diff --git a/app.py b/app.py index 13d6afd..d73ee58 100644 --- a/app.py +++ b/app.py @@ -1,11 +1,16 @@ import codecs from typing import List -from fastapi import FastAPI +from fastapi import FastAPI, Response from fastapi.responses import FileResponse import uvicorn import os -from scripts.iib.api import infinite_image_browsing_api, index_html_path -from scripts.iib.tool import get_sd_webui_conf, get_valid_img_dirs, sd_img_dirs, normalize_paths +from scripts.iib.api import infinite_image_browsing_api, index_html_path, DEFAULT_BASE +from scripts.iib.tool import ( + get_sd_webui_conf, + get_valid_img_dirs, + sd_img_dirs, + normalize_paths, +) from scripts.iib.db.datamodel import DataBase, Image from scripts.iib.db.update_image_data import update_image_data import argparse @@ -70,6 +75,8 @@ class AppUtils: allow_cors=False, enable_shutdown=False, sd_webui_dir: Optional[str] = None, + base="", + export_fe_fn=False, ): """ Parameter definitions can be found by running the `python app.py -h `command or by examining the setup_parser() function. @@ -81,6 +88,8 @@ class AppUtils: self.allow_cors = allow_cors self.enable_shutdown = enable_shutdown self.sd_webui_dir = sd_webui_dir + self.base = base + self.export_fe_fn = export_fe_fn if sd_webui_dir: DataBase.path = os.path.join( sd_webui_dir, "extensions/sd-webui-infinite-image-browsing/iib.db" @@ -93,7 +102,9 @@ class AppUtils: self.__init__(*args, **kwargs) @staticmethod - def async_run(app: FastAPI, port: int = default_port, host = default_host) -> Coroutine: + def async_run( + app: FastAPI, port: int = default_port, host=default_host + ) -> Coroutine: """ 用于从异步运行的 FastAPI,在 Jupyter Notebook 环境中非常有用 """ @@ -127,6 +138,8 @@ class AppUtils: allow_cors=self.allow_cors, enable_shutdown=self.enable_shutdown, launch_mode="server", + base=self.base, + export_fe_fn=self.export_fe_fn, ) def get_root_browser_app(self) -> FastAPI: @@ -138,6 +151,10 @@ class AppUtils: # 用于在首页显示 @app.get("/") def index(): + if self.base and self.base != DEFAULT_BASE: + with open(index_html_path, "r", encoding="utf-8") as file: + content = file.read().replace(DEFAULT_BASE, self.base) + return Response(content=content, media_type="text/html") return FileResponse(index_html_path) self.wrap_app(app) @@ -187,10 +204,18 @@ def setup_parser() -> argparse.ArgumentParser: default=None, help="The path to the sd_webui folder. When specified, the sd_webui's configuration will be used and the extension must be installed within the sd_webui. Data will be shared between the two.", ) + parser.add_argument( + "--export_fe_fn", + action="store_true", + help="Export front-end functions to enable external access through iframe.", + ) + parser.add_argument("--base", type=str, help="The base URL for the IIB Api.") return parser -def launch_app(port: int = default_port, host: str = default_host, *args, **kwargs: dict) -> None: +def launch_app( + port: int = default_port, host: str = default_host, *args, **kwargs: dict +) -> None: """ Launches the application on the specified port. @@ -203,7 +228,9 @@ def launch_app(port: int = default_port, host: str = default_host, *args, **kwar uvicorn.run(app, host=host, port=port) -async def async_launch_app(port: int = default_port, host: str = default_host, *args, **kwargs: dict) -> None: +async def async_launch_app( + port: int = default_port, host: str = default_host, *args, **kwargs: dict +) -> None: """ Asynchronously launches the application on the specified port. diff --git a/javascript/index.js b/javascript/index.js index 8b0e7c3..0f5b011 100644 --- a/javascript/index.js +++ b/javascript/index.js @@ -14,6 +14,8 @@ Promise.resolve().then(async () => {
1){var p=l.find(function(g){return g.isIntersecting});p&&(d=p)}if(a.callback){var E=d.isIntersecting&&d.intersectionRatio>=a.threshold;if(E===a.oldResult)return;a.oldResult=E,a.callback(E,d)}},this.options.intersection),zt(function(){a.observer&&a.observer.observe(a.el)})}}},{key:"destroyObserver",value:function(){this.observer&&(this.observer.disconnect(),this.observer=null),this.callback&&this.callback._clear&&(this.callback._clear(),this.callback=null)}},{key:"threshold",get:function(){return this.options.intersection&&typeof this.options.intersection.threshold=="number"?this.options.intersection.threshold:0}}]),e}();function Jt(e,t,n){var i=t.value;if(i)if(typeof IntersectionObserver>"u")console.warn("[vue-observe-visibility] IntersectionObserver API is not available in your browser. Please install this polyfill: https://github.com/w3c/IntersectionObserver/tree/master/polyfill");else{var a=new ha(e,i,n);e._vue_visibilityState=a}}function ma(e,t,n){var i=t.value,a=t.oldValue;if(!Ut(i,a)){var r=e._vue_visibilityState;if(!i){Wt(e);return}r?r.createObserver(i,n):Jt(e,{value:i},n)}}function Wt(e){var t=e._vue_visibilityState;t&&(t.destroyObserver(),delete e._vue_visibilityState)}var ga={beforeMount:Jt,updated:ma,unmounted:Wt},ya={itemsLimit:1e3},ba=/(auto|scroll)/;function Kt(e,t){return e.parentNode===null?t:Kt(e.parentNode,t.concat([e]))}var Re=function(t,n){return getComputedStyle(t,null).getPropertyValue(n)},wa=function(t){return Re(t,"overflow")+Re(t,"overflow-y")+Re(t,"overflow-x")},Aa=function(t){return ba.test(wa(t))};function Et(e){if(e instanceof HTMLElement||e instanceof SVGElement){for(var t=Kt(e.parentNode,[]),n=0;n p&&(c=p)),S=o;S p&&(c=p),S<0&&(S=0),h>p&&(h=p),y=Math.ceil(p/i)*n}}c-o>ya.itemsLimit&&this.itemsLimitError(),this.totalSize=y;let u;const C=o<=this.$_endIndex&&c>=this.$_startIndex;if(C)for(let I=0,Q=v.length;I 1&&arguments[1]!==void 0?arguments[1]:!1;g.activeIndex=O;var P={source:I?"keyboard":"mouse"},k=s.value[O];if(!k){o.onActiveValue(null,-1,P);return}o.onActiveValue(k.value,O,P)};pe([function(){return s.value.length},function(){return i.searchValue}],function(){c(o.defaultActiveFirstOption!==!1?h(0):-1)},{immediate:!0});var d=function(O){return o.rawValues.has(O)&&i.mode!=="combobox"};pe([function(){return i.open},function(){return i.searchValue}],function(){if(!i.multiple&&i.open&&o.rawValues.size===1){var _=Array.from(o.rawValues)[0],O=Me(s.value).findIndex(function(I){var P=I.data;return P[o.fieldNames.value]===_});O!==-1&&(c(O),Ke(function(){v(O)}))}i.open&&Ke(function(){var I;(I=u.current)===null||I===void 0||I.scrollTo(void 0)})},{immediate:!0,flush:"post"});var m=function(O){O!==void 0&&o.onSelect(O,{selected:!o.rawValues.has(O)}),i.multiple||i.toggleOpen(!1)},p=function(O){return typeof O.label=="function"?O.label():O.label};function y(_){var O=s.value[_];if(!O)return null;var I=O.data||{},P=I.value,k=O.group,L=zs(I,!0),F=p(O);return O?x("div",T(T({"aria-label":typeof F=="string"&&!k?F:null},L),{},{key:_,role:k?"presentation":"option",id:"".concat(i.id,"_list_").concat(_),"aria-selected":d(P)}),[P]):null}var b=function(O){var I=O.which,P=O.ctrlKey;switch(I){case Ce.N:case Ce.P:case Ce.UP:case Ce.DOWN:{var k=0;if(I===Ce.UP?k=-1:I===Ce.DOWN?k=1:nN()&&P&&(I===Ce.N?k=1:I===Ce.P&&(k=-1)),k!==0){var L=h(g.activeIndex+k,k);v(L),c(L,!0)}break}case Ce.ENTER:{var F=s.value[g.activeIndex];F&&!F.data.disabled?m(F.value):m(void 0),i.open&&O.preventDefault();break}case Ce.ESC:i.toggleOpen(!1),i.open&&O.stopPropagation()}},w=function(){},C=function(O){v(O)};return r({onKeydown:b,onKeyup:w,scrollTo:C}),function(){var _=i.id,O=i.notFoundContent,I=i.onPopupScroll,P=o.menuItemSelectedIcon,k=o.fieldNames,L=o.virtual,F=o.listHeight,j=o.listItemHeight,z=a.option,$=g.activeIndex,M=Object.keys(k).map(function(A){return k[A]});return s.value.length===0?x("div",{role:"listbox",id:"".concat(_,"_list"),class:"".concat(l.value,"-empty"),onMousedown:f},[O]):x(De,null,[x("div",{role:"listbox",id:"".concat(_,"_list"),style:{height:0,width:0,overflow:"hidden"}},[y($-1),y($),y($+1)]),x(eN,{itemKey:"key",ref:u,data:s.value,height:F,itemHeight:j,fullHeight:!1,onMousedown:f,onScroll:I,virtual:L},{default:function(N,D){var q,ee=N.group,Z=N.groupOption,Y=N.data,G=N.value,ne=Y.key,oe=typeof N.label=="function"?N.label():N.label;if(ee){var de,me=(de=Y.title)!==null&&de!==void 0?de:Zh(oe)&&oe;return x("div",{class:ge(l.value,"".concat(l.value,"-group")),title:me},[z?z(Y):oe!==void 0?oe:ne])}var ve=Y.disabled,he=Y.title;Y.children;var ye=Y.style,R=Y.class,S=Y.className,E=ut(Y,iN),B=xt(E,M),H=d(G),Q="".concat(l.value,"-option"),ae=ge(l.value,Q,R,S,(q={},te(q,"".concat(Q,"-grouped"),Z),te(q,"".concat(Q,"-active"),$===D&&!ve),te(q,"".concat(Q,"-disabled"),ve),te(q,"".concat(Q,"-selected"),H),q)),ie=p(N),re=!P||typeof P=="function"||H,X=typeof ie=="number"?ie:ie||G,V=Zh(X)?X.toString():void 0;return he!==void 0&&(V=he),x("div",T(T({},B),{},{"aria-selected":H,class:ae,title:V,onMousemove:function(se){E.onMousemove&&E.onMousemove(se),!($===D||ve)&&c(D)},onClick:function(se){ve||m(G),E.onClick&&E.onClick(se)},style:ye}),[x("div",{class:"".concat(Q,"-content")},[z?z(Y):X]),ir(P)||H,re&&x(ts,{class:"".concat(l.value,"-option-state"),customizeIcon:P,customizeIconProps:{isSelected:H}},{default:function(){return[H?"✓":null]}})])}})])}}});const lN=oN;var sN=["value","disabled"];function uN(t){var e=t.key,n=t.children,r=t.props,a=r.value,i=r.disabled,o=ut(r,sN),l=n==null?void 0:n.default;return T({key:e,value:a!==void 0?a:e,children:l,disabled:i||i===""},o)}function Uw(t){var e=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,n=pn(t).map(function(r,a){var i;if(!ir(r)||!r.type)return null;var o=r.type.isSelectOptGroup,l=r.key,s=r.children,u=r.props;if(e||!o)return uN(r);var f=s&&s.default?s.default():void 0,v=(u==null?void 0:u.label)||((i=s.label)===null||i===void 0?void 0:i.call(s))||l;return T(T({key:"__RC_SELECT_GRP__".concat(l===null?a:String(l),"__")},u),{},{label:v,options:Uw(f||[])})}).filter(function(r){return r});return n}function cN(t,e,n){var r=$n(),a=$n(),i=$n(),o=$n([]);return pe([t,e],function(){t.value?o.value=Me(t.value).slice():o.value=Uw(e.value)},{immediate:!0,deep:!0}),st(function(){var l=o.value,s=new Map,u=new Map,f=n.value;function v(h){for(var g=arguments.length>1&&arguments[1]!==void 0?arguments[1]:!1,c=0;c =A*2&&w!==1+2&&(k[0]=x(ra,{locale:l,rootPrefixCls:r,onClick:this.handleChange,onKeypress:this.runIfEnter,key:de,page:de,class:"".concat(r,"-item-after-jump-prev"),active:!1,showTitle:this.showTitle,itemRender:g},null),k.unshift(L)),P-w>=A*2&&w!==P-2&&(k[k.length-1]=x(ra,{locale:l,rootPrefixCls:r,onClick:this.handleChange,onKeypress:this.runIfEnter,key:me,page:me,class:"".concat(r,"-item-before-jump-next"),active:!1,showTitle:this.showTitle,itemRender:g},null),k.push(F)),de!==1&&k.unshift(j),me!==P&&k.push(z)}var ye=null;v&&(ye=x("li",{class:"".concat(r,"-total-text")},[v(o,[o===0?0:(w-1)*C+1,w*C>o?o:w*C])]));var R=!q||!P,S=!ee||!P,E=this.buildOptionText||this.$slots.buildOptionText;return x("ul",T(T({unselectable:"on",ref:"paginationNode"},I),{},{class:ge((e={},te(e,"".concat(r),!0),te(e,"".concat(r,"-disabled"),a),e),O)}),[ye,x("li",{title:f?l.prev_page:null,onClick:this.prev,tabindex:R?null:0,onKeypress:this.runIfEnterPrev,class:ge("".concat(r,"-prev"),te({},"".concat(r,"-disabled"),R)),"aria-disabled":R},[this.renderPrev(N)]),k,x("li",{title:f?l.next_page:null,onClick:this.next,tabindex:S?null:0,onKeypress:this.runIfEnterNext,class:ge("".concat(r,"-next"),te({},"".concat(r,"-disabled"),S)),"aria-disabled":S},[this.renderNext(D)]),x(IF,{disabled:a,locale:l,rootPrefixCls:r,selectComponentClass:p,selectPrefixCls:y,changeSize:this.getShowSizeChanger()?this.changePageSize:null,current:w,pageSize:C,pageSizeOptions:b,buildOptionText:E||null,quickGo:this.shouldDisplayQuickJumper()?this.handleChange:null,goButton:M},null)])}});var RF=["size","itemRender","buildOptionText","selectComponentClass","responsive"],LF=function(){return{total:Number,defaultCurrent:Number,disabled:{type:Boolean,default:void 0},current:Number,defaultPageSize:Number,pageSize:Number,hideOnSinglePage:{type:Boolean,default:void 0},showSizeChanger:{type:Boolean,default:void 0},pageSizeOptions:Array,buildOptionText:Function,showQuickJumper:{type:[Boolean,Object],default:void 0},showTotal:Function,size:String,simple:{type:Boolean,default:void 0},locale:Object,prefixCls:String,selectPrefixCls:String,totalBoundaryShowSizeChanger:Number,selectComponentClass:String,itemRender:Function,role:String,responsive:Boolean,showLessItems:{type:Boolean,default:void 0},onChange:Function,onShowSizeChange:Function,"onUpdate:current":Function,"onUpdate:pageSize":Function}};const DF=fe({compatConfig:{MODE:3},name:"APagination",inheritAttrs:!1,props:LF(),setup:function(e,n){var r=n.slots,a=n.attrs,i=Ze("pagination",e),o=i.prefixCls,l=i.configProvider,s=i.direction,u=K(function(){return l.getPrefixCls("select",e.selectPrefixCls)}),f=$N(),v=ed("Pagination",p0,Ut(e,"locale")),h=_e(v,1),g=h[0],c=function(m){var p=x("span",{class:"".concat(m,"-item-ellipsis")},[Fn("•••")]),y=x("button",{class:"".concat(m,"-item-link"),type:"button",tabindex:-1},[x(TC,null,null)]),b=x("button",{class:"".concat(m,"-item-link"),type:"button",tabindex:-1},[x(tC,null,null)]),w=x("a",{rel:"nofollow",class:"".concat(m,"-item-link")},[x("div",{class:"".concat(m,"-item-container")},[x(SF,{class:"".concat(m,"-item-link-icon")},null),p])]),C=x("a",{rel:"nofollow",class:"".concat(m,"-item-link")},[x("div",{class:"".concat(m,"-item-container")},[x(EF,{class:"".concat(m,"-item-link-icon")},null),p])]);if(s.value==="rtl"){var _=[b,y];y=_[0],b=_[1];var O=[C,w];w=O[0],C=O[1]}return{prevIcon:y,nextIcon:b,jumpPrevIcon:w,jumpNextIcon:C}};return function(){var d,m=e.size,p=e.itemRender,y=p===void 0?r.itemRender:p,b=e.buildOptionText,w=b===void 0?r.buildOptionText:b,C=e.selectComponentClass,_=e.responsive,O=ut(e,RF),I=m==="small"||!!((d=f.value)!==null&&d!==void 0&&d.xs&&!m&&_),P=T(T(T(T({},O),c(o.value)),{},{prefixCls:o.value,selectPrefixCls:u.value,selectComponentClass:C||(I?TF:as),locale:g.value,buildOptionText:w},a),{},{class:ge(te({mini:I},"".concat(o.value,"-rtl"),s.value==="rtl"),a.class),itemRender:y});return x($F,P,null)}}}),FF=No(DF);var BF=["prefixCls","visible","wrapClassName","centered","getContainer","closeIcon","focusTriggerAfterClose"],Qc=null,jF=function(e){Qc={x:e.pageX,y:e.pageY},setTimeout(function(){return Qc=null},100)};EC()&&Sn(document.documentElement,"click",jF,!0);var zF=function(){return{prefixCls:String,visible:{type:Boolean,default:void 0},confirmLoading:{type:Boolean,default:void 0},title:J.any,closable:{type:Boolean,default:void 0},closeIcon:J.any,onOk:Function,onCancel:Function,"onUpdate:visible":Function,onChange:Function,afterClose:Function,centered:{type:Boolean,default:void 0},width:[String,Number],footer:J.any,okText:J.any,okType:String,cancelText:J.any,icon:J.any,maskClosable:{type:Boolean,default:void 0},forceRender:{type:Boolean,default:void 0},okButtonProps:Object,cancelButtonProps:Object,destroyOnClose:{type:Boolean,default:void 0},wrapClassName:String,maskTransitionName:String,transitionName:String,getContainer:{type:[String,Function,Boolean,Object],default:void 0},zIndex:Number,bodyStyle:{type:Object,default:void 0},maskStyle:{type:Object,default:void 0},mask:{type:Boolean,default:void 0},keyboard:{type:Boolean,default:void 0},wrapProps:Object,focusTriggerAfterClose:{type:Boolean,default:void 0},modalRender:Function}},za=[];const Xt=fe({compatConfig:{MODE:3},name:"AModal",inheritAttrs:!1,props:Jt(zF(),{width:520,transitionName:"zoom",maskTransitionName:"fade",confirmLoading:!1,visible:!1,okType:"primary"}),setup:function(e,n){var r=n.emit,a=n.slots,i=n.attrs,o=ed("Modal"),l=_e(o,1),s=l[0],u=Ze("modal",e),f=u.prefixCls,v=u.rootPrefixCls,h=u.direction,g=u.getPopupContainer,c=function(y){r("update:visible",!1),r("cancel",y),r("change",!1)},d=function(y){r("ok",y)},m=function(){var y,b,w=e.okText,C=w===void 0?(y=a.okText)===null||y===void 0?void 0:y.call(a):w,_=e.okType,O=e.cancelText,I=O===void 0?(b=a.cancelText)===null||b===void 0?void 0:b.call(a):O,P=e.confirmLoading;return x(De,null,[x(Tn,T({onClick:c},e.cancelButtonProps),{default:function(){return[I||s.value.cancelText]}}),x(Tn,T(T({},Jw(_)),{},{loading:P,onClick:d},e.okButtonProps),{default:function(){return[C||s.value.okText]}})])};return function(){var p,y;e.prefixCls;var b=e.visible,w=e.wrapClassName,C=e.centered,_=e.getContainer,O=e.closeIcon,I=O===void 0?(p=a.closeIcon)===null||p===void 0?void 0:p.call(a):O,P=e.focusTriggerAfterClose,k=P===void 0?!0:P,L=ut(e,BF),F=ge(w,(y={},te(y,"".concat(f.value,"-centered"),!!C),te(y,"".concat(f.value,"-wrap-rtl"),h.value==="rtl"),y));return x(YC,T(T(T({},L),i),{},{getContainer:_||g.value,prefixCls:f.value,wrapClassName:F,visible:b,mousePosition:Qc,onClose:c,focusTriggerAfterClose:k,transitionName:Ca(v.value,"zoom",e.transitionName),maskTransitionName:Ca(v.value,"fade",e.maskTransitionName)}),T(T({},a),{},{footer:a.footer||m,closeIcon:function(){return x("span",{class:"".concat(f.value,"-close-x")},[I||x(Ci,{class:"".concat(f.value,"-close-icon")},null)])}}))}}});var WF=function(){var e=W(!1);return Qe(function(){e.value=!0}),e};const VF=WF;var HF={type:{type:String},actionFn:Function,close:Function,autofocus:Boolean,prefixCls:String,buttonProps:Object,emitEvent:Boolean,quitOnNullishReturnValue:Boolean};function Ag(t){return!!(t&&t.then)}const Mg=fe({compatConfig:{MODE:3},name:"ActionButton",props:HF,setup:function(e,n){var r=n.slots,a=W(!1),i=W(),o=W(!1),l,s=VF();Re(function(){e.autofocus&&(l=setTimeout(function(){var v;return(v=i.value.$el)===null||v===void 0?void 0:v.focus()}))}),Qe(function(){clearTimeout(l)});var u=function(h){var g=e.close;Ag(h)&&(o.value=!0,h.then(function(){s.value||(o.value=!1),g.apply(void 0,arguments),a.value=!1},function(c){console.error(c),s.value||(o.value=!1),a.value=!1}))},f=function(h){var g=e.actionFn,c=e.close,d=c===void 0?function(){}:c;if(!a.value){if(a.value=!0,!g){d();return}var m;if(e.emitEvent){if(m=g(h),e.quitOnNullishReturnValue&&!Ag(m)){a.value=!1,d(h);return}}else if(g.length)m=g(d),a.value=!1;else if(m=g(),!m){d();return}u(m)}};return function(){var v=e.type,h=e.prefixCls,g=e.buttonProps;return x(Tn,T(T(T({},Jw(v)),{},{onClick:f,loading:o.value,prefixCls:h},g),{},{ref:i}),r)}}});function Li(t){return typeof t=="function"?t():t}const UF=fe({name:"ConfirmDialog",inheritAttrs:!1,props:["icon","onCancel","onOk","close","closable","zIndex","afterClose","visible","keyboard","centered","getContainer","maskStyle","okButtonProps","cancelButtonProps","okType","prefixCls","okCancel","width","mask","maskClosable","okText","cancelText","autoFocusButton","transitionName","maskTransitionName","type","title","content","direction","rootPrefixCls","bodyStyle","closeIcon","modalRender","focusTriggerAfterClose","wrapClassName"],setup:function(e,n){var r=n.attrs,a=ed("Modal"),i=_e(a,1),o=i[0];return function(){var l=e.icon,s=e.onCancel,u=e.onOk,f=e.close,v=e.closable,h=v===void 0?!1:v,g=e.zIndex,c=e.afterClose,d=e.visible,m=e.keyboard,p=e.centered,y=e.getContainer,b=e.maskStyle,w=e.okButtonProps,C=e.cancelButtonProps,_=e.okCancel,O=_===void 0?!0:_,I=e.width,P=I===void 0?416:I,k=e.mask,L=k===void 0?!0:k,F=e.maskClosable,j=F===void 0?!1:F,z=e.type,$=e.title,M=e.content,A=e.direction,N=e.closeIcon,D=e.modalRender,q=e.focusTriggerAfterClose,ee=e.rootPrefixCls,Z=e.bodyStyle,Y=e.wrapClassName,G=e.okType||"primary",ne=e.prefixCls||"ant-modal",oe="".concat(ne,"-confirm"),de=r.style||{},me=Li(e.okText)||(O?o.value.okText:o.value.justOkText),ve=Li(e.cancelText)||o.value.cancelText,he=e.autoFocusButton===null?!1:e.autoFocusButton||"ok",ye=ge(oe,"".concat(oe,"-").concat(z),"".concat(ne,"-").concat(z),te({},"".concat(oe,"-rtl"),A==="rtl"),r.class),R=O&&x(Mg,{actionFn:s,close:f,autofocus:he==="cancel",buttonProps:C,prefixCls:"".concat(ee,"-btn")},{default:function(){return[ve]}});return x(Xt,{prefixCls:ne,class:ye,wrapClassName:ge(te({},"".concat(oe,"-centered"),!!p),Y),onCancel:function(E){return f({triggerCancel:!0},E)},visible:d,title:"",footer:"",transitionName:Ca(ee,"zoom",e.transitionName),maskTransitionName:Ca(ee,"fade",e.maskTransitionName),mask:L,maskClosable:j,maskStyle:b,style:de,bodyStyle:Z,width:P,zIndex:g,afterClose:c,keyboard:m,centered:p,getContainer:y,closable:h,closeIcon:N,modalRender:D,focusTriggerAfterClose:q},{default:function(){return[x("div",{class:"".concat(oe,"-body-wrapper")},[x("div",{class:"".concat(oe,"-body")},[Li(l),$===void 0?null:x("span",{class:"".concat(oe,"-title")},[Li($)]),x("div",{class:"".concat(oe,"-content")},[Li(M)])]),x("div",{class:"".concat(oe,"-btns")},[R,x(Mg,{type:G,actionFn:u,close:f,autofocus:he==="ok",buttonProps:w,prefixCls:"".concat(ee,"-btn")},{default:function(){return[me]}})])])]}})}}});var KF=function(e){var n=document.createDocumentFragment(),r=T(T({},xt(e,["parentContext","appContext"])),{},{close:o,visible:!0}),a=null;function i(){a&&(Ul(null,n),a.component.update(),a=null);for(var f=arguments.length,v=new Array(f),h=0;h I){if(!d)try{return e.codec.base32hex.toBits(c)}catch{}throw new e.exception.invalid("this isn't "+P+"!")}C>y?(C-=y,b.push(O^I>>>C),O=I< >>1|(b[p-1]&1)<<31;b[0]>>>=1,w&&(b[0]^=-520093696)}return y},j:function(c,d,m){var p,y=m.length;for(d=d.slice(0),p=0;p=c)&&this.unuseView(u));const A=C?null:new Map;let P,_,T;for(let I=o;I
{const i=r.fn(...a);return i&&(i.key=r.key),i}:r.fn)}return t}function Wl(t,e,n={},r,a){if(kt.isCE||kt.parent&&Ki(kt.parent)&&kt.parent.isCE)return e!=="default"&&(n.name=e),x("slot",n,r&&r());let i=t[e];i&&i._c&&(i._d=!1),Xe();const o=i&&Pb(i(n)),l=Yt(De,{key:n.key||o&&o.key||`_${e}`},o||(r?r():[]),o&&t._===1?64:-2);return!a&&l.scopeId&&(l.slotScopeIds=[l.scopeId+"-s"]),i&&i._c&&(i._d=!0),l}function Pb(t){return t.some(e=>rr(e)?!(e.type===vn||e.type===De&&!Pb(e.children)):!0)?t:null}function U7(t,e){const n={};for(const r in t)n[e&&/[A-Z]/.test(r)?`on:${r}`:Sl(r)]=t[r];return n}const sc=t=>t?Lb(t)?Ts(t)||t.proxy:sc(t.parent):null,Gi=ht(Object.create(null),{$:t=>t,$el:t=>t.vnode.el,$data:t=>t.data,$props:t=>t.props,$attrs:t=>t.attrs,$slots:t=>t.slots,$refs:t=>t.refs,$parent:t=>sc(t.parent),$root:t=>sc(t.root),$emit:t=>t.emit,$options:t=>Vf(t),$forceUpdate:t=>t.f||(t.f=()=>_s(t.update)),$nextTick:t=>t.n||(t.n=Ke.bind(t.proxy)),$watch:t=>ox.bind(t)}),pu=(t,e)=>t!==at&&!t.__isScriptSetup&&We(t,e),bx={get({_:t},e){const{ctx:n,setupState:r,data:a,props:i,accessCache:o,type:l,appContext:s}=t;let u;if(e[0]!=="$"){const g=o[e];if(g!==void 0)switch(g){case 1:return r[e];case 2:return a[e];case 4:return n[e];case 3:return i[e]}else{if(pu(r,e))return o[e]=1,r[e];if(a!==at&&We(a,e))return o[e]=2,a[e];if((u=t.propsOptions[0])&&We(u,e))return o[e]=3,i[e];if(n!==at&&We(n,e))return o[e]=4,n[e];uc&&(o[e]=0)}}const f=Gi[e];let v,h;if(f)return e==="$attrs"&&an(t,"get",e),f(t);if((v=l.__cssModules)&&(v=v[e]))return v;if(n!==at&&We(n,e))return o[e]=4,n[e];if(h=s.config.globalProperties,We(h,e))return h[e]},set({_:t},e,n){const{data:r,setupState:a,ctx:i}=t;return pu(a,e)?(a[e]=n,!0):r!==at&&We(r,e)?(r[e]=n,!0):We(t.props,e)||e[0]==="$"&&e.slice(1)in t?!1:(i[e]=n,!0)},has({_:{data:t,setupState:e,accessCache:n,ctx:r,appContext:a,propsOptions:i}},o){let l;return!!n[o]||t!==at&&We(t,o)||pu(e,o)||(l=i[0])&&We(l,o)||We(r,o)||We(Gi,o)||We(a.config.globalProperties,o)},defineProperty(t,e,n){return n.get!=null?t._.accessCache[e]=0:We(n,"value")&&this.set(t,e,n.value,null),Reflect.defineProperty(t,e,n)}};function K7(t,e,n){const r=bt();if(n&&n.local){const a=W(t[e]);return pe(()=>t[e],i=>a.value=i),pe(a,i=>{i!==t[e]&&r.emit(`update:${e}`,i)}),a}else return{__v_isRef:!0,get value(){return t[e]},set value(a){r.emit(`update:${e}`,a)}}}function Vl(t){return Se(t)?t.reduce((e,n)=>(e[n]=null,e),{}):t}function G7(t,e){return!t||!e?t||e:Se(t)&&Se(e)?t.concat(e):ht({},Vl(t),Vl(e))}let uc=!0;function wx(t){const e=Vf(t),n=t.proxy,r=t.ctx;uc=!1,e.beforeCreate&&Zv(e.beforeCreate,t,"bc");const{data:a,computed:i,methods:o,watch:l,provide:s,inject:u,created:f,beforeMount:v,mounted:h,beforeUpdate:g,updated:c,activated:d,deactivated:m,beforeDestroy:p,beforeUnmount:y,destroyed:b,unmounted:w,render:C,renderTracked:_,renderTriggered:O,errorCaptured:I,serverPrefetch:P,expose:k,inheritAttrs:L,components:F,directives:j,filters:z}=e;if(u&&Cx(u,r,null),o)for(const A in o){const N=o[A];ke(N)&&(r[A]=N.bind(n))}if(a){const A=a.call(n,n);nt(A)&&(t.data=ot(A))}if(uc=!0,i)for(const A in i){const N=i[A],D=ke(N)?N.bind(n,n):ke(N.get)?N.get.bind(n,n):Dn,q=!ke(N)&&ke(N.set)?N.set.bind(n):Dn,ee=K({get:D,set:q});Object.defineProperty(r,A,{enumerable:!0,configurable:!0,get:()=>ee.value,set:Z=>ee.value=Z})}if(l)for(const A in l)Ob(l[A],r,n,A);if(s){const A=ke(s)?s.call(n):s;Reflect.ownKeys(A).forEach(N=>{ct(N,A[N])})}f&&Zv(f,t,"c");function M(A,N){Se(N)?N.forEach(D=>A(D.bind(n))):N&&A(N.bind(n))}if(M(jf,v),M(Re,h),M(_b,g),M(Gr,c),M(ux,d),M(cx,m),M(hx,I),M(px,_),M(vx,O),M(Qe,y),M(on,w),M(dx,P),Se(k))if(k.length){const A=t.exposed||(t.exposed={});k.forEach(N=>{Object.defineProperty(A,N,{get:()=>n[N],set:D=>n[N]=D})})}else t.exposed||(t.exposed={});C&&t.render===Dn&&(t.render=C),L!=null&&(t.inheritAttrs=L),F&&(t.components=F),j&&(t.directives=j)}function Cx(t,e,n=Dn){Se(t)&&(t=cc(t));for(const r in t){const a=t[r];let i;nt(a)?"default"in a?i=Ye(a.from||r,a.default,!0):i=Ye(a.from||r):i=Ye(a),tt(i)?Object.defineProperty(e,r,{enumerable:!0,configurable:!0,get:()=>i.value,set:o=>i.value=o}):e[r]=i}}function Zv(t,e,n){On(Se(t)?t.map(r=>r.bind(e.proxy)):t.bind(e.proxy),e,n)}function Ob(t,e,n,r){const a=r.includes(".")?gb(n,r):()=>n[r];if(vt(t)){const i=e[t];ke(i)&&pe(a,i)}else if(ke(t))pe(a,t.bind(n));else if(nt(t))if(Se(t))t.forEach(i=>Ob(i,e,n,r));else{const i=ke(t.handler)?t.handler.bind(n):e[t.handler];ke(i)&&pe(a,i,t)}}function Vf(t){const e=t.type,{mixins:n,extends:r}=e,{mixins:a,optionsCache:i,config:{optionMergeStrategies:o}}=t.appContext,l=i.get(e);let s;return l?s=l:!a.length&&!n&&!r?s=e:(s={},a.length&&a.forEach(u=>Hl(s,u,o,!0)),Hl(s,e,o)),nt(e)&&i.set(e,s),s}function Hl(t,e,n,r=!1){const{mixins:a,extends:i}=e;i&&Hl(t,i,n,!0),a&&a.forEach(o=>Hl(t,o,n,!0));for(const o in e)if(!(r&&o==="expose")){const l=_x[o]||n&&n[o];t[o]=l?l(t[o],e[o]):e[o]}return t}const _x={data:ep,props:tp,emits:tp,methods:zi,computed:zi,beforeCreate:Vt,created:Vt,beforeMount:Vt,mounted:Vt,beforeUpdate:Vt,updated:Vt,beforeDestroy:Vt,beforeUnmount:Vt,destroyed:Vt,unmounted:Vt,activated:Vt,deactivated:Vt,errorCaptured:Vt,serverPrefetch:Vt,components:zi,directives:zi,watch:xx,provide:ep,inject:Sx};function ep(t,e){return e?t?function(){return ht(ke(t)?t.call(this,this):t,ke(e)?e.call(this,this):e)}:e:t}function Sx(t,e){return zi(cc(t),cc(e))}function cc(t){if(Se(t)){const e={};for(let n=0;n(n[c]||"").split(", "),a=r(`${Ar}Delay`),i=r(`${Ar}Duration`),o=wp(a,i),l=r(`${Ei}Delay`),s=r(`${Ei}Duration`),u=wp(l,s);let f=null,v=0,h=0;e===Ar?o>0&&(f=Ar,v=o,h=i.length):e===Ei?u>0&&(f=Ei,v=u,h=s.length):(v=Math.max(o,u),f=v>0?o>u?Ar:Ei:null,h=f?f===Ar?i.length:s.length:0);const g=f===Ar&&/\b(transform|all)(,|$)/.test(r(`${Ar}Property`).toString());return{type:f,timeout:v,propCount:h,hasTransform:g}}function wp(t,e){for(;t.length1&&(Y=x("div",{class:"".concat(z,"-content")},[Y]));var G=ge(z,a.class,s.value),ne=c.value||!e.visible,oe=ne?Ns(I.value.name,I.value):{};return x(sr,T(T({ref:l},oe),{},{onBeforeEnter:P}),{default:function(){return!$||e.visible?lr(x(zM,{target:C(),key:"popup",ref:o,monitorWindowResize:!0,disabled:k.value,align:j,onAlign:O},{default:function(){return x("div",T(T({class:G,onMouseenter:M,onMouseleave:A,onMousedown:Ln(q,["capture"])},te({},Kt?"onTouchstartPassive":"onTouchstart",Ln(D,["capture"]))),{},{style:Z}),[Y])}}),[[Is,c.value]]):null}})}}}),VM=fe({compatConfig:{MODE:3},name:"Popup",inheritAttrs:!1,props:PI,setup:function(e,n){var r=n.attrs,a=n.slots,i=n.expose,o=W(!1),l=W(!1),s=W();return pe([function(){return e.visible},function(){return e.mobile}],function(){o.value=e.visible,e.visible&&e.mobile&&(l.value=!0)},{immediate:!0,flush:"post"}),i({forceAlign:function(){var f;(f=s.value)===null||f===void 0||f.forceAlign()},getElement:function(){var f;return(f=s.value)===null||f===void 0?void 0:f.getElement()}}),function(){var u=T(T(T({},e),r),{},{visible:o.value}),f=l.value?x(OI,T(T({},u),{},{mobile:e.mobile,ref:s}),{default:a.default}):x(WM,T(T({},u),{},{ref:s}),{default:a.default});return x("div",null,[x(cw,u,null),f])}}});function HM(t,e,n){return n?t[0]===e[0]:t[0]===e[0]&&t[1]===e[1]}function Kh(t,e,n){var r=t[e]||{};return T(T({},r),n)}function UM(t,e,n,r){for(var a=n.points,i=Object.keys(t),o=0;o