@vue-ui-kit/ant 2.4.2 → 2.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/cjs/index.js CHANGED
@@ -1,5 +1,5 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),M=require("ant-design-vue"),Zt=require("@ant-design/icons-vue");function _l(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const Rl=_l(Zt);var Il={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},ke=Il;function Sl(i,e,t){if(i)if(i.forEach)i.forEach(e,t);else for(var r=0,s=i.length;r<s;r++)e.call(t,i[r],r,i)}var ie=Sl,Tl=Object.prototype.toString,Un=Tl,Ol=Un;function kl(i){return function(e){return"[object "+i+"]"===Ol.call(e)}}var Jt=kl,Dl=Jt,Ll=Array.isArray||Dl("Array"),G=Ll;function $l(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var Ee=$l,Ml=Ee;function Al(i,e,t){if(i)for(var r in i)Ml(i,r)&&e.call(t,i[r],r,i)}var Qt=Al,Nl=G,Bl=ie,Hl=Qt;function Fl(i,e,t){return i&&(Nl(i)?Bl:Hl)(i,e,t)}var Z=Fl;function Kl(i){return function(e){return typeof e===i}}var Dt=Kl,Pl=Dt,Yl=Pl("function"),le=Yl,Vl=Z;function Wl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);Vl(r,e>1?function(n){s.push([""+n,r[n]])}:function(){s.push(arguments[e])})}return s}}var wr=Wl,Xl=wr,zl=Xl("keys",1),Ke=zl,Gl=Un,Ul=Qt,ql=ie;function Zi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function hi(i,e){return e?qn(i,e):i}function qn(i,e){if(i)switch(Gl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return Ul(i,function(o,a){t[a]=hi(o,e)}),t}case"[object Date]":case"[object RegExp]":return Zi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return ql(i,function(o){r.push(hi(o,e))}),r}case"[object Set]":{var s=Zi(i);return s.forEach(function(o){s.add(hi(o,e))}),s}case"[object Map]":{var n=Zi(i);return n.forEach(function(o,a){n.set(a,hi(o,e))}),n}}return i}function Zl(i,e){return i&&qn(i,e)}var Er=Zl,Jl=ie,Ql=Ke,jl=G,ec=Er,jr=Object.assign;function es(i,e,t){for(var r=e.length,s,n=1;n<r;n++)s=e[n],Jl(Ql(e[n]),t?function(o){i[o]=ec(s[o],t)}:function(o){i[o]=s[o]});return i}var tc=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=jl(i[1])?[]:{},es(i,e,!0)}else return jr?jr.apply(Object,e):es(i,e)}return i},ue=tc,Zn=ke,ic=ie,rc=Z,sc=le,nc=ue,Se=function(){};function oc(){ic(arguments,function(i){rc(i,function(e,t){Se[t]=sc(e)?function(){var r=e.apply(Se.$context,arguments);return Se.$context=null,r}:e})})}function Jn(i){return nc(Zn,i)}function ac(){return Zn}var Qn="3.9.1";Se.VERSION=Qn;Se.version=Qn;Se.mixin=oc;Se.setup=Jn;Se.setConfig=Jn;Se.getConfig=ac;var lc=Se;function cc(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var Cr=cc,hc=Cr,dc=Ke;function uc(i,e,t){hc(dc(i),function(r){e.call(t,i[r],r,i)})}var jn=uc;function fc(i){return i===null}var Pe=fc,gc=Pe;function vc(i,e){return function(t){return gc(t)?e:t[i]}}var Lt=vc,mc=Z,xc=le,pc=Lt;function yc(i,e,t){var r={};if(i)if(e)xc(e)||(e=pc(e)),mc(i,function(s,n){r[n]=e.call(t,s,n,i)});else return i;return r}var wc=yc;function Ec(i){return i?i.constructor===Object:!1}var $t=Ec;function Cc(i){return i!=="__proto__"&&i!=="constructor"}var eo=Cc,ts=G,is=$t,bc=le,_c=Z,Rc=eo;function to(i,e){return is(i)&&is(e)||ts(i)&&ts(e)?(_c(e,function(t,r){Rc(r)&&(i[r]=bc(e)?t:to(i[r],t))}),i):e}var Ic=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&to(i,r);return i},Sc=Ic,Tc=Z;function Oc(i,e,t){var r=[];if(i&&arguments.length>1){if(i.map)return i.map(e,t);Tc(i,function(){r.push(e.apply(t,arguments))})}return r}var vt=Oc,kc=Ee,Dc=G;function Lc(i,e,t,r,s){return function(n,o,a){if(n&&o){if(i&&n[i])return n[i](o,a);if(e&&Dc(n)){for(var l=0,d=n.length;l<d;l++)if(!!o.call(a,n[l],l,n)===r)return[!0,!1,l,n[l]][t]}else for(var u in n)if(kc(n,u)&&!!o.call(a,n[u],u,n)===r)return[!0,!1,u,n[u]][t]}return s}}var Mi=Lc,$c=Mi,Mc=$c("some",1,0,!0,!1),io=Mc,Ac=Mi,Nc=Ac("every",1,1,!1,!0),ro=Nc,Bc=Ee;function Hc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(Bc(i,t)&&e===i[t])return!0}return!1}var Mt=Hc,rs=G,ss=Mt;function Fc(i,e){var t,r=0;if(rs(i)&&rs(e)){for(t=e.length;r<t;r++)if(!ss(i,e[r]))return!1;return!0}return ss(i,e)}var so=Fc,ns=Z,Kc=Mt,Pc=le,Yc=Lt;function Vc(i,e,t){var r=[];if(e){Pc(e)||(e=Yc(e));var s,n={};ns(i,function(o,a){s=e.call(t,o,a,i),n[s]||(n[s]=1,r.push(o))})}else ns(i,function(o){Kc(r,o)||r.push(o)});return r}var no=Vc,Wc=vt;function Xc(i){return Wc(i,function(e){return e})}var br=Xc,zc=no,Gc=br;function Uc(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(Gc(i[t]));return zc(e)}var qc=Uc,Zc="undefined",Ce=Zc,Jc=Ce,Qc=Dt,jc=Qc(Jc),De=jc,eh=Pe,th=De;function ih(i){return eh(i)||th(i)}var Le=ih,rh=/(.+)?\[(\d+)\]$/,oo=rh;function sh(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var _r=sh,nh=oo,oh=_r,ah=Ee,lh=De,ao=Le;function ch(i,e,t){if(ao(i))return t;var r=dh(i,e);return lh(r)?t:r}function hh(i,e){var t=e?e.match(nh):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function dh(i,e){if(i){var t,r,s,n=0;if(i[e]||ah(i,e))return i[e];if(r=oh(e),s=r.length,s){for(t=i;n<s;n++)if(t=hh(t,r[n]),ao(t))return n===s-1?t:void 0}return t}}var jt=ch,os=ie,uh=br,as=vt,ls=G,fh=le,gh=$t,cs=De,vh=Pe,mh=Le,xh=jt,ph=Lt,yh="asc",wh="desc";function dr(i,e){return cs(i)?1:vh(i)?cs(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function Eh(i,e,t){return function(r,s){var n=r[i],o=s[i];return n===o?t?t(r,s):0:e.order===wh?dr(o,n):dr(n,o)}}function Ch(i,e,t,r){var s=[];return t=ls(t)?t:[t],os(t,function(n,o){if(n){var a=n,l;ls(n)?(a=n[0],l=n[1]):gh(n)&&(a=n.field,l=n.order),s.push({field:a,order:l||yh}),os(e,fh(a)?function(d,u){d[o]=a.call(r,d.data,u,i)}:function(d){d[o]=a?xh(d.data,a):d.data})}}),s}function bh(i,e,t){if(i){if(mh(e))return uh(i).sort(dr);for(var r,s=as(i,function(a){return{data:a}}),n=Ch(i,s,e,t),o=n.length-1;o>=0;)r=Eh(o,n[o],r),o--;return r&&(s=s.sort(r)),as(s,ph("data"))}return[]}var Rr=bh,_h=Rr,Rh=_h,Ih=Rh;function Sh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var lo=Sh,Th=wr,Oh=Th("values",0),At=Oh,kh=lo,Dh=At;function Lh(i){for(var e,t=[],r=Dh(i),s=r.length-1;s>=0;s--)e=s>0?kh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var co=Lh,$h=co;function Mh(i,e){var t=$h(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Ah=Mh;function Nh(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var ho=Nh,Bh=ho,Hh=Bh(parseFloat),mt=Hh,hs=mt;function Fh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?hs(e):0,t=s>=3?hs(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var xt=Fh,Kh=Z;function Ph(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);Kh(i,function(s,n){e.call(t,s,n,i)&&r.push(s)})}return r}var Yh=Ph,Vh=Mi,Wh=Vh("",0,2,!0),Xh=Wh,zh=Mi,Gh=zh("find",1,3,!0),Uh=Gh,qh=G,Zh=At;function Jh(i,e,t){if(i){qh(i)||(i=Zh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Qh=Jh,jh=Ke;function ed(i,e,t){if(i){var r,s,n=0,o=null,a=t,l=arguments.length>2,d=jh(i);if(i.length&&i.reduce)return s=function(){return e.apply(o,arguments)},l?i.reduce(s,a):i.reduce(s);for(l&&(n=1,a=i[d[0]]),r=d.length;n<r;n++)a=e.call(o,a,i[d[n]],n,i);return a}}var td=ed,id=G;function rd(i,e,t,r){if(id(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,n,o=e>>0,a=t>>0,l=i.length,d=arguments.length>3?r>>0:l;if(o<l&&(o=o>=0?o:l+o,o>=0&&(a=a>=0?a:l+a,d=d>=0?d:l+d,a<d)))for(s=0,n=i.slice(a,d);o<l&&!(n.length<=s);o++)i[o]=n[s++];return i}var sd=rd,nd=G;function od(i,e){var t,r=[],s=e>>0||1;if(nd(i))if(s>=0&&i.length>s)for(t=0;t<i.length;)r.push(i.slice(t,t+s)),t+=s;else r=i.length?[i]:i;return r}var ad=od,ld=vt,cd=Lt;function hd(i,e){return ld(i,cd(e))}var uo=hd,dd=le,ds=Le,ud=jt,fd=ie;function gd(i){return function(e,t){if(e&&e.length){var r,s;return fd(e,function(n,o){t&&(n=dd(t)?t(n,o,e):ud(n,t)),!ds(n)&&(ds(r)||i(r,n))&&(s=o,r=n)}),e[s]}return r}}var fo=gd,vd=fo,md=vd(function(i,e){return i<e}),go=md,xd=uo,pd=go;function yd(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=pd(i,function(n){return n?n.length:0}),r=t?t.length:0;e<r;e++)s.push(xd(i,e));return s}var vo=yd,wd=vo;function Ed(){return wd(arguments)}var Cd=Ed,bd=At,_d=Z;function Rd(i,e){var t={};return e=e||[],_d(bd(i),function(r,s){t[r]=e[s]}),t}var Id=Rd,mo=G,Sd=ie;function xo(i,e){var t=[];return Sd(i,function(r){t=t.concat(mo(r)?e?xo(r,e):r:[r])}),t}function Td(i,e){return mo(i)?xo(i,e):[]}var Od=Td,kd=vt,Dd=G;function Ld(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function $d(i,e){for(var t,r=arguments,s=[],n=[],o=2,a=r.length;o<a;o++)s.push(r[o]);if(Dd(e)){for(a=e.length-1,o=0;o<a;o++)n.push(e[o]);e=e[a]}return kd(i,function(l){if(n.length&&(l=Ld(l,n)),t=l[e]||e,t&&t.apply)return t.apply(l,s)})}var Md=$d;function Ad(i,e){return(console[i]||console.log)(e)}var Nd=Ad;function Bd(i,e){try{delete i[e]}catch{i[e]=void 0}}var po=Bd,Hd=G,Fd=Cr,Kd=jn;function Pd(i,e,t){return i&&(Hd(i)?Fd:Kd)(i,e,t)}var yo=Pd,Yd=Dt,Vd=Yd("object"),Ai=Vd,Wd=po,Xd=$t,zd=Ai,Gd=G,Ud=Pe,qd=ue,Zd=Qt;function Jd(i,e,t){if(i){var r,s=arguments.length>1&&(Ud(e)||!zd(e)),n=s?t:e;if(Xd(i))Zd(i,s?function(o,a){i[a]=e}:function(o,a){Wd(i,a)}),n&&qd(i,n);else if(Gd(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;n&&i.push.apply(i,n)}}return i}var wo=Jd,Qd=po,jd=le,eu=G,tu=Z,iu=ie,ru=yo,su=wo,nu=Le;function ou(i){return function(e,t){return t===i}}function au(i,e,t){if(i){if(!nu(e)){var r=[],s=[];return jd(e)||(e=ou(e)),tu(i,function(n,o,a){e.call(t,n,o,a)&&r.push(o)}),eu(i)?ru(r,function(n,o){s.push(i[n]),i.splice(n,1)}):(s={},iu(r,function(n){s[n]=i[n],Qd(i,n)})),s}return su(i)}return i}var Eo=au,lu=ke,us=Nd,cu=Rr,hu=Er,du=Le,ur=Z,uu=Eo,fu=ue;function gu(i,e){ur(i,function(t){t[e]&&!t[e].length&&uu(t,e)})}function vu(i,e){var t=fu({},lu.treeOptions,e),r=t.strict,s=t.key,n=t.parentKey,o=t.children,a=t.mapChildren,l=t.sortKey,d=t.reverse,u=t.data,f=[],g={},m={},x,v,p;return l&&(i=cu(hu(i),l),d&&(i=i.reverse())),ur(i,function(w){x=w[s],m[x]&&us("warn","Duplicate primary key="+x),m[x]=!0}),ur(i,function(w){x=w[s],u?(v={},v[u]=w):v=w,p=w[n],g[x]=g[x]||[],v[s]=x,v[n]=p,x===p&&(p=null,us("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(v),v[o]=g[x],a&&(v[a]=g[x]),(!r||r&&du(p))&&(m[p]||f.push(v))}),r&&gu(i,o),f}var mu=vu,xu=ke,pu=ie,yu=ue;function Co(i,e,t,r){var s=r.key,n=r.parentKey,o=r.children,a=r.data,l=r.updated,d=r.clear;return pu(t,function(u){var f=u[o];a&&(u=u[a]),l!==!1&&(u[n]=e?e[s]:null),i.push(u),f&&f.length&&Co(i,u,f,r),d&&delete u[o]}),i}function wu(i,e){return Co([],null,i,yu({},xu.treeOptions,e))}var Eu=wu;function Cu(i){return function(e,t,r,s){var n=r||{},o=n.children||"children";return i(null,e,t,s,[],[],o,n)}}var Ni=Cu,bu=Ni;function bo(i,e,t,r,s,n,o,a){if(e){var l,d,u,f,g,m;for(d=0,u=e.length;d<u;d++){if(l=e[d],f=s.concat([""+d]),g=n.concat([l]),t.call(r,l,d,e,f,i,g))return{index:d,item:l,path:f,items:e,parent:i,nodes:g};if(o&&l&&(m=bo(l,l[o],t,r,f.concat([o]),g,o),m))return m}}}var _u=bu(bo),Ru=_u,Iu=Ni,Su=Z;function _o(i,e,t,r,s,n,o,a){var l,d;Su(e,function(u,f){l=s.concat([""+f]),d=n.concat([u]),t.call(r,u,f,e,l,i,d),u&&o&&(l.push(o),_o(u,u[o],t,r,l,d,o))})}var Tu=Iu(_o),Ro=Tu,Ou=Ni,ku=vt;function Io(i,e,t,r,s,n,o,a){var l,d,u,f=a.mapChildren||o;return ku(e,function(g,m){return l=s.concat([""+m]),d=n.concat([g]),u=t.call(r,g,m,e,l,i,d),u&&g&&o&&g[o]&&(u[f]=Io(g,g[o],t,r,l,d,o,a)),u})}var Du=Ou(Io),Lu=Du,$u=Ro;function Mu(i,e,t,r){var s=[];return i&&e&&$u(i,function(n,o,a,l,d,u){e.call(r,n,o,a,l,d,u)&&s.push(n)},t),s}var Au=Mu,Nu=Ni,Bu=ie,Hu=ue;function So(i,e,t,r,s,n,o,a,l){var d,u,f,g,m,x=[],v=l.original,p=l.data,w=l.mapChildren||a,E=l.isEvery;return Bu(t,function(C,b){d=n.concat([""+b]),u=o.concat([C]),g=i&&!E||r.call(s,C,b,t,d,e,u),m=a&&C[a],g||m?(v?f=C:(f=Hu({},C),p&&(f[p]=C)),f[w]=So(g,C,C[a],r,s,d,u,a,l),(g||f[w].length)&&x.push(f)):g&&x.push(f)}),x}var Fu=Nu(function(i,e,t,r,s,n,o,a){return So(0,i,e,t,r,s,n,o,a)}),Ku=Fu;function Pu(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;t<r;t++)if(e===i[t])return t}var To=Pu;function Yu(i,e){if(i.lastIndexOf)return i.lastIndexOf(e);for(var t=i.length-1;t>=0;t--)if(e===i[t])return t;return-1}var Oo=Yu,Vu=Dt,Wu=Vu("number"),$e=Wu,Xu=$e;function zu(i){return Xu(i)&&isNaN(i)}var Gu=zu,Uu=Dt,qu=Uu("string"),Ye=qu,Zu=Jt,Ju=Zu("Date"),et=Ju,Qu=parseInt,tt=Qu;function ju(i){return Date.UTC(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}var ef=ju;function tf(i){return i.getTime()}var re=tf,bi=tt,fs=ef,rf=re,sf=Ye,nf=et;function ei(i){return"(\\d{"+i+"})"}function of(i){return i<10?i*100:i<100?i*10:i}function gs(i){return isNaN(i)?i:bi(i)}var bt=ei(2),Rt=ei("1,2"),ko=ei("1,7"),Do=ei("3,4"),Lo=".{1}",Yt=Lo+Rt,$o="(([zZ])|([-+]\\d{2}:?\\d{2}))",vs=[Do,Yt,Yt,Yt,Yt,Yt,Lo+ko,$o],fr=[];for(var Ji=vs.length-1;Ji>=0;Ji--){for(var ms="",dt=0;dt<Ji+1;dt++)ms+=vs[dt];fr.push(new RegExp("^"+ms+"$"))}function af(i){for(var e,t={},r=0,s=fr.length;r<s;r++)if(e=i.match(fr[r]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var xs=[["yyyy",Do],["yy",bt],["MM",bt],["M",Rt],["dd",bt],["d",Rt],["HH",bt],["H",Rt],["mm",bt],["m",Rt],["ss",bt],["s",Rt],["SSS",ei(3)],["S",ko],["Z",$o]],Mo={},Ao=["\\[([^\\]]+)\\]"];for(var dt=0;dt<xs.length;dt++){var Qi=xs[dt];Mo[Qi[0]]=Qi[1]+"?",Ao.push(Qi[0])}var lf=new RegExp(Ao.join("|"),"g"),ps={};function cf(i,e){var t=ps[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(lf,function(u,f){var g=u.charAt(0);return g==="["?f:(r.push(g),Mo[u])});t=ps[e]={_i:r,_r:new RegExp(s)}}var n={},o=i.match(t._r);if(o){for(var a=t._i,l=1,d=o.length;l<d;l++)n[a[l-1]]=o[l];return n}return n}function hf(i){if(/^[zZ]/.test(i.Z))return new Date(fs(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(fs(i)-(e[1]==="-"?-1:1)*bi(e[2])*36e5+bi(e[3])*6e4):new Date("")}function df(i,e){if(i){var t=nf(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?rf(i):bi(i));if(sf(i)){var r=e?cf(i,e):af(i);if(r.y)return r.M&&(r.M=gs(r.M)-1),r.S&&(r.S=of(gs(r.S.substring(0,3)))),r.Z?hf(r):new Date(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}}return new Date("")}var Q=df;function uf(){return new Date}var Bi=uf,ff=et,gf=Q,vf=Bi;function mf(i){var e,t=i?gf(i):vf();return ff(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var No=mf,xf=G,pf=Ee;function yf(i,e,t){if(i){if(xf(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var n in i)if(pf(i,n)&&e.call(t,i[n],n,i)===!1)break}}var wf=yf,Ef=G,Cf=Ee;function bf(i,e,t){if(i){var r,s;if(Ef(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=Cf(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var _f=bf,Rf=G,If=Ye,Sf=Ee;function Tf(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(If(t)||Rf(t))return e(t,r);for(var s in t)if(Sf(t,s)&&r===t[s])return s}return-1}}var Bo=Tf,Of=Bo,kf=To,Df=Of("indexOf",kf),Lf=Df,$f=Bo,Mf=Oo,Af=$f("lastIndexOf",Mf),Ho=Af,Nf=G,Bf=Ye,Hf=Z;function Ff(i){var e=0;return Bf(i)||Nf(i)?i.length:(Hf(i,function(){e++}),e)}var Fo=Ff,Kf=$e;function Pf(i){return Kf(i)&&isFinite(i)}var Yf=Pf,Vf=G,Wf=Pe,Xf=function(i){return!Wf(i)&&!isNaN(i)&&!Vf(i)&&i%1===0},Ko=Xf,zf=G,Gf=Ko,Uf=Pe;function qf(i){return!Uf(i)&&!isNaN(i)&&!zf(i)&&!Gf(i)}var Zf=qf,Jf=Dt,Qf=Jf("boolean"),Po=Qf,jf=Jt,eg=jf("RegExp"),Ir=eg,tg=Jt,ig=tg("Error"),Yo=ig;function rg(i){return i?i.constructor===TypeError:!1}var sg=rg;function ng(i){for(var e in i)return!1;return!0}var Vo=ng,og=Ce,ag=typeof Symbol!==og;function lg(i){return ag&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var Wo=lg,cg=Jt,hg=cg("Arguments"),dg=hg,ug=Ye,fg=$e;function gg(i){return!!(i&&ug(i.nodeName)&&fg(i.nodeType))}var vg=gg,mg=Ce,xg=typeof document===mg?0:document,Sr=xg,pg=Sr;function yg(i){return!!(i&&pg&&i.nodeType===9)}var wg=yg,Eg=Ce,Cg=typeof window===Eg?0:window,Xo=Cg,bg=Xo;function _g(i){return!!(bg&&(i&&i===i.window))}var Rg=_g,Ig=Ce,Sg=typeof FormData!==Ig;function Tg(i){return Sg&&i instanceof FormData}var Og=Tg,kg=Ce,Dg=typeof Map!==kg;function Lg(i){return Dg&&i instanceof Map}var $g=Lg,Mg=Ce,Ag=typeof WeakMap!==Mg;function Ng(i){return Ag&&i instanceof WeakMap}var Bg=Ng,Hg=Ce,Fg=typeof Set!==Hg;function Kg(i){return Fg&&i instanceof Set}var Pg=Kg,Yg=Ce,Vg=typeof WeakSet!==Yg;function Wg(i){return Vg&&i instanceof WeakSet}var Xg=Wg,zg=le,Gg=Ye,Ug=G,qg=Ee;function Zg(i){return function(e,t,r){if(e&&zg(t)){if(Ug(e)||Gg(e))return i(e,t,r);for(var s in e)if(qg(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var zo=Zg,Jg=zo,Qg=Jg(function(i,e,t){for(var r=0,s=i.length;r<s;r++)if(e.call(t,i[r],r,i))return r;return-1}),Tr=Qg,ys=$e,ws=G,Es=Ye,jg=Ir,ev=et,tv=Po,iv=De,Cs=Ke,rv=ro;function Go(i,e,t,r,s,n,o){if(i===e)return!0;if(i&&e&&!ys(i)&&!ys(e)&&!Es(i)&&!Es(e)){if(jg(i))return t(""+i,""+e,s,n,o);if(ev(i)||tv(i))return t(+i,+e,s,n,o);var a,l,d,u=ws(i),f=ws(e);if(u||f?u&&f:i.constructor===e.constructor)return l=Cs(i),d=Cs(e),r&&(a=r(i,e,s)),l.length===d.length?iv(a)?rv(l,function(g,m){return g===d[m]&&Go(i[g],e[d[m]],t,r,u||f?m:g,i,e)}):!!a:!1}return t(i,e,s,n,o)}var Uo=Go;function sv(i,e){return i===e}var qo=sv,nv=Uo,ov=qo;function av(i,e){return nv(i,e,ov)}var Zo=av,bs=Ke,lv=Tr,_s=Zo,cv=io,hv=so;function dv(i,e){var t=bs(i),r=bs(e);if(r.length){if(hv(t,r))return cv(r,function(s){return lv(t,function(n){return n===s&&_s(i[n],e[s])})>-1})}else return!0;return _s(i,e)}var uv=dv,Rs=Uo,Is=qo,fv=le,gv=De;function vv(i,e,t){return fv(t)?Rs(i,e,function(r,s,n,o,a){var l=t(r,s,n,o,a);return gv(l)?Is(r,s):!!l},t):Rs(i,e,Is)}var mv=vv,xv=Wo,pv=et,yv=G,wv=Ir,Ev=Yo,Cv=Pe;function bv(i){return Cv(i)?"null":xv(i)?"symbol":pv(i)?"date":yv(i)?"array":wv(i)?"regexp":Ev(i)?"error":typeof i}var _v=bv,Rv=ke,Iv=Le;function Sv(i){return""+(Iv(i)?"":i)+Rv.keyId++}var Tv=Sv,Ov=zo,kv=Ov(function(i,e,t){for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return r;return-1}),Dv=kv,Lv=$t,$v=Ye;function Mv(i){if(Lv(i))return i;if($v(i))try{return JSON.parse(i)}catch{}return{}}var Av=Mv,Nv=Le;function Bv(i){return Nv(i)?"":JSON.stringify(i)}var Hv=Bv,Fv=wr,Kv=Fv("entries",2),Pv=Kv,Yv=le,Vv=G,Wv=Z,Xv=Tr;function zv(i,e){return function(t,r){var s,n,o={},a=[],l=this,d=arguments,u=d.length;if(!Yv(r)){for(n=1;n<u;n++)s=d[n],a.push.apply(a,Vv(s)?s:[s]);r=0}return Wv(t,function(f,g){((r?r.call(l,f,g,t):Xv(a,function(m){return m===g})>-1)?i:e)&&(o[g]=f)}),o}}var Jo=zv,Gv=Jo,Uv=Gv(1,0),qv=Uv,Zv=Jo,Jv=Zv(0,1),Qv=Jv,jv=At;function em(i){return jv(i)[0]}var tm=em,im=At;function rm(i){var e=im(i);return e[e.length-1]}var sm=rm,nm=oo,om=_r,di=Ee;function am(i,e){if(i){if(di(i,e))return!0;var t,r,s,n,o,a,l=om(e),d=0,u=l.length;for(o=i;d<u&&(a=!1,t=l[d],n=t?t.match(nm):"",n?(r=n[1],s=n[2],r?o[r]&&di(o[r],s)&&(a=!0,o=o[r][s]):di(o,s)&&(a=!0,o=o[s])):di(o,t)&&(a=!0,o=o[t]),a);d++)if(d===u-1)return!0}return!1}var lm=am,Ss=tt,cm=_r,hm=eo,dm=Ee,Ts=/(.+)?\[(\d+)\]$/;function um(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var n,o,a=e?e.match(Ts):null;if(t)o=s;else{var l=r?r.match(Ts):null;l&&!l[1]?o=new Array(Ss(l[2])+1):o={}}return a?a[1]?(n=Ss(a[2]),i[a[1]]?t?i[a[1]][n]=o:i[a[1]][n]?o=i[a[1]][n]:i[a[1]][n]=o:(i[a[1]]=new Array(n+1),i[a[1]][n]=o)):i[a[2]]=o:i[e]=o,o}return i[e]}function fm(i,e,t){if(i&&hm(e)){if((i[e]||dm(i,e))&&!Os(e))i[e]=t;else for(var r=i,s=cm(e),n=s.length,o=0;o<n;o++)if(!Os(s[o])){var a=o===n-1;r=um(r,s[o],a,a?null:s[o+1],t)}}return i}function Os(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var gm=fm,vm=Vo,mm=Ai,xm=le,pm=Lt,ym=Z;function wm(i){return function(){return vm(i)}}function Em(i,e,t){var r,s={};return i&&(e&&mm(e)?e=wm(e):xm(e)||(e=pm(e)),ym(i,function(n,o){r=e?e.call(t,n,o,i):n,s[r]?s[r].push(n):s[r]=[n]})),s}var Qo=Em,Cm=Qo,bm=Qt;function _m(i,e,t){var r=Cm(i,e,t||this);return bm(r,function(s,n){r[n]=s.length}),r}var Rm=_m;function Im(i,e,t){var r,s,n=[],o=arguments;if(o.length<2&&(e=o[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)n.push(r);return n}var jo=Im,ks=Ke,Sm=xt,Tm=Mt,Om=ie,km=ue;function Dm(i,e){if(i&&e){var t=km.apply(this,[{}].concat(Sm(arguments,1))),r=ks(t);Om(ks(i),function(s){Tm(r,s)&&(i[s]=t[s])})}return i}var Lm=Dm,$m=fo,Mm=$m(function(i,e){return i>e}),Am=Mm;function Nm(i){return(i.split(".")[1]||"").length}var Hi=Nm,Bm=tt;function Hm(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(Bm(e));return t.join(i)+(t.length>0?i:"")}var ti=Hm;function Fm(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var ea=Fm,ui=ti,ji=ea;function Km(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",n=t[3]||"",o=t[5]||"",a=t[6]||"",l=t[7],d=t[8],u=d-a.length,f=d-n.length,g=d-o.length;return l==="+"?n?s+n+ui("0",d):u>0?s+o+a+ui("0",u):s+o+ji(a,d):n?f>0?s+"0."+ui("0",Math.abs(f))+n:s+ji(n,f):g>0?s+"0."+ui("0",Math.abs(g))+o+a:s+ji(o,g)+a}return e}var it=Km,Ds=Hi,Ls=it;function Pm(i,e){var t=Ls(i),r=Ls(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,Ds(t)+Ds(r))}var ta=Pm,Ym=ta,$s=mt,Vm=it;function Wm(i){return function(e,t){var r=$s(e),s=r;if(r){t=t>>0;var n=Vm(r),o=n.split("."),a=o[0],l=o[1]||"",d=l.substring(0,t+1),u=a+(d?"."+d:"");if(t>=l.length)return $s(u);if(u=r,t>0){var f=Math.pow(10,t);s=Math[i](Ym(u,f))/f}else s=Math[i](u)}return s}}var Or=Wm,Xm=Or,zm=Xm("round"),kr=zm,Gm=Or,Um=Gm("ceil"),ia=Um,qm=Or,Zm=qm("floor"),ra=Zm,Jm=Le,Qm=$e,jm=it;function ex(i){return Qm(i)?jm(i):""+(Jm(i)?"":i)}var ce=ex,tx=kr,ix=ce,rx=ti,sx=ea;function nx(i,e){e=e>>0;var t=ix(tx(i,e)),r=t.split("."),s=r[0],n=r[1]||"",o=e-n.length;return e?o>0?s+"."+n+rx("0",o):s+sx(n,Math.abs(o)):s}var Dr=nx,ox=ke,ax=kr,lx=ia,cx=ra,hx=$e,dx=ce,ux=Dr,fx=it,gx=ue;function vx(i,e){var t=gx({},ox.commafyOptions,e),r=t.digits,s=hx(i),n,o,a,l,d;return s?(n=(t.ceil?lx:t.floor?cx:ax)(i,r),o=fx(r?ux(n,r):n).split("."),l=o[0],d=o[1],a=l&&n<0,a&&(l=l.substring(1,l.length))):(n=dx(i).replace(/,/g,""),o=n?[n]:[],l=o[0]),o.length?(a?"-":"")+l.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):n}var mx=vx,xx=tt,px=ho,yx=px(xx),wx=yx,Ex=ta,Ms=mt;function Cx(i,e){var t=Ms(i),r=Ms(e);return Ex(t,r)}var Lr=Cx,As=Hi,Ns=it,Bs=Lr;function bx(i,e){var t=Ns(i),r=Ns(e),s=Math.pow(10,Math.max(As(t),As(r)));return(Bs(i,s)+Bs(e,s))/s}var sa=bx,_x=sa,Hs=mt;function Rx(i,e){return _x(Hs(i),Hs(e))}var Ix=Rx,Fs=Hi,Ks=it,Ps=mt,Sx=Dr;function Tx(i,e){var t=Ps(i),r=Ps(e),s=Ks(t),n=Ks(r),o=Fs(s),a=Fs(n),l=Math.pow(10,Math.max(o,a)),d=o>=a?o:a;return parseFloat(Sx((t*l-r*l)/l,d))}var Ox=Tx,Ys=Hi,Vs=it,kx=Lr;function Dx(i,e){var t=Vs(i),r=Vs(e),s=Ys(t),n=Ys(r),o=n-s,a=o<0,l=Math.pow(10,a?Math.abs(o):o);return kx(t.replace(".","")/r.replace(".",""),a?1/l:l)}var na=Dx,Lx=na,Ws=mt;function $x(i,e){return Lx(Ws(i),Ws(e))}var Mx=$x,er=sa,Ax=le,Nx=G,Bx=Z,Hx=jt;function Fx(i,e,t){var r=0;return Bx(i&&i.length>2&&Nx(i)?i.sort():i,e?Ax(e)?function(){r=er(r,e.apply(t,arguments))}:function(s){r=er(r,Hx(s,e))}:function(s){r=er(r,s)}),r}var oa=Fx,Kx=na,Px=Fo,Yx=oa;function Vx(i,e,t){return Kx(Yx(i,e,t),Px(i))}var Wx=Vx,Xx="first",rt=Xx,zx="last",pt=zx;function Gx(i){return i.getFullYear()}var st=Gx,Ux=864e5,Nt=Ux;function qx(i){return i.getMonth()}var yt=qx,Zx=et,Jx=re;function Qx(i){return Zx(i)&&!isNaN(Jx(i))}var se=Qx,Xs=rt,jx=pt,ep=Nt,tp=st,zs=re,Gs=yt,ip=Q,rp=se,sp=$e;function aa(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=ip(i),rp(i)){if(t===Xs)return new Date(tp(i),Gs(i)+r,1);if(t===jx)return new Date(zs(aa(i,r+1,Xs))-1);if(sp(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(Gs(i)+r),s!==i.getDate())return i.setDate(1),new Date(zs(i)-ep)}}return i}var ii=aa,np=rt,Us=pt,qs=st,op=ii,ap=Q,lp=se;function cp(i,e,t){var r;if(i=ap(i),lp(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear(qs(i)+r)),t||!isNaN(t))){if(t===np)return new Date(qs(i),0,1);if(t===Us)return i.setMonth(11),op(i,0,Us);i.setMonth(t)}return i}var Fi=cp,hp=ii,dp=Q,up=se;function fp(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function gp(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=dp(i),up(i)?(r=(fp(i)-1)*3,i.setMonth(r),hp(i,s,t)):i}var vp=gp,mp=Nt,xp=mp*7,la=xp,pp=ke,tr=Nt,yp=la,wp=re,Ep=Q,Cp=se,Zs=$e;function bp(i,e,t,r){if(i=Ep(i),Cp(i)){var s=Zs(t),n=Zs(r),o=wp(i);if(s||n){var a=n?r:pp.firstDayOfWeek,l=i.getDay(),d=s?t:l;if(l!==d){var u=0;a>l?u=-(7-a+l):a<l&&(u=a-l),d>a?o+=((d===0?7:d)-a+u)*tr:d<a?o+=(7-a+d+u)*tr:o+=u*tr}}return e&&!isNaN(e)&&(o+=e*yp),new Date(o)}return i}var ca=bp,Js=rt,_p=pt,Rp=tt,Ip=st,Sp=yt,Tp=re,Op=Q,kp=se;function ha(i,e,t){if(i=Op(i),kp(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Rp(e)),t===Js)return new Date(Ip(i),Sp(i),i.getDate());if(t===_p)return new Date(Tp(ha(i,1,Js))-1)}return i}var da=ha,Qs=rt,Dp=pt,Lp=tt,$p=st,Mp=yt,Ap=re,Np=Q,Bp=se;function ua(i,e,t){if(i=Np(i),Bp(i)&&!isNaN(e)){if(i.setHours(i.getHours()+Lp(e)),t===Qs)return new Date($p(i),Mp(i),i.getDate(),i.getHours());if(t===Dp)return new Date(Ap(ua(i,1,Qs))-1)}return i}var Hp=ua,js=rt,Fp=pt,Kp=tt,Pp=st,Yp=yt,Vp=re,Wp=Q,Xp=se;function fa(i,e,t){if(i=Wp(i),Xp(i)&&!isNaN(e)){if(i.setMinutes(i.getMinutes()+Kp(e)),t===js)return new Date(Pp(i),Yp(i),i.getDate(),i.getHours(),i.getMinutes());if(t===Fp)return new Date(Vp(fa(i,1,js))-1)}return i}var zp=fa,en=rt,Gp=pt,Up=tt,qp=st,Zp=yt,Jp=re,Qp=Q,jp=se;function ga(i,e,t){if(i=Qp(i),jp(i)&&!isNaN(e)){if(i.setSeconds(i.getSeconds()+Up(e)),t===en)return new Date(qp(i),Zp(i),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds());if(t===Gp)return new Date(Jp(ga(i,1,en))-1)}return i}var e0=ga;function t0(i){return i.toUpperCase()}var va=t0,i0=ke,fi=Nt,r0=la,s0=$e,n0=Mt,o0=Q,a0=se,tn=ca,l0=jo,c0=vt,gi=re,h0=c0(l0(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function rn(i,e){var t=new Date(i).getDay();return n0(h0[e],t)}function d0(i,e){return function(t,r){var s=s0(r)?r:i0.firstDayOfWeek,n=o0(t);if(a0(n)){var o=tn(n,0,s,s),a=i(o),l=gi(a),d=gi(o),u=d+fi*6,f=new Date(u),g=tn(a,0,s,s),m=gi(g),x;if(d===m)return 1;if(e(o,f)){for(x=gi(i(f));x<u;x+=fi)if(rn(x,s))return 1}var v=m+fi*6,p=new Date(u),w=1;if(e(g,p)){for(w=0,x=l;x<v;x+=fi)if(rn(x,s)){w++;break}}return Math.floor((d-m)/r0)+w}return NaN}}var ma=d0,u0=ma,f0=u0(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),xa=f0,g0=st,v0=yt;function m0(i){return new Date(g0(i),v0(i),i.getDate())}var x0=m0,p0=re,y0=x0;function w0(i){return p0(y0(i))}var E0=w0,C0=Nt,b0=rt,sn=E0,_0=Fi,R0=Q,I0=se;function S0(i){return i=R0(i),I0(i)?Math.floor((sn(i)-sn(_0(i,0,b0)))/C0)+1:NaN}var pa=S0,T0=ce,O0=De,k0=ti;function D0(i,e,t){var r=T0(i);return e=e>>0,t=O0(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=k0(t,e/t.length)),t.slice(0,e)+r):r}var ya=D0,Vt=ke,L0=va,$0=st,nn=yt,M0=Q,A0=xa,N0=pa,B0=ue,H0=se,F0=le,K0=Le,Ie=ya;function Ue(i,e,t,r){var s=e[t];return s?F0(s)?s(r,t,i):s[r]:r}var P0=/\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;function Y0(i,e,t){if(i){if(i=M0(i),H0(i)){var r=t||{},s=e||Vt.parseDateFormat||Vt.formatString,n=i.getHours(),o=n<12?"am":"pm",a=B0({},Vt.parseDateRules||Vt.formatStringMatchs,r.formats),l=function(b,_){return(""+$0(i)).substring(4-_)},d=function(b,_){return Ie(nn(i)+1,_,"0")},u=function(b,_){return Ie(i.getDate(),_,"0")},f=function(b,_){return Ie(n,_,"0")},g=function(b,_){return Ie(n<=12?n:n-12,_,"0")},m=function(b,_){return Ie(i.getMinutes(),_,"0")},x=function(b,_){return Ie(i.getSeconds(),_,"0")},v=function(b,_){return Ie(i.getMilliseconds(),_,"0")},p=function(b,_){var B=i.getTimezoneOffset()/60*-1;return Ue(i,a,b,(B>=0?"+":"-")+Ie(B,2,"0")+(_===1?":":"")+"00")},w=function(b,_){return Ie(Ue(i,a,b,A0(i,K0(r.firstDay)?Vt.firstDayOfWeek:r.firstDay)),_,"0")},E=function(b,_){return Ie(Ue(i,a,b,N0(i)),_,"0")},C={yyyy:l,yy:l,MM:d,M:d,dd:u,d:u,HH:f,H:f,hh:g,h:g,mm:m,m,ss:x,s:x,SSS:v,S:v,ZZ:p,Z:p,WW:w,W:w,DDD:E,D:E,a:function(b){return Ue(i,a,b,o)},A:function(b){return Ue(i,a,b,L0(o))},e:function(b){return Ue(i,a,b,i.getDay())},E:function(b){return Ue(i,a,b,i.getDay())},q:function(b){return Ue(i,a,b,Math.floor((nn(i)+3)/3))}};return s.replace(P0,function(b,_){return _||(C[b]?C[b](b,b.length):b)})}return"Invalid Date"}return""}var wa=Y0,V0=re,W0=Bi,X0=Date.now||function(){return V0(W0())},Ea=X0,z0=re,G0=Ea,U0=Q,q0=et,Z0=function(i,e){if(i){var t=U0(i,e);return q0(t)?z0(t):t}return G0()},J0=Z0,on=wa;function Q0(i,e,t){return i&&e?(i=on(i,t),i!=="Invalid Date"&&i===on(e,t)):!1}var j0=Q0,e1=ma,t1=e1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),i1=t1,r1=Fi,s1=Q,n1=se,o1=No;function a1(i,e){return i=s1(i),n1(i)?o1(r1(i,e))?366:365:NaN}var l1=a1,c1=Nt,h1=rt,d1=pt,an=re,ln=ii,u1=Q,f1=se;function g1(i,e){return i=u1(i),f1(i)?Math.floor((an(ln(i,e,d1))-an(ln(i,e,h1)))/c1)+1:NaN}var v1=g1,cn=re,m1=Bi,hn=Q,dn=se,un=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function x1(i,e){var t,r,s,n,o,a,l={done:!1,status:!1,time:0};if(i=hn(i),e=e?hn(e):m1(),dn(i)&&dn(e)&&(t=cn(i),r=cn(e),t<r))for(n=l.time=r-t,l.done=!0,l.status=!0,a=0,o=un.length;a<o;a++)s=un[a],n>=s[1]?a===o-1?l[s[0]]=n||0:(l[s[0]]=Math.floor(n/s[1]),n-=l[s[0]]*s[1]):l[s[0]]=0;return l}var p1=x1,y1=ce,w1=De,E1=ti;function C1(i,e,t){var r=y1(i);return e=e>>0,t=w1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=E1(t,e/t.length)),r+t.slice(0,e)):r}var b1=C1,_1=ce,R1=ti;function I1(i,e){return R1(_1(i),e)}var S1=I1,T1=ce;function O1(i){return i&&i.trimRight?i.trimRight():T1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Ca=O1,k1=ce;function D1(i){return i&&i.trimLeft?i.trimLeft():k1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var ba=D1,L1=Ca,$1=ba;function M1(i){return i&&i.trim?i.trim():L1($1(i))}var _a=M1,A1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Ra=A1,N1=ce,B1=Ke;function H1(i){var e=new RegExp("(?:"+B1(i).join("|")+")","g");return function(t){return N1(t).replace(e,function(r){return i[r]})}}var Ia=H1,F1=Ra,K1=Ia,P1=K1(F1),Y1=P1,fn=Ra,V1=Ia,W1=Z,Sa={};W1(fn,function(i,e){Sa[fn[e]]=e});var X1=V1(Sa),z1=X1;function G1(i,e,t){return i.substring(e,t)}var Ta=G1;function U1(i){return i.toLowerCase()}var Oa=U1,q1=ce,qe=Ta,Wt=va,Z1=Oa,ir={};function J1(i){if(i=q1(i),ir[i])return ir[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,n){return n&&n+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,n){var o=s.length;return s=Z1(s),n?o>2&&n+o<e?Wt(qe(s,0,1))+qe(s,1,o-1)+Wt(qe(s,o-1,o)):Wt(qe(s,0,1))+qe(s,1,o):o>1&&n+o<e?qe(s,0,o-1)+Wt(qe(s,o-1,o)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return Wt(qe(s,1,s.length))}),ir[i]=t,t}var Q1=J1,j1=ce,_t=Ta,Ze=Oa,rr={};function ey(i){if(i=j1(i),rr[i])return rr[i];if(/^[A-Z]+$/.test(i))return Ze(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,n){var o=s.length;return o>1?r+"-"+Ze(_t(s,0,o-1))+"-"+Ze(_t(s,o-1,o))+n:Ze(r+"-"+s+n)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var n=r.length;return Ze(_t(r,0,n-1)+"-"+_t(r,n-1,n)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,n,o){var a=s.length;return a>1&&(r&&(r+="-"),n)?(r||"")+Ze(_t(s,0,a-1))+"-"+Ze(_t(s,a-1,a))+n:(r||"")+(o?"-":"")+Ze(s)+(n||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),rr[i]=e,e}var ty=ey,iy=ce;function ry(i,e,t){var r=iy(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var sy=ry,ny=ce;function oy(i,e,t){var r=ny(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var ay=oy,ly=ke,cy=ce,hy=_a,dy=jt;function uy(i,e,t){return cy(i).replace((t||ly).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return dy(e,hy(s))})}var ka=uy,fy=ka;function gy(i,e){return fy(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var vy=gy;function my(){}var xy=my,gn=xt;function py(i,e){var t=gn(arguments,2);return function(){return i.apply(e,gn(arguments).concat(t))}}var yy=py,vn=xt;function wy(i,e){var t=!1,r=null,s=vn(arguments,2);return function(){return t||(r=i.apply(e,vn(arguments).concat(s)),t=!0),r}}var Ey=wy,Cy=xt;function by(i,e,t){var r=0,s=[];return function(){var n=arguments;r++,r<=i&&s.push(n[0]),r>=i&&e.apply(t,[s].concat(Cy(n)))}}var _y=by,Ry=xt;function Iy(i,e,t){var r=0,s=[];return t=t||this,function(){var n=arguments;r++,r<i&&(s.push(n[0]),e.apply(t,[s].concat(Ry(n))))}}var Sy=Iy,Ty=ue;function Oy(i,e,t){var r=null,s=null,n=!1,o=null,a=Ty({leading:!0,trailing:!0},t),l=a.leading,d=a.trailing,u=function(){r=null,s=null},f=function(){n=!0,i.apply(s,r),o=setTimeout(g,e),u()},g=function(){if(o=null,n){u();return}if(d===!0){f();return}u()},m=function(){var v=o!==null;return v&&clearTimeout(o),u(),o=null,n=!1,v},x=function(){if(r=arguments,s=this,n=!1,o===null&&l===!0){f();return}d===!0&&(o=setTimeout(g,e))};return x.cancel=m,x}var ky=Oy,Dy=ue;function Ly(i,e,t){var r=null,s=null,n=typeof t=="boolean"?{leading:t,trailing:!t}:Dy({leading:!1,trailing:!0},t),o=!1,a=null,l=n.leading,d=n.trailing,u=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),u()},g=function(){if(l===!0&&(a=null),o){u();return}if(d===!0){f();return}u()},m=function(){var v=a!==null;return v&&clearTimeout(a),u(),a=null,o=!1,v},x=function(){o=!1,r=arguments,s=this,a===null?l===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var $y=Ly,My=xt;function Ay(i,e){var t=My(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var Ny=Ay,By=decodeURIComponent,Da=By,mn=Da,Hy=ie,Fy=Ye;function Ky(i){var e,t={};return i&&Fy(i)&&Hy(i.split("&"),function(r){e=r.split("="),t[mn(e[0])]=mn(e[1]||"")}),t}var La=Ky,Py=encodeURIComponent,$a=Py,_i=$a,Ma=Z,Aa=G,Na=Pe,Yy=De,Ba=$t;function Ha(i,e,t){var r,s=[];return Ma(i,function(n,o){r=Aa(n),Ba(n)||r?s=s.concat(Ha(n,e+"["+o+"]",r)):s.push(_i(e+"["+(t?"":o)+"]")+"="+_i(Na(n)?"":n))}),s}function Vy(i){var e,t=[];return Ma(i,function(r,s){Yy(r)||(e=Aa(r),Ba(r)||e?t=t.concat(Ha(r,s,e)):t.push(_i(s)+"="+_i(Na(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var Wy=Vy,Xy=Ce,zy=typeof location===Xy?0:location,Ki=zy,vi=Ki;function Gy(){return vi?vi.origin||vi.protocol+"//"+vi.host:""}var Fa=Gy,xn=Ki,Uy=La,qy=Fa;function pn(i){return Uy(i.split("?")[1]||"")}function Zy(i){var e,t,r,s,n=""+i;return n.indexOf("//")===0?n=(xn?xn.protocol:"")+n:n.indexOf("/")===0&&(n=qy()+n),r=n.replace(/#.*/,"").match(/(\?.*)/),s={href:n,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=n.replace(/^([a-z0-9.+-]*:)\/\//,function(o,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(o,a,l){return t=l||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(o,a){return s.hash=a.length>1?a:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=pn(s.hash),s.searchQuery=pn(s.search),s}var Ka=Zy,yn=Ki,Jy=Fa,Qy=Ho;function jy(){if(yn){var i=yn.pathname,e=Qy(i,"/")+1;return Jy()+(e===i.length?i:i.substring(0,e))}return""}var ew=jy,wn=Ki,tw=Ka;function iw(){return wn?tw(wn.href):{}}var rw=iw,Pa=ke,sr=Sr,En=Da,Cn=$a,sw=G,bn=Ai,Ya=et,nw=De,ow=Mt,aw=Ke,Ri=ue,nr=ie,lw=Bi,mi=re,cw=Fi,hw=ii,dw=da;function _n(i,e){var t=parseFloat(e),r=lw(),s=mi(r);switch(i){case"y":return mi(cw(r,t));case"M":return mi(hw(r,t));case"d":return mi(dw(r,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function or(i){return(Ya(i)?i:new Date(i)).toUTCString()}function Qe(i,e,t){if(sr){var r,s,n,o,a,l,d=[],u=arguments;return sw(i)?d=i:u.length>1?d=[Ri({name:i,value:e},t)]:bn(i)&&(d=[i]),d.length>0?(nr(d,function(f){r=Ri({},Pa.cookies,f),n=[],r.name&&(s=r.expires,n.push(Cn(r.name)+"="+Cn(bn(r.value)?JSON.stringify(r.value):r.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,m,x){return or(_n(x,m))}):/^[0-9]{11,13}$/.test(s)||Ya(s)?s=or(s):s=or(_n("d",s)),r.expires=s),nr(["expires","path","domain","secure"],function(g){nw(r[g])||n.push(r[g]&&g==="secure"?g:g+"="+r[g])})),sr.cookie=n.join("; ")}),!0):(o={},a=sr.cookie,a&&nr(a.split("; "),function(f){l=f.indexOf("="),o[En(f.substring(0,l))]=En(f.substring(l+1)||"")}),u.length===1?o[i]:o)}return!1}function uw(i){return ow(Va(),i)}function Rn(i){return Qe(i)}function In(i,e,t){return Qe(i,e,t),Qe}function Sn(i,e){Qe(i,"",Ri({expires:-1},Pa.cookies,e))}function Va(){return aw(Qe())}function fw(){return Qe()}Ri(Qe,{has:uw,set:In,setItem:In,get:Rn,getItem:Rn,remove:Sn,removeItem:Sn,keys:Va,getJSON:fw});var gw=Qe,vw=Ce,ar=Sr,lr=Xo,mw=ue,xw=ie;function Tn(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function xi(i){return navigator.userAgent.indexOf(i)>-1}function pw(){var i,e,t,r=!1,s=!1,n=!1,o={isNode:!1,isMobile:r,isPC:!1,isDoc:!!ar};if(!lr&&typeof process!==vw)o.isNode=!0;else{t=xi("Edge"),e=xi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),o.isDoc&&(i=ar.body||ar.documentElement,xw(["webkit","khtml","moz","ms","o"],function(a){o["-"+a]=!!i[a+"MatchesSelector"]}));try{s=Tn(lr.localStorage)}catch{}try{n=Tn(lr.sessionStorage)}catch{}mw(o,{edge:t,firefox:xi("Firefox"),msie:!t&&o["-ms"],safari:!e&&!t&&xi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:n})}return o}var yw=pw,Wa=lc,On=ue,ww=Qt,Ew=jn,Cw=wc,bw=Sc,_w=vt,Rw=io,Iw=ro,Sw=so,Tw=ie,Ow=Cr,kw=no,Dw=qc,Lw=br,$w=Ih,Mw=Rr,Aw=co,Nw=Ah,Bw=xt,Hw=Yh,Fw=Xh,Kw=Mt,Pw=Uh,Yw=Qh,Vw=td,Ww=sd,Xw=ad,zw=Cd,Gw=vo,Uw=Id,qw=Od,Zw=uo,Jw=Md,Qw=mu,jw=Eu,eE=Ru,tE=Ro,iE=Lu,rE=Au,sE=Ku,nE=To,oE=Oo,aE=Ee,lE=G,cE=Pe,hE=Gu,dE=De,uE=le,fE=Ai,gE=Ye,vE=$t,mE=No,xE=et,pE=Le,yE=Z,wE=wf,EE=_f,CE=Lf,bE=Ho,_E=Ke,RE=At,IE=Er,SE=Fo,TE=yo,OE=Eo,kE=wo,DE=Yf,LE=Zf,$E=Ko,ME=Po,AE=$e,NE=Ir,BE=Yo,HE=sg,FE=Vo,KE=Wo,PE=dg,YE=vg,VE=wg,WE=Rg,XE=Og,zE=$g,GE=Bg,UE=Pg,qE=Xg,ZE=uv,JE=Zo,QE=mv,jE=_v,e2=Tv,t2=Tr,i2=Dv,r2=Av,s2=Hv,n2=Pv,o2=qv,a2=Qv,l2=tm,c2=sm,h2=lm,d2=jt,u2=gm,f2=Qo,g2=Rm,v2=jo,m2=Lm,x2=lo,p2=go,y2=Am,w2=mx,E2=kr,C2=ia,b2=ra,_2=Dr,R2=wx,I2=mt,S2=it,T2=Ix,O2=Ox,k2=Lr,D2=Mx,L2=oa,$2=Wx,M2=Fi,A2=vp,N2=ii,B2=ca,H2=da,F2=Hp,K2=zp,P2=e0,Y2=Q,V2=wa,W2=Ea,X2=J0,z2=se,G2=j0,U2=pa,q2=xa,Z2=i1,J2=l1,Q2=v1,j2=p1,eC=b1,tC=ya,iC=S1,rC=_a,sC=Ca,nC=ba,oC=Y1,aC=z1,lC=Q1,cC=ty,hC=sy,dC=ay,uC=ka,fC=vy,kn=ce,gC=xy,vC=Lt,mC=yy,xC=Ey,pC=_y,yC=Sy,wC=ky,EC=$y,CC=Ny,bC=La,_C=Wy,RC=Ka,IC=ew,SC=rw,TC=gw,OC=yw;On(Wa,{assign:On,objectEach:ww,lastObjectEach:Ew,objectMap:Cw,merge:bw,uniq:kw,union:Dw,sortBy:$w,orderBy:Mw,shuffle:Aw,sample:Nw,some:Rw,every:Iw,slice:Bw,filter:Hw,find:Pw,findLast:Yw,findKey:Fw,includes:Kw,arrayIndexOf:nE,arrayLastIndexOf:oE,map:_w,reduce:Vw,copyWithin:Ww,chunk:Xw,zip:zw,unzip:Gw,zipObject:Uw,flatten:qw,toArray:Lw,includeArrays:Sw,pluck:Zw,invoke:Jw,arrayEach:Tw,lastArrayEach:Ow,toArrayTree:Qw,toTreeArray:jw,findTree:eE,eachTree:tE,mapTree:iE,filterTree:rE,searchTree:sE,hasOwnProp:aE,eqNull:pE,isNaN:hE,isFinite:DE,isUndefined:dE,isArray:lE,isFloat:LE,isInteger:$E,isFunction:uE,isBoolean:ME,isString:gE,isNumber:AE,isRegExp:NE,isObject:fE,isPlainObject:vE,isDate:xE,isError:BE,isTypeError:HE,isEmpty:FE,isNull:cE,isSymbol:KE,isArguments:PE,isElement:YE,isDocument:VE,isWindow:WE,isFormData:XE,isMap:zE,isWeakMap:GE,isSet:UE,isWeakSet:qE,isLeapYear:mE,isMatch:ZE,isEqual:JE,isEqualWith:QE,getType:jE,uniqueId:e2,getSize:SE,indexOf:CE,lastIndexOf:bE,findIndexOf:t2,findLastIndexOf:i2,toStringJSON:r2,toJSONString:s2,keys:_E,values:RE,entries:n2,pick:o2,omit:a2,first:l2,last:c2,each:yE,forOf:wE,lastForOf:EE,lastEach:TE,has:h2,get:d2,set:u2,groupBy:f2,countBy:g2,clone:IE,clear:kE,remove:OE,range:v2,destructuring:m2,random:x2,min:y2,max:p2,commafy:w2,round:E2,ceil:C2,floor:b2,toFixed:_2,toNumber:I2,toNumberString:S2,toInteger:R2,add:T2,subtract:O2,multiply:k2,divide:D2,sum:L2,mean:$2,now:W2,timestamp:X2,isValidDate:z2,isDateSame:G2,toStringDate:Y2,toDateString:V2,getWhatYear:M2,getWhatQuarter:A2,getWhatMonth:N2,getWhatWeek:B2,getWhatDay:H2,getWhatHours:F2,getWhatMinutes:K2,getWhatSeconds:P2,getYearDay:U2,getYearWeek:q2,getMonthWeek:Z2,getDayOfYear:J2,getDayOfMonth:Q2,getDateDiff:j2,trim:rC,trimLeft:nC,trimRight:sC,escape:oC,unescape:aC,camelCase:lC,kebabCase:cC,repeat:iC,padStart:tC,padEnd:eC,startsWith:hC,endsWith:dC,template:uC,toFormatString:fC,toString:kn,toValueString:kn,noop:gC,property:vC,bind:mC,once:xC,after:pC,before:yC,throttle:wC,debounce:EC,delay:CC,unserialize:bC,serialize:_C,parseUrl:RC,getBaseURL:IC,locat:SC,browse:OC,cookie:TC});var T=Wa,J=[];for(var cr=0;cr<256;++cr)J.push((cr+256).toString(16).slice(1));function kC(i,e=0){return(J[i[e+0]]+J[i[e+1]]+J[i[e+2]]+J[i[e+3]]+"-"+J[i[e+4]]+J[i[e+5]]+"-"+J[i[e+6]]+J[i[e+7]]+"-"+J[i[e+8]]+J[i[e+9]]+"-"+J[i[e+10]]+J[i[e+11]]+J[i[e+12]]+J[i[e+13]]+J[i[e+14]]+J[i[e+15]]).toLowerCase()}var pi,DC=new Uint8Array(16);function LC(){if(!pi&&(pi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!pi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return pi(DC)}var $C=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Dn={randomUUID:$C};function Fe(i,e,t){if(Dn.randomUUID&&!i)return Dn.randomUUID();i=i||{};var r=i.random||(i.rng||LC)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,kC(r)}const MC=i=>i==null||i==="",q=i=>!MC(i),ht=i=>i==null,ve=i=>!ht(i),AC=i=>function(e,t,r,s){const n=r||{},o=n.children||"children";return i(null,e,t,s,[],[],o,n)},Xa=(i,e,t,r,s,n,o)=>{let a,l;e.forEach((d,u)=>{a=s.concat([""+u]),l=n.concat([d]),t.call(r,d,u,e,a,i,l),d&&o&&(a.push(o),Xa(d,d[o]||[],t,r,a,l,o))})},zt=AC(Xa),za={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let te=T.clone(za,!0);function Ga(i){te={form:{...te.form,...i.form},grid:{...te.grid,...i.grid},canvasTable:{...te.canvasTable,...i.canvasTable},renderTooltip:i.renderTooltip??te.renderTooltip}}function Ua(){return te.renderTooltip}function NC(){return te}function Ln(){var i,e;return{labelCol:(i=te.form)==null?void 0:i.labelCol,wrapperCol:(e=te.form)==null?void 0:e.wrapperCol}}function It(){var i,e,t,r;return{align:(i=te.grid)==null?void 0:i.align,lazyReset:(e=te.grid)==null?void 0:e.lazyReset,fitHeight:(t=te.grid)==null?void 0:t.fitHeight,striped:(r=te.grid)==null?void 0:r.striped}}function qa(){return te.canvasTable||{}}function BC(){te=JSON.parse(JSON.stringify(za))}const Pi=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...T.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>Pi(t))}},$r={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Mr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},HC={1:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},2:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},3:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:5},4:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},5:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},6:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:8},7:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:9},8:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:9},9:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:10}},Za=i=>{const t=(24-i.reduce((s,n)=>s+n,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},$n=["xxs","xs","sm","md","lg","xl","xxl"],FC=i=>{const e=T.isArray(i)?i:T.isNumber(i)?Array.from({length:i},()=>$r):[];return T.zipObject($n,$n.map(t=>e.every(r=>q(r[t]))?Za(e.map(r=>r[t])):24))};function Ar(i,e,t){const r=c.toValue(i);if(typeof r!="object"||r===null)return c.watch(i,e,t);let s=T.clone(r,!0);return c.watch(i,(n,o,a)=>{e(n,s,a),s=T.clone(n,!0)},t)}const ct="-",St={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??ct:ct},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return ct;if(T.isArray(i))if(i.length>0){const s=e.filter(n=>i.includes(n.value));return s.length?s.map(n=>n.label).join(t):ct}else return ct;const r=e.find(s=>s.value===i);return r?r.label:ct},formatSex:({cellValue:i})=>q(i)?T.toNumber(i)===1?"男":"女":ct},KC=(i,{record:e,index:t,column:r,field:s})=>{if(T.isString(i)&&St[i]){const n=St[i];return n({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(T.isArray(i)&&St[i[0]]&&i.length>1){const n=St[i[0]];return n({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return T.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},Ja=i=>{Object.assign(St,i)},PC=c.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:n,rowIndex:o}=t;return()=>{var a,l;return((l=(a=Gt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:l.call(a,e,{data:r,row:s,field:n,rowIndex:o},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Qa=c.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,n=r.field?t[r.field]:null;return()=>{var o,a;return((a=(o=r.slots)==null?void 0:o.default)==null?void 0:a.call(o,{row:t,column:r,rowIndex:s,cellValue:n}))??(r.cellRender?c.createVNode(PC,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?KC(r.formatter,{record:t,index:s,field:r.field,column:r}):n)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),YC={class:"text-right mt-4px"},VC=c.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(i,{emit:e}){const t=i,r={size:"small",pagination:!1};c.watch(()=>t.modelValue,()=>{n("trigger")},{deep:!0});const s=c.computed(()=>T.merge({},r,t.tableConfig)),n=e,o=c.computed({get:()=>t.modelValue??[],set:f=>{n("update:modelValue",f)}}),a=c.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>d(f)}]}}]),l=()=>{o.value=[...o.value,{}]},d=f=>{o.value=o.value.filter((g,m)=>m!==f)},u=c.computed(()=>{let f=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+f,f++),!0):!1)});return(f,g)=>{const m=c.resolveComponent("a-form-item-rest"),x=c.resolveComponent("a-table"),v=c.resolveComponent("a-button");return c.openBlock(),c.createElementBlock("div",null,[c.createVNode(x,c.mergeProps({"data-source":o.value},s.value,{columns:a.value.map(p=>c.unref(Pi)(p))}),c.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:p,record:w,index:E})=>[c.createVNode(m,null,{default:c.withCtx(()=>[u.value.some(C=>p.key&&C.field===p.key)?(c.openBlock(),c.createBlock(c.unref(Qa),{key:E,"row-index":E,"default-handler":{},column:u.value.find(C=>p.key&&C.field===p.key),row:w,"table-data":o.value},null,8,["row-index","column","row","table-data"])):c.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),c.createElementVNode("div",YC,[c.createVNode(v,{type:"primary",onClick:l},{default:c.withCtx(()=>[...g[0]||(g[0]=[c.createTextVNode("+添加",-1)])]),_:1})])])}}}),he=i=>{const{icon:e}=i,t=Rl;return t[e]?c.createVNode(t[e]):t[e]},Xt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())},ASelect:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())}},yi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},ja={$input:M.Input,AInput:M.Input,$textarea:M.Textarea,Textarea:M.Textarea,$number:M.InputNumber,AInputNumber:M.InputNumber,$select:M.Select,ASelect:M.Select,$date:M.DatePicker,ADatePicker:M.DatePicker,$range:M.RangePicker,ARangePicker:M.RangePicker,AAutoComplete:M.AutoComplete,$Cascader:M.Cascader,ACascader:M.Cascader,ACheckbox:M.Checkbox,AMentions:M.Mentions,ARate:M.Rate,ASlider:M.Slider,$time:M.TimePicker,ATimePicker:M.TimePicker,ATreeSelect:M.TreeSelect},WC=i=>{const e=ja[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:n},{data:o,field:a}){return ve(n)&&q(a)&&ht(o[a])&&(o[a]=n),a?c.createVNode(e,c.mergeProps({is:i,value:o[a],"onUpdate:value":l=>o[a]=l},r,T.merge({},Xt[i],t),{onChange:(...l)=>{var d;(d=s.change)==null||d.call(s,{data:o,field:a},...l)}}),null):c.createVNode(e,c.mergeProps({is:i},t),null)},renderDefault({props:t=Xt[i]??{},attrs:r={},events:s={},defaultValue:n},{data:o,row:a,field:l}){return ve(n)&&q(l)&&ht(a[l])&&(a[l]=n),l?c.createVNode(e,c.mergeProps({is:i,value:a[l],"onUpdate:value":d=>a[l]=d},r,T.merge({},Xt[i],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:o,row:a,field:l},...d)}}),null):c.createVNode(e,c.mergeProps({is:i},t),null)},renderEdit(t,{props:r=Xt[i]??{},attrs:s={},events:n={}},o,a){return c.createVNode(e,c.mergeProps({is:i,value:t.value,"onUpdate:value":l=>t.value=l},s,T.merge({},Xt[i],r),{onBlur:(...l)=>{var d;a==null||a("blur",t.value),(d=n.blur)==null||d.call(n,o,...l)}}),null)}}},el=(i,e,t)=>{var r,s;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(n=>{var o;return!((o=n.hiddenIf)!=null&&o.call(n,e))}).length>0?c.createVNode(M.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var n;return c.createVNode(M.Button,c.mergeProps(T.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):c.createVNode(he,{icon:"DownOutlined"},null)},((n=i.getProps)==null?void 0:n.call(i,e))??{}),{default:()=>{var o;return[i.content||(((o=i==null?void 0:i.getContent)==null?void 0:o.call(i,e))??"")]}})},overlay:()=>{var n;return c.createVNode("div",{class:`dropdown-wrapper ${((n=i==null?void 0:i.dynamicClassName)==null?void 0:n.call(i,e))??""}`},[i.dropdowns.filter(o=>{var a;return!((a=o.hiddenIf)!=null&&a.call(o,e))}).map(o=>el(o,e,t))])}}):c.createVNode(M.Button,c.mergeProps({class:((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))||""},T.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?c.createVNode(he,{icon:i.icon},null):null},((s=i.getProps)==null?void 0:s.call(i,e))??{},{onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var n;return[i.content||(((n=i==null?void 0:i.getContent)==null?void 0:n.call(i,e))??"")]}})},gr={...Object.fromEntries(Object.keys(ja).map(i=>[i,WC(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return c.createVNode(M.Button,c.mergeProps(T.omit(i,["content"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):null,onClick:()=>{var n;(n=e.click)==null||n.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(o=>{s.reset(o?{data:o,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var n;return[i.content,((n=i.suffix)==null?void 0:n.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return c.createVNode(M.Button,c.mergeProps(T.omit(i,["content"]),{icon:i.icon?c.createVNode(he,{icon:i.icon},null):null,onClick:()=>{var n,o,a;(n=e.click)==null||n.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((o=s==null?void 0:s.setLoadings)==null||o.call(s,!0),i.beforeClick({row:t,field:r}).then(l=>{s.reset(l?{row:l,field:r}:{row:t,field:r})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(l=>{s.pick(l?{row:l,field:r}:{row:t,field:r})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.map(n=>c.createVNode(M.Button,c.mergeProps(T.omit(Object.assign({},i,n.props),["content"]),{icon:n.props.icon?c.createVNode(he,{icon:n.props.icon},null):null,onClick:()=>{var o,a;(a=(o=n.events)==null?void 0:o.click)==null||a.call(o,{data:t,field:r}),n.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(l=>{s.reset(l?{data:l,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),n.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(l=>{s.pick(l?{data:l,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[n.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},n){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(o=>{var a,l;return!((l=(a=o==null?void 0:o.props)==null?void 0:a.hiddenIf)!=null&&l.call(a,{data:t,row:r,field:s}))}).map(o=>c.createVNode(M.Button,c.mergeProps(T.omit(Object.assign({},i,o.props),["content","hiddenIf"]),{icon:o.props.icon?c.createVNode(he,{icon:o.props.icon},null):null,onClick:()=>{var a,l,d,u;(l=(a=o.events)==null?void 0:a.click)==null||l.call(a,{data:t,row:r,field:s}),o.props.htmlType==="reset"&&(n!=null&&n.reset)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((d=n==null?void 0:n.setLoadings)==null||d.call(n,!0),i.beforeClick({row:r,field:s}).then(f=>{n.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=n==null?void 0:n.setLoadings)==null||f.call(n,!1)})):n.reset({row:r,field:s})),o.props.htmlType==="pick"&&(n!=null&&n.pick)&&(i.beforeClick&&T.isFunction(i.beforeClick)?((u=n==null?void 0:n.setLoadings)==null||u.call(n,!0),i.beforeClick({row:r,field:s}).then(f=>{n.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=n==null?void 0:n.setLoadings)==null||f.call(n,!1)})):n.pick({row:r,field:s}))}}),{default:()=>[o.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){const r=c.ref(null);return c.createVNode("span",{ref:r,class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(s=>{var n;return!((n=s.hiddenIf)!=null&&n.call(s,t))}).map(s=>el(s,t,()=>{var n,o,a,l;return((l=(a=(o=(n=r.value)==null?void 0:n.parentElement)==null?void 0:o.parentElement)==null?void 0:a.parentElement)==null?void 0:l.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t,defaultValue:r},{data:s,field:n}){return ve(r)&&q(n)&&ht(s[n])&&(s[n]=r),q(n)?c.createVNode(M.RadioGroup,c.mergeProps({value:s[n],"onUpdate:value":o=>s[n]=o},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...o)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:n},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?c.createVNode(M.RadioGroup,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?c.createVNode(M.AutoComplete,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:yi.autoComplete.filterOption},i),{onChange:(...s)=>{var n;(n=e.change)==null||n.call(e,{data:t,field:r},...s)}}),{default:()=>c.createVNode(c.resolveComponent("a-input"),Object.assign({},yi.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={},defaultValue:t},{data:r,field:s}){return ve(t)&&q(s)&&ht(r[s])&&(r[s]=t),q(s)?c.createVNode(M.Switch,c.mergeProps({checked:r[s],"onUpdate:checked":n=>r[s]=n},i,{onChange:(...n)=>{var o;(o=e.change)==null||o.call(e,{data:r,field:s},...n)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={},defaultValue:r},{data:s,field:n}){return ve(r)&&q(n)&&ht(s[n])&&(s[n]=r),q(n)?c.createVNode(M.CheckboxGroup,c.mergeProps({value:s[n],"onUpdate:value":o=>s[n]=o},i,{options:i.options??e??[],onChange:(...o)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:n},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?c.createVNode(M.CheckboxGroup,c.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$paragraph:{renderDefault({props:i={}},{row:e,field:t}){var n;const r={ellipsis:{expandable:!0,rows:3}},s=((n=i.getContent)==null?void 0:n.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?c.createVNode(M.TypographyParagraph,c.mergeProps(T.merge({},r,T.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?c.createVNode(VC,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&T.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={},defaultValue:t},{data:r,field:s}){const n=i.parse?100:1;if(q(s)){ve(t)&&ht(r[s])&&(r[s]=t);const o=c.computed({get:()=>(r[s]??0)*n,set:a=>{r[s]=(a??0)/n}});return c.createVNode("div",{class:"flex items-center"},[i.info?c.createVNode("span",{class:"pr-4"},[i.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":a=>o.value=a},T.merge({},yi.PercentInput,T.omit(i,["info"]))),null)])}else return null},renderDefault({props:i={},attrs:e={}},{row:t,field:r}){const s=i.parse?100:1;if(q(r)){const n=c.computed({get:()=>(t[r]??0)*s,set:o=>{T.set(t,r,(o??0)/s)}});return[i.info?c.createVNode("span",{class:"pr-4"},[i.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":o=>n.value=o},T.merge({},yi.PercentInput,T.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?c.createVNode(M.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},Nr=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{gr.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),gr[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},Gt={renders:gr,addRender:Nr},XC=c.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=c.toRefs(i),n=a=>{e("trigger",a)},o=(a,l)=>{e("delayTrigger",a,l)};return()=>{var a,l;return((l=(a=Gt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:l.call(a,{...t,handleTrigger:n,handleDelayTrigger:o},s.value,r))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),zC=c.defineComponent(i=>{const{formData:e}=c.toRefs(i);return()=>{var t,r;return((r=(t=i.item.slots)==null?void 0:t.default)==null?void 0:r.call(t,{data:e.value,field:i.item.field},i.passTrigger,i.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),GC={key:2},Br=c.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=c.ref(!1),n=c.ref(Fe()),o=(g,m)=>{const x=m??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",g)},x)},a=g=>{r("trigger",g)},l=()=>{r("reset")},d=()=>{n.value=Fe()},u=T.debounce(d,100),f=c.computed(()=>{if(!t.item.tooltipConfig)return null;const g=t.item.tooltipConfig,m=Ua(),x=()=>c.h(Zt.InfoCircleOutlined,{class:"cursor-pointer py-4 px-2"}),v=T.isFunction(g.title)?g.title:String(g.title??"");return m?()=>m(x,v):()=>T.isFunction(g.title)?c.h(M.Tooltip,T.omit(g,["title"]),{default:x,title:()=>c.h("div",{innerHTML:g.title()})}):c.h(M.Tooltip,g,{default:x})});return Ar(()=>t.item,(g,m)=>{T.isEqual(g,m)||u()},{deep:!0}),(g,m)=>{const x=c.resolveComponent("a-form-item"),v=c.resolveComponent("a-col");return c.openBlock(),c.createBlock(v,c.mergeProps({key:`_col_${n.value}`},i.item.col??(i.item.span?{span:i.item.span}:c.unref($r))),{default:c.withCtx(()=>{var p;return[(c.openBlock(),c.createBlock(x,c.mergeProps({key:`_item_${n.value}`,class:[`p-content-align-${i.item.align??"left"} ${i.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:i.item.title,name:i.item.field,"wrapper-col":i.item.wrapperCol??(i.item.title?void 0:{span:24})},c.unref(T.omit)(i.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),c.createSlots({default:c.withCtx(()=>{var w,E;return[(w=i.item.slots)!=null&&w.default?(c.openBlock(),c.createBlock(c.unref(zC),{key:`_sl_${i.item.field??"_"}_${n.value}`,"form-data":i.formData,item:i.item,"pass-delay-trigger":o,"pass-trigger":a},null,8,["form-data","item"])):(E=i.item.itemRender)!=null&&E.name?(c.openBlock(),c.createBlock(c.unref(XC),{key:`_re_${i.item.field??"_"}_${n.value}`,"default-handler":{reset:l},"item-render":i.item.itemRender,"render-form-params":{data:i.formData,field:i.item.field},onDelayTrigger:o,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(c.openBlock(),c.createElementBlock("span",GC))]}),_:2},[(p=i.item.slots)!=null&&p.title?{name:"label",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(i.item.slots.title)))]),key:"0"}:void 0,f.value?{name:"tooltip",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(f.value)))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),UC={key:0,class:"p-pane p-wrapper"},Hr=c.defineComponent({__name:"PForm",props:{name:{},items:{},customReset:{},layout:{},labelCol:{default:()=>Ln().labelCol??{span:6}},wrapperCol:{default:()=>Ln().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(i,{expose:e,emit:t}){const r=i,s=t,{items:n,data:o}=c.toRefs(r);function a(){s("apply",o.value)}const l=c.ref(),d=c.ref(Fe()),u=()=>{d.value=Fe()},f=()=>{if(r.customReset)r.customReset();else{const v={};zt(n.value,p=>{p.field&&p.itemRender?ve(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ve(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(o.value,v)}s("reset")},g=c.computed(()=>({...T.omit(r,["items","data","model","labelCol","wrapperCol"]),labelCol:r.labelCol,wrapperCol:r.wrapperCol})),m=v=>{var p;v&&((p=l.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:u,$form:c.computed(()=>l.value)}),(v,p)=>c.unref(n).some(w=>{var E;return w.field&&w.itemRender||((E=w.slots)==null?void 0:E.default)})?(c.openBlock(),c.createElementBlock("div",UC,[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({name:i.name,key:d.value,ref_key:"formEl",ref:l,model:c.unref(o)},g.value,{onSubmit:a}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(n),(w,E)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${w.field||E}`,"form-data":c.unref(o),item:w,onReset:f,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))])):c.createCommentVNode("",!0)}}),qC=c.defineComponent(i=>{const{column:e}=i;return()=>{var t,r;return((r=(t=e.slots)==null?void 0:t.title)==null?void 0:r.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),tl=({title:i,content:e})=>new Promise((t,r)=>{M.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),ZC=M.message.success,JC=M.message.error;M.message.info;const Ii=M.message.warning,QC={key:0},jC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},eb={class:"flex items-center flex-1 gap-4px"},tb={key:2},ib={class:"flex items-center gap-4px"},rb={key:0,class:"w-full text-slate-5 pl-4"},Fr=c.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>It().striped??!1},manualFetch:{type:Boolean},align:{default:()=>It().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>It().lazyReset??!1},fitHeight:{default:()=>It().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var ze,Kt,F,pe,Re;const r=i,{formConfig:s,pageConfig:n,columns:o,toolbarConfig:a,proxyConfig:l,tableConfig:d,selectConfig:u,scrollMode:f}=c.toRefs(r),g=c.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{T.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):T.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=c.ref(),v=c.ref(),p=c.ref(),w=c.ref(500),E=c.ref([]),C=c.ref([]),b=k=>{const{ajax:N}=l.value;switch(k){case"multiDelete":N.multiDelete&&(E.value.length>0?tl({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(E.value).then(()=>{M.message.success("删除成功"),Et()}).catch(()=>{M.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,R.multiDelete=!1})}):M.message.warn("请选择要删除的数据"));break}},_=c.computed(()=>{const k=[];return zt(o.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),B=c.ref(),K=c.ref(),S=c.ref(Fe()),I=c.ref(Fe()),R=c.reactive([...(((Kt=(ze=r.toolbarConfig)==null?void 0:ze.buttons)==null?void 0:Kt.map(k=>k.code))??[]).filter(k=>k),...(((pe=(F=r.toolbarConfig)==null?void 0:F.tools)==null?void 0:pe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),O=(k,N)=>{R[k]=N},y=()=>{I.value=Fe()},A=T.debounce(y,100),L=c.computed(()=>{const k=[];return zt(o.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),P=c.reactive({page:1,size:((Re=n.value)==null?void 0:Re.pageSize)??10}),Y=c.ref(0),V=c.ref(0),W=c.ref([]),z=c.computed(()=>l.value&&l.value.ajax?n.value?"pagination":"list":"bad"),j=c.useAttrs(),ne=t,Ve=c.computed(()=>C.value.filter(k=>E.value.includes(k[r.rowKey??"id"]))),be=k=>{ne("toolbarButtonClick",{data:W.value,code:k,selectedKeys:E.value,records:Ve.value}),b(k)},Ae=T.debounce(be,100),ee=({key:k})=>Ae(k),Xi=k=>{ne("toolbarToolClick",{data:W.value,code:k,selectedKeys:E.value,records:Ve.value}),b(k)},zi=T.debounce(Xi,100),me=c.ref({}),Gi=({row:k,field:N})=>{ne("pick",{row:k,field:N})},nt=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};zt(s.value.items,U=>{U.field&&U.itemRender?ve(U.itemRender.defaultValue)?N[U.field]=U.itemRender.defaultValue:N[U.field]=void 0:U.field&&U.slots&&(ve(U.slots.defaultValue)?N[U.field]=U.slots.defaultValue:N[U.field]=void 0)}),me.value=N}ne("resetQuery")}P.page=1,k||Ct()},wt=(k,N)=>N?{list:T.isString(N.list)?T.get(k,N.list):T.isFunction(N.list)?N.list(k):void 0,total:T.isString(N.total)?T.get(k,N.total):T.isFunction(N.total)?N.total(k):void 0,result:T.isString(N.result)?T.get(k,N.result):T.isFunction(N.result)?N.result(k):void 0,message:T.isString(N.message)?T.get(k,N.message):T.isFunction(N.message)?N.message(k):void 0}:{list:k},oi=c.ref(!0),Ui=()=>(C.value=[],E.value=[],nt()),Et=()=>(P.page=1,C.value=[],E.value=[],ot()),qi=(k,N,U)=>(P.page=k.current,P.size=k.pageSize,ot()),ot=()=>new Promise(k=>{if(z.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=l.value;N.query({form:me.value,page:P}).then(U=>{const{list:Ge,total:Pt,result:oe,message:lt}=wt(U,l.value.response);Ge?(W.value=Ge,Y.value++):oe?(W.value=oe,V.value=Pt??oe.length,Y.value++):(W.value=[],Y.value++,lt&&M.message.warn(lt)),k(W.value)}).catch(U=>{console.error("fetchData error",U),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),Ct=T.debounce(ot,160),We=(k,N)=>(Object.assign(me.value,k),P.page=1,N?Promise.resolve():Ct()),Ne=(k,N)=>(me.value=k,P.page=1,N?Promise.resolve():Ct()),xe=c.computed(()=>z.value==="pagination"?{current:P.page,total:V.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Ht={size:"small",sticky:!0,transformCellText:({text:k})=>T.isArray(k)&&k.length===0?"-":k},at=c.computed(()=>T.merge({},Ht,(d==null?void 0:d.value)??{},u.value?{rowSelection:{type:u.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:E.value,onChange:k=>{E.value=k;const N=r.rowKey??"id",U=C.value.map(oe=>oe[N]),Pt=k.filter(oe=>!U.includes(oe)).map(oe=>W.value.find(lt=>lt[N]===oe)).filter(oe=>!!oe);C.value=[...C.value,...Pt]},getCheckboxProps:u.value.getCheckboxProps}}:{})),ai=c.computed(()=>T.omit({labelCol:Mr,...s.value},["items"])),li=()=>{Et()};c.watch(()=>[o.value,l.value,a.value],()=>{A()},{deep:!0});let Be=null;const _e=()=>{Be&&cancelAnimationFrame(Be),Be=requestAnimationFrame(()=>{if(Be=null,!p.value)return;const k=p.value.getBoundingClientRect();w.value=r.renderY??Math.max(window.innerHeight-k.top-r.fitHeight,100),oi.value=window.innerHeight>600})};let fe=null;c.watch(v,k=>{fe==null||fe.disconnect(),fe=null,k&&(fe=new ResizeObserver(()=>_e()),fe.observe(k))},{immediate:!0}),e({commitProxy:{query:Ct,reload:Ui,reloadPage:Et,passQuery:We,forcePassQuery:Ne},$table:c.computed(()=>K.value),selectedRowKeys:c.computed(()=>E.value),setBtnLoading:O,selectedRecords:Ve,$form:c.computed(()=>B.value),getFormData:()=>me.value,setLoadings:m,resizeTable:_e});let D,H=null;c.onMounted(()=>{if(_e(),window.addEventListener("resize",_e),D=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const U=N.target;window.getComputedStyle(U).display!=="none"&&_e()}})}),x.value){D.observe(x.value,{attributes:!0,attributeFilter:["style"]}),H=new ResizeObserver(()=>_e());let k=x.value.parentElement;for(let N=0;N<5&&k&&k!==document.body;N++)H.observe(k),k=k.parentElement}nt(r.manualFetch)});const X=k=>T.isFunction(k)?k():k,He=k=>T.isString(k),Ft=["align"],Xe=k=>k.map(N=>({...Ft.reduce((U,Ge)=>({[Ge]:r[Ge]}),{}),...N}));return c.onBeforeUnmount(()=>{Be&&cancelAnimationFrame(Be),window.removeEventListener("resize",_e),D.disconnect(),fe==null||fe.disconnect(),H==null||H.disconnect()}),(k,N)=>{var oe,lt,Qr;const U=c.resolveComponent("a-menu-item"),Ge=c.resolveComponent("a-menu"),Pt=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(j)),[z.value==="bad"?(c.openBlock(),c.createElementBlock("div",QC,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(lt=(oe=c.unref(s))==null?void 0:oe.items)!=null&&lt.some($=>$.field&&$.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[c.createVNode(c.unref(M.Spin),{spinning:g.form},{default:c.withCtx(()=>{var $;return[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({name:($=c.unref(s))==null?void 0:$.name,key:S.value,ref_key:"formEl",ref:B,model:me.value},ai.value,{onSubmit:li}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s).items,(ae,ge)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${ae.field||ge}`,"form-data":me.value,item:ae,onReset:N[0]||(N[0]=ci=>nt(r.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["name","model"]))]}),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(a)?(c.openBlock(),c.createElementBlock("div",jC,[c.createElementVNode("div",eb,[c.unref(a).buttons&&c.unref(a).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).buttons,($,ae)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:ae},[$.dropdowns&&$.dropdowns.length?(c.openBlock(),c.createBlock(Pt,{key:0},{overlay:c.withCtx(()=>[c.createVNode(Ge,{onClick:ee},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList($.dropdowns,ge=>(c.openBlock(),c.createBlock(U,{key:ge.code},{default:c.withCtx(()=>[ge.content&&He(X(ge.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:0},[c.createTextVNode(c.toDisplayString(X(ge.content)),1)],64)):ge.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X(ge.content)),{key:1})):c.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&R[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0),c.createVNode(c.unref(Zt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):$.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,loading:g.toolbar||!!$.code&&R[$.code],danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ge=>c.unref(Ae)($.code)},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",tb))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",ib,[c.unref(a).tools&&c.unref(a).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).tools,($,ae)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:ae,type:$.type,size:$.size??"middle",disabled:c.unref(a).disabled||$.disabled,danger:$.danger,shape:$.shape,ghost:$.ghost,block:$.block,onClick:ge=>c.unref(zi)($.code),loading:g.toolbar||!!$.code&&R[$.code]},{default:c.withCtx(()=>[$.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:$.icon},null,8,["icon"])):c.createCommentVNode("",!0),$.content&&He(X($.content))?(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[c.createTextVNode(c.toDisplayString(X($.content)),1)],64)):$.content?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(X($.content)),{key:2})):c.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"tableWrapperEl",ref:p,class:c.normalizeClass(`p-pane flex-1 ${oi.value?"h-0":""} p-${c.unref(f)??"inner"}-scroll`)},[(Qr=c.unref(u))!=null&&Qr.multiple&&c.unref(u).showCount?(c.openBlock(),c.createElementBlock("div",rb," 已选:"+c.toDisplayString(E.value.length),1)):c.createCommentVNode("",!0),(c.openBlock(),c.createBlock(c.unref(M.Table),c.mergeProps({key:I.value+"_table","row-key":i.rowKey??"id",ref_key:"tableEl",ref:K,"row-class-name":i.striped?($,ae)=>ae%2===1?"p-grid-row-striped":"":"",columns:Xe(c.unref(o)??[]).map($=>c.unref(Pi)($)),"data-source":W.value,loading:g.table,pagination:xe.value},at.value,{scroll:{x:"max-content",y:w.value},onChange:qi}),c.createSlots({_:2},[_.value.length>0?{name:"headerCell",fn:c.withCtx(({column:$})=>[_.value.some(ae=>$.key&&ae.field===$.key)?(c.openBlock(),c.createBlock(c.unref(qC),{key:I.value+"_title_"+Y.value+"_slot_"+$.key,column:_.value.find(ae=>$.key&&ae.field===$.key)},null,8,["column"])):c.createCommentVNode("",!0)]),key:"0"}:void 0,L.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:$,record:ae,index:ge})=>[L.value.some(ci=>$.key&&ci.field===$.key)?(c.openBlock(),c.createBlock(c.unref(Qa),{key:I.value+"_cell_"+Y.value+"_slot_"+$.key,column:L.value.find(ci=>$.key&&ci.field===$.key),"default-handler":{pick:Gi,setLoadings:m},row:ae,"row-index":ge,"table-data":W.value},null,8,["column","default-handler","row","row-index","table-data"])):c.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var sb=Object.defineProperty,nb=(i,e,t)=>e in i?sb(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>nb(i,typeof e!="symbol"?e+"":e,t);class ob{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,value:d,field:u,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:u,fieldValue:f,value:d,column:r,colIndex:a,rowIndex:l,row:s,key:n,rowKey:o,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,field:u,fieldValue:f,message:g.message||`${n} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:r,row:s,key:n,rowKey:o,colIndex:a,rowIndex:l,field:u,fieldValue:f,message:g.message||`${n} is required`})}return t}}function il(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function Kr(i,e){let t=0,r;return function(...s){const n=new Date().getTime(),o=n-t,a=typeof e=="function"?e():e;!t||o>=a?(i.apply(this,s),t=n):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},a-o))}}function Ei(i=[]){return i.length?i.map(e=>Ei(e.children)+1).sort((e,t)=>t-e)[0]:0}function ab(i=[]){let e=[],t=[],r=[];return i.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?r.push(s):t.push(s)}),[...e.sort((s,n)=>(s.sort??0)-(n.sort??0)),...t.sort((s,n)=>(s.sort??0)-(n.sort??0)),...r.sort((s,n)=>(s.sort??0)-(n.sort??0))]}function Ci(i=[],e=1,t=0,r=""){return i.sort((s,n)=>(s.sort??0)-(n.sort??0)).map(s=>{if(s.children){let n=0,o=s.fixed;s.children.forEach(l=>{l.fixed=o});const a=Ci(s.children,e-1,t+1,s.key);return a&&a.forEach(l=>{n+=l.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:n,parentKey:r,children:a.sort((l,d)=>(l.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:r}})}function Ut(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(Ut(t.children)):e.push(t)}),e}function rl(i){return i.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:rl(e.children)}:{...e})}const Mn=/^(\r\n|\n\r|\r|\n)/,lb=/^[^\t\r\n]+/,An=/^\t/;function cb(i){let e=[[""]];if(i.length===0)return e;let t=0,r=0,s;for(;i.length>0&&s!==i.length;)if(s=i.length,i.match(An))i=i.replace(An,""),t+=1,e[r][t]="";else if(i.match(Mn))i=i.replace(Mn,""),t=0,r+=1,e[r]=[""];else{let n="";if(i.startsWith('"')){let o=0,a=!0;for(;a;){const l=i.slice(0,1);l==='"'&&(o+=1),n+=l,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&o%2===0)&&(a=!1)}n=n.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,l=>new Array(Math.floor(l.length/2)).fill('"').join(""))}else{const o=i.match(lb);n=o?o[0]:"",i=i.slice(n.length)}e[r][t]=n}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function hb(i){let e,t,r,s,n="",o;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(n+=" "),o=i[e][r],typeof o=="string"?o.indexOf(`
2
- `)>-1?n+=`"${o.replace(/"/g,'""')}"`:n+=o:o==null?n+="":n+=o;e!==t-1&&(n+=`
3
- `)}return n}function sl(i,e,t=[]){let r=0;const s=[];return i.forEach((n,o)=>{if(o===0)s.push(1);else{const a=t.reduce((d,u)=>`${d}${n[u]??""}`,"")||n[e],l=t.reduce((d,u)=>`${d}${i[o-1][u]??""}`,"")||i[o-1][e];a===l?(s[r]+=1,s.push(0)):(s.push(1),r=o)}}),s}function nl(i,e){let t="",r="";const s={};return e.forEach((n,o)=>{o===0?(t=n.key,r=n.key,s[n.key]=1):i[n.key]===i[t]?(s[n.key]=0,s[r]+=1):(s[n.key]=1,t=n.key,r=n.key)}),s}function db(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:n}=i,o=sl(r,e,t);return o[s-n]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:o[s-n],colspan:1,relationRowKeys:t,mergeRow:!0}}function ub(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,n=s.filter(o=>e.includes(o.key));if(e.includes(t.key)){const o=nl(r,n);return o[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:o[t.key],relationColKeys:e,mergeCol:!0}}}function fb(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}function Nn(i){if(!i)return new Date(0);if(typeof i=="number")return new Date(i);const e=String(i).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const r=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of r){const n=e.match(s);if(n){const o=n.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(a,l-1,d,u,f,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(d,l-1,a,u,f,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,l,d,u=0,f=0,g=0]=o;return new Date(d,a-1,l,u,f,g)}else if(s.source.includes("YYYYMMDD")){const[a,l,d]=o;return new Date(a,l-1,d)}}}return new Date(NaN)}function gb(i,e){const t=Nn(i),r=Nn(e);return isNaN(t.getTime())&&isNaN(r.getTime())?0:isNaN(t.getTime())?-1:isNaN(r.getTime())?1:t.getTime()-r.getTime()}class ol{constructor(e,t,r,s,n,o,a){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=r,this.width=s,this.height=n,this.fixed=a,this.cellType=o}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,n=e;return!(this.x+this.width-t-r<=0||this.x-r>=n-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,r=e;return!(this.y+this.height-t<=0||this.y-t>=r)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Pr extends ol{constructor(e,t,r,s,n,o,a,l,d,u="body",f=!0){super(e,s,n,o,a,u,l.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=r,this.rowIndex=t,this.key=l.key,this.type=l.type||"",this.editorType=l.editorType||"text",this.selectorCellValueType=l.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=l.editorProps||{},this.cellType=u,this.align=l.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=l.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=l.fixed||"",this.level=l.level||0,this.operation=l.operation||!1,this.column=l,this.rules=l.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=l.render,this.overflowTooltipShow=l.overflowTooltipShow!==!1,this.autoRowHeight=l.autoRowHeight!==void 0?l.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=l.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=l.overflowTooltipPlacement||"top",this.renderFooter=l.renderFooter,this.hoverIconName=l.hoverIconName,this.formatter=l.formatter,this.formatterFooter=l.formatterFooter,this.maxLineClamp=l.maxLineClamp||"auto",f&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:r=1,rowspan:s=1,relationRowKeys:n,relationColKeys:o,mergeRow:a=!1,mergeCol:l=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(n)&&n.length>0?this.relationRowKeys=n:this.relationRowKeys=[this.key],Array.isArray(o)&&o.length>0?this.relationColKeys=o:this.relationColKeys=[this.key],this.mergeCol=l,this.mergeRow=a,this.colspan=r,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:r,props:s={}}=t;this.editorType=r,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,n=0,o="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&r==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:l=!1,hasChildren:d=!1,expandLoading:u=!1,level:f=0}=a||{};this.rowExpand=l,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(n=f*g,u){const _=this.ctx.icons.get("loading");o="loading",s=_}else if(d){const _=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=l?B:_,o=l?"shrink":"expand"}let v=x,p=x,w=this.drawX;(this.align==="center"||this.align==="right")&&(w=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let E=w+n+e,C=this.drawY+(this.visibleHeight-p)/2,b=n+this.drawX+v-.5;this.type==="selection-tree"?(E=n+this.drawSelectionImageX+this.drawSelectionImageWidth,b=E+v-e/2):this.type==="tree-selection"?b=E+m+v-e/2:b=E+v-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(E+v+e>this.drawX+this.visibleWidth)&&(C+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=E,this.drawTreeImageY=C,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=o,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:r=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const n=this.ctx.database.getRowForRowKey(this.rowKey)||{},o=n.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,l=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-o*t;const u=Array.isArray(n.parentRowKeys)?n.parentRowKeys:[];if(o>0){for(let x=0;x<o-1;x+=1){const v=u[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(o-x)*t+r/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const f=Math.round(this.drawTreeImageX-t+r/2),g=n.isLastChild?l:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([f,this.drawY,f,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(o-1)*t+r/2);this.ctx.paint.drawLine([m,l,a,l],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(n.hasChildren&&n.expand){const f=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,f,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:n,BODY_TEXT_COLOR:o,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:l,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:u,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let R=l,O=a;if(typeof s=="function"){const y=s,{backgroundColor:A,color:L,font:P}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};A&&(R=A),L&&(O=L),P&&(this.drawTextFont=P)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=R,this.drawTextColor=O;return}let p="transparent";const w=this.ctx.hoverCell,E=this.ctx.currentCell;let C=this.rowIndex,b=this.rowIndex;if(this.rowspan!==1&&(f||d)){const R=this.getSpanInfo(),{yArr:O}=R;C=O[0],b=O[1]}f&&w&&(w.rowKey===this.rowKey&&(p=g),w.rowIndex>=C&&w.rowIndex<=b&&(p=g)),d&&E&&(E.rowKey===this.rowKey&&(p=u),E.rowIndex>=C&&E.rowIndex<=b&&(p=u)),this.drawCellSkyBgColor=p;let _=e,B=o;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(_=t,B=n),m&&(this.rowIndex%2?_=x:_=e),typeof r=="function"){const R=r,{backgroundColor:O,color:y,font:A}=R({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(_=O),y&&(B=y),A&&(this.drawTextFont=A)}const{rowIndex:K,colIndex:S,type:I}=this.ctx.finderBar;K===this.rowIndex&&S===this.colIndex&&I==="body"&&(_=v),this.drawCellBgColor=_,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:n,type:o,rowIndex:a,rowKey:l}=this;if(r===0||s===0||n==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(o))return;const d=this.ctx.database.getRowSelectable(l),{CHECKBOX_SIZE:u=0,CELL_PADDING:f}=this.ctx.config;let g=this.drawX+f;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-u)/2);let m=g,x=this.drawY+(t-u)/2;if(o!=="selection-tree"&&o==="tree-selection"){const{TREE_INDENT:w=16,TREE_ICON_SIZE:E}=this.ctx.config,C=this.ctx.database.getRowForRowKey(l),{level:b=0}=C||{},_=b*w;m=g+E+_}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(o==="selection-tree"||o==="tree-selection"){const w=this.ctx.database.getTreeSelectionState(l);w.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):w.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!w.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const w=this.ctx.database.getRowSelection(l);w&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):w&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!w&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+u+f>this.drawX+this.visibleWidth||x+u+f>this.drawY+this.visibleHeight||(o==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:r,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const o=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});o!==void 0&&(this.hoverIconName=o)}const{hoverCell:n}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&n){let o=0,a=0;if(n.rowKey===this.rowKey&&(o=this.drawX+this.width-t-r,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:u}=d,f=u[0],g=u[1];if(n.rowIndex>=f&&n.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;o=this.drawX-p+m-t-r,a=this.drawY-v+(x-t)/2}}const l=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=o,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=l}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const o=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:r}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,n=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:r,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const s=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(s<this.visibleHeight&&s>0){const n=(this.visibleHeight-s)/2;t=t+n}}this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999);let r={};return this.rowspan===0&&(r={display:"none"}),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none",...r}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:n}=this;e.drawRect(s,n,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,n,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,n+this.visibleHeight,s+this.visibleWidth,n+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:r,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!r||!t||this.ctx.editing)return;const{xArr:n,yArr:o}=this.ctx.selector,a=n[1],l=o[1],{colIndex:d,rowIndex:u,drawX:f,drawY:g}=this;if(d===a&&u===l){const m=d===this.ctx.maxColIndex||u===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let r=0;for(let s=e;s<e+t;s++){const n=this.ctx.header.leafCellHeaders[s];r+=n.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:n}=this.column;let o=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&n&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(o=n,a=r),["",null,void 0].includes(o))return!1;typeof o!="string"&&(o=`${o}`);const l=`${o}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(o,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:l}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:r,xArrCopy:s,yArrCopy:n}=this.ctx.selector;this.drawBorder({xArr:s,yArr:n,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:r,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[o,a]=t,[l,d]=r;!(o===a&&l===d)&&this.colIndex>=o&&this.colIndex<=a&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:r}=this,s=this.drawX,n=this.drawY,o=[s+r-e-.5,n,s+r-.5,n,s+r-.5,n+e];this.ctx.paint.drawLine(o,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:n,height:o,width:a}=this;let l=t,d=r;const{xArr:u,yArr:f,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=u[0],w=u[1],E=f[0],C=f[1];if(n>=p&&n<=w&&s===E){const b=n===w?1:0,_=n===p?1:0;this.ctx.paint.drawLine([l+_,d+1,l+a-b,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n===w&&s>=E&&s<=C){const b=s===E?1:0,_=s===C?1:0;this.ctx.paint.drawLine([l+a-1,d+b,l+a-1,d+o-_],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n>=p&&n<=w&&s===C){const b=n===w?1:0,_=n===p?1:0;this.ctx.paint.drawLine([l+_,d+o-1,l+a-b,d+o-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(n===p&&s>=E&&s<=C){const b=s===C?1:0,_=s===E?1:0;this.ctx.paint.drawLine([l+1,d+_,l+1,d+o-b],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class vb{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:r=[],columns:s=[],footerData:n=[]}=t;this.data=r,this.footerData=n,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),r=Ut(t);if(this.ctx.hasSelection=r.some(s=>s.type==="selection"),this.ctx.hasTree=r.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,r=[]){const s=e.length,{ROW_KEY:n="",DEFAULT_EXPAND_ALL:o,CELL_HEIGHT:a,SELECTABLE_METHOD:l,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:u}=this.ctx.config;e.forEach((f,g)=>{var m;u!=="children"&&(f.children=f[u]);const x=f[n],v=x!=null?`${x}`:il();this.itemRowKeyMap.set(f,v);const p=f._height||a,w=f._readonly;let E=!0;if(typeof l=="function"&&(E=l),d){const b=f[d];if(this.checkboxKeyMap.has(b)){const _=this.checkboxKeyMap.get(b)||[];_.push(v),this.checkboxKeyMap.set(b,_)}else this.checkboxKeyMap.set(b,[v])}this.selectionMap.set(v,{key:d?f[d]:v,row:f,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const C=o||this.expandMap.get(v)||f._expand||!1;this.expandMap.set(v,C),this.rowKeyMap.set(v,{readonly:w,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:E,expand:C,expandLazy:!1,hasChildren:f._hasChildren||(Array.isArray(f.children)?f.children.length>0:!1),expandLoading:!1,item:f,parentRowKeys:r,parentRowKey:r[r.length-1]||"",isLastChild:g===s-1}),Array.isArray(f.children)&&f.children.length&&this.initData(f.children,t+1,[...r,v])})}setRowHeight(e,t){const r=this.rowIndexRowKeyMap.get(e);if(r===void 0)return;const s=this.rowKeyMap.get(r);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const n=this.rowKeyMap.get(s);n.height=r,n.item._height=r}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:r})=>this.getPositionForRowIndex(r).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const n=this.rowKeyMap.get(s),{height:o=-1}=this.getMaxRowHeightItem(s)||{};n.calculatedHeight=Math.max(r,o)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=r=>r.map(s=>{var n,o,a,l,d,u,f,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(o=(n=this.customHeader)==null?void 0:n.hideData)==null?void 0:o[s.key],fixed:(l=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:l[s.key],sort:(u=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:u[s.key],width:(g=(f=this.customHeader)==null?void 0:f.resizableData)==null?void 0:g[s.key]},v={};for(const[w,E]of Object.entries(x))E!==void 0&&(v[w]=E);const p=m&&m.every(w=>w.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const r=n=>{n.forEach(o=>{e.push(o);const a=this.itemRowKeyMap.get(o),{expand:l,hasChildren:d,height:u,calculatedHeight:f}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(f,u);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:f}),t+=1,l&&d&&r(o.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const n=Array.from(this.sortState.entries()).sort((o,a)=>o[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,n)}return r(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const r=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:r}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let r=[...e];for(const[s,{direction:n}]of t){if(n==="none")continue;const o=this.getColumnByKey(s);!o||!o.column.sortBy||(r=this.applySingleColumnSort(r,s,n,o.column.sortBy))}return r.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,r,s){return e.sort((n,o)=>{const a=n[t],l=o[t];let d=0;if(typeof s=="function")d=s(n,o);else if(s==="number"){const u=Number(a)||0,f=Number(l)||0;d=u-f}else if(s==="string"){const u=String(a||""),f=String(l||"");d=u.localeCompare(f)}else s==="date"&&(d=gb(a,l));return r==="asc"?d:-d})}expandItem(e,t=!1){const r=this.rowKeyMap.get(e);r.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(r=>{const s=this.rowKeyMap.get(r);this.expandMap.set(r,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,r)=>{t.expand&&e.push(r)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const r=this.rowKeyMap.get(e);r.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const r=this.rowKeyMap.get(e);r.expand=!0,this.expandMap.set(e,!0),r.expandLazy=!0,r.item.children=t,this.initData(r.item.children,r.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const r=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return r===void 0||s===void 0?null:{rowKey:r,key:s,value:this.getItemValue(r,s)}}getItemValue(e,t){const r=this.rowKeyMap.get(e);return r&&r.item?r.item[t]===void 0?null:r.item[t]:null}async batchSetItemValue(e,t=!1,r=!0,s="none"){let n=[],o=r;const a=new Set;let l=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let w=x.value,E=w;const C=this.getRowDataItemForRowKey(v),b=this.getItemValue(v,p),_=this.getVirtualBodyCellByKey(v,p);return(_==null?void 0:_.type)==="number"&&(["",void 0,null].includes(w)?E=null:/^-?\d+(\.\d+)?$/.test(`${w}`)?E=Number(w):(E=b,l.push({...x,value:E,oldValue:b,row:C}))),{...x,value:E,oldValue:b,row:C}});if(d=d.filter(x=>!l.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),l.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:l};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:u}=this.ctx.config;s==="none"&&typeof u=="function"&&(d=await u(d),o=!1),d.forEach(x=>{const{value:v,rowKey:p,key:w}=x,E=this.getItemValue(p,w);a.add(p),this.setItemValue(p,w,v,!1,!1,!1,o),n.push({rowKey:p,key:w,oldValue:E,newValue:v})});let f=[];a.forEach(x=>{f.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,f),t&&this.ctx.history.pushState({changeList:n,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,n=!1,o=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:l}=this.rowKeyMap.get(e);let d=l[t],u=r;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};l[t]!==null&&typeof l[t]=="object"&&(d=JSON.parse(JSON.stringify(l[t])));const f=`${e}​_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,d);const g=this.originalDataMap.get(f),m=this.getRowDataItemForRowKey(e);if(o){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(r))u=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))u=Number(r);else{u=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:u,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(u===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:u,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:g,row:m})}else this.changedDataMap.set(f,u),l[t]=u;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:this.originalDataMap.get(f),row:m}),n&&this.ctx.emit("draw"),{oldValue:d,newValue:u}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:r}=this.ctx.config;if(r){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),n=s[r];this.checkboxKeyMap.has(n)&&(this.checkboxKeyMap.get(n)||[]).forEach(o=>{const a=this.selectionMap.get(o);a&&(a.check=t)})}}toggleRowSelection(e,t){const r=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",r);const n=this.getSelectionRows();this.ctx.emit("selectionChange",n),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),r=this.ctx.config.TREE_SELECT_MODE;if(r==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(r==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(r==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const r=this.getTreeChildren(t).map(l=>this.selectionMap.get(l)),s=r.filter(l=>l==null?void 0:l.check).length,n=r.length;let o=!1;n>0&&(s===0?o=!1:s===n||this.ctx.config.TREE_SELECT_MODE==="auto"?o=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(o=!1));const a=this.selectionMap.get(t);a&&a.check!==o&&(a.check=o,this.setRowSelectionByCheckboxKey(t,o),this.updateParentTreeSelection(t))}setRowSelection(e,t,r=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const r=this.selectionMap.get(e);r&&(r.check=t,this.setRowSelectionByCheckboxKey(e,r.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),r=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:r,indeterminate:!1};let s=!1,n=r;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const o=f=>{const g=this.getTreeChildren(f);let m=[];for(const x of g)m.push(x),m.push(...o(x));return m},a=o(e).map(f=>this.selectionMap.get(f)),l=a.filter(f=>f==null?void 0:f.check).length,d=a.length,u=l>0;s=u&&l!==d,n=r||u,r&&d>0&&l===0&&(n=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const o=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...o(v));return x},a=o(e).map(g=>this.selectionMap.get(g)),l=a.filter(g=>g==null?void 0:g.check).length,d=a.length,u=l>0,f=l===d;s=u&&!f,n=r||f,r&&d>0&&l===0&&(n=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,n=r);return{checked:n,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const r=[],s=n=>{for(const o of n){const a=this.getRowKeyByItem(o);a&&r.push(a),o.children&&o.children.length>0&&s(o.children)}};return s(t.item.children),r}getTreeParent(e){const t=(r,s)=>{for(const n of r){const o=this.getRowKeyByItem(n);if(n.children)for(const a of n.children){if(this.getRowKeyByItem(a)===s)return o;const l=t(n.children,s);if(l)return l}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:r,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:r,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const n=this.selectionMap.get(r);n&&(n.check=!0,this.setRowSelectionByCheckboxKey(r,!0))}}):this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(r,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,n)=>{const o=this.selectionMap.get(n);o&&(o.check=!1,this.setRowSelectionByCheckboxKey(n,!1))}):this.rowKeyMap.forEach((s,n)=>{this.setRowSelection(n,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,n)=>{this.selectionMap.set(n,{check:!1,row:s.item,key:n})}));const r=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",r),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const r=this.rowKeyMap.size;let s=0,n=0;const o=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(n+=1)});const l=o>r&&s===0&&a,d=n&&n>s&&s>0||l,u=n!==0,f=!!n&&n===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:d,selectable:u},{check:f,indeterminate:d,selectable:u}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const r=this.colIndexKeyMap.get(e);if(r&&this.headerMap.has(r))return(t=this.headerMap.get(r))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,r)=>{const s=this.originalDataMap.get(r),n=r.split("​_")[0],o=r.split("​_")[1];s!==t&&e.push({rowKey:n,colKey:o,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(n),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const n=this.originalDataMap.get(s),o=s.split("​_")[0];n!==r&&e.add(o)});let t=[];return e.forEach(r=>{t.push(this.ctx.database.getRowDataItemForRowKey(r))}),t}isHasChangedData(e,t){const r=`${e}​_${t}`;if(!this.changedDataMap.has(r))return!1;const s=this.originalDataMap.get(r),n=this.changedDataMap.get(r);return s!==n}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:r}=this.ctx.config;if(r)return!0;const s=this.rowKeyMap.get(e),n=this.headerMap.get(t);if(!s||!n)return!0;const o=s.readonly,a=n.readonly,{BODY_CELL_READONLY_METHOD:l}=this.ctx.config;if(typeof l=="function"&&n){const d=l({row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:n.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||o}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return this.ctx.database.getReadonly(e,t)?new Promise(r=>{r([])}):new Promise(r=>{const s=this.rowKeyMap.get(e),n=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:o}=this.ctx.config;if(s===void 0||n===void 0)return r([]);const a=n.column;let l=a.rules;if(typeof o=="function"){const d=o({row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:a,value:this.getItemValue(e,t)});d&&(l=d)}if(l){const d={row:s.item,rowIndex:s.rowIndex,colIndex:n.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},u=new ob(l).validate(d);this.setValidationError(e,t,u),r(u)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const n=this.positions[e+s];n&&(r+=n.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:n,value:o,colIndex:a,relationRowKeys:l,relationColKeys:d,rowspan:u,height:f,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(u===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:u,colspan:m,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:n,value:o}]};let p=t,w=t,E=a,C=a,b=[],_=0,B=0,K=0,S=0;if(u!==1&&x){S=g;const I=l.reduce((R,O)=>{const y=this.getItemValue(s,O)??"";return`${R}${y}`},"");for(let R=t-1;R>=0;R--){const O=this.rowIndexRowKeyMap.get(R)||"",y=l.reduce((A,L)=>{const P=this.getItemValue(O,L)??"";return`${A}${P}`},"");if(I===y)p=R;else break}for(let R=t;R<=this.ctx.maxRowIndex;R++){const O=this.rowIndexRowKeyMap.get(R)||"",y=l.reduce((A,L)=>{const P=this.getItemValue(O,L)??"";return`${A}${P}`},"");if(I===y)w=R;else break}for(let R=p;R<t;R++){const{height:O}=this.positions[R];_+=O}for(let R=p;R<=w;R++){const{height:O}=this.positions[R];K+=O;const y=this.rowIndexRowKeyMap.get(R)||"",{item:A}=this.rowKeyMap.get(y),L=this.getItemValue(y,r);b.push({rowKey:y,key:r,value:L,row:A})}}if(m!==1&&v){K=f;for(let I=a-1;I>=0;I--){const R=this.getColumnByColIndex(I);if(!R)break;const O=this.getItemValue(s,r),y=this.getItemValue(s,R.key);if(O===y&&d.includes(R.key))E=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const R=this.getColumnByColIndex(I);if(!R)break;const O=this.getItemValue(s,r),y=this.getItemValue(s,R.key);if(O===y&&d.includes(R.key))C=I;else break}for(let I=E;I<a;I++){const R=this.getColumnByColIndex(I);if(!R)break;B+=R.width||100}for(let I=E;I<=C;I++){const R=this.getColumnByColIndex(I);if(!R)break;S+=R.width||100,b.push({rowKey:s,key:R.key,value:this.getItemValue(s,R.key),row:n})}}return{xArr:[E,C],yArr:[p,w],rowspan:u,colspan:m,height:K,width:S,offsetTop:_,offsetLeft:B,dataList:b}}setValidationErrorByRowKey(e,t,r){const s=`${e}​_${t}`,n=this.getRowForRowKey(e),o=n==null?void 0:n.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!n)return;const l=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:o,colIndex:a.colIndex,column:a.column,row:n,value:l,message:r,field:t,fieldValue:l}];this.validationErrorMap.set(s,d)}setValidationError(e,t,r){const s=`${e}​_${t}`;this.validationErrorMap.set(s,r)}clearValidationError(e,t){const r=`${e}​_${t}`;this.validationErrorMap.has(r)&&this.validationErrorMap.delete(r)}getValidationError(e,t){const r=`${e}​_${t}`;return this.validationErrorMap.get(r)||[]}getVirtualBodyCell(e,t,r=!0){const s=this.getColumnByColIndex(t),n=this.getRowForRowIndex(e);return!s||!n?void 0:new Pr(this.ctx,e,t,0,0,0,0,s,n.item,"body",r)}getVirtualBodyCellByKey(e,t){const r=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(r===void 0||s===void 0))return this.getVirtualBodyCell(r,s)}hasMergeCell(e,t){let r=!1;for(let s=t[0];s<=t[1];s++)for(let n=e[0];n<=e[1];n++){const o=this.getVirtualBodyCell(s,n);if(o&&(o.rowspan!==1||o.colspan!==1)){r=!0;break}}return r}calculateMaxTreeDepth(e,t=0){let r=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const n=this.calculateMaxTreeDepth(s.children,t+1);r=Math.max(r,n)}}),r}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const r=`${e}​_${t}`;return this.overlayerAutoHeightMap.get(r)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(r=>{const s=e[r];s!==void 0&&(this.customHeader[r]=s)}),!t){const r=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",r)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:r={}}=this.customHeader;r[e]=t,this.setCustomHeader({resizableData:r})}setCustomHeaderHideData(e,t){let{hideData:r={}}=this.customHeader;e.forEach(s=>{r[s]=t}),this.setCustomHeader({hideData:r}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:r={}}=this.customHeader;e.forEach(s=>{r[s]=t}),this.setCustomHeader({fixedData:r}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,n={})=>{s.forEach(o=>{o.children&&o.children.length>0&&t(o.children,n);const a=(l,d)=>{var u,f;const g=(u=this.customHeader[l])==null?void 0:u[o.key];g!==void 0&&g!==d&&(n[l]||(n[l]={}),n[l][o.key]=g,l==="fixedData"&&!g&&!d&&((f=n[l])==null||delete f[o.key]))};a("fixedData",o.fixed),a("sortData",o.sort),a("hideData",o.hide),a("resizableData",o.width)})};let r={};return t(e,r),r}setMaxRowHeightItem(e,t,r){this.maxRowHeightCellMap.set(e,{key:t,height:r})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class mb{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:r}=this.ctx.config;r&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:r}=this.history[this.historyIndex],s=e.map(n=>({rowKey:n.rowKey,key:n.key,value:n.oldValue,row:{}}));this.ctx.setScroll(t,r),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(r=>({rowKey:r.rowKey,key:r.key,value:r.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class xb{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:r,options:s})=>{this.unbind(e,t,r,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,r=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-r.left,n=t.clientY-r.top;this.ctx.mouseX=s,this.ctx.mouseY=n,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,r,s){e.addEventListener(t,r,s),this.eventTasks.add({target:e,name:t,fn:r,options:s})}unbind(e,t,r,s){e.removeEventListener(t,r,s);for(const n of this.eventTasks)if(n.target===e&&n.name===t&&n.fn===r){this.eventTasks.delete(n);break}}}class pb{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const r=this.events.get(e)||[];r.push(t),this.events.set(e,r)}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}off(e,t){const r=this.events.get(e);if(r){const s=r.indexOf(t);s>=0&&(r.splice(s,1),r.length===0?this.events.delete(e):this.events.set(e,r))}}emit(e,...t){const r=this.events.get(e);r&&r.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class yb{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,r,s){this.ctx.clearRect(e,t,r||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,r,s,n){const{fillColor:o,side:a,shadowWidth:l,colorStart:d,colorEnd:u}=n;this.ctx.save(),o&&(this.ctx.fillStyle=o,this.ctx.fillRect(e,t,r,s));let f;switch(a){case"left":f=this.ctx.createLinearGradient(e-l,t,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e-l,t,l,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+l,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,l,s);break;case"top":f=this.ctx.createLinearGradient(e,t-l,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-l,r,l);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+l),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,l);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:r="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let n=2;n<e.length;n+=2)this.ctx.lineTo(e[n]-.5,e[n+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,r,s,n){this.ctx.save(),this.ctx.drawImage(e,t,r,s,n),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:n=1,borderColor:o,fillColor:a,radius:l=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),o!==void 0&&(this.ctx.lineWidth=n,this.ctx.strokeStyle=o),l===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[d,u,f,g]=typeof l=="number"?[l,l,l,l]:l;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+r,t,e+r,t+u,u),this.ctx.arcTo(e+r,t+s,e+r-f,t+s,f),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),o!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,n,o={}){var a;this.ctx.save();const{font:l="12px Arial",align:d="center",color:u="#495060",padding:f=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=o;if(this.ctx.font=l,this.ctx.fillStyle=u,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const w=parseInt(((a=l.match(/\d+/))==null?void 0:a[0])||"12")*(o.lineHeight||1.2),E=s-f*2-v-p;let C=!1;const b=Math.round((n-2*f)/w);let _=this.wrapText(e,E,o.cacheTextKey),B=Math.min(_.length,Math.max(b,1));m==="auto"&&x?B=_.length:typeof m=="number"&&m<B&&m!==1?B=m:(m===1&&(_=[e],B=1),m==="auto"&&b===1&&(_=[e],B=1));let K=r+f;const S=Math.round(B*w);g==="middle"?K=r+(n-S)/2:g==="bottom"&&(K=r+n-S-f);let I=t+f+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-f-p);for(let R=0;R<_.length;R++){const O=_[R],y=K+R*w;if(this.ctx.textBaseline="top",R===B-1){const A=_.slice(R).join(""),{_text:L,ellipsis:P}=this.handleEllipsis(A,s,f,l);this.ctx.fillText(L,I,y),C=P;break}this.ctx.fillText(O,I,y)}if(o.textCallback&&_.length){const R=_.reduce((P,Y)=>Math.max(P,this.ctx.measureText(Y).width),0),O=Math.round(R);let y=I,A=I+O;d==="center"?(y=I-O/2,A=I+O/2):d==="right"&&(y=I-O,A=I);const L={x:I,y:K,width:O,height:S,left:y,right:A,top:K,bottom:K+S};o.textCallback(L)}return this.ctx.restore(),C}wrapText(e,t,r=""){if(!e)return[""];if(r&&this.textCacheMap.has(r))return this.textCacheMap.get(r)||[""];const s=[],n=e.split(`
4
- `);for(const a of n){if(a===""){s.push("");continue}const l=a.split("");let d="";for(const u of l){const f=d+u;this.ctx.measureText(f).width<=t?d=f:d?(s.push(d),d=u):(s.push(u),d="")}d&&s.push(d)}const o=s.length>0?s:[""];return r&&this.textCacheMap.set(r,o),o}calculateTextHeight(e="",t,r={}){var s;const{font:n="12px Arial",padding:o=0,align:a="center",color:l="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=r;this.ctx.save(),this.ctx.font=n,this.ctx.fillStyle=l,this.ctx.textAlign=a;const f=parseInt(((s=n.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(r.lineHeight||1.2),m=t-o*2,x=this.wrapText(e,m,u);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+o*2),Math.floor(f+o*2))}handleEllipsis(e,t,r=0,s="12px Arial"){this.ctx.save();let n=!1,o=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:n};const a=this.ctx.measureText("...").width;if(t<=a+r*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const l=this.ctx.measureText(e).width,d=t-r*2;if(l&&l>=d){n=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-a){o=e.slice(0,f)+"...",n=!0;break}}return this.ctx.restore(),{_text:o,ellipsis:n}}}class Bn{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const r=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=fb(r);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Si='<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',Hn='<svg t="1722595535853" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>',Fn='<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>',Yr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',wb=Yr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),Eb=Yr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),al='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class Cb{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:al,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Si,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Fn,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Hn,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Hn,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:Fn,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:wb,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:Eb,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Yr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const r=this.list[t];let s=r.color,n=r.svg;if(r.configColorName){const a=this.ctx.config[r.configColorName];a&&(s=a)}if(r.configName){const a=this.ctx.config[r.configName];a&&(n=a)}const o=this.createImageFromSVG(n,s).then(a=>{this.icons.set(r.name,a)});e.push(o)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const n=this.createImageFromSVG(r.svg,s,r.isBlob).then(o=>{this.icons.set(r.name,o)});e.push(n)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,r=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const l=a.getAttribute("fill");(l==="currentColor"||l===null)&&a.setAttribute("fill",t)});const n=new Image;let o="";if(r){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});o=URL.createObjectURL(a)}else o="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return n.src=o,new Promise((a,l)=>{n.onerror=()=>l(new Error("Failed to load image:"+e)),n.onload=()=>{a(n)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class vr extends ol{constructor(e,t,r,s,n,o,a){super(e,r,s,n,o,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=n,this.height=o,this.visibleWidth=n,this.visibleHeight=o,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=il(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:r}=this.ctx.config;let s=t,n=r;if(typeof e=="function"){const l=e,{backgroundColor:d,color:u,font:f}=l({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),u&&(n=u),f&&(this.drawTextFont=f)}const{colKey:o,type:a}=this.ctx.finderBar;a==="header"&&o===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=n}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:r,REQUIRED_COLOR:s}}=this.ctx,n=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:n,textCallback:o=>{this.column.sortBy&&(this.drawSortImageX=o.right+4,this.drawSortImageY=o.top+(o.height-16)/2),this.required&&e.drawText("*",o.left-18,o.top+(o.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let r=-1,s=-1;if(this.ctx.focusCellHeader&&(r=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:o}=this.ctx.selector;r=o[0],s=o[1]}const n=this.colspan+this.colIndex-1;this.colIndex>=r&&this.colIndex<=s&&n<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:r}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:n}=this.ctx.config;let o=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=o+s-n/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(o=this.drawX+n,this.drawTextX=o+s-n/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+n/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-n/2);let l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(l=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&r?(l=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!r?(l=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&r?(l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(l=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),l&&(this.drawSelectionImageX=o,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=l,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const r=this.ctx.database.getSortState(this.key);r.direction==="asc"?t=this.sortAscIconName:r.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class bb{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r,{body:{height:o,visibleHeight:a,visibleWidth:l,y:d}}=this.ctx,u=Math.min(o,a);n>0&&n<l&&s>d&&s<d+u||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,f=>{this.ctx.focusCellHeader=f,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",f,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,f=>{this.ctx.setFocusCell(f),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",f,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,o=>{this.ctx.focusCellHeader=o,this.ctx.emit("cellHeaderMouseup",o,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,o=>{this.ctx.setFocusCell(o),this.ctx.emit("cellMouseup",o,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;this.handleHeaderEvent(n,s,this.ctx.header.renderCellHeaders,o=>{this.ctx.emit("cellHeaderContextMenuClick",o,e)}),this.handleBodyEvent(n,s,this.ctx.body.renderRows,o=>{this.ctx.emit("cellContextMenuClick",o,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{var n;this.imageEnterAndLeave(s,e),this.ctx.emit("cellMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellMouseleave",s,e),this.ctx.hoverCell!==s&&(((n=this.ctx.hoverCell)==null?void 0:n.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(o=>o.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(r,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&!this.ctx.disableHoverIconClick&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof vr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(!this.isInsideElement(o,n,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:l=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:u,EXPAND_LAZY_METHOD:f}=this.ctx.config;if(u&&f&&!l&&!d)typeof f=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),f({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(!this.isInsideElement(o,n,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let l;a.direction==="none"?l="asc":a.direction==="asc"?l="desc":l="none",this.ctx.database.setSortState(e.key,l)}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),n=r,o=s;if(e instanceof vr){if(e.drawSelectionImageSource&&this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(o,n,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Pr){if(e.drawSelectionImageSource&&this.isInsideElement(o,n,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(o,n,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(o,n,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,r,s,n,o){return e>r&&e<r+n&&t>s&&t<s+o}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:o}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-o||n>this.ctx.stageWidth-o)}handleBodyEvent(e,t,r,s,n=!1){if(this.isInsideBody(t))for(const o of r){const a=o.fixedCells.concat(o.noFixedCells);for(const l of a){const d=l.getDrawX(),u=l.getDrawY();if(n){if(e>d&&e<d+l.visibleWidth&&t>u&&t<u+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>u&&t<u+l.height){s(l);return}}}}handleHeaderEvent(e,t,r,s){for(const n of r){const o=n.getDrawX(),a=n.getDrawY();if(e>o&&e<o+n.width&&t>a&&t<a+n.height){s(n);return}}}handleFooterEvent(e,t,r,s,n=!1){for(const o of r){const a=o.fixedCells.concat(o.noFixedCells);for(const l of a){const d=l.getDrawX(),u=l.getDrawY();if(n){if(e>d&&e<d+l.visibleWidth&&t>u&&t<u+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>u&&t<u+l.height){s(l);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class _b{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:r,stageElement:s,canvasElement:n,overlayerElement:o,editorElement:a,emptyElement:l,loadingElement:d,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=n,this.overlayerElement=o,this.editorElement=a,this.emptyElement=l,this.loadingElement=d,this.contextMenuElement=u,this.config=new Bn(t.config||{}),this.eventBus=new pb,this.eventBrowser=new xb(this),this.eventTable=new bb(this),this.paint=new yb(this.canvasElement),this.database=new vb(this,t),this.history=new mb(this),this.icons=new Cb(this)}setConfig(e){this.config=new Bn(e)}setItemValueByEditor(e,t,r,s=!0,n=!0,o=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:l}=a.getSpanInfo(),d=l.map(u=>({...u,value:r}));this.database.batchSetItemValue(d,s,o);return}}this.database.setItemValue(e,t,r,s,n,!0,o)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(n=>{const o=this.database.getRowIndexForRowKey(n.rowKey),a=this.database.getColIndexForKey(n.key);if(o===void 0||a===void 0)return;const l=this.database.getVirtualBodyCell(o,a);if(l){const{dataList:d}=l.getSpanInfo(),u=d.map(f=>({...f,value:n.value}));s.push(...u)}}),this.database.batchSetItemValue(s,t,r)}else this.database.batchSetItemValue(e,t,r)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const r={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",r)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,r=this.selector.xArr;let s="";for(let n=0;n<=t[1]-t[0];n++){const o=[];for(let a=0;a<=r[1]-r[0];a++){const l=n+t[0],d=a+r[0],u=this.database.getVirtualBodyCell(l,d);u&&(u.selectorCellValueType==="displayText"?o.push(u.displayText):o.push(u.getValue()))}s+=`${o.join(" ")}\r`,e.push(o)}return s=s?s.replace(/\r$/,""):" ",{xArr:r,yArr:t,text:s,value:e}}setScroll(e,t){let r=Math.floor(e);const s=this.body.width-this.body.visibleWidth;r<0?r=0:r>s&&(r=s);let n=Math.floor(t),o=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(o=this.body.height+this.footer.height-this.body.visibleHeight),n<0?n=0:n>o&&(n=o),this.emit("setScroll",r,n)}setScrollX(e){let t=Math.floor(e);const r=this.body.width-this.body.visibleWidth;t<0?t=0:t>r&&(t=r),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),r=0;this.config.FOOTER_FIXED||(r=this.footer.height);const s=this.body.height-this.body.visibleHeight+r;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:r}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-r}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class Kn{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:r}=e.touches[0],s=t-this.clientY,n=r-this.clientX;let o=0;this.type==="vertical"?(o=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(o===0&&s>0||o===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(o=Math.max(0,Math.min(this.dragStart-n,this.distance))),this.scroll=o}onTouchstart(e){const{clientY:t,clientX:r}=e.touches[0];this.clientX=r,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:r,clientX:s,clientY:n}=e;if(!(s==this.clientX&&n==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=n,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let o=0;this.type==="vertical"?o=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:o=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(o,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:r,clientX:s,clientY:n,buttons:o}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,o===0||s==this.clientX&&n==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=n-this.clientY,this.isDragging&&a!==0){let l=0;this.type==="vertical"?l=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:l=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(l,this.distance))}}isPointInElement(e,t,r,s,n,o){return e>=r&&e<=r+n&&t>=s&&t<=s+o}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,r=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&r<0||this.scroll===this.distance&&r>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:r,stageWidth:s,config:{SCROLLER_TRACK_SIZE:n=0,SCROLLER_SIZE:o=0,BORDER:a}}=this.ctx,l=s,d=r,u=t.height,f=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-n-u,this.distance=g-this.visibleDistance+m,this.trackX=l-n,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+n,u],this.trackWidth=n,this.trackHeight=d,this.barX=this.trackX-1+(n-o)/2,this.barWidth=o;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=l-n,this.distance=f-this.visibleDistance,this.splitPoints=[l-n,d-n,l-n,d];const x=a?0:.5;this.trackX=0,this.trackY=d-n+x,this.trackWidth=l,this.trackHeight=n;const v=this.distance?this.visibleDistance/f:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(n-o)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,this.barHeight=o,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:r,BORDER:s,SCROLLER_TRACK_COLOR:n}}=this.ctx;this.updatedSize();let o=r;s||(o="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:o,fillColor:n}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:o,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class Rb{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new Kn(e,"vertical"),this.horizontalScrollbar=new Kn(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,r)=>{this.setScroll(t,r)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,r)=>{this.scrollToIndex(t,r)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.key===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.colIndex===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:n}=r.getPositionForRowIndex(s);this.setScrollY(n-t.visibleHeight/2)}startAdjustPosition(e){var t,r;const{offsetX:s,offsetY:n}=this.ctx.getOffset(e);let o="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?o="left":((r=this.ctx.focusCell)==null?void 0:r.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?o="right":(o="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&n<this.ctx.header.visibleHeight?a="top":n>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),o&&this.adjustPositionX!==o){this.adjustPositionX=o;let l=10*(o==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{l*=1.5;const{scrollX:d}=this.ctx,u=d+l;(u<0||u>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(u)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let l=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{l*=1.5;const{scrollY:d}=this.ctx,u=d+l;(u<0||u>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(u)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class Ib{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,r){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:n,index:o,node:a}=s;if(n){const f=n[this.childrenKey];f.splice(o,1),f.length===0&&delete n[this.childrenKey]}else this.root.splice(o,1);const l=this.findNodeWithParent(this.root,t[this.key]);if(!l)throw new Error("Target node not found");const{parent:d,index:u}=l;r==="before"?d?d[this.childrenKey].splice(u,0,a):this.root.splice(u,0,a):r==="after"&&(d?d[this.childrenKey].splice(u+1,0,a):this.root.splice(u+1,0,a))}findNodeWithParent(e,t,r=null){for(let s=0;s<e.length;s++){const n=e[s];if(n[this.key]===t)return{parent:r,index:s,node:n};if(n[this.childrenKey]){const o=this.findNodeWithParent(n[this.childrenKey],t,n);if(o)return o}}return null}}class Sb{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Kr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:r}}=this.ctx;if(!e){const f=this.ctx.database.getColumns();this.columns=f}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=rl(this.columns);const s=Ei(this.visibleColumns),n=Ut(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=n.reduce((f,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?f+x:v&&m<v?f+v:f+m},0),this.columnIndex=0,this.resizeNum=0;const o=ab(Ci(this.visibleColumns,s));this.render(o,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const a=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(a.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+r),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-r;const l=this.visibleWidth-this.width;if(this.resizeNum&&l>0){const f=Math.floor(l/this.resizeNum*100)/100;this.resizeAllColumn(f)}const d=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=d.reduce((f,g)=>f+g.width,0);const u=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=u.reduce((f,g)=>f+g.width,r),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:r}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,n=this.resizeTarget.minWidth,o=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<r&&(a=-(s-r)),n&&a+s<n&&(a=-(s-n)),o&&a+s>o&&(a=o-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const n of s){const{offsetX:o,offsetY:a}=this.ctx.getOffset(e),l=o,d=a,u=n.getDrawX(),f=n.getDrawY();if(l>u+n.width-5&&l<u+n.width+4&&l<t-4&&d>f){const g=n.colIndex+n.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<u+n.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,u={})=>(d.forEach((f,g)=>{f.children&&e(f.children,u),u[f.key]=g}),u),t=this.ctx.database.getColumns(),r=Ci(t,Ei(t)),s=new Ib(r,{key:"key",childrenKey:"children"}),n=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,n);const o=s.getTree(),a=e(o);this.ctx.database.setCustomHeader({sortData:a}),this.init();const l={source:this.dragTarget,target:this.dragingCell,columns:r};this.ctx.emit("columnDragChange",l)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:r,level:s,fixed:n}=this.dragTarget,o=this.allCellHeaders.find(a=>a.key!==r&&a.fixed===n&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=o?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return o}resizeColumn(e,t){const r=o=>{o.forEach(a=>{if(a.children&&a.children.length>0&&r(a.children),a.key===e.key){const l=a.width||100;a.width=l+t}})};r(this.columns);let s=0;if(this.width<this.visibleWidth){const o=this.visibleWidth-this.width;s=Math.floor(o/this.resizeNum*100)/100,this.resizeAllColumn(s)}const n=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:n,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,n),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const n of this.allCellHeaders)if(n.widthFillDisable)t.set(n.key,n.width);else{const o=n.width+e*n.colspan;t.set(n.key,o),o<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=n=>{n.forEach(o=>{t.has(o.key)&&(o.width=t.get(o.key)),o.children&&o.children.length>0&&s(o.children)})};s(this.columns),this.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:r={}}=t;return Object.keys(r).length===0?{columns:e,customHeader:t}:{columns:Ci(e,Ei(e)),customHeader:t}}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:n=0}=this.ctx.config;for(let o=0;o<r;o++){const a=e[o],l=n*(a.rowspan||0),d=n*(a.level||0);let{minWidth:u,maxWidth:f}=a,g=a.width||100;u&&g<u&&(g=u),f&&g>f&&(g=f),a.children&&(g=Ut(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new vr(this.ctx,this.columnIndex,s,d,g,l,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:r,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:n}}=this.ctx,o=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,l=o+a+this.resizeDiff-.5,d=[l-.5,0,l-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),n){const u=`${Math.floor(a+this.resizeDiff)}px`,f=45,g=24;this.ctx.paint.drawRect(l+f/2,this.ctx.mouseY-g/2,f,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(u,l+f/2,this.ctx.mouseY-g/2,f,g+2,{padding:0,color:r,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,r=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,r,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:n,visibleWidth:o,colIndex:a}=this.dragingCell;let l=s,d=n;a>this.dragTarget.colIndex&&(l=s+o),a===0&&(l=l+1),a===this.ctx.maxColIndex&&(l=l-1);const u=[l,d,l,this.ctx.stageHeight],f=[l-4,d,l+4,d,l,d+6,l-4,d];this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a){const l=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(l,this.y,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],r=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=r,this.renderLeafCellHeaders=e.sort((s,n)=>s.x-n.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.height,e,this.height];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class ll{constructor(e,t,r=0,s=0,n=0,o=0,a,l="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=r,this.y=s,this.width=n,this.height=o,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=l,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[],n=[];e.renderLeafCellHeaders.forEach(o=>{const a=new Pr(this.ctx,this.rowIndex,o.colIndex,o.x,this.y,o.width,this.height,o.column,this.data,this.rowType);a.fixed?r.push(a):s.push(a),t.push(a),a.autoRowHeight&&n.push(a)}),this.cells=t,this.calculatedHeightCells=n,this.fixedCells=r,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const r=t.getAutoHeight(),{key:s,height:n=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return r>n?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,r):t.key===s&&r<n&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,r),r});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class Tb{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:r,database:s,config:{FOOTER_FIXED:n,SCROLLER_TRACK_SIZE:o=0,HEIGHT:a,EMPTY_BODY_HEIGHT:l=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:u=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&n?this.y=t.height+r.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-o;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=l:!this.data.length&&a&&(this.height=a-t.height-v-o);let p=this.height+t.height+o;p+=v;let w=p;const E=window.innerHeight,{top:C}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(E>C&&u&&!a){const O=E-C-f;O>t.height+o?w=O:p>d&&(w=d)}else this.data.length&&a?w=a:this.data.length&&d&&p>d&&(w=d);w>0&&(this.ctx.stageHeight=Math.floor(w),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-o;n?this.visibleHeight=b-v:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const _=window.devicePixelRatio||1,B=this.ctx.stageWidth*_,K=this.ctx.stageHeight*_;e.width=Math.round(B),e.height=Math.round(K);const S=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:S,type:S,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:l+v});const I=Math.round(e.width/_*1e4)/1e4,R=Math.round(e.height/_*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${R}px;width:${I}px;`),this.ctx.paint.scale(_)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,n=r,o=e.clientY,{stageHeight:a,scrollY:l,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=o-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;f+u<m&&(f=-(u-m)),this.resizeDiff=f,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(n<0||n>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let u=0;u<this.renderRows.length;u++){const f=this.renderRows[u];if(s>f.y-l+f.height-1.5&&s<f.y-l+f.height+1.5&&s<a-4)for(let g=0;g<f.cells.length;g++){const m=f.cells[g];n>m.drawX+10&&n<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:n,data:o}=e;this.ctx.database.setRowHeight(r,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:r,oldHeight:s,height:s+t,rowKey:n,row:o,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:r}}=this.ctx,s=this.resizeTarget.y-t,n=this.resizeTarget.height,o=s+n+this.resizeDiff-.5,a=[0,o-.5,e,o-.5];this.ctx.paint.drawLine(a,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a&&!this.ctx.isEmpty){const l=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(l,this.y,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let r=0,s=e.length-1,n=-1;for(;r<=s;){let o=Math.floor((r+s)/2),a=e[o].bottom;if(a===t)return o;a<t?r=o+1:(n=o,s=o-1)}return n}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,n=r,{data:o,positions:a}=t.getData();this.ctx.maxRowIndex=o.length-1;let l=this.binarySearch(a,n),d=this.binarySearch(a,n+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),l===-1&&d===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);l=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,l),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=o.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const u=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,m=this.visibleRows[f],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new ll(this.ctx,g,0,v+this.y,e.width,x,m);u.push(p)}this.renderRows=u,this.ctx.body.renderRows=u}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(r=>r.calculatedHeightCells.length>0))return!1;e.forEach(r=>{r.updateCalculatedHeight()});const t=e.map(r=>({height:r.calculatedHeight,rowIndex:r.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class Ob{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:r,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:n,FOOTER_POSITION:o}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+r,0),this.visibleHeight=this.height,s?o==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-n:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:n,config:{HEADER_BG_COLOR:o,SCROLLER_TRACK_SIZE:a}}=this.ctx;let l=this.y;if(this.ctx.config.FOOTER_FIXED||(l=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,l,e,this.height,{fillColor:o,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-n-1)&&t!==a){const d=s.width-(this.x+this.width)+n-t;this.ctx.paint.drawShadow(d,l,t,this.height,{fillColor:o,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const r=[];this.data.forEach((s,n)=>{const o=new ll(this.ctx,n,0,t,this.width,e,s,"footer");t+=e,r.push(o)}),this.renderRows=r,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.y,e,this.y];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class kb{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Kr(e=>{var t;(t=this.ctx.focusCellHeader)!=null&&t.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellClick",()=>{this.adjustBoundaryPosition()}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0)}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:r}=this.ctx.selector;this.clearSelectedData(t,r);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click(),this.adjustBoundaryPosition()}),this.ctx.on("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let n=e,o=t;if(!s){const[a]=o;o=[a,a]}if(!r){const[a]=n;n=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(o)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:l,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:u,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=l||this.ctx.maxColIndex-f,v=d,p=u||this.ctx.maxRowIndex-g;let[w,E]=n,[C,b]=o;if(w<m||E>x||C<v||b>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(n,o);C=B.yArr[0],b=B.yArr[1],w=B.xArr[0],E=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}w===E&&C===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,n=[Math.max(m,w),Math.min(x,E)],o=[Math.max(v,C),Math.min(p,b)];const{BEFORE_SET_SELECTOR_METHOD:_}=this.ctx.config;if(typeof _=="function"){const B=_({focusCell:this.ctx.focusCell,xArr:n,yArr:o});if(!B)return;n=B.xArr,o=B.yArr}this.ctx.selector.xArr=n,this.ctx.selector.yArr=o,b===this.ctx.maxRowIndex&&C===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,E===this.ctx.maxColIndex&&w===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,n]=t,[o,a]=e;if(n===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&o===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let l=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const w=v+t[0],E=p+e[0],C=this.ctx.database.getVirtualBodyCell(w,E);C&&((w===s||w===n)&&l.push(C),(E===o||E===a)&&d.push(C))}const u=l.reduce((v,p)=>{const{yArr:w}=p.getSpanInfo(),[E,C]=w;return v.minY=Math.min(v.minY,E),v.maxY=Math.max(v.maxY,C),v},{minY:s,maxY:n}),f=d.reduce((v,p)=>{const{xArr:w}=p.getSpanInfo(),[E,C]=w;return v.minX=Math.min(v.minX,E),v.maxX=Math.max(v.maxX,C),v},{minX:o,maxX:a}),g=[f.minX,f.maxX],m=[u.minY,u.maxY];let x=!1;if(f.minX!==f.maxX||u.minY!==u.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,n=t,o=r||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const l=[a,e.colIndex+e.colspan-1],d=[n,o];this.setSelector(l,d)}else{const l=[e.colIndex,a+e.colspan-1],d=[n,o];this.setSelector(l,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:o,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:l}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-a,f=n,g=o||this.ctx.maxRowIndex-l,m=[d,u],x=[f,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:n}=this.ctx.config,o=s||this.ctx.maxColIndex-n,a=r;if(t){this.ctx.setFocusCell(e);const l=[a,o],d=[e.rowIndex,e.rowIndex];this.setSelector(l,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:l}=this.ctx.focusCell;if(e.rowIndex>=l){const d=[a,o],u=[l,e.rowIndex];this.setSelector(d,u)}else{const d=[a,o],u=[e.rowIndex,l];this.setSelector(d,u)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:r}=this.ctx;if(e&&t&&r){const{rowIndex:s,colIndex:n}=t,o=Math.min(r.colIndex,n),a=Math.max(r.colIndex,n),l=Math.min(r.rowIndex,s),d=Math.max(r.rowIndex,s),u=[o,a],f=[l,d];this.setSelector(u,f)}}click(e=!1){const{focusCell:t,clickCell:r}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,r&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:n}=r,{colIndex:o,rowIndex:a}=t,l=Math.min(o,s),d=Math.max(o,s),u=Math.min(a,n),f=Math.max(a,n),g=[l,d],m=[u,f];this.setSelector(g,m)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],n=[t.rowIndex,t.rowIndex];this.setSelector(s,n)}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const r=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return r==null?void 0:r.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:r}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,r))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const o=this.ctx.focusCell;e=[[o.getValue()]],t=[o.colIndex,o.colIndex],r=[o.rowIndex,o.rowIndex]}else{const o={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",o):alert(o.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const o=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!o)return;e=o.data}const n=hb(e);navigator.clipboard?navigator.clipboard.writeText(n).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit("copyChange",{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit("draw")}).catch(o=>console.error("Copy Failure:",o)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let n=[];const o=new Set;for(let l=0;l<=t[1]-t[0];l++)for(let d=0;d<=e[1]-e[0];d++){const u=l+t[0],f=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(u,f);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(o.add(m),n.push({rowKey:m,key:x,value:s,row:{}}))}}if(!n.length)return[];if(r)return n;this.ctx.database.batchSetItemValue(n,!0);let a=[];return o.forEach(l=>{a.push(this.ctx.database.getRowDataItemForRowKey(l))}),this.ctx.emit("clearSelectedDataChange",n,a),n}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],r=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async n=>{let o=cb(n);const a=[r,r+o[0].length-1],l=[t,t+o.length-1],[d,u]=l,[f,g]=a,m=u-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:u,maxX:g,minY:d,minX:f,overflowRowCount:m,overflowColCount:x,textArr:o});const v=o.length===1&&o[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!v){const C={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",C):alert(C.message);return}let p=[];for(let C=0;C<=o.length-1;C++){const b=o[C].length;for(let _=0;_<=b-1;_++){const B=C+t,K=_+r,S=o[C][_],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:R,key:O}=I;this.ctx.database.getReadonly(R,O)||(s.add(R),p.push({rowKey:R,key:O,value:S,row:{}}))}}}if(this.isCut){const C=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=p.map(_=>`${_.rowKey}-${_.key}`);C.forEach(_=>{b.includes(`${_.rowKey}-${_.key}`)||p.unshift(_)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:w}=this.ctx.config;if(typeof w=="function"){const C=w,b=p.map(_=>({rowKey:_.rowKey,key:_.key,value:_.value,oldValue:this.ctx.database.getItemValue(_.rowKey,_.key),row:this.ctx.database.getRowDataItemForRowKey(_.rowKey)}));if(p=await C(b,a,l,o),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let E=[];s.forEach(C=>{E.push(this.ctx.database.getRowDataItemForRowKey(C))}),this.ctx.emit("pasteChange",p,E),this.ctx.emit("draw")}).catch(n=>{console.error("Failed to get the clipboard content:",n)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:r=0,rowIndex:s=0}=t;const n=0,o=0,a=this.ctx.maxColIndex,l=this.ctx.maxRowIndex;switch(e){case"LEFT":r>n&&r--;break;case"TOP":s>o&&s--;break;case"RIGHT":r<a&&r++;break;case"BOTTOM":s<l&&s++;break}const d=[r,r],u=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(d,u),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:o,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:l}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-a,f=n,g=o||this.ctx.maxRowIndex-l;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:n,header:o,footer:a,body:l,scrollX:d,scrollY:u,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!r)return;x&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:v,drawY:p,width:w,height:E,fixed:C}=r,b=n-v+1,_=r.drawX+w-(t-s)+1;let B=o.height-p,K=E;K>l.visibleHeight&&(K=l.visibleHeight);let S=0;g&&(m==="top"?B=o.height+a.height-p:S=a.visibleHeight);const I=p+K-(e-S-f);let R=d,O=u;_>0&&!C?R=Math.floor(d+_):b>0&&!C&&(R=Math.floor(d-b)),B>0?O=Math.floor(u-B):I>0&&(O=Math.floor(u+I)),(Math.abs(d-R)>2.5||Math.abs(u-O)>2.5)&&this.ctx.setScroll(R,O)}destroy(){}}class Db{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:r}=this.ctx.getOffset(e),{colIndex:s,rowIndex:n,drawX:o,drawY:a,width:l,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||n===this.ctx.maxRowIndex?0:2,g=o+l-u+f,m=a+d-u+f;t>g&&r>m&&t<g+u&&r<m+u&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],n=r[1],{colIndex:o,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&o===s&&a===n&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:n}=this.ctx.config;if(!r)return;let o=e,a=t;const l=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!n&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(l)!==JSON.stringify(o))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:u,SELECTOR_AREA_MAX_X:f,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=u,w=f||this.ctx.maxColIndex-x,E=g,C=m||this.ctx.maxRowIndex-v;let[b,_]=o,[B,K]=a;if(b<p||B<E)return;o=[Math.max(p,b),Math.min(w,_)],a=[Math.max(E,B),Math.min(C,K)];const{BEFORE_SET_AUTOFILL_METHOD:S}=this.ctx.config;if(typeof S=="function"){const I=S({focusCell:this.ctx.focusCell,xArr:o,yArr:a});if(!I)return;o=I.xArr,a=I.yArr}this.ctx.autofill.xArr=o,this.ctx.autofill.yArr=a,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),r=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];r.set(`${v}-${p}`,!0)}const{value:s}=t,n=s[0].length,o=s.length,a=this.ctx.autofill.xArr,l=this.ctx.autofill.yArr,d=n===1&&o===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let u=[];for(let m=0;m<=l[1]-l[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+l[0],w=s[m%o][x%n],E=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),C=`${p}-${v}`;if(E&&!r.has(C)){const{rowKey:b,key:_}=E;this.ctx.database.getReadonly(b,_)||(e.add(b),u.push({rowKey:b,key:_,value:w,row:{}}))}}if(!u.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:f}=this.ctx.config;if(typeof f=="function"){const m=f,x=u.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(u=await m(x,a,l),u&&!u.length)return}this.ctx.batchSetItemValueByEditor(u,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",u,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:r}=this.ctx;if(this.ctx.mousedown&&t.enable&&r.enable){const{rowIndex:s,colIndex:n}=e,o=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?n>t.xArr[1]?o.splice(1,1,n):n<t.xArr[0]&&o.splice(0,1,n):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(o,a)}}destroy(){}}const Ot=Math.min,ut=Math.max,Ti=Math.round,wi=Math.floor,Te=i=>({x:i,y:i}),Lb={left:"right",right:"left",bottom:"top",top:"bottom"},$b={start:"end",end:"start"};function mr(i,e,t){return ut(i,Ot(e,t))}function ri(i,e){return typeof i=="function"?i(e):i}function ft(i){return i.split("-")[0]}function si(i){return i.split("-")[1]}function cl(i){return i==="x"?"y":"x"}function Vr(i){return i==="y"?"height":"width"}const Mb=new Set(["top","bottom"]);function Je(i){return Mb.has(ft(i))?"y":"x"}function Wr(i){return cl(Je(i))}function Ab(i,e,t){t===void 0&&(t=!1);const r=si(i),s=Wr(i),n=Vr(s);let o=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[n]>e.floating[n]&&(o=Oi(o)),[o,Oi(o)]}function Nb(i){const e=Oi(i);return[xr(i),e,xr(e)]}function xr(i){return i.replace(/start|end/g,e=>$b[e])}const Pn=["left","right"],Yn=["right","left"],Bb=["top","bottom"],Hb=["bottom","top"];function Fb(i,e,t){switch(i){case"top":case"bottom":return t?e?Yn:Pn:e?Pn:Yn;case"left":case"right":return e?Bb:Hb;default:return[]}}function Kb(i,e,t,r){const s=si(i);let n=Fb(ft(i),t==="start",r);return s&&(n=n.map(o=>o+"-"+s),e&&(n=n.concat(n.map(xr)))),n}function Oi(i){return i.replace(/left|right|bottom|top/g,e=>Lb[e])}function Pb(i){return{top:0,right:0,bottom:0,left:0,...i}}function hl(i){return typeof i!="number"?Pb(i):{top:i,right:i,bottom:i,left:i}}function ki(i){const{x:e,y:t,width:r,height:s}=i;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function Vn(i,e,t){let{reference:r,floating:s}=i;const n=Je(e),o=Wr(e),a=Vr(o),l=ft(e),d=n==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,g=r[a]/2-s[a]/2;let m;switch(l){case"top":m={x:u,y:r.y-s.height};break;case"bottom":m={x:u,y:r.y+r.height};break;case"right":m={x:r.x+r.width,y:f};break;case"left":m={x:r.x-s.width,y:f};break;default:m={x:r.x,y:r.y}}switch(si(e)){case"start":m[o]-=g*(t&&d?-1:1);break;case"end":m[o]+=g*(t&&d?-1:1);break}return m}const Yb=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:n=[],platform:o}=t,a=n.filter(Boolean),l=await(o.isRTL==null?void 0:o.isRTL(e));let d=await o.getElementRects({reference:i,floating:e,strategy:s}),{x:u,y:f}=Vn(d,r,l),g=r,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:w}=a[v],{x:E,y:C,data:b,reset:_}=await w({x:u,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:m,rects:d,platform:o,elements:{reference:i,floating:e}});u=E??u,f=C??f,m={...m,[p]:{...m[p],...b}},_&&x<=50&&(x++,typeof _=="object"&&(_.placement&&(g=_.placement),_.rects&&(d=_.rects===!0?await o.getElementRects({reference:i,floating:e,strategy:s}):_.rects),{x:u,y:f}=Vn(d,g,l)),v=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:m}};async function dl(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:n,rects:o,elements:a,strategy:l}=i,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:m=0}=ri(e,i),x=hl(m),v=a[g?f==="floating"?"reference":"floating":f],p=ki(await n.getClippingRect({element:(t=await(n.isElement==null?void 0:n.isElement(v)))==null||t?v:v.contextElement||await(n.getDocumentElement==null?void 0:n.getDocumentElement(a.floating)),boundary:d,rootBoundary:u,strategy:l})),w=f==="floating"?{x:r,y:s,width:o.floating.width,height:o.floating.height}:o.reference,E=await(n.getOffsetParent==null?void 0:n.getOffsetParent(a.floating)),C=await(n.isElement==null?void 0:n.isElement(E))?await(n.getScale==null?void 0:n.getScale(E))||{x:1,y:1}:{x:1,y:1},b=ki(n.convertOffsetParentRelativeRectToViewportRelativeRect?await n.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:w,offsetParent:E,strategy:l}):w);return{top:(p.top-b.top+x.top)/C.y,bottom:(b.bottom-p.bottom+x.bottom)/C.y,left:(p.left-b.left+x.left)/C.x,right:(b.right-p.right+x.right)/C.x}}const Vb=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:n,platform:o,elements:a,middlewareData:l}=e,{element:d,padding:u=0}=ri(i,e)||{};if(d==null)return{};const f=hl(u),g={x:t,y:r},m=Wr(s),x=Vr(m),v=await o.getDimensions(d),p=m==="y",w=p?"top":"left",E=p?"bottom":"right",C=p?"clientHeight":"clientWidth",b=n.reference[x]+n.reference[m]-g[m]-n.floating[x],_=g[m]-n.reference[m],B=await(o.getOffsetParent==null?void 0:o.getOffsetParent(d));let K=B?B[C]:0;(!K||!await(o.isElement==null?void 0:o.isElement(B)))&&(K=a.floating[C]||n.floating[x]);const S=b/2-_/2,I=K/2-v[x]/2-1,R=Ot(f[w],I),O=Ot(f[E],I),y=R,A=K-v[x]-O,L=K/2-v[x]/2+S,P=mr(y,L,A),Y=!l.arrow&&si(s)!=null&&L!==P&&n.reference[x]/2-(L<y?R:O)-v[x]/2<0,V=Y?L<y?L-y:L-A:0;return{[m]:g[m]+V,data:{[m]:P,centerOffset:L-P-V,...Y&&{alignmentOffset:V}},reset:Y}}}),Wb=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:n,rects:o,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=ri(i,e);if((t=n.arrow)!=null&&t.alignmentOffset)return{};const w=ft(s),E=Je(a),C=ft(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(d.floating)),_=g||(C||!v?[Oi(a)]:Nb(a)),B=x!=="none";!g&&B&&_.push(...Kb(a,v,x,b));const K=[a,..._],S=await dl(e,p),I=[];let R=((r=n.flip)==null?void 0:r.overflows)||[];if(u&&I.push(S[w]),f){const L=Ab(s,o,b);I.push(S[L[0]],S[L[1]])}if(R=[...R,{placement:s,overflows:I}],!I.every(L=>L<=0)){var O,y;const L=(((O=n.flip)==null?void 0:O.index)||0)+1,P=K[L];if(P&&(!(f==="alignment"&&E!==Je(P))||R.every(V=>Je(V.placement)===E?V.overflows[0]>0:!0)))return{data:{index:L,overflows:R},reset:{placement:P}};let Y=(y=R.filter(V=>V.overflows[0]<=0).sort((V,W)=>V.overflows[1]-W.overflows[1])[0])==null?void 0:y.placement;if(!Y)switch(m){case"bestFit":{var A;const V=(A=R.filter(W=>{if(B){const z=Je(W.placement);return z===E||z==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(z=>z>0).reduce((z,j)=>z+j,0)]).sort((W,z)=>W[1]-z[1])[0])==null?void 0:A[0];V&&(Y=V);break}case"initialPlacement":Y=a;break}if(s!==Y)return{reset:{placement:Y}}}return{}}}},Xb=new Set(["left","top"]);async function zb(i,e){const{placement:t,platform:r,elements:s}=i,n=await(r.isRTL==null?void 0:r.isRTL(s.floating)),o=ft(t),a=si(t),l=Je(t)==="y",d=Xb.has(o)?-1:1,u=n&&l?-1:1,f=ri(e,i);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),l?{x:m*u,y:g*d}:{x:g*d,y:m*u}}const Gb=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:n,placement:o,middlewareData:a}=e,l=await zb(e,i);return o===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+l.x,y:n+l.y,data:{...l,placement:o}}}}},Ub=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:n=!0,crossAxis:o=!1,limiter:a={fn:p=>{let{x:w,y:E}=p;return{x:w,y:E}}},...l}=ri(i,e),d={x:t,y:r},u=await dl(e,l),f=Je(ft(s)),g=cl(f);let m=d[g],x=d[f];if(n){const p=g==="y"?"top":"left",w=g==="y"?"bottom":"right",E=m+u[p],C=m-u[w];m=mr(E,m,C)}if(o){const p=f==="y"?"top":"left",w=f==="y"?"bottom":"right",E=x+u[p],C=x-u[w];x=mr(E,x,C)}const v=a.fn({...e,[g]:m,[f]:x});return{...v,data:{x:v.x-t,y:v.y-r,enabled:{[g]:n,[f]:o}}}}}};function Yi(){return typeof window<"u"}function Bt(i){return ul(i)?(i.nodeName||"").toLowerCase():"#document"}function de(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Me(i){var e;return(e=(ul(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function ul(i){return Yi()?i instanceof Node||i instanceof de(i).Node:!1}function ye(i){return Yi()?i instanceof Element||i instanceof de(i).Element:!1}function Oe(i){return Yi()?i instanceof HTMLElement||i instanceof de(i).HTMLElement:!1}function Wn(i){return!Yi()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof de(i).ShadowRoot}const qb=new Set(["inline","contents"]);function ni(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=we(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!qb.has(s)}const Zb=new Set(["table","td","th"]);function Jb(i){return Zb.has(Bt(i))}const Qb=[":popover-open",":modal"];function Vi(i){return Qb.some(e=>{try{return i.matches(e)}catch{return!1}})}const jb=["transform","translate","scale","rotate","perspective"],e_=["transform","translate","scale","rotate","perspective","filter"],t_=["paint","layout","strict","content"];function Xr(i){const e=zr(),t=ye(i)?we(i):i;return jb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||e_.some(r=>(t.willChange||"").includes(r))||t_.some(r=>(t.contain||"").includes(r))}function i_(i){let e=je(i);for(;Oe(e)&&!kt(e);){if(Xr(e))return e;if(Vi(e))return null;e=je(e)}return null}function zr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const r_=new Set(["html","body","#document"]);function kt(i){return r_.has(Bt(i))}function we(i){return de(i).getComputedStyle(i)}function Wi(i){return ye(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function je(i){if(Bt(i)==="html")return i;const e=i.assignedSlot||i.parentNode||Wn(i)&&i.host||Me(i);return Wn(e)?e.host:e}function fl(i){const e=je(i);return kt(e)?i.ownerDocument?i.ownerDocument.body:i.body:Oe(e)&&ni(e)?e:fl(e)}function qt(i,e,t){var r;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=fl(i),n=s===((r=i.ownerDocument)==null?void 0:r.body),o=de(s);if(n){const a=pr(o);return e.concat(o,o.visualViewport||[],ni(s)?s:[],a&&t?qt(a):[])}return e.concat(s,qt(s,[],t))}function pr(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function gl(i){const e=we(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Oe(i),n=s?i.offsetWidth:t,o=s?i.offsetHeight:r,a=Ti(t)!==n||Ti(r)!==o;return a&&(t=n,r=o),{width:t,height:r,$:a}}function Gr(i){return ye(i)?i:i.contextElement}function Tt(i){const e=Gr(i);if(!Oe(e))return Te(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:n}=gl(e);let o=(n?Ti(t.width):t.width)/r,a=(n?Ti(t.height):t.height)/s;return(!o||!Number.isFinite(o))&&(o=1),(!a||!Number.isFinite(a))&&(a=1),{x:o,y:a}}const s_=Te(0);function vl(i){const e=de(i);return!zr()||!e.visualViewport?s_:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function n_(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==de(i)?!1:e}function gt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),n=Gr(i);let o=Te(1);e&&(r?ye(r)&&(o=Tt(r)):o=Tt(i));const a=n_(n,t,r)?vl(n):Te(0);let l=(s.left+a.x)/o.x,d=(s.top+a.y)/o.y,u=s.width/o.x,f=s.height/o.y;if(n){const g=de(n),m=r&&ye(r)?de(r):r;let x=g,v=pr(x);for(;v&&r&&m!==x;){const p=Tt(v),w=v.getBoundingClientRect(),E=we(v),C=w.left+(v.clientLeft+parseFloat(E.paddingLeft))*p.x,b=w.top+(v.clientTop+parseFloat(E.paddingTop))*p.y;l*=p.x,d*=p.y,u*=p.x,f*=p.y,l+=C,d+=b,x=de(v),v=pr(x)}}return ki({width:u,height:f,x:l,y:d})}function Ur(i,e){const t=Wi(i).scrollLeft;return e?e.left+t:gt(Me(i)).left+t}function ml(i,e,t){t===void 0&&(t=!1);const r=i.getBoundingClientRect(),s=r.left+e.scrollLeft-(t?0:Ur(i,r)),n=r.top+e.scrollTop;return{x:s,y:n}}function o_(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const n=s==="fixed",o=Me(r),a=e?Vi(e.floating):!1;if(r===o||a&&n)return t;let l={scrollLeft:0,scrollTop:0},d=Te(1);const u=Te(0),f=Oe(r);if((f||!f&&!n)&&((Bt(r)!=="body"||ni(o))&&(l=Wi(r)),Oe(r))){const m=gt(r);d=Tt(r),u.x=m.x+r.clientLeft,u.y=m.y+r.clientTop}const g=o&&!f&&!n?ml(o,l,!0):Te(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+u.x+g.x,y:t.y*d.y-l.scrollTop*d.y+u.y+g.y}}function a_(i){return Array.from(i.getClientRects())}function l_(i){const e=Me(i),t=Wi(i),r=i.ownerDocument.body,s=ut(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),n=ut(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let o=-t.scrollLeft+Ur(i);const a=-t.scrollTop;return we(r).direction==="rtl"&&(o+=ut(e.clientWidth,r.clientWidth)-s),{width:s,height:n,x:o,y:a}}function c_(i,e){const t=de(i),r=Me(i),s=t.visualViewport;let n=r.clientWidth,o=r.clientHeight,a=0,l=0;if(s){n=s.width,o=s.height;const d=zr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:n,height:o,x:a,y:l}}const h_=new Set(["absolute","fixed"]);function d_(i,e){const t=gt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,n=Oe(i)?Tt(i):Te(1),o=i.clientWidth*n.x,a=i.clientHeight*n.y,l=s*n.x,d=r*n.y;return{width:o,height:a,x:l,y:d}}function Xn(i,e,t){let r;if(e==="viewport")r=c_(i,t);else if(e==="document")r=l_(Me(i));else if(ye(e))r=d_(e,t);else{const s=vl(i);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return ki(r)}function xl(i,e){const t=je(i);return t===e||!ye(t)||kt(t)?!1:we(t).position==="fixed"||xl(t,e)}function u_(i,e){const t=e.get(i);if(t)return t;let r=qt(i,[],!1).filter(a=>ye(a)&&Bt(a)!=="body"),s=null;const n=we(i).position==="fixed";let o=n?je(i):i;for(;ye(o)&&!kt(o);){const a=we(o),l=Xr(o);!l&&a.position==="fixed"&&(s=null),(n?!l&&!s:!l&&a.position==="static"&&s&&h_.has(s.position)||ni(o)&&!l&&xl(i,o))?r=r.filter(d=>d!==o):s=a,o=je(o)}return e.set(i,r),r}function f_(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const n=[...t==="clippingAncestors"?Vi(e)?[]:u_(e,this._c):[].concat(t),r],o=n[0],a=n.reduce((l,d)=>{const u=Xn(e,d,s);return l.top=ut(u.top,l.top),l.right=Ot(u.right,l.right),l.bottom=Ot(u.bottom,l.bottom),l.left=ut(u.left,l.left),l},Xn(e,o,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function g_(i){const{width:e,height:t}=gl(i);return{width:e,height:t}}function v_(i,e,t){const r=Oe(e),s=Me(e),n=t==="fixed",o=gt(i,!0,n,e);let a={scrollLeft:0,scrollTop:0};const l=Te(0);function d(){l.x=Ur(s)}if(r||!r&&!n)if((Bt(e)!=="body"||ni(s))&&(a=Wi(e)),r){const m=gt(e,!0,n,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else s&&d();n&&!r&&s&&d();const u=s&&!r&&!n?ml(s,a):Te(0),f=o.left+a.scrollLeft-l.x-u.x,g=o.top+a.scrollTop-l.y-u.y;return{x:f,y:g,width:o.width,height:o.height}}function hr(i){return we(i).position==="static"}function zn(i,e){if(!Oe(i)||we(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Me(i)===t&&(t=t.ownerDocument.body),t}function pl(i,e){const t=de(i);if(Vi(i))return t;if(!Oe(i)){let s=je(i);for(;s&&!kt(s);){if(ye(s)&&!hr(s))return s;s=je(s)}return t}let r=zn(i,e);for(;r&&Jb(r)&&hr(r);)r=zn(r,e);return r&&kt(r)&&hr(r)&&!Xr(r)?t:r||i_(i)||t}const m_=async function(i){const e=this.getOffsetParent||pl,t=this.getDimensions,r=await t(i.floating);return{reference:v_(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function x_(i){return we(i).direction==="rtl"}const p_={convertOffsetParentRelativeRectToViewportRelativeRect:o_,getDocumentElement:Me,getClippingRect:f_,getOffsetParent:pl,getElementRects:m_,getClientRects:a_,getDimensions:g_,getScale:Tt,isElement:ye,isRTL:x_};function yl(i,e){return i.x===e.x&&i.y===e.y&&i.width===e.width&&i.height===e.height}function y_(i,e){let t=null,r;const s=Me(i);function n(){var a;clearTimeout(r),(a=t)==null||a.disconnect(),t=null}function o(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),n();const d=i.getBoundingClientRect(),{left:u,top:f,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=wi(f),v=wi(s.clientWidth-(u+g)),p=wi(s.clientHeight-(f+m)),w=wi(u),E={rootMargin:-x+"px "+-v+"px "+-p+"px "+-w+"px",threshold:ut(0,Ot(1,l))||1};let C=!0;function b(_){const B=_[0].intersectionRatio;if(B!==l){if(!C)return o();B?o(!1,B):r=setTimeout(()=>{o(!1,1e-7)},1e3)}B===1&&!yl(d,i.getBoundingClientRect())&&o(),C=!1}try{t=new IntersectionObserver(b,{...E,root:s.ownerDocument})}catch{t=new IntersectionObserver(b,E)}t.observe(i)}return o(!0),n}function yr(i,e,t,r){r===void 0&&(r={});const{ancestorScroll:s=!0,ancestorResize:n=!0,elementResize:o=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=r,d=Gr(i),u=s||n?[...d?qt(d):[],...qt(e)]:[];u.forEach(w=>{s&&w.addEventListener("scroll",t,{passive:!0}),n&&w.addEventListener("resize",t)});const f=d&&a?y_(d,t):null;let g=-1,m=null;o&&(m=new ResizeObserver(w=>{let[E]=w;E&&E.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var C;(C=m)==null||C.observe(e)})),t()}),d&&!l&&m.observe(d),m.observe(e));let x,v=l?gt(i):null;l&&p();function p(){const w=gt(i);v&&!yl(v,w)&&t(),v=w,x=requestAnimationFrame(p)}return t(),()=>{var w;u.forEach(E=>{s&&E.removeEventListener("scroll",t),n&&E.removeEventListener("resize",t)}),f==null||f(),(w=m)==null||w.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const Di=Gb,Li=Ub,qr=Wb,w_=Vb,$i=(i,e,t)=>{const r=new Map,s={platform:p_,...t},n={...s.platform,_c:r};return Yb(i,e,{...s,platform:n})};let E_=class{constructor(i){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=i;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:r,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:n}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${n}-tooltip`,this.contentEl.className=`${n}-tooltip-content`,this.arrowEl.className=`${n}-tooltip-arrow`;const o={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:r,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},a={position:"absolute",width:"10px",height:"10px",background:o.background,backgroundColor:o.backgroundColor,transform:"rotate(45deg)",zIndex:o.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,o),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",i=>{this.floatingEl.contains(i.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||(i.ellipsis||i.message)&&this.show(i)}),this.ctx.on("visibleCellMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)}),this.ctx.on("cellFooterMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)}),this.ctx.on("cellShowTooltip",(i,e)=>{this.show(i,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(i,e){if(this.ctx.contextMenuIng||!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=i.getText();i.message&&(t=i.message),e&&(t=e);const r=this.ctx.containerElement.getBoundingClientRect();if(!r)return;this.enable=!0,this.contentEl.style.maxWidth=`${i.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=i.drawX+r.x,n=i.drawY+r.y;$i({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:s,y:n,left:s,right:s+i.visibleWidth,top:n,bottom:n+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Li(),qr(),Di(6),w_({element:this.arrowEl})]}).then(o=>{const{x:a,y:l,placement:d,middlewareData:u}=o;if(Object.assign(this.floatingEl.style,{top:`${l}px`,left:`${a}px`}),u.arrow){const f=u.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${f.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${f.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${f.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${f.x}px`,right:""})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display="none")}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class C_{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e,this.resetEditorStyle();const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r),this.focusInput()}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;const{focusCell:t}=this.ctx;if(t.isVerticalVisible()&&t.isHorizontalVisible()||this.ctx.emit("scrollToIndex",t.rowIndex,t.colIndex),e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:l}=this.ctx;l&&(this.ctx.emit("setSelectorCell",l),this.cellTarget=l),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const l=this.inputEl.selectionStart,d=this.inputEl.value.substring(0,l),u=this.inputEl.value.substring(l);this.inputEl.value=d+`
5
- `+u,this.inputEl.selectionStart=this.inputEl.selectionEnd=l+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const r=e.key,s=e.ctrlKey,n=e.altKey,o=e.shiftKey,a=e.metaKey;if(!(s||n||o||a||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(r))){if(document.activeElement!==this.inputEl){e.preventDefault();return}this.startEdit(!0)}}),this.ctx.on("cellClick",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(this.focusInput(),this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.resetEditorStyle(),this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){const{xArr:r,yArr:s}=this.ctx.selector,[n,o]=r,[a,l]=s;return!(t<n||t>o||e<a||e>l)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){if(!this.ctx.editing)return;const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,r=this.ctx.body.visibleHeight;t>r&&(t=r);const{stageHeight:s,footer:n,header:o,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,l=s-n.height-a;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+t>l&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-l}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:n,width:o,drawY:a,drawX:l}=e;this.drawX=l,this.drawY=a;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;n>f&&(n=f),this.editorEl.style.zIndex="100",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxWidth="none",this.editorEl.style.maxHeight=`${f}px`,["text"].includes(s)?(this.inputEl.style.opacity="1",this.inputEl.style.position="relative",this.inputEl.style.minWidth=`${o-1}px`,this.inputEl.style.minHeight=`${n-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${o}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",r!==null&&(this.inputEl.value=r)):(this.inputEl.style.opacity="0",this.inputEl.style.width="1px",this.inputEl.style.height="1px",this.inputEl.style.position="absolute",this.inputEl.style.left="0px",this.inputEl.style.top="0px"),(this.inputEl.scrollHeight>n||this.drawY<u.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,r=this.cellTarget.getValue(),s=this.inputEl.value;s!==r&&!(s===""&&r===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}focusInput(){document.activeElement!==this.inputEl&&this.inputEl.focus({preventScroll:!0})}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const r=this.ctx.focusCell;if(!r||["index","index-selection","selection"].includes(r.type)||this.enable||!(r.isVerticalVisible()&&r.isHorizontalVisible()))return;const{rowKey:s,key:n}=r,o=this.ctx.database.getReadonly(s,n);r&&!o&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const r=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!r)return;const s=r.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const n=this.ctx.focusCell;if(!n||["index","index-selection","selection"].includes(n.type)||this.enable)return;const{rowKey:o,key:a}=n,l=this.ctx.database.getReadonly(o,a);n&&!l&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=n,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.resetEditorStyle(),setTimeout(()=>{this.focusInput()},0),this.ctx.emit("draw"))}resetEditorStyle(){const e=this.cellTarget;e&&(this.editorEl.style.left=`${e.drawX}px`,this.editorEl.style.top=`${e.drawY}px`,this.editorEl.style.maxWidth="1px",this.editorEl.style.maxHeight="1px",this.editorEl.style.zIndex="-1")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.inputEl.blur(),this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let b_=class{constructor(i){h(this,"ctx"),h(this,"emptyEl"),this.ctx=i;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:r,headerHeight:s,bodyHeight:n,footerHeight:o})=>{const a=s+(n+o)/2,l={display:r==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,l)})}destroy(){this.emptyEl.remove()}};class __{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[r,s]of e)if(!t.has(r)||t.get(r)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Kr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const n=Number(s.getAttribute("data-row-index")),o=Number(s.getAttribute("data-col-index"));if(isNaN(n)||isNaN(o))return;const a=s.getBoundingClientRect(),l=`${n}​_${o}`;t.set(l,Math.round(a.height))});const r=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(r,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),r.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(r=>{const s=document.createElement("div");s.className=r.class,Object.assign(s.style,r.style),r.views.forEach(n=>{const o=document.createElement("div");Object.assign(o.style,n.style),n.cells.forEach(a=>{const l=document.createElement("div");Object.assign(l.style,a.style),Object.keys(a.domDataset).forEach(d=>{l.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(l,a),o.appendChild(l)}),s.appendChild(o)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:n,FOOTER_POSITION:o}=this.ctx.config;return n?o==="top"?s=[e,r,t]:s=[e,t,r]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:r,CSS_PREFIX:s}}=this.ctx,{visibleWidth:n,visibleHeight:o,renderCellHeaders:a}=this.ctx.header;let l=[],d=[],u=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?u.push(v):l.push(v))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${o}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${n-e-f+1}px`,height:`${o}px`},cells:l},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${o}px`},cells:u};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${n}px`,height:`${o}px`},views:[g,m,x]}}getBody(){const e=[],t=[],r=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?r.push(p):e.push(p))})});const{fixedLeftWidth:n,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:l}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=o-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${n}px`,height:`${u}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${n-.5}px`,overflow:"hidden",width:`${d-n-f}px`,height:`${u}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${u}px`},cells:r};return{type:"body",class:`${l}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${u}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?r.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:o,CSS_PREFIX:a}}=this.ctx,{visibleWidth:l,visibleHeight:d}=this.ctx.footer,u=n-o,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${l-s-u}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${u}px`,height:`${d}px`},cells:r};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${l}px`,height:`${d}px`},views:[f,g,m]}}}class Gn{constructor(e,t=[],r={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=r.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var r;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const n=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,n.appendChild(a)}else n.classList.add("menu-item-no-icon");const o=this.createElement("span","e-virt-table-menu-item-text");if(o.textContent=e.label,n.appendChild(o),s.appendChild(n),(r=e.children)!=null&&r.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=Si,s.appendChild(a);const l=this.createSubmenu(e.children);s._submenu=l,this.container.appendChild(l)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(r=>{t.appendChild(this.createMenuItem(r,!0))}),t}createElement(e,t=""){const r=document.createElement(e);return t&&(r.className=t),r}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const r=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");r&&(this.container.contains(r)||r.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(r):this.handleLeave(r))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(r=>r.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const r=t;r&&!r.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(r),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const r=e.closest(".e-virt-table-submenu");if(r)t=r.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(r=>{r!==e&&r._submenu&&this.hideSubmenu(r._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const r=yr(e,t,async()=>{const s=this.container.getBoundingClientRect(),n=window.innerWidth,o=t.offsetWidth||200,a=n-s.right,l=s.left,d=a>=o||a>=l?"right-start":"left-start",{x:u,y:f}=await $i(e,t,{placement:d,middleware:[Di(8),Li({padding:8})]});Object.assign(t.style,{left:`${u}px`,top:`${f}px`})});t._cleanup=r}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const r=t._submenu;if(this.activeSubmenus.has(r)){this.activeSubmenus.delete(r),r.classList.remove("show");const s=r;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(r)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const n=t._submenu||t.querySelector(".e-virt-table-submenu");if(n){this.showSubmenu(t,n);return}}const r=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(r||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,r||""))}findMenuItem(e,t=this.menuData){for(const r of t){if(r.value===e)return r;if(r.children){const s=this.findMenuItem(e,r.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.container,()=>{$i(t,this.container,{placement:"right-start",middleware:[Di(),Li(),qr()]}).then(({x:r,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${r}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const r=t.querySelector(".e-virt-table-submenu");return r&&this.cleanupSubmenuRecursively(r),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const r=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),r&&r.querySelectorAll(".e-virt-table-submenu-item").length===0){const n=this.container.querySelector("[data-menu]");if(n&&n._submenu===r)this.removeMenuItem(n.getAttribute("data-menu")||"");else{const o=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of o)if(a._submenu===r){const l=a.getAttribute("data-menu")||a.getAttribute("data-submenu");l&&(a.hasAttribute("data-menu")?this.removeMenuItem(l):this.removeSubMenuItem(l));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(r=>{r._submenu&&this.cleanupSubmenuRecursively(r._submenu)}),e.remove()}}class R_{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:r,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:n}=this.ctx.config,o=[...n,...s];if(!r||o.length===0)return;t.preventDefault();const{xArr:a,yArr:l}=this.ctx.selector,[d,u]=a,[f,g]=l,{rowIndex:m,colIndex:x}=e;m>=f&&m<=g&&x>=d&&x<=u||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Gn(this.contextMenuEl,o,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:n}=this.ctx.config,o=r,a=s||this.ctx.maxColIndex-n;if(e.colIndex<o||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:l,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:u}=this.ctx.config,f=[...l,...d];if(!u||f.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),w=f.map(E=>E.value==="visible"?{...E,children:this.filterColumns(p)}:E);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Gn(this.contextMenuEl,w,{onClick:(E,C)=>{const{xArr:b}=this.ctx.selector,[_,B]=b;if(C==="fixedLeft"||C==="fixedRight"||C==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(S=>S.colIndex>=_&&S.colIndex<=B).filter(S=>S.level===0).filter(S=>!S.column.fixedDisabled).map(S=>S.key);this.ctx.database.setCustomHeaderFixedData(K,C==="fixedLeft"?"left":C==="fixedRight"?"right":""),this.hide()}else if(C==="hide"){const K=this.ctx.header.leafCellHeaders.filter(S=>S.colIndex>=_&&S.colIndex<=B).filter(S=>!S.children.length).filter(S=>!S.column.hideDisabled).map(S=>S.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(C!=="visible")if(C.startsWith("visible_")){if(!E.key)return;if(E.children){const S=this.getLeafKeys(E.children);this.ctx.database.setCustomHeaderHideData(S,!1)}else this.ctx.database.setCustomHeaderHideData([E.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(C);const K=this.ctx.database.getColumns();Ut(K).filter(S=>S.hide).length===0&&this.hide()}else C==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};yr(t,this.contextMenuEl,()=>{$i(t,this.contextMenuEl,{placement:"right-start",middleware:[Di(),Li(),qr()]}).then(({x:r,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${r}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const r of e)if(r.children&&r.children.length>0){const s=this.filterColumns(r.children);s.length>0&&t.push({label:r.title,key:r.key,value:`visible_${r.key}`,children:s})}else r.hide&&t.push({label:r.title,value:`visible_${r.key}`,key:r.key});return t}getLeafKeys(e){return e.reduce((t,r)=>(!r.children||r.children.length===0?t.push(String(r.key)):t.push(...this.getLeafKeys(r.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class I_{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const r=this.ctx.icons.getSvg("loading");if(r){const n=new DOMParser().parseFromString(r.svg,"image/svg+xml").documentElement;t.appendChild(n)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class S_{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const n=e[s];n&&["string","number"].includes(typeof n.text)&&this.searchData.push({rowIndex:0,colIndex:n.colIndex,text:`${n.text}`,type:"header",colKey:n.key})}const{maxColIndex:t,maxRowIndex:r}=this.ctx;for(let s=0;s<r;s++)for(let n=0;n<t;n++){const o=this.ctx.database.getVirtualBodyCell(s,n,!1),a=o==null?void 0:o.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:n,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const r=al;this.loadingEl.innerHTML=r,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=Si,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=Si,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:r}=e;this.ctx.emit("scrollToIndex",t,r)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class T_{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:n,contextMenuElement:o}=this.options,a=this.createContainer(e,r,s,n,o);this.ctx=new _b(a,this.options),this.header=new Sb(this.ctx),this.footer=new Ob(this.ctx),this.body=new Tb(this.ctx),this.scroller=new Rb(this.ctx),this.selector=new kb(this.ctx),this.autofill=new Db(this.ctx),this.tooltip=new E_(this.ctx),this.empty=new b_(this.ctx),this.editor=new C_(this.ctx),this.overlayer=new __(this.ctx),this.contextMenu=new R_(this.ctx),this.loading=new I_(this.ctx),this.finderBar=new S_(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,r,s,n){e.className="e-virt-table-container";const o=document.createElement("div"),a=document.createElement("canvas"),l=t||document.createElement("div");o.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",l.className="e-virt-table-overlayer",l.setAttribute("data-overlayer",t?"custom":"default");const d=r||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=n;return o.appendChild(a),o.appendChild(l),e.appendChild(o),{containerElement:e,stageElement:o,canvasElement:a,overlayerElement:l,editorElement:d,emptyElement:u,contextMenuElement:f}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,r,s=!0,n=!0,o=!1){this.ctx.database.setItemValue(e,t,r,s,n,o)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,n=!0){this.ctx.setItemValueByEditor(e,t,r,s,n),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],r=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,r,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(r,s)=>{let n=[];for(let o=0;o<e.length;o++){const{rowKey:a,key:l}=e[o],d=await this.ctx.database.getValidator(a,l);Array.isArray(d)&&d.length&&n.push(d)}if(n.length){if(s(n),t){const[o]=n;if(Array.isArray(o)&&o.length){const[a]=o,{rowKey:l,key:d}=a;this.scrollToRowkey(l),this.scrollToColkey(d)}}this.ctx.emit("draw")}else r([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,r)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[n]=s;if(Array.isArray(n)&&n.length){const[o]=n,{rowKey:a,key:l}=o,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:u=[]}=d;u&&u.length&&this.setExpandRowKeys(u,!0)}this.scrollToRowkey(a),this.scrollToColkey(l)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:n,rowKey:o}=t;if(r!==void 0&&o===void 0){const a=this.ctx.database.getRowKeyForRowIndex(r);this.ctx.database.setValidationErrorByRowKey(a,s,n)}o&&this.ctx.database.setValidationErrorByRowKey(o,s,n)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return this.ctx.config.DISABLED?new Promise(e=>{e([])}):new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let n=[];for(let o=0;o<r.length;o++)for(let a=0;a<s.length;a++){const l=this.ctx.database.getRowKeyByItem(r[o]),d=s[a].key,u=await this.ctx.database.getValidator(l,d);Array.isArray(u)&&u.length&&n.push(u)}n.length?(t(n),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(r=>{const s=this.ctx.database.getRowKeyByItem(r);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(r=>{this.ctx.database.setRowSelection(r,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:ub,mergeRowCell:db,getSpanArrByRow:sl,getSpanObjByColumn:nl}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}getReadonly(e,t){return this.ctx.database.getReadonly(e,t)}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const O_=c.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:n}=r;if(n){const o=c.ref(s[n]);return()=>{var a,l;return((l=(a=Gt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:l.call(a,o,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Zr=c.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(i,{expose:e,emit:t}){const r=t,s=c.ref([]),n=i,o=qa(),a=c.computed(()=>({...n,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...o,...n.config}}));let l=null;const d=c.useAttrs(),u=c.ref(null),f=c.ref(null),g=c.ref(null),m=c.ref(null),x=c.ref(),v=c.ref("text"),p=c.ref(),w={},E={},C=c.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>St[y]||(({cellValue:A})=>A),_=y=>{var A;return(A=Gt.renders[y])==null?void 0:A.renderDefault},B=(y,...A)=>({row:L,rowIndex:P,value:Y})=>y({row:L,rowIndex:P,cellValue:Y},...A),K=y=>{var A,L,P,Y,V;if((A=y.slots)!=null&&A.default&&T.isFunction((L=y.slots)==null?void 0:L.default))return W=>{var z,j;return(j=(z=y.slots)==null?void 0:z.default)==null?void 0:j.call(z,{row:W.row,column:y,rowIndex:W.rowIndex})};if((P=y.slots)!=null&&P.default&&T.isString((Y=y.slots)==null?void 0:Y.default))return`slot:${(V=y.slots)==null?void 0:V.default}`;if(y.cellRender&&y.cellRender.name)return W=>{var z,j;return(j=_(y.cellRender.name))==null?void 0:j(y.cellRender,{data:n.data,row:W.row,rowIndex:W.rowIndex,field:y.field||W.column.key,title:((z=W.column)==null?void 0:z.title)??""},{})}},S=y=>{var A,L;if((A=y.slots)!=null&&A.title&&T.isFunction((L=y.slots)==null?void 0:L.title))return P=>{var Y,V;return(V=(Y=y.slots)==null?void 0:Y.title)==null?void 0:V.call(Y,{column:y})}},I=y=>{var A,L,P,Y,V,W,z;return(A=y.slots)!=null&&A.edit&&(y.field||y.key)&&T.isFunction((L=y.slots)==null?void 0:L.edit)?w[`__slot:${y.field||y.key}`]=y:(P=y.editRender)!=null&&P.name&&(y.field||y.key)&&(E[y.field||y.key]=y.editRender),{...T.omit(y,["formatter"]),key:y.key||y.field||Fe(),formatter:T.isString(y.formatter)?B(b(y.formatter)):T.isArray(y.formatter)&&T.isString(y.formatter[0])?B(b(y.formatter[0]),...y.formatter.slice(1)):T.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((Y=y.slots)!=null&&Y.edit&&(y.field||y.key)&&T.isFunction((V=y.slots)==null?void 0:V.edit)?`__slot:${y.field||y.key}`:(W=y.editRender)!=null&&W.name?y.editRender.name:void 0),render:K(y),renderHeader:S(y),children:(z=y.children)==null?void 0:z.map(j=>I(j))}};c.onMounted(()=>{u.value&&(l=new T_(u.value,{config:a.value.config,columns:n.columns.map(y=>I(y)),data:n.data,footerData:n.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(y=>{const A=d[y];if(typeof A=="function"&&y.startsWith("on")){const L=y.charAt(2).toLowerCase()+y.slice(3);l==null||l.on(L,A)}}),l.on("change",y=>{r("change",y)}),l.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),l.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),l.on("doneEdit",()=>{v.value="text"}),l.on("selectionChange",y=>{s.value=y,r("selectionChange",y)}),r("ready",l))});function R(y){if(!l||!x.value)return;const{rowKey:A,key:L}=x.value;l==null||l.setItemValueByEditor(A,L,y)}const O=()=>document.body;return c.watch(()=>n.data,y=>{l==null||l.loadData(y)},{deep:!0}),Ar(()=>n.columns,(y,A)=>{T.isEqual(y,A)||l==null||l.loadColumns(y.map(L=>I(L)))},{deep:!0}),c.watch(()=>a.value.config,y=>{l==null||l.loadConfig(y)},{deep:!0}),c.watch(()=>n.footerData,y=>{l==null||l.loadFooterData(y||[])},{deep:!0}),c.watch(()=>n.loading,(y,A)=>{y!==A&&(l==null||l.setLoading(y))},{immediate:!0}),e({$table:l,selectedRecords:c.computed(()=>s.value),reloadData:()=>{l==null||l.loadData(n.data)}}),(y,A)=>{const L=c.resolveComponent("a-empty"),P=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(P,{spinning:i.loading},{default:c.withCtx(()=>{var Y,V,W,z,j,ne,Ve;return[c.createElementVNode("div",{ref_key:"eVirtTableRef",ref:u},[c.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[v.value.startsWith("__slot:")?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(w[v.value].slots.edit({row:x.value.row,column:w[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:c.normalizeStyle(C.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":A[0]||(A[0]=be=>x.value.value=be),cell:x.value,onBlur:R},null,40,["style","value","cell"])):(Y=c.unref(Gt).renders[v.value])!=null&&Y.renderEdit?(c.openBlock(),c.createBlock(c.unref(O_),{key:1,"cell-render":E[x.value.key],class:"ev-editor-wrapper",style:c.normalizeStyle(C.value),"render-table-params":{data:n.data,row:(V=x.value)==null?void 0:V.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((z=x.value)==null?void 0:z.key)??"",title:((ne=(j=x.value)==null?void 0:j.column)==null?void 0:ne.title)??""},bordered:!1,"get-popup-container":O,onBlur:R},null,8,["cell-render","style","render-table-params"])):c.createCommentVNode("",!0)],512),c.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[c.renderSlot(y.$slots,"empty",{},()=>[c.createVNode(L,{description:"空数据"})])],512),c.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(((Ve=p.value)==null?void 0:Ve.views)||[],be=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(be.class),style:c.normalizeStyle(be.style),key:be.type},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(be.views,Ae=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle(Ae.style),key:Ae.key},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(Ae.cells,ee=>(c.openBlock(),c.createElementBlock("div",c.mergeProps({class:"canvas-cell",key:`${ee.rowKey}_${ee.key}`,style:{...ee.style}},{ref_for:!0},ee.domDataset),[typeof ee.render=="function"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(ee.render(ee)),{key:0,bordered:!1})):typeof ee.render=="string"&&ee.render.startsWith("slot:")?c.renderSlot(y.$slots,ee.render.replace("slot:",""),c.mergeProps({key:1,ref_for:!0},ee,{cell:ee})):c.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),k_={key:0},D_={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},L_={class:"flex items-center flex-1 gap-4px"},$_={key:2},M_={class:"flex items-center gap-4px"},A_={key:0,class:"w-full text-slate-5 pl-4"},wl=c.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>It().lazyReset??!1},fitHeight:{default:()=>It().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var ai,li,Be,_e,fe;const r=i,s=c.useAttrs(),n=t,{formConfig:o,pageConfig:a,columns:l,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=c.toRefs(r),m=qa(),x=c.ref(Fe()),v=c.ref({}),p=c.computed(()=>({...r,config:{...m,...r.config}})),w=c.computed(()=>u.value&&u.value.ajax?a.value?"pagination":"list":"bad");c.computed(()=>w.value==="pagination"?{current:b.page,total:B.value,pageSize:b.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const E=c.computed(()=>T.omit({labelCol:Mr,...o.value},["items"])),C=c.reactive({toolbar:!1,form:!1,table:!1}),b=c.reactive({page:1,size:((ai=a.value)==null?void 0:ai.pageSize)??10}),_=c.ref(0),B=c.ref(0),K=c.ref([]),S=c.ref(),I=c.ref(),R=c.ref(),O=c.ref(),y=c.ref(),A=c.ref(500),L=c.ref({}),P=D=>{L.value[b.page]=D},Y=c.reactive([...(((Be=(li=r.toolbarConfig)==null?void 0:li.buttons)==null?void 0:Be.map(D=>D.code))??[]).filter(D=>D),...(((fe=(_e=r.toolbarConfig)==null?void 0:_e.tools)==null?void 0:fe.map(D=>D.code))??[]).filter(D=>D)].reduce((D,H)=>(D[H]=!1,D),{})),V=(D,H)=>{Y[D]=H},W=D=>{T.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(C.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(C.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(C.table=D.table)):T.isBoolean(D)&&(C.form=D,C.toolbar=D,C.table=D)},z=c.computed(()=>T.uniq(Object.values(L.value).flat(),D=>{var H;return D[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),j=()=>{nt()},ne=c.computed(()=>z.value.map(D=>{var H;return D[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ve=(D,H)=>H?{list:T.isString(H.list)?T.get(D,H.list):T.isFunction(H.list)?H.list(D):void 0,total:T.isString(H.total)?T.get(D,H.total):T.isFunction(H.total)?H.total(D):void 0,result:T.isString(H.result)?T.get(D,H.result):T.isFunction(H.result)?H.result(D):void 0,message:T.isString(H.message)?T.get(D,H.message):T.isFunction(H.message)?H.message(D):void 0}:{list:D},be=D=>{n("toolbarButtonClick",{data:K.value,code:D,selectedKeys:ne.value,records:z.value}),Et(D)},Ae=T.debounce(be,100),ee=({key:D})=>Ae(D),Xi=D=>{n("toolbarToolClick",{data:K.value,code:D,selectedKeys:ne.value,records:z.value}),Et(D)},zi=T.debounce(Xi,100),me=()=>new Promise(D=>{if(w.value!=="bad"){W({table:!0,form:!0});const{ajax:H}=u.value;H.query({form:v.value,page:b}).then(X=>{const{list:He,total:Ft,result:Xe,message:ze}=Ve(X,u.value.response);He?(K.value=He,_.value++):Xe?(K.value=Xe,B.value=Ft??Xe.length,_.value++):(K.value=[],_.value++,ze&&Ii(ze)),D(K.value)}).catch(X=>{console.error("fetchData error",X),D([])}).finally(()=>{W({table:!1,form:!1})})}}),Gi=(D,H)=>(b.page=D,b.size=H,me()),nt=()=>(b.page=1,L.value={},me()),wt=T.debounce(me,160),oi=(D,H)=>(Object.assign(v.value,D),b.page=1,H?Promise.resolve():wt()),Ui=(D,H)=>(v.value=D,b.page=1,H?Promise.resolve():wt()),Et=D=>{const{ajax:H}=u.value;switch(D){case"multiDelete":H.multiDelete&&(ne.value.length>0?tl({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),H.multiDelete(ne.value).then(()=>{ZC("删除成功"),nt()}).catch(()=>{JC("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),Y.multiDelete=!1})}):Ii("请选择要删除的数据"));break}},qi=c.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?l.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...l.value]),ot=D=>{if(o.value&&o.value.items.length>0){if(o.value.customReset)o.value.customReset();else{const H={};zt(o.value.items,X=>{X.field&&X.itemRender?ve(X.itemRender.defaultValue)?H[X.field]=X.itemRender.defaultValue:H[X.field]=void 0:X.field&&X.slots&&(ve(X.slots.defaultValue)?H[X.field]=X.slots.defaultValue:H[X.field]=void 0)}),v.value=H}n("resetQuery")}b.page=1,D||wt()},Ct=()=>(L.value={},ot());let We=null;const Ne=()=>{We&&cancelAnimationFrame(We),We=requestAnimationFrame(()=>{if(We=null,!y.value)return;const D=y.value.getBoundingClientRect();A.value=Math.max(window.innerHeight-D.top-r.fitHeight,100)})};let xe=null;c.watch(O,D=>{xe==null||xe.disconnect(),xe=null,D&&(xe=new ResizeObserver(()=>Ne()),xe.observe(D))},{immediate:!0});let Ht,at=null;return c.onMounted(()=>{if(Ne(),window.addEventListener("resize",Ne),Ht=new MutationObserver(D=>{D.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const X=H.target;window.getComputedStyle(X).display!=="none"&&Ne()}})}),R.value){Ht.observe(R.value,{attributes:!0,attributeFilter:["style"]}),at=new ResizeObserver(()=>Ne());let D=R.value.parentElement;for(let H=0;H<5&&D&&D!==document.body;H++)at.observe(D),D=D.parentElement}ot(r.manualFetch)}),c.onBeforeUnmount(()=>{We&&cancelAnimationFrame(We),window.removeEventListener("resize",Ne),Ht.disconnect(),xe==null||xe.disconnect(),at==null||at.disconnect()}),e({commitProxy:{query:wt,reload:Ct,reloadPage:nt,passQuery:oi,forcePassQuery:Ui},$canvasTable:c.computed(()=>I.value),selectedRowKeys:ne,setBtnLoading:V,selectedRecords:z,$form:c.computed(()=>S.value),getFormData:()=>v.value,setLoadings:W,resizeTable:Ne}),(D,H)=>{var Xe,ze,Kt;const X=c.resolveComponent("a-menu-item"),He=c.resolveComponent("a-menu"),Ft=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:R,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(s)),[w.value==="bad"?(c.openBlock(),c.createElementBlock("div",k_,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(ze=(Xe=c.unref(o))==null?void 0:Xe.items)!=null&&ze.some(F=>F.field&&F.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[c.createVNode(c.unref(M.Spin),{spinning:C.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(M.Form),c.mergeProps({key:x.value,ref_key:"formEl",ref:S,model:v.value},E.value,{onSubmit:j}),{default:c.withCtx(()=>[c.createVNode(c.unref(M.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(o).items,(F,pe)=>(c.openBlock(),c.createBlock(Br,{key:`_col_${F.field||pe}`,"form-data":v.value,item:F,onReset:H[0]||(H[0]=Re=>ot(r.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(d)?(c.openBlock(),c.createElementBlock("div",D_,[c.createElementVNode("div",L_,[c.unref(d).buttons&&c.unref(d).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).buttons,(F,pe)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:pe},[F.dropdowns&&F.dropdowns.length?(c.openBlock(),c.createBlock(Ft,{key:0},{overlay:c.withCtx(()=>[c.createVNode(He,{onClick:ee},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(F.dropdowns,Re=>(c.openBlock(),c.createBlock(X,{key:Re.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(M.Button),{type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:C.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content)+" ",1),c.createVNode(c.unref(Zt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:1,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:C.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>c.unref(Ae)(F.code)},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",$_))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",M_,[c.unref(d).tools&&c.unref(d).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).tools,(F,pe)=>(c.openBlock(),c.createBlock(c.unref(M.Button),{key:pe,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>c.unref(zi)(F.code),loading:C.toolbar||!!F.code&&Y[F.code]},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(he),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{ref_key:"tableWrapperEl",ref:y,class:c.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},[(Kt=c.unref(g))!=null&&Kt.selectable&&c.unref(g).showCount?(c.openBlock(),c.createElementBlock("div",A_," 已选:"+c.toDisplayString(ne.value.length),1)):c.createCommentVNode("",!0),c.createVNode(Zr,{ref_key:"canvasTableRef",ref:I,columns:qi.value,config:{...p.value.config,HEIGHT:A.value},data:K.value,loading:C.table,onSelectionChange:P},c.createSlots({_:2},[c.renderList(D.$slots,(F,pe)=>({name:pe,fn:c.withCtx(Re=>[c.renderSlot(D.$slots,pe,c.normalizeProps(c.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),w.value==="pagination"?(c.openBlock(),c.createBlock(c.unref(M.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:b.page,"page-size":b.size,total:B.value,onChange:Gi},null,8,["current","page-size","total"])):c.createCommentVNode("",!0)],512)],64))],16)}}}),Jr=c.defineComponent({__name:"PGroupBlock",props:{name:{},getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=c.ref(),{source:s}=c.toRefs(t),n=c.computed(()=>{var a;return(a=r.value)==null?void 0:a.$form}),o=c.computed(()=>t.getFormSetting(s.value));return e({$form:n}),(a,l)=>(c.openBlock(),c.createBlock(Hr,c.mergeProps({name:i.name,ref_key:"formEl",ref:r},o.value,{data:c.unref(s)}),null,16,["name","data"]))}}),N_=c.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(i,{expose:e}){const t=i,r=c.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{r.value=[]},expand:()=>{r.value=["content"]}}),(s,n)=>{const o=c.resolveComponent("a-collapse-panel"),a=c.resolveComponent("a-collapse"),l=c.resolveComponent("a-card");return i.collapsible?(c.openBlock(),c.createBlock(a,{key:0,"active-key":r.value,"onUpdate:activeKey":n[0]||(n[0]=d=>r.value=d),class:"collapsible-card"},{default:c.withCtx(()=>[c.createVNode(o,{key:"content","force-render":"",header:i.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["header"])]),_:3},8,["active-key"])):(c.openBlock(),c.createBlock(l,{key:1,size:"small",title:i.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,u)=>({name:u,fn:c.withCtx(()=>[c.renderSlot(s.$slots,u)])}))]),1032,["title"]))}}}),El=c.defineComponent({__name:"PFormGroup",props:c.mergeModels({name:{},getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(i,{expose:e}){const t=M.Form.useForm,r=c.ref(),s=i,n=c.ref(),o=c.useModel(i,"modelValue"),a=c.ref(0),l=c.ref([]),d=c.ref([]),u=S=>{a.value=S},f=c.computed(()=>s.max??1/0),g=S=>{(s.createItem??(()=>Promise.resolve({})))({list:o.value}).then(R=>{var O;o.value=[...o.value,{...R,__index:(((O=T.max(o.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=S})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=S=>{var I,R,O,y,A,L;return((A=(y=(O=(R=(I=S==null?void 0:S.parentElement)==null?void 0:I.parentElement)==null?void 0:R.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:A.parentElement)??((L=n.value)==null?void 0:L.$el)??document.body},v=c.computed(()=>s.forceRender||o.value.length<=5),p=S=>{var R;const I=(R=o.value.find((O,y)=>y===S))==null?void 0:R.__index;q(I)&&(l.value=l.value.filter(O=>O!==I))},w=()=>{c.nextTick().then(()=>{var S,I;p(a.value),(I=(S=d.value[a.value])==null?void 0:S.$form)==null||I.validate()})},E=(S,I)=>{var R;return((R=s.getTabLabel)==null?void 0:R.call(s,S,I))??`${s.tabLabel} ${s.keepSerial?I+1:(S.__index??0)+1}`};c.watch(()=>o.value,()=>{if(!s.keepSerial){const S=o.value.filter(I=>!q(I.__index));S.length>0&&S.forEach(I=>{var R;I.__index=(((R=T.max(o.value,O=>O.__index??-1))==null?void 0:R.__index)??-1)+1})}},{immediate:!0});const C=({key:S},I,R)=>{var O;if(s.menuHandler&&T.isFunction(s.menuHandler))s.menuHandler({code:T.toString(S),data:I,index:R});else switch(S){case"delete":o.value=o.value.filter((y,A)=>A!==R),c.nextTick(()=>{d.value=d.value.filter(y=>!!y),R<=a.value&&a.value>0&&a.value--});break;case"copy":if(o.value.length>=f.value){Ii("已达到最大数量");return}o.value=[...o.value,T.clone({...T.omit(I,["id","__index"]),__index:(((O=T.max(o.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},b=T.debounce(C,100);c.watchEffect(()=>{o.value.length===0?a.value=0:a.value>=o.value.length&&(a.value=o.value.length-1)});const _=T.debounce(p,50);c.watchEffect(()=>{var R;const S=o.value.map((O,y)=>l.value.includes(O.__index)?y:void 0).filter(q),I=(R=r.value)==null?void 0:R.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,A)=>{S.includes(A)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var S,I;(I=(S=n.value)==null?void 0:S.collapse)==null||I.call(S)},expand:()=>{var S,I;(I=(S=n.value)==null?void 0:S.expand)==null||I.call(S)},activeKey:c.computed(()=>a.value),setActiveKey:u,validateAll:()=>{const S=v.value?d.value.map(I=>{var R;return(R=I.$form)==null?void 0:R.validate()}):o.value.map(I=>{var R;return((R=t(I,s.getFormSetting(I).rules))==null?void 0:R.validate())??Promise.resolve()});return Promise.allSettled(S).then(I=>{if(l.value=I.map((R,O)=>{var y;return R.status==="rejected"&&typeof((y=o.value[O])==null?void 0:y.__index)=="number"?o.value[O].__index:void 0}).filter(R=>typeof R=="number"),!s.lazyErrorMark&&l.value.length){const R=l.value[0],O=o.value.findIndex(y=>y.__index===R);O!==-1&&(a.value=O)}return l.value.length?Promise.reject({error_indexes:l.value,results:I}):Promise.resolve(I)})},validate:async(S,I)=>{var O,y,A;const R=o.value.findIndex(L=>L.__index===S);try{return await(v.value?((y=(O=d.value[R])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((A=t(o.value[R],s.getFormSetting(o.value[R]).rules))==null?void 0:A.validate())??Promise.resolve()),l.value=l.value.filter(L=>L!==S),Promise.resolve()}catch(L){return!l.value.includes(S)&&!I&&(l.value=[...l.value,S]),Promise.reject(L)}},validateFields:async(S,I,R)=>{var P,Y;const O=o.value.findIndex(V=>V.__index===S),A=s.getFormSetting(o.value[O]).rules,L=t(o.value[O],A);try{return await(v.value?((Y=(P=d.value[O])==null?void 0:P.$form)==null?void 0:Y.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(V=>L.validateField(V,o.value[O][V],A[V]??[])))),Promise.resolve()}catch(V){return!l.value.includes(S)&&!R&&(l.value=[...l.value,S]),Promise.reject(V)}}});const B=c.useSlots(),K=c.computed(()=>Object.keys(B).filter(S=>S.startsWith("group-")).map(S=>({original:S,target:S.replace("group-","")})));return(S,I)=>{const R=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(N_,{ref_key:"rootRef",ref:n,title:i.title,size:"small",collapsible:i.collapsible,"default-collapsed":i.defaultCollapsed},c.createSlots({default:c.withCtx(()=>[i.loading?(c.openBlock(),c.createBlock(R,{key:0,class:"w-full"})):(c.openBlock(),c.createBlock(c.unref(M.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:w},{rightExtra:c.withCtx(()=>[c.renderSlot(S.$slots,"rightExtra",{},()=>[i.showAdd&&o.value.length<f.value?(c.openBlock(),c.createBlock(c.unref(M.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(o.value.length))},{default:c.withCtx(()=>[...I[2]||(I[2]=[c.createTextVNode(" + 新增 ",-1)])]),_:1})):c.createCommentVNode("",!0)])]),default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(o.value,(O,y)=>(c.openBlock(),c.createBlock(c.unref(M.TabPane),{key:y,tab:E(O,y),"force-render":v.value},{closeIcon:c.withCtx(()=>{var A;return[i.editAble&&((A=c.unref(m))!=null&&A.length)?(c.openBlock(),c.createBlock(c.unref(M.Dropdown),{key:0,"get-popup-container":x},{overlay:c.withCtx(()=>[c.createVNode(c.unref(M.Menu),{onClick:L=>c.unref(b)(L,O,y)},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(m).filter(L=>{var P;return((P=L.visibleMethod)==null?void 0:P.call(L,{data:O,index:y}))??!0}),L=>(c.openBlock(),c.createBlock(c.unref(M.MenuItem),{key:L.code},{default:c.withCtx(()=>[c.createElementVNode("div",null,c.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:c.withCtx(()=>[c.createVNode(c.unref(Zt.MoreOutlined))]),_:2},1024)):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(Jr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,name:i.name?`${i.name}_${y}`:void 0,"get-form-setting":i.getFormSetting,onFocusCapture:A=>c.unref(_)(y),onClickCapture:A=>c.unref(_)(y)},null,8,["source","name","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[c.renderList(K.value,O=>({name:O.target,fn:c.withCtx(()=>[c.renderSlot(S.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),B_={class:"w-full text-right p-2"},Cl=c.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(i,{expose:e}){const t=c.ref(),r=c.ref(!1),s=i,n=c.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let o,a,l;const d=c.reactive({modal:!1}),u=()=>{l&&l()},f=()=>{d.modal=!1,l&&l()},g=({row:x,field:v})=>{o&&!n.value&&s.beforePick(x).then(()=>{d.modal=!1,o({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?Ii("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return c.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{o=x,l=v,r.value=!1,d.modal=!0,c.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,l=v,r.value=!1,d.modal=!0,c.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(c.openBlock(),c.createBlock(c.unref(M.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:i.title,width:i.width,footer:n.value?void 0:null,onCancel:u,"body-style":i.bodyStyle},c.createSlots({default:c.withCtx(()=>[c.createElementVNode("div",{style:c.normalizeStyle({minHeight:r.value?"unset":"642px"})},[c.createVNode(Fr,c.mergeProps(i.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[n.value?{name:"footer",fn:c.withCtx(()=>[c.createElementVNode("div",B_,[c.createElementVNode("span",null,[c.createVNode(c.unref(M.Button),{class:"mr-4",onClick:f},{default:c.withCtx(()=>[...v[1]||(v[1]=[c.createTextVNode(" 取消 ",-1)])]),_:1}),c.createVNode(c.unref(M.Button),{type:"primary",onClick:m},{default:c.withCtx(()=>[...v[2]||(v[2]=[c.createTextVNode(" 确定 ",-1)])]),_:1})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function bl(i){i&&Ga(i)}const H_={install(i){i.component("PForm",Hr),i.component("PGrid",Fr),i.component("PCanvasTable",Zr),i.component("PCanvasGrid",wl),i.component("PFormGroup",El),i.component("PGroupBlock",Jr),i.component("PromisePicker",Cl)},addFormatter:Ja,addRender:Nr,setup:bl};exports.PCanvasGrid=wl;exports.PCanvasTable=Zr;exports.PForm=Hr;exports.PFormGroup=El;exports.PGrid=Fr;exports.PGroupBlock=Jr;exports.PromisePicker=Cl;exports.addFormatter=Ja;exports.addRender=Nr;exports.cleanCol=Pi;exports.default=H_;exports.defaultItemResponsive=$r;exports.defaultLabelCol=Mr;exports.get24rest=Za;exports.getButtonResponsive=FC;exports.getTooltipRenderer=Ua;exports.getUIKitConfig=NC;exports.labelColDict=HC;exports.resetUIKitConfig=BC;exports.setUIKitConfig=Ga;exports.setup=bl;exports.watchPreviousDeep=Ar;
1
+ Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:`Module`}});var e=Object.create,t=Object.defineProperty,n=Object.getOwnPropertyDescriptor,r=Object.getOwnPropertyNames,i=Object.getPrototypeOf,a=Object.prototype.hasOwnProperty,o=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),s=(e,i,o,s)=>{if(i&&typeof i==`object`||typeof i==`function`)for(var c=r(i),l=0,u=c.length,d;l<u;l++)d=c[l],!a.call(e,d)&&d!==o&&t(e,d,{get:(e=>i[e]).bind(null,d),enumerable:!(s=n(i,d))||s.enumerable});return e},c=(n,r,a)=>(a=n==null?{}:e(i(n)),s(r||!n||!n.__esModule?t(a,`default`,{value:n,enumerable:!0}):a,n));let l=require(`vue`),u=require(`ant-design-vue`),d=require(`@ant-design/icons-vue`);d=c(d,1);for(var f=o(((e,t)=>{t.exports={keyId:1,cookies:{path:`/`},treeOptions:{parentKey:`parentId`,key:`id`,children:`children`},parseDateFormat:`yyyy-MM-dd HH:mm:ss`,firstDayOfWeek:1}})),p=o(((e,t)=>{function n(e,t,n){if(e)if(e.forEach)e.forEach(t,n);else for(var r=0,i=e.length;r<i;r++)t.call(n,e[r],r,e)}t.exports=n})),m=o(((e,t)=>{t.exports=Object.prototype.toString})),h=o(((e,t)=>{var n=m();function r(e){return function(t){return`[object `+e+`]`===n.call(t)}}t.exports=r})),g=o(((e,t)=>{var n=h();t.exports=Array.isArray||n(`Array`)})),_=o(((e,t)=>{function n(e,t){return e&&e.hasOwnProperty?e.hasOwnProperty(t):!1}t.exports=n})),v=o(((e,t)=>{var n=_();function r(e,t,r){if(e)for(var i in e)n(e,i)&&t.call(r,e[i],i,e)}t.exports=r})),y=o(((e,t)=>{var n=g(),r=p(),i=v();function a(e,t,a){return e&&(n(e)?r:i)(e,t,a)}t.exports=a})),b=o(((e,t)=>{function n(e){return function(t){return typeof t===e}}t.exports=n})),x=o(((e,t)=>{t.exports=b()(`function`)})),S=o(((e,t)=>{var n=y();function r(e,t){var r=Object[e];return function(e){var i=[];if(e){if(r)return r(e);n(e,t>1?function(t){i.push([``+t,e[t]])}:function(){i.push(arguments[t])})}return i}}t.exports=r})),C=o(((e,t)=>{t.exports=S()(`keys`,1)})),w=o(((e,t)=>{var n=m(),r=v(),i=p();function a(e,t){var n=e.__proto__.constructor;return t?new n(t):new n}function o(e,t){return t?s(e,t):e}function s(e,t){if(e)switch(n.call(e)){case`[object Object]`:var s=Object.create(Object.getPrototypeOf(e));return r(e,function(e,n){s[n]=o(e,t)}),s;case`[object Date]`:case`[object RegExp]`:return a(e,e.valueOf());case`[object Array]`:case`[object Arguments]`:var c=[];return i(e,function(e){c.push(o(e,t))}),c;case`[object Set]`:var l=a(e);return l.forEach(function(e){l.add(o(e,t))}),l;case`[object Map]`:var u=a(e);return u.forEach(function(e,n){u.set(n,o(e,t))}),u}return e}function c(e,t){return e&&s(e,t)}t.exports=c})),T=o(((e,t)=>{var n=p(),r=C(),i=g(),a=w(),o=Object.assign;function s(e,t,i){for(var o=t.length,s,c=1;c<o;c++)s=t[c],n(r(t[c]),i?function(t){e[t]=a(s[t],i)}:function(t){e[t]=s[t]});return e}t.exports=function(e){if(e){var t=arguments;if(e===!0){if(t.length>1)return e=i(e[1])?[]:{},s(e,t,!0)}else return o?o.apply(Object,t):s(e,t)}return e}})),E=o(((e,t)=>{var n=f(),r=p(),i=y(),a=x(),o=T(),s=function(){};function c(){r(arguments,function(e){i(e,function(e,t){s[t]=a(e)?function(){var t=e.apply(s.$context,arguments);return s.$context=null,t}:e})})}function l(e){return o(n,e)}function u(){return n}var d=`3.9.1`;s.VERSION=d,s.version=d,s.mixin=c,s.setup=l,s.setConfig=l,s.getConfig=u,t.exports=s})),D=o(((e,t)=>{function n(e,t,n){for(var r=e.length-1;r>=0;r--)t.call(n,e[r],r,e)}t.exports=n})),O=o(((e,t)=>{var n=D(),r=C();function i(e,t,i){n(r(e),function(n){t.call(i,e[n],n,e)})}t.exports=i})),k=o(((e,t)=>{function n(e){return e===null}t.exports=n})),A=o(((e,t)=>{var n=k();function r(e,t){return function(r){return n(r)?t:r[e]}}t.exports=r})),j=o(((e,t)=>{var n=y(),r=x(),i=A();function a(e,t,a){var o={};if(e)if(t)r(t)||(t=i(t)),n(e,function(n,r){o[r]=t.call(a,n,r,e)});else return e;return o}t.exports=a})),M=o(((e,t)=>{function n(e){return e?e.constructor===Object:!1}t.exports=n})),N=o(((e,t)=>{function n(e){return e!==`__proto__`&&e!==`constructor`}t.exports=n})),ee=o(((e,t)=>{var n=g(),r=M(),i=x(),a=y(),o=N();function s(e,t){return r(e)&&r(t)||n(e)&&n(t)?(a(t,function(n,r){o(r)&&(e[r]=i(t)?n:s(e[r],n))}),e):t}t.exports=function(e){e||={};for(var t=arguments,n=t.length,r,i=1;i<n;i++)r=t[i],r&&s(e,r);return e}})),P=o(((e,t)=>{var n=y();function r(e,t,r){var i=[];if(e&&arguments.length>1){if(e.map)return e.map(t,r);n(e,function(){i.push(t.apply(r,arguments))})}return i}t.exports=r})),te=o(((e,t)=>{var n=_(),r=g();function i(e,t,i,a,o){return function(s,c,l){if(s&&c){if(e&&s[e])return s[e](c,l);if(t&&r(s)){for(var u=0,d=s.length;u<d;u++)if(!!c.call(l,s[u],u,s)===a)return[!0,!1,u,s[u]][i]}else for(var f in s)if(n(s,f)&&!!c.call(l,s[f],f,s)===a)return[!0,!1,f,s[f]][i]}return o}}t.exports=i})),F=o(((e,t)=>{t.exports=te()(`some`,1,0,!0,!1)})),ne=o(((e,t)=>{t.exports=te()(`every`,1,1,!1,!0)})),re=o(((e,t)=>{var n=_();function r(e,t){if(e){if(e.includes)return e.includes(t);for(var r in e)if(n(e,r)&&t===e[r])return!0}return!1}t.exports=r})),ie=o(((e,t)=>{var n=g(),r=re();function i(e,t){var i,a=0;if(n(e)&&n(t)){for(i=t.length;a<i;a++)if(!r(e,t[a]))return!1;return!0}return r(e,t)}t.exports=i})),ae=o(((e,t)=>{var n=y(),r=re(),i=x(),a=A();function o(e,t,o){var s=[];if(t){i(t)||(t=a(t));var c,l={};n(e,function(n,r){c=t.call(o,n,r,e),l[c]||(l[c]=1,s.push(n))})}else n(e,function(e){r(s,e)||s.push(e)});return s}t.exports=o})),oe=o(((e,t)=>{var n=P();function r(e){return n(e,function(e){return e})}t.exports=r})),se=o(((e,t)=>{var n=ae(),r=oe();function i(){for(var e=arguments,t=[],i=0,a=e.length;i<a;i++)t=t.concat(r(e[i]));return n(t)}t.exports=i})),I=o(((e,t)=>{t.exports=`undefined`})),L=o(((e,t)=>{var n=I();t.exports=b()(n)})),R=o(((e,t)=>{var n=k(),r=L();function i(e){return n(e)||r(e)}t.exports=i})),ce=o(((e,t)=>{t.exports=/(.+)?\[(\d+)\]$/})),le=o(((e,t)=>{function n(e){return e?e.splice&&e.join?e:(``+e).replace(/(\[\d+\])\.?/g,`$1.`).replace(/\.$/,``).split(`.`):[]}t.exports=n})),ue=o(((e,t)=>{var n=ce(),r=le(),i=_(),a=L(),o=R();function s(e,t,n){if(o(e))return n;var r=l(e,t);return a(r)?n:r}function c(e,t){var r=t?t.match(n):``;return r?r[1]?e[r[1]]?e[r[1]][r[2]]:void 0:e[r[2]]:e[t]}function l(e,t){if(e){var n,a,s,l=0;if(e[t]||i(e,t))return e[t];if(a=r(t),s=a.length,s){for(n=e;l<s;l++)if(n=c(n,a[l]),o(n))return l===s-1?n:void 0}return n}}t.exports=s})),de=o(((e,t)=>{var n=p(),r=oe(),i=P(),a=g(),o=x(),s=M(),c=L(),l=k(),u=R(),d=ue(),f=A(),m=`asc`,h=`desc`;function _(e,t){return c(e)?1:l(e)?c(t)?-1:1:e&&e.localeCompare?e.localeCompare(t):e>t?1:-1}function v(e,t,n){return function(r,i){var a=r[e],o=i[e];return a===o?n?n(r,i):0:t.order===h?_(o,a):_(a,o)}}function y(e,t,r,i){var c=[];return r=a(r)?r:[r],n(r,function(r,l){if(r){var u=r,f;a(r)?(u=r[0],f=r[1]):s(r)&&(u=r.field,f=r.order),c.push({field:u,order:f||m}),n(t,o(u)?function(t,n){t[l]=u.call(i,t.data,n,e)}:function(e){e[l]=u?d(e.data,u):e.data})}}),c}function b(e,t,n){if(e){if(u(t))return r(e).sort(_);for(var a,o=i(e,function(e){return{data:e}}),s=y(e,o,t,n),c=s.length-1;c>=0;)a=v(c,s[c],a),c--;return a&&(o=o.sort(a)),i(o,f(`data`))}return[]}t.exports=b})),fe=o(((e,t)=>{t.exports=de()})),pe=o(((e,t)=>{function n(e,t){return e>=t?e:(e>>=0)+Math.round(Math.random()*((t||9)-e))}t.exports=n})),z=o(((e,t)=>{t.exports=S()(`values`,0)})),B=o(((e,t)=>{var n=pe(),r=z();function i(e){for(var t,i=[],a=r(e),o=a.length-1;o>=0;o--)t=o>0?n(0,o):0,i.push(a[t]),a.splice(t,1);return i}t.exports=i})),me=o(((e,t)=>{var n=B();function r(e,t){var r=n(e);return arguments.length<=1?r[0]:(t<r.length&&(r.length=t||0),r)}t.exports=r})),he=o(((e,t)=>{function n(e){return function(t){if(t){var n=e(t&&t.replace?t.replace(/,/g,``):t);if(!isNaN(n))return n}return 0}}t.exports=n})),V=o(((e,t)=>{t.exports=he()(parseFloat)})),H=o(((e,t)=>{var n=V();function r(e,t,r){var i=[],a=arguments.length;if(e){if(t=a>=2?n(t):0,r=a>=3?n(r):e.length,e.slice)return e.slice(t,r);for(;t<r;t++)i.push(e[t])}return i}t.exports=r})),ge=o(((e,t)=>{var n=y();function r(e,t,r){var i=[];if(e&&t){if(e.filter)return e.filter(t,r);n(e,function(n,a){t.call(r,n,a,e)&&i.push(n)})}return i}t.exports=r})),_e=o(((e,t)=>{t.exports=te()(``,0,2,!0)})),ve=o(((e,t)=>{t.exports=te()(`find`,1,3,!0)})),ye=o(((e,t)=>{var n=g(),r=z();function i(e,t,i){if(e){n(e)||(e=r(e));for(var a=e.length-1;a>=0;a--)if(t.call(i,e[a],a,e))return e[a]}}t.exports=i})),be=o(((e,t)=>{var n=C();function r(e,t,r){if(e){var i,a,o=0,s=null,c=r,l=arguments.length>2,u=n(e);if(e.length&&e.reduce)return a=function(){return t.apply(s,arguments)},l?e.reduce(a,c):e.reduce(a);for(l&&(o=1,c=e[u[0]]),i=u.length;o<i;o++)c=t.call(s,c,e[u[o]],o,e);return c}}t.exports=r})),xe=o(((e,t)=>{var n=g();function r(e,t,r,i){if(n(e)&&e.copyWithin)return e.copyWithin(t,r,i);var a,o,s=t>>0,c=r>>0,l=e.length,u=arguments.length>3?i>>0:l;if(s<l&&(s=s>=0?s:l+s,s>=0&&(c=c>=0?c:l+c,u=u>=0?u:l+u,c<u)))for(a=0,o=e.slice(c,u);s<l&&!(o.length<=a);s++)e[s]=o[a++];return e}t.exports=r})),Se=o(((e,t)=>{var n=g();function r(e,t){var r,i=[],a=t>>0||1;if(n(e))if(a>=0&&e.length>a)for(r=0;r<e.length;)i.push(e.slice(r,r+a)),r+=a;else i=e.length?[e]:e;return i}t.exports=r})),Ce=o(((e,t)=>{var n=P(),r=A();function i(e,t){return n(e,r(t))}t.exports=i})),we=o(((e,t)=>{var n=x(),r=R(),i=ue(),a=p();function o(e){return function(t,o){if(t&&t.length){var s,c;return a(t,function(a,l){o&&(a=n(o)?o(a,l,t):i(a,o)),!r(a)&&(r(s)||e(s,a))&&(c=l,s=a)}),t[c]}return s}}t.exports=o})),Te=o(((e,t)=>{t.exports=we()(function(e,t){return e<t})})),U=o(((e,t)=>{var n=Ce(),r=Te();function i(e){var t,i,a,o=[];if(e&&e.length)for(t=0,i=r(e,function(e){return e?e.length:0}),a=i?i.length:0;t<a;t++)o.push(n(e,t));return o}t.exports=i})),Ee=o(((e,t)=>{var n=U();function r(){return n(arguments)}t.exports=r})),De=o(((e,t)=>{var n=z(),r=y();function i(e,t){var i={};return t||=[],r(n(e),function(e,n){i[e]=t[n]}),i}t.exports=i})),Oe=o(((e,t)=>{var n=g(),r=p();function i(e,t){var a=[];return r(e,function(e){a=a.concat(n(e)?t?i(e,t):e:[e])}),a}function a(e,t){return n(e)?i(e,t):[]}t.exports=a})),ke=o(((e,t)=>{var n=P(),r=g();function i(e,t){for(var n=0,r=t.length;e&&n<r;)e=e[t[n++]];return r&&e?e:0}function a(e,t){for(var a,o=arguments,s=[],c=[],l=2,u=o.length;l<u;l++)s.push(o[l]);if(r(t)){for(u=t.length-1,l=0;l<u;l++)c.push(t[l]);t=t[u]}return n(e,function(e){if(c.length&&(e=i(e,c)),a=e[t]||t,a&&a.apply)return a.apply(e,s)})}t.exports=a})),Ae=o(((e,t)=>{function n(e,t){return(console[e]||console.log)(t)}t.exports=n})),je=o(((e,t)=>{function n(e,t){try{delete e[t]}catch{e[t]=void 0}}t.exports=n})),Me=o(((e,t)=>{var n=g(),r=D(),i=O();function a(e,t,a){return e&&(n(e)?r:i)(e,t,a)}t.exports=a})),Ne=o(((e,t)=>{t.exports=b()(`object`)})),Pe=o(((e,t)=>{var n=je(),r=M(),i=Ne(),a=g(),o=k(),s=T(),c=v();function l(e,t,l){if(e){var u,d=arguments.length>1&&(o(t)||!i(t)),f=d?l:t;if(r(e))c(e,d?function(n,r){e[r]=t}:function(t,r){n(e,r)}),f&&s(e,f);else if(a(e)){if(d)for(u=e.length;u>0;)u--,e[u]=t;else e.length=0;f&&e.push.apply(e,f)}}return e}t.exports=l})),Fe=o(((e,t)=>{var n=je(),r=x(),i=g(),a=y(),o=p(),s=Me(),c=Pe(),l=R();function u(e){return function(t,n){return n===e}}function d(e,t,d){if(e){if(!l(t)){var f=[],p=[];return r(t)||(t=u(t)),a(e,function(e,n,r){t.call(d,e,n,r)&&f.push(n)}),i(e)?s(f,function(t,n){p.push(e[t]),e.splice(t,1)}):(p={},o(f,function(t){p[t]=e[t],n(e,t)})),p}return c(e)}return e}t.exports=d})),Ie=o(((e,t)=>{var n=f(),r=Ae(),i=de(),a=w(),o=R(),s=y(),c=Fe(),l=T();function u(e,t){s(e,function(e){e[t]&&!e[t].length&&c(e,t)})}function d(e,t){var c=l({},n.treeOptions,t),d=c.strict,f=c.key,p=c.parentKey,m=c.children,h=c.mapChildren,g=c.sortKey,_=c.reverse,v=c.data,y=[],b={},x={},S,C,w;return g&&(e=i(a(e),g),_&&(e=e.reverse())),s(e,function(e){S=e[f],x[S]&&r(`warn`,`Duplicate primary key=`+S),x[S]=!0}),s(e,function(e){S=e[f],v?(C={},C[v]=e):C=e,w=e[p],b[S]=b[S]||[],C[f]=S,C[p]=w,S===w&&(w=null,r(`warn`,`Error infinite Loop. key=`+S+` parentKey=`+S)),b[w]=b[w]||[],b[w].push(C),C[m]=b[S],h&&(C[h]=b[S]),(!d||d&&o(w))&&(x[w]||y.push(C))}),d&&u(e,m),y}t.exports=d})),Le=o(((e,t)=>{var n=f(),r=p(),i=T();function a(e,t,n,i){var o=i.key,s=i.parentKey,c=i.children,l=i.data,u=i.updated,d=i.clear;return r(n,function(n){var r=n[c];l&&(n=n[l]),u!==!1&&(n[s]=t?t[o]:null),e.push(n),r&&r.length&&a(e,n,r,i),d&&delete n[c]}),e}function o(e,t){return a([],null,e,i({},n.treeOptions,t))}t.exports=o})),Re=o(((e,t)=>{function n(e){return function(t,n,r,i){var a=r||{};return e(null,t,n,i,[],[],a.children||`children`,a)}}t.exports=n})),ze=o(((e,t)=>{var n=Re();function r(e,t,n,i,a,o,s,c){if(t){var l,u,d,f,p,m;for(u=0,d=t.length;u<d;u++){if(l=t[u],f=a.concat([``+u]),p=o.concat([l]),n.call(i,l,u,t,f,e,p))return{index:u,item:l,path:f,items:t,parent:e,nodes:p};if(s&&l&&(m=r(l,l[s],n,i,f.concat([s]),p,s,c),m))return m}}}t.exports=n(r)})),Be=o(((e,t)=>{var n=Re(),r=y();function i(e,t,n,a,o,s,c,l){var u,d;r(t,function(r,f){u=o.concat([``+f]),d=s.concat([r]),n.call(a,r,f,t,u,e,d),r&&c&&(u.push(c),i(r,r[c],n,a,u,d,c,l))})}t.exports=n(i)})),Ve=o(((e,t)=>{var n=Re(),r=P();function i(e,t,n,a,o,s,c,l){var u,d,f,p=l.mapChildren||c;return r(t,function(r,m){return u=o.concat([``+m]),d=s.concat([r]),f=n.call(a,r,m,t,u,e,d),f&&r&&c&&r[c]&&(f[p]=i(r,r[c],n,a,u,d,c,l)),f})}t.exports=n(i)})),He=o(((e,t)=>{var n=Be();function r(e,t,r,i){var a=[];return e&&t&&n(e,function(e,n,r,o,s,c){t.call(i,e,n,r,o,s,c)&&a.push(e)},r),a}t.exports=r})),Ue=o(((e,t)=>{var n=Re(),r=p(),i=T();function a(e,t,n,o,s,c,l,u,d){var f,p,m,h,g,_=[],v=d.original,y=d.data,b=d.mapChildren||u,x=d.isEvery;return r(n,function(r,S){f=c.concat([``+S]),p=l.concat([r]),h=e&&!x||o.call(s,r,S,n,f,t,p),g=u&&r[u],h||g?(v?m=r:(m=i({},r),y&&(m[y]=r)),m[b]=a(h,r,r[u],o,s,f,p,u,d),(h||m[b].length)&&_.push(m)):h&&_.push(m)}),_}t.exports=n(function(e,t,n,r,i,o,s,c){return a(0,e,t,n,r,i,o,s,c)})})),We=o(((e,t)=>{function n(e,t){if(e.indexOf)return e.indexOf(t);for(var n=0,r=e.length;n<r;n++)if(t===e[n])return n}t.exports=n})),Ge=o(((e,t)=>{function n(e,t){if(e.lastIndexOf)return e.lastIndexOf(t);for(var n=e.length-1;n>=0;n--)if(t===e[n])return n;return-1}t.exports=n})),W=o(((e,t)=>{t.exports=b()(`number`)})),Ke=o(((e,t)=>{var n=W();function r(e){return n(e)&&isNaN(e)}t.exports=r})),qe=o(((e,t)=>{t.exports=b()(`string`)})),G=o(((e,t)=>{t.exports=h()(`Date`)})),K=o(((e,t)=>{t.exports=parseInt})),Je=o(((e,t)=>{function n(e){return Date.UTC(e.y,e.M||0,e.d||1,e.H||0,e.m||0,e.s||0,e.S||0)}t.exports=n})),q=o(((e,t)=>{function n(e){return e.getTime()}t.exports=n})),J=o(((e,t)=>{var n=K(),r=Je(),i=q(),a=qe(),o=G();function s(e){return`(\\d{`+e+`})`}function c(e){return e<10?e*100:e<100?e*10:e}function l(e){return isNaN(e)?e:n(e)}for(var u=s(2),d=s(`1,2`),f=s(`1,7`),p=s(`3,4`),m=`.{1}`,h=m+d,g=`(([zZ])|([-+]\\d{2}:?\\d{2}))`,_=[p,h,h,h,h,h,m+f,g],v=[],y=_.length-1;y>=0;y--){for(var b=``,x=0;x<y+1;x++)b+=_[x];v.push(RegExp(`^`+b+`$`))}function S(e){for(var t,n={},r=0,i=v.length;r<i;r++)if(t=e.match(v[r]),t){n.y=t[1],n.M=t[2],n.d=t[3],n.H=t[4],n.m=t[5],n.s=t[6],n.S=t[7],n.Z=t[8];break}return n}for(var C=[[`yyyy`,p],[`yy`,u],[`MM`,u],[`M`,d],[`dd`,u],[`d`,d],[`HH`,u],[`H`,d],[`mm`,u],[`m`,d],[`ss`,u],[`s`,d],[`SSS`,s(3)],[`S`,f],[`Z`,g]],w={},T=[`\\[([^\\]]+)\\]`],x=0;x<C.length;x++){var E=C[x];w[E[0]]=E[1]+`?`,T.push(E[0])}var D=new RegExp(T.join(`|`),`g`),O={};function k(e,t){var n=O[t];if(!n){var r=[],i=t.replace(/([$(){}*+.?\\^|])/g,`\\$1`).replace(D,function(e,t){var n=e.charAt(0);return n===`[`?t:(r.push(n),w[e])});n=O[t]={_i:r,_r:new RegExp(i)}}var a={},o=e.match(n._r);if(o){for(var s=n._i,c=1,l=o.length;c<l;c++)a[s[c-1]]=o[c];return a}return a}function A(e){if(/^[zZ]/.test(e.Z))return new Date(r(e));var t=e.Z.match(/([-+])(\d{2}):?(\d{2})/);return t?new Date(r(e)-(t[1]===`-`?-1:1)*n(t[2])*36e5+n(t[3])*6e4):new Date(``)}function j(e,t){if(e){var r=o(e);if(r||!t&&/^[0-9]{11,15}$/.test(e))return new Date(r?i(e):n(e));if(a(e)){var s=t?k(e,t):S(e);if(s.y)return s.M&&=l(s.M)-1,s.S&&=c(l(s.S.substring(0,3))),s.Z?A(s):new Date(s.y,s.M||0,s.d||1,s.H||0,s.m||0,s.s||0,s.S||0)}}return new Date(``)}t.exports=j})),Ye=o(((e,t)=>{function n(){return new Date}t.exports=n})),Xe=o(((e,t)=>{var n=G(),r=J(),i=Ye();function a(e){var t,a=e?r(e):i();return n(a)?(t=a.getFullYear(),t%4==0&&(t%100!=0||t%400==0)):!1}t.exports=a})),Ze=o(((e,t)=>{var n=g(),r=_();function i(e,t,i){if(e){if(n(e))for(var a=0,o=e.length;a<o&&t.call(i,e[a],a,e)!==!1;a++);else for(var s in e)if(r(e,s)&&t.call(i,e[s],s,e)===!1)break}}t.exports=i})),Qe=o(((e,t)=>{var n=g(),r=_();function i(e,t,i){if(e){var a,o;if(n(e))for(a=e.length-1;a>=0&&t.call(i,e[a],a,e)!==!1;a--);else for(o=r(e),a=o.length-1;a>=0&&t.call(i,e[o[a]],o[a],e)!==!1;a--);}}t.exports=i})),$e=o(((e,t)=>{var n=g(),r=qe(),i=_();function a(e,t){return function(a,o){if(a){if(a[e])return a[e](o);if(r(a)||n(a))return t(a,o);for(var s in a)if(i(a,s)&&o===a[s])return s}return-1}}t.exports=a})),et=o(((e,t)=>{t.exports=$e()(`indexOf`,We())})),tt=o(((e,t)=>{t.exports=$e()(`lastIndexOf`,Ge())})),nt=o(((e,t)=>{var n=g(),r=qe(),i=y();function a(e){var t=0;return r(e)||n(e)?e.length:(i(e,function(){t++}),t)}t.exports=a})),rt=o(((e,t)=>{var n=W();function r(e){return n(e)&&isFinite(e)}t.exports=r})),it=o(((e,t)=>{var n=g(),r=k();t.exports=function(e){return!r(e)&&!isNaN(e)&&!n(e)&&e%1==0}})),at=o(((e,t)=>{var n=g(),r=it(),i=k();function a(e){return!i(e)&&!isNaN(e)&&!n(e)&&!r(e)}t.exports=a})),ot=o(((e,t)=>{t.exports=b()(`boolean`)})),st=o(((e,t)=>{t.exports=h()(`RegExp`)})),ct=o(((e,t)=>{t.exports=h()(`Error`)})),lt=o(((e,t)=>{function n(e){return e?e.constructor===TypeError:!1}t.exports=n})),ut=o(((e,t)=>{function n(e){for(var t in e)return!1;return!0}t.exports=n})),dt=o(((e,t)=>{var n=I(),r=typeof Symbol!==n;function i(e){return r&&Symbol.isSymbol?Symbol.isSymbol(e):typeof e==`symbol`}t.exports=i})),ft=o(((e,t)=>{t.exports=h()(`Arguments`)})),pt=o(((e,t)=>{var n=qe(),r=W();function i(e){return!!(e&&n(e.nodeName)&&r(e.nodeType))}t.exports=i})),mt=o(((e,t)=>{var n=I();t.exports=typeof document===n?0:document})),ht=o(((e,t)=>{var n=mt();function r(e){return!!(e&&n&&e.nodeType===9)}t.exports=r})),gt=o(((e,t)=>{var n=I();t.exports=typeof window===n?0:window})),_t=o(((e,t)=>{var n=gt();function r(e){return!!(n&&e&&e===e.window)}t.exports=r})),vt=o(((e,t)=>{var n=I(),r=typeof FormData!==n;function i(e){return r&&e instanceof FormData}t.exports=i})),yt=o(((e,t)=>{var n=I(),r=typeof Map!==n;function i(e){return r&&e instanceof Map}t.exports=i})),bt=o(((e,t)=>{var n=I(),r=typeof WeakMap!==n;function i(e){return r&&e instanceof WeakMap}t.exports=i})),xt=o(((e,t)=>{var n=I(),r=typeof Set!==n;function i(e){return r&&e instanceof Set}t.exports=i})),St=o(((e,t)=>{var n=I(),r=typeof WeakSet!==n;function i(e){return r&&e instanceof WeakSet}t.exports=i})),Ct=o(((e,t)=>{var n=x(),r=qe(),i=g(),a=_();function o(e){return function(t,o,s){if(t&&n(o)){if(i(t)||r(t))return e(t,o,s);for(var c in t)if(a(t,c)&&o.call(s,t[c],c,t))return c}return-1}}t.exports=o})),wt=o(((e,t)=>{t.exports=Ct()(function(e,t,n){for(var r=0,i=e.length;r<i;r++)if(t.call(n,e[r],r,e))return r;return-1})})),Tt=o(((e,t)=>{var n=W(),r=g(),i=qe(),a=st(),o=G(),s=ot(),c=L(),l=C(),u=ne();function d(e,t,f,p,m,h,g){if(e===t)return!0;if(e&&t&&!n(e)&&!n(t)&&!i(e)&&!i(t)){if(a(e))return f(``+e,``+t,m,h,g);if(o(e)||s(e))return f(+e,+t,m,h,g);var _,v,y,b=r(e),x=r(t);if(b||x?b&&x:e.constructor===t.constructor)return v=l(e),y=l(t),p&&(_=p(e,t,m)),v.length===y.length?c(_)?u(v,function(n,r){return n===y[r]&&d(e[n],t[y[r]],f,p,b||x?r:n,e,t)}):!!_:!1}return f(e,t,m,h,g)}t.exports=d})),Et=o(((e,t)=>{function n(e,t){return e===t}t.exports=n})),Dt=o(((e,t)=>{var n=Tt(),r=Et();function i(e,t){return n(e,t,r)}t.exports=i})),Ot=o(((e,t)=>{var n=C(),r=wt(),i=Dt(),a=F(),o=ie();function s(e,t){var s=n(e),c=n(t);if(c.length){if(o(s,c))return a(c,function(n){return r(s,function(r){return r===n&&i(e[r],t[n])})>-1})}else return!0;return i(e,t)}t.exports=s})),kt=o(((e,t)=>{var n=Tt(),r=Et(),i=x(),a=L();function o(e,t,o){return i(o)?n(e,t,function(e,t,n,i,s){var c=o(e,t,n,i,s);return a(c)?r(e,t):!!c},o):n(e,t,r)}t.exports=o})),At=o(((e,t)=>{var n=dt(),r=G(),i=g(),a=st(),o=ct(),s=k();function c(e){return s(e)?`null`:n(e)?`symbol`:r(e)?`date`:i(e)?`array`:a(e)?`regexp`:o(e)?`error`:typeof e}t.exports=c})),jt=o(((e,t)=>{var n=f(),r=R();function i(e){return``+(r(e)?``:e)+ n.keyId++}t.exports=i})),Mt=o(((e,t)=>{t.exports=Ct()(function(e,t,n){for(var r=e.length-1;r>=0;r--)if(t.call(n,e[r],r,e))return r;return-1})})),Nt=o(((e,t)=>{var n=M(),r=qe();function i(e){if(n(e))return e;if(r(e))try{return JSON.parse(e)}catch{}return{}}t.exports=i})),Pt=o(((e,t)=>{var n=R();function r(e){return n(e)?``:JSON.stringify(e)}t.exports=r})),Ft=o(((e,t)=>{t.exports=S()(`entries`,2)})),It=o(((e,t)=>{var n=x(),r=g(),i=y(),a=wt();function o(e,t){return function(o,s){var c,l,u={},d=[],f=this,p=arguments,m=p.length;if(!n(s)){for(l=1;l<m;l++)c=p[l],d.push.apply(d,r(c)?c:[c]);s=0}return i(o,function(n,r){((s?s.call(f,n,r,o):a(d,function(e){return e===r})>-1)?e:t)&&(u[r]=n)}),u}}t.exports=o})),Lt=o(((e,t)=>{t.exports=It()(1,0)})),Rt=o(((e,t)=>{t.exports=It()(0,1)})),zt=o(((e,t)=>{var n=z();function r(e){return n(e)[0]}t.exports=r})),Bt=o(((e,t)=>{var n=z();function r(e){var t=n(e);return t[t.length-1]}t.exports=r})),Vt=o(((e,t)=>{var n=ce(),r=le(),i=_();function a(e,t){if(e){if(i(e,t))return!0;var a,o,s,c,l,u,d=r(t),f=0,p=d.length;for(l=e;f<p&&(u=!1,a=d[f],c=a?a.match(n):``,c?(o=c[1],s=c[2],o?l[o]&&i(l[o],s)&&(u=!0,l=l[o][s]):i(l,s)&&(u=!0,l=l[s])):i(l,a)&&(u=!0,l=l[a]),u);f++)if(f===p-1)return!0}return!1}t.exports=a})),Ht=o(((e,t)=>{var n=K(),r=le(),i=N(),a=_(),o=/(.+)?\[(\d+)\]$/;function s(e,t,r,i,a){if(e[t])r&&(e[t]=a);else{var s,c,l=t?t.match(o):null;if(r)c=a;else{var u=i?i.match(o):null;c=u&&!u[1]?Array(n(u[2])+1):{}}return l?l[1]?(s=n(l[2]),e[l[1]]?r?e[l[1]][s]=c:e[l[1]][s]?c=e[l[1]][s]:e[l[1]][s]=c:(e[l[1]]=Array(s+1),e[l[1]][s]=c)):e[l[2]]=c:e[t]=c,c}return e[t]}function c(e,t,n){if(e&&i(t)){if((e[t]||a(e,t))&&!l(t))e[t]=n;else for(var o=e,c=r(t),u=c.length,d=0;d<u;d++)if(!l(c[d])){var f=d===u-1;o=s(o,c[d],f,f?null:c[d+1],n)}}return e}function l(e){return e===`__proto__`||e===`constructor`||e===`prototype`}t.exports=c})),Ut=o(((e,t)=>{var n=ut(),r=Ne(),i=x(),a=A(),o=y();function s(e){return function(){return n(e)}}function c(e,t,n){var c,l={};return e&&(t&&r(t)?t=s(t):i(t)||(t=a(t)),o(e,function(r,i){c=t?t.call(n,r,i,e):r,l[c]?l[c].push(r):l[c]=[r]})),l}t.exports=c})),Wt=o(((e,t)=>{var n=Ut(),r=v();function i(e,t,i){var a=n(e,t,i||this);return r(a,function(e,t){a[t]=e.length}),a}t.exports=i})),Gt=o(((e,t)=>{function n(e,t,n){var r,i,a=[],o=arguments;if(o.length<2&&(t=o[0],e=0),r=e>>0,i=t>>0,r<t)for(n=n>>0||1;r<i;r+=n)a.push(r);return a}t.exports=n})),Kt=o(((e,t)=>{var n=C(),r=H(),i=re(),a=p(),o=T();function s(e,t){if(e&&t){var s=o.apply(this,[{}].concat(r(arguments,1))),c=n(s);a(n(e),function(t){i(c,t)&&(e[t]=s[t])})}return e}t.exports=s})),qt=o(((e,t)=>{t.exports=we()(function(e,t){return e>t})})),Jt=o(((e,t)=>{function n(e){return(e.split(`.`)[1]||``).length}t.exports=n})),Yt=o(((e,t)=>{var n=K();function r(e,t){if(e.repeat)return e.repeat(t);var r=isNaN(t)?[]:Array(n(t));return r.join(e)+(r.length>0?e:``)}t.exports=r})),Xt=o(((e,t)=>{function n(e,t){return e.substring(0,t)+`.`+e.substring(t,e.length)}t.exports=n})),Zt=o(((e,t)=>{var n=Yt(),r=Xt();function i(e){var t=``+e,i=t.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(i){var a=e<0?`-`:``,o=i[3]||``,s=i[5]||``,c=i[6]||``,l=i[7],u=i[8],d=u-c.length,f=u-o.length,p=u-s.length;return l===`+`?o?a+o+n(`0`,u):d>0?a+s+c+n(`0`,d):a+s+r(c,u):o?f>0?a+`0.`+n(`0`,Math.abs(f))+o:a+r(o,f):p>0?a+`0.`+n(`0`,Math.abs(p))+s+c:a+r(s,p)+c}return t}t.exports=i})),Qt=o(((e,t)=>{var n=Jt(),r=Zt();function i(e,t){var i=r(e),a=r(t);return parseInt(i.replace(`.`,``))*parseInt(a.replace(`.`,``))/10**(n(i)+n(a))}t.exports=i})),$t=o(((e,t)=>{var n=Qt(),r=V(),i=Zt();function a(e){return function(t,a){var o=r(t),s=o;if(o){a>>=0;var c=i(o).split(`.`),l=c[0],u=c[1]||``,d=u.substring(0,a+1),f=l+(d?`.`+d:``);if(a>=u.length)return r(f);if(f=o,a>0){var p=10**a;s=Math[e](n(f,p))/p}else s=Math[e](f)}return s}}t.exports=a})),en=o(((e,t)=>{t.exports=$t()(`round`)})),tn=o(((e,t)=>{t.exports=$t()(`ceil`)})),nn=o(((e,t)=>{t.exports=$t()(`floor`)})),rn=o(((e,t)=>{var n=R(),r=W(),i=Zt();function a(e){return r(e)?i(e):``+(n(e)?``:e)}t.exports=a})),an=o(((e,t)=>{var n=en(),r=rn(),i=Yt(),a=Xt();function o(e,t){t>>=0;var o=r(n(e,t)).split(`.`),s=o[0],c=o[1]||``,l=t-c.length;return t?l>0?s+`.`+c+i(`0`,l):s+a(c,Math.abs(l)):s}t.exports=o})),on=o(((e,t)=>{var n=f(),r=en(),i=tn(),a=nn(),o=W(),s=rn(),c=an(),l=Zt(),u=T();function d(e,t){var d=u({},n.commafyOptions,t),f=d.digits,p=o(e),m,h,g,_,v;return p?(m=(d.ceil?i:d.floor?a:r)(e,f),h=l(f?c(m,f):m).split(`.`),_=h[0],v=h[1],g=_&&m<0,g&&(_=_.substring(1,_.length))):(m=s(e).replace(/,/g,``),h=m?[m]:[],_=h[0]),h.length?(g?`-`:``)+_.replace(RegExp(`(?=(?!(\\b))(.{`+(d.spaceNumber||3)+`})+$)`,`g`),d.separator||`,`)+(v?`.`+v:``):m}t.exports=d})),sn=o(((e,t)=>{var n=K();t.exports=he()(n)})),cn=o(((e,t)=>{var n=Qt(),r=V();function i(e,t){return n(r(e),r(t))}t.exports=i})),ln=o(((e,t)=>{var n=Jt(),r=Zt(),i=cn();function a(e,t){var a=r(e),o=r(t),s=10**Math.max(n(a),n(o));return(i(e,s)+i(t,s))/s}t.exports=a})),un=o(((e,t)=>{var n=ln(),r=V();function i(e,t){return n(r(e),r(t))}t.exports=i})),dn=o(((e,t)=>{var n=Jt(),r=Zt(),i=V(),a=an();function o(e,t){var o=i(e),s=i(t),c=r(o),l=r(s),u=n(c),d=n(l),f=10**Math.max(u,d),p=u>=d?u:d;return parseFloat(a((o*f-s*f)/f,p))}t.exports=o})),fn=o(((e,t)=>{var n=Jt(),r=Zt(),i=cn();function a(e,t){var a=r(e),o=r(t),s=n(a),c=n(o)-s,l=c<0,u=10**(l?Math.abs(c):c);return i(a.replace(`.`,``)/o.replace(`.`,``),l?1/u:u)}t.exports=a})),pn=o(((e,t)=>{var n=fn(),r=V();function i(e,t){return n(r(e),r(t))}t.exports=i})),mn=o(((e,t)=>{var n=ln(),r=x(),i=g(),a=y(),o=ue();function s(e,t,s){var c=0;return a(e&&e.length>2&&i(e)?e.sort():e,t?r(t)?function(){c=n(c,t.apply(s,arguments))}:function(e){c=n(c,o(e,t))}:function(e){c=n(c,e)}),c}t.exports=s})),hn=o(((e,t)=>{var n=fn(),r=nt(),i=mn();function a(e,t,a){return n(i(e,t,a),r(e))}t.exports=a})),gn=o(((e,t)=>{t.exports=`first`})),_n=o(((e,t)=>{t.exports=`last`})),vn=o(((e,t)=>{function n(e){return e.getFullYear()}t.exports=n})),yn=o(((e,t)=>{t.exports=864e5})),bn=o(((e,t)=>{function n(e){return e.getMonth()}t.exports=n})),Y=o(((e,t)=>{var n=G(),r=q();function i(e){return n(e)&&!isNaN(r(e))}t.exports=i})),xn=o(((e,t)=>{var n=gn(),r=_n(),i=yn(),a=vn(),o=q(),s=bn(),c=J(),l=Y(),u=W();function d(e,t,f){var p=t&&!isNaN(t)?t:0;if(e=c(e),l(e)){if(f===n)return new Date(a(e),s(e)+p,1);if(f===r)return new Date(o(d(e,p+1,n))-1);if(u(f)&&e.setDate(f),p){var m=e.getDate();if(e.setMonth(s(e)+p),m!==e.getDate())return e.setDate(1),new Date(o(e)-i)}}return e}t.exports=d})),Sn=o(((e,t)=>{var n=gn(),r=_n(),i=vn(),a=xn(),o=J(),s=Y();function c(e,t,c){var l;if(e=o(e),s(e)&&(t&&(l=t&&!isNaN(t)?t:0,e.setFullYear(i(e)+l)),c||!isNaN(c))){if(c===n)return new Date(i(e),0,1);if(c===r)return e.setMonth(11),a(e,0,r);e.setMonth(c)}return e}t.exports=c})),Cn=o(((e,t)=>{var n=xn(),r=J(),i=Y();function a(e){var t=e.getMonth();return t<3?1:t<6?2:t<9?3:4}function o(e,t,o){var s,c=t&&!isNaN(t)?t*3:0;return e=r(e),i(e)?(s=(a(e)-1)*3,e.setMonth(s),n(e,c,o)):e}t.exports=o})),wn=o(((e,t)=>{t.exports=yn()*7})),Tn=o(((e,t)=>{var n=f(),r=yn(),i=wn(),a=q(),o=J(),s=Y(),c=W();function l(e,t,l,u){if(e=o(e),s(e)){var d=c(l),f=c(u),p=a(e);if(d||f){var m=f?u:n.firstDayOfWeek,h=e.getDay(),g=d?l:h;if(h!==g){var _=0;m>h?_=-(7-m+h):m<h&&(_=m-h),g>m?p+=((g===0?7:g)-m+_)*r:g<m?p+=(7-m+g+_)*r:p+=_*r}}return t&&!isNaN(t)&&(p+=t*i),new Date(p)}return e}t.exports=l})),En=o(((e,t)=>{var n=gn(),r=_n(),i=K(),a=vn(),o=bn(),s=q(),c=J(),l=Y();function u(e,t,d){if(e=c(e),l(e)&&!isNaN(t)){if(e.setDate(e.getDate()+i(t)),d===n)return new Date(a(e),o(e),e.getDate());if(d===r)return new Date(s(u(e,1,n))-1)}return e}t.exports=u})),Dn=o(((e,t)=>{var n=gn(),r=_n(),i=K(),a=vn(),o=bn(),s=q(),c=J(),l=Y();function u(e,t,d){if(e=c(e),l(e)&&!isNaN(t)){if(e.setHours(e.getHours()+i(t)),d===n)return new Date(a(e),o(e),e.getDate(),e.getHours());if(d===r)return new Date(s(u(e,1,n))-1)}return e}t.exports=u})),On=o(((e,t)=>{var n=gn(),r=_n(),i=K(),a=vn(),o=bn(),s=q(),c=J(),l=Y();function u(e,t,d){if(e=c(e),l(e)&&!isNaN(t)){if(e.setMinutes(e.getMinutes()+i(t)),d===n)return new Date(a(e),o(e),e.getDate(),e.getHours(),e.getMinutes());if(d===r)return new Date(s(u(e,1,n))-1)}return e}t.exports=u})),kn=o(((e,t)=>{var n=gn(),r=_n(),i=K(),a=vn(),o=bn(),s=q(),c=J(),l=Y();function u(e,t,d){if(e=c(e),l(e)&&!isNaN(t)){if(e.setSeconds(e.getSeconds()+i(t)),d===n)return new Date(a(e),o(e),e.getDate(),e.getHours(),e.getMinutes(),e.getSeconds());if(d===r)return new Date(s(u(e,1,n))-1)}return e}t.exports=u})),An=o(((e,t)=>{function n(e){return e.toUpperCase()}t.exports=n})),jn=o(((e,t)=>{var n=f(),r=yn(),i=wn(),a=W(),o=re(),s=J(),c=Y(),l=Tn(),u=Gt(),d=P(),p=q(),m=d(u(0,7),function(e){return[(e+1)%7,(e+2)%7,(e+3)%7]});function h(e,t){var n=new Date(e).getDay();return o(m[t],n)}function g(e,t){return function(o,u){var d=a(u)?u:n.firstDayOfWeek,f=s(o);if(c(f)){var m=l(f,0,d,d),g=e(m),_=p(g),v=p(m),y=v+r*6,b=new Date(y),x=l(g,0,d,d),S=p(x),C;if(v===S)return 1;if(t(m,b)){for(C=p(e(b));C<y;C+=r)if(h(C,d))return 1}var w=S+r*6,T=new Date(y),E=1;if(t(x,T)){for(E=0,C=_;C<w;C+=r)if(h(C,d)){E++;break}}return Math.floor((v-S)/i)+E}return NaN}}t.exports=g})),Mn=o(((e,t)=>{t.exports=jn()(function(e){return new Date(e.getFullYear(),0,1)},function(e,t){return e.getFullYear()!==t.getFullYear()})})),Nn=o(((e,t)=>{var n=vn(),r=bn();function i(e){return new Date(n(e),r(e),e.getDate())}t.exports=i})),Pn=o(((e,t)=>{var n=q(),r=Nn();function i(e){return n(r(e))}t.exports=i})),Fn=o(((e,t)=>{var n=yn(),r=gn(),i=Pn(),a=Sn(),o=J(),s=Y();function c(e){return e=o(e),s(e)?Math.floor((i(e)-i(a(e,0,r)))/n)+1:NaN}t.exports=c})),In=o(((e,t)=>{var n=rn(),r=L(),i=Yt();function a(e,t,a){var o=n(e);return t>>=0,a=r(a)?` `:``+a,o.padStart?o.padStart(t,a):t>o.length?(t-=o.length,t>a.length&&(a+=i(a,t/a.length)),a.slice(0,t)+o):o}t.exports=a})),Ln=o(((e,t)=>{var n=f(),r=An(),i=vn(),a=bn(),o=J(),s=Mn(),c=Fn(),l=T(),u=Y(),d=x(),p=R(),m=In();function h(e,t,n,r){var i=t[n];return i?d(i)?i(r,n,e):i[r]:r}var g=/\[([^\]]+)]|y{2,4}|M{1,2}|d{1,2}|H{1,2}|h{1,2}|m{1,2}|s{1,2}|S{1,3}|Z{1,2}|W{1,2}|D{1,3}|[aAeEq]/g;function _(e,t,d){if(e){if(e=o(e),u(e)){var f=d||{},_=t||n.parseDateFormat||n.formatString,v=e.getHours(),y=v<12?`am`:`pm`,b=l({},n.parseDateRules||n.formatStringMatchs,f.formats),x=function(t,n){return(``+i(e)).substring(4-n)},S=function(t,n){return m(a(e)+1,n,`0`)},C=function(t,n){return m(e.getDate(),n,`0`)},w=function(e,t){return m(v,t,`0`)},T=function(e,t){return m(v<=12?v:v-12,t,`0`)},E=function(t,n){return m(e.getMinutes(),n,`0`)},D=function(t,n){return m(e.getSeconds(),n,`0`)},O=function(t,n){return m(e.getMilliseconds(),n,`0`)},k=function(t,n){var r=e.getTimezoneOffset()/60*-1;return h(e,b,t,(r>=0?`+`:`-`)+m(r,2,`0`)+(n===1?`:`:``)+`00`)},A=function(t,r){return m(h(e,b,t,s(e,p(f.firstDay)?n.firstDayOfWeek:f.firstDay)),r,`0`)},j=function(t,n){return m(h(e,b,t,c(e)),n,`0`)},M={yyyy:x,yy:x,MM:S,M:S,dd:C,d:C,HH:w,H:w,hh:T,h:T,mm:E,m:E,ss:D,s:D,SSS:O,S:O,ZZ:k,Z:k,WW:A,W:A,DDD:j,D:j,a:function(t){return h(e,b,t,y)},A:function(t){return h(e,b,t,r(y))},e:function(t){return h(e,b,t,e.getDay())},E:function(t){return h(e,b,t,e.getDay())},q:function(t){return h(e,b,t,Math.floor((a(e)+3)/3))}};return _.replace(g,function(e,t){return t||(M[e]?M[e](e,e.length):e)})}return`Invalid Date`}return``}t.exports=_})),Rn=o(((e,t)=>{var n=q(),r=Ye();t.exports=Date.now||function(){return n(r())}})),zn=o(((e,t)=>{var n=q(),r=Rn(),i=J(),a=G();t.exports=function(e,t){if(e){var o=i(e,t);return a(o)?n(o):o}return r()}})),Bn=o(((e,t)=>{var n=Ln();function r(e,t,r){return e&&t?(e=n(e,r),e!==`Invalid Date`&&e===n(t,r)):!1}t.exports=r})),Vn=o(((e,t)=>{t.exports=jn()(function(e){return new Date(e.getFullYear(),e.getMonth(),1)},function(e,t){return e.getMonth()!==t.getMonth()})})),Hn=o(((e,t)=>{var n=Sn(),r=J(),i=Y(),a=Xe();function o(e,t){return e=r(e),i(e)?a(n(e,t))?366:365:NaN}t.exports=o})),Un=o(((e,t)=>{var n=yn(),r=gn(),i=_n(),a=q(),o=xn(),s=J(),c=Y();function l(e,t){return e=s(e),c(e)?Math.floor((a(o(e,t,i))-a(o(e,t,r)))/n)+1:NaN}t.exports=l})),Wn=o(((e,t)=>{var n=q(),r=Ye(),i=J(),a=Y(),o=[[`yyyy`,31536e6],[`MM`,2592e6],[`dd`,864e5],[`HH`,36e5],[`mm`,6e4],[`ss`,1e3],[`S`,0]];function s(e,t){var s,c,l,u,d,f,p={done:!1,status:!1,time:0};if(e=i(e),t=t?i(t):r(),a(e)&&a(t)&&(s=n(e),c=n(t),s<c))for(u=p.time=c-s,p.done=!0,p.status=!0,f=0,d=o.length;f<d;f++)l=o[f],u>=l[1]?f===d-1?p[l[0]]=u||0:(p[l[0]]=Math.floor(u/l[1]),u-=p[l[0]]*l[1]):p[l[0]]=0;return p}t.exports=s})),Gn=o(((e,t)=>{var n=rn(),r=L(),i=Yt();function a(e,t,a){var o=n(e);return t>>=0,a=r(a)?` `:``+a,o.padEnd?o.padEnd(t,a):t>o.length?(t-=o.length,t>a.length&&(a+=i(a,t/a.length)),o+a.slice(0,t)):o}t.exports=a})),Kn=o(((e,t)=>{var n=rn(),r=Yt();function i(e,t){return r(n(e),t)}t.exports=i})),qn=o(((e,t)=>{var n=rn();function r(e){return e&&e.trimRight?e.trimRight():n(e).replace(/[\s\uFEFF\xA0]+$/g,``)}t.exports=r})),Jn=o(((e,t)=>{var n=rn();function r(e){return e&&e.trimLeft?e.trimLeft():n(e).replace(/^[\s\uFEFF\xA0]+/g,``)}t.exports=r})),Yn=o(((e,t)=>{var n=qn(),r=Jn();function i(e){return e&&e.trim?e.trim():n(r(e))}t.exports=i})),Xn=o(((e,t)=>{t.exports={"&":`&amp;`,"<":`&lt;`,">":`&gt;`,'"':`&quot;`,"'":`&#x27;`,"`":`&#x60;`}})),Zn=o(((e,t)=>{var n=rn(),r=C();function i(e){var t=RegExp(`(?:`+r(e).join(`|`)+`)`,`g`);return function(r){return n(r).replace(t,function(t){return e[t]})}}t.exports=i})),Qn=o(((e,t)=>{var n=Xn();t.exports=Zn()(n)})),$n=o(((e,t)=>{var n=Xn(),r=Zn(),i=y(),a={};i(n,function(e,t){a[n[t]]=t}),t.exports=r(a)})),er=o(((e,t)=>{function n(e,t,n){return e.substring(t,n)}t.exports=n})),tr=o(((e,t)=>{function n(e){return e.toLowerCase()}t.exports=n})),nr=o(((e,t)=>{var n=rn(),r=er(),i=An(),a=tr(),o={};function s(e){if(e=n(e),o[e])return o[e];var t=e.length,s=e.replace(/([-]+)/g,function(e,n,r){return r&&r+n.length<t?`-`:``});return t=s.length,s=s.replace(/([A-Z]+)/g,function(e,n,o){var s=n.length;return n=a(n),o?s>2&&o+s<t?i(r(n,0,1))+r(n,1,s-1)+i(r(n,s-1,s)):i(r(n,0,1))+r(n,1,s):s>1&&o+s<t?r(n,0,s-1)+i(r(n,s-1,s)):n}).replace(/(-[a-zA-Z])/g,function(e,t){return i(r(t,1,t.length))}),o[e]=s,s}t.exports=s})),rr=o(((e,t)=>{var n=rn(),r=er(),i=tr(),a={};function o(e){if(e=n(e),a[e])return a[e];if(/^[A-Z]+$/.test(e))return i(e);var t=e.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(e,t,n,a){var o=n.length;return o>1?t+`-`+i(r(n,0,o-1))+`-`+i(r(n,o-1,o))+a:i(t+`-`+n+a)}).replace(/^([A-Z]+)([a-z]+)?$/,function(e,t,n){var a=t.length;return i(r(t,0,a-1)+`-`+r(t,a-1,a)+(n||``))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(e,t,n,a,o){var s=n.length;return s>1&&(t&&(t+=`-`),a)?(t||``)+i(r(n,0,s-1))+`-`+i(r(n,s-1,s))+a:(t||``)+(o?`-`:``)+i(n)+(a||``)});return t=t.replace(/([-]+)/g,function(e,n,r){return r&&r+n.length<t.length?`-`:``}),a[e]=t,t}t.exports=o})),ir=o(((e,t)=>{var n=rn();function r(e,t,r){var i=n(e);return(arguments.length===1?i:i.substring(r)).indexOf(t)===0}t.exports=r})),ar=o(((e,t)=>{var n=rn();function r(e,t,r){var i=n(e),a=arguments.length;return a>1&&(a>2?i.substring(0,r).indexOf(t)===r-1:i.indexOf(t)===i.length-1)}t.exports=r})),or=o(((e,t)=>{var n=f(),r=rn(),i=Yn(),a=ue();function o(e,t,o){return r(e).replace((o||n).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(e,n){return a(t,i(n))})}t.exports=o})),sr=o(((e,t)=>{var n=or();function r(e,t){return n(e,t,{tmplRE:/\{([.\w[\]\s]+)\}/g})}t.exports=r})),cr=o(((e,t)=>{function n(){}t.exports=n})),lr=o(((e,t)=>{var n=H();function r(e,t){var r=n(arguments,2);return function(){return e.apply(t,n(arguments).concat(r))}}t.exports=r})),ur=o(((e,t)=>{var n=H();function r(e,t){var r=!1,i=null,a=n(arguments,2);return function(){return r?i:(i=e.apply(t,n(arguments).concat(a)),r=!0,i)}}t.exports=r})),dr=o(((e,t)=>{var n=H();function r(e,t,r){var i=0,a=[];return function(){var o=arguments;i++,i<=e&&a.push(o[0]),i>=e&&t.apply(r,[a].concat(n(o)))}}t.exports=r})),fr=o(((e,t)=>{var n=H();function r(e,t,r){var i=0,a=[];return r||=this,function(){var o=arguments;i++,i<e&&(a.push(o[0]),t.apply(r,[a].concat(n(o))))}}t.exports=r})),pr=o(((e,t)=>{var n=T();function r(e,t,r){var i=null,a=null,o=!1,s=null,c=n({leading:!0,trailing:!0},r),l=c.leading,u=c.trailing,d=function(){i=null,a=null},f=function(){o=!0,e.apply(a,i),s=setTimeout(p,t),d()},p=function(){if(s=null,o){d();return}if(u===!0){f();return}d()},m=function(){var e=s!==null;return e&&clearTimeout(s),d(),s=null,o=!1,e},h=function(){if(i=arguments,a=this,o=!1,s===null&&l===!0){f();return}u===!0&&(s=setTimeout(p,t))};return h.cancel=m,h}t.exports=r})),mr=o(((e,t)=>{var n=T();function r(e,t,r){var i=null,a=null,o=typeof r==`boolean`?{leading:r,trailing:!r}:n({leading:!1,trailing:!0},r),s=!1,c=null,l=o.leading,u=o.trailing,d=function(){i=null,a=null},f=function(){s=!0,e.apply(a,i),d()},p=function(){if(l===!0&&(c=null),s){d();return}if(u===!0){f();return}d()},m=function(){var e=c!==null;return e&&clearTimeout(c),d(),c=null,s=!1,e},h=function(){s=!1,i=arguments,a=this,c===null?l===!0&&f():clearTimeout(c),c=setTimeout(p,t)};return h.cancel=m,h}t.exports=r})),hr=o(((e,t)=>{var n=H();function r(e,t){var r=n(arguments,2),i=this;return setTimeout(function(){e.apply(i,r)},t)}t.exports=r})),gr=o(((e,t)=>{t.exports=decodeURIComponent})),_r=o(((e,t)=>{var n=gr(),r=p(),i=qe();function a(e){var t,a={};return e&&i(e)&&r(e.split(`&`),function(e){t=e.split(`=`),a[n(t[0])]=n(t[1]||``)}),a}t.exports=a})),vr=o(((e,t)=>{t.exports=encodeURIComponent})),yr=o(((e,t)=>{var n=vr(),r=y(),i=g(),a=k(),o=L(),s=M();function c(e,t,o){var l,u=[];return r(e,function(e,r){l=i(e),s(e)||l?u=u.concat(c(e,t+`[`+r+`]`,l)):u.push(n(t+`[`+(o?``:r)+`]`)+`=`+n(a(e)?``:e))}),u}function l(e){var t,l=[];return r(e,function(e,r){o(e)||(t=i(e),s(e)||t?l=l.concat(c(e,r,t)):l.push(n(r)+`=`+n(a(e)?``:e)))}),l.join(`&`).replace(/%20/g,`+`)}t.exports=l})),br=o(((e,t)=>{var n=I();t.exports=typeof location===n?0:location})),xr=o(((e,t)=>{var n=br();function r(){return n?n.origin||n.protocol+`//`+n.host:``}t.exports=r})),Sr=o(((e,t)=>{var n=br(),r=_r(),i=xr();function a(e){return r(e.split(`?`)[1]||``)}function o(e){var t,r,o,s,c=``+e;return c.indexOf(`//`)===0?c=(n?n.protocol:``)+c:c.indexOf(`/`)===0&&(c=i()+c),o=c.replace(/#.*/,``).match(/(\?.*)/),s={href:c,hash:``,host:``,hostname:``,protocol:``,port:``,search:o&&o[1]&&o[1].length>1?o[1]:``},s.path=c.replace(/^([a-z0-9.+-]*:)\/\//,function(e,t){return s.protocol=t,``}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(e,t,n){return r=n||``,s.port=r.replace(`:`,``),s.hostname=t,s.host=t+r,`/`}).replace(/(#.*)/,function(e,t){return s.hash=t.length>1?t:``,``}),t=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,``),s.origin=s.protocol+`//`+s.host,s.hashKey=t&&(t[2]||t[1])||``,s.hashQuery=a(s.hash),s.searchQuery=a(s.search),s}t.exports=o})),Cr=o(((e,t)=>{var n=br(),r=xr(),i=tt();function a(){if(n){var e=n.pathname,t=i(e,`/`)+1;return r()+(t===e.length?e:e.substring(0,t))}return``}t.exports=a})),wr=o(((e,t)=>{var n=br(),r=Sr();function i(){return n?r(n.href):{}}t.exports=i})),Tr=o(((e,t)=>{var n=f(),r=mt(),i=gr(),a=vr(),o=g(),s=Ne(),c=G(),l=L(),u=re(),d=C(),m=T(),h=p(),_=Ye(),v=q(),y=Sn(),b=xn(),x=En();function S(e,t){var n=parseFloat(t),r=_(),i=v(r);switch(e){case`y`:return v(y(r,n));case`M`:return v(b(r,n));case`d`:return v(x(r,n));case`h`:case`H`:return i+n*60*60*1e3;case`m`:return i+n*60*1e3;case`s`:return i+n*1e3}return i}function w(e){return(c(e)?e:new Date(e)).toUTCString()}function E(e,t,u){if(r){var d,f,p,g,_,v,y=[],b=arguments;return o(e)?y=e:b.length>1?y=[m({name:e,value:t},u)]:s(e)&&(y=[e]),y.length>0?(h(y,function(e){d=m({},n.cookies,e),p=[],d.name&&(f=d.expires,p.push(a(d.name)+`=`+a(s(d.value)?JSON.stringify(d.value):d.value)),f&&(f=isNaN(f)?f.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(e,t,n){return w(S(n,t))}):/^[0-9]{11,13}$/.test(f)||c(f)?w(f):w(S(`d`,f)),d.expires=f),h([`expires`,`path`,`domain`,`secure`],function(e){l(d[e])||p.push(d[e]&&e===`secure`?e:e+`=`+d[e])})),r.cookie=p.join(`; `)}),!0):(g={},_=r.cookie,_&&h(_.split(`; `),function(e){v=e.indexOf(`=`),g[i(e.substring(0,v))]=i(e.substring(v+1)||``)}),b.length===1?g[e]:g)}return!1}function D(e){return u(j(),e)}function O(e){return E(e)}function k(e,t,n){return E(e,t,n),E}function A(e,t){E(e,``,m({expires:-1},n.cookies,t))}function j(){return d(E())}function M(){return E()}m(E,{has:D,set:k,setItem:k,get:O,getItem:O,remove:A,removeItem:A,keys:j,getJSON:M}),t.exports=E})),Er=o(((e,t)=>{var n=I(),r=mt(),i=gt(),a=T(),o=p();function s(e){try{var t=`__xe_t`;return e.setItem(t,1),e.removeItem(t),!0}catch{return!1}}function c(e){return navigator.userAgent.indexOf(e)>-1}function l(){var e,t,l,u=!1,d=!1,f=!1,p={isNode:!1,isMobile:u,isPC:!1,isDoc:!!r};if(!i&&typeof process!==n)p.isNode=!0;else{l=c(`Edge`),t=c(`Chrome`),u=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),p.isDoc&&(e=r.body||r.documentElement,o([`webkit`,`khtml`,`moz`,`ms`,`o`],function(t){p[`-`+t]=!!e[t+`MatchesSelector`]}));try{d=s(i.localStorage)}catch{}try{f=s(i.sessionStorage)}catch{}a(p,{edge:l,firefox:c(`Firefox`),msie:!l&&p[`-ms`],safari:!t&&!l&&c(`Safari`),isMobile:u,isPC:!u,isLocalStorage:d,isSessionStorage:f})}return p}t.exports=l})),Dr=o(((e,t)=>{var n=E(),r=T(),i=v(),a=O(),o=j(),s=ee(),c=P(),l=F(),u=ne(),d=ie(),f=p(),m=D(),h=ae(),b=se(),S=oe(),N=fe(),te=de(),I=B(),ce=me(),le=H(),he=ge(),we=_e(),Ae=re(),je=ve(),Re=ye(),K=be(),Je=xe(),q=Se(),Ye=Ee(),$e=U(),mt=De(),gt=Oe(),Ct=Ce(),Tt=ke(),Et=Ie(),It=Le(),Jt=ze(),Yt=Be(),Xt=Ve(),Qt=He(),$t=Ue(),ln=We(),fn=Ge(),gn=_(),_n=g(),vn=k(),yn=Ke(),bn=L(),wn=x(),An=Ne(),jn=qe(),Nn=M(),Pn=Xe(),Xn=G(),Zn=R(),er=y(),tr=Ze(),gr=Qe(),vr=et(),br=tt(),xr=C(),Dr=z(),X=w(),Or=nt(),kr=Me(),Ar=Fe(),jr=Pe(),Mr=rt(),Nr=at(),Pr=it(),Z=ot(),Fr=W(),Q=st(),Ir=ct(),Lr=lt(),Rr=ut(),zr=dt(),Br=ft(),Vr=pt(),$=ht(),Hr=_t(),Ur=vt(),Wr=yt(),Gr=bt(),Kr=xt(),qr=St(),Jr=Ot(),Yr=Dt(),Xr=kt(),Zr=At(),Qr=jt(),$r=wt(),ei=Mt(),ti=Nt(),ni=Pt(),ri=Ft(),ii=Lt(),ai=Rt(),oi=zt(),si=Bt(),ci=Vt(),li=ue(),ui=Ht(),di=Ut(),fi=Wt(),pi=Gt(),mi=Kt(),hi=pe(),gi=Te(),_i=qt(),vi=on(),yi=en(),bi=tn(),xi=nn(),Si=an(),Ci=sn(),wi=V(),Ti=Zt(),Ei=un(),Di=dn(),Oi=cn(),ki=pn(),Ai=mn(),ji=hn(),Mi=Sn(),Ni=Cn(),Pi=xn(),Fi=Tn(),Ii=En(),Li=Dn(),Ri=On(),zi=kn(),Bi=J(),Vi=Ln(),Hi=Rn(),Ui=zn(),Wi=Y(),Gi=Bn(),Ki=Fn(),qi=Mn(),Ji=Vn(),Yi=Hn(),Xi=Un(),Zi=Wn(),Qi=Gn(),$i=In(),ea=Kn(),ta=Yn(),na=qn(),ra=Jn(),ia=Qn(),aa=$n(),oa=nr(),sa=rr(),ca=ir(),la=ar(),ua=or(),da=sr(),fa=rn(),pa=cr(),ma=A(),ha=lr(),ga=ur(),_a=dr(),va=fr(),ya=pr(),ba=mr(),xa=hr(),Sa=_r(),Ca=yr(),wa=Sr(),Ta=Cr(),Ea=wr(),Da=Tr();r(n,{assign:r,objectEach:i,lastObjectEach:a,objectMap:o,merge:s,uniq:h,union:b,sortBy:N,orderBy:te,shuffle:I,sample:ce,some:l,every:u,slice:le,filter:he,find:je,findLast:Re,findKey:we,includes:Ae,arrayIndexOf:ln,arrayLastIndexOf:fn,map:c,reduce:K,copyWithin:Je,chunk:q,zip:Ye,unzip:$e,zipObject:mt,flatten:gt,toArray:S,includeArrays:d,pluck:Ct,invoke:Tt,arrayEach:f,lastArrayEach:m,toArrayTree:Et,toTreeArray:It,findTree:Jt,eachTree:Yt,mapTree:Xt,filterTree:Qt,searchTree:$t,hasOwnProp:gn,eqNull:Zn,isNaN:yn,isFinite:Mr,isUndefined:bn,isArray:_n,isFloat:Nr,isInteger:Pr,isFunction:wn,isBoolean:Z,isString:jn,isNumber:Fr,isRegExp:Q,isObject:An,isPlainObject:Nn,isDate:Xn,isError:Ir,isTypeError:Lr,isEmpty:Rr,isNull:vn,isSymbol:zr,isArguments:Br,isElement:Vr,isDocument:$,isWindow:Hr,isFormData:Ur,isMap:Wr,isWeakMap:Gr,isSet:Kr,isWeakSet:qr,isLeapYear:Pn,isMatch:Jr,isEqual:Yr,isEqualWith:Xr,getType:Zr,uniqueId:Qr,getSize:Or,indexOf:vr,lastIndexOf:br,findIndexOf:$r,findLastIndexOf:ei,toStringJSON:ti,toJSONString:ni,keys:xr,values:Dr,entries:ri,pick:ii,omit:ai,first:oi,last:si,each:er,forOf:tr,lastForOf:gr,lastEach:kr,has:ci,get:li,set:ui,groupBy:di,countBy:fi,clone:X,clear:jr,remove:Ar,range:pi,destructuring:mi,random:hi,min:_i,max:gi,commafy:vi,round:yi,ceil:bi,floor:xi,toFixed:Si,toNumber:wi,toNumberString:Ti,toInteger:Ci,add:Ei,subtract:Di,multiply:Oi,divide:ki,sum:Ai,mean:ji,now:Hi,timestamp:Ui,isValidDate:Wi,isDateSame:Gi,toStringDate:Bi,toDateString:Vi,getWhatYear:Mi,getWhatQuarter:Ni,getWhatMonth:Pi,getWhatWeek:Fi,getWhatDay:Ii,getWhatHours:Li,getWhatMinutes:Ri,getWhatSeconds:zi,getYearDay:Ki,getYearWeek:qi,getMonthWeek:Ji,getDayOfYear:Yi,getDayOfMonth:Xi,getDateDiff:Zi,trim:ta,trimLeft:ra,trimRight:na,escape:ia,unescape:aa,camelCase:oa,kebabCase:sa,repeat:ea,padStart:$i,padEnd:Qi,startsWith:ca,endsWith:la,template:ua,toFormatString:da,toString:fa,toValueString:fa,noop:pa,property:ma,bind:ha,once:ga,after:_a,before:va,throttle:ya,debounce:ba,delay:xa,unserialize:Sa,serialize:Ca,parseUrl:wa,getBaseURL:Ta,locat:Ea,browse:Er(),cookie:Da}),t.exports=n})),X=[],Or=0;Or<256;++Or)X.push((Or+256).toString(16).slice(1));function kr(e,t=0){return(X[e[t+0]]+X[e[t+1]]+X[e[t+2]]+X[e[t+3]]+`-`+X[e[t+4]]+X[e[t+5]]+`-`+X[e[t+6]]+X[e[t+7]]+`-`+X[e[t+8]]+X[e[t+9]]+`-`+X[e[t+10]]+X[e[t+11]]+X[e[t+12]]+X[e[t+13]]+X[e[t+14]]+X[e[t+15]]).toLowerCase()}var Ar,jr=new Uint8Array(16);function Mr(){if(!Ar&&(Ar=typeof crypto<`u`&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!Ar))throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);return Ar(jr)}var Nr={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function Pr(e,t,n){if(Nr.randomUUID&&!t&&!e)return Nr.randomUUID();e||={};var r=e.random||(e.rng||Mr)();if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){n||=0;for(var i=0;i<16;++i)t[n+i]=r[i];return t}return kr(r)}var Z=Dr(),Fr=e=>e==null||e===``,Q=e=>!Fr(e),Ir=e=>e==null,Lr=e=>!Ir(e),Rr=e=>function(t,n,r,i){let a=r||{};return e(null,t,n,i,[],[],a.children||`children`,a)},zr=(e,t,n,r,i,a,o)=>{let s,c;t.forEach((l,u)=>{s=i.concat([``+u]),c=a.concat([l]),n.call(r,l,u,t,s,e,c),l&&o&&(s.push(o),zr(l,l[o]||[],n,r,s,c,o))})},Br=Rr(zr),Vr={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:`left`,lazyReset:!1,fitHeight:30,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}},$=(0,Z.clone)(Vr,!0);function Hr(e){$={form:{...$.form,...e.form},grid:{...$.grid,...e.grid},canvasTable:{...$.canvasTable,...e.canvasTable},renderTooltip:e.renderTooltip??$.renderTooltip}}function Ur(){return $.renderTooltip}function Wr(){return $}function Gr(){return{labelCol:$.form?.labelCol,wrapperCol:$.form?.wrapperCol}}function Kr(){return{align:$.grid?.align,lazyReset:$.grid?.lazyReset,fitHeight:$.grid?.fitHeight,striped:$.grid?.striped}}function qr(){return $.canvasTable||{}}function Jr(){$=JSON.parse(JSON.stringify(Vr))}var Yr=e=>({dataIndex:e.field,key:e.field,title:e.title,...(0,Z.omit)(e,[`children`,`slots`,`cellRender`,`formatter`]),children:e.children?.map(e=>Yr(e))}),Xr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Zr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},Qr={1:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},2:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},3:{xs:12,sm:5,md:6,lg:6,xl:5,xxl:5},4:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},5:{xs:12,sm:4,md:6,lg:9,xl:7,xxl:6},6:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:8},7:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:9},8:{xs:12,sm:6,md:8,lg:10,xl:7,xxl:9},9:{xs:12,sm:6,md:8,lg:10,xl:9,xxl:10}},$r=e=>{let t=(24-e.reduce((e,t)=>e+t,0))%24,n=t===0?24:t<0?24+t:t;return n>1?n:24},ei=[`xxs`,`xs`,`sm`,`md`,`lg`,`xl`,`xxl`],ti=e=>{let t=(0,Z.isArray)(e)?e:(0,Z.isNumber)(e)?Array.from({length:e},()=>Xr):[];return(0,Z.zipObject)(ei,ei.map(e=>t.every(t=>Q(t[e]))?$r(t.map(t=>t[e])):24))};function ni(e,t,n){let r=(0,l.toValue)(e);if(typeof r!=`object`||!r)return(0,l.watch)(e,t,n);let i=(0,Z.clone)(r,!0);return(0,l.watch)(e,(e,n,r)=>{t(e,i,r),i=(0,Z.clone)(e,!0)},n)}var ri=`-`,ii={toString:({cellValue:e})=>e?e.toString?.()??ri:ri,formatByOptions:({cellValue:e},t,n=`,`)=>{if(e==null)return ri;if((0,Z.isArray)(e))if(e.length>0){let r=t.filter(t=>e.includes(t.value));return r.length?r.map(e=>e.label).join(n):ri}else return ri;let r=t.find(t=>t.value===e);return r?r.label:ri},formatSex:({cellValue:e})=>Q(e)?(0,Z.toNumber)(e)===1?`男`:`女`:ri},ai=(e,{record:t,index:n,column:r,field:i})=>{if((0,Z.isString)(e)&&ii[e]){let r=ii[e];return r({row:t,rowIndex:n,cellValue:i?t[i]:null})}else if((0,Z.isArray)(e)&&ii[e[0]]&&e.length>1){let r=ii[e[0]];return r({row:t,rowIndex:n,cellValue:i?t[i]:null},...e.slice(1))}else if((0,Z.isFunction)(e))return e({row:t,rowIndex:n,cellValue:i?t[i]:null,column:r});else return i?t[i]:null},oi=e=>{Object.assign(ii,e)},si=(0,l.defineComponent)(e=>{let{cellRender:t,renderTableParams:n}=e,{data:r,row:i,field:a,rowIndex:o}=n;return()=>yi.renders[t.name]?.renderDefault?.(t,{data:r,row:i,field:a,rowIndex:o},e.defaultHandler)??null},{name:`RenderAntCell`,props:[`cellRender`,`renderTableParams`,`defaultHandler`]}),ci=(0,l.defineComponent)(e=>{let{tableData:t,row:n,column:r,rowIndex:i}=e,a=r.field?n[r.field]:null;return()=>r.slots?.default?.({row:n,column:r,rowIndex:i,cellValue:a})??(r.cellRender?(0,l.createVNode)(si,{cellRender:r.cellRender,defaultHandler:e.defaultHandler,renderTableParams:{data:t,row:n,field:r.field,rowIndex:i}},null):r.formatter?ai(r.formatter,{record:n,index:i,field:r.field,column:r}):a)},{name:`RenderAntDefaultCell`,props:[`tableData`,`row`,`column`,`rowIndex`,`defaultHandler`]}),li={class:`text-right mt-4px`},ui=(0,l.defineComponent)({__name:`TableInput`,props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:[`update:modelValue`,`trigger`],setup(e,{emit:t}){let n=e,r={size:`small`,pagination:!1};(0,l.watch)(()=>n.modelValue,()=>{a(`trigger`)},{deep:!0});let i=(0,l.computed)(()=>(0,Z.merge)({},r,n.tableConfig)),a=t,o=(0,l.computed)({get:()=>n.modelValue??[],set:e=>{a(`update:modelValue`,e)}}),s=(0,l.computed)(()=>[...n.editColumns,{title:`操作`,fixed:`right`,width:100,cellRender:{name:`ButtonTree`,children:[{content:`删除`,type:`link`,danger:!0,clickEvt:({rowIndex:e})=>u(e)}]}}]),c=()=>{o.value=[...o.value,{}]},u=e=>{o.value=o.value.filter((t,n)=>n!==e)},d=(0,l.computed)(()=>{let e=0;return s.value.filter(t=>t.slots&&t.slots.default||t.formatter||t.cellRender?(t.field||(t.field=`__holder__`+e,e++),!0):!1)});return(e,t)=>{let n=(0,l.resolveComponent)(`a-form-item-rest`),r=(0,l.resolveComponent)(`a-table`),a=(0,l.resolveComponent)(`a-button`);return(0,l.openBlock)(),(0,l.createElementBlock)(`div`,null,[(0,l.createVNode)(r,(0,l.mergeProps)({"data-source":o.value},i.value,{columns:s.value.map(e=>(0,l.unref)(Yr)(e))}),(0,l.createSlots)({_:2},[d.value.length>0?{name:`bodyCell`,fn:(0,l.withCtx)(({column:e,record:t,index:r})=>[(0,l.createVNode)(n,null,{default:(0,l.withCtx)(()=>[d.value.some(t=>e.key&&t.field===e.key)?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(ci),{key:r,"row-index":r,"default-handler":{},column:d.value.find(t=>e.key&&t.field===e.key),row:t,"table-data":o.value},null,8,[`row-index`,`column`,`row`,`table-data`])):(0,l.createCommentVNode)(``,!0)]),_:2},1024)]),key:`0`}:void 0]),1040,[`data-source`,`columns`]),(0,l.createElementVNode)(`div`,li,[(0,l.createVNode)(a,{type:`primary`,onClick:c},{default:(0,l.withCtx)(()=>[...t[0]||=[(0,l.createTextVNode)(`+添加`,-1)]]),_:1})])])}}}),di=e=>{let{icon:t}=e,n=d;return n[t]?(0,l.createVNode)(n[t]):n[t]},fi={AInput:{autocomplete:`off`},$input:{autocomplete:`off`,allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:`YYYY-MM-DD`,valueFormat:`YYYY-MM-DD`},ADatePicker:{format:`YYYY-MM-DD`,valueFormat:`YYYY-MM-DD`},$range:{format:`YYYY-MM-DD`,valueFormat:`YYYY-MM-DD`},ARangePicker:{format:`YYYY-MM-DD`,valueFormat:`YYYY-MM-DD`},$select:{getPopupContainer:e=>e.parentNode,allowClear:!0,showSearch:!0,filterOption:(e,t)=>t.label&&t.label.toLowerCase().includes(e.toLowerCase())},ASelect:{getPopupContainer:e=>e.parentNode,allowClear:!0,showSearch:!0,filterOption:(e,t)=>t.label&&t.label.toLowerCase().includes(e.toLowerCase())}},pi={PercentInput:{controls:!1,min:0,max:100,addonAfter:`%`},autoComplete:{inputProps:{}}},mi={$input:u.Input,AInput:u.Input,$textarea:u.Textarea,Textarea:u.Textarea,$number:u.InputNumber,AInputNumber:u.InputNumber,$select:u.Select,ASelect:u.Select,$date:u.DatePicker,ADatePicker:u.DatePicker,$range:u.RangePicker,ARangePicker:u.RangePicker,AAutoComplete:u.AutoComplete,$Cascader:u.Cascader,ACascader:u.Cascader,ACheckbox:u.Checkbox,AMentions:u.Mentions,ARate:u.Rate,ASlider:u.Slider,$time:u.TimePicker,ATimePicker:u.TimePicker,ATreeSelect:u.TreeSelect},hi=e=>{let t=mi[e];return{renderItemContent({props:n={},attrs:r={},events:i={},defaultValue:a},{data:o,field:s}){return Lr(a)&&Q(s)&&Ir(o[s])&&(o[s]=a),s?(0,l.createVNode)(t,(0,l.mergeProps)({is:e,value:o[s],"onUpdate:value":e=>o[s]=e},r,(0,Z.merge)({},fi[e],n),{onChange:(...e)=>{i.change?.({data:o,field:s},...e)}}),null):(0,l.createVNode)(t,(0,l.mergeProps)({is:e},n),null)},renderDefault({props:n=fi[e]??{},attrs:r={},events:i={},defaultValue:a},{data:o,row:s,field:c}){return Lr(a)&&Q(c)&&Ir(s[c])&&(s[c]=a),c?(0,l.createVNode)(t,(0,l.mergeProps)({is:e,value:s[c],"onUpdate:value":e=>s[c]=e},r,(0,Z.merge)({},fi[e],n),{onChange:(...e)=>{i.change?.({data:o,row:s,field:c},...e)}}),null):(0,l.createVNode)(t,(0,l.mergeProps)({is:e},n),null)},renderEdit(n,{props:r=fi[e]??{},attrs:i={},events:a={}},o,s){return(0,l.createVNode)(t,(0,l.mergeProps)({is:e,value:n.value,"onUpdate:value":e=>n.value=e},i,(0,Z.merge)({},fi[e],r),{onBlur:(...e)=>{s?.(`blur`,n.value),a.blur?.(o,...e)}}),null)}}},gi=(e,t,n)=>e.dropdowns&&e.dropdowns.length>0&&e.dropdowns.filter(e=>!e.hiddenIf?.(t)).length>0?(0,l.createVNode)(u.Dropdown,{getPopupContainer:n??(()=>document.querySelector(`.p-wrapper`))},{default:()=>(0,l.createVNode)(u.Button,(0,l.mergeProps)((0,Z.omit)(e,[`dynamicClassName`,`content`,`getContent`,`icon`,`clickEvt`,`dropdowns`,`getProps`]),{icon:e.icon?(0,l.createVNode)(di,{icon:e.icon},null):(0,l.createVNode)(di,{icon:`DownOutlined`},null)},e.getProps?.(t)??{}),{default:()=>[e.content||(e?.getContent?.(t)??``)]}),overlay:()=>(0,l.createVNode)(`div`,{class:`dropdown-wrapper ${e?.dynamicClassName?.(t)??``}`},[e.dropdowns.filter(e=>!e.hiddenIf?.(t)).map(e=>gi(e,t,n))])}):(0,l.createVNode)(u.Button,(0,l.mergeProps)({class:e?.dynamicClassName?.(t)||``},(0,Z.omit)(e,[`dynamicClassName`,`content`,`getContent`,`icon`,`clickEvt`,`dropdowns`,`getProps`]),{disabled:!!e.dropdowns&&e.dropdowns.length>0||e.disabled,icon:e.icon?(0,l.createVNode)(di,{icon:e.icon},null):null},e.getProps?.(t)??{},{onClick:()=>{e?.clickEvt&&e.clickEvt(t)}}),{default:()=>[e.content||(e?.getContent?.(t)??``)]}),_i={...Object.fromEntries(Object.keys(mi).map(e=>[e,hi(e)])),$button:{renderItemContent({props:e={},events:t={}},{data:n,field:r},i){return(0,l.createVNode)(u.Button,(0,l.mergeProps)((0,Z.omit)(e,[`content`]),{icon:e.icon?(0,l.createVNode)(di,{icon:e.icon},null):null,onClick:()=>{t.click?.({data:n,field:r}),e.htmlType===`reset`&&i?.reset&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?e.beforeClick({data:n,field:r}).then(e=>{i.reset(e?{data:e,field:r}:{data:n,field:r})}):i.reset({data:n,field:r}))}}),{default:()=>[e.content,e.suffix?.({data:n,field:r})??null]})},renderDefault({props:e={},events:t={}},{row:n,field:r},i){return(0,l.createVNode)(u.Button,(0,l.mergeProps)((0,Z.omit)(e,[`content`]),{icon:e.icon?(0,l.createVNode)(di,{icon:e.icon},null):null,onClick:()=>{t.click?.({row:n,field:r}),e.htmlType===`reset`&&i?.reset&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?(i?.setLoadings?.(!0),e.beforeClick({row:n,field:r}).then(e=>{i.reset(e?{row:e,field:r}:{row:n,field:r})}).finally(()=>{i?.setLoadings?.(!1)})):i.reset({row:n,field:r})),e.htmlType===`pick`&&i?.pick&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?(i?.setLoadings?.(!0),e.beforeClick({row:n,field:r}).then(e=>{i.pick(e?{row:e,field:r}:{row:n,field:r})}).finally(()=>{i?.setLoadings?.(!1)})):i.pick({row:n,field:r}))}}),{default:()=>[e.content]})}},$buttons:{renderItemContent({props:e={},children:t=[]},{data:n,field:r},i){return(0,l.createVNode)(`span`,{class:`align-gap-box w-fit`},[t.map(t=>(0,l.createVNode)(u.Button,(0,l.mergeProps)((0,Z.omit)(Object.assign({},e,t.props),[`content`]),{icon:t.props.icon?(0,l.createVNode)(di,{icon:t.props.icon},null):null,onClick:()=>{t.events?.click?.({data:n,field:r}),t.props.htmlType===`reset`&&i?.reset&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?e.beforeClick({data:n,field:r}).then(e=>{i.reset(e?{data:e,field:r}:{data:n,field:r})}):i.reset({data:n,field:r})),t.props.htmlType===`pick`&&i?.pick&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?e.beforeClick({data:n,field:r}).then(e=>{i.pick(e?{data:e,field:r}:{data:n,field:r})}):i.pick({data:n,field:r}))}}),{default:()=>[t.props.content]}))])},renderDefault({props:e={},children:t=[]},{data:n,row:r,field:i},a){return(0,l.createVNode)(`span`,{class:`align-gap-box w-fit`},[t.filter(e=>!e?.props?.hiddenIf?.({data:n,row:r,field:i})).map(t=>(0,l.createVNode)(u.Button,(0,l.mergeProps)((0,Z.omit)(Object.assign({},e,t.props),[`content`,`hiddenIf`]),{icon:t.props.icon?(0,l.createVNode)(di,{icon:t.props.icon},null):null,onClick:()=>{t.events?.click?.({data:n,row:r,field:i}),t.props.htmlType===`reset`&&a?.reset&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?(a?.setLoadings?.(!0),e.beforeClick({row:r,field:i}).then(e=>{a.reset(e?{row:e,field:i}:{row:r,field:i})}).finally(()=>{a?.setLoadings?.(!1)})):a.reset({row:r,field:i})),t.props.htmlType===`pick`&&a?.pick&&(e.beforeClick&&(0,Z.isFunction)(e.beforeClick)?(a?.setLoadings?.(!0),e.beforeClick({row:r,field:i}).then(e=>{a.pick(e?{row:e,field:i}:{row:r,field:i})}).finally(()=>{a?.setLoadings?.(!1)})):a.pick({row:r,field:i}))}}),{default:()=>[t.props.content]}))])}},ButtonTree:{renderDefault({children:e=[],props:t={}},n){let r=(0,l.ref)(null);return(0,l.createVNode)(`span`,{ref:r,class:t.noGap?`align-no-gap-box`:`align-gap-box`},[e.filter(e=>!e.hiddenIf?.(n)).map(e=>gi(e,n,()=>r.value?.parentElement?.parentElement?.parentElement?.parentElement||document.body))??[]])}},$radio:{renderItemContent({props:e={},events:t={},options:n,defaultValue:r},{data:i,field:a}){return Lr(r)&&Q(a)&&Ir(i[a])&&(i[a]=r),Q(a)?(0,l.createVNode)(u.RadioGroup,(0,l.mergeProps)({value:i[a],"onUpdate:value":e=>i[a]=e},e,{options:e.options??n??[],disabled:!!e.disabled,onChange:(...e)=>{t.change?.({data:i,field:a},...e)}}),null):null},renderDefault({props:e={},options:t},{row:n,field:r}){return Q(r)?(0,l.createVNode)(u.RadioGroup,(0,l.mergeProps)({value:n[r],"onUpdate:value":e=>n[r]=e},e,{options:e.options??t??[]}),null):null}},$autoComplete:{renderItemContent({props:e={},events:t={}},{data:n,field:r}){return Q(r)?(0,l.createVNode)(u.AutoComplete,(0,l.mergeProps)({value:n[r],"onUpdate:value":e=>n[r]=e},Object.assign({},{filterOption:pi.autoComplete.filterOption},e),{onChange:(...e)=>{t.change?.({data:n,field:r},...e)}}),{default:()=>(0,l.createVNode)((0,l.resolveComponent)(`a-input`),Object.assign({},pi.autoComplete.inputProps,e.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:e={},events:t={},defaultValue:n},{data:r,field:i}){return Lr(n)&&Q(i)&&Ir(r[i])&&(r[i]=n),Q(i)?(0,l.createVNode)(u.Switch,(0,l.mergeProps)({checked:r[i],"onUpdate:checked":e=>r[i]=e},e,{onChange:(...e)=>{t.change?.({data:r,field:i},...e)}}),null):null}},$checkbox:{renderItemContent({props:e={},options:t,events:n={},defaultValue:r},{data:i,field:a}){return Lr(r)&&Q(a)&&Ir(i[a])&&(i[a]=r),Q(a)?(0,l.createVNode)(u.CheckboxGroup,(0,l.mergeProps)({value:i[a],"onUpdate:value":e=>i[a]=e},e,{options:e.options??t??[],onChange:(...e)=>{n.change?.({data:i,field:a},...e)}}),null):null},renderDefault({props:e={},options:t},{row:n,field:r}){return Q(r)?(0,l.createVNode)(u.CheckboxGroup,(0,l.mergeProps)({value:n[r],"onUpdate:value":e=>n[r]=e},e,{options:e.options??t??[]}),null):null}},$paragraph:{renderDefault({props:e={}},{row:t,field:n}){let r={ellipsis:{expandable:!0,rows:3}},i=e.getContent?.({row:t,field:n})??(Q(n)?t[n]:``);return Q(n)?(0,l.createVNode)(u.TypographyParagraph,(0,l.mergeProps)((0,Z.merge)({},r,(0,Z.omit)(e,[`content`,`getContent`])),{content:i}),null):null}},$tableInput:{renderItemContent({props:e={},handleTrigger:t},{data:n,field:r}){return Q(r)?(0,l.createVNode)(ui,{modelValue:n[r],"onUpdate:modelValue":e=>n[r]=e,onTrigger:()=>{t&&(0,Z.isFunction)(t)&&t(e.cusFields??r)},editColumns:e.editColumns??[],tableConfig:e.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:e={},attrs:t={},defaultValue:n},{data:r,field:i}){let a=e.parse?100:1;if(Q(i)){Lr(n)&&Ir(r[i])&&(r[i]=n);let o=(0,l.computed)({get:()=>(r[i]??0)*a,set:e=>{r[i]=(e??0)/a}});return(0,l.createVNode)(`div`,{class:`flex items-center`},[e.info?(0,l.createVNode)(`span`,{class:`pr-4`},[e.info]):null,(0,l.createVNode)((0,l.resolveComponent)(`a-input-number`),(0,l.mergeProps)({class:`w-60px!`},t,{value:o.value,"onUpdate:value":e=>o.value=e},(0,Z.merge)({},pi.PercentInput,(0,Z.omit)(e,[`info`]))),null)])}else return null},renderDefault({props:e={},attrs:t={}},{row:n,field:r}){let i=e.parse?100:1;if(Q(r)){let a=(0,l.computed)({get:()=>(n[r]??0)*i,set:e=>{(0,Z.set)(n,r,(e??0)/i)}});return[e.info?(0,l.createVNode)(`span`,{class:`pr-4`},[e.info]):null,(0,l.createVNode)((0,l.resolveComponent)(`a-input-number`),(0,l.mergeProps)({class:`w-60px!`},t,{value:a.value,"onUpdate:value":e=>a.value=e},(0,Z.merge)({},pi.PercentInput,(0,Z.omit)(e,[`info`]))),null)]}else return null}},TreeSelect:{renderItemContent({props:e={}},{data:t,field:n}){return Q(n)?(0,l.createVNode)(u.TreeSelect,(0,l.mergeProps)({value:t[n],"onUpdate:value":e=>t[n]=e},e),null):null},renderDefault({props:e={}},{row:t,field:n}){return Q(n)?(0,l.createVNode)(u.TreeSelect,(0,l.mergeProps)({value:t[n],"onUpdate:value":e=>t[n]=e},e),null):null}}},vi=(e,{renderItemContent:t,renderDefault:n,renderEdit:r})=>{_i.hasOwnProperty(e)&&console.warn(`render ${e} already exists, you are trying to override it`),_i[e]={renderItemContent:t,renderDefault:n,renderEdit:r}},yi={renders:_i,addRender:vi},bi=(0,l.defineComponent)((e,{emit:t})=>{let{itemRender:n,defaultHandler:r}=e,{renderFormParams:i}=(0,l.toRefs)(e),a=e=>{t(`trigger`,e)},o=(e,n)=>{t(`delayTrigger`,e,n)};return()=>yi.renders[n.name]?.renderItemContent?.({...n,handleTrigger:a,handleDelayTrigger:o},i.value,r)??null},{name:`RenderAntItem`,props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:[`trigger`,`delayTrigger`]}),xi=(0,l.defineComponent)(e=>{let{formData:t}=(0,l.toRefs)(e);return()=>e.item.slots?.default?.({data:t.value,field:e.item.field},e.passTrigger,e.passDelayTrigger)??null},{name:`RenderItemSlots`,props:[`formData`,`item`,`passTrigger`,`passDelayTrigger`]}),Si={key:2},Ci=(0,l.defineComponent)({__name:`PFormCol`,props:{item:{},formData:{}},emits:[`trigger`,`reset`],setup(e,{emit:t}){let n=e,r=t,i=(0,l.ref)(!1),a=(0,l.ref)(Pr()),o=(e,t)=>{let n=t??222;i.value=!0,setTimeout(()=>{i.value=!1,r(`trigger`,e)},n)},s=e=>{r(`trigger`,e)},c=()=>{r(`reset`)},f=(0,Z.debounce)(()=>{a.value=Pr()},100),p=(0,l.computed)(()=>{if(!n.item.tooltipConfig)return null;let e=n.item.tooltipConfig,t=Ur(),r=()=>(0,l.h)(d.InfoCircleOutlined,{class:`cursor-pointer py-4 px-2`}),i=(0,Z.isFunction)(e.title)?e.title:String(e.title??``);return t?()=>t(r,i):()=>(0,Z.isFunction)(e.title)?(0,l.h)(u.Tooltip,(0,Z.omit)(e,[`title`]),{default:r,title:()=>(0,l.h)(`div`,{innerHTML:e.title()})}):(0,l.h)(u.Tooltip,e,{default:r})});return ni(()=>n.item,(e,t)=>{(0,Z.isEqual)(e,t)||f()},{deep:!0}),(t,n)=>{let r=(0,l.resolveComponent)(`a-form-item`),u=(0,l.resolveComponent)(`a-col`);return(0,l.openBlock)(),(0,l.createBlock)(u,(0,l.mergeProps)({key:`_col_${a.value}`},e.item.col??(e.item.span?{span:e.item.span}:(0,l.unref)(Xr))),{default:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)(r,(0,l.mergeProps)({key:`_item_${a.value}`,class:[`p-content-align-${e.item.align??`left`} ${e.item.forceRequired?`p-required`:``}`,{"p-error-hang-out":i.value}],colon:``,label:e.item.title,name:e.item.field,"wrapper-col":e.item.wrapperCol??(e.item.title?void 0:{span:24})},(0,l.unref)(Z.omit)(e.item,[`field`,`title`,`span`,`col`,`wrapperCol`,`itemRender`,`forceRequired`,`tooltip`])),(0,l.createSlots)({default:(0,l.withCtx)(()=>[e.item.slots?.default?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(xi),{key:`_sl_${e.item.field??`_`}_${a.value}`,"form-data":e.formData,item:e.item,"pass-delay-trigger":o,"pass-trigger":s},null,8,[`form-data`,`item`])):e.item.itemRender?.name?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(bi),{key:`_re_${e.item.field??`_`}_${a.value}`,"default-handler":{reset:c},"item-render":e.item.itemRender,"render-form-params":{data:e.formData,field:e.item.field},onDelayTrigger:o,onTrigger:s},null,8,[`default-handler`,`item-render`,`render-form-params`])):((0,l.openBlock)(),(0,l.createElementBlock)(`span`,Si))]),_:2},[e.item.slots?.title?{name:`label`,fn:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(e.item.slots.title)))]),key:`0`}:void 0,p.value?{name:`tooltip`,fn:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(p.value)))]),key:`1`}:void 0]),1040,[`class`,`label`,`name`,`wrapper-col`]))]),_:1},16)}}}),wi={key:0,class:`p-pane p-wrapper`},Ti=(0,l.defineComponent)({__name:`PForm`,props:{name:{},items:{},customReset:{},layout:{},labelCol:{default:()=>Gr().labelCol??{span:6}},wrapperCol:{default:()=>Gr().wrapperCol??{span:16}},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:[`apply`,`reset`],setup(e,{expose:t,emit:n}){let r=e,i=n,{items:a,data:o}=(0,l.toRefs)(r);function s(){i(`apply`,o.value)}let c=(0,l.ref)(),d=(0,l.ref)(Pr()),f=()=>{d.value=Pr()},p=()=>{if(r.customReset)r.customReset();else{let e={};Br(a.value,t=>{t.field&&t.itemRender?Lr(t.itemRender.defaultValue)?e[t.field]=t.itemRender.defaultValue:e[t.field]=void 0:t.field&&t.slots&&(Lr(t.slots.defaultValue)?e[t.field]=t.slots.defaultValue:e[t.field]=void 0)}),Object.assign(o.value,e)}i(`reset`)},m=(0,l.computed)(()=>({...(0,Z.omit)(r,[`items`,`data`,`model`,`labelCol`,`wrapperCol`]),labelCol:r.labelCol,wrapperCol:r.wrapperCol})),h=e=>{e&&c.value?.validateFields(e)},g=e=>{h(e)};return t({reset:f,$form:(0,l.computed)(()=>c.value)}),(t,n)=>(0,l.unref)(a).some(e=>e.field&&e.itemRender||e.slots?.default)?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,wi,[((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Form),(0,l.mergeProps)({name:e.name,key:d.value,ref_key:`formEl`,ref:c,model:(0,l.unref)(o)},m.value,{onSubmit:s}),{default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Row),{gutter:[6,12]},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)((0,l.unref)(a),(e,t)=>((0,l.openBlock)(),(0,l.createBlock)(Ci,{key:`_col_${e.field||t}`,"form-data":(0,l.unref)(o),item:e,onReset:p,onTrigger:g},null,8,[`form-data`,`item`]))),128))]),_:1})]),_:1},16,[`name`,`model`]))])):(0,l.createCommentVNode)(``,!0)}}),Ei=(0,l.defineComponent)(e=>{let{column:t}=e;return()=>t.slots?.title?.({column:t})??t.title},{name:`RenderAntTitle`,props:[`column`]}),Di=({title:e,content:t})=>new Promise((n,r)=>{u.Modal.confirm({title:e,content:t,onOk:()=>{n()},onCancel:()=>{r()}})}),Oi=u.message.success,ki=u.message.error;u.message.info;var Ai=u.message.warning,ji={key:0},Mi={key:1,class:`p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px`},Ni={class:`flex items-center flex-1 gap-4px`},Pi={key:2},Fi={class:`flex items-center gap-4px`},Ii={class:`p-grid-table-body flex-1 min-h-0 overflow-hidden`},Li={key:0,class:`w-full pt-8px px-16px text-slate-5`},Ri={key:1,class:`flex w-full items-center gap-12px pt-8px px-16px`},zi={class:`flex-1 min-w-0 text-slate-5 flex items-center`},Bi=(0,l.defineComponent)({__name:`PGrid`,props:{selectConfig:{},rowKey:{default:`id`},striped:{type:Boolean,default:()=>Kr().striped??!1},manualFetch:{type:Boolean},align:{default:()=>Kr().align??`left`},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:`inner`},lazyReset:{type:Boolean,default:()=>Kr().lazyReset??!1},fitHeight:{default:()=>Kr().fitHeight??30},fitCanvasHeight:{},renderY:{}},emits:[`toolbarButtonClick`,`toolbarToolClick`,`pick`,`resetQuery`],setup(e,{expose:t,emit:n}){let r=e,{formConfig:i,pageConfig:a,columns:o,toolbarConfig:s,proxyConfig:c,tableConfig:f,selectConfig:p,scrollMode:m}=(0,l.toRefs)(r),h=(0,l.reactive)({table:!1,toolbar:!1,form:!1}),g=e=>{(0,Z.isObject)(e)?Object.keys(e).forEach(t=>{h[t]=e[t]}):(0,Z.isBoolean)(e)&&(h.form=e,h.table=e,h.toolbar=e)},_=(0,l.ref)(),v=(0,l.ref)(),y=(0,l.ref)(),b=(0,l.ref)(),x=(0,l.ref)(500),S=(0,l.ref)([]),C=(0,l.ref)([]),w=e=>{let{ajax:t}=c.value;switch(e){case`multiDelete`:t.multiDelete&&(S.value.length>0?Di({title:`警告`,content:`确认删除选中的数据吗?`}).then(()=>{h.table=!0,h.toolbar=!0,t.multiDelete(S.value).then(()=>{u.message.success(`删除成功`),fe()}).catch(()=>{u.message.error(`删除失败`)}).finally(()=>{h.table=!1,h.toolbar=!1,A.multiDelete=!1})}):u.message.warn(`请选择要删除的数据`));break}},T=(0,l.computed)(()=>{let e=[];return Br(o.value??[],t=>{t.slots&&t.slots.title&&(t.field||=`__holder__`+e.length,e.push(t))}),e}),E=(0,l.ref)(),D=(0,l.ref)(),O=(0,l.ref)(Pr()),k=(0,l.ref)(Pr()),A=(0,l.reactive)([...(r.toolbarConfig?.buttons?.map(e=>e.code)??[]).filter(e=>e),...(r.toolbarConfig?.tools?.map(e=>e.code)??[]).filter(e=>e)].reduce((e,t)=>(e[t]=!1,e),{})),j=(e,t)=>{A[e]=t},M=(0,Z.debounce)(()=>{k.value=Pr()},100),N=(0,l.computed)(()=>{let e=[];return Br(o.value??[],t=>{(t.slots&&t.slots.default||t.formatter||t.cellRender)&&(t.field||=`__holder__`+e.length,e.push(t))}),e}),ee=(0,l.reactive)({page:1,size:a.value?.pageSize??10}),P=(0,l.ref)(0),te=(0,l.ref)(0),F=(0,l.ref)([]),ne=(0,l.computed)(()=>c.value&&c.value.ajax?a.value?`pagination`:`list`:`bad`),re=(0,l.computed)(()=>!!p.value?.showCount),ie=(0,l.useAttrs)(),ae=n,oe=(0,l.computed)(()=>C.value.filter(e=>S.value.includes(e[r.rowKey??`id`]))),se=(0,Z.debounce)(e=>{ae(`toolbarButtonClick`,{data:F.value,code:e,selectedKeys:S.value,records:oe.value}),w(e)},100),I=({key:e})=>se(e),L=(0,Z.debounce)(e=>{ae(`toolbarToolClick`,{data:F.value,code:e,selectedKeys:S.value,records:oe.value}),w(e)},100),R=(0,l.ref)({}),ce=({row:e,field:t})=>{ae(`pick`,{row:e,field:t})},le=e=>{if(i.value&&i.value.items.length>0){if(i.value.customReset)i.value.customReset();else{let e={};Br(i.value.items,t=>{t.field&&t.itemRender?Lr(t.itemRender.defaultValue)?e[t.field]=t.itemRender.defaultValue:e[t.field]=void 0:t.field&&t.slots&&(Lr(t.slots.defaultValue)?e[t.field]=t.slots.defaultValue:e[t.field]=void 0)}),R.value=e}ae(`resetQuery`)}ee.page=1,e||B()},ue=(e,t)=>t?{list:(0,Z.isString)(t.list)?(0,Z.get)(e,t.list):(0,Z.isFunction)(t.list)?t.list(e):void 0,total:(0,Z.isString)(t.total)?(0,Z.get)(e,t.total):(0,Z.isFunction)(t.total)?t.total(e):void 0,result:(0,Z.isString)(t.result)?(0,Z.get)(e,t.result):(0,Z.isFunction)(t.result)?t.result(e):void 0,message:(0,Z.isString)(t.message)?(0,Z.get)(e,t.message):(0,Z.isFunction)(t.message)?t.message(e):void 0}:{list:e},de=()=>(C.value=[],S.value=[],le()),fe=()=>(ee.page=1,C.value=[],S.value=[],z()),pe=(e,t)=>(ee.page=e,ee.size=t,z()),z=()=>new Promise(e=>{if(ne.value!==`bad`){h.form=!0,h.table=!0;let{ajax:t}=c.value;t.query({form:R.value,page:ee}).then(t=>{let{list:n,total:r,result:i,message:a}=ue(t,c.value.response);n?(F.value=n,P.value++):i?(F.value=i,te.value=r??i.length,P.value++):(F.value=[],P.value++,a&&u.message.warn(a)),e(F.value)}).catch(t=>{console.error(`fetchData error`,t),e([])}).finally(()=>{h.form=!1,h.table=!1})}}),B=(0,Z.debounce)(z,160),me=(e,t)=>(Object.assign(R.value,e),ee.page=1,t?Promise.resolve():B()),he=(e,t)=>(R.value=e,ee.page=1,t?Promise.resolve():B()),V={size:`small`,sticky:!0,transformCellText:({text:e})=>(0,Z.isArray)(e)&&e.length===0?`-`:e},H=(0,l.computed)(()=>(0,Z.merge)({},V,f?.value??{},p.value?{rowSelection:{type:p.value.multiple?`checkbox`:`radio`,preserveSelectedRowKeys:!0,selectedRowKeys:S.value,onChange:e=>{S.value=e;let t=r.rowKey??`id`,n=C.value.map(e=>e[t]),i=e.filter(e=>!n.includes(e)).map(e=>F.value.find(n=>n[t]===e)).filter(e=>!!e);C.value=[...C.value,...i]},getCheckboxProps:p.value.getCheckboxProps}}:{})),ge=(0,l.computed)(()=>(0,Z.omit)({labelCol:Zr,...i.value},[`items`])),_e=()=>{fe()};(0,l.watch)(()=>[o.value,c.value,s.value],()=>{M()},{deep:!0}),(0,l.watch)(()=>[k.value,P.value,ne.value,re.value],()=>(0,l.nextTick)(()=>be()),{flush:`post`});let ve=null,ye=e=>{let t=e.querySelector(`.ant-table-wrapper`);return t?t.querySelector(`.ant-table-header`)||t.querySelector(`.ant-table-thead`):null},be=()=>{ve&&cancelAnimationFrame(ve),ve=requestAnimationFrame(()=>{if(ve=null,!y.value)return;if(Lr(r.renderY)){x.value=r.renderY;return}let e=y.value.clientHeight,t=b.value?.offsetHeight??0,n=ye(y.value)?.getBoundingClientRect().height??0,i=r.fitHeight??30;x.value=Math.max(e-t-n-i,100)})},xe=null;(0,l.watch)(v,e=>{xe?.disconnect(),xe=null,e&&(xe=new ResizeObserver(()=>be()),xe.observe(e))},{immediate:!0}),t({commitProxy:{query:B,reload:de,reloadPage:fe,passQuery:me,forcePassQuery:he},$table:(0,l.computed)(()=>D.value),selectedRowKeys:(0,l.computed)(()=>S.value),setBtnLoading:j,selectedRecords:oe,$form:(0,l.computed)(()=>E.value),getFormData:()=>R.value,setLoadings:g,resizeTable:be});let Se,Ce=null,we=null,Te=null;(0,l.onMounted)(()=>{if(be(),window.addEventListener(`resize`,be),Se=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`style`){let t=e.target;window.getComputedStyle(t).display!==`none`&&be()}})}),_.value){Se.observe(_.value,{attributes:!0,attributeFilter:[`style`]}),Ce=new ResizeObserver(()=>be());let e=_.value.parentElement;for(let t=0;t<5&&e&&e!==document.body;t++)Ce.observe(e),e=e.parentElement}we=new ResizeObserver(()=>be()),y.value&&we.observe(y.value),Te=new ResizeObserver(()=>be()),b.value&&Te.observe(b.value),le(r.manualFetch),(0,l.nextTick)(()=>be())});let U=e=>(0,Z.isFunction)(e)?e():e,Ee=e=>(0,Z.isString)(e),De=[`align`],Oe=e=>e.map(e=>({...De.reduce((e,t)=>({[t]:r[t]}),{}),...e}));return(0,l.onBeforeUnmount)(()=>{ve&&cancelAnimationFrame(ve),window.removeEventListener(`resize`,be),Se.disconnect(),xe?.disconnect(),Ce?.disconnect(),we?.disconnect(),Te?.disconnect()}),(t,n)=>{let a=(0,l.resolveComponent)(`a-menu-item`),c=(0,l.resolveComponent)(`a-menu`),f=(0,l.resolveComponent)(`a-dropdown`),p=(0,l.resolveComponent)(`a-pagination`);return(0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({ref_key:`boxEl`,ref:_,class:`h-full p-wrapper flex flex-col gap-8px overflow-y-auto`},(0,l.unref)(ie)),[ne.value===`bad`?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,ji,`请检查配置`)):((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.unref)(i)?.items?.some(e=>e.field&&e.itemRender)?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,{key:0,class:`p-pane p-form-wrapper`,ref_key:`pFormWrapper`,ref:v},[(0,l.createVNode)((0,l.unref)(u.Spin),{spinning:h.form},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Form),(0,l.mergeProps)({name:(0,l.unref)(i)?.name,key:O.value,ref_key:`formEl`,ref:E,model:R.value},ge.value,{onSubmit:_e}),{default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Row),{gutter:[6,12]},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)((0,l.unref)(i).items,(e,t)=>((0,l.openBlock)(),(0,l.createBlock)(Ci,{key:`_col_${e.field||t}`,"form-data":R.value,item:e,onReset:n[0]||=e=>le(r.lazyReset)},null,8,[`form-data`,`item`]))),128))]),_:1})]),_:1},16,[`name`,`model`]))]),_:1},8,[`spinning`])],512)):(0,l.createCommentVNode)(``,!0),(0,l.unref)(s)?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Mi,[(0,l.createElementVNode)(`div`,Ni,[(0,l.unref)(s).buttons&&(0,l.unref)(s).buttons.length>0?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:0},(0,l.renderList)((0,l.unref)(s).buttons,(e,t)=>((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:t},[e.dropdowns&&e.dropdowns.length?((0,l.openBlock)(),(0,l.createBlock)(f,{key:0},{overlay:(0,l.withCtx)(()=>[(0,l.createVNode)(c,{onClick:I},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(e.dropdowns,e=>((0,l.openBlock)(),(0,l.createBlock)(a,{key:e.code},{default:(0,l.withCtx)(()=>[e.content&&Ee(U(e.content))?((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:0},[(0,l.createTextVNode)((0,l.toDisplayString)(U(e.content)),1)],64)):e.content?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(U(e.content)),{key:1})):(0,l.createCommentVNode)(``,!0)]),_:2},1024))),128))]),_:2},1024)]),default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Button),{type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(s).disabled||e.disabled,loading:h.toolbar||!!e.code&&A[e.code],danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),e.content&&Ee(U(e.content))?((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.createTextVNode)((0,l.toDisplayString)(U(e.content)),1)],64)):e.content?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(U(e.content)),{key:2})):(0,l.createCommentVNode)(``,!0),(0,l.createVNode)((0,l.unref)(d.DownOutlined))]),_:2},1032,[`type`,`size`,`disabled`,`loading`,`danger`,`shape`,`ghost`,`block`])]),_:2},1024)):e.code?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Button),{key:1,type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(s).disabled||e.disabled,loading:h.toolbar||!!e.code&&A[e.code],danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block,onClick:t=>(0,l.unref)(se)(e.code)},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),e.content&&Ee(U(e.content))?((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.createTextVNode)((0,l.toDisplayString)(U(e.content)),1)],64)):e.content?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(U(e.content)),{key:2})):(0,l.createCommentVNode)(``,!0)]),_:2},1032,[`type`,`size`,`disabled`,`loading`,`danger`,`shape`,`ghost`,`block`,`onClick`])):((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Pi))],64))),128)):(0,l.createCommentVNode)(``,!0)]),(0,l.createElementVNode)(`span`,Fi,[(0,l.unref)(s).tools&&(0,l.unref)(s).tools.length>0?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:0},(0,l.renderList)((0,l.unref)(s).tools,(e,t)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Button),{key:t,type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(s).disabled||e.disabled,danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block,onClick:t=>(0,l.unref)(L)(e.code),loading:h.toolbar||!!e.code&&A[e.code]},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),e.content&&Ee(U(e.content))?((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.createTextVNode)((0,l.toDisplayString)(U(e.content)),1)],64)):e.content?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(U(e.content)),{key:2})):(0,l.createCommentVNode)(``,!0)]),_:2},1032,[`type`,`size`,`disabled`,`danger`,`shape`,`ghost`,`block`,`onClick`,`loading`]))),128)):(0,l.createCommentVNode)(``,!0)])])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,{ref_key:`tableWrapperEl`,ref:y,class:(0,l.normalizeClass)(`p-pane flex-1 h-0 min-h-0 flex flex-col p-${(0,l.unref)(m)??`inner`}-scroll`)},[(0,l.createElementVNode)(`div`,Ii,[((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Table),(0,l.mergeProps)({key:k.value+`_table`,"row-key":e.rowKey??`id`,ref_key:`tableEl`,ref:D,"row-class-name":e.striped?(e,t)=>t%2==1?`p-grid-row-striped`:``:``,columns:Oe((0,l.unref)(o)??[]).map(e=>(0,l.unref)(Yr)(e)),"data-source":F.value,loading:h.table,pagination:!1},H.value,{scroll:{x:`max-content`,y:x.value}}),(0,l.createSlots)({_:2},[T.value.length>0?{name:`headerCell`,fn:(0,l.withCtx)(({column:e})=>[T.value.some(t=>e.key&&t.field===e.key)?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(Ei),{key:k.value+`_title_`+P.value+`_slot_`+e.key,column:T.value.find(t=>e.key&&t.field===e.key)},null,8,[`column`])):(0,l.createCommentVNode)(``,!0)]),key:`0`}:void 0,N.value.length>0?{name:`bodyCell`,fn:(0,l.withCtx)(({column:e,record:t,index:n})=>[N.value.some(t=>e.key&&t.field===e.key)?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(ci),{key:k.value+`_cell_`+P.value+`_slot_`+e.key,column:N.value.find(t=>e.key&&t.field===e.key),"default-handler":{pick:ce,setLoadings:g},row:t,"row-index":n,"table-data":F.value},null,8,[`column`,`default-handler`,`row`,`row-index`,`table-data`])):(0,l.createCommentVNode)(``,!0)]),key:`1`}:void 0]),1040,[`row-key`,`row-class-name`,`columns`,`data-source`,`loading`,`scroll`]))]),(0,l.createElementVNode)(`div`,{ref_key:`tableFooterEl`,ref:b,class:`flex-shrink-0`},[ne.value!==`pagination`&&re.value?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Li,` 已选:`+(0,l.toDisplayString)(S.value.length),1)):ne.value===`pagination`?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Ri,[(0,l.createElementVNode)(`div`,zi,[re.value?((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:0},[(0,l.createTextVNode)(` 已选:`+(0,l.toDisplayString)(S.value.length),1)],64)):(0,l.createCommentVNode)(``,!0)]),(0,l.createVNode)(p,{size:`small`,responsive:!1,"show-size-changer":!0,"show-total":e=>`共${e}条数据`,current:ee.page,"page-size":ee.size,total:te.value,onChange:pe},null,8,[`show-total`,`current`,`page-size`,`total`])])):(0,l.createCommentVNode)(``,!0)],512)],2)],64))],16)}}}),Vi=c(o(((e,t)=>{(function(){"use strict";try{if(typeof document<`u`){var e=document.createElement(`style`);e.appendChild(document.createTextNode(`:root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}`)),document.head.appendChild(e)}}catch(e){console.error(`vite-plugin-css-injected-by-js`,e)}})(),(function(n,r){typeof e==`object`&&typeof t<`u`?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self,n.EVirtTable=r())})(e,function(){"use strict";var e=Object.defineProperty,t=(t,n,r)=>n in t?e(t,n,{enumerable:!0,configurable:!0,writable:!0,value:r}):t[n]=r,n=(e,n,r)=>t(e,typeof n==`symbol`?n:n+``,r);class r{constructor(e){n(this,`rules`),this.rules=e}validate(e){let t=[],{column:n,row:r,key:i,rowKey:a,colIndex:o,rowIndex:s,value:c,field:l,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(let e of this.rules){if(e.validator){let d={field:l,fieldValue:u,value:c,column:n,colIndex:o,rowIndex:s,row:r,key:i,rowKey:a,...e};e.validator(d,c,e=>{e&&t.push({...d,message:e})})}if(!e.required&&(c==null||c===``))return t;e.pattern&&!e.pattern.test(c)&&t.push({value:c,column:n,row:r,key:i,rowKey:a,colIndex:o,rowIndex:s,field:l,fieldValue:u,message:e.message||`${i} is pattern validation error`}),e.required&&(c==null||c===``)&&t.push({value:c,column:n,row:r,key:i,rowKey:a,colIndex:o,rowIndex:s,field:l,fieldValue:u,message:e.message||`${i} is required`})}return t}}function i(){return`xxxxxxxxxxxxxxxxxx`.replace(/[x]/g,function(e){let t=Math.random()*16|0;return(e===`x`?t:t&3|8).toString(16)})}function a(e,t){let n=0,r;return function(...i){let a=new Date().getTime(),o=a-n,s=typeof t==`function`?t():t;!n||o>=s?(e.apply(this,i),n=a):r||=setTimeout(()=>{e.apply(this,i),n=new Date().getTime(),r=void 0},s-o)}}function o(e=[]){return e.length?e.map(e=>o(e.children)+1).sort((e,t)=>t-e)[0]:0}function s(e=[]){let t=[],n=[],r=[];return e.forEach(e=>{e.fixed===`left`?t.push(e):e.fixed===`right`?r.push(e):n.push(e)}),[...t.sort((e,t)=>(e.sort??0)-(t.sort??0)),...n.sort((e,t)=>(e.sort??0)-(t.sort??0)),...r.sort((e,t)=>(e.sort??0)-(t.sort??0))]}function c(e=[],t=1,n=0,r=``){return e.sort((e,t)=>(e.sort??0)-(t.sort??0)).map(e=>{if(e.children){let i=0,a=e.fixed;e.children.forEach(e=>{e.fixed=a});let o=c(e.children,t-1,n+1,e.key);return o&&o.forEach(e=>{i+=e.colspan??0}),{...e,width:e.width,level:n,rowspan:1,colspan:i,parentKey:r,children:o.sort((e,t)=>(e.sort??0)-(t.sort??0))}}return{...e,level:n,rowspan:t,colspan:1,parentKey:r}})}function l(e=[]){let t=[];return e.forEach(e=>{e.children?t=t.concat(l(e.children)):t.push(e)}),t}function u(e){return e.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:u(e.children)}:{...e})}let d=/^(\r\n|\n\r|\r|\n)/,f=/^[^\t\r\n]+/,p=/^\t/;function m(e){let t=[[``]];if(e.length===0)return t;let n=0,r=0,i;for(;e.length>0&&i!==e.length;)if(i=e.length,e.match(p))e=e.replace(p,``),n+=1,t[r][n]=``;else if(e.match(d))e=e.replace(d,``),n=0,r+=1,t[r]=[``];else{let i=``;if(e.startsWith(`"`)){let t=0,n=!0;for(;n;){let r=e.slice(0,1);r===`"`&&(t+=1),i+=r,e=e.slice(1),(e.length===0||e.match(/^[\t\r\n]/)&&t%2==0)&&(n=!1)}i=i.replace(/^"/,``).replace(/"$/,``).replace(/["]*/g,e=>Array(Math.floor(e.length/2)).fill(`"`).join(``))}else{let t=e.match(f);i=t?t[0]:``,e=e.slice(i.length)}t[r][n]=i}return Array.isArray(t)&&t.length>1&&t[t.length-1].length===1&&t[t.length-1][0]===``&&(t=t.slice(0,t.length-1)),t}function h(e){let t,n,r,i,a=``,o;for(t=0,n=e.length;t<n;t+=1){for(i=e[t].length,r=0;r<i;r+=1)r>0&&(a+=` `),o=e[t][r],typeof o==`string`?o.indexOf(`
2
+ `)>-1?a+=`"${o.replace(/"/g,`""`)}"`:a+=o:o==null?a+=``:a+=o;t!==n-1&&(a+=`
3
+ `)}return a}function g(e,t,n=[]){let r=0,i=[];return e.forEach((a,o)=>{o===0?i.push(1):(n.reduce((e,t)=>`${e}${a[t]??``}`,``)||a[t])===(n.reduce((t,n)=>`${t}${e[o-1][n]??``}`,``)||e[o-1][t])?(i[r]+=1,i.push(0)):(i.push(1),r=o)}),i}function _(e,t){let n=``,r=``,i={};return t.forEach((t,a)=>{a===0?(n=t.key,r=t.key,i[t.key]=1):e[t.key]===e[n]?(i[t.key]=0,i[r]+=1):(i[t.key]=1,n=t.key,r=t.key)}),i}function v(e,t,n=[]){let{visibleRows:r,rowIndex:i,headIndex:a}=e,o=g(r,t,n);return o[i-a]===0?{rowspan:0,colspan:0,relationRowKeys:n,mergeRow:!0}:{rowspan:o[i-a],colspan:1,relationRowKeys:n,mergeRow:!0}}function y(e,t=[]){let{column:n,row:r,visibleLeafColumns:i}=e,a=i.filter(e=>t.includes(e.key));if(t.includes(n.key)){let e=_(r,a);return e[n.key]===0?{rowspan:0,colspan:0,relationColKeys:t,mergeCol:!0}:{rowspan:1,colspan:e[n.key],relationColKeys:t,mergeCol:!0}}}function b(e,t=document.documentElement){let n=e.startsWith(`--`)?e:`--${e}`;return getComputedStyle(t).getPropertyValue(n).trim()}function x(e){if(!e)return new Date(0);if(typeof e==`number`)return new Date(e);let t=String(e).trim(),n=new Date(t);if(!isNaN(n.getTime()))return n;for(let e of[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/]){let n=t.match(e);if(n){let t=n.slice(1).map(Number);if(e.source.includes(`YYYY-MM-DD`)||e.source.includes(`YYYY/MM/DD`)||e.source.includes(`YYYY.MM.DD`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(e,n-1,r,i,a,o)}else if(e.source.includes(`DD-MM-YYYY`)||e.source.includes(`DD/MM/YYYY`)||e.source.includes(`DD.MM.YYYY`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(r,n-1,e,i,a,o)}else if(e.source.includes(`MM-DD-YYYY`)||e.source.includes(`MM/DD/YYYY`)||e.source.includes(`MM.DD.YYYY`)){let[e,n,r,i=0,a=0,o=0]=t;return new Date(r,e-1,n,i,a,o)}else if(e.source.includes(`YYYYMMDD`)){let[e,n,r]=t;return new Date(e,n-1,r)}}}return new Date(NaN)}function S(e,t){let n=x(e),r=x(t);return isNaN(n.getTime())&&isNaN(r.getTime())?0:isNaN(n.getTime())?-1:isNaN(r.getTime())?1:n.getTime()-r.getTime()}class C{constructor(e,t,r,i,a,o,s){n(this,`ctx`),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`,0),n(this,`fixed`),n(this,`cellType`),this.ctx=e,this.x=t,this.y=r,this.width=i,this.height=a,this.fixed=s,this.cellType=o}isHorizontalVisible(){if(this.fixed)return!0;let{stageWidth:e,fixedLeftWidth:t,scrollX:n,fixedRightWidth:r}=this.ctx,i=e;return!(this.x+this.width-t-n<=0||this.x-n>=i-r)}isVerticalVisible(){let{stageHeight:e,scrollY:t}=this.ctx,n=e;return!(this.y+this.height-t<=0||this.y-t>=n)}getDrawX(){if(this.fixed===`left`)return this.x;if(this.fixed===`right`){let{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType===`header`||this.cellType===`footer`&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class w extends C{constructor(e,t,r,i,a,o,s,c,l,u=`body`,d=!0){super(e,i,a,o,s,u,c.fixed),n(this,`formatter`),n(this,`formatterFooter`),n(this,`hoverIconName`,``),n(this,`operation`,!1),n(this,`align`),n(this,`verticalAlign`),n(this,`fixed`),n(this,`type`),n(this,`editorType`),n(this,`editorProps`),n(this,`cellType`),n(this,`level`),n(this,`colspan`,1),n(this,`rowspan`,1),n(this,`mergeRow`,!1),n(this,`mergeCol`,!1),n(this,`relationRowKeys`,[]),n(this,`relationColKeys`,[]),n(this,`key`),n(this,`column`),n(this,`rowIndex`),n(this,`colIndex`),n(this,`rowKey`),n(this,`row`),n(this,`value`),n(this,`render`),n(this,`renderFooter`),n(this,`style`,{}),n(this,`domDataset`,{}),n(this,`rules`,[]),n(this,`message`,``),n(this,`text`,``),n(this,`displayText`,``),n(this,`visibleWidth`,0),n(this,`visibleHeight`,0),n(this,`isHasChanged`,!1),n(this,`drawX`,0),n(this,`drawY`,0),n(this,`drawCellBgColor`,``),n(this,`drawCellSkyBgColor`,``),n(this,`drawTextColor`,``),n(this,`drawTextFont`,``),n(this,`drawTextX`,0),n(this,`drawTextY`,0),n(this,`drawTextWidth`,0),n(this,`drawTextHeight`,0),n(this,`drawTreeImageX`,0),n(this,`drawTreeImageY`,0),n(this,`drawTreeImageWidth`,0),n(this,`drawTreeImageHeight`,0),n(this,`drawTreeImageName`,``),n(this,`drawTreeImageSource`),n(this,`drawSelectionImageX`,0),n(this,`drawSelectionImageY`,0),n(this,`drawSelectionImageWidth`,0),n(this,`drawSelectionImageHeight`,0),n(this,`drawSelectionImageName`,``),n(this,`drawSelectionImageSource`),n(this,`drawHoverImageX`,0),n(this,`drawHoverImageY`,0),n(this,`drawHoverImageWidth`,0),n(this,`drawHoverImageHeight`,0),n(this,`drawHoverImageName`,``),n(this,`drawHoverImageSource`),n(this,`autoRowHeight`,!1),n(this,`calculatedHeight`,0),n(this,`ellipsis`,!1),n(this,`rowExpand`,!1),n(this,`rowHasChildren`,!1),n(this,`overflowTooltipShow`,!0),n(this,`selectorCellValueType`,`value`),n(this,`overflowTooltipMaxWidth`,500),n(this,`overflowTooltipPlacement`,`top`),n(this,`maxLineClamp`,`auto`),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=r,this.rowIndex=t,this.key=c.key,this.type=c.type||``,this.editorType=c.editorType||`text`,this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||`value`,this.editorProps=c.editorProps||{},this.cellType=u,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||``,this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=l,this.rowKey=this.cellType===`body`?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=c.render,this.overflowTooltipShow=c.overflowTooltipShow!==!1,this.autoRowHeight=c.autoRowHeight===void 0?this.ctx.config.AUTO_ROW_HEIGHT:c.autoRowHeight,this.overflowTooltipMaxWidth=c.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=c.overflowTooltipPlacement||`top`,this.renderFooter=c.renderFooter,this.hoverIconName=c.hoverIconName,this.formatter=c.formatter,this.formatterFooter=c.formatterFooter,this.maxLineClamp=c.maxLineClamp||`auto`,d&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){let e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){let[t]=e;this.message=t.message||``}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType===`footer`)return;let{SPAN_METHOD:e}=this.ctx.config;if(typeof e==`function`){let{colspan:t=1,rowspan:n=1,relationRowKeys:r,relationColKeys:i,mergeRow:a=!1,mergeCol:o=!1}=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(r)&&r.length>0?this.relationRowKeys=r:this.relationRowKeys=[this.key],Array.isArray(i)&&i.length>0?this.relationColKeys=i:this.relationColKeys=[this.key],this.mergeCol=o,this.mergeRow=a,this.colspan=t,this.rowspan=n,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){let e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){let{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e==`function`){let t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){let{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e==`function`){let t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){let{type:e,props:n={}}=t;this.editorType=e,this.editorProps=n}}}updateRender(){let{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e==`function`){let t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=``}).catch(e=>{if(Array.isArray(e)&&e.length){let[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit(`draw`)})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){let{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:n}=this,r,i=0,a=``;if(!([`tree`,`selection-tree`,`tree-selection`].includes(this.type)&&n===`body`))return;let{expand:o=!1,hasChildren:s=!1,expandLoading:c=!1,level:l=0}=this.ctx.database.getRowForRowKey(t)||{};this.rowExpand=o,this.rowHasChildren=s;let{TREE_INDENT:u=16,CHECKBOX_SIZE:d,TREE_ICON_SIZE:f}=this.ctx.config;if(i=l*u,c){let e=this.ctx.icons.get(`loading`);a=`loading`,r=e}else if(s){let e=this.ctx.icons.get(`expand`),t=this.ctx.icons.get(`shrink`);r=o?t:e,a=o?`shrink`:`expand`}let p=f,m=f,h=this.drawX;(this.align===`center`||this.align===`right`)&&(h=this.drawX+(this.visibleWidth-p-2*e)/2,this.align=`left`);let g=h+i+e,_=this.drawY+(this.visibleHeight-m)/2,v=i+this.drawX+p-.5;this.type===`selection-tree`?(g=i+this.drawSelectionImageX+this.drawSelectionImageWidth,v=g+p-e/2):v=this.type===`tree-selection`?g+d+p-e/2:g+p-e/2,this.drawTextX=v,this.drawTextWidth=this.drawX+this.visibleWidth-v,!(g+p+e>this.drawX+this.visibleWidth)&&(_+m+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=g,this.drawTreeImageY=_,this.drawTreeImageWidth=p,this.drawTreeImageHeight=m,r?(this.drawTreeImageName=a,this.drawTreeImageSource=r):(this.drawTreeImageName=``,this.drawTreeImageSource=void 0)))}drawTreeLine(){let{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:n=16,TREE_LINE_COLOR:r=`#e1e6eb`}=this.ctx.config;if(!e||this.cellType!==`body`||![`tree`,`selection-tree`,`tree-selection`].includes(this.type)||this.rowspan===0||this.colspan===0)return;let i=this.ctx.database.getRowForRowKey(this.rowKey)||{},a=i.level??0,o=this.drawTreeImageX+this.drawTreeImageWidth/2,s=this.drawTreeImageY+this.drawTreeImageHeight/2,c=this.drawTreeImageX-a*t,l=Array.isArray(i.parentRowKeys)?i.parentRowKeys:[];if(a>0){for(let e=0;e<a-1;e+=1){let i=l[e+1];if((i&&this.ctx.database.getRowForRowKey(i)||{}).isLastChild)continue;let o=Math.round(this.drawTreeImageX-(a-e)*t+n/2);this.ctx.paint.drawLine([o,this.drawY,o,this.drawY+this.visibleHeight],{borderColor:r,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}let e=Math.round(this.drawTreeImageX-t+n/2),u=i.isLastChild?s:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([e,this.drawY,e,u],{borderColor:r,borderWidth:1,lineDash:[4,4],lineDashOffset:0});let d=Math.round(c+(a-1)*t+n/2);this.ctx.paint.drawLine([d,s,o,s],{borderColor:r,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(i.hasChildren&&i.expand){let e=this.drawTreeImageY+this.drawTreeImageHeight,t=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([o,e,o,t],{borderColor:r,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){let{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:n,FOOTER_CELL_STYLE_METHOD:r,READONLY_TEXT_COLOR:i,BODY_TEXT_COLOR:a,FOOTER_TEXT_COLOR:o,FOOTER_BG_COLOR:s,HIGHLIGHT_SELECTED_ROW:c,HIGHLIGHT_SELECTED_ROW_COLOR:l,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:d,STRIPE:f,STRIPE_COLOR:p,FINDER_CELL_BG_COLOR:m}=this.ctx.config;if(this.cellType===`footer`){let e=s,t=o;if(typeof r==`function`){let{backgroundColor:n,color:i,font:a}=r({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};n&&(e=n),i&&(t=i),a&&(this.drawTextFont=a)}this.drawCellSkyBgColor=`transparent`,this.drawCellBgColor=e,this.drawTextColor=t;return}let h=`transparent`,g=this.ctx.hoverCell,_=this.ctx.currentCell,v=this.rowIndex,y=this.rowIndex;if(this.rowspan!==1&&(u||c)){let{yArr:e}=this.getSpanInfo();v=e[0],y=e[1]}u&&g&&(g.rowKey===this.rowKey&&(h=d),g.rowIndex>=v&&g.rowIndex<=y&&(h=d)),c&&_&&(_.rowKey===this.rowKey&&(h=l),_.rowIndex>=v&&_.rowIndex<=y&&(h=l)),this.drawCellSkyBgColor=h;let b=e,x=a;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(b=t,x=i),f&&(b=this.rowIndex%2?p:e),typeof n==`function`){let{backgroundColor:e,color:t,font:r}=n({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};e&&(b=e),t&&(x=t),r&&(this.drawTextFont=r)}let{rowIndex:S,colIndex:C,type:w}=this.ctx.finderBar;S===this.rowIndex&&C===this.colIndex&&w===`body`&&(b=m),this.drawCellBgColor=b,this.drawTextColor=x}updateSelection(){let{visibleWidth:e,visibleHeight:t,rowspan:n,colspan:r,cellType:i,type:a,rowIndex:o,rowKey:s}=this;if(n===0||r===0||i===`footer`||![`index-selection`,`selection`,`selection-tree`,`tree-selection`].includes(a))return;let c=this.ctx.database.getRowSelectable(s),{CHECKBOX_SIZE:l=0,CELL_PADDING:u}=this.ctx.config,d=this.drawX+u;(this.align===`center`||this.align===`right`)&&(d=this.drawX+(e-l)/2);let f=d,p=this.drawY+(t-l)/2;if(a!==`selection-tree`&&a===`tree-selection`){let{TREE_INDENT:e=16,TREE_ICON_SIZE:t}=this.ctx.config,{level:n=0}=this.ctx.database.getRowForRowKey(s)||{},r=n*e;f=d+t+r}let m=this.ctx.icons.get(`checkbox-uncheck`),h=`checkbox-uncheck`;if(a===`selection-tree`||a===`tree-selection`){let e=this.ctx.database.getTreeSelectionState(s);e.indeterminate&&c?(m=this.ctx.icons.get(`checkbox-indeterminate`),h=`checkbox-indeterminate`):e.checked&&c?(m=this.ctx.icons.get(`checkbox-check`),h=`checkbox-check`):!e.checked&&c?(m=this.ctx.icons.get(`checkbox-uncheck`),h=`checkbox-uncheck`):(m=this.ctx.icons.get(`checkbox-disabled`),h=`checkbox-disabled`)}else{let e=this.ctx.database.getRowSelection(s);e&&c?(m=this.ctx.icons.get(`checkbox-check`),h=`checkbox-check`):e&&!c?(m=this.ctx.icons.get(`checkbox-check-disabled`),h=`checkbox-check-disabled`):!e&&c?(m=this.ctx.icons.get(`checkbox-uncheck`),h=`checkbox-uncheck`):(m=this.ctx.icons.get(`checkbox-disabled`),h=`checkbox-disabled`)}f+l+u>this.drawX+this.visibleWidth||p+l+u>this.drawY+this.visibleHeight||(a===`index-selection`?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===o||[`checkbox-disabled`,`checkbox-check`].includes(h))&&(this.drawSelectionImageX=f,this.drawSelectionImageY=p,this.drawSelectionImageWidth=l,this.drawSelectionImageHeight=l,this.drawSelectionImageName=h,this.drawSelectionImageSource=m):(this.drawSelectionImageX=f,this.drawSelectionImageY=p,this.drawSelectionImageWidth=l,this.drawSelectionImageHeight=l,this.drawSelectionImageName=h,this.drawSelectionImageSource=m))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;let{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:n,ENABLE_MERGE_CELL_LINK:r}=this.ctx.config;if(typeof e==`function`){let t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.hoverIconName=t)}let{hoverCell:i}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&i){let e=0,a=0;if(i.rowKey===this.rowKey&&(e=this.drawX+this.width-t-n,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&r){let r=this.getSpanInfo(),{yArr:o}=r,s=o[0],c=o[1];if(i.rowIndex>=s&&i.rowIndex<=c){let{width:i,height:o,offsetTop:s,offsetLeft:c}=r;e=this.drawX-c+i-t-n,a=this.drawY-s+(o-t)/2}}let o=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=e,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=o}}getAutoHeight(){if(this.cellType!==`body`||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){let e=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?e<this.visibleHeight?0:Math.round(e-(this.visibleHeight-this.height)):Math.round(e)}if(!(this.displayText&&typeof this.displayText==`string`))return 0;let{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:n}=this.ctx.config,r=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,i=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:n,maxLineClamp:this.maxLineClamp,cacheTextKey:r});return this.rowspan>1?i<this.visibleHeight?0:Math.round(i-(this.visibleHeight-this.height)):Math.round(i)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType===`footer`?this.renderFooter||this.text===null||this.text===void 0?``:this.text:this.rowspan===0||this.colspan===0||this.render||this.type===`index-selection`&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||[`checkbox-disabled`,`checkbox-check`].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?``:`${this.text}`}getText(){if(this.cellType===`footer`)return typeof this.formatterFooter==`function`?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter==`function`)return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});let{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e==`function`?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):[`index-selection`,`index`].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed===`left`?e=this.drawX:this.fixed===`right`&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType===`footer`&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign===`middle`){let e=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(e<this.visibleHeight&&e>0){let n=(this.visibleHeight-e)/2;t+=n}}this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999);let n={};return this.rowspan===0&&(n={display:`none`}),{position:`absolute`,overflow:`hidden`,left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?`auto`:`${this.visibleHeight}px`,pointerEvents:`initial`,userSelect:`none`,...n}}drawContainer(){let{paint:e,config:{BORDER_COLOR:t,BORDER:n}}=this.ctx,{drawX:r,drawY:i}=this;e.drawRect(r,i,this.visibleWidth,this.visibleHeight,{borderColor:n?t:`transparent`,fillColor:this.drawCellBgColor}),e.drawRect(r,i,this.width,this.height,{borderColor:`transparent`,fillColor:this.drawCellSkyBgColor}),n||this.ctx.paint.drawLine([r,i+this.visibleHeight,r+this.visibleWidth,i+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:`round`,lineJoin:`round`})}drawAutofillPiont(){if(this.cellType===`footer`)return;let{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:n,AUTOFILL_POINT_BORDER_COLOR:r}=this.ctx.config;if(!n||!t||this.ctx.editing)return;let{xArr:i,yArr:a}=this.ctx.selector,o=i[1],s=a[1],{colIndex:c,rowIndex:l,drawX:u,drawY:d}=this;if(c===o&&l===s){let t=c===this.ctx.maxColIndex||l===this.ctx.maxRowIndex||c===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-t,d+this.height-t,6,6,{borderColor:r,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let n=0;for(let r=e;r<e+t;r++){let e=this.ctx.header.leafCellHeaders[r];n+=e.width}return n}drawText(){let{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:n,CELL_LINE_HEIGHT:r}=this.ctx.config,{placeholder:i}=this.column,a=this.displayText,o=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&i&&[``,null,void 0].includes(this.text)&&this.cellType===`body`&&!(this.rowspan===0||this.colspan===0)&&(a=i,o=n),[``,null,void 0].includes(a))return!1;typeof a!=`string`&&(a=`${a}`);let s=`${a}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(a,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:o,autoRowHeight:this.autoRowHeight,lineHeight:r,maxLineClamp:this.maxLineClamp,cacheTextKey:s}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){let{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType===`footer`)return;let{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;let{xArr:t,yArr:n,xArrCopy:r,yArrCopy:i}=this.ctx.selector;this.drawBorder({xArr:r,yArr:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||`rgb(82,146,247)`,fillColor:`transparent`,borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||`rgb(82,146,247)`,fillColor:`transparent`,borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:n,borderColor:this.ctx.config.SELECT_BORDER_COLOR||`rgb(82,146,247)`,fillColor:`transparent`,borderWidth:1});let[a,o]=t,[s,c]=n;!(a===o&&s===c)&&this.colIndex>=a&&this.colIndex<=o&&this.rowIndex>=s&&this.rowIndex<=c&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:`transparent`,fillColor:this.ctx.config.SELECT_AREA_COLOR||`rgba(82,146,247,0.1)`}),this.operation&&this.rowIndex>=s&&this.rowIndex<=c&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:`transparent`,fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||`transparent`})}drawErrorTip(){if(this.cellType===`footer`||!this.message||this.rowspan===0||this.colspan===0)return;let{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:n}=this,r=this.drawX,i=this.drawY,a=[r+n-e-.5,i,r+n-.5,i,r+n-.5,i+e];this.ctx.paint.drawLine(a,{borderColor:t,fillColor:t,borderWidth:1,lineCap:`round`,lineJoin:`round`})}drawBorder(e){let{drawX:t,drawY:n,rowIndex:r,colIndex:i,height:a,width:o}=this,s=t,c=n,{xArr:l,yArr:u,lineDash:d=[],borderWidth:f=1,borderColor:p,fillColor:m}=e,h=l[0],g=l[1],_=u[0],v=u[1];if(i>=h&&i<=g&&r===_){let e=+(i===g),t=+(i===h);this.ctx.paint.drawLine([s+t,c+1,s+o-e,c+1],{borderColor:p,fillColor:m,borderWidth:f,lineCap:`round`,lineJoin:`round`,lineDash:d})}if(i===g&&r>=_&&r<=v){let e=+(r===_),t=+(r===v);this.ctx.paint.drawLine([s+o-1,c+e,s+o-1,c+a-t],{borderColor:p,fillColor:m,borderWidth:f,lineCap:`round`,lineJoin:`round`,lineDash:d})}if(i>=h&&i<=g&&r===v){let e=+(i===g),t=+(i===h);this.ctx.paint.drawLine([s+t,c+a-1,s+o-e,c+a-1],{borderColor:p,fillColor:m,borderWidth:f,lineCap:`round`,lineJoin:`round`,lineDash:d})}if(i===h&&r>=_&&r<=v){let e=+(r===v),t=+(r===_);this.ctx.paint.drawLine([s+1,c+t,s+1,c+a-e],{borderColor:p,fillColor:m,borderWidth:f,lineCap:`round`,lineJoin:`round`,lineDash:d})}}}class T{constructor(e,t){n(this,`ctx`),n(this,`data`),n(this,`columns`),n(this,`footerData`,[]),n(this,`rowKeyMap`,new Map),n(this,`colIndexKeyMap`,new Map),n(this,`headerMap`,new Map),n(this,`rowIndexRowKeyMap`,new Map),n(this,`rowKeyRowIndexMap`,new Map),n(this,`checkboxKeyMap`,new Map),n(this,`selectionMap`,new Map),n(this,`expandMap`,new Map),n(this,`originalDataMap`,new Map),n(this,`changedDataMap`,new Map),n(this,`validationErrorMap`,new Map),n(this,`itemRowKeyMap`,new WeakMap),n(this,`bufferData`,[]),n(this,`customHeader`,{fixedData:{},sortData:{},hideData:{},resizableData:{}}),n(this,`overlayerAutoHeightMap`,new Map),n(this,`maxRowHeightCellMap`,new Map),n(this,`bufferCheckState`,{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),n(this,`sumHeight`,0),n(this,`filterMethod`),n(this,`positions`,[]),n(this,`sortState`,new Map),this.ctx=e;let{data:r=[],columns:i=[],footerData:a=[]}=t;this.data=r,this.footerData=a,this.columns=i,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();let t=l(this.getColumns());if(this.ctx.hasSelection=t.some(e=>e.type===`selection`),this.ctx.hasTree=t.some(e=>e.type===`tree`),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();let{ROW_KEY:e}=this.ctx.config;e?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,n=[]){let r=e.length,{ROW_KEY:a=``,DEFAULT_EXPAND_ALL:o,CELL_HEIGHT:s,SELECTABLE_METHOD:c,CHECKBOX_KEY:l,TREE_CHILDREN_KEY:u}=this.ctx.config;e.forEach((e,d)=>{u!==`children`&&(e.children=e[u]);let f=e[a],p=f==null?i():`${f}`;this.itemRowKeyMap.set(e,p);let m=e._height||s,h=e._readonly,g=!0;if(typeof c==`function`&&(g=c),l){let t=e[l];if(this.checkboxKeyMap.has(t)){let e=this.checkboxKeyMap.get(t)||[];e.push(p),this.checkboxKeyMap.set(t,e)}else this.checkboxKeyMap.set(t,[p])}this.selectionMap.set(p,{key:l?e[l]:p,row:e,check:this.selectionMap.get(p)?.check||!1});let _=o||this.expandMap.get(p)||e._expand||!1;this.expandMap.set(p,_),this.rowKeyMap.set(p,{readonly:h,index:d,rowIndex:d,level:t,height:m,calculatedHeight:-1,check:!1,selectable:g,expand:_,expandLazy:!1,hasChildren:e._hasChildren||(Array.isArray(e.children)?e.children.length>0:!1),expandLoading:!1,item:e,parentRowKeys:n,parentRowKey:n[n.length-1]||``,isLastChild:d===r-1}),Array.isArray(e.children)&&e.children.length&&this.initData(e.children,t+1,[...n,p])})}setRowHeight(e,t){let n=this.rowIndexRowKeyMap.get(e);if(n===void 0)return;let r=this.rowKeyMap.get(n);r.height=t,r.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:e,height:t})=>{let n=this.rowIndexRowKeyMap.get(e);if(n){let e=this.rowKeyMap.get(n);e.height=t,e.item._height=t}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:e,rowIndex:t})=>this.getPositionForRowIndex(t).calculatedHeight===e)?!1:(e.forEach(({rowIndex:e,height:t})=>{let n=this.rowIndexRowKeyMap.get(e);if(n){let e=this.rowKeyMap.get(n),{height:r=-1}=this.getMaxRowHeightItem(n)||{};e.calculatedHeight=Math.max(t,r)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[],t=n=>{n.forEach(n=>{e.push(n),Array.isArray(n.children)&&t(n.children)})};return t(this.data),e}generateColumns(e){let t=e=>e.map(e=>{let n=e.children&&Array.isArray(e.children)?t(e.children):void 0,r={hide:this.customHeader?.hideData?.[e.key],fixed:this.customHeader?.fixedData?.[e.key],sort:this.customHeader?.sortData?.[e.key],width:this.customHeader?.resizableData?.[e.key]},i={};for(let[e,t]of Object.entries(r))t!==void 0&&(i[e]=t);let a=n&&n.every(e=>e.hide);return{...e,children:n,hide:a||(typeof e.hide==`function`?e.hide(e):e.hide),...i}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];let n=r=>{r.forEach(r=>{e.push(r);let i=this.itemRowKeyMap.get(r),{expand:a,hasChildren:o,height:s,calculatedHeight:c}=this.rowKeyMap.get(i),l=this.sumHeight,u=Math.max(c,s);this.sumHeight+=u,this.rowIndexRowKeyMap.set(t,i),this.rowKeyRowIndexMap.set(i,t),this.positions.push({top:l,height:u,bottom:this.sumHeight,calculatedHeight:c}),t+=1,a&&o&&n(r.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let r=this.data;if(typeof this.filterMethod==`function`&&(r=this.filterMethod(r)),this.sortState.size){let e=Array.from(this.sortState.entries()).sort((e,t)=>e[1].timestamp-t[1].timestamp);r=this.sortDataRecursive(r,e)}return n(r),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:`none`,timestamp:0}}setSortState(e,t){let n=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t===`none`?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:n}),this.ctx.emit(`sortChange`,this.sortState),this.clearBufferData(),this.ctx.emit(`draw`)}clearSort(){this.sortState.clear(),this.ctx.emit(`sortChange`,this.sortState),this.clearBufferData(),this.ctx.emit(`draw`)}sortDataRecursive(e,t){let n=[...e];for(let[e,{direction:r}]of t){if(r===`none`)continue;let t=this.getColumnByKey(e);!t||!t.column.sortBy||(n=this.applySingleColumnSort(n,e,r,t.column.sortBy))}return n.map(e=>(e.children&&Array.isArray(e.children)&&(e.children=this.sortDataRecursive(e.children,t)),e))}applySingleColumnSort(e,t,n,r){return e.sort((e,i)=>{let a=e[t],o=i[t],s=0;if(typeof r==`function`)s=r(e,i);else if(r===`number`)s=(Number(a)||0)-(Number(o)||0);else if(r===`string`){let e=String(a||``),t=String(o||``);s=e.localeCompare(t)}else r===`date`&&(s=S(a,o));return n===`asc`?s:-s})}expandItem(e,t=!1){let n=this.rowKeyMap.get(e);n.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit(`draw`)}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(e=>{let n=this.rowKeyMap.get(e);this.expandMap.set(e,t),n.expand=t}),this.clearBufferData(),this.ctx.emit(`draw`)}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,n)=>{t.expand&&e.push(n)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit(`draw`)}expandLoading(e,t=!1){let n=this.rowKeyMap.get(e);n.expandLoading=t,this.clearBufferData(),this.ctx.emit(`draw`)}setExpandChildren(e,t){let n=this.rowKeyMap.get(e);n.expand=!0,this.expandMap.set(e,!0),n.expandLazy=!0,n.item.children=t,this.initData(n.item.children,n.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){let t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||``}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;let n=this.rowIndexRowKeyMap.get(e),r=this.colIndexKeyMap.get(t);return n===void 0||r===void 0?null:{rowKey:n,key:r,value:this.getItemValue(n,r)}}getItemValue(e,t){let n=this.rowKeyMap.get(e);return n&&n.item?n.item[t]===void 0?null:n.item[t]:null}async batchSetItemValue(e,t=!1,n=!0,r=`none`){let i=[],a=n,o=new Set,s=[],c=e.map(e=>{let{rowKey:t,key:n}=e,r=e.value,i=r,a=this.getRowDataItemForRowKey(t),o=this.getItemValue(t,n);return this.getVirtualBodyCellByKey(t,n)?.type===`number`&&([``,void 0,null].includes(r)?i=null:/^-?\d+(\.\d+)?$/.test(`${r}`)?i=Number(r):(i=o,s.push({...e,value:i,oldValue:o,row:a}))),{...e,value:i,oldValue:o,row:a}});if(c=c.filter(e=>!s.some(t=>e.rowKey===t.rowKey&&e.key===t.key)),s.length){let e={code:`ERR_BATCH_SET_NUMBER_VALUE`,message:`Assignment failed, not a numeric type`,data:s};this.ctx.emit(`error`,e)}if(c=c.filter(e=>e.oldValue!==e.value),!c.length)return;let{BEFORE_VALUE_CHANGE_METHOD:l}=this.ctx.config;r===`none`&&typeof l==`function`&&(c=await l(c),a=!1),c.forEach(e=>{let{value:t,rowKey:n,key:r}=e,s=this.getItemValue(n,r);o.add(n),this.setItemValue(n,r,t,!1,!1,!1,a),i.push({rowKey:n,key:r,oldValue:s,newValue:t})});let u=[];o.forEach(e=>{u.push(this.ctx.database.getRowDataItemForRowKey(e))});let d=c.map(({rowKey:e,key:t})=>this.getValidator(e,t));Promise.all(d).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit(`validateChangedData`,this.getChangedData())});let f=c.map(e=>{let t=!!this.getValidationError(e.rowKey,e.key).length;return{...e,errorTip:t}});this.ctx.emit(`change`,f,u),t&&this.ctx.history.pushState({changeList:i,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:`multiple`}),this.ctx.emit(`draw`)}async setItemValue(e,t,n,r=!1,i=!1,a=!1,o=!0){if(!this.rowKeyMap.has(e))return{};let{item:s}=this.rowKeyMap.get(e),c=s[t],l=n;if(o&&this.ctx.database.getReadonly(e,t))return{oldValue:c,newValue:c};s[t]!==null&&typeof s[t]==`object`&&(c=JSON.parse(JSON.stringify(s[t])));let u=`${e}​_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,c);let d=this.originalDataMap.get(u),f=this.getRowDataItemForRowKey(e);if(a){if(this.getVirtualBodyCellByKey(e,t)?.type===`number`)if([``,void 0,null].includes(n))l=null;else if(/^-?\d+(\.\d+)?$/.test(`${n}`))l=Number(n);else{l=c;let n={code:`ERR_SET_NUMBER_VALUE`,message:`Assignment failed, not a numeric type`,data:[{rowKey:e,key:t,value:l,oldValue:c,row:f}]};this.ctx.emit(`error`,n)}if(l===c)return{oldValue:c,newValue:c};let i=[{rowKey:e,key:t,value:l,oldValue:c,row:f}];this.batchSetItemValue(i,r,!1),this.ctx.emit(`editChange`,{rowKey:e,key:t,oldValue:c,value:l,originalValue:d,row:f})}else this.changedDataMap.set(u,l),s[t]=l;return this.ctx.hasEvent(`iterationChange`)&&this.ctx.emit(`iterationChange`,{rowKey:e,key:t,oldValue:c,value:l,originalValue:this.originalDataMap.get(u),row:f}),i&&this.ctx.emit(`draw`),{oldValue:c,newValue:l}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};let{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){let{CHECKBOX_KEY:n}=this.ctx.config;if(n){if(!this.rowKeyMap.has(e))return!1;let{item:r}=this.rowKeyMap.get(e),i=r[n];this.checkboxKeyMap.has(i)&&(this.checkboxKeyMap.get(i)||[]).forEach(e=>{let n=this.selectionMap.get(e);n&&(n.check=t)})}}toggleRowSelection(e,t){let n=this.rowKeyMap.get(e),r=this.selectionMap.get(e);if(!r)return;t===`selection-tree`||t===`tree-selection`?this.toggleTreeSelection(e):(r.check=!r.check,this.setRowSelectionByCheckboxKey(e,r.check)),this.ctx.emit(`toggleRowSelection`,n);let i=this.getSelectionRows();this.ctx.emit(`selectionChange`,i),this.bufferCheckState.buffer=!1,this.ctx.emit(`draw`)}toggleTreeSelection(e){let t=this.getTreeSelectionState(e),n=this.ctx.config.TREE_SELECT_MODE;if(n===`auto`)t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(n===`cautious`)t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(n===`strictly`){let t=this.selectionMap.get(e);t&&(t.check=!t.check,this.setRowSelectionByCheckboxKey(e,t.check))}this.ctx.emit(`selectionChange`,this.getSelectionRows()),this.ctx.emit(`draw`)}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(e=>{this.setRowSelectionByParent(e,!0),this.selectTreeSelectionRecursive(e)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(e=>{this.setRowSelectionByParent(e,!1),this.clearTreeSelectionRecursive(e)})}updateParentTreeSelection(e){let t=this.getTreeParent(e);if(!t)return;let n=this.getTreeChildren(t).map(e=>this.selectionMap.get(e)),r=n.filter(e=>e?.check).length,i=n.length,a=!1;i>0&&(r===0?a=!1:r===i||this.ctx.config.TREE_SELECT_MODE===`auto`?a=!0:this.ctx.config.TREE_SELECT_MODE===`cautious`&&(a=!1));let o=this.selectionMap.get(t);o&&o.check!==a&&(o.check=a,this.setRowSelectionByCheckboxKey(t,a),this.updateParentTreeSelection(t))}setRowSelection(e,t,n=!0){let r=this.selectionMap.get(e);r&&(r.check=t,this.setRowSelectionByCheckboxKey(e,r.check),this.ctx.emit(`setRowSelection`,t,r.row),(this.ctx.config.TREE_SELECT_MODE===`auto`||this.ctx.config.TREE_SELECT_MODE===`cautious`)&&this.updateParentTreeSelection(e),n&&(this.bufferCheckState.buffer=!1,this.ctx.emit(`draw`)))}setRowSelectionByParent(e,t){let n=this.selectionMap.get(e);n&&(n.check=t,this.setRowSelectionByCheckboxKey(e,n.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){let t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};let t=this.selectionMap.get(e)?.check||!1;if(this.getTreeChildren(e).length===0)return{checked:t,indeterminate:!1};let n=!1,r=t;if(this.ctx.config.TREE_SELECT_MODE===`auto`){let i=e=>{let t=this.getTreeChildren(e),n=[];for(let e of t)n.push(e),n.push(...i(e));return n},a=i(e).map(e=>this.selectionMap.get(e)),o=a.filter(e=>e?.check).length,s=a.length,c=o>0;n=c&&o!==s,r=t||c,t&&s>0&&o===0&&(r=!1,n=!1)}else if(this.ctx.config.TREE_SELECT_MODE===`cautious`){let i=e=>{let t=this.getTreeChildren(e),n=[];for(let e of t)n.push(e),n.push(...i(e));return n},a=i(e).map(e=>this.selectionMap.get(e)),o=a.filter(e=>e?.check).length,s=a.length,c=o>0,l=o===s;n=c&&!l,r=t||l,t&&s>0&&o===0&&(r=!1,n=!1)}else this.ctx.config.TREE_SELECT_MODE===`strictly`&&(n=!1,r=t);return{checked:r,indeterminate:n}}getTreeChildren(e){let t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];let n=[],r=e=>{for(let t of e){let e=this.getRowKeyByItem(t);e&&n.push(e),t.children&&t.children.length>0&&r(t.children)}};return r(t.item.children),n}getTreeParent(e){let t=(e,n)=>{for(let r of e){let e=this.getRowKeyByItem(r);if(r.children)for(let i of r.children){if(this.getRowKeyByItem(i)===n)return e;let a=t(r.children,n);if(a)return a}}return null};return t(this.data,e)}getRowSelectable(e){let{selectable:t,item:n,rowIndex:r}=this.rowKeyMap.get(e);return typeof t==`function`?t({row:n,rowIndex:r}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE===`auto`||this.ctx.config.TREE_SELECT_MODE===`cautious`?this.rowKeyMap.forEach((e,t)=>{let n=e.selectable;if(typeof n==`function`&&(n=n({row:e.item,rowIndex:e.rowIndex})),n){let e=this.selectionMap.get(t);e&&(e.check=!0,this.setRowSelectionByCheckboxKey(t,!0))}}):this.rowKeyMap.forEach((e,t)=>{let n=e.selectable;typeof n==`function`&&(n=n({row:e.item,rowIndex:e.rowIndex})),n&&this.setRowSelection(t,!0,!1)});let e=this.getSelectionRows();this.ctx.emit(`toggleAllSelection`,e),this.ctx.emit(`selectionChange`,e),this.bufferCheckState.buffer=!1,this.ctx.emit(`draw`)}clearSelection(e=!1){let t=this.ctx.config.TREE_SELECT_MODE===`auto`||this.ctx.config.TREE_SELECT_MODE===`cautious`;e?t?this.rowKeyMap.forEach((e,t)=>{let n=this.selectionMap.get(t);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(t,!1))}):this.rowKeyMap.forEach((e,t)=>{this.setRowSelection(t,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((e,t)=>{this.selectionMap.set(t,{check:!1,row:e.item,key:t})}));let n=this.getSelectionRows();this.ctx.emit(`clearSelection`),this.ctx.emit(`selectionChange`,n),this.bufferCheckState.buffer=!1,this.ctx.emit(`draw`)}getCheckedState(){let{buffer:e,...t}=this.bufferCheckState;if(e)return t;let n=this.rowKeyMap.size,r=0,i=0,a=this.selectionMap.size,o=Array.from(this.selectionMap.values()).some(e=>e.check);this.rowKeyMap.forEach((e,t)=>{var n;(n=this.selectionMap.get(t))!=null&&n.check&&(r+=1);let a=e.selectable;typeof a==`function`&&(a=a({row:e.item,rowIndex:e.rowIndex})),a&&(i+=1)});let s=i&&i>r&&r>0||a>n&&r===0&&o,c=i!==0,l=!!i&&i===r;return this.bufferCheckState={buffer:!0,check:l,indeterminate:s,selectable:c},{check:l,indeterminate:s,selectable:c}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(e=>{this.colIndexKeyMap.set(e.colIndex,e.key)})}getColumnByColIndex(e){let t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)?.column}getColumnByKey(e){let t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){if(e&&this.headerMap.has(e))return this.headerMap.get(e)?.colIndex}getColHeaderByIndex(e){let t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,n)=>{let r=this.originalDataMap.get(n),i=n.split(`​_`)[0],a=n.split(`​_`)[1];r!==t&&e.push({rowKey:i,colKey:a,originalValue:r,row:this.ctx.database.getRowDataItemForRowKey(i),value:t})}),e}getChangedRows(){let e=new Set;this.changedDataMap.forEach((t,n)=>{let r=this.originalDataMap.get(n),i=n.split(`​_`)[0];r!==t&&e.add(i)});let t=[];return e.forEach(e=>{t.push(this.ctx.database.getRowDataItemForRowKey(e))}),t}isHasChangedData(e,t){let n=`${e}​_${t}`;return this.changedDataMap.has(n)?this.originalDataMap.get(n)!==this.changedDataMap.get(n):!1}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){let{DISABLED:n}=this.ctx.config;if(n)return!0;let r=this.rowKeyMap.get(e),i=this.headerMap.get(t);if(!r||!i)return!0;let a=r.readonly,o=i.readonly,{BODY_CELL_READONLY_METHOD:s}=this.ctx.config;if(typeof s==`function`&&i){let n=s({row:r.item,rowIndex:r.rowIndex,colIndex:i.colIndex,column:i.column,value:this.getItemValue(e,t)});if(n!==void 0)return n}return o||a}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return this.ctx.database.getReadonly(e,t)?new Promise(e=>{e([])}):new Promise(n=>{let i=this.rowKeyMap.get(e),a=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:o}=this.ctx.config;if(i===void 0||a===void 0)return n([]);let s=a.column,c=s.rules;if(typeof o==`function`){let n=o({row:i.item,rowIndex:i.rowIndex,colIndex:a.colIndex,column:s,value:this.getItemValue(e,t)});n&&(c=n)}if(c){let o={row:i.item,rowIndex:i.rowIndex,colIndex:a.colIndex,column:s,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},l=new r(c).validate(o);this.setValidationError(e,t,l),n(l)}else this.clearValidationError(e,t),n([])})}getHeightByRowIndexRowSpan(e,t){let n=0;for(let r=0;r<t;r++){let t=this.positions[e+r];t&&(n+=t.height)}return n}getSpanInfo(e){let{rowIndex:t,key:n,rowKey:r,row:i,value:a,colIndex:o,relationRowKeys:s,relationColKeys:c,rowspan:l,height:u,width:d,colspan:f,mergeRow:p,mergeCol:m}=e;if(l===1&&f===1)return{xArr:[o,o],yArr:[t,t],rowspan:l,colspan:f,height:u,width:d,offsetTop:0,offsetLeft:0,dataList:[{rowKey:r,key:n,row:i,value:a}]};let h=t,g=t,_=o,v=o,y=[],b=0,x=0,S=0,C=0;if(l!==1&&p){C=d;let e=s.reduce((e,t)=>`${e}${this.getItemValue(r,t)??``}`,``);for(let n=t-1;n>=0;n--){let t=this.rowIndexRowKeyMap.get(n)||``;if(e===s.reduce((e,n)=>`${e}${this.getItemValue(t,n)??``}`,``))h=n;else break}for(let n=t;n<=this.ctx.maxRowIndex;n++){let t=this.rowIndexRowKeyMap.get(n)||``;if(e===s.reduce((e,n)=>`${e}${this.getItemValue(t,n)??``}`,``))g=n;else break}for(let e=h;e<t;e++){let{height:t}=this.positions[e];b+=t}for(let e=h;e<=g;e++){let{height:t}=this.positions[e];S+=t;let r=this.rowIndexRowKeyMap.get(e)||``,{item:i}=this.rowKeyMap.get(r),a=this.getItemValue(r,n);y.push({rowKey:r,key:n,value:a,row:i})}}if(f!==1&&m){S=u;for(let e=o-1;e>=0;e--){let t=this.getColumnByColIndex(e);if(!t)break;if(this.getItemValue(r,n)===this.getItemValue(r,t.key)&&c.includes(t.key))_=e;else break}for(let e=o;e<=this.ctx.maxColIndex;e++){let t=this.getColumnByColIndex(e);if(!t)break;if(this.getItemValue(r,n)===this.getItemValue(r,t.key)&&c.includes(t.key))v=e;else break}for(let e=_;e<o;e++){let t=this.getColumnByColIndex(e);if(!t)break;x+=t.width||100}for(let e=_;e<=v;e++){let t=this.getColumnByColIndex(e);if(!t)break;C+=t.width||100,y.push({rowKey:r,key:t.key,value:this.getItemValue(r,t.key),row:i})}}return{xArr:[_,v],yArr:[h,g],rowspan:l,colspan:f,height:S,width:C,offsetTop:b,offsetLeft:x,dataList:y}}setValidationErrorByRowKey(e,t,n){let r=`${e}​_${t}`,i=this.getRowForRowKey(e),a=i?.rowIndex,o=this.getColumnByKey(t);if(!e||!o||!i)return;let s=this.getItemValue(e,t),c=[{key:t,rowKey:e,rowIndex:a,colIndex:o.colIndex,column:o.column,row:i,value:s,message:n,field:t,fieldValue:s}];this.validationErrorMap.set(r,c)}setValidationError(e,t,n){let r=`${e}​_${t}`;this.validationErrorMap.set(r,n)}clearValidationError(e,t){let n=`${e}​_${t}`;this.validationErrorMap.has(n)&&this.validationErrorMap.delete(n)}getValidationError(e,t){let n=`${e}​_${t}`;return this.validationErrorMap.get(n)||[]}getVirtualBodyCell(e,t,n=!0){let r=this.getColumnByColIndex(t),i=this.getRowForRowIndex(e);return!r||!i?void 0:new w(this.ctx,e,t,0,0,0,0,r,i.item,`body`,n)}getVirtualBodyCellByKey(e,t){let n=this.getRowIndexForRowKey(e),r=this.getColIndexForKey(t);if(!(n===void 0||r===void 0))return this.getVirtualBodyCell(n,r)}hasMergeCell(e,t){let n=!1;for(let r=t[0];r<=t[1];r++)for(let t=e[0];t<=e[1];t++){let e=this.getVirtualBodyCell(r,t);if(e&&(e.rowspan!==1||e.colspan!==1)){n=!0;break}}return n}calculateMaxTreeDepth(e,t=0){let n=t;return e.forEach(e=>{if(Array.isArray(e.children)&&e.children.length>0){let r=this.calculateMaxTreeDepth(e.children,t+1);n=Math.max(n,r)}}),n}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){let n=`${e}​_${t}`;return this.overlayerAutoHeightMap.get(n)||0}setCustomHeader(e,t=!1){if([`fixedData`,`sortData`,`hideData`,`resizableData`].forEach(t=>{let n=e[t];n!==void 0&&(this.customHeader[t]=n)}),!t){let e=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit(`customHeaderChange`,e)}}resetCustomHeader(){this.customHeader={},this.ctx.emit(`resetHeader`),this.ctx.emit(`customHeaderChange`,this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:n={}}=this.customHeader;n[e]=t,this.setCustomHeader({resizableData:n})}setCustomHeaderHideData(e,t){let{hideData:n={}}=this.customHeader;e.forEach(e=>{n[e]=t}),this.setCustomHeader({hideData:n}),this.ctx.emit(`resetHeader`)}setCustomHeaderFixedData(e,t){let{fixedData:n={}}=this.customHeader;e.forEach(e=>{n[e]=t}),this.setCustomHeader({fixedData:n}),this.ctx.emit(`resetHeader`)}clearCustomHeaderInvalidValues(e){let t=(e,n={})=>{e.forEach(e=>{e.children&&e.children.length>0&&t(e.children,n);let r=(t,r)=>{var i;let a=this.customHeader[t]?.[e.key];a!==void 0&&a!==r&&(n[t]||(n[t]={}),n[t][e.key]=a,t===`fixedData`&&!a&&!r&&((i=n[t])==null||delete i[e.key]))};r(`fixedData`,e.fixed),r(`sortData`,e.sort),r(`hideData`,e.hide),r(`resizableData`,e.width)})},n={};return t(e,n),n}setMaxRowHeightItem(e,t,n){this.maxRowHeightCellMap.set(e,{key:t,height:n})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class E{constructor(e){n(this,`ctx`),n(this,`history`,[]),n(this,`historyIndex`,-1),this.ctx=e,this.init()}init(){this.ctx.on(`keydown`,e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code===`KeyZ`||e.metaKey&&!e.shiftKey&&e.code===`KeyZ`){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code===`KeyY`||e.ctrlKey&&e.shiftKey&&e.code===`KeyZ`||e.metaKey&&e.shiftKey&&e.code===`KeyZ`){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){let{HISTORY_NUM:t=0,ENABLE_HISTORY:n}=this.ctx.config;n&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){let{changeList:e,scrollX:t,scrollY:n}=this.history[this.historyIndex],r=e.map(e=>({rowKey:e.rowKey,key:e.key,value:e.oldValue,row:{}}));this.ctx.setScroll(t,n),this.ctx.database.batchSetItemValue(r,!1,!1,`back`),--this.historyIndex}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;let{changeList:e}=this.history[this.historyIndex],t=e.map(e=>({rowKey:e.rowKey,key:e.key,value:e.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,`forward`)}}clear(){this.history=[],this.historyIndex=-1}}class D{constructor(e){n(this,`eventTasks`,new Set),n(this,`ctx`),this.ctx=e,this.init()}init(){this.bind(window,`resize`,this.handleResize.bind(this)),this.bind(window,`mouseup`,this.handleMouseUp.bind(this)),this.bind(window,`mousemove`,this.handleMousemove.bind(this)),this.bind(window,`blur`,this.handleOutsideMousedown.bind(this)),this.bind(window,`mousedown`,this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,`click`,this.handleClick.bind(this)),this.bind(window,`keydown`,this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,`wheel`,this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,`touchstart`,this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,`touchend`,this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,`touchmove`,this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,`contextmenu`,this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,`mousedown`,this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,`dblclick`,this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,`mouseover`,this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,`mouseout`,this.handleMouseout.bind(this)),this.bind(document,`selectionchange`,this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr=``;let e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){let e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:n,options:r})=>{this.unbind(e,t,n,r)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit(`resetHeader`,e),this.ctx.emit(`resize`,e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit(`mousedown`,e)}handleMousemove(e){let t=e,n=this.ctx.containerElement.getBoundingClientRect(),r=t.clientX-n.left,i=t.clientY-n.top;this.ctx.mouseX=r,this.ctx.mouseY=i,this.ctx.emit(`mousemove`,e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit(`mouseup`,e)}handleClick(e){this.ctx.emit(`click`,e)}handleKeydown(e){let{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit(`keydown`,e))}handleWheel(e){this.ctx.emit(`wheel`,e)}handleTouchstart(e){this.ctx.emit(`touchstart`,e)}handleTouchend(e){this.ctx.emit(`touchend`,e)}handleTouchmove(e){this.ctx.emit(`touchmove`,e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit(`contextMenu`,e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit(`mouseover`,e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit(`mouseout`,e)}handleDblclick(e){this.ctx.emit(`dblclick`,e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit(`outsideMousedown`,e)}bind(e,t,n,r){e.addEventListener(t,n,r),this.eventTasks.add({target:e,name:t,fn:n,options:r})}unbind(e,t,n,r){e.removeEventListener(t,n,r);for(let r of this.eventTasks)if(r.target===e&&r.name===t&&r.fn===n){this.eventTasks.delete(r);break}}}class O{constructor(){n(this,`events`,new Map)}has(e){return this.events.has(e)}on(e,t){let n=this.events.get(e)||[];n.push(t),this.events.set(e,n)}once(e,t){let n=(...r)=>{t(...r),this.off(e,n)};return this.on(e,n),this}off(e,t){let n=this.events.get(e);if(n){let r=n.indexOf(t);r>=0&&(n.splice(r,1),n.length===0?this.events.delete(e):this.events.set(e,n))}}emit(e,...t){let n=this.events.get(e);n&&n.forEach(e=>{e(...t)})}destroy(){this.events.clear()}}class k{constructor(e){n(this,`ctx`),n(this,`textCacheMap`,new Map);let t=e.getContext(`2d`);if(!t)throw Error(`canvas context not found`);this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e=`default`){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,n,r){this.ctx.clearRect(e,t,n||this.ctx.canvas.width,r||this.ctx.canvas.height)}drawShadow(e,t,n,r,i){let{fillColor:a,side:o,shadowWidth:s,colorStart:c,colorEnd:l}=i;this.ctx.save(),a&&(this.ctx.fillStyle=a,this.ctx.fillRect(e,t,n,r));let u;switch(o){case`left`:u=this.ctx.createLinearGradient(e-s,t,e,t),u.addColorStop(0,c),u.addColorStop(1,l),this.ctx.fillStyle=u,this.ctx.fillRect(e-s,t,s,r);break;case`right`:u=this.ctx.createLinearGradient(e+n,t,e+n+s,t),u.addColorStop(0,c),u.addColorStop(1,l),this.ctx.fillStyle=u,this.ctx.fillRect(e+n,t,s,r);break;case`top`:u=this.ctx.createLinearGradient(e,t-s,e,t),u.addColorStop(0,c),u.addColorStop(1,l),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-s,n,s);break;case`bottom`:u=this.ctx.createLinearGradient(e,t+r,e,t+r+s),u.addColorStop(0,c),u.addColorStop(1,l),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+r,n,s);break;default:console.error(`Invalid side specified for shadow`);break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!=0)throw Error(`A valid array of points is required to draw a line`);this.ctx.save();let{borderColor:n=`black`,borderWidth:r=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let t=2;t<e.length;t+=2)this.ctx.lineTo(e[t]-.5,e[t+1]-.5);this.ctx.strokeStyle=n,this.ctx.lineWidth=r,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,n,r,i){this.ctx.save(),this.ctx.drawImage(e,t,n,r,i),this.ctx.restore()}drawRect(e,t,n,r,{borderWidth:i=1,borderColor:a,fillColor:o,radius:s=0}={}){if(this.ctx.save(),this.ctx.beginPath(),o!==void 0&&(this.ctx.fillStyle=o),a!==void 0&&(this.ctx.lineWidth=i,this.ctx.strokeStyle=a),s===0)this.ctx.rect(e-.5,t-.5,n,r);else{let[i,a,o,c]=typeof s==`number`?[s,s,s,s]:s;this.ctx.moveTo(e+i,t),this.ctx.arcTo(e+n,t,e+n,t+a,a),this.ctx.arcTo(e+n,t+r,e+n-o,t+r,o),this.ctx.arcTo(e,t+r,e,t+r-c,c),this.ctx.arcTo(e,t,e+i,t,i)}o!==void 0&&this.ctx.fill(),a!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e=``,t,n,r,i,a={}){this.ctx.save();let{font:o=`12px Arial`,align:s=`center`,color:c=`#495060`,padding:l=0,verticalAlign:u=`middle`,maxLineClamp:d=1,autoRowHeight:f=!1,offsetLeft:p=0,offsetRight:m=0}=a;if(this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=s,[``,null,void 0].includes(e))return this.ctx.restore(),!1;let h=parseInt(o.match(/\d+/)?.[0]||`12`)*(a.lineHeight||1.2),g=r-l*2-p-m,_=!1,v=Math.round((i-2*l)/h),y=this.wrapText(e,g,a.cacheTextKey),b=Math.min(y.length,Math.max(v,1));d===`auto`&&f?b=y.length:typeof d==`number`&&d<b&&d!==1?b=d:(d===1&&(y=[e],b=1),d===`auto`&&v===1&&(y=[e],b=1));let x=n+l,S=Math.round(b*h);u===`middle`?x=n+(i-S)/2:u===`bottom`&&(x=n+i-S-l);let C=t+l+p;s===`center`?C=t+r/2:s===`right`&&(C=t+r-l-m);for(let e=0;e<y.length;e++){let t=y[e],n=x+e*h;if(this.ctx.textBaseline=`top`,e===b-1){let t=y.slice(e).join(``),{_text:i,ellipsis:a}=this.handleEllipsis(t,r,l,o);this.ctx.fillText(i,C,n),_=a;break}this.ctx.fillText(t,C,n)}if(a.textCallback&&y.length){let e=y.reduce((e,t)=>Math.max(e,this.ctx.measureText(t).width),0),t=Math.round(e),n=C,r=C+t;s===`center`?(n=C-t/2,r=C+t/2):s===`right`&&(n=C-t,r=C);let i={x:C,y:x,width:t,height:S,left:n,right:r,top:x,bottom:x+S};a.textCallback(i)}return this.ctx.restore(),_}wrapText(e,t,n=``){if(!e)return[``];if(n&&this.textCacheMap.has(n))return this.textCacheMap.get(n)||[``];let r=[],i=e.split(`
4
+ `);for(let e of i){if(e===``){r.push(``);continue}let n=e.split(``),i=``;for(let e of n){let n=i+e;this.ctx.measureText(n).width<=t?i=n:i?(r.push(i),i=e):(r.push(e),i=``)}i&&r.push(i)}let a=r.length>0?r:[``];return n&&this.textCacheMap.set(n,a),a}calculateTextHeight(e=``,t,n={}){let{font:r=`12px Arial`,padding:i=0,align:a=`center`,color:o=`#495060`,maxLineClamp:s=1,cacheTextKey:c=``}=n;this.ctx.save(),this.ctx.font=r,this.ctx.fillStyle=o,this.ctx.textAlign=a;let l=parseInt(r.match(/\d+/)?.[0]||`12`),u=l*(n.lineHeight||1.2),d=t-i*2,f=this.wrapText(e,d,c),p=1;return p=s===`auto`?f.length:f.length>s?s:f.length,this.ctx.restore(),Math.max(Math.floor(p*u+i*2),Math.floor(l+i*2))}handleEllipsis(e,t,n=0,r=`12px Arial`){this.ctx.save();let i=!1,a=e;if(this.ctx.font=r,e==null||e===``)return this.ctx.restore(),{_text:``,ellipsis:i};let o=this.ctx.measureText(`...`).width;if(t<=o+n*2)return this.ctx.restore(),{_text:``,ellipsis:!0};let s=this.ctx.measureText(e).width,c=t-n*2;if(s&&s>=c){i=!0;let t=0;for(let n=0;n<e.length;n++)if(t+=this.ctx.measureText(e[n]).width,t>=c-o){a=e.slice(0,n)+`...`,i=!0;break}}return this.ctx.restore(),{_text:a,ellipsis:i}}}class A{constructor(e){n(this,`_config`,{}),n(this,`CSS_PREFIX`,`e-virt-table`),n(this,`ICONS`,[]),n(this,`ROW_KEY`,``),n(this,`DISABLED`,!1),n(this,`HEADER_FONT`,`12px normal Arial`),n(this,`BODY_FONT`,`12px normal Arial`),n(this,`BORDER`,!0),n(this,`STRIPE`,!1),n(this,`STRIPE_COLOR`,`#fafafa`),n(this,`BORDER_COLOR`,`#e1e6eb`),n(this,`HEIGHT`,0),n(this,`PLACEHOLDER_COLOR`,`#CDD0DC`),n(this,`EMPTY_BODY_HEIGHT`,120),n(this,`EMPTY_CUSTOM_STYLE`,{}),n(this,`NUMBER_ERROR_TIP`,`只允许输入数字`),n(this,`EMPTY_TEXT`,`暂无数据`),n(this,`LOADING_TEXT`,`加载中...`),n(this,`MAX_HEIGHT`,1e3),n(this,`BORDER_RADIUS`,8),n(this,`ENABLE_OFFSET_HEIGHT`,!1),n(this,`OFFSET_HEIGHT`,0),n(this,`HEADER_HEIGHT`,36),n(this,`ENABLE_HEADER_STICKY`,!1),n(this,`HEADER_BG_COLOR`,`#F8FAFF`),n(this,`BODY_BG_COLOR`,`#FFF`),n(this,`HEADER_TEXT_COLOR`,`#1D2129`),n(this,`REQUIRED_COLOR`,`#F56C6C`),n(this,`BODY_TEXT_COLOR`,`#4E5969`),n(this,`FOOTER_TEXT_COLOR`,`#4E5969`),n(this,`LOADING_ICON_SVG`,``),n(this,`LOADING_ICON_COLOR`,`#4E5969`),n(this,`EXPAND_ICON_SVG`,``),n(this,`SHRINK_ICON_SVG`,``),n(this,`EXPAND_ICON_COLOR`,`#4E5969`),n(this,`SHRINK_ICON_COLOR`,`#4E5969`),n(this,`ERROR_TIP_ICON_COLOR`,`red`),n(this,`ERROR_TIP_ICON_SIZE`,6),n(this,`COLUMNS_ALIGN`,`left`),n(this,`COLUMNS_VERTICAL_ALIGN`,`middle`),n(this,`EXPAND_LAZY`,!0),n(this,`DEFAULT_EXPAND_ALL`,!1),n(this,`CELL_WIDTH`,100),n(this,`CELL_HEIGHT`,36),n(this,`CELL_PADDING`,8),n(this,`CELL_HOVER_ICON_SIZE`,14),n(this,`CELL_HOVER_ICON_BG_COLOR`,`#fff`),n(this,`CELL_HOVER_ICON_BORDER_COLOR`,`#DDE0EA`),n(this,`SCROLLER_TRACK_SIZE`,14),n(this,`SCROLLER_SIZE`,8),n(this,`SCROLLER_COLOR`,`#dee0e3`),n(this,`SCROLLER_TRACK_COLOR`,`#fff`),n(this,`SCROLLER_FOCUS_COLOR`,`#bbbec4`),n(this,`SELECT_BORDER_COLOR`,`rgb(82,146,247)`),n(this,`SELECT_AREA_COLOR`,`rgba(82,146,247,0.1)`),n(this,`SELECT_ROW_COL_BG_COLOR`,`transparent`),n(this,`AUTOFILL_POINT_BORDER_COLOR`,`#fff`),n(this,`EDIT_BG_COLOR`,`#fcf6ed`),n(this,`CHECKBOX_KEY`,``),n(this,`CHECKBOX_COLOR`,`rgb(82,146,247)`),n(this,`FINDER_CELL_BG_COLOR`,`rgb(255,229,144)`),n(this,`ENABLE_FINDER`,!0),n(this,`CHECKBOX_SIZE`,20),n(this,`CHECKBOX_DISABLED_SVG`,``),n(this,`CHECKBOX_DISABLED_COLOR`,`#F1F2F4`),n(this,`CHECKBOX_CHECK_SVG`,``),n(this,`CHECKBOX_UNCHECK_SVG`,``),n(this,`CHECKBOX_UNCHECK_COLOR`,`#DDE0EA`),n(this,`CHECKBOX_INDETERMINATE_SVG`,``),n(this,`CHECKBOX_CHECK_DISABLED_SVG`,``),n(this,`CHECKBOX_CHECK_DISABLED_COLOR`,`#DDE0EA`),n(this,`ICON_EDIT_SVG`,``),n(this,`ICON_EDIT_COLOR`,`#4E5969`),n(this,`ICON_SELECT_SVG`,``),n(this,`ICON_SELECT_COLOR`,`#4E5969`),n(this,`SORT_STRICTLY`,!0),n(this,`SORT_ASC_ICON_SVG`,``),n(this,`SORT_DESC_ICON_SVG`,``),n(this,`SORTABLE_ICON_SVG`,``),n(this,`SORT_ICON_COLOR`,`rgb(82,146,247)`),n(this,`READONLY_COLOR`,`#fff`),n(this,`READONLY_TEXT_COLOR`,`#4E5969`),n(this,`ERROR_TIP_COLOR`,`#ED3F14`),n(this,`FOOTER_BG_COLOR`,`#fafafa`),n(this,`FOOTER_FIXED`,!0),n(this,`FOOTER_POSITION`,`bottom`),n(this,`CELL_FOOTER_HEIGHT`,36),n(this,`ENABLE_SELECTOR`,!0),n(this,`TREE_SELECT_MODE`,`auto`),n(this,`TREE_CHILDREN_KEY`,`children`),n(this,`TREE_INDENT`,20),n(this,`TREE_ICON_SIZE`,20),n(this,`TREE_LINE`,!1),n(this,`TREE_LINE_COLOR`,`#e1e6eb`),n(this,`ENABLE_EDIT_SINGLE_CLICK`,!1),n(this,`ENABLE_EDIT_CLICK_SELECTOR`,!0),n(this,`SELECTOR_AREA_MIN_X`,0),n(this,`SELECTOR_AREA_MAX_X_OFFSET`,0),n(this,`SELECTOR_AREA_MAX_X`,0),n(this,`SELECTOR_AREA_MIN_Y`,0),n(this,`SELECTOR_AREA_MAX_Y`,0),n(this,`SELECTOR_AREA_MAX_Y_OFFSET`,0),n(this,`SELECTOR_CELL_VALUE_TYPE`,`value`),n(this,`ENABLE_AUTO_THEME`,!0),n(this,`ENABLE_SELECTOR_SINGLE`,!1),n(this,`ENABLE_SELECTOR_SPAN_COL`,!0),n(this,`ENABLE_SELECTOR_SPAN_ROW`,!0),n(this,`ENABLE_SELECTOR_ALL_ROWS`,!0),n(this,`ENABLE_SELECTOR_ALL_COLS`,!0),n(this,`ENABLE_MERGE_CELL_LINK`,!1),n(this,`ENABLE_AUTOFILL`,!1),n(this,`ENABLE_AUTOFILL_SPAN_COL`,!0),n(this,`ENABLE_AUTOFILL_SPAN_ROW`,!0),n(this,`ENABLE_CONTEXT_MENU`,!1),n(this,`ENABLE_HEADER_CONTEXT_MENU`,!1),n(this,`ENABLE_COPY`,!0),n(this,`ENABLE_PASTER`,!0),n(this,`ENABLE_RESIZE_ROW`,!0),n(this,`ENABLE_RESIZE_COLUMN`,!0),n(this,`RESIZE_ROW_LINE_COLOR`,`#e1e6eb`),n(this,`RESIZE_COLUMN_LINE_COLOR`,`#e1e6eb`),n(this,`ENABLE_RESIZE_COLUMN_TEXT`,!0),n(this,`RESIZE_COLUMN_TEXT_COLOR`,`#fff`),n(this,`RESIZE_COLUMN_TEXT_BG_COLOR`,`rgb(82,146,247)`),n(this,`RESIZE_ROW_MIN_HEIGHT`,36),n(this,`RESIZE_COLUMN_MIN_WIDTH`,40),n(this,`DRAG_TIP_BG_COLOR`,`rgba(82,146,247,0.1)`),n(this,`DRAG_TIP_LINE_COLOR`,`rgb(82,146,247)`),n(this,`ENABLE_KEYBOARD`,!0),n(this,`ENABLE_HISTORY`,!1),n(this,`ENABLE_VALIDATOR_IMMEDIATE`,!0),n(this,`HISTORY_NUM`,50),n(this,`HIGHLIGHT_HOVER_ROW`,!1),n(this,`HIGHLIGHT_HOVER_ROW_COLOR`,`rgba(186,203,231,0.1)`),n(this,`HIGHLIGHT_SELECTED_ROW`,!1),n(this,`HIGHLIGHT_SELECTED_ROW_COLOR`,`rgba(82,146,247,0.1)`),n(this,`TOOLTIP_BG_COLOR`,`#303133`),n(this,`TOOLTIP_TEXT_COLOR`,`#fff`),n(this,`TOOLTIP_ZINDEX`,3e3),n(this,`TOOLTIP_CUSTOM_STYLE`,{}),n(this,`CONTEXT_MENU`,[{label:`复制`,value:`copy`},{label:`剪切`,value:`cut`},{label:`粘贴`,value:`paste`},{label:`清空选中内容`,value:`clearSelected`}]),n(this,`CUSTOM_BODY_CONTEXT_MENU`,[]),n(this,`HEADER_CONTEXT_MENU`,[{label:`左固定`,value:`fixedLeft`},{label:`右固定`,value:`fixedRight`},{label:`取消固定`,value:`fixedNone`},{label:`隐藏`,value:`hide`},{label:`显示`,value:`visible`},{label:`恢复默认`,value:`resetHeader`}]),n(this,`CUSTOM_HEADER_CONTEXT_MENU`,[]),n(this,`CELL_LINE_HEIGHT`,1.3),n(this,`AUTO_ROW_HEIGHT`,!1),n(this,`ENABLE_DRAG_COLUMN`,!1),n(this,`HEADER_CELL_STYLE_METHOD`),n(this,`BODY_CELL_STYLE_METHOD`),n(this,`FOOTER_CELL_STYLE_METHOD`),n(this,`BODY_CELL_READONLY_METHOD`),n(this,`BODY_CELL_FORMATTER_METHOD`),n(this,`BODY_CELL_RULES_METHOD`),n(this,`BODY_CELL_TYPE_METHOD`),n(this,`BODY_CELL_EDITOR_METHOD`),n(this,`BODY_CELL_RENDER_METHOD`),n(this,`BODY_CELL_HOVER_ICON_METHOD`),n(this,`SPAN_METHOD`),n(this,`SELECTABLE_METHOD`),n(this,`EXPAND_LAZY_METHOD`),n(this,`BEFORE_VALUE_CHANGE_METHOD`),n(this,`BEFORE_PASTE_DATA_METHOD`),n(this,`BEFORE_AUTOFILL_DATA_METHOD`),n(this,`BEFORE_SET_SELECTOR_METHOD`),n(this,`BEFORE_SET_AUTOFILL_METHOD`),n(this,`BEFORE_COPY_METHOD`),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith(`_COLOR`)||t.endsWith(`_FONT`)){let n=b(`--evt-${t.toLocaleLowerCase().replace(/_/g,`-`)}`);n&&(e[t]=n)}}),Object.assign(this,e,this._config)}}let j=`<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>`,M=`<svg t="1722595535853" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M640 128H384c-170.496 0-256 85.504-256 256v256c0 170.496 85.504 256 256 256h256c170.496 0 256-85.504 256-256V384c0-170.496-85.504-256-256-256z m67.584 302.592c-2.048 4.608-4.608 8.704-8.192 12.288L506.88 634.88c-3.584 3.584-7.68 6.144-12.288 8.192-4.608 2.048-9.728 3.072-14.848 3.072s-10.24-1.024-14.848-3.072c-4.608-2.048-8.704-4.608-12.288-8.192l-96.256-96.256c-3.584-3.584-6.144-7.68-8.192-12.288-2.048-4.608-3.072-9.728-3.072-14.848 0-2.56 0-5.12 1.024-7.68 0.512-2.56 1.024-5.12 2.048-7.168 1.024-2.56 2.048-4.608 3.584-6.656 1.536-2.048 3.072-4.096 4.608-5.632 1.536-2.048 3.584-3.584 5.632-4.608 2.048-1.536 4.096-2.56 6.656-3.584 2.56-1.024 4.608-1.536 7.168-2.048 2.56-0.512 5.12-0.512 7.68-0.512 5.12 0 10.24 1.024 14.848 3.072 4.608 2.048 8.704 4.608 12.288 8.192l69.12 68.608L645.12 389.12c3.584-3.584 7.68-6.144 12.288-8.192 4.608-2.048 9.728-3.072 14.848-3.072 2.56 0 5.12 0 7.68 0.512s5.12 1.024 7.168 2.048c2.56 1.024 4.608 2.048 6.656 3.584 2.048 1.536 4.096 3.072 5.632 4.608 1.536 1.536 3.584 3.584 4.608 5.632 1.536 2.048 2.56 4.096 3.584 6.656 1.024 2.56 1.536 4.608 2.048 7.168 0.512 2.56 1.024 5.12 1.024 7.68 0 5.12-1.024 10.24-3.072 14.848z" p-id="4552"></path></svg>`,N=`<svg t="1724122044148" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4551" width="32" height="32"><path d="M707.648 401.28L489.28 560.704l22.656 30.976 22.656-30.976L316.16 401.216q-3.072-2.24-6.464-3.84-3.456-1.536-7.104-2.432-3.712-0.896-7.488-1.088-3.776-0.128-7.488 0.448-3.776 0.64-7.296 1.92-3.584 1.28-6.784 3.2-3.2 1.984-6.016 4.544-2.816 2.56-5.056 5.632-2.176 3.072-3.84 6.464-1.536 3.456-2.432 7.104-0.896 3.712-1.088 7.488-0.128 3.776 0.448 7.488 0.64 3.776 1.92 7.296 1.28 3.584 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992l218.368 159.552q4.928 3.584 10.752 5.504 5.76 1.92 11.904 1.92 6.08 0 11.904-1.92 5.76-1.92 10.752-5.504l218.368-159.552q3.008-2.24 5.568-4.992 2.56-2.816 4.544-6.016 1.92-3.2 3.264-6.784 1.28-3.52 1.92-7.296 0.576-3.712 0.384-7.488-0.128-3.84-1.024-7.488-0.896-3.648-2.496-7.04-1.6-3.456-3.84-6.528-2.24-3.072-4.992-5.632-2.816-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.584-1.28-7.296-1.856-3.712-0.64-7.488-0.448-3.84 0.192-7.488 1.088-3.648 0.896-7.04 2.496-3.456 1.536-6.528 3.84z m61.056 30.976q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.472-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.72-3.584-3.456-1.408-7.168-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.656 3.584-3.136 2.112-5.76 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.584 6.656-1.408 3.52-2.176 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.176 7.168 1.472 3.52 3.584 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.168-2.176 3.52-1.408 6.656-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.048-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z m-436.736 0q0-3.84-0.768-7.488-0.704-3.712-2.176-7.232-1.408-3.456-3.52-6.656-2.112-3.136-4.8-5.76-2.688-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704-3.84 0-7.488 0.704-3.712 0.768-7.232 2.176-3.456 1.472-6.592 3.584-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.24 7.232-0.704 3.712-0.704 7.488 0 3.776 0.704 7.488 0.768 3.712 2.24 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.824 2.624 2.688 5.76 4.8 3.2 2.112 6.656 3.52 3.52 1.472 7.232 2.176 3.712 0.768 7.488 0.768 3.776 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.72 1.472-3.456 2.176-7.168 0.768-3.712 0.768-7.488z" p-id="4552"></path></svg>`,ee=`<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>`,P=ee.replace(`fill="currentColor" p-id="2016"`,`fill="#bec4c7" p-id="2016"`),te=ee.replace(`fill="currentColor" p-id="2015"`,`fill="#bec4c7" p-id="2015"`);class F{constructor(e){n(this,`ctx`),n(this,`list`,[{name:`loading`,configName:`LOADING_ICON_SVG`,configColorName:`LOADING_ICON_COLOR`,svg:`<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>`,color:`#4E5969`},{name:`expand`,configName:`EXPAND_ICON_SVG`,configColorName:`EXPAND_ICON_COLOR`,svg:j,color:`#4E5969`},{name:`shrink`,configName:`SHRINK_ICON_SVG`,configColorName:`SHRINK_ICON_COLOR`,svg:N,color:`#4E5969`},{name:`checkbox-uncheck`,configName:`CHECKBOX_UNCHECK_SVG`,configColorName:`CHECKBOX_UNCHECK_COLOR`,svg:`<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>`,color:``},{name:`checkbox-check`,configName:`CHECKBOX_CHECK_SVG`,configColorName:`CHECKBOX_COLOR`,svg:M,color:`rgb(82,146,247)`},{name:`checkbox-indeterminate`,configName:`CHECKBOX_INDETERMINATE_SVG`,configColorName:`CHECKBOX_COLOR`,svg:`<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>`,color:`rgb(82,146,247)`},{name:`checkbox-check-disabled`,configName:`CHECKBOX_CHECK_DISABLED_SVG`,svg:M,color:`#DDE0EA`},{name:`checkbox-disabled`,configName:`CHECKBOX_DISABLED_SVG`,configColorName:`CHECKBOX_DISABLED_COLOR`,svg:`<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>`,color:`#F1F2F4`},{name:`icon-edit`,configName:`ICON_EDIT_SVG`,configColorName:`ICON_EDIT_COLOR`,svg:`<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>`,color:`#4E5969`},{name:`icon-select`,configName:`ICON_SELECT_SVG`,configColorName:`ICON_SELECT_COLOR`,svg:N,color:`#4E5969`},{name:`sort-asc`,configName:`SORT_ASC_ICON_SVG`,configColorName:`SORT_ICON_COLOR`,svg:P,color:`rgb(82,146,247)`},{name:`sort-desc`,configName:`SORT_DESC_ICON_SVG`,configColorName:`SORT_ICON_COLOR`,svg:te,color:`rgb(82,146,247)`},{name:`sort-default`,configName:`SORTABLE_ICON_SVG`,svg:ee,color:`#bec4c7`}]),n(this,`icons`,new Map),this.ctx=e,this.init()}async init(){let e=[];for(let t=0;t<this.list.length;t++){let n=this.list[t],r=n.color,i=n.svg;if(n.configColorName){let e=this.ctx.config[n.configColorName];e&&(r=e)}if(n.configName){let e=this.ctx.config[n.configName];e&&(i=e)}let a=this.createImageFromSVG(i,r).then(e=>{this.icons.set(n.name,e)});e.push(a)}for(let t=0;t<this.ctx.config.ICONS.length;t++){let n=this.ctx.config.ICONS[t],r=n.color,i=this.createImageFromSVG(n.svg,r,n.isBlob).then(e=>{this.icons.set(n.name,e)});e.push(i)}await Promise.all(e),this.ctx.emit(`draw`)}async createImageFromSVG(e,t,n=!1){let r=new DOMParser().parseFromString(e,`image/svg+xml`).documentElement;t&&r.querySelectorAll(`*`).forEach(e=>{let n=e.getAttribute(`fill`);(n===`currentColor`||n===null)&&e.setAttribute(`fill`,t)});let i=new Image,a=``;if(n){let e=new Blob([new XMLSerializer().serializeToString(r)],{type:`image/svg+xml`});a=URL.createObjectURL(e)}else a=`data:image/svg+xml;charset=utf-8,`+encodeURIComponent(new XMLSerializer().serializeToString(r));return i.src=a,new Promise((t,n)=>{i.onerror=()=>n(Error(`Failed to load image:`+e)),i.onload=()=>{t(i)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class ne extends C{constructor(e,t,r,a,o,s,c){super(e,r,a,o,s,`header`,c.fixed),n(this,`align`),n(this,`hideHeaderSelection`,!1),n(this,`verticalAlign`,`middle`),n(this,`fixed`),n(this,`minWidth`),n(this,`maxWidth`),n(this,`widthFillDisable`),n(this,`type`),n(this,`operation`,!1),n(this,`editorType`),n(this,`level`),n(this,`text`),n(this,`hide`,!1),n(this,`displayText`,``),n(this,`colspan`),n(this,`rowspan`),n(this,`row`),n(this,`key`),n(this,`required`,!1),n(this,`readonly`,!1),n(this,`ellipsis`,!1),n(this,`overflowTooltipShow`,!0),n(this,`children`,[]),n(this,`column`),n(this,`colIndex`),n(this,`rowKey`),n(this,`rules`),n(this,`hasChildren`),n(this,`render`),n(this,`style`,{}),n(this,`drawX`,0),n(this,`drawY`,0),n(this,`sortIconName`,`sort-default`),n(this,`sortAscIconName`,`sort-asc`),n(this,`sortDescIconName`,`sort-desc`),n(this,`visibleWidth`,0),n(this,`visibleHeight`,0),n(this,`maxLineClampHeader`,`auto`),n(this,`domDataset`,{}),n(this,`drawTextX`,0),n(this,`drawTextY`,0),n(this,`drawTextWidth`,0),n(this,`drawTextHeight`,0),n(this,`drawCellBgColor`,``),n(this,`drawTextColor`,``),n(this,`drawTextFont`,``),n(this,`drawSelectionImageX`,0),n(this,`drawSelectionImageY`,0),n(this,`drawSelectionImageWidth`,0),n(this,`drawSelectionImageHeight`,0),n(this,`drawSelectionImageName`,``),n(this,`drawSelectionImageSource`),n(this,`drawSortImageX`,0),n(this,`drawSortImageY`,0),n(this,`drawSortImageWidth`,0),n(this,`drawSortImageHeight`,0),n(this,`drawSortImageName`,``),n(this,`drawSortImageSource`),this.ctx=e,this.x=r,this.y=a,this.width=o,this.height=s,this.visibleWidth=o,this.visibleHeight=s,this.colIndex=t,this.key=c.key,this.minWidth=c.minWidth,this.maxWidth=c.maxWidth,this.hide=(typeof c.hide==`function`?c.hide(c):c.hide)||!1,this.type=c.type||``,this.editorType=c.editorType||`text`,this.hideHeaderSelection=c.hideHeaderSelection||!1,this.align=c.headerAlign||c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.headerVerticalAlign||c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||``,this.level=c.level||0,this.operation=c.operation||!1,this.text=c.title,this.column=c,this.colspan=c.colspan||1,this.widthFillDisable=c.widthFillDisable||!1,this.rowspan=c.rowspan||1,this.rules=c.rules,this.readonly=c.readonly||!1,this.required=c.required||!1,this.sortIconName=c.sortIconName||`sort-default`,this.sortAscIconName=c.sortAscIconName||`sort-asc`,this.sortDescIconName=c.sortDescIconName||`sort-desc`,this.rowKey=i(),this.overflowTooltipShow=c.overflowTooltipHeaderShow!==!1,this.hasChildren=c.children&&c.children.length>0||!1,this.render=c.renderHeader,this.maxLineClampHeader=c.maxLineClampHeader||`auto`}isVerticalVisible(){let{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){let{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:n}=this.ctx.config,r=t,i=n;if(typeof e==`function`){let{backgroundColor:t,color:n,font:a}=e({colIndex:this.colIndex,column:this.column})||{};t&&(r=t),n&&(i=n),a&&(this.drawTextFont=a)}let{colKey:a,type:o}=this.ctx.finderBar;o===`header`&&a===this.key&&(r=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=r,this.drawTextColor=i}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){let{paint:e,config:{BORDER_COLOR:t,BORDER:n}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:n?t:`transparent`,fillColor:this.drawCellBgColor})}drawText(){let{paint:e,config:{HEADER_FONT:t,CELL_PADDING:n,REQUIRED_COLOR:r}}=this.ctx,i=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:n,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:i,textCallback:t=>{this.column.sortBy&&(this.drawSortImageX=t.right+4,this.drawSortImageY=t.top+(t.height-16)/2),this.required&&e.drawText(`*`,t.left-18,t.top+(t.height-12)/2,24,24,{color:r,font:`18px Arial`,align:`center`,verticalAlign:`middle`,padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;let{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config,n=-1,r=-1;if(this.ctx.focusCellHeader&&(n=this.ctx.focusCellHeader.colIndex,r=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){let{xArr:e}=this.ctx.selector;n=e[0],r=e[1]}let i=this.colspan+this.colIndex-1;this.colIndex>=n&&this.colIndex<=r&&i<=r&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:`transparent`,fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||`transparent`})}drawSelection(){if(!this.hideHeaderSelection&&[`index-selection`,`selection`,`selection-tree`,`tree-selection`].includes(this.type)){let{indeterminate:e,check:t,selectable:n}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:r=0,CELL_PADDING:i}=this.ctx.config,a=this.drawX+(this.width-r)/2,o=this.drawY+(this.height-r)/2;this.drawTextX=a+r-i/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align===`left`||this.align===`right`)&&(a=this.drawX+i,this.drawTextX=a+r-i/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign===`top`?o=this.drawY+i/2:this.verticalAlign===`bottom`&&(o=this.drawY+this.height-r-i/2);let s=this.ctx.icons.get(`checkbox-uncheck`),c=`checkbox-uncheck`;e?(s=this.ctx.icons.get(`checkbox-indeterminate`),c=`checkbox-indeterminate`):t&&n?(s=this.ctx.icons.get(`checkbox-check`),c=`checkbox-check`):t&&!n?(s=this.ctx.icons.get(`checkbox-check-disabled`),c=`checkbox-check-disabled`):!t&&n?(s=this.ctx.icons.get(`checkbox-uncheck`),c=`checkbox-uncheck`):(s=this.ctx.icons.get(`checkbox-disabled`),c=`checkbox-disabled`),s&&(this.drawSelectionImageX=a,this.drawSelectionImageY=o,this.drawSelectionImageWidth=r,this.drawSelectionImageHeight=r,this.drawSelectionImageName=c,this.drawSelectionImageSource=s,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;let e=this.sortIconName,t=this.ctx.database.getSortState(this.key);t.direction===`asc`?e=this.sortAscIconName:t.direction===`desc`&&(e=this.sortDescIconName);let n=this.ctx.icons.get(e);n&&(this.drawSortImageWidth=16,this.drawSortImageHeight=16,this.drawSortImageName=e,this.drawSortImageSource=n,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||[``,null,void 0].includes(this.text)?``:`${this.text}`}getOverlayerViewsStyle(){let e=``;return e=this.fixed===`left`?`${this.drawX}px`:this.fixed===`right`?`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:`absolute`,overflow:`hidden`,left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:`initial`,userSelect:`none`}}}class re{constructor(e){n(this,`ctx`),n(this,`visibleHoverCell`),n(this,`resizeObserver`),n(this,`mutationObserver`),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit(`resetHeader`),this.ctx.emit(`resizeObserver`,e),this.ctx.emit(`containerResize`,this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(let t of e)t.type===`attributes`&&t.attributeName===`class`&&(this.ctx.config.updateCssVar(),this.ctx.emit(`draw`))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:[`class`]}),this.ctx.on(`mousedown`,e=>{if(this.isBusy(e))return;let{offsetY:t,offsetX:n}=this.ctx.getOffset(e),r=t,i=n,{body:{height:a,visibleHeight:o,visibleWidth:s,y:c}}=this.ctx;i>0&&i<s&&r>c&&r<c+Math.min(a,o)||this.ctx.emit(`mousedownBodyOutside`,e),e.button===0&&(this.handleHeaderEvent(i,r,this.ctx.header.renderCellHeaders,t=>{this.ctx.focusCellHeader=t,this.ctx.focusCell=void 0,this.ctx.emit(`cellHeaderMousedown`,t,e)}),this.handleBodyEvent(i,r,this.ctx.body.renderRows,t=>{this.ctx.setFocusCell(t),this.ctx.focusCellHeader=void 0,this.ctx.emit(`cellMousedown`,t,e)}))}),this.ctx.on(`mouseup`,e=>{if(e.button!==0||this.isBusy(e))return;let{offsetY:t,offsetX:n}=this.ctx.getOffset(e),r=t,i=n;this.handleHeaderEvent(i,r,this.ctx.header.renderCellHeaders,t=>{this.ctx.focusCellHeader=t,this.ctx.emit(`cellHeaderMouseup`,t,e)}),this.handleBodyEvent(i,r,this.ctx.body.renderRows,t=>{this.ctx.setFocusCell(t),this.ctx.emit(`cellMouseup`,t,e)})}),this.ctx.on(`click`,e=>{if(e.button!==0||this.isBusy(e))return;let t=this.ctx.getOffset(e).offsetY,n=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(n,t,this.ctx.header.renderCellHeaders,t=>{this.ctx.clickCellHeader=t,this.ctx.emit(`cellHeaderClick`,t,e),this.selectionClick(t,e),this.sortClick(t,e)}),this.handleBodyEvent(n,t,this.ctx.body.renderRows,t=>{this.ctx.clickCell=t,this.ctx.emit(`cellClick`,t,e),this.selectionClick(t,e),this.treeClick(t,e)},!0),this.handleBodyEvent(n,t,this.ctx.body.renderRows,e=>{this.hoverIconClick(e)},!1)}),this.ctx.on(`dblclick`,e=>{if(e.button!==0||this.isBusy(e))return;let t=this.ctx.getOffset(e).offsetY,n=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(n,t,this.ctx.header.renderCellHeaders,t=>{this.ctx.emit(`cellHeaderDblclick`,t,e)}),this.handleBodyEvent(n,t,this.ctx.body.renderRows,t=>{this.ctx.clickCell=t,this.ctx.emit(`cellDblclick`,t,e)})}),this.ctx.on(`contextMenu`,e=>{if(this.isBusy(e))return;let{offsetY:t,offsetX:n}=this.ctx.getOffset(e),r=t,i=n;this.handleHeaderEvent(i,r,this.ctx.header.renderCellHeaders,t=>{this.ctx.emit(`cellHeaderContextMenuClick`,t,e)}),this.handleBodyEvent(i,r,this.ctx.body.renderRows,t=>{this.ctx.emit(`cellContextMenuClick`,t,e)})}),this.ctx.on(`mouseout`,e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit(`draw`))}),this.ctx.on(`mousemove`,e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor===`pointer`&&(this.ctx.stageElement.style.cursor=`default`);let t=this.ctx.getOffset(e).offsetY,n=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(n,t,this.ctx.header.renderCellHeaders,t=>{this.ctx.emit(`cellHeaderMouseenter`,t,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==t&&this.ctx.emit(`cellHeaderMouseleave`,this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(t,e),this.ctx.hoverCellHeader!==t&&(this.ctx.hoverCellHeader=t,this.visibleHoverCell=void 0,this.ctx.emit(`cellHeaderHoverChange`,t,e))}),this.handleBodyEvent(n,t,this.ctx.body.renderRows,t=>{this.imageEnterAndLeave(t,e),this.visibleHoverCell!==t&&(this.ctx.emit(`visibleCellMouseleave`,t,e),this.visibleHoverCell=t,this.ctx.hoverCellHeader=void 0,this.ctx.emit(`visibleCellHoverChange`,t,e))},!0),this.handleBodyEvent(n,t,this.ctx.body.renderRows,t=>{this.imageEnterAndLeave(t,e),this.ctx.emit(`cellMouseenter`,t,e),this.ctx.hoverCell&&this.ctx.hoverCell!==t&&this.ctx.emit(`cellMouseleave`,t,e),this.ctx.hoverCell!==t&&(this.ctx.hoverCell?.rowKey!==t.rowKey&&(this.ctx.hoverCell=t,this.ctx.hoverRow=this.ctx.body.renderRows.find(e=>e.rowKey===t.rowKey),this.ctx.emit(`rowHoverChange`,this.ctx.hoverRow,t,e),this.ctx.emit(`draw`)),this.ctx.hoverCell=t,this.ctx.emit(`cellHoverChange`,t,e))}),this.handleFooterEvent(n,t,this.ctx.footer.renderRows,t=>{this.ctx.emit(`cellFooterMouseenter`,t,e),this.ctx.hoverCell&&this.ctx.hoverCell!==t&&this.ctx.emit(`cellFooterMouseleave`,t,e),this.ctx.emit(`cellFooterHoverChange`,t,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&!this.ctx.disableHoverIconClick&&this.ctx.emit(`hoverIconClick`,e)}selectionClick(e,t){if(!([`selection`,`index-selection`,`selection-tree`,`tree-selection`].includes(e.type)&&this.ctx.isPointer))return;let{offsetY:n,offsetX:r}=this.ctx.getOffset(t),i=n,a=r;if(this.isInsideElement(a,i,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof ne)e.drawSelectionImageName===`checkbox-uncheck`||e.drawSelectionImageName===`checkbox-indeterminate`?this.ctx.database.toggleAllSelection():e.drawSelectionImageName===`checkbox-check`&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!([`tree`,`selection-tree`,`tree-selection`].includes(e.type)&&this.ctx.isPointer))return;let{offsetY:n,offsetX:r}=this.ctx.getOffset(t),i=n,a=r;if(!this.isInsideElement(a,i,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;let{expand:o=!1,expandLazy:s=!1}=this.ctx.database.getRowForRowKey(e.rowKey)||{},{EXPAND_LAZY:c,EXPAND_LAZY_METHOD:l}=this.ctx.config;if(c&&l&&!o&&!s)typeof l==`function`&&(this.ctx.database.expandLoading(e.rowKey,!0),l({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(t=>{this.ctx.database.setExpandChildren(e.rowKey,t),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit(`expandChange`,this.ctx.database.getExpandRowKeys())}).catch(t=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(t)}));else{let t=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!t),this.ctx.emit(`expandChange`,this.ctx.database.getExpandRowKeys())}}sortClick(e,t){let{offsetY:n,offsetX:r}=this.ctx.getOffset(t),i=n,a=r;if(!this.isInsideElement(a,i,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;let o=this.ctx.database.getSortState(e.key),s;s=o.direction===`none`?`asc`:o.direction===`asc`?`desc`:`none`,this.ctx.database.setSortState(e.key,s)}imageEnterAndLeave(e,t){let{offsetY:n,offsetX:r}=this.ctx.getOffset(t),i=n,a=r;if(e instanceof ne){if(e.drawSelectionImageSource&&this.isInsideElement(a,i,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor=`pointer`,this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(a,i,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor=`pointer`,this.ctx.isPointer=!0;return}}if(e instanceof w){if(e.drawSelectionImageSource&&this.isInsideElement(a,i,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor=`pointer`,this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor=`not-allowed`);return}if(e.drawHoverImageSource&&this.isInsideElement(a,i,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor=`pointer`,this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(a,i,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor=`pointer`,this.ctx.isPointer=!0;return}}}isInsideElement(e,t,n,r,i,a){return e>n&&e<n+i&&t>r&&t<r+a}isBusy(e){let{offsetY:t,offsetX:n}=this.ctx.getOffset(e),r=t,i=n;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor===`row-resize`||this.ctx.stageElement.style.cursor===`col-resize`||this.ctx.columnResizing||this.ctx.rowResizing)return!0;let{SCROLLER_TRACK_SIZE:a}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||r>this.ctx.stageHeight-a||i>this.ctx.stageWidth-a)}handleBodyEvent(e,t,n,r,i=!1){if(this.isInsideBody(t))for(let a of n){let n=a.fixedCells.concat(a.noFixedCells);for(let a of n){let n=a.getDrawX(),o=a.getDrawY();if(i){if(e>n&&e<n+a.visibleWidth&&t>o&&t<o+a.visibleHeight){r(a);return}}else if(e>n&&e<n+a.width&&t>o&&t<o+a.height){r(a);return}}}}handleHeaderEvent(e,t,n,r){for(let i of n){let n=i.getDrawX(),a=i.getDrawY();if(e>n&&e<n+i.width&&t>a&&t<a+i.height){r(i);return}}}handleFooterEvent(e,t,n,r,i=!1){for(let a of n){let n=a.fixedCells.concat(a.noFixedCells);for(let a of n){let n=a.getDrawX(),o=a.getDrawY();if(i){if(e>n&&e<n+a.visibleWidth&&t>o&&t<o+a.visibleHeight){r(a);return}}else if(e>n&&e<n+a.width&&t>o&&t<o+a.height){r(a);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class ie{constructor(e,t){n(this,`eventBus`),n(this,`eventBrowser`),n(this,`eventTable`),n(this,`containerElement`),n(this,`stageElement`),n(this,`canvasElement`),n(this,`overlayerElement`),n(this,`editorElement`),n(this,`emptyElement`),n(this,`contextMenuElement`),n(this,`loadingElement`),n(this,`stageWidth`,0),n(this,`stageHeight`,0),n(this,`paint`),n(this,`icons`),n(this,`domSelectionStr`,``),n(this,`isMouseoverTargetContainer`,!1),n(this,`mousedown`,!1),n(this,`isPointer`,!1),n(this,`isEmpty`,!1),n(this,`rowResizing`,!1),n(this,`columnResizing`,!1),n(this,`scrollerMove`,!1),n(this,`scrollerFocus`,!1),n(this,`autofillMove`,!1),n(this,`selectorMove`,!1),n(this,`disableHoverIconClick`,!1),n(this,`selectColsIng`,!1),n(this,`selectRowsIng`,!1),n(this,`dragHeaderIng`,!1),n(this,`finding`,!1),n(this,`contextMenuIng`,!1),n(this,`editing`,!1),n(this,`loading`,!1),n(this,`onlyMergeCell`,!1),n(this,`selectOnlyOne`,!1),n(this,`hasSelection`,!1),n(this,`hasTree`,!1),n(this,`scrollY`,0),n(this,`scrollX`,0),n(this,`fixedLeftWidth`,0),n(this,`fixedRightWidth`,0),n(this,`lastCenterColIndex`,0),n(this,`maxColIndex`,0),n(this,`maxRowIndex`,0),n(this,`hoverRow`),n(this,`clickCell`),n(this,`focusCell`),n(this,`currentCell`),n(this,`hoverCell`),n(this,`clickCellHeader`),n(this,`focusCellHeader`),n(this,`hoverCellHeader`),n(this,`mouseX`,0),n(this,`mouseY`,0),n(this,`body`,{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),n(this,`footer`,{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),n(this,`header`,{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),n(this,`selector`,{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),n(this,`autofill`,{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),n(this,`finderBar`,{text:``,rowIndex:-1,colIndex:-1,type:`body`}),n(this,`database`),n(this,`history`),n(this,`config`);let{containerElement:r,stageElement:i,canvasElement:a,overlayerElement:o,editorElement:s,emptyElement:c,loadingElement:l,contextMenuElement:u}=e;this.containerElement=r,i.tabIndex=0,this.stageElement=i,this.canvasElement=a,this.overlayerElement=o,this.editorElement=s,this.emptyElement=c,this.loadingElement=l,this.contextMenuElement=u,this.config=new A(t.config||{}),this.eventBus=new O,this.eventBrowser=new D(this),this.eventTable=new re(this),this.paint=new k(this.canvasElement),this.database=new T(this,t),this.history=new E(this),this.icons=new F(this)}setConfig(e){this.config=new A(e)}setItemValueByEditor(e,t,n,r=!0,i=!0,a=!0){if(this.config.ENABLE_MERGE_CELL_LINK){let i=this.database.getVirtualBodyCellByKey(e,t);if(i&&(i.mergeRow||i.mergeCol)){let{dataList:e}=i.getSpanInfo(),t=e.map(e=>({...e,value:n}));this.database.batchSetItemValue(t,r,a);return}}this.database.setItemValue(e,t,n,r,i,!0,a)}batchSetItemValueByEditor(e,t=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){let r=[];e.forEach(e=>{let t=this.database.getRowIndexForRowKey(e.rowKey),n=this.database.getColIndexForKey(e.key);if(t===void 0||n===void 0)return;let i=this.database.getVirtualBodyCell(t,n);if(i){let{dataList:t}=i.getSpanInfo(),n=t.map(t=>({...t,value:e.value}));r.push(...n)}}),this.database.batchSetItemValue(r,t,n)}else this.database.batchSetItemValue(e,t,n)}setFocusCell(e){if(this.focusCell!==e){if(this.focusCell?.rowKey!==e.rowKey){this.currentCell=e,this.emit(`rowFocusChange`,e);let t={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit(`currentRowChange`,t)}this.focusCell=e,this.emit(`cellFocusChange`,e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit(`clearSelector`)}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){let e=[],t=this.selector.yArr,n=this.selector.xArr,r=``;for(let i=0;i<=t[1]-t[0];i++){let a=[];for(let e=0;e<=n[1]-n[0];e++){let r=i+t[0],o=e+n[0],s=this.database.getVirtualBodyCell(r,o);s&&(s.selectorCellValueType===`displayText`?a.push(s.displayText):a.push(s.getValue()))}r+=`${a.join(` `)}\r`,e.push(a)}return r=r?r.replace(/\r$/,``):` `,{xArr:n,yArr:t,text:r,value:e}}setScroll(e,t){let n=Math.floor(e),r=this.body.width-this.body.visibleWidth;n<0?n=0:n>r&&(n=r);let i=Math.floor(t),a=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(a=this.body.height+this.footer.height-this.body.visibleHeight),i<0?i=0:i>a&&(i=a),this.emit(`setScroll`,n,i)}setScrollX(e){let t=Math.floor(e),n=this.body.width-this.body.visibleWidth;t<0?t=0:t>n&&(t=n),this.emit(`setScrollX`,t)}setScrollY(e){let t=Math.floor(e),n=0;this.config.FOOTER_FIXED||(n=this.footer.height);let r=this.body.height-this.body.visibleHeight+n;t<0?t=0:t>r&&(t=r),this.emit(`setScrollY`,t)}startAdjustPosition(e){this.emit(`startAdjustPosition`,e)}stopAdjustPosition(){this.emit(`stopAdjustPosition`)}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){let{left:t,top:n}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-n}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class ae{constructor(e,t){n(this,`ctx`),n(this,`type`),n(this,`isFocus`,!1),n(this,`trackX`,0),n(this,`trackY`,0),n(this,`trackWidth`,0),n(this,`trackHeight`,0),n(this,`splitPoints`,[]),n(this,`barX`,0),n(this,`barY`,0),n(this,`barWidth`,0),n(this,`barHeight`,0),n(this,`distance`,0),n(this,`visibleDistance`,0),n(this,`clientX`,0),n(this,`clientY`,0),n(this,`dragStart`,0),n(this,`isDragging`,!1),n(this,`scroll`,0),this.ctx=e,this.type=t,this.type===`vertical`?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){let{clientY:t,clientX:n}=e.touches[0],r=t-this.clientY,i=n-this.clientX,a=0;this.type===`vertical`?(a=Math.max(0,Math.min(this.dragStart-r,this.distance)),this.hasScrollbar()&&!(a===0&&r>0||a===this.distance&&r<0)&&e.preventDefault()):this.type===`horizontal`&&(a=Math.max(0,Math.min(this.dragStart-i,this.distance))),this.scroll=a}onTouchstart(e){let{clientY:t,clientX:n}=e.touches[0];this.clientX=n,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor===`row-resize`||this.ctx.stageElement.style.cursor===`col-resize`)return!0;let{offsetX:t,offsetY:n,clientX:r,clientY:i}=e;if(!(r==this.clientX&&i==this.clientY)){if(this.isOnScrollbar(t,n))this.clientX=r,this.clientY=i,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,n)){let e=0;e=this.type===`vertical`?(n-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(e,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){let{offsetX:t,offsetY:n,clientX:r,clientY:i,buttons:a}=e;if(this.isOnScrollbar(t,n)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,a===0||r==this.clientX&&i==this.clientY)return;let o=0;if(o=this.type===`horizontal`?r-this.clientX:i-this.clientY,this.isDragging&&o!==0){let e=0;e=this.type===`vertical`?this.dragStart+o/(this.visibleDistance-this.barHeight)*this.distance:this.dragStart+o/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(e,this.distance))}}isPointInElement(e,t,n,r,i,a){return e>=n&&e<=n+i&&t>=r&&t<=r+a}hasScrollbar(){return this.type===`vertical`?this.barHeight>0:this.type===`horizontal`?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){let t=e.deltaX,n=e.deltaY;this.type===`vertical`&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&n<0||this.scroll===this.distance&&n>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+n,this.distance))):this.type===`horizontal`&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+n,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){let{body:e,header:t,stageHeight:n,stageWidth:r,config:{SCROLLER_TRACK_SIZE:i=0,SCROLLER_SIZE:a=0,BORDER:o}}=this.ctx,s=r,c=n,l=t.height,u=t.width,d=e.height,f=this.ctx.footer.height;if(this.type===`vertical`){this.visibleDistance=c-i-l,this.distance=d-this.visibleDistance+f,this.trackX=s-i,this.trackY=0,this.splitPoints=[this.trackX,l,this.trackX+i,l],this.trackWidth=i,this.trackHeight=c,this.barX=this.trackX-1+(i-a)/2,this.barWidth=a;let e=this.distance?this.visibleDistance/(d+f):0,t=Math.floor(e*this.visibleDistance);t<30?t=30:t>this.visibleDistance&&(t=0),this.barHeight=t,this.barY=l+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=s-i,this.distance=u-this.visibleDistance,this.splitPoints=[s-i,c-i,s-i,c];let e=o?0:.5;this.trackX=0,this.trackY=c-i+e,this.trackWidth=s,this.trackHeight=i;let t=this.distance?this.visibleDistance/u:0,n=Math.floor(t*this.visibleDistance);this.barY=this.trackY-1+(i-a)/2,n<30?n=30:n>=this.visibleDistance&&(n=0),this.barWidth=n,this.barHeight=a,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){let{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:n,BORDER:r,SCROLLER_TRACK_COLOR:i}}=this.ctx;this.updatedSize();let a=n;r||(a=`transparent`),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:a,fillColor:i}),this.ctx.paint.drawRect(this.barX,this.barY,this.barWidth,this.barHeight,{fillColor:this.isFocus||this.isDragging?e:t,radius:4}),this.splitPoints.length>0&&this.ctx.paint.drawLine(this.splitPoints,{borderColor:a,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class oe{constructor(e){n(this,`ctx`),n(this,`verticalScrollbar`),n(this,`horizontalScrollbar`),n(this,`mousedownHeader`,!1),n(this,`adjustPositionX`,``),n(this,`adjustPositionY`,``),n(this,`timerX`,0),n(this,`timerY`,0),this.ctx=e,this.verticalScrollbar=new ae(e,`vertical`),this.horizontalScrollbar=new ae(e,`horizontal`),this.ctx.on(`wheel`,e=>this.onWheel(e)),this.ctx.on(`mousedown`,e=>this.onMouseDown(e)),this.ctx.on(`mousemove`,e=>this.onMouseMove(e)),this.ctx.on(`mouseup`,()=>this.onMouseUp()),this.ctx.on(`touchmove`,e=>this.onTouchmove(e)),this.ctx.on(`touchstart`,e=>{this.onTouchstart(e)}),this.ctx.on(`setScroll`,(e,t)=>{this.setScroll(e,t)}),this.ctx.on(`setScrollX`,e=>{this.setScrollX(e)}),this.ctx.on(`setScrollY`,e=>{this.setScrollY(e)}),this.ctx.on(`scrollToIndex`,(e,t)=>{this.scrollToIndex(e,t)}),this.ctx.on(`cellHeaderMousedown`,()=>{this.mousedownHeader=!0}),this.ctx.on(`startAdjustPosition`,e=>{this.startAdjustPosition(e)}),this.ctx.on(`stopAdjustPosition`,()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();let e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit(`onScroll`,e,t),e!==this.ctx.scrollX&&this.ctx.emit(`onScrollX`,e),t!==this.ctx.scrollY&&this.ctx.emit(`onScrollY`,t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit(`draw`))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit(`draw`),this.ctx.emit(`onScroll`,e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit(`draw`)}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit(`draw`)}scrollToColkey(e){let{header:t}=this.ctx,n=t.leafCellHeaders.find(t=>t.key===e);n&&this.setScrollX(n.x-t.visibleWidth/2)}scrollToColIndex(e){let{header:t}=this.ctx,n=t.leafCellHeaders.find(t=>t.colIndex===e);n&&this.setScrollX(n.x-t.visibleWidth/2)}scrollToRowIndex(e){let{body:t,database:n}=this.ctx,{top:r}=n.getPositionForRowIndex(e);this.setScrollY(r-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){let{body:t,database:n}=this.ctx,r=n.getRowIndexForRowKey(e);if(r===void 0)return;let{top:i}=n.getPositionForRowIndex(r);this.setScrollY(i-t.visibleHeight/2)}startAdjustPosition(e){let{offsetX:t,offsetY:n}=this.ctx.getOffset(e),r=``,i=``;if(this.ctx.focusCell?.fixed!==`left`&&t<this.ctx.fixedLeftWidth?r=`left`:this.ctx.focusCell?.fixed!==`right`&&t>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?r=`right`:(r=``,this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&n<this.ctx.header.visibleHeight?i=`top`:n>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?i=`bottom`:(i=``,this.stopAdjustPosition(!1,!0)),r&&this.adjustPositionX!==r){this.adjustPositionX=r;let e=10*(r===`left`?-1:1);this.timerX&&=(clearInterval(this.timerX),0),this.timerX=setInterval(()=>{e*=1.5;let{scrollX:t}=this.ctx,n=t+e;(n<0||n>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(n)},100)}if(i&&this.adjustPositionY!==i){this.adjustPositionY=i;let e=10*(i===`top`?-1:1);this.timerY&&=(clearInterval(this.timerY),0),this.timerY=setInterval(()=>{e*=1.5;let{scrollY:t}=this.ctx,n=t+e;(n<0||n>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(n)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX=``,this.timerX&&=(clearInterval(this.timerX),0)),t&&(this.adjustPositionY=``,this.timerY&&=(clearInterval(this.timerY),0))}}class se{constructor(e,t){n(this,`root`),n(this,`key`),n(this,`childrenKey`),this.root=e,this.key=t?.key||`key`,this.childrenKey=t?.childrenKey||`children`}getTree(){return this.root}treeMove(e,t,n){let r=this.findNodeWithParent(this.root,e[this.key]);if(!r)throw Error(`Source node not found`);let{parent:i,index:a,node:o}=r;if(i){let e=i[this.childrenKey];e.splice(a,1),e.length===0&&delete i[this.childrenKey]}else this.root.splice(a,1);let s=this.findNodeWithParent(this.root,t[this.key]);if(!s)throw Error(`Target node not found`);let{parent:c,index:l}=s;n===`before`?c?c[this.childrenKey].splice(l,0,o):this.root.splice(l,0,o):n===`after`&&(c?c[this.childrenKey].splice(l+1,0,o):this.root.splice(l+1,0,o))}findNodeWithParent(e,t,n=null){for(let r=0;r<e.length;r++){let i=e[r];if(i[this.key]===t)return{parent:n,index:r,node:i};if(i[this.childrenKey]){let e=this.findNodeWithParent(i[this.childrenKey],t,i);if(e)return e}}return null}}class I{constructor(e){n(this,`ctx`),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`,0),n(this,`resizeTarget`,null),n(this,`dragTarget`,null),n(this,`dragingCell`),n(this,`dragCellDiff`,0),n(this,`resizeNum`,0),n(this,`isResizing`,!1),n(this,`clientX`,0),n(this,`resizeDiff`,0),n(this,`columnIndex`,0),n(this,`isMouseDown`,!1),n(this,`columns`),n(this,`visibleColumns`),n(this,`visibleLeafColumns`,[]),n(this,`visibleHeight`,0),n(this,`visibleWidth`,0),n(this,`allCellHeaders`,[]),n(this,`leafCellHeaders`,[]),n(this,`renderLeafCellHeaders`,[]),n(this,`fixedLeftCellHeaders`,[]),n(this,`centerCellHeaders`,[]),n(this,`fixedRightCellHeaders`,[]),n(this,`renderCenterCellHeaders`,[]),n(this,`renderFixedCellHeaders`,[]),this.ctx=e,this.ctx.on(`resetHeader`,a(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit(`draw`)},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){let{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:n}}=this.ctx;e||(this.columns=this.ctx.database.getColumns()),this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=u(this.columns);let r=o(this.visibleColumns),i=l(this.visibleColumns);this.height=t*r,this.visibleHeight=this.height,this.width=i.reduce((e,t)=>{let n=t.width||100,{maxWidth:r,minWidth:i}=t;return r&&n>r?e+r:i&&n<i?e+i:e+n},0),this.columnIndex=0,this.resizeNum=0;let a=s(c(this.visibleColumns,r));this.render(a,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);let d=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(d.width):this.ctx.stageWidth=Math.min(Math.floor(this.width+n),Math.floor(d.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+`px`,this.visibleWidth=this.ctx.stageWidth-n;let f=this.visibleWidth-this.width;if(this.resizeNum&&f>0){let e=Math.floor(f/this.resizeNum*100)/100;this.resizeAllColumn(e)}let p=this.fixedLeftCellHeaders.filter(e=>!e.hasChildren);this.ctx.fixedLeftWidth=p.reduce((e,t)=>e+t.width,0);let m=this.fixedRightCellHeaders.filter(e=>!e.hasChildren);this.ctx.fixedRightWidth=m.reduce((e,t)=>e+t.width,n),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on(`mousedown`,e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on(`mouseup`,()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on(`mousemove`,e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;let{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:n}}=this.ctx;if(this.isResizing&&this.resizeTarget){let t=this.resizeTarget.width,r=this.resizeTarget.minWidth,i=this.resizeTarget.maxWidth,a=e.clientX-this.clientX;a+t<n&&(a=-(t-n)),r&&a+t<r&&(a=-(t-r)),i&&a+t>i&&(a=i-t),this.resizeDiff=a,this.ctx.emit(`draw`)}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor===`col-resize`&&(this.ctx.stageElement.style.cursor=`default`);return}this.ctx.stageElement.style.cursor===`col-resize`&&(this.ctx.stageElement.style.cursor=`default`);let n=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(let r of n){let{offsetX:n,offsetY:i}=this.ctx.getOffset(e),a=n,o=i,s=r.getDrawX(),c=r.getDrawY();if(a>s+r.width-5&&a<s+r.width+4&&a<t-4&&o>c){let t=r.colIndex+r.colspan-1,n=this.leafCellHeaders.find(e=>e.colIndex===t);if(!n||!n.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<s+r.width)return;this.ctx.isTarget(e)&&i<=this.height&&(this.ctx.stageElement.style.cursor=`col-resize`,this.resizeTarget=n)}}}})}initDragColumn(){this.ctx.on(`cellHeaderMousedown`,e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor=`grabbing`):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on(`cellMousedown`,()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on(`mouseup`,()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){let e=(t,n={})=>(t.forEach((t,r)=>{t.children&&e(t.children,n),n[t.key]=r}),n),t=this.ctx.database.getColumns(),n=c(t,o(t)),r=new se(n,{key:`key`,childrenKey:`children`}),i=this.dragTarget.colIndex>this.dragingCell.colIndex?`before`:`after`;r.treeMove(this.dragTarget.column,this.dragingCell.column,i);let a=e(r.getTree());this.ctx.database.setCustomHeader({sortData:a}),this.init();let s={source:this.dragTarget,target:this.dragingCell,columns:n};this.ctx.emit(`columnDragChange`,s)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor=`default`,this.ctx.emit(`draw`))}}),this.ctx.on(`mousemove`,e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit(`draw`)))}),this.ctx.on(`cellHoverChange`,e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on(`cellHeaderHoverChange`,e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;let{column:{parentKey:t},key:n,level:r,fixed:i}=this.dragTarget,a=this.allCellHeaders.find(a=>a.key!==n&&a.fixed===i&&a.column.level===r&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){let e=a?`grabbing`:`not-allowed`;this.ctx.stageElement.style.cursor=e}return a}resizeColumn(e,t){let n=r=>{r.forEach(r=>{r.children&&r.children.length>0&&n(r.children),r.key===e.key&&(r.width=(r.width||100)+t)})};n(this.columns);let r=0;if(this.width<this.visibleWidth){let e=this.visibleWidth-this.width;r=Math.floor(e/this.resizeNum*100)/100,this.resizeAllColumn(r)}let i=e.width+t+r;this.ctx.emit(`resizeColumnChange`,{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:i,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,i),this.init(!0),this.ctx.emit(`draw`)}resizeAllColumn(e){if(e===0)return;let t=new Map,n=!0;for(let r of this.allCellHeaders)if(r.widthFillDisable)t.set(r.key,r.width);else{let i=r.width+e*r.colspan;t.set(r.key,i),i<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(n=!1)}if(!n)return;let r=e=>{e.forEach(e=>{t.has(e.key)&&(e.width=t.get(e.key)),e.children&&e.children.length>0&&r(e.children)})};r(this.columns),this.init(!0),this.ctx.emit(`draw`)}getCustomHeader(){let e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:n={}}=t;return Object.keys(n).length===0?{columns:e,customHeader:t}:{columns:c(e,o(e)),customHeader:t}}render(e,t){let n=e.length,r=t,{HEADER_HEIGHT:i=0}=this.ctx.config;for(let t=0;t<n;t++){let n=e[t],a=i*(n.rowspan||0),o=i*(n.level||0),{minWidth:s,maxWidth:c}=n,u=n.width||100;s&&u<s&&(u=s),c&&u>c&&(u=c),n.children&&(u=l(n.children).reduce((e,t)=>e+(t?.width||100),0));let d=new ne(this.ctx,this.columnIndex,r,o,u,a,n);this.ctx.database.setHeader(n.key,d),this.allCellHeaders.push(d),n.children||(this.leafCellHeaders.push(d),d.column.widthFillDisable||this.resizeNum++),n.fixed===`left`?this.fixedLeftCellHeaders.push(d):n.fixed===`right`?this.fixedRightCellHeaders.push(d):this.centerCellHeaders.push(d),!n.children&&this.columnIndex++,n.children&&this.render(n.children,r),r+=u}}drawTipLine(){if(this.isResizing&&this.resizeTarget){let{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:n,RESIZE_COLUMN_TEXT_BG_COLOR:r,ENABLE_RESIZE_COLUMN_TEXT:i}}=this.ctx,a=this.resizeTarget.getDrawX(),o=this.resizeTarget.width,s=a+o+this.resizeDiff-.5,c=[s-.5,0,s-.5,e];if(this.ctx.paint.drawLine(c,{borderColor:t}),i){let e=`${Math.floor(o+this.resizeDiff)}px`;this.ctx.paint.drawRect(s+45/2,this.ctx.mouseY-24/2,45,24,{fillColor:r,borderWidth:0,borderColor:`transparent`}),this.ctx.paint.drawText(e,s+45/2,this.ctx.mouseY-24/2,45,26,{padding:0,color:n,align:`center`,verticalAlign:`middle`})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){let{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,n=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,n,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:`transparent`}),this.dragingCell){let{drawX:e,drawY:n,visibleWidth:r,colIndex:i}=this.dragingCell,a=e,o=n;i>this.dragTarget.colIndex&&(a=e+r),i===0&&(a+=1),i===this.ctx.maxColIndex&&--a;let s=[a,o,a,this.ctx.stageHeight],c=[a-4,o,a+4,o,a,o+6,a-4,o];this.ctx.paint.drawLine(c,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(s,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){let{fixedLeftWidth:e,fixedRightWidth:t,scrollX:n,header:r,stageWidth:i,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:o}}=this.ctx;if(n>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:`right`,shadowWidth:4,colorStart:`rgba(0,0,0,0.1)`,colorEnd:`rgba(0,0,0,0)`}),n<Math.floor(r.width-i-1)&&t!==o){let e=r.width-(this.x+this.width)+i-t;this.ctx.paint.drawShadow(e,this.y,t,this.height,{fillColor:a,side:`left`,shadowWidth:4,colorStart:`rgba(0,0,0,0)`,colorEnd:`rgba(0,0,0,0.1)`})}}update(){let e=[],t=[],n=[];if(this.centerCellHeaders.length){let e=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=e.colIndex}this.centerCellHeaders.forEach(n=>{n.isHorizontalVisible()&&n.isVerticalVisible()&&(t.push(n),n.hasChildren||e.push(n))}),this.fixedLeftCellHeaders.forEach(t=>{n.push(t),t.hasChildren||e.push(t)}),this.fixedRightCellHeaders.forEach(t=>{n.push(t),t.hasChildren||e.push(t)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=n,this.renderLeafCellHeaders=e.sort((e,t)=>e.x-t.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(e=>e.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){let{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,n=[0,this.height,e,this.height];this.ctx.paint.drawLine(n,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class L{constructor(e,t,r=0,i=0,a=0,o=0,s,c=`body`){n(this,`ctx`),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`),n(this,`cells`,[]),n(this,`fixedCells`,[]),n(this,`noFixedCells`,[]),n(this,`calculatedHeightCells`,[]),n(this,`rowIndex`,0),n(this,`rowKey`,``),n(this,`rowType`,`body`),n(this,`data`),n(this,`calculatedHeight`,-1),this.ctx=e,this.x=r,this.y=i,this.width=a,this.height=o,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||``,this.rowType=c,this.data=s,this.update()}update(){let{header:e}=this.ctx,t=[],n=[],r=[],i=[];e.renderLeafCellHeaders.forEach(e=>{let a=new w(this.ctx,this.rowIndex,e.colIndex,e.x,this.y,e.width,this.height,e.column,this.data,this.rowType);a.fixed?n.push(a):r.push(a),t.push(a),a.autoRowHeight&&i.push(a)}),this.cells=t,this.calculatedHeightCells=i,this.fixedCells=n,this.noFixedCells=r}updateCalculatedHeight(){let e=this.calculatedHeightCells.map(e=>{let t=e.getAutoHeight(),{key:n,height:r=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return(t>r||e.key===n&&t<r)&&this.ctx.database.setMaxRowHeightItem(this.rowKey,e.key,t),t});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class R{constructor(e){n(this,`resizeTarget`,null),n(this,`isMouseDown`,!1),n(this,`resizeDiff`,0),n(this,`clientY`,0),n(this,`ctx`),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`,0),n(this,`headIndex`,0),n(this,`tailIndex`,0),n(this,`isResizing`,!1),n(this,`renderRows`,[]),n(this,`visibleRows`,[]),n(this,`visibleHeight`,0),n(this,`visibleWidth`,0),n(this,`containerRect`),n(this,`data`,[]),this.ctx=e,this.init(),this.initResizeRow()}init(){let{canvasElement:e,header:t,footer:n,database:r,config:{FOOTER_FIXED:i,SCROLLER_TRACK_SIZE:a=0,HEIGHT:o,EMPTY_BODY_HEIGHT:s=0,MAX_HEIGHT:c=0,ENABLE_OFFSET_HEIGHT:l=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:d}}=this.ctx;if(!t.width)return;this.x=0,d===`top`&&i?this.y=t.height+n.height:this.y=t.height;let{data:f,sumHeight:p}=r.getData();this.height=p,this.data=f,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-a;let m=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!o?this.height=s:!this.data.length&&o&&(this.height=o-t.height-m-a);let h=this.height+t.height+a;h+=m;let g=h,_=window.innerHeight,{top:v}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(_>v&&l&&!o){let e=_-v-u;e>t.height+a?g=e:h>c&&(g=c)}else this.data.length&&o?g=o:this.data.length&&c&&h>c&&(g=c);g>0&&(this.ctx.stageHeight=Math.floor(g),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let y=this.ctx.stageHeight-t.height-a;i?this.visibleHeight=y-m:this.visibleHeight=y,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=f;let b=window.devicePixelRatio||1,x=this.ctx.stageWidth*b,S=this.ctx.stageHeight*b;e.width=Math.round(x),e.height=Math.round(S);let C=this.data.length?`not-empty`:`empty`;this.ctx.emit(`emptyChange`,{isEmpty:C,type:C,headerHeight:t.height,bodyHeight:this.height,footerHeight:m,width:this.width,height:this.data.length?0:s+m});let w=Math.round(e.width/b*1e4)/1e4,T=Math.round(e.height/b*1e4)/1e4;this.ctx.canvasElement.setAttribute(`style`,`height:${T}px;width:${w}px;`),this.ctx.paint.scale(b)}initResizeRow(){this.ctx.on(`resize`,()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on(`resizeObserver`,()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on(`mouseup`,()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on(`mousedown`,e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on(`mousemove`,e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;let{offsetY:t,offsetX:n}=this.ctx.getOffset(e),r=t,i=n,a=e.clientY,{stageHeight:o,scrollY:s,config:{RESIZE_ROW_MIN_HEIGHT:c=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){let e=this.resizeTarget.height,t=a-this.clientY,{calculatedHeight:n}=this.resizeTarget,r=n===-1?c:n;t+e<r&&(t=-(e-r)),this.resizeDiff=t,this.ctx.emit(`draw`)}else{if(this.resizeTarget=null,this.isMouseDown)return;if(i<0||i>this.ctx.body.visibleWidth||r<0||r>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor===`row-resize`&&(this.ctx.stageElement.style.cursor=`default`);return}if(this.ctx.stageElement.style.cursor===`crosshair`)return;this.ctx.stageElement.style.cursor===`row-resize`&&(this.ctx.stageElement.style.cursor=`default`);for(let e=0;e<this.renderRows.length;e++){let t=this.renderRows[e];if(r>t.y-s+t.height-1.5&&r<t.y-s+t.height+1.5&&r<o-4)for(let e=0;e<t.cells.length;e++){let n=t.cells[e];i>n.drawX+10&&i<n.drawX+n.width-10&&n.rowspan===1&&(this.ctx.stageElement.style.cursor=`row-resize`,this.resizeTarget=t)}}}})}resizeRow(e,t){let{rowIndex:n,height:r,rowKey:i,data:a}=e;this.ctx.database.setRowHeight(n,r+t),this.init(),this.ctx.emit(`draw`),this.ctx.emit(`resizeRowChange`,{rowIndex:n,oldHeight:r,height:r+t,rowKey:i,row:a,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){let{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:n}}=this.ctx,r=this.resizeTarget.y-t+this.resizeTarget.height+this.resizeDiff-.5,i=[0,r-.5,e,r-.5];this.ctx.paint.drawLine(i,{borderColor:n,borderWidth:1})}}drawFixedShadow(){let{fixedLeftWidth:e,fixedRightWidth:t,scrollX:n,header:r,stageWidth:i,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:o}}=this.ctx;if(n>0&&e!==0&&!this.ctx.isEmpty&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:`right`,shadowWidth:4,colorStart:`rgba(0,0,0,0.1)`,colorEnd:`rgba(0,0,0,0)`}),n<Math.floor(r.width-i-1)&&t!==o&&!this.ctx.isEmpty){let e=r.width-(this.x+this.width)+i-t;this.ctx.paint.drawShadow(e,this.y,t,this.height,{fillColor:a,side:`left`,shadowWidth:4,colorStart:`rgba(0,0,0,0)`,colorEnd:`rgba(0,0,0,0.1)`})}}binarySearch(e,t){let n=0,r=e.length-1,i=-1;for(;n<=r;){let a=Math.floor((n+r)/2),o=e[a].bottom;if(o===t)return a;o<t?n=a+1:(i=a,r=a-1)}return i}update(){this.init();let{header:e,database:t,scrollY:n,config:{CELL_HEIGHT:r}}=this.ctx,i=n,{data:a,positions:o}=t.getData();this.ctx.maxRowIndex=a.length-1;let s=this.binarySearch(o,i),c=this.binarySearch(o,i+this.visibleHeight);if(c===-1&&(c=this.ctx.maxRowIndex),s===-1&&c===this.ctx.maxRowIndex){let e=Math.floor(this.visibleHeight/r);s=this.ctx.maxRowIndex-e}this.headIndex=Math.max(0,s),this.tailIndex=Math.min(this.ctx.maxRowIndex,c+1),this.visibleRows=a.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;let l=[];for(let t=0;t<this.visibleRows.length;t++){let n=this.headIndex+t,r=this.visibleRows[t],{height:i,top:a}=this.ctx.database.getPositionForRowIndex(n),o=new L(this.ctx,n,0,a+this.y,e.width,i,r);l.push(o)}this.renderRows=l,this.ctx.body.renderRows=l}updateAutoHeight(){let e=this.ctx.body.renderRows;if(!e.some(e=>e.calculatedHeightCells.length>0))return!1;e.forEach(e=>{e.updateCalculatedHeight()});let t=e.map(e=>({height:e.calculatedHeight,rowIndex:e.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class ce{constructor(e){n(this,`ctx`),n(this,`renderRows`,[]),n(this,`data`,[]),n(this,`x`,0),n(this,`y`,0),n(this,`width`,0),n(this,`height`,0),n(this,`visibleWidth`,0),n(this,`visibleHeight`,0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();let{header:e,body:t,config:{CELL_FOOTER_HEIGHT:n,FOOTER_FIXED:r,SCROLLER_TRACK_SIZE:i,FOOTER_POSITION:a}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(e=>e+n,0),this.visibleHeight=this.height,r?a===`top`?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-i:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){let{fixedLeftWidth:e,fixedRightWidth:t,scrollX:n,header:r,stageWidth:i,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:o}}=this.ctx,s=this.y;if(this.ctx.config.FOOTER_FIXED||(s=this.y-this.ctx.scrollY),n>0&&e!==0&&this.ctx.paint.drawShadow(this.x,s,e,this.height,{fillColor:a,side:`right`,shadowWidth:4,colorStart:`rgba(0,0,0,0.1)`,colorEnd:`rgba(0,0,0,0)`}),n<Math.floor(r.width-i-1)&&t!==o){let e=r.width-(this.x+this.width)+i-t;this.ctx.paint.drawShadow(e,s,t,this.height,{fillColor:a,side:`left`,shadowWidth:4,colorStart:`rgba(0,0,0,0)`,colorEnd:`rgba(0,0,0,0.1)`})}}update(){this.init();let{CELL_FOOTER_HEIGHT:e}=this.ctx.config,t=this.y,n=[];this.data.forEach((r,i)=>{let a=new L(this.ctx,i,0,t,this.width,e,r,`footer`);t+=e,n.push(a)}),this.renderRows=n,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){let{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,n=[0,this.y,e,this.y];this.ctx.paint.drawLine(n,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class le{constructor(e){n(this,`isCut`,!1),n(this,`isMultipleRow`,!1),n(this,`ctx`),this.ctx=e,this.init()}init(){this.ctx.on(`setMoveFocus`,e=>{this.moveFocus(e)}),this.ctx.on(`mousemove`,a(e=>{var t;(t=this.ctx.focusCellHeader)!=null&&t.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on(`cellHoverChange`,e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on(`cellClick`,()=>{this.adjustBoundaryPosition()}),this.ctx.on(`cellMousedown`,(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor===`pointer`||this.ctx.isPointer||this.ctx.stageElement.style.cursor===`crosshair`)){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!==`text`&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit(`selectorClick`,e)}}),this.ctx.on(`mouseup`,()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0)}),this.ctx.on(`cellHeaderHoverChange`,e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on(`cellHoverChange`,e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on(`cellHeaderMousedown`,(e,t)=>{this.ctx.stageElement.style.cursor===`pointer`||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!==`text`&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on(`keydown`,e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code===`KeyV`||e.metaKey&&e.code===`KeyV`){this.paste();return}if(e.ctrlKey&&e.code===`KeyC`||e.metaKey&&e.code===`KeyC`){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code===`KeyX`||e.metaKey&&e.code===`KeyX`){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code===`KeyA`||e.metaKey&&e.code===`KeyA`)&&(e.preventDefault(),this.selectAll()),e.code===`ArrowLeft`||e.shiftKey&&e.code===`Tab`){e.preventDefault(),this.moveFocus(`LEFT`);return}if(e.code===`ArrowUp`){e.preventDefault(),this.moveFocus(`TOP`);return}if(e.code===`ArrowRight`||e.code===`Tab`){e.preventDefault(),this.moveFocus(`RIGHT`);return}if(e.code===`ArrowDown`){e.preventDefault(),this.moveFocus(`BOTTOM`);return}if(e.code===`Delete`||e.code===`Backspace`){e.preventDefault();let{xArr:t,yArr:n}=this.ctx.selector;this.clearSelectedData(t,n);return}}}),this.ctx.on(`contextMenuClearSelected`,()=>{let{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on(`contextMenuCopy`,()=>{this.copy()}),this.ctx.on(`contextMenuPaste`,()=>{this.paste()}),this.ctx.on(`contextMenuCut`,()=>{this.isCut=!0,this.copy()}),this.ctx.on(`setSelectorCell`,e=>{this.ctx.setFocusCell(e),this.click(),this.adjustBoundaryPosition()}),this.ctx.on(`selectCols`,e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;let{ENABLE_SELECTOR_SPAN_COL:n,ENABLE_SELECTOR_SPAN_ROW:r}=this.ctx.config,i=e,a=t;if(!r){let[e]=a;a=[e,e]}if(!n){let[e]=i;i=[e,e]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(i)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(a)){this.ctx.mousedown&&(this.ctx.selectorMove=!0,this.ctx.disableHoverIconClick=!0),this.ctx.selector.enable=!0;let{SELECTOR_AREA_MIN_X:e,SELECTOR_AREA_MAX_X:t,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_X_OFFSET:o,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,c=e,l=t||this.ctx.maxColIndex-o,u=n,d=r||this.ctx.maxRowIndex-s,[f,p]=i,[m,h]=a;if(f<c||p>l||m<u||h>d)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){let e=this.adjustMergeCells(i,a);m=e.yArr[0],h=e.yArr[1],f=e.xArr[0],p=e.xArr[1],this.ctx.onlyMergeCell=e.onlyMergeCell}f===p&&m===h?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,i=[Math.max(c,f),Math.min(l,p)],a=[Math.max(u,m),Math.min(d,h)];let{BEFORE_SET_SELECTOR_METHOD:g}=this.ctx.config;if(typeof g==`function`){let e=g({focusCell:this.ctx.focusCell,xArr:i,yArr:a});if(!e)return;i=e.xArr,a=e.yArr}this.ctx.selector.xArr=i,this.ctx.selector.yArr=a,h===this.ctx.maxRowIndex&&m===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,p===this.ctx.maxColIndex&&f===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit(`setSelector`,this.ctx.selector),this.ctx.emit(`drawView`)}}adjustMergeCells(e,t){let[n,r]=t,[i,a]=e;if(r===this.ctx.maxRowIndex&&n===0||a===this.ctx.maxColIndex&&i===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let o=[],s=[];for(let c=0;c<=t[1]-t[0];c++)for(let l=0;l<=e[1]-e[0];l++){let u=c+t[0],d=l+e[0],f=this.ctx.database.getVirtualBodyCell(u,d);f&&((u===n||u===r)&&o.push(f),(d===i||d===a)&&s.push(f))}let c=o.reduce((e,t)=>{let{yArr:n}=t.getSpanInfo(),[r,i]=n;return e.minY=Math.min(e.minY,r),e.maxY=Math.max(e.maxY,i),e},{minY:n,maxY:r}),l=s.reduce((e,t)=>{let{xArr:n}=t.getSpanInfo(),[r,i]=n;return e.minX=Math.min(e.minX,r),e.maxX=Math.max(e.maxX,i),e},{minX:i,maxX:a}),u=[l.minX,l.maxX],d=[c.minY,c.maxY],f=!1;if(l.minX!==l.maxX||c.minY!==c.maxY){let e=JSON.stringify(u)+JSON.stringify(d),t=this.ctx.focusCell?.getSpanInfo();f=(t&&JSON.stringify(t.xArr)+JSON.stringify(t.yArr))===e}return{xArr:u,yArr:d,onlyMergeCell:f}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;let{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_Y_OFFSET:r}=this.ctx.config,i=t,a=n||this.ctx.maxRowIndex-r;if(this.ctx.focusCellHeader){let{colIndex:t}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=t){let n=[t,e.colIndex+e.colspan-1],r=[i,a];this.setSelector(n,r)}else{let n=[e.colIndex,t+e.colspan-1],r=[i,a];this.setSelector(n,r)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;let{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){let{SELECTOR_AREA_MIN_X:e,SELECTOR_AREA_MAX_X:t,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_X_OFFSET:i,SELECTOR_AREA_MAX_Y_OFFSET:a}=this.ctx.config,o=e,s=t||this.ctx.maxColIndex-i,c=n,l=r||this.ctx.maxRowIndex-a,u=[o,s],d=[c,l];this.setSelector(u,d)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;let{SELECTOR_AREA_MIN_X:n,SELECTOR_AREA_MAX_X:r,SELECTOR_AREA_MAX_X_OFFSET:i}=this.ctx.config,a=r||this.ctx.maxColIndex-i,o=n;if(t){this.ctx.setFocusCell(e);let t=[o,a],n=[e.rowIndex,e.rowIndex];this.setSelector(t,n)}if(this.ctx.focusCell&&this.ctx.mousedown){let{rowIndex:t}=this.ctx.focusCell;if(e.rowIndex>=t){let n=[o,a],r=[t,e.rowIndex];this.setSelector(n,r)}else{let n=[o,a],r=[e.rowIndex,t];this.setSelector(n,r)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;let{mousedown:e,focusCell:t,hoverCell:n}=this.ctx;if(e&&t&&n){let{rowIndex:e,colIndex:r}=t,i=Math.min(n.colIndex,r),a=Math.max(n.colIndex,r),o=Math.min(n.rowIndex,e),s=Math.max(n.rowIndex,e),c=[i,a],l=[o,s];this.setSelector(c,l)}}click(e=!1){let{focusCell:t,clickCell:n}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,n&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;let{colIndex:e,rowIndex:r}=n,{colIndex:i,rowIndex:a}=t,o=Math.min(i,e),s=Math.max(i,e),c=Math.min(a,r),l=Math.max(a,r),u=[o,s],d=[c,l];this.setSelector(u,d)}else{this.ctx.emit(`cellSelectedClick`,t);let e=[t.colIndex,t.colIndex],n=[t.rowIndex,t.rowIndex];this.setSelector(e,n)}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){return this.ctx.body.renderRows.find(t=>t.rowIndex===e)?.cells.find(e=>e.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:n}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,n))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){let r=this.ctx.focusCell;e=[[r.getValue()]],t=[r.colIndex,r.colIndex],n=[r.rowIndex,r.rowIndex]}else{let e={code:`ERR_MERGED_CELLS_COPY`,message:`Merged cells cannot span copy data`};this.ctx.hasEvent(`error`)?this.ctx.emit(`error`,e):alert(e.message);return}let{BEFORE_COPY_METHOD:r}=this.ctx.config;if(typeof r==`function`){let i=r({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:n});if(!i)return;e=i.data}let i=h(e);navigator.clipboard?navigator.clipboard.writeText(i).then(()=>{this.ctx.selector.xArrCopy=this.ctx.selector.xArr.slice(),this.ctx.selector.yArrCopy=this.ctx.selector.yArr.slice(),this.ctx.emit(`copyChange`,{xArr:this.ctx.selector.xArrCopy,yArr:this.ctx.selector.yArrCopy,data:e}),this.ctx.emit(`draw`)}).catch(e=>console.error(`Copy Failure:`,e)):console.error(`current browser does not support the Clipboard API`)}clearSelectedData(e,t,n=!1,r=null){let i=[],a=new Set;for(let n=0;n<=t[1]-t[0];n++)for(let o=0;o<=e[1]-e[0];o++){let s=n+t[0],c=o+e[0],l=this.ctx.database.getItemValueForRowIndexAndColIndex(s,c);if(l){let{rowKey:e,key:t}=l;this.ctx.database.getReadonly(e,t)||(a.add(e),i.push({rowKey:e,key:t,value:r,row:{}}))}}if(!i.length)return[];if(n)return i;this.ctx.database.batchSetItemValue(i,!0);let o=[];return a.forEach(e=>{o.push(this.ctx.database.getRowDataItemForRowKey(e))}),this.ctx.emit(`clearSelectedDataChange`,i,o),i}paste(){if(!navigator.clipboard){console.error(`current browser does not support the Clipboard API`);return}let{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){let e=this.ctx.selector.yArr[0],t=this.ctx.selector.xArr[0],n=new Set;navigator.clipboard.readText().then(async r=>{let i=m(r),a=[t,t+i[0].length-1],o=[e,e+i.length-1],[s,c]=o,[l,u]=a,d=c-this.ctx.maxRowIndex,f=u-this.ctx.maxColIndex;(d>0||f>0)&&this.ctx.emit(`onPastedDataOverflow`,{maxY:c,maxX:u,minY:s,minX:l,overflowRowCount:d,overflowColCount:f,textArr:i});let p=i.length===1&&i[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,o)&&!p){let e={code:`ERR_MERGED_CELLS_PASTE`,message:`Merged cells cannot span paste data`};this.ctx.hasEvent(`error`)?this.ctx.emit(`error`,e):alert(e.message);return}let h=[];for(let r=0;r<=i.length-1;r++){let a=i[r].length;for(let o=0;o<=a-1;o++){let a=r+e,s=o+t,c=i[r][o],l=this.ctx.database.getItemValueForRowIndexAndColIndex(a,s);if(l){let{rowKey:e,key:t}=l;this.ctx.database.getReadonly(e,t)||(n.add(e),h.push({rowKey:e,key:t,value:c,row:{}}))}}}if(this.isCut){let e=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),t=h.map(e=>`${e.rowKey}-${e.key}`);e.forEach(e=>{t.includes(`${e.rowKey}-${e.key}`)||h.unshift(e)}),this.isCut=!1}if(!h.length)return;let{BEFORE_PASTE_DATA_METHOD:g}=this.ctx.config;if(typeof g==`function`&&(h=await g(h.map(e=>({rowKey:e.rowKey,key:e.key,value:e.value,oldValue:this.ctx.database.getItemValue(e.rowKey,e.key),row:this.ctx.database.getRowDataItemForRowKey(e.rowKey)})),a,o,i),h&&!h.length))return;this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(h,!0);let _=[];n.forEach(e=>{_.push(this.ctx.database.getRowDataItemForRowKey(e))}),this.ctx.emit(`pasteChange`,h,_),this.ctx.emit(`draw`)}).catch(e=>{console.error(`Failed to get the clipboard content:`,e)})}}moveFocus(e){if(this.ctx.editing)return;let{focusCell:t}=this.ctx;if(!t)return;let{colIndex:n=0,rowIndex:r=0}=t,i=this.ctx.maxColIndex,a=this.ctx.maxRowIndex;switch(e){case`LEFT`:n>0&&n--;break;case`TOP`:r>0&&r--;break;case`RIGHT`:n<i&&n++;break;case`BOTTOM`:r<a&&r++;break}let o=[n,n],s=[r,r],c=this.getCell(r,n);c&&(c.operation||this.isInSettingRange(c.rowIndex,c.colIndex)&&(this.ctx.setFocusCell(c),this.setSelector(o,s),this.adjustBoundaryPosition(),this.ctx.emit(`moveFocus`,c),this.ctx.emit(`draw`)))}isInSettingRange(e,t){let{SELECTOR_AREA_MIN_X:n,SELECTOR_AREA_MAX_X:r,SELECTOR_AREA_MIN_Y:i,SELECTOR_AREA_MAX_Y:a,SELECTOR_AREA_MAX_X_OFFSET:o,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,c=n,l=r||this.ctx.maxColIndex-o,u=i,d=a||this.ctx.maxRowIndex-s;return!(t<c||t>l||e<u||e>d)}adjustBoundaryPosition(){let{stageHeight:e,stageWidth:t,focusCell:n,fixedRightWidth:r,fixedLeftWidth:i,header:a,footer:o,body:s,scrollX:c,scrollY:l,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:d,FOOTER_POSITION:f,ENABLE_MERGE_CELL_LINK:p}}=this.ctx;if(!n)return;p&&this.ctx.onlyMergeCell&&n.updateSpanInfo();let{drawX:m,drawY:h,width:g,height:_,fixed:v}=n,y=i-m+1,b=n.drawX+g-(t-r)+1,x=a.height-h,S=_;S>s.visibleHeight&&(S=s.visibleHeight);let C=0;d&&(f===`top`?x=a.height+o.height-h:C=o.visibleHeight);let w=h+S-(e-C-u),T=c,E=l;b>0&&!v?T=Math.floor(c+b):y>0&&!v&&(T=Math.floor(c-y)),x>0?E=Math.floor(l-x):w>0&&(E=Math.floor(l+w)),(Math.abs(c-T)>2.5||Math.abs(l-E)>2.5)&&this.ctx.setScroll(T,E)}destroy(){}}class ue{constructor(e){n(this,`ctx`),n(this,`maxColRowCell`),this.ctx=e,this.init()}init(){this.ctx.on(`mousemove`,e=>{if(this.ctx.stageElement.style.cursor===`crosshair`&&(this.ctx.stageElement.style.cursor=`default`),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;let{offsetX:t,offsetY:n}=this.ctx.getOffset(e),{colIndex:r,rowIndex:i,drawX:a,drawY:o,width:s,height:c}=this.maxColRowCell,l=r===this.ctx.maxColIndex||i===this.ctx.maxRowIndex?0:2,u=a+s-6+l,d=o+c-6+l;t>u&&n>d&&t<u+6&&n<d+6&&(this.ctx.stageElement.style.cursor=`crosshair`),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on(`cellMouseenter`,e=>{let{xArr:t,yArr:n}=this.ctx.selector,r=t[1],i=n[1],{colIndex:a,rowIndex:o}=e;this.ctx.config.ENABLE_AUTOFILL&&a===r&&o===i&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on(`mousedown`,()=>{this.ctx.stageElement.style.cursor===`crosshair`&&this.setMousedown()}),this.ctx.on(`mouseup`,()=>{this.setMouseUp(),this.ctx.stopAdjustPosition()})}isAutofillIng(){let{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){let{ENABLE_AUTOFILL:n,ENABLE_AUTOFILL_SPAN_COL:r,ENABLE_AUTOFILL_SPAN_ROW:i}=this.ctx.config;if(!n)return;let a=e,o=t,s=this.ctx.selector.xArr,c=this.ctx.selector.yArr;if(!(!i&&JSON.stringify(c)!==JSON.stringify(o))&&!(!r&&JSON.stringify(s)!==JSON.stringify(a))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(a)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(o))){let{SELECTOR_AREA_MIN_X:e,SELECTOR_AREA_MAX_X:t,SELECTOR_AREA_MIN_Y:n,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_X_OFFSET:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,c=e,l=t||this.ctx.maxColIndex-i,u=n,d=r||this.ctx.maxRowIndex-s,[f,p]=a,[m,h]=o;if(f<c||m<u)return;a=[Math.max(c,f),Math.min(l,p)],o=[Math.max(u,m),Math.min(d,h)];let{BEFORE_SET_AUTOFILL_METHOD:g}=this.ctx.config;if(typeof g==`function`){let e=g({focusCell:this.ctx.focusCell,xArr:a,yArr:o});if(!e)return;a=e.xArr,o=e.yArr}this.ctx.autofill.xArr=a,this.ctx.autofill.yArr=o,this.ctx.emit(`setAutofill`,this.ctx.autofill),this.ctx.emit(`draw`)}}async autofillData(){let e=new Set,t=this.ctx.getSelectedData(),n=new Map;for(let e=0;e<=t.yArr[1]-t.yArr[0];e++)for(let r=0;r<=t.xArr[1]-t.xArr[0];r++){let i=e+t.yArr[0],a=r+t.xArr[0];n.set(`${i}-${a}`,!0)}let{value:r}=t,i=r[0].length,a=r.length,o=this.ctx.autofill.xArr,s=this.ctx.autofill.yArr,c=i===1&&a===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(o,s)&&!c){let e={code:`ERR_MERGED_CELLS_AUTOFILL`,message:`Merged cells cannot span autofill data`};this.ctx.hasEvent(`error`)?this.ctx.emit(`error`,e):alert(e.message);return}let l=[];for(let t=0;t<=s[1]-s[0];t++)for(let c=0;c<=o[1]-o[0];c++){let u=c+o[0],d=t+s[0],f=r[t%a][c%i],p=this.ctx.database.getItemValueForRowIndexAndColIndex(d,u),m=`${d}-${u}`;if(p&&!n.has(m)){let{rowKey:t,key:n}=p;this.ctx.database.getReadonly(t,n)||(e.add(t),l.push({rowKey:t,key:n,value:f,row:{}}))}}if(!l.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;let{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u==`function`&&(l=await u(l.map(e=>({rowKey:e.rowKey,key:e.key,value:e.value,oldValue:this.ctx.database.getItemValue(e.rowKey,e.key),row:this.ctx.database.getRowDataItemForRowKey(e.rowKey)})),o,s),l&&!l.length))return;this.ctx.batchSetItemValueByEditor(l,!0);let d=[];e.forEach(e=>{d.push(this.ctx.database.getRowDataItemForRowKey(e))}),this.ctx.emit(`autofillChange`,l,d),this.ctx.emit(`draw`)}mouseenter(e){if([`index`,`selection`,`index-selection`].includes(e.type))return;let{selector:t,autofill:n}=this.ctx;if(this.ctx.mousedown&&t.enable&&n.enable){let{rowIndex:n,colIndex:r}=e,i=t.xArr.slice(),a=t.yArr.slice();n>=t.yArr[0]&&n<=t.yArr[1]?r>t.xArr[1]?i.splice(1,1,r):r<t.xArr[0]&&i.splice(0,1,r):n>t.yArr[1]?a.splice(1,1,n):n<t.yArr[0]&&a.splice(0,1,n),this.setAutofill(i,a)}}destroy(){}}let de=Math.min,fe=Math.max,pe=Math.round,z=Math.floor,B=e=>({x:e,y:e}),me={left:`right`,right:`left`,bottom:`top`,top:`bottom`},he={start:`end`,end:`start`};function V(e,t,n){return fe(e,de(t,n))}function H(e,t){return typeof e==`function`?e(t):e}function ge(e){return e.split(`-`)[0]}function _e(e){return e.split(`-`)[1]}function ve(e){return e===`x`?`y`:`x`}function ye(e){return e===`y`?`height`:`width`}let be=new Set([`top`,`bottom`]);function xe(e){return be.has(ge(e))?`y`:`x`}function Se(e){return ve(xe(e))}function Ce(e,t,n){n===void 0&&(n=!1);let r=_e(e),i=Se(e),a=ye(i),o=i===`x`?r===(n?`end`:`start`)?`right`:`left`:r===`start`?`bottom`:`top`;return t.reference[a]>t.floating[a]&&(o=je(o)),[o,je(o)]}function we(e){let t=je(e);return[Te(e),t,Te(t)]}function Te(e){return e.replace(/start|end/g,e=>he[e])}let U=[`left`,`right`],Ee=[`right`,`left`],De=[`top`,`bottom`],Oe=[`bottom`,`top`];function ke(e,t,n){switch(e){case`top`:case`bottom`:return n?t?Ee:U:t?U:Ee;case`left`:case`right`:return t?De:Oe;default:return[]}}function Ae(e,t,n,r){let i=_e(e),a=ke(ge(e),n===`start`,r);return i&&(a=a.map(e=>e+`-`+i),t&&(a=a.concat(a.map(Te)))),a}function je(e){return e.replace(/left|right|bottom|top/g,e=>me[e])}function Me(e){return{top:0,right:0,bottom:0,left:0,...e}}function Ne(e){return typeof e==`number`?{top:e,right:e,bottom:e,left:e}:Me(e)}function Pe(e){let{x:t,y:n,width:r,height:i}=e;return{width:r,height:i,top:n,left:t,right:t+r,bottom:n+i,x:t,y:n}}function Fe(e,t,n){let{reference:r,floating:i}=e,a=xe(t),o=Se(t),s=ye(o),c=ge(t),l=a===`y`,u=r.x+r.width/2-i.width/2,d=r.y+r.height/2-i.height/2,f=r[s]/2-i[s]/2,p;switch(c){case`top`:p={x:u,y:r.y-i.height};break;case`bottom`:p={x:u,y:r.y+r.height};break;case`right`:p={x:r.x+r.width,y:d};break;case`left`:p={x:r.x-i.width,y:d};break;default:p={x:r.x,y:r.y}}switch(_e(t)){case`start`:p[o]-=f*(n&&l?-1:1);break;case`end`:p[o]+=f*(n&&l?-1:1);break}return p}let Ie=async(e,t,n)=>{let{placement:r=`bottom`,strategy:i=`absolute`,middleware:a=[],platform:o}=n,s=a.filter(Boolean),c=await(o.isRTL==null?void 0:o.isRTL(t)),l=await o.getElementRects({reference:e,floating:t,strategy:i}),{x:u,y:d}=Fe(l,r,c),f=r,p={},m=0;for(let n=0;n<s.length;n++){let{name:a,fn:h}=s[n],{x:g,y:_,data:v,reset:y}=await h({x:u,y:d,initialPlacement:r,placement:f,strategy:i,middlewareData:p,rects:l,platform:o,elements:{reference:e,floating:t}});u=g??u,d=_??d,p={...p,[a]:{...p[a],...v}},y&&m<=50&&(m++,typeof y==`object`&&(y.placement&&(f=y.placement),y.rects&&(l=y.rects===!0?await o.getElementRects({reference:e,floating:t,strategy:i}):y.rects),{x:u,y:d}=Fe(l,f,c)),n=-1)}return{x:u,y:d,placement:f,strategy:i,middlewareData:p}};async function Le(e,t){var n;t===void 0&&(t={});let{x:r,y:i,platform:a,rects:o,elements:s,strategy:c}=e,{boundary:l=`clippingAncestors`,rootBoundary:u=`viewport`,elementContext:d=`floating`,altBoundary:f=!1,padding:p=0}=H(t,e),m=Ne(p),h=s[f?d===`floating`?`reference`:`floating`:d],g=Pe(await a.getClippingRect({element:(n=await(a.isElement==null?void 0:a.isElement(h)))==null||n?h:h.contextElement||await(a.getDocumentElement==null?void 0:a.getDocumentElement(s.floating)),boundary:l,rootBoundary:u,strategy:c})),_=d===`floating`?{x:r,y:i,width:o.floating.width,height:o.floating.height}:o.reference,v=await(a.getOffsetParent==null?void 0:a.getOffsetParent(s.floating)),y=await(a.isElement==null?void 0:a.isElement(v))&&await(a.getScale==null?void 0:a.getScale(v))||{x:1,y:1},b=Pe(a.convertOffsetParentRelativeRectToViewportRelativeRect?await a.convertOffsetParentRelativeRectToViewportRelativeRect({elements:s,rect:_,offsetParent:v,strategy:c}):_);return{top:(g.top-b.top+m.top)/y.y,bottom:(b.bottom-g.bottom+m.bottom)/y.y,left:(g.left-b.left+m.left)/y.x,right:(b.right-g.right+m.right)/y.x}}let Re=e=>({name:`arrow`,options:e,async fn(t){let{x:n,y:r,placement:i,rects:a,platform:o,elements:s,middlewareData:c}=t,{element:l,padding:u=0}=H(e,t)||{};if(l==null)return{};let d=Ne(u),f={x:n,y:r},p=Se(i),m=ye(p),h=await o.getDimensions(l),g=p===`y`,_=g?`top`:`left`,v=g?`bottom`:`right`,y=g?`clientHeight`:`clientWidth`,b=a.reference[m]+a.reference[p]-f[p]-a.floating[m],x=f[p]-a.reference[p],S=await(o.getOffsetParent==null?void 0:o.getOffsetParent(l)),C=S?S[y]:0;(!C||!await(o.isElement==null?void 0:o.isElement(S)))&&(C=s.floating[y]||a.floating[m]);let w=b/2-x/2,T=C/2-h[m]/2-1,E=de(d[_],T),D=de(d[v],T),O=E,k=C-h[m]-D,A=C/2-h[m]/2+w,j=V(O,A,k),M=!c.arrow&&_e(i)!=null&&A!==j&&a.reference[m]/2-(A<O?E:D)-h[m]/2<0,N=M?A<O?A-O:A-k:0;return{[p]:f[p]+N,data:{[p]:j,centerOffset:A-j-N,...M&&{alignmentOffset:N}},reset:M}}}),ze=function(e){return e===void 0&&(e={}),{name:`flip`,options:e,async fn(t){var n;let{placement:r,middlewareData:i,rects:a,initialPlacement:o,platform:s,elements:c}=t,{mainAxis:l=!0,crossAxis:u=!0,fallbackPlacements:d,fallbackStrategy:f=`bestFit`,fallbackAxisSideDirection:p=`none`,flipAlignment:m=!0,...h}=H(e,t);if((n=i.arrow)!=null&&n.alignmentOffset)return{};let g=ge(r),_=xe(o),v=ge(o)===o,y=await(s.isRTL==null?void 0:s.isRTL(c.floating)),b=d||(v||!m?[je(o)]:we(o)),x=p!==`none`;!d&&x&&b.push(...Ae(o,m,p,y));let S=[o,...b],C=await Le(t,h),w=[],T=i.flip?.overflows||[];if(l&&w.push(C[g]),u){let e=Ce(r,a,y);w.push(C[e[0]],C[e[1]])}if(T=[...T,{placement:r,overflows:w}],!w.every(e=>e<=0)){let e=(i.flip?.index||0)+1,t=S[e];if(t&&(!(u===`alignment`&&_!==xe(t))||T.every(e=>xe(e.placement)===_?e.overflows[0]>0:!0)))return{data:{index:e,overflows:T},reset:{placement:t}};let n=T.filter(e=>e.overflows[0]<=0).sort((e,t)=>e.overflows[1]-t.overflows[1])[0]?.placement;if(!n)switch(f){case`bestFit`:{let e=T.filter(e=>{if(x){let t=xe(e.placement);return t===_||t===`y`}return!0}).map(e=>[e.placement,e.overflows.filter(e=>e>0).reduce((e,t)=>e+t,0)]).sort((e,t)=>e[1]-t[1])[0]?.[0];e&&(n=e);break}case`initialPlacement`:n=o;break}if(r!==n)return{reset:{placement:n}}}return{}}}},Be=new Set([`left`,`top`]);async function Ve(e,t){let{placement:n,platform:r,elements:i}=e,a=await(r.isRTL==null?void 0:r.isRTL(i.floating)),o=ge(n),s=_e(n),c=xe(n)===`y`,l=Be.has(o)?-1:1,u=a&&c?-1:1,d=H(t,e),{mainAxis:f,crossAxis:p,alignmentAxis:m}=typeof d==`number`?{mainAxis:d,crossAxis:0,alignmentAxis:null}:{mainAxis:d.mainAxis||0,crossAxis:d.crossAxis||0,alignmentAxis:d.alignmentAxis};return s&&typeof m==`number`&&(p=s===`end`?m*-1:m),c?{x:p*u,y:f*l}:{x:f*l,y:p*u}}let He=function(e){return e===void 0&&(e=0),{name:`offset`,options:e,async fn(t){var n;let{x:r,y:i,placement:a,middlewareData:o}=t,s=await Ve(t,e);return a===o.offset?.placement&&(n=o.arrow)!=null&&n.alignmentOffset?{}:{x:r+s.x,y:i+s.y,data:{...s,placement:a}}}}},Ue=function(e){return e===void 0&&(e={}),{name:`shift`,options:e,async fn(t){let{x:n,y:r,placement:i}=t,{mainAxis:a=!0,crossAxis:o=!1,limiter:s={fn:e=>{let{x:t,y:n}=e;return{x:t,y:n}}},...c}=H(e,t),l={x:n,y:r},u=await Le(t,c),d=xe(ge(i)),f=ve(d),p=l[f],m=l[d];if(a){let e=f===`y`?`top`:`left`,t=f===`y`?`bottom`:`right`,n=p+u[e],r=p-u[t];p=V(n,p,r)}if(o){let e=d===`y`?`top`:`left`,t=d===`y`?`bottom`:`right`,n=m+u[e],r=m-u[t];m=V(n,m,r)}let h=s.fn({...t,[f]:p,[d]:m});return{...h,data:{x:h.x-n,y:h.y-r,enabled:{[f]:a,[d]:o}}}}}};function We(){return typeof window<`u`}function Ge(e){return qe(e)?(e.nodeName||``).toLowerCase():`#document`}function W(e){var t;return(e==null||(t=e.ownerDocument)==null?void 0:t.defaultView)||window}function Ke(e){return((qe(e)?e.ownerDocument:e.document)||window.document)?.documentElement}function qe(e){return We()?e instanceof Node||e instanceof W(e).Node:!1}function G(e){return We()?e instanceof Element||e instanceof W(e).Element:!1}function K(e){return We()?e instanceof HTMLElement||e instanceof W(e).HTMLElement:!1}function Je(e){return!We()||typeof ShadowRoot>`u`?!1:e instanceof ShadowRoot||e instanceof W(e).ShadowRoot}let q=new Set([`inline`,`contents`]);function J(e){let{overflow:t,overflowX:n,overflowY:r,display:i}=st(e);return/auto|scroll|overlay|hidden|clip/.test(t+r+n)&&!q.has(i)}let Ye=new Set([`table`,`td`,`th`]);function Xe(e){return Ye.has(Ge(e))}let Ze=[`:popover-open`,`:modal`];function Qe(e){return Ze.some(t=>{try{return e.matches(t)}catch{return!1}})}let $e=[`transform`,`translate`,`scale`,`rotate`,`perspective`],et=[`transform`,`translate`,`scale`,`rotate`,`perspective`,`filter`],tt=[`paint`,`layout`,`strict`,`content`];function nt(e){let t=it(),n=G(e)?st(e):e;return $e.some(e=>n[e]?n[e]!==`none`:!1)||(n.containerType?n.containerType!==`normal`:!1)||!t&&(n.backdropFilter?n.backdropFilter!==`none`:!1)||!t&&(n.filter?n.filter!==`none`:!1)||et.some(e=>(n.willChange||``).includes(e))||tt.some(e=>(n.contain||``).includes(e))}function rt(e){let t=lt(e);for(;K(t)&&!ot(t);){if(nt(t))return t;if(Qe(t))return null;t=lt(t)}return null}function it(){return typeof CSS>`u`||!CSS.supports?!1:CSS.supports(`-webkit-backdrop-filter`,`none`)}let at=new Set([`html`,`body`,`#document`]);function ot(e){return at.has(Ge(e))}function st(e){return W(e).getComputedStyle(e)}function ct(e){return G(e)?{scrollLeft:e.scrollLeft,scrollTop:e.scrollTop}:{scrollLeft:e.scrollX,scrollTop:e.scrollY}}function lt(e){if(Ge(e)===`html`)return e;let t=e.assignedSlot||e.parentNode||Je(e)&&e.host||Ke(e);return Je(t)?t.host:t}function ut(e){let t=lt(e);return ot(t)?e.ownerDocument?e.ownerDocument.body:e.body:K(t)&&J(t)?t:ut(t)}function dt(e,t,n){t===void 0&&(t=[]),n===void 0&&(n=!0);let r=ut(e),i=r===e.ownerDocument?.body,a=W(r);if(i){let e=ft(a);return t.concat(a,a.visualViewport||[],J(r)?r:[],e&&n?dt(e):[])}return t.concat(r,dt(r,[],n))}function ft(e){return e.parent&&Object.getPrototypeOf(e.parent)?e.frameElement:null}function pt(e){let t=st(e),n=parseFloat(t.width)||0,r=parseFloat(t.height)||0,i=K(e),a=i?e.offsetWidth:n,o=i?e.offsetHeight:r,s=pe(n)!==a||pe(r)!==o;return s&&(n=a,r=o),{width:n,height:r,$:s}}function mt(e){return G(e)?e:e.contextElement}function ht(e){let t=mt(e);if(!K(t))return B(1);let n=t.getBoundingClientRect(),{width:r,height:i,$:a}=pt(t),o=(a?pe(n.width):n.width)/r,s=(a?pe(n.height):n.height)/i;return(!o||!Number.isFinite(o))&&(o=1),(!s||!Number.isFinite(s))&&(s=1),{x:o,y:s}}let gt=B(0);function _t(e){let t=W(e);return!it()||!t.visualViewport?gt:{x:t.visualViewport.offsetLeft,y:t.visualViewport.offsetTop}}function vt(e,t,n){return t===void 0&&(t=!1),!n||t&&n!==W(e)?!1:t}function yt(e,t,n,r){t===void 0&&(t=!1),n===void 0&&(n=!1);let i=e.getBoundingClientRect(),a=mt(e),o=B(1);t&&(r?G(r)&&(o=ht(r)):o=ht(e));let s=vt(a,n,r)?_t(a):B(0),c=(i.left+s.x)/o.x,l=(i.top+s.y)/o.y,u=i.width/o.x,d=i.height/o.y;if(a){let e=W(a),t=r&&G(r)?W(r):r,n=e,i=ft(n);for(;i&&r&&t!==n;){let e=ht(i),t=i.getBoundingClientRect(),r=st(i),a=t.left+(i.clientLeft+parseFloat(r.paddingLeft))*e.x,o=t.top+(i.clientTop+parseFloat(r.paddingTop))*e.y;c*=e.x,l*=e.y,u*=e.x,d*=e.y,c+=a,l+=o,n=W(i),i=ft(n)}}return Pe({width:u,height:d,x:c,y:l})}function bt(e,t){let n=ct(e).scrollLeft;return t?t.left+n:yt(Ke(e)).left+n}function xt(e,t,n){n===void 0&&(n=!1);let r=e.getBoundingClientRect();return{x:r.left+t.scrollLeft-(n?0:bt(e,r)),y:r.top+t.scrollTop}}function St(e){let{elements:t,rect:n,offsetParent:r,strategy:i}=e,a=i===`fixed`,o=Ke(r),s=t?Qe(t.floating):!1;if(r===o||s&&a)return n;let c={scrollLeft:0,scrollTop:0},l=B(1),u=B(0),d=K(r);if((d||!d&&!a)&&((Ge(r)!==`body`||J(o))&&(c=ct(r)),K(r))){let e=yt(r);l=ht(r),u.x=e.x+r.clientLeft,u.y=e.y+r.clientTop}let f=o&&!d&&!a?xt(o,c,!0):B(0);return{width:n.width*l.x,height:n.height*l.y,x:n.x*l.x-c.scrollLeft*l.x+u.x+f.x,y:n.y*l.y-c.scrollTop*l.y+u.y+f.y}}function Ct(e){return Array.from(e.getClientRects())}function wt(e){let t=Ke(e),n=ct(e),r=e.ownerDocument.body,i=fe(t.scrollWidth,t.clientWidth,r.scrollWidth,r.clientWidth),a=fe(t.scrollHeight,t.clientHeight,r.scrollHeight,r.clientHeight),o=-n.scrollLeft+bt(e),s=-n.scrollTop;return st(r).direction===`rtl`&&(o+=fe(t.clientWidth,r.clientWidth)-i),{width:i,height:a,x:o,y:s}}function Tt(e,t){let n=W(e),r=Ke(e),i=n.visualViewport,a=r.clientWidth,o=r.clientHeight,s=0,c=0;if(i){a=i.width,o=i.height;let e=it();(!e||e&&t===`fixed`)&&(s=i.offsetLeft,c=i.offsetTop)}return{width:a,height:o,x:s,y:c}}let Et=new Set([`absolute`,`fixed`]);function Dt(e,t){let n=yt(e,!0,t===`fixed`),r=n.top+e.clientTop,i=n.left+e.clientLeft,a=K(e)?ht(e):B(1);return{width:e.clientWidth*a.x,height:e.clientHeight*a.y,x:i*a.x,y:r*a.y}}function Ot(e,t,n){let r;if(t===`viewport`)r=Tt(e,n);else if(t===`document`)r=wt(Ke(e));else if(G(t))r=Dt(t,n);else{let n=_t(e);r={x:t.x-n.x,y:t.y-n.y,width:t.width,height:t.height}}return Pe(r)}function kt(e,t){let n=lt(e);return n===t||!G(n)||ot(n)?!1:st(n).position===`fixed`||kt(n,t)}function At(e,t){let n=t.get(e);if(n)return n;let r=dt(e,[],!1).filter(e=>G(e)&&Ge(e)!==`body`),i=null,a=st(e).position===`fixed`,o=a?lt(e):e;for(;G(o)&&!ot(o);){let t=st(o),n=nt(o);!n&&t.position===`fixed`&&(i=null),(a?!n&&!i:!n&&t.position===`static`&&i&&Et.has(i.position)||J(o)&&!n&&kt(e,o))?r=r.filter(e=>e!==o):i=t,o=lt(o)}return t.set(e,r),r}function jt(e){let{element:t,boundary:n,rootBoundary:r,strategy:i}=e,a=[...n===`clippingAncestors`?Qe(t)?[]:At(t,this._c):[].concat(n),r],o=a[0],s=a.reduce((e,n)=>{let r=Ot(t,n,i);return e.top=fe(r.top,e.top),e.right=de(r.right,e.right),e.bottom=de(r.bottom,e.bottom),e.left=fe(r.left,e.left),e},Ot(t,o,i));return{width:s.right-s.left,height:s.bottom-s.top,x:s.left,y:s.top}}function Mt(e){let{width:t,height:n}=pt(e);return{width:t,height:n}}function Nt(e,t,n){let r=K(t),i=Ke(t),a=n===`fixed`,o=yt(e,!0,a,t),s={scrollLeft:0,scrollTop:0},c=B(0);function l(){c.x=bt(i)}if(r||!r&&!a)if((Ge(t)!==`body`||J(i))&&(s=ct(t)),r){let e=yt(t,!0,a,t);c.x=e.x+t.clientLeft,c.y=e.y+t.clientTop}else i&&l();a&&!r&&i&&l();let u=i&&!r&&!a?xt(i,s):B(0);return{x:o.left+s.scrollLeft-c.x-u.x,y:o.top+s.scrollTop-c.y-u.y,width:o.width,height:o.height}}function Pt(e){return st(e).position===`static`}function Ft(e,t){if(!K(e)||st(e).position===`fixed`)return null;if(t)return t(e);let n=e.offsetParent;return Ke(e)===n&&(n=n.ownerDocument.body),n}function It(e,t){let n=W(e);if(Qe(e))return n;if(!K(e)){let t=lt(e);for(;t&&!ot(t);){if(G(t)&&!Pt(t))return t;t=lt(t)}return n}let r=Ft(e,t);for(;r&&Xe(r)&&Pt(r);)r=Ft(r,t);return r&&ot(r)&&Pt(r)&&!nt(r)?n:r||rt(e)||n}let Lt=async function(e){let t=this.getOffsetParent||It,n=this.getDimensions,r=await n(e.floating);return{reference:Nt(e.reference,await t(e.floating),e.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rt(e){return st(e).direction===`rtl`}let zt={convertOffsetParentRelativeRectToViewportRelativeRect:St,getDocumentElement:Ke,getClippingRect:jt,getOffsetParent:It,getElementRects:Lt,getClientRects:Ct,getDimensions:Mt,getScale:ht,isElement:G,isRTL:Rt};function Bt(e,t){return e.x===t.x&&e.y===t.y&&e.width===t.width&&e.height===t.height}function Vt(e,t){let n=null,r,i=Ke(e);function a(){var e;clearTimeout(r),(e=n)==null||e.disconnect(),n=null}function o(s,c){s===void 0&&(s=!1),c===void 0&&(c=1),a();let l=e.getBoundingClientRect(),{left:u,top:d,width:f,height:p}=l;if(s||t(),!f||!p)return;let m=z(d),h=z(i.clientWidth-(u+f)),g=z(i.clientHeight-(d+p)),_=z(u),v={rootMargin:-m+`px `+-h+`px `+-g+`px `+-_+`px`,threshold:fe(0,de(1,c))||1},y=!0;function b(t){let n=t[0].intersectionRatio;if(n!==c){if(!y)return o();n?o(!1,n):r=setTimeout(()=>{o(!1,1e-7)},1e3)}n===1&&!Bt(l,e.getBoundingClientRect())&&o(),y=!1}try{n=new IntersectionObserver(b,{...v,root:i.ownerDocument})}catch{n=new IntersectionObserver(b,v)}n.observe(e)}return o(!0),a}function Ht(e,t,n,r){r===void 0&&(r={});let{ancestorScroll:i=!0,ancestorResize:a=!0,elementResize:o=typeof ResizeObserver==`function`,layoutShift:s=typeof IntersectionObserver==`function`,animationFrame:c=!1}=r,l=mt(e),u=i||a?[...l?dt(l):[],...dt(t)]:[];u.forEach(e=>{i&&e.addEventListener(`scroll`,n,{passive:!0}),a&&e.addEventListener(`resize`,n)});let d=l&&s?Vt(l,n):null,f=-1,p=null;o&&(p=new ResizeObserver(e=>{let[r]=e;r&&r.target===l&&p&&(p.unobserve(t),cancelAnimationFrame(f),f=requestAnimationFrame(()=>{var e;(e=p)==null||e.observe(t)})),n()}),l&&!c&&p.observe(l),p.observe(t));let m,h=c?yt(e):null;c&&g();function g(){let t=yt(e);h&&!Bt(h,t)&&n(),h=t,m=requestAnimationFrame(g)}return n(),()=>{var e;u.forEach(e=>{i&&e.removeEventListener(`scroll`,n),a&&e.removeEventListener(`resize`,n)}),d?.(),(e=p)==null||e.disconnect(),p=null,c&&cancelAnimationFrame(m)}}let Ut=He,Wt=Ue,Gt=ze,Kt=Re,qt=(e,t,n)=>{let r=new Map,i={platform:zt,...n},a={...i.platform,_c:r};return Ie(e,t,{...i,platform:a})},Jt=class{constructor(e){n(this,`ctx`),n(this,`enable`,!1),n(this,`contentEl`),n(this,`floatingEl`),n(this,`arrowEl`),this.ctx=e;let{TOOLTIP_BG_COLOR:t,TOOLTIP_TEXT_COLOR:r,TOOLTIP_ZINDEX:i,TOOLTIP_CUSTOM_STYLE:a,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement(`div`),this.arrowEl=document.createElement(`div`),this.floatingEl=document.createElement(`div`),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;let s={display:`none`,position:`absolute`,background:t,color:r,boxSizing:`border-box`,zIndex:i,padding:`8px`,borderRadius:`4px`,fontSize:`12px`,...a},c={position:`absolute`,width:`10px`,height:`10px`,background:s.background,backgroundColor:s.backgroundColor,transform:`rotate(45deg)`,zIndex:s.zIndex};Object.assign(this.arrowEl.style,c),Object.assign(this.floatingEl.style,s),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener(`mouseleave`,()=>{this.hide()}),this.ctx.on(`mouseout`,e=>{this.floatingEl.contains(e.relatedTarget)||this.hide()}),this.ctx.on(`onScroll`,()=>{this.hide()}),this.ctx.on(`startEdit`,()=>{this.hide()}),this.ctx.on(`visibleCellHoverChange`,(e,t)=>{this.floatingEl.contains(t.target)||(e.ellipsis||e.message)&&this.show(e)}),this.ctx.on(`visibleCellMouseleave`,(e,t)=>{this.floatingEl.contains(t.target)||this.hide()}),this.ctx.on(`cellHeaderMouseleave`,(e,t)=>{this.floatingEl.contains(t.target)||this.hide()}),this.ctx.on(`cellHeaderHoverChange`,(e,t)=>{this.floatingEl.contains(t.target)||e.ellipsis&&this.show(e)}),this.ctx.on(`cellFooterMouseleave`,(e,t)=>{this.floatingEl.contains(t.target)||this.hide()}),this.ctx.on(`cellFooterHoverChange`,(e,t)=>{this.floatingEl.contains(t.target)||e.ellipsis&&this.show(e)}),this.ctx.on(`cellShowTooltip`,(e,t)=>{this.show(e,t)}),this.ctx.on(`cellHideTooltip`,()=>{this.hide()})}show(e,t){if(this.ctx.contextMenuIng||!e.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display=`block`;let n=e.getText();e.message&&(n=e.message),t&&(n=t);let r=this.ctx.containerElement.getBoundingClientRect();if(!r)return;this.enable=!0,this.contentEl.style.maxWidth=`${e.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth=`100px`,this.contentEl.style.width=`100%`,this.contentEl.style.display=`inline-block`,this.contentEl.style.wordBreak=`break-all`,this.contentEl.style.lineHeight=`1.5`,this.contentEl.innerText=n;let i=e.drawX+r.x,a=e.drawY+r.y;qt({getBoundingClientRect(){return{width:e.visibleWidth,height:e.visibleHeight,x:i,y:a,left:i,right:i+e.visibleWidth,top:a,bottom:a+e.visibleHeight}}},this.floatingEl,{placement:e.overflowTooltipPlacement,middleware:[Wt(),Gt(),Ut(6),Kt({element:this.arrowEl})]}).then(e=>{let{x:t,y:n,placement:r,middlewareData:i}=e;if(Object.assign(this.floatingEl.style,{top:`${n}px`,left:`${t}px`}),i.arrow){let e=i.arrow;[`left`,`left-start`,`left-end`].includes(r)?Object.assign(this.arrowEl.style,{top:`${e.y}px`,bottom:``,left:``,right:`-5px`}):[`right`,`right-start`,`right-end`].includes(r)?Object.assign(this.arrowEl.style,{top:`${e.y}px`,bottom:``,left:`-5px`,right:``}):[`bottom`,`bottom-start`,`bottom-end`].includes(r)?Object.assign(this.arrowEl.style,{top:`-5px`,bottom:``,left:`${e.x}px`,right:``}):[`top`,`top-start`,`top-end`].includes(r)&&Object.assign(this.arrowEl.style,{top:``,bottom:`-5px`,left:`${e.x}px`,right:``})}})}hide(){this.enable&&(this.enable=!1,this.floatingEl.style.display=`none`)}destroy(){this.contentEl.remove(),this.arrowEl.remove(),this.floatingEl.remove()}};class Yt{constructor(e){n(this,`editorEl`),n(this,`inputEl`),n(this,`enable`,!1),n(this,`cellTarget`,null),n(this,`selectorArrStr`,``),n(this,`ctx`),n(this,`drawY`,0),n(this,`drawX`,0),n(this,`cancel`,!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on(`outsideMousedown`,()=>{this.cellTarget&&this.cellTarget.editorType===`text`&&this.clearEditor()}),this.ctx.on(`moveFocus`,e=>{this.cellTarget=e,this.resetEditorStyle();let{xArr:t,yArr:n}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(n),this.focusInput()}),this.ctx.on(`onScroll`,()=>{this.enable&&this.doneEdit()}),this.ctx.on(`hoverIconClick`,e=>{this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on(`keydown`,e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)return;let{focusCell:t}=this.ctx;if(t.isVerticalVisible()&&t.isHorizontalVisible()||this.ctx.emit(`scrollToIndex`,t.rowIndex,t.colIndex),e.code===`Escape`&&this.ctx.editing){this.cancel=!0;let{focusCell:e}=this.ctx;e&&(this.ctx.emit(`setSelectorCell`,e),this.cellTarget=e),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.key===`Enter`&&this.ctx.editing&&this.inputEl){e.preventDefault();let t=this.inputEl.selectionStart,n=this.inputEl.value.substring(0,t),r=this.inputEl.value.substring(t);this.inputEl.value=n+`
5
+ `+r,this.inputEl.selectionStart=this.inputEl.selectionEnd=t+1,this.autoSize();return}if(e.code===`Tab`&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit(`setMoveFocus`,`LEFT`);return}this.ctx.emit(`setMoveFocus`,`RIGHT`);return}if(e.key===`Enter`&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit(`setMoveFocus`,`TOP`);return}this.ctx.emit(`setMoveFocus`,`BOTTOM`);return}if(e.key===`Enter`&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}let n=e.key,r=e.ctrlKey,i=e.altKey,a=e.shiftKey,o=e.metaKey;if(!(r||i||a||o||`Enter.Escape.Tab.Backspace.Delete.ArrowUp.ArrowDown.ArrowLeft.ArrowRight.Home.End.PageUp.PageDown.Insert.F1.F2.F3.F4.F5.F6.F7.F8.F9.F10.F11.F12`.split(`.`).includes(n))){if(document.activeElement!==this.inputEl){e.preventDefault();return}this.startEdit(!0)}}),this.ctx.on(`cellClick`,e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;let{xArr:t,yArr:n}=this.ctx.selector,r=JSON.stringify(t)+JSON.stringify(n);if(this.focusInput(),this.selectorArrStr===r&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=r,this.doneEdit(),this.cellTarget=e,this.resetEditorStyle(),this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){let{xArr:n,yArr:r}=this.ctx.selector,[i,a]=n,[o,s]=r;return!(t<i||t>a||e<o||e>s)}initTextEditor(){this.inputEl=document.createElement(`textarea`),this.inputEl.id=`e-virt-table-editor-textarea`,this.inputEl.setAttribute(`rows`,`1`),this.inputEl.setAttribute(`tabindex`,`-1`),this.inputEl.addEventListener(`input`,this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className=`e-virt-table-editor-textarea`,this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){if(!this.ctx.editing)return;let e=this.inputEl.value;this.cellTarget&&this.cellTarget.type===`number`&&e!==``&&(this.ctx.emit(`cellHideTooltip`),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit(`cellShowTooltip`,this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height=`auto`;let t=this.inputEl.scrollHeight,n=this.ctx.body.visibleHeight;t>n&&(t=n);let{stageHeight:r,footer:i,header:a,config:{SCROLLER_TRACK_SIZE:o}}=this.ctx,s=r-i.height-o;this.editorEl.style.bottom=`auto`,this.drawY<a.height&&(this.editorEl.style.top=`${a.height-1}px`),this.drawY+t>s&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`auto`,this.editorEl.style.bottom=`${r-s}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){let n=t?null:e.getValue(),{editorType:r}=e;if(r===`none`)return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:i,width:a,drawY:o,drawX:s}=e;this.drawX=s,this.drawY=o;let{config:{CELL_PADDING:c},header:l}=this.ctx,u=this.ctx.body.visibleHeight;i>u&&(i=u),this.editorEl.style.zIndex=`100`,this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY}px`,this.editorEl.style.bottom=`auto`,this.editorEl.style.maxWidth=`none`,this.editorEl.style.maxHeight=`${u}px`,[`text`].includes(r)?(this.inputEl.style.opacity=`1`,this.inputEl.style.position=`relative`,this.inputEl.style.minWidth=`${a-1}px`,this.inputEl.style.minHeight=`${i-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${a}px`,this.inputEl.style.height=`auto`,this.inputEl.style.padding=`${c}px`,this.inputEl.value=``,n!==null&&(this.inputEl.value=n)):(this.inputEl.style.opacity=`0`,this.inputEl.style.width=`1px`,this.inputEl.style.height=`1px`,this.inputEl.style.position=`absolute`,this.inputEl.style.left=`0px`,this.inputEl.style.top=`0px`),(this.inputEl.scrollHeight>i||this.drawY<l.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType===`text`){let{rowKey:e,key:t}=this.cellTarget,n=this.cellTarget.getValue(),r=this.inputEl.value;r!==n&&!(r===``&&n===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,r,!0)}}focusInput(){document.activeElement!==this.inputEl&&this.inputEl.focus({preventScroll:!0})}startEdit(e=!1){this.cancel=!1;let{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;let n=this.ctx.focusCell;if(!n||[`index`,`index-selection`,`selection`].includes(n.type)||this.enable||!(n.isVerticalVisible()&&n.isHorizontalVisible()))return;let{rowKey:r,key:i}=n,a=this.ctx.database.getReadonly(r,i);n&&!a&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=n,this.startEditByInput(this.cellTarget,e),this.ctx.emit(`startEdit`,this.cellTarget),this.ctx.emit(`draw`))}editCell(e,t){let n=this.ctx.body.renderRows.find(t=>t.rowIndex===e);if(!n)return;let r=n.cells.find(e=>e.colIndex===t);if(!r)return;this.ctx.emit(`setSelectorCell`,r);let i=this.ctx.focusCell;if(!i||[`index`,`index-selection`,`selection`].includes(i.type)||this.enable)return;let{rowKey:a,key:o}=i,s=this.ctx.database.getReadonly(a,o);i&&!s&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget),this.ctx.emit(`startEdit`,this.cellTarget),this.ctx.emit(`draw`))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit(`cellHideTooltip`),this.ctx.emit(`doneEdit`,this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.resetEditorStyle(),setTimeout(()=>{this.focusInput()},0),this.ctx.emit(`draw`))}resetEditorStyle(){let e=this.cellTarget;e&&(this.editorEl.style.left=`${e.drawX}px`,this.editorEl.style.top=`${e.drawY}px`,this.editorEl.style.maxWidth=`1px`,this.editorEl.style.maxHeight=`1px`,this.editorEl.style.zIndex=`-1`)}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr=``,this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.inputEl.blur(),this.ctx.emit(`draw`)}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Xt=class{constructor(e){n(this,`ctx`),n(this,`emptyEl`),this.ctx=e;let{EMPTY_TEXT:t,EMPTY_CUSTOM_STYLE:r}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement(`div`),this.emptyEl.innerText=t),this.emptyEl.className=`e-virt-table-empty`,this.emptyEl.style.display=`none`,this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on(`emptyChange`,({type:e,headerHeight:t,bodyHeight:n,footerHeight:i})=>{let a=t+(n+i)/2,o={display:e===`empty`?`block`:`none`,top:`${a}px`,...r};Object.assign(this.emptyEl.style,o)})}destroy(){this.emptyEl.remove()}};class Zt{constructor(e){n(this,`ctx`),n(this,`observer`),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[n,r]of e)if(!t.has(n)||t.get(n)!==r)return!1;return!0}init(){this.observer=new MutationObserver(a(()=>{let e=this.ctx.overlayerElement.querySelectorAll(`[data-auto-height="true"]`),t=new Map;e.forEach(e=>{let n=Number(e.getAttribute(`data-row-index`)),r=Number(e.getAttribute(`data-col-index`));if(isNaN(n)||isNaN(r))return;let i=e.getBoundingClientRect(),a=`${n}​_${r}`;t.set(a,Math.round(i.height))});let n=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(n,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),n.size===0&&t.size===0)return;this.ctx.emit(`draw`)}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute(`data-overlayer`)===`default`&&this.ctx.on(`overlayerChange`,e=>{let t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(e=>{let n=document.createElement(`div`);n.className=e.class,Object.assign(n.style,e.style),e.views.forEach(e=>{let t=document.createElement(`div`);Object.assign(t.style,e.style),e.cells.forEach(e=>{let n=document.createElement(`div`);Object.assign(n.style,e.style),Object.keys(e.domDataset).forEach(t=>{n.setAttribute(t,e.domDataset[t])}),typeof e.render==`function`&&e.render(n,e),t.appendChild(n)}),n.appendChild(t)}),t.appendChild(n)})})}draw(){let e=this.getContainer();this.ctx.emit(`overlayerChange`,e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit(`overlayerChange`,{style:{},views:[]})}getContainer(){let e=this.getHeader(),t=this.getBody(),n=this.getFooter(),r=[],{FOOTER_FIXED:i,FOOTER_POSITION:a}=this.ctx.config;return r=i?a===`top`?[e,n,t]:[e,t,n]:[e,t],{views:r}}getHeader(){let{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:r}}=this.ctx,{visibleWidth:i,visibleHeight:a,renderCellHeaders:o}=this.ctx.header,s=[],c=[],l=[];o.forEach(e=>{e.render&&(e.fixed===`left`?c.push(e):e.fixed===`right`?l.push(e):s.push(e))});let u=t-n,d={key:`left`,style:{position:`absolute`,top:`0px`,left:`0px`,overflow:`hidden`,width:`${e}px`,height:`${a}px`},cells:c},f={key:`center`,style:{position:`absolute`,top:`0px`,left:`${e}px`,overflow:`hidden`,width:`${i-e-u+1}px`,height:`${a}px`},cells:s},p={key:`right`,style:{position:`absolute`,top:`0px`,right:`0px`,overflow:`hidden`,width:`${u+1}px`,height:`${a}px`},cells:l};return{type:`header`,class:`${r}-overlayer-header`,style:{position:`relative`,overflow:`hidden`,width:`${i}px`,height:`${a}px`},views:[d,f,p]}}getBody(){let e=[],t=[],n=[],r=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(r=r.concat(this.ctx.footer.renderRows)),r.forEach(r=>{r.cells.forEach(r=>{r.cellType===`footer`&&(r.render=r.renderFooter),r.render&&(r.fixed===`left`?t.push(r):r.fixed===`right`?n.push(r):e.push(r))})});let{fixedLeftWidth:i,fixedRightWidth:a,config:{SCROLLER_TRACK_SIZE:o,CSS_PREFIX:s}}=this.ctx,{visibleWidth:c,visibleHeight:l}=this.ctx.body,u=a-o,d={key:`left`,style:{position:`absolute`,top:`0.5px`,left:`0.5px`,overflow:`hidden`,width:`${i}px`,height:`${l}px`},cells:t},f={key:`center`,style:{position:`absolute`,top:`0.5px`,left:`${i-.5}px`,overflow:`hidden`,width:`${c-i-u}px`,height:`${l}px`},cells:e},p={key:`right`,style:{position:`absolute`,top:`0px`,right:`0px`,overflow:`hidden`,width:`${u}px`,height:`${l}px`},cells:n};return{type:`body`,class:`${s}-overlayer-body`,style:{position:`relative`,overflow:`hidden`,width:`${c}px`,height:`${l}px`},views:[d,f,p]}}getFooter(){let e=[],t=[],n=[];this.ctx.footer.renderRows.forEach(r=>{r.cells.forEach(r=>{r.cellType===`footer`&&r.renderFooter&&(r.render=r.renderFooter,r.fixed===`left`?t.push(r):r.fixed===`right`?n.push(r):e.push(r))})});let{fixedLeftWidth:r,fixedRightWidth:i,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:o}}=this.ctx,{visibleWidth:s,visibleHeight:c}=this.ctx.footer,l=i-a,u={key:`left`,style:{position:`absolute`,top:`0.5px`,left:`0.5px`,overflow:`hidden`,width:`${r}px`,height:`${c}px`},cells:t},d={key:`center`,style:{position:`absolute`,top:`0.5px`,left:`${r-.5}px`,overflow:`hidden`,width:`${s-r-l}px`,height:`${c}px`},cells:e},f={key:`right`,style:{position:`absolute`,top:`0.5px`,right:`0.5px`,overflow:`hidden`,width:`${l}px`,height:`${c}px`},cells:n};return{type:`footer`,class:`${o}-overlayer-footer`,style:{position:`relative`,overflow:`hidden`,width:`${s}px`,height:`${c}px`},views:[u,d,f]}}}class Qt{constructor(e,t=[],r={}){n(this,`container`),n(this,`menuData`),n(this,`onClick`),n(this,`activeSubmenus`,new Set),n(this,`boundMouseEnterHandler`),n(this,`boundMouseLeaveHandler`),n(this,`boundClickHandler`),this.container=e,this.menuData=t,this.onClick=r.onClick,this.boundMouseEnterHandler=e=>this.handleMouseEvent(e,`enter`),this.boundMouseLeaveHandler=e=>this.handleMouseEvent(e,`leave`),this.boundClickHandler=e=>this.handleClick(e),this.createMenu(),this.bindEvents()}createMenu(){this.container.className=`e-virt-table-main-menu`,this.container.style.display=`block`;let e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var n;let r=this.createElement(`div`,t?`e-virt-table-submenu-item`:`e-virt-table-menu-item`);r.setAttribute(t?`data-submenu`:`data-menu`,e.value),e.disabled&&r.classList.add(`disabled`);let i=this.createElement(`div`,`e-virt-table-menu-item-content`);if(e.icon){let t=this.createElement(`span`,`e-virt-table-menu-item-icon`);t.innerHTML=e.icon,i.appendChild(t)}else i.classList.add(`menu-item-no-icon`);let a=this.createElement(`span`,`e-virt-table-menu-item-text`);if(a.textContent=e.label,i.appendChild(a),r.appendChild(i),(n=e.children)!=null&&n.length){let t=this.createElement(`span`,`e-virt-table-menu-arrow`);t.innerHTML=j,r.appendChild(t);let n=this.createSubmenu(e.children);r._submenu=n,this.container.appendChild(n)}return r}createSubmenu(e){let t=this.createElement(`div`,`e-virt-table-submenu`);return e.forEach(e=>{t.appendChild(this.createMenuItem(e,!0))}),t}createElement(e,t=``){let n=document.createElement(e);return t&&(n.className=t),n}bindEvents(){this.container.addEventListener(`mouseenter`,this.boundMouseEnterHandler,!0),this.container.addEventListener(`mouseleave`,this.boundMouseLeaveHandler,!0),this.container.addEventListener(`click`,this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();let n=e.target.closest(`.e-virt-table-menu-item, .e-virt-table-submenu-item`);n&&(this.container.contains(n)||n.classList.contains(`e-virt-table-submenu-item`))&&(t===`enter`?this.handleHover(n):this.handleLeave(n))}handleHover(e){e.classList.contains(`e-virt-table-menu-item`)&&(this.container.querySelectorAll(`.e-virt-table-menu-item`).forEach(e=>e.classList.remove(`active`)),e.classList.contains(`disabled`)||e.classList.add(`active`));let t=e._submenu||e.querySelector(`.e-virt-table-submenu`);t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){let t=e._submenu||e.querySelector(`.e-virt-table-submenu`);setTimeout(()=>{let n=t;n&&!n.matches(`:hover`)&&!e.matches(`:hover`)&&(this.hideSubmenu(n),e.classList.contains(`e-virt-table-menu-item`)&&e.classList.remove(`active`))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains(`e-virt-table-menu-item`))t=this.container.querySelectorAll(`.e-virt-table-menu-item`);else{let n=e.closest(`.e-virt-table-submenu`);if(n)t=n.querySelectorAll(`.e-virt-table-submenu-item`);else return}t.forEach(t=>{t!==e&&t._submenu&&this.hideSubmenu(t._submenu)})}async showSubmenu(e,t){this.activeSubmenus.has(t)||(this.activeSubmenus.add(t),t.classList.add(`show`),t._cleanup=Ht(e,t,async()=>{let n=this.container.getBoundingClientRect(),r=window.innerWidth,i=t.offsetWidth||200,a=r-n.right,o=n.left,{x:s,y:c}=await qt(e,t,{placement:a>=i||a>=o?`right-start`:`left-start`,middleware:[Ut(8),Wt({padding:8})]});Object.assign(t.style,{left:`${s}px`,top:`${c}px`})}))}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove(`show`),this.hideAllChildSubmenus(e);let t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(`.e-virt-table-submenu-item`).forEach(e=>{if(e._submenu){let t=e._submenu;if(this.activeSubmenus.has(t)){this.activeSubmenus.delete(t),t.classList.remove(`show`);let e=t;e._cleanup&&(e._cleanup(),delete e._cleanup),this.hideAllChildSubmenus(t)}}})}handleClick(e){e.stopPropagation();let t=e.target.closest(`.e-virt-table-menu-item, .e-virt-table-submenu-item`);if(!t||t.classList.contains(`disabled`))return;if(t.classList.contains(`e-virt-table-menu-item`)){let e=t._submenu||t.querySelector(`.e-virt-table-submenu`);if(e){this.showSubmenu(t,e);return}}let n=t.getAttribute(`data-menu`)||t?.getAttribute(`data-submenu`),r=this.findMenuItem(n||``);r&&(r.event&&r.event(e,this.hide.bind(this)),this.onClick&&this.onClick(r,n||``))}findMenuItem(e,t=this.menuData){for(let n of t){if(n.value===e)return n;if(n.children){let t=this.findMenuItem(e,n.children);if(t)return t}}return null}positionMenu(e){let t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};Ht(t,this.container,()=>{qt(t,this.container,{placement:`right-start`,middleware:[Ut(),Wt(),Gt()]}).then(({x:e,y:t})=>{this.container&&Object.assign(this.container.style,{left:`${e}px`,top:`${t}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display=`none`}destroy(){this.container.removeEventListener(`mouseenter`,this.boundMouseEnterHandler,!0),this.container.removeEventListener(`mouseleave`,this.boundMouseLeaveHandler,!0),this.container.removeEventListener(`click`,this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display=`none`,this.container.replaceChildren()}removeMenuItem(e){let t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;let n=t.querySelector(`.e-virt-table-submenu`);return n&&this.cleanupSubmenuRecursively(n),t.remove(),!0}removeSubMenuItem(e){let t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;let n=t.closest(`.e-virt-table-submenu`),r=t._submenu;if(r&&this.cleanupSubmenuRecursively(r),t.remove(),n&&n.querySelectorAll(`.e-virt-table-submenu-item`).length===0){let e=this.container.querySelector(`[data-menu]`);if(e&&e._submenu===n)this.removeMenuItem(e.getAttribute(`data-menu`)||``);else{let e=this.container.querySelectorAll(`[data-menu], [data-submenu]`);for(let t of e)if(t._submenu===n){let e=t.getAttribute(`data-menu`)||t.getAttribute(`data-submenu`);e&&(t.hasAttribute(`data-menu`)?this.removeMenuItem(e):this.removeSubMenuItem(e));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(`.e-virt-table-menu-item`).forEach(e=>{e._submenu&&=(this.cleanupSubmenuRecursively(e._submenu),void 0)})}cleanupSubmenuRecursively(e){let t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(`.e-virt-table-submenu-item`).forEach(e=>{e._submenu&&this.cleanupSubmenuRecursively(e._submenu)}),e.remove()}}class $t{constructor(e){n(this,`ctx`),n(this,`contextMenuEl`),n(this,`currentDOMTreeMenu`),n(this,`isCustom`,!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className=`e-virt-table-main-menu`,this.isCustom=!0):(this.contextMenuEl=document.createElement(`div`),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on(`outsideMousedown`,()=>{this.hide()}),this.ctx.on(`cellContextMenuClick`,(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display=`block`,this.positionMenu(t);return}let{ENABLE_CONTEXT_MENU:n,CUSTOM_BODY_CONTEXT_MENU:r,CONTEXT_MENU:i}=this.ctx.config,a=[...i,...r];if(!n||a.length===0)return;t.preventDefault();let{xArr:o,yArr:s}=this.ctx.selector,[c,l]=o,[u,d]=s,{rowIndex:f,colIndex:p}=e;f>=u&&f<=d&&p>=c&&p<=l||this.ctx.emit(`setSelectorCell`,e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Qt(this.contextMenuEl,a,{onClick:(e,t)=>{t===`copy`?(this.ctx.emit(`contextMenuCopy`),this.hide()):t===`paste`?(this.ctx.emit(`contextMenuPaste`),this.hide()):t===`cut`?(this.ctx.emit(`contextMenuCut`),this.hide()):t===`clearSelected`&&(this.ctx.emit(`contextMenuClearSelected`),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on(`cellHeaderContextMenuClick`,(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display=`block`,this.positionMenu(t);return}let{SELECTOR_AREA_MIN_X:n,SELECTOR_AREA_MAX_X:r,SELECTOR_AREA_MAX_X_OFFSET:i}=this.ctx.config,a=n,o=r||this.ctx.maxColIndex-i;if(e.colIndex<a||e.colIndex>o)return;let{HEADER_CONTEXT_MENU:s,CUSTOM_HEADER_CONTEXT_MENU:c,ENABLE_HEADER_CONTEXT_MENU:u}=this.ctx.config,d=[...s,...c];if(!u||d.length===0)return;t.preventDefault();let{xArr:f}=this.ctx.selector,[p,m]=f,{colIndex:h}=e;h>=p&&h<=m||(this.ctx.focusCellHeader=e,this.ctx.emit(`selectCols`,e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();let g=this.ctx.database.getColumns(),_=d.map(e=>e.value===`visible`?{...e,children:this.filterColumns(g)}:e);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Qt(this.contextMenuEl,_,{onClick:(e,t)=>{let{xArr:n}=this.ctx.selector,[r,i]=n;if(t===`fixedLeft`||t===`fixedRight`||t===`fixedNone`){let e=this.ctx.header.allCellHeaders.filter(e=>e.colIndex>=r&&e.colIndex<=i).filter(e=>e.level===0).filter(e=>!e.column.fixedDisabled).map(e=>e.key);this.ctx.database.setCustomHeaderFixedData(e,t===`fixedLeft`?`left`:t===`fixedRight`?`right`:``),this.hide()}else if(t===`hide`){let e=this.ctx.header.leafCellHeaders.filter(e=>e.colIndex>=r&&e.colIndex<=i).filter(e=>!e.children.length).filter(e=>!e.column.hideDisabled).map(e=>e.key);e.length>0&&this.ctx.database.setCustomHeaderHideData(e,!0),this.hide()}else if(t!==`visible`)if(t.startsWith(`visible_`)){if(!e.key)return;if(e.children){let t=this.getLeafKeys(e.children);this.ctx.database.setCustomHeaderHideData(t,!1)}else this.ctx.database.setCustomHeaderHideData([e.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(t),l(this.ctx.database.getColumns()).filter(e=>e.hide).length===0&&this.hide()}else t===`resetHeader`&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on(`click`,()=>{this.hide()}),this.ctx.on(`onScroll`,this.hide.bind(this)),this.ctx.on(`resize`,this.hide.bind(this))}positionMenu(e){let t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};Ht(t,this.contextMenuEl,()=>{qt(t,this.contextMenuEl,{placement:`right-start`,middleware:[Ut(),Wt(),Gt()]}).then(({x:e,y:t})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${e}px`,top:`${t}px`})})})}filterColumns(e){let t=[];for(let n of e)if(n.children&&n.children.length>0){let e=this.filterColumns(n.children);e.length>0&&t.push({label:n.title,key:n.key,value:`visible_${n.key}`,children:e})}else n.hide&&t.push({label:n.title,value:`visible_${n.key}`,key:n.key});return t}getLeafKeys(e){return e.reduce((e,t)=>(!t.children||t.children.length===0?e.push(String(t.key)):e.push(...this.getLeafKeys(t.children)),e),[])}hide(){this.currentDOMTreeMenu&&=(this.currentDOMTreeMenu.destroy(),void 0),this.contextMenuEl.style.display=`none`,this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class en{constructor(e){if(n(this,`ctx`),n(this,`loadingEl`),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement(`div`);let e=document.createElement(`div`);e.className=`e-virt-table-loading-spinner`;let t=this.ctx.icons.getSvg(`loading`);if(t){let n=new DOMParser().parseFromString(t.svg,`image/svg+xml`).documentElement;e.appendChild(n)}let n=document.createElement(`p`);n.className=`e-virt-table-loading-text`,n.innerText=this.ctx.config.LOADING_TEXT,e.appendChild(n),this.loadingEl.appendChild(e)}this.loadingEl.className=`e-virt-table-loading`,this.loadingEl.style.display=`none`,this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display=`flex`}hide(){this.loadingEl.style.display=`none`}destroy(){this.loadingEl.remove()}}class tn{constructor(e){n(this,`ctx`),n(this,`container`),n(this,`input`),n(this,`prevBtn`),n(this,`nextBtn`),n(this,`closeBtn`),n(this,`countEl`),n(this,`loadingEl`),n(this,`isVisible`,!1),n(this,`searchResults`,[]),n(this,`currentIndex`,-1),n(this,`searchData`,[]),n(this,`isComposing`,!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on(`keydown`,e=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((e.ctrlKey||e.metaKey)&&e.code===`KeyF`){e.preventDefault(),this.show();return}if(this.ctx.finding){if(e.code===`Escape`){e.preventDefault(),this.hide();return}if(e.code===`ArrowUp`||e.shiftKey&&e.key===`Enter`){e.preventDefault(),this.navigatePrevious();return}if(e.code===`ArrowDown`||e.key===`Enter`){e.preventDefault(),this.navigateNext();return}}}}),this.ctx.on(`setSelector`,()=>{this.hide()}),this.ctx.on(`outsideMousedown`,()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{let{allCellHeaders:e}=this.ctx.header;for(let t=0;t<e.length;t++){let n=e[t];n&&[`string`,`number`].includes(typeof n.text)&&this.searchData.push({rowIndex:0,colIndex:n.colIndex,text:`${n.text}`,type:`header`,colKey:n.key})}let{maxColIndex:t,maxRowIndex:n}=this.ctx;for(let e=0;e<n;e++)for(let n=0;n<t;n++){let t=this.ctx.database.getVirtualBodyCell(e,n,!1)?.getText();[`string`,`number`].includes(typeof t)&&this.searchData.push({rowIndex:e,colIndex:n,text:`${t}`,type:`body`})}this.hideLoading()},0)}createContainer(){let e=document.createElement(`div`);e.className=`e-virt-table-finder-bar`;let t=document.createElement(`div`);t.className=`e-virt-table-finder-bar-input-wrapper`,this.input=document.createElement(`input`),this.input.type=`text`,this.input.className=`e-virt-table-finder-bar-input`,this.input.placeholder=``,t.appendChild(this.input),this.loadingEl=document.createElement(`div`),this.loadingEl.className=`e-virt-table-finder-bar-loading`,this.loadingEl.innerHTML=`<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>`,t.appendChild(this.loadingEl),this.countEl=document.createElement(`span`),this.countEl.className=`e-virt-table-finder-bar-count`;let n=document.createElement(`div`);return n.className=`e-virt-table-finder-bar-nav`,this.prevBtn=document.createElement(`button`),this.prevBtn.className=`e-virt-table-finder-bar-nav-btn prev-btn`,this.prevBtn.innerHTML=j,this.nextBtn=document.createElement(`button`),this.nextBtn.className=`e-virt-table-finder-bar-nav-btn next-btn`,this.nextBtn.innerHTML=j,n.appendChild(this.prevBtn),n.appendChild(this.nextBtn),this.closeBtn=document.createElement(`button`),this.closeBtn.className=`e-virt-table-finder-bar-nav-btn close-btn`,this.closeBtn.innerHTML=`×`,e.appendChild(t),e.appendChild(this.countEl),e.appendChild(n),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener(`input`,()=>{this.isComposing||this.performSearch()}),this.input.addEventListener(`compositionstart`,()=>{this.isComposing=!0}),this.input.addEventListener(`compositionend`,()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener(`click`,()=>{this.navigatePrevious()}),this.nextBtn.addEventListener(`click`,()=>{this.navigateNext()}),this.closeBtn.addEventListener(`click`,()=>{this.hide()})}performSearch(){let e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;let e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;let{rowIndex:t,colIndex:n}=e;this.ctx.emit(`scrollToIndex`,t,n)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent=`0/0`,this.countEl.classList.add(`no-results`)):(this.countEl.textContent=``,this.countEl.classList.remove(`no-results`));else{let e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove(`no-results`)}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add(`show`),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add(`show`),(e=this.loadingEl.parentElement)==null||e.classList.add(`loading`),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove(`show`),(e=this.loadingEl.parentElement)==null||e.classList.remove(`loading`),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:``,type:`header`},this.ctx.emit(`draw`)}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove(`show`),this.ctx.finding=!1,this.input.value=``,this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:``,type:`header`},this.updateCount(),this.ctx.emit(`draw`))}destroy(){this.hide(),this.container.remove()}}class nn{constructor(e,t){n(this,`options`),n(this,`scroller`),n(this,`header`),n(this,`body`),n(this,`footer`),n(this,`selector`),n(this,`autofill`),n(this,`tooltip`),n(this,`editor`),n(this,`empty`),n(this,`overlayer`),n(this,`contextMenu`),n(this,`loading`),n(this,`finderBar`),n(this,`animationFrameId`),n(this,`ctx`),this.options=t;let{overlayerElement:r,editorElement:i,emptyElement:a,contextMenuElement:o}=this.options;this.ctx=new ie(this.createContainer(e,r,i,a,o),this.options),this.header=new I(this.ctx),this.footer=new ce(this.ctx),this.body=new R(this.ctx),this.scroller=new oe(this.ctx),this.selector=new le(this.ctx),this.autofill=new ue(this.ctx),this.tooltip=new Jt(this.ctx),this.empty=new Xt(this.ctx),this.editor=new Yt(this.ctx),this.overlayer=new Zt(this.ctx),this.contextMenu=new $t(this.ctx),this.loading=new en(this.ctx),this.finderBar=new tn(this.ctx),this.ctx.on(`draw`,()=>{this.draw()}),this.ctx.on(`drawView`,()=>{this.draw(!0)}),this.draw()}createContainer(e,t,n,r,i){e.className=`e-virt-table-container`;let a=document.createElement(`div`),o=document.createElement(`canvas`),s=t||document.createElement(`div`);a.className=`e-virt-table-stage`,e.tabIndex=0,o.className=`e-virt-table-canvas`,s.className=`e-virt-table-overlayer`,s.setAttribute(`data-overlayer`,t?`custom`:`default`);let c=n||document.createElement(`div`);c.className=`e-virt-table-editor`;let l=r,u=i;return a.appendChild(o),a.appendChild(s),e.appendChild(a),{containerElement:e,stageElement:a,canvasElement:o,overlayerElement:s,editorElement:c,emptyElement:l,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit(`draw`)}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit(`draw`)}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit(`draw`)}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit(`draw`)}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit(`draw`)}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit(`draw`)}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit(`draw`)}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit(`draw`)}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,n,r=!0,i=!0,a=!1){this.ctx.database.setItemValue(e,t,n,r,i,a)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,n,r=!0,i=!0){this.ctx.setItemValueByEditor(e,t,n,r,i),this.editor.doneEdit()}clearEditableData(e=null){let t=[0,this.ctx.maxColIndex],n=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,n,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit(`draw`)}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit(`draw`)}setCurrentRow(e){let t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit(`draw`))}getCurrentRow(){let e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit(`draw`)}validateFields(e,t=!0){return new Promise(async(n,r)=>{let i=[];for(let t=0;t<e.length;t++){let{rowKey:n,key:r}=e[t],a=await this.ctx.database.getValidator(n,r);Array.isArray(a)&&a.length&&i.push(a)}if(i.length){if(r(i),t){let[e]=i;if(Array.isArray(e)&&e.length){let[t]=e,{rowKey:n,key:r}=t;this.scrollToRowkey(n),this.scrollToColkey(r)}}this.ctx.emit(`draw`)}else n([]),this.ctx.emit(`draw`)})}async validate(e=!0){return new Promise(async(t,n)=>{try{t(await this.getValidations())}catch(t){if(e&&Array.isArray(t)&&t.length){let[e]=t;if(Array.isArray(e)&&e.length){let[t]=e,{rowKey:n,key:r}=t,i=this.ctx.database.getRowForRowKey(n);if(i){let{parentRowKeys:e=[]}=i;e&&e.length&&this.setExpandRowKeys(e,!0)}this.scrollToRowkey(n),this.scrollToColkey(r)}}n(t)}})}setValidations(e){if(e.forEach(e=>{let{rowIndex:t,key:n,message:r,rowKey:i}=e;if(t!==void 0&&i===void 0){let e=this.ctx.database.getRowKeyForRowIndex(t);this.ctx.database.setValidationErrorByRowKey(e,n,r)}i&&this.ctx.database.setValidationErrorByRowKey(i,n,r)}),e&&Array.isArray(e)&&e.length){let[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){let{rowIndex:e,key:n}=t;this.scrollToRowIndex(e),this.scrollToColkey(n)}}}getValidations(){return this.ctx.config.DISABLED?new Promise(e=>{e([])}):new Promise(async(e,t)=>{let n=this.ctx.database.getAllRowsData(),r=this.ctx.header.leafCellHeaders,i=[];for(let e=0;e<n.length;e++)for(let t=0;t<r.length;t++){let a=this.ctx.database.getRowKeyByItem(n[e]),o=r[t].key,s=await this.ctx.database.getValidator(a,o);Array.isArray(s)&&s.length&&i.push(s)}i.length?(t(i),this.ctx.emit(`draw`)):(e([]),this.ctx.emit(`draw`))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit(`draw`)}toggleRowSelection(e){let t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit(`draw`)}setSelectionByRows(e,t=!0){e.forEach(e=>{let n=this.ctx.database.getRowKeyByItem(e);this.ctx.database.setRowSelection(n,t,!1)}),this.ctx.emit(`selectionChange`,this.getSelectionRows()),this.ctx.emit(`draw`)}setSelectionByRowKeys(e,t=!0){e.forEach(e=>{this.ctx.database.setRowSelection(e,t,!1)}),this.ctx.emit(`selectionChange`,this.getSelectionRows()),this.ctx.emit(`draw`)}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit(`draw`)}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit(`draw`)}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit(`draw`)}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:y,mergeRowCell:v,getSpanArrByRow:g,getSpanObjByColumn:_}}getColumnByKey(e){return this.ctx.database.getColumnByKey(e)?.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit(`draw`)}getReadonly(e,t){return this.ctx.database.getReadonly(e,t)}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}return nn})}))(),1),Hi=(0,l.defineComponent)((e,{emit:t})=>{let{cellRender:n,renderTableParams:r}=e,{row:i,field:a}=r;if(a){let e=(0,l.ref)(i[a]);return()=>yi.renders[n.name]?.renderEdit?.(e,n,r,t)??null}else return()=>null},{name:`RenderEditCell`,props:[`cellRender`,`renderTableParams`],emits:[`blur`]}),Ui=(0,l.defineComponent)({__name:`PCanvasTable`,props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:[`change`,`selectionChange`,`ready`],setup(e,{expose:t,emit:n}){let r=n,i=(0,l.ref)([]),a=e,o=qr(),s=(0,l.computed)(()=>({...a,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...o,...a.config}})),c=null,u=(0,l.useAttrs)(),d=(0,l.ref)(null),f=(0,l.ref)(null),p=(0,l.ref)(null),m=(0,l.ref)(null),h=(0,l.ref)(),g=(0,l.ref)(`text`),_=(0,l.ref)(),v={},y={},b=(0,l.computed)(()=>{let e=h.value;return e?{width:`${e.width}px`,height:`${e.height}px`}:{}}),x=e=>ii[e]||(({cellValue:e})=>e),S=e=>yi.renders[e]?.renderDefault,C=(e,...t)=>({row:n,rowIndex:r,value:i})=>e({row:n,rowIndex:r,cellValue:i},...t),w=e=>{if(e.slots?.default&&(0,Z.isFunction)(e.slots?.default))return t=>e.slots?.default?.({row:t.row,column:e,rowIndex:t.rowIndex});if(e.slots?.default&&(0,Z.isString)(e.slots?.default))return`slot:${e.slots?.default}`;if(e.cellRender&&e.cellRender.name)return t=>S(e.cellRender.name)?.(e.cellRender,{data:a.data,row:t.row,rowIndex:t.rowIndex,field:e.field||t.column.key,title:t.column?.title??``},{})},T=e=>{if(e.slots?.title&&(0,Z.isFunction)(e.slots?.title))return t=>e.slots?.title?.({column:e})},E=e=>(e.slots?.edit&&(e.field||e.key)&&(0,Z.isFunction)(e.slots?.edit)?v[`__slot:${e.field||e.key}`]=e:e.editRender?.name&&(e.field||e.key)&&(y[e.field||e.key]=e.editRender),{...(0,Z.omit)(e,[`formatter`]),key:e.key||e.field||Pr(),formatter:(0,Z.isString)(e.formatter)?C(x(e.formatter)):(0,Z.isArray)(e.formatter)&&(0,Z.isString)(e.formatter[0])?C(x(e.formatter[0]),...e.formatter.slice(1)):(0,Z.isFunction)(e.formatter)?C(e.formatter):void 0,editorType:e.editorType??(e.slots?.edit&&(e.field||e.key)&&(0,Z.isFunction)(e.slots?.edit)?`__slot:${e.field||e.key}`:e.editRender?.name?e.editRender.name:void 0),render:w(e),renderHeader:T(e),children:e.children?.map(e=>E(e))});(0,l.onMounted)(()=>{d.value&&(c=new Vi.default(d.value,{config:s.value.config,columns:a.columns.map(e=>E(e)),data:a.data,footerData:a.footerData,emptyElement:p.value||void 0,overlayerElement:m.value||void 0,editorElement:f.value||void 0}),Object.keys(u).forEach(e=>{let t=u[e];if(typeof t==`function`&&e.startsWith(`on`)){let n=e.charAt(2).toLowerCase()+e.slice(3);c?.on(n,t)}}),c.on(`change`,e=>{r(`change`,e)}),c.on(`overlayerChange`,e=>{_.value=e,console.log(`overlayerChange`,e)}),c.on(`startEdit`,e=>{h.value=e,g.value=e.editorType,g.value}),c.on(`doneEdit`,()=>{g.value=`text`}),c.on(`selectionChange`,e=>{i.value=e,r(`selectionChange`,e)}),r(`ready`,c))});function D(e){if(!c||!h.value)return;let{rowKey:t,key:n}=h.value;c?.setItemValueByEditor(t,n,e)}let O=()=>document.body;return(0,l.watch)(()=>a.data,e=>{c?.loadData(e)},{deep:!0}),ni(()=>a.columns,(e,t)=>{(0,Z.isEqual)(e,t)||c?.loadColumns(e.map(e=>E(e)))},{deep:!0}),(0,l.watch)(()=>s.value.config,e=>{c?.loadConfig(e)},{deep:!0}),(0,l.watch)(()=>a.footerData,e=>{c?.loadFooterData(e||[])},{deep:!0}),(0,l.watch)(()=>a.loading,(e,t)=>{e!==t&&c?.setLoading(e)},{immediate:!0}),t({$table:c,selectedRecords:(0,l.computed)(()=>i.value),reloadData:()=>{c?.loadData(a.data)}}),(t,n)=>{let r=(0,l.resolveComponent)(`a-empty`),i=(0,l.resolveComponent)(`a-spin`);return(0,l.openBlock)(),(0,l.createBlock)(i,{spinning:e.loading},{default:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,{ref_key:`eVirtTableRef`,ref:d},[(0,l.createElementVNode)(`div`,{ref_key:`eVirtTableEditorRef`,ref:f},[g.value.startsWith(`__slot:`)?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(v[g.value].slots.edit({row:h.value.row,column:v[g.value],rowIndex:h.value.rowIndex})),{key:0,bordered:!1,style:(0,l.normalizeStyle)(b.value),class:`ev-editor-wrapper`,"get-popup-container":O,value:h.value.value,"onUpdate:value":n[0]||=e=>h.value.value=e,cell:h.value,onBlur:D},null,40,[`style`,`value`,`cell`])):(0,l.unref)(yi).renders[g.value]?.renderEdit?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(Hi),{key:1,"cell-render":y[h.value.key],class:`ev-editor-wrapper`,style:(0,l.normalizeStyle)(b.value),"render-table-params":{data:a.data,row:h.value?.row,rowIndex:h.value?.rowIndex??-1,field:h.value?.key??``,title:h.value?.column?.title??``},bordered:!1,"get-popup-container":O,onBlur:D},null,8,[`cell-render`,`style`,`render-table-params`])):(0,l.createCommentVNode)(``,!0)],512),(0,l.createElementVNode)(`div`,{ref_key:`eVirtTableEmptyRef`,ref:p},[(0,l.renderSlot)(t.$slots,`empty`,{},()=>[(0,l.createVNode)(r,{description:`空数据`})])],512),(0,l.createElementVNode)(`div`,{ref_key:`eVirtTableOverlayerRef`,ref:m},[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(_.value?.views||[],e=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,{class:(0,l.normalizeClass)(e.class),style:(0,l.normalizeStyle)(e.style),key:e.type},[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(e.views,e=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,{style:(0,l.normalizeStyle)(e.style),key:e.key},[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(e.cells,e=>((0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({class:`canvas-cell`,key:`${e.rowKey}_${e.key}`,style:{...e.style}},{ref_for:!0},e.domDataset),[typeof e.render==`function`?((0,l.openBlock)(),(0,l.createBlock)((0,l.resolveDynamicComponent)(e.render(e)),{key:0,bordered:!1})):typeof e.render==`string`&&e.render.startsWith(`slot:`)?(0,l.renderSlot)(t.$slots,e.render.replace(`slot:`,``),(0,l.mergeProps)({key:1,ref_for:!0},e,{cell:e})):(0,l.createCommentVNode)(``,!0)],16))),128))],4))),128))],6))),128))],512)],512)]),_:3},8,[`spinning`])}}}),Wi={key:0},Gi={key:1,class:`p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px`},Ki={class:`flex items-center flex-1 gap-4px`},qi={key:2},Ji={class:`flex items-center gap-4px`},Yi={key:0,class:`w-full text-slate-5 pl-4`},Xi=(0,l.defineComponent)({__name:`PCanvasGrid`,props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>Kr().lazyReset??!1},fitHeight:{default:()=>Kr().fitCanvasHeight??100}},emits:[`toolbarButtonClick`,`toolbarToolClick`,`pick`,`resetQuery`],setup(e,{expose:t,emit:n}){let r=e,i=(0,l.useAttrs)(),a=n,{formConfig:o,pageConfig:s,columns:c,toolbarConfig:f,proxyConfig:p,config:m,staticConfig:h}=(0,l.toRefs)(r),g=qr(),_=(0,l.ref)(Pr()),v=(0,l.ref)({}),y=(0,l.computed)(()=>({...r,config:{...g,...r.config}})),b=(0,l.computed)(()=>p.value&&p.value.ajax?s.value?`pagination`:`list`:`bad`);(0,l.computed)(()=>b.value===`pagination`?{current:C.page,total:T.value,pageSize:C.size,responsive:!1,showSizeChanger:!0,showTotal:e=>`共${e}条数据`}:!1);let x=(0,l.computed)(()=>(0,Z.omit)({labelCol:Zr,...o.value},[`items`])),S=(0,l.reactive)({toolbar:!1,form:!1,table:!1}),C=(0,l.reactive)({page:1,size:s.value?.pageSize??10}),w=(0,l.ref)(0),T=(0,l.ref)(0),E=(0,l.ref)([]),D=(0,l.ref)(),O=(0,l.ref)(),k=(0,l.ref)(),A=(0,l.ref)(),j=(0,l.ref)(),M=(0,l.ref)(500),N=(0,l.ref)({}),ee=e=>{N.value[C.page]=e},P=(0,l.reactive)([...(r.toolbarConfig?.buttons?.map(e=>e.code)??[]).filter(e=>e),...(r.toolbarConfig?.tools?.map(e=>e.code)??[]).filter(e=>e)].reduce((e,t)=>(e[t]=!1,e),{})),te=(e,t)=>{P[e]=t},F=e=>{(0,Z.isObject)(e)?(Object.prototype.hasOwnProperty.call(e,`toolbar`)&&(S.toolbar=e.toolbar),Object.prototype.hasOwnProperty.call(e,`form`)&&(S.form=e.form),Object.prototype.hasOwnProperty.call(e,`table`)&&(S.table=e.table)):(0,Z.isBoolean)(e)&&(S.form=e,S.toolbar=e,S.table=e)},ne=(0,l.computed)(()=>(0,Z.uniq)(Object.values(N.value).flat(),e=>e[y.value.config?.ROW_KEY??`id`])),re=()=>{ce()},ie=(0,l.computed)(()=>ne.value.map(e=>e[y.value.config?.ROW_KEY??`id`])),ae=(e,t)=>t?{list:(0,Z.isString)(t.list)?(0,Z.get)(e,t.list):(0,Z.isFunction)(t.list)?t.list(e):void 0,total:(0,Z.isString)(t.total)?(0,Z.get)(e,t.total):(0,Z.isFunction)(t.total)?t.total(e):void 0,result:(0,Z.isString)(t.result)?(0,Z.get)(e,t.result):(0,Z.isFunction)(t.result)?t.result(e):void 0,message:(0,Z.isString)(t.message)?(0,Z.get)(e,t.message):(0,Z.isFunction)(t.message)?t.message(e):void 0}:{list:e},oe=(0,Z.debounce)(e=>{a(`toolbarButtonClick`,{data:E.value,code:e,selectedKeys:ie.value,records:ne.value}),fe(e)},100),se=({key:e})=>oe(e),I=(0,Z.debounce)(e=>{a(`toolbarToolClick`,{data:E.value,code:e,selectedKeys:ie.value,records:ne.value}),fe(e)},100),L=()=>new Promise(e=>{if(b.value!==`bad`){F({table:!0,form:!0});let{ajax:t}=p.value;t.query({form:v.value,page:C}).then(t=>{let{list:n,total:r,result:i,message:a}=ae(t,p.value.response);n?(E.value=n,w.value++):i?(E.value=i,T.value=r??i.length,w.value++):(E.value=[],w.value++,a&&Ai(a)),e(E.value)}).catch(t=>{console.error(`fetchData error`,t),e([])}).finally(()=>{F({table:!1,form:!1})})}}),R=(e,t)=>(C.page=e,C.size=t,L()),ce=()=>(C.page=1,N.value={},L()),le=(0,Z.debounce)(L,160),ue=(e,t)=>(Object.assign(v.value,e),C.page=1,t?Promise.resolve():le()),de=(e,t)=>(v.value=e,C.page=1,t?Promise.resolve():le()),fe=e=>{let{ajax:t}=p.value;switch(e){case`multiDelete`:t.multiDelete&&(ie.value.length>0?Di({title:`警告`,content:`确认删除选中的数据吗?`}).then(()=>{F({table:!0,toolbar:!0}),t.multiDelete(ie.value).then(()=>{Oi(`删除成功`),ce()}).catch(()=>{ki(`删除失败`)}).finally(()=>{F({table:!1,toolbar:!1}),P.multiDelete=!1})}):Ai(`请选择要删除的数据`));break}},pe=(0,l.computed)(()=>!h.value||!h.value.selectable&&!h.value.tree?c.value:[h.value.selectable&&h.value.tree?{type:`selection-tree`,width:40,widthFillDisable:!0,title:``}:h.value.selectable?{type:`selection`,width:40,widthFillDisable:!0,title:``}:h.value.tree?{type:`tree`,width:40,widthFillDisable:!0,title:``}:{type:`index`,width:40,widthFillDisable:!0,title:``},...c.value]),z=e=>{if(o.value&&o.value.items.length>0){if(o.value.customReset)o.value.customReset();else{let e={};Br(o.value.items,t=>{t.field&&t.itemRender?Lr(t.itemRender.defaultValue)?e[t.field]=t.itemRender.defaultValue:e[t.field]=void 0:t.field&&t.slots&&(Lr(t.slots.defaultValue)?e[t.field]=t.slots.defaultValue:e[t.field]=void 0)}),v.value=e}a(`resetQuery`)}C.page=1,e||le()},B=()=>(N.value={},z()),me=null,he=()=>{me&&cancelAnimationFrame(me),me=requestAnimationFrame(()=>{if(me=null,!j.value)return;let e=j.value.getBoundingClientRect();M.value=Math.max(window.innerHeight-e.top-r.fitHeight,100)})},V=null;(0,l.watch)(A,e=>{V?.disconnect(),V=null,e&&(V=new ResizeObserver(()=>he()),V.observe(e))},{immediate:!0});let H,ge=null;return(0,l.onMounted)(()=>{if(he(),window.addEventListener(`resize`,he),H=new MutationObserver(e=>{e.forEach(e=>{if(e.type===`attributes`&&e.attributeName===`style`){let t=e.target;window.getComputedStyle(t).display!==`none`&&he()}})}),k.value){H.observe(k.value,{attributes:!0,attributeFilter:[`style`]}),ge=new ResizeObserver(()=>he());let e=k.value.parentElement;for(let t=0;t<5&&e&&e!==document.body;t++)ge.observe(e),e=e.parentElement}z(r.manualFetch)}),(0,l.onBeforeUnmount)(()=>{me&&cancelAnimationFrame(me),window.removeEventListener(`resize`,he),H.disconnect(),V?.disconnect(),ge?.disconnect()}),t({commitProxy:{query:le,reload:B,reloadPage:ce,passQuery:ue,forcePassQuery:de},$canvasTable:(0,l.computed)(()=>O.value),selectedRowKeys:ie,setBtnLoading:te,selectedRecords:ne,$form:(0,l.computed)(()=>D.value),getFormData:()=>v.value,setLoadings:F,resizeTable:he}),(e,t)=>{let n=(0,l.resolveComponent)(`a-menu-item`),a=(0,l.resolveComponent)(`a-menu`),s=(0,l.resolveComponent)(`a-dropdown`);return(0,l.openBlock)(),(0,l.createElementBlock)(`div`,(0,l.mergeProps)({ref_key:`boxEl`,ref:k,class:`h-full p-wrapper flex flex-col gap-8px overflow-y-auto`},(0,l.unref)(i)),[b.value===`bad`?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Wi,`请检查配置`)):((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:1},[(0,l.unref)(o)?.items?.some(e=>e.field&&e.itemRender)?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,{key:0,class:`p-pane p-form-wrapper`,ref_key:`pFormWrapper`,ref:A},[(0,l.createVNode)((0,l.unref)(u.Spin),{spinning:S.form},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Form),(0,l.mergeProps)({key:_.value,ref_key:`formEl`,ref:D,model:v.value},x.value,{onSubmit:re}),{default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Row),{gutter:[6,12]},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)((0,l.unref)(o).items,(e,n)=>((0,l.openBlock)(),(0,l.createBlock)(Ci,{key:`_col_${e.field||n}`,"form-data":v.value,item:e,onReset:t[0]||=e=>z(r.lazyReset)},null,8,[`form-data`,`item`]))),128))]),_:1})]),_:1},16,[`model`]))]),_:1},8,[`spinning`])],512)):(0,l.createCommentVNode)(``,!0),(0,l.unref)(f)?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Gi,[(0,l.createElementVNode)(`div`,Ki,[(0,l.unref)(f).buttons&&(0,l.unref)(f).buttons.length>0?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:0},(0,l.renderList)((0,l.unref)(f).buttons,(e,t)=>((0,l.openBlock)(),(0,l.createElementBlock)(l.Fragment,{key:t},[e.dropdowns&&e.dropdowns.length?((0,l.openBlock)(),(0,l.createBlock)(s,{key:0},{overlay:(0,l.withCtx)(()=>[(0,l.createVNode)(a,{onClick:se},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(e.dropdowns,e=>((0,l.openBlock)(),(0,l.createBlock)(n,{key:e.code},{default:(0,l.withCtx)(()=>[(0,l.createTextVNode)((0,l.toDisplayString)(e.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Button),{type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(f).disabled||e.disabled,loading:S.toolbar||!!e.code&&P[e.code],danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(e.content)+` `,1),(0,l.createVNode)((0,l.unref)(d.DownOutlined))]),_:2},1032,[`type`,`size`,`disabled`,`loading`,`danger`,`shape`,`ghost`,`block`])]),_:2},1024)):e.code?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Button),{key:1,type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(f).disabled||e.disabled,loading:S.toolbar||!!e.code&&P[e.code],danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block,onClick:t=>(0,l.unref)(oe)(e.code)},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(e.content),1)]),_:2},1032,[`type`,`size`,`disabled`,`loading`,`danger`,`shape`,`ghost`,`block`,`onClick`])):((0,l.openBlock)(),(0,l.createElementBlock)(`div`,qi))],64))),128)):(0,l.createCommentVNode)(``,!0)]),(0,l.createElementVNode)(`span`,Ji,[(0,l.unref)(f).tools&&(0,l.unref)(f).tools.length>0?((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,{key:0},(0,l.renderList)((0,l.unref)(f).tools,(e,t)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Button),{key:t,type:e.type,size:e.size??`middle`,disabled:(0,l.unref)(f).disabled||e.disabled,danger:e.danger,shape:e.shape,ghost:e.ghost,block:e.block,onClick:t=>(0,l.unref)(I)(e.code),loading:S.toolbar||!!e.code&&P[e.code]},{default:(0,l.withCtx)(()=>[e.icon?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(di),{key:0,icon:e.icon},null,8,[`icon`])):(0,l.createCommentVNode)(``,!0),(0,l.createTextVNode)(` `+(0,l.toDisplayString)(e.content),1)]),_:2},1032,[`type`,`size`,`disabled`,`danger`,`shape`,`ghost`,`block`,`onClick`,`loading`]))),128)):(0,l.createCommentVNode)(``,!0)])])):(0,l.createCommentVNode)(``,!0),(0,l.createElementVNode)(`div`,{ref_key:`tableWrapperEl`,ref:j,class:(0,l.normalizeClass)(`p-pane flex-1 h-0 p-inner-scroll`)},[(0,l.unref)(h)?.selectable&&(0,l.unref)(h).showCount?((0,l.openBlock)(),(0,l.createElementBlock)(`div`,Yi,` 已选:`+(0,l.toDisplayString)(ie.value.length),1)):(0,l.createCommentVNode)(``,!0),(0,l.createVNode)(Ui,{ref_key:`canvasTableRef`,ref:O,columns:pe.value,config:{...y.value.config,HEIGHT:M.value},data:E.value,loading:S.table,onSelectionChange:ee},(0,l.createSlots)({_:2},[(0,l.renderList)(e.$slots,(t,n)=>({name:n,fn:(0,l.withCtx)(t=>[(0,l.renderSlot)(e.$slots,n,(0,l.normalizeProps)((0,l.guardReactiveProps)(t)))])}))]),1032,[`columns`,`config`,`data`,`loading`]),b.value===`pagination`?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Pagination),{key:1,class:`p-canvas-pagination`,size:`small`,current:C.page,"page-size":C.size,total:T.value,onChange:R},null,8,[`current`,`page-size`,`total`])):(0,l.createCommentVNode)(``,!0)],512)],64))],16)}}}),Zi=(0,l.defineComponent)({__name:`PGroupBlock`,props:{name:{},getFormSetting:{type:Function},source:{}},setup(e,{expose:t}){let n=e,r=(0,l.ref)(),{source:i}=(0,l.toRefs)(n),a=(0,l.computed)(()=>r.value?.$form),o=(0,l.computed)(()=>n.getFormSetting(i.value));return t({$form:a}),(t,n)=>((0,l.openBlock)(),(0,l.createBlock)(Ti,(0,l.mergeProps)({name:e.name,ref_key:`formEl`,ref:r},o.value,{data:(0,l.unref)(i)}),null,16,[`name`,`data`]))}}),Qi=(0,l.defineComponent)({__name:`CollapseCard`,props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(e,{expose:t}){let n=(0,l.ref)(e.defaultCollapsed?[]:[`content`]);return t({collapse:()=>{n.value=[]},expand:()=>{n.value=[`content`]}}),(t,r)=>{let i=(0,l.resolveComponent)(`a-collapse-panel`),a=(0,l.resolveComponent)(`a-collapse`),o=(0,l.resolveComponent)(`a-card`);return e.collapsible?((0,l.openBlock)(),(0,l.createBlock)(a,{key:0,"active-key":n.value,"onUpdate:activeKey":r[0]||=e=>n.value=e,class:`collapsible-card`},{default:(0,l.withCtx)(()=>[(0,l.createVNode)(i,{key:`content`,"force-render":``,header:e.title},(0,l.createSlots)({_:2},[(0,l.renderList)(t.$slots,(e,n)=>({name:n,fn:(0,l.withCtx)(()=>[(0,l.renderSlot)(t.$slots,n)])}))]),1032,[`header`])]),_:3},8,[`active-key`])):((0,l.openBlock)(),(0,l.createBlock)(o,{key:1,size:`small`,title:e.title},(0,l.createSlots)({_:2},[(0,l.renderList)(t.$slots,(e,n)=>({name:n,fn:(0,l.withCtx)(()=>[(0,l.renderSlot)(t.$slots,n)])}))]),1032,[`title`]))}}}),$i=(0,l.defineComponent)({__name:`PFormGroup`,props:(0,l.mergeModels)({name:{},getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:[`update:modelValue`],setup(e,{expose:t}){let n=u.Form.useForm,r=(0,l.ref)(),i=e,a=(0,l.ref)(),o=(0,l.useModel)(e,`modelValue`),s=(0,l.ref)(0),c=(0,l.ref)([]),f=(0,l.ref)([]),p=e=>{s.value=e},m=(0,l.computed)(()=>i.max??1/0),h=e=>{(i.createItem??(()=>Promise.resolve({})))({list:o.value}).then(t=>{o.value=[...o.value,{...t,__index:((0,Z.max)(o.value,e=>e.__index??-1)?.__index??-1)+1}],s.value=e})},g=i.itemMenus??[{content:`复制`,code:`copy`},{content:`删除`,code:`delete`}],_=e=>e?.parentElement?.parentElement?.parentElement?.parentElement?.parentElement?.parentElement??a.value?.$el??document.body,v=(0,l.computed)(()=>i.forceRender||o.value.length<=5),y=e=>{let t=o.value.find((t,n)=>n===e)?.__index;Q(t)&&(c.value=c.value.filter(e=>e!==t))},b=()=>{(0,l.nextTick)().then(()=>{y(s.value),f.value[s.value]?.$form?.validate()})},x=(e,t)=>i.getTabLabel?.(e,t)??`${i.tabLabel} ${i.keepSerial?t+1:(e.__index??0)+1}`;(0,l.watch)(()=>o.value,()=>{if(!i.keepSerial){let e=o.value.filter(e=>!Q(e.__index));e.length>0&&e.forEach(e=>{e.__index=((0,Z.max)(o.value,e=>e.__index??-1)?.__index??-1)+1})}},{immediate:!0});let S=(0,Z.debounce)(({key:e},t,n)=>{if(i.menuHandler&&(0,Z.isFunction)(i.menuHandler))i.menuHandler({code:(0,Z.toString)(e),data:t,index:n});else switch(e){case`delete`:o.value=o.value.filter((e,t)=>t!==n),(0,l.nextTick)(()=>{f.value=f.value.filter(e=>!!e),n<=s.value&&s.value>0&&s.value--});break;case`copy`:if(o.value.length>=m.value){Ai(`已达到最大数量`);return}o.value=[...o.value,(0,Z.clone)({...(0,Z.omit)(t,[`id`,`__index`]),__index:((0,Z.max)(o.value,e=>e.__index??-1)?.__index??-1)+1})];break}},100);(0,l.watchEffect)(()=>{o.value.length===0?s.value=0:s.value>=o.value.length&&(s.value=o.value.length-1)});let C=(0,Z.debounce)(y,50);(0,l.watchEffect)(()=>{let e=o.value.map((e,t)=>c.value.includes(e.__index)?t:void 0).filter(Q),t=r.value?.$el;t&&t.querySelectorAll(`:scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn`).forEach((t,n)=>{e.includes(n)?t.classList.add(`p-error-group-tab`):t.classList.remove(`p-error-group-tab`)})}),t({collapse:()=>{a.value?.collapse?.()},expand:()=>{a.value?.expand?.()},activeKey:(0,l.computed)(()=>s.value),setActiveKey:p,validateAll:()=>{let e=v.value?f.value.map(e=>e.$form?.validate()):o.value.map(e=>n(e,i.getFormSetting(e).rules)?.validate()??Promise.resolve());return Promise.allSettled(e).then(e=>{if(c.value=e.map((e,t)=>e.status===`rejected`&&typeof o.value[t]?.__index==`number`?o.value[t].__index:void 0).filter(e=>typeof e==`number`),!i.lazyErrorMark&&c.value.length){let e=c.value[0],t=o.value.findIndex(t=>t.__index===e);t!==-1&&(s.value=t)}return c.value.length?Promise.reject({error_indexes:c.value,results:e}):Promise.resolve(e)})},validate:async(e,t)=>{let r=o.value.findIndex(t=>t.__index===e);try{return await(v.value?f.value[r]?.$form?.validate()??Promise.resolve():n(o.value[r],i.getFormSetting(o.value[r]).rules)?.validate()??Promise.resolve()),c.value=c.value.filter(t=>t!==e),Promise.resolve()}catch(n){return!c.value.includes(e)&&!t&&(c.value=[...c.value,e]),Promise.reject(n)}},validateFields:async(e,t,r)=>{let a=o.value.findIndex(t=>t.__index===e),s=i.getFormSetting(o.value[a]).rules,l=n(o.value[a],s);try{return await(v.value?f.value[a]?.$form?.validateFields(t)??Promise.resolve():Promise.allSettled(t.map(e=>l.validateField(e,o.value[a][e],s[e]??[])))),Promise.resolve()}catch(t){return!c.value.includes(e)&&!r&&(c.value=[...c.value,e]),Promise.reject(t)}}});let w=(0,l.useSlots)(),T=(0,l.computed)(()=>Object.keys(w).filter(e=>e.startsWith(`group-`)).map(e=>({original:e,target:e.replace(`group-`,``)})));return(t,n)=>{let i=(0,l.resolveComponent)(`a-spin`);return(0,l.openBlock)(),(0,l.createBlock)(Qi,{ref_key:`rootRef`,ref:a,title:e.title,size:`small`,collapsible:e.collapsible,"default-collapsed":e.defaultCollapsed},(0,l.createSlots)({default:(0,l.withCtx)(()=>[e.loading?((0,l.openBlock)(),(0,l.createBlock)(i,{key:0,class:`w-full`})):((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Tabs),{key:1,ref_key:`tabsRef`,ref:r,type:`editable-card`,activeKey:s.value,"onUpdate:activeKey":n[1]||=e=>s.value=e,"hide-add":``,onChange:b},{rightExtra:(0,l.withCtx)(()=>[(0,l.renderSlot)(t.$slots,`rightExtra`,{},()=>[e.showAdd&&o.value.length<m.value?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Button),{key:0,type:`link`,onClick:n[0]||=e=>h(o.value.length)},{default:(0,l.withCtx)(()=>[...n[2]||=[(0,l.createTextVNode)(` + 新增 `,-1)]]),_:1})):(0,l.createCommentVNode)(``,!0)])]),default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)(o.value,(t,n)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.TabPane),{key:n,tab:x(t,n),"force-render":v.value},{closeIcon:(0,l.withCtx)(()=>[e.editAble&&(0,l.unref)(g)?.length?((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Dropdown),{key:0,"get-popup-container":_},{overlay:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(u.Menu),{onClick:e=>(0,l.unref)(S)(e,t,n)},{default:(0,l.withCtx)(()=>[((0,l.openBlock)(!0),(0,l.createElementBlock)(l.Fragment,null,(0,l.renderList)((0,l.unref)(g).filter(e=>e.visibleMethod?.({data:t,index:n})??!0),e=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.MenuItem),{key:e.code},{default:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,null,(0,l.toDisplayString)(e.content),1)]),_:2},1024))),128))]),_:2},1032,[`onClick`])]),default:(0,l.withCtx)(()=>[(0,l.createVNode)((0,l.unref)(d.MoreOutlined))]),_:2},1024)):(0,l.createCommentVNode)(``,!0)]),default:(0,l.withCtx)(()=>[((0,l.openBlock)(),(0,l.createBlock)(Zi,{ref_for:!0,ref_key:`blockInstance`,ref:f,key:n,source:t,name:e.name?`${e.name}_${n}`:void 0,"get-form-setting":e.getFormSetting,onFocusCapture:e=>(0,l.unref)(C)(n),onClickCapture:e=>(0,l.unref)(C)(n)},null,8,[`source`,`name`,`get-form-setting`,`onFocusCapture`,`onClickCapture`]))]),_:2},1032,[`tab`,`force-render`]))),128))]),_:3},8,[`activeKey`]))]),_:2},[(0,l.renderList)(T.value,e=>({name:e.target,fn:(0,l.withCtx)(()=>[(0,l.renderSlot)(t.$slots,e.original)])}))]),1032,[`title`,`collapsible`,`default-collapsed`])}}}),ea={class:`w-full text-right p-2`},ta=(0,l.defineComponent)({__name:`PromisePicker`,props:{gridSetting:{},title:{default:`数据选择`},width:{default:`70%`},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(e,{expose:t}){let n=(0,l.ref)(),r=(0,l.ref)(!1),i=e,a=(0,l.computed)(()=>i.gridSetting.selectConfig?.multiple),o,s,c,d=(0,l.reactive)({modal:!1}),f=()=>{c&&c()},p=()=>{d.modal=!1,c&&c()},m=({row:e,field:t})=>{o&&!a.value&&i.beforePick(e).then(()=>{d.modal=!1,o({row:e,field:t})})},h=()=>{let e=n.value?.selectedRecords??[];e.length===0&&!i.multipleAllowEmpty?Ai(`请选择数据`):i.beforePick(e).then(()=>{d.modal=!1,s(e)})};return(0,l.onMounted)(()=>{}),t({pick:()=>new Promise((e,t)=>{o=e,c=t,r.value=!1,d.modal=!0,(0,l.nextTick)(()=>{r.value=!0})}),pickMultiple:()=>new Promise((e,t)=>{s=e,c=t,r.value=!1,d.modal=!0,(0,l.nextTick)(()=>{r.value=!0})}),grid:n,hide:()=>{d.modal=!1}}),(t,i)=>((0,l.openBlock)(),(0,l.createBlock)((0,l.unref)(u.Modal),{open:d.modal,"onUpdate:open":i[0]||=e=>d.modal=e,"destroy-on-close":``,title:e.title,width:e.width,footer:a.value?void 0:null,onCancel:f,"body-style":e.bodyStyle},(0,l.createSlots)({default:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,{style:(0,l.normalizeStyle)({minHeight:r.value?`unset`:`642px`})},[(0,l.createVNode)(Bi,(0,l.mergeProps)(e.gridSetting,{ref_key:`gridEl`,ref:n,onPick:m}),null,16)],4)]),_:2},[a.value?{name:`footer`,fn:(0,l.withCtx)(()=>[(0,l.createElementVNode)(`div`,ea,[(0,l.createElementVNode)(`span`,null,[(0,l.createVNode)((0,l.unref)(u.Button),{class:`mr-4`,onClick:p},{default:(0,l.withCtx)(()=>[...i[1]||=[(0,l.createTextVNode)(` 取消 `,-1)]]),_:1}),(0,l.createVNode)((0,l.unref)(u.Button),{type:`primary`,onClick:h},{default:(0,l.withCtx)(()=>[...i[2]||=[(0,l.createTextVNode)(` 确定 `,-1)]]),_:1})])])]),key:`0`}:void 0]),1032,[`open`,`title`,`width`,`footer`,`body-style`]))}});function na(e){e&&Hr(e)}var ra={install(e){e.component(`PForm`,Ti),e.component(`PGrid`,Bi),e.component(`PCanvasTable`,Ui),e.component(`PCanvasGrid`,Xi),e.component(`PFormGroup`,$i),e.component(`PGroupBlock`,Zi),e.component(`PromisePicker`,ta)},addFormatter:oi,addRender:vi,setup:na};exports.PCanvasGrid=Xi,exports.PCanvasTable=Ui,exports.PForm=Ti,exports.PFormGroup=$i,exports.PGrid=Bi,exports.PGroupBlock=Zi,exports.PromisePicker=ta,exports.addFormatter=oi,exports.addRender=vi,exports.cleanCol=Yr,exports.default=ra,exports.defaultItemResponsive=Xr,exports.defaultLabelCol=Zr,exports.get24rest=$r,exports.getButtonResponsive=ti,exports.getTooltipRenderer=Ur,exports.getUIKitConfig=Wr,exports.labelColDict=Qr,exports.resetUIKitConfig=Jr,exports.setUIKitConfig=Hr,exports.setup=na,exports.watchPreviousDeep=ni;