@vue-ui-kit/ant 2.3.7 → 2.3.8
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 +4 -4
- package/dist/declarations/antProxy.d.ts +2 -2
- package/dist/es/index.js +2312 -2304
- package/package.json +1 -1
- package/src/declarations/antProxy.ts +2 -2
- package/src/packages/components/PGrid.vue +27 -5
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const c=require("vue"),A=require("ant-design-vue"),pt=require("@ant-design/icons-vue");function dl(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const ul=dl(pt);var fl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Se=fl;function gl(r,e,t){if(r)if(r.forEach)r.forEach(e,t);else for(var i=0,s=r.length;i<s;i++)e.call(t,r[i],i,r)}var te=gl,vl=Object.prototype.toString,Fo=vl,ml=Fo;function xl(r){return function(e){return"[object "+r+"]"===ml.call(e)}}var Bt=xl,pl=Bt,yl=Array.isArray||pl("Array"),X=yl;function wl(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var we=wl,El=we;function Cl(r,e,t){if(r)for(var i in r)El(r,i)&&e.call(t,r[i],i,r)}var Ft=Cl,bl=X,_l=te,Rl=Ft;function Il(r,e,t){return r&&(bl(r)?_l:Rl)(r,e,t)}var J=Il;function Sl(r){return function(e){return typeof e===r}}var Et=Sl,Tl=Et,Ol=Tl("function"),ie=Ol,kl=J;function Ll(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);kl(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var gr=Ll,Dl=gr,$l=Dl("keys",1),$e=$l,Ml=Fo,Al=Ft,Nl=te;function Wi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function ii(r,e){return e?Ko(r,e):r}function Ko(r,e){if(r)switch(Ml.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Al(r,function(n,a){t[a]=ii(n,e)}),t}case"[object Date]":case"[object RegExp]":return Wi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Nl(r,function(n){i.push(ii(n,e))}),i}case"[object Set]":{var s=Wi(r);return s.forEach(function(n){s.add(ii(n,e))}),s}case"[object Map]":{var o=Wi(r);return o.forEach(function(n,a){o.set(a,ii(n,e))}),o}}return r}function Hl(r,e){return r&&Ko(r,e)}var vr=Hl,Bl=te,Fl=$e,Kl=X,Pl=vr,Gr=Object.assign;function Ur(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Bl(Fl(e[o]),t?function(n){r[n]=Pl(s[n],t)}:function(n){r[n]=s[n]});return r}var Yl=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=Kl(r[1])?[]:{},Ur(r,e,!0)}else return Gr?Gr.apply(Object,e):Ur(r,e)}return r},ce=Yl,Po=Se,Vl=te,Wl=J,Xl=ie,zl=ce,_e=function(){};function Gl(){Vl(arguments,function(r){Wl(r,function(e,t){_e[t]=Xl(e)?function(){var i=e.apply(_e.$context,arguments);return _e.$context=null,i}:e})})}function Yo(r){return zl(Po,r)}function Ul(){return Po}var Vo="3.7.8";_e.VERSION=Vo;_e.version=Vo;_e.mixin=Gl;_e.setup=Yo;_e.setConfig=Yo;_e.getConfig=Ul;var ql=_e;function Zl(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var mr=Zl,Jl=mr,Ql=$e;function jl(r,e,t){Jl(Ql(r),function(i){e.call(t,r[i],i,r)})}var Wo=jl;function ec(r){return r===null}var Me=ec,tc=Me;function ic(r,e){return function(t){return tc(t)?e:t[r]}}var Ct=ic,rc=J,sc=ie,oc=Ct;function nc(r,e,t){var i={};if(r)if(e)sc(e)||(e=oc(e)),rc(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var ac=nc;function lc(r){return r?r.constructor===Object:!1}var bt=lc;function cc(r){return r!=="__proto__"&&r!=="constructor"}var Xo=cc,qr=X,Zr=bt,hc=ie,dc=J,uc=Xo;function zo(r,e){return Zr(r)&&Zr(e)||qr(r)&&qr(e)?(dc(e,function(t,i){uc(i)&&(r[i]=hc(e)?t:zo(r[i],t))}),r):e}var fc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&zo(r,i);return r},gc=fc,vc=J;function mc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);vc(r,function(){i.push(e.apply(t,arguments))})}return i}var ot=mc,xc=we,pc=X;function yc(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&pc(o)){for(var l=0,d=o.length;l<d;l++)if(!!n.call(a,o[l],l,o)===i)return[!0,!1,l,o[l]][t]}else for(var f in o)if(xc(o,f)&&!!n.call(a,o[f],f,o)===i)return[!0,!1,f,o[f]][t]}return s}}var Ii=yc,wc=Ii,Ec=wc("some",1,0,!0,!1),Go=Ec,Cc=Ii,bc=Cc("every",1,1,!1,!0),Uo=bc,_c=we;function Rc(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(_c(r,t)&&e===r[t])return!0}return!1}var _t=Rc,Jr=X,Qr=_t;function Ic(r,e){var t,i=0;if(Jr(r)&&Jr(e)){for(t=e.length;i<t;i++)if(!Qr(r,e[i]))return!1;return!0}return Qr(r,e)}var qo=Ic,jr=J,Sc=_t,Tc=ie,Oc=Ct;function kc(r,e,t){var i=[];if(e){Tc(e)||(e=Oc(e));var s,o={};jr(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else jr(r,function(n){Sc(i,n)||i.push(n)});return i}var Zo=kc,Lc=ot;function Dc(r){return Lc(r,function(e){return e})}var xr=Dc,$c=Zo,Mc=xr;function Ac(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat(Mc(r[t]));return $c(e)}var Nc=Ac,Hc="undefined",Ee=Hc,Bc=Ee,Fc=Et,Kc=Fc(Bc),Te=Kc,Pc=Me,Yc=Te;function Vc(r){return Pc(r)||Yc(r)}var Ae=Vc,Wc=/(.+)?\[(\d+)\]$/,Jo=Wc;function Xc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var pr=Xc,zc=Jo,Gc=pr,Uc=we,qc=Te,Qo=Ae;function Zc(r,e,t){if(Qo(r))return t;var i=Qc(r,e);return qc(i)?t:i}function Jc(r,e){var t=e?e.match(zc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function Qc(r,e){if(r){var t,i,s,o=0;if(r[e]||Uc(r,e))return r[e];if(i=Gc(e),s=i.length,s){for(t=r;o<s;o++)if(t=Jc(t,i[o]),Qo(t))return o===s-1?t:void 0}return t}}var Kt=Zc,es=te,jc=xr,ts=ot,is=X,eh=ie,th=bt,rs=Te,ih=Me,rh=Ae,sh=Kt,oh=Ct,nh="asc",ah="desc";function or(r,e){return rs(r)?1:ih(r)?rs(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function lh(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===ah?or(n,o):or(o,n)}}function ch(r,e,t,i){var s=[];return t=is(t)?t:[t],es(t,function(o,n){if(o){var a=o,l;is(o)?(a=o[0],l=o[1]):th(o)&&(a=o.field,l=o.order),s.push({field:a,order:l||nh}),es(e,eh(a)?function(d,f){d[n]=a.call(i,d.data,f,r)}:function(d){d[n]=a?sh(d.data,a):d.data})}}),s}function hh(r,e,t){if(r){if(rh(e))return jc(r).sort(or);for(var i,s=ts(r,function(a){return{data:a}}),o=ch(r,s,e,t),n=o.length-1;n>=0;)i=lh(n,o[n],i),n--;return i&&(s=s.sort(i)),ts(s,oh("data"))}return[]}var yr=hh,dh=yr,uh=dh,fh=uh;function gh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var jo=gh,vh=gr,mh=vh("values",0),Rt=mh,xh=jo,ph=Rt;function yh(r){for(var e,t=[],i=ph(r),s=i.length-1;s>=0;s--)e=s>0?xh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var en=yh,wh=en;function Eh(r,e){var t=wh(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var Ch=Eh;function bh(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var tn=bh,_h=tn,Rh=_h(parseFloat),nt=Rh,ss=nt;function Ih(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?ss(e):0,t=s>=3?ss(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var at=Ih,Sh=J;function Th(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);Sh(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Oh=Th,kh=Ii,Lh=kh("",0,2,!0),Dh=Lh,$h=Ii,Mh=$h("find",1,3,!0),Ah=Mh,Nh=X,Hh=Rt;function Bh(r,e,t){if(r){Nh(r)||(r=Hh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Fh=Bh,Kh=$e;function Ph(r,e,t){if(r){var i,s,o=0,n=null,a=t,l=arguments.length>2,d=Kh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},l?r.reduce(s,a):r.reduce(s);for(l&&(o=1,a=r[d[0]]),i=d.length;o<i;o++)a=e.call(n,a,r[d[o]],o,r);return a}}var Yh=Ph,Vh=X;function Wh(r,e,t,i){if(Vh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,l=r.length,d=arguments.length>3?i>>0:l;if(n<l&&(n=n>=0?n:l+n,n>=0&&(a=a>=0?a:l+a,d=d>=0?d:l+d,a<d)))for(s=0,o=r.slice(a,d);n<l&&!(o.length<=s);n++)r[n]=o[s++];return r}var Xh=Wh,zh=X;function Gh(r,e){var t,i=[],s=e>>0||1;if(zh(r))if(s>=0&&r.length>s)for(t=0;t<r.length;)i.push(r.slice(t,t+s)),t+=s;else i=r.length?[r]:r;return i}var Uh=Gh,qh=ot,Zh=Ct;function Jh(r,e){return qh(r,Zh(e))}var rn=Jh,Qh=ie,os=Ae,jh=Kt,ed=te;function td(r){return function(e,t){if(e&&e.length){var i,s;return ed(e,function(o,n){t&&(o=Qh(t)?t(o,n,e):jh(o,t)),!os(o)&&(os(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var sn=td,id=sn,rd=id(function(r,e){return r<e}),on=rd,sd=rn,od=on;function nd(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=od(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(sd(r,e));return s}var nn=nd,ad=nn;function ld(){return ad(arguments)}var cd=ld,hd=Rt,dd=J;function ud(r,e){var t={};return e=e||[],dd(hd(r),function(i,s){t[i]=e[s]}),t}var fd=ud,an=X,gd=te;function ln(r,e){var t=[];return gd(r,function(i){t=t.concat(an(i)?e?ln(i,e):i:[i])}),t}function vd(r,e){return an(r)?ln(r,e):[]}var md=vd,xd=ot,pd=X;function yd(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function wd(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(pd(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return xd(r,function(l){if(o.length&&(l=yd(l,o)),t=l[e]||e,t&&t.apply)return t.apply(l,s)})}var Ed=wd;function Cd(r,e){return(console[r]||console.log)(e)}var bd=Cd;function _d(r,e){try{delete r[e]}catch{r[e]=void 0}}var cn=_d,Rd=X,Id=mr,Sd=Wo;function Td(r,e,t){return r&&(Rd(r)?Id:Sd)(r,e,t)}var hn=Td,Od=Et,kd=Od("object"),Si=kd,Ld=cn,Dd=bt,$d=Si,Md=X,Ad=Me,Nd=ce,Hd=Ft;function Bd(r,e,t){if(r){var i,s=arguments.length>1&&(Ad(e)||!$d(e)),o=s?t:e;if(Dd(r))Hd(r,s?function(n,a){r[a]=e}:function(n,a){Ld(r,a)}),o&&Nd(r,o);else if(Md(r)){if(s)for(i=r.length;i>0;)i--,r[i]=e;else r.length=0;o&&r.push.apply(r,o)}}return r}var dn=Bd,Fd=cn,Kd=ie,Pd=X,Yd=J,Vd=te,Wd=hn,Xd=dn,zd=Ae;function Gd(r){return function(e,t){return t===r}}function Ud(r,e,t){if(r){if(!zd(e)){var i=[],s=[];return Kd(e)||(e=Gd(e)),Yd(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Pd(r)?Wd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},Vd(i,function(o){s[o]=r[o],Fd(r,o)})),s}return Xd(r)}return r}var un=Ud,qd=Se,ns=bd,Zd=yr,Jd=vr,Qd=Ae,nr=J,jd=un,eu=ce;function tu(r,e){nr(r,function(t){t[e]&&!t[e].length&&jd(t,e)})}function iu(r,e){var t=eu({},qd.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,l=t.sortKey,d=t.reverse,f=t.data,u=[],g={},m={},x,v,p;return l&&(r=Zd(Jd(r),l),d&&(r=r.reverse())),nr(r,function(E){x=E[s],m[x]&&ns("warn","Duplicate primary key="+x),m[x]=!0}),nr(r,function(E){x=E[s],f?(v={},v[f]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,ns("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(v),v[n]=g[x],a&&(v[a]=g[x]),(!i||i&&Qd(p))&&(m[p]||u.push(v))}),i&&tu(r,n),u}var ru=iu,su=Se,ou=te,nu=ce;function fn(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,l=i.updated,d=i.clear;return ou(t,function(f){var u=f[n];a&&(f=f[a]),l!==!1&&(f[o]=e?e[s]:null),r.push(f),u&&u.length&&fn(r,f,u,i),d&&delete f[n]}),r}function au(r,e){return fn([],null,r,nu({},su.treeOptions,e))}var lu=au;function cu(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var Ti=cu,hu=Ti;function gn(r,e,t,i,s,o,n,a){if(e){var l,d,f,u,g,m;for(d=0,f=e.length;d<f;d++){if(l=e[d],u=s.concat([""+d]),g=o.concat([l]),t.call(i,l,d,e,u,r,g))return{index:d,item:l,path:u,items:e,parent:r,nodes:g};if(n&&l&&(m=gn(l,l[n],t,i,u.concat([n]),g,n),m))return m}}}var du=hu(gn),uu=du,fu=Ti,gu=J;function vn(r,e,t,i,s,o,n,a){var l,d;gu(e,function(f,u){l=s.concat([""+u]),d=o.concat([f]),t.call(i,f,u,e,l,r,d),f&&n&&(l.push(n),vn(f,f[n],t,i,l,d,n))})}var vu=fu(vn),mn=vu,mu=Ti,xu=ot;function xn(r,e,t,i,s,o,n,a){var l,d,f,u=a.mapChildren||n;return xu(e,function(g,m){return l=s.concat([""+m]),d=o.concat([g]),f=t.call(i,g,m,e,l,r,d),f&&g&&n&&g[n]&&(f[u]=xn(g,g[n],t,i,l,d,n,a)),f})}var pu=mu(xn),yu=pu,wu=mn;function Eu(r,e,t,i){var s=[];return r&&e&&wu(r,function(o,n,a,l,d,f){e.call(i,o,n,a,l,d,f)&&s.push(o)},t),s}var Cu=Eu,bu=Ti,_u=te,Ru=ce;function pn(r,e,t,i,s,o,n,a,l){var d,f,u,g,m,x=[],v=l.original,p=l.data,E=l.mapChildren||a,C=l.isEvery;return _u(t,function(w,b){d=o.concat([""+b]),f=n.concat([w]),g=r&&!C||i.call(s,w,b,t,d,e,f),m=a&&w[a],g||m?(v?u=w:(u=Ru({},w),p&&(u[p]=w)),u[E]=pn(g,w,w[a],i,s,d,f,a,l),(g||u[E].length)&&x.push(u)):g&&x.push(u)}),x}var Iu=bu(function(r,e,t,i,s,o,n,a){return pn(0,r,e,t,i,s,o,n,a)}),Su=Iu;function Tu(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(e===r[t])return t}var yn=Tu;function Ou(r,e){if(r.lastIndexOf)return r.lastIndexOf(e);for(var t=r.length-1;t>=0;t--)if(e===r[t])return t;return-1}var wn=Ou,ku=Et,Lu=ku("number"),Oe=Lu,Du=Oe;function $u(r){return Du(r)&&isNaN(r)}var Mu=$u,Au=Et,Nu=Au("string"),Ne=Nu,Hu=Bt,Bu=Hu("Date"),Xe=Bu,Fu=parseInt,Pt=Fu;function Ku(r){return Date.UTC(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}var Pu=Ku;function Yu(r){return r.getTime()}var fe=Yu,vi=Pt,as=Pu,Vu=fe,Wu=Ne,Xu=Xe;function Yt(r){return"(\\d{"+r+"})"}function zu(r){return r<10?r*100:r<100?r*10:r}function ls(r){return isNaN(r)?r:vi(r)}var ut=Yt(2),gt=Yt("1,2"),En=Yt("1,7"),Cn=Yt("3,4"),bn=".{1}",kt=bn+gt,_n="(([zZ])|([-+]\\d{2}:?\\d{2}))",cs=[Cn,kt,kt,kt,kt,kt,bn+En,_n],ar=[];for(var Xi=cs.length-1;Xi>=0;Xi--){for(var hs="",tt=0;tt<Xi+1;tt++)hs+=cs[tt];ar.push(new RegExp("^"+hs+"$"))}function Gu(r){for(var e,t={},i=0,s=ar.length;i<s;i++)if(e=r.match(ar[i]),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 ds=[["yyyy",Cn],["yy",ut],["MM",ut],["M",gt],["dd",ut],["d",gt],["HH",ut],["H",gt],["mm",ut],["m",gt],["ss",ut],["s",gt],["SSS",Yt(3)],["S",En],["Z",_n]],Rn={},In=["\\[([^\\]]+)\\]"];for(var tt=0;tt<ds.length;tt++){var zi=ds[tt];Rn[zi[0]]=zi[1]+"?",In.push(zi[0])}var Uu=new RegExp(In.join("|"),"g"),us={};function qu(r,e){var t=us[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Uu,function(f,u){var g=f.charAt(0);return g==="["?u:(i.push(g),Rn[f])});t=us[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,l=1,d=n.length;l<d;l++)o[a[l-1]]=n[l];return o}return o}function Zu(r){if(/^[zZ]/.test(r.Z))return new Date(as(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(as(r)-(e[1]==="-"?-1:1)*vi(e[2])*36e5+vi(e[3])*6e4):new Date("")}function Ju(r,e){if(r){var t=Xu(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?Vu(r):vi(r));if(Wu(r)){var i=e?qu(r,e):Gu(r);if(i.y)return i.M&&(i.M=ls(i.M)-1),i.S&&(i.S=zu(ls(i.S.substring(0,3)))),i.Z?Zu(i):new Date(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}}return new Date("")}var re=Ju;function Qu(){return new Date}var Oi=Qu,ju=Xe,ef=re,tf=Oi;function rf(r){var e,t=r?ef(r):tf();return ju(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var Sn=rf,sf=X,of=we;function nf(r,e,t){if(r){if(sf(r))for(var i=0,s=r.length;i<s&&e.call(t,r[i],i,r)!==!1;i++);else for(var o in r)if(of(r,o)&&e.call(t,r[o],o,r)===!1)break}}var af=nf,lf=X,cf=we;function hf(r,e,t){if(r){var i,s;if(lf(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=cf(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var df=hf,uf=X,ff=Ne,gf=we;function vf(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(ff(t)||uf(t))return e(t,i);for(var s in t)if(gf(t,s)&&i===t[s])return s}return-1}}var Tn=vf,mf=Tn,xf=yn,pf=mf("indexOf",xf),yf=pf,wf=Tn,Ef=wn,Cf=wf("lastIndexOf",Ef),On=Cf,bf=X,_f=Ne,Rf=J;function If(r){var e=0;return _f(r)||bf(r)?r.length:(Rf(r,function(){e++}),e)}var kn=If,Sf=Oe;function Tf(r){return Sf(r)&&isFinite(r)}var Of=Tf,kf=X,Lf=Me,Df=function(r){return!Lf(r)&&!isNaN(r)&&!kf(r)&&r%1===0},Ln=Df,$f=X,Mf=Ln,Af=Me;function Nf(r){return!Af(r)&&!isNaN(r)&&!$f(r)&&!Mf(r)}var Hf=Nf,Bf=Et,Ff=Bf("boolean"),Dn=Ff,Kf=Bt,Pf=Kf("RegExp"),wr=Pf,Yf=Bt,Vf=Yf("Error"),$n=Vf;function Wf(r){return r?r.constructor===TypeError:!1}var Xf=Wf;function zf(r){for(var e in r)return!1;return!0}var Mn=zf,Gf=Ee,Uf=typeof Symbol!==Gf;function qf(r){return Uf&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var An=qf,Zf=Bt,Jf=Zf("Arguments"),Qf=Jf,jf=Ne,eg=Oe;function tg(r){return!!(r&&jf(r.nodeName)&&eg(r.nodeType))}var ig=tg,rg=Ee,sg=typeof document===rg?0:document,Er=sg,og=Er;function ng(r){return!!(r&&og&&r.nodeType===9)}var ag=ng,lg=Ee,cg=typeof window===lg?0:window,Nn=cg,hg=Nn;function dg(r){return!!(hg&&(r&&r===r.window))}var ug=dg,fg=Ee,gg=typeof FormData!==fg;function vg(r){return gg&&r instanceof FormData}var mg=vg,xg=Ee,pg=typeof Map!==xg;function yg(r){return pg&&r instanceof Map}var wg=yg,Eg=Ee,Cg=typeof WeakMap!==Eg;function bg(r){return Cg&&r instanceof WeakMap}var _g=bg,Rg=Ee,Ig=typeof Set!==Rg;function Sg(r){return Ig&&r instanceof Set}var Tg=Sg,Og=Ee,kg=typeof WeakSet!==Og;function Lg(r){return kg&&r instanceof WeakSet}var Dg=Lg,$g=ie,Mg=Ne,Ag=X,Ng=we;function Hg(r){return function(e,t,i){if(e&&$g(t)){if(Ag(e)||Mg(e))return r(e,t,i);for(var s in e)if(Ng(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Hn=Hg,Bg=Hn,Fg=Bg(function(r,e,t){for(var i=0,s=r.length;i<s;i++)if(e.call(t,r[i],i,r))return i;return-1}),Cr=Fg,fs=Oe,gs=X,vs=Ne,Kg=wr,Pg=Xe,Yg=Dn,Vg=Te,ms=$e,Wg=Uo;function Bn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!fs(r)&&!fs(e)&&!vs(r)&&!vs(e)){if(Kg(r))return t(""+r,""+e,s,o,n);if(Pg(r)||Yg(r))return t(+r,+e,s,o,n);var a,l,d,f=gs(r),u=gs(e);if(f||u?f&&u:r.constructor===e.constructor)return l=ms(r),d=ms(e),i&&(a=i(r,e,s)),l.length===d.length?Vg(a)?Wg(l,function(g,m){return g===d[m]&&Bn(r[g],e[d[m]],t,i,f||u?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Fn=Bn;function Xg(r,e){return r===e}var Kn=Xg,zg=Fn,Gg=Kn;function Ug(r,e){return zg(r,e,Gg)}var Pn=Ug,xs=$e,qg=Cr,ps=Pn,Zg=Go,Jg=qo;function Qg(r,e){var t=xs(r),i=xs(e);if(i.length){if(Jg(t,i))return Zg(i,function(s){return qg(t,function(o){return o===s&&ps(r[o],e[s])})>-1})}else return!0;return ps(r,e)}var jg=Qg,ys=Fn,ws=Kn,ev=ie,tv=Te;function iv(r,e,t){return ev(t)?ys(r,e,function(i,s,o,n,a){var l=t(i,s,o,n,a);return tv(l)?ws(i,s):!!l},t):ys(r,e,ws)}var rv=iv,sv=An,ov=Xe,nv=X,av=wr,lv=$n,cv=Me;function hv(r){return cv(r)?"null":sv(r)?"symbol":ov(r)?"date":nv(r)?"array":av(r)?"regexp":lv(r)?"error":typeof r}var dv=hv,uv=Se,fv=Ae;function gv(r){return""+(fv(r)?"":r)+uv.keyId++}var vv=gv,mv=Hn,xv=mv(function(r,e,t){for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return i;return-1}),pv=xv,yv=bt,wv=Ne;function Ev(r){if(yv(r))return r;if(wv(r))try{return JSON.parse(r)}catch{}return{}}var Cv=Ev,bv=Ae;function _v(r){return bv(r)?"":JSON.stringify(r)}var Rv=_v,Iv=gr,Sv=Iv("entries",2),Tv=Sv,Ov=ie,kv=X,Lv=J,Dv=Cr;function $v(r,e){return function(t,i){var s,o,n={},a=[],l=this,d=arguments,f=d.length;if(!Ov(i)){for(o=1;o<f;o++)s=d[o],a.push.apply(a,kv(s)?s:[s]);i=0}return Lv(t,function(u,g){((i?i.call(l,u,g,t):Dv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=u)}),n}}var Yn=$v,Mv=Yn,Av=Mv(1,0),Nv=Av,Hv=Yn,Bv=Hv(0,1),Fv=Bv,Kv=Rt;function Pv(r){return Kv(r)[0]}var Yv=Pv,Vv=Rt;function Wv(r){var e=Vv(r);return e[e.length-1]}var Xv=Wv,zv=Jo,Gv=pr,ri=we;function Uv(r,e){if(r){if(ri(r,e))return!0;var t,i,s,o,n,a,l=Gv(e),d=0,f=l.length;for(n=r;d<f&&(a=!1,t=l[d],o=t?t.match(zv):"",o?(i=o[1],s=o[2],i?n[i]&&ri(n[i],s)&&(a=!0,n=n[i][s]):ri(n,s)&&(a=!0,n=n[s])):ri(n,t)&&(a=!0,n=n[t]),a);d++)if(d===f-1)return!0}return!1}var qv=Uv,Es=Pt,Zv=pr,Jv=Xo,Qv=we,Cs=/(.+)?\[(\d+)\]$/;function jv(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(Cs):null;if(t)n=s;else{var l=i?i.match(Cs):null;l&&!l[1]?n=new Array(Es(l[2])+1):n={}}return a?a[1]?(o=Es(a[2]),r[a[1]]?t?r[a[1]][o]=n:r[a[1]][o]?n=r[a[1]][o]:r[a[1]][o]=n:(r[a[1]]=new Array(o+1),r[a[1]][o]=n)):r[a[2]]=n:r[e]=n,n}return r[e]}function em(r,e,t){if(r&&Jv(e)){if((r[e]||Qv(r,e))&&!bs(e))r[e]=t;else for(var i=r,s=Zv(e),o=s.length,n=0;n<o;n++)if(!bs(s[n])){var a=n===o-1;i=jv(i,s[n],a,a?null:s[n+1],t)}}return r}function bs(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var tm=em,im=Mn,rm=Si,sm=ie,om=Ct,nm=J;function am(r){return function(){return im(r)}}function lm(r,e,t){var i,s={};return r&&(e&&rm(e)?e=am(e):sm(e)||(e=om(e)),nm(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var Vn=lm,cm=Vn,hm=Ft;function dm(r,e,t){var i=cm(r,e,t||this);return hm(i,function(s,o){i[o]=s.length}),i}var um=dm;function fm(r,e,t){var i,s,o=[],n=arguments;if(n.length<2&&(e=n[0],r=0),i=r>>0,s=e>>0,i<e)for(t=t>>0||1;i<s;i+=t)o.push(i);return o}var Wn=fm,_s=$e,gm=at,vm=_t,mm=te,xm=ce;function pm(r,e){if(r&&e){var t=xm.apply(this,[{}].concat(gm(arguments,1))),i=_s(t);mm(_s(r),function(s){vm(i,s)&&(r[s]=t[s])})}return r}var ym=pm,wm=sn,Em=wm(function(r,e){return r>e}),Cm=Em;function bm(r){return(r.split(".")[1]||"").length}var ki=bm,_m=Pt;function Rm(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(_m(e));return t.join(r)+(t.length>0?r:"")}var Vt=Rm;function Im(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Xn=Im,si=Vt,Gi=Xn;function Sm(r){var e=""+r,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var i=r<0,s=i?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",l=t[7],d=t[8],f=d-a.length,u=d-o.length,g=d-n.length;return l==="+"?o?s+o+si("0",d):f>0?s+n+a+si("0",f):s+n+Gi(a,d):o?u>0?s+"0."+si("0",Math.abs(u))+o:s+Gi(o,u):g>0?s+"0."+si("0",Math.abs(g))+n+a:s+Gi(n,g)+a}return e}var ze=Sm,Rs=ki,Is=ze;function Tm(r,e){var t=Is(r),i=Is(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,Rs(t)+Rs(i))}var zn=Tm,Om=zn,Ss=nt,km=ze;function Lm(r){return function(e,t){var i=Ss(e),s=i;if(i){t=t>>0;var o=km(i),n=o.split("."),a=n[0],l=n[1]||"",d=l.substring(0,t+1),f=a+(d?"."+d:"");if(t>=l.length)return Ss(f);if(f=i,t>0){var u=Math.pow(10,t);s=Math[r](Om(f,u))/u}else s=Math[r](f)}return s}}var br=Lm,Dm=br,$m=Dm("round"),_r=$m,Mm=br,Am=Mm("ceil"),Gn=Am,Nm=br,Hm=Nm("floor"),Un=Hm,Bm=Ae,Fm=Oe,Km=ze;function Pm(r){return Fm(r)?Km(r):""+(Bm(r)?"":r)}var se=Pm,Ym=_r,Vm=se,Wm=Vt,Xm=Xn;function zm(r,e){e=e>>0;var t=Vm(Ym(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+Wm("0",n):s+Xm(o,Math.abs(n)):s}var Rr=zm,Gm=Se,Um=_r,qm=Gn,Zm=Un,Jm=Oe,Qm=se,jm=Rr,ex=ze,tx=ce;function ix(r,e){var t=tx({},Gm.commafyOptions,e),i=t.digits,s=Jm(r),o,n,a,l,d;return s?(o=(t.ceil?qm:t.floor?Zm:Um)(r,i),n=ex(i?jm(o,i):o).split("."),l=n[0],d=n[1],a=l&&o<0,a&&(l=l.substring(1,l.length))):(o=Qm(r).replace(/,/g,""),n=o?[o]:[],l=n[0]),n.length?(a?"-":"")+l.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var rx=ix,sx=Pt,ox=tn,nx=ox(sx),ax=nx,lx=zn,Ts=nt;function cx(r,e){var t=Ts(r),i=Ts(e);return lx(t,i)}var Ir=cx,Os=ki,ks=ze,Ls=Ir;function hx(r,e){var t=ks(r),i=ks(e),s=Math.pow(10,Math.max(Os(t),Os(i)));return(Ls(r,s)+Ls(e,s))/s}var qn=hx,dx=qn,Ds=nt;function ux(r,e){return dx(Ds(r),Ds(e))}var fx=ux,$s=ki,Ms=ze,As=nt,gx=Rr;function vx(r,e){var t=As(r),i=As(e),s=Ms(t),o=Ms(i),n=$s(s),a=$s(o),l=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(gx((t*l-i*l)/l,d))}var mx=vx,Ns=ki,Hs=ze,xx=Ir;function px(r,e){var t=Hs(r),i=Hs(e),s=Ns(t),o=Ns(i),n=o-s,a=n<0,l=Math.pow(10,a?Math.abs(n):n);return xx(t.replace(".","")/i.replace(".",""),a?1/l:l)}var Zn=px,yx=Zn,Bs=nt;function wx(r,e){return yx(Bs(r),Bs(e))}var Ex=wx,Ui=qn,Cx=ie,bx=X,_x=J,Rx=Kt;function Ix(r,e,t){var i=0;return _x(r&&r.length>2&&bx(r)?r.sort():r,e?Cx(e)?function(){i=Ui(i,e.apply(t,arguments))}:function(s){i=Ui(i,Rx(s,e))}:function(s){i=Ui(i,s)}),i}var Jn=Ix,Sx=Zn,Tx=kn,Ox=Jn;function kx(r,e,t){return Sx(Ox(r,e,t),Tx(r))}var Lx=kx,Dx="first",Wt=Dx,$x="last",Li=$x;function Mx(r){return r.getFullYear()}var Xt=Mx,Ax=864e5,It=Ax;function Nx(r){return r.getMonth()}var Di=Nx,Hx=Xe,Bx=fe;function Fx(r){return Hx(r)&&!isNaN(Bx(r))}var ge=Fx,Fs=Wt,Kx=Li,Px=It,Yx=Xt,Ks=fe,Ps=Di,Vx=re,Wx=ge,Xx=Oe;function Qn(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=Vx(r),Wx(r)){if(t===Fs)return new Date(Yx(r),Ps(r)+i,1);if(t===Kx)return new Date(Ks(Qn(r,i+1,Fs))-1);if(Xx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Ps(r)+i),s!==r.getDate())return r.setDate(1),new Date(Ks(r)-Px)}}return r}var zt=Qn,zx=Wt,Ys=Li,Vs=Xt,Gx=zt,Ux=re,qx=ge;function Zx(r,e,t){var i;if(r=Ux(r),qx(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(Vs(r)+i)),t||!isNaN(t))){if(t===zx)return new Date(Vs(r),0,1);if(t===Ys)return r.setMonth(11),Gx(r,0,Ys);r.setMonth(t)}return r}var $i=Zx,Jx=zt,Qx=re,jx=ge;function ep(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function tp(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=Qx(r),jx(r)?(i=(ep(r)-1)*3,r.setMonth(i),Jx(r,s,t)):r}var ip=tp,Ws=Wt,rp=Li,sp=Pt,op=Xt,np=Di,ap=fe,lp=re,cp=ge;function jn(r,e,t){if(r=lp(r),cp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+sp(e)),t===Ws)return new Date(op(r),np(r),r.getDate());if(t===rp)return new Date(ap(jn(r,1,Ws))-1)}return r}var ea=jn;function hp(r){return r.toUpperCase()}var ta=hp,dp=It,up=dp*7,ia=up,fp=Se,qi=It,gp=ia,vp=fe,mp=re,xp=ge,Xs=Oe;function pp(r,e,t,i){if(r=mp(r),xp(r)){var s=Xs(t),o=Xs(i),n=vp(r);if(s||o){var a=o?i:fp.firstDayOfWeek,l=r.getDay(),d=s?t:l;if(l!==d){var f=0;a>l?f=-(7-a+l):a<l&&(f=a-l),d>a?n+=((d===0?7:d)-a+f)*qi:d<a?n+=(7-a+d+f)*qi:n+=f*qi}}return e&&!isNaN(e)&&(n+=e*gp),new Date(n)}return r}var ra=pp,yp=Se,oi=It,wp=ia,Ep=Oe,Cp=_t,bp=re,_p=ge,zs=ra,Rp=Wn,Ip=ot,ni=fe,Sp=Ip(Rp(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function Gs(r,e){var t=new Date(r).getDay();return Cp(Sp[e],t)}function Tp(r,e){return function(t,i){var s=Ep(i)?i:yp.firstDayOfWeek,o=bp(t);if(_p(o)){var n=zs(o,0,s,s),a=r(n),l=ni(a),d=ni(n),f=d+oi*6,u=new Date(f),g=zs(a,0,s,s),m=ni(g),x;if(d===m)return 1;if(e(n,u)){for(x=ni(r(u));x<f;x+=oi)if(Gs(x,s))return 1}var v=m+oi*6,p=new Date(f),E=1;if(e(g,p)){for(E=0,x=l;x<v;x+=oi)if(Gs(x,s)){E++;break}}return Math.floor((d-m)/wp)+E}return NaN}}var sa=Tp,Op=sa,kp=Op(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),oa=kp,Lp=Xt,Dp=Di;function $p(r){return new Date(Lp(r),Dp(r),r.getDate())}var Mp=$p,Ap=fe,Np=Mp;function Hp(r){return Ap(Np(r))}var Bp=Hp,Fp=It,Kp=Wt,Us=Bp,Pp=$i,Yp=re,Vp=ge;function Wp(r){return r=Yp(r),Vp(r)?Math.floor((Us(r)-Us(Pp(r,0,Kp)))/Fp)+1:NaN}var na=Wp,Xp=se,zp=Te,Gp=Vt;function Up(r,e,t){var i=Xp(r);return e=e>>0,t=zp(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=Gp(t,e/t.length)),t.slice(0,e)+i):i}var aa=Up,Lt=Se,qp=ta,Zp=Xt,qs=Di,Jp=re,Qp=oa,jp=na,e0=ce,t0=ge,i0=ie,be=aa;function Fe(r,e,t,i){var s=e[t];return s?i0(s)?s(i,t,r):s[i]:i}var r0=/\[([^\]]+)]|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 s0(r,e,t){if(r){if(r=Jp(r),t0(r)){var i=e||Lt.parseDateFormat||Lt.formatString,s=r.getHours(),o=s<12?"am":"pm",n=e0({},Lt.parseDateRules||Lt.formatStringMatchs,t?t.formats:null),a=function(w,b){return(""+Zp(r)).substr(4-b)},l=function(w,b){return be(qs(r)+1,b,"0")},d=function(w,b){return be(r.getDate(),b,"0")},f=function(w,b){return be(s,b,"0")},u=function(w,b){return be(s<=12?s:s-12,b,"0")},g=function(w,b){return be(r.getMinutes(),b,"0")},m=function(w,b){return be(r.getSeconds(),b,"0")},x=function(w,b){return be(r.getMilliseconds(),b,"0")},v=function(w,b){var S=r.getTimezoneOffset()/60*-1;return Fe(r,n,w,(S>=0?"+":"-")+be(S,2,"0")+(b===1?":":"")+"00")},p=function(w,b){return be(Fe(r,n,w,Qp(r,(t?t.firstDay:null)||Lt.firstDayOfWeek)),b,"0")},E=function(w,b){return be(Fe(r,n,w,jp(r)),b,"0")},C={yyyy:a,yy:a,MM:l,M:l,dd:d,d,HH:f,H:f,hh:u,h:u,mm:g,m:g,ss:m,s:m,SSS:x,S:x,ZZ:v,Z:v,WW:p,W:p,DDD:E,D:E,a:function(w){return Fe(r,n,w,o)},A:function(w){return Fe(r,n,w,qp(o))},e:function(w){return Fe(r,n,w,r.getDay())},E:function(w){return Fe(r,n,w,r.getDay())},q:function(w){return Fe(r,n,w,Math.floor((qs(r)+3)/3))}};return i.replace(r0,function(w,b){return b||(C[w]?C[w](w,w.length):w)})}return"Invalid Date"}return""}var la=s0,o0=fe,n0=Oi,a0=Date.now||function(){return o0(n0())},ca=a0,l0=fe,c0=ca,h0=re,d0=Xe,u0=function(r,e){if(r){var t=h0(r,e);return d0(t)?l0(t):t}return c0()},f0=u0,Zs=la;function g0(r,e,t){return r&&e?(r=Zs(r,t),r!=="Invalid Date"&&r===Zs(e,t)):!1}var v0=g0,m0=sa,x0=m0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),p0=x0,y0=$i,w0=re,E0=ge,C0=Sn;function b0(r,e){return r=w0(r),E0(r)?C0(y0(r,e))?366:365:NaN}var _0=b0,R0=It,I0=Wt,S0=Li,Js=fe,Qs=zt,T0=re,O0=ge;function k0(r,e){return r=T0(r),O0(r)?Math.floor((Js(Qs(r,e,S0))-Js(Qs(r,e,I0)))/R0)+1:NaN}var L0=k0,js=fe,D0=Oi,eo=re,to=ge,io=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function $0(r,e){var t,i,s,o,n,a,l={done:!1,time:0};if(r=eo(r),e=e?eo(e):D0(),to(r)&&to(e)&&(t=js(r),i=js(e),t<i))for(o=l.time=i-t,l.done=!0,a=0,n=io.length;a<n;a++)s=io[a],o>=s[1]?a===n-1?l[s[0]]=o||0:(l[s[0]]=Math.floor(o/s[1]),o-=l[s[0]]*s[1]):l[s[0]]=0;return l}var M0=$0,A0=se,N0=Te,H0=Vt;function B0(r,e,t){var i=A0(r);return e=e>>0,t=N0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=H0(t,e/t.length)),i+t.slice(0,e)):i}var F0=B0,K0=se,P0=Vt;function Y0(r,e){return P0(K0(r),e)}var V0=Y0,W0=se;function X0(r){return r&&r.trimRight?r.trimRight():W0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ha=X0,z0=se;function G0(r){return r&&r.trimLeft?r.trimLeft():z0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var da=G0,U0=ha,q0=da;function Z0(r){return r&&r.trim?r.trim():U0(q0(r))}var ua=Z0,J0={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},fa=J0,Q0=se,j0=$e;function e1(r){var e=new RegExp("(?:"+j0(r).join("|")+")","g");return function(t){return Q0(t).replace(e,function(i){return r[i]})}}var ga=e1,t1=fa,i1=ga,r1=i1(t1),s1=r1,ro=fa,o1=ga,n1=J,va={};n1(ro,function(r,e){va[ro[e]]=e});var a1=o1(va),l1=a1;function c1(r,e,t){return r.substring(e,t)}var ma=c1;function h1(r){return r.toLowerCase()}var xa=h1,d1=se,Ke=ma,Dt=ta,u1=xa,Zi={};function f1(r){if(r=d1(r),Zi[r])return Zi[r];var e=r.length,t=r.replace(/([-]+)/g,function(i,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(i,s,o){var n=s.length;return s=u1(s),o?n>2&&o+n<e?Dt(Ke(s,0,1))+Ke(s,1,n-1)+Dt(Ke(s,n-1,n)):Dt(Ke(s,0,1))+Ke(s,1,n):n>1&&o+n<e?Ke(s,0,n-1)+Dt(Ke(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Dt(Ke(s,1,s.length))}),Zi[r]=t,t}var g1=f1,v1=se,ft=ma,Pe=xa,Ji={};function m1(r){if(r=v1(r),Ji[r])return Ji[r];if(/^[A-Z]+$/.test(r))return Pe(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Pe(ft(s,0,n-1))+"-"+Pe(ft(s,n-1,n))+o:Pe(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Pe(ft(i,0,o-1)+"-"+ft(i,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,i,s,o,n){var a=s.length;return a>1&&(i&&(i+="-"),o)?(i||"")+Pe(ft(s,0,a-1))+"-"+Pe(ft(s,a-1,a))+o:(i||"")+(n?"-":"")+Pe(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),Ji[r]=e,e}var x1=m1,p1=se;function y1(r,e,t){var i=p1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var w1=y1,E1=se;function C1(r,e,t){var i=E1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var b1=C1,_1=Se,R1=se,I1=ua,S1=Kt;function T1(r,e,t){return R1(r).replace((t||_1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return S1(e,I1(s))})}var pa=T1,O1=pa;function k1(r,e){return O1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var L1=k1;function D1(){}var $1=D1,so=at;function M1(r,e){var t=so(arguments,2);return function(){return r.apply(e,so(arguments).concat(t))}}var A1=M1,oo=at;function N1(r,e){var t=!1,i=null,s=oo(arguments,2);return function(){return t||(i=r.apply(e,oo(arguments).concat(s)),t=!0),i}}var H1=N1,B1=at;function F1(r,e,t){var i=0,s=[];return function(){var o=arguments;i++,i<=r&&s.push(o[0]),i>=r&&e.apply(t,[s].concat(B1(o)))}}var K1=F1,P1=at;function Y1(r,e,t){var i=0,s=[];return t=t||this,function(){var o=arguments;i++,i<r&&(s.push(o[0]),e.apply(t,[s].concat(P1(o))))}}var V1=Y1,W1=ce;function X1(r,e,t){var i=null,s=null,o=!1,n=null,a=W1({leading:!0,trailing:!0},t),l=a.leading,d=a.trailing,f=function(){i=null,s=null},u=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),f()},g=function(){if(n=null,o){f();return}if(d===!0){u();return}f()},m=function(){var v=n!==null;return v&&clearTimeout(n),f(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&l===!0){u();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var z1=X1,G1=ce;function U1(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:G1({leading:!1,trailing:!0},t),n=!1,a=null,l=o.leading,d=o.trailing,f=function(){i=null,s=null},u=function(){n=!0,r.apply(s,i),f()},g=function(){if(l===!0&&(a=null),n){f();return}if(d===!0){u();return}f()},m=function(){var v=a!==null;return v&&clearTimeout(a),f(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?l===!0&&u():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var q1=U1,Z1=at;function J1(r,e){var t=Z1(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var Q1=J1,j1=decodeURIComponent,ya=j1,no=ya,ey=te,ty=Ne;function iy(r){var e,t={};return r&&ty(r)&&ey(r.split("&"),function(i){e=i.split("="),t[no(e[0])]=no(e[1]||"")}),t}var wa=iy,ry=encodeURIComponent,Ea=ry,mi=Ea,Ca=J,ba=X,_a=Me,sy=Te,Ra=bt;function Ia(r,e,t){var i,s=[];return Ca(r,function(o,n){i=ba(o),Ra(o)||i?s=s.concat(Ia(o,e+"["+n+"]",i)):s.push(mi(e+"["+(t?"":n)+"]")+"="+mi(_a(o)?"":o))}),s}function oy(r){var e,t=[];return Ca(r,function(i,s){sy(i)||(e=ba(i),Ra(i)||e?t=t.concat(Ia(i,s,e)):t.push(mi(s)+"="+mi(_a(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var ny=oy,ay=Ee,ly=typeof location===ay?0:location,Mi=ly,ai=Mi;function cy(){return ai?ai.origin||ai.protocol+"//"+ai.host:""}var Sa=cy,ao=Mi,hy=wa,dy=Sa;function lo(r){return hy(r.split("?")[1]||"")}function uy(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(ao?ao.protocol:"")+o:o.indexOf("/")===0&&(o=dy()+o),i=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:i&&i[1]&&i[1].length>1?i[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(n,a){return s.protocol=a,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(n,a,l){return t=l||"",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=lo(s.hash),s.searchQuery=lo(s.search),s}var Ta=uy,co=Mi,fy=Sa,gy=On;function vy(){if(co){var r=co.pathname,e=gy(r,"/")+1;return fy()+(e===r.length?r:r.substring(0,e))}return""}var my=vy,ho=Mi,xy=Ta;function py(){return ho?xy(ho.href):{}}var yy=py,Oa=Se,Qi=Er,uo=ya,fo=Ea,wy=X,go=Si,ka=Xe,Ey=Te,Cy=_t,by=$e,xi=ce,ji=te,_y=Oi,li=fe,Ry=$i,Iy=zt,Sy=ea;function vo(r,e){var t=parseFloat(e),i=_y(),s=li(i);switch(r){case"y":return li(Ry(i,t));case"M":return li(Iy(i,t));case"d":return li(Sy(i,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 er(r){return(ka(r)?r:new Date(r)).toUTCString()}function Ve(r,e,t){if(Qi){var i,s,o,n,a,l,d=[],f=arguments;return wy(r)?d=r:f.length>1?d=[xi({name:r,value:e},t)]:go(r)&&(d=[r]),d.length>0?(ji(d,function(u){i=xi({},Oa.cookies,u),o=[],i.name&&(s=i.expires,o.push(fo(i.name)+"="+fo(go(i.value)?JSON.stringify(i.value):i.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,m,x){return er(vo(x,m))}):/^[0-9]{11,13}$/.test(s)||ka(s)?s=er(s):s=er(vo("d",s)),i.expires=s),ji(["expires","path","domain","secure"],function(g){Ey(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),Qi.cookie=o.join("; ")}),!0):(n={},a=Qi.cookie,a&&ji(a.split("; "),function(u){l=u.indexOf("="),n[uo(u.substring(0,l))]=uo(u.substring(l+1)||"")}),f.length===1?n[r]:n)}return!1}function Ty(r){return Cy(La(),r)}function mo(r){return Ve(r)}function xo(r,e,t){return Ve(r,e,t),Ve}function po(r,e){Ve(r,"",xi({expires:-1},Oa.cookies,e))}function La(){return by(Ve())}function Oy(){return Ve()}xi(Ve,{has:Ty,set:xo,setItem:xo,get:mo,getItem:mo,remove:po,removeItem:po,keys:La,getJSON:Oy});var ky=Ve,Ly=Ee,tr=Er,ir=Nn,Dy=ce,$y=te;function yo(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function ci(r){return navigator.userAgent.indexOf(r)>-1}function My(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!tr};if(!ir&&typeof process!==Ly)n.isNode=!0;else{t=ci("Edge"),e=ci("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=tr.body||tr.documentElement,$y(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=yo(ir.localStorage)}catch{}try{o=yo(ir.sessionStorage)}catch{}Dy(n,{edge:t,firefox:ci("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&ci("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var Ay=My,Da=ql,wo=ce,Ny=Ft,Hy=Wo,By=ac,Fy=gc,Ky=ot,Py=Go,Yy=Uo,Vy=qo,Wy=te,Xy=mr,zy=Zo,Gy=Nc,Uy=xr,qy=fh,Zy=yr,Jy=en,Qy=Ch,jy=at,ew=Oh,tw=Dh,iw=_t,rw=Ah,sw=Fh,ow=Yh,nw=Xh,aw=Uh,lw=cd,cw=nn,hw=fd,dw=md,uw=rn,fw=Ed,gw=ru,vw=lu,mw=uu,xw=mn,pw=yu,yw=Cu,ww=Su,Ew=yn,Cw=wn,bw=we,_w=X,Rw=Me,Iw=Mu,Sw=Te,Tw=ie,Ow=Si,kw=Ne,Lw=bt,Dw=Sn,$w=Xe,Mw=Ae,Aw=J,Nw=af,Hw=df,Bw=yf,Fw=On,Kw=$e,Pw=Rt,Yw=vr,Vw=kn,Ww=hn,Xw=un,zw=dn,Gw=Of,Uw=Hf,qw=Ln,Zw=Dn,Jw=Oe,Qw=wr,jw=$n,eE=Xf,tE=Mn,iE=An,rE=Qf,sE=ig,oE=ag,nE=ug,aE=mg,lE=wg,cE=_g,hE=Tg,dE=Dg,uE=jg,fE=Pn,gE=rv,vE=dv,mE=vv,xE=Cr,pE=pv,yE=Cv,wE=Rv,EE=Tv,CE=Nv,bE=Fv,_E=Yv,RE=Xv,IE=qv,SE=Kt,TE=tm,OE=Vn,kE=um,LE=Wn,DE=ym,$E=jo,ME=on,AE=Cm,NE=rx,HE=_r,BE=Gn,FE=Un,KE=Rr,PE=ax,YE=nt,VE=ze,WE=fx,XE=mx,zE=Ir,GE=Ex,UE=Jn,qE=Lx,ZE=$i,JE=ip,QE=zt,jE=ea,e2=re,t2=la,i2=ca,r2=f0,s2=ge,o2=v0,n2=ra,a2=na,l2=oa,c2=p0,h2=_0,d2=L0,u2=M0,f2=F0,g2=aa,v2=V0,m2=ua,x2=ha,p2=da,y2=s1,w2=l1,E2=g1,C2=x1,b2=w1,_2=b1,R2=pa,I2=L1,Eo=se,S2=$1,T2=Ct,O2=A1,k2=H1,L2=K1,D2=V1,$2=z1,M2=q1,A2=Q1,N2=wa,H2=ny,B2=Ta,F2=my,K2=yy,P2=ky,Y2=Ay;wo(Da,{assign:wo,objectEach:Ny,lastObjectEach:Hy,objectMap:By,merge:Fy,uniq:zy,union:Gy,sortBy:qy,orderBy:Zy,shuffle:Jy,sample:Qy,some:Py,every:Yy,slice:jy,filter:ew,find:rw,findLast:sw,findKey:tw,includes:iw,arrayIndexOf:Ew,arrayLastIndexOf:Cw,map:Ky,reduce:ow,copyWithin:nw,chunk:aw,zip:lw,unzip:cw,zipObject:hw,flatten:dw,toArray:Uy,includeArrays:Vy,pluck:uw,invoke:fw,arrayEach:Wy,lastArrayEach:Xy,toArrayTree:gw,toTreeArray:vw,findTree:mw,eachTree:xw,mapTree:pw,filterTree:yw,searchTree:ww,hasOwnProp:bw,eqNull:Mw,isNaN:Iw,isFinite:Gw,isUndefined:Sw,isArray:_w,isFloat:Uw,isInteger:qw,isFunction:Tw,isBoolean:Zw,isString:kw,isNumber:Jw,isRegExp:Qw,isObject:Ow,isPlainObject:Lw,isDate:$w,isError:jw,isTypeError:eE,isEmpty:tE,isNull:Rw,isSymbol:iE,isArguments:rE,isElement:sE,isDocument:oE,isWindow:nE,isFormData:aE,isMap:lE,isWeakMap:cE,isSet:hE,isWeakSet:dE,isLeapYear:Dw,isMatch:uE,isEqual:fE,isEqualWith:gE,getType:vE,uniqueId:mE,getSize:Vw,indexOf:Bw,lastIndexOf:Fw,findIndexOf:xE,findLastIndexOf:pE,toStringJSON:yE,toJSONString:wE,keys:Kw,values:Pw,entries:EE,pick:CE,omit:bE,first:_E,last:RE,each:Aw,forOf:Nw,lastForOf:Hw,lastEach:Ww,has:IE,get:SE,set:TE,groupBy:OE,countBy:kE,clone:Yw,clear:zw,remove:Xw,range:LE,destructuring:DE,random:$E,min:AE,max:ME,commafy:NE,round:HE,ceil:BE,floor:FE,toFixed:KE,toNumber:YE,toNumberString:VE,toInteger:PE,add:WE,subtract:XE,multiply:zE,divide:GE,sum:UE,mean:qE,now:i2,timestamp:r2,isValidDate:s2,isDateSame:o2,toStringDate:e2,toDateString:t2,getWhatYear:ZE,getWhatQuarter:JE,getWhatMonth:QE,getWhatWeek:n2,getWhatDay:jE,getYearDay:a2,getYearWeek:l2,getMonthWeek:c2,getDayOfYear:h2,getDayOfMonth:d2,getDateDiff:u2,trim:m2,trimLeft:p2,trimRight:x2,escape:y2,unescape:w2,camelCase:E2,kebabCase:C2,repeat:v2,padStart:g2,padEnd:f2,startsWith:b2,endsWith:_2,template:R2,toFormatString:I2,toString:Eo,toValueString:Eo,noop:S2,property:T2,bind:O2,once:k2,after:L2,before:D2,throttle:$2,debounce:M2,delay:A2,unserialize:N2,serialize:H2,parseUrl:B2,getBaseURL:F2,locat:K2,browse:Y2,cookie:P2});var T=Da,j=[];for(var rr=0;rr<256;++rr)j.push((rr+256).toString(16).slice(1));function V2(r,e=0){return(j[r[e+0]]+j[r[e+1]]+j[r[e+2]]+j[r[e+3]]+"-"+j[r[e+4]]+j[r[e+5]]+"-"+j[r[e+6]]+j[r[e+7]]+"-"+j[r[e+8]]+j[r[e+9]]+"-"+j[r[e+10]]+j[r[e+11]]+j[r[e+12]]+j[r[e+13]]+j[r[e+14]]+j[r[e+15]]).toLowerCase()}var hi,W2=new Uint8Array(16);function X2(){if(!hi&&(hi=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!hi))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return hi(W2)}var z2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const Co={randomUUID:z2};function De(r,e,t){if(Co.randomUUID&&!r)return Co.randomUUID();r=r||{};var i=r.random||(r.rng||X2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,V2(i)}const G2=r=>r==null||r==="",Z=r=>!G2(r),et=r=>r==null,ue=r=>!et(r),U2=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},$a=(r,e,t,i,s,o,n)=>{let a,l;e.forEach((d,f)=>{a=s.concat([""+f]),l=o.concat([d]),t.call(i,d,f,e,a,r,l),d&&n&&(a.push(n),$a(d,d[n]||[],t,i,a,l,n))})},Mt=U2($a),Ma={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let ne=T.clone(Ma,!0);function Aa(r){ne={form:{...ne.form,...r.form},grid:{...ne.grid,...r.grid},canvasTable:{...ne.canvasTable,...r.canvasTable}}}function q2(){return ne}function bo(){var r,e;return{labelCol:(r=ne.form)==null?void 0:r.labelCol,wrapperCol:(e=ne.form)==null?void 0:e.wrapperCol}}function vt(){var r,e,t,i;return{align:(r=ne.grid)==null?void 0:r.align,lazyReset:(e=ne.grid)==null?void 0:e.lazyReset,fitHeight:(t=ne.grid)==null?void 0:t.fitHeight,striped:(i=ne.grid)==null?void 0:i.striped}}function Na(){return ne.canvasTable||{}}function Z2(){ne=JSON.parse(JSON.stringify(Ma))}const Ai=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...T.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Ai(t))}},Sr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Tr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},J2={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}},Ha=r=>{const t=(24-r.reduce((s,o)=>s+o,0))%24,i=t===0?24:t<0?24+t:t;return i>1?i:24},_o=["xxs","xs","sm","md","lg","xl","xxl"],Q2=r=>{const e=T.isArray(r)?r:T.isNumber(r)?Array.from({length:r},()=>Sr):[];return T.zipObject(_o,_o.map(t=>e.every(i=>Z(i[t]))?Ha(e.map(i=>i[t])):24))};function Or(r,e,t){const i=c.toValue(r);if(typeof i!="object"||i===null)return c.watch(r,e,t);let s=T.clone(i,!0);return c.watch(r,(o,n,a)=>{e(o,s,a),s=T.clone(o,!0)},t)}const je="-",mt={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??je:je},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return je;if(T.isArray(r))if(r.length>0){const s=e.filter(o=>r.includes(o.value));return s.length?s.map(o=>o.label).join(t):je}else return je;const i=e.find(s=>s.value===r);return i?i.label:je},formatSex:({cellValue:r})=>Z(r)?T.toNumber(r)===1?"男":"女":je},j2=(r,{record:e,index:t,column:i,field:s})=>{if(T.isString(r)&&mt[r]){const o=mt[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(T.isArray(r)&&mt[r[0]]&&r.length>1){const o=mt[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return T.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Ba=r=>{Object.assign(mt,r)},eC=c.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,l;return((l=(a=At.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:l.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Fa=c.defineComponent(r=>{const{tableData:e,row:t,column:i,rowIndex:s}=r,o=i.field?t[i.field]:null;return()=>{var n,a;return((a=(n=i.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:i,rowIndex:s,cellValue:o}))??(i.cellRender?c.createVNode(eC,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?j2(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),tC={class:"text-right mt-4px"},iC=c.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(r,{emit:e}){const t=r,i={size:"small",pagination:!1};c.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=c.computed(()=>T.merge({},i,t.tableConfig)),o=e,n=c.computed({get:()=>t.modelValue??[],set:u=>{o("update:modelValue",u)}}),a=c.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:u})=>d(u)}]}}]),l=()=>{n.value=[...n.value,{}]},d=u=>{n.value=n.value.filter((g,m)=>m!==u)},f=c.computed(()=>{let u=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+u,u++),!0):!1)});return(u,g)=>{const m=c.resolveComponent("a-form-item-rest"),x=c.resolveComponent("a-table"),v=c.resolveComponent("a-button");return c.openBlock(),c.createElementBlock("div",null,[c.createVNode(x,c.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(p=>c.unref(Ai)(p))}),c.createSlots({_:2},[f.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:p,record:E,index:C})=>[c.createVNode(m,null,{default:c.withCtx(()=>[f.value.some(w=>p.key&&w.field===p.key)?(c.openBlock(),c.createBlock(c.unref(Fa),{key:C,"row-index":C,"default-handler":{},column:f.value.find(w=>p.key&&w.field===p.key),row:E,"table-data":n.value},null,8,["row-index","column","row","table-data"])):c.createCommentVNode("",!0)]),_:2},1024)]),key:"0"}:void 0]),1040,["data-source","columns"]),c.createElementVNode("div",tC,[c.createVNode(v,{type:"primary",onClick:l},{default:c.withCtx(()=>g[0]||(g[0]=[c.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),ae=r=>{const{icon:e}=r,t=ul;return t[e]?c.createVNode(t[e]):t[e]},$t={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:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())},ASelect:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())}},di={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},Ka={$input:A.Input,AInput:A.Input,$textarea:A.Textarea,Textarea:A.Textarea,$number:A.InputNumber,AInputNumber:A.InputNumber,$select:A.Select,ASelect:A.Select,$date:A.DatePicker,ADatePicker:A.DatePicker,$range:A.RangePicker,ARangePicker:A.RangePicker,AAutoComplete:A.AutoComplete,$Cascader:A.Cascader,ACascader:A.Cascader,ACheckbox:A.Checkbox,AMentions:A.Mentions,ARate:A.Rate,ASlider:A.Slider,$time:A.TimePicker,ATimePicker:A.TimePicker,ATreeSelect:A.TreeSelect},rC=r=>{const e=Ka[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return ue(o)&&Z(a)&&et(n[a])&&(n[a]=o),a?c.createVNode(e,c.mergeProps({is:r,value:n[a],"onUpdate:value":l=>n[a]=l},i,T.merge({},$t[r],t),{onChange:(...l)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...l)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderDefault({props:t=$t[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:l}){return ue(o)&&Z(l)&&et(a[l])&&(a[l]=o),l?c.createVNode(e,c.mergeProps({is:r,value:a[l],"onUpdate:value":d=>a[l]=d},i,T.merge({},$t[r],t),{onChange:(...d)=>{var f;(f=s.change)==null||f.call(s,{data:n,row:a,field:l},...d)}}),null):c.createVNode(e,c.mergeProps({is:r},t),null)},renderEdit(t,{props:i=$t[r]??{},attrs:s={},events:o={}},n,a){return c.createVNode(e,c.mergeProps({is:r,value:t.value,"onUpdate:value":l=>t.value=l},s,T.merge({},$t[r],i),{onBlur:(...l)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...l)}}),null)}}},Pa=(r,e,t)=>{var i,s;return r.dropdowns&&r.dropdowns.length>0&&r.dropdowns.filter(o=>{var n;return!((n=o.hiddenIf)!=null&&n.call(o,e))}).length>0?c.createVNode(A.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return c.createVNode(A.Button,c.mergeProps(T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?c.createVNode(ae,{icon:r.icon},null):c.createVNode(ae,{icon:"DownOutlined"},null)},((o=r.getProps)==null?void 0:o.call(r,e))??{}),{default:()=>{var n;return[r.content||(((n=r==null?void 0:r.getContent)==null?void 0:n.call(r,e))??"")]}})},overlay:()=>{var o;return c.createVNode("div",{class:`dropdown-wrapper ${((o=r==null?void 0:r.dynamicClassName)==null?void 0:o.call(r,e))??""}`},[r.dropdowns.filter(n=>{var a;return!((a=n.hiddenIf)!=null&&a.call(n,e))}).map(n=>Pa(n,e,t))])}}):c.createVNode(A.Button,c.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},T.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?c.createVNode(ae,{icon:r.icon},null):null},((s=r.getProps)==null?void 0:s.call(r,e))??{},{onClick:()=>{r!=null&&r.clickEvt&&r.clickEvt(e)}}),{default:()=>{var o;return[r.content||(((o=r==null?void 0:r.getContent)==null?void 0:o.call(r,e))??"")]}})},lr={...Object.fromEntries(Object.keys(Ka).map(r=>[r,rC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return c.createVNode(A.Button,c.mergeProps(T.omit(r,["content"]),{icon:r.icon?c.createVNode(ae,{icon:r.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(n=>{s.reset(n?{data:n,field:i}:{data:t,field:i})}):s.reset({data:t,field:i}))}}),{default:()=>{var o;return[r.content,((o=r.suffix)==null?void 0:o.call(r,{data:t,field:i}))??null]}})},renderDefault({props:r={},events:e={}},{row:t,field:i},s){return c.createVNode(A.Button,c.mergeProps(T.omit(r,["content"]),{icon:r.icon?c.createVNode(ae,{icon:r.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.reset(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(l=>{s.pick(l?{row:l,field:i}:{row:t,field:i})}).finally(()=>{var l;(l=s==null?void 0:s.setLoadings)==null||l.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>c.createVNode(A.Button,c.mergeProps(T.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?c.createVNode(ae,{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:i}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.reset(l?{data:l,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(l=>{s.pick(l?{data:l,field:i}:{data:t,field:i})}):s.pick({data:t,field:i}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:r={},children:e=[]},{data:t,row:i,field:s},o){return c.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(n=>{var a,l;return!((l=(a=n==null?void 0:n.props)==null?void 0:a.hiddenIf)!=null&&l.call(a,{data:t,row:i,field:s}))}).map(n=>c.createVNode(A.Button,c.mergeProps(T.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?c.createVNode(ae,{icon:n.props.icon},null):null,onClick:()=>{var a,l,d,f;(l=(a=n.events)==null?void 0:a.click)==null||l.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.reset(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&T.isFunction(r.beforeClick)?((f=o==null?void 0:o.setLoadings)==null||f.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.pick(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=c.ref(null);return c.createVNode("span",{ref:i,class:e.noGap?"align-no-gap-box":"align-gap-box"},[r.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>Pa(s,t,()=>{var o,n,a,l;return((l=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:l.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(A.RadioGroup,c.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??t??[],disabled:!!r.disabled,onChange:(...n)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?c.createVNode(A.RadioGroup,c.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:r={},events:e={}},{data:t,field:i}){return Z(i)?c.createVNode(A.AutoComplete,c.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:di.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>c.createVNode(c.resolveComponent("a-input"),Object.assign({},di.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return ue(t)&&Z(s)&&et(i[s])&&(i[s]=t),Z(s)?c.createVNode(A.Switch,c.mergeProps({checked:i[s],"onUpdate:checked":o=>i[s]=o},r,{onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:i,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:r={},options:e,events:t={},defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&et(s[o])&&(s[o]=i),Z(o)?c.createVNode(A.CheckboxGroup,c.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??e??[],onChange:(...n)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?c.createVNode(A.CheckboxGroup,c.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$paragraph:{renderDefault({props:r={}},{row:e,field:t}){var o;const i={ellipsis:{expandable:!0,rows:3}},s=((o=r.getContent)==null?void 0:o.call(r,{row:e,field:t}))??(Z(t)?e[t]:"");return Z(t)?c.createVNode(A.TypographyParagraph,c.mergeProps(T.merge({},i,T.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return Z(i)?c.createVNode(iC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&T.isFunction(e)&&e(r.cusFields??i)},editColumns:r.editColumns??[],tableConfig:r.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:r={},attrs:e={},defaultValue:t},{data:i,field:s}){const o=r.parse?100:1;if(Z(s)){ue(t)&&et(i[s])&&(i[s]=t);const n=c.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return c.createVNode("div",{class:"flex items-center"},[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},T.merge({},di.PercentInput,T.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(Z(i)){const o=c.computed({get:()=>(t[i]??0)*s,set:n=>{T.set(t,i,(n??0)/s)}});return[r.info?c.createVNode("span",{class:"pr-4"},[r.info]):null,c.createVNode(c.resolveComponent("a-input-number"),c.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},T.merge({},di.PercentInput,T.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return Z(t)?c.createVNode(A.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return Z(t)?c.createVNode(A.TreeSelect,c.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},kr=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{lr.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),lr[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},At={renders:lr,addRender:kr},sC=c.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=c.toRefs(r),o=a=>{e("trigger",a)},n=(a,l)=>{e("delayTrigger",a,l)};return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:l.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},s.value,i))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),oC=c.defineComponent(r=>{const{formData:e}=c.toRefs(r);return()=>{var t,i;return((i=(t=r.item.slots)==null?void 0:t.default)==null?void 0:i.call(t,{data:e.value,field:r.item.field},r.passTrigger,r.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),nC={key:2},aC=["innerHTML"],Lr=c.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=c.ref(!1),o=c.ref(De()),n=(u,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",u)},m)},a=u=>{i("trigger",u)},l=()=>{i("reset")},d=()=>{o.value=De()},f=T.debounce(d,100);return Or(()=>t.item,(u,g)=>{T.isEqual(u,g)||f()},{deep:!0}),(u,g)=>{const m=c.resolveComponent("a-tooltip"),x=c.resolveComponent("a-form-item"),v=c.resolveComponent("a-col");return c.openBlock(),c.createBlock(v,c.mergeProps({key:`_col_${o.value}`},u.item.col??(u.item.span?{span:u.item.span}:c.unref(Sr))),{default:c.withCtx(()=>{var p;return[(c.openBlock(),c.createBlock(x,c.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${u.item.align??"left"} ${u.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:u.item.title,name:u.item.field,"wrapper-col":u.item.wrapperCol??(u.item.title?void 0:{span:24})},c.unref(T.omit)(u.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),c.createSlots({default:c.withCtx(()=>{var E,C;return[(E=u.item.slots)!=null&&E.default?(c.openBlock(),c.createBlock(c.unref(oC),{key:`_sl_${u.item.field??"_"}_${o.value}`,"form-data":u.formData,item:u.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(C=u.item.itemRender)!=null&&C.name?(c.openBlock(),c.createBlock(c.unref(sC),{key:`_re_${u.item.field??"_"}_${o.value}`,"default-handler":{reset:l},"item-render":u.item.itemRender,"render-form-params":{data:u.formData,field:u.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(c.openBlock(),c.createElementBlock("span",nC))]}),_:2},[(p=u.item.slots)!=null&&p.title?{name:"label",fn:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.resolveDynamicComponent(u.item.slots.title)))]),key:"0"}:void 0,u.item.tooltipConfig?{name:"tooltip",fn:c.withCtx(()=>[c.unref(T.isFunction)(u.item.tooltipConfig.title)?(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:0},c.unref(T.omit)(u.item.tooltipConfig,["title"]))),{title:c.withCtx(()=>[c.createElementVNode("div",{innerHTML:u.item.tooltipConfig.title()},null,8,aC)]),default:c.withCtx(()=>[c.createVNode(c.unref(pt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(c.openBlock(),c.createBlock(m,c.normalizeProps(c.mergeProps({key:1},u.item.tooltipConfig)),{default:c.withCtx(()=>[c.createVNode(c.unref(pt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),lC={key:0,class:"p-pane p-wrapper"},Dr=c.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>bo().labelCol??{span:6}},wrapperCol:{default:()=>bo().wrapperCol??{span:16}},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(r,{expose:e,emit:t}){const i=r,s=t,{items:o,data:n}=c.toRefs(i);function a(){s("apply",n.value)}const l=c.ref(),d=c.ref(De()),f=()=>{d.value=De()},u=()=>{if(i.customReset)i.customReset();else{const v={};Mt(o.value,p=>{p.field&&p.itemRender?ue(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ue(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(n.value,v)}s("reset")},g=c.computed(()=>({...T.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.wrapperCol})),m=v=>{var p;v&&((p=l.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:f,$form:c.computed(()=>l.value)}),(v,p)=>c.unref(o).some(E=>{var C;return E.field&&E.itemRender||((C=E.slots)==null?void 0:C.default)})?(c.openBlock(),c.createElementBlock("div",lC,[(c.openBlock(),c.createBlock(c.unref(A.Form),c.mergeProps({key:d.value,ref_key:"formEl",ref:l,model:c.unref(n)},g.value,{onSubmit:a}),{default:c.withCtx(()=>[c.createVNode(c.unref(A.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(o),(E,C)=>(c.openBlock(),c.createBlock(Lr,{key:`_col_${E.field||C}`,"form-data":c.unref(n),item:E,onReset:u,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):c.createCommentVNode("",!0)}}),cC=c.defineComponent(r=>{const{column:e}=r;return()=>{var t,i;return((i=(t=e.slots)==null?void 0:t.title)==null?void 0:i.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),Ya=({title:r,content:e})=>new Promise((t,i)=>{A.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),hC=A.message.success,dC=A.message.error;A.message.info;const pi=A.message.warning,uC={key:0},fC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},gC={class:"flex items-center flex-1 gap-4px"},vC={key:2},mC={class:"flex items-center gap-4px"},xC={key:0,class:"w-full text-slate-5 pl-4"},$r=c.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>vt().striped??!1},manualFetch:{type:Boolean},align:{default:()=>vt().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>vt().lazyReset??!1},fitHeight:{default:()=>vt().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Be,de,me,Ot,F;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:l,tableConfig:d,selectConfig:f,scrollMode:u}=c.toRefs(i),g=c.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{T.isObject(k)?Object.keys(k).forEach(D=>{g[D]=k[D]}):T.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=c.ref(),v=c.ref(),p=c.ref(500),E=c.ref([]),C=c.ref([]),w=k=>{const{ajax:D}=l.value;switch(k){case"multiDelete":D.multiDelete&&(E.value.length>0?Ya({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,D.multiDelete(E.value).then(()=>{A.message.success("删除成功"),ht()}).catch(()=>{A.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,I.multiDelete=!1})}):A.message.warn("请选择要删除的数据"));break}},b=c.computed(()=>{const k=[];return Mt(n.value??[],D=>{D.slots&&D.slots.title&&(D.field||(D.field="__holder__"+k.length),k.push(D))}),k}),S=c.ref(),N=c.ref(),K=c.ref(De()),R=c.ref(De()),I=c.reactive([...(((de=(Be=i.toolbarConfig)==null?void 0:Be.buttons)==null?void 0:de.map(k=>k.code))??[]).filter(k=>k),...(((Ot=(me=i.toolbarConfig)==null?void 0:me.tools)==null?void 0:Ot.map(k=>k.code))??[]).filter(k=>k)].reduce((k,D)=>(k[D]=!1,k),{})),_=(k,D)=>{I[k]=D},O=()=>{R.value=De()},y=T.debounce(O,100),$=c.computed(()=>{const k=[];return Mt(n.value??[],D=>{(D.slots&&D.slots.default||D.formatter||D.cellRender)&&(D.field||(D.field="__holder__"+k.length),k.push(D))}),k}),L=c.reactive({page:1,size:((F=o.value)==null?void 0:F.pageSize)??10}),Y=c.ref(0),V=c.ref(0),P=c.ref([]),W=c.computed(()=>l.value&&l.value.ajax?o.value?"pagination":"list":"bad"),G=c.useAttrs(),q=t,He=c.computed(()=>C.value.filter(k=>E.value.includes(k[i.rowKey??"id"]))),lt=k=>{q("toolbarButtonClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),w(k)},he=T.debounce(lt,100),Ge=({key:k})=>he(k),ee=k=>{q("toolbarToolClick",{data:P.value,code:k,selectedKeys:E.value,records:He.value}),w(k)},Fi=T.debounce(ee,100),ve=c.ref({}),Ki=({row:k,field:D})=>{q("pick",{row:k,field:D})},Ue=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const D={};Mt(s.value.items,z=>{z.field&&z.itemRender?ue(z.itemRender.defaultValue)?D[z.field]=z.itemRender.defaultValue:D[z.field]=void 0:z.field&&z.slots&&(ue(z.slots.defaultValue)?D[z.field]=z.slots.defaultValue:D[z.field]=void 0)}),ve.value=D}q("resetQuery")}L.page=1,k||dt()},ct=(k,D)=>D?{list:T.isString(D.list)?T.get(k,D.list):T.isFunction(D.list)?D.list(k):void 0,total:T.isString(D.total)?T.get(k,D.total):T.isFunction(D.total)?D.total(k):void 0,result:T.isString(D.result)?T.get(k,D.result):T.isFunction(D.result)?D.result(k):void 0,message:T.isString(D.message)?T.get(k,D.message):T.isFunction(D.message)?D.message(k):void 0}:{list:k},Zt=c.ref(!0),Pi=()=>(C.value=[],E.value=[],Ue()),ht=()=>(L.page=1,C.value=[],E.value=[],qe()),Yi=(k,D,z)=>(L.page=k.current,L.size=k.pageSize,qe()),qe=()=>new Promise(k=>{if(W.value!=="bad"){g.form=!0,g.table=!0;const{ajax:D}=l.value;D.query({form:ve.value,page:L}).then(z=>{const{list:xe,total:Je,result:Q,message:Ce}=ct(z,l.value.response);xe?(P.value=xe,Y.value++):Q?(P.value=Q,V.value=Je??Q.length,Y.value++):(P.value=[],Y.value++,Ce&&A.message.warn(Ce)),k(P.value)}).catch(z=>{console.error("fetchData error",z),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),dt=T.debounce(qe,160),Ze=(k,D)=>(Object.assign(ve.value,k),L.page=1,D?Promise.resolve():dt()),Tt=(k,D)=>(ve.value=k,L.page=1,D?Promise.resolve():dt()),Jt=c.computed(()=>W.value==="pagination"?{current:L.page,total:V.value,pageSize:L.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),Qt={size:"small",sticky:!0,transformCellText:({text:k})=>T.isArray(k)&&k.length===0?"-":k},jt=c.computed(()=>T.merge({},Qt,(d==null?void 0:d.value)??{},f.value?{rowSelection:{type:f.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:E.value,onChange:k=>{E.value=k;const D=i.rowKey??"id",z=C.value.map(Q=>Q[D]),Je=k.filter(Q=>!z.includes(Q)).map(Q=>P.value.find(Ce=>Ce[D]===Q)).filter(Q=>!!Q);C.value=[...C.value,...Je]},getCheckboxProps:f.value.getCheckboxProps}}:{})),ei=c.computed(()=>T.omit({labelCol:Tr,...s.value},["items"])),ti=()=>{ht()};c.watch(()=>[n.value,l.value,a.value],()=>{y()},{deep:!0});const M=()=>{var Q,Ce;const k=(Q=x.value)==null?void 0:Q.parentElement,D=k?window.getComputedStyle(k).height:"0px",z=v.value?window.getComputedStyle(v.value).height:"0px",xe=z.includes("px")?T.toNumber(z.replace("px","")):0,Je=(Ce=f.value)!=null&&Ce.showCount?22:0;p.value=i.renderY??T.toNumber(D.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-xe-Je,Zt.value=T.toNumber(D.replace("px",""))>600};e({commitProxy:{query:dt,reload:Pi,reloadPage:ht,passQuery:Ze,forcePassQuery:Tt},$table:c.computed(()=>N.value),selectedRowKeys:c.computed(()=>E.value),setBtnLoading:_,selectedRecords:He,$form:c.computed(()=>S.value),getFormData:()=>ve.value,setLoadings:m,resizeTable:M});let B;c.onMounted(()=>{M(),window.addEventListener("resize",M),B=new MutationObserver(k=>{k.forEach(D=>{if(D.type==="attributes"&&D.attributeName==="style"){const z=D.target;window.getComputedStyle(z).display!=="none"&&M()}})}),x.value&&B.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ue(i.manualFetch)});const U=["align"],Le=k=>k.map(D=>({...U.reduce((z,xe)=>({[xe]:i[xe]}),{}),...D}));return c.onBeforeUnmount(()=>{window.removeEventListener("resize",M),B.disconnect()}),(k,D)=>{var Q,Ce,zr;const z=c.resolveComponent("a-menu-item"),xe=c.resolveComponent("a-menu"),Je=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(G)),[W.value==="bad"?(c.openBlock(),c.createElementBlock("div",uC,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(Ce=(Q=c.unref(s))==null?void 0:Q.items)!=null&&Ce.some(H=>H.field&&H.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[c.createVNode(c.unref(A.Spin),{spinning:g.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(A.Form),c.mergeProps({key:K.value,ref_key:"formEl",ref:S,model:ve.value},ei.value,{onSubmit:ti}),{default:c.withCtx(()=>[c.createVNode(c.unref(A.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(s).items,(H,oe)=>(c.openBlock(),c.createBlock(Lr,{key:`_col_${H.field||oe}`,"form-data":ve.value,item:H,onReset:D[0]||(D[0]=Qe=>Ue(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(a)?(c.openBlock(),c.createElementBlock("div",fC,[c.createElementVNode("div",gC,[c.unref(a).buttons&&c.unref(a).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).buttons,(H,oe)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:oe},[H.dropdowns&&H.dropdowns.length?(c.openBlock(),c.createBlock(Je,{key:0},{overlay:c.withCtx(()=>[c.createVNode(xe,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(H.dropdowns,Qe=>(c.openBlock(),c.createBlock(z,{key:Qe.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(Qe.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(A.Button),{type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&I[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content)+" ",1),c.createVNode(c.unref(pt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):H.code?(c.openBlock(),c.createBlock(c.unref(A.Button),{key:1,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,loading:g.toolbar||!!H.code&&I[H.code],danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(he)(H.code)},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",vC))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",mC,[c.unref(a).tools&&c.unref(a).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(a).tools,(H,oe)=>(c.openBlock(),c.createBlock(c.unref(A.Button),{key:oe,type:H.type,size:H.size??"middle",disabled:c.unref(a).disabled||H.disabled,danger:H.danger,shape:H.shape,ghost:H.ghost,block:H.block,onClick:Qe=>c.unref(Fi)(H.code),loading:g.toolbar||!!H.code&&I[H.code]},{default:c.withCtx(()=>[H.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:H.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",{class:c.normalizeClass(`p-pane flex-1 ${Zt.value?"h-0":""} p-${c.unref(u)??"inner"}-scroll`)},[(zr=c.unref(f))!=null&&zr.multiple&&c.unref(f).showCount?(c.openBlock(),c.createElementBlock("div",xC," 已选:"+c.toDisplayString(E.value.length),1)):c.createCommentVNode("",!0),(c.openBlock(),c.createBlock(c.unref(A.Table),c.mergeProps({key:R.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:N,"row-class-name":k.striped?(H,oe)=>oe%2===1?"p-grid-row-striped":"":"",columns:Le(c.unref(n)??[]).map(H=>c.unref(Ai)(H)),"data-source":P.value,loading:g.table,pagination:Jt.value},jt.value,{scroll:{x:"max-content",y:p.value},onChange:Yi}),c.createSlots({_:2},[b.value.length>0?{name:"headerCell",fn:c.withCtx(({column:H})=>[b.value.some(oe=>H.key&&oe.field===H.key)?(c.openBlock(),c.createBlock(c.unref(cC),{key:R.value+"_title_"+Y.value+"_slot_"+H.key,column:b.value.find(oe=>H.key&&oe.field===H.key)},null,8,["column"])):c.createCommentVNode("",!0)]),key:"0"}:void 0,$.value.length>0?{name:"bodyCell",fn:c.withCtx(({column:H,record:oe,index:Qe})=>[$.value.some(Vi=>H.key&&Vi.field===H.key)?(c.openBlock(),c.createBlock(c.unref(Fa),{key:R.value+"_cell_"+Y.value+"_slot_"+H.key,column:$.value.find(Vi=>H.key&&Vi.field===H.key),"default-handler":{pick:Ki,setLoadings:m},row:oe,"row-index":Qe,"table-data":P.value},null,8,["column","default-handler","row","row-index","table-data"])):c.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var pC=Object.defineProperty,yC=(r,e,t)=>e in r?pC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>yC(r,typeof e!="symbol"?e+"":e,t);class wC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:l,value:d,field:f,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:f,fieldValue:u,value:d,column:i,colIndex:a,rowIndex:l,row:s,key:o,rowKey:n,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:l,field:f,fieldValue:u,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:l,field:f,fieldValue:u,message:g.message||`${o} is required`})}return t}}function Va(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Mr(r,e){let t=0,i;return function(...s){const o=new Date().getTime(),n=o-t,a=typeof e=="function"?e():e;!t||n>=a?(r.apply(this,s),t=o):i||(i=setTimeout(()=>{r.apply(this,s),t=new Date().getTime(),i=void 0},a-n))}}function fi(r=[]){return r.length?r.map(e=>fi(e.children)+1).sort((e,t)=>t-e)[0]:0}function EC(r=[]){let e=[],t=[],i=[];return r.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?i.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)),...i.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function gi(r=[],e=1,t=0,i=""){return r.sort((s,o)=>(s.sort??0)-(o.sort??0)).map(s=>{if(s.children){let o=0,n=s.fixed;s.children.forEach(l=>{l.fixed=n});const a=gi(s.children,e-1,t+1,s.key);return a&&a.forEach(l=>{o+=l.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((l,d)=>(l.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Nt(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Nt(t.children)):e.push(t)}),e}function Wa(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:Wa(e.children)}:{...e})}const Ro=/^(\r\n|\n\r|\r|\n)/,CC=/^[^\t\r\n]+/,Io=/^\t/;function bC(r){let e=[[""]];if(r.length===0)return e;let t=0,i=0,s;for(;r.length>0&&s!==r.length;)if(s=r.length,r.match(Io))r=r.replace(Io,""),t+=1,e[i][t]="";else if(r.match(Ro))r=r.replace(Ro,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const l=r.slice(0,1);l==='"'&&(n+=1),o+=l,r=r.slice(1),(r.length===0||r.match(/^[\t\r\n]/)&&n%2===0)&&(a=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,l=>new Array(Math.floor(l.length/2)).fill('"').join(""))}else{const n=r.match(CC);o=n?n[0]:"",r=r.slice(o.length)}e[i][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 _C(r){let e,t,i,s,o="",n;for(e=0,t=r.length;e<t;e+=1){for(s=r[e].length,i=0;i<s;i+=1)i>0&&(o+=" "),n=r[e][i],typeof n=="string"?n.indexOf(`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),A=require("ant-design-vue"),wt=require("@ant-design/icons-vue");function fl(r){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(r){for(const t in r)if(t!=="default"){const i=Object.getOwnPropertyDescriptor(r,t);Object.defineProperty(e,t,i.get?i:{enumerable:!0,get:()=>r[t]})}}return e.default=r,Object.freeze(e)}const gl=fl(wt);var vl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Le=vl;function ml(r,e,t){if(r)if(r.forEach)r.forEach(e,t);else for(var i=0,s=r.length;i<s;i++)e.call(t,r[i],i,r)}var te=ml,xl=Object.prototype.toString,Po=xl,pl=Po;function yl(r){return function(e){return"[object "+r+"]"===pl.call(e)}}var Kt=yl,wl=Kt,El=Array.isArray||wl("Array"),z=El;function Cl(r,e){return r&&r.hasOwnProperty?r.hasOwnProperty(e):!1}var be=Cl,bl=be;function _l(r,e,t){if(r)for(var i in r)bl(r,i)&&e.call(t,r[i],i,r)}var Pt=_l,Rl=z,Il=te,Sl=Pt;function Tl(r,e,t){return r&&(Rl(r)?Il:Sl)(r,e,t)}var J=Tl;function Ol(r){return function(e){return typeof e===r}}var bt=Ol,kl=bt,Ll=kl("function"),ie=Ll,Dl=J;function $l(r,e){var t=Object[r];return function(i){var s=[];if(i){if(t)return t(i);Dl(i,e>1?function(o){s.push([""+o,i[o]])}:function(){s.push(arguments[e])})}return s}}var mr=$l,Ml=mr,Al=Ml("keys",1),Ne=Al,Nl=Po,Bl=Pt,Hl=te;function zi(r,e){var t=r.__proto__.constructor;return e?new t(e):new t}function si(r,e){return e?Yo(r,e):r}function Yo(r,e){if(r)switch(Nl.call(r)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(r));return Bl(r,function(n,a){t[a]=si(n,e)}),t}case"[object Date]":case"[object RegExp]":return zi(r,r.valueOf());case"[object Array]":case"[object Arguments]":{var i=[];return Hl(r,function(n){i.push(si(n,e))}),i}case"[object Set]":{var s=zi(r);return s.forEach(function(n){s.add(si(n,e))}),s}case"[object Map]":{var o=zi(r);return o.forEach(function(n,a){o.set(a,si(n,e))}),o}}return r}function Fl(r,e){return r&&Yo(r,e)}var xr=Fl,Kl=te,Pl=Ne,Yl=z,Vl=xr,qr=Object.assign;function Zr(r,e,t){for(var i=e.length,s,o=1;o<i;o++)s=e[o],Kl(Pl(e[o]),t?function(n){r[n]=Vl(s[n],t)}:function(n){r[n]=s[n]});return r}var Wl=function(r){if(r){var e=arguments;if(r===!0){if(e.length>1)return r=Yl(r[1])?[]:{},Zr(r,e,!0)}else return qr?qr.apply(Object,e):Zr(r,e)}return r},ce=Wl,Vo=Le,Xl=te,zl=J,Gl=ie,Ul=ce,Te=function(){};function ql(){Xl(arguments,function(r){zl(r,function(e,t){Te[t]=Gl(e)?function(){var i=e.apply(Te.$context,arguments);return Te.$context=null,i}:e})})}function Wo(r){return Ul(Vo,r)}function Zl(){return Vo}var Xo="3.7.8";Te.VERSION=Xo;Te.version=Xo;Te.mixin=ql;Te.setup=Wo;Te.setConfig=Wo;Te.getConfig=Zl;var Jl=Te;function Ql(r,e,t){for(var i=r.length-1;i>=0;i--)e.call(t,r[i],i,r)}var pr=Ql,jl=pr,ec=Ne;function tc(r,e,t){jl(ec(r),function(i){e.call(t,r[i],i,r)})}var zo=tc;function ic(r){return r===null}var Be=ic,rc=Be;function sc(r,e){return function(t){return rc(t)?e:t[r]}}var _t=sc,oc=J,nc=ie,ac=_t;function lc(r,e,t){var i={};if(r)if(e)nc(e)||(e=ac(e)),oc(r,function(s,o){i[o]=e.call(t,s,o,r)});else return r;return i}var cc=lc;function hc(r){return r?r.constructor===Object:!1}var Rt=hc;function dc(r){return r!=="__proto__"&&r!=="constructor"}var Go=dc,Jr=z,Qr=Rt,uc=ie,fc=J,gc=Go;function Uo(r,e){return Qr(r)&&Qr(e)||Jr(r)&&Jr(e)?(fc(e,function(t,i){gc(i)&&(r[i]=uc(e)?t:Uo(r[i],t))}),r):e}var vc=function(r){r||(r={});for(var e=arguments,t=e.length,i,s=1;s<t;s++)i=e[s],i&&Uo(r,i);return r},mc=vc,xc=J;function pc(r,e,t){var i=[];if(r&&arguments.length>1){if(r.map)return r.map(e,t);xc(r,function(){i.push(e.apply(t,arguments))})}return i}var at=pc,yc=be,wc=z;function Ec(r,e,t,i,s){return function(o,n,a){if(o&&n){if(r&&o[r])return o[r](n,a);if(e&&wc(o)){for(var c=0,d=o.length;c<d;c++)if(!!n.call(a,o[c],c,o)===i)return[!0,!1,c,o[c]][t]}else for(var f in o)if(yc(o,f)&&!!n.call(a,o[f],f,o)===i)return[!0,!1,f,o[f]][t]}return s}}var Ti=Ec,Cc=Ti,bc=Cc("some",1,0,!0,!1),qo=bc,_c=Ti,Rc=_c("every",1,1,!1,!0),Zo=Rc,Ic=be;function Sc(r,e){if(r){if(r.includes)return r.includes(e);for(var t in r)if(Ic(r,t)&&e===r[t])return!0}return!1}var It=Sc,jr=z,es=It;function Tc(r,e){var t,i=0;if(jr(r)&&jr(e)){for(t=e.length;i<t;i++)if(!es(r,e[i]))return!1;return!0}return es(r,e)}var Jo=Tc,ts=J,Oc=It,kc=ie,Lc=_t;function Dc(r,e,t){var i=[];if(e){kc(e)||(e=Lc(e));var s,o={};ts(r,function(n,a){s=e.call(t,n,a,r),o[s]||(o[s]=1,i.push(n))})}else ts(r,function(n){Oc(i,n)||i.push(n)});return i}var Qo=Dc,$c=at;function Mc(r){return $c(r,function(e){return e})}var yr=Mc,Ac=Qo,Nc=yr;function Bc(){for(var r=arguments,e=[],t=0,i=r.length;t<i;t++)e=e.concat(Nc(r[t]));return Ac(e)}var Hc=Bc,Fc="undefined",_e=Fc,Kc=_e,Pc=bt,Yc=Pc(Kc),De=Yc,Vc=Be,Wc=De;function Xc(r){return Vc(r)||Wc(r)}var He=Xc,zc=/(.+)?\[(\d+)\]$/,jo=zc;function Gc(r){return r?r.splice&&r.join?r:(""+r).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var wr=Gc,Uc=jo,qc=wr,Zc=be,Jc=De,en=He;function Qc(r,e,t){if(en(r))return t;var i=eh(r,e);return Jc(i)?t:i}function jc(r,e){var t=e?e.match(Uc):"";return t?t[1]?r[t[1]]?r[t[1]][t[2]]:void 0:r[t[2]]:r[e]}function eh(r,e){if(r){var t,i,s,o=0;if(r[e]||Zc(r,e))return r[e];if(i=qc(e),s=i.length,s){for(t=r;o<s;o++)if(t=jc(t,i[o]),en(t))return o===s-1?t:void 0}return t}}var Yt=Qc,is=te,th=yr,rs=at,ss=z,ih=ie,rh=Rt,os=De,sh=Be,oh=He,nh=Yt,ah=_t,lh="asc",ch="desc";function ar(r,e){return os(r)?1:sh(r)?os(e)?-1:1:r&&r.localeCompare?r.localeCompare(e):r>e?1:-1}function hh(r,e,t){return function(i,s){var o=i[r],n=s[r];return o===n?t?t(i,s):0:e.order===ch?ar(n,o):ar(o,n)}}function dh(r,e,t,i){var s=[];return t=ss(t)?t:[t],is(t,function(o,n){if(o){var a=o,c;ss(o)?(a=o[0],c=o[1]):rh(o)&&(a=o.field,c=o.order),s.push({field:a,order:c||lh}),is(e,ih(a)?function(d,f){d[n]=a.call(i,d.data,f,r)}:function(d){d[n]=a?nh(d.data,a):d.data})}}),s}function uh(r,e,t){if(r){if(oh(e))return th(r).sort(ar);for(var i,s=rs(r,function(a){return{data:a}}),o=dh(r,s,e,t),n=o.length-1;n>=0;)i=hh(n,o[n],i),n--;return i&&(s=s.sort(i)),rs(s,ah("data"))}return[]}var Er=uh,fh=Er,gh=fh,vh=gh;function mh(r,e){return r>=e?r:(r=r>>0)+Math.round(Math.random()*((e||9)-r))}var tn=mh,xh=mr,ph=xh("values",0),St=ph,yh=tn,wh=St;function Eh(r){for(var e,t=[],i=wh(r),s=i.length-1;s>=0;s--)e=s>0?yh(0,s):0,t.push(i[e]),i.splice(e,1);return t}var rn=Eh,Ch=rn;function bh(r,e){var t=Ch(r);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var _h=bh;function Rh(r){return function(e){if(e){var t=r(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var sn=Rh,Ih=sn,Sh=Ih(parseFloat),lt=Sh,ns=lt;function Th(r,e,t){var i=[],s=arguments.length;if(r){if(e=s>=2?ns(e):0,t=s>=3?ns(t):r.length,r.slice)return r.slice(e,t);for(;e<t;e++)i.push(r[e])}return i}var ct=Th,Oh=J;function kh(r,e,t){var i=[];if(r&&e){if(r.filter)return r.filter(e,t);Oh(r,function(s,o){e.call(t,s,o,r)&&i.push(s)})}return i}var Lh=kh,Dh=Ti,$h=Dh("",0,2,!0),Mh=$h,Ah=Ti,Nh=Ah("find",1,3,!0),Bh=Nh,Hh=z,Fh=St;function Kh(r,e,t){if(r){Hh(r)||(r=Fh(r));for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return r[i]}}var Ph=Kh,Yh=Ne;function Vh(r,e,t){if(r){var i,s,o=0,n=null,a=t,c=arguments.length>2,d=Yh(r);if(r.length&&r.reduce)return s=function(){return e.apply(n,arguments)},c?r.reduce(s,a):r.reduce(s);for(c&&(o=1,a=r[d[0]]),i=d.length;o<i;o++)a=e.call(n,a,r[d[o]],o,r);return a}}var Wh=Vh,Xh=z;function zh(r,e,t,i){if(Xh(r)&&r.copyWithin)return r.copyWithin(e,t,i);var s,o,n=e>>0,a=t>>0,c=r.length,d=arguments.length>3?i>>0:c;if(n<c&&(n=n>=0?n:c+n,n>=0&&(a=a>=0?a:c+a,d=d>=0?d:c+d,a<d)))for(s=0,o=r.slice(a,d);n<c&&!(o.length<=s);n++)r[n]=o[s++];return r}var Gh=zh,Uh=z;function qh(r,e){var t,i=[],s=e>>0||1;if(Uh(r))if(s>=0&&r.length>s)for(t=0;t<r.length;)i.push(r.slice(t,t+s)),t+=s;else i=r.length?[r]:r;return i}var Zh=qh,Jh=at,Qh=_t;function jh(r,e){return Jh(r,Qh(e))}var on=jh,ed=ie,as=He,td=Yt,id=te;function rd(r){return function(e,t){if(e&&e.length){var i,s;return id(e,function(o,n){t&&(o=ed(t)?t(o,n,e):td(o,t)),!as(o)&&(as(i)||r(i,o))&&(s=n,i=o)}),e[s]}return i}}var nn=rd,sd=nn,od=sd(function(r,e){return r<e}),an=od,nd=on,ad=an;function ld(r){var e,t,i,s=[];if(r&&r.length)for(e=0,t=ad(r,function(o){return o?o.length:0}),i=t?t.length:0;e<i;e++)s.push(nd(r,e));return s}var ln=ld,cd=ln;function hd(){return cd(arguments)}var dd=hd,ud=St,fd=J;function gd(r,e){var t={};return e=e||[],fd(ud(r),function(i,s){t[i]=e[s]}),t}var vd=gd,cn=z,md=te;function hn(r,e){var t=[];return md(r,function(i){t=t.concat(cn(i)?e?hn(i,e):i:[i])}),t}function xd(r,e){return cn(r)?hn(r,e):[]}var pd=xd,yd=at,wd=z;function Ed(r,e){for(var t=0,i=e.length;r&&t<i;)r=r[e[t++]];return i&&r?r:0}function Cd(r,e){for(var t,i=arguments,s=[],o=[],n=2,a=i.length;n<a;n++)s.push(i[n]);if(wd(e)){for(a=e.length-1,n=0;n<a;n++)o.push(e[n]);e=e[a]}return yd(r,function(c){if(o.length&&(c=Ed(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var bd=Cd;function _d(r,e){return(console[r]||console.log)(e)}var Rd=_d;function Id(r,e){try{delete r[e]}catch{r[e]=void 0}}var dn=Id,Sd=z,Td=pr,Od=zo;function kd(r,e,t){return r&&(Sd(r)?Td:Od)(r,e,t)}var un=kd,Ld=bt,Dd=Ld("object"),Oi=Dd,$d=dn,Md=Rt,Ad=Oi,Nd=z,Bd=Be,Hd=ce,Fd=Pt;function Kd(r,e,t){if(r){var i,s=arguments.length>1&&(Bd(e)||!Ad(e)),o=s?t:e;if(Md(r))Fd(r,s?function(n,a){r[a]=e}:function(n,a){$d(r,a)}),o&&Hd(r,o);else if(Nd(r)){if(s)for(i=r.length;i>0;)i--,r[i]=e;else r.length=0;o&&r.push.apply(r,o)}}return r}var fn=Kd,Pd=dn,Yd=ie,Vd=z,Wd=J,Xd=te,zd=un,Gd=fn,Ud=He;function qd(r){return function(e,t){return t===r}}function Zd(r,e,t){if(r){if(!Ud(e)){var i=[],s=[];return Yd(e)||(e=qd(e)),Wd(r,function(o,n,a){e.call(t,o,n,a)&&i.push(n)}),Vd(r)?zd(i,function(o,n){s.push(r[o]),r.splice(o,1)}):(s={},Xd(i,function(o){s[o]=r[o],Pd(r,o)})),s}return Gd(r)}return r}var gn=Zd,Jd=Le,ls=Rd,Qd=Er,jd=xr,eu=He,lr=J,tu=gn,iu=ce;function ru(r,e){lr(r,function(t){t[e]&&!t[e].length&&tu(t,e)})}function su(r,e){var t=iu({},Jd.treeOptions,e),i=t.strict,s=t.key,o=t.parentKey,n=t.children,a=t.mapChildren,c=t.sortKey,d=t.reverse,f=t.data,u=[],g={},m={},x,v,p;return c&&(r=Qd(jd(r),c),d&&(r=r.reverse())),lr(r,function(E){x=E[s],m[x]&&ls("warn","Duplicate primary key="+x),m[x]=!0}),lr(r,function(E){x=E[s],f?(v={},v[f]=E):v=E,p=E[o],g[x]=g[x]||[],v[s]=x,v[o]=p,x===p&&(p=null,ls("warn","Error infinite Loop. key="+x+" parentKey="+x)),g[p]=g[p]||[],g[p].push(v),v[n]=g[x],a&&(v[a]=g[x]),(!i||i&&eu(p))&&(m[p]||u.push(v))}),i&&ru(r,n),u}var ou=su,nu=Le,au=te,lu=ce;function vn(r,e,t,i){var s=i.key,o=i.parentKey,n=i.children,a=i.data,c=i.updated,d=i.clear;return au(t,function(f){var u=f[n];a&&(f=f[a]),c!==!1&&(f[o]=e?e[s]:null),r.push(f),u&&u.length&&vn(r,f,u,i),d&&delete f[n]}),r}function cu(r,e){return vn([],null,r,lu({},nu.treeOptions,e))}var hu=cu;function du(r){return function(e,t,i,s){var o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)}}var ki=du,uu=ki;function mn(r,e,t,i,s,o,n,a){if(e){var c,d,f,u,g,m;for(d=0,f=e.length;d<f;d++){if(c=e[d],u=s.concat([""+d]),g=o.concat([c]),t.call(i,c,d,e,u,r,g))return{index:d,item:c,path:u,items:e,parent:r,nodes:g};if(n&&c&&(m=mn(c,c[n],t,i,u.concat([n]),g,n),m))return m}}}var fu=uu(mn),gu=fu,vu=ki,mu=J;function xn(r,e,t,i,s,o,n,a){var c,d;mu(e,function(f,u){c=s.concat([""+u]),d=o.concat([f]),t.call(i,f,u,e,c,r,d),f&&n&&(c.push(n),xn(f,f[n],t,i,c,d,n))})}var xu=vu(xn),pn=xu,pu=ki,yu=at;function yn(r,e,t,i,s,o,n,a){var c,d,f,u=a.mapChildren||n;return yu(e,function(g,m){return c=s.concat([""+m]),d=o.concat([g]),f=t.call(i,g,m,e,c,r,d),f&&g&&n&&g[n]&&(f[u]=yn(g,g[n],t,i,c,d,n,a)),f})}var wu=pu(yn),Eu=wu,Cu=pn;function bu(r,e,t,i){var s=[];return r&&e&&Cu(r,function(o,n,a,c,d,f){e.call(i,o,n,a,c,d,f)&&s.push(o)},t),s}var _u=bu,Ru=ki,Iu=te,Su=ce;function wn(r,e,t,i,s,o,n,a,c){var d,f,u,g,m,x=[],v=c.original,p=c.data,E=c.mapChildren||a,C=c.isEvery;return Iu(t,function(w,b){d=o.concat([""+b]),f=n.concat([w]),g=r&&!C||i.call(s,w,b,t,d,e,f),m=a&&w[a],g||m?(v?u=w:(u=Su({},w),p&&(u[p]=w)),u[E]=wn(g,w,w[a],i,s,d,f,a,c),(g||u[E].length)&&x.push(u)):g&&x.push(u)}),x}var Tu=Ru(function(r,e,t,i,s,o,n,a){return wn(0,r,e,t,i,s,o,n,a)}),Ou=Tu;function ku(r,e){if(r.indexOf)return r.indexOf(e);for(var t=0,i=r.length;t<i;t++)if(e===r[t])return t}var En=ku;function Lu(r,e){if(r.lastIndexOf)return r.lastIndexOf(e);for(var t=r.length-1;t>=0;t--)if(e===r[t])return t;return-1}var Cn=Lu,Du=bt,$u=Du("number"),$e=$u,Mu=$e;function Au(r){return Mu(r)&&isNaN(r)}var Nu=Au,Bu=bt,Hu=Bu("string"),Fe=Hu,Fu=Kt,Ku=Fu("Date"),Ge=Ku,Pu=parseInt,Vt=Pu;function Yu(r){return Date.UTC(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}var Vu=Yu;function Wu(r){return r.getTime()}var fe=Wu,xi=Vt,cs=Vu,Xu=fe,zu=Fe,Gu=Ge;function Wt(r){return"(\\d{"+r+"})"}function Uu(r){return r<10?r*100:r<100?r*10:r}function hs(r){return isNaN(r)?r:xi(r)}var gt=Wt(2),mt=Wt("1,2"),bn=Wt("1,7"),_n=Wt("3,4"),Rn=".{1}",Dt=Rn+mt,In="(([zZ])|([-+]\\d{2}:?\\d{2}))",ds=[_n,Dt,Dt,Dt,Dt,Dt,Rn+bn,In],cr=[];for(var Gi=ds.length-1;Gi>=0;Gi--){for(var us="",rt=0;rt<Gi+1;rt++)us+=ds[rt];cr.push(new RegExp("^"+us+"$"))}function qu(r){for(var e,t={},i=0,s=cr.length;i<s;i++)if(e=r.match(cr[i]),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 fs=[["yyyy",_n],["yy",gt],["MM",gt],["M",mt],["dd",gt],["d",mt],["HH",gt],["H",mt],["mm",gt],["m",mt],["ss",gt],["s",mt],["SSS",Wt(3)],["S",bn],["Z",In]],Sn={},Tn=["\\[([^\\]]+)\\]"];for(var rt=0;rt<fs.length;rt++){var Ui=fs[rt];Sn[Ui[0]]=Ui[1]+"?",Tn.push(Ui[0])}var Zu=new RegExp(Tn.join("|"),"g"),gs={};function Ju(r,e){var t=gs[e];if(!t){var i=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Zu,function(f,u){var g=f.charAt(0);return g==="["?u:(i.push(g),Sn[f])});t=gs[e]={_i:i,_r:new RegExp(s)}}var o={},n=r.match(t._r);if(n){for(var a=t._i,c=1,d=n.length;c<d;c++)o[a[c-1]]=n[c];return o}return o}function Qu(r){if(/^[zZ]/.test(r.Z))return new Date(cs(r));var e=r.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(cs(r)-(e[1]==="-"?-1:1)*xi(e[2])*36e5+xi(e[3])*6e4):new Date("")}function ju(r,e){if(r){var t=Gu(r);if(t||!e&&/^[0-9]{11,15}$/.test(r))return new Date(t?Xu(r):xi(r));if(zu(r)){var i=e?Ju(r,e):qu(r);if(i.y)return i.M&&(i.M=hs(i.M)-1),i.S&&(i.S=Uu(hs(i.S.substring(0,3)))),i.Z?Qu(i):new Date(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}}return new Date("")}var re=ju;function ef(){return new Date}var Li=ef,tf=Ge,rf=re,sf=Li;function of(r){var e,t=r?rf(r):sf();return tf(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var On=of,nf=z,af=be;function lf(r,e,t){if(r){if(nf(r))for(var i=0,s=r.length;i<s&&e.call(t,r[i],i,r)!==!1;i++);else for(var o in r)if(af(r,o)&&e.call(t,r[o],o,r)===!1)break}}var cf=lf,hf=z,df=be;function uf(r,e,t){if(r){var i,s;if(hf(r))for(i=r.length-1;i>=0&&e.call(t,r[i],i,r)!==!1;i--);else for(s=df(r),i=s.length-1;i>=0&&e.call(t,r[s[i]],s[i],r)!==!1;i--);}}var ff=uf,gf=z,vf=Fe,mf=be;function xf(r,e){return function(t,i){if(t){if(t[r])return t[r](i);if(vf(t)||gf(t))return e(t,i);for(var s in t)if(mf(t,s)&&i===t[s])return s}return-1}}var kn=xf,pf=kn,yf=En,wf=pf("indexOf",yf),Ef=wf,Cf=kn,bf=Cn,_f=Cf("lastIndexOf",bf),Ln=_f,Rf=z,If=Fe,Sf=J;function Tf(r){var e=0;return If(r)||Rf(r)?r.length:(Sf(r,function(){e++}),e)}var Dn=Tf,Of=$e;function kf(r){return Of(r)&&isFinite(r)}var Lf=kf,Df=z,$f=Be,Mf=function(r){return!$f(r)&&!isNaN(r)&&!Df(r)&&r%1===0},$n=Mf,Af=z,Nf=$n,Bf=Be;function Hf(r){return!Bf(r)&&!isNaN(r)&&!Af(r)&&!Nf(r)}var Ff=Hf,Kf=bt,Pf=Kf("boolean"),Mn=Pf,Yf=Kt,Vf=Yf("RegExp"),Cr=Vf,Wf=Kt,Xf=Wf("Error"),An=Xf;function zf(r){return r?r.constructor===TypeError:!1}var Gf=zf;function Uf(r){for(var e in r)return!1;return!0}var Nn=Uf,qf=_e,Zf=typeof Symbol!==qf;function Jf(r){return Zf&&Symbol.isSymbol?Symbol.isSymbol(r):typeof r=="symbol"}var Bn=Jf,Qf=Kt,jf=Qf("Arguments"),eg=jf,tg=Fe,ig=$e;function rg(r){return!!(r&&tg(r.nodeName)&&ig(r.nodeType))}var sg=rg,og=_e,ng=typeof document===og?0:document,br=ng,ag=br;function lg(r){return!!(r&&ag&&r.nodeType===9)}var cg=lg,hg=_e,dg=typeof window===hg?0:window,Hn=dg,ug=Hn;function fg(r){return!!(ug&&(r&&r===r.window))}var gg=fg,vg=_e,mg=typeof FormData!==vg;function xg(r){return mg&&r instanceof FormData}var pg=xg,yg=_e,wg=typeof Map!==yg;function Eg(r){return wg&&r instanceof Map}var Cg=Eg,bg=_e,_g=typeof WeakMap!==bg;function Rg(r){return _g&&r instanceof WeakMap}var Ig=Rg,Sg=_e,Tg=typeof Set!==Sg;function Og(r){return Tg&&r instanceof Set}var kg=Og,Lg=_e,Dg=typeof WeakSet!==Lg;function $g(r){return Dg&&r instanceof WeakSet}var Mg=$g,Ag=ie,Ng=Fe,Bg=z,Hg=be;function Fg(r){return function(e,t,i){if(e&&Ag(t)){if(Bg(e)||Ng(e))return r(e,t,i);for(var s in e)if(Hg(e,s)&&t.call(i,e[s],s,e))return s}return-1}}var Fn=Fg,Kg=Fn,Pg=Kg(function(r,e,t){for(var i=0,s=r.length;i<s;i++)if(e.call(t,r[i],i,r))return i;return-1}),_r=Pg,vs=$e,ms=z,xs=Fe,Yg=Cr,Vg=Ge,Wg=Mn,Xg=De,ps=Ne,zg=Zo;function Kn(r,e,t,i,s,o,n){if(r===e)return!0;if(r&&e&&!vs(r)&&!vs(e)&&!xs(r)&&!xs(e)){if(Yg(r))return t(""+r,""+e,s,o,n);if(Vg(r)||Wg(r))return t(+r,+e,s,o,n);var a,c,d,f=ms(r),u=ms(e);if(f||u?f&&u:r.constructor===e.constructor)return c=ps(r),d=ps(e),i&&(a=i(r,e,s)),c.length===d.length?Xg(a)?zg(c,function(g,m){return g===d[m]&&Kn(r[g],e[d[m]],t,i,f||u?m:g,r,e)}):!!a:!1}return t(r,e,s,o,n)}var Pn=Kn;function Gg(r,e){return r===e}var Yn=Gg,Ug=Pn,qg=Yn;function Zg(r,e){return Ug(r,e,qg)}var Vn=Zg,ys=Ne,Jg=_r,ws=Vn,Qg=qo,jg=Jo;function ev(r,e){var t=ys(r),i=ys(e);if(i.length){if(jg(t,i))return Qg(i,function(s){return Jg(t,function(o){return o===s&&ws(r[o],e[s])})>-1})}else return!0;return ws(r,e)}var tv=ev,Es=Pn,Cs=Yn,iv=ie,rv=De;function sv(r,e,t){return iv(t)?Es(r,e,function(i,s,o,n,a){var c=t(i,s,o,n,a);return rv(c)?Cs(i,s):!!c},t):Es(r,e,Cs)}var ov=sv,nv=Bn,av=Ge,lv=z,cv=Cr,hv=An,dv=Be;function uv(r){return dv(r)?"null":nv(r)?"symbol":av(r)?"date":lv(r)?"array":cv(r)?"regexp":hv(r)?"error":typeof r}var fv=uv,gv=Le,vv=He;function mv(r){return""+(vv(r)?"":r)+gv.keyId++}var xv=mv,pv=Fn,yv=pv(function(r,e,t){for(var i=r.length-1;i>=0;i--)if(e.call(t,r[i],i,r))return i;return-1}),wv=yv,Ev=Rt,Cv=Fe;function bv(r){if(Ev(r))return r;if(Cv(r))try{return JSON.parse(r)}catch{}return{}}var _v=bv,Rv=He;function Iv(r){return Rv(r)?"":JSON.stringify(r)}var Sv=Iv,Tv=mr,Ov=Tv("entries",2),kv=Ov,Lv=ie,Dv=z,$v=J,Mv=_r;function Av(r,e){return function(t,i){var s,o,n={},a=[],c=this,d=arguments,f=d.length;if(!Lv(i)){for(o=1;o<f;o++)s=d[o],a.push.apply(a,Dv(s)?s:[s]);i=0}return $v(t,function(u,g){((i?i.call(c,u,g,t):Mv(a,function(m){return m===g})>-1)?r:e)&&(n[g]=u)}),n}}var Wn=Av,Nv=Wn,Bv=Nv(1,0),Hv=Bv,Fv=Wn,Kv=Fv(0,1),Pv=Kv,Yv=St;function Vv(r){return Yv(r)[0]}var Wv=Vv,Xv=St;function zv(r){var e=Xv(r);return e[e.length-1]}var Gv=zv,Uv=jo,qv=wr,oi=be;function Zv(r,e){if(r){if(oi(r,e))return!0;var t,i,s,o,n,a,c=qv(e),d=0,f=c.length;for(n=r;d<f&&(a=!1,t=c[d],o=t?t.match(Uv):"",o?(i=o[1],s=o[2],i?n[i]&&oi(n[i],s)&&(a=!0,n=n[i][s]):oi(n,s)&&(a=!0,n=n[s])):oi(n,t)&&(a=!0,n=n[t]),a);d++)if(d===f-1)return!0}return!1}var Jv=Zv,bs=Vt,Qv=wr,jv=Go,em=be,_s=/(.+)?\[(\d+)\]$/;function tm(r,e,t,i,s){if(r[e])t&&(r[e]=s);else{var o,n,a=e?e.match(_s):null;if(t)n=s;else{var c=i?i.match(_s):null;c&&!c[1]?n=new Array(bs(c[2])+1):n={}}return a?a[1]?(o=bs(a[2]),r[a[1]]?t?r[a[1]][o]=n:r[a[1]][o]?n=r[a[1]][o]:r[a[1]][o]=n:(r[a[1]]=new Array(o+1),r[a[1]][o]=n)):r[a[2]]=n:r[e]=n,n}return r[e]}function im(r,e,t){if(r&&jv(e)){if((r[e]||em(r,e))&&!Rs(e))r[e]=t;else for(var i=r,s=Qv(e),o=s.length,n=0;n<o;n++)if(!Rs(s[n])){var a=n===o-1;i=tm(i,s[n],a,a?null:s[n+1],t)}}return r}function Rs(r){return r==="__proto__"||r==="constructor"||r==="prototype"}var rm=im,sm=Nn,om=Oi,nm=ie,am=_t,lm=J;function cm(r){return function(){return sm(r)}}function hm(r,e,t){var i,s={};return r&&(e&&om(e)?e=cm(e):nm(e)||(e=am(e)),lm(r,function(o,n){i=e?e.call(t,o,n,r):o,s[i]?s[i].push(o):s[i]=[o]})),s}var Xn=hm,dm=Xn,um=Pt;function fm(r,e,t){var i=dm(r,e,t||this);return um(i,function(s,o){i[o]=s.length}),i}var gm=fm;function vm(r,e,t){var i,s,o=[],n=arguments;if(n.length<2&&(e=n[0],r=0),i=r>>0,s=e>>0,i<e)for(t=t>>0||1;i<s;i+=t)o.push(i);return o}var zn=vm,Is=Ne,mm=ct,xm=It,pm=te,ym=ce;function wm(r,e){if(r&&e){var t=ym.apply(this,[{}].concat(mm(arguments,1))),i=Is(t);pm(Is(r),function(s){xm(i,s)&&(r[s]=t[s])})}return r}var Em=wm,Cm=nn,bm=Cm(function(r,e){return r>e}),_m=bm;function Rm(r){return(r.split(".")[1]||"").length}var Di=Rm,Im=Vt;function Sm(r,e){if(r.repeat)return r.repeat(e);var t=isNaN(e)?[]:new Array(Im(e));return t.join(r)+(t.length>0?r:"")}var Xt=Sm;function Tm(r,e){return r.substring(0,e)+"."+r.substring(e,r.length)}var Gn=Tm,ni=Xt,qi=Gn;function Om(r){var e=""+r,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var i=r<0,s=i?"-":"",o=t[3]||"",n=t[5]||"",a=t[6]||"",c=t[7],d=t[8],f=d-a.length,u=d-o.length,g=d-n.length;return c==="+"?o?s+o+ni("0",d):f>0?s+n+a+ni("0",f):s+n+qi(a,d):o?u>0?s+"0."+ni("0",Math.abs(u))+o:s+qi(o,u):g>0?s+"0."+ni("0",Math.abs(g))+n+a:s+qi(n,g)+a}return e}var Ue=Om,Ss=Di,Ts=Ue;function km(r,e){var t=Ts(r),i=Ts(e);return parseInt(t.replace(".",""))*parseInt(i.replace(".",""))/Math.pow(10,Ss(t)+Ss(i))}var Un=km,Lm=Un,Os=lt,Dm=Ue;function $m(r){return function(e,t){var i=Os(e),s=i;if(i){t=t>>0;var o=Dm(i),n=o.split("."),a=n[0],c=n[1]||"",d=c.substring(0,t+1),f=a+(d?"."+d:"");if(t>=c.length)return Os(f);if(f=i,t>0){var u=Math.pow(10,t);s=Math[r](Lm(f,u))/u}else s=Math[r](f)}return s}}var Rr=$m,Mm=Rr,Am=Mm("round"),Ir=Am,Nm=Rr,Bm=Nm("ceil"),qn=Bm,Hm=Rr,Fm=Hm("floor"),Zn=Fm,Km=He,Pm=$e,Ym=Ue;function Vm(r){return Pm(r)?Ym(r):""+(Km(r)?"":r)}var se=Vm,Wm=Ir,Xm=se,zm=Xt,Gm=Gn;function Um(r,e){e=e>>0;var t=Xm(Wm(r,e)),i=t.split("."),s=i[0],o=i[1]||"",n=e-o.length;return e?n>0?s+"."+o+zm("0",n):s+Gm(o,Math.abs(n)):s}var Sr=Um,qm=Le,Zm=Ir,Jm=qn,Qm=Zn,jm=$e,ex=se,tx=Sr,ix=Ue,rx=ce;function sx(r,e){var t=rx({},qm.commafyOptions,e),i=t.digits,s=jm(r),o,n,a,c,d;return s?(o=(t.ceil?Jm:t.floor?Qm:Zm)(r,i),n=ix(i?tx(o,i):o).split("."),c=n[0],d=n[1],a=c&&o<0,a&&(c=c.substring(1,c.length))):(o=ex(r).replace(/,/g,""),n=o?[o]:[],c=n[0]),n.length?(a?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var ox=sx,nx=Vt,ax=sn,lx=ax(nx),cx=lx,hx=Un,ks=lt;function dx(r,e){var t=ks(r),i=ks(e);return hx(t,i)}var Tr=dx,Ls=Di,Ds=Ue,$s=Tr;function ux(r,e){var t=Ds(r),i=Ds(e),s=Math.pow(10,Math.max(Ls(t),Ls(i)));return($s(r,s)+$s(e,s))/s}var Jn=ux,fx=Jn,Ms=lt;function gx(r,e){return fx(Ms(r),Ms(e))}var vx=gx,As=Di,Ns=Ue,Bs=lt,mx=Sr;function xx(r,e){var t=Bs(r),i=Bs(e),s=Ns(t),o=Ns(i),n=As(s),a=As(o),c=Math.pow(10,Math.max(n,a)),d=n>=a?n:a;return parseFloat(mx((t*c-i*c)/c,d))}var px=xx,Hs=Di,Fs=Ue,yx=Tr;function wx(r,e){var t=Fs(r),i=Fs(e),s=Hs(t),o=Hs(i),n=o-s,a=n<0,c=Math.pow(10,a?Math.abs(n):n);return yx(t.replace(".","")/i.replace(".",""),a?1/c:c)}var Qn=wx,Ex=Qn,Ks=lt;function Cx(r,e){return Ex(Ks(r),Ks(e))}var bx=Cx,Zi=Jn,_x=ie,Rx=z,Ix=J,Sx=Yt;function Tx(r,e,t){var i=0;return Ix(r&&r.length>2&&Rx(r)?r.sort():r,e?_x(e)?function(){i=Zi(i,e.apply(t,arguments))}:function(s){i=Zi(i,Sx(s,e))}:function(s){i=Zi(i,s)}),i}var jn=Tx,Ox=Qn,kx=Dn,Lx=jn;function Dx(r,e,t){return Ox(Lx(r,e,t),kx(r))}var $x=Dx,Mx="first",zt=Mx,Ax="last",$i=Ax;function Nx(r){return r.getFullYear()}var Gt=Nx,Bx=864e5,Tt=Bx;function Hx(r){return r.getMonth()}var Mi=Hx,Fx=Ge,Kx=fe;function Px(r){return Fx(r)&&!isNaN(Kx(r))}var ge=Px,Ps=zt,Yx=$i,Vx=Tt,Wx=Gt,Ys=fe,Vs=Mi,Xx=re,zx=ge,Gx=$e;function ea(r,e,t){var i=e&&!isNaN(e)?e:0;if(r=Xx(r),zx(r)){if(t===Ps)return new Date(Wx(r),Vs(r)+i,1);if(t===Yx)return new Date(Ys(ea(r,i+1,Ps))-1);if(Gx(t)&&r.setDate(t),i){var s=r.getDate();if(r.setMonth(Vs(r)+i),s!==r.getDate())return r.setDate(1),new Date(Ys(r)-Vx)}}return r}var Ut=ea,Ux=zt,Ws=$i,Xs=Gt,qx=Ut,Zx=re,Jx=ge;function Qx(r,e,t){var i;if(r=Zx(r),Jx(r)&&(e&&(i=e&&!isNaN(e)?e:0,r.setFullYear(Xs(r)+i)),t||!isNaN(t))){if(t===Ux)return new Date(Xs(r),0,1);if(t===Ws)return r.setMonth(11),qx(r,0,Ws);r.setMonth(t)}return r}var Ai=Qx,jx=Ut,ep=re,tp=ge;function ip(r){var e=r.getMonth();return e<3?1:e<6?2:e<9?3:4}function rp(r,e,t){var i,s=e&&!isNaN(e)?e*3:0;return r=ep(r),tp(r)?(i=(ip(r)-1)*3,r.setMonth(i),jx(r,s,t)):r}var sp=rp,zs=zt,op=$i,np=Vt,ap=Gt,lp=Mi,cp=fe,hp=re,dp=ge;function ta(r,e,t){if(r=hp(r),dp(r)&&!isNaN(e)){if(r.setDate(r.getDate()+np(e)),t===zs)return new Date(ap(r),lp(r),r.getDate());if(t===op)return new Date(cp(ta(r,1,zs))-1)}return r}var ia=ta;function up(r){return r.toUpperCase()}var ra=up,fp=Tt,gp=fp*7,sa=gp,vp=Le,Ji=Tt,mp=sa,xp=fe,pp=re,yp=ge,Gs=$e;function wp(r,e,t,i){if(r=pp(r),yp(r)){var s=Gs(t),o=Gs(i),n=xp(r);if(s||o){var a=o?i:vp.firstDayOfWeek,c=r.getDay(),d=s?t:c;if(c!==d){var f=0;a>c?f=-(7-a+c):a<c&&(f=a-c),d>a?n+=((d===0?7:d)-a+f)*Ji:d<a?n+=(7-a+d+f)*Ji:n+=f*Ji}}return e&&!isNaN(e)&&(n+=e*mp),new Date(n)}return r}var oa=wp,Ep=Le,ai=Tt,Cp=sa,bp=$e,_p=It,Rp=re,Ip=ge,Us=oa,Sp=zn,Tp=at,li=fe,Op=Tp(Sp(0,7),function(r){return[(r+1)%7,(r+2)%7,(r+3)%7]});function qs(r,e){var t=new Date(r).getDay();return _p(Op[e],t)}function kp(r,e){return function(t,i){var s=bp(i)?i:Ep.firstDayOfWeek,o=Rp(t);if(Ip(o)){var n=Us(o,0,s,s),a=r(n),c=li(a),d=li(n),f=d+ai*6,u=new Date(f),g=Us(a,0,s,s),m=li(g),x;if(d===m)return 1;if(e(n,u)){for(x=li(r(u));x<f;x+=ai)if(qs(x,s))return 1}var v=m+ai*6,p=new Date(f),E=1;if(e(g,p)){for(E=0,x=c;x<v;x+=ai)if(qs(x,s)){E++;break}}return Math.floor((d-m)/Cp)+E}return NaN}}var na=kp,Lp=na,Dp=Lp(function(r){return new Date(r.getFullYear(),0,1)},function(r,e){return r.getFullYear()!==e.getFullYear()}),aa=Dp,$p=Gt,Mp=Mi;function Ap(r){return new Date($p(r),Mp(r),r.getDate())}var Np=Ap,Bp=fe,Hp=Np;function Fp(r){return Bp(Hp(r))}var Kp=Fp,Pp=Tt,Yp=zt,Zs=Kp,Vp=Ai,Wp=re,Xp=ge;function zp(r){return r=Wp(r),Xp(r)?Math.floor((Zs(r)-Zs(Vp(r,0,Yp)))/Pp)+1:NaN}var la=zp,Gp=se,Up=De,qp=Xt;function Zp(r,e,t){var i=Gp(r);return e=e>>0,t=Up(t)?" ":""+t,i.padStart?i.padStart(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=qp(t,e/t.length)),t.slice(0,e)+i):i}var ca=Zp,$t=Le,Jp=ra,Qp=Gt,Js=Mi,jp=re,e0=aa,t0=la,i0=ce,r0=ge,s0=ie,Se=ca;function Pe(r,e,t,i){var s=e[t];return s?s0(s)?s(i,t,r):s[i]:i}var o0=/\[([^\]]+)]|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 n0(r,e,t){if(r){if(r=jp(r),r0(r)){var i=e||$t.parseDateFormat||$t.formatString,s=r.getHours(),o=s<12?"am":"pm",n=i0({},$t.parseDateRules||$t.formatStringMatchs,t?t.formats:null),a=function(w,b){return(""+Qp(r)).substr(4-b)},c=function(w,b){return Se(Js(r)+1,b,"0")},d=function(w,b){return Se(r.getDate(),b,"0")},f=function(w,b){return Se(s,b,"0")},u=function(w,b){return Se(s<=12?s:s-12,b,"0")},g=function(w,b){return Se(r.getMinutes(),b,"0")},m=function(w,b){return Se(r.getSeconds(),b,"0")},x=function(w,b){return Se(r.getMilliseconds(),b,"0")},v=function(w,b){var T=r.getTimezoneOffset()/60*-1;return Pe(r,n,w,(T>=0?"+":"-")+Se(T,2,"0")+(b===1?":":"")+"00")},p=function(w,b){return Se(Pe(r,n,w,e0(r,(t?t.firstDay:null)||$t.firstDayOfWeek)),b,"0")},E=function(w,b){return Se(Pe(r,n,w,t0(r)),b,"0")},C={yyyy:a,yy:a,MM:c,M:c,dd:d,d,HH:f,H:f,hh:u,h:u,mm:g,m:g,ss:m,s:m,SSS:x,S:x,ZZ:v,Z:v,WW:p,W:p,DDD:E,D:E,a:function(w){return Pe(r,n,w,o)},A:function(w){return Pe(r,n,w,Jp(o))},e:function(w){return Pe(r,n,w,r.getDay())},E:function(w){return Pe(r,n,w,r.getDay())},q:function(w){return Pe(r,n,w,Math.floor((Js(r)+3)/3))}};return i.replace(o0,function(w,b){return b||(C[w]?C[w](w,w.length):w)})}return"Invalid Date"}return""}var ha=n0,a0=fe,l0=Li,c0=Date.now||function(){return a0(l0())},da=c0,h0=fe,d0=da,u0=re,f0=Ge,g0=function(r,e){if(r){var t=u0(r,e);return f0(t)?h0(t):t}return d0()},v0=g0,Qs=ha;function m0(r,e,t){return r&&e?(r=Qs(r,t),r!=="Invalid Date"&&r===Qs(e,t)):!1}var x0=m0,p0=na,y0=p0(function(r){return new Date(r.getFullYear(),r.getMonth(),1)},function(r,e){return r.getMonth()!==e.getMonth()}),w0=y0,E0=Ai,C0=re,b0=ge,_0=On;function R0(r,e){return r=C0(r),b0(r)?_0(E0(r,e))?366:365:NaN}var I0=R0,S0=Tt,T0=zt,O0=$i,js=fe,eo=Ut,k0=re,L0=ge;function D0(r,e){return r=k0(r),L0(r)?Math.floor((js(eo(r,e,O0))-js(eo(r,e,T0)))/S0)+1:NaN}var $0=D0,to=fe,M0=Li,io=re,ro=ge,so=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function A0(r,e){var t,i,s,o,n,a,c={done:!1,time:0};if(r=io(r),e=e?io(e):M0(),ro(r)&&ro(e)&&(t=to(r),i=to(e),t<i))for(o=c.time=i-t,c.done=!0,a=0,n=so.length;a<n;a++)s=so[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 N0=A0,B0=se,H0=De,F0=Xt;function K0(r,e,t){var i=B0(r);return e=e>>0,t=H0(t)?" ":""+t,i.padEnd?i.padEnd(e,t):e>i.length?(e-=i.length,e>t.length&&(t+=F0(t,e/t.length)),i+t.slice(0,e)):i}var P0=K0,Y0=se,V0=Xt;function W0(r,e){return V0(Y0(r),e)}var X0=W0,z0=se;function G0(r){return r&&r.trimRight?r.trimRight():z0(r).replace(/[\s\uFEFF\xA0]+$/g,"")}var ua=G0,U0=se;function q0(r){return r&&r.trimLeft?r.trimLeft():U0(r).replace(/^[\s\uFEFF\xA0]+/g,"")}var fa=q0,Z0=ua,J0=fa;function Q0(r){return r&&r.trim?r.trim():Z0(J0(r))}var ga=Q0,j0={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},va=j0,e1=se,t1=Ne;function i1(r){var e=new RegExp("(?:"+t1(r).join("|")+")","g");return function(t){return e1(t).replace(e,function(i){return r[i]})}}var ma=i1,r1=va,s1=ma,o1=s1(r1),n1=o1,oo=va,a1=ma,l1=J,xa={};l1(oo,function(r,e){xa[oo[e]]=e});var c1=a1(xa),h1=c1;function d1(r,e,t){return r.substring(e,t)}var pa=d1;function u1(r){return r.toLowerCase()}var ya=u1,f1=se,Ye=pa,Mt=ra,g1=ya,Qi={};function v1(r){if(r=f1(r),Qi[r])return Qi[r];var e=r.length,t=r.replace(/([-]+)/g,function(i,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(i,s,o){var n=s.length;return s=g1(s),o?n>2&&o+n<e?Mt(Ye(s,0,1))+Ye(s,1,n-1)+Mt(Ye(s,n-1,n)):Mt(Ye(s,0,1))+Ye(s,1,n):n>1&&o+n<e?Ye(s,0,n-1)+Mt(Ye(s,n-1,n)):s}).replace(/(-[a-zA-Z])/g,function(i,s){return Mt(Ye(s,1,s.length))}),Qi[r]=t,t}var m1=v1,x1=se,vt=pa,Ve=ya,ji={};function p1(r){if(r=x1(r),ji[r])return ji[r];if(/^[A-Z]+$/.test(r))return Ve(r);var e=r.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,i,s,o){var n=s.length;return n>1?i+"-"+Ve(vt(s,0,n-1))+"-"+Ve(vt(s,n-1,n))+o:Ve(i+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,i,s){var o=i.length;return Ve(vt(i,0,o-1)+"-"+vt(i,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,i,s,o,n){var a=s.length;return a>1&&(i&&(i+="-"),o)?(i||"")+Ve(vt(s,0,a-1))+"-"+Ve(vt(s,a-1,a))+o:(i||"")+(n?"-":"")+Ve(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,i,s){return s&&s+i.length<e.length?"-":""}),ji[r]=e,e}var y1=p1,w1=se;function E1(r,e,t){var i=w1(r);return(arguments.length===1?i:i.substring(t)).indexOf(e)===0}var C1=E1,b1=se;function _1(r,e,t){var i=b1(r),s=arguments.length;return s>1&&(s>2?i.substring(0,t).indexOf(e)===t-1:i.indexOf(e)===i.length-1)}var R1=_1,I1=Le,S1=se,T1=ga,O1=Yt;function k1(r,e,t){return S1(r).replace((t||I1).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(i,s){return O1(e,T1(s))})}var wa=k1,L1=wa;function D1(r,e){return L1(r,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var $1=D1;function M1(){}var A1=M1,no=ct;function N1(r,e){var t=no(arguments,2);return function(){return r.apply(e,no(arguments).concat(t))}}var B1=N1,ao=ct;function H1(r,e){var t=!1,i=null,s=ao(arguments,2);return function(){return t||(i=r.apply(e,ao(arguments).concat(s)),t=!0),i}}var F1=H1,K1=ct;function P1(r,e,t){var i=0,s=[];return function(){var o=arguments;i++,i<=r&&s.push(o[0]),i>=r&&e.apply(t,[s].concat(K1(o)))}}var Y1=P1,V1=ct;function W1(r,e,t){var i=0,s=[];return t=t||this,function(){var o=arguments;i++,i<r&&(s.push(o[0]),e.apply(t,[s].concat(V1(o))))}}var X1=W1,z1=ce;function G1(r,e,t){var i=null,s=null,o=!1,n=null,a=z1({leading:!0,trailing:!0},t),c=a.leading,d=a.trailing,f=function(){i=null,s=null},u=function(){o=!0,r.apply(s,i),n=setTimeout(g,e),f()},g=function(){if(n=null,o){f();return}if(d===!0){u();return}f()},m=function(){var v=n!==null;return v&&clearTimeout(n),f(),n=null,o=!1,v},x=function(){if(i=arguments,s=this,o=!1,n===null&&c===!0){u();return}d===!0&&(n=setTimeout(g,e))};return x.cancel=m,x}var U1=G1,q1=ce;function Z1(r,e,t){var i=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:q1({leading:!1,trailing:!0},t),n=!1,a=null,c=o.leading,d=o.trailing,f=function(){i=null,s=null},u=function(){n=!0,r.apply(s,i),f()},g=function(){if(c===!0&&(a=null),n){f();return}if(d===!0){u();return}f()},m=function(){var v=a!==null;return v&&clearTimeout(a),f(),a=null,n=!1,v},x=function(){n=!1,i=arguments,s=this,a===null?c===!0&&u():clearTimeout(a),a=setTimeout(g,e)};return x.cancel=m,x}var J1=Z1,Q1=ct;function j1(r,e){var t=Q1(arguments,2),i=this;return setTimeout(function(){r.apply(i,t)},e)}var ey=j1,ty=decodeURIComponent,Ea=ty,lo=Ea,iy=te,ry=Fe;function sy(r){var e,t={};return r&&ry(r)&&iy(r.split("&"),function(i){e=i.split("="),t[lo(e[0])]=lo(e[1]||"")}),t}var Ca=sy,oy=encodeURIComponent,ba=oy,pi=ba,_a=J,Ra=z,Ia=Be,ny=De,Sa=Rt;function Ta(r,e,t){var i,s=[];return _a(r,function(o,n){i=Ra(o),Sa(o)||i?s=s.concat(Ta(o,e+"["+n+"]",i)):s.push(pi(e+"["+(t?"":n)+"]")+"="+pi(Ia(o)?"":o))}),s}function ay(r){var e,t=[];return _a(r,function(i,s){ny(i)||(e=Ra(i),Sa(i)||e?t=t.concat(Ta(i,s,e)):t.push(pi(s)+"="+pi(Ia(i)?"":i)))}),t.join("&").replace(/%20/g,"+")}var ly=ay,cy=_e,hy=typeof location===cy?0:location,Ni=hy,ci=Ni;function dy(){return ci?ci.origin||ci.protocol+"//"+ci.host:""}var Oa=dy,co=Ni,uy=Ca,fy=Oa;function ho(r){return uy(r.split("?")[1]||"")}function gy(r){var e,t,i,s,o=""+r;return o.indexOf("//")===0?o=(co?co.protocol:"")+o:o.indexOf("/")===0&&(o=fy()+o),i=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:i&&i[1]&&i[1].length>1?i[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=ho(s.hash),s.searchQuery=ho(s.search),s}var ka=gy,uo=Ni,vy=Oa,my=Ln;function xy(){if(uo){var r=uo.pathname,e=my(r,"/")+1;return vy()+(e===r.length?r:r.substring(0,e))}return""}var py=xy,fo=Ni,yy=ka;function wy(){return fo?yy(fo.href):{}}var Ey=wy,La=Le,er=br,go=Ea,vo=ba,Cy=z,mo=Oi,Da=Ge,by=De,_y=It,Ry=Ne,yi=ce,tr=te,Iy=Li,hi=fe,Sy=Ai,Ty=Ut,Oy=ia;function xo(r,e){var t=parseFloat(e),i=Iy(),s=hi(i);switch(r){case"y":return hi(Sy(i,t));case"M":return hi(Ty(i,t));case"d":return hi(Oy(i,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 ir(r){return(Da(r)?r:new Date(r)).toUTCString()}function Xe(r,e,t){if(er){var i,s,o,n,a,c,d=[],f=arguments;return Cy(r)?d=r:f.length>1?d=[yi({name:r,value:e},t)]:mo(r)&&(d=[r]),d.length>0?(tr(d,function(u){i=yi({},La.cookies,u),o=[],i.name&&(s=i.expires,o.push(vo(i.name)+"="+vo(mo(i.value)?JSON.stringify(i.value):i.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,m,x){return ir(xo(x,m))}):/^[0-9]{11,13}$/.test(s)||Da(s)?s=ir(s):s=ir(xo("d",s)),i.expires=s),tr(["expires","path","domain","secure"],function(g){by(i[g])||o.push(i[g]&&g==="secure"?g:g+"="+i[g])})),er.cookie=o.join("; ")}),!0):(n={},a=er.cookie,a&&tr(a.split("; "),function(u){c=u.indexOf("="),n[go(u.substring(0,c))]=go(u.substring(c+1)||"")}),f.length===1?n[r]:n)}return!1}function ky(r){return _y($a(),r)}function po(r){return Xe(r)}function yo(r,e,t){return Xe(r,e,t),Xe}function wo(r,e){Xe(r,"",yi({expires:-1},La.cookies,e))}function $a(){return Ry(Xe())}function Ly(){return Xe()}yi(Xe,{has:ky,set:yo,setItem:yo,get:po,getItem:po,remove:wo,removeItem:wo,keys:$a,getJSON:Ly});var Dy=Xe,$y=_e,rr=br,sr=Hn,My=ce,Ay=te;function Eo(r){try{var e="__xe_t";return r.setItem(e,1),r.removeItem(e),!0}catch{return!1}}function di(r){return navigator.userAgent.indexOf(r)>-1}function Ny(){var r,e,t,i=!1,s=!1,o=!1,n={isNode:!1,isMobile:i,isPC:!1,isDoc:!!rr};if(!sr&&typeof process!==$y)n.isNode=!0;else{t=di("Edge"),e=di("Chrome"),i=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),n.isDoc&&(r=rr.body||rr.documentElement,Ay(["webkit","khtml","moz","ms","o"],function(a){n["-"+a]=!!r[a+"MatchesSelector"]}));try{s=Eo(sr.localStorage)}catch{}try{o=Eo(sr.sessionStorage)}catch{}My(n,{edge:t,firefox:di("Firefox"),msie:!t&&n["-ms"],safari:!e&&!t&&di("Safari"),isMobile:i,isPC:!i,isLocalStorage:s,isSessionStorage:o})}return n}var By=Ny,Ma=Jl,Co=ce,Hy=Pt,Fy=zo,Ky=cc,Py=mc,Yy=at,Vy=qo,Wy=Zo,Xy=Jo,zy=te,Gy=pr,Uy=Qo,qy=Hc,Zy=yr,Jy=vh,Qy=Er,jy=rn,ew=_h,tw=ct,iw=Lh,rw=Mh,sw=It,ow=Bh,nw=Ph,aw=Wh,lw=Gh,cw=Zh,hw=dd,dw=ln,uw=vd,fw=pd,gw=on,vw=bd,mw=ou,xw=hu,pw=gu,yw=pn,ww=Eu,Ew=_u,Cw=Ou,bw=En,_w=Cn,Rw=be,Iw=z,Sw=Be,Tw=Nu,Ow=De,kw=ie,Lw=Oi,Dw=Fe,$w=Rt,Mw=On,Aw=Ge,Nw=He,Bw=J,Hw=cf,Fw=ff,Kw=Ef,Pw=Ln,Yw=Ne,Vw=St,Ww=xr,Xw=Dn,zw=un,Gw=gn,Uw=fn,qw=Lf,Zw=Ff,Jw=$n,Qw=Mn,jw=$e,eE=Cr,tE=An,iE=Gf,rE=Nn,sE=Bn,oE=eg,nE=sg,aE=cg,lE=gg,cE=pg,hE=Cg,dE=Ig,uE=kg,fE=Mg,gE=tv,vE=Vn,mE=ov,xE=fv,pE=xv,yE=_r,wE=wv,EE=_v,CE=Sv,bE=kv,_E=Hv,RE=Pv,IE=Wv,SE=Gv,TE=Jv,OE=Yt,kE=rm,LE=Xn,DE=gm,$E=zn,ME=Em,AE=tn,NE=an,BE=_m,HE=ox,FE=Ir,KE=qn,PE=Zn,YE=Sr,VE=cx,WE=lt,XE=Ue,zE=vx,GE=px,UE=Tr,qE=bx,ZE=jn,JE=$x,QE=Ai,jE=sp,e2=Ut,t2=ia,i2=re,r2=ha,s2=da,o2=v0,n2=ge,a2=x0,l2=oa,c2=la,h2=aa,d2=w0,u2=I0,f2=$0,g2=N0,v2=P0,m2=ca,x2=X0,p2=ga,y2=ua,w2=fa,E2=n1,C2=h1,b2=m1,_2=y1,R2=C1,I2=R1,S2=wa,T2=$1,bo=se,O2=A1,k2=_t,L2=B1,D2=F1,$2=Y1,M2=X1,A2=U1,N2=J1,B2=ey,H2=Ca,F2=ly,K2=ka,P2=py,Y2=Ey,V2=Dy,W2=By;Co(Ma,{assign:Co,objectEach:Hy,lastObjectEach:Fy,objectMap:Ky,merge:Py,uniq:Uy,union:qy,sortBy:Jy,orderBy:Qy,shuffle:jy,sample:ew,some:Vy,every:Wy,slice:tw,filter:iw,find:ow,findLast:nw,findKey:rw,includes:sw,arrayIndexOf:bw,arrayLastIndexOf:_w,map:Yy,reduce:aw,copyWithin:lw,chunk:cw,zip:hw,unzip:dw,zipObject:uw,flatten:fw,toArray:Zy,includeArrays:Xy,pluck:gw,invoke:vw,arrayEach:zy,lastArrayEach:Gy,toArrayTree:mw,toTreeArray:xw,findTree:pw,eachTree:yw,mapTree:ww,filterTree:Ew,searchTree:Cw,hasOwnProp:Rw,eqNull:Nw,isNaN:Tw,isFinite:qw,isUndefined:Ow,isArray:Iw,isFloat:Zw,isInteger:Jw,isFunction:kw,isBoolean:Qw,isString:Dw,isNumber:jw,isRegExp:eE,isObject:Lw,isPlainObject:$w,isDate:Aw,isError:tE,isTypeError:iE,isEmpty:rE,isNull:Sw,isSymbol:sE,isArguments:oE,isElement:nE,isDocument:aE,isWindow:lE,isFormData:cE,isMap:hE,isWeakMap:dE,isSet:uE,isWeakSet:fE,isLeapYear:Mw,isMatch:gE,isEqual:vE,isEqualWith:mE,getType:xE,uniqueId:pE,getSize:Xw,indexOf:Kw,lastIndexOf:Pw,findIndexOf:yE,findLastIndexOf:wE,toStringJSON:EE,toJSONString:CE,keys:Yw,values:Vw,entries:bE,pick:_E,omit:RE,first:IE,last:SE,each:Bw,forOf:Hw,lastForOf:Fw,lastEach:zw,has:TE,get:OE,set:kE,groupBy:LE,countBy:DE,clone:Ww,clear:Uw,remove:Gw,range:$E,destructuring:ME,random:AE,min:BE,max:NE,commafy:HE,round:FE,ceil:KE,floor:PE,toFixed:YE,toNumber:WE,toNumberString:XE,toInteger:VE,add:zE,subtract:GE,multiply:UE,divide:qE,sum:ZE,mean:JE,now:s2,timestamp:o2,isValidDate:n2,isDateSame:a2,toStringDate:i2,toDateString:r2,getWhatYear:QE,getWhatQuarter:jE,getWhatMonth:e2,getWhatWeek:l2,getWhatDay:t2,getYearDay:c2,getYearWeek:h2,getMonthWeek:d2,getDayOfYear:u2,getDayOfMonth:f2,getDateDiff:g2,trim:p2,trimLeft:w2,trimRight:y2,escape:E2,unescape:C2,camelCase:b2,kebabCase:_2,repeat:x2,padStart:m2,padEnd:v2,startsWith:R2,endsWith:I2,template:S2,toFormatString:T2,toString:bo,toValueString:bo,noop:O2,property:k2,bind:L2,once:D2,after:$2,before:M2,throttle:A2,debounce:N2,delay:B2,unserialize:H2,serialize:F2,parseUrl:K2,getBaseURL:P2,locat:Y2,browse:W2,cookie:V2});var S=Ma,j=[];for(var or=0;or<256;++or)j.push((or+256).toString(16).slice(1));function X2(r,e=0){return(j[r[e+0]]+j[r[e+1]]+j[r[e+2]]+j[r[e+3]]+"-"+j[r[e+4]]+j[r[e+5]]+"-"+j[r[e+6]]+j[r[e+7]]+"-"+j[r[e+8]]+j[r[e+9]]+"-"+j[r[e+10]]+j[r[e+11]]+j[r[e+12]]+j[r[e+13]]+j[r[e+14]]+j[r[e+15]]).toLowerCase()}var ui,z2=new Uint8Array(16);function G2(){if(!ui&&(ui=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!ui))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return ui(z2)}var U2=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const _o={randomUUID:U2};function Ae(r,e,t){if(_o.randomUUID&&!r)return _o.randomUUID();r=r||{};var i=r.random||(r.rng||G2)();return i[6]=i[6]&15|64,i[8]=i[8]&63|128,X2(i)}const q2=r=>r==null||r==="",Z=r=>!q2(r),it=r=>r==null,ue=r=>!it(r),Z2=r=>function(e,t,i,s){const o=i||{},n=o.children||"children";return r(null,e,t,s,[],[],n,o)},Aa=(r,e,t,i,s,o,n)=>{let a,c;e.forEach((d,f)=>{a=s.concat([""+f]),c=o.concat([d]),t.call(i,d,f,e,a,r,c),d&&n&&(a.push(n),Aa(d,d[n]||[],t,i,a,c,n))})},Nt=Z2(Aa),Na={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170,striped:!1},canvasTable:{DISABLED:!0,ENABLE_FINDER:!0,AUTO_ROW_HEIGHT:!0}};let ne=S.clone(Na,!0);function Ba(r){ne={form:{...ne.form,...r.form},grid:{...ne.grid,...r.grid},canvasTable:{...ne.canvasTable,...r.canvasTable}}}function J2(){return ne}function Ro(){var r,e;return{labelCol:(r=ne.form)==null?void 0:r.labelCol,wrapperCol:(e=ne.form)==null?void 0:e.wrapperCol}}function xt(){var r,e,t,i;return{align:(r=ne.grid)==null?void 0:r.align,lazyReset:(e=ne.grid)==null?void 0:e.lazyReset,fitHeight:(t=ne.grid)==null?void 0:t.fitHeight,striped:(i=ne.grid)==null?void 0:i.striped}}function Ha(){return ne.canvasTable||{}}function Q2(){ne=JSON.parse(JSON.stringify(Na))}const Bi=r=>{var e;return{dataIndex:r.field,key:r.field,title:r.title,...S.omit(r,["children","slots","cellRender","formatter"]),children:(e=r.children)==null?void 0:e.map(t=>Bi(t))}},Or={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},kr={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},j2={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}},Fa=r=>{const t=(24-r.reduce((s,o)=>s+o,0))%24,i=t===0?24:t<0?24+t:t;return i>1?i:24},Io=["xxs","xs","sm","md","lg","xl","xxl"],eC=r=>{const e=S.isArray(r)?r:S.isNumber(r)?Array.from({length:r},()=>Or):[];return S.zipObject(Io,Io.map(t=>e.every(i=>Z(i[t]))?Fa(e.map(i=>i[t])):24))};function Lr(r,e,t){const i=l.toValue(r);if(typeof i!="object"||i===null)return l.watch(r,e,t);let s=S.clone(i,!0);return l.watch(r,(o,n,a)=>{e(o,s,a),s=S.clone(o,!0)},t)}const tt="-",pt={toString:({cellValue:r})=>{var e;return r?((e=r.toString)==null?void 0:e.call(r))??tt:tt},formatByOptions:({cellValue:r},e,t=",")=>{if(r==null)return tt;if(S.isArray(r))if(r.length>0){const s=e.filter(o=>r.includes(o.value));return s.length?s.map(o=>o.label).join(t):tt}else return tt;const i=e.find(s=>s.value===r);return i?i.label:tt},formatSex:({cellValue:r})=>Z(r)?S.toNumber(r)===1?"男":"女":tt},tC=(r,{record:e,index:t,column:i,field:s})=>{if(S.isString(r)&&pt[r]){const o=pt[r];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(S.isArray(r)&&pt[r[0]]&&r.length>1){const o=pt[r[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...r.slice(1))}else return S.isFunction(r)?r({row:e,rowIndex:t,cellValue:s?e[s]:null,column:i}):s?e[s]:null},Ka=r=>{Object.assign(pt,r)},iC=l.defineComponent(r=>{const{cellRender:e,renderTableParams:t}=r,{data:i,row:s,field:o,rowIndex:n}=t;return()=>{var a,c;return((c=(a=Bt.renders[e.name])==null?void 0:a.renderDefault)==null?void 0:c.call(a,e,{data:i,row:s,field:o,rowIndex:n},r.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Pa=l.defineComponent(r=>{const{tableData:e,row:t,column:i,rowIndex:s}=r,o=i.field?t[i.field]:null;return()=>{var n,a;return((a=(n=i.slots)==null?void 0:n.default)==null?void 0:a.call(n,{row:t,column:i,rowIndex:s,cellValue:o}))??(i.cellRender?l.createVNode(iC,{cellRender:i.cellRender,defaultHandler:r.defaultHandler,renderTableParams:{data:e,row:t,field:i.field,rowIndex:s}},null):i.formatter?tC(i.formatter,{record:t,index:s,field:i.field,column:i}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),rC={class:"text-right mt-4px"},sC=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(r,{emit:e}){const t=r,i={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>S.merge({},i,t.tableConfig)),o=e,n=l.computed({get:()=>t.modelValue??[],set:u=>{o("update:modelValue",u)}}),a=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:u})=>d(u)}]}}]),c=()=>{n.value=[...n.value,{}]},d=u=>{n.value=n.value.filter((g,m)=>m!==u)},f=l.computed(()=>{let u=0;return a.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+u,u++),!0):!1)});return(u,g)=>{const m=l.resolveComponent("a-form-item-rest"),x=l.resolveComponent("a-table"),v=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(x,l.mergeProps({"data-source":n.value},s.value,{columns:a.value.map(p=>l.unref(Bi)(p))}),l.createSlots({_:2},[f.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:p,record:E,index:C})=>[l.createVNode(m,null,{default:l.withCtx(()=>[f.value.some(w=>p.key&&w.field===p.key)?(l.openBlock(),l.createBlock(l.unref(Pa),{key:C,"row-index":C,"default-handler":{},column:f.value.find(w=>p.key&&w.field===p.key),row:E,"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",rC,[l.createVNode(v,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),ae=r=>{const{icon:e}=r,t=gl;return t[e]?l.createVNode(t[e]):t[e]},At={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:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())},ASelect:{getPopupContainer:r=>r.parentNode,allowClear:!0,showSearch:!0,filterOption:(r,e)=>e.label&&e.label.toLowerCase().includes(r.toLowerCase())}},fi={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},Ya={$input:A.Input,AInput:A.Input,$textarea:A.Textarea,Textarea:A.Textarea,$number:A.InputNumber,AInputNumber:A.InputNumber,$select:A.Select,ASelect:A.Select,$date:A.DatePicker,ADatePicker:A.DatePicker,$range:A.RangePicker,ARangePicker:A.RangePicker,AAutoComplete:A.AutoComplete,$Cascader:A.Cascader,ACascader:A.Cascader,ACheckbox:A.Checkbox,AMentions:A.Mentions,ARate:A.Rate,ASlider:A.Slider,$time:A.TimePicker,ATimePicker:A.TimePicker,ATreeSelect:A.TreeSelect},oC=r=>{const e=Ya[r];return{renderItemContent({props:t={},attrs:i={},events:s={},defaultValue:o},{data:n,field:a}){return ue(o)&&Z(a)&&it(n[a])&&(n[a]=o),a?l.createVNode(e,l.mergeProps({is:r,value:n[a],"onUpdate:value":c=>n[a]=c},i,S.merge({},At[r],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:n,field:a},...c)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderDefault({props:t=At[r]??{},attrs:i={},events:s={},defaultValue:o},{data:n,row:a,field:c}){return ue(o)&&Z(c)&&it(a[c])&&(a[c]=o),c?l.createVNode(e,l.mergeProps({is:r,value:a[c],"onUpdate:value":d=>a[c]=d},i,S.merge({},At[r],t),{onChange:(...d)=>{var f;(f=s.change)==null||f.call(s,{data:n,row:a,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:r},t),null)},renderEdit(t,{props:i=At[r]??{},attrs:s={},events:o={}},n,a){return l.createVNode(e,l.mergeProps({is:r,value:t.value,"onUpdate:value":c=>t.value=c},s,S.merge({},At[r],i),{onBlur:(...c)=>{var d;a==null||a("blur",t.value),(d=o.blur)==null||d.call(o,n,...c)}}),null)}}},Va=(r,e,t)=>{var i,s;return r.dropdowns&&r.dropdowns.length>0&&r.dropdowns.filter(o=>{var n;return!((n=o.hiddenIf)!=null&&n.call(o,e))}).length>0?l.createVNode(A.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>{var o;return l.createVNode(A.Button,l.mergeProps(S.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{icon:r.icon?l.createVNode(ae,{icon:r.icon},null):l.createVNode(ae,{icon:"DownOutlined"},null)},((o=r.getProps)==null?void 0:o.call(r,e))??{}),{default:()=>{var n;return[r.content||(((n=r==null?void 0:r.getContent)==null?void 0:n.call(r,e))??"")]}})},overlay:()=>{var o;return l.createVNode("div",{class:`dropdown-wrapper ${((o=r==null?void 0:r.dynamicClassName)==null?void 0:o.call(r,e))??""}`},[r.dropdowns.filter(n=>{var a;return!((a=n.hiddenIf)!=null&&a.call(n,e))}).map(n=>Va(n,e,t))])}}):l.createVNode(A.Button,l.mergeProps({class:((i=r==null?void 0:r.dynamicClassName)==null?void 0:i.call(r,e))||""},S.omit(r,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns","getProps"]),{disabled:!!r.dropdowns&&r.dropdowns.length>0||r.disabled,icon:r.icon?l.createVNode(ae,{icon:r.icon},null):null},((s=r.getProps)==null?void 0:s.call(r,e))??{},{onClick:()=>{r!=null&&r.clickEvt&&r.clickEvt(e)}}),{default:()=>{var o;return[r.content||(((o=r==null?void 0:r.getContent)==null?void 0:o.call(r,e))??"")]}})},hr={...Object.fromEntries(Object.keys(Ya).map(r=>[r,oC(r)])),$button:{renderItemContent({props:r={},events:e={}},{data:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(S.omit(r,["content"]),{icon:r.icon?l.createVNode(ae,{icon:r.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(n=>{s.reset(n?{data:n,field:i}:{data:t,field:i})}):s.reset({data:t,field:i}))}}),{default:()=>{var o;return[r.content,((o=r.suffix)==null?void 0:o.call(r,{data:t,field:i}))??null]}})},renderDefault({props:r={},events:e={}},{row:t,field:i},s){return l.createVNode(A.Button,l.mergeProps(S.omit(r,["content"]),{icon:r.icon?l.createVNode(ae,{icon:r.icon},null):null,onClick:()=>{var o,n,a;(o=e.click)==null||o.call(e,{row:t,field:i}),r.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.reset(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:i})),r.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),r.beforeClick({row:t,field:i}).then(c=>{s.pick(c?{row:c,field:i}:{row:t,field:i})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:i}))}}),{default:()=>[r.content]})}},$buttons:{renderItemContent({props:r={},children:e=[]},{data:t,field:i},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(A.Button,l.mergeProps(S.omit(Object.assign({},r,o.props),["content"]),{icon:o.props.icon?l.createVNode(ae,{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:i}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(r.beforeClick&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.reset(c?{data:c,field:i}:{data:t,field:i})}):s.reset({data:t,field:i})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?r.beforeClick({data:t,field:i}).then(c=>{s.pick(c?{data:c,field:i}:{data:t,field:i})}):s.pick({data:t,field:i}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:r={},children:e=[]},{data:t,row:i,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:i,field:s}))}).map(n=>l.createVNode(A.Button,l.mergeProps(S.omit(Object.assign({},r,n.props),["content","hiddenIf"]),{icon:n.props.icon?l.createVNode(ae,{icon:n.props.icon},null):null,onClick:()=>{var a,c,d,f;(c=(a=n.events)==null?void 0:a.click)==null||c.call(a,{data:t,row:i,field:s}),n.props.htmlType==="reset"&&(o!=null&&o.reset)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.reset(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.reset({row:i,field:s})),n.props.htmlType==="pick"&&(o!=null&&o.pick)&&(r.beforeClick&&S.isFunction(r.beforeClick)?((f=o==null?void 0:o.setLoadings)==null||f.call(o,!0),r.beforeClick({row:i,field:s}).then(u=>{o.pick(u?{row:u,field:s}:{row:i,field:s})}).finally(()=>{var u;(u=o==null?void 0:o.setLoadings)==null||u.call(o,!1)})):o.pick({row:i,field:s}))}}),{default:()=>[n.props.content]}))])}},ButtonTree:{renderDefault({children:r=[],props:e={}},t){const i=l.ref(null);return l.createVNode("span",{ref:i,class:e.noGap?"align-no-gap-box":"align-gap-box"},[r.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>Va(s,t,()=>{var o,n,a,c;return((c=(a=(n=(o=i.value)==null?void 0:o.parentElement)==null?void 0:n.parentElement)==null?void 0:a.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:r={},events:e={},options:t,defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&it(s[o])&&(s[o]=i),Z(o)?l.createVNode(A.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??t??[],disabled:!!r.disabled,onChange:(...n)=>{var a;(a=e.change)==null||a.call(e,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?l.createVNode(A.RadioGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:r={},events:e={}},{data:t,field:i}){return Z(i)?l.createVNode(A.AutoComplete,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},Object.assign({},{filterOption:fi.autoComplete.filterOption},r),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:i},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},fi.autoComplete.inputProps,r.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:r={},events:e={},defaultValue:t},{data:i,field:s}){return ue(t)&&Z(s)&&it(i[s])&&(i[s]=t),Z(s)?l.createVNode(A.Switch,l.mergeProps({checked:i[s],"onUpdate:checked":o=>i[s]=o},r,{onChange:(...o)=>{var n;(n=e.change)==null||n.call(e,{data:i,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:r={},options:e,events:t={},defaultValue:i},{data:s,field:o}){return ue(i)&&Z(o)&&it(s[o])&&(s[o]=i),Z(o)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":n=>s[o]=n},r,{options:r.options??e??[],onChange:(...n)=>{var a;(a=t.change)==null||a.call(t,{data:s,field:o},...n)}}),null):null},renderDefault({props:r={},options:e},{row:t,field:i}){return Z(i)?l.createVNode(A.CheckboxGroup,l.mergeProps({value:t[i],"onUpdate:value":s=>t[i]=s},r,{options:r.options??e??[]}),null):null}},$paragraph:{renderDefault({props:r={}},{row:e,field:t}){var o;const i={ellipsis:{expandable:!0,rows:3}},s=((o=r.getContent)==null?void 0:o.call(r,{row:e,field:t}))??(Z(t)?e[t]:"");return Z(t)?l.createVNode(A.TypographyParagraph,l.mergeProps(S.merge({},i,S.omit(r,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:r={},handleTrigger:e},{data:t,field:i}){return Z(i)?l.createVNode(sC,{modelValue:t[i],"onUpdate:modelValue":s=>t[i]=s,onTrigger:()=>{e&&S.isFunction(e)&&e(r.cusFields??i)},editColumns:r.editColumns??[],tableConfig:r.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:r={},attrs:e={},defaultValue:t},{data:i,field:s}){const o=r.parse?100:1;if(Z(s)){ue(t)&&it(i[s])&&(i[s]=t);const n=l.computed({get:()=>(i[s]??0)*o,set:a=>{i[s]=(a??0)/o}});return l.createVNode("div",{class:"flex items-center"},[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:n.value,"onUpdate:value":a=>n.value=a},S.merge({},fi.PercentInput,S.omit(r,["info"]))),null)])}else return null},renderDefault({props:r={},attrs:e={}},{row:t,field:i}){const s=r.parse?100:1;if(Z(i)){const o=l.computed({get:()=>(t[i]??0)*s,set:n=>{S.set(t,i,(n??0)/s)}});return[r.info?l.createVNode("span",{class:"pr-4"},[r.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":n=>o.value=n},S.merge({},fi.PercentInput,S.omit(r,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:r={}},{data:e,field:t}){return Z(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null},renderDefault({props:r={}},{row:e,field:t}){return Z(t)?l.createVNode(A.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":i=>e[t]=i},r),null):null}}},Dr=(r,{renderItemContent:e,renderDefault:t,renderEdit:i})=>{hr.hasOwnProperty(r)&&console.warn(`render ${r} already exists, you are trying to override it`),hr[r]={renderItemContent:e,renderDefault:t,renderEdit:i}},Bt={renders:hr,addRender:Dr},nC=l.defineComponent((r,{emit:e})=>{const{itemRender:t,defaultHandler:i}=r,{renderFormParams:s}=l.toRefs(r),o=a=>{e("trigger",a)},n=(a,c)=>{e("delayTrigger",a,c)};return()=>{var a,c;return((c=(a=Bt.renders[t.name])==null?void 0:a.renderItemContent)==null?void 0:c.call(a,{...t,handleTrigger:o,handleDelayTrigger:n},s.value,i))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),aC=l.defineComponent(r=>{const{formData:e}=l.toRefs(r);return()=>{var t,i;return((i=(t=r.item.slots)==null?void 0:t.default)==null?void 0:i.call(t,{data:e.value,field:r.item.field},r.passTrigger,r.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),lC={key:2},cC=["innerHTML"],$r=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(r,{emit:e}){const t=r,i=e,s=l.ref(!1),o=l.ref(Ae()),n=(u,g)=>{const m=g??222;s.value=!0,setTimeout(()=>{s.value=!1,i("trigger",u)},m)},a=u=>{i("trigger",u)},c=()=>{i("reset")},d=()=>{o.value=Ae()},f=S.debounce(d,100);return Lr(()=>t.item,(u,g)=>{S.isEqual(u,g)||f()},{deep:!0}),(u,g)=>{const m=l.resolveComponent("a-tooltip"),x=l.resolveComponent("a-form-item"),v=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(v,l.mergeProps({key:`_col_${o.value}`},u.item.col??(u.item.span?{span:u.item.span}:l.unref(Or))),{default:l.withCtx(()=>{var p;return[(l.openBlock(),l.createBlock(x,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${u.item.align??"left"} ${u.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:u.item.title,name:u.item.field,"wrapper-col":u.item.wrapperCol??(u.item.title?void 0:{span:24})},l.unref(S.omit)(u.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var E,C;return[(E=u.item.slots)!=null&&E.default?(l.openBlock(),l.createBlock(l.unref(aC),{key:`_sl_${u.item.field??"_"}_${o.value}`,"form-data":u.formData,item:u.item,"pass-delay-trigger":n,"pass-trigger":a},null,8,["form-data","item"])):(C=u.item.itemRender)!=null&&C.name?(l.openBlock(),l.createBlock(l.unref(nC),{key:`_re_${u.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":u.item.itemRender,"render-form-params":{data:u.formData,field:u.item.field},onDelayTrigger:n,onTrigger:a},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",lC))]}),_:2},[(p=u.item.slots)!=null&&p.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(u.item.slots.title)))]),key:"0"}:void 0,u.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(S.isFunction)(u.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:0},l.unref(S.omit)(u.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:u.item.tooltipConfig.title()},null,8,cC)]),default:l.withCtx(()=>[l.createVNode(l.unref(wt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(m,l.normalizeProps(l.mergeProps({key:1},u.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(wt.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),hC={key:0,class:"p-pane p-wrapper"},Mr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{},layout:{},labelCol:{default:()=>Ro().labelCol??{span:6}},wrapperCol:{default:()=>Ro().wrapperCol??{span:16}},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(r,{expose:e,emit:t}){const i=r,s=t,{items:o,data:n}=l.toRefs(i);function a(){s("apply",n.value)}const c=l.ref(),d=l.ref(Ae()),f=()=>{d.value=Ae()},u=()=>{if(i.customReset)i.customReset();else{const v={};Nt(o.value,p=>{p.field&&p.itemRender?ue(p.itemRender.defaultValue)?v[p.field]=p.itemRender.defaultValue:v[p.field]=void 0:p.field&&p.slots&&(ue(p.slots.defaultValue)?v[p.field]=p.slots.defaultValue:v[p.field]=void 0)}),Object.assign(n.value,v)}s("reset")},g=l.computed(()=>({...S.omit(i,["items","data","model","labelCol","wrapperCol"]),labelCol:i.labelCol,wrapperCol:i.wrapperCol})),m=v=>{var p;v&&((p=c.value)==null||p.validateFields(v))},x=v=>{m(v)};return e({reset:f,$form:l.computed(()=>c.value)}),(v,p)=>l.unref(o).some(E=>{var C;return E.field&&E.itemRender||((C=E.slots)==null?void 0:C.default)})?(l.openBlock(),l.createElementBlock("div",hC,[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:d.value,ref_key:"formEl",ref:c,model:l.unref(n)},g.value,{onSubmit:a}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(o),(E,C)=>(l.openBlock(),l.createBlock($r,{key:`_col_${E.field||C}`,"form-data":l.unref(n),item:E,onReset:u,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),dC=l.defineComponent(r=>{const{column:e}=r;return()=>{var t,i;return((i=(t=e.slots)==null?void 0:t.title)==null?void 0:i.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),Wa=({title:r,content:e})=>new Promise((t,i)=>{A.Modal.confirm({title:r,content:e,onOk:()=>{t()},onCancel:()=>{i()}})}),uC=A.message.success,fC=A.message.error;A.message.info;const wi=A.message.warning,gC={key:0},vC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},mC={class:"flex items-center flex-1 gap-4px"},xC={key:2},pC={class:"flex items-center gap-4px"},yC={key:0,class:"w-full text-slate-5 pl-4"},Ar=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{default:"id"},striped:{type:Boolean,default:()=>xt().striped??!1},manualFetch:{type:Boolean},align:{default:()=>xt().align??"left"},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{default:"inner"},lazyReset:{type:Boolean,default:()=>xt().lazyReset??!1},fitHeight:{default:()=>xt().fitHeight??170},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var xe,Lt,F,pe,Re;const i=r,{formConfig:s,pageConfig:o,columns:n,toolbarConfig:a,proxyConfig:c,tableConfig:d,selectConfig:f,scrollMode:u}=l.toRefs(i),g=l.reactive({table:!1,toolbar:!1,form:!1}),m=k=>{S.isObject(k)?Object.keys(k).forEach(N=>{g[N]=k[N]}):S.isBoolean(k)&&(g.form=k,g.table=k,g.toolbar=k)},x=l.ref(),v=l.ref(),p=l.ref(500),E=l.ref([]),C=l.ref([]),w=k=>{const{ajax:N}=c.value;switch(k){case"multiDelete":N.multiDelete&&(E.value.length>0?Wa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{g.table=!0,g.toolbar=!0,N.multiDelete(E.value).then(()=>{A.message.success("删除成功"),ut()}).catch(()=>{A.message.error("删除失败")}).finally(()=>{g.table=!1,g.toolbar=!1,I.multiDelete=!1})}):A.message.warn("请选择要删除的数据"));break}},b=l.computed(()=>{const k=[];return Nt(n.value??[],N=>{N.slots&&N.slots.title&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),T=l.ref(),B=l.ref(),K=l.ref(Ae()),R=l.ref(Ae()),I=l.reactive([...(((Lt=(xe=i.toolbarConfig)==null?void 0:xe.buttons)==null?void 0:Lt.map(k=>k.code))??[]).filter(k=>k),...(((pe=(F=i.toolbarConfig)==null?void 0:F.tools)==null?void 0:pe.map(k=>k.code))??[]).filter(k=>k)].reduce((k,N)=>(k[N]=!1,k),{})),_=(k,N)=>{I[k]=N},O=()=>{R.value=Ae()},y=S.debounce(O,100),D=l.computed(()=>{const k=[];return Nt(n.value??[],N=>{(N.slots&&N.slots.default||N.formatter||N.cellRender)&&(N.field||(N.field="__holder__"+k.length),k.push(N))}),k}),L=l.reactive({page:1,size:((Re=o.value)==null?void 0:Re.pageSize)??10}),Y=l.ref(0),W=l.ref(0),P=l.ref([]),X=l.computed(()=>c.value&&c.value.ajax?o.value?"pagination":"list":"bad"),U=l.useAttrs(),q=t,Ke=l.computed(()=>C.value.filter(k=>E.value.includes(k[i.rowKey??"id"]))),ht=k=>{q("toolbarButtonClick",{data:P.value,code:k,selectedKeys:E.value,records:Ke.value}),w(k)},he=S.debounce(ht,100),qe=({key:k})=>he(k),ee=k=>{q("toolbarToolClick",{data:P.value,code:k,selectedKeys:E.value,records:Ke.value}),w(k)},Pi=S.debounce(ee,100),ve=l.ref({}),Yi=({row:k,field:N})=>{q("pick",{row:k,field:N})},Ze=k=>{if(s.value&&s.value.items.length>0){if(s.value.customReset)s.value.customReset();else{const N={};Nt(s.value.items,G=>{G.field&&G.itemRender?ue(G.itemRender.defaultValue)?N[G.field]=G.itemRender.defaultValue:N[G.field]=void 0:G.field&&G.slots&&(ue(G.slots.defaultValue)?N[G.field]=G.slots.defaultValue:N[G.field]=void 0)}),ve.value=N}q("resetQuery")}L.page=1,k||ft()},dt=(k,N)=>N?{list:S.isString(N.list)?S.get(k,N.list):S.isFunction(N.list)?N.list(k):void 0,total:S.isString(N.total)?S.get(k,N.total):S.isFunction(N.total)?N.total(k):void 0,result:S.isString(N.result)?S.get(k,N.result):S.isFunction(N.result)?N.result(k):void 0,message:S.isString(N.message)?S.get(k,N.message):S.isFunction(N.message)?N.message(k):void 0}:{list:k},Qt=l.ref(!0),Vi=()=>(C.value=[],E.value=[],Ze()),ut=()=>(L.page=1,C.value=[],E.value=[],Je()),Wi=(k,N,G)=>(L.page=k.current,L.size=k.pageSize,Je()),Je=()=>new Promise(k=>{if(X.value!=="bad"){g.form=!0,g.table=!0;const{ajax:N}=c.value;N.query({form:ve.value,page:L}).then(G=>{const{list:ye,total:et,result:Q,message:Ie}=dt(G,c.value.response);ye?(P.value=ye,Y.value++):Q?(P.value=Q,W.value=et??Q.length,Y.value++):(P.value=[],Y.value++,Ie&&A.message.warn(Ie)),k(P.value)}).catch(G=>{console.error("fetchData error",G),k([])}).finally(()=>{g.form=!1,g.table=!1})}}),ft=S.debounce(Je,160),Qe=(k,N)=>(Object.assign(ve.value,k),L.page=1,N?Promise.resolve():ft()),kt=(k,N)=>(ve.value=k,L.page=1,N?Promise.resolve():ft()),jt=l.computed(()=>X.value==="pagination"?{current:L.page,total:W.value,pageSize:L.size,responsive:!1,showSizeChanger:!0,showTotal:k=>`共${k}条数据`}:!1),ei={size:"small",sticky:!0,transformCellText:({text:k})=>S.isArray(k)&&k.length===0?"-":k},ti=l.computed(()=>S.merge({},ei,(d==null?void 0:d.value)??{},f.value?{rowSelection:{type:f.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:E.value,onChange:k=>{E.value=k;const N=i.rowKey??"id",G=C.value.map(Q=>Q[N]),et=k.filter(Q=>!G.includes(Q)).map(Q=>P.value.find(Ie=>Ie[N]===Q)).filter(Q=>!!Q);C.value=[...C.value,...et]},getCheckboxProps:f.value.getCheckboxProps}}:{})),ii=l.computed(()=>S.omit({labelCol:kr,...s.value},["items"])),ri=()=>{ut()};l.watch(()=>[n.value,c.value,a.value],()=>{y()},{deep:!0});const $=()=>{var Q,Ie;const k=(Q=x.value)==null?void 0:Q.parentElement,N=k?window.getComputedStyle(k).height:"0px",G=v.value?window.getComputedStyle(v.value).height:"0px",ye=G.includes("px")?S.toNumber(G.replace("px","")):0,et=(Ie=f.value)!=null&&Ie.showCount?22:0;p.value=i.renderY??S.toNumber(N.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-ye-et,Qt.value=S.toNumber(N.replace("px",""))>600};e({commitProxy:{query:ft,reload:Vi,reloadPage:ut,passQuery:Qe,forcePassQuery:kt},$table:l.computed(()=>B.value),selectedRowKeys:l.computed(()=>E.value),setBtnLoading:_,selectedRecords:Ke,$form:l.computed(()=>T.value),getFormData:()=>ve.value,setLoadings:m,resizeTable:$});let H;l.onMounted(()=>{$(),window.addEventListener("resize",$),H=new MutationObserver(k=>{k.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const G=N.target;window.getComputedStyle(G).display!=="none"&&$()}})}),x.value&&H.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ze(i.manualFetch)});const V=k=>S.isFunction(k)?k():k,de=k=>S.isString(k),je=["align"],me=k=>k.map(N=>({...je.reduce((G,ye)=>({[ye]:i[ye]}),{}),...N}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",$),H.disconnect()}),(k,N)=>{var Q,Ie,Ur;const G=l.resolveComponent("a-menu-item"),ye=l.resolveComponent("a-menu"),et=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:x,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(U)),[X.value==="bad"?(l.openBlock(),l.createElementBlock("div",gC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(Ie=(Q=l.unref(s))==null?void 0:Q.items)!=null&&Ie.some(M=>M.field&&M.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:v},[l.createVNode(l.unref(A.Spin),{spinning:g.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:K.value,ref_key:"formEl",ref:T,model:ve.value},ii.value,{onSubmit:ri}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(s).items,(M,oe)=>(l.openBlock(),l.createBlock($r,{key:`_col_${M.field||oe}`,"form-data":ve.value,item:M,onReset:N[0]||(N[0]=we=>Ze(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(a)?(l.openBlock(),l.createElementBlock("div",vC,[l.createElementVNode("div",mC,[l.unref(a).buttons&&l.unref(a).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).buttons,(M,oe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:oe},[M.dropdowns&&M.dropdowns.length?(l.openBlock(),l.createBlock(et,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ye,{onClick:qe},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(M.dropdowns,we=>(l.openBlock(),l.createBlock(G,{key:we.code},{default:l.withCtx(()=>[we.content&&de(V(we.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:0},[l.createTextVNode(l.toDisplayString(V(we.content)),1)],64)):we.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(we.content)),{key:1})):l.createCommentVNode("",!0)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,loading:g.toolbar||!!M.code&&I[M.code],danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0),l.createVNode(l.unref(wt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):M.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,loading:g.toolbar||!!M.code&&I[M.code],danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block,onClick:we=>l.unref(he)(M.code)},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",xC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",pC,[l.unref(a).tools&&l.unref(a).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(a).tools,(M,oe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:oe,type:M.type,size:M.size??"middle",disabled:l.unref(a).disabled||M.disabled,danger:M.danger,shape:M.shape,ghost:M.ghost,block:M.block,onClick:we=>l.unref(Pi)(M.code),loading:g.toolbar||!!M.code&&I[M.code]},{default:l.withCtx(()=>[M.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:M.icon},null,8,["icon"])):l.createCommentVNode("",!0),M.content&&de(V(M.content))?(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[l.createTextVNode(l.toDisplayString(V(M.content)),1)],64)):M.content?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(V(M.content)),{key:2})):l.createCommentVNode("",!0)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${Qt.value?"h-0":""} p-${l.unref(u)??"inner"}-scroll`)},[(Ur=l.unref(f))!=null&&Ur.multiple&&l.unref(f).showCount?(l.openBlock(),l.createElementBlock("div",yC," 已选:"+l.toDisplayString(E.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(A.Table),l.mergeProps({key:R.value+"_table","row-key":k.rowKey??"id",ref_key:"tableEl",ref:B,"row-class-name":k.striped?(M,oe)=>oe%2===1?"p-grid-row-striped":"":"",columns:me(l.unref(n)??[]).map(M=>l.unref(Bi)(M)),"data-source":P.value,loading:g.table,pagination:jt.value},ti.value,{scroll:{x:"max-content",y:p.value},onChange:Wi}),l.createSlots({_:2},[b.value.length>0?{name:"headerCell",fn:l.withCtx(({column:M})=>[b.value.some(oe=>M.key&&oe.field===M.key)?(l.openBlock(),l.createBlock(l.unref(dC),{key:R.value+"_title_"+Y.value+"_slot_"+M.key,column:b.value.find(oe=>M.key&&oe.field===M.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,D.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:M,record:oe,index:we})=>[D.value.some(Xi=>M.key&&Xi.field===M.key)?(l.openBlock(),l.createBlock(l.unref(Pa),{key:R.value+"_cell_"+Y.value+"_slot_"+M.key,column:D.value.find(Xi=>M.key&&Xi.field===M.key),"default-handler":{pick:Yi,setLoadings:m},row:oe,"row-index":we,"table-data":P.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","row-class-name","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var r=document.createElement("style");r.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-body-bg-color: #fff;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-required-color: #f56c6c;--evt-cell-hover-icon-bg-color: #fff;--evt-cell-hover-icon-border-color: #dde0ea;--evt-scroller-color: #dee0e3;--evt-scroller-track-color: #fff;--evt-scroller-focus-color: #bbbec4;--evt-select-border-color: var(--evt-color-primary);--evt-select-area-color: rgba(82, 146, 247, .1);--evt-select-row-col-bg-color: rgba(82, 146, 247, .1);--evt-autofill-point-border-color: #fff;--evt-edit-bg-color: #fcf6ed;--evt-checkbox-color: var(--evt-color-primary);--evt-checkbox-uncheck-color: #dde0ea;--evt-checkbox-disabled-color: #f1f2f4;--evt-checkbox-check-disabled-color: #dde0ea;--evt-icon-edit-color: #4e5969;--evt-icon-select-color: #4e5969;--evt-readonly-color: #fff;--evt-readonly-text-color: var(--evt-body-text-color);--evt-error-tip-color: #ed3f14;--evt-footer-bg-color: #fafafa;--evt-highlight-hover-row-color: rgba(186, 203, 231, .1);--evt-highlight-selected-row-color: rgba(82, 146, 247, .1);--evt-tooltip-bg-color: #303133;--evt-tooltip-text-color: #fff;--evt-resize-row-line-color: #e1e6eb;--evt-resize-column-text-color: #fff;--evt-resize-column-text-bg-color: var(--evt-color-primary);--evt-resize-column-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: var(--evt-color-primary);--evt-drag-tip-bg-color: rgba(82, 146, 247, .1);--evt-drag-tip-line-color: var(--evt-color-primary);--evt-context-menu-min-width: 150px;--evt-context-menu-max-width: 220px;--evt-context-menu-item-padding: 8px 12px;--evt-context-menu-bg-color: #fff;--evt-context-menu-text-color: #333;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #f5f5f5;--evt-context-menu-text-size: 13px}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-body-text-color: #cfd3dc;--evt-readonly-text-color: #cfd3dc;--evt-footer-text-color: #cfd3dc;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc;--evt-context-menu-bg-color: #141414;--evt-context-menu-text-color: #cfd3dc;--evt-context-menu-item-hover-text-color: var(--evt-color-primary);--evt-context-menu-item-hover-bg-color: #414243}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;background-color:var(--evt-body-bg-color);border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:6px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.e-virt-table-loading{display:none;position:absolute;left:0;top:0;right:0;bottom:0;width:100%;height:100%;z-index:2000;background-color:#fff6;display:flex;align-items:center;justify-content:center}.e-virt-table-loading-spinner{opacity:1;display:flex;flex-direction:column;align-items:center;justify-content:center}.e-virt-table-loading-spinner svg{color:var(--evt-text-color-regular);animation:rotate 1s linear infinite}@keyframes rotate{0%{transform:rotate(0)}to{transform:rotate(360deg)}}.e-virt-table-loading-text{margin:0;font-size:12px;color:var(--evt-text-color-regular)}.e-virt-table-main-menu,.e-virt-table-submenu{position:absolute;background:var(--evt-context-menu-bg-color);border-radius:4px;box-shadow:0 2px 8px #0000001a;min-width:var(--evt-context-menu-min-width);max-width:var(--evt-context-menu-max-width);color:var(--evt-text-color-primary)}.e-virt-table-main-menu{border:1px solid var(--evt-border-color);z-index:3000;left:-99999px;top:-99999px;display:none;position:fixed;background-color:var(--evt-body-bg-color)}.e-virt-table-submenu{border:1px solid var(--evt-border-color);z-index:1000;max-height:350px;overflow-y:auto;opacity:0;visibility:hidden;transform:translate(-10px);transition:opacity .2s,visibility .2s,transform .2s;-ms-overflow-style:none;scrollbar-width:none}.e-virt-table-submenu::-webkit-scrollbar{display:none}.e-virt-table-submenu.show{opacity:1;visibility:visible;transform:translate(0)}.e-virt-table-submenu:not(.show){transition:none}.e-virt-table-menu-item,.e-virt-table-submenu-item{position:relative;-webkit-user-select:none;user-select:none;padding:var(--evt-context-menu-item-padding);cursor:pointer;display:flex;justify-content:space-between;align-items:center;transition:background .2s,color .2s;color:var(--evt-context-menu-text-color);font-size:var(--evt-context-menu-text-size)}.e-virt-table-menu-item:last-child,.e-virt-table-submenu-item:last-child{border-bottom:none}.e-virt-table-menu-item:has(.e-virt-table-menu-item-icon){padding-left:8px}.e-virt-table-menu-item-content{display:flex;align-items:center;flex:1;min-width:0}.e-virt-table-menu-item-icon{display:inline-flex;align-items:center;justify-content:center;width:16px;height:16px;margin-right:8px;flex-shrink:0}.e-virt-table-menu-item-icon svg{width:100%;height:100%;fill:currentColor}.e-virt-table-menu-item-text{flex:1;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.e-virt-table-menu-arrow{display:inline-flex;align-items:center;justify-content:center;color:var(--evt-text-color-regular);transition:color .2s}.e-virt-table-menu-arrow svg{width:20px;height:20px;fill:currentColor}.e-virt-table-submenu-item:hover,.e-virt-table-menu-item:hover,.e-virt-table-menu-item.active{background:var(--evt-context-menu-item-hover-bg-color);color:var(--evt-context-menu-item-hover-text-color)}.e-virt-table-menu-item.disabled,.e-virt-table-submenu-item.disabled{cursor:not-allowed}.e-virt-table-finder-bar{position:absolute;top:8px;right:16px;display:none;z-index:10000;background:#fff;border:1px solid #dadce0;border-radius:12px;box-shadow:0 2px 6px #0003;padding:0 8px;height:48px;min-width:250px;align-items:center;font-size:12px}.e-virt-table-finder-bar.show{display:flex}.e-virt-table-finder-bar-input-wrapper{display:flex;align-items:center;flex:1;padding:0 8px;position:relative}.e-virt-table-finder-bar-input{border:none;outline:none;flex:1;font-size:12px;background:transparent;color:#333;min-width:150px;padding-left:0;position:relative}.e-virt-table-finder-bar-nav{display:flex;flex-direction:row;gap:8px;margin:0 8px;align-items:center}.e-virt-table-finder-bar-nav-btn{border:none;background:transparent;cursor:pointer;padding:0;color:#666;border-radius:50%;display:flex;align-items:center;justify-content:center}.e-virt-table-finder-bar-nav-btn svg{width:24px;height:24px}.e-virt-table-finder-bar-nav-btn.prev-btn{transform:rotate(-90deg)}.e-virt-table-finder-bar-nav-btn.next-btn{transform:rotate(90deg)}.e-virt-table-finder-bar-nav-btn.close-btn{font-size:24px;color:#666;line-height:1;width:24px;height:24px}.e-virt-table-finder-bar-nav-btn:hover{color:#666;background-color:#f0f0f0}.e-virt-table-finder-bar-count{color:#666;font-size:12px;margin:0 8px;white-space:nowrap;flex-shrink:0}.e-virt-table-finder-bar-count.no-results{color:#999}.e-virt-table-finder-bar-loading{display:none;position:absolute;left:8px;top:0;width:16px;height:16px;flex-shrink:0;pointer-events:none;z-index:0}.e-virt-table-finder-bar-loading.show{display:block}.e-virt-table-finder-bar-loading svg{width:100%;height:100%;color:#666;animation:rotate 1s linear infinite}.e-virt-table-empty{position:absolute;left:50%;top:50%;transform:translate(-50%,-50%);font-size:14px;color:#666;z-index:15}")),document.head.appendChild(r)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var wC=Object.defineProperty,EC=(r,e,t)=>e in r?wC(r,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):r[e]=t,h=(r,e,t)=>EC(r,typeof e!="symbol"?e+"":e,t);class CC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,value:d,field:f,fieldValue:u}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const m={field:f,fieldValue:u,value:d,column:i,colIndex:a,rowIndex:c,row:s,key:o,rowKey:n,...g};g.validator(m,d,x=>{x&&t.push({...m,message:x})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:i,row:s,key:o,rowKey:n,colIndex:a,rowIndex:c,field:f,fieldValue:u,message:g.message||`${o} is required`})}return t}}function Xa(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(r){const e=Math.random()*16|0;return(r==="x"?e:e&3|8).toString(16)})}function Nr(r,e){let t=0,i;return function(...s){const o=new Date().getTime(),n=o-t,a=typeof e=="function"?e():e;!t||n>=a?(r.apply(this,s),t=o):i||(i=setTimeout(()=>{r.apply(this,s),t=new Date().getTime(),i=void 0},a-n))}}function vi(r=[]){return r.length?r.map(e=>vi(e.children)+1).sort((e,t)=>t-e)[0]:0}function bC(r=[]){let e=[],t=[],i=[];return r.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?i.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)),...i.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function mi(r=[],e=1,t=0,i=""){return r.sort((s,o)=>(s.sort??0)-(o.sort??0)).map(s=>{if(s.children){let o=0,n=s.fixed;s.children.forEach(c=>{c.fixed=n});const a=mi(s.children,e-1,t+1,s.key);return a&&a.forEach(c=>{o+=c.colspan??0}),{...s,width:s.width,level:t,rowspan:1,colspan:o,parentKey:i,children:a.sort((c,d)=>(c.sort??0)-(d.sort??0))}}return{...s,level:t,rowspan:e,colspan:1,parentKey:i}})}function Ht(r=[]){let e=[];return r.forEach(t=>{t.children?e=e.concat(Ht(t.children)):e.push(t)}),e}function za(r){return r.filter(e=>!e.hide).map(e=>Array.isArray(e.children)&&e.children.length>0?{...e,children:za(e.children)}:{...e})}const So=/^(\r\n|\n\r|\r|\n)/,_C=/^[^\t\r\n]+/,To=/^\t/;function RC(r){let e=[[""]];if(r.length===0)return e;let t=0,i=0,s;for(;r.length>0&&s!==r.length;)if(s=r.length,r.match(To))r=r.replace(To,""),t+=1,e[i][t]="";else if(r.match(So))r=r.replace(So,""),t=0,i+=1,e[i]=[""];else{let o="";if(r.startsWith('"')){let n=0,a=!0;for(;a;){const c=r.slice(0,1);c==='"'&&(n+=1),o+=c,r=r.slice(1),(r.length===0||r.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=r.match(_C);o=n?n[0]:"",r=r.slice(o.length)}e[i][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 IC(r){let e,t,i,s,o="",n;for(e=0,t=r.length;e<t;e+=1){for(s=r[e].length,i=0;i<s;i+=1)i>0&&(o+=" "),n=r[e][i],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 Xa(r,e,t=[]){let i=0;const s=[];return r.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((d,f)=>`${d}${o[f]??""}`,"")||o[e],l=t.reduce((d,f)=>`${d}${r[n-1][f]??""}`,"")||r[n-1][e];a===l?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function za(r,e){let t="",i="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,i=o.key,s[o.key]=1):r[o.key]===r[t]?(s[o.key]=0,s[i]+=1):(s[o.key]=1,t=o.key,i=o.key)}),s}function RC(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Xa(i,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 IC(r,e=[]){const{column:t,row:i,visibleLeafColumns:s}=r,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=za(i,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 SC(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function So(r){if(!r)return new Date(0);if(typeof r=="number")return new Date(r);const e=String(r).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const i=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of i){const o=e.match(s);if(o){const n=o.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,l,d,f=0,u=0,g=0]=n;return new Date(a,l-1,d,f,u,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,l,d,f=0,u=0,g=0]=n;return new Date(d,l-1,a,f,u,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,l,d,f=0,u=0,g=0]=n;return new Date(d,a-1,l,f,u,g)}else if(s.source.includes("YYYYMMDD")){const[a,l,d]=n;return new Date(a,l-1,d)}}}return new Date(NaN)}function TC(r,e){const t=So(r),i=So(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class Ga{constructor(e,t,i,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=i,this.width=s,this.height=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:i,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-i<=0||this.x-i>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,i=e;return!(this.y+this.height-t<=0||this.y-t>=i)}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 Ar extends Ga{constructor(e,t,i,s,o,n,a,l,d,f="body",u=!0){super(e,s,o,n,a,f,l.fixed),h(this,"formatter"),h(this,"formatterFooter"),h(this,"hoverIconName",""),h(this,"operation",!1),h(this,"align"),h(this,"verticalAlign"),h(this,"fixed"),h(this,"type"),h(this,"editorType"),h(this,"editorProps"),h(this,"cellType"),h(this,"level"),h(this,"colspan",1),h(this,"rowspan",1),h(this,"mergeRow",!1),h(this,"mergeCol",!1),h(this,"relationRowKeys",[]),h(this,"relationColKeys",[]),h(this,"key"),h(this,"column"),h(this,"rowIndex"),h(this,"colIndex"),h(this,"rowKey"),h(this,"row"),h(this,"value"),h(this,"render"),h(this,"renderFooter"),h(this,"style",{}),h(this,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=i,this.rowIndex=t,this.key=l.key,this.type=l.type||"",this.editorType=l.editorType||"text",this.selectorCellValueType=l.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=l.editorProps||{},this.cellType=f,this.align=l.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=l.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=l.fixed||"",this.level=l.level||0,this.operation=l.operation||!1,this.column=l,this.rules=l.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=l.render,this.overflowTooltipShow=l.overflowTooltipShow!==!1,this.autoRowHeight=l.autoRowHeight!==void 0?l.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=l.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=l.overflowTooltipPlacement||"top",this.renderFooter=l.renderFooter,this.hoverIconName=l.hoverIconName,this.formatter=l.formatter,this.formatterFooter=l.formatterFooter,this.maxLineClamp=l.maxLineClamp||"auto",u&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:i=1,rowspan:s=1,relationRowKeys:o,relationColKeys:n,mergeRow:a=!1,mergeCol:l=!1}=t({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue(),headIndex:this.ctx.body.headIndex,headPosition:this.ctx.database.getPositionForRowIndex(this.ctx.body.headIndex),visibleRows:this.ctx.body.visibleRows,visibleLeafColumns:this.ctx.header.visibleLeafColumns,rows:this.ctx.body.data})||{};Array.isArray(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=l,this.mergeRow=a,this.colspan=i,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:i,props:s={}}=t;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:i}=this;let s,o=0,n="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&i==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:l=!1,hasChildren:d=!1,expandLoading:f=!1,level:u=0}=a||{};this.rowExpand=l,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(o=u*g,f){const S=this.ctx.icons.get("loading");n="loading",s=S}else if(d){const S=this.ctx.icons.get("expand"),N=this.ctx.icons.get("shrink");s=l?N:S,n=l?"shrink":"expand"}let v=x,p=x,E=this.drawX;(this.align==="center"||this.align==="right")&&(E=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let C=E+o+e,w=this.drawY+(this.visibleHeight-p)/2,b=o+this.drawX+v-.5;this.type==="selection-tree"?(C=o+this.drawSelectionImageX+this.drawSelectionImageWidth,b=C+v-e/2):this.type==="tree-selection"?b=C+m+v-e/2:b=C+v-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(C+v+e>this.drawX+this.visibleWidth)&&(w+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=C,this.drawTreeImageY=w,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=n,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:i=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},n=o.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,l=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const f=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const v=f[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(n-x)*t+i/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const u=Math.round(this.drawTreeImageX-t+i/2),g=o.isLastChild?l:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([u,this.drawY,u,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(n-1)*t+i/2);this.ctx.paint.drawLine([m,l,a,l],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const u=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,u,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:l,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:f,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let _=l,O=a;if(typeof s=="function"){const y=s,{backgroundColor:$,color:L,font:Y}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};$&&(_=$),L&&(O=L),Y&&(this.drawTextFont=Y)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=_,this.drawTextColor=O;return}let p="transparent";const E=this.ctx.hoverCell,C=this.ctx.currentCell;let w=this.rowIndex,b=this.rowIndex;if(this.rowspan!==1&&(u||d)){const _=this.getSpanInfo(),{yArr:O}=_;w=O[0],b=O[1]}u&&E&&(E.rowKey===this.rowKey&&(p=g),E.rowIndex>=w&&E.rowIndex<=b&&(p=g)),d&&C&&(C.rowKey===this.rowKey&&(p=f),C.rowIndex>=w&&C.rowIndex<=b&&(p=f)),this.drawCellSkyBgColor=p;let S=e,N=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(S=t,N=o),m&&(this.rowIndex%2?S=x:S=e),typeof i=="function"){const _=i,{backgroundColor:O,color:y,font:$}=_({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(S=O),y&&(N=y),$&&(this.drawTextFont=$)}const{rowIndex:K,colIndex:R,type:I}=this.ctx.finderBar;K===this.rowIndex&&R===this.colIndex&&I==="body"&&(S=v),this.drawCellBgColor=S,this.drawTextColor=N}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:l}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))return;const d=this.ctx.database.getRowSelectable(l),{CHECKBOX_SIZE:f=0,CELL_PADDING:u}=this.ctx.config;let g=this.drawX+u;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-f)/2);let m=g,x=this.drawY+(t-f)/2;if(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:C}=this.ctx.config,w=this.ctx.database.getRowForRowKey(l),{level:b=0}=w||{},S=b*E;m=g+C+S}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(n==="selection-tree"||n==="tree-selection"){const E=this.ctx.database.getTreeSelectionState(l);E.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):E.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!E.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const E=this.ctx.database.getRowSelection(l);E&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):E&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!E&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+f+u>this.drawX+this.visibleWidth||x+f+u>this.drawY+this.visibleHeight||(n==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:i,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-i,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:f}=d,u=f[0],g=f[1];if(o.rowIndex>=u&&o.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;n=this.drawX-p+m-t-i,a=this.drawY-v+(x-t)/2}}const l=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=l}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const n=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:i}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:i,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const i=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(i<this.visibleHeight&&i>0){const s=(this.visibleHeight-i)/2;t=t+s}}return this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),i||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:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!t||this.ctx.editing)return;const{xArr:o,yArr:n}=this.ctx.selector,a=o[1],l=n[1],{colIndex:d,rowIndex:f,drawX:u,drawY:g}=this;if(d===a&&f===l){const m=d===this.ctx.maxColIndex||f===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let i=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];i+=o.width}return i}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:i,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let n=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&o&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(n=o,a=i),["",null,void 0].includes(n))return!1;typeof n!="string"&&(n=`${n}`);const l=`${n}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(n,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:l}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:i,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:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[n,a]=t,[l,d]=i;!(n===a&&l===d)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=l&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:i}=this,s=this.drawX,o=this.drawY,n=[s+i-e-.5,o,s+i-.5,o,s+i-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:i,rowIndex:s,colIndex:o,height:n,width:a}=this;let l=t,d=i;const{xArr:f,yArr:u,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=f[0],E=f[1],C=u[0],w=u[1];if(o>=p&&o<=E&&s===C){const b=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([l+S,d+1,l+a-b,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=C&&s<=w){const b=s===C?1:0,S=s===w?1:0;this.ctx.paint.drawLine([l+a-1,d+b,l+a-1,d+n-S],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===w){const b=o===E?1:0,S=o===p?1:0;this.ctx.paint.drawLine([l+S,d+n-1,l+a-b,d+n-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=C&&s<=w){const b=s===w?1:0,S=s===C?1:0;this.ctx.paint.drawLine([l+1,d+S,l+1,d+n-b],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class OC{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:i=[],columns:s=[],footerData:o=[]}=t;this.data=i,this.footerData=o,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),i=Nt(t);if(this.ctx.hasSelection=i.some(s=>s.type==="selection"),this.ctx.hasTree=i.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,i=[]){const s=e.length,{ROW_KEY:o="",DEFAULT_EXPAND_ALL:n,CELL_HEIGHT:a,SELECTABLE_METHOD:l,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:f}=this.ctx.config;e.forEach((u,g)=>{var m;f!=="children"&&(u.children=u[f]);const x=u[o],v=x!=null?`${x}`:Va();this.itemRowKeyMap.set(u,v);const p=u._height||a,E=u._readonly;let C=!0;if(typeof l=="function"&&(C=l),d){const b=u[d];if(this.checkboxKeyMap.has(b)){const S=this.checkboxKeyMap.get(b)||[];S.push(v),this.checkboxKeyMap.set(b,S)}else this.checkboxKeyMap.set(b,[v])}this.selectionMap.set(v,{key:d?u[d]:v,row:u,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const w=n||this.expandMap.get(v)||u._expand||!1;this.expandMap.set(v,w),this.rowKeyMap.set(v,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:C,expand:w,expandLazy:!1,hasChildren:u._hasChildren||(Array.isArray(u.children)?u.children.length>0:!1),expandLoading:!1,item:u,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(u.children)&&u.children.length&&this.initData(u.children,t+1,[...i,v])})}setRowHeight(e,t){const i=this.rowIndexRowKeyMap.get(e);if(i===void 0)return;const s=this.rowKeyMap.get(i);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=i,o.item._height=i}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s),{height:n=-1}=this.getMaxRowHeightItem(s)||{};o.calculatedHeight=Math.max(i,n)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=i=>{i.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=i=>i.map(s=>{var o,n,a,l,d,f,u,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(n=(o=this.customHeader)==null?void 0:o.hideData)==null?void 0:n[s.key],fixed:(l=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:l[s.key],sort:(f=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:f[s.key],width:(g=(u=this.customHeader)==null?void 0:u.resizableData)==null?void 0:g[s.key]},v={};for(const[E,C]of Object.entries(x))C!==void 0&&(v[E]=C);const p=m&&m.every(E=>E.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const i=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:l,hasChildren:d,height:f,calculatedHeight:u}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(u,f);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:u}),t+=1,l&&d&&i(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const o=Array.from(this.sortState.entries()).sort((n,a)=>n[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,o)}return i(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const i=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:i}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let i=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const n=this.getColumnByKey(s);!n||!n.column.sortBy||(i=this.applySingleColumnSort(i,s,o,n.column.sortBy))}return i.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,i,s){return e.sort((o,n)=>{const a=o[t],l=n[t];let d=0;if(typeof s=="function")d=s(o,n);else if(s==="number"){const f=Number(a)||0,u=Number(l)||0;d=f-u}else if(s==="string"){const f=String(a||""),u=String(l||"");d=f.localeCompare(u)}else s==="date"&&(d=TC(a,l));return i==="asc"?d:-d})}expandItem(e,t=!1){const i=this.rowKeyMap.get(e);i.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(i=>{const s=this.rowKeyMap.get(i);this.expandMap.set(i,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,i)=>{t.expand&&e.push(i)}),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 i=this.rowKeyMap.get(e);i.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const i=this.rowKeyMap.get(e);i.expand=!0,this.expandMap.set(e,!0),i.expandLazy=!0,i.item.children=t,this.initData(i.item.children,i.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 i=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return i===void 0||s===void 0?null:{rowKey:i,key:s,value:this.getItemValue(i,s)}}getItemValue(e,t){const i=this.rowKeyMap.get(e);return i&&i.item?i.item[t]===void 0?null:i.item[t]:null}async batchSetItemValue(e,t=!1,i=!0,s="none"){let o=[],n=i;const a=new Set;let l=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let E=x.value,C=E;const w=this.getRowDataItemForRowKey(v),b=this.getItemValue(v,p),S=this.getVirtualBodyCellByKey(v,p);return(S==null?void 0:S.type)==="number"&&(["",void 0,null].includes(E)?C=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?C=Number(E):(C=b,l.push({...x,value:C,oldValue:b,row:w}))),{...x,value:C,oldValue:b,row:w}});if(d=d.filter(x=>!l.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),l.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:l};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:f}=this.ctx.config;s==="none"&&typeof f=="function"&&(d=await f(d),n=!1),d.forEach(x=>{const{value:v,rowKey:p,key:E}=x,C=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,v,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:C,newValue:v})});let u=[];a.forEach(x=>{u.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,u),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,i,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:l}=this.rowKeyMap.get(e);let d=l[t],f=i;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};l[t]!==null&&typeof l[t]=="object"&&(d=JSON.parse(JSON.stringify(l[t])));const u=`${e}_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,d);const g=this.originalDataMap.get(u),m=this.getRowDataItemForRowKey(e);if(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))f=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))f=Number(i);else{f=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:f,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(f===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:f,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:g,row:m})}else this.changedDataMap.set(u,f),l[t]=f;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:this.originalDataMap.get(u),row:m}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:f}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:i}=this.ctx.config;if(i){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[i];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e,t){const i=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",i);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),i=this.ctx.config.TREE_SELECT_MODE;if(i==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const i=this.getTreeChildren(t).map(l=>this.selectionMap.get(l)),s=i.filter(l=>l==null?void 0:l.check).length,o=i.length;let n=!1;o>0&&(s===0?n=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?n=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(n=!1));const a=this.selectionMap.get(t);a&&a.check!==n&&(a.check=n,this.setRowSelectionByCheckboxKey(t,n),this.updateParentTreeSelection(t))}setRowSelection(e,t,i=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),i&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const i=this.selectionMap.get(e);i&&(i.check=t,this.setRowSelectionByCheckboxKey(e,i.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),i=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:i,indeterminate:!1};let s=!1,o=i;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const n=u=>{const g=this.getTreeChildren(u);let m=[];for(const x of g)m.push(x),m.push(...n(x));return m},a=n(e).map(u=>this.selectionMap.get(u)),l=a.filter(u=>u==null?void 0:u.check).length,d=a.length,f=l>0;s=f&&l!==d,o=i||f,i&&d>0&&l===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const n=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...n(v));return x},a=n(e).map(g=>this.selectionMap.get(g)),l=a.filter(g=>g==null?void 0:g.check).length,d=a.length,f=l>0,u=l===d;s=f&&!u,o=i||u,i&&d>0&&l===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=i);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const i=[],s=o=>{for(const n of o){const a=this.getRowKeyByItem(n);a&&i.push(a),n.children&&n.children.length>0&&s(n.children)}};return s(t.item.children),i}getTreeParent(e){const t=(i,s)=>{for(const o of i){const n=this.getRowKeyByItem(o);if(o.children)for(const a of o.children){if(this.getRowKeyByItem(a)===s)return n;const l=t(o.children,s);if(l)return l}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:i,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:i,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(i);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(i,!0))}}):this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(i,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const n=this.selectionMap.get(o);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(o,!1))}):this.rowKeyMap.forEach((s,o)=>{this.setRowSelection(o,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,o)=>{this.selectionMap.set(o,{check:!1,row:s.item,key:o})}));const i=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",i),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const i=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,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(o+=1)});const l=n>i&&s===0&&a,d=o&&o>s&&s>0||l,f=o!==0,u=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:u,indeterminate:d,selectable:f},{check:u,indeterminate:d,selectable:f}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const i=this.colIndexKeyMap.get(e);if(i&&this.headerMap.has(i))return(t=this.headerMap.get(i))==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,i)=>{const s=this.originalDataMap.get(i),o=i.split("_")[0],n=i.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((i,s)=>{const o=this.originalDataMap.get(s),n=s.split("_")[0];o!==i&&e.add(n)});let t=[];return e.forEach(i=>{t.push(this.ctx.database.getRowDataItemForRowKey(i))}),t}isHasChangedData(e,t){const i=`${e}_${t}`;if(!this.changedDataMap.has(i))return!1;const s=this.originalDataMap.get(i),o=this.changedDataMap.get(i);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:i}=this.ctx.config;if(i)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:l}=this.ctx.config;if(typeof l=="function"&&o){const d=l({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(i=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(s===void 0||o===void 0)return i([]);const a=o.column;let l=a.rules;if(typeof n=="function"){const d=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});d&&(l=d)}if(l){const d={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)},f=new wC(l).validate(d);this.setValidationError(e,t,f),i(f)}else this.clearValidationError(e,t),i([])})}getHeightByRowIndexRowSpan(e,t){let i=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(i+=o.height)}return i}getSpanInfo(e){const{rowIndex:t,key:i,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:l,relationColKeys:d,rowspan:f,height:u,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(f===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:f,colspan:m,height:u,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:i,row:o,value:n}]};let p=t,E=t,C=a,w=a,b=[],S=0,N=0,K=0,R=0;if(f!==1&&x){R=g;const I=l.reduce((_,O)=>{const y=this.getItemValue(s,O)??"";return`${_}${y}`},"");for(let _=t-1;_>=0;_--){const O=this.rowIndexRowKeyMap.get(_)||"",y=l.reduce(($,L)=>{const Y=this.getItemValue(O,L)??"";return`${$}${Y}`},"");if(I===y)p=_;else break}for(let _=t;_<=this.ctx.maxRowIndex;_++){const O=this.rowIndexRowKeyMap.get(_)||"",y=l.reduce(($,L)=>{const Y=this.getItemValue(O,L)??"";return`${$}${Y}`},"");if(I===y)E=_;else break}for(let _=p;_<t;_++){const{height:O}=this.positions[_];S+=O}for(let _=p;_<=E;_++){const{height:O}=this.positions[_];K+=O;const y=this.rowIndexRowKeyMap.get(_)||"",{item:$}=this.rowKeyMap.get(y),L=this.getItemValue(y,i);b.push({rowKey:y,key:i,value:L,row:$})}}if(m!==1&&v){K=u;for(let I=a-1;I>=0;I--){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))C=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))w=I;else break}for(let I=C;I<a;I++){const _=this.getColumnByColIndex(I);if(!_)break;N+=_.width||100}for(let I=C;I<=w;I++){const _=this.getColumnByColIndex(I);if(!_)break;R+=_.width||100,b.push({rowKey:s,key:_.key,value:this.getItemValue(s,_.key),row:o})}}return{xArr:[C,w],yArr:[p,E],rowspan:f,colspan:m,height:K,width:R,offsetTop:S,offsetLeft:N,dataList:b}}setValidationErrorByRowKey(e,t,i){const s=`${e}_${t}`,o=this.getRowForRowKey(e),n=o==null?void 0:o.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!o)return;const l=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:l,message:i,field:t,fieldValue:l}];this.validationErrorMap.set(s,d)}setValidationError(e,t,i){const s=`${e}_${t}`;this.validationErrorMap.set(s,i)}clearValidationError(e,t){const i=`${e}_${t}`;this.validationErrorMap.has(i)&&this.validationErrorMap.delete(i)}getValidationError(e,t){const i=`${e}_${t}`;return this.validationErrorMap.get(i)||[]}getVirtualBodyCell(e,t,i=!0){const s=this.getColumnByColIndex(t),o=this.getRowForRowIndex(e);return!s||!o?void 0:new Ar(this.ctx,e,t,0,0,0,0,s,o.item,"body",i)}getVirtualBodyCellByKey(e,t){const i=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(i===void 0||s===void 0))return this.getVirtualBodyCell(i,s)}hasMergeCell(e,t){let i=!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)){i=!0;break}}return i}calculateMaxTreeDepth(e,t=0){let i=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);i=Math.max(i,o)}}),i}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const i=`${e}_${t}`;return this.overlayerAutoHeightMap.get(i)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(i=>{const s=e[i];s!==void 0&&(this.customHeader[i]=s)}),!t){const i=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",i)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:i={}}=this.customHeader;i[e]=t,this.setCustomHeader({resizableData:i})}setCustomHeaderHideData(e,t){let{hideData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({hideData:i}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({fixedData:i}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,o={})=>{s.forEach(n=>{n.children&&n.children.length>0&&t(n.children,o);const a=(l,d)=>{var f,u;const g=(f=this.customHeader[l])==null?void 0:f[n.key];g!==void 0&&g!==d&&(o[l]||(o[l]={}),o[l][n.key]=g,l==="fixedData"&&!g&&!d&&((u=o[l])==null||delete u[n.key]))};a("fixedData",n.fixed),a("sortData",n.sort),a("hideData",n.hide),a("resizableData",n.width)})};let i={};return t(e,i),i}setMaxRowHeightItem(e,t,i){this.maxRowHeightCellMap.set(e,{key:t,height:i})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class kC{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:i}=this.ctx.config;i&&(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:i}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,i),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(i=>({rowKey:i.rowKey,key:i.key,value:i.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class LC{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:i,options:s})=>{this.unbind(e,t,i,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,i=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;this.ctx.mouseX=s,this.ctx.mouseY=o,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,i,s){e.addEventListener(t,i,s),this.eventTasks.add({target:e,name:t,fn:i,options:s})}unbind(e,t,i,s){e.removeEventListener(t,i,s);for(const o of this.eventTasks)if(o.target===e&&o.name===t&&o.fn===i){this.eventTasks.delete(o);break}}}class DC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const i=this.events.get(e)||[];i.push(t),this.events.set(e,i)}once(e,t){const i=(...s)=>{t(...s),this.off(e,i)};return this.on(e,i),this}off(e,t){const i=this.events.get(e);if(i){const s=i.indexOf(t);s>=0&&(i.splice(s,1),i.length===0?this.events.delete(e):this.events.set(e,i))}}emit(e,...t){const i=this.events.get(e);i&&i.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class $C{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,i,s){this.ctx.clearRect(e,t,i||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,i,s,o){const{fillColor:n,side:a,shadowWidth:l,colorStart:d,colorEnd:f}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,s));let u;switch(a){case"left":u=this.ctx.createLinearGradient(e-l,t,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e-l,t,l,s);break;case"right":u=this.ctx.createLinearGradient(e+i,t,e+i+l,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e+i,t,l,s);break;case"top":u=this.ctx.createLinearGradient(e,t-l,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-l,i,l);break;case"bottom":u=this.ctx.createLinearGradient(e,t+s,e,t+s+l),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+s,i,l);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:i="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=i,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,i,s,o){this.ctx.save(),this.ctx.drawImage(e,t,i,s,o),this.ctx.restore()}drawRect(e,t,i,s,{borderWidth:o=1,borderColor:n,fillColor:a,radius:l=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),l===0)this.ctx.rect(e-.5,t-.5,i,s);else{const[d,f,u,g]=typeof l=="number"?[l,l,l,l]:l;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+i,t,e+i,t+f,f),this.ctx.arcTo(e+i,t+s,e+i-u,t+s,u),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){var a;this.ctx.save();const{font:l="12px Arial",align:d="center",color:f="#495060",padding:u=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=n;if(this.ctx.font=l,this.ctx.fillStyle=f,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=l.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),C=s-u*2-v-p;let w=!1;const b=Math.round((o-2*u)/E);let S=this.wrapText(e,C,n.cacheTextKey),N=Math.min(S.length,Math.max(b,1));m==="auto"&&x?N=S.length:typeof m=="number"&&m<N&&m!==1?N=m:(m===1&&(S=[e],N=1),m==="auto"&&b===1&&(S=[e],N=1));let K=i+u;const R=Math.round(N*E);g==="middle"?K=i+(o-R)/2:g==="bottom"&&(K=i+o-R-u);let I=t+u+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-u-p);for(let _=0;_<S.length;_++){const O=S[_],y=K+_*E;if(this.ctx.textBaseline="top",_===N-1){const $=S.slice(_).join(""),{_text:L,ellipsis:Y}=this.handleEllipsis($,s,u,l);this.ctx.fillText(L,I,y),w=Y;break}this.ctx.fillText(O,I,y)}if(n.textCallback&&S.length){const _=S.reduce((Y,V)=>Math.max(Y,this.ctx.measureText(V).width),0),O=Math.round(_);let y=I,$=I+O;d==="center"?(y=I-O/2,$=I+O/2):d==="right"&&(y=I-O,$=I);const L={x:I,y:K,width:O,height:R,left:y,right:$,top:K,bottom:K+R};n.textCallback(L)}return this.ctx.restore(),w}wrapText(e,t,i=""){if(!e)return[""];if(i&&this.textCacheMap.has(i))return this.textCacheMap.get(i)||[""];const s=[],o=e.split(`
|
|
4
|
-
`);for(const a of o){if(a===""){s.push("");continue}const l=a.split("");let d="";for(const f of l){const u=d+f;this.ctx.measureText(u).width<=t?d=u:d?(s.push(d),d=f):(s.push(f),d="")}d&&s.push(d)}const n=s.length>0?s:[""];return i&&this.textCacheMap.set(i,n),n}calculateTextHeight(e="",t,i={}){var s;const{font:o="12px Arial",padding:n=0,align:a="center",color:l="#495060",maxLineClamp:d=1,cacheTextKey:f=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=l,this.ctx.textAlign=a;const u=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=u*(i.lineHeight||1.2),m=t-n*2,x=this.wrapText(e,m,f);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+n*2),Math.floor(u+n*2))}handleEllipsis(e,t,i=0,s="12px Arial"){this.ctx.save();let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width;if(t<=a+i*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const l=this.ctx.measureText(e).width,d=t-i*2;if(l&&l>=d){o=!0;let f=0;for(let u=0;u<e.length;u++)if(f+=this.ctx.measureText(e[u]).width,f>=d-a){n=e.slice(0,u)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class To{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const i=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=SC(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const yi='<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>',Oo='<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>',ko='<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>',Nr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',MC=Nr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),AC=Nr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),Ua='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class NC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:Ua,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:yi,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:ko,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Oo,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Oo,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:ko,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:MC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:AC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Nr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const i=this.list[t];let s=i.color,o=i.svg;if(i.configColorName){const a=this.ctx.config[i.configColorName];a&&(s=a)}if(i.configName){const a=this.ctx.config[i.configName];a&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(i.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const i=this.ctx.config.ICONS[t];let s=i.color;const o=this.createImageFromSVG(i.svg,s,i.isBlob).then(n=>{this.icons.set(i.name,n)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,i=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const l=a.getAttribute("fill");(l==="currentColor"||l===null)&&a.setAttribute("fill",t)});const o=new Image;let n="";if(i){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,l)=>{o.onerror=()=>l(new Error("Failed to load image:"+e)),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class cr extends Ga{constructor(e,t,i,s,o,n,a){super(e,i,s,o,n,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=i,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.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=Va(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:i}=this.ctx.config;let s=t,o=i;if(typeof e=="function"){const l=e,{backgroundColor:d,color:f,font:u}=l({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),f&&(o=f),u&&(this.drawTextFont=u)}const{colKey:n,type:a}=this.ctx.finderBar;a==="header"&&n===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:i,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:i,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:n=>{this.column.sortBy&&(this.drawSortImageX=n.right+4,this.drawSortImageY=n.top+(n.height-16)/2),this.required&&e.drawText("*",n.left-18,n.top+(n.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let i=-1,s=-1;if(this.ctx.focusCellHeader&&(i=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:n}=this.ctx.selector;i=n[0],s=n[1]}const o=this.colspan+this.colIndex-1;this.colIndex>=i&&this.colIndex<=s&&o<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:i}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let n=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(n=this.drawX+o,this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+o/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-o/2);let l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(l=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(l=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(l=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(l=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(l=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),l&&(this.drawSelectionImageX=n,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=l,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const i=this.ctx.database.getSortState(this.key);i.direction==="asc"?t=this.sortAscIconName:i.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class HC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,{body:{height:n,visibleHeight:a,visibleWidth:l,y:d}}=this.ctx,f=Math.min(n,a);o>0&&o<l&&s>d&&s<d+f||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,u=>{this.ctx.focusCellHeader=u,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",u,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,u=>{this.ctx.setFocusCell(u),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",u,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMouseup",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMouseup",n,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(i,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:i}=this.ctx.getOffset(e),s=t,o=i;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,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,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(i,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(i,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("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(i,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof cr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:l=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:f,EXPAND_LAZY_METHOD:u}=this.ctx.config;if(f&&u&&!l&&!d)typeof u=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),u({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let l;a.direction==="none"?l="asc":a.direction==="asc"?l="desc":l="none",this.ctx.database.setSortState(e.key,l)}imageEnterAndLeave(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof cr){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Ar){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(n,o,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,i,s,o,n){return e>i&&e<i+o&&t>s&&t<s+n}isBusy(e){const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,i,s,o=!1){if(this.isInsideBody(t))for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const l of a){const d=l.getDrawX(),f=l.getDrawY();if(o){if(e>d&&e<d+l.visibleWidth&&t>f&&t<f+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>f&&t<f+l.height){s(l);return}}}}handleHeaderEvent(e,t,i,s){for(const o of i){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);return}}}handleFooterEvent(e,t,i,s,o=!1){for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const l of a){const d=l.getDrawX(),f=l.getDrawY();if(o){if(e>d&&e<d+l.visibleWidth&&t>f&&t<f+l.visibleHeight){s(l);return}}else if(e>d&&e<d+l.width&&t>f&&t<f+l.height){s(l);return}}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class BC{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"adjustPositioning",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:l,loadingElement:d,contextMenuElement:f}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=l,this.loadingElement=d,this.contextMenuElement=f,this.config=new To(t.config||{}),this.eventBus=new DC,this.eventBrowser=new LC(this),this.eventTable=new HC(this),this.paint=new $C(this.canvasElement),this.database=new OC(this,t),this.history=new kC(this),this.icons=new NC(this)}setConfig(e){this.config=new To(e)}setItemValueByEditor(e,t,i,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:l}=a.getSpanInfo(),d=l.map(f=>({...f,value:i}));this.database.batchSetItemValue(d,s,n);return}}this.database.setItemValue(e,t,i,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,i=!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 l=this.database.getVirtualBodyCell(n,a);if(l){const{dataList:d}=l.getSpanInfo(),f=d.map(u=>({...u,value:o.value}));s.push(...f)}}),this.database.batchSetItemValue(s,t,i)}else this.database.batchSetItemValue(e,t,i)}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 i={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",i)}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,i=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=i[1]-i[0];a++){const l=o+t[0],d=a+i[0],f=this.database.getVirtualBodyCell(l,d);f&&(f.selectorCellValueType==="displayText"?n.push(f.displayText):n.push(f.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}return s=s?s.replace(/\r$/,""):" ",{xArr:i,yArr:t,text:s,value:e}}setScroll(e,t){let i=Math.floor(e);const s=this.body.width-this.body.visibleWidth;i<0?i=0:i>s&&(i=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",i,o)}setScrollX(e){let t=Math.floor(e);const i=this.body.width-this.body.visibleWidth;t<0?t=0:t>i&&(t=i),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),i=0;this.config.FOOTER_FIXED||(i=this.footer.height);const s=this.body.height-this.body.visibleHeight+i;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:i}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-i}}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 Lo{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:i}=e.touches[0],s=t-this.clientY,o=i-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:i}=e.touches[0];this.clientX=i,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:i,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,i))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,i)){let n=0;this.type==="vertical"?n=(i-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:i,clientX:s,clientY:o,buttons:n}=e;if(this.isOnScrollbar(t,i)&&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 l=0;this.type==="vertical"?l=this.dragStart+a/(this.visibleDistance-this.barHeight)*this.distance:l=this.dragStart+a/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(l,this.distance))}}isPointInElement(e,t,i,s,o,n){return e>=i&&e<=i+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,i=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&i<0||this.scroll===this.distance&&i>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:i,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,l=s,d=i,f=t.height,u=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-f,this.distance=g-this.visibleDistance+m,this.trackX=l-o,this.trackY=0,this.splitPoints=[this.trackX,f,this.trackX+o,f],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=f+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=l-o,this.distance=u-this.visibleDistance,this.splitPoints=[l-o,d-o,l-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=l,this.trackHeight=o;const v=this.distance?this.visibleDistance/u:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,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:i,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let n=i;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 FC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new Lo(e,"vertical"),this.horizontalScrollbar=new Lo(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,i)=>{this.setScroll(t,i)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,i)=>{this.scrollToIndex(t,i)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.key===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.colIndex===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:i}=this.ctx,s=i.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=i.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,i;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let n="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?n="left":((i=this.ctx.focusCell)==null?void 0:i.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?n="right":(n="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?a="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),n&&this.adjustPositionX!==n){this.adjustPositionX=n;let l=10*(n==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{l*=1.5;const{scrollX:d}=this.ctx,f=d+l;(f<0||f>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(f)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let l=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{l*=1.5;const{scrollY:d}=this.ctx,f=d+l;(f<0||f>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(f)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class KC{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,i){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:o,index:n,node:a}=s;if(o){const u=o[this.childrenKey];u.splice(n,1),u.length===0&&delete o[this.childrenKey]}else this.root.splice(n,1);const l=this.findNodeWithParent(this.root,t[this.key]);if(!l)throw new Error("Target node not found");const{parent:d,index:f}=l;i==="before"?d?d[this.childrenKey].splice(f,0,a):this.root.splice(f,0,a):i==="after"&&(d?d[this.childrenKey].splice(f+1,0,a):this.root.splice(f+1,0,a))}findNodeWithParent(e,t,i=null){for(let s=0;s<e.length;s++){const o=e[s];if(o[this.key]===t)return{parent:i,index:s,node:o};if(o[this.childrenKey]){const n=this.findNodeWithParent(o[this.childrenKey],t,o);if(n)return n}}return null}}class PC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Mr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:i}}=this.ctx;if(!e){const u=this.ctx.database.getColumns();this.columns=u}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=Wa(this.columns);const s=fi(this.visibleColumns),o=Nt(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.reduce((u,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?u+x:v&&m<v?u+v:u+m},0),this.columnIndex=0,this.resizeNum=0;const n=EC(gi(this.visibleColumns,s));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.min(Math.floor(this.width+i),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-i;const l=this.visibleWidth-this.width;if(this.resizeNum&&l>0){const u=Math.floor(l/this.resizeNum*100)/100;this.resizeAllColumn(u)}const d=this.fixedLeftCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedLeftWidth=d.reduce((u,g)=>u+g.width,0);const f=this.fixedRightCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedRightWidth=f.reduce((u,g)=>u+g.width,i),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:i}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,n=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<i&&(a=-(s-i)),o&&a+s<o&&(a=-(s-o)),n&&a+s>n&&(a=n-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const o of s){const{offsetX:n,offsetY:a}=this.ctx.getOffset(e),l=n,d=a,f=o.getDrawX(),u=o.getDrawY();if(l>f+o.width-5&&l<f+o.width+4&&l<t-4&&d>u){const g=o.colIndex+o.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<f+o.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,f={})=>(d.forEach((u,g)=>{u.children&&e(u.children,f),f[u.key]=g}),f),t=this.ctx.database.getColumns(),i=gi(t,fi(t)),s=new KC(i,{key:"key",childrenKey:"children"}),o=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,o);const n=s.getTree(),a=e(n);this.ctx.database.setCustomHeader({sortData:a}),this.init();const l={source:this.dragTarget,target:this.dragingCell,columns:i};this.ctx.emit("columnDragChange",l)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:i,level:s,fixed:o}=this.dragTarget,n=this.allCellHeaders.find(a=>a.key!==i&&a.fixed===o&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=n?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return n}resizeColumn(e,t){const i=n=>{n.forEach(a=>{if(a.children&&a.children.length>0&&i(a.children),a.key===e.key){const l=a.width||100;a.width=l+t}})};i(this.columns);let s=0;if(this.width<this.visibleWidth){const n=this.visibleWidth-this.width;s=Math.floor(n/this.resizeNum*100)/100,this.resizeAllColumn(s)}const o=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:o,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,o),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let i=!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&&(i=!1)}if(!i)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.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:i={}}=t;return Object.keys(i).length===0?{columns:e,customHeader:t}:{columns:gi(e,fi(e)),customHeader:t}}render(e,t){const i=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<i;n++){const a=e[n],l=o*(a.rowspan||0),d=o*(a.level||0);let{minWidth:f,maxWidth:u}=a,g=a.width||100;f&&g<f&&(g=f),u&&g>u&&(g=u),a.children&&(g=Nt(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new cr(this.ctx,this.columnIndex,s,d,g,l,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,l=n+a+this.resizeDiff-.5,d=[l-.5,0,l-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){const f=`${Math.floor(a+this.resizeDiff)}px`,u=45,g=24;this.ctx.paint.drawRect(l+u/2,this.ctx.mouseY-g/2,u,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(f,l+u/2,this.ctx.mouseY-g/2,u,g+2,{padding:0,color:i,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,i=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,i,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:o,visibleWidth:n,colIndex:a}=this.dragingCell;let l=s,d=o;a>this.dragTarget.colIndex&&(l=s+n),a===0&&(l=l+1),a===this.ctx.maxColIndex&&(l=l-1);const f=[l,d,l,this.ctx.stageHeight],u=[l-4,d,l+4,d,l,d+6,l-4,d];this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>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)"}),i<Math.floor(s.width-o-1)&&t!==a){const l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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=[],i=[];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=>{i.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=i,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,i=[0,this.height,e,this.height];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class qa{constructor(e,t,i=0,s=0,o=0,n=0,a,l="body"){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height"),h(this,"cells",[]),h(this,"fixedCells",[]),h(this,"noFixedCells",[]),h(this,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=i,this.y=s,this.width=o,this.height=n,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=l,this.data=a,this.update()}update(){const{header:e}=this.ctx,t=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Ar(this.ctx,this.rowIndex,n.colIndex,n.x,this.y,n.width,this.height,n.column,this.data,this.rowType);a.fixed?i.push(a):s.push(a),t.push(a),a.autoRowHeight&&o.push(a)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=i,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const i=t.getAutoHeight(),{key:s,height:o=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return i>o?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i):i!==0&&t.key===s&&i<o&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i),i});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class YC{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:i,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:l=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:f=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+i.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=l:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const C=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(C>w&&f&&!a){const O=C-w-u;O>t.height+n?E=O:p>d&&(E=d)}else this.data.length&&a?E=a:this.data.length&&d&&p>d&&(E=d);E>0&&(this.ctx.stageHeight=Math.floor(E),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=b-v:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const S=window.devicePixelRatio||1,N=this.ctx.stageWidth*S,K=this.ctx.stageHeight*S;e.width=Math.round(N),e.height=Math.round(K);const R=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:R,type:R,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:l+v});const I=Math.round(e.width/S*1e4)/1e4,_=Math.round(e.height/S*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${_}px;width:${I}px;`),this.ctx.paint.scale(S)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,n=e.clientY,{stageHeight:a,scrollY:l,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let u=n-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;u+f<m&&(u=-(f-m)),this.resizeDiff=u,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(o<0||o>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let f=0;f<this.renderRows.length;f++){const u=this.renderRows[f];if(s>u.y-l+u.height-1.5&&s<u.y-l+u.height+1.5&&s<a-4)for(let g=0;g<u.cells.length;g++){const m=u.cells[g];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=u)}}}})}resizeRow(e,t){const{rowIndex:i,height:s,rowKey:o,data:n}=e;this.ctx.database.setRowHeight(i,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:i,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:i}}=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:i,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&!this.ctx.isEmpty&&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)"}),i<Math.floor(s.width-o-1)&&t!==a&&!this.ctx.isEmpty){const l=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(l,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 i=0,s=e.length-1,o=-1;for(;i<=s;){let n=Math.floor((i+s)/2),a=e[n].bottom;if(a===t)return n;a<t?i=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:i,config:{CELL_HEIGHT:s}}=this.ctx,o=i,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let l=this.binarySearch(a,o),d=this.binarySearch(a,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),l===-1&&d===this.ctx.maxRowIndex){const u=Math.floor(this.visibleHeight/s);l=this.ctx.maxRowIndex-u}this.headIndex=Math.max(0,l),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+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 f=[];for(let u=0;u<this.visibleRows.length;u++){const g=this.headIndex+u,m=this.visibleRows[u],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new qa(this.ctx,g,0,v+this.y,e.width,x,m);f.push(p)}this.renderRows=f,this.ctx.body.renderRows=f}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(i=>i.calculatedHeightCells.length>0))return!1;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class VC{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:i,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+i,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:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;let l=this.y;if(this.ctx.config.FOOTER_FIXED||(l=this.y-this.ctx.scrollY),i>0&&e!==0&&this.ctx.paint.drawShadow(this.x,l,e,this.height,{fillColor:n,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),i<Math.floor(s.width-o-1)&&t!==a){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,l,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 i=[];this.data.forEach((s,o)=>{const n=new qa(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,i.push(n)}),this.renderRows=i,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.y,e,this.y];this.ctx.paint.drawLine(i,{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 WC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Mr(e=>{var t,i;(t=this.ctx.focusCell)!=null&&t.fixed||(i=this.ctx.focusCellHeader)!=null&&i.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),this.ctx.adjustPositioning=!1,this.ctx.disableHoverIconClick=!1}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:i}=this.ctx.selector;this.clearSelectedData(t,i);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("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:i,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!i){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.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:l,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:u,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=l||this.ctx.maxColIndex-u,v=d,p=f||this.ctx.maxRowIndex-g;let[E,C]=o,[w,b]=n;if(E<m||C>x||w<v||b>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const N=this.adjustMergeCells(o,n);w=N.yArr[0],b=N.yArr[1],E=N.xArr[0],C=N.xArr[1],this.ctx.onlyMergeCell=N.onlyMergeCell}E===C&&w===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,C)],n=[Math.max(v,w),Math.min(p,b)];const{BEFORE_SET_SELECTOR_METHOD:S}=this.ctx.config;if(typeof S=="function"){const N=S({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!N)return;o=N.xArr,n=N.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,b===this.ctx.maxRowIndex&&w===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,C===this.ctx.maxColIndex&&E===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var i;const[s,o]=t,[n,a]=e;if(o===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&n===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let l=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const E=v+t[0],C=p+e[0],w=this.ctx.database.getVirtualBodyCell(E,C);w&&((E===s||E===o)&&l.push(w),(C===n||C===a)&&d.push(w))}const f=l.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[C,w]=E;return v.minY=Math.min(v.minY,C),v.maxY=Math.max(v.maxY,w),v},{minY:s,maxY:o}),u=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[C,w]=E;return v.minX=Math.min(v.minX,C),v.maxX=Math.max(v.maxX,w),v},{minX:n,maxX:a}),g=[u.minX,u.maxX],m=[f.minY,f.maxY];let x=!1;if(u.minX!==u.maxX||f.minY!==f.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(i=this.ctx.focusCell)==null?void 0:i.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=i||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const l=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(l,d)}else{const l=[e.colIndex,a+e.colspan-1],d=[o,n];this.setSelector(l,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:i,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:l}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-l,m=[d,f],x=[u,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=i;if(t){this.ctx.setFocusCell(e);const l=[a,n],d=[e.rowIndex,e.rowIndex];this.setSelector(l,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:l}=this.ctx.focusCell;if(e.rowIndex>=l){const d=[a,n],f=[l,e.rowIndex];this.setSelector(d,f)}else{const d=[a,n],f=[e.rowIndex,l];this.setSelector(d,f)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:i}=this.ctx;if(e&&t&&i){const{rowIndex:s,colIndex:o}=t,n=Math.min(i.colIndex,o),a=Math.max(i.colIndex,o),l=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),f=[n,a],u=[l,d];this.setSelector(f,u)}}click(e=!1){const{focusCell:t,clickCell:i}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,i&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=i,{colIndex:n,rowIndex:a}=t,l=Math.min(n,s),d=Math.max(n,s),f=Math.min(a,o),u=Math.max(a,o),g=[l,d],m=[f,u];this.setSelector(g,m)}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 i=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return i==null?void 0:i.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:i}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,i))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],i=[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:i});if(!n)return;e=n.data}const o=_C(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,i=!1,s=null){let o=[];const n=new Set;for(let l=0;l<=t[1]-t[0];l++)for(let d=0;d<=e[1]-e[0];d++){const f=l+t[0],u=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(f,u);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(n.add(m),o.push({rowKey:m,key:x,value:s,row:{}}))}}if(!o.length)return[];if(i)return o;this.ctx.database.batchSetItemValue(o,!0);let a=[];return n.forEach(l=>{a.push(this.ctx.database.getRowDataItemForRowKey(l))}),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],i=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let n=bC(o);const a=[i,i+n[0].length-1],l=[t,t+n.length-1],[d,f]=l,[u,g]=a,m=f-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:f,maxX:g,minY:d,minX:u,overflowRowCount:m,overflowColCount:x,textArr:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!v){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 p=[];for(let w=0;w<=n.length-1;w++){const b=n[w].length;for(let S=0;S<=b-1;S++){const N=w+t,K=S+i,R=n[w][S],I=this.ctx.database.getItemValueForRowIndexAndColIndex(N,K);if(I){const{rowKey:_,key:O}=I;this.ctx.database.getReadonly(_,O)||(s.add(_),p.push({rowKey:_,key:O,value:R,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=p.map(S=>`${S.rowKey}-${S.key}`);w.forEach(S=>{b.includes(`${S.rowKey}-${S.key}`)||p.unshift(S)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const w=E,b=p.map(S=>({rowKey:S.rowKey,key:S.key,value:S.value,oldValue:this.ctx.database.getItemValue(S.rowKey,S.key),row:this.ctx.database.getRowDataItemForRowKey(S.rowKey)}));if(p=await w(b,a,l,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let C=[];s.forEach(w=>{C.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",p,C),this.ctx.emit("draw")}).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:i=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,l=this.ctx.maxRowIndex;switch(e){case"LEFT":i>o&&i--;break;case"TOP":s>n&&s--;break;case"RIGHT":i<a&&i++;break;case"BOTTOM":s<l&&s++;break}const d=[i,i],f=[s,s],u=this.getCell(s,i);u&&(u.operation||this.isInSettingRange(u.rowIndex,u.colIndex)&&(this.ctx.setFocusCell(u),this.setSelector(d,f),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",u),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:i,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:l}=this.ctx.config,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-l;return!(t<d||t>f||e<u||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:l,scrollX:d,scrollY:f,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:C,fixed:w}=i,b=o-v+1,S=i.drawX+E-(t-s)+1;let N=n.height-p,K=C;K>l.visibleHeight&&(K=l.visibleHeight);let R=0;g&&(m==="top"?N=n.height+a.height-p:R=a.visibleHeight);const I=p+K-(e-R-u);let _=d,O=f;S>0&&!w?_=Math.floor(d+S):b>0&&!w&&(_=Math.floor(d-b)),N>0?O=Math.floor(f-N):I>0&&(O=Math.floor(f+I)),(Math.abs(d-_)>2||Math.abs(f-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(_,O))}destroy(){}}class XC{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:i}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:n,drawY:a,width:l,height:d}=this.maxColRowCell,f=6,u=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+l-f+u,m=a+d-f+u;t>g&&i>m&&t<g+f&&i<m+f&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:i}=this.ctx.selector,s=t[1],o=i[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(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:i,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:o}=this.ctx.config;if(!i)return;let n=e,a=t;const l=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(l)!==JSON.stringify(n))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:f,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=f,E=u||this.ctx.maxColIndex-x,C=g,w=m||this.ctx.maxRowIndex-v;let[b,S]=n,[N,K]=a;if(b<p||N<C)return;n=[Math.max(p,b),Math.min(E,S)],a=[Math.max(C,N),Math.min(w,K)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const I=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!I)return;n=I.xArr,a=I.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(),i=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];i.set(`${v}-${p}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,l=this.ctx.autofill.yArr,d=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,l)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let f=[];for(let m=0;m<=l[1]-l[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+l[0],E=s[m%n][x%o],C=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),w=`${p}-${v}`;if(C&&!i.has(w)){const{rowKey:b,key:S}=C;this.ctx.database.getReadonly(b,S)||(e.add(b),f.push({rowKey:b,key:S,value:E,row:{}}))}}if(!f.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u=="function"){const m=u,x=f.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(f=await m(x,a,l),f&&!f.length)return}this.ctx.batchSetItemValueByEditor(f,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",f,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:i}=this.ctx;if(this.ctx.mousedown&&t.enable&&i.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 yt=Math.min,it=Math.max,wi=Math.round,ui=Math.floor,Re=r=>({x:r,y:r}),zC={left:"right",right:"left",bottom:"top",top:"bottom"},GC={start:"end",end:"start"};function hr(r,e,t){return it(r,yt(e,t))}function Gt(r,e){return typeof r=="function"?r(e):r}function rt(r){return r.split("-")[0]}function Ut(r){return r.split("-")[1]}function Za(r){return r==="x"?"y":"x"}function Hr(r){return r==="y"?"height":"width"}const UC=new Set(["top","bottom"]);function Ye(r){return UC.has(rt(r))?"y":"x"}function Br(r){return Za(Ye(r))}function qC(r,e,t){t===void 0&&(t=!1);const i=Ut(r),s=Br(r),o=Hr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=Ei(n)),[n,Ei(n)]}function ZC(r){const e=Ei(r);return[dr(r),e,dr(e)]}function dr(r){return r.replace(/start|end/g,e=>GC[e])}const Do=["left","right"],$o=["right","left"],JC=["top","bottom"],QC=["bottom","top"];function jC(r,e,t){switch(r){case"top":case"bottom":return t?e?$o:Do:e?Do:$o;case"left":case"right":return e?JC:QC;default:return[]}}function eb(r,e,t,i){const s=Ut(r);let o=jC(rt(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(dr)))),o}function Ei(r){return r.replace(/left|right|bottom|top/g,e=>zC[e])}function tb(r){return{top:0,right:0,bottom:0,left:0,...r}}function Ja(r){return typeof r!="number"?tb(r):{top:r,right:r,bottom:r,left:r}}function Ci(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function Mo(r,e,t){let{reference:i,floating:s}=r;const o=Ye(e),n=Br(e),a=Hr(n),l=rt(e),d=o==="y",f=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(l){case"top":m={x:f,y:i.y-s.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:u};break;case"left":m={x:i.x-s.width,y:u};break;default:m={x:i.x,y:i.y}}switch(Ut(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const ib=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),l=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:f,y:u}=Mo(d,i,l),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:C,y:w,data:b,reset:S}=await E({x:f,y:u,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});f=C??f,u=w??u,m={...m,[p]:{...m[p],...b}},S&&x<=50&&(x++,typeof S=="object"&&(S.placement&&(g=S.placement),S.rects&&(d=S.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):S.rects),{x:f,y:u}=Mo(d,g,l)),v=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:m}};async function Qa(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:l}=r,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:m=0}=Gt(e,r),x=Ja(m),v=a[g?u==="floating"?"reference":"floating":u],p=Ci(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(v)))==null||t?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:l})),E=u==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},b=Ci(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:l}):E);return{top:(p.top-b.top+x.top)/w.y,bottom:(b.bottom-p.bottom+x.bottom)/w.y,left:(p.left-b.left+x.left)/w.x,right:(b.right-p.right+x.right)/w.x}}const rb=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:l}=e,{element:d,padding:f=0}=Gt(r,e)||{};if(d==null)return{};const u=Ja(f),g={x:t,y:i},m=Br(s),x=Hr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",C=p?"bottom":"right",w=p?"clientHeight":"clientWidth",b=o.reference[x]+o.reference[m]-g[m]-o.floating[x],S=g[m]-o.reference[m],N=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let K=N?N[w]:0;(!K||!await(n.isElement==null?void 0:n.isElement(N)))&&(K=a.floating[w]||o.floating[x]);const R=b/2-S/2,I=K/2-v[x]/2-1,_=yt(u[E],I),O=yt(u[C],I),y=_,$=K-v[x]-O,L=K/2-v[x]/2+R,Y=hr(y,L,$),V=!l.arrow&&Ut(s)!=null&&L!==Y&&o.reference[x]/2-(L<y?_:O)-v[x]/2<0,P=V?L<y?L-y:L-$:0;return{[m]:g[m]+P,data:{[m]:Y,centerOffset:L-Y-P,...V&&{alignmentOffset:P}},reset:V}}}),sb=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:l,elements:d}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=Gt(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=rt(s),C=Ye(a),w=rt(a)===a,b=await(l.isRTL==null?void 0:l.isRTL(d.floating)),S=g||(w||!v?[Ei(a)]:ZC(a)),N=x!=="none";!g&&N&&S.push(...eb(a,v,x,b));const K=[a,...S],R=await Qa(e,p),I=[];let _=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&I.push(R[E]),u){const L=qC(s,n,b);I.push(R[L[0]],R[L[1]])}if(_=[..._,{placement:s,overflows:I}],!I.every(L=>L<=0)){var O,y;const L=(((O=o.flip)==null?void 0:O.index)||0)+1,Y=K[L];if(Y&&(!(u==="alignment"&&C!==Ye(Y))||_.every(P=>Ye(P.placement)===C?P.overflows[0]>0:!0)))return{data:{index:L,overflows:_},reset:{placement:Y}};let V=(y=_.filter(P=>P.overflows[0]<=0).sort((P,W)=>P.overflows[1]-W.overflows[1])[0])==null?void 0:y.placement;if(!V)switch(m){case"bestFit":{var $;const P=($=_.filter(W=>{if(N){const G=Ye(W.placement);return G===C||G==="y"}return!0}).map(W=>[W.placement,W.overflows.filter(G=>G>0).reduce((G,q)=>G+q,0)]).sort((W,G)=>W[1]-G[1])[0])==null?void 0:$[0];P&&(V=P);break}case"initialPlacement":V=a;break}if(s!==V)return{reset:{placement:V}}}return{}}}},ob=new Set(["left","top"]);async function nb(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=rt(t),a=Ut(t),l=Ye(t)==="y",d=ob.has(n)?-1:1,f=o&&l?-1:1,u=Gt(e,r);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),l?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const ab=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:o,placement:n,middlewareData:a}=e,l=await nb(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+l.x,y:o+l.y,data:{...l,placement:n}}}}},lb=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:p=>{let{x:E,y:C}=p;return{x:E,y:C}}},...l}=Gt(r,e),d={x:t,y:i},f=await Qa(e,l),u=Ye(rt(s)),g=Za(u);let m=d[g],x=d[u];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=m+f[p],w=m-f[E];m=hr(C,m,w)}if(n){const p=u==="y"?"top":"left",E=u==="y"?"bottom":"right",C=x+f[p],w=x-f[E];x=hr(C,x,w)}const v=a.fn({...e,[g]:m,[u]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[u]:n}}}}}};function Ni(){return typeof window<"u"}function St(r){return ja(r)?(r.nodeName||"").toLowerCase():"#document"}function le(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function ke(r){var e;return(e=(ja(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function ja(r){return Ni()?r instanceof Node||r instanceof le(r).Node:!1}function pe(r){return Ni()?r instanceof Element||r instanceof le(r).Element:!1}function Ie(r){return Ni()?r instanceof HTMLElement||r instanceof le(r).HTMLElement:!1}function Ao(r){return!Ni()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof le(r).ShadowRoot}const cb=new Set(["inline","contents"]);function qt(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=ye(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!cb.has(s)}const hb=new Set(["table","td","th"]);function db(r){return hb.has(St(r))}const ub=[":popover-open",":modal"];function Hi(r){return ub.some(e=>{try{return r.matches(e)}catch{return!1}})}const fb=["transform","translate","scale","rotate","perspective"],gb=["transform","translate","scale","rotate","perspective","filter"],vb=["paint","layout","strict","content"];function Fr(r){const e=Kr(),t=pe(r)?ye(r):r;return fb.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||gb.some(i=>(t.willChange||"").includes(i))||vb.some(i=>(t.contain||"").includes(i))}function mb(r){let e=We(r);for(;Ie(e)&&!wt(e);){if(Fr(e))return e;if(Hi(e))return null;e=We(e)}return null}function Kr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const xb=new Set(["html","body","#document"]);function wt(r){return xb.has(St(r))}function ye(r){return le(r).getComputedStyle(r)}function Bi(r){return pe(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function We(r){if(St(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Ao(r)&&r.host||ke(r);return Ao(e)?e.host:e}function el(r){const e=We(r);return wt(e)?r.ownerDocument?r.ownerDocument.body:r.body:Ie(e)&&qt(e)?e:el(e)}function Ht(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=el(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=le(s);if(o){const a=ur(n);return e.concat(n,n.visualViewport||[],qt(s)?s:[],a&&t?Ht(a):[])}return e.concat(s,Ht(s,[],t))}function ur(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function tl(r){const e=ye(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=Ie(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=wi(t)!==o||wi(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Pr(r){return pe(r)?r:r.contextElement}function xt(r){const e=Pr(r);if(!Ie(e))return Re(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=tl(e);let n=(o?wi(t.width):t.width)/i,a=(o?wi(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const pb=Re(0);function il(r){const e=le(r);return!Kr()||!e.visualViewport?pb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function yb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==le(r)?!1:e}function st(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Pr(r);let n=Re(1);e&&(i?pe(i)&&(n=xt(i)):n=xt(r));const a=yb(o,t,i)?il(o):Re(0);let l=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,f=s.width/n.x,u=s.height/n.y;if(o){const g=le(o),m=i&&pe(i)?le(i):i;let x=g,v=ur(x);for(;v&&i&&m!==x;){const p=xt(v),E=v.getBoundingClientRect(),C=ye(v),w=E.left+(v.clientLeft+parseFloat(C.paddingLeft))*p.x,b=E.top+(v.clientTop+parseFloat(C.paddingTop))*p.y;l*=p.x,d*=p.y,f*=p.x,u*=p.y,l+=w,d+=b,x=le(v),v=ur(x)}}return Ci({width:f,height:u,x:l,y:d})}function Yr(r,e){const t=Bi(r).scrollLeft;return e?e.left+t:st(ke(r)).left+t}function rl(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Yr(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function wb(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=ke(i),a=e?Hi(e.floating):!1;if(i===n||a&&o)return t;let l={scrollLeft:0,scrollTop:0},d=Re(1);const f=Re(0),u=Ie(i);if((u||!u&&!o)&&((St(i)!=="body"||qt(n))&&(l=Bi(i)),Ie(i))){const m=st(i);d=xt(i),f.x=m.x+i.clientLeft,f.y=m.y+i.clientTop}const g=n&&!u&&!o?rl(n,l,!0):Re(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-l.scrollLeft*d.x+f.x+g.x,y:t.y*d.y-l.scrollTop*d.y+f.y+g.y}}function Eb(r){return Array.from(r.getClientRects())}function Cb(r){const e=ke(r),t=Bi(r),i=r.ownerDocument.body,s=it(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=it(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Yr(r);const a=-t.scrollTop;return ye(i).direction==="rtl"&&(n+=it(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function bb(r,e){const t=le(r),i=ke(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,l=0;if(s){o=s.width,n=s.height;const d=Kr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,l=s.offsetTop)}return{width:o,height:n,x:a,y:l}}const _b=new Set(["absolute","fixed"]);function Rb(r,e){const t=st(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=Ie(r)?xt(r):Re(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,l=s*o.x,d=i*o.y;return{width:n,height:a,x:l,y:d}}function No(r,e,t){let i;if(e==="viewport")i=bb(r,t);else if(e==="document")i=Cb(ke(r));else if(pe(e))i=Rb(e,t);else{const s=il(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return Ci(i)}function sl(r,e){const t=We(r);return t===e||!pe(t)||wt(t)?!1:ye(t).position==="fixed"||sl(t,e)}function Ib(r,e){const t=e.get(r);if(t)return t;let i=Ht(r,[],!1).filter(a=>pe(a)&&St(a)!=="body"),s=null;const o=ye(r).position==="fixed";let n=o?We(r):r;for(;pe(n)&&!wt(n);){const a=ye(n),l=Fr(n);!l&&a.position==="fixed"&&(s=null),(o?!l&&!s:!l&&a.position==="static"&&s&&_b.has(s.position)||qt(n)&&!l&&sl(r,n))?i=i.filter(d=>d!==n):s=a,n=We(n)}return e.set(r,i),i}function Sb(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Hi(e)?[]:Ib(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((l,d)=>{const f=No(e,d,s);return l.top=it(f.top,l.top),l.right=yt(f.right,l.right),l.bottom=yt(f.bottom,l.bottom),l.left=it(f.left,l.left),l},No(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function Tb(r){const{width:e,height:t}=tl(r);return{width:e,height:t}}function Ob(r,e,t){const i=Ie(e),s=ke(e),o=t==="fixed",n=st(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const l=Re(0);function d(){l.x=Yr(s)}if(i||!i&&!o)if((St(e)!=="body"||qt(s))&&(a=Bi(e)),i){const m=st(e,!0,o,e);l.x=m.x+e.clientLeft,l.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const f=s&&!i&&!o?rl(s,a):Re(0),u=n.left+a.scrollLeft-l.x-f.x,g=n.top+a.scrollTop-l.y-f.y;return{x:u,y:g,width:n.width,height:n.height}}function sr(r){return ye(r).position==="static"}function Ho(r,e){if(!Ie(r)||ye(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return ke(r)===t&&(t=t.ownerDocument.body),t}function ol(r,e){const t=le(r);if(Hi(r))return t;if(!Ie(r)){let s=We(r);for(;s&&!wt(s);){if(pe(s)&&!sr(s))return s;s=We(s)}return t}let i=Ho(r,e);for(;i&&db(i)&&sr(i);)i=Ho(i,e);return i&&wt(i)&&sr(i)&&!Fr(i)?t:i||mb(r)||t}const kb=async function(r){const e=this.getOffsetParent||ol,t=this.getDimensions,i=await t(r.floating);return{reference:Ob(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function Lb(r){return ye(r).direction==="rtl"}const Db={convertOffsetParentRelativeRectToViewportRelativeRect:wb,getDocumentElement:ke,getClippingRect:Sb,getOffsetParent:ol,getElementRects:kb,getClientRects:Eb,getDimensions:Tb,getScale:xt,isElement:pe,isRTL:Lb};function nl(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function $b(r,e){let t=null,i;const s=ke(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,l){a===void 0&&(a=!1),l===void 0&&(l=1),o();const d=r.getBoundingClientRect(),{left:f,top:u,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=ui(u),v=ui(s.clientWidth-(f+g)),p=ui(s.clientHeight-(u+m)),E=ui(f),C={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:it(0,yt(1,l))||1};let w=!0;function b(S){const N=S[0].intersectionRatio;if(N!==l){if(!w)return n();N?n(!1,N):i=setTimeout(()=>{n(!1,1e-7)},1e3)}N===1&&!nl(d,r.getBoundingClientRect())&&n(),w=!1}try{t=new IntersectionObserver(b,{...C,root:s.ownerDocument})}catch{t=new IntersectionObserver(b,C)}t.observe(r)}return n(!0),o}function fr(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:l=!1}=i,d=Pr(r),f=s||o?[...d?Ht(d):[],...Ht(e)]:[];f.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const u=d&&a?$b(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[C]=E;C&&C.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(e)})),t()}),d&&!l&&m.observe(d),m.observe(e));let x,v=l?st(r):null;l&&p();function p(){const E=st(r);v&&!nl(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;f.forEach(C=>{s&&C.removeEventListener("scroll",t),o&&C.removeEventListener("resize",t)}),u==null||u(),(E=m)==null||E.disconnect(),m=null,l&&cancelAnimationFrame(x)}}const bi=ab,_i=lb,Vr=sb,Mb=rb,Ri=(r,e,t)=>{const i=new Map,s={platform:Db,...t},o={...s.platform,_c:i};return ib(r,e,{...s,platform:o})};let Ab=class{constructor(r){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=r;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:i,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:i,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",r=>{this.floatingEl.contains(r.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||(r.ellipsis||r.message)&&this.show(r)}),this.ctx.on("visibleCellMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellFooterMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellShowTooltip",(r,e)=>{this.show(r,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(r,e){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=r.getText();r.message&&(t=r.message),e&&(t=e);const i=this.ctx.containerElement.getBoundingClientRect();if(!i)return;this.enable=!0,this.contentEl.style.maxWidth=`${r.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=r.drawX+i.x,o=r.drawY+i.y;Ri({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:s,y:o,left:s,right:s+r.visibleWidth,top:o,bottom:o+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[_i(),Vr(),bi(6),Mb({element:this.arrowEl})]}).then(n=>{const{x:a,y:l,placement:d,middlewareData:f}=n;if(Object.assign(this.floatingEl.style,{top:`${l}px`,left:`${a}px`}),f.arrow){const u=f.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${u.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 Nb{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:i}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(i)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.ctx.disableHoverIconClick||this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("cellMousedown",()=>{this.inputEl.focus({preventScroll:!0})}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)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.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,l=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=l+`
|
|
5
|
-
`+d,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.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,i=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;i||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("cellMouseup",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:i}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(i);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()}}),this.ctx.on("mousedownBodyOutside",()=>{this.enable&&this.doneEdit(),this.cellTarget=null})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,l]=s;return!(t<o||t>n||e<a||e>l)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,i=this.ctx.body.visibleHeight;t>i&&(t=i);const{stageHeight:s,footer:o,header:n,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,l=s-o.height-a;this.editorEl.style.bottom="auto",this.drawY<n.height&&(this.editorEl.style.top=`${n.height-1}px`),this.drawY+t>l&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-l}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const i=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:n,drawY:a,drawX:l}=e;this.drawX=l,this.drawY=a;const{config:{CELL_PADDING:d},header:f}=this.ctx;let u=this.ctx.body.visibleHeight;o>u&&(o=u),this.editorEl.style.display="inline-block",this.editorEl.style.zIndex="100",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=`${u}px`,s==="text"?(this.inputEl.style.display="inline-block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",i!==null&&(this.inputEl.value=i,this.inputEl.focus({preventScroll:!0}))):this.inputEl.style.display="none",(this.inputEl.scrollHeight>o||this.drawY<f.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,i=this.cellTarget.getValue(),s=this.inputEl.value;s!==i&&!(s===""&&i===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const i=this.ctx.focusCell;if(!i||["index","index-selection","selection"].includes(i.type)||this.enable||!(i.isVerticalVisible()&&i.isHorizontalVisible()))return;const{rowKey:s,key:o}=i,n=this.ctx.database.getReadonly(s,o);i&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const i=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!i)return;const s=i.cells.find(d=>d.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,l=this.ctx.database.getReadonly(n,a);o&&!l&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}doneEdit(){if(!this.enable)return;const{header:e,config:{CELL_HEIGHT:t}}=this.ctx;this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",this.editorEl.style.left="0px",this.editorEl.style.top=`${e.height}px`,this.editorEl.style.maxHeight=`${t}px`,this.editorEl.style.zIndex="-1",setTimeout(()=>{this.inputEl.focus({preventScroll:!0})},0),this.ctx.emit("draw")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Hb=class{constructor(r){h(this,"ctx"),h(this,"emptyEl"),this.ctx=r;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:i,headerHeight:s,bodyHeight:o,footerHeight:n})=>{const a=s+(o+n)/2,l={display:i==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,l)})}destroy(){this.emptyEl.remove()}};class Bb{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Mr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const o=Number(s.getAttribute("data-row-index")),n=Number(s.getAttribute("data-col-index"));if(isNaN(o)||isNaN(n))return;const a=s.getBoundingClientRect(),l=`${o}_${n}`;t.set(l,Math.round(a.height))});const i=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(i,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),i.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(i=>{const s=document.createElement("div");s.className=i.class,Object.assign(s.style,i.style),i.views.forEach(o=>{const n=document.createElement("div");Object.assign(n.style,o.style),o.cells.forEach(a=>{const l=document.createElement("div");Object.assign(l.style,a.style),Object.keys(a.domDataset).forEach(d=>{l.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(l,a),n.appendChild(l)}),s.appendChild(n)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),i=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="top"?s=[e,i,t]:s=[e,t,i]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:i,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let l=[],d=[],f=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?f.push(v):l.push(v))});const u=t-i,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-u+1}px`,height:`${n}px`},cells:l},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u+1}px`,height:`${n}px`},cells:f};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,m,x]}}getBody(){const e=[],t=[],i=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?i.push(p):e.push(p))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:l}}=this.ctx,{visibleWidth:d,visibleHeight:f}=this.ctx.body,u=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${f}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-u}px`,height:`${f}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u}px`,height:`${f}px`},cells:i};return{type:"body",class:`${l}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${f}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],i=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?i.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:l,visibleHeight:d}=this.ctx.footer,f=o-n,u={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${l-s-f}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${l}px`,height:`${d}px`},views:[u,g,m]}}}class Bo{constructor(e,t=[],i={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=i.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var i;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const o=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,o.appendChild(a)}else o.classList.add("menu-item-no-icon");const n=this.createElement("span","e-virt-table-menu-item-text");if(n.textContent=e.label,o.appendChild(n),s.appendChild(o),(i=e.children)!=null&&i.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=yi,s.appendChild(a);const l=this.createSubmenu(e.children);s._submenu=l,this.container.appendChild(l)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(i=>{t.appendChild(this.createMenuItem(i,!0))}),t}createElement(e,t=""){const i=document.createElement(e);return t&&(i.className=t),i}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const i=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");i&&(this.container.contains(i)||i.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(i):this.handleLeave(i))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(i=>i.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const i=t;i&&!i.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(i),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const i=e.closest(".e-virt-table-submenu");if(i)t=i.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(i=>{i!==e&&i._submenu&&this.hideSubmenu(i._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const i=fr(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,l=s.left,d=a>=n||a>=l?"right-start":"left-start",{x:f,y:u}=await Ri(e,t,{placement:d,middleware:[bi(8),_i({padding:8})]});Object.assign(t.style,{left:`${f}px`,top:`${u}px`})});t._cleanup=i}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const i=t._submenu;if(this.activeSubmenus.has(i)){this.activeSubmenus.delete(i),i.classList.remove("show");const s=i;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(i)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const o=t._submenu||t.querySelector(".e-virt-table-submenu");if(o){this.showSubmenu(t,o);return}}const i=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(i||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,i||""))}findMenuItem(e,t=this.menuData){for(const i of t){if(i.value===e)return i;if(i.children){const s=this.findMenuItem(e,i.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};fr(t,this.container,()=>{Ri(t,this.container,{placement:"right-start",middleware:[bi(),_i(),Vr()]}).then(({x:i,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${i}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const i=t.querySelector(".e-virt-table-submenu");return i&&this.cleanupSubmenuRecursively(i),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const i=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),i&&i.querySelectorAll(".e-virt-table-submenu-item").length===0){const o=this.container.querySelector("[data-menu]");if(o&&o._submenu===i)this.removeMenuItem(o.getAttribute("data-menu")||"");else{const n=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of n)if(a._submenu===i){const l=a.getAttribute("data-menu")||a.getAttribute("data-submenu");l&&(a.hasAttribute("data-menu")?this.removeMenuItem(l):this.removeSubMenuItem(l));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Fb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:i,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:o}=this.ctx.config,n=[...o,...s];if(!i||n.length===0)return;t.preventDefault();const{xArr:a,yArr:l}=this.ctx.selector,[d,f]=a,[u,g]=l,{rowIndex:m,colIndex:x}=e;m>=u&&m<=g&&x>=d&&x<=f||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Bo(this.contextMenuEl,n,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=i,a=s||this.ctx.maxColIndex-o;if(e.colIndex<n||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:l,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:f}=this.ctx.config,u=[...l,...d];if(!f||u.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),E=u.map(C=>C.value==="visible"?{...C,children:this.filterColumns(p)}:C);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Bo(this.contextMenuEl,E,{onClick:(C,w)=>{const{xArr:b}=this.ctx.selector,[S,N]=b;if(w==="fixedLeft"||w==="fixedRight"||w==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=N).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(K,w==="fixedLeft"?"left":w==="fixedRight"?"right":""),this.hide()}else if(w==="hide"){const K=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=S&&R.colIndex<=N).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(w!=="visible")if(w.startsWith("visible_")){if(!C.key)return;if(C.children){const R=this.getLeafKeys(C.children);this.ctx.database.setCustomHeaderHideData(R,!1)}else this.ctx.database.setCustomHeaderHideData([C.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(w);const K=this.ctx.database.getColumns();Nt(K).filter(R=>R.hide).length===0&&this.hide()}else w==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};fr(t,this.contextMenuEl,()=>{Ri(t,this.contextMenuEl,{placement:"right-start",middleware:[bi(),_i(),Vr()]}).then(({x:i,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${i}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const i of e)if(i.children&&i.children.length>0){const s=this.filterColumns(i.children);s.length>0&&t.push({label:i.title,key:i.key,value:`visible_${i.key}`,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`,key:i.key});return t}getLeafKeys(e){return e.reduce((t,i)=>(!i.children||i.children.length===0?t.push(String(i.key)):t.push(...this.getLeafKeys(i.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class Kb{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const i=this.ctx.icons.getSvg("loading");if(i){const o=new DOMParser().parseFromString(i.svg,"image/svg+xml").documentElement;t.appendChild(o)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class Pb{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const o=e[s];o&&["string","number"].includes(typeof o.text)&&this.searchData.push({rowIndex:0,colIndex:o.colIndex,text:`${o.text}`,type:"header",colKey:o.key})}const{maxColIndex:t,maxRowIndex:i}=this.ctx;for(let s=0;s<i;s++)for(let o=0;o<t;o++){const n=this.ctx.database.getVirtualBodyCell(s,o,!1),a=n==null?void 0:n.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:o,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const i=Ua;this.loadingEl.innerHTML=i,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=yi,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=yi,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:i}=e;this.ctx.emit("scrollToIndex",t,i)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class Yb{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:i,editorElement:s,emptyElement:o,contextMenuElement:n}=this.options,a=this.createContainer(e,i,s,o,n);this.ctx=new BC(a,this.options),this.header=new PC(this.ctx),this.footer=new VC(this.ctx),this.body=new YC(this.ctx),this.scroller=new FC(this.ctx),this.selector=new WC(this.ctx),this.autofill=new XC(this.ctx),this.tooltip=new Ab(this.ctx),this.empty=new Hb(this.ctx),this.editor=new Nb(this.ctx),this.overlayer=new Bb(this.ctx),this.contextMenu=new Fb(this.ctx),this.loading=new Kb(this.ctx),this.finderBar=new Pb(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,i,s,o){e.className="e-virt-table-container";const n=document.createElement("div"),a=document.createElement("canvas"),l=t||document.createElement("div");n.className="e-virt-table-stage",e.tabIndex=0,a.className="e-virt-table-canvas",l.className="e-virt-table-overlayer",l.setAttribute("data-overlayer",t?"custom":"default");const d=i||document.createElement("div");d.className="e-virt-table-editor";const f=s,u=o;return n.appendChild(a),n.appendChild(l),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:l,editorElement:d,emptyElement:f,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,i,s=!0,o=!0,n=!1){this.ctx.database.setItemValue(e,t,i,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,i,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,i,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],i=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,i,!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(i,s)=>{let o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:l}=e[n],d=await this.ctx.database.getValidator(a,l);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:l,key:d}=a;this.scrollToRowkey(l),this.scrollToColkey(d)}}this.ctx.emit("draw")}else i([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,i)=>{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:l}=n,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:f=[]}=d;f&&f.length&&this.setExpandRowKeys(f,!0)}this.scrollToRowkey(a),this.scrollToColkey(l)}}i(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:i,key:s,message:o,rowKey:n}=t;if(i!==void 0&&n===void 0){const a=this.ctx.database.getRowKeyForRowIndex(i);this.ctx.database.setValidationErrorByRowKey(a,s,o)}n&&this.ctx.database.setValidationErrorByRowKey(n,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:i,key:s}=t;this.scrollToRowIndex(i),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const i=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<i.length;n++)for(let a=0;a<s.length;a++){const l=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,f=await this.ctx.database.getValidator(l,d);Array.isArray(f)&&f.length&&o.push(f)}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(i=>{const s=this.ctx.database.getRowKeyByItem(i);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(i=>{this.ctx.database.setRowSelection(i,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:IC,mergeRowCell:RC,getSpanArrByRow:Xa,getSpanObjByColumn:za}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const Vb=c.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=c.ref(s[o]);return()=>{var a,l;return((l=(a=At.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:l.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Wr=c.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(r,{expose:e,emit:t}){const i=t,s=c.ref([]),o=r,n=Na(),a=c.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.config}}));let l=null;const d=c.useAttrs(),f=c.ref(null),u=c.ref(null),g=c.ref(null),m=c.ref(null),x=c.ref(),v=c.ref("text"),p=c.ref(),E={},C={},w=c.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>mt[y]||(({cellValue:$})=>$),S=y=>{var $;return($=At.renders[y])==null?void 0:$.renderDefault},N=(y,...$)=>({row:L,rowIndex:Y,value:V})=>y({row:L,rowIndex:Y,cellValue:V},...$),K=y=>{var $,L,Y,V,P;if(($=y.slots)!=null&&$.default&&T.isFunction((L=y.slots)==null?void 0:L.default))return W=>{var G,q;return(q=(G=y.slots)==null?void 0:G.default)==null?void 0:q.call(G,{row:W.row,column:y,rowIndex:W.rowIndex})};if((Y=y.slots)!=null&&Y.default&&T.isString((V=y.slots)==null?void 0:V.default))return`slot:${(P=y.slots)==null?void 0:P.default}`;if(y.cellRender&&y.cellRender.name)return W=>{var G,q;return(q=S(y.cellRender.name))==null?void 0:q(y.cellRender,{data:o.data,row:W.row,rowIndex:W.rowIndex,field:y.field||W.column.key,title:((G=W.column)==null?void 0:G.title)??""},{})}},R=y=>{var $,L;if(($=y.slots)!=null&&$.title&&T.isFunction((L=y.slots)==null?void 0:L.title))return Y=>{var V,P;return(P=(V=y.slots)==null?void 0:V.title)==null?void 0:P.call(V,{column:y})}},I=y=>{var $,L,Y,V,P,W,G;return($=y.slots)!=null&&$.edit&&(y.field||y.key)&&T.isFunction((L=y.slots)==null?void 0:L.edit)?E[`__slot:${y.field||y.key}`]=y:(Y=y.editRender)!=null&&Y.name&&(y.field||y.key)&&(C[y.field||y.key]=y.editRender),{...T.omit(y,["formatter"]),key:y.key||y.field||De(),formatter:T.isString(y.formatter)?N(b(y.formatter)):T.isArray(y.formatter)&&T.isString(y.formatter[0])?N(b(y.formatter[0]),...y.formatter.slice(1)):T.isFunction(y.formatter)?N(y.formatter):void 0,editorType:y.editorType??((V=y.slots)!=null&&V.edit&&(y.field||y.key)&&T.isFunction((P=y.slots)==null?void 0:P.edit)?`__slot:${y.field||y.key}`:(W=y.editRender)!=null&&W.name?y.editRender.name:void 0),render:K(y),renderHeader:R(y),children:(G=y.children)==null?void 0:G.map(q=>I(q))}};c.onMounted(()=>{f.value&&(l=new Yb(f.value,{config:a.value.config,columns:o.columns.map(y=>I(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:u.value||void 0}),Object.keys(d).forEach(y=>{const $=d[y];if(typeof $=="function"&&y.startsWith("on")){const L=y.charAt(2).toLowerCase()+y.slice(3);l==null||l.on(L,$)}}),l.on("change",y=>{i("change",y)}),l.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),l.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),l.on("doneEdit",()=>{v.value="text"}),l.on("selectionChange",y=>{s.value=y,i("selectionChange",y)}),i("ready",l))});function _(y){if(!l||!x.value)return;const{rowKey:$,key:L}=x.value;l==null||l.setItemValueByEditor($,L,y)}const O=()=>document.body;return c.watch(()=>o.data,y=>{l==null||l.loadData(y)},{deep:!0}),Or(()=>o.columns,(y,$)=>{T.isEqual(y,$)||l==null||l.loadColumns(y.map(L=>I(L)))},{deep:!0}),c.watch(()=>a.value.config,y=>{l==null||l.loadConfig(y)},{deep:!0}),c.watch(()=>o.footerData,y=>{l==null||l.loadFooterData(y||[])},{deep:!0}),c.watch(()=>o.loading,(y,$)=>{y!==$&&(l==null||l.setLoading(y))},{immediate:!0}),e({$table:l,selectedRecords:c.computed(()=>s.value),reloadData:()=>{l==null||l.loadData(o.data)}}),(y,$)=>{const L=c.resolveComponent("a-empty"),Y=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(Y,{spinning:y.loading},{default:c.withCtx(()=>{var V,P,W,G,q,He,lt;return[c.createElementVNode("div",{ref_key:"eVirtTableRef",ref:f},[c.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:u},[v.value.startsWith("__slot:")?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:c.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":$[0]||($[0]=he=>x.value.value=he),cell:x.value,onBlur:_},null,40,["style","value","cell"])):(V=c.unref(At).renders[v.value])!=null&&V.renderEdit?(c.openBlock(),c.createBlock(c.unref(Vb),{key:1,"cell-render":C[x.value.key],class:"ev-editor-wrapper",style:c.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(P=x.value)==null?void 0:P.row,rowIndex:((W=x.value)==null?void 0:W.rowIndex)??-1,field:((G=x.value)==null?void 0:G.key)??"",title:((He=(q=x.value)==null?void 0:q.column)==null?void 0:He.title)??""},bordered:!1,"get-popup-container":O,onBlur:_},null,8,["cell-render","style","render-table-params"])):c.createCommentVNode("",!0)],512),c.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[c.renderSlot(y.$slots,"empty",{},()=>[c.createVNode(L,{description:"空数据"})])],512),c.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(((lt=p.value)==null?void 0:lt.views)||[],he=>(c.openBlock(),c.createElementBlock("div",{class:c.normalizeClass(he.class),style:c.normalizeStyle(he.style),key:he.type},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(he.views,Ge=>(c.openBlock(),c.createElementBlock("div",{style:c.normalizeStyle(Ge.style),key:Ge.key},[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(Ge.cells,ee=>(c.openBlock(),c.createElementBlock("div",c.mergeProps({class:"canvas-cell",key:`${ee.rowKey}_${ee.key}`,style:{...ee.style}},{ref_for:!0},ee.domDataset),[typeof ee.render=="function"?(c.openBlock(),c.createBlock(c.resolveDynamicComponent(ee.render(ee)),{key:0,bordered:!1})):typeof ee.render=="string"&&ee.render.startsWith("slot:")?c.renderSlot(y.$slots,ee.render.replace("slot:",""),c.mergeProps({key:1,ref_for:!0},ee,{cell:ee})):c.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Wb={key:0},Xb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},zb={class:"flex items-center flex-1 gap-4px"},Gb={key:2},Ub={class:"flex items-center gap-4px"},qb={class:c.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Zb={key:0,class:"w-full text-slate-5 pl-4"},al=c.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>vt().lazyReset??!1},fitHeight:{default:()=>vt().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var Jt,Qt,jt,ei,ti;const i=r,s=c.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:l,toolbarConfig:d,proxyConfig:f,config:u,staticConfig:g}=c.toRefs(i),m=Na(),x=c.ref(De()),v=c.ref({}),p=c.computed(()=>({...i,config:{...m,...i.config}})),E=c.computed(()=>f.value&&f.value.ajax?a.value?"pagination":"list":"bad");c.computed(()=>E.value==="pagination"?{current:b.page,total:N.value,pageSize:b.size,responsive:!1,showSizeChanger:!0,showTotal:M=>`共${M}条数据`}:!1);const C=c.computed(()=>T.omit({labelCol:Tr,...n.value},["items"])),w=c.reactive({toolbar:!1,form:!1,table:!1}),b=c.reactive({page:1,size:((Jt=a.value)==null?void 0:Jt.pageSize)??10}),S=c.ref(0),N=c.ref(0),K=c.ref([]),R=c.ref(),I=c.ref(),_=c.ref(),O=c.ref(),y=c.ref(500),$=c.ref({}),L=M=>{$.value[b.page]=M},Y=c.reactive([...(((jt=(Qt=i.toolbarConfig)==null?void 0:Qt.buttons)==null?void 0:jt.map(M=>M.code))??[]).filter(M=>M),...(((ti=(ei=i.toolbarConfig)==null?void 0:ei.tools)==null?void 0:ti.map(M=>M.code))??[]).filter(M=>M)].reduce((M,B)=>(M[B]=!1,M),{})),V=(M,B)=>{Y[M]=B},P=M=>{T.isObject(M)?(Object.prototype.hasOwnProperty.call(M,"toolbar")&&(w.toolbar=M.toolbar),Object.prototype.hasOwnProperty.call(M,"form")&&(w.form=M.form),Object.prototype.hasOwnProperty.call(M,"table")&&(w.table=M.table)):T.isBoolean(M)&&(w.form=M,w.toolbar=M,w.table=M)},W=c.computed(()=>T.uniq(Object.values($.value).flat(),M=>{var B;return M[((B=p.value.config)==null?void 0:B.ROW_KEY)??"id"]})),G=()=>{Ue()},q=c.computed(()=>W.value.map(M=>{var B;return M[((B=p.value.config)==null?void 0:B.ROW_KEY)??"id"]})),He=(M,B)=>B?{list:T.isString(B.list)?T.get(M,B.list):T.isFunction(B.list)?B.list(M):void 0,total:T.isString(B.total)?T.get(M,B.total):T.isFunction(B.total)?B.total(M):void 0,result:T.isString(B.result)?T.get(M,B.result):T.isFunction(B.result)?B.result(M):void 0,message:T.isString(B.message)?T.get(M,B.message):T.isFunction(B.message)?B.message(M):void 0}:{list:M},lt=M=>{o("toolbarButtonClick",{data:K.value,code:M,selectedKeys:q.value,records:W.value}),ht(M)},he=T.debounce(lt,100),Ge=({key:M})=>he(M),ee=M=>{o("toolbarToolClick",{data:K.value,code:M,selectedKeys:q.value,records:W.value}),ht(M)},Fi=T.debounce(ee,100),ve=()=>new Promise(M=>{if(E.value!=="bad"){P({table:!0,form:!0});const{ajax:B}=f.value;B.query({form:v.value,page:b}).then(U=>{const{list:Le,total:Be,result:de,message:me}=He(U,f.value.response);Le?(K.value=Le,S.value++):de?(K.value=de,N.value=Be??de.length,S.value++):(K.value=[],S.value++,me&&pi(me)),M(K.value)}).catch(U=>{console.error("fetchData error",U),M([])}).finally(()=>{P({table:!1,form:!1})})}}),Ki=(M,B)=>(b.page=M,b.size=B,ve()),Ue=()=>(b.page=1,$.value={},ve()),ct=T.debounce(ve,160),Zt=(M,B)=>(Object.assign(v.value,M),b.page=1,B?Promise.resolve():ct()),Pi=(M,B)=>(v.value=M,b.page=1,B?Promise.resolve():ct()),ht=M=>{const{ajax:B}=f.value;switch(M){case"multiDelete":B.multiDelete&&(q.value.length>0?Ya({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{P({table:!0,toolbar:!0}),B.multiDelete(q.value).then(()=>{hC("删除成功"),Ue()}).catch(()=>{dC("删除失败")}).finally(()=>{P({table:!1,toolbar:!1}),Y.multiDelete=!1})}):pi("请选择要删除的数据"));break}},Yi=c.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?l.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...l.value]),qe=M=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const B={};Mt(n.value.items,U=>{U.field&&U.itemRender?ue(U.itemRender.defaultValue)?B[U.field]=U.itemRender.defaultValue:B[U.field]=void 0:U.field&&U.slots&&(ue(U.slots.defaultValue)?B[U.field]=U.slots.defaultValue:B[U.field]=void 0)}),v.value=B}o("resetQuery")}b.page=1,M||ct()},dt=()=>($.value={},qe()),Ze=()=>{var de,me;const M=(de=_.value)==null?void 0:de.parentElement,B=M?window.getComputedStyle(M).height:"0px",U=O.value?window.getComputedStyle(O.value).height:"0px",Le=U.includes("px")?T.toNumber(U.replace("px","")):0,Be=(me=g.value)!=null&&me.showCount?22:0;y.value=T.toNumber(B.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-Le-Be};let Tt;return c.onMounted(()=>{Ze(),window.addEventListener("resize",Ze),Tt=new MutationObserver(M=>{M.forEach(B=>{if(B.type==="attributes"&&B.attributeName==="style"){const U=B.target;window.getComputedStyle(U).display!=="none"&&Ze()}})}),_.value&&Tt.observe(_.value,{attributes:!0,attributeFilter:["style"]}),qe(i.manualFetch)}),c.onBeforeUnmount(()=>{window.removeEventListener("resize",Ze),Tt.disconnect()}),e({commitProxy:{query:ct,reload:dt,reloadPage:Ue,passQuery:Zt,forcePassQuery:Pi},$canvasTable:c.computed(()=>I.value),selectedRowKeys:q,setBtnLoading:V,selectedRecords:W,$form:c.computed(()=>R.value),getFormData:()=>v.value,setLoadings:P,resizeTable:Ze}),(M,B)=>{var de,me,Ot;const U=c.resolveComponent("a-menu-item"),Le=c.resolveComponent("a-menu"),Be=c.resolveComponent("a-dropdown");return c.openBlock(),c.createElementBlock("div",c.mergeProps({ref_key:"boxEl",ref:_,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},c.unref(s)),[E.value==="bad"?(c.openBlock(),c.createElementBlock("div",Wb,"请检查配置")):(c.openBlock(),c.createElementBlock(c.Fragment,{key:1},[(me=(de=c.unref(n))==null?void 0:de.items)!=null&&me.some(F=>F.field&&F.itemRender)?(c.openBlock(),c.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[c.createVNode(c.unref(A.Spin),{spinning:w.form},{default:c.withCtx(()=>[(c.openBlock(),c.createBlock(c.unref(A.Form),c.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},C.value,{onSubmit:G}),{default:c.withCtx(()=>[c.createVNode(c.unref(A.Row),{gutter:[6,12]},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(n).items,(F,k)=>(c.openBlock(),c.createBlock(Lr,{key:`_col_${F.field||k}`,"form-data":v.value,item:F,onReset:B[0]||(B[0]=D=>qe(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):c.createCommentVNode("",!0),c.unref(d)?(c.openBlock(),c.createElementBlock("div",Xb,[c.createElementVNode("div",zb,[c.unref(d).buttons&&c.unref(d).buttons.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).buttons,(F,k)=>(c.openBlock(),c.createElementBlock(c.Fragment,{key:k},[F.dropdowns&&F.dropdowns.length?(c.openBlock(),c.createBlock(Be,{key:0},{overlay:c.withCtx(()=>[c.createVNode(Le,{onClick:Ge},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(F.dropdowns,D=>(c.openBlock(),c.createBlock(U,{key:D.code},{default:c.withCtx(()=>[c.createTextVNode(c.toDisplayString(D.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:c.withCtx(()=>[c.createVNode(c.unref(A.Button),{type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content)+" ",1),c.createVNode(c.unref(pt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(c.openBlock(),c.createBlock(c.unref(A.Button),{key:1,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:D=>c.unref(he)(F.code)},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(c.openBlock(),c.createElementBlock("div",Gb))],64))),128)):c.createCommentVNode("",!0)]),c.createElementVNode("span",Ub,[c.unref(d).tools&&c.unref(d).tools.length>0?(c.openBlock(!0),c.createElementBlock(c.Fragment,{key:0},c.renderList(c.unref(d).tools,(F,k)=>(c.openBlock(),c.createBlock(c.unref(A.Button),{key:k,type:F.type,size:F.size??"middle",disabled:c.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:D=>c.unref(Fi)(F.code),loading:w.toolbar||!!F.code&&Y[F.code]},{default:c.withCtx(()=>[F.icon?(c.openBlock(),c.createBlock(c.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):c.createCommentVNode("",!0),c.createTextVNode(" "+c.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):c.createCommentVNode("",!0)])])):c.createCommentVNode("",!0),c.createElementVNode("div",qb,[(Ot=c.unref(g))!=null&&Ot.selectable&&c.unref(g).showCount?(c.openBlock(),c.createElementBlock("div",Zb," 已选:"+c.toDisplayString(q.value.length),1)):c.createCommentVNode("",!0),c.createVNode(Wr,{ref_key:"canvasTableRef",ref:I,columns:Yi.value,config:{...p.value.config,HEIGHT:y.value},data:K.value,loading:w.table,onSelectionChange:L},c.createSlots({_:2},[c.renderList(M.$slots,(F,k)=>({name:k,fn:c.withCtx(D=>[c.renderSlot(M.$slots,k,c.normalizeProps(c.guardReactiveProps(D)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(c.openBlock(),c.createBlock(c.unref(A.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:b.page,"page-size":b.size,total:N.value,onChange:Ki},null,8,["current","page-size","total"])):c.createCommentVNode("",!0)])],64))],16)}}}),Xr=c.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=c.ref(),{source:s}=c.toRefs(t),o=c.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=c.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,l)=>(c.openBlock(),c.createBlock(Dr,c.mergeProps({ref_key:"formEl",ref:i},n.value,{data:c.unref(s)}),null,16,["data"]))}}),Jb=c.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(r,{expose:e}){const t=r,i=c.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=c.resolveComponent("a-collapse-panel"),a=c.resolveComponent("a-collapse"),l=c.resolveComponent("a-card");return s.collapsible?(c.openBlock(),c.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:c.withCtx(()=>[c.createVNode(n,{key:"content","force-render":"",header:s.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,f)=>({name:f,fn:c.withCtx(()=>[c.renderSlot(s.$slots,f)])}))]),1032,["header"])]),_:3},8,["active-key"])):(c.openBlock(),c.createBlock(l,{key:1,size:"small",title:s.title},c.createSlots({_:2},[c.renderList(s.$slots,(d,f)=>({name:f,fn:c.withCtx(()=>[c.renderSlot(s.$slots,f)])}))]),1032,["title"]))}}}),ll=c.defineComponent({__name:"PFormGroup",props:c.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:e}){const t=A.Form.useForm,i=c.ref(),s=r,o=c.ref(),n=c.useModel(r,"modelValue"),a=c.ref(0),l=c.ref([]),d=c.ref([]),f=R=>{a.value=R},u=c.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(_=>{var O;n.value=[...n.value,{..._,__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var I,_,O,y,$,L;return(($=(y=(O=(_=(I=R==null?void 0:R.parentElement)==null?void 0:I.parentElement)==null?void 0:_.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:$.parentElement)??((L=o.value)==null?void 0:L.$el)??document.body},v=c.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var _;const I=(_=n.value.find((O,y)=>y===R))==null?void 0:_.__index;Z(I)&&(l.value=l.value.filter(O=>O!==I))},E=()=>{c.nextTick().then(()=>{var R,I;p(a.value),(I=(R=d.value[a.value])==null?void 0:R.$form)==null||I.validate()})},C=(R,I)=>{var _;return((_=s.getTabLabel)==null?void 0:_.call(s,R,I))??`${s.tabLabel} ${s.keepSerial?I+1:(R.__index??0)+1}`};c.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(I=>!Z(I.__index));R.length>0&&R.forEach(I=>{var _;I.__index=(((_=T.max(n.value,O=>O.__index??-1))==null?void 0:_.__index)??-1)+1})}},{immediate:!0});const w=({key:R},I,_)=>{var O;if(s.menuHandler&&T.isFunction(s.menuHandler))s.menuHandler({code:T.toString(R),data:I,index:_});else switch(R){case"delete":n.value=n.value.filter((y,$)=>$!==_),c.nextTick(()=>{d.value=d.value.filter(y=>!!y),_<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=u.value){pi("已达到最大数量");return}n.value=[...n.value,T.clone({...T.omit(I,["id","__index"]),__index:(((O=T.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},b=T.debounce(w,100);c.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const S=T.debounce(p,50);c.watchEffect(()=>{var _;const R=n.value.map((O,y)=>l.value.includes(O.__index)?y:void 0).filter(Z),I=(_=i.value)==null?void 0:_.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,$)=>{R.includes($)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,I;(I=(R=o.value)==null?void 0:R.collapse)==null||I.call(R)},expand:()=>{var R,I;(I=(R=o.value)==null?void 0:R.expand)==null||I.call(R)},activeKey:c.computed(()=>a.value),setActiveKey:f,validateAll:()=>{const R=v.value?d.value.map(I=>{var _;return(_=I.$form)==null?void 0:_.validate()}):n.value.map(I=>{var _;return((_=t(I,s.getFormSetting(I).rules))==null?void 0:_.validate())??Promise.resolve()});return Promise.allSettled(R).then(I=>{if(l.value=I.map((_,O)=>{var y;return _.status==="rejected"&&typeof((y=n.value[O])==null?void 0:y.__index)=="number"?n.value[O].__index:void 0}).filter(_=>typeof _=="number"),!s.lazyErrorMark&&l.value.length){const _=l.value[0],O=n.value.findIndex(y=>y.__index===_);O!==-1&&(a.value=O)}return l.value.length?Promise.reject({error_indexes:l.value,results:I}):Promise.resolve(I)})},validate:async(R,I)=>{var O,y,$;const _=n.value.findIndex(L=>L.__index===R);try{return await(v.value?((y=(O=d.value[_])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():(($=t(n.value[_],s.getFormSetting(n.value[_]).rules))==null?void 0:$.validate())??Promise.resolve()),l.value=l.value.filter(L=>L!==R),Promise.resolve()}catch(L){return!l.value.includes(R)&&!I&&(l.value=[...l.value,R]),Promise.reject(L)}},validateFields:async(R,I,_)=>{var Y,V;const O=n.value.findIndex(P=>P.__index===R),$=s.getFormSetting(n.value[O]).rules,L=t(n.value[O],$);try{return await(v.value?((V=(Y=d.value[O])==null?void 0:Y.$form)==null?void 0:V.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(P=>L.validateField(P,n.value[O][P],$[P]??[])))),Promise.resolve()}catch(P){return!l.value.includes(R)&&!_&&(l.value=[...l.value,R]),Promise.reject(P)}}});const N=c.useSlots(),K=c.computed(()=>Object.keys(N).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,I)=>{const _=c.resolveComponent("a-spin");return c.openBlock(),c.createBlock(Jb,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},c.createSlots({default:c.withCtx(()=>[R.loading?(c.openBlock(),c.createBlock(_,{key:0,class:"w-full"})):(c.openBlock(),c.createBlock(c.unref(A.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:c.withCtx(()=>[c.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<u.value?(c.openBlock(),c.createBlock(c.unref(A.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>g(n.value.length))},{default:c.withCtx(()=>I[2]||(I[2]=[c.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):c.createCommentVNode("",!0)])]),default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(n.value,(O,y)=>(c.openBlock(),c.createBlock(c.unref(A.TabPane),{key:y,tab:C(O,y),"force-render":v.value},{closeIcon:c.withCtx(()=>{var $;return[R.editAble&&(($=c.unref(m))!=null&&$.length)?(c.openBlock(),c.createBlock(c.unref(A.Dropdown),{key:0,"get-popup-container":x},{overlay:c.withCtx(()=>[c.createVNode(c.unref(A.Menu),{onClick:L=>c.unref(b)(L,O,y)},{default:c.withCtx(()=>[(c.openBlock(!0),c.createElementBlock(c.Fragment,null,c.renderList(c.unref(m).filter(L=>{var Y;return((Y=L.visibleMethod)==null?void 0:Y.call(L,{data:O,index:y}))??!0}),L=>(c.openBlock(),c.createBlock(c.unref(A.MenuItem),{key:L.code},{default:c.withCtx(()=>[c.createElementVNode("div",null,c.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:c.withCtx(()=>[c.createVNode(c.unref(pt.MoreOutlined))]),_:2},1024)):c.createCommentVNode("",!0)]}),default:c.withCtx(()=>[(c.openBlock(),c.createBlock(Xr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:$=>c.unref(S)(y),onClickCapture:$=>c.unref(S)(y)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[c.renderList(K.value,O=>({name:O.target,fn:c.withCtx(()=>[c.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),Qb={class:"w-full text-right p-2"},cl=c.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(r,{expose:e}){const t=c.ref(),i=c.ref(!1),s=r,o=c.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,l;const d=c.reactive({modal:!1}),f=()=>{l&&l()},u=()=>{d.modal=!1,l&&l()},g=({row:x,field:v})=>{n&&!o.value&&s.beforePick(x).then(()=>{d.modal=!1,n({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?pi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return c.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,l=v,i.value=!1,d.modal=!0,c.nextTick(()=>{i.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(c.openBlock(),c.createBlock(c.unref(A.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:x.title,width:x.width,footer:o.value?void 0:null,onCancel:f,"body-style":x.bodyStyle},c.createSlots({default:c.withCtx(()=>[c.createElementVNode("div",{style:c.normalizeStyle({minHeight:i.value?"unset":"642px"})},[c.createVNode($r,c.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:c.withCtx(()=>[c.createElementVNode("div",Qb,[c.createElementVNode("span",null,[c.createVNode(c.unref(A.Button),{class:"mr-4",onClick:u},{default:c.withCtx(()=>v[1]||(v[1]=[c.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),c.createVNode(c.unref(A.Button),{type:"primary",onClick:m},{default:c.withCtx(()=>v[2]||(v[2]=[c.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function hl(r){r&&Aa(r)}const jb={install(r){r.component("PForm",Dr),r.component("PGrid",$r),r.component("PCanvasTable",Wr),r.component("PCanvasGrid",al),r.component("PFormGroup",ll),r.component("PGroupBlock",Xr),r.component("PromisePicker",cl)},addFormatter:Ba,addRender:kr,setup:hl};exports.PCanvasGrid=al;exports.PCanvasTable=Wr;exports.PForm=Dr;exports.PFormGroup=ll;exports.PGrid=$r;exports.PGroupBlock=Xr;exports.PromisePicker=cl;exports.addFormatter=Ba;exports.addRender=kr;exports.cleanCol=Ai;exports.default=jb;exports.defaultItemResponsive=Sr;exports.defaultLabelCol=Tr;exports.get24rest=Ha;exports.getButtonResponsive=Q2;exports.getUIKitConfig=q2;exports.labelColDict=J2;exports.resetUIKitConfig=Z2;exports.setUIKitConfig=Aa;exports.setup=hl;exports.watchPreviousDeep=Or;
|
|
3
|
+
`)}return o}function Ga(r,e,t=[]){let i=0;const s=[];return r.forEach((o,n)=>{if(n===0)s.push(1);else{const a=t.reduce((d,f)=>`${d}${o[f]??""}`,"")||o[e],c=t.reduce((d,f)=>`${d}${r[n-1][f]??""}`,"")||r[n-1][e];a===c?(s[i]+=1,s.push(0)):(s.push(1),i=n)}}),s}function Ua(r,e){let t="",i="";const s={};return e.forEach((o,n)=>{n===0?(t=o.key,i=o.key,s[o.key]=1):r[o.key]===r[t]?(s[o.key]=0,s[i]+=1):(s[o.key]=1,t=o.key,i=o.key)}),s}function SC(r,e,t=[]){const{visibleRows:i,rowIndex:s,headIndex:o}=r,n=Ga(i,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 TC(r,e=[]){const{column:t,row:i,visibleLeafColumns:s}=r,o=s.filter(n=>e.includes(n.key));if(e.includes(t.key)){const n=Ua(i,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 OC(r,e=document.documentElement){const t=r.startsWith("--")?r:`--${r}`;return getComputedStyle(e).getPropertyValue(t).trim()}function Oo(r){if(!r)return new Date(0);if(typeof r=="number")return new Date(r);const e=String(r).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const i=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of i){const o=e.match(s);if(o){const n=o.slice(1).map(Number);if(s.source.includes("YYYY-MM-DD")||s.source.includes("YYYY/MM/DD")||s.source.includes("YYYY.MM.DD")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(a,c-1,d,f,u,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,c-1,a,f,u,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[a,c,d,f=0,u=0,g=0]=n;return new Date(d,a-1,c,f,u,g)}else if(s.source.includes("YYYYMMDD")){const[a,c,d]=n;return new Date(a,c-1,d)}}}return new Date(NaN)}function kC(r,e){const t=Oo(r),i=Oo(e);return isNaN(t.getTime())&&isNaN(i.getTime())?0:isNaN(t.getTime())?-1:isNaN(i.getTime())?1:t.getTime()-i.getTime()}class qa{constructor(e,t,i,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=i,this.width=s,this.height=o,this.fixed=a,this.cellType=n}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:i,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-i<=0||this.x-i>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,i=e;return!(this.y+this.height-t<=0||this.y-t>=i)}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 Br extends qa{constructor(e,t,i,s,o,n,a,c,d,f="body",u=!0){super(e,s,o,n,a,f,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,"domDataset",{}),h(this,"rules",[]),h(this,"message",""),h(this,"text",""),h(this,"displayText",""),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"isHasChanged",!1),h(this,"drawX",0),h(this,"drawY",0),h(this,"drawCellBgColor",""),h(this,"drawCellSkyBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=i,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=f,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed||"",this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=d,this.rowKey=this.cellType==="body"?this.ctx.database.getRowKeyForRowIndex(t):`${this.cellType}_${this.rowIndex}`,this.value=this.getValue(),this.render=c.render,this.overflowTooltipShow=c.overflowTooltipShow!==!1,this.autoRowHeight=c.autoRowHeight!==void 0?c.autoRowHeight:this.ctx.config.AUTO_ROW_HEIGHT,this.overflowTooltipMaxWidth=c.overflowTooltipMaxWidth||500,this.overflowTooltipPlacement=c.overflowTooltipPlacement||"top",this.renderFooter=c.renderFooter,this.hoverIconName=c.hoverIconName,this.formatter=c.formatter,this.formatterFooter=c.formatterFooter,this.maxLineClamp=c.maxLineClamp||"auto",u&&this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:i=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=i,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:i,props:s={}}=t;this.editorType=i,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:i}=this;let s,o=0,n="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&i==="body"))return;const a=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:f=!1,level:u=0}=a||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:m,TREE_ICON_SIZE:x}=this.ctx.config;if(o=u*g,f){const T=this.ctx.icons.get("loading");n="loading",s=T}else if(d){const T=this.ctx.icons.get("expand"),B=this.ctx.icons.get("shrink");s=c?B:T,n=c?"shrink":"expand"}let v=x,p=x,E=this.drawX;(this.align==="center"||this.align==="right")&&(E=this.drawX+(this.visibleWidth-v-2*e)/2,this.align="left");let C=E+o+e,w=this.drawY+(this.visibleHeight-p)/2,b=o+this.drawX+v-.5;this.type==="selection-tree"?(C=o+this.drawSelectionImageX+this.drawSelectionImageWidth,b=C+v-e/2):this.type==="tree-selection"?b=C+m+v-e/2:b=C+v-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(C+v+e>this.drawX+this.visibleWidth)&&(w+p+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=C,this.drawTreeImageY=w,this.drawTreeImageWidth=v,this.drawTreeImageHeight=p,s?(this.drawTreeImageName=n,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:i=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},n=o.level??0,a=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-n*t;const f=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(n>0){for(let x=0;x<n-1;x+=1){const v=f[x+1];if((v?this.ctx.database.getRowForRowKey(v)||{}:{}).isLastChild)continue;const p=Math.round(this.drawTreeImageX-(n-x)*t+i/2);this.ctx.paint.drawLine([p,this.drawY,p,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const u=Math.round(this.drawTreeImageX-t+i/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([u,this.drawY,u,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const m=Math.round(d+(n-1)*t+i/2);this.ctx.paint.drawLine([m,c,a,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const u=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([a,u,a,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:i,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:n,FOOTER_TEXT_COLOR:a,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:f,HIGHLIGHT_HOVER_ROW:u,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:m,STRIPE_COLOR:x,FINDER_CELL_BG_COLOR:v}=this.ctx.config;if(this.cellType==="footer"){let _=c,O=a;if(typeof s=="function"){const y=s,{backgroundColor:D,color:L,font:Y}=y({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};D&&(_=D),L&&(O=L),Y&&(this.drawTextFont=Y)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=_,this.drawTextColor=O;return}let p="transparent";const E=this.ctx.hoverCell,C=this.ctx.currentCell;let w=this.rowIndex,b=this.rowIndex;if(this.rowspan!==1&&(u||d)){const _=this.getSpanInfo(),{yArr:O}=_;w=O[0],b=O[1]}u&&E&&(E.rowKey===this.rowKey&&(p=g),E.rowIndex>=w&&E.rowIndex<=b&&(p=g)),d&&C&&(C.rowKey===this.rowKey&&(p=f),C.rowIndex>=w&&C.rowIndex<=b&&(p=f)),this.drawCellSkyBgColor=p;let T=e,B=n;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(T=t,B=o),m&&(this.rowIndex%2?T=x:T=e),typeof i=="function"){const _=i,{backgroundColor:O,color:y,font:D}=_({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};O&&(T=O),y&&(B=y),D&&(this.drawTextFont=D)}const{rowIndex:K,colIndex:R,type:I}=this.ctx.finderBar;K===this.rowIndex&&R===this.colIndex&&I==="body"&&(T=v),this.drawCellBgColor=T,this.drawTextColor=B}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:i,colspan:s,cellType:o,type:n,rowIndex:a,rowKey:c}=this;if(i===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(n))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:f=0,CELL_PADDING:u}=this.ctx.config;let g=this.drawX+u;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-f)/2);let m=g,x=this.drawY+(t-f)/2;if(n!=="selection-tree"&&n==="tree-selection"){const{TREE_INDENT:E=16,TREE_ICON_SIZE:C}=this.ctx.config,w=this.ctx.database.getRowForRowKey(c),{level:b=0}=w||{},T=b*E;m=g+C+T}let v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck";if(n==="selection-tree"||n==="tree-selection"){const E=this.ctx.database.getTreeSelectionState(c);E.indeterminate&&d?(v=this.ctx.icons.get("checkbox-indeterminate"),p="checkbox-indeterminate"):E.checked&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):!E.checked&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}else{const E=this.ctx.database.getRowSelection(c);E&&d?(v=this.ctx.icons.get("checkbox-check"),p="checkbox-check"):E&&!d?(v=this.ctx.icons.get("checkbox-check-disabled"),p="checkbox-check-disabled"):!E&&d?(v=this.ctx.icons.get("checkbox-uncheck"),p="checkbox-uncheck"):(v=this.ctx.icons.get("checkbox-disabled"),p="checkbox-disabled")}m+f+u>this.drawX+this.visibleWidth||x+f+u>this.drawY+this.visibleHeight||(n==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===a||["checkbox-disabled","checkbox-check"].includes(p))&&(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v):(this.drawSelectionImageX=m,this.drawSelectionImageY=x,this.drawSelectionImageWidth=f,this.drawSelectionImageHeight=f,this.drawSelectionImageName=p,this.drawSelectionImageSource=v))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:i,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-i,a=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:f}=d,u=f[0],g=f[1];if(o.rowIndex>=u&&o.rowIndex<=g){const{width:m,height:x,offsetTop:v,offsetLeft:p}=d;n=this.drawX-p+m-t-i,a=this.drawY-v+(x-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=n,this.drawHoverImageY=a,this.drawHoverImageWidth=t,this.drawHoverImageHeight=t,this.drawHoverImageName=this.hoverIconName,this.drawHoverImageSource=c}}getAutoHeight(){if(this.cellType!=="body"||!this.autoRowHeight||this.rowspan===0)return 0;if(this.render){const n=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?n<this.visibleHeight?0:Math.round(n-(this.visibleHeight-this.height)):Math.round(n)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:i}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:this.drawTextFont||e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:i,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?o<this.visibleHeight?0:Math.round(o-(this.visibleHeight-this.height)):Math.round(o)}getSpanInfo(){return this.ctx.database.getSpanInfo(this)}getDisplayText(){return this.cellType==="footer"?this.renderFooter||this.text===null||this.text===void 0?"":this.text:this.rowspan===0||this.colspan===0||this.render||this.type==="index-selection"&&(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===this.rowIndex||["checkbox-disabled","checkbox-check"].includes(this.drawSelectionImageName))||this.text===null||this.text===void 0?"":`${this.text}`}getText(){if(this.cellType==="footer")return typeof this.formatterFooter=="function"?this.formatterFooter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.row[this.key]}):this.row[this.key];if(typeof this.formatter=="function")return this.formatter({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});const{BODY_CELL_FORMATTER_METHOD:e}=this.ctx.config;return typeof e=="function"?e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()}):["index-selection","index"].includes(this.type)?`${this.rowIndex+1}`:(this.value=this.ctx.database.getItemValue(this.rowKey,this.key),this.value)}getValue(){return this.ctx.database.getItemValue(this.rowKey,this.key)}setValue(e){this.ctx.setItemValueByEditor(this.rowKey,this.key,e)}getOverlayerViewsStyle(){let e=this.drawX-this.ctx.fixedLeftWidth,t=this.drawY-this.ctx.body.y;if(this.fixed==="left"?e=this.drawX:this.fixed==="right"&&(e=this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=this.drawY-this.ctx.footer.y),this.autoRowHeight&&this.render&&this.verticalAlign==="middle"){const i=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);if(i<this.visibleHeight&&i>0){const s=(this.visibleHeight-i)/2;t=t+s}}return this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e=-99999,t=-99999),{position:"absolute",overflow:"hidden",left:`${Math.round(e-1)}px`,top:`${Math.round(t-1)}px`,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),i||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:i,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!i||!t||this.ctx.editing)return;const{xArr:o,yArr:n}=this.ctx.selector,a=o[1],c=n[1],{colIndex:d,rowIndex:f,drawX:u,drawY:g}=this;if(d===a&&f===c){const m=d===this.ctx.maxColIndex||f===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(u+this.width-m,g+this.height-m,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let i=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];i+=o.width}return i}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:i,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let n=this.displayText,a=this.drawTextColor;if(!this.ctx.database.getReadonly(this.rowKey,this.key)&&o&&["",null,void 0].includes(this.text)&&this.cellType==="body"&&!(this.rowspan===0||this.colspan===0)&&(n=o,a=i),["",null,void 0].includes(n))return!1;typeof n!="string"&&(n=`${n}`);const c=`${n}_${this.drawTextWidth}_${this.drawTextFont}`;return this.ellipsis=this.ctx.paint.drawText(n,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:a,autoRowHeight:this.autoRowHeight,lineHeight:s,maxLineClamp:this.maxLineClamp,cacheTextKey:c}),this.ellipsis}drawImage(){if(this.drawSelectionImageSource&&this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight),this.drawTreeImageSource&&this.ctx.paint.drawImage(this.drawTreeImageSource,this.drawTreeImageX,this.drawTreeImageY,this.drawTreeImageWidth,this.drawTreeImageHeight),this.drawHoverImageSource){const{CELL_HOVER_ICON_BG_COLOR:e,CELL_HOVER_ICON_BORDER_COLOR:t}=this.ctx.config;this.ctx.paint.drawRect(this.drawHoverImageX-2,this.drawHoverImageY-2,this.drawHoverImageWidth+4,this.drawHoverImageHeight+4,{borderColor:t,radius:4,borderWidth:1,fillColor:e}),this.ctx.paint.drawImage(this.drawHoverImageSource,this.drawHoverImageX,this.drawHoverImageY,this.drawHoverImageWidth,this.drawHoverImageHeight)}}drawSelector(){if(this.cellType==="footer")return;const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t,yArr:i,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:i,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[n,a]=t,[c,d]=i;!(n===a&&c===d)&&this.colIndex>=n&&this.colIndex<=a&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_AREA_COLOR||"rgba(82,146,247,0.1)"}),this.operation&&this.rowIndex>=c&&this.rowIndex<=d&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.visibleWidth,this.visibleHeight,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawErrorTip(){if(this.cellType==="footer"||!this.message||this.rowspan===0||this.colspan===0)return;const{ERROR_TIP_ICON_SIZE:e,ERROR_TIP_COLOR:t}=this.ctx.config,{width:i}=this,s=this.drawX,o=this.drawY,n=[s+i-e-.5,o,s+i-.5,o,s+i-.5,o+e];this.ctx.paint.drawLine(n,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:i,rowIndex:s,colIndex:o,height:n,width:a}=this;let c=t,d=i;const{xArr:f,yArr:u,lineDash:g=[],borderWidth:m=1,borderColor:x,fillColor:v}=e,p=f[0],E=f[1],C=u[0],w=u[1];if(o>=p&&o<=E&&s===C){const b=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([c+T,d+1,c+a-b,d+1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===E&&s>=C&&s<=w){const b=s===C?1:0,T=s===w?1:0;this.ctx.paint.drawLine([c+a-1,d+b,c+a-1,d+n-T],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=p&&o<=E&&s===w){const b=o===E?1:0,T=o===p?1:0;this.ctx.paint.drawLine([c+T,d+n-1,c+a-b,d+n-1],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===p&&s>=C&&s<=w){const b=s===w?1:0,T=s===C?1:0;this.ctx.paint.drawLine([c+1,d+T,c+1,d+n-b],{borderColor:x,fillColor:v,borderWidth:m,lineCap:"round",lineJoin:"round",lineDash:g})}}}class LC{constructor(e,t){h(this,"ctx"),h(this,"data"),h(this,"columns"),h(this,"footerData",[]),h(this,"rowKeyMap",new Map),h(this,"colIndexKeyMap",new Map),h(this,"headerMap",new Map),h(this,"rowIndexRowKeyMap",new Map),h(this,"rowKeyRowIndexMap",new Map),h(this,"checkboxKeyMap",new Map),h(this,"selectionMap",new Map),h(this,"expandMap",new Map),h(this,"originalDataMap",new Map),h(this,"changedDataMap",new Map),h(this,"validationErrorMap",new Map),h(this,"itemRowKeyMap",new WeakMap),h(this,"bufferData",[]),h(this,"customHeader",{fixedData:{},sortData:{},hideData:{},resizableData:{}}),h(this,"overlayerAutoHeightMap",new Map),h(this,"maxRowHeightCellMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:i=[],columns:s=[],footerData:o=[]}=t;this.data=i,this.footerData=o,this.columns=s,this.init()}init(e=!0){this.ctx.paint.clearTextCache(),this.clearBufferData(),this.rowKeyMap.clear(),this.checkboxKeyMap.clear(),this.colIndexKeyMap.clear(),this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear(),this.maxRowHeightCellMap.clear();const t=this.getColumns(),i=Ht(t);if(this.ctx.hasSelection=i.some(s=>s.type==="selection"),this.ctx.hasTree=i.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,i=[]){const s=e.length,{ROW_KEY:o="",DEFAULT_EXPAND_ALL:n,CELL_HEIGHT:a,SELECTABLE_METHOD:c,CHECKBOX_KEY:d,TREE_CHILDREN_KEY:f}=this.ctx.config;e.forEach((u,g)=>{var m;f!=="children"&&(u.children=u[f]);const x=u[o],v=x!=null?`${x}`:Xa();this.itemRowKeyMap.set(u,v);const p=u._height||a,E=u._readonly;let C=!0;if(typeof c=="function"&&(C=c),d){const b=u[d];if(this.checkboxKeyMap.has(b)){const T=this.checkboxKeyMap.get(b)||[];T.push(v),this.checkboxKeyMap.set(b,T)}else this.checkboxKeyMap.set(b,[v])}this.selectionMap.set(v,{key:d?u[d]:v,row:u,check:((m=this.selectionMap.get(v))==null?void 0:m.check)||!1});const w=n||this.expandMap.get(v)||u._expand||!1;this.expandMap.set(v,w),this.rowKeyMap.set(v,{readonly:E,index:g,rowIndex:g,level:t,height:p,calculatedHeight:-1,check:!1,selectable:C,expand:w,expandLazy:!1,hasChildren:u._hasChildren||(Array.isArray(u.children)?u.children.length>0:!1),expandLoading:!1,item:u,parentRowKeys:i,parentRowKey:i[i.length-1]||"",isLastChild:g===s-1}),Array.isArray(u.children)&&u.children.length&&this.initData(u.children,t+1,[...i,v])})}setRowHeight(e,t){const i=this.rowIndexRowKeyMap.get(e);if(i===void 0)return;const s=this.rowKeyMap.get(i);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=i,o.item._height=i}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){return e.every(({height:t,rowIndex:i})=>this.getPositionForRowIndex(i).calculatedHeight===t)?!1:(e.forEach(({rowIndex:t,height:i})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s),{height:n=-1}=this.getMaxRowHeightItem(s)||{};o.calculatedHeight=Math.max(i,n)}}),this.clearBufferData(),this.getData(),!0)}getAllRowsData(){let e=[];const t=i=>{i.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}generateColumns(e){const t=i=>i.map(s=>{var o,n,a,c,d,f,u,g;const m=s.children&&Array.isArray(s.children)?t(s.children):void 0,x={hide:(n=(o=this.customHeader)==null?void 0:o.hideData)==null?void 0:n[s.key],fixed:(c=(a=this.customHeader)==null?void 0:a.fixedData)==null?void 0:c[s.key],sort:(f=(d=this.customHeader)==null?void 0:d.sortData)==null?void 0:f[s.key],width:(g=(u=this.customHeader)==null?void 0:u.resizableData)==null?void 0:g[s.key]},v={};for(const[E,C]of Object.entries(x))C!==void 0&&(v[E]=C);const p=m&&m.every(E=>E.hide);return{...s,children:m,hide:p||(typeof s.hide=="function"?s.hide(s):s.hide),...v}});return t(e)}getColumns(){return this.generateColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const i=o=>{o.forEach(n=>{e.push(n);const a=this.itemRowKeyMap.get(n),{expand:c,hasChildren:d,height:f,calculatedHeight:u}=this.rowKeyMap.get(a),g=this.sumHeight,m=Math.max(u,f);this.sumHeight+=m,this.rowIndexRowKeyMap.set(t,a),this.rowKeyRowIndexMap.set(a,t),this.positions.push({top:g,height:m,bottom:this.sumHeight,calculatedHeight:u}),t+=1,c&&d&&i(n.children)})};this.rowIndexRowKeyMap.clear(),this.rowKeyRowIndexMap.clear();let s=this.data;if(typeof this.filterMethod=="function"&&(s=this.filterMethod(s)),this.sortState.size){const o=Array.from(this.sortState.entries()).sort((n,a)=>n[1].timestamp-a[1].timestamp);s=this.sortDataRecursive(s,o)}return i(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const i=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:i}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let i=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const n=this.getColumnByKey(s);!n||!n.column.sortBy||(i=this.applySingleColumnSort(i,s,o,n.column.sortBy))}return i.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,i,s){return e.sort((o,n)=>{const a=o[t],c=n[t];let d=0;if(typeof s=="function")d=s(o,n);else if(s==="number"){const f=Number(a)||0,u=Number(c)||0;d=f-u}else if(s==="string"){const f=String(a||""),u=String(c||"");d=f.localeCompare(u)}else s==="date"&&(d=kC(a,c));return i==="asc"?d:-d})}expandItem(e,t=!1){const i=this.rowKeyMap.get(e);i.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(i=>{const s=this.rowKeyMap.get(i);this.expandMap.set(i,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,i)=>{t.expand&&e.push(i)}),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 i=this.rowKeyMap.get(e);i.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const i=this.rowKeyMap.get(e);i.expand=!0,this.expandMap.set(e,!0),i.expandLazy=!0,i.item.children=t,this.initData(i.item.children,i.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 i=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return i===void 0||s===void 0?null:{rowKey:i,key:s,value:this.getItemValue(i,s)}}getItemValue(e,t){const i=this.rowKeyMap.get(e);return i&&i.item?i.item[t]===void 0?null:i.item[t]:null}async batchSetItemValue(e,t=!1,i=!0,s="none"){let o=[],n=i;const a=new Set;let c=[],d=e.map(x=>{const{rowKey:v,key:p}=x;let E=x.value,C=E;const w=this.getRowDataItemForRowKey(v),b=this.getItemValue(v,p),T=this.getVirtualBodyCellByKey(v,p);return(T==null?void 0:T.type)==="number"&&(["",void 0,null].includes(E)?C=null:/^-?\d+(\.\d+)?$/.test(`${E}`)?C=Number(E):(C=b,c.push({...x,value:C,oldValue:b,row:w}))),{...x,value:C,oldValue:b,row:w}});if(d=d.filter(x=>!c.some(v=>x.rowKey===v.rowKey&&x.key===v.key)),c.length){const x={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",x)}if(d=d.filter(x=>x.oldValue!==x.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:f}=this.ctx.config;s==="none"&&typeof f=="function"&&(d=await f(d),n=!1),d.forEach(x=>{const{value:v,rowKey:p,key:E}=x,C=this.getItemValue(p,E);a.add(p),this.setItemValue(p,E,v,!1,!1,!1,n),o.push({rowKey:p,key:E,oldValue:C,newValue:v})});let u=[];a.forEach(x=>{u.push(this.ctx.database.getRowDataItemForRowKey(x))});const g=d.map(({rowKey:x,key:v})=>this.getValidator(x,v));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())});const m=d.map(x=>{const v=!!this.getValidationError(x.rowKey,x.key).length;return{...x,errorTip:v}});this.ctx.emit("change",m,u),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,i,s=!1,o=!1,n=!1,a=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],f=i;if(a&&this.ctx.database.getReadonly(e,t))return{oldValue:d,newValue:d};c[t]!==null&&typeof c[t]=="object"&&(d=JSON.parse(JSON.stringify(c[t])));const u=`${e}_${t}`;this.originalDataMap.has(u)||this.originalDataMap.set(u,d);const g=this.originalDataMap.get(u),m=this.getRowDataItemForRowKey(e);if(n){const x=this.getVirtualBodyCellByKey(e,t);if((x==null?void 0:x.type)==="number")if(["",void 0,null].includes(i))f=null;else if(/^-?\d+(\.\d+)?$/.test(`${i}`))f=Number(i);else{f=d;const p={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:f,oldValue:d,row:m}]};this.ctx.emit("error",p)}if(f===d)return{oldValue:d,newValue:d};let v=[{rowKey:e,key:t,value:f,oldValue:d,row:m}];this.batchSetItemValue(v,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:g,row:m})}else this.changedDataMap.set(u,f),c[t]=f;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:f,originalValue:this.originalDataMap.get(u),row:m}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:f}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:i}=this.ctx.config;if(i){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[i];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(n=>{const a=this.selectionMap.get(n);a&&(a.check=t)})}}toggleRowSelection(e,t){const i=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",i);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),i=this.ctx.config.TREE_SELECT_MODE;if(i==="auto")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="cautious")t.checked&&!t.indeterminate?(this.clearTreeSelectionRecursive(e),this.setRowSelection(e,!1,!1)):(this.selectTreeSelectionRecursive(e),this.setRowSelection(e,!0,!1));else if(i==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!0),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelectionByParent(t,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const i=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=i.filter(c=>c==null?void 0:c.check).length,o=i.length;let n=!1;o>0&&(s===0?n=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?n=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(n=!1));const a=this.selectionMap.get(t);a&&a.check!==n&&(a.check=n,this.setRowSelectionByCheckboxKey(t,n),this.updateParentTreeSelection(t))}setRowSelection(e,t,i=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),i&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}setRowSelectionByParent(e,t){const i=this.selectionMap.get(e);i&&(i.check=t,this.setRowSelectionByCheckboxKey(e,i.check))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),i=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:i,indeterminate:!1};let s=!1,o=i;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const n=u=>{const g=this.getTreeChildren(u);let m=[];for(const x of g)m.push(x),m.push(...n(x));return m},a=n(e).map(u=>this.selectionMap.get(u)),c=a.filter(u=>u==null?void 0:u.check).length,d=a.length,f=c>0;s=f&&c!==d,o=i||f,i&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const n=g=>{const m=this.getTreeChildren(g);let x=[];for(const v of m)x.push(v),x.push(...n(v));return x},a=n(e).map(g=>this.selectionMap.get(g)),c=a.filter(g=>g==null?void 0:g.check).length,d=a.length,f=c>0,u=c===d;s=f&&!u,o=i||u,i&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=i);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const i=[],s=o=>{for(const n of o){const a=this.getRowKeyByItem(n);a&&i.push(a),n.children&&n.children.length>0&&s(n.children)}};return s(t.item.children),i}getTreeParent(e){const t=(i,s)=>{for(const o of i){const n=this.getRowKeyByItem(o);if(o.children)for(const a of o.children){if(this.getRowKeyByItem(a)===s)return n;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:i,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:i,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(i);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(i,!0))}}):this.rowKeyMap.forEach((t,i)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(i,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const n=this.selectionMap.get(o);n&&(n.check=!1,this.setRowSelectionByCheckboxKey(o,!1))}):this.rowKeyMap.forEach((s,o)=>{this.setRowSelection(o,!1,!1)}):(this.selectionMap.clear(),this.rowKeyMap.forEach((s,o)=>{this.selectionMap.set(o,{check:!1,row:s.item,key:o})}));const i=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",i),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const i=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,m)=>{var x;(x=this.selectionMap.get(m))!=null&&x.check&&(s+=1);let v=g.selectable;typeof v=="function"&&(v=v({row:g.item,rowIndex:g.rowIndex})),v&&(o+=1)});const c=n>i&&s===0&&a,d=o&&o>s&&s>0||c,f=o!==0,u=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:u,indeterminate:d,selectable:f},{check:u,indeterminate:d,selectable:f}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const i=this.colIndexKeyMap.get(e);if(i&&this.headerMap.has(i))return(t=this.headerMap.get(i))==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,i)=>{const s=this.originalDataMap.get(i),o=i.split("_")[0],n=i.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((i,s)=>{const o=this.originalDataMap.get(s),n=s.split("_")[0];o!==i&&e.add(n)});let t=[];return e.forEach(i=>{t.push(this.ctx.database.getRowDataItemForRowKey(i))}),t}isHasChangedData(e,t){const i=`${e}_${t}`;if(!this.changedDataMap.has(i))return!1;const s=this.originalDataMap.get(i),o=this.changedDataMap.get(i);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:i}=this.ctx.config;if(i)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 d=c({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:o.column,value:this.getItemValue(e,t)});if(d!==void 0)return d}return a||n}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(i=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:n}=this.ctx.config;if(s===void 0||o===void 0)return i([]);const a=o.column;let c=a.rules;if(typeof n=="function"){const d=n({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:a,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={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)},f=new CC(c).validate(d);this.setValidationError(e,t,f),i(f)}else this.clearValidationError(e,t),i([])})}getHeightByRowIndexRowSpan(e,t){let i=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(i+=o.height)}return i}getSpanInfo(e){const{rowIndex:t,key:i,rowKey:s,row:o,value:n,colIndex:a,relationRowKeys:c,relationColKeys:d,rowspan:f,height:u,width:g,colspan:m,mergeRow:x,mergeCol:v}=e;if(f===1&&m===1)return{xArr:[a,a],yArr:[t,t],rowspan:f,colspan:m,height:u,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:i,row:o,value:n}]};let p=t,E=t,C=a,w=a,b=[],T=0,B=0,K=0,R=0;if(f!==1&&x){R=g;const I=c.reduce((_,O)=>{const y=this.getItemValue(s,O)??"";return`${_}${y}`},"");for(let _=t-1;_>=0;_--){const O=this.rowIndexRowKeyMap.get(_)||"",y=c.reduce((D,L)=>{const Y=this.getItemValue(O,L)??"";return`${D}${Y}`},"");if(I===y)p=_;else break}for(let _=t;_<=this.ctx.maxRowIndex;_++){const O=this.rowIndexRowKeyMap.get(_)||"",y=c.reduce((D,L)=>{const Y=this.getItemValue(O,L)??"";return`${D}${Y}`},"");if(I===y)E=_;else break}for(let _=p;_<t;_++){const{height:O}=this.positions[_];T+=O}for(let _=p;_<=E;_++){const{height:O}=this.positions[_];K+=O;const y=this.rowIndexRowKeyMap.get(_)||"",{item:D}=this.rowKeyMap.get(y),L=this.getItemValue(y,i);b.push({rowKey:y,key:i,value:L,row:D})}}if(m!==1&&v){K=u;for(let I=a-1;I>=0;I--){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))C=I;else break}for(let I=a;I<=this.ctx.maxColIndex;I++){const _=this.getColumnByColIndex(I);if(!_)break;const O=this.getItemValue(s,i),y=this.getItemValue(s,_.key);if(O===y&&d.includes(_.key))w=I;else break}for(let I=C;I<a;I++){const _=this.getColumnByColIndex(I);if(!_)break;B+=_.width||100}for(let I=C;I<=w;I++){const _=this.getColumnByColIndex(I);if(!_)break;R+=_.width||100,b.push({rowKey:s,key:_.key,value:this.getItemValue(s,_.key),row:o})}}return{xArr:[C,w],yArr:[p,E],rowspan:f,colspan:m,height:K,width:R,offsetTop:T,offsetLeft:B,dataList:b}}setValidationErrorByRowKey(e,t,i){const s=`${e}_${t}`,o=this.getRowForRowKey(e),n=o==null?void 0:o.rowIndex,a=this.getColumnByKey(t);if(!e||!a||!o)return;const c=this.getItemValue(e,t),d=[{key:t,rowKey:e,rowIndex:n,colIndex:a.colIndex,column:a.column,row:o,value:c,message:i,field:t,fieldValue:c}];this.validationErrorMap.set(s,d)}setValidationError(e,t,i){const s=`${e}_${t}`;this.validationErrorMap.set(s,i)}clearValidationError(e,t){const i=`${e}_${t}`;this.validationErrorMap.has(i)&&this.validationErrorMap.delete(i)}getValidationError(e,t){const i=`${e}_${t}`;return this.validationErrorMap.get(i)||[]}getVirtualBodyCell(e,t,i=!0){const s=this.getColumnByColIndex(t),o=this.getRowForRowIndex(e);return!s||!o?void 0:new Br(this.ctx,e,t,0,0,0,0,s,o.item,"body",i)}getVirtualBodyCellByKey(e,t){const i=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(i===void 0||s===void 0))return this.getVirtualBodyCell(i,s)}hasMergeCell(e,t){let i=!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)){i=!0;break}}return i}calculateMaxTreeDepth(e,t=0){let i=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);i=Math.max(i,o)}}),i}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const i=`${e}_${t}`;return this.overlayerAutoHeightMap.get(i)||0}setCustomHeader(e,t=!1){if(["fixedData","sortData","hideData","resizableData"].forEach(i=>{const s=e[i];s!==void 0&&(this.customHeader[i]=s)}),!t){const i=this.clearCustomHeaderInvalidValues(this.columns);this.ctx.emit("customHeaderChange",i)}}resetCustomHeader(){this.customHeader={},this.ctx.emit("resetHeader"),this.ctx.emit("customHeaderChange",this.customHeader)}getCustomHeader(){return this.customHeader}setCustomHeaderResizableData(e,t){let{resizableData:i={}}=this.customHeader;i[e]=t,this.setCustomHeader({resizableData:i})}setCustomHeaderHideData(e,t){let{hideData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({hideData:i}),this.ctx.emit("resetHeader")}setCustomHeaderFixedData(e,t){let{fixedData:i={}}=this.customHeader;e.forEach(s=>{i[s]=t}),this.setCustomHeader({fixedData:i}),this.ctx.emit("resetHeader")}clearCustomHeaderInvalidValues(e){const t=(s,o={})=>{s.forEach(n=>{n.children&&n.children.length>0&&t(n.children,o);const a=(c,d)=>{var f,u;const g=(f=this.customHeader[c])==null?void 0:f[n.key];g!==void 0&&g!==d&&(o[c]||(o[c]={}),o[c][n.key]=g,c==="fixedData"&&!g&&!d&&((u=o[c])==null||delete u[n.key]))};a("fixedData",n.fixed),a("sortData",n.sort),a("hideData",n.hide),a("resizableData",n.width)})};let i={};return t(e,i),i}setMaxRowHeightItem(e,t,i){this.maxRowHeightCellMap.set(e,{key:t,height:i})}getMaxRowHeightItem(e){return this.maxRowHeightCellMap.get(e)}clearChangeData(){this.changedDataMap.clear()}}class DC{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:i}=this.ctx.config;i&&(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:i}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,i),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(i=>({rowKey:i.rowKey,key:i.key,value:i.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class $C{constructor(e){h(this,"eventTasks",new Set),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),this.bind(document,"selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){Array.from(this.eventTasks).forEach(({target:e,name:t,fn:i,options:s})=>{this.unbind(e,t,i,s)}),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.emit("mousedown",e)}handleMousemove(e){const t=e,i=this.ctx.containerElement.getBoundingClientRect(),s=t.clientX-i.left,o=t.clientY-i.top;this.ctx.mouseX=s,this.ctx.mouseY=o,this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&(this.ctx.dragHeaderIng||this.ctx.emit("keydown",e))}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,i,s){e.addEventListener(t,i,s),this.eventTasks.add({target:e,name:t,fn:i,options:s})}unbind(e,t,i,s){e.removeEventListener(t,i,s);for(const o of this.eventTasks)if(o.target===e&&o.name===t&&o.fn===i){this.eventTasks.delete(o);break}}}class MC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const i=this.events.get(e)||[];i.push(t),this.events.set(e,i)}once(e,t){const i=(...s)=>{t(...s),this.off(e,i)};return this.on(e,i),this}off(e,t){const i=this.events.get(e);if(i){const s=i.indexOf(t);s>=0&&(i.splice(s,1),i.length===0?this.events.delete(e):this.events.set(e,i))}}emit(e,...t){const i=this.events.get(e);i&&i.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class AC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,i,s){this.ctx.clearRect(e,t,i||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,i,s,o){const{fillColor:n,side:a,shadowWidth:c,colorStart:d,colorEnd:f}=o;this.ctx.save(),n&&(this.ctx.fillStyle=n,this.ctx.fillRect(e,t,i,s));let u;switch(a){case"left":u=this.ctx.createLinearGradient(e-c,t,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e-c,t,c,s);break;case"right":u=this.ctx.createLinearGradient(e+i,t,e+i+c,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e+i,t,c,s);break;case"top":u=this.ctx.createLinearGradient(e,t-c,e,t),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t-c,i,c);break;case"bottom":u=this.ctx.createLinearGradient(e,t+s,e,t+s+c),u.addColorStop(0,d),u.addColorStop(1,f),this.ctx.fillStyle=u,this.ctx.fillRect(e,t+s,i,c);break;default:console.error("Invalid side specified for shadow");break}this.ctx.restore()}drawLine(e,t){if(e.length<4||e.length%2!==0)throw new Error("A valid array of points is required to draw a line");this.ctx.save();const{borderColor:i="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=i,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,i,s,o){this.ctx.save(),this.ctx.drawImage(e,t,i,s,o),this.ctx.restore()}drawRect(e,t,i,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,i,s);else{const[d,f,u,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+i,t,e+i,t+f,f),this.ctx.arcTo(e+i,t+s,e+i-u,t+s,u),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}a!==void 0&&this.ctx.fill(),n!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,i,s,o,n={}){var a;this.ctx.save();const{font:c="12px Arial",align:d="center",color:f="#495060",padding:u=0,verticalAlign:g="middle",maxLineClamp:m=1,autoRowHeight:x=!1,offsetLeft:v=0,offsetRight:p=0}=n;if(this.ctx.font=c,this.ctx.fillStyle=f,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const E=parseInt(((a=c.match(/\d+/))==null?void 0:a[0])||"12")*(n.lineHeight||1.2),C=s-u*2-v-p;let w=!1;const b=Math.round((o-2*u)/E);let T=this.wrapText(e,C,n.cacheTextKey),B=Math.min(T.length,Math.max(b,1));m==="auto"&&x?B=T.length:typeof m=="number"&&m<B&&m!==1?B=m:(m===1&&(T=[e],B=1),m==="auto"&&b===1&&(T=[e],B=1));let K=i+u;const R=Math.round(B*E);g==="middle"?K=i+(o-R)/2:g==="bottom"&&(K=i+o-R-u);let I=t+u+v;d==="center"?I=t+s/2:d==="right"&&(I=t+s-u-p);for(let _=0;_<T.length;_++){const O=T[_],y=K+_*E;if(this.ctx.textBaseline="top",_===B-1){const D=T.slice(_).join(""),{_text:L,ellipsis:Y}=this.handleEllipsis(D,s,u,c);this.ctx.fillText(L,I,y),w=Y;break}this.ctx.fillText(O,I,y)}if(n.textCallback&&T.length){const _=T.reduce((Y,W)=>Math.max(Y,this.ctx.measureText(W).width),0),O=Math.round(_);let y=I,D=I+O;d==="center"?(y=I-O/2,D=I+O/2):d==="right"&&(y=I-O,D=I);const L={x:I,y:K,width:O,height:R,left:y,right:D,top:K,bottom:K+R};n.textCallback(L)}return this.ctx.restore(),w}wrapText(e,t,i=""){if(!e)return[""];if(i&&this.textCacheMap.has(i))return this.textCacheMap.get(i)||[""];const s=[],o=e.split(`
|
|
4
|
+
`);for(const a of o){if(a===""){s.push("");continue}const c=a.split("");let d="";for(const f of c){const u=d+f;this.ctx.measureText(u).width<=t?d=u:d?(s.push(d),d=f):(s.push(f),d="")}d&&s.push(d)}const n=s.length>0?s:[""];return i&&this.textCacheMap.set(i,n),n}calculateTextHeight(e="",t,i={}){var s;const{font:o="12px Arial",padding:n=0,align:a="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:f=""}=i;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=a;const u=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=u*(i.lineHeight||1.2),m=t-n*2,x=this.wrapText(e,m,f);let v=1;return d==="auto"?v=x.length:x.length>d?v=d:v=x.length,this.ctx.restore(),Math.max(Math.floor(v*g+n*2),Math.floor(u+n*2))}handleEllipsis(e,t,i=0,s="12px Arial"){this.ctx.save();let o=!1,n=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const a=this.ctx.measureText("...").width;if(t<=a+i*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-i*2;if(c&&c>=d){o=!0;let f=0;for(let u=0;u<e.length;u++)if(f+=this.ctx.measureText(e[u]).width,f>=d-a){n=e.slice(0,u)+"...",o=!0;break}}return this.ctx.restore(),{_text:n,ellipsis:o}}}class ko{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),h(this,"NUMBER_ERROR_TIP","只允许输入数字"),h(this,"EMPTY_TEXT","暂无数据"),h(this,"LOADING_TEXT","加载中..."),h(this,"MAX_HEIGHT",1e3),h(this,"BORDER_RADIUS",8),h(this,"ENABLE_OFFSET_HEIGHT",!1),h(this,"OFFSET_HEIGHT",0),h(this,"HEADER_HEIGHT",36),h(this,"ENABLE_HEADER_STICKY",!1),h(this,"HEADER_BG_COLOR","#F8FAFF"),h(this,"BODY_BG_COLOR","#FFF"),h(this,"HEADER_TEXT_COLOR","#1D2129"),h(this,"REQUIRED_COLOR","#F56C6C"),h(this,"BODY_TEXT_COLOR","#4E5969"),h(this,"FOOTER_TEXT_COLOR","#4E5969"),h(this,"LOADING_ICON_SVG",""),h(this,"LOADING_ICON_COLOR","#4E5969"),h(this,"EXPAND_ICON_SVG",""),h(this,"SHRINK_ICON_SVG",""),h(this,"EXPAND_ICON_COLOR","#4E5969"),h(this,"SHRINK_ICON_COLOR","#4E5969"),h(this,"ERROR_TIP_ICON_COLOR","red"),h(this,"ERROR_TIP_ICON_SIZE",6),h(this,"COLUMNS_ALIGN","left"),h(this,"COLUMNS_VERTICAL_ALIGN","middle"),h(this,"EXPAND_LAZY",!0),h(this,"DEFAULT_EXPAND_ALL",!1),h(this,"CELL_WIDTH",100),h(this,"CELL_HEIGHT",36),h(this,"CELL_PADDING",8),h(this,"CELL_HOVER_ICON_SIZE",14),h(this,"CELL_HOVER_ICON_BG_COLOR","#fff"),h(this,"CELL_HOVER_ICON_BORDER_COLOR","#DDE0EA"),h(this,"SCROLLER_TRACK_SIZE",14),h(this,"SCROLLER_SIZE",8),h(this,"SCROLLER_COLOR","#dee0e3"),h(this,"SCROLLER_TRACK_COLOR","#fff"),h(this,"SCROLLER_FOCUS_COLOR","#bbbec4"),h(this,"SELECT_BORDER_COLOR","rgb(82,146,247)"),h(this,"SELECT_AREA_COLOR","rgba(82,146,247,0.1)"),h(this,"SELECT_ROW_COL_BG_COLOR","transparent"),h(this,"AUTOFILL_POINT_BORDER_COLOR","#fff"),h(this,"EDIT_BG_COLOR","#fcf6ed"),h(this,"CHECKBOX_KEY",""),h(this,"CHECKBOX_COLOR","rgb(82,146,247)"),h(this,"FINDER_CELL_BG_COLOR","rgb(255,229,144)"),h(this,"ENABLE_FINDER",!0),h(this,"CHECKBOX_SIZE",20),h(this,"CHECKBOX_DISABLED_SVG",""),h(this,"CHECKBOX_DISABLED_COLOR","#F1F2F4"),h(this,"CHECKBOX_CHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_SVG",""),h(this,"CHECKBOX_UNCHECK_COLOR","#DDE0EA"),h(this,"CHECKBOX_INDETERMINATE_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_SVG",""),h(this,"CHECKBOX_CHECK_DISABLED_COLOR","#DDE0EA"),h(this,"ICON_EDIT_SVG",""),h(this,"ICON_EDIT_COLOR","#4E5969"),h(this,"ICON_SELECT_SVG",""),h(this,"ICON_SELECT_COLOR","#4E5969"),h(this,"SORT_STRICTLY",!0),h(this,"SORT_ASC_ICON_SVG",""),h(this,"SORT_DESC_ICON_SVG",""),h(this,"SORTABLE_ICON_SVG",""),h(this,"SORT_ICON_COLOR","rgb(82,146,247)"),h(this,"READONLY_COLOR","#fff"),h(this,"READONLY_TEXT_COLOR","#4E5969"),h(this,"ERROR_TIP_COLOR","#ED3F14"),h(this,"FOOTER_BG_COLOR","#fafafa"),h(this,"FOOTER_FIXED",!0),h(this,"FOOTER_POSITION","bottom"),h(this,"CELL_FOOTER_HEIGHT",36),h(this,"ENABLE_SELECTOR",!0),h(this,"TREE_SELECT_MODE","auto"),h(this,"TREE_CHILDREN_KEY","children"),h(this,"TREE_INDENT",20),h(this,"TREE_ICON_SIZE",20),h(this,"TREE_LINE",!1),h(this,"TREE_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_EDIT_SINGLE_CLICK",!1),h(this,"ENABLE_EDIT_CLICK_SELECTOR",!0),h(this,"SELECTOR_AREA_MIN_X",0),h(this,"SELECTOR_AREA_MAX_X_OFFSET",0),h(this,"SELECTOR_AREA_MAX_X",0),h(this,"SELECTOR_AREA_MIN_Y",0),h(this,"SELECTOR_AREA_MAX_Y",0),h(this,"SELECTOR_AREA_MAX_Y_OFFSET",0),h(this,"SELECTOR_CELL_VALUE_TYPE","value"),h(this,"ENABLE_AUTO_THEME",!0),h(this,"ENABLE_SELECTOR_SINGLE",!1),h(this,"ENABLE_SELECTOR_SPAN_COL",!0),h(this,"ENABLE_SELECTOR_SPAN_ROW",!0),h(this,"ENABLE_SELECTOR_ALL_ROWS",!0),h(this,"ENABLE_SELECTOR_ALL_COLS",!0),h(this,"ENABLE_MERGE_CELL_LINK",!1),h(this,"ENABLE_AUTOFILL",!1),h(this,"ENABLE_AUTOFILL_SPAN_COL",!0),h(this,"ENABLE_AUTOFILL_SPAN_ROW",!0),h(this,"ENABLE_CONTEXT_MENU",!1),h(this,"ENABLE_HEADER_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"ENABLE_RESIZE_COLUMN_TEXT",!0),h(this,"RESIZE_COLUMN_TEXT_COLOR","#fff"),h(this,"RESIZE_COLUMN_TEXT_BG_COLOR","rgb(82,146,247)"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"DRAG_TIP_BG_COLOR","rgba(82,146,247,0.1)"),h(this,"DRAG_TIP_LINE_COLOR","rgb(82,146,247)"),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CUSTOM_BODY_CONTEXT_MENU",[]),h(this,"HEADER_CONTEXT_MENU",[{label:"左固定",value:"fixedLeft"},{label:"右固定",value:"fixedRight"},{label:"取消固定",value:"fixedNone"},{label:"隐藏",value:"hide"},{label:"显示",value:"visible"},{label:"恢复默认",value:"resetHeader"}]),h(this,"CUSTOM_HEADER_CONTEXT_MENU",[]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"ENABLE_DRAG_COLUMN",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const i=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=OC(i);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const Ei='<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>',Lo='<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>',Do='<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>',Hr='<svg t="1755138507987" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="5079" width="200" height="200"><path d="M512 938.688a42.688 42.688 0 0 1-35.072-18.432l-192-277.312A42.56 42.56 0 0 1 320 576h384a42.752 42.752 0 0 1 35.072 66.944l-192 277.312a42.688 42.688 0 0 1-35.072 18.432" fill="currentColor" p-id="2016"></path><path d="M704 448H320a42.752 42.752 0 0 1-35.072-66.944l192-277.312c16-23.04 54.208-23.04 70.144 0l192 277.312A42.56 42.56 0 0 1 704 448" fill="currentColor" p-id="2015"></path></svg>',NC=Hr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),BC=Hr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"'),Za='<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>';class HC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:Za,color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:Ei,color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:Do,color:"#4E5969"},{name:"checkbox-uncheck",configName:"CHECKBOX_UNCHECK_SVG",configColorName:"CHECKBOX_UNCHECK_COLOR",svg:'<svg t="1722595639920" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4708" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" p-id="4709"></path></svg>',color:""},{name:"checkbox-check",configName:"CHECKBOX_CHECK_SVG",configColorName:"CHECKBOX_COLOR",svg:Lo,color:"rgb(82,146,247)"},{name:"checkbox-indeterminate",configName:"CHECKBOX_INDETERMINATE_SVG",configColorName:"CHECKBOX_COLOR",svg:'<svg t="1722595280953" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4394" width="32" height="32"><path d="M128 384v256q0 12.608 1.28 25.088 1.216 12.544 3.648 24.832 2.432 12.352 6.08 24.384t8.448 23.68q4.864 11.584 10.752 22.72 5.952 11.072 12.928 21.504 7.04 10.496 14.976 20.224 8 9.728 16.896 18.56 8.896 8.96 18.56 16.896 9.728 8 20.224 14.976 10.432 7.04 21.504 12.928 11.136 5.888 22.72 10.688 11.648 4.864 23.68 8.512 12.032 3.648 24.32 6.08 12.352 2.432 24.896 3.712Q371.392 896 384 896h256q12.608 0 25.088-1.28 12.544-1.216 24.832-3.648 12.352-2.432 24.384-6.08t23.68-8.512q11.584-4.8 22.72-10.688 11.072-5.952 21.504-12.928 10.496-7.04 20.224-14.976 9.728-8 18.56-16.896 8.96-8.832 16.896-18.56 8-9.728 14.976-20.224 7.04-10.432 12.928-21.504 5.888-11.136 10.688-22.72 4.864-11.648 8.512-23.68 3.648-12.032 6.08-24.32 2.432-12.352 3.712-24.896Q896 652.608 896 640V384q0-12.608-1.28-25.088-1.216-12.544-3.648-24.832-2.432-12.352-6.08-24.384t-8.512-23.68q-4.8-11.584-10.688-22.72-5.952-11.072-12.928-21.504-7.04-10.496-14.976-20.224-8-9.664-16.896-18.56-8.832-8.96-18.56-16.896-9.728-8-20.224-14.976-10.432-7.04-21.504-12.928-11.136-5.888-22.72-10.752-11.648-4.8-23.68-8.448-12.032-3.648-24.32-6.08-12.352-2.432-24.896-3.712Q652.608 128 640 128H384q-12.608 0-25.088 1.28-12.544 1.216-24.832 3.648-12.352 2.432-24.384 6.08t-23.68 8.448q-11.584 4.864-22.72 10.752-11.072 5.952-21.504 12.928-10.496 7.04-20.224 14.976-9.664 8-18.56 16.896-8.96 8.896-16.896 18.56-8 9.728-14.976 20.224-7.04 10.432-12.928 21.504-5.888 11.136-10.752 22.72-4.8 11.648-8.448 23.68-3.648 12.032-6.08 24.32-2.432 12.352-3.712 24.896Q128 371.392 128 384z m566.016 166.336H330.112a38.4 38.4 0 0 1 0-76.8h363.904a38.4 38.4 0 0 1 0 76.8z" p-id="4395"></path></svg>',color:"rgb(82,146,247)"},{name:"checkbox-check-disabled",configName:"CHECKBOX_CHECK_DISABLED_SVG",svg:Lo,color:"#DDE0EA"},{name:"checkbox-disabled",configName:"CHECKBOX_DISABLED_SVG",configColorName:"CHECKBOX_DISABLED_COLOR",svg:'<svg t="1722595946663" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4865" width="32" height="32"><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z" p-id="4866"></path><path d="M128 640V384a256 256 0 0 1 256-256h256a256 256 0 0 1 256 256v256a256 256 0 0 1-256 256H384a256 256 0 0 1-256-256z m64 0q0 79.552 56.256 135.744Q304.448 832 384 832h256q79.552 0 135.744-56.256Q832 719.552 832 640V384q0-79.552-56.256-135.744Q719.552 192 640 192H384q-79.552 0-135.744 56.256Q192 304.448 192 384v256z" fill="#DDE0EA" p-id="4867"></path></svg>',color:"#F1F2F4"},{name:"icon-edit",configName:"ICON_EDIT_SVG",configColorName:"ICON_EDIT_COLOR",svg:'<svg t="1744798692576" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="6606" width="200" height="200"><path d="M855.296 894.528H168.768v-76.8h686.528v76.8z m38.4-38.4q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.824 4.8-3.2 2.112-6.656 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.52-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.76 4.736 2.752 2.688 4.864 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488z m-686.528 0q0 3.84-0.768 7.488-0.704 3.712-2.176 7.232-1.472 3.52-3.52 6.656-2.112 3.136-4.8 5.76-2.688 2.688-5.76 4.8-3.2 2.112-6.72 3.584-3.456 1.408-7.168 2.176-3.712 0.704-7.488 0.704-3.84 0-7.488-0.704-3.712-0.768-7.232-2.176-3.456-1.472-6.656-3.584-3.136-2.112-5.76-4.736-2.688-2.688-4.8-5.824-2.112-3.2-3.584-6.656-1.408-3.52-2.176-7.232-0.704-3.648-0.704-7.488 0-3.776 0.704-7.488 0.768-3.712 2.176-7.168 1.472-3.52 3.584-6.656 2.112-3.136 4.736-5.76 2.688-2.752 5.824-4.8 3.2-2.112 6.656-3.584 3.52-1.472 7.232-2.176 3.712-0.768 7.488-0.768 3.776 0 7.488 0.768 3.712 0.704 7.168 2.176 3.52 1.472 6.656 3.584 3.2 2.048 5.824 4.736 2.688 2.688 4.8 5.824 2.048 3.2 3.52 6.656 1.472 3.456 2.176 7.168 0.768 3.712 0.768 7.488zM652.032 211.2l-369.92 370.368v89.344h90.048l369.664-369.856L652.032 211.2z m-54.4-54.272q22.528-22.528 54.4-22.528 31.808 0 54.336 22.528l89.792 89.856q22.464 22.464 22.464 54.272t-22.464 54.272l-369.664 369.856q-22.464 22.528-54.336 22.528H282.24q-31.808 0-54.336-22.528-22.464-22.464-22.464-54.272V581.568q0-31.808 22.4-54.272l369.92-370.368z" p-id="6607"></path></svg>',color:"#4E5969"},{name:"icon-select",configName:"ICON_SELECT_SVG",configColorName:"ICON_SELECT_COLOR",svg:Do,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:NC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:BC,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Hr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const i=this.list[t];let s=i.color,o=i.svg;if(i.configColorName){const a=this.ctx.config[i.configColorName];a&&(s=a)}if(i.configName){const a=this.ctx.config[i.configName];a&&(o=a)}const n=this.createImageFromSVG(o,s).then(a=>{this.icons.set(i.name,a)});e.push(n)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const i=this.ctx.config.ICONS[t];let s=i.color;const o=this.createImageFromSVG(i.svg,s,i.isBlob).then(n=>{this.icons.set(i.name,n)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,i=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(a=>{const c=a.getAttribute("fill");(c==="currentColor"||c===null)&&a.setAttribute("fill",t)});const o=new Image;let n="";if(i){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:"+e)),o.onload=()=>{a(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class dr extends qa{constructor(e,t,i,s,o,n,a){super(e,i,s,o,n,"header",a.fixed),h(this,"align"),h(this,"hideHeaderSelection",!1),h(this,"verticalAlign","middle"),h(this,"fixed"),h(this,"minWidth"),h(this,"maxWidth"),h(this,"widthFillDisable"),h(this,"type"),h(this,"operation",!1),h(this,"editorType"),h(this,"level"),h(this,"text"),h(this,"hide",!1),h(this,"displayText",""),h(this,"colspan"),h(this,"rowspan"),h(this,"row"),h(this,"key"),h(this,"required",!1),h(this,"readonly",!1),h(this,"ellipsis",!1),h(this,"overflowTooltipShow",!0),h(this,"children",[]),h(this,"column"),h(this,"colIndex"),h(this,"rowKey"),h(this,"rules"),h(this,"hasChildren"),h(this,"render"),h(this,"style",{}),h(this,"drawX",0),h(this,"drawY",0),h(this,"sortIconName","sort-default"),h(this,"sortAscIconName","sort-asc"),h(this,"sortDescIconName","sort-desc"),h(this,"visibleWidth",0),h(this,"visibleHeight",0),h(this,"maxLineClampHeader","auto"),h(this,"domDataset",{}),h(this,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawCellBgColor",""),h(this,"drawTextColor",""),h(this,"drawTextFont",""),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=i,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.hide=(typeof a.hide=="function"?a.hide(a):a.hide)||!1,this.type=a.type||"",this.editorType=a.editorType||"text",this.hideHeaderSelection=a.hideHeaderSelection||!1,this.align=a.headerAlign||a.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=a.headerVerticalAlign||a.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=a.fixed||"",this.level=a.level||0,this.operation=a.operation||!1,this.text=a.title,this.column=a,this.colspan=a.colspan||1,this.widthFillDisable=a.widthFillDisable||!1,this.rowspan=a.rowspan||1,this.rules=a.rules,this.readonly=a.readonly||!1,this.required=a.required||!1,this.sortIconName=a.sortIconName||"sort-default",this.sortAscIconName=a.sortAscIconName||"sort-asc",this.sortDescIconName=a.sortDescIconName||"sort-desc",this.rowKey=Xa(),this.overflowTooltipShow=a.overflowTooltipHeaderShow!==!1,this.hasChildren=a.children&&a.children.length>0||!1,this.render=a.renderHeader,this.maxLineClampHeader=a.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:i}=this.ctx.config;let s=t,o=i;if(typeof e=="function"){const c=e,{backgroundColor:d,color:f,font:u}=c({colIndex:this.colIndex,column:this.column})||{};d&&(s=d),f&&(o=f),u&&(this.drawTextFont=u)}const{colKey:n,type:a}=this.ctx.finderBar;a==="header"&&n===this.key&&(s=this.ctx.config.FINDER_CELL_BG_COLOR),this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.drawTextWidth=this.width,this.drawTextHeight=this.height,this.updateStyle()}draw(){this.drawEdge(),this.drawSelection(),this.drawText(),this.drawBg(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:i}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:i?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:i,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}_${this.drawTextFont}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:this.drawTextFont||t,padding:i,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:n=>{this.column.sortBy&&(this.drawSortImageX=n.right+4,this.drawSortImageY=n.top+(n.height-16)/2),this.required&&e.drawText("*",n.left-18,n.top+(n.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawBg(){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR:e,ENABLE_SELECTOR_SINGLE:t}=this.ctx.config;let i=-1,s=-1;if(this.ctx.focusCellHeader&&(i=this.ctx.focusCellHeader.colIndex,s=this.ctx.focusCellHeader.colIndex+this.ctx.focusCellHeader.colspan-1),e&&!t){const{xArr:n}=this.ctx.selector;i=n[0],s=n[1]}const o=this.colspan+this.colIndex-1;this.colIndex>=i&&this.colIndex<=s&&o<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:i}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let n=this.drawX+(this.width-s)/2,a=this.drawY+(this.height-s)/2;this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(n=this.drawX+o,this.drawTextX=n+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?a=this.drawY+o/2:this.verticalAlign==="bottom"&&(a=this.drawY+this.height-s-o/2);let c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck";e?(c=this.ctx.icons.get("checkbox-indeterminate"),d="checkbox-indeterminate"):t&&i?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!i?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&i?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=n,this.drawSelectionImageY=a,this.drawSelectionImageWidth=s,this.drawSelectionImageHeight=s,this.drawSelectionImageName=d,this.drawSelectionImageSource=c,this.ctx.paint.drawImage(this.drawSelectionImageSource,this.drawSelectionImageX,this.drawSelectionImageY,this.drawSelectionImageWidth,this.drawSelectionImageHeight))}}drawSortIcon(){if(!this.column.sortBy)return;const e=16;let t=this.sortIconName;const i=this.ctx.database.getSortState(this.key);i.direction==="asc"?t=this.sortAscIconName:i.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class FC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(e=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver",e),this.ctx.emit("containerResize",this.ctx.containerElement)}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,{body:{height:n,visibleHeight:a,visibleWidth:c,y:d}}=this.ctx,f=Math.min(n,a);o>0&&o<c&&s>d&&s<d+f||this.ctx.emit("mousedownBodyOutside",e),e.button===0&&(this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,u=>{this.ctx.focusCellHeader=u,this.ctx.focusCell=void 0,this.ctx.emit("cellHeaderMousedown",u,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,u=>{this.ctx.setFocusCell(u),this.ctx.focusCellHeader=void 0,this.ctx.emit("cellMousedown",u,e)}))}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,n=>{this.ctx.focusCellHeader=n,this.ctx.emit("cellHeaderMouseup",n,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,n=>{this.ctx.setFocusCell(n),this.ctx.emit("cellMouseup",n,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(i,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(i,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:i}=this.ctx.getOffset(e),s=t,o=i;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,i=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(i,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(i,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(i,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("draw")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))}),this.handleFooterEvent(i,t,this.ctx.footer.renderRows,s=>{this.ctx.emit("cellFooterMouseenter",s,e),this.ctx.hoverCell&&this.ctx.hoverCell!==s&&this.ctx.emit("cellFooterMouseleave",s,e),this.ctx.emit("cellFooterHoverChange",s,e)})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof dr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const a=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=a||{},{EXPAND_LAZY:f,EXPAND_LAZY_METHOD:u}=this.ctx.config;if(f&&u&&!c&&!d)typeof u=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),u({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(!this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const a=this.ctx.database.getSortState(e.key);let c;a.direction==="none"?c="asc":a.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:i,offsetX:s}=this.ctx.getOffset(t),o=i,n=s;if(e instanceof dr){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawSortImageSource&&this.isInsideElement(n,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Br){if(e.drawSelectionImageSource&&this.isInsideElement(n,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0,this.ctx.database.getRowSelectable(e.rowKey)||(this.ctx.stageElement.style.cursor="not-allowed");return}if(e.drawHoverImageSource&&this.isInsideElement(n,o,e.drawHoverImageX,e.drawHoverImageY,e.drawHoverImageWidth,e.drawHoverImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}if(e.drawTreeImageSource&&this.isInsideElement(n,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,i,s,o,n){return e>i&&e<i+o&&t>s&&t<s+n}isBusy(e){const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:n}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-n||o>this.ctx.stageWidth-n)}handleBodyEvent(e,t,i,s,o=!1){if(this.isInsideBody(t))for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);return}}}}handleHeaderEvent(e,t,i,s){for(const o of i){const n=o.getDrawX(),a=o.getDrawY();if(e>n&&e<n+o.width&&t>a&&t<a+o.height){s(o);return}}}handleFooterEvent(e,t,i,s,o=!1){for(const n of i){const a=n.fixedCells.concat(n.noFixedCells);for(const c of a){const d=c.getDrawX(),f=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>f&&t<f+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>f&&t<f+c.height){s(c);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 KC{constructor(e,t){h(this,"eventBus"),h(this,"eventBrowser"),h(this,"eventTable"),h(this,"containerElement"),h(this,"stageElement"),h(this,"canvasElement"),h(this,"overlayerElement"),h(this,"editorElement"),h(this,"emptyElement"),h(this,"contextMenuElement"),h(this,"loadingElement"),h(this,"stageWidth",0),h(this,"stageHeight",0),h(this,"paint"),h(this,"icons"),h(this,"domSelectionStr",""),h(this,"isMouseoverTargetContainer",!1),h(this,"mousedown",!1),h(this,"isPointer",!1),h(this,"isEmpty",!1),h(this,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"disableHoverIconClick",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"dragHeaderIng",!1),h(this,"finding",!1),h(this,"adjustPositioning",!1),h(this,"contextMenuIng",!1),h(this,"editing",!1),h(this,"loading",!1),h(this,"onlyMergeCell",!1),h(this,"selectOnlyOne",!1),h(this,"hasSelection",!1),h(this,"hasTree",!1),h(this,"scrollY",0),h(this,"scrollX",0),h(this,"fixedLeftWidth",0),h(this,"fixedRightWidth",0),h(this,"lastCenterColIndex",0),h(this,"maxColIndex",0),h(this,"maxRowIndex",0),h(this,"hoverRow"),h(this,"clickCell"),h(this,"focusCell"),h(this,"currentCell"),h(this,"hoverCell"),h(this,"clickCellHeader"),h(this,"focusCellHeader"),h(this,"hoverCellHeader"),h(this,"mouseX",0),h(this,"mouseY",0),h(this,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],allCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"finderBar",{text:"",rowIndex:-1,colIndex:-1,type:"body"}),h(this,"database"),h(this,"history"),h(this,"config");const{containerElement:i,stageElement:s,canvasElement:o,overlayerElement:n,editorElement:a,emptyElement:c,loadingElement:d,contextMenuElement:f}=e;this.containerElement=i,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=n,this.editorElement=a,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=f,this.config=new ko(t.config||{}),this.eventBus=new MC,this.eventBrowser=new $C(this),this.eventTable=new FC(this),this.paint=new AC(this.canvasElement),this.database=new LC(this,t),this.history=new DC(this),this.icons=new HC(this)}setConfig(e){this.config=new ko(e)}setItemValueByEditor(e,t,i,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(),d=c.map(f=>({...f,value:i}));this.database.batchSetItemValue(d,s,n);return}}this.database.setItemValue(e,t,i,s,o,!0,n)}batchSetItemValueByEditor(e,t=!0,i=!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:d}=c.getSpanInfo(),f=d.map(u=>({...u,value:o.value}));s.push(...f)}}),this.database.batchSetItemValue(s,t,i)}else this.database.batchSetItemValue(e,t,i)}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 i={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",i)}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,i=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const n=[];for(let a=0;a<=i[1]-i[0];a++){const c=o+t[0],d=a+i[0],f=this.database.getVirtualBodyCell(c,d);f&&(f.selectorCellValueType==="displayText"?n.push(f.displayText):n.push(f.getValue()))}s+=`${n.join(" ")}\r`,e.push(n)}return s=s?s.replace(/\r$/,""):" ",{xArr:i,yArr:t,text:s,value:e}}setScroll(e,t){let i=Math.floor(e);const s=this.body.width-this.body.visibleWidth;i<0?i=0:i>s&&(i=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",i,o)}setScrollX(e){let t=Math.floor(e);const i=this.body.width-this.body.visibleWidth;t<0?t=0:t>i&&(t=i),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),i=0;this.config.FOOTER_FIXED||(i=this.footer.height);const s=this.body.height-this.body.visibleHeight+i;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:i}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-i}}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 $o{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:i}=e.touches[0],s=t-this.clientY,o=i-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:i}=e.touches[0];this.clientX=i,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:i,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,i))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,i)){let n=0;this.type==="vertical"?n=(i-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:i,clientX:s,clientY:o,buttons:n}=e;if(this.isOnScrollbar(t,i)&&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,i,s,o,n){return e>=i&&e<=i+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,i=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&i<0||this.scroll===this.distance&&i>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+i,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:i,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:n=0,BORDER:a}}=this.ctx,c=s,d=i,f=t.height,u=t.width,g=e.height,m=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-f,this.distance=g-this.visibleDistance+m,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,f,this.trackX+o,f],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-n)/2,this.barWidth=n;const x=this.distance?this.visibleDistance/(g+m):0;let v=Math.floor(x*this.visibleDistance);v<30?v=30:v>this.visibleDistance&&(v=0),this.barHeight=v,this.barY=f+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=u-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const x=a?0:.5;this.trackX=0,this.trackY=d-o+x,this.trackWidth=c,this.trackHeight=o;const v=this.distance?this.visibleDistance/u:0;let p=Math.floor(v*this.visibleDistance);this.barY=this.trackY-1+(o-n)/2,p<30?p=30:p>=this.visibleDistance&&(p=0),this.barWidth=p,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:i,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let n=i;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 PC{constructor(e){h(this,"ctx"),h(this,"verticalScrollbar"),h(this,"horizontalScrollbar"),h(this,"mousedownHeader",!1),h(this,"adjustPositionX",""),h(this,"adjustPositionY",""),h(this,"timerX",0),h(this,"timerY",0),this.ctx=e,this.verticalScrollbar=new $o(e,"vertical"),this.horizontalScrollbar=new $o(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,i)=>{this.setScroll(t,i)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("scrollToIndex",(t,i)=>{this.scrollToIndex(t,i)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.key===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,i=t.leafCellHeaders.find(s=>s.colIndex===e);i&&this.setScrollX(i.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:i}=this.ctx,{top:s}=i.getPositionForRowIndex(e);this.setScrollY(s-t.visibleHeight/2)}scrollToIndex(e,t){this.scrollToRowIndex(e),this.scrollToColIndex(t)}scrollToRowKey(e){const{body:t,database:i}=this.ctx,s=i.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=i.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,i;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let n="",a="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?n="left":((i=this.ctx.focusCell)==null?void 0:i.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?n="right":(n="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?a="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?a="bottom":(a="",this.stopAdjustPosition(!1,!0)),n&&this.adjustPositionX!==n){this.adjustPositionX=n;let c=10*(n==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(f)},100)}if(a&&this.adjustPositionY!==a){this.adjustPositionY=a;let c=10*(a==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,f=d+c;(f<0||f>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(f)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class YC{constructor(e,t){h(this,"root"),h(this,"key"),h(this,"childrenKey"),this.root=e,this.key=(t==null?void 0:t.key)||"key",this.childrenKey=(t==null?void 0:t.childrenKey)||"children"}getTree(){return this.root}treeMove(e,t,i){const s=this.findNodeWithParent(this.root,e[this.key]);if(!s)throw new Error("Source node not found");const{parent:o,index:n,node:a}=s;if(o){const u=o[this.childrenKey];u.splice(n,1),u.length===0&&delete o[this.childrenKey]}else this.root.splice(n,1);const c=this.findNodeWithParent(this.root,t[this.key]);if(!c)throw new Error("Target node not found");const{parent:d,index:f}=c;i==="before"?d?d[this.childrenKey].splice(f,0,a):this.root.splice(f,0,a):i==="after"&&(d?d[this.childrenKey].splice(f+1,0,a):this.root.splice(f+1,0,a))}findNodeWithParent(e,t,i=null){for(let s=0;s<e.length;s++){const o=e[s];if(o[this.key]===t)return{parent:i,index:s,node:o};if(o[this.childrenKey]){const n=this.findNodeWithParent(o[this.childrenKey],t,o);if(n)return n}}return null}}class VC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"dragTarget",null),h(this,"dragingCell"),h(this,"dragCellDiff",0),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleColumns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Nr(()=>{this.init(),this.ctx.clearSelector(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn(),this.initDragColumn()}init(e=!1){const{config:{HEADER_HEIGHT:t,SCROLLER_TRACK_SIZE:i}}=this.ctx;if(!e){const u=this.ctx.database.getColumns();this.columns=u}this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[],this.visibleColumns=za(this.columns);const s=vi(this.visibleColumns),o=Ht(this.visibleColumns);this.height=t*s,this.visibleHeight=this.height,this.width=o.reduce((u,g)=>{const m=g.width||100,{maxWidth:x,minWidth:v}=g;return x&&m>x?u+x:v&&m<v?u+v:u+m},0),this.columnIndex=0,this.resizeNum=0;const n=bC(mi(this.visibleColumns,s));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.min(Math.floor(this.width+i),Math.floor(a.width)),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-i;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const u=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(u)}const d=this.fixedLeftCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedLeftWidth=d.reduce((u,g)=>u+g.width,0);const f=this.fixedRightCellHeaders.filter(u=>!u.hasChildren);this.ctx.fixedRightWidth=f.reduce((u,g)=>u+g.width,i),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.allCellHeaders=this.allCellHeaders,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:i}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,n=this.resizeTarget.maxWidth;let a=e.clientX-this.clientX;a+s<i&&(a=-(s-i)),o&&a+s<o&&(a=-(s-o)),n&&a+s>n&&(a=n-s),this.resizeDiff=a,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(e.offsetX<0||e.offsetX>this.visibleWidth){this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");return}this.ctx.stageElement.style.cursor==="col-resize"&&(this.ctx.stageElement.style.cursor="default");const s=[...this.renderFixedCellHeaders,...this.renderCenterCellHeaders];for(const o of s){const{offsetX:n,offsetY:a}=this.ctx.getOffset(e),c=n,d=a,f=o.getDrawX(),u=o.getDrawY();if(c>f+o.width-5&&c<f+o.width+4&&c<t-4&&d>u){const g=o.colIndex+o.colspan-1,m=this.leafCellHeaders.find(x=>x.colIndex===g);if(!m||!m.fixed&&this.ctx.stageWidth-this.ctx.fixedRightWidth<f+o.width)return;this.ctx.isTarget(e)&&a<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=m)}}}})}initDragColumn(){this.ctx.on("cellHeaderMousedown",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragTarget===e?(this.ctx.dragHeaderIng=!0,this.dragCellDiff=this.ctx.mouseX-e.drawX,this.ctx.stageElement.style.cursor="grabbing"):(this.dragTarget=e,this.ctx.dragHeaderIng=!1)))}),this.ctx.on("cellMousedown",()=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(this.dragTarget=null,this.ctx.dragHeaderIng=!1)}),this.ctx.on("mouseup",()=>{if(this.ctx.config.ENABLE_DRAG_COLUMN){if(this.dragingCell&&this.dragTarget){const e=(d,f={})=>(d.forEach((u,g)=>{u.children&&e(u.children,f),f[u.key]=g}),f),t=this.ctx.database.getColumns(),i=mi(t,vi(t)),s=new YC(i,{key:"key",childrenKey:"children"}),o=this.dragTarget.colIndex>this.dragingCell.colIndex?"before":"after";s.treeMove(this.dragTarget.column,this.dragingCell.column,o);const n=s.getTree(),a=e(n);this.ctx.database.setCustomHeader({sortData:a}),this.init();const c={source:this.dragTarget,target:this.dragingCell,columns:i};this.ctx.emit("columnDragChange",c)}this.ctx.dragHeaderIng&&this.dragTarget&&(this.ctx.dragHeaderIng=!1,this.dragTarget=null,this.dragingCell=void 0,this.dragCellDiff=0,this.ctx.clearSelector(),this.ctx.focusCellHeader=void 0,this.ctx.stageElement.style.cursor="default",this.ctx.emit("draw"))}}),this.ctx.on("mousemove",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(!this.ctx.dragHeaderIng||!this.dragTarget||(this.dragTarget.fixed||this.ctx.startAdjustPosition(e),this.ctx.emit("draw")))}),this.ctx.on("cellHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.config.ENABLE_DRAG_COLUMN&&(e.column.dragDisabled||(this.dragingCell=this.getDragCellHeader(e.colIndex)))})}getDragCellHeader(e){if(!this.dragTarget||!this.ctx.dragHeaderIng)return;const{column:{parentKey:t},key:i,level:s,fixed:o}=this.dragTarget,n=this.allCellHeaders.find(a=>a.key!==i&&a.fixed===o&&a.column.level===s&&a.column.parentKey===t&&a.colIndex<=e&&a.colIndex+a.colspan-1>=e);if(this.ctx.dragHeaderIng){const a=n?"grabbing":"not-allowed";this.ctx.stageElement.style.cursor=a}return n}resizeColumn(e,t){const i=n=>{n.forEach(a=>{if(a.children&&a.children.length>0&&i(a.children),a.key===e.key){const c=a.width||100;a.width=c+t}})};i(this.columns);let s=0;if(this.width<this.visibleWidth){const n=this.visibleWidth-this.width;s=Math.floor(n/this.resizeNum*100)/100,this.resizeAllColumn(s)}const o=e.width+t+s;this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:o,column:e.column,columns:this.columns}),this.ctx.database.setCustomHeaderResizableData(e.key,o),this.init(!0),this.ctx.emit("draw")}resizeAllColumn(e){if(e===0)return;const t=new Map;let i=!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&&(i=!1)}if(!i)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.init(!0),this.ctx.emit("draw")}getCustomHeader(){const e=this.ctx.database.getColumns(),t=this.ctx.database.getCustomHeader(),{sortData:i={}}=t;return Object.keys(i).length===0?{columns:e,customHeader:t}:{columns:mi(e,vi(e)),customHeader:t}}render(e,t){const i=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let n=0;n<i;n++){const a=e[n],c=o*(a.rowspan||0),d=o*(a.level||0);let{minWidth:f,maxWidth:u}=a,g=a.width||100;f&&g<f&&(g=f),u&&g>u&&(g=u),a.children&&(g=Ht(a.children).reduce((x,v)=>x+((v==null?void 0:v.width)||100),0));const m=new dr(this.ctx,this.columnIndex,s,d,g,c,a);this.ctx.database.setHeader(a.key,m),this.allCellHeaders.push(m),a.children||(this.leafCellHeaders.push(m),m.column.widthFillDisable||this.resizeNum++),a.fixed==="left"?this.fixedLeftCellHeaders.push(m):a.fixed==="right"?this.fixedRightCellHeaders.push(m):this.centerCellHeaders.push(m),!a.children&&this.columnIndex++,a.children&&this.render(a.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t,RESIZE_COLUMN_TEXT_COLOR:i,RESIZE_COLUMN_TEXT_BG_COLOR:s,ENABLE_RESIZE_COLUMN_TEXT:o}}=this.ctx,n=this.resizeTarget.getDrawX(),a=this.resizeTarget.width,c=n+a+this.resizeDiff-.5,d=[c-.5,0,c-.5,e];if(this.ctx.paint.drawLine(d,{borderColor:t}),o){const f=`${Math.floor(a+this.resizeDiff)}px`,u=45,g=24;this.ctx.paint.drawRect(c+u/2,this.ctx.mouseY-g/2,u,g,{fillColor:s,borderWidth:0,borderColor:"transparent"}),this.ctx.paint.drawText(f,c+u/2,this.ctx.mouseY-g/2,u,g+2,{padding:0,color:i,align:"center",verticalAlign:"middle"})}}}drawDragTip(){if(this.dragTarget&&this.ctx.dragHeaderIng){const{DRAG_TIP_BG_COLOR:e,DRAG_TIP_LINE_COLOR:t}=this.ctx.config,i=this.dragTarget.width;if(this.ctx.paint.drawRect(this.ctx.mouseX-this.dragCellDiff,this.visibleHeight,i,this.ctx.body.visibleHeight,{fillColor:e,borderWidth:0,borderColor:"transparent"}),this.dragingCell){const{drawX:s,drawY:o,visibleWidth:n,colIndex:a}=this.dragingCell;let c=s,d=o;a>this.dragTarget.colIndex&&(c=s+n),a===0&&(c=c+1),a===this.ctx.maxColIndex&&(c=c-1);const f=[c,d,c,this.ctx.stageHeight],u=[c-4,d,c+4,d,c,d+6,c-4,d];this.ctx.paint.drawLine(u,{borderColor:t,borderWidth:1.2,fillColor:t}),this.ctx.paint.drawLine(f,{borderColor:t,borderWidth:1.2})}}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>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)"}),i<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=[],i=[];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=>{i.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{i.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=i,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,i=[0,this.height,e,this.height];this.ctx.paint.drawLine(i,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawBottomLine(),this.drawTipLine(),this.drawDragTip()}}class Ja{constructor(e,t,i=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,"calculatedHeightCells",[]),h(this,"rowIndex",0),h(this,"rowKey",""),h(this,"rowType","body"),h(this,"data"),h(this,"calculatedHeight",-1),this.ctx=e,this.x=i,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=[],i=[],s=[],o=[];e.renderLeafCellHeaders.forEach(n=>{const a=new Br(this.ctx,this.rowIndex,n.colIndex,n.x,this.y,n.width,this.height,n.column,this.data,this.rowType);a.fixed?i.push(a):s.push(a),t.push(a),a.autoRowHeight&&o.push(a)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=i,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>{const i=t.getAutoHeight(),{key:s,height:o=-1}=this.ctx.database.getMaxRowHeightItem(this.rowKey)||{};return i>o?this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i):i!==0&&t.key===s&&i<o&&this.ctx.database.setMaxRowHeightItem(this.rowKey,t.key,i),i});return this.calculatedHeight=e.length?Math.max(...e):-1,this.calculatedHeight}drawCenter(){this.noFixedCells.forEach(e=>{e.draw()})}drawFixed(){this.fixedCells.forEach(e=>{e.draw()})}drawContainer(){this.noFixedCells.forEach(e=>{e.drawContainer()})}drawFixedContainer(){this.fixedCells.forEach(e=>{e.drawContainer()})}}class WC{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:i,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:n=0,HEIGHT:a,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:f=0,OFFSET_HEIGHT:u=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+i.height:this.y=t.height;const{data:m,sumHeight:x}=s.getData();this.height=x,this.data=m,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-n;const v=this.ctx.footer.height;this.ctx.isEmpty=!this.data.length,!this.data.length&&!a?this.height=c:!this.data.length&&a&&(this.height=a-t.height-v-n);let p=this.height+t.height+n;p+=v;let E=p;const C=window.innerHeight,{top:w}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(C>w&&f&&!a){const O=C-w-u;O>t.height+n?E=O:p>d&&(E=d)}else this.data.length&&a?E=a:this.data.length&&d&&p>d&&(E=d);E>0&&(this.ctx.stageHeight=Math.floor(E),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-n;o?this.visibleHeight=b-v:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=m;const T=window.devicePixelRatio||1,B=this.ctx.stageWidth*T,K=this.ctx.stageHeight*T;e.width=Math.round(B),e.height=Math.round(K);const R=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:R,type:R,headerHeight:t.height,bodyHeight:this.height,footerHeight:v,width:this.width,height:this.data.length?0:c+v});const I=Math.round(e.width/T*1e4)/1e4,_=Math.round(e.height/T*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${_}px;width:${I}px;`),this.ctx.paint.scale(T)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:i}=this.ctx.getOffset(e),s=t,o=i,n=e.clientY,{stageHeight:a,scrollY:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const f=this.resizeTarget.height;let u=n-this.clientY;const{calculatedHeight:g}=this.resizeTarget,m=g===-1?d:g;u+f<m&&(u=-(f-m)),this.resizeDiff=u,this.ctx.emit("draw")}else{if(this.resizeTarget=null,this.isMouseDown)return;if(o<0||o>this.ctx.body.visibleWidth||s<0||s>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight){this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");return}if(this.ctx.stageElement.style.cursor==="crosshair")return;this.ctx.stageElement.style.cursor==="row-resize"&&(this.ctx.stageElement.style.cursor="default");for(let f=0;f<this.renderRows.length;f++){const u=this.renderRows[f];if(s>u.y-c+u.height-1.5&&s<u.y-c+u.height+1.5&&s<a-4)for(let g=0;g<u.cells.length;g++){const m=u.cells[g];o>m.drawX+10&&o<m.drawX+m.width-10&&m.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=u)}}}})}resizeRow(e,t){const{rowIndex:i,height:s,rowKey:o,data:n}=e;this.ctx.database.setRowHeight(i,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:i,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:i}}=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:i,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:i,header:s,stageWidth:o,config:{HEADER_BG_COLOR:n,SCROLLER_TRACK_SIZE:a}}=this.ctx;if(i>0&&e!==0&&!this.ctx.isEmpty&&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)"}),i<Math.floor(s.width-o-1)&&t!==a&&!this.ctx.isEmpty){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 i=0,s=e.length-1,o=-1;for(;i<=s;){let n=Math.floor((i+s)/2),a=e[n].bottom;if(a===t)return n;a<t?i=n+1:(o=n,s=n-1)}return o}update(){this.init();const{header:e,database:t,scrollY:i,config:{CELL_HEIGHT:s}}=this.ctx,o=i,{data:n,positions:a}=t.getData();this.ctx.maxRowIndex=n.length-1;let c=this.binarySearch(a,o),d=this.binarySearch(a,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const u=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-u}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+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 f=[];for(let u=0;u<this.visibleRows.length;u++){const g=this.headIndex+u,m=this.visibleRows[u],{height:x,top:v}=this.ctx.database.getPositionForRowIndex(g),p=new Ja(this.ctx,g,0,v+this.y,e.width,x,m);f.push(p)}this.renderRows=f,this.ctx.body.renderRows=f}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(i=>i.calculatedHeightCells.length>0))return!1;e.forEach(i=>{i.updateCalculatedHeight()});const t=e.map(i=>({height:i.calculatedHeight,rowIndex:i.rowIndex}));return this.ctx.database.setBatchCalculatedRowHeight(t)}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTipLine()}}class XC{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:i,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+i,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:i,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),i>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)"}),i<Math.floor(s.width-o-1)&&t!==a){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,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 i=[];this.data.forEach((s,o)=>{const n=new Ja(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,i.push(n)}),this.renderRows=i,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,i=[0,this.y,e,this.y];this.ctx.paint.drawLine(i,{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 zC{constructor(e){h(this,"isCut",!1),h(this,"isMultipleRow",!1),h(this,"ctx"),this.ctx=e,this.init()}init(){this.ctx.on("setMoveFocus",e=>{this.moveFocus(e)}),this.ctx.on("mousemove",Nr(e=>{var t,i;(t=this.ctx.focusCell)!=null&&t.fixed||(i=this.ctx.focusCellHeader)!=null&&i.fixed||!this.ctx.dragHeaderIng&&this.ctx.selectorMove&&this.ctx.startAdjustPosition(e)},100)),this.ctx.on("cellHoverChange",e=>{if(!this.ctx.autofillMove){if(e.operation){this.selectRows(e,!1);return}this.isMultipleRow||this.mouseenter()}}),this.ctx.on("cellMousedown",(e,t)=>{if(!(!this.ctx.isTarget(t)||this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||this.ctx.stageElement.style.cursor==="crosshair")){if(e.operation){this.isMultipleRow=!0,this.selectRows(e);return}window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.isMultipleRow=!1,this.click(t.shiftKey),this.ctx.emit("selectorClick",e)}}),this.ctx.on("mouseup",()=>{this.ctx.selectorMove=!1,this.ctx.stopAdjustPosition(),this.ctx.adjustPositioning=!1,this.ctx.disableHoverIconClick=!1}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.ctx.clearSelector(),e.operation?this.selectAll():this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing&&!this.ctx.finding){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:i}=this.ctx.selector;this.clearSelectedData(t,i);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("selectCols",e=>{this.selectCols(e)})}setSelector(e,t){if(this.ctx.dragHeaderIng)return;const{ENABLE_SELECTOR_SPAN_COL:i,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,n=t;if(!s){const[a]=n;n=[a,a]}if(!i){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.disableHoverIconClick=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:a,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:u,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,m=a,x=c||this.ctx.maxColIndex-u,v=d,p=f||this.ctx.maxRowIndex-g;let[E,C]=o,[w,b]=n;if(E<m||C>x||w<v||b>p)return;if(this.ctx.config.ENABLE_MERGE_CELL_LINK){const B=this.adjustMergeCells(o,n);w=B.yArr[0],b=B.yArr[1],E=B.xArr[0],C=B.xArr[1],this.ctx.onlyMergeCell=B.onlyMergeCell}E===C&&w===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(m,E),Math.min(x,C)],n=[Math.max(v,w),Math.min(p,b)];const{BEFORE_SET_SELECTOR_METHOD:T}=this.ctx.config;if(typeof T=="function"){const B=T({focusCell:this.ctx.focusCell,xArr:o,yArr:n});if(!B)return;o=B.xArr,n=B.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=n,b===this.ctx.maxRowIndex&&w===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,C===this.ctx.maxColIndex&&E===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var i;const[s,o]=t,[n,a]=e;if(o===this.ctx.maxRowIndex&&s===0||a===this.ctx.maxColIndex&&n===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let v=0;v<=t[1]-t[0];v++)for(let p=0;p<=e[1]-e[0];p++){const E=v+t[0],C=p+e[0],w=this.ctx.database.getVirtualBodyCell(E,C);w&&((E===s||E===o)&&c.push(w),(C===n||C===a)&&d.push(w))}const f=c.reduce((v,p)=>{const{yArr:E}=p.getSpanInfo(),[C,w]=E;return v.minY=Math.min(v.minY,C),v.maxY=Math.max(v.maxY,w),v},{minY:s,maxY:o}),u=d.reduce((v,p)=>{const{xArr:E}=p.getSpanInfo(),[C,w]=E;return v.minX=Math.min(v.minX,C),v.maxX=Math.max(v.maxX,w),v},{minX:n,maxX:a}),g=[u.minX,u.maxX],m=[f.minY,f.maxY];let x=!1;if(u.minX!==u.maxX||f.minY!==f.maxY){const v=JSON.stringify(g)+JSON.stringify(m),p=(i=this.ctx.focusCell)==null?void 0:i.getSpanInfo();x=(p&&JSON.stringify(p.xArr)+JSON.stringify(p.yArr))===v}return{xArr:g,yArr:m,onlyMergeCell:x}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:i,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,n=i||this.ctx.maxRowIndex-s;if(this.ctx.focusCellHeader){const{colIndex:a}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),this.ctx.mousedown&&e.colIndex>=a){const c=[a,e.colIndex+e.colspan-1],d=[o,n];this.setSelector(c,d)}else{const c=[e.colIndex,a+e.colspan-1],d=[o,n];this.setSelector(c,d)}}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:i,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,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c,m=[d,f],x=[u,g];this.setSelector(m,x)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=s||this.ctx.maxColIndex-o,a=i;if(t){this.ctx.setFocusCell(e);const c=[a,n],d=[e.rowIndex,e.rowIndex];this.setSelector(c,d)}if(this.ctx.focusCell&&this.ctx.mousedown){const{rowIndex:c}=this.ctx.focusCell;if(e.rowIndex>=c){const d=[a,n],f=[c,e.rowIndex];this.setSelector(d,f)}else{const d=[a,n],f=[e.rowIndex,c];this.setSelector(d,f)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:i}=this.ctx;if(e&&t&&i){const{rowIndex:s,colIndex:o}=t,n=Math.min(i.colIndex,o),a=Math.max(i.colIndex,o),c=Math.min(i.rowIndex,s),d=Math.max(i.rowIndex,s),f=[n,a],u=[c,d];this.setSelector(f,u)}}click(e=!1){const{focusCell:t,clickCell:i}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,i&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=i,{colIndex:n,rowIndex:a}=t,c=Math.min(n,s),d=Math.max(n,s),f=Math.min(a,o),u=Math.max(a,o),g=[c,d],m=[f,u];this.setSelector(g,m)}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 i=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return i==null?void 0:i.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:i}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,i))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const n=this.ctx.focusCell;e=[[n.getValue()]],t=[n.colIndex,n.colIndex],i=[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:i});if(!n)return;e=n.data}const o=IC(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,i=!1,s=null){let o=[];const n=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const f=c+t[0],u=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(f,u);if(g){const{rowKey:m,key:x}=g;this.ctx.database.getReadonly(m,x)||(n.add(m),o.push({rowKey:m,key:x,value:s,row:{}}))}}if(!o.length)return[];if(i)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],i=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let n=RC(o);const a=[i,i+n[0].length-1],c=[t,t+n.length-1],[d,f]=c,[u,g]=a,m=f-this.ctx.maxRowIndex,x=g-this.ctx.maxColIndex;(m>0||x>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:f,maxX:g,minY:d,minX:u,overflowRowCount:m,overflowColCount:x,textArr:n});const v=n.length===1&&n[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!v){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 p=[];for(let w=0;w<=n.length-1;w++){const b=n[w].length;for(let T=0;T<=b-1;T++){const B=w+t,K=T+i,R=n[w][T],I=this.ctx.database.getItemValueForRowIndexAndColIndex(B,K);if(I){const{rowKey:_,key:O}=I;this.ctx.database.getReadonly(_,O)||(s.add(_),p.push({rowKey:_,key:O,value:R,row:{}}))}}}if(this.isCut){const w=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=p.map(T=>`${T.rowKey}-${T.key}`);w.forEach(T=>{b.includes(`${T.rowKey}-${T.key}`)||p.unshift(T)}),this.isCut=!1}if(!p.length)return;const{BEFORE_PASTE_DATA_METHOD:E}=this.ctx.config;if(typeof E=="function"){const w=E,b=p.map(T=>({rowKey:T.rowKey,key:T.key,value:T.value,oldValue:this.ctx.database.getItemValue(T.rowKey,T.key),row:this.ctx.database.getRowDataItemForRowKey(T.rowKey)}));if(p=await w(b,a,c,n),p&&!p.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(p,!0);let C=[];s.forEach(w=>{C.push(this.ctx.database.getRowDataItemForRowKey(w))}),this.ctx.emit("pasteChange",p,C),this.ctx.emit("draw")}).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:i=0,rowIndex:s=0}=t;const o=0,n=0,a=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":i>o&&i--;break;case"TOP":s>n&&s--;break;case"RIGHT":i<a&&i++;break;case"BOTTOM":s<c&&s++;break}const d=[i,i],f=[s,s],u=this.getCell(s,i);u&&(u.operation||this.isInSettingRange(u.rowIndex,u.colIndex)&&(this.ctx.setFocusCell(u),this.setSelector(d,f),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",u),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:i,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,d=i,f=s||this.ctx.maxColIndex-a,u=o,g=n||this.ctx.maxRowIndex-c;return!(t<d||t>f||e<u||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:i,fixedRightWidth:s,fixedLeftWidth:o,header:n,footer:a,body:c,scrollX:d,scrollY:f,config:{SCROLLER_TRACK_SIZE:u,FOOTER_FIXED:g,FOOTER_POSITION:m,ENABLE_MERGE_CELL_LINK:x}}=this.ctx;if(!i)return;x&&this.ctx.onlyMergeCell&&i.updateSpanInfo();const{drawX:v,drawY:p,width:E,height:C,fixed:w}=i,b=o-v+1,T=i.drawX+E-(t-s)+1;let B=n.height-p,K=C;K>c.visibleHeight&&(K=c.visibleHeight);let R=0;g&&(m==="top"?B=n.height+a.height-p:R=a.visibleHeight);const I=p+K-(e-R-u);let _=d,O=f;T>0&&!w?_=Math.floor(d+T):b>0&&!w&&(_=Math.floor(d-b)),B>0?O=Math.floor(f-B):I>0&&(O=Math.floor(f+I)),(Math.abs(d-_)>2||Math.abs(f-O)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.emit("adjustBoundaryPosition",i),this.ctx.setScroll(_,O))}destroy(){}}class GC{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:i}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:n,drawY:a,width:c,height:d}=this.maxColRowCell,f=6,u=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=n+c-f+u,m=a+d-f+u;t>g&&i>m&&t<g+f&&i<m+f&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:i}=this.ctx.selector,s=t[1],o=i[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(),this.ctx.stopAdjustPosition()})}isAutofillIng(){const{xArr:e,yArr:t}=this.ctx.selector;return!(JSON.stringify(this.ctx.autofill.xArr)===JSON.stringify(e)&&JSON.stringify(this.ctx.autofill.yArr)===JSON.stringify(t))}setMousedown(){this.ctx.autofill.enable=!0,this.ctx.autofillMove=!0,this.ctx.disableHoverIconClick=!0}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1],setTimeout(()=>{this.ctx.disableHoverIconClick=!1},0))}setAutofill(e,t){const{ENABLE_AUTOFILL:i,ENABLE_AUTOFILL_SPAN_COL:s,ENABLE_AUTOFILL_SPAN_ROW:o}=this.ctx.config;if(!i)return;let n=e,a=t;const c=this.ctx.selector.xArr,d=this.ctx.selector.yArr;if(!(!o&&JSON.stringify(d)!==JSON.stringify(a))&&!(!s&&JSON.stringify(c)!==JSON.stringify(n))&&(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(n)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(a))){const{SELECTOR_AREA_MIN_X:f,SELECTOR_AREA_MAX_X:u,SELECTOR_AREA_MIN_Y:g,SELECTOR_AREA_MAX_Y:m,SELECTOR_AREA_MAX_X_OFFSET:x,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=f,E=u||this.ctx.maxColIndex-x,C=g,w=m||this.ctx.maxRowIndex-v;let[b,T]=n,[B,K]=a;if(b<p||B<C)return;n=[Math.max(p,b),Math.min(E,T)],a=[Math.max(C,B),Math.min(w,K)];const{BEFORE_SET_AUTOFILL_METHOD:R}=this.ctx.config;if(typeof R=="function"){const I=R({focusCell:this.ctx.focusCell,xArr:n,yArr:a});if(!I)return;n=I.xArr,a=I.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(),i=new Map;for(let m=0;m<=t.yArr[1]-t.yArr[0];m++)for(let x=0;x<=t.xArr[1]-t.xArr[0];x++){const v=m+t.yArr[0],p=x+t.xArr[0];i.set(`${v}-${p}`,!0)}const{value:s}=t,o=s[0].length,n=s.length,a=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&n===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(a,c)&&!d){const m={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",m):alert(m.message);return}let f=[];for(let m=0;m<=c[1]-c[0];m++)for(let x=0;x<=a[1]-a[0];x++){const v=x+a[0],p=m+c[0],E=s[m%n][x%o],C=this.ctx.database.getItemValueForRowIndexAndColIndex(p,v),w=`${p}-${v}`;if(C&&!i.has(w)){const{rowKey:b,key:T}=C;this.ctx.database.getReadonly(b,T)||(e.add(b),f.push({rowKey:b,key:T,value:E,row:{}}))}}if(!f.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:u}=this.ctx.config;if(typeof u=="function"){const m=u,x=f.map(v=>({rowKey:v.rowKey,key:v.key,value:v.value,oldValue:this.ctx.database.getItemValue(v.rowKey,v.key),row:this.ctx.database.getRowDataItemForRowKey(v.rowKey)}));if(f=await m(x,a,c),f&&!f.length)return}this.ctx.batchSetItemValueByEditor(f,!0);let g=[];e.forEach(m=>{g.push(this.ctx.database.getRowDataItemForRowKey(m))}),this.ctx.emit("autofillChange",f,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:i}=this.ctx;if(this.ctx.mousedown&&t.enable&&i.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 Et=Math.min,st=Math.max,Ci=Math.round,gi=Math.floor,Oe=r=>({x:r,y:r}),UC={left:"right",right:"left",bottom:"top",top:"bottom"},qC={start:"end",end:"start"};function ur(r,e,t){return st(r,Et(e,t))}function qt(r,e){return typeof r=="function"?r(e):r}function ot(r){return r.split("-")[0]}function Zt(r){return r.split("-")[1]}function Qa(r){return r==="x"?"y":"x"}function Fr(r){return r==="y"?"height":"width"}const ZC=new Set(["top","bottom"]);function We(r){return ZC.has(ot(r))?"y":"x"}function Kr(r){return Qa(We(r))}function JC(r,e,t){t===void 0&&(t=!1);const i=Zt(r),s=Kr(r),o=Fr(s);let n=s==="x"?i===(t?"end":"start")?"right":"left":i==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(n=bi(n)),[n,bi(n)]}function QC(r){const e=bi(r);return[fr(r),e,fr(e)]}function fr(r){return r.replace(/start|end/g,e=>qC[e])}const Mo=["left","right"],Ao=["right","left"],jC=["top","bottom"],eb=["bottom","top"];function tb(r,e,t){switch(r){case"top":case"bottom":return t?e?Ao:Mo:e?Mo:Ao;case"left":case"right":return e?jC:eb;default:return[]}}function ib(r,e,t,i){const s=Zt(r);let o=tb(ot(r),t==="start",i);return s&&(o=o.map(n=>n+"-"+s),e&&(o=o.concat(o.map(fr)))),o}function bi(r){return r.replace(/left|right|bottom|top/g,e=>UC[e])}function rb(r){return{top:0,right:0,bottom:0,left:0,...r}}function ja(r){return typeof r!="number"?rb(r):{top:r,right:r,bottom:r,left:r}}function _i(r){const{x:e,y:t,width:i,height:s}=r;return{width:i,height:s,top:t,left:e,right:e+i,bottom:t+s,x:e,y:t}}function No(r,e,t){let{reference:i,floating:s}=r;const o=We(e),n=Kr(e),a=Fr(n),c=ot(e),d=o==="y",f=i.x+i.width/2-s.width/2,u=i.y+i.height/2-s.height/2,g=i[a]/2-s[a]/2;let m;switch(c){case"top":m={x:f,y:i.y-s.height};break;case"bottom":m={x:f,y:i.y+i.height};break;case"right":m={x:i.x+i.width,y:u};break;case"left":m={x:i.x-s.width,y:u};break;default:m={x:i.x,y:i.y}}switch(Zt(e)){case"start":m[n]-=g*(t&&d?-1:1);break;case"end":m[n]+=g*(t&&d?-1:1);break}return m}const sb=async(r,e,t)=>{const{placement:i="bottom",strategy:s="absolute",middleware:o=[],platform:n}=t,a=o.filter(Boolean),c=await(n.isRTL==null?void 0:n.isRTL(e));let d=await n.getElementRects({reference:r,floating:e,strategy:s}),{x:f,y:u}=No(d,i,c),g=i,m={},x=0;for(let v=0;v<a.length;v++){const{name:p,fn:E}=a[v],{x:C,y:w,data:b,reset:T}=await E({x:f,y:u,initialPlacement:i,placement:g,strategy:s,middlewareData:m,rects:d,platform:n,elements:{reference:r,floating:e}});f=C??f,u=w??u,m={...m,[p]:{...m[p],...b}},T&&x<=50&&(x++,typeof T=="object"&&(T.placement&&(g=T.placement),T.rects&&(d=T.rects===!0?await n.getElementRects({reference:r,floating:e,strategy:s}):T.rects),{x:f,y:u}=No(d,g,c)),v=-1)}return{x:f,y:u,placement:g,strategy:s,middlewareData:m}};async function el(r,e){var t;e===void 0&&(e={});const{x:i,y:s,platform:o,rects:n,elements:a,strategy:c}=r,{boundary:d="clippingAncestors",rootBoundary:f="viewport",elementContext:u="floating",altBoundary:g=!1,padding:m=0}=qt(e,r),x=ja(m),v=a[g?u==="floating"?"reference":"floating":u],p=_i(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(v)))==null||t?v:v.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(a.floating)),boundary:d,rootBoundary:f,strategy:c})),E=u==="floating"?{x:i,y:s,width:n.floating.width,height:n.floating.height}:n.reference,C=await(o.getOffsetParent==null?void 0:o.getOffsetParent(a.floating)),w=await(o.isElement==null?void 0:o.isElement(C))?await(o.getScale==null?void 0:o.getScale(C))||{x:1,y:1}:{x:1,y:1},b=_i(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:a,rect:E,offsetParent:C,strategy:c}):E);return{top:(p.top-b.top+x.top)/w.y,bottom:(b.bottom-p.bottom+x.bottom)/w.y,left:(p.left-b.left+x.left)/w.x,right:(b.right-p.right+x.right)/w.x}}const ob=r=>({name:"arrow",options:r,async fn(e){const{x:t,y:i,placement:s,rects:o,platform:n,elements:a,middlewareData:c}=e,{element:d,padding:f=0}=qt(r,e)||{};if(d==null)return{};const u=ja(f),g={x:t,y:i},m=Kr(s),x=Fr(m),v=await n.getDimensions(d),p=m==="y",E=p?"top":"left",C=p?"bottom":"right",w=p?"clientHeight":"clientWidth",b=o.reference[x]+o.reference[m]-g[m]-o.floating[x],T=g[m]-o.reference[m],B=await(n.getOffsetParent==null?void 0:n.getOffsetParent(d));let K=B?B[w]:0;(!K||!await(n.isElement==null?void 0:n.isElement(B)))&&(K=a.floating[w]||o.floating[x]);const R=b/2-T/2,I=K/2-v[x]/2-1,_=Et(u[E],I),O=Et(u[C],I),y=_,D=K-v[x]-O,L=K/2-v[x]/2+R,Y=ur(y,L,D),W=!c.arrow&&Zt(s)!=null&&L!==Y&&o.reference[x]/2-(L<y?_:O)-v[x]/2<0,P=W?L<y?L-y:L-D:0;return{[m]:g[m]+P,data:{[m]:Y,centerOffset:L-Y-P,...W&&{alignmentOffset:P}},reset:W}}}),nb=function(r){return r===void 0&&(r={}),{name:"flip",options:r,async fn(e){var t,i;const{placement:s,middlewareData:o,rects:n,initialPlacement:a,platform:c,elements:d}=e,{mainAxis:f=!0,crossAxis:u=!0,fallbackPlacements:g,fallbackStrategy:m="bestFit",fallbackAxisSideDirection:x="none",flipAlignment:v=!0,...p}=qt(r,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const E=ot(s),C=We(a),w=ot(a)===a,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),T=g||(w||!v?[bi(a)]:QC(a)),B=x!=="none";!g&&B&&T.push(...ib(a,v,x,b));const K=[a,...T],R=await el(e,p),I=[];let _=((i=o.flip)==null?void 0:i.overflows)||[];if(f&&I.push(R[E]),u){const L=JC(s,n,b);I.push(R[L[0]],R[L[1]])}if(_=[..._,{placement:s,overflows:I}],!I.every(L=>L<=0)){var O,y;const L=(((O=o.flip)==null?void 0:O.index)||0)+1,Y=K[L];if(Y&&(!(u==="alignment"&&C!==We(Y))||_.every(P=>We(P.placement)===C?P.overflows[0]>0:!0)))return{data:{index:L,overflows:_},reset:{placement:Y}};let W=(y=_.filter(P=>P.overflows[0]<=0).sort((P,X)=>P.overflows[1]-X.overflows[1])[0])==null?void 0:y.placement;if(!W)switch(m){case"bestFit":{var D;const P=(D=_.filter(X=>{if(B){const U=We(X.placement);return U===C||U==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(U=>U>0).reduce((U,q)=>U+q,0)]).sort((X,U)=>X[1]-U[1])[0])==null?void 0:D[0];P&&(W=P);break}case"initialPlacement":W=a;break}if(s!==W)return{reset:{placement:W}}}return{}}}},ab=new Set(["left","top"]);async function lb(r,e){const{placement:t,platform:i,elements:s}=r,o=await(i.isRTL==null?void 0:i.isRTL(s.floating)),n=ot(t),a=Zt(t),c=We(t)==="y",d=ab.has(n)?-1:1,f=o&&c?-1:1,u=qt(e,r);let{mainAxis:g,crossAxis:m,alignmentAxis:x}=typeof u=="number"?{mainAxis:u,crossAxis:0,alignmentAxis:null}:{mainAxis:u.mainAxis||0,crossAxis:u.crossAxis||0,alignmentAxis:u.alignmentAxis};return a&&typeof x=="number"&&(m=a==="end"?x*-1:x),c?{x:m*f,y:g*d}:{x:g*d,y:m*f}}const cb=function(r){return r===void 0&&(r=0),{name:"offset",options:r,async fn(e){var t,i;const{x:s,y:o,placement:n,middlewareData:a}=e,c=await lb(e,r);return n===((t=a.offset)==null?void 0:t.placement)&&(i=a.arrow)!=null&&i.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:n}}}}},hb=function(r){return r===void 0&&(r={}),{name:"shift",options:r,async fn(e){const{x:t,y:i,placement:s}=e,{mainAxis:o=!0,crossAxis:n=!1,limiter:a={fn:p=>{let{x:E,y:C}=p;return{x:E,y:C}}},...c}=qt(r,e),d={x:t,y:i},f=await el(e,c),u=We(ot(s)),g=Qa(u);let m=d[g],x=d[u];if(o){const p=g==="y"?"top":"left",E=g==="y"?"bottom":"right",C=m+f[p],w=m-f[E];m=ur(C,m,w)}if(n){const p=u==="y"?"top":"left",E=u==="y"?"bottom":"right",C=x+f[p],w=x-f[E];x=ur(C,x,w)}const v=a.fn({...e,[g]:m,[u]:x});return{...v,data:{x:v.x-t,y:v.y-i,enabled:{[g]:o,[u]:n}}}}}};function Hi(){return typeof window<"u"}function Ot(r){return tl(r)?(r.nodeName||"").toLowerCase():"#document"}function le(r){var e;return(r==null||(e=r.ownerDocument)==null?void 0:e.defaultView)||window}function Me(r){var e;return(e=(tl(r)?r.ownerDocument:r.document)||window.document)==null?void 0:e.documentElement}function tl(r){return Hi()?r instanceof Node||r instanceof le(r).Node:!1}function Ee(r){return Hi()?r instanceof Element||r instanceof le(r).Element:!1}function ke(r){return Hi()?r instanceof HTMLElement||r instanceof le(r).HTMLElement:!1}function Bo(r){return!Hi()||typeof ShadowRoot>"u"?!1:r instanceof ShadowRoot||r instanceof le(r).ShadowRoot}const db=new Set(["inline","contents"]);function Jt(r){const{overflow:e,overflowX:t,overflowY:i,display:s}=Ce(r);return/auto|scroll|overlay|hidden|clip/.test(e+i+t)&&!db.has(s)}const ub=new Set(["table","td","th"]);function fb(r){return ub.has(Ot(r))}const gb=[":popover-open",":modal"];function Fi(r){return gb.some(e=>{try{return r.matches(e)}catch{return!1}})}const vb=["transform","translate","scale","rotate","perspective"],mb=["transform","translate","scale","rotate","perspective","filter"],xb=["paint","layout","strict","content"];function Pr(r){const e=Yr(),t=Ee(r)?Ce(r):r;return vb.some(i=>t[i]?t[i]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||mb.some(i=>(t.willChange||"").includes(i))||xb.some(i=>(t.contain||"").includes(i))}function pb(r){let e=ze(r);for(;ke(e)&&!Ct(e);){if(Pr(e))return e;if(Fi(e))return null;e=ze(e)}return null}function Yr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const yb=new Set(["html","body","#document"]);function Ct(r){return yb.has(Ot(r))}function Ce(r){return le(r).getComputedStyle(r)}function Ki(r){return Ee(r)?{scrollLeft:r.scrollLeft,scrollTop:r.scrollTop}:{scrollLeft:r.scrollX,scrollTop:r.scrollY}}function ze(r){if(Ot(r)==="html")return r;const e=r.assignedSlot||r.parentNode||Bo(r)&&r.host||Me(r);return Bo(e)?e.host:e}function il(r){const e=ze(r);return Ct(e)?r.ownerDocument?r.ownerDocument.body:r.body:ke(e)&&Jt(e)?e:il(e)}function Ft(r,e,t){var i;e===void 0&&(e=[]),t===void 0&&(t=!0);const s=il(r),o=s===((i=r.ownerDocument)==null?void 0:i.body),n=le(s);if(o){const a=gr(n);return e.concat(n,n.visualViewport||[],Jt(s)?s:[],a&&t?Ft(a):[])}return e.concat(s,Ft(s,[],t))}function gr(r){return r.parent&&Object.getPrototypeOf(r.parent)?r.frameElement:null}function rl(r){const e=Ce(r);let t=parseFloat(e.width)||0,i=parseFloat(e.height)||0;const s=ke(r),o=s?r.offsetWidth:t,n=s?r.offsetHeight:i,a=Ci(t)!==o||Ci(i)!==n;return a&&(t=o,i=n),{width:t,height:i,$:a}}function Vr(r){return Ee(r)?r:r.contextElement}function yt(r){const e=Vr(r);if(!ke(e))return Oe(1);const t=e.getBoundingClientRect(),{width:i,height:s,$:o}=rl(e);let n=(o?Ci(t.width):t.width)/i,a=(o?Ci(t.height):t.height)/s;return(!n||!Number.isFinite(n))&&(n=1),(!a||!Number.isFinite(a))&&(a=1),{x:n,y:a}}const wb=Oe(0);function sl(r){const e=le(r);return!Yr()||!e.visualViewport?wb:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function Eb(r,e,t){return e===void 0&&(e=!1),!t||e&&t!==le(r)?!1:e}function nt(r,e,t,i){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=r.getBoundingClientRect(),o=Vr(r);let n=Oe(1);e&&(i?Ee(i)&&(n=yt(i)):n=yt(r));const a=Eb(o,t,i)?sl(o):Oe(0);let c=(s.left+a.x)/n.x,d=(s.top+a.y)/n.y,f=s.width/n.x,u=s.height/n.y;if(o){const g=le(o),m=i&&Ee(i)?le(i):i;let x=g,v=gr(x);for(;v&&i&&m!==x;){const p=yt(v),E=v.getBoundingClientRect(),C=Ce(v),w=E.left+(v.clientLeft+parseFloat(C.paddingLeft))*p.x,b=E.top+(v.clientTop+parseFloat(C.paddingTop))*p.y;c*=p.x,d*=p.y,f*=p.x,u*=p.y,c+=w,d+=b,x=le(v),v=gr(x)}}return _i({width:f,height:u,x:c,y:d})}function Wr(r,e){const t=Ki(r).scrollLeft;return e?e.left+t:nt(Me(r)).left+t}function ol(r,e,t){t===void 0&&(t=!1);const i=r.getBoundingClientRect(),s=i.left+e.scrollLeft-(t?0:Wr(r,i)),o=i.top+e.scrollTop;return{x:s,y:o}}function Cb(r){let{elements:e,rect:t,offsetParent:i,strategy:s}=r;const o=s==="fixed",n=Me(i),a=e?Fi(e.floating):!1;if(i===n||a&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Oe(1);const f=Oe(0),u=ke(i);if((u||!u&&!o)&&((Ot(i)!=="body"||Jt(n))&&(c=Ki(i)),ke(i))){const m=nt(i);d=yt(i),f.x=m.x+i.clientLeft,f.y=m.y+i.clientTop}const g=n&&!u&&!o?ol(n,c,!0):Oe(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+f.x+g.x,y:t.y*d.y-c.scrollTop*d.y+f.y+g.y}}function bb(r){return Array.from(r.getClientRects())}function _b(r){const e=Me(r),t=Ki(r),i=r.ownerDocument.body,s=st(e.scrollWidth,e.clientWidth,i.scrollWidth,i.clientWidth),o=st(e.scrollHeight,e.clientHeight,i.scrollHeight,i.clientHeight);let n=-t.scrollLeft+Wr(r);const a=-t.scrollTop;return Ce(i).direction==="rtl"&&(n+=st(e.clientWidth,i.clientWidth)-s),{width:s,height:o,x:n,y:a}}function Rb(r,e){const t=le(r),i=Me(r),s=t.visualViewport;let o=i.clientWidth,n=i.clientHeight,a=0,c=0;if(s){o=s.width,n=s.height;const d=Yr();(!d||d&&e==="fixed")&&(a=s.offsetLeft,c=s.offsetTop)}return{width:o,height:n,x:a,y:c}}const Ib=new Set(["absolute","fixed"]);function Sb(r,e){const t=nt(r,!0,e==="fixed"),i=t.top+r.clientTop,s=t.left+r.clientLeft,o=ke(r)?yt(r):Oe(1),n=r.clientWidth*o.x,a=r.clientHeight*o.y,c=s*o.x,d=i*o.y;return{width:n,height:a,x:c,y:d}}function Ho(r,e,t){let i;if(e==="viewport")i=Rb(r,t);else if(e==="document")i=_b(Me(r));else if(Ee(e))i=Sb(e,t);else{const s=sl(r);i={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return _i(i)}function nl(r,e){const t=ze(r);return t===e||!Ee(t)||Ct(t)?!1:Ce(t).position==="fixed"||nl(t,e)}function Tb(r,e){const t=e.get(r);if(t)return t;let i=Ft(r,[],!1).filter(a=>Ee(a)&&Ot(a)!=="body"),s=null;const o=Ce(r).position==="fixed";let n=o?ze(r):r;for(;Ee(n)&&!Ct(n);){const a=Ce(n),c=Pr(n);!c&&a.position==="fixed"&&(s=null),(o?!c&&!s:!c&&a.position==="static"&&s&&Ib.has(s.position)||Jt(n)&&!c&&nl(r,n))?i=i.filter(d=>d!==n):s=a,n=ze(n)}return e.set(r,i),i}function Ob(r){let{element:e,boundary:t,rootBoundary:i,strategy:s}=r;const o=[...t==="clippingAncestors"?Fi(e)?[]:Tb(e,this._c):[].concat(t),i],n=o[0],a=o.reduce((c,d)=>{const f=Ho(e,d,s);return c.top=st(f.top,c.top),c.right=Et(f.right,c.right),c.bottom=Et(f.bottom,c.bottom),c.left=st(f.left,c.left),c},Ho(e,n,s));return{width:a.right-a.left,height:a.bottom-a.top,x:a.left,y:a.top}}function kb(r){const{width:e,height:t}=rl(r);return{width:e,height:t}}function Lb(r,e,t){const i=ke(e),s=Me(e),o=t==="fixed",n=nt(r,!0,o,e);let a={scrollLeft:0,scrollTop:0};const c=Oe(0);function d(){c.x=Wr(s)}if(i||!i&&!o)if((Ot(e)!=="body"||Jt(s))&&(a=Ki(e)),i){const m=nt(e,!0,o,e);c.x=m.x+e.clientLeft,c.y=m.y+e.clientTop}else s&&d();o&&!i&&s&&d();const f=s&&!i&&!o?ol(s,a):Oe(0),u=n.left+a.scrollLeft-c.x-f.x,g=n.top+a.scrollTop-c.y-f.y;return{x:u,y:g,width:n.width,height:n.height}}function nr(r){return Ce(r).position==="static"}function Fo(r,e){if(!ke(r)||Ce(r).position==="fixed")return null;if(e)return e(r);let t=r.offsetParent;return Me(r)===t&&(t=t.ownerDocument.body),t}function al(r,e){const t=le(r);if(Fi(r))return t;if(!ke(r)){let s=ze(r);for(;s&&!Ct(s);){if(Ee(s)&&!nr(s))return s;s=ze(s)}return t}let i=Fo(r,e);for(;i&&fb(i)&&nr(i);)i=Fo(i,e);return i&&Ct(i)&&nr(i)&&!Pr(i)?t:i||pb(r)||t}const Db=async function(r){const e=this.getOffsetParent||al,t=this.getDimensions,i=await t(r.floating);return{reference:Lb(r.reference,await e(r.floating),r.strategy),floating:{x:0,y:0,width:i.width,height:i.height}}};function $b(r){return Ce(r).direction==="rtl"}const Mb={convertOffsetParentRelativeRectToViewportRelativeRect:Cb,getDocumentElement:Me,getClippingRect:Ob,getOffsetParent:al,getElementRects:Db,getClientRects:bb,getDimensions:kb,getScale:yt,isElement:Ee,isRTL:$b};function ll(r,e){return r.x===e.x&&r.y===e.y&&r.width===e.width&&r.height===e.height}function Ab(r,e){let t=null,i;const s=Me(r);function o(){var a;clearTimeout(i),(a=t)==null||a.disconnect(),t=null}function n(a,c){a===void 0&&(a=!1),c===void 0&&(c=1),o();const d=r.getBoundingClientRect(),{left:f,top:u,width:g,height:m}=d;if(a||e(),!g||!m)return;const x=gi(u),v=gi(s.clientWidth-(f+g)),p=gi(s.clientHeight-(u+m)),E=gi(f),C={rootMargin:-x+"px "+-v+"px "+-p+"px "+-E+"px",threshold:st(0,Et(1,c))||1};let w=!0;function b(T){const B=T[0].intersectionRatio;if(B!==c){if(!w)return n();B?n(!1,B):i=setTimeout(()=>{n(!1,1e-7)},1e3)}B===1&&!ll(d,r.getBoundingClientRect())&&n(),w=!1}try{t=new IntersectionObserver(b,{...C,root:s.ownerDocument})}catch{t=new IntersectionObserver(b,C)}t.observe(r)}return n(!0),o}function vr(r,e,t,i){i===void 0&&(i={});const{ancestorScroll:s=!0,ancestorResize:o=!0,elementResize:n=typeof ResizeObserver=="function",layoutShift:a=typeof IntersectionObserver=="function",animationFrame:c=!1}=i,d=Vr(r),f=s||o?[...d?Ft(d):[],...Ft(e)]:[];f.forEach(E=>{s&&E.addEventListener("scroll",t,{passive:!0}),o&&E.addEventListener("resize",t)});const u=d&&a?Ab(d,t):null;let g=-1,m=null;n&&(m=new ResizeObserver(E=>{let[C]=E;C&&C.target===d&&m&&(m.unobserve(e),cancelAnimationFrame(g),g=requestAnimationFrame(()=>{var w;(w=m)==null||w.observe(e)})),t()}),d&&!c&&m.observe(d),m.observe(e));let x,v=c?nt(r):null;c&&p();function p(){const E=nt(r);v&&!ll(v,E)&&t(),v=E,x=requestAnimationFrame(p)}return t(),()=>{var E;f.forEach(C=>{s&&C.removeEventListener("scroll",t),o&&C.removeEventListener("resize",t)}),u==null||u(),(E=m)==null||E.disconnect(),m=null,c&&cancelAnimationFrame(x)}}const Ri=cb,Ii=hb,Xr=nb,Nb=ob,Si=(r,e,t)=>{const i=new Map,s={platform:Mb,...t},o={...s.platform,_c:i};return sb(r,e,{...s,platform:o})};let Bb=class{constructor(r){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=r;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:i,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:i,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",r=>{this.floatingEl.contains(r.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||(r.ellipsis||r.message)&&this.show(r)}),this.ctx.on("visibleCellMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellFooterMouseleave",(r,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellFooterHoverChange",(r,e)=>{this.floatingEl.contains(e.target)||r.ellipsis&&this.show(r)}),this.ctx.on("cellShowTooltip",(r,e)=>{this.show(r,e)}),this.ctx.on("cellHideTooltip",()=>{this.hide()})}show(r,e){if(this.ctx.contextMenuIng||!r.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let t=r.getText();r.message&&(t=r.message),e&&(t=e);const i=this.ctx.containerElement.getBoundingClientRect();if(!i)return;this.enable=!0,this.contentEl.style.maxWidth=`${r.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=t;const s=r.drawX+i.x,o=r.drawY+i.y;Si({getBoundingClientRect(){return{width:r.visibleWidth,height:r.visibleHeight,x:s,y:o,left:s,right:s+r.visibleWidth,top:o,bottom:o+r.visibleHeight}}},this.floatingEl,{placement:r.overflowTooltipPlacement,middleware:[Ii(),Xr(),Ri(6),Nb({element:this.arrowEl})]}).then(n=>{const{x:a,y:c,placement:d,middlewareData:f}=n;if(Object.assign(this.floatingEl.style,{top:`${c}px`,left:`${a}px`}),f.arrow){const u=f.arrow;["left","left-start","left-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(d)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(d)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(d)&&Object.assign(this.arrowEl.style,{top:"",bottom:"-5px",left:`${u.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 Hb{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:i}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(i)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("hoverIconClick",e=>{this.ctx.disableHoverIconClick||this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("cellMousedown",()=>{this.inputEl.focus({preventScroll:!0})}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell||this.ctx.finding)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.key==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const a=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,a),d=this.inputEl.value.substring(a);this.inputEl.value=c+`
|
|
5
|
+
`+d,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.key==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.key==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,i=e.ctrlKey,s=e.altKey,o=e.shiftKey,n=e.metaKey;i||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("cellMouseup",e=>{if(this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:i}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(i);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()}}),this.ctx.on("mousedownBodyOutside",()=>{this.enable&&this.doneEdit(),this.cellTarget=null})}isInSelectorRange(e,t){const{xArr:i,yArr:s}=this.ctx.selector,[o,n]=i,[a,c]=s;return!(t<o||t>n||e<a||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.id="e-virt-table-editor-textarea",this.inputEl.setAttribute("rows","1"),this.inputEl.setAttribute("tabindex","-1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){const e=this.inputEl.value;this.cellTarget&&this.cellTarget.type==="number"&&e!==""&&(this.ctx.emit("cellHideTooltip"),/^-?\d+(\.\d+)?$/.test(e)||this.ctx.emit("cellShowTooltip",this.cellTarget,this.ctx.config.NUMBER_ERROR_TIP)),this.inputEl.style.height="auto";let t=this.inputEl.scrollHeight,i=this.ctx.body.visibleHeight;t>i&&(t=i);const{stageHeight:s,footer:o,header:n,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,c=s-o.height-a;this.editorEl.style.bottom="auto",this.drawY<n.height&&(this.editorEl.style.top=`${n.height-1}px`),this.drawY+t>c&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${s-c}px`),this.inputEl.style.height=`${t}px`}startEditByInput(e,t=!1){const i=t?null:e.getValue(),{editorType:s}=e;if(s==="none")return;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:d},header:f}=this.ctx;let u=this.ctx.body.visibleHeight;o>u&&(o=u),this.editorEl.style.display="inline-block",this.editorEl.style.zIndex="100",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=`${u}px`,s==="text"?(this.inputEl.style.display="inline-block",this.inputEl.style.minWidth=`${n-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${u}px`,this.inputEl.style.width=`${n-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,this.inputEl.value="",i!==null&&(this.inputEl.value=i,this.inputEl.focus({preventScroll:!0}))):this.inputEl.style.display="none",(this.inputEl.scrollHeight>o||this.drawY<f.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,i=this.cellTarget.getValue(),s=this.inputEl.value;s!==i&&!(s===""&&i===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0)}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const i=this.ctx.focusCell;if(!i||["index","index-selection","selection"].includes(i.type)||this.enable||!(i.isVerticalVisible()&&i.isHorizontalVisible()))return;const{rowKey:s,key:o}=i,n=this.ctx.database.getReadonly(s,o);i&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=i,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget),this.ctx.emit("draw"))}editCell(e,t){const i=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!i)return;const s=i.cells.find(d=>d.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),this.ctx.emit("draw"))}doneEdit(){if(!this.enable)return;const{header:e,config:{CELL_HEIGHT:t}}=this.ctx;this.doneEditByInput(),this.ctx.emit("cellHideTooltip"),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.inputEl.style.display="inline-block",this.editorEl.style.left="0px",this.editorEl.style.top=`${e.height}px`,this.editorEl.style.maxHeight=`${t}px`,this.editorEl.style.zIndex="-1",setTimeout(()=>{this.inputEl.focus({preventScroll:!0})},0),this.ctx.emit("draw")}clearEditor(){this.doneEdit(),this.cellTarget=null,this.selectorArrStr="",this.ctx.clearSelector(),this.ctx.focusCell=void 0,this.ctx.emit("draw")}destroy(){var e;(e=this.editorEl)==null||e.remove()}}let Fb=class{constructor(r){h(this,"ctx"),h(this,"emptyEl"),this.ctx=r;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:i,headerHeight:s,bodyHeight:o,footerHeight:n})=>{const a=s+(o+n)/2,c={display:i==="empty"?"block":"none",top:`${a}px`,...t};Object.assign(this.emptyEl.style,c)})}destroy(){this.emptyEl.remove()}};class Kb{constructor(e){h(this,"ctx"),h(this,"observer"),this.ctx=e,this.init()}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[i,s]of e)if(!t.has(i)||t.get(i)!==s)return!1;return!0}init(){this.observer=new MutationObserver(Nr(()=>{const e=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),t=new Map;e.forEach(s=>{const o=Number(s.getAttribute("data-row-index")),n=Number(s.getAttribute("data-col-index"));if(isNaN(o)||isNaN(n))return;const a=s.getBoundingClientRect(),c=`${o}_${n}`;t.set(c,Math.round(a.height))});const i=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(i,t)){if(this.ctx.database.setOverlayerAutoHeightMap(t),i.size===0&&t.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0,characterData:!0}),this.ctx.overlayerElement.getAttribute("data-overlayer")==="default"&&this.ctx.on("overlayerChange",e=>{const t=this.ctx.overlayerElement;t.replaceChildren(),Object.assign(t.style,e.style),e.views.forEach(i=>{const s=document.createElement("div");s.className=i.class,Object.assign(s.style,i.style),i.views.forEach(o=>{const n=document.createElement("div");Object.assign(n.style,o.style),o.cells.forEach(a=>{const c=document.createElement("div");Object.assign(c.style,a.style),Object.keys(a.domDataset).forEach(d=>{c.setAttribute(d,a.domDataset[d])}),typeof a.render=="function"&&a.render(c,a),n.appendChild(c)}),s.appendChild(n)}),t.appendChild(s)})})}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),i=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:n}=this.ctx.config;return o?n==="top"?s=[e,i,t]:s=[e,t,i]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:i,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:n,renderCellHeaders:a}=this.ctx.header;let c=[],d=[],f=[];a.forEach(v=>{v.render&&(v.fixed==="left"?d.push(v):v.fixed==="right"?f.push(v):c.push(v))});const u=t-i,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${n}px`},cells:d},m={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-u+1}px`,height:`${n}px`},cells:c},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u+1}px`,height:`${n}px`},cells:f};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${n}px`},views:[g,m,x]}}getBody(){const e=[],t=[],i=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(v=>{v.cells.forEach(p=>{p.cellType==="footer"&&(p.render=p.renderFooter),p.render&&(p.fixed==="left"?t.push(p):p.fixed==="right"?i.push(p):e.push(p))})});const{fixedLeftWidth:o,fixedRightWidth:n,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:f}=this.ctx.body,u=n-a,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${f}px`},cells:t},m={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-u}px`,height:`${f}px`},cells:e},x={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${u}px`,height:`${f}px`},cells:i};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${f}px`},views:[g,m,x]}}getFooter(){const e=[],t=[],i=[];this.ctx.footer.renderRows.forEach(x=>{x.cells.forEach(v=>{v.cellType==="footer"&&v.renderFooter&&(v.render=v.renderFooter,v.fixed==="left"?t.push(v):v.fixed==="right"?i.push(v):e.push(v))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:a}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,f=o-n,u={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-f}px`,height:`${d}px`},cells:e},m={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${f}px`,height:`${d}px`},cells:i};return{type:"footer",class:`${a}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[u,g,m]}}}class Ko{constructor(e,t=[],i={}){h(this,"container"),h(this,"menuData"),h(this,"onClick"),h(this,"activeSubmenus",new Set),h(this,"boundMouseEnterHandler"),h(this,"boundMouseLeaveHandler"),h(this,"boundClickHandler"),this.container=e,this.menuData=t,this.onClick=i.onClick,this.boundMouseEnterHandler=s=>this.handleMouseEvent(s,"enter"),this.boundMouseLeaveHandler=s=>this.handleMouseEvent(s,"leave"),this.boundClickHandler=s=>this.handleClick(s),this.createMenu(),this.bindEvents()}createMenu(){this.container.className="e-virt-table-main-menu",this.container.style.display="block";const e=document.createDocumentFragment();this.menuData.forEach(t=>{e.appendChild(this.createMenuItem(t))}),this.container.appendChild(e)}createMenuItem(e,t=!1){var i;const s=this.createElement("div",t?"e-virt-table-submenu-item":"e-virt-table-menu-item");s.setAttribute(t?"data-submenu":"data-menu",e.value),e.disabled&&s.classList.add("disabled");const o=this.createElement("div","e-virt-table-menu-item-content");if(e.icon){const a=this.createElement("span","e-virt-table-menu-item-icon");a.innerHTML=e.icon,o.appendChild(a)}else o.classList.add("menu-item-no-icon");const n=this.createElement("span","e-virt-table-menu-item-text");if(n.textContent=e.label,o.appendChild(n),s.appendChild(o),(i=e.children)!=null&&i.length){const a=this.createElement("span","e-virt-table-menu-arrow");a.innerHTML=Ei,s.appendChild(a);const c=this.createSubmenu(e.children);s._submenu=c,this.container.appendChild(c)}return s}createSubmenu(e){const t=this.createElement("div","e-virt-table-submenu");return e.forEach(i=>{t.appendChild(this.createMenuItem(i,!0))}),t}createElement(e,t=""){const i=document.createElement(e);return t&&(i.className=t),i}bindEvents(){this.container.addEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.addEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.addEventListener("click",this.boundClickHandler)}handleMouseEvent(e,t){e.stopPropagation();const i=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");i&&(this.container.contains(i)||i.classList.contains("e-virt-table-submenu-item"))&&(t==="enter"?this.handleHover(i):this.handleLeave(i))}handleHover(e){e.classList.contains("e-virt-table-menu-item")&&(this.container.querySelectorAll(".e-virt-table-menu-item").forEach(i=>i.classList.remove("active")),e.classList.contains("disabled")||e.classList.add("active"));const t=e._submenu||e.querySelector(".e-virt-table-submenu");t&&(this.hideSiblingSubmenus(e),this.showSubmenu(e,t))}handleLeave(e){const t=e._submenu||e.querySelector(".e-virt-table-submenu");setTimeout(()=>{const i=t;i&&!i.matches(":hover")&&!e.matches(":hover")&&(this.hideSubmenu(i),e.classList.contains("e-virt-table-menu-item")&&e.classList.remove("active"))},150)}hideSiblingSubmenus(e){let t;if(e.classList.contains("e-virt-table-menu-item"))t=this.container.querySelectorAll(".e-virt-table-menu-item");else{const i=e.closest(".e-virt-table-submenu");if(i)t=i.querySelectorAll(".e-virt-table-submenu-item");else return}t.forEach(i=>{i!==e&&i._submenu&&this.hideSubmenu(i._submenu)})}async showSubmenu(e,t){if(this.activeSubmenus.has(t))return;this.activeSubmenus.add(t),t.classList.add("show");const i=vr(e,t,async()=>{const s=this.container.getBoundingClientRect(),o=window.innerWidth,n=t.offsetWidth||200,a=o-s.right,c=s.left,d=a>=n||a>=c?"right-start":"left-start",{x:f,y:u}=await Si(e,t,{placement:d,middleware:[Ri(8),Ii({padding:8})]});Object.assign(t.style,{left:`${f}px`,top:`${u}px`})});t._cleanup=i}hideSubmenu(e){if(!this.activeSubmenus.has(e))return;this.activeSubmenus.delete(e),e.classList.remove("show"),this.hideAllChildSubmenus(e);const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup)}hideAllChildSubmenus(e){e.querySelectorAll(".e-virt-table-submenu-item").forEach(t=>{if(t._submenu){const i=t._submenu;if(this.activeSubmenus.has(i)){this.activeSubmenus.delete(i),i.classList.remove("show");const s=i;s._cleanup&&(s._cleanup(),delete s._cleanup),this.hideAllChildSubmenus(i)}}})}handleClick(e){e.stopPropagation();const t=e.target.closest(".e-virt-table-menu-item, .e-virt-table-submenu-item");if(!t||t.classList.contains("disabled"))return;if(t.classList.contains("e-virt-table-menu-item")){const o=t._submenu||t.querySelector(".e-virt-table-submenu");if(o){this.showSubmenu(t,o);return}}const i=t.getAttribute("data-menu")||(t==null?void 0:t.getAttribute("data-submenu")),s=this.findMenuItem(i||"");s&&(s.event&&s.event(e,this.hide.bind(this)),this.onClick&&this.onClick(s,i||""))}findMenuItem(e,t=this.menuData){for(const i of t){if(i.value===e)return i;if(i.children){const s=this.findMenuItem(e,i.children);if(s)return s}}return null}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};vr(t,this.container,()=>{Si(t,this.container,{placement:"right-start",middleware:[Ri(),Ii(),Xr()]}).then(({x:i,y:s})=>{this.container&&Object.assign(this.container.style,{left:`${i}px`,top:`${s}px`})})})}hide(){this.cleanupAllSubmenus(this.container),this.container.style.display="none"}destroy(){this.container.removeEventListener("mouseenter",this.boundMouseEnterHandler,!0),this.container.removeEventListener("mouseleave",this.boundMouseLeaveHandler,!0),this.container.removeEventListener("click",this.boundClickHandler),this.cleanupAllSubmenus(this.container),this.container.style.display="none",this.container.replaceChildren()}removeMenuItem(e){const t=this.container.querySelector(`[data-menu="${e}"]`);if(!t)return!1;const i=t.querySelector(".e-virt-table-submenu");return i&&this.cleanupSubmenuRecursively(i),t.remove(),!0}removeSubMenuItem(e){const t=this.container.querySelector(`[data-submenu="${e}"]`);if(!t)return!1;const i=t.closest(".e-virt-table-submenu"),s=t._submenu;if(s&&this.cleanupSubmenuRecursively(s),t.remove(),i&&i.querySelectorAll(".e-virt-table-submenu-item").length===0){const o=this.container.querySelector("[data-menu]");if(o&&o._submenu===i)this.removeMenuItem(o.getAttribute("data-menu")||"");else{const n=this.container.querySelectorAll("[data-menu], [data-submenu]");for(const a of n)if(a._submenu===i){const c=a.getAttribute("data-menu")||a.getAttribute("data-submenu");c&&(a.hasAttribute("data-menu")?this.removeMenuItem(c):this.removeSubMenuItem(c));break}}}return!0}cleanupAllSubmenus(e){e.querySelectorAll(".e-virt-table-menu-item").forEach(t=>{t._submenu&&(this.cleanupSubmenuRecursively(t._submenu),t._submenu=void 0)})}cleanupSubmenuRecursively(e){const t=e;t._cleanup&&(t._cleanup(),delete t._cleanup),e.querySelectorAll(".e-virt-table-submenu-item").forEach(i=>{i._submenu&&this.cleanupSubmenuRecursively(i._submenu)}),e.remove()}}class Pb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"currentDOMTreeMenu"),h(this,"isCustom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.contextMenuEl=this.ctx.contextMenuElement,this.contextMenuEl.className="e-virt-table-main-menu",this.isCustom=!0):(this.contextMenuEl=document.createElement("div"),this.isCustom=!1),this.ctx.containerElement.appendChild(this.contextMenuEl),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.hide()}),this.ctx.on("cellContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{ENABLE_CONTEXT_MENU:i,CUSTOM_BODY_CONTEXT_MENU:s,CONTEXT_MENU:o}=this.ctx.config,n=[...o,...s];if(!i||n.length===0)return;t.preventDefault();const{xArr:a,yArr:c}=this.ctx.selector,[d,f]=a,[u,g]=c,{rowIndex:m,colIndex:x}=e;m>=u&&m<=g&&x>=d&&x<=f||this.ctx.emit("setSelectorCell",e,t),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy(),this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ko(this.contextMenuEl,n,{onClick:(v,p)=>{p==="copy"?(this.ctx.emit("contextMenuCopy"),this.hide()):p==="paste"?(this.ctx.emit("contextMenuPaste"),this.hide()):p==="cut"?(this.ctx.emit("contextMenuCut"),this.hide()):p==="clearSelected"&&(this.ctx.emit("contextMenuClearSelected"),this.hide())}}),this.currentDOMTreeMenu.positionMenu(t)}),this.ctx.on("cellHeaderContextMenuClick",(e,t)=>{if(this.isCustom){this.contextMenuEl.style.display="block",this.positionMenu(t);return}const{SELECTOR_AREA_MIN_X:i,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,n=i,a=s||this.ctx.maxColIndex-o;if(e.colIndex<n||e.colIndex>a)return;const{HEADER_CONTEXT_MENU:c,CUSTOM_HEADER_CONTEXT_MENU:d,ENABLE_HEADER_CONTEXT_MENU:f}=this.ctx.config,u=[...c,...d];if(!f||u.length===0)return;t.preventDefault();const{xArr:g}=this.ctx.selector,[m,x]=g,{colIndex:v}=e;v>=m&&v<=x||(this.ctx.focusCellHeader=e,this.ctx.emit("selectCols",e)),this.currentDOMTreeMenu&&this.currentDOMTreeMenu.destroy();const p=this.ctx.database.getColumns(),E=u.map(C=>C.value==="visible"?{...C,children:this.filterColumns(p)}:C);this.ctx.contextMenuIng=!0,this.currentDOMTreeMenu=new Ko(this.contextMenuEl,E,{onClick:(C,w)=>{const{xArr:b}=this.ctx.selector,[T,B]=b;if(w==="fixedLeft"||w==="fixedRight"||w==="fixedNone"){const K=this.ctx.header.allCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=B).filter(R=>R.level===0).filter(R=>!R.column.fixedDisabled).map(R=>R.key);this.ctx.database.setCustomHeaderFixedData(K,w==="fixedLeft"?"left":w==="fixedRight"?"right":""),this.hide()}else if(w==="hide"){const K=this.ctx.header.leafCellHeaders.filter(R=>R.colIndex>=T&&R.colIndex<=B).filter(R=>!R.children.length).filter(R=>!R.column.hideDisabled).map(R=>R.key);K.length>0&&this.ctx.database.setCustomHeaderHideData(K,!0),this.hide()}else if(w!=="visible")if(w.startsWith("visible_")){if(!C.key)return;if(C.children){const R=this.getLeafKeys(C.children);this.ctx.database.setCustomHeaderHideData(R,!1)}else this.ctx.database.setCustomHeaderHideData([C.key],!1);this.currentDOMTreeMenu&&this.currentDOMTreeMenu.removeSubMenuItem(w);const K=this.ctx.database.getColumns();Ht(K).filter(R=>R.hide).length===0&&this.hide()}else w==="resetHeader"&&(this.ctx.database.resetCustomHeader(),this.hide())}}),this.positionMenu(t)}),this.ctx.on("click",()=>{this.hide()}),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}positionMenu(e){const t={getBoundingClientRect:()=>({width:0,height:0,top:e.clientY,left:e.clientX,right:e.clientX,bottom:e.clientY,x:e.clientX,y:e.clientY}),contextElement:document.body};vr(t,this.contextMenuEl,()=>{Si(t,this.contextMenuEl,{placement:"right-start",middleware:[Ri(),Ii(),Xr()]}).then(({x:i,y:s})=>{this.contextMenuEl&&Object.assign(this.contextMenuEl.style,{left:`${i}px`,top:`${s}px`})})})}filterColumns(e){const t=[];for(const i of e)if(i.children&&i.children.length>0){const s=this.filterColumns(i.children);s.length>0&&t.push({label:i.title,key:i.key,value:`visible_${i.key}`,children:s})}else i.hide&&t.push({label:i.title,value:`visible_${i.key}`,key:i.key});return t}getLeafKeys(e){return e.reduce((t,i)=>(!i.children||i.children.length===0?t.push(String(i.key)):t.push(...this.getLeafKeys(i.children)),t),[])}hide(){this.currentDOMTreeMenu&&(this.currentDOMTreeMenu.destroy(),this.currentDOMTreeMenu=void 0),this.contextMenuEl.style.display="none",this.ctx.contextMenuIng=!1}destroy(){var e;this.hide(),(e=this.contextMenuEl)==null||e.remove()}}class Yb{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const i=this.ctx.icons.getSvg("loading");if(i){const o=new DOMParser().parseFromString(i.svg,"image/svg+xml").documentElement;t.appendChild(o)}const s=document.createElement("p");s.className="e-virt-table-loading-text",s.innerText=this.ctx.config.LOADING_TEXT,t.appendChild(s),this.loadingEl.appendChild(t)}this.loadingEl.className="e-virt-table-loading",this.loadingEl.style.display="none",this.ctx.containerElement.appendChild(this.loadingEl)}show(){this.loadingEl.style.display="flex"}hide(){this.loadingEl.style.display="none"}destroy(){this.loadingEl.remove()}}class Vb{constructor(e){h(this,"ctx"),h(this,"container"),h(this,"input"),h(this,"prevBtn"),h(this,"nextBtn"),h(this,"closeBtn"),h(this,"countEl"),h(this,"loadingEl"),h(this,"isVisible",!1),h(this,"searchResults",[]),h(this,"currentIndex",-1),h(this,"searchData",[]),h(this,"isComposing",!1),this.ctx=e,this.container=this.createContainer(),this.ctx.containerElement.appendChild(this.container),this.bindEvents(),this.ctx.on("keydown",t=>{if(this.ctx.config.ENABLE_FINDER&&!this.ctx.editing){if((t.ctrlKey||t.metaKey)&&t.code==="KeyF"){t.preventDefault(),this.show();return}if(this.ctx.finding){if(t.code==="Escape"){t.preventDefault(),this.hide();return}if(t.code==="ArrowUp"||t.shiftKey&&t.key==="Enter"){t.preventDefault(),this.navigatePrevious();return}if(t.code==="ArrowDown"||t.key==="Enter"){t.preventDefault(),this.navigateNext();return}}}}),this.ctx.on("setSelector",()=>{this.hide()}),this.ctx.on("outsideMousedown",()=>{this.hide()})}async initSearchData(){this.showLoading(),this.searchData=[],setTimeout(()=>{const{allCellHeaders:e}=this.ctx.header;for(let s=0;s<e.length;s++){const o=e[s];o&&["string","number"].includes(typeof o.text)&&this.searchData.push({rowIndex:0,colIndex:o.colIndex,text:`${o.text}`,type:"header",colKey:o.key})}const{maxColIndex:t,maxRowIndex:i}=this.ctx;for(let s=0;s<i;s++)for(let o=0;o<t;o++){const n=this.ctx.database.getVirtualBodyCell(s,o,!1),a=n==null?void 0:n.getText();["string","number"].includes(typeof a)&&this.searchData.push({rowIndex:s,colIndex:o,text:`${a}`,type:"body"})}this.hideLoading()},0)}createContainer(){const e=document.createElement("div");e.className="e-virt-table-finder-bar";const t=document.createElement("div");t.className="e-virt-table-finder-bar-input-wrapper",this.input=document.createElement("input"),this.input.type="text",this.input.className="e-virt-table-finder-bar-input",this.input.placeholder="",t.appendChild(this.input),this.loadingEl=document.createElement("div"),this.loadingEl.className="e-virt-table-finder-bar-loading";const i=Za;this.loadingEl.innerHTML=i,t.appendChild(this.loadingEl),this.countEl=document.createElement("span"),this.countEl.className="e-virt-table-finder-bar-count";const s=document.createElement("div");return s.className="e-virt-table-finder-bar-nav",this.prevBtn=document.createElement("button"),this.prevBtn.className="e-virt-table-finder-bar-nav-btn prev-btn",this.prevBtn.innerHTML=Ei,this.nextBtn=document.createElement("button"),this.nextBtn.className="e-virt-table-finder-bar-nav-btn next-btn",this.nextBtn.innerHTML=Ei,s.appendChild(this.prevBtn),s.appendChild(this.nextBtn),this.closeBtn=document.createElement("button"),this.closeBtn.className="e-virt-table-finder-bar-nav-btn close-btn",this.closeBtn.innerHTML="×",e.appendChild(t),e.appendChild(this.countEl),e.appendChild(s),e.appendChild(this.closeBtn),e}bindEvents(){this.input.addEventListener("input",()=>{this.isComposing||this.performSearch()}),this.input.addEventListener("compositionstart",()=>{this.isComposing=!0}),this.input.addEventListener("compositionend",()=>{this.isComposing=!1,this.performSearch()}),this.prevBtn.addEventListener("click",()=>{this.navigatePrevious()}),this.nextBtn.addEventListener("click",()=>{this.navigateNext()}),this.closeBtn.addEventListener("click",()=>{this.hide()})}performSearch(){const e=this.input.value.trim();if(this.searchResults=[],this.currentIndex=-1,!e){this.cearFinderBar(),this.updateCount();return}this.showLoading(),setTimeout(()=>{this.searchResults=this.searchData.filter(t=>t.text.toLowerCase().includes(e.toLowerCase())),this.searchResults.length>0?(this.currentIndex=0,this.scrollToCurrentResult()):this.cearFinderBar(),this.updateCount(),this.hideLoading()},0)}scrollToCurrentResult(){if(this.currentIndex<0||this.currentIndex>=this.searchResults.length)return;const e=this.searchResults[this.currentIndex];this.ctx.finderBar=e;const{rowIndex:t,colIndex:i}=e;this.ctx.emit("scrollToIndex",t,i)}navigateNext(){this.searchResults.length!==0&&(this.currentIndex=(this.currentIndex+1)%this.searchResults.length,this.scrollToCurrentResult(),this.updateCount())}navigatePrevious(){this.searchResults.length!==0&&(this.currentIndex=this.currentIndex<=0?this.searchResults.length-1:this.currentIndex-1,this.scrollToCurrentResult(),this.updateCount())}updateCount(){if(this.searchResults.length===0)this.input.value.trim()?(this.countEl.textContent="0/0",this.countEl.classList.add("no-results")):(this.countEl.textContent="",this.countEl.classList.remove("no-results"));else{const e=this.currentIndex+1,t=this.searchResults.length;this.countEl.textContent=`${e}/${t}`,this.countEl.classList.remove("no-results")}}show(){this.isVisible||(this.isVisible=!0,this.ctx.finding=!0,this.container.classList.add("show"),this.input.focus(),this.initSearchData())}showLoading(){var e;this.loadingEl.classList.add("show"),(e=this.loadingEl.parentElement)==null||e.classList.add("loading"),this.input.readOnly=!0}hideLoading(){var e;this.loadingEl.classList.remove("show"),(e=this.loadingEl.parentElement)==null||e.classList.remove("loading"),this.input.readOnly=!1}cearFinderBar(){this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.ctx.emit("draw")}hide(){this.isVisible&&(this.isVisible=!1,this.container.classList.remove("show"),this.ctx.finding=!1,this.input.value="",this.searchResults=[],this.searchData=[],this.currentIndex=-1,this.hideLoading(),this.ctx.finderBar={rowIndex:-1,colIndex:-1,text:"",type:"header"},this.updateCount(),this.ctx.emit("draw"))}destroy(){this.hide(),this.container.remove()}}class Wb{constructor(e,t){h(this,"options"),h(this,"scroller"),h(this,"header"),h(this,"body"),h(this,"footer"),h(this,"selector"),h(this,"autofill"),h(this,"tooltip"),h(this,"editor"),h(this,"empty"),h(this,"overlayer"),h(this,"contextMenu"),h(this,"loading"),h(this,"finderBar"),h(this,"animationFrameId"),h(this,"ctx"),this.options=t;const{overlayerElement:i,editorElement:s,emptyElement:o,contextMenuElement:n}=this.options,a=this.createContainer(e,i,s,o,n);this.ctx=new KC(a,this.options),this.header=new VC(this.ctx),this.footer=new XC(this.ctx),this.body=new WC(this.ctx),this.scroller=new PC(this.ctx),this.selector=new zC(this.ctx),this.autofill=new GC(this.ctx),this.tooltip=new Bb(this.ctx),this.empty=new Fb(this.ctx),this.editor=new Hb(this.ctx),this.overlayer=new Kb(this.ctx),this.contextMenu=new Pb(this.ctx),this.loading=new Yb(this.ctx),this.finderBar=new Vb(this.ctx),this.ctx.on("draw",()=>{this.draw()}),this.ctx.on("drawView",()=>{this.draw(!0)}),this.draw()}createContainer(e,t,i,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",c.setAttribute("data-overlayer",t?"custom":"default");const d=i||document.createElement("div");d.className="e-virt-table-editor";const f=s,u=o;return n.appendChild(a),n.appendChild(c),e.appendChild(n),{containerElement:e,stageElement:n,canvasElement:a,overlayerElement:c,editorElement:d,emptyElement:f,contextMenuElement:u}}doDraw(e=!1){this.header.update(),this.footer.update(),this.body.update(),this.ctx.paint.clear(),this.body.draw(),this.footer.draw(),this.header.draw(),this.scroller.draw(),e||this.overlayer.draw()}draw(e=!1){this.animationFrameId&&cancelAnimationFrame(this.animationFrameId),this.animationFrameId=requestAnimationFrame(()=>{this.doDraw(e),this.body.updateAutoHeight()&&this.doDraw(e)})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setCustomHeader(e,t=!0){this.ctx.database.setCustomHeader(e,t),this.header.init(),this.ctx.emit("draw")}getCustomHeader(){return this.header.getCustomHeader()}showColumns(e,t=!0){this.ctx.database.setCustomHeaderHideData(e,!t),this.header.init(),this.ctx.emit("draw")}fixedColumns(e,t){this.ctx.database.setCustomHeaderFixedData(e,t),this.header.init(),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,i,s=!0,o=!0,n=!1){this.ctx.database.setItemValue(e,t,i,s,o,n)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,i,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,i,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],i=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,i,!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(i,s)=>{let o=[];for(let n=0;n<e.length;n++){const{rowKey:a,key:c}=e[n],d=await this.ctx.database.getValidator(a,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[n]=o;if(Array.isArray(n)&&n.length){const[a]=n,{rowKey:c,key:d}=a;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else i([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,i)=>{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,d=this.ctx.database.getRowForRowKey(a);if(d){const{parentRowKeys:f=[]}=d;f&&f.length&&this.setExpandRowKeys(f,!0)}this.scrollToRowkey(a),this.scrollToColkey(c)}}i(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:i,key:s,message:o,rowKey:n}=t;if(i!==void 0&&n===void 0){const a=this.ctx.database.getRowKeyForRowIndex(i);this.ctx.database.setValidationErrorByRowKey(a,s,o)}n&&this.ctx.database.setValidationErrorByRowKey(n,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowKey)this.scrollToRowkey(t.rowKey),this.scrollToColkey(t.key);else if(t&&t.rowIndex!==void 0&&t.rowIndex>=0&&t.key){const{rowIndex:i,key:s}=t;this.scrollToRowIndex(i),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const i=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let n=0;n<i.length;n++)for(let a=0;a<s.length;a++){const c=this.ctx.database.getRowKeyByItem(i[n]),d=s[a].key,f=await this.ctx.database.getValidator(c,d);Array.isArray(f)&&f.length&&o.push(f)}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(i=>{const s=this.ctx.database.getRowKeyByItem(i);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(i=>{this.ctx.database.setRowSelection(i,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:TC,mergeRowCell:SC,getSpanArrByRow:Ga,getSpanObjByColumn:Ua}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}clearChangeData(){this.ctx.database.clearChangeData(),this.ctx.emit("draw")}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.finderBar.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const Xb=l.defineComponent((r,{emit:e})=>{const{cellRender:t,renderTableParams:i}=r,{row:s,field:o}=i;if(o){const n=l.ref(s[o]);return()=>{var a,c;return((c=(a=Bt.renders[t.name])==null?void 0:a.renderEdit)==null?void 0:c.call(a,n,t,i,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),zr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(r,{expose:e,emit:t}){const i=t,s=l.ref([]),o=r,n=Ha(),a=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...n,...o.config}}));let c=null;const d=l.useAttrs(),f=l.ref(null),u=l.ref(null),g=l.ref(null),m=l.ref(null),x=l.ref(),v=l.ref("text"),p=l.ref(),E={},C={},w=l.computed(()=>{const y=x.value;return y?{width:`${y.width}px`,height:`${y.height}px`}:{}}),b=y=>pt[y]||(({cellValue:D})=>D),T=y=>{var D;return(D=Bt.renders[y])==null?void 0:D.renderDefault},B=(y,...D)=>({row:L,rowIndex:Y,value:W})=>y({row:L,rowIndex:Y,cellValue:W},...D),K=y=>{var D,L,Y,W,P;if((D=y.slots)!=null&&D.default&&S.isFunction((L=y.slots)==null?void 0:L.default))return X=>{var U,q;return(q=(U=y.slots)==null?void 0:U.default)==null?void 0:q.call(U,{row:X.row,column:y,rowIndex:X.rowIndex})};if((Y=y.slots)!=null&&Y.default&&S.isString((W=y.slots)==null?void 0:W.default))return`slot:${(P=y.slots)==null?void 0:P.default}`;if(y.cellRender&&y.cellRender.name)return X=>{var U,q;return(q=T(y.cellRender.name))==null?void 0:q(y.cellRender,{data:o.data,row:X.row,rowIndex:X.rowIndex,field:y.field||X.column.key,title:((U=X.column)==null?void 0:U.title)??""},{})}},R=y=>{var D,L;if((D=y.slots)!=null&&D.title&&S.isFunction((L=y.slots)==null?void 0:L.title))return Y=>{var W,P;return(P=(W=y.slots)==null?void 0:W.title)==null?void 0:P.call(W,{column:y})}},I=y=>{var D,L,Y,W,P,X,U;return(D=y.slots)!=null&&D.edit&&(y.field||y.key)&&S.isFunction((L=y.slots)==null?void 0:L.edit)?E[`__slot:${y.field||y.key}`]=y:(Y=y.editRender)!=null&&Y.name&&(y.field||y.key)&&(C[y.field||y.key]=y.editRender),{...S.omit(y,["formatter"]),key:y.key||y.field||Ae(),formatter:S.isString(y.formatter)?B(b(y.formatter)):S.isArray(y.formatter)&&S.isString(y.formatter[0])?B(b(y.formatter[0]),...y.formatter.slice(1)):S.isFunction(y.formatter)?B(y.formatter):void 0,editorType:y.editorType??((W=y.slots)!=null&&W.edit&&(y.field||y.key)&&S.isFunction((P=y.slots)==null?void 0:P.edit)?`__slot:${y.field||y.key}`:(X=y.editRender)!=null&&X.name?y.editRender.name:void 0),render:K(y),renderHeader:R(y),children:(U=y.children)==null?void 0:U.map(q=>I(q))}};l.onMounted(()=>{f.value&&(c=new Wb(f.value,{config:a.value.config,columns:o.columns.map(y=>I(y)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:m.value||void 0,editorElement:u.value||void 0}),Object.keys(d).forEach(y=>{const D=d[y];if(typeof D=="function"&&y.startsWith("on")){const L=y.charAt(2).toLowerCase()+y.slice(3);c==null||c.on(L,D)}}),c.on("change",y=>{i("change",y)}),c.on("overlayerChange",y=>{p.value=y,console.log("overlayerChange",y)}),c.on("startEdit",y=>{x.value=y,v.value=y.editorType,v.value}),c.on("doneEdit",()=>{v.value="text"}),c.on("selectionChange",y=>{s.value=y,i("selectionChange",y)}),i("ready",c))});function _(y){if(!c||!x.value)return;const{rowKey:D,key:L}=x.value;c==null||c.setItemValueByEditor(D,L,y)}const O=()=>document.body;return l.watch(()=>o.data,y=>{c==null||c.loadData(y)},{deep:!0}),Lr(()=>o.columns,(y,D)=>{S.isEqual(y,D)||c==null||c.loadColumns(y.map(L=>I(L)))},{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,D)=>{y!==D&&(c==null||c.setLoading(y))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(y,D)=>{const L=l.resolveComponent("a-empty"),Y=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(Y,{spinning:y.loading},{default:l.withCtx(()=>{var W,P,X,U,q,Ke,ht;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:f},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:u},[v.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(E[v.value].slots.edit({row:x.value.row,column:E[v.value],rowIndex:x.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(w.value),class:"ev-editor-wrapper","get-popup-container":O,value:x.value.value,"onUpdate:value":D[0]||(D[0]=he=>x.value.value=he),cell:x.value,onBlur:_},null,40,["style","value","cell"])):(W=l.unref(Bt).renders[v.value])!=null&&W.renderEdit?(l.openBlock(),l.createBlock(l.unref(Xb),{key:1,"cell-render":C[x.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(w.value),"render-table-params":{data:o.data,row:(P=x.value)==null?void 0:P.row,rowIndex:((X=x.value)==null?void 0:X.rowIndex)??-1,field:((U=x.value)==null?void 0:U.key)??"",title:((Ke=(q=x.value)==null?void 0:q.column)==null?void 0:Ke.title)??""},bordered:!1,"get-popup-container":O,onBlur:_},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(L,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:m},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((ht=p.value)==null?void 0:ht.views)||[],he=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(he.class),style:l.normalizeStyle(he.style),key:he.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(he.views,qe=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(qe.style),key:qe.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(qe.cells,ee=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${ee.rowKey}_${ee.key}`,style:{...ee.style}},{ref_for:!0},ee.domDataset),[typeof ee.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(ee.render(ee)),{key:0,bordered:!1})):typeof ee.render=="string"&&ee.render.startsWith("slot:")?l.renderSlot(y.$slots,ee.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},ee,{cell:ee})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),zb={key:0},Gb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Ub={class:"flex items-center flex-1 gap-4px"},qb={key:2},Zb={class:"flex items-center gap-4px"},Jb={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Qb={key:0,class:"w-full text-slate-5 pl-4"},cl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean,default:()=>xt().lazyReset??!1},fitHeight:{default:()=>xt().fitCanvasHeight??100}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(r,{expose:e,emit:t}){var jt,ei,ti,ii,ri;const i=r,s=l.useAttrs(),o=t,{formConfig:n,pageConfig:a,columns:c,toolbarConfig:d,proxyConfig:f,config:u,staticConfig:g}=l.toRefs(i),m=Ha(),x=l.ref(Ae()),v=l.ref({}),p=l.computed(()=>({...i,config:{...m,...i.config}})),E=l.computed(()=>f.value&&f.value.ajax?a.value?"pagination":"list":"bad");l.computed(()=>E.value==="pagination"?{current:b.page,total:B.value,pageSize:b.size,responsive:!1,showSizeChanger:!0,showTotal:$=>`共${$}条数据`}:!1);const C=l.computed(()=>S.omit({labelCol:kr,...n.value},["items"])),w=l.reactive({toolbar:!1,form:!1,table:!1}),b=l.reactive({page:1,size:((jt=a.value)==null?void 0:jt.pageSize)??10}),T=l.ref(0),B=l.ref(0),K=l.ref([]),R=l.ref(),I=l.ref(),_=l.ref(),O=l.ref(),y=l.ref(500),D=l.ref({}),L=$=>{D.value[b.page]=$},Y=l.reactive([...(((ti=(ei=i.toolbarConfig)==null?void 0:ei.buttons)==null?void 0:ti.map($=>$.code))??[]).filter($=>$),...(((ri=(ii=i.toolbarConfig)==null?void 0:ii.tools)==null?void 0:ri.map($=>$.code))??[]).filter($=>$)].reduce(($,H)=>($[H]=!1,$),{})),W=($,H)=>{Y[$]=H},P=$=>{S.isObject($)?(Object.prototype.hasOwnProperty.call($,"toolbar")&&(w.toolbar=$.toolbar),Object.prototype.hasOwnProperty.call($,"form")&&(w.form=$.form),Object.prototype.hasOwnProperty.call($,"table")&&(w.table=$.table)):S.isBoolean($)&&(w.form=$,w.toolbar=$,w.table=$)},X=l.computed(()=>S.uniq(Object.values(D.value).flat(),$=>{var H;return $[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),U=()=>{Ze()},q=l.computed(()=>X.value.map($=>{var H;return $[((H=p.value.config)==null?void 0:H.ROW_KEY)??"id"]})),Ke=($,H)=>H?{list:S.isString(H.list)?S.get($,H.list):S.isFunction(H.list)?H.list($):void 0,total:S.isString(H.total)?S.get($,H.total):S.isFunction(H.total)?H.total($):void 0,result:S.isString(H.result)?S.get($,H.result):S.isFunction(H.result)?H.result($):void 0,message:S.isString(H.message)?S.get($,H.message):S.isFunction(H.message)?H.message($):void 0}:{list:$},ht=$=>{o("toolbarButtonClick",{data:K.value,code:$,selectedKeys:q.value,records:X.value}),ut($)},he=S.debounce(ht,100),qe=({key:$})=>he($),ee=$=>{o("toolbarToolClick",{data:K.value,code:$,selectedKeys:q.value,records:X.value}),ut($)},Pi=S.debounce(ee,100),ve=()=>new Promise($=>{if(E.value!=="bad"){P({table:!0,form:!0});const{ajax:H}=f.value;H.query({form:v.value,page:b}).then(V=>{const{list:de,total:je,result:me,message:xe}=Ke(V,f.value.response);de?(K.value=de,T.value++):me?(K.value=me,B.value=je??me.length,T.value++):(K.value=[],T.value++,xe&&wi(xe)),$(K.value)}).catch(V=>{console.error("fetchData error",V),$([])}).finally(()=>{P({table:!1,form:!1})})}}),Yi=($,H)=>(b.page=$,b.size=H,ve()),Ze=()=>(b.page=1,D.value={},ve()),dt=S.debounce(ve,160),Qt=($,H)=>(Object.assign(v.value,$),b.page=1,H?Promise.resolve():dt()),Vi=($,H)=>(v.value=$,b.page=1,H?Promise.resolve():dt()),ut=$=>{const{ajax:H}=f.value;switch($){case"multiDelete":H.multiDelete&&(q.value.length>0?Wa({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{P({table:!0,toolbar:!0}),H.multiDelete(q.value).then(()=>{uC("删除成功"),Ze()}).catch(()=>{fC("删除失败")}).finally(()=>{P({table:!1,toolbar:!1}),Y.multiDelete=!1})}):wi("请选择要删除的数据"));break}},Wi=l.computed(()=>!g.value||!g.value.selectable&&!g.value.tree?c.value:[g.value.selectable&&g.value.tree?{type:"selection-tree",width:40,widthFillDisable:!0,title:""}:g.value.selectable?{type:"selection",width:40,widthFillDisable:!0,title:""}:g.value.tree?{type:"tree",width:40,widthFillDisable:!0,title:""}:{type:"index",width:40,widthFillDisable:!0,title:""},...c.value]),Je=$=>{if(n.value&&n.value.items.length>0){if(n.value.customReset)n.value.customReset();else{const H={};Nt(n.value.items,V=>{V.field&&V.itemRender?ue(V.itemRender.defaultValue)?H[V.field]=V.itemRender.defaultValue:H[V.field]=void 0:V.field&&V.slots&&(ue(V.slots.defaultValue)?H[V.field]=V.slots.defaultValue:H[V.field]=void 0)}),v.value=H}o("resetQuery")}b.page=1,$||dt()},ft=()=>(D.value={},Je()),Qe=()=>{var me,xe;const $=(me=_.value)==null?void 0:me.parentElement,H=$?window.getComputedStyle($).height:"0px",V=O.value?window.getComputedStyle(O.value).height:"0px",de=V.includes("px")?S.toNumber(V.replace("px","")):0,je=(xe=g.value)!=null&&xe.showCount?22:0;y.value=S.toNumber(H.replace("px",""))-i.fitHeight-(i.toolbarConfig?30:0)-de-je};let kt;return l.onMounted(()=>{Qe(),window.addEventListener("resize",Qe),kt=new MutationObserver($=>{$.forEach(H=>{if(H.type==="attributes"&&H.attributeName==="style"){const V=H.target;window.getComputedStyle(V).display!=="none"&&Qe()}})}),_.value&&kt.observe(_.value,{attributes:!0,attributeFilter:["style"]}),Je(i.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Qe),kt.disconnect()}),e({commitProxy:{query:dt,reload:ft,reloadPage:Ze,passQuery:Qt,forcePassQuery:Vi},$canvasTable:l.computed(()=>I.value),selectedRowKeys:q,setBtnLoading:W,selectedRecords:X,$form:l.computed(()=>R.value),getFormData:()=>v.value,setLoadings:P,resizeTable:Qe}),($,H)=>{var me,xe,Lt;const V=l.resolveComponent("a-menu-item"),de=l.resolveComponent("a-menu"),je=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:_,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[E.value==="bad"?(l.openBlock(),l.createElementBlock("div",zb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(xe=(me=l.unref(n))==null?void 0:me.items)!=null&&xe.some(F=>F.field&&F.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:O},[l.createVNode(l.unref(A.Spin),{spinning:w.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(A.Form),l.mergeProps({key:x.value,ref_key:"formEl",ref:R,model:v.value},C.value,{onSubmit:U}),{default:l.withCtx(()=>[l.createVNode(l.unref(A.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n).items,(F,pe)=>(l.openBlock(),l.createBlock($r,{key:`_col_${F.field||pe}`,"form-data":v.value,item:F,onReset:H[0]||(H[0]=Re=>Je(i.lazyReset))},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))]),_:1},8,["spinning"])],512)):l.createCommentVNode("",!0),l.unref(d)?(l.openBlock(),l.createElementBlock("div",Gb,[l.createElementVNode("div",Ub,[l.unref(d).buttons&&l.unref(d).buttons.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).buttons,(F,pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:pe},[F.dropdowns&&F.dropdowns.length?(l.openBlock(),l.createBlock(je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(de,{onClick:qe},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(F.dropdowns,Re=>(l.openBlock(),l.createBlock(V,{key:Re.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Re.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(A.Button),{type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content)+" ",1),l.createVNode(l.unref(wt.DownOutlined))]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block"])]),_:2},1024)):F.code?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:1,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,loading:w.toolbar||!!F.code&&Y[F.code],danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(he)(F.code)},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","loading","danger","shape","ghost","block","onClick"])):(l.openBlock(),l.createElementBlock("div",qb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",Zb,[l.unref(d).tools&&l.unref(d).tools.length>0?(l.openBlock(!0),l.createElementBlock(l.Fragment,{key:0},l.renderList(l.unref(d).tools,(F,pe)=>(l.openBlock(),l.createBlock(l.unref(A.Button),{key:pe,type:F.type,size:F.size??"middle",disabled:l.unref(d).disabled||F.disabled,danger:F.danger,shape:F.shape,ghost:F.ghost,block:F.block,onClick:Re=>l.unref(Pi)(F.code),loading:w.toolbar||!!F.code&&Y[F.code]},{default:l.withCtx(()=>[F.icon?(l.openBlock(),l.createBlock(l.unref(ae),{key:0,icon:F.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(F.content),1)]),_:2},1032,["type","size","disabled","danger","shape","ghost","block","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",Jb,[(Lt=l.unref(g))!=null&&Lt.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",Qb," 已选:"+l.toDisplayString(q.value.length),1)):l.createCommentVNode("",!0),l.createVNode(zr,{ref_key:"canvasTableRef",ref:I,columns:Wi.value,config:{...p.value.config,HEIGHT:y.value},data:K.value,loading:w.table,onSelectionChange:L},l.createSlots({_:2},[l.renderList($.$slots,(F,pe)=>({name:pe,fn:l.withCtx(Re=>[l.renderSlot($.$slots,pe,l.normalizeProps(l.guardReactiveProps(Re)))])}))]),1032,["columns","config","data","loading"]),E.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(A.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:b.page,"page-size":b.size,total:B.value,onChange:Yi},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Gr=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(r,{expose:e}){const t=r,i=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var a;return(a=i.value)==null?void 0:a.$form}),n=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(a,c)=>(l.openBlock(),l.createBlock(Mr,l.mergeProps({ref_key:"formEl",ref:i},n.value,{data:l.unref(s)}),null,16,["data"]))}}),jb=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(r,{expose:e}){const t=r,i=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{i.value=[]},expand:()=>{i.value=["content"]}}),(s,o)=>{const n=l.resolveComponent("a-collapse-panel"),a=l.resolveComponent("a-collapse"),c=l.resolveComponent("a-card");return s.collapsible?(l.openBlock(),l.createBlock(a,{key:0,"active-key":i.value,"onUpdate:activeKey":o[0]||(o[0]=d=>i.value=d),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(c,{key:1,size:"small",title:s.title},l.createSlots({_:2},[l.renderList(s.$slots,(d,f)=>({name:f,fn:l.withCtx(()=>[l.renderSlot(s.$slots,f)])}))]),1032,["title"]))}}}),hl=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},getTabLabel:{type:Function},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(r,{expose:e}){const t=A.Form.useForm,i=l.ref(),s=r,o=l.ref(),n=l.useModel(r,"modelValue"),a=l.ref(0),c=l.ref([]),d=l.ref([]),f=R=>{a.value=R},u=l.computed(()=>s.max??1/0),g=R=>{(s.createItem??(()=>Promise.resolve({})))({list:n.value}).then(_=>{var O;n.value=[...n.value,{..._,__index:(((O=S.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1}],a.value=R})},m=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],x=R=>{var I,_,O,y,D,L;return((D=(y=(O=(_=(I=R==null?void 0:R.parentElement)==null?void 0:I.parentElement)==null?void 0:_.parentElement)==null?void 0:O.parentElement)==null?void 0:y.parentElement)==null?void 0:D.parentElement)??((L=o.value)==null?void 0:L.$el)??document.body},v=l.computed(()=>s.forceRender||n.value.length<=5),p=R=>{var _;const I=(_=n.value.find((O,y)=>y===R))==null?void 0:_.__index;Z(I)&&(c.value=c.value.filter(O=>O!==I))},E=()=>{l.nextTick().then(()=>{var R,I;p(a.value),(I=(R=d.value[a.value])==null?void 0:R.$form)==null||I.validate()})},C=(R,I)=>{var _;return((_=s.getTabLabel)==null?void 0:_.call(s,R,I))??`${s.tabLabel} ${s.keepSerial?I+1:(R.__index??0)+1}`};l.watch(()=>n.value,()=>{if(!s.keepSerial){const R=n.value.filter(I=>!Z(I.__index));R.length>0&&R.forEach(I=>{var _;I.__index=(((_=S.max(n.value,O=>O.__index??-1))==null?void 0:_.__index)??-1)+1})}},{immediate:!0});const w=({key:R},I,_)=>{var O;if(s.menuHandler&&S.isFunction(s.menuHandler))s.menuHandler({code:S.toString(R),data:I,index:_});else switch(R){case"delete":n.value=n.value.filter((y,D)=>D!==_),l.nextTick(()=>{d.value=d.value.filter(y=>!!y),_<=a.value&&a.value>0&&a.value--});break;case"copy":if(n.value.length>=u.value){wi("已达到最大数量");return}n.value=[...n.value,S.clone({...S.omit(I,["id","__index"]),__index:(((O=S.max(n.value,y=>y.__index??-1))==null?void 0:O.__index)??-1)+1})];break}},b=S.debounce(w,100);l.watchEffect(()=>{n.value.length===0?a.value=0:a.value>=n.value.length&&(a.value=n.value.length-1)});const T=S.debounce(p,50);l.watchEffect(()=>{var _;const R=n.value.map((O,y)=>c.value.includes(O.__index)?y:void 0).filter(Z),I=(_=i.value)==null?void 0:_.$el;I&&I.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((y,D)=>{R.includes(D)?y.classList.add("p-error-group-tab"):y.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var R,I;(I=(R=o.value)==null?void 0:R.collapse)==null||I.call(R)},expand:()=>{var R,I;(I=(R=o.value)==null?void 0:R.expand)==null||I.call(R)},activeKey:l.computed(()=>a.value),setActiveKey:f,validateAll:()=>{const R=v.value?d.value.map(I=>{var _;return(_=I.$form)==null?void 0:_.validate()}):n.value.map(I=>{var _;return((_=t(I,s.getFormSetting(I).rules))==null?void 0:_.validate())??Promise.resolve()});return Promise.allSettled(R).then(I=>{if(c.value=I.map((_,O)=>{var y;return _.status==="rejected"&&typeof((y=n.value[O])==null?void 0:y.__index)=="number"?n.value[O].__index:void 0}).filter(_=>typeof _=="number"),!s.lazyErrorMark&&c.value.length){const _=c.value[0],O=n.value.findIndex(y=>y.__index===_);O!==-1&&(a.value=O)}return c.value.length?Promise.reject({error_indexes:c.value,results:I}):Promise.resolve(I)})},validate:async(R,I)=>{var O,y,D;const _=n.value.findIndex(L=>L.__index===R);try{return await(v.value?((y=(O=d.value[_])==null?void 0:O.$form)==null?void 0:y.validate())??Promise.resolve():((D=t(n.value[_],s.getFormSetting(n.value[_]).rules))==null?void 0:D.validate())??Promise.resolve()),c.value=c.value.filter(L=>L!==R),Promise.resolve()}catch(L){return!c.value.includes(R)&&!I&&(c.value=[...c.value,R]),Promise.reject(L)}},validateFields:async(R,I,_)=>{var Y,W;const O=n.value.findIndex(P=>P.__index===R),D=s.getFormSetting(n.value[O]).rules,L=t(n.value[O],D);try{return await(v.value?((W=(Y=d.value[O])==null?void 0:Y.$form)==null?void 0:W.validateFields(I))??Promise.resolve():Promise.allSettled(I.map(P=>L.validateField(P,n.value[O][P],D[P]??[])))),Promise.resolve()}catch(P){return!c.value.includes(R)&&!_&&(c.value=[...c.value,R]),Promise.reject(P)}}});const B=l.useSlots(),K=l.computed(()=>Object.keys(B).filter(R=>R.startsWith("group-")).map(R=>({original:R,target:R.replace("group-","")})));return(R,I)=>{const _=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(jb,{ref_key:"rootRef",ref:o,title:R.title,size:"small",collapsible:R.collapsible,"default-collapsed":R.defaultCollapsed},l.createSlots({default:l.withCtx(()=>[R.loading?(l.openBlock(),l.createBlock(_,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(A.Tabs),{key:1,ref_key:"tabsRef",ref:i,type:"editable-card",activeKey:a.value,"onUpdate:activeKey":I[1]||(I[1]=O=>a.value=O),"hide-add":"",onChange:E},{rightExtra:l.withCtx(()=>[l.renderSlot(R.$slots,"rightExtra",{},()=>[R.showAdd&&n.value.length<u.value?(l.openBlock(),l.createBlock(l.unref(A.Button),{key:0,type:"link",onClick:I[0]||(I[0]=O=>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,(O,y)=>(l.openBlock(),l.createBlock(l.unref(A.TabPane),{key:y,tab:C(O,y),"force-render":v.value},{closeIcon:l.withCtx(()=>{var D;return[R.editAble&&((D=l.unref(m))!=null&&D.length)?(l.openBlock(),l.createBlock(l.unref(A.Dropdown),{key:0,"get-popup-container":x},{overlay:l.withCtx(()=>[l.createVNode(l.unref(A.Menu),{onClick:L=>l.unref(b)(L,O,y)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(m).filter(L=>{var Y;return((Y=L.visibleMethod)==null?void 0:Y.call(L,{data:O,index:y}))??!0}),L=>(l.openBlock(),l.createBlock(l.unref(A.MenuItem),{key:L.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(L.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(wt.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Gr,{ref_for:!0,ref_key:"blockInstance",ref:d,key:y,source:O,"get-form-setting":R.getFormSetting,onFocusCapture:D=>l.unref(T)(y),onClickCapture:D=>l.unref(T)(y)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:2},[l.renderList(K.value,O=>({name:O.target,fn:l.withCtx(()=>[l.renderSlot(R.$slots,O.original)])}))]),1032,["title","collapsible","default-collapsed"])}}}),e_={class:"w-full text-right p-2"},dl=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(r,{expose:e}){const t=l.ref(),i=l.ref(!1),s=r,o=l.computed(()=>{var x;return(x=s.gridSetting.selectConfig)==null?void 0:x.multiple});let n,a,c;const d=l.reactive({modal:!1}),f=()=>{c&&c()},u=()=>{d.modal=!1,c&&c()},g=({row:x,field:v})=>{n&&!o.value&&s.beforePick(x).then(()=>{d.modal=!1,n({row:x,field:v})})},m=()=>{var v;const x=((v=t.value)==null?void 0:v.selectedRecords)??[];x.length===0&&!s.multipleAllowEmpty?wi("请选择数据"):s.beforePick(x).then(()=>{d.modal=!1,a(x)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((x,v)=>{n=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),pickMultiple:()=>new Promise((x,v)=>{a=x,c=v,i.value=!1,d.modal=!0,l.nextTick(()=>{i.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(x,v)=>(l.openBlock(),l.createBlock(l.unref(A.Modal),{open:d.modal,"onUpdate:open":v[0]||(v[0]=p=>d.modal=p),"destroy-on-close":"",title:x.title,width:x.width,footer:o.value?void 0:null,onCancel:f,"body-style":x.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:i.value?"unset":"642px"})},[l.createVNode(Ar,l.mergeProps(x.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",e_,[l.createElementVNode("span",null,[l.createVNode(l.unref(A.Button),{class:"mr-4",onClick:u},{default:l.withCtx(()=>v[1]||(v[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(A.Button),{type:"primary",onClick:m},{default:l.withCtx(()=>v[2]||(v[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function ul(r){r&&Ba(r)}const t_={install(r){r.component("PForm",Mr),r.component("PGrid",Ar),r.component("PCanvasTable",zr),r.component("PCanvasGrid",cl),r.component("PFormGroup",hl),r.component("PGroupBlock",Gr),r.component("PromisePicker",dl)},addFormatter:Ka,addRender:Dr,setup:ul};exports.PCanvasGrid=cl;exports.PCanvasTable=zr;exports.PForm=Mr;exports.PFormGroup=hl;exports.PGrid=Ar;exports.PGroupBlock=Gr;exports.PromisePicker=dl;exports.addFormatter=Ka;exports.addRender=Dr;exports.cleanCol=Bi;exports.default=t_;exports.defaultItemResponsive=Or;exports.defaultLabelCol=kr;exports.get24rest=Fa;exports.getButtonResponsive=eC;exports.getUIKitConfig=J2;exports.labelColDict=j2;exports.resetUIKitConfig=Q2;exports.setUIKitConfig=Ba;exports.setup=ul;exports.watchPreviousDeep=Lr;
|