From b86ccba7778216eebd05f3a4d47369dded55ce0b Mon Sep 17 00:00:00 2001 From: sunhao Date: Tue, 3 Dec 2024 09:11:10 +0800 Subject: [PATCH] * [misc] update zui3 lib. --- www/js/zui3/zui.zentao.js | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/www/js/zui3/zui.zentao.js b/www/js/zui3/zui.zentao.js index 804b8a9ab6..5f49280513 100644 --- a/www/js/zui3/zui.zentao.js +++ b/www/js/zui3/zui.zentao.js @@ -6,6 +6,6 @@ var pu=(I,et,Dt)=>{if(!et.has(I))throw TypeError("Cannot "+Dt)};var $t=(I,et,Dt) `)}function wn(h,f,m,_){this.failures=f,this.failedKeys=_,this.successCount=m,this.message=bn(h,f)}function kt(h,f){this.name="BulkError",this.failures=Object.keys(f).map(function(m){return f[m]}),this.failuresByPos=f,this.message=bn(h,this.failures)}C(gt).from(Error).extend({toString:function(){return this.name+": "+this.message}}),C(wn).from(gt),C(kt).from(gt);var qn=Bt.reduce(function(h,f){return h[f]=f+"Error",h},{}),on=gt,de=Bt.reduce(function(h,f){var m=f+"Error";function _(w,T){this.name=m,w?typeof w=="string"?(this.message="".concat(w).concat(T?` `+T:""),this.inner=T||null):typeof w=="object"&&(this.message="".concat(w.name," ").concat(w.message),this.inner=w):(this.message=Kn[f]||m,this.inner=null)}return C(_).from(on),h[f]=_,h},{});de.Syntax=SyntaxError,de.Type=TypeError,de.Range=RangeError;var pr=yr.reduce(function(h,f){return h[f+"Error"]=de[f],h},{}),Ca=Bt.reduce(function(h,f){return["Syntax","Type","Range"].indexOf(f)===-1&&(h[f+"Error"]=de[f]),h},{});function He(){}function mr(h){return h}function fw(h,f){return h==null||h===mr?f:function(m){return f(h(m))}}function ys(h,f){return function(){h.apply(this,arguments),f.apply(this,arguments)}}function pw(h,f){return h===He?f:function(){var m=h.apply(this,arguments);m!==void 0&&(arguments[0]=m);var _=this.onsuccess,w=this.onerror;this.onsuccess=null,this.onerror=null;var T=f.apply(this,arguments);return _&&(this.onsuccess=this.onsuccess?ys(_,this.onsuccess):_),w&&(this.onerror=this.onerror?ys(w,this.onerror):w),T!==void 0?T:m}}function mw(h,f){return h===He?f:function(){h.apply(this,arguments);var m=this.onsuccess,_=this.onerror;this.onsuccess=this.onerror=null,f.apply(this,arguments),m&&(this.onsuccess=this.onsuccess?ys(m,this.onsuccess):m),_&&(this.onerror=this.onerror?ys(_,this.onerror):_)}}function gw(h,f){return h===He?f:function(m){var _=h.apply(this,arguments);l(m,_);var w=this.onsuccess,T=this.onerror;return this.onsuccess=null,this.onerror=null,m=f.apply(this,arguments),w&&(this.onsuccess=this.onsuccess?ys(w,this.onsuccess):w),T&&(this.onerror=this.onerror?ys(T,this.onerror):T),_===void 0?m===void 0?void 0:m:l(_,m)}}function yw(h,f){return h===He?f:function(){return f.apply(this,arguments)!==!1&&h.apply(this,arguments)}}function Nh(h,f){return h===He?f:function(){var m=h.apply(this,arguments);if(m&&typeof m.then=="function"){for(var _=this,w=arguments.length,T=new Array(w);w--;)T[w]=arguments[w];return m.then(function(){return f.apply(_,T)})}return f.apply(this,arguments)}}Ca.ModifyError=wn,Ca.DexieError=gt,Ca.BulkError=kt;var an=typeof location<"u"&&/^(http|https):\/\/(localhost|127\.0\.0\.1)/.test(location.href);function Cm(h){an=h}var gr={},km=100,kn=typeof Promise>"u"?[]:function(){var h=Promise.resolve();if(typeof crypto>"u"||!crypto.subtle)return[h,c(h),h];var f=crypto.subtle.digest("SHA-512",new Uint8Array([0]));return[f,c(f),h]}(),yr=kn[0],Bt=kn[1],kn=kn[2],Bt=Bt&&Bt.then,_r=yr&&yr.constructor,Mh=!!kn,vr=function(h,f){br.push([h,f]),ka&&(queueMicrotask(vw),ka=!1)},Ph=!0,ka=!0,_s=[],xa=[],Eh=mr,Gn={id:"global",global:!0,ref:0,unhandleds:[],onunhandled:He,pgp:!1,env:{},finalize:He},ue=Gn,br=[],vs=0,Sa=[];function le(h){if(typeof this!="object")throw new TypeError("Promises must be constructed via new");this._listeners=[],this._lib=!1;var f=this._PSD=ue;if(typeof h!="function"){if(h!==gr)throw new TypeError("Not a function");return this._state=arguments[1],this._value=arguments[2],void(this._state===!1&&Lh(this,this._value))}this._state=null,this._value=null,++f.ref,function m(_,w){try{w(function(T){if(_._state===null){if(T===_)throw new TypeError("A promise cannot be resolved with itself.");var $=_._lib&&hi();T&&typeof T.then=="function"?m(_,function(N,L){T instanceof le?T._then(N,L):T.then(N,L)}):(_._state=!0,_._value=T,Sm(_)),$&&ui()}},Lh.bind(null,_))}catch(T){Lh(_,T)}}(this,h)}var Ah={get:function(){var h=ue,f=Ia;function m(_,w){var T=this,$=!h.global&&(h!==ue||f!==Ia),N=$&&!Qn(),L=new le(function(E,z){Rh(T,new xm($m(_,h,$,N),$m(w,h,$,N),E,z,h))});return this._consoleTask&&(L._consoleTask=this._consoleTask),L}return m.prototype=gr,m},set:function(h){v(this,"then",h&&h.prototype===gr?Ah:{get:function(){return h},set:Ah.set})}};function xm(h,f,m,_,w){this.onFulfilled=typeof h=="function"?h:null,this.onRejected=typeof f=="function"?f:null,this.resolve=m,this.reject=_,this.psd=w}function Lh(h,f){var m,_;xa.push(f),h._state===null&&(m=h._lib&&hi(),f=Eh(f),h._state=!1,h._value=f,_=h,_s.some(function(w){return w._value===_._value})||_s.push(_),Sm(h),m&&ui())}function Sm(h){var f=h._listeners;h._listeners=[];for(var m=0,_=f.length;m<_;++m)Rh(h,f[m]);var w=h._PSD;--w.ref||w.finalize(),vs===0&&(++vs,vr(function(){--vs==0&&Oh()},[]))}function Rh(h,f){if(h._state!==null){var m=h._state?f.onFulfilled:f.onRejected;if(m===null)return(h._state?f.resolve:f.reject)(h._value);++f.psd.ref,++vs,vr(_w,[m,h,f])}else h._listeners.push(f)}function _w(h,f,m){try{var _,w=f._value;!f._state&&xa.length&&(xa=[]),_=an&&f._consoleTask?f._consoleTask.run(function(){return h(w)}):h(w),f._state||xa.indexOf(w)!==-1||function(T){for(var $=_s.length;$;)if(_s[--$]._value===T._value)return _s.splice($,1)}(f),m.resolve(_)}catch(T){m.reject(T)}finally{--vs==0&&Oh(),--m.psd.ref||m.psd.finalize()}}function vw(){bs(Gn,function(){hi()&&ui()})}function hi(){var h=Ph;return ka=Ph=!1,h}function ui(){var h,f,m;do for(;0.",Dm="String expected.",fi=[],Ma="__dbnames",Fh="readonly",jh="readwrite";function Cs(h,f){return h?f?function(){return h.apply(this,arguments)&&f.apply(this,arguments)}:h:f}var Im={type:3,lower:-1/0,lowerOpen:!1,upper:[[]],upperOpen:!1};function Pa(h){return typeof h!="string"||/\./.test(h)?function(f){return f}:function(f){return f[h]===void 0&&h in f&&delete(f=ge(f))[h],f}}function Nm(){throw de.Type()}function Le(h,f){try{var m=Mm(h),_=Mm(f);if(m!==_)return m==="Array"?1:_==="Array"?-1:m==="binary"?1:_==="binary"?-1:m==="string"?1:_==="string"?-1:m==="Date"?1:_!=="Date"?NaN:-1;switch(m){case"number":case"Date":case"string":return fU+K&&W(U+j)})})}return W(0).then(function(){if(0=j})).length!==0?(z.forEach(function(W){B.push(function(){var U=R,K=W._cfg.dbschema;ja(M,U,O),ja(M,K,O),R=M._dbSchema=K;var q=Qh(U,K);q.add.forEach(function(oe){Jh(O,oe[0],oe[1].primKey,oe[1].indexes)}),q.change.forEach(function(oe){if(oe.recreate)throw new de.Upgrade("Not yet support for changing primary key");var ae=O.objectStore(oe.name);oe.add.forEach(function(_e){return za(ae,_e)}),oe.change.forEach(function(_e){ae.deleteIndex(_e.name),za(ae,_e)}),oe.del.forEach(function(_e){return ae.deleteIndex(_e)})});var Q=W._cfg.contentUpgrade;if(Q&&W._cfg.version>j){Ra(M,O),A._memoizedTables={};var re=X(K);q.del.forEach(function(oe){re[oe]=U[oe]}),Yh(M,[M.Transaction.prototype]),Oa(M,[M.Transaction.prototype],o(re),re),A.schema=re;var te,ne=Pe(Q);return ne&&di(),q=le.follow(function(){var oe;(te=Q(A))&&ne&&(oe=Qn.bind(null,null),te.then(oe,oe))}),te&&typeof te.then=="function"?le.resolve(te):q.then(function(){return te})}}),B.push(function(U){var K,q,Q=W._cfg.dbschema;K=Q,q=U,[].slice.call(q.db.objectStoreNames).forEach(function(re){return K[re]==null&&q.db.deleteObjectStore(re)}),Yh(M,[M.Transaction.prototype]),Oa(M,[M.Transaction.prototype],M._storeNames,M._dbSchema),A.schema=M._dbSchema}),B.push(function(U){M.idbdb.objectStoreNames.contains("$meta")&&(Math.ceil(M.idbdb.version/10)===W._cfg.version?(M.idbdb.deleteObjectStore("$meta"),delete M._dbSchema.$meta,M._storeNames=M._storeNames.filter(function(K){return K!=="$meta"})):U.objectStore("$meta").put(W._cfg.version,"version"))})}),function W(){return B.length?le.resolve(B.shift()(A.idbtrans)).then(W):le.resolve()}().then(function(){Bm(R,O)})):le.resolve();var M,j,A,O,B,R}).catch($)):(o(w).forEach(function(z){Jh(m,z,w[z].primKey,w[z].indexes)}),Ra(h,m),void le.follow(function(){return h.on.populate.fire(T)}).catch($));var L,E})}function Pw(h,f){Bm(h._dbSchema,f),f.db.version%10!=0||f.objectStoreNames.contains("$meta")||f.db.createObjectStore("$meta").add(Math.ceil(f.db.version/10-1),"version");var m=Fa(0,h.idbdb,f);ja(h,h._dbSchema,f);for(var _=0,w=Qh(m,h._dbSchema).change;_Math.pow(2,62)?0:R.oldVersion,M=R<1,h.idbdb=B.result,T&&Pw(h,z),Mw(h,R/10,z,A))},A),B.onsuccess=Ge(function(){z=null;var R,W,U,K,q,Q=h.idbdb=B.result,re=D(Q.objectStoreNames);if(0"u"?le.resolve():!navigator.userAgentData&&/Safari\//.test(navigator.userAgent)&&!/Chrom(e|ium)\//.test(navigator.userAgent)&&indexedDB.databases?new Promise(function(j){function A(){return indexedDB.databases().finally(j)}L=setInterval(A,100),A()}).finally(function(){return clearInterval(L)}):Promise.resolve()).then(N)]).then(function(){return $(),f.onReadyBeingFired=[],le.resolve(eu(function(){return h.on.ready.fire(h.vip)})).then(function j(){if(0f.limit?j.length=f.limit:h.length===f.limit&&j.length=W.limit&&(!W.values||Q.req.values)&&Fw(Q.req.query.range,W.query.range)}),!1,U,K];case"count":return q=K.find(function(Q){return Jm(Q.req.query.range,W.query.range)}),[q,!!q,U,K]}}(f,m,"query",T),z=E[0],M=E[1],j=E[2],A=E[3];return z&&M?z.obsSet=T.obsSet:(M=_.query(T).then(function(O){var B=O.result;if(z&&(z.res=B),$){for(var R=0,W=B.length;RMath.max(e.TABLE.version,s),1),x_=Object.values(tf).reduce((s,{TABLE:e})=>(s[e.name]=e.schema,s),{});class nf extends zi{constructor(e="DataHub"){super(e),this.version(k_).stores(x_),this.cache.mapToClass(Ln)}async getCache(e,t=Ln.DEFAULT_TYPE){return this.cache.where("[type+key]").equals([t,e]).first()}async getCacheData(e,t=Ln.DEFAULT_TYPE){const n=await this.getCache(e,t);return n==null?void 0:n.data}async setCacheData(e,t,n,i=Ln.DEFAULT_TYPE){if(t===null)return this.deleteCacheData(e,i);const r=await this.getCache(e,i);return n=n||Date.now(),r?(await this.cache.update(r.id,{data:t,updateTime:n}),r.id):await this.cache.add({key:e,data:t,type:i,createTime:n,updateTime:n})}async deleteCacheData(e,t=Ln.DEFAULT_TYPE){return typeof e=="number"?this.cache.delete(e):this.cache.where("[type+key]").equals([t,e]).delete()}async getPageData(e,t,n){const{currentModule:i,currentMethod:r}=window.config;return this.getCacheData(e,`PAGE_${t||i}_${n||r}`)}setPageData(e,t,n,i){const{currentModule:r,currentMethod:o}=window.config;return this.setCacheData(e,t,void 0,`PAGE_${n||r}_${i||o}`)}}Object.defineProperty(window.$,"db",{get(){var s;return this._db||(window.parent!==window?this._db=window.parent.$.db:this._db=new nf(`zentao_${((s=window.config)==null?void 0:s.account)||""}`)),this._db}});class Zl extends ye{}Zl.NAME="Avatar",Zl.Component=Fs,Xe(Jy);const W0="",U0="",V0="",K0="";class ec extends ye{}ec.NAME="BtnGroup",ec.Component=Wt,Xe(Object.freeze(Object.defineProperty({__proto__:null,BtnGroup:Wt},Symbol.toStringTag,{value:"Module"})));const G0="",Y0="",sf=Symbol("EVENT_PICK");class _o extends pe{constructor(e){super(e),this._handleClick=this._handleClick.bind(this),this._hasInput=!!y(`#${e.id}`).length}get hasInput(){return this._hasInput}_handleClick(e){const{togglePop:t,clickType:n,onClick:i}=this.props;let r=n==="open"?!0:void 0;const o=y(e.target),a=i==null?void 0:i(e);if(!e.defaultPrevented){if(typeof a=="boolean")r=a;else{if(o.closest('[data-dismiss="pick"]').length){t(!1);return}if(o.closest("a,input").length)return}requestAnimationFrame(()=>t(r))}}_getClass(e){const{state:t,className:n,disabled:i,readonly:r,pickerName:o,empty:a}=e,{open:l}=t;return V("pick",n,o?`${o}-pick`:"",l&&"is-open focus",i&&"disabled",r&&"readonly",a?"is-empty-value":"")}_getProps(e){const{id:t,style:n,attrs:i}=e;return{id:`pick-${t}`,className:this._getClass(e),style:n,tabIndex:-1,onClick:this._handleClick,...i}}_renderTrigger(e){const{children:t,state:n}=e;return t??n.value}_renderValue(e){const{name:t,state:{value:n=""},disabled:i,readonly:r,id:o}=e;if(t)if(this._hasInput)y(`#${o}`).val(n);else return x("input",{id:o,type:"hidden",className:"pick-value",name:t,value:n,readonly:r,disabled:i});return null}componentDidMount(){const{id:e}=this.props;y(`#${e}`).on(`change.zui.pick.${e} syncValue.zui.pick.${e}`,(t,n)=>{if(typeof n=="symbol")return;const i=t.target.value;this._skipTriggerChange=i,this.props.changeState({value:i})})}componentWillUnmount(){const{id:e}=this.props;y(`#${e}`).off(`change.zui.pick.${e}`)}componentDidUpdate(e){const{id:t,state:n,name:i}=this.props;i&&e.state.value!==n.value&&(this._skipTriggerChange!==n.value&&y(`#${t}`).trigger("change",sf),this._skipTriggerChange=!1)}render(e){return b(e.tagName||"div",this._getProps(e),this._renderTrigger(e),this._renderValue(e))}}const Rn=Math.min,Mt=Math.max,vo=Math.round,bo=Math.floor,tn=s=>({x:s,y:s}),S_={left:"right",right:"left",bottom:"top",top:"bottom"},T_={start:"end",end:"start"};function tc(s,e,t){return Mt(s,Rn(e,t))}function Ws(s,e){return typeof s=="function"?s(e):s}function On(s){return s.split("-")[0]}function Us(s){return s.split("-")[1]}function rf(s){return s==="x"?"y":"x"}function nc(s){return s==="y"?"height":"width"}function ds(s){return["top","bottom"].includes(On(s))?"y":"x"}function sc(s){return rf(ds(s))}function $_(s,e,t){t===void 0&&(t=!1);const n=Us(s),i=sc(s),r=nc(i);let o=i==="x"?n===(t?"end":"start")?"right":"left":n==="start"?"bottom":"top";return e.reference[r]>e.floating[r]&&(o=wo(o)),[o,wo(o)]}function D_(s){const e=wo(s);return[ic(s),e,ic(e)]}function ic(s){return s.replace(/start|end/g,e=>T_[e])}function I_(s,e,t){const n=["left","right"],i=["right","left"],r=["top","bottom"],o=["bottom","top"];switch(s){case"top":case"bottom":return t?e?i:n:e?n:i;case"left":case"right":return e?r:o;default:return[]}}function N_(s,e,t,n){const i=Us(s);let r=I_(On(s),t==="start",n);return i&&(r=r.map(o=>o+"-"+i),e&&(r=r.concat(r.map(ic)))),r}function wo(s){return s.replace(/left|right|bottom|top/g,e=>S_[e])}function M_(s){return{top:0,right:0,bottom:0,left:0,...s}}function of(s){return typeof s!="number"?M_(s):{top:s,right:s,bottom:s,left:s}}function Co(s){const{x:e,y:t,width:n,height:i}=s;return{width:n,height:i,top:t,left:e,right:e+n,bottom:t+i,x:e,y:t}}function af(s,e,t){let{reference:n,floating:i}=s;const r=ds(e),o=sc(e),a=nc(o),l=On(e),c=r==="y",d=n.x+n.width/2-i.width/2,u=n.y+n.height/2-i.height/2,p=n[a]/2-i[a]/2;let g;switch(l){case"top":g={x:d,y:n.y-i.height};break;case"bottom":g={x:d,y:n.y+n.height};break;case"right":g={x:n.x+n.width,y:u};break;case"left":g={x:n.x-i.width,y:u};break;default:g={x:n.x,y:n.y}}switch(Us(e)){case"start":g[o]-=p*(t&&c?-1:1);break;case"end":g[o]+=p*(t&&c?-1:1);break}return g}const P_=async(s,e,t)=>{const{placement:n="bottom",strategy:i="absolute",middleware:r=[],platform:o}=t,a=r.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let c=await o.getElementRects({reference:s,floating:e,strategy:i}),{x:d,y:u}=af(c,n,l),p=n,g={},v=0;for(let C=0;C({name:"arrow",options:s,async fn(e){const{x:t,y:n,placement:i,rects:r,platform:o,elements:a,middlewareData:l}=e,{element:c,padding:d=0}=Ws(s,e)||{};if(c==null)return{};const u=of(d),p={x:t,y:n},g=sc(i),v=nc(g),C=await o.getDimensions(c),S=g==="y",k=S?"top":"left",D=S?"bottom":"right",P=S?"clientHeight":"clientWidth",F=r.reference[v]+r.reference[g]-p[g]-r.floating[v],H=p[g]-r.reference[g],Y=await(o.getOffsetParent==null?void 0:o.getOffsetParent(c));let G=Y?Y[P]:0;(!G||!await(o.isElement==null?void 0:o.isElement(Y)))&&(G=a.floating[P]||r.floating[v]);const X=F/2-H/2,ee=G/2-C[v]/2-1,he=Rn(u[k],ee),J=Rn(u[D],ee),ie=he,ge=G-C[v]-J,be=G/2-C[v]/2+X,Me=tc(ie,be,ge),Ae=!l.arrow&&Us(i)!=null&&be!==Me&&r.reference[v]/2-(bebe<=0)){var J,ie;const be=(((J=r.flip)==null?void 0:J.index)||0)+1,Me=G[be];if(Me)return{data:{index:be,overflows:he},reset:{placement:Me}};let Ae=(ie=he.filter(ce=>ce.overflows[0]<=0).sort((ce,Z)=>ce.overflows[1]-Z.overflows[1])[0])==null?void 0:ie.placement;if(!Ae)switch(g){case"bestFit":{var ge;const ce=(ge=he.filter(Z=>{if(Y){const Ce=ds(Z.placement);return Ce===D||Ce==="y"}return!0}).map(Z=>[Z.placement,Z.overflows.filter(Ce=>Ce>0).reduce((Ce,ve)=>Ce+ve,0)]).sort((Z,Ce)=>Z[1]-Ce[1])[0])==null?void 0:ge[0];ce&&(Ae=ce);break}case"initialPlacement":Ae=a;break}if(i!==Ae)return{reset:{placement:Ae}}}return{}}}};async function L_(s,e){const{placement:t,platform:n,elements:i}=s,r=await(n.isRTL==null?void 0:n.isRTL(i.floating)),o=On(t),a=Us(t),l=ds(t)==="y",c=["left","top"].includes(o)?-1:1,d=r&&l?-1:1,u=Ws(e,s);let{mainAxis:p,crossAxis:g,alignmentAxis:v}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof v=="number"&&(g=a==="end"?v*-1:v),l?{x:g*d,y:p*c}:{x:p*c,y:g*d}}const R_=function(s){return s===void 0&&(s=0),{name:"offset",options:s,async fn(e){var t,n;const{x:i,y:r,placement:o,middlewareData:a}=e,l=await L_(e,s);return o===((t=a.offset)==null?void 0:t.placement)&&(n=a.arrow)!=null&&n.alignmentOffset?{}:{x:i+l.x,y:r+l.y,data:{...l,placement:o}}}}},O_=function(s){return s===void 0&&(s={}),{name:"shift",options:s,async fn(e){const{x:t,y:n,placement:i}=e,{mainAxis:r=!0,crossAxis:o=!1,limiter:a={fn:S=>{let{x:k,y:D}=S;return{x:k,y:D}}},...l}=Ws(s,e),c={x:t,y:n},d=await rc(e,l),u=ds(On(i)),p=rf(u);let g=c[p],v=c[u];if(r){const S=p==="y"?"top":"left",k=p==="y"?"bottom":"right",D=g+d[S],P=g-d[k];g=tc(D,g,P)}if(o){const S=u==="y"?"top":"left",k=u==="y"?"bottom":"right",D=v+d[S],P=v-d[k];v=tc(D,v,P)}const C=a.fn({...e,[p]:g,[u]:v});return{...C,data:{x:C.x-t,y:C.y-n,enabled:{[p]:r,[u]:o}}}}}},z_=function(s){return s===void 0&&(s={}),{name:"size",options:s,async fn(e){var t,n;const{placement:i,rects:r,platform:o,elements:a}=e,{apply:l=()=>{},...c}=Ws(s,e),d=await rc(e,c),u=On(i),p=Us(i),g=ds(i)==="y",{width:v,height:C}=r.floating;let S,k;u==="top"||u==="bottom"?(S=u,k=p===(await(o.isRTL==null?void 0:o.isRTL(a.floating))?"start":"end")?"left":"right"):(k=u,S=p==="end"?"top":"bottom");const D=C-d.top-d.bottom,P=v-d.left-d.right,F=Rn(C-d[S],D),H=Rn(v-d[k],P),Y=!e.middlewareData.shift;let G=F,X=H;if((t=e.middlewareData.shift)!=null&&t.enabled.x&&(X=P),(n=e.middlewareData.shift)!=null&&n.enabled.y&&(G=D),Y&&!p){const he=Mt(d.left,0),J=Mt(d.right,0),ie=Mt(d.top,0),ge=Mt(d.bottom,0);g?X=v-2*(he!==0||J!==0?he+J:Mt(d.left,d.right)):G=C-2*(ie!==0||ge!==0?ie+ge:Mt(d.top,d.bottom))}await l({...e,availableWidth:X,availableHeight:G});const ee=await o.getDimensions(a.floating);return v!==ee.width||C!==ee.height?{reset:{rects:!0}}:{}}}};function ko(){return typeof window<"u"}function Vs(s){return lf(s)?(s.nodeName||"").toLowerCase():"#document"}function Pt(s){var e;return(s==null||(e=s.ownerDocument)==null?void 0:e.defaultView)||window}function nn(s){var e;return(e=(lf(s)?s.ownerDocument:s.document)||window.document)==null?void 0:e.documentElement}function lf(s){return ko()?s instanceof Node||s instanceof Pt(s).Node:!1}function Ut(s){return ko()?s instanceof Element||s instanceof Pt(s).Element:!1}function sn(s){return ko()?s instanceof HTMLElement||s instanceof Pt(s).HTMLElement:!1}function cf(s){return!ko()||typeof ShadowRoot>"u"?!1:s instanceof ShadowRoot||s instanceof Pt(s).ShadowRoot}function Fi(s){const{overflow:e,overflowX:t,overflowY:n,display:i}=Vt(s);return/auto|scroll|overlay|hidden|clip/.test(e+n+t)&&!["inline","contents"].includes(i)}function F_(s){return["table","td","th"].includes(Vs(s))}function xo(s){return[":popover-open",":modal"].some(e=>{try{return s.matches(e)}catch{return!1}})}function oc(s){const e=ac(),t=Ut(s)?Vt(s):s;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(n=>(t.willChange||"").includes(n))||["paint","layout","strict","content"].some(n=>(t.contain||"").includes(n))}function j_(s){let e=zn(s);for(;sn(e)&&!Ks(e);){if(oc(e))return e;if(xo(e))return null;e=zn(e)}return null}function ac(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function Ks(s){return["html","body","#document"].includes(Vs(s))}function Vt(s){return Pt(s).getComputedStyle(s)}function So(s){return Ut(s)?{scrollLeft:s.scrollLeft,scrollTop:s.scrollTop}:{scrollLeft:s.scrollX,scrollTop:s.scrollY}}function zn(s){if(Vs(s)==="html")return s;const e=s.assignedSlot||s.parentNode||cf(s)&&s.host||nn(s);return cf(e)?e.host:e}function hf(s){const e=zn(s);return Ks(e)?s.ownerDocument?s.ownerDocument.body:s.body:sn(e)&&Fi(e)?e:hf(e)}function ji(s,e,t){var n;e===void 0&&(e=[]),t===void 0&&(t=!0);const i=hf(s),r=i===((n=s.ownerDocument)==null?void 0:n.body),o=Pt(i);if(r){const a=lc(o);return e.concat(o,o.visualViewport||[],Fi(i)?i:[],a&&t?ji(a):[])}return e.concat(i,ji(i,[],t))}function lc(s){return s.parent&&Object.getPrototypeOf(s.parent)?s.frameElement:null}function uf(s){const e=Vt(s);let t=parseFloat(e.width)||0,n=parseFloat(e.height)||0;const i=sn(s),r=i?s.offsetWidth:t,o=i?s.offsetHeight:n,a=vo(t)!==r||vo(n)!==o;return a&&(t=r,n=o),{width:t,height:n,$:a}}function cc(s){return Ut(s)?s:s.contextElement}function qs(s){const e=cc(s);if(!sn(e))return tn(1);const t=e.getBoundingClientRect(),{width:n,height:i,$:r}=uf(e);let o=(r?vo(t.width):t.width)/n,a=(r?vo(t.height):t.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const B_=tn(0);function df(s){const e=Pt(s);return!ac()||!e.visualViewport?B_:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function H_(s,e,t){return e===void 0&&(e=!1),!t||e&&t!==Pt(s)?!1:e}function fs(s,e,t,n){e===void 0&&(e=!1),t===void 0&&(t=!1);const i=s.getBoundingClientRect(),r=cc(s);let o=tn(1);e&&(n?Ut(n)&&(o=qs(n)):o=qs(s));const a=H_(r,t,n)?df(r):tn(0);let l=(i.left+a.x)/o.x,c=(i.top+a.y)/o.y,d=i.width/o.x,u=i.height/o.y;if(r){const p=Pt(r),g=n&&Ut(n)?Pt(n):n;let v=p,C=lc(v);for(;C&&n&&g!==v;){const S=qs(C),k=C.getBoundingClientRect(),D=Vt(C),P=k.left+(C.clientLeft+parseFloat(D.paddingLeft))*S.x,F=k.top+(C.clientTop+parseFloat(D.paddingTop))*S.y;l*=S.x,c*=S.y,d*=S.x,u*=S.y,l+=P,c+=F,v=Pt(C),C=lc(v)}}return Co({width:d,height:u,x:l,y:c})}function hc(s,e){const t=So(s).scrollLeft;return e?e.left+t:fs(nn(s)).left+t}function ff(s,e,t){t===void 0&&(t=!1);const n=s.getBoundingClientRect(),i=n.left+e.scrollLeft-(t?0:hc(s,n)),r=n.top+e.scrollTop;return{x:i,y:r}}function W_(s){let{elements:e,rect:t,offsetParent:n,strategy:i}=s;const r=i==="fixed",o=nn(n),a=e?xo(e.floating):!1;if(n===o||a&&r)return t;let l={scrollLeft:0,scrollTop:0},c=tn(1);const d=tn(0),u=sn(n);if((u||!u&&!r)&&((Vs(n)!=="body"||Fi(o))&&(l=So(n)),sn(n))){const g=fs(n);c=qs(n),d.x=g.x+n.clientLeft,d.y=g.y+n.clientTop}const p=o&&!u&&!r?ff(o,l,!0):tn(0);return{width:t.width*c.x,height:t.height*c.y,x:t.x*c.x-l.scrollLeft*c.x+d.x+p.x,y:t.y*c.y-l.scrollTop*c.y+d.y+p.y}}function U_(s){return Array.from(s.getClientRects())}function V_(s){const e=nn(s),t=So(s),n=s.ownerDocument.body,i=Mt(e.scrollWidth,e.clientWidth,n.scrollWidth,n.clientWidth),r=Mt(e.scrollHeight,e.clientHeight,n.scrollHeight,n.clientHeight);let o=-t.scrollLeft+hc(s);const a=-t.scrollTop;return Vt(n).direction==="rtl"&&(o+=Mt(e.clientWidth,n.clientWidth)-i),{width:i,height:r,x:o,y:a}}function K_(s,e){const t=Pt(s),n=nn(s),i=t.visualViewport;let r=n.clientWidth,o=n.clientHeight,a=0,l=0;if(i){r=i.width,o=i.height;const c=ac();(!c||c&&e==="fixed")&&(a=i.offsetLeft,l=i.offsetTop)}return{width:r,height:o,x:a,y:l}}function q_(s,e){const t=fs(s,!0,e==="fixed"),n=t.top+s.clientTop,i=t.left+s.clientLeft,r=sn(s)?qs(s):tn(1),o=s.clientWidth*r.x,a=s.clientHeight*r.y,l=i*r.x,c=n*r.y;return{width:o,height:a,x:l,y:c}}function pf(s,e,t){let n;if(e==="viewport")n=K_(s,t);else if(e==="document")n=V_(nn(s));else if(Ut(e))n=q_(e,t);else{const i=df(s);n={x:e.x-i.x,y:e.y-i.y,width:e.width,height:e.height}}return Co(n)}function mf(s,e){const t=zn(s);return t===e||!Ut(t)||Ks(t)?!1:Vt(t).position==="fixed"||mf(t,e)}function G_(s,e){const t=e.get(s);if(t)return t;let n=ji(s,[],!1).filter(a=>Ut(a)&&Vs(a)!=="body"),i=null;const r=Vt(s).position==="fixed";let o=r?zn(s):s;for(;Ut(o)&&!Ks(o);){const a=Vt(o),l=oc(o);!l&&a.position==="fixed"&&(i=null),(r?!l&&!i:!l&&a.position==="static"&&!!i&&["absolute","fixed"].includes(i.position)||Fi(o)&&!l&&mf(s,o))?n=n.filter(d=>d!==o):i=a,o=zn(o)}return e.set(s,n),n}function Y_(s){let{element:e,boundary:t,rootBoundary:n,strategy:i}=s;const o=[...t==="clippingAncestors"?xo(e)?[]:G_(e,this._c):[].concat(t),n],a=o[0],l=o.reduce((c,d)=>{const u=pf(e,d,i);return c.top=Mt(u.top,c.top),c.right=Rn(u.right,c.right),c.bottom=Rn(u.bottom,c.bottom),c.left=Mt(u.left,c.left),c},pf(e,a,i));return{width:l.right-l.left,height:l.bottom-l.top,x:l.left,y:l.top}}function Q_(s){const{width:e,height:t}=uf(s);return{width:e,height:t}}function J_(s,e,t){const n=sn(e),i=nn(e),r=t==="fixed",o=fs(s,!0,r,e);let a={scrollLeft:0,scrollTop:0};const l=tn(0);if(n||!n&&!r)if((Vs(e)!=="body"||Fi(i))&&(a=So(e)),n){const p=fs(e,!0,r,e);l.x=p.x+e.clientLeft,l.y=p.y+e.clientTop}else i&&(l.x=hc(i));const c=i&&!n&&!r?ff(i,a):tn(0),d=o.left+a.scrollLeft-l.x-c.x,u=o.top+a.scrollTop-l.y-c.y;return{x:d,y:u,width:o.width,height:o.height}}function uc(s){return Vt(s).position==="static"}function gf(s,e){if(!sn(s)||Vt(s).position==="fixed")return null;if(e)return e(s);let t=s.offsetParent;return nn(s)===t&&(t=t.ownerDocument.body),t}function yf(s,e){const t=Pt(s);if(xo(s))return t;if(!sn(s)){let i=zn(s);for(;i&&!Ks(i);){if(Ut(i)&&!uc(i))return i;i=zn(i)}return t}let n=gf(s,e);for(;n&&F_(n)&&uc(n);)n=gf(n,e);return n&&Ks(n)&&uc(n)&&!oc(n)?t:n||j_(s)||t}const X_=async function(s){const e=this.getOffsetParent||yf,t=this.getDimensions,n=await t(s.floating);return{reference:J_(s.reference,await e(s.floating),s.strategy),floating:{x:0,y:0,width:n.width,height:n.height}}};function Z_(s){return Vt(s).direction==="rtl"}const ev={convertOffsetParentRelativeRectToViewportRelativeRect:W_,getDocumentElement:nn,getClippingRect:Y_,getOffsetParent:yf,getElementRects:X_,getClientRects:U_,getDimensions:Q_,getScale:qs,isElement:Ut,isRTL:Z_};function tv(s,e){let t=null,n;const i=nn(s);function r(){var a;clearTimeout(n),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),r();const{left:c,top:d,width:u,height:p}=s.getBoundingClientRect();if(a||e(),!u||!p)return;const g=bo(d),v=bo(i.clientWidth-(c+u)),C=bo(i.clientHeight-(d+p)),S=bo(c),D={rootMargin:-g+"px "+-v+"px "+-C+"px "+-S+"px",threshold:Mt(0,Rn(1,l))||1};let P=!0;function F(H){const Y=H[0].intersectionRatio;if(Y!==l){if(!P)return o();Y?o(!1,Y):n=setTimeout(()=>{o(!1,1e-7)},1e3)}P=!1}try{t=new IntersectionObserver(F,{...D,root:i.ownerDocument})}catch{t=new IntersectionObserver(F,D)}t.observe(s)}return o(!0),r}function _f(s,e,t,n){n===void 0&&(n={});const{ancestorScroll:i=!0,ancestorResize:r=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=n,c=cc(s),d=i||r?[...c?ji(c):[],...ji(e)]:[];d.forEach(k=>{i&&k.addEventListener("scroll",t,{passive:!0}),r&&k.addEventListener("resize",t)});const u=c&&a?tv(c,t):null;let p=-1,g=null;o&&(g=new ResizeObserver(k=>{let[D]=k;D&&D.target===c&&g&&(g.unobserve(e),cancelAnimationFrame(p),p=requestAnimationFrame(()=>{var P;(P=g)==null||P.observe(e)})),t()}),c&&!l&&g.observe(c),g.observe(e));let v,C=l?fs(s):null;l&&S();function S(){const k=fs(s);C&&(k.x!==C.x||k.y!==C.y||k.width!==C.width||k.height!==C.height)&&t(),C=k,v=requestAnimationFrame(S)}return t(),()=>{var k;d.forEach(D=>{i&&D.removeEventListener("scroll",t),r&&D.removeEventListener("resize",t)}),u==null||u(),(k=g)==null||k.disconnect(),g=null,l&&cancelAnimationFrame(v)}}const dc=R_,fc=O_,pc=A_,vf=z_,nv=E_,mc=(s,e,t)=>{const n=new Map,i={platform:ev,...t},r={...i.platform,_c:n};return P_(s,e,{...i,platform:r})};class gc extends pe{constructor(e){super(e),this._ref=fe(),this._handleDocClick=t=>{const{state:{open:n},id:i,togglePop:r}=this.props,o=y(t.target);n!=="closing"&&!o.closest(`#pick-${i},#pick-pop-${i}`).length&&o.parent().length&&r(!1)},this._handleClick=this._handleClick.bind(this)}get trigger(){return y(`#pick-${this.props.id}`)[0]}get element(){var e;return(e=this._ref)==null?void 0:e.current}get container(){return this._container}_handleClick(e){const{togglePop:t,onClickItem:n,state:i}=this.props,r=y(e.target),o=r.closest("[data-pick-value]");if(n&&n(e,i.value),o.length)return e.stopPropagation(),t(!1,{value:`${o.dataset("pickValue")}`});if(r.closest('[data-dismiss="pick"]').length)return t(!1)}_getClass(e){const{className:t,state:n,pickerName:i,empty:r}=e,{open:o}=n;return V("pick-pop",i?`${i}-pick-pop`:"",t,o===!0&&"in",r?"is-empty-value":"")}_getProps(e){const{id:t,style:n,maxHeight:i,maxWidth:r,minHeight:o,minWidth:a}=e,l=y.extend({maxHeight:i,maxWidth:r,minHeight:o,minWidth:a},n);return{id:`pick-pop-${t}`,className:this._getClass(e),style:l,ref:this._ref,onClick:this._handleClick}}_getContainer(e){if(!this._container){const t=y(e.container||"body");let n=t.find(".pick-container");n.length||(n=y("
").addClass("pick-container").appendTo(t)),this._container=n[0]}return this._container}_render(e){return x("div",{...this._getProps(e),children:this._renderPop(e)})}_renderPop(e){return e.children}_getStyle(e={},t){var c;const n=(c=this.trigger)==null?void 0:c.getBoundingClientRect();if(!n)return{};const{width:i,minWidth:r,maxWidth:o,maxHeight:a}=this.props,l=n.width;if(typeof i=="function"?e.width=i():i==="100%"?e.width=l:i&&(e.width=We(i)),r==="100%"&&(e.minWidth=l),o==="100%"&&(e.maxWidth=l),this.props.limitInScreen&&t&&(!a||a==="auto"||typeof a=="number")){let d;if(t.includes("bottom"))d=window.innerHeight-n.bottom-2;else{const u=this.element.getBoundingClientRect().height;d=n.top,u>d&&typeof e.top=="number"&&(e.top+=u-d)}d&&(e.maxHeight=typeof a=="number"?Math.min(d,a):d)}else a&&(e.maxHeight=a);return e}layout(){const{element:e,trigger:t,props:n}=this,{state:i}=n;if(!e||!t||!i.open){this._layoutWatcher&&(this._layoutWatcher(),this._layoutWatcher=void 0);return}this._layoutWatcher||(this._layoutWatcher=_f(t,e,()=>{const{placement:r,width:o}=n;mc(t,e,{placement:!r||r==="auto"?"bottom-start":r,middleware:[r==="auto"?pc():null,fc(),dc(1)].filter(Boolean)}).then(({x:a,y:l,placement:c})=>{var d,u;if(Mn(t)||!Ti(t,{checkZeroSize:!0})){y(e).css({display:"none"});return}y(e).css(this._getStyle({left:a,top:l},c)),(u=(d=this.props).onLayout)==null||u.call(d,e)}),o==="100%"&&y(e).css(this._getStyle())}))}componentDidMount(){var e,t;this.layout(),y(document).on("click",this._handleDocClick),(t=(e=this.props).afterRender)==null||t.call(e,{firstRender:!0})}componentDidUpdate(){var e,t;(t=(e=this.props).afterRender)==null||t.call(e,{firstRender:!1})}componentWillUnmount(){var t,n;y(document).off("click",this._handleDocClick);const e=this._layoutWatcher;e&&(e(),this._layoutWatcher=void 0),this._container=void 0,this._ref=void 0,y(`#pick-pop-${this.props.id}`).remove(),(n=(t=this.props).beforeDestroy)==null||n.call(t)}render(e){return Kd(this._render(e),this._getContainer(e))}}const Q0="";let ot=class extends pe{constructor(e){super(e),this._toggleTimer=0,this._pop=fe(),this._trigger=fe(),this.toggle=async(t,n)=>{(this.props.disabled||this.props.readonly)&&(t=!1);const{state:i}=this;if(typeof t=="boolean"&&t===(!!i.open&&i.open!=="closing"))return n&&await this.changeState(n),this.state;this._toggleTimer&&(clearTimeout(this._toggleTimer),this._toggleTimer=0);let r=await this.changeState(a=>(t=t??!a.open,{open:t?"opening":"closing",...n}));const{open:o}=r;return o==="closing"?(await Ps(200,a=>{this._toggleTimer=a}),this._toggleTimer=0,r=await this.changeState({open:!1})):o==="opening"&&(await Ps(50,a=>{this._toggleTimer=a}),this._toggleTimer=0,r=await this.changeState({open:!0})),r},this._id=e.id??`_pick${mt()}`,this.changeState=this.changeState.bind(this),this.state=this.getDefaultState(e)}get id(){return this._id}get pop(){return this._pop.current}get trigger(){return this._trigger.current}get value(){return this.state.value}getDefaultState(e){return{value:String((e||this.props).defaultValue??""),open:!1}}resetState(e,t){const n=this.getDefaultState(e);t?this.state=n:this.changeState(n)}changeState(e,t){return new Promise(n=>{this.setState(e,()=>{t==null||t(),n(this.state)})})}open(e){return this.toggle(!0,e)}close(e){return this.toggle(!1,e)}_getTriggerProps(e,t){return{id:this.id,ref:this._trigger,state:t,className:e.className,pickerName:e.pickerName,style:e.style,name:e.name,tagName:e.tagName,attrs:e.attrs,disabled:e.disabled,readonly:e.readonly,clickType:e.clickType,onClick:e.onClick,changeState:this.changeState,togglePop:this.toggle}}_getPopProps(e,t){return{id:this.id,state:t,className:e.popClass,pickerName:e.pickerName,style:e.popStyle,disabled:e.disabled,readonly:e.readonly,changeState:this.changeState,togglePop:this.toggle,placement:e.popPlacement,container:e.popContainer,width:e.popWidth,height:e.popHeight,minHeight:e.popMinHeight,maxHeight:e.popMaxHeight,maxWidth:e.popMaxWidth,minWidth:e.popMinWidth,limitInScreen:e.limitPopInScreen,onClickItem:e.onClickItem}}_renderTrigger(e,t){return null}_renderPop(e,t){return null}_afterRender(e=!1){var t;(t=this.props.afterRender)==null||t.call(this,{firstRender:e})}_getPop(e){return e.Pop||this.constructor.Pop}_getTrigger(e){return e.Trigger||this.constructor.Trigger}_isEmptyValue(){const{value:e}=this.state;return e==null||e===""}_handleChange(e,t){const{onChange:n}=this.props;n&&n.call(this,e,t)}_handlePopToggle(e){const{onPopShown:t,onPopHidden:n}=this.props;e===!0&&t?t.call(this):!e&&n&&n.call(this)}setValue(e,t){if(t){const n=this._trigger.current;n&&(n._skipTriggerChange=e)}return this.changeState({value:e})}componentDidMount(){this._afterRender(!0)}componentWillUpdate(e,t){const{open:n}=this.state,{open:i}=t;if(!n==!i)return;const{onPopShow:r,onPopHide:o}=this.props;i&&r?r.call(this):!i&&o&&o.call(this)}componentDidUpdate(e,t){const{open:n,value:i}=this.state,{open:r,value:o}=t;!!n!=!!r&&this._handlePopToggle(!!n),i!==o&&this._handleChange(i,o),this._afterRender()}componentWillUnmount(){var t;(t=this.props.beforeDestroy)==null||t.call(this),this._toggleTimer&&clearTimeout(this._toggleTimer);const e=this._pop.current;e&&e.componentWillUnmount&&e.componentWillUnmount()}render(e,t){const{open:n}=t,i=this._getTrigger(e);let r;if(n&&(!e.hidePopWhenEmpty||!this._isEmptyValue())){const o=this._getPop(e);r=x(o,{ref:this._pop,...this._getPopProps(e,t),children:this._renderPop(e,t)},"pop")}return x(Nn,{children:[x(i,{...this._getTriggerProps(e,t),children:this._renderTrigger(e,t)},"pick"),r]})}};ot.Trigger=_o,ot.Pop=gc,ot.defaultProps={popContainer:"body",popClass:"popup",popWidth:"100%",popPlacement:"auto",popMinWidth:50,popMinHeight:32,popMaxHeight:300,limitPopInScreen:!0,clickType:"open"};let bf=class extends ot{getDefaultState(e){const t=super.getDefaultState(e);return t.value===void 0&&(e||this.props).required&&(t.value=this.getColors()[0]),t}getColors(){const{colors:e}=this.props;return typeof e=="string"?e.split(","):e||[]}componentDidMount(){this.syncColor()}syncColor(){const{syncBackground:e,syncBorder:t,syncColor:n,syncValue:i}=this.props,r=this.state.value||"";if(e&&y(e).css("backgroundColor",r),t&&y(t).css("borderColor",r),n&&y(n).css("color",r),i){const o=y(i);o.is("input,textarea,select")?o.val(r):o.text(r)}}_handleChange(e,t){this.props.disabled||(super._handleChange(e,t),this.syncColor())}_renderTrigger(e,t){const{icon:n}=e,{value:i}=t;return[n?x(De,{icon:n},"icon"):x("span",{class:"color-picker-item bg-current ring ring-gray ring-inset",style:{background:i}})]}_getTriggerProps(e,t){const n=super._getTriggerProps(e,t);return n.style=y.extend({color:t.value},n.style),n.className=V("color-picker",n.className,{disabled:e.disabled}),n}_renderPop(e,t){const{closeBtn:n,heading:i}=e,r=this.getColors(),{value:o}=t;let a;return i&&(a=x("div",{className:"color-picker-heading",children:[i,n?x("button",{className:"btn ghost square rounded size-sm","data-dismiss":"pick",children:x("span",{class:"close"})}):null]},"heading")),[a,x("div",{className:"color-picker-row",children:[r.map(l=>x("button",{className:"btn color-picker-item",style:{backgroundColor:l},"data-pick-value":l,children:o===l?x(De,{icon:"check"}):null},l)),x("button",{className:"btn color-picker-item","data-pick-value":"",children:x(De,{className:"text-fore",icon:"trash"})})]},"row")]}};bf.defaultProps={...ot.defaultProps,className:"rounded btn square size-sm ghost",popClass:"color-picker-pop popup",colors:["#ef4444","#f97316","#eab308","#84cc16","#22c55e","#14b8a6","#0ea5e9","#6366f1","#a855f7","#d946ef","#ec4899"],closeBtn:!0,popWidth:"auto",popMinWidth:184};class To extends ye{}To.NAME="ColorPicker",To.Component=bf,To.register();const J0="";class wf extends pe{constructor(){super(...arguments),this._ref=fe(),this._handleClickItem=(e,t)=>{var n,i;(i=(n=this.props).onChange)==null||i.call(n,e,+t.item.key)}}componentDidMount(){setTimeout(()=>{y(this._ref.current).find(".menu-item>.active").scrollIntoView({container:".menu"})},100)}render(e){const{minuteStep:t=5,hour:n,minute:i}=e,r=[],o=[];for(let l=0;l<24;++l)r.push({key:String(l),text:l<10?`0${l}`:l,active:n===l});for(let l=0;l<60;l+=t)o.push({key:String(l),text:l<10?`0${l}`:l,active:i===l});const a="col w-10 max-h-full overflow-y-auto scrollbar-thin scrollbar-hover";return x("div",{className:"time-picker-menu row",ref:this._ref,children:[x(St,{className:a,items:r,onClickItem:this._handleClickItem.bind(this,"hour")}),x(St,{className:a,items:o,onClickItem:this._handleClickItem.bind(this,"minute")})]})}}const X0="",Cf=s=>{if(!s)return;const e=Ve(`1999-01-01 ${s}`);if(!Number.isNaN(e.getDay()))return e};let $o=class extends ot{constructor(){super(...arguments),this._handleInputFocus=()=>{this.toggle(!0)},this._handleInputChange=e=>{this.setTime(e.target.value)},this._handleSetTime=(e,t)=>{this.setTime({[e]:String(t)})},this._handleClearBtnClick=()=>{this.setTime("")}}getDefaultState(e){const t=super.getDefaultState(e);return t.value==="now"&&(t.value=ut(new Date,(e||this.props).format)),t}setTime(e,t){if(!t&&(this.props.disabled||this.props.readonly))return;let n="";if(typeof e=="string")n=e;else{const[c,d]=(this.state.value||"00:00").split(":"),{hour:u=+c,minute:p=+d}=e;n=`${u}:${p}`}const i=Cf(n),{onInvalid:r,required:o,defaultValue:a,format:l}=this.props;return this.changeState({value:i?ut(i,l):o?a:""},()=>{!i&&r&&r(n)})}setValue(e,t){if(t){const n=this._trigger.current;n&&(n._skipTriggerChange=e)}return this.setTime(e,!0)}getTime(){const e=Cf(this.state.value);return e?[e.getHours(),e.getMinutes()]:null}_renderTrigger(e,t){const{placeholder:n,icon:i,required:r,disabled:o,readonly:a}=e,{value:l="",open:c}=t,d=`time-picker-${this.id}`;let u;return c&&!r&&l.length?u=x("button",{type:"button",className:"btn size-sm square ghost",onClick:this._handleClearBtnClick,children:x("span",{className:"close"})}):i&&(i===!0?u=x("i",{class:"i-time"}):u=x(De,{icon:i})),[x("input",{id:d,type:"text",className:"form-control",placeholder:n,value:l,disabled:o,readOnly:a,autoComplete:"off",onFocus:this._handleInputFocus,onChange:this._handleInputChange},"input"),u?x("label",{for:d,className:"input-control-suffix",children:u},"icon"):null]}_getTriggerProps(e,t){const n=super._getTriggerProps(e,t);return{...n,className:V(n.className,"time-picker input-control has-suffix-icon")}}_renderPop(e){const[t,n]=this.getTime()||[];return x(wf,{hour:t,minute:n,minuteStep:e.minuteStep,onChange:this._handleSetTime})}};$o.defaultProps={...ot.defaultProps,popWidth:"auto",popMaxHeight:320,minuteStep:5,format:"hh:mm",icon:!0};function sv(s,e,t){return e&&st?t:s}function Bi(s){if(s==null)return null;if(typeof s=="function"&&(s=s()),typeof s=="string"&&s.startsWith("today")){const e=new Date;s.length>6?s=md(e,s.substring(5).replace("+","")):s=e}else s=Ve(s);return Pl(s)?s:null}const Z0="";Ne.addLang({zh_cn:{today:"今天",yearFormat:"{0}年",weekNames:["日","一","二","三","四","五","六"],monthNames:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},zh_tw:{today:"今天",yearFormat:"{0}年",weekNames:["日","一","二","三","四","五","六"],monthNames:["1月","2月","3月","4月","5月","6月","7月","8月","9月","10月","11月","12月"]},en:{today:"Today",yearFormat:"{0}",weekNames:["SUN","MON","TUE","WED","THU","FRI","SAT"],monthNames:["Jan.","Feb.","Mar.","Apr.","May.","Jun.","Jul.","Aug.","Sept.","Oct.","Nov.","Dec."]}});const iv=(s,e,t=0)=>{const n=new Date(s,e-1,1),i=n.getDay(),r=n.getTime()-(7+i-t)%7*As;return{days:7*5,startTime:r,firstDay:n.getTime()}},kf=(s,e)=>new Set((Array.isArray(s)?s:[s]).map(t=>ut(t,e)));class rv extends pe{constructor(){super(...arguments),this._handleClickDate=e=>{const{onClickDate:t}=this.props;if(!t)return;const n=y(e.target).closest(".mini-calendar-day").dataset("date");n&&t(n)}}render(e){var he,J;const t=new Date,{weekStart:n=1,weekNames:i=Ne.getLang("weekNames"),monthNames:r=Ne.getLang("monthNames"),year:o=t.getFullYear(),month:a=t.getMonth()+1,highlights:l=[],selections:c=[],maxDate:d,minDate:u,isAllowDate:p}=e,g=[],v="btn ghost square rounded-full";for(let ie=0;ie<7;ie++){const ge=(n+ie)%7;g.push(x("div",{className:V("col mini-calendar-day",{"is-weekend":ge===0||ge===6}),children:x("div",{children:i?i[ge]:ge})},ie))}const{startTime:C,days:S,firstDay:k}=iv(o,a,n),D=k+S*As;let P=C;const F=[],H="yyyy-MM-dd",Y=kf(l,H),G=kf(c,H),X=((he=d?Ve(d):null)==null?void 0:he.getTime())??Number.MAX_SAFE_INTEGER,ee=((J=u?Ve(u):null)==null?void 0:J.getTime())??0;for(;P<=D;){const ie=[];for(let ge=0;ge<7;ge++){const be=new Date(P);let Me=(p==null?void 0:p(be))??!0;typeof Me=="boolean"&&(Me={allow:Me});const Ae=be.getDate(),ce=ut(be,H),Z=be.getDay(),Ce=Ml(be,k),ve=V("col mini-calendar-day",{active:Y.has(ce),selected:G.has(ce),"is-first":Ae===1,"is-in-month":Ce,"is-out-month":!Ce,"is-today":Pn(be,t),"is-weekend":Z===0||Z===6,disabled:!Me.allow||(P>X||P{const{onChange:n}=this.props;if(!n)return;const r=y(t.target).closest("[data-value]").dataset("value");r&&(n(+r),t.stopPropagation())})}render(t){const{className:n,max:i,min:r,value:o}=t,a=[],l=new Date().getFullYear();for(let c=r;c<=i;++c)a.push(x(xe,{type:"ghost","data-value":c,active:c===o,className:V(l===c?"is-current":""),onClick:$t(this,va),children:c},c));return x("div",{className:n,ref:$t(this,_a),children:a})}}_a=new WeakMap,va=new WeakMap;class ov extends pe{constructor(t){super(t);zt(this,ba);zt(this,wa);zt(this,lr,void 0);zt(this,cr,void 0);zt(this,hr,void 0);zt(this,ur,void 0);zt(this,dr,void 0);zt(this,fr,void 0);Ht(this,lr,fe()),Ht(this,cr,r=>{const o=y(r.target).closest("[data-set-date]");o.length&&this.changeDate(o.dataset("set-date"))}),Ht(this,hr,()=>{const{year:r,month:o}=this.state;o===1?this.setState({year:r-1,month:12}):this.setState({month:o-1})}),Ht(this,ur,()=>{const{year:r,month:o}=this.state;o===12?this.setState({year:r+1,month:1}):this.setState({month:o+1})}),Ht(this,dr,r=>{this.setState({year:r,select:"day"})}),Ht(this,fr,r=>{this.setState({month:r,select:"day"})}),this.changeDate=r=>{var o,a;(a=(o=this.props).onChange)==null||a.call(o,r)};const{date:n}=t,i=Bi(n)||new Date;this.state={select:"day",year:i.getFullYear(),month:i.getMonth()+1}}_showSelect(t){this.setState(n=>n.select===t?{select:"day"}:{select:t})}render(t,n){const{date:i,yearText:r=Ne.getLang("yearFormat")||"{0}",weekNames:o=Ne.getLang("weekNames"),monthNames:a=Ne.getLang("monthNames"),minDate:l,maxDate:c,weekStart:d}=t,u=Bi(i),{year:p,month:g,select:v}=n,C=v==="day",S=l||Ve("1970-1-1"),k=c||Ve("2099-12-31");return x("div",{className:"date-picker-menu row",ref:$t(this,lr),onClick:$t(this,cr),children:[mu(this,ba,og).call(this,t),x("div",{className:"cell",style:"width: 312px",children:[x("div",{className:"row p-2",children:[x(xe,{type:v==="year"?"primary-pale":"ghost",size:"sm",caret:!0,onClick:this._showSelect.bind(this,"year"),children:we(r,p)}),x(xe,{type:v==="month"?"primary-pale":"ghost",size:"sm",caret:!0,onClick:this._showSelect.bind(this,"month"),children:a?a[g-1]:g}),x("div",{className:"flex-auto"}),C?x("div",{children:[x(xe,{type:"ghost",size:"sm",square:!0,onClick:$t(this,hr),children:x("i",{className:"chevron-left"})}),x(xe,{type:"ghost",size:"sm",square:!0,onClick:$t(this,ur),children:x("i",{className:"chevron-right"})})]}):null]}),C?x(rv,{weekStart:d,weekNames:o,monthNames:a,maxDate:k,minDate:S,year:p,month:g,selections:u||[],onClickDate:this.changeDate,isAllowDate:t.isAllowDate}):null,v==="year"?x(xf,{className:"date-pick-menu-years overflow-y-auto scrollbar-hover scrollbar-thin",value:p,min:S.getFullYear(),max:k.getFullYear(),onChange:$t(this,dr)}):v==="month"?x(xf,{className:"date-pick-menu-month overflow-y-auto scrollbar-hover scrollbar-thin",value:g,min:1,max:12,onChange:$t(this,fr)}):null,C?mu(this,wa,ag).call(this,t):null]})]})}}lr=new WeakMap,cr=new WeakMap,hr=new WeakMap,ur=new WeakMap,dr=new WeakMap,fr=new WeakMap,ba=new WeakSet,og=function(t){return St.render(t.menu,[],{onClickItem:n=>{const i=n.item.value;typeof i=="string"&&this.changeDate(i)}},this)},wa=new WeakSet,ag=function(t){let{actions:n}=t;const{todayText:i=Ne.getLang("today"),clearText:r}=t;return n===void 0&&(n=[{text:i,"data-set-date":ut(new Date,"yyyy-MM-dd")}]),Array.isArray(n)&&(n={items:n}),x("div",{className:"date-picker-menu-footer",children:[x(ze,{btnProps:{className:"ghost text-primary"},...n}),r?x(xe,{type:"ghost text-link","data-set-date":"",children:r}):null]})};const eC="";let Gs=class extends ot{constructor(){super(...arguments),this.setDate=(e,t)=>{const{disabled:n,readonly:i}=this.props;if(!t&&(n||i))return;const r=this._calcValue(e);return this.changeState({value:r},()=>{this._afterSetDate()})},this._handleInputFocus=()=>{this.toggle(!0)},this._handleInputChange=e=>{this.setDate(e.target.value)},this._handleClearBtnClick=()=>{this.setDate("")},this._handleSetDate=e=>{this.setDate(e)}}getDefaultState(e){const t=super.getDefaultState(e);return{...t,value:this._calcValue(t.value)}}getDate(){return this._date}setValue(e,t){if(t){const n=this._trigger.current;n&&(n._skipTriggerChange=e)}return this.setDate(e,!0)}_calcValue(e){const{onInvalid:t,defaultValue:n="",required:i,allowInvalid:r,format:o}=this.props;let a=this._parseDate(e);if(!a&&t){const l=t(e);l&&(a=this._parseDate(l))}return this._date=a,a?ut(a,o):r?e:i?n:""}_getDateRange(e){const{minDate:t,maxDate:n}=this.props;return[Bi(typeof t=="function"?t(e):t),Bi(typeof n=="function"?n(e):n)]}_parseDate(e){const t=Bi(e);return t&&this._isAllowDate(t)?sv(t,...this._getDateRange(e)):null}_afterSetDate(){this.toggle(!1)}_renderTrigger(e,t){const{placeholder:n,icon:i,required:r,disabled:o,readonly:a,display:l}=e,{value:c="",open:d}=t,u=`date-picker-${this.id}`;let p;d&&!r&&c.length?p=x("button",{type:"button",className:"btn size-sm square ghost",onClick:this._handleClearBtnClick,children:x("span",{className:"close"})}):i&&(i===!0?p=x("i",{class:"i-calendar"}):p=x(De,{icon:i}));const g=d?c:l?l(c,this._date):c;return[x("input",{id:u,type:"text",className:"form-control",placeholder:n,value:g,disabled:o,readOnly:a,autoComplete:"off",onFocus:this._handleInputFocus,onChange:this._handleInputChange},"input"),p?x("label",{for:u,className:"input-control-suffix",children:p},"icon"):null]}_getTriggerProps(e,t){const n=super._getTriggerProps(e,t);return{...n,className:V(n.className,"date-picker input-control has-suffix-icon")}}_getPopProps(e,t){const n=super._getPopProps(e,t);return{...n,className:V(n.className,"popup")}}_isAllowDate(e){var n;const t=((n=this.props.isAllowDate)==null?void 0:n.call(this,e))??!0;return t===!0||typeof t=="object"&&t&&t.allow}_renderPop(e,t){const{weekNames:n,monthNames:i,weekStart:r,yearText:o,todayText:a,clearText:l,menu:c,actions:d,required:u,isAllowDate:p}=e,[g,v]=this._getDateRange(t.value);return x(ov,{onChange:this._handleSetDate,date:this._date,weekNames:n,monthNames:i,weekStart:r,yearText:o,todayText:a,clearText:u?"":l,menu:c,actions:d,minDate:g,maxDate:v,isAllowDate:p?this._isAllowDate.bind(this):void 0})}};Gs.defaultProps={...ot.defaultProps,popWidth:"auto",popMaxHeight:320,format:"yyyy-MM-dd",icon:!0,limitPopInScreen:!1};let yc=class extends Gs{constructor(){super(...arguments),this._handleSetDate=e=>{const t=Ve(e),n=this.getDate()||new Date;t.setHours(n.getHours()),t.setMinutes(n.getMinutes()),this.setDate(ut(t,this.props.format))},this._handleSetTime=(e,t)=>{const n=this.getDate()||new Date;e==="hour"?n.setHours(t):n.setMinutes(t),this.setDate(ut(n,this.props.format))}}getTime(){const e=this.getDate();return e?[e.getHours(),e.getMinutes()]:null}_afterSetDate(){}_renderPop(e,t){const[n,i]=this.getTime()||[];return x("div",{className:"datetime-picker-menu row",children:[super._renderPop(e,t),x("div",{className:"divider"}),x(wf,{hour:n,minute:i,minuteStep:e.minuteStep,onChange:this._handleSetTime})]})}};yc.defaultProps={...Gs.defaultProps,popMaxHeight:310,format:"yyyy-MM-dd hh:mm",minuteStep:5};class Do extends ye{}Do.NAME="TimePicker",Do.Component=$o,Do.register();class Io extends ye{}Io.NAME="DatePicker",Io.Component=Gs,Io.register();class No extends ye{}No.NAME="DatetimePicker",No.Component=yc,No.register();const tC="",Sf="show",_c="in",av='[data-dismiss="modal"]',Mo="modal-hide",Ys=class Ts extends Fe{constructor(){super(...arguments),this._timer=0,this._handleClick=e=>{const t=e.target,n=t.closest(".modal");!n||n!==this.modalElement||(t.closest(av)||this.options.backdrop===!0&&t===n)&&(e.preventDefault(),this.hide())}}static get SELECTOR(){return".modal"}get modalElement(){return this.element}get shown(){return this._shown}get dialog(){return this.modalElement.querySelector(".modal-dialog")}get rob(){return this._rob}_observeResize(){var e;if(this.options.responsive&&typeof ResizeObserver<"u"){(e=this._rob)==null||e.disconnect();const{dialog:t}=this;if(t){const n=new ResizeObserver(()=>{if(!this._shown)return;const i=t.clientWidth,r=t.clientHeight,[o,a]=this._lastDialogSize||[];(o!==i||a!==r)&&(this._lastDialogSize=[i,r],this.layout())});n.observe(t),this._rob=n}}}afterInit(){this.on("click",this._handleClick),this.options.show&&this.show(),this._observeResize(),this.on("hidden",e=>{const{modalElement:t}=this;if(!t.parentNode)return this.destroy();e.target.closest(".modal")===t&&!Ts.getAll().some(n=>n.shown)&&y("html").enableScroll()}),this.on("show",e=>{const{modalElement:t}=this;if(!t.parentNode)return this.destroy();e.target.closest(".modal")===t&&y("html").disableScroll()}),this.shown&&y("html").disableScroll()}destroy(){super.destroy(),this._rob&&(this._rob.disconnect(),this._rob=void 0)}show(e){var c;const{modalElement:t}=this,n=y(t);if(this._shown&&n.hasClass(_c))return n.removeClass(Mo).css("z-index",`${Ts.zIndex++}`),!1;this._shown=!0,this.setOptions(e);const{animation:i,backdrop:r,className:o,style:a}=this.options;n.setClass({"modal-trans":i,"modal-no-backdrop":!r,[Mo]:!1},Sf,o).css({zIndex:`${Ts.zIndex++}`,...a});const l=this.constructor;return l.hideOthers&&this.options.hideOthers!==!1&&l.getAll().forEach(d=>{d!==this&&d.shown&&!n.closest(d.modalElement).length&&d.hideForOther()}),this.options.closeOthers&&l.getAll().forEach(d=>{d!==this&&!n.closest(d.modalElement).length&&d.hide()}),this.layout(),(c=this.options.onShow)==null||c.call(this),this.emit("show"),this._setTimer(()=>{n.addClass(_c),this._setTimer(()=>{var d,u;(d=n.find("[autofocus]")[0])==null||d.focus(),(u=this.options.onShown)==null||u.call(this),this.emit("shown")})},50),!0}hideForOther(){y(this.modalElement).addClass(Mo)}hide(){var t;if(!this._shown)return!1;this._shown=!1,y(this.modalElement).removeClass(_c),(t=this.options.onHide)==null||t.call(this),this.emit("hide"),this._setTimer(()=>{var n;y(this.modalElement).removeClass(Sf),(n=this.options.onHidden)==null||n.call(this),this.emit("hidden")});const e=this.constructor;return e.hideOthers&&this.options.hideOthers!==!1&&e.getAll().forEach(n=>{n.shown&&n!==this&&y(n.modalElement).removeClass(Mo)}),!0}layout(e,t){if(!this._shown)return;const{dialog:n}=this;if(!n)return;const i=y(n);if(t=t??this.options.size,t){i.removeAttr("data-size");const d={width:"",height:""};typeof t=="object"?(d.width=t.width,d.height=t.height):typeof t=="string"&&["md","sm","lg","full"].includes(t)?i.attr("data-size",t):t&&(d.width=t),i.css(d)}e=e??this.options.position??"fit";const r=n.clientWidth,o=n.clientHeight;this._lastDialogSize=[r,o],typeof e=="function"&&(e=e({width:r,height:o}));const a={left:null,bottom:null,right:null};let l=null,c="center";typeof e=="number"?(c="flex-start",l=e):typeof e=="object"&&e?(Object.assign(a,e),l=a.top??l,c=a.alignSelf??"flex-start"):e==="fit"?(c="flex-start",l=`${Math.max(0,Math.floor((window.innerHeight-o)/3))}px`):e==="bottom"?c="flex-end":e==="top"?c="flex-start":e!=="center"&&typeof e=="string"&&(c="flex-start",l=e),a.top=l,a.alignSelf=c,i.css(a),y(this.modalElement).css("justifyContent",a.left?"flex-start":"center")}_setTimer(e,t){this._timer&&(clearTimeout(this._timer),this._timer=0),e&&(this.options.animation?this._timer=window.setTimeout(e,t??this.options.transTime):e())}static last(e){return Ts.query(e,void 0,t=>t.shown)}static hide(e){var t;(t=Ts.last(e))==null||t.hide()}static show(e){var t;(t=Ts.query(e,void 0,n=>!n.shown))==null||t.show()}};Ys.NAME="Modal",Ys.MULTI_INSTANCE=!0,Ys.DEFAULT={position:"fit",show:!0,keyboard:!0,animation:!0,backdrop:!0,responsive:!0,transTime:300},Ys.hideOthers=!0,Ys.zIndex=1500;let Qs=Ys;y(window).on(`resize.${Qs.NAMESPACE}`,()=>{Qs.getAll().forEach(s=>{const e=s;e.shown&&e.options.responsive&&e.layout()})});class Tf extends pe{constructor(e){super(e),this._ref=fe(),this.state={showed:!e.waitShowEvent}}componentDidMount(){const{waitShowEvent:e,afterRender:t}=this.props;t==null||t.call(this,{firstRender:!0}),e&&y(this._ref.current).on(e,()=>{this.setState({showed:!0})})}componentDidUpdate(){var e;(e=this.props.afterRender)==null||e.call(this,{firstRender:!1})}componentWillUnmount(){var e;(e=this.props.beforeDestroy)==null||e.call(this)}renderHeader(){const{header:e,headerClass:t,title:n}=this.props;return I.isValidElement(e)?e:e===!1||!n?null:e?x(me,{className:V("modal-header",t),content:e}):x("div",{className:V("modal-header",t),children:x("div",{className:"modal-title",children:n})})}renderActions(){const{actions:e,closeBtn:t}=this.props;return!t&&!e?null:I.isValidElement(e)?e:x("div",{className:"modal-actions",children:[e?x(ze,{...e}):null,t?x("button",{type:"button",class:"btn square ghost","data-dismiss":"modal",children:x("span",{class:"close"})}):null]})}renderBody(){const{body:e,bodyClass:t}=this.props;return e?I.isValidElement(e)?e:x(me,{className:V("modal-body",t),content:e}):null}renderFooter(){const{footer:e,footerClass:t,footerActions:n}=this.props;return I.isValidElement(e)?e:e===!1||!n?null:e?x(me,{className:V("modal-footer",t),content:e}):x("div",{className:V("modal-footer",t),children:n?x(ze,{...n}):null})}render(){const{className:e,style:t,contentClass:n,children:i,waitShowEvent:r}=this.props,o=r&&!this.state.showed;return x("div",{ref:r?this._ref:void 0,className:V("modal-dialog",e,o?"loading":""),style:t,children:[x("div",{className:V("modal-content",n),children:[this.renderHeader(),this.renderActions(),this.renderBody(),i,this.renderFooter()]}),o?x("div",{class:"load-indicator loading"}):null]})}}Tf.defaultProps={closeBtn:!0};class vc extends pe{constructor(){super(...arguments),this._ref=fe(),this.state={},this._handleIframeLoad=()=>{const e=this.iframeDoc;if(!e)return;const{iframeBodyClass:t,watchHeight:n}=this.props;n&&this._watchIframeHeight(),t&&e.body.classList.add(t),y(this._ref.current).trigger("modal-iframe-loaded")}}get iframeDoc(){var e,t;return(t=(e=this._ref.current)==null?void 0:e.contentWindow)==null?void 0:t.document}componentDidMount(){this.props.watchHeight&&this._watchIframeHeight()}componentWillUnmount(){var e;(e=this._rob)==null||e.disconnect()}_watchIframeHeight(){const e=this.iframeDoc;if(!e)return;let t=this._rob;t==null||t.disconnect(),t=new ResizeObserver(()=>{const n=e.body,i=e.documentElement,r=Math.ceil(Math.max(n.scrollHeight,n.offsetHeight,i.offsetHeight));this.setState({height:r})}),t.observe(e.body),t.observe(e.documentElement),this._rob=t}render(){return x("iframe",{className:"modal-iframe",style:this.state,src:this.props.url,ref:this._ref,onLoad:this._handleIframeLoad})}}vc.defaultProps={watchHeight:!0};var bc=(s,e,t)=>{if(!e.has(s))throw TypeError("Cannot "+t)},Kt=(s,e,t)=>(bc(s,e,"read from private field"),t?t.call(s):e.get(s)),Hi=(s,e,t)=>{if(e.has(s))throw TypeError("Cannot add the same private member more than once");e instanceof WeakSet?e.add(s):e.set(s,t)},Js=(s,e,t,n)=>(bc(s,e,"write to private field"),n?n.call(s,t):e.set(s,t),t),Po=(s,e,t)=>(bc(s,e,"access private method"),t),gn,Wi,yn,Eo,wc,Ao,Cc;function lv(s,e){const{custom:t,title:n,content:i}=e;return{body:i,title:n,...typeof t=="function"?t():t}}async function cv(s,e){const{dataType:t="html",url:n,request:i,custom:r,title:o,replace:a=!0,executeScript:l=!0}=e,c=await y.ajax({url:n,headers:{"X-ZUI-Modal":"true"},...i});if(t!=="html")try{const d=JSON.parse(c);return{title:o,...r,...d}}catch{}return a!==!1&&t==="html"?[c]:{title:o,...r,body:t==="html"?x(pn,{className:"modal-body",html:c,executeScript:l}):c}}async function hv(s,e){const{url:t,custom:n,title:i,size:r}=e,o=typeof r=="object"&&typeof r.height=="number";return{title:i,...n,waitShowEvent:"modal-iframe-loaded",body:x(vc,{url:t,watchHeight:!o})}}const uv={custom:lv,ajax:cv,iframe:hv},$f="loading",Df=class $s extends Qs{constructor(){super(...arguments),Hi(this,Eo),Hi(this,Ao),Hi(this,gn,void 0),Hi(this,Wi,void 0),Hi(this,yn,void 0)}get id(){return Kt(this,Wi)}get loading(){var e;return(e=Kt(this,gn))==null?void 0:e.classList.contains($f)}get shown(){var e;return!!((e=Kt(this,gn))!=null&&e.classList.contains("show"))}get modalElement(){let e=Kt(this,gn);if(!e){const{options:t}=this;let n=Kt(this,Wi);n||(n=t.id||`modal-${mt()}`,Js(this,Wi,n));const{$element:i}=this;if(e=i.find(`#${n}`)[0],e)y(e).data(this.constructor.KEY,this);else{const r=this.key;e=y("
").attr({id:n,"data-key":r}).data(this.constructor.KEY,this).css(t.style||{}).setClass("modal modal-async load-indicator",t.className).appendTo(i)[0]}Js(this,gn,e)}return e}get $emitter(){const e=Kt(this,gn);return e?y(e):this.$element}afterInit(){super.afterInit(),this.options.destroyOnHide&&this.options.type!=="static"&&this.on("hidden",e=>{y(e.target).data("key")===this.key&&this.destroy()})}show(e){return super.show(e)?(this.buildDialog(),!0):!1}destroy(){super.destroy();const e=Kt(this,gn);e&&(y(e).removeData(this.constructor.KEY).remove(),Js(this,gn,void 0))}render(e){return super.render(e),this.buildDialog()}async buildDialog(){if(this.loading)return!1;Kt(this,yn)&&clearTimeout(Kt(this,yn));const{modalElement:e,options:t}=this,n=y(e),{type:i,loadTimeout:r,loadingClass:o=$f,loadingText:a=null}=t;if(!i||i==="static")return!0;const l=uv[i];if(!l)return console.warn(`Modal: Cannot build modal with type "${i}"`),!1;n.attr("data-loading",a).addClass(o),r&&Js(this,yn,window.setTimeout(()=>{Js(this,yn,0),Po(this,Ao,Cc).call(this,this.options.timeoutTip)},r));const c=await l.call(this,e,t);return this._destroyed?!1:(c===!1?await Po(this,Ao,Cc).call(this,this.options.failedTip):c&&typeof c=="object"&&await Po(this,Eo,wc).call(this,c),Kt(this,yn)&&(clearTimeout(Kt(this,yn)),Js(this,yn,0)),this.layout(),await Ps(100),n.removeClass(o),!0)}static isValid(e){return!y.isDetached(e.modalElement)}static open(e){return new Promise(t=>{const{container:n=document.body,ref:i,...r}=e,o={show:!0,...r};!o.type&&o.url&&(o.type="ajax"),!o.type&&e.id&&(o.type="static"),o.key===void 0&&(o.key=o.id);const a=$s.ensure(n,o);i&&(i.current=a);const l=`${$s.NAMESPACE}.open${mt()}`;a.on(`hidden${l}`,()=>{a.off(l),t(a)}),a.show()})}static async alert(e){typeof e=="string"&&(e={message:e});const{type:t,message:n,icon:i,iconClass:r="icon-lg muted",actions:o="confirm",onClickAction:a,custom:l,key:c="__alert",...d}=e,u=(typeof l=="function"?l():l)||{};let p=typeof n=="object"&&n.html?x("div",{dangerouslySetInnerHTML:{__html:n.html}}):x("div",{children:n});i?p=x("div",{className:V("modal-body row gap-4 items-center",u.bodyClass),children:[x("div",{className:`icon ${i} ${r}`}),p]}):p=x("div",{className:V("modal-body",u.bodyClass),children:p});const g=[];(Array.isArray(o)?o:[o]).forEach(S=>{S={...typeof S=="string"?{key:S}:S},typeof S.key=="string"&&(S.text||(S.text=Ne.getLang(S.key,S.key)),S.btnType||(S.btnType=`btn-wide ${S.key==="confirm"?"primary":"btn-default"}`)),S&&g.push(S)},[]);let v;const C=g.length?{gap:4,items:g,onClickItem:({item:S,event:k})=>{const D=$s.query(k.target);if(!D||D.key!==c)return;v=S.key,(a==null?void 0:a(S,D))!==!1&&D&&D.hide()}}:void 0;return await $s.open({key:c,type:"custom",size:400,className:"modal-alert",content:p,modal:!0,backdrop:"static",hideOthers:!1,custom:{footerActions:C,...u},...d}),v}static async confirm(e){typeof e=="string"&&(e={message:e});const{onClickAction:t,onResult:n,...i}=e;return await $s.alert({actions:["confirm","cancel"],onClickAction:(o,a)=>{n==null||n(o.key==="confirm",a),t==null||t(o,a)},...i})==="confirm"}static async prompt(e){typeof e=="string"&&(e={message:e});const{defaultValue:t="",placeholder:n,onResult:i,onShown:r,message:o,content:a,bodyClass:l,custom:c,...d}=e;let u=t,p=!1;const g=fe();return await $s.confirm({...d,custom:{closeBtn:!1,...c},message:o,ref:g,content:x("div",{className:V("modal-body",l),children:[x(me,{content:o}),x("input",{type:"text",className:"modal-prompt-input form-control mt-3",autoFocus:!0,placeholder:n,defaultValue:t,onChange:C=>{u=C.target.value},onKeyDown:C=>{var S,k;C.key==="Enter"?(p=!0,C.preventDefault(),(S=g.current)==null||S.hide()):C.key==="Escape"&&((k=g.current)==null||k.hide())}}),a]})})||p?u:null}};gn=new WeakMap,Wi=new WeakMap,yn=new WeakMap,Eo=new WeakSet,wc=function(s){return new Promise(e=>{if(Array.isArray(s))return y(this.modalElement).html(s[0]).zuiInit(),this.layout(),this._observeResize(),e();const{afterRender:t,...n}=s;s={afterRender:i=>{this.layout(),t==null||t(i),this._observeResize(),e()},...n},as(x(Tf,{...s}),this.modalElement)})},Ao=new WeakSet,Cc=function(s){if(s)return Po(this,Eo,wc).call(this,{body:x("div",{className:"modal-load-failed",children:s})})},Df.DEFAULT={...Qs.DEFAULT,loadTimeout:1e4,destroyOnHide:!0};let Ue=Df;Ue.register();class Xs extends Fe{get modal(){return this._modal}get container(){const{container:e}=this.options;return typeof e=="string"?document.querySelector(e):e instanceof HTMLElement?e:document.body}show(){var e;return(e=this._initModal())==null?void 0:e.show()}hide(){var e;return(e=this._modal)==null?void 0:e.hide()}_getBuilderOptions(){const{container:e,...t}=this.options,n=t,i=this.$element.attr("href")||"";return n.type||(n.target||i[0]==="#"?n.type="static":n.type=n.type||(n.url||i?"ajax":"custom")),!n.url&&(n.type==="iframe"||n.type==="ajax")&&i[0]!=="#"&&(n.url=i),n.key===void 0&&(n.key=`${this._key}`),n}_initModal(){const e=this._getBuilderOptions();let t=this._modal;if(t)return t.setOptions(e),t;if(e.type==="static"){const n=this._getStaticModalElement();if(!n)return;t=Qs.ensure(n,e)}else t=Ue.ensure(this.container,e);return this._modal=t,t.on("destroyed",()=>{this._modal=void 0}),t}_getStaticModalElement(){let e=this.options.target;if(!e){const{$element:t}=this;if(t.is("a")){const n=t.attr("href");n!=null&&n.startsWith("#")&&(e=n)}}return this.container.querySelector(e||".modal")}}Xs.NAME="ModalTrigger",Xs.toggle={name:"modal",skip:"[disabled],.disabled,.open-in-parent",convertHref:!0,onGet(s){return Xs.get(s)},onCreate(s,e,t){return new Xs(s,t)}},Xs.register();const dv={zh_cn:{selectFile:"选择文件",fileSelectTip:"(不超过 {maxFileSize})",removeFile:"移除文件",renameFile:"重命名",duplicatedTip:"文件 “{name}”({size}) 已存在。",exceededSizeTip:"文件 “{name}”({size}) 超过了 {maxFileSize} 的限制。",exceededTotalSizeTip:"文件 “{name}”({size}) 超过了总大小 {totalFileSize} 的限制。",exceededCountTip:"文件 “{name}”({size}) 超过了数量 {maxFileCount} 的限制。"},zh_tw:{selectFile:"選擇文件",fileSelectTip:"(不超過 {maxFileSize})",removeFile:"移除文件",renameFile:"重命名",duplicatedTip:"文件 “{name}”({size}) 已存在。",exceededSizeTip:"文件 “{name}”({size}) 超過了 {maxFileSize} 的限制。",exceededTotalSizeTip:"文件 “{name}”({size}) 超過了總大小 {totalFileSize} 的限制。",exceededCountTip:"文件 “{name}”({size}) 超過了數量 {maxFileCount} 的限制。"},en:{selectFile:"Select File",fileSelectTip:"(Not exceeding {maxFileSize})",removeFile:"Remove File",renameFile:"Rename",duplicatedTip:"File “{name}” ({size}) already exists.",exceededSizeTip:"File “{name}” ({size}) exceeds the limit of {maxFileSize}.",exceededTotalSizeTip:"File “{name}” ({size}) exceeds the total size limit of {totalFileSize}.",exceededCountTip:"File “{name}” ({size}) exceeds the limit of {maxFileCount}."}};let Fn=class extends Be{constructor(e){if(e.totalFileSize)if(e.maxFileSize){const{maxFileSize:t,totalFileSize:n}=e,i=typeof t=="number"?t:Dn(t),r=typeof n=="number"?n:Dn(n);e.maxFileSize=i>r?n:t}else e.maxFileSize=e.totalFileSize;e.maxFileSize||(e.maxFileSize="100MB"),super(e),this._input=fe(),this._file=fe(),this._id=`file-selector-input-${mt()}`,this._data=new DataTransfer,this.stopRenameFile=()=>{const{renaming:t,newName:n}=this.state;this.cancelRenameFile(),!(!t||!n)&&this.renameFile(t,n)},this.cancelRenameFile=()=>{this.setState({renaming:""})},this._handleChange=t=>{const n=t.target;n.files&&(this.selectFiles(n.files),this.setState({inputKey:mt()}))},this._handleDragOver=t=>{t.preventDefault(),this.state.dragging||this.setState({dragging:!0})},this._handleDragLeave=t=>{t.preventDefault(),this.setState({dragging:!1})},this._handleDrop=t=>{var i;this._handleDragLeave(t);const n=this.constructor.filterFiles(((i=t.dataTransfer)==null?void 0:i.files)||[],this.props.accept);n.length&&(this.selectFiles(n),this.setState({inputKey:mt()}))},this._handleRenameChange=t=>{this.setState({newName:t.target.value})},this._handleClick=t=>{if(this.props.disabled)return;const i=y(t.target).closest("[data-remove-file],[data-rename-file]");if(!i.length)return;const r=i.data();r.renameFile?this.startRenameFile(String(r.renameFile)):r.removeFile&&this.removeFile(String(r.removeFile))},this.state={files:(e.defaultFiles||[]).map(t=>this.constructor.getInfo(t)),inputKey:0}}get size(){return this.state.files.reduce((e,t)=>e+t.size,0)}get count(){return this.state.files.length}get multiple(){const{multiple:e,maxFileCount:t,name:n=""}=this.props;return!!(t!==1&&(e??n.endsWith("[]")))}get info(){const{maxFileSize:e=0,maxFileCount:t=Number.MAX_SAFE_INTEGER}=this.props;return{size:ft(this.size,1),maxFileSize:ft(typeof e=="string"?Dn(e):e,1),maxFileCount:t,count:this.count}}get files(){return this._data.files}componentDidMount(){const e=this.state.files.reduce((t,n)=>(n.file&&t.push(n.file),t),[]);e.length&&(e.forEach(t=>this._data.items.add(t)),this._syncFiles())}getFile(e){return this.state.files.find(t=>t.id===e)}getFileByName(e){return this.state.files.find(t=>t.name===e)}select(){var e;(e=this._input.current)==null||e.click()}async selectFiles(e){var t;if(((t=this.props.onSelect)==null?void 0:t.call(this,e))!==!1){this._skipAddMore=!1;for(let n=0;n({files:[...c.files,i]})),!0)}startRenameFile(e){this.setState({renaming:e,newName:void 0},()=>{const t=y(this._file.current).closest(".file-selector").find(".file-selector-rename-input")[0];t&&(t.select(),t.focus())})}async renameFile(e,t){const n=this.getFile(e);if(!n||n.name===t)return;const{onRename:i}=this.props;if(i&&await i.call(this,t,n.name,n)===!1)return;const r=n.file,{files:o,renamedFiles:a={}}=this.state;if(r){const c=new File([r],t,{type:r.type,lastModified:r.lastModified}),d=Array.from(this._data.files).indexOf(r);d>=0&&this._data.items.remove(d),this._data.items.add(c),this._syncFiles(!0),n.file=c}else a[n.id]=t;n.name=t,n.ext=this.constructor.getExt(t);const l=o.indexOf(n);l>=0?o.splice(l,1,n):o.push(n),this.setState({files:[...o],renamedFiles:{...a}})}async removeFile(e){const t=this.getFile(e);if(!t)return;const{onRemove:n,removeConfirm:i}=this.props;if(i){let c=i;if(typeof c=="string"&&(c={message:c}),typeof c.message=="string"&&(c.message=we(c.message,{name:t.name,size:ft(t.size,1)})),!await Ue.confirm(c))return}if(n&&await n.call(this,t)===!1)return;if(t.file){const c=Array.from(this._data.files).indexOf(t.file);c>=0&&this._data.items.remove(c)}const{files:r,deletedFiles:o=[],renamedFiles:a={}}=this.state,l=r.indexOf(t);l>=0&&(!t.file&&!o.includes(t.id)&&(delete a[t.id],o.push(t.id)),r.splice(l,1),this.setState({files:[...r],deletedFiles:[...o],renamedFiles:{...a}}),this._syncFiles(!0))}_syncFiles(e=!1){const t=this._data.files,n=this._file.current;n.files=t,e&&y(n).trigger("change",{files:t})}_showAlert(e,t){return typeof e=="string"&&(e={message:e}),typeof e.message=="string"&&(e.message=we(e.message,{...this.info,...t})),Ue.alert(e)}_getTip(e){return typeof e=="string"?we(e,this.info):e}_renderInput(e){return x("input",{id:this._id,multiple:this.multiple,accept:e.accept,style:"display:none",type:"file",ref:this._input,onChange:this._handleChange},`input${this.state.inputKey}`)}_getDraggableProps(){const e={};return this.props.draggable&&!this.props.disabled&&(e.onDragOver=this._handleDragOver,e.onDragLeave=this._handleDragLeave,e.onDrop=this._handleDrop),e}_renderUpload(e){const{mode:t,disabled:n,tip:i=this.i18n("fileSelectTip"),uploadBtn:r}=e,o=ke({component:"label",attrs:{for:n?void 0:this._id},disabled:n,text:this.i18n("selectFile")},typeof r=="object"?r:typeof r=="string"?{text:r}:{}),a=x("div",{className:"file-selector-tip",children:x(me,{content:this._getTip(i),generatorThis:this,generatorArgs:[this.state]})}),l=t==="grid",c=l?{}:this._getDraggableProps();return l||t==="box"?x(xe,{...o,...c,className:V(l?"file-selector-grid-btn":"file-selector-box",o.className),children:a},"upload"):x("div",{className:"file-selector-btn",...c,children:[x(xe,{rounded:"full",size:"sm",...o}),a]},"upload")}_renderForForm(e){const{name:t,accept:n,onChange:i,deleteName:r,renameName:o}=e,{deletedFiles:a,renamedFiles:l}=this.state,c=[x("input",{ref:this._file,type:"file",name:t,multiple:this.multiple,accept:n,style:"display:none",onChange:i},"form")];return r&&a&&c.push(...a.map(d=>x("input",{type:"hidden",name:`${r}[${d}]`,value:d},`delete:${d}`))),o&&l&&c.push(...Object.entries(l).map(([d,u])=>x("input",{type:"hidden",name:`${o}[${d}]`,value:u},`rename:${d}`))),c}_getIcon(e){let{fileIcons:t}=this.props;if(t)return typeof t=="string"&&(t={default:t}),t[e.ext]??t.default}_getThumbnail(e){if((e.file||e.url)&&this.props.thumbnail&&this.constructor.isImage(e))return e.url||URL.createObjectURL(e.file)}_getAvatar(e){const t=this._getThumbnail(e);let n;if(t)n={src:t};else{const i=this._getIcon(e);i&&(n={icon:i})}return n&&{size:this.props.mode==="grid"?void 0:"sm",...n}}_getFileActions(e){if(this.props.disabled)return;let{removeBtn:t,renameBtn:n}=this.props;typeof t=="function"&&(t=t.call(this,e)),typeof t=="string"?t={text:t}:t===!0&&(t={hint:this.i18n("removeFile"),icon:"trash"}),typeof n=="function"&&(n=n.call(this,e)),typeof n=="string"?n={text:n}:n===!0&&(n={hint:this.i18n("renameFile"),icon:"edit"});const i=[];return n&&i.push({"data-rename-file":e.id,...n}),t&&i.push({"data-remove-file":e.id,...t}),i}_renderFile(e){let{itemProps:t}=this.props;return t=ke({className:this.props.mode==="grid"?"file-selector-grid-item":"file-selector-item",multiline:!1,title:e.name,subtitle:ft(e.size,1),avatar:this._getAvatar(e),actions:this._getFileActions(e),"z-id":e.id},typeof t=="function"?t.call(this,e):t),x(en,{...t},e.id)}_renderFileRename(e){let{itemProps:t}=this.props;if(typeof t=="function")t=t.call(this,e);else{const{newName:n=e.name}=this.state,i=this.props.mode==="grid",r=x("div",{className:"file-selector-rename-text",children:[x("div",{className:"form-control size-sm",children:n}),x("input",{type:"text",defaultValue:e.name,className:"form-control size-sm select-all file-selector-rename-input",autofocus:!0,onBlur:i?this.stopRenameFile:void 0,onChange:this._handleRenameChange,onInput:this._handleRenameChange})]});t=ke({className:`${i?"file-selector-grid-item":"file-selector-item"} is-renaming`,multiline:!1,avatar:this._getAvatar(e),"z-id":e.id,contentClass:"file-selector-rename",content:i?r:[r,x(xe,{icon:"check",text:this.i18n("confirm"),type:"primary-pale",size:"sm",onClick:this.stopRenameFile}),x(xe,{icon:"close",text:this.i18n("cancel"),type:"gray-pale",size:"sm",onClick:this.cancelRenameFile})]},t)}return x(en,{...t},e.id)}_renderList(e){const{files:t,renaming:n}=this.state;return x("div",{className:`file-selector-list${t.length?"":" is-empty"}`,onClick:this._handleClick,children:t.map(i=>i.id===n?this._renderFileRename(i):this._renderFile(i))},"list")}_renderGrid(e){const t=this._getDraggableProps(),{gridWidth:n=120,gridHeight:i=148,gridGap:r=12}=e,o={"--file-selector-grid-width":We(n),"--file-selector-grid-height":We(i),"--file-selector-grid-gap":We(r)},{files:a,renaming:l}=this.state;return x("div",{className:"file-selector-grid",style:o,onClick:this._handleClick,...t,children:[a.map(c=>c.id===l?this._renderFileRename(c):this._renderFile(c)),this._renderUpload(e)]},"grid")}_getClassName(e){return["file-selector",`is-mode-${e.mode}`,e.className,this.state.dragging?"is-dragging":""]}_getChildren(e){const t=e.mode==="grid";return[t?null:this._renderUpload(e),t?this._renderGrid(e):this._renderList(e),this._renderInput(e),this._renderForForm(e)]}static getExt(e){return(e.split(".").pop()||"").toLowerCase()}static getInfo(e){const{name:t,size:n,type:i}=e;if(e instanceof File)return{name:t,size:n,type:i,file:e,id:[t,n].join(":"),ext:this.getExt(t)};const r=typeof n=="string"?Dn(n):n;return{name:t,size:r,id:e.id?String(e.id):[t,r].join(":"),type:i??"",ext:this.getExt(t),file:e.file,url:e.url}}static isAccept(e,t){return!t||!t.length?!0:(Array.isArray(t)?t:t.split(",")).some(i=>e.type&&i===e.type?!0:i.startsWith(".")?e.name.endsWith(i):i.endsWith("/*")?e.type.startsWith(i.slice(0,-1)):!1)}static isImage(e){return this.isAccept(e,this.imageAccepts)}static filterFiles(e,t){if(!t||!t.length)return e;e instanceof FileList&&(e=Array.from(e));const n=t.split(",");return e.filter(i=>this.isAccept(i,n))}};Fn.defaultProps={mode:"button",fileIcons:"file",renameBtn:!0,removeBtn:!0,draggable:!0,thumbnail:!0,maxFileCount:0},Fn.i18n=dv,Fn.imageAccepts="image/*,.png,.jpg,.jpeg,.gif";let kc=class extends Fn{};kc.defaultProps={...Fn.defaultProps,mode:"grid",accept:Fn.imageAccepts};const fv=Object.freeze(Object.defineProperty({__proto__:null,FileSelector:Fn,ImageSelector:kc},Symbol.toStringTag,{value:"Module"}));class Lo extends ye{}Lo.NAME="FileSelector",Lo.Component=Fn,Lo.replace=!0;class Ro extends ye{}Ro.NAME="ImageSelector",Ro.Component=kc,Ro.replace=!0,Xe(fv);const nC="",xc=class lg extends dt{_getClassName(e){const{type:t,stacked:n}=e;return[super._getClassName(e),t?`nav-${t}`:"",n?"nav-stacked":""]}static render(e,t,n,i){let r=typeof e=="function"?e.call(i??this,...t):e;if(r)return Array.isArray(r)&&(r={items:r}),n&&(r=ke(n,r)),b(lg,{...r})}};xc.NAME="nav",xc.defaultItemProps={component:"li",innerComponent:"a"};let If=xc;const pv=Object.freeze(Object.defineProperty({__proto__:null,Nav:If},Symbol.toStringTag,{value:"Module"}));class Sc extends ye{}Sc.NAME="Nav",Sc.Component=If,Xe(pv);const sC="",iC="",rC="",oC="",aC="",lC="",cC="",hC="",uC="",dC="",fC="",pC="",mC="";function Ui(s,e){const t=s.pageTotal||Math.ceil(s.recTotal/s.recPerPage);return typeof e=="string"&&(e==="first"?e=1:e==="last"?e=t:e==="prev"?e=s.page-1:e==="next"?e=s.page+1:e==="current"?e=s.page:e=Number.parseInt(e,10)),e=e!==void 0?Math.max(1,Math.min(e<0?t+e:e,t)):s.page,{...s,pageTotal:t,page:e}}function Nf({key:s,type:e,btnType:t,page:n,format:i,pagerInfo:r,linkCreator:o,...a}){const l=Ui(r,n);return a.text===void 0&&!a.icon&&i&&(a.text=typeof i=="function"?i(l):we(i,l)),a.url===void 0&&o&&(a.url=typeof o=="function"?o(l):we(o,l)),a.disabled===void 0&&(a.disabled=n!==void 0&&l.page===r.page),x(xe,{type:t,"z-go-to-page":l.page,...a})}function Mf({key:s,type:e,page:t,text:n="",pagerInfo:i,children:r,...o}){const a=Ui(i,t);return n=typeof n=="function"?n(a):we(n,a),x(Be,{...o,children:[r,n]})}function mv({type:s,btnType:e,count:t=12,pagerInfo:n,linkCreator:i,...r}){if(!n.pageTotal)return;const o={...r,square:!0},a=()=>(o.text="",o.icon="icon-ellipsis-h",o.disabled=!0,x(xe,{type:e,...o})),l=(d,u)=>{const p=[];for(let g=d;g<=u;g++){o.text=g,delete o.icon,o.disabled=!1;const v=Ui(n,g);i&&(o.url=typeof i=="function"?i(v):we(i,v)),p.push(x(xe,{type:e,...o}))}return p};let c=[];return c=[...l(1,1)],n.pageTotal<=1||(n.pageTotal<=t?c=[...c,...l(2,n.pageTotal)]:n.pagen.pageTotal-t+3?c=[...c,a(),...l(n.pageTotal-t+3,n.pageTotal)]:c=[...c,a(),...l(n.page-Math.ceil((t-4)/2),n.page+Math.floor((t-4)/2)),a(),...l(n.pageTotal,n.pageTotal)]),c}const gC="";let gv=class extends pe{render(e){const{id:t,popup:n,title:i,content:r,style:o,className:a,closeBtn:l,arrow:c,headingClass:d,titleClass:u,contentClass:p,arrowStyle:g,onlyInner:v,footer:C,footerClass:S}=e;let k=x(me,{content:r},"content");(p||i)&&(k=x("div",{className:p,children:k},"content"));let D=x(me,{content:C},"footer");(S||i)&&(D=x("div",{className:S,children:D},"footer"));const P=[],F=l?x("button",{className:"btn ghost square size-sm btn-close","data-dismiss":"popover",children:x("span",{className:"close"})}):null;return i?P.push(x("div",{className:d,children:[i?x(me,{className:u,content:i}):null,F]},"heading")):P.push(F),P.push(k,D),c&&P.push(x("div",{className:typeof c=="string"?c:"arrow",style:g},"arrow")),v?P:x("div",{id:t,className:V("popover",a,{popup:n,"has-heading":i}),style:o,children:P})}};class Oo extends ye{}Oo.NAME="PopoverPanel",Oo.Component=gv;const Pf="show",Ef="in",Zs=class cg extends Fe{constructor(){super(...arguments),this._getClickBounding=()=>{const e=this._triggerEvent;return{x:e.clientX,y:e.clientY,left:e.clientX,top:e.clientY,width:0,height:0,bottom:e.clientY,right:e.clientX}}}get shown(){return this._shown}get id(){return this._id}get zIndex(){return this._zIndex}get trigger(){return this._triggerElement}get target(){return this._targetElement}afterInit(){const{trigger:e,id:t,triggerEvent:n}=this.options;this._triggerEvent=n,this._id=t||`popover_${this.gid}`;const i=this.getTriggerElement();if(i instanceof HTMLElement){const o=y(i),{namespace:a}=this;if(e){const l=()=>{let c=o.dataset();const d=o.attr(`zui-toggle-${this.constructor.ZUI}`);d&&(c=y.extend(c,rs(d))),this.setOptions(c)};e==="hover"?o.on(`pointerenter${a}`,c=>{o.is("[disabled],.disabled")||(l(),this.show({delay:!0,event:c}))}).on(`pointerleave${a} pointercancel${a}`,()=>{this.delayHide()}):o.on(`${e}${a}`,c=>{o.is("[disabled],.disabled")||(this.shown||l(),this.toggle({event:c,delay:!0}),c.preventDefault())})}}const{show:r}=this.options;r&&this.show({delay:typeof r=="number"?r:!1})}getTriggerElement(){if(!this._triggerElement){let{element:e=this.element}=this.options;e===document.body&&(e={getBoundingClientRect:this._getClickBounding}),this._triggerElement=e,this._virtual=!(e instanceof HTMLElement)}return this._triggerElement}initTarget(){let e=this.options.target;return this._dynamic=!e,e?(typeof e=="function"&&(e=e()),typeof e=="string"&&(e==="$next"?e=y(this._triggerElement).next():e.startsWith("$target:")&&(e=y(this._triggerElement).closest(e.slice(8)))),y(e)[0]):this._createTarget()}show(e){const{delay:t,event:n,hideOthers:i=this.options.hideOthers}=e||{};if(n&&(this._triggerEvent=n),t)return this._resetTimer(()=>{this.show()},t===!0?this.options.delay:t);if(!this.inited){this.setOptions({show:!0});return}if(this._shown)return;const r=this.initTarget();if(!r)return;this._targetElement=r;const o=y(r),{animation:a,onShow:l,onShown:c,trigger:d,elementShowClass:u}=this.options,{SHOWN_POPOVERS:p}=this.constructor;o.addClass(Pf),a&&o.addClass(a===!0?"fade":a),this._zIndex=cg.Z_INDEX++,this._shown=!0,this.render(),p.set(this.gid,this),l==null||l.call(this),this.emit("show"),i&&p.forEach(v=>{v!==this&&v.hide()});const{namespace:g}=this;d==="hover"&&(this._clearDelayHide(),o.off(g).on(`pointerenter${g}`,()=>{this._clearDelayHide()}).on(`pointerleave${g}`,()=>{this.delayHide()})),this._virtual||(o.attr("zui-commands-proxy","").data("zui.commandProxy",this._triggerElement),u&&y(this._triggerElement).addClass(u)),this._resetTimer(()=>{o.addClass(Ef),this._resetTimer(()=>{c==null||c.call(this),this.emit("shown")},200)},50)}hide(e){(!this._shown||!this._targetElement)&&this._resetTimer();const{destroyOnHide:t,animation:n,onHide:i,onHidden:r,trigger:o,hideNewOnHide:a,elementShowClass:l}=this.options,c=y(this._targetElement),{SHOWN_POPOVERS:d}=this.constructor;if(this._shown=!1,d.delete(this.gid),i==null||i.call(this),this.emit("hide"),c.removeClass(Ef),o==="hover"&&(this._clearDelayHide(),c.off(this.namespace)),!this._virtual){const u=y(this._triggerElement);u.removeAttr("zui-commands-proxy").removeData("zui.commandProxy"),l&&u.removeClass(l).removeAttr("data-pop-placement")}a&&d.forEach(u=>{u!==this&&u.zIndex>this.zIndex&&u.hide()}),this._resetTimer(()=>{r==null||r.call(this),this.emit("hidden"),c.removeClass(Pf),(t||e)&&this._resetTimer(()=>{this.destroy()},!e&&typeof t=="number"?t:0),this._destoryTarget()},n&&!e?200:0)}toggle(e){this._shown?this.hide():this.show(e)}destroy(){if(super.destroy(),!this._virtual){const{namespace:e}=this;y(this._triggerElement).off(e)}this._resetTimer(),this._destoryTarget(),this._clearDelayHide()}layout(){const e=this._triggerElement,t=this._targetElement,n=this._layoutWatcher;if(!t||!e||!this._shown){n&&(n(),this._layoutWatcher=void 0);return}n||(this._layoutWatcher=_f(e,t,()=>{if(this.destroyed||!this._shown)return;const{animation:i,name:r="popover",minWidth:o,minHeight:a,maxWidth:l,maxHeight:c,limitInScreen:d,onLayout:u}=this.options;if(!this._virtual){const p={minWidth:We(o),minHeight:We(a),maxWidth:We(l),maxHeight:We(c)},{width:g,height:v}=this.options;g&&(p.width=typeof g=="function"?g():g==="100%"?y(e).outerWidth():g),v&&(p.height=typeof v=="function"?v():v),Object.keys(p).length&&y(t).css(p)}mc(...this._getLayoutOptions()).then(({x:p,y:g,middlewareData:v,placement:C,strategy:S})=>{if(e instanceof HTMLElement&&Mn(e)){this.hide(!0);return}const k={position:S,left:p,top:g},D=y(t).css(k);d&&D.css({top:Math.max(0,Math.min(window.innerHeight-D.outerHeight(),g)),left:Math.max(0,Math.min(window.innerWidth-D.outerWidth(),p))});const P=C.split("-")[0],F={top:"bottom",right:"left",bottom:"top",left:"right"}[P],H=v.arrow;H&&D.attr("data-pop-placement",P).find(".arrow").css({left:H.x,top:H.y}).attr("class",`arrow ${r}-arrow arrow-${F}`),i===!0&&D.attr("class",`${D.attr("class").split(" ").filter(Y=>Y!=="fade"&&!Y.startsWith("fade-from")).join(" ")} fade-from-${F}`),this._virtual||y(this._triggerElement).attr("data-pop-placement",P),u&&u.call(this,{target:t,trigger:e,popSide:P,arrowSide:F,x:p,y:g,placement:C,strategy:S})})},{ancestorResize:!1}))}render(e){super.render(e);const t=this._targetElement;if(!t)return;const n=this._getRenderOptions(),i=y(t);if(i.z("popover",this.gid).toggleClass("popup",n.popup).css(n.style),n.className&&i.setClass(n.className),this._dynamic){let r=this._panel;r&&r.element!==t&&(r.destroy(),r=void 0),r?r.render(n):(r=new Oo(t,n),r.on("inited",()=>this.layout())),this._panel=r}else n.arrow&&(i.find(".arrow").length||i.append(y('
').css(n.arrowStyle))),this.layout()}handleClickOutside(e){if(this.options.mask){const t=this._triggerElement;t instanceof HTMLElement&&y(e.target).closest(t).length||this.hide()}}handleClickTarget(e){}delayHide(e=100){this._resetTimer(),this._clearDelayHide(),this._hideTimer=window.setTimeout(()=>{this._hideTimer=0,this.hide()},e)}_clearDelayHide(){this._hideTimer&&(clearTimeout(this._hideTimer),this._hideTimer=0)}_getLayoutOptions(){const e=this._triggerElement,t=this._targetElement,{placement:n,flip:i,limitSize:r,shift:o,offset:a,arrow:l,strategy:c}=this.options,d=l?t.querySelector(".arrow"):null,u=d?typeof l=="number"?l:5:0,p=()=>typeof a=="function"?a:typeof a=="object"?{mainAxis:(a.mainAxis||0)+u,...a}:(a||0)+u;return[e,t,{placement:n,strategy:c,middleware:[i?pc():null,o?fc(typeof o=="object"?o:void 0):null,a||u?dc(p()):null,l?nv({element:d}):null,r?vf({apply({availableWidth:g,availableHeight:v,placement:C}){y(t).css({maxHeight:v-(["top","bottom"].includes(C.split("-")[0])?u:0)-2,maxWidth:g-2})}}):null].filter(Boolean)}]}_getRenderOptions(){const{name:e="popover"}=this.options,{popup:t,title:n,content:i,headingClass:r=`${e}-heading`,titleClass:o=`${e}-title`,contentClass:a=`${e}-content`,style:l,className:c=e,closeBtn:d,arrow:u,footer:p,footerClass:g=`${e}-footer`}=this.options;return{popup:t,title:n,titleClass:o,headingClass:r,contentClass:a,content:i,style:{zIndex:this._zIndex,...l},className:c,closeBtn:d,arrow:u?`arrow ${e}-arrow`:!1,arrowStyle:{"--arrow-size":`${typeof u=="number"?u:5}px`},onlyInner:!0,footer:p,footerClass:g}}_destoryTarget(){var e,t,n;(e=this._layoutWatcher)==null||e.call(this),this._layoutWatcher=void 0,this._dynamic&&((t=this._panel)==null||t.destroy(),(n=this._targetElement)==null||n.remove(),this._panel=void 0,this._targetElement=void 0)}_resetTimer(e,t=0){this._timer&&clearTimeout(this._timer),e&&(this._timer=window.setTimeout(()=>{this._timer=0,e()},t))}_createTarget(){const{container:e="body"}=this.options,t=y(e);let n=t.find(`#${this._id}`);return n.length||(n=y("
").attr({id:this._id,class:"popover"}).appendTo(t)),n[0]}static show(e){const{element:t,event:n,...i}=e,r=t||(n==null?void 0:n.currentTarget);return this.ensure(r instanceof HTMLElement?r:document.body,{element:r,show:!0,destroyOnHide:!0,triggerEvent:n,...i})}};Zs.NAME="Popover",Zs.Z_INDEX=1700,Zs.MULTI_INSTANCE=!0,Zs.DEFAULT={placement:"top",strategy:"absolute",flip:!0,arrow:!0,offset:1,trigger:"click",mask:!0,delay:0,animation:!0,closeBtn:!0,popup:!0,elementShowClass:"with-popover-show",hideNewOnHide:!0},Zs.SHOWN_POPOVERS=new Map;let Et=Zs;Et.toggle={trigger:["click","hover"],convertHref:{selector:"target"},check(s,e){const t=y(s);return t.data(this.KEY)?!1:e==="hover"?(t.dataset("trigger")||this.DEFAULT.trigger)==="hover":!0},getOptions(s,e,t){return{triggerEvent:t,...e}},onToggle(s,e,t){s.toggle({event:t})}},Et.register(),y(()=>{y(document).on(`click.${Et.NAMESPACE}`,s=>{const{SHOWN_POPOVERS:e}=Et;if(!e.size)return;const t=y(s.target),n=t.closest("[z-popover]"),i=n.length?n.z("popover"):0,r=i?e.get(i):null;if(r){const a=r.options.name??r.constructor.ZUI;if(t.closest(`[data-dismiss="popover"],[data-dismiss="${a}"]`).length){r.hide();return}if(r.handleClickTarget(s))return}const o=[...e.values()].sort((a,l)=>l.zIndex-a.zIndex);for(const a of o)if(a!==r&&a.handleClickOutside(s))return})}),Object.assign(window,{Popover:Et});const yC="";class rn extends Et{handleClickTarget(e){const t=y(e.target),{notHideOnClick:n}=this.options;return(!n||!t.closest(n).length)&&this.hide(),!0}_getMenuOptions(){const{items:e,placement:t,menu:n,tree:i,onClickItem:r,relativeTarget:o=this._triggerElement}=this.options;return{items:e,placement:t,tree:i,onClickItem:r,nestedToggle:".item",accordion:!0,relativeTarget:{target:o,event:this.options.triggerEvent,dropdown:this},dropdown:this,popup:!0,...n}}_getRenderOptions(){const e=super._getRenderOptions();return this._dynamic?{...e,contentClass:"",popup:!1,content:b(zo,this._getMenuOptions())}:e}}rn.NAME="Dropdown",rn.DEFAULT={...Et.DEFAULT,name:"dropdown",placement:"bottom-start",arrow:!1,closeBtn:!1,animation:"fade",limitSize:!0,notHideOnClick:".not-hide-menu,.form-control,input,label,.nested-toggle-icon"},rn.toggle={...Et.toggle,getOptions(s,e,t){return e=Et.toggle.getOptions.call(this,s,e,t),!e.target&&!e.items&&!e.menu&&(e.target=y(s).next(".dropdown-menu")),e}},rn.register();class ei extends xe{constructor(){super(...arguments),this._ref=fe()}get triggerElement(){return this._ref.current}_updateData(){const{dropdown:e,menu:t,items:n,onClickItem:i,relativeTarget:r=this.triggerElement}=this.props,o=rn.get(this.triggerElement),a={items:n,onClickItem:i,menu:t,relativeTarget:r,...y(this.triggerElement).dataset(),...e};o?o.setOptions(a):new rn(this.triggerElement,a)}componentDidMount(){this._updateData()}componentDidUpdate(){this._updateData()}componentWillUnmount(){var e;(e=rn.get(this.triggerElement))==null||e.destroy()}_getProps(e){const{trigger:t,placement:n}=e;return{...super._getProps(e),"data-toggle":"dropdown","data-trigger":t,"data-placement":n,ref:this._ref}}}ei.defaultProps={caret:!0},Object.assign(Wt.ItemComponents,{dropdown:ei}),Object.assign(ze.ItemComponents,{dropdown:ei});class zo extends rt{constructor(){super(...arguments),this._handleSearchFocus=()=>{this._searchFocused=!0},this._handleSearchBlur=()=>{this._searchFocused=!1}}get isHoverTrigger(){const{nestedTrigger:e,tree:t}=this.props;return e?e==="hover":!t}get dropdown(){return this.props.dropdown}layout(){var d;if(this.props.tree||this.isRoot)return;const e=(d=this.element)==null?void 0:d.parentElement,t=y(e);e&&this._searchFocused&&this._position&&t.css(this._position);const r=t.parent().children(".dropdown-menu").children(`[z-key-path="${this.props.parentKey}"]`)[0];if(!e||!r)return;let{maxHeight:o}=this.props;const{flip:a,shift:l,offset:c}=this.props;mc(r,e,{placement:this.props.placement,middleware:[a?pc():null,l?fc(typeof l=="object"?l:void 0):null,dc(c),vf({apply({availableWidth:u,availableHeight:p}){if(o){const[g,v]=ls(o);o=Math.min(v==="%"?g*window.innerHeight:g,p-2)}else o=p;t.css({maxHeight:o,maxWidth:u-2})}})]}).then(({x:u,y:p})=>{t.css({left:u,top:p}),this._position={left:u,top:p,width:e.offsetWidth,height:e.offsetHeight}})}_getClassName(e){return["dropdown-menu scrollbar-hover scrollbar-thin",super._getClassName(e)]}_afterRender(e){super._afterRender(e),this.layout()}_getNestedProps(e,t,n,i){return ke(this.isHoverTrigger?{"z-key":n.key,"z-hover":this.props.parentKey??"root",onMouseEnter:this._handleHover,onMouseLeave:this._handleHover}:{},super._getNestedProps(e,t,n,i))}_getItemFromEvent(e){const t=super._getItemFromEvent(e);if(t)return t;const n=y(e.target).closest(".dropdown-menu[z-key]");if(n.length){const i=n.attr("z-key"),r=n.parent().parent().children(".dropdown-menu").children(`[z-key="${i}"]`);if(r.length)return super._getItemFromEvent(e,r[0])}}_renderNestedList(e,t,n,i){const r=super._renderNestedList(e,t,n,i);if(this.props.tree)return r;this._nestedContextMenu.push(r)}_getWrapClass(e){return[super._getWrapClass(e),e.tree?"is-tree":this.isRoot?"is-contextmenu":"is-contextmenu popup"]}_renderWrapperFooter(e){const t=super._renderWrapperFooter(e),n=this._nestedContextMenu;return this.props.tree||!n.length?t:[t,...n]}_renderNestedToggle(e,t){if(this.props.tree)return super._renderNestedToggle(e,t);if(typeof t=="boolean")return x("span",{className:`${this.name}-toggle nested-toggle-icon`,children:x("span",{className:"caret-right"})})}_getSearchBoxProps(e){return{...super._getSearchBoxProps(e),onFocus:this._handleSearchFocus,onBlur:this._handleSearchBlur}}_beforeRender(e){return this._nestedContextMenu=[],super._beforeRender(e)}}zo.defaultProps={...rt.defaultProps,searchBox:!1,placement:"right-start",defaultNestedShow:!1,expandOnSearch:!1,nestedSearch:!1,flip:!0,shift:!0,offset:1},zo.inheritNestedProps=[...rt.inheritNestedProps,"container","tree"];const yv=Object.freeze(Object.defineProperty({__proto__:null,DropdownButton:ei,DropdownMenu:zo},Symbol.toStringTag,{value:"Module"}));function _v({type:s,pagerInfo:e,linkCreator:t,items:n=[5,10,15,20,25,30,35,40,45,50,100,200,500,1e3,2e3],dropdown:i={},menu:r,itemProps:o,...a}){var c;i.items=n.map(d=>{const u={...e,recPerPage:d};return{...o,key:d,text:`${d}`,active:d===e.recPerPage,url:t?typeof t=="function"?t(u):we(t,u):void 0,"z-change-page-size":d}});const{text:l=""}=a;return a.text=typeof l=="function"?l(e):we(l,e),i.menu={...r,...i.menu,className:V((c=i.menu)==null?void 0:c.className,"pager-size-menu")},x(ei,{dropdown:i,...a})}function Af({key:s,page:e,type:t,btnType:n,pagerInfo:i,size:r,onClick:o,onChange:a,linkCreator:l,...c}){const d={...c};let u;const p=C=>{var S;u=Number((S=C.target)==null?void 0:S.value)||1,u=u>i.pageTotal?i.pageTotal:u},g=C=>{if(!(C!=null&&C.target))return;u=u<=i.pageTotal?u:i.pageTotal;const S=Ui(i,u);a&&!a({info:S,event:C})||(C.target.href=d.url=typeof l=="function"?l(S):we(l,S))},v=Ui(i,e||0);return d.url=typeof l=="function"?l(v):we(l,v),x("div",{className:V("input-group","pager-goto-group",r?`size-${r}`:""),children:[x("input",{type:"number",class:"form-control",max:i.pageTotal,min:"1",onInput:p}),x(xe,{type:n,...d,onClick:g})]})}const Fo=class gu extends ze{constructor(){super(...arguments),this._pagerChanges=nt({}),this._changedPager=je(()=>gu.format({...this.props,...this._pagerChanges.value})),this._changeEffect=Zt(()=>{const{onChangePageInfo:e}=this.props,t=this._changedPager.value;e&&this._changeEvent&&(e(t,this._changeEvent),this._changeEvent=void 0)}),this._handleClickLink=e=>{const t=y(e.currentTarget);if(t.is(".disabled"))return;const n=t.z("goToPage");typeof n=="number"&&(this._changeEvent=e,this._pagerChanges.value={...this._pagerChanges.value,page:n})},this._handleClickSizeMenu=e=>{const{item:t}=e,n=t["z-change-page-size"];typeof n=="number"&&!t.disabled&&(this._changeEvent=e.event,this._pagerChanges.value={...this._pagerChanges.value,recPerPage:n})}}_isBtnType(e){const{type:t}=e;return super._isBtnType(e)||["link","nav","size-menu","goto"].includes(t)}componentDidUpdate(e){if(this.props.useState)this.props.recTotal!==e.recTotal&&(this._pagerChanges.value={...this._pagerChanges.value,recTotal:this.props.recTotal});else{const{page:t,recTotal:n,recPerPage:i}=this.props;(t!==e.page||n!==e.recTotal||i!==e.recPerPage)&&(this._pagerChanges.value={})}}componentWillUnmount(){this._changeEffect()}_beforeRender(e){return this._pagerInfo=e.useState?this._changedPager.value:gu.format(e),super._beforeRender(e)}_getItem(e,t,n){const i=super._getItem(e,t,n);if(!i)return!1;const{type:r="item"}=t,o=this._pagerInfo;return r==="info"?y.extend(i,{pagerInfo:o}):(r==="link"||r==="size-menu"||r==="nav"||r==="goto")&&y.extend(i,{pagerInfo:o,linkCreator:e.linkCreator}),r==="size-menu"&&(i.menu={onClickItem:this._handleClickSizeMenu,...i.menu}),r==="link"&&(i.onClick=this._handleClickLink),i}static format(e){const{page:t=1,recTotal:n=0,recPerPage:i=10}=e,r=Math.max(0,+n),o=Math.max(1,+i),a=o?Math.ceil(r/o):0;return{page:Math.min(Math.max(1,+t),a),recTotal:r,recPerPage:o,pageTotal:a}}};Fo.NAME="pager",Fo.ItemComponents={...ze.ItemComponents,info:Mf,link:Nf,nav:mv,"size-menu":_v,goto:Af},Fo.defaultItemProps={btnType:"ghost",size:"sm"};let Vi=Fo;class Tc extends ye{}Tc.NAME="Pager",Tc.Component=Vi,Xe(Object.freeze(Object.defineProperty({__proto__:null,Pager:Vi,PagerGoto:Af,PagerInfoItem:Mf,PagerLink:Nf},Symbol.toStringTag,{value:"Module"})));const vC="",bC="";class jo extends ye{}jo.NAME="Pick",jo.Component=ot,jo.replace=!0;const wC="",CC="",kC="",xC="";class $c extends pe{constructor(e){super(e),this._searchInput=fe(),this._measure=fe(),this._changeTimer=0,this._handleChange=t=>{if(t.isComposing)return;const n=t.target.value;this.setState({search:n},()=>{const{onSearch:i}=this.props;i&&(this._changeTimer&&clearTimeout(this._changeTimer),this._changeTimer=window.setTimeout(()=>{this._changeTimer=0,i(n)},this.props.debounce||300))}),t.stopPropagation()},this._handleClear=t=>{t.stopPropagation(),this.clear()},this.state={search:e.defaultSearch??""}}get $pop(){return y(`#pick-pop-${this.props.id}`)}focus(){var e;(e=this._searchInput.current)==null||e.focus()}clear(){var e,t;(t=(e=this.props).onClear)==null||t.call(e),this.setState({search:""},()=>this.focus())}componentDidMount(){this.focus();const{hotkeys:e}=this.props;if(e){const t=Sl(e,{clear:{keys:"Escape",handler:()=>{this.state.search.trim().length?this.clear():this.$pop.trigger("hidePop")}},enter:{keys:"Enter",handler:n=>{n.preventDefault(),this.$pop.trigger("selectActive"),this.clear()}},activeNext:{keys:"ArrowDown",handler:()=>{this.$pop.trigger("activeNext")}},activePrev:{keys:"ArrowUp",handler:()=>{this.$pop.trigger("activePrev")}},deselectLast:{keys:"Backspace",handler:()=>{this.state.search.trim().length||this.$pop.trigger("deselectLast")}}});t&&(this._hotkeysScope=`PickerSearch_${mt()}`,y(this._searchInput.current).hotkeys(t,{scope:this._hotkeysScope,event:"keydown"}))}y(this._searchInput.current).on("compositionend",this._handleChange)}componentDidUpdate(){const{inline:e}=this.props;if(e){const{current:t}=this._measure,{current:n}=this._searchInput;if(t&&n){const i=y(n).parent();i.width(Math.ceil(Math.min(t.clientWidth,i.closest(".picker").outerWidth()-32)))}}}componentWillUnmount(){clearTimeout(this._changeTimer),this._hotkeysScope&&y(this._searchInput.current).unbindHotkeys(this._hotkeysScope),y(this._searchInput.current).off("compositionend",this._handleChange)}render(e,t){const{placeholder:n,inline:i}=e,{search:r}=t,o=r.trim().length>0;let a;return i?a=x("div",{className:"picker-search-measure",ref:this._measure,children:r}):o?a=x("button",{type:"button",className:"btn picker-search-clear square size-sm ghost",onClick:this._handleClear,children:x("span",{className:"close"})}):a=x("span",{className:"magnifier"}),x("div",{className:`picker-search${i?" is-inline":""}`,children:[x("input",{className:"form-control picker-search-input",type:"text",placeholder:n,value:r,autoComplete:"off",onChange:this._handleChange,onInput:this._handleChange,ref:this._searchInput}),a]})}}class Lf extends _o{constructor(){super(...arguments),this._search=fe(),this._handleDeselectClick=e=>{const{onDeselect:t,state:{selections:n}}=this.props,i=y(e.target).closest(".picker-deselect-btn").attr("data-value");t&&n.length&&typeof i=="string"&&t(i),e.stopPropagation()},this._handleSearch=e=>{this.props.changeState({search:e})},this._handleSearchClear=()=>{this.props.togglePop(!0,{search:""})},this._renderSelection=e=>{const{text:t}=e;return x("div",{className:"picker-multi-selection",title:typeof t=="string"?t:void 0,children:[x("span",{className:"text",children:x(me,{content:t})}),this.props.disabled||this.props.readonly?null:x("div",{className:"picker-deselect-btn btn size-xs ghost",onClick:this._handleDeselectClick,"data-value":e.value,children:x("span",{className:"close"})})]},e.value)}}_handleClick(e){var t;super._handleClick(e),(t=this._search.current)==null||t.focus()}_getClass(e){return V(super._getClass(e),e.search?"":"picker-no-search","picker-select picker-select-multi form-control")}_renderSearch(e){const{state:{search:t},searchHint:n,hotkeys:i}=e;return x($c,{inline:!0,id:e.id,ref:this._search,defaultSearch:t,onSearch:this._handleSearch,onClear:this._handleSearchClear,placeholder:n,hotkeys:i})}_renderTrigger(e){const{state:{selections:t=[],open:n,value:i},search:r,placeholder:o,display:a,valueList:l,children:c,caretClass:d}=this.props,u=n&&r;let p;const g=!u&&!t.length;return a&&(!g||o===void 0)?(typeof a=="function"?p=a.call(this,l,t):typeof a=="string"&&(p=we(a,{value:i,values:l,count:l.length})),p=x("div",{className:"picker-multi-selections",children:p},"selections")):g?p=x("span",{className:"picker-select-placeholder",children:o},"selections"):p=x("div",{className:"picker-multi-selections",children:[t.map(this._renderSelection),u?this._renderSearch(e):null]},"selections"),[p,c,x("span",{class:V("caret",d)},"caret")]}_renderValue(e){const{name:t,state:{value:n=""},disabled:i,readonly:r,id:o,valueList:a,emptyValue:l}=e;if(t)if(this.hasInput)y(`#${o}`).val(n);else{const c=a.length?a:[l];return x("select",{id:o,multiple:!0,className:"pick-value",name:t.endsWith("[]")?t:`${t}[]`,disabled:i,readonly:r,style:{display:"none"},children:c.map(d=>x("option",{value:d,children:d},d))})}return null}componentDidMount(){super.componentDidMount();const{id:e,valueList:t,emptyValue:n}=this.props;y(`#${e}`).val(t.length?t:[n])}componentDidUpdate(e){const{id:t,state:n,name:i,valueList:r,emptyValue:o}=this.props;if(i&&e.state.value!==n.value){const a=y(`#${t}`).val(r.length?r:[o]);this._skipTriggerChange!==n.value&&a.trigger("change",sf),this._skipTriggerChange=!1}}}class Rf extends _o{constructor(){super(...arguments),this._search=fe(),this._handleDeselectClick=e=>{this.props.disabled||(this.props.onClear(),e.stopPropagation())},this._handleSearch=e=>{this.props.changeState({search:e})},this._handleSearchClear=()=>{this.props.togglePop(!0,{search:""})}}_getSearchPlaceholder(){const{searchHint:e,state:{value:t,selections:n}}=this.props;let i=e;if(i===void 0){const r=n.find(o=>o.value===t);r&&typeof r.text=="string"&&(i=r.text)}return i}_handleClick(e){var t;super._handleClick(e),(t=this._search.current)==null||t.focus()}_getClass(e){return V(super._getClass(e),e.search?"":"picker-no-search","picker-select picker-select-single form-control")}_renderSearch(e){const{state:{search:t},hotkeys:n}=e;return x($c,{ref:this._search,id:e.id,defaultSearch:t,onSearch:this._handleSearch,onClear:this._handleSearchClear,placeholder:this._getSearchPlaceholder(),hotkeys:n})}_renderTrigger(e){const{children:t,state:{selections:n=[],value:i,open:r},placeholder:o,search:a,disabled:l,readonly:c,clearable:d,display:u,caretClass:p}=e,[g]=n,v=r&&a;let C;if(v)C=this._renderSearch(e);else if(g||o===void 0&&u){const{text:D}=g||{text:"",value:""};typeof u=="function"?C=u.call(this,i,n):typeof u=="string"?C=we(u,g):C=x(me,{content:D}),C=x("span",{className:"picker-single-selection",title:typeof D=="string"?D:void 0,children:C},"main")}else C=x("span",{className:"picker-select-placeholder",children:o},"main");const S=d&&!v?x("button",{type:"button",className:"btn picker-deselect-btn size-xs square ghost",disabled:l,readonly:c,onClick:this._handleDeselectClick,children:x("span",{className:"close"})},"deselect"):null,k=v?null:x("span",{className:V("caret flex-none",p)},"caret");return[C,t,S,k]}}function Of(s,e){return s.reduce((t,n)=>(Array.isArray(n.items)&&Of(n.items,t),typeof n.value=="string"&&t.set(n.value,n),t),e||new Map)}class zf extends gc{constructor(){super(...arguments),this._menu=fe(),this._disabledSet=new Set,this._getItem=(e,t)=>{var c;if(e.parentKey!==void 0)return e;const n=new Set(this.props.valueList);let i=e.items,r=!1,o=!1;Array.isArray(i)&&(r=!0,i=i.reduce((d,u,p)=>{const g=this._getItem(u,p);return g&&(g.selected?o=!0:r=!1,d.push(g)),d},[]));const a=r||n.has(e.value);e={selected:a,hint:typeof e.text=="string"?e.text:void 0,...e,checked:this._hasCheckbox||typeof e.checked=="boolean"?r?!0:o?"indeterminate":a:void 0,className:V(e.className,{hover:e.value!==void 0&&e.value===this.props.state.hoverItem}),items:i},a&&!e.disabled&&this._firstSelected===void 0&&(this._firstSelected=e.key),e.content&&e.text&&delete e.text;const l=((c=this._getItemCallback)==null?void 0:c.call(this,e,t))??e;return l&&(l.disabled&&this._disabledSet.add(l.value),l)},this._beforeRenderItem=(e,t)=>{var n;return(n=this._renderItemCallback)==null?void 0:n.call(this,e,t)},this._handleItemClick=({item:e,event:t})=>{const n=e.value,i=t.target;if(e.disabled||n===void 0||i.closest(".item-icon,.nested-toggle-icon,.disabled")||Array.isArray(e.items)&&e.items.every(d=>this._disabledSet.has(d.value)))return;const{multiple:r,onToggleValue:o,onSelect:a,togglePop:l,onDeselect:c}=this.props;if(r)if(e.items){const u=[...Of(e.items).values()].filter(p=>!p.items&&!this._disabledSet.has(p.value)).map(p=>p.value);y(i).closest(".item").children(".item-inner.selected").length?c(u):a(u)}else o(n);else a(n),l(!1,{search:""})}}get menu(){return this._menu.current}get picker(){return this.props.picker}componentDidMount(){var e,t;super.componentDidMount(),this._firstSelected===void 0?(e=this.menu)==null||e.activeNext():(t=this.menu)==null||t.toggleActive(this._firstSelected,!0),y(this.element).on("activeNext.zui.Picker",()=>{var n;(n=this.menu)==null||n.activeNext()}).on("activePrev.zui.Picker",()=>{var n;(n=this.menu)==null||n.activePrev()}).on("selectActive.zui.Picker",()=>{const n=this.menu;if(!n)return;const i=n.getActiveKey();if(i!==void 0){const r=n.getRenderedItem(i);r&&y(this.element).find(`.item[z-key-path="${r._keyPath}"]`).trigger("click")}}).on("hidePop.zui.Picker",()=>{this.props.togglePop(!1)}).on("deselectLast.zui.Picker",()=>{if(this.props.multiple){const{valueList:n}=this.props,i=n[n.length-1];i&&this.props.onDeselect(i)}}),setTimeout(()=>{var n;y((n=this.menu)==null?void 0:n.element).find(".menu-item>.active").scrollIntoView({container:".menu"})},100)}componentWillUnmount(){super.componentWillUnmount(),y(this.element).off(".zui.Picker")}_getClass(e){return V(super._getClass(e),"picker-menu")}_getMenuProps(e){const{menu:t,tree:n,state:i,checkbox:r,header:o,footer:a,noMatchHint:l,maxItemsCount:c,exceedLimitHint:d}=e,{items:u,search:p}=i;return ke({ref:this._menu,className:"picker-menu-list",underlineKeys:!0,limit:c,items:u,defaultNestedShow:!0,activeOnHover:!0,search:p,exceedLimitHint:d,onClickItem:this._handleItemClick,nestedToggle:".nested-toggle-icon,.item-icon",checkbox:r,searchProps:["keys","text","title","subtitle","value"],header:o,footer:a,noMatchHint:l,relativeTarget:this},t,n)}_renderPop(e){const{tree:t}=e;this._firstSelected=void 0,this._disabledSet.clear();const n=this._getMenuProps(e);return this._hasCheckbox=!!n.checkbox,this._getItemCallback=n.getItem,this._renderItemCallback=n.beforeRenderItem,n.getItem=this._getItem,n.beforeRenderItem=this._beforeRenderItem,t?x(us,{...n}):x(rt,{...n})}}function ps(s,e){return s.reduce((t,n)=>(Array.isArray(n.items)&&ps(n.items,t),t.set(n.value===void 0?"":String(n.value),n),t),e||new Map)}let qt=class extends ot{constructor(e){super(e),this._updateTimer=0,this.toggleValue=(t,n)=>{if(!this.props.multiple)return n||t!==this.value?this.setValue(t):this.setValue();const{valueList:i}=this,r=i.indexOf(t);if(n!==r>=0)return r>-1?i.splice(r,1):i.push(t),this.setValue(i)},this.deselect=(t=[])=>{const{valueList:n}=this,i=new Set(this.formatValueList(t)),r=n.filter(o=>!i.has(o));this.setValue(r)},this.clear=()=>{this.setValue()},this.select=t=>{const n=this.formatValueList(t),i=this.props.multiple?[...this.valueList,...n]:n[0];return this.setValue(i)},this.isSelected=t=>this.valueList.includes(t),this.setValue=this.setValue.bind(this),this.isEmptyValue=this.isEmptyValue.bind(this)}get valueList(){return this.formatValueList(this.state.value)}get firstEmptyValue(){return this._emptyValueSet.values().next().value}getDefaultState(e){const{items:t,valueSplitter:n=",",emptyValue:i=""}=e||this.props,r={...super.getDefaultState(e),loading:!1,search:"",items:t,selections:[]};if(this._emptyValueSet=new Set(typeof i=="string"?i.split(n):[]),Array.isArray(t)&&t.length){const{limitValueInList:o,required:a,multiple:l}=this.props;if(t.forEach(c=>{typeof c.value=="number"&&(c.value=String(c.value))}),o){const c=ps(t);r.value=this.formatValueList(r.value,n).filter(d=>c.has(d)).join(n),a&&!l&&!this.formatValueList(r.value,n).length&&(r.value=t[0].value??"")}}return r}isEmptyValue(e){return this._emptyValueSet.has(e)}deselectAll(){this.setValue([])}selectAll(){const{items:e}=this.state;if(!Array.isArray(e))return;const n=[...ps(e).values()].reduce((i,r)=>(r.disabled||i.push(r.value),i),[]);return this.select(n)}isSelectedAll(){const{items:e}=this.state;if(!Array.isArray(e))return!1;const t=ps(e),n=new Set(this.valueList);return[...t.values()].every(i=>i.disabled||n.has(i.value))}async load(){let e=this._abort;e&&e.abort(),e=new AbortController,this._abort=e;const{items:t=[],searchDelay:n}=this.props,{search:i=""}=this.state;let r=[];if(Array.isArray(t))r=t;else{if(await Ps(n||500),this._abort!==e)return r;let o=t;if(typeof o=="string"&&(o={url:o}),typeof o=="object"&&o.url&&(o={...o,url:we(o.url,{search:encodeURIComponent(i)})}),r=await pt(o,[this,i],{signal:e.signal}),this._abort!==e)return r}return this._abort=void 0,r}changeState(e,t){return super.changeState(n=>{const i=typeof e=="function"?e(n):e;if(i.value!==void 0&&i.value!==n.value||i.items&&i.items!==n.items){const r=i.items||n.items,o=new Map;Array.isArray(n.items)&&n.items!==i.items&&ps(n.items,o),ps(r,o),i.selections=this.formatValueList(i.value??n.value).reduce((a,l)=>(this.isEmptyValue(l)||a.push(o.get(l)||{value:l,text:l}),a),[])}return i},t)}async update(e){const{state:t,props:n}=this,i=this._itemsCacheInfo||{},r={};if(this._itemsCacheInfo=i,!t.loading&&(e||i.search!==t.search||n.items!==i.items)){await this.changeState({loading:!0});let a=await this.load();a=a.filter(l=>(l.key=l.key??l.value,typeof l.value=="number"&&(l.value=String(l.value)),!this.isEmptyValue(l.value))),r.loading=!1,r.items=a,i.items=n.items,i.search=t.search}else i.items&&!t.open&&n.cache===!1&&!Array.isArray(n.items)&&(i.items=void 0);(e||i.value!==t.value)&&(i.value=t.value);const o=r.items;n.required&&!n.multiple&&this.isEmptyValue(this.state.value)&&Array.isArray(o)&&o.length&&(r.value=o[0].value),Object.keys(r).length&&await this.changeState(r)}async tryUpdate(){this._updateTimer&&clearTimeout(this._updateTimer),this._updateTimer=window.setTimeout(()=>{this._updateTimer=0,this.update()},50)}componentDidUpdate(e,t){super.componentDidUpdate(e,t),this.tryUpdate()}componentDidMount(){super.componentDidMount(),this.tryUpdate()}componentWillUnmount(){var e;(e=this._abort)==null||e.abort(),this._abort=void 0,this._itemsCacheInfo=void 0,clearTimeout(this._updateTimer),super.componentWillUnmount()}_handleChange(e,t){if(super._handleChange(e,t),e!==t){const{onDeselect:n,onSelect:i,onClear:r,multiple:o}=this.props,a=this.formatValueList(t),l=this.valueList;if(r&&!l.length&&a.length&&r.call(this),n){const c=a.filter(d=>!l.includes(d));c.length&&n.call(this,o?c:c[0])}if(i){const c=l.filter(d=>!a.includes(d));c.length&&i.call(this,o?c:c[0])}}}_getTriggerProps(e,t){return{...super._getTriggerProps(e,t),multiple:e.multiple,hotkeys:e.hotkeys,placeholder:e.placeholder,search:e.search,display:e.display,searchHint:e.searchHint,caretClass:e.caretClass,clearable:!!this.valueList.length&&!e.required,valueList:this.valueList,emptyValue:this.firstEmptyValue,onDeselect:this.deselect,onSelect:this.select,onClear:this.clear,onToggleValue:this.toggleValue,onSetValue:this.setValue}}_getPopProps(e,t){return{...super._getPopProps(e,t),picker:this,menu:e.menu,tree:e.tree,checkbox:e.checkbox,multiple:e.multiple,search:e.search,maxItemsCount:e.maxItemsCount,footer:this._renderToolbar(),valueList:this.valueList,noMatchHint:t.loading?Ne.getLang("loadingHint"):e.searchEmptyHint??Ne.getLang("searchEmptyHint"),exceedLimitHint:e.exceedLimitHint??Ne.getLang("exceedLimitHint"),onDeselect:this.deselect,onSelect:this.select,onClear:this.clear,onToggleValue:this.toggleValue,onSetValue:this.setValue}}_getTrigger(e){return e.Trigger||(e.multiple?Lf:Rf)}_renderToolbar(){let{toolbar:e}=this.props;return e?(e===!0&&(e=[{key:"selectAll",text:Ne.getLang("selectAll")},{key:"cancelSelect",text:Ne.getLang("cancelSelect")}]),ze.render(e,[],{size:"sm",relativeTarget:this,getItem:t=>(t.onClick||(t.key==="selectAll"?(t.onClick=this.selectAll.bind(this),t.disabled=this.isSelectedAll()):t.key==="cancelSelect"&&(t.onClick=this.deselectAll.bind(this),t.disabled=!this.valueList.length)),t)},this)):null}formatValueList(e,t){let n;return typeof e=="string"&&e.length?n=e.split(t??this.props.valueSplitter??","):Array.isArray(e)?n=e:n=[e],y.unique(n).reduce((i,r)=>(r==null||(r=typeof r!="string"?String(r):r,this.isEmptyValue(r)||i.push(r)),i),[])}formatValue(e){const t=this.formatValueList(e);return t.length?t.join(this.props.valueSplitter??","):this.firstEmptyValue}setValue(e=[],t){let n=this.formatValueList(e);if(n.length){const{items:r,limitValueInList:o}=this.props;if(o){const a=ps(Array.isArray(r)?r:this.state.items);n=n.filter(l=>a.has(l))}}const i=this.formatValue(n);return super.setValue(i,t)}};qt.defaultProps={...ot.defaultProps,className:"picker",valueSplitter:",",limitValueInList:!0,search:!0,emptyValue:"",cache:!0,hotkeys:!0},qt.Pop=zf;const vv=Object.freeze(Object.defineProperty({__proto__:null,Picker:qt,PickerMenu:zf,PickerMultiSelect:Lf,PickerSearch:$c,PickerSingleSelect:Rf},Symbol.toStringTag,{value:"Module"}));class Bo extends ye{}Bo.NAME="Picker",Bo.Component=qt,Bo.register(),Ne.addLang({zh_cn:{selectAll:"全选",cancelSelect:"取消选择",searchEmptyHint:"无匹配选项",loadingHint:"正在加载...",exceedLimitHint:"还有 {0} 个选项没有显示,可尝试搜索来查找"},zh_tw:{selectAll:"全選",cancelSelect:"取消選擇",searchEmptyHint:"無匹配選項",loadingHint:"正在載入...",exceedLimitHint:"還有 {0} 個選項沒有顯示,可嘗試搜索來查找"},en:{selectAll:"Select All",cancelSelect:"Cancel Select",searchEmptyHint:"No matching options",loadingHint:"Loading...",exceedLimitHint:"There are {0} items not displayed, try searching to find"}}),Xe(vv);class Ho extends ye{}Ho.NAME="SearchBox",Ho.Component=hs,Ho.register(),Xe(i_);const SC="";function Dc(s,e){const[t,n]=ls(s);return n==="%"?e*t/100:t}const Ff="is-sidebar-resizing",jf="has-sidebar-animation",Ic="is-animating",Wo=".sidebar-gutter";class Uo extends Fe{get side(){return this._side}get width(){return this._width}get $parent(){const{parent:e}=this.options;return e?y(e):this.$element.parent()}afterInit(){const{$element:e}=this,t=e.parent(),n=t[0],i=t.width();this._container=n;const{preserve:r,side:o=e.hasClass("sidebar-right")?"right":"left",animation:a,dragToResize:l,width:c,minWidth:d=0,maxWidth:u=Number.MAX_SAFE_INTEGER,toggleBtn:p,dbclick:g}=this.options;this._storeID=r?`SIDEBAR:${r}:width`:"",this._side=o,this._minWidth=Dc(d,i),this._maxWidth=Dc(u,i),this._defaultWidth=Math.max(this._minWidth,Math.min(this._maxWidth,Dc(c||e.width(),i))),this._width=(r?Ye.get(this._storeID):null)??this._defaultWidth,this.render(),p&&e.on(`click${this.namespace}`,".gutter-toggle",()=>this.toggle()),g&&e.on(`dblclick${this.namespace}`,Wo,()=>{g==="reset"?this.update(this._defaultWidth):this.toggle()}).on("mousedown",Wo,v=>{v.preventDefault()}),l&&(this._moveable=new Ri(e,{selector:Wo,move:!1,onMoveStart:()=>{this._startWidth=this._width,this.$parent.addClass(Ff).removeClass(jf)},onMove:(v,C)=>{const{deltaX:S}=C;Math.abs(S)<10||this.update(this._startWidth+S*(o==="left"?1:-1))},onMoveEnd:()=>{a&&this.$parent.addClass(jf),this.$parent.removeClass(Ff)}})),a&&this.on("transitionend",v=>{v.target===e[0]&&v.propertyName==="width"&&e.removeClass(Ic)})}destroy(){var e;super.destroy(),this._raf&&cancelAnimationFrame(this._raf),(e=this._moveable)==null||e.destroy()}toggle(e){e=e??!!this._width,e&&(this._widthBack=this._width),this.update(e?0:this._widthBack||this._defaultWidth)}update(e,t){if(!t){this._raf&&cancelAnimationFrame(this._raf),this._raf=requestAnimationFrame(()=>{this._raf=0,this.update(e,!0)});return}const{preserve:n,toggleBtn:i,onResize:r,onToggle:o,animation:a}=this.options;if(e=e
').appendTo(n)),o?c.children(".gutter-toggle").length||c.append(``):c.children(".gutter-resize-handler").length||c.append('
'),i.addClass(`has-sidebar-${e}`).css(`--sidebar-${e}-width`,`${t}px`).toggleClass(`is-sidebar-${e}-collapsed`,r),(d=this._moveable)!=null&&d.state&&n.removeClass(Ic)}}Uo.NAME="Sidebar",Uo.DEFAULT={minWidth:40,toggleBtn:!0,animation:!0,dragToResize:!0,dbclick:"reset"};const TC="",$C="",DC="";class Nc extends ye{}Nc.NAME="Toolbar",Nc.Component=ze,Xe(Xy);const IC="";class ti extends Et{_getRenderOptions(){const{type:e,className:t,title:n,content:i}=this.options;let r=n,o=i;return o===void 0&&(o=r,r=void 0),{...super._getRenderOptions(),title:r,content:o,className:V("tooltip",e,t,r?"tooltip-has-title":""),contentClass:r?"tooltip-content":""}}}ti.NAME="Tooltip",ti.DEFAULT={...Et.DEFAULT,trigger:"hover",delay:500,closeBtn:!1,popup:!1,name:"tooltip",animation:"fade",destroyOnHide:5e3,hideOthers:!0,hideNewOnHide:!1},ti.register();const NC="",MC="",PC="";class Vo extends ye{}Vo.NAME="Tree",Vo.Component=Ct,Vo.replace=Ct.TAG;class Mc extends ye{}Mc.NAME="SearchTree",Mc.Component=us,Xe(h_);const EC="",AC="",LC="",RC="";class Ko extends Fe{init(){const{multiple:e,defaultFileList:t,limitSize:n}=this.options;this.fileMap=new Map,this.renameMap=new Map,this.itemMap=new Map,this.dataTransfer=new DataTransfer,this.limitBytes=n?Dn(n):Number.MAX_VALUE,this.currentBytes=0,e||(this.options.limitCount=1),this.$element.addClass("upload"),this.initFileInputCash(),this.initUploadCash(),t&&this.addFileItem(t)}initUploadCash(){const{name:e,uploadText:t,uploadIcon:n,listPosition:i,btnClass:r,tip:o,draggable:a}=this.options;this.$list=y('
    ');const l=y(`${o}`);if(!a){if(this.$label=y(``),n){const p=y(``);this.$label.prepend(p)}const u=i==="bottom"?[this.$label,l,this.$list]:[this.$list,this.$label,l];this.$element.append(this.$input,...u);return}const c=y(`${t}`);if(n){const u=y(``);c.prepend(u)}this.$label=y(``).append(c).append(l),this.bindDragEvent();const d=i==="bottom"?[this.$label,this.$list]:[this.$list,this.$label];this.$element.append(this.$input,...d)}bindDragEvent(){this.$label.on("dragover",e=>{e.preventDefault(),this.$label.hasClass("border-primary")||(this.$label.removeClass("border-gray"),this.$label.addClass("border-primary")),this.$label.hasClass("dragover")||this.$label.addClass("dragover")}).on("dragleave",e=>{e.preventDefault(),this.$label.removeClass("border-primary"),this.$label.addClass("border-gray"),this.$label.removeClass("dragover")}).on("drop",e=>{var n;e.preventDefault(),this.$label.removeClass("border-primary"),this.$label.addClass("border-gray"),this.$label.removeClass("dragover");const t=Array.from(((n=e.dataTransfer)==null?void 0:n.files)??[]);console.log(e.dataTransfer.files),this.addFileItem(t)})}initFileInputCash(){const{name:e,multiple:t,accept:n}=this.options;this.$input=y("").addClass("hidden").prop("type","file").prop("name",e).prop("id",e).prop("multiple",t).on("change",i=>{const r=i.target.files;if(!r)return;const o=[...r];this.addFileItem(o)}),n&&this.$input.prop("accept",n)}addFile(e){const{multiple:t,onSizeChange:n}=this.options;t||(this.renameMap.clear(),this.fileMap.clear(),this.dataTransfer.items.clear(),this.currentBytes=e.size),this.renameMap.set(e.name,e.name),this.fileMap.set(e.name,e),this.dataTransfer.items.add(e),this.$input.prop("files",this.dataTransfer.files),this.currentBytes+=e.size,n==null||n(this.currentBytes)}renameDuplicatedFile(e){if(!this.fileMap.has(e.name))return e;const t=e.name.lastIndexOf(".");if(t===-1)return this.renameDuplicatedFile(new File([e],`${e.name}(1)`));const n=e.name.substring(0,t),i=e.name.substring(t);return this.renameDuplicatedFile(new File([e],`${n}(1)${i}`))}filterFiles(e){const{accept:t}=this.options;if(!t)return e;const n=t.replace(/\s/g,"").split(","),i=[],r=[],o=[];return n.forEach(a=>{a.endsWith("/*")?r.push(a.substring(0,a.length-1)):a.includes("/")?i.push(a):a.startsWith(".")&&o.push(a)}),e.filter(a=>i.includes(a.type)||r.some(l=>a.type.startsWith(l))||o.some(l=>a.name.endsWith(l)))}addFileItem(e){e=this.filterFiles(e);const{multiple:t,limitCount:n,exceededSizeHint:i,onExceededSize:r,exceededCountHint:o,onExceededCount:a,onAdd:l}=this.options;if(t){for(let p of e){if(n&&this.fileMap.size>=n){a==null||a(n),o&&alert(o);return}if(this.currentBytes+p.size>this.limitBytes){r==null||r(this.limitBytes),i&&alert(i);return}p=this.renameDuplicatedFile(p);const g=l==null?void 0:l(p);if(!g)continue;p=g;const v=this.createFileItem(p);this.itemMap.set(p.name,v),this.$list.append(v)}return}if(e.length===0||e[0].size>this.limitBytes)return;let c=this.renameDuplicatedFile(e[0]);const d=l==null?void 0:l(c);if(!d)return;c=d;const u=this.createFileItem(c);this.itemMap.clear(),this.itemMap.set(c.name,u),this.$list.empty().append(u)}deleteFileItem(e){var l,c;const t=this.renameMap.get(e)??e;this.renameMap.delete(e);const n=this.fileMap.get(t);if(!n)return;const{onDelete:i,onSizeChange:r}=this.options,o=this.itemMap.get(n.name);this.itemMap.delete(n.name),o==null||o.addClass("hidden");const a=(l=o==null?void 0:o.find(".file-delete"))==null?void 0:l.data("tooltip");a&&(a.destroy(),(c=a.tooltip)==null||c.remove()),setTimeout(()=>o==null?void 0:o.remove(),3e3),i==null||i(n),this.fileMap.delete(n.name),this.currentBytes-=n.size,r==null||r(this.currentBytes),this.dataTransfer=new DataTransfer,this.fileMap.forEach(d=>this.dataTransfer.items.add(d)),this.$input.prop("files",this.dataTransfer.files)}renameFileItem(e,t){var r,o;const n=this.renameMap.get(e.name);this.renameMap.set(e.name,t),n&&(e=this.fileMap.get(n)??e);const i=this.itemMap.get(e.name);i&&(this.itemMap.set(t,i).delete(e.name),(o=(r=this.options).onRename)==null||o.call(r,t,e.name),this.fileMap.delete(e.name),this.dataTransfer=new DataTransfer,e=new File([e],t),this.fileMap.set(t,e).forEach(a=>this.dataTransfer.items.add(a)),this.$input.prop("files",this.dataTransfer.files))}createFileItem(e){const{showIcon:t}=this.options;return this.addFile(e),y('
  • ').append(t?this.fileIcon():null).append(this.createFileInfo(e)).append(this.createRenameContainer(e))}fileIcon(){const{icon:e}=this.options;return y(``)}fileRenameBtn(){const{useIconBtn:e,renameText:t,renameIcon:n,renameClass:i}=this.options;if(e){const r=y(``).prop("type","button").addClass("file-action file-rename");return new ti(r,{title:t}),r}return y("`).prop("type","button").addClass("file-action file-delete");return r.data("tooltip",new ti(r,{title:t})),r}return y("