@vue-ui-kit/ant 2.0.5 → 2.0.6

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,4 +1,4 @@
1
- "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),k=require("ant-design-vue"),dt=require("@ant-design/icons-vue");function Ja(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 Qa=Ja(dt);var ja={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Re=ja;function el(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 ee=el,tl=Object.prototype.toString,mo=tl,il=mo;function rl(i){return function(e){return"[object "+i+"]"===il.call(e)}}var At=rl,sl=At,ol=Array.isArray||sl("Array"),z=ol;function nl(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var me=nl,al=me;function ll(i,e,t){if(i)for(var r in i)al(i,r)&&e.call(t,i[r],r,i)}var Mt=ll,cl=z,hl=ee,ul=Mt;function dl(i,e,t){return i&&(cl(i)?hl:ul)(i,e,t)}var Z=dl;function fl(i){return function(e){return typeof e===i}}var vt=fl,gl=vt,vl=gl("function"),te=vl,pl=Z;function xl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);pl(r,e>1?function(o){s.push([""+o,r[o]])}:function(){s.push(arguments[e])})}return s}}var or=xl,ml=or,yl=ml("keys",1),Le=yl,wl=mo,El=Mt,Cl=ee;function Mi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function Qt(i,e){return e?yo(i,e):i}function yo(i,e){if(i)switch(wl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return El(i,function(n,a){t[a]=Qt(n,e)}),t}case"[object Date]":case"[object RegExp]":return Mi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return Cl(i,function(n){r.push(Qt(n,e))}),r}case"[object Set]":{var s=Mi(i);return s.forEach(function(n){s.add(Qt(n,e))}),s}case"[object Map]":{var o=Mi(i);return o.forEach(function(n,a){o.set(a,Qt(n,e))}),o}}return i}function bl(i,e){return i&&yo(i,e)}var nr=bl,_l=ee,Rl=Le,Il=z,Sl=nr,Lr=Object.assign;function Dr(i,e,t){for(var r=e.length,s,o=1;o<r;o++)s=e[o],_l(Rl(e[o]),t?function(n){i[n]=Sl(s[n],t)}:function(n){i[n]=s[n]});return i}var $l=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=Il(i[1])?[]:{},Dr(i,e,!0)}else return Lr?Lr.apply(Object,e):Dr(i,e)}return i},ae=$l,wo=Re,Ol=ee,Tl=Z,kl=te,Ll=ae,be=function(){};function Dl(){Ol(arguments,function(i){Tl(i,function(e,t){be[t]=kl(e)?function(){var r=e.apply(be.$context,arguments);return be.$context=null,r}:e})})}function Eo(i){return Ll(wo,i)}function Al(){return wo}var Co="3.7.8";be.VERSION=Co;be.version=Co;be.mixin=Dl;be.setup=Eo;be.setConfig=Eo;be.getConfig=Al;var Ml=be;function Bl(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var ar=Bl,Nl=ar,Fl=Le;function Kl(i,e,t){Nl(Fl(i),function(r){e.call(t,i[r],r,i)})}var bo=Kl;function Hl(i){return i===null}var De=Hl,Vl=De;function Pl(i,e){return function(t){return Vl(t)?e:t[i]}}var pt=Pl,Yl=Z,Wl=te,zl=pt;function Xl(i,e,t){var r={};if(i)if(e)Wl(e)||(e=zl(e)),Yl(i,function(s,o){r[o]=e.call(t,s,o,i)});else return i;return r}var Gl=Xl;function Ul(i){return i?i.constructor===Object:!1}var xt=Ul;function ql(i){return i!=="__proto__"&&i!=="constructor"}var _o=ql,Ar=z,Mr=xt,Zl=te,Jl=Z,Ql=_o;function Ro(i,e){return Mr(i)&&Mr(e)||Ar(i)&&Ar(e)?(Jl(e,function(t,r){Ql(r)&&(i[r]=Zl(e)?t:Ro(i[r],t))}),i):e}var jl=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&Ro(i,r);return i},ec=jl,tc=Z;function ic(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 rt=ic,rc=me,sc=z;function oc(i,e,t,r,s){return function(o,n,a){if(o&&n){if(i&&o[i])return o[i](n,a);if(e&&sc(o)){for(var c=0,u=o.length;c<u;c++)if(!!n.call(a,o[c],c,o)===r)return[!0,!1,c,o[c]][t]}else for(var d in o)if(rc(o,d)&&!!n.call(a,o[d],d,o)===r)return[!0,!1,d,o[d]][t]}return s}}var pi=oc,nc=pi,ac=nc("some",1,0,!0,!1),Io=ac,lc=pi,cc=lc("every",1,1,!1,!0),So=cc,hc=me;function uc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(hc(i,t)&&e===i[t])return!0}return!1}var mt=uc,Br=z,Nr=mt;function dc(i,e){var t,r=0;if(Br(i)&&Br(e)){for(t=e.length;r<t;r++)if(!Nr(i,e[r]))return!1;return!0}return Nr(i,e)}var $o=dc,Fr=Z,fc=mt,gc=te,vc=pt;function pc(i,e,t){var r=[];if(e){gc(e)||(e=vc(e));var s,o={};Fr(i,function(n,a){s=e.call(t,n,a,i),o[s]||(o[s]=1,r.push(n))})}else Fr(i,function(n){fc(r,n)||r.push(n)});return r}var Oo=pc,xc=rt;function mc(i){return xc(i,function(e){return e})}var lr=mc,yc=Oo,wc=lr;function Ec(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(wc(i[t]));return yc(e)}var Cc=Ec,bc="undefined",ye=bc,_c=ye,Rc=vt,Ic=Rc(_c),Ie=Ic,Sc=De,$c=Ie;function Oc(i){return Sc(i)||$c(i)}var Ae=Oc,Tc=/(.+)?\[(\d+)\]$/,To=Tc;function kc(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var cr=kc,Lc=To,Dc=cr,Ac=me,Mc=Ie,ko=Ae;function Bc(i,e,t){if(ko(i))return t;var r=Fc(i,e);return Mc(r)?t:r}function Nc(i,e){var t=e?e.match(Lc):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function Fc(i,e){if(i){var t,r,s,o=0;if(i[e]||Ac(i,e))return i[e];if(r=Dc(e),s=r.length,s){for(t=i;o<s;o++)if(t=Nc(t,r[o]),ko(t))return o===s-1?t:void 0}return t}}var Bt=Bc,Kr=ee,Kc=lr,Hr=rt,Vr=z,Hc=te,Vc=xt,Pr=Ie,Pc=De,Yc=Ae,Wc=Bt,zc=pt,Xc="asc",Gc="desc";function Zi(i,e){return Pr(i)?1:Pc(i)?Pr(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function Uc(i,e,t){return function(r,s){var o=r[i],n=s[i];return o===n?t?t(r,s):0:e.order===Gc?Zi(n,o):Zi(o,n)}}function qc(i,e,t,r){var s=[];return t=Vr(t)?t:[t],Kr(t,function(o,n){if(o){var a=o,c;Vr(o)?(a=o[0],c=o[1]):Vc(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||Xc}),Kr(e,Hc(a)?function(u,d){u[n]=a.call(r,u.data,d,i)}:function(u){u[n]=a?Wc(u.data,a):u.data})}}),s}function Zc(i,e,t){if(i){if(Yc(e))return Kc(i).sort(Zi);for(var r,s=Hr(i,function(a){return{data:a}}),o=qc(i,s,e,t),n=o.length-1;n>=0;)r=Uc(n,o[n],r),n--;return r&&(s=s.sort(r)),Hr(s,zc("data"))}return[]}var hr=Zc,Jc=hr,Qc=Jc,jc=Qc;function eh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var Lo=eh,th=or,ih=th("values",0),yt=ih,rh=Lo,sh=yt;function oh(i){for(var e,t=[],r=sh(i),s=r.length-1;s>=0;s--)e=s>0?rh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var Do=oh,nh=Do;function ah(i,e){var t=nh(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var lh=ah;function ch(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var Ao=ch,hh=Ao,uh=hh(parseFloat),st=uh,Yr=st;function dh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?Yr(e):0,t=s>=3?Yr(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var ot=dh,fh=Z;function gh(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);fh(i,function(s,o){e.call(t,s,o,i)&&r.push(s)})}return r}var vh=gh,ph=pi,xh=ph("",0,2,!0),mh=xh,yh=pi,wh=yh("find",1,3,!0),Eh=wh,Ch=z,bh=yt;function _h(i,e,t){if(i){Ch(i)||(i=bh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Rh=_h,Ih=Le;function Sh(i,e,t){if(i){var r,s,o=0,n=null,a=t,c=arguments.length>2,u=Ih(i);if(i.length&&i.reduce)return s=function(){return e.apply(n,arguments)},c?i.reduce(s,a):i.reduce(s);for(c&&(o=1,a=i[u[0]]),r=u.length;o<r;o++)a=e.call(n,a,i[u[o]],o,i);return a}}var $h=Sh,Oh=z;function Th(i,e,t,r){if(Oh(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,o,n=e>>0,a=t>>0,c=i.length,u=arguments.length>3?r>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,u=u>=0?u:c+u,a<u)))for(s=0,o=i.slice(a,u);n<c&&!(o.length<=s);n++)i[n]=o[s++];return i}var kh=Th,Lh=z;function Dh(i,e){var t,r=[],s=e>>0||1;if(Lh(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 Ah=Dh,Mh=rt,Bh=pt;function Nh(i,e){return Mh(i,Bh(e))}var Mo=Nh,Fh=te,Wr=Ae,Kh=Bt,Hh=ee;function Vh(i){return function(e,t){if(e&&e.length){var r,s;return Hh(e,function(o,n){t&&(o=Fh(t)?t(o,n,e):Kh(o,t)),!Wr(o)&&(Wr(r)||i(r,o))&&(s=n,r=o)}),e[s]}return r}}var Bo=Vh,Ph=Bo,Yh=Ph(function(i,e){return i<e}),No=Yh,Wh=Mo,zh=No;function Xh(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=zh(i,function(o){return o?o.length:0}),r=t?t.length:0;e<r;e++)s.push(Wh(i,e));return s}var Fo=Xh,Gh=Fo;function Uh(){return Gh(arguments)}var qh=Uh,Zh=yt,Jh=Z;function Qh(i,e){var t={};return e=e||[],Jh(Zh(i),function(r,s){t[r]=e[s]}),t}var jh=Qh,Ko=z,eu=ee;function Ho(i,e){var t=[];return eu(i,function(r){t=t.concat(Ko(r)?e?Ho(r,e):r:[r])}),t}function tu(i,e){return Ko(i)?Ho(i,e):[]}var iu=tu,ru=rt,su=z;function ou(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function nu(i,e){for(var t,r=arguments,s=[],o=[],n=2,a=r.length;n<a;n++)s.push(r[n]);if(su(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return ru(i,function(c){if(o.length&&(c=ou(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var au=nu;function lu(i,e){return(console[i]||console.log)(e)}var cu=lu;function hu(i,e){try{delete i[e]}catch{i[e]=void 0}}var Vo=hu,uu=z,du=ar,fu=bo;function gu(i,e,t){return i&&(uu(i)?du:fu)(i,e,t)}var Po=gu,vu=vt,pu=vu("object"),xi=pu,xu=Vo,mu=xt,yu=xi,wu=z,Eu=De,Cu=ae,bu=Mt;function _u(i,e,t){if(i){var r,s=arguments.length>1&&(Eu(e)||!yu(e)),o=s?t:e;if(mu(i))bu(i,s?function(n,a){i[a]=e}:function(n,a){xu(i,a)}),o&&Cu(i,o);else if(wu(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;o&&i.push.apply(i,o)}}return i}var Yo=_u,Ru=Vo,Iu=te,Su=z,$u=Z,Ou=ee,Tu=Po,ku=Yo,Lu=Ae;function Du(i){return function(e,t){return t===i}}function Au(i,e,t){if(i){if(!Lu(e)){var r=[],s=[];return Iu(e)||(e=Du(e)),$u(i,function(o,n,a){e.call(t,o,n,a)&&r.push(n)}),Su(i)?Tu(r,function(o,n){s.push(i[o]),i.splice(o,1)}):(s={},Ou(r,function(o){s[o]=i[o],Ru(i,o)})),s}return ku(i)}return i}var Wo=Au,Mu=Re,zr=cu,Bu=hr,Nu=nr,Fu=Ae,Ji=Z,Ku=Wo,Hu=ae;function Vu(i,e){Ji(i,function(t){t[e]&&!t[e].length&&Ku(t,e)})}function Pu(i,e){var t=Hu({},Mu.treeOptions,e),r=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,u=t.reverse,d=t.data,f=[],g={},v={},p,x,m;return c&&(i=Bu(Nu(i),c),u&&(i=i.reverse())),Ji(i,function(C){p=C[s],v[p]&&zr("warn","Duplicate primary key="+p),v[p]=!0}),Ji(i,function(C){p=C[s],d?(x={},x[d]=C):x=C,m=C[o],g[p]=g[p]||[],x[s]=p,x[o]=m,p===m&&(m=null,zr("warn","Error infinite Loop. key="+p+" parentKey="+p)),g[m]=g[m]||[],g[m].push(x),x[n]=g[p],a&&(x[a]=g[p]),(!r||r&&Fu(m))&&(v[m]||f.push(x))}),r&&Vu(i,n),f}var Yu=Pu,Wu=Re,zu=ee,Xu=ae;function zo(i,e,t,r){var s=r.key,o=r.parentKey,n=r.children,a=r.data,c=r.updated,u=r.clear;return zu(t,function(d){var f=d[n];a&&(d=d[a]),c!==!1&&(d[o]=e?e[s]:null),i.push(d),f&&f.length&&zo(i,d,f,r),u&&delete d[n]}),i}function Gu(i,e){return zo([],null,i,Xu({},Wu.treeOptions,e))}var Uu=Gu;function qu(i){return function(e,t,r,s){var o=r||{},n=o.children||"children";return i(null,e,t,s,[],[],n,o)}}var mi=qu,Zu=mi;function Xo(i,e,t,r,s,o,n,a){if(e){var c,u,d,f,g,v;for(u=0,d=e.length;u<d;u++){if(c=e[u],f=s.concat([""+u]),g=o.concat([c]),t.call(r,c,u,e,f,i,g))return{index:u,item:c,path:f,items:e,parent:i,nodes:g};if(n&&c&&(v=Xo(c,c[n],t,r,f.concat([n]),g,n),v))return v}}}var Ju=Zu(Xo),Qu=Ju,ju=mi,ed=Z;function Go(i,e,t,r,s,o,n,a){var c,u;ed(e,function(d,f){c=s.concat([""+f]),u=o.concat([d]),t.call(r,d,f,e,c,i,u),d&&n&&(c.push(n),Go(d,d[n],t,r,c,u,n))})}var td=ju(Go),Uo=td,id=mi,rd=rt;function qo(i,e,t,r,s,o,n,a){var c,u,d,f=a.mapChildren||n;return rd(e,function(g,v){return c=s.concat([""+v]),u=o.concat([g]),d=t.call(r,g,v,e,c,i,u),d&&g&&n&&g[n]&&(d[f]=qo(g,g[n],t,r,c,u,n,a)),d})}var sd=id(qo),od=sd,nd=Uo;function ad(i,e,t,r){var s=[];return i&&e&&nd(i,function(o,n,a,c,u,d){e.call(r,o,n,a,c,u,d)&&s.push(o)},t),s}var ld=ad,cd=mi,hd=ee,ud=ae;function Zo(i,e,t,r,s,o,n,a,c){var u,d,f,g,v,p=[],x=c.original,m=c.data,C=c.mapChildren||a,_=c.isEvery;return hd(t,function(w,b){u=o.concat([""+b]),d=n.concat([w]),g=i&&!_||r.call(s,w,b,t,u,e,d),v=a&&w[a],g||v?(x?f=w:(f=ud({},w),m&&(f[m]=w)),f[C]=Zo(g,w,w[a],r,s,u,d,a,c),(g||f[C].length)&&p.push(f)):g&&p.push(f)}),p}var dd=cd(function(i,e,t,r,s,o,n,a){return Zo(0,i,e,t,r,s,o,n,a)}),fd=dd;function gd(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 Jo=gd;function vd(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 Qo=vd,pd=vt,xd=pd("number"),Se=xd,md=Se;function yd(i){return md(i)&&isNaN(i)}var wd=yd,Ed=vt,Cd=Ed("string"),Me=Cd,bd=At,_d=bd("Date"),Xe=_d,Rd=parseInt,Nt=Rd;function Id(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 Sd=Id;function $d(i){return i.getTime()}var he=$d,li=Nt,Xr=Sd,Od=he,Td=Me,kd=Xe;function Ft(i){return"(\\d{"+i+"})"}function Ld(i){return i<10?i*100:i<100?i*10:i}function Gr(i){return isNaN(i)?i:li(i)}var nt=Ft(2),lt=Ft("1,2"),jo=Ft("1,7"),en=Ft("3,4"),tn=".{1}",It=tn+lt,rn="(([zZ])|([-+]\\d{2}:?\\d{2}))",Ur=[en,It,It,It,It,It,tn+jo,rn],Qi=[];for(var Bi=Ur.length-1;Bi>=0;Bi--){for(var qr="",tt=0;tt<Bi+1;tt++)qr+=Ur[tt];Qi.push(new RegExp("^"+qr+"$"))}function Dd(i){for(var e,t={},r=0,s=Qi.length;r<s;r++)if(e=i.match(Qi[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 Zr=[["yyyy",en],["yy",nt],["MM",nt],["M",lt],["dd",nt],["d",lt],["HH",nt],["H",lt],["mm",nt],["m",lt],["ss",nt],["s",lt],["SSS",Ft(3)],["S",jo],["Z",rn]],sn={},on=["\\[([^\\]]+)\\]"];for(var tt=0;tt<Zr.length;tt++){var Ni=Zr[tt];sn[Ni[0]]=Ni[1]+"?",on.push(Ni[0])}var Ad=new RegExp(on.join("|"),"g"),Jr={};function Md(i,e){var t=Jr[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Ad,function(d,f){var g=d.charAt(0);return g==="["?f:(r.push(g),sn[d])});t=Jr[e]={_i:r,_r:new RegExp(s)}}var o={},n=i.match(t._r);if(n){for(var a=t._i,c=1,u=n.length;c<u;c++)o[a[c-1]]=n[c];return o}return o}function Bd(i){if(/^[zZ]/.test(i.Z))return new Date(Xr(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(Xr(i)-(e[1]==="-"?-1:1)*li(e[2])*36e5+li(e[3])*6e4):new Date("")}function Nd(i,e){if(i){var t=kd(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?Od(i):li(i));if(Td(i)){var r=e?Md(i,e):Dd(i);if(r.y)return r.M&&(r.M=Gr(r.M)-1),r.S&&(r.S=Ld(Gr(r.S.substring(0,3)))),r.Z?Bd(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 ie=Nd;function Fd(){return new Date}var yi=Fd,Kd=Xe,Hd=ie,Vd=yi;function Pd(i){var e,t=i?Hd(i):Vd();return Kd(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var nn=Pd,Yd=z,Wd=me;function zd(i,e,t){if(i){if(Yd(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var o in i)if(Wd(i,o)&&e.call(t,i[o],o,i)===!1)break}}var Xd=zd,Gd=z,Ud=me;function qd(i,e,t){if(i){var r,s;if(Gd(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=Ud(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var Zd=qd,Jd=z,Qd=Me,jd=me;function ef(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(Qd(t)||Jd(t))return e(t,r);for(var s in t)if(jd(t,s)&&r===t[s])return s}return-1}}var an=ef,tf=an,rf=Jo,sf=tf("indexOf",rf),of=sf,nf=an,af=Qo,lf=nf("lastIndexOf",af),ln=lf,cf=z,hf=Me,uf=Z;function df(i){var e=0;return hf(i)||cf(i)?i.length:(uf(i,function(){e++}),e)}var cn=df,ff=Se;function gf(i){return ff(i)&&isFinite(i)}var vf=gf,pf=z,xf=De,mf=function(i){return!xf(i)&&!isNaN(i)&&!pf(i)&&i%1===0},hn=mf,yf=z,wf=hn,Ef=De;function Cf(i){return!Ef(i)&&!isNaN(i)&&!yf(i)&&!wf(i)}var bf=Cf,_f=vt,Rf=_f("boolean"),un=Rf,If=At,Sf=If("RegExp"),ur=Sf,$f=At,Of=$f("Error"),dn=Of;function Tf(i){return i?i.constructor===TypeError:!1}var kf=Tf;function Lf(i){for(var e in i)return!1;return!0}var fn=Lf,Df=ye,Af=typeof Symbol!==Df;function Mf(i){return Af&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var gn=Mf,Bf=At,Nf=Bf("Arguments"),Ff=Nf,Kf=Me,Hf=Se;function Vf(i){return!!(i&&Kf(i.nodeName)&&Hf(i.nodeType))}var Pf=Vf,Yf=ye,Wf=typeof document===Yf?0:document,dr=Wf,zf=dr;function Xf(i){return!!(i&&zf&&i.nodeType===9)}var Gf=Xf,Uf=ye,qf=typeof window===Uf?0:window,vn=qf,Zf=vn;function Jf(i){return!!(Zf&&(i&&i===i.window))}var Qf=Jf,jf=ye,eg=typeof FormData!==jf;function tg(i){return eg&&i instanceof FormData}var ig=tg,rg=ye,sg=typeof Map!==rg;function og(i){return sg&&i instanceof Map}var ng=og,ag=ye,lg=typeof WeakMap!==ag;function cg(i){return lg&&i instanceof WeakMap}var hg=cg,ug=ye,dg=typeof Set!==ug;function fg(i){return dg&&i instanceof Set}var gg=fg,vg=ye,pg=typeof WeakSet!==vg;function xg(i){return pg&&i instanceof WeakSet}var mg=xg,yg=te,wg=Me,Eg=z,Cg=me;function bg(i){return function(e,t,r){if(e&&yg(t)){if(Eg(e)||wg(e))return i(e,t,r);for(var s in e)if(Cg(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var pn=bg,_g=pn,Rg=_g(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}),fr=Rg,Qr=Se,jr=z,es=Me,Ig=ur,Sg=Xe,$g=un,Og=Ie,ts=Le,Tg=So;function xn(i,e,t,r,s,o,n){if(i===e)return!0;if(i&&e&&!Qr(i)&&!Qr(e)&&!es(i)&&!es(e)){if(Ig(i))return t(""+i,""+e,s,o,n);if(Sg(i)||$g(i))return t(+i,+e,s,o,n);var a,c,u,d=jr(i),f=jr(e);if(d||f?d&&f:i.constructor===e.constructor)return c=ts(i),u=ts(e),r&&(a=r(i,e,s)),c.length===u.length?Og(a)?Tg(c,function(g,v){return g===u[v]&&xn(i[g],e[u[v]],t,r,d||f?v:g,i,e)}):!!a:!1}return t(i,e,s,o,n)}var mn=xn;function kg(i,e){return i===e}var yn=kg,Lg=mn,Dg=yn;function Ag(i,e){return Lg(i,e,Dg)}var wn=Ag,is=Le,Mg=fr,rs=wn,Bg=Io,Ng=$o;function Fg(i,e){var t=is(i),r=is(e);if(r.length){if(Ng(t,r))return Bg(r,function(s){return Mg(t,function(o){return o===s&&rs(i[o],e[s])})>-1})}else return!0;return rs(i,e)}var Kg=Fg,ss=mn,os=yn,Hg=te,Vg=Ie;function Pg(i,e,t){return Hg(t)?ss(i,e,function(r,s,o,n,a){var c=t(r,s,o,n,a);return Vg(c)?os(r,s):!!c},t):ss(i,e,os)}var Yg=Pg,Wg=gn,zg=Xe,Xg=z,Gg=ur,Ug=dn,qg=De;function Zg(i){return qg(i)?"null":Wg(i)?"symbol":zg(i)?"date":Xg(i)?"array":Gg(i)?"regexp":Ug(i)?"error":typeof i}var Jg=Zg,Qg=Re,jg=Ae;function ev(i){return""+(jg(i)?"":i)+Qg.keyId++}var tv=ev,iv=pn,rv=iv(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}),sv=rv,ov=xt,nv=Me;function av(i){if(ov(i))return i;if(nv(i))try{return JSON.parse(i)}catch{}return{}}var lv=av,cv=Ae;function hv(i){return cv(i)?"":JSON.stringify(i)}var uv=hv,dv=or,fv=dv("entries",2),gv=fv,vv=te,pv=z,xv=Z,mv=fr;function yv(i,e){return function(t,r){var s,o,n={},a=[],c=this,u=arguments,d=u.length;if(!vv(r)){for(o=1;o<d;o++)s=u[o],a.push.apply(a,pv(s)?s:[s]);r=0}return xv(t,function(f,g){((r?r.call(c,f,g,t):mv(a,function(v){return v===g})>-1)?i:e)&&(n[g]=f)}),n}}var En=yv,wv=En,Ev=wv(1,0),Cv=Ev,bv=En,_v=bv(0,1),Rv=_v,Iv=yt;function Sv(i){return Iv(i)[0]}var $v=Sv,Ov=yt;function Tv(i){var e=Ov(i);return e[e.length-1]}var kv=Tv,Lv=To,Dv=cr,jt=me;function Av(i,e){if(i){if(jt(i,e))return!0;var t,r,s,o,n,a,c=Dv(e),u=0,d=c.length;for(n=i;u<d&&(a=!1,t=c[u],o=t?t.match(Lv):"",o?(r=o[1],s=o[2],r?n[r]&&jt(n[r],s)&&(a=!0,n=n[r][s]):jt(n,s)&&(a=!0,n=n[s])):jt(n,t)&&(a=!0,n=n[t]),a);u++)if(u===d-1)return!0}return!1}var Mv=Av,ns=Nt,Bv=cr,Nv=_o,Fv=me,as=/(.+)?\[(\d+)\]$/;function Kv(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var o,n,a=e?e.match(as):null;if(t)n=s;else{var c=r?r.match(as):null;c&&!c[1]?n=new Array(ns(c[2])+1):n={}}return a?a[1]?(o=ns(a[2]),i[a[1]]?t?i[a[1]][o]=n:i[a[1]][o]?n=i[a[1]][o]:i[a[1]][o]=n:(i[a[1]]=new Array(o+1),i[a[1]][o]=n)):i[a[2]]=n:i[e]=n,n}return i[e]}function Hv(i,e,t){if(i&&Nv(e)){if((i[e]||Fv(i,e))&&!ls(e))i[e]=t;else for(var r=i,s=Bv(e),o=s.length,n=0;n<o;n++)if(!ls(s[n])){var a=n===o-1;r=Kv(r,s[n],a,a?null:s[n+1],t)}}return i}function ls(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var Vv=Hv,Pv=fn,Yv=xi,Wv=te,zv=pt,Xv=Z;function Gv(i){return function(){return Pv(i)}}function Uv(i,e,t){var r,s={};return i&&(e&&Yv(e)?e=Gv(e):Wv(e)||(e=zv(e)),Xv(i,function(o,n){r=e?e.call(t,o,n,i):o,s[r]?s[r].push(o):s[r]=[o]})),s}var Cn=Uv,qv=Cn,Zv=Mt;function Jv(i,e,t){var r=qv(i,e,t||this);return Zv(r,function(s,o){r[o]=s.length}),r}var Qv=Jv;function jv(i,e,t){var r,s,o=[],n=arguments;if(n.length<2&&(e=n[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)o.push(r);return o}var bn=jv,cs=Le,ep=ot,tp=mt,ip=ee,rp=ae;function sp(i,e){if(i&&e){var t=rp.apply(this,[{}].concat(ep(arguments,1))),r=cs(t);ip(cs(i),function(s){tp(r,s)&&(i[s]=t[s])})}return i}var op=sp,np=Bo,ap=np(function(i,e){return i>e}),lp=ap;function cp(i){return(i.split(".")[1]||"").length}var wi=cp,hp=Nt;function up(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(hp(e));return t.join(i)+(t.length>0?i:"")}var Kt=up;function dp(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var _n=dp,ei=Kt,Fi=_n;function fp(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],u=t[8],d=u-a.length,f=u-o.length,g=u-n.length;return c==="+"?o?s+o+ei("0",u):d>0?s+n+a+ei("0",d):s+n+Fi(a,u):o?f>0?s+"0."+ei("0",Math.abs(f))+o:s+Fi(o,f):g>0?s+"0."+ei("0",Math.abs(g))+n+a:s+Fi(n,g)+a}return e}var Ge=fp,hs=wi,us=Ge;function gp(i,e){var t=us(i),r=us(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,hs(t)+hs(r))}var Rn=gp,vp=Rn,ds=st,pp=Ge;function xp(i){return function(e,t){var r=ds(e),s=r;if(r){t=t>>0;var o=pp(r),n=o.split("."),a=n[0],c=n[1]||"",u=c.substring(0,t+1),d=a+(u?"."+u:"");if(t>=c.length)return ds(d);if(d=r,t>0){var f=Math.pow(10,t);s=Math[i](vp(d,f))/f}else s=Math[i](d)}return s}}var gr=xp,mp=gr,yp=mp("round"),vr=yp,wp=gr,Ep=wp("ceil"),In=Ep,Cp=gr,bp=Cp("floor"),Sn=bp,_p=Ae,Rp=Se,Ip=Ge;function Sp(i){return Rp(i)?Ip(i):""+(_p(i)?"":i)}var re=Sp,$p=vr,Op=re,Tp=Kt,kp=_n;function Lp(i,e){e=e>>0;var t=Op($p(i,e)),r=t.split("."),s=r[0],o=r[1]||"",n=e-o.length;return e?n>0?s+"."+o+Tp("0",n):s+kp(o,Math.abs(n)):s}var pr=Lp,Dp=Re,Ap=vr,Mp=In,Bp=Sn,Np=Se,Fp=re,Kp=pr,Hp=Ge,Vp=ae;function Pp(i,e){var t=Vp({},Dp.commafyOptions,e),r=t.digits,s=Np(i),o,n,a,c,u;return s?(o=(t.ceil?Mp:t.floor?Bp:Ap)(i,r),n=Hp(r?Kp(o,r):o).split("."),c=n[0],u=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=Fp(i).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(u?"."+u:""):o}var Yp=Pp,Wp=Nt,zp=Ao,Xp=zp(Wp),Gp=Xp,Up=Rn,fs=st;function qp(i,e){var t=fs(i),r=fs(e);return Up(t,r)}var xr=qp,gs=wi,vs=Ge,ps=xr;function Zp(i,e){var t=vs(i),r=vs(e),s=Math.pow(10,Math.max(gs(t),gs(r)));return(ps(i,s)+ps(e,s))/s}var $n=Zp,Jp=$n,xs=st;function Qp(i,e){return Jp(xs(i),xs(e))}var jp=Qp,ms=wi,ys=Ge,ws=st,ex=pr;function tx(i,e){var t=ws(i),r=ws(e),s=ys(t),o=ys(r),n=ms(s),a=ms(o),c=Math.pow(10,Math.max(n,a)),u=n>=a?n:a;return parseFloat(ex((t*c-r*c)/c,u))}var ix=tx,Es=wi,Cs=Ge,rx=xr;function sx(i,e){var t=Cs(i),r=Cs(e),s=Es(t),o=Es(r),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return rx(t.replace(".","")/r.replace(".",""),a?1/c:c)}var On=sx,ox=On,bs=st;function nx(i,e){return ox(bs(i),bs(e))}var ax=nx,Ki=$n,lx=te,cx=z,hx=Z,ux=Bt;function dx(i,e,t){var r=0;return hx(i&&i.length>2&&cx(i)?i.sort():i,e?lx(e)?function(){r=Ki(r,e.apply(t,arguments))}:function(s){r=Ki(r,ux(s,e))}:function(s){r=Ki(r,s)}),r}var Tn=dx,fx=On,gx=cn,vx=Tn;function px(i,e,t){return fx(vx(i,e,t),gx(i))}var xx=px,mx="first",Ht=mx,yx="last",Ei=yx;function wx(i){return i.getFullYear()}var Vt=wx,Ex=864e5,wt=Ex;function Cx(i){return i.getMonth()}var Ci=Cx,bx=Xe,_x=he;function Rx(i){return bx(i)&&!isNaN(_x(i))}var ue=Rx,_s=Ht,Ix=Ei,Sx=wt,$x=Vt,Rs=he,Is=Ci,Ox=ie,Tx=ue,kx=Se;function kn(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=Ox(i),Tx(i)){if(t===_s)return new Date($x(i),Is(i)+r,1);if(t===Ix)return new Date(Rs(kn(i,r+1,_s))-1);if(kx(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(Is(i)+r),s!==i.getDate())return i.setDate(1),new Date(Rs(i)-Sx)}}return i}var Pt=kn,Lx=Ht,Ss=Ei,$s=Vt,Dx=Pt,Ax=ie,Mx=ue;function Bx(i,e,t){var r;if(i=Ax(i),Mx(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear($s(i)+r)),t||!isNaN(t))){if(t===Lx)return new Date($s(i),0,1);if(t===Ss)return i.setMonth(11),Dx(i,0,Ss);i.setMonth(t)}return i}var bi=Bx,Nx=Pt,Fx=ie,Kx=ue;function Hx(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function Vx(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=Fx(i),Kx(i)?(r=(Hx(i)-1)*3,i.setMonth(r),Nx(i,s,t)):i}var Px=Vx,Os=Ht,Yx=Ei,Wx=Nt,zx=Vt,Xx=Ci,Gx=he,Ux=ie,qx=ue;function Ln(i,e,t){if(i=Ux(i),qx(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Wx(e)),t===Os)return new Date(zx(i),Xx(i),i.getDate());if(t===Yx)return new Date(Gx(Ln(i,1,Os))-1)}return i}var Dn=Ln;function Zx(i){return i.toUpperCase()}var An=Zx,Jx=wt,Qx=Jx*7,Mn=Qx,jx=Re,Hi=wt,em=Mn,tm=he,im=ie,rm=ue,Ts=Se;function sm(i,e,t,r){if(i=im(i),rm(i)){var s=Ts(t),o=Ts(r),n=tm(i);if(s||o){var a=o?r:jx.firstDayOfWeek,c=i.getDay(),u=s?t:c;if(c!==u){var d=0;a>c?d=-(7-a+c):a<c&&(d=a-c),u>a?n+=((u===0?7:u)-a+d)*Hi:u<a?n+=(7-a+u+d)*Hi:n+=d*Hi}}return e&&!isNaN(e)&&(n+=e*em),new Date(n)}return i}var Bn=sm,om=Re,ti=wt,nm=Mn,am=Se,lm=mt,cm=ie,hm=ue,ks=Bn,um=bn,dm=rt,ii=he,fm=dm(um(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function Ls(i,e){var t=new Date(i).getDay();return lm(fm[e],t)}function gm(i,e){return function(t,r){var s=am(r)?r:om.firstDayOfWeek,o=cm(t);if(hm(o)){var n=ks(o,0,s,s),a=i(n),c=ii(a),u=ii(n),d=u+ti*6,f=new Date(d),g=ks(a,0,s,s),v=ii(g),p;if(u===v)return 1;if(e(n,f)){for(p=ii(i(f));p<d;p+=ti)if(Ls(p,s))return 1}var x=v+ti*6,m=new Date(d),C=1;if(e(g,m)){for(C=0,p=c;p<x;p+=ti)if(Ls(p,s)){C++;break}}return Math.floor((u-v)/nm)+C}return NaN}}var Nn=gm,vm=Nn,pm=vm(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),Fn=pm,xm=Vt,mm=Ci;function ym(i){return new Date(xm(i),mm(i),i.getDate())}var wm=ym,Em=he,Cm=wm;function bm(i){return Em(Cm(i))}var _m=bm,Rm=wt,Im=Ht,Ds=_m,Sm=bi,$m=ie,Om=ue;function Tm(i){return i=$m(i),Om(i)?Math.floor((Ds(i)-Ds(Sm(i,0,Im)))/Rm)+1:NaN}var Kn=Tm,km=re,Lm=Ie,Dm=Kt;function Am(i,e,t){var r=km(i);return e=e>>0,t=Lm(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=Dm(t,e/t.length)),t.slice(0,e)+r):r}var Hn=Am,St=Re,Mm=An,Bm=Vt,As=Ci,Nm=ie,Fm=Fn,Km=Kn,Hm=ae,Vm=ue,Pm=te,Ce=Hn;function Ke(i,e,t,r){var s=e[t];return s?Pm(s)?s(r,t,i):s[r]:r}var Ym=/\[([^\]]+)]|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 Wm(i,e,t){if(i){if(i=Nm(i),Vm(i)){var r=e||St.parseDateFormat||St.formatString,s=i.getHours(),o=s<12?"am":"pm",n=Hm({},St.parseDateRules||St.formatStringMatchs,t?t.formats:null),a=function(w,b){return(""+Bm(i)).substr(4-b)},c=function(w,b){return Ce(As(i)+1,b,"0")},u=function(w,b){return Ce(i.getDate(),b,"0")},d=function(w,b){return Ce(s,b,"0")},f=function(w,b){return Ce(s<=12?s:s-12,b,"0")},g=function(w,b){return Ce(i.getMinutes(),b,"0")},v=function(w,b){return Ce(i.getSeconds(),b,"0")},p=function(w,b){return Ce(i.getMilliseconds(),b,"0")},x=function(w,b){var E=i.getTimezoneOffset()/60*-1;return Ke(i,n,w,(E>=0?"+":"-")+Ce(E,2,"0")+(b===1?":":"")+"00")},m=function(w,b){return Ce(Ke(i,n,w,Fm(i,(t?t.firstDay:null)||St.firstDayOfWeek)),b,"0")},C=function(w,b){return Ce(Ke(i,n,w,Km(i)),b,"0")},_={yyyy:a,yy:a,MM:c,M:c,dd:u,d:u,HH:d,H:d,hh:f,h:f,mm:g,m:g,ss:v,s:v,SSS:p,S:p,ZZ:x,Z:x,WW:m,W:m,DDD:C,D:C,a:function(w){return Ke(i,n,w,o)},A:function(w){return Ke(i,n,w,Mm(o))},e:function(w){return Ke(i,n,w,i.getDay())},E:function(w){return Ke(i,n,w,i.getDay())},q:function(w){return Ke(i,n,w,Math.floor((As(i)+3)/3))}};return r.replace(Ym,function(w,b){return b||(_[w]?_[w](w,w.length):w)})}return"Invalid Date"}return""}var Vn=Wm,zm=he,Xm=yi,Gm=Date.now||function(){return zm(Xm())},Pn=Gm,Um=he,qm=Pn,Zm=ie,Jm=Xe,Qm=function(i,e){if(i){var t=Zm(i,e);return Jm(t)?Um(t):t}return qm()},jm=Qm,Ms=Vn;function e1(i,e,t){return i&&e?(i=Ms(i,t),i!=="Invalid Date"&&i===Ms(e,t)):!1}var t1=e1,i1=Nn,r1=i1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),s1=r1,o1=bi,n1=ie,a1=ue,l1=nn;function c1(i,e){return i=n1(i),a1(i)?l1(o1(i,e))?366:365:NaN}var h1=c1,u1=wt,d1=Ht,f1=Ei,Bs=he,Ns=Pt,g1=ie,v1=ue;function p1(i,e){return i=g1(i),v1(i)?Math.floor((Bs(Ns(i,e,f1))-Bs(Ns(i,e,d1)))/u1)+1:NaN}var x1=p1,Fs=he,m1=yi,Ks=ie,Hs=ue,Vs=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function y1(i,e){var t,r,s,o,n,a,c={done:!1,time:0};if(i=Ks(i),e=e?Ks(e):m1(),Hs(i)&&Hs(e)&&(t=Fs(i),r=Fs(e),t<r))for(o=c.time=r-t,c.done=!0,a=0,n=Vs.length;a<n;a++)s=Vs[a],o>=s[1]?a===n-1?c[s[0]]=o||0:(c[s[0]]=Math.floor(o/s[1]),o-=c[s[0]]*s[1]):c[s[0]]=0;return c}var w1=y1,E1=re,C1=Ie,b1=Kt;function _1(i,e,t){var r=E1(i);return e=e>>0,t=C1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=b1(t,e/t.length)),r+t.slice(0,e)):r}var R1=_1,I1=re,S1=Kt;function $1(i,e){return S1(I1(i),e)}var O1=$1,T1=re;function k1(i){return i&&i.trimRight?i.trimRight():T1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Yn=k1,L1=re;function D1(i){return i&&i.trimLeft?i.trimLeft():L1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var Wn=D1,A1=Yn,M1=Wn;function B1(i){return i&&i.trim?i.trim():A1(M1(i))}var zn=B1,N1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Xn=N1,F1=re,K1=Le;function H1(i){var e=new RegExp("(?:"+K1(i).join("|")+")","g");return function(t){return F1(t).replace(e,function(r){return i[r]})}}var Gn=H1,V1=Xn,P1=Gn,Y1=P1(V1),W1=Y1,Ps=Xn,z1=Gn,X1=Z,Un={};X1(Ps,function(i,e){Un[Ps[e]]=e});var G1=z1(Un),U1=G1;function q1(i,e,t){return i.substring(e,t)}var qn=q1;function Z1(i){return i.toLowerCase()}var Zn=Z1,J1=re,He=qn,$t=An,Q1=Zn,Vi={};function j1(i){if(i=J1(i),Vi[i])return Vi[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,o){var n=s.length;return s=Q1(s),o?n>2&&o+n<e?$t(He(s,0,1))+He(s,1,n-1)+$t(He(s,n-1,n)):$t(He(s,0,1))+He(s,1,n):n>1&&o+n<e?He(s,0,n-1)+$t(He(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return $t(He(s,1,s.length))}),Vi[i]=t,t}var e0=j1,t0=re,at=qn,Ve=Zn,Pi={};function i0(i){if(i=t0(i),Pi[i])return Pi[i];if(/^[A-Z]+$/.test(i))return Ve(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,o){var n=s.length;return n>1?r+"-"+Ve(at(s,0,n-1))+"-"+Ve(at(s,n-1,n))+o:Ve(r+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var o=r.length;return Ve(at(r,0,o-1)+"-"+at(r,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,o,n){var a=s.length;return a>1&&(r&&(r+="-"),o)?(r||"")+Ve(at(s,0,a-1))+"-"+Ve(at(s,a-1,a))+o:(r||"")+(n?"-":"")+Ve(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),Pi[i]=e,e}var r0=i0,s0=re;function o0(i,e,t){var r=s0(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var n0=o0,a0=re;function l0(i,e,t){var r=a0(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var c0=l0,h0=Re,u0=re,d0=zn,f0=Bt;function g0(i,e,t){return u0(i).replace((t||h0).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return f0(e,d0(s))})}var Jn=g0,v0=Jn;function p0(i,e){return v0(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var x0=p0;function m0(){}var y0=m0,Ys=ot;function w0(i,e){var t=Ys(arguments,2);return function(){return i.apply(e,Ys(arguments).concat(t))}}var E0=w0,Ws=ot;function C0(i,e){var t=!1,r=null,s=Ws(arguments,2);return function(){return t||(r=i.apply(e,Ws(arguments).concat(s)),t=!0),r}}var b0=C0,_0=ot;function R0(i,e,t){var r=0,s=[];return function(){var o=arguments;r++,r<=i&&s.push(o[0]),r>=i&&e.apply(t,[s].concat(_0(o)))}}var I0=R0,S0=ot;function $0(i,e,t){var r=0,s=[];return t=t||this,function(){var o=arguments;r++,r<i&&(s.push(o[0]),e.apply(t,[s].concat(S0(o))))}}var O0=$0,T0=ae;function k0(i,e,t){var r=null,s=null,o=!1,n=null,a=T0({leading:!0,trailing:!0},t),c=a.leading,u=a.trailing,d=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),n=setTimeout(g,e),d()},g=function(){if(n=null,o){d();return}if(u===!0){f();return}d()},v=function(){var x=n!==null;return x&&clearTimeout(n),d(),n=null,o=!1,x},p=function(){if(r=arguments,s=this,o=!1,n===null&&c===!0){f();return}u===!0&&(n=setTimeout(g,e))};return p.cancel=v,p}var L0=k0,D0=ae;function A0(i,e,t){var r=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:D0({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,u=o.trailing,d=function(){r=null,s=null},f=function(){n=!0,i.apply(s,r),d()},g=function(){if(c===!0&&(a=null),n){d();return}if(u===!0){f();return}d()},v=function(){var x=a!==null;return x&&clearTimeout(a),d(),a=null,n=!1,x},p=function(){n=!1,r=arguments,s=this,a===null?c===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return p.cancel=v,p}var M0=A0,B0=ot;function N0(i,e){var t=B0(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var F0=N0,K0=decodeURIComponent,Qn=K0,zs=Qn,H0=ee,V0=Me;function P0(i){var e,t={};return i&&V0(i)&&H0(i.split("&"),function(r){e=r.split("="),t[zs(e[0])]=zs(e[1]||"")}),t}var jn=P0,Y0=encodeURIComponent,ea=Y0,ci=ea,ta=Z,ia=z,ra=De,W0=Ie,sa=xt;function oa(i,e,t){var r,s=[];return ta(i,function(o,n){r=ia(o),sa(o)||r?s=s.concat(oa(o,e+"["+n+"]",r)):s.push(ci(e+"["+(t?"":n)+"]")+"="+ci(ra(o)?"":o))}),s}function z0(i){var e,t=[];return ta(i,function(r,s){W0(r)||(e=ia(r),sa(r)||e?t=t.concat(oa(r,s,e)):t.push(ci(s)+"="+ci(ra(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var X0=z0,G0=ye,U0=typeof location===G0?0:location,_i=U0,ri=_i;function q0(){return ri?ri.origin||ri.protocol+"//"+ri.host:""}var na=q0,Xs=_i,Z0=jn,J0=na;function Gs(i){return Z0(i.split("?")[1]||"")}function Q0(i){var e,t,r,s,o=""+i;return o.indexOf("//")===0?o=(Xs?Xs.protocol:"")+o:o.indexOf("/")===0&&(o=J0()+o),r=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,c){return t=c||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(n,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=Gs(s.hash),s.searchQuery=Gs(s.search),s}var aa=Q0,Us=_i,j0=na,ey=ln;function ty(){if(Us){var i=Us.pathname,e=ey(i,"/")+1;return j0()+(e===i.length?i:i.substring(0,e))}return""}var iy=ty,qs=_i,ry=aa;function sy(){return qs?ry(qs.href):{}}var oy=sy,la=Re,Yi=dr,Zs=Qn,Js=ea,ny=z,Qs=xi,ca=Xe,ay=Ie,ly=mt,cy=Le,hi=ae,Wi=ee,hy=yi,si=he,uy=bi,dy=Pt,fy=Dn;function js(i,e){var t=parseFloat(e),r=hy(),s=si(r);switch(i){case"y":return si(uy(r,t));case"M":return si(dy(r,t));case"d":return si(fy(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 zi(i){return(ca(i)?i:new Date(i)).toUTCString()}function Pe(i,e,t){if(Yi){var r,s,o,n,a,c,u=[],d=arguments;return ny(i)?u=i:d.length>1?u=[hi({name:i,value:e},t)]:Qs(i)&&(u=[i]),u.length>0?(Wi(u,function(f){r=hi({},la.cookies,f),o=[],r.name&&(s=r.expires,o.push(Js(r.name)+"="+Js(Qs(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,v,p){return zi(js(p,v))}):/^[0-9]{11,13}$/.test(s)||ca(s)?s=zi(s):s=zi(js("d",s)),r.expires=s),Wi(["expires","path","domain","secure"],function(g){ay(r[g])||o.push(r[g]&&g==="secure"?g:g+"="+r[g])})),Yi.cookie=o.join("; ")}),!0):(n={},a=Yi.cookie,a&&Wi(a.split("; "),function(f){c=f.indexOf("="),n[Zs(f.substring(0,c))]=Zs(f.substring(c+1)||"")}),d.length===1?n[i]:n)}return!1}function gy(i){return ly(ha(),i)}function eo(i){return Pe(i)}function to(i,e,t){return Pe(i,e,t),Pe}function io(i,e){Pe(i,"",hi({expires:-1},la.cookies,e))}function ha(){return cy(Pe())}function vy(){return Pe()}hi(Pe,{has:gy,set:to,setItem:to,get:eo,getItem:eo,remove:io,removeItem:io,keys:ha,getJSON:vy});var py=Pe,xy=ye,Xi=dr,Gi=vn,my=ae,yy=ee;function ro(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function oi(i){return navigator.userAgent.indexOf(i)>-1}function wy(){var i,e,t,r=!1,s=!1,o=!1,n={isNode:!1,isMobile:r,isPC:!1,isDoc:!!Xi};if(!Gi&&typeof process!==xy)n.isNode=!0;else{t=oi("Edge"),e=oi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(i=Xi.body||Xi.documentElement,yy(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!i[a+"MatchesSelector"]}));try{s=ro(Gi.localStorage)}catch{}try{o=ro(Gi.sessionStorage)}catch{}my(n,{edge:t,firefox:oi("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&oi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:o})}return n}var Ey=wy,ua=Ml,so=ae,Cy=Mt,by=bo,_y=Gl,Ry=ec,Iy=rt,Sy=Io,$y=So,Oy=$o,Ty=ee,ky=ar,Ly=Oo,Dy=Cc,Ay=lr,My=jc,By=hr,Ny=Do,Fy=lh,Ky=ot,Hy=vh,Vy=mh,Py=mt,Yy=Eh,Wy=Rh,zy=$h,Xy=kh,Gy=Ah,Uy=qh,qy=Fo,Zy=jh,Jy=iu,Qy=Mo,jy=au,e2=Yu,t2=Uu,i2=Qu,r2=Uo,s2=od,o2=ld,n2=fd,a2=Jo,l2=Qo,c2=me,h2=z,u2=De,d2=wd,f2=Ie,g2=te,v2=xi,p2=Me,x2=xt,m2=nn,y2=Xe,w2=Ae,E2=Z,C2=Xd,b2=Zd,_2=of,R2=ln,I2=Le,S2=yt,$2=nr,O2=cn,T2=Po,k2=Wo,L2=Yo,D2=vf,A2=bf,M2=hn,B2=un,N2=Se,F2=ur,K2=dn,H2=kf,V2=fn,P2=gn,Y2=Ff,W2=Pf,z2=Gf,X2=Qf,G2=ig,U2=ng,q2=hg,Z2=gg,J2=mg,Q2=Kg,j2=wn,ew=Yg,tw=Jg,iw=tv,rw=fr,sw=sv,ow=lv,nw=uv,aw=gv,lw=Cv,cw=Rv,hw=$v,uw=kv,dw=Mv,fw=Bt,gw=Vv,vw=Cn,pw=Qv,xw=bn,mw=op,yw=Lo,ww=No,Ew=lp,Cw=Yp,bw=vr,_w=In,Rw=Sn,Iw=pr,Sw=Gp,$w=st,Ow=Ge,Tw=jp,kw=ix,Lw=xr,Dw=ax,Aw=Tn,Mw=xx,Bw=bi,Nw=Px,Fw=Pt,Kw=Dn,Hw=ie,Vw=Vn,Pw=Pn,Yw=jm,Ww=ue,zw=t1,Xw=Bn,Gw=Kn,Uw=Fn,qw=s1,Zw=h1,Jw=x1,Qw=w1,jw=R1,eE=Hn,tE=O1,iE=zn,rE=Yn,sE=Wn,oE=W1,nE=U1,aE=e0,lE=r0,cE=n0,hE=c0,uE=Jn,dE=x0,oo=re,fE=y0,gE=pt,vE=E0,pE=b0,xE=I0,mE=O0,yE=L0,wE=M0,EE=F0,CE=jn,bE=X0,_E=aa,RE=iy,IE=oy,SE=py,$E=Ey;so(ua,{assign:so,objectEach:Cy,lastObjectEach:by,objectMap:_y,merge:Ry,uniq:Ly,union:Dy,sortBy:My,orderBy:By,shuffle:Ny,sample:Fy,some:Sy,every:$y,slice:Ky,filter:Hy,find:Yy,findLast:Wy,findKey:Vy,includes:Py,arrayIndexOf:a2,arrayLastIndexOf:l2,map:Iy,reduce:zy,copyWithin:Xy,chunk:Gy,zip:Uy,unzip:qy,zipObject:Zy,flatten:Jy,toArray:Ay,includeArrays:Oy,pluck:Qy,invoke:jy,arrayEach:Ty,lastArrayEach:ky,toArrayTree:e2,toTreeArray:t2,findTree:i2,eachTree:r2,mapTree:s2,filterTree:o2,searchTree:n2,hasOwnProp:c2,eqNull:w2,isNaN:d2,isFinite:D2,isUndefined:f2,isArray:h2,isFloat:A2,isInteger:M2,isFunction:g2,isBoolean:B2,isString:p2,isNumber:N2,isRegExp:F2,isObject:v2,isPlainObject:x2,isDate:y2,isError:K2,isTypeError:H2,isEmpty:V2,isNull:u2,isSymbol:P2,isArguments:Y2,isElement:W2,isDocument:z2,isWindow:X2,isFormData:G2,isMap:U2,isWeakMap:q2,isSet:Z2,isWeakSet:J2,isLeapYear:m2,isMatch:Q2,isEqual:j2,isEqualWith:ew,getType:tw,uniqueId:iw,getSize:O2,indexOf:_2,lastIndexOf:R2,findIndexOf:rw,findLastIndexOf:sw,toStringJSON:ow,toJSONString:nw,keys:I2,values:S2,entries:aw,pick:lw,omit:cw,first:hw,last:uw,each:E2,forOf:C2,lastForOf:b2,lastEach:T2,has:dw,get:fw,set:gw,groupBy:vw,countBy:pw,clone:$2,clear:L2,remove:k2,range:xw,destructuring:mw,random:yw,min:Ew,max:ww,commafy:Cw,round:bw,ceil:_w,floor:Rw,toFixed:Iw,toNumber:$w,toNumberString:Ow,toInteger:Sw,add:Tw,subtract:kw,multiply:Lw,divide:Dw,sum:Aw,mean:Mw,now:Pw,timestamp:Yw,isValidDate:Ww,isDateSame:zw,toStringDate:Hw,toDateString:Vw,getWhatYear:Bw,getWhatQuarter:Nw,getWhatMonth:Fw,getWhatWeek:Xw,getWhatDay:Kw,getYearDay:Gw,getYearWeek:Uw,getMonthWeek:qw,getDayOfYear:Zw,getDayOfMonth:Jw,getDateDiff:Qw,trim:iE,trimLeft:sE,trimRight:rE,escape:oE,unescape:nE,camelCase:aE,kebabCase:lE,repeat:tE,padStart:eE,padEnd:jw,startsWith:cE,endsWith:hE,template:uE,toFormatString:dE,toString:oo,toValueString:oo,noop:fE,property:gE,bind:vE,once:pE,after:xE,before:mE,throttle:yE,debounce:wE,delay:EE,unserialize:CE,serialize:bE,parseUrl:_E,getBaseURL:RE,locat:IE,browse:$E,cookie:SE});var R=ua,Q=[];for(var Ui=0;Ui<256;++Ui)Q.push((Ui+256).toString(16).slice(1));function OE(i,e=0){return(Q[i[e+0]]+Q[i[e+1]]+Q[i[e+2]]+Q[i[e+3]]+"-"+Q[i[e+4]]+Q[i[e+5]]+"-"+Q[i[e+6]]+Q[i[e+7]]+"-"+Q[i[e+8]]+Q[i[e+9]]+"-"+Q[i[e+10]]+Q[i[e+11]]+Q[i[e+12]]+Q[i[e+13]]+Q[i[e+14]]+Q[i[e+15]]).toLowerCase()}var ni,TE=new Uint8Array(16);function kE(){if(!ni&&(ni=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ni))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ni(TE)}var LE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const no={randomUUID:LE};function ke(i,e,t){if(no.randomUUID&&!i)return no.randomUUID();i=i||{};var r=i.random||(i.rng||kE)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,OE(r)}const DE=i=>i==null||i==="",q=i=>!DE(i),ji=i=>i==null,Ye=i=>!ji(i),AE=i=>function(e,t,r,s){const o=r||{},n=o.children||"children";return i(null,e,t,s,[],[],n,o)},da=(i,e,t,r,s,o,n)=>{let a,c;e.forEach((u,d)=>{a=s.concat([""+d]),c=o.concat([u]),t.call(r,u,d,e,a,i,c),u&&n&&(a.push(n),da(u,u[n]||[],t,r,a,c,n))})},Tt=AE(da),fa={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170},canvasTable:{DISABLED:!0}};let ce=R.clone(fa);function ga(i){ce={form:{...ce.form,...i.form},grid:{...ce.grid,...i.grid},canvasTable:{...ce.canvasTable,...i.canvasTable}}}function ME(){return ce}function BE(){var i,e;return{labelCol:(i=ce.form)==null?void 0:i.labelCol,wrapperCol:(e=ce.form)==null?void 0:e.wrapperCol}}function va(){var i,e,t;return{align:(i=ce.grid)==null?void 0:i.align,lazyReset:(e=ce.grid)==null?void 0:e.lazyReset,fitHeight:(t=ce.grid)==null?void 0:t.fitHeight}}function pa(){return ce.canvasTable||{}}function NE(){ce=JSON.parse(JSON.stringify(fa))}const Ri=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...R.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>Ri(t))}},mr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},yr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},FE={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}},xa=i=>{const t=(24-i.reduce((s,o)=>s+o,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},ao=["xxs","xs","sm","md","lg","xl","xxl"],KE=i=>{const e=R.isArray(i)?i:R.isNumber(i)?Array.from({length:i},()=>mr):[];return R.zipObject(ao,ao.map(t=>e.every(r=>q(r[t]))?xa(e.map(r=>r[t])):24))},et="-",ct={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??et:et},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return et;if(R.isArray(i))if(i.length>0){const s=e.filter(o=>i.includes(o.value));return s.length?s.map(o=>o.label).join(t):et}else return et;const r=e.find(s=>s.value===i);return r?r.label:et},formatSex:({cellValue:i})=>q(i)?R.toNumber(i)===1?"男":"女":et},HE=(i,{record:e,index:t,column:r,field:s})=>{if(R.isString(i)&&ct[i]){const o=ct[i];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(R.isArray(i)&&ct[i[0]]&&i.length>1){const o=ct[i[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return R.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},ma=i=>{Object.assign(ct,i)},VE=l.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=kt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:r,row:s,field:o,rowIndex:n},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),ya=l.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,o=r.field?t[r.field]:null;return()=>{var n,a;return((a=(n=r.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:r,rowIndex:s,cellValue:o}))??(r.cellRender?l.createVNode(VE,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?HE(r.formatter,{record:t,index:s,field:r.field,column:r}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),PE={class:"text-right mt-4px"},YE=l.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};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>R.merge({},r,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:f=>{o("update:modelValue",f)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>u(f)}]}}]),c=()=>{n.value=[...n.value,{}]},u=f=>{n.value=n.value.filter((g,v)=>v!==f)},d=l.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 v=l.resolveComponent("a-form-item-rest"),p=l.resolveComponent("a-table"),x=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(p,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(m=>l.unref(Ri)(m))}),l.createSlots({_:2},[d.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:m,record:C,index:_})=>[l.createVNode(v,null,{default:l.withCtx(()=>[d.value.some(w=>m.key&&w.field===m.key)?(l.openBlock(),l.createBlock(l.unref(ya),{key:_,"row-index":_,"default-handler":{},column:d.value.find(w=>m.key&&w.field===m.key),row:C,"table-data":n.value},null,8,["row-index","column","row","table-data"])):l.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),l.createElementVNode("div",PE,[l.createVNode(x,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),oe=i=>{const{icon:e}=i,t=Qa;return t[e]?l.createVNode(t[e]):t[e]},Ot={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())}},ai={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},wa={$input:k.Input,AInput:k.Input,$textarea:k.Textarea,Textarea:k.Textarea,$number:k.InputNumber,AInputNumber:k.InputNumber,$select:k.Select,ASelect:k.Select,$date:k.DatePicker,ADatePicker:k.DatePicker,$range:k.RangePicker,ARangePicker:k.RangePicker,AAutoComplete:k.AutoComplete,$Cascader:k.Cascader,ACascader:k.Cascader,ACheckbox:k.Checkbox,AMentions:k.Mentions,ARate:k.Rate,ASlider:k.Slider,$time:k.TimePicker,ATimePicker:k.TimePicker,ATreeSelect:k.TreeSelect},WE=i=>{const e=wa[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:o},{data:n,field:a}){return Ye(o)&&q(a)&&ji(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:i,value:n[a],"onUpdate:value":c=>n[a]=c},r,R.merge({},Ot[i],t),{onChange:(...c)=>{var u;(u=s.change)==null||u.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderDefault({props:t=Ot[i]??{},attrs:r={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return Ye(o)&&q(c)&&ji(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:i,value:a[c],"onUpdate:value":u=>a[c]=u},r,R.merge({},Ot[i],t),{onChange:(...u)=>{var d;(d=s.change)==null||d.call(s,{data:n,row:a,field:c},...u)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderEdit(t,{props:r=Ot[i]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:i,value:t.value,"onUpdate:value":c=>t.value=c},s,R.merge({},Ot[i],r),{onBlur:(...c)=>{var u;a==null||a("blur",t.value),(u=o.blur)==null||u.call(o,n,...c)}}),null)}}},Ea=(i,e)=>{var t;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(r=>{var s;return!((s=r.hiddenIf)!=null&&s.call(r,e))}).length>0?l.createVNode(k.Dropdown,null,{default:()=>l.createVNode(k.Button,l.mergeProps(R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):l.createVNode(oe,{icon:"DownOutlined"},null)}),{default:()=>{var r;return[i.content||(((r=i==null?void 0:i.getContent)==null?void 0:r.call(i,e))??"")]}}),overlay:()=>{var r;return l.createVNode("div",{class:`dropdown-wrapper ${((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))??""}`},[i.dropdowns.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,e))}).map(s=>Ea(s,e))])}}):l.createVNode(k.Button,l.mergeProps({class:((t=i==null?void 0:i.dynamicClassName)==null?void 0:t.call(i,e))||""},R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var r;return[i.content||(((r=i==null?void 0:i.getContent)==null?void 0:r.call(i,e))??"")]}})},er={...Object.fromEntries(Object.keys(wa).map(i=>[i,WE(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return l.createVNode(k.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(n=>{s.reset(n?{data:n,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var o;return[i.content,((o=i.suffix)==null?void 0:o.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return l.createVNode(k.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.reset(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.pick(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(k.Button,l.mergeProps(R.omit(Object.assign({},i,o.props),["content"]),{icon:o.props.icon?l.createVNode(oe,{icon:o.props.icon},null):null,onClick:()=>{var n,a;(a=(n=o.events)==null?void 0:n.click)==null||a.call(n,{data:t,field:r}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.reset(c?{data:c,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.pick(c?{data:c,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,c;return!((c=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&c.call(a,{data:t,row:r,field:s}))}).map(n=>l.createVNode(k.Button,l.mergeProps(R.omit(Object.assign({},i,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(oe,{icon:n.props.icon},null):null,onClick:()=>{var a,c,u,d;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:r,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:r,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:r,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){return l.createVNode("span",{class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(r=>{var s;return!((s=r.hiddenIf)!=null&&s.call(r,t))}).map(r=>Ea(r,t))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t},{data:r,field:s}){return q(s)?l.createVNode(k.RadioGroup,l.mergeProps({value:r[s],"onUpdate:value":o=>r[s]=o},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:r,field:s},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(k.RadioGroup,l.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)?l.createVNode(k.AutoComplete,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:ai.autoComplete.filterOption},i),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},ai.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?l.createVNode(k.Switch,l.mergeProps({checked:t[r],"onUpdate:checked":s=>t[r]=s},i,{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={}},{data:r,field:s}){return q(s)?l.createVNode(k.CheckboxGroup,l.mergeProps({value:r[s],"onUpdate:value":o=>r[s]=o},i,{options:i.options??e??[],onChange:(...o)=>{var n;(n=t.change)==null||n.call(t,{data:r,field:s},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(k.CheckboxGroup,l.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 o;const r={ellipsis:{expandable:!0,rows:3}},s=((o=i.getContent)==null?void 0:o.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(k.TypographyParagraph,l.mergeProps(R.merge({},r,R.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?l.createVNode(YE,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&R.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={}},{data:t,field:r}){const s=i.parse?100:1;if(q(r)){const o=l.computed({get:()=>(t[r]??0)*s,set:n=>{t[r]=(n??0)/s}});return l.createVNode("div",{class:"flex items-center"},[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},R.merge({},ai.PercentInput,R.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 o=l.computed({get:()=>(t[r]??0)*s,set:n=>{R.set(t,r,(n??0)/s)}});return[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},R.merge({},ai.PercentInput,R.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?l.createVNode(k.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?l.createVNode(k.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},wr=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{er.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),er[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},kt={renders:er,addRender:wr},zE=l.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=l.toRefs(i),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=kt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},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"]}),XE=l.defineComponent(i=>{const{formData:e}=l.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"]}),GE={key:2},UE=["innerHTML"],Er=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=l.ref(!1),o=l.ref(ke()),n=(f,g)=>{const v=g??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",f)},v)},a=f=>{r("trigger",f)},c=()=>{r("reset")},u=()=>{o.value=ke()},d=R.debounce(u,100);return l.watch(()=>t.item,(f,g)=>{R.isEqual(f,g)||d()},{deep:!0}),(f,g)=>{const v=l.resolveComponent("a-tooltip"),p=l.resolveComponent("a-form-item"),x=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(x,l.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:l.unref(mr))),{default:l.withCtx(()=>{var m;return[(l.openBlock(),l.createBlock(p,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},l.unref(R.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var C,_;return[(C=f.item.slots)!=null&&C.default?(l.openBlock(),l.createBlock(l.unref(XE),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(_=f.item.itemRender)!=null&&_.name?(l.openBlock(),l.createBlock(l.unref(zE),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",GE))]}),_:2},[(m=f.item.slots)!=null&&m.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(R.isFunction)(f.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:0},l.unref(R.omit)(f.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,UE)]),default:l.withCtx(()=>[l.createVNode(l.unref(dt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:1},f.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(dt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),qE={key:0,class:"p-pane p-wrapper"},Cr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{type:Function},layout:{},labelCol:{},wrapperCol:{},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},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,o=BE(),n=l.computed(()=>({...r,labelCol:r.labelCol??o.labelCol??{span:6},wrapperCol:r.wrapperCol??o.wrapperCol??{span:16}})),{items:a,data:c}=l.toRefs(r);function u(){s("apply",c.value)}const d=l.ref(),f=l.ref(ke()),g=()=>{f.value=ke()},v=()=>{if(r.customReset)r.customReset();else{const C={};Tt(a.value,_=>{_.field&&_.itemRender?Ye(_.itemRender.defaultValue)?C[_.field]=_.itemRender.defaultValue:C[_.field]=void 0:_.field&&_.slots&&(Ye(_.slots.defaultValue)?C[_.field]=_.slots.defaultValue:C[_.field]=void 0)}),Object.assign(c.value,C)}s("reset")},p=l.computed(()=>({...R.omit(n.value,["items","data","model","labelCol","wrapperCol"]),labelCol:n.value.labelCol,wrapperCol:n.value.wrapperCol})),x=C=>{var _;C&&((_=d.value)==null||_.validateFields(C))},m=C=>{x(C)};return e({reset:g,$form:l.computed(()=>d.value)}),(C,_)=>l.unref(a).some(w=>{var b;return w.field&&w.itemRender||((b=w.slots)==null?void 0:b.default)})?(l.openBlock(),l.createElementBlock("div",qE,[(l.openBlock(),l.createBlock(l.unref(k.Form),l.mergeProps({key:f.value,ref_key:"formEl",ref:d,model:l.unref(c)},p.value,{onSubmit:u}),{default:l.withCtx(()=>[l.createVNode(l.unref(k.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a),(w,b)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${w.field||b}`,"form-data":l.unref(c),item:w,onReset:v,onTrigger:m},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),ZE=l.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"]}),Ca=({title:i,content:e})=>new Promise((t,r)=>{k.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),JE=k.message.success,QE=k.message.error;k.message.info;const ui=k.message.warning,jE={key:0},eC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},tC={class:"flex items-center flex-1 gap-4px"},iC={key:2},rC={class:"flex items-center gap-4px"},sC={key:0,class:"w-full text-slate-5 pl-4"},br=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{},manualFetch:{type:Boolean},align:{},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{},lazyReset:{type:Boolean},fitHeight:{},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var le,fe,Rt,K,Fe;const r=i,s=va(),o=l.computed(()=>({...r,rowKey:r.rowKey??"id",scrollMode:r.scrollMode??"inner",align:r.align??s.align??"left",lazyReset:r.lazyReset??s.lazyReset??!1,fitHeight:r.fitHeight??s.fitHeight??170})),{formConfig:n,pageConfig:a,columns:c,toolbarConfig:u,proxyConfig:d,tableConfig:f,selectConfig:g,scrollMode:v}=l.toRefs(r),p=l.reactive({table:!1,toolbar:!1,form:!1}),x=S=>{R.isObject(S)?Object.keys(S).forEach(A=>{p[A]=S[A]}):R.isBoolean(S)&&(p.form=S,p.table=S,p.toolbar=S)},m=l.ref(),C=l.ref(),_=l.ref(500),w=l.ref([]),b=l.ref([]),E=S=>{const{ajax:A}=d.value;switch(S){case"multiDelete":A.multiDelete&&(w.value.length>0?Ca({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{p.table=!0,p.toolbar=!0,A.multiDelete(w.value).then(()=>{k.message.success("删除成功"),qe()}).catch(()=>{k.message.error("删除失败")}).finally(()=>{p.table=!1,p.toolbar=!1,y.multiDelete=!1})}):k.message.warn("请选择要删除的数据"));break}},I=l.computed(()=>{const S=[];return Tt(c.value??[],A=>{A.slots&&A.slots.title&&(A.field||(A.field="__holder__"+S.length),S.push(A))}),S}),T=l.ref(),L=l.ref(),O=l.ref(ke()),$=l.ref(ke()),y=l.reactive([...(((fe=(le=r.toolbarConfig)==null?void 0:le.buttons)==null?void 0:fe.map(S=>S.code))??[]).filter(S=>S),...(((K=(Rt=r.toolbarConfig)==null?void 0:Rt.tools)==null?void 0:K.map(S=>S.code))??[]).filter(S=>S)].reduce((S,A)=>(S[A]=!1,S),{})),M=(S,A)=>{y[S]=A},H=()=>{$.value=ke()},F=R.debounce(H,100),X=l.computed(()=>{const S=[];return Tt(c.value??[],A=>{(A.slots&&A.slots.default||A.formatter||A.cellRender)&&(A.field||(A.field="__holder__"+S.length),S.push(A))}),S}),P=l.reactive({page:1,size:((Fe=a.value)==null?void 0:Fe.pageSize)??10}),Y=l.ref(0),W=l.ref(0),V=l.ref([]),we=l.computed(()=>d.value&&d.value.ajax?a.value?"pagination":"list":"bad"),de=l.useAttrs(),se=t,$e=l.computed(()=>b.value.filter(S=>w.value.includes(S[r.rowKey??"id"]))),j=S=>{se("toolbarButtonClick",{data:V.value,code:S,selectedKeys:w.value,records:$e.value}),E(S)},Xt=R.debounce(j,100),Oi=({key:S})=>Xt(S),Ti=S=>{se("toolbarToolClick",{data:V.value,code:S,selectedKeys:w.value,records:$e.value}),E(S)},Ct=R.debounce(Ti,100),Ne=l.ref({}),bt=({row:S,field:A})=>{se("pick",{row:S,field:A})},Ue=S=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const A={};Tt(n.value.items,U=>{U.field&&U.itemRender?Ye(U.itemRender.defaultValue)?A[U.field]=U.itemRender.defaultValue:A[U.field]=void 0:U.field&&U.slots&&(Ye(U.slots.defaultValue)?A[U.field]=U.slots.defaultValue:A[U.field]=void 0)}),Ne.value=A}se("resetQuery")}P.page=1,S||Ze()},ki=(S,A)=>A?{list:R.isString(A.list)?R.get(S,A.list):R.isFunction(A.list)?A.list(S):void 0,total:R.isString(A.total)?R.get(S,A.total):R.isFunction(A.total)?A.total(S):void 0,result:R.isString(A.result)?R.get(S,A.result):R.isFunction(A.result)?A.result(S):void 0,message:R.isString(A.message)?R.get(S,A.message):R.isFunction(A.message)?A.message(S):void 0}:{list:S},_t=l.ref(!0),Li=()=>(b.value=[],w.value=[],Ue()),qe=()=>(P.page=1,b.value=[],w.value=[],Oe()),Di=(S,A,U)=>(P.page=S.current,P.size=S.pageSize,Oe()),Oe=()=>new Promise(S=>{if(we.value!=="bad"){p.form=!0,p.table=!0;const{ajax:A}=d.value;A.query({form:Ne.value,page:P}).then(U=>{const{list:ge,total:Qe,result:J,message:Ee}=ki(U,d.value.response);ge?(V.value=ge,Y.value++):J?(V.value=J,W.value=Qe??J.length,Y.value++):(V.value=[],Y.value++,Ee&&k.message.warn(Ee)),S(V.value)}).catch(U=>{console.error("fetchData error",U),S([])}).finally(()=>{p.form=!1,p.table=!1})}}),Ze=R.debounce(Oe,160),Gt=(S,A)=>(Object.assign(Ne.value,S),P.page=1,A?Promise.resolve():Ze()),Ut=l.computed(()=>we.value==="pagination"?{current:P.page,total:W.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:S=>`共${S}条数据`}:!1),qt={size:"small",sticky:!0,transformCellText:({text:S})=>R.isArray(S)&&S.length===0?"-":S},Zt=l.computed(()=>R.merge({},qt,(f==null?void 0:f.value)??{},g.value?{rowSelection:{type:g.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:w.value,onChange:S=>{w.value=S;const A=r.rowKey??"id",U=b.value.map(J=>J[A]),Qe=S.filter(J=>!U.includes(J)).map(J=>V.value.find(Ee=>Ee[A]===J)).filter(J=>!!J);b.value=[...b.value,...Qe]},getCheckboxProps:g.value.getCheckboxProps}}:{})),Jt=l.computed(()=>R.omit({labelCol:yr,...n.value},["items"])),D=()=>{qe()};l.watch(()=>[c.value,d.value,u.value],()=>{F()},{deep:!0});const B=()=>{var J,Ee;const S=(J=m.value)==null?void 0:J.parentElement,A=S?window.getComputedStyle(S).height:"0px",U=C.value?window.getComputedStyle(C.value).height:"0px",ge=U.includes("px")?R.toNumber(U.replace("px","")):0,Qe=(Ee=g.value)!=null&&Ee.showCount?22:0;_.value=r.renderY??R.toNumber(A.replace("px",""))-o.value.fitHeight-(r.toolbarConfig?30:0)-ge-Qe,_t.value=R.toNumber(A.replace("px",""))>600};e({commitProxy:{query:Ze,reload:Li,reloadPage:qe,passQuery:Gt},$table:l.computed(()=>L.value),selectedRowKeys:l.computed(()=>w.value),setBtnLoading:M,selectedRecords:$e,$form:l.computed(()=>T.value),getFormData:()=>Ne.value,setLoadings:x,resizeTable:B});let G;l.onMounted(()=>{B(),window.addEventListener("resize",B),G=new MutationObserver(S=>{S.forEach(A=>{if(A.type==="attributes"&&A.attributeName==="style"){const U=A.target;window.getComputedStyle(U).display!=="none"&&B()}})}),m.value&&G.observe(m.value,{attributes:!0,attributeFilter:["style"]}),Ue(r.manualFetch)});const Te=["align"],Je=S=>S.map(A=>({...Te.reduce((U,ge)=>({[ge]:o.value[ge]}),{}),...A}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",B),G.disconnect()}),(S,A)=>{var J,Ee,kr;const U=l.resolveComponent("a-menu-item"),ge=l.resolveComponent("a-menu"),Qe=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:m,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(de)),[we.value==="bad"?(l.openBlock(),l.createElementBlock("div",jE,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(Ee=(J=l.unref(n))==null?void 0:J.items)!=null&&Ee.some(N=>N.field&&N.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:C},[l.createVNode(l.unref(k.Spin),{spinning:p.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(k.Form),l.mergeProps({key:O.value,ref_key:"formEl",ref:T,model:Ne.value},Jt.value,{onSubmit:D}),{default:l.withCtx(()=>[l.createVNode(l.unref(k.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(N,ve)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${N.field||ve}`,"form-data":Ne.value,item:N,onReset:A[0]||(A[0]=je=>Ue(o.value.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(u)?(l.openBlock(),l.createElementBlock("div",eC,[l.createElementVNode("div",tC,[l.unref(u).buttons&&l.unref(u).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).buttons,(N,ve)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ve},[N.dropdowns&&N.dropdowns.length?(l.openBlock(),l.createBlock(Qe,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ge,{onClick:Oi},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(N.dropdowns,je=>(l.openBlock(),l.createBlock(U,{key:je.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(je.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(k.Button),{type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,loading:p.toolbar||!!N.code&&y[N.code]},{default:l.withCtx(()=>[N.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:N.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(N.content)+" ",1),l.createVNode(l.unref(dt.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):N.code?(l.openBlock(),l.createBlock(l.unref(k.Button),{key:1,type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,loading:p.toolbar||!!N.code&&y[N.code],onClick:je=>l.unref(Xt)(N.code)},{default:l.withCtx(()=>[N.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:N.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(N.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",iC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",rC,[l.unref(u).tools&&l.unref(u).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).tools,(N,ve)=>(l.openBlock(),l.createBlock(l.unref(k.Button),{key:ve,type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,onClick:je=>l.unref(Ct)(N.code),loading:p.toolbar||!!N.code&&y[N.code]},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{icon:N.icon},null,8,["icon"])]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${_t.value?"h-0":""} p-${l.unref(v)??"inner"}-scroll`)},[(kr=l.unref(g))!=null&&kr.multiple&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",sC," 已选:"+l.toDisplayString(w.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(k.Table),l.mergeProps({key:$.value+"_table","row-key":S.rowKey??"id",ref_key:"tableEl",ref:L,columns:Je(l.unref(c)??[]).map(N=>l.unref(Ri)(N)),"data-source":V.value,loading:p.table,pagination:Ut.value},Zt.value,{scroll:{x:"max-content",y:_.value},onChange:Di}),l.createSlots({_:2},[I.value.length>0?{name:"headerCell",fn:l.withCtx(({column:N})=>[I.value.some(ve=>N.key&&ve.field===N.key)?(l.openBlock(),l.createBlock(l.unref(ZE),{key:$.value+"_title_"+Y.value+"_slot_"+N.key,column:I.value.find(ve=>N.key&&ve.field===N.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,X.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:N,record:ve,index:je})=>[X.value.some(Ai=>N.key&&Ai.field===N.key)?(l.openBlock(),l.createBlock(l.unref(ya),{key:$.value+"_cell_"+Y.value+"_slot_"+N.key,column:X.value.find(Ai=>N.key&&Ai.field===N.key),"default-handler":{pick:bt,setLoadings:x},row:ve,"row-index":je,"table-data":V.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","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-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--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-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: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--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-line-color: #e1e6eb}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.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;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:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var oC=Object.defineProperty,nC=(i,e,t)=>e in i?oC(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>nC(i,typeof e!="symbol"?e+"":e,t);class aC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:u,field:d,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(!g.required&&(u==null||u===""))return t;if(g.validator){const v={field:d,fieldValue:f,value:u,column:r,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(v,u,p=>{p&&t.push({...v,message:p})})}g.pattern&&!g.pattern.test(u)&&t.push({value:u,column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:d,fieldValue:f,message:g.message||`${o} is pattern validation error`}),g.required&&(u==null||u==="")&&t.push({value:u,column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:d,fieldValue:f,message:g.message||`${o} is required`})}return t}}function ba(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function _a(i,e){let t=0,r;return function(...s){const o=new Date().getTime(),n=o-t;!t||n>=e?(i.apply(this,s),t=o):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},e-n))}}function Ra(i=[]){return i.length?i.map(e=>Ra(e.children)+1).sort((e,t)=>t-e)[0]:0}function lC(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,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...r.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function Ia(i=[],e=1,t=0){return i.map(r=>{if(r.children){let s=0,o=r.fixed;r.children.forEach(a=>{a.fixed=o});const n=Ia(r.children,e-1,t+1);return n&&n.forEach(a=>{s+=a.colspan??0}),{...r,width:r.width,level:t,rowspan:1,colspan:s,children:n}}return{...r,level:t,rowspan:e,colspan:1}})}function di(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(di(t.children)):e.push(t)}),e}const lo=/^(\r\n|\n\r|\r|\n)/,cC=/^[^\t\r\n]+/,co=/^\t/;function hC(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(co))i=i.replace(co,""),t+=1,e[r][t]="";else if(i.match(lo))i=i.replace(lo,""),t=0,r+=1,e[r]=[""];else{let o="";if(i.startsWith('"')){let n=0,a=!0;for(;a;){const c=i.slice(0,1);c==='"'&&(n+=1),o+=c,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const n=i.match(cC);o=n?n[0]:"",i=i.slice(o.length)}e[r][t]=o}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 uC(i){let e,t,r,s,o="",n;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(o+=" "),n=i[e][r],typeof n=="string"?n.indexOf(`
1
+ "use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),L=require("ant-design-vue"),dt=require("@ant-design/icons-vue");function Ja(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 Qa=Ja(dt);var ja={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Re=ja;function el(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 ee=el,tl=Object.prototype.toString,mo=tl,il=mo;function rl(i){return function(e){return"[object "+i+"]"===il.call(e)}}var At=rl,sl=At,ol=Array.isArray||sl("Array"),z=ol;function nl(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var me=nl,al=me;function ll(i,e,t){if(i)for(var r in i)al(i,r)&&e.call(t,i[r],r,i)}var Mt=ll,cl=z,hl=ee,ul=Mt;function dl(i,e,t){return i&&(cl(i)?hl:ul)(i,e,t)}var Z=dl;function fl(i){return function(e){return typeof e===i}}var vt=fl,gl=vt,vl=gl("function"),te=vl,pl=Z;function xl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);pl(r,e>1?function(o){s.push([""+o,r[o]])}:function(){s.push(arguments[e])})}return s}}var or=xl,ml=or,yl=ml("keys",1),Le=yl,wl=mo,El=Mt,Cl=ee;function Mi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function Qt(i,e){return e?yo(i,e):i}function yo(i,e){if(i)switch(wl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return El(i,function(n,a){t[a]=Qt(n,e)}),t}case"[object Date]":case"[object RegExp]":return Mi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return Cl(i,function(n){r.push(Qt(n,e))}),r}case"[object Set]":{var s=Mi(i);return s.forEach(function(n){s.add(Qt(n,e))}),s}case"[object Map]":{var o=Mi(i);return o.forEach(function(n,a){o.set(a,Qt(n,e))}),o}}return i}function bl(i,e){return i&&yo(i,e)}var nr=bl,_l=ee,Rl=Le,Il=z,Sl=nr,Lr=Object.assign;function Dr(i,e,t){for(var r=e.length,s,o=1;o<r;o++)s=e[o],_l(Rl(e[o]),t?function(n){i[n]=Sl(s[n],t)}:function(n){i[n]=s[n]});return i}var $l=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=Il(i[1])?[]:{},Dr(i,e,!0)}else return Lr?Lr.apply(Object,e):Dr(i,e)}return i},ae=$l,wo=Re,Ol=ee,Tl=Z,kl=te,Ll=ae,be=function(){};function Dl(){Ol(arguments,function(i){Tl(i,function(e,t){be[t]=kl(e)?function(){var r=e.apply(be.$context,arguments);return be.$context=null,r}:e})})}function Eo(i){return Ll(wo,i)}function Al(){return wo}var Co="3.7.8";be.VERSION=Co;be.version=Co;be.mixin=Dl;be.setup=Eo;be.setConfig=Eo;be.getConfig=Al;var Ml=be;function Bl(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var ar=Bl,Nl=ar,Fl=Le;function Kl(i,e,t){Nl(Fl(i),function(r){e.call(t,i[r],r,i)})}var bo=Kl;function Hl(i){return i===null}var De=Hl,Vl=De;function Pl(i,e){return function(t){return Vl(t)?e:t[i]}}var pt=Pl,Yl=Z,Wl=te,zl=pt;function Xl(i,e,t){var r={};if(i)if(e)Wl(e)||(e=zl(e)),Yl(i,function(s,o){r[o]=e.call(t,s,o,i)});else return i;return r}var Gl=Xl;function Ul(i){return i?i.constructor===Object:!1}var xt=Ul;function ql(i){return i!=="__proto__"&&i!=="constructor"}var _o=ql,Ar=z,Mr=xt,Zl=te,Jl=Z,Ql=_o;function Ro(i,e){return Mr(i)&&Mr(e)||Ar(i)&&Ar(e)?(Jl(e,function(t,r){Ql(r)&&(i[r]=Zl(e)?t:Ro(i[r],t))}),i):e}var jl=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&Ro(i,r);return i},ec=jl,tc=Z;function ic(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 rt=ic,rc=me,sc=z;function oc(i,e,t,r,s){return function(o,n,a){if(o&&n){if(i&&o[i])return o[i](n,a);if(e&&sc(o)){for(var c=0,u=o.length;c<u;c++)if(!!n.call(a,o[c],c,o)===r)return[!0,!1,c,o[c]][t]}else for(var d in o)if(rc(o,d)&&!!n.call(a,o[d],d,o)===r)return[!0,!1,d,o[d]][t]}return s}}var pi=oc,nc=pi,ac=nc("some",1,0,!0,!1),Io=ac,lc=pi,cc=lc("every",1,1,!1,!0),So=cc,hc=me;function uc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(hc(i,t)&&e===i[t])return!0}return!1}var mt=uc,Br=z,Nr=mt;function dc(i,e){var t,r=0;if(Br(i)&&Br(e)){for(t=e.length;r<t;r++)if(!Nr(i,e[r]))return!1;return!0}return Nr(i,e)}var $o=dc,Fr=Z,fc=mt,gc=te,vc=pt;function pc(i,e,t){var r=[];if(e){gc(e)||(e=vc(e));var s,o={};Fr(i,function(n,a){s=e.call(t,n,a,i),o[s]||(o[s]=1,r.push(n))})}else Fr(i,function(n){fc(r,n)||r.push(n)});return r}var Oo=pc,xc=rt;function mc(i){return xc(i,function(e){return e})}var lr=mc,yc=Oo,wc=lr;function Ec(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(wc(i[t]));return yc(e)}var Cc=Ec,bc="undefined",ye=bc,_c=ye,Rc=vt,Ic=Rc(_c),Ie=Ic,Sc=De,$c=Ie;function Oc(i){return Sc(i)||$c(i)}var Ae=Oc,Tc=/(.+)?\[(\d+)\]$/,To=Tc;function kc(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var cr=kc,Lc=To,Dc=cr,Ac=me,Mc=Ie,ko=Ae;function Bc(i,e,t){if(ko(i))return t;var r=Fc(i,e);return Mc(r)?t:r}function Nc(i,e){var t=e?e.match(Lc):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function Fc(i,e){if(i){var t,r,s,o=0;if(i[e]||Ac(i,e))return i[e];if(r=Dc(e),s=r.length,s){for(t=i;o<s;o++)if(t=Nc(t,r[o]),ko(t))return o===s-1?t:void 0}return t}}var Bt=Bc,Kr=ee,Kc=lr,Hr=rt,Vr=z,Hc=te,Vc=xt,Pr=Ie,Pc=De,Yc=Ae,Wc=Bt,zc=pt,Xc="asc",Gc="desc";function Zi(i,e){return Pr(i)?1:Pc(i)?Pr(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function Uc(i,e,t){return function(r,s){var o=r[i],n=s[i];return o===n?t?t(r,s):0:e.order===Gc?Zi(n,o):Zi(o,n)}}function qc(i,e,t,r){var s=[];return t=Vr(t)?t:[t],Kr(t,function(o,n){if(o){var a=o,c;Vr(o)?(a=o[0],c=o[1]):Vc(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||Xc}),Kr(e,Hc(a)?function(u,d){u[n]=a.call(r,u.data,d,i)}:function(u){u[n]=a?Wc(u.data,a):u.data})}}),s}function Zc(i,e,t){if(i){if(Yc(e))return Kc(i).sort(Zi);for(var r,s=Hr(i,function(a){return{data:a}}),o=qc(i,s,e,t),n=o.length-1;n>=0;)r=Uc(n,o[n],r),n--;return r&&(s=s.sort(r)),Hr(s,zc("data"))}return[]}var hr=Zc,Jc=hr,Qc=Jc,jc=Qc;function eh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var Lo=eh,th=or,ih=th("values",0),yt=ih,rh=Lo,sh=yt;function oh(i){for(var e,t=[],r=sh(i),s=r.length-1;s>=0;s--)e=s>0?rh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var Do=oh,nh=Do;function ah(i,e){var t=nh(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var lh=ah;function ch(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var Ao=ch,hh=Ao,uh=hh(parseFloat),st=uh,Yr=st;function dh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?Yr(e):0,t=s>=3?Yr(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var ot=dh,fh=Z;function gh(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);fh(i,function(s,o){e.call(t,s,o,i)&&r.push(s)})}return r}var vh=gh,ph=pi,xh=ph("",0,2,!0),mh=xh,yh=pi,wh=yh("find",1,3,!0),Eh=wh,Ch=z,bh=yt;function _h(i,e,t){if(i){Ch(i)||(i=bh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Rh=_h,Ih=Le;function Sh(i,e,t){if(i){var r,s,o=0,n=null,a=t,c=arguments.length>2,u=Ih(i);if(i.length&&i.reduce)return s=function(){return e.apply(n,arguments)},c?i.reduce(s,a):i.reduce(s);for(c&&(o=1,a=i[u[0]]),r=u.length;o<r;o++)a=e.call(n,a,i[u[o]],o,i);return a}}var $h=Sh,Oh=z;function Th(i,e,t,r){if(Oh(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,o,n=e>>0,a=t>>0,c=i.length,u=arguments.length>3?r>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,u=u>=0?u:c+u,a<u)))for(s=0,o=i.slice(a,u);n<c&&!(o.length<=s);n++)i[n]=o[s++];return i}var kh=Th,Lh=z;function Dh(i,e){var t,r=[],s=e>>0||1;if(Lh(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 Ah=Dh,Mh=rt,Bh=pt;function Nh(i,e){return Mh(i,Bh(e))}var Mo=Nh,Fh=te,Wr=Ae,Kh=Bt,Hh=ee;function Vh(i){return function(e,t){if(e&&e.length){var r,s;return Hh(e,function(o,n){t&&(o=Fh(t)?t(o,n,e):Kh(o,t)),!Wr(o)&&(Wr(r)||i(r,o))&&(s=n,r=o)}),e[s]}return r}}var Bo=Vh,Ph=Bo,Yh=Ph(function(i,e){return i<e}),No=Yh,Wh=Mo,zh=No;function Xh(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=zh(i,function(o){return o?o.length:0}),r=t?t.length:0;e<r;e++)s.push(Wh(i,e));return s}var Fo=Xh,Gh=Fo;function Uh(){return Gh(arguments)}var qh=Uh,Zh=yt,Jh=Z;function Qh(i,e){var t={};return e=e||[],Jh(Zh(i),function(r,s){t[r]=e[s]}),t}var jh=Qh,Ko=z,eu=ee;function Ho(i,e){var t=[];return eu(i,function(r){t=t.concat(Ko(r)?e?Ho(r,e):r:[r])}),t}function tu(i,e){return Ko(i)?Ho(i,e):[]}var iu=tu,ru=rt,su=z;function ou(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function nu(i,e){for(var t,r=arguments,s=[],o=[],n=2,a=r.length;n<a;n++)s.push(r[n]);if(su(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return ru(i,function(c){if(o.length&&(c=ou(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var au=nu;function lu(i,e){return(console[i]||console.log)(e)}var cu=lu;function hu(i,e){try{delete i[e]}catch{i[e]=void 0}}var Vo=hu,uu=z,du=ar,fu=bo;function gu(i,e,t){return i&&(uu(i)?du:fu)(i,e,t)}var Po=gu,vu=vt,pu=vu("object"),xi=pu,xu=Vo,mu=xt,yu=xi,wu=z,Eu=De,Cu=ae,bu=Mt;function _u(i,e,t){if(i){var r,s=arguments.length>1&&(Eu(e)||!yu(e)),o=s?t:e;if(mu(i))bu(i,s?function(n,a){i[a]=e}:function(n,a){xu(i,a)}),o&&Cu(i,o);else if(wu(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;o&&i.push.apply(i,o)}}return i}var Yo=_u,Ru=Vo,Iu=te,Su=z,$u=Z,Ou=ee,Tu=Po,ku=Yo,Lu=Ae;function Du(i){return function(e,t){return t===i}}function Au(i,e,t){if(i){if(!Lu(e)){var r=[],s=[];return Iu(e)||(e=Du(e)),$u(i,function(o,n,a){e.call(t,o,n,a)&&r.push(n)}),Su(i)?Tu(r,function(o,n){s.push(i[o]),i.splice(o,1)}):(s={},Ou(r,function(o){s[o]=i[o],Ru(i,o)})),s}return ku(i)}return i}var Wo=Au,Mu=Re,zr=cu,Bu=hr,Nu=nr,Fu=Ae,Ji=Z,Ku=Wo,Hu=ae;function Vu(i,e){Ji(i,function(t){t[e]&&!t[e].length&&Ku(t,e)})}function Pu(i,e){var t=Hu({},Mu.treeOptions,e),r=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,u=t.reverse,d=t.data,f=[],g={},v={},p,x,m;return c&&(i=Bu(Nu(i),c),u&&(i=i.reverse())),Ji(i,function(C){p=C[s],v[p]&&zr("warn","Duplicate primary key="+p),v[p]=!0}),Ji(i,function(C){p=C[s],d?(x={},x[d]=C):x=C,m=C[o],g[p]=g[p]||[],x[s]=p,x[o]=m,p===m&&(m=null,zr("warn","Error infinite Loop. key="+p+" parentKey="+p)),g[m]=g[m]||[],g[m].push(x),x[n]=g[p],a&&(x[a]=g[p]),(!r||r&&Fu(m))&&(v[m]||f.push(x))}),r&&Vu(i,n),f}var Yu=Pu,Wu=Re,zu=ee,Xu=ae;function zo(i,e,t,r){var s=r.key,o=r.parentKey,n=r.children,a=r.data,c=r.updated,u=r.clear;return zu(t,function(d){var f=d[n];a&&(d=d[a]),c!==!1&&(d[o]=e?e[s]:null),i.push(d),f&&f.length&&zo(i,d,f,r),u&&delete d[n]}),i}function Gu(i,e){return zo([],null,i,Xu({},Wu.treeOptions,e))}var Uu=Gu;function qu(i){return function(e,t,r,s){var o=r||{},n=o.children||"children";return i(null,e,t,s,[],[],n,o)}}var mi=qu,Zu=mi;function Xo(i,e,t,r,s,o,n,a){if(e){var c,u,d,f,g,v;for(u=0,d=e.length;u<d;u++){if(c=e[u],f=s.concat([""+u]),g=o.concat([c]),t.call(r,c,u,e,f,i,g))return{index:u,item:c,path:f,items:e,parent:i,nodes:g};if(n&&c&&(v=Xo(c,c[n],t,r,f.concat([n]),g,n),v))return v}}}var Ju=Zu(Xo),Qu=Ju,ju=mi,ed=Z;function Go(i,e,t,r,s,o,n,a){var c,u;ed(e,function(d,f){c=s.concat([""+f]),u=o.concat([d]),t.call(r,d,f,e,c,i,u),d&&n&&(c.push(n),Go(d,d[n],t,r,c,u,n))})}var td=ju(Go),Uo=td,id=mi,rd=rt;function qo(i,e,t,r,s,o,n,a){var c,u,d,f=a.mapChildren||n;return rd(e,function(g,v){return c=s.concat([""+v]),u=o.concat([g]),d=t.call(r,g,v,e,c,i,u),d&&g&&n&&g[n]&&(d[f]=qo(g,g[n],t,r,c,u,n,a)),d})}var sd=id(qo),od=sd,nd=Uo;function ad(i,e,t,r){var s=[];return i&&e&&nd(i,function(o,n,a,c,u,d){e.call(r,o,n,a,c,u,d)&&s.push(o)},t),s}var ld=ad,cd=mi,hd=ee,ud=ae;function Zo(i,e,t,r,s,o,n,a,c){var u,d,f,g,v,p=[],x=c.original,m=c.data,C=c.mapChildren||a,_=c.isEvery;return hd(t,function(w,b){u=o.concat([""+b]),d=n.concat([w]),g=i&&!_||r.call(s,w,b,t,u,e,d),v=a&&w[a],g||v?(x?f=w:(f=ud({},w),m&&(f[m]=w)),f[C]=Zo(g,w,w[a],r,s,u,d,a,c),(g||f[C].length)&&p.push(f)):g&&p.push(f)}),p}var dd=cd(function(i,e,t,r,s,o,n,a){return Zo(0,i,e,t,r,s,o,n,a)}),fd=dd;function gd(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 Jo=gd;function vd(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 Qo=vd,pd=vt,xd=pd("number"),Se=xd,md=Se;function yd(i){return md(i)&&isNaN(i)}var wd=yd,Ed=vt,Cd=Ed("string"),Me=Cd,bd=At,_d=bd("Date"),Xe=_d,Rd=parseInt,Nt=Rd;function Id(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 Sd=Id;function $d(i){return i.getTime()}var he=$d,li=Nt,Xr=Sd,Od=he,Td=Me,kd=Xe;function Ft(i){return"(\\d{"+i+"})"}function Ld(i){return i<10?i*100:i<100?i*10:i}function Gr(i){return isNaN(i)?i:li(i)}var nt=Ft(2),lt=Ft("1,2"),jo=Ft("1,7"),en=Ft("3,4"),tn=".{1}",It=tn+lt,rn="(([zZ])|([-+]\\d{2}:?\\d{2}))",Ur=[en,It,It,It,It,It,tn+jo,rn],Qi=[];for(var Bi=Ur.length-1;Bi>=0;Bi--){for(var qr="",tt=0;tt<Bi+1;tt++)qr+=Ur[tt];Qi.push(new RegExp("^"+qr+"$"))}function Dd(i){for(var e,t={},r=0,s=Qi.length;r<s;r++)if(e=i.match(Qi[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 Zr=[["yyyy",en],["yy",nt],["MM",nt],["M",lt],["dd",nt],["d",lt],["HH",nt],["H",lt],["mm",nt],["m",lt],["ss",nt],["s",lt],["SSS",Ft(3)],["S",jo],["Z",rn]],sn={},on=["\\[([^\\]]+)\\]"];for(var tt=0;tt<Zr.length;tt++){var Ni=Zr[tt];sn[Ni[0]]=Ni[1]+"?",on.push(Ni[0])}var Ad=new RegExp(on.join("|"),"g"),Jr={};function Md(i,e){var t=Jr[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Ad,function(d,f){var g=d.charAt(0);return g==="["?f:(r.push(g),sn[d])});t=Jr[e]={_i:r,_r:new RegExp(s)}}var o={},n=i.match(t._r);if(n){for(var a=t._i,c=1,u=n.length;c<u;c++)o[a[c-1]]=n[c];return o}return o}function Bd(i){if(/^[zZ]/.test(i.Z))return new Date(Xr(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(Xr(i)-(e[1]==="-"?-1:1)*li(e[2])*36e5+li(e[3])*6e4):new Date("")}function Nd(i,e){if(i){var t=kd(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?Od(i):li(i));if(Td(i)){var r=e?Md(i,e):Dd(i);if(r.y)return r.M&&(r.M=Gr(r.M)-1),r.S&&(r.S=Ld(Gr(r.S.substring(0,3)))),r.Z?Bd(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 ie=Nd;function Fd(){return new Date}var yi=Fd,Kd=Xe,Hd=ie,Vd=yi;function Pd(i){var e,t=i?Hd(i):Vd();return Kd(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var nn=Pd,Yd=z,Wd=me;function zd(i,e,t){if(i){if(Yd(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var o in i)if(Wd(i,o)&&e.call(t,i[o],o,i)===!1)break}}var Xd=zd,Gd=z,Ud=me;function qd(i,e,t){if(i){var r,s;if(Gd(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=Ud(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var Zd=qd,Jd=z,Qd=Me,jd=me;function ef(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(Qd(t)||Jd(t))return e(t,r);for(var s in t)if(jd(t,s)&&r===t[s])return s}return-1}}var an=ef,tf=an,rf=Jo,sf=tf("indexOf",rf),of=sf,nf=an,af=Qo,lf=nf("lastIndexOf",af),ln=lf,cf=z,hf=Me,uf=Z;function df(i){var e=0;return hf(i)||cf(i)?i.length:(uf(i,function(){e++}),e)}var cn=df,ff=Se;function gf(i){return ff(i)&&isFinite(i)}var vf=gf,pf=z,xf=De,mf=function(i){return!xf(i)&&!isNaN(i)&&!pf(i)&&i%1===0},hn=mf,yf=z,wf=hn,Ef=De;function Cf(i){return!Ef(i)&&!isNaN(i)&&!yf(i)&&!wf(i)}var bf=Cf,_f=vt,Rf=_f("boolean"),un=Rf,If=At,Sf=If("RegExp"),ur=Sf,$f=At,Of=$f("Error"),dn=Of;function Tf(i){return i?i.constructor===TypeError:!1}var kf=Tf;function Lf(i){for(var e in i)return!1;return!0}var fn=Lf,Df=ye,Af=typeof Symbol!==Df;function Mf(i){return Af&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var gn=Mf,Bf=At,Nf=Bf("Arguments"),Ff=Nf,Kf=Me,Hf=Se;function Vf(i){return!!(i&&Kf(i.nodeName)&&Hf(i.nodeType))}var Pf=Vf,Yf=ye,Wf=typeof document===Yf?0:document,dr=Wf,zf=dr;function Xf(i){return!!(i&&zf&&i.nodeType===9)}var Gf=Xf,Uf=ye,qf=typeof window===Uf?0:window,vn=qf,Zf=vn;function Jf(i){return!!(Zf&&(i&&i===i.window))}var Qf=Jf,jf=ye,eg=typeof FormData!==jf;function tg(i){return eg&&i instanceof FormData}var ig=tg,rg=ye,sg=typeof Map!==rg;function og(i){return sg&&i instanceof Map}var ng=og,ag=ye,lg=typeof WeakMap!==ag;function cg(i){return lg&&i instanceof WeakMap}var hg=cg,ug=ye,dg=typeof Set!==ug;function fg(i){return dg&&i instanceof Set}var gg=fg,vg=ye,pg=typeof WeakSet!==vg;function xg(i){return pg&&i instanceof WeakSet}var mg=xg,yg=te,wg=Me,Eg=z,Cg=me;function bg(i){return function(e,t,r){if(e&&yg(t)){if(Eg(e)||wg(e))return i(e,t,r);for(var s in e)if(Cg(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var pn=bg,_g=pn,Rg=_g(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}),fr=Rg,Qr=Se,jr=z,es=Me,Ig=ur,Sg=Xe,$g=un,Og=Ie,ts=Le,Tg=So;function xn(i,e,t,r,s,o,n){if(i===e)return!0;if(i&&e&&!Qr(i)&&!Qr(e)&&!es(i)&&!es(e)){if(Ig(i))return t(""+i,""+e,s,o,n);if(Sg(i)||$g(i))return t(+i,+e,s,o,n);var a,c,u,d=jr(i),f=jr(e);if(d||f?d&&f:i.constructor===e.constructor)return c=ts(i),u=ts(e),r&&(a=r(i,e,s)),c.length===u.length?Og(a)?Tg(c,function(g,v){return g===u[v]&&xn(i[g],e[u[v]],t,r,d||f?v:g,i,e)}):!!a:!1}return t(i,e,s,o,n)}var mn=xn;function kg(i,e){return i===e}var yn=kg,Lg=mn,Dg=yn;function Ag(i,e){return Lg(i,e,Dg)}var wn=Ag,is=Le,Mg=fr,rs=wn,Bg=Io,Ng=$o;function Fg(i,e){var t=is(i),r=is(e);if(r.length){if(Ng(t,r))return Bg(r,function(s){return Mg(t,function(o){return o===s&&rs(i[o],e[s])})>-1})}else return!0;return rs(i,e)}var Kg=Fg,ss=mn,os=yn,Hg=te,Vg=Ie;function Pg(i,e,t){return Hg(t)?ss(i,e,function(r,s,o,n,a){var c=t(r,s,o,n,a);return Vg(c)?os(r,s):!!c},t):ss(i,e,os)}var Yg=Pg,Wg=gn,zg=Xe,Xg=z,Gg=ur,Ug=dn,qg=De;function Zg(i){return qg(i)?"null":Wg(i)?"symbol":zg(i)?"date":Xg(i)?"array":Gg(i)?"regexp":Ug(i)?"error":typeof i}var Jg=Zg,Qg=Re,jg=Ae;function ev(i){return""+(jg(i)?"":i)+Qg.keyId++}var tv=ev,iv=pn,rv=iv(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}),sv=rv,ov=xt,nv=Me;function av(i){if(ov(i))return i;if(nv(i))try{return JSON.parse(i)}catch{}return{}}var lv=av,cv=Ae;function hv(i){return cv(i)?"":JSON.stringify(i)}var uv=hv,dv=or,fv=dv("entries",2),gv=fv,vv=te,pv=z,xv=Z,mv=fr;function yv(i,e){return function(t,r){var s,o,n={},a=[],c=this,u=arguments,d=u.length;if(!vv(r)){for(o=1;o<d;o++)s=u[o],a.push.apply(a,pv(s)?s:[s]);r=0}return xv(t,function(f,g){((r?r.call(c,f,g,t):mv(a,function(v){return v===g})>-1)?i:e)&&(n[g]=f)}),n}}var En=yv,wv=En,Ev=wv(1,0),Cv=Ev,bv=En,_v=bv(0,1),Rv=_v,Iv=yt;function Sv(i){return Iv(i)[0]}var $v=Sv,Ov=yt;function Tv(i){var e=Ov(i);return e[e.length-1]}var kv=Tv,Lv=To,Dv=cr,jt=me;function Av(i,e){if(i){if(jt(i,e))return!0;var t,r,s,o,n,a,c=Dv(e),u=0,d=c.length;for(n=i;u<d&&(a=!1,t=c[u],o=t?t.match(Lv):"",o?(r=o[1],s=o[2],r?n[r]&&jt(n[r],s)&&(a=!0,n=n[r][s]):jt(n,s)&&(a=!0,n=n[s])):jt(n,t)&&(a=!0,n=n[t]),a);u++)if(u===d-1)return!0}return!1}var Mv=Av,ns=Nt,Bv=cr,Nv=_o,Fv=me,as=/(.+)?\[(\d+)\]$/;function Kv(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var o,n,a=e?e.match(as):null;if(t)n=s;else{var c=r?r.match(as):null;c&&!c[1]?n=new Array(ns(c[2])+1):n={}}return a?a[1]?(o=ns(a[2]),i[a[1]]?t?i[a[1]][o]=n:i[a[1]][o]?n=i[a[1]][o]:i[a[1]][o]=n:(i[a[1]]=new Array(o+1),i[a[1]][o]=n)):i[a[2]]=n:i[e]=n,n}return i[e]}function Hv(i,e,t){if(i&&Nv(e)){if((i[e]||Fv(i,e))&&!ls(e))i[e]=t;else for(var r=i,s=Bv(e),o=s.length,n=0;n<o;n++)if(!ls(s[n])){var a=n===o-1;r=Kv(r,s[n],a,a?null:s[n+1],t)}}return i}function ls(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var Vv=Hv,Pv=fn,Yv=xi,Wv=te,zv=pt,Xv=Z;function Gv(i){return function(){return Pv(i)}}function Uv(i,e,t){var r,s={};return i&&(e&&Yv(e)?e=Gv(e):Wv(e)||(e=zv(e)),Xv(i,function(o,n){r=e?e.call(t,o,n,i):o,s[r]?s[r].push(o):s[r]=[o]})),s}var Cn=Uv,qv=Cn,Zv=Mt;function Jv(i,e,t){var r=qv(i,e,t||this);return Zv(r,function(s,o){r[o]=s.length}),r}var Qv=Jv;function jv(i,e,t){var r,s,o=[],n=arguments;if(n.length<2&&(e=n[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)o.push(r);return o}var bn=jv,cs=Le,ep=ot,tp=mt,ip=ee,rp=ae;function sp(i,e){if(i&&e){var t=rp.apply(this,[{}].concat(ep(arguments,1))),r=cs(t);ip(cs(i),function(s){tp(r,s)&&(i[s]=t[s])})}return i}var op=sp,np=Bo,ap=np(function(i,e){return i>e}),lp=ap;function cp(i){return(i.split(".")[1]||"").length}var wi=cp,hp=Nt;function up(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(hp(e));return t.join(i)+(t.length>0?i:"")}var Kt=up;function dp(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var _n=dp,ei=Kt,Fi=_n;function fp(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],u=t[8],d=u-a.length,f=u-o.length,g=u-n.length;return c==="+"?o?s+o+ei("0",u):d>0?s+n+a+ei("0",d):s+n+Fi(a,u):o?f>0?s+"0."+ei("0",Math.abs(f))+o:s+Fi(o,f):g>0?s+"0."+ei("0",Math.abs(g))+n+a:s+Fi(n,g)+a}return e}var Ge=fp,hs=wi,us=Ge;function gp(i,e){var t=us(i),r=us(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,hs(t)+hs(r))}var Rn=gp,vp=Rn,ds=st,pp=Ge;function xp(i){return function(e,t){var r=ds(e),s=r;if(r){t=t>>0;var o=pp(r),n=o.split("."),a=n[0],c=n[1]||"",u=c.substring(0,t+1),d=a+(u?"."+u:"");if(t>=c.length)return ds(d);if(d=r,t>0){var f=Math.pow(10,t);s=Math[i](vp(d,f))/f}else s=Math[i](d)}return s}}var gr=xp,mp=gr,yp=mp("round"),vr=yp,wp=gr,Ep=wp("ceil"),In=Ep,Cp=gr,bp=Cp("floor"),Sn=bp,_p=Ae,Rp=Se,Ip=Ge;function Sp(i){return Rp(i)?Ip(i):""+(_p(i)?"":i)}var re=Sp,$p=vr,Op=re,Tp=Kt,kp=_n;function Lp(i,e){e=e>>0;var t=Op($p(i,e)),r=t.split("."),s=r[0],o=r[1]||"",n=e-o.length;return e?n>0?s+"."+o+Tp("0",n):s+kp(o,Math.abs(n)):s}var pr=Lp,Dp=Re,Ap=vr,Mp=In,Bp=Sn,Np=Se,Fp=re,Kp=pr,Hp=Ge,Vp=ae;function Pp(i,e){var t=Vp({},Dp.commafyOptions,e),r=t.digits,s=Np(i),o,n,a,c,u;return s?(o=(t.ceil?Mp:t.floor?Bp:Ap)(i,r),n=Hp(r?Kp(o,r):o).split("."),c=n[0],u=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=Fp(i).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(u?"."+u:""):o}var Yp=Pp,Wp=Nt,zp=Ao,Xp=zp(Wp),Gp=Xp,Up=Rn,fs=st;function qp(i,e){var t=fs(i),r=fs(e);return Up(t,r)}var xr=qp,gs=wi,vs=Ge,ps=xr;function Zp(i,e){var t=vs(i),r=vs(e),s=Math.pow(10,Math.max(gs(t),gs(r)));return(ps(i,s)+ps(e,s))/s}var $n=Zp,Jp=$n,xs=st;function Qp(i,e){return Jp(xs(i),xs(e))}var jp=Qp,ms=wi,ys=Ge,ws=st,ex=pr;function tx(i,e){var t=ws(i),r=ws(e),s=ys(t),o=ys(r),n=ms(s),a=ms(o),c=Math.pow(10,Math.max(n,a)),u=n>=a?n:a;return parseFloat(ex((t*c-r*c)/c,u))}var ix=tx,Es=wi,Cs=Ge,rx=xr;function sx(i,e){var t=Cs(i),r=Cs(e),s=Es(t),o=Es(r),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return rx(t.replace(".","")/r.replace(".",""),a?1/c:c)}var On=sx,ox=On,bs=st;function nx(i,e){return ox(bs(i),bs(e))}var ax=nx,Ki=$n,lx=te,cx=z,hx=Z,ux=Bt;function dx(i,e,t){var r=0;return hx(i&&i.length>2&&cx(i)?i.sort():i,e?lx(e)?function(){r=Ki(r,e.apply(t,arguments))}:function(s){r=Ki(r,ux(s,e))}:function(s){r=Ki(r,s)}),r}var Tn=dx,fx=On,gx=cn,vx=Tn;function px(i,e,t){return fx(vx(i,e,t),gx(i))}var xx=px,mx="first",Ht=mx,yx="last",Ei=yx;function wx(i){return i.getFullYear()}var Vt=wx,Ex=864e5,wt=Ex;function Cx(i){return i.getMonth()}var Ci=Cx,bx=Xe,_x=he;function Rx(i){return bx(i)&&!isNaN(_x(i))}var ue=Rx,_s=Ht,Ix=Ei,Sx=wt,$x=Vt,Rs=he,Is=Ci,Ox=ie,Tx=ue,kx=Se;function kn(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=Ox(i),Tx(i)){if(t===_s)return new Date($x(i),Is(i)+r,1);if(t===Ix)return new Date(Rs(kn(i,r+1,_s))-1);if(kx(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(Is(i)+r),s!==i.getDate())return i.setDate(1),new Date(Rs(i)-Sx)}}return i}var Pt=kn,Lx=Ht,Ss=Ei,$s=Vt,Dx=Pt,Ax=ie,Mx=ue;function Bx(i,e,t){var r;if(i=Ax(i),Mx(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear($s(i)+r)),t||!isNaN(t))){if(t===Lx)return new Date($s(i),0,1);if(t===Ss)return i.setMonth(11),Dx(i,0,Ss);i.setMonth(t)}return i}var bi=Bx,Nx=Pt,Fx=ie,Kx=ue;function Hx(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function Vx(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=Fx(i),Kx(i)?(r=(Hx(i)-1)*3,i.setMonth(r),Nx(i,s,t)):i}var Px=Vx,Os=Ht,Yx=Ei,Wx=Nt,zx=Vt,Xx=Ci,Gx=he,Ux=ie,qx=ue;function Ln(i,e,t){if(i=Ux(i),qx(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Wx(e)),t===Os)return new Date(zx(i),Xx(i),i.getDate());if(t===Yx)return new Date(Gx(Ln(i,1,Os))-1)}return i}var Dn=Ln;function Zx(i){return i.toUpperCase()}var An=Zx,Jx=wt,Qx=Jx*7,Mn=Qx,jx=Re,Hi=wt,em=Mn,tm=he,im=ie,rm=ue,Ts=Se;function sm(i,e,t,r){if(i=im(i),rm(i)){var s=Ts(t),o=Ts(r),n=tm(i);if(s||o){var a=o?r:jx.firstDayOfWeek,c=i.getDay(),u=s?t:c;if(c!==u){var d=0;a>c?d=-(7-a+c):a<c&&(d=a-c),u>a?n+=((u===0?7:u)-a+d)*Hi:u<a?n+=(7-a+u+d)*Hi:n+=d*Hi}}return e&&!isNaN(e)&&(n+=e*em),new Date(n)}return i}var Bn=sm,om=Re,ti=wt,nm=Mn,am=Se,lm=mt,cm=ie,hm=ue,ks=Bn,um=bn,dm=rt,ii=he,fm=dm(um(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function Ls(i,e){var t=new Date(i).getDay();return lm(fm[e],t)}function gm(i,e){return function(t,r){var s=am(r)?r:om.firstDayOfWeek,o=cm(t);if(hm(o)){var n=ks(o,0,s,s),a=i(n),c=ii(a),u=ii(n),d=u+ti*6,f=new Date(d),g=ks(a,0,s,s),v=ii(g),p;if(u===v)return 1;if(e(n,f)){for(p=ii(i(f));p<d;p+=ti)if(Ls(p,s))return 1}var x=v+ti*6,m=new Date(d),C=1;if(e(g,m)){for(C=0,p=c;p<x;p+=ti)if(Ls(p,s)){C++;break}}return Math.floor((u-v)/nm)+C}return NaN}}var Nn=gm,vm=Nn,pm=vm(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),Fn=pm,xm=Vt,mm=Ci;function ym(i){return new Date(xm(i),mm(i),i.getDate())}var wm=ym,Em=he,Cm=wm;function bm(i){return Em(Cm(i))}var _m=bm,Rm=wt,Im=Ht,Ds=_m,Sm=bi,$m=ie,Om=ue;function Tm(i){return i=$m(i),Om(i)?Math.floor((Ds(i)-Ds(Sm(i,0,Im)))/Rm)+1:NaN}var Kn=Tm,km=re,Lm=Ie,Dm=Kt;function Am(i,e,t){var r=km(i);return e=e>>0,t=Lm(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=Dm(t,e/t.length)),t.slice(0,e)+r):r}var Hn=Am,St=Re,Mm=An,Bm=Vt,As=Ci,Nm=ie,Fm=Fn,Km=Kn,Hm=ae,Vm=ue,Pm=te,Ce=Hn;function Ke(i,e,t,r){var s=e[t];return s?Pm(s)?s(r,t,i):s[r]:r}var Ym=/\[([^\]]+)]|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 Wm(i,e,t){if(i){if(i=Nm(i),Vm(i)){var r=e||St.parseDateFormat||St.formatString,s=i.getHours(),o=s<12?"am":"pm",n=Hm({},St.parseDateRules||St.formatStringMatchs,t?t.formats:null),a=function(w,b){return(""+Bm(i)).substr(4-b)},c=function(w,b){return Ce(As(i)+1,b,"0")},u=function(w,b){return Ce(i.getDate(),b,"0")},d=function(w,b){return Ce(s,b,"0")},f=function(w,b){return Ce(s<=12?s:s-12,b,"0")},g=function(w,b){return Ce(i.getMinutes(),b,"0")},v=function(w,b){return Ce(i.getSeconds(),b,"0")},p=function(w,b){return Ce(i.getMilliseconds(),b,"0")},x=function(w,b){var E=i.getTimezoneOffset()/60*-1;return Ke(i,n,w,(E>=0?"+":"-")+Ce(E,2,"0")+(b===1?":":"")+"00")},m=function(w,b){return Ce(Ke(i,n,w,Fm(i,(t?t.firstDay:null)||St.firstDayOfWeek)),b,"0")},C=function(w,b){return Ce(Ke(i,n,w,Km(i)),b,"0")},_={yyyy:a,yy:a,MM:c,M:c,dd:u,d:u,HH:d,H:d,hh:f,h:f,mm:g,m:g,ss:v,s:v,SSS:p,S:p,ZZ:x,Z:x,WW:m,W:m,DDD:C,D:C,a:function(w){return Ke(i,n,w,o)},A:function(w){return Ke(i,n,w,Mm(o))},e:function(w){return Ke(i,n,w,i.getDay())},E:function(w){return Ke(i,n,w,i.getDay())},q:function(w){return Ke(i,n,w,Math.floor((As(i)+3)/3))}};return r.replace(Ym,function(w,b){return b||(_[w]?_[w](w,w.length):w)})}return"Invalid Date"}return""}var Vn=Wm,zm=he,Xm=yi,Gm=Date.now||function(){return zm(Xm())},Pn=Gm,Um=he,qm=Pn,Zm=ie,Jm=Xe,Qm=function(i,e){if(i){var t=Zm(i,e);return Jm(t)?Um(t):t}return qm()},jm=Qm,Ms=Vn;function e1(i,e,t){return i&&e?(i=Ms(i,t),i!=="Invalid Date"&&i===Ms(e,t)):!1}var t1=e1,i1=Nn,r1=i1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),s1=r1,o1=bi,n1=ie,a1=ue,l1=nn;function c1(i,e){return i=n1(i),a1(i)?l1(o1(i,e))?366:365:NaN}var h1=c1,u1=wt,d1=Ht,f1=Ei,Bs=he,Ns=Pt,g1=ie,v1=ue;function p1(i,e){return i=g1(i),v1(i)?Math.floor((Bs(Ns(i,e,f1))-Bs(Ns(i,e,d1)))/u1)+1:NaN}var x1=p1,Fs=he,m1=yi,Ks=ie,Hs=ue,Vs=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function y1(i,e){var t,r,s,o,n,a,c={done:!1,time:0};if(i=Ks(i),e=e?Ks(e):m1(),Hs(i)&&Hs(e)&&(t=Fs(i),r=Fs(e),t<r))for(o=c.time=r-t,c.done=!0,a=0,n=Vs.length;a<n;a++)s=Vs[a],o>=s[1]?a===n-1?c[s[0]]=o||0:(c[s[0]]=Math.floor(o/s[1]),o-=c[s[0]]*s[1]):c[s[0]]=0;return c}var w1=y1,E1=re,C1=Ie,b1=Kt;function _1(i,e,t){var r=E1(i);return e=e>>0,t=C1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=b1(t,e/t.length)),r+t.slice(0,e)):r}var R1=_1,I1=re,S1=Kt;function $1(i,e){return S1(I1(i),e)}var O1=$1,T1=re;function k1(i){return i&&i.trimRight?i.trimRight():T1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Yn=k1,L1=re;function D1(i){return i&&i.trimLeft?i.trimLeft():L1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var Wn=D1,A1=Yn,M1=Wn;function B1(i){return i&&i.trim?i.trim():A1(M1(i))}var zn=B1,N1={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#x27;","`":"&#x60;"},Xn=N1,F1=re,K1=Le;function H1(i){var e=new RegExp("(?:"+K1(i).join("|")+")","g");return function(t){return F1(t).replace(e,function(r){return i[r]})}}var Gn=H1,V1=Xn,P1=Gn,Y1=P1(V1),W1=Y1,Ps=Xn,z1=Gn,X1=Z,Un={};X1(Ps,function(i,e){Un[Ps[e]]=e});var G1=z1(Un),U1=G1;function q1(i,e,t){return i.substring(e,t)}var qn=q1;function Z1(i){return i.toLowerCase()}var Zn=Z1,J1=re,He=qn,$t=An,Q1=Zn,Vi={};function j1(i){if(i=J1(i),Vi[i])return Vi[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,o){var n=s.length;return s=Q1(s),o?n>2&&o+n<e?$t(He(s,0,1))+He(s,1,n-1)+$t(He(s,n-1,n)):$t(He(s,0,1))+He(s,1,n):n>1&&o+n<e?He(s,0,n-1)+$t(He(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return $t(He(s,1,s.length))}),Vi[i]=t,t}var e0=j1,t0=re,at=qn,Ve=Zn,Pi={};function i0(i){if(i=t0(i),Pi[i])return Pi[i];if(/^[A-Z]+$/.test(i))return Ve(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,o){var n=s.length;return n>1?r+"-"+Ve(at(s,0,n-1))+"-"+Ve(at(s,n-1,n))+o:Ve(r+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var o=r.length;return Ve(at(r,0,o-1)+"-"+at(r,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,o,n){var a=s.length;return a>1&&(r&&(r+="-"),o)?(r||"")+Ve(at(s,0,a-1))+"-"+Ve(at(s,a-1,a))+o:(r||"")+(n?"-":"")+Ve(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),Pi[i]=e,e}var r0=i0,s0=re;function o0(i,e,t){var r=s0(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var n0=o0,a0=re;function l0(i,e,t){var r=a0(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var c0=l0,h0=Re,u0=re,d0=zn,f0=Bt;function g0(i,e,t){return u0(i).replace((t||h0).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return f0(e,d0(s))})}var Jn=g0,v0=Jn;function p0(i,e){return v0(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var x0=p0;function m0(){}var y0=m0,Ys=ot;function w0(i,e){var t=Ys(arguments,2);return function(){return i.apply(e,Ys(arguments).concat(t))}}var E0=w0,Ws=ot;function C0(i,e){var t=!1,r=null,s=Ws(arguments,2);return function(){return t||(r=i.apply(e,Ws(arguments).concat(s)),t=!0),r}}var b0=C0,_0=ot;function R0(i,e,t){var r=0,s=[];return function(){var o=arguments;r++,r<=i&&s.push(o[0]),r>=i&&e.apply(t,[s].concat(_0(o)))}}var I0=R0,S0=ot;function $0(i,e,t){var r=0,s=[];return t=t||this,function(){var o=arguments;r++,r<i&&(s.push(o[0]),e.apply(t,[s].concat(S0(o))))}}var O0=$0,T0=ae;function k0(i,e,t){var r=null,s=null,o=!1,n=null,a=T0({leading:!0,trailing:!0},t),c=a.leading,u=a.trailing,d=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),n=setTimeout(g,e),d()},g=function(){if(n=null,o){d();return}if(u===!0){f();return}d()},v=function(){var x=n!==null;return x&&clearTimeout(n),d(),n=null,o=!1,x},p=function(){if(r=arguments,s=this,o=!1,n===null&&c===!0){f();return}u===!0&&(n=setTimeout(g,e))};return p.cancel=v,p}var L0=k0,D0=ae;function A0(i,e,t){var r=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:D0({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,u=o.trailing,d=function(){r=null,s=null},f=function(){n=!0,i.apply(s,r),d()},g=function(){if(c===!0&&(a=null),n){d();return}if(u===!0){f();return}d()},v=function(){var x=a!==null;return x&&clearTimeout(a),d(),a=null,n=!1,x},p=function(){n=!1,r=arguments,s=this,a===null?c===!0&&f():clearTimeout(a),a=setTimeout(g,e)};return p.cancel=v,p}var M0=A0,B0=ot;function N0(i,e){var t=B0(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var F0=N0,K0=decodeURIComponent,Qn=K0,zs=Qn,H0=ee,V0=Me;function P0(i){var e,t={};return i&&V0(i)&&H0(i.split("&"),function(r){e=r.split("="),t[zs(e[0])]=zs(e[1]||"")}),t}var jn=P0,Y0=encodeURIComponent,ea=Y0,ci=ea,ta=Z,ia=z,ra=De,W0=Ie,sa=xt;function oa(i,e,t){var r,s=[];return ta(i,function(o,n){r=ia(o),sa(o)||r?s=s.concat(oa(o,e+"["+n+"]",r)):s.push(ci(e+"["+(t?"":n)+"]")+"="+ci(ra(o)?"":o))}),s}function z0(i){var e,t=[];return ta(i,function(r,s){W0(r)||(e=ia(r),sa(r)||e?t=t.concat(oa(r,s,e)):t.push(ci(s)+"="+ci(ra(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var X0=z0,G0=ye,U0=typeof location===G0?0:location,_i=U0,ri=_i;function q0(){return ri?ri.origin||ri.protocol+"//"+ri.host:""}var na=q0,Xs=_i,Z0=jn,J0=na;function Gs(i){return Z0(i.split("?")[1]||"")}function Q0(i){var e,t,r,s,o=""+i;return o.indexOf("//")===0?o=(Xs?Xs.protocol:"")+o:o.indexOf("/")===0&&(o=J0()+o),r=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,c){return t=c||"",s.port=t.replace(":",""),s.hostname=a,s.host=a+t,"/"}).replace(/(#.*)/,function(n,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=Gs(s.hash),s.searchQuery=Gs(s.search),s}var aa=Q0,Us=_i,j0=na,ey=ln;function ty(){if(Us){var i=Us.pathname,e=ey(i,"/")+1;return j0()+(e===i.length?i:i.substring(0,e))}return""}var iy=ty,qs=_i,ry=aa;function sy(){return qs?ry(qs.href):{}}var oy=sy,la=Re,Yi=dr,Zs=Qn,Js=ea,ny=z,Qs=xi,ca=Xe,ay=Ie,ly=mt,cy=Le,hi=ae,Wi=ee,hy=yi,si=he,uy=bi,dy=Pt,fy=Dn;function js(i,e){var t=parseFloat(e),r=hy(),s=si(r);switch(i){case"y":return si(uy(r,t));case"M":return si(dy(r,t));case"d":return si(fy(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 zi(i){return(ca(i)?i:new Date(i)).toUTCString()}function Pe(i,e,t){if(Yi){var r,s,o,n,a,c,u=[],d=arguments;return ny(i)?u=i:d.length>1?u=[hi({name:i,value:e},t)]:Qs(i)&&(u=[i]),u.length>0?(Wi(u,function(f){r=hi({},la.cookies,f),o=[],r.name&&(s=r.expires,o.push(Js(r.name)+"="+Js(Qs(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,v,p){return zi(js(p,v))}):/^[0-9]{11,13}$/.test(s)||ca(s)?s=zi(s):s=zi(js("d",s)),r.expires=s),Wi(["expires","path","domain","secure"],function(g){ay(r[g])||o.push(r[g]&&g==="secure"?g:g+"="+r[g])})),Yi.cookie=o.join("; ")}),!0):(n={},a=Yi.cookie,a&&Wi(a.split("; "),function(f){c=f.indexOf("="),n[Zs(f.substring(0,c))]=Zs(f.substring(c+1)||"")}),d.length===1?n[i]:n)}return!1}function gy(i){return ly(ha(),i)}function eo(i){return Pe(i)}function to(i,e,t){return Pe(i,e,t),Pe}function io(i,e){Pe(i,"",hi({expires:-1},la.cookies,e))}function ha(){return cy(Pe())}function vy(){return Pe()}hi(Pe,{has:gy,set:to,setItem:to,get:eo,getItem:eo,remove:io,removeItem:io,keys:ha,getJSON:vy});var py=Pe,xy=ye,Xi=dr,Gi=vn,my=ae,yy=ee;function ro(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function oi(i){return navigator.userAgent.indexOf(i)>-1}function wy(){var i,e,t,r=!1,s=!1,o=!1,n={isNode:!1,isMobile:r,isPC:!1,isDoc:!!Xi};if(!Gi&&typeof process!==xy)n.isNode=!0;else{t=oi("Edge"),e=oi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(i=Xi.body||Xi.documentElement,yy(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!i[a+"MatchesSelector"]}));try{s=ro(Gi.localStorage)}catch{}try{o=ro(Gi.sessionStorage)}catch{}my(n,{edge:t,firefox:oi("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&oi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:o})}return n}var Ey=wy,ua=Ml,so=ae,Cy=Mt,by=bo,_y=Gl,Ry=ec,Iy=rt,Sy=Io,$y=So,Oy=$o,Ty=ee,ky=ar,Ly=Oo,Dy=Cc,Ay=lr,My=jc,By=hr,Ny=Do,Fy=lh,Ky=ot,Hy=vh,Vy=mh,Py=mt,Yy=Eh,Wy=Rh,zy=$h,Xy=kh,Gy=Ah,Uy=qh,qy=Fo,Zy=jh,Jy=iu,Qy=Mo,jy=au,e2=Yu,t2=Uu,i2=Qu,r2=Uo,s2=od,o2=ld,n2=fd,a2=Jo,l2=Qo,c2=me,h2=z,u2=De,d2=wd,f2=Ie,g2=te,v2=xi,p2=Me,x2=xt,m2=nn,y2=Xe,w2=Ae,E2=Z,C2=Xd,b2=Zd,_2=of,R2=ln,I2=Le,S2=yt,$2=nr,O2=cn,T2=Po,k2=Wo,L2=Yo,D2=vf,A2=bf,M2=hn,B2=un,N2=Se,F2=ur,K2=dn,H2=kf,V2=fn,P2=gn,Y2=Ff,W2=Pf,z2=Gf,X2=Qf,G2=ig,U2=ng,q2=hg,Z2=gg,J2=mg,Q2=Kg,j2=wn,ew=Yg,tw=Jg,iw=tv,rw=fr,sw=sv,ow=lv,nw=uv,aw=gv,lw=Cv,cw=Rv,hw=$v,uw=kv,dw=Mv,fw=Bt,gw=Vv,vw=Cn,pw=Qv,xw=bn,mw=op,yw=Lo,ww=No,Ew=lp,Cw=Yp,bw=vr,_w=In,Rw=Sn,Iw=pr,Sw=Gp,$w=st,Ow=Ge,Tw=jp,kw=ix,Lw=xr,Dw=ax,Aw=Tn,Mw=xx,Bw=bi,Nw=Px,Fw=Pt,Kw=Dn,Hw=ie,Vw=Vn,Pw=Pn,Yw=jm,Ww=ue,zw=t1,Xw=Bn,Gw=Kn,Uw=Fn,qw=s1,Zw=h1,Jw=x1,Qw=w1,jw=R1,eE=Hn,tE=O1,iE=zn,rE=Yn,sE=Wn,oE=W1,nE=U1,aE=e0,lE=r0,cE=n0,hE=c0,uE=Jn,dE=x0,oo=re,fE=y0,gE=pt,vE=E0,pE=b0,xE=I0,mE=O0,yE=L0,wE=M0,EE=F0,CE=jn,bE=X0,_E=aa,RE=iy,IE=oy,SE=py,$E=Ey;so(ua,{assign:so,objectEach:Cy,lastObjectEach:by,objectMap:_y,merge:Ry,uniq:Ly,union:Dy,sortBy:My,orderBy:By,shuffle:Ny,sample:Fy,some:Sy,every:$y,slice:Ky,filter:Hy,find:Yy,findLast:Wy,findKey:Vy,includes:Py,arrayIndexOf:a2,arrayLastIndexOf:l2,map:Iy,reduce:zy,copyWithin:Xy,chunk:Gy,zip:Uy,unzip:qy,zipObject:Zy,flatten:Jy,toArray:Ay,includeArrays:Oy,pluck:Qy,invoke:jy,arrayEach:Ty,lastArrayEach:ky,toArrayTree:e2,toTreeArray:t2,findTree:i2,eachTree:r2,mapTree:s2,filterTree:o2,searchTree:n2,hasOwnProp:c2,eqNull:w2,isNaN:d2,isFinite:D2,isUndefined:f2,isArray:h2,isFloat:A2,isInteger:M2,isFunction:g2,isBoolean:B2,isString:p2,isNumber:N2,isRegExp:F2,isObject:v2,isPlainObject:x2,isDate:y2,isError:K2,isTypeError:H2,isEmpty:V2,isNull:u2,isSymbol:P2,isArguments:Y2,isElement:W2,isDocument:z2,isWindow:X2,isFormData:G2,isMap:U2,isWeakMap:q2,isSet:Z2,isWeakSet:J2,isLeapYear:m2,isMatch:Q2,isEqual:j2,isEqualWith:ew,getType:tw,uniqueId:iw,getSize:O2,indexOf:_2,lastIndexOf:R2,findIndexOf:rw,findLastIndexOf:sw,toStringJSON:ow,toJSONString:nw,keys:I2,values:S2,entries:aw,pick:lw,omit:cw,first:hw,last:uw,each:E2,forOf:C2,lastForOf:b2,lastEach:T2,has:dw,get:fw,set:gw,groupBy:vw,countBy:pw,clone:$2,clear:L2,remove:k2,range:xw,destructuring:mw,random:yw,min:Ew,max:ww,commafy:Cw,round:bw,ceil:_w,floor:Rw,toFixed:Iw,toNumber:$w,toNumberString:Ow,toInteger:Sw,add:Tw,subtract:kw,multiply:Lw,divide:Dw,sum:Aw,mean:Mw,now:Pw,timestamp:Yw,isValidDate:Ww,isDateSame:zw,toStringDate:Hw,toDateString:Vw,getWhatYear:Bw,getWhatQuarter:Nw,getWhatMonth:Fw,getWhatWeek:Xw,getWhatDay:Kw,getYearDay:Gw,getYearWeek:Uw,getMonthWeek:qw,getDayOfYear:Zw,getDayOfMonth:Jw,getDateDiff:Qw,trim:iE,trimLeft:sE,trimRight:rE,escape:oE,unescape:nE,camelCase:aE,kebabCase:lE,repeat:tE,padStart:eE,padEnd:jw,startsWith:cE,endsWith:hE,template:uE,toFormatString:dE,toString:oo,toValueString:oo,noop:fE,property:gE,bind:vE,once:pE,after:xE,before:mE,throttle:yE,debounce:wE,delay:EE,unserialize:CE,serialize:bE,parseUrl:_E,getBaseURL:RE,locat:IE,browse:$E,cookie:SE});var R=ua,Q=[];for(var Ui=0;Ui<256;++Ui)Q.push((Ui+256).toString(16).slice(1));function OE(i,e=0){return(Q[i[e+0]]+Q[i[e+1]]+Q[i[e+2]]+Q[i[e+3]]+"-"+Q[i[e+4]]+Q[i[e+5]]+"-"+Q[i[e+6]]+Q[i[e+7]]+"-"+Q[i[e+8]]+Q[i[e+9]]+"-"+Q[i[e+10]]+Q[i[e+11]]+Q[i[e+12]]+Q[i[e+13]]+Q[i[e+14]]+Q[i[e+15]]).toLowerCase()}var ni,TE=new Uint8Array(16);function kE(){if(!ni&&(ni=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ni))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ni(TE)}var LE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const no={randomUUID:LE};function ke(i,e,t){if(no.randomUUID&&!i)return no.randomUUID();i=i||{};var r=i.random||(i.rng||kE)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,OE(r)}const DE=i=>i==null||i==="",q=i=>!DE(i),ji=i=>i==null,Ye=i=>!ji(i),AE=i=>function(e,t,r,s){const o=r||{},n=o.children||"children";return i(null,e,t,s,[],[],n,o)},da=(i,e,t,r,s,o,n)=>{let a,c;e.forEach((u,d)=>{a=s.concat([""+d]),c=o.concat([u]),t.call(r,u,d,e,a,i,c),u&&n&&(a.push(n),da(u,u[n]||[],t,r,a,c,n))})},Tt=AE(da),fa={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170},canvasTable:{DISABLED:!0}};let ce=R.clone(fa);function ga(i){ce={form:{...ce.form,...i.form},grid:{...ce.grid,...i.grid},canvasTable:{...ce.canvasTable,...i.canvasTable}}}function ME(){return ce}function BE(){var i,e;return{labelCol:(i=ce.form)==null?void 0:i.labelCol,wrapperCol:(e=ce.form)==null?void 0:e.wrapperCol}}function va(){var i,e,t;return{align:(i=ce.grid)==null?void 0:i.align,lazyReset:(e=ce.grid)==null?void 0:e.lazyReset,fitHeight:(t=ce.grid)==null?void 0:t.fitHeight}}function pa(){return ce.canvasTable||{}}function NE(){ce=JSON.parse(JSON.stringify(fa))}const Ri=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...R.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>Ri(t))}},mr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},yr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},FE={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}},xa=i=>{const t=(24-i.reduce((s,o)=>s+o,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},ao=["xxs","xs","sm","md","lg","xl","xxl"],KE=i=>{const e=R.isArray(i)?i:R.isNumber(i)?Array.from({length:i},()=>mr):[];return R.zipObject(ao,ao.map(t=>e.every(r=>q(r[t]))?xa(e.map(r=>r[t])):24))},et="-",ct={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??et:et},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return et;if(R.isArray(i))if(i.length>0){const s=e.filter(o=>i.includes(o.value));return s.length?s.map(o=>o.label).join(t):et}else return et;const r=e.find(s=>s.value===i);return r?r.label:et},formatSex:({cellValue:i})=>q(i)?R.toNumber(i)===1?"男":"女":et},HE=(i,{record:e,index:t,column:r,field:s})=>{if(R.isString(i)&&ct[i]){const o=ct[i];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(R.isArray(i)&&ct[i[0]]&&i.length>1){const o=ct[i[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return R.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},ma=i=>{Object.assign(ct,i)},VE=l.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=kt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:r,row:s,field:o,rowIndex:n},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),ya=l.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,o=r.field?t[r.field]:null;return()=>{var n,a;return((a=(n=r.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:r,rowIndex:s,cellValue:o}))??(r.cellRender?l.createVNode(VE,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?HE(r.formatter,{record:t,index:s,field:r.field,column:r}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),PE={class:"text-right mt-4px"},YE=l.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};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>R.merge({},r,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:f=>{o("update:modelValue",f)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>u(f)}]}}]),c=()=>{n.value=[...n.value,{}]},u=f=>{n.value=n.value.filter((g,v)=>v!==f)},d=l.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 v=l.resolveComponent("a-form-item-rest"),p=l.resolveComponent("a-table"),x=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(p,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(m=>l.unref(Ri)(m))}),l.createSlots({_:2},[d.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:m,record:C,index:_})=>[l.createVNode(v,null,{default:l.withCtx(()=>[d.value.some(w=>m.key&&w.field===m.key)?(l.openBlock(),l.createBlock(l.unref(ya),{key:_,"row-index":_,"default-handler":{},column:d.value.find(w=>m.key&&w.field===m.key),row:C,"table-data":n.value},null,8,["row-index","column","row","table-data"])):l.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),l.createElementVNode("div",PE,[l.createVNode(x,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),oe=i=>{const{icon:e}=i,t=Qa;return t[e]?l.createVNode(t[e]):t[e]},Ot={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())}},ai={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},wa={$input:L.Input,AInput:L.Input,$textarea:L.Textarea,Textarea:L.Textarea,$number:L.InputNumber,AInputNumber:L.InputNumber,$select:L.Select,ASelect:L.Select,$date:L.DatePicker,ADatePicker:L.DatePicker,$range:L.RangePicker,ARangePicker:L.RangePicker,AAutoComplete:L.AutoComplete,$Cascader:L.Cascader,ACascader:L.Cascader,ACheckbox:L.Checkbox,AMentions:L.Mentions,ARate:L.Rate,ASlider:L.Slider,$time:L.TimePicker,ATimePicker:L.TimePicker,ATreeSelect:L.TreeSelect},WE=i=>{const e=wa[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:o},{data:n,field:a}){return Ye(o)&&q(a)&&ji(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:i,value:n[a],"onUpdate:value":c=>n[a]=c},r,R.merge({},Ot[i],t),{onChange:(...c)=>{var u;(u=s.change)==null||u.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderDefault({props:t=Ot[i]??{},attrs:r={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return Ye(o)&&q(c)&&ji(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:i,value:a[c],"onUpdate:value":u=>a[c]=u},r,R.merge({},Ot[i],t),{onChange:(...u)=>{var d;(d=s.change)==null||d.call(s,{data:n,row:a,field:c},...u)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderEdit(t,{props:r=Ot[i]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:i,value:t.value,"onUpdate:value":c=>t.value=c},s,R.merge({},Ot[i],r),{onBlur:(...c)=>{var u;a==null||a("blur",t.value),(u=o.blur)==null||u.call(o,n,...c)}}),null)}}},Ea=(i,e)=>{var t;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(r=>{var s;return!((s=r.hiddenIf)!=null&&s.call(r,e))}).length>0?l.createVNode(L.Dropdown,null,{default:()=>l.createVNode(L.Button,l.mergeProps(R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):l.createVNode(oe,{icon:"DownOutlined"},null)}),{default:()=>{var r;return[i.content||(((r=i==null?void 0:i.getContent)==null?void 0:r.call(i,e))??"")]}}),overlay:()=>{var r;return l.createVNode("div",{class:`dropdown-wrapper ${((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))??""}`},[i.dropdowns.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,e))}).map(s=>Ea(s,e))])}}):l.createVNode(L.Button,l.mergeProps({class:((t=i==null?void 0:i.dynamicClassName)==null?void 0:t.call(i,e))||""},R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var r;return[i.content||(((r=i==null?void 0:i.getContent)==null?void 0:r.call(i,e))??"")]}})},er={...Object.fromEntries(Object.keys(wa).map(i=>[i,WE(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(n=>{s.reset(n?{data:n,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var o;return[i.content,((o=i.suffix)==null?void 0:o.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.reset(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.pick(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,o.props),["content"]),{icon:o.props.icon?l.createVNode(oe,{icon:o.props.icon},null):null,onClick:()=>{var n,a;(a=(n=o.events)==null?void 0:n.click)==null||a.call(n,{data:t,field:r}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.reset(c?{data:c,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.pick(c?{data:c,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,c;return!((c=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&c.call(a,{data:t,row:r,field:s}))}).map(n=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(oe,{icon:n.props.icon},null):null,onClick:()=>{var a,c,u,d;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:r,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:r,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:r,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){return l.createVNode("span",{class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(r=>{var s;return!((s=r.hiddenIf)!=null&&s.call(r,t))}).map(r=>Ea(r,t))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t},{data:r,field:s}){return q(s)?l.createVNode(L.RadioGroup,l.mergeProps({value:r[s],"onUpdate:value":o=>r[s]=o},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:r,field:s},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.RadioGroup,l.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)?l.createVNode(L.AutoComplete,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:ai.autoComplete.filterOption},i),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},ai.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?l.createVNode(L.Switch,l.mergeProps({checked:t[r],"onUpdate:checked":s=>t[r]=s},i,{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={}},{data:r,field:s}){return q(s)?l.createVNode(L.CheckboxGroup,l.mergeProps({value:r[s],"onUpdate:value":o=>r[s]=o},i,{options:i.options??e??[],onChange:(...o)=>{var n;(n=t.change)==null||n.call(t,{data:r,field:s},...o)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.CheckboxGroup,l.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 o;const r={ellipsis:{expandable:!0,rows:3}},s=((o=i.getContent)==null?void 0:o.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(L.TypographyParagraph,l.mergeProps(R.merge({},r,R.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?l.createVNode(YE,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&R.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={}},{data:t,field:r}){const s=i.parse?100:1;if(q(r)){const o=l.computed({get:()=>(t[r]??0)*s,set:n=>{t[r]=(n??0)/s}});return l.createVNode("div",{class:"flex items-center"},[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},R.merge({},ai.PercentInput,R.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 o=l.computed({get:()=>(t[r]??0)*s,set:n=>{R.set(t,r,(n??0)/s)}});return[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},R.merge({},ai.PercentInput,R.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},wr=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{er.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),er[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},kt={renders:er,addRender:wr},zE=l.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=l.toRefs(i),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=kt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},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"]}),XE=l.defineComponent(i=>{const{formData:e}=l.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"]}),GE={key:2},UE=["innerHTML"],Er=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=l.ref(!1),o=l.ref(ke()),n=(f,g)=>{const v=g??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",f)},v)},a=f=>{r("trigger",f)},c=()=>{r("reset")},u=()=>{o.value=ke()},d=R.debounce(u,100);return l.watch(()=>t.item,(f,g)=>{R.isEqual(f,g)||d()},{deep:!0}),(f,g)=>{const v=l.resolveComponent("a-tooltip"),p=l.resolveComponent("a-form-item"),x=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(x,l.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:l.unref(mr))),{default:l.withCtx(()=>{var m;return[(l.openBlock(),l.createBlock(p,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},l.unref(R.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var C,_;return[(C=f.item.slots)!=null&&C.default?(l.openBlock(),l.createBlock(l.unref(XE),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(_=f.item.itemRender)!=null&&_.name?(l.openBlock(),l.createBlock(l.unref(zE),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",GE))]}),_:2},[(m=f.item.slots)!=null&&m.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(R.isFunction)(f.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:0},l.unref(R.omit)(f.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,UE)]),default:l.withCtx(()=>[l.createVNode(l.unref(dt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:1},f.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(dt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),qE={key:0,class:"p-pane p-wrapper"},Cr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{type:Function},layout:{},labelCol:{},wrapperCol:{},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},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,o=BE(),n=l.computed(()=>({...r,labelCol:r.labelCol??o.labelCol??{span:6},wrapperCol:r.wrapperCol??o.wrapperCol??{span:16}})),{items:a,data:c}=l.toRefs(r);function u(){s("apply",c.value)}const d=l.ref(),f=l.ref(ke()),g=()=>{f.value=ke()},v=()=>{if(r.customReset)r.customReset();else{const C={};Tt(a.value,_=>{_.field&&_.itemRender?Ye(_.itemRender.defaultValue)?C[_.field]=_.itemRender.defaultValue:C[_.field]=void 0:_.field&&_.slots&&(Ye(_.slots.defaultValue)?C[_.field]=_.slots.defaultValue:C[_.field]=void 0)}),Object.assign(c.value,C)}s("reset")},p=l.computed(()=>({...R.omit(n.value,["items","data","model","labelCol","wrapperCol"]),labelCol:n.value.labelCol,wrapperCol:n.value.wrapperCol})),x=C=>{var _;C&&((_=d.value)==null||_.validateFields(C))},m=C=>{x(C)};return e({reset:g,$form:l.computed(()=>d.value)}),(C,_)=>l.unref(a).some(w=>{var b;return w.field&&w.itemRender||((b=w.slots)==null?void 0:b.default)})?(l.openBlock(),l.createElementBlock("div",qE,[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:f.value,ref_key:"formEl",ref:d,model:l.unref(c)},p.value,{onSubmit:u}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a),(w,b)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${w.field||b}`,"form-data":l.unref(c),item:w,onReset:v,onTrigger:m},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),ZE=l.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"]}),Ca=({title:i,content:e})=>new Promise((t,r)=>{L.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),JE=L.message.success,QE=L.message.error;L.message.info;const ui=L.message.warning,jE={key:0},eC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},tC={class:"flex items-center flex-1 gap-4px"},iC={key:2},rC={class:"flex items-center gap-4px"},sC={key:0,class:"w-full text-slate-5 pl-4"},br=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{},manualFetch:{type:Boolean},align:{},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{},lazyReset:{type:Boolean},fitHeight:{},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var le,fe,Rt,K,Fe;const r=i,s=va(),o=l.computed(()=>({...r,rowKey:r.rowKey??"id",scrollMode:r.scrollMode??"inner",align:r.align??s.align??"left",lazyReset:r.lazyReset??s.lazyReset??!1,fitHeight:r.fitHeight??s.fitHeight??170})),{formConfig:n,pageConfig:a,columns:c,toolbarConfig:u,proxyConfig:d,tableConfig:f,selectConfig:g,scrollMode:v}=l.toRefs(r),p=l.reactive({table:!1,toolbar:!1,form:!1}),x=$=>{R.isObject($)?Object.keys($).forEach(A=>{p[A]=$[A]}):R.isBoolean($)&&(p.form=$,p.table=$,p.toolbar=$)},m=l.ref(),C=l.ref(),_=l.ref(500),w=l.ref([]),b=l.ref([]),E=$=>{const{ajax:A}=d.value;switch($){case"multiDelete":A.multiDelete&&(w.value.length>0?Ca({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{p.table=!0,p.toolbar=!0,A.multiDelete(w.value).then(()=>{L.message.success("删除成功"),qe()}).catch(()=>{L.message.error("删除失败")}).finally(()=>{p.table=!1,p.toolbar=!1,y.multiDelete=!1})}):L.message.warn("请选择要删除的数据"));break}},I=l.computed(()=>{const $=[];return Tt(c.value??[],A=>{A.slots&&A.slots.title&&(A.field||(A.field="__holder__"+$.length),$.push(A))}),$}),T=l.ref(),k=l.ref(),O=l.ref(ke()),S=l.ref(ke()),y=l.reactive([...(((fe=(le=r.toolbarConfig)==null?void 0:le.buttons)==null?void 0:fe.map($=>$.code))??[]).filter($=>$),...(((K=(Rt=r.toolbarConfig)==null?void 0:Rt.tools)==null?void 0:K.map($=>$.code))??[]).filter($=>$)].reduce(($,A)=>($[A]=!1,$),{})),M=($,A)=>{y[$]=A},H=()=>{S.value=ke()},F=R.debounce(H,100),X=l.computed(()=>{const $=[];return Tt(c.value??[],A=>{(A.slots&&A.slots.default||A.formatter||A.cellRender)&&(A.field||(A.field="__holder__"+$.length),$.push(A))}),$}),P=l.reactive({page:1,size:((Fe=a.value)==null?void 0:Fe.pageSize)??10}),Y=l.ref(0),W=l.ref(0),V=l.ref([]),we=l.computed(()=>d.value&&d.value.ajax?a.value?"pagination":"list":"bad"),de=l.useAttrs(),se=t,$e=l.computed(()=>b.value.filter($=>w.value.includes($[r.rowKey??"id"]))),j=$=>{se("toolbarButtonClick",{data:V.value,code:$,selectedKeys:w.value,records:$e.value}),E($)},Xt=R.debounce(j,100),Oi=({key:$})=>Xt($),Ti=$=>{se("toolbarToolClick",{data:V.value,code:$,selectedKeys:w.value,records:$e.value}),E($)},Ct=R.debounce(Ti,100),Ne=l.ref({}),bt=({row:$,field:A})=>{se("pick",{row:$,field:A})},Ue=$=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const A={};Tt(n.value.items,U=>{U.field&&U.itemRender?Ye(U.itemRender.defaultValue)?A[U.field]=U.itemRender.defaultValue:A[U.field]=void 0:U.field&&U.slots&&(Ye(U.slots.defaultValue)?A[U.field]=U.slots.defaultValue:A[U.field]=void 0)}),Ne.value=A}se("resetQuery")}P.page=1,$||Ze()},ki=($,A)=>A?{list:R.isString(A.list)?R.get($,A.list):R.isFunction(A.list)?A.list($):void 0,total:R.isString(A.total)?R.get($,A.total):R.isFunction(A.total)?A.total($):void 0,result:R.isString(A.result)?R.get($,A.result):R.isFunction(A.result)?A.result($):void 0,message:R.isString(A.message)?R.get($,A.message):R.isFunction(A.message)?A.message($):void 0}:{list:$},_t=l.ref(!0),Li=()=>(b.value=[],w.value=[],Ue()),qe=()=>(P.page=1,b.value=[],w.value=[],Oe()),Di=($,A,U)=>(P.page=$.current,P.size=$.pageSize,Oe()),Oe=()=>new Promise($=>{if(we.value!=="bad"){p.form=!0,p.table=!0;const{ajax:A}=d.value;A.query({form:Ne.value,page:P}).then(U=>{const{list:ge,total:Qe,result:J,message:Ee}=ki(U,d.value.response);ge?(V.value=ge,Y.value++):J?(V.value=J,W.value=Qe??J.length,Y.value++):(V.value=[],Y.value++,Ee&&L.message.warn(Ee)),$(V.value)}).catch(U=>{console.error("fetchData error",U),$([])}).finally(()=>{p.form=!1,p.table=!1})}}),Ze=R.debounce(Oe,160),Gt=($,A)=>(Object.assign(Ne.value,$),P.page=1,A?Promise.resolve():Ze()),Ut=l.computed(()=>we.value==="pagination"?{current:P.page,total:W.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:$=>`共${$}条数据`}:!1),qt={size:"small",sticky:!0,transformCellText:({text:$})=>R.isArray($)&&$.length===0?"-":$},Zt=l.computed(()=>R.merge({},qt,(f==null?void 0:f.value)??{},g.value?{rowSelection:{type:g.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:w.value,onChange:$=>{w.value=$;const A=r.rowKey??"id",U=b.value.map(J=>J[A]),Qe=$.filter(J=>!U.includes(J)).map(J=>V.value.find(Ee=>Ee[A]===J)).filter(J=>!!J);b.value=[...b.value,...Qe]},getCheckboxProps:g.value.getCheckboxProps}}:{})),Jt=l.computed(()=>R.omit({labelCol:yr,...n.value},["items"])),D=()=>{qe()};l.watch(()=>[c.value,d.value,u.value],()=>{F()},{deep:!0});const B=()=>{var J,Ee;const $=(J=m.value)==null?void 0:J.parentElement,A=$?window.getComputedStyle($).height:"0px",U=C.value?window.getComputedStyle(C.value).height:"0px",ge=U.includes("px")?R.toNumber(U.replace("px","")):0,Qe=(Ee=g.value)!=null&&Ee.showCount?22:0;_.value=r.renderY??R.toNumber(A.replace("px",""))-o.value.fitHeight-(r.toolbarConfig?30:0)-ge-Qe,_t.value=R.toNumber(A.replace("px",""))>600};e({commitProxy:{query:Ze,reload:Li,reloadPage:qe,passQuery:Gt},$table:l.computed(()=>k.value),selectedRowKeys:l.computed(()=>w.value),setBtnLoading:M,selectedRecords:$e,$form:l.computed(()=>T.value),getFormData:()=>Ne.value,setLoadings:x,resizeTable:B});let G;l.onMounted(()=>{B(),window.addEventListener("resize",B),G=new MutationObserver($=>{$.forEach(A=>{if(A.type==="attributes"&&A.attributeName==="style"){const U=A.target;window.getComputedStyle(U).display!=="none"&&B()}})}),m.value&&G.observe(m.value,{attributes:!0,attributeFilter:["style"]}),Ue(r.manualFetch)});const Te=["align"],Je=$=>$.map(A=>({...Te.reduce((U,ge)=>({[ge]:o.value[ge]}),{}),...A}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",B),G.disconnect()}),($,A)=>{var J,Ee,kr;const U=l.resolveComponent("a-menu-item"),ge=l.resolveComponent("a-menu"),Qe=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:m,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(de)),[we.value==="bad"?(l.openBlock(),l.createElementBlock("div",jE,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(Ee=(J=l.unref(n))==null?void 0:J.items)!=null&&Ee.some(N=>N.field&&N.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:C},[l.createVNode(l.unref(L.Spin),{spinning:p.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:O.value,ref_key:"formEl",ref:T,model:Ne.value},Jt.value,{onSubmit:D}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(N,ve)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${N.field||ve}`,"form-data":Ne.value,item:N,onReset:A[0]||(A[0]=je=>Ue(o.value.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(u)?(l.openBlock(),l.createElementBlock("div",eC,[l.createElementVNode("div",tC,[l.unref(u).buttons&&l.unref(u).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).buttons,(N,ve)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:ve},[N.dropdowns&&N.dropdowns.length?(l.openBlock(),l.createBlock(Qe,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ge,{onClick:Oi},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(N.dropdowns,je=>(l.openBlock(),l.createBlock(U,{key:je.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(je.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,loading:p.toolbar||!!N.code&&y[N.code]},{default:l.withCtx(()=>[N.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:N.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(N.content)+" ",1),l.createVNode(l.unref(dt.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):N.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,loading:p.toolbar||!!N.code&&y[N.code],onClick:je=>l.unref(Xt)(N.code)},{default:l.withCtx(()=>[N.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:N.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(N.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",iC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",rC,[l.unref(u).tools&&l.unref(u).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).tools,(N,ve)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:ve,type:N.type,size:N.size??"middle",disabled:l.unref(u).disabled||N.disabled,onClick:je=>l.unref(Ct)(N.code),loading:p.toolbar||!!N.code&&y[N.code]},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{icon:N.icon},null,8,["icon"])]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${_t.value?"h-0":""} p-${l.unref(v)??"inner"}-scroll`)},[(kr=l.unref(g))!=null&&kr.multiple&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",sC," 已选:"+l.toDisplayString(w.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(L.Table),l.mergeProps({key:S.value+"_table","row-key":$.rowKey??"id",ref_key:"tableEl",ref:k,columns:Je(l.unref(c)??[]).map(N=>l.unref(Ri)(N)),"data-source":V.value,loading:p.table,pagination:Ut.value},Zt.value,{scroll:{x:"max-content",y:_.value},onChange:Di}),l.createSlots({_:2},[I.value.length>0?{name:"headerCell",fn:l.withCtx(({column:N})=>[I.value.some(ve=>N.key&&ve.field===N.key)?(l.openBlock(),l.createBlock(l.unref(ZE),{key:S.value+"_title_"+Y.value+"_slot_"+N.key,column:I.value.find(ve=>N.key&&ve.field===N.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,X.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:N,record:ve,index:je})=>[X.value.some(Ai=>N.key&&Ai.field===N.key)?(l.openBlock(),l.createBlock(l.unref(ya),{key:S.value+"_cell_"+Y.value+"_slot_"+N.key,column:X.value.find(Ai=>N.key&&Ai.field===N.key),"default-handler":{pick:bt,setLoadings:x},row:ve,"row-index":je,"table-data":V.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","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-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--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-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: transparent;--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--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-line-color: #e1e6eb}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.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;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:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var oC=Object.defineProperty,nC=(i,e,t)=>e in i?oC(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>nC(i,typeof e!="symbol"?e+"":e,t);class aC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:u,field:d,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(!g.required&&(u==null||u===""))return t;if(g.validator){const v={field:d,fieldValue:f,value:u,column:r,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(v,u,p=>{p&&t.push({...v,message:p})})}g.pattern&&!g.pattern.test(u)&&t.push({value:u,column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:d,fieldValue:f,message:g.message||`${o} is pattern validation error`}),g.required&&(u==null||u==="")&&t.push({value:u,column:r,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:d,fieldValue:f,message:g.message||`${o} is required`})}return t}}function ba(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function _a(i,e){let t=0,r;return function(...s){const o=new Date().getTime(),n=o-t;!t||n>=e?(i.apply(this,s),t=o):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},e-n))}}function Ra(i=[]){return i.length?i.map(e=>Ra(e.children)+1).sort((e,t)=>t-e)[0]:0}function lC(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,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...r.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function Ia(i=[],e=1,t=0){return i.map(r=>{if(r.children){let s=0,o=r.fixed;r.children.forEach(a=>{a.fixed=o});const n=Ia(r.children,e-1,t+1);return n&&n.forEach(a=>{s+=a.colspan??0}),{...r,width:r.width,level:t,rowspan:1,colspan:s,children:n}}return{...r,level:t,rowspan:e,colspan:1}})}function di(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(di(t.children)):e.push(t)}),e}const lo=/^(\r\n|\n\r|\r|\n)/,cC=/^[^\t\r\n]+/,co=/^\t/;function hC(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(co))i=i.replace(co,""),t+=1,e[r][t]="";else if(i.match(lo))i=i.replace(lo,""),t=0,r+=1,e[r]=[""];else{let o="";if(i.startsWith('"')){let n=0,a=!0;for(;a;){const c=i.slice(0,1);c==='"'&&(n+=1),o+=c,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const n=i.match(cC);o=n?n[0]:"",i=i.slice(o.length)}e[r][t]=o}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 uC(i){let e,t,r,s,o="",n;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(o+=" "),n=i[e][r],typeof n=="string"?n.indexOf(`
2
2
  `)>-1?o+=`"${n.replace(/"/g,'""')}"`:o+=n:n==null?o+="":o+=n;e!==t-1&&(o+=`
3
- `)}return o}function Sa(i,e,t=[]){let r=0;const s=[];return i.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((u,d)=>`${u}${o[d]??""}`,"")||o[e],c=t.reduce((u,d)=>`${u}${i[n-1][d]??""}`,"")||i[n-1][e];a===c?(s[r]+=1,s.push(0)):(s.push(1),r=n)}}),s}function $a(i,e){let t="",r="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,r=o.key,s[o.key]=1):i[o.key]===i[t]?(s[o.key]=0,s[r]+=1):(s[o.key]=1,t=o.key,r=o.key)}),s}function dC(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:o}=i,n=Sa(r,e,t);return n[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:n[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function fC(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=$a(r,o);return n[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:n[t.key],relationColKeys:e,mergeCol:!0}}}function gC(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}class Oa{constructor(e,t,r,s,o,n,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=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-r<=0||this.x-r>=o-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 _r extends Oa{constructor(e,t,r,s,o,n,a,c,u,d="body"){super(e,s,o,n,a,d,c.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,"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,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawImageX",0),h(this,"drawImageY",0),h(this,"drawImageWidth",0),h(this,"drawImageHeight",0),h(this,"drawImageName",""),h(this,"drawImageSource"),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"),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=d,this.align=c.align||"center",this.verticalAlign=c.verticalAlign||"middle",this.fixed=c.fixed,this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=u,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.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.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.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:o,relationColKeys:n,mergeRow:a=!1,mergeCol:c=!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(o)&&o.length>0?this.relationRowKeys=o:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=c,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.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,o=0,n="";if(this.type==="tree"&&r==="body"){const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:u=!1,expandLoading:d=!1,level:f=0}=a||{};if(this.rowExpand=c,this.rowHasChildren=u,d){const p=this.ctx.icons.get("loading");n="loading",s=p,o=f*8}else if(u){const p=this.ctx.icons.get("expand"),x=this.ctx.icons.get("shrink");s=c?x:p,n=c?"shrink":"expand",o=f*8}else o=f*8;let g=20,v=20;if(s){let p=this.drawX+o+e,x=this.drawY+(this.visibleHeight-v)/2;this.ctx.paint.drawImage(s,p,x,g,v),this.drawImageX=p,this.drawImageY=x,this.drawImageWidth=g,this.drawImageHeight=v,this.drawImageName=n,this.drawImageSource=s}this.align="left",this.drawTextX=o+this.drawX+g-.5}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:u,HIGHLIGHT_SELECTED_ROW_COLOR:d,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:v,STRIPE_COLOR:p}=this.ctx.config;if(this.cellType==="footer"){let I=c,T=a;if(typeof s=="function"){const L=s,{backgroundColor:O,color:$}=L({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};O&&(I=O),$&&(T=$)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=I,this.drawTextColor=T;return}let x="transparent";const m=this.ctx.hoverCell,C=this.ctx.currentCell;let _=this.rowIndex,w=this.rowIndex;if(this.rowspan!==1&&(f||u)){const I=this.getSpanInfo(),{yArr:T}=I;_=T[0],w=T[1]}f&&m&&(m.rowKey===this.rowKey&&(x=g),m.rowIndex>=_&&m.rowIndex<=w&&(x=g)),u&&C&&(C.rowKey===this.rowKey&&(x=d),C.rowIndex>=_&&C.rowIndex<=w&&(x=d)),this.drawCellSkyBgColor=x;let b=e,E=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(b=t,E=o),v&&(this.rowIndex%2?b=p:b=e),typeof r=="function"){const I=r,{backgroundColor:T,color:L}=I({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};T&&(b=T),L&&(E=L)}this.drawCellBgColor=b,this.drawTextColor=E}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(!(r===0||s===0)&&o!=="footer"&&["index-selection","selection"].includes(n)){const u=this.ctx.database.getRowSelection(c),d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0}=this.ctx.config,g=this.drawX+(e-f)/2,v=this.drawY+(t-f)/2;let p=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck";u&&d?(p=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):u&&d?(p=this.ctx.icons.get("checkbox-check-disabled"),x="checkbox-check-disabled"):!u&&d?(p=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(p=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled"),p&&n=="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(x))&&(this.drawImageX=g,this.drawImageY=v,this.drawImageWidth=f,this.drawImageHeight=f,this.drawImageName=x,this.drawImageSource=p):p&&n==="selection"&&(this.drawImageX=g,this.drawImageY=v,this.drawImageWidth=f,this.drawImageHeight=f,this.drawImageName=x,this.drawImageSource=p)}}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 n=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let n=0,a=0;if(o.rowKey===this.rowKey&&(n=this.drawX+this.width-t-r,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const u=this.getSpanInfo(),{yArr:d}=u,f=d[0],g=d[1];if(o.rowIndex>=f&&o.rowIndex<=g){const{width:v,height:p,offsetTop:x,offsetLeft:m}=u;n=this.drawX-m+v-t-r,a=this.drawY-x+(p-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawImageX=n,this.drawImageY=a,this.drawImageWidth=t,this.drawImageHeight=t,this.drawImageName=this.hoverIconName,this.drawImageSource=c}}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.drawImageName))||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}px`,t=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"&&(e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=`${this.drawY-this.ctx.footer.y}px`),{position:"absolute",overflow:"hidden",left:e,top:t,width:`${this.visibleWidth}px`,height:`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+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:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:u,rowIndex:d,drawX:f,drawY:g}=this;if(u===a&&d===c){const v=u===this.ctx.maxColIndex||d===this.ctx.maxRowIndex||u===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-v,g+this.height-v,6,6,{borderColor:s,fillColor:e})}}draw(){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 o=this.ctx.header.leafCellHeaders[s];r+=o.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r}=this.ctx.config;let s=this.visibleWidth;if(this.type==="tree"){const u=this.drawTextX-this.drawX;s=this.visibleWidth-u}const{ellipsis:o}=this.ctx.paint.handleEllipsis(this.displayText,s,e,t);this.ellipsis=o;const{placeholder:n}=this.column;let a=this.displayText,c=this.drawTextColor;return!this.ctx.database.getReadonly(this.rowKey,this.key)&&n&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(a=n,c=r),this.ctx.paint.drawText(a,this.drawTextX,this.drawTextY,s,this.visibleHeight,{font:t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:c})}drawImage(){if(this.drawImageSource){if(this.hoverIconName){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawImageX-2,this.drawImageY-2,this.drawImageWidth+4,this.drawImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e})}this.ctx.paint.drawImage(this.drawImageSource,this.drawImageX,this.drawImageY,this.drawImageWidth,this.drawImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:r,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,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[n,a]=t,[c,u]=r;!(n===a&&c===u)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=u&&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>=c&&this.rowIndex<=u&&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,o=this.drawY,n=[s+r-e-.5,o,s+r-.5,o,s+r-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,u=r;const{xArr:d,yArr:f,lineDash:g=[],borderWidth:v=1,borderColor:p,fillColor:x}=e,m=d[0],C=d[1],_=f[0],w=f[1];if(o>=m&&o<=C&&s===_){const b=o===C?1:0,E=o===m?1:0;this.ctx.paint.drawLine([c+E,u+1,c+a-b,u+1],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===C&&s>=_&&s<=w){const b=s===_?1:0,E=s===w?1:0;this.ctx.paint.drawLine([c+a-1,u+b,c+a-1,u+n-E],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=m&&o<=C&&s===w){const b=o===C?1:0,E=o===m?1:0;this.ctx.paint.drawLine([c+E,u+n-1,c+a-b,u+n-1],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===m&&s>=_&&s<=w){const b=s===w?1:0,E=s===_?1:0;this.ctx.paint.drawLine([c+1,u+E,c+1,u+n-b],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}}}class vC{constructor(e,t){h(this,"loading",!1),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,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),this.ctx=e;const{data:r=[],columns:s=[],footerData:o=[]}=t;this.data=r,this.footerData=o,this.columns=s,this.setLoading(!0),this.init()}init(e=!0){this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();const t=this.getColumns(),r=di(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=[]){e.forEach((s,o)=>{var n;const{ROW_KEY:a="",DEFAULT_EXPAND_ALL:c,CELL_HEIGHT:u,SELECTABLE_METHOD:d,CHECKBOX_KEY:f}=this.ctx.config,g=s[a],v=g!=null?`${g}`:ba();this.itemRowKeyMap.set(s,v);const p=s._height||u,x=s._readonly;let m=!0;if(typeof d=="function"&&(m=d),f){const _=s[f];if(this.checkboxKeyMap.has(_)){const w=this.checkboxKeyMap.get(_)||[];w.push(v),this.checkboxKeyMap.set(_,w)}else this.checkboxKeyMap.set(_,[v])}this.selectionMap.set(v,{key:f?s[f]:v,row:s,check:((n=this.selectionMap.get(v))==null?void 0:n.check)||!1});const C=c||this.expandMap.get(v)||s._expand||!1;this.expandMap.set(v,C),this.rowKeyMap.set(v,{readonly:x,index:o,rowIndex:o,level:t,height:p,check:!1,selectable:m,expand:C,expandLazy:!1,hasChildren:s._hasChildren||(Array.isArray(s.children)?s.children.length>0:!1),expandLoading:!1,item:s,parentRowKeys:r}),Array.isArray(s.children)&&s.children.length&&this.initData(s.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()}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}filterColumns(e){return e.reduce((t,r)=>{if(!(typeof r.hide=="function"?r.hide():r.hide)){const s={...r};s.children&&Array.isArray(s.children)&&(s.children=this.filterColumns(s.children)),t.push(s)}return t},[])}getColumns(){return this.filterColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.columns.length&&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=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:u,height:d}=this.rowKeyMap.get(a),f=this.sumHeight;this.sumHeight+=d,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:f,height:d,bottom:this.sumHeight}),t+=1,c&&u&&r(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;return typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),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}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 o=[],n=r;const a=new Set;let c=[],u=e.map(v=>{const{rowKey:p,key:x}=v;let m=v.value,C=m;const _=this.getRowDataItemForRowKey(p),w=this.getItemValue(p,x),b=this.getVirtualBodyCellByKey(p,x);return(b==null?void 0:b.type)==="number"&&(["",void 0,null].includes(m)?C=null:/^-?\d+(\.\d+)?$/.test(`${m}`)?C=Number(m):(C=w,c.push({...v,value:C,oldValue:w,row:_}))),{...v,value:C,oldValue:w,row:_}});if(u=u.filter(v=>!c.some(p=>v.rowKey===p.rowKey&&v.key===p.key)),c.length){const v={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",v)}if(!u.length)return;const{BEFORE_VALUE_CHANGE_METHOD:d}=this.ctx.config;s==="none"&&typeof d=="function"&&(u=await d(u),n=!1),u.forEach(v=>{const{value:p,rowKey:x,key:m}=v,C=this.getItemValue(x,m);a.add(x),this.setItemValue(x,m,p,!1,!1,!1,n),o.push({rowKey:x,key:m,oldValue:C,newValue:p})});let f=[];a.forEach(v=>{f.push(this.ctx.database.getRowDataItemForRowKey(v))});const g=u.map(({rowKey:v,key:p})=>this.getValidator(v,p));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())}),this.ctx.emit("change",u,f),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let u=c[t],d=r;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:u,newValue:u};c[t]!==null&&typeof c[t]=="object"&&(u=JSON.parse(JSON.stringify(c[t])));const f=`${e}​_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,u);const g=this.originalDataMap.get(f),v=this.getRowDataItemForRowKey(e);if(n){const p=this.getVirtualBodyCellByKey(e,t);if((p==null?void 0:p.type)==="number")if(["",void 0,null].includes(r))d=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))d=Number(r);else{d=u;const m={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:d,oldValue:u,row:v}]};this.ctx.emit("error",m)}if(d===u)return{oldValue:u,newValue:u};let x=[{rowKey:e,key:t,value:d,oldValue:u,row:v}];this.batchSetItemValue(x,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:u,value:d,originalValue:g,row:v})}else this.changedDataMap.set(f,d),c[t]=d;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:u,value:d,originalValue:this.originalDataMap.get(f),row:v}),o&&this.ctx.emit("draw"),{oldValue:u,newValue:d}}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),o=s[r];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e){const t=this.rowKeyMap.get(e),r=this.selectionMap.get(e);if(!r)return;r.check=!r.check,this.setRowSelectionByCheckboxKey(e,r.check),this.ctx.emit("toggleRowSelection",t);const s=this.getSelectionRows();this.ctx.emit("selectionChange",s),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}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),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}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}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.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){e?this.rowKeyMap.forEach((r,s)=>{this.setRowSelection(s,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((r,s)=>{this.selectionMap.set(s,{check:!1,row:r.item,key:s})}));const t=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",t),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,o=0;const n=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,v)=>{var p;(p=this.selectionMap.get(v))!=null&&p.check&&(s+=1);let x=g.selectable;typeof x=="function"&&(x=x({row:g.item,rowIndex:g.rowIndex})),x&&(o+=1)});const c=n>r&&s===0&&a,u=o&&o>s&&s>0||c,d=o!==0,f=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:u,selectable:d},{check:f,indeterminate:u,selectable:d}}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),o=r.split("​_")[0],n=r.split("​_")[1];s!==t&&e.push({rowKey:o,colKey:n,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const o=this.originalDataMap.get(s),n=s.split("​_")[0];o!==r&&e.add(n)});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),o=this.changedDataMap.get(r);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom: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),o=this.headerMap.get(t);if(!s||!o)return!0;const n=s.readonly,a=o.readonly,{BODY_CELL_READONLY_METHOD:c}=this.ctx.config;if(typeof c=="function"&&o){const u=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(u!==void 0)return u}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(r=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(o===void 0)return r([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const u=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});u&&(c=u)}if(c){const u={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},d=new aC(c).validate(u);this.setValidationError(e,t,d),r(d)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(r+=o.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:u,rowspan:d,height:f,width:g,colspan:v,mergeRow:p,mergeCol:x}=e;if(d===1&&v===1)return{xArr:[a,a],yArr:[t,t],rowspan:d,colspan:v,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:o,value:n}]};let m=t,C=t,_=a,w=a,b=[],E=0,I=0,T=0,L=0;if(d!==1&&p){L=g;const O=c.reduce(($,y)=>{const M=this.getItemValue(s,y)??"";return`${$}${M}`},"");for(let $=t-1;$>=0;$--){const y=this.rowIndexRowKeyMap.get($)||"",M=c.reduce((H,F)=>{const X=this.getItemValue(y,F)??"";return`${H}${X}`},"");if(O===M)m=$;else break}for(let $=t;$<=this.ctx.maxRowIndex;$++){const y=this.rowIndexRowKeyMap.get($)||"",M=c.reduce((H,F)=>{const X=this.getItemValue(y,F)??"";return`${H}${X}`},"");if(O===M)C=$;else break}for(let $=m;$<t;$++){const{height:y}=this.positions[$];E+=y}for(let $=m;$<=C;$++){const{height:y}=this.positions[$];T+=y;const M=this.rowIndexRowKeyMap.get($)||"",{item:H}=this.rowKeyMap.get(M),F=this.getItemValue(M,r);b.push({rowKey:M,key:r,value:F,row:H})}}if(v!==1&&x){T=f;for(let O=a-1;O>=0;O--){const $=this.getColumnByColIndex(O);if(!$)break;const y=this.getItemValue(s,r),M=this.getItemValue(s,$.key);if(y===M&&u.includes($.key))_=O;else break}for(let O=a;O<=this.ctx.maxColIndex;O++){const $=this.getColumnByColIndex(O);if(!$)break;const y=this.getItemValue(s,r),M=this.getItemValue(s,$.key);if(y===M&&u.includes($.key))w=O;else break}for(let O=_;O<a;O++){const $=this.getColumnByColIndex(O);if(!$)break;I+=$.width||100}for(let O=_;O<=w;O++){const $=this.getColumnByColIndex(O);if(!$)break;L+=$.width||100,b.push({rowKey:s,key:$.key,value:this.getItemValue(s,$.key),row:o})}}return{xArr:[_,w],yArr:[m,C],rowspan:d,colspan:v,height:T,width:L,offsetTop:E,offsetLeft:I,dataList:b}}setLoading(e){this.loading=e,this.ctx.emit("loadingChange",e)}getLoading(){return this.loading}setValidationErrorByRowIndex(e,t,r){const s=this.rowIndexRowKeyMap.get(e),o=`${s}​_${t}`,n=this.getRowForRowIndex(e),a=this.getColumnByKey(t);if(!s||!a||!n)return;const c=this.getItemValue(s,t),u=[{key:t,rowKey:s,rowIndex:e,colIndex:a.colIndex,column:a.column,row:n,value:c,message:r,field:t,fieldValue:c}];this.validationErrorMap.set(o,u)}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){const r=this.getColumnByColIndex(t),s=this.getRowForRowIndex(e);return!r||!s?void 0:new _r(this.ctx,e,t,0,0,0,0,r,s.item,"body")}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 o=e[0];o<=e[1];o++){const n=this.getVirtualBodyCell(s,o);if(n&&(n.rowspan!==1||n.colspan!==1)){r=!0;break}}return r}}class pC{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(o=>({rowKey:o.rowKey,key:o.key,value:o.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 xC{constructor(e){h(this,"eventTasks",new Map),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)),document.addEventListener("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(){this.eventTasks.forEach((e,t)=>{this.unbind(window,t,e)}),document.removeEventListener("selectionchange",this.selectionchange.bind(this)),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.containerElement.focus({preventScroll:!0}),this.ctx.emit("mousedown",e)}handleMousemove(e){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.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.set(t,r)}unbind(e,t,r){e.removeEventListener(t,r),this.eventTasks.delete(t)}}class mC{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 yC{constructor(e){h(this,"ctx");const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}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,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:u,colorEnd:d}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,r,s));let f;switch(a){case"left":f=this.ctx.createLinearGradient(e-c,t,e,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e-c,t,c,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+c,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,c,s);break;case"top":f=this.ctx.createLinearGradient(e,t-c,e,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-c,r,c);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+c),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,c);break;default:console.error("Invalid side specified for shadow");break}}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 o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=4,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,o){this.ctx.save(),this.ctx.drawImage(e,t,r,s,o),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),n!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=n),c===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[u,d,f,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+u,t),this.ctx.arcTo(e+r,t,e+r,t+d,d),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+u,t,u)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,o,n={}){this.ctx.save();const{font:a="12px Arial",align:c="center",color:u="#495060",padding:d=0,verticalAlign:f="middle"}=n;this.ctx.font=a,this.ctx.fillStyle=u,this.ctx.textBaseline=f,this.ctx.textAlign=c;let g=0;f==="top"?g=r+d:f==="bottom"?g=r+o-d:g=r+(o+1)/2;let v=0;c==="left"?v=t+d:c==="right"?v=t+s-d:v=t+s/2;const{_text:p,ellipsis:x}=this.handleEllipsis(e,s,d,a);return this.ctx.fillText(p,v,g),this.ctx.restore(),x}handleEllipsis(e,t,r=0,s="12px Arial"){let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width,c=this.ctx.measureText(e).width;if(c&&c+a>=t-r*2){o=!0;let u=0;for(let d=0;d<e.length;d++)if(u+=this.ctx.measureText(e[d]).width,u>=t-r*2-a){n=e.slice(0,d)+"...";break}}return{_text:n,ellipsis:o}}}class ho{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,"WIDTH",0),h(this,"RESIZE_MIN_WIDTH",40),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"EMPTY_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,"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,"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,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_INDETERMINATE_SVG",""),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,"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_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,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),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,"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=gC(r);e[t]=s}}),Object.assign(this,e,this._config)}}const uo='<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>';class wC{constructor(e){h(this,"ctx"),h(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:'<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>',color:"#4E5969"},{name:"shrink",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"SHRINK_ICON_COLOR",svg:uo,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",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" fill="#DDE0EA" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:'<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>',color:"rgb(82,146,247)"},{name:"checkbox-hover",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_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" fill="#DDE0EA" p-id="4709"></path></svg>',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_SVG",svg:'<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>',color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",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" fill="#F1F2F4" 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:""},{name:"icon-edit",configName:"CHECKBOX_DISABLED_SVG",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:"CHECKBOX_UNCHECK_SVG",configColorName:"SHRINK_ICON_COLOR",svg:uo,color:"#4E5969"}]),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,o=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&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(r.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const o=this.createImageFromSVG(r.svg,s,r.isBlob).then(n=>{this.icons.set(r.name,n)});e.push(o)}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=>{a.setAttribute("fill",t)});const o=new Image;let n="";if(r){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});n=URL.createObjectURL(a)}else n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=n,new Promise((a,c)=>{o.onerror=()=>c(new Error("Failed to load image")),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}}class Ta extends Oa{constructor(e,t,r,s,o,n,a){super(e,r,s,o,n,"header",a.fixed),h(this,"align"),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,"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,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawImageX",0),h(this,"drawImageY",0),h(this,"drawImageWidth",0),h(this,"drawImageHeight",0),h(this,"drawImageName",""),h(this,"drawImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=n,this.visibleWidth=o,this.visibleHeight=n,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.type=a.type||"",this.editorType=a.editorType||"text",this.align=a.align||"center",this.verticalAlign=a.verticalAlign||"middle",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.rowKey=ba(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader}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,o=r;if(typeof e=="function"){const n=e,{backgroundColor:a,color:c}=n({colIndex:this.colIndex,column:this.column})||{};a&&(s=a),c&&(o=c)}this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.updateStyle()}draw(){const{paint:e,config:{BORDER_COLOR:t,CELL_PADDING:r,HEADER_FONT:s,BORDER:o}}=this.ctx,{drawX:n,drawY:a,displayText:c}=this;e.drawRect(n,a,this.width,this.height,{borderColor:o?t:"transparent",fillColor:this.drawCellBgColor}),this.ellipsis=e.drawText(c,n,a,this.width,this.height,{font:s,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign}),this.drawSelection(),this.drawSelector()}drawSelector(){const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t}=this.ctx.selector,[r,s]=t;this.colIndex>=r&&this.colIndex<=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(){const{width:e,height:t,type:r}=this;if(["index-selection","selection"].includes(r)){const{indeterminate:s,check:o,selectable:n}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:a=0}=this.ctx.config,c=this.drawX+(e-a)/2,u=this.drawY+(t-a)/2;let d=this.ctx.icons.get("checkbox-uncheck"),f="checkbox-uncheck";s?(d=this.ctx.icons.get("checkbox-indeterminate"),f="checkbox-indeterminate"):o&&n?(d=this.ctx.icons.get("checkbox-check"),f="checkbox-check"):o&&n?(d=this.ctx.icons.get("checkbox-check-disabled"),f="checkbox-check-disabled"):!o&&n?(d=this.ctx.icons.get("checkbox-uncheck"),f="checkbox-uncheck"):(d=this.ctx.icons.get("checkbox-disabled"),f="checkbox-disabled"),d&&(this.drawImageX=c,this.drawImageY=u,this.drawImageWidth=a,this.drawImageHeight=a,this.drawImageName=f,this.drawImageSource=d,this.ctx.paint.drawImage(this.drawImageSource,this.drawImageX,this.drawImageY,this.drawImageWidth,this.drawImageHeight))}}getText(){return this.render?"":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 EC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(()=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver")}),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(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMousedown",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMousedown",n,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)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s),this.treeClick(s),this.hoverIconClick(s)})}),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,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.emit("cellHeaderContextMenuClick",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.emit("cellContextMenuClick",n,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.selectionEnterAndLeave(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 o;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&&(((o=this.ctx.hoverCell)==null?void 0:o.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(n=>n.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("drawView")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e){if(["selection","index-selection"].includes(e.type)&&this.ctx.isPointer)if(e instanceof Ta)e.drawImageName==="checkbox-uncheck"||e.drawImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey)}}treeClick(e){if(e.type==="tree"&&this.ctx.isPointer){const t=this.ctx.database.getRowForRowKey(e.rowKey),{expand:r=!1,expandLazy:s=!1}=t||{},{EXPAND_LAZY:o,EXPAND_LAZY_METHOD:n}=this.ctx.config;if(o&&n&&!r&&!s)typeof n=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),n({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(a=>{this.ctx.database.setExpandChildren(e.rowKey,a),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(a=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(a)}));else{const a=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!a),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s;n>e.drawImageX&&n<e.drawImageX+e.drawImageWidth&&o>e.drawImageY&&o<e.drawImageY+e.drawImageHeight&&(this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0)}selectionEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s;n>e.drawImageX&&n<e.drawImageX+e.drawImageWidth&&o>e.drawImageY&&o<e.drawImageY+e.drawImageHeight&&e instanceof _r&&["selection","index-selection"].includes(e.type)&&(this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed"))}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;if(!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:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,r,s,o=!1){if(this.isInsideBody(t))for(const n of r){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const u=c.getDrawX(),d=c.getDrawY();if(o){if(e>u&&e<u+c.visibleWidth&&t>d&&t<d+c.visibleHeight){s(c);return}}else if(e>u&&e<u+c.width&&t>d&&t<d+c.height){s(c);return}}}}handleHeaderEvent(e,t,r,s){for(const o of r){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);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 CC{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,"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,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"adjustPositioning",!1),h(this,"editing",!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,"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:[],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,"database"),h(this,"history"),h(this,"config");const{containerElement:r,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.contextMenuElement=u,this.config=new ho(t.config||{}),this.eventBus=new mC,this.eventBrowser=new xC(this),this.eventTable=new EC(this),this.paint=new yC(this.canvasElement),this.database=new vC(this,t),this.history=new pC(this),this.icons=new wC(this)}setConfig(e){this.config=new ho(e)}setItemValueByEditor(e,t,r,s=!0,o=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:c}=a.getSpanInfo(),u=c.map(d=>({...d,value:r}));this.database.batchSetItemValue(u,s,n);return}}this.database.setItemValue(e,t,r,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const n=this.database.getRowIndexForRowKey(o.rowKey),a=this.database.getColIndexForKey(o.key);if(n===void 0||a===void 0)return;const c=this.database.getVirtualBodyCell(n,a);if(c){const{dataList:u}=c.getSpanInfo(),d=u.map(f=>({...f,value:o.value}));s.push(...d)}}),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 o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=r[1]-r[0];a++){const c=o+t[0],u=a+r[0],d=this.database.getVirtualBodyCell(c,u);d&&(d.selectorCellValueType==="displayText"?n.push(d.displayText):n.push(d.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}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 o=Math.floor(t),n=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(n=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>n&&(o=n),this.emit("setScroll",r,o)}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)}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 fo{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,o=r-this.clientX;let n=0;this.type==="vertical"?(n=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(n===0&&s>0||n===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(n=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=n}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:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let n=0;this.type==="vertical"?n=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:n=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(n,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:o,buttons:n}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,n===0||s==this.clientX&&o==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=o-this.clientY,this.isDragging&&a!==0){let c=0;this.type==="vertical"?c=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,r,s,o,n){return e>=r&&e<=r+o&&t>=s&&t<=s+n}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:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,u=r,d=t.height,f=t.width,g=e.height,v=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=u-o-d,this.distance=g-this.visibleDistance+v,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,d,this.trackX+o,d],this.trackWidth=o,this.trackHeight=u,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const p=this.distance?this.visibleDistance/(g+v):0;let x=Math.floor(p*this.visibleDistance);x<30?x=30:x>this.visibleDistance&&(x=0),this.barHeight=x,this.barY=d+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=f-this.visibleDistance,this.splitPoints=[c-o,u-o,c-o,u];const p=a?0:.5;this.trackX=0,this.trackY=u-o+p,this.trackWidth=c,this.trackHeight=o;const x=this.distance?this.visibleDistance/f:0;let m=Math.floor(x*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,m<30?m=30:m>=this.visibleDistance&&(m=0),this.barWidth=m,this.barHeight=n,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:o}}=this.ctx;this.updatedSize();let n=r;s||(n="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:n,fillColor:o}),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:n,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class bC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),this.ctx=e,this.verticalScrollbar=new fo(e,"vertical"),this.horizontalScrollbar=new fo(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)})}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.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&&r.x>t.visibleWidth/2&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=r.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}}class _C{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,"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,"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",_a(()=>{this.init(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn()}init(){const{config:{HEADER_HEIGHT:e,SCROLLER_TRACK_SIZE:t}}=this.ctx,r=this.ctx.database.getColumns();this.columns=r,this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[];const s=Ra(r),o=di(r);this.height=e*s,this.width=o.reduce((f,g)=>{const v=g.width||100,{maxWidth:p,minWidth:x}=g;return p&&v>p?f+p:x&&v<x?f+x:f+v},0),this.visibleHeight=this.height;const n=lC(Ia(r,s));this.columnIndex=0,this.resizeNum=0,this.render(n,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.floor(this.width+t),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-t;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const f=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(f)}const u=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=u.reduce((f,g)=>f+g.width,0);const d=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=d.reduce((f,g)=>f+g.width,t),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.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){const{config:{ENABLE_RESIZE_COLUMN:e}}=this.ctx;e&&(this.ctx.on("mousedown",t=>{this.ctx.isTarget(t)&&(this.clientX=t.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{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",t=>{if(this.ctx.editing)return;const{stageWidth:r,config:{RESIZE_COLUMN_MIN_WIDTH:s}}=this.ctx;if(this.isResizing&&this.resizeTarget){const o=this.resizeTarget.width,n=this.resizeTarget.minWidth,a=this.resizeTarget.maxWidth;let c=t.clientX-this.clientX;c+o<s&&(c=-(o-s)),n&&c+o<n&&(c=-(o-n)),a&&c+o>a&&(c=a-o),this.resizeDiff=c,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(t.offsetX<0||t.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 o=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const n of o){const{offsetX:a,offsetY:c}=this.ctx.getOffset(t),u=a,d=n.getDrawX();u>d+n.width-5&&u<d+n.width+4&&u<r-4&&n.colspan<=1&&this.ctx.isTarget(t)&&c<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=n)}}}))}resizeColumn(e,t){const r=o=>{o.forEach(n=>{if(n.children&&n.children.length>0&&r(n.children),n.key===e.key){const a=n.width||100;n.width=a+t}})};r(this.columns),this.ctx.database.setColumns(this.columns),this.init(),this.ctx.emit("draw");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),this.ctx.emit("draw")}this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:e.width+t+s,column:e.column,columns:this.columns})}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const n=o.width+e*o.colspan;t.set(o.key,n),n<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=o=>{o.forEach(n=>{t.has(n.key)&&(n.width=t.get(n.key)),n.children&&n.children.length>0&&s(n.children)})};s(this.columns),this.ctx.database.setColumns(this.columns),this.init()}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<r;n++){const a=e[n],c=o*(a.rowspan||0),u=o*(a.level||0);let{minWidth:d,maxWidth:f}=a,g=a.width||100;d&&g<d&&(g=d),f&&g>f&&(g=f),a.children&&(g=di(a.children).reduce((p,x)=>p+((x==null?void 0:x.width)||100),0));const v=new Ta(this.ctx,this.columnIndex,s,u,g,c,a);this.ctx.database.setHeader(a.key,v),this.allCellHeaders.push(v),a.children||(this.leafCellHeaders.push(v),v.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(v):a.fixed==="right"?this.fixedRightCellHeaders.push(v):this.centerCellHeaders.push(v),!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}}=this.ctx,r=this.resizeTarget.getDrawX(),s=this.resizeTarget.width,o=r+s+this.resizeDiff-.5,n=[o-.5,0,o-.5,e];this.ctx.paint.drawLine(n,{borderColor:t,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,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,o)=>s.x-o.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.drawTipLine(),this.drawBottomLine()}}class ka{constructor(e,t,r=0,s=0,o=0,n=0,a,c="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,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[];e.renderLeafCellHeaders.forEach(o=>{const n=new _r(this.ctx,this.rowIndex,o.colIndex,o.x,this.y,o.width,this.height,o.column,this.data,this.rowType);n.fixed?r.push(n):s.push(n),t.push(n)}),this.cells=t,this.fixedCells=r,this.noFixedCells=s}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 RC{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:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:u=0,ENABLE_OFFSET_HEIGHT:d=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+r.height:this.y=t.height;const{data:v,sumHeight:p}=s.getData();this.height=p,this.data=v,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const x=this.ctx.footer.height;!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-x-n);let m=this.height+t.height+n;m+=x;let C=m;const _=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(_>w&&d&&!a){const y=_-w-f;y>t.height+n?C=y:m>u&&(C=u)}else this.data.length&&a?C=a:this.data.length&&u&&m>u&&(C=u);C>0&&(this.ctx.stageHeight=Math.floor(C),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=b-x: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=v;const E=window.devicePixelRatio||1,I=this.ctx.stageWidth*E,T=this.ctx.stageHeight*E;e.width=Math.round(I),e.height=Math.round(T);const L=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:L,type:L,headerHeight:t.height,bodyHeight:this.height,footerHeight:x,width:this.width,height:this.data.length?0:c+x});const O=Math.round(e.width/E*1e4)/1e4,$=Math.round(e.height/E*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${$}px;width:${O}px;`),this.ctx.paint.scale(E)}initResizeRow(){const{config:{ENABLE_RESIZE_ROW:e}}=this.ctx;e&&(this.ctx.on("resize",()=>{this.containerRect=this.ctx.containerElement.getBoundingClientRect()}),this.ctx.on("resizeObserver",()=>{this.containerRect=this.ctx.containerElement.getBoundingClientRect()}),this.ctx.on("mouseup",()=>{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",t=>{this.ctx.isTarget(t)&&(this.clientY=t.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",t=>{if(this.ctx.editing)return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s,a=t.clientY,{stageHeight:c,scrollY:u,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let g=a-this.clientY;g+f<d&&(g=-(f-d)),this.resizeDiff=g,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(n<0||n>this.ctx.body.visibleWidth||o<0||o>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 f=0;f<this.renderRows.length;f++){const g=this.renderRows[f];if(o>g.y-u+g.height-1.5&&o<g.y-u+g.height+1.5&&o<c-4)for(let v=0;v<g.cells.length;v++){const p=g.cells[v];n>p.drawX+10&&n<p.drawX+p.width-10&&p.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=g)}}}}))}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:o,data:n}=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:o,row:n,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,o=this.resizeTarget.height,n=s+o+this.resizeDiff-.5,a=[0,n-.5,e,n-.5];this.ctx.paint.drawLine(a,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,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,o=-1;for(;r<=s;){let n=Math.floor((r+s)/2),a=e[n].bottom;if(a===t)return n;a<t?r=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,o=r,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),u=this.binarySearch(a,o+this.visibleHeight);if(u===-1&&(u=this.ctx.maxRowIndex),c===-1&&u===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,u+1),this.visibleRows=n.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 d=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,v=this.visibleRows[f],{height:p,top:x}=this.ctx.database.getPositionForRowIndex(g),m=new ka(this.ctx,g,0,x+this.y,e.width,p,v);d.push(m)}this.renderRows=d,this.ctx.body.renderRows=d}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 IC{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:o,FOOTER_POSITION:n}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+r,0),this.visibleHeight=this.height,s?n==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o: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:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const u=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(u,c,t,this.height,{fillColor:n,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,o)=>{const n=new ka(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,r.push(n)}),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 SC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"mousedownHeader",!1),h(this,"ctx"),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",_a(e=>{const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=this.ctx.isTarget(e)&&r>0&&r<this.ctx.body.visibleWidth&&t>this.ctx.header.visibleHeight&&t<this.ctx.header.visibleHeight+this.ctx.body.visibleHeight;(this.ctx.selectorMove||this.ctx.autofillMove)&&(!s&&!this.mousedownHeader?this.startAdjustPosition(e):this.stopAdjustPosition())},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("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.mousedownHeader=!1;const e=setTimeout(()=>{this.ctx.adjustPositioning=!1,clearTimeout(e)},0)}),this.ctx.on("cellHeaderHoverChange",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.mousedownHeader=!0,this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing){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.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.stopAdjustPosition()})}setSelector(e,t){const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!r){const[a]=o;o=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(n)){this.ctx.mousedown&&(this.ctx.selectorMove=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:u,SELECTOR_AREA_MAX_Y:d,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,v=a,p=c||this.ctx.maxColIndex-f,x=u,m=d||this.ctx.maxRowIndex-g;let[C,_]=o,[w,b]=n;if(C<v||_>p||w<x||b>m)return;if(this.ctx.stageElement.focus({preventScroll:!0}),this.ctx.config.ENABLE_MERGE_CELL_LINK){const I=this.adjustMergeCells(o,n);w=I.yArr[0],b=I.yArr[1],C=I.xArr[0],_=I.xArr[1],this.ctx.onlyMergeCell=I.onlyMergeCell}C===_&&w===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(v,C),Math.min(p,_)],n=[Math.max(x,w),Math.min(m,b)];const{BEFORE_SET_SELECTOR_METHOD:E}=this.ctx.config;if(typeof E=="function"){const I=E({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!I)return;o=I.xArr,n=I.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,o]=t,[n,a]=e;let c=[],u=[];for(let x=0;x<=t[1]-t[0];x++)for(let m=0;m<=e[1]-e[0];m++){const C=x+t[0],_=m+e[0],w=this.ctx.database.getVirtualBodyCell(C,_);w&&((C===s||C===o)&&c.push(w),(_===n||_===a)&&u.push(w))}const d=c.reduce((x,m)=>{const{yArr:C}=m.getSpanInfo(),[_,w]=C;return x.minY=Math.min(x.minY,_),x.maxY=Math.max(x.maxY,w),x},{minY:s,maxY:o}),f=u.reduce((x,m)=>{const{xArr:C}=m.getSpanInfo(),[_,w]=C;return x.minX=Math.min(x.minX,_),x.maxX=Math.max(x.maxX,w),x},{minX:n,maxX:a}),g=[f.minX,f.maxX],v=[d.minY,d.maxY];let p=!1;if(f.minX!==f.maxX||d.minY!==d.maxY){const x=JSON.stringify(g)+JSON.stringify(v),m=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();p=(m&&JSON.stringify(m.xArr)+JSON.stringify(m.yArr))===x}return{xArr:g,yArr:v,onlyMergeCell:p}}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;if(e.operation){this.selectAll();return}const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=r||this.ctx.maxRowIndex-s;if(this.ctx.mousedown&&this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],u=[o,n];this.setSelector(c,u)}else{const c=[e.colIndex,a],u=[o,n];this.setSelector(c,u)}}else{const a=[e.colIndex,e.colIndex+e.colspan-1],c=[o,n];this.setSelector(a,c)}}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:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,u=r,d=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-c,v=[u,d],p=[f,g];this.setSelector(v,p)}}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:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=r;if(t){this.ctx.setFocusCell(e);const c=[a,n],u=[e.rowIndex,e.rowIndex];this.setSelector(c,u)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const u=[a,n],d=[c,e.rowIndex];this.setSelector(u,d)}else{const u=[a,n],d=[e.rowIndex,c];this.setSelector(u,d)}}}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:o}=t,n=Math.min(r.colIndex,o),a=Math.max(r.colIndex,o),c=Math.min(r.rowIndex,s),u=Math.max(r.rowIndex,s),d=[n,a],f=[c,u];this.setSelector(d,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:o}=r,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),u=Math.max(n,s),d=Math.min(a,o),f=Math.max(a,o),g=[c,u],v=[d,f];this.setSelector(g,v)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}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 n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],r=[n.rowIndex,n.rowIndex]}else{const n={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",n):alert(n.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const n=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!n)return;e=n.data}const o=uC(e);navigator.clipboard?navigator.clipboard.writeText(o).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(n=>console.error("Copy Failure:",n)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let u=0;u<=e[1]-e[0];u++){const d=c+t[0],f=u+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(d,f);if(g){const{rowKey:v,key:p}=g;this.ctx.database.getReadonly(v,p)||(n.add(v),o.push({rowKey:v,key:p,value:s,row:{}}))}}if(!o.length)return[];if(r)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(c=>{a.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,a),o}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 o=>{let n=hC(o);const a=[r,r+n[0].length-1],c=[t,t+n.length-1],[u,d]=c,[f,g]=a,v=d-this.ctx.maxRowIndex,p=g-this.ctx.maxColIndex;(v>0||p>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:d,maxX:g,minY:u,minX:f,overflowRowCount:v,overflowColCount:p,textArr:n});const x=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!x){const w={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",w):alert(w.message);return}let m=[];for(let w=0;w<=n.length-1;w++){const b=n[w].length;for(let E=0;E<=b-1;E++){const I=w+t,T=E+r,L=n[w][E],O=this.ctx.database.getItemValueForRowIndexAndColIndex(I,T);if(O){const{rowKey:$,key:y}=O;this.ctx.database.getReadonly($,y)||(s.add($),m.push({rowKey:$,key:y,value:L,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=m.map(E=>`${E.rowKey}-${E.key}`);w.forEach(E=>{b.includes(`${E.rowKey}-${E.key}`)||m.unshift(E)}),this.isCut=!1}if(!m.length)return;const{BEFORE_PASTE_DATA_METHOD:C}=this.ctx.config;if(typeof C=="function"){const w=C,b=m.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)}));if(m=await w(b,a,c,n),m&&!m.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(m,!0);let _=[];s.forEach(w=>{_.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",m,_)}).catch(o=>{console.error("Failed to get the clipboard content:",o)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:r=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":r>o&&r--;break;case"TOP":s>n&&s--;break;case"RIGHT":r<a&&r++;break;case"BOTTOM":s<c&&s++;break}const u=[r,r],d=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(u,d),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}stopAdjustPosition(){this.adjustPositionX="",this.adjustPositionY="",this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerY&&(clearInterval(this.timerY),this.timerY=0)}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,u=r,d=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-c;return!(t<u||t>d||e<f||e>g)}startAdjustPosition(e){const{offsetX:t,offsetY:r}=this.ctx.getOffset(e);let s="",o="";if(t<0?s="left":t>this.ctx.body.visibleWidth&&(s="right"),r<this.ctx.header.visibleHeight?o="top":r>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight&&(o="bottom"),s&&this.adjustPositionX!==s){this.adjustPositionX=s;let n=10*(s==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{n*=1.5;const{scrollX:a}=this.ctx,c=a+n;(c<0||c>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(c)},100)}if(o&&this.adjustPositionY!==o){this.adjustPositionY=o;let n=10*(o==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{n*=1.5;const{scrollY:a}=this.ctx,c=a+n;(c<0||c>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(c)},100)}}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:u,scrollY:d,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:v,ENABLE_MERGE_CELL_LINK:p}}=this.ctx;if(!r)return;p&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:x,drawY:m,width:C,height:_,fixed:w}=r,b=o-x+1,E=r.drawX+C-(t-s)+1;let I=n.height-m,T=_;T>c.visibleHeight&&(T=c.visibleHeight);let L=0;g&&(v==="top"?I=n.height+a.height-m:L=a.visibleHeight);const O=m+T-(e-L-f);let $=u,y=d;E>0&&!w?$=Math.floor(u+E):b>0&&!w&&($=Math.floor(u-b)),I>0?y=Math.floor(d-I):O>0&&(y=Math.floor(d+O)),(Math.abs(u-$)>2||Math.abs(d-y)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.setScroll($,y),this.ctx.emit("adjustBoundaryPosition",r))}destroy(){this.timerX&&(clearTimeout(this.timerX),this.timerX=0),this.timerY&&(clearTimeout(this.timerY),this.timerY=0)}}class $C{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:o,drawX:n,drawY:a,width:c,height:u}=this.maxColRowCell,d=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-d+f,v=a+u-d+f;t>g&&r>v&&t<g+d&&r<v+d&&(this.ctx.stageElement.style.cursor="crosshair")}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],o=r[1],{colIndex:n,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&n===s&&a===o&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp()})}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}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])}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_SELECTOR_SPAN_COL:s,ENABLE_SELECTOR_SPAN_ROW:o}=this.ctx.config;if(!r)return;let n=e,a=t;if(!o){const[c]=a;a=[c,c]}if(!s){const[c]=n;n=[c,c]}if(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a)){const{SELECTOR_AREA_MIN_X:c,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:g,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=c,x=u||this.ctx.maxColIndex-g,m=d,C=f||this.ctx.maxRowIndex-v;let[_,w]=n,[b,E]=a;if(_<p||b<m)return;n=[Math.max(p,_),Math.min(x,w)],a=[Math.max(m,b),Math.min(C,E)];const{BEFORE_SET_AUTOFILL_METHOD:I}=this.ctx.config;if(typeof I=="function"){const T=I({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!T)return;n=T.xArr,a=T.yArr}this.ctx.autofill.xArr=n,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 v=0;v<=t.yArr[1]-t.yArr[0];v++)for(let p=0;p<=t.xArr[1]-t.xArr[0];p++){const x=v+t.yArr[0],m=p+t.xArr[0];r.set(`${x}-${m}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,u=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!u){const v={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",v):alert(v.message);return}let d=[];for(let v=0;v<=c[1]-c[0];v++)for(let p=0;p<=a[1]-a[0];p++){const x=p+a[0],m=v+c[0],C=s[v%n][p%o],_=this.ctx.database.getItemValueForRowIndexAndColIndex(m,x),w=`${m}-${x}`;if(_&&!r.has(w)){const{rowKey:b,key:E}=_;this.ctx.database.getReadonly(b,E)||(e.add(b),d.push({rowKey:b,key:E,value:C,row:{}}))}}if(!d.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 v=f,p=d.map(x=>({rowKey:x.rowKey,key:x.key,value:x.value,oldValue:this.ctx.database.getItemValue(x.rowKey,x.key),row:this.ctx.database.getRowDataItemForRowKey(x.rowKey)}));if(d=await v(p,a,c),d&&!d.length)return}this.ctx.batchSetItemValueByEditor(d,!0);let g=[];e.forEach(v=>{g.push(this.ctx.database.getRowDataItemForRowKey(v))}),this.ctx.emit("autofillChange",d,g)}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:o}=e,n=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?n.splice(1,1,o):o<t.xArr[0]&&n.splice(0,1,o):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(n,a)}}destroy(){}}const Lt=Math.min,ht=Math.max,fi=Math.round,We=i=>({x:i,y:i}),OC={left:"right",right:"left",bottom:"top",top:"bottom"},TC={start:"end",end:"start"};function tr(i,e,t){return ht(i,Lt(e,t))}function Yt(i,e){return typeof i=="function"?i(e):i}function it(i){return i.split("-")[0]}function Wt(i){return i.split("-")[1]}function La(i){return i==="x"?"y":"x"}function Rr(i){return i==="y"?"height":"width"}function ft(i){return["top","bottom"].includes(it(i))?"y":"x"}function Ir(i){return La(ft(i))}function kC(i,e,t){t===void 0&&(t=!1);const r=Wt(i),s=Ir(i),o=Rr(s);let n=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=gi(n)),[n,gi(n)]}function LC(i){const e=gi(i);return[ir(i),e,ir(e)]}function ir(i){return i.replace(/start|end/g,e=>TC[e])}function DC(i,e,t){const r=["left","right"],s=["right","left"],o=["top","bottom"],n=["bottom","top"];switch(i){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?o:n;default:return[]}}function AC(i,e,t,r){const s=Wt(i);let o=DC(it(i),t==="start",r);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(ir)))),o}function gi(i){return i.replace(/left|right|bottom|top/g,e=>OC[e])}function MC(i){return{top:0,right:0,bottom:0,left:0,...i}}function Da(i){return typeof i!="number"?MC(i):{top:i,right:i,bottom:i,left:i}}function vi(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 go(i,e,t){let{reference:r,floating:s}=i;const o=ft(e),n=Ir(e),a=Rr(n),c=it(e),u=o==="y",d=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 v;switch(c){case"top":v={x:d,y:r.y-s.height};break;case"bottom":v={x:d,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:f};break;case"left":v={x:r.x-s.width,y:f};break;default:v={x:r.x,y:r.y}}switch(Wt(e)){case"start":v[n]-=g*(t&&u?-1:1);break;case"end":v[n]+=g*(t&&u?-1:1);break}return v}const BC=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let u=await n.getElementRects({reference:i,floating:e,strategy:s}),{x:d,y:f}=go(u,r,c),g=r,v={},p=0;for(let x=0;x<a.length;x++){const{name:m,fn:C}=a[x],{x:_,y:w,data:b,reset:E}=await C({x:d,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:v,rects:u,platform:n,elements:{reference:i,floating:e}});d=_??d,f=w??f,v={...v,[m]:{...v[m],...b}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(g=E.placement),E.rects&&(u=E.rects===!0?await n.getElementRects({reference:i,floating:e,strategy:s}):E.rects),{x:d,y:f}=go(u,g,c)),x=-1)}return{x:d,y:f,placement:g,strategy:s,middlewareData:v}};async function Aa(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:o,rects:n,elements:a,strategy:c}=i,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=Yt(e,i),p=Da(v),x=a[g?f==="floating"?"reference":"floating":f],m=vi(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),C=f==="floating"?{x:r,y:s,width:n.floating.width,height:n.floating.height}:n.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},b=vi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:_,strategy:c}):C);return{top:(m.top-b.top+p.top)/w.y,bottom:(b.bottom-m.bottom+p.bottom)/w.y,left:(m.left-b.left+p.left)/w.x,right:(b.right-m.right+p.right)/w.x}}const NC=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:u,padding:d=0}=Yt(i,e)||{};if(u==null)return{};const f=Da(d),g={x:t,y:r},v=Ir(s),p=Rr(v),x=await n.getDimensions(u),m=v==="y",C=m?"top":"left",_=m?"bottom":"right",w=m?"clientHeight":"clientWidth",b=o.reference[p]+o.reference[v]-g[v]-o.floating[p],E=g[v]-o.reference[v],I=await(n.getOffsetParent==null?void 0:n.getOffsetParent(u));let T=I?I[w]:0;(!T||!await(n.isElement==null?void 0:n.isElement(I)))&&(T=a.floating[w]||o.floating[p]);const L=b/2-E/2,O=T/2-x[p]/2-1,$=Lt(f[C],O),y=Lt(f[_],O),M=$,H=T-x[p]-y,F=T/2-x[p]/2+L,X=tr(M,F,H),P=!c.arrow&&Wt(s)!=null&&F!==X&&o.reference[p]/2-(F<M?$:y)-x[p]/2<0,Y=P?F<M?F-M:F-H:0;return{[v]:g[v]+Y,data:{[v]:X,centerOffset:F-X-Y,...P&&{alignmentOffset:Y}},reset:P}}}),FC=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:x=!0,...m}=Yt(i,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const C=it(s),_=ft(a),w=it(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=g||(w||!x?[gi(a)]:LC(a)),I=p!=="none";!g&&I&&E.push(...AC(a,x,p,b));const T=[a,...E],L=await Aa(e,m),O=[];let $=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&O.push(L[C]),f){const F=kC(s,n,b);O.push(L[F[0]],L[F[1]])}if($=[...$,{placement:s,overflows:O}],!O.every(F=>F<=0)){var y,M;const F=(((y=o.flip)==null?void 0:y.index)||0)+1,X=T[F];if(X)return{data:{index:F,overflows:$},reset:{placement:X}};let P=(M=$.filter(Y=>Y.overflows[0]<=0).sort((Y,W)=>Y.overflows[1]-W.overflows[1])[0])==null?void 0:M.placement;if(!P)switch(v){case"bestFit":{var H;const Y=(H=$.filter(W=>{if(I){const V=ft(W.placement);return V===_||V==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(V=>V>0).reduce((V,we)=>V+we,0)]).sort((W,V)=>W[1]-V[1])[0])==null?void 0:H[0];Y&&(P=Y);break}case"initialPlacement":P=a;break}if(s!==P)return{reset:{placement:P}}}return{}}}};async function KC(i,e){const{placement:t,platform:r,elements:s}=i,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),n=it(t),a=Wt(t),c=ft(t)==="y",u=["left","top"].includes(n)?-1:1,d=o&&c?-1:1,f=Yt(e,i);let{mainAxis:g,crossAxis:v,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(v=a==="end"?p*-1:p),c?{x:v*d,y:g*u}:{x:g*u,y:v*d}}const HC=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await KC(e,i);return n===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},VC=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:m=>{let{x:C,y:_}=m;return{x:C,y:_}}},...c}=Yt(i,e),u={x:t,y:r},d=await Aa(e,c),f=ft(it(s)),g=La(f);let v=u[g],p=u[f];if(o){const m=g==="y"?"top":"left",C=g==="y"?"bottom":"right",_=v+d[m],w=v-d[C];v=tr(_,v,w)}if(n){const m=f==="y"?"top":"left",C=f==="y"?"bottom":"right",_=p+d[m],w=p-d[C];p=tr(_,p,w)}const x=a.fn({...e,[g]:v,[f]:p});return{...x,data:{x:x.x-t,y:x.y-r,enabled:{[g]:o,[f]:n}}}}}};function Ii(){return typeof window<"u"}function Et(i){return Ma(i)?(i.nodeName||"").toLowerCase():"#document"}function ne(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Be(i){var e;return(e=(Ma(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Ma(i){return Ii()?i instanceof Node||i instanceof ne(i).Node:!1}function pe(i){return Ii()?i instanceof Element||i instanceof ne(i).Element:!1}function _e(i){return Ii()?i instanceof HTMLElement||i instanceof ne(i).HTMLElement:!1}function vo(i){return!Ii()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof ne(i).ShadowRoot}function zt(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=xe(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function PC(i){return["table","td","th"].includes(Et(i))}function Si(i){return[":popover-open",":modal"].some(e=>{try{return i.matches(e)}catch{return!1}})}function Sr(i){const e=$r(),t=pe(i)?xe(i):i;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function YC(i){let e=ze(i);for(;_e(e)&&!gt(e);){if(Sr(e))return e;if(Si(e))return null;e=ze(e)}return null}function $r(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gt(i){return["html","body","#document"].includes(Et(i))}function xe(i){return ne(i).getComputedStyle(i)}function $i(i){return pe(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function ze(i){if(Et(i)==="html")return i;const e=i.assignedSlot||i.parentNode||vo(i)&&i.host||Be(i);return vo(e)?e.host:e}function Ba(i){const e=ze(i);return gt(e)?i.ownerDocument?i.ownerDocument.body:i.body:_e(e)&&zt(e)?e:Ba(e)}function Na(i,e,t){var r;e===void 0&&(e=[]);const s=Ba(i),o=s===((r=i.ownerDocument)==null?void 0:r.body),n=ne(s);return o?(rr(n),e.concat(n,n.visualViewport||[],zt(s)?s:[],[])):e.concat(s,Na(s,[]))}function rr(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Fa(i){const e=xe(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=_e(i),o=s?i.offsetWidth:t,n=s?i.offsetHeight:r,a=fi(t)!==o||fi(r)!==n;return a&&(t=o,r=n),{width:t,height:r,$:a}}function Ka(i){return pe(i)?i:i.contextElement}function ut(i){const e=Ka(i);if(!_e(e))return We(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:o}=Fa(e);let n=(o?fi(t.width):t.width)/r,a=(o?fi(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const WC=We(0);function Ha(i){const e=ne(i);return!$r()||!e.visualViewport?WC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function zC(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==ne(i)?!1:e}function Dt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),o=Ka(i);let n=We(1);e&&(r?pe(r)&&(n=ut(r)):n=ut(i));const a=zC(o,t,r)?Ha(o):We(0);let c=(s.left+a.x)/n.x,u=(s.top+a.y)/n.y,d=s.width/n.x,f=s.height/n.y;if(o){const g=ne(o),v=r&&pe(r)?ne(r):r;let p=g,x=rr(p);for(;x&&r&&v!==p;){const m=ut(x),C=x.getBoundingClientRect(),_=xe(x),w=C.left+(x.clientLeft+parseFloat(_.paddingLeft))*m.x,b=C.top+(x.clientTop+parseFloat(_.paddingTop))*m.y;c*=m.x,u*=m.y,d*=m.x,f*=m.y,c+=w,u+=b,p=ne(x),x=rr(p)}}return vi({width:d,height:f,x:c,y:u})}function XC(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const o=s==="fixed",n=Be(r),a=e?Si(e.floating):!1;if(r===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},u=We(1);const d=We(0),f=_e(r);if((f||!f&&!o)&&((Et(r)!=="body"||zt(n))&&(c=$i(r)),_e(r))){const g=Dt(r);u=ut(r),d.x=g.x+r.clientLeft,d.y=g.y+r.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+d.x,y:t.y*u.y-c.scrollTop*u.y+d.y}}function GC(i){return Array.from(i.getClientRects())}function sr(i,e){const t=$i(i).scrollLeft;return e?e.left+t:Dt(Be(i)).left+t}function UC(i){const e=Be(i),t=$i(i),r=i.ownerDocument.body,s=ht(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ht(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let n=-t.scrollLeft+sr(i);const a=-t.scrollTop;return xe(r).direction==="rtl"&&(n+=ht(e.clientWidth,r.clientWidth)-s),{width:s,height:o,x:n,y:a}}function qC(i,e){const t=ne(i),r=Be(i),s=t.visualViewport;let o=r.clientWidth,n=r.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const u=$r();(!u||u&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}function ZC(i,e){const t=Dt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,o=_e(i)?ut(i):We(1),n=i.clientWidth*o.x,a=i.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:n,height:a,x:c,y:u}}function po(i,e,t){let r;if(e==="viewport")r=qC(i,t);else if(e==="document")r=UC(Be(i));else if(pe(e))r=ZC(e,t);else{const s=Ha(i);r={...e,x:e.x-s.x,y:e.y-s.y}}return vi(r)}function Va(i,e){const t=ze(i);return t===e||!pe(t)||gt(t)?!1:xe(t).position==="fixed"||Va(t,e)}function JC(i,e){const t=e.get(i);if(t)return t;let r=Na(i,[]).filter(a=>pe(a)&&Et(a)!=="body"),s=null;const o=xe(i).position==="fixed";let n=o?ze(i):i;for(;pe(n)&&!gt(n);){const a=xe(n),c=Sr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&["absolute","fixed"].includes(s.position)||zt(n)&&!c&&Va(i,n))?r=r.filter(u=>u!==n):s=a,n=ze(n)}return e.set(i,r),r}function QC(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const o=[...t==="clippingAncestors"?Si(e)?[]:JC(e,this._c):[].concat(t),r],n=o[0],a=o.reduce((c,u)=>{const d=po(e,u,s);return c.top=ht(d.top,c.top),c.right=Lt(d.right,c.right),c.bottom=Lt(d.bottom,c.bottom),c.left=ht(d.left,c.left),c},po(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function jC(i){const{width:e,height:t}=Fa(i);return{width:e,height:t}}function e4(i,e,t){const r=_e(e),s=Be(e),o=t==="fixed",n=Dt(i,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=We(0);if(r||!r&&!o)if((Et(e)!=="body"||zt(s))&&(a=$i(e)),r){const v=Dt(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&(c.x=sr(s));let u=0,d=0;if(s&&!r&&!o){const v=s.getBoundingClientRect();d=v.top+a.scrollTop,u=v.left+a.scrollLeft-sr(s,v)}const f=n.left+a.scrollLeft-c.x-u,g=n.top+a.scrollTop-c.y-d;return{x:f,y:g,width:n.width,height:n.height}}function qi(i){return xe(i).position==="static"}function xo(i,e){if(!_e(i)||xe(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Be(i)===t&&(t=t.ownerDocument.body),t}function Pa(i,e){const t=ne(i);if(Si(i))return t;if(!_e(i)){let s=ze(i);for(;s&&!gt(s);){if(pe(s)&&!qi(s))return s;s=ze(s)}return t}let r=xo(i,e);for(;r&&PC(r)&&qi(r);)r=xo(r,e);return r&&gt(r)&&qi(r)&&!Sr(r)?t:r||YC(i)||t}const t4=async function(i){const e=this.getOffsetParent||Pa,t=this.getDimensions,r=await t(i.floating);return{reference:e4(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function i4(i){return xe(i).direction==="rtl"}const r4={convertOffsetParentRelativeRectToViewportRelativeRect:XC,getDocumentElement:Be,getClippingRect:QC,getOffsetParent:Pa,getElementRects:t4,getClientRects:GC,getDimensions:jC,getScale:ut,isElement:pe,isRTL:i4},Ya=HC,Wa=VC,za=FC,s4=NC,Xa=(i,e,t)=>{const r=new Map,s={platform:r4,...t},o={...s.platform,_c:r};return BC(i,e,{...s,platform:o})};let o4=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: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`;const n={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:n.background,backgroundColor:n.backgroundColor,transform:"rotate(45deg)",zIndex:n.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,n),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)})}show(i){if(!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=i.getText();i.message&&(e=i.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)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=e;const r=i.drawX+t.x,s=i.drawY+t.y;Xa({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:r,y:s,left:r,right:r+i.visibleWidth,top:s,bottom:s+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Wa(),za(),Ya(6),s4({element:this.arrowEl})]}).then(o=>{const{x:n,y:a,placement:c,middlewareData:u}=o;if(Object.assign(this.floatingEl.style,{top:`${a}px`,left:`${n}px`}),u.arrow){const d=u.arrow;["left","left-start","left-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${d.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${d.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(c)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${d.x}px`,right:""}):["top","top-start","top-end"].includes(c)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${d.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 n4{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;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),this.ctx.on("hoverIconClick",e=>{e.editorType!=="none"&&this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:a}=this.ctx;a&&(this.ctx.emit("setSelectorCell",a),this.cellTarget=a),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),u=this.inputEl.value.substring(a);this.inputEl.value=c+`
4
- `+u,this.inputEl.selectionStart=this.inputEl.selectionEnd=a+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.code==="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.code==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,r=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;r||s||o||n||["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(t)||this.startEdit(!0)}),this.ctx.on("adjustBoundaryPosition",e=>{this.cellTarget=e;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("cellClick",e=>{if(this.ctx.adjustPositioning||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(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.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,[o,n]=r,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.setAttribute("rows","1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.inputEl.addEventListener("blur",()=>{this.doneEdit()}),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(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:r,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:n}}=this.ctx,a=r-s.height-n;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>a&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${r-a}px`),this.inputEl.style.height=`${e}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:c}=e;this.drawX=c,this.drawY=a;const{config:{CELL_PADDING:u},header:d}=this.ctx;let f=this.ctx.body.visibleHeight;if(o>f&&(o=f),this.editorEl.style.display="inline-block",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${f}px`,s==="text"){this.inputEl.style.display="block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${u}px`,r!==null&&(this.inputEl.value=r),this.inputEl.focus({preventScroll:!0});const g=this.inputEl.value.length;this.inputEl.setSelectionRange(g,g)}else this.inputEl.style.display="none";(this.inputEl.scrollHeight>o||this.drawY<d.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),this.inputEl.value=""}}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||(this.ctx.emit("drawView"),!(r.isVerticalVisible()&&r.isHorizontalVisible())))return;const{rowKey:s,key:o,editorType:n}=r;if(n==="none")return;const a=this.ctx.database.getReadonly(s,o);r&&!a&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget))}editCell(e,t){const r=this.ctx.body.renderRows.find(u=>u.rowIndex===e);if(!r)return;const s=r.cells.find(u=>u.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:n,key:a}=o,c=this.ctx.database.getReadonly(n,a);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.ctx.containerElement.focus({preventScroll:!0}),this.editorEl.style.display="none",this.ctx.emit("drawView"))}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("drawView")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}class a4{constructor(e){h(this,"ctx"),h(this,"emptyEl"),this.ctx=e;const{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:s,headerHeight:o,bodyHeight:n,footerHeight:a})=>{const c=o+(n+a)/2,u={display:s==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${c}px`,transform:"translate(-50%, -50%)",...r};Object.assign(this.emptyEl.style,u)})}destroy(){this.emptyEl.remove()}}class l4{constructor(e){h(this,"ctx"),this.ctx=e}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="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:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],u=[],d=[];a.forEach(x=>{x.render&&(x.fixed==="left"?u.push(x):x.fixed==="right"?d.push(x):c.push(x))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:u},v={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-f+1}px`,height:`${n}px`},cells:c},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${n}px`},cells:d};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,v,p]}}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(x=>{x.cells.forEach(m=>{m.cellType==="footer"&&(m.render=m.renderFooter),m.render&&(m.fixed==="left"?t.push(m):m.fixed==="right"?r.push(m):e.push(m))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:u,visibleHeight:d}=this.ctx.body,f=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${d}px`},cells:t},v={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${u-o-f}px`,height:`${d}px`},cells:e},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:r};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${u}px`,height:`${d}px`},views:[g,v,p]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(p=>{p.cells.forEach(x=>{x.cellType==="footer"&&x.renderFooter&&(x.render=x.renderFooter,x.fixed==="left"?t.push(x):x.fixed==="right"?r.push(x):e.push(x))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:u}=this.ctx.footer,d=o-n,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${u}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-d}px`,height:`${u}px`},cells:e},v={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${d}px`,height:`${u}px`},cells:r};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${u}px`},views:[f,g,v]}}}class c4{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"custom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.custom=!0,this.contextMenuEl=this.ctx.contextMenuElement):(this.custom=!1,this.contextMenuEl=document.createElement("div")),this.createContextMenu(),this.init()}init(){this.ctx.on("cellContextMenuClick",(e,t)=>{if(!this.ctx.config.ENABLE_CONTEXT_MENU)return;t.preventDefault();const{xArr:r,yArr:s}=this.ctx.selector,[o,n]=r,[a,c]=s,{rowIndex:u,colIndex:d}=e;u>=a&&u<=c&&d>=o&&d<=n||this.ctx.emit("setSelectorCell",e,t);const f={getBoundingClientRect:()=>({width:0,height:0,top:t.clientY,left:t.clientX,right:t.clientX,bottom:t.clientY,x:t.clientX,y:t.clientY}),contextElement:document.body};Xa(f,this.contextMenuEl,{placement:"right-start",middleware:[Ya(),Wa(),za()]}).then(({x:g,y:v})=>{this.show(g,v)})}),this.ctx.on("click",this.hide.bind(this)),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}createContextMenu(){if(this.contextMenuEl.className="e-virt-table-context-menu",this.contextMenuEl.addEventListener("contextmenu",function(t){t.preventDefault()}),this.ctx.containerElement.appendChild(this.contextMenuEl),this.custom)return;const{CONTEXT_MENU:e}=this.ctx.config;this.createContextMenuItems(e,t=>{switch(t.value){case"copy":this.ctx.emit("contextMenuCopy");break;case"paste":this.ctx.emit("contextMenuPaste");break;case"cut":this.ctx.emit("contextMenuCut");break;case"clearSelected":this.ctx.emit("contextMenuClearSelected");break}this.hide()})}createContextMenuItems(e,t){this.contextMenuEl.replaceChildren(),e.forEach(r=>{const s=document.createElement("div");s.className="e-virt-table-context-menu-item",s.innerText=r.label,r.event?s.onclick=()=>{r.event&&r.event(),t(r)}:s.onclick=()=>t(r),this.contextMenuEl.appendChild(s)})}show(e,t){Object.assign(this.contextMenuEl.style,{left:`${e}px`,top:`${t}px`})}hide(){Object.assign(this.contextMenuEl.style,{left:"-99999px",top:"-99999px"})}updated(){this.createContextMenu()}destroy(){this.contextMenuEl.remove()}}class h4{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,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:o,contextMenuElement:n}=t,a=this.createContainer(e,r,s,o,n);this.ctx=new CC(a,this.options),this.header=new _C(this.ctx),this.footer=new IC(this.ctx),this.body=new RC(this.ctx),this.scroller=new bC(this.ctx),this.selector=new SC(this.ctx),this.autofill=new $C(this.ctx),this.tooltip=new o4(this.ctx),this.empty=new a4(this.ctx),this.editor=new n4(this.ctx),this.overlayer=new l4(this.ctx),this.contextMenu=new c4(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,r,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),c=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",c.className="e-virt-table-overlayer";const u=r||document.createElement("div");u.className="e-virt-table-editor";const d=s,f=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:u,emptyElement:d,contextMenuElement:f}}draw(e=!1){requestAnimationFrame(()=>{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()})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.contextMenu.updated(),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")}setLoading(e){this.ctx.database.setLoading(e)}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,o=!0,n=!1){this.ctx.database.setItemValue(e,t,r,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,r,s,o),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 o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],u=await this.ctx.database.getValidator(a,c);Array.isArray(u)&&u.length&&o.push(u)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:u}=a;this.scrollToRowkey(c),this.scrollToColkey(u)}}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[o]=s;if(Array.isArray(o)&&o.length){const[n]=o,{rowKey:a,key:c}=n,u=this.ctx.database.getRowForRowKey(a);if(u){const{parentRowKeys:d=[]}=u;d&&d.length&&this.setExpandRowKeys(d,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:o}=t;this.ctx.database.setValidationErrorByRowIndex(r,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<r.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(r[n]),u=s[a].key,d=await this.ctx.database.getValidator(c,u);Array.isArray(d)&&d.length&&o.push(d)}o.length?(t(o),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)}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:fC,mergeRowCell:dC,getSpanArrByRow:Sa,getSpanObjByColumn:$a}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const u4=l.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:o}=r;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=kt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Or=l.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=l.ref([]),o=i,n=pa(),a=l.computed(()=>({...o,config:{DISABLED:!0,...n,...o.config}}));let c=null;const u=l.useAttrs(),d=l.ref(null),f=l.ref(null),g=l.ref(null),v=l.ref(null),p=l.ref(),x=l.ref("text"),m=l.ref(),C={},_={},w=l.computed(()=>{const y=p.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>ct[y]||(({cellValue:M})=>M),E=y=>{var M;return(M=kt.renders[y])==null?void 0:M.renderDefault},I=(y,...M)=>({row:H,rowIndex:F,value:X})=>y({row:H,rowIndex:F,cellValue:X},...M),T=y=>{var M,H,F,X,P;if((M=y.slots)!=null&&M.default&&R.isFunction((H=y.slots)==null?void 0:H.default))return Y=>{var W,V;return(V=(W=y.slots)==null?void 0:W.default)==null?void 0:V.call(W,{row:Y.row,column:y,rowIndex:Y.rowIndex})};if((F=y.slots)!=null&&F.default&&R.isString((X=y.slots)==null?void 0:X.default))return`slot:${(P=y.slots)==null?void 0:P.default}`;if(y.cellRender&&y.cellRender.name)return Y=>{var W,V;return(V=E(y.cellRender.name))==null?void 0:V(y.cellRender,{data:o.data,row:Y.row,rowIndex:Y.rowIndex,field:y.field||Y.column.key,title:((W=Y.column)==null?void 0:W.title)??""},{})}},L=y=>{var M,H,F,X,P,Y,W;return(M=y.slots)!=null&&M.edit&&(y.field||y.key)&&R.isFunction((H=y.slots)==null?void 0:H.edit)?C[`__slot:${y.field||y.key}`]=y:(F=y.editRender)!=null&&F.name&&(y.field||y.key)&&(_[y.field||y.key]=y.editRender),{...R.omit(y,["formatter"]),key:y.key||y.field||ke(),formatter:R.isString(y.formatter)?I(b(y.formatter)):R.isArray(y.formatter)&&R.isString(y.formatter[0])?I(b(y.formatter[0]),...y.formatter.slice(1)):R.isFunction(y.formatter)?I(y.formatter):void 0,editorType:y.editorType??((X=y.slots)!=null&&X.edit&&(y.field||y.key)&&R.isFunction((P=y.slots)==null?void 0:P.edit)?`__slot:${y.field||y.key}`:(Y=y.editRender)!=null&&Y.name?y.editRender.name:void 0),render:T(y),children:(W=y.children)==null?void 0:W.map(V=>L(V))}};l.onMounted(()=>{d.value&&(c=new h4(d.value,{config:a.value.config,columns:o.columns.map(y=>L(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:v.value||void 0,editorElement:f.value||void 0}),Object.keys(u).forEach(y=>{const M=u[y];if(typeof M=="function"&&y.startsWith("on")){const H=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(H,M)}}),c.on("change",y=>{r("change",y)}),c.on("overlayerChange",y=>{m.value=y}),c.on("startEdit",y=>{p.value=y,x.value=y.editorType,x.value}),c.on("doneEdit",()=>{x.value="text"}),c.on("selectionChange",y=>{s.value=y,r("selectionChange",y)}),r("ready",c))});function O(y){if(!c||!p.value)return;const{rowKey:M,key:H}=p.value;c==null||c.setItemValueByEditor(M,H,y)}const $=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),l.watch(()=>o.columns,(y,M)=>{R.isEqual(y,M)||c==null||c.loadColumns(y.map(H=>L(H)))},{deep:!0}),l.watch(()=>a.value.config,y=>{c==null||c.loadConfig(y)},{deep:!0}),l.watch(()=>o.footerData,y=>{c==null||c.loadFooterData(y||[])},{deep:!0}),l.watch(()=>o.loading,(y,M)=>{y!==M&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,M)=>{const H=l.resolveComponent("a-empty"),F=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(F,{spinning:y.loading},{default:l.withCtx(()=>{var X,P,Y,W,V,we,de;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:d},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[x.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(C[x.value].slots.edit({row:p.value.row,column:C[x.value],rowIndex:p.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":$,value:p.value.value,"onUpdate:value":M[0]||(M[0]=se=>p.value.value=se),cell:p.value,onBlur:O},null,40,["style","value","cell"])):(X=l.unref(kt).renders[x.value])!=null&&X.renderEdit?(l.openBlock(),l.createBlock(l.unref(u4),{key:1,"cell-render":_[p.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(P=p.value)==null?void 0:P.row,rowIndex:((Y=p.value)==null?void 0:Y.rowIndex)??-1,field:((W=p.value)==null?void 0:W.key)??"",title:((we=(V=p.value)==null?void 0:V.column)==null?void 0:we.title)??""},bordered:!1,"get-popup-container":$,onBlur:O},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(y.$slots,"empty",{},()=>[l.createVNode(H,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:v},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((de=m.value)==null?void 0:de.views)||[],se=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(se.class),style:l.normalizeStyle(se.style),key:se.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(se.views,$e=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle($e.style),key:$e.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList($e.cells,j=>(l.openBlock(),l.createElementBlock("div",{class:"canvas-cell",key:`${j.rowKey}_${j.key}`,style:l.normalizeStyle(j.style)},[typeof j.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(j.render(j)),{key:0,bordered:!1})):typeof j.render=="string"&&j.render.startsWith("slot:")?l.renderSlot(y.$slots,j.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},j,{cell:j})):l.createCommentVNode("",!0)],4))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),d4={key:0},f4={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},g4={class:"flex items-center flex-1 gap-4px"},v4={key:2},p4={class:"flex items-center gap-4px"},x4={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},m4={key:0,class:"w-full text-slate-5 pl-4"},Ga=l.defineComponent({__name:"PCanvasGrid",props:{selectConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean},fitHeight:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var Gt,Ut,qt,Zt,Jt;const r=i,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:u,proxyConfig:d,config:f,selectConfig:g}=l.toRefs(r),v=va(),p=pa(),x=l.ref(ke()),m=l.ref({}),C=l.computed(()=>({...r,config:{...p,...r.config},lazyReset:r.lazyReset??v.lazyReset??!1,fitCanvasHeight:r.fitHeight??v.fitCanvasHeight??100})),_=l.computed(()=>d.value&&d.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>_.value==="pagination"?{current:E.page,total:T.value,pageSize:E.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const w=l.computed(()=>R.omit({labelCol:yr,...n.value},["items"])),b=l.reactive({toolbar:!1,form:!1,table:!1}),E=l.reactive({page:1,size:((Gt=a.value)==null?void 0:Gt.pageSize)??10}),I=l.ref(0),T=l.ref(0),L=l.ref([]),O=l.ref(),$=l.ref(),y=l.ref(),M=l.ref(),H=l.ref(500),F=l.ref({}),X=D=>{F.value[E.page]=D},P=l.reactive([...(((qt=(Ut=r.toolbarConfig)==null?void 0:Ut.buttons)==null?void 0:qt.map(D=>D.code))??[]).filter(D=>D),...(((Jt=(Zt=r.toolbarConfig)==null?void 0:Zt.tools)==null?void 0:Jt.map(D=>D.code))??[]).filter(D=>D)].reduce((D,B)=>(D[B]=!1,D),{})),Y=(D,B)=>{P[D]=B},W=D=>{R.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(b.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(b.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(b.table=D.table)):R.isBoolean(D)&&(b.form=D,b.toolbar=D,b.table=D)},V=l.computed(()=>R.uniq(Object.values(F.value).flat(),D=>{var B;return D[((B=r.config)==null?void 0:B.ROW_KEY)??"id"]})),we=()=>{bt()},de=l.computed(()=>V.value.map(D=>{var B;return D[((B=r.config)==null?void 0:B.ROW_KEY)??"id"]})),se=(D,B)=>B?{list:R.isString(B.list)?R.get(D,B.list):R.isFunction(B.list)?B.list(D):void 0,total:R.isString(B.total)?R.get(D,B.total):R.isFunction(B.total)?B.total(D):void 0,result:R.isString(B.result)?R.get(D,B.result):R.isFunction(B.result)?B.result(D):void 0,message:R.isString(B.message)?R.get(D,B.message):R.isFunction(B.message)?B.message(D):void 0}:{list:D},$e=D=>{o("toolbarButtonClick",{data:L.value,code:D,selectedKeys:de.value,records:V.value}),_t(D)},j=R.debounce($e,100),Xt=({key:D})=>j(D),Oi=D=>{o("toolbarToolClick",{data:L.value,code:D,selectedKeys:de.value,records:V.value}),_t(D)},Ti=R.debounce(Oi,100),Ct=()=>new Promise(D=>{if(_.value!=="bad"){W({table:!0,form:!0});const{ajax:B}=d.value;B.query({form:m.value,page:E}).then(G=>{const{list:Te,total:Je,result:le,message:fe}=se(G,d.value.response);Te?(L.value=Te,I.value++):le?(L.value=le,T.value=Je??le.length,I.value++):(L.value=[],I.value++,fe&&ui(fe)),D(L.value)}).catch(G=>{console.error("fetchData error",G),D([])}).finally(()=>{W({table:!1,form:!1})})}}),Ne=(D,B)=>(E.page=D,E.size=B,Ct()),bt=()=>(E.page=1,F.value={},Ct()),Ue=R.debounce(Ct,160),ki=(D,B)=>(Object.assign(m.value,D),E.page=1,B?Promise.resolve():Ue()),_t=D=>{const{ajax:B}=d.value;switch(D){case"multiDelete":B.multiDelete&&(de.value.length>0?Ca({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),B.multiDelete(de.value).then(()=>{JE("删除成功"),bt()}).catch(()=>{QE("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),P.multiDelete=!1})}):ui("请选择要删除的数据"));break}},Li=l.computed(()=>{var D;return(D=g.value)!=null&&D.multiple?[{type:"selection",width:40,widthFillDisable:!0,title:""},...c.value]:c.value}),qe=D=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const B={};Tt(n.value.items,G=>{G.field&&G.itemRender?Ye(G.itemRender.defaultValue)?B[G.field]=G.itemRender.defaultValue:B[G.field]=void 0:G.field&&G.slots&&(Ye(G.slots.defaultValue)?B[G.field]=G.slots.defaultValue:B[G.field]=void 0)}),m.value=B}o("resetQuery")}E.page=1,D||Ue()},Di=()=>(F.value={},qe()),Oe=()=>{var le,fe;const D=(le=y.value)==null?void 0:le.parentElement,B=D?window.getComputedStyle(D).height:"0px",G=M.value?window.getComputedStyle(M.value).height:"0px",Te=G.includes("px")?R.toNumber(G.replace("px","")):0,Je=(fe=g.value)!=null&&fe.showCount?22:0;H.value=R.toNumber(B.replace("px",""))-C.value.fitCanvasHeight-(r.toolbarConfig?30:0)-Te-Je};let Ze;return l.onMounted(()=>{Oe(),window.addEventListener("resize",Oe),Ze=new MutationObserver(D=>{D.forEach(B=>{if(B.type==="attributes"&&B.attributeName==="style"){const G=B.target;window.getComputedStyle(G).display!=="none"&&Oe()}})}),y.value&&Ze.observe(y.value,{attributes:!0,attributeFilter:["style"]}),qe(r.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Oe),Ze.disconnect()}),e({commitProxy:{query:Ue,reload:Di,reloadPage:bt,passQuery:ki},$canvasTable:l.computed(()=>$.value),selectedRowKeys:de,setBtnLoading:Y,selectedRecords:V,$form:l.computed(()=>O.value),getFormData:()=>m.value,setLoadings:W,resizeTable:Oe}),(D,B)=>{var le,fe,Rt;const G=l.resolveComponent("a-menu-item"),Te=l.resolveComponent("a-menu"),Je=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:y,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[_.value==="bad"?(l.openBlock(),l.createElementBlock("div",d4,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(fe=(le=l.unref(n))==null?void 0:le.items)!=null&&fe.some(K=>K.field&&K.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:M},[l.createVNode(l.unref(k.Spin),{spinning:b.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(k.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:O,model:m.value},w.value,{onSubmit:we}),{default:l.withCtx(()=>[l.createVNode(l.unref(k.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(K,Fe)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${K.field||Fe}`,"form-data":m.value,item:K,onReset:B[0]||(B[0]=S=>qe(C.value.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(u)?(l.openBlock(),l.createElementBlock("div",f4,[l.createElementVNode("div",g4,[l.unref(u).buttons&&l.unref(u).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).buttons,(K,Fe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Fe},[K.dropdowns&&K.dropdowns.length?(l.openBlock(),l.createBlock(Je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Te,{onClick:Xt},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(K.dropdowns,S=>(l.openBlock(),l.createBlock(G,{key:S.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(S.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(k.Button),{type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content)+" ",1),l.createVNode(l.unref(dt.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):K.code?(l.openBlock(),l.createBlock(l.unref(k.Button),{key:1,type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code],onClick:S=>l.unref(j)(K.code)},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",v4))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",p4,[l.unref(u).tools&&l.unref(u).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).tools,(K,Fe)=>(l.openBlock(),l.createBlock(l.unref(k.Button),{key:Fe,type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,onClick:S=>l.unref(Ti)(K.code),loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{icon:K.icon},null,8,["icon"])]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",x4,[(Rt=l.unref(g))!=null&&Rt.multiple&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",m4," 已选:"+l.toDisplayString(de.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Or,{ref_key:"canvasTableRef",ref:$,columns:Li.value,config:{...l.unref(f),HEIGHT:H.value},onSelectionChange:X,data:L.value,loading:b.table},null,8,["columns","config","data","loading"]),_.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(k.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:E.page,"page-size":E.size,total:T.value,onChange:Ne},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Tr=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=r.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Cr,l.mergeProps({ref_key:"formEl",ref:r},n.value,{data:l.unref(s)}),null,16,["data"]))}}),Ua=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},editAble:{type:Boolean},showAdd:{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=k.Form.useForm,r=l.ref(),s=i,o=l.ref(),n=l.useModel(i,"modelValue"),a=l.ref(0),c=l.ref([]),u=l.ref([]),d=E=>{a.value=E},f=l.computed(()=>s.max??1/0),g=E=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(T=>{var L;n.value=[...n.value,{...T,__index:(((L=R.max(n.value,O=>O.__index??-1))==null?void 0:L.__index)??-1)+1}],a.value=E})},v=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],p=()=>{var E;return((E=o.value)==null?void 0:E.$el)??document.body},x=l.computed(()=>s.forceRender||n.value.length<=5),m=E=>{var T;const I=(T=n.value.find((L,O)=>O===E))==null?void 0:T.__index;q(I)&&(c.value=c.value.filter(L=>L!==I))},C=()=>{l.nextTick().then(()=>{var E,I;m(a.value),(I=(E=u.value[a.value])==null?void 0:E.$form)==null||I.validate()})};l.watch(()=>n.value,()=>{if(!s.keepSerial){const E=n.value.filter(I=>!q(I.__index));E.length>0&&E.forEach(I=>{var T;I.__index=(((T=R.max(n.value,L=>L.__index??-1))==null?void 0:T.__index)??-1)+1})}},{immediate:!0});const _=({key:E},I,T)=>{var L;if(s.menuHandler&&R.isFunction(s.menuHandler))s.menuHandler({code:R.toString(E),data:I,index:T});else switch(E){case"delete":n.value=n.value.filter((O,$)=>$!==T),l.nextTick(()=>{u.value=u.value.filter(O=>!!O),T<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=f.value){ui("已达到最大数量");return}n.value=[...n.value,R.clone({...R.omit(I,["id","__index"]),__index:(((L=R.max(n.value,O=>O.__index??-1))==null?void 0:L.__index)??-1)+1})];break}},w=R.debounce(_,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const b=R.debounce(m,50);return l.watchEffect(()=>{var T;const E=n.value.map((L,O)=>c.value.includes(L.__index)?O:void 0).filter(q),I=(T=r.value)==null?void 0:T.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((O,$)=>{E.includes($)?O.classList.add("p-error-group-tab"):O.classList.remove("p-error-group-tab")})}),e({activeKey:l.computed(()=>a.value),setActiveKey:d,validateAll:()=>{const E=x.value?u.value.map(I=>{var T;return(T=I.$form)==null?void 0:T.validate()}):n.value.map(I=>{var T;return((T=t(I,s.getFormSetting(I).rules))==null?void 0:T.validate())??Promise.resolve()});return Promise.allSettled(E).then(I=>{if(c.value=I.map((T,L)=>{var O;return T.status==="rejected"&&typeof((O=n.value[L])==null?void 0:O.__index)=="number"?n.value[L].__index:void 0}).filter(T=>typeof T=="number"),!s.lazyErrorMark&&c.value.length){const T=c.value[0],L=n.value.findIndex(O=>O.__index===T);L!==-1&&(a.value=L)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(E,I)=>{var L,O,$;const T=n.value.findIndex(y=>y.__index===E);try{return await(x.value?((O=(L=u.value[T])==null?void 0:L.$form)==null?void 0:O.validate())??Promise.resolve():(($=t(n.value[T],s.getFormSetting(n.value[T]).rules))==null?void 0:$.validate())??Promise.resolve()),c.value=c.value.filter(y=>y!==E),Promise.resolve()}catch(y){return!c.value.includes(E)&&!I&&(c.value=[...c.value,E]),Promise.reject(y)}},validateFields:async(E,I,T)=>{var M,H;const L=n.value.findIndex(F=>F.__index===E),$=s.getFormSetting(n.value[L]).rules,y=t(n.value[L],$);try{return await(x.value?((H=(M=u.value[L])==null?void 0:M.$form)==null?void 0:H.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(F=>y.validateField(F,n.value[L][F],$[F]??[])))),Promise.resolve()}catch(F){return!c.value.includes(E)&&!T&&(c.value=[...c.value,E]),Promise.reject(F)}}}),(E,I)=>{const T=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(l.unref(k.Card),{ref_key:"rootRef",ref:o,title:E.title,size:"small"},{default:l.withCtx(()=>[E.loading?(l.openBlock(),l.createBlock(T,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(k.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=L=>a.value=L),"hide-add":"",onChange:C},{rightExtra:l.withCtx(()=>[l.renderSlot(E.$slots,"rightExtra",{},()=>[E.showAdd&&n.value.length<f.value?(l.openBlock(),l.createBlock(l.unref(k.Button),{key:0,type:"link",onClick:I[0]||(I[0]=L=>g(n.value.length))},{default:l.withCtx(()=>I[2]||(I[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(L,O)=>(l.openBlock(),l.createBlock(l.unref(k.TabPane),{key:O,tab:`${E.tabLabel} ${E.keepSerial?O+1:(L.__index??0)+1}`,"force-render":x.value},{closeIcon:l.withCtx(()=>{var $;return[E.editAble&&(($=l.unref(v))!=null&&$.length)?(l.openBlock(),l.createBlock(l.unref(k.Dropdown),{key:0,"get-popup-container":p},{overlay:l.withCtx(()=>[l.createVNode(l.unref(k.Menu),{onClick:y=>l.unref(w)(y,L,O)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(v).filter(y=>{var M;return((M=y.visibleMethod)==null?void 0:M.call(y,{data:L,index:O}))??!0}),y=>(l.openBlock(),l.createBlock(l.unref(k.MenuItem),{key:y.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(y.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dt.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Tr,{ref_for:!0,ref_key:"blockInstance",ref:u,key:O,source:L,"get-form-setting":E.getFormSetting,onFocusCapture:$=>l.unref(b)(O),onClickCapture:$=>l.unref(b)(O)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:3},8,["title"])}}}),y4={class:"w-full text-right p-2"},qa=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(i,{expose:e}){const t=l.ref(),r=l.ref(!1),s=i,o=l.computed(()=>{var p;return(p=s.gridSetting.selectConfig)==null?void 0:p.multiple});let n,a,c;const u=l.reactive({modal:!1}),d=()=>{c&&c()},f=()=>{u.modal=!1,c&&c()},g=({row:p,field:x})=>{n&&!o.value&&s.beforePick(p).then(()=>{u.modal=!1,n({row:p,field:x})})},v=()=>{var x;const p=((x=t.value)==null?void 0:x.selectedRecords)??[];p.length===0&&!s.multipleAllowEmpty?ui("请选择数据"):s.beforePick(p).then(()=>{u.modal=!1,a(p)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((p,x)=>{n=p,c=x,r.value=!1,u.modal=!0,l.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((p,x)=>{a=p,c=x,r.value=!1,u.modal=!0,l.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{u.modal=!1}}),(p,x)=>(l.openBlock(),l.createBlock(l.unref(k.Modal),{open:u.modal,"onUpdate:open":x[0]||(x[0]=m=>u.modal=m),"destroy-on-close":"",title:p.title,width:p.width,footer:o.value?void 0:null,onCancel:d,"body-style":p.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:r.value?"unset":"642px"})},[l.createVNode(br,l.mergeProps(p.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",y4,[l.createElementVNode("span",null,[l.createVNode(l.unref(k.Button),{class:"mr-4",onClick:f},{default:l.withCtx(()=>x[1]||(x[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(k.Button),{type:"primary",onClick:v},{default:l.withCtx(()=>x[2]||(x[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function Za(i){i&&ga(i)}const w4={install(i){i.component("PForm",Cr),i.component("PGrid",br),i.component("PCanvasTable",Or),i.component("PCanvasGrid",Ga),i.component("PFormGroup",Ua),i.component("PGroupBlock",Tr),i.component("PromisePicker",qa)},addFormatter:ma,addRender:wr,setup:Za};exports.PCanvasGrid=Ga;exports.PCanvasTable=Or;exports.PForm=Cr;exports.PFormGroup=Ua;exports.PGrid=br;exports.PGroupBlock=Tr;exports.PromisePicker=qa;exports.addFormatter=ma;exports.addRender=wr;exports.cleanCol=Ri;exports.default=w4;exports.defaultItemResponsive=mr;exports.defaultLabelCol=yr;exports.get24rest=xa;exports.getButtonResponsive=KE;exports.getUIKitConfig=ME;exports.labelColDict=FE;exports.resetUIKitConfig=NE;exports.setUIKitConfig=ga;exports.setup=Za;
3
+ `)}return o}function Sa(i,e,t=[]){let r=0;const s=[];return i.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((u,d)=>`${u}${o[d]??""}`,"")||o[e],c=t.reduce((u,d)=>`${u}${i[n-1][d]??""}`,"")||i[n-1][e];a===c?(s[r]+=1,s.push(0)):(s.push(1),r=n)}}),s}function $a(i,e){let t="",r="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,r=o.key,s[o.key]=1):i[o.key]===i[t]?(s[o.key]=0,s[r]+=1):(s[o.key]=1,t=o.key,r=o.key)}),s}function dC(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:o}=i,n=Sa(r,e,t);return n[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:n[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function fC(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=$a(r,o);return n[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:n[t.key],relationColKeys:e,mergeCol:!0}}}function gC(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}class Oa{constructor(e,t,r,s,o,n,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=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-r<=0||this.x-r>=o-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 _r extends Oa{constructor(e,t,r,s,o,n,a,c,u,d="body"){super(e,s,o,n,a,d,c.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,"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,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawImageX",0),h(this,"drawImageY",0),h(this,"drawImageWidth",0),h(this,"drawImageHeight",0),h(this,"drawImageName",""),h(this,"drawImageSource"),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"),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=d,this.align=c.align||"center",this.verticalAlign=c.verticalAlign||"middle",this.fixed=c.fixed,this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=u,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.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.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.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:o,relationColKeys:n,mergeRow:a=!1,mergeCol:c=!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(o)&&o.length>0?this.relationRowKeys=o:this.relationRowKeys=[this.key],Array.isArray(n)&&n.length>0?this.relationColKeys=n:this.relationColKeys=[this.key],this.mergeCol=c,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.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,o=0,n="";if(this.type==="tree"&&r==="body"){const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:u=!1,expandLoading:d=!1,level:f=0}=a||{};if(this.rowExpand=c,this.rowHasChildren=u,d){const p=this.ctx.icons.get("loading");n="loading",s=p,o=f*8}else if(u){const p=this.ctx.icons.get("expand"),x=this.ctx.icons.get("shrink");s=c?x:p,n=c?"shrink":"expand",o=f*8}else o=f*8;let g=20,v=20;if(s){let p=this.drawX+o+e,x=this.drawY+(this.visibleHeight-v)/2;this.ctx.paint.drawImage(s,p,x,g,v),this.drawImageX=p,this.drawImageY=x,this.drawImageWidth=g,this.drawImageHeight=v,this.drawImageName=n,this.drawImageSource=s}this.align="left",this.drawTextX=o+this.drawX+g-.5}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:u,HIGHLIGHT_SELECTED_ROW_COLOR:d,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:v,STRIPE_COLOR:p}=this.ctx.config;if(this.cellType==="footer"){let I=c,T=a;if(typeof s=="function"){const k=s,{backgroundColor:O,color:S}=k({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};O&&(I=O),S&&(T=S)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=I,this.drawTextColor=T;return}let x="transparent";const m=this.ctx.hoverCell,C=this.ctx.currentCell;let _=this.rowIndex,w=this.rowIndex;if(this.rowspan!==1&&(f||u)){const I=this.getSpanInfo(),{yArr:T}=I;_=T[0],w=T[1]}f&&m&&(m.rowKey===this.rowKey&&(x=g),m.rowIndex>=_&&m.rowIndex<=w&&(x=g)),u&&C&&(C.rowKey===this.rowKey&&(x=d),C.rowIndex>=_&&C.rowIndex<=w&&(x=d)),this.drawCellSkyBgColor=x;let b=e,E=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(b=t,E=o),v&&(this.rowIndex%2?b=p:b=e),typeof r=="function"){const I=r,{backgroundColor:T,color:k}=I({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};T&&(b=T),k&&(E=k)}this.drawCellBgColor=b,this.drawTextColor=E}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(!(r===0||s===0)&&o!=="footer"&&["index-selection","selection"].includes(n)){const u=this.ctx.database.getRowSelection(c),d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0}=this.ctx.config,g=this.drawX+(e-f)/2,v=this.drawY+(t-f)/2;let p=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck";u&&d?(p=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):u&&d?(p=this.ctx.icons.get("checkbox-check-disabled"),x="checkbox-check-disabled"):!u&&d?(p=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(p=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled"),p&&n=="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(x))&&(this.drawImageX=g,this.drawImageY=v,this.drawImageWidth=f,this.drawImageHeight=f,this.drawImageName=x,this.drawImageSource=p):p&&n==="selection"&&(this.drawImageX=g,this.drawImageY=v,this.drawImageWidth=f,this.drawImageHeight=f,this.drawImageName=x,this.drawImageSource=p)}}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 n=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});n!==void 0&&(this.hoverIconName=n)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let n=0,a=0;if(o.rowKey===this.rowKey&&(n=this.drawX+this.width-t-r,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const u=this.getSpanInfo(),{yArr:d}=u,f=d[0],g=d[1];if(o.rowIndex>=f&&o.rowIndex<=g){const{width:v,height:p,offsetTop:x,offsetLeft:m}=u;n=this.drawX-m+v-t-r,a=this.drawY-x+(p-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawImageX=n,this.drawImageY=a,this.drawImageWidth=t,this.drawImageHeight=t,this.drawImageName=this.hoverIconName,this.drawImageSource=c}}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.drawImageName))||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}px`,t=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"&&(e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=`${this.drawY-this.ctx.footer.y}px`),{position:"absolute",overflow:"hidden",left:e,top:t,width:`${this.visibleWidth}px`,height:`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+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:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:u,rowIndex:d,drawX:f,drawY:g}=this;if(u===a&&d===c){const v=u===this.ctx.maxColIndex||d===this.ctx.maxRowIndex||u===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-v,g+this.height-v,6,6,{borderColor:s,fillColor:e})}}draw(){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 o=this.ctx.header.leafCellHeaders[s];r+=o.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r}=this.ctx.config;let s=this.visibleWidth;if(this.type==="tree"){const u=this.drawTextX-this.drawX;s=this.visibleWidth-u}const{ellipsis:o}=this.ctx.paint.handleEllipsis(this.displayText,s,e,t);this.ellipsis=o;const{placeholder:n}=this.column;let a=this.displayText,c=this.drawTextColor;return!this.ctx.database.getReadonly(this.rowKey,this.key)&&n&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(a=n,c=r),this.ctx.paint.drawText(a,this.drawTextX,this.drawTextY,s,this.visibleHeight,{font:t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:c})}drawImage(){if(this.drawImageSource){if(this.hoverIconName){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawImageX-2,this.drawImageY-2,this.drawImageWidth+4,this.drawImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e})}this.ctx.paint.drawImage(this.drawImageSource,this.drawImageX,this.drawImageY,this.drawImageWidth,this.drawImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:r,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,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[n,a]=t,[c,u]=r;!(n===a&&c===u)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=u&&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>=c&&this.rowIndex<=u&&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,o=this.drawY,n=[s+r-e-.5,o,s+r-.5,o,s+r-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,u=r;const{xArr:d,yArr:f,lineDash:g=[],borderWidth:v=1,borderColor:p,fillColor:x}=e,m=d[0],C=d[1],_=f[0],w=f[1];if(o>=m&&o<=C&&s===_){const b=o===C?1:0,E=o===m?1:0;this.ctx.paint.drawLine([c+E,u+1,c+a-b,u+1],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===C&&s>=_&&s<=w){const b=s===_?1:0,E=s===w?1:0;this.ctx.paint.drawLine([c+a-1,u+b,c+a-1,u+n-E],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=m&&o<=C&&s===w){const b=o===C?1:0,E=o===m?1:0;this.ctx.paint.drawLine([c+E,u+n-1,c+a-b,u+n-1],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===m&&s>=_&&s<=w){const b=s===w?1:0,E=s===_?1:0;this.ctx.paint.drawLine([c+1,u+E,c+1,u+n-b],{borderColor:p,fillColor:x,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}}}class vC{constructor(e,t){h(this,"loading",!1),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,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),this.ctx=e;const{data:r=[],columns:s=[],footerData:o=[]}=t;this.data=r,this.footerData=o,this.columns=s,this.setLoading(!0),this.init()}init(e=!0){this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();const t=this.getColumns(),r=di(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=[]){e.forEach((s,o)=>{var n;const{ROW_KEY:a="",DEFAULT_EXPAND_ALL:c,CELL_HEIGHT:u,SELECTABLE_METHOD:d,CHECKBOX_KEY:f}=this.ctx.config,g=s[a],v=g!=null?`${g}`:ba();this.itemRowKeyMap.set(s,v);const p=s._height||u,x=s._readonly;let m=!0;if(typeof d=="function"&&(m=d),f){const _=s[f];if(this.checkboxKeyMap.has(_)){const w=this.checkboxKeyMap.get(_)||[];w.push(v),this.checkboxKeyMap.set(_,w)}else this.checkboxKeyMap.set(_,[v])}this.selectionMap.set(v,{key:f?s[f]:v,row:s,check:((n=this.selectionMap.get(v))==null?void 0:n.check)||!1});const C=c||this.expandMap.get(v)||s._expand||!1;this.expandMap.set(v,C),this.rowKeyMap.set(v,{readonly:x,index:o,rowIndex:o,level:t,height:p,check:!1,selectable:m,expand:C,expandLazy:!1,hasChildren:s._hasChildren||(Array.isArray(s.children)?s.children.length>0:!1),expandLoading:!1,item:s,parentRowKeys:r}),Array.isArray(s.children)&&s.children.length&&this.initData(s.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()}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}filterColumns(e){return e.reduce((t,r)=>{if(!(typeof r.hide=="function"?r.hide():r.hide)){const s={...r};s.children&&Array.isArray(s.children)&&(s.children=this.filterColumns(s.children)),t.push(s)}return t},[])}getColumns(){return this.filterColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.columns.length&&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=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:u,height:d}=this.rowKeyMap.get(a),f=this.sumHeight;this.sumHeight+=d,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:f,height:d,bottom:this.sumHeight}),t+=1,c&&u&&r(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;return typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),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}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 o=[],n=r;const a=new Set;let c=[],u=e.map(v=>{const{rowKey:p,key:x}=v;let m=v.value,C=m;const _=this.getRowDataItemForRowKey(p),w=this.getItemValue(p,x),b=this.getVirtualBodyCellByKey(p,x);return(b==null?void 0:b.type)==="number"&&(["",void 0,null].includes(m)?C=null:/^-?\d+(\.\d+)?$/.test(`${m}`)?C=Number(m):(C=w,c.push({...v,value:C,oldValue:w,row:_}))),{...v,value:C,oldValue:w,row:_}});if(u=u.filter(v=>!c.some(p=>v.rowKey===p.rowKey&&v.key===p.key)),c.length){const v={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",v)}if(!u.length)return;const{BEFORE_VALUE_CHANGE_METHOD:d}=this.ctx.config;s==="none"&&typeof d=="function"&&(u=await d(u),n=!1),u.forEach(v=>{const{value:p,rowKey:x,key:m}=v,C=this.getItemValue(x,m);a.add(x),this.setItemValue(x,m,p,!1,!1,!1,n),o.push({rowKey:x,key:m,oldValue:C,newValue:p})});let f=[];a.forEach(v=>{f.push(this.ctx.database.getRowDataItemForRowKey(v))});const g=u.map(({rowKey:v,key:p})=>this.getValidator(v,p));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())}),this.ctx.emit("change",u,f),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let u=c[t],d=r;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:u,newValue:u};c[t]!==null&&typeof c[t]=="object"&&(u=JSON.parse(JSON.stringify(c[t])));const f=`${e}​_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,u);const g=this.originalDataMap.get(f),v=this.getRowDataItemForRowKey(e);if(n){const p=this.getVirtualBodyCellByKey(e,t);if((p==null?void 0:p.type)==="number")if(["",void 0,null].includes(r))d=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))d=Number(r);else{d=u;const m={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:d,oldValue:u,row:v}]};this.ctx.emit("error",m)}if(d===u)return{oldValue:u,newValue:u};let x=[{rowKey:e,key:t,value:d,oldValue:u,row:v}];this.batchSetItemValue(x,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:u,value:d,originalValue:g,row:v})}else this.changedDataMap.set(f,d),c[t]=d;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:u,value:d,originalValue:this.originalDataMap.get(f),row:v}),o&&this.ctx.emit("draw"),{oldValue:u,newValue:d}}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),o=s[r];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e){const t=this.rowKeyMap.get(e),r=this.selectionMap.get(e);if(!r)return;r.check=!r.check,this.setRowSelectionByCheckboxKey(e,r.check),this.ctx.emit("toggleRowSelection",t);const s=this.getSelectionRows();this.ctx.emit("selectionChange",s),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}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),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}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}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.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){e?this.rowKeyMap.forEach((r,s)=>{this.setRowSelection(s,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((r,s)=>{this.selectionMap.set(s,{check:!1,row:r.item,key:s})}));const t=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",t),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,o=0;const n=this.selectionMap.size,a=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,v)=>{var p;(p=this.selectionMap.get(v))!=null&&p.check&&(s+=1);let x=g.selectable;typeof x=="function"&&(x=x({row:g.item,rowIndex:g.rowIndex})),x&&(o+=1)});const c=n>r&&s===0&&a,u=o&&o>s&&s>0||c,d=o!==0,f=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:u,selectable:d},{check:f,indeterminate:u,selectable:d}}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),o=r.split("​_")[0],n=r.split("​_")[1];s!==t&&e.push({rowKey:o,colKey:n,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const o=this.originalDataMap.get(s),n=s.split("​_")[0];o!==r&&e.add(n)});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),o=this.changedDataMap.get(r);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom: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),o=this.headerMap.get(t);if(!s||!o)return!0;const n=s.readonly,a=o.readonly,{BODY_CELL_READONLY_METHOD:c}=this.ctx.config;if(typeof c=="function"&&o){const u=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(u!==void 0)return u}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(r=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(o===void 0)return r([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const u=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});u&&(c=u)}if(c){const u={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},d=new aC(c).validate(u);this.setValidationError(e,t,d),r(d)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(r+=o.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:u,rowspan:d,height:f,width:g,colspan:v,mergeRow:p,mergeCol:x}=e;if(d===1&&v===1)return{xArr:[a,a],yArr:[t,t],rowspan:d,colspan:v,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:o,value:n}]};let m=t,C=t,_=a,w=a,b=[],E=0,I=0,T=0,k=0;if(d!==1&&p){k=g;const O=c.reduce((S,y)=>{const M=this.getItemValue(s,y)??"";return`${S}${M}`},"");for(let S=t-1;S>=0;S--){const y=this.rowIndexRowKeyMap.get(S)||"",M=c.reduce((H,F)=>{const X=this.getItemValue(y,F)??"";return`${H}${X}`},"");if(O===M)m=S;else break}for(let S=t;S<=this.ctx.maxRowIndex;S++){const y=this.rowIndexRowKeyMap.get(S)||"",M=c.reduce((H,F)=>{const X=this.getItemValue(y,F)??"";return`${H}${X}`},"");if(O===M)C=S;else break}for(let S=m;S<t;S++){const{height:y}=this.positions[S];E+=y}for(let S=m;S<=C;S++){const{height:y}=this.positions[S];T+=y;const M=this.rowIndexRowKeyMap.get(S)||"",{item:H}=this.rowKeyMap.get(M),F=this.getItemValue(M,r);b.push({rowKey:M,key:r,value:F,row:H})}}if(v!==1&&x){T=f;for(let O=a-1;O>=0;O--){const S=this.getColumnByColIndex(O);if(!S)break;const y=this.getItemValue(s,r),M=this.getItemValue(s,S.key);if(y===M&&u.includes(S.key))_=O;else break}for(let O=a;O<=this.ctx.maxColIndex;O++){const S=this.getColumnByColIndex(O);if(!S)break;const y=this.getItemValue(s,r),M=this.getItemValue(s,S.key);if(y===M&&u.includes(S.key))w=O;else break}for(let O=_;O<a;O++){const S=this.getColumnByColIndex(O);if(!S)break;I+=S.width||100}for(let O=_;O<=w;O++){const S=this.getColumnByColIndex(O);if(!S)break;k+=S.width||100,b.push({rowKey:s,key:S.key,value:this.getItemValue(s,S.key),row:o})}}return{xArr:[_,w],yArr:[m,C],rowspan:d,colspan:v,height:T,width:k,offsetTop:E,offsetLeft:I,dataList:b}}setLoading(e){this.loading=e,this.ctx.emit("loadingChange",e)}getLoading(){return this.loading}setValidationErrorByRowIndex(e,t,r){const s=this.rowIndexRowKeyMap.get(e),o=`${s}​_${t}`,n=this.getRowForRowIndex(e),a=this.getColumnByKey(t);if(!s||!a||!n)return;const c=this.getItemValue(s,t),u=[{key:t,rowKey:s,rowIndex:e,colIndex:a.colIndex,column:a.column,row:n,value:c,message:r,field:t,fieldValue:c}];this.validationErrorMap.set(o,u)}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){const r=this.getColumnByColIndex(t),s=this.getRowForRowIndex(e);return!r||!s?void 0:new _r(this.ctx,e,t,0,0,0,0,r,s.item,"body")}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 o=e[0];o<=e[1];o++){const n=this.getVirtualBodyCell(s,o);if(n&&(n.rowspan!==1||n.colspan!==1)){r=!0;break}}return r}}class pC{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(o=>({rowKey:o.rowKey,key:o.key,value:o.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 xC{constructor(e){h(this,"eventTasks",new Map),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)),document.addEventListener("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(){this.eventTasks.forEach((e,t)=>{this.unbind(window,t,e)}),document.removeEventListener("selectionchange",this.selectionchange.bind(this)),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.containerElement.focus({preventScroll:!0}),this.ctx.emit("mousedown",e)}handleMousemove(e){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.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.set(t,r)}unbind(e,t,r){e.removeEventListener(t,r),this.eventTasks.delete(t)}}class mC{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 yC{constructor(e){h(this,"ctx");const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}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,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:u,colorEnd:d}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,r,s));let f;switch(a){case"left":f=this.ctx.createLinearGradient(e-c,t,e,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e-c,t,c,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+c,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,c,s);break;case"top":f=this.ctx.createLinearGradient(e,t-c,e,t),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-c,r,c);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+c),f.addColorStop(0,u),f.addColorStop(1,d),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,c);break;default:console.error("Invalid side specified for shadow");break}}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 o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=4,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,o){this.ctx.save(),this.ctx.drawImage(e,t,r,s,o),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),a!==void 0&&(this.ctx.fillStyle=a),n!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=n),c===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[u,d,f,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+u,t),this.ctx.arcTo(e+r,t,e+r,t+d,d),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+u,t,u)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,o,n={}){this.ctx.save();const{font:a="12px Arial",align:c="center",color:u="#495060",padding:d=0,verticalAlign:f="middle"}=n;this.ctx.font=a,this.ctx.fillStyle=u,this.ctx.textBaseline=f,this.ctx.textAlign=c;let g=0;f==="top"?g=r+d:f==="bottom"?g=r+o-d:g=r+(o+1)/2;let v=0;c==="left"?v=t+d:c==="right"?v=t+s-d:v=t+s/2;const{_text:p,ellipsis:x}=this.handleEllipsis(e,s,d,a);return this.ctx.fillText(p,v,g),this.ctx.restore(),x}handleEllipsis(e,t,r=0,s="12px Arial"){let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width,c=this.ctx.measureText(e).width;if(c&&c+a>=t-r*2){o=!0;let u=0;for(let d=0;d<e.length;d++)if(u+=this.ctx.measureText(e[d]).width,u>=t-r*2-a){n=e.slice(0,d)+"...";break}}return{_text:n,ellipsis:o}}}class ho{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,"WIDTH",0),h(this,"RESIZE_MIN_WIDTH",40),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"EMPTY_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,"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,"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,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_INDETERMINATE_SVG",""),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,"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_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,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),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,"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=gC(r);e[t]=s}}),Object.assign(this,e,this._config)}}const uo='<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>';class wC{constructor(e){h(this,"ctx"),h(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:'<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>',color:"#4E5969"},{name:"shrink",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"SHRINK_ICON_COLOR",svg:uo,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",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" fill="#DDE0EA" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:'<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>',color:"rgb(82,146,247)"},{name:"checkbox-hover",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_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" fill="#DDE0EA" p-id="4709"></path></svg>',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_SVG",svg:'<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>',color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",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" fill="#F1F2F4" 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:""},{name:"icon-edit",configName:"CHECKBOX_DISABLED_SVG",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:"CHECKBOX_UNCHECK_SVG",configColorName:"SHRINK_ICON_COLOR",svg:uo,color:"#4E5969"}]),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,o=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&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(r.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const o=this.createImageFromSVG(r.svg,s,r.isBlob).then(n=>{this.icons.set(r.name,n)});e.push(o)}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=>{a.setAttribute("fill",t)});const o=new Image;let n="";if(r){const a=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});n=URL.createObjectURL(a)}else n="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=n,new Promise((a,c)=>{o.onerror=()=>c(new Error("Failed to load image")),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}}class Ta extends Oa{constructor(e,t,r,s,o,n,a){super(e,r,s,o,n,"header",a.fixed),h(this,"align"),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,"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,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawImageX",0),h(this,"drawImageY",0),h(this,"drawImageWidth",0),h(this,"drawImageHeight",0),h(this,"drawImageName",""),h(this,"drawImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=n,this.visibleWidth=o,this.visibleHeight=n,this.colIndex=t,this.key=a.key,this.minWidth=a.minWidth,this.maxWidth=a.maxWidth,this.type=a.type||"",this.editorType=a.editorType||"text",this.align=a.align||"center",this.verticalAlign=a.verticalAlign||"middle",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.rowKey=ba(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader}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,o=r;if(typeof e=="function"){const n=e,{backgroundColor:a,color:c}=n({colIndex:this.colIndex,column:this.column})||{};a&&(s=a),c&&(o=c)}this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.updateStyle()}draw(){const{paint:e,config:{BORDER_COLOR:t,CELL_PADDING:r,HEADER_FONT:s,BORDER:o}}=this.ctx,{drawX:n,drawY:a,displayText:c}=this;e.drawRect(n,a,this.width,this.height,{borderColor:o?t:"transparent",fillColor:this.drawCellBgColor}),this.ellipsis=e.drawText(c,n,a,this.width,this.height,{font:s,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign}),this.drawSelection(),this.drawSelector()}drawSelector(){const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t}=this.ctx.selector,[r,s]=t;this.colIndex>=r&&this.colIndex<=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(){const{width:e,height:t,type:r}=this;if(["index-selection","selection"].includes(r)){const{indeterminate:s,check:o,selectable:n}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:a=0}=this.ctx.config,c=this.drawX+(e-a)/2,u=this.drawY+(t-a)/2;let d=this.ctx.icons.get("checkbox-uncheck"),f="checkbox-uncheck";s?(d=this.ctx.icons.get("checkbox-indeterminate"),f="checkbox-indeterminate"):o&&n?(d=this.ctx.icons.get("checkbox-check"),f="checkbox-check"):o&&n?(d=this.ctx.icons.get("checkbox-check-disabled"),f="checkbox-check-disabled"):!o&&n?(d=this.ctx.icons.get("checkbox-uncheck"),f="checkbox-uncheck"):(d=this.ctx.icons.get("checkbox-disabled"),f="checkbox-disabled"),d&&(this.drawImageX=c,this.drawImageY=u,this.drawImageWidth=a,this.drawImageHeight=a,this.drawImageName=f,this.drawImageSource=d,this.ctx.paint.drawImage(this.drawImageSource,this.drawImageX,this.drawImageY,this.drawImageWidth,this.drawImageHeight))}}getText(){return this.render?"":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 EC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(()=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver")}),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(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMousedown",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMousedown",n,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)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s),this.treeClick(s),this.hoverIconClick(s)})}),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,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.emit("cellHeaderContextMenuClick",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.emit("cellContextMenuClick",n,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.selectionEnterAndLeave(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 o;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&&(((o=this.ctx.hoverCell)==null?void 0:o.rowKey)!==s.rowKey&&(this.ctx.hoverCell=s,this.ctx.hoverRow=this.ctx.body.renderRows.find(n=>n.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("drawView")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e){if(["selection","index-selection"].includes(e.type)&&this.ctx.isPointer)if(e instanceof Ta)e.drawImageName==="checkbox-uncheck"||e.drawImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey)}}treeClick(e){if(e.type==="tree"&&this.ctx.isPointer){const t=this.ctx.database.getRowForRowKey(e.rowKey),{expand:r=!1,expandLazy:s=!1}=t||{},{EXPAND_LAZY:o,EXPAND_LAZY_METHOD:n}=this.ctx.config;if(o&&n&&!r&&!s)typeof n=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),n({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(a=>{this.ctx.database.setExpandChildren(e.rowKey,a),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(a=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(a)}));else{const a=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!a),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s;n>e.drawImageX&&n<e.drawImageX+e.drawImageWidth&&o>e.drawImageY&&o<e.drawImageY+e.drawImageHeight&&(this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0)}selectionEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s;n>e.drawImageX&&n<e.drawImageX+e.drawImageWidth&&o>e.drawImageY&&o<e.drawImageY+e.drawImageHeight&&e instanceof _r&&["selection","index-selection"].includes(e.type)&&(this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed"))}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;if(!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:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,r,s,o=!1){if(this.isInsideBody(t))for(const n of r){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const u=c.getDrawX(),d=c.getDrawY();if(o){if(e>u&&e<u+c.visibleWidth&&t>d&&t<d+c.visibleHeight){s(c);return}}else if(e>u&&e<u+c.width&&t>d&&t<d+c.height){s(c);return}}}}handleHeaderEvent(e,t,r,s){for(const o of r){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);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 CC{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,"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,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"adjustPositioning",!1),h(this,"editing",!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,"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:[],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,"database"),h(this,"history"),h(this,"config");const{containerElement:r,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.contextMenuElement=u,this.config=new ho(t.config||{}),this.eventBus=new mC,this.eventBrowser=new xC(this),this.eventTable=new EC(this),this.paint=new yC(this.canvasElement),this.database=new vC(this,t),this.history=new pC(this),this.icons=new wC(this)}setConfig(e){this.config=new ho(e)}setItemValueByEditor(e,t,r,s=!0,o=!0,n=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const a=this.database.getVirtualBodyCellByKey(e,t);if(a&&(a.mergeRow||a.mergeCol)){const{dataList:c}=a.getSpanInfo(),u=c.map(d=>({...d,value:r}));this.database.batchSetItemValue(u,s,n);return}}this.database.setItemValue(e,t,r,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const n=this.database.getRowIndexForRowKey(o.rowKey),a=this.database.getColIndexForKey(o.key);if(n===void 0||a===void 0)return;const c=this.database.getVirtualBodyCell(n,a);if(c){const{dataList:u}=c.getSpanInfo(),d=u.map(f=>({...f,value:o.value}));s.push(...d)}}),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 o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=r[1]-r[0];a++){const c=o+t[0],u=a+r[0],d=this.database.getVirtualBodyCell(c,u);d&&(d.selectorCellValueType==="displayText"?n.push(d.displayText):n.push(d.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}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 o=Math.floor(t),n=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(n=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>n&&(o=n),this.emit("setScroll",r,o)}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)}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 fo{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,o=r-this.clientX;let n=0;this.type==="vertical"?(n=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(n===0&&s>0||n===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(n=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=n}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:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let n=0;this.type==="vertical"?n=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:n=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(n,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:o,buttons:n}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,n===0||s==this.clientX&&o==this.clientY)return;let a=0;if(this.type==="horizontal"?a=s-this.clientX:a=o-this.clientY,this.isDragging&&a!==0){let c=0;this.type==="vertical"?c=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,r,s,o,n){return e>=r&&e<=r+o&&t>=s&&t<=s+n}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:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,u=r,d=t.height,f=t.width,g=e.height,v=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=u-o-d,this.distance=g-this.visibleDistance+v,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,d,this.trackX+o,d],this.trackWidth=o,this.trackHeight=u,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const p=this.distance?this.visibleDistance/(g+v):0;let x=Math.floor(p*this.visibleDistance);x<30?x=30:x>this.visibleDistance&&(x=0),this.barHeight=x,this.barY=d+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=f-this.visibleDistance,this.splitPoints=[c-o,u-o,c-o,u];const p=a?0:.5;this.trackX=0,this.trackY=u-o+p,this.trackWidth=c,this.trackHeight=o;const x=this.distance?this.visibleDistance/f:0;let m=Math.floor(x*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,m<30?m=30:m>=this.visibleDistance&&(m=0),this.barWidth=m,this.barHeight=n,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:o}}=this.ctx;this.updatedSize();let n=r;s||(n="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:n,fillColor:o}),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:n,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class bC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),this.ctx=e,this.verticalScrollbar=new fo(e,"vertical"),this.horizontalScrollbar=new fo(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)})}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.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&&r.x>t.visibleWidth/2&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=r.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}}class _C{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,"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,"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",_a(()=>{this.init(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn()}init(){const{config:{HEADER_HEIGHT:e,SCROLLER_TRACK_SIZE:t}}=this.ctx,r=this.ctx.database.getColumns();this.columns=r,this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[];const s=Ra(r),o=di(r);this.height=e*s,this.width=o.reduce((f,g)=>{const v=g.width||100,{maxWidth:p,minWidth:x}=g;return p&&v>p?f+p:x&&v<x?f+x:f+v},0),this.visibleHeight=this.height;const n=lC(Ia(r,s));this.columnIndex=0,this.resizeNum=0,this.render(n,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.floor(this.width+t),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-t;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const f=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(f)}const u=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=u.reduce((f,g)=>f+g.width,0);const d=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=d.reduce((f,g)=>f+g.width,t),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.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){const{config:{ENABLE_RESIZE_COLUMN:e}}=this.ctx;e&&(this.ctx.on("mousedown",t=>{this.ctx.isTarget(t)&&(this.clientX=t.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{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",t=>{if(this.ctx.editing)return;const{stageWidth:r,config:{RESIZE_COLUMN_MIN_WIDTH:s}}=this.ctx;if(this.isResizing&&this.resizeTarget){const o=this.resizeTarget.width,n=this.resizeTarget.minWidth,a=this.resizeTarget.maxWidth;let c=t.clientX-this.clientX;c+o<s&&(c=-(o-s)),n&&c+o<n&&(c=-(o-n)),a&&c+o>a&&(c=a-o),this.resizeDiff=c,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(t.offsetX<0||t.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 o=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const n of o){const{offsetX:a,offsetY:c}=this.ctx.getOffset(t),u=a,d=n.getDrawX();u>d+n.width-5&&u<d+n.width+4&&u<r-4&&n.colspan<=1&&this.ctx.isTarget(t)&&c<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=n)}}}))}resizeColumn(e,t){const r=o=>{o.forEach(n=>{if(n.children&&n.children.length>0&&r(n.children),n.key===e.key){const a=n.width||100;n.width=a+t}})};r(this.columns),this.ctx.database.setColumns(this.columns),this.init(),this.ctx.emit("draw");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),this.ctx.emit("draw")}this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:e.width+t+s,column:e.column,columns:this.columns})}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const n=o.width+e*o.colspan;t.set(o.key,n),n<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=o=>{o.forEach(n=>{t.has(n.key)&&(n.width=t.get(n.key)),n.children&&n.children.length>0&&s(n.children)})};s(this.columns),this.ctx.database.setColumns(this.columns),this.init()}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<r;n++){const a=e[n],c=o*(a.rowspan||0),u=o*(a.level||0);let{minWidth:d,maxWidth:f}=a,g=a.width||100;d&&g<d&&(g=d),f&&g>f&&(g=f),a.children&&(g=di(a.children).reduce((p,x)=>p+((x==null?void 0:x.width)||100),0));const v=new Ta(this.ctx,this.columnIndex,s,u,g,c,a);this.ctx.database.setHeader(a.key,v),this.allCellHeaders.push(v),a.children||(this.leafCellHeaders.push(v),v.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(v):a.fixed==="right"?this.fixedRightCellHeaders.push(v):this.centerCellHeaders.push(v),!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}}=this.ctx,r=this.resizeTarget.getDrawX(),s=this.resizeTarget.width,o=r+s+this.resizeDiff-.5,n=[o-.5,0,o-.5,e];this.ctx.paint.drawLine(n,{borderColor:t,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,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,o)=>s.x-o.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.drawTipLine(),this.drawBottomLine()}}class ka{constructor(e,t,r=0,s=0,o=0,n=0,a,c="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,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[];e.renderLeafCellHeaders.forEach(o=>{const n=new _r(this.ctx,this.rowIndex,o.colIndex,o.x,this.y,o.width,this.height,o.column,this.data,this.rowType);n.fixed?r.push(n):s.push(n),t.push(n)}),this.cells=t,this.fixedCells=r,this.noFixedCells=s}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 RC{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:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:u=0,ENABLE_OFFSET_HEIGHT:d=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+r.height:this.y=t.height;const{data:v,sumHeight:p}=s.getData();this.height=p,this.data=v,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const x=this.ctx.footer.height;!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-x-n);let m=this.height+t.height+n;m+=x;let C=m;const _=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(_>w&&d&&!a){const y=_-w-f;y>t.height+n?C=y:m>u&&(C=u)}else this.data.length&&a?C=a:this.data.length&&u&&m>u&&(C=u);C>0&&(this.ctx.stageHeight=Math.floor(C),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=b-x: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=v;const E=window.devicePixelRatio||1,I=this.ctx.stageWidth*E,T=this.ctx.stageHeight*E;e.width=Math.round(I),e.height=Math.round(T);const k=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:k,type:k,headerHeight:t.height,bodyHeight:this.height,footerHeight:x,width:this.width,height:this.data.length?0:c+x});const O=Math.round(e.width/E*1e4)/1e4,S=Math.round(e.height/E*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${S}px;width:${O}px;`),this.ctx.paint.scale(E)}initResizeRow(){const{config:{ENABLE_RESIZE_ROW:e}}=this.ctx;e&&(this.ctx.on("resize",()=>{this.containerRect=this.ctx.containerElement.getBoundingClientRect()}),this.ctx.on("resizeObserver",()=>{this.containerRect=this.ctx.containerElement.getBoundingClientRect()}),this.ctx.on("mouseup",()=>{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",t=>{this.ctx.isTarget(t)&&(this.clientY=t.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",t=>{if(this.ctx.editing)return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,n=s,a=t.clientY,{stageHeight:c,scrollY:u,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let g=a-this.clientY;g+f<d&&(g=-(f-d)),this.resizeDiff=g,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(n<0||n>this.ctx.body.visibleWidth||o<0||o>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 f=0;f<this.renderRows.length;f++){const g=this.renderRows[f];if(o>g.y-u+g.height-1.5&&o<g.y-u+g.height+1.5&&o<c-4)for(let v=0;v<g.cells.length;v++){const p=g.cells[v];n>p.drawX+10&&n<p.drawX+p.width-10&&p.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=g)}}}}))}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:o,data:n}=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:o,row:n,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,o=this.resizeTarget.height,n=s+o+this.resizeDiff-.5,a=[0,n-.5,e,n-.5];this.ctx.paint.drawLine(a,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:n,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,o=-1;for(;r<=s;){let n=Math.floor((r+s)/2),a=e[n].bottom;if(a===t)return n;a<t?r=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,o=r,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),u=this.binarySearch(a,o+this.visibleHeight);if(u===-1&&(u=this.ctx.maxRowIndex),c===-1&&u===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,u+1),this.visibleRows=n.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 d=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,v=this.visibleRows[f],{height:p,top:x}=this.ctx.database.getPositionForRowIndex(g),m=new ka(this.ctx,g,0,x+this.y,e.width,p,v);d.push(m)}this.renderRows=d,this.ctx.body.renderRows=d}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 IC{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:o,FOOTER_POSITION:n}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(a=>a+r,0),this.visibleHeight=this.height,s?n==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o: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:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==a){const u=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(u,c,t,this.height,{fillColor:n,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,o)=>{const n=new ka(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,r.push(n)}),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 SC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"mousedownHeader",!1),h(this,"ctx"),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",_a(e=>{const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=this.ctx.isTarget(e)&&r>0&&r<this.ctx.body.visibleWidth&&t>this.ctx.header.visibleHeight&&t<this.ctx.header.visibleHeight+this.ctx.body.visibleHeight;(this.ctx.selectorMove||this.ctx.autofillMove)&&(!s&&!this.mousedownHeader?this.startAdjustPosition(e):this.stopAdjustPosition())},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("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.mousedownHeader=!1;const e=setTimeout(()=>{this.ctx.adjustPositioning=!1,clearTimeout(e)},0)}),this.ctx.on("cellHeaderHoverChange",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.mousedownHeader=!0,this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing){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.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.stopAdjustPosition()})}setSelector(e,t){const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!r){const[a]=o;o=[a,a]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(n)){this.ctx.mousedown&&(this.ctx.selectorMove=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:u,SELECTOR_AREA_MAX_Y:d,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,v=a,p=c||this.ctx.maxColIndex-f,x=u,m=d||this.ctx.maxRowIndex-g;let[C,_]=o,[w,b]=n;if(C<v||_>p||w<x||b>m)return;if(this.ctx.stageElement.focus({preventScroll:!0}),this.ctx.config.ENABLE_MERGE_CELL_LINK){const I=this.adjustMergeCells(o,n);w=I.yArr[0],b=I.yArr[1],C=I.xArr[0],_=I.xArr[1],this.ctx.onlyMergeCell=I.onlyMergeCell}C===_&&w===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(v,C),Math.min(p,_)],n=[Math.max(x,w),Math.min(m,b)];const{BEFORE_SET_SELECTOR_METHOD:E}=this.ctx.config;if(typeof E=="function"){const I=E({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!I)return;o=I.xArr,n=I.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,o]=t,[n,a]=e;let c=[],u=[];for(let x=0;x<=t[1]-t[0];x++)for(let m=0;m<=e[1]-e[0];m++){const C=x+t[0],_=m+e[0],w=this.ctx.database.getVirtualBodyCell(C,_);w&&((C===s||C===o)&&c.push(w),(_===n||_===a)&&u.push(w))}const d=c.reduce((x,m)=>{const{yArr:C}=m.getSpanInfo(),[_,w]=C;return x.minY=Math.min(x.minY,_),x.maxY=Math.max(x.maxY,w),x},{minY:s,maxY:o}),f=u.reduce((x,m)=>{const{xArr:C}=m.getSpanInfo(),[_,w]=C;return x.minX=Math.min(x.minX,_),x.maxX=Math.max(x.maxX,w),x},{minX:n,maxX:a}),g=[f.minX,f.maxX],v=[d.minY,d.maxY];let p=!1;if(f.minX!==f.maxX||d.minY!==d.maxY){const x=JSON.stringify(g)+JSON.stringify(v),m=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();p=(m&&JSON.stringify(m.xArr)+JSON.stringify(m.yArr))===x}return{xArr:g,yArr:v,onlyMergeCell:p}}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;if(e.operation){this.selectAll();return}const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=r||this.ctx.maxRowIndex-s;if(this.ctx.mousedown&&this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],u=[o,n];this.setSelector(c,u)}else{const c=[e.colIndex,a],u=[o,n];this.setSelector(c,u)}}else{const a=[e.colIndex,e.colIndex+e.colspan-1],c=[o,n];this.setSelector(a,c)}}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:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,u=r,d=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-c,v=[u,d],p=[f,g];this.setSelector(v,p)}}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:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=r;if(t){this.ctx.setFocusCell(e);const c=[a,n],u=[e.rowIndex,e.rowIndex];this.setSelector(c,u)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const u=[a,n],d=[c,e.rowIndex];this.setSelector(u,d)}else{const u=[a,n],d=[e.rowIndex,c];this.setSelector(u,d)}}}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:o}=t,n=Math.min(r.colIndex,o),a=Math.max(r.colIndex,o),c=Math.min(r.rowIndex,s),u=Math.max(r.rowIndex,s),d=[n,a],f=[c,u];this.setSelector(d,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:o}=r,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),u=Math.max(n,s),d=Math.min(a,o),f=Math.max(a,o),g=[c,u],v=[d,f];this.setSelector(g,v)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}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 n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],r=[n.rowIndex,n.rowIndex]}else{const n={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",n):alert(n.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const n=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!n)return;e=n.data}const o=uC(e);navigator.clipboard?navigator.clipboard.writeText(o).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(n=>console.error("Copy Failure:",n)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let u=0;u<=e[1]-e[0];u++){const d=c+t[0],f=u+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(d,f);if(g){const{rowKey:v,key:p}=g;this.ctx.database.getReadonly(v,p)||(n.add(v),o.push({rowKey:v,key:p,value:s,row:{}}))}}if(!o.length)return[];if(r)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(c=>{a.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,a),o}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 o=>{let n=hC(o);const a=[r,r+n[0].length-1],c=[t,t+n.length-1],[u,d]=c,[f,g]=a,v=d-this.ctx.maxRowIndex,p=g-this.ctx.maxColIndex;(v>0||p>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:d,maxX:g,minY:u,minX:f,overflowRowCount:v,overflowColCount:p,textArr:n});const x=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!x){const w={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",w):alert(w.message);return}let m=[];for(let w=0;w<=n.length-1;w++){const b=n[w].length;for(let E=0;E<=b-1;E++){const I=w+t,T=E+r,k=n[w][E],O=this.ctx.database.getItemValueForRowIndexAndColIndex(I,T);if(O){const{rowKey:S,key:y}=O;this.ctx.database.getReadonly(S,y)||(s.add(S),m.push({rowKey:S,key:y,value:k,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=m.map(E=>`${E.rowKey}-${E.key}`);w.forEach(E=>{b.includes(`${E.rowKey}-${E.key}`)||m.unshift(E)}),this.isCut=!1}if(!m.length)return;const{BEFORE_PASTE_DATA_METHOD:C}=this.ctx.config;if(typeof C=="function"){const w=C,b=m.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)}));if(m=await w(b,a,c,n),m&&!m.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(m,!0);let _=[];s.forEach(w=>{_.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",m,_)}).catch(o=>{console.error("Failed to get the clipboard content:",o)})}}moveFocus(e){if(this.ctx.editing)return;const{focusCell:t}=this.ctx;if(!t)return;let{colIndex:r=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":r>o&&r--;break;case"TOP":s>n&&s--;break;case"RIGHT":r<a&&r++;break;case"BOTTOM":s<c&&s++;break}const u=[r,r],d=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(u,d),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}stopAdjustPosition(){this.adjustPositionX="",this.adjustPositionY="",this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerY&&(clearInterval(this.timerY),this.timerY=0)}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:n,SELECTOR_AREA_MAX_X_OFFSET:a,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,u=r,d=s||this.ctx.maxColIndex-a,f=o,g=n||this.ctx.maxRowIndex-c;return!(t<u||t>d||e<f||e>g)}startAdjustPosition(e){const{offsetX:t,offsetY:r}=this.ctx.getOffset(e);let s="",o="";if(t<0?s="left":t>this.ctx.body.visibleWidth&&(s="right"),r<this.ctx.header.visibleHeight?o="top":r>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight&&(o="bottom"),s&&this.adjustPositionX!==s){this.adjustPositionX=s;let n=10*(s==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{n*=1.5;const{scrollX:a}=this.ctx,c=a+n;(c<0||c>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(c)},100)}if(o&&this.adjustPositionY!==o){this.adjustPositionY=o;let n=10*(o==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{n*=1.5;const{scrollY:a}=this.ctx,c=a+n;(c<0||c>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(c)},100)}}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:u,scrollY:d,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:v,ENABLE_MERGE_CELL_LINK:p}}=this.ctx;if(!r)return;p&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:x,drawY:m,width:C,height:_,fixed:w}=r,b=o-x+1,E=r.drawX+C-(t-s)+1;let I=n.height-m,T=_;T>c.visibleHeight&&(T=c.visibleHeight);let k=0;g&&(v==="top"?I=n.height+a.height-m:k=a.visibleHeight);const O=m+T-(e-k-f);let S=u,y=d;E>0&&!w?S=Math.floor(u+E):b>0&&!w&&(S=Math.floor(u-b)),I>0?y=Math.floor(d-I):O>0&&(y=Math.floor(d+O)),(Math.abs(u-S)>2||Math.abs(d-y)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.setScroll(S,y),this.ctx.emit("adjustBoundaryPosition",r))}destroy(){this.timerX&&(clearTimeout(this.timerX),this.timerX=0),this.timerY&&(clearTimeout(this.timerY),this.timerY=0)}}class $C{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:o,drawX:n,drawY:a,width:c,height:u}=this.maxColRowCell,d=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-d+f,v=a+u-d+f;t>g&&r>v&&t<g+d&&r<v+d&&(this.ctx.stageElement.style.cursor="crosshair")}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],o=r[1],{colIndex:n,rowIndex:a}=e;this.ctx.config.ENABLE_AUTOFILL&&n===s&&a===o&&(this.maxColRowCell=e),this.mouseenter(e)}),this.ctx.on("mousedown",()=>{this.ctx.stageElement.style.cursor==="crosshair"&&this.setMousedown()}),this.ctx.on("mouseup",()=>{this.setMouseUp()})}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}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])}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_SELECTOR_SPAN_COL:s,ENABLE_SELECTOR_SPAN_ROW:o}=this.ctx.config;if(!r)return;let n=e,a=t;if(!o){const[c]=a;a=[c,c]}if(!s){const[c]=n;n=[c,c]}if(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a)){const{SELECTOR_AREA_MIN_X:c,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:g,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=c,x=u||this.ctx.maxColIndex-g,m=d,C=f||this.ctx.maxRowIndex-v;let[_,w]=n,[b,E]=a;if(_<p||b<m)return;n=[Math.max(p,_),Math.min(x,w)],a=[Math.max(m,b),Math.min(C,E)];const{BEFORE_SET_AUTOFILL_METHOD:I}=this.ctx.config;if(typeof I=="function"){const T=I({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!T)return;n=T.xArr,a=T.yArr}this.ctx.autofill.xArr=n,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 v=0;v<=t.yArr[1]-t.yArr[0];v++)for(let p=0;p<=t.xArr[1]-t.xArr[0];p++){const x=v+t.yArr[0],m=p+t.xArr[0];r.set(`${x}-${m}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,u=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!u){const v={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",v):alert(v.message);return}let d=[];for(let v=0;v<=c[1]-c[0];v++)for(let p=0;p<=a[1]-a[0];p++){const x=p+a[0],m=v+c[0],C=s[v%n][p%o],_=this.ctx.database.getItemValueForRowIndexAndColIndex(m,x),w=`${m}-${x}`;if(_&&!r.has(w)){const{rowKey:b,key:E}=_;this.ctx.database.getReadonly(b,E)||(e.add(b),d.push({rowKey:b,key:E,value:C,row:{}}))}}if(!d.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 v=f,p=d.map(x=>({rowKey:x.rowKey,key:x.key,value:x.value,oldValue:this.ctx.database.getItemValue(x.rowKey,x.key),row:this.ctx.database.getRowDataItemForRowKey(x.rowKey)}));if(d=await v(p,a,c),d&&!d.length)return}this.ctx.batchSetItemValueByEditor(d,!0);let g=[];e.forEach(v=>{g.push(this.ctx.database.getRowDataItemForRowKey(v))}),this.ctx.emit("autofillChange",d,g)}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:o}=e,n=t.xArr.slice(),a=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?n.splice(1,1,o):o<t.xArr[0]&&n.splice(0,1,o):s>t.yArr[1]?a.splice(1,1,s):s<t.yArr[0]&&a.splice(0,1,s),this.setAutofill(n,a)}}destroy(){}}const Lt=Math.min,ht=Math.max,fi=Math.round,We=i=>({x:i,y:i}),OC={left:"right",right:"left",bottom:"top",top:"bottom"},TC={start:"end",end:"start"};function tr(i,e,t){return ht(i,Lt(e,t))}function Yt(i,e){return typeof i=="function"?i(e):i}function it(i){return i.split("-")[0]}function Wt(i){return i.split("-")[1]}function La(i){return i==="x"?"y":"x"}function Rr(i){return i==="y"?"height":"width"}function ft(i){return["top","bottom"].includes(it(i))?"y":"x"}function Ir(i){return La(ft(i))}function kC(i,e,t){t===void 0&&(t=!1);const r=Wt(i),s=Ir(i),o=Rr(s);let n=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=gi(n)),[n,gi(n)]}function LC(i){const e=gi(i);return[ir(i),e,ir(e)]}function ir(i){return i.replace(/start|end/g,e=>TC[e])}function DC(i,e,t){const r=["left","right"],s=["right","left"],o=["top","bottom"],n=["bottom","top"];switch(i){case"top":case"bottom":return t?e?s:r:e?r:s;case"left":case"right":return e?o:n;default:return[]}}function AC(i,e,t,r){const s=Wt(i);let o=DC(it(i),t==="start",r);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(ir)))),o}function gi(i){return i.replace(/left|right|bottom|top/g,e=>OC[e])}function MC(i){return{top:0,right:0,bottom:0,left:0,...i}}function Da(i){return typeof i!="number"?MC(i):{top:i,right:i,bottom:i,left:i}}function vi(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 go(i,e,t){let{reference:r,floating:s}=i;const o=ft(e),n=Ir(e),a=Rr(n),c=it(e),u=o==="y",d=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 v;switch(c){case"top":v={x:d,y:r.y-s.height};break;case"bottom":v={x:d,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:f};break;case"left":v={x:r.x-s.width,y:f};break;default:v={x:r.x,y:r.y}}switch(Wt(e)){case"start":v[n]-=g*(t&&u?-1:1);break;case"end":v[n]+=g*(t&&u?-1:1);break}return v}const BC=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let u=await n.getElementRects({reference:i,floating:e,strategy:s}),{x:d,y:f}=go(u,r,c),g=r,v={},p=0;for(let x=0;x<a.length;x++){const{name:m,fn:C}=a[x],{x:_,y:w,data:b,reset:E}=await C({x:d,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:v,rects:u,platform:n,elements:{reference:i,floating:e}});d=_??d,f=w??f,v={...v,[m]:{...v[m],...b}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(g=E.placement),E.rects&&(u=E.rects===!0?await n.getElementRects({reference:i,floating:e,strategy:s}):E.rects),{x:d,y:f}=go(u,g,c)),x=-1)}return{x:d,y:f,placement:g,strategy:s,middlewareData:v}};async function Aa(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:o,rects:n,elements:a,strategy:c}=i,{boundary:u="clippingAncestors",rootBoundary:d="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=Yt(e,i),p=Da(v),x=a[g?f==="floating"?"reference":"floating":f],m=vi(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(x)))==null||t?x:x.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:u,rootBoundary:d,strategy:c})),C=f==="floating"?{x:r,y:s,width:n.floating.width,height:n.floating.height}:n.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},b=vi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:C,offsetParent:_,strategy:c}):C);return{top:(m.top-b.top+p.top)/w.y,bottom:(b.bottom-m.bottom+p.bottom)/w.y,left:(m.left-b.left+p.left)/w.x,right:(b.right-m.right+p.right)/w.x}}const NC=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:u,padding:d=0}=Yt(i,e)||{};if(u==null)return{};const f=Da(d),g={x:t,y:r},v=Ir(s),p=Rr(v),x=await n.getDimensions(u),m=v==="y",C=m?"top":"left",_=m?"bottom":"right",w=m?"clientHeight":"clientWidth",b=o.reference[p]+o.reference[v]-g[v]-o.floating[p],E=g[v]-o.reference[v],I=await(n.getOffsetParent==null?void 0:n.getOffsetParent(u));let T=I?I[w]:0;(!T||!await(n.isElement==null?void 0:n.isElement(I)))&&(T=a.floating[w]||o.floating[p]);const k=b/2-E/2,O=T/2-x[p]/2-1,S=Lt(f[C],O),y=Lt(f[_],O),M=S,H=T-x[p]-y,F=T/2-x[p]/2+k,X=tr(M,F,H),P=!c.arrow&&Wt(s)!=null&&F!==X&&o.reference[p]/2-(F<M?S:y)-x[p]/2<0,Y=P?F<M?F-M:F-H:0;return{[v]:g[v]+Y,data:{[v]:X,centerOffset:F-X-Y,...P&&{alignmentOffset:Y}},reset:P}}}),FC=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:u}=e,{mainAxis:d=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:x=!0,...m}=Yt(i,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const C=it(s),_=ft(a),w=it(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(u.floating)),E=g||(w||!x?[gi(a)]:LC(a)),I=p!=="none";!g&&I&&E.push(...AC(a,x,p,b));const T=[a,...E],k=await Aa(e,m),O=[];let S=((r=o.flip)==null?void 0:r.overflows)||[];if(d&&O.push(k[C]),f){const F=kC(s,n,b);O.push(k[F[0]],k[F[1]])}if(S=[...S,{placement:s,overflows:O}],!O.every(F=>F<=0)){var y,M;const F=(((y=o.flip)==null?void 0:y.index)||0)+1,X=T[F];if(X)return{data:{index:F,overflows:S},reset:{placement:X}};let P=(M=S.filter(Y=>Y.overflows[0]<=0).sort((Y,W)=>Y.overflows[1]-W.overflows[1])[0])==null?void 0:M.placement;if(!P)switch(v){case"bestFit":{var H;const Y=(H=S.filter(W=>{if(I){const V=ft(W.placement);return V===_||V==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(V=>V>0).reduce((V,we)=>V+we,0)]).sort((W,V)=>W[1]-V[1])[0])==null?void 0:H[0];Y&&(P=Y);break}case"initialPlacement":P=a;break}if(s!==P)return{reset:{placement:P}}}return{}}}};async function KC(i,e){const{placement:t,platform:r,elements:s}=i,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),n=it(t),a=Wt(t),c=ft(t)==="y",u=["left","top"].includes(n)?-1:1,d=o&&c?-1:1,f=Yt(e,i);let{mainAxis:g,crossAxis:v,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return a&&typeof p=="number"&&(v=a==="end"?p*-1:p),c?{x:v*d,y:g*u}:{x:g*u,y:v*d}}const HC=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await KC(e,i);return n===((t=a.offset)==null?void 0:t.placement)&&(r=a.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},VC=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:m=>{let{x:C,y:_}=m;return{x:C,y:_}}},...c}=Yt(i,e),u={x:t,y:r},d=await Aa(e,c),f=ft(it(s)),g=La(f);let v=u[g],p=u[f];if(o){const m=g==="y"?"top":"left",C=g==="y"?"bottom":"right",_=v+d[m],w=v-d[C];v=tr(_,v,w)}if(n){const m=f==="y"?"top":"left",C=f==="y"?"bottom":"right",_=p+d[m],w=p-d[C];p=tr(_,p,w)}const x=a.fn({...e,[g]:v,[f]:p});return{...x,data:{x:x.x-t,y:x.y-r,enabled:{[g]:o,[f]:n}}}}}};function Ii(){return typeof window<"u"}function Et(i){return Ma(i)?(i.nodeName||"").toLowerCase():"#document"}function ne(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Be(i){var e;return(e=(Ma(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Ma(i){return Ii()?i instanceof Node||i instanceof ne(i).Node:!1}function pe(i){return Ii()?i instanceof Element||i instanceof ne(i).Element:!1}function _e(i){return Ii()?i instanceof HTMLElement||i instanceof ne(i).HTMLElement:!1}function vo(i){return!Ii()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof ne(i).ShadowRoot}function zt(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=xe(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!["inline","contents"].includes(s)}function PC(i){return["table","td","th"].includes(Et(i))}function Si(i){return[":popover-open",":modal"].some(e=>{try{return i.matches(e)}catch{return!1}})}function Sr(i){const e=$r(),t=pe(i)?xe(i):i;return t.transform!=="none"||t.perspective!=="none"||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||["transform","perspective","filter"].some(r=>(t.willChange||"").includes(r))||["paint","layout","strict","content"].some(r=>(t.contain||"").includes(r))}function YC(i){let e=ze(i);for(;_e(e)&&!gt(e);){if(Sr(e))return e;if(Si(e))return null;e=ze(e)}return null}function $r(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}function gt(i){return["html","body","#document"].includes(Et(i))}function xe(i){return ne(i).getComputedStyle(i)}function $i(i){return pe(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function ze(i){if(Et(i)==="html")return i;const e=i.assignedSlot||i.parentNode||vo(i)&&i.host||Be(i);return vo(e)?e.host:e}function Ba(i){const e=ze(i);return gt(e)?i.ownerDocument?i.ownerDocument.body:i.body:_e(e)&&zt(e)?e:Ba(e)}function Na(i,e,t){var r;e===void 0&&(e=[]);const s=Ba(i),o=s===((r=i.ownerDocument)==null?void 0:r.body),n=ne(s);return o?(rr(n),e.concat(n,n.visualViewport||[],zt(s)?s:[],[])):e.concat(s,Na(s,[]))}function rr(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Fa(i){const e=xe(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=_e(i),o=s?i.offsetWidth:t,n=s?i.offsetHeight:r,a=fi(t)!==o||fi(r)!==n;return a&&(t=o,r=n),{width:t,height:r,$:a}}function Ka(i){return pe(i)?i:i.contextElement}function ut(i){const e=Ka(i);if(!_e(e))return We(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:o}=Fa(e);let n=(o?fi(t.width):t.width)/r,a=(o?fi(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const WC=We(0);function Ha(i){const e=ne(i);return!$r()||!e.visualViewport?WC:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function zC(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==ne(i)?!1:e}function Dt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),o=Ka(i);let n=We(1);e&&(r?pe(r)&&(n=ut(r)):n=ut(i));const a=zC(o,t,r)?Ha(o):We(0);let c=(s.left+a.x)/n.x,u=(s.top+a.y)/n.y,d=s.width/n.x,f=s.height/n.y;if(o){const g=ne(o),v=r&&pe(r)?ne(r):r;let p=g,x=rr(p);for(;x&&r&&v!==p;){const m=ut(x),C=x.getBoundingClientRect(),_=xe(x),w=C.left+(x.clientLeft+parseFloat(_.paddingLeft))*m.x,b=C.top+(x.clientTop+parseFloat(_.paddingTop))*m.y;c*=m.x,u*=m.y,d*=m.x,f*=m.y,c+=w,u+=b,p=ne(x),x=rr(p)}}return vi({width:d,height:f,x:c,y:u})}function XC(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const o=s==="fixed",n=Be(r),a=e?Si(e.floating):!1;if(r===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},u=We(1);const d=We(0),f=_e(r);if((f||!f&&!o)&&((Et(r)!=="body"||zt(n))&&(c=$i(r)),_e(r))){const g=Dt(r);u=ut(r),d.x=g.x+r.clientLeft,d.y=g.y+r.clientTop}return{width:t.width*u.x,height:t.height*u.y,x:t.x*u.x-c.scrollLeft*u.x+d.x,y:t.y*u.y-c.scrollTop*u.y+d.y}}function GC(i){return Array.from(i.getClientRects())}function sr(i,e){const t=$i(i).scrollLeft;return e?e.left+t:Dt(Be(i)).left+t}function UC(i){const e=Be(i),t=$i(i),r=i.ownerDocument.body,s=ht(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ht(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let n=-t.scrollLeft+sr(i);const a=-t.scrollTop;return xe(r).direction==="rtl"&&(n+=ht(e.clientWidth,r.clientWidth)-s),{width:s,height:o,x:n,y:a}}function qC(i,e){const t=ne(i),r=Be(i),s=t.visualViewport;let o=r.clientWidth,n=r.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const u=$r();(!u||u&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}function ZC(i,e){const t=Dt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,o=_e(i)?ut(i):We(1),n=i.clientWidth*o.x,a=i.clientHeight*o.y,c=s*o.x,u=r*o.y;return{width:n,height:a,x:c,y:u}}function po(i,e,t){let r;if(e==="viewport")r=qC(i,t);else if(e==="document")r=UC(Be(i));else if(pe(e))r=ZC(e,t);else{const s=Ha(i);r={...e,x:e.x-s.x,y:e.y-s.y}}return vi(r)}function Va(i,e){const t=ze(i);return t===e||!pe(t)||gt(t)?!1:xe(t).position==="fixed"||Va(t,e)}function JC(i,e){const t=e.get(i);if(t)return t;let r=Na(i,[]).filter(a=>pe(a)&&Et(a)!=="body"),s=null;const o=xe(i).position==="fixed";let n=o?ze(i):i;for(;pe(n)&&!gt(n);){const a=xe(n),c=Sr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&["absolute","fixed"].includes(s.position)||zt(n)&&!c&&Va(i,n))?r=r.filter(u=>u!==n):s=a,n=ze(n)}return e.set(i,r),r}function QC(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const o=[...t==="clippingAncestors"?Si(e)?[]:JC(e,this._c):[].concat(t),r],n=o[0],a=o.reduce((c,u)=>{const d=po(e,u,s);return c.top=ht(d.top,c.top),c.right=Lt(d.right,c.right),c.bottom=Lt(d.bottom,c.bottom),c.left=ht(d.left,c.left),c},po(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function jC(i){const{width:e,height:t}=Fa(i);return{width:e,height:t}}function e4(i,e,t){const r=_e(e),s=Be(e),o=t==="fixed",n=Dt(i,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=We(0);if(r||!r&&!o)if((Et(e)!=="body"||zt(s))&&(a=$i(e)),r){const v=Dt(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&(c.x=sr(s));let u=0,d=0;if(s&&!r&&!o){const v=s.getBoundingClientRect();d=v.top+a.scrollTop,u=v.left+a.scrollLeft-sr(s,v)}const f=n.left+a.scrollLeft-c.x-u,g=n.top+a.scrollTop-c.y-d;return{x:f,y:g,width:n.width,height:n.height}}function qi(i){return xe(i).position==="static"}function xo(i,e){if(!_e(i)||xe(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Be(i)===t&&(t=t.ownerDocument.body),t}function Pa(i,e){const t=ne(i);if(Si(i))return t;if(!_e(i)){let s=ze(i);for(;s&&!gt(s);){if(pe(s)&&!qi(s))return s;s=ze(s)}return t}let r=xo(i,e);for(;r&&PC(r)&&qi(r);)r=xo(r,e);return r&&gt(r)&&qi(r)&&!Sr(r)?t:r||YC(i)||t}const t4=async function(i){const e=this.getOffsetParent||Pa,t=this.getDimensions,r=await t(i.floating);return{reference:e4(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function i4(i){return xe(i).direction==="rtl"}const r4={convertOffsetParentRelativeRectToViewportRelativeRect:XC,getDocumentElement:Be,getClippingRect:QC,getOffsetParent:Pa,getElementRects:t4,getClientRects:GC,getDimensions:jC,getScale:ut,isElement:pe,isRTL:i4},Ya=HC,Wa=VC,za=FC,s4=NC,Xa=(i,e,t)=>{const r=new Map,s={platform:r4,...t},o={...s.platform,_c:r};return BC(i,e,{...s,platform:o})};let o4=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: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`;const n={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:n.background,backgroundColor:n.backgroundColor,transform:"rotate(45deg)",zIndex:n.zIndex};Object.assign(this.arrowEl.style,a),Object.assign(this.floatingEl.style,n),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)})}show(i){if(!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=i.getText();i.message&&(e=i.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)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=e;const r=i.drawX+t.x,s=i.drawY+t.y;Xa({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:r,y:s,left:r,right:r+i.visibleWidth,top:s,bottom:s+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Wa(),za(),Ya(6),s4({element:this.arrowEl})]}).then(o=>{const{x:n,y:a,placement:c,middlewareData:u}=o;if(Object.assign(this.floatingEl.style,{top:`${a}px`,left:`${n}px`}),u.arrow){const d=u.arrow;["left","left-start","left-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${d.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${d.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(c)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${d.x}px`,right:""}):["top","top-start","top-end"].includes(c)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${d.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 n4{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;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),this.ctx.on("hoverIconClick",e=>{e.editorType!=="none"&&this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:a}=this.ctx;a&&(this.ctx.emit("setSelectorCell",a),this.cellTarget=a),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),u=this.inputEl.value.substring(a);this.inputEl.value=c+`
4
+ `+u,this.inputEl.selectionStart=this.inputEl.selectionEnd=a+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.code==="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.code==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,r=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;r||s||o||n||["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(t)||this.startEdit(!0)}),this.ctx.on("adjustBoundaryPosition",e=>{this.cellTarget=e;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("cellClick",e=>{if(this.ctx.adjustPositioning||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(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.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,[o,n]=r,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.setAttribute("rows","1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.inputEl.addEventListener("blur",()=>{this.doneEdit()}),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(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:r,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:n}}=this.ctx,a=r-s.height-n;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>a&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${r-a}px`),this.inputEl.style.height=`${e}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:c}=e;this.drawX=c,this.drawY=a;const{config:{CELL_PADDING:u},header:d}=this.ctx;let f=this.ctx.body.visibleHeight;if(o>f&&(o=f),this.editorEl.style.display="inline-block",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${f}px`,s==="text"){this.inputEl.style.display="block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${u}px`,r!==null&&(this.inputEl.value=r),this.inputEl.focus({preventScroll:!0});const g=this.inputEl.value.length;this.inputEl.setSelectionRange(g,g)}else this.inputEl.style.display="none";(this.inputEl.scrollHeight>o||this.drawY<d.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),this.inputEl.value=""}}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||(this.ctx.emit("drawView"),!(r.isVerticalVisible()&&r.isHorizontalVisible())))return;const{rowKey:s,key:o,editorType:n}=r;if(n==="none")return;const a=this.ctx.database.getReadonly(s,o);r&&!a&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget))}editCell(e,t){const r=this.ctx.body.renderRows.find(u=>u.rowIndex===e);if(!r)return;const s=r.cells.find(u=>u.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:n,key:a}=o,c=this.ctx.database.getReadonly(n,a);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.ctx.containerElement.focus({preventScroll:!0}),this.editorEl.style.display="none",this.ctx.emit("drawView"))}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("drawView")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}class a4{constructor(e){h(this,"ctx"),h(this,"emptyEl"),this.ctx=e;const{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:s,headerHeight:o,bodyHeight:n,footerHeight:a})=>{const c=o+(n+a)/2,u={display:s==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${c}px`,transform:"translate(-50%, -50%)",...r};Object.assign(this.emptyEl.style,u)})}destroy(){this.emptyEl.remove()}}class l4{constructor(e){h(this,"ctx"),this.ctx=e}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="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:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],u=[],d=[];a.forEach(x=>{x.render&&(x.fixed==="left"?u.push(x):x.fixed==="right"?d.push(x):c.push(x))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:u},v={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-f+1}px`,height:`${n}px`},cells:c},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${n}px`},cells:d};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,v,p]}}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(x=>{x.cells.forEach(m=>{m.cellType==="footer"&&(m.render=m.renderFooter),m.render&&(m.fixed==="left"?t.push(m):m.fixed==="right"?r.push(m):e.push(m))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:u,visibleHeight:d}=this.ctx.body,f=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${d}px`},cells:t},v={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${u-o-f}px`,height:`${d}px`},cells:e},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:r};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${u}px`,height:`${d}px`},views:[g,v,p]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(p=>{p.cells.forEach(x=>{x.cellType==="footer"&&x.renderFooter&&(x.render=x.renderFooter,x.fixed==="left"?t.push(x):x.fixed==="right"?r.push(x):e.push(x))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:u}=this.ctx.footer,d=o-n,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${u}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-d}px`,height:`${u}px`},cells:e},v={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${d}px`,height:`${u}px`},cells:r};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${u}px`},views:[f,g,v]}}}class c4{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"custom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.custom=!0,this.contextMenuEl=this.ctx.contextMenuElement):(this.custom=!1,this.contextMenuEl=document.createElement("div")),this.createContextMenu(),this.init()}init(){this.ctx.on("cellContextMenuClick",(e,t)=>{if(!this.ctx.config.ENABLE_CONTEXT_MENU)return;t.preventDefault();const{xArr:r,yArr:s}=this.ctx.selector,[o,n]=r,[a,c]=s,{rowIndex:u,colIndex:d}=e;u>=a&&u<=c&&d>=o&&d<=n||this.ctx.emit("setSelectorCell",e,t);const f={getBoundingClientRect:()=>({width:0,height:0,top:t.clientY,left:t.clientX,right:t.clientX,bottom:t.clientY,x:t.clientX,y:t.clientY}),contextElement:document.body};Xa(f,this.contextMenuEl,{placement:"right-start",middleware:[Ya(),Wa(),za()]}).then(({x:g,y:v})=>{this.show(g,v)})}),this.ctx.on("click",this.hide.bind(this)),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}createContextMenu(){if(this.contextMenuEl.className="e-virt-table-context-menu",this.contextMenuEl.addEventListener("contextmenu",function(t){t.preventDefault()}),this.ctx.containerElement.appendChild(this.contextMenuEl),this.custom)return;const{CONTEXT_MENU:e}=this.ctx.config;this.createContextMenuItems(e,t=>{switch(t.value){case"copy":this.ctx.emit("contextMenuCopy");break;case"paste":this.ctx.emit("contextMenuPaste");break;case"cut":this.ctx.emit("contextMenuCut");break;case"clearSelected":this.ctx.emit("contextMenuClearSelected");break}this.hide()})}createContextMenuItems(e,t){this.contextMenuEl.replaceChildren(),e.forEach(r=>{const s=document.createElement("div");s.className="e-virt-table-context-menu-item",s.innerText=r.label,r.event?s.onclick=()=>{r.event&&r.event(),t(r)}:s.onclick=()=>t(r),this.contextMenuEl.appendChild(s)})}show(e,t){Object.assign(this.contextMenuEl.style,{left:`${e}px`,top:`${t}px`})}hide(){Object.assign(this.contextMenuEl.style,{left:"-99999px",top:"-99999px"})}updated(){this.createContextMenu()}destroy(){this.contextMenuEl.remove()}}class h4{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,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:o,contextMenuElement:n}=t,a=this.createContainer(e,r,s,o,n);this.ctx=new CC(a,this.options),this.header=new _C(this.ctx),this.footer=new IC(this.ctx),this.body=new RC(this.ctx),this.scroller=new bC(this.ctx),this.selector=new SC(this.ctx),this.autofill=new $C(this.ctx),this.tooltip=new o4(this.ctx),this.empty=new a4(this.ctx),this.editor=new n4(this.ctx),this.overlayer=new l4(this.ctx),this.contextMenu=new c4(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,r,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),c=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",c.className="e-virt-table-overlayer";const u=r||document.createElement("div");u.className="e-virt-table-editor";const d=s,f=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:u,emptyElement:d,contextMenuElement:f}}draw(e=!1){requestAnimationFrame(()=>{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()})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.contextMenu.updated(),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")}setLoading(e){this.ctx.database.setLoading(e)}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,o=!0,n=!1){this.ctx.database.setItemValue(e,t,r,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,r,s,o),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 o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],u=await this.ctx.database.getValidator(a,c);Array.isArray(u)&&u.length&&o.push(u)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:u}=a;this.scrollToRowkey(c),this.scrollToColkey(u)}}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[o]=s;if(Array.isArray(o)&&o.length){const[n]=o,{rowKey:a,key:c}=n,u=this.ctx.database.getRowForRowKey(a);if(u){const{parentRowKeys:d=[]}=u;d&&d.length&&this.setExpandRowKeys(d,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:o}=t;this.ctx.database.setValidationErrorByRowIndex(r,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<r.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(r[n]),u=s[a].key,d=await this.ctx.database.getValidator(c,u);Array.isArray(d)&&d.length&&o.push(d)}o.length?(t(o),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)}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:fC,mergeRowCell:dC,getSpanArrByRow:Sa,getSpanObjByColumn:$a}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const u4=l.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:o}=r;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=kt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Or=l.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=l.ref([]),o=i,n=pa(),a=l.computed(()=>({...o,config:{DISABLED:!0,...n,...o.config}}));let c=null;const u=l.useAttrs(),d=l.ref(null),f=l.ref(null),g=l.ref(null),v=l.ref(null),p=l.ref(),x=l.ref("text"),m=l.ref(),C={},_={},w=l.computed(()=>{const y=p.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>ct[y]||(({cellValue:M})=>M),E=y=>{var M;return(M=kt.renders[y])==null?void 0:M.renderDefault},I=(y,...M)=>({row:H,rowIndex:F,value:X})=>y({row:H,rowIndex:F,cellValue:X},...M),T=y=>{var M,H,F,X,P;if((M=y.slots)!=null&&M.default&&R.isFunction((H=y.slots)==null?void 0:H.default))return Y=>{var W,V;return(V=(W=y.slots)==null?void 0:W.default)==null?void 0:V.call(W,{row:Y.row,column:y,rowIndex:Y.rowIndex})};if((F=y.slots)!=null&&F.default&&R.isString((X=y.slots)==null?void 0:X.default))return`slot:${(P=y.slots)==null?void 0:P.default}`;if(y.cellRender&&y.cellRender.name)return Y=>{var W,V;return(V=E(y.cellRender.name))==null?void 0:V(y.cellRender,{data:o.data,row:Y.row,rowIndex:Y.rowIndex,field:y.field||Y.column.key,title:((W=Y.column)==null?void 0:W.title)??""},{})}},k=y=>{var M,H,F,X,P,Y,W;return(M=y.slots)!=null&&M.edit&&(y.field||y.key)&&R.isFunction((H=y.slots)==null?void 0:H.edit)?C[`__slot:${y.field||y.key}`]=y:(F=y.editRender)!=null&&F.name&&(y.field||y.key)&&(_[y.field||y.key]=y.editRender),{...R.omit(y,["formatter"]),key:y.key||y.field||ke(),formatter:R.isString(y.formatter)?I(b(y.formatter)):R.isArray(y.formatter)&&R.isString(y.formatter[0])?I(b(y.formatter[0]),...y.formatter.slice(1)):R.isFunction(y.formatter)?I(y.formatter):void 0,editorType:y.editorType??((X=y.slots)!=null&&X.edit&&(y.field||y.key)&&R.isFunction((P=y.slots)==null?void 0:P.edit)?`__slot:${y.field||y.key}`:(Y=y.editRender)!=null&&Y.name?y.editRender.name:void 0),render:T(y),children:(W=y.children)==null?void 0:W.map(V=>k(V))}};l.onMounted(()=>{d.value&&(c=new h4(d.value,{config:a.value.config,columns:o.columns.map(y=>k(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:v.value||void 0,editorElement:f.value||void 0}),Object.keys(u).forEach(y=>{const M=u[y];if(typeof M=="function"&&y.startsWith("on")){const H=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(H,M)}}),c.on("change",y=>{r("change",y)}),c.on("overlayerChange",y=>{m.value=y}),c.on("startEdit",y=>{p.value=y,x.value=y.editorType,x.value}),c.on("doneEdit",()=>{x.value="text"}),c.on("selectionChange",y=>{s.value=y,r("selectionChange",y)}),r("ready",c))});function O(y){if(!c||!p.value)return;const{rowKey:M,key:H}=p.value;c==null||c.setItemValueByEditor(M,H,y)}const S=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),l.watch(()=>o.columns,(y,M)=>{R.isEqual(y,M)||c==null||c.loadColumns(y.map(H=>k(H)))},{deep:!0}),l.watch(()=>a.value.config,y=>{c==null||c.loadConfig(y)},{deep:!0}),l.watch(()=>o.footerData,y=>{c==null||c.loadFooterData(y||[])},{deep:!0}),l.watch(()=>o.loading,(y,M)=>{y!==M&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,M)=>{const H=l.resolveComponent("a-empty"),F=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(F,{spinning:y.loading},{default:l.withCtx(()=>{var X,P,Y,W,V,we,de;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:d},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[x.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(C[x.value].slots.edit({row:p.value.row,column:C[x.value],rowIndex:p.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":S,value:p.value.value,"onUpdate:value":M[0]||(M[0]=se=>p.value.value=se),cell:p.value,onBlur:O},null,40,["style","value","cell"])):(X=l.unref(kt).renders[x.value])!=null&&X.renderEdit?(l.openBlock(),l.createBlock(l.unref(u4),{key:1,"cell-render":_[p.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(P=p.value)==null?void 0:P.row,rowIndex:((Y=p.value)==null?void 0:Y.rowIndex)??-1,field:((W=p.value)==null?void 0:W.key)??"",title:((we=(V=p.value)==null?void 0:V.column)==null?void 0:we.title)??""},bordered:!1,"get-popup-container":S,onBlur:O},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(y.$slots,"empty",{},()=>[l.createVNode(H,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:v},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((de=m.value)==null?void 0:de.views)||[],se=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(se.class),style:l.normalizeStyle(se.style),key:se.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(se.views,$e=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle($e.style),key:$e.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList($e.cells,j=>(l.openBlock(),l.createElementBlock("div",{class:"canvas-cell",key:`${j.rowKey}_${j.key}`,style:l.normalizeStyle(j.style)},[typeof j.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(j.render(j)),{key:0,bordered:!1})):typeof j.render=="string"&&j.render.startsWith("slot:")?l.renderSlot(y.$slots,j.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},j,{cell:j})):l.createCommentVNode("",!0)],4))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),d4={key:0},f4={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},g4={class:"flex items-center flex-1 gap-4px"},v4={key:2},p4={class:"flex items-center gap-4px"},x4={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},m4={key:0,class:"w-full text-slate-5 pl-4"},Ga=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean},fitHeight:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var Gt,Ut,qt,Zt,Jt;const r=i,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:u,proxyConfig:d,config:f,staticConfig:g}=l.toRefs(r),v=va(),p=pa(),x=l.ref(ke()),m=l.ref({}),C=l.computed(()=>({...r,config:{...p,...r.config},lazyReset:r.lazyReset??v.lazyReset??!1,fitCanvasHeight:r.fitHeight??v.fitCanvasHeight??100})),_=l.computed(()=>d.value&&d.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>_.value==="pagination"?{current:E.page,total:T.value,pageSize:E.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const w=l.computed(()=>R.omit({labelCol:yr,...n.value},["items"])),b=l.reactive({toolbar:!1,form:!1,table:!1}),E=l.reactive({page:1,size:((Gt=a.value)==null?void 0:Gt.pageSize)??10}),I=l.ref(0),T=l.ref(0),k=l.ref([]),O=l.ref(),S=l.ref(),y=l.ref(),M=l.ref(),H=l.ref(500),F=l.ref({}),X=D=>{F.value[E.page]=D},P=l.reactive([...(((qt=(Ut=r.toolbarConfig)==null?void 0:Ut.buttons)==null?void 0:qt.map(D=>D.code))??[]).filter(D=>D),...(((Jt=(Zt=r.toolbarConfig)==null?void 0:Zt.tools)==null?void 0:Jt.map(D=>D.code))??[]).filter(D=>D)].reduce((D,B)=>(D[B]=!1,D),{})),Y=(D,B)=>{P[D]=B},W=D=>{R.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(b.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(b.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(b.table=D.table)):R.isBoolean(D)&&(b.form=D,b.toolbar=D,b.table=D)},V=l.computed(()=>R.uniq(Object.values(F.value).flat(),D=>{var B;return D[((B=r.config)==null?void 0:B.ROW_KEY)??"id"]})),we=()=>{bt()},de=l.computed(()=>V.value.map(D=>{var B;return D[((B=r.config)==null?void 0:B.ROW_KEY)??"id"]})),se=(D,B)=>B?{list:R.isString(B.list)?R.get(D,B.list):R.isFunction(B.list)?B.list(D):void 0,total:R.isString(B.total)?R.get(D,B.total):R.isFunction(B.total)?B.total(D):void 0,result:R.isString(B.result)?R.get(D,B.result):R.isFunction(B.result)?B.result(D):void 0,message:R.isString(B.message)?R.get(D,B.message):R.isFunction(B.message)?B.message(D):void 0}:{list:D},$e=D=>{o("toolbarButtonClick",{data:k.value,code:D,selectedKeys:de.value,records:V.value}),_t(D)},j=R.debounce($e,100),Xt=({key:D})=>j(D),Oi=D=>{o("toolbarToolClick",{data:k.value,code:D,selectedKeys:de.value,records:V.value}),_t(D)},Ti=R.debounce(Oi,100),Ct=()=>new Promise(D=>{if(_.value!=="bad"){W({table:!0,form:!0});const{ajax:B}=d.value;B.query({form:m.value,page:E}).then(G=>{const{list:Te,total:Je,result:le,message:fe}=se(G,d.value.response);Te?(k.value=Te,I.value++):le?(k.value=le,T.value=Je??le.length,I.value++):(k.value=[],I.value++,fe&&ui(fe)),D(k.value)}).catch(G=>{console.error("fetchData error",G),D([])}).finally(()=>{W({table:!1,form:!1})})}}),Ne=(D,B)=>(E.page=D,E.size=B,Ct()),bt=()=>(E.page=1,F.value={},Ct()),Ue=R.debounce(Ct,160),ki=(D,B)=>(Object.assign(m.value,D),E.page=1,B?Promise.resolve():Ue()),_t=D=>{const{ajax:B}=d.value;switch(D){case"multiDelete":B.multiDelete&&(de.value.length>0?Ca({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{W({table:!0,toolbar:!0}),B.multiDelete(de.value).then(()=>{JE("删除成功"),bt()}).catch(()=>{QE("删除失败")}).finally(()=>{W({table:!1,toolbar:!1}),P.multiDelete=!1})}):ui("请选择要删除的数据"));break}},Li=l.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?c.value:[g.value.selectable&&g.value.tree?{type:"tree-selection",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:""},...c.value]),qe=D=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const B={};Tt(n.value.items,G=>{G.field&&G.itemRender?Ye(G.itemRender.defaultValue)?B[G.field]=G.itemRender.defaultValue:B[G.field]=void 0:G.field&&G.slots&&(Ye(G.slots.defaultValue)?B[G.field]=G.slots.defaultValue:B[G.field]=void 0)}),m.value=B}o("resetQuery")}E.page=1,D||Ue()},Di=()=>(F.value={},qe()),Oe=()=>{var le,fe;const D=(le=y.value)==null?void 0:le.parentElement,B=D?window.getComputedStyle(D).height:"0px",G=M.value?window.getComputedStyle(M.value).height:"0px",Te=G.includes("px")?R.toNumber(G.replace("px","")):0,Je=(fe=g.value)!=null&&fe.showCount?22:0;H.value=R.toNumber(B.replace("px",""))-C.value.fitCanvasHeight-(r.toolbarConfig?30:0)-Te-Je};let Ze;return l.onMounted(()=>{Oe(),window.addEventListener("resize",Oe),Ze=new MutationObserver(D=>{D.forEach(B=>{if(B.type==="attributes"&&B.attributeName==="style"){const G=B.target;window.getComputedStyle(G).display!=="none"&&Oe()}})}),y.value&&Ze.observe(y.value,{attributes:!0,attributeFilter:["style"]}),qe(r.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Oe),Ze.disconnect()}),e({commitProxy:{query:Ue,reload:Di,reloadPage:bt,passQuery:ki},$canvasTable:l.computed(()=>S.value),selectedRowKeys:de,setBtnLoading:Y,selectedRecords:V,$form:l.computed(()=>O.value),getFormData:()=>m.value,setLoadings:W,resizeTable:Oe}),(D,B)=>{var le,fe,Rt;const G=l.resolveComponent("a-menu-item"),Te=l.resolveComponent("a-menu"),Je=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:y,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[_.value==="bad"?(l.openBlock(),l.createElementBlock("div",d4,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(fe=(le=l.unref(n))==null?void 0:le.items)!=null&&fe.some(K=>K.field&&K.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:M},[l.createVNode(l.unref(L.Spin),{spinning:b.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:O,model:m.value},w.value,{onSubmit:we}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(K,Fe)=>(l.openBlock(),l.createBlock(Er,{key:`_col_${K.field||Fe}`,"form-data":m.value,item:K,onReset:B[0]||(B[0]=$=>qe(C.value.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(u)?(l.openBlock(),l.createElementBlock("div",f4,[l.createElementVNode("div",g4,[l.unref(u).buttons&&l.unref(u).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).buttons,(K,Fe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Fe},[K.dropdowns&&K.dropdowns.length?(l.openBlock(),l.createBlock(Je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(Te,{onClick:Xt},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(K.dropdowns,$=>(l.openBlock(),l.createBlock(G,{key:$.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString($.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content)+" ",1),l.createVNode(l.unref(dt.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):K.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code],onClick:$=>l.unref(j)(K.code)},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",v4))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",p4,[l.unref(u).tools&&l.unref(u).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(u).tools,(K,Fe)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:Fe,type:K.type,size:K.size??"middle",disabled:l.unref(u).disabled||K.disabled,onClick:$=>l.unref(Ti)(K.code),loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{icon:K.icon},null,8,["icon"])]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",x4,[(Rt=l.unref(g))!=null&&Rt.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",m4," 已选:"+l.toDisplayString(de.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Or,{ref_key:"canvasTableRef",ref:S,columns:Li.value,config:{...l.unref(f),HEIGHT:H.value},onSelectionChange:X,data:k.value,loading:b.table},null,8,["columns","config","data","loading"]),_.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(L.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:E.page,"page-size":E.size,total:T.value,onChange:Ne},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Tr=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=r.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Cr,l.mergeProps({ref_key:"formEl",ref:r},n.value,{data:l.unref(s)}),null,16,["data"]))}}),Ua=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},editAble:{type:Boolean},showAdd:{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=L.Form.useForm,r=l.ref(),s=i,o=l.ref(),n=l.useModel(i,"modelValue"),a=l.ref(0),c=l.ref([]),u=l.ref([]),d=E=>{a.value=E},f=l.computed(()=>s.max??1/0),g=E=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(T=>{var k;n.value=[...n.value,{...T,__index:(((k=R.max(n.value,O=>O.__index??-1))==null?void 0:k.__index)??-1)+1}],a.value=E})},v=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],p=E=>{var I,T,k,O,S,y;return((S=(O=(k=(T=(I=E==null?void 0:E.parentElement)==null?void 0:I.parentElement)==null?void 0:T.parentElement)==null?void 0:k.parentElement)==null?void 0:O.parentElement)==null?void 0:S.parentElement)??((y=o.value)==null?void 0:y.$el)??document.body},x=l.computed(()=>s.forceRender||n.value.length<=5),m=E=>{var T;const I=(T=n.value.find((k,O)=>O===E))==null?void 0:T.__index;q(I)&&(c.value=c.value.filter(k=>k!==I))},C=()=>{l.nextTick().then(()=>{var E,I;m(a.value),(I=(E=u.value[a.value])==null?void 0:E.$form)==null||I.validate()})};l.watch(()=>n.value,()=>{if(!s.keepSerial){const E=n.value.filter(I=>!q(I.__index));E.length>0&&E.forEach(I=>{var T;I.__index=(((T=R.max(n.value,k=>k.__index??-1))==null?void 0:T.__index)??-1)+1})}},{immediate:!0});const _=({key:E},I,T)=>{var k;if(s.menuHandler&&R.isFunction(s.menuHandler))s.menuHandler({code:R.toString(E),data:I,index:T});else switch(E){case"delete":n.value=n.value.filter((O,S)=>S!==T),l.nextTick(()=>{u.value=u.value.filter(O=>!!O),T<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=f.value){ui("已达到最大数量");return}n.value=[...n.value,R.clone({...R.omit(I,["id","__index"]),__index:(((k=R.max(n.value,O=>O.__index??-1))==null?void 0:k.__index)??-1)+1})];break}},w=R.debounce(_,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const b=R.debounce(m,50);return l.watchEffect(()=>{var T;const E=n.value.map((k,O)=>c.value.includes(k.__index)?O:void 0).filter(q),I=(T=r.value)==null?void 0:T.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((O,S)=>{E.includes(S)?O.classList.add("p-error-group-tab"):O.classList.remove("p-error-group-tab")})}),e({activeKey:l.computed(()=>a.value),setActiveKey:d,validateAll:()=>{const E=x.value?u.value.map(I=>{var T;return(T=I.$form)==null?void 0:T.validate()}):n.value.map(I=>{var T;return((T=t(I,s.getFormSetting(I).rules))==null?void 0:T.validate())??Promise.resolve()});return Promise.allSettled(E).then(I=>{if(c.value=I.map((T,k)=>{var O;return T.status==="rejected"&&typeof((O=n.value[k])==null?void 0:O.__index)=="number"?n.value[k].__index:void 0}).filter(T=>typeof T=="number"),!s.lazyErrorMark&&c.value.length){const T=c.value[0],k=n.value.findIndex(O=>O.__index===T);k!==-1&&(a.value=k)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(E,I)=>{var k,O,S;const T=n.value.findIndex(y=>y.__index===E);try{return await(x.value?((O=(k=u.value[T])==null?void 0:k.$form)==null?void 0:O.validate())??Promise.resolve():((S=t(n.value[T],s.getFormSetting(n.value[T]).rules))==null?void 0:S.validate())??Promise.resolve()),c.value=c.value.filter(y=>y!==E),Promise.resolve()}catch(y){return!c.value.includes(E)&&!I&&(c.value=[...c.value,E]),Promise.reject(y)}},validateFields:async(E,I,T)=>{var M,H;const k=n.value.findIndex(F=>F.__index===E),S=s.getFormSetting(n.value[k]).rules,y=t(n.value[k],S);try{return await(x.value?((H=(M=u.value[k])==null?void 0:M.$form)==null?void 0:H.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(F=>y.validateField(F,n.value[k][F],S[F]??[])))),Promise.resolve()}catch(F){return!c.value.includes(E)&&!T&&(c.value=[...c.value,E]),Promise.reject(F)}}}),(E,I)=>{const T=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(l.unref(L.Card),{ref_key:"rootRef",ref:o,title:E.title,size:"small"},{default:l.withCtx(()=>[E.loading?(l.openBlock(),l.createBlock(T,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(L.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=k=>a.value=k),"hide-add":"",onChange:C},{rightExtra:l.withCtx(()=>[l.renderSlot(E.$slots,"rightExtra",{},()=>[E.showAdd&&n.value.length<f.value?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:0,type:"link",onClick:I[0]||(I[0]=k=>g(n.value.length))},{default:l.withCtx(()=>I[2]||(I[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(n.value,(k,O)=>(l.openBlock(),l.createBlock(l.unref(L.TabPane),{key:O,tab:`${E.tabLabel} ${E.keepSerial?O+1:(k.__index??0)+1}`,"force-render":x.value},{closeIcon:l.withCtx(()=>{var S;return[E.editAble&&((S=l.unref(v))!=null&&S.length)?(l.openBlock(),l.createBlock(l.unref(L.Dropdown),{key:0,"get-popup-container":p},{overlay:l.withCtx(()=>[l.createVNode(l.unref(L.Menu),{onClick:y=>l.unref(w)(y,k,O)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(v).filter(y=>{var M;return((M=y.visibleMethod)==null?void 0:M.call(y,{data:k,index:O}))??!0}),y=>(l.openBlock(),l.createBlock(l.unref(L.MenuItem),{key:y.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(y.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(dt.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Tr,{ref_for:!0,ref_key:"blockInstance",ref:u,key:O,source:k,"get-form-setting":E.getFormSetting,onFocusCapture:S=>l.unref(b)(O),onClickCapture:S=>l.unref(b)(O)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:3},8,["title"])}}}),y4={class:"w-full text-right p-2"},qa=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(i,{expose:e}){const t=l.ref(),r=l.ref(!1),s=i,o=l.computed(()=>{var p;return(p=s.gridSetting.selectConfig)==null?void 0:p.multiple});let n,a,c;const u=l.reactive({modal:!1}),d=()=>{c&&c()},f=()=>{u.modal=!1,c&&c()},g=({row:p,field:x})=>{n&&!o.value&&s.beforePick(p).then(()=>{u.modal=!1,n({row:p,field:x})})},v=()=>{var x;const p=((x=t.value)==null?void 0:x.selectedRecords)??[];p.length===0&&!s.multipleAllowEmpty?ui("请选择数据"):s.beforePick(p).then(()=>{u.modal=!1,a(p)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((p,x)=>{n=p,c=x,r.value=!1,u.modal=!0,l.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((p,x)=>{a=p,c=x,r.value=!1,u.modal=!0,l.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{u.modal=!1}}),(p,x)=>(l.openBlock(),l.createBlock(l.unref(L.Modal),{open:u.modal,"onUpdate:open":x[0]||(x[0]=m=>u.modal=m),"destroy-on-close":"",title:p.title,width:p.width,footer:o.value?void 0:null,onCancel:d,"body-style":p.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:r.value?"unset":"642px"})},[l.createVNode(br,l.mergeProps(p.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",y4,[l.createElementVNode("span",null,[l.createVNode(l.unref(L.Button),{class:"mr-4",onClick:f},{default:l.withCtx(()=>x[1]||(x[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(L.Button),{type:"primary",onClick:v},{default:l.withCtx(()=>x[2]||(x[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function Za(i){i&&ga(i)}const w4={install(i){i.component("PForm",Cr),i.component("PGrid",br),i.component("PCanvasTable",Or),i.component("PCanvasGrid",Ga),i.component("PFormGroup",Ua),i.component("PGroupBlock",Tr),i.component("PromisePicker",qa)},addFormatter:ma,addRender:wr,setup:Za};exports.PCanvasGrid=Ga;exports.PCanvasTable=Or;exports.PForm=Cr;exports.PFormGroup=Ua;exports.PGrid=br;exports.PGroupBlock=Tr;exports.PromisePicker=qa;exports.addFormatter=ma;exports.addRender=wr;exports.cleanCol=Ri;exports.default=w4;exports.defaultItemResponsive=mr;exports.defaultLabelCol=yr;exports.get24rest=xa;exports.getButtonResponsive=KE;exports.getUIKitConfig=ME;exports.labelColDict=FE;exports.resetUIKitConfig=NE;exports.setUIKitConfig=ga;exports.setup=Za;