@vue-ui-kit/ant 2.1.3 → 2.1.4
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/es/index.js +333 -331
- package/package.json +1 -1
- package/src/packages/components/PGrid.vue +2 -1
package/dist/cjs/index.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),L=require("ant-design-vue"),ut=require("@ant-design/icons-vue");function ol(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const al=ol(ut);var nl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Te=nl;function ll(i,e,t){if(i)if(i.forEach)i.forEach(e,t);else for(var r=0,s=i.length;r<s;r++)e.call(t,i[r],r,i)}var ee=ll,cl=Object.prototype.toString,Io=cl,hl=Io;function dl(i){return function(e){return"[object "+i+"]"===hl.call(e)}}var Bt=dl,ul=Bt,fl=Array.isArray||ul("Array"),z=fl;function gl(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var we=gl,vl=we;function pl(i,e,t){if(i)for(var r in i)vl(i,r)&&e.call(t,i[r],r,i)}var Ht=pl,ml=z,xl=ee,wl=Ht;function yl(i,e,t){return i&&(ml(i)?xl:wl)(i,e,t)}var Z=yl;function El(i){return function(e){return typeof e===i}}var gt=El,Cl=gt,bl=Cl("function"),te=bl,_l=Z;function Rl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);_l(r,e>1?function(o){s.push([""+o,r[o]])}:function(){s.push(arguments[e])})}return s}}var nr=Rl,Sl=nr,Il=Sl("keys",1),Ae=Il,Tl=Io,Ol=Ht,$l=ee;function Hi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function ri(i,e){return e?To(i,e):i}function To(i,e){if(i)switch(Tl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return Ol(i,function(a,n){t[n]=ri(a,e)}),t}case"[object Date]":case"[object RegExp]":return Hi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return $l(i,function(a){r.push(ri(a,e))}),r}case"[object Set]":{var s=Hi(i);return s.forEach(function(a){s.add(ri(a,e))}),s}case"[object Map]":{var o=Hi(i);return o.forEach(function(a,n){o.set(n,ri(a,e))}),o}}return i}function kl(i,e){return i&&To(i,e)}var lr=kl,Ll=ee,Dl=Ae,Ml=z,Al=lr,Br=Object.assign;function Hr(i,e,t){for(var r=e.length,s,o=1;o<r;o++)s=e[o],Ll(Dl(e[o]),t?function(a){i[a]=Al(s[a],t)}:function(a){i[a]=s[a]});return i}var Nl=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=Ml(i[1])?[]:{},Hr(i,e,!0)}else return Br?Br.apply(Object,e):Hr(i,e)}return i},ne=Nl,Oo=Te,Bl=ee,Hl=Z,Fl=te,Kl=ne,Re=function(){};function Pl(){Bl(arguments,function(i){Hl(i,function(e,t){Re[t]=Fl(e)?function(){var r=e.apply(Re.$context,arguments);return Re.$context=null,r}:e})})}function $o(i){return Kl(Oo,i)}function Yl(){return Oo}var ko="3.7.8";Re.VERSION=ko;Re.version=ko;Re.mixin=Pl;Re.setup=$o;Re.setConfig=$o;Re.getConfig=Yl;var Vl=Re;function Wl(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var cr=Wl,Xl=cr,zl=Ae;function Gl(i,e,t){Xl(zl(i),function(r){e.call(t,i[r],r,i)})}var Lo=Gl;function Ul(i){return i===null}var Ne=Ul,ql=Ne;function Zl(i,e){return function(t){return ql(t)?e:t[i]}}var vt=Zl,Jl=Z,Ql=te,jl=vt;function ec(i,e,t){var r={};if(i)if(e)Ql(e)||(e=jl(e)),Jl(i,function(s,o){r[o]=e.call(t,s,o,i)});else return i;return r}var tc=ec;function ic(i){return i?i.constructor===Object:!1}var pt=ic;function rc(i){return i!=="__proto__"&&i!=="constructor"}var Do=rc,Fr=z,Kr=pt,sc=te,oc=Z,ac=Do;function Mo(i,e){return Kr(i)&&Kr(e)||Fr(i)&&Fr(e)?(oc(e,function(t,r){ac(r)&&(i[r]=sc(e)?t:Mo(i[r],t))}),i):e}var nc=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&Mo(i,r);return i},lc=nc,cc=Z;function hc(i,e,t){var r=[];if(i&&arguments.length>1){if(i.map)return i.map(e,t);cc(i,function(){r.push(e.apply(t,arguments))})}return r}var rt=hc,dc=we,uc=z;function fc(i,e,t,r,s){return function(o,a,n){if(o&&a){if(i&&o[i])return o[i](a,n);if(e&&uc(o)){for(var c=0,d=o.length;c<d;c++)if(!!a.call(n,o[c],c,o)===r)return[!0,!1,c,o[c]][t]}else for(var u in o)if(dc(o,u)&&!!a.call(n,o[u],u,o)===r)return[!0,!1,u,o[u]][t]}return s}}var Ei=fc,gc=Ei,vc=gc("some",1,0,!0,!1),Ao=vc,pc=Ei,mc=pc("every",1,1,!1,!0),No=mc,xc=we;function wc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(xc(i,t)&&e===i[t])return!0}return!1}var mt=wc,Pr=z,Yr=mt;function yc(i,e){var t,r=0;if(Pr(i)&&Pr(e)){for(t=e.length;r<t;r++)if(!Yr(i,e[r]))return!1;return!0}return Yr(i,e)}var Bo=yc,Vr=Z,Ec=mt,Cc=te,bc=vt;function _c(i,e,t){var r=[];if(e){Cc(e)||(e=bc(e));var s,o={};Vr(i,function(a,n){s=e.call(t,a,n,i),o[s]||(o[s]=1,r.push(a))})}else Vr(i,function(a){Ec(r,a)||r.push(a)});return r}var Ho=_c,Rc=rt;function Sc(i){return Rc(i,function(e){return e})}var hr=Sc,Ic=Ho,Tc=hr;function Oc(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(Tc(i[t]));return Ic(e)}var $c=Oc,kc="undefined",ye=kc,Lc=ye,Dc=gt,Mc=Dc(Lc),Oe=Mc,Ac=Ne,Nc=Oe;function Bc(i){return Ac(i)||Nc(i)}var Be=Bc,Hc=/(.+)?\[(\d+)\]$/,Fo=Hc;function Fc(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var dr=Fc,Kc=Fo,Pc=dr,Yc=we,Vc=Oe,Ko=Be;function Wc(i,e,t){if(Ko(i))return t;var r=zc(i,e);return Vc(r)?t:r}function Xc(i,e){var t=e?e.match(Kc):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function zc(i,e){if(i){var t,r,s,o=0;if(i[e]||Yc(i,e))return i[e];if(r=Pc(e),s=r.length,s){for(t=i;o<s;o++)if(t=Xc(t,r[o]),Ko(t))return o===s-1?t:void 0}return t}}var Ft=Wc,Wr=ee,Gc=hr,Xr=rt,zr=z,Uc=te,qc=pt,Gr=Oe,Zc=Ne,Jc=Be,Qc=Ft,jc=vt,eh="asc",th="desc";function ji(i,e){return Gr(i)?1:Zc(i)?Gr(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function ih(i,e,t){return function(r,s){var o=r[i],a=s[i];return o===a?t?t(r,s):0:e.order===th?ji(a,o):ji(o,a)}}function rh(i,e,t,r){var s=[];return t=zr(t)?t:[t],Wr(t,function(o,a){if(o){var n=o,c;zr(o)?(n=o[0],c=o[1]):qc(o)&&(n=o.field,c=o.order),s.push({field:n,order:c||eh}),Wr(e,Uc(n)?function(d,u){d[a]=n.call(r,d.data,u,i)}:function(d){d[a]=n?Qc(d.data,n):d.data})}}),s}function sh(i,e,t){if(i){if(Jc(e))return Gc(i).sort(ji);for(var r,s=Xr(i,function(n){return{data:n}}),o=rh(i,s,e,t),a=o.length-1;a>=0;)r=ih(a,o[a],r),a--;return r&&(s=s.sort(r)),Xr(s,jc("data"))}return[]}var ur=sh,oh=ur,ah=oh,nh=ah;function lh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var Po=lh,ch=nr,hh=ch("values",0),xt=hh,dh=Po,uh=xt;function fh(i){for(var e,t=[],r=uh(i),s=r.length-1;s>=0;s--)e=s>0?dh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var Yo=fh,gh=Yo;function vh(i,e){var t=gh(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var ph=vh;function mh(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var Vo=mh,xh=Vo,wh=xh(parseFloat),st=wh,Ur=st;function yh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?Ur(e):0,t=s>=3?Ur(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var ot=yh,Eh=Z;function Ch(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);Eh(i,function(s,o){e.call(t,s,o,i)&&r.push(s)})}return r}var bh=Ch,_h=Ei,Rh=_h("",0,2,!0),Sh=Rh,Ih=Ei,Th=Ih("find",1,3,!0),Oh=Th,$h=z,kh=xt;function Lh(i,e,t){if(i){$h(i)||(i=kh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Dh=Lh,Mh=Ae;function Ah(i,e,t){if(i){var r,s,o=0,a=null,n=t,c=arguments.length>2,d=Mh(i);if(i.length&&i.reduce)return s=function(){return e.apply(a,arguments)},c?i.reduce(s,n):i.reduce(s);for(c&&(o=1,n=i[d[0]]),r=d.length;o<r;o++)n=e.call(a,n,i[d[o]],o,i);return n}}var Nh=Ah,Bh=z;function Hh(i,e,t,r){if(Bh(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,o,a=e>>0,n=t>>0,c=i.length,d=arguments.length>3?r>>0:c;if(a<c&&(a=a>=0?a:c+a,a>=0&&(n=n>=0?n:c+n,d=d>=0?d:c+d,n<d)))for(s=0,o=i.slice(n,d);a<c&&!(o.length<=s);a++)i[a]=o[s++];return i}var Fh=Hh,Kh=z;function Ph(i,e){var t,r=[],s=e>>0||1;if(Kh(i))if(s>=0&&i.length>s)for(t=0;t<i.length;)r.push(i.slice(t,t+s)),t+=s;else r=i.length?[i]:i;return r}var Yh=Ph,Vh=rt,Wh=vt;function Xh(i,e){return Vh(i,Wh(e))}var Wo=Xh,zh=te,qr=Be,Gh=Ft,Uh=ee;function qh(i){return function(e,t){if(e&&e.length){var r,s;return Uh(e,function(o,a){t&&(o=zh(t)?t(o,a,e):Gh(o,t)),!qr(o)&&(qr(r)||i(r,o))&&(s=a,r=o)}),e[s]}return r}}var Xo=qh,Zh=Xo,Jh=Zh(function(i,e){return i<e}),zo=Jh,Qh=Wo,jh=zo;function ed(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=jh(i,function(o){return o?o.length:0}),r=t?t.length:0;e<r;e++)s.push(Qh(i,e));return s}var Go=ed,td=Go;function id(){return td(arguments)}var rd=id,sd=xt,od=Z;function ad(i,e){var t={};return e=e||[],od(sd(i),function(r,s){t[r]=e[s]}),t}var nd=ad,Uo=z,ld=ee;function qo(i,e){var t=[];return ld(i,function(r){t=t.concat(Uo(r)?e?qo(r,e):r:[r])}),t}function cd(i,e){return Uo(i)?qo(i,e):[]}var hd=cd,dd=rt,ud=z;function fd(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function gd(i,e){for(var t,r=arguments,s=[],o=[],a=2,n=r.length;a<n;a++)s.push(r[a]);if(ud(e)){for(n=e.length-1,a=0;a<n;a++)o.push(e[a]);e=e[n]}return dd(i,function(c){if(o.length&&(c=fd(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var vd=gd;function pd(i,e){return(console[i]||console.log)(e)}var md=pd;function xd(i,e){try{delete i[e]}catch{i[e]=void 0}}var Zo=xd,wd=z,yd=cr,Ed=Lo;function Cd(i,e,t){return i&&(wd(i)?yd:Ed)(i,e,t)}var Jo=Cd,bd=gt,_d=bd("object"),Ci=_d,Rd=Zo,Sd=pt,Id=Ci,Td=z,Od=Ne,$d=ne,kd=Ht;function Ld(i,e,t){if(i){var r,s=arguments.length>1&&(Od(e)||!Id(e)),o=s?t:e;if(Sd(i))kd(i,s?function(a,n){i[n]=e}:function(a,n){Rd(i,n)}),o&&$d(i,o);else if(Td(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;o&&i.push.apply(i,o)}}return i}var Qo=Ld,Dd=Zo,Md=te,Ad=z,Nd=Z,Bd=ee,Hd=Jo,Fd=Qo,Kd=Be;function Pd(i){return function(e,t){return t===i}}function Yd(i,e,t){if(i){if(!Kd(e)){var r=[],s=[];return Md(e)||(e=Pd(e)),Nd(i,function(o,a,n){e.call(t,o,a,n)&&r.push(a)}),Ad(i)?Hd(r,function(o,a){s.push(i[o]),i.splice(o,1)}):(s={},Bd(r,function(o){s[o]=i[o],Dd(i,o)})),s}return Fd(i)}return i}var jo=Yd,Vd=Te,Zr=md,Wd=ur,Xd=lr,zd=Be,er=Z,Gd=jo,Ud=ne;function qd(i,e){er(i,function(t){t[e]&&!t[e].length&&Gd(t,e)})}function Zd(i,e){var t=Ud({},Vd.treeOptions,e),r=t.strict,s=t.key,o=t.parentKey,a=t.children,n=t.mapChildren,c=t.sortKey,d=t.reverse,u=t.data,f=[],g={},v={},p,m,x;return c&&(i=Wd(Xd(i),c),d&&(i=i.reverse())),er(i,function(C){p=C[s],v[p]&&Zr("warn","Duplicate primary key="+p),v[p]=!0}),er(i,function(C){p=C[s],u?(m={},m[u]=C):m=C,x=C[o],g[p]=g[p]||[],m[s]=p,m[o]=x,p===x&&(x=null,Zr("warn","Error infinite Loop. key="+p+" parentKey="+p)),g[x]=g[x]||[],g[x].push(m),m[a]=g[p],n&&(m[n]=g[p]),(!r||r&&zd(x))&&(v[x]||f.push(m))}),r&&qd(i,a),f}var Jd=Zd,Qd=Te,jd=ee,eu=ne;function ea(i,e,t,r){var s=r.key,o=r.parentKey,a=r.children,n=r.data,c=r.updated,d=r.clear;return jd(t,function(u){var f=u[a];n&&(u=u[n]),c!==!1&&(u[o]=e?e[s]:null),i.push(u),f&&f.length&&ea(i,u,f,r),d&&delete u[a]}),i}function tu(i,e){return ea([],null,i,eu({},Qd.treeOptions,e))}var iu=tu;function ru(i){return function(e,t,r,s){var o=r||{},a=o.children||"children";return i(null,e,t,s,[],[],a,o)}}var bi=ru,su=bi;function ta(i,e,t,r,s,o,a,n){if(e){var c,d,u,f,g,v;for(d=0,u=e.length;d<u;d++){if(c=e[d],f=s.concat([""+d]),g=o.concat([c]),t.call(r,c,d,e,f,i,g))return{index:d,item:c,path:f,items:e,parent:i,nodes:g};if(a&&c&&(v=ta(c,c[a],t,r,f.concat([a]),g,a),v))return v}}}var ou=su(ta),au=ou,nu=bi,lu=Z;function ia(i,e,t,r,s,o,a,n){var c,d;lu(e,function(u,f){c=s.concat([""+f]),d=o.concat([u]),t.call(r,u,f,e,c,i,d),u&&a&&(c.push(a),ia(u,u[a],t,r,c,d,a))})}var cu=nu(ia),ra=cu,hu=bi,du=rt;function sa(i,e,t,r,s,o,a,n){var c,d,u,f=n.mapChildren||a;return du(e,function(g,v){return c=s.concat([""+v]),d=o.concat([g]),u=t.call(r,g,v,e,c,i,d),u&&g&&a&&g[a]&&(u[f]=sa(g,g[a],t,r,c,d,a,n)),u})}var uu=hu(sa),fu=uu,gu=ra;function vu(i,e,t,r){var s=[];return i&&e&&gu(i,function(o,a,n,c,d,u){e.call(r,o,a,n,c,d,u)&&s.push(o)},t),s}var pu=vu,mu=bi,xu=ee,wu=ne;function oa(i,e,t,r,s,o,a,n,c){var d,u,f,g,v,p=[],m=c.original,x=c.data,C=c.mapChildren||n,_=c.isEvery;return xu(t,function(y,b){d=o.concat([""+b]),u=a.concat([y]),g=i&&!_||r.call(s,y,b,t,d,e,u),v=n&&y[n],g||v?(m?f=y:(f=wu({},y),x&&(f[x]=y)),f[C]=oa(g,y,y[n],r,s,d,u,n,c),(g||f[C].length)&&p.push(f)):g&&p.push(f)}),p}var yu=mu(function(i,e,t,r,s,o,a,n){return oa(0,i,e,t,r,s,o,a,n)}),Eu=yu;function Cu(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;t<r;t++)if(e===i[t])return t}var aa=Cu;function bu(i,e){if(i.lastIndexOf)return i.lastIndexOf(e);for(var t=i.length-1;t>=0;t--)if(e===i[t])return t;return-1}var na=bu,_u=gt,Ru=_u("number"),$e=Ru,Su=$e;function Iu(i){return Su(i)&&isNaN(i)}var Tu=Iu,Ou=gt,$u=Ou("string"),He=$u,ku=Bt,Lu=ku("Date"),Ue=Lu,Du=parseInt,Kt=Du;function Mu(i){return Date.UTC(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}var Au=Mu;function Nu(i){return i.getTime()}var de=Nu,fi=Kt,Jr=Au,Bu=de,Hu=He,Fu=Ue;function Pt(i){return"(\\d{"+i+"})"}function Ku(i){return i<10?i*100:i<100?i*10:i}function Qr(i){return isNaN(i)?i:fi(i)}var at=Pt(2),lt=Pt("1,2"),la=Pt("1,7"),ca=Pt("3,4"),ha=".{1}",Tt=ha+lt,da="(([zZ])|([-+]\\d{2}:?\\d{2}))",jr=[ca,Tt,Tt,Tt,Tt,Tt,ha+la,da],tr=[];for(var Fi=jr.length-1;Fi>=0;Fi--){for(var es="",tt=0;tt<Fi+1;tt++)es+=jr[tt];tr.push(new RegExp("^"+es+"$"))}function Pu(i){for(var e,t={},r=0,s=tr.length;r<s;r++)if(e=i.match(tr[r]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var ts=[["yyyy",ca],["yy",at],["MM",at],["M",lt],["dd",at],["d",lt],["HH",at],["H",lt],["mm",at],["m",lt],["ss",at],["s",lt],["SSS",Pt(3)],["S",la],["Z",da]],ua={},fa=["\\[([^\\]]+)\\]"];for(var tt=0;tt<ts.length;tt++){var Ki=ts[tt];ua[Ki[0]]=Ki[1]+"?",fa.push(Ki[0])}var Yu=new RegExp(fa.join("|"),"g"),is={};function Vu(i,e){var t=is[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Yu,function(u,f){var g=u.charAt(0);return g==="["?f:(r.push(g),ua[u])});t=is[e]={_i:r,_r:new RegExp(s)}}var o={},a=i.match(t._r);if(a){for(var n=t._i,c=1,d=a.length;c<d;c++)o[n[c-1]]=a[c];return o}return o}function Wu(i){if(/^[zZ]/.test(i.Z))return new Date(Jr(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(Jr(i)-(e[1]==="-"?-1:1)*fi(e[2])*36e5+fi(e[3])*6e4):new Date("")}function Xu(i,e){if(i){var t=Fu(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?Bu(i):fi(i));if(Hu(i)){var r=e?Vu(i,e):Pu(i);if(r.y)return r.M&&(r.M=Qr(r.M)-1),r.S&&(r.S=Ku(Qr(r.S.substring(0,3)))),r.Z?Wu(r):new Date(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}}return new Date("")}var ie=Xu;function zu(){return new Date}var _i=zu,Gu=Ue,Uu=ie,qu=_i;function Zu(i){var e,t=i?Uu(i):qu();return Gu(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var ga=Zu,Ju=z,Qu=we;function ju(i,e,t){if(i){if(Ju(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var o in i)if(Qu(i,o)&&e.call(t,i[o],o,i)===!1)break}}var ef=ju,tf=z,rf=we;function sf(i,e,t){if(i){var r,s;if(tf(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=rf(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var of=sf,af=z,nf=He,lf=we;function cf(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(nf(t)||af(t))return e(t,r);for(var s in t)if(lf(t,s)&&r===t[s])return s}return-1}}var va=cf,hf=va,df=aa,uf=hf("indexOf",df),ff=uf,gf=va,vf=na,pf=gf("lastIndexOf",vf),pa=pf,mf=z,xf=He,wf=Z;function yf(i){var e=0;return xf(i)||mf(i)?i.length:(wf(i,function(){e++}),e)}var ma=yf,Ef=$e;function Cf(i){return Ef(i)&&isFinite(i)}var bf=Cf,_f=z,Rf=Ne,Sf=function(i){return!Rf(i)&&!isNaN(i)&&!_f(i)&&i%1===0},xa=Sf,If=z,Tf=xa,Of=Ne;function $f(i){return!Of(i)&&!isNaN(i)&&!If(i)&&!Tf(i)}var kf=$f,Lf=gt,Df=Lf("boolean"),wa=Df,Mf=Bt,Af=Mf("RegExp"),fr=Af,Nf=Bt,Bf=Nf("Error"),ya=Bf;function Hf(i){return i?i.constructor===TypeError:!1}var Ff=Hf;function Kf(i){for(var e in i)return!1;return!0}var Ea=Kf,Pf=ye,Yf=typeof Symbol!==Pf;function Vf(i){return Yf&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var Ca=Vf,Wf=Bt,Xf=Wf("Arguments"),zf=Xf,Gf=He,Uf=$e;function qf(i){return!!(i&&Gf(i.nodeName)&&Uf(i.nodeType))}var Zf=qf,Jf=ye,Qf=typeof document===Jf?0:document,gr=Qf,jf=gr;function eg(i){return!!(i&&jf&&i.nodeType===9)}var tg=eg,ig=ye,rg=typeof window===ig?0:window,ba=rg,sg=ba;function og(i){return!!(sg&&(i&&i===i.window))}var ag=og,ng=ye,lg=typeof FormData!==ng;function cg(i){return lg&&i instanceof FormData}var hg=cg,dg=ye,ug=typeof Map!==dg;function fg(i){return ug&&i instanceof Map}var gg=fg,vg=ye,pg=typeof WeakMap!==vg;function mg(i){return pg&&i instanceof WeakMap}var xg=mg,wg=ye,yg=typeof Set!==wg;function Eg(i){return yg&&i instanceof Set}var Cg=Eg,bg=ye,_g=typeof WeakSet!==bg;function Rg(i){return _g&&i instanceof WeakSet}var Sg=Rg,Ig=te,Tg=He,Og=z,$g=we;function kg(i){return function(e,t,r){if(e&&Ig(t)){if(Og(e)||Tg(e))return i(e,t,r);for(var s in e)if($g(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var _a=kg,Lg=_a,Dg=Lg(function(i,e,t){for(var r=0,s=i.length;r<s;r++)if(e.call(t,i[r],r,i))return r;return-1}),vr=Dg,rs=$e,ss=z,os=He,Mg=fr,Ag=Ue,Ng=wa,Bg=Oe,as=Ae,Hg=No;function Ra(i,e,t,r,s,o,a){if(i===e)return!0;if(i&&e&&!rs(i)&&!rs(e)&&!os(i)&&!os(e)){if(Mg(i))return t(""+i,""+e,s,o,a);if(Ag(i)||Ng(i))return t(+i,+e,s,o,a);var n,c,d,u=ss(i),f=ss(e);if(u||f?u&&f:i.constructor===e.constructor)return c=as(i),d=as(e),r&&(n=r(i,e,s)),c.length===d.length?Bg(n)?Hg(c,function(g,v){return g===d[v]&&Ra(i[g],e[d[v]],t,r,u||f?v:g,i,e)}):!!n:!1}return t(i,e,s,o,a)}var Sa=Ra;function Fg(i,e){return i===e}var Ia=Fg,Kg=Sa,Pg=Ia;function Yg(i,e){return Kg(i,e,Pg)}var Ta=Yg,ns=Ae,Vg=vr,ls=Ta,Wg=Ao,Xg=Bo;function zg(i,e){var t=ns(i),r=ns(e);if(r.length){if(Xg(t,r))return Wg(r,function(s){return Vg(t,function(o){return o===s&&ls(i[o],e[s])})>-1})}else return!0;return ls(i,e)}var Gg=zg,cs=Sa,hs=Ia,Ug=te,qg=Oe;function Zg(i,e,t){return Ug(t)?cs(i,e,function(r,s,o,a,n){var c=t(r,s,o,a,n);return qg(c)?hs(r,s):!!c},t):cs(i,e,hs)}var Jg=Zg,Qg=Ca,jg=Ue,ev=z,tv=fr,iv=ya,rv=Ne;function sv(i){return rv(i)?"null":Qg(i)?"symbol":jg(i)?"date":ev(i)?"array":tv(i)?"regexp":iv(i)?"error":typeof i}var ov=sv,av=Te,nv=Be;function lv(i){return""+(nv(i)?"":i)+av.keyId++}var cv=lv,hv=_a,dv=hv(function(i,e,t){for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return r;return-1}),uv=dv,fv=pt,gv=He;function vv(i){if(fv(i))return i;if(gv(i))try{return JSON.parse(i)}catch{}return{}}var pv=vv,mv=Be;function xv(i){return mv(i)?"":JSON.stringify(i)}var wv=xv,yv=nr,Ev=yv("entries",2),Cv=Ev,bv=te,_v=z,Rv=Z,Sv=vr;function Iv(i,e){return function(t,r){var s,o,a={},n=[],c=this,d=arguments,u=d.length;if(!bv(r)){for(o=1;o<u;o++)s=d[o],n.push.apply(n,_v(s)?s:[s]);r=0}return Rv(t,function(f,g){((r?r.call(c,f,g,t):Sv(n,function(v){return v===g})>-1)?i:e)&&(a[g]=f)}),a}}var Oa=Iv,Tv=Oa,Ov=Tv(1,0),$v=Ov,kv=Oa,Lv=kv(0,1),Dv=Lv,Mv=xt;function Av(i){return Mv(i)[0]}var Nv=Av,Bv=xt;function Hv(i){var e=Bv(i);return e[e.length-1]}var Fv=Hv,Kv=Fo,Pv=dr,si=we;function Yv(i,e){if(i){if(si(i,e))return!0;var t,r,s,o,a,n,c=Pv(e),d=0,u=c.length;for(a=i;d<u&&(n=!1,t=c[d],o=t?t.match(Kv):"",o?(r=o[1],s=o[2],r?a[r]&&si(a[r],s)&&(n=!0,a=a[r][s]):si(a,s)&&(n=!0,a=a[s])):si(a,t)&&(n=!0,a=a[t]),n);d++)if(d===u-1)return!0}return!1}var Vv=Yv,ds=Kt,Wv=dr,Xv=Do,zv=we,us=/(.+)?\[(\d+)\]$/;function Gv(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var o,a,n=e?e.match(us):null;if(t)a=s;else{var c=r?r.match(us):null;c&&!c[1]?a=new Array(ds(c[2])+1):a={}}return n?n[1]?(o=ds(n[2]),i[n[1]]?t?i[n[1]][o]=a:i[n[1]][o]?a=i[n[1]][o]:i[n[1]][o]=a:(i[n[1]]=new Array(o+1),i[n[1]][o]=a)):i[n[2]]=a:i[e]=a,a}return i[e]}function Uv(i,e,t){if(i&&Xv(e)){if((i[e]||zv(i,e))&&!fs(e))i[e]=t;else for(var r=i,s=Wv(e),o=s.length,a=0;a<o;a++)if(!fs(s[a])){var n=a===o-1;r=Gv(r,s[a],n,n?null:s[a+1],t)}}return i}function fs(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var qv=Uv,Zv=Ea,Jv=Ci,Qv=te,jv=vt,ep=Z;function tp(i){return function(){return Zv(i)}}function ip(i,e,t){var r,s={};return i&&(e&&Jv(e)?e=tp(e):Qv(e)||(e=jv(e)),ep(i,function(o,a){r=e?e.call(t,o,a,i):o,s[r]?s[r].push(o):s[r]=[o]})),s}var $a=ip,rp=$a,sp=Ht;function op(i,e,t){var r=rp(i,e,t||this);return sp(r,function(s,o){r[o]=s.length}),r}var ap=op;function np(i,e,t){var r,s,o=[],a=arguments;if(a.length<2&&(e=a[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)o.push(r);return o}var ka=np,gs=Ae,lp=ot,cp=mt,hp=ee,dp=ne;function up(i,e){if(i&&e){var t=dp.apply(this,[{}].concat(lp(arguments,1))),r=gs(t);hp(gs(i),function(s){cp(r,s)&&(i[s]=t[s])})}return i}var fp=up,gp=Xo,vp=gp(function(i,e){return i>e}),pp=vp;function mp(i){return(i.split(".")[1]||"").length}var Ri=mp,xp=Kt;function wp(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(xp(e));return t.join(i)+(t.length>0?i:"")}var Yt=wp;function yp(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var La=yp,oi=Yt,Pi=La;function Ep(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",o=t[3]||"",a=t[5]||"",n=t[6]||"",c=t[7],d=t[8],u=d-n.length,f=d-o.length,g=d-a.length;return c==="+"?o?s+o+oi("0",d):u>0?s+a+n+oi("0",u):s+a+Pi(n,d):o?f>0?s+"0."+oi("0",Math.abs(f))+o:s+Pi(o,f):g>0?s+"0."+oi("0",Math.abs(g))+a+n:s+Pi(a,g)+n}return e}var qe=Ep,vs=Ri,ps=qe;function Cp(i,e){var t=ps(i),r=ps(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,vs(t)+vs(r))}var Da=Cp,bp=Da,ms=st,_p=qe;function Rp(i){return function(e,t){var r=ms(e),s=r;if(r){t=t>>0;var o=_p(r),a=o.split("."),n=a[0],c=a[1]||"",d=c.substring(0,t+1),u=n+(d?"."+d:"");if(t>=c.length)return ms(u);if(u=r,t>0){var f=Math.pow(10,t);s=Math[i](bp(u,f))/f}else s=Math[i](u)}return s}}var pr=Rp,Sp=pr,Ip=Sp("round"),mr=Ip,Tp=pr,Op=Tp("ceil"),Ma=Op,$p=pr,kp=$p("floor"),Aa=kp,Lp=Be,Dp=$e,Mp=qe;function Ap(i){return Dp(i)?Mp(i):""+(Lp(i)?"":i)}var re=Ap,Np=mr,Bp=re,Hp=Yt,Fp=La;function Kp(i,e){e=e>>0;var t=Bp(Np(i,e)),r=t.split("."),s=r[0],o=r[1]||"",a=e-o.length;return e?a>0?s+"."+o+Hp("0",a):s+Fp(o,Math.abs(a)):s}var xr=Kp,Pp=Te,Yp=mr,Vp=Ma,Wp=Aa,Xp=$e,zp=re,Gp=xr,Up=qe,qp=ne;function Zp(i,e){var t=qp({},Pp.commafyOptions,e),r=t.digits,s=Xp(i),o,a,n,c,d;return s?(o=(t.ceil?Vp:t.floor?Wp:Yp)(i,r),a=Up(r?Gp(o,r):o).split("."),c=a[0],d=a[1],n=c&&o<0,n&&(c=c.substring(1,c.length))):(o=zp(i).replace(/,/g,""),a=o?[o]:[],c=a[0]),a.length?(n?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var Jp=Zp,Qp=Kt,jp=Vo,em=jp(Qp),tm=em,im=Da,xs=st;function rm(i,e){var t=xs(i),r=xs(e);return im(t,r)}var wr=rm,ws=Ri,ys=qe,Es=wr;function sm(i,e){var t=ys(i),r=ys(e),s=Math.pow(10,Math.max(ws(t),ws(r)));return(Es(i,s)+Es(e,s))/s}var Na=sm,om=Na,Cs=st;function am(i,e){return om(Cs(i),Cs(e))}var nm=am,bs=Ri,_s=qe,Rs=st,lm=xr;function cm(i,e){var t=Rs(i),r=Rs(e),s=_s(t),o=_s(r),a=bs(s),n=bs(o),c=Math.pow(10,Math.max(a,n)),d=a>=n?a:n;return parseFloat(lm((t*c-r*c)/c,d))}var hm=cm,Ss=Ri,Is=qe,dm=wr;function um(i,e){var t=Is(i),r=Is(e),s=Ss(t),o=Ss(r),a=o-s,n=a<0,c=Math.pow(10,n?Math.abs(a):a);return dm(t.replace(".","")/r.replace(".",""),n?1/c:c)}var Ba=um,fm=Ba,Ts=st;function gm(i,e){return fm(Ts(i),Ts(e))}var vm=gm,Yi=Na,pm=te,mm=z,xm=Z,wm=Ft;function ym(i,e,t){var r=0;return xm(i&&i.length>2&&mm(i)?i.sort():i,e?pm(e)?function(){r=Yi(r,e.apply(t,arguments))}:function(s){r=Yi(r,wm(s,e))}:function(s){r=Yi(r,s)}),r}var Ha=ym,Em=Ba,Cm=ma,bm=Ha;function _m(i,e,t){return Em(bm(i,e,t),Cm(i))}var Rm=_m,Sm="first",Vt=Sm,Im="last",Si=Im;function Tm(i){return i.getFullYear()}var Wt=Tm,Om=864e5,wt=Om;function $m(i){return i.getMonth()}var Ii=$m,km=Ue,Lm=de;function Dm(i){return km(i)&&!isNaN(Lm(i))}var ue=Dm,Os=Vt,Mm=Si,Am=wt,Nm=Wt,$s=de,ks=Ii,Bm=ie,Hm=ue,Fm=$e;function Fa(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=Bm(i),Hm(i)){if(t===Os)return new Date(Nm(i),ks(i)+r,1);if(t===Mm)return new Date($s(Fa(i,r+1,Os))-1);if(Fm(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(ks(i)+r),s!==i.getDate())return i.setDate(1),new Date($s(i)-Am)}}return i}var Xt=Fa,Km=Vt,Ls=Si,Ds=Wt,Pm=Xt,Ym=ie,Vm=ue;function Wm(i,e,t){var r;if(i=Ym(i),Vm(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear(Ds(i)+r)),t||!isNaN(t))){if(t===Km)return new Date(Ds(i),0,1);if(t===Ls)return i.setMonth(11),Pm(i,0,Ls);i.setMonth(t)}return i}var Ti=Wm,Xm=Xt,zm=ie,Gm=ue;function Um(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function qm(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=zm(i),Gm(i)?(r=(Um(i)-1)*3,i.setMonth(r),Xm(i,s,t)):i}var Zm=qm,Ms=Vt,Jm=Si,Qm=Kt,jm=Wt,ex=Ii,tx=de,ix=ie,rx=ue;function Ka(i,e,t){if(i=ix(i),rx(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Qm(e)),t===Ms)return new Date(jm(i),ex(i),i.getDate());if(t===Jm)return new Date(tx(Ka(i,1,Ms))-1)}return i}var Pa=Ka;function sx(i){return i.toUpperCase()}var Ya=sx,ox=wt,ax=ox*7,Va=ax,nx=Te,Vi=wt,lx=Va,cx=de,hx=ie,dx=ue,As=$e;function ux(i,e,t,r){if(i=hx(i),dx(i)){var s=As(t),o=As(r),a=cx(i);if(s||o){var n=o?r:nx.firstDayOfWeek,c=i.getDay(),d=s?t:c;if(c!==d){var u=0;n>c?u=-(7-n+c):n<c&&(u=n-c),d>n?a+=((d===0?7:d)-n+u)*Vi:d<n?a+=(7-n+d+u)*Vi:a+=u*Vi}}return e&&!isNaN(e)&&(a+=e*lx),new Date(a)}return i}var Wa=ux,fx=Te,ai=wt,gx=Va,vx=$e,px=mt,mx=ie,xx=ue,Ns=Wa,wx=ka,yx=rt,ni=de,Ex=yx(wx(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function Bs(i,e){var t=new Date(i).getDay();return px(Ex[e],t)}function Cx(i,e){return function(t,r){var s=vx(r)?r:fx.firstDayOfWeek,o=mx(t);if(xx(o)){var a=Ns(o,0,s,s),n=i(a),c=ni(n),d=ni(a),u=d+ai*6,f=new Date(u),g=Ns(n,0,s,s),v=ni(g),p;if(d===v)return 1;if(e(a,f)){for(p=ni(i(f));p<u;p+=ai)if(Bs(p,s))return 1}var m=v+ai*6,x=new Date(u),C=1;if(e(g,x)){for(C=0,p=c;p<m;p+=ai)if(Bs(p,s)){C++;break}}return Math.floor((d-v)/gx)+C}return NaN}}var Xa=Cx,bx=Xa,_x=bx(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),za=_x,Rx=Wt,Sx=Ii;function Ix(i){return new Date(Rx(i),Sx(i),i.getDate())}var Tx=Ix,Ox=de,$x=Tx;function kx(i){return Ox($x(i))}var Lx=kx,Dx=wt,Mx=Vt,Hs=Lx,Ax=Ti,Nx=ie,Bx=ue;function Hx(i){return i=Nx(i),Bx(i)?Math.floor((Hs(i)-Hs(Ax(i,0,Mx)))/Dx)+1:NaN}var Ga=Hx,Fx=re,Kx=Oe,Px=Yt;function Yx(i,e,t){var r=Fx(i);return e=e>>0,t=Kx(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=Px(t,e/t.length)),t.slice(0,e)+r):r}var Ua=Yx,Ot=Te,Vx=Ya,Wx=Wt,Fs=Ii,Xx=ie,zx=za,Gx=Ga,Ux=ne,qx=ue,Zx=te,_e=Ua;function Ye(i,e,t,r){var s=e[t];return s?Zx(s)?s(r,t,i):s[r]:r}var Jx=/\[([^\]]+)]|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 Qx(i,e,t){if(i){if(i=Xx(i),qx(i)){var r=e||Ot.parseDateFormat||Ot.formatString,s=i.getHours(),o=s<12?"am":"pm",a=Ux({},Ot.parseDateRules||Ot.formatStringMatchs,t?t.formats:null),n=function(y,b){return(""+Wx(i)).substr(4-b)},c=function(y,b){return _e(Fs(i)+1,b,"0")},d=function(y,b){return _e(i.getDate(),b,"0")},u=function(y,b){return _e(s,b,"0")},f=function(y,b){return _e(s<=12?s:s-12,b,"0")},g=function(y,b){return _e(i.getMinutes(),b,"0")},v=function(y,b){return _e(i.getSeconds(),b,"0")},p=function(y,b){return _e(i.getMilliseconds(),b,"0")},m=function(y,b){var E=i.getTimezoneOffset()/60*-1;return Ye(i,a,y,(E>=0?"+":"-")+_e(E,2,"0")+(b===1?":":"")+"00")},x=function(y,b){return _e(Ye(i,a,y,zx(i,(t?t.firstDay:null)||Ot.firstDayOfWeek)),b,"0")},C=function(y,b){return _e(Ye(i,a,y,Gx(i)),b,"0")},_={yyyy:n,yy:n,MM:c,M:c,dd:d,d,HH:u,H:u,hh:f,h:f,mm:g,m:g,ss:v,s:v,SSS:p,S:p,ZZ:m,Z:m,WW:x,W:x,DDD:C,D:C,a:function(y){return Ye(i,a,y,o)},A:function(y){return Ye(i,a,y,Vx(o))},e:function(y){return Ye(i,a,y,i.getDay())},E:function(y){return Ye(i,a,y,i.getDay())},q:function(y){return Ye(i,a,y,Math.floor((Fs(i)+3)/3))}};return r.replace(Jx,function(y,b){return b||(_[y]?_[y](y,y.length):y)})}return"Invalid Date"}return""}var qa=Qx,jx=de,e1=_i,t1=Date.now||function(){return jx(e1())},Za=t1,i1=de,r1=Za,s1=ie,o1=Ue,a1=function(i,e){if(i){var t=s1(i,e);return o1(t)?i1(t):t}return r1()},n1=a1,Ks=qa;function l1(i,e,t){return i&&e?(i=Ks(i,t),i!=="Invalid Date"&&i===Ks(e,t)):!1}var c1=l1,h1=Xa,d1=h1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),u1=d1,f1=Ti,g1=ie,v1=ue,p1=ga;function m1(i,e){return i=g1(i),v1(i)?p1(f1(i,e))?366:365:NaN}var x1=m1,w1=wt,y1=Vt,E1=Si,Ps=de,Ys=Xt,C1=ie,b1=ue;function _1(i,e){return i=C1(i),b1(i)?Math.floor((Ps(Ys(i,e,E1))-Ps(Ys(i,e,y1)))/w1)+1:NaN}var R1=_1,Vs=de,S1=_i,Ws=ie,Xs=ue,zs=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function I1(i,e){var t,r,s,o,a,n,c={done:!1,time:0};if(i=Ws(i),e=e?Ws(e):S1(),Xs(i)&&Xs(e)&&(t=Vs(i),r=Vs(e),t<r))for(o=c.time=r-t,c.done=!0,n=0,a=zs.length;n<a;n++)s=zs[n],o>=s[1]?n===a-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 T1=I1,O1=re,$1=Oe,k1=Yt;function L1(i,e,t){var r=O1(i);return e=e>>0,t=$1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=k1(t,e/t.length)),r+t.slice(0,e)):r}var D1=L1,M1=re,A1=Yt;function N1(i,e){return A1(M1(i),e)}var B1=N1,H1=re;function F1(i){return i&&i.trimRight?i.trimRight():H1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Ja=F1,K1=re;function P1(i){return i&&i.trimLeft?i.trimLeft():K1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var Qa=P1,Y1=Ja,V1=Qa;function W1(i){return i&&i.trim?i.trim():Y1(V1(i))}var ja=W1,X1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},en=X1,z1=re,G1=Ae;function U1(i){var e=new RegExp("(?:"+G1(i).join("|")+")","g");return function(t){return z1(t).replace(e,function(r){return i[r]})}}var tn=U1,q1=en,Z1=tn,J1=Z1(q1),Q1=J1,Gs=en,j1=tn,e0=Z,rn={};e0(Gs,function(i,e){rn[Gs[e]]=e});var t0=j1(rn),i0=t0;function r0(i,e,t){return i.substring(e,t)}var sn=r0;function s0(i){return i.toLowerCase()}var on=s0,o0=re,Ve=sn,$t=Ya,a0=on,Wi={};function n0(i){if(i=o0(i),Wi[i])return Wi[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,o){var a=s.length;return s=a0(s),o?a>2&&o+a<e?$t(Ve(s,0,1))+Ve(s,1,a-1)+$t(Ve(s,a-1,a)):$t(Ve(s,0,1))+Ve(s,1,a):a>1&&o+a<e?Ve(s,0,a-1)+$t(Ve(s,a-1,a)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return $t(Ve(s,1,s.length))}),Wi[i]=t,t}var l0=n0,c0=re,nt=sn,We=on,Xi={};function h0(i){if(i=c0(i),Xi[i])return Xi[i];if(/^[A-Z]+$/.test(i))return We(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,o){var a=s.length;return a>1?r+"-"+We(nt(s,0,a-1))+"-"+We(nt(s,a-1,a))+o:We(r+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var o=r.length;return We(nt(r,0,o-1)+"-"+nt(r,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,o,a){var n=s.length;return n>1&&(r&&(r+="-"),o)?(r||"")+We(nt(s,0,n-1))+"-"+We(nt(s,n-1,n))+o:(r||"")+(a?"-":"")+We(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),Xi[i]=e,e}var d0=h0,u0=re;function f0(i,e,t){var r=u0(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var g0=f0,v0=re;function p0(i,e,t){var r=v0(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var m0=p0,x0=Te,w0=re,y0=ja,E0=Ft;function C0(i,e,t){return w0(i).replace((t||x0).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return E0(e,y0(s))})}var an=C0,b0=an;function _0(i,e){return b0(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var R0=_0;function S0(){}var I0=S0,Us=ot;function T0(i,e){var t=Us(arguments,2);return function(){return i.apply(e,Us(arguments).concat(t))}}var O0=T0,qs=ot;function $0(i,e){var t=!1,r=null,s=qs(arguments,2);return function(){return t||(r=i.apply(e,qs(arguments).concat(s)),t=!0),r}}var k0=$0,L0=ot;function D0(i,e,t){var r=0,s=[];return function(){var o=arguments;r++,r<=i&&s.push(o[0]),r>=i&&e.apply(t,[s].concat(L0(o)))}}var M0=D0,A0=ot;function N0(i,e,t){var r=0,s=[];return t=t||this,function(){var o=arguments;r++,r<i&&(s.push(o[0]),e.apply(t,[s].concat(A0(o))))}}var B0=N0,H0=ne;function F0(i,e,t){var r=null,s=null,o=!1,a=null,n=H0({leading:!0,trailing:!0},t),c=n.leading,d=n.trailing,u=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),a=setTimeout(g,e),u()},g=function(){if(a=null,o){u();return}if(d===!0){f();return}u()},v=function(){var m=a!==null;return m&&clearTimeout(a),u(),a=null,o=!1,m},p=function(){if(r=arguments,s=this,o=!1,a===null&&c===!0){f();return}d===!0&&(a=setTimeout(g,e))};return p.cancel=v,p}var K0=F0,P0=ne;function Y0(i,e,t){var r=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:P0({leading:!1,trailing:!0},t),a=!1,n=null,c=o.leading,d=o.trailing,u=function(){r=null,s=null},f=function(){a=!0,i.apply(s,r),u()},g=function(){if(c===!0&&(n=null),a){u();return}if(d===!0){f();return}u()},v=function(){var m=n!==null;return m&&clearTimeout(n),u(),n=null,a=!1,m},p=function(){a=!1,r=arguments,s=this,n===null?c===!0&&f():clearTimeout(n),n=setTimeout(g,e)};return p.cancel=v,p}var V0=Y0,W0=ot;function X0(i,e){var t=W0(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var z0=X0,G0=decodeURIComponent,nn=G0,Zs=nn,U0=ee,q0=He;function Z0(i){var e,t={};return i&&q0(i)&&U0(i.split("&"),function(r){e=r.split("="),t[Zs(e[0])]=Zs(e[1]||"")}),t}var ln=Z0,J0=encodeURIComponent,cn=J0,gi=cn,hn=Z,dn=z,un=Ne,Q0=Oe,fn=pt;function gn(i,e,t){var r,s=[];return hn(i,function(o,a){r=dn(o),fn(o)||r?s=s.concat(gn(o,e+"["+a+"]",r)):s.push(gi(e+"["+(t?"":a)+"]")+"="+gi(un(o)?"":o))}),s}function j0(i){var e,t=[];return hn(i,function(r,s){Q0(r)||(e=dn(r),fn(r)||e?t=t.concat(gn(r,s,e)):t.push(gi(s)+"="+gi(un(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var ew=j0,tw=ye,iw=typeof location===tw?0:location,Oi=iw,li=Oi;function rw(){return li?li.origin||li.protocol+"//"+li.host:""}var vn=rw,Js=Oi,sw=ln,ow=vn;function Qs(i){return sw(i.split("?")[1]||"")}function aw(i){var e,t,r,s,o=""+i;return o.indexOf("//")===0?o=(Js?Js.protocol:"")+o:o.indexOf("/")===0&&(o=ow()+o),r=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(a,n){return s.protocol=n,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(a,n,c){return t=c||"",s.port=t.replace(":",""),s.hostname=n,s.host=n+t,"/"}).replace(/(#.*)/,function(a,n){return s.hash=n.length>1?n:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=Qs(s.hash),s.searchQuery=Qs(s.search),s}var pn=aw,js=Oi,nw=vn,lw=pa;function cw(){if(js){var i=js.pathname,e=lw(i,"/")+1;return nw()+(e===i.length?i:i.substring(0,e))}return""}var hw=cw,eo=Oi,dw=pn;function uw(){return eo?dw(eo.href):{}}var fw=uw,mn=Te,zi=gr,to=nn,io=cn,gw=z,ro=Ci,xn=Ue,vw=Oe,pw=mt,mw=Ae,vi=ne,Gi=ee,xw=_i,ci=de,ww=Ti,yw=Xt,Ew=Pa;function so(i,e){var t=parseFloat(e),r=xw(),s=ci(r);switch(i){case"y":return ci(ww(r,t));case"M":return ci(yw(r,t));case"d":return ci(Ew(r,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function Ui(i){return(xn(i)?i:new Date(i)).toUTCString()}function ze(i,e,t){if(zi){var r,s,o,a,n,c,d=[],u=arguments;return gw(i)?d=i:u.length>1?d=[vi({name:i,value:e},t)]:ro(i)&&(d=[i]),d.length>0?(Gi(d,function(f){r=vi({},mn.cookies,f),o=[],r.name&&(s=r.expires,o.push(io(r.name)+"="+io(ro(r.value)?JSON.stringify(r.value):r.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,v,p){return Ui(so(p,v))}):/^[0-9]{11,13}$/.test(s)||xn(s)?s=Ui(s):s=Ui(so("d",s)),r.expires=s),Gi(["expires","path","domain","secure"],function(g){vw(r[g])||o.push(r[g]&&g==="secure"?g:g+"="+r[g])})),zi.cookie=o.join("; ")}),!0):(a={},n=zi.cookie,n&&Gi(n.split("; "),function(f){c=f.indexOf("="),a[to(f.substring(0,c))]=to(f.substring(c+1)||"")}),u.length===1?a[i]:a)}return!1}function Cw(i){return pw(wn(),i)}function oo(i){return ze(i)}function ao(i,e,t){return ze(i,e,t),ze}function no(i,e){ze(i,"",vi({expires:-1},mn.cookies,e))}function wn(){return mw(ze())}function bw(){return ze()}vi(ze,{has:Cw,set:ao,setItem:ao,get:oo,getItem:oo,remove:no,removeItem:no,keys:wn,getJSON:bw});var _w=ze,Rw=ye,qi=gr,Zi=ba,Sw=ne,Iw=ee;function lo(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function hi(i){return navigator.userAgent.indexOf(i)>-1}function Tw(){var i,e,t,r=!1,s=!1,o=!1,a={isNode:!1,isMobile:r,isPC:!1,isDoc:!!qi};if(!Zi&&typeof process!==Rw)a.isNode=!0;else{t=hi("Edge"),e=hi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),a.isDoc&&(i=qi.body||qi.documentElement,Iw(["webkit","khtml","moz","ms","o"],function(n){a["-"+n]=!!i[n+"MatchesSelector"]}));try{s=lo(Zi.localStorage)}catch{}try{o=lo(Zi.sessionStorage)}catch{}Sw(a,{edge:t,firefox:hi("Firefox"),msie:!t&&a["-ms"],safari:!e&&!t&&hi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:o})}return a}var Ow=Tw,yn=Vl,co=ne,$w=Ht,kw=Lo,Lw=tc,Dw=lc,Mw=rt,Aw=Ao,Nw=No,Bw=Bo,Hw=ee,Fw=cr,Kw=Ho,Pw=$c,Yw=hr,Vw=nh,Ww=ur,Xw=Yo,zw=ph,Gw=ot,Uw=bh,qw=Sh,Zw=mt,Jw=Oh,Qw=Dh,jw=Nh,ey=Fh,ty=Yh,iy=rd,ry=Go,sy=nd,oy=hd,ay=Wo,ny=vd,ly=Jd,cy=iu,hy=au,dy=ra,uy=fu,fy=pu,gy=Eu,vy=aa,py=na,my=we,xy=z,wy=Ne,yy=Tu,Ey=Oe,Cy=te,by=Ci,_y=He,Ry=pt,Sy=ga,Iy=Ue,Ty=Be,Oy=Z,$y=ef,ky=of,Ly=ff,Dy=pa,My=Ae,Ay=xt,Ny=lr,By=ma,Hy=Jo,Fy=jo,Ky=Qo,Py=bf,Yy=kf,Vy=xa,Wy=wa,Xy=$e,zy=fr,Gy=ya,Uy=Ff,qy=Ea,Zy=Ca,Jy=zf,Qy=Zf,jy=tg,e2=ag,t2=hg,i2=gg,r2=xg,s2=Cg,o2=Sg,a2=Gg,n2=Ta,l2=Jg,c2=ov,h2=cv,d2=vr,u2=uv,f2=pv,g2=wv,v2=Cv,p2=$v,m2=Dv,x2=Nv,w2=Fv,y2=Vv,E2=Ft,C2=qv,b2=$a,_2=ap,R2=ka,S2=fp,I2=Po,T2=zo,O2=pp,$2=Jp,k2=mr,L2=Ma,D2=Aa,M2=xr,A2=tm,N2=st,B2=qe,H2=nm,F2=hm,K2=wr,P2=vm,Y2=Ha,V2=Rm,W2=Ti,X2=Zm,z2=Xt,G2=Pa,U2=ie,q2=qa,Z2=Za,J2=n1,Q2=ue,j2=c1,eE=Wa,tE=Ga,iE=za,rE=u1,sE=x1,oE=R1,aE=T1,nE=D1,lE=Ua,cE=B1,hE=ja,dE=Ja,uE=Qa,fE=Q1,gE=i0,vE=l0,pE=d0,mE=g0,xE=m0,wE=an,yE=R0,ho=re,EE=I0,CE=vt,bE=O0,_E=k0,RE=M0,SE=B0,IE=K0,TE=V0,OE=z0,$E=ln,kE=ew,LE=pn,DE=hw,ME=fw,AE=_w,NE=Ow;co(yn,{assign:co,objectEach:$w,lastObjectEach:kw,objectMap:Lw,merge:Dw,uniq:Kw,union:Pw,sortBy:Vw,orderBy:Ww,shuffle:Xw,sample:zw,some:Aw,every:Nw,slice:Gw,filter:Uw,find:Jw,findLast:Qw,findKey:qw,includes:Zw,arrayIndexOf:vy,arrayLastIndexOf:py,map:Mw,reduce:jw,copyWithin:ey,chunk:ty,zip:iy,unzip:ry,zipObject:sy,flatten:oy,toArray:Yw,includeArrays:Bw,pluck:ay,invoke:ny,arrayEach:Hw,lastArrayEach:Fw,toArrayTree:ly,toTreeArray:cy,findTree:hy,eachTree:dy,mapTree:uy,filterTree:fy,searchTree:gy,hasOwnProp:my,eqNull:Ty,isNaN:yy,isFinite:Py,isUndefined:Ey,isArray:xy,isFloat:Yy,isInteger:Vy,isFunction:Cy,isBoolean:Wy,isString:_y,isNumber:Xy,isRegExp:zy,isObject:by,isPlainObject:Ry,isDate:Iy,isError:Gy,isTypeError:Uy,isEmpty:qy,isNull:wy,isSymbol:Zy,isArguments:Jy,isElement:Qy,isDocument:jy,isWindow:e2,isFormData:t2,isMap:i2,isWeakMap:r2,isSet:s2,isWeakSet:o2,isLeapYear:Sy,isMatch:a2,isEqual:n2,isEqualWith:l2,getType:c2,uniqueId:h2,getSize:By,indexOf:Ly,lastIndexOf:Dy,findIndexOf:d2,findLastIndexOf:u2,toStringJSON:f2,toJSONString:g2,keys:My,values:Ay,entries:v2,pick:p2,omit:m2,first:x2,last:w2,each:Oy,forOf:$y,lastForOf:ky,lastEach:Hy,has:y2,get:E2,set:C2,groupBy:b2,countBy:_2,clone:Ny,clear:Ky,remove:Fy,range:R2,destructuring:S2,random:I2,min:O2,max:T2,commafy:$2,round:k2,ceil:L2,floor:D2,toFixed:M2,toNumber:N2,toNumberString:B2,toInteger:A2,add:H2,subtract:F2,multiply:K2,divide:P2,sum:Y2,mean:V2,now:Z2,timestamp:J2,isValidDate:Q2,isDateSame:j2,toStringDate:U2,toDateString:q2,getWhatYear:W2,getWhatQuarter:X2,getWhatMonth:z2,getWhatWeek:eE,getWhatDay:G2,getYearDay:tE,getYearWeek:iE,getMonthWeek:rE,getDayOfYear:sE,getDayOfMonth:oE,getDateDiff:aE,trim:hE,trimLeft:uE,trimRight:dE,escape:fE,unescape:gE,camelCase:vE,kebabCase:pE,repeat:cE,padStart:lE,padEnd:nE,startsWith:mE,endsWith:xE,template:wE,toFormatString:yE,toString:ho,toValueString:ho,noop:EE,property:CE,bind:bE,once:_E,after:RE,before:SE,throttle:IE,debounce:TE,delay:OE,unserialize:$E,serialize:kE,parseUrl:LE,getBaseURL:DE,locat:ME,browse:NE,cookie:AE});var R=yn,j=[];for(var Ji=0;Ji<256;++Ji)j.push((Ji+256).toString(16).slice(1));function BE(i,e=0){return(j[i[e+0]]+j[i[e+1]]+j[i[e+2]]+j[i[e+3]]+"-"+j[i[e+4]]+j[i[e+5]]+"-"+j[i[e+6]]+j[i[e+7]]+"-"+j[i[e+8]]+j[i[e+9]]+"-"+j[i[e+10]]+j[i[e+11]]+j[i[e+12]]+j[i[e+13]]+j[i[e+14]]+j[i[e+15]]).toLowerCase()}var di,HE=new Uint8Array(16);function FE(){if(!di&&(di=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!di))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return di(HE)}var KE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const uo={randomUUID:KE};function Me(i,e,t){if(uo.randomUUID&&!i)return uo.randomUUID();i=i||{};var r=i.random||(i.rng||FE)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,BE(r)}const PE=i=>i==null||i==="",q=i=>!PE(i),et=i=>i==null,ce=i=>!et(i),YE=i=>function(e,t,r,s){const o=r||{},a=o.children||"children";return i(null,e,t,s,[],[],a,o)},En=(i,e,t,r,s,o,a)=>{let n,c;e.forEach((d,u)=>{n=s.concat([""+u]),c=o.concat([d]),t.call(r,d,u,e,n,i,c),d&&a&&(n.push(a),En(d,d[a]||[],t,r,n,c,a))})},Lt=YE(En),Cn={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170},canvasTable:{DISABLED:!0}};let he=R.clone(Cn,!0);function bn(i){he={form:{...he.form,...i.form},grid:{...he.grid,...i.grid},canvasTable:{...he.canvasTable,...i.canvasTable}}}function VE(){return he}function WE(){var i,e;return{labelCol:(i=he.form)==null?void 0:i.labelCol,wrapperCol:(e=he.form)==null?void 0:e.wrapperCol}}function _n(){var i,e,t;return{align:(i=he.grid)==null?void 0:i.align,lazyReset:(e=he.grid)==null?void 0:e.lazyReset,fitHeight:(t=he.grid)==null?void 0:t.fitHeight}}function Rn(){return he.canvasTable||{}}function XE(){he=JSON.parse(JSON.stringify(Cn))}const $i=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...R.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>$i(t))}},yr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Er={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},zE={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}},Sn=i=>{const t=(24-i.reduce((s,o)=>s+o,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},fo=["xxs","xs","sm","md","lg","xl","xxl"],GE=i=>{const e=R.isArray(i)?i:R.isNumber(i)?Array.from({length:i},()=>yr):[];return R.zipObject(fo,fo.map(t=>e.every(r=>q(r[t]))?Sn(e.map(r=>r[t])):24))};function Cr(i,e,t){const r=l.toValue(i);if(typeof r!="object"||r===null)return l.watch(i,e,t);let s=R.clone(r,!0);return l.watch(i,(o,a,n)=>{e(o,s,n),s=R.clone(o,!0)},t)}const je="-",ct={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??je:je},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return je;if(R.isArray(i))if(i.length>0){const s=e.filter(o=>i.includes(o.value));return s.length?s.map(o=>o.label).join(t):je}else return je;const r=e.find(s=>s.value===i);return r?r.label:je},formatSex:({cellValue:i})=>q(i)?R.toNumber(i)===1?"男":"女":je},UE=(i,{record:e,index:t,column:r,field:s})=>{if(R.isString(i)&&ct[i]){const o=ct[i];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(R.isArray(i)&&ct[i[0]]&&i.length>1){const o=ct[i[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return R.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},In=i=>{Object.assign(ct,i)},qE=l.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:o,rowIndex:a}=t;return()=>{var n,c;return((c=(n=Dt.renders[e.name])==null?void 0:n.renderDefault)==null?void 0:c.call(n,e,{data:r,row:s,field:o,rowIndex:a},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Tn=l.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,o=r.field?t[r.field]:null;return()=>{var a,n;return((n=(a=r.slots)==null?void 0:a.default)==null?void 0:n.call(a,{row:t,column:r,rowIndex:s,cellValue:o}))??(r.cellRender?l.createVNode(qE,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?UE(r.formatter,{record:t,index:s,field:r.field,column:r}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),ZE={class:"text-right mt-4px"},JE=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(i,{emit:e}){const t=i,r={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>R.merge({},r,t.tableConfig)),o=e,a=l.computed({get:()=>t.modelValue??[],set:f=>{o("update:modelValue",f)}}),n=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>d(f)}]}}]),c=()=>{a.value=[...a.value,{}]},d=f=>{a.value=a.value.filter((g,v)=>v!==f)},u=l.computed(()=>{let f=0;return n.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+f,f++),!0):!1)});return(f,g)=>{const v=l.resolveComponent("a-form-item-rest"),p=l.resolveComponent("a-table"),m=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(p,l.mergeProps({"data-source":a.value},s.value,{columns:n.value.map(x=>l.unref($i)(x))}),l.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:x,record:C,index:_})=>[l.createVNode(v,null,{default:l.withCtx(()=>[u.value.some(y=>x.key&&y.field===x.key)?(l.openBlock(),l.createBlock(l.unref(Tn),{key:_,"row-index":_,"default-handler":{},column:u.value.find(y=>x.key&&y.field===x.key),row:C,"table-data":a.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",ZE,[l.createVNode(m,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),oe=i=>{const{icon:e}=i,t=al;return t[e]?l.createVNode(t[e]):t[e]},kt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())},ASelect:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())}},ui={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},On={$input:L.Input,AInput:L.Input,$textarea:L.Textarea,Textarea:L.Textarea,$number:L.InputNumber,AInputNumber:L.InputNumber,$select:L.Select,ASelect:L.Select,$date:L.DatePicker,ADatePicker:L.DatePicker,$range:L.RangePicker,ARangePicker:L.RangePicker,AAutoComplete:L.AutoComplete,$Cascader:L.Cascader,ACascader:L.Cascader,ACheckbox:L.Checkbox,AMentions:L.Mentions,ARate:L.Rate,ASlider:L.Slider,$time:L.TimePicker,ATimePicker:L.TimePicker,ATreeSelect:L.TreeSelect},QE=i=>{const e=On[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:o},{data:a,field:n}){return ce(o)&&q(n)&&et(a[n])&&(a[n]=o),n?l.createVNode(e,l.mergeProps({is:i,value:a[n],"onUpdate:value":c=>a[n]=c},r,R.merge({},kt[i],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:a,field:n},...c)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderDefault({props:t=kt[i]??{},attrs:r={},events:s={},defaultValue:o},{data:a,row:n,field:c}){return ce(o)&&q(c)&&et(n[c])&&(n[c]=o),c?l.createVNode(e,l.mergeProps({is:i,value:n[c],"onUpdate:value":d=>n[c]=d},r,R.merge({},kt[i],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:a,row:n,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderEdit(t,{props:r=kt[i]??{},attrs:s={},events:o={}},a,n){return l.createVNode(e,l.mergeProps({is:i,value:t.value,"onUpdate:value":c=>t.value=c},s,R.merge({},kt[i],r),{onBlur:(...c)=>{var d;n==null||n("blur",t.value),(d=o.blur)==null||d.call(o,a,...c)}}),null)}}},$n=(i,e,t)=>{var r;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,e))}).length>0?l.createVNode(L.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>l.createVNode(L.Button,l.mergeProps(R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):l.createVNode(oe,{icon:"DownOutlined"},null)}),{default:()=>{var s;return[i.content||(((s=i==null?void 0:i.getContent)==null?void 0:s.call(i,e))??"")]}}),overlay:()=>{var s;return l.createVNode("div",{class:`dropdown-wrapper ${((s=i==null?void 0:i.dynamicClassName)==null?void 0:s.call(i,e))??""}`},[i.dropdowns.filter(o=>{var a;return!((a=o.hiddenIf)!=null&&a.call(o,e))}).map(o=>$n(o,e,t))])}}):l.createVNode(L.Button,l.mergeProps({class:((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))||""},R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var s;return[i.content||(((s=i==null?void 0:i.getContent)==null?void 0:s.call(i,e))??"")]}})},ir={...Object.fromEntries(Object.keys(On).map(i=>[i,QE(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(a=>{s.reset(a?{data:a,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var o;return[i.content,((o=i.suffix)==null?void 0:o.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o,a,n;(o=e.click)==null||o.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.reset(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.pick(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,o.props),["content"]),{icon:o.props.icon?l.createVNode(oe,{icon:o.props.icon},null):null,onClick:()=>{var a,n;(n=(a=o.events)==null?void 0:a.click)==null||n.call(a,{data:t,field:r}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.reset(c?{data:c,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.pick(c?{data:c,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(a=>{var n,c;return!((c=(n=a==null?void 0:a.props)==null?void 0:n.hiddenIf)!=null&&c.call(n,{data:t,row:r,field:s}))}).map(a=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,a.props),["content","hiddenIf"]),{icon:a.props.icon?l.createVNode(oe,{icon:a.props.icon},null):null,onClick:()=>{var n,c,d,u;(c=(n=a.events)==null?void 0:n.click)==null||c.call(n,{data:t,row:r,field:s}),a.props.htmlType==="reset"&&(o!=null&&o.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:r,field:s})),a.props.htmlType==="pick"&&(o!=null&&o.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:r,field:s}))}}),{default:()=>[a.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){const r=l.ref(null);return l.createVNode("span",{ref:r,class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>$n(s,t,()=>{var o,a,n,c;return((c=(n=(a=(o=r.value)==null?void 0:o.parentElement)==null?void 0:a.parentElement)==null?void 0:n.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t,defaultValue:r},{data:s,field:o}){return ce(r)&&q(o)&&et(s[o])&&(s[o]=r),q(o)?l.createVNode(L.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":a=>s[o]=a},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...a)=>{var n;(n=e.change)==null||n.call(e,{data:s,field:o},...a)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.RadioGroup,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?l.createVNode(L.AutoComplete,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:ui.autoComplete.filterOption},i),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},ui.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={},defaultValue:t},{data:r,field:s}){return ce(t)&&q(s)&&et(r[s])&&(r[s]=t),q(s)?l.createVNode(L.Switch,l.mergeProps({checked:r[s],"onUpdate:checked":o=>r[s]=o},i,{onChange:(...o)=>{var a;(a=e.change)==null||a.call(e,{data:r,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={},defaultValue:r},{data:s,field:o}){return ce(r)&&q(o)&&et(s[o])&&(s[o]=r),q(o)?l.createVNode(L.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":a=>s[o]=a},i,{options:i.options??e??[],onChange:(...a)=>{var n;(n=t.change)==null||n.call(t,{data:s,field:o},...a)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.CheckboxGroup,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$paragraph:{renderDefault({props:i={}},{row:e,field:t}){var o;const r={ellipsis:{expandable:!0,rows:3}},s=((o=i.getContent)==null?void 0:o.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(L.TypographyParagraph,l.mergeProps(R.merge({},r,R.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?l.createVNode(JE,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&R.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={},defaultValue:t},{data:r,field:s}){const o=i.parse?100:1;if(q(s)){ce(t)&&et(r[s])&&(r[s]=t);const a=l.computed({get:()=>(r[s]??0)*o,set:n=>{r[s]=(n??0)/o}});return l.createVNode("div",{class:"flex items-center"},[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:a.value,"onUpdate:value":n=>a.value=n},R.merge({},ui.PercentInput,R.omit(i,["info"]))),null)])}else return null},renderDefault({props:i={},attrs:e={}},{row:t,field:r}){const s=i.parse?100:1;if(q(r)){const o=l.computed({get:()=>(t[r]??0)*s,set:a=>{R.set(t,r,(a??0)/s)}});return[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":a=>o.value=a},R.merge({},ui.PercentInput,R.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},br=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{ir.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),ir[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},Dt={renders:ir,addRender:br},jE=l.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=l.toRefs(i),o=n=>{e("trigger",n)},a=(n,c)=>{e("delayTrigger",n,c)};return()=>{var n,c;return((c=(n=Dt.renders[t.name])==null?void 0:n.renderItemContent)==null?void 0:c.call(n,{...t,handleTrigger:o,handleDelayTrigger:a},s.value,r))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),eC=l.defineComponent(i=>{const{formData:e}=l.toRefs(i);return()=>{var t,r;return((r=(t=i.item.slots)==null?void 0:t.default)==null?void 0:r.call(t,{data:e.value,field:i.item.field},i.passTrigger,i.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),tC={key:2},iC=["innerHTML"],_r=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=l.ref(!1),o=l.ref(Me()),a=(f,g)=>{const v=g??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",f)},v)},n=f=>{r("trigger",f)},c=()=>{r("reset")},d=()=>{o.value=Me()},u=R.debounce(d,100);return Cr(()=>t.item,(f,g)=>{R.isEqual(f,g)||u()},{deep:!0}),(f,g)=>{const v=l.resolveComponent("a-tooltip"),p=l.resolveComponent("a-form-item"),m=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(m,l.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:l.unref(yr))),{default:l.withCtx(()=>{var x;return[(l.openBlock(),l.createBlock(p,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},l.unref(R.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var C,_;return[(C=f.item.slots)!=null&&C.default?(l.openBlock(),l.createBlock(l.unref(eC),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":a,"pass-trigger":n},null,8,["form-data","item"])):(_=f.item.itemRender)!=null&&_.name?(l.openBlock(),l.createBlock(l.unref(jE),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:a,onTrigger:n},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",tC))]}),_:2},[(x=f.item.slots)!=null&&x.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(R.isFunction)(f.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:0},l.unref(R.omit)(f.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,iC)]),default:l.withCtx(()=>[l.createVNode(l.unref(ut.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:1},f.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(ut.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),rC={key:0,class:"p-pane p-wrapper"},Rr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{type:Function},layout:{},labelCol:{},wrapperCol:{},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(i,{expose:e,emit:t}){const r=i,s=t,o=WE(),a=l.computed(()=>({...r,labelCol:r.labelCol??o.labelCol??{span:6},wrapperCol:r.wrapperCol??o.wrapperCol??{span:16}})),{items:n,data:c}=l.toRefs(r);function d(){s("apply",c.value)}const u=l.ref(),f=l.ref(Me()),g=()=>{f.value=Me()},v=()=>{if(r.customReset)r.customReset();else{const C={};Lt(n.value,_=>{_.field&&_.itemRender?ce(_.itemRender.defaultValue)?C[_.field]=_.itemRender.defaultValue:C[_.field]=void 0:_.field&&_.slots&&(ce(_.slots.defaultValue)?C[_.field]=_.slots.defaultValue:C[_.field]=void 0)}),Object.assign(c.value,C)}s("reset")},p=l.computed(()=>({...R.omit(a.value,["items","data","model","labelCol","wrapperCol"]),labelCol:a.value.labelCol,wrapperCol:a.value.wrapperCol})),m=C=>{var _;C&&((_=u.value)==null||_.validateFields(C))},x=C=>{m(C)};return e({reset:g,$form:l.computed(()=>u.value)}),(C,_)=>l.unref(n).some(y=>{var b;return y.field&&y.itemRender||((b=y.slots)==null?void 0:b.default)})?(l.openBlock(),l.createElementBlock("div",rC,[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:f.value,ref_key:"formEl",ref:u,model:l.unref(c)},p.value,{onSubmit:d}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n),(y,b)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${y.field||b}`,"form-data":l.unref(c),item:y,onReset:v,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),sC=l.defineComponent(i=>{const{column:e}=i;return()=>{var t,r;return((r=(t=e.slots)==null?void 0:t.title)==null?void 0:r.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),kn=({title:i,content:e})=>new Promise((t,r)=>{L.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),oC=L.message.success,aC=L.message.error;L.message.info;const pi=L.message.warning,nC={key:0},lC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},cC={class:"flex items-center flex-1 gap-4px"},hC={key:2},dC={class:"flex items-center gap-4px"},uC={key:0,class:"w-full text-slate-5 pl-4"},Sr=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{},manualFetch:{type:Boolean},align:{},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{},lazyReset:{type:Boolean},fitHeight:{},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var le,ge,It,K,Pe;const r=i,s=_n(),o=l.computed(()=>({...r,rowKey:r.rowKey??"id",scrollMode:r.scrollMode??"inner",align:r.align??s.align??"left",lazyReset:r.lazyReset??s.lazyReset??!1,fitHeight:r.fitHeight??s.fitHeight??170})),{formConfig:a,pageConfig:n,columns:c,toolbarConfig:d,proxyConfig:u,tableConfig:f,selectConfig:g,scrollMode:v}=l.toRefs(r),p=l.reactive({table:!1,toolbar:!1,form:!1}),m=O=>{R.isObject(O)?Object.keys(O).forEach(M=>{p[M]=O[M]}):R.isBoolean(O)&&(p.form=O,p.table=O,p.toolbar=O)},x=l.ref(),C=l.ref(),_=l.ref(500),y=l.ref([]),b=l.ref([]),E=O=>{const{ajax:M}=u.value;switch(O){case"multiDelete":M.multiDelete&&(y.value.length>0?kn({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{p.table=!0,p.toolbar=!0,M.multiDelete(y.value).then(()=>{L.message.success("删除成功"),bt()}).catch(()=>{L.message.error("删除失败")}).finally(()=>{p.table=!1,p.toolbar=!1,w.multiDelete=!1})}):L.message.warn("请选择要删除的数据"));break}},S=l.computed(()=>{const O=[];return Lt(c.value??[],M=>{M.slots&&M.slots.title&&(M.field||(M.field="__holder__"+O.length),O.push(M))}),O}),$=l.ref(),k=l.ref(),T=l.ref(Me()),I=l.ref(Me()),w=l.reactive([...(((ge=(le=r.toolbarConfig)==null?void 0:le.buttons)==null?void 0:ge.map(O=>O.code))??[]).filter(O=>O),...(((K=(It=r.toolbarConfig)==null?void 0:It.tools)==null?void 0:K.map(O=>O.code))??[]).filter(O=>O)].reduce((O,M)=>(O[M]=!1,O),{})),A=(O,M)=>{w[O]=M},F=()=>{I.value=Me()},B=R.debounce(F,100),W=l.computed(()=>{const O=[];return Lt(c.value??[],M=>{(M.slots&&M.slots.default||M.formatter||M.cellRender)&&(M.field||(M.field="__holder__"+O.length),O.push(M))}),O}),P=l.reactive({page:1,size:((Pe=n.value)==null?void 0:Pe.pageSize)??10}),Y=l.ref(0),X=l.ref(0),V=l.ref([]),Ee=l.computed(()=>u.value&&u.value.ajax?n.value?"pagination":"list":"bad"),fe=l.useAttrs(),se=t,ke=l.computed(()=>b.value.filter(O=>y.value.includes(O[r.rowKey??"id"]))),J=O=>{se("toolbarButtonClick",{data:V.value,code:O,selectedKeys:y.value,records:ke.value}),E(O)},qt=R.debounce(J,100),Mi=({key:O})=>qt(O),Ai=O=>{se("toolbarToolClick",{data:V.value,code:O,selectedKeys:y.value,records:ke.value}),E(O)},Et=R.debounce(Ai,100),Le=l.ref({}),Ct=({row:O,field:M})=>{se("pick",{row:O,field:M})},Ke=O=>{if(a.value&&a.value.items.length>0){if(a.value.customReset)a.value.customReset();else{const M={};Lt(a.value.items,U=>{U.field&&U.itemRender?ce(U.itemRender.defaultValue)?M[U.field]=U.itemRender.defaultValue:M[U.field]=void 0:U.field&&U.slots&&(ce(U.slots.defaultValue)?M[U.field]=U.slots.defaultValue:M[U.field]=void 0)}),Le.value=M}se("resetQuery")}P.page=1,O||Ce()},Ni=(O,M)=>M?{list:R.isString(M.list)?R.get(O,M.list):R.isFunction(M.list)?M.list(O):void 0,total:R.isString(M.total)?R.get(O,M.total):R.isFunction(M.total)?M.total(O):void 0,result:R.isString(M.result)?R.get(O,M.result):R.isFunction(M.result)?M.result(O):void 0,message:R.isString(M.message)?R.get(O,M.message):R.isFunction(M.message)?M.message(O):void 0}:{list:O},Zt=l.ref(!0),Jt=()=>(b.value=[],y.value=[],Ke()),bt=()=>(P.page=1,b.value=[],y.value=[],Rt()),_t=(O,M,U)=>(P.page=O.current,P.size=O.pageSize,Rt()),Rt=()=>new Promise(O=>{if(Ee.value!=="bad"){p.form=!0,p.table=!0;const{ajax:M}=u.value;M.query({form:Le.value,page:P}).then(U=>{const{list:ve,total:Je,result:Q,message:be}=Ni(U,u.value.response);ve?(V.value=ve,Y.value++):Q?(V.value=Q,X.value=Je??Q.length,Y.value++):(V.value=[],Y.value++,be&&L.message.warn(be)),O(V.value)}).catch(U=>{console.error("fetchData error",U),O([])}).finally(()=>{p.form=!1,p.table=!1})}}),Ce=R.debounce(Rt,160),St=(O,M)=>(Object.assign(Le.value,O),P.page=1,M?Promise.resolve():Ce()),Qt=(O,M)=>(Le.value=O,P.page=1,M?Promise.resolve():Ce()),jt=l.computed(()=>Ee.value==="pagination"?{current:P.page,total:X.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:O=>`共${O}条数据`}:!1),ei={size:"small",sticky:!0,transformCellText:({text:O})=>R.isArray(O)&&O.length===0?"-":O},ti=l.computed(()=>R.merge({},ei,(f==null?void 0:f.value)??{},g.value?{rowSelection:{type:g.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:y.value,onChange:O=>{y.value=O;const M=r.rowKey??"id",U=b.value.map(Q=>Q[M]),Je=O.filter(Q=>!U.includes(Q)).map(Q=>V.value.find(be=>be[M]===Q)).filter(Q=>!!Q);b.value=[...b.value,...Je]},getCheckboxProps:g.value.getCheckboxProps}}:{})),ii=l.computed(()=>R.omit({labelCol:Er,...a.value},["items"])),D=()=>{bt()};l.watch(()=>[c.value,u.value,d.value],()=>{B()},{deep:!0});const N=()=>{var Q,be;const O=(Q=x.value)==null?void 0:Q.parentElement,M=O?window.getComputedStyle(O).height:"0px",U=C.value?window.getComputedStyle(C.value).height:"0px",ve=U.includes("px")?R.toNumber(U.replace("px","")):0,Je=(be=g.value)!=null&&be.showCount?22:0;_.value=r.renderY??R.toNumber(M.replace("px",""))-o.value.fitHeight-(r.toolbarConfig?30:0)-ve-Je,Zt.value=R.toNumber(M.replace("px",""))>600};e({commitProxy:{query:Ce,reload:Jt,reloadPage:bt,passQuery:St,forcePassQuery:Qt},$table:l.computed(()=>k.value),selectedRowKeys:l.computed(()=>y.value),setBtnLoading:A,selectedRecords:ke,$form:l.computed(()=>$.value),getFormData:()=>Le.value,setLoadings:m,resizeTable:N});let G;l.onMounted(()=>{N(),window.addEventListener("resize",N),G=new MutationObserver(O=>{O.forEach(M=>{if(M.type==="attributes"&&M.attributeName==="style"){const U=M.target;window.getComputedStyle(U).display!=="none"&&N()}})}),x.value&&G.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ke(r.manualFetch)});const De=["align"],Ze=O=>O.map(M=>({...De.reduce((U,ve)=>({[ve]:o.value[ve]}),{}),...M}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",N),G.disconnect()}),(O,M)=>{var Q,be,Nr;const U=l.resolveComponent("a-menu-item"),ve=l.resolveComponent("a-menu"),Je=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(fe)),[Ee.value==="bad"?(l.openBlock(),l.createElementBlock("div",nC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(be=(Q=l.unref(a))==null?void 0:Q.items)!=null&&be.some(H=>H.field&&H.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:C},[l.createVNode(l.unref(L.Spin),{spinning:p.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:T.value,ref_key:"formEl",ref:$,model:Le.value},ii.value,{onSubmit:D}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).items,(H,pe)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${H.field||pe}`,"form-data":Le.value,item:H,onReset:M[0]||(M[0]=Qe=>Ke(o.value.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",lC,[l.createElementVNode("div",cC,[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,(H,pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:pe},[H.dropdowns&&H.dropdowns.length?(l.openBlock(),l.createBlock(Je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ve,{onClick:Mi},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(H.dropdowns,Qe=>(l.openBlock(),l.createBlock(U,{key:Qe.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Qe.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:H.type,size:H.size??"middle",disabled:l.unref(d).disabled||H.disabled,loading:p.toolbar||!!H.code&&w[H.code]},{default:l.withCtx(()=>[H.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:H.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(H.content)+" ",1),l.createVNode(l.unref(ut.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):H.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:H.type,size:H.size??"middle",disabled:l.unref(d).disabled||H.disabled,loading:p.toolbar||!!H.code&&w[H.code],onClick:Qe=>l.unref(qt)(H.code)},{default:l.withCtx(()=>[H.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:H.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(H.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",hC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",dC,[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,(H,pe)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:pe,type:H.type,size:H.size??"middle",disabled:l.unref(d).disabled||H.disabled,onClick:Qe=>l.unref(Et)(H.code),loading:p.toolbar||!!H.code&&w[H.code]},{default:l.withCtx(()=>[l.createVNode(l.unref(oe),{icon:H.icon},null,8,["icon"])]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${Zt.value?"h-0":""} p-${l.unref(v)??"inner"}-scroll`)},[(Nr=l.unref(g))!=null&&Nr.multiple&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",uC," 已选:"+l.toDisplayString(y.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(L.Table),l.mergeProps({key:I.value+"_table","row-key":O.rowKey??"id",ref_key:"tableEl",ref:k,columns:Ze(l.unref(c)??[]).map(H=>l.unref($i)(H)),"data-source":V.value,loading:p.table,pagination:jt.value},ti.value,{scroll:{x:"max-content",y:_.value},onChange:_t}),l.createSlots({_:2},[S.value.length>0?{name:"headerCell",fn:l.withCtx(({column:H})=>[S.value.some(pe=>H.key&&pe.field===H.key)?(l.openBlock(),l.createBlock(l.unref(sC),{key:I.value+"_title_"+Y.value+"_slot_"+H.key,column:S.value.find(pe=>H.key&&pe.field===H.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,W.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:H,record:pe,index:Qe})=>[W.value.some(Bi=>H.key&&Bi.field===H.key)?(l.openBlock(),l.createBlock(l.unref(Tn),{key:I.value+"_cell_"+Y.value+"_slot_"+H.key,column:W.value.find(Bi=>H.key&&Bi.field===H.key),"default-handler":{pick:Ct,setLoadings:m},row:pe,"row-index":Qe,"table-data":V.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-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: transparent;--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-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: rgb(82, 146, 247)}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.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)}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var fC=Object.defineProperty,gC=(i,e,t)=>e in i?fC(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>gC(i,typeof e!="symbol"?e+"":e,t);class vC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,value:d,field:u,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const v={field:u,fieldValue:f,value:d,column:r,colIndex:n,rowIndex:c,row:s,key:o,rowKey:a,...g};g.validator(v,d,p=>{p&&t.push({...v,message:p})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,field:u,fieldValue:f,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,field:u,fieldValue:f,message:g.message||`${o} is required`})}return t}}function Ln(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function Mt(i,e){let t=0,r;return function(...s){const o=new Date().getTime(),a=o-t,n=typeof e=="function"?e():e;!t||a>=n?(i.apply(this,s),t=o):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},n-a))}}function Dn(i=[]){return i.length?i.map(e=>Dn(e.children)+1).sort((e,t)=>t-e)[0]:0}function pC(i=[]){let e=[],t=[],r=[];return i.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?r.push(s):t.push(s)}),[...e.sort((s,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...r.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function Mn(i=[],e=1,t=0){return i.map(r=>{if(r.children){let s=0,o=r.fixed;r.children.forEach(n=>{n.fixed=o});const a=Mn(r.children,e-1,t+1);return a&&a.forEach(n=>{s+=n.colspan??0}),{...r,width:r.width,level:t,rowspan:1,colspan:s,children:a}}return{...r,level:t,rowspan:e,colspan:1}})}function mi(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(mi(t.children)):e.push(t)}),e}const go=/^(\r\n|\n\r|\r|\n)/,mC=/^[^\t\r\n]+/,vo=/^\t/;function xC(i){let e=[[""]];if(i.length===0)return e;let t=0,r=0,s;for(;i.length>0&&s!==i.length;)if(s=i.length,i.match(vo))i=i.replace(vo,""),t+=1,e[r][t]="";else if(i.match(go))i=i.replace(go,""),t=0,r+=1,e[r]=[""];else{let o="";if(i.startsWith('"')){let a=0,n=!0;for(;n;){const c=i.slice(0,1);c==='"'&&(a+=1),o+=c,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&a%2===0)&&(n=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const a=i.match(mC);o=a?a[0]:"",i=i.slice(o.length)}e[r][t]=o}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function wC(i){let e,t,r,s,o="",a;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(o+=" "),a=i[e][r],typeof a=="string"?a.indexOf(`
|
|
1
|
+
"use strict";Object.defineProperties(exports,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}});const l=require("vue"),L=require("ant-design-vue"),ut=require("@ant-design/icons-vue");function ol(i){const e=Object.create(null,{[Symbol.toStringTag]:{value:"Module"}});if(i){for(const t in i)if(t!=="default"){const r=Object.getOwnPropertyDescriptor(i,t);Object.defineProperty(e,t,r.get?r:{enumerable:!0,get:()=>i[t]})}}return e.default=i,Object.freeze(e)}const al=ol(ut);var nl={keyId:1,cookies:{path:"/"},treeOptions:{parentKey:"parentId",key:"id",children:"children"},parseDateFormat:"yyyy-MM-dd HH:mm:ss",firstDayOfWeek:1},Te=nl;function ll(i,e,t){if(i)if(i.forEach)i.forEach(e,t);else for(var r=0,s=i.length;r<s;r++)e.call(t,i[r],r,i)}var ee=ll,cl=Object.prototype.toString,Io=cl,hl=Io;function dl(i){return function(e){return"[object "+i+"]"===hl.call(e)}}var Bt=dl,ul=Bt,fl=Array.isArray||ul("Array"),z=fl;function gl(i,e){return i&&i.hasOwnProperty?i.hasOwnProperty(e):!1}var we=gl,vl=we;function pl(i,e,t){if(i)for(var r in i)vl(i,r)&&e.call(t,i[r],r,i)}var Ht=pl,ml=z,xl=ee,wl=Ht;function yl(i,e,t){return i&&(ml(i)?xl:wl)(i,e,t)}var Z=yl;function El(i){return function(e){return typeof e===i}}var gt=El,Cl=gt,bl=Cl("function"),te=bl,_l=Z;function Rl(i,e){var t=Object[i];return function(r){var s=[];if(r){if(t)return t(r);_l(r,e>1?function(o){s.push([""+o,r[o]])}:function(){s.push(arguments[e])})}return s}}var nr=Rl,Sl=nr,Il=Sl("keys",1),Ae=Il,Tl=Io,Ol=Ht,$l=ee;function Hi(i,e){var t=i.__proto__.constructor;return e?new t(e):new t}function ri(i,e){return e?To(i,e):i}function To(i,e){if(i)switch(Tl.call(i)){case"[object Object]":{var t=Object.create(Object.getPrototypeOf(i));return Ol(i,function(a,n){t[n]=ri(a,e)}),t}case"[object Date]":case"[object RegExp]":return Hi(i,i.valueOf());case"[object Array]":case"[object Arguments]":{var r=[];return $l(i,function(a){r.push(ri(a,e))}),r}case"[object Set]":{var s=Hi(i);return s.forEach(function(a){s.add(ri(a,e))}),s}case"[object Map]":{var o=Hi(i);return o.forEach(function(a,n){o.set(n,ri(a,e))}),o}}return i}function kl(i,e){return i&&To(i,e)}var lr=kl,Ll=ee,Dl=Ae,Ml=z,Al=lr,Br=Object.assign;function Hr(i,e,t){for(var r=e.length,s,o=1;o<r;o++)s=e[o],Ll(Dl(e[o]),t?function(a){i[a]=Al(s[a],t)}:function(a){i[a]=s[a]});return i}var Nl=function(i){if(i){var e=arguments;if(i===!0){if(e.length>1)return i=Ml(i[1])?[]:{},Hr(i,e,!0)}else return Br?Br.apply(Object,e):Hr(i,e)}return i},ne=Nl,Oo=Te,Bl=ee,Hl=Z,Fl=te,Kl=ne,Re=function(){};function Pl(){Bl(arguments,function(i){Hl(i,function(e,t){Re[t]=Fl(e)?function(){var r=e.apply(Re.$context,arguments);return Re.$context=null,r}:e})})}function $o(i){return Kl(Oo,i)}function Yl(){return Oo}var ko="3.7.8";Re.VERSION=ko;Re.version=ko;Re.mixin=Pl;Re.setup=$o;Re.setConfig=$o;Re.getConfig=Yl;var Vl=Re;function Wl(i,e,t){for(var r=i.length-1;r>=0;r--)e.call(t,i[r],r,i)}var cr=Wl,Xl=cr,zl=Ae;function Gl(i,e,t){Xl(zl(i),function(r){e.call(t,i[r],r,i)})}var Lo=Gl;function Ul(i){return i===null}var Ne=Ul,ql=Ne;function Zl(i,e){return function(t){return ql(t)?e:t[i]}}var vt=Zl,Jl=Z,Ql=te,jl=vt;function ec(i,e,t){var r={};if(i)if(e)Ql(e)||(e=jl(e)),Jl(i,function(s,o){r[o]=e.call(t,s,o,i)});else return i;return r}var tc=ec;function ic(i){return i?i.constructor===Object:!1}var pt=ic;function rc(i){return i!=="__proto__"&&i!=="constructor"}var Do=rc,Fr=z,Kr=pt,sc=te,oc=Z,ac=Do;function Mo(i,e){return Kr(i)&&Kr(e)||Fr(i)&&Fr(e)?(oc(e,function(t,r){ac(r)&&(i[r]=sc(e)?t:Mo(i[r],t))}),i):e}var nc=function(i){i||(i={});for(var e=arguments,t=e.length,r,s=1;s<t;s++)r=e[s],r&&Mo(i,r);return i},lc=nc,cc=Z;function hc(i,e,t){var r=[];if(i&&arguments.length>1){if(i.map)return i.map(e,t);cc(i,function(){r.push(e.apply(t,arguments))})}return r}var rt=hc,dc=we,uc=z;function fc(i,e,t,r,s){return function(o,a,n){if(o&&a){if(i&&o[i])return o[i](a,n);if(e&&uc(o)){for(var c=0,d=o.length;c<d;c++)if(!!a.call(n,o[c],c,o)===r)return[!0,!1,c,o[c]][t]}else for(var u in o)if(dc(o,u)&&!!a.call(n,o[u],u,o)===r)return[!0,!1,u,o[u]][t]}return s}}var Ei=fc,gc=Ei,vc=gc("some",1,0,!0,!1),Ao=vc,pc=Ei,mc=pc("every",1,1,!1,!0),No=mc,xc=we;function wc(i,e){if(i){if(i.includes)return i.includes(e);for(var t in i)if(xc(i,t)&&e===i[t])return!0}return!1}var mt=wc,Pr=z,Yr=mt;function yc(i,e){var t,r=0;if(Pr(i)&&Pr(e)){for(t=e.length;r<t;r++)if(!Yr(i,e[r]))return!1;return!0}return Yr(i,e)}var Bo=yc,Vr=Z,Ec=mt,Cc=te,bc=vt;function _c(i,e,t){var r=[];if(e){Cc(e)||(e=bc(e));var s,o={};Vr(i,function(a,n){s=e.call(t,a,n,i),o[s]||(o[s]=1,r.push(a))})}else Vr(i,function(a){Ec(r,a)||r.push(a)});return r}var Ho=_c,Rc=rt;function Sc(i){return Rc(i,function(e){return e})}var hr=Sc,Ic=Ho,Tc=hr;function Oc(){for(var i=arguments,e=[],t=0,r=i.length;t<r;t++)e=e.concat(Tc(i[t]));return Ic(e)}var $c=Oc,kc="undefined",ye=kc,Lc=ye,Dc=gt,Mc=Dc(Lc),Oe=Mc,Ac=Ne,Nc=Oe;function Bc(i){return Ac(i)||Nc(i)}var Be=Bc,Hc=/(.+)?\[(\d+)\]$/,Fo=Hc;function Fc(i){return i?i.splice&&i.join?i:(""+i).replace(/(\[\d+\])\.?/g,"$1.").replace(/\.$/,"").split("."):[]}var dr=Fc,Kc=Fo,Pc=dr,Yc=we,Vc=Oe,Ko=Be;function Wc(i,e,t){if(Ko(i))return t;var r=zc(i,e);return Vc(r)?t:r}function Xc(i,e){var t=e?e.match(Kc):"";return t?t[1]?i[t[1]]?i[t[1]][t[2]]:void 0:i[t[2]]:i[e]}function zc(i,e){if(i){var t,r,s,o=0;if(i[e]||Yc(i,e))return i[e];if(r=Pc(e),s=r.length,s){for(t=i;o<s;o++)if(t=Xc(t,r[o]),Ko(t))return o===s-1?t:void 0}return t}}var Ft=Wc,Wr=ee,Gc=hr,Xr=rt,zr=z,Uc=te,qc=pt,Gr=Oe,Zc=Ne,Jc=Be,Qc=Ft,jc=vt,eh="asc",th="desc";function ji(i,e){return Gr(i)?1:Zc(i)?Gr(e)?-1:1:i&&i.localeCompare?i.localeCompare(e):i>e?1:-1}function ih(i,e,t){return function(r,s){var o=r[i],a=s[i];return o===a?t?t(r,s):0:e.order===th?ji(a,o):ji(o,a)}}function rh(i,e,t,r){var s=[];return t=zr(t)?t:[t],Wr(t,function(o,a){if(o){var n=o,c;zr(o)?(n=o[0],c=o[1]):qc(o)&&(n=o.field,c=o.order),s.push({field:n,order:c||eh}),Wr(e,Uc(n)?function(d,u){d[a]=n.call(r,d.data,u,i)}:function(d){d[a]=n?Qc(d.data,n):d.data})}}),s}function sh(i,e,t){if(i){if(Jc(e))return Gc(i).sort(ji);for(var r,s=Xr(i,function(n){return{data:n}}),o=rh(i,s,e,t),a=o.length-1;a>=0;)r=ih(a,o[a],r),a--;return r&&(s=s.sort(r)),Xr(s,jc("data"))}return[]}var ur=sh,oh=ur,ah=oh,nh=ah;function lh(i,e){return i>=e?i:(i=i>>0)+Math.round(Math.random()*((e||9)-i))}var Po=lh,ch=nr,hh=ch("values",0),xt=hh,dh=Po,uh=xt;function fh(i){for(var e,t=[],r=uh(i),s=r.length-1;s>=0;s--)e=s>0?dh(0,s):0,t.push(r[e]),r.splice(e,1);return t}var Yo=fh,gh=Yo;function vh(i,e){var t=gh(i);return arguments.length<=1?t[0]:(e<t.length&&(t.length=e||0),t)}var ph=vh;function mh(i){return function(e){if(e){var t=i(e&&e.replace?e.replace(/,/g,""):e);if(!isNaN(t))return t}return 0}}var Vo=mh,xh=Vo,wh=xh(parseFloat),st=wh,Ur=st;function yh(i,e,t){var r=[],s=arguments.length;if(i){if(e=s>=2?Ur(e):0,t=s>=3?Ur(t):i.length,i.slice)return i.slice(e,t);for(;e<t;e++)r.push(i[e])}return r}var ot=yh,Eh=Z;function Ch(i,e,t){var r=[];if(i&&e){if(i.filter)return i.filter(e,t);Eh(i,function(s,o){e.call(t,s,o,i)&&r.push(s)})}return r}var bh=Ch,_h=Ei,Rh=_h("",0,2,!0),Sh=Rh,Ih=Ei,Th=Ih("find",1,3,!0),Oh=Th,$h=z,kh=xt;function Lh(i,e,t){if(i){$h(i)||(i=kh(i));for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return i[r]}}var Dh=Lh,Mh=Ae;function Ah(i,e,t){if(i){var r,s,o=0,a=null,n=t,c=arguments.length>2,d=Mh(i);if(i.length&&i.reduce)return s=function(){return e.apply(a,arguments)},c?i.reduce(s,n):i.reduce(s);for(c&&(o=1,n=i[d[0]]),r=d.length;o<r;o++)n=e.call(a,n,i[d[o]],o,i);return n}}var Nh=Ah,Bh=z;function Hh(i,e,t,r){if(Bh(i)&&i.copyWithin)return i.copyWithin(e,t,r);var s,o,a=e>>0,n=t>>0,c=i.length,d=arguments.length>3?r>>0:c;if(a<c&&(a=a>=0?a:c+a,a>=0&&(n=n>=0?n:c+n,d=d>=0?d:c+d,n<d)))for(s=0,o=i.slice(n,d);a<c&&!(o.length<=s);a++)i[a]=o[s++];return i}var Fh=Hh,Kh=z;function Ph(i,e){var t,r=[],s=e>>0||1;if(Kh(i))if(s>=0&&i.length>s)for(t=0;t<i.length;)r.push(i.slice(t,t+s)),t+=s;else r=i.length?[i]:i;return r}var Yh=Ph,Vh=rt,Wh=vt;function Xh(i,e){return Vh(i,Wh(e))}var Wo=Xh,zh=te,qr=Be,Gh=Ft,Uh=ee;function qh(i){return function(e,t){if(e&&e.length){var r,s;return Uh(e,function(o,a){t&&(o=zh(t)?t(o,a,e):Gh(o,t)),!qr(o)&&(qr(r)||i(r,o))&&(s=a,r=o)}),e[s]}return r}}var Xo=qh,Zh=Xo,Jh=Zh(function(i,e){return i<e}),zo=Jh,Qh=Wo,jh=zo;function ed(i){var e,t,r,s=[];if(i&&i.length)for(e=0,t=jh(i,function(o){return o?o.length:0}),r=t?t.length:0;e<r;e++)s.push(Qh(i,e));return s}var Go=ed,td=Go;function id(){return td(arguments)}var rd=id,sd=xt,od=Z;function ad(i,e){var t={};return e=e||[],od(sd(i),function(r,s){t[r]=e[s]}),t}var nd=ad,Uo=z,ld=ee;function qo(i,e){var t=[];return ld(i,function(r){t=t.concat(Uo(r)?e?qo(r,e):r:[r])}),t}function cd(i,e){return Uo(i)?qo(i,e):[]}var hd=cd,dd=rt,ud=z;function fd(i,e){for(var t=0,r=e.length;i&&t<r;)i=i[e[t++]];return r&&i?i:0}function gd(i,e){for(var t,r=arguments,s=[],o=[],a=2,n=r.length;a<n;a++)s.push(r[a]);if(ud(e)){for(n=e.length-1,a=0;a<n;a++)o.push(e[a]);e=e[n]}return dd(i,function(c){if(o.length&&(c=fd(c,o)),t=c[e]||e,t&&t.apply)return t.apply(c,s)})}var vd=gd;function pd(i,e){return(console[i]||console.log)(e)}var md=pd;function xd(i,e){try{delete i[e]}catch{i[e]=void 0}}var Zo=xd,wd=z,yd=cr,Ed=Lo;function Cd(i,e,t){return i&&(wd(i)?yd:Ed)(i,e,t)}var Jo=Cd,bd=gt,_d=bd("object"),Ci=_d,Rd=Zo,Sd=pt,Id=Ci,Td=z,Od=Ne,$d=ne,kd=Ht;function Ld(i,e,t){if(i){var r,s=arguments.length>1&&(Od(e)||!Id(e)),o=s?t:e;if(Sd(i))kd(i,s?function(a,n){i[n]=e}:function(a,n){Rd(i,n)}),o&&$d(i,o);else if(Td(i)){if(s)for(r=i.length;r>0;)r--,i[r]=e;else i.length=0;o&&i.push.apply(i,o)}}return i}var Qo=Ld,Dd=Zo,Md=te,Ad=z,Nd=Z,Bd=ee,Hd=Jo,Fd=Qo,Kd=Be;function Pd(i){return function(e,t){return t===i}}function Yd(i,e,t){if(i){if(!Kd(e)){var r=[],s=[];return Md(e)||(e=Pd(e)),Nd(i,function(o,a,n){e.call(t,o,a,n)&&r.push(a)}),Ad(i)?Hd(r,function(o,a){s.push(i[o]),i.splice(o,1)}):(s={},Bd(r,function(o){s[o]=i[o],Dd(i,o)})),s}return Fd(i)}return i}var jo=Yd,Vd=Te,Zr=md,Wd=ur,Xd=lr,zd=Be,er=Z,Gd=jo,Ud=ne;function qd(i,e){er(i,function(t){t[e]&&!t[e].length&&Gd(t,e)})}function Zd(i,e){var t=Ud({},Vd.treeOptions,e),r=t.strict,s=t.key,o=t.parentKey,a=t.children,n=t.mapChildren,c=t.sortKey,d=t.reverse,u=t.data,f=[],g={},v={},p,m,x;return c&&(i=Wd(Xd(i),c),d&&(i=i.reverse())),er(i,function(C){p=C[s],v[p]&&Zr("warn","Duplicate primary key="+p),v[p]=!0}),er(i,function(C){p=C[s],u?(m={},m[u]=C):m=C,x=C[o],g[p]=g[p]||[],m[s]=p,m[o]=x,p===x&&(x=null,Zr("warn","Error infinite Loop. key="+p+" parentKey="+p)),g[x]=g[x]||[],g[x].push(m),m[a]=g[p],n&&(m[n]=g[p]),(!r||r&&zd(x))&&(v[x]||f.push(m))}),r&&qd(i,a),f}var Jd=Zd,Qd=Te,jd=ee,eu=ne;function ea(i,e,t,r){var s=r.key,o=r.parentKey,a=r.children,n=r.data,c=r.updated,d=r.clear;return jd(t,function(u){var f=u[a];n&&(u=u[n]),c!==!1&&(u[o]=e?e[s]:null),i.push(u),f&&f.length&&ea(i,u,f,r),d&&delete u[a]}),i}function tu(i,e){return ea([],null,i,eu({},Qd.treeOptions,e))}var iu=tu;function ru(i){return function(e,t,r,s){var o=r||{},a=o.children||"children";return i(null,e,t,s,[],[],a,o)}}var bi=ru,su=bi;function ta(i,e,t,r,s,o,a,n){if(e){var c,d,u,f,g,v;for(d=0,u=e.length;d<u;d++){if(c=e[d],f=s.concat([""+d]),g=o.concat([c]),t.call(r,c,d,e,f,i,g))return{index:d,item:c,path:f,items:e,parent:i,nodes:g};if(a&&c&&(v=ta(c,c[a],t,r,f.concat([a]),g,a),v))return v}}}var ou=su(ta),au=ou,nu=bi,lu=Z;function ia(i,e,t,r,s,o,a,n){var c,d;lu(e,function(u,f){c=s.concat([""+f]),d=o.concat([u]),t.call(r,u,f,e,c,i,d),u&&a&&(c.push(a),ia(u,u[a],t,r,c,d,a))})}var cu=nu(ia),ra=cu,hu=bi,du=rt;function sa(i,e,t,r,s,o,a,n){var c,d,u,f=n.mapChildren||a;return du(e,function(g,v){return c=s.concat([""+v]),d=o.concat([g]),u=t.call(r,g,v,e,c,i,d),u&&g&&a&&g[a]&&(u[f]=sa(g,g[a],t,r,c,d,a,n)),u})}var uu=hu(sa),fu=uu,gu=ra;function vu(i,e,t,r){var s=[];return i&&e&&gu(i,function(o,a,n,c,d,u){e.call(r,o,a,n,c,d,u)&&s.push(o)},t),s}var pu=vu,mu=bi,xu=ee,wu=ne;function oa(i,e,t,r,s,o,a,n,c){var d,u,f,g,v,p=[],m=c.original,x=c.data,C=c.mapChildren||n,_=c.isEvery;return xu(t,function(y,b){d=o.concat([""+b]),u=a.concat([y]),g=i&&!_||r.call(s,y,b,t,d,e,u),v=n&&y[n],g||v?(m?f=y:(f=wu({},y),x&&(f[x]=y)),f[C]=oa(g,y,y[n],r,s,d,u,n,c),(g||f[C].length)&&p.push(f)):g&&p.push(f)}),p}var yu=mu(function(i,e,t,r,s,o,a,n){return oa(0,i,e,t,r,s,o,a,n)}),Eu=yu;function Cu(i,e){if(i.indexOf)return i.indexOf(e);for(var t=0,r=i.length;t<r;t++)if(e===i[t])return t}var aa=Cu;function bu(i,e){if(i.lastIndexOf)return i.lastIndexOf(e);for(var t=i.length-1;t>=0;t--)if(e===i[t])return t;return-1}var na=bu,_u=gt,Ru=_u("number"),$e=Ru,Su=$e;function Iu(i){return Su(i)&&isNaN(i)}var Tu=Iu,Ou=gt,$u=Ou("string"),He=$u,ku=Bt,Lu=ku("Date"),Ue=Lu,Du=parseInt,Kt=Du;function Mu(i){return Date.UTC(i.y,i.M||0,i.d||1,i.H||0,i.m||0,i.s||0,i.S||0)}var Au=Mu;function Nu(i){return i.getTime()}var de=Nu,fi=Kt,Jr=Au,Bu=de,Hu=He,Fu=Ue;function Pt(i){return"(\\d{"+i+"})"}function Ku(i){return i<10?i*100:i<100?i*10:i}function Qr(i){return isNaN(i)?i:fi(i)}var at=Pt(2),lt=Pt("1,2"),la=Pt("1,7"),ca=Pt("3,4"),ha=".{1}",Tt=ha+lt,da="(([zZ])|([-+]\\d{2}:?\\d{2}))",jr=[ca,Tt,Tt,Tt,Tt,Tt,ha+la,da],tr=[];for(var Fi=jr.length-1;Fi>=0;Fi--){for(var es="",tt=0;tt<Fi+1;tt++)es+=jr[tt];tr.push(new RegExp("^"+es+"$"))}function Pu(i){for(var e,t={},r=0,s=tr.length;r<s;r++)if(e=i.match(tr[r]),e){t.y=e[1],t.M=e[2],t.d=e[3],t.H=e[4],t.m=e[5],t.s=e[6],t.S=e[7],t.Z=e[8];break}return t}var ts=[["yyyy",ca],["yy",at],["MM",at],["M",lt],["dd",at],["d",lt],["HH",at],["H",lt],["mm",at],["m",lt],["ss",at],["s",lt],["SSS",Pt(3)],["S",la],["Z",da]],ua={},fa=["\\[([^\\]]+)\\]"];for(var tt=0;tt<ts.length;tt++){var Ki=ts[tt];ua[Ki[0]]=Ki[1]+"?",fa.push(Ki[0])}var Yu=new RegExp(fa.join("|"),"g"),is={};function Vu(i,e){var t=is[e];if(!t){var r=[],s=e.replace(/([$(){}*+.?\\^|])/g,"\\$1").replace(Yu,function(u,f){var g=u.charAt(0);return g==="["?f:(r.push(g),ua[u])});t=is[e]={_i:r,_r:new RegExp(s)}}var o={},a=i.match(t._r);if(a){for(var n=t._i,c=1,d=a.length;c<d;c++)o[n[c-1]]=a[c];return o}return o}function Wu(i){if(/^[zZ]/.test(i.Z))return new Date(Jr(i));var e=i.Z.match(/([-+])(\d{2}):?(\d{2})/);return e?new Date(Jr(i)-(e[1]==="-"?-1:1)*fi(e[2])*36e5+fi(e[3])*6e4):new Date("")}function Xu(i,e){if(i){var t=Fu(i);if(t||!e&&/^[0-9]{11,15}$/.test(i))return new Date(t?Bu(i):fi(i));if(Hu(i)){var r=e?Vu(i,e):Pu(i);if(r.y)return r.M&&(r.M=Qr(r.M)-1),r.S&&(r.S=Ku(Qr(r.S.substring(0,3)))),r.Z?Wu(r):new Date(r.y,r.M||0,r.d||1,r.H||0,r.m||0,r.s||0,r.S||0)}}return new Date("")}var ie=Xu;function zu(){return new Date}var _i=zu,Gu=Ue,Uu=ie,qu=_i;function Zu(i){var e,t=i?Uu(i):qu();return Gu(t)?(e=t.getFullYear(),e%4===0&&(e%100!==0||e%400===0)):!1}var ga=Zu,Ju=z,Qu=we;function ju(i,e,t){if(i){if(Ju(i))for(var r=0,s=i.length;r<s&&e.call(t,i[r],r,i)!==!1;r++);else for(var o in i)if(Qu(i,o)&&e.call(t,i[o],o,i)===!1)break}}var ef=ju,tf=z,rf=we;function sf(i,e,t){if(i){var r,s;if(tf(i))for(r=i.length-1;r>=0&&e.call(t,i[r],r,i)!==!1;r--);else for(s=rf(i),r=s.length-1;r>=0&&e.call(t,i[s[r]],s[r],i)!==!1;r--);}}var of=sf,af=z,nf=He,lf=we;function cf(i,e){return function(t,r){if(t){if(t[i])return t[i](r);if(nf(t)||af(t))return e(t,r);for(var s in t)if(lf(t,s)&&r===t[s])return s}return-1}}var va=cf,hf=va,df=aa,uf=hf("indexOf",df),ff=uf,gf=va,vf=na,pf=gf("lastIndexOf",vf),pa=pf,mf=z,xf=He,wf=Z;function yf(i){var e=0;return xf(i)||mf(i)?i.length:(wf(i,function(){e++}),e)}var ma=yf,Ef=$e;function Cf(i){return Ef(i)&&isFinite(i)}var bf=Cf,_f=z,Rf=Ne,Sf=function(i){return!Rf(i)&&!isNaN(i)&&!_f(i)&&i%1===0},xa=Sf,If=z,Tf=xa,Of=Ne;function $f(i){return!Of(i)&&!isNaN(i)&&!If(i)&&!Tf(i)}var kf=$f,Lf=gt,Df=Lf("boolean"),wa=Df,Mf=Bt,Af=Mf("RegExp"),fr=Af,Nf=Bt,Bf=Nf("Error"),ya=Bf;function Hf(i){return i?i.constructor===TypeError:!1}var Ff=Hf;function Kf(i){for(var e in i)return!1;return!0}var Ea=Kf,Pf=ye,Yf=typeof Symbol!==Pf;function Vf(i){return Yf&&Symbol.isSymbol?Symbol.isSymbol(i):typeof i=="symbol"}var Ca=Vf,Wf=Bt,Xf=Wf("Arguments"),zf=Xf,Gf=He,Uf=$e;function qf(i){return!!(i&&Gf(i.nodeName)&&Uf(i.nodeType))}var Zf=qf,Jf=ye,Qf=typeof document===Jf?0:document,gr=Qf,jf=gr;function eg(i){return!!(i&&jf&&i.nodeType===9)}var tg=eg,ig=ye,rg=typeof window===ig?0:window,ba=rg,sg=ba;function og(i){return!!(sg&&(i&&i===i.window))}var ag=og,ng=ye,lg=typeof FormData!==ng;function cg(i){return lg&&i instanceof FormData}var hg=cg,dg=ye,ug=typeof Map!==dg;function fg(i){return ug&&i instanceof Map}var gg=fg,vg=ye,pg=typeof WeakMap!==vg;function mg(i){return pg&&i instanceof WeakMap}var xg=mg,wg=ye,yg=typeof Set!==wg;function Eg(i){return yg&&i instanceof Set}var Cg=Eg,bg=ye,_g=typeof WeakSet!==bg;function Rg(i){return _g&&i instanceof WeakSet}var Sg=Rg,Ig=te,Tg=He,Og=z,$g=we;function kg(i){return function(e,t,r){if(e&&Ig(t)){if(Og(e)||Tg(e))return i(e,t,r);for(var s in e)if($g(e,s)&&t.call(r,e[s],s,e))return s}return-1}}var _a=kg,Lg=_a,Dg=Lg(function(i,e,t){for(var r=0,s=i.length;r<s;r++)if(e.call(t,i[r],r,i))return r;return-1}),vr=Dg,rs=$e,ss=z,os=He,Mg=fr,Ag=Ue,Ng=wa,Bg=Oe,as=Ae,Hg=No;function Ra(i,e,t,r,s,o,a){if(i===e)return!0;if(i&&e&&!rs(i)&&!rs(e)&&!os(i)&&!os(e)){if(Mg(i))return t(""+i,""+e,s,o,a);if(Ag(i)||Ng(i))return t(+i,+e,s,o,a);var n,c,d,u=ss(i),f=ss(e);if(u||f?u&&f:i.constructor===e.constructor)return c=as(i),d=as(e),r&&(n=r(i,e,s)),c.length===d.length?Bg(n)?Hg(c,function(g,v){return g===d[v]&&Ra(i[g],e[d[v]],t,r,u||f?v:g,i,e)}):!!n:!1}return t(i,e,s,o,a)}var Sa=Ra;function Fg(i,e){return i===e}var Ia=Fg,Kg=Sa,Pg=Ia;function Yg(i,e){return Kg(i,e,Pg)}var Ta=Yg,ns=Ae,Vg=vr,ls=Ta,Wg=Ao,Xg=Bo;function zg(i,e){var t=ns(i),r=ns(e);if(r.length){if(Xg(t,r))return Wg(r,function(s){return Vg(t,function(o){return o===s&&ls(i[o],e[s])})>-1})}else return!0;return ls(i,e)}var Gg=zg,cs=Sa,hs=Ia,Ug=te,qg=Oe;function Zg(i,e,t){return Ug(t)?cs(i,e,function(r,s,o,a,n){var c=t(r,s,o,a,n);return qg(c)?hs(r,s):!!c},t):cs(i,e,hs)}var Jg=Zg,Qg=Ca,jg=Ue,ev=z,tv=fr,iv=ya,rv=Ne;function sv(i){return rv(i)?"null":Qg(i)?"symbol":jg(i)?"date":ev(i)?"array":tv(i)?"regexp":iv(i)?"error":typeof i}var ov=sv,av=Te,nv=Be;function lv(i){return""+(nv(i)?"":i)+av.keyId++}var cv=lv,hv=_a,dv=hv(function(i,e,t){for(var r=i.length-1;r>=0;r--)if(e.call(t,i[r],r,i))return r;return-1}),uv=dv,fv=pt,gv=He;function vv(i){if(fv(i))return i;if(gv(i))try{return JSON.parse(i)}catch{}return{}}var pv=vv,mv=Be;function xv(i){return mv(i)?"":JSON.stringify(i)}var wv=xv,yv=nr,Ev=yv("entries",2),Cv=Ev,bv=te,_v=z,Rv=Z,Sv=vr;function Iv(i,e){return function(t,r){var s,o,a={},n=[],c=this,d=arguments,u=d.length;if(!bv(r)){for(o=1;o<u;o++)s=d[o],n.push.apply(n,_v(s)?s:[s]);r=0}return Rv(t,function(f,g){((r?r.call(c,f,g,t):Sv(n,function(v){return v===g})>-1)?i:e)&&(a[g]=f)}),a}}var Oa=Iv,Tv=Oa,Ov=Tv(1,0),$v=Ov,kv=Oa,Lv=kv(0,1),Dv=Lv,Mv=xt;function Av(i){return Mv(i)[0]}var Nv=Av,Bv=xt;function Hv(i){var e=Bv(i);return e[e.length-1]}var Fv=Hv,Kv=Fo,Pv=dr,si=we;function Yv(i,e){if(i){if(si(i,e))return!0;var t,r,s,o,a,n,c=Pv(e),d=0,u=c.length;for(a=i;d<u&&(n=!1,t=c[d],o=t?t.match(Kv):"",o?(r=o[1],s=o[2],r?a[r]&&si(a[r],s)&&(n=!0,a=a[r][s]):si(a,s)&&(n=!0,a=a[s])):si(a,t)&&(n=!0,a=a[t]),n);d++)if(d===u-1)return!0}return!1}var Vv=Yv,ds=Kt,Wv=dr,Xv=Do,zv=we,us=/(.+)?\[(\d+)\]$/;function Gv(i,e,t,r,s){if(i[e])t&&(i[e]=s);else{var o,a,n=e?e.match(us):null;if(t)a=s;else{var c=r?r.match(us):null;c&&!c[1]?a=new Array(ds(c[2])+1):a={}}return n?n[1]?(o=ds(n[2]),i[n[1]]?t?i[n[1]][o]=a:i[n[1]][o]?a=i[n[1]][o]:i[n[1]][o]=a:(i[n[1]]=new Array(o+1),i[n[1]][o]=a)):i[n[2]]=a:i[e]=a,a}return i[e]}function Uv(i,e,t){if(i&&Xv(e)){if((i[e]||zv(i,e))&&!fs(e))i[e]=t;else for(var r=i,s=Wv(e),o=s.length,a=0;a<o;a++)if(!fs(s[a])){var n=a===o-1;r=Gv(r,s[a],n,n?null:s[a+1],t)}}return i}function fs(i){return i==="__proto__"||i==="constructor"||i==="prototype"}var qv=Uv,Zv=Ea,Jv=Ci,Qv=te,jv=vt,ep=Z;function tp(i){return function(){return Zv(i)}}function ip(i,e,t){var r,s={};return i&&(e&&Jv(e)?e=tp(e):Qv(e)||(e=jv(e)),ep(i,function(o,a){r=e?e.call(t,o,a,i):o,s[r]?s[r].push(o):s[r]=[o]})),s}var $a=ip,rp=$a,sp=Ht;function op(i,e,t){var r=rp(i,e,t||this);return sp(r,function(s,o){r[o]=s.length}),r}var ap=op;function np(i,e,t){var r,s,o=[],a=arguments;if(a.length<2&&(e=a[0],i=0),r=i>>0,s=e>>0,r<e)for(t=t>>0||1;r<s;r+=t)o.push(r);return o}var ka=np,gs=Ae,lp=ot,cp=mt,hp=ee,dp=ne;function up(i,e){if(i&&e){var t=dp.apply(this,[{}].concat(lp(arguments,1))),r=gs(t);hp(gs(i),function(s){cp(r,s)&&(i[s]=t[s])})}return i}var fp=up,gp=Xo,vp=gp(function(i,e){return i>e}),pp=vp;function mp(i){return(i.split(".")[1]||"").length}var Ri=mp,xp=Kt;function wp(i,e){if(i.repeat)return i.repeat(e);var t=isNaN(e)?[]:new Array(xp(e));return t.join(i)+(t.length>0?i:"")}var Yt=wp;function yp(i,e){return i.substring(0,e)+"."+i.substring(e,i.length)}var La=yp,oi=Yt,Pi=La;function Ep(i){var e=""+i,t=e.match(/^([-+]?)((\d+)|((\d+)?[.](\d+)?))e([-+]{1})([0-9]+)$/);if(t){var r=i<0,s=r?"-":"",o=t[3]||"",a=t[5]||"",n=t[6]||"",c=t[7],d=t[8],u=d-n.length,f=d-o.length,g=d-a.length;return c==="+"?o?s+o+oi("0",d):u>0?s+a+n+oi("0",u):s+a+Pi(n,d):o?f>0?s+"0."+oi("0",Math.abs(f))+o:s+Pi(o,f):g>0?s+"0."+oi("0",Math.abs(g))+a+n:s+Pi(a,g)+n}return e}var qe=Ep,vs=Ri,ps=qe;function Cp(i,e){var t=ps(i),r=ps(e);return parseInt(t.replace(".",""))*parseInt(r.replace(".",""))/Math.pow(10,vs(t)+vs(r))}var Da=Cp,bp=Da,ms=st,_p=qe;function Rp(i){return function(e,t){var r=ms(e),s=r;if(r){t=t>>0;var o=_p(r),a=o.split("."),n=a[0],c=a[1]||"",d=c.substring(0,t+1),u=n+(d?"."+d:"");if(t>=c.length)return ms(u);if(u=r,t>0){var f=Math.pow(10,t);s=Math[i](bp(u,f))/f}else s=Math[i](u)}return s}}var pr=Rp,Sp=pr,Ip=Sp("round"),mr=Ip,Tp=pr,Op=Tp("ceil"),Ma=Op,$p=pr,kp=$p("floor"),Aa=kp,Lp=Be,Dp=$e,Mp=qe;function Ap(i){return Dp(i)?Mp(i):""+(Lp(i)?"":i)}var re=Ap,Np=mr,Bp=re,Hp=Yt,Fp=La;function Kp(i,e){e=e>>0;var t=Bp(Np(i,e)),r=t.split("."),s=r[0],o=r[1]||"",a=e-o.length;return e?a>0?s+"."+o+Hp("0",a):s+Fp(o,Math.abs(a)):s}var xr=Kp,Pp=Te,Yp=mr,Vp=Ma,Wp=Aa,Xp=$e,zp=re,Gp=xr,Up=qe,qp=ne;function Zp(i,e){var t=qp({},Pp.commafyOptions,e),r=t.digits,s=Xp(i),o,a,n,c,d;return s?(o=(t.ceil?Vp:t.floor?Wp:Yp)(i,r),a=Up(r?Gp(o,r):o).split("."),c=a[0],d=a[1],n=c&&o<0,n&&(c=c.substring(1,c.length))):(o=zp(i).replace(/,/g,""),a=o?[o]:[],c=a[0]),a.length?(n?"-":"")+c.replace(new RegExp("(?=(?!(\\b))(.{"+(t.spaceNumber||3)+"})+$)","g"),t.separator||",")+(d?"."+d:""):o}var Jp=Zp,Qp=Kt,jp=Vo,em=jp(Qp),tm=em,im=Da,xs=st;function rm(i,e){var t=xs(i),r=xs(e);return im(t,r)}var wr=rm,ws=Ri,ys=qe,Es=wr;function sm(i,e){var t=ys(i),r=ys(e),s=Math.pow(10,Math.max(ws(t),ws(r)));return(Es(i,s)+Es(e,s))/s}var Na=sm,om=Na,Cs=st;function am(i,e){return om(Cs(i),Cs(e))}var nm=am,bs=Ri,_s=qe,Rs=st,lm=xr;function cm(i,e){var t=Rs(i),r=Rs(e),s=_s(t),o=_s(r),a=bs(s),n=bs(o),c=Math.pow(10,Math.max(a,n)),d=a>=n?a:n;return parseFloat(lm((t*c-r*c)/c,d))}var hm=cm,Ss=Ri,Is=qe,dm=wr;function um(i,e){var t=Is(i),r=Is(e),s=Ss(t),o=Ss(r),a=o-s,n=a<0,c=Math.pow(10,n?Math.abs(a):a);return dm(t.replace(".","")/r.replace(".",""),n?1/c:c)}var Ba=um,fm=Ba,Ts=st;function gm(i,e){return fm(Ts(i),Ts(e))}var vm=gm,Yi=Na,pm=te,mm=z,xm=Z,wm=Ft;function ym(i,e,t){var r=0;return xm(i&&i.length>2&&mm(i)?i.sort():i,e?pm(e)?function(){r=Yi(r,e.apply(t,arguments))}:function(s){r=Yi(r,wm(s,e))}:function(s){r=Yi(r,s)}),r}var Ha=ym,Em=Ba,Cm=ma,bm=Ha;function _m(i,e,t){return Em(bm(i,e,t),Cm(i))}var Rm=_m,Sm="first",Vt=Sm,Im="last",Si=Im;function Tm(i){return i.getFullYear()}var Wt=Tm,Om=864e5,wt=Om;function $m(i){return i.getMonth()}var Ii=$m,km=Ue,Lm=de;function Dm(i){return km(i)&&!isNaN(Lm(i))}var ue=Dm,Os=Vt,Mm=Si,Am=wt,Nm=Wt,$s=de,ks=Ii,Bm=ie,Hm=ue,Fm=$e;function Fa(i,e,t){var r=e&&!isNaN(e)?e:0;if(i=Bm(i),Hm(i)){if(t===Os)return new Date(Nm(i),ks(i)+r,1);if(t===Mm)return new Date($s(Fa(i,r+1,Os))-1);if(Fm(t)&&i.setDate(t),r){var s=i.getDate();if(i.setMonth(ks(i)+r),s!==i.getDate())return i.setDate(1),new Date($s(i)-Am)}}return i}var Xt=Fa,Km=Vt,Ls=Si,Ds=Wt,Pm=Xt,Ym=ie,Vm=ue;function Wm(i,e,t){var r;if(i=Ym(i),Vm(i)&&(e&&(r=e&&!isNaN(e)?e:0,i.setFullYear(Ds(i)+r)),t||!isNaN(t))){if(t===Km)return new Date(Ds(i),0,1);if(t===Ls)return i.setMonth(11),Pm(i,0,Ls);i.setMonth(t)}return i}var Ti=Wm,Xm=Xt,zm=ie,Gm=ue;function Um(i){var e=i.getMonth();return e<3?1:e<6?2:e<9?3:4}function qm(i,e,t){var r,s=e&&!isNaN(e)?e*3:0;return i=zm(i),Gm(i)?(r=(Um(i)-1)*3,i.setMonth(r),Xm(i,s,t)):i}var Zm=qm,Ms=Vt,Jm=Si,Qm=Kt,jm=Wt,ex=Ii,tx=de,ix=ie,rx=ue;function Ka(i,e,t){if(i=ix(i),rx(i)&&!isNaN(e)){if(i.setDate(i.getDate()+Qm(e)),t===Ms)return new Date(jm(i),ex(i),i.getDate());if(t===Jm)return new Date(tx(Ka(i,1,Ms))-1)}return i}var Pa=Ka;function sx(i){return i.toUpperCase()}var Ya=sx,ox=wt,ax=ox*7,Va=ax,nx=Te,Vi=wt,lx=Va,cx=de,hx=ie,dx=ue,As=$e;function ux(i,e,t,r){if(i=hx(i),dx(i)){var s=As(t),o=As(r),a=cx(i);if(s||o){var n=o?r:nx.firstDayOfWeek,c=i.getDay(),d=s?t:c;if(c!==d){var u=0;n>c?u=-(7-n+c):n<c&&(u=n-c),d>n?a+=((d===0?7:d)-n+u)*Vi:d<n?a+=(7-n+d+u)*Vi:a+=u*Vi}}return e&&!isNaN(e)&&(a+=e*lx),new Date(a)}return i}var Wa=ux,fx=Te,ai=wt,gx=Va,vx=$e,px=mt,mx=ie,xx=ue,Ns=Wa,wx=ka,yx=rt,ni=de,Ex=yx(wx(0,7),function(i){return[(i+1)%7,(i+2)%7,(i+3)%7]});function Bs(i,e){var t=new Date(i).getDay();return px(Ex[e],t)}function Cx(i,e){return function(t,r){var s=vx(r)?r:fx.firstDayOfWeek,o=mx(t);if(xx(o)){var a=Ns(o,0,s,s),n=i(a),c=ni(n),d=ni(a),u=d+ai*6,f=new Date(u),g=Ns(n,0,s,s),v=ni(g),p;if(d===v)return 1;if(e(a,f)){for(p=ni(i(f));p<u;p+=ai)if(Bs(p,s))return 1}var m=v+ai*6,x=new Date(u),C=1;if(e(g,x)){for(C=0,p=c;p<m;p+=ai)if(Bs(p,s)){C++;break}}return Math.floor((d-v)/gx)+C}return NaN}}var Xa=Cx,bx=Xa,_x=bx(function(i){return new Date(i.getFullYear(),0,1)},function(i,e){return i.getFullYear()!==e.getFullYear()}),za=_x,Rx=Wt,Sx=Ii;function Ix(i){return new Date(Rx(i),Sx(i),i.getDate())}var Tx=Ix,Ox=de,$x=Tx;function kx(i){return Ox($x(i))}var Lx=kx,Dx=wt,Mx=Vt,Hs=Lx,Ax=Ti,Nx=ie,Bx=ue;function Hx(i){return i=Nx(i),Bx(i)?Math.floor((Hs(i)-Hs(Ax(i,0,Mx)))/Dx)+1:NaN}var Ga=Hx,Fx=re,Kx=Oe,Px=Yt;function Yx(i,e,t){var r=Fx(i);return e=e>>0,t=Kx(t)?" ":""+t,r.padStart?r.padStart(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=Px(t,e/t.length)),t.slice(0,e)+r):r}var Ua=Yx,Ot=Te,Vx=Ya,Wx=Wt,Fs=Ii,Xx=ie,zx=za,Gx=Ga,Ux=ne,qx=ue,Zx=te,_e=Ua;function Ye(i,e,t,r){var s=e[t];return s?Zx(s)?s(r,t,i):s[r]:r}var Jx=/\[([^\]]+)]|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 Qx(i,e,t){if(i){if(i=Xx(i),qx(i)){var r=e||Ot.parseDateFormat||Ot.formatString,s=i.getHours(),o=s<12?"am":"pm",a=Ux({},Ot.parseDateRules||Ot.formatStringMatchs,t?t.formats:null),n=function(y,b){return(""+Wx(i)).substr(4-b)},c=function(y,b){return _e(Fs(i)+1,b,"0")},d=function(y,b){return _e(i.getDate(),b,"0")},u=function(y,b){return _e(s,b,"0")},f=function(y,b){return _e(s<=12?s:s-12,b,"0")},g=function(y,b){return _e(i.getMinutes(),b,"0")},v=function(y,b){return _e(i.getSeconds(),b,"0")},p=function(y,b){return _e(i.getMilliseconds(),b,"0")},m=function(y,b){var E=i.getTimezoneOffset()/60*-1;return Ye(i,a,y,(E>=0?"+":"-")+_e(E,2,"0")+(b===1?":":"")+"00")},x=function(y,b){return _e(Ye(i,a,y,zx(i,(t?t.firstDay:null)||Ot.firstDayOfWeek)),b,"0")},C=function(y,b){return _e(Ye(i,a,y,Gx(i)),b,"0")},_={yyyy:n,yy:n,MM:c,M:c,dd:d,d,HH:u,H:u,hh:f,h:f,mm:g,m:g,ss:v,s:v,SSS:p,S:p,ZZ:m,Z:m,WW:x,W:x,DDD:C,D:C,a:function(y){return Ye(i,a,y,o)},A:function(y){return Ye(i,a,y,Vx(o))},e:function(y){return Ye(i,a,y,i.getDay())},E:function(y){return Ye(i,a,y,i.getDay())},q:function(y){return Ye(i,a,y,Math.floor((Fs(i)+3)/3))}};return r.replace(Jx,function(y,b){return b||(_[y]?_[y](y,y.length):y)})}return"Invalid Date"}return""}var qa=Qx,jx=de,e1=_i,t1=Date.now||function(){return jx(e1())},Za=t1,i1=de,r1=Za,s1=ie,o1=Ue,a1=function(i,e){if(i){var t=s1(i,e);return o1(t)?i1(t):t}return r1()},n1=a1,Ks=qa;function l1(i,e,t){return i&&e?(i=Ks(i,t),i!=="Invalid Date"&&i===Ks(e,t)):!1}var c1=l1,h1=Xa,d1=h1(function(i){return new Date(i.getFullYear(),i.getMonth(),1)},function(i,e){return i.getMonth()!==e.getMonth()}),u1=d1,f1=Ti,g1=ie,v1=ue,p1=ga;function m1(i,e){return i=g1(i),v1(i)?p1(f1(i,e))?366:365:NaN}var x1=m1,w1=wt,y1=Vt,E1=Si,Ps=de,Ys=Xt,C1=ie,b1=ue;function _1(i,e){return i=C1(i),b1(i)?Math.floor((Ps(Ys(i,e,E1))-Ps(Ys(i,e,y1)))/w1)+1:NaN}var R1=_1,Vs=de,S1=_i,Ws=ie,Xs=ue,zs=[["yyyy",31536e6],["MM",2592e6],["dd",864e5],["HH",36e5],["mm",6e4],["ss",1e3],["S",0]];function I1(i,e){var t,r,s,o,a,n,c={done:!1,time:0};if(i=Ws(i),e=e?Ws(e):S1(),Xs(i)&&Xs(e)&&(t=Vs(i),r=Vs(e),t<r))for(o=c.time=r-t,c.done=!0,n=0,a=zs.length;n<a;n++)s=zs[n],o>=s[1]?n===a-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 T1=I1,O1=re,$1=Oe,k1=Yt;function L1(i,e,t){var r=O1(i);return e=e>>0,t=$1(t)?" ":""+t,r.padEnd?r.padEnd(e,t):e>r.length?(e-=r.length,e>t.length&&(t+=k1(t,e/t.length)),r+t.slice(0,e)):r}var D1=L1,M1=re,A1=Yt;function N1(i,e){return A1(M1(i),e)}var B1=N1,H1=re;function F1(i){return i&&i.trimRight?i.trimRight():H1(i).replace(/[\s\uFEFF\xA0]+$/g,"")}var Ja=F1,K1=re;function P1(i){return i&&i.trimLeft?i.trimLeft():K1(i).replace(/^[\s\uFEFF\xA0]+/g,"")}var Qa=P1,Y1=Ja,V1=Qa;function W1(i){return i&&i.trim?i.trim():Y1(V1(i))}var ja=W1,X1={"&":"&","<":"<",">":">",'"':""","'":"'","`":"`"},en=X1,z1=re,G1=Ae;function U1(i){var e=new RegExp("(?:"+G1(i).join("|")+")","g");return function(t){return z1(t).replace(e,function(r){return i[r]})}}var tn=U1,q1=en,Z1=tn,J1=Z1(q1),Q1=J1,Gs=en,j1=tn,e0=Z,rn={};e0(Gs,function(i,e){rn[Gs[e]]=e});var t0=j1(rn),i0=t0;function r0(i,e,t){return i.substring(e,t)}var sn=r0;function s0(i){return i.toLowerCase()}var on=s0,o0=re,Ve=sn,$t=Ya,a0=on,Wi={};function n0(i){if(i=o0(i),Wi[i])return Wi[i];var e=i.length,t=i.replace(/([-]+)/g,function(r,s,o){return o&&o+s.length<e?"-":""});return e=t.length,t=t.replace(/([A-Z]+)/g,function(r,s,o){var a=s.length;return s=a0(s),o?a>2&&o+a<e?$t(Ve(s,0,1))+Ve(s,1,a-1)+$t(Ve(s,a-1,a)):$t(Ve(s,0,1))+Ve(s,1,a):a>1&&o+a<e?Ve(s,0,a-1)+$t(Ve(s,a-1,a)):s}).replace(/(-[a-zA-Z])/g,function(r,s){return $t(Ve(s,1,s.length))}),Wi[i]=t,t}var l0=n0,c0=re,nt=sn,We=on,Xi={};function h0(i){if(i=c0(i),Xi[i])return Xi[i];if(/^[A-Z]+$/.test(i))return We(i);var e=i.replace(/^([a-z])([A-Z]+)([a-z]+)$/,function(t,r,s,o){var a=s.length;return a>1?r+"-"+We(nt(s,0,a-1))+"-"+We(nt(s,a-1,a))+o:We(r+"-"+s+o)}).replace(/^([A-Z]+)([a-z]+)?$/,function(t,r,s){var o=r.length;return We(nt(r,0,o-1)+"-"+nt(r,o-1,o)+(s||""))}).replace(/([a-z]?)([A-Z]+)([a-z]?)/g,function(t,r,s,o,a){var n=s.length;return n>1&&(r&&(r+="-"),o)?(r||"")+We(nt(s,0,n-1))+"-"+We(nt(s,n-1,n))+o:(r||"")+(a?"-":"")+We(s)+(o||"")});return e=e.replace(/([-]+)/g,function(t,r,s){return s&&s+r.length<e.length?"-":""}),Xi[i]=e,e}var d0=h0,u0=re;function f0(i,e,t){var r=u0(i);return(arguments.length===1?r:r.substring(t)).indexOf(e)===0}var g0=f0,v0=re;function p0(i,e,t){var r=v0(i),s=arguments.length;return s>1&&(s>2?r.substring(0,t).indexOf(e)===t-1:r.indexOf(e)===r.length-1)}var m0=p0,x0=Te,w0=re,y0=ja,E0=Ft;function C0(i,e,t){return w0(i).replace((t||x0).tmplRE||/\{{2}([.\w[\]\s]+)\}{2}/g,function(r,s){return E0(e,y0(s))})}var an=C0,b0=an;function _0(i,e){return b0(i,e,{tmplRE:/\{([.\w[\]\s]+)\}/g})}var R0=_0;function S0(){}var I0=S0,Us=ot;function T0(i,e){var t=Us(arguments,2);return function(){return i.apply(e,Us(arguments).concat(t))}}var O0=T0,qs=ot;function $0(i,e){var t=!1,r=null,s=qs(arguments,2);return function(){return t||(r=i.apply(e,qs(arguments).concat(s)),t=!0),r}}var k0=$0,L0=ot;function D0(i,e,t){var r=0,s=[];return function(){var o=arguments;r++,r<=i&&s.push(o[0]),r>=i&&e.apply(t,[s].concat(L0(o)))}}var M0=D0,A0=ot;function N0(i,e,t){var r=0,s=[];return t=t||this,function(){var o=arguments;r++,r<i&&(s.push(o[0]),e.apply(t,[s].concat(A0(o))))}}var B0=N0,H0=ne;function F0(i,e,t){var r=null,s=null,o=!1,a=null,n=H0({leading:!0,trailing:!0},t),c=n.leading,d=n.trailing,u=function(){r=null,s=null},f=function(){o=!0,i.apply(s,r),a=setTimeout(g,e),u()},g=function(){if(a=null,o){u();return}if(d===!0){f();return}u()},v=function(){var m=a!==null;return m&&clearTimeout(a),u(),a=null,o=!1,m},p=function(){if(r=arguments,s=this,o=!1,a===null&&c===!0){f();return}d===!0&&(a=setTimeout(g,e))};return p.cancel=v,p}var K0=F0,P0=ne;function Y0(i,e,t){var r=null,s=null,o=typeof t=="boolean"?{leading:t,trailing:!t}:P0({leading:!1,trailing:!0},t),a=!1,n=null,c=o.leading,d=o.trailing,u=function(){r=null,s=null},f=function(){a=!0,i.apply(s,r),u()},g=function(){if(c===!0&&(n=null),a){u();return}if(d===!0){f();return}u()},v=function(){var m=n!==null;return m&&clearTimeout(n),u(),n=null,a=!1,m},p=function(){a=!1,r=arguments,s=this,n===null?c===!0&&f():clearTimeout(n),n=setTimeout(g,e)};return p.cancel=v,p}var V0=Y0,W0=ot;function X0(i,e){var t=W0(arguments,2),r=this;return setTimeout(function(){i.apply(r,t)},e)}var z0=X0,G0=decodeURIComponent,nn=G0,Zs=nn,U0=ee,q0=He;function Z0(i){var e,t={};return i&&q0(i)&&U0(i.split("&"),function(r){e=r.split("="),t[Zs(e[0])]=Zs(e[1]||"")}),t}var ln=Z0,J0=encodeURIComponent,cn=J0,gi=cn,hn=Z,dn=z,un=Ne,Q0=Oe,fn=pt;function gn(i,e,t){var r,s=[];return hn(i,function(o,a){r=dn(o),fn(o)||r?s=s.concat(gn(o,e+"["+a+"]",r)):s.push(gi(e+"["+(t?"":a)+"]")+"="+gi(un(o)?"":o))}),s}function j0(i){var e,t=[];return hn(i,function(r,s){Q0(r)||(e=dn(r),fn(r)||e?t=t.concat(gn(r,s,e)):t.push(gi(s)+"="+gi(un(r)?"":r)))}),t.join("&").replace(/%20/g,"+")}var ew=j0,tw=ye,iw=typeof location===tw?0:location,Oi=iw,li=Oi;function rw(){return li?li.origin||li.protocol+"//"+li.host:""}var vn=rw,Js=Oi,sw=ln,ow=vn;function Qs(i){return sw(i.split("?")[1]||"")}function aw(i){var e,t,r,s,o=""+i;return o.indexOf("//")===0?o=(Js?Js.protocol:"")+o:o.indexOf("/")===0&&(o=ow()+o),r=o.replace(/#.*/,"").match(/(\?.*)/),s={href:o,hash:"",host:"",hostname:"",protocol:"",port:"",search:r&&r[1]&&r[1].length>1?r[1]:""},s.path=o.replace(/^([a-z0-9.+-]*:)\/\//,function(a,n){return s.protocol=n,""}).replace(/^([a-z0-9.+-]*)(:\d+)?\/?/,function(a,n,c){return t=c||"",s.port=t.replace(":",""),s.hostname=n,s.host=n+t,"/"}).replace(/(#.*)/,function(a,n){return s.hash=n.length>1?n:"",""}),e=s.hash.match(/#((.*)\?|(.*))/),s.pathname=s.path.replace(/(\?|#.*).*/,""),s.origin=s.protocol+"//"+s.host,s.hashKey=e&&(e[2]||e[1])||"",s.hashQuery=Qs(s.hash),s.searchQuery=Qs(s.search),s}var pn=aw,js=Oi,nw=vn,lw=pa;function cw(){if(js){var i=js.pathname,e=lw(i,"/")+1;return nw()+(e===i.length?i:i.substring(0,e))}return""}var hw=cw,eo=Oi,dw=pn;function uw(){return eo?dw(eo.href):{}}var fw=uw,mn=Te,zi=gr,to=nn,io=cn,gw=z,ro=Ci,xn=Ue,vw=Oe,pw=mt,mw=Ae,vi=ne,Gi=ee,xw=_i,ci=de,ww=Ti,yw=Xt,Ew=Pa;function so(i,e){var t=parseFloat(e),r=xw(),s=ci(r);switch(i){case"y":return ci(ww(r,t));case"M":return ci(yw(r,t));case"d":return ci(Ew(r,t));case"h":case"H":return s+t*60*60*1e3;case"m":return s+t*60*1e3;case"s":return s+t*1e3}return s}function Ui(i){return(xn(i)?i:new Date(i)).toUTCString()}function ze(i,e,t){if(zi){var r,s,o,a,n,c,d=[],u=arguments;return gw(i)?d=i:u.length>1?d=[vi({name:i,value:e},t)]:ro(i)&&(d=[i]),d.length>0?(Gi(d,function(f){r=vi({},mn.cookies,f),o=[],r.name&&(s=r.expires,o.push(io(r.name)+"="+io(ro(r.value)?JSON.stringify(r.value):r.value)),s&&(isNaN(s)?s=s.replace(/^([0-9]+)(y|M|d|H|h|m|s)$/,function(g,v,p){return Ui(so(p,v))}):/^[0-9]{11,13}$/.test(s)||xn(s)?s=Ui(s):s=Ui(so("d",s)),r.expires=s),Gi(["expires","path","domain","secure"],function(g){vw(r[g])||o.push(r[g]&&g==="secure"?g:g+"="+r[g])})),zi.cookie=o.join("; ")}),!0):(a={},n=zi.cookie,n&&Gi(n.split("; "),function(f){c=f.indexOf("="),a[to(f.substring(0,c))]=to(f.substring(c+1)||"")}),u.length===1?a[i]:a)}return!1}function Cw(i){return pw(wn(),i)}function oo(i){return ze(i)}function ao(i,e,t){return ze(i,e,t),ze}function no(i,e){ze(i,"",vi({expires:-1},mn.cookies,e))}function wn(){return mw(ze())}function bw(){return ze()}vi(ze,{has:Cw,set:ao,setItem:ao,get:oo,getItem:oo,remove:no,removeItem:no,keys:wn,getJSON:bw});var _w=ze,Rw=ye,qi=gr,Zi=ba,Sw=ne,Iw=ee;function lo(i){try{var e="__xe_t";return i.setItem(e,1),i.removeItem(e),!0}catch{return!1}}function hi(i){return navigator.userAgent.indexOf(i)>-1}function Tw(){var i,e,t,r=!1,s=!1,o=!1,a={isNode:!1,isMobile:r,isPC:!1,isDoc:!!qi};if(!Zi&&typeof process!==Rw)a.isNode=!0;else{t=hi("Edge"),e=hi("Chrome"),r=/(Android|webOS|iPhone|iPad|iPod|SymbianOS|BlackBerry|Windows Phone)/.test(navigator.userAgent),a.isDoc&&(i=qi.body||qi.documentElement,Iw(["webkit","khtml","moz","ms","o"],function(n){a["-"+n]=!!i[n+"MatchesSelector"]}));try{s=lo(Zi.localStorage)}catch{}try{o=lo(Zi.sessionStorage)}catch{}Sw(a,{edge:t,firefox:hi("Firefox"),msie:!t&&a["-ms"],safari:!e&&!t&&hi("Safari"),isMobile:r,isPC:!r,isLocalStorage:s,isSessionStorage:o})}return a}var Ow=Tw,yn=Vl,co=ne,$w=Ht,kw=Lo,Lw=tc,Dw=lc,Mw=rt,Aw=Ao,Nw=No,Bw=Bo,Hw=ee,Fw=cr,Kw=Ho,Pw=$c,Yw=hr,Vw=nh,Ww=ur,Xw=Yo,zw=ph,Gw=ot,Uw=bh,qw=Sh,Zw=mt,Jw=Oh,Qw=Dh,jw=Nh,ey=Fh,ty=Yh,iy=rd,ry=Go,sy=nd,oy=hd,ay=Wo,ny=vd,ly=Jd,cy=iu,hy=au,dy=ra,uy=fu,fy=pu,gy=Eu,vy=aa,py=na,my=we,xy=z,wy=Ne,yy=Tu,Ey=Oe,Cy=te,by=Ci,_y=He,Ry=pt,Sy=ga,Iy=Ue,Ty=Be,Oy=Z,$y=ef,ky=of,Ly=ff,Dy=pa,My=Ae,Ay=xt,Ny=lr,By=ma,Hy=Jo,Fy=jo,Ky=Qo,Py=bf,Yy=kf,Vy=xa,Wy=wa,Xy=$e,zy=fr,Gy=ya,Uy=Ff,qy=Ea,Zy=Ca,Jy=zf,Qy=Zf,jy=tg,e2=ag,t2=hg,i2=gg,r2=xg,s2=Cg,o2=Sg,a2=Gg,n2=Ta,l2=Jg,c2=ov,h2=cv,d2=vr,u2=uv,f2=pv,g2=wv,v2=Cv,p2=$v,m2=Dv,x2=Nv,w2=Fv,y2=Vv,E2=Ft,C2=qv,b2=$a,_2=ap,R2=ka,S2=fp,I2=Po,T2=zo,O2=pp,$2=Jp,k2=mr,L2=Ma,D2=Aa,M2=xr,A2=tm,N2=st,B2=qe,H2=nm,F2=hm,K2=wr,P2=vm,Y2=Ha,V2=Rm,W2=Ti,X2=Zm,z2=Xt,G2=Pa,U2=ie,q2=qa,Z2=Za,J2=n1,Q2=ue,j2=c1,eE=Wa,tE=Ga,iE=za,rE=u1,sE=x1,oE=R1,aE=T1,nE=D1,lE=Ua,cE=B1,hE=ja,dE=Ja,uE=Qa,fE=Q1,gE=i0,vE=l0,pE=d0,mE=g0,xE=m0,wE=an,yE=R0,ho=re,EE=I0,CE=vt,bE=O0,_E=k0,RE=M0,SE=B0,IE=K0,TE=V0,OE=z0,$E=ln,kE=ew,LE=pn,DE=hw,ME=fw,AE=_w,NE=Ow;co(yn,{assign:co,objectEach:$w,lastObjectEach:kw,objectMap:Lw,merge:Dw,uniq:Kw,union:Pw,sortBy:Vw,orderBy:Ww,shuffle:Xw,sample:zw,some:Aw,every:Nw,slice:Gw,filter:Uw,find:Jw,findLast:Qw,findKey:qw,includes:Zw,arrayIndexOf:vy,arrayLastIndexOf:py,map:Mw,reduce:jw,copyWithin:ey,chunk:ty,zip:iy,unzip:ry,zipObject:sy,flatten:oy,toArray:Yw,includeArrays:Bw,pluck:ay,invoke:ny,arrayEach:Hw,lastArrayEach:Fw,toArrayTree:ly,toTreeArray:cy,findTree:hy,eachTree:dy,mapTree:uy,filterTree:fy,searchTree:gy,hasOwnProp:my,eqNull:Ty,isNaN:yy,isFinite:Py,isUndefined:Ey,isArray:xy,isFloat:Yy,isInteger:Vy,isFunction:Cy,isBoolean:Wy,isString:_y,isNumber:Xy,isRegExp:zy,isObject:by,isPlainObject:Ry,isDate:Iy,isError:Gy,isTypeError:Uy,isEmpty:qy,isNull:wy,isSymbol:Zy,isArguments:Jy,isElement:Qy,isDocument:jy,isWindow:e2,isFormData:t2,isMap:i2,isWeakMap:r2,isSet:s2,isWeakSet:o2,isLeapYear:Sy,isMatch:a2,isEqual:n2,isEqualWith:l2,getType:c2,uniqueId:h2,getSize:By,indexOf:Ly,lastIndexOf:Dy,findIndexOf:d2,findLastIndexOf:u2,toStringJSON:f2,toJSONString:g2,keys:My,values:Ay,entries:v2,pick:p2,omit:m2,first:x2,last:w2,each:Oy,forOf:$y,lastForOf:ky,lastEach:Hy,has:y2,get:E2,set:C2,groupBy:b2,countBy:_2,clone:Ny,clear:Ky,remove:Fy,range:R2,destructuring:S2,random:I2,min:O2,max:T2,commafy:$2,round:k2,ceil:L2,floor:D2,toFixed:M2,toNumber:N2,toNumberString:B2,toInteger:A2,add:H2,subtract:F2,multiply:K2,divide:P2,sum:Y2,mean:V2,now:Z2,timestamp:J2,isValidDate:Q2,isDateSame:j2,toStringDate:U2,toDateString:q2,getWhatYear:W2,getWhatQuarter:X2,getWhatMonth:z2,getWhatWeek:eE,getWhatDay:G2,getYearDay:tE,getYearWeek:iE,getMonthWeek:rE,getDayOfYear:sE,getDayOfMonth:oE,getDateDiff:aE,trim:hE,trimLeft:uE,trimRight:dE,escape:fE,unescape:gE,camelCase:vE,kebabCase:pE,repeat:cE,padStart:lE,padEnd:nE,startsWith:mE,endsWith:xE,template:wE,toFormatString:yE,toString:ho,toValueString:ho,noop:EE,property:CE,bind:bE,once:_E,after:RE,before:SE,throttle:IE,debounce:TE,delay:OE,unserialize:$E,serialize:kE,parseUrl:LE,getBaseURL:DE,locat:ME,browse:NE,cookie:AE});var R=yn,j=[];for(var Ji=0;Ji<256;++Ji)j.push((Ji+256).toString(16).slice(1));function BE(i,e=0){return(j[i[e+0]]+j[i[e+1]]+j[i[e+2]]+j[i[e+3]]+"-"+j[i[e+4]]+j[i[e+5]]+"-"+j[i[e+6]]+j[i[e+7]]+"-"+j[i[e+8]]+j[i[e+9]]+"-"+j[i[e+10]]+j[i[e+11]]+j[i[e+12]]+j[i[e+13]]+j[i[e+14]]+j[i[e+15]]).toLowerCase()}var di,HE=new Uint8Array(16);function FE(){if(!di&&(di=typeof crypto<"u"&&crypto.getRandomValues&&crypto.getRandomValues.bind(crypto),!di))throw new Error("crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported");return di(HE)}var KE=typeof crypto<"u"&&crypto.randomUUID&&crypto.randomUUID.bind(crypto);const uo={randomUUID:KE};function Me(i,e,t){if(uo.randomUUID&&!i)return uo.randomUUID();i=i||{};var r=i.random||(i.rng||FE)();return r[6]=r[6]&15|64,r[8]=r[8]&63|128,BE(r)}const PE=i=>i==null||i==="",q=i=>!PE(i),et=i=>i==null,ce=i=>!et(i),YE=i=>function(e,t,r,s){const o=r||{},a=o.children||"children";return i(null,e,t,s,[],[],a,o)},En=(i,e,t,r,s,o,a)=>{let n,c;e.forEach((d,u)=>{n=s.concat([""+u]),c=o.concat([d]),t.call(r,d,u,e,n,i,c),d&&a&&(n.push(a),En(d,d[a]||[],t,r,n,c,a))})},Lt=YE(En),Cn={form:{labelCol:{span:6},wrapperCol:{span:16}},grid:{align:"left",lazyReset:!1,fitHeight:170},canvasTable:{DISABLED:!0}};let he=R.clone(Cn,!0);function bn(i){he={form:{...he.form,...i.form},grid:{...he.grid,...i.grid},canvasTable:{...he.canvasTable,...i.canvasTable}}}function VE(){return he}function WE(){var i,e;return{labelCol:(i=he.form)==null?void 0:i.labelCol,wrapperCol:(e=he.form)==null?void 0:e.wrapperCol}}function _n(){var i,e,t;return{align:(i=he.grid)==null?void 0:i.align,lazyReset:(e=he.grid)==null?void 0:e.lazyReset,fitHeight:(t=he.grid)==null?void 0:t.fitHeight}}function Rn(){return he.canvasTable||{}}function XE(){he=JSON.parse(JSON.stringify(Cn))}const $i=i=>{var e;return{dataIndex:i.field,key:i.field,title:i.title,...R.omit(i,["children","slots","cellRender","formatter"]),children:(e=i.children)==null?void 0:e.map(t=>$i(t))}},yr={xs:24,sm:24,md:12,lg:8,xl:8,xxl:6},Er={xs:12,sm:5,md:6,lg:6,xl:5,xxl:4},zE={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}},Sn=i=>{const t=(24-i.reduce((s,o)=>s+o,0))%24,r=t===0?24:t<0?24+t:t;return r>1?r:24},fo=["xxs","xs","sm","md","lg","xl","xxl"],GE=i=>{const e=R.isArray(i)?i:R.isNumber(i)?Array.from({length:i},()=>yr):[];return R.zipObject(fo,fo.map(t=>e.every(r=>q(r[t]))?Sn(e.map(r=>r[t])):24))};function Cr(i,e,t){const r=l.toValue(i);if(typeof r!="object"||r===null)return l.watch(i,e,t);let s=R.clone(r,!0);return l.watch(i,(o,a,n)=>{e(o,s,n),s=R.clone(o,!0)},t)}const je="-",ct={toString:({cellValue:i})=>{var e;return i?((e=i.toString)==null?void 0:e.call(i))??je:je},formatByOptions:({cellValue:i},e,t=",")=>{if(i==null)return je;if(R.isArray(i))if(i.length>0){const s=e.filter(o=>i.includes(o.value));return s.length?s.map(o=>o.label).join(t):je}else return je;const r=e.find(s=>s.value===i);return r?r.label:je},formatSex:({cellValue:i})=>q(i)?R.toNumber(i)===1?"男":"女":je},UE=(i,{record:e,index:t,column:r,field:s})=>{if(R.isString(i)&&ct[i]){const o=ct[i];return o({row:e,rowIndex:t,cellValue:s?e[s]:null})}else if(R.isArray(i)&&ct[i[0]]&&i.length>1){const o=ct[i[0]];return o({row:e,rowIndex:t,cellValue:s?e[s]:null},...i.slice(1))}else return R.isFunction(i)?i({row:e,rowIndex:t,cellValue:s?e[s]:null,column:r}):s?e[s]:null},In=i=>{Object.assign(ct,i)},qE=l.defineComponent(i=>{const{cellRender:e,renderTableParams:t}=i,{data:r,row:s,field:o,rowIndex:a}=t;return()=>{var n,c;return((c=(n=Dt.renders[e.name])==null?void 0:n.renderDefault)==null?void 0:c.call(n,e,{data:r,row:s,field:o,rowIndex:a},i.defaultHandler))??null}},{name:"RenderAntCell",props:["cellRender","renderTableParams","defaultHandler"]}),Tn=l.defineComponent(i=>{const{tableData:e,row:t,column:r,rowIndex:s}=i,o=r.field?t[r.field]:null;return()=>{var a,n;return((n=(a=r.slots)==null?void 0:a.default)==null?void 0:n.call(a,{row:t,column:r,rowIndex:s,cellValue:o}))??(r.cellRender?l.createVNode(qE,{cellRender:r.cellRender,defaultHandler:i.defaultHandler,renderTableParams:{data:e,row:t,field:r.field,rowIndex:s}},null):r.formatter?UE(r.formatter,{record:t,index:s,field:r.field,column:r}):o)}},{name:"RenderAntDefaultCell",props:["tableData","row","column","rowIndex","defaultHandler"]}),ZE={class:"text-right mt-4px"},JE=l.defineComponent({__name:"TableInput",props:{modelValue:{type:Array,default:()=>[]},tableConfig:{type:Object,default:()=>({})},editColumns:{type:Array,default:()=>[]}},emits:["update:modelValue","trigger"],setup(i,{emit:e}){const t=i,r={size:"small",pagination:!1};l.watch(()=>t.modelValue,()=>{o("trigger")},{deep:!0});const s=l.computed(()=>R.merge({},r,t.tableConfig)),o=e,a=l.computed({get:()=>t.modelValue??[],set:f=>{o("update:modelValue",f)}}),n=l.computed(()=>[...t.editColumns,{title:"操作",fixed:"right",width:100,cellRender:{name:"ButtonTree",children:[{content:"删除",type:"link",danger:!0,clickEvt:({rowIndex:f})=>d(f)}]}}]),c=()=>{a.value=[...a.value,{}]},d=f=>{a.value=a.value.filter((g,v)=>v!==f)},u=l.computed(()=>{let f=0;return n.value.filter(g=>g.slots&&g.slots.default||g.formatter||g.cellRender?(g.field||(g.field="__holder__"+f,f++),!0):!1)});return(f,g)=>{const v=l.resolveComponent("a-form-item-rest"),p=l.resolveComponent("a-table"),m=l.resolveComponent("a-button");return l.openBlock(),l.createElementBlock("div",null,[l.createVNode(p,l.mergeProps({"data-source":a.value},s.value,{columns:n.value.map(x=>l.unref($i)(x))}),l.createSlots({_:2},[u.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:x,record:C,index:_})=>[l.createVNode(v,null,{default:l.withCtx(()=>[u.value.some(y=>x.key&&y.field===x.key)?(l.openBlock(),l.createBlock(l.unref(Tn),{key:_,"row-index":_,"default-handler":{},column:u.value.find(y=>x.key&&y.field===x.key),row:C,"table-data":a.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",ZE,[l.createVNode(m,{type:"primary",onClick:c},{default:l.withCtx(()=>g[0]||(g[0]=[l.createTextVNode("+添加",-1)])),_:1,__:[0]})])])}}}),oe=i=>{const{icon:e}=i,t=al;return t[e]?l.createVNode(t[e]):t[e]},kt={AInput:{autocomplete:"off"},$input:{autocomplete:"off",allowClear:!0},AInputNumber:{min:0,controls:!1,precision:0},$number:{min:0,controls:!1,precision:0},$date:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ADatePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$range:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},ARangePicker:{format:"YYYY-MM-DD",valueFormat:"YYYY-MM-DD"},$select:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())},ASelect:{getPopupContainer:i=>i.parentNode,allowClear:!0,showSearch:!0,filterOption:(i,e)=>e.label&&e.label.toLowerCase().includes(i.toLowerCase())}},ui={PercentInput:{controls:!1,min:0,max:100,addonAfter:"%"},autoComplete:{inputProps:{}}},On={$input:L.Input,AInput:L.Input,$textarea:L.Textarea,Textarea:L.Textarea,$number:L.InputNumber,AInputNumber:L.InputNumber,$select:L.Select,ASelect:L.Select,$date:L.DatePicker,ADatePicker:L.DatePicker,$range:L.RangePicker,ARangePicker:L.RangePicker,AAutoComplete:L.AutoComplete,$Cascader:L.Cascader,ACascader:L.Cascader,ACheckbox:L.Checkbox,AMentions:L.Mentions,ARate:L.Rate,ASlider:L.Slider,$time:L.TimePicker,ATimePicker:L.TimePicker,ATreeSelect:L.TreeSelect},QE=i=>{const e=On[i];return{renderItemContent({props:t={},attrs:r={},events:s={},defaultValue:o},{data:a,field:n}){return ce(o)&&q(n)&&et(a[n])&&(a[n]=o),n?l.createVNode(e,l.mergeProps({is:i,value:a[n],"onUpdate:value":c=>a[n]=c},r,R.merge({},kt[i],t),{onChange:(...c)=>{var d;(d=s.change)==null||d.call(s,{data:a,field:n},...c)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderDefault({props:t=kt[i]??{},attrs:r={},events:s={},defaultValue:o},{data:a,row:n,field:c}){return ce(o)&&q(c)&&et(n[c])&&(n[c]=o),c?l.createVNode(e,l.mergeProps({is:i,value:n[c],"onUpdate:value":d=>n[c]=d},r,R.merge({},kt[i],t),{onChange:(...d)=>{var u;(u=s.change)==null||u.call(s,{data:a,row:n,field:c},...d)}}),null):l.createVNode(e,l.mergeProps({is:i},t),null)},renderEdit(t,{props:r=kt[i]??{},attrs:s={},events:o={}},a,n){return l.createVNode(e,l.mergeProps({is:i,value:t.value,"onUpdate:value":c=>t.value=c},s,R.merge({},kt[i],r),{onBlur:(...c)=>{var d;n==null||n("blur",t.value),(d=o.blur)==null||d.call(o,a,...c)}}),null)}}},$n=(i,e,t)=>{var r;return i.dropdowns&&i.dropdowns.length>0&&i.dropdowns.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,e))}).length>0?l.createVNode(L.Dropdown,{getPopupContainer:t??(()=>document.querySelector(".p-wrapper"))},{default:()=>l.createVNode(L.Button,l.mergeProps(R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):l.createVNode(oe,{icon:"DownOutlined"},null)}),{default:()=>{var s;return[i.content||(((s=i==null?void 0:i.getContent)==null?void 0:s.call(i,e))??"")]}}),overlay:()=>{var s;return l.createVNode("div",{class:`dropdown-wrapper ${((s=i==null?void 0:i.dynamicClassName)==null?void 0:s.call(i,e))??""}`},[i.dropdowns.filter(o=>{var a;return!((a=o.hiddenIf)!=null&&a.call(o,e))}).map(o=>$n(o,e,t))])}}):l.createVNode(L.Button,l.mergeProps({class:((r=i==null?void 0:i.dynamicClassName)==null?void 0:r.call(i,e))||""},R.omit(i,["dynamicClassName","content","getContent","icon","clickEvt","dropdowns"]),{disabled:!!i.dropdowns&&i.dropdowns.length>0||i.disabled,icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{i!=null&&i.clickEvt&&i.clickEvt(e)}}),{default:()=>{var s;return[i.content||(((s=i==null?void 0:i.getContent)==null?void 0:s.call(i,e))??"")]}})},ir={...Object.fromEntries(Object.keys(On).map(i=>[i,QE(i)])),$button:{renderItemContent({props:i={},events:e={}},{data:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o;(o=e.click)==null||o.call(e,{data:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(a=>{s.reset(a?{data:a,field:r}:{data:t,field:r})}):s.reset({data:t,field:r}))}}),{default:()=>{var o;return[i.content,((o=i.suffix)==null?void 0:o.call(i,{data:t,field:r}))??null]}})},renderDefault({props:i={},events:e={}},{row:t,field:r},s){return l.createVNode(L.Button,l.mergeProps(R.omit(i,["content"]),{icon:i.icon?l.createVNode(oe,{icon:i.icon},null):null,onClick:()=>{var o,a,n;(o=e.click)==null||o.call(e,{row:t,field:r}),i.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((a=s==null?void 0:s.setLoadings)==null||a.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.reset(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.reset({row:t,field:r})),i.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((n=s==null?void 0:s.setLoadings)==null||n.call(s,!0),i.beforeClick({row:t,field:r}).then(c=>{s.pick(c?{row:c,field:r}:{row:t,field:r})}).finally(()=>{var c;(c=s==null?void 0:s.setLoadings)==null||c.call(s,!1)})):s.pick({row:t,field:r}))}}),{default:()=>[i.content]})}},$buttons:{renderItemContent({props:i={},children:e=[]},{data:t,field:r},s){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.map(o=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,o.props),["content"]),{icon:o.props.icon?l.createVNode(oe,{icon:o.props.icon},null):null,onClick:()=>{var a,n;(n=(a=o.events)==null?void 0:a.click)==null||n.call(a,{data:t,field:r}),o.props.htmlType==="reset"&&(s!=null&&s.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.reset(c?{data:c,field:r}:{data:t,field:r})}):s.reset({data:t,field:r})),o.props.htmlType==="pick"&&(s!=null&&s.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?i.beforeClick({data:t,field:r}).then(c=>{s.pick(c?{data:c,field:r}:{data:t,field:r})}):s.pick({data:t,field:r}))}}),{default:()=>[o.props.content]}))])},renderDefault({props:i={},children:e=[]},{data:t,row:r,field:s},o){return l.createVNode("span",{class:"align-gap-box w-fit"},[e.filter(a=>{var n,c;return!((c=(n=a==null?void 0:a.props)==null?void 0:n.hiddenIf)!=null&&c.call(n,{data:t,row:r,field:s}))}).map(a=>l.createVNode(L.Button,l.mergeProps(R.omit(Object.assign({},i,a.props),["content","hiddenIf"]),{icon:a.props.icon?l.createVNode(oe,{icon:a.props.icon},null):null,onClick:()=>{var n,c,d,u;(c=(n=a.events)==null?void 0:n.click)==null||c.call(n,{data:t,row:r,field:s}),a.props.htmlType==="reset"&&(o!=null&&o.reset)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((d=o==null?void 0:o.setLoadings)==null||d.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.reset(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.reset({row:r,field:s})),a.props.htmlType==="pick"&&(o!=null&&o.pick)&&(i.beforeClick&&R.isFunction(i.beforeClick)?((u=o==null?void 0:o.setLoadings)==null||u.call(o,!0),i.beforeClick({row:r,field:s}).then(f=>{o.pick(f?{row:f,field:s}:{row:r,field:s})}).finally(()=>{var f;(f=o==null?void 0:o.setLoadings)==null||f.call(o,!1)})):o.pick({row:r,field:s}))}}),{default:()=>[a.props.content]}))])}},ButtonTree:{renderDefault({children:i=[],props:e={}},t){const r=l.ref(null);return l.createVNode("span",{ref:r,class:e.noGap?"align-no-gap-box":"align-gap-box"},[i.filter(s=>{var o;return!((o=s.hiddenIf)!=null&&o.call(s,t))}).map(s=>$n(s,t,()=>{var o,a,n,c;return((c=(n=(a=(o=r.value)==null?void 0:o.parentElement)==null?void 0:a.parentElement)==null?void 0:n.parentElement)==null?void 0:c.parentElement)||document.body}))??[]])}},$radio:{renderItemContent({props:i={},events:e={},options:t,defaultValue:r},{data:s,field:o}){return ce(r)&&q(o)&&et(s[o])&&(s[o]=r),q(o)?l.createVNode(L.RadioGroup,l.mergeProps({value:s[o],"onUpdate:value":a=>s[o]=a},i,{options:i.options??t??[],disabled:!!i.disabled,onChange:(...a)=>{var n;(n=e.change)==null||n.call(e,{data:s,field:o},...a)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.RadioGroup,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$autoComplete:{renderItemContent({props:i={},events:e={}},{data:t,field:r}){return q(r)?l.createVNode(L.AutoComplete,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},Object.assign({},{filterOption:ui.autoComplete.filterOption},i),{onChange:(...s)=>{var o;(o=e.change)==null||o.call(e,{data:t,field:r},...s)}}),{default:()=>l.createVNode(l.resolveComponent("a-input"),Object.assign({},ui.autoComplete.inputProps,i.inputProps??{}),null)}):null}},$switch:{renderItemContent({props:i={},events:e={},defaultValue:t},{data:r,field:s}){return ce(t)&&q(s)&&et(r[s])&&(r[s]=t),q(s)?l.createVNode(L.Switch,l.mergeProps({checked:r[s],"onUpdate:checked":o=>r[s]=o},i,{onChange:(...o)=>{var a;(a=e.change)==null||a.call(e,{data:r,field:s},...o)}}),null):null}},$checkbox:{renderItemContent({props:i={},options:e,events:t={},defaultValue:r},{data:s,field:o}){return ce(r)&&q(o)&&et(s[o])&&(s[o]=r),q(o)?l.createVNode(L.CheckboxGroup,l.mergeProps({value:s[o],"onUpdate:value":a=>s[o]=a},i,{options:i.options??e??[],onChange:(...a)=>{var n;(n=t.change)==null||n.call(t,{data:s,field:o},...a)}}),null):null},renderDefault({props:i={},options:e},{row:t,field:r}){return q(r)?l.createVNode(L.CheckboxGroup,l.mergeProps({value:t[r],"onUpdate:value":s=>t[r]=s},i,{options:i.options??e??[]}),null):null}},$paragraph:{renderDefault({props:i={}},{row:e,field:t}){var o;const r={ellipsis:{expandable:!0,rows:3}},s=((o=i.getContent)==null?void 0:o.call(i,{row:e,field:t}))??(q(t)?e[t]:"");return q(t)?l.createVNode(L.TypographyParagraph,l.mergeProps(R.merge({},r,R.omit(i,["content","getContent"])),{content:s}),null):null}},$tableInput:{renderItemContent({props:i={},handleTrigger:e},{data:t,field:r}){return q(r)?l.createVNode(JE,{modelValue:t[r],"onUpdate:modelValue":s=>t[r]=s,onTrigger:()=>{e&&R.isFunction(e)&&e(i.cusFields??r)},editColumns:i.editColumns??[],tableConfig:i.tableConfig??{}},null):null}},PercentInput:{renderItemContent({props:i={},attrs:e={},defaultValue:t},{data:r,field:s}){const o=i.parse?100:1;if(q(s)){ce(t)&&et(r[s])&&(r[s]=t);const a=l.computed({get:()=>(r[s]??0)*o,set:n=>{r[s]=(n??0)/o}});return l.createVNode("div",{class:"flex items-center"},[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:a.value,"onUpdate:value":n=>a.value=n},R.merge({},ui.PercentInput,R.omit(i,["info"]))),null)])}else return null},renderDefault({props:i={},attrs:e={}},{row:t,field:r}){const s=i.parse?100:1;if(q(r)){const o=l.computed({get:()=>(t[r]??0)*s,set:a=>{R.set(t,r,(a??0)/s)}});return[i.info?l.createVNode("span",{class:"pr-4"},[i.info]):null,l.createVNode(l.resolveComponent("a-input-number"),l.mergeProps({class:"w-60px!"},e,{value:o.value,"onUpdate:value":a=>o.value=a},R.merge({},ui.PercentInput,R.omit(i,["info"]))),null)]}else return null}},TreeSelect:{renderItemContent({props:i={}},{data:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null},renderDefault({props:i={}},{row:e,field:t}){return q(t)?l.createVNode(L.TreeSelect,l.mergeProps({value:e[t],"onUpdate:value":r=>e[t]=r},i),null):null}}},br=(i,{renderItemContent:e,renderDefault:t,renderEdit:r})=>{ir.hasOwnProperty(i)&&console.warn(`render ${i} already exists, you are trying to override it`),ir[i]={renderItemContent:e,renderDefault:t,renderEdit:r}},Dt={renders:ir,addRender:br},jE=l.defineComponent((i,{emit:e})=>{const{itemRender:t,defaultHandler:r}=i,{renderFormParams:s}=l.toRefs(i),o=n=>{e("trigger",n)},a=(n,c)=>{e("delayTrigger",n,c)};return()=>{var n,c;return((c=(n=Dt.renders[t.name])==null?void 0:n.renderItemContent)==null?void 0:c.call(n,{...t,handleTrigger:o,handleDelayTrigger:a},s.value,r))??null}},{name:"RenderAntItem",props:{itemRender:{type:Object,required:!0},renderFormParams:{type:Object,required:!0},defaultHandler:{type:Object,required:!1}},emits:["trigger","delayTrigger"]}),eC=l.defineComponent(i=>{const{formData:e}=l.toRefs(i);return()=>{var t,r;return((r=(t=i.item.slots)==null?void 0:t.default)==null?void 0:r.call(t,{data:e.value,field:i.item.field},i.passTrigger,i.passDelayTrigger))??null}},{name:"RenderItemSlots",props:["formData","item","passTrigger","passDelayTrigger"]}),tC={key:2},iC=["innerHTML"],_r=l.defineComponent({__name:"PFormCol",props:{item:{},formData:{}},emits:["trigger","reset"],setup(i,{emit:e}){const t=i,r=e,s=l.ref(!1),o=l.ref(Me()),a=(f,g)=>{const v=g??222;s.value=!0,setTimeout(()=>{s.value=!1,r("trigger",f)},v)},n=f=>{r("trigger",f)},c=()=>{r("reset")},d=()=>{o.value=Me()},u=R.debounce(d,100);return Cr(()=>t.item,(f,g)=>{R.isEqual(f,g)||u()},{deep:!0}),(f,g)=>{const v=l.resolveComponent("a-tooltip"),p=l.resolveComponent("a-form-item"),m=l.resolveComponent("a-col");return l.openBlock(),l.createBlock(m,l.mergeProps({key:`_col_${o.value}`},f.item.col??(f.item.span?{span:f.item.span}:l.unref(yr))),{default:l.withCtx(()=>{var x;return[(l.openBlock(),l.createBlock(p,l.mergeProps({key:`_item_${o.value}`,class:[`p-content-align-${f.item.align??"left"} ${f.item.forceRequired?"p-required":""}`,{"p-error-hang-out":s.value}],colon:"",label:f.item.title,name:f.item.field,"wrapper-col":f.item.wrapperCol??(f.item.title?void 0:{span:24})},l.unref(R.omit)(f.item,["field","title","span","col","wrapperCol","itemRender","forceRequired","tooltip"])),l.createSlots({default:l.withCtx(()=>{var C,_;return[(C=f.item.slots)!=null&&C.default?(l.openBlock(),l.createBlock(l.unref(eC),{key:`_sl_${f.item.field??"_"}_${o.value}`,"form-data":f.formData,item:f.item,"pass-delay-trigger":a,"pass-trigger":n},null,8,["form-data","item"])):(_=f.item.itemRender)!=null&&_.name?(l.openBlock(),l.createBlock(l.unref(jE),{key:`_re_${f.item.field??"_"}_${o.value}`,"default-handler":{reset:c},"item-render":f.item.itemRender,"render-form-params":{data:f.formData,field:f.item.field},onDelayTrigger:a,onTrigger:n},null,8,["default-handler","item-render","render-form-params"])):(l.openBlock(),l.createElementBlock("span",tC))]}),_:2},[(x=f.item.slots)!=null&&x.title?{name:"label",fn:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.resolveDynamicComponent(f.item.slots.title)))]),key:"0"}:void 0,f.item.tooltipConfig?{name:"tooltip",fn:l.withCtx(()=>[l.unref(R.isFunction)(f.item.tooltipConfig.title)?(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:0},l.unref(R.omit)(f.item.tooltipConfig,["title"]))),{title:l.withCtx(()=>[l.createElementVNode("div",{innerHTML:f.item.tooltipConfig.title()},null,8,iC)]),default:l.withCtx(()=>[l.createVNode(l.unref(ut.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16)):(l.openBlock(),l.createBlock(v,l.normalizeProps(l.mergeProps({key:1},f.item.tooltipConfig)),{default:l.withCtx(()=>[l.createVNode(l.unref(ut.InfoCircleOutlined),{class:"cursor-pointer py-4 px-2"})]),_:1},16))]),key:"1"}:void 0]),1040,["class","label","name","wrapper-col"]))]}),_:1},16)}}}),rC={key:0,class:"p-pane p-wrapper"},Rr=l.defineComponent({__name:"PForm",props:{items:{},customReset:{type:Function},layout:{},labelCol:{},wrapperCol:{},colon:{type:Boolean},labelAlign:{},labelWrap:{type:Boolean},prefixCls:{},requiredMark:{},hideRequiredMark:{type:Boolean},model:{},rules:{},validateMessages:{},validateOnRuleChange:{type:Boolean},scrollToFirstError:{},onSubmit:{},name:{},validateTrigger:{},size:{},disabled:{type:Boolean},onValuesChange:{},onFieldsChange:{},onFinish:{},onFinishFailed:{},onValidate:{},data:{}},emits:["apply","reset"],setup(i,{expose:e,emit:t}){const r=i,s=t,o=WE(),a=l.computed(()=>({...r,labelCol:r.labelCol??o.labelCol??{span:6},wrapperCol:r.wrapperCol??o.wrapperCol??{span:16}})),{items:n,data:c}=l.toRefs(r);function d(){s("apply",c.value)}const u=l.ref(),f=l.ref(Me()),g=()=>{f.value=Me()},v=()=>{if(r.customReset)r.customReset();else{const C={};Lt(n.value,_=>{_.field&&_.itemRender?ce(_.itemRender.defaultValue)?C[_.field]=_.itemRender.defaultValue:C[_.field]=void 0:_.field&&_.slots&&(ce(_.slots.defaultValue)?C[_.field]=_.slots.defaultValue:C[_.field]=void 0)}),Object.assign(c.value,C)}s("reset")},p=l.computed(()=>({...R.omit(a.value,["items","data","model","labelCol","wrapperCol"]),labelCol:a.value.labelCol,wrapperCol:a.value.wrapperCol})),m=C=>{var _;C&&((_=u.value)==null||_.validateFields(C))},x=C=>{m(C)};return e({reset:g,$form:l.computed(()=>u.value)}),(C,_)=>l.unref(n).some(y=>{var b;return y.field&&y.itemRender||((b=y.slots)==null?void 0:b.default)})?(l.openBlock(),l.createElementBlock("div",rC,[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:f.value,ref_key:"formEl",ref:u,model:l.unref(c)},p.value,{onSubmit:d}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(n),(y,b)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${y.field||b}`,"form-data":l.unref(c),item:y,onReset:v,onTrigger:x},null,8,["form-data","item"]))),128))]),_:1})]),_:1},16,["model"]))])):l.createCommentVNode("",!0)}}),sC=l.defineComponent(i=>{const{column:e}=i;return()=>{var t,r;return((r=(t=e.slots)==null?void 0:t.title)==null?void 0:r.call(t,{column:e}))??e.title}},{name:"RenderAntTitle",props:["column"]}),kn=({title:i,content:e})=>new Promise((t,r)=>{L.Modal.confirm({title:i,content:e,onOk:()=>{t()},onCancel:()=>{r()}})}),oC=L.message.success,aC=L.message.error;L.message.info;const pi=L.message.warning,nC={key:0},lC={key:1,class:"p-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},cC={class:"flex items-center flex-1 gap-4px"},hC={key:2},dC={class:"flex items-center gap-4px"},uC={key:0,class:"w-full text-slate-5 pl-4"},Sr=l.defineComponent({__name:"PGrid",props:{selectConfig:{},rowKey:{},manualFetch:{type:Boolean},align:{},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},tableConfig:{},scrollMode:{},lazyReset:{type:Boolean},fitHeight:{},fitCanvasHeight:{},renderY:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var le,ge,It,K,Pe;const r=i,s=_n(),o=l.computed(()=>({...r,rowKey:r.rowKey??"id",scrollMode:r.scrollMode??"inner",align:r.align??s.align??"left",lazyReset:r.lazyReset??s.lazyReset??!1,fitHeight:r.fitHeight??s.fitHeight??170})),{formConfig:a,pageConfig:n,columns:c,toolbarConfig:d,proxyConfig:u,tableConfig:f,selectConfig:g,scrollMode:v}=l.toRefs(r),p=l.reactive({table:!1,toolbar:!1,form:!1}),m=O=>{R.isObject(O)?Object.keys(O).forEach(M=>{p[M]=O[M]}):R.isBoolean(O)&&(p.form=O,p.table=O,p.toolbar=O)},x=l.ref(),C=l.ref(),_=l.ref(500),y=l.ref([]),b=l.ref([]),E=O=>{const{ajax:M}=u.value;switch(O){case"multiDelete":M.multiDelete&&(y.value.length>0?kn({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{p.table=!0,p.toolbar=!0,M.multiDelete(y.value).then(()=>{L.message.success("删除成功"),bt()}).catch(()=>{L.message.error("删除失败")}).finally(()=>{p.table=!1,p.toolbar=!1,w.multiDelete=!1})}):L.message.warn("请选择要删除的数据"));break}},S=l.computed(()=>{const O=[];return Lt(c.value??[],M=>{M.slots&&M.slots.title&&(M.field||(M.field="__holder__"+O.length),O.push(M))}),O}),$=l.ref(),k=l.ref(),T=l.ref(Me()),I=l.ref(Me()),w=l.reactive([...(((ge=(le=r.toolbarConfig)==null?void 0:le.buttons)==null?void 0:ge.map(O=>O.code))??[]).filter(O=>O),...(((K=(It=r.toolbarConfig)==null?void 0:It.tools)==null?void 0:K.map(O=>O.code))??[]).filter(O=>O)].reduce((O,M)=>(O[M]=!1,O),{})),A=(O,M)=>{w[O]=M},F=()=>{I.value=Me()},H=R.debounce(F,100),W=l.computed(()=>{const O=[];return Lt(c.value??[],M=>{(M.slots&&M.slots.default||M.formatter||M.cellRender)&&(M.field||(M.field="__holder__"+O.length),O.push(M))}),O}),P=l.reactive({page:1,size:((Pe=n.value)==null?void 0:Pe.pageSize)??10}),Y=l.ref(0),X=l.ref(0),V=l.ref([]),Ee=l.computed(()=>u.value&&u.value.ajax?n.value?"pagination":"list":"bad"),fe=l.useAttrs(),se=t,ke=l.computed(()=>b.value.filter(O=>y.value.includes(O[r.rowKey??"id"]))),J=O=>{se("toolbarButtonClick",{data:V.value,code:O,selectedKeys:y.value,records:ke.value}),E(O)},qt=R.debounce(J,100),Mi=({key:O})=>qt(O),Ai=O=>{se("toolbarToolClick",{data:V.value,code:O,selectedKeys:y.value,records:ke.value}),E(O)},Et=R.debounce(Ai,100),Le=l.ref({}),Ct=({row:O,field:M})=>{se("pick",{row:O,field:M})},Ke=O=>{if(a.value&&a.value.items.length>0){if(a.value.customReset)a.value.customReset();else{const M={};Lt(a.value.items,U=>{U.field&&U.itemRender?ce(U.itemRender.defaultValue)?M[U.field]=U.itemRender.defaultValue:M[U.field]=void 0:U.field&&U.slots&&(ce(U.slots.defaultValue)?M[U.field]=U.slots.defaultValue:M[U.field]=void 0)}),Le.value=M}se("resetQuery")}P.page=1,O||Ce()},Ni=(O,M)=>M?{list:R.isString(M.list)?R.get(O,M.list):R.isFunction(M.list)?M.list(O):void 0,total:R.isString(M.total)?R.get(O,M.total):R.isFunction(M.total)?M.total(O):void 0,result:R.isString(M.result)?R.get(O,M.result):R.isFunction(M.result)?M.result(O):void 0,message:R.isString(M.message)?R.get(O,M.message):R.isFunction(M.message)?M.message(O):void 0}:{list:O},Zt=l.ref(!0),Jt=()=>(b.value=[],y.value=[],Ke()),bt=()=>(P.page=1,b.value=[],y.value=[],Rt()),_t=(O,M,U)=>(P.page=O.current,P.size=O.pageSize,Rt()),Rt=()=>new Promise(O=>{if(Ee.value!=="bad"){p.form=!0,p.table=!0;const{ajax:M}=u.value;M.query({form:Le.value,page:P}).then(U=>{const{list:ve,total:Je,result:Q,message:be}=Ni(U,u.value.response);ve?(V.value=ve,Y.value++):Q?(V.value=Q,X.value=Je??Q.length,Y.value++):(V.value=[],Y.value++,be&&L.message.warn(be)),O(V.value)}).catch(U=>{console.error("fetchData error",U),O([])}).finally(()=>{p.form=!1,p.table=!1})}}),Ce=R.debounce(Rt,160),St=(O,M)=>(Object.assign(Le.value,O),P.page=1,M?Promise.resolve():Ce()),Qt=(O,M)=>(Le.value=O,P.page=1,M?Promise.resolve():Ce()),jt=l.computed(()=>Ee.value==="pagination"?{current:P.page,total:X.value,pageSize:P.size,responsive:!1,showSizeChanger:!0,showTotal:O=>`共${O}条数据`}:!1),ei={size:"small",sticky:!0,transformCellText:({text:O})=>R.isArray(O)&&O.length===0?"-":O},ti=l.computed(()=>R.merge({},ei,(f==null?void 0:f.value)??{},g.value?{rowSelection:{type:g.value.multiple?"checkbox":"radio",preserveSelectedRowKeys:!0,selectedRowKeys:y.value,onChange:O=>{y.value=O;const M=r.rowKey??"id",U=b.value.map(Q=>Q[M]),Je=O.filter(Q=>!U.includes(Q)).map(Q=>V.value.find(be=>be[M]===Q)).filter(Q=>!!Q);b.value=[...b.value,...Je]},getCheckboxProps:g.value.getCheckboxProps}}:{})),ii=l.computed(()=>R.omit({labelCol:Er,...a.value},["items"])),D=()=>{bt()};l.watch(()=>[c.value,u.value,d.value],()=>{H()},{deep:!0});const N=()=>{var Q,be;const O=(Q=x.value)==null?void 0:Q.parentElement,M=O?window.getComputedStyle(O).height:"0px",U=C.value?window.getComputedStyle(C.value).height:"0px",ve=U.includes("px")?R.toNumber(U.replace("px","")):0,Je=(be=g.value)!=null&&be.showCount?22:0;_.value=r.renderY??R.toNumber(M.replace("px",""))-o.value.fitHeight-(r.toolbarConfig?30:0)-ve-Je,Zt.value=R.toNumber(M.replace("px",""))>600};e({commitProxy:{query:Ce,reload:Jt,reloadPage:bt,passQuery:St,forcePassQuery:Qt},$table:l.computed(()=>k.value),selectedRowKeys:l.computed(()=>y.value),setBtnLoading:A,selectedRecords:ke,$form:l.computed(()=>$.value),getFormData:()=>Le.value,setLoadings:m,resizeTable:N});let G;l.onMounted(()=>{N(),window.addEventListener("resize",N),G=new MutationObserver(O=>{O.forEach(M=>{if(M.type==="attributes"&&M.attributeName==="style"){const U=M.target;window.getComputedStyle(U).display!=="none"&&N()}})}),x.value&&G.observe(x.value,{attributes:!0,attributeFilter:["style"]}),Ke(r.manualFetch)});const De=["align"],Ze=O=>O.map(M=>({...De.reduce((U,ve)=>({[ve]:o.value[ve]}),{}),...M}));return l.onBeforeUnmount(()=>{window.removeEventListener("resize",N),G.disconnect()}),(O,M)=>{var Q,be,Nr;const U=l.resolveComponent("a-menu-item"),ve=l.resolveComponent("a-menu"),Je=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(fe)),[Ee.value==="bad"?(l.openBlock(),l.createElementBlock("div",nC,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(be=(Q=l.unref(a))==null?void 0:Q.items)!=null&&be.some(B=>B.field&&B.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:C},[l.createVNode(l.unref(L.Spin),{spinning:p.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:T.value,ref_key:"formEl",ref:$,model:Le.value},ii.value,{onSubmit:D}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).items,(B,pe)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${B.field||pe}`,"form-data":Le.value,item:B,onReset:M[0]||(M[0]=Qe=>Ke(o.value.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",lC,[l.createElementVNode("div",cC,[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,(B,pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:pe},[B.dropdowns&&B.dropdowns.length?(l.openBlock(),l.createBlock(Je,{key:0},{overlay:l.withCtx(()=>[l.createVNode(ve,{onClick:Mi},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(B.dropdowns,Qe=>(l.openBlock(),l.createBlock(U,{key:Qe.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(Qe.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:B.type,size:B.size??"middle",disabled:l.unref(d).disabled||B.disabled,loading:p.toolbar||!!B.code&&w[B.code]},{default:l.withCtx(()=>[B.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:B.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(B.content)+" ",1),l.createVNode(l.unref(ut.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):B.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:B.type,size:B.size??"middle",disabled:l.unref(d).disabled||B.disabled,loading:p.toolbar||!!B.code&&w[B.code],onClick:Qe=>l.unref(qt)(B.code)},{default:l.withCtx(()=>[B.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:B.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(B.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",hC))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",dC,[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,(B,pe)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:pe,type:B.type,size:B.size??"middle",disabled:l.unref(d).disabled||B.disabled,onClick:Qe=>l.unref(Et)(B.code),loading:p.toolbar||!!B.code&&w[B.code]},{default:l.withCtx(()=>[B.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:B.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(B.content),1)]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",{class:l.normalizeClass(`p-pane flex-1 ${Zt.value?"h-0":""} p-${l.unref(v)??"inner"}-scroll`)},[(Nr=l.unref(g))!=null&&Nr.multiple&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",uC," 已选:"+l.toDisplayString(y.value.length),1)):l.createCommentVNode("",!0),(l.openBlock(),l.createBlock(l.unref(L.Table),l.mergeProps({key:I.value+"_table","row-key":O.rowKey??"id",ref_key:"tableEl",ref:k,columns:Ze(l.unref(c)??[]).map(B=>l.unref($i)(B)),"data-source":V.value,loading:p.table,pagination:jt.value},ti.value,{scroll:{x:"max-content",y:_.value},onChange:_t}),l.createSlots({_:2},[S.value.length>0?{name:"headerCell",fn:l.withCtx(({column:B})=>[S.value.some(pe=>B.key&&pe.field===B.key)?(l.openBlock(),l.createBlock(l.unref(sC),{key:I.value+"_title_"+Y.value+"_slot_"+B.key,column:S.value.find(pe=>B.key&&pe.field===B.key)},null,8,["column"])):l.createCommentVNode("",!0)]),key:"0"}:void 0,W.value.length>0?{name:"bodyCell",fn:l.withCtx(({column:B,record:pe,index:Qe})=>[W.value.some(Bi=>B.key&&Bi.field===B.key)?(l.openBlock(),l.createBlock(l.unref(Tn),{key:I.value+"_cell_"+Y.value+"_slot_"+B.key,column:W.value.find(Bi=>B.key&&Bi.field===B.key),"default-handler":{pick:Ct,setLoadings:m},row:pe,"row-index":Qe,"table-data":V.value},null,8,["column","default-handler","row","row-index","table-data"])):l.createCommentVNode("",!0)]),key:"1"}:void 0]),1040,["row-key","columns","data-source","loading","pagination","scroll"]))],2)],64))],16)}}});(function(){try{if(typeof document<"u"){var i=document.createElement("style");i.appendChild(document.createTextNode(":root{--evt-header-font: 12px normal Arial;--evt-body-font: 12px normal Arial;--evt-color-white: #fff;--evt-color-black: #000000;--evt-color-primary: rgb(82, 146, 247);--evt-text-color-primary: #333;--evt-text-color-regular: #666;--evt-text-color-secondary: #999;--evt-box-shadow: 0 2px 12px 0 #0000001a;--evt-editor-bg-color: #fff;--evt-editor-text-color: #333;--evt-border-color: #e1e6eb;--evt-stripe-color: #fafafa;--evt-placeholder-color: #cdd0dc;--evt-header-bg-color: #f8faff;--evt-body-bg-color: #fff;--evt-header-text-color: #1d2129;--evt-body-text-color: #4e5969;--evt-footer-text-color: #4e5969;--evt-loading-icon-color: #4e5969;--evt-expand-icon-color: #4e5969;--evt-shrink-icon-color: #4e5969;--evt-error-tip-icon-color: red;--evt-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: transparent;--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-line-color: #e1e6eb;--evt-tree-line-color: #e1e6eb;--evt-sort-icon-color: rgb(82, 146, 247)}.dark{--evt-border-color: #363637;--evt-header-bg-color: #141414;--evt-body-bg-color: #141414;--evt-header-text-color: #a3a6ad;--evt-scroller-color: #414243;--evt-scroller-track-color: #141414;--evt-scroller-focus-color: #a3a6ad;--evt-edit-bg-color: #141414;--evt-readonly-text-color: #cfd3dc;--evt-footer-bg-color: #262727;--evt-autofill-point-border-color: #fff;--evt-editor-bg-color: #434343;--evt-editor-text-color: #cfd3dc}.e-virt-table-container{position:relative;outline:none}.e-virt-table-stage{position:relative;overflow:hidden;outline:none;box-sizing:border-box;z-index:10;border-radius:8px;border:1px solid var(--evt-border-color)}.e-virt-table-canvas{position:absolute;left:0;top:0;box-sizing:border-box;border:none;outline:none;z-index:10}.e-virt-table-editor{position:absolute;top:-10000px;left:-10000px;text-align:left;height:auto;line-height:0;z-index:100;overflow:hidden;background-color:var(--evt-editor-bg-color);border:2px solid var(--evt-color-primary);box-sizing:border-box;box-shadow:var(--evt-box-shadow);display:flex;align-items:center}.e-virt-table-overlayer{position:absolute;left:0;top:0;overflow:hidden;z-index:100;pointer-events:none}.e-virt-table-editor-textarea{width:100%;box-sizing:border-box;outline:none;font-weight:400;padding:8px;font-size:12px;color:inherit;white-space:pre-wrap;word-wrap:break-word;word-break:break-all;line-height:1.5;margin:0;border:none;vertical-align:middle;background:var(--evt-editor-bg-color);color:var(--evt-editor-text-color);overflow-y:auto;resize:none}.e-virt-table-context-menu{position:absolute;font-size:14px;color:var(--evt-text-color-regular);background-color:var(--evt-color-white);border-radius:4px;border:1px solid #e4e7ed;box-shadow:var(--evt-box-shadow);width:fit-content;padding:6px 0;z-index:9999;left:-99999px;top:-99999px}.e-virt-table-context-menu-item{cursor:pointer;padding:8px 24px;color:var(--evt-text-color-regular)}.e-virt-table-context-menu-item:hover{color:var(--evt-color-primary);background-color:#f5f7fa}.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)}")),document.head.appendChild(i)}}catch(e){console.error("vite-plugin-css-injected-by-js",e)}})();var fC=Object.defineProperty,gC=(i,e,t)=>e in i?fC(i,e,{enumerable:!0,configurable:!0,writable:!0,value:t}):i[e]=t,h=(i,e,t)=>gC(i,typeof e!="symbol"?e+"":e,t);class vC{constructor(e){h(this,"rules"),this.rules=e}validate(e){const t=[],{column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,value:d,field:u,fieldValue:f}=e;Array.isArray(this.rules)||(this.rules=[this.rules]);for(const g of this.rules){if(g.validator){const v={field:u,fieldValue:f,value:d,column:r,colIndex:n,rowIndex:c,row:s,key:o,rowKey:a,...g};g.validator(v,d,p=>{p&&t.push({...v,message:p})})}if(!g.required&&(d==null||d===""))return t;g.pattern&&!g.pattern.test(d)&&t.push({value:d,column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,field:u,fieldValue:f,message:g.message||`${o} is pattern validation error`}),g.required&&(d==null||d==="")&&t.push({value:d,column:r,row:s,key:o,rowKey:a,colIndex:n,rowIndex:c,field:u,fieldValue:f,message:g.message||`${o} is required`})}return t}}function Ln(){return"xxxxxxxxxxxxxxxxxx".replace(/[x]/g,function(i){const e=Math.random()*16|0;return(i==="x"?e:e&3|8).toString(16)})}function Mt(i,e){let t=0,r;return function(...s){const o=new Date().getTime(),a=o-t,n=typeof e=="function"?e():e;!t||a>=n?(i.apply(this,s),t=o):r||(r=setTimeout(()=>{i.apply(this,s),t=new Date().getTime(),r=void 0},n-a))}}function Dn(i=[]){return i.length?i.map(e=>Dn(e.children)+1).sort((e,t)=>t-e)[0]:0}function pC(i=[]){let e=[],t=[],r=[];return i.forEach(s=>{s.fixed==="left"?e.push(s):s.fixed==="right"?r.push(s):t.push(s)}),[...e.sort((s,o)=>(s.sort??0)-(o.sort??0)),...t.sort((s,o)=>(s.sort??0)-(o.sort??0)),...r.sort((s,o)=>(s.sort??0)-(o.sort??0))]}function Mn(i=[],e=1,t=0){return i.map(r=>{if(r.children){let s=0,o=r.fixed;r.children.forEach(n=>{n.fixed=o});const a=Mn(r.children,e-1,t+1);return a&&a.forEach(n=>{s+=n.colspan??0}),{...r,width:r.width,level:t,rowspan:1,colspan:s,children:a}}return{...r,level:t,rowspan:e,colspan:1}})}function mi(i=[]){let e=[];return i.forEach(t=>{t.children?e=e.concat(mi(t.children)):e.push(t)}),e}const go=/^(\r\n|\n\r|\r|\n)/,mC=/^[^\t\r\n]+/,vo=/^\t/;function xC(i){let e=[[""]];if(i.length===0)return e;let t=0,r=0,s;for(;i.length>0&&s!==i.length;)if(s=i.length,i.match(vo))i=i.replace(vo,""),t+=1,e[r][t]="";else if(i.match(go))i=i.replace(go,""),t=0,r+=1,e[r]=[""];else{let o="";if(i.startsWith('"')){let a=0,n=!0;for(;n;){const c=i.slice(0,1);c==='"'&&(a+=1),o+=c,i=i.slice(1),(i.length===0||i.match(/^[\t\r\n]/)&&a%2===0)&&(n=!1)}o=o.replace(/^"/,"").replace(/"$/,"").replace(/["]*/g,c=>new Array(Math.floor(c.length/2)).fill('"').join(""))}else{const a=i.match(mC);o=a?a[0]:"",i=i.slice(o.length)}e[r][t]=o}return Array.isArray(e)&&e.length>1&&e[e.length-1].length===1&&e[e.length-1][0]===""&&(e=e.slice(0,e.length-1)),e}function wC(i){let e,t,r,s,o="",a;for(e=0,t=i.length;e<t;e+=1){for(s=i[e].length,r=0;r<s;r+=1)r>0&&(o+=" "),a=i[e][r],typeof a=="string"?a.indexOf(`
|
|
2
2
|
`)>-1?o+=`"${a.replace(/"/g,'""')}"`:o+=a:a==null?o+="":o+=a;e!==t-1&&(o+=`
|
|
3
|
-
`)}return o}function An(i,e,t=[]){let r=0;const s=[];return i.forEach((o,a)=>{if(a===0)s.push(1);else{const n=t.reduce((d,u)=>`${d}${o[u]??""}`,"")||o[e],c=t.reduce((d,u)=>`${d}${i[a-1][u]??""}`,"")||i[a-1][e];n===c?(s[r]+=1,s.push(0)):(s.push(1),r=a)}}),s}function Nn(i,e){let t="",r="";const s={};return e.forEach((o,a)=>{a===0?(t=o.key,r=o.key,s[o.key]=1):i[o.key]===i[t]?(s[o.key]=0,s[r]+=1):(s[o.key]=1,t=o.key,r=o.key)}),s}function yC(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:o}=i,a=An(r,e,t);return a[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:a[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function EC(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,o=s.filter(a=>e.includes(a.key));if(e.includes(t.key)){const a=Nn(r,o);return a[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:a[t.key],relationColKeys:e,mergeCol:!0}}}function CC(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}function po(i){if(!i)return new Date(0);if(typeof i=="number")return new Date(i);const e=String(i).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const r=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of r){const o=e.match(s);if(o){const a=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[n,c,d,u=0,f=0,g=0]=a;return new Date(n,c-1,d,u,f,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[n,c,d,u=0,f=0,g=0]=a;return new Date(d,c-1,n,u,f,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[n,c,d,u=0,f=0,g=0]=a;return new Date(d,n-1,c,u,f,g)}else if(s.source.includes("YYYYMMDD")){const[n,c,d]=a;return new Date(n,c-1,d)}}}return new Date(NaN)}function bC(i,e){const t=po(i),r=po(e);return isNaN(t.getTime())&&isNaN(r.getTime())?0:isNaN(t.getTime())?-1:isNaN(r.getTime())?1:t.getTime()-r.getTime()}class Bn{constructor(e,t,r,s,o,a,n){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=r,this.width=s,this.height=o,this.fixed=n,this.cellType=a}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-r<=0||this.x-r>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,r=e;return!(this.y+this.height-t<=0||this.y-t>=r)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Ir extends Bn{constructor(e,t,r,s,o,a,n,c,d,u="body"){super(e,s,o,a,n,u,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,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=r,this.rowIndex=t,this.key=c.key,this.type=c.type||"",this.editorType=c.editorType||"text",this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=c.editorProps||{},this.cellType=u,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed,this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=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",this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:r=1,rowspan:s=1,relationRowKeys:o,relationColKeys:a,mergeRow:n=!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(a)&&a.length>0?this.relationColKeys=a:this.relationColKeys=[this.key],this.mergeCol=c,this.mergeRow=n,this.colspan=r,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:r,props:s={}}=t;this.editorType=r,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,o=0,a="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&r==="body"))return;const n=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:u=!1,level:f=0}=n||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:v,TREE_ICON_SIZE:p}=this.ctx.config;if(o=f*g,u){const E=this.ctx.icons.get("loading");a="loading",s=E}else if(d){const E=this.ctx.icons.get("expand"),S=this.ctx.icons.get("shrink");s=c?S:E,a=c?"shrink":"expand"}let m=p,x=p,C=this.drawX;(this.align==="center"||this.align==="right")&&(C=this.drawX+(this.visibleWidth-m-2*e)/2,this.align="left");let _=C+o+e,y=this.drawY+(this.visibleHeight-x)/2,b=o+this.drawX+m-.5;this.type==="selection-tree"?(_=o+this.drawSelectionImageX+this.drawSelectionImageWidth,b=_+m-e/2):this.type==="tree-selection"?b=_+v+m-e/2:b=_+m-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(_+m+e>this.drawX+this.visibleWidth)&&(y+x+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=_,this.drawTreeImageY=y,this.drawTreeImageWidth=m,this.drawTreeImageHeight=x,s?(this.drawTreeImageName=a,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:r=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},a=o.level??0,n=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-a*t;const u=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(a>0){for(let p=0;p<a-1;p+=1){const m=u[p+1];if((m?this.ctx.database.getRowForRowKey(m)||{}:{}).isLastChild)continue;const x=Math.round(this.drawTreeImageX-(a-p)*t+r/2);this.ctx.paint.drawLine([x,this.drawY,x,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const f=Math.round(this.drawTreeImageX-t+r/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([f,this.drawY,f,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const v=Math.round(d+(a-1)*t+r/2);this.ctx.paint.drawLine([v,c,n,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const f=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([n,f,n,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:a,FOOTER_TEXT_COLOR:n,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:u,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:v,STRIPE_COLOR:p}=this.ctx.config;if(this.cellType==="footer"){let S=c,$=n;if(typeof s=="function"){const k=s,{backgroundColor:T,color:I}=k({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};T&&(S=T),I&&($=I)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=S,this.drawTextColor=$;return}let m="transparent";const x=this.ctx.hoverCell,C=this.ctx.currentCell;let _=this.rowIndex,y=this.rowIndex;if(this.rowspan!==1&&(f||d)){const S=this.getSpanInfo(),{yArr:$}=S;_=$[0],y=$[1]}f&&x&&(x.rowKey===this.rowKey&&(m=g),x.rowIndex>=_&&x.rowIndex<=y&&(m=g)),d&&C&&(C.rowKey===this.rowKey&&(m=u),C.rowIndex>=_&&C.rowIndex<=y&&(m=u)),this.drawCellSkyBgColor=m;let b=e,E=a;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(b=t,E=o),v&&(this.rowIndex%2?b=p:b=e),typeof r=="function"){const S=r,{backgroundColor:$,color:k}=S({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};$&&(b=$),k&&(E=k)}this.drawCellBgColor=b,this.drawTextColor=E}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:o,type:a,rowIndex:n,rowKey:c}=this;if(r===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(a))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:u=0,CELL_PADDING:f}=this.ctx.config;let g=this.drawX+f;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-u)/2);let v=g,p=this.drawY+(t-u)/2;if(a!=="selection-tree"&&a==="tree-selection"){const{TREE_INDENT:C=16,TREE_ICON_SIZE:_}=this.ctx.config,y=this.ctx.database.getRowForRowKey(c),{level:b=0}=y||{},E=b*C;v=g+_+E}let m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck";if(a==="selection-tree"||a==="tree-selection"){const C=this.ctx.database.getTreeSelectionState(c);C.indeterminate&&d?(m=this.ctx.icons.get("checkbox-indeterminate"),x="checkbox-indeterminate"):C.checked&&d?(m=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):!C.checked&&d?(m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled")}else{const C=this.ctx.database.getRowSelection(c);C&&d?(m=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):C&&!d?(m=this.ctx.icons.get("checkbox-check-disabled"),x="checkbox-check-disabled"):!C&&d?(m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled")}v+u+f>this.drawX+this.visibleWidth||p+u+f>this.drawY+this.visibleHeight||(a==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===n||["checkbox-disabled","checkbox-check"].includes(x))&&(this.drawSelectionImageX=v,this.drawSelectionImageY=p,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=x,this.drawSelectionImageSource=m):(this.drawSelectionImageX=v,this.drawSelectionImageY=p,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=x,this.drawSelectionImageSource=m))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:r,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const a=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});a!==void 0&&(this.hoverIconName=a)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let a=0,n=0;if(o.rowKey===this.rowKey&&(a=this.drawX+this.width-t-r,n=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:u}=d,f=u[0],g=u[1];if(o.rowIndex>=f&&o.rowIndex<=g){const{width:v,height:p,offsetTop:m,offsetLeft:x}=d;a=this.drawX-x+v-t-r,n=this.drawY-m+(p-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=a,this.drawHoverImageY=n,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 a=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?a<this.visibleHeight?0:Math.round(a-(this.visibleHeight-this.height)):Math.round(a)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:r}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:r,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?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}px`,t=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"&&(e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=`${this.drawY-this.ctx.footer.y}px`),this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e="-99999px",t="-99999px"),{position:"absolute",overflow:"hidden",left:e,top:t,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:r,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!r||!t||this.ctx.editing)return;const{xArr:o,yArr:a}=this.ctx.selector,n=o[1],c=a[1],{colIndex:d,rowIndex:u,drawX:f,drawY:g}=this;if(d===n&&u===c){const v=d===this.ctx.maxColIndex||u===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-v,g+this.height-v,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let r=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];r+=o.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let a=this.displayText,n=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)&&(a=o,n=r),["",null,void 0].includes(a))return!1;typeof a!="string"&&(a=`${a}`);const c=`${a}_${this.drawTextWidth}`;return this.ellipsis=this.ctx.paint.drawText(a,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:n,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:r,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:r,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[a,n]=t,[c,d]=r;!(a===n&&c===d)&&this.colIndex>=a&&this.colIndex<=n&&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:r}=this,s=this.drawX,o=this.drawY,a=[s+r-e-.5,o,s+r-.5,o,s+r-.5,o+e];this.ctx.paint.drawLine(a,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:o,height:a,width:n}=this;let c=t,d=r;const{xArr:u,yArr:f,lineDash:g=[],borderWidth:v=1,borderColor:p,fillColor:m}=e,x=u[0],C=u[1],_=f[0],y=f[1];if(o>=x&&o<=C&&s===_){const b=o===C?1:0,E=o===x?1:0;this.ctx.paint.drawLine([c+E,d+1,c+n-b,d+1],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===C&&s>=_&&s<=y){const b=s===_?1:0,E=s===y?1:0;this.ctx.paint.drawLine([c+n-1,d+b,c+n-1,d+a-E],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=x&&o<=C&&s===y){const b=o===C?1:0,E=o===x?1:0;this.ctx.paint.drawLine([c+E,d+a-1,c+n-b,d+a-1],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===x&&s>=_&&s<=y){const b=s===y?1:0,E=s===_?1:0;this.ctx.paint.drawLine([c+1,d+E,c+1,d+a-b],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}}}class _C{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,"overlayerAutoHeightMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:r=[],columns:s=[],footerData:o=[]}=t;this.data=r,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();const t=this.getColumns(),r=mi(t);if(this.ctx.hasSelection=r.some(s=>s.type==="selection"),this.ctx.hasTree=r.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,r=[]){const s=e.length;e.forEach((o,a)=>{var n;const{ROW_KEY:c="",DEFAULT_EXPAND_ALL:d,CELL_HEIGHT:u,SELECTABLE_METHOD:f,CHECKBOX_KEY:g}=this.ctx.config,v=o[c],p=v!=null?`${v}`:Ln();this.itemRowKeyMap.set(o,p);const m=o._height||u,x=o._readonly;let C=!0;if(typeof f=="function"&&(C=f),g){const y=o[g];if(this.checkboxKeyMap.has(y)){const b=this.checkboxKeyMap.get(y)||[];b.push(p),this.checkboxKeyMap.set(y,b)}else this.checkboxKeyMap.set(y,[p])}this.selectionMap.set(p,{key:g?o[g]:p,row:o,check:((n=this.selectionMap.get(p))==null?void 0:n.check)||!1});const _=d||this.expandMap.get(p)||o._expand||!1;this.expandMap.set(p,_),this.rowKeyMap.set(p,{readonly:x,index:a,rowIndex:a,level:t,height:m,calculatedHeight:-1,check:!1,selectable:C,expand:_,expandLazy:!1,hasChildren:o._hasChildren||(Array.isArray(o.children)?o.children.length>0:!1),expandLoading:!1,item:o,parentRowKeys:r,parentRowKey:r[r.length-1]||"",isLastChild:a===s-1}),Array.isArray(o.children)&&o.children.length&&this.initData(o.children,t+1,[...r,p])})}setRowHeight(e,t){const r=this.rowIndexRowKeyMap.get(e);if(r===void 0)return;const s=this.rowKeyMap.get(r);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=r,o.item._height=r}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){e.every(({height:t,rowIndex:r})=>this.getPositionForRowIndex(r).calculatedHeight===t)||(e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.calculatedHeight=r}}),this.clearBufferData(),this.getData(),this.ctx.emit("draw"))}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}filterColumns(e){return e.reduce((t,r)=>{if(!(typeof r.hide=="function"?r.hide():r.hide)){const s={...r};s.children&&Array.isArray(s.children)&&(s.children=this.filterColumns(s.children)),t.push(s)}return t},[])}getColumns(){return this.filterColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const r=o=>{o.forEach(a=>{e.push(a);const n=this.itemRowKeyMap.get(a),{expand:c,hasChildren:d,height:u,calculatedHeight:f}=this.rowKeyMap.get(n),g=this.sumHeight,v=Math.max(f,u);this.sumHeight+=v,this.rowIndexRowKeyMap.set(t,n),this.rowKeyRowIndexMap.set(n,t),this.positions.push({top:g,height:v,bottom:this.sumHeight,calculatedHeight:f}),t+=1,c&&d&&r(a.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((a,n)=>a[1].timestamp-n[1].timestamp);s=this.sortDataRecursive(s,o)}return r(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const r=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:r}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let r=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const a=this.getColumnByKey(s);!a||!a.column.sortBy||(r=this.applySingleColumnSort(r,s,o,a.column.sortBy))}return r.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,r,s){return e.sort((o,a)=>{const n=o[t],c=a[t];let d=0;if(typeof s=="function")d=s(o,a);else if(s==="number"){const u=Number(n)||0,f=Number(c)||0;d=u-f}else if(s==="string"){const u=String(n||""),f=String(c||"");d=u.localeCompare(f)}else s==="date"&&(d=bC(n,c));return r==="asc"?d:-d})}expandItem(e,t=!1){const r=this.rowKeyMap.get(e);r.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(r=>{const s=this.rowKeyMap.get(r);this.expandMap.set(r,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,r)=>{t.expand&&e.push(r)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const r=this.rowKeyMap.get(e);r.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const r=this.rowKeyMap.get(e);r.expand=!0,this.expandMap.set(e,!0),r.expandLazy=!0,r.item.children=t,this.initData(r.item.children,r.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const r=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return r===void 0||s===void 0?null:{rowKey:r,key:s,value:this.getItemValue(r,s)}}getItemValue(e,t){const r=this.rowKeyMap.get(e);return r&&r.item?r.item[t]===void 0?null:r.item[t]:null}async batchSetItemValue(e,t=!1,r=!0,s="none"){let o=[],a=r;const n=new Set;let c=[],d=e.map(v=>{const{rowKey:p,key:m}=v;let x=v.value,C=x;const _=this.getRowDataItemForRowKey(p),y=this.getItemValue(p,m),b=this.getVirtualBodyCellByKey(p,m);return(b==null?void 0:b.type)==="number"&&(["",void 0,null].includes(x)?C=null:/^-?\d+(\.\d+)?$/.test(`${x}`)?C=Number(x):(C=y,c.push({...v,value:C,oldValue:y,row:_}))),{...v,value:C,oldValue:y,row:_}});if(d=d.filter(v=>!c.some(p=>v.rowKey===p.rowKey&&v.key===p.key)),c.length){const v={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",v)}if(d=d.filter(v=>v.oldValue!==v.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:u}=this.ctx.config;s==="none"&&typeof u=="function"&&(d=await u(d),a=!1),d.forEach(v=>{const{value:p,rowKey:m,key:x}=v,C=this.getItemValue(m,x);n.add(m),this.setItemValue(m,x,p,!1,!1,!1,a),o.push({rowKey:m,key:x,oldValue:C,newValue:p})});let f=[];n.forEach(v=>{f.push(this.ctx.database.getRowDataItemForRowKey(v))});const g=d.map(({rowKey:v,key:p})=>this.getValidator(v,p));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())}),this.ctx.emit("change",d,f),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,o=!1,a=!1,n=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],u=r;if(n&&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 f=`${e}_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,d);const g=this.originalDataMap.get(f),v=this.getRowDataItemForRowKey(e);if(a){const p=this.getVirtualBodyCellByKey(e,t);if((p==null?void 0:p.type)==="number")if(["",void 0,null].includes(r))u=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))u=Number(r);else{u=d;const x={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:u,oldValue:d,row:v}]};this.ctx.emit("error",x)}if(u===d)return{oldValue:d,newValue:d};let m=[{rowKey:e,key:t,value:u,oldValue:d,row:v}];this.batchSetItemValue(m,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:g,row:v})}else this.changedDataMap.set(f,u),c[t]=u;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:this.originalDataMap.get(f),row:v}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:u}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:r}=this.ctx.config;if(r){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[r];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(a=>{const n=this.selectionMap.get(a);n&&(n.check=t)})}}toggleRowSelection(e,t){const r=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",r);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),r=this.ctx.config.TREE_SELECT_MODE;if(r==="auto")t.checked&&!t.indeterminate?(this.setRowSelection(e,!1,!1),this.clearTreeSelectionRecursive(e)):(this.setRowSelection(e,!0,!1),this.selectTreeSelectionRecursive(e));else if(r==="cautious")t.checked&&!t.indeterminate?(this.setRowSelection(e,!1,!1),this.clearTreeSelectionRecursive(e)):(this.setRowSelection(e,!0,!1),this.selectTreeSelectionRecursive(e));else if(r==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelection(t,!0,!1),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelection(t,!1,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const r=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=r.filter(c=>c==null?void 0:c.check).length,o=r.length;let a=!1;o>0&&(s===0?a=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?a=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(a=!1));const n=this.selectionMap.get(t);n&&n.check!==a&&(n.check=a,this.setRowSelectionByCheckboxKey(t,a),this.updateParentTreeSelection(t))}setRowSelection(e,t,r=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),r=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:r,indeterminate:!1};let s=!1,o=r;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const a=f=>{const g=this.getTreeChildren(f);let v=[];for(const p of g)v.push(p),v.push(...a(p));return v},n=a(e).map(f=>this.selectionMap.get(f)),c=n.filter(f=>f==null?void 0:f.check).length,d=n.length,u=c>0;s=u&&c!==d,o=r||u,r&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const a=g=>{const v=this.getTreeChildren(g);let p=[];for(const m of v)p.push(m),p.push(...a(m));return p},n=a(e).map(g=>this.selectionMap.get(g)),c=n.filter(g=>g==null?void 0:g.check).length,d=n.length,u=c>0,f=c===d;s=u&&!f,o=r||f,r&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=r);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const r=[],s=o=>{for(const a of o){const n=this.getRowKeyByItem(a);n&&r.push(n),a.children&&a.children.length>0&&s(a.children)}};return s(t.item.children),r}getTreeParent(e){const t=(r,s)=>{for(const o of r){const a=this.getRowKeyByItem(o);if(o.children)for(const n of o.children){if(this.getRowKeyByItem(n)===s)return a;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:r,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:r,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(r);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(r,!0))}}):this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(r,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const a=this.selectionMap.get(o);a&&(a.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 r=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",r),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const r=this.rowKeyMap.size;let s=0,o=0;const a=this.selectionMap.size,n=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,v)=>{var p;(p=this.selectionMap.get(v))!=null&&p.check&&(s+=1);let m=g.selectable;typeof m=="function"&&(m=m({row:g.item,rowIndex:g.rowIndex})),m&&(o+=1)});const c=a>r&&s===0&&n,d=o&&o>s&&s>0||c,u=o!==0,f=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:d,selectable:u},{check:f,indeterminate:d,selectable:u}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const r=this.colIndexKeyMap.get(e);if(r&&this.headerMap.has(r))return(t=this.headerMap.get(r))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,r)=>{const s=this.originalDataMap.get(r),o=r.split("_")[0],a=r.split("_")[1];s!==t&&e.push({rowKey:o,colKey:a,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const o=this.originalDataMap.get(s),a=s.split("_")[0];o!==r&&e.add(a)});let t=[];return e.forEach(r=>{t.push(this.ctx.database.getRowDataItemForRowKey(r))}),t}isHasChangedData(e,t){const r=`${e}_${t}`;if(!this.changedDataMap.has(r))return!1;const s=this.originalDataMap.get(r),o=this.changedDataMap.get(r);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:r}=this.ctx.config;if(r)return!0;const s=this.rowKeyMap.get(e),o=this.headerMap.get(t);if(!s||!o)return!0;const a=s.readonly,n=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 n||a}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(r=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:a}=this.ctx.config;if(o===void 0)return r([]);const n=o.column;let c=n.rules;if(typeof a=="function"){const d=a({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:n,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:n,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},u=new vC(c).validate(d);this.setValidationError(e,t,u),r(u)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(r+=o.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:o,value:a,colIndex:n,relationRowKeys:c,relationColKeys:d,rowspan:u,height:f,width:g,colspan:v,mergeRow:p,mergeCol:m}=e;if(u===1&&v===1)return{xArr:[n,n],yArr:[t,t],rowspan:u,colspan:v,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:o,value:a}]};let x=t,C=t,_=n,y=n,b=[],E=0,S=0,$=0,k=0;if(u!==1&&p){k=g;const T=c.reduce((I,w)=>{const A=this.getItemValue(s,w)??"";return`${I}${A}`},"");for(let I=t-1;I>=0;I--){const w=this.rowIndexRowKeyMap.get(I)||"",A=c.reduce((F,B)=>{const W=this.getItemValue(w,B)??"";return`${F}${W}`},"");if(T===A)x=I;else break}for(let I=t;I<=this.ctx.maxRowIndex;I++){const w=this.rowIndexRowKeyMap.get(I)||"",A=c.reduce((F,B)=>{const W=this.getItemValue(w,B)??"";return`${F}${W}`},"");if(T===A)C=I;else break}for(let I=x;I<t;I++){const{height:w}=this.positions[I];E+=w}for(let I=x;I<=C;I++){const{height:w}=this.positions[I];$+=w;const A=this.rowIndexRowKeyMap.get(I)||"",{item:F}=this.rowKeyMap.get(A),B=this.getItemValue(A,r);b.push({rowKey:A,key:r,value:B,row:F})}}if(v!==1&&m){$=f;for(let T=n-1;T>=0;T--){const I=this.getColumnByColIndex(T);if(!I)break;const w=this.getItemValue(s,r),A=this.getItemValue(s,I.key);if(w===A&&d.includes(I.key))_=T;else break}for(let T=n;T<=this.ctx.maxColIndex;T++){const I=this.getColumnByColIndex(T);if(!I)break;const w=this.getItemValue(s,r),A=this.getItemValue(s,I.key);if(w===A&&d.includes(I.key))y=T;else break}for(let T=_;T<n;T++){const I=this.getColumnByColIndex(T);if(!I)break;S+=I.width||100}for(let T=_;T<=y;T++){const I=this.getColumnByColIndex(T);if(!I)break;k+=I.width||100,b.push({rowKey:s,key:I.key,value:this.getItemValue(s,I.key),row:o})}}return{xArr:[_,y],yArr:[x,C],rowspan:u,colspan:v,height:$,width:k,offsetTop:E,offsetLeft:S,dataList:b}}setValidationErrorByRowIndex(e,t,r){const s=this.rowIndexRowKeyMap.get(e),o=`${s}_${t}`,a=this.getRowForRowIndex(e),n=this.getColumnByKey(t);if(!s||!n||!a)return;const c=this.getItemValue(s,t),d=[{key:t,rowKey:s,rowIndex:e,colIndex:n.colIndex,column:n.column,row:a,value:c,message:r,field:t,fieldValue:c}];this.validationErrorMap.set(o,d)}setValidationError(e,t,r){const s=`${e}_${t}`;this.validationErrorMap.set(s,r)}clearValidationError(e,t){const r=`${e}_${t}`;this.validationErrorMap.has(r)&&this.validationErrorMap.delete(r)}getValidationError(e,t){const r=`${e}_${t}`;return this.validationErrorMap.get(r)||[]}getVirtualBodyCell(e,t){const r=this.getColumnByColIndex(t),s=this.getRowForRowIndex(e);return!r||!s?void 0:new Ir(this.ctx,e,t,0,0,0,0,r,s.item,"body")}getVirtualBodyCellByKey(e,t){const r=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(r===void 0||s===void 0))return this.getVirtualBodyCell(r,s)}hasMergeCell(e,t){let r=!1;for(let s=t[0];s<=t[1];s++)for(let o=e[0];o<=e[1];o++){const a=this.getVirtualBodyCell(s,o);if(a&&(a.rowspan!==1||a.colspan!==1)){r=!0;break}}return r}calculateMaxTreeDepth(e,t=0){let r=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);r=Math.max(r,o)}}),r}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const r=`${e}_${t}`;return this.overlayerAutoHeightMap.get(r)||0}}class RC{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:r}=this.ctx.config;r&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:r}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,r),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(r=>({rowKey:r.rowKey,key:r.key,value:r.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class SC{constructor(e){h(this,"eventTasks",new Map),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),document.addEventListener("selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){this.eventTasks.forEach((e,t)=>{this.unbind(window,t,e)}),document.removeEventListener("selectionchange",this.selectionchange.bind(this)),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.containerElement.focus({preventScroll:!0}),this.ctx.emit("mousedown",e)}handleMousemove(e){this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&this.ctx.emit("keydown",e)}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,r,s){e.addEventListener(t,r,s),this.eventTasks.set(t,r)}unbind(e,t,r){e.removeEventListener(t,r),this.eventTasks.delete(t)}}class IC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const r=this.events.get(e)||[];r.push(t),this.events.set(e,r)}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}off(e,t){const r=this.events.get(e);if(r){const s=r.indexOf(t);s>=0&&(r.splice(s,1),r.length===0?this.events.delete(e):this.events.set(e,r))}}emit(e,...t){const r=this.events.get(e);r&&r.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class TC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,r,s){this.ctx.clearRect(e,t,r||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,r,s,o){const{fillColor:a,side:n,shadowWidth:c,colorStart:d,colorEnd:u}=o;this.ctx.save(),a&&(this.ctx.fillStyle=a,this.ctx.fillRect(e,t,r,s));let f;switch(n){case"left":f=this.ctx.createLinearGradient(e-c,t,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e-c,t,c,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+c,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,c,s);break;case"top":f=this.ctx.createLinearGradient(e,t-c,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-c,r,c);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+c),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,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:r="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,r,s,o){this.ctx.save(),this.ctx.drawImage(e,t,r,s,o),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:o=1,borderColor:a,fillColor:n,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),n!==void 0&&(this.ctx.fillStyle=n),a!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=a),c===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[d,u,f,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+r,t,e+r,t+u,u),this.ctx.arcTo(e+r,t+s,e+r-f,t+s,f),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}n!==void 0&&this.ctx.fill(),a!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,o,a={}){var n;this.ctx.save();const{font:c="12px Arial",align:d="center",color:u="#495060",padding:f=0,verticalAlign:g="middle",maxLineClamp:v=1,autoRowHeight:p=!1,offsetLeft:m=0,offsetRight:x=0}=a;if(this.ctx.font=c,this.ctx.fillStyle=u,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const C=parseInt(((n=c.match(/\d+/))==null?void 0:n[0])||"12")*(a.lineHeight||1.2),_=s-f*2-m-x;let y=!1;const b=Math.round((o-2*f)/C);let E=this.wrapText(e,_,a.cacheTextKey),S=Math.min(E.length,Math.max(b,1));v==="auto"&&p?S=E.length:typeof v=="number"&&v<S&&v!==1?S=v:(v===1&&(E=[e],S=1),v==="auto"&&b===1&&(E=[e],S=1));let $=r+f;const k=Math.round(S*C);g==="middle"?$=r+(o-k)/2:g==="bottom"&&($=r+o-k-f);let T=t+f+m;d==="center"?T=t+s/2:d==="right"&&(T=t+s-f-x);for(let I=0;I<E.length;I++){const w=E[I],A=$+I*C;if(this.ctx.textBaseline="top",I===S-1){const F=E.slice(I).join(""),{_text:B,ellipsis:W}=this.handleEllipsis(F,s,f,c);this.ctx.fillText(B,T,A),y=W;break}this.ctx.fillText(w,T,A)}if(a.textCallback&&E.length){const I=E.reduce((W,P)=>Math.max(W,this.ctx.measureText(P).width),0),w=Math.round(I);let A=T,F=T+w;d==="center"?(A=T-w/2,F=T+w/2):d==="right"&&(A=T-w,F=T);const B={x:T,y:$,width:w,height:k,left:A,right:F,top:$,bottom:$+k};a.textCallback(B)}return this.ctx.restore(),y}wrapText(e,t,r=""){if(!e)return[""];if(r&&this.textCacheMap.has(r))return this.textCacheMap.get(r)||[""];const s=[],o=e.split(`
|
|
4
|
-
`);for(const n of o){if(n===""){s.push("");continue}const c=n.split("");let d="";for(const u of c){const f=d+u;this.ctx.measureText(f).width<=t?d=f:d?(s.push(d),d=u):(s.push(u),d="")}d&&s.push(d)}const a=s.length>0?s:[""];return r&&this.textCacheMap.set(r,a),a}calculateTextHeight(e="",t,r={}){var s;const{font:o="12px Arial",padding:a=0,align:n="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=r;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=n;const f=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(r.lineHeight||1.2),v=t-a*2,p=this.wrapText(e,v,u);let m=1;return d==="auto"?m=p.length:p.length>d?m=d:m=p.length,this.ctx.restore(),Math.max(Math.floor(m*g+a*2),Math.floor(f+a*2))}handleEllipsis(e,t,r=0,s="12px Arial"){this.ctx.save();let o=!1,a=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const n=this.ctx.measureText("...").width;if(t<=n+r*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-r*2;if(c&&c>=d){o=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-n){a=e.slice(0,f)+"...",o=!0;break}}return this.ctx.restore(),{_text:a,ellipsis:o}}}class mo{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"DRAW_TIME_MULTIPLIER",2),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"WIDTH",0),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),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,"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_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_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const r=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=CC(r);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const xo='<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>',wo='<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>',Tr='<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>',OC=Tr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),$C=Tr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"');class kC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:'<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>',color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:'<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:wo,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:xo,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:xo,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:wo,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:OC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:$C,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Tr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const r=this.list[t];let s=r.color,o=r.svg;if(r.configColorName){const n=this.ctx.config[r.configColorName];n&&(s=n)}if(r.configName){const n=this.ctx.config[r.configName];n&&(o=n)}const a=this.createImageFromSVG(o,s).then(n=>{this.icons.set(r.name,n)});e.push(a)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const o=this.createImageFromSVG(r.svg,s,r.isBlob).then(a=>{this.icons.set(r.name,a)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,r=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(n=>{const c=n.getAttribute("fill");(c==="currentColor"||c===null)&&n.setAttribute("fill",t)});const o=new Image;let a="";if(r){const n=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});a=URL.createObjectURL(n)}else a="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=a,new Promise((n,c)=>{o.onerror=()=>c(new Error("Failed to load image:"+e)),o.onload=()=>{n(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class rr extends Bn{constructor(e,t,r,s,o,a,n){super(e,r,s,o,a,"header",n.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,"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,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=a,this.visibleWidth=o,this.visibleHeight=a,this.colIndex=t,this.key=n.key,this.minWidth=n.minWidth,this.maxWidth=n.maxWidth,this.type=n.type||"",this.editorType=n.editorType||"text",this.hideHeaderSelection=n.hideHeaderSelection||!1,this.align=n.headerAlign||n.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=n.headerVerticalAlign||n.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=n.fixed,this.level=n.level||0,this.operation=n.operation||!1,this.text=n.title,this.column=n,this.colspan=n.colspan||1,this.widthFillDisable=n.widthFillDisable||!1,this.rowspan=n.rowspan||1,this.rules=n.rules,this.readonly=n.readonly||!1,this.required=n.required||!1,this.sortIconName=n.sortIconName||"sort-default",this.sortAscIconName=n.sortAscIconName||"sort-asc",this.sortDescIconName=n.sortDescIconName||"sort-desc",this.rowKey=Ln(),this.overflowTooltipShow=n.overflowTooltipHeaderShow!==!1,this.hasChildren=n.children&&n.children.length>0||!1,this.render=n.renderHeader,this.maxLineClampHeader=n.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:r}=this.ctx.config;let s=t,o=r;if(typeof e=="function"){const a=e,{backgroundColor:n,color:c}=a({colIndex:this.colIndex,column:this.column})||{};n&&(s=n),c&&(o=c)}this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.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.drawSelector(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:r,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:t,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:a=>{this.column.sortBy&&(this.drawSortImageX=a.right+4,this.drawSortImageY=a.top+(a.height-16)/2),this.required&&e.drawText("*",a.left-18,a.top+(a.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawSelector(){const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t}=this.ctx.selector,[r,s]=t;this.colIndex>=r&&this.colIndex<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:r}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let a=this.drawX+(this.width-s)/2,n=this.drawY+(this.height-s)/2;this.drawTextX=a+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(a=this.drawX+o,this.drawTextX=a+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?n=this.drawY+o/2:this.verticalAlign==="bottom"&&(n=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&&r?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!r?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&r?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=a,this.drawSelectionImageY=n,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 r=this.ctx.database.getSortState(this.key);r.direction==="asc"?t=this.sortAscIconName:r.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class LC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(()=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver")}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.focusCellHeader=a,this.ctx.emit("cellHeaderMousedown",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.setFocusCell(a),this.ctx.emit("cellMousedown",a,e)})}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.focusCellHeader=a,this.ctx.emit("cellHeaderMouseup",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.setFocusCell(a),this.ctx.emit("cellMouseup",a,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.emit("cellHeaderContextMenuClick",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.emit("cellContextMenuClick",a,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{var 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(a=>a.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("drawView")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(this.isInsideElement(a,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof rr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(!this.isInsideElement(a,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const n=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=n||{},{EXPAND_LAZY:u,EXPAND_LAZY_METHOD:f}=this.ctx.config;if(u&&f&&!c&&!d)typeof f=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),f({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(!this.isInsideElement(a,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const n=this.ctx.database.getSortState(e.key);let c;n.direction==="none"?c="asc":n.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(e instanceof rr){if(e.drawSelectionImageSource&&this.isInsideElement(a,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(a,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Ir){if(e.drawSelectionImageSource&&this.isInsideElement(a,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(a,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(a,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,r,s,o,a){return e>r&&e<r+o&&t>s&&t<s+a}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:a}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-a||o>this.ctx.stageWidth-a)}handleBodyEvent(e,t,r,s,o=!1){if(this.isInsideBody(t))for(const a of r){const n=a.fixedCells.concat(a.noFixedCells);for(const c of n){const d=c.getDrawX(),u=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>u&&t<u+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>u&&t<u+c.height){s(c);return}}}}handleHeaderEvent(e,t,r,s){for(const o of r){const a=o.getDrawX(),n=o.getDrawY();if(e>a&&e<a+o.width&&t>n&&t<n+o.height){s(o);return}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class DC{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,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"adjustPositioning",!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,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"database"),h(this,"history"),h(this,"config"),h(this,"drawTime",0);const{containerElement:r,stageElement:s,canvasElement:o,overlayerElement:a,editorElement:n,emptyElement:c,loadingElement:d,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=a,this.editorElement=n,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=u,this.config=new mo(t.config||{}),this.eventBus=new IC,this.eventBrowser=new SC(this),this.eventTable=new LC(this),this.paint=new TC(this.canvasElement),this.database=new _C(this,t),this.history=new RC(this),this.icons=new kC(this)}setConfig(e){this.config=new mo(e)}setItemValueByEditor(e,t,r,s=!0,o=!0,a=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const n=this.database.getVirtualBodyCellByKey(e,t);if(n&&(n.mergeRow||n.mergeCol)){const{dataList:c}=n.getSpanInfo(),d=c.map(u=>({...u,value:r}));this.database.batchSetItemValue(d,s,a);return}}this.database.setItemValue(e,t,r,s,o,!0,a)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const a=this.database.getRowIndexForRowKey(o.rowKey),n=this.database.getColIndexForKey(o.key);if(a===void 0||n===void 0)return;const c=this.database.getVirtualBodyCell(a,n);if(c){const{dataList:d}=c.getSpanInfo(),u=d.map(f=>({...f,value:o.value}));s.push(...u)}}),this.database.batchSetItemValue(s,t,r)}else this.database.batchSetItemValue(e,t,r)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const r={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",r)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,r=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const a=[];for(let n=0;n<=r[1]-r[0];n++){const c=o+t[0],d=n+r[0],u=this.database.getVirtualBodyCell(c,d);u&&(u.selectorCellValueType==="displayText"?a.push(u.displayText):a.push(u.getValue()))}s+=`${a.join(" ")}\r`,e.push(a)}return s=s?s.replace(/\r$/,""):" ",{xArr:r,yArr:t,text:s,value:e}}setScroll(e,t){let r=Math.floor(e);const s=this.body.width-this.body.visibleWidth;r<0?r=0:r>s&&(r=s);let o=Math.floor(t),a=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(a=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>a&&(o=a),this.emit("setScroll",r,o)}setScrollX(e){let t=Math.floor(e);const r=this.body.width-this.body.visibleWidth;t<0?t=0:t>r&&(t=r),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),r=0;this.config.FOOTER_FIXED||(r=this.footer.height);const s=this.body.height-this.body.visibleHeight+r;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:r}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-r}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class yo{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:r}=e.touches[0],s=t-this.clientY,o=r-this.clientX;let a=0;this.type==="vertical"?(a=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(a===0&&s>0||a===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(a=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=a}onTouchstart(e){const{clientY:t,clientX:r}=e.touches[0];this.clientX=r,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:r,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let a=0;this.type==="vertical"?a=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:a=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(a,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:r,clientX:s,clientY:o,buttons:a}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,a===0||s==this.clientX&&o==this.clientY)return;let n=0;if(this.type==="horizontal"?n=s-this.clientX:n=o-this.clientY,this.isDragging&&n!==0){let c=0;this.type==="vertical"?c=this.dragStart+n/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+n/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,r,s,o,a){return e>=r&&e<=r+o&&t>=s&&t<=s+a}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,r=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&r<0||this.scroll===this.distance&&r>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:r,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:a=0,BORDER:n}}=this.ctx,c=s,d=r,u=t.height,f=t.width,g=e.height,v=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-u,this.distance=g-this.visibleDistance+v,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+o,u],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-a)/2,this.barWidth=a;const p=this.distance?this.visibleDistance/(g+v):0;let m=Math.floor(p*this.visibleDistance);m<30?m=30:m>this.visibleDistance&&(m=0),this.barHeight=m,this.barY=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=f-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const p=n?0:.5;this.trackX=0,this.trackY=d-o+p,this.trackWidth=c,this.trackHeight=o;const m=this.distance?this.visibleDistance/f:0;let x=Math.floor(m*this.visibleDistance);this.barY=this.trackY-1+(o-a)/2,x<30?x=30:x>=this.visibleDistance&&(x=0),this.barWidth=x,this.barHeight=a,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:r,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let a=r;s||(a="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:a,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:a,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class MC{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 yo(e,"vertical"),this.horizontalScrollbar=new yo(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,r)=>{this.setScroll(t,r)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.key===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.colIndex===e);r&&r.x>t.visibleWidth/2&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=r.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,r;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let a="",n="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?a="left":((r=this.ctx.focusCell)==null?void 0:r.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?a="right":(a="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?n="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?n="bottom":(n="",this.stopAdjustPosition(!1,!0)),a&&this.adjustPositionX!==a){this.adjustPositionX=a;let c=10*(a==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,u=d+c;(u<0||u>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(u)},100)}if(n&&this.adjustPositionY!==n){this.adjustPositionY=n;let c=10*(n==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,u=d+c;(u<0||u>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(u)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class AC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Mt(()=>{this.init(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn()}init(){const{config:{HEADER_HEIGHT:e,SCROLLER_TRACK_SIZE:t}}=this.ctx,r=this.ctx.database.getColumns();this.columns=r,this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[];const s=Dn(r),o=mi(r);this.height=e*s,this.width=o.reduce((f,g)=>{const v=g.width||100,{maxWidth:p,minWidth:m}=g;return p&&v>p?f+p:m&&v<m?f+m:f+v},0),this.visibleHeight=this.height;const a=pC(Mn(r,s));this.columnIndex=0,this.resizeNum=0,this.render(a,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const n=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(n.width):this.ctx.stageWidth=Math.floor(this.width+t),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-t;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const f=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(f)}const d=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=d.reduce((f,g)=>f+g.width,0);const u=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=u.reduce((f,g)=>f+g.width,t),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:r}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,a=this.resizeTarget.maxWidth;let n=e.clientX-this.clientX;n+s<r&&(n=-(s-r)),o&&n+s<o&&(n=-(s-o)),a&&n+s>a&&(n=a-s),this.resizeDiff=n,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:a,offsetY:n}=this.ctx.getOffset(e),c=a,d=o.getDrawX();c>d+o.width-5&&c<d+o.width+4&&c<t-4&&o.colspan<=1&&this.ctx.isTarget(e)&&n<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=o)}}})}resizeColumn(e,t){const r=o=>{o.forEach(a=>{if(a.children&&a.children.length>0&&r(a.children),a.key===e.key){const n=a.width||100;a.width=n+t}})};r(this.columns),this.ctx.database.setColumns(this.columns),this.init(),this.ctx.emit("draw");let s=0;if(this.width<this.visibleWidth){const o=this.visibleWidth-this.width;s=Math.floor(o/this.resizeNum*100)/100,this.resizeAllColumn(s),this.ctx.emit("draw")}this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:e.width+t+s,column:e.column,columns:this.columns})}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const a=o.width+e*o.colspan;t.set(o.key,a),a<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=o=>{o.forEach(a=>{t.has(a.key)&&(a.width=t.get(a.key)),a.children&&a.children.length>0&&s(a.children)})};s(this.columns),this.ctx.database.setColumns(this.columns),this.init()}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let a=0;a<r;a++){const n=e[a],c=o*(n.rowspan||0),d=o*(n.level||0);let{minWidth:u,maxWidth:f}=n,g=n.width||100;u&&g<u&&(g=u),f&&g>f&&(g=f),n.children&&(g=mi(n.children).reduce((p,m)=>p+((m==null?void 0:m.width)||100),0));const v=new rr(this.ctx,this.columnIndex,s,d,g,c,n);this.ctx.database.setHeader(n.key,v),this.allCellHeaders.push(v),n.children||(this.leafCellHeaders.push(v),v.column.widthFillDisable||this.resizeNum++),n.fixed==="left"?this.fixedLeftCellHeaders.push(v):n.fixed==="right"?this.fixedRightCellHeaders.push(v):this.centerCellHeaders.push(v),!n.children&&this.columnIndex++,n.children&&this.render(n.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t}}=this.ctx,r=this.resizeTarget.getDrawX(),s=this.resizeTarget.width,o=r+s+this.resizeDiff-.5,a=[o-.5,0,o-.5,e];this.ctx.paint.drawLine(a,{borderColor:t,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],r=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=r,this.renderLeafCellHeaders=e.sort((s,o)=>s.x-o.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.height,e,this.height];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawTipLine(),this.drawBottomLine()}}class Hn{constructor(e,t,r=0,s=0,o=0,a=0,n,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=r,this.y=s,this.width=o,this.height=a,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=n,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[],o=[];e.renderLeafCellHeaders.forEach(a=>{const n=new Ir(this.ctx,this.rowIndex,a.colIndex,a.x,this.y,a.width,this.height,a.column,this.data,this.rowType);n.fixed?r.push(n):s.push(n),t.push(n),n.autoRowHeight&&o.push(n)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=r,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>t.getAutoHeight());this.calculatedHeight=e.length?Math.max(...e):-1}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 NC{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:r,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:a=0,HEIGHT:n,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:u=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+r.height:this.y=t.height;const{data:v,sumHeight:p}=s.getData();this.height=p,this.data=v,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-a;const m=this.ctx.footer.height;!this.data.length&&!n?this.height=c:!this.data.length&&n&&(this.height=n-t.height-m-a);let x=this.height+t.height+a;x+=m;let C=x;const _=window.innerHeight,{top:y}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(_>y&&u&&!n){const w=_-y-f;w>t.height+a?C=w:x>d&&(C=d)}else this.data.length&&n?C=n:this.data.length&&d&&x>d&&(C=d);C>0&&(this.ctx.stageHeight=Math.floor(C),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-a;o?this.visibleHeight=b-m:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=v;const E=window.devicePixelRatio||1,S=this.ctx.stageWidth*E,$=this.ctx.stageHeight*E;e.width=Math.round(S),e.height=Math.round($);const k=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:k,type:k,headerHeight:t.height,bodyHeight:this.height,footerHeight:m,width:this.width,height:this.data.length?0:c+m});const T=Math.round(e.width/E*1e4)/1e4,I=Math.round(e.height/E*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${I}px;width:${T}px;`),this.ctx.paint.scale(E)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r,a=e.clientY,{stageHeight:n,scrollY:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=a-this.clientY;const{calculatedHeight:g}=this.resizeTarget,v=g===-1?d:g;f+u<v&&(f=-(u-v)),this.resizeDiff=f,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 u=0;u<this.renderRows.length;u++){const f=this.renderRows[u];if(s>f.y-c+f.height-1.5&&s<f.y-c+f.height+1.5&&s<n-4)for(let g=0;g<f.cells.length;g++){const v=f.cells[g];o>v.drawX+10&&o<v.drawX+v.width-10&&v.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:o,data:a}=e;this.ctx.database.setRowHeight(r,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:r,oldHeight:s,height:s+t,rowKey:o,row:a,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:r}}=this.ctx,s=this.resizeTarget.y-t,o=this.resizeTarget.height,a=s+o+this.resizeDiff-.5,n=[0,a-.5,e,a-.5];this.ctx.paint.drawLine(n,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let r=0,s=e.length-1,o=-1;for(;r<=s;){let a=Math.floor((r+s)/2),n=e[a].bottom;if(n===t)return a;n<t?r=a+1:(o=a,s=a-1)}return o}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,o=r,{data:a,positions:n}=t.getData();this.ctx.maxRowIndex=a.length-1;let c=this.binarySearch(n,o),d=this.binarySearch(n,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=a.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const u=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,v=this.visibleRows[f],{height:p,top:m}=this.ctx.database.getPositionForRowIndex(g),x=new Hn(this.ctx,g,0,m+this.y,e.width,p,v);u.push(x)}this.renderRows=u,this.ctx.body.renderRows=u}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(r=>r.calculatedHeightCells.length>0))return;e.forEach(r=>{r.updateCalculatedHeight()});const t=e.map(r=>({height:r.calculatedHeight,rowIndex:r.rowIndex}));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 BC{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:r,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:o,FOOTER_POSITION:a}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(n=>n+r,0),this.visibleHeight=this.height,s?a==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,c,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const r=[];this.data.forEach((s,o)=>{const a=new Hn(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,r.push(a)}),this.renderRows=r,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.y,e,this.y];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class HC{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",Mt(e=>{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();const e=setTimeout(()=>{this.ctx.adjustPositioning=!1,clearTimeout(e)},0)}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:r}=this.ctx.selector;this.clearSelectedData(t,r);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click()})}setSelector(e,t){const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,a=t;if(!s){const[n]=a;a=[n,n]}if(!r){const[n]=o;o=[n,n]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(a)){this.ctx.mousedown&&(this.ctx.selectorMove=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:n,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:u,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,v=n,p=c||this.ctx.maxColIndex-f,m=d,x=u||this.ctx.maxRowIndex-g;let[C,_]=o,[y,b]=a;if(C<v||_>p||y<m||b>x)return;if(this.ctx.stageElement.focus({preventScroll:!0}),this.ctx.config.ENABLE_MERGE_CELL_LINK){const S=this.adjustMergeCells(o,a);y=S.yArr[0],b=S.yArr[1],C=S.xArr[0],_=S.xArr[1],this.ctx.onlyMergeCell=S.onlyMergeCell}C===_&&y===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(v,C),Math.min(p,_)],a=[Math.max(m,y),Math.min(x,b)];const{BEFORE_SET_SELECTOR_METHOD:E}=this.ctx.config;if(typeof E=="function"){const S=E({focusCell:this.ctx.focusCell,xArr:o,yArr:a});if(!S)return;o=S.xArr,a=S.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=a,b===this.ctx.maxRowIndex&&y===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,_===this.ctx.maxColIndex&&C===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,o]=t,[a,n]=e;if(o===this.ctx.maxRowIndex&&s===0||n===this.ctx.maxColIndex&&a===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let m=0;m<=t[1]-t[0];m++)for(let x=0;x<=e[1]-e[0];x++){const C=m+t[0],_=x+e[0],y=this.ctx.database.getVirtualBodyCell(C,_);y&&((C===s||C===o)&&c.push(y),(_===a||_===n)&&d.push(y))}const u=c.reduce((m,x)=>{const{yArr:C}=x.getSpanInfo(),[_,y]=C;return m.minY=Math.min(m.minY,_),m.maxY=Math.max(m.maxY,y),m},{minY:s,maxY:o}),f=d.reduce((m,x)=>{const{xArr:C}=x.getSpanInfo(),[_,y]=C;return m.minX=Math.min(m.minX,_),m.maxX=Math.max(m.maxX,y),m},{minX:a,maxX:n}),g=[f.minX,f.maxX],v=[u.minY,u.maxY];let p=!1;if(f.minX!==f.maxX||u.minY!==u.maxY){const m=JSON.stringify(g)+JSON.stringify(v),x=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();p=(x&&JSON.stringify(x.xArr)+JSON.stringify(x.yArr))===m}return{xArr:g,yArr:v,onlyMergeCell:p}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;if(e.operation){this.selectAll();return}const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,a=r||this.ctx.maxRowIndex-s;if(this.ctx.mousedown&&this.ctx.focusCellHeader){const{colIndex:n}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),e.colIndex>=n){const c=[n,e.colIndex+e.colspan-1],d=[o,a];this.setSelector(c,d)}else{const c=[e.colIndex,n],d=[o,a];this.setSelector(c,d)}}else{const n=[e.colIndex,e.colIndex+e.colspan-1],c=[o,a];this.setSelector(n,c)}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:a,SELECTOR_AREA_MAX_X_OFFSET:n,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-n,f=o,g=a||this.ctx.maxRowIndex-c,v=[d,u],p=[f,g];this.setSelector(v,p)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,a=s||this.ctx.maxColIndex-o,n=r;if(t){this.ctx.setFocusCell(e);const c=[n,a],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=[n,a],u=[c,e.rowIndex];this.setSelector(d,u)}else{const d=[n,a],u=[e.rowIndex,c];this.setSelector(d,u)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:r}=this.ctx;if(e&&t&&r){const{rowIndex:s,colIndex:o}=t,a=Math.min(r.colIndex,o),n=Math.max(r.colIndex,o),c=Math.min(r.rowIndex,s),d=Math.max(r.rowIndex,s),u=[a,n],f=[c,d];this.setSelector(u,f)}}click(e=!1){const{focusCell:t,clickCell:r}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,r&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=r,{colIndex:a,rowIndex:n}=t,c=Math.min(a,s),d=Math.max(a,s),u=Math.min(n,o),f=Math.max(n,o),g=[c,d],v=[u,f];this.setSelector(g,v)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const r=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return r==null?void 0:r.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:r}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,r))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const a=this.ctx.focusCell;e=[[a.getValue()]],t=[a.colIndex,a.colIndex],r=[a.rowIndex,a.rowIndex]}else{const a={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",a):alert(a.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const a=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!a)return;e=a.data}const o=wC(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(a=>console.error("Copy Failure:",a)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let o=[];const a=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const u=c+t[0],f=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(u,f);if(g){const{rowKey:v,key:p}=g;this.ctx.database.getReadonly(v,p)||(a.add(v),o.push({rowKey:v,key:p,value:s,row:{}}))}}if(!o.length)return[];if(r)return o;this.ctx.database.batchSetItemValue(o,!0);let n=[];return a.forEach(c=>{n.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,n),o}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],r=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let a=xC(o);const n=[r,r+a[0].length-1],c=[t,t+a.length-1],[d,u]=c,[f,g]=n,v=u-this.ctx.maxRowIndex,p=g-this.ctx.maxColIndex;(v>0||p>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:u,maxX:g,minY:d,minX:f,overflowRowCount:v,overflowColCount:p,textArr:a});const m=a.length===1&&a[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(n,c)&&!m){const y={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",y):alert(y.message);return}let x=[];for(let y=0;y<=a.length-1;y++){const b=a[y].length;for(let E=0;E<=b-1;E++){const S=y+t,$=E+r,k=a[y][E],T=this.ctx.database.getItemValueForRowIndexAndColIndex(S,$);if(T){const{rowKey:I,key:w}=T;this.ctx.database.getReadonly(I,w)||(s.add(I),x.push({rowKey:I,key:w,value:k,row:{}}))}}}if(this.isCut){const y=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=x.map(E=>`${E.rowKey}-${E.key}`);y.forEach(E=>{b.includes(`${E.rowKey}-${E.key}`)||x.unshift(E)}),this.isCut=!1}if(!x.length)return;const{BEFORE_PASTE_DATA_METHOD:C}=this.ctx.config;if(typeof C=="function"){const y=C,b=x.map(E=>({rowKey:E.rowKey,key:E.key,value:E.value,oldValue:this.ctx.database.getItemValue(E.rowKey,E.key),row:this.ctx.database.getRowDataItemForRowKey(E.rowKey)}));if(x=await y(b,n,c,a),x&&!x.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(x,!0);let _=[];s.forEach(y=>{_.push(this.ctx.database.getRowDataItemForRowKey(y))}),this.ctx.emit("pasteChange",x,_),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:r=0,rowIndex:s=0}=t;const o=0,a=0,n=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":r>o&&r--;break;case"TOP":s>a&&s--;break;case"RIGHT":r<n&&r++;break;case"BOTTOM":s<c&&s++;break}const d=[r,r],u=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(d,u),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:a,SELECTOR_AREA_MAX_X_OFFSET:n,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-n,f=o,g=a||this.ctx.maxRowIndex-c;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:o,header:a,footer:n,body:c,scrollX:d,scrollY:u,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:v,ENABLE_MERGE_CELL_LINK:p}}=this.ctx;if(!r)return;p&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:m,drawY:x,width:C,height:_,fixed:y}=r,b=o-m+1,E=r.drawX+C-(t-s)+1;let S=a.height-x,$=_;$>c.visibleHeight&&($=c.visibleHeight);let k=0;g&&(v==="top"?S=a.height+n.height-x:k=n.visibleHeight);const T=x+$-(e-k-f);let I=d,w=u;E>0&&!y?I=Math.floor(d+E):b>0&&!y&&(I=Math.floor(d-b)),S>0?w=Math.floor(u-S):T>0&&(w=Math.floor(u+T)),(Math.abs(d-I)>2||Math.abs(u-w)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.setScroll(I,w),this.ctx.emit("adjustBoundaryPosition",r))}destroy(){}}class FC{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:r}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:a,drawY:n,width:c,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=a+c-u+f,v=n+d-u+f;t>g&&r>v&&t<g+u&&r<v+u&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],o=r[1],{colIndex:a,rowIndex:n}=e;this.ctx.config.ENABLE_AUTOFILL&&a===s&&n===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}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1])}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_SELECTOR_SPAN_COL:s,ENABLE_SELECTOR_SPAN_ROW:o}=this.ctx.config;if(!r)return;let a=e,n=t;if(!o){const[c]=n;n=[c,c]}if(!s){const[c]=a;a=[c,c]}if(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(a)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(n)){const{SELECTOR_AREA_MIN_X:c,SELECTOR_AREA_MAX_X:d,SELECTOR_AREA_MIN_Y:u,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:g,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=c,m=d||this.ctx.maxColIndex-g,x=u,C=f||this.ctx.maxRowIndex-v;let[_,y]=a,[b,E]=n;if(_<p||b<x)return;a=[Math.max(p,_),Math.min(m,y)],n=[Math.max(x,b),Math.min(C,E)];const{BEFORE_SET_AUTOFILL_METHOD:S}=this.ctx.config;if(typeof S=="function"){const $=S({focusCell:this.ctx.focusCell,xArr:a,yArr:n});if(!$)return;a=$.xArr,n=$.yArr}this.ctx.autofill.xArr=a,this.ctx.autofill.yArr=n,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),r=new Map;for(let v=0;v<=t.yArr[1]-t.yArr[0];v++)for(let p=0;p<=t.xArr[1]-t.xArr[0];p++){const m=v+t.yArr[0],x=p+t.xArr[0];r.set(`${m}-${x}`,!0)}const{value:s}=t,o=s[0].length,a=s.length,n=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&a===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(n,c)&&!d){const v={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",v):alert(v.message);return}let u=[];for(let v=0;v<=c[1]-c[0];v++)for(let p=0;p<=n[1]-n[0];p++){const m=p+n[0],x=v+c[0],C=s[v%a][p%o],_=this.ctx.database.getItemValueForRowIndexAndColIndex(x,m),y=`${x}-${m}`;if(_&&!r.has(y)){const{rowKey:b,key:E}=_;this.ctx.database.getReadonly(b,E)||(e.add(b),u.push({rowKey:b,key:E,value:C,row:{}}))}}if(!u.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:f}=this.ctx.config;if(typeof f=="function"){const v=f,p=u.map(m=>({rowKey:m.rowKey,key:m.key,value:m.value,oldValue:this.ctx.database.getItemValue(m.rowKey,m.key),row:this.ctx.database.getRowDataItemForRowKey(m.rowKey)}));if(u=await v(p,n,c),u&&!u.length)return}this.ctx.batchSetItemValueByEditor(u,!0);let g=[];e.forEach(v=>{g.push(this.ctx.database.getRowDataItemForRowKey(v))}),this.ctx.emit("autofillChange",u,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:r}=this.ctx;if(this.ctx.mousedown&&t.enable&&r.enable){const{rowIndex:s,colIndex:o}=e,a=t.xArr.slice(),n=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?a.splice(1,1,o):o<t.xArr[0]&&a.splice(0,1,o):s>t.yArr[1]?n.splice(1,1,s):s<t.yArr[0]&&n.splice(0,1,s),this.setAutofill(a,n)}}destroy(){}}const At=Math.min,ht=Math.max,xi=Math.round,Se=i=>({x:i,y:i}),KC={left:"right",right:"left",bottom:"top",top:"bottom"},PC={start:"end",end:"start"};function sr(i,e,t){return ht(i,At(e,t))}function zt(i,e){return typeof i=="function"?i(e):i}function it(i){return i.split("-")[0]}function Gt(i){return i.split("-")[1]}function Fn(i){return i==="x"?"y":"x"}function Or(i){return i==="y"?"height":"width"}const YC=new Set(["top","bottom"]);function Xe(i){return YC.has(it(i))?"y":"x"}function $r(i){return Fn(Xe(i))}function VC(i,e,t){t===void 0&&(t=!1);const r=Gt(i),s=$r(i),o=Or(s);let a=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=wi(a)),[a,wi(a)]}function WC(i){const e=wi(i);return[or(i),e,or(e)]}function or(i){return i.replace(/start|end/g,e=>PC[e])}const Eo=["left","right"],Co=["right","left"],XC=["top","bottom"],zC=["bottom","top"];function GC(i,e,t){switch(i){case"top":case"bottom":return t?e?Co:Eo:e?Eo:Co;case"left":case"right":return e?XC:zC;default:return[]}}function UC(i,e,t,r){const s=Gt(i);let o=GC(it(i),t==="start",r);return s&&(o=o.map(a=>a+"-"+s),e&&(o=o.concat(o.map(or)))),o}function wi(i){return i.replace(/left|right|bottom|top/g,e=>KC[e])}function qC(i){return{top:0,right:0,bottom:0,left:0,...i}}function Kn(i){return typeof i!="number"?qC(i):{top:i,right:i,bottom:i,left:i}}function yi(i){const{x:e,y:t,width:r,height:s}=i;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function bo(i,e,t){let{reference:r,floating:s}=i;const o=Xe(e),a=$r(e),n=Or(a),c=it(e),d=o==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,g=r[n]/2-s[n]/2;let v;switch(c){case"top":v={x:u,y:r.y-s.height};break;case"bottom":v={x:u,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:f};break;case"left":v={x:r.x-s.width,y:f};break;default:v={x:r.x,y:r.y}}switch(Gt(e)){case"start":v[a]-=g*(t&&d?-1:1);break;case"end":v[a]+=g*(t&&d?-1:1);break}return v}const ZC=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=t,n=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let d=await a.getElementRects({reference:i,floating:e,strategy:s}),{x:u,y:f}=bo(d,r,c),g=r,v={},p=0;for(let m=0;m<n.length;m++){const{name:x,fn:C}=n[m],{x:_,y,data:b,reset:E}=await C({x:u,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:v,rects:d,platform:a,elements:{reference:i,floating:e}});u=_??u,f=y??f,v={...v,[x]:{...v[x],...b}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(g=E.placement),E.rects&&(d=E.rects===!0?await a.getElementRects({reference:i,floating:e,strategy:s}):E.rects),{x:u,y:f}=bo(d,g,c)),m=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:v}};async function Pn(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:o,rects:a,elements:n,strategy:c}=i,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=zt(e,i),p=Kn(v),m=n[g?f==="floating"?"reference":"floating":f],x=yi(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(m)))==null||t?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(n.floating)),boundary:d,rootBoundary:u,strategy:c})),C=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(n.floating)),y=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},b=yi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:n,rect:C,offsetParent:_,strategy:c}):C);return{top:(x.top-b.top+p.top)/y.y,bottom:(b.bottom-x.bottom+p.bottom)/y.y,left:(x.left-b.left+p.left)/y.x,right:(b.right-x.right+p.right)/y.x}}const JC=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:o,platform:a,elements:n,middlewareData:c}=e,{element:d,padding:u=0}=zt(i,e)||{};if(d==null)return{};const f=Kn(u),g={x:t,y:r},v=$r(s),p=Or(v),m=await a.getDimensions(d),x=v==="y",C=x?"top":"left",_=x?"bottom":"right",y=x?"clientHeight":"clientWidth",b=o.reference[p]+o.reference[v]-g[v]-o.floating[p],E=g[v]-o.reference[v],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let $=S?S[y]:0;(!$||!await(a.isElement==null?void 0:a.isElement(S)))&&($=n.floating[y]||o.floating[p]);const k=b/2-E/2,T=$/2-m[p]/2-1,I=At(f[C],T),w=At(f[_],T),A=I,F=$-m[p]-w,B=$/2-m[p]/2+k,W=sr(A,B,F),P=!c.arrow&&Gt(s)!=null&&B!==W&&o.reference[p]/2-(B<A?I:w)-m[p]/2<0,Y=P?B<A?B-A:B-F:0;return{[v]:g[v]+Y,data:{[v]:W,centerOffset:B-W-Y,...P&&{alignmentOffset:Y}},reset:P}}}),QC=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:n,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...x}=zt(i,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const C=it(s),_=Xe(n),y=it(n)===n,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=g||(y||!m?[wi(n)]:WC(n)),S=p!=="none";!g&&S&&E.push(...UC(n,m,p,b));const $=[n,...E],k=await Pn(e,x),T=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&T.push(k[C]),f){const B=VC(s,a,b);T.push(k[B[0]],k[B[1]])}if(I=[...I,{placement:s,overflows:T}],!T.every(B=>B<=0)){var w,A;const B=(((w=o.flip)==null?void 0:w.index)||0)+1,W=$[B];if(W&&(!(f==="alignment"&&_!==Xe(W))||I.every(Y=>Xe(Y.placement)===_?Y.overflows[0]>0:!0)))return{data:{index:B,overflows:I},reset:{placement:W}};let P=(A=I.filter(Y=>Y.overflows[0]<=0).sort((Y,X)=>Y.overflows[1]-X.overflows[1])[0])==null?void 0:A.placement;if(!P)switch(v){case"bestFit":{var F;const Y=(F=I.filter(X=>{if(S){const V=Xe(X.placement);return V===_||V==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(V=>V>0).reduce((V,Ee)=>V+Ee,0)]).sort((X,V)=>X[1]-V[1])[0])==null?void 0:F[0];Y&&(P=Y);break}case"initialPlacement":P=n;break}if(s!==P)return{reset:{placement:P}}}return{}}}},jC=new Set(["left","top"]);async function eb(i,e){const{placement:t,platform:r,elements:s}=i,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=it(t),n=Gt(t),c=Xe(t)==="y",d=jC.has(a)?-1:1,u=o&&c?-1:1,f=zt(e,i);let{mainAxis:g,crossAxis:v,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return n&&typeof p=="number"&&(v=n==="end"?p*-1:p),c?{x:v*u,y:g*d}:{x:g*d,y:v*u}}const tb=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:o,placement:a,middlewareData:n}=e,c=await eb(e,i);return a===((t=n.offset)==null?void 0:t.placement)&&(r=n.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},ib=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:n={fn:x=>{let{x:C,y:_}=x;return{x:C,y:_}}},...c}=zt(i,e),d={x:t,y:r},u=await Pn(e,c),f=Xe(it(s)),g=Fn(f);let v=d[g],p=d[f];if(o){const x=g==="y"?"top":"left",C=g==="y"?"bottom":"right",_=v+u[x],y=v-u[C];v=sr(_,v,y)}if(a){const x=f==="y"?"top":"left",C=f==="y"?"bottom":"right",_=p+u[x],y=p-u[C];p=sr(_,p,y)}const m=n.fn({...e,[g]:v,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[g]:o,[f]:a}}}}}};function ki(){return typeof window<"u"}function yt(i){return Yn(i)?(i.nodeName||"").toLowerCase():"#document"}function ae(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Fe(i){var e;return(e=(Yn(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Yn(i){return ki()?i instanceof Node||i instanceof ae(i).Node:!1}function me(i){return ki()?i instanceof Element||i instanceof ae(i).Element:!1}function Ie(i){return ki()?i instanceof HTMLElement||i instanceof ae(i).HTMLElement:!1}function _o(i){return!ki()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof ae(i).ShadowRoot}const rb=new Set(["inline","contents"]);function Ut(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=xe(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!rb.has(s)}const sb=new Set(["table","td","th"]);function ob(i){return sb.has(yt(i))}const ab=[":popover-open",":modal"];function Li(i){return ab.some(e=>{try{return i.matches(e)}catch{return!1}})}const nb=["transform","translate","scale","rotate","perspective"],lb=["transform","translate","scale","rotate","perspective","filter"],cb=["paint","layout","strict","content"];function kr(i){const e=Lr(),t=me(i)?xe(i):i;return nb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||lb.some(r=>(t.willChange||"").includes(r))||cb.some(r=>(t.contain||"").includes(r))}function hb(i){let e=Ge(i);for(;Ie(e)&&!ft(e);){if(kr(e))return e;if(Li(e))return null;e=Ge(e)}return null}function Lr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const db=new Set(["html","body","#document"]);function ft(i){return db.has(yt(i))}function xe(i){return ae(i).getComputedStyle(i)}function Di(i){return me(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function Ge(i){if(yt(i)==="html")return i;const e=i.assignedSlot||i.parentNode||_o(i)&&i.host||Fe(i);return _o(e)?e.host:e}function Vn(i){const e=Ge(i);return ft(e)?i.ownerDocument?i.ownerDocument.body:i.body:Ie(e)&&Ut(e)?e:Vn(e)}function Wn(i,e,t){var r;e===void 0&&(e=[]);const s=Vn(i),o=s===((r=i.ownerDocument)==null?void 0:r.body),a=ae(s);return o?(ar(a),e.concat(a,a.visualViewport||[],Ut(s)?s:[],[])):e.concat(s,Wn(s,[]))}function ar(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Xn(i){const e=xe(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ie(i),o=s?i.offsetWidth:t,a=s?i.offsetHeight:r,n=xi(t)!==o||xi(r)!==a;return n&&(t=o,r=a),{width:t,height:r,$:n}}function zn(i){return me(i)?i:i.contextElement}function dt(i){const e=zn(i);if(!Ie(e))return Se(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:o}=Xn(e);let a=(o?xi(t.width):t.width)/r,n=(o?xi(t.height):t.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!n||!Number.isFinite(n))&&(n=1),{x:a,y:n}}const ub=Se(0);function Gn(i){const e=ae(i);return!Lr()||!e.visualViewport?ub:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function fb(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==ae(i)?!1:e}function Nt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),o=zn(i);let a=Se(1);e&&(r?me(r)&&(a=dt(r)):a=dt(i));const n=fb(o,t,r)?Gn(o):Se(0);let c=(s.left+n.x)/a.x,d=(s.top+n.y)/a.y,u=s.width/a.x,f=s.height/a.y;if(o){const g=ae(o),v=r&&me(r)?ae(r):r;let p=g,m=ar(p);for(;m&&r&&v!==p;){const x=dt(m),C=m.getBoundingClientRect(),_=xe(m),y=C.left+(m.clientLeft+parseFloat(_.paddingLeft))*x.x,b=C.top+(m.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,f*=x.y,c+=y,d+=b,p=ae(m),m=ar(p)}}return yi({width:u,height:f,x:c,y:d})}function Dr(i,e){const t=Di(i).scrollLeft;return e?e.left+t:Nt(Fe(i)).left+t}function Un(i,e,t){t===void 0&&(t=!1);const r=i.getBoundingClientRect(),s=r.left+e.scrollLeft-(t?0:Dr(i,r)),o=r.top+e.scrollTop;return{x:s,y:o}}function gb(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const o=s==="fixed",a=Fe(r),n=e?Li(e.floating):!1;if(r===a||n&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Se(1);const u=Se(0),f=Ie(r);if((f||!f&&!o)&&((yt(r)!=="body"||Ut(a))&&(c=Di(r)),Ie(r))){const v=Nt(r);d=dt(r),u.x=v.x+r.clientLeft,u.y=v.y+r.clientTop}const g=a&&!f&&!o?Un(a,c,!0):Se(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+u.x+g.x,y:t.y*d.y-c.scrollTop*d.y+u.y+g.y}}function vb(i){return Array.from(i.getClientRects())}function pb(i){const e=Fe(i),t=Di(i),r=i.ownerDocument.body,s=ht(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ht(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-t.scrollLeft+Dr(i);const n=-t.scrollTop;return xe(r).direction==="rtl"&&(a+=ht(e.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:n}}function mb(i,e){const t=ae(i),r=Fe(i),s=t.visualViewport;let o=r.clientWidth,a=r.clientHeight,n=0,c=0;if(s){o=s.width,a=s.height;const d=Lr();(!d||d&&e==="fixed")&&(n=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:n,y:c}}const xb=new Set(["absolute","fixed"]);function wb(i,e){const t=Nt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,o=Ie(i)?dt(i):Se(1),a=i.clientWidth*o.x,n=i.clientHeight*o.y,c=s*o.x,d=r*o.y;return{width:a,height:n,x:c,y:d}}function Ro(i,e,t){let r;if(e==="viewport")r=mb(i,t);else if(e==="document")r=pb(Fe(i));else if(me(e))r=wb(e,t);else{const s=Gn(i);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return yi(r)}function qn(i,e){const t=Ge(i);return t===e||!me(t)||ft(t)?!1:xe(t).position==="fixed"||qn(t,e)}function yb(i,e){const t=e.get(i);if(t)return t;let r=Wn(i,[]).filter(n=>me(n)&&yt(n)!=="body"),s=null;const o=xe(i).position==="fixed";let a=o?Ge(i):i;for(;me(a)&&!ft(a);){const n=xe(a),c=kr(a);!c&&n.position==="fixed"&&(s=null),(o?!c&&!s:!c&&n.position==="static"&&s&&xb.has(s.position)||Ut(a)&&!c&&qn(i,a))?r=r.filter(d=>d!==a):s=n,a=Ge(a)}return e.set(i,r),r}function Eb(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const o=[...t==="clippingAncestors"?Li(e)?[]:yb(e,this._c):[].concat(t),r],a=o[0],n=o.reduce((c,d)=>{const u=Ro(e,d,s);return c.top=ht(u.top,c.top),c.right=At(u.right,c.right),c.bottom=At(u.bottom,c.bottom),c.left=ht(u.left,c.left),c},Ro(e,a,s));return{width:n.right-n.left,height:n.bottom-n.top,x:n.left,y:n.top}}function Cb(i){const{width:e,height:t}=Xn(i);return{width:e,height:t}}function bb(i,e,t){const r=Ie(e),s=Fe(e),o=t==="fixed",a=Nt(i,!0,o,e);let n={scrollLeft:0,scrollTop:0};const c=Se(0);function d(){c.x=Dr(s)}if(r||!r&&!o)if((yt(e)!=="body"||Ut(s))&&(n=Di(e)),r){const v=Nt(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&d();o&&!r&&s&&d();const u=s&&!r&&!o?Un(s,n):Se(0),f=a.left+n.scrollLeft-c.x-u.x,g=a.top+n.scrollTop-c.y-u.y;return{x:f,y:g,width:a.width,height:a.height}}function Qi(i){return xe(i).position==="static"}function So(i,e){if(!Ie(i)||xe(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Fe(i)===t&&(t=t.ownerDocument.body),t}function Zn(i,e){const t=ae(i);if(Li(i))return t;if(!Ie(i)){let s=Ge(i);for(;s&&!ft(s);){if(me(s)&&!Qi(s))return s;s=Ge(s)}return t}let r=So(i,e);for(;r&&ob(r)&&Qi(r);)r=So(r,e);return r&&ft(r)&&Qi(r)&&!kr(r)?t:r||hb(i)||t}const _b=async function(i){const e=this.getOffsetParent||Zn,t=this.getDimensions,r=await t(i.floating);return{reference:bb(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rb(i){return xe(i).direction==="rtl"}const Sb={convertOffsetParentRelativeRectToViewportRelativeRect:gb,getDocumentElement:Fe,getClippingRect:Eb,getOffsetParent:Zn,getElementRects:_b,getClientRects:vb,getDimensions:Cb,getScale:dt,isElement:me,isRTL:Rb},Jn=tb,Qn=ib,jn=QC,Ib=JC,el=(i,e,t)=>{const r=new Map,s={platform:Sb,...t},o={...s.platform,_c:r};return ZC(i,e,{...s,platform:o})};let Tb=class{constructor(i){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=i;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:r,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;const a={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:r,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},n={position:"absolute",width:"10px",height:"10px",background:a.background,backgroundColor:a.backgroundColor,transform:"rotate(45deg)",zIndex:a.zIndex};Object.assign(this.arrowEl.style,n),Object.assign(this.floatingEl.style,a),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",i=>{this.floatingEl.contains(i.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||(i.ellipsis||i.message)&&this.show(i)}),this.ctx.on("visibleCellMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)})}show(i){if(!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=i.getText();i.message&&(e=i.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)return;this.enable=!0,this.contentEl.style.maxWidth=`${i.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=e;const r=i.drawX+t.x,s=i.drawY+t.y;el({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:r,y:s,left:r,right:r+i.visibleWidth,top:s,bottom:s+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Qn(),jn(),Jn(6),Ib({element:this.arrowEl})]}).then(o=>{const{x:a,y:n,placement:c,middlewareData:d}=o;if(Object.assign(this.floatingEl.style,{top:`${n}px`,left:`${a}px`}),d.arrow){const u=d.arrow;["left","left-start","left-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(c)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(c)&&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 Ob{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),this.ctx.on("hoverIconClick",e=>{e.editorType!=="none"&&this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:n}=this.ctx;n&&(this.ctx.emit("setSelectorCell",n),this.cellTarget=n),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const n=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,n),d=this.inputEl.value.substring(n);this.inputEl.value=c+`
|
|
5
|
-
`+d,this.inputEl.selectionStart=this.inputEl.selectionEnd=n+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.code==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.code==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,r=e.ctrlKey,s=e.altKey,o=e.shiftKey,a=e.metaKey;r||s||o||a||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(t)||this.startEdit(!0)}),this.ctx.on("cellMouseup",e=>{if(this.ctx.adjustPositioning||this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){const{xArr:r,yArr:s}=this.ctx.selector,[o,a]=r,[n,c]=s;return!(t<o||t>a||e<n||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.setAttribute("rows","1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.inputEl.addEventListener("blur",()=>{this.doneEdit()}),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:r,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,n=r-s.height-a;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>n&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${r-n}px`),this.inputEl.style.height=`${e}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:a,drawY:n,drawX:c}=e;this.drawX=c,this.drawY=n;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;if(o>f&&(o=f),this.editorEl.style.display="inline-block",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${f}px`,s==="text"){this.inputEl.style.display="block",this.inputEl.style.minWidth=`${a-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${a-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,r!==null&&(this.inputEl.value=r),this.inputEl.focus({preventScroll:!0});const g=this.inputEl.value.length;this.inputEl.setSelectionRange(g,g)}else this.inputEl.style.display="none";(this.inputEl.scrollHeight>o||this.drawY<u.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,r=this.cellTarget.getValue(),s=this.inputEl.value;s!==r&&!(s===""&&r===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0),this.inputEl.value=""}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const r=this.ctx.focusCell;if(!r||["index","index-selection","selection"].includes(r.type)||this.enable||!(r.isVerticalVisible()&&r.isHorizontalVisible()))return;const{rowKey:s,key:o,editorType:a}=r;if(a==="none")return;const n=this.ctx.database.getReadonly(s,o);r&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget))}editCell(e,t){const r=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!r)return;const s=r.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:a,key:n}=o,c=this.ctx.database.getReadonly(a,n);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.ctx.containerElement.focus({preventScroll:!0}),this.editorEl.style.display="none",this.ctx.emit("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 $b=class{constructor(i){h(this,"ctx"),h(this,"emptyEl"),this.ctx=i;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:r,headerHeight:s,bodyHeight:o,footerHeight:a})=>{const n=s+(o+a)/2,c={display:r==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${n}px`,transform:"translate(-50%, -50%)",...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.observer=new MutationObserver(Mt(()=>{const t=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),r=new Map;t.forEach(o=>{const a=Number(o.getAttribute("data-row-index")),n=Number(o.getAttribute("data-col-index"));if(isNaN(a)||isNaN(n)||!(o instanceof HTMLElement)||o.offsetWidth===0)return;const c=`${a}_${n}`;r.set(c,Math.round(o.offsetHeight))});const s=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(s,r)){if(this.ctx.database.setOverlayerAutoHeightMap(r),s.size===0&&r.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0})}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[r,s]of e)if(!t.has(r)||t.get(r)!==s)return!1;return!0}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:a}=this.ctx.config;return o?a==="top"?s=[e,r,t]:s=[e,t,r]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:r,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:a,renderCellHeaders:n}=this.ctx.header;let c=[],d=[],u=[];n.forEach(m=>{m.render&&(m.fixed==="left"?d.push(m):m.fixed==="right"?u.push(m):c.push(m))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${a}px`},cells:d},v={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-f+1}px`,height:`${a}px`},cells:c},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${a}px`},cells:u};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${a}px`},views:[g,v,p]}}getBody(){const e=[],t=[],r=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(m=>{m.cells.forEach(x=>{x.cellType==="footer"&&(x.render=x.renderFooter),x.render&&(x.fixed==="left"?t.push(x):x.fixed==="right"?r.push(x):e.push(x))})});const{fixedLeftWidth:o,fixedRightWidth:a,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=a-n,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${u}px`},cells:t},v={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-f}px`,height:`${u}px`},cells:e},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${u}px`},cells:r};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${u}px`},views:[g,v,p]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(p=>{p.cells.forEach(m=>{m.cellType==="footer"&&m.renderFooter&&(m.render=m.renderFooter,m.fixed==="left"?t.push(m):m.fixed==="right"?r.push(m):e.push(m))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:n}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,u=o-a,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-u}px`,height:`${d}px`},cells:e},v={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${u}px`,height:`${d}px`},cells:r};return{type:"footer",class:`${n}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[f,g,v]}}}class Lb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"custom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.custom=!0,this.contextMenuEl=this.ctx.contextMenuElement):(this.custom=!1,this.contextMenuEl=document.createElement("div")),this.createContextMenu(),this.init()}init(){this.ctx.on("cellContextMenuClick",(e,t)=>{if(!this.ctx.config.ENABLE_CONTEXT_MENU)return;t.preventDefault();const{xArr:r,yArr:s}=this.ctx.selector,[o,a]=r,[n,c]=s,{rowIndex:d,colIndex:u}=e;d>=n&&d<=c&&u>=o&&u<=a||this.ctx.emit("setSelectorCell",e,t);const f={getBoundingClientRect:()=>({width:0,height:0,top:t.clientY,left:t.clientX,right:t.clientX,bottom:t.clientY,x:t.clientX,y:t.clientY}),contextElement:document.body};el(f,this.contextMenuEl,{placement:"right-start",middleware:[Jn(),Qn(),jn()]}).then(({x:g,y:v})=>{this.show(g,v)})}),this.ctx.on("click",this.hide.bind(this)),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}createContextMenu(){if(this.contextMenuEl.className="e-virt-table-context-menu",this.contextMenuEl.addEventListener("contextmenu",function(t){t.preventDefault()}),this.ctx.containerElement.appendChild(this.contextMenuEl),this.custom)return;const{CONTEXT_MENU:e}=this.ctx.config;this.createContextMenuItems(e,t=>{switch(t.value){case"copy":this.ctx.emit("contextMenuCopy");break;case"paste":this.ctx.emit("contextMenuPaste");break;case"cut":this.ctx.emit("contextMenuCut");break;case"clearSelected":this.ctx.emit("contextMenuClearSelected");break}this.hide()})}createContextMenuItems(e,t){this.contextMenuEl.replaceChildren(),e.forEach(r=>{const s=document.createElement("div");s.className="e-virt-table-context-menu-item",s.innerText=r.label,r.event?s.onclick=()=>{r.event&&r.event(),t(r)}:s.onclick=()=>t(r),this.contextMenuEl.appendChild(s)})}show(e,t){Object.assign(this.contextMenuEl.style,{left:`${e}px`,top:`${t}px`})}hide(){Object.assign(this.contextMenuEl.style,{left:"-99999px",top:"-99999px"})}updated(){this.createContextMenu()}destroy(){this.contextMenuEl.remove()}}class Db{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const r=this.ctx.icons.getSvg("loading");if(r){const o=new DOMParser().parseFromString(r.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 Mb{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,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:o,contextMenuElement:a}=this.options,n=this.createContainer(e,r,s,o,a);this.ctx=new DC(n,this.options),this.header=new AC(this.ctx),this.footer=new BC(this.ctx),this.body=new NC(this.ctx),this.scroller=new MC(this.ctx),this.selector=new HC(this.ctx),this.autofill=new FC(this.ctx),this.tooltip=new Tb(this.ctx),this.empty=new $b(this.ctx),this.editor=new Ob(this.ctx),this.overlayer=new kb(this.ctx),this.contextMenu=new Lb(this.ctx),this.loading=new Db(this.ctx),this.ctx.on("draw",Mt(()=>{this.draw()},()=>this.ctx.drawTime)),this.ctx.on("drawView",Mt(()=>{this.draw(!0)},()=>this.ctx.drawTime)),this.draw()}createContainer(e,t,r,s,o){e.className="e-virt-table-container";const a=document.createElement("div"),n=document.createElement("canvas"),c=t||document.createElement("div");a.className="e-virt-table-stage",e.tabIndex=0,n.className="e-virt-table-canvas",c.className="e-virt-table-overlayer";const d=r||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=o;return a.appendChild(n),a.appendChild(c),e.appendChild(a),{containerElement:e,stageElement:a,canvasElement:n,overlayerElement:c,editorElement:d,emptyElement:u,contextMenuElement:f}}draw(e=!1){requestAnimationFrame(()=>{const t=performance.now();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(),requestAnimationFrame(()=>{this.body.updateAutoHeight()});const r=performance.now(),s=Math.round(r-t);this.ctx.drawTime=s*this.ctx.config.DRAW_TIME_MULTIPLIER})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.contextMenu.updated(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,r,s=!0,o=!0,a=!1){this.ctx.database.setItemValue(e,t,r,s,o,a)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,r,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],r=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,r,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(r,s)=>{let o=[];for(let a=0;a<e.length;a++){const{rowKey:n,key:c}=e[a],d=await this.ctx.database.getValidator(n,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[a]=o;if(Array.isArray(a)&&a.length){const[n]=a,{rowKey:c,key:d}=n;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else r([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,r)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[o]=s;if(Array.isArray(o)&&o.length){const[a]=o,{rowKey:n,key:c}=a,d=this.ctx.database.getRowForRowKey(n);if(d){const{parentRowKeys:u=[]}=d;u&&u.length&&this.setExpandRowKeys(u,!0)}this.scrollToRowkey(n),this.scrollToColkey(c)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:o}=t;this.ctx.database.setValidationErrorByRowIndex(r,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let a=0;a<r.length;a++)for(let n=0;n<s.length;n++){const c=this.ctx.database.getRowKeyByItem(r[a]),d=s[n].key,u=await this.ctx.database.getValidator(c,d);Array.isArray(u)&&u.length&&o.push(u)}o.length?(t(o),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(r=>{const s=this.ctx.database.getRowKeyByItem(r);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(r=>{this.ctx.database.setRowSelection(r,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:EC,mergeRowCell:yC,getSpanArrByRow:An,getSpanObjByColumn:Nn}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const Ab=l.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:o}=r;if(o){const a=l.ref(s[o]);return()=>{var n,c;return((c=(n=Dt.renders[t.name])==null?void 0:n.renderEdit)==null?void 0:c.call(n,a,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Mr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(i,{expose:e,emit:t}){const r=t,s=l.ref([]),o=i,a=Rn(),n=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...a,...o.config}}));let c=null;const d=l.useAttrs(),u=l.ref(null),f=l.ref(null),g=l.ref(null),v=l.ref(null),p=l.ref(),m=l.ref("text"),x=l.ref(),C={},_={},y=l.computed(()=>{const w=p.value;return w?{width:`${w.width}px`,height:`${w.height}px`}:{}}),b=w=>ct[w]||(({cellValue:A})=>A),E=w=>{var A;return(A=Dt.renders[w])==null?void 0:A.renderDefault},S=(w,...A)=>({row:F,rowIndex:B,value:W})=>w({row:F,rowIndex:B,cellValue:W},...A),$=w=>{var A,F,B,W,P;if((A=w.slots)!=null&&A.default&&R.isFunction((F=w.slots)==null?void 0:F.default))return Y=>{var X,V;return(V=(X=w.slots)==null?void 0:X.default)==null?void 0:V.call(X,{row:Y.row,column:w,rowIndex:Y.rowIndex})};if((B=w.slots)!=null&&B.default&&R.isString((W=w.slots)==null?void 0:W.default))return`slot:${(P=w.slots)==null?void 0:P.default}`;if(w.cellRender&&w.cellRender.name)return Y=>{var X,V;return(V=E(w.cellRender.name))==null?void 0:V(w.cellRender,{data:o.data,row:Y.row,rowIndex:Y.rowIndex,field:w.field||Y.column.key,title:((X=Y.column)==null?void 0:X.title)??""},{})}},k=w=>{var A,F,B,W,P,Y,X;return(A=w.slots)!=null&&A.edit&&(w.field||w.key)&&R.isFunction((F=w.slots)==null?void 0:F.edit)?C[`__slot:${w.field||w.key}`]=w:(B=w.editRender)!=null&&B.name&&(w.field||w.key)&&(_[w.field||w.key]=w.editRender),{...R.omit(w,["formatter"]),key:w.key||w.field||Me(),formatter:R.isString(w.formatter)?S(b(w.formatter)):R.isArray(w.formatter)&&R.isString(w.formatter[0])?S(b(w.formatter[0]),...w.formatter.slice(1)):R.isFunction(w.formatter)?S(w.formatter):void 0,editorType:w.editorType??((W=w.slots)!=null&&W.edit&&(w.field||w.key)&&R.isFunction((P=w.slots)==null?void 0:P.edit)?`__slot:${w.field||w.key}`:(Y=w.editRender)!=null&&Y.name?w.editRender.name:void 0),render:$(w),children:(X=w.children)==null?void 0:X.map(V=>k(V))}};l.onMounted(()=>{u.value&&(c=new Mb(u.value,{config:n.value.config,columns:o.columns.map(w=>k(w)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:v.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(w=>{const A=d[w];if(typeof A=="function"&&w.startsWith("on")){const F=w.charAt(2).toLowerCase()+w.slice(3);c==null||c.on(F,A)}}),c.on("change",w=>{r("change",w)}),c.on("overlayerChange",w=>{x.value=w}),c.on("startEdit",w=>{p.value=w,m.value=w.editorType,m.value}),c.on("doneEdit",()=>{m.value="text"}),c.on("selectionChange",w=>{s.value=w,r("selectionChange",w)}),r("ready",c))});function T(w){if(!c||!p.value)return;const{rowKey:A,key:F}=p.value;c==null||c.setItemValueByEditor(A,F,w)}const I=()=>document.body;return l.watch(()=>o.data,w=>{c==null||c.loadData(w)},{deep:!0}),Cr(()=>o.columns,(w,A)=>{R.isEqual(w,A)||c==null||c.loadColumns(w.map(F=>k(F)))},{deep:!0}),l.watch(()=>n.value.config,w=>{c==null||c.loadConfig(w)},{deep:!0}),l.watch(()=>o.footerData,w=>{c==null||c.loadFooterData(w||[])},{deep:!0}),l.watch(()=>o.loading,(w,A)=>{w!==A&&(c==null||c.setLoading(w))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(w,A)=>{const F=l.resolveComponent("a-empty"),B=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(B,{spinning:w.loading},{default:l.withCtx(()=>{var W,P,Y,X,V,Ee,fe;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:u},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[m.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(C[m.value].slots.edit({row:p.value.row,column:C[m.value],rowIndex:p.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(y.value),class:"ev-editor-wrapper","get-popup-container":I,value:p.value.value,"onUpdate:value":A[0]||(A[0]=se=>p.value.value=se),cell:p.value,onBlur:T},null,40,["style","value","cell"])):(W=l.unref(Dt).renders[m.value])!=null&&W.renderEdit?(l.openBlock(),l.createBlock(l.unref(Ab),{key:1,"cell-render":_[p.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(y.value),"render-table-params":{data:o.data,row:(P=p.value)==null?void 0:P.row,rowIndex:((Y=p.value)==null?void 0:Y.rowIndex)??-1,field:((X=p.value)==null?void 0:X.key)??"",title:((Ee=(V=p.value)==null?void 0:V.column)==null?void 0:Ee.title)??""},bordered:!1,"get-popup-container":I,onBlur:T},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(w.$slots,"empty",{},()=>[l.createVNode(F,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:v},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((fe=x.value)==null?void 0:fe.views)||[],se=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(se.class),style:l.normalizeStyle(se.style),key:se.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(se.views,ke=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(ke.style),key:ke.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(ke.cells,J=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${J.rowKey}_${J.key}`,style:J.style},{ref_for:!0},J.domDataset),[typeof J.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(J.render(J)),{key:0,bordered:!1})):typeof J.render=="string"&&J.render.startsWith("slot:")?l.renderSlot(w.$slots,J.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},J,{cell:J})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Nb={key:0},Bb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Hb={class:"flex items-center flex-1 gap-4px"},Fb={key:2},Kb={class:"flex items-center gap-4px"},Pb={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Yb={key:0,class:"w-full text-slate-5 pl-4"},tl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean},fitHeight:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var Qt,jt,ei,ti,ii;const r=i,s=l.useAttrs(),o=t,{formConfig:a,pageConfig:n,columns:c,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=l.toRefs(r),v=_n(),p=Rn(),m=l.ref(Me()),x=l.ref({}),C=l.computed(()=>({...r,config:{...p,...r.config},lazyReset:r.lazyReset??v.lazyReset??!1,fitCanvasHeight:r.fitHeight??v.fitCanvasHeight??100})),_=l.computed(()=>u.value&&u.value.ajax?n.value?"pagination":"list":"bad");l.computed(()=>_.value==="pagination"?{current:E.page,total:$.value,pageSize:E.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const y=l.computed(()=>R.omit({labelCol:Er,...a.value},["items"])),b=l.reactive({toolbar:!1,form:!1,table:!1}),E=l.reactive({page:1,size:((Qt=n.value)==null?void 0:Qt.pageSize)??10}),S=l.ref(0),$=l.ref(0),k=l.ref([]),T=l.ref(),I=l.ref(),w=l.ref(),A=l.ref(),F=l.ref(500),B=l.ref({}),W=D=>{B.value[E.page]=D},P=l.reactive([...(((ei=(jt=r.toolbarConfig)==null?void 0:jt.buttons)==null?void 0:ei.map(D=>D.code))??[]).filter(D=>D),...(((ii=(ti=r.toolbarConfig)==null?void 0:ti.tools)==null?void 0:ii.map(D=>D.code))??[]).filter(D=>D)].reduce((D,N)=>(D[N]=!1,D),{})),Y=(D,N)=>{P[D]=N},X=D=>{R.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(b.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(b.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(b.table=D.table)):R.isBoolean(D)&&(b.form=D,b.toolbar=D,b.table=D)},V=l.computed(()=>R.uniq(Object.values(B.value).flat(),D=>{var N;return D[((N=r.config)==null?void 0:N.ROW_KEY)??"id"]})),Ee=()=>{Ct()},fe=l.computed(()=>V.value.map(D=>{var N;return D[((N=r.config)==null?void 0:N.ROW_KEY)??"id"]})),se=(D,N)=>N?{list:R.isString(N.list)?R.get(D,N.list):R.isFunction(N.list)?N.list(D):void 0,total:R.isString(N.total)?R.get(D,N.total):R.isFunction(N.total)?N.total(D):void 0,result:R.isString(N.result)?R.get(D,N.result):R.isFunction(N.result)?N.result(D):void 0,message:R.isString(N.message)?R.get(D,N.message):R.isFunction(N.message)?N.message(D):void 0}:{list:D},ke=D=>{o("toolbarButtonClick",{data:k.value,code:D,selectedKeys:fe.value,records:V.value}),Jt(D)},J=R.debounce(ke,100),qt=({key:D})=>J(D),Mi=D=>{o("toolbarToolClick",{data:k.value,code:D,selectedKeys:fe.value,records:V.value}),Jt(D)},Ai=R.debounce(Mi,100),Et=()=>new Promise(D=>{if(_.value!=="bad"){X({table:!0,form:!0});const{ajax:N}=u.value;N.query({form:x.value,page:E}).then(G=>{const{list:De,total:Ze,result:le,message:ge}=se(G,u.value.response);De?(k.value=De,S.value++):le?(k.value=le,$.value=Ze??le.length,S.value++):(k.value=[],S.value++,ge&&pi(ge)),D(k.value)}).catch(G=>{console.error("fetchData error",G),D([])}).finally(()=>{X({table:!1,form:!1})})}}),Le=(D,N)=>(E.page=D,E.size=N,Et()),Ct=()=>(E.page=1,B.value={},Et()),Ke=R.debounce(Et,160),Ni=(D,N)=>(Object.assign(x.value,D),E.page=1,N?Promise.resolve():Ke()),Zt=(D,N)=>(x.value=D,E.page=1,N?Promise.resolve():Ke()),Jt=D=>{const{ajax:N}=u.value;switch(D){case"multiDelete":N.multiDelete&&(fe.value.length>0?kn({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{X({table:!0,toolbar:!0}),N.multiDelete(fe.value).then(()=>{oC("删除成功"),Ct()}).catch(()=>{aC("删除失败")}).finally(()=>{X({table:!1,toolbar:!1}),P.multiDelete=!1})}):pi("请选择要删除的数据"));break}},bt=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]),_t=D=>{if(a.value&&a.value.items.length>0){if(a.value.customReset)a.value.customReset();else{const N={};Lt(a.value.items,G=>{G.field&&G.itemRender?ce(G.itemRender.defaultValue)?N[G.field]=G.itemRender.defaultValue:N[G.field]=void 0:G.field&&G.slots&&(ce(G.slots.defaultValue)?N[G.field]=G.slots.defaultValue:N[G.field]=void 0)}),x.value=N}o("resetQuery")}E.page=1,D||Ke()},Rt=()=>(B.value={},_t()),Ce=()=>{var le,ge;const D=(le=w.value)==null?void 0:le.parentElement,N=D?window.getComputedStyle(D).height:"0px",G=A.value?window.getComputedStyle(A.value).height:"0px",De=G.includes("px")?R.toNumber(G.replace("px","")):0,Ze=(ge=g.value)!=null&&ge.showCount?22:0;F.value=R.toNumber(N.replace("px",""))-C.value.fitCanvasHeight-(r.toolbarConfig?30:0)-De-Ze};let St;return l.onMounted(()=>{Ce(),window.addEventListener("resize",Ce),St=new MutationObserver(D=>{D.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const G=N.target;window.getComputedStyle(G).display!=="none"&&Ce()}})}),w.value&&St.observe(w.value,{attributes:!0,attributeFilter:["style"]}),_t(r.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Ce),St.disconnect()}),e({commitProxy:{query:Ke,reload:Rt,reloadPage:Ct,passQuery:Ni,forcePassQuery:Zt},$canvasTable:l.computed(()=>I.value),selectedRowKeys:fe,setBtnLoading:Y,selectedRecords:V,$form:l.computed(()=>T.value),getFormData:()=>x.value,setLoadings:X,resizeTable:Ce}),(D,N)=>{var le,ge,It;const G=l.resolveComponent("a-menu-item"),De=l.resolveComponent("a-menu"),Ze=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:w,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[_.value==="bad"?(l.openBlock(),l.createElementBlock("div",Nb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ge=(le=l.unref(a))==null?void 0:le.items)!=null&&ge.some(K=>K.field&&K.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:A},[l.createVNode(l.unref(L.Spin),{spinning:b.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:m.value,ref_key:"formEl",ref:T,model:x.value},y.value,{onSubmit:Ee}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).items,(K,Pe)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${K.field||Pe}`,"form-data":x.value,item:K,onReset:N[0]||(N[0]=O=>_t(C.value.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",Bb,[l.createElementVNode("div",Hb,[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,(K,Pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Pe},[K.dropdowns&&K.dropdowns.length?(l.openBlock(),l.createBlock(Ze,{key:0},{overlay:l.withCtx(()=>[l.createVNode(De,{onClick:qt},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(K.dropdowns,O=>(l.openBlock(),l.createBlock(G,{key:O.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(O.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content)+" ",1),l.createVNode(l.unref(ut.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):K.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code],onClick:O=>l.unref(J)(K.code)},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",Fb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",Kb,[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,(K,Pe)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:Pe,type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,onClick:O=>l.unref(Ai)(K.code),loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",Pb,[(It=l.unref(g))!=null&&It.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",Yb," 已选:"+l.toDisplayString(fe.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Mr,{ref_key:"canvasTableRef",ref:I,columns:bt.value,config:{...l.unref(f),HEIGHT:F.value},onSelectionChange:W,data:k.value,loading:b.table},null,8,["columns","config","data","loading"]),_.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(L.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:E.page,"page-size":E.size,total:$.value,onChange:Le},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Ar=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var n;return(n=r.value)==null?void 0:n.$form}),a=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(n,c)=>(l.openBlock(),l.createBlock(Rr,l.mergeProps({ref_key:"formEl",ref:r},a.value,{data:l.unref(s)}),null,16,["data"]))}}),Vb=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(i,{expose:e}){const t=i,r=l.useSlots(),s=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{s.value=[]},expand:()=>{s.value=["content"]}}),(o,a)=>{const n=l.resolveComponent("a-collapse-panel"),c=l.resolveComponent("a-collapse"),d=l.resolveComponent("a-card");return o.collapsible?(l.openBlock(),l.createBlock(c,{key:0,"active-key":s.value,"onUpdate:activeKey":a[0]||(a[0]=u=>s.value=u),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:o.title},l.createSlots({default:l.withCtx(()=>[l.renderSlot(o.$slots,"default")]),_:2},[r.title?{name:"header",fn:l.withCtx(()=>[l.renderSlot(o.$slots,"title")]),key:"0"}:void 0]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(d,{key:1,size:"small",title:o.title},l.createSlots({default:l.withCtx(()=>[l.renderSlot(o.$slots,"default")]),_:2},[r.title?{name:"title",fn:l.withCtx(()=>[l.renderSlot(o.$slots,"title")]),key:"0"}:void 0]),1032,["title"]))}}}),il=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(i,{expose:e}){const t=L.Form.useForm,r=l.ref(),s=i,o=l.ref(),a=l.useModel(i,"modelValue"),n=l.ref(0),c=l.ref([]),d=l.ref([]),u=E=>{n.value=E},f=l.computed(()=>s.max??1/0),g=E=>{(s.createItem??(()=>Promise.resolve({})))({list:a.value}).then($=>{var k;a.value=[...a.value,{...$,__index:(((k=R.max(a.value,T=>T.__index??-1))==null?void 0:k.__index)??-1)+1}],n.value=E})},v=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],p=E=>{var S,$,k,T,I,w;return((I=(T=(k=($=(S=E==null?void 0:E.parentElement)==null?void 0:S.parentElement)==null?void 0:$.parentElement)==null?void 0:k.parentElement)==null?void 0:T.parentElement)==null?void 0:I.parentElement)??((w=o.value)==null?void 0:w.$el)??document.body},m=l.computed(()=>s.forceRender||a.value.length<=5),x=E=>{var $;const S=($=a.value.find((k,T)=>T===E))==null?void 0:$.__index;q(S)&&(c.value=c.value.filter(k=>k!==S))},C=()=>{l.nextTick().then(()=>{var E,S;x(n.value),(S=(E=d.value[n.value])==null?void 0:E.$form)==null||S.validate()})};l.watch(()=>a.value,()=>{if(!s.keepSerial){const E=a.value.filter(S=>!q(S.__index));E.length>0&&E.forEach(S=>{var $;S.__index=((($=R.max(a.value,k=>k.__index??-1))==null?void 0:$.__index)??-1)+1})}},{immediate:!0});const _=({key:E},S,$)=>{var k;if(s.menuHandler&&R.isFunction(s.menuHandler))s.menuHandler({code:R.toString(E),data:S,index:$});else switch(E){case"delete":a.value=a.value.filter((T,I)=>I!==$),l.nextTick(()=>{d.value=d.value.filter(T=>!!T),$<=n.value&&n.value>0&&n.value--});break;case"copy":if(a.value.length>=f.value){pi("已达到最大数量");return}a.value=[...a.value,R.clone({...R.omit(S,["id","__index"]),__index:(((k=R.max(a.value,T=>T.__index??-1))==null?void 0:k.__index)??-1)+1})];break}},y=R.debounce(_,100);l.watchEffect(()=>{a.value.length===0?n.value=0:n.value>=a.value.length&&(n.value=a.value.length-1)});const b=R.debounce(x,50);return l.watchEffect(()=>{var $;const E=a.value.map((k,T)=>c.value.includes(k.__index)?T:void 0).filter(q),S=($=r.value)==null?void 0:$.$el;S&&S.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((T,I)=>{E.includes(I)?T.classList.add("p-error-group-tab"):T.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var E,S;(S=(E=o.value)==null?void 0:E.collapse)==null||S.call(E)},expand:()=>{var E,S;(S=(E=o.value)==null?void 0:E.expand)==null||S.call(E)},activeKey:l.computed(()=>n.value),setActiveKey:u,validateAll:()=>{const E=m.value?d.value.map(S=>{var $;return($=S.$form)==null?void 0:$.validate()}):a.value.map(S=>{var $;return(($=t(S,s.getFormSetting(S).rules))==null?void 0:$.validate())??Promise.resolve()});return Promise.allSettled(E).then(S=>{if(c.value=S.map(($,k)=>{var T;return $.status==="rejected"&&typeof((T=a.value[k])==null?void 0:T.__index)=="number"?a.value[k].__index:void 0}).filter($=>typeof $=="number"),!s.lazyErrorMark&&c.value.length){const $=c.value[0],k=a.value.findIndex(T=>T.__index===$);k!==-1&&(n.value=k)}return c.value.length?Promise.reject({error_indexes:c.value,results:S}):Promise.resolve(S)})},validate:async(E,S)=>{var k,T,I;const $=a.value.findIndex(w=>w.__index===E);try{return await(m.value?((T=(k=d.value[$])==null?void 0:k.$form)==null?void 0:T.validate())??Promise.resolve():((I=t(a.value[$],s.getFormSetting(a.value[$]).rules))==null?void 0:I.validate())??Promise.resolve()),c.value=c.value.filter(w=>w!==E),Promise.resolve()}catch(w){return!c.value.includes(E)&&!S&&(c.value=[...c.value,E]),Promise.reject(w)}},validateFields:async(E,S,$)=>{var A,F;const k=a.value.findIndex(B=>B.__index===E),I=s.getFormSetting(a.value[k]).rules,w=t(a.value[k],I);try{return await(m.value?((F=(A=d.value[k])==null?void 0:A.$form)==null?void 0:F.validateFields(S))??Promise.resolve():Promise.allSettled(S.map(B=>w.validateField(B,a.value[k][B],I[B]??[])))),Promise.resolve()}catch(B){return!c.value.includes(E)&&!$&&(c.value=[...c.value,E]),Promise.reject(B)}}}),(E,S)=>{const $=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(Vb,{ref_key:"rootRef",ref:o,title:E.title,size:"small",collapsible:E.collapsible,"default-collapsed":E.defaultCollapsed},{default:l.withCtx(()=>[E.loading?(l.openBlock(),l.createBlock($,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(L.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:n.value,"onUpdate:activeKey":S[1]||(S[1]=k=>n.value=k),"hide-add":"",onChange:C},{rightExtra:l.withCtx(()=>[l.renderSlot(E.$slots,"rightExtra",{},()=>[E.showAdd&&a.value.length<f.value?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:0,type:"link",onClick:S[0]||(S[0]=k=>g(a.value.length))},{default:l.withCtx(()=>S[2]||(S[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a.value,(k,T)=>(l.openBlock(),l.createBlock(l.unref(L.TabPane),{key:T,tab:`${E.tabLabel} ${E.keepSerial?T+1:(k.__index??0)+1}`,"force-render":m.value},{closeIcon:l.withCtx(()=>{var I;return[E.editAble&&((I=l.unref(v))!=null&&I.length)?(l.openBlock(),l.createBlock(l.unref(L.Dropdown),{key:0,"get-popup-container":p},{overlay:l.withCtx(()=>[l.createVNode(l.unref(L.Menu),{onClick:w=>l.unref(y)(w,k,T)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(v).filter(w=>{var A;return((A=w.visibleMethod)==null?void 0:A.call(w,{data:k,index:T}))??!0}),w=>(l.openBlock(),l.createBlock(l.unref(L.MenuItem),{key:w.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(w.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ut.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Ar,{ref_for:!0,ref_key:"blockInstance",ref:d,key:T,source:k,"get-form-setting":E.getFormSetting,onFocusCapture:I=>l.unref(b)(T),onClickCapture:I=>l.unref(b)(T)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:3},8,["title","collapsible","default-collapsed"])}}}),Wb={class:"w-full text-right p-2"},rl=l.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(i,{expose:e}){const t=l.ref(),r=l.ref(!1),s=i,o=l.computed(()=>{var p;return(p=s.gridSetting.selectConfig)==null?void 0:p.multiple});let a,n,c;const d=l.reactive({modal:!1}),u=()=>{c&&c()},f=()=>{d.modal=!1,c&&c()},g=({row:p,field:m})=>{a&&!o.value&&s.beforePick(p).then(()=>{d.modal=!1,a({row:p,field:m})})},v=()=>{var m;const p=((m=t.value)==null?void 0:m.selectedRecords)??[];p.length===0&&!s.multipleAllowEmpty?pi("请选择数据"):s.beforePick(p).then(()=>{d.modal=!1,n(p)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((p,m)=>{a=p,c=m,r.value=!1,d.modal=!0,l.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((p,m)=>{n=p,c=m,r.value=!1,d.modal=!0,l.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(p,m)=>(l.openBlock(),l.createBlock(l.unref(L.Modal),{open:d.modal,"onUpdate:open":m[0]||(m[0]=x=>d.modal=x),"destroy-on-close":"",title:p.title,width:p.width,footer:o.value?void 0:null,onCancel:u,"body-style":p.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:r.value?"unset":"642px"})},[l.createVNode(Sr,l.mergeProps(p.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",Wb,[l.createElementVNode("span",null,[l.createVNode(l.unref(L.Button),{class:"mr-4",onClick:f},{default:l.withCtx(()=>m[1]||(m[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(L.Button),{type:"primary",onClick:v},{default:l.withCtx(()=>m[2]||(m[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function sl(i){i&&bn(i)}const Xb={install(i){i.component("PForm",Rr),i.component("PGrid",Sr),i.component("PCanvasTable",Mr),i.component("PCanvasGrid",tl),i.component("PFormGroup",il),i.component("PGroupBlock",Ar),i.component("PromisePicker",rl)},addFormatter:In,addRender:br,setup:sl};exports.PCanvasGrid=tl;exports.PCanvasTable=Mr;exports.PForm=Rr;exports.PFormGroup=il;exports.PGrid=Sr;exports.PGroupBlock=Ar;exports.PromisePicker=rl;exports.addFormatter=In;exports.addRender=br;exports.cleanCol=$i;exports.default=Xb;exports.defaultItemResponsive=yr;exports.defaultLabelCol=Er;exports.get24rest=Sn;exports.getButtonResponsive=GE;exports.getUIKitConfig=VE;exports.labelColDict=zE;exports.resetUIKitConfig=XE;exports.setUIKitConfig=bn;exports.setup=sl;exports.watchPreviousDeep=Cr;
|
|
3
|
+
`)}return o}function An(i,e,t=[]){let r=0;const s=[];return i.forEach((o,a)=>{if(a===0)s.push(1);else{const n=t.reduce((d,u)=>`${d}${o[u]??""}`,"")||o[e],c=t.reduce((d,u)=>`${d}${i[a-1][u]??""}`,"")||i[a-1][e];n===c?(s[r]+=1,s.push(0)):(s.push(1),r=a)}}),s}function Nn(i,e){let t="",r="";const s={};return e.forEach((o,a)=>{a===0?(t=o.key,r=o.key,s[o.key]=1):i[o.key]===i[t]?(s[o.key]=0,s[r]+=1):(s[o.key]=1,t=o.key,r=o.key)}),s}function yC(i,e,t=[]){const{visibleRows:r,rowIndex:s,headIndex:o}=i,a=An(r,e,t);return a[s-o]===0?{rowspan:0,colspan:0,relationRowKeys:t,mergeRow:!0}:{rowspan:a[s-o],colspan:1,relationRowKeys:t,mergeRow:!0}}function EC(i,e=[]){const{column:t,row:r,visibleLeafColumns:s}=i,o=s.filter(a=>e.includes(a.key));if(e.includes(t.key)){const a=Nn(r,o);return a[t.key]===0?{rowspan:0,colspan:0,relationColKeys:e,mergeCol:!0}:{rowspan:1,colspan:a[t.key],relationColKeys:e,mergeCol:!0}}}function CC(i,e=document.documentElement){const t=i.startsWith("--")?i:`--${i}`;return getComputedStyle(e).getPropertyValue(t).trim()}function po(i){if(!i)return new Date(0);if(typeof i=="number")return new Date(i);const e=String(i).trim(),t=new Date(e);if(!isNaN(t.getTime()))return t;const r=[/^(\d{4})-(\d{1,2})-(\d{1,2})$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})$/,/^(\d{4})\.(\d{1,2})\.(\d{1,2})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{1,2})-(\d{1,2})-(\d{4})$/,/^(\d{1,2})\/(\d{1,2})\/(\d{4})$/,/^(\d{1,2})\.(\d{1,2})\.(\d{4})$/,/^(\d{4})(\d{2})(\d{2})$/,/^(\d{4})-(\d{1,2})-(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/,/^(\d{4})\/(\d{1,2})\/(\d{1,2})\s+(\d{1,2}):(\d{1,2})(?::(\d{1,2}))?$/];for(const s of r){const o=e.match(s);if(o){const a=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[n,c,d,u=0,f=0,g=0]=a;return new Date(n,c-1,d,u,f,g)}else if(s.source.includes("DD-MM-YYYY")||s.source.includes("DD/MM/YYYY")||s.source.includes("DD.MM.YYYY")){const[n,c,d,u=0,f=0,g=0]=a;return new Date(d,c-1,n,u,f,g)}else if(s.source.includes("MM-DD-YYYY")||s.source.includes("MM/DD/YYYY")||s.source.includes("MM.DD.YYYY")){const[n,c,d,u=0,f=0,g=0]=a;return new Date(d,n-1,c,u,f,g)}else if(s.source.includes("YYYYMMDD")){const[n,c,d]=a;return new Date(n,c-1,d)}}}return new Date(NaN)}function bC(i,e){const t=po(i),r=po(e);return isNaN(t.getTime())&&isNaN(r.getTime())?0:isNaN(t.getTime())?-1:isNaN(r.getTime())?1:t.getTime()-r.getTime()}class Bn{constructor(e,t,r,s,o,a,n){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"fixed"),h(this,"cellType"),this.ctx=e,this.x=t,this.y=r,this.width=s,this.height=o,this.fixed=n,this.cellType=a}isHorizontalVisible(){if(this.fixed)return!0;const{stageWidth:e,fixedLeftWidth:t,scrollX:r,fixedRightWidth:s}=this.ctx,o=e;return!(this.x+this.width-t-r<=0||this.x-r>=o-s)}isVerticalVisible(){const{stageHeight:e,scrollY:t}=this.ctx,r=e;return!(this.y+this.height-t<=0||this.y-t>=r)}getDrawX(){if(this.fixed==="left")return this.x;if(this.fixed==="right"){const{stageWidth:e,config:{SCROLLER_TRACK_SIZE:t}}=this.ctx;return e-(this.ctx.header.width-this.x)-t}return this.x-this.ctx.scrollX}getDrawY(){return this.cellType==="header"?this.y:this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED?this.y:this.y-this.ctx.scrollY}getLeftFixedX(){return this.x-this.ctx.scrollX}getRightFixedX(){}}class Ir extends Bn{constructor(e,t,r,s,o,a,n,c,d,u="body"){super(e,s,o,a,n,u,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,"drawTextX",0),h(this,"drawTextY",0),h(this,"drawTextWidth",0),h(this,"drawTextHeight",0),h(this,"drawTreeImageX",0),h(this,"drawTreeImageY",0),h(this,"drawTreeImageWidth",0),h(this,"drawTreeImageHeight",0),h(this,"drawTreeImageName",""),h(this,"drawTreeImageSource"),h(this,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawHoverImageX",0),h(this,"drawHoverImageY",0),h(this,"drawHoverImageWidth",0),h(this,"drawHoverImageHeight",0),h(this,"drawHoverImageName",""),h(this,"drawHoverImageSource"),h(this,"autoRowHeight",!1),h(this,"calculatedHeight",0),h(this,"ellipsis",!1),h(this,"rowExpand",!1),h(this,"rowHasChildren",!1),h(this,"overflowTooltipShow",!0),h(this,"selectorCellValueType","value"),h(this,"overflowTooltipMaxWidth",500),h(this,"overflowTooltipPlacement","top"),h(this,"maxLineClamp","auto"),this.visibleWidth=this.width,this.visibleHeight=this.height,this.colIndex=r,this.rowIndex=t,this.key=c.key,this.type=c.type||"",this.editorType=c.editorType||"text",this.selectorCellValueType=c.selectorCellValueType||this.ctx.config.SELECTOR_CELL_VALUE_TYPE||"value",this.editorProps=c.editorProps||{},this.cellType=u,this.align=c.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=c.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=c.fixed,this.level=c.level||0,this.operation=c.operation||!1,this.column=c,this.rules=c.rules||[],this.row=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",this.update()}setWidthHeight(e,t){this.width=e,this.height=t}getValidationMessage(){const e=this.ctx.database.getValidationError(this.rowKey,this.key);if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message||""}return this.message}update(){this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawTextX=this.drawX,this.drawTextY=this.drawY,this.isHasChanged=this.ctx.database.isHasChangedData(this.rowKey,this.key),this.updateSpan(),this.drawTextWidth=this.visibleWidth,this.drawTextHeight=this.visibleHeight,this.updateStyle(),this.updateType(),this.updateHoverIcon(),this.updateSelection(),this.updateTree(),this.updateEditor(),this.updateRender(),this.getValidationMessage(),this.updateContainer(),this.text=this.getText(),this.displayText=this.getDisplayText()}updateSpan(){if(this.cellType==="footer")return;const{SPAN_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e,{colspan:r=1,rowspan:s=1,relationRowKeys:o,relationColKeys:a,mergeRow:n=!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(a)&&a.length>0?this.relationColKeys=a:this.relationColKeys=[this.key],this.mergeCol=c,this.mergeRow=n,this.colspan=r,this.rowspan=s,this.visibleWidth=this.getWidthByColIndexColSpan(this.colIndex,this.colspan),this.visibleHeight=this.ctx.database.getHeightByRowIndexRowSpan(this.rowIndex,this.rowspan)}}updateSpanInfo(){if(this.mergeRow||this.mergeCol){const e=this.getSpanInfo();this.height=e.height,this.width=e.width,this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.drawY-=e.offsetTop,this.drawX-=e.offsetLeft}}updateType(){const{BODY_CELL_TYPE_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.type=t)}}updateEditor(){const{BODY_CELL_EDITOR_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});if(t!==void 0){const{type:r,props:s={}}=t;this.editorType=r,this.editorProps=s}}}updateRender(){const{BODY_CELL_RENDER_METHOD:e}=this.ctx.config;if(typeof e=="function"){const t=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});t!==void 0&&(this.render=t)}}validate(){this.ctx.database.getValidator(this.rowKey,this.key).then(()=>{this.ctx.database.setValidationError(this.rowKey,this.key,[]),this.message=""}).catch(e=>{if(Array.isArray(e)&&e.length){const[t]=e;this.message=t.message,this.ctx.database.setValidationError(this.rowKey,this.key,e)}}).finally(()=>{this.ctx.emit("draw")})}updateStyle(){this.autoRowHeight&&(this.domDataset={"data-auto-height":!0,"data-row-index":this.rowIndex,"data-col-index":this.colIndex}),this.style=this.getOverlayerViewsStyle()}updateTree(){const{CELL_PADDING:e=0}=this.ctx.config,{rowKey:t,cellType:r}=this;let s,o=0,a="";if(!(["tree","selection-tree","tree-selection"].includes(this.type)&&r==="body"))return;const n=this.ctx.database.getRowForRowKey(t),{expand:c=!1,hasChildren:d=!1,expandLoading:u=!1,level:f=0}=n||{};this.rowExpand=c,this.rowHasChildren=d;const{TREE_INDENT:g=16,CHECKBOX_SIZE:v,TREE_ICON_SIZE:p}=this.ctx.config;if(o=f*g,u){const E=this.ctx.icons.get("loading");a="loading",s=E}else if(d){const E=this.ctx.icons.get("expand"),S=this.ctx.icons.get("shrink");s=c?S:E,a=c?"shrink":"expand"}let m=p,x=p,C=this.drawX;(this.align==="center"||this.align==="right")&&(C=this.drawX+(this.visibleWidth-m-2*e)/2,this.align="left");let _=C+o+e,y=this.drawY+(this.visibleHeight-x)/2,b=o+this.drawX+m-.5;this.type==="selection-tree"?(_=o+this.drawSelectionImageX+this.drawSelectionImageWidth,b=_+m-e/2):this.type==="tree-selection"?b=_+v+m-e/2:b=_+m-e/2,this.drawTextX=b,this.drawTextWidth=this.drawX+this.visibleWidth-b,!(_+m+e>this.drawX+this.visibleWidth)&&(y+x+e>this.drawY+this.visibleHeight||(this.drawTreeImageX=_,this.drawTreeImageY=y,this.drawTreeImageWidth=m,this.drawTreeImageHeight=x,s?(this.drawTreeImageName=a,this.drawTreeImageSource=s):(this.drawTreeImageName="",this.drawTreeImageSource=void 0)))}drawTreeLine(){const{TREE_LINE:e,TREE_INDENT:t=16,TREE_ICON_SIZE:r=16,TREE_LINE_COLOR:s="#e1e6eb"}=this.ctx.config;if(!e||this.cellType!=="body"||!["tree","selection-tree","tree-selection"].includes(this.type)||this.rowspan===0||this.colspan===0)return;const o=this.ctx.database.getRowForRowKey(this.rowKey)||{},a=o.level??0,n=this.drawTreeImageX+this.drawTreeImageWidth/2,c=this.drawTreeImageY+this.drawTreeImageHeight/2;let d=this.drawTreeImageX-a*t;const u=Array.isArray(o.parentRowKeys)?o.parentRowKeys:[];if(a>0){for(let p=0;p<a-1;p+=1){const m=u[p+1];if((m?this.ctx.database.getRowForRowKey(m)||{}:{}).isLastChild)continue;const x=Math.round(this.drawTreeImageX-(a-p)*t+r/2);this.ctx.paint.drawLine([x,this.drawY,x,this.drawY+this.visibleHeight],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}const f=Math.round(this.drawTreeImageX-t+r/2),g=o.isLastChild?c:this.drawY+this.visibleHeight;this.ctx.paint.drawLine([f,this.drawY,f,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0});const v=Math.round(d+(a-1)*t+r/2);this.ctx.paint.drawLine([v,c,n,c],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}if(o.hasChildren&&o.expand){const f=this.drawTreeImageY+this.drawTreeImageHeight,g=this.drawY+this.visibleHeight;this.ctx.paint.drawLine([n,f,n,g],{borderColor:s,borderWidth:1,lineDash:[4,4],lineDashOffset:0})}}updateContainer(){const{BODY_BG_COLOR:e,EDIT_BG_COLOR:t,BODY_CELL_STYLE_METHOD:r,FOOTER_CELL_STYLE_METHOD:s,READONLY_TEXT_COLOR:o,BODY_TEXT_COLOR:a,FOOTER_TEXT_COLOR:n,FOOTER_BG_COLOR:c,HIGHLIGHT_SELECTED_ROW:d,HIGHLIGHT_SELECTED_ROW_COLOR:u,HIGHLIGHT_HOVER_ROW:f,HIGHLIGHT_HOVER_ROW_COLOR:g,STRIPE:v,STRIPE_COLOR:p}=this.ctx.config;if(this.cellType==="footer"){let S=c,$=n;if(typeof s=="function"){const k=s,{backgroundColor:T,color:I}=k({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()})||{};T&&(S=T),I&&($=I)}this.drawCellSkyBgColor="transparent",this.drawCellBgColor=S,this.drawTextColor=$;return}let m="transparent";const x=this.ctx.hoverCell,C=this.ctx.currentCell;let _=this.rowIndex,y=this.rowIndex;if(this.rowspan!==1&&(f||d)){const S=this.getSpanInfo(),{yArr:$}=S;_=$[0],y=$[1]}f&&x&&(x.rowKey===this.rowKey&&(m=g),x.rowIndex>=_&&x.rowIndex<=y&&(m=g)),d&&C&&(C.rowKey===this.rowKey&&(m=u),C.rowIndex>=_&&C.rowIndex<=y&&(m=u)),this.drawCellSkyBgColor=m;let b=e,E=a;if(this.ctx.database.getReadonly(this.rowKey,this.key)||(b=t,E=o),v&&(this.rowIndex%2?b=p:b=e),typeof r=="function"){const S=r,{backgroundColor:$,color:k}=S({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,isHasChanged:this.isHasChanged,value:this.getValue()})||{};$&&(b=$),k&&(E=k)}this.drawCellBgColor=b,this.drawTextColor=E}updateSelection(){const{visibleWidth:e,visibleHeight:t,rowspan:r,colspan:s,cellType:o,type:a,rowIndex:n,rowKey:c}=this;if(r===0||s===0||o==="footer"||!["index-selection","selection","selection-tree","tree-selection"].includes(a))return;const d=this.ctx.database.getRowSelectable(c),{CHECKBOX_SIZE:u=0,CELL_PADDING:f}=this.ctx.config;let g=this.drawX+f;(this.align==="center"||this.align==="right")&&(g=this.drawX+(e-u)/2);let v=g,p=this.drawY+(t-u)/2;if(a!=="selection-tree"&&a==="tree-selection"){const{TREE_INDENT:C=16,TREE_ICON_SIZE:_}=this.ctx.config,y=this.ctx.database.getRowForRowKey(c),{level:b=0}=y||{},E=b*C;v=g+_+E}let m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck";if(a==="selection-tree"||a==="tree-selection"){const C=this.ctx.database.getTreeSelectionState(c);C.indeterminate&&d?(m=this.ctx.icons.get("checkbox-indeterminate"),x="checkbox-indeterminate"):C.checked&&d?(m=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):!C.checked&&d?(m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled")}else{const C=this.ctx.database.getRowSelection(c);C&&d?(m=this.ctx.icons.get("checkbox-check"),x="checkbox-check"):C&&!d?(m=this.ctx.icons.get("checkbox-check-disabled"),x="checkbox-check-disabled"):!C&&d?(m=this.ctx.icons.get("checkbox-uncheck"),x="checkbox-uncheck"):(m=this.ctx.icons.get("checkbox-disabled"),x="checkbox-disabled")}v+u+f>this.drawX+this.visibleWidth||p+u+f>this.drawY+this.visibleHeight||(a==="index-selection"?(this.ctx.hoverCell&&this.ctx.hoverCell.rowIndex===n||["checkbox-disabled","checkbox-check"].includes(x))&&(this.drawSelectionImageX=v,this.drawSelectionImageY=p,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=x,this.drawSelectionImageSource=m):(this.drawSelectionImageX=v,this.drawSelectionImageY=p,this.drawSelectionImageWidth=u,this.drawSelectionImageHeight=u,this.drawSelectionImageName=x,this.drawSelectionImageSource=m))}updateHoverIcon(){if(this.ctx.database.getReadonly(this.rowKey,this.key))return;const{BODY_CELL_HOVER_ICON_METHOD:e,CELL_HOVER_ICON_SIZE:t,CELL_PADDING:r,ENABLE_MERGE_CELL_LINK:s}=this.ctx.config;if(typeof e=="function"){const a=e({row:this.row,rowIndex:this.rowIndex,colIndex:this.colIndex,column:this.column,value:this.getValue()});a!==void 0&&(this.hoverIconName=a)}const{hoverCell:o}=this.ctx;if(this.hoverIconName&&!this.ctx.editing&&o){let a=0,n=0;if(o.rowKey===this.rowKey&&(a=this.drawX+this.width-t-r,n=this.drawY+(this.height-t)/2),this.rowspan!==1&&s){const d=this.getSpanInfo(),{yArr:u}=d,f=u[0],g=u[1];if(o.rowIndex>=f&&o.rowIndex<=g){const{width:v,height:p,offsetTop:m,offsetLeft:x}=d;a=this.drawX-x+v-t-r,n=this.drawY-m+(p-t)/2}}const c=this.ctx.icons.get(this.hoverIconName);this.drawHoverImageX=a,this.drawHoverImageY=n,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 a=this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex);return this.rowspan>1?a<this.visibleHeight?0:Math.round(a-(this.visibleHeight-this.height)):Math.round(a)}if(!(this.displayText&&typeof this.displayText=="string"))return 0;const{BODY_FONT:e,CELL_PADDING:t,CELL_LINE_HEIGHT:r}=this.ctx.config,s=`${this.displayText}_${this.drawTextWidth}`,o=this.ctx.paint.calculateTextHeight(this.displayText,this.drawTextWidth,{font:e,padding:t,align:this.align,verticalAlign:this.verticalAlign,color:this.drawTextColor,autoRowHeight:this.autoRowHeight,lineHeight:r,maxLineClamp:this.maxLineClamp,cacheTextKey:s});return this.rowspan>1?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}px`,t=`${this.drawY-this.ctx.body.y}px`;return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"&&(e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`),this.cellType==="footer"&&this.ctx.config.FOOTER_FIXED&&(t=`${this.drawY-this.ctx.footer.y}px`),this.autoRowHeight&&this.ctx.database.getOverlayerAutoHeight(this.rowIndex,this.colIndex)===0&&(e="-99999px",t="-99999px"),{position:"absolute",overflow:"hidden",left:e,top:t,width:`${this.visibleWidth}px`,height:this.autoRowHeight?"auto":`${this.visibleHeight}px`,pointerEvents:"initial",userSelect:"none"}}drawContainer(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx,{drawX:s,drawY:o}=this;e.drawRect(s,o,this.visibleWidth,this.visibleHeight,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor}),e.drawRect(s,o,this.width,this.height,{borderColor:"transparent",fillColor:this.drawCellSkyBgColor}),r||this.ctx.paint.drawLine([s,o+this.visibleHeight,s+this.visibleWidth,o+this.visibleHeight],{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawAutofillPiont(){if(this.cellType==="footer")return;const{SELECT_BORDER_COLOR:e,ENABLE_AUTOFILL:t,ENABLE_SELECTOR:r,AUTOFILL_POINT_BORDER_COLOR:s}=this.ctx.config;if(!r||!t||this.ctx.editing)return;const{xArr:o,yArr:a}=this.ctx.selector,n=o[1],c=a[1],{colIndex:d,rowIndex:u,drawX:f,drawY:g}=this;if(d===n&&u===c){const v=d===this.ctx.maxColIndex||u===this.ctx.maxRowIndex||d===this.ctx.lastCenterColIndex?6:4;this.ctx.paint.drawRect(f+this.width-v,g+this.height-v,6,6,{borderColor:s,fillColor:e})}}draw(){this.drawTreeLine(),this.drawText(),this.drawImage(),this.drawSelector(),this.drawAutofillPiont(),this.drawErrorTip()}getWidthByColIndexColSpan(e,t){if(t===0)return 0;let r=0;for(let s=e;s<e+t;s++){const o=this.ctx.header.leafCellHeaders[s];r+=o.width}return r}drawText(){const{CELL_PADDING:e,BODY_FONT:t,PLACEHOLDER_COLOR:r,CELL_LINE_HEIGHT:s}=this.ctx.config,{placeholder:o}=this.column;let a=this.displayText,n=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)&&(a=o,n=r),["",null,void 0].includes(a))return!1;typeof a!="string"&&(a=`${a}`);const c=`${a}_${this.drawTextWidth}`;return this.ellipsis=this.ctx.paint.drawText(a,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:t,padding:e,align:this.align,verticalAlign:this.verticalAlign,color:n,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:r,xArrCopy:s,yArrCopy:o}=this.ctx.selector;this.drawBorder({xArr:s,yArr:o,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:this.ctx.autofill.xArr,yArr:this.ctx.autofill.yArr,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1,lineDash:[4,4]}),this.drawBorder({xArr:t,yArr:r,borderColor:this.ctx.config.SELECT_BORDER_COLOR||"rgb(82,146,247)",fillColor:"transparent",borderWidth:1});const[a,n]=t,[c,d]=r;!(a===n&&c===d)&&this.colIndex>=a&&this.colIndex<=n&&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:r}=this,s=this.drawX,o=this.drawY,a=[s+r-e-.5,o,s+r-.5,o,s+r-.5,o+e];this.ctx.paint.drawLine(a,{borderColor:t,fillColor:t,borderWidth:1,lineCap:"round",lineJoin:"round"})}drawBorder(e){const{drawX:t,drawY:r,rowIndex:s,colIndex:o,height:a,width:n}=this;let c=t,d=r;const{xArr:u,yArr:f,lineDash:g=[],borderWidth:v=1,borderColor:p,fillColor:m}=e,x=u[0],C=u[1],_=f[0],y=f[1];if(o>=x&&o<=C&&s===_){const b=o===C?1:0,E=o===x?1:0;this.ctx.paint.drawLine([c+E,d+1,c+n-b,d+1],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===C&&s>=_&&s<=y){const b=s===_?1:0,E=s===y?1:0;this.ctx.paint.drawLine([c+n-1,d+b,c+n-1,d+a-E],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o>=x&&o<=C&&s===y){const b=o===C?1:0,E=o===x?1:0;this.ctx.paint.drawLine([c+E,d+a-1,c+n-b,d+a-1],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}if(o===x&&s>=_&&s<=y){const b=s===y?1:0,E=s===_?1:0;this.ctx.paint.drawLine([c+1,d+E,c+1,d+a-b],{borderColor:p,fillColor:m,borderWidth:v,lineCap:"round",lineJoin:"round",lineDash:g})}}}class _C{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,"overlayerAutoHeightMap",new Map),h(this,"bufferCheckState",{buffer:!1,check:!1,indeterminate:!1,selectable:!0}),h(this,"sumHeight",0),h(this,"filterMethod"),h(this,"positions",[]),h(this,"sortState",new Map),this.ctx=e;const{data:r=[],columns:s=[],footerData:o=[]}=t;this.data=r,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();const t=this.getColumns(),r=mi(t);if(this.ctx.hasSelection=r.some(s=>s.type==="selection"),this.ctx.hasTree=r.some(s=>s.type==="tree"),e){this.originalDataMap.clear(),this.changedDataMap.clear(),this.validationErrorMap.clear();const{ROW_KEY:s}=this.ctx.config;s?(this.ctx.hasSelection||this.selectionMap.clear(),this.ctx.hasTree||this.expandMap.clear()):(this.selectionMap.clear(),this.expandMap.clear())}this.itemRowKeyMap=new WeakMap,this.initData(this.data),this.getData(),this.bufferCheckState.buffer=!1}clearBufferData(){this.bufferData=[]}initData(e,t=0,r=[]){const s=e.length;e.forEach((o,a)=>{var n;const{ROW_KEY:c="",DEFAULT_EXPAND_ALL:d,CELL_HEIGHT:u,SELECTABLE_METHOD:f,CHECKBOX_KEY:g}=this.ctx.config,v=o[c],p=v!=null?`${v}`:Ln();this.itemRowKeyMap.set(o,p);const m=o._height||u,x=o._readonly;let C=!0;if(typeof f=="function"&&(C=f),g){const y=o[g];if(this.checkboxKeyMap.has(y)){const b=this.checkboxKeyMap.get(y)||[];b.push(p),this.checkboxKeyMap.set(y,b)}else this.checkboxKeyMap.set(y,[p])}this.selectionMap.set(p,{key:g?o[g]:p,row:o,check:((n=this.selectionMap.get(p))==null?void 0:n.check)||!1});const _=d||this.expandMap.get(p)||o._expand||!1;this.expandMap.set(p,_),this.rowKeyMap.set(p,{readonly:x,index:a,rowIndex:a,level:t,height:m,calculatedHeight:-1,check:!1,selectable:C,expand:_,expandLazy:!1,hasChildren:o._hasChildren||(Array.isArray(o.children)?o.children.length>0:!1),expandLoading:!1,item:o,parentRowKeys:r,parentRowKey:r[r.length-1]||"",isLastChild:a===s-1}),Array.isArray(o.children)&&o.children.length&&this.initData(o.children,t+1,[...r,p])})}setRowHeight(e,t){const r=this.rowIndexRowKeyMap.get(e);if(r===void 0)return;const s=this.rowKeyMap.get(r);s.height=t,s.item._height=t,this.clearBufferData()}setBatchRowHeight(e){e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.height=r,o.item._height=r}}),this.clearBufferData()}setBatchCalculatedRowHeight(e){e.every(({height:t,rowIndex:r})=>this.getPositionForRowIndex(r).calculatedHeight===t)||(e.forEach(({rowIndex:t,height:r})=>{const s=this.rowIndexRowKeyMap.get(t);if(s){const o=this.rowKeyMap.get(s);o.calculatedHeight=r}}),this.clearBufferData(),this.getData(),this.ctx.emit("draw"))}getAllRowsData(){let e=[];const t=r=>{r.forEach(s=>{e.push(s),Array.isArray(s.children)&&t(s.children)})};return t(this.data),e}filterColumns(e){return e.reduce((t,r)=>{if(!(typeof r.hide=="function"?r.hide():r.hide)){const s={...r};s.children&&Array.isArray(s.children)&&(s.children=this.filterColumns(s.children)),t.push(s)}return t},[])}getColumns(){return this.filterColumns(this.columns)}setColumns(e){this.columns=e,this.clearBufferData()}setData(e){this.data=e,this.init()}getData(){if(this.bufferData.length>0)return{data:this.bufferData,sumHeight:this.sumHeight,positions:this.positions};let e=[],t=0;this.sumHeight=0,this.positions=[];const r=o=>{o.forEach(a=>{e.push(a);const n=this.itemRowKeyMap.get(a),{expand:c,hasChildren:d,height:u,calculatedHeight:f}=this.rowKeyMap.get(n),g=this.sumHeight,v=Math.max(f,u);this.sumHeight+=v,this.rowIndexRowKeyMap.set(t,n),this.rowKeyRowIndexMap.set(n,t),this.positions.push({top:g,height:v,bottom:this.sumHeight,calculatedHeight:f}),t+=1,c&&d&&r(a.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((a,n)=>a[1].timestamp-n[1].timestamp);s=this.sortDataRecursive(s,o)}return r(s),this.bufferData=e,{data:e,sumHeight:this.sumHeight,positions:this.positions}}setFooterData(e){this.footerData=e}getFooterData(){return this.footerData}setFilterMethod(e){this.filterMethod=e}clearFilterMethod(){this.filterMethod=void 0}getSortState(e){return this.sortState.get(e)||{direction:"none",timestamp:0}}setSortState(e,t){const r=Date.now();this.ctx.config.SORT_STRICTLY&&this.sortState.clear(),t==="none"?this.sortState.delete(e):this.sortState.set(e,{direction:t,timestamp:r}),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}clearSort(){this.sortState.clear(),this.ctx.emit("sortChange",this.sortState),this.clearBufferData(),this.ctx.emit("draw")}sortDataRecursive(e,t){let r=[...e];for(const[s,{direction:o}]of t){if(o==="none")continue;const a=this.getColumnByKey(s);!a||!a.column.sortBy||(r=this.applySingleColumnSort(r,s,o,a.column.sortBy))}return r.map(s=>(s.children&&Array.isArray(s.children)&&(s.children=this.sortDataRecursive(s.children,t)),s))}applySingleColumnSort(e,t,r,s){return e.sort((o,a)=>{const n=o[t],c=a[t];let d=0;if(typeof s=="function")d=s(o,a);else if(s==="number"){const u=Number(n)||0,f=Number(c)||0;d=u-f}else if(s==="string"){const u=String(n||""),f=String(c||"");d=u.localeCompare(f)}else s==="date"&&(d=bC(n,c));return r==="asc"?d:-d})}expandItem(e,t=!1){const r=this.rowKeyMap.get(e);r.expand=t,this.expandMap.set(e,t),this.clearBufferData(),this.ctx.emit("draw")}setExpandRowKeys(e,t=!0){this.expandMap.clear(),e.forEach(r=>{const s=this.rowKeyMap.get(r);this.expandMap.set(r,t),s.expand=t}),this.clearBufferData(),this.ctx.emit("draw")}getExpandRowKeys(){let e=[];return this.rowKeyMap.forEach((t,r)=>{t.expand&&e.push(r)}),e}expandAll(e){this.expandMap.clear(),this.rowKeyMap.forEach(t=>{t.expand=e,this.expandMap.set(t.key,e)}),this.clearBufferData(),this.ctx.emit("draw")}expandLoading(e,t=!1){const r=this.rowKeyMap.get(e);r.expandLoading=t,this.clearBufferData(),this.ctx.emit("draw")}setExpandChildren(e,t){const r=this.rowKeyMap.get(e);r.expand=!0,this.expandMap.set(e,!0),r.expandLazy=!0,r.item.children=t,this.initData(r.item.children,r.level+1),this.clearBufferData()}getIsExpandLoading(e){return this.rowKeyMap.get(e).expandLoading}getIsExpandLazy(e){return this.rowKeyMap.get(e).expandLazy}getIsExpand(e){return this.rowKeyMap.get(e).expand}getRowForRowKey(e){return this.rowKeyMap.get(e)}getRowForRowIndex(e){const t=this.getRowKeyForRowIndex(e);return this.rowKeyMap.get(t)}getRowKeyForRowIndex(e){return this.rowIndexRowKeyMap.get(e)||""}getRowKeyByItem(e){return this.itemRowKeyMap.get(e)}getRowIndexForRowKey(e){return this.rowKeyRowIndexMap.get(e)}getItemValueForRowIndexAndColIndex(e,t){if(!(this.rowIndexRowKeyMap.has(e)&&this.colIndexKeyMap.get(t)))return null;const r=this.rowIndexRowKeyMap.get(e),s=this.colIndexKeyMap.get(t);return r===void 0||s===void 0?null:{rowKey:r,key:s,value:this.getItemValue(r,s)}}getItemValue(e,t){const r=this.rowKeyMap.get(e);return r&&r.item?r.item[t]===void 0?null:r.item[t]:null}async batchSetItemValue(e,t=!1,r=!0,s="none"){let o=[],a=r;const n=new Set;let c=[],d=e.map(v=>{const{rowKey:p,key:m}=v;let x=v.value,C=x;const _=this.getRowDataItemForRowKey(p),y=this.getItemValue(p,m),b=this.getVirtualBodyCellByKey(p,m);return(b==null?void 0:b.type)==="number"&&(["",void 0,null].includes(x)?C=null:/^-?\d+(\.\d+)?$/.test(`${x}`)?C=Number(x):(C=y,c.push({...v,value:C,oldValue:y,row:_}))),{...v,value:C,oldValue:y,row:_}});if(d=d.filter(v=>!c.some(p=>v.rowKey===p.rowKey&&v.key===p.key)),c.length){const v={code:"ERR_BATCH_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:c};this.ctx.emit("error",v)}if(d=d.filter(v=>v.oldValue!==v.value),!d.length)return;const{BEFORE_VALUE_CHANGE_METHOD:u}=this.ctx.config;s==="none"&&typeof u=="function"&&(d=await u(d),a=!1),d.forEach(v=>{const{value:p,rowKey:m,key:x}=v,C=this.getItemValue(m,x);n.add(m),this.setItemValue(m,x,p,!1,!1,!1,a),o.push({rowKey:m,key:x,oldValue:C,newValue:p})});let f=[];n.forEach(v=>{f.push(this.ctx.database.getRowDataItemForRowKey(v))});const g=d.map(({rowKey:v,key:p})=>this.getValidator(v,p));Promise.all(g).then(()=>{this.validationErrorMap.size===0&&this.changedDataMap.size>0&&this.ctx.emit("validateChangedData",this.getChangedData())}),this.ctx.emit("change",d,f),t&&this.ctx.history.pushState({changeList:o,scrollX:this.ctx.scrollX,scrollY:this.ctx.scrollY,type:"multiple"}),this.ctx.emit("draw")}async setItemValue(e,t,r,s=!1,o=!1,a=!1,n=!0){if(!this.rowKeyMap.has(e))return{};const{item:c}=this.rowKeyMap.get(e);let d=c[t],u=r;if(n&&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 f=`${e}_${t}`;this.originalDataMap.has(f)||this.originalDataMap.set(f,d);const g=this.originalDataMap.get(f),v=this.getRowDataItemForRowKey(e);if(a){const p=this.getVirtualBodyCellByKey(e,t);if((p==null?void 0:p.type)==="number")if(["",void 0,null].includes(r))u=null;else if(/^-?\d+(\.\d+)?$/.test(`${r}`))u=Number(r);else{u=d;const x={code:"ERR_SET_NUMBER_VALUE",message:"Assignment failed, not a numeric type",data:[{rowKey:e,key:t,value:u,oldValue:d,row:v}]};this.ctx.emit("error",x)}if(u===d)return{oldValue:d,newValue:d};let m=[{rowKey:e,key:t,value:u,oldValue:d,row:v}];this.batchSetItemValue(m,s,!1),this.ctx.emit("editChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:g,row:v})}else this.changedDataMap.set(f,u),c[t]=u;return this.ctx.hasEvent("iterationChange")&&this.ctx.emit("iterationChange",{rowKey:e,key:t,oldValue:d,value:u,originalValue:this.originalDataMap.get(f),row:v}),o&&this.ctx.emit("draw"),{oldValue:d,newValue:u}}getRowDataItemForRowKey(e){if(!this.rowKeyMap.has(e))return{};const{item:t}=this.rowKeyMap.get(e);return t}setRowSelectionByCheckboxKey(e,t){const{CHECKBOX_KEY:r}=this.ctx.config;if(r){if(!this.rowKeyMap.has(e))return!1;const{item:s}=this.rowKeyMap.get(e),o=s[r];this.checkboxKeyMap.has(o)&&(this.checkboxKeyMap.get(o)||[]).forEach(a=>{const n=this.selectionMap.get(a);n&&(n.check=t)})}}toggleRowSelection(e,t){const r=this.rowKeyMap.get(e),s=this.selectionMap.get(e);if(!s)return;t==="selection-tree"||t==="tree-selection"?this.toggleTreeSelection(e):(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check)),this.ctx.emit("toggleRowSelection",r);const o=this.getSelectionRows();this.ctx.emit("selectionChange",o),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}toggleTreeSelection(e){const t=this.getTreeSelectionState(e),r=this.ctx.config.TREE_SELECT_MODE;if(r==="auto")t.checked&&!t.indeterminate?(this.setRowSelection(e,!1,!1),this.clearTreeSelectionRecursive(e)):(this.setRowSelection(e,!0,!1),this.selectTreeSelectionRecursive(e));else if(r==="cautious")t.checked&&!t.indeterminate?(this.setRowSelection(e,!1,!1),this.clearTreeSelectionRecursive(e)):(this.setRowSelection(e,!0,!1),this.selectTreeSelectionRecursive(e));else if(r==="strictly"){const s=this.selectionMap.get(e);s&&(s.check=!s.check,this.setRowSelectionByCheckboxKey(e,s.check))}this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}selectTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelection(t,!0,!1),this.selectTreeSelectionRecursive(t)})}clearTreeSelectionRecursive(e){this.getTreeChildren(e).forEach(t=>{this.setRowSelection(t,!1,!1),this.clearTreeSelectionRecursive(t)})}updateParentTreeSelection(e){const t=this.getTreeParent(e);if(!t)return;const r=this.getTreeChildren(t).map(c=>this.selectionMap.get(c)),s=r.filter(c=>c==null?void 0:c.check).length,o=r.length;let a=!1;o>0&&(s===0?a=!1:s===o||this.ctx.config.TREE_SELECT_MODE==="auto"?a=!0:this.ctx.config.TREE_SELECT_MODE==="cautious"&&(a=!1));const n=this.selectionMap.get(t);n&&n.check!==a&&(n.check=a,this.setRowSelectionByCheckboxKey(t,a),this.updateParentTreeSelection(t))}setRowSelection(e,t,r=!0){const s=this.selectionMap.get(e);s&&(s.check=t,this.setRowSelectionByCheckboxKey(e,s.check),this.ctx.emit("setRowSelection",t,s.row),(this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious")&&this.updateParentTreeSelection(e),r&&(this.bufferCheckState.buffer=!1,this.ctx.emit("draw")))}getSelectionRows(){let e=[];return this.selectionMap.forEach(t=>{t.check&&e.push(t.row)}),e}getRowSelection(e){const t=this.selectionMap.get(e);return t?t.check:!1}getTreeSelectionState(e){if(!this.getRowForRowKey(e))return{checked:!1,indeterminate:!1};const t=this.selectionMap.get(e),r=(t==null?void 0:t.check)||!1;if(this.getTreeChildren(e).length===0)return{checked:r,indeterminate:!1};let s=!1,o=r;if(this.ctx.config.TREE_SELECT_MODE==="auto"){const a=f=>{const g=this.getTreeChildren(f);let v=[];for(const p of g)v.push(p),v.push(...a(p));return v},n=a(e).map(f=>this.selectionMap.get(f)),c=n.filter(f=>f==null?void 0:f.check).length,d=n.length,u=c>0;s=u&&c!==d,o=r||u,r&&d>0&&c===0&&(o=!1,s=!1)}else if(this.ctx.config.TREE_SELECT_MODE==="cautious"){const a=g=>{const v=this.getTreeChildren(g);let p=[];for(const m of v)p.push(m),p.push(...a(m));return p},n=a(e).map(g=>this.selectionMap.get(g)),c=n.filter(g=>g==null?void 0:g.check).length,d=n.length,u=c>0,f=c===d;s=u&&!f,o=r||f,r&&d>0&&c===0&&(o=!1,s=!1)}else this.ctx.config.TREE_SELECT_MODE==="strictly"&&(s=!1,o=r);return{checked:o,indeterminate:s}}getTreeChildren(e){const t=this.getRowForRowKey(e);if(!t||!t.item||!t.item.children)return[];const r=[],s=o=>{for(const a of o){const n=this.getRowKeyByItem(a);n&&r.push(n),a.children&&a.children.length>0&&s(a.children)}};return s(t.item.children),r}getTreeParent(e){const t=(r,s)=>{for(const o of r){const a=this.getRowKeyByItem(o);if(o.children)for(const n of o.children){if(this.getRowKeyByItem(n)===s)return a;const c=t(o.children,s);if(c)return c}}return null};return t(this.data,e)}getRowSelectable(e){const{selectable:t,item:r,rowIndex:s}=this.rowKeyMap.get(e);return typeof t=="function"?t({row:r,rowIndex:s}):t}toggleAllSelection(){this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious"?this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;if(typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s){const o=this.selectionMap.get(r);o&&(o.check=!0,this.setRowSelectionByCheckboxKey(r,!0))}}):this.rowKeyMap.forEach((t,r)=>{let s=t.selectable;typeof s=="function"&&(s=s({row:t.item,rowIndex:t.rowIndex})),s&&this.setRowSelection(r,!0,!1)});const e=this.getSelectionRows();this.ctx.emit("toggleAllSelection",e),this.ctx.emit("selectionChange",e),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}clearSelection(e=!1){const t=this.ctx.config.TREE_SELECT_MODE==="auto"||this.ctx.config.TREE_SELECT_MODE==="cautious";e?t?this.rowKeyMap.forEach((s,o)=>{const a=this.selectionMap.get(o);a&&(a.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 r=this.getSelectionRows();this.ctx.emit("clearSelection"),this.ctx.emit("selectionChange",r),this.bufferCheckState.buffer=!1,this.ctx.emit("draw")}getCheckedState(){const{buffer:e,...t}=this.bufferCheckState;if(e)return t;const r=this.rowKeyMap.size;let s=0,o=0;const a=this.selectionMap.size,n=Array.from(this.selectionMap.values()).some(g=>g.check);this.rowKeyMap.forEach((g,v)=>{var p;(p=this.selectionMap.get(v))!=null&&p.check&&(s+=1);let m=g.selectable;typeof m=="function"&&(m=m({row:g.item,rowIndex:g.rowIndex})),m&&(o+=1)});const c=a>r&&s===0&&n,d=o&&o>s&&s>0||c,u=o!==0,f=!!o&&o===s;return this.bufferCheckState={buffer:!0,check:f,indeterminate:d,selectable:u},{check:f,indeterminate:d,selectable:u}}updateColIndexKeyMap(e=[]){this.colIndexKeyMap.clear(),e.forEach(t=>{this.colIndexKeyMap.set(t.colIndex,t.key)})}getColumnByColIndex(e){var t;const r=this.colIndexKeyMap.get(e);if(r&&this.headerMap.has(r))return(t=this.headerMap.get(r))==null?void 0:t.column}getColumnByKey(e){const t=this.headerMap.get(e);if(t)return t}getColIndexForKey(e){var t;if(e&&this.headerMap.has(e))return(t=this.headerMap.get(e))==null?void 0:t.colIndex}getColHeaderByIndex(e){const t=this.colIndexKeyMap.get(e);if(t&&this.headerMap.has(t))return this.headerMap.get(t)}getChangedData(){let e=[];return this.changedDataMap.forEach((t,r)=>{const s=this.originalDataMap.get(r),o=r.split("_")[0],a=r.split("_")[1];s!==t&&e.push({rowKey:o,colKey:a,originalValue:s,row:this.ctx.database.getRowDataItemForRowKey(o),value:t})}),e}getChangedRows(){const e=new Set;this.changedDataMap.forEach((r,s)=>{const o=this.originalDataMap.get(s),a=s.split("_")[0];o!==r&&e.add(a)});let t=[];return e.forEach(r=>{t.push(this.ctx.database.getRowDataItemForRowKey(r))}),t}isHasChangedData(e,t){const r=`${e}_${t}`;if(!this.changedDataMap.has(r))return!1;const s=this.originalDataMap.get(r),o=this.changedDataMap.get(r);return s!==o}getPositionForRowIndex(e){return e<this.positions.length?this.positions[e]:{height:0,top:0,bottom:0,calculatedHeight:0}}setHeader(e,t){return e?(this.headerMap.set(e,t),!0):!1}getReadonly(e,t){const{DISABLED:r}=this.ctx.config;if(r)return!0;const s=this.rowKeyMap.get(e),o=this.headerMap.get(t);if(!s||!o)return!0;const a=s.readonly,n=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 n||a}clearValidate(){this.validationErrorMap.clear()}hasValidationError(){return this.validationErrorMap.size!==0}getValidator(e,t){return new Promise(r=>{const s=this.rowKeyMap.get(e),o=this.headerMap.get(t),{BODY_CELL_RULES_METHOD:a}=this.ctx.config;if(o===void 0)return r([]);const n=o.column;let c=n.rules;if(typeof a=="function"){const d=a({row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:n,value:this.getItemValue(e,t)});d&&(c=d)}if(c){const d={row:s.item,rowIndex:s.rowIndex,colIndex:o.colIndex,column:n,key:t,rowKey:e,value:this.getItemValue(e,t),field:t,fieldValue:this.getItemValue(e,t)},u=new vC(c).validate(d);this.setValidationError(e,t,u),r(u)}else this.clearValidationError(e,t),r([])})}getHeightByRowIndexRowSpan(e,t){let r=0;for(let s=0;s<t;s++){const o=this.positions[e+s];o&&(r+=o.height)}return r}getSpanInfo(e){const{rowIndex:t,key:r,rowKey:s,row:o,value:a,colIndex:n,relationRowKeys:c,relationColKeys:d,rowspan:u,height:f,width:g,colspan:v,mergeRow:p,mergeCol:m}=e;if(u===1&&v===1)return{xArr:[n,n],yArr:[t,t],rowspan:u,colspan:v,height:f,width:g,offsetTop:0,offsetLeft:0,dataList:[{rowKey:s,key:r,row:o,value:a}]};let x=t,C=t,_=n,y=n,b=[],E=0,S=0,$=0,k=0;if(u!==1&&p){k=g;const T=c.reduce((I,w)=>{const A=this.getItemValue(s,w)??"";return`${I}${A}`},"");for(let I=t-1;I>=0;I--){const w=this.rowIndexRowKeyMap.get(I)||"",A=c.reduce((F,H)=>{const W=this.getItemValue(w,H)??"";return`${F}${W}`},"");if(T===A)x=I;else break}for(let I=t;I<=this.ctx.maxRowIndex;I++){const w=this.rowIndexRowKeyMap.get(I)||"",A=c.reduce((F,H)=>{const W=this.getItemValue(w,H)??"";return`${F}${W}`},"");if(T===A)C=I;else break}for(let I=x;I<t;I++){const{height:w}=this.positions[I];E+=w}for(let I=x;I<=C;I++){const{height:w}=this.positions[I];$+=w;const A=this.rowIndexRowKeyMap.get(I)||"",{item:F}=this.rowKeyMap.get(A),H=this.getItemValue(A,r);b.push({rowKey:A,key:r,value:H,row:F})}}if(v!==1&&m){$=f;for(let T=n-1;T>=0;T--){const I=this.getColumnByColIndex(T);if(!I)break;const w=this.getItemValue(s,r),A=this.getItemValue(s,I.key);if(w===A&&d.includes(I.key))_=T;else break}for(let T=n;T<=this.ctx.maxColIndex;T++){const I=this.getColumnByColIndex(T);if(!I)break;const w=this.getItemValue(s,r),A=this.getItemValue(s,I.key);if(w===A&&d.includes(I.key))y=T;else break}for(let T=_;T<n;T++){const I=this.getColumnByColIndex(T);if(!I)break;S+=I.width||100}for(let T=_;T<=y;T++){const I=this.getColumnByColIndex(T);if(!I)break;k+=I.width||100,b.push({rowKey:s,key:I.key,value:this.getItemValue(s,I.key),row:o})}}return{xArr:[_,y],yArr:[x,C],rowspan:u,colspan:v,height:$,width:k,offsetTop:E,offsetLeft:S,dataList:b}}setValidationErrorByRowIndex(e,t,r){const s=this.rowIndexRowKeyMap.get(e),o=`${s}_${t}`,a=this.getRowForRowIndex(e),n=this.getColumnByKey(t);if(!s||!n||!a)return;const c=this.getItemValue(s,t),d=[{key:t,rowKey:s,rowIndex:e,colIndex:n.colIndex,column:n.column,row:a,value:c,message:r,field:t,fieldValue:c}];this.validationErrorMap.set(o,d)}setValidationError(e,t,r){const s=`${e}_${t}`;this.validationErrorMap.set(s,r)}clearValidationError(e,t){const r=`${e}_${t}`;this.validationErrorMap.has(r)&&this.validationErrorMap.delete(r)}getValidationError(e,t){const r=`${e}_${t}`;return this.validationErrorMap.get(r)||[]}getVirtualBodyCell(e,t){const r=this.getColumnByColIndex(t),s=this.getRowForRowIndex(e);return!r||!s?void 0:new Ir(this.ctx,e,t,0,0,0,0,r,s.item,"body")}getVirtualBodyCellByKey(e,t){const r=this.getRowIndexForRowKey(e),s=this.getColIndexForKey(t);if(!(r===void 0||s===void 0))return this.getVirtualBodyCell(r,s)}hasMergeCell(e,t){let r=!1;for(let s=t[0];s<=t[1];s++)for(let o=e[0];o<=e[1];o++){const a=this.getVirtualBodyCell(s,o);if(a&&(a.rowspan!==1||a.colspan!==1)){r=!0;break}}return r}calculateMaxTreeDepth(e,t=0){let r=t;return e.forEach(s=>{if(Array.isArray(s.children)&&s.children.length>0){const o=this.calculateMaxTreeDepth(s.children,t+1);r=Math.max(r,o)}}),r}setOverlayerAutoHeightMap(e){this.overlayerAutoHeightMap=e}getOverlayerAutoHeightMap(){return this.overlayerAutoHeightMap}getOverlayerAutoHeight(e,t){const r=`${e}_${t}`;return this.overlayerAutoHeightMap.get(r)||0}}class RC{constructor(e){h(this,"ctx"),h(this,"history",[]),h(this,"historyIndex",-1),this.ctx=e,this.init()}init(){this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&!e.shiftKey&&e.code==="KeyZ"||e.metaKey&&!e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.backState();return}if(e.ctrlKey&&e.code==="KeyY"||e.ctrlKey&&e.shiftKey&&e.code==="KeyZ"||e.metaKey&&e.shiftKey&&e.code==="KeyZ"){e.preventDefault(),this.ctx.clearSelector(),this.ctx.clearAutofill(),this.forwardState();return}}})}pushState(e){const{HISTORY_NUM:t=0,ENABLE_HISTORY:r}=this.ctx.config;r&&(this.history.push(e),this.history.length>t&&this.history.splice(0,1),this.historyIndex=this.history.length-1)}backState(){if(this.historyIndex>=0){const{changeList:e,scrollX:t,scrollY:r}=this.history[this.historyIndex],s=e.map(o=>({rowKey:o.rowKey,key:o.key,value:o.oldValue,row:{}}));this.ctx.setScroll(t,r),this.ctx.database.batchSetItemValue(s,!1,!1,"back"),this.historyIndex-=1}}forwardState(){if(this.historyIndex<this.history.length-1){this.historyIndex+=1;const{changeList:e}=this.history[this.historyIndex],t=e.map(r=>({rowKey:r.rowKey,key:r.key,value:r.newValue,row:{}}));this.ctx.database.batchSetItemValue(t,!1,!1,"forward")}}clear(){this.history=[],this.historyIndex=-1}}class SC{constructor(e){h(this,"eventTasks",new Map),h(this,"ctx"),this.ctx=e,this.init()}init(){this.bind(window,"resize",this.handleResize.bind(this)),this.bind(window,"mouseup",this.handleMouseUp.bind(this)),this.bind(window,"mousemove",this.handleMousemove.bind(this)),this.bind(window,"blur",this.handleOutsideMousedown.bind(this)),this.bind(window,"mousedown",this.handleOutsideMousedown.bind(this)),this.bind(this.ctx.stageElement,"click",this.handleClick.bind(this)),this.bind(window,"keydown",this.handleKeydown.bind(this)),this.bind(this.ctx.stageElement,"wheel",this.handleWheel.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchstart",this.handleTouchstart.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"touchend",this.handleTouchend.bind(this)),this.bind(this.ctx.stageElement,"touchmove",this.handleTouchmove.bind(this),{passive:!1}),this.bind(this.ctx.stageElement,"contextmenu",this.handleContextMenu.bind(this)),this.bind(this.ctx.stageElement,"mousedown",this.handleMouseDown.bind(this)),this.bind(this.ctx.stageElement,"dblclick",this.handleDblclick.bind(this)),this.bind(this.ctx.stageElement,"mouseover",this.handleMouseover.bind(this)),this.bind(this.ctx.stageElement,"mouseout",this.handleMouseout.bind(this)),document.addEventListener("selectionchange",this.selectionchange.bind(this))}selectionchange(){this.ctx.domSelectionStr="";const e=window.getSelection();e&&e.toString()&&(this.ctx.domSelectionStr=e.toString())}clearDomSelection(){const e=window.getSelection();e&&!e.isCollapsed&&e.removeAllRanges()}destroy(){this.eventTasks.forEach((e,t)=>{this.unbind(window,t,e)}),document.removeEventListener("selectionchange",this.selectionchange.bind(this)),this.eventTasks.clear()}handleResize(e){this.ctx.emit("resetHeader",e),this.ctx.emit("resize",e)}handleMouseDown(e){this.clearDomSelection(),e.button===0&&(this.ctx.mousedown=!0),this.ctx.containerElement.focus({preventScroll:!0}),this.ctx.emit("mousedown",e)}handleMousemove(e){this.ctx.emit("mousemove",e)}handleMouseUp(e){e.button===0&&(this.ctx.mousedown=!1),this.ctx.emit("mouseup",e)}handleClick(e){this.ctx.emit("click",e)}handleKeydown(e){const{ENABLE_KEYBOARD:t}=this.ctx.config;t&&this.ctx.isTarget(e)&&this.ctx.emit("keydown",e)}handleWheel(e){this.ctx.emit("wheel",e)}handleTouchstart(e){this.ctx.emit("touchstart",e)}handleTouchend(e){this.ctx.emit("touchend",e)}handleTouchmove(e){this.ctx.emit("touchmove",e)}handleContextMenu(e){e.preventDefault(),this.ctx.emit("contextMenu",e)}handleMouseover(e){this.ctx.isMouseoverTargetContainer=!0,this.ctx.emit("mouseover",e)}handleMouseout(e){this.ctx.isMouseoverTargetContainer=!1,this.ctx.emit("mouseout",e)}handleDblclick(e){this.ctx.emit("dblclick",e)}handleOutsideMousedown(e){this.ctx.selector.enable&&(e.target instanceof Window||e.target instanceof Node&&!this.ctx.containerElement.contains(e.target))&&this.ctx.emit("outsideMousedown",e)}bind(e,t,r,s){e.addEventListener(t,r,s),this.eventTasks.set(t,r)}unbind(e,t,r){e.removeEventListener(t,r),this.eventTasks.delete(t)}}class IC{constructor(){h(this,"events",new Map)}has(e){return this.events.has(e)}on(e,t){const r=this.events.get(e)||[];r.push(t),this.events.set(e,r)}once(e,t){const r=(...s)=>{t(...s),this.off(e,r)};return this.on(e,r),this}off(e,t){const r=this.events.get(e);if(r){const s=r.indexOf(t);s>=0&&(r.splice(s,1),r.length===0?this.events.delete(e):this.events.set(e,r))}}emit(e,...t){const r=this.events.get(e);r&&r.forEach(s=>{s(...t)})}destroy(){this.events.clear()}}class TC{constructor(e){h(this,"ctx"),h(this,"textCacheMap",new Map);const t=e.getContext("2d");if(!t)throw new Error("canvas context not found");this.ctx=t}clearTextCache(){this.textCacheMap.clear()}scale(e){this.ctx.setTransform(1,0,0,1,0,0),this.ctx.scale(e,e)}save(){this.ctx.save()}restore(){this.ctx.restore()}translate(e,t){this.ctx.translate(e,t)}setCursor(e="default"){this.ctx.canvas.style.cursor=e}clear(e=0,t=0,r,s){this.ctx.clearRect(e,t,r||this.ctx.canvas.width,s||this.ctx.canvas.height)}drawShadow(e,t,r,s,o){const{fillColor:a,side:n,shadowWidth:c,colorStart:d,colorEnd:u}=o;this.ctx.save(),a&&(this.ctx.fillStyle=a,this.ctx.fillRect(e,t,r,s));let f;switch(n){case"left":f=this.ctx.createLinearGradient(e-c,t,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e-c,t,c,s);break;case"right":f=this.ctx.createLinearGradient(e+r,t,e+r+c,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e+r,t,c,s);break;case"top":f=this.ctx.createLinearGradient(e,t-c,e,t),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t-c,r,c);break;case"bottom":f=this.ctx.createLinearGradient(e,t+s,e,t+s+c),f.addColorStop(0,d),f.addColorStop(1,u),this.ctx.fillStyle=f,this.ctx.fillRect(e,t+s,r,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:r="black",borderWidth:s=1}=t;this.ctx.beginPath(),this.ctx.moveTo(e[0]-.5,e[1]-.5);for(let o=2;o<e.length;o+=2)this.ctx.lineTo(e[o]-.5,e[o+1]-.5);this.ctx.strokeStyle=r,this.ctx.lineWidth=s,t.lineDash&&(this.ctx.lineDashOffset=t.lineDashOffset??0,this.ctx.setLineDash(t.lineDash)),t.fillColor&&(this.ctx.fillStyle=t.fillColor,this.ctx.fill()),t.borderColor&&(this.ctx.strokeStyle=t.borderColor),this.ctx.stroke(),this.ctx.closePath(),this.ctx.restore()}drawImage(e,t,r,s,o){this.ctx.save(),this.ctx.drawImage(e,t,r,s,o),this.ctx.restore()}drawRect(e,t,r,s,{borderWidth:o=1,borderColor:a,fillColor:n,radius:c=0}={}){if(this.ctx.save(),this.ctx.beginPath(),n!==void 0&&(this.ctx.fillStyle=n),a!==void 0&&(this.ctx.lineWidth=o,this.ctx.strokeStyle=a),c===0)this.ctx.rect(e-.5,t-.5,r,s);else{const[d,u,f,g]=typeof c=="number"?[c,c,c,c]:c;this.ctx.moveTo(e+d,t),this.ctx.arcTo(e+r,t,e+r,t+u,u),this.ctx.arcTo(e+r,t+s,e+r-f,t+s,f),this.ctx.arcTo(e,t+s,e,t+s-g,g),this.ctx.arcTo(e,t,e+d,t,d)}n!==void 0&&this.ctx.fill(),a!==void 0&&this.ctx.stroke(),this.ctx.restore()}drawText(e="",t,r,s,o,a={}){var n;this.ctx.save();const{font:c="12px Arial",align:d="center",color:u="#495060",padding:f=0,verticalAlign:g="middle",maxLineClamp:v=1,autoRowHeight:p=!1,offsetLeft:m=0,offsetRight:x=0}=a;if(this.ctx.font=c,this.ctx.fillStyle=u,this.ctx.textAlign=d,["",null,void 0].includes(e))return this.ctx.restore(),!1;const C=parseInt(((n=c.match(/\d+/))==null?void 0:n[0])||"12")*(a.lineHeight||1.2),_=s-f*2-m-x;let y=!1;const b=Math.round((o-2*f)/C);let E=this.wrapText(e,_,a.cacheTextKey),S=Math.min(E.length,Math.max(b,1));v==="auto"&&p?S=E.length:typeof v=="number"&&v<S&&v!==1?S=v:(v===1&&(E=[e],S=1),v==="auto"&&b===1&&(E=[e],S=1));let $=r+f;const k=Math.round(S*C);g==="middle"?$=r+(o-k)/2:g==="bottom"&&($=r+o-k-f);let T=t+f+m;d==="center"?T=t+s/2:d==="right"&&(T=t+s-f-x);for(let I=0;I<E.length;I++){const w=E[I],A=$+I*C;if(this.ctx.textBaseline="top",I===S-1){const F=E.slice(I).join(""),{_text:H,ellipsis:W}=this.handleEllipsis(F,s,f,c);this.ctx.fillText(H,T,A),y=W;break}this.ctx.fillText(w,T,A)}if(a.textCallback&&E.length){const I=E.reduce((W,P)=>Math.max(W,this.ctx.measureText(P).width),0),w=Math.round(I);let A=T,F=T+w;d==="center"?(A=T-w/2,F=T+w/2):d==="right"&&(A=T-w,F=T);const H={x:T,y:$,width:w,height:k,left:A,right:F,top:$,bottom:$+k};a.textCallback(H)}return this.ctx.restore(),y}wrapText(e,t,r=""){if(!e)return[""];if(r&&this.textCacheMap.has(r))return this.textCacheMap.get(r)||[""];const s=[],o=e.split(`
|
|
4
|
+
`);for(const n of o){if(n===""){s.push("");continue}const c=n.split("");let d="";for(const u of c){const f=d+u;this.ctx.measureText(f).width<=t?d=f:d?(s.push(d),d=u):(s.push(u),d="")}d&&s.push(d)}const a=s.length>0?s:[""];return r&&this.textCacheMap.set(r,a),a}calculateTextHeight(e="",t,r={}){var s;const{font:o="12px Arial",padding:a=0,align:n="center",color:c="#495060",maxLineClamp:d=1,cacheTextKey:u=""}=r;this.ctx.save(),this.ctx.font=o,this.ctx.fillStyle=c,this.ctx.textAlign=n;const f=parseInt(((s=o.match(/\d+/))==null?void 0:s[0])||"12"),g=f*(r.lineHeight||1.2),v=t-a*2,p=this.wrapText(e,v,u);let m=1;return d==="auto"?m=p.length:p.length>d?m=d:m=p.length,this.ctx.restore(),Math.max(Math.floor(m*g+a*2),Math.floor(f+a*2))}handleEllipsis(e,t,r=0,s="12px Arial"){this.ctx.save();let o=!1,a=e;if(this.ctx.font=s,e==null||e==="")return this.ctx.restore(),{_text:"",ellipsis:o};const n=this.ctx.measureText("...").width;if(t<=n+r*2)return this.ctx.restore(),{_text:"",ellipsis:!0};const c=this.ctx.measureText(e).width,d=t-r*2;if(c&&c>=d){o=!0;let u=0;for(let f=0;f<e.length;f++)if(u+=this.ctx.measureText(e[f]).width,u>=d-n){a=e.slice(0,f)+"...",o=!0;break}}return this.ctx.restore(),{_text:a,ellipsis:o}}}class mo{constructor(e){h(this,"_config",{}),h(this,"CSS_PREFIX","e-virt-table"),h(this,"DRAW_TIME_MULTIPLIER",2),h(this,"ICONS",[]),h(this,"ROW_KEY",""),h(this,"DISABLED",!1),h(this,"HEADER_FONT","12px normal Arial"),h(this,"BODY_FONT","12px normal Arial"),h(this,"BORDER",!0),h(this,"STRIPE",!1),h(this,"STRIPE_COLOR","#fafafa"),h(this,"BORDER_COLOR","#e1e6eb"),h(this,"WIDTH",0),h(this,"HEIGHT",0),h(this,"PLACEHOLDER_COLOR","#CDD0DC"),h(this,"EMPTY_BODY_HEIGHT",120),h(this,"EMPTY_CUSTOM_STYLE",{}),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,"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_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_CONTEXT_MENU",!1),h(this,"ENABLE_COPY",!0),h(this,"ENABLE_PASTER",!0),h(this,"ENABLE_RESIZE_ROW",!0),h(this,"ENABLE_RESIZE_COLUMN",!0),h(this,"RESIZE_ROW_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_COLUMN_LINE_COLOR","#e1e6eb"),h(this,"RESIZE_ROW_MIN_HEIGHT",36),h(this,"RESIZE_COLUMN_MIN_WIDTH",40),h(this,"ENABLE_KEYBOARD",!0),h(this,"ENABLE_HISTORY",!1),h(this,"ENABLE_VALIDATOR_IMMEDIATE",!0),h(this,"HISTORY_NUM",50),h(this,"HIGHLIGHT_HOVER_ROW",!1),h(this,"HIGHLIGHT_HOVER_ROW_COLOR","rgba(186,203,231,0.1)"),h(this,"HIGHLIGHT_SELECTED_ROW",!1),h(this,"HIGHLIGHT_SELECTED_ROW_COLOR","rgba(82,146,247,0.1)"),h(this,"TOOLTIP_BG_COLOR","#303133"),h(this,"TOOLTIP_TEXT_COLOR","#fff"),h(this,"TOOLTIP_ZINDEX",3e3),h(this,"TOOLTIP_CUSTOM_STYLE",{}),h(this,"CONTEXT_MENU",[{label:"复制",value:"copy"},{label:"剪切",value:"cut"},{label:"粘贴",value:"paste"},{label:"清空选中内容",value:"clearSelected"}]),h(this,"CELL_LINE_HEIGHT",1.3),h(this,"AUTO_ROW_HEIGHT",!1),h(this,"HEADER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_STYLE_METHOD"),h(this,"FOOTER_CELL_STYLE_METHOD"),h(this,"BODY_CELL_READONLY_METHOD"),h(this,"BODY_CELL_FORMATTER_METHOD"),h(this,"BODY_CELL_RULES_METHOD"),h(this,"BODY_CELL_TYPE_METHOD"),h(this,"BODY_CELL_EDITOR_METHOD"),h(this,"BODY_CELL_RENDER_METHOD"),h(this,"BODY_CELL_HOVER_ICON_METHOD"),h(this,"SPAN_METHOD"),h(this,"SELECTABLE_METHOD"),h(this,"EXPAND_LAZY_METHOD"),h(this,"BEFORE_VALUE_CHANGE_METHOD"),h(this,"BEFORE_PASTE_DATA_METHOD"),h(this,"BEFORE_AUTOFILL_DATA_METHOD"),h(this,"BEFORE_SET_SELECTOR_METHOD"),h(this,"BEFORE_SET_AUTOFILL_METHOD"),h(this,"BEFORE_COPY_METHOD"),this._config=e,this.updateCssVar()}init(e){this._config=e,this.updateCssVar()}updateCssVar(){let e={};Object.keys(this).forEach(t=>{if(t.endsWith("_COLOR")||t.endsWith("_FONT")){const r=`--evt-${t.toLocaleLowerCase().replace(/_/g,"-")}`,s=CC(r);s&&(e[t]=s)}}),Object.assign(this,e,this._config)}}const xo='<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>',wo='<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>',Tr='<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>',OC=Tr.replace('fill="currentColor" p-id="2016"','fill="#bec4c7" p-id="2016"'),$C=Tr.replace('fill="currentColor" p-id="2015"','fill="#bec4c7" p-id="2015"');class kC{constructor(e){h(this,"ctx"),h(this,"list",[{name:"loading",configName:"LOADING_ICON_SVG",configColorName:"LOADING_ICON_COLOR",svg:'<svg t="1724133395728" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="2893" width="32" height="32"><path d="M512 226.8476541a19.82487759 19.82487759 0 0 1 14.66497778 5.70304692c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497779v122.20814825a19.82487759 19.82487759 0 0 1-5.70304693 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304691 19.82487759 19.82487759 0 0 1-14.66497778-5.70304691 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778v-122.20814825a19.82487759 19.82487759 0 0 1 5.70304693-14.66497779 19.82487759 19.82487759 0 0 1 14.66497778-5.70304692z m0 407.36049415a19.82487759 19.82487759 0 0 1 14.66497778 5.70304691c3.80203107 3.82918865 5.70304692 8.71751457 5.70304693 14.66497778v122.20814827a19.82487759 19.82487759 0 0 1-5.70304693 14.66497776 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693 19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497776v-122.20814827a19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304691zM797.1523459 512a19.82487759 19.82487759 0 0 1-5.70304692 14.66497778 19.82487759 19.82487759 0 0 1-14.66497779 5.70304693h-122.20814825a19.82487759 19.82487759 0 0 1-14.66497778-5.70304693 19.82487759 19.82487759 0 0 1-5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 5.70304691-14.66497778 19.82487759 19.82487759 0 0 1 14.66497778-5.70304693h122.20814825a19.82487759 19.82487759 0 0 1 14.66497779 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304692 14.66497778z m-407.36049415 0a19.82487759 19.82487759 0 0 1-5.70304691 14.66497778 19.82487759 19.82487759 0 0 1-14.66497778 5.70304693h-122.20814827a19.82487759 19.82487759 0 0 1-14.66497776-5.70304693 19.82487759 19.82487759 0 0 1-5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 5.70304693-14.66497778 19.82487759 19.82487759 0 0 1 14.66497776-5.70304693h122.20814827a19.82487759 19.82487759 0 0 1 14.66497778 5.70304693c3.80203107 3.82918865 5.70304692 8.71751457 5.70304691 14.66497778zM310.22076878 310.22076878a21.29137537 21.29137537 0 0 1 14.66497779-5.70304693c5.51294514 0 10.18401235 1.90101585 14.01320099 5.70304693l86.55052591 86.57768347a20.91117183 20.91117183 0 0 1 5.73020449 14.31193182 19.28172983 19.28172983 0 0 1-6.05609289 14.013201 19.11878565 19.11878565 0 0 1-14.013201 6.05609289 20.96548698 20.96548698 0 0 1-14.31193182-5.70304692L310.22076878 338.87178998a19.06447114 19.06447114 0 0 1-5.70304693-14.01320099c0-5.54010272 1.90101585-10.42842865 5.70304693-14.66497778z m288.32975775 288.32975775a19.79772001 19.79772001 0 0 1 14.3390894-6.35482371c5.29568642 0 10.04822572 2.11827457 14.31193182 6.38198066l86.57768347 86.55052651c3.80203107 3.80203107 5.70304692 8.47309828 5.70304691 14.01320102a19.55330372 19.55330372 0 0 1-6.05609225 14.31193182 19.66193339 19.66193339 0 0 1-14.31193245 6.05609288 19.01015661 19.01015661 0 0 1-14.01320099-5.70304692l-86.55052591-86.57768347a19.79772001 19.79772001 0 0 1-6.38198129-14.31193245c0-5.29568642 2.11827457-10.07538268 6.38198129-14.33908939zM713.77923122 310.22076878c3.80203107 4.26370672 5.70304692 9.15203265 5.70304693 14.66497779s-1.90101585 10.18401235-5.70304693 14.01320099l-86.57768347 86.55052591a20.91117183 20.91117183 0 0 1-14.31193182 5.73020449 19.28172983 19.28172983 0 0 1-14.013201-6.05609289 19.11878565 19.11878565 0 0 1-6.05609289-14.013201c0-5.29568642 1.90101585-10.07538268 5.70304692-14.31193182l86.57768348-86.57768347c3.80203107-3.80203107 8.50025585-5.70304692 14.01320099-5.70304693 5.54010272 0 10.40127108 1.90101585 14.66497779 5.70304693zM425.44947347 598.57768347a19.79772001 19.79772001 0 0 1 6.35482371 14.33908939c0 5.29568642-2.11827457 10.04822572-6.38198066 14.31193245L338.89894756 713.77923122a19.06447114 19.06447114 0 0 1-14.01320099 5.70304693 19.55330372 19.55330372 0 0 1-14.31193245-6.05609227 19.68909035 19.68909035 0 0 1-6.05609227-14.31193245 19.01015661 19.01015661 0 0 1 5.70304693-14.01320099l86.57768347-86.55052591a19.79772001 19.79772001 0 0 1 14.31193182-6.38198129c5.29568642 0 10.07538268 2.11827457 14.3390894 6.38198129z" fill="#000000" fill-opacity=".65" p-id="2894"></path></svg>',color:"#4E5969"},{name:"expand",configName:"EXPAND_ICON_SVG",configColorName:"EXPAND_ICON_COLOR",svg:'<svg t="1724122015492" class="icon" viewBox="0 0 1024 1024" version="1.1" xmlns="http://www.w3.org/2000/svg" p-id="4237" width="32" height="32"><path d="M401.472 316.992l159.04 217.664L591.488 512l-30.976-22.656-159.04 217.728q-2.24 3.008-3.84 6.464-1.6 3.456-2.496 7.104-0.896 3.648-1.024 7.424-0.192 3.84 0.384 7.552 0.64 3.712 1.92 7.296 1.28 3.52 3.2 6.784 1.984 3.2 4.544 6.016 2.56 2.752 5.632 4.992 3.072 2.24 6.464 3.84 3.456 1.6 7.168 2.496 3.648 0.896 7.424 1.024 3.776 0.192 7.488-0.448 3.776-0.576 7.296-1.856 3.584-1.28 6.784-3.264 3.2-1.92 6.016-4.48 2.816-2.56 5.056-5.632l159.04-217.728q3.584-4.928 5.504-10.752 1.92-5.76 1.92-11.904 0-6.08-1.92-11.904-1.92-5.76-5.504-10.752L463.488 271.68q-2.24-3.072-5.056-5.632-2.752-2.56-6.016-4.48-3.2-1.984-6.784-3.328-3.52-1.28-7.296-1.856-3.712-0.576-7.488-0.448-3.84 0.192-7.424 1.088-3.712 0.896-7.168 2.496-3.392 1.6-6.4 3.84-3.136 2.176-5.696 4.992-2.56 2.752-4.48 6.016-1.984 3.2-3.264 6.784-1.28 3.52-1.92 7.296-0.576 3.712-0.384 7.488 0.128 3.84 1.024 7.488 0.896 3.648 2.496 7.04 1.6 3.456 3.84 6.528z m30.976-61.056q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.24-3.52 1.408-6.656 3.52-3.2 2.112-5.824 4.8-2.688 2.624-4.8 5.76-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.232 1.408 3.456 3.52 6.592 2.112 3.2 4.8 5.824 2.688 2.688 5.76 4.8 3.2 2.112 6.72 3.52 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.408 6.592-3.52 3.2-2.112 5.824-4.8 2.688-2.688 4.8-5.76 2.112-3.2 3.52-6.656 1.472-3.52 2.24-7.232 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.456-3.52-6.592-2.112-3.2-4.8-5.824-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.52-3.52-1.472-7.232-2.24Q436.224 256 432.448 256z m0 435.392q-3.776 0-7.488 0.704-3.712 0.768-7.168 2.176-3.52 1.472-6.656 3.584-3.2 2.112-5.824 4.736-2.688 2.688-4.8 5.824-2.112 3.2-3.52 6.656-1.472 3.52-2.176 7.232-0.768 3.712-0.768 7.488 0 3.776 0.768 7.488 0.704 3.712 2.176 7.168 1.408 3.52 3.52 6.656 2.112 3.2 4.8 5.76 2.688 2.752 5.76 4.8 3.2 2.112 6.72 3.584 3.456 1.472 7.168 2.176 3.712 0.768 7.488 0.768 3.84 0 7.488-0.768 3.712-0.704 7.232-2.176 3.456-1.472 6.592-3.584 3.2-2.048 5.824-4.736 2.688-2.688 4.8-5.824 2.112-3.2 3.52-6.656 1.472-3.456 2.24-7.168 0.704-3.712 0.704-7.488 0-3.84-0.704-7.488-0.768-3.712-2.24-7.232-1.408-3.52-3.52-6.656-2.112-3.136-4.8-5.76-2.624-2.688-5.76-4.8-3.2-2.112-6.656-3.584-3.52-1.408-7.232-2.176-3.712-0.704-7.488-0.704z" p-id="4238"></path></svg>',color:"#4E5969"},{name:"shrink",configName:"SHRINK_ICON_SVG",configColorName:"SHRINK_ICON_COLOR",svg:wo,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:xo,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:xo,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:wo,color:"#4E5969"},{name:"sort-asc",configName:"SORT_ASC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:OC,color:"rgb(82,146,247)"},{name:"sort-desc",configName:"SORT_DESC_ICON_SVG",configColorName:"SORT_ICON_COLOR",svg:$C,color:"rgb(82,146,247)"},{name:"sort-default",configName:"SORTABLE_ICON_SVG",svg:Tr,color:"#bec4c7"}]),h(this,"icons",new Map),this.ctx=e,this.init()}async init(){const e=[];for(let t=0;t<this.list.length;t++){const r=this.list[t];let s=r.color,o=r.svg;if(r.configColorName){const n=this.ctx.config[r.configColorName];n&&(s=n)}if(r.configName){const n=this.ctx.config[r.configName];n&&(o=n)}const a=this.createImageFromSVG(o,s).then(n=>{this.icons.set(r.name,n)});e.push(a)}for(let t=0;t<this.ctx.config.ICONS.length;t++){const r=this.ctx.config.ICONS[t];let s=r.color;const o=this.createImageFromSVG(r.svg,s,r.isBlob).then(a=>{this.icons.set(r.name,a)});e.push(o)}await Promise.all(e),this.ctx.emit("draw")}async createImageFromSVG(e,t,r=!1){const s=new DOMParser().parseFromString(e,"image/svg+xml").documentElement;t&&s.querySelectorAll("*").forEach(n=>{const c=n.getAttribute("fill");(c==="currentColor"||c===null)&&n.setAttribute("fill",t)});const o=new Image;let a="";if(r){const n=new Blob([new XMLSerializer().serializeToString(s)],{type:"image/svg+xml"});a=URL.createObjectURL(n)}else a="data:image/svg+xml;charset=utf-8,"+encodeURIComponent(new XMLSerializer().serializeToString(s));return o.src=a,new Promise((n,c)=>{o.onerror=()=>c(new Error("Failed to load image:"+e)),o.onload=()=>{n(o)}})}get(e){return this.icons.get(e)}getSvg(e){return this.list.find(t=>t.name===e)}}class rr extends Bn{constructor(e,t,r,s,o,a,n){super(e,r,s,o,a,"header",n.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,"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,"drawSelectionImageX",0),h(this,"drawSelectionImageY",0),h(this,"drawSelectionImageWidth",0),h(this,"drawSelectionImageHeight",0),h(this,"drawSelectionImageName",""),h(this,"drawSelectionImageSource"),h(this,"drawSortImageX",0),h(this,"drawSortImageY",0),h(this,"drawSortImageWidth",0),h(this,"drawSortImageHeight",0),h(this,"drawSortImageName",""),h(this,"drawSortImageSource"),this.ctx=e,this.x=r,this.y=s,this.width=o,this.height=a,this.visibleWidth=o,this.visibleHeight=a,this.colIndex=t,this.key=n.key,this.minWidth=n.minWidth,this.maxWidth=n.maxWidth,this.type=n.type||"",this.editorType=n.editorType||"text",this.hideHeaderSelection=n.hideHeaderSelection||!1,this.align=n.headerAlign||n.align||this.ctx.config.COLUMNS_ALIGN,this.verticalAlign=n.headerVerticalAlign||n.verticalAlign||this.ctx.config.COLUMNS_VERTICAL_ALIGN,this.fixed=n.fixed,this.level=n.level||0,this.operation=n.operation||!1,this.text=n.title,this.column=n,this.colspan=n.colspan||1,this.widthFillDisable=n.widthFillDisable||!1,this.rowspan=n.rowspan||1,this.rules=n.rules,this.readonly=n.readonly||!1,this.required=n.required||!1,this.sortIconName=n.sortIconName||"sort-default",this.sortAscIconName=n.sortAscIconName||"sort-asc",this.sortDescIconName=n.sortDescIconName||"sort-desc",this.rowKey=Ln(),this.overflowTooltipShow=n.overflowTooltipHeaderShow!==!1,this.hasChildren=n.children&&n.children.length>0||!1,this.render=n.renderHeader,this.maxLineClampHeader=n.maxLineClampHeader||"auto"}isVerticalVisible(){const{stageHeight:e}=this.ctx,t=e;return!(this.y+this.height<=0||this.y>=t)}updateStyle(){this.style=this.getOverlayerViewsStyle()}updateContainer(){const{HEADER_CELL_STYLE_METHOD:e,HEADER_BG_COLOR:t,HEADER_TEXT_COLOR:r}=this.ctx.config;let s=t,o=r;if(typeof e=="function"){const a=e,{backgroundColor:n,color:c}=a({colIndex:this.colIndex,column:this.column})||{};n&&(s=n),c&&(o=c)}this.drawCellBgColor=s,this.drawTextColor=o}update(){this.updateContainer(),this.displayText=this.getText(),this.drawX=this.getDrawX(),this.drawY=this.getDrawY(),this.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.drawSelector(),this.drawSortIcon()}drawEdge(){const{paint:e,config:{BORDER_COLOR:t,BORDER:r}}=this.ctx;e.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:r?t:"transparent",fillColor:this.drawCellBgColor})}drawText(){const{paint:e,config:{HEADER_FONT:t,CELL_PADDING:r,REQUIRED_COLOR:s}}=this.ctx,o=`${this.displayText}_${this.drawTextWidth}`;this.ellipsis=e.drawText(this.displayText,this.drawTextX,this.drawTextY,this.drawTextWidth,this.drawTextHeight,{font:t,padding:r,color:this.drawTextColor,align:this.align,verticalAlign:this.verticalAlign,maxLineClamp:this.maxLineClampHeader,offsetRight:this.column.sortBy?16:0,offsetLeft:this.required?12:0,cacheTextKey:o,textCallback:a=>{this.column.sortBy&&(this.drawSortImageX=a.right+4,this.drawSortImageY=a.top+(a.height-16)/2),this.required&&e.drawText("*",a.left-18,a.top+(a.height-12)/2,24,24,{color:s,font:"18px Arial",align:"center",verticalAlign:"middle",padding:0})}})}drawSelector(){const{ENABLE_SELECTOR:e}=this.ctx.config;if(!e)return;const{xArr:t}=this.ctx.selector,[r,s]=t;this.colIndex>=r&&this.colIndex<=s&&this.ctx.paint.drawRect(this.drawX,this.drawY,this.width,this.height,{borderColor:"transparent",fillColor:this.ctx.config.SELECT_ROW_COL_BG_COLOR||"transparent"})}drawSelection(){if(!this.hideHeaderSelection&&["index-selection","selection","selection-tree","tree-selection"].includes(this.type)){const{indeterminate:e,check:t,selectable:r}=this.ctx.database.getCheckedState(),{CHECKBOX_SIZE:s=0,CELL_PADDING:o}=this.ctx.config;let a=this.drawX+(this.width-s)/2,n=this.drawY+(this.height-s)/2;this.drawTextX=a+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX,(this.align==="left"||this.align==="right")&&(a=this.drawX+o,this.drawTextX=a+s-o/2,this.drawTextWidth=this.drawX+this.visibleWidth-this.drawTextX),this.verticalAlign==="top"?n=this.drawY+o/2:this.verticalAlign==="bottom"&&(n=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&&r?(c=this.ctx.icons.get("checkbox-check"),d="checkbox-check"):t&&!r?(c=this.ctx.icons.get("checkbox-check-disabled"),d="checkbox-check-disabled"):!t&&r?(c=this.ctx.icons.get("checkbox-uncheck"),d="checkbox-uncheck"):(c=this.ctx.icons.get("checkbox-disabled"),d="checkbox-disabled"),c&&(this.drawSelectionImageX=a,this.drawSelectionImageY=n,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 r=this.ctx.database.getSortState(this.key);r.direction==="asc"?t=this.sortAscIconName:r.direction==="desc"&&(t=this.sortDescIconName);const s=this.ctx.icons.get(t);s&&(this.drawSortImageWidth=e,this.drawSortImageHeight=e,this.drawSortImageName=t,this.drawSortImageSource=s,this.ctx.paint.drawImage(this.drawSortImageSource,this.drawSortImageX,this.drawSortImageY,this.drawSortImageWidth,this.drawSortImageHeight))}getText(){return this.render||["",null,void 0].includes(this.text)?"":`${this.text}`}getOverlayerViewsStyle(){let e="";return this.fixed==="left"?e=`${this.drawX}px`:this.fixed==="right"?e=`${this.drawX-(this.ctx.stageWidth-this.ctx.fixedRightWidth)}px`:e=`${this.drawX-this.ctx.fixedLeftWidth}px`,{position:"absolute",overflow:"hidden",left:e,top:`${this.drawY+1}px`,width:`${this.width}px`,height:`${this.height-2}px`,pointerEvents:"initial",userSelect:"none"}}}class LC{constructor(e){h(this,"ctx"),h(this,"visibleHoverCell"),h(this,"resizeObserver"),h(this,"mutationObserver"),this.ctx=e,this.init()}init(){this.resizeObserver=new ResizeObserver(()=>{this.ctx.emit("resetHeader"),this.ctx.emit("resizeObserver")}),this.resizeObserver.observe(this.ctx.containerElement),this.mutationObserver=new MutationObserver(e=>{for(const t of e)t.type==="attributes"&&t.attributeName==="class"&&(this.ctx.config.updateCssVar(),this.ctx.emit("draw"))}),this.ctx.config.ENABLE_AUTO_THEME&&this.mutationObserver.observe(document.documentElement,{attributes:!0,attributeFilter:["class"]}),this.ctx.on("mousedown",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.focusCellHeader=a,this.ctx.emit("cellHeaderMousedown",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.setFocusCell(a),this.ctx.emit("cellMousedown",a,e)})}),this.ctx.on("mouseup",e=>{if(e.button!==0||this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.focusCellHeader=a,this.ctx.emit("cellHeaderMouseup",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.setFocusCell(a),this.ctx.emit("cellMouseup",a,e)})}),this.ctx.on("click",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.clickCellHeader=s,this.ctx.emit("cellHeaderClick",s,e),this.selectionClick(s,e),this.sortClick(s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellClick",s,e),this.selectionClick(s,e),this.treeClick(s,e)},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.hoverIconClick(s)},!1)}),this.ctx.on("dblclick",e=>{if(e.button!==0||this.isBusy(e))return;const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderDblclick",s,e)}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.ctx.clickCell=s,this.ctx.emit("cellDblclick",s,e)})}),this.ctx.on("contextMenu",e=>{if(this.isBusy(e))return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;this.handleHeaderEvent(o,s,this.ctx.header.renderCellHeaders,a=>{this.ctx.emit("cellHeaderContextMenuClick",a,e)}),this.handleBodyEvent(o,s,this.ctx.body.renderRows,a=>{this.ctx.emit("cellContextMenuClick",a,e)})}),this.ctx.on("mouseout",e=>{!this.ctx.containerElement.contains(e.relatedTarget)&&this.ctx.hoverCell!==void 0&&(this.ctx.hoverRow=void 0,this.ctx.hoverCell=void 0,this.ctx.emit("draw"))}),this.ctx.on("mousemove",e=>{if(this.isBusy(e))return;this.ctx.isPointer=!1,this.ctx.stageElement.style.cursor==="pointer"&&(this.ctx.stageElement.style.cursor="default");const t=this.ctx.getOffset(e).offsetY,r=this.ctx.getOffset(e).offsetX;this.handleHeaderEvent(r,t,this.ctx.header.renderCellHeaders,s=>{this.ctx.emit("cellHeaderMouseenter",s,e),this.ctx.hoverCellHeader&&this.ctx.hoverCellHeader!==s&&this.ctx.emit("cellHeaderMouseleave",this.ctx.hoverCellHeader,e),this.imageEnterAndLeave(s,e),this.ctx.hoverCellHeader!==s&&(this.ctx.hoverCellHeader=s,this.visibleHoverCell=void 0,this.ctx.emit("cellHeaderHoverChange",s,e))}),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{this.imageEnterAndLeave(s,e),this.visibleHoverCell!==s&&(this.ctx.emit("visibleCellMouseleave",s,e),this.visibleHoverCell=s,this.ctx.hoverCellHeader=void 0,this.ctx.emit("visibleCellHoverChange",s,e))},!0),this.handleBodyEvent(r,t,this.ctx.body.renderRows,s=>{var 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(a=>a.rowKey===s.rowKey),this.ctx.emit("rowHoverChange",this.ctx.hoverRow,s,e),this.ctx.emit("drawView")),this.ctx.hoverCell=s,this.ctx.emit("cellHoverChange",s,e))})})}hoverIconClick(e){e.hoverIconName&&this.ctx.isPointer&&this.ctx.emit("hoverIconClick",e)}selectionClick(e,t){if(!(["selection","index-selection","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(this.isInsideElement(a,o,e.drawSelectionImageX,e.drawSelectionImageY,e.drawSelectionImageWidth,e.drawSelectionImageHeight))if(e instanceof rr)e.drawSelectionImageName==="checkbox-uncheck"||e.drawSelectionImageName==="checkbox-indeterminate"?this.ctx.database.toggleAllSelection():e.drawSelectionImageName==="checkbox-check"&&this.ctx.database.clearSelection(!0);else{if(!this.ctx.database.getRowSelectable(e.rowKey))return;this.ctx.database.toggleRowSelection(e.rowKey,e.type)}}treeClick(e,t){if(!(["tree","selection-tree","tree-selection"].includes(e.type)&&this.ctx.isPointer))return;const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(!this.isInsideElement(a,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight))return;const n=this.ctx.database.getRowForRowKey(e.rowKey),{expand:c=!1,expandLazy:d=!1}=n||{},{EXPAND_LAZY:u,EXPAND_LAZY_METHOD:f}=this.ctx.config;if(u&&f&&!c&&!d)typeof f=="function"&&(this.ctx.database.expandLoading(e.rowKey,!0),f({row:e.row,rowIndex:e.rowIndex,colIndex:e.colIndex,column:e.column,value:e.getValue()}).then(g=>{this.ctx.database.setExpandChildren(e.rowKey,g),this.ctx.database.expandLoading(e.rowKey,!1),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}).catch(g=>{this.ctx.database.expandLoading(e.rowKey,!1),console.error(g)}));else{const g=this.ctx.database.getIsExpand(e.rowKey);this.ctx.database.expandItem(e.rowKey,!g),this.ctx.emit("expandChange",this.ctx.database.getExpandRowKeys())}}sortClick(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(!this.isInsideElement(a,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight))return;const n=this.ctx.database.getSortState(e.key);let c;n.direction==="none"?c="asc":n.direction==="asc"?c="desc":c="none",this.ctx.database.setSortState(e.key,c)}imageEnterAndLeave(e,t){const{offsetY:r,offsetX:s}=this.ctx.getOffset(t),o=r,a=s;if(e instanceof rr){if(e.drawSelectionImageSource&&this.isInsideElement(a,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(a,o,e.drawSortImageX,e.drawSortImageY,e.drawSortImageWidth,e.drawSortImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}if(e instanceof Ir){if(e.drawSelectionImageSource&&this.isInsideElement(a,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(a,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(a,o,e.drawTreeImageX,e.drawTreeImageY,e.drawTreeImageWidth,e.drawTreeImageHeight)){this.ctx.stageElement.style.cursor="pointer",this.ctx.isPointer=!0;return}}}isInsideElement(e,t,r,s,o,a){return e>r&&e<r+o&&t>s&&t<s+a}isBusy(e){const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r;if(this.ctx.loading||!this.ctx.isTarget(e)||this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize"||this.ctx.columnResizing||this.ctx.rowResizing)return!0;const{SCROLLER_TRACK_SIZE:a}=this.ctx.config;return!!(this.ctx.scrollerMove||this.ctx.scrollerFocus||s>this.ctx.stageHeight-a||o>this.ctx.stageWidth-a)}handleBodyEvent(e,t,r,s,o=!1){if(this.isInsideBody(t))for(const a of r){const n=a.fixedCells.concat(a.noFixedCells);for(const c of n){const d=c.getDrawX(),u=c.getDrawY();if(o){if(e>d&&e<d+c.visibleWidth&&t>u&&t<u+c.visibleHeight){s(c);return}}else if(e>d&&e<d+c.width&&t>u&&t<u+c.height){s(c);return}}}}handleHeaderEvent(e,t,r,s){for(const o of r){const a=o.getDrawX(),n=o.getDrawY();if(e>a&&e<a+o.width&&t>n&&t<n+o.height){s(o);return}}}isInsideBody(e){return e>this.ctx.body.y&&e<this.ctx.body.y+this.ctx.body.visibleHeight}destroy(){this.resizeObserver.unobserve(this.ctx.stageElement),this.mutationObserver.disconnect()}}class DC{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,"rowResizing",!1),h(this,"columnResizing",!1),h(this,"scrollerMove",!1),h(this,"scrollerFocus",!1),h(this,"autofillMove",!1),h(this,"selectorMove",!1),h(this,"selectColsIng",!1),h(this,"selectRowsIng",!1),h(this,"adjustPositioning",!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,"body",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,headIndex:0,tailIndex:0,visibleRows:[],renderRows:[],data:[]}),h(this,"footer",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,renderRows:[]}),h(this,"header",{x:0,y:0,width:0,height:0,visibleHeight:0,visibleWidth:0,visibleLeafColumns:[],leafCellHeaders:[],renderLeafCellHeaders:[],renderCellHeaders:[],fixedLeftCellHeaders:[],fixedRightCellHeaders:[],renderCenterCellHeaders:[]}),h(this,"selector",{enable:!1,xArr:[-1,-1],yArr:[-1,-1],xArrCopy:[-1,-1],yArrCopy:[-1,-1]}),h(this,"autofill",{enable:!1,xArr:[-1,-1],yArr:[-1,-1]}),h(this,"database"),h(this,"history"),h(this,"config"),h(this,"drawTime",0);const{containerElement:r,stageElement:s,canvasElement:o,overlayerElement:a,editorElement:n,emptyElement:c,loadingElement:d,contextMenuElement:u}=e;this.containerElement=r,s.tabIndex=0,this.stageElement=s,this.canvasElement=o,this.overlayerElement=a,this.editorElement=n,this.emptyElement=c,this.loadingElement=d,this.contextMenuElement=u,this.config=new mo(t.config||{}),this.eventBus=new IC,this.eventBrowser=new SC(this),this.eventTable=new LC(this),this.paint=new TC(this.canvasElement),this.database=new _C(this,t),this.history=new RC(this),this.icons=new kC(this)}setConfig(e){this.config=new mo(e)}setItemValueByEditor(e,t,r,s=!0,o=!0,a=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const n=this.database.getVirtualBodyCellByKey(e,t);if(n&&(n.mergeRow||n.mergeCol)){const{dataList:c}=n.getSpanInfo(),d=c.map(u=>({...u,value:r}));this.database.batchSetItemValue(d,s,a);return}}this.database.setItemValue(e,t,r,s,o,!0,a)}batchSetItemValueByEditor(e,t=!0,r=!0){if(this.config.ENABLE_MERGE_CELL_LINK){const s=[];e.forEach(o=>{const a=this.database.getRowIndexForRowKey(o.rowKey),n=this.database.getColIndexForKey(o.key);if(a===void 0||n===void 0)return;const c=this.database.getVirtualBodyCell(a,n);if(c){const{dataList:d}=c.getSpanInfo(),u=d.map(f=>({...f,value:o.value}));s.push(...u)}}),this.database.batchSetItemValue(s,t,r)}else this.database.batchSetItemValue(e,t,r)}setFocusCell(e){var t;if(this.focusCell!==e){if(((t=this.focusCell)==null?void 0:t.rowKey)!==e.rowKey){this.currentCell=e,this.emit("rowFocusChange",e);const r={rowIndex:e.rowIndex,rowKey:e.rowKey,row:e.row};this.emit("currentRowChange",r)}this.focusCell=e,this.emit("cellFocusChange",e)}}clearSelector(){this.selector.enable=!1,this.selector.xArr=[-1,-1],this.selector.yArr=[-1,-1],this.emit("clearSelector")}clearSelectorCopy(){this.selector.xArrCopy=[-1,-1],this.selector.yArrCopy=[-1,-1]}clearAutofill(){this.autofill={enable:!1,xArr:[-1,-1],yArr:[-1,-1]}}getSelectedData(){const e=[],t=this.selector.yArr,r=this.selector.xArr;let s="";for(let o=0;o<=t[1]-t[0];o++){const a=[];for(let n=0;n<=r[1]-r[0];n++){const c=o+t[0],d=n+r[0],u=this.database.getVirtualBodyCell(c,d);u&&(u.selectorCellValueType==="displayText"?a.push(u.displayText):a.push(u.getValue()))}s+=`${a.join(" ")}\r`,e.push(a)}return s=s?s.replace(/\r$/,""):" ",{xArr:r,yArr:t,text:s,value:e}}setScroll(e,t){let r=Math.floor(e);const s=this.body.width-this.body.visibleWidth;r<0?r=0:r>s&&(r=s);let o=Math.floor(t),a=this.body.height-this.body.visibleHeight;this.config.FOOTER_FIXED||(a=this.body.height+this.footer.height-this.body.visibleHeight),o<0?o=0:o>a&&(o=a),this.emit("setScroll",r,o)}setScrollX(e){let t=Math.floor(e);const r=this.body.width-this.body.visibleWidth;t<0?t=0:t>r&&(t=r),this.emit("setScrollX",t)}setScrollY(e){let t=Math.floor(e),r=0;this.config.FOOTER_FIXED||(r=this.footer.height);const s=this.body.height-this.body.visibleHeight+r;t<0?t=0:t>s&&(t=s),this.emit("setScrollY",t)}startAdjustPosition(e){this.emit("startAdjustPosition",e)}stopAdjustPosition(){this.emit("stopAdjustPosition")}isTarget(e){return!!this.containerElement.contains(e.target)}getOffset(e){const{left:t,top:r}=this.containerElement.getBoundingClientRect();return{offsetX:e.clientX-t,offsetY:e.clientY-r}}hasEvent(e){return this.eventBus.has(e)}on(e,t){this.eventBus.on(e,t)}once(e,t){this.eventBus.once(e,t)}off(e,t){this.eventBus.off(e,t)}emit(e,...t){this.eventBus.emit(e,...t)}destroy(){this.eventTable.destroy(),this.eventBrowser.destroy(),this.eventBus.destroy()}}class yo{constructor(e,t){h(this,"ctx"),h(this,"type"),h(this,"isFocus",!1),h(this,"trackX",0),h(this,"trackY",0),h(this,"trackWidth",0),h(this,"trackHeight",0),h(this,"splitPoints",[]),h(this,"barX",0),h(this,"barY",0),h(this,"barWidth",0),h(this,"barHeight",0),h(this,"distance",0),h(this,"visibleDistance",0),h(this,"clientX",0),h(this,"clientY",0),h(this,"dragStart",0),h(this,"isDragging",!1),h(this,"scroll",0),this.ctx=e,this.type=t,this.type==="vertical"?this.scroll=this.ctx.scrollY:this.scroll=this.ctx.scrollX}onWheel(e){this.updateScroll(e)}onTouchmove(e){const{clientY:t,clientX:r}=e.touches[0],s=t-this.clientY,o=r-this.clientX;let a=0;this.type==="vertical"?(a=Math.max(0,Math.min(this.dragStart-s,this.distance)),this.hasScrollbar()&&!(a===0&&s>0||a===this.distance&&s<0)&&e.preventDefault()):this.type==="horizontal"&&(a=Math.max(0,Math.min(this.dragStart-o,this.distance))),this.scroll=a}onTouchstart(e){const{clientY:t,clientX:r}=e.touches[0];this.clientX=r,this.clientY=t,this.dragStart=this.scroll}onMouseDown(e){if(!(e.target instanceof Element)||!this.ctx.isTarget(e))return;if(this.ctx.stageElement.style.cursor==="row-resize"||this.ctx.stageElement.style.cursor==="col-resize")return!0;const{offsetX:t,offsetY:r,clientX:s,clientY:o}=e;if(!(s==this.clientX&&o==this.clientY)){if(this.isOnScrollbar(t,r))this.clientX=s,this.clientY=o,this.isDragging=!0,this.ctx.scrollerMove=!0,this.isFocus=!0,this.dragStart=this.scroll,e.preventDefault();else if(this.isOnTrack(t,r)){let a=0;this.type==="vertical"?a=(r-this.ctx.header.height-this.barHeight/2)/(this.visibleDistance-this.barHeight)*this.distance:a=(t-this.barWidth/2)/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(a,this.distance))}}}onMouseUp(){this.isDragging=!1,this.isFocus=!1,this.clientX=0,this.clientY=0}onMouseMove(e){const{offsetX:t,offsetY:r,clientX:s,clientY:o,buttons:a}=e;if(this.isOnScrollbar(t,r)&&e.target===this.ctx.canvasElement?this.isFocus=!0:this.isFocus=!1,a===0||s==this.clientX&&o==this.clientY)return;let n=0;if(this.type==="horizontal"?n=s-this.clientX:n=o-this.clientY,this.isDragging&&n!==0){let c=0;this.type==="vertical"?c=this.dragStart+n/(this.visibleDistance-this.barHeight)*this.distance:c=this.dragStart+n/(this.visibleDistance-this.barWidth)*this.distance,this.scroll=Math.max(0,Math.min(c,this.distance))}}isPointInElement(e,t,r,s,o,a){return e>=r&&e<=r+o&&t>=s&&t<=s+a}hasScrollbar(){return this.type==="vertical"?this.barHeight>0:this.type==="horizontal"?this.barWidth>0:!1}isOnScrollbar(e,t){return this.isPointInElement(e,t,this.barX,this.barY,this.barWidth,this.barHeight)}isOnTrack(e,t){return this.isPointInElement(e,t,this.trackX,this.trackY,this.trackWidth,this.trackHeight)}updateScroll(e){const t=e.deltaX,r=e.deltaY;this.type==="vertical"&&e.shiftKey===!1?(this.hasScrollbar()&&!(this.scroll===0&&r<0||this.scroll===this.distance&&r>0)&&e.preventDefault(),this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance))):this.type==="horizontal"&&(e.shiftKey?this.scroll=Math.max(0,Math.min(this.scroll+r,this.distance)):this.scroll=Math.max(0,Math.min(this.scroll+t,this.distance)))}updatedSize(){const{body:e,header:t,stageHeight:r,stageWidth:s,config:{SCROLLER_TRACK_SIZE:o=0,SCROLLER_SIZE:a=0,BORDER:n}}=this.ctx,c=s,d=r,u=t.height,f=t.width,g=e.height,v=this.ctx.footer.height;if(this.type==="vertical"){this.visibleDistance=d-o-u,this.distance=g-this.visibleDistance+v,this.trackX=c-o,this.trackY=0,this.splitPoints=[this.trackX,u,this.trackX+o,u],this.trackWidth=o,this.trackHeight=d,this.barX=this.trackX-1+(o-a)/2,this.barWidth=a;const p=this.distance?this.visibleDistance/(g+v):0;let m=Math.floor(p*this.visibleDistance);m<30?m=30:m>this.visibleDistance&&(m=0),this.barHeight=m,this.barY=u+this.scroll/this.distance*(this.visibleDistance-this.barHeight),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}else{this.visibleDistance=c-o,this.distance=f-this.visibleDistance,this.splitPoints=[c-o,d-o,c-o,d];const p=n?0:.5;this.trackX=0,this.trackY=d-o+p,this.trackWidth=c,this.trackHeight=o;const m=this.distance?this.visibleDistance/f:0;let x=Math.floor(m*this.visibleDistance);this.barY=this.trackY-1+(o-a)/2,x<30?x=30:x>=this.visibleDistance&&(x=0),this.barWidth=x,this.barHeight=a,this.barX=this.scroll/this.distance*(this.visibleDistance-this.barWidth),this.scroll=Math.max(0,Math.min(this.scroll,this.distance))}}draw(){const{config:{SCROLLER_FOCUS_COLOR:e,SCROLLER_COLOR:t,BORDER_COLOR:r,BORDER:s,SCROLLER_TRACK_COLOR:o}}=this.ctx;this.updatedSize();let a=r;s||(a="transparent"),this.ctx.paint.drawRect(this.trackX,this.trackY,this.trackWidth,this.trackHeight,{borderColor:a,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:a,borderWidth:1}),this.ctx.scrollerFocus=this.isFocus}}class MC{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 yo(e,"vertical"),this.horizontalScrollbar=new yo(e,"horizontal"),this.ctx.on("wheel",t=>this.onWheel(t)),this.ctx.on("mousedown",t=>this.onMouseDown(t)),this.ctx.on("mousemove",t=>this.onMouseMove(t)),this.ctx.on("mouseup",()=>this.onMouseUp()),this.ctx.on("touchmove",t=>this.onTouchmove(t)),this.ctx.on("touchstart",t=>{this.onTouchstart(t)}),this.ctx.on("setScroll",(t,r)=>{this.setScroll(t,r)}),this.ctx.on("setScrollX",t=>{this.setScrollX(t)}),this.ctx.on("setScrollY",t=>{this.setScrollY(t)}),this.ctx.on("cellHeaderMousedown",()=>{this.mousedownHeader=!0}),this.ctx.on("startAdjustPosition",t=>{this.startAdjustPosition(t)}),this.ctx.on("stopAdjustPosition",()=>{this.stopAdjustPosition()})}onWheel(e){this.verticalScrollbar.onWheel(e),this.horizontalScrollbar.onWheel(e),this.draw()}onTouchmove(e){this.verticalScrollbar.onTouchmove(e),this.horizontalScrollbar.onTouchmove(e),this.draw()}onTouchstart(e){this.verticalScrollbar.onTouchstart(e),this.horizontalScrollbar.onTouchstart(e),this.draw()}onMouseDown(e){this.verticalScrollbar.onMouseDown(e),this.horizontalScrollbar.onMouseDown(e),this.draw()}onMouseMove(e){this.verticalScrollbar.onMouseMove(e),this.horizontalScrollbar.onMouseMove(e),this.draw()}onMouseUp(){this.mousedownHeader=!1,this.verticalScrollbar.onMouseUp(),this.horizontalScrollbar.onMouseUp(),this.ctx.scrollerMove=!1}draw(){this.verticalScrollbar.draw(),this.horizontalScrollbar.draw();const e=Math.floor(this.horizontalScrollbar.scroll),t=Math.floor(this.verticalScrollbar.scroll);(e!==this.ctx.scrollX||t!==this.ctx.scrollY)&&(this.ctx.emit("onScroll",e,t),e!==this.ctx.scrollX&&this.ctx.emit("onScrollX",e),t!==this.ctx.scrollY&&this.ctx.emit("onScrollY",t),this.ctx.scrollX=e,this.ctx.scrollY=t,this.ctx.emit("draw"))}setScroll(e,t){this.horizontalScrollbar.scroll=e,this.verticalScrollbar.scroll=t,this.ctx.emit("draw"),this.ctx.emit("onScroll",e,t)}setScrollX(e){this.horizontalScrollbar.scroll=e,this.ctx.emit("draw")}setScrollY(e){this.verticalScrollbar.scroll=e,this.ctx.emit("draw")}scrollToColkey(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.key===e);r&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToColIndex(e){const{header:t}=this.ctx,r=t.leafCellHeaders.find(s=>s.colIndex===e);r&&r.x>t.visibleWidth/2&&this.setScrollX(r.x-t.visibleWidth/2)}scrollToRowIndex(e){const{body:t,database:r}=this.ctx,{top:s}=r.getPositionForRowIndex(e);s>t.visibleHeight&&this.setScrollY(s-t.visibleHeight/2)}scrollToRowKey(e){const{body:t,database:r}=this.ctx,s=r.getRowIndexForRowKey(e);if(s===void 0)return;const{top:o}=r.getPositionForRowIndex(s);this.setScrollY(o-t.visibleHeight/2)}startAdjustPosition(e){var t,r;const{offsetX:s,offsetY:o}=this.ctx.getOffset(e);let a="",n="";if(((t=this.ctx.focusCell)==null?void 0:t.fixed)!=="left"&&s<this.ctx.fixedLeftWidth?a="left":((r=this.ctx.focusCell)==null?void 0:r.fixed)!=="right"&&s>this.ctx.body.visibleWidth-this.ctx.fixedRightWidth?a="right":(a="",this.stopAdjustPosition(!0,!1)),!this.mousedownHeader&&o<this.ctx.header.visibleHeight?n="top":o>this.ctx.header.visibleHeight+this.ctx.body.visibleHeight?n="bottom":(n="",this.stopAdjustPosition(!1,!0)),a&&this.adjustPositionX!==a){this.adjustPositionX=a;let c=10*(a==="left"?-1:1);this.timerX&&(clearInterval(this.timerX),this.timerX=0),this.timerX=setInterval(()=>{c*=1.5;const{scrollX:d}=this.ctx,u=d+c;(u<0||u>this.ctx.body.width)&&(clearInterval(this.timerX),this.timerX=0),this.ctx.setScrollX(u)},100)}if(n&&this.adjustPositionY!==n){this.adjustPositionY=n;let c=10*(n==="top"?-1:1);this.timerY&&(clearInterval(this.timerY),this.timerY=0),this.timerY=setInterval(()=>{c*=1.5;const{scrollY:d}=this.ctx,u=d+c;(u<0||u>this.ctx.body.height)&&(clearInterval(this.timerY),this.timerY=0),this.ctx.setScrollY(u)},100)}}stopAdjustPosition(e=!0,t=!0){e&&(this.adjustPositionX="",this.timerX&&(clearInterval(this.timerX),this.timerX=0)),t&&(this.adjustPositionY="",this.timerY&&(clearInterval(this.timerY),this.timerY=0))}}class AC{constructor(e){h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"resizeTarget",null),h(this,"resizeNum",0),h(this,"isResizing",!1),h(this,"clientX",0),h(this,"resizeDiff",0),h(this,"columnIndex",0),h(this,"isMouseDown",!1),h(this,"columns"),h(this,"visibleLeafColumns",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"allCellHeaders",[]),h(this,"leafCellHeaders",[]),h(this,"renderLeafCellHeaders",[]),h(this,"fixedLeftCellHeaders",[]),h(this,"centerCellHeaders",[]),h(this,"fixedRightCellHeaders",[]),h(this,"renderCenterCellHeaders",[]),h(this,"renderFixedCellHeaders",[]),this.ctx=e,this.ctx.on("resetHeader",Mt(()=>{this.init(),this.ctx.emit("draw")},100)),this.init(),this.initResizeColumn()}init(){const{config:{HEADER_HEIGHT:e,SCROLLER_TRACK_SIZE:t}}=this.ctx,r=this.ctx.database.getColumns();this.columns=r,this.allCellHeaders=[],this.leafCellHeaders=[],this.fixedLeftCellHeaders=[],this.fixedRightCellHeaders=[],this.centerCellHeaders=[];const s=Dn(r),o=mi(r);this.height=e*s,this.width=o.reduce((f,g)=>{const v=g.width||100,{maxWidth:p,minWidth:m}=g;return p&&v>p?f+p:m&&v<m?f+m:f+v},0),this.visibleHeight=this.height;const a=pC(Mn(r,s));this.columnIndex=0,this.resizeNum=0,this.render(a,0),this.ctx.database.updateColIndexKeyMap(this.leafCellHeaders);const n=this.ctx.containerElement.getBoundingClientRect();this.resizeNum>0?this.ctx.stageWidth=Math.floor(n.width):this.ctx.stageWidth=Math.floor(this.width+t),this.ctx.stageElement.style.width=this.ctx.stageWidth+"px",this.visibleWidth=this.ctx.stageWidth-t;const c=this.visibleWidth-this.width;if(this.resizeNum&&c>0){const f=Math.floor(c/this.resizeNum*100)/100;this.resizeAllColumn(f)}const d=this.fixedLeftCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedLeftWidth=d.reduce((f,g)=>f+g.width,0);const u=this.fixedRightCellHeaders.filter(f=>!f.hasChildren);this.ctx.fixedRightWidth=u.reduce((f,g)=>f+g.width,t),this.ctx.maxColIndex=this.leafCellHeaders.length-1,this.ctx.header.x=this.x,this.ctx.header.y=this.y,this.ctx.header.width=this.width,this.ctx.header.height=this.height,this.ctx.header.visibleWidth=this.visibleWidth,this.ctx.header.visibleHeight=this.visibleHeight}initResizeColumn(){this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&this.ctx.isTarget(e)&&(this.clientX=e.clientX,this.resizeTarget?(this.isResizing=!0,this.ctx.columnResizing=!0):this.isResizing=!1,this.isMouseDown=!0)}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_COLUMN&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeColumn(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.isResizing=!1,this.isMouseDown=!1,this.ctx.columnResizing=!1,this.clientX=0,this.resizeDiff=0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_COLUMN||this.ctx.editing)return;const{stageWidth:t,config:{RESIZE_COLUMN_MIN_WIDTH:r}}=this.ctx;if(this.isResizing&&this.resizeTarget){const s=this.resizeTarget.width,o=this.resizeTarget.minWidth,a=this.resizeTarget.maxWidth;let n=e.clientX-this.clientX;n+s<r&&(n=-(s-r)),o&&n+s<o&&(n=-(s-o)),a&&n+s>a&&(n=a-s),this.resizeDiff=n,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:a,offsetY:n}=this.ctx.getOffset(e),c=a,d=o.getDrawX();c>d+o.width-5&&c<d+o.width+4&&c<t-4&&o.colspan<=1&&this.ctx.isTarget(e)&&n<=this.height&&(this.ctx.stageElement.style.cursor="col-resize",this.resizeTarget=o)}}})}resizeColumn(e,t){const r=o=>{o.forEach(a=>{if(a.children&&a.children.length>0&&r(a.children),a.key===e.key){const n=a.width||100;a.width=n+t}})};r(this.columns),this.ctx.database.setColumns(this.columns),this.init(),this.ctx.emit("draw");let s=0;if(this.width<this.visibleWidth){const o=this.visibleWidth-this.width;s=Math.floor(o/this.resizeNum*100)/100,this.resizeAllColumn(s),this.ctx.emit("draw")}this.ctx.emit("resizeColumnChange",{colIndex:e.colIndex,key:e.key,oldWidth:e.width,width:e.width+t+s,column:e.column,columns:this.columns})}resizeAllColumn(e){if(e===0)return;const t=new Map;let r=!0;for(const o of this.allCellHeaders)if(o.widthFillDisable)t.set(o.key,o.width);else{const a=o.width+e*o.colspan;t.set(o.key,a),a<this.ctx.config.RESIZE_COLUMN_MIN_WIDTH&&(r=!1)}if(!r)return;const s=o=>{o.forEach(a=>{t.has(a.key)&&(a.width=t.get(a.key)),a.children&&a.children.length>0&&s(a.children)})};s(this.columns),this.ctx.database.setColumns(this.columns),this.init()}render(e,t){const r=e.length;let s=t;const{HEADER_HEIGHT:o=0}=this.ctx.config;for(let a=0;a<r;a++){const n=e[a],c=o*(n.rowspan||0),d=o*(n.level||0);let{minWidth:u,maxWidth:f}=n,g=n.width||100;u&&g<u&&(g=u),f&&g>f&&(g=f),n.children&&(g=mi(n.children).reduce((p,m)=>p+((m==null?void 0:m.width)||100),0));const v=new rr(this.ctx,this.columnIndex,s,d,g,c,n);this.ctx.database.setHeader(n.key,v),this.allCellHeaders.push(v),n.children||(this.leafCellHeaders.push(v),v.column.widthFillDisable||this.resizeNum++),n.fixed==="left"?this.fixedLeftCellHeaders.push(v):n.fixed==="right"?this.fixedRightCellHeaders.push(v):this.centerCellHeaders.push(v),!n.children&&this.columnIndex++,n.children&&this.render(n.children,s),s+=g}}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageHeight:e,config:{RESIZE_COLUMN_LINE_COLOR:t}}=this.ctx,r=this.resizeTarget.getDrawX(),s=this.resizeTarget.width,o=r+s+this.resizeDiff-.5,a=[o-.5,0,o-.5,e];this.ctx.paint.drawLine(a,{borderColor:t,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){const e=[],t=[],r=[];if(this.centerCellHeaders.length){const s=this.centerCellHeaders[this.centerCellHeaders.length-1];this.ctx.lastCenterColIndex=s.colIndex}this.centerCellHeaders.forEach(s=>{s.isHorizontalVisible()&&s.isVerticalVisible()&&(t.push(s),s.hasChildren||e.push(s))}),this.fixedLeftCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.fixedRightCellHeaders.forEach(s=>{r.push(s),s.hasChildren||e.push(s)}),this.renderCenterCellHeaders=t,this.renderFixedCellHeaders=r,this.renderLeafCellHeaders=e.sort((s,o)=>s.x-o.x),this.visibleLeafColumns=this.renderLeafCellHeaders.map(s=>s.column),this.ctx.header.visibleLeafColumns=this.visibleLeafColumns,this.ctx.header.leafCellHeaders=this.leafCellHeaders,this.ctx.header.renderLeafCellHeaders=this.renderLeafCellHeaders,this.ctx.header.renderCellHeaders=this.renderFixedCellHeaders.concat(this.renderCenterCellHeaders)}drawBottomLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.height,e,this.height];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderCenterCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawFixedShadow(),this.renderFixedCellHeaders.forEach(e=>{e.update(),e.draw()}),this.drawTipLine(),this.drawBottomLine()}}class Hn{constructor(e,t,r=0,s=0,o=0,a=0,n,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=r,this.y=s,this.width=o,this.height=a,this.rowIndex=t,this.rowKey=e.database.getRowKeyForRowIndex(t)||"",this.rowType=c,this.data=n,this.update()}update(){const{header:e}=this.ctx,t=[],r=[],s=[],o=[];e.renderLeafCellHeaders.forEach(a=>{const n=new Ir(this.ctx,this.rowIndex,a.colIndex,a.x,this.y,a.width,this.height,a.column,this.data,this.rowType);n.fixed?r.push(n):s.push(n),t.push(n),n.autoRowHeight&&o.push(n)}),this.cells=t,this.calculatedHeightCells=o,this.fixedCells=r,this.noFixedCells=s}updateCalculatedHeight(){const e=this.calculatedHeightCells.map(t=>t.getAutoHeight());this.calculatedHeight=e.length?Math.max(...e):-1}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 NC{constructor(e){h(this,"resizeTarget",null),h(this,"isMouseDown",!1),h(this,"resizeDiff",0),h(this,"clientY",0),h(this,"ctx"),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"headIndex",0),h(this,"tailIndex",0),h(this,"isResizing",!1),h(this,"renderRows",[]),h(this,"visibleRows",[]),h(this,"visibleHeight",0),h(this,"visibleWidth",0),h(this,"containerRect"),h(this,"data",[]),this.ctx=e,this.init(),this.initResizeRow()}init(){const{canvasElement:e,header:t,footer:r,database:s,config:{FOOTER_FIXED:o,SCROLLER_TRACK_SIZE:a=0,HEIGHT:n,EMPTY_BODY_HEIGHT:c=0,MAX_HEIGHT:d=0,ENABLE_OFFSET_HEIGHT:u=0,OFFSET_HEIGHT:f=0,FOOTER_POSITION:g}}=this.ctx;if(!t.width)return;this.x=0,g==="top"&&o?this.y=t.height+r.height:this.y=t.height;const{data:v,sumHeight:p}=s.getData();this.height=p,this.data=v,this.width=t.width,this.visibleWidth=this.ctx.stageWidth-a;const m=this.ctx.footer.height;!this.data.length&&!n?this.height=c:!this.data.length&&n&&(this.height=n-t.height-m-a);let x=this.height+t.height+a;x+=m;let C=x;const _=window.innerHeight,{top:y}=this.containerRect||this.ctx.containerElement.getBoundingClientRect();if(_>y&&u&&!n){const w=_-y-f;w>t.height+a?C=w:x>d&&(C=d)}else this.data.length&&n?C=n:this.data.length&&d&&x>d&&(C=d);C>0&&(this.ctx.stageHeight=Math.floor(C),this.ctx.stageElement.style.height=`${this.ctx.stageHeight}px`);let b=this.ctx.stageHeight-t.height-a;o?this.visibleHeight=b-m:this.visibleHeight=b,this.data.length||(this.height=this.visibleHeight),this.ctx.body.x=this.x,this.ctx.body.y=this.y,this.ctx.body.width=this.width,this.ctx.body.height=this.height,this.ctx.body.visibleWidth=this.visibleWidth,this.ctx.body.visibleHeight=this.visibleHeight,this.ctx.body.data=v;const E=window.devicePixelRatio||1,S=this.ctx.stageWidth*E,$=this.ctx.stageHeight*E;e.width=Math.round(S),e.height=Math.round($);const k=this.data.length?"not-empty":"empty";this.ctx.emit("emptyChange",{isEmpty:k,type:k,headerHeight:t.height,bodyHeight:this.height,footerHeight:m,width:this.width,height:this.data.length?0:c+m});const T=Math.round(e.width/E*1e4)/1e4,I=Math.round(e.height/E*1e4)/1e4;this.ctx.canvasElement.setAttribute("style",`height:${I}px;width:${T}px;`),this.ctx.paint.scale(E)}initResizeRow(){this.ctx.on("resize",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("resizeObserver",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.containerRect=this.ctx.containerElement.getBoundingClientRect())}),this.ctx.on("mouseup",()=>{this.ctx.config.ENABLE_RESIZE_ROW&&(this.isMouseDown=!1,this.resizeDiff!==0&&this.resizeTarget&&this.resizeRow(this.resizeTarget,this.resizeDiff),this.resizeTarget=null,this.resizeDiff=0,this.isResizing=!1,setTimeout(()=>{this.ctx.rowResizing=!1},0),this.clientY=0)}),this.ctx.on("mousedown",e=>{this.ctx.config.ENABLE_RESIZE_ROW&&this.ctx.isTarget(e)&&(this.clientY=e.clientY,this.resizeTarget?(this.isResizing=!0,this.ctx.rowResizing=!0):(this.isResizing=!1,this.ctx.rowResizing=!1),this.isMouseDown=!0)}),this.ctx.on("mousemove",e=>{if(!this.ctx.config.ENABLE_RESIZE_ROW||this.ctx.editing)return;const{offsetY:t,offsetX:r}=this.ctx.getOffset(e),s=t,o=r,a=e.clientY,{stageHeight:n,scrollY:c,config:{RESIZE_ROW_MIN_HEIGHT:d=0}}=this.ctx;if(this.isResizing&&this.resizeTarget){const u=this.resizeTarget.height;let f=a-this.clientY;const{calculatedHeight:g}=this.resizeTarget,v=g===-1?d:g;f+u<v&&(f=-(u-v)),this.resizeDiff=f,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 u=0;u<this.renderRows.length;u++){const f=this.renderRows[u];if(s>f.y-c+f.height-1.5&&s<f.y-c+f.height+1.5&&s<n-4)for(let g=0;g<f.cells.length;g++){const v=f.cells[g];o>v.drawX+10&&o<v.drawX+v.width-10&&v.rowspan===1&&(this.ctx.stageElement.style.cursor="row-resize",this.resizeTarget=f)}}}})}resizeRow(e,t){const{rowIndex:r,height:s,rowKey:o,data:a}=e;this.ctx.database.setRowHeight(r,s+t),this.init(),this.ctx.emit("draw"),this.ctx.emit("resizeRowChange",{rowIndex:r,oldHeight:s,height:s+t,rowKey:o,row:a,data:this.data})}drawTipLine(){if(this.isResizing&&this.resizeTarget){const{stageWidth:e,scrollY:t,config:{RESIZE_ROW_LINE_COLOR:r}}=this.ctx,s=this.resizeTarget.y-t,o=this.resizeTarget.height,a=s+o+this.resizeDiff-.5,n=[0,a-.5,e,a-.5];this.ctx.paint.drawLine(n,{borderColor:r,borderWidth:1})}}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;if(r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,this.y,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const c=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(c,this.y,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}binarySearch(e,t){let r=0,s=e.length-1,o=-1;for(;r<=s;){let a=Math.floor((r+s)/2),n=e[a].bottom;if(n===t)return a;n<t?r=a+1:(o=a,s=a-1)}return o}update(){this.init();const{header:e,database:t,scrollY:r,config:{CELL_HEIGHT:s}}=this.ctx,o=r,{data:a,positions:n}=t.getData();this.ctx.maxRowIndex=a.length-1;let c=this.binarySearch(n,o),d=this.binarySearch(n,o+this.visibleHeight);if(d===-1&&(d=this.ctx.maxRowIndex),c===-1&&d===this.ctx.maxRowIndex){const f=Math.floor(this.visibleHeight/s);c=this.ctx.maxRowIndex-f}this.headIndex=Math.max(0,c),this.tailIndex=Math.min(this.ctx.maxRowIndex,d+1),this.visibleRows=a.slice(this.headIndex,this.tailIndex+1),this.ctx.body.headIndex=this.headIndex,this.ctx.body.tailIndex=this.tailIndex,this.ctx.body.visibleRows=this.visibleRows;const u=[];for(let f=0;f<this.visibleRows.length;f++){const g=this.headIndex+f,v=this.visibleRows[f],{height:p,top:m}=this.ctx.database.getPositionForRowIndex(g),x=new Hn(this.ctx,g,0,m+this.y,e.width,p,v);u.push(x)}this.renderRows=u,this.ctx.body.renderRows=u}updateAutoHeight(){const e=this.ctx.body.renderRows;if(!e.some(r=>r.calculatedHeightCells.length>0))return;e.forEach(r=>{r.updateCalculatedHeight()});const t=e.map(r=>({height:r.calculatedHeight,rowIndex:r.rowIndex}));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 BC{constructor(e){h(this,"ctx"),h(this,"renderRows",[]),h(this,"data",[]),h(this,"x",0),h(this,"y",0),h(this,"width",0),h(this,"height",0),h(this,"visibleWidth",0),h(this,"visibleHeight",0),this.ctx=e,this.init()}init(){this.data=this.ctx.database.getFooterData();const{header:e,body:t,config:{CELL_FOOTER_HEIGHT:r,FOOTER_FIXED:s,SCROLLER_TRACK_SIZE:o,FOOTER_POSITION:a}}=this.ctx;this.width=e.width,this.visibleWidth=e.visibleWidth,this.height=this.data.reduce(n=>n+r,0),this.visibleHeight=this.height,s?a==="top"?this.y=this.ctx.header.height:this.y=this.ctx.stageHeight-this.height-o:this.y=t.y+t.height,this.ctx.footer.x=this.x,this.ctx.footer.y=this.y,this.ctx.footer.height=this.height,this.ctx.footer.width=this.width,this.ctx.footer.visibleWidth=this.visibleWidth,this.ctx.footer.visibleHeight=this.visibleHeight}drawFixedShadow(){const{fixedLeftWidth:e,fixedRightWidth:t,scrollX:r,header:s,stageWidth:o,config:{HEADER_BG_COLOR:a,SCROLLER_TRACK_SIZE:n}}=this.ctx;let c=this.y;if(this.ctx.config.FOOTER_FIXED||(c=this.y-this.ctx.scrollY),r>0&&e!==0&&this.ctx.paint.drawShadow(this.x,c,e,this.height,{fillColor:a,side:"right",shadowWidth:4,colorStart:"rgba(0,0,0,0.1)",colorEnd:"rgba(0,0,0,0)"}),r<Math.floor(s.width-o-1)&&t!==n){const d=s.width-(this.x+this.width)+o-t;this.ctx.paint.drawShadow(d,c,t,this.height,{fillColor:a,side:"left",shadowWidth:4,colorStart:"rgba(0,0,0,0)",colorEnd:"rgba(0,0,0,0.1)"})}}update(){this.init();const{CELL_FOOTER_HEIGHT:e}=this.ctx.config;let t=this.y;const r=[];this.data.forEach((s,o)=>{const a=new Hn(this.ctx,o,0,t,this.width,e,s,"footer");t+=e,r.push(a)}),this.renderRows=r,this.ctx.footer.renderRows=this.renderRows}drawTopLine(){const{stageWidth:e,config:{BORDER_COLOR:t}}=this.ctx,r=[0,this.y,e,this.y];this.ctx.paint.drawLine(r,{borderColor:t,borderWidth:1})}draw(){this.renderRows.forEach(e=>{e.drawContainer()}),this.renderRows.forEach(e=>{e.drawCenter()}),this.drawFixedShadow(),this.renderRows.forEach(e=>{e.drawFixedContainer()}),this.renderRows.forEach(e=>{e.drawFixed()}),this.drawTopLine()}}class HC{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",Mt(e=>{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();const e=setTimeout(()=>{this.ctx.adjustPositioning=!1,clearTimeout(e)},0)}),this.ctx.on("cellHeaderHoverChange",e=>{this.ctx.mousedown&&this.selectCols(e)}),this.ctx.on("cellHeaderMousedown",(e,t)=>{this.ctx.stageElement.style.cursor==="pointer"||this.ctx.isPointer||(window.getComputedStyle(t.target).userSelect!=="text"&&t.preventDefault(),this.selectCols(e))}),this.ctx.on("keydown",e=>{if(!this.ctx.editing){if(e.ctrlKey&&e.code==="KeyV"||e.metaKey&&e.code==="KeyV"){this.paste();return}if(e.ctrlKey&&e.code==="KeyC"||e.metaKey&&e.code==="KeyC"){this.copy(),this.isCut=!1;return}if(e.ctrlKey&&e.code==="KeyX"||e.metaKey&&e.code==="KeyX"){this.isCut=!0,this.copy();return}if((e.ctrlKey&&e.code==="KeyA"||e.metaKey&&e.code==="KeyA")&&(e.preventDefault(),this.selectAll()),e.code==="ArrowLeft"||e.shiftKey&&e.code==="Tab"){e.preventDefault(),this.moveFocus("LEFT");return}if(e.code==="ArrowUp"){e.preventDefault(),this.moveFocus("TOP");return}if(e.code==="ArrowRight"||e.code==="Tab"){e.preventDefault(),this.moveFocus("RIGHT");return}if(e.code==="ArrowDown"){e.preventDefault(),this.moveFocus("BOTTOM");return}if(e.code==="Delete"||e.code==="Backspace"){e.preventDefault();const{xArr:t,yArr:r}=this.ctx.selector;this.clearSelectedData(t,r);return}}}),this.ctx.on("contextMenuClearSelected",()=>{const{xArr:e,yArr:t}=this.ctx.selector;this.clearSelectedData(e,t)}),this.ctx.on("contextMenuCopy",()=>{this.copy()}),this.ctx.on("contextMenuPaste",()=>{this.paste()}),this.ctx.on("contextMenuCut",()=>{this.isCut=!0,this.copy()}),this.ctx.on("setSelectorCell",e=>{this.ctx.setFocusCell(e),this.click()})}setSelector(e,t){const{ENABLE_SELECTOR_SPAN_COL:r,ENABLE_SELECTOR_SPAN_ROW:s}=this.ctx.config;let o=e,a=t;if(!s){const[n]=a;a=[n,n]}if(!r){const[n]=o;o=[n,n]}if(JSON.stringify(this.ctx.selector.xArr)!==JSON.stringify(o)||JSON.stringify(this.ctx.selector.yArr)!==JSON.stringify(a)){this.ctx.mousedown&&(this.ctx.selectorMove=!0),this.ctx.selector.enable=!0;const{SELECTOR_AREA_MIN_X:n,SELECTOR_AREA_MAX_X:c,SELECTOR_AREA_MIN_Y:d,SELECTOR_AREA_MAX_Y:u,SELECTOR_AREA_MAX_X_OFFSET:f,SELECTOR_AREA_MAX_Y_OFFSET:g}=this.ctx.config,v=n,p=c||this.ctx.maxColIndex-f,m=d,x=u||this.ctx.maxRowIndex-g;let[C,_]=o,[y,b]=a;if(C<v||_>p||y<m||b>x)return;if(this.ctx.stageElement.focus({preventScroll:!0}),this.ctx.config.ENABLE_MERGE_CELL_LINK){const S=this.adjustMergeCells(o,a);y=S.yArr[0],b=S.yArr[1],C=S.xArr[0],_=S.xArr[1],this.ctx.onlyMergeCell=S.onlyMergeCell}C===_&&y===b?this.ctx.selectOnlyOne=!0:this.ctx.selectOnlyOne=!1,o=[Math.max(v,C),Math.min(p,_)],a=[Math.max(m,y),Math.min(x,b)];const{BEFORE_SET_SELECTOR_METHOD:E}=this.ctx.config;if(typeof E=="function"){const S=E({focusCell:this.ctx.focusCell,xArr:o,yArr:a});if(!S)return;o=S.xArr,a=S.yArr}this.ctx.selector.xArr=o,this.ctx.selector.yArr=a,b===this.ctx.maxRowIndex&&y===0?this.ctx.selectColsIng=!0:this.ctx.selectColsIng=!1,_===this.ctx.maxColIndex&&C===0?this.ctx.selectRowsIng=!0:this.ctx.selectRowsIng=!1,this.ctx.emit("setSelector",this.ctx.selector),this.ctx.emit("drawView")}}adjustMergeCells(e,t){var r;const[s,o]=t,[a,n]=e;if(o===this.ctx.maxRowIndex&&s===0||n===this.ctx.maxColIndex&&a===0)return{xArr:e,yArr:t,onlyMergeCell:!1};let c=[],d=[];for(let m=0;m<=t[1]-t[0];m++)for(let x=0;x<=e[1]-e[0];x++){const C=m+t[0],_=x+e[0],y=this.ctx.database.getVirtualBodyCell(C,_);y&&((C===s||C===o)&&c.push(y),(_===a||_===n)&&d.push(y))}const u=c.reduce((m,x)=>{const{yArr:C}=x.getSpanInfo(),[_,y]=C;return m.minY=Math.min(m.minY,_),m.maxY=Math.max(m.maxY,y),m},{minY:s,maxY:o}),f=d.reduce((m,x)=>{const{xArr:C}=x.getSpanInfo(),[_,y]=C;return m.minX=Math.min(m.minX,_),m.maxX=Math.max(m.maxX,y),m},{minX:a,maxX:n}),g=[f.minX,f.maxX],v=[u.minY,u.maxY];let p=!1;if(f.minX!==f.maxX||u.minY!==u.maxY){const m=JSON.stringify(g)+JSON.stringify(v),x=(r=this.ctx.focusCell)==null?void 0:r.getSpanInfo();p=(x&&JSON.stringify(x.xArr)+JSON.stringify(x.yArr))===m}return{xArr:g,yArr:v,onlyMergeCell:p}}selectCols(e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_ROWS||this.ctx.autofillMove||this.ctx.columnResizing||this.ctx.editing)return;if(e.operation){this.selectAll();return}const{SELECTOR_AREA_MIN_Y:t,SELECTOR_AREA_MAX_Y:r,SELECTOR_AREA_MAX_Y_OFFSET:s}=this.ctx.config,o=t,a=r||this.ctx.maxRowIndex-s;if(this.ctx.mousedown&&this.ctx.focusCellHeader){const{colIndex:n}=this.ctx.focusCellHeader;if(this.ctx.clearSelector(),e.colIndex>=n){const c=[n,e.colIndex+e.colspan-1],d=[o,a];this.setSelector(c,d)}else{const c=[e.colIndex,n],d=[o,a];this.setSelector(c,d)}}else{const n=[e.colIndex,e.colIndex+e.colspan-1],c=[o,a];this.setSelector(n,c)}}selectAll(){if(this.ctx.autofillMove||this.ctx.editing)return;const{ENABLE_SELECTOR_ALL_ROWS:e,ENABLE_SELECTOR_ALL_COLS:t}=this.ctx.config;if(e&&t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:a,SELECTOR_AREA_MAX_X_OFFSET:n,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-n,f=o,g=a||this.ctx.maxRowIndex-c,v=[d,u],p=[f,g];this.setSelector(v,p)}}selectRows(e,t=!0){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||!this.ctx.config.ENABLE_SELECTOR_ALL_COLS||this.ctx.autofillMove||this.ctx.editing)return;const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MAX_X_OFFSET:o}=this.ctx.config,a=s||this.ctx.maxColIndex-o,n=r;if(t){this.ctx.setFocusCell(e);const c=[n,a],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=[n,a],u=[c,e.rowIndex];this.setSelector(d,u)}else{const d=[n,a],u=[e.rowIndex,c];this.setSelector(d,u)}}}mouseenter(){if(this.ctx.config.ENABLE_SELECTOR_SINGLE||this.ctx.editing)return;const{mousedown:e,focusCell:t,hoverCell:r}=this.ctx;if(e&&t&&r){const{rowIndex:s,colIndex:o}=t,a=Math.min(r.colIndex,o),n=Math.max(r.colIndex,o),c=Math.min(r.rowIndex,s),d=Math.max(r.rowIndex,s),u=[a,n],f=[c,d];this.setSelector(u,f)}}click(e=!1){const{focusCell:t,clickCell:r}=this.ctx;if(t&&this.isInSettingRange(t.rowIndex,t.colIndex))if(this.ctx.selector.enable=!0,r&&e){if(this.ctx.config.ENABLE_SELECTOR_SINGLE)return;const{colIndex:s,rowIndex:o}=r,{colIndex:a,rowIndex:n}=t,c=Math.min(a,s),d=Math.max(a,s),u=Math.min(n,o),f=Math.max(n,o),g=[c,d],v=[u,f];this.setSelector(g,v)}else{this.ctx.emit("cellSelectedClick",t);const s=[t.colIndex,t.colIndex],o=[t.rowIndex,t.rowIndex];this.setSelector(s,o),this.adjustBoundaryPosition()}}clearCopyLine(){this.ctx.selector.xArrCopy=[-1,-1],this.ctx.selector.yArrCopy=[-1,-1]}getCell(e,t){const r=this.ctx.body.renderRows.find(s=>s.rowIndex===e);return r==null?void 0:r.cells.find(s=>s.colIndex===t)}copy(){if(!this.ctx.config.ENABLE_COPY||this.ctx.domSelectionStr)return;let{value:e,xArr:t,yArr:r}=this.ctx.getSelectedData();if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(t,r))if(this.ctx.onlyMergeCell&&this.ctx.focusCell){const a=this.ctx.focusCell;e=[[a.getValue()]],t=[a.colIndex,a.colIndex],r=[a.rowIndex,a.rowIndex]}else{const a={code:"ERR_MERGED_CELLS_COPY",message:"Merged cells cannot span copy data"};this.ctx.hasEvent("error")?this.ctx.emit("error",a):alert(a.message);return}const{BEFORE_COPY_METHOD:s}=this.ctx.config;if(typeof s=="function"){const a=s({focusCell:this.ctx.focusCell,data:e,xArr:t,yArr:r});if(!a)return;e=a.data}const o=wC(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(a=>console.error("Copy Failure:",a)):console.error("current browser does not support the Clipboard API")}clearSelectedData(e,t,r=!1,s=null){let o=[];const a=new Set;for(let c=0;c<=t[1]-t[0];c++)for(let d=0;d<=e[1]-e[0];d++){const u=c+t[0],f=d+e[0],g=this.ctx.database.getItemValueForRowIndexAndColIndex(u,f);if(g){const{rowKey:v,key:p}=g;this.ctx.database.getReadonly(v,p)||(a.add(v),o.push({rowKey:v,key:p,value:s,row:{}}))}}if(!o.length)return[];if(r)return o;this.ctx.database.batchSetItemValue(o,!0);let n=[];return a.forEach(c=>{n.push(this.ctx.database.getRowDataItemForRowKey(c))}),this.ctx.emit("clearSelectedDataChange",o,n),o}paste(){if(!navigator.clipboard){console.error("current browser does not support the Clipboard API");return}const{ENABLE_PASTER:e}=this.ctx.config;if(this.ctx.selector.enable&&e){const t=this.ctx.selector.yArr[0],r=this.ctx.selector.xArr[0],s=new Set;navigator.clipboard.readText().then(async o=>{let a=xC(o);const n=[r,r+a[0].length-1],c=[t,t+a.length-1],[d,u]=c,[f,g]=n,v=u-this.ctx.maxRowIndex,p=g-this.ctx.maxColIndex;(v>0||p>0)&&this.ctx.emit("onPastedDataOverflow",{maxY:u,maxX:g,minY:d,minX:f,overflowRowCount:v,overflowColCount:p,textArr:a});const m=a.length===1&&a[0].length===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(n,c)&&!m){const y={code:"ERR_MERGED_CELLS_PASTE",message:"Merged cells cannot span paste data"};this.ctx.hasEvent("error")?this.ctx.emit("error",y):alert(y.message);return}let x=[];for(let y=0;y<=a.length-1;y++){const b=a[y].length;for(let E=0;E<=b-1;E++){const S=y+t,$=E+r,k=a[y][E],T=this.ctx.database.getItemValueForRowIndexAndColIndex(S,$);if(T){const{rowKey:I,key:w}=T;this.ctx.database.getReadonly(I,w)||(s.add(I),x.push({rowKey:I,key:w,value:k,row:{}}))}}}if(this.isCut){const y=this.clearSelectedData(this.ctx.selector.xArrCopy,this.ctx.selector.yArrCopy,!0),b=x.map(E=>`${E.rowKey}-${E.key}`);y.forEach(E=>{b.includes(`${E.rowKey}-${E.key}`)||x.unshift(E)}),this.isCut=!1}if(!x.length)return;const{BEFORE_PASTE_DATA_METHOD:C}=this.ctx.config;if(typeof C=="function"){const y=C,b=x.map(E=>({rowKey:E.rowKey,key:E.key,value:E.value,oldValue:this.ctx.database.getItemValue(E.rowKey,E.key),row:this.ctx.database.getRowDataItemForRowKey(E.rowKey)}));if(x=await y(b,n,c,a),x&&!x.length)return}this.clearCopyLine(),this.ctx.batchSetItemValueByEditor(x,!0);let _=[];s.forEach(y=>{_.push(this.ctx.database.getRowDataItemForRowKey(y))}),this.ctx.emit("pasteChange",x,_),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:r=0,rowIndex:s=0}=t;const o=0,a=0,n=this.ctx.maxColIndex,c=this.ctx.maxRowIndex;switch(e){case"LEFT":r>o&&r--;break;case"TOP":s>a&&s--;break;case"RIGHT":r<n&&r++;break;case"BOTTOM":s<c&&s++;break}const d=[r,r],u=[s,s],f=this.getCell(s,r);f&&(f.operation||this.isInSettingRange(f.rowIndex,f.colIndex)&&(this.ctx.setFocusCell(f),this.setSelector(d,u),this.adjustBoundaryPosition(),this.ctx.emit("moveFocus",f),this.ctx.emit("draw")))}isInSettingRange(e,t){const{SELECTOR_AREA_MIN_X:r,SELECTOR_AREA_MAX_X:s,SELECTOR_AREA_MIN_Y:o,SELECTOR_AREA_MAX_Y:a,SELECTOR_AREA_MAX_X_OFFSET:n,SELECTOR_AREA_MAX_Y_OFFSET:c}=this.ctx.config,d=r,u=s||this.ctx.maxColIndex-n,f=o,g=a||this.ctx.maxRowIndex-c;return!(t<d||t>u||e<f||e>g)}adjustBoundaryPosition(){const{stageHeight:e,stageWidth:t,focusCell:r,fixedRightWidth:s,fixedLeftWidth:o,header:a,footer:n,body:c,scrollX:d,scrollY:u,config:{SCROLLER_TRACK_SIZE:f,FOOTER_FIXED:g,FOOTER_POSITION:v,ENABLE_MERGE_CELL_LINK:p}}=this.ctx;if(!r)return;p&&this.ctx.onlyMergeCell&&r.updateSpanInfo();const{drawX:m,drawY:x,width:C,height:_,fixed:y}=r,b=o-m+1,E=r.drawX+C-(t-s)+1;let S=a.height-x,$=_;$>c.visibleHeight&&($=c.visibleHeight);let k=0;g&&(v==="top"?S=a.height+n.height-x:k=n.visibleHeight);const T=x+$-(e-k-f);let I=d,w=u;E>0&&!y?I=Math.floor(d+E):b>0&&!y&&(I=Math.floor(d-b)),S>0?w=Math.floor(u-S):T>0&&(w=Math.floor(u+T)),(Math.abs(d-I)>2||Math.abs(u-w)>2)&&(this.ctx.adjustPositioning=!0,this.ctx.setScroll(I,w),this.ctx.emit("adjustBoundaryPosition",r))}destroy(){}}class FC{constructor(e){h(this,"ctx"),h(this,"maxColRowCell"),this.ctx=e,this.init()}init(){this.ctx.on("mousemove",e=>{if(this.ctx.stageElement.style.cursor==="crosshair"&&(this.ctx.stageElement.style.cursor="default"),this.ctx.editing||!this.ctx.focusCell||!this.maxColRowCell)return;const{offsetX:t,offsetY:r}=this.ctx.getOffset(e),{colIndex:s,rowIndex:o,drawX:a,drawY:n,width:c,height:d}=this.maxColRowCell,u=6,f=s===this.ctx.maxColIndex||o===this.ctx.maxRowIndex?0:2,g=a+c-u+f,v=n+d-u+f;t>g&&r>v&&t<g+u&&r<v+u&&(this.ctx.stageElement.style.cursor="crosshair"),this.ctx.autofillMove&&this.ctx.startAdjustPosition(e)}),this.ctx.on("cellMouseenter",e=>{const{xArr:t,yArr:r}=this.ctx.selector,s=t[1],o=r[1],{colIndex:a,rowIndex:n}=e;this.ctx.config.ENABLE_AUTOFILL&&a===s&&n===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}setMouseUp(){this.ctx.autofill.enable&&(this.isAutofillIng()&&this.autofillData(),this.ctx.autofill.enable=!1,this.ctx.autofillMove=!1,this.ctx.autofill.xArr=[-1,-1],this.ctx.autofill.yArr=[-1,-1])}setAutofill(e,t){const{ENABLE_AUTOFILL:r,ENABLE_SELECTOR_SPAN_COL:s,ENABLE_SELECTOR_SPAN_ROW:o}=this.ctx.config;if(!r)return;let a=e,n=t;if(!o){const[c]=n;n=[c,c]}if(!s){const[c]=a;a=[c,c]}if(JSON.stringify(this.ctx.autofill.xArr)!==JSON.stringify(a)||JSON.stringify(this.ctx.autofill.yArr)!==JSON.stringify(n)){const{SELECTOR_AREA_MIN_X:c,SELECTOR_AREA_MAX_X:d,SELECTOR_AREA_MIN_Y:u,SELECTOR_AREA_MAX_Y:f,SELECTOR_AREA_MAX_X_OFFSET:g,SELECTOR_AREA_MAX_Y_OFFSET:v}=this.ctx.config,p=c,m=d||this.ctx.maxColIndex-g,x=u,C=f||this.ctx.maxRowIndex-v;let[_,y]=a,[b,E]=n;if(_<p||b<x)return;a=[Math.max(p,_),Math.min(m,y)],n=[Math.max(x,b),Math.min(C,E)];const{BEFORE_SET_AUTOFILL_METHOD:S}=this.ctx.config;if(typeof S=="function"){const $=S({focusCell:this.ctx.focusCell,xArr:a,yArr:n});if(!$)return;a=$.xArr,n=$.yArr}this.ctx.autofill.xArr=a,this.ctx.autofill.yArr=n,this.ctx.emit("setAutofill",this.ctx.autofill),this.ctx.emit("draw")}}async autofillData(){const e=new Set,t=this.ctx.getSelectedData(),r=new Map;for(let v=0;v<=t.yArr[1]-t.yArr[0];v++)for(let p=0;p<=t.xArr[1]-t.xArr[0];p++){const m=v+t.yArr[0],x=p+t.xArr[0];r.set(`${m}-${x}`,!0)}const{value:s}=t,o=s[0].length,a=s.length,n=this.ctx.autofill.xArr,c=this.ctx.autofill.yArr,d=o===1&&a===1;if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.database.hasMergeCell(n,c)&&!d){const v={code:"ERR_MERGED_CELLS_AUTOFILL",message:"Merged cells cannot span autofill data"};this.ctx.hasEvent("error")?this.ctx.emit("error",v):alert(v.message);return}let u=[];for(let v=0;v<=c[1]-c[0];v++)for(let p=0;p<=n[1]-n[0];p++){const m=p+n[0],x=v+c[0],C=s[v%a][p%o],_=this.ctx.database.getItemValueForRowIndexAndColIndex(x,m),y=`${x}-${m}`;if(_&&!r.has(y)){const{rowKey:b,key:E}=_;this.ctx.database.getReadonly(b,E)||(e.add(b),u.push({rowKey:b,key:E,value:C,row:{}}))}}if(!u.length)return;this.ctx.selector.xArr=this.ctx.autofill.xArr,this.ctx.selector.yArr=this.ctx.autofill.yArr;const{BEFORE_AUTOFILL_DATA_METHOD:f}=this.ctx.config;if(typeof f=="function"){const v=f,p=u.map(m=>({rowKey:m.rowKey,key:m.key,value:m.value,oldValue:this.ctx.database.getItemValue(m.rowKey,m.key),row:this.ctx.database.getRowDataItemForRowKey(m.rowKey)}));if(u=await v(p,n,c),u&&!u.length)return}this.ctx.batchSetItemValueByEditor(u,!0);let g=[];e.forEach(v=>{g.push(this.ctx.database.getRowDataItemForRowKey(v))}),this.ctx.emit("autofillChange",u,g),this.ctx.emit("draw")}mouseenter(e){if(["index","selection","index-selection"].includes(e.type))return;const{selector:t,autofill:r}=this.ctx;if(this.ctx.mousedown&&t.enable&&r.enable){const{rowIndex:s,colIndex:o}=e,a=t.xArr.slice(),n=t.yArr.slice();s>=t.yArr[0]&&s<=t.yArr[1]?o>t.xArr[1]?a.splice(1,1,o):o<t.xArr[0]&&a.splice(0,1,o):s>t.yArr[1]?n.splice(1,1,s):s<t.yArr[0]&&n.splice(0,1,s),this.setAutofill(a,n)}}destroy(){}}const At=Math.min,ht=Math.max,xi=Math.round,Se=i=>({x:i,y:i}),KC={left:"right",right:"left",bottom:"top",top:"bottom"},PC={start:"end",end:"start"};function sr(i,e,t){return ht(i,At(e,t))}function zt(i,e){return typeof i=="function"?i(e):i}function it(i){return i.split("-")[0]}function Gt(i){return i.split("-")[1]}function Fn(i){return i==="x"?"y":"x"}function Or(i){return i==="y"?"height":"width"}const YC=new Set(["top","bottom"]);function Xe(i){return YC.has(it(i))?"y":"x"}function $r(i){return Fn(Xe(i))}function VC(i,e,t){t===void 0&&(t=!1);const r=Gt(i),s=$r(i),o=Or(s);let a=s==="x"?r===(t?"end":"start")?"right":"left":r==="start"?"bottom":"top";return e.reference[o]>e.floating[o]&&(a=wi(a)),[a,wi(a)]}function WC(i){const e=wi(i);return[or(i),e,or(e)]}function or(i){return i.replace(/start|end/g,e=>PC[e])}const Eo=["left","right"],Co=["right","left"],XC=["top","bottom"],zC=["bottom","top"];function GC(i,e,t){switch(i){case"top":case"bottom":return t?e?Co:Eo:e?Eo:Co;case"left":case"right":return e?XC:zC;default:return[]}}function UC(i,e,t,r){const s=Gt(i);let o=GC(it(i),t==="start",r);return s&&(o=o.map(a=>a+"-"+s),e&&(o=o.concat(o.map(or)))),o}function wi(i){return i.replace(/left|right|bottom|top/g,e=>KC[e])}function qC(i){return{top:0,right:0,bottom:0,left:0,...i}}function Kn(i){return typeof i!="number"?qC(i):{top:i,right:i,bottom:i,left:i}}function yi(i){const{x:e,y:t,width:r,height:s}=i;return{width:r,height:s,top:t,left:e,right:e+r,bottom:t+s,x:e,y:t}}function bo(i,e,t){let{reference:r,floating:s}=i;const o=Xe(e),a=$r(e),n=Or(a),c=it(e),d=o==="y",u=r.x+r.width/2-s.width/2,f=r.y+r.height/2-s.height/2,g=r[n]/2-s[n]/2;let v;switch(c){case"top":v={x:u,y:r.y-s.height};break;case"bottom":v={x:u,y:r.y+r.height};break;case"right":v={x:r.x+r.width,y:f};break;case"left":v={x:r.x-s.width,y:f};break;default:v={x:r.x,y:r.y}}switch(Gt(e)){case"start":v[a]-=g*(t&&d?-1:1);break;case"end":v[a]+=g*(t&&d?-1:1);break}return v}const ZC=async(i,e,t)=>{const{placement:r="bottom",strategy:s="absolute",middleware:o=[],platform:a}=t,n=o.filter(Boolean),c=await(a.isRTL==null?void 0:a.isRTL(e));let d=await a.getElementRects({reference:i,floating:e,strategy:s}),{x:u,y:f}=bo(d,r,c),g=r,v={},p=0;for(let m=0;m<n.length;m++){const{name:x,fn:C}=n[m],{x:_,y,data:b,reset:E}=await C({x:u,y:f,initialPlacement:r,placement:g,strategy:s,middlewareData:v,rects:d,platform:a,elements:{reference:i,floating:e}});u=_??u,f=y??f,v={...v,[x]:{...v[x],...b}},E&&p<=50&&(p++,typeof E=="object"&&(E.placement&&(g=E.placement),E.rects&&(d=E.rects===!0?await a.getElementRects({reference:i,floating:e,strategy:s}):E.rects),{x:u,y:f}=bo(d,g,c)),m=-1)}return{x:u,y:f,placement:g,strategy:s,middlewareData:v}};async function Pn(i,e){var t;e===void 0&&(e={});const{x:r,y:s,platform:o,rects:a,elements:n,strategy:c}=i,{boundary:d="clippingAncestors",rootBoundary:u="viewport",elementContext:f="floating",altBoundary:g=!1,padding:v=0}=zt(e,i),p=Kn(v),m=n[g?f==="floating"?"reference":"floating":f],x=yi(await o.getClippingRect({element:(t=await(o.isElement==null?void 0:o.isElement(m)))==null||t?m:m.contextElement||await(o.getDocumentElement==null?void 0:o.getDocumentElement(n.floating)),boundary:d,rootBoundary:u,strategy:c})),C=f==="floating"?{x:r,y:s,width:a.floating.width,height:a.floating.height}:a.reference,_=await(o.getOffsetParent==null?void 0:o.getOffsetParent(n.floating)),y=await(o.isElement==null?void 0:o.isElement(_))?await(o.getScale==null?void 0:o.getScale(_))||{x:1,y:1}:{x:1,y:1},b=yi(o.convertOffsetParentRelativeRectToViewportRelativeRect?await o.convertOffsetParentRelativeRectToViewportRelativeRect({elements:n,rect:C,offsetParent:_,strategy:c}):C);return{top:(x.top-b.top+p.top)/y.y,bottom:(b.bottom-x.bottom+p.bottom)/y.y,left:(x.left-b.left+p.left)/y.x,right:(b.right-x.right+p.right)/y.x}}const JC=i=>({name:"arrow",options:i,async fn(e){const{x:t,y:r,placement:s,rects:o,platform:a,elements:n,middlewareData:c}=e,{element:d,padding:u=0}=zt(i,e)||{};if(d==null)return{};const f=Kn(u),g={x:t,y:r},v=$r(s),p=Or(v),m=await a.getDimensions(d),x=v==="y",C=x?"top":"left",_=x?"bottom":"right",y=x?"clientHeight":"clientWidth",b=o.reference[p]+o.reference[v]-g[v]-o.floating[p],E=g[v]-o.reference[v],S=await(a.getOffsetParent==null?void 0:a.getOffsetParent(d));let $=S?S[y]:0;(!$||!await(a.isElement==null?void 0:a.isElement(S)))&&($=n.floating[y]||o.floating[p]);const k=b/2-E/2,T=$/2-m[p]/2-1,I=At(f[C],T),w=At(f[_],T),A=I,F=$-m[p]-w,H=$/2-m[p]/2+k,W=sr(A,H,F),P=!c.arrow&&Gt(s)!=null&&H!==W&&o.reference[p]/2-(H<A?I:w)-m[p]/2<0,Y=P?H<A?H-A:H-F:0;return{[v]:g[v]+Y,data:{[v]:W,centerOffset:H-W-Y,...P&&{alignmentOffset:Y}},reset:P}}}),QC=function(i){return i===void 0&&(i={}),{name:"flip",options:i,async fn(e){var t,r;const{placement:s,middlewareData:o,rects:a,initialPlacement:n,platform:c,elements:d}=e,{mainAxis:u=!0,crossAxis:f=!0,fallbackPlacements:g,fallbackStrategy:v="bestFit",fallbackAxisSideDirection:p="none",flipAlignment:m=!0,...x}=zt(i,e);if((t=o.arrow)!=null&&t.alignmentOffset)return{};const C=it(s),_=Xe(n),y=it(n)===n,b=await(c.isRTL==null?void 0:c.isRTL(d.floating)),E=g||(y||!m?[wi(n)]:WC(n)),S=p!=="none";!g&&S&&E.push(...UC(n,m,p,b));const $=[n,...E],k=await Pn(e,x),T=[];let I=((r=o.flip)==null?void 0:r.overflows)||[];if(u&&T.push(k[C]),f){const H=VC(s,a,b);T.push(k[H[0]],k[H[1]])}if(I=[...I,{placement:s,overflows:T}],!T.every(H=>H<=0)){var w,A;const H=(((w=o.flip)==null?void 0:w.index)||0)+1,W=$[H];if(W&&(!(f==="alignment"&&_!==Xe(W))||I.every(Y=>Xe(Y.placement)===_?Y.overflows[0]>0:!0)))return{data:{index:H,overflows:I},reset:{placement:W}};let P=(A=I.filter(Y=>Y.overflows[0]<=0).sort((Y,X)=>Y.overflows[1]-X.overflows[1])[0])==null?void 0:A.placement;if(!P)switch(v){case"bestFit":{var F;const Y=(F=I.filter(X=>{if(S){const V=Xe(X.placement);return V===_||V==="y"}return!0}).map(X=>[X.placement,X.overflows.filter(V=>V>0).reduce((V,Ee)=>V+Ee,0)]).sort((X,V)=>X[1]-V[1])[0])==null?void 0:F[0];Y&&(P=Y);break}case"initialPlacement":P=n;break}if(s!==P)return{reset:{placement:P}}}return{}}}},jC=new Set(["left","top"]);async function eb(i,e){const{placement:t,platform:r,elements:s}=i,o=await(r.isRTL==null?void 0:r.isRTL(s.floating)),a=it(t),n=Gt(t),c=Xe(t)==="y",d=jC.has(a)?-1:1,u=o&&c?-1:1,f=zt(e,i);let{mainAxis:g,crossAxis:v,alignmentAxis:p}=typeof f=="number"?{mainAxis:f,crossAxis:0,alignmentAxis:null}:{mainAxis:f.mainAxis||0,crossAxis:f.crossAxis||0,alignmentAxis:f.alignmentAxis};return n&&typeof p=="number"&&(v=n==="end"?p*-1:p),c?{x:v*u,y:g*d}:{x:g*d,y:v*u}}const tb=function(i){return i===void 0&&(i=0),{name:"offset",options:i,async fn(e){var t,r;const{x:s,y:o,placement:a,middlewareData:n}=e,c=await eb(e,i);return a===((t=n.offset)==null?void 0:t.placement)&&(r=n.arrow)!=null&&r.alignmentOffset?{}:{x:s+c.x,y:o+c.y,data:{...c,placement:a}}}}},ib=function(i){return i===void 0&&(i={}),{name:"shift",options:i,async fn(e){const{x:t,y:r,placement:s}=e,{mainAxis:o=!0,crossAxis:a=!1,limiter:n={fn:x=>{let{x:C,y:_}=x;return{x:C,y:_}}},...c}=zt(i,e),d={x:t,y:r},u=await Pn(e,c),f=Xe(it(s)),g=Fn(f);let v=d[g],p=d[f];if(o){const x=g==="y"?"top":"left",C=g==="y"?"bottom":"right",_=v+u[x],y=v-u[C];v=sr(_,v,y)}if(a){const x=f==="y"?"top":"left",C=f==="y"?"bottom":"right",_=p+u[x],y=p-u[C];p=sr(_,p,y)}const m=n.fn({...e,[g]:v,[f]:p});return{...m,data:{x:m.x-t,y:m.y-r,enabled:{[g]:o,[f]:a}}}}}};function ki(){return typeof window<"u"}function yt(i){return Yn(i)?(i.nodeName||"").toLowerCase():"#document"}function ae(i){var e;return(i==null||(e=i.ownerDocument)==null?void 0:e.defaultView)||window}function Fe(i){var e;return(e=(Yn(i)?i.ownerDocument:i.document)||window.document)==null?void 0:e.documentElement}function Yn(i){return ki()?i instanceof Node||i instanceof ae(i).Node:!1}function me(i){return ki()?i instanceof Element||i instanceof ae(i).Element:!1}function Ie(i){return ki()?i instanceof HTMLElement||i instanceof ae(i).HTMLElement:!1}function _o(i){return!ki()||typeof ShadowRoot>"u"?!1:i instanceof ShadowRoot||i instanceof ae(i).ShadowRoot}const rb=new Set(["inline","contents"]);function Ut(i){const{overflow:e,overflowX:t,overflowY:r,display:s}=xe(i);return/auto|scroll|overlay|hidden|clip/.test(e+r+t)&&!rb.has(s)}const sb=new Set(["table","td","th"]);function ob(i){return sb.has(yt(i))}const ab=[":popover-open",":modal"];function Li(i){return ab.some(e=>{try{return i.matches(e)}catch{return!1}})}const nb=["transform","translate","scale","rotate","perspective"],lb=["transform","translate","scale","rotate","perspective","filter"],cb=["paint","layout","strict","content"];function kr(i){const e=Lr(),t=me(i)?xe(i):i;return nb.some(r=>t[r]?t[r]!=="none":!1)||(t.containerType?t.containerType!=="normal":!1)||!e&&(t.backdropFilter?t.backdropFilter!=="none":!1)||!e&&(t.filter?t.filter!=="none":!1)||lb.some(r=>(t.willChange||"").includes(r))||cb.some(r=>(t.contain||"").includes(r))}function hb(i){let e=Ge(i);for(;Ie(e)&&!ft(e);){if(kr(e))return e;if(Li(e))return null;e=Ge(e)}return null}function Lr(){return typeof CSS>"u"||!CSS.supports?!1:CSS.supports("-webkit-backdrop-filter","none")}const db=new Set(["html","body","#document"]);function ft(i){return db.has(yt(i))}function xe(i){return ae(i).getComputedStyle(i)}function Di(i){return me(i)?{scrollLeft:i.scrollLeft,scrollTop:i.scrollTop}:{scrollLeft:i.scrollX,scrollTop:i.scrollY}}function Ge(i){if(yt(i)==="html")return i;const e=i.assignedSlot||i.parentNode||_o(i)&&i.host||Fe(i);return _o(e)?e.host:e}function Vn(i){const e=Ge(i);return ft(e)?i.ownerDocument?i.ownerDocument.body:i.body:Ie(e)&&Ut(e)?e:Vn(e)}function Wn(i,e,t){var r;e===void 0&&(e=[]);const s=Vn(i),o=s===((r=i.ownerDocument)==null?void 0:r.body),a=ae(s);return o?(ar(a),e.concat(a,a.visualViewport||[],Ut(s)?s:[],[])):e.concat(s,Wn(s,[]))}function ar(i){return i.parent&&Object.getPrototypeOf(i.parent)?i.frameElement:null}function Xn(i){const e=xe(i);let t=parseFloat(e.width)||0,r=parseFloat(e.height)||0;const s=Ie(i),o=s?i.offsetWidth:t,a=s?i.offsetHeight:r,n=xi(t)!==o||xi(r)!==a;return n&&(t=o,r=a),{width:t,height:r,$:n}}function zn(i){return me(i)?i:i.contextElement}function dt(i){const e=zn(i);if(!Ie(e))return Se(1);const t=e.getBoundingClientRect(),{width:r,height:s,$:o}=Xn(e);let a=(o?xi(t.width):t.width)/r,n=(o?xi(t.height):t.height)/s;return(!a||!Number.isFinite(a))&&(a=1),(!n||!Number.isFinite(n))&&(n=1),{x:a,y:n}}const ub=Se(0);function Gn(i){const e=ae(i);return!Lr()||!e.visualViewport?ub:{x:e.visualViewport.offsetLeft,y:e.visualViewport.offsetTop}}function fb(i,e,t){return e===void 0&&(e=!1),!t||e&&t!==ae(i)?!1:e}function Nt(i,e,t,r){e===void 0&&(e=!1),t===void 0&&(t=!1);const s=i.getBoundingClientRect(),o=zn(i);let a=Se(1);e&&(r?me(r)&&(a=dt(r)):a=dt(i));const n=fb(o,t,r)?Gn(o):Se(0);let c=(s.left+n.x)/a.x,d=(s.top+n.y)/a.y,u=s.width/a.x,f=s.height/a.y;if(o){const g=ae(o),v=r&&me(r)?ae(r):r;let p=g,m=ar(p);for(;m&&r&&v!==p;){const x=dt(m),C=m.getBoundingClientRect(),_=xe(m),y=C.left+(m.clientLeft+parseFloat(_.paddingLeft))*x.x,b=C.top+(m.clientTop+parseFloat(_.paddingTop))*x.y;c*=x.x,d*=x.y,u*=x.x,f*=x.y,c+=y,d+=b,p=ae(m),m=ar(p)}}return yi({width:u,height:f,x:c,y:d})}function Dr(i,e){const t=Di(i).scrollLeft;return e?e.left+t:Nt(Fe(i)).left+t}function Un(i,e,t){t===void 0&&(t=!1);const r=i.getBoundingClientRect(),s=r.left+e.scrollLeft-(t?0:Dr(i,r)),o=r.top+e.scrollTop;return{x:s,y:o}}function gb(i){let{elements:e,rect:t,offsetParent:r,strategy:s}=i;const o=s==="fixed",a=Fe(r),n=e?Li(e.floating):!1;if(r===a||n&&o)return t;let c={scrollLeft:0,scrollTop:0},d=Se(1);const u=Se(0),f=Ie(r);if((f||!f&&!o)&&((yt(r)!=="body"||Ut(a))&&(c=Di(r)),Ie(r))){const v=Nt(r);d=dt(r),u.x=v.x+r.clientLeft,u.y=v.y+r.clientTop}const g=a&&!f&&!o?Un(a,c,!0):Se(0);return{width:t.width*d.x,height:t.height*d.y,x:t.x*d.x-c.scrollLeft*d.x+u.x+g.x,y:t.y*d.y-c.scrollTop*d.y+u.y+g.y}}function vb(i){return Array.from(i.getClientRects())}function pb(i){const e=Fe(i),t=Di(i),r=i.ownerDocument.body,s=ht(e.scrollWidth,e.clientWidth,r.scrollWidth,r.clientWidth),o=ht(e.scrollHeight,e.clientHeight,r.scrollHeight,r.clientHeight);let a=-t.scrollLeft+Dr(i);const n=-t.scrollTop;return xe(r).direction==="rtl"&&(a+=ht(e.clientWidth,r.clientWidth)-s),{width:s,height:o,x:a,y:n}}function mb(i,e){const t=ae(i),r=Fe(i),s=t.visualViewport;let o=r.clientWidth,a=r.clientHeight,n=0,c=0;if(s){o=s.width,a=s.height;const d=Lr();(!d||d&&e==="fixed")&&(n=s.offsetLeft,c=s.offsetTop)}return{width:o,height:a,x:n,y:c}}const xb=new Set(["absolute","fixed"]);function wb(i,e){const t=Nt(i,!0,e==="fixed"),r=t.top+i.clientTop,s=t.left+i.clientLeft,o=Ie(i)?dt(i):Se(1),a=i.clientWidth*o.x,n=i.clientHeight*o.y,c=s*o.x,d=r*o.y;return{width:a,height:n,x:c,y:d}}function Ro(i,e,t){let r;if(e==="viewport")r=mb(i,t);else if(e==="document")r=pb(Fe(i));else if(me(e))r=wb(e,t);else{const s=Gn(i);r={x:e.x-s.x,y:e.y-s.y,width:e.width,height:e.height}}return yi(r)}function qn(i,e){const t=Ge(i);return t===e||!me(t)||ft(t)?!1:xe(t).position==="fixed"||qn(t,e)}function yb(i,e){const t=e.get(i);if(t)return t;let r=Wn(i,[]).filter(n=>me(n)&&yt(n)!=="body"),s=null;const o=xe(i).position==="fixed";let a=o?Ge(i):i;for(;me(a)&&!ft(a);){const n=xe(a),c=kr(a);!c&&n.position==="fixed"&&(s=null),(o?!c&&!s:!c&&n.position==="static"&&s&&xb.has(s.position)||Ut(a)&&!c&&qn(i,a))?r=r.filter(d=>d!==a):s=n,a=Ge(a)}return e.set(i,r),r}function Eb(i){let{element:e,boundary:t,rootBoundary:r,strategy:s}=i;const o=[...t==="clippingAncestors"?Li(e)?[]:yb(e,this._c):[].concat(t),r],a=o[0],n=o.reduce((c,d)=>{const u=Ro(e,d,s);return c.top=ht(u.top,c.top),c.right=At(u.right,c.right),c.bottom=At(u.bottom,c.bottom),c.left=ht(u.left,c.left),c},Ro(e,a,s));return{width:n.right-n.left,height:n.bottom-n.top,x:n.left,y:n.top}}function Cb(i){const{width:e,height:t}=Xn(i);return{width:e,height:t}}function bb(i,e,t){const r=Ie(e),s=Fe(e),o=t==="fixed",a=Nt(i,!0,o,e);let n={scrollLeft:0,scrollTop:0};const c=Se(0);function d(){c.x=Dr(s)}if(r||!r&&!o)if((yt(e)!=="body"||Ut(s))&&(n=Di(e)),r){const v=Nt(e,!0,o,e);c.x=v.x+e.clientLeft,c.y=v.y+e.clientTop}else s&&d();o&&!r&&s&&d();const u=s&&!r&&!o?Un(s,n):Se(0),f=a.left+n.scrollLeft-c.x-u.x,g=a.top+n.scrollTop-c.y-u.y;return{x:f,y:g,width:a.width,height:a.height}}function Qi(i){return xe(i).position==="static"}function So(i,e){if(!Ie(i)||xe(i).position==="fixed")return null;if(e)return e(i);let t=i.offsetParent;return Fe(i)===t&&(t=t.ownerDocument.body),t}function Zn(i,e){const t=ae(i);if(Li(i))return t;if(!Ie(i)){let s=Ge(i);for(;s&&!ft(s);){if(me(s)&&!Qi(s))return s;s=Ge(s)}return t}let r=So(i,e);for(;r&&ob(r)&&Qi(r);)r=So(r,e);return r&&ft(r)&&Qi(r)&&!kr(r)?t:r||hb(i)||t}const _b=async function(i){const e=this.getOffsetParent||Zn,t=this.getDimensions,r=await t(i.floating);return{reference:bb(i.reference,await e(i.floating),i.strategy),floating:{x:0,y:0,width:r.width,height:r.height}}};function Rb(i){return xe(i).direction==="rtl"}const Sb={convertOffsetParentRelativeRectToViewportRelativeRect:gb,getDocumentElement:Fe,getClippingRect:Eb,getOffsetParent:Zn,getElementRects:_b,getClientRects:vb,getDimensions:Cb,getScale:dt,isElement:me,isRTL:Rb},Jn=tb,Qn=ib,jn=QC,Ib=JC,el=(i,e,t)=>{const r=new Map,s={platform:Sb,...t},o={...s.platform,_c:r};return ZC(i,e,{...s,platform:o})};let Tb=class{constructor(i){h(this,"ctx"),h(this,"enable",!1),h(this,"contentEl"),h(this,"floatingEl"),h(this,"arrowEl"),this.ctx=i;const{TOOLTIP_BG_COLOR:e,TOOLTIP_TEXT_COLOR:t,TOOLTIP_ZINDEX:r,TOOLTIP_CUSTOM_STYLE:s,CSS_PREFIX:o}=this.ctx.config;this.contentEl=document.createElement("div"),this.arrowEl=document.createElement("div"),this.floatingEl=document.createElement("div"),this.floatingEl.className=`${o}-tooltip`,this.contentEl.className=`${o}-tooltip-content`,this.arrowEl.className=`${o}-tooltip-arrow`;const a={display:"none",position:"absolute",background:e,color:t,boxSizing:"border-box",zIndex:r,padding:"8px",borderRadius:"4px",fontSize:"12px",...s},n={position:"absolute",width:"10px",height:"10px",background:a.background,backgroundColor:a.backgroundColor,transform:"rotate(45deg)",zIndex:a.zIndex};Object.assign(this.arrowEl.style,n),Object.assign(this.floatingEl.style,a),this.floatingEl.appendChild(this.contentEl),this.floatingEl.appendChild(this.arrowEl),this.ctx.containerElement.appendChild(this.floatingEl),this.init()}init(){this.floatingEl.addEventListener("mouseleave",()=>{this.hide()}),this.ctx.on("mouseout",i=>{this.floatingEl.contains(i.relatedTarget)||this.hide()}),this.ctx.on("onScroll",()=>{this.hide()}),this.ctx.on("startEdit",()=>{this.hide()}),this.ctx.on("visibleCellHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||(i.ellipsis||i.message)&&this.show(i)}),this.ctx.on("visibleCellMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderMouseleave",(i,e)=>{this.floatingEl.contains(e.target)||this.hide()}),this.ctx.on("cellHeaderHoverChange",(i,e)=>{this.floatingEl.contains(e.target)||i.ellipsis&&this.show(i)})}show(i){if(!i.overflowTooltipShow||this.ctx.mousedown)return;this.floatingEl.style.display="block";let e=i.getText();i.message&&(e=i.message);const t=this.ctx.containerElement.getBoundingClientRect();if(!t)return;this.enable=!0,this.contentEl.style.maxWidth=`${i.overflowTooltipMaxWidth||500}px`,this.contentEl.style.minWidth="100px",this.contentEl.style.width="100%",this.contentEl.style.display="inline-block",this.contentEl.style.wordBreak="break-all",this.contentEl.style.lineHeight="1.5",this.contentEl.innerText=e;const r=i.drawX+t.x,s=i.drawY+t.y;el({getBoundingClientRect(){return{width:i.visibleWidth,height:i.visibleHeight,x:r,y:s,left:r,right:r+i.visibleWidth,top:s,bottom:s+i.visibleHeight}}},this.floatingEl,{placement:i.overflowTooltipPlacement,middleware:[Qn(),jn(),Jn(6),Ib({element:this.arrowEl})]}).then(o=>{const{x:a,y:n,placement:c,middlewareData:d}=o;if(Object.assign(this.floatingEl.style,{top:`${n}px`,left:`${a}px`}),d.arrow){const u=d.arrow;["left","left-start","left-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"",right:"-5px"}):["right","right-start","right-end"].includes(c)?Object.assign(this.arrowEl.style,{top:`${u.y}px`,bottom:"",left:"-5px",right:""}):["bottom","bottom-start","bottom-end"].includes(c)?Object.assign(this.arrowEl.style,{top:"-5px",bottom:"",left:`${u.x}px`,right:""}):["top","top-start","top-end"].includes(c)&&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 Ob{constructor(e){h(this,"editorEl"),h(this,"inputEl"),h(this,"enable",!1),h(this,"cellTarget",null),h(this,"selectorArrStr",""),h(this,"ctx"),h(this,"drawY",0),h(this,"drawX",0),h(this,"cancel",!1),this.ctx=e,this.initTextEditor(),this.init()}init(){this.ctx.on("outsideMousedown",()=>{this.cellTarget&&this.cellTarget.editorType==="text"&&this.clearEditor()}),this.ctx.on("moveFocus",e=>{this.cellTarget=e;const{xArr:t,yArr:r}=this.ctx.selector;this.selectorArrStr=JSON.stringify(t)+JSON.stringify(r)}),this.ctx.on("onScroll",()=>{this.enable&&this.doneEdit()}),this.ctx.on("cellHeaderMousedown",()=>{this.enable&&this.doneEdit(),this.cellTarget=null}),this.ctx.on("hoverIconClick",e=>{e.editorType!=="none"&&this.editCell(e.rowIndex,e.colIndex)}),this.ctx.on("keydown",e=>{if(!this.ctx.isTarget(e)||!this.ctx.focusCell)return;if(e.code==="Escape"&&this.ctx.editing){this.cancel=!0;const{focusCell:n}=this.ctx;n&&(this.ctx.emit("setSelectorCell",n),this.cellTarget=n),this.doneEdit();return}if((e.altKey||e.metaKey)&&e.code==="Enter"&&this.ctx.editing&&this.inputEl){e.preventDefault();const n=this.inputEl.selectionStart,c=this.inputEl.value.substring(0,n),d=this.inputEl.value.substring(n);this.inputEl.value=c+`
|
|
5
|
+
`+d,this.inputEl.selectionStart=this.inputEl.selectionEnd=n+1,this.autoSize();return}if(e.code==="Tab"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","LEFT");return}this.ctx.emit("setMoveFocus","RIGHT");return}if(e.code==="Enter"&&this.ctx.editing){if(e.preventDefault(),this.doneEdit(),e.shiftKey){this.ctx.emit("setMoveFocus","TOP");return}this.ctx.emit("setMoveFocus","BOTTOM");return}if(e.code==="Enter"&&!this.ctx.editing){e.preventDefault(),this.startEdit();return}const t=e.key,r=e.ctrlKey,s=e.altKey,o=e.shiftKey,a=e.metaKey;r||s||o||a||["Enter","Escape","Tab","Backspace","Delete","ArrowUp","ArrowDown","ArrowLeft","ArrowRight","Home","End","PageUp","PageDown","Insert","F1","F2","F3","F4","F5","F6","F7","F8","F9","F10","F11","F12"].includes(t)||this.startEdit(!0)}),this.ctx.on("cellMouseup",e=>{if(this.ctx.adjustPositioning||this.ctx.isPointer||!this.isInSelectorRange(e.rowIndex,e.colIndex))return;const{xArr:t,yArr:r}=this.ctx.selector,s=JSON.stringify(t)+JSON.stringify(r);if(this.selectorArrStr===s&&this.cellTarget){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}if(this.ctx.selectOnlyOne&&e.rowKey===this.cellTarget.rowKey&&e.key===this.cellTarget.key){this.startEdit();return}}if(this.selectorArrStr=s,this.doneEdit(),this.cellTarget=e,this.ctx.config.ENABLE_EDIT_SINGLE_CLICK){if(this.ctx.config.ENABLE_MERGE_CELL_LINK&&this.ctx.onlyMergeCell){this.startEdit();return}this.ctx.selectOnlyOne&&this.startEdit()}})}isInSelectorRange(e,t){const{xArr:r,yArr:s}=this.ctx.selector,[o,a]=r,[n,c]=s;return!(t<o||t>a||e<n||e>c)}initTextEditor(){this.inputEl=document.createElement("textarea"),this.inputEl.setAttribute("rows","1"),this.inputEl.addEventListener("input",this.autoSize.bind(this)),this.inputEl.addEventListener("blur",()=>{this.doneEdit()}),this.editorEl=this.ctx.editorElement,this.inputEl.className="e-virt-table-editor-textarea",this.editorEl.appendChild(this.inputEl),this.ctx.containerElement.appendChild(this.editorEl)}autoSize(){this.inputEl.style.height="auto";let e=this.inputEl.scrollHeight,t=this.ctx.body.visibleHeight;e>t&&(e=t);const{stageHeight:r,footer:s,header:o,config:{SCROLLER_TRACK_SIZE:a}}=this.ctx,n=r-s.height-a;this.editorEl.style.bottom="auto",this.drawY<o.height&&(this.editorEl.style.top=`${o.height-1}px`),this.drawY+e>n&&(this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top="auto",this.editorEl.style.bottom=`${r-n}px`),this.inputEl.style.height=`${e}px`}startEditByInput(e,t=!1){const r=t?null:e.getValue(),{editorType:s}=e;e.update(),this.ctx.config.ENABLE_MERGE_CELL_LINK&&e.updateSpanInfo();let{height:o,width:a,drawY:n,drawX:c}=e;this.drawX=c,this.drawY=n;const{config:{CELL_PADDING:d},header:u}=this.ctx;let f=this.ctx.body.visibleHeight;if(o>f&&(o=f),this.editorEl.style.display="inline-block",this.editorEl.style.left=`${this.drawX-1}px`,this.editorEl.style.top=`${this.drawY-1}px`,this.editorEl.style.bottom="auto",this.editorEl.style.maxHeight=`${f}px`,s==="text"){this.inputEl.style.display="block",this.inputEl.style.minWidth=`${a-1}px`,this.inputEl.style.minHeight=`${o-1}px`,this.inputEl.style.maxHeight=`${f}px`,this.inputEl.style.width=`${a-1}px`,this.inputEl.style.height="auto",this.inputEl.style.padding=`${d}px`,r!==null&&(this.inputEl.value=r),this.inputEl.focus({preventScroll:!0});const g=this.inputEl.value.length;this.inputEl.setSelectionRange(g,g)}else this.inputEl.style.display="none";(this.inputEl.scrollHeight>o||this.drawY<u.height)&&this.autoSize()}doneEditByInput(){if(this.cellTarget&&this.cellTarget.editorType==="text"){const{rowKey:e,key:t}=this.cellTarget,r=this.cellTarget.getValue(),s=this.inputEl.value;s!==r&&!(s===""&&r===null)&&!this.cancel&&this.ctx.setItemValueByEditor(e,t,s,!0),this.inputEl.value=""}}startEdit(e=!1){this.cancel=!1;const{ENABLE_EDIT_CLICK_SELECTOR:t}=this.ctx.config;if(!t)return;const r=this.ctx.focusCell;if(!r||["index","index-selection","selection"].includes(r.type)||this.enable||!(r.isVerticalVisible()&&r.isHorizontalVisible()))return;const{rowKey:s,key:o,editorType:a}=r;if(a==="none")return;const n=this.ctx.database.getReadonly(s,o);r&&!n&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=r,this.startEditByInput(this.cellTarget,e),this.ctx.emit("startEdit",this.cellTarget))}editCell(e,t){const r=this.ctx.body.renderRows.find(d=>d.rowIndex===e);if(!r)return;const s=r.cells.find(d=>d.colIndex===t);if(!s)return;this.ctx.emit("setSelectorCell",s);const o=this.ctx.focusCell;if(!o||["index","index-selection","selection"].includes(o.type)||this.enable)return;const{rowKey:a,key:n}=o,c=this.ctx.database.getReadonly(a,n);o&&!c&&(this.enable=!0,this.ctx.editing=!0,this.cellTarget=o,this.startEditByInput(this.cellTarget),this.ctx.emit("startEdit",this.cellTarget))}doneEdit(){this.enable&&(this.doneEditByInput(),this.ctx.emit("doneEdit",this.cellTarget),this.enable=!1,this.ctx.editing=!1,this.ctx.containerElement.focus({preventScroll:!0}),this.editorEl.style.display="none",this.ctx.emit("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 $b=class{constructor(i){h(this,"ctx"),h(this,"emptyEl"),this.ctx=i;const{EMPTY_TEXT:e,EMPTY_CUSTOM_STYLE:t}=this.ctx.config;this.ctx.emptyElement?this.emptyEl=this.ctx.emptyElement:(this.emptyEl=document.createElement("div"),this.emptyEl.innerText=e),this.emptyEl.className="e-virt-table-empty",this.emptyEl.style.display="none",this.ctx.containerElement.appendChild(this.emptyEl),this.ctx.on("emptyChange",({type:r,headerHeight:s,bodyHeight:o,footerHeight:a})=>{const n=s+(o+a)/2,c={display:r==="empty"?"block":"none",position:"absolute",fontSize:"14px",color:"#666",left:"50%",top:`${n}px`,transform:"translate(-50%, -50%)",...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.observer=new MutationObserver(Mt(()=>{const t=this.ctx.overlayerElement.querySelectorAll('[data-auto-height="true"]'),r=new Map;t.forEach(o=>{const a=Number(o.getAttribute("data-row-index")),n=Number(o.getAttribute("data-col-index"));if(isNaN(a)||isNaN(n)||!(o instanceof HTMLElement)||o.offsetWidth===0)return;const c=`${a}_${n}`;r.set(c,Math.round(o.offsetHeight))});const s=this.ctx.database.getOverlayerAutoHeightMap();if(!this.arerMapsEqual(s,r)){if(this.ctx.database.setOverlayerAutoHeightMap(r),s.size===0&&r.size===0)return;this.ctx.emit("draw")}},16.67)),this.observer.observe(this.ctx.overlayerElement,{childList:!0,subtree:!0,attributes:!0})}arerMapsEqual(e,t){if(e.size!==t.size)return!1;for(let[r,s]of e)if(!t.has(r)||t.get(r)!==s)return!1;return!0}draw(){const e=this.getContainer();this.ctx.emit("overlayerChange",e)}destroy(){this.observer&&this.observer.disconnect(),this.ctx.emit("overlayerChange",{style:{},views:[]})}getContainer(){const e=this.getHeader(),t=this.getBody(),r=this.getFooter();let s=[];const{FOOTER_FIXED:o,FOOTER_POSITION:a}=this.ctx.config;return o?a==="top"?s=[e,r,t]:s=[e,t,r]:s=[e,t],{views:s}}getHeader(){const{fixedLeftWidth:e,fixedRightWidth:t,config:{SCROLLER_TRACK_SIZE:r,CSS_PREFIX:s}}=this.ctx,{visibleWidth:o,visibleHeight:a,renderCellHeaders:n}=this.ctx.header;let c=[],d=[],u=[];n.forEach(m=>{m.render&&(m.fixed==="left"?d.push(m):m.fixed==="right"?u.push(m):c.push(m))});const f=t-r,g={key:"left",style:{position:"absolute",top:"0px",left:"0px",overflow:"hidden",width:`${e}px`,height:`${a}px`},cells:d},v={key:"center",style:{position:"absolute",top:"0px",left:`${e}px`,overflow:"hidden",width:`${o-e-f+1}px`,height:`${a}px`},cells:c},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f+1}px`,height:`${a}px`},cells:u};return{type:"header",class:`${s}-overlayer-header`,style:{position:"relative",overflow:"hidden",width:`${o}px`,height:`${a}px`},views:[g,v,p]}}getBody(){const e=[],t=[],r=[];let s=this.ctx.body.renderRows;this.ctx.config.FOOTER_FIXED||(s=s.concat(this.ctx.footer.renderRows)),s.forEach(m=>{m.cells.forEach(x=>{x.cellType==="footer"&&(x.render=x.renderFooter),x.render&&(x.fixed==="left"?t.push(x):x.fixed==="right"?r.push(x):e.push(x))})});const{fixedLeftWidth:o,fixedRightWidth:a,config:{SCROLLER_TRACK_SIZE:n,CSS_PREFIX:c}}=this.ctx,{visibleWidth:d,visibleHeight:u}=this.ctx.body,f=a-n,g={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${o}px`,height:`${u}px`},cells:t},v={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${o-.5}px`,overflow:"hidden",width:`${d-o-f}px`,height:`${u}px`},cells:e},p={key:"right",style:{position:"absolute",top:"0px",right:"0px",overflow:"hidden",width:`${f}px`,height:`${u}px`},cells:r};return{type:"body",class:`${c}-overlayer-body`,style:{position:"relative",overflow:"hidden",width:`${d}px`,height:`${u}px`},views:[g,v,p]}}getFooter(){const e=[],t=[],r=[];this.ctx.footer.renderRows.forEach(p=>{p.cells.forEach(m=>{m.cellType==="footer"&&m.renderFooter&&(m.render=m.renderFooter,m.fixed==="left"?t.push(m):m.fixed==="right"?r.push(m):e.push(m))})});const{fixedLeftWidth:s,fixedRightWidth:o,config:{SCROLLER_TRACK_SIZE:a,CSS_PREFIX:n}}=this.ctx,{visibleWidth:c,visibleHeight:d}=this.ctx.footer,u=o-a,f={key:"left",style:{position:"absolute",top:`${.5}px`,left:`${.5}px`,overflow:"hidden",width:`${s}px`,height:`${d}px`},cells:t},g={key:"center",style:{position:"absolute",top:`${.5}px`,left:`${s-.5}px`,overflow:"hidden",width:`${c-s-u}px`,height:`${d}px`},cells:e},v={key:"right",style:{position:"absolute",top:`${.5}px`,right:`${.5}px`,overflow:"hidden",width:`${u}px`,height:`${d}px`},cells:r};return{type:"footer",class:`${n}-overlayer-footer`,style:{position:"relative",overflow:"hidden",width:`${c}px`,height:`${d}px`},views:[f,g,v]}}}class Lb{constructor(e){h(this,"ctx"),h(this,"contextMenuEl"),h(this,"custom",!1),this.ctx=e,this.ctx.contextMenuElement?(this.custom=!0,this.contextMenuEl=this.ctx.contextMenuElement):(this.custom=!1,this.contextMenuEl=document.createElement("div")),this.createContextMenu(),this.init()}init(){this.ctx.on("cellContextMenuClick",(e,t)=>{if(!this.ctx.config.ENABLE_CONTEXT_MENU)return;t.preventDefault();const{xArr:r,yArr:s}=this.ctx.selector,[o,a]=r,[n,c]=s,{rowIndex:d,colIndex:u}=e;d>=n&&d<=c&&u>=o&&u<=a||this.ctx.emit("setSelectorCell",e,t);const f={getBoundingClientRect:()=>({width:0,height:0,top:t.clientY,left:t.clientX,right:t.clientX,bottom:t.clientY,x:t.clientX,y:t.clientY}),contextElement:document.body};el(f,this.contextMenuEl,{placement:"right-start",middleware:[Jn(),Qn(),jn()]}).then(({x:g,y:v})=>{this.show(g,v)})}),this.ctx.on("click",this.hide.bind(this)),this.ctx.on("onScroll",this.hide.bind(this)),this.ctx.on("resize",this.hide.bind(this))}createContextMenu(){if(this.contextMenuEl.className="e-virt-table-context-menu",this.contextMenuEl.addEventListener("contextmenu",function(t){t.preventDefault()}),this.ctx.containerElement.appendChild(this.contextMenuEl),this.custom)return;const{CONTEXT_MENU:e}=this.ctx.config;this.createContextMenuItems(e,t=>{switch(t.value){case"copy":this.ctx.emit("contextMenuCopy");break;case"paste":this.ctx.emit("contextMenuPaste");break;case"cut":this.ctx.emit("contextMenuCut");break;case"clearSelected":this.ctx.emit("contextMenuClearSelected");break}this.hide()})}createContextMenuItems(e,t){this.contextMenuEl.replaceChildren(),e.forEach(r=>{const s=document.createElement("div");s.className="e-virt-table-context-menu-item",s.innerText=r.label,r.event?s.onclick=()=>{r.event&&r.event(),t(r)}:s.onclick=()=>t(r),this.contextMenuEl.appendChild(s)})}show(e,t){Object.assign(this.contextMenuEl.style,{left:`${e}px`,top:`${t}px`})}hide(){Object.assign(this.contextMenuEl.style,{left:"-99999px",top:"-99999px"})}updated(){this.createContextMenu()}destroy(){this.contextMenuEl.remove()}}class Db{constructor(e){if(h(this,"ctx"),h(this,"loadingEl"),this.ctx=e,this.ctx.loadingElement)this.loadingEl=this.ctx.loadingElement;else{this.loadingEl=document.createElement("div");const t=document.createElement("div");t.className="e-virt-table-loading-spinner";const r=this.ctx.icons.getSvg("loading");if(r){const o=new DOMParser().parseFromString(r.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 Mb{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,"ctx"),this.options=t;const{overlayerElement:r,editorElement:s,emptyElement:o,contextMenuElement:a}=this.options,n=this.createContainer(e,r,s,o,a);this.ctx=new DC(n,this.options),this.header=new AC(this.ctx),this.footer=new BC(this.ctx),this.body=new NC(this.ctx),this.scroller=new MC(this.ctx),this.selector=new HC(this.ctx),this.autofill=new FC(this.ctx),this.tooltip=new Tb(this.ctx),this.empty=new $b(this.ctx),this.editor=new Ob(this.ctx),this.overlayer=new kb(this.ctx),this.contextMenu=new Lb(this.ctx),this.loading=new Db(this.ctx),this.ctx.on("draw",Mt(()=>{this.draw()},()=>this.ctx.drawTime)),this.ctx.on("drawView",Mt(()=>{this.draw(!0)},()=>this.ctx.drawTime)),this.draw()}createContainer(e,t,r,s,o){e.className="e-virt-table-container";const a=document.createElement("div"),n=document.createElement("canvas"),c=t||document.createElement("div");a.className="e-virt-table-stage",e.tabIndex=0,n.className="e-virt-table-canvas",c.className="e-virt-table-overlayer";const d=r||document.createElement("div");d.className="e-virt-table-editor";const u=s,f=o;return a.appendChild(n),a.appendChild(c),e.appendChild(a),{containerElement:e,stageElement:a,canvasElement:n,overlayerElement:c,editorElement:d,emptyElement:u,contextMenuElement:f}}draw(e=!1){requestAnimationFrame(()=>{const t=performance.now();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(),requestAnimationFrame(()=>{this.body.updateAutoHeight()});const r=performance.now(),s=Math.round(r-t);this.ctx.drawTime=s*this.ctx.config.DRAW_TIME_MULTIPLIER})}loadConfig(e){this.ctx.config.init(e),this.ctx.database.init(!1),this.header.init(),this.contextMenu.updated(),this.ctx.emit("draw")}loadColumns(e){this.editor.doneEdit(),this.ctx.database.setColumns(e),this.header.init(),this.ctx.emit("draw")}loadData(e){this.editor.doneEdit(),this.ctx.database.setData(e),this.header.init(),this.tooltip.hide(),this.ctx.emit("draw")}loadFooterData(e){this.ctx.database.setFooterData(e),this.ctx.emit("draw")}setLoading(e){this.ctx.loading=e,e?this.loading.show():this.loading.hide()}on(e,t){this.ctx.on(e,t)}emit(e,...t){this.ctx.emit(e,...t)}off(e,t){this.ctx.off(e,t)}filterMethod(e){this.ctx.database.setFilterMethod(e),this.ctx.database.init(!1),this.header.init(),this.ctx.emit("draw")}editCell(e,t){this.editor.editCell(e,t)}setItemValue(e,t,r,s=!0,o=!0,a=!1){this.ctx.database.setItemValue(e,t,r,s,o,a)}batchSetItemValue(e,t=!0){this.ctx.database.batchSetItemValue(e,t)}setItemValueByEditor(e,t,r,s=!0,o=!0){this.ctx.setItemValueByEditor(e,t,r,s,o),this.editor.doneEdit()}clearEditableData(e=null){const t=[0,this.ctx.maxColIndex],r=[0,this.ctx.maxRowIndex];return this.selector.clearSelectedData(t,r,!1,e)}clearEditor(){this.editor.clearEditor()}doLayout(){this.ctx.emit("draw")}getChangedData(){return this.ctx.database.getChangedData()}getChangedRows(){return this.ctx.database.getChangedRows()}setCurrentRowByRowIndex(e){this.ctx.currentCell=this.ctx.database.getVirtualBodyCell(e,0),this.ctx.emit("draw")}setCurrentRow(e){const t=this.ctx.database.getColumnByColIndex(0);t&&(this.ctx.currentCell=this.ctx.database.getVirtualBodyCellByKey(e,t.key),this.ctx.emit("draw"))}getCurrentRow(){const e=this.ctx.currentCell;return e?{row:e.row,rowIndex:e.rowIndex,rowKey:e.rowKey}:void 0}clearValidate(){this.ctx.database.clearValidate(),this.ctx.emit("draw")}validateFields(e,t=!0){return new Promise(async(r,s)=>{let o=[];for(let a=0;a<e.length;a++){const{rowKey:n,key:c}=e[a],d=await this.ctx.database.getValidator(n,c);Array.isArray(d)&&d.length&&o.push(d)}if(o.length){if(s(o),t){const[a]=o;if(Array.isArray(a)&&a.length){const[n]=a,{rowKey:c,key:d}=n;this.scrollToRowkey(c),this.scrollToColkey(d)}}this.ctx.emit("draw")}else r([]),this.ctx.emit("draw")})}async validate(e=!0){return new Promise(async(t,r)=>{try{const s=await this.getValidations();t(s)}catch(s){if(e&&Array.isArray(s)&&s.length){const[o]=s;if(Array.isArray(o)&&o.length){const[a]=o,{rowKey:n,key:c}=a,d=this.ctx.database.getRowForRowKey(n);if(d){const{parentRowKeys:u=[]}=d;u&&u.length&&this.setExpandRowKeys(u,!0)}this.scrollToRowkey(n),this.scrollToColkey(c)}}r(s)}})}setValidations(e){if(e.forEach(t=>{const{rowIndex:r,key:s,message:o}=t;this.ctx.database.setValidationErrorByRowIndex(r,s,o)}),e&&Array.isArray(e)&&e.length){const[t]=e;if(t&&t.rowIndex>=0&&t.key){const{rowIndex:r,key:s}=t;this.scrollToRowIndex(r),this.scrollToColkey(s)}}}getValidations(){return new Promise(async(e,t)=>{const r=this.ctx.database.getAllRowsData(),s=this.ctx.header.leafCellHeaders;let o=[];for(let a=0;a<r.length;a++)for(let n=0;n<s.length;n++){const c=this.ctx.database.getRowKeyByItem(r[a]),d=s[n].key,u=await this.ctx.database.getValidator(c,d);Array.isArray(u)&&u.length&&o.push(u)}o.length?(t(o),this.ctx.emit("draw")):(e([]),this.ctx.emit("draw"))})}hasValidationError(){return this.ctx.database.hasValidationError()}scrollTo(e,t){this.scroller.setScroll(e,t)}scrollXTo(e){this.scroller.setScrollX(e)}scrollToColkey(e){this.scroller.scrollToColkey(e)}scrollToRowkey(e){this.scroller.scrollToRowKey(e)}scrollToColIndex(e){this.scroller.scrollToColIndex(e)}scrollToRowIndex(e){this.scroller.scrollToRowIndex(e)}scrollYTo(e){this.scroller.setScrollY(e)}setExpandRowKeys(e,t=!0){this.ctx.database.setExpandRowKeys(e,t)}getExpandRowKeys(){return this.ctx.database.getExpandRowKeys()}clearSelection(){this.ctx.database.clearSelection(),this.ctx.emit("draw")}toggleRowSelection(e){const t=this.ctx.database.getRowKeyByItem(e);this.ctx.database.toggleRowSelection(t),this.ctx.emit("draw")}setSelectionByRows(e,t=!0){e.forEach(r=>{const s=this.ctx.database.getRowKeyByItem(r);this.ctx.database.setRowSelection(s,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}setSelectionByRowKeys(e,t=!0){e.forEach(r=>{this.ctx.database.setRowSelection(r,t,!1)}),this.ctx.emit("selectionChange",this.getSelectionRows()),this.ctx.emit("draw")}toggleAllSelection(){this.ctx.database.toggleAllSelection(),this.ctx.emit("draw")}toggleRowExpand(e,t){this.ctx.database.expandItem(e,t),this.ctx.emit("draw")}toggleExpandAll(e){this.ctx.database.expandAll(e),this.ctx.emit("draw")}getSelectionRows(){return this.ctx.database.getSelectionRows()}getPositionForRowIndex(e){return this.ctx.database.getPositionForRowIndex(e)}getCellValue(e,t){return this.ctx.database.getItemValue(e,t)}getCellValueByIndex(e,t){return this.ctx.database.getItemValueForRowIndexAndColIndex(e,t)}clearSort(){this.ctx.database.clearSort()}contextMenuHide(){this.contextMenu.hide()}getUtils(){return{mergeColCell:EC,mergeRowCell:yC,getSpanArrByRow:An,getSpanObjByColumn:Nn}}getColumnByKey(e){var t;return(t=this.ctx.database.getColumnByKey(e))==null?void 0:t.column}destroy(){this.overlayer.destroy(),this.empty.destroy(),this.editor.destroy(),this.tooltip.destroy(),this.selector.destroy(),this.autofill.destroy(),this.contextMenu.destroy(),this.loading.destroy(),this.ctx.destroy(),this.ctx.containerElement.remove()}}const Ab=l.defineComponent((i,{emit:e})=>{const{cellRender:t,renderTableParams:r}=i,{row:s,field:o}=r;if(o){const a=l.ref(s[o]);return()=>{var n,c;return((c=(n=Dt.renders[t.name])==null?void 0:n.renderEdit)==null?void 0:c.call(n,a,t,r,e))??null}}else return()=>null},{name:"RenderEditCell",props:["cellRender","renderTableParams"],emits:["blur"]}),Mr=l.defineComponent({__name:"PCanvasTable",props:{columns:{},data:{},config:{default:()=>({})},footerData:{},loading:{type:Boolean}},emits:["change","selectionChange","ready"],setup(i,{expose:e,emit:t}){const r=t,s=l.ref([]),o=i,a=Rn(),n=l.computed(()=>({...o,config:{AUTO_ROW_HEIGHT:!0,DISABLED:!0,...a,...o.config}}));let c=null;const d=l.useAttrs(),u=l.ref(null),f=l.ref(null),g=l.ref(null),v=l.ref(null),p=l.ref(),m=l.ref("text"),x=l.ref(),C={},_={},y=l.computed(()=>{const w=p.value;return w?{width:`${w.width}px`,height:`${w.height}px`}:{}}),b=w=>ct[w]||(({cellValue:A})=>A),E=w=>{var A;return(A=Dt.renders[w])==null?void 0:A.renderDefault},S=(w,...A)=>({row:F,rowIndex:H,value:W})=>w({row:F,rowIndex:H,cellValue:W},...A),$=w=>{var A,F,H,W,P;if((A=w.slots)!=null&&A.default&&R.isFunction((F=w.slots)==null?void 0:F.default))return Y=>{var X,V;return(V=(X=w.slots)==null?void 0:X.default)==null?void 0:V.call(X,{row:Y.row,column:w,rowIndex:Y.rowIndex})};if((H=w.slots)!=null&&H.default&&R.isString((W=w.slots)==null?void 0:W.default))return`slot:${(P=w.slots)==null?void 0:P.default}`;if(w.cellRender&&w.cellRender.name)return Y=>{var X,V;return(V=E(w.cellRender.name))==null?void 0:V(w.cellRender,{data:o.data,row:Y.row,rowIndex:Y.rowIndex,field:w.field||Y.column.key,title:((X=Y.column)==null?void 0:X.title)??""},{})}},k=w=>{var A,F,H,W,P,Y,X;return(A=w.slots)!=null&&A.edit&&(w.field||w.key)&&R.isFunction((F=w.slots)==null?void 0:F.edit)?C[`__slot:${w.field||w.key}`]=w:(H=w.editRender)!=null&&H.name&&(w.field||w.key)&&(_[w.field||w.key]=w.editRender),{...R.omit(w,["formatter"]),key:w.key||w.field||Me(),formatter:R.isString(w.formatter)?S(b(w.formatter)):R.isArray(w.formatter)&&R.isString(w.formatter[0])?S(b(w.formatter[0]),...w.formatter.slice(1)):R.isFunction(w.formatter)?S(w.formatter):void 0,editorType:w.editorType??((W=w.slots)!=null&&W.edit&&(w.field||w.key)&&R.isFunction((P=w.slots)==null?void 0:P.edit)?`__slot:${w.field||w.key}`:(Y=w.editRender)!=null&&Y.name?w.editRender.name:void 0),render:$(w),children:(X=w.children)==null?void 0:X.map(V=>k(V))}};l.onMounted(()=>{u.value&&(c=new Mb(u.value,{config:n.value.config,columns:o.columns.map(w=>k(w)),data:o.data,footerData:o.footerData,emptyElement:g.value||void 0,overlayerElement:v.value||void 0,editorElement:f.value||void 0}),Object.keys(d).forEach(w=>{const A=d[w];if(typeof A=="function"&&w.startsWith("on")){const F=w.charAt(2).toLowerCase()+w.slice(3);c==null||c.on(F,A)}}),c.on("change",w=>{r("change",w)}),c.on("overlayerChange",w=>{x.value=w}),c.on("startEdit",w=>{p.value=w,m.value=w.editorType,m.value}),c.on("doneEdit",()=>{m.value="text"}),c.on("selectionChange",w=>{s.value=w,r("selectionChange",w)}),r("ready",c))});function T(w){if(!c||!p.value)return;const{rowKey:A,key:F}=p.value;c==null||c.setItemValueByEditor(A,F,w)}const I=()=>document.body;return l.watch(()=>o.data,w=>{c==null||c.loadData(w)},{deep:!0}),Cr(()=>o.columns,(w,A)=>{R.isEqual(w,A)||c==null||c.loadColumns(w.map(F=>k(F)))},{deep:!0}),l.watch(()=>n.value.config,w=>{c==null||c.loadConfig(w)},{deep:!0}),l.watch(()=>o.footerData,w=>{c==null||c.loadFooterData(w||[])},{deep:!0}),l.watch(()=>o.loading,(w,A)=>{w!==A&&(c==null||c.setLoading(w))},{immediate:!0}),e({$table:c,selectedRecords:l.computed(()=>s.value),reloadData:()=>{c==null||c.loadData(o.data)}}),(w,A)=>{const F=l.resolveComponent("a-empty"),H=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(H,{spinning:w.loading},{default:l.withCtx(()=>{var W,P,Y,X,V,Ee,fe;return[l.createElementVNode("div",{ref_key:"eVirtTableRef",ref:u},[l.createElementVNode("div",{ref_key:"eVirtTableEditorRef",ref:f},[m.value.startsWith("__slot:")?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(C[m.value].slots.edit({row:p.value.row,column:C[m.value],rowIndex:p.value.rowIndex})),{key:0,bordered:!1,style:l.normalizeStyle(y.value),class:"ev-editor-wrapper","get-popup-container":I,value:p.value.value,"onUpdate:value":A[0]||(A[0]=se=>p.value.value=se),cell:p.value,onBlur:T},null,40,["style","value","cell"])):(W=l.unref(Dt).renders[m.value])!=null&&W.renderEdit?(l.openBlock(),l.createBlock(l.unref(Ab),{key:1,"cell-render":_[p.value.key],class:"ev-editor-wrapper",style:l.normalizeStyle(y.value),"render-table-params":{data:o.data,row:(P=p.value)==null?void 0:P.row,rowIndex:((Y=p.value)==null?void 0:Y.rowIndex)??-1,field:((X=p.value)==null?void 0:X.key)??"",title:((Ee=(V=p.value)==null?void 0:V.column)==null?void 0:Ee.title)??""},bordered:!1,"get-popup-container":I,onBlur:T},null,8,["cell-render","style","render-table-params"])):l.createCommentVNode("",!0)],512),l.createElementVNode("div",{ref_key:"eVirtTableEmptyRef",ref:g},[l.renderSlot(w.$slots,"empty",{},()=>[l.createVNode(F,{description:"空数据"})])],512),l.createElementVNode("div",{ref_key:"eVirtTableOverlayerRef",ref:v},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(((fe=x.value)==null?void 0:fe.views)||[],se=>(l.openBlock(),l.createElementBlock("div",{class:l.normalizeClass(se.class),style:l.normalizeStyle(se.style),key:se.type},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(se.views,ke=>(l.openBlock(),l.createElementBlock("div",{style:l.normalizeStyle(ke.style),key:ke.key},[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(ke.cells,J=>(l.openBlock(),l.createElementBlock("div",l.mergeProps({class:"canvas-cell",key:`${J.rowKey}_${J.key}`,style:J.style},{ref_for:!0},J.domDataset),[typeof J.render=="function"?(l.openBlock(),l.createBlock(l.resolveDynamicComponent(J.render(J)),{key:0,bordered:!1})):typeof J.render=="string"&&J.render.startsWith("slot:")?l.renderSlot(w.$slots,J.render.replace("slot:",""),l.mergeProps({key:1,ref_for:!0},J,{cell:J})):l.createCommentVNode("",!0)],16))),128))],4))),128))],6))),128))],512)],512)]}),_:3},8,["spinning"])}}}),Nb={key:0},Bb={key:1,class:"p-canvas-toolbar-wrapper flex items-center w-full justify-between p-theme-bg pt-8px px-16px"},Hb={class:"flex items-center flex-1 gap-4px"},Fb={key:2},Kb={class:"flex items-center gap-4px"},Pb={class:l.normalizeClass("p-pane flex-1 h-0 p-inner-scroll")},Yb={key:0,class:"w-full text-slate-5 pl-4"},tl=l.defineComponent({__name:"PCanvasGrid",props:{staticConfig:{},manualFetch:{type:Boolean},formConfig:{},columns:{},toolbarConfig:{},pageConfig:{},proxyConfig:{},config:{},lazyReset:{type:Boolean},fitHeight:{}},emits:["toolbarButtonClick","toolbarToolClick","pick","resetQuery"],setup(i,{expose:e,emit:t}){var Qt,jt,ei,ti,ii;const r=i,s=l.useAttrs(),o=t,{formConfig:a,pageConfig:n,columns:c,toolbarConfig:d,proxyConfig:u,config:f,staticConfig:g}=l.toRefs(r),v=_n(),p=Rn(),m=l.ref(Me()),x=l.ref({}),C=l.computed(()=>({...r,config:{...p,...r.config},lazyReset:r.lazyReset??v.lazyReset??!1,fitCanvasHeight:r.fitHeight??v.fitCanvasHeight??100})),_=l.computed(()=>u.value&&u.value.ajax?n.value?"pagination":"list":"bad");l.computed(()=>_.value==="pagination"?{current:E.page,total:$.value,pageSize:E.size,responsive:!1,showSizeChanger:!0,showTotal:D=>`共${D}条数据`}:!1);const y=l.computed(()=>R.omit({labelCol:Er,...a.value},["items"])),b=l.reactive({toolbar:!1,form:!1,table:!1}),E=l.reactive({page:1,size:((Qt=n.value)==null?void 0:Qt.pageSize)??10}),S=l.ref(0),$=l.ref(0),k=l.ref([]),T=l.ref(),I=l.ref(),w=l.ref(),A=l.ref(),F=l.ref(500),H=l.ref({}),W=D=>{H.value[E.page]=D},P=l.reactive([...(((ei=(jt=r.toolbarConfig)==null?void 0:jt.buttons)==null?void 0:ei.map(D=>D.code))??[]).filter(D=>D),...(((ii=(ti=r.toolbarConfig)==null?void 0:ti.tools)==null?void 0:ii.map(D=>D.code))??[]).filter(D=>D)].reduce((D,N)=>(D[N]=!1,D),{})),Y=(D,N)=>{P[D]=N},X=D=>{R.isObject(D)?(Object.prototype.hasOwnProperty.call(D,"toolbar")&&(b.toolbar=D.toolbar),Object.prototype.hasOwnProperty.call(D,"form")&&(b.form=D.form),Object.prototype.hasOwnProperty.call(D,"table")&&(b.table=D.table)):R.isBoolean(D)&&(b.form=D,b.toolbar=D,b.table=D)},V=l.computed(()=>R.uniq(Object.values(H.value).flat(),D=>{var N;return D[((N=r.config)==null?void 0:N.ROW_KEY)??"id"]})),Ee=()=>{Ct()},fe=l.computed(()=>V.value.map(D=>{var N;return D[((N=r.config)==null?void 0:N.ROW_KEY)??"id"]})),se=(D,N)=>N?{list:R.isString(N.list)?R.get(D,N.list):R.isFunction(N.list)?N.list(D):void 0,total:R.isString(N.total)?R.get(D,N.total):R.isFunction(N.total)?N.total(D):void 0,result:R.isString(N.result)?R.get(D,N.result):R.isFunction(N.result)?N.result(D):void 0,message:R.isString(N.message)?R.get(D,N.message):R.isFunction(N.message)?N.message(D):void 0}:{list:D},ke=D=>{o("toolbarButtonClick",{data:k.value,code:D,selectedKeys:fe.value,records:V.value}),Jt(D)},J=R.debounce(ke,100),qt=({key:D})=>J(D),Mi=D=>{o("toolbarToolClick",{data:k.value,code:D,selectedKeys:fe.value,records:V.value}),Jt(D)},Ai=R.debounce(Mi,100),Et=()=>new Promise(D=>{if(_.value!=="bad"){X({table:!0,form:!0});const{ajax:N}=u.value;N.query({form:x.value,page:E}).then(G=>{const{list:De,total:Ze,result:le,message:ge}=se(G,u.value.response);De?(k.value=De,S.value++):le?(k.value=le,$.value=Ze??le.length,S.value++):(k.value=[],S.value++,ge&&pi(ge)),D(k.value)}).catch(G=>{console.error("fetchData error",G),D([])}).finally(()=>{X({table:!1,form:!1})})}}),Le=(D,N)=>(E.page=D,E.size=N,Et()),Ct=()=>(E.page=1,H.value={},Et()),Ke=R.debounce(Et,160),Ni=(D,N)=>(Object.assign(x.value,D),E.page=1,N?Promise.resolve():Ke()),Zt=(D,N)=>(x.value=D,E.page=1,N?Promise.resolve():Ke()),Jt=D=>{const{ajax:N}=u.value;switch(D){case"multiDelete":N.multiDelete&&(fe.value.length>0?kn({title:"警告",content:"确认删除选中的数据吗?"}).then(()=>{X({table:!0,toolbar:!0}),N.multiDelete(fe.value).then(()=>{oC("删除成功"),Ct()}).catch(()=>{aC("删除失败")}).finally(()=>{X({table:!1,toolbar:!1}),P.multiDelete=!1})}):pi("请选择要删除的数据"));break}},bt=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]),_t=D=>{if(a.value&&a.value.items.length>0){if(a.value.customReset)a.value.customReset();else{const N={};Lt(a.value.items,G=>{G.field&&G.itemRender?ce(G.itemRender.defaultValue)?N[G.field]=G.itemRender.defaultValue:N[G.field]=void 0:G.field&&G.slots&&(ce(G.slots.defaultValue)?N[G.field]=G.slots.defaultValue:N[G.field]=void 0)}),x.value=N}o("resetQuery")}E.page=1,D||Ke()},Rt=()=>(H.value={},_t()),Ce=()=>{var le,ge;const D=(le=w.value)==null?void 0:le.parentElement,N=D?window.getComputedStyle(D).height:"0px",G=A.value?window.getComputedStyle(A.value).height:"0px",De=G.includes("px")?R.toNumber(G.replace("px","")):0,Ze=(ge=g.value)!=null&&ge.showCount?22:0;F.value=R.toNumber(N.replace("px",""))-C.value.fitCanvasHeight-(r.toolbarConfig?30:0)-De-Ze};let St;return l.onMounted(()=>{Ce(),window.addEventListener("resize",Ce),St=new MutationObserver(D=>{D.forEach(N=>{if(N.type==="attributes"&&N.attributeName==="style"){const G=N.target;window.getComputedStyle(G).display!=="none"&&Ce()}})}),w.value&&St.observe(w.value,{attributes:!0,attributeFilter:["style"]}),_t(r.manualFetch)}),l.onBeforeUnmount(()=>{window.removeEventListener("resize",Ce),St.disconnect()}),e({commitProxy:{query:Ke,reload:Rt,reloadPage:Ct,passQuery:Ni,forcePassQuery:Zt},$canvasTable:l.computed(()=>I.value),selectedRowKeys:fe,setBtnLoading:Y,selectedRecords:V,$form:l.computed(()=>T.value),getFormData:()=>x.value,setLoadings:X,resizeTable:Ce}),(D,N)=>{var le,ge,It;const G=l.resolveComponent("a-menu-item"),De=l.resolveComponent("a-menu"),Ze=l.resolveComponent("a-dropdown");return l.openBlock(),l.createElementBlock("div",l.mergeProps({ref_key:"boxEl",ref:w,class:"h-full p-wrapper flex flex-col gap-8px overflow-y-auto"},l.unref(s)),[_.value==="bad"?(l.openBlock(),l.createElementBlock("div",Nb,"请检查配置")):(l.openBlock(),l.createElementBlock(l.Fragment,{key:1},[(ge=(le=l.unref(a))==null?void 0:le.items)!=null&&ge.some(K=>K.field&&K.itemRender)?(l.openBlock(),l.createElementBlock("div",{key:0,class:"p-pane p-form-wrapper",ref_key:"pFormWrapper",ref:A},[l.createVNode(l.unref(L.Spin),{spinning:b.form},{default:l.withCtx(()=>[(l.openBlock(),l.createBlock(l.unref(L.Form),l.mergeProps({key:m.value,ref_key:"formEl",ref:T,model:x.value},y.value,{onSubmit:Ee}),{default:l.withCtx(()=>[l.createVNode(l.unref(L.Row),{gutter:[6,12]},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(a).items,(K,Pe)=>(l.openBlock(),l.createBlock(_r,{key:`_col_${K.field||Pe}`,"form-data":x.value,item:K,onReset:N[0]||(N[0]=O=>_t(C.value.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",Bb,[l.createElementVNode("div",Hb,[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,(K,Pe)=>(l.openBlock(),l.createElementBlock(l.Fragment,{key:Pe},[K.dropdowns&&K.dropdowns.length?(l.openBlock(),l.createBlock(Ze,{key:0},{overlay:l.withCtx(()=>[l.createVNode(De,{onClick:qt},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(K.dropdowns,O=>(l.openBlock(),l.createBlock(G,{key:O.code},{default:l.withCtx(()=>[l.createTextVNode(l.toDisplayString(O.content),1)]),_:2},1024))),128))]),_:2},1024)]),default:l.withCtx(()=>[l.createVNode(l.unref(L.Button),{type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content)+" ",1),l.createVNode(l.unref(ut.DownOutlined))]),_:2},1032,["type","size","disabled","loading"])]),_:2},1024)):K.code?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:1,type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,loading:b.toolbar||!!K.code&&P[K.code],onClick:O=>l.unref(J)(K.code)},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","loading","onClick"])):(l.openBlock(),l.createElementBlock("div",Fb))],64))),128)):l.createCommentVNode("",!0)]),l.createElementVNode("span",Kb,[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,(K,Pe)=>(l.openBlock(),l.createBlock(l.unref(L.Button),{key:Pe,type:K.type,size:K.size??"middle",disabled:l.unref(d).disabled||K.disabled,onClick:O=>l.unref(Ai)(K.code),loading:b.toolbar||!!K.code&&P[K.code]},{default:l.withCtx(()=>[K.icon?(l.openBlock(),l.createBlock(l.unref(oe),{key:0,icon:K.icon},null,8,["icon"])):l.createCommentVNode("",!0),l.createTextVNode(" "+l.toDisplayString(K.content),1)]),_:2},1032,["type","size","disabled","onClick","loading"]))),128)):l.createCommentVNode("",!0)])])):l.createCommentVNode("",!0),l.createElementVNode("div",Pb,[(It=l.unref(g))!=null&&It.selectable&&l.unref(g).showCount?(l.openBlock(),l.createElementBlock("div",Yb," 已选:"+l.toDisplayString(fe.value.length),1)):l.createCommentVNode("",!0),l.createVNode(Mr,{ref_key:"canvasTableRef",ref:I,columns:bt.value,config:{...l.unref(f),HEIGHT:F.value},onSelectionChange:W,data:k.value,loading:b.table},null,8,["columns","config","data","loading"]),_.value==="pagination"?(l.openBlock(),l.createBlock(l.unref(L.Pagination),{key:1,class:"p-canvas-pagination",size:"small",current:E.page,"page-size":E.size,total:$.value,onChange:Le},null,8,["current","page-size","total"])):l.createCommentVNode("",!0)])],64))],16)}}}),Ar=l.defineComponent({__name:"PGroupBlock",props:{getFormSetting:{type:Function},source:{}},setup(i,{expose:e}){const t=i,r=l.ref(),{source:s}=l.toRefs(t),o=l.computed(()=>{var n;return(n=r.value)==null?void 0:n.$form}),a=l.computed(()=>t.getFormSetting(s.value));return e({$form:o}),(n,c)=>(l.openBlock(),l.createBlock(Rr,l.mergeProps({ref_key:"formEl",ref:r},a.value,{data:l.unref(s)}),null,16,["data"]))}}),Vb=l.defineComponent({__name:"CollapseCard",props:{defaultCollapsed:{type:Boolean,default:!1},title:{default:void 0},collapsible:{type:Boolean,default:!1}},setup(i,{expose:e}){const t=i,r=l.useSlots(),s=l.ref(t.defaultCollapsed?[]:["content"]);return e({collapse:()=>{s.value=[]},expand:()=>{s.value=["content"]}}),(o,a)=>{const n=l.resolveComponent("a-collapse-panel"),c=l.resolveComponent("a-collapse"),d=l.resolveComponent("a-card");return o.collapsible?(l.openBlock(),l.createBlock(c,{key:0,"active-key":s.value,"onUpdate:activeKey":a[0]||(a[0]=u=>s.value=u),class:"collapsible-card"},{default:l.withCtx(()=>[l.createVNode(n,{key:"content","force-render":"",header:o.title},l.createSlots({default:l.withCtx(()=>[l.renderSlot(o.$slots,"default")]),_:2},[r.title?{name:"header",fn:l.withCtx(()=>[l.renderSlot(o.$slots,"title")]),key:"0"}:void 0]),1032,["header"])]),_:3},8,["active-key"])):(l.openBlock(),l.createBlock(d,{key:1,size:"small",title:o.title},l.createSlots({default:l.withCtx(()=>[l.renderSlot(o.$slots,"default")]),_:2},[r.title?{name:"title",fn:l.withCtx(()=>[l.renderSlot(o.$slots,"title")]),key:"0"}:void 0]),1032,["title"]))}}}),il=l.defineComponent({__name:"PFormGroup",props:l.mergeModels({getFormSetting:{type:Function},title:{},tabLabel:{},editAble:{type:Boolean},showAdd:{type:Boolean},collapsible:{type:Boolean},defaultCollapsed:{type:Boolean},lazyErrorMark:{type:Boolean},forceRender:{type:Boolean},keepSerial:{type:Boolean},loading:{type:Boolean},itemMenus:{},createItem:{type:Function},max:{},menuHandler:{type:Function}},{modelValue:{type:Array,default:()=>[]},modelModifiers:{}}),emits:["update:modelValue"],setup(i,{expose:e}){const t=L.Form.useForm,r=l.ref(),s=i,o=l.ref(),a=l.useModel(i,"modelValue"),n=l.ref(0),c=l.ref([]),d=l.ref([]),u=E=>{n.value=E},f=l.computed(()=>s.max??1/0),g=E=>{(s.createItem??(()=>Promise.resolve({})))({list:a.value}).then($=>{var k;a.value=[...a.value,{...$,__index:(((k=R.max(a.value,T=>T.__index??-1))==null?void 0:k.__index)??-1)+1}],n.value=E})},v=s.itemMenus??[{content:"复制",code:"copy"},{content:"删除",code:"delete"}],p=E=>{var S,$,k,T,I,w;return((I=(T=(k=($=(S=E==null?void 0:E.parentElement)==null?void 0:S.parentElement)==null?void 0:$.parentElement)==null?void 0:k.parentElement)==null?void 0:T.parentElement)==null?void 0:I.parentElement)??((w=o.value)==null?void 0:w.$el)??document.body},m=l.computed(()=>s.forceRender||a.value.length<=5),x=E=>{var $;const S=($=a.value.find((k,T)=>T===E))==null?void 0:$.__index;q(S)&&(c.value=c.value.filter(k=>k!==S))},C=()=>{l.nextTick().then(()=>{var E,S;x(n.value),(S=(E=d.value[n.value])==null?void 0:E.$form)==null||S.validate()})};l.watch(()=>a.value,()=>{if(!s.keepSerial){const E=a.value.filter(S=>!q(S.__index));E.length>0&&E.forEach(S=>{var $;S.__index=((($=R.max(a.value,k=>k.__index??-1))==null?void 0:$.__index)??-1)+1})}},{immediate:!0});const _=({key:E},S,$)=>{var k;if(s.menuHandler&&R.isFunction(s.menuHandler))s.menuHandler({code:R.toString(E),data:S,index:$});else switch(E){case"delete":a.value=a.value.filter((T,I)=>I!==$),l.nextTick(()=>{d.value=d.value.filter(T=>!!T),$<=n.value&&n.value>0&&n.value--});break;case"copy":if(a.value.length>=f.value){pi("已达到最大数量");return}a.value=[...a.value,R.clone({...R.omit(S,["id","__index"]),__index:(((k=R.max(a.value,T=>T.__index??-1))==null?void 0:k.__index)??-1)+1})];break}},y=R.debounce(_,100);l.watchEffect(()=>{a.value.length===0?n.value=0:n.value>=a.value.length&&(n.value=a.value.length-1)});const b=R.debounce(x,50);return l.watchEffect(()=>{var $;const E=a.value.map((k,T)=>c.value.includes(k.__index)?T:void 0).filter(q),S=($=r.value)==null?void 0:$.$el;S&&S.querySelectorAll(":scope >.ant-tabs-nav>.ant-tabs-nav-wrap>.ant-tabs-nav-list>.ant-tabs-tab>.ant-tabs-tab-btn").forEach((T,I)=>{E.includes(I)?T.classList.add("p-error-group-tab"):T.classList.remove("p-error-group-tab")})}),e({collapse:()=>{var E,S;(S=(E=o.value)==null?void 0:E.collapse)==null||S.call(E)},expand:()=>{var E,S;(S=(E=o.value)==null?void 0:E.expand)==null||S.call(E)},activeKey:l.computed(()=>n.value),setActiveKey:u,validateAll:()=>{const E=m.value?d.value.map(S=>{var $;return($=S.$form)==null?void 0:$.validate()}):a.value.map(S=>{var $;return(($=t(S,s.getFormSetting(S).rules))==null?void 0:$.validate())??Promise.resolve()});return Promise.allSettled(E).then(S=>{if(c.value=S.map(($,k)=>{var T;return $.status==="rejected"&&typeof((T=a.value[k])==null?void 0:T.__index)=="number"?a.value[k].__index:void 0}).filter($=>typeof $=="number"),!s.lazyErrorMark&&c.value.length){const $=c.value[0],k=a.value.findIndex(T=>T.__index===$);k!==-1&&(n.value=k)}return c.value.length?Promise.reject({error_indexes:c.value,results:S}):Promise.resolve(S)})},validate:async(E,S)=>{var k,T,I;const $=a.value.findIndex(w=>w.__index===E);try{return await(m.value?((T=(k=d.value[$])==null?void 0:k.$form)==null?void 0:T.validate())??Promise.resolve():((I=t(a.value[$],s.getFormSetting(a.value[$]).rules))==null?void 0:I.validate())??Promise.resolve()),c.value=c.value.filter(w=>w!==E),Promise.resolve()}catch(w){return!c.value.includes(E)&&!S&&(c.value=[...c.value,E]),Promise.reject(w)}},validateFields:async(E,S,$)=>{var A,F;const k=a.value.findIndex(H=>H.__index===E),I=s.getFormSetting(a.value[k]).rules,w=t(a.value[k],I);try{return await(m.value?((F=(A=d.value[k])==null?void 0:A.$form)==null?void 0:F.validateFields(S))??Promise.resolve():Promise.allSettled(S.map(H=>w.validateField(H,a.value[k][H],I[H]??[])))),Promise.resolve()}catch(H){return!c.value.includes(E)&&!$&&(c.value=[...c.value,E]),Promise.reject(H)}}}),(E,S)=>{const $=l.resolveComponent("a-spin");return l.openBlock(),l.createBlock(Vb,{ref_key:"rootRef",ref:o,title:E.title,size:"small",collapsible:E.collapsible,"default-collapsed":E.defaultCollapsed},{default:l.withCtx(()=>[E.loading?(l.openBlock(),l.createBlock($,{key:0,class:"w-full"})):(l.openBlock(),l.createBlock(l.unref(L.Tabs),{key:1,ref_key:"tabsRef",ref:r,type:"editable-card",activeKey:n.value,"onUpdate:activeKey":S[1]||(S[1]=k=>n.value=k),"hide-add":"",onChange:C},{rightExtra:l.withCtx(()=>[l.renderSlot(E.$slots,"rightExtra",{},()=>[E.showAdd&&a.value.length<f.value?(l.openBlock(),l.createBlock(l.unref(L.Button),{key:0,type:"link",onClick:S[0]||(S[0]=k=>g(a.value.length))},{default:l.withCtx(()=>S[2]||(S[2]=[l.createTextVNode(" + 新增 ",-1)])),_:1,__:[2]})):l.createCommentVNode("",!0)])]),default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(a.value,(k,T)=>(l.openBlock(),l.createBlock(l.unref(L.TabPane),{key:T,tab:`${E.tabLabel} ${E.keepSerial?T+1:(k.__index??0)+1}`,"force-render":m.value},{closeIcon:l.withCtx(()=>{var I;return[E.editAble&&((I=l.unref(v))!=null&&I.length)?(l.openBlock(),l.createBlock(l.unref(L.Dropdown),{key:0,"get-popup-container":p},{overlay:l.withCtx(()=>[l.createVNode(l.unref(L.Menu),{onClick:w=>l.unref(y)(w,k,T)},{default:l.withCtx(()=>[(l.openBlock(!0),l.createElementBlock(l.Fragment,null,l.renderList(l.unref(v).filter(w=>{var A;return((A=w.visibleMethod)==null?void 0:A.call(w,{data:k,index:T}))??!0}),w=>(l.openBlock(),l.createBlock(l.unref(L.MenuItem),{key:w.code},{default:l.withCtx(()=>[l.createElementVNode("div",null,l.toDisplayString(w.content),1)]),_:2},1024))),128))]),_:2},1032,["onClick"])]),default:l.withCtx(()=>[l.createVNode(l.unref(ut.MoreOutlined))]),_:2},1024)):l.createCommentVNode("",!0)]}),default:l.withCtx(()=>[(l.openBlock(),l.createBlock(Ar,{ref_for:!0,ref_key:"blockInstance",ref:d,key:T,source:k,"get-form-setting":E.getFormSetting,onFocusCapture:I=>l.unref(b)(T),onClickCapture:I=>l.unref(b)(T)},null,8,["source","get-form-setting","onFocusCapture","onClickCapture"]))]),_:2},1032,["tab","force-render"]))),128))]),_:3},8,["activeKey"]))]),_:3},8,["title","collapsible","default-collapsed"])}}}),Wb={class:"w-full text-right p-2"},rl=l.defineComponent({__name:"PromisePicker",props:{gridSetting:{},title:{default:"数据选择"},width:{default:"70%"},multipleAllowEmpty:{type:Boolean,default:!1},bodyStyle:{default:()=>({})},beforePick:{type:Function,default:()=>Promise.resolve()}},setup(i,{expose:e}){const t=l.ref(),r=l.ref(!1),s=i,o=l.computed(()=>{var p;return(p=s.gridSetting.selectConfig)==null?void 0:p.multiple});let a,n,c;const d=l.reactive({modal:!1}),u=()=>{c&&c()},f=()=>{d.modal=!1,c&&c()},g=({row:p,field:m})=>{a&&!o.value&&s.beforePick(p).then(()=>{d.modal=!1,a({row:p,field:m})})},v=()=>{var m;const p=((m=t.value)==null?void 0:m.selectedRecords)??[];p.length===0&&!s.multipleAllowEmpty?pi("请选择数据"):s.beforePick(p).then(()=>{d.modal=!1,n(p)})};return l.onMounted(()=>{}),e({pick:()=>new Promise((p,m)=>{a=p,c=m,r.value=!1,d.modal=!0,l.nextTick(()=>{r.value=!0})}),pickMultiple:()=>new Promise((p,m)=>{n=p,c=m,r.value=!1,d.modal=!0,l.nextTick(()=>{r.value=!0})}),grid:t,hide:()=>{d.modal=!1}}),(p,m)=>(l.openBlock(),l.createBlock(l.unref(L.Modal),{open:d.modal,"onUpdate:open":m[0]||(m[0]=x=>d.modal=x),"destroy-on-close":"",title:p.title,width:p.width,footer:o.value?void 0:null,onCancel:u,"body-style":p.bodyStyle},l.createSlots({default:l.withCtx(()=>[l.createElementVNode("div",{style:l.normalizeStyle({minHeight:r.value?"unset":"642px"})},[l.createVNode(Sr,l.mergeProps(p.gridSetting,{ref_key:"gridEl",ref:t,onPick:g}),null,16)],4)]),_:2},[o.value?{name:"footer",fn:l.withCtx(()=>[l.createElementVNode("div",Wb,[l.createElementVNode("span",null,[l.createVNode(l.unref(L.Button),{class:"mr-4",onClick:f},{default:l.withCtx(()=>m[1]||(m[1]=[l.createTextVNode(" 取消 ",-1)])),_:1,__:[1]}),l.createVNode(l.unref(L.Button),{type:"primary",onClick:v},{default:l.withCtx(()=>m[2]||(m[2]=[l.createTextVNode(" 确定 ",-1)])),_:1,__:[2]})])])]),key:"0"}:void 0]),1032,["open","title","width","footer","body-style"]))}});function sl(i){i&&bn(i)}const Xb={install(i){i.component("PForm",Rr),i.component("PGrid",Sr),i.component("PCanvasTable",Mr),i.component("PCanvasGrid",tl),i.component("PFormGroup",il),i.component("PGroupBlock",Ar),i.component("PromisePicker",rl)},addFormatter:In,addRender:br,setup:sl};exports.PCanvasGrid=tl;exports.PCanvasTable=Mr;exports.PForm=Rr;exports.PFormGroup=il;exports.PGrid=Sr;exports.PGroupBlock=Ar;exports.PromisePicker=rl;exports.addFormatter=In;exports.addRender=br;exports.cleanCol=$i;exports.default=Xb;exports.defaultItemResponsive=yr;exports.defaultLabelCol=Er;exports.get24rest=Sn;exports.getButtonResponsive=GE;exports.getUIKitConfig=VE;exports.labelColDict=zE;exports.resetUIKitConfig=XE;exports.setUIKitConfig=bn;exports.setup=sl;exports.watchPreviousDeep=Cr;
|