ag-grid-enterprise
Version:
Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue
253 lines • 1.51 MB
JavaScript
var ky=FT,_y=ST,Gy=OT,Oy=MT,Ny=YM,By=oI,Vy=dI,Hy=cI,Uy=CI,zy=gI,Wy=bd,$y=pI,Ky=jI,jy=VI,Yy=_I,qy=ZI,Xy=JI,Zy=cE,Jy=pE,_u=xE,Qy=jE,ew=PL,tw=vL,sw=mL,iw=hL,rw=$L,nw=QL,ow=Gk,aw=_k,lw=Zk,cw=Ck,uw=l1,dw=nk,hw=C1,pw=P1,gw=L1,fw=f1,mw=ZL,vw=oL,Cw=eL,Sw=Q1,bw=BG,yw=kG,ww=QG,xw=JG,Fw=PG,Tw=yG,Aw=yO,Pw=JO,Rw=oN,Mw=WO,Iw=AN,Ew=MO,Dw=fO,Lw=hO,kw=nB,_w=yB,Gw=hB,Ow=LB,Nw=KN,Bw=NB,Vw=OB,Hw=QB,Uw=nV,zw=lV,Ww=fV,Gu=yV,$w=wV,Kw=LV,jw=KV,Yw=qV,qw=e2,Xw=b2,Zw=u2,Jw=V2,Qw=U2,ex=k2,tx=Y2,sx=Q2,ix=m3,rx=u3,nx=k3,ox=V3,ax=J3,lx=cH,cx=CH,ux=wH,dx=AH,hx=RH,px=DH,gx=zH,fx=UH,mx=vU,vx=bU,Cx=wU,Sx=EU,bx=VU,yx=zU,wx=tz,xx=az,Fx=fz,Tx=Sz,Ax=Rz,Px=Oz,Rx=Jz,Mx=oW,Ix=cW,Ex=fW,Dx=FW,Lx=RW,kx=kW,_x=zW,Gx=VW,Ox=JW,Nx=t7,Bx=l7,Vx=i7,Hx=v7,Ux=D7,zx=G7,Wx=H7,$x=K7,Kx=Y7,jx=Q7,Yx=i$,qx=g$,Xx=D$,Zx=U$,Jx=q$,Qx=uK,e0=xK,t0=EK,s0=vK,i0=aK,r0=UK,n0=$K,o0=c8,a0=w8,l0=T8,c0=C8,u0=o8,d0=t8,h0=W8,p0=B8,g0=rj,f0=xj,m0=m9,v0=C9,C0=b9,S0=Kj,b0=k9,y0=J9,w0=uY,x0=vY,F0=wY,T0=RY,A0=LY,P0=OY,R0=VY,M0=UY,I0=KY,E0=ZY,D0=Cq,L0=Sq,k0=Fq,_0=Aq,G0=yq,O0=Mq,N0=Eq,B0=Hq,V0=Oq,H0=Gq,U0=qq,z0=Zq,W0=dX,$0=wX,K0=rX,j0=sX,Y0=BX,q0=UX,X0=$X,Z0=cJ,J0=TJ,Q0=FJ,eF=hJ,tF=$J,sF=WJ,iF=VJ,rF=iQ,nF=mQ,oF=$Q,aF=ZQ,lF=Iee,cF=Mee,uF=See,dF=ite,hF=cte,pF=tse,gF=ose,fF=cse,mF=qte,vF=dte,CF=yse,SF=xse,bF=Ase,yF=Mse,wF=Lse,xF=Sse,FF=vse,TF=Cse,AF=Use,PF=zse,RF=Yse,MF=Qse,IF=sie,EF=vie,DF=$ie,LF=cre,kF=rre,_F=Sre,GF=Cre,OF=Are,NF=ere,BF=Vre,VF=jre,HF=Xre,UF=Jre,zF=Gre,WF=ine,$F=ane,KF=une,jF=one,YF=pne,qF=vne,XF=Tne,ZF=Pne,JF=Mne,QF=Ene,eT=kne,tT=Bne,sT=Hne,iT=zne,rT=jne,nT=Xne,oT=wne,aT=soe,lT=eoe,cT=Dre,uT=foe,dT=poe,hT=uoe,pT=Xie,gT=Uie,fT=Xae,mT=pie,vT=aie;import{_getDocument as CT}from"ag-stack";import{BeanStub as ST}from"ag-grid-community";import{_exists as bT}from"ag-stack";import{_logPreInitWarn as yT}from"ag-grid-community";var wT=class{constructor(){this.ieCompatibility=!1}init(){this.ieCompatibility=this.md5("hello")!="5d41402abc4b2a76b9719d911017c592"}md5cycle(e,t){let s=e[0],i=e[1],r=e[2],n=e[3];s=this.ff(s,i,r,n,t[0],7,-680876936),n=this.ff(n,s,i,r,t[1],12,-389564586),r=this.ff(r,n,s,i,t[2],17,606105819),i=this.ff(i,r,n,s,t[3],22,-1044525330),s=this.ff(s,i,r,n,t[4],7,-176418897),n=this.ff(n,s,i,r,t[5],12,1200080426),r=this.ff(r,n,s,i,t[6],17,-1473231341),i=this.ff(i,r,n,s,t[7],22,-45705983),s=this.ff(s,i,r,n,t[8],7,1770035416),n=this.ff(n,s,i,r,t[9],12,-1958414417),r=this.ff(r,n,s,i,t[10],17,-42063),i=this.ff(i,r,n,s,t[11],22,-1990404162),s=this.ff(s,i,r,n,t[12],7,1804603682),n=this.ff(n,s,i,r,t[13],12,-40341101),r=this.ff(r,n,s,i,t[14],17,-1502002290),i=this.ff(i,r,n,s,t[15],22,1236535329),s=this.gg(s,i,r,n,t[1],5,-165796510),n=this.gg(n,s,i,r,t[6],9,-1069501632),r=this.gg(r,n,s,i,t[11],14,643717713),i=this.gg(i,r,n,s,t[0],20,-373897302),s=this.gg(s,i,r,n,t[5],5,-701558691),n=this.gg(n,s,i,r,t[10],9,38016083),r=this.gg(r,n,s,i,t[15],14,-660478335),i=this.gg(i,r,n,s,t[4],20,-405537848),s=this.gg(s,i,r,n,t[9],5,568446438),n=this.gg(n,s,i,r,t[14],9,-1019803690),r=this.gg(r,n,s,i,t[3],14,-187363961),i=this.gg(i,r,n,s,t[8],20,1163531501),s=this.gg(s,i,r,n,t[13],5,-1444681467),n=this.gg(n,s,i,r,t[2],9,-51403784),r=this.gg(r,n,s,i,t[7],14,1735328473),i=this.gg(i,r,n,s,t[12],20,-1926607734),s=this.hh(s,i,r,n,t[5],4,-378558),n=this.hh(n,s,i,r,t[8],11,-2022574463),r=this.hh(r,n,s,i,t[11],16,1839030562),i=this.hh(i,r,n,s,t[14],23,-35309556),s=this.hh(s,i,r,n,t[1],4,-1530992060),n=this.hh(n,s,i,r,t[4],11,1272893353),r=this.hh(r,n,s,i,t[7],16,-155497632),i=this.hh(i,r,n,s,t[10],23,-1094730640),s=this.hh(s,i,r,n,t[13],4,681279174),n=this.hh(n,s,i,r,t[0],11,-358537222),r=this.hh(r,n,s,i,t[3],16,-722521979),i=this.hh(i,r,n,s,t[6],23,76029189),s=this.hh(s,i,r,n,t[9],4,-640364487),n=this.hh(n,s,i,r,t[12],11,-421815835),r=this.hh(r,n,s,i,t[15],16,530742520),i=this.hh(i,r,n,s,t[2],23,-995338651),s=this.ii(s,i,r,n,t[0],6,-198630844),n=this.ii(n,s,i,r,t[7],10,1126891415),r=this.ii(r,n,s,i,t[14],15,-1416354905),i=this.ii(i,r,n,s,t[5],21,-57434055),s=this.ii(s,i,r,n,t[12],6,1700485571),n=this.ii(n,s,i,r,t[3],10,-1894986606),r=this.ii(r,n,s,i,t[10],15,-1051523),i=this.ii(i,r,n,s,t[1],21,-2054922799),s=this.ii(s,i,r,n,t[8],6,1873313359),n=this.ii(n,s,i,r,t[15],10,-30611744),r=this.ii(r,n,s,i,t[6],15,-1560198380),i=this.ii(i,r,n,s,t[13],21,1309151649),s=this.ii(s,i,r,n,t[4],6,-145523070),n=this.ii(n,s,i,r,t[11],10,-1120210379),r=this.ii(r,n,s,i,t[2],15,718787259),i=this.ii(i,r,n,s,t[9],21,-343485551),e[0]=this.add32(s,e[0]),e[1]=this.add32(i,e[1]),e[2]=this.add32(r,e[2]),e[3]=this.add32(n,e[3])}cmn(e,t,s,i,r,n){return t=this.add32(this.add32(t,e),this.add32(i,n)),this.add32(t<<r|t>>>32-r,s)}ff(e,t,s,i,r,n,o){return this.cmn(t&s|~t&i,e,t,r,n,o)}gg(e,t,s,i,r,n,o){return this.cmn(t&i|s&~i,e,t,r,n,o)}hh(e,t,s,i,r,n,o){return this.cmn(t^s^i,e,t,r,n,o)}ii(e,t,s,i,r,n,o){return this.cmn(s^(t|~i),e,t,r,n,o)}md51(e){const t=e.length,s=[1732584193,-271733879,-1732584194,271733878];let i;for(i=64;i<=e.length;i+=64)this.md5cycle(s,this.md5blk(e.substring(i-64,i)));e=e.substring(i-64);const r=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(i=0;i<e.length;i++)r[i>>2]|=e.charCodeAt(i)<<(i%4<<3);if(r[i>>2]|=128<<(i%4<<3),i>55)for(this.md5cycle(s,r),i=0;i<16;i++)r[i]=0;return r[14]=t*8,this.md5cycle(s,r),s}md5blk(e){const t=[];for(let s=0;s<64;s+=4)t[s>>2]=e.charCodeAt(s)+(e.charCodeAt(s+1)<<8)+(e.charCodeAt(s+2)<<16)+(e.charCodeAt(s+3)<<24);return t}rhex(e){const t="0123456789abcdef".split("");let s="",i=0;for(;i<4;i++)s+=t[e>>i*8+4&15]+t[e>>i*8&15];return s}hex(e){for(let t=0;t<e.length;t++)e[t]=this.rhex(e[t]);return e.join("")}md5(e){return this.hex(this.md51(e))}add32(e,t){return this.ieCompatibility?this.add32Compat(e,t):this.add32Std(e,t)}add32Std(e,t){return e+t&4294967295}add32Compat(e,t){const s=(e&65535)+(t&65535);return(e>>16)+(t>>16)+(s>>16)<<16|s&65535}},wr={"01":"GRID","02":"CHARTS","0102":"BOTH"},Ou="https://www.ag-grid.com/licensing/",Nu=class ke{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new wT,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(ke.licenseKey),s=`AG Grid ${t.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,i=t.suppliedLicenseType===void 0?"":`AG ${t.suppliedLicenseType==="BOTH"?"Grid and AG Charts":t.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(t.missing)(!this.isWebsiteUrl()||this.isForceWatermark())&&this.outputMissingLicenseKey(s);else if(t.expired){const r=ke.getGridReleaseDate(),n=ke.formatDate(r);this.outputExpiredKey(t.expiry,n,s,i)}else t.valid?t.isTrial&&t.trialExpired&&this.outputExpiredTrialKey(t.expiry,s,i):this.outputInvalidLicenseKey(!!t.incorrectLicenseType,s,i)}static extractExpiry(t){const s=t.substring(t.lastIndexOf("_")+1,t.length);return new Date(parseInt(ke.decode(s),10))}static extractLicenseComponents(t){let s=t.replace(/[\u200B-\u200D\uFEFF]/g,"");if(s=s.replace(/\r?\n|\r/g,""),t.length<=32)return{md5:null,license:t,version:null,isTrial:null};const i=s.length-32,r=s.substring(i),n=s.substring(0,i),[o,a,l]=ke.extractBracketedInformation(s);return{md5:r,license:n,version:o,isTrial:a,type:l}}getLicenseDetails(t){const s=ke.chartsLicenseManager?"BOTH":"GRID";if(!t?.length)return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const i=ke.getGridReleaseDate(),{md5:r,license:n,version:o,isTrial:a,type:l}=ke.extractLicenseComponents(t);let c=r===this.md5.md5(n)&&!t.includes("For_Trialing_ag-Grid_Only"),u,d,h=null,p=!1,g;function f(){u=h<new Date,d=void 0}if(c&&(h=ke.extractExpiry(n),c=!isNaN(h.getTime()),c))switch(d=i>h,o){case"legacy":case"2":{a&&f();break}case"3":l?.length?(g=l,l!==wr["01"]&&l!==wr["0102"]||s==="BOTH"&&g!=="BOTH"?(c=!1,p=!0):a&&f()):c=!1}return c?{licenseKey:t,valid:c,expiry:ke.formatDate(h),expired:d,version:o,isTrial:a,trialExpired:u,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}:{licenseKey:t,valid:c,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){const s=(this.document.defaultView||window).location,{hostname:i=""}=s;return i}isForceWatermark(){const s=(this.document.defaultView||window).location,{pathname:i}=s;return i?i.includes("forceWatermark"):!1}isWebsiteUrl(){return this.getHostname().match(/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/)!==null}isLocalhost(){return this.getHostname().match(/^(?:127\.0\.0\.1|localhost)$/)!==null}static formatDate(t){const s=["January","February","March","April","May","June","July","August","September","October","November","December"],i=t.getDate(),r=t.getMonth(),n=t.getFullYear();return i+" "+s[r]+" "+n}static getGridReleaseDate(){return new Date(parseInt(ke.decode(ke.RELEASE_INFORMATION),10))}static decode(t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i="",r,n,o,a,l,c,u,d=0;const h=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;d<h.length;)a=s.indexOf(h.charAt(d++)),l=s.indexOf(h.charAt(d++)),c=s.indexOf(h.charAt(d++)),u=s.indexOf(h.charAt(d++)),r=a<<2|l>>4,n=(l&15)<<4|c>>2,o=(c&3)<<6|u,i=i+String.fromCharCode(r),c!=64&&(i=i+String.fromCharCode(n)),u!=64&&(i=i+String.fromCharCode(o));return i=ke.utf8_decode(i),i}static utf8_decode(t){t=t.replace(/rn/g,"n");let s="";for(let i=0;i<t.length;i++){const r=t.charCodeAt(i);r<128?s+=String.fromCharCode(r):r>127&&r<2048?(s+=String.fromCharCode(r>>6|192),s+=String.fromCharCode(r&63|128)):(s+=String.fromCharCode(r>>12|224),s+=String.fromCharCode(r>>6&63|128),s+=String.fromCharCode(r&63|128))}return s}static setChartsLicenseManager(t){this.chartsLicenseManager=t,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(t){bT(this.licenseKey)&&this.licenseKey!==t&&yT(291,void 0,"AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used."),this.licenseKey=t,this.chartsLicenseManager?.setLicenseKey(t,!0)}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const s=t.match(/\[(.*?)\]/g).map(a=>a.replace("[","").replace("]",""));if(!s||s.length===0)return["legacy",!1,void 0];const i=s.filter(a=>a==="TRIAL").length===1,r=s.filter(a=>a.indexOf("v")===0)[0],n=r?r.replace("v",""):"legacy",o=wr[s.filter(a=>wr[a])[0]];return[n,i,o]}centerPadAndOutput(t){const s=this.totalMessageLength-t.length;console.error(t.padStart(s/2+t.length,"*").padEnd(this.totalMessageLength,"*"))}padAndOutput(t,s="*",i=""){console.error(t.padEnd(this.totalMessageLength-i.length,s)+i)}outputInvalidLicenseKey(t,s,i){t?(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Incompatible License Key "),this.padAndOutput(`* Your license key is for ${i} only and does not cover you for ${s}.`," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${Ou}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")):(this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Invalid License Key "),this.padAndOutput("* Your license key is not valid."," ","*"),this.padAndOutput(`* To troubleshoot your license key visit ${Ou}.`," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput("")),this.watermarkMessage="Invalid License"}outputExpiredTrialKey(t,s,i){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${s} License `),this.centerPadAndOutput(" Trial Period Expired. "),this.padAndOutput(`* Your trial only license for ${i} expired on ${t}.`," ","*"),this.padAndOutput("* Please email info@ag-grid.com to purchase a license."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="Trial Period Expired"}outputMissingLicenseKey(t){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${t} License `),this.centerPadAndOutput(" License Key Not Found "),this.padAndOutput(`* All ${t} features are unlocked for trial.`," ","*"),this.padAndOutput("* If you want to hide the watermark please email info@ag-grid.com for a trial license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="For Trial Use Only"}outputExpiredKey(t,s,i,r){this.centerPadAndOutput(""),this.centerPadAndOutput(` ${i} License `),this.centerPadAndOutput(" Incompatible Software Version "),this.padAndOutput(`* Your license key works with versions${r==""?"":` of ${r}`} released before ${t}.`," ","*"),this.padAndOutput(`* The version you are trying to use was released on ${s}.`," ","*"),this.padAndOutput("* Please contact info@ag-grid.com to renew your license key."," ","*"),this.centerPadAndOutput(""),this.centerPadAndOutput(""),this.watermarkMessage="License Expired"}};Nu.RELEASE_INFORMATION="MTc4OTU0NDk3Mzc5MA==";var ei=Nu;import{RefPlaceholder as xT}from"ag-stack";import{Component as FT}from"ag-grid-community";var TT='.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}',AT={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},PT=class extends ky{constructor(){super(AT),this.eLicenseTextRef=xT,this.registerCSS(TT)}wireBeans(e){this.licenseManager=e.licenseManager}postConstruct(){const e=this.shouldDisplayWatermark();this.setDisplayed(e),e&&(this.eLicenseTextRef.textContent=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCss("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5e3))}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},RT={selector:"AG-WATERMARK",component:PT},ko=class extends _y{constructor(){super(...arguments),this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){const e=this.beans;if(e.studio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{const t=new ei(CT(e));this.licenseManager=t,t.validateLicense()}}static getLicenseDetails(e){return new ei(null).getLicenseDetails(e)}getWatermarkSelector(){return RT}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(e){ei.setLicenseKey(e)}static setChartsLicenseManager(e){ei.setChartsLicenseManager(e)}};import{_downloadFile as _o}from"ag-stack";import{BaseCreator as MT,_addGridCommonParams as IT,_clamp as ET,_getHeaderClassesFromColDef as DT,_warnForGrid as LT,_warnWithoutAttribution as kT}from"ag-grid-community";import{_isExpressionString as _T,_last as GT}from"ag-stack";import{BaseGridSerializingSession as OT,_addGridCommonParams as xr,_isHiddenSingleChildGroup as NT,_mergeDeep as BT}from"ag-grid-community";import{_escapeString as VT}from"ag-stack";var HT=9525,Bu={0:1,"0.00":2,"#,##0":3,"#,##0.00":4,"0%":9,"0.00%":10,"0.00E+00":11,"# ?/?":12,"# ??/??":13,"mm-dd-yy":14,"d-mmm-yy":15,"d-mmm":16,"mmm-yy":17,"h:mm AM/PM":18,"h:mm:ss AM/PM":19,"h:mm":20,"h:mm:ss":21,"m/d/yy h:mm":22,"#,##0 ;(#,##0)":37,"#,##0 ;[Red](#,##0)":38,"#,##0.00;(#,##0.00)":39,"#,##0.00;[Red](#,##0.00)":40,"mm:ss":45,"[h]:mm:ss":46,"mmss.0":47,"##0.0E+0":48,"@":49},Fr=`\r
`;function Vu(e,t,s){if(!t&&t!==""&&t!==0)return"";let i=t;return typeof t=="boolean"&&s&&(i=s(t)),` ${e}="${i}"`}function UT(e={}){const i=["version"];return e.version||(e.version="1.0"),e.encoding&&i.push("encoding"),e.standalone&&i.push("standalone"),`<?xml ${i.map(n=>`${n}="${e[n]}"`).join(" ")} ?>`}function Hu(e,t){let s="";if(e.properties&&(e.properties.prefixedAttributes&&e.properties.prefixedAttributes.forEach(r=>{for(const n of Object.keys(r.map))s+=Vu(r.prefix+n,r.map[n],t)}),e.properties.rawMap))for(const r of Object.keys(e.properties.rawMap))s+=Vu(r,e.properties.rawMap[r],t);let i="<"+e.name+s;if(!e.children&&e.textNode==null)return i+"/>"+Fr;if(e.textNode!=null)return i+">"+e.textNode+"</"+e.name+">"+Fr;if(i+=">"+Fr,e.children)for(const r of e.children)i+=Hu(r,t);return i+"</"+e.name+">"+Fr}var zT=e=>Math.round(e*96/72),vs=e=>Math.ceil(e*HT),WT=e=>{if(e===void 0)return;const s=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(e||"Automatic");return Math.max(s,0)},Tr=(e,t)=>{if(!t)return;let s;return typeof t=="number"?s=t:s=t({rowIndex:e}),s},$T=(e,t)=>{const{colSpan:s,column:i}=e.position;if(e.width)if(s){const r=t.slice(i-1,i+s-1);let n=0;for(let o=0;o<r.length;o++){const a=r[o].getActualWidth();if(e.width<n+a){e.position.colSpan=o+1,e.totalWidth=e.width,e.width=e.totalWidth-n;break}n+=a}}else e.totalWidth=e.width},KT=(e,t)=>{const{rowSpan:s,row:i}=e.position;if(e.height)if(s){let r=0,n=0;for(let o=i;o<i+s;o++){const a=zT(Tr(o,t)||20);if(e.height<r+a){e.position.rowSpan=n+1,e.totalHeight=e.height,e.height=e.totalHeight-r;break}r+=a,n++}}else e.totalHeight=e.height},ge=(e,t)=>{const s=UT({encoding:"UTF-8",standalone:"yes"}),i=Hu(e);return t?i:`${s}${i}`},Jt=e=>{const i=String.fromCharCode,r=Math.floor(e/26),n=e%26;return!r||e===26?i(65+e-1):n?r<26?i(65+r-1)+i(65+n-1):Jt(r)+i(65+n-1):Jt(r-1)+"Z"},jT=e=>e.replaceAll(`
`,"_x000a_"),ti=e=>{if(e==null)return null;let t="";for(let s=0;s<e.length;s++){const i=e.charCodeAt(s);if(i>=0&&i<=31&&i!==10){const o=`_x${i.toString(16).toUpperCase().padStart(4,"0")}_`;t+=o}else t+=e[s]}return t},YT=e=>{const t=[];for(const s of e.keys()){const i=s.toString(),r={name:"t",textNode:VT(ti(i))};i.trim().length!==i.length&&(r.properties={rawMap:{"xml:space":"preserve"}}),t.push({name:"si",children:[r]})}return t},Go="_agSpanningHeader",qT=class extends Gy{constructor(e){super(e),this.useGridHeaderLayout=!0,this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.verticallySpannedHeaderStyles=new Map,this.frozenRowCount=0,this.emittedHeaderRowCount=0,this.spanningHeaderStyleRegistered=!1,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=e.formulaSvc,this.notesSvc=e.notesSvc,this.config=Object.assign({},e),this.workbook=e.workbook,this.stylesByIds={};for(const i of this.config.baseExcelStyles)this.stylesByIds[i.id]=i;const t={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[t.id]=t;const s={id:Go,alignment:{vertical:"Center"}};this.stylesByIds[s.id]=s,this.excelStyles=[...this.config.baseExcelStyles,t]}addCustomContent(e){for(const t of e){const s=this.rows.length+1;let i;!this.config.suppressRowOutline&&t.outlineLevel!=null&&(i=t.outlineLevel);const r={height:Tr(s,t.height||this.config.rowHeight),cells:(t.cells||[]).map((n,o)=>{const a=this.addImage(s,this.columnsToExport[o],n.data?.value);let l=null;n.styleId&&(l=typeof n.styleId=="string"?[n.styleId]:n.styleId);const c=this.getStyleId(l);if(a)return this.createCell(c,this.getDataTypeForValue(a.value),a.value==null?"":a.value,void 0,n.note);const u=n.data?.value??"",d=this.getDataTypeForValue(u);return n.mergeAcross?this.createMergedCell(c,d,u,n.mergeAcross,n.note):this.createCell(c,d,u,void 0,n.note)}),outlineLevel:i};t.collapsed!=null&&(r.collapsed=t.collapsed),t.hidden!=null&&(r.hidden=t.hidden),this.rows.push(r)}}isSpanColumnHeader(){const{exportAsExcelTable:e,pivotModeActive:t}=this.config;return!e||!!t}onNewHeaderGroupingRow(){return this.createHeaderRow()}onNewHeaderRow(){return this.createHeaderRow()}createHeaderRow(){const e=[],{freezeRows:t,headerRowHeight:s}=this.config;return this.emittedHeaderRowCount+=1,this.rows.push({cells:e,height:Tr(this.rows.length+1,s)}),t&&this.frozenRowCount++,{onCell:i=>{const{columnSpan:r,rowSpan:n}=i;if(i.type==="covered"){const c=this.verticallySpannedHeaderStyles.get(i.columnIndex);e.push({styleId:c?.styleId,data:{type:"empty",value:null}}),c&&(c.remainingRows-=1,c.remainingRows||this.verticallySpannedHeaderStyles.delete(i.columnIndex));return}if(i.type==="column"){const c=i.column,u=this.extractHeaderValue(c),d=this.config.styleLinker({rowType:"HEADER",rowIndex:this.rows.length,value:u,column:c});n>1&&this.registerSpanningHeaderStyle();const h=n>1?[Go,...d]:d,p=this.getStyleId(h)??void 0;e.push({...this.createCell(p,this.getDataTypeForValue("string"),u),mergeDown:n>1?n-1:void 0}),n>1&&this.verticallySpannedHeaderStyles.set(i.columnIndex,{styleId:p,remainingRows:n-1});return}const o=i.column,a=o?this.extractGroupHeaderValue(o):"",l=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${a}`,columnGroup:o});e.push({...this.createMergedCell(this.getStyleId(l),this.getDataTypeForValue("string"),a,r-1),collapsibleRanges:i.collapsibleGroupRanges})}}}onNewBodyRow(e){const{freezeRows:t,rowHeight:s}=this.config;this.skipFrozenRows||(t==="headersAndPinnedRows"&&e?.rowPinned==="top"?this.frozenRowCount++:typeof t=="function"?t(xr(this.gos,{node:e}))?this.frozenRowCount++:this.skipFrozenRows=!0:this.skipFrozenRows=!0);const i=this.onNewRow(this.onNewBodyColumn,s);return e&&this.addRowOutlineIfNecessary(e),i}prepare(e){super.prepare(e),this.emittedHeaderRowCount=0,this.columnsToExport=[...e],this.cols=e.map((t,s)=>this.convertColumnToExcel(t,s))}registerSpanningHeaderStyle(){this.spanningHeaderStyleRegistered||(this.excelStyles.push(this.stylesByIds[Go]),this.spanningHeaderStyleRegistered=!0)}parse(){this.config.headerRowCount=this.emittedHeaderRowCount;const e=this.rows.reduce((s,i)=>Math.max(s,i.cells.length),0);for(;this.cols.length<e;)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));const t=this.createWorksheet();return this.addWorksheetToWorkbook(t)}createWorksheet(){const{sheetName:e}=this.config;let t;if(e!=null){const s=typeof e=="function"?e(xr(this.gos,{})):e;t=String(s).substring(0,31)}else t="ag-grid";return{name:t,table:{columns:this.cols,rows:this.rows}}}addRowOutlineIfNecessary(e){const{gos:t,suppressRowOutline:s,rowGroupExpandState:i="expanded"}=this.config;if(t.get("groupHideOpenParents")||s||e.level==null)return;const n=e.footer&&e.level!==-1?1:0,o=GT(this.rows);if(o.outlineLevel=Math.min(this.getExportedLevel(e)+n,7),i==="expanded")return;const a=i==="collapsed";if(e.isExpandable()){const l=!a&&e.expanded;o.collapsed=!l}o.hidden=!!e.parent&&e.parent.level!==-1&&(a||this.isAnyParentCollapsed(e.parent))}getExportedLevel(e){const t=this.gos;let s=0,i=e.parent;for(;i&&i.level!==-1;)NT(t,i)||s++,i=i.parent;return s}isAnyParentCollapsed(e){for(;e&&e.level!==-1;){if(!e.expanded)return!0;e=e.parent}return!1}convertColumnToExcel(e,t){const s=this.config.columnWidth,r=(e?this.extractHeaderValue(e):void 0)??"",n=e?e.isFilterAllowed():!1;return s?typeof s=="number"?{width:s,displayName:r,filterAllowed:n}:{width:s({column:e,index:t}),displayName:r,filterAllowed:n}:e?{width:Math.max(e.getActualWidth(),75),displayName:r,filterAllowed:n}:{displayName:r,filterAllowed:n}}onNewBodyColumn(e,t){let s=0;const{freezeColumns:i,rightToLeft:r}=this.config;return(n,o,a)=>{if(s>0){s-=1;return}if(!this.skipFrozenColumns){const C=n.getPinned();i==="pinned"&&C&&(C===!0||C==="left")!==r?this.frozenColumnCount++:typeof i=="function"&&i(xr(this.gos,{column:n}))?this.frozenColumnCount++:this.skipFrozenColumns=!0}const{value:l,valueFormatted:c}=this.extractRowCellValue({column:n,node:a,currentColumnIndex:o,accumulatedRowIndex:e,type:"excel",useRawFormula:!0}),u=l,d=typeof u=="bigint"?u.toString():u,h=this.config.styleLinker({rowType:"BODY",rowIndex:e,value:u,column:n,node:a}),p=this.getStyleId(h),g=n.getColSpan(a),f=this.addImage(e,n,d),m=this.resolveBodyCellNote({accumulatedRowIndex:e,column:n,node:a}),v=!f&&this.transformValues&&n.showValuesAs!=null&&(!a.group||!this.valueSvc.displayIgnoresAggData(a));if(f)t.push(this.createCell(p,this.getDataTypeForValue(f.value),f.value==null?"":f.value,void 0,m));else if(g>1)s=g-1,t.push(this.createMergedCell(p,v?"s":this.getDataTypeForValue(u),v?c??d:d,g-1,m));else{const C=!v&&n.allowFormula&&this.formulaSvc?.isFormula(d),S=v?"s":this.getDataTypeForValue(u);let w=d;C?w=this.formulaSvc?.updateFormulaByOffset({value:d,rowDelta:e-(a.formulaRowIndex+1),useRefFormat:!1}):v&&(w=c??d);const b=this.createCell(p,C?"f":S,w,c,m);t.push(b)}}}onNewRow(e,t){const s=[];return this.rows.push({cells:s,height:Tr(this.rows.length+1,t)}),{onColumn:e.bind(this,this.rows.length,s)()}}addWorksheetToWorkbook(e){const{excelStyles:t,config:s}=this;return this.mapSharedStrings(e),this.frozenColumnCount&&(s.frozenColumnCount=this.frozenColumnCount),this.frozenRowCount&&(s.frozenRowCount=this.frozenRowCount),this.workbook.addWorksheet(t,e,s)}mapSharedStrings(e){for(const t of e.table.rows)for(const s of t.cells){const i=s.data;if(i?.type!=="s")continue;const r=i.value;r==null||r===""||(i.value=this.workbook.getStringPosition(String(r)).toString())}}getDataTypeForValue(e){if(e===void 0)return"empty";let t="s";try{this.isNumerical(e)&&(t="n")}catch{}return t}getTypeFromStyle(e,t){if(this.isFormula(t))return"f";if(e?.dataType)switch(e.dataType.toLocaleLowerCase()){case"formula":return"f";case"string":return"s";case"number":return"n";case"datetime":return"d";case"error":return"e";case"boolean":return"b";default:this.log.warn(162,{id:e.id,dataType:e.dataType})}return null}addImage(e,t,s){if(!this.config.addImageToCell)return;const i=this.config.addImageToCell(e,t,s);if(i)return this.workbook.addBodyImageToMap(i.image,e,t,this.columnsToExport,this.config.rowHeight),i}createCell(e,t,s,i,r){const n=this.getStyleById(e);!n?.dataType&&t==="s"&&i!=null&&(s=i);const o=this.getTypeFromStyle(n,s)||t,{type:a,value:l,escaped:c}=this.getCellValue(o,s),u=[];return n&&u.push(e),c&&u.push("_quotePrefix"),e=this.getStyleId(u)||void 0,{styleId:e,data:{type:a,value:l},note:r?.text?r:void 0}}createMergedCell(e,t,s,i,r){const n=this.getStyleById(e),o=s??"",a=this.getTypeFromStyle(n,o)||t,{type:l,value:c}=this.getCellValue(a,o);return{styleId:n?e:void 0,data:{type:l,value:c},mergeAcross:i,note:r?.text?r:void 0}}resolveBodyCellNote(e){const{processNoteCallback:t,suppressGridNotesExport:s}=this.config,i=!s&&!!this.notesSvc?.hasDataSource(),n=!!this.notesSvc&&(i||!!t)?this.notesSvc?.getNote({rowNode:e.node,column:e.column,location:"cell"}):void 0;let o;if(i&&n?.text!=null&&n.text!==""&&(o={text:n.text,author:n.author}),!t)return o;const a=t(this.getCellNoteExportParams(e,n,o));if(a===void 0)return o;if(!(a?.text==null||a.text===""))return{text:a.text,author:a.author}}getCellNoteExportParams(e,t,s){const{column:i,node:r,accumulatedRowIndex:n}=e,o=this.valueSvc,a=this.valueFrom,l=o.getDisplayValue(i,r,a,this.transformValues);return xr(this.gos,{accumulatedRowIndex:n,column:i,node:r,value:l,type:"excel",parseValue:c=>o.parseValue(i,r,c,o.getValue(i,r,a)),formatValue:c=>(this.transformValues?o.formatTransformedValue(i,r,c):void 0)??o.formatValue(i,r,c)??c,gridNote:t,excelNote:s})}getCellValue(e,t){let s=!1;if(t==null||t===""||e==="empty")return{type:"empty",value:null,escaped:!1};if(e==="s"){if(t=String(t),t[0]==="'"&&(s=!0,t=t.slice(1),t===""))return{type:"empty",value:null,escaped:!1}}else if(e==="f")t=this.addXlfnPrefix(t).slice(1);else if(e==="n"){const i=Number(t);if(isNaN(i))return{type:"empty",value:null,escaped:!1};t=i.toString()}return{type:e,value:t,escaped:s}}addXlfnPrefix(e){if(!e)return e;const t=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return e.replace(t,(s,i,r,n)=>`${i}_xlfn.${r}${n}`)}getStyleId(e){if(!e?.length)return null;const t=e.filter(i=>this.stylesByIds[i]!=null);if(!t.length)return null;if(t.length===1)return t[0];const s=t.join("-");return this.mixedStyles[s]||this.addNewMixedStyle(t),this.mixedStyles[s].excelID}addNewMixedStyle(e){this.mixedStyleCounter+=1;const t=`mixedStyle${this.mixedStyleCounter}`,s={};for(const r of e){const n=this.stylesByIds[r];n&&BT(s,n,!0,!0)}s.id=t;const i=e.join("-");this.mixedStyles[i]={excelID:t,key:i,result:s},this.excelStyles.push(s),this.stylesByIds[t]=s}isFormula(e){if(e==null)return!1;const t=String(e);return this.config.autoConvertFormulas&&_T(t)}isNumerical(e){return typeof e=="bigint"?!1:isFinite(e)&&e!==""&&!isNaN(parseFloat(e))}getStyleById(e){return e==null?null:this.stylesByIds[e]||null}};import{_escapeString as XT}from"ag-stack";import{_escapeString as Uu}from"ag-stack";var zu={name:"rPr",children:[{name:"sz",properties:{rawMap:{val:"10"}}},{name:"color",properties:{rawMap:{rgb:"FF000000"}}},{name:"rFont",properties:{rawMap:{val:"Tahoma"}}},{name:"family",properties:{rawMap:{val:"2"}}}]},ZT={name:"rPr",children:[{name:"b"},...zu.children]},JT=(e,t)=>({name:"t",properties:t?{rawMap:{"xml:space":"preserve"}}:void 0,textNode:Uu(ti(e)??"")}),Oo=(e,t,s)=>({name:"r",children:[t?ZT:zu,JT(e,s)]}),QT=(e,t,s)=>!t||!s?[Oo(e,!1,e.includes(`
`)||e.trim().length!==e.length)]:[Oo(`${t}:
`,!0,!0),Oo(e,!1,e.includes(`
`)||e.trim().length!==e.length)],eA={getTemplate(e){const t=new Map,s=[],i=e.comments.map(r=>{const n=r.author||e.defaultAuthor;let o=t.get(n);return o==null&&(o=s.length,s.push(n),t.set(n,o)),{name:"comment",properties:{rawMap:{ref:r.ref,authorId:o}},children:[{name:"text",children:QT(r.text,n,e.prependAuthor)}]}});return{name:"comments",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:[{name:"authors",children:s.map(r=>({name:"author",textNode:Uu(r)}))},{name:"commentList",children:i}]}}},tA=eA,sA={getTemplate(e){const{name:t,ContentType:s,Extension:i,PartName:r}=e;return{name:t,properties:{rawMap:{Extension:i,PartName:r,ContentType:s}}}}},iA=sA,Ar=e=>e==="jpg"?"jpeg":e,rA={getTemplate({sheetLen:e,hasCustomProperties:t}){const s=new Array(e).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${g+1}.xml`})),i=Et.size,r=Be.size,n=je.size,o={};Ss.forEach(p=>{o[Ar(p.type)]=!0});const a=new Array(i).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${g+1}.xml`})),l=[],c=new Array(n).fill(void 0).map((p,g)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml",PartName:`/xl/comments${g+1}.xml`}));Ve.forEach(({name:p})=>{l.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${p}.xml`})});const u=t?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],d=Object.keys(o).map(p=>({name:"Default",ContentType:`image/${p}`,Extension:p}));(r||n)&&d.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});const h=[...d,{name:"Default",Extension:"rels",ContentType:"application/vnd.openxmlformats-package.relationships+xml"},{name:"Default",ContentType:"application/xml",Extension:"xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml",PartName:"/xl/workbook.xml"},...s,{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.theme+xml",PartName:"/xl/theme/theme1.xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml",PartName:"/xl/styles.xml"},{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml",PartName:"/xl/sharedStrings.xml"},...a,...c,...l,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...u].map(p=>iA.getTemplate(p));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:h}}},nA=rA,oA={getTemplate(e){const s=new Date().toJSON();return{name:"cp:coreProperties",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{cp:"http://schemas.openxmlformats.org/package/2006/metadata/core-properties",dc:"http://purl.org/dc/elements/1.1/",dcterms:"http://purl.org/dc/terms/",dcmitype:"http://purl.org/dc/dcmitype/",xsi:"http://www.w3.org/2001/XMLSchema-instance"}}]},children:[{name:"dc:creator",textNode:e},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:s},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:s}]}}},aA=oA;import{_escapeString as Wu}from"ag-stack";var lA="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",cA=e=>Object.keys(e).filter(s=>s&&e[s]!=null).map((s,i)=>({name:"property",properties:{rawMap:{fmtid:lA,pid:(i+2).toString(),name:Wu(s)??""}},children:[{name:"vt:lpwstr",textNode:Wu(ti(String(e[s])))??""}]})),uA={getTemplate(e){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:cA(e)}}},dA=uA;import{_clamp as $u}from"ag-grid-community";var Ku=(e,t)=>({name:`xdr:${e}`,children:[{name:"xdr:col",textNode:t.col.toString()},{name:"xdr:colOff",textNode:t.offsetX.toString()},{name:"xdr:row",textNode:t.row.toString()},{name:"xdr:rowOff",textNode:t.offsetY.toString()}]}),hA=e=>{const t=[{name:"a:ext",properties:{rawMap:{uri:"{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}"}},children:[{name:"a16:creationId",properties:{rawMap:{id:"{822E6D20-D7BC-2841-A643-D49A6EF008A2}","xmlns:a16":"http://schemas.microsoft.com/office/drawing/2014/main"}}}]}];switch(e.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":t.push({name:"a:ext",properties:{rawMap:{uri:"{C183D7F6-B498-43B3-948B-1728B52AA6E4}"}},children:[{name:"adec:decorative",properties:{rawMap:{val:"0","xmlns:adec":"http://schemas.microsoft.com/office/drawing/2017/decorative"}}}]})}return{name:"a:extLst",children:t}},pA=(e,t)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:t,name:e.id,descr:e.altText!=null?e.altText:void 0}},children:[hA(e)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),ju=e=>{if(!e.saturation&&!e.tint)return;const t=[];return e.saturation&&t.push({name:"a:satMod",properties:{rawMap:{val:e.saturation*1e3}}}),e.tint&&t.push({name:"a:tint",properties:{rawMap:{val:e.tint*1e3}}}),t},gA=(e,t)=>({name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:e.color}},children:ju(e)},{name:"a:srgbClr",properties:{rawMap:{val:t.color}},children:ju(t)}]}),fA=(e,t)=>{let s;if(e.transparency){const i=$u(e.transparency,0,100);s=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(i*1e3)}}}]}if(e.recolor)switch(s||(s=[]),e.recolor.toLocaleLowerCase()){case"grayscale":s.push({name:"a:grayscl"});break;case"sepia":s.push(gA({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":s.push({name:"a:lum",properties:{rawMap:{bright:"70000",contrast:"-70000"}}});break;default:}return{name:"xdr:blipFill",children:[{name:"a:blip",properties:{rawMap:{cstate:"print","r:embed":`rId${t}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:s},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},mA=(e,t)=>{const s={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:t.width,cy:t.height}}}]};if(e.rotation){const n=e.rotation;s.properties={rawMap:{rot:$u(n,0,360)*6e4}}}return{name:"xdr:spPr",children:[s,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},vA=e=>{e.fitCell=!!e.fitCell||!e.width||!e.height;const{position:t={},fitCell:s,width:i=0,height:r=0,totalHeight:n,totalWidth:o}=e,{offsetX:a=0,offsetY:l=0,row:c=1,rowSpan:u=1,column:d=1,colSpan:h=1}=t;return{from:{row:c-1,col:d-1,offsetX:vs(a),offsetY:vs(l)},to:{row:c-1+(s?1:u-1),col:d-1+(s?1:h-1),offsetX:vs(i+a),offsetY:vs(r+l)},height:vs(n||r),width:vs(o||i)}},CA=(e,t,s,i)=>({name:"xdr:pic",children:[pA(e,t+1),fA(e,s+1),mA(e,i)]}),SA={getTemplate(e){const{sheetIndex:t}=e,s=Et.get(t),i=bs.get(t),r=s.map((n,o)=>{const a=vA(n);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[Ku("from",a.from),Ku("to",a.to),CA(n,o,i.get(n.id).index,a),{name:"xdr:clientData"}]}});return{name:"xdr:wsDr",properties:{rawMap:{"xmlns:a":"http://schemas.openxmlformats.org/drawingml/2006/main","xmlns:xdr":"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"}},children:r}}},bA=SA,Yu=e=>{let t=0,s=0;for(;s<e.length;){const r=e.charCodeAt(s);if(r<65||r>90)break;t=t*26+(r-64),s++}return{row:Number(e.slice(s))-1,column:t-1}},yA=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),wA=()=>({name:"v:shapetype",properties:{prefixedAttributes:[{prefix:"o:",map:{spt:"202"}}],rawMap:{id:"_x0000_t202",coordsize:"21600,21600",path:"m0,0l0,21600,21600,21600,21600,0xe"}},children:[{name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}},{name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect"}}],rawMap:{gradientshapeok:"t"}}}]}),xA=e=>{const{row:t,column:s}=Yu(e.ref);return`${s+1},0,${t+1},0,${s+3},20,${t+5},20`},FA=e=>{const{row:t,column:s}=Yu(e.ref);return{name:"x:ClientData",properties:{rawMap:{ObjectType:"Note"}},children:[{name:"x:MoveWithCells"},{name:"x:SizeWithCells"},{name:"x:Anchor",textNode:xA(e)},{name:"x:AutoFill",textNode:"False"},{name:"x:Row",textNode:String(t)},{name:"x:Column",textNode:String(s)}]}},TA=(e,t)=>({name:"v:shape",properties:{prefixedAttributes:[{prefix:"o:",map:{insetmode:"auto"}}],rawMap:{id:`_x0000_s${1025+t}`,type:"#_x0000_t202",style:"position:absolute;margin-left:80pt;margin-top:5pt;width:104pt;height:64pt;z-index:10;visibility:hidden",fillcolor:"#ffffe1",strokecolor:"#000000"}},children:[{name:"v:fill",properties:{rawMap:{color2:"#ffffe1"}}},{name:"v:shadow",properties:{rawMap:{color:"black",obscured:"t"}}},{name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"none"}}]}},{name:"v:textbox",properties:{rawMap:{style:"mso-direction-alt:auto"}},children:[{name:"div",properties:{rawMap:{style:"text-align:left"}}}]},FA(e)]}),AA={getTemplate(e){const t=je.get(e.sheetIndex)||[];return{name:"xml",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{v:"urn:schemas-microsoft-com:vml",o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel"}}]},children:[yA(),wA(),...t.map((s,i)=>TA(s,i))]}}},PA=AA,RA={getTemplate(e){const{Id:t,Type:s,Target:i}=e;return{name:"Relationship",properties:{rawMap:{Id:t,Type:s,Target:i}}}}},MA=RA,IA={getTemplate(e){const t=e.map(s=>MA.getTemplate(s));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:t}}},si=IA,EA={getTemplate(e){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:e.size,uniqueCount:e.size}},children:YT(e)}}},DA=EA,LA=e=>{switch(e){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},kA={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},_A=["Dashed","DashDot","DashDotDot"],GA={None:"none",Solid:"solid",Gray50:"mediumGray",Gray75:"darkGray",Gray25:"lightGray",HorzStripe:"darkHorizontal",VertStripe:"darkVertical",ReverseDiagStripe:"darkDown",DiagStripe:"darkUp",DiagCross:"darkGrid",ThickDiagCross:"darkTrellis",ThinHorzStripe:"lightHorizontal",ThinVertStripe:"lightVertical",ThinReverseDiagStripe:"lightDown",ThinDiagStripe:"lightUp",ThinHorzCross:"lightGrid",ThinDiagCross:"lightTrellis",Gray125:"gray125",Gray0625:"gray0625"},OA={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},NA={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},BA=e=>e?GA[e]||e:"none",It=e=>e==null?e:(e.charAt(0)==="#"&&(e=e.substring(1)),e.length===6?"FF"+e:e),Pr=(e,t)=>{if(!e)return"thin";const s=LA(t);if(e==="Continuous")return s;const i=kA[e];return s==="medium"&&_A.some(r=>r===i)?`medium${i}`:`${i.charAt(0).toLowerCase()}${i.substring(1)}`},VA=e=>OA[e]||"general",HA=e=>NA[e]||void 0,ii=e=>({name:"color",properties:{rawMap:{rgb:It(e||"#000000")}}}),UA={getTemplate(e){const{left:t,right:s,top:i,bottom:r,diagonal:n}=e,o=t?[ii(t.color)]:void 0,a=s?[ii(s.color)]:void 0,l=i?[ii(i.color)]:void 0,c=r?[ii(r.color)]:void 0,u=n?[ii(n.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:t?.style}},children:o},{name:"right",properties:{rawMap:{style:s?.style}},children:a},{name:"top",properties:{rawMap:{style:i?.style}},children:l},{name:"bottom",properties:{rawMap:{style:r?.style}},children:c},{name:"diagonal",properties:{rawMap:{style:n?.style}},children:u}]}}},zA=UA,WA={getTemplate(e){return{name:"borders",properties:{rawMap:{count:e.length}},children:e.map(t=>zA.getTemplate(t))}}},$A=WA,KA=e=>{const s=["Context","LeftToRight","RightToLeft"].indexOf(e);return Math.max(s,0)},jA={getTemplate(e){const{horizontal:t,indent:s,readingOrder:i,rotate:r,shrinkToFit:n,vertical:o,wrapText:a}=e;return{name:"alignment",properties:{rawMap:{horizontal:t&&VA(t),indent:s,readingOrder:i&&KA(i),textRotation:r,shrinkToFit:n,vertical:o&&HA(o),wrapText:a}}}}},YA=jA,qA={getTemplate(e){const t=e.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:e.hideFormula===!0?1:0,locked:t}}}}},XA=qA,ZA={getTemplate(e){const{alignment:t,borderId:s,fillId:i,fontId:r,numFmtId:n,protection:o,quotePrefix:a,xfId:l}=e,c=[];return t&&c.push(YA.getTemplate(t)),o&&c.push(XA.getTemplate(o)),{name:"xf",properties:{rawMap:{applyAlignment:t?1:void 0,applyProtection:o?1:void 0,applyBorder:s?1:void 0,applyFill:i?1:void 0,borderId:s,fillId:i,applyFont:r?1:void 0,fontId:r,applyNumberFormat:n?1:void 0,numFmtId:n,quotePrefix:a?1:void 0,xfId:l}},children:c.length?c:void 0}}},qu=ZA,JA={getTemplate(e){return{name:"cellStyleXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>qu.getTemplate(t))}}},QA=JA,eP={getTemplate(e){const{builtinId:t,name:s,xfId:i}=e;return{name:"cellStyle",properties:{rawMap:{builtinId:t,name:s,xfId:i}}}}},tP=eP,sP={getTemplate(e){return{name:"cellStyles",properties:{rawMap:{count:e.length}},children:e.map(t=>tP.getTemplate(t))}}},iP=sP,rP={getTemplate(e){return{name:"cellXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>qu.getTemplate(t))}}},nP=rP,oP={getTemplate(e){const{patternType:t,fgTheme:s,fgTint:i,fgRgb:r,bgRgb:n,bgIndexed:o}=e,a={name:"patternFill",properties:{rawMap:{patternType:t}}};return(s||i||r)&&(a.children=[{name:"fgColor",properties:{rawMap:{theme:s,tint:i,rgb:r}}}]),(o||n)&&(a.children||(a.children=[]),a.children.push({name:"bgColor",properties:{rawMap:{indexed:o,rgb:n}}})),{name:"fill",children:[a]}}},aP=oP,lP={getTemplate(e){return{name:"fills",properties:{rawMap:{count:e.length}},children:e.map(t=>aP.getTemplate(t))}}},cP=lP,uP={getTemplate(e){const{size:t,colorTheme:s,color:i="FF000000",fontName:r="Calibri",family:n,scheme:o,italic:a,bold:l,strikeThrough:c,outline:u,shadow:d,underline:h,verticalAlign:p}=e,g=[{name:"sz",properties:{rawMap:{val:t}}},{name:"color",properties:{rawMap:{theme:s,rgb:i}}},{name:"name",properties:{rawMap:{val:r}}}];return n&&g.push({name:"family",properties:{rawMap:{val:n}}}),o&&g.push({name:"scheme",properties:{rawMap:{val:o}}}),a&&g.push({name:"i"}),l&&g.push({name:"b"}),c&&g.push({name:"strike"}),u&&g.push({name:"outline"}),d&&g.push({name:"shadow"}),h&&g.push({name:"u",properties:{rawMap:{val:h}}}),p&&g.push({name:"vertAlign",properties:{rawMap:{val:p}}}),{name:"font",children:g}}},dP=uP,hP={getTemplate(e){return{name:"fonts",properties:{rawMap:{count:e.length}},children:e.map(t=>dP.getTemplate(t))}}},pP=hP;import{_escapeString as gP}from"ag-stack";function fP(e){const t=e.split(/(\[[^\]]*\])/);for(let s=0;s<t.length;s++){let i=t[s];i.length&&(i.startsWith("[")||(i=i.replace(/\$/g,'"$"')),t[s]=gP(i))}return t.join("")}var mP={getTemplate(e){let{formatCode:t,numFmtId:s}=e;return t.length&&(t=fP(t)),{name:"numFmt",properties:{rawMap:{formatCode:t,numFmtId:s}}}}},vP=mP,CP={getTemplate(e){return{name:"numFmts",properties:{rawMap:{count:e.length}},children:e.map(t=>vP.getTemplate(t))}}},SP=CP,Rr,Cs,ri,ni,oi,Xu,Mr,Zu,No,Ju=(e,t)=>(e.includes("mixedStyle")&&t>1&&(e+=`_${t}`),e),Qu=()=>{Rr={base:0},Cs=[],ri=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],ni=[{patternType:"none"},{patternType:"gray125"}],oi=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],Xu=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],Mr=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],Zu=[{builtinId:0,name:"Normal",xfId:0}]},bP=e=>{const t=BA(e.pattern),s=It(e.color),i=It(e.patternColor);let r=ni.findIndex(n=>{const{patternType:o,fgRgb:a,bgRgb:l}=n;return!(o!=t||a!=s||l!=i)});return r===-1&&(r=ni.length,ni.push({patternType:t,fgRgb:s,bgRgb:i})),r},yP=e=>{if(Bu[e])return Bu[e];let t=Cs.findIndex(s=>s.formatCode===e);return t===-1?(t=Cs.length+164,Cs.push({formatCode:e,numFmtId:t})):t=Cs[t].numFmtId,t},wP=e=>{const{borderBottom:t,borderTop:s,borderLeft:i,borderRight:r}=e;let n,o,a,l,c,u,d,h;i&&(a=Pr(i.lineStyle,i.weight),d=It(i.color)),r&&(l=Pr(r.lineStyle,r.weight),h=It(r.color)),t&&(n=Pr(t.lineStyle,t.weight),c=It(t.color)),s&&(o=Pr(s.lineStyle,s.weight),u=It(s.color));let p=oi.findIndex(g=>{const{left:f,right:m,top:v,bottom:C}=g;if(!f&&(a||d)||!m&&(l||h)||!v&&(o||u)||!C&&(n||c))return!1;const{style:S,color:w}=f||{},{style:b,color:y}=m||{},{style:T,color:x}=v||{},{style:F,color:A}=C||{};return!(S!=a||w!=d||b!=l||y!=h||T!=o||x!=u||F!=n||A!=c)});return p===-1&&(p=oi.length,oi.push({left:{style:a,color:d},right:{style:l,color:h},top:{style:o,color:u},bottom:{style:n,color:c},diagonal:{style:void 0,color:void 0}})),p},xP=e=>{const{fontName:t="Calibri",color:s,size:i,bold:r,italic:n,outline:o,shadow:a,strikeThrough:l,underline:c,family:u,verticalAlign:d}=e,h=It(s),p=WT(u),g=c?c.toLocaleLowerCase():void 0,f=d?d.toLocaleLowerCase():void 0;let m=ri.findIndex(v=>!(v.fontName!=t||v.color!=h||v.size!=i||v.bold!=r||v.italic!=n||v.outline!=o||v.shadow!=a||v.strikeThrough!=l||v.underline!=g||v.verticalAlign!=f||v.family!=p));return m===-1&&(m=ri.length,ri.push({fontName:t,color:h,size:i,bold:r,italic:n,outline:o,shadow:a,strikeThrough:l,underline:g,verticalAlign:f,family:p?.toString()})),m},FP=e=>{const{alignment:t,borders:s,font:i,interior:r,numberFormat:n,protection:o,quotePrefix:a}=e;let{id:l}=e,c=0,u=0,d=0,h=0;l&&(l=Ju(l,No),Rr[l]==null&&(r&&(c=bP(r)),s&&(u=wP(s)),i&&(d=xP(i)),n&&(h=yP(n.format)),Rr[l]=Mr.length,Mr.push({alignment:t,borderId:u||0,fillId:c||0,fontId:d||0,numFmtId:h||0,protection:o,quotePrefix:a,xfId:0})))},TP={getTemplate(e){const t=SP.getTemplate(Cs),s=pP.getTemplate(ri.map(l=>({...l,size:l.size!=null?l.size:e}))),i=cP.getTemplate(ni),r=$A.getTemplate(oi),n=QA.getTemplate(Xu),o=nP.getTemplate(Mr),a=iP.getTemplate(Zu);return Qu(),{name:"styleSheet",properties:{rawMap:{"mc:Ignorable":"x14ac x16r2 xr",xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","xmlns:x14ac":"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac","xmlns:x16r2":"http://schemas.microsoft.com/office/spreadsheetml/2015/02/main","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision"}},children:[t,s,i,r,n,o,a,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},AP=(e,t)=>Rr[Ju(e,t)]||0,PP=(e,t)=>{No=t,No===1&&Qu(),e.forEach(FP)},RP=TP;import{_escapeString as MP}from"ag-stack";var IP={getTemplate(e,t){const{name:s,columns:i,rowRange:r,displayName:n,showRowStripes:o,showColumnStripes:a,showFilterButtons:l,highlightFirstColumn:c,highlightLastColumn:u}=e||{},d=!r||r[0]-r[1]===0;if(!e||!s||!Array.isArray(i)||!i.length||d)return{name:"table"};const h=i.map((C,S)=>({name:"filterColumn",properties:{rawMap:{colId:S.toString(),hiddenButton:l[S]?0:1}}})),p=`A${r[0]}`,g=`${Jt(i.length)}${r[1]}`,f=`${p}:${g}`,m=`${t+1}`,v=t?`${n}_${m}`:n;return{name:"table",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main","xmlns:mc":"http://schemas.openxmlformats.org/markup-compatibility/2006","mc:Ignorable":"xr xr3","xmlns:xr":"http://schemas.microsoft.com/office/spreadsheetml/2014/revision","xmlns:xr3":"http://schemas.microsoft.com/office/spreadsheetml/2016/revision3",name:v,displayName:v,ref:f,totalsRowShown:0,id:m}},children:[{name:"autoFilter",properties:{rawMap:{ref:f}},children:h},{name:"tableColumns",properties:{rawMap:{count:i.length}},children:i.map((C,S)=>({name:"tableColumn",properties:{rawMap:{id:(S+1).toString(),name:MP(jT(C)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:c?1:0,showLastColumn:u?1:0,showRowStripes:o?1:0,showColumnStripes:a?1:0}}}]}}},EP=IP,Ne=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,children:[{name:`a:${s}`,properties:{rawMap:{val:i,lastClr:r}}}]}},DP={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[Ne(["dk1","sysClr","windowText","000000"]),Ne(["lt1","sysClr","window","FFFFFF"]),Ne(["dk2","srgbClr","44546A"]),Ne(["lt2","srgbClr","E7E6E6"]),Ne(["accent1","srgbClr","4472C4"]),Ne(["accent2","srgbClr","ED7D31"]),Ne(["accent3","srgbClr","A5A5A5"]),Ne(["accent4","srgbClr","FFC000"]),Ne(["accent5","srgbClr","5B9BD5"]),Ne(["accent6","srgbClr","70AD47"]),Ne(["hlink","srgbClr","0563C1"]),Ne(["folHlink","srgbClr","954F72"])]}}},LP=DP,R=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,properties:{rawMap:{script:i,typeface:s,panose:r}}}},kP={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[R(["latin","Calibri Light",void 0,"020F0302020204030204"]),R(["ea",""]),R(["cs",""]),R(["font","\u6E38\u30B4\u30B7\u30C3\u30AF Light","Jpan"]),R(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),R(["font","\u7B49\u7EBF Light","Hans"]),R(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),R(["font","Times New Roman","Arab"]),R(["font","Times New Roman","Hebr"]),R(["font","Tahoma","Thai"]),R(["font","Nyala","Ethi"]),R(["font","Vrinda","Beng"]),R(["font","Shruti","Gujr"]),R(["font","MoolBoran","Khmr"]),R(["font","Tunga","Knda"]),R(["font","Raavi","Guru"]),R(["font","Euphemia","Cans"]),R(["font","Plantagenet Cherokee","Cher"]),R(["font","Microsoft Yi Baiti","Yiii"]),R(["font","Microsoft Himalaya","Tibt"]),R(["font","MV Boli","Thaa"]),R(["font","Mangal","Deva"]),R(["font","Gautami","Telu"]),R(["font","Latha","Taml"]),R(["font","Estrangelo Edessa","Syrc"]),R(["font","Kalinga","Orya"]),R(["font","Kartika","Mlym"]),R(["font","DokChampa","Laoo"]),R(["font","Iskoola Pota","Sinh"]),R(["font","Mongolian Baiti","Mong"]),R(["font","Times New Roman","Viet"]),R(["font","Microsoft Uighur","Uigh"]),R(["font","Sylfaen","Geor"]),R(["font","Arial","Armn"]),R(["font","Leelawadee UI","Bugi"]),R(["font","Microsoft JhengHei","Bopo"]),R(["font","Javanese Text","Java"]),R(["font","Segoe UI","Lisu"]),R(["font","Myanmar Text","Mymr"]),R(["font","Ebrima","Nkoo"]),R(["font","Nirmala UI","Olck"]),R(["font","Ebrima","Osma"]),R(["font","Phagspa","Phag"]),R(["font","Estrangelo Edessa","Syrn"]),R(["font","Estrangelo Edessa","Syrj"]),R(["font","Estrangelo Edessa","Syre"]),R(["font","Nirmala UI","Sora"]),R(["font","Microsoft Tai Le","Tale"]),R(["font","Microsoft New Tai Lue","Talu"]),R(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[R(["latin","Calibri",void 0,"020F0502020204030204"]),R(["ea",""]),R(["cs",""]),R(["font","\u6E38\u30B4\u30B7\u30C3\u30AF","Jpan"]),R(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),R(["font","\u7B49\u7EBF","Hans"]),R(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),R(["font","Arial","Arab"]),R(["font","Arial","Hebr"]),R(["font","Tahoma","Thai"]),R(["font","Nyala","Ethi"]),R(["font","Vrinda","Beng"]),R(["font","Shruti","Gujr"]),R(["font","DaunPenh","Khmr"]),R(["font","Tunga","Knda"]),R(["font","Raavi","Guru"]),R(["font","Euphemia","Cans"]),R(["font","Plantagenet Cherokee","Cher"]),R(["font","Microsoft Yi Baiti","Yiii"]),R(["font","Microsoft Himalaya","Tibt"]),R(["font","MV Boli","Thaa"]),R(["font","Mangal","Deva"]),R(["font","Gautami","Telu"]),R(["font","Latha","Taml"]),R(["font","Estrangelo Edessa","Syrc"]),R(["font","Kalinga","Orya"]),R(["font","Kartika","Mlym"]),R(["font","DokChampa","Laoo"]),R(["font","Iskoola Pota","Sinh"]),R(["font","Mongolian Baiti","Mong"]),R(["font","Arial","Viet"]),R(["font","Microsoft Uighur","Uigh"]),R(["font","Sylfaen","Geor"]),R(["font","Arial","Armn"]),R(["font","Leelawadee UI","Bugi"]),R(["font","Microsoft JhengHei","Bopo"]),R(["font","Javanese Text","Java"]),R(["font","Segoe UI","Lisu"]),R(["font","Myanmar Text","Mymr"]),R(["font","Ebrima","Nkoo"]),R(["font","Nirmala UI","Olck"]),R(["font","Ebrima","Osma"]),R(["font","Phagspa","Phag"]),R(["font","Estrangelo Edessa","Syrn"]),R(["font","Estrangelo Edessa","Syrj"]),R(["font","Estrangelo Edessa","Syre"]),R(["font","Nirmala UI","Sora"]),R(["font","Microsoft Tai Le","Tale"]),R(["font","Microsoft New Tai Lue","Talu"]),R(["font","Ebrima","Tfng"])]}]}}},_P=kP,tt=(e,t,s)=>({name:`a:${e}`,properties:{rawMap:{val:t}},children:s}),Bo=e=>{const[t,s,i,r,n,o]=e,a=[];return a.push(tt("satMod",i)),r&&a.push(tt("lumMod",r)),n&&a.push(tt("tint",n)),o&&a.push(tt("shade",o)),{name:"a:gs",properties:{rawMap:{pos:t}},children:[{name:"a:schemeClr",properties:{rawMap:{val:s}},children:a}]}},Ir=(e,t)=>({name:"a:solidFill",children:[tt("schemeClr",e,t)]}),Vo=e=>{const[t,s,i,r,n]=e,[o,a]=n;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:t}},children:[{name:"a:gsLst",children:[Bo(s),Bo(i),Bo(r)]},{name:"a:lin",properties:{rawMap:{ang:o,scaled:a}}}]}},Ho=e=>{const[t,s,i,r]=e;return{name:"a:ln",properties:{rawMap:{w:t,cap:s,cmpd:i,algn:r}},children:[Ir("phClr"),tt("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},Uo=e=>{const t=[];if(e){const[s,i,r,n,o]=e;t.push({name:"a:outerShdw",properties:{rawMap:{blurRad:s,dist:i,dir:r,algn:n,rotWithShape:o}},children:[tt("srgbClr","000000",[tt("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},t.length?{children:t}:{})]}},GP=()=>({name:"a:fillStyleLst",children:[Ir("phClr"),Vo(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),Vo(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),OP=()=>({name:"a:lnStyleLst",children:[Ho(["6350","flat","sng","ctr"]),Ho(["12700","flat","sng","ctr"]),Ho(["19050","flat","sng","ctr"])]}),NP=()=>({name:"a:effectStyleLst",children:[Uo(),Uo(),Uo(["57150","19050","5400000","ctr","0"])]}),BP=()=>({name:"a:bgFillStyleLst",children:[Ir("phClr"),Ir("phClr",[tt("tint","95000"),tt("satMod","170000")]),Vo(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),VP={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[GP(),OP(),NP(),BP()]}}},HP=VP,UP={getTemplate(){return{name:"a:themeElements",children:[LP.getTemplate(),_P.getTemplate(),HP.getTemplate()]}}},zP=UP,WP={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[zP.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},$P=WP,KP=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),jP=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),YP=e=>({name:"v:formulas",children:e.map(t=>({name:"v:f",properties:{rawMap:{eqn:t}}}))}),qP=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),ed=e=>{const{aspectratio:t,rotation:s}=e||{},i={};return t&&(i.aspectratio="t"),s&&(i.rotation="t"),{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:i}}};function XP(e,t,s,i,r){return(e-t)/(s-t)*(r-i)+i}var ZP=(e,t)=>{let s;const{recolor:i,brightness:r,contrast:n,id:o}=e;if(i&&(s={},(i==="Washout"||i==="Grayscale")&&(s.gain="19661f",s.blacklevel="22938f"),(i==="Black & White"||i==="Grayscale")&&(s.grayscale="t",i==="Black & White"&&(s.bilevel="t"))),!i||i==="Grayscale"){if(s||(s={}),n!=null&&n!==50){let a="1";n>=0&&(n<50?a=String(n/50):n<100?a=String(50/(100-n)):n===100&&(a="2147483647f")),s.gain=a}r!=null&&r!==50&&(s.blacklevel=XP(r,0,100,-.5,.5).toString())}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${t}`,title:o}}],rawMap:s}}},JP=()=>{const e=["if lineDrawn pixelLineWidth 0","sum @0 1 0","sum 0 0 @1","prod @2 1 2","prod @3 21600 pixelWidth","prod @3 21600 pixelHeight","sum @0 0 1","prod @6 1 2","prod @7 21600 pixelWidth","sum @8 21600 0","prod @7 21600 pixelHeight","sum @10 21600 0"];return{name:"v:shapetype",properties:{prefixedAttributes:[{prefix:"o:",map:{spt:"75",preferrelative:"t"}}],rawMap:{coordsize:"21600,21600",filled:"f",id:"_x0000_t75",path:"m@4@5l@4@11@9@11@9@5xe",stroked:"f"}},children:[jP(),YP(e),qP(),ed({aspectratio:!0})]}},td=e=>Math.floor((e??0)*.74999943307122),QP=(e,t)=>{const{width:s=0,height:i=0,altText:r}=e,n=td(s),o=td(i);return{name:"v:shape",properties:{rawMap:{id:e.headerFooterPosition,"o:spid":"_x0000_s1025",style:`position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${n}pt; height: ${o}pt; z-index: ${t+1}`,type:"#_x0000_t75",alt:r}},children:[ZP(e,t+1),ed({rotation:!0})]}},eR={getTemplate(e){const t=Be.get(e.sheetIndex)||[],s=[KP(),JP(),...t.map((i,r)=>QP(i,r))];return{name:"xml",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{v:"urn:schemas-microsoft-com:vml",o:"urn:schemas-microsoft-com:office:office",x:"urn:schemas-microsoft-com:office:excel"}}]},children:s}}},tR=eR,sR={getTemplate(e,t){const s=(t+1).toString();return{name:"sheet",properties:{rawMap:{name:e,sheetId:s,"r:id":`rId${s}`}}}}},iR=sR,rR={getTemplate(e){return{name:"sheets",children:e.map((t,s)=>iR.getTemplate(t,s))}}},nR=rR,oR={getTemplate(e,t){return{name:"workbook",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}}],rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:[{name:"bookViews",children:[{name:"workbookView",properties:{rawMap:{activeTab:t}}}]},nR.getTemplate(e)]}}},aR=oR;import{_escapeString as lR}from"ag-stack";var cR=e=>Math.ceil((e-12)/7+1),uR={getTemplate(e){const{min:t,max:s,outlineLevel:i,s:r,width:n,hidden:o,bestFit:a}=e;let l=1,c="0";return n>1&&(l=cR(n),c="1"),{name:"col",properties:{rawMap:{min:t,max:s,outlineLevel:i??void 0,width:l,style:r,hidden:o?"1":"0",bestFit:a?"1":"0",customWidth:c}}}}},dR=uR,hR={getTemplate(e){return{name:"mergeCell",properties:{rawMap:{ref:e}}}}},pR=hR;import{_escapeString as sd}from"ag-stack";var gR=e=>{const t=e.charAt(0).toLowerCase();return t==="s"?"inlineStr":t},fR={getTemplate(e,t,s){const{ref:i,data:r,styleId:n}=e,{type:o,value:a}=r||{type:"empty",value:null};let l=o;o==="f"?l="str":o.charAt(0)===o.charAt(0).toUpperCase()&&(l=gR(o));const c={name:"c",properties:{rawMap:{r:i,t:l==="empty"?void 0:l,s:n?AP(n,s):void 0}}};if(l==="empty")return c;let u;return l==="str"&&o==="f"?u=[{name:"f",textNode:sd(ti(a))}]:l==="inlineStr"?u=[{name:"is",children:[{name:"t",textNode:sd(ti(a))}]}]:u=[{name:"v",textNode:a}],Object.assign({},c,{children:u})}},mR=fR,vR=(e,t)=>{const s=[];let i=0;for(let r=0;r<e.length;r++){const n=e[r];n.mergeAcross&&(s.push({pos:r,excelPos:i}),i+=n.mergeAcross),i++}if(s.length)for(let r=s.length-1;r>=0;r--){const n=[],o=e[s[r].pos];for(let a=1;a<=o.mergeAcross;a++)n.push({ref:`${Jt(s[r].excelPos+1+a)}${t+1}`,styleId:o.styleId,data:{type:"empty",value:null}});n.length&&e.splice(s[r].pos+1,0,...n)}},CR=e=>e.mergeAcross!=null||e.styleId!==void 0||e.note!==void 0?!0:!!e.data&&e.data.type!=="empty"&&e.data.value!=="",SR={getTemplate(e,t,s){const{collapsed:i,hidden:r,height:n,outlineLevel:o,cells:a=[]}=e;vR(a,t);const l=a.filter(CR).map((c,u)=>mR.getTemplate(c,u,s));return{name:"row",properties:{rawMap:{r:t+1,collapsed:i?"1":"0",hidden:r?"1":"0",ht:n,customHeight:n!=null?"1":"0",spans:"1:1",outlineLevel:o||void 0}},children:l}}},bR=SR,yR=(e,t,s)=>{const i=[],r=[];return e.forEach((n,o)=>{const a=n.cells;let l=0,c;a.forEach((u,d)=>{const h=d+l+1,p=Jt(h),g=o+1,f=u.mergeAcross??0,m=u.mergeDown??0;if(f||m){l+=f;const C=Jt(d+l+1);i.push(`${p}${g}:${C}${g+m}`)}t[h-1]||(t[h-1]={});const{collapsibleRanges:v}=u;v&&v.forEach(C=>{r.push([h+C[0],h+C[1]])}),c=t[h-1],c.min=h,c.max=h,u.ref=`${p}${g}`})}),s||wR(t,r),i},wR=(e,t)=>{const s=new Map;for(let i=0,r=t.length;i<r;++i){const[n,o]=t[i];for(let a=n;a<=o;++a)s.set(a,(s.get(a)??0)+1)}s.forEach((i,r)=>{e[r-1]||(e[r-1]={min:r,max:r}),e[r-1].outlineLevel=Math.min(i,7)})},xR=e=>!e||e!=="Portrait"&&e!=="Landscape"?"portrait":e.toLocaleLowerCase(),FR=e=>{if(e==null)return 1;const s=["Letter","Letter Small","Tabloid","Ledger","Legal","Statement","Executive","A3","A4","A4 Small","A5","A6","B4","B5","Folio","Envelope","Envelope DL","Envelope C5","Envelope B5","Envelope C3","Envelope C4","Envelope C6","Envelope Monarch","Japanese Postcard","Japanese Double Postcard"].indexOf(e);return s===-1?1:s+1},TR=e=>{const t={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(const s of Object.keys(t))e=e.replace(s,t[s]);return e},AR=e=>e==="Center"?"C":e==="Right"?"R":"L",PR=(e,t)=>(t&&(e+="&"",e+=t.fontName||"Calibri",t.bold!==t.italic?e+=t.bold?",Bold":",Italic":t.bold?e+=",Bold Italic":e+=",Regular",e+=""",t.size&&(e+=`&${t.size}`),t.strikeThrough&&(e+="&S"),t.underline&&(e+=`&${t.underline==="Double"?"E":"U"}`),t.color&&(e+=`&K${t.color.replace("#","").toUpperCase()}`)),e),RR=(e,t,s)=>e.reduce((i,r,n)=>{const o=AR(r.position),a=PR(`${i}&${o}`,r.font),l=["Left","Center","Right"];r.position||(r.position=l[n]);const{image:c}=r;if(r.value==="&[Picture]"&&c){const u=`${o}${t}${s}`;id(c,u)}return`${a}${lR(TR(r.value))}`},""),MR=e=>{const t=["all","first","even"],s=[];return t.forEach(i=>{const r=e[i],n=i==="all"?"odd":i;if(r)for(const o of Object.keys(r)){const a=r[o],l=`${o.charAt(0).toUpperCase()}${o.slice(1)}`,c=o[0].toUpperCase();if(a){const u=i==="all"?"":i.toUpperCase();s.push({name:`${n}${l}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:RR(a,c,u)})}}}),s},IR=e=>t=>(e.length&&t.children.push({name:"cols",children:e.map(s=>dR.getTemplate(s))}),t),ER=(e,t)=>{const s=[];for(let i=0;i<t.length;i++){const r=t[i].cells;for(let n=0;n<r.length;n++){const o=r[n];!o.note||!o.ref||s.push({ref:o.ref,text:o.note.text,author:o.note.author})}}s.length?je.set(e,s):je.delete(e)},DR=(e,t)=>s=>(e.length&&s.children.push({name:"sheetData",children:e.map((i,r)=>bR.getTemplate(i,r,t))}),s),LR=e=>{const t=e.length;if(!t)return"";const s=new Array(t+1);s[0]=t;for(let r=1;r<=t;r++)s[r]=e.charCodeAt(r-1)&255;let i=0;for(let r=s.length-1;r>=0;r--){const n=s[r],o=(i&16384)===0?0:1,a=i<<1&32767;i=(o|a)^n}return(i^52811).toString(16).toUpperCase().padStart(4,"0")},kR=e=>t=>{if(!e)return t;const s=typeof e=="boolean"?{}:e,i={sheet:1},r=s.password?LR(s.password):"";r&&(i.password=r);const n={autoFilter:!1,deleteColumns:!1,deleteRows:!1,formatCells:!1,formatColumns:!1,formatRows:!1,insertColumns:!1,insertHyperlinks:!1,insertRows:!1,pivotTables:!1,selectLockedCells:!0,selectUnlockedCells:!0};return Object.keys(n).forEach(o=>{const a=s[o];a==null||a===n[o]||(i[o]=a?0:1)}),t.children.push({name:"sheetProtection",properties:{rawMap:i}}),t},_R=e=>t=>(e.length&&t.children.push({name:"mergeCells",properties:{rawMap:{count:e.length}},children:e.map(s=>pR.getTemplate(s))}),t),GR=e=>t=>{const{top:s=.75,right:i=.7,bottom:r=.75,left:n=.7,header:o=.3,footer:a=.3}=e;return t.children.push({name:"pageMargins",properties:{rawMap:{bottom:r,footer:a,header:o,left:n,right:i,top:s}}}),t},OR=e=>t=>(e&&t.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:xR(e.orientation),paperSize:FR(e.pageSize)}}}),t),NR=e=>t=>{if(!e)return t;const s=e.first!=null?1:0,i=e.even!=null?1:0;return t.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:s,differentOddEven:i}},children:MR(e)}),t},BR=e=>t=>(e&&t.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}]}),t),VR=e=>t=>(Et.get(e)?.length&&t.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),HR=e=>t=>(je.get(e)?.length&&t.children.push({name:"legacyDrawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),UR=e=>t=>(Be.get(e)&&t.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),zR=(e=0,t=0)=>{const s=e>0||t>0;return s?[{name:"pane",properties:{rawMap:{state:s?"frozen":void 0,topLeftCell:s?`${Jt(e+1)}${t+1}`:void 0,xSplit:e===0?void 0:e,ySplit:t===0?void 0:t}}}]:void 0},WR=(e=!1,t,s)=>i=>(i.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:e===!0?"1":"0",workbookViewId:"0"}},children:zR(t,s)}]}),i),$R=()=>e=>(e.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),e),KR=(e,t)=>s=>{const i=e.reduce((n,o)=>o.outlineLevel&&o.outlineLevel>n?o.outlineLevel:n,0),r=t.reduce((n,o)=>o.outlineLevel&&o.outlineLevel>n?o.outlineLevel:n,0);return s.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:i||void 0,outlineLevelCol:r||void 0}}}),s},jR={getTemplate(e){const{worksheet:t,currentSheet:s,config:i}=e,{margins:r={},pageSetup:n,headerFooterConfig:o,suppressColumnOutline:a,rightToLeft:l,frozenRowCount:c,frozenColumnCount:u,protectSheet:d}=i,{table:h}=t,{rows:p,columns:g}=h,f=g?.length?yR(p,g,!!a):[];ER(s,p);const m=Ve.get(s),{children:v}=[$R(),WR(l,u,c),KR(p,g??[]),IR(g),DR(p,s+1),kR(d),_R(f),GR(r),OR(n),NR(o),VR(s),HR(s),UR(s),BR(m)].reduce((C,S)=>S(C),{children:[],rIdCounter:0});return{name:"worksheet",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{r:"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}}],rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main"}},children:v}}},YR=jR,Qt=new Map,_e=[],es=[],ts=new Map,Ke=new Map,Et=new Map,Be=new Map,Ss=new Map,bs=new Map,Ve=new Map,je=new Map,qR="AG-GRID-TABLE",zo="SINGLE_SHEET";function XR(){return zo}function ZR(e){zo=e}function JR(e,t,s){iM(t),PP(e,_e.length);const i=Object.assign({},s);s.exportAsExcelTable&&s.pivotModeActive&&(s.log.warn(163,{featureName:"pivot mode"}),i.exportAsExcelTable=!1),tM(t,i);const r=xM(t,i);return FM(r),r}function QR(e){return e.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function eM(e,t,s){if(Ve.has(e)){s.warn(164);return}Ve.set(e,t)}function tM(e,t){const{exportAsExcelTable:s,prependContent:i,appendContent:r,headerRowCount:n=0}=t;if(!s)return;const o=typeof s=="boolean"?{}:s,{name:a,showColumnStripes:l,showRowStripes:c,showFilterButton:u,highlightFirstColumn:d,highlightLastColumn:h}=o,p=QR(a||qR),g=_e.length-1,{table:f}=e,{rows:m,columns:v}=f,C=i?i.length:0,S=r?r.length:0,w=m.length,b=v.length,y=[],T=[];for(let x=0;x<b;x++){const F=v[x];y.push(F.displayName||""),T.push(u==="match"||u===void 0?F.filterAllowed??!1:u)}if(!y?.length||!w||!p){t.log.warn(165);return}eM(g,{name:`table${Ve.size+1}`,displayName:p,columns:y,showFilterButtons:T,rowRange:[n+C,n+(w-n)-S],showRowStripes:c??!0,showColumnStripes:l??!1,highlightFirstColumn:d??!1,highlightLastColumn:h??!1},t.log)}function id(e,t){const s=_e.length-1,i=e;i.headerFooterPosition=t,rd({imageToAdd:i,idx:s});let r=Be.get(s);r||(r=[],Be.set(s,r)),r.find(n=>n.id===e.id)||r.push(e)}function sM(e,t,s,i,r){const n=_e.length,{row:o,column:a}=e.position||{},l=e;i&&(t!=null&&s!=null&&(!o||!a)&&(e.position||(e.position={}),e.position=Object.assign({},e.position,{row:t,column:i.indexOf(s)+1})),$T(l,i),KT(l,r)),rd({imageToAdd:l,idx:n});let c=bs.get(n);c||(c=new Map,bs.set(n,c));const u=Et.get(n);u?u.push(l):Et.set(n,[l]),c.get(e.id)||c.set(e.id,{index:c.size,type:e.imageType})}function rd(e){const{imageToAdd:t,idx:s}=e,i=Ke.get(t.id);if(i){const r=i.find(n=>n.sheetId===s);r?r.image.push(t):i.push({sheetId:s,image:[t]})}else Ke.set(t.id,[{sheetId:s,image:[t]}]),Ss.set(t.id,{type:t.imageType,index:Ss.size})}function iM(e){const t=XT(e.name)||"";let s="";for(;_e.indexOf(`${t}${s}`)!==-1;)s===""?s="_1":s=`_${parseInt(s.slice(1),10)+1}`;e.name=`${t}${s}`,_e.push(e.name)}function rM(e){return Qt.has(e)?Qt.get(e):(Qt.set(e,Qt.size),Qt.size-1)}function nM(){Qt.clear(),Ke.clear(),Et.clear(),Be.clear(),Ss.clear(),bs.clear(),Ve.clear(),je.clear(),_e=[],es=[],ts=new Map,zo="SINGLE_SHEET"}function oM(e){return ge(aR.getTemplate(_e,e))}function aM(e){return ge(RP.getTemplate(e))}function lM(){return ge(DA.getTemplate(Qt))}function cM(e){return ge(aA.getTemplate(e))}function uM(e){return ge(dA.getTemplate(e))}function dM(e,t){return ge(nA.getTemplate({sheetLen:e,hasCustomProperties:t}))}function hM(e){const t=[{Id:"rId1",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",Target:"xl/workbook.xml"},{Id:"rId2",Type:"http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties",Target:"docProps/core.xml"}];e&&t.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});const s=si.getTemplate(t);return ge(s)}function pM(){return ge($P.getTemplate())}function gM(e,t){return ge(EP.getTemplate(e,t))}function fM(e){const t=new Array(e).fill(void 0).map((i,r)=>({Id:`rId${r+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${r+1}.xml`})),s=si.getTemplate([...t,{Id:`rId${e+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${e+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${e+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return ge(s)}function mM(e){return ge(bA.getTemplate({sheetIndex:e}))}function vM(e,t,s){const i=je.get(e)||[],r=t||"AG Grid",n=!s;return ge(tA.getTemplate({comments:i,defaultAuthor:r,prependAuthor:n}))}function CM(e){const t=bs.get(e)||[],s=[];for(const[i,r]of t){const{index:n,type:o}=r;s.push({Id:`rId${n+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${Ss.get(i).index+1}.${Ar(o)}`})}return ge(si.getTemplate(s))}function SM(e){return ge(tR.getTemplate({sheetIndex:e}),!0)}function bM(e){return ge(PA.getTemplate({sheetIndex:e}),!0)}function yM(e){const t=Be.get(e)||[],s=[];for(let i=0;i<t.length;i++){const r=t[i],n=Ss.get(r.id);if(!n)continue;const{index:o,type:a}=n;s.push({Id:`rId${i+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${o+1}.${Ar(a)}`})}return ge(si.getTemplate(s))}function wM({drawingIndex:e,noteVmlDrawingIndex:t,headerFooterVmlDrawingIndex:s,commentsIndex:i,tableName:r}={}){if(e===void 0&&t===void 0&&s===void 0&&i===void 0&&r===void 0)return"";const n=[];e!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/drawing${e+1}.xml`}),t!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${t+1}.vml`}),s!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${s+1}.vml`}),r!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",Target:`../tables/${r}.xml`}),i!=null&&n.push({Id:`rId${n.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments",Target:`../comments${i+1}.xml`});const o=si.getTemplate(n);return ge(o)}function xM(e,t){return ge(YR.getTemplate({worksheet:e,currentSheet:_e.length-1,config:t}))}var ai=(e,t)=>{if(!e.size)return;const s=new Map;t.forEach((i,r)=>{e.has(i)&&s.set(r,e.get(i))}),e.clear(),s.forEach((i,r)=>e.set(r,i))},FM=e=>{const t=ts.get(e)??[];t.push(_e.length-1),ts.set(e,t),es.push(e)},TM=e=>{const t=new Map(ts),s=[];for(const i of e){const r=t.get(i);if(!r?.length)return null;const n=r.shift();s.push(n),t.set(i,r)}return s},AM=e=>{if(!e.length||es.length===0)return null;const t=new Set,s=[];for(const i of e){const r=es.findIndex((n,o)=>!t.has(o)&&n===i);if(r===-1)return null;t.add(r),s.push(r)}return s},PM=e=>{const t=new Map;e.forEach((s,i)=>t.set(s,i)),_e=e.map(s=>_e[s]),es=e.map(s=>es[s]),ai(Et,e),ai(Be,e),ai(Ve,e),ai(je,e),ai(bs,e),Ke.forEach(s=>{s.forEach(i=>{const r=t.get(i.sheetId);r!=null&&(i.sheetId=r)})}),ts=new Map,es.forEach((s,i)=>{const r=ts.get(s)??[];r.push(i),ts.set(s,r)})},RM=e=>{if(e.length<=1)return;const t=TM(e)??AM(e);t&&PM(t)},Er=class{getStringPosition(e){return rM(e)}addBodyImageToMap(e,t,s,i,r){sM(e,t,s,i,r)}addHeaderFooterImageToMap(e,t){id(e,t)}addWorksheet(e,t,s){return JR(e,t,s)}syncOrderWithSheetData(e){RM(e)}reset(){nM()}setFactoryMode(e){ZR(e)}getFactoryMode(){return XR()}getSheetNames(){return[..._e]}};import{_errMsg as MM}from"ag-grid-community";var IM=async e=>{let t=0;const s=[],i=new WritableStream({write:o=>{s.push(o),t+=o.length}}),r=new ReadableStream({start:o=>{const a=new FileReader;a.onload=l=>{l.target?.result&&o.enqueue(l.target.result),o.close()},a.readAsArrayBuffer(e)}}),n=new window.CompressionStream("deflate-raw");return await r.pipeThrough(n).pipeTo(i),{size:t,content:new Blob(s)}},EM=async e=>{const t=new Blob([e]),{size:s,content:i}=await IM(t),r=new Uint8Array(await i.arrayBuffer());return{size:s,content:r}},DM=e=>{let t=e.getHours();return t<<=6,t=t|e.getMinutes(),t<<=5,t=t|e.getSeconds()/2,t},LM=e=>{let t=e.getFullYear()-1980;return t<<=4,t=t|e.getMonth()+1,t<<=5,t=t|e.getDate(),t};function be(e,t){let s="";for(let i=0;i<t;i++)s+=String.fromCharCode(e&255),e>>>=8;return s}var nd=e=>{if(!e.length)return 0;let t=-1;for(let s=0;s<e.length;s++){const i=e[s],r=(t^i)&255,n=kM[r];t=t>>>8^n}return t^-1},od=e=>e.length?nd(typeof e=="string"?new TextEncoder().encode(e):e):0,kM=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918e3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function _M(e){const t=String.fromCharCode;function s(d){const h=[];if(!d)return[];const p=d.length;let g=0,f,m;for(;g<p;)f=d.charCodeAt(g++),f>=55296&&f<=56319&&g<p?(m=d.charCodeAt(g++),(m&64512)==56320?h.push(((f&1023)<<10)+(m&1023)+65536):(h.push(f),g--)):h.push(f);return h}function i(d){if(d>=55296&&d<=57343)throw new Error(MM(255,{point:d}))}function r(d,h){return t(d>>h&63|128)}function n(d){if((d&4294967168)==0)return t(d);let h="";return(d&4294965248)==0?h=t(d>>6&31|192):(d&4294901760)==0?(i(d),h=t(d>>12&15|224),h+=r(d,6)):(d&4292870144)==0&&(h=t(d>>18&7|240),h+=r(d,12),h+=r(d,6)),h+=t(d&63|128),h}const o=s(e),a=o.length;let l=-1,c,u="";for(;++l<a;)c=o[l],u+=n(c);return u}var ad=(e,t,s,i,r,n)=>{const{content:o,path:a,created:l}=e,c=DM(l),u=LM(l),d=od(r),h=n!==void 0?n:i,p=_M(a),g=p!==a;let f="";if(g){const S=be(1,1)+be(od(p),4)+p;f="up"+be(S.length,2)+S}const m="\0"+(g?"\0\b":"\0\0")+be(t?8:0,2)+be(c,2)+be(u,2)+be(h?d:0,4)+be(n??i,4)+be(i,4)+be(p.length,2)+be(f.length,2),v="PK"+m+p+f,C="PK\0"+m+"\0\0\0\0\0\0"+(o?"\0\0\0\0":"\0\0\0")+be(s,4)+p+f;return{localFileHeader:Uint8Array.from(v,S=>S.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(C,S=>S.charCodeAt(0))}},ld=e=>{let t;if(typeof e=="string"){const s=atob(e.split(";base64,")[1]);t=Uint8Array.from(s,i=>i.charCodeAt(0))}else t=e;return{size:t.length,content:t}},GM=async e=>{const{content:t}=e,{size:s,content:i}=t?ld(t):{size:0,content:Uint8Array.from([])};let r,n,o=!1;if(e.type==="file"&&i&&s>0){const l=await EM(i);r=l.content,n=l.size,o=!0}return{rawContent:i,rawSize:s,deflatedContent:r,deflatedSize:n,isCompressed:o}},OM=(e,t)=>{const{content:s}=e,{content:i}=s?ld(s):{content:Uint8Array.from([])};return{...ad(e,!1,t,i.length,i,void 0),content:i,isCompressed:!1}},NM=(e,t,s)=>{const i="PK\0\0\0\0"+be(e,2)+be(e,2)+be(t,4)+be(s,4)+"\0\0";return Uint8Array.from(i,r=>r.charCodeAt(0))},cd=class{constructor(){this.folders=[],this.files=[]}addFolders(e){e.forEach(this.addFolder.bind(this))}addFolder(e){this.folders.push({path:e,created:new Date,isBase64:!1,type:"folder"})}addFile(e,t,s=!1){this.files.push({path:e,created:new Date,content:s?t:new TextEncoder().encode(t),isBase64:s,type:"file"})}async getZipFile(e="application/zip"){const t=await this.buildCompressedFileStream();return this.clearStream(),new Blob([t],{type:e})}getUncompressedZipFile(e="application/zip"){const t=this.buildFileStream();return this.clearStream(),new Blob([t],{type:e})}clearStream(){this.folders=[],this.files=[]}packageFiles(e){let t=0,s=0;for(const c of e){const{localFileHeader:u,centralDirectoryHeader:d,content:h}=c;t+=u.length+h.length,s+=d.length}const i=new Uint8Array(t),r=new Uint8Array(s);let n=0,o=0;for(const c of e){const{localFileHeader:u,centralDirectoryHeader:d,content:h}=c;i.set(u,n),n+=u.length,i.set(h,n),n+=h.length,r.set(d,o),o+=d.length}const a=NM(e.length,s,t),l=new Uint8Array(i.length+r.length+a.length);return l.set(i),l.set(r,i.length),l.set(a,i.length+r.length),l}async buildCompressedFileStream(){const e=[...this.folders,...this.files],t=await Promise.all(e.map(GM)),s=[];let i=0;for(let r=0;r<e.length;r++){const n=e[r],{rawContent:o,rawSize:a,deflatedContent:l,deflatedSize:c,isCompressed:u}=t[r],d=ad(n,u,i,a,o,c),h=l??o;s.push({...d,content:h,isCompressed:u}),i+=d.localFileHeader.length+h.length}return this.packageFiles(s)}buildFileStream(){const e=[...this.folders,...this.files],t=[];let s=0;for(const i of e){const r=OM(i,s),{localFileHeader:n,content:o}=r;t.push(r),s+=n.length+o.length}return this.packageFiles(t)}},BM=e=>{if(e.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),(Ke.size||Ve.size||Be.size||je.size)&&e.addFolders(["xl/worksheets/_rels"]),(Ke.size||Be.size||je.size)&&e.addFolders(["xl/drawings/"]),(Ke.size||Be.size)&&e.addFolders(["xl/drawings/_rels"]),Ve.size&&e.addFolders(["xl/tables/"]),!Ke.size)return;e.addFolders(["xl/media/"]);let t=0;Ke.forEach(s=>{const i=s[0].image[0],{base64:r,imageType:n}=i;e.addFile(`xl/media/image${++t}.${Ar(n)}`,r,!0)})},VM=(e,t,s,i)=>{let r=0,n=0,o=0;for(let a=0;a<t.length;a++){const l=t[a];e.addFile(`xl/worksheets/sheet${a+1}.xml`,l,!1);const c=Ke.size>0&&Et.has(a),u=Ve.size>0&&Ve.get(a),d=Ke.size&&Be.has(a),h=!!je.get(a)?.length;if(!c&&!u&&!d&&!h)continue;let p,g,f,m,v;c&&(HM(e,a,r),g=r,r++),h&&(UM(e,a,n,o,s,i),v=n,f=o,n++,o++),d&&(zM(e,a,o),m=o,o++),u&&(p=u.name);const C=`xl/worksheets/_rels/sheet${a+1}.xml.rels`;e.addFile(C,wM({tableName:p,drawingIndex:g,noteVmlDrawingIndex:f,headerFooterVmlDrawingIndex:m,commentsIndex:v}))}},HM=(e,t,s)=>{const i="xl/drawings",r=`${i}/drawing${s+1}.xml`,n=`${i}/_rels/drawing${s+1}.xml.rels`;e.addFile(n,CM(t)),e.addFile(r,mM(t))},UM=(e,t,s,i,r,n)=>{const o="xl/drawings";e.addFile(`xl/comments${s+1}.xml`,vM(t,r,n)),e.addFile(`${o}/vmlDrawing${i+1}.vml`,bM(t))},zM=(e,t,s)=>{const i="xl/drawings",r=`${i}/vmlDrawing${s+1}.vml`,n=`${i}/_rels/vmlDrawing${s+1}.vml.rels`;e.addFile(r,SM(t)),e.addFile(n,yM(t))},WM=e=>{const t=Ve,s=Array.from(t.keys());for(let i=0;i<s.length;i++){const r=s[i],n=t.get(r);n&&e.addFile(`xl/tables/${n.name}.xml`,gM(n,i))}},$M=(e,t,s,i,r,n)=>{const o=!!n&&Object.keys(n).some(a=>n[a]!=null);e.addFile("xl/workbook.xml",oM(r)),e.addFile("xl/styles.xml",aM(t)),e.addFile("xl/sharedStrings.xml",lM()),e.addFile("xl/theme/theme1.xml",pM()),e.addFile("xl/_rels/workbook.xml.rels",fM(i)),e.addFile("docProps/core.xml",cM(s)),o&&e.addFile("docProps/custom.xml",uM(n)),e.addFile("[Content_Types].xml",dM(i,o)),e.addFile("_rels/.rels",hM(o))},ud=(e,t,s={},i,r)=>{if(!t||t.length===0)return r?LT(r,159):kT(159),i.reset(),!1;i.syncOrderWithSheetData(t);const{fontSize:n=11,author:o="AG Grid",activeTab:a=0,customMetadata:l,suppressPrependAuthorToNotes:c}=s,u=t.length,d=ET(a,0,u-1);return BM(e),WM(e),VM(e,t,o,c),$M(e,n,o,u,d,l),i.reset(),!0},Wo=(e,t=new Er,s)=>{const{data:i,fontSize:r,author:n,activeSheetIndex:o,customMetadata:a,suppressPrependAuthorToNotes:l}=e,c=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",u=new cd;return ud(u,i,{author:n,fontSize:r,activeTab:o,customMetadata:a,suppressPrependAuthorToNotes:l},t,s)?u.getZipFile(c):Promise.resolve(void 0)},$o=(e,t=new Er,s)=>{const{data:i,fontSize:r,author:n,activeSheetIndex:o,customMetadata:a,suppressPrependAuthorToNotes:l}=e,c=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",u=new cd;if(ud(u,i,{author:n,fontSize:r,activeTab:o,customMetadata:a,suppressPrependAuthorToNotes:l},t,s))return u.getUncompressedZipFile(c)},KM=e=>{const{fileName:t="export.xlsx"}=e,s=new Er;Wo(e,s).then(i=>{if(i){const r=typeof t=="function"?t():t;_o(r,i)}})},jM=class extends Oy{constructor(){super(...arguments),this.beanName="excelCreator",this.workbook=new Er}getMergedParams(e){const t=this.gos.get("defaultExcelExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){this.warn(160);return}this.runExport(()=>{const t=this.getMergedParams(e),s=this.getData(t),{fontSize:i,author:r,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a}=t,l={data:[s],fontSize:i,author:r,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a};this.packageCompressedFile(l).then(c=>{c&&_o(this.resolveFileName(t),c)})})}exportDataAsExcel(e){this.export(e)}getDataAsExcel(e){const t=this.getMergedParams(e),s=this.getData(t),{fontSize:i,author:r,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a}=t,l={data:[s],fontSize:i,author:r,mimeType:n,customMetadata:o,suppressPrependAuthorToNotes:a};return this.packageFile(l)}setFactoryMode(e){this.workbook.setFactoryMode(e)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel(e){const t=this.getMergedParams(e);return this.getData(t)}getMultipleSheetsAsExcel(e){return $o(e,this.workbook,this.beans.context.getId())}exportMultipleSheetsAsExcel(e){Wo(e,this.workbook,this.beans.context.getId()).then(t=>{const{fileName:s="export.xlsx"}=e;if(t){const i=typeof s=="function"?s():s;_o(i,t)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession(e){const{colModel:t,colNames:s,rowGroupColsSvc:i,valueSvc:r,formula:n,gos:o,notesSvc:a,log:l}=this.beans,c=o.get("excelStyles")||[],u=this.createStyleLinker(c),d={...e,colModel:t,colNames:s,rowGroupColsSvc:i,valueSvc:r,formulaSvc:n,gos:o,log:l,suppressRowOutline:e.suppressRowOutline||e.skipRowGroups,headerRowHeight:e.headerRowHeight||e.rowHeight,baseExcelStyles:c,rightToLeft:e.rightToLeft??o.get("enableRtl"),styleLinker:u,notesSvc:a,pivotModeActive:t.isPivotActive(),workbook:this.workbook};return new qT(d)}createStyleLinker(e){const t=[],s=new Set,i=new Map;e.forEach((o,a)=>{t.push(o.id),s.add(o.id),i.set(o.id,a)});const{gos:r,cellStyles:n}=this.beans;return o=>{const{rowType:a,rowIndex:l,value:c,column:u,columnGroup:d,node:h}=o,p=a==="HEADER",g=a==="HEADER_GROUPING",f=p?u:d;let m=[];if(p||g)return m.push("header"),g&&m.push("headerGroup"),f&&(m=m.concat(DT(f.getDefinition(),this.beans,u||null,d||null))),m;const v=["cell"];if(!t.length)return v;const C=u.getDefinition();return n?.processAllCellClasses(C,IT(r,{value:c,data:h.data,node:h,colDef:C,column:u,rowIndex:l}),S=>{s.has(S)&&v.push(S)}),v.sort((S,w)=>{const b=i.get(S)??-1,y=i.get(w)??-1;return b===y?0:b<y?-1:1})}}isExportSuppressed(){return this.gos.get("suppressExcelExport")}packageCompressedFile(e){return Wo(e,this.workbook,this.beans.context.getId())}packageFile(e){return $o(e,this.workbook,this.beans.context.getId())}};import{AgTabGuardComp as YM,RefPlaceholder as qM,_createAgElement as XM,_getAriaPosInSet as ZM,_observeResize as JM,_requestAnimationFrame as dd,_setAriaLabel as QM,_setAriaPosInSet as eI,_setAriaRole as tI,_setAriaSetSize as sI,_waitUntil as iI}from"ag-stack";import{KeyCode as Ye}from"ag-grid-community";var rI=":where(.ag-virtual-list-viewport) .ag-tab-guard{position:sticky}.ag-virtual-list-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:auto;position:relative;width:100%}.ag-virtual-list-container{overflow:var(--ag-internal-virtual-list-overflow,hidden);position:relative}.ag-virtual-list-item{height:var(--ag-list-item-height);position:absolute;width:100%}:where(.ag-virtual-list-grow-to-content) .ag-virtual-list-item{min-width:100%;width:-moz-max-content;width:max-content}";function nI(e){return{tag:"div",cls:`ag-virtual-list-viewport ag-${e}-virtual-list-viewport`,role:"presentation",children:[{tag:"div",ref:"eContainer",cls:`ag-virtual-list-container ag-${e}-virtual-list-container`}]}}var hd=class extends Ny{constructor(e,t){super(nI(t?.cssIdentifier||"default")),this.stopPropagationCallbacks=e,this.renderedRows=new Map,this.rowHeight=20,this.pageSize=-1,this.isScrolling=!1,this.isHeightFromTheme=!0,this.eContainer=qM,this.awaitStableCallbacks=[],this.registerCSS(rI);const{cssIdentifier:s="default",ariaRole:i="listbox",listName:r,moveItemCallback:n}=t||{};this.cssIdentifier=s,this.ariaRole=i,this.listName=r,this.moveItemCallback=n}postConstruct(){this.addScrollListener(),this.rowHeight=this.getItemHeight(),this.addResizeObserver(),this.initialiseTabGuard({onFocusIn:e=>this.onFocusIn(e),onFocusOut:e=>this.onFocusOut(e),focusInnerElement:e=>this.focusInnerElement(e),onTabKeyDown:e=>this.onTabKeyDown(e),handleKeyDown:e=>this.handleKeyDown(e)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged(e){e.listItemHeightChanged&&(this.rowHeight=this.getItemHeight(),this.refresh())}refreshAriaProperties(){const t=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),s=this.eContainer;tI(s,this.model?.getRowCount()>0?this.ariaRole:"presentation"),QM(s,t)}addResizeObserver(){const e=()=>dd(this.beans,()=>this.drawVirtualRows()),t=JM(this.beans,this.getGui(),e);this.addDestroyFunc(t)}focusInnerElement(e){return this.focusRow(e?this.model.getRowCount()-1:0),!0}onFocusIn(e){const t=e.target;t.classList.contains("ag-virtual-list-item")&&(this.lastFocusedRowIndex=ZM(t)-1)}onFocusOut(e){this.getFocusableElement().contains(e.relatedTarget)||(this.lastFocusedRowIndex=null)}handleKeyDown(e){const{key:t,shiftKey:s}=e;switch(t){case Ye.UP:case Ye.DOWN:{const i=t===Ye.UP;e.preventDefault(),s?this.moveItem(i):this.navigate(i)}break;case Ye.PAGE_HOME:case Ye.PAGE_END:case Ye.PAGE_UP:case Ye.PAGE_DOWN:this.navigateToPage(t)!==null&&e.preventDefault();break}}onTabKeyDown(e){this.stopPropagationCallbacks?.stopPropagation(e),this.forceFocusOutOfContainer(e.shiftKey)}getNextRow(e){if(this.lastFocusedRowIndex==null)return;const t=this.lastFocusedRowIndex+(e?-1:1);if(!(t<0||t>=this.model.getRowCount()))return t}moveItem(e){if(!this.moveItemCallback)return;const t=this.getComponentAt(this.lastFocusedRowIndex);t&&this.moveItemCallback(t,e)}navigate(e){const t=this.getNextRow(e);t!==void 0&&this.focusRow(t)}navigateToPage(e,t="focused"){let s=!1;t==="focused"&&(t=this.getLastFocusedRow(),s=!0);const i=this.model.getRowCount()-1;let r=-1;return e===Ye.PAGE_HOME?r=0:e===Ye.PAGE_END?r=i:e===Ye.PAGE_DOWN?r=Math.min(t+this.pageSize,i):e===Ye.PAGE_UP&&(r=Math.max(t-this.pageSize,0)),r===-1?null:(s?this.focusRow(r):this.ensureIndexVisible(r),r)}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow(e){this.isScrolling||(this.isScrolling=!0,this.ensureIndexVisible(e),dd(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;const t=this.renderedRows.get(e);t&&t.eDiv.focus()}))}getComponentAt(e){return this.renderedRows.get(e)?.rowComponent}forEachRenderedRow(e){this.renderedRows.forEach((t,s)=>e(t.rowComponent,s))}getItemHeight(){return this.isHeightFromTheme?this.beans.environment.getDefaultListItemHeight():this.rowHeight}ensureIndexVisible(e,t=!0){const s=this.model.getRowCount();if(typeof e!="number"||e<0||e>=s)return!1;const i=e*this.rowHeight,r=i+this.rowHeight,n=this.getGui(),o=n.scrollTop,a=n.offsetHeight,l=o+a,c=t?0:this.rowHeight,u=o>i+c,d=l<r-c;if(u)return n.scrollTop=i,!0;if(d){const h=r-a;return n.scrollTop=h,!0}return!1}setComponentCreator(e){this.componentCreator=e}setComponentUpdater(e){this.componentUpdater=e}getRowHeight(){return this.rowHeight}getScrollTop(){return this.getGui().scrollTop}setRowHeight(e){this.isHeightFromTheme=!1,this.rowHeight=e,this.refresh()}refresh(e){if(this.model==null||!this.isAlive())return;const t=this.model.getRowCount();this.eContainer.style.height=`${t*this.rowHeight}px`,this.refreshAriaProperties(),this.awaitStable(()=>{this.isAlive()&&(this.canSoftRefresh(e)?this.drawVirtualRows(!0):(this.clearVirtualRows(),this.drawVirtualRows()))})}awaitStable(e){if(this.awaitStableCallbacks.push(e),this.awaitStableCallbacks.length>1)return;const t=this.model.getRowCount();iI(this,()=>this.eContainer.clientHeight>=t*this.rowHeight,()=>{if(!this.isAlive())return;const s=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(const i of s)i()})}canSoftRefresh(e){return!!(e&&this.renderedRows.size&&typeof this.model.areRowsEqual=="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach((e,t)=>this.removeRow(t))}drawVirtualRows(e){if(!this.isAlive()||!this.model)return;const t=this.getGui(),s=t.scrollTop,i=s+t.offsetHeight;if(s===i)this.clearVirtualRows();else{const r=Math.floor(s/this.rowHeight),n=Math.floor(i/this.rowHeight);this.pageSize=Math.floor((i-s)/this.rowHeight),this.ensureRowsRendered(r,n,e)}}ensureRowsRendered(e,t,s){this.renderedRows.forEach((i,r)=>{(r<e||r>t)&&r!==this.lastFocusedRowIndex&&this.removeRow(r)}),s&&this.refreshRows();for(let i=e;i<=t;i++)this.renderedRows.has(i)||i<this.model.getRowCount()&&this.insertRow(i)}insertRow(e){const{model:t}=this;if(e<0||e>=t.getRowCount())return;const{cssIdentifier:s,ariaRole:i,renderedRows:r,eContainer:n}=this,o=t.getRow(e),a=i==="tree"?"treeitem":"option",l=XM({tag:"div",cls:`ag-virtual-list-item ag-${s}-virtual-list-item`,role:a,attrs:{tabindex:"-1"}});sI(l,t.getRowCount()),eI(l,e+1);const c=this.rowHeight;l.style.height=`${c}px`,l.style.top=`${c*e}px`;const u=this.componentCreator(o,l,e);u.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=e),l.appendChild(u.getGui()),r.has(e-1)?r.get(e-1).eDiv.insertAdjacentElement("afterend",l):r.has(e+1)?r.get(e+1).eDiv.insertAdjacentElement("beforebegin",l):n.appendChild(l),r.set(e,{rowComponent:u,eDiv:l,value:o})}removeRow(e){const t=this.renderedRows.get(e);t.eDiv.remove(),this.destroyBean(t.rowComponent),this.renderedRows.delete(e)}refreshRows(){const e=this.model.getRowCount();this.renderedRows.forEach((t,s)=>{if(s>=e)this.removeRow(s);else{const i=this.model.getRow(s);this.model.areRowsEqual?.(t.value,i)?this.componentUpdater(i,t.rowComponent):this.removeRow(s)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel(e){this.model=e}getAriaElement(){return this.eContainer}destroy(){this.isAlive()&&(this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy())}};import{AgBeanStub as oI,AutoScrollService as aI,_radioCssClass as pd}from"ag-stack";var lI='.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}',Ko="ag-list-item-hovered",gd=class extends By{constructor(e,t,s){super(),this.comp=e,this.virtualList=t,this.params=s,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(lI,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart(e){this.currentDragValue=this.params.getCurrentDragValue(e),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){const e={isInterestedIn:t=>t===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:t=>this.onDragging(t),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget(e)}createAutoScrollService(){const e=this.virtualList.getGui();this.autoScrollService=new aI({scrollContainer:e,scrollAxis:"y",getVerticalPosition:()=>e.scrollTop,setVerticalPosition:t=>e.scrollTop=t})}onDragging(e){if(!this.currentDragValue||this.moveBlocked)return;const t=this.getListDragItem(e),s=this.virtualList.getComponentAt(t.rowIndex);if(!s)return;const i=s.getGui().parentElement;this.lastHoveredListItem?.rowIndex===t.rowIndex&&this.lastHoveredListItem.position===t.position||(this.autoScrollService.check(e.event),this.clearHoveredItems(),this.lastHoveredListItem=t,pd(i,Ko),pd(i,`ag-item-highlight-${t.position}`))}getListDragItem(e){const t=this.virtualList.getGui(),s=Number.parseFloat(window.getComputedStyle(t).paddingTop),i=this.virtualList.getRowHeight(),r=this.virtualList.getScrollTop(),n=Math.max(0,(e.y-s+r)/i),o=this.params.getNumRows(this.comp)-1,a=Math.min(o,n)|0;return{rowIndex:a,position:Math.round(n)>n||n>o?"bottom":"top",component:this.virtualList.getComponentAt(a)}}onDragStop(){this.moveBlocked||(this.params.moveItem(this.currentDragValue,this.lastHoveredListItem),this.clearDragProperties())}onDragCancel(){this.clearDragProperties()}onDragLeave(){this.clearDragProperties()}clearDragProperties(){this.clearHoveredItems(),this.autoScrollService.ensureCleared()}clearHoveredItems(){const e=this.virtualList.getGui();for(const t of e.querySelectorAll(`.${Ko}`))for(const s of[Ko,"ag-item-highlight-top","ag-item-highlight-bottom"])t.classList.remove(s);this.lastHoveredListItem=null}};import{RefPlaceholder as jo}from"ag-stack";import{AgAbstractLabel as cI,AgInputNumberFieldSelector as uI}from"ag-grid-community";import{AgAbstractInputField as dI}from"ag-grid-community";var fd=class extends Vy{constructor(e){super(e,"ag-range-field","range")}postConstruct(){super.postConstruct();const{min:e,max:t,step:s}=this.config;e!=null&&this.setMinValue(e),t!=null&&this.setMaxValue(t),this.setStep(s||1)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:e=>{const t=e.target.value;this.setValue(t)}})}setMinValue(e){return this.min=e,this.eInput.setAttribute("min",e.toString()),this}setMaxValue(e){return this.max=e,this.eInput.setAttribute("max",e.toString()),this}setStep(e){return this.eInput.setAttribute("step",e.toString()),this}setValue(e,t){this.min!=null&&(e=Math.max(parseFloat(e),this.min).toString()),this.max!=null&&(e=Math.min(parseFloat(e),this.max).toString());const s=super.setValue(e,t);return this.eInput.value=e,s}},md={selector:"AG-INPUT-RANGE",component:fd},hI=".ag-slider-wrapper{display:flex;:where(.ag-input-field){flex:1 1 auto}}:where(.ag-ltr) .ag-slider-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-slider-field{margin-left:calc(var(--ag-spacing)*2)}",ye=class extends Hy{constructor(e){super(e,`<div class="ag-slider">
<label data-ref="eLabel"></label>
<div class="ag-wrapper ag-slider-wrapper">
<ag-input-range data-ref="eSlider"></ag-input-range>
<ag-input-number-field data-ref="eText"></ag-input-number-field>
</div>
</div>`,[md,uI]),this.eLabel=jo,this.eSlider=jo,this.eText=jo,this.labelAlignment="top",this.registerCSS(hI)}postConstruct(){super.postConstruct(),this.eSlider.addCss("ag-slider-field");const{minValue:e,maxValue:t,textFieldWidth:s,step:i,value:r,onValueChange:n}=this.config;e!=null&&this.setMinValue(e),t!=null&&this.setMaxValue(t),s!=null&&this.setTextFieldWidth(s),i!=null&&this.setStep(i),r!=null&&this.setValue(r),n!=null&&this.onValueChange(n)}onValueChange(e){return this.addManagedListeners(this.eText,{fieldValueChanged:()=>{const t=parseFloat(this.eText.getValue());this.eSlider.setValue(t.toString(),!0),e(t||0)}}),this.addManagedListeners(this.eSlider,{fieldValueChanged:()=>{const t=this.eSlider.getValue();this.eText.setValue(t,!0),e(parseFloat(t))}}),this}setSliderWidth(e){return this.eSlider.setWidth(e),this}setTextFieldWidth(e){return this.eText.setWidth(e),this}setMinValue(e){return this.eSlider.setMinValue(e),this.eText.setMin(e),this}setMaxValue(e){return this.eSlider.setMaxValue(e),this.eText.setMax(e),this}getValue(){return this.eText.getValue()}setValue(e,t){return this.getValue()===e?this:(this.eText.setValue(e,!0),this.eSlider.setValue(e,!0),t||this.dispatchLocalEvent({type:"fieldValueChanged"}),this)}setStep(e){return this.eSlider.setStep(e),this.eText.setStep(e),this}},Te={selector:"AG-SLIDER",component:ye};import{AgPickerField as pI,_createElement as vd}from"ag-grid-community";import{AgComponentStub as gI,RefPlaceholder as bt,_exists as fI,_setDisplayed as mI}from"ag-stack";import{KeyCode as yt}from"ag-grid-community";import{RefPlaceholder as vI}from"ag-stack";import{AgInputTextField as CI}from"ag-grid-community";var SI=class extends Uy{constructor(){super({template:{tag:"div",cls:"ag-color-input",role:"presentation",children:[{tag:"div",ref:"eLabel",cls:"ag-input-field-label"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-input-wrapper",role:"presentation",children:[{tag:"input",ref:"eInput",cls:"ag-input-field-input"},{tag:"div",ref:"eColor",cls:"ag-color-input-color"}]}]}}),this.eColor=vI}wireBeans(e){this.color=e.agChartsExports._Util.Color}setColor(e){const t=e.toRgbaString();this.setValue(this.color.fromString(t).toHexString().toUpperCase(),!0),this.eColor.style.backgroundColor=t}setValue(e,t){const s=this.color.validColorString(e??"");return this.eInput.setCustomValidity(s?"":this.getLocaleTextFunc()("invalidColor","Color value is invalid")),super.setValue(e,t),s&&!t&&this.dispatchLocalEvent({type:"colorChanged"}),this}onColorChanged(e){this.addManagedListeners(this,{colorChanged:()=>e(this.color.fromString(this.value))})}},bI={selector:"AG-COLOR-INPUT",component:SI},Cd=8,Dr=[],yI=class extends zy{constructor(e){super(`<div class="ag-color-panel" tabindex="-1">
<div data-ref="spectrumColor" class="ag-spectrum-color">
<div class="ag-spectrum-sat ag-spectrum-fill">
<div data-ref="spectrumVal" class="ag-spectrum-val ag-spectrum-fill">
<div data-ref="spectrumDragger" class="ag-spectrum-dragger"></div>
</div>
</div>
</div>
<div class="ag-spectrum-tools">
<div data-ref="spectrumHue" class="ag-spectrum-hue ag-spectrum-tool">
<div class="ag-spectrum-hue-background"></div>
<div data-ref="spectrumHueSlider" class="ag-spectrum-slider"></div>
</div>
<div data-ref="spectrumAlpha" class="ag-spectrum-alpha ag-spectrum-tool">
<div class="ag-spectrum-alpha-background"></div>
<div data-ref="spectrumAlphaSlider" class="ag-spectrum-slider"></div>
</div>
<ag-color-input data-ref="colorInput"></ag-color-input>
<div data-ref="recentColors" class="ag-recent-colors"></div>
</div>
</div>`,[bI]),this.H=1,this.S=1,this.B=1,this.A=1,this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1,this.colorChanged=!1,this.spectrumColor=bt,this.spectrumVal=bt,this.spectrumDragger=bt,this.spectrumHue=bt,this.spectrumHueSlider=bt,this.spectrumAlpha=bt,this.spectrumAlphaSlider=bt,this.colorInput=bt,this.recentColors=bt,this.picker=e.picker}wireBeans(e){this._Color=e.agChartsExports._Util.Color}postConstruct(){this.initTabIndex(),this.initRecentColors(),this.addGuiEventListener("focus",()=>this.spectrumColor.focus()),this.addGuiEventListener("keydown",e=>{e.key===yt.ENTER&&!e.defaultPrevented&&this.destroy()}),this.addManagedListeners(this.spectrumColor,{keydown:e=>this.moveDragger(e)}),this.addManagedListeners(this.spectrumAlphaSlider,{keydown:e=>this.moveAlphaSlider(e)}),this.addManagedListeners(this.spectrumHueSlider,{keydown:e=>this.moveHueSlider(e)}),this.addManagedListeners(this.spectrumVal,{mousedown:this.onSpectrumDraggerDown.bind(this)}),this.addManagedListeners(this.spectrumHue,{mousedown:this.onSpectrumHueDown.bind(this)}),this.addManagedListeners(this.spectrumAlpha,{mousedown:this.onSpectrumAlphaDown.bind(this)}),this.addGuiEventListener("mousemove",e=>{this.onSpectrumDraggerMove(e),this.onSpectrumHueMove(e),this.onSpectrumAlphaMove(e)}),this.addManagedListeners(document,{mouseup:this.onMouseUp.bind(this)}),this.colorInput.onColorChanged(this.setColor.bind(this)),this.addManagedListeners(this.recentColors,{click:this.onRecentColorClick.bind(this),keydown:e=>{(e.key===yt.ENTER||e.key===yt.SPACE)&&(e.preventDefault(),this.onRecentColorClick(e))}})}initTabIndex(){const e=this.tabIndex=this.gos.get("tabIndex").toString();this.spectrumColor.setAttribute("tabindex",e),this.spectrumHueSlider.setAttribute("tabindex",e),this.spectrumAlphaSlider.setAttribute("tabindex",e)}refreshSpectrumRect(){return this.spectrumValRect=this.spectrumVal.getBoundingClientRect()}refreshHueRect(){return this.spectrumHueRect=this.spectrumHue.getBoundingClientRect()}refreshAlphaRect(){return this.spectrumAlphaRect=this.spectrumAlpha.getBoundingClientRect()}onSpectrumDraggerDown(e){e.preventDefault(),this.refreshSpectrumRect(),this.isSpectrumDragging=!0,this.moveDragger(e)}onSpectrumDraggerMove(e){this.isSpectrumDragging&&this.moveDragger(e)}onSpectrumHueDown(e){this.refreshHueRect(),this.isSpectrumHueDragging=!0,this.moveHueSlider(e)}onSpectrumHueMove(e){this.isSpectrumHueDragging&&this.moveHueSlider(e)}onSpectrumAlphaDown(e){this.refreshAlphaRect(),this.isSpectrumAlphaDragging=!0,this.moveAlphaSlider(e)}onSpectrumAlphaMove(e){this.isSpectrumAlphaDragging&&this.moveAlphaSlider(e)}onMouseUp(){this.isSpectrumDragging=!1,this.isSpectrumHueDragging=!1,this.isSpectrumAlphaDragging=!1}moveDragger(e){const t=this.spectrumValRect;if(!t)return;let s,i;if(e instanceof MouseEvent)s=e.clientX-t.left,i=e.clientY-t.top;else{const r=e.key===yt.LEFT,n=e.key===yt.RIGHT,o=e.key===yt.UP,a=e.key===yt.DOWN,l=o||a,c=r||n;if(!l&&!c)return;e.preventDefault();const{x:u,y:d}=this.getSpectrumValue();s=u+(c?r?-5:5:0),i=d+(l?o?-5:5:0)}s=Math.max(s,0),s=Math.min(s,t.width),i=Math.max(i,0),i=Math.min(i,t.height),this.setSpectrumValue(s/t.width,1-i/t.height)}moveHueSlider(e){const t=this.spectrumHueRect;if(!t)return;const s=this.moveSlider(this.spectrumHueSlider,e);s!=null&&(this.H=1-s/t.width,this.update())}moveAlphaSlider(e){const t=this.spectrumAlphaRect;if(!t)return;const s=this.moveSlider(this.spectrumAlphaSlider,e);s!=null&&(this.A=s/t.width,this.update())}moveSlider(e,t){const s=e.getBoundingClientRect(),i=e.parentElement?.getBoundingClientRect();if(!e||!i)return null;const r=s.width/2;let n;if(t instanceof MouseEvent)n=Math.floor(t.clientX-i.left);else{const o=t.key===yt.LEFT,a=t.key===yt.RIGHT;if(!o&&!a)return null;t.preventDefault();const l=o?-5:5;n=parseFloat(e.style.left)+r+l}return n=Math.max(n,0),n=Math.min(n,i.width),e.style.left=n-r+"px",n}update(e){const{A:t,S:s,B:i,H:r,_Color:n}=this,o=r*360,a=n.fromHSB(o,s,i,t),l=a.toRgbaString(),u=n.fromHSB(o,s,i).toRgbaString(),h=n.fromHSB(o,1,1).toRgbaString(),p=this.picker;n.fromString(p.getValue()).toRgbaString()!==l&&(this.colorChanged=!0),p.setValue(l),this.spectrumColor.style.backgroundColor=h,this.spectrumDragger.style.backgroundColor=u,this.spectrumHueSlider.style.backgroundColor=h,this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-from",n.fromHSB(o,s,i,0).toRgbaString()),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-to",u),this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color",l),e||this.colorInput.setColor(a)}setSpectrumValue(e,t,s){const i=this.spectrumValRect||this.refreshSpectrumRect();if(i==null)return;const r=this.spectrumDragger,n=r.getBoundingClientRect();e=Math.max(0,e),e=Math.min(1,e),t=Math.max(0,t),t=Math.min(1,t),this.S=e,this.B=t,r.style.left=e*i.width-n.width/2+"px",r.style.top=(1-t)*i.height-n.height/2+"px",this.update(s)}getSpectrumValue(){const e=this.spectrumDragger,t=e.getBoundingClientRect(),s=parseFloat(e.style.left)+t.width/2,i=parseFloat(e.style.top)+t.height/2;return{x:s,y:i}}initRecentColors(){const e=Dr,t=e.map((s,i)=>`<div class="ag-recent-color" id=${i} style="background-color: ${s}; width: 15px; height: 15px;" recent-color="${s}" tabIndex="${this.tabIndex}"></div>`);this.recentColors.innerHTML=t.join(""),mI(this.recentColors,!!e.length)}setValue(e){const t=this._Color.fromString(e);this.setColor(t,!0)}setColor(e,t){const[s,i,r]=e.toHSB();this.H=(isNaN(s)?0:s)/360,this.A=e.a;const n=this.spectrumHueRect||this.refreshHueRect(),o=this.spectrumAlphaRect||this.refreshAlphaRect();this.spectrumHueSlider.style.left=`${(this.H-1)*-n.width-this.spectrumHueSlider.getBoundingClientRect().width/2}px`,this.spectrumAlphaSlider.style.left=`${this.A*o.width-this.spectrumAlphaSlider.getBoundingClientRect().width/2}px`,this.setSpectrumValue(i,r,!t)}onRecentColorClick(e){const t=e.target;if(!fI(t.id))return;const s=parseInt(t.id,10);this.setValue(Dr[s]),this.destroy()}addRecentColor(){const t=this._Color.fromHSB(this.H*360,this.S,this.B,this.A).toRgbaString();let s=Dr;!this.colorChanged||s[0]===t||(s=s.filter(i=>i!=t),s=[t].concat(s),s.length>Cd&&(s=s.slice(0,Cd)),Dr=s)}destroy(){this.addRecentColor(),super.destroy()}},wI=`.ag-color-panel{display:flex;flex-direction:column;padding:var(--ag-spacing);text-align:center;width:100%}.ag-spectrum-color{cursor:default;flex:1 1 auto;overflow:visible;position:relative}.ag-spectrum-color,.ag-spectrum-fill{border-radius:var(--ag-border-radius)}.ag-spectrum-fill{inset:0;position:absolute}.ag-spectrum-val{background-image:linear-gradient(0deg,#000,rgba(204,154,129,0));cursor:pointer}.ag-spectrum-dragger{background:#000;border:var(--ag-color-picker-thumb-border-width) solid #fff;border-radius:var(--ag-color-picker-thumb-size);box-shadow:0 0 2px 0 rgba(0,0,0,.24);cursor:pointer;height:var(--ag-color-picker-thumb-size);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}.ag-spectrum-alpha,.ag-spectrum-hue{cursor:default}.ag-spectrum-hue-background{background:linear-gradient(270deg,red 3%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);height:100%;width:100%}.ag-spectrum-alpha-background{background:linear-gradient(to right,var(--ag-internal-spectrum-alpha-color-from),var(--ag-internal-spectrum-alpha-color-to)),url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" width="4" height="4"><rect x="0" y="0" width="4" height="4" fill="%23fff"/><path d="M0 0H2V4H4V2H0Z" fill="%23b2b2b2"/></svg>') 0 0 /4px 4px;height:100%;width:100%}.ag-spectrum-tool{cursor:pointer;height:var(--ag-color-picker-track-size);margin-bottom:10px;position:relative}.ag-spectrum-slider,.ag-spectrum-tool{border-radius:var(--ag-color-picker-thumb-size)}.ag-spectrum-slider{border:var(--ag-color-picker-thumb-border-width) solid #fff;box-shadow:0 1px 4px 0 rgba(0,0,0,.37);height:var(--ag-color-picker-thumb-size);margin-top:calc(var(--ag-color-picker-track-size)/2*-1 + var(--ag-color-picker-thumb-size)/2*-1);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}:where(.ag-spectrum-alpha) .ag-spectrum-slider{background:linear-gradient(to bottom,var(--ag-internal-spectrum-alpha-color),var(--ag-internal-spectrum-alpha-color)) var(--ag-background-color)}.ag-recent-colors{display:flex;gap:6px;margin:10px var(--ag-spacing) 2px}.ag-recent-color{border:solid var(--ag-border-width) var(--ag-border-color);cursor:pointer}.ag-color-dialog{border-radius:5px}:where(.ag-color-picker){.ag-picker-field-wrapper{padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}.ag-picker-field-display{align-items:center;display:flex;flex-direction:row;min-height:var(--ag-list-item-height)}}:where(.ag-ltr) .ag-color-picker-color,:where(.ag-ltr) .ag-color-picker-value{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-color-picker-color,:where(.ag-rtl) .ag-color-picker-value{margin-left:var(--ag-spacing)}.ag-spectrum-tools{padding:10px 0 0}.ag-spectrum-alpha-background,.ag-spectrum-hue-background{border-radius:var(--ag-color-picker-track-border-radius)}.ag-color-input-color,.ag-color-picker-color,.ag-recent-color{border-radius:var(--ag-color-picker-color-border-radius)}.ag-spectrum-sat{background-image:linear-gradient(90deg,#fff,rgba(204,154,129,0))}.ag-recent-color,.ag-spectrum-color,.ag-spectrum-slider{&:where(:not(:disabled,[readonly])):focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-color-input-color,.ag-color-picker-color{border:solid var(--ag-border-width) var(--ag-border-color);height:var(--ag-icon-size);width:var(--ag-icon-size)}:where(.ag-ltr) .ag-color-input .ag-input-field-input{padding-left:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-rtl) .ag-color-input .ag-input-field-input{padding-right:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-color-input) .ag-color-input-color{position:absolute}:where(.ag-ltr) :where(.ag-color-input) .ag-color-input-color{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-color-input) .ag-color-input-color{margin-right:var(--ag-spacing)}`;import{AgComponentStub as xI,AgTabGuardFeature as FI,_setDisplayed as Sd}from"ag-stack";import{AgComponentStub as bd,AgPositionableFeature as TI,RefPlaceholder as Lr,_getActiveDomElement as AI,_getInnerHeight as PI,_getInnerWidth as RI,_isVisible as MI,_setDisplayed as II}from"ag-stack";import{_clamp as EI}from"ag-grid-community";var DI=".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-family:var(--ag-panel-title-bar-font-family);font-size:var(--ag-panel-title-bar-font-size);font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-panel-title-bar-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*2);margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-left:var(--ag-spacing);margin-right:calc(var(--ag-spacing)*2)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}";function LI(e){return e??(e=e||"default"),{tag:"div",cls:`ag-panel ag-${e}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${e}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${e}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${e}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${e}-panel-content-wrapper`}]}}var Yo=class extends Wy{constructor(e){super(LI(e.cssIdentifier)),this.config=e,this.closable=!0,this.eContentWrapper=Lr,this.eTitleBar=Lr,this.eTitleBarButtons=Lr,this.eTitle=Lr,this.registerCSS(DI)}postConstruct(){const{component:e,closable:t,hideTitleBar:s,title:i,minWidth:r=250,width:n,minHeight:o=250,height:a,centered:l,popup:c,x:u,y:d,postProcessPopupParams:h}=this.config,p=this.beans,g=this.createManagedBean(new TI(this.getGui(),{minWidth:r,width:n,minHeight:o,height:a,centered:l,x:u,y:d,popup:c,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=g;const f=this.getGui();if(e&&this.setBodyComponent(e),s?II(this.eTitleBar,!1):(i&&this.setTitle(i),this.setClosable(t??this.closable)),this.addManagedElementListeners(this.eTitleBar,{mousedown:v=>{if(f.contains(v.relatedTarget)||f.contains(AI(p))||this.eTitleBarButtons.contains(v.target)){v.preventDefault();return}const C=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");C&&C.focus()}}),c&&g.isPositioned())return;this.renderComponent&&this.renderComponent();let m;if(h){const{type:v,eventSource:C,mouseEvent:S}=h;m=()=>p.popupSvc?.callPostProcessPopup(h,v,f,C,S)}g.initialisePosition(m),this.eContentWrapper.style.height="0"}renderComponent(){const e=this.getGui();e.focus(),this.close=()=>{e.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight(e){this.positionableFeature.setHeight(e)}getWidth(){return this.positionableFeature.getWidth()}get isResizing(){return this.positionableFeature.isResizing}setWidth(e){this.positionableFeature.setWidth(e)}setClosable(e){if(e!==this.closable&&(this.closable=e),e){const t=this.closeButtonComp=new bd({tag:"div",cls:"ag-button"});this.createBean(t);const s=t.getGui(),i=this.beans.iconSvc.createIconNoSpan("close",this.beans);i.classList.add("ag-panel-title-bar-button-icon"),s.appendChild(i),this.addTitleBarButton(t),t.addManagedElementListeners(s,{click:this.onBtClose.bind(this)})}else this.closeButtonComp&&(this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp))}setBodyComponent(e){e.setParentComponent(this),this.eContentWrapper.appendChild(e.getGui())}addTitleBarButton(e,t){const s=this.eTitleBarButtons,i=s.children,r=i.length;t==null&&(t=r),t=EI(t,0,r),e.addCss("ag-panel-title-bar-button");const n=e.getGui();t===0?s.prepend(n):t===r?s.append(n):i[t-1].after(n),e.setParentComponent(this)}getBodyHeight(){return PI(this.eContentWrapper)}getBodyWidth(){return RI(this.eContentWrapper)}setTitle(e){this.eTitle.innerText=e}onBtClose(){this.close()}destroy(){this.closeButtonComp&&(this.closeButtonComp=this.destroyBean(this.closeButtonComp));const e=this.getGui();e&&MI(e)&&this.close(),super.destroy()}},qo=class extends Yo{constructor(e,t){super({...e,popup:!0}),this.callbacks=t,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans(e){this.popupSvc=e.popupSvc}postConstruct(){const e=this.getGui(),{movable:t,resizable:s,maximizable:i,modal:r}=this.config;this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new FI(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront(e)},onGuardFocusedFromInside:r?void 0:n=>this.callbacks?.focusNextContainer(this.beans,!n),onTabKeyDown:()=>{}}),t&&this.setMovable(t),i&&this.setMaximizable(i),s&&this.setResizable(s),r||this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus(e){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(e)}renderComponent(){const e=this.getGui(),{alwaysOnTop:t,modal:s,title:i,afterGuiAttached:r}=this.config,n=this.getLocaleTextFunc(),o=this.popupSvc?.addPopup({modal:s,eChild:e,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:t,ariaLabel:i||n("ariaLabelDialog","Dialog"),afterGuiAttached:r});o&&(this.close=o.hideFunc)}onClosed(e){this.destroy(),this.config.closedCallback?.(e)}setMaximized(e){this.isMaximizable&&e!==this.isMaximized&&this.toggleMaximize()}toggleMaximize(){const e=this.positionableFeature.getPosition();if(this.isMaximized){const{x:t,y:s,width:i,height:r}=this.lastPosition;this.setWidth(i),this.setHeight(r),this.positionableFeature.offsetElement(t,s)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=e.x,this.lastPosition.y=e.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){Sd(this.maximizeIcon,!this.isMaximized),Sd(this.minimizeIcon,this.isMaximized)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(const e of this.maximizeListeners)e();this.maximizeListeners.length=0}this.resizeListenerDestroy&&(this.resizeListenerDestroy(),this.resizeListenerDestroy=null)}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable(e){this.positionableFeature.setResizable(e)}setMovable(e){this.positionableFeature.setMovable(e,this.eTitleBar)}setMaximizable(e){if(!e){this.clearMaximizebleListeners(),this.maximizeButtonComp&&(this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0);return}const t=this.eTitleBar;if(!t||e===this.isMaximizable)return;this.isMaximizable=e;const s=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),s.addManagedElementListeners(s.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(s,0),this.maximizeListeners.push(...this.addManagedElementListeners(t,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){const e=this.maximizeButtonComp=this.createBean(new xI({tag:"div",cls:"ag-dialog-button"})),t=e.getGui(),s=this.beans.iconSvc;return this.maximizeIcon=s.createIconNoSpan("maximize"),t.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=s.createIconNoSpan("minimize"),t.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),e}},Xo=class extends $y{constructor(e){super({pickerAriaLabelKey:"ariaLabelColorPicker",pickerAriaLabelValue:"Color Picker",pickerType:"ag-list",className:"ag-color-picker",pickerIcon:"chartsColorPicker",...e}),this.registerCSS(wI)}postConstruct(){this.eDisplayFieldColor=vd({tag:"span",cls:"ag-color-picker-color"}),this.eDisplayFieldText=vd({tag:"span",cls:"ag-color-picker-value"}),this.eDisplayField.append(this.eDisplayFieldColor,this.eDisplayFieldText),super.postConstruct(),this.value&&this.setValue(this.value)}createPickerComponent(){const e=this.eWrapper.getBoundingClientRect(),t=this.beans.popupSvc.getParentRect();return this.createBean(new qo({closable:!1,modal:!0,hideTitleBar:!0,minWidth:190,width:190,height:250,x:e.right-t.left-190,y:e.top-t.top-250-(this.config.pickerGap??0),postProcessPopupParams:{type:"colorPicker",eventSource:this.eWrapper}},this.config.dialogCallbacks))}renderAndPositionPicker(){const e=this.pickerComponent,t=this.createBean(new yI({picker:this}));return e.addCss("ag-color-dialog"),t.addDestroyFunc(()=>{e.isAlive()&&this.destroyBean(e)}),e.setParentComponent(this),e.setBodyComponent(t),t.setValue(this.getValue()),t.getGui().focus(),e.addDestroyFunc(()=>{this.isDestroyingPicker?this.isDestroyingPicker=!1:(this.beforeHidePicker(),this.isDestroyingPicker=!0,t.isAlive()&&this.destroyBean(t),this.isAlive()&&this.getFocusableElement().focus())}),()=>this.pickerComponent?.close()}setValue(e){return this.value===e?this:(this.eDisplayFieldColor.style.backgroundColor=e,this.eDisplayFieldText.textContent=this.beans.agChartsExports._Util.Color.fromString(e).toHexString().toUpperCase(),super.setValue(e))}getValue(){return this.value}},kI={selector:"AG-COLOR-PICKER",component:Xo};import{AgTabGuardComp as _I,_createAgElement as GI,_focusInto as OI,_getActiveDomElement as NI,_isNothingFocused as yd,_last as BI}from"ag-stack";import{AgPromise as Zo,KeyCode as st}from"ag-grid-community";import{AgBeanStub as VI,FAST_TEST_TIMINGS as wd,_setAriaDisabled as HI,_setAriaExpanded as UI,_setAriaHasPopup as zI,_setAriaRole as WI}from"ag-stack";import{KeyCode as xd,TouchListener as $I,_createElement as KI}from"ag-grid-community";import{AgTabGuardComp as jI}from"ag-stack";import{KeyCode as YI}from"ag-grid-community";var qI=class extends Ky{constructor(e){super(),this.setTemplateFromElement(e.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:e=>this.onTabKeyDown(e),handleKeyDown:e=>this.handleKeyDown(e)})}handleKeyDown(e){e.key===YI.ESCAPE&&this.closePanel()}onTabKeyDown(e){e.defaultPrevented||(this.closePanel(),e.preventDefault())}closePanel(){const e=this.parentComponent;e.closeSubMenu(),setTimeout(()=>e.getGui().focus(),0)}},Fd=wd?0:80,XI=wd?0:300,li=class extends jy{constructor(e){super(),this.callbacks=e,this.isActive=!1,this.isMouseActivation=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init(e){const{menuItemDef:t,isAnotherSubMenuOpen:s,level:i,childComponent:r,contextParams:n}=e;return this.params=e.menuItemDef,this.level=i,this.isAnotherSubMenuOpen=s,this.shouldDisplayTooltipOnFocus=e.shouldDisplayTooltipOnFocus,this.childComponent=r,this.contextParams=n,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...t,level:i,isAnotherSubMenuOpen:s,openSubMenu:o=>this.openSubMenu(o),closeSubMenu:()=>this.closeSubMenu(),closeMenu:o=>this.closeMenu(o),updateTooltip:(o,a)=>this.refreshTooltip(o,a),onItemActivated:()=>this.onItemActivated()}).then(o=>{if(!o)return;this.menuItemComp=o;const a=o.configureDefaults?.();a&&this.configureDefaults(a===!0?void 0:a)})}addListeners(e,t){if(!t?.suppressClick){this.addManagedElementListeners(e,{click:i=>this.onItemSelected(i)});const s=new $I(e,!0);this.addManagedListeners(s,{tap:i=>this.onItemSelected(i.touchStart)}),this.addDestroyFunc(()=>s.destroy())}t?.suppressKeyboardSelect||this.addManagedElementListeners(e,{keydown:s=>{(s.key===xd.ENTER||s.key===xd.SPACE)&&(s.preventDefault(),this.onItemSelected(s))}}),t?.suppressMouseDown||this.addManagedElementListeners(e,{mousedown:s=>{s.stopPropagation(),s.preventDefault()}}),t?.suppressMouseOver||this.addManagedElementListeners(e,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu(e=!1,t){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;const s=KI({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=s;let i,r=()=>{this.subMenuIsOpening=!1};if(this.childComponent){const c=this.createBean(new qI(this.childComponent));c.setParentComponent(this);const u=c.getGui(),d="mouseenter",h=()=>this.cancelDeactivate();u.addEventListener(d,h),i=()=>{u.removeEventListener(d,h),this.destroyBean(c)},s.appendChild(u),this.childComponent.afterGuiAttached&&(r=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1})}else if(this.params.subMenu){const c=this.createBean(new kr(this.level+1,this.contextParams,this.callbacks));c.setParentComponent(this),c.addMenuItems(this.params.subMenu),s.appendChild(c.getGui()),this.addManagedListeners(c,{closeMenu:u=>this.dispatchLocalEvent(u)}),c.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),i=()=>this.destroyBean(c),e&&(r=()=>{c.activateFirstItem(),this.subMenuIsOpening=!1})}const n=this.beans.popupSvc,o=()=>{const c=this.eGui;n?.positionPopupForMenu({eventSource:c,ePopup:s,event:t instanceof KeyboardEvent?void 0:t,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},a=this.getLocaleTextFunc(),l=n?.addPopup({modal:!0,eChild:s,positionCallback:o,anchorToElement:this.eGui,ariaLabel:a("ariaLabelSubMenu","SubMenu"),afterGuiAttached:r});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{l&&l.hideFunc(),this.subMenuIsOpen=!1,this.setAriaExpanded(!1),i(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded(e){this.suppressAria||UI(this.eGui,e)}closeSubMenu(){this.hideSubMenu&&(this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1))}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate(e,t){this.cancelActivate(),!(this.params.disabled&&!t)&&(this.isActive=!0,this.suppressRootStyles||this.eGui.classList.add(`${this.cssClassPrefix}-active`),this.onItemActivated(),this.menuItemComp.setActive?.(!0),this.suppressFocus||this.callbacks.preserveRangesWhile(this.beans,()=>this.eGui.focus({preventScroll:!t})),e&&this.params.subMenu&&window.setTimeout(()=>{this.isAlive()&&this.isActive&&this.openSubMenu()},XI))}deactivate(){this.cancelDeactivate(),this.suppressRootStyles||this.eGui.classList.remove(`${this.cssClassPrefix}-active`),this.menuItemComp.setActive?.(!1),this.isActive=!1,this.subMenuIsOpen&&this.closeSubMenu()}getGui(){return this.menuItemComp.getGui()}getParentComponent(){return this.parentComponent}setParentComponent(e){this.parentComponent=e}getSubMenuGui(){return this.eSubMenuGui}onItemSelected(e){this.menuItemComp.select?.(),this.params.action?this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams}))):this.openSubMenu(e instanceof KeyboardEvent&&e.type==="keydown",e),!(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)&&this.closeMenu(e instanceof MouseEvent||e instanceof KeyboardEvent?e:void 0)}closeMenu(e){const t={type:"closeMenu"};e&&(e instanceof MouseEvent?t.mouseEvent=e:t.keyboardEvent=e),this.dispatchLocalEvent(t)}onItemActivated(){const e={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent(e)}cancelActivate(){this.activateTimeoutId&&(window.clearTimeout(this.activateTimeoutId),this.activateTimeoutId=0)}cancelDeactivate(){this.deactivateTimeoutId&&(window.clearTimeout(this.deactivateTimeoutId),this.deactivateTimeoutId=0)}onMouseEnter(){this.cancelDeactivate(),this.isAnotherSubMenuOpen()?this.activateTimeoutId=window.setTimeout(()=>this.activateOnMouseEnter(),Fd):this.activateOnMouseEnter()}activateOnMouseEnter(){this.isMouseActivation=!0;try{this.activate(!0)}finally{this.isMouseActivation=!1}}onMouseLeave(){this.cancelActivate(),this.isSubMenuOpen()?this.deactivateTimeoutId=window.setTimeout(()=>this.deactivate(),Fd):this.deactivate()}refreshRootElementGui(e){let t=this.menuItemComp.getGui();const{cssClassPrefix:s,params:{cssClasses:i,disabled:r}}=this,n=this.menuItemComp.getRootElement?.();if(n&&(e||t.classList.add("ag-menu-option-custom"),t=n),this.suppressRootStyles=!!e,!this.suppressRootStyles){t.classList.add(s);for(const o of i??[])t.classList.add(o);r&&t.classList.add(`${s}-disabled`)}return t}applyAriaProperties(e){const{params:{checked:t,subMenu:s,subMenuRole:i,disabled:r}}=this,n=t!=null;WI(e,n?"menuitemcheckbox":"menuitem"),s&&zI(e,i??"menu"),r&&HI(e,!0)}configureDefaults(e){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults(e));return}const{suppressRootStyles:t,suppressTooltip:s,suppressAria:i,suppressTabIndex:r,suppressFocus:n}=e||{},{params:{tooltip:o,disabled:a}}=this,l=this.eGui=this.refreshRootElementGui(!!t);this.suppressAria=!!i,i||this.applyAriaProperties(l),r||l.setAttribute("tabindex","-1"),s||this.refreshTooltip(o),a||this.addListeners(l,e),this.suppressFocus=!!n}refreshTooltip(e,t){if(this.tooltip=e,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!e||!this.menuItemComp)return;const s=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:t,shouldDisplayTooltipOnFocus:()=>!this.isMouseActivation&&this.shouldDisplayTooltipOnFocus?.()!==!1});s&&(this.tooltipFeature=this.createBean(s))}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},Td="ag-menu-list-no-focus-ring",kr=class Ey extends Yy{constructor(t=0,s,i){super({tag:"div",cls:"ag-menu-list",role:"menu"}),this.level=t,this.menuActionParams=s,this.callbacks=i,this.menuItems=[],this.suppressFocusTooltip=!1}postConstruct(){this.initialiseTabGuard({onTabKeyDown:t=>this.onTabKeyDown(t),handleKeyDown:t=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown(t)),onFocusIn:t=>this.handleFocusIn(t),onFocusOut:t=>this.handleFocusOut(t)})}onTabKeyDown(t){this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed")||t.preventDefault(),t.shiftKey&&this.closeIfIsChild(t)}handleKeyDown(t){switch(t.key){case st.UP:case st.RIGHT:case st.DOWN:case st.LEFT:t.preventDefault(),this.clearNoFocusRing(),this.handleNavKey(t.key);break;case st.ESCAPE:this.closeIfIsChild()&&this.callbacks.stopPropagationCallbacks.stopPropagation(t);break}}handleFocusIn(t){const s=t.relatedTarget;!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(s)&&(this.getGui().contains(s)||this.activeMenuItem?.getSubMenuGui()?.contains(s))||(this.activeMenuItem?this.activeMenuItem.activate():this.activateFirstItem())}handleFocusOut(t){const s=t.relatedTarget;!this.activeMenuItem||this.getGui().contains(s)||this.activeMenuItem.getSubMenuGui()?.contains(s)||this.activeMenuItem.isSubMenuOpening()||this.activeMenuItem.deactivate()}clearActiveItem(){this.activeMenuItem&&(this.activeMenuItem.deactivate(),this.activeMenuItem=null)}addMenuItems(t){t!=null&&(this.itemsReady=Zo.all(t.map(s=>s==="separator"?Zo.resolve({eGui:this.createSeparator()}):typeof s=="string"?(this.callbacks.warnNoItem?.(this.beans,s),Zo.resolve({eGui:null})):this.addItem(s))).then(s=>{for(const i of s??[])i?.eGui&&(this.appendChild(i.eGui),i.comp&&this.menuItems.push(i.comp))}))}addItem(t){const s=this.createManagedBean(new li(this.callbacks));return s.init({menuItemDef:t,isAnotherSubMenuOpen:()=>this.menuItems.some(i=>i.isSubMenuOpen()),shouldDisplayTooltipOnFocus:()=>!this.suppressFocusTooltip,level:this.level,contextParams:this.menuActionParams}).then(()=>(s.setParentComponent(this),this.addManagedListeners(s,{closeMenu:i=>{this.dispatchLocalEvent(i)},menuItemActivated:i=>{this.activeMenuItem&&this.activeMenuItem!==i.menuItem&&this.activeMenuItem.deactivate(),this.activeMenuItem=i.menuItem}}),{comp:s,eGui:s.getGui()}))}focusInto(t=!1){this.getGui().classList.toggle(Td,yd(this.beans));const s=this.withFocusTooltipSuppressed(t,()=>OI(this.getGui()));return this.itemsReady?.then(()=>{if(!this.isAlive()||this.activeMenuItem)return;const i=NI(this.beans);(yd(this.beans)||this.getGui().contains(i))&&this.withFocusTooltipSuppressed(t,()=>this.activateFirstItem())}),s}withFocusTooltipSuppressed(t,s){const i=this.suppressFocusTooltip;this.suppressFocusTooltip=t;try{return s()}finally{this.suppressFocusTooltip=i}}activateFirstItem(){const t=this.menuItems.filter(s=>!s.isDisabled())[0];t&&t.activate()}createSeparator(){const t={tag:"div",cls:"ag-menu-separator-part"};return GI({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[t,t,t,t]})}handleNavKey(t){switch(t){case st.UP:case st.DOWN:{const i=this.findNextItem(t===st.UP);i&&i!==this.activeMenuItem&&i.activate(!1,!0);return}}const s=this.gos.get("enableRtl")?st.RIGHT:st.LEFT;t===s?this.closeIfIsChild():this.openChild()}clearNoFocusRing(){this.getGui().classList.remove(Td);const t=this.getParentComponent();if(t instanceof li){const s=t.getParentComponent();s instanceof Ey&&s.clearNoFocusRing()}}closeIfIsChild(t){const s=this.getParentComponent();return s&&s instanceof li?(t&&t.preventDefault(),s.closeSubMenu(),s.getGui().focus(),!0):!1}openChild(){this.activeMenuItem&&this.activeMenuItem.openSubMenu(!0)}findNextItem(t){const s=[...this.menuItems];if(!s.length)return;if(!this.activeMenuItem)return t?BI(s):s[0];t&&s.reverse();let i,r=!1;for(const n of s){if(!r){n===this.activeMenuItem&&(r=!0);continue}i=n;break}return r&&!i?s[0]:i||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};import{AgBeanStub as ZI,AgComponentStub as JI,_anchorElementToMouseMoveEvent as Ad,_createAgElement as QI,_getPageBody as eE,_getRootNode as tE,_initStyledRoot as sE,_isKeyboardMode as iE,_isPromise as rE,_isVisible as nE}from"ag-stack";var oE="ag-menu",aE="ag-context-menu-loading-icon",Pd=class extends qy{constructor(e){super(),this.params=e,this.destroyLoadingSpinner=null,this.lastPromise=0}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenu(e,t,s){const{getMenuItems:i,shouldBlockMenuOpen:r}=this.params,n=t instanceof MouseEvent?t.target!=null&&!iE():!0,o=i(e,t);if(rE(o)){const a=this.lastPromise+1;return this.lastPromise=a,this.destroyLoadingSpinner||this.createLoadingIcon(t),o.then(l=>{if(this.lastPromise!==a)return;const{target:c}=t,u=!c;l?.length&&(u||nE(c))&&!r?.()&&this.createContextMenu({menuItems:l,menuActionParams:e,mouseEvent:t,anchorToElement:s,suppressInitialTooltip:n}),this.destroyLoadingSpinner?.()}),!0}return o?.length?(this.createContextMenu({menuItems:o,menuActionParams:e,mouseEvent:t,anchorToElement:s,suppressInitialTooltip:n}),!0):!1}createLoadingIcon(e){const{beans:t}=this,s=this.getLocaleTextFunc(),i=t.iconSvc.createIconNoSpan("loadingMenuItems"),r=QI({tag:"div",cls:aE});r.appendChild(i);const n=tE(t),o=eE(t);if(!o)return;const a=sE(t.environment,o,r);t.ariaAnnounce?.announceValue(s("ariaLabelLoadingContextMenu","Loading Context Menu"),"contextmenu"),Ad(r,e,t);const l=c=>{Ad(r,c,t)};n.addEventListener("mousemove",l),this.destroyLoadingSpinner=()=>{n.removeEventListener("mousemove",l),a(),this.destroyLoadingSpinner=null}}createContextMenu(e){const{mapMenuItems:t,menuItemCallbacks:s,beforeMenuOpen:i,onMenuClose:r,afterMenuDestroyed:n,onVisibleChanged:o,onMenuOpen:a}=this.params,{menuItems:l,menuActionParams:c,mouseEvent:u,anchorToElement:d,suppressInitialTooltip:h}=e,p=this.beans.popupSvc,g=t?b=>t(l,c,b):()=>l,f=new lE(g,c,s,h);this.createBean(f);const m=f.getGui();i?.(c);const v={additionalParams:s.getPostProcessPopupParams(c),type:"contextMenu",mouseEvent:u,ePopup:m,nudgeY:1},C=this.getLocaleTextFunc(),S=p?.addPopup({modal:!0,eChild:m,closeOnEsc:!0,closedCallback:b=>{s.preserveRangesWhile(this.beans,()=>{r?.(),this.destroyBean(f),n?.(),o?.(!1,b===void 0?"api":"ui")})},click:u,positionCallback:()=>{const b=this.gos.get("enableRtl");p?.positionPopupUnderMouseEvent({...v,nudgeX:b?(m.offsetWidth+1)*-1:1})},anchorToElement:d,ariaLabel:C("ariaLabelContextMenu","Context Menu")});S&&(a?.(),f.afterGuiAttached({container:"contextMenu",hidePopup:S.hideFunc})),this.activeMenu&&this.hideActiveMenu(),this.activeMenu=f,f.addEventListener("destroyed",()=>{this.activeMenu===f&&(this.activeMenu=null)}),S&&f.addEventListener("closeMenu",b=>S.hideFunc({mouseEvent:b.mouseEvent??void 0,keyboardEvent:b.keyboardEvent??void 0,forceHide:!0}));const w=u&&u instanceof MouseEvent&&u.type==="mousedown";o?.(!0,w?"api":"ui")}destroy(){this.destroyLoadingSpinner?.(),super.destroy()}},lE=class extends Xy{constructor(e,t,s,i){super({tag:"div",cls:oE,role:"presentation"}),this.getMenuItems=e,this.menuActionParams=t,this.callbacks=s,this.suppressInitialTooltip=i,this.menuList=null}postConstruct(){const e=this.createManagedBean(new kr(0,this.menuActionParams,this.callbacks)),t=this.getMenuItems(()=>this.getGui());e.addMenuItems(t),this.appendChild(e),this.menuList=e,e.addEventListener("closeMenu",s=>this.dispatchLocalEvent(s))}afterGuiAttached({hidePopup:e}){e&&this.addDestroyFunc(e);const t=this.menuList;t&&this.callbacks.preserveRangesWhile(this.beans,()=>t.focusInto(this.suppressInitialTooltip))}};import{AgComponentStub as cE,_createAgElement as _r,_isNodeOrElement as uE,_setAriaChecked as dE,_setAriaExpanded as hE}from"ag-stack";var Rd=class extends Zy{constructor(e){super({tag:"div"}),this.callbacks=e}init(e){this.params=e,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){const{checked:e,subMenu:t}=this.params,s=this.getGui();e&&dE(s,e),t&&hE(s,!1)}addIcon(){if(this.params.isCompact)return;const e=_r({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:t,icon:s}=this.params;t?e.appendChild(this.beans.iconSvc.createIconNoSpan("check")):s&&(uE(s)?e.appendChild(s):typeof s=="string"?e.innerHTML=s:this.callbacks?.warnNoIcon?.()),this.getGui().appendChild(e)}addName(){const e=_r({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild(e)}addShortcut(){if(this.params.isCompact)return;const e=_r({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild(e)}addSubMenu(){const e=_r({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),t=this.getGui();if(this.params.subMenu){const s=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";e.appendChild(this.beans.iconSvc.createIconNoSpan(s))}t.appendChild(e)}getClassName(e){return`${this.cssClassPrefix}-${e}`}};import{AgTabGuardComp as pE,RefPlaceholder as Md,_clearElement as gE,_createAgElement as Gr,_findNextFocusableElement as fE,_focusInto as Id,_getActiveDomElement as Ed,_getDocument as mE,_isKeyboardMode as vE,_setAriaLabel as Dd,_setAriaRole as CE}from"ag-stack";import{KeyCode as ci}from"ag-grid-community";import{FOCUS_MANAGED_CLASS as SE,TabGuardClassNames as bE,_findFocusableElements as yE}from"ag-stack";function Jo(e,t){if(!t)return null;const s=yE(e),i=s.indexOf(t);if(i===-1)return null;let r=-1;for(let n=i-1;n>=0;n--)if(s[n].classList.contains(bE.TAB_GUARD_TOP)){r=n;break}return r<=0?null:s[r-1]}function Ld(e,t){if(!t)return!1;const s=e.querySelectorAll(`.${SE}`);if(!s.length)return!1;for(let i=0;i<s.length;i++)if(s[i].contains(t))return!0;return!1}function wE(e){return{tag:"div",cls:`ag-tabs ${e}`,children:[{tag:"div",ref:"eHeader"},{tag:"div",ref:"eBody",role:"presentation",cls:"ag-tabs-body"+e?` ${e}-body`:""}]}}var Qo=class extends Jy{constructor(e){super(wE(e.cssClass)),this.eHeader=Md,this.eBody=Md,this.items=[],this.tabbedItemScrollMap=new Map,this.params=e}postConstruct(){if(this.setupHeader(),this.params.items)for(const e of this.params.items)this.addItem(e);this.initialiseTabGuard({onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),focusInnerElement:this.focusInnerElement.bind(this),focusTrapActive:!0}),this.addDestroyFunc(()=>this.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){const{enableCloseButton:e,cssClass:t}=this.params,s=(i,r)=>{i.classList.add(`ag-tabs-${r}`),t&&i.classList.add(`${t}-${r}`)};e?(this.setupCloseButton(s),this.eTabHeader=Gr({tag:"div",role:"presentation"}),s(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader)):this.eTabHeader=this.eHeader,CE(this.eTabHeader,"tablist"),s(this.eTabHeader,"header")}setupCloseButton(e){const t=Gr({tag:"button"});e(t,"close-button");const s=this.beans.iconSvc.createIconNoSpan("close");Dd(t,this.params.closeButtonAriaLabel),t.appendChild(s),this.addManagedElementListeners(t,{click:()=>this.params.onCloseClicked?.()});const i=Gr({tag:"div",role:"presentation"});e(i,"close-button-wrapper"),i.appendChild(t),this.eHeader.appendChild(i),this.eCloseButton=t}handleKeyDown(e){switch(e.key){case ci.RIGHT:case ci.LEFT:{if(!this.eTabHeader.contains(Ed(this.beans)))return;const t=e.key===ci.RIGHT,s=this.gos.get("enableRtl"),i=this.items.indexOf(this.activeItem),r=t!==s?Math.min(i+1,this.items.length-1):Math.max(i-1,0);if(i===r)return;e.preventDefault();const n=this.items[r];this.showItemWrapper(n),n.eHeaderButton.focus();break}case ci.UP:case ci.DOWN:e.stopPropagation();break}}onTabKeyDown(e){if(e.defaultPrevented)return;const{beans:t,eHeader:s,eBody:i,activeItem:r,params:n}=this,{suppressTrapFocus:o,enableCloseButton:a}=n,l=Ed(t),c=e.target,u=e.shiftKey;if(s.contains(l)){e.preventDefault(),a&&u&&!this.eCloseButton?.contains(l)?this.eCloseButton?.focus():o&&u?Jo(mE(t).body,c)?.focus():this.focusBody(e.shiftKey);return}let d=null;if(Ld(i,c)&&(u&&(d=Jo(i,c)),!d&&!o&&(d=r.eHeaderButton)),!d&&i.contains(l)&&(d=fE({beans:t,rootNode:i,backwards:u}),!d)){o&&!u?this.forceFocusOutOfContainer(u):a&&!u?(e.preventDefault(),this.eCloseButton?.focus()):(e.preventDefault(),this.focusHeader());return}d&&(e.preventDefault(),d.focus())}focusInnerElement(e){return e?this.focusBody(!0):(this.focusHeader(),!0)}focusHeader(e){this.activeItem.eHeaderButton.focus({preventScroll:e})}focusBody(e){return Id(this.eBody,e)}setAfterAttachedParams(e){this.afterAttachedParams=e}showFirstItem(){this.items.length>0&&this.showItemWrapper(this.items[0])}addItem(e){const t=Gr({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});t.appendChild(e.title),this.eTabHeader.appendChild(t),Dd(t,e.titleLabel);const s={tabbedItem:e,eHeaderButton:t};this.items.push(s),t.addEventListener("click",this.showItemWrapper.bind(this,s))}showItem(e){const t=this.items.find(s=>s.tabbedItem===e);t&&this.showItemWrapper(t)}showItemWrapper(e){const{tabbedItem:t,eHeaderButton:s}=e;if(this.params.onItemClicked?.({item:t}),this.activeItem===e){this.params.onActiveItemClicked?.();return}this.lastScrollListener&&(this.lastScrollListener=this.lastScrollListener()),gE(this.eBody),t.bodyPromise.then(i=>{this.eBody.appendChild(i);const r=!vE();if(this.params.suppressFocusBodyOnOpen||Id(this.eBody,!1,r),t.afterAttachedCallback&&t.afterAttachedCallback(this.afterAttachedParams),this.params.keepScrollPosition){const n=t.getScrollableContainer?.()||i;[this.lastScrollListener]=this.addManagedElementListeners(n,{scroll:()=>{this.tabbedItemScrollMap.set(t.name,n.scrollTop)}});const o=this.tabbedItemScrollMap.get(t.name);o!==void 0&&setTimeout(()=>{n.scrollTop=o},0)}}),this.activeItem&&(this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"),this.activeItem.tabbedItem.afterDetachedCallback?.()),s.classList.add("ag-tab-selected"),this.activeItem=e}};import{AgComponentStub as xE,RefPlaceholder as ys,_isComponent as ea,_removeAriaExpanded as FE,_removeFromParent as TE,_setAriaControls as AE,_setAriaExpanded as PE,_setAriaRole as RE,_setDisplayed as ss}from"ag-stack";import{AgCheckboxSelector as ME,AgToggleButton as IE,KeyCode as EE}from"ag-grid-community";var DE=".ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}";function LE(e){const t=e.cssIdentifier||"default",s=e.direction||"vertical";return{tag:"div",cls:`ag-group ag-${t}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${t}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${s} ag-${t}-group-container`}]}}var it=class extends _u{constructor(e={}){super(LE(e),[ME]),this.params=e,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=ys,this.cbGroupEnabled=ys,this.eContainer=ys,this.registerCSS(DE);const{enabled:t,items:s,suppressEnabledCheckbox:i,expanded:r,suppressToggleExpandOnEnableChange:n,useToggle:o}=e;this.cssIdentifier=e.cssIdentifier||"default",this.enabled=t??!0,this.items=s||[],this.useToggle=o??!1,this.alignItems=e.alignItems||"center",this.expanded=r??!0,i!=null&&(this.suppressEnabledCheckbox=i),n!=null&&(this.suppressToggleExpandOnEnableChange=n)}postConstruct(){if(this.setupTitleBar(),this.items.length){const r=this.items;this.items=[],this.addItems(r)}const e=this.getLocaleTextFunc();this.cbGroupEnabled.setLabel(e("enabled","Enabled")),this.enabled&&this.setEnabled(this.enabled,void 0,!0),this.setAlignItems(this.alignItems);const{onEnableChange:t,onExpandedChange:s,suppressOpenCloseIcons:i}=this.params;this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(i??!1),this.refreshChildDisplay(),ss(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange(r=>{this.setEnabled(r,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(r)}),t!=null&&this.onEnableChange(t),s!=null&&this.onExpandedChange(s)}refreshChildDisplay(){ss(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems(e){this.alignItems!==e&&this.removeCss(`ag-group-item-alignment-${this.alignItems}`),this.alignItems=e;const t=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(t),this}toggleGroupExpand(e,t){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)e=!0,t=!0;else if(e=e??!this.expanded,this.expanded===e)return this;return this.expanded=e,this.refreshChildDisplay(),ss(this.eContainer,e),t||this.dispatchLocalEvent({type:e?"expanded":"collapsed"}),this}addItems(e){for(const t of e)this.addItem(t)}prependItem(e){this.insertItem(e,!0)}addItem(e){this.insertItem(e,!1)}updateItems(e){const t=this.items;let s=0;for(let i=0;i<t.length;++i){const r=t[i];if(r===e[s])s++;else{const n=ea(r)?r.getGui():r;TE(n)}}for(;s<e.length;)this.insertItem(e[s++]);this.items=e}setDirection(e){return this.eContainer.classList.toggle("ag-group-container-horizontal",e==="horizontal"),this.eContainer.classList.toggle("ag-group-container-vertical",e==="vertical"),this}insertItem(e,t){const s=this.eContainer,i=ea(e)?e.getGui():e;i.classList.add("ag-group-item",`ag-${this.cssIdentifier}-group-item`),t?(s.prepend(i),this.items.unshift(i)):(s.appendChild(i),this.items.push(i))}hideItem(e,t){const s=this.items[t];ss(s,!e)}getItemIndex(e){const t=ea(e)?e.getGui():e;return this.items.indexOf(t)}setTitle(e){return this.eTitleBar?.setTitle(e),this}addTitleBarWidget(e){return this.eTitleBar?.addWidget(e),this}addCssClassToTitleBar(e){this.eTitleBar?.addCss(e)}getTitleBarGui(){return this.eTitleBar?.getGui()??this.eToggle?.getGui()??this.getGui()}dispatchEnableChangeEvent(e){const t={type:"enableChange",enabled:e};this.dispatchLocalEvent(t)}setEnabled(e,t,s){return this.enabled=e,this.refreshDisabledStyles(),s||this.toggleGroupExpand(e),t||(this.cbGroupEnabled.setValue(e),this.eToggle?.setValue(e)),this}isEnabled(){return this.enabled}onEnableChange(e){return this.addManagedListeners(this,{enableChange:t=>e(t.enabled)}),this}onExpandedChange(e){return this.addManagedListeners(this,{expanded:()=>e(!0),collapsed:()=>e(!1)}),this}hideEnabledCheckbox(e){return this.suppressEnabledCheckbox=e,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons(e){return this.eTitleBar?.hideOpenCloseIcons(e),this}refreshDisabledStyles(){const e=!this.enabled;this.eContainer.classList.toggle("ag-disabled",e),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&e),this.eContainer.classList.toggle("ag-disabled-group-container",e)}setupTitleBar(){const e=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",e.getGui())}createDefaultTitleBar(){const e=`ag-${this.getCompId()}-group-container`;this.eContainer.id=e;const t=this.createManagedBean(new GE(this.params,e));return this.eTitleBar=t,t.refreshOnExpand(this.expanded),this.addManagedListeners(t,{expandedChanged:s=>this.toggleGroupExpand(s.expanded)}),t}createToggleTitleBar(){const e=this.createManagedBean(new IE({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:t=>{this.setEnabled(t,!0),this.dispatchEnableChangeEvent(t)}}));return e.addCss("ag-group-title-bar"),e.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=e,this.toggleGroupExpand(this.enabled),e}},kE="ag-disabled-group-title-bar";function _E(e){const{cssIdentifier:t,suppressOpenCloseIcons:s}=e,i=t??"default",r=s?"group":"button";return{tag:"div",cls:`ag-group-title-bar ag-${i}-group-title-bar ag-unselectable`,role:e.suppressKeyboardNavigation?"presentation":r,children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${i}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${i}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${i}-group-title`}]}}var GE=class extends _u{constructor(e={},t){super(_E(e)),this.containerId=t,this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.expanded=!0,this.disabled=!1,this.eGroupOpenedIcon=ys,this.eGroupClosedIcon=ys,this.eTitle=ys;const{title:s,suppressOpenCloseIcons:i,suppressKeyboardNavigation:r}=e;s&&s.length>0&&(this.title=s),i!=null&&(this.suppressOpenCloseIcons=i),this.suppressKeyboardNavigation=r??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){const e=this.beans.iconSvc;this.eGroupClosedIcon.appendChild(e.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild(e.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:t=>{const{ENTER:s,SPACE:i,RIGHT:r,LEFT:n,UP:o,DOWN:a,PAGE_UP:l,PAGE_DOWN:c,PAGE_HOME:u,PAGE_END:d}=EE;switch(t.key){case o:case a:case l:case c:case u:case d:t.preventDefault();return;case s:case i:t.preventDefault(),this.dispatchExpandChanged();break;case r:case n:t.preventDefault(),this.dispatchExpandChanged(t.key===r);break}}})}refreshOnExpand(e){this.expanded=e,this.refreshAriaState(),this.refreshOpenCloseIcons(e)}refreshAriaState(){const e=this.getGui(),t=this.title!=null&&!this.suppressKeyboardNavigation&&!this.disabled,s=t&&!this.suppressOpenCloseIcons;let i="presentation";s?i="button":t&&(i="group"),RE(e,i),t?this.activateTabIndex([e]):e.removeAttribute("tabindex"),s?PE(e,this.expanded):FE(e),AE(e,s?this.containerId:null)}refreshOpenCloseIcons(e){const t=!this.suppressOpenCloseIcons;ss(this.eGroupOpenedIcon,t&&e),ss(this.eGroupClosedIcon,t&&!e)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged(e){const t={type:"expandedChanged",expanded:e};this.dispatchLocalEvent(t)}setTitle(e){const t=this.getGui(),s=!!e&&e.length>0;return e=s?e:void 0,this.eTitle.textContent=e??"",ss(t,s),e!==this.title&&(this.title=e),this.refreshAriaState(),this}addWidget(e){return this.getGui().appendChild(e),this}hideOpenCloseIcons(e){return this.suppressOpenCloseIcons=e,e&&this.dispatchExpandChanged(!0),this.refreshAriaState(),this}refreshDisabledStyles(e){this.disabled=e,this.getGui().classList.toggle(kE,e),this.refreshAriaState()}},J={selector:"AG-GROUP-COMPONENT",component:it};import{TooltipModule as OE,_FilterCoreModule as NE,_FilterValueModule as BE,_PopupModule as VE,_SharedDragAndDropModule as HE}from"ag-grid-community";var G="36.2.0",$={moduleName:"EnterpriseCore",version:G,beans:[ko],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:ko.setLicenseKey},UE='.ag-advanced-filter-header{align-items:center;background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);display:flex;position:relative;z-index:1}.ag-advanced-filter{align-items:center;display:flex;width:100%}.ag-advanced-filter-buttons{display:contents}.ag-advanced-filter-header-cell{height:100%;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding)}.ag-advanced-filter-apply-button,.ag-advanced-filter-builder-button{align-items:center;background-color:unset;border:0;display:flex;font-size:var(--ag-font-size);font-weight:600;line-height:normal;padding:var(--ag-spacing);white-space:nowrap;&:where(.ag-standard-button):where(:not(:disabled)){cursor:pointer;&:where(.ag-standard-button):hover{background-color:var(--ag-row-hover-color)}}}:where(.ag-ltr) .ag-advanced-filter-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-button{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-advanced-filter-builder-button:disabled) .ag-advanced-filter-builder-button-label{color:var(--ag-button-disabled-text-color)}:where(.ag-ltr) .ag-advanced-filter-builder-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-advanced-filter-builder-button-label{margin-right:var(--ag-spacing)}.ag-advanced-filter-builder{display:flex;flex-direction:column;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-advanced-filter-builder-list{flex:1;overflow:auto}.ag-advanced-filter-builder-button-panel{border-top:var(--ag-advanced-filter-builder-button-bar-border);display:flex;justify-content:flex-end;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-advanced-filter-builder-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-cancel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-builder-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-cancel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-advanced-filter-builder-item-wrapper{align-items:center;display:flex;flex:1 1 auto;justify-content:space-between;overflow:hidden}:where(.ag-ltr) .ag-advanced-filter-builder-item-wrapper{padding-left:calc(var(--ag-icon-size)/2);padding-right:var(--ag-icon-size)}:where(.ag-rtl) .ag-advanced-filter-builder-item-wrapper{padding-left:var(--ag-icon-size);padding-right:calc(var(--ag-icon-size)/2)}:where(.ag-virtual-list-viewport) .ag-advanced-filter-builder-item-wrapper .ag-tab-guard{position:absolute}.ag-advanced-filter-builder-item-tree-line{width:var(--ag-advanced-filter-builder-indent-size)}.ag-advanced-filter-builder-item-tree-line-root{width:var(--ag-icon-size)}.ag-advanced-filter-builder-item-tree-line-root:before{height:50%;top:50%}.ag-advanced-filter-builder-item-tree-line-horizontal,.ag-advanced-filter-builder-item-tree-line-vertical,.ag-advanced-filter-builder-item-tree-line-vertical-bottom,.ag-advanced-filter-builder-item-tree-line-vertical-top{align-items:center;display:flex;height:100%;position:relative}.ag-advanced-filter-builder-item-tree-line-horizontal:after,.ag-advanced-filter-builder-item-tree-line-horizontal:before,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:after,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before,.ag-advanced-filter-builder-item-tree-line-vertical-top:after,.ag-advanced-filter-builder-item-tree-line-vertical-top:before,.ag-advanced-filter-builder-item-tree-line-vertical:after,.ag-advanced-filter-builder-item-tree-line-vertical:before{content:"";height:100%;position:absolute}.ag-advanced-filter-builder-item-tree-line-horizontal:after{border-bottom:var(--ag-border-width) solid var(--ag-border-color);height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size))}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-horizontal:after{left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-horizontal:after{right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical:before{top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-top:before{height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{height:calc(50% - var(--ag-icon-size)*1.5/2);top:calc(50% + var(--ag-icon-size)*1.5/2);width:calc(var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-condition{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing)}.ag-advanced-filter-builder-item,.ag-advanced-filter-builder-item-buttons,.ag-advanced-filter-builder-item-condition,.ag-advanced-filter-builder-item-tree-lines,.ag-advanced-filter-builder-pill,.ag-advanced-filter-builder-pill-wrapper{align-items:center;display:flex;height:100%}.ag-advanced-filter-builder-pill-wrapper{margin:0 var(--ag-spacing)}.ag-advanced-filter-builder-pill{border-radius:var(--ag-border-radius);min-height:calc(100% - var(--ag-spacing)*3);min-width:calc(var(--ag-spacing)*2);padding:var(--ag-spacing) calc(var(--ag-spacing)*2);position:relative}:where(.ag-advanced-filter-builder-pill){.ag-advanced-filter-builder-value-number{font-family:monospace;font-weight:700}.ag-advanced-filter-builder-value-empty{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-left:var(--ag-spacing)}}.ag-advanced-filter-builder-pill-display{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-advanced-filter-builder-join-pill{background-color:var(--ag-advanced-filter-builder-join-pill-color);cursor:pointer}.ag-advanced-filter-builder-column-pill{background-color:var(--ag-advanced-filter-builder-column-pill-color);cursor:pointer}.ag-advanced-filter-builder-option-pill{background-color:var(--ag-advanced-filter-builder-option-pill-color);cursor:pointer}.ag-advanced-filter-builder-value-pill{background-color:var(--ag-advanced-filter-builder-value-pill-color);cursor:text;max-width:140px;:where(.ag-advanced-filter-builder-pill-display){display:block}}.ag-advanced-filter-builder-set-values-pill-wrapper{flex:1 1 152px;max-width:100%;min-width:152px;width:152px}.ag-advanced-filter-builder-set-values-pill{cursor:pointer;max-width:100%;min-width:152px;width:-moz-max-content;width:max-content;:where(.ag-advanced-filter-builder-pill-display){min-width:0}}.ag-advanced-filter-builder-set-values-pill-empty{width:152px}.ag-advanced-filter-builder-item-buttons{display:flex;gap:var(--ag-spacing);padding:0 calc(var(--ag-spacing)*.5)}.ag-advanced-filter-builder-item-button{color:var(--ag-subtle-text-color);cursor:pointer;position:relative}.ag-advanced-filter-builder-item-button,.ag-advanced-filter-builder-pill{&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-advanced-filter-builder-item-button-disabled{cursor:default;opacity:.5}.ag-advanced-filter-builder-virtual-list-viewport{scrollbar-width:thin}.ag-advanced-filter-builder-virtual-list-container{--ag-internal-virtual-list-overflow:visible;top:var(--ag-spacing)}.ag-advanced-filter-builder-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);min-width:-moz-max-content;min-width:max-content}.ag-advanced-filter-builder-set-value-list{:where(.ag-advanced-filter-builder-item){flex:1 1 auto;min-width:0}:where(.ag-advanced-filter-builder-item-condition){flex:1 1 auto;min-width:0}:where(.ag-advanced-filter-builder-item-wrapper){-moz-column-gap:max(0px,calc(24px - var(--ag-spacing)*1.5));column-gap:max(0px,calc(24px - var(--ag-spacing)*1.5))}:where(.ag-advanced-filter-builder-invalid.ag-invisible){display:none}}.ag-advanced-filter-builder-virtual-list-item:hover{background-color:var(--ag-row-hover-color);:where(.ag-advanced-filter-builder-item-button){opacity:1}}.ag-advanced-filter-builder-invalid{color:var(--ag-subtle-text-color);cursor:default;margin:0 var(--ag-spacing)}:where(.ag-advanced-filter-builder-validation) .ag-advanced-filter-builder-invalid{color:var(--ag-invalid-color)}:where(.ag-advanced-filter-builder-virtual-list-item-highlight) .ag-advanced-filter-builder-item-button:focus-visible{opacity:1}.ag-advanced-filter-builder-set-picker{background-color:var(--ag-menu-background-color);border:var(--ag-border-width) solid var(--ag-border-color);border-radius:var(--ag-border-radius);min-width:240px;position:absolute;width:auto}';function zE(e){return e.filterManager?.getAdvFilterModel()??null}function WE(e,t){e.filterManager?.setAdvFilterModel(t)}function $E(e){e.filterManager?.toggleAdvFilterBuilder(!0,"api")}function KE(e){e.filterManager?.toggleAdvFilterBuilder(!1,"api")}import{_getOwn as Or,_parseBigIntOrNull as kd,_parseDateTimeFromString as _d,_serialiseDate as Gd,_toStringOrNull as ui}from"ag-stack";import{BeanStub as jE,_addGridCommonParams as YE,_bindFilterCallback as qE,_classifyFilterOptions as XE,_filterCallbackParams as ZE,_getDefaultSimpleFilter as Od,_isGridSuppliedFilterParam as Nd,_toFiniteNumber as JE}from"ag-grid-community";var QE={ariaAdvancedFilterBuilderItem:e=>`${e[0]}. Level ${e[1]}. Press ENTER to edit`,ariaAdvancedFilterBuilderItemValidation:e=>`${e[0]}. Level ${e[1]}. ${e[2]} Press ENTER to edit`,ariaAdvancedFilterBuilderList:"Advanced Filter Builder List",ariaAdvancedFilterBuilderFilterItem:"Filter Condition",ariaAdvancedFilterBuilderGroupItem:"Filter Group",ariaAdvancedFilterBuilderColumn:"Column",ariaAdvancedFilterBuilderOption:"Option",ariaAdvancedFilterBuilderValue:"Value",ariaAdvancedFilterBuilderJoinOperator:"Join Operator",ariaAdvancedFilterInput:"Advanced Filter Input",ariaLabelAdvancedFilterAutocomplete:"Advanced Filter Autocomplete",advancedFilterContains:"contains",advancedFilterNotContains:"does not contain",advancedFilterTextEquals:"equals",advancedFilterTextNotEqual:"does not equal",advancedFilterStartsWith:"begins with",advancedFilterEndsWith:"ends with",advancedFilterBlank:"is blank",advancedFilterNotBlank:"is not blank",advancedFilterEquals:"=",advancedFilterNotEqual:"!=",advancedFilterGreaterThan:">",advancedFilterGreaterThanOrEqual:">=",advancedFilterLessThan:"<",advancedFilterLessThanOrEqual:"<=",advancedFilterInRange:"is between",advancedFilterYesterday:"is yesterday",advancedFilterToday:"is today",advancedFilterTomorrow:"is tomorrow",advancedFilterLast7Days:"is in last 7 days",advancedFilterLastWeek:"is in last week",advancedFilterThisWeek:"is in this week",advancedFilterNextWeek:"is in next week",advancedFilterLast30Days:"is in last 30 days",advancedFilterLastMonth:"is in last month",advancedFilterThisMonth:"is in this month",advancedFilterNextMonth:"is in next month",advancedFilterLast90Days:"is in last 90 days",advancedFilterLastQuarter:"is in last quarter",advancedFilterThisQuarter:"is in this quarter",advancedFilterNextQuarter:"is in next quarter",advancedFilterLastYear:"is in last year",advancedFilterThisYear:"is in this year",advancedFilterYearToDate:"is in year to date",advancedFilterNextYear:"is in next year",advancedFilterLast6Months:"is in last 6 months",advancedFilterLast12Months:"is in last 12 months",advancedFilterLast24Months:"is in last 24 months",advancedFilterTrue:"is true",advancedFilterFalse:"is false",advancedFilterIsAnyOf:"is any of",advancedFilterIsNoneOf:"is none of",advancedFilterSetMore:e=>`+${e[0]} more`,advancedFilterAnd:"AND",advancedFilterOr:"OR",advancedFilterApply:"Apply",advancedFilterReset:"Reset",advancedFilterCancel:"Cancel",advancedFilterClear:"Clear",advancedFilterBuilder:"Builder",advancedFilterValidationMissingColumn:"Column is missing",advancedFilterValidationMissingOption:"Option is missing",advancedFilterValidationMissingValue:"Value is missing",advancedFilterValidationInvalidColumn:"Column not found",advancedFilterValidationInvalidOption:"Option not found",advancedFilterValidationInvalidValue:"Value not found",advancedFilterValidationMissingQuote:"Value is missing an end quote",advancedFilterValidationNotANumber:"Value is not a number",advancedFilterValidationNotABigInt:"Value is not a BigInt",advancedFilterValidationInvalidDate:"Value is not a valid date",advancedFilterValidationMissingCondition:"Condition is missing",advancedFilterValidationJoinOperatorMismatch:"Join operators within a condition must be the same",advancedFilterValidationInvalidJoinOperator:"Join operator not found",advancedFilterValidationMissingListStartBracket:"Missing opening square bracket",advancedFilterValidationMissingListEndBracket:"Missing closing square bracket",advancedFilterValidationMissingEndBracket:"Missing end bracket",advancedFilterValidationExtraEndBracket:"Too many end brackets",advancedFilterValidationMessage:e=>`Expression has an error. ${e[0]} - ${e[1]}.`,advancedFilterValidationMessageAtEnd:e=>`Expression has an error. ${e[0]} at end of expression.`,advancedFilterValidationMessageOnly:e=>`Expression has an error. ${e[0]}.`,advancedFilterValidationMustBeGreaterThan:e=>`${e[0]} must be greater than ${e[1]}`,advancedFilterValidationMustBeGreaterThanOrEqualTo:e=>`${e[0]} must be greater than or equal to ${e[1]}`,advancedFilterValidationMustBeAfter:e=>`${e[0]} must be after ${e[1]}`,advancedFilterValidationMustBeOnOrAfter:e=>`${e[0]} must be on or after ${e[1]}`,advancedFilterBuilderTitle:"Advanced Filter",advancedFilterBuilderApply:"Apply",advancedFilterBuilderCancel:"Cancel",advancedFilterBuilderClear:"Clear",advancedFilterBuilderReset:"Reset",advancedFilterBuilderAddButtonTooltip:"Add Filter or Group",advancedFilterBuilderRemoveButtonTooltip:"Remove",advancedFilterBuilderMoveUpButtonTooltip:"Move Up",advancedFilterBuilderMoveDownButtonTooltip:"Move Down",advancedFilterBuilderAddJoin:"Add Group",advancedFilterBuilderAddCondition:"Add Filter",advancedFilterBuilderSelectColumn:"Select a column",advancedFilterBuilderSelectOption:"Select an option",advancedFilterBuilderEnterValue:"Enter a value...",advancedFilterBuilderValidationAlreadyApplied:"Current filter already applied.",advancedFilterBuilderValidationIncomplete:"Not all conditions are complete.",advancedFilterBuilderValidationSelectColumn:"Must select a column.",advancedFilterBuilderValidationSelectOption:"Must select an option.",advancedFilterBuilderValidationEnterValue:"Must enter a value."};import{_trimInputForFilter as eD}from"ag-grid-community";import{_getOwn as tD}from"ag-stack";import{_PRESET_DATE_FILTER_RANGES as sD,_PRESET_DATE_FILTER_TYPES as Bd,_RelativeDateRangeCache as iD,_TEXT_COMPARISONS as rD,_defaultLowercaseFormatter as nD,_hasValue as ta,_isBlank as ws}from"ag-grid-community";function is(e){return e instanceof Date?new Date(e.getTime()):e}var di={none:0,one:1,range:2,list:0};function oD(e,t,s){let i=!1;const r=e.toLocaleLowerCase(),n=r+" ",o=Object.keys(t).find(a=>{const l=t[a],c=s(l).toLocaleLowerCase();return c.startsWith(n)&&(i=!0),c===r});return o||(i?null:void 0)}function hi(e,t){const s=t??Object.keys(e),i=s.length,r=new Array(i);let n=0;for(let o=0;o<i;++o){const a=s[o],l=tD(e,a);l&&(r[n++]={key:a,displayValue:l.displayValue})}return n<i&&(r.length=n),r}var aD=e=>e??null,Vd=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return hi(this.operators,e)}initOperators(){const{translate:e}=this.params;this.operators={contains:{displayValue:e("advancedFilterContains"),evaluator:this.createEvaluator("contains",!1),operands:"one"},notContains:{displayValue:e("advancedFilterNotContains"),evaluator:this.createEvaluator("notContains",!0),operands:"one"},equals:{displayValue:e("advancedFilterTextEquals"),evaluator:this.createEvaluator("equals",!1),operands:"one"},notEqual:{displayValue:e("advancedFilterTextNotEqual"),evaluator:this.createEvaluator("notEqual",!0),operands:"one"},startsWith:{displayValue:e("advancedFilterStartsWith"),evaluator:this.createEvaluator("startsWith",!1),operands:"one"},endsWith:{displayValue:e("advancedFilterEndsWith"),evaluator:this.createEvaluator("endsWith",!1),operands:"one"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ws,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:ta,operands:"none"}}}createEvaluator(e,t){const s=rD[e];return(i,r,n,o)=>{if(i==null)return t;const a=n.textFormatter??(n.caseSensitive?aD:nD),l=a(n.valueConverter(i,r)),c=a(o),u=n.textMatcher;return u?u(e,l,c,r):l==null||c==null?!1:s(l,c)}}},lD=e=>e===0,cD=e=>e!==0,uD=e=>e>0,dD=e=>e>=0,hD=e=>e<0,pD=e=>e<=0,xs=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return hi(this.operators,e)}initOperators(){const{translate:e,equals:t,relativeDates:s}=this.params;this.operators={equals:{displayValue:e("advancedFilterEquals"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInEquals,t,lD),operands:"one"},notEqual:{displayValue:e("advancedFilterNotEqual"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInNotEqual,(a,l)=>!t(a,l),cD,!0),operands:"one"},greaterThan:{displayValue:e("advancedFilterGreaterThan"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInGreaterThan,(a,l)=>a>l,uD),operands:"one"},greaterThanOrEqual:{displayValue:e("advancedFilterGreaterThanOrEqual"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInGreaterThan,(a,l)=>a>=l,dD),operands:"one"},lessThan:{displayValue:e("advancedFilterLessThan"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInLessThan,(a,l)=>a<l,hD),operands:"one"},lessThanOrEqual:{displayValue:e("advancedFilterLessThanOrEqual"),evaluator:(i,r,n,o)=>this.evaluateSingleOperandExpression(i,r,n,o,!!n.includeBlanksInLessThan,(a,l)=>a<=l,pD),operands:"one"},inRange:{displayValue:e("advancedFilterInRange"),evaluator:(i,r,n,o,a)=>this.evaluateRangeExpression(i,r,n,o,a),operands:"range"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ws,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:ta,operands:"none"}},s&&(this.defaultOperators=Object.keys(this.operators),fD(this.operators,e))}evaluateRangeExpression(e,t,s,i,r){if(e==null||ws(e))return!!s.includeBlanksInRange;const{comparator:n,isValid:o}=s;if(o&&!o(e))return!1;if(n){const l=n(is(i),e);return s.inRangeInclusive?l>=0&&n(is(r),e)<=0:l>0&&n(is(r),e)<0}const a=s.valueConverter(e,t);return a==null?!1:s.inRangeInclusive?a>=i&&a<=r:a>i&&a<r}evaluateSingleOperandExpression(e,t,s,i,r,n,o,a){if(e==null||ws(e))return r;const{comparator:l,isValid:c}=s;if(c&&!c(e))return!!a;if(l)return o(l(is(i),e));const u=s.valueConverter(e,t);return u==null?!!a:n(u,i)}},gD={yesterday:"advancedFilterYesterday",today:"advancedFilterToday",tomorrow:"advancedFilterTomorrow",last7Days:"advancedFilterLast7Days",lastWeek:"advancedFilterLastWeek",thisWeek:"advancedFilterThisWeek",nextWeek:"advancedFilterNextWeek",last30Days:"advancedFilterLast30Days",lastMonth:"advancedFilterLastMonth",thisMonth:"advancedFilterThisMonth",nextMonth:"advancedFilterNextMonth",last90Days:"advancedFilterLast90Days",lastQuarter:"advancedFilterLastQuarter",thisQuarter:"advancedFilterThisQuarter",nextQuarter:"advancedFilterNextQuarter",lastYear:"advancedFilterLastYear",thisYear:"advancedFilterThisYear",yearToDate:"advancedFilterYearToDate",nextYear:"advancedFilterNextYear",last6Months:"advancedFilterLast6Months",last12Months:"advancedFilterLast12Months",last24Months:"advancedFilterLast24Months"};function fD(e,t){const s=new iD;for(let i=0,r=Bd.length;i<r;++i){const n=Bd[i],o=sD[n];e[n]={displayValue:t(gD[n]),evaluator:(a,l,c)=>{if(a==null||ws(a))return!1;const{comparator:u,isValid:d}=c;if(d&&!d(a))return!1;if(u){const{fromTime:m,toTime:v}=s.getRange(n,o);return u(new Date(m),a)>=0&&u(new Date(v),a)<0}const h=c.valueConverter(a,l);if(h==null)return!1;const{fromTime:p,toTime:g}=s.getRange(n,o),f=+h;return f>=p&&f<g},operands:"none"}}}var mD=class{constructor(e){this.params=e,this.initOperators()}getEntries(e){return hi(this.operators,e)}initOperators(){const{translate:e}=this.params;this.operators={true:{displayValue:e("advancedFilterTrue"),evaluator:t=>!!t,operands:"none"},false:{displayValue:e("advancedFilterFalse"),evaluator:t=>t===!1,operands:"none"},blank:{displayValue:e("advancedFilterBlank"),evaluator:ws,operands:"none"},notBlank:{displayValue:e("advancedFilterNotBlank"),evaluator:ta,operands:"none"}}}};import{_parseBigIntOrNull as vD,_parseDateTimeFromString as CD,_toStringOrNull as Hd}from"ag-stack";import{_bindFilterCallback as Nr,_isRangeOutOfOrder as SD,_toFiniteNumber as bD}from"ag-grid-community";import{_getCustomOptionDisplayName as yD,_getCustomOptionNumberOfInputs as wD,_isGridSuppliedFilterOptions as xD}from"ag-grid-community";import{_areEqual as FD}from"ag-stack";import{ProvidedFilter as TD}from"ag-grid-community";function Dt(e){const t=e?.filters;return t&&t.length>0?t:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function sa(e){const t=e.filter;return t===!0?"agTextColumnFilter":t}function AD(e,t){const s=sa(e),i=sa(t);return s===i?!0:typeof s!="object"||typeof i!="object"?!1:s.component===i.component&&s.handler===i.handler&&s.doesFilterPass===i.doesFilterPass}function Ud(e,t){return!FD(e,t,AD)}function Br(e,t){if(e!=null)for(let s=e.length-1;s>=0;s--)t(e[s],s)}function PD(e,t){return t.title!=null?t.title:e instanceof TD?e.getFilterTitle():"Filter"}function Vr(e,t,s,i){const r=[],n=e?.filterModels;for(let o=0;o<t;o++)r[o]=(o===i?s:n?.[o])??null;return r.every(o=>o==null)?null:{filterType:"multi",filterModels:r}}function wt(e,t){return e?.filterModels?.[t]??null}function Hr(e,t,s,i){const r=s.filterValueGetter;return r?e.colFilter.createGetValue(t,r):i}function zd(e){const t=e?.filterOptions;return!t?.length||xD(t)?void 0:t}function pi(e,t){const s=Dt(e);for(let i=0,r=s.length;i<r;++i){const n=s[i];if(n&&sa(n)===t)return n}}function Wd(e){const t=e.colDef.filterParams,s=t?.filters;for(let i=0,r=s?.length??0;i<r;++i){const n=zd(s[i]?.filterParams);if(n)return n}return zd(t)}function RD(e,t,s,i){const r=Object.assign(Object.create(null),e.operators);return t.forEach((n,o)=>{r[o]=MD(n,s,i)}),{operators:r,getEntries:n=>hi(r,n)}}function MD(e,t,s){const i=e.predicate;let r,n;switch(wD(e)){case 0:r=o=>i([],o,s()),n="none";break;case 1:r=(o,a,l,c)=>i([is(c)],o,s()),n="one";break;default:r=(o,a,l,c,u)=>i([is(c),is(u)],o,s()),n="range";break}return{displayValue:yD(e,t),evaluator:r,operands:n}}var Ur=["filter","filterTo"];function ID(e,t,s){const i=[];for(let r=0;r<s;++r){const n=e.formatOperand(t,t[Ur[r]],!0);if(!n)return null;i.push(n)}return i}function $d(e,t,s,i,r,n){if(!s.colId)return e.translate("advancedFilterBuilderValidationSelectColumn");if(!s.type)return e.translate("advancedFilterBuilderValidationSelectOption");const o=s;if(n?.operands==="list")return o.values?.length?null:e.translate("advancedFilterBuilderValidationEnterValue");const a=ID(e,o,di[n?.operands??"none"]);if(!a)return e.translate("advancedFilterBuilderValidationEnterValue");if(n?.operands!=="range")return null;const l=d=>ED(i,t,r,d),{filter:c,filterTo:u}=s;return Kd(e,s.colId,l(c),l(u),a[0])}function Kd(e,t,s,i,r){const{inRangeInclusive:n}=e.getExpressionEvaluatorParams(t);if(!SD(s,i,n))return null;const o=s instanceof Date;let a;return n?a=o?"advancedFilterValidationMustBeOnOrAfter":"advancedFilterValidationMustBeGreaterThanOrEqualTo":a=o?"advancedFilterValidationMustBeAfter":"advancedFilterValidationMustBeGreaterThan",e.translate(a,[e.getColumnDisplayValue(t)??t,r])}function ED(e,t,s,i){return i==null?null:s==="bigint"?zr(e,t)(Hd(i)):s==="number"?typeof i=="number"?bD(i):gi(e,t)(i):CD(Hd(i))}var jd=class{constructor(e,t){this.params=e,this.startPosition=t,this.message=null}reject(e,t){this.message??(this.message=this.params.advFilterExpSvc.translate(e)),t!=null&&(this.endPosition??(this.endPosition=t))}isRejected(){return this.endPosition!=null}getErrorPosition(){return this.endPosition}getError(){const e=this.message;if(!e)return null;const t=this.endPosition,s=this.params.expression.length;return{message:e,startPosition:t==null?s:this.startPosition,endPosition:t??s}}},Yd=e=>e?.colDef.filterParams,zr=(e,t)=>Nr(Yd(e)?.bigintParser,t,e,"advancedFilter")??vD,DD=(e,t)=>Nr(Yd(e)?.bigintFormatter,t,e,"advancedFilter");function ia(e){const t=e?.colDef.filterParams;return t?.numberParser!=null&&t.numberFormatter!=null?t:void 0}var LD=e=>e?.trim()?Number(e):null,gi=(e,t)=>Nr(ia(e)?.numberParser,t,e,"advancedFilter")??LD,kD=(e,t)=>Nr(ia(e)?.numberFormatter,t,e,"advancedFilter");function _D(e){return ia(e)!=null}function qd(e,t,s){if(t!=null&&t!=="text"&&t!=="object")return;const i=e?.colDef,r=i?.filter;return r==="agMultiColumnFilter"?pi(i?.filterParams,"agTextColumnFilter")?.filterParams:(r==null||r===!0||r==="agTextColumnFilter")&&!s.hasSetFilter(e)?i?.filterParams:void 0}function Wr(e,t,s){if(!e)return"";const i=s-t;return i?e.slice(0,e.length-i):e}function rs(e,t,s,i,r,n,o,a){let l=s+(!e.length||o?0:1),c=0;if(r){const d=e[l]===" ";d&&!a&&!n?c=1:(i+=" ",a&&(i+=a),n&&(i+='"'),d&&l++)}return{updatedValue:e.slice(0,t)+i+e.slice(l),updatedPosition:t+i.length+c}}function ra(e,t,s){let i=t;for(;i<s&&e[i]===" ";)i++;return i}function na(e,t,s,i){let r=t,n=!1;for(;r<e.length;){const o=e[r];if(o==="("){i&&e[r-1]===" "?n=!0:r=r-1;break}else if(o===" "||s&&o===")"){r=r-1;break}r++}return{endPosition:r,isEmpty:n}}function oa(e,t,s,i){s!==t&&(e.expression=rs(e.expression,i-t.length+1,i,s).updatedValue)}var $r="[",aa="]",Xd="\u203A",Zd=">",GD=` ${Xd} `,OD=` ${Zd} `,fi=e=>e.join(GD),Jd=e=>e.join(OD),ND=class{constructor(e,t,s){this.params=e,this.column=s,this.values=[],this.hasOpenBracket=!1,this.hasCloseBracket=!1,this.closeBracketPosition=-1,this.pendingQuoteClose=!1,this.expectSeparator=!1,this.separatorPosition=-1,this.validation=new jd(e,t)}parse(e,t){return this.hasCloseBracket||this.validation.isRejected()?!0:this.quotes?this.parseInQuotes(e,t):this.segment?this.parseInSegment(e,t):this.parseBetweenSegments(e,t)}complete(e){this.pendingQuoteClose?this.closeQuotes(e):this.quotes&&this.validation.reject("advancedFilterValidationMissingQuote"),this.finishValue(e,!1),this.values.length?this.hasCloseBracket||this.validation.reject("advancedFilterValidationMissingListEndBracket"):this.validation.reject("advancedFilterValidationMissingValue")}isComplete(){return this.values.length>0&&this.hasCloseBracket}getKeys(){const e=this.values,t=[];for(let s=0,i=e.length;s<i;++s){const r=e[s].keys;for(let n=0,o=r?.length??0;n<o;++n)t.push(r[n])}return t}getUsedKeys(e){const t=this.values,s=new Set;for(let i=0,r=t.length;i<r;++i){const n=t[i];if(n!==e&&n.resolved){const o=n.keys;for(let a=0,l=o.length;a<l;++a)s.add(o[a])}}return s}getValidationError(){const e=this.values;for(let t=0,s=e.length;t<s;++t){const i=e[t];if(i.judged&&!i.resolved)return{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidValue"),startPosition:i.startPosition,endPosition:i.endPosition,advisory:!0}}return this.validation.getError()}getValueAt(e){const t=this.values;for(let s=0,i=t.length;s<i;++s){const r=t[s];if(e<=r.startPosition||e>r.endPosition+1)continue;const n=r.segments;if(r.expectsSegment&&e>(n[n.length-1]?.endPosition??-1)+1)return{value:r,segmentIndex:n.length};let o=n.length-1;for(let a=0;a<n.length;++a)if(e<=n[a].endPosition+1){o=a;break}return{value:r,segmentIndex:o}}}isInList(e){const t=this.validation.getErrorPosition();return t!=null?e<=t:!this.hasCloseBracket||e<=this.closeBracketPosition}parseInQuotes(e,t){if(this.pendingQuoteClose){if(this.pendingQuoteClose=!1,e===this.quotes){this.segment.text+=e;return}return this.closeQuotes(t-1),this.parseBetweenSegments(e,t)}if(e===this.quotes){this.pendingQuoteClose=!0;return}this.segment.text+=e}closeQuotes(e){this.pendingQuoteClose=!1,this.quotes=void 0,this.finishSegment(e,!0)}parseInSegment(e,t){if(e===","||la(e)||e===aa)return this.finishSegment(t-1,!0),this.parseBetweenSegments(e,t);this.segment.text+=e}parseBetweenSegments(e,t){var s;if(!this.hasOpenBracket){if(e===" ")return;if(e!==$r)return this.validation.reject("advancedFilterValidationMissingListStartBracket",t);this.hasOpenBracket=!0;return}if(e!==" "){if(e===aa)return this.hasCloseBracket=!0,this.closeBracketPosition=t,this.finishValue(t-1,!0),this.values.length?this.separatorPosition>=0&&((s=this.params).redundantSeparators??(s.redundantSeparators=[])).push({startPosition:this.separatorPosition,endPosition:t-1}):this.validation.reject("advancedFilterValidationMissingValue",t),!1;if(e===","){if(!this.value)return this.validation.reject("advancedFilterValidationMissingValue",t);this.finishValue(t-1,!0),this.separatorPosition=t;return}if(la(e)){if(!this.value)return this.validation.reject("advancedFilterValidationMissingValue",t);this.expectSeparator=!1,this.value.expectsSegment=!0;return}if(this.expectSeparator)return this.validation.reject("advancedFilterValidationMissingListEndBracket",t);this.startSegment(e,t)}}startSegment(e,t){this.separatorPosition=-1,this.value||(this.value={segments:[],startPosition:t,endPosition:t,terminated:!1,expectsSegment:!1,judged:!1,resolved:!1},this.values.push(this.value)),this.value.expectsSegment=!1;const s=BD(e);this.quotes=s?e:void 0,this.segment={text:s?"":e,startPosition:t,endPosition:t,closed:!1,quoted:s},this.value.segments.push(this.segment)}finishSegment(e,t){const s=this.segment;if(s){if(!s.quoted){const i=s.text,r=i.trimEnd();s.text=r,e-=i.length-r.length}s.endPosition=e,s.closed=t,this.segment=void 0,this.value.endPosition=e,this.expectSeparator=!0}}finishValue(e,t){const s=this.value;if(!s)return;this.finishSegment(e,!1),s.endPosition=Math.max(s.endPosition,Math.min(e,this.params.expression.length-1)),s.terminated=t,s.judged=!s.expectsSegment&&(t||!!s.segments[s.segments.length-1]?.closed),this.expectSeparator=!1,this.value=void 0;const i=this.column;if(!i)return;const r=s.segments.map(c=>c.text),n=this.params.advFilterSetSvc,o=n.getKeys(i,r)??this.getKeysForWholeValue(s,i)??this.getKeysForJoinedPath(i,r);s.resolved=o!==void 0;const a=fi(r),l=r.length===1&&a===n.getBlankLabel(i);s.keys=o??[l?null:a]}getKeysForWholeValue(e,t){const s=e.segments;if(s.length<2)return;for(let r=0,n=s.length;r<n;++r)if(s[r].quoted)return;const i=this.params.expression.slice(e.startPosition,s[s.length-1].endPosition+1);return this.params.advFilterSetSvc.getKeys(t,[i])}getKeysForJoinedPath(e,t){if(t.length!==1)return;const s=Kr(t[0]);return s.length>1?this.params.advFilterSetSvc.getKeys(e,s):void 0}},la=e=>e===Xd||e===Zd,Kr=e=>{const t=[];let s=0;for(let i=0,r=e.length;i<r;++i)la(e[i])&&(t.push(e.slice(s,i).trim()),s=i+1);return t.push(e.slice(s).trim()),t},BD=e=>e==="'"||e==='"',VD=class{constructor(e,t){this.params=e,this.startPosition=t,this.valid=!0,this.hasStartChar=!1,this.hasEndChar=!1,this.colName=""}parse(e,t){if(e===ca&&!this.colName)this.hasStartChar=!0;else if(e===ua&&this.hasStartChar){if(this.parseColumn(!1,t))return this.hasEndChar=!0,!1;this.colName+=e}else this.colName+=e}getDisplayValue(){return(this.hasStartChar?ca:"")+this.colName+(this.hasEndChar?ua:"")}getColId(){return this.colId}complete(e){this.parseColumn(!0,e)}getValidationError(){return this.valid?null:{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidColumn"),startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}}parseColumn(e,t){this.endPosition=t;const s=this.params.advFilterExpSvc.getColId(this.colName);return s&&this.hasStartChar&&(this.colId=s.colId,oa(this.params,this.colName,s.columnName,t-1),this.colName=s.columnName,this.column=this.params.colModel.getNonPivotCol(this.colId),this.column)?(this.baseCellDataType=this.params.dataTypeSvc?.getBaseDataType(this.column)??"text",!0):(e&&(this.valid=!1),this.baseCellDataType="text",!1)}},HD=class{constructor(e,t,s,i){this.params=e,this.startPosition=t,this.baseCellDataType=s,this.column=i,this.valid=!0,this.operands="none",this.operator=""}parse(e,t){if(this.matchEndPosition==null&&(!(e===" "||e===")")||!this.parseOperator(!1,t-1))){this.operator+=e;return}return t<=this.matchEndPosition?void 0:!0}complete(e){this.matchEndPosition==null&&this.parseOperator(!0,e)}getValidationError(){return this.valid?null:{message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidOption"),startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}}getDisplayValue(){return this.operator}getOperatorKey(){return this.parsedOperator}matchOperatorName(e,t,s){const{params:i,startPosition:r}=this,n=i.expression;let o,a=0,l=!1;for(let c=0,u=e.length;c<u;++c){const d=e[c],h=d.displayValue??"",p=h.toLocaleLowerCase();h.length>a&&h.length>=t&&UD(n,r,h,p)&&(o=d.key,a=h.length),p.startsWith(s)&&(l=!0)}return{key:o,length:a,isPartialMatch:l}}parseOperator(e,t){const{params:s,startPosition:i}=this,r=s.expression,n=s.advFilterExpSvc.getColumnOperators(this.baseCellDataType,this.column);this.endPosition=t;const o=t-i+1,a=r.slice(i,t+1).toLocaleLowerCase()+" ",l=n?.activeOperators;let c=this.matchOperatorName(n?.operators.getEntries(l)??[],o,a);if(l){const h=this.matchOperatorName(n.operators.getEntries(),o,a);(h.length>c.length||!c.key&&h.isPartialMatch)&&(c=h)}const{key:u,isPartialMatch:d}=c;if(u){const h=i+c.length-1;this.parsedOperator=u,this.endPosition=h,this.matchEndPosition=h;const p=s.advFilterExpSvc.getExpressionOperator(this.baseCellDataType,u,this.column);this.operands=p.operands;const g=p.displayValue,f=r.slice(i,h+1);return oa(s,f,g,h),this.operator=g,!0}return(e||!d)&&(this.valid=!1),!1}};function UD(e,t,s,i){const r=t+s.length,n=e[r];return(n===void 0||n===" "||n===")")&&e.slice(t,r).toLocaleLowerCase()===i}var zD=class{constructor(e,t,s,i){this.params=e,this.startPosition=t,this.baseCellDataType=s,this.column=i,this.operand="",this.validationMessage=null,this.filterValidationSetters={number:r=>{(r==null||isNaN(r))&&(this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationNotANumber"))},bigint:r=>{r==null&&(this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationNotABigInt"))},date:r=>{r==null&&(this.validationMessage=this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidDate"))},dateString:(...r)=>this.filterValidationSetters.date(...r),dateTime:(...r)=>this.filterValidationSetters.date(...r),dateTimeString:(...r)=>this.filterValidationSetters.date(...r),boolean(){},object(){},text(){}}}parse(e,t){if(e===" ")if(this.quotes)this.operand+=e;else return this.parseOperand(!1,t),!0;else if(e===")")if(this.quotes)this.operand+=e;else return this.parseOperand(!1,t-1),!0;else if(!this.operand&&!this.quotes&&(e==="'"||e==='"'))this.quotes=e;else{if(this.quotes&&e===this.quotes)return this.parseOperand(!1,t),this.quotes=void 0,!1;this.operand+=e}}complete(e){this.parseOperand(!0,e)}getValidationError(){return this.validationMessage?{message:this.validationMessage,startPosition:this.startPosition,endPosition:this.endPosition??this.params.expression.length-1}:null}isInsideQuotes(){return this.quotes!=null}getRawValue(){return this.operand}getModelValue(){return this.modelValue}getBuilderValue(){return this.params.advFilterExpSvc.isOperandModelValueEditable(this.baseCellDataType,this.column)?this.modelValue:this.operand}parseOperand(e,t){const{advFilterExpSvc:s,advFilterSetSvc:i}=this.params;if(this.endPosition=t,qd(this.column,this.baseCellDataType,i)?.trimInput&&(this.operand=eD(this.operand)??this.operand),this.modelValue=this.operand,e&&this.quotes)this.validationMessage=s.translate("advancedFilterValidationMissingQuote");else if(this.modelValue==="")this.validationMessage=s.translate("advancedFilterValidationMissingValue");else{const r=s.getOperandModelValue(this.operand,this.baseCellDataType,this.column);r!=null&&(this.modelValue=r),this.filterValidationSetters[this.baseCellDataType](r)}}},WD=class{constructor(e,t,s,i,r){this.params=e,this.baseCellDataType=s,this.column=i,this.expectedNumOperands=r,this.parsers=[],this.expectSeparator=!1,this.hasOpenBracket=!1,this.validation=new jd(e,t)}parse(e,t){return this.expectedNumOperands>1?this.parseSeveral(e,t):(this.startOperand(t),this.parser.parse(e,t))}complete(e){this.parser&&!this.expectSeparator&&this.finishOperand(e),!(this.expectedNumOperands<2)&&(this.parsers.length<this.expectedNumOperands?this.validation.reject("advancedFilterValidationMissingValue"):this.hasOpenBracket&&this.validation.reject("advancedFilterValidationMissingEndBracket"))}getValidationError(){const e=this.parsers;for(let t=0,s=e.length;t<s;++t){const i=e[t].getValidationError();if(i)return i}return this.validation.getError()}isComplete(){return this.parsers.length>=this.expectedNumOperands}getParsers(){return this.parsers}parseSeveral(e,t){const s=this.parser;if(!this.validation.isRejected()){if(s&&!this.expectSeparator&&s.isInsideQuotes())return this.delegate(e,t);if(e===" ")return s&&!this.expectSeparator&&this.finishOperand(t-1),this.expectSeparator&&this.isComplete()&&!this.hasOpenBracket?!0:void 0;if(e==="("&&!s&&!this.hasOpenBracket&&!this.parsers.length){this.hasOpenBracket=!0;return}return e===","?s?(this.expectSeparator||this.finishOperand(t-1),this.isComplete()&&!this.hasOpenBracket?!0:(this.parser=void 0,this.expectSeparator=!1,this.isComplete()?this.validation.reject("advancedFilterValidationMissingEndBracket",t):void 0)):this.validation.reject("advancedFilterValidationMissingValue",t):e===")"?(s&&!this.expectSeparator&&this.finishOperand(t-1),this.hasOpenBracket?this.isComplete()?!1:this.validation.reject("advancedFilterValidationMissingValue",t):(this.isComplete()||this.validation.reject("advancedFilterValidationMissingValue"),!0)):this.expectSeparator?this.validation.reject(this.isComplete()?"advancedFilterValidationMissingEndBracket":"advancedFilterValidationMissingValue",t):(this.startOperand(t),this.delegate(e,t))}}delegate(e,t){this.parser.parse(e,t)!=null&&(this.expectSeparator=!0)}startOperand(e){this.parser||(this.parser=new zD(this.params,e,this.baseCellDataType,this.column),this.parsers.push(this.parser))}finishOperand(e){this.parser.complete(e),this.expectSeparator=!0}},ca="[",ua="]",$D=class{constructor(e,t){this.params=e,this.startPosition=t,this.isAwaiting=!0,this.operandValueGetters={number:s=>gi(this.columnParser.column,this.params.gos)(s),bigint:s=>zr(this.columnParser.column,this.params.gos)(s),date:s=>this.params.valueSvc.parseValue(this.columnParser.column,null,s,void 0),dateString:s=>this.operandValueGetters.date(s),dateTime:s=>this.operandValueGetters.date(s),dateTimeString:s=>this.operandValueGetters.date(s),boolean:s=>s,object:s=>s,text:s=>s}}parseExpression(){let e=this.startPosition;const{expression:t}=this.params;for(;e<t.length;){const s=t[e];if(!(s===" "&&this.isAwaiting)){if(this.isAwaiting=!1,!this.parser){let r;this.columnParser?this.operatorParser?this.operatorParser.operands==="list"?(this.setOperandsParser??(this.setOperandsParser=new ND(this.params,e,this.columnParser.column)),r=this.setOperandsParser):(this.operandsParser??(this.operandsParser=new WD(this.params,e,this.columnParser.baseCellDataType,this.columnParser.column,di[this.operatorParser.operands])),r=this.operandsParser):(this.operatorParser=new HD(this.params,e,this.columnParser.baseCellDataType,this.columnParser.column),r=this.operatorParser):(this.columnParser=new VD(this.params,e),r=this.columnParser),this.parser=r}const i=this.parser.parse(s,e);if(i!=null){if(this.isComplete())return this.returnEndPosition(i?e-1:e,!0);this.parser=void 0,this.isAwaiting=!0}}e++}return this.parser?.complete?.(e-1),this.returnEndPosition(e)}isValid(){const e=this.getValidationError();return this.isComplete()&&(!e||!!e.advisory)}getValidationError(){const e=this.columnParser?.getValidationError()??this.operatorParser?.getValidationError()??this.operandsParser?.getValidationError()??this.setOperandsParser?.getValidationError();if(e)return e;const t=this.params.expression.length;let s;return this.columnParser?this.operatorParser?this.operatorParser.operands!=="none"&&!this.operandsParser&&!this.setOperandsParser&&(s="advancedFilterValidationMissingValue"):s="advancedFilterValidationMissingOption":s="advancedFilterValidationMissingColumn",s?{message:this.params.advFilterExpSvc.translate(s),startPosition:t,endPosition:t}:this.getRangeOrderError()}getRangeOrderError(){const[e,t]=this.getOperandParsers();if(this.operatorParser.operands!=="range"||!t)return null;const s=Kd(this.params.advFilterExpSvc,this.columnParser.getColId(),this.getOperandValue(e),this.getOperandValue(t),e.getRawValue());return s?{message:s,startPosition:t.startPosition,endPosition:t.endPosition??this.params.expression.length-1,selfContained:!0}:null}getFunction(e){const t=this.columnParser,s=t.getColId(),{operators:i,evaluatorParams:r,operands:n}=e,o=this.params.advFilterExpSvc,a=mi(i,o.getExpressionOperator(t.baseCellDataType,this.operatorParser?.getOperatorKey(),t.column)),l=mi(r,o.getExpressionEvaluatorParams(s)),c=this.setOperandsParser;if(c){const g=mi(n,this.params.advFilterSetSvc.createMatcher(t.column,c.getKeys()));return(f,m,v)=>v.operators[a].evaluator(void 0,m,v.evaluatorParams[l],v.operands[g])}const[u,d]=this.getOperandParsers(),h=u?mi(n,this.getOperandValue(u)):-1,p=d?mi(n,this.getOperandValue(d)):-1;return(g,f,m)=>m.operators[a].evaluator(g.getValue(s,f),f,m.evaluatorParams[l],h<0?void 0:m.operands[h],p<0?void 0:m.operands[p])}getAutocompleteListParams(e){if(this.isColumnPosition(e))return this.getColumnAutocompleteListParams(e);if(this.isOperatorPosition(e))return this.getOperatorAutocompleteListParams(e);if(!this.isBeyondEndPosition(e))return this.setOperandsParser?this.getSetValueAutocompleteListParams(e):{enabled:!1}}updateExpression(e,t,s){const{expression:i}=this.params,r=this.columnParser;if(this.isColumnPosition(e))return rs(i,this.startPosition,r?.getColId()?r.endPosition:na(i,e).endPosition,this.params.advFilterExpSvc.getColumnValue(t),!0);const n=this.setOperandsParser;if(n&&this.params.advFilterSetSvc.isSetValueType(s))return this.updateSetExpression(n,e,t);if(!this.isOperatorPosition(e))return null;const o=r.baseCellDataType,a=this.getOperandsKindFor(o,t.key),l=a==="list",c=a!=="none",u=this.operatorParser;let d=e,h=e,p=!1;if(u?.startPosition==null||e>=u.startPosition){if(u?.getOperatorKey())h=u.endPosition;else{const w=na(i,e,!0,!0);h=w.endPosition,p=w.isEmpty}d=ra(i,r.endPosition+1,h)}let g;l?g=$r:a==="range"&&(g="(");const f=KD(i,h+(p?0:1)),m=c&&(g?f===g:!!f),v=c&&!m,C=rs(i,d,h,t.displayValue??t.key,c,v&&!l&&this.doesOperandNeedQuotes(o),p,v?g:void 0),S=C.updatedValue;return{...C,updatedPosition:m?ra(S,C.updatedPosition,S.length)+1:C.updatedPosition,hideAutocomplete:!c}}getModel(e){const t=this.columnParser,s=this.setOperandsParser,i={colId:t.getColId(),type:this.operatorParser.getOperatorKey()};if(s)return{filterType:"set",...i,values:s.getKeys()};const[r,n]=this.getOperandParsers(),o={};return r&&(o.filter=e?r.getBuilderValue():r.getModelValue()),n&&(o.filterTo=e?n.getBuilderValue():n.getModelValue()),{filterType:t.baseCellDataType,...i,...o}}getOperandValue(e){const{baseCellDataType:t,column:s}=this.columnParser,i=this.operandValueGetters[t](e.getRawValue());return t==="dateString"||t==="dateTimeString"?this.params.dataTypeSvc?.getDateParserFunction(s)(i)??i:i}getOperandParsers(){return this.operandsParser?.getParsers()??[]}isComplete(){const e=this.operatorParser;return!!e&&(e.operands==="none"||!!(this.operandsParser??this.setOperandsParser)?.isComplete())}isColumnPosition(e){return this.columnParser?.endPosition==null||e<=this.columnParser.endPosition+1}isOperatorPosition(e){return this.operatorParser?.endPosition==null||e<=this.operatorParser.endPosition+1}isBeyondEndPosition(e){return this.isComplete()&&this.endPosition!=null&&e>this.endPosition+1&&this.endPosition+1<this.params.expression.length}returnEndPosition(e,t){return this.endPosition=t?e:e-1,e}getColumnAutocompleteListParams(e){return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getColumnAutocompleteEntries(),"column",this.getColumnSearchString(e))}getColumnSearchString(e){const t=this.columnParser?.getDisplayValue()??"",s=Wr(t,e,this.columnParser?.endPosition==null?this.params.expression.length:this.columnParser.endPosition+1),i=this.columnParser?.hasStartChar&&s.length>0,r=this.columnParser?.hasEndChar&&s.length===t.length+2;return i?s.slice(1,r?-1:void 0):s}getOperatorAutocompleteListParams(e){const t=this.columnParser?.column;if(!t)return{enabled:!1};const s=this.columnParser.baseCellDataType,i=this.operatorParser?.startPosition!=null&&e<this.operatorParser.startPosition?"":Wr(this.operatorParser?.getDisplayValue()??"",e,this.operatorParser?.endPosition==null?this.params.expression.length:this.operatorParser.endPosition+1);return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getOperatorAutocompleteEntries(t,s),`operator-${s}-${t?.getColId()}`,i)}getSetValueAutocompleteListParams(e){const t=this.columnParser?.column,s=this.setOperandsParser;if(!t)return{enabled:!1};const i=s.getValueAt(e);if(!i&&!s.isInList(e))return{enabled:!1};const r=s.getUsedKeys(i?.value),{advFilterSetSvc:n,advFilterExpSvc:o}=this.params,a=n.getAutocompleteList(t,r);let l="";if(i){const u=i.value.segments,d=i.segmentIndex,h=u[d],p=h?Wr(h.text,e,h.endPosition+1):"",g=[];for(let f=0;f<=d;++f){const m=f===d?p:u[f].text;a.isTree?g.push(...Kr(m)):g.push(m)}l=fi(g)}const c=o.generateAutocompleteListParams(a.entries,a.type,l);return c.rowComponentCreator=a.rowComponentCreator,c.loading=a.loading,c.suggestFirstMatch=!0,c}updateSetExpression(e,t,s){const i=this.params.expression,r=e.getValueAt(t),n=r?.value.startPosition??t,o=r?.value.endPosition??t-1,l=this.params.advFilterSetSvc.writeEntry(this.columnParser.column,s)+(r?.value.terminated?"":", ");return{updatedValue:i.slice(0,n)+l+i.slice(o+1),updatedPosition:n+l.length}}getOperandsKindFor(e,t){if(!t)return"one";const s=this.columnParser?.column;return this.params.advFilterExpSvc.getExpressionOperator(e,t,s)?.operands??"none"}doesOperandNeedQuotes(e){return e!=="number"&&e!=="bigint"}};function mi(e,t){return e.push(t)-1}function KD(e,t){const s=e[ra(e,t,e.length)];return s===$r||s==="("||s==='"'||s==="'"?s:void 0}var jD=["isAnyOf","isNoneOf"];function YD(e){const t=Wd(e);for(let s=0,i=t?.length??0;s<i;++s){const r=t[s];if(r==="isAnyOf"||r==="isNoneOf")return!0}return!1}function qD(e,t){const s={isAnyOf:{displayValue:t("advancedFilterIsAnyOf"),evaluator:(r,n,o,a)=>a(n)===!0,operands:"list"},isNoneOf:{displayValue:t("advancedFilterIsNoneOf"),evaluator:(r,n,o,a)=>a(n)===!1,operands:"list"}},i=Object.assign(Object.create(null),e.operators,s);return{operators:i,getEntries:r=>hi(i,r)}}function XD(e){return[...e,...jD]}function ZD(e,t){return e.includes(" ")||e.includes(")")||e.startsWith("'")||e.startsWith('"')||!!t&&e.includes(",")}function Qd(e){return e.includes('"')?e.includes("'")?null:"'":'"'}function vi(e){const t=Qd(e);return t?`${t}${e}${t}`:`"${e.replaceAll('"','""')}"`}var eh=["caseSensitive","includeBlanksInEquals","includeBlanksInNotEqual","includeBlanksInLessThan","includeBlanksInGreaterThan","includeBlanksInRange","inRangeInclusive"],JD=e=>Jd(e.map(vi)),da="agDateColumnFilter",QD=class extends Qy{constructor(){super(...arguments),this.beanName="advFilterExpSvc",this.wroteUnresolvedSetValue=!1,this.filterOperandGetters={number:e=>{const t=this.colModel.getNonPivotCol(e.colId);return this.applyOperandFormatter(e.filter,kD(t,this.gos),JE,gi(t,this.gos))},bigint:e=>{const t=this.colModel.getNonPivotCol(e.colId);return this.applyOperandFormatter(e.filter,DD(t,this.gos),kd,zr(t,this.gos))},date:e=>{const t=this.colModel.getNonPivotCol(e.colId);return t?this.valueSvc.formatValue(t,null,_d(ui(e.filter)??""),void 0,!0):null},dateTime:e=>this.filterOperandGetters.date(e),dateString:e=>{const t=this.colModel.getNonPivotCol(e.colId);if(!t)return null;const{filter:s}=e,r=this.dataTypeSvc?.getDateFormatterFunction(t)?.(_d(ui(e.filter)??"")??void 0)??s;return this.valueSvc.formatValue(t,null,r)},dateTimeString:e=>this.filterOperandGetters.dateString(e),boolean:()=>null,object:()=>null,text:()=>null},this.operandModelValueGetters={number:(e,t)=>e!=null&&e!==""?gi(t,this.gos)(e):null,bigint:(e,t)=>{const s=zr(t,this.gos)(e);return s==null?null:String(s)},date:(e,t,s)=>Gd(this.valueSvc.parseValue(t,null,e,void 0),!!this.dataTypeSvc?.getDateIncludesTimeFlag(s)),dateTime:(...e)=>this.operandModelValueGetters.date(...e),dateString:(e,t,s)=>{const i=this.valueSvc.parseValue(t,null,e,void 0);return this.dataTypeSvc?Gd(this.dataTypeSvc.getDateParserFunction(t)(i)??null,this.dataTypeSvc.getDateIncludesTimeFlag(s)):i},dateTimeString:(...e)=>this.operandModelValueGetters.dateString(...e),boolean:e=>e,object:e=>e,text:e=>e},this.columnNameToIdMap=Object.create(null),this.columnAutocompleteEntries=null,this.expressionEvaluatorParams=Object.create(null),this.columnExpressionOperators=new WeakMap}wireBeans(e){this.valueSvc=e.valueSvc,this.colModel=e.colModel,this.colNames=e.colNames,this.dataTypeSvc=e.dataTypeSvc,this.advFilterSetSvc=e.advFilterSetSvc}postConstruct(){this.expressionJoinOperators=this.generateExpressionJoinOperators(),this.expressionOperators=this.generateExpressionOperators();const e=this.resetColumnCaches.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnRowGroupChanged:e,columnPivotModeChanged:e,columnPivotChanged:e,columnHeaderNameChanged:e})}parseJoinOperator(e){const{type:t}=e;return this.expressionJoinOperators[t]??t}getColumnDisplayValue(e){const s=this.getColumnAutocompleteEntries().find(({key:r})=>r===e);let i;return s?(i=s.displayValue,this.columnNameToIdMap[i.toLocaleUpperCase()]={colId:e,columnName:i}):i=e,i}applyOperandFormatter(e,t,s,i){const r=ui(e);if(r==null||r.trim()==="")return"";if(!t)return r;const n=s(r),o=n==null?null:t(n);if(o==null||o.trim()==="")return r;const a=i(o);return a!=null&&String(a)===String(n)?o:r}getOperatorDisplayValue(e){return this.getModelOperator(e)?.displayValue??e.type}getModelOperator(e){const t=e.filterType,{column:s,baseCellDataType:i}=this.getColumnDetails(e.colId);return this.getExpressionOperator(t==="set"?i:t,e.type,s)}getOperandModelValue(e,t,s){return this.operandModelValueGetters[t](e,s,t)}isOperandModelValueEditable(e,t){return e==="number"?!_D(t):e!=="bigint"}getOperandDisplayValue(e){if(e.filterType==="set")return this.getSetOperandDisplayValue(e);const{filter:t,filterTo:s}=e,i=this.getModelOperator(e),r=i?di[i.operands]:void 0;return r===0?"":r!==2?t==null?"":` ${this.formatOperand(e,t)}`:` (${this.formatOperand(e,t,!1,!0)}, ${this.formatOperand(e,s,!1,!0)})`}getSetOperandDisplayValue(e){const t=e.values;if(!t?.length)return"";const s=this.colModel.getNonPivotColById(e.colId),i=new Set;for(let r=0,n=t.length;r<n;++r){const o=t[r],a=s?this.advFilterSetSvc.getPath(s,o):void 0;if(s&&a){i.add(this.advFilterSetSvc.writePath(s,a));continue}this.wroteUnresolvedSetValue=!0,i.add(vi(o??(s?this.advFilterSetSvc.getBlankLabel(s):void 0)??""))}return` ${$r}${Array.from(i).join(", ")}${aa}`}formatOperand(e,t,s,i){if(t==null)return"";const{filterType:r,colId:n}=e,o=ui(t)??"";let a=Or(this.filterOperandGetters,r)?.({filter:t,colId:n})??o;const l=r==="number"||r==="bigint";if(!s&&(!l||ZD(a,i))){const c=Qd(a);c?a=`${c}${a}${c}`:l?a=o:a=`"${a}"`}return a}parseColumnFilterModel(e){const t=this.getColumnDisplayValue(e.colId)??"",s=this.getOperatorDisplayValue(e)??"",i=this.getOperandDisplayValue(e);return`[${t}] ${s}${i}`}updateAutocompleteCache(e,t){if(t==="column"){const{key:s,displayValue:i}=e;this.columnNameToIdMap[e.displayValue.toLocaleUpperCase()]={colId:s,columnName:i}}}translate(e,t){let s=QE[e];return typeof s=="function"&&(s=s(t)),this.getLocaleTextFunc()(e,s,t)}generateAutocompleteListParams(e,t,s){return{enabled:!0,type:t,searchString:s,entries:e}}getColumnAutocompleteEntries(){if(this.columnAutocompleteEntries)return this.columnAutocompleteEntries;const e=this.colModel.colDefList,t=[],s=this.gos.get("includeHiddenColumnsInAdvancedFilter");for(const i of e)i.colDef.filter&&(s||i.isVisible()||i.isRowGroupActive())&&t.push({key:i.colId,displayValue:this.colNames.getDisplayNameForColumn(i,"advancedFilter")});return t.sort((i,r)=>{const n=i.displayValue??"",o=r.displayValue??"";return n<o?-1:o>n?1:0}),this.columnAutocompleteEntries=t,t}getOperatorAutocompleteEntries(e,t){const s=this.getColumnOperators(t,e);return s?s.operators.getEntries(s.activeOperators):[]}getJoinOperatorAutocompleteEntries(){return Object.entries(this.expressionJoinOperators).map(([e,t])=>({key:e,displayValue:t}))}getDefaultAutocompleteListParams(e){return this.generateAutocompleteListParams(this.getColumnAutocompleteEntries(),"column",e)}getExpressionOperator(e,t,s){return Or(this.getColumnOperators(e,s)?.operators.operators,t)}isOperatorOffered(e,t,s){const i=this.getColumnOperators(e,s);if(!t||!Or(i?.operators.operators,t))return!1;const r=i.activeOperators;return!r||r.includes(t)}getColumnOperators(e,t){const s=this.expressionOperators[e];if(!s)return;if(!t)return{operators:s,activeOperators:s.defaultOperators};const i=this.columnExpressionOperators;let r=i.get(t);r||(r=Object.create(null),i.set(t,r));let n=r[e];return n||(n=this.createColumnOperators(s,t),r[e]=n),n}createColumnOperators(e,t){const s=this.advFilterSetSvc.offersSetOperators(t);let i=s?qD(e,o=>this.translate(o)):e,r=e.defaultOperators;s&&r&&(r=XD(r));const n=Wd(t);if(n){const{offered:o,customOptions:a}=XE(n,u=>this.warn(72,{keys:u}),null);if(a.size){const u=this.gos;i=RD(i,a,this.getLocaleTextFunc(),()=>ZE(u,t,"advancedFilter"))}const l=i.operators,c=[];for(const u of o.keys())Or(l,u)&&c.push(u);c.length&&(r=c)}return{operators:i,activeOperators:r}}getDateFilterParams(e,t){if(Od(t)!==da)return;const{filter:s,filterParams:i}=e.colDef;return s==="agMultiColumnFilter"?pi(i,da)?.filterParams:s===!0||s===da||this.advFilterSetSvc.hasSetFilter(e)?i:void 0}getExpressionJoinOperators(){return this.expressionJoinOperators}getColId(e){const t=e.toLocaleUpperCase(),s=this.columnNameToIdMap[t];if(s)return s;const r=this.getColumnAutocompleteEntries().find(({displayValue:n})=>n.toLocaleUpperCase()===t);if(r){const{key:n,displayValue:o}=r,a={colId:n,columnName:o};return this.columnNameToIdMap[t]=a,a}return null}getExpressionEvaluatorParams(e){let t=this.expressionEvaluatorParams[e];if(t)return t;const s=this.colModel.getNonPivotColById(e);if(!s)return{valueConverter:c=>c};const i=this.dataTypeSvc?.getBaseDataType(s);let r=!1;switch(i){case"dateTimeString":case"dateString":t={valueConverter:this.dataTypeSvc?.getDateParserFunction(s)??(c=>c)},r=!0;break;case"object":s.colDef.filterValueGetter?t={valueConverter:c=>c}:t={valueConverter:(c,u)=>this.valueSvc.formatValue(s,u,c)??(typeof c.toString=="function"?c.toString():"")};break;case"bigint":t={valueConverter:c=>kd(c)};break;case"text":case void 0:t={valueConverter:c=>ui(c)};break;default:t={valueConverter:c=>c};break}const{filter:n,filterParams:o}=s.colDef,a=n==="agMultiColumnFilter"?pi(o,Od(i))?.filterParams:o;if(a)for(let c=0,u=eh.length;c<u;++c){const d=eh[c],h=a[d];h&&(t[d]=h)}this.addTextFilterParams(t,s,i);const l=this.getDateFilterParams(s,i);if(l){const{comparator:c,isValidDate:u}=l,d=c&&!Nd(c)&&!this.advFilterSetSvc.hasSetFilter(s)?c:void 0,h=r&&!d;t.comparator=d,t.isValid=h&&Nd(u)?void 0:u}return this.expressionEvaluatorParams[e]=t,t}addTextFilterParams(e,t,s){const i=qd(t,s,this.advFilterSetSvc);if(!i)return;const{textFormatter:r,textMatcher:n}=i,o=this.gos,a=qE(r,o,t,"advancedFilter");e.textFormatter=a,n&&(e.textMatcher=(l,c,u,d)=>n(YE(o,{colDef:t.colDef,column:t,node:d,data:d.data,filterOption:l,value:c,filterText:u,textFormatter:a,source:"advancedFilter"})))}getColumnDetails(e){const t=this.colModel.getNonPivotColById(e),s=(t?this.dataTypeSvc?.getBaseDataType(t):void 0)??"text";return{column:t,baseCellDataType:s}}generateExpressionOperators(){const t={translate:(i,r)=>this.translate(i,r)},s={...t,equals:(i,r)=>i.getTime()===r.getTime(),relativeDates:!0};return{text:new Vd(t),boolean:new mD(t),object:new Vd(t),number:new xs({...t,equals:(i,r)=>i===r}),bigint:new xs({...t,equals:(i,r)=>i===r}),date:new xs(s),dateString:new xs(s),dateTime:new xs(s),dateTimeString:new xs(s)}}getColumnValue({displayValue:e}){return`${ca}${e}${ua}`}generateExpressionJoinOperators(){return{AND:this.translate("advancedFilterAnd"),OR:this.translate("advancedFilterOr")}}resetColumnCaches(){this.columnAutocompleteEntries=null,this.columnNameToIdMap=Object.create(null),this.expressionEvaluatorParams=Object.create(null),this.columnExpressionOperators=new WeakMap}};import{BeanStub as eL,_isClientSideRowModel as tL,_isServerSideRowModel as sL}from"ag-grid-community";import{_getAbsoluteHeight as iL,_getAbsoluteWidth as rL,_initStyledRoot as nL}from"ag-stack";import{BeanStub as oL,_clamp as aL}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as lL,_focusNextGridCoreContainer as cL}from"ag-grid-community";var th={stopPropagationCallbacks:lL,focusNextContainer:(e,t)=>cL(e,t,"direct"),configureFocusableContainer:(e,t)=>{const s=e.ctrlsSvc.get("gridCtrl");s.addFocusableContainer(t),t.addDestroyFunc(()=>s.removeFocusableContainer(t))}},ns=class extends qo{constructor(e){super(e,th)}getFocusableContainerName(){return"dialog"}};import{RefPlaceholder as Ci,_makeNull as uL,_setDisabled as sh,_setDisplayed as ih}from"ag-stack";import{AgFilterButtonSelector as dL,Component as hL,_createIconNoSpan as pL}from"ag-grid-community";import{RefPlaceholder as gL,_makeNull as rh}from"ag-stack";import{AgInputTextFieldSelector as fL,Component as mL,KeyCode as He}from"ag-grid-community";var ha=".ag-autocomplete{align-items:center;display:flex;width:100%;>:where(.ag-text-field){flex:1 1 auto}}.ag-autocomplete-row-path-parent{opacity:.5}.ag-autocomplete-list-popup{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-autocomplete-list{height:calc(var(--ag-row-height)*6.5);min-width:200px;position:relative;width:100%}.ag-autocomplete-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);&:focus-visible:after{content:none}}.ag-autocomplete-virtual-list-item:hover{background-color:var(--ag-row-hover-color)}.ag-autocomplete-row{align-items:center;display:flex;flex:1 1 auto;overflow:hidden}.ag-autocomplete-row-label{margin:0 var(--ag-widget-container-horizontal-padding);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-autocomplete-row-selected{background-color:var(--ag-selected-row-background-color)}.ag-autocomplete-loading{min-width:200px;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);:where(.ag-loading-text){overflow:hidden;text-overflow:ellipsis;white-space:nowrap}}";import{AgPopupComponent as vL,RefPlaceholder as pa,_exists as CL,_isVisible as SL,_setAriaActiveDescendant as bL,_setAriaSelected as yL}from"ag-stack";import{KeyCode as jr,_clamp as wL,_createIconNoSpan as xL}from"ag-grid-community";import{_STOP_PROPAGATION_CALLBACKS as FL}from"ag-grid-community";var Fs=class extends hd{constructor(e){super(FL,e)}};import{_clearElement as TL,_exists as AL}from"ag-stack";import{Component as PL,_createElement as RL}from"ag-grid-community";var ML={tag:"div",cls:"ag-autocomplete-row",role:"presentation",children:[{tag:"div",cls:"ag-autocomplete-row-label"}]},nh=class extends ew{constructor(){super(ML),this.hasHighlighting=!1}getLabel(){return this.getGui().lastElementChild}afterLabelRendered(){}setState(e,t){this.value=e,this.render(),this.updateSelected(t)}updateSelected(e){this.toggleCss("ag-autocomplete-row-selected",e)}setSearchString(e){let t=!1;const{value:s}=this;if(s&&AL(e)){const i=s.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());if(i>=0){t=!0,this.hasHighlighting=!0;const r=i+e.length,n=this.getLabel();TL(n),n.append(s.slice(0,i),RL({tag:"b",children:s.slice(i,r)}),s.slice(r)),this.afterLabelRendered()}}!t&&this.hasHighlighting&&(this.hasHighlighting=!1,this.render())}render(){this.getLabel().textContent=this.value??"\xA0",this.afterLabelRendered()}},IL=e=>({tag:"div",cls:"ag-autocomplete-list-popup",children:[e?{tag:"div",cls:"ag-loading ag-autocomplete-loading",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingLabel",cls:"ag-loading-text"}]}:null,{tag:"div",ref:"eList",cls:`ag-autocomplete-list${e?" ag-hidden":""}`,attrs:e?{"aria-hidden":"true"}:void 0}]}),ga=class extends tw{constructor(e){super(IL(!!e.loading)),this.params=e,this.eList=pa,this.eLoadingIcon=pa,this.eLoadingLabel=pa,this.selectedIndex=-1,this.searchString="",this.lastAutoListHeight=null,this.registerCSS(ha)}postConstruct(){this.setupLoading(),this.autocompleteEntries=this.params.autocompleteEntries,this.virtualList=this.createManagedBean(new Fs({cssIdentifier:"autocomplete"}));const e=this.virtualList,t=e.getGui();e.getAriaElement().id=this.getListId(),e.setComponentCreator(this.createRowComponent.bind(this)),this.eList.appendChild(t),e.setModel({getRowCount:()=>this.autocompleteEntries.length,getRow:i=>this.autocompleteEntries[i]});const s=i=>{i.type==="mousedown"&&i.preventDefault(),this.selectRowUnderMouse(i)};this.addManagedListeners(t,{click:()=>this.params.onConfirmed(),mousemove:s,mousedown:s}),this.setSelectedValue(0),this.updateListHeight()}setupLoading(){if(!this.params.loading)return;this.eLoadingLabel.textContent=this.getLocaleTextFunc()("loadingOoo","Loading...");const e=xL("setFilterLoading",this.beans,null);e&&this.eLoadingIcon.appendChild(e)}getActiveOptionId(){const e=this.selectedIndex;return e>=0&&this.autocompleteEntries[e]===this.selectedValue?this.getOptionId(e):null}getListId(){return`ag-autocomplete-list-${this.getCompId()}`}onNavigationKeyDown(e,t){if(e.preventDefault(),!this.autocompleteEntries.length)return;const s=this.selectedIndex,i=this.autocompleteEntries[s]===this.selectedValue?s:-1;let r=0;if(i>=0){const a=t===jr.PAGE_UP||t===jr.PAGE_DOWN?this.getPageSize():1;r=t===jr.UP||t===jr.PAGE_UP?i-a:i+a}const n=this.autocompleteEntries.length-1;this.setSelectedValue(wL(r,0,n))}getPageSize(){const e=this.virtualList,t=e.getRowHeight(),s=e.getGui().getBoundingClientRect().height;return t>0?Math.max(1,Math.floor(s/t)):1}setSearch(e){this.searchString=e,CL(e)?this.runSearch():(this.autocompleteEntries=this.params.autocompleteEntries,this.refreshVirtualList(),this.checkSetSelectedValue(0),this.updateListHeight())}runContainsSearch(e,t){const s=e.toLocaleLowerCase(),i=[];let r=-1,n=0,o=!1;for(let a=0,l=t.length;a<l;++a){const c=t[a],u=c.searchValue??c.displayValue??c.key,d=u.toLocaleLowerCase().indexOf(s);if(d<0)continue;const h=d===0;(r<0||!o&&h||o===h&&u.length<n)&&(r=i.length,n=u.length,o=h),i.push(c)}return{matches:i,topIndex:r}}runStartsWithSearch(e,t){const s=e.toLocaleLowerCase(),i=[];for(let r=0,n=t.length;r<n;++r){const o=t[r];(o.searchValue??o.displayValue??o.key).toLocaleLowerCase().startsWith(s)&&i.push(o)}return i}runSearch(){const{autocompleteEntries:e,useStartsWithSearch:t,suggestFirstMatch:s,forceLastSelection:i}=this.params,r=this.searchString;let n,o=0;t?n=this.runStartsWithSearch(r,e):({matches:n,topIndex:o}=this.runContainsSearch(r,e),s&&(o=0));const a=this.selectedValue;!n.length&&a&&i?.(a,r)&&(n=[a],o=0),this.autocompleteEntries=n,this.refreshVirtualList(),this.updateListHeight(),this.checkSetSelectedValue(o)}updateListHeight(){if(!this.params.autoSizeList)return;const e=this.autocompleteEntries.length,t=this.virtualList.getRowHeight(),s=this.params.maxVisibleItems??e;let r=Math.min(e,s)*t;e===0&&(r=t),this.lastAutoListHeight!==r&&(this.lastAutoListHeight=r,this.eList.style.height=`${r}px`,SL(this.eList)&&this.params.onListHeightChanged?.())}checkSetSelectedValue(e){e>=0&&e<this.autocompleteEntries.length&&this.setSelectedValue(e)}refreshVirtualList(){this.virtualList.refresh(),this.virtualList.awaitStable(()=>{this.refreshRenderedRowsAria(),this.refreshActiveDescendant()})}setSelectedValue(e){const t=this.autocompleteEntries[e];if(this.selectedIndex=t===void 0?-1:e,this.selectedValue===t){this.refreshRenderedRowsAria(),this.refreshActiveDescendant();return}this.selectedValue=t,this.virtualList.ensureIndexVisible(e),this.refreshRenderedRowsAria(),this.refreshActiveDescendant()}refreshRenderedRowsAria(){this.virtualList.forEachRenderedRow((e,t)=>{const i=e.getGui().parentElement;i instanceof HTMLElement&&this.updateRowAriaProperties(e,i,t)})}refreshActiveDescendant(){const e=this.getActiveOptionId();bL(this.virtualList.getAriaElement(),e),this.params.onActiveOptionChanged?.(e)}updateRowAriaProperties(e,t,s){const i=this.autocompleteEntries[s]===this.selectedValue;e.updateSelected(i),yL(t,i),t.setAttribute("id",this.getOptionId(s))}getOptionId(e){return`${this.getListId()}-option-${e}`}createRowComponent(e,t,s){const i=e===this.selectedValue;let r=this.params.rowComponentCreator?.(e,i);if(r)this.createBean(r);else{const n=new nh;this.createBean(n),n.setState(e.displayValue??e.key,i),r=n}return r.setSearchString(this.searchString),this.updateRowAriaProperties(r,t,s),r}selectRowUnderMouse(e){const t=this.virtualList,s=t.getGui().getBoundingClientRect(),i=t.getScrollTop(),r=e.clientY-s.top+i,n=Math.floor(r/t.getRowHeight());this.checkSetSelectedValue(n)}afterGuiAttached(){this.refreshVirtualList(),this.updateListHeight()}getSelectedValue(){return this.autocompleteEntries.length?this.selectedValue??null:null}},EL={tag:"div",cls:"ag-autocomplete",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eAutocompleteInput"}]},DL=class extends sw{constructor(){super(EL,[fL]),this.eAutocompleteInput=gL,this.isListOpen=!1,this.lastPosition=0,this.valid=!0,this.registerCSS(ha)}wireBeans(e){this.popupSvc=e.popupSvc}postConstruct(){this.eAutocompleteInput.onValueChange(e=>this.onValueChanged(e)),this.eAutocompleteInput.setAutoComplete(!1),this.addGuiEventListener("keydown",this.onKeyDown.bind(this)),this.addGuiEventListener("click",this.updatePositionAndList.bind(this)),this.addDestroyFunc(()=>{this.destroyBean(this.autocompleteList)}),this.addGuiEventListener("focusout",()=>this.onFocusOut())}onValueChanged(e){const t=rh(e);this.updateValue(t),this.updateAutocompleteList(t)}updateValue(e){this.updateLastPosition(),this.dispatchLocalEvent({type:"eventValueChanged",value:e}),this.validate(e)}updateAutocompleteList(e){const t=this.listGenerator?.(e,this.lastPosition)??{enabled:!1};(!t.type||t.type!==this.autocompleteListParams?.type)&&this.isListOpen&&this.closeList();const s=this.isListOpen;if(this.autocompleteListParams=t,t?.enabled){s||this.openList();const{searchString:i}=t;this.autocompleteList.setSearch(i??"")}else s&&this.closeList()}onKeyDown(e){const t=e.key;switch(this.updateLastPosition(),t){case He.ENTER:this.onEnterKeyDown(e);break;case He.TAB:this.onTabKeyDown(e);break;case He.DOWN:case He.UP:case He.PAGE_DOWN:case He.PAGE_UP:this.onUpDownKeyDown(e,t);break;case He.LEFT:case He.RIGHT:case He.PAGE_HOME:case He.PAGE_END:setTimeout(()=>{this.updatePositionAndList()});break;case He.ESCAPE:this.onEscapeKeyDown(e);break;case He.SPACE:e.ctrlKey&&!this.isListOpen&&(e.preventDefault(),this.forceOpenList());break}}confirmSelection(){const e=this.autocompleteList?.getSelectedValue();e&&(this.closeList(),this.dispatchLocalEvent({type:"eventOptionSelected",value:this.getValue(),position:this.lastPosition,updateEntry:e,autocompleteType:this.autocompleteListParams.type}))}onTabKeyDown(e){this.isListOpen&&(e.preventDefault(),e.stopPropagation(),this.confirmSelection())}onEnterKeyDown(e){e.preventDefault(),this.isListOpen?this.confirmSelection():this.onCompleted()}onUpDownKeyDown(e,t){e.preventDefault(),this.isListOpen?this.autocompleteList?.onNavigationKeyDown(e,t):this.forceOpenList()}onEscapeKeyDown(e){this.isListOpen&&(e.preventDefault(),e.stopPropagation(),this.closeList(),this.setCaret(this.lastPosition,!0))}onFocusOut(){this.isListOpen&&this.closeList()}updatePositionAndList(){this.updateLastPosition(),this.updateAutocompleteList(this.eAutocompleteInput.getValue()??null)}setCaret(e,t){t&&this.eAutocompleteInput.getFocusableElement().focus();const s=this.eAutocompleteInput.getInputElement();s.setSelectionRange(e,e),this.updateLastPosition(),e===s.value.length&&(s.scrollLeft=s.scrollWidth)}forceOpenList(){this.onValueChanged(this.eAutocompleteInput.getValue())}updateLastPosition(){this.lastPosition=this.eAutocompleteInput.getInputElement().selectionStart??0}validate(e){if(!this.validator)return;const t=this.validator(e);this.eAutocompleteInput.getInputElement().setCustomValidity(t??""),this.valid=!t,this.dispatchLocalEvent({type:"eventValidChanged",isValid:this.valid,validationMessage:t})}openList(){this.isListOpen=!0,this.autocompleteList=this.createBean(new ga({autocompleteEntries:this.autocompleteListParams.entries,onConfirmed:()=>this.confirmSelection(),forceLastSelection:this.forceLastSelection,rowComponentCreator:this.autocompleteListParams.rowComponentCreator,suggestFirstMatch:this.autocompleteListParams.suggestFirstMatch,loading:this.autocompleteListParams.loading}));const e=this.autocompleteList.getGui(),t={ePopup:e,type:"autocomplete",eventSource:this.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0},s=this.popupSvc.addPopup({eChild:e,anchorToElement:this.getGui(),positionCallback:()=>this.popupSvc.positionPopupByComponent(t),ariaLabel:this.listAriaLabel});this.hidePopup=s.hideFunc,this.autocompleteList.afterGuiAttached()}closeList(){this.isListOpen=!1,this.hidePopup(),this.destroyBean(this.autocompleteList),this.autocompleteList=null}onCompleted(){this.isListOpen&&this.closeList(),this.dispatchLocalEvent({type:"eventValueConfirmed",value:this.getValue(),isValid:this.isValid()})}getValue(){return rh(this.eAutocompleteInput.getValue())}getCaretPosition(){return this.lastPosition}setInputPlaceholder(e){return this.eAutocompleteInput.setInputPlaceholder(e),this}setInputAriaLabel(e){return this.eAutocompleteInput.setInputAriaLabel(e),this}setListAriaLabel(e){return this.listAriaLabel=e,this}setListGenerator(e){return this.listGenerator=e,this}setValidator(e){return this.validator=e,this}isValid(){return this.valid}setValue(e){const{value:t,position:s,silent:i,updateListOnlyIfOpen:r,restoreFocus:n}=e;this.eAutocompleteInput.setValue(t,!0),this.setCaret(s??this.lastPosition,n),i||this.updateValue(t),(!r||this.isListOpen)&&this.updateAutocompleteList(t)}refresh(e){const t=this.getValue();e&&this.updateValue(t),this.isListOpen&&this.updateAutocompleteList(t)}setForceLastSelection(e){return this.forceLastSelection=e,this}setInputDisabled(e){return this.eAutocompleteInput.setDisabled(e),this}},LL={selector:"AG-AUTOCOMPLETE",component:DL},fa={buttons:["apply"],suppressBuilderButton:!1},oh={apply:"advancedFilterApply",clear:"advancedFilterClear",cancel:"advancedFilterCancel",reset:"advancedFilterReset"},kL={tag:"div",cls:"ag-advanced-filter",role:"presentation",attrs:{tabindex:"-1"},children:[{tag:"ag-autocomplete",ref:"eAutocomplete"},{tag:"ag-filter-button",ref:"eButtons",cls:"ag-advanced-filter-buttons"},{tag:"button",ref:"eBuilderFilterButton",cls:"ag-button ag-advanced-filter-builder-button",children:[{tag:"span",ref:"eBuilderFilterButtonIcon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eBuilderFilterButtonLabel",cls:"ag-advanced-filter-builder-button-label"}]}]},ah=class extends iw{constructor(){super(kL,[LL,dL]),this.eAutocomplete=Ci,this.eButtons=Ci,this.eBuilderFilterButton=Ci,this.eBuilderFilterButtonIcon=Ci,this.eBuilderFilterButtonLabel=Ci,this.expressionParser=null,this.isApplyDisabled=!0,this.builderOpen=!1}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc,this.advancedFilter=e.advancedFilter,this.advFilterSetSvc=e.advFilterSetSvc,this.filterManager=e.filterManager}postConstruct(){if(this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipShowDelayOverride:()=>1e3,getLocation:()=>"advancedFilter"})),this.eAutocomplete.setListGenerator((s,i)=>this.generateAutocompleteListParams(i)).setValidator(()=>this.validateValue()).setForceLastSelection((s,i)=>this.forceLastSelection(s,i)).setInputAriaLabel(this.advFilterExpSvc.translate("ariaAdvancedFilterInput")).setListAriaLabel(this.advFilterExpSvc.translate("ariaLabelAdvancedFilterAutocomplete")),this.refresh(),this.advFilterSetSvc){const s=this.advFilterSetSvc;this.addManagedListeners(s,{valuesChanged:()=>this.eAutocomplete.refresh(!this.advancedFilter.isCurrentExpressionApplied())}),this.addManagedElementListeners(this.eAutocomplete.getGui(),{focusin:()=>s.refreshValuesOnFocus()})}this.addManagedListeners(this.eAutocomplete,{eventValueChanged:({value:s})=>this.onValueChanged(s),eventValueConfirmed:({isValid:s})=>this.onValueConfirmed(s),eventOptionSelected:({position:s,updateEntry:i,autocompleteType:r})=>this.onOptionSelected(s,i,r),eventValidChanged:({isValid:s,validationMessage:i})=>this.onValidChanged(s,i)});const{buttons:e,suppressBuilderButton:t}={...fa,...this.gos.get("advancedFilterParams")};this.setupButtons(e),this.setupBuilderButton(t),this.beans.gos.addManagedPropertyListener("advancedFilterParams",s=>{const i={...fa,...s.currentValue},r={...fa,...s.previousValue};if(i.buttons!==r.buttons){const n=i.buttons.map(o=>({type:o,label:this.advFilterExpSvc.translate(oh[o])}));this.eButtons.updateButtons(n)}i.suppressBuilderButton!==r.suppressBuilderButton&&ih(this.eBuilderFilterButton,!i.suppressBuilderButton)})}refresh(){const e=this.advancedFilter.getExpressionDisplayValue();this.eAutocomplete.setValue({value:e??"",position:e?.length,updateListOnlyIfOpen:!0})}setInputDisabled(e){this.eAutocomplete.setInputDisabled(e),this.eButtons.updateValidity(!e&&!this.isApplyDisabled&&!this.advancedFilter.isCurrentExpressionApplied())}setupButtons(e){const t=e.map(i=>({type:i,label:this.advFilterExpSvc.translate(oh[i])})),s=i=>()=>{this.updateModel(i)};this.eButtons.addManagedListeners(this.eButtons,{apply:s("apply"),clear:s("clear"),reset:s("reset"),cancel:s("cancel")}),this.eButtons.updateButtons(t),this.eButtons.updateValidity(!this.isApplyDisabled)}updateModel(e){switch(e){case"apply":this.onValueConfirmed(this.eAutocomplete.isValid());break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":this.advancedFilter.setModel(this.advancedFilter.getModel()),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"clear":this.eAutocomplete.setValue({value:"",restoreFocus:!0});break}}setupBuilderButton(e){this.eBuilderFilterButtonIcon.appendChild(pL("advancedFilterBuilder",this.beans)),this.eBuilderFilterButtonLabel.textContent=this.advFilterExpSvc.translate("advancedFilterBuilder"),this.activateTabIndex([this.eBuilderFilterButton]),this.addManagedElementListeners(this.eBuilderFilterButton,{click:()=>this.openBuilder()}),this.addManagedListeners(this.advancedFilter.getCtrl(),{advancedFilterBuilderClosed:()=>this.closeBuilder()}),ih(this.eBuilderFilterButton,!e)}onValueChanged(e){e=uL(e),this.expressionParser=this.advancedFilter.createExpressionParser(e);let t=this.expressionParser?.parseExpression()??null;const s=this.eAutocomplete.getCaretPosition(),i=this.stripRedundantSeparators(s);let r;i!=null&&(r=s-(t.length-i.length),t=i),t!=null&&t!==e&&(e=t,this.eAutocomplete.setValue({value:e,position:r,silent:!0,restoreFocus:!0})),this.advancedFilter.setExpressionDisplayValue(e)}stripRedundantSeparators(e){const t=this.expressionParser?.stripRedundantSeparators(e)??null;return t!=null&&(this.expressionParser=this.advancedFilter.createExpressionParser(t),this.expressionParser.parseExpression()),t}onValueConfirmed(e){if(!e||this.isApplyDisabled)return;this.eButtons?.updateValidity(!1);const t=this.stripRedundantSeparators(this.eAutocomplete.getValue()?.length??0);t!=null&&(this.eAutocomplete.setValue({value:t,position:t.length,silent:!0,updateListOnlyIfOpen:!0}),this.advancedFilter.setExpressionDisplayValue(t)),this.advancedFilter.applyExpression(),this.filterManager?.onFilterChanged({source:"advancedFilter"})}onOptionSelected(e,t,s){const{updatedValue:i,updatedPosition:r,hideAutocomplete:n}=this.updateExpression(e,t,s);this.eAutocomplete.setValue({value:i,position:r,updateListOnlyIfOpen:n,restoreFocus:!0})}validateValue(){return this.expressionParser?.getValidationMessage()??null}onValidChanged(e,t){this.isApplyDisabled=!e||this.advancedFilter.isCurrentExpressionApplied(),this.eButtons.updateValidity(!this.isApplyDisabled),this.tooltipFeature?.setTooltipAndRefresh(t)}generateAutocompleteListParams(e){return this.expressionParser?this.expressionParser.getAutocompleteListParams(e):this.advFilterExpSvc.getDefaultAutocompleteListParams("")}updateExpression(e,t,s){return this.advFilterExpSvc.updateAutocompleteCache(t,s),this.expressionParser?.updateExpression(e,t,s)??this.advancedFilter.getDefaultExpression(t)}forceLastSelection({key:e,displayValue:t},s){return!!s.toLocaleLowerCase().match(`^${(t??e).toLocaleLowerCase()}\\s*$`)}openBuilder(){this.builderOpen||(this.builderOpen=!0,sh(this.eBuilderFilterButton,!0),this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui",eventSource:this.eBuilderFilterButton}))}closeBuilder(){this.builderOpen&&(this.builderOpen=!1,sh(this.eBuilderFilterButton,!1),this.eBuilderFilterButton.focus())}};import{RefPlaceholder as _L,_clearElement as GL,_findNextFocusableElement as OL,_focusInto as NL,_getActiveDomElement as BL,_setAriaColIndex as VL,_setAriaColSpan as HL,_setAriaRole as UL,_setAriaRowIndex as zL,_setDisplayed as WL}from"ag-stack";import{Component as $L,KeyCode as Si,_getFloatingFiltersHeight as KL}from"ag-grid-community";var jL={tag:"div",cls:"ag-row ag-full-width-row ag-advanced-filter-header",role:"row",children:[{tag:"div",cls:"ag-full-width-anchor",role:"presentation",ref:"eFullWidthAnchor"}]},YL=class extends rw{constructor(e){super(jL),this.enabled=e,this.eFullWidthAnchor=_L}wireBeans(e){this.colModel=e.colModel,this.focusSvc=e.focusSvc,this.ctrlsSvc=e.ctrlsSvc}postConstruct(){this.setupAdvancedFilter(this.enabled),this.addDestroyFunc(()=>this.destroyBean(this.eAdvancedFilter));const e=this.refreshLayout.bind(this);this.addManagedEventListeners({gridColumnsChanged:()=>this.onGridColumnsChanged(),headerRowsChanged:()=>this.setAriaRowIndex(),columnHeaderHeightChanged:e,stylesChanged:e}),this.addManagedPropertyListener("headerHeight",e),this.addManagedPropertyListener("floatingFiltersHeight",e),this.addGuiEventListener("keydown",t=>this.onKeyDown(t)),this.addGuiEventListener("focusout",t=>{this.getFocusableElement().contains(t.relatedTarget)||this.focusSvc.clearAdvancedFilterColumn()})}getFocusableElement(){return this.eAdvancedFilter?.getGui()??this.getGui()}setEnabled(e){e!==this.enabled&&this.setupAdvancedFilter(e)}refresh(){this.eAdvancedFilter?.refresh()}refreshLayout(){this.enabled&&this.setEnabledHeight()}getHeight(){return this.height}setInputDisabled(e){this.eAdvancedFilter?.setInputDisabled(e)}setupAdvancedFilter(e){if(e){this.eAdvancedFilter=this.createBean(new ah);const t=this.eAdvancedFilter.getGui();this.eAdvancedFilter.addCss("ag-advanced-filter-header-cell"),this.setEnabledHeight(),this.setAriaRowIndex(),UL(t,"gridcell"),VL(t,1),this.setAriaColumnCount(t),this.eFullWidthAnchor.appendChild(t)}else GL(this.eFullWidthAnchor),this.destroyBean(this.eAdvancedFilter),this.height=0;WL(this.getGui(),e),this.enabled=e}setEnabledHeight(){const e=this.getGui();this.height=KL(this.beans);const t=`${this.height}px`;e.style.height=t,e.style.minHeight=t}setAriaColumnCount(e){HL(e,this.colModel.getCols().length)}setAriaRowIndex(){const e=this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0;zL(this.getGui(),e+1)}onGridColumnsChanged(){this.eAdvancedFilter&&(this.setAriaColumnCount(this.eAdvancedFilter.getGui()),this.setAriaRowIndex())}onKeyDown(e){switch(e.key){case Si.ENTER:{this.hasFocus()&&NL(this.getFocusableElement())&&e.preventDefault();break}case Si.ESCAPE:this.hasFocus()||this.getFocusableElement().focus();break;case Si.UP:this.navigateUpDown(!0,e);break;case Si.DOWN:this.navigateUpDown(!1,e);break;case Si.TAB:if(this.hasFocus())this.navigateLeftRight(e);else{const t=OL({beans:this.beans,rootNode:this.getFocusableElement(),backwards:e.shiftKey});t?(e.preventDefault(),t.focus()):this.navigateLeftRight(e)}break}}navigateUpDown(e,t){this.hasFocus()&&this.focusSvc.focusNextFromAdvancedFilter(e)&&t.preventDefault()}navigateLeftRight(e){(e.shiftKey?this.focusSvc.focusLastHeader():this.focusSvc.focusNextFromAdvancedFilter(!1,!0))&&e.preventDefault()}hasFocus(){return BL(this.beans)===this.getFocusableElement()}};import{RefPlaceholder as qL,_removeFromParent as XL}from"ag-stack";import{Component as ZL,FilterButtonComp as JL}from"ag-grid-community";import{BeanStub as QL,DragSourceType as ek}from"ag-grid-community";var lh=class extends gd{},tk=class extends nw{constructor(e,t){super(),this.comp=e,this.virtualList=t}postConstruct(){this.createManagedBean(new lh(this.comp,this.virtualList,{dragSourceType:ek.AdvancedFilterBuilder,addListeners:(e,t,s)=>{e.addManagedListeners(this,{advancedFilterBuilderDragStarted:t,advancedFilterBuilderDragEnded:s})},getCurrentDragValue:e=>this.getCurrentDragValue(e),isMoveBlocked:()=>!1,getNumRows:e=>e.getNumItems(),moveItem:(e,t)=>this.moveItem(e,t)}))}getCurrentDragValue(e){return e.item}moveItem(e,t){this.comp.moveItem(e,t)}};import{RefPlaceholder as sk,_setAriaLabel as ik,_setAriaLevel as rk}from"ag-stack";import{Component as nk}from"ag-grid-community";import{_setAriaLabel as ok,_setAriaLabelledBy as ak,_setDisplayed as lk}from"ag-stack";import{AgInputTextFieldSelector as ck,_stopPropagationForAgGrid as uk}from"ag-grid-community";import{RefPlaceholder as ch,_addOrRemoveAttribute as dk,_clearElement as ma,_debounce as va,_exists as hk,_fuzzySuggestions as pk,_getActiveDomElement as uh,_isElementOverflowingCallback as gk,_isEventFromPrintableCharacter as fk,_isVisible as mk,_setAriaActiveDescendant as vk,_setScrollLeft as dh}from"ag-stack";import{AgInputTextFieldSelector as hh,AgPickerField as Ck,ComponentInstanceGuard as Sk,KeyCode as ue,_addGridCommonParams as bk,_clamp as yk,_createIconNoSpan as wk,_getEditorRendererDetails as xk,_stopPropagationForAgGrid as Fk}from"ag-grid-community";import{_consoleError as Ca}from"ag-grid-community";var Tk=100;function Ak(e){const{host:t,source:s,useAsyncSearch:i,onMisconfiguredSearchSource:r,onFirstValuesPageLoaded:n}=e,o=new Pk({host:t,source:s,onMisconfiguredSearchSource:r,onFirstValuesPageLoaded:n??(()=>{})}),a=typeof s.loadValuesPage=="function";return{controller:o,hasPagedSource:a,onSearch:i?l=>o.onSearch(l):void 0,onLoadMoreRows:a?l=>o.loadValuesPage(l??"down"):void 0}}var Pk=class{constructor(e){this.ctrlParams=e,this.currentSearchRequest=0,this.currentValuesPageRequest=0,this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.valuesPageLoadedValues=[],this.valuesPageSearch="",this.valuesPageWindowStartRow=0,this.destroyed=!1}destroy(){this.destroyed=!0,this.currentSearchRequest++,this.currentValuesPageRequest++}onSearch(e){if(this.destroyed)return;if(this.isValuesPaged()){this.resetValuesPage(e);return}const t=++this.currentSearchRequest,{host:s,source:i,onMisconfiguredSearchSource:r}=this.ctrlParams;if(s.setValueList({refresh:!0,valueList:void 0}),!e)return;if(typeof i.searchValues!="function"){r?.();return}let n;try{n=i.searchValues(e)}catch(o){Ca("Rich Select",o),t===this.currentSearchRequest&&s.setValueList({refresh:!0,valueList:[]});return}if(Array.isArray(n)){r?.(),s.setValueList({refresh:!0,valueList:n});return}s.setValueList({valueList:n.then(o=>{if(t===this.currentSearchRequest)return o}).catch(o=>{if(Ca("Rich Select",o),t===this.currentSearchRequest)return[]}),refresh:!0})}resetValuesPage(e){this.destroyed||(this.valuesPageSearch=e,this.valuesPageLoadedValues=[],this.valuesPageWindowStartRow=this.resolveValuesPageStartRow(e),this.valuesPageNextCursor=void 0,this.valuesPageHasMoreNext=!0,this.valuesPageHasMorePrev=this.valuesPageWindowStartRow>0,this.valuesPageLoading=!1,this.currentValuesPageRequest++,this.ctrlParams.host.setValueList({valueList:void 0,refresh:!0,isInitial:!0}),this.loadValuesPage("down"))}loadValuesPage(e){if(this.destroyed)return;const t=this.ctrlParams.source.loadValuesPage;if(typeof t!="function"||this.valuesPageLoading||e==="up"&&!this.valuesPageHasMorePrev||e==="down"&&!this.valuesPageHasMoreNext)return;const s=Math.max(this.ctrlParams.source.valuesPageSize??Tk,1),i=e==="up"?Math.max(this.valuesPageWindowStartRow-s,0):this.valuesPageWindowStartRow+this.valuesPageLoadedValues.length,r=e==="up"?this.valuesPageWindowStartRow:i+s;if(i>=r){e==="up"?this.valuesPageHasMorePrev=!1:this.valuesPageHasMoreNext=!1;return}const n=this.currentValuesPageRequest,o={search:this.valuesPageSearch,startRow:i,endRow:r,cursor:e==="down"?this.valuesPageNextCursor:void 0};this.valuesPageLoading=!0,this.valuesPageLoadedValues.length===0&&this.ctrlParams.host.setIsLoading();let a;try{a=t(o)}catch(l){this.handleValuesPageError(l,n);return}Promise.resolve(a).then(l=>this.applyValuesPageResult(l,s,n,e,i,r)).catch(l=>this.handleValuesPageError(l,n))}applyValuesPageResult(e,t,s,i,r,n){if(this.destroyed||s!==this.currentValuesPageRequest)return;this.valuesPageLoading=!1;const o=this.valuesPageLoadedValues.length===0,a=e?.values??[];if(i==="up"){a.length&&(this.valuesPageLoadedValues=[...a,...this.valuesPageLoadedValues],this.valuesPageWindowStartRow=r);const l=n-r;this.valuesPageHasMorePrev=r>0&&a.length>=l}else{a.length&&(this.valuesPageLoadedValues=[...this.valuesPageLoadedValues,...a]),this.valuesPageNextCursor=e?.cursor;const l=this.valuesPageLoadedValues.length;typeof e?.lastRow=="number"?this.valuesPageHasMoreNext=this.valuesPageWindowStartRow+l<e.lastRow:e?.cursor!==void 0?this.valuesPageHasMoreNext=!!e.cursor:this.valuesPageHasMoreNext=a.length>=t}this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0,scrollToCurrentValue:o,prependedRowCount:i==="up"?a.length:void 0}),o&&this.ctrlParams.onFirstValuesPageLoaded()}handleValuesPageError(e,t){Ca("Rich Select",e),!(this.destroyed||t!==this.currentValuesPageRequest)&&(this.valuesPageLoading=!1,this.valuesPageHasMoreNext=!1,this.valuesPageHasMorePrev=!1,this.ctrlParams.host.setValueList({valueList:this.valuesPageLoadedValues,refresh:!0,isInitial:!0}))}resolveValuesPageStartRow(e){if(e)return 0;const t=this.ctrlParams.source.valuesPageInitialStartRow?.(e);return Math.max(Math.floor(t??0),0)}isValuesPaged(){return typeof this.ctrlParams.source.loadValuesPage=="function"}};import{_clearElement as Rk,_findFocusableElements as Mk,_findNextFocusableElement as Ik,_getActiveDomElement as ph,_getDocument as Ek,_setAriaPosInSet as Dk,_setAriaRole as Lk,_setAriaSetSize as kk}from"ag-stack";import{Component as _k,KeyCode as Lt}from"ag-grid-community";import{RefPlaceholder as gh}from"ag-stack";import{Component as Gk}from"ag-grid-community";var Ok={tag:"div",cls:"ag-pill",role:"option",children:[{tag:"span",ref:"eText",cls:"ag-pill-text"},{tag:"span",ref:"eButton",cls:"ag-button ag-pill-button",role:"presentation"}]},Nk=class extends ow{constructor(e){super(Ok),this.config=e,this.eText=gh,this.eButton=gh}postConstruct(){const{config:e,eButton:t}=this,{onKeyDown:s,onButtonClick:i}=e;this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),this.addGuiEventListener("focus",()=>{this.eButton.focus()}),s&&this.addGuiEventListener("keydown",s),i&&this.addManagedElementListeners(t,{click:i})}toggleCloseButtonClass(e,t){this.eButton.classList.toggle(e,t)}setText(e){this.eText.textContent=e}getText(){return this.eText.textContent}},Bk={tag:"div",cls:"ag-pill-container"},Vk=class extends aw{constructor(){super(Bk),this.pills=[]}init(e){this.params=e,this.getKey=e.valueFormatter??(t=>String(t)),this.refresh()}refresh(){this.clearPills();const{params:e,onPillKeyDown:t,getKey:s}=this;let i=e.getValue();if(!Array.isArray(i)){if(i==null)return;i=[i]}const r=e.valueFormatter??(o=>String(o)),n=i.length;Lk(this.getGui(),n===0?"presentation":"listbox");for(let o=0;o<n;o++){const a=i[o],l=this.createBean(new Nk({onButtonClick:()=>this.onPillButtonClick(l),onKeyDown:t.bind(this)})),c=l.getGui();Dk(c,o+1),kk(c,n),e.onPillMouseDown&&l.addGuiEventListener("mousedown",e.onPillMouseDown),e.announceItemFocus&&l.addGuiEventListener("focus",e.announceItemFocus),l.setText(r(a)??""),l.toggleCloseButtonClass("ag-icon-cancel",!0),this.appendChild(c),this.pills.push({key:s(a)??o.toString(),pill:l})}}onNavigationKeyDown(e){const{key:t}=e,s=this.gos.get("enableRtl"),i=!s&&t===Lt.LEFT||s&&t===Lt.RIGHT,r=!s&&t===Lt.RIGHT||s&&t===Lt.LEFT;if(!this.pills.length||!i&&!r)return;e.preventDefault();const{beans:n,params:o}=this,a=ph(n),l=this.getGui(),c=Mk(l);if(l.contains(a)){const u=c.find(h=>h.contains(a));u&&u!==a&&u.focus();const d=Ik({beans:n,rootNode:l,backwards:i});d?d.focus():r&&o.focusAfterForwardBoundary?.()}else c.length>0&&c[r?0:c.length-1].focus()}clearPills(){const e=this.getGui();e.contains(ph(this.beans))&&this.params.eWrapper&&this.params.eWrapper.focus(),Rk(e),this.destroyBeans(this.pills.map(({pill:t})=>t)),this.pills=[]}onPillButtonClick(e){this.deletePill(e)}onPillKeyDown(e){const t=e.key;if(t===Lt.LEFT||t===Lt.RIGHT){e.stopPropagation(),this.params.onHorizontalArrowKeyDown?this.params.onHorizontalArrowKeyDown(e):this.onNavigationKeyDown(e);return}if(t!==Lt.DELETE&&t!==Lt.BACKSPACE)return;e.preventDefault();const s=Ek(this.beans),i=this.pills.findIndex(({pill:n})=>n.getGui().contains(s.activeElement));if(i===-1)return;const r=this.pills[i];r?.pill&&this.deletePill(r.pill,i)}deletePill(e,t){const{getKey:s,pills:i,params:r}=this,n=(i[t??-1]??i.find(({pill:a})=>a===e))?.key,o=(r.getValue()||[]).filter(a=>s(a)!==n);if(r.setValue(o),!o.length)r.focusAfterDelete?r.focusAfterDelete():r.eWrapper?.focus();else if(t!=null){const{pill:a}=i[Math.min(t,i.length-1)];a&&a.getFocusableElement().focus()}}destroy(){this.clearPills(),super.destroy()}},Hk=".ag-rich-select{cursor:default;height:100%}.ag-rich-select-value{align-items:center;background-color:var(--ag-picker-button-background-color);display:flex;height:100%;padding:var(--ag-spacing);:where(.ag-picker-field-display){overflow:hidden;text-overflow:ellipsis;&:where(.ag-display-as-placeholder){opacity:.5}}}.ag-virtual-list-viewport.ag-rich-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-input-border-radius);box-shadow:var(--ag-dropdown-shadow);height:auto;position:relative;width:100%;:where(.ag-rich-select-loading){display:flex;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);:where(.ag-loading-text){overflow:hidden;text-overflow:ellipsis}}}.ag-rich-select-row{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;padding:0 var(--ag-spacing);white-space:nowrap}.ag-rich-select-row-selected{background-color:var(--ag-selected-row-background-color)}.ag-rich-select-row-highlighted,.ag-rich-select-row:hover{background-image:linear-gradient(var(--ag-row-hover-color),var(--ag-row-hover-color))}.ag-rich-select-row-text-highlight{font-weight:700}.ag-rich-select-field-input{flex:1 1 auto;:where(.ag-input-field-input){border:none!important;box-shadow:none!important;padding:0!important;text-overflow:ellipsis;&::-moz-placeholder{opacity:.8}&::placeholder{opacity:.8}}}:where(.ag-ltr) .ag-rich-select-field-input{left:var(--ag-spacing)}:where(.ag-rtl) .ag-rich-select-field-input{right:var(--ag-spacing)}.ag-rich-select-typing-multi{:where(.ag-picker-field-display){flex:0 1 auto;max-width:100%;min-width:0}:where(.ag-rich-select-pill-display){align-items:center;display:flex;flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden;:where(.ag-pill-container){flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden}}:where(.ag-rich-select-field-input){flex:0 0 auto;max-width:100%;min-width:0;:where(.ag-input-wrapper){flex:0 0 auto;max-width:100%}:where(.ag-input-field-input){max-width:100%;min-width:1ch;width:auto}}}:where(.ag-ltr) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-left:.25rem}:where(.ag-rich-select-deselect-button){margin-left:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-left:auto}}:where(.ag-rtl) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-right:.25rem}:where(.ag-rich-select-deselect-button){margin-right:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-right:auto}}:where(.ag-popup-editor) .ag-rich-select-value{height:var(--ag-row-height);min-width:200px}.ag-rich-select-virtual-list-item{cursor:default;height:var(--ag-list-item-height)}.ag-pill-container{display:flex;flex-wrap:nowrap;gap:.25rem;min-width:0}.ag-pill{align-items:center;background:var(--ag-select-cell-background-color);border:var(--ag-select-cell-border);border-radius:var(--ag-border-radius);display:flex;padding:0 .25rem;white-space:nowrap}.ag-pill-button{border:none;padding:0}:where(.ag-ltr) .ag-pill-button{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-pill-button{margin-right:var(--ag-spacing)}.ag-pill-button:hover{color:var(--ag-accent-color);cursor:pointer}";import{_addOrRemoveAttribute as Uk,_requestAnimationFrame as Sa,_setAriaActiveDescendant as zk,_setAriaLabel as Wk,_setAriaLabelledBy as $k,_setDisplayed as os}from"ag-stack";import{KeyCode as Kk,_clamp as fh,_createElement as mh,_createIconNoSpan as jk}from"ag-grid-community";import{_clearElement as vh,_exists as bi,_isElementOverflowingCallback as Yk,_setAriaSelected as qk,_toString as Xk}from"ag-stack";import{Component as Zk,ComponentInstanceGuard as Jk,_addGridCommonParams as Qk,_createElement as Ch,_getEditorRendererDetails as e1}from"ag-grid-community";var t1={tag:"div",cls:"ag-rich-select-row",role:"presentation"},s1=class extends lw{constructor(e){super(t1),this.params=e,this.rendererGuard=new Jk,this.valueFormatter=ya(e.valueFormatter)}wireBeans(e){this.userCompFactory=e.userCompFactory}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createHighlightTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"richSelectListItem",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0},this))}setState(e){const t=this.valueFormatter(e),s=this.rendererGuard.claim();this.cellRenderer=this.destroyBean(this.cellRenderer),this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null),vh(this.getGui()),this.populateWithRenderer(e,t,s)||this.populateWithoutRenderer(e,t),this.value=e}highlightString(e){const{parsedValue:t,params:s}=this;if(s.cellRenderer||!bi(t))return;let i=bi(e);if(i){const r=t?.toLocaleLowerCase().indexOf(e.toLocaleLowerCase());if(r>=0){const n=r+e.length,o=this.getGui().querySelector("span");o&&(vh(o),o.append(t.slice(0,r),Ch({tag:"span",cls:"ag-rich-select-row-text-highlight",children:t.slice(r,n)}),t.slice(n)))}else i=!1}i||this.renderValueWithoutRenderer(t)}updateSelected(e){const t=this.getGui();qk(t.parentElement,e),this.toggleCss("ag-rich-select-row-selected",e)}getValue(){return this.value}toggleHighlighted(e){this.toggleCss("ag-rich-select-row-highlighted",e),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:e})}populateWithoutRenderer(e,t){const s=this.getGui(),i=Ch({tag:"span"});i.style.overflow="hidden",i.style.textOverflow="ellipsis";const r=Xk(bi(t)?t:e);this.parsedValue=bi(r)?r:null,s.appendChild(i),this.renderValueWithoutRenderer(r),this.shouldDisplayTooltip=Yk(()=>i),this.tooltipFeature?.setTooltipAndRefresh(this.parsedValue)}renderValueWithoutRenderer(e){const t=this.getGui().querySelector("span");t&&(t.textContent=bi(e)?e:"\xA0")}populateWithRenderer(e,t,s){let i,r;const{cellRenderer:n,cellRendererParams:o}=this.params;if(n){const a=this.getParentComponent()?.getParentComponent();r=e1(this.userCompFactory,this.params,Qk(this.gos,{value:e,valueFormatted:t,cellRendererParams:o,getValue:()=>a?.getValue(),setValue:l=>{a?.setValue(l,!0)},setTooltip:(l,c)=>{this.gos.assertModuleRegistered("Tooltip",3),s.isCurrent()&&(this.shouldDisplayTooltip=c,this.tooltipFeature?.setTooltipAndRefresh(l))}}))}return r&&(i=r.newAgStackInstance()),i?(wh(i,this.getGui(),a=>!this.isAlive()||!s.isCurrent()?(this.destroyBean(a),!1):(this.cellRenderer=a,!0)),!0):!1}destroy(){this.rendererGuard.invalidate(),this.cellRenderer=this.destroyBean(this.cellRenderer),super.destroy()}},Sh="ag-rich-select-list",bh="ag-rich-select-row",Yr=0,i1=1,qr=2,ba=3,r1=class extends Fs{constructor(e,t,s){super({cssIdentifier:"rich-select"}),this.params=e,this.richSelectWrapper=t,this.getSearchString=s,this.lastRowHovered=-1,this.selectedItems=new Set,this.loadingState=ba,this.loadMoreRowsThreshold=10,this.valueFormatter=ya(e.valueFormatter),this.setComponentCreator(this.createRowComponent.bind(this)),this.setComponentUpdater(()=>{})}postConstruct(){super.postConstruct();const e=this.getLocaleTextFunc();this.loadingLabel=e("loadingOoo","Loading..."),this.noMatchesLabel=e("noMatches","No matches to show"),this.eLoadingIcon=jk("richSelectLoading",this.beans,null),this.eStateCompLabel=mh({tag:"span",cls:"ag-loading-text",children:this.loadingLabel}),this.eStateComp=mh({tag:"div",cls:"ag-rich-select-loading",children:[{tag:"span",cls:"ag-loading-icon",children:[this.eLoadingIcon?()=>this.eLoadingIcon:void 0]},{tag:"span",cls:"ag-loading-text",children:[()=>this.eStateCompLabel]}]}),this.appendChild(this.eStateComp);const{cellRowHeight:t,pickerAriaLabelKey:s,pickerAriaLabelValue:i}=this.params;t&&this.setRowHeight(t);const r=this.getGui(),n=this.getAriaElement();this.addManagedListeners(r,{mousemove:this.onMouseMove.bind(this),mouseout:this.onMouseOut.bind(this),mousedown:this.onMouseDown.bind(this),click:this.onClick.bind(this),scroll:this.onGuiScroll.bind(this)}),r.classList.add(Sh);const o=`${Sh}-${this.getCompId()}`;n.setAttribute("id",o);const a=e(s,i);Wk(n,a),$k(n,this.richSelectWrapper.id)}setIsLoading(){this.setLoadingState(Yr)}setLoadingState(e){const t=this.loadingState!==e;if(this.loadingState=e,this.toggleStateComp(),this.toggleVisibility(),t){const s=this.getStateAnnouncementText(e);s&&this.stateAnnouncementCallback?.(s)}}toggleStateComp(){const{eStateComp:e,eStateCompLabel:t,eLoadingIcon:s,loadingState:i,loadingLabel:r,noMatchesLabel:n,params:o}=this;if(e){if(i===Yr){t.textContent=r,s&&os(s,!0),os(e,!0);return}if(i===qr&&o.allowNoResultsCopy){t.textContent=n,s&&os(s,!1),os(e,!0);return}os(e,!1)}}shouldBeVisible(){return this.loadingState===qr?!!this.params.allowNoResultsCopy:this.loadingState!==ba}toggleVisibility(e){const t=this.getGui();e===void 0?os(t,this.shouldBeVisible()):os(t,e),this.scheduleMaybeRequestMoreRows()}setLoadMoreRowsCallback(e,t=10){this.loadMoreRowsCallback=e,this.loadMoreRowsThreshold=Math.max(t,1),this.maybeRequestMoreRows()}setStateAnnouncementCallback(e){this.stateAnnouncementCallback=e}navigateToPage(e){const t=super.navigateToPage(e,this.lastRowHovered);return t!=null&&Sa(this.beans,()=>{if(!this.isAlive())return null;this.highlightIndex(t)}),t}drawVirtualRows(e){super.drawVirtualRows(e),this.refreshSelectedItems(),this.lastRowHovered!==-1&&this.updateRenderedHighlightState(this.lastRowHovered),this.reportContentWidth()}setContentWidthCallback(e){this.contentWidthCallback=e,this.getGui().classList.add("ag-virtual-list-grow-to-content")}reportContentWidth(){const e=this.contentWidthCallback;if(!e)return;let t=0;if(this.forEachRenderedRow(r=>{t=Math.max(t,r.getGui().getBoundingClientRect().width)}),t===0)return;const s=this.eContainer.getBoundingClientRect().width;if(t<=s)return;const i=this.getGui();e(Math.ceil(t+i.getBoundingClientRect().width-s))||(this.contentWidthCallback=void 0,i.classList.remove("ag-virtual-list-grow-to-content"))}highlightFilterMatch(e){this.forEachRenderedRow(t=>{t.highlightString(e)})}onNavigationKeyDown(e,t){Sa(this.beans,()=>{if(!this.currentList||!this.isAlive())return;const s=this.currentList.length,i=this.lastRowHovered,r=e===Kk.DOWN?1:-1,n=fh(i===-1?0:i+r,0,s-1);this.highlightIndex(n),t()})}selectValue(e){if(!this.currentList||e==null)return!1;const t=this.getIndicesForValues(e),s=t.length>0;return s&&(this.refresh(),this.ensureIndexVisible(t[0]),this.refresh(!0)),this.selectListItems(Array.isArray(e)?e:[e]),s&&this.highlightIndex(t[0],!0),s}selectListItems(e,t=!1){t||this.selectedItems.clear();for(let s=0;s<e.length;s++){const i=e[s];this.findItemInSelected(i)===void 0&&this.selectedItems.add(i)}this.refreshSelectedItems()}getCurrentList(){return this.currentList}setCurrentList(e){const t=n1(e);this.setLoadingState(t),e||(e=[]),this.currentList=e,this.setModel({getRowCount:()=>e.length,getRow:s=>e[s],areRowsEqual:(s,i)=>s===i})}offsetHoveredIndexOnPrependedRows(e){e<=0||this.lastRowHovered<0||(this.lastRowHovered+=e)}restoreScrollOnPrependedRows(e,t){if(t<=0)return;const s=this.getGui(),i=this.getRowHeight(),r=e+t*i;this.awaitStable(()=>{this.isAlive()&&(s.scrollTop=r)})}getSelectedItems(){return this.selectedItems}getLastItemHovered(){return this.currentList?.[this.lastRowHovered]}highlightIndex(e,t){this.currentList&&(e<0||e>=this.currentList.length?(this.lastRowHovered=-1,this.setActiveOption()):(this.lastRowHovered=e,this.ensureIndexVisible(e,!t)&&!t&&this.refresh(!0)),this.updateRenderedHighlightState(e))}updateRenderedHighlightState(e){let t;this.forEachRenderedRow((s,i)=>{const r=e===i;s.toggleHighlighted(r),r&&(t=`${bh}-${s.getCompId()}`)}),this.setActiveOption(t)}setActiveOption(e){zk(this.richSelectWrapper,e??null),Uk(this.richSelectWrapper,"data-active-option",e)}getIndicesForValues(e){const{currentList:t}=this;if(!t||t.length===0||e===void 0)return[];const s=Array.isArray(e)?e:[e];if(s.length===0)return[];const i=[];let r;for(const n of s){let o=t.indexOf(n);if(o===-1&&n!=null){r??(r=t.map(l=>this.valueFormatter(l)));const a=this.getComparableFormattedValue(n);o=r.indexOf(a)}o>=0&&i.push(o)}return i}toggleListItemSelection(e){const t=this.findItemInSelected(e);t!==void 0?this.selectedItems.delete(t):this.selectedItems.add(e),this.refreshSelectedItems(),this.dispatchValueSelected()}refreshSelectedItems(){this.forEachRenderedRow(e=>{const t=this.findItemInSelected(e.getValue())!==void 0;e.updateSelected(t)})}findItemInSelected(e){if(typeof e=="object"){if(this.selectedItems.has(e))return e;const t=this.valueFormatter(e);for(const s of this.selectedItems)if(this.valueFormatter(s)===t)return s}else return this.selectedItems.has(e)?e:void 0}getComparableFormattedValue(e){return e!=null&&typeof e=="object"?this.valueFormatter(e):String(e??"")}createRowComponent(e,t){const s=new s1(this.params);t.setAttribute("id",`${bh}-${s.getCompId()}`),s.setParentComponent(this),this.createBean(s),s.setState(e);const{highlightMatch:i,searchType:r="fuzzy"}=this.params;return i&&r!=="fuzzy"&&s.highlightString(this.getSearchString()),s}getRowForMouseEvent(e){if(!this.model)return-1;const s=this.getGui().getBoundingClientRect(),i=this.getScrollTop(),r=e.clientY-s.top+i;return fh(Math.floor(r/this.getRowHeight()),0,this.model.getRowCount()-1)}onMouseMove(e){const t=this.getRowForMouseEvent(e);t!==-1&&t!=this.lastRowHovered&&(this.lastRowHovered=t,this.highlightIndex(t,!0))}onGuiScroll(){this.maybeRequestMoreRows(!0)}scheduleMaybeRequestMoreRows(){if(this.beans){Sa(this.beans,()=>this.maybeRequestMoreRows(!1));return}this.maybeRequestMoreRows(!1)}maybeRequestMoreRows(e=!1){const t=this.loadMoreRowsCallback,s=this.currentList;if(!t||!s||this.loadingState===Yr)return;const i=this.getGui();if(i.clientHeight<=0)return;const n=(i.scrollHeight-(i.scrollTop+i.clientHeight))/this.getRowHeight(),o=i.scrollTop/this.getRowHeight(),a=i.scrollHeight>i.clientHeight;o<=this.loadMoreRowsThreshold&&(e||!a)&&t("up"),n<=this.loadMoreRowsThreshold&&t("down")}getStateAnnouncementText(e){if(e===Yr)return this.loadingLabel;if(e===qr&&this.params.allowNoResultsCopy)return this.noMatchesLabel}onMouseDown(e){e.preventDefault()}onMouseOut(e){this.getGui().contains(e.relatedTarget)||this.highlightIndex(-1)}onClick(e){const{multiSelect:t}=this.params;if(!this.currentList?.length)return;const s=this.getRowForMouseEvent(e),i=this.currentList[s];t?this.toggleListItemSelection(i):(this.selectListItems([i]),this.dispatchValueSelected())}dispatchValueSelected(){this.dispatchLocalEvent({type:"richSelectListRowSelected",fromEnterKey:!1,value:this.selectedItems})}destroy(){super.destroy(),this.eStateComp=void 0}};function n1(e){return e?e.length?i1:qr:ba}var yh=300,o1={tag:"div",cls:"ag-picker-field",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-picker-field-wrapper ag-rich-select-value ag-picker-collapsed",children:[{tag:"span",ref:"eDisplayField",cls:"ag-picker-field-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"span",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},Xr=class extends cw{constructor(e){const t=ya(e?.valueFormatter),s=e?.agComponents?.includes(hh)?e.agComponents:[hh,...e?.agComponents??[]];super({...e,pickerAriaLabelKey:e?.pickerAriaLabelKey??"ariaLabelRichSelectField",pickerAriaLabelValue:e?.pickerAriaLabelValue??"Rich Select Field",pickerType:e?.pickerType??"ag-list",className:e?.className??"ag-rich-select",pickerIcon:e?.pickerIcon??"richSelectOpen",ariaRole:e?.ariaRole??"combobox",template:e?.template??o1,agComponents:s,modalPicker:e?.modalPicker??!1,valueFormatter:t,maxPickerHeight:e?.maxPickerHeight??"calc(var(--ag-row-height) * 6.5)"}),this.searchString="",this.loadMoreRowsThreshold=10,this.hasPagedAsyncSource=!1,this.searchStringCreator=null,this.eInput=ch,this.eDeselect=ch,this.skipWrapperAnnouncement=!1,this.selectedValueRendererGuard=new Sk,this.onPillHorizontalArrowKeyDown=l=>{this.handleHorizontalNavigationKey(l)},this.valueFormatter=t;const{value:i,valueList:r,searchStringCreator:n,onSearch:o}=e??{};i!==void 0&&(this.value=i),n&&(this.searchStringCreator=n),r!=null&&this.setValueList({valueList:r,isInitial:!0});const{searchDebounceDelay:a=yh}=this.config;o&&(this.onSearchCallbackDebounced=va(this,o,a)),this.registerCSS(Hk)}wireBeans(e){this.userCompFactory=e.userCompFactory,this.ariaAnnounce=e.ariaAnnounce}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"richSelectValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0})),super.postConstruct(),this.createListComponent(),this.eDeselect.appendChild(wk("richSelectRemove",this.beans));const{allowTyping:e,placeholder:t,multiSelect:s,searchIcon:i,suppressDeselectAll:r,suppressMultiSelectPillRenderer:n}=this.config;this.eDeselect.classList.add("ag-hidden"),e?(this.eInput.setAutoComplete(!1).setInputPlaceholder(t).setSearchIcon(!!i),s?(this.eWrapper.classList.add("ag-rich-select-typing-multi"),n||this.eDisplayField.classList.add("ag-rich-select-pill-display")):this.eDisplayField.classList.add("ag-hidden")):this.eInput.setDisplayed(!1),this.setupAriaProperties();const{searchDebounceDelay:o=300}=this.config;this.clearSearchString=va(this,this.clearSearchString.bind(this),o),this.renderSelectedValue(),e&&this.eInput.onValueChange(a=>{this.openPickerOnTypingIfNeeded(a),this.updateTypingMultiSelectPlaceholder(a),this.searchTextFromString(a)}),this.addManagedElementListeners(this.eWrapper,{focus:this.onWrapperFocus.bind(this)}),this.addManagedElementListeners(this.eWrapper,{focusout:this.onWrapperFocusOut.bind(this)}),r||this.addManagedElementListeners(this.eDeselect,{mousedown:this.onDeselectAllMouseDown.bind(this),click:this.onDeselectAllClick.bind(this)})}setupAriaProperties(){const{eWrapper:e,gos:t}=this;e.tabIndex=t.get("tabIndex");const s=this.getLocaleTextFunc();this.ariaDeleteSelection=s("ariaLabelRichSelectDeleteSelection","Press DELETE to deselect item"),this.ariaDeselectAllItems=s("ariaLabelRichSelectDeselectAllItems","Press DELETE to deselect all items"),this.ariaToggleSelection=s("ariaLabelRichSelectToggleSelection","Press SPACE to toggle selection")}createListComponent(){this.listComponent=this.createBean(new r1(this.config,this.getFocusableElement(),()=>this.searchString)),this.listComponent.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold),this.listComponent.setStateAnnouncementCallback(e=>this.announceAriaValue(e)),this.listComponent.setParentComponent(this),this.setAriaControlsId(this.listComponent.getAriaElement().id),this.addManagedListeners(this.listComponent,{richSelectListRowSelected:e=>{this.onListValueSelected(e.value,e.fromEnterKey)}})}renderSelectedValue(e){const{value:t,eDisplayField:s,config:i,gos:r}=this,{allowTyping:n,cellRenderer:o,cellRendererParams:a,initialInputValue:l,multiSelect:c,suppressDeselectAll:u,suppressMultiSelectPillRenderer:d,onSearch:h}=i,p=this.valueFormatter(t),g=!!(n&&c),f=this.selectedValueRendererGuard.claim();if(this.destroySelectedValueRenderer(),this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null),n){const C=g?l??this.eInput.getValue()??"":l??(t===""?"":p);if(this.eInput.setValue(C,!!e&&!!h),!g)return;this.updateTypingMultiSelectPlaceholder(C)}if(c&&!u){const C=t==null||Array.isArray(t)&&t.length===0;this.eDeselect.classList.toggle("ag-hidden",C)}let m;if(c&&!d){this.createOrUpdatePillContainer(s);return}o&&!n&&(m=xk(this.userCompFactory,i,bk(this.gos,{value:t,valueFormatted:p,cellRendererParams:a,getValue:()=>this.getValue(),setValue:C=>{this.setValue(C,!0)},setTooltip:(C,S)=>{r.assertModuleRegistered("Tooltip",3),f.isCurrent()&&(this.shouldDisplayTooltip=S,this.tooltipFeature?.setTooltipAndRefresh(C))}})));let v;if(m&&(v=m.newAgStackInstance()),v)ma(s),wh(v,s,C=>!this.isAlive()||!f.isCurrent()?(this.destroyBean(C),!1):(this.selectedValueRenderer=C,!0));else{if(t!=null)s.innerText=p,s.classList.remove("ag-display-as-placeholder");else{const{placeholder:C}=i;hk(C)?(s.textContent=C,s.classList.add("ag-display-as-placeholder")):ma(s)}this.shouldDisplayTooltip=gk(()=>this.eDisplayField),this.tooltipFeature?.setTooltipAndRefresh(p??null)}}destroySelectedValueRenderer(){this.selectedValueRenderer&&(this.selectedValueRenderer=this.destroyBean(this.selectedValueRenderer))}createPickerComponent(){const{values:e}=this;return e&&this.setValueList({valueList:e}),this.listComponent}setSearchStringCreator(e){this.searchStringCreator=e}setAsyncValuesSource(e){const{source:t,thresholdRows:s,useAsyncSearch:i,onMisconfiguredSearchSource:r,onFirstValuesPageLoaded:n}=e;this.asyncRequests?.destroy();const o=Ak({host:{setValueList:a=>this.setValueList(a),setIsLoading:()=>this.setIsLoading()},source:t,useAsyncSearch:i,onMisconfiguredSearchSource:r,onFirstValuesPageLoaded:n});if(this.asyncRequests=o.controller,this.hasPagedAsyncSource=o.hasPagedSource,o.onSearch){const{searchDebounceDelay:a=yh}=this.config;this.onSearchCallbackDebounced=va(this,o.onSearch,a)}else this.config.onSearch||(this.onSearchCallbackDebounced=void 0);this.setLoadMoreRowsCallback(o.onLoadMoreRows,s??this.loadMoreRowsThreshold)}resetAsyncValues(e=""){this.hasPagedAsyncSource&&this.asyncRequests?.resetValuesPage(e)}setLoadMoreRowsCallback(e,t=10){this.loadMoreRowsCallback=e,this.loadMoreRowsThreshold=Math.max(t,1),this.listComponent?.setLoadMoreRowsCallback(this.loadMoreRowsCallback,this.loadMoreRowsThreshold)}setIsLoading(){this.listComponent?.setIsLoading()}setValueListInternal(e){const{listComponent:t,isPickerDisplayed:s,value:i}=this,{valueList:r,refresh:n,isInitial:o,scrollToCurrentValue:a=!0,prependedRowCount:l=0}=e;if(o&&this.setValues(r),!t)return;const c=l>0?t.getScrollTop():void 0;if(l>0&&t.offsetHoveredIndexOnPrependedRows(l),t.setCurrentList(r),!!n){if(s&&c!=null&&l>0&&t.restoreScrollOnPrependedRows?.(c,l),this.values){t.refresh(!0);const u=i!=null&&t.getIndicesForValues(i).length>0;s&&u&&a&&t.selectValue(i)}else s&&(t.selectValue(i)||t.refresh());this.alignPickerToComponent()}}setValueList(e){const{valueList:t}=e;if(!t||Array.isArray(t)){this.setValueListInternal(e);return}this.listComponent?.setIsLoading(),t.then(s=>{s!==void 0&&this.setValueListInternal({...e,valueList:s})}).catch(()=>{this.setValueListInternal({...e,valueList:[],refresh:!0})})}setValues(e){this.values=e,this.searchStrings=this.getSearchStringsFromValues(e||[])}showPicker(){const{listComponent:e,value:t}=this;if(!e)return;super.showPicker();const s=t??null;e.selectValue(s);const i=e.getIndicesForValues(s)[0];i!=null?(this.tooltipFeature?.attemptToHideTooltip(),e.highlightIndex(i)):e.refresh()}createOrUpdatePillContainer(e){if(!this.pillContainer){const s=this.pillContainer=this.createBean(new Vk);this.addDestroyFunc(()=>{this.destroyBean(this.pillContainer),this.pillContainer=null}),ma(e),e.appendChild(s.getGui());const{config:i,eWrapper:r,ariaDeleteSelection:n}=this;s.init({eWrapper:r,valueFormatter:this.valueFormatter,onPillMouseDown:o=>{o.stopImmediatePropagation()},announceItemFocus:()=>{this.announceAriaValue(n)},focusAfterDelete:i.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,focusAfterForwardBoundary:i.allowTyping?()=>this.focusTypingInputAtBoundary():void 0,onHorizontalArrowKeyDown:this.onPillHorizontalArrowKeyDown,getValue:()=>this.getValue(),setValue:o=>this.setValue(o,!0)})}const t=this.pillContainer.getGui().childElementCount;this.doWhileBlockingAnnouncement(()=>this.pillContainer?.refresh()),this.scrollTypingMultiSelectPillsToEndOnAdd(t)}scrollTypingMultiSelectPillsToEndOnAdd(e){const{allowTyping:t,multiSelect:s,suppressMultiSelectPillRenderer:i}=this.config;if(!t||!s||i)return;const r=this.pillContainer?.getGui();!r||r.childElementCount<=e||dh(r,r.scrollWidth,this.isRtl())}doWhileBlockingAnnouncement(e){this.skipWrapperAnnouncement=!0,e(),this.skipWrapperAnnouncement=!1}isPreviousHorizontalNavigation(e){return e===ue.LEFT!==this.isRtl()}isRtl(){return!!this.gos?.get("enableRtl")}isTypingInputAtPillBoundary(){const e=this.eInput.getInputElement(),{selectionStart:t,selectionEnd:s,value:i}=e;return t==null||s==null||t!==s?!1:this.isRtl()?t===(i??"").length:t===0}focusTypingInputAtBoundary(){const e=this.eInput.getInputElement();e.focus();const t=this.isRtl()?e.value.length:0;e.setSelectionRange(t,t)}getActiveElementForKeyboardNavigation(){if(this.beans?.eRootDiv)return uh(this.beans);const e=this.getTypingInputElement();return e?e.ownerDocument?.activeElement??document.activeElement:document.activeElement}onWrapperFocus(){const{eInput:e,config:t}=this,{allowTyping:s,multiSelect:i,suppressDeselectAll:r}=t;if(s){const n=e.getFocusableElement();n.focus(),n.select()}else i&&!r&&!this.skipWrapperAnnouncement&&this.announceAriaValue(this.ariaDeselectAllItems)}onWrapperFocusOut(e){this.eWrapper.contains(e.relatedTarget)||this.hidePicker()}onDeselectAllMouseDown(e){e.stopImmediatePropagation()}onDeselectAllClick(){this.setValue([],!0)}buildSearchStringFromKeyboardEvent(e){let{key:t}=e;if(t===ue.BACKSPACE)this.searchString=this.searchString.slice(0,-1),t="";else if(!fk(e))return;e.preventDefault(),this.searchTextFromCharacter(t)}searchTextFromCharacter(e){this.searchString+=e,this.runSearch(),this.clearSearchString()}searchTextFromString(e){e==null&&(e=""),this.searchString=e,this.onSearchCallbackDebounced&&this.setValueList({valueList:void 0,refresh:!0}),this.runSearch()}getSearchStringsFromValues(e){return typeof e[0]=="object"&&this.searchStringCreator?this.searchStringCreator(e):e.map(t=>t===""?"":this.valueFormatter(t))}filterListModel(e){const{filterList:t}=this.config;t&&this.setValueList({valueList:e,refresh:!0})}runSearch(){if(!this.listComponent)return;if(this.onSearchCallbackDebounced){this.onSearchCallbackDebounced(this.searchString);return}const e=this.searchStrings;if(!e){this.listComponent.highlightIndex(-1);return}const{suggestions:t,filteredValues:s}=this.getSuggestionsAndFilteredValues(this.searchString,e),{filterList:i,highlightMatch:r,searchType:n="fuzzy"}=this.config,o=!!(i&&this.searchString!=="");this.filterListModel(o?s:this.values||[]),this.highlightEmptyValue()||this.highlightListValue(t,s,o),r&&n!=="fuzzy"&&this.listComponent?.highlightFilterMatch(this.searchString),this.listComponent?.toggleVisibility()}highlightEmptyValue(){if(this.searchString===""){const e=this.searchStrings?.indexOf("");if(e!==void 0&&e!==-1)return this.listComponent?.highlightIndex(e),!0}return!1}highlightListValue(e,t,s){if(e.length){const i=s?0:this.searchStrings?.indexOf(e[0]);i!==void 0&&this.listComponent?.highlightIndex(i)}else if(this.listComponent?.highlightIndex(-1),!s||t.length)this.listComponent?.ensureIndexVisible(0);else if(s){const i=this.getFocusableElement();dk(i,"data-active-option",null),vk(i,null)}}getSuggestionsAndFilteredValues(e,t){let s=[];const i=[];if(!e.length)return{suggestions:s,filteredValues:i};const{searchType:r="fuzzy",filterList:n}=this.config,o=this.values||[];if(r==="fuzzy"){const a=pk({inputValue:e,allSuggestions:t,hideIrrelevant:!0});s=a.values;const l=a.indices;if(n&&l.length)for(let c=0;c<l.length;c++)i.push(o[l[c]])}else s=t.filter((a,l)=>{const c=a.toLocaleLowerCase(),u=this.searchString.toLocaleLowerCase(),d=r==="match"?c.startsWith(u):c.includes(u);return n&&d&&i.push(o[l]),d});return{suggestions:s,filteredValues:i}}clearSearchString(){this.searchString=""}setValue(e,t,s,i){if(this.value===e)return this.updateTypingMultiSelectPlaceholder(),this;const r=Array.isArray(e);if(e!=null){if(!r&&!this.listComponent?.getIndicesForValues(e)?.length)return this;s||this.listComponent?.selectValue(e)}return super.setValue(e,t),i?this.updateTypingMultiSelectPlaceholder():this.renderSelectedValue(s),this}onNavigationKeyDown(e,t,s){e.preventDefault();const i=t===ue.DOWN;if(!this.isPickerDisplayed&&i){this.showPicker();return}this.listComponent?.onNavigationKeyDown(t,s)}onEnterKeyDown(e){const t=!!(this.config.allowTyping&&this.config.multiSelect);if(!this.isPickerDisplayed){t&&(e.preventDefault(),this.dispatchPickerEventAndHidePicker(this.value,!0,e));return}if(e.preventDefault(),this.listComponent?.getCurrentList()){const s=this.listComponent.getLastItemHovered();if(t){if(s!==void 0){const i=this.getCurrentSelectionWithAppendedItem(s);this.listComponent.selectValue(i),this.setValue(i,!1,!0),this.resetTypingMultiSelectSearchState(),this.hidePicker()}return}this.config.multiSelect||s===void 0?this.dispatchPickerEventAndHidePicker(this.value,!0,e):this.onListValueSelected(new Set([s]),!0,e)}}getCurrentSelectionWithAppendedItem(e){const t=this.getValue(),s=Array.isArray(t)?[...t]:t!=null?[t]:[];return s.some(i=>this.areValuesEquivalent(i,e))||s.push(e),s}areValuesEquivalent(e,t){return e===t?!0:typeof e=="object"&&typeof t=="object"&&e!=null&&t!=null?this.valueFormatter(e)===this.valueFormatter(t):!1}resetTypingMultiSelectSearchState(){if(this.searchString="",this.eInput.setValue("",!0),this.onSearchCallbackDebounced){this.setValueList({valueList:void 0,refresh:!0});return}this.config.filterList&&this.values&&this.setValueList({valueList:this.values,refresh:!0})}updateTypingMultiSelectPlaceholder(e){const{allowTyping:t,multiSelect:s,placeholder:i}=this.config;if(!t||!s)return;const r=e??this.eInput.getValue()??"",n=r.length>0,o=this.value,a=(Array.isArray(o)?o.length>0:o!=null)||(this.listComponent?.getSelectedItems().size??0)>0,l=!n&&!a?i:"";this.eInput.setInputPlaceholder(l),this.updateTypingMultiSelectInputSize(r,l)}updateTypingMultiSelectInputSize(e,t){const s=this.getTypingInputElement();if(!s)return;const r=yk((e||t||"").length+1,1,32);if(s.size!==r&&(s.size=r),e){const n=this.pillContainer?.getGui();n&&dh(n,n.scrollWidth,this.isRtl())}}getTypingInputElement(){const e=this.eInput.getInputElement;if(typeof e=="function")return e.call(this.eInput)}openPickerOnTypingIfNeeded(e){const{isPickerDisplayed:t,config:{allowTyping:s,multiSelect:i}}=this;s&&i&&!t&&e&&this.showPicker()}onDeleteKeyDown(e){const{eWrapper:t,beans:s}=this;uh(s)===t&&(e.preventDefault(),this.setValue([],!0))}onBackspaceKeyDown(e){if(!this.isTypingInputAtPillBoundary())return;const t=this.getValue(),s=Array.isArray(t)?t:t!=null?[t]:Array.from(this.listComponent?.getSelectedItems()??[]);s.length&&(e.preventDefault(),this.setValue(s.slice(0,-1),!0))}onTabKeyDown(){const{config:e,isPickerDisplayed:t,listComponent:s}=this,{multiSelect:i}=e;if(!(!t||!s)){if(i){const r=this.getValueFromSet(s.getSelectedItems());r&&this.setValue(r,!1,!0,!0)}else{const r=s.getLastItemHovered();r!==void 0&&this.setValue(r,!1,!0)}this.hidePicker()}}getValueFromSet(e){const{multiSelect:t}=this.config;if(!t)return e.size?e.values().next().value:null;const s=Array.from(e);return s.length?s:null}onListValueSelected(e,t,s){const i=this.getValueFromSet(e);this.setValue(i,!1,!0);const{multiSelect:r,allowTyping:n}=this.config;r&&n?(this.resetTypingMultiSelectSearchState(),this.hidePicker()):r||this.dispatchPickerEventAndHidePicker(i,t,s)}dispatchPickerEventAndHidePicker(e,t,s){const i={type:"fieldPickerValueSelected",fromEnterKey:t,value:e,keyboardEvent:s};this.dispatchLocalEvent(i),this.hidePicker()}getFocusableElement(){const{allowTyping:e}=this.config;return e?this.eInput.getFocusableElement():super.getFocusableElement()}handleHorizontalNavigationKey(e){const{allowTyping:t,multiSelect:s}=this.config;if(!t){e.preventDefault(),this.listComponent?.highlightIndex(-1),this.pillContainer?.onNavigationKeyDown(e);return}const i=this.pillContainer;if(!i||!s)return;const r=this.getActiveElementForKeyboardNavigation(),n=this.isPreviousHorizontalNavigation(e.key),o=this.eInput.getInputElement();if(r===o){n&&this.isTypingInputAtPillBoundary()&&(this.listComponent?.highlightIndex(-1),i.onNavigationKeyDown(e));return}if(i.getGui().contains(r)){this.listComponent?.highlightIndex(-1);const a=r;i.onNavigationKeyDown(e),!n&&this.getActiveElementForKeyboardNavigation()===a&&this.focusTypingInputAtBoundary()}}handlePageNavigationKey(e,t){const{allowTyping:s}=this.config;if(s&&(t===ue.PAGE_HOME||t===ue.PAGE_END)){e.preventDefault();const i=this.eInput.getInputElement(),r=t===ue.PAGE_HOME?0:i.value.length;i.setSelectionRange(r,r);return}e.preventDefault(),this.pickerComponent&&this.listComponent?.navigateToPage(t)}handleVerticalNavigationKey(e,t,s){s||this.onNavigationKeyDown(e,t,()=>{this.config.multiSelect&&(this.doWhileBlockingAnnouncement(()=>this.eWrapper.focus()),this.announceAriaValue(this.ariaToggleSelection))})}handleEscapeKey(e){this.isPickerDisplayed&&(mk(this.listComponent.getGui())&&(e.preventDefault(),Fk(e)),this.hidePicker())}handleEnterKey(e,t){if(t){e.preventDefault();return}this.onEnterKeyDown(e)}handleSpaceKey(e,t){const{allowTyping:s,multiSelect:i}=this.config,{isPickerDisplayed:r,listComponent:n}=this,o=!t&&r&&i&&!!n&&(!s||(this.eInput.getValue()??"")==="");if((!s||t||o)&&e.preventDefault(),o&&n){const a=n.getLastItemHovered();a!==void 0&&n.toggleListItemSelection(a)}}handleBackspaceKey(e,t){!t&&this.config.allowTyping&&this.config.multiSelect&&this.onBackspaceKeyDown(e)}handleDeleteKey(e){this.config.multiSelect&&!this.config.suppressDeselectAll&&this.onDeleteKeyDown(e)}handleSearchWithoutTyping(e){this.config.allowTyping||this.buildSearchStringFromKeyboardEvent(e)}onKeyDown(e){const{key:t,isComposing:s}=e;switch(t){case ue.LEFT:case ue.RIGHT:this.handleHorizontalNavigationKey(e);break;case ue.PAGE_HOME:case ue.PAGE_END:case ue.PAGE_UP:case ue.PAGE_DOWN:this.handlePageNavigationKey(e,t);break;case ue.DOWN:case ue.UP:this.handleVerticalNavigationKey(e,t,s);break;case ue.ESCAPE:this.handleEscapeKey(e);break;case ue.ENTER:this.handleEnterKey(e,s);break;case ue.SPACE:this.handleSpaceKey(e,s);break;case ue.BACKSPACE:this.handleBackspaceKey(e,s);break;case ue.TAB:this.onTabKeyDown();break;case ue.DELETE:this.handleDeleteKey(e);break;default:this.handleSearchWithoutTyping(e)}}announceAriaValue(e){this.ariaAnnounce?.announceValue(e,"richSelect")}destroy(){this.selectedValueRendererGuard.invalidate(),this.destroySelectedValueRenderer(),this.asyncRequests?.destroy(),this.asyncRequests=void 0,this.hasPagedAsyncSource=!1,this.listComponent&&(this.listComponent=this.destroyBean(this.listComponent)),this.searchStrings=void 0,super.destroy()}};function wh(e,t,s){e.then(i=>{if(!i||s&&!s(i))return;const r=i.getGui();r!=null&&t.appendChild(r)})}function ya(e){return t=>e?.(t)??String(t??"")}var a1={tag:"div",cls:"ag-picker-field",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-picker-collapsed",children:[{tag:"div",ref:"eDisplayField",cls:"ag-picker-field-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"div",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},xh=class extends Xr{constructor(e){super({...e,template:a1,agComponents:[ck]}),this.params=e}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();const{wrapperClassName:e,ariaLabel:t}=this.params;lk(this.eDisplayField,!1),e&&this.eWrapper.classList.add(e),ak(this.eWrapper,""),ok(this.eWrapper,t)}onEnterKeyDown(e){uk(e),this.isPickerDisplayed?super.onEnterKeyDown(e):(e.preventDefault(),this.showPicker())}};import{_getActiveDomElement as Fh}from"ag-stack";import{BeanStub as l1,KeyCode as yi,_isStopPropagationForAgGrid as Th,_stopPropagationForAgGrid as Zr}from"ag-grid-community";var Ah=class extends uw{constructor(e,t,s){super(),this.eGui=e,this.focusWrapper=t,this.eFocusableComp=s}postConstruct(){this.addManagedElementListeners(this.eGui,{keydown:t=>{switch(t.key){case yi.TAB:t.defaultPrevented||Zr(t);break;case yi.UP:case yi.DOWN:Zr(t);break;case yi.ESCAPE:if(Th(t))return;this.eGui.contains(Fh(this.beans))&&(t.preventDefault(),Zr(t),this.focusWrapper.focus());break}}});const e="ag-advanced-filter-builder-virtual-list-item-highlight";this.addManagedListeners(this.focusWrapper,{keydown:t=>{if(t.key===yi.ENTER){if(Th(t))return;Fh(this.beans)===this.focusWrapper&&(t.preventDefault(),Zr(t),this.eFocusableComp.getFocusableElement().focus())}},focusin:()=>{this.focusWrapper.classList.add(e)},focusout:t=>{this.focusWrapper.contains(t.relatedTarget)||this.focusWrapper.classList.remove(e)}})}};function Ph(e,t){return{pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderAddField",pickerAriaLabelValue:"Advanced Filter Builder Add Field",pickerType:"ag-list",valueList:[{key:"condition",displayValue:e("advancedFilterBuilderAddCondition")},{key:"join",displayValue:e("advancedFilterBuilderAddJoin")}],valueFormatter:s=>s==null?"":s.displayValue??s.key,pickerIcon:"advancedFilterBuilderAdd",maxPickerWidth:`${t??120}px`,wrapperClassName:"ag-advanced-filter-builder-item-button",ariaLabel:e("advancedFilterBuilderAddButtonTooltip")}}var c1={tag:"div",cls:"ag-advanced-filter-builder-item-wrapper",role:"presentation",children:[{tag:"div",ref:"eItem",cls:"ag-advanced-filter-builder-item",role:"presentation",children:[{tag:"div",cls:"ag-advanced-filter-builder-item-tree-lines",attrs:{"aria-hidden":"true"},children:[{tag:"div",cls:"ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-top ag-advanced-filter-builder-item-tree-line-horizontal"}]}]}]},u1=class extends dw{constructor(e,t){super(c1),this.item=e,this.focusWrapper=t,this.eItem=sk}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){rk(this.focusWrapper,2);const e=Ph(s=>this.advFilterExpSvc.translate(s),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),t=this.createManagedBean(new xh(e));this.addManagedListeners(t,{fieldPickerValueSelected:({value:s})=>{this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:s.key==="join"})}}),this.eItem.appendChild(t.getGui()),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>t.getGui(),getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")})),this.createManagedBean(new Ah(this.getGui(),this.focusWrapper,t)),ik(this.focusWrapper,this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip"),`${this.item.level+1}`]))}afterAdd(){}};import{RefPlaceholder as kt,_removeAriaExpanded as d1,_setAriaDisabled as Rh,_setAriaExpanded as Mh,_setAriaLabel as Jr,_setAriaLevel as h1,_setDisplayed as Qr,_setVisible as p1}from"ag-stack";import{DragSourceType as g1,KeyCode as wa,TabGuardComp as f1,_createElement as Ih,_createIconNoSpan as wi,_stopPropagationForAgGrid as xa}from"ag-grid-community";import{RefPlaceholder as Fa,_setAriaDescribedBy as m1,_setAriaLabel as v1}from"ag-stack";import{Component as C1,KeyCode as S1,_stopPropagationForAgGrid as b1}from"ag-grid-community";var Eh="ag-advanced-filter-builder-value-empty",y1="ag-advanced-filter-builder-value-number",w1="ag-advanced-filter-builder-value-text",x1=({cssClass:e,wrapperClassName:t,displayClassName:s,pickerIcon:i})=>{const r=[{tag:"span",cls:`ag-advanced-filter-builder-pill-display ${s??""}`,ref:"eLabel"}];return i&&r.push({tag:"span",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}),{tag:"div",cls:`ag-advanced-filter-builder-pill-wrapper ${t??""}`,role:"presentation",children:[{tag:"div",ref:"ePill",cls:`ag-advanced-filter-builder-pill ${e}`,role:"button",children:r}]}},Dh=class extends hw{constructor(e){super(x1(e)),this.pillParams=e,this.ePill=Fa,this.eLabel=Fa,this.eIcon=Fa}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}writeLabel(e,t){const s=this.eLabel,i=s.classList;if(i.remove(Eh,y1,w1),e===null){s.textContent=this.advFilterExpSvc.translate("advancedFilterBuilderEnterValue"),i.add(Eh);return}s.textContent=e,t&&i.add(t)}postConstruct(){const{ariaLabel:e,pickerIcon:t}=this.pillParams,s=this.ePill,i=this.eLabel;if(this.activateTabIndex([s]),t){const r=this.beans.iconSvc.createIconNoSpan(t);r&&this.eIcon.appendChild(r)}i.id=`${this.getCompId()}`,m1(s,i.id),v1(s,e),this.renderValue(),this.addManagedListeners(s,{click:r=>{r.preventDefault(),this.open()},keydown:r=>{r.key===S1.ENTER&&(r.preventDefault(),b1(r),this.open())}})}getFocusableElement(){return this.ePill}},Ta=3,F1="ag-advanced-filter-builder-set-values-pill-empty",T1=class extends Dh{constructor(e){super({...e,cssClass:`${e.cssClass} ag-advanced-filter-builder-set-values-pill`,wrapperClassName:"ag-advanced-filter-builder-set-values-pill-wrapper",displayClassName:"ag-picker-field-display",pickerIcon:"advancedFilterBuilderSelectOpen"}),this.params=e,this.opening=!1,this.values=e.values}wireBeans(e){super.wireBeans(e),this.popupSvc=e.popupSvc,this.advFilterSetSvc=e.advFilterSetSvc}postConstruct(){super.postConstruct(),this.addDestroyFunc(()=>this.hidePicker())}renderValue(){const e=this.values;this.ePill.classList.toggle(F1,e.length===0),this.writeLabel(e.length?this.summarise(e,this.params.column):null)}summarise(e,t){const s=e.length,i=[];for(let r=0,n=Math.min(s,Ta);r<n;++r){const o=e[r],a=this.advFilterSetSvc.getPath(t,o);i.push(a?fi(a):String(o??""))}return s>Ta&&i.push(this.advFilterExpSvc.translate("advancedFilterSetMore",[String(s-Ta)])),`(${s}) ${i.join(", ")}`}open(){if(this.opening)return;if(this.filterUi){this.hidePicker(!0);return}const{column:e,update:t}=this.params,s={filterType:"set",values:this.values},i=this.advFilterSetSvc.createFilterUi(e,s,r=>{this.values=r?.values??this.advFilterSetSvc.getAllKeys(e)??this.values,this.renderValue(),t(this.values)});i&&(this.opening=!0,i.newAgStackInstance().then(r=>{if(this.opening=!1,!this.isAlive()){this.destroyBean(r);return}this.filterUi=r;const n=r.getGui();n.classList.add("ag-advanced-filter-builder-set-picker");const o={ePopup:n,type:"advancedFilterBuilderSet",eventSource:this.ePill,position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0},a=this.popupSvc.addPopup({modal:!0,eChild:n,closeOnEsc:!0,closedCallback:l=>this.hidePicker(l instanceof KeyboardEvent),anchorToElement:this.ePill,eventSourceToIgnore:this.ePill,positionCallback:()=>this.popupSvc.positionPopupByComponent(o),ariaLabel:this.params.ariaLabel});this.hidePopup=a.hideFunc,this.filterUi.afterGuiAttached?.({container:"columnFilter"})}))}hidePicker(e){const{filterUi:t,hidePopup:s}=this;t&&(this.filterUi=void 0,this.hidePopup=void 0,s?.(),this.destroyBean(t),e&&this.ePill.focus())}};import{_removeFromParent as Lh,_toStringOrNull as A1}from"ag-stack";import{Component as P1}from"ag-grid-community";var R1=class extends pw{constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"}),this.eOperandPills=[],this.hasSetValuesPill=!1,this.validationMessage=null}wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}init(e){const{item:t,createPill:s}=e;this.item=t,this.createPill=s,this.filterModel=t.filterModel,this.setupColumnCondition(this.filterModel),this.validate(),this.addDestroyFunc(()=>this.destroyBeans([this.eColumnPill,this.eOperatorPill,...this.eOperandPills]))}getDragName(){return this.filterModel.colId?this.advFilterExpSvc.parseColumnFilterModel(this.filterModel):this.getDefaultColumnDisplayValue()}getAriaLabel(){return`${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderFilterItem")} ${this.getDragName()}`}getValidationMessage(){return this.validationMessage}getFocusableElement(){return this.eColumnPill.getFocusableElement()}setupColumnCondition(e){const t=this.advFilterExpSvc.getColumnDetails(e.colId);this.baseCellDataType=t.baseCellDataType,this.column=t.column,this.setOperands(e.type),this.eColumnPill=this.createPill({key:e.colId,displayValue:this.advFilterExpSvc.getColumnDisplayValue(e.colId)??this.getDefaultColumnDisplayValue(),cssClass:"ag-advanced-filter-builder-column-pill",isSelect:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getColumnAutocompleteEntries()}),update:s=>this.setColumnKey(s),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderColumnSelectField",pickerAriaLabelValue:"Advanced Filter Builder Column Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderColumn")}),this.getGui().appendChild(this.eColumnPill.getGui()),e.colId&&(this.createOperatorPill(),this.syncOperandPills())}createOperatorPill(){this.eOperatorPill=this.createPill({key:this.filterModel.type,displayValue:this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel)??this.advFilterExpSvc.translate("advancedFilterBuilderSelectOption"),cssClass:"ag-advanced-filter-builder-option-pill",isSelect:!0,getEditorParams:()=>({values:this.getOperatorAutocompleteEntries()}),update:e=>this.setOperatorKey(e),pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderOptionSelectField",pickerAriaLabelValue:"Advanced Filter Builder Option Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderOption")}),this.eColumnPill.getGui().insertAdjacentElement("afterend",this.eOperatorPill.getGui())}createOperandPill(e){const t=this.getOperandModelValue(e),s=(typeof t=="number"||typeof t=="bigint"?A1(t):t)??"",i=()=>this.advFilterExpSvc.formatOperand(this.filterModel,this.getOperandModelValue(e),!0),r=this.createPill({key:s,valueFormatter:i,editValueFormatter:this.advFilterExpSvc.isOperandModelValueEditable(this.baseCellDataType,this.column)?void 0:i,baseCellDataType:this.baseCellDataType,cssClass:"ag-advanced-filter-builder-value-pill",isSelect:!1,update:n=>this.setOperand(n,e),ariaLabel:this.getOperandAriaLabel(e)});this.eOperandPills.push(r),this.getGui().appendChild(r.getGui())}getOperandAriaLabel(e){if(this.operands!=="range")return this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue");const t=this.getLocaleTextFunc();return e===0?t("ariaFilterFromValue","Filter from value"):t("ariaFilterToValue","Filter to value")}destroyOperandPills(){this.hasSetValuesPill=!1;const e=this.eOperandPills;for(let t=0,s=e.length;t<s;++t){const i=e[t];Lh(i.getGui()),this.destroyBean(i)}e.length=0}syncOperandPills(){const{eOperandPills:e,operands:t}=this,s=di[t];for(let i=s,r=Ur.length;i<r;++i)this.setOperandModelValue(i,void 0);if(t==="list"){this.hasSetValuesPill||(this.destroyOperandPills(),this.createSetValuesPill());return}if(delete this.filterModel.values,!(e.length===s&&!this.hasSetValuesPill)){this.destroyOperandPills();for(let i=0;i<s;++i)this.createOperandPill(i)}}createSetValuesPill(){const e=this.column;if(!e)return;this.hasSetValuesPill=!0;const t=this.filterModel;t.values??(t.values=[]);const s=this.createPill({key:"",column:e,values:t.values,cssClass:"ag-advanced-filter-builder-value-pill",isSelect:"set",update:i=>{t.values=i,this.validate()},ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue")});this.eOperandPills.push(s),this.getGui().appendChild(s.getGui())}getOperandModelValue(e){return this.filterModel[Ur[e]]}setOperandModelValue(e,t){const s=this.filterModel,i=Ur[e];t===void 0?delete s[i]:s[i]=t}getOperatorAutocompleteEntries(){return this.column?this.advFilterExpSvc.getOperatorAutocompleteEntries(this.column,this.baseCellDataType):[]}setColumnKey(e){this.eOperatorPill||this.createOperatorPill();const{column:t,baseCellDataType:s}=this.advFilterExpSvc.getColumnDetails(e),i=this.column,r=this.baseCellDataType!==s,n=this.filterModel.type,o=this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel);this.column=t,this.baseCellDataType=s,this.filterModel.colId=e,!r&&this.advFilterExpSvc.isOperatorOffered(s,this.filterModel.type,t)||delete this.filterModel.type,(i!==t||this.filterModel.type!==n||this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel)!==o)&&(Lh(this.eOperatorPill.getGui()),this.destroyBean(this.eOperatorPill),this.createOperatorPill()),i!==t&&(this.destroyOperandPills(),delete this.filterModel.values),this.setOperands(this.filterModel.type),this.syncOperandPills(),this.validate()}setOperatorKey(e){const t=this.operands;this.setOperands(e),this.operands!==t&&this.syncOperandPills(),this.filterModel.type=e,this.validate()}setOperands(e){const t=this.getExpressionOperator(e)?.operands??"none";this.operands=t,this.filterModel.filterType=t==="list"?"set":this.baseCellDataType}setOperand(e,t){const s=this.baseCellDataType==="number"&&e?gi(this.column,this.gos)(e)??"":e;this.setOperandModelValue(t,s===""?void 0:s),this.validate()}getExpressionOperator(e){return this.advFilterExpSvc.getExpressionOperator(this.baseCellDataType,e,this.column)}validate(){const e=$d(this.advFilterExpSvc,this.gos,this.filterModel,this.column,this.baseCellDataType,this.getExpressionOperator(this.filterModel.type));this.item.valid=!e,e!==this.validationMessage&&(this.validationMessage=e,this.dispatchLocalEvent({type:"advancedFilterBuilderValidChanged"}))}getDefaultColumnDisplayValue(){return this.advFilterExpSvc.translate("advancedFilterBuilderSelectColumn")}};import{_exists as M1,_setDisplayed as kh}from"ag-stack";import{AgInputDateField as en,AgInputNumberField as I1,AgInputTextField as tn,KeyCode as _h,_stopPropagationForAgGrid as Gh}from"ag-grid-community";var E1={number:[I1],bigint:[tn],boolean:[tn],object:[tn],text:[tn],date:[en],dateString:[en],dateTime:[en,e=>e.setIncludeTime(!0)],dateTimeString:[en,e=>e.setIncludeTime(!0)]},D1=class extends Dh{constructor(e){super(e),this.params=e;const{value:t,valueFormatter:s}=e;this.value=t,this.displayValue=s(t)}postConstruct(){super.postConstruct(),this.addDestroyFunc(()=>this.destroyBean(this.eEditor))}open(){if(this.eEditor)return;kh(this.ePill,!1),this.eEditor=this.createEditorComp();const{editValueFormatter:e}=this.params;this.editorOpenedWith=e?.(this.value)??this.value,this.eEditor.setValue(this.editorOpenedWith);const t=this.eEditor.getGui();this.eEditor.addManagedElementListeners(t,{keydown:s=>{switch(s.key){case _h.ENTER:s.preventDefault(),Gh(s),this.updateValue(!0);break;case _h.ESCAPE:s.preventDefault(),Gh(s),this.hideEditor(!0);break}},focusout:()=>this.updateValue(!1)}),this.getGui().appendChild(t),this.eEditor.getFocusableElement().focus()}createEditorComp(){const e=this.params.editValueFormatter?"text":this.params.type,[t,s]=E1[e],i=this.createBean(new t);return s?.(i),i}hideEditor(e){const{eEditor:t}=this;t&&(this.eEditor=void 0,t.getGui().remove(),this.destroyBean(t),kh(this.ePill,!0),e&&this.ePill.focus())}renderValue(){const e=this.displayValue;if(!M1(e)){this.writeLabel(null);return}const t=this.params.type;if(t==="number"||t==="bigint"){this.writeLabel(e,"ag-advanced-filter-builder-value-number");return}this.writeLabel(`"${e}"`,"ag-advanced-filter-builder-value-text")}updateValue(e){if(!this.eEditor)return;const t=this.eEditor.getValue()??"";if(t===this.editorOpenedWith){this.hideEditor(e);return}this.dispatchLocalEvent({type:"fieldValueChanged",value:t}),this.value=t,this.displayValue=this.params.valueFormatter(t),this.renderValue(),this.hideEditor(e)}};import{Component as L1}from"ag-grid-community";var k1=class extends gw{wireBeans(e){this.advFilterExpSvc=e.advFilterExpSvc}constructor(){super({tag:"div",cls:"ag-advanced-filter-builder-item-condition",role:"presentation"})}init(e){const{item:t,createPill:s}=e,i=t.filterModel;this.filterModel=i,this.ePill=s({key:i.type,displayValue:this.advFilterExpSvc.parseJoinOperator(i),cssClass:"ag-advanced-filter-builder-join-pill",isSelect:!0,getEditorParams:()=>({values:this.advFilterExpSvc.getJoinOperatorAutocompleteEntries()}),update:r=>i.type=r,pickerAriaLabelKey:"ariaLabelAdvancedFilterBuilderJoinSelectField",pickerAriaLabelValue:"Advanced Filter Builder Join Operator Select Field",ariaLabel:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderJoinOperator")}),this.getGui().appendChild(this.ePill.getGui()),this.addDestroyFunc(()=>this.destroyBean(this.ePill))}getDragName(){return this.advFilterExpSvc.parseJoinOperator(this.filterModel)}getAriaLabel(){return`${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderGroupItem")} ${this.getDragName()}`}getValidationMessage(){return null}getFocusableElement(){return this.ePill.getFocusableElement()}};import{_getInnerWidth as _1,_setAriaLabel as G1,_setAriaLabelledBy as O1}from"ag-stack";import{AgInputTextFieldSelector as N1,_stopPropagationForAgGrid as B1}from"ag-grid-community";var V1={tag:"div",cls:"ag-picker-field ag-advanced-filter-builder-pill-wrapper",role:"presentation",children:[{tag:"div",ref:"eLabel"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-advanced-filter-builder-pill ag-picker-collapsed",children:[{tag:"div",ref:"eDisplayField",cls:"ag-picker-field-display ag-advanced-filter-builder-pill-display"},{tag:"ag-input-text-field",ref:"eInput",cls:"ag-rich-select-field-input"},{tag:"span",ref:"eDeselect",cls:"ag-rich-select-deselect-button ag-picker-field-icon",role:"presentation"},{tag:"div",ref:"eIcon",cls:"ag-picker-field-icon",attrs:{"aria-hidden":"true"}}]}]},H1=class extends Xr{constructor(e){super({...e,template:V1,agComponents:[N1]}),this.params=e}getFocusableElement(){return this.eWrapper}showPicker(){setTimeout(()=>super.showPicker())}hidePicker(){setTimeout(()=>super.hidePicker())}postConstruct(){super.postConstruct();const{wrapperClassName:e,ariaLabel:t}=this.params;this.eWrapper.classList.add(e),O1(this.eWrapper,""),G1(this.eWrapper,t)}createPickerComponent(){if(!this.values){const{values:s}=this.params.getEditorParams();this.values=s;const i=this.value.key,r=s.find(n=>n.key===i)??{key:i,displayValue:this.value.displayValue};this.value=r}const e=super.createPickerComponent(),t=Math.min(this.params.maxPickerWidth??1/0,_1(this.params.eBuilder));return e.setContentWidthCallback(s=>this.growPickerToContent(s,t)),e}growPickerToContent(e,t){const s=this.pickerComponent?.getGui();if(!s)return!0;const i=Math.min(e,t);return i>parseFloat(s.style.minWidth||"0")&&(s.style.minWidth=`${i}px`,this.alignPickerToComponent()),i<t}onEnterKeyDown(e){B1(e),this.isPickerDisplayed?super.onEnterKeyDown(e):(e.preventDefault(),this.showPicker())}},Oh="ag-advanced-filter-builder-set-value-list",U1={tag:"div",cls:"ag-advanced-filter-builder-item-wrapper",role:"presentation",children:[{tag:"div",cls:"ag-advanced-filter-builder-item",role:"presentation",children:[{tag:"div",ref:"eTreeLines",cls:"ag-advanced-filter-builder-item-tree-lines",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eValidation",cls:"ag-advanced-filter-builder-item-button ag-advanced-filter-builder-invalid",attrs:{"aria-hidden":"true"}}]},{tag:"div",ref:"eButtons",cls:"ag-advanced-filter-builder-item-buttons",children:[{tag:"span",ref:"eMoveUpButton",cls:"ag-advanced-filter-builder-item-button",role:"button"},{tag:"span",ref:"eMoveDownButton",cls:"ag-advanced-filter-builder-item-button",role:"button"},{tag:"div",ref:"eAddButton",role:"presentation"},{tag:"span",ref:"eRemoveButton",cls:"ag-advanced-filter-builder-item-button",role:"button"}]}]},Aa=class extends fw{constructor(e,t,s,i){super(U1),this.item=e,this.dragFeature=t,this.focusWrapper=s,this.eBuilder=i,this.eTreeLines=kt,this.eDragHandle=kt,this.eButtons=kt,this.eValidation=kt,this.eMoveUpButton=kt,this.eMoveDownButton=kt,this.eAddButton=kt,this.eRemoveButton=kt,this.moveUpDisabled=!1,this.moveDownDisabled=!1}wireBeans(e){this.dragAndDrop=e.dragAndDrop,this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){const{filterModel:e,level:t,showMove:s}=this.item,i=e.filterType==="join";if(this.ePillWrapper=this.createManagedBean(i?new k1:new R1),this.ePillWrapper.init({item:this.item,createPill:r=>this.createPill(r)}),this.eDragHandle.insertAdjacentElement("afterend",this.ePillWrapper.getGui()),t===0){const r=Ih({tag:"div",cls:"ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-bottom ag-advanced-filter-builder-item-tree-line-root"});this.eTreeLines.appendChild(r),Qr(this.eDragHandle,!1),Qr(this.eButtons,!1),Mh(this.focusWrapper,!0)}else this.setupTreeLines(t),this.eDragHandle.appendChild(wi("advancedFilterBuilderDrag",this.beans)),this.setupValidation(),this.setupMoveButtons(s),this.setupAddButton(),this.setupRemoveButton(),this.setupDragging(),this.updateAriaExpanded();h1(this.focusWrapper,t+1),this.initialiseTabGuard({}),this.createManagedBean(new Ah(this.getGui(),this.focusWrapper,this.ePillWrapper)),this.updateAriaLabel(),this.addManagedListeners(this.ePillWrapper,{advancedFilterBuilderValueChanged:()=>this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"}),advancedFilterBuilderValidChanged:()=>this.updateValidity()})}setState(e){const{level:t}=this.item;if(t===0)return;const{showMove:s}=this.item,{disableMoveUp:i,disableMoveDown:r,treeLines:n,showStartTreeLine:o}=e;this.updateTreeLines(n,o),this.updateAriaExpanded(),s&&(this.moveUpDisabled=!!i,this.moveDownDisabled=!!r,this.eMoveUpButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",i),this.eMoveDownButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled",r),Rh(this.eMoveUpButton,!!i),Rh(this.eMoveDownButton,!!r),this.moveUpTooltipFeature?.refreshTooltip(),this.moveDownTooltipFeature?.refreshTooltip())}focusMoveButton(e){(e?this.eMoveUpButton:this.eMoveDownButton).focus()}afterAdd(){this.ePillWrapper.getFocusableElement().focus()}setupTreeLines(e){for(let t=0;t<e;t++)this.eTreeLines.appendChild(Ih({tag:"div",cls:"ag-advanced-filter-builder-item-tree-line"}))}updateTreeLines(e,t){const s=e.length-1,{children:i}=this.eTreeLines;for(let n=0;n<s;n++){const o=i.item(n);o&&o.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical",!e[n])}const r=i.item(s);if(r){r.classList.add("ag-advanced-filter-builder-item-tree-line-horizontal");const n=e[s];r.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-top",n),r.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical",!n)}this.eDragHandle.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-bottom",t)}setupValidation(){this.eValidation.appendChild(wi("advancedFilterBuilderInvalid",this.beans)),this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eValidation,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.ePillWrapper.getValidationMessage(),getTooltipShowDelayOverride:()=>1e3})),this.updateValidity()}setupAddButton(){const e=Ph(s=>this.advFilterExpSvc.translate(s),this.gos.get("advancedFilterBuilderParams")?.addSelectWidth),t=this.createManagedBean(new xh(e));this.addManagedListeners(t,{fieldPickerValueSelected:({value:s})=>this.dispatchLocalEvent({type:"advancedFilterBuilderAdded",item:this.item,isJoin:s.key==="join"})}),this.eAddButton.appendChild(t.getGui()),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eAddButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip")}))}setupRemoveButton(){this.eRemoveButton.appendChild(wi("advancedFilterBuilderRemove",this.beans)),this.addManagedListeners(this.eRemoveButton,{click:()=>this.removeItem(),keydown:e=>{e.key===wa.ENTER&&(e.preventDefault(),xa(e),this.removeItem())}}),this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eRemoveButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")})),Jr(this.eRemoveButton,this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")),this.activateTabIndex([this.eRemoveButton])}setupMoveButtons(e){e?(this.eMoveUpButton.appendChild(wi("advancedFilterBuilderMoveUp",this.beans)),this.addManagedListeners(this.eMoveUpButton,{click:()=>this.moveItem(!0),keydown:t=>{t.key===wa.ENTER&&(t.preventDefault(),xa(t),this.moveItem(!0))}}),this.moveUpTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eMoveUpButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveUpDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")})),Jr(this.eMoveUpButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip")),this.eMoveDownButton.appendChild(wi("advancedFilterBuilderMoveDown",this.beans)),this.addManagedListeners(this.eMoveDownButton,{click:()=>this.moveItem(!1),keydown:t=>{t.key===wa.ENTER&&(t.preventDefault(),xa(t),this.moveItem(!1))}}),this.moveDownTooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.eMoveDownButton,getTooltipComponentDefinition:()=>{},getLocation:()=>"advancedFilter",getTooltipValue:()=>this.moveDownDisabled?null:this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")})),Jr(this.eMoveDownButton,this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip")),this.activateTabIndex([this.eMoveUpButton,this.eMoveDownButton])):(Qr(this.eMoveUpButton,!1),Qr(this.eMoveDownButton,!1))}updateValidity(){p1(this.eValidation,!this.item.valid),this.validationTooltipFeature?.refreshTooltip(),this.updateAriaLabel()}createPill(e){const{key:t,cssClass:s,ariaLabel:i}=e;if(e.isSelect==="set"){const n=this.focusWrapper.classList,o=this.createBean(new T1({...e,update:this.onPillUpdated(e.update)}));return n.add(Oh),o.addDestroyFunc(()=>n.remove(Oh)),o}const r=this.onPillUpdated(e.update);if(e.isSelect===!0){const{getEditorParams:n,pickerAriaLabelKey:o,pickerAriaLabelValue:a,displayValue:l}=e,{pillSelectMinWidth:c,pillSelectMaxWidth:u}=this.gos.get("advancedFilterBuilderParams")??{},d=this.createBean(new H1({pickerAriaLabelKey:o,pickerAriaLabelValue:a,pickerType:"ag-list",value:{key:t,displayValue:l},valueFormatter:h=>h==null?"":h.displayValue??h.key,variableWidth:!0,minPickerWidth:c??140,maxPickerWidth:u,eBuilder:this.eBuilder,getEditorParams:n,wrapperClassName:s,ariaLabel:i,pickerIcon:"advancedFilterBuilderSelectOpen"}));return this.addManagedListeners(d,{fieldPickerValueSelected:({value:h})=>r(h?.key)}),d}else{const{baseCellDataType:n,valueFormatter:o,editValueFormatter:a}=e,l=this.createBean(new D1({value:t,valueFormatter:o,editValueFormatter:a,cssClass:s,type:n,ariaLabel:i}));return this.addManagedListeners(l,{fieldValueChanged:({value:c})=>r(c)}),l}}onPillUpdated(e){return t=>{t!=null&&(e(t),this.dispatchLocalEvent({type:"advancedFilterBuilderValueChanged"}))}}setupDragging(){const e={type:g1.AdvancedFilterBuilder,eElement:this.eDragHandle,dragItemName:()=>this.ePillWrapper.getDragName(),getDefaultIconName:()=>"notAllowed",getDragItem:()=>({}),onDragStarted:()=>this.dragFeature.dispatchLocalEvent({type:"advancedFilterBuilderDragStarted",item:this.item}),onDragStopped:()=>this.dragFeature.dispatchLocalEvent({type:"advancedFilterBuilderDragEnded"})};this.dragAndDrop.addDragSource(e,!0),this.addDestroyFunc(()=>this.dragAndDrop.removeDragSource(e))}updateAriaLabel(){const e=this.ePillWrapper.getAriaLabel(),t=`${this.item.level+1}`,s=this.ePillWrapper.getValidationMessage();let i;s?i=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItemValidation",[e,t,s]):i=this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem",[e,t]),Jr(this.focusWrapper,i)}updateAriaExpanded(){d1(this.focusWrapper);const{filterModel:e}=this.item;e?.filterType==="join"&&e.conditions.length&&Mh(this.focusWrapper,!0)}removeItem(){this.dispatchLocalEvent({type:"advancedFilterBuilderRemoved",item:this.item})}moveItem(e){this.dispatchLocalEvent({type:"advancedFilterBuilderMoved",item:this.item,backwards:e})}},z1={apply:"advancedFilterBuilderApply",clear:"advancedFilterBuilderClear",cancel:"advancedFilterBuilderCancel",reset:"advancedFilterBuilderReset"},W1={tag:"div",cls:"ag-advanced-filter-builder",role:"presentation",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eList",cls:"ag-advanced-filter-builder-list",role:"presentation"}]},$1=class extends mw{constructor(){super(W1),this.eList=qL}wireBeans(e){this.filterManager=e.filterManager,this.advancedFilter=e.advancedFilter,this.advFilterExpSvc=e.advFilterExpSvc}postConstruct(){const e=this.gos.get("advancedFilterBuilderParams");this.params={buttons:["apply","cancel"],...e},this.addManagedPropertyListener("advancedFilterBuilderParams",({currentValue:t})=>{this.params.showMoveButtons=!!t?.showMoveButtons,this.params.buttons=t?.buttons??["apply","cancel"],this.refreshList(!1)}),this.filterModel=this.setupFilterModel(),this.setupVirtualList(),this.dragFeature=this.createManagedBean(new tk(this,this.virtualList)),this.resetButtonsPanel(this.params.buttons)}refresh(){const e=this.virtualList;let t=e.getLastFocusedRow();this.setupFilterModel(),this.validateItems(),this.refreshList(!1),t!=null&&(e.getComponentAt(t)||(t=0),e.focusRow(t))}getNumItems(){return this.items.length}moveItem(e,t){!t||!e||this.moveItemToIndex(e,t.rowIndex,t.position)}afterGuiAttached(){this.virtualList.awaitStable(()=>this.virtualList.focusRow(0))}setupVirtualList(){const e=this.virtualList=this.createManagedBean(new Fs({cssIdentifier:"advanced-filter-builder",ariaRole:"tree",listName:this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderList"),moveItemCallback:this.virtualListMoveItemCallback.bind(this)}));e.setComponentCreator(this.createItemComponent.bind(this)),e.setComponentUpdater(this.updateItemComponent.bind(this)),e.setRowHeight(40),this.eList.appendChild(e.getGui()),e.setModel({getRowCount:()=>this.items?.length||0,getRow:t=>this.items[t],areRowsEqual:(t,s)=>t===s}),this.buildList(),e.refresh()}resetButtonsPanel(e){const t=e&&e.length>0;let s=this.eButtons;if(t){const i=e.map(n=>({type:n,label:this.advFilterExpSvc.translate(z1[n])}));if(!s){s=this.createBean(new JL),this.appendChild(s.getGui());const n=o=>({event:a})=>{this.updateModel(o),this.afterAction(o,a)};s.addManagedListeners(s,{apply:n("apply"),clear:n("clear"),reset:n("reset"),cancel:n("cancel")}),this.eButtons=s}s.updateButtons(i);const r=s.getApplyButton();if(r){const n=o=>this.toggleCss("ag-advanced-filter-builder-validation",o);this.addManagedElementListeners(r,{mouseenter:()=>n(!0),mouseleave:()=>n(!1)})}}else s&&(XL(s.getGui()),this.eButtons=this.destroyBean(s))}updateModel(e){switch(e){case"apply":this.advancedFilter.setModel(this.filterModel),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"reset":this.advancedFilter.setModel(null),this.filterManager?.onFilterChanged({source:"advancedFilter"});break;case"cancel":break;case"clear":this.filterModel=this.formatFilterModel(null),this.refreshList(!1);break}}afterAction(e,t){switch(e){case"apply":{t?.preventDefault(),this.close();break}case"reset":{this.close();break}case"cancel":{this.close();break}}}removeItemFromParent(e){const t=e.parent.conditions.indexOf(e.filterModel);return e.parent.conditions.splice(t,1),t}moveItemToIndex(e,t,s){const i=this.items[t],r=i.filterModel?.filterType==="join"&&s==="bottom",n=r?i.filterModel:i.parent;if(!n||this.isChildOrSelf(n,e.filterModel)||i===e)return;this.removeItemFromParent(e);let o;r?o=0:(o=n.conditions.indexOf(i.filterModel),o===-1?o=n.conditions.length:s==="bottom"&&(o+=1)),n.conditions.splice(o,0,e.filterModel),this.refreshList(!1)}isChildOrSelf(e,t){return e===t||t.filterType==="join"&&t.conditions.some(s=>this.isChildOrSelf(e,s))}setupFilterModel(){const e=this.formatFilterModel(this.advancedFilter.getBuilderModel());return this.stringifiedModel=JSON.stringify(e),e}formatFilterModel(e){return e=e??{filterType:"join",type:"AND",conditions:[]},e.filterType!=="join"&&(e={filterType:"join",type:"AND",conditions:[e]}),e}buildList(){const e=(t,s,i,r)=>{if(s.push({filterModel:t,level:i,parent:r,valid:!0,showMove:this.params.showMoveButtons}),t.filterType==="join"){for(const n of t.conditions)e(n,s,i+1,t);i===0&&s.push({filterModel:null,level:i+1,parent:t,valid:!0})}};this.items=[],e(this.filterModel,this.items,0)}refreshList(e){if(!e){const t=new Map;for(const s of this.items)s.valid||t.set(s.filterModel,s.validationMessage);if(this.buildList(),t.size)for(const s of this.items)s.filterModel&&t.has(s.filterModel)&&(s.valid=!1,s.validationMessage=t.get(s.filterModel))}this.virtualList.refresh(e),this.validate()}updateItemComponent(e,t){const s=this.items.indexOf(e),i=(a,l)=>{const u=this.items.find(d=>d.filterModel===a)?.parent;if(u){const{conditions:d}=u;i(u,l),l.push(d[d.length-1]===a)}},r=[],{filterModel:n}=e;n&&(i(n,r),r[0]=!1);const o=n?.filterType==="join"&&!!n.conditions.length;t.setState({disableMoveUp:s===1,disableMoveDown:!this.canMoveDown(e,s),treeLines:r,showStartTreeLine:o})}createItemComponent(e,t){const s=this.createBean(e.filterModel?new Aa(e,this.dragFeature,t,this.getGui()):new u1(e,t));return s.addManagedListeners(s,{advancedFilterBuilderRemoved:({item:i})=>this.removeItem(i),advancedFilterBuilderValueChanged:()=>this.validate(),advancedFilterBuilderAdded:({item:i,isJoin:r})=>this.addItem(i,r),advancedFilterBuilderMoved:({item:i,backwards:r})=>this.moveItemUpDown(i,r)}),s instanceof Aa&&this.updateItemComponent(e,s),s}addItem(e,t){const{parent:s,level:i,filterModel:r}=e,n=r?.filterType==="join",o=t?{filterType:"join",type:"AND",conditions:[]}:{},a=n?r:s;let l=n?0:a.conditions.indexOf(r);l>=0?(n||(l+=1),a.conditions.splice(l,0,o)):a.conditions.push(o);let c=this.items.indexOf(e);const u=c>=0;if(u){e.filterModel&&c++;const d=[{filterModel:o,level:n?i+1:i,parent:a,valid:t,showMove:this.params.showMoveButtons}];this.items.splice(c,0,...d)}this.refreshList(u),u&&this.virtualList.getComponentAt(c)?.afterAdd()}removeItem(e){const t=e.parent,{filterModel:s}=e,i=t.conditions.indexOf(s);t.conditions.splice(i,1);const r=e.filterModel?.filterType==="join",n=this.items.indexOf(e),o=!r&&n>=0;o&&this.items.splice(n,1),this.refreshList(o),n>=0&&this.virtualList.focusRow(n)}moveItemUpDown(e,t,s){const i=this.items.indexOf(e),r=t?i-1:i+1;if(r===0||!t&&!this.canMoveDown(e,i))return;const n=this.items[r],o=this.removeItemFromParent(e),{level:a,filterModel:l,parent:c}=e,{level:u,filterModel:d,parent:h}=n;if(t)if(u===a&&d.filterType==="join")d.conditions.push(l);else if(u<=a){const f=h.conditions.indexOf(d);h.conditions.splice(f,0,l)}else c.conditions[o-1].conditions.push(l);else if(u===a)if(d.filterType==="join")d.conditions.splice(0,0,l);else{const f=h.conditions.indexOf(d);h.conditions.splice(f+1,0,l)}else if(o<c.conditions.length)c.conditions.splice(o+1,0,l);else{const f=this.items.find(v=>v.filterModel===c),m=f.parent.conditions.indexOf(f.filterModel)+1;f.parent.conditions.splice(m,0,l)}this.refreshList(!1);const p=this.items.findIndex(({filterModel:f})=>f===l);if(p<0)return;const g=this.virtualList.getComponentAt(p);g instanceof Aa&&(s||g.focusMoveButton(t))}virtualListMoveItemCallback(e,t){const s=e.item,i=this.items.indexOf(s);i<=0||i===this.items.length-1||t&&i===1||!t&&!this.canMoveDown(s,i)||(this.moveItemUpDown(s,t,!0),this.virtualList.focusRow(i+(t?-1:1)))}canMoveDown(e,t){return!(e.level===1&&t===this.items.length-2||e.level===1&&e.parent.conditions[e.parent.conditions.length-1]===e.filterModel)}close(){this.advancedFilter.getCtrl().toggleFilterBuilder({source:"ui"})}validate(){let e=this.items.every(({valid:s})=>s),t=null;e?(e=JSON.stringify(this.filterModel)!==this.stringifiedModel,e||(t=this.advFilterExpSvc.translate("advancedFilterBuilderValidationAlreadyApplied"))):t=this.items.find(s=>!s.valid)?.validationMessage??this.advFilterExpSvc.translate("advancedFilterBuilderValidationIncomplete"),this.eButtons?.updateValidity(e,t)}validateItems(){const e=this.advFilterExpSvc;for(const t of this.items){if(!t.filterModel||t.filterModel.filterType==="join")continue;const{filterModel:s}=t;t.validationMessage=null;const{colId:i}=s,r=e.getColumnAutocompleteEntries().find(({key:l})=>l===i),{column:n,baseCellDataType:o}=e.getColumnDetails(i);if(!r||!n){t.valid=!1,delete s.colId,Nh(s);continue}const a=e.getExpressionOperator(o,s.type,n);if(!a){t.valid=!1,Nh(s);continue}t.validationMessage=$d(e,this.gos,s,n,o,a),t.valid=!t.validationMessage}}},Nh=e=>{delete e.type,delete e.filter,delete e.filterTo,delete e.values,delete e.filterType},K1=class extends vw{constructor(e){super(),this.enabled=e}wireBeans(e){this.ctrlsSvc=e.ctrlsSvc,this.popupSvc=e.popupSvc,this.advFilterExpSvc=e.advFilterExpSvc,this.environment=e.environment}postConstruct(){this.hasAdvancedFilterParent=!!this.gos.get("advancedFilterParent"),this.ctrlsSvc.whenReady(this,()=>this.setAdvancedFilterComp()),this.addManagedEventListeners({advancedFilterEnabledChanged:({enabled:e})=>this.onEnabledChanged(e)}),this.addManagedPropertyListener("advancedFilterParent",()=>this.updateComps()),this.addManagedPropertyListener("advancedFilterBuilderParams",e=>{e.currentValue?.suppressFullScreenButton!==e.previousValue?.suppressFullScreenButton&&this.eBuilderDialog?.setMaximizable(e.currentValue?.suppressFullScreenButton??!0)}),this.addDestroyFunc(()=>{this.destroyFilterComp(),this.eHeaderComp&&(this.headerCompHost?.unmountComp(this.eHeaderComp.getGui()),this.destroyBean(this.eHeaderComp),this.eHeaderComp=void 0,this.headerCompHost=void 0),this.destroyBean(this.eBuilderComp),this.eBuilderDialog?.isAlive()&&this.destroyBean(this.eBuilderDialog)})}mountTopSectionComp(e){this.headerCompHost=e,this.syncHeaderComp()}focusHeaderComp(){return this.eHeaderComp?(this.eHeaderComp.getFocusableElement().focus(),!0):!1}refreshComp(){this.eFilterComp?.refresh(),this.eHeaderComp?.refresh()}refreshBuilderComp(){this.eBuilderComp?.refresh()}getHeaderHeight(){return this.eHeaderComp?.getHeight()??0}setInputDisabled(e){this.eFilterComp?.setInputDisabled(e),this.eHeaderComp?.setInputDisabled(e)}toggleFilterBuilder(e){const{source:t,force:s,eventSource:i}=e;if(s&&this.eBuilderDialog||s===!1&&!this.eBuilderDialog)return;if(this.eBuilderDialog){this.builderDestroySource=t,this.destroyBean(this.eBuilderDialog);return}this.setInputDisabled(!0);const{width:r,height:n,minWidth:o}=this.getBuilderDialogSize(),{suppressFullScreenButton:a}={suppressFullScreenButton:!1,...this.gos.get("advancedFilterBuilderParams")};this.eBuilderComp=this.createBean(new $1),this.eBuilderDialog=this.createBean(new ns({title:this.advFilterExpSvc.translate("advancedFilterBuilderTitle"),component:this.eBuilderComp,width:r,height:n,resizable:!0,movable:!0,maximizable:!a,centered:!0,closable:!0,minWidth:o,afterGuiAttached:()=>this.eBuilderComp?.afterGuiAttached(),postProcessPopupParams:{type:"advancedFilterBuilder",eventSource:i}})),this.dispatchFilterBuilderVisibleChangedEvent(t,!0),this.eBuilderDialog.addEventListener("destroyed",()=>{this.destroyBean(this.eBuilderComp),this.eBuilderComp=void 0,this.eBuilderDialog=void 0,this.setInputDisabled(!1),this.dispatchLocalEvent({type:"advancedFilterBuilderClosed"}),this.dispatchFilterBuilderVisibleChangedEvent(this.builderDestroySource??"ui",!1),this.builderDestroySource=void 0})}dispatchFilterBuilderVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"advancedFilterBuilderVisibleChanged",source:e,visible:t})}getBuilderDialogSize(){const e=this.gos.get("advancedFilterBuilderParams")?.minWidth??500,t=this.popupSvc.getPopupParent(),s=Math.round(rL(t))-2,i=Math.round(iL(t)*.75)-2,r=aL(700,e,s),n=Math.min(600,i);return{width:r,height:n,minWidth:e}}onEnabledChanged(e){this.enabled=e,this.updateComps()}updateComps(){this.setAdvancedFilterComp(),this.syncHeaderComp(),this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}setAdvancedFilterComp(){if(this.destroyFilterComp(),!this.enabled)return;const e=this.gos.get("advancedFilterParent");if(this.hasAdvancedFilterParent=!!e,e){const t=this.createBean(new ah),s=t.getGui();this.disconnectFilterComp=nL(this.environment,e,s),this.eFilterComp=t}}syncHeaderComp(){const e=this.headerCompHost;if(!e)return;if(!(this.enabled&&!this.hasAdvancedFilterParent)){if(!this.eHeaderComp)return;e.unmountComp(this.eHeaderComp.getGui()),this.destroyBean(this.eHeaderComp),this.eHeaderComp=void 0;return}this.eHeaderComp||(this.eHeaderComp=this.createManagedBean(new YL(!0)),e.mountComp(this.eHeaderComp.getGui())),this.eHeaderComp.refreshLayout()}destroyFilterComp(){this.disconnectFilterComp?.(),this.destroyBean(this.eFilterComp)}},j1=class{constructor(e){this.params=e,this.operators=[],this.operatorStartPositions=[],this.operatorEndPositions=[],this.activeOperator=0,this.validationError=null}parseExpression(e){this.operators.push(""),this.operatorStartPositions.push(e),this.operatorEndPositions.push(void 0);const{expression:t}=this.params;for(;e<t.length;){const s=t[e];if(s===" "){if(this.parseOperator(e-1))return this.activeOperator++,e-1;this.operators[this.activeOperator]+=s}else this.operators[this.activeOperator]+=s;e++}return this.parseOperator(e-1),e}isValid(){return!this.validationError&&(!this.operators.length||!!this.parsedOperator)}getValidationError(){return this.validationError}getFunction(){return this.parsedOperator==="OR"?"||":"&&"}getModel(){return this.parsedOperator==="OR"?"OR":"AND"}getAutocompleteListParams(e,t){let s;if(t==null)s="";else{const r=this.operators[t],n=this.operatorEndPositions[t];s=Wr(r,e,n==null?this.params.expression.length:n+1)}let i=this.params.advFilterExpSvc.getJoinOperatorAutocompleteEntries();return(t||t==null&&this.activeOperator)&&(i=i.filter(({key:r})=>r===this.parsedOperator)),this.params.advFilterExpSvc.generateAutocompleteListParams(i,"join",s)}updateExpression(e,t,s){let{expression:i}=this.params;const r=t.displayValue??t.key;if(s===0)for(let a=this.operatorEndPositions.length-1;a>0;a--){const l=this.operatorEndPositions[a];l!=null&&(i=rs(i,this.operatorStartPositions[a],l,r).updatedValue)}const n=this.operatorStartPositions.length>s?this.operatorStartPositions[s]:e,o=(this.operatorEndPositions.length>s?this.operatorEndPositions[s]:void 0)??na(i,e,!0).endPosition;return rs(i,n,o,r,!0)}getNumOperators(){return this.operators.length}getLastOperatorEndPosition(){return this.operatorEndPositions[this.operatorEndPositions.length-1]}parseOperator(e){const t=this.operators.length>this.activeOperator?this.operators[this.activeOperator]:"",s=this.params.advFilterExpSvc.getExpressionJoinOperators(),i=oD(t,s,r=>r);if(i){this.operatorEndPositions[this.activeOperator]=e;const r=s[i];if(this.activeOperator){if(i!==this.parsedOperator)return this.validationError||(this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationJoinOperatorMismatch"),startPosition:e-t.length+1,endPosition:e}),!1}else this.parsedOperator=i;return t!==r&&(oa(this.params,t,r,e),this.operators[this.activeOperator]=r),!0}else return i===null?!1:(this.validationError||(this.validationError={message:this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidJoinOperator"),startPosition:e-t.length+1,endPosition:e}),!0)}},Y1=class Dy{constructor(t,s){this.params=t,this.startPosition=s,this.expectingExpression=!0,this.expectingOperator=!1,this.expressionParsers=[],this.operatorParser=new j1(this.params),this.missingEndBracket=!1,this.extraEndBracket=!1}parseExpression(){let t=this.startPosition;const{expression:s}=this.params;for(;t<s.length;){const i=s[t];if(i==="("&&!this.expectingOperator){const r=new Dy(this.params,t+1);t=r.parseExpression(),this.expressionParsers.push(r),this.expectingExpression=!1,this.expectingOperator=!0}else{if(i===")")return this.endPosition=t-1,this.startPosition===0&&(this.extraEndBracket=!0),t;if(i!==" ")if(this.expectingExpression){const r=new $D(this.params,t);t=r.parseExpression(),this.expressionParsers.push(r),this.expectingExpression=!1,this.expectingOperator=!0}else this.expectingOperator&&(t=this.operatorParser.parseExpression(t),this.expectingOperator=!1,this.expectingExpression=!0)}t++}return this.startPosition>0&&(this.missingEndBracket=!0),t}isValid(){return!this.missingEndBracket&&!this.extraEndBracket&&this.expressionParsers.length===this.operatorParser.getNumOperators()+1&&this.operatorParser.isValid()&&this.expressionParsers.every(t=>t.isValid())}getValidationError(){const t=this.operatorParser.getValidationError();for(let i=0;i<this.expressionParsers.length;i++){const r=this.expressionParsers[i].getValidationError();if(r)return t&&t.startPosition<r.startPosition?t:r}if(t)return t;if(this.extraEndBracket)return{message:this.params.advFilterExpSvc.translate("advancedFilterValidationExtraEndBracket"),startPosition:this.endPosition+1,endPosition:this.endPosition+1};let s;return this.expressionParsers.length===this.operatorParser.getNumOperators()?s="advancedFilterValidationMissingCondition":this.missingEndBracket&&(s="advancedFilterValidationMissingEndBracket"),s?{message:this.params.advFilterExpSvc.translate(s),startPosition:this.params.expression.length,endPosition:this.params.expression.length}:null}getFunction(t){const s=this.operatorParser.getFunction(),i=this.expressionParsers.map(n=>n.getFunction(t)),r=s==="&&"?"every":"some";return(n,o,a)=>i[r](l=>l(n,o,a))}getAutocompleteListParams(t){if(this.endPosition!=null&&t>this.endPosition+1)return;if(!this.expressionParsers.length)return this.getColumnAutocompleteListParams();const s=this.getExpressionParserIndex(t);if(s==null)return this.params.expression[t]==="("?{enabled:!1}:this.getColumnAutocompleteListParams();const r=this.expressionParsers[s].getAutocompleteListParams(t);if(!r){if(s<this.expressionParsers.length-1)return this.operatorParser.getAutocompleteListParams(t,s);if(this.expressionParsers.length===this.operatorParser.getNumOperators()){const n=this.operatorParser.getLastOperatorEndPosition();return n==null||t<=n+1?this.operatorParser.getAutocompleteListParams(t,this.operatorParser.getNumOperators()-1):this.getColumnAutocompleteListParams()}return this.params.expression[t-1]===")"?{enabled:!1}:this.operatorParser.getAutocompleteListParams(t)}return r}updateExpression(t,s,i){const r=this.params.expression,n=this.getExpressionParserIndex(t);if(n==null){const l=i==="column"?this.params.advFilterExpSvc.getColumnValue(s):s.displayValue??s.key;return rs(r,this.startPosition,this.startPosition,l,!0)}const a=this.expressionParsers[n].updateExpression(t,s,i);return a??(i==="column"?rs(r,t,r.length-1,this.params.advFilterExpSvc.getColumnValue(s),!0):this.endPosition!=null&&t>this.endPosition+1?null:this.operatorParser.updateExpression(t,s,n))}getModel(t){return this.expressionParsers.length>1?{filterType:"join",type:this.operatorParser.getModel(),conditions:this.expressionParsers.map(s=>s.getModel(t))}:this.expressionParsers[0].getModel(t)}getColumnAutocompleteListParams(){return this.params.advFilterExpSvc.generateAutocompleteListParams(this.params.advFilterExpSvc.getColumnAutocompleteEntries(),"column","")}getExpressionParserIndex(t){let s;for(let i=0;i<this.expressionParsers.length&&!(this.expressionParsers[i].startPosition>t);i++)s=i;return s}},q1=class{constructor(e){this.params=e,this.valid=!1}parseExpression(){this.joinExpressionParser=new Y1(this.params,0);const e=this.joinExpressionParser.parseExpression();return this.valid=e>=this.params.expression.length-1&&this.joinExpressionParser.isValid(),this.params.expression}isValid(){return this.valid}getValidationMessage(){const e=this.joinExpressionParser.getValidationError();if(!e)return null;const{message:t,startPosition:s,endPosition:i,selfContained:r}=e;return r?this.params.advFilterExpSvc.translate("advancedFilterValidationMessageOnly",[t]):s<this.params.expression.length?this.params.advFilterExpSvc.translate("advancedFilterValidationMessage",[t,this.params.expression.slice(s,i+1).trim()]):this.params.advFilterExpSvc.translate("advancedFilterValidationMessageAtEnd",[t])}getFunction(){const e=this.createFunctionParams();return{expressionFunction:this.joinExpressionParser.getFunction(e),params:e}}stripRedundantSeparators(e){const t=this.params.redundantSeparators;if(!t)return null;let s=this.params.expression,i=!1;for(let r=t.length-1;r>=0;--r){const{startPosition:n,endPosition:o}=t[r];e>o+1&&(s=s.slice(0,n)+s.slice(o+1),i=!0)}return i?s:null}getAutocompleteListParams(e){return this.joinExpressionParser.getAutocompleteListParams(e)??{enabled:!1}}updateExpression(e,t,s){return this.joinExpressionParser.updateExpression(e,t,s)}getModel(e){return this.isValid()?this.joinExpressionParser.getModel(e):null}createFunctionParams(){return{operands:[],operators:[],evaluatorParams:[]}}},X1=class extends Cw{constructor(){super(...arguments),this.beanName="advancedFilter",this.appliedExpression=null,this.appliedModel=null,this.appliedBuilderModel=null,this.appliedTextUnresolved=!1,this.expression=null,this.isValid=!0}wireBeans(e){this.valueSvc=e.valueSvc,this.colModel=e.colModel,this.dataTypeSvc=e.dataTypeSvc,this.advFilterExpSvc=e.advFilterExpSvc,this.advFilterSetSvc=e.advFilterSetSvc,this.filterValueSvc=e.filterValueSvc,this.filterManager=e.filterManager}postConstruct(){this.setEnabled(this.gos.get("enableAdvancedFilter"),!0),this.ctrl=this.createManagedBean(new K1(this.enabled)),this.expressionProxy={getValue:(e,t)=>{const s=this.colModel.getNonPivotColById(e);return s?this.filterValueSvc.getValue(s,t):void 0}},this.addManagedPropertyListener("enableAdvancedFilter",e=>this.setEnabled(!!e.currentValue)),this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter",()=>this.revalidateAndApply()),this.addManagedEventListeners({dataTypesInferred:()=>this.revalidateAndApply()}),this.addManagedListeners(this.advFilterSetSvc,{valuesChanged:()=>this.refreshAppliedExpressionText()})}revalidateAndApply(){this.updateValidity()&&this.filterManager?.onFilterChanged({source:"advancedFilter"})}isEnabled(){return this.enabled}isFilterPresent(){return!!this.expressionFunction}doesFilterPass(e){return this.expressionFunction(this.expressionProxy,e,this.expressionParams)}getModel(){return Pa(this.appliedModel)}getBuilderModel(){return Pa(this.appliedBuilderModel)}modelToExpression(e,t){if(e.filterType==="join"){const s=this.advFilterExpSvc.parseJoinOperator(e),i=e.conditions.map(r=>this.modelToExpression(r)).filter(r=>r!=null&&r!=="").join(` ${s} `);return t||e.conditions.length<=1?i:`(${i})`}return this.advFilterExpSvc.parseColumnFilterModel(e)}writeExpression(e){const t=this.advFilterExpSvc;t.wroteUnresolvedSetValue=!1;const s=e?this.modelToExpression(e,!0):null;return this.appliedTextUnresolved=t.wroteUnresolvedSetValue,s}refreshAppliedExpressionText(){if(!this.appliedTextUnresolved)return;const e=this.appliedModel;if(!e||this.expression!==this.appliedExpression)return;const t=this.writeExpression(e);t!==this.expression&&(this.expression=t,this.appliedExpression=t),this.ctrl.refreshComp()}setModel(e){const t=this.writeExpression(e),s=this.appliedTextUnresolved;this.setExpressionDisplayValue(t),this.applyExpression(),this.appliedTextUnresolved=s,this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp()}getExpressionDisplayValue(){return this.expression}setExpressionDisplayValue(e){this.expression=e}isCurrentExpressionApplied(){return this.appliedExpression===this.expression}createExpressionParser(e){return e?new q1({expression:e,gos:this.gos,colModel:this.colModel,dataTypeSvc:this.dataTypeSvc,valueSvc:this.valueSvc,advFilterExpSvc:this.advFilterExpSvc,advFilterSetSvc:this.advFilterSetSvc}):null}getDefaultExpression(e){const t=this.advFilterExpSvc.getColumnValue(e)+" ";return{updatedValue:t,updatedPosition:t.length}}isHeaderActive(){return!this.gos.get("advancedFilterParent")}getCtrl(){return this.ctrl}setEnabled(e,t){const s=this.enabled,i=tL(this.gos)||sL(this.gos);e&&!i&&this.warn(123),this.enabled=e&&i,!t&&this.enabled!==s&&this.eventSvc.dispatchEvent({type:"advancedFilterEnabledChanged",enabled:this.enabled})}applyExpression(){const e=this.createExpressionParser(this.expression);e?.parseExpression(),this.applyExpressionFromParser(e)}getAppliedExpressionDisplayValue(){return this.appliedExpression}applyExpressionFromParser(e){if(this.appliedTextUnresolved=!1,this.isValid=!e||e.isValid(),!e||!this.isValid){this.expressionFunction=null,this.expressionParams=null,this.appliedExpression=null,this.appliedModel=null,this.appliedBuilderModel=null;return}const{expressionFunction:t,params:s}=e.getFunction();this.expressionFunction=t,this.expressionParams=s,this.appliedExpression=this.expression,this.appliedModel=e.getModel(),this.appliedBuilderModel=e.getModel(!0)}updateValidity(){this.advFilterExpSvc.resetColumnCaches();const e=this.createExpressionParser(this.expression);e?.parseExpression();const t=!e||e.isValid(),s=this.isValid,i=this.appliedExpression,r=!!this.expressionFunction;return t&&e?.getValidationMessage()?this.isValid=!0:this.applyExpressionFromParser(e),this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp(),t!==s||this.appliedExpression!==i||!!this.expressionFunction!==r}},Pa=e=>{if(!e)return null;if(e.filterType==="join"){const t=e.conditions,s=t.length,i=new Array(s);for(let r=0;r<s;++r)i[r]=Pa(t[r]);return{...e,conditions:i}}return e.filterType==="set"?{...e,values:[...e.values]}:{...e}};import{_areEqual as Z1,_last as J1,_pushToMapArray as Bh}from"ag-stack";import{BeanStub as Q1,_addGridCommonParams as e_,_getCellRendererDetails as t_,_getFilterDetails as s_,_isClientSideRowModel as i_,_isSetFilterByDefault as r_,_mergeFilterParamsWithApplicationProvidedParams as n_}from"ag-grid-community";import{_defaultComparator as o_,_last as a_,_toStringOrNull as l_,_translate as c_}from"ag-stack";import{_isBlank as u_}from"ag-grid-community";var d_={loadingOoo:"Loading...",blanks:"(Blanks)",searchOoo:"Search...",selectAll:"(Select All)",selectAllSearchResults:"(Select All Search Results)",addCurrentSelectionToFilter:"Add current selection to filter",noMatches:"No matches.",ariaSearchFilterValues:"Search filter values",ariaFilterList:"Filter List",filterSummaryListInactive:"is (All)",filterSummaryListSeparator:", ",filterSummaryListShort:e=>`is (${e[0]})`,filterSummaryListLong:e=>`is (${e[0]}) and ${e[1]} more`},Ra=e=>e??null;function Ma(e,t,s){let i=e;return i?(i=i.map(r=>l_(as(r))),!t&&s&&i.some(r=>r==null)?a_(i)==null?null:i.filter(r=>r!=null):i):null}function as(e){return e==null||u_(e)?null:e}function Vh(e,t,s,i){return e.valueSvc.formatValue(t,null,s,i,!1)}function ve(e,t,s){return c_(e,d_,t,s)}function h_(e,t){e.excelMode==="windows"?(e.buttons||(e.buttons=["apply","cancel"]),e.closeOnApply==null&&(e.closeOnApply=!0)):e.excelMode==="mac"&&(e.buttons||(e.buttons=["reset"]),e.applyMiniFilterWhileTyping==null&&(e.applyMiniFilterWhileTyping=!0),e.debounceMs==null&&(e.debounceMs=500)),e.excelMode&&e.defaultToNothingSelected&&(e.defaultToNothingSelected=!1,t.log.warn(207))}function p_(){return([e,t],[s,i])=>{if(t==null)return i==null?0:-1;if(i==null)return 1;for(let r=0;r<t.length;r++){if(r>=i.length)return 1;const n=o_(t[r],i[r]);if(n!==0)return n}return 0}}import{_createElement as Hh}from"ag-grid-community";var g_=(e,t)=>{const s=Hh({tag:"span",cls:"ag-autocomplete-row-path-parent"});let i=t;for(;i>0&&e.firstChild;){const r=e.firstChild,n=r.textContent??"";if(n.length<=i){i-=n.length,s.appendChild(r);continue}const o=r.cloneNode(!1);o.textContent=n.slice(0,i),r.textContent=n.slice(i),s.appendChild(o),i=0}e.prepend(s)},f_=class extends nh{constructor(e,t,s){super(),this.parentLength=t,this.createCellRenderer=s,this.rendererOwnsLabel=!1,this.value=e}postConstruct(){this.render()}setSearchString(e){this.rendererOwnsLabel||super.setSearchString(e)}render(){const e=this.createCellRenderer?.();if(!e){super.render();return}const t=this.getLabel();t.textContent="",this.rendererOwnsLabel=!0,e.newAgStackInstance().then(s=>{if(!this.isAlive()){this.destroyBean(s);return}this.addDestroyFunc(()=>this.destroyBean(s)),t.appendChild(s.getGui()),this.afterLabelRendered()})}afterLabelRendered(){const e=this.parentLength;if(!e)return;const t=this.getLabel();if(!this.rendererOwnsLabel){g_(t,e);return}t.prepend(Hh({tag:"span",cls:"ag-autocomplete-row-path-parent",children:this.value.slice(0,e)}))}},Uh=e=>"path"in e,zh="set-value",m_="\0",v_=[],C_=class extends Sw{constructor(){super(...arguments),this.beanName="advFilterSetSvc",this.columns=new Map,this.listCount=0}wireBeans(e){this.registry=e.registry,this.userCompFactory=e.userCompFactory}postConstruct(){const e=()=>this.refreshColumns();this.addManagedEventListeners({newColumnsLoaded:e,columnRowGroupChanged:e,columnPivotModeChanged:e,columnPivotChanged:e,rowDataUpdated:()=>this.onNewRowsLoaded()}),this.addManagedPropertyListeners(["treeData"],e),this.addDestroyFunc(()=>this.reset())}refreshColumns(){const e=this.columns;for(const[t,s]of e){const i=this.beans.colModel.getNonPivotColById(t);if(s&&i&&this.offersSetOperators(i)){const r=s.handler;r.refresh(this.createHandlerParams(i,"colDef")),r.onNewRowsLoaded(),s.values=null;continue}s&&this.destroyColumn(s),e.delete(t)}this.invalidateList()}onNewRowsLoaded(){for(const e of this.columns.values())e?.handler.onNewRowsLoaded()}offersSetOperators(e){if(!e)return!1;if(YD(e))return this.gos.assertModuleRegistered("SetFilter",4);if(!this.gos.isModuleRegistered("SetFilter"))return!1;const t=e.colDef;return(this.isSetFilterDef(e)||t.filter==="agMultiColumnFilter"&&!!pi(t.filterParams,"agSetColumnFilter"))&&this.hasSetFilterValues(e)}hasSetFilterValues(e){if(i_(this.gos))return!0;const t=this.getSetColDef(e).filterParams;return!!(typeof t=="function"?this.createHandlerParams(e,"init").filterParams:t)?.values}hasSetFilter(e){return!!e&&this.gos.isModuleRegistered("SetFilter")&&this.isSetFilterDef(e)}isSetFilterDef(e){const t=e.colDef.filter;return t==="agSetColumnFilter"||t===!0&&r_(this.gos)}getKeys(e,t){const s=this.getSetColumn(e),i=s&&this.getValues(s);if(!i)return;const r=s.handler.caseFormat(Ia(t)),n=i.keysByPath.get(r);if(n===void 0)return;const o=i.sharedKeysByPath.get(r);return o?[n,...o]:[n]}getPath(e,t){const s=this.getSetColumn(e);return(s&&this.getValues(s))?.pathsByKey.get(s.handler.caseFormat(t))}getAllKeys(e){const t=this.getSetColumn(e);return t&&this.getValues(t)?t.keys:void 0}refreshValuesOnFocus(){for(const[e,t]of this.columns)t?.handler.params.filterParams.refreshValuesOnOpen&&(t.handler.refreshFilterValues(),this.invalidateValues(e))}getBlankLabel(e){const t=this.getSetColumn(e);return t?ve(t.handler,"blanks"):void 0}getAutocompleteList(e,t){const s=e.getColId(),i=this.list;if(i?.colId===s&&w_(i.usedKeys,t))return i;const r=this.getSetColumn(e),n=r&&this.getValues(r),o=n?.entries??v_;let a=o;if(t.size){a=[];for(let c=0,u=o.length;c<u;++c){const d=o[c];t.has(d.setKey)||a.push(d)}}const l={type:`${zh}-${++this.listCount}`,colId:s,usedKeys:t,entries:a,isTree:!!r?.handler.params.filterParams.treeList,loading:!!r&&!n,rowComponentCreator:n?this.createRowCreator(e,r.handler):void 0};return n&&(this.list=l),l}writePath(e,t){if(t.length<2)return vi(t[0]);const s=Jd(t);return Z1(Kr(s),t)&&!this.getKeys(e,[s])?vi(s):JD(t)}writeEntry(e,t){return Uh(t)?this.writePath(e,t.path):vi(t.key)}isSetValueType(e){return!!e?.startsWith(`${zh}-`)}createRowCreator(e,t){const s=t.params.filterParams,i=s.cellRenderer;if(!i&&!s.treeList)return;const r=e.getColDef(),n=!!s.treeList;return o=>{const a=o.displayValue??o.key,l=Uh(o)?o:void 0,c=l?J1(l.path):a,u=n&&l&&l.path.length>1?a.length-c.length:0,d=i?()=>t_(this.userCompFactory,s,e_(this.gos,{value:n||!l?c:t.valueModel.allValues.get(l.setKey),valueFormatted:c,colDef:r,column:e})):void 0;return new f_(a,u,d)}}createMatcher(e,t){const s=this.getSetColumn(e)?.handler;return s?s.createKeysMatcher(t):()=>{}}getValues(e){if(e.values)return e.values;const t=e.handler.valueModel.allKeys;if(e.keysPromise!==t){e.keysPromise=t,e.keys=void 0;let i=!1;t.then(r=>{e.keys=r??[],i&&this.invalidateList()}),i=!0}const s=e.keys;return s?(e.values=e.handler.params.filterParams.treeList?y_(e,s):b_(e,s),e.values):null}getSetColumn(e){const t=e.getColId(),s=this.columns,i=s.get(t);if(i!==void 0)return i;const r=this.createSetColumn(e);return s.set(t,r),r}createSetColumn(e){if(!this.offersSetOperators(e))return null;const t=this.registry.createDynamicBean("agSetColumnFilterHandler",!1);if(!t)return null;const s=this.createBean(t);s.init(this.createHandlerParams(e,"init"));const i=e.getColId(),[r]=this.addManagedListeners(s,{dataChanged:()=>this.invalidateValues(i)});return{handler:s,values:null,removeListener:r}}destroyColumn(e){e.removeListener(),this.destroyBean(e.handler)}createFilterUi(e,t,s){const i=this.getSetColumn(e)?.handler;if(!i)return;const r={...this.createSharedParams(e),buttons:[],model:t,state:{model:t},onStateChange:n=>{r.model=n.model,s(n.model)},onModelChange:()=>{},onAction:()=>{},onUiChange:()=>{},getHandler:()=>i,filterChangedCallback:()=>{},filterModifiedCallback:()=>{},source:"init"};return s_(this.userCompFactory,this.getSetColDef(e),r,"agSetColumnFilter")}createSharedParams(e){return this.beans.colFilter.createBaseFilterParams(e,!0)}getSetColDef(e){const t=e.getColDef();if(this.hasSetFilter(e))return t;const s=t.filter==="agMultiColumnFilter"?pi(t.filterParams,"agSetColumnFilter"):void 0;return{...t,filter:"agSetColumnFilter",filterParams:s?.filterParams}}createHandlerParams(e,t){const s=this.getSetColDef(e),i={...this.createSharedParams(e),model:null,source:t,onModelChange:()=>{},onModelAsStringChange:()=>{},filterChangedCallback:()=>{},filterModifiedCallback:()=>{},filterParams:s.filterParams};return i.filterParams=n_(this.userCompFactory,s,i),i}invalidateValues(e){const t=this.columns.get(e);t&&(t.values=null,this.invalidateList())}invalidateList(){this.list=void 0,this.dispatchLocalEvent({type:"valuesChanged"})}reset(){for(const e of this.columns.values())e&&this.destroyColumn(e);this.columns.clear(),this.list=void 0}},Ia=e=>e.join(m_),Wh=()=>({keysByPath:new Map,sharedKeysByPath:new Map,pathsByKey:new Map}),S_=(e,t,s)=>{const i=fi(e),r=s?fi(Kr(i)):i;return{key:i,setKey:t,path:e,searchValue:r===i?void 0:r}},Ea=(e,t,s,i,r,n)=>{const{keysByPath:o,sharedKeysByPath:a,pathsByKey:l}=t,c=s.length-1,u=i[0];let d=e.caseFormat(Ia(s));o.has(d)&&(s[c]=u??"",d=e.caseFormat(Ia(s))),l.set(e.caseFormat(u),s),o.has(d)?Bh(a,d,u):(o.set(d,u),r?.push(S_(s,u,n)));for(let h=1,p=i.length;h<p;++h){const g=i[h];l.set(e.caseFormat(g),s),Bh(a,d,g)}},b_=(e,t)=>{const s=e.handler,i=[],r=Wh();for(let n=0,o=t.length;n<o;++n){const a=t[n];Ea(s,r,[s.getFormattedValue(a)??""],[a],i,!1)}return{entries:i,...r}},y_=(e,t)=>{const s=e.handler,i=s.params.filterParams.treeListFormatter,r=[],n=Wh(),o=(a,l)=>{for(const c of a.values()){const u=(i?i(c.treeKey,c.depth,c.parentTreeKeys):c.treeKey)??ve(s,"blanks"),d=[...l,u],h=c.children,p=c.keys;if(h?.size){o(h,d),p&&Ea(s,n,d,p,null,!0);continue}p&&Ea(s,n,d,p,r,!0)}};return o(s.createDisplayValueTree(t),[]),{entries:r,...n}},w_=(e,t)=>{if(e.size!==t.size)return!1;for(const s of e)if(!t.has(s))return!1;return!0},$h={moduleName:"AdvancedFilter",version:G,beans:[X1,QD,C_],icons:{advancedFilterBuilder:"group",advancedFilterBuilderDrag:"grip",advancedFilterBuilderInvalid:"not-allowed",advancedFilterBuilderMoveUp:"up",advancedFilterBuilderMoveDown:"down",advancedFilterBuilderAdd:"plus",advancedFilterBuilderRemove:"minus",advancedFilterBuilderSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},apiFunctions:{getAdvancedFilterModel:zE,setAdvancedFilterModel:WE,showAdvancedFilterBuilder:$E,hideAdvancedFilterBuilder:KE},dependsOn:[$,NE,HE,VE,BE,OE],css:[UE]};import{ColumnApiModule as x_}from"ag-grid-community";import{STRUCTURED_SCHEMA_FEATURES as F_}from"ag-grid-community";var Ts=class{constructor(e){this._defs={},this._nullable=!1,this.description=e}_collectNestedDefs(e){const t={...this._defs};for(const s of e)s&&typeof s=="object"&&"$defs"in s&&(Object.assign(t,s.$defs),delete s.$defs);return t}_toJSON(e={}){const t={type:this._nullable?[this.type,"null"]:this.type,description:this.description,...e};return Object.keys(this._defs).length>0&&(t.$defs=this._defs),t}nullable(){return this._nullable=!0,this}define(e,t){return this._defs[e]=t,this}},T_=class extends Ts{constructor(e){super(typeof e=="string"?e:e?.description),this.type="string",typeof e=="object"&&e&&(this._pattern=e.pattern,this._format=e.format)}pattern(e){return this._pattern=e,this}format(e){return this._format=e,this}toJSON(){return this._toJSON({pattern:this._pattern,format:this._format})}},A_=class extends Ts{constructor(e){super(typeof e=="string"?e:e?.description),this.type="number",typeof e=="object"&&e&&(this._minimum=e.minimum,this._maximum=e.maximum,this._exclusiveMinimum=e.exclusiveMinimum,this._exclusiveMaximum=e.exclusiveMaximum,this._multipleOf=e.multipleOf)}minimum(e){return this._minimum=e,this}exclusiveMinimum(e){return this._exclusiveMinimum=e,this}maximum(e){return this._maximum=e,this}exclusiveMaximum(e){return this._exclusiveMaximum=e,this}multipleOf(e){return this._multipleOf=e,this}toJSON(){return this._toJSON({minimum:this._minimum,exclusiveMinimum:this._exclusiveMinimum,maximum:this._maximum,exclusiveMaximum:this._exclusiveMaximum,multipleOf:this._multipleOf})}},Kh=class extends Ts{constructor(e,t){super(t),this._enum=e,this.type="string"}toJSON(){return this._toJSON({enum:this._enum})}},P_=class extends Kh{constructor(e,t){super([e],t)}},R_=class extends Ts{constructor(e){super(e),this.type="boolean"}toJSON(){return this._toJSON()}},M_=class extends Ts{constructor(e,t){super(typeof t=="string"?t:t?.description),this.items=e,this.type="array",typeof t=="object"&&t&&(this._minItems=t.minItems,this._maxItems=t.maxItems)}minItems(e){return this._minItems=e,this}maxItems(e){return this._maxItems=e,this}toJSON(){const e=this.items.toJSON(),t=this._collectNestedDefs([e]);return this._defs=t,this._toJSON({items:e,minItems:this._minItems,maxItems:this._maxItems})}},I_=class extends Ts{constructor(e,t){super(t),this.properties=e,this.type="object"}toJSON(){const e=Object.fromEntries(Object.keys(this.properties).map(s=>[s,this.properties[s].toJSON()])),t=this._collectNestedDefs(Object.values(e));return this._defs=t,this._toJSON({required:Object.keys(this.properties),additionalProperties:!1,properties:e})}},E_=class{constructor(e,t){this.schemas=e,this._nullable=!1,this._defs={},this.description=t}nullable(){return this._nullable=!0,this}define(e,t){return this._defs[e]=t,this}_collectNestedDefs(e){const t=this._defs;for(const s of e)s&&typeof s=="object"&&"$defs"in s&&(Object.assign(t,s.$defs),delete s.$defs);return t}toJSON(){const e=this.schemas.map(i=>i.toJSON()),t=this._collectNestedDefs(e),s={anyOf:this._nullable?[...e,{type:"null"}]:e};return this.description&&(s.description=this.description),Object.keys(t).length>0&&(s.$defs=t),s}},D_=class{constructor(e){this.id=e}nullable(){return this}toJSON(){return{$ref:`#/$defs/${this.id}`}}},I={string:e=>new T_(e),number:e=>new A_(e),enum:(e,t)=>new Kh(e,t),boolean:e=>new R_(e),array:(e,t)=>new M_(e,t),object:(e,t)=>new I_(e,t),union:(e,t)=>new E_(e,t),literal:(e,t)=>new P_(e,t),ref:e=>new D_(e)},L_=e=>{const{aggFuncSvc:t}=e;if(!t)return;const i=e.colModel.getCols().filter(r=>r.isAllowValue()&&t.getFuncNames(r).length>0);if(i.length!==0)return I.object({aggregationModel:I.array(I.union(i.map(r=>I.object({colId:I.literal(r.colId,"Column identifier"),aggFunc:I.enum(e.aggFuncSvc?.getFuncNames(r)||[],"Aggregation function")}))),"Array of column aggregations")},"Aggregation configuration for the grid").nullable()},k_=e=>{const s=e.colModel.getCols().filter(r=>r.isResizable());if(s.length===0)return;const i=s.map(r=>r.colId);return I.object({columnSizingModel:I.array(I.union([I.object({colId:I.ref("resizableColumnId"),width:I.number("Fixed width in pixels").minimum(20)}),I.object({colId:I.ref("resizableColumnId"),flex:I.number("Flex sizing ratio").minimum(0)})]),"Array of column sizing configurations")},"Column sizing configuration for the grid").define("resizableColumnId",I.enum(i,"Column ID that supports resizing"))},__=()=>I.object({hiddenColIds:I.array(I.ref("allColumnIds"),"Array of column IDs to hide")},"Column visibility configuration for the grid").nullable();import{_ADVANCED_FILTER_ONLY_OPTIONS as G_,_classifyFilterOptions as O_}from"ag-grid-community";import{_getOwn as N_}from"ag-stack";function B_(e,t,s){const i=e.getColumnOperators(s,t),r=i?.operators.getEntries(i.activeOperators)??[],n=new Map;for(let o=0,a=r.length;o<a;++o){const l=r[o].key,c=N_(i.operators.operators,l)?.operands??"none",u=n.get(c);u?u.push(l):n.set(c,[l])}return n}var V_=({colModel:e,dataTypeSvc:t,advFilterExpSvc:s})=>{if(!t||!s)return;const i=s,r=e.getCols(),n=new Map;for(const u of r){const d=t.getBaseDataType(u);if(!d)continue;B_(i,u,d).forEach((p,g)=>{const f=g==="list"?"set":d,m=`${f} ${g} ${JSON.stringify(p)}`,v=n.get(m);v?v.colIds.push(u.colId):n.set(m,{schemaName:f,operatorKeys:p,operands:g,colIds:[u.colId]})})}const o=[],a={},l={};for(const u of n.values()){const d=u.schemaName,h=(l[d]??0)+1;l[d]=h;const p=`${d}AdvancedFilterModel${h>1?h:""}`;a[p]=U_(u).toJSON(),o.push({$ref:`#/$defs/${p}`})}a.joinAdvancedFilterModel=I.object({filterType:I.literal("join","Filter type identifier for joining multiple advanced filter conditions"),type:I.enum(["AND","OR"],"Logical operator to combine multiple advanced filter conditions"),conditions:I.array(I.ref("advancedFilterModel"),"Array of advanced filter conditions to be combined")}),a.advancedFilterModel={anyOf:[...o,{$ref:"#/$defs/joinAdvancedFilterModel"}]};const c=I.object({advancedFilterModel:I.ref("advancedFilterModel")},"Advanced filter configuration for the grid").nullable();for(const u of Object.keys(a))c.define(u,a[u]);return c},jh=()=>I.string({pattern:"^\\d{4}-\\d{2}-\\d{2}$",description:"Date value in YYYY-MM-DD format"}),H_={boolean:{filterType:"boolean",noun:"boolean",titleNoun:"Boolean",value:()=>I.string("Filter value to compare against boolean column values")},object:{filterType:"object",noun:"object",titleNoun:"Object",value:()=>I.string("Filter value to compare against object column values")},date:{filterType:"date",noun:"date",titleNoun:"Date",value:jh},dateString:{filterType:"dateString",noun:"date string",titleNoun:"Date string",value:jh},dateTime:{filterType:"dateTime",noun:"datetime",titleNoun:"DateTime",value:()=>I.string({pattern:"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$",description:"DateTime value in YYYY-MM-DDTHH:mm:ss format"})},dateTimeString:{filterType:"dateTimeString",noun:"datetime string",titleNoun:"DateTime string",value:()=>I.string({pattern:"^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",description:"DateTime value in YYYY-MM-DD HH:mm:ss format"})},number:{filterType:"number",noun:"number",titleNoun:"Number",value:()=>I.number("Numeric value to filter by")},bigint:{filterType:"bigint",noun:"bigint",titleNoun:"BigInt",value:()=>I.string({pattern:"^-?\\d+$",description:"BigInt value to filter by"})},text:{filterType:"text",noun:"text",titleNoun:"Text",value:()=>I.string("Text value to filter by")}};function U_(e){const t=e.schemaName;if(t==="set")return I.object({filterType:I.literal("set","Filter type identifier for set column filters"),colId:I.enum(e.colIds,"Column identifier for the Set Filter column to filter"),type:I.enum(e.operatorKeys,"Set filter operation type"),values:I.array(I.string().nullable(),"The values to filter on; null matches blank cells").minItems(1)});const{filterType:s,noun:i,titleNoun:r,value:n}=H_[t],o={filterType:I.literal(s,`Filter type identifier for ${i} column filters`),colId:I.enum(e.colIds,`Column identifier for the ${i} column to filter`),type:I.enum(e.operatorKeys,`${r} filter operation type`)},a=di[e.operands];return a>0&&(o.filter=n().nullable()),a>1&&(o.filterTo=n().nullable()),I.object(o)}var z_="agTextColumnFilter",Yh="agNumberColumnFilter",qh="agDateColumnFilter",W_="agSetColumnFilter",$_="agMultiColumnFilter",K_=[z_,Yh,qh],j_=(e,t)=>{const{advancedFilter:s}=e;return s?.isEnabled()?V_(e):Y_(e,t)},Y_=(e,t)=>{const{gos:s,colFilter:i,colModel:r}=e;if(!i)return;const o=r.getCols().filter(c=>c.isFilterAllowed());if(o.length===0)return;const a={},l=s.get("enableFilterHandlers");for(const c of o){const u=t?.columns?t.columns[c.colId]:void 0,d=c.colDef,h=i.getDefaultFilter(c),p=u?.includeSetValues??!1,g=Xh(d.filter,d.filterParams,h,(f=!1,m=0)=>{if(!p)return[];let v;return f?l&&(v=i.getHandler(c,!0).getHandler(m)):v=i.getHandler(c,!0),v?v.getFilterKeys():[]});g&&(a[c.colId]=g.nullable())}return I.object({filterModel:I.object(a)}).nullable()};function Xh(e,t,s,i){let r;if(typeof e=="string"?r=e:typeof e=="object"&&typeof e.component=="string"?r=e.component:(e===!0||typeof e=="object"&&e.component===!0)&&(r=s),!r)return null;if(K_.includes(r)){const n=t?.maxNumConditions,o=t?.filterOptions?[...O_(t.filterOptions,()=>{},G_).offered.keys()]:void 0,a=t?.useIsoSeparator||!1;return q_(r,{maxConditions:n,filterOptions:o,useIsoSeparator:a})}else{if(r===W_)return Q_(i);if(r===$_)return eG(Dt(t??{}),s,i)}return null}var q_=(e,t)=>e===qh?J_(t):e===Yh?Z_(t):X_(t),Da=(e,t,s=2)=>s===1?e:I.object({filterType:I.literal(t,`Filter type identifier for ${t} filters with multiple conditions`),operator:I.enum(["AND","OR"],"Logical operator to combine multiple filter conditions. Must be included even with a single filter to adhere to the API."),conditions:I.array(e,"Array of filter conditions to be combined").minItems(2).maxItems(s)}),X_=e=>{const t=e.filterOptions??["contains","notContains","equals","notEqual","startsWith","endsWith","blank","notBlank"],s=I.object({filterType:I.literal("text","Filter type identifier for text filters"),type:I.enum(t,"Text filter operation type"),filter:I.string("Primary filter value").nullable(),filterTo:I.string("Secondary filter value for range operations").nullable()});return Da(s,"text",e.maxConditions)},Z_=e=>{const t=e.filterOptions??["equals","notEqual","greaterThan","greaterThanOrEqual","lessThan","lessThanOrEqual","inRange","blank","notBlank"],s=I.object({filterType:I.literal("number","Filter type identifier for number filters"),type:I.enum(t,"Number filter operation type"),filter:I.number("Primary filter value").nullable(),filterTo:I.number("Secondary filter value for range operations").nullable()});return Da(s,"number",e.maxConditions)},J_=e=>{const t=e.filterOptions??["equals","notEqual","lessThan","greaterThan","inRange","blank","notBlank"],s=e.useIsoSeparator?"^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$":"^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$",i=I.object({filterType:I.literal("date","Filter type identifier for date filters"),type:I.enum(t,"Date filter operation type"),dateFrom:I.string({pattern:s,description:"Primary date filter value in YYYY-MM-DD HH:mm:ss format"}).nullable(),dateTo:I.string({pattern:s,description:"Secondary date filter value for range operations in YYYY-MM-DD HH:mm:ss format"}).nullable()});return Da(i,"date",e.maxConditions)},Q_=e=>{const t=e?e().filter(Boolean):[];return I.object({filterType:I.literal("set","Filter type identifier for set filters"),values:I.array(t.length>0?I.enum(t,"Available values to filter by"):I.string("Filter values"),"Array of values to include in the filter")})},eG=(e,t,s=()=>[])=>{const i=e.map((r,n)=>Xh(r.filter,r.filterParams,t,()=>s(!0,n))).filter(r=>r!==null);return i.length===0?null:I.object({filterType:I.literal("multi","Filter type identifier for multi-condition filters"),filterModels:I.array(I.union(i,"Union of different filter types that can be combined").nullable(),"Array of filter conditions to be combined with AND/OR logic")})},tG=e=>{const s=e.colModel.getCols().filter(i=>i.isAllowPivot()).map(i=>i.colId);if(s.length!==0)return I.object({pivotMode:I.boolean("Whether pivot mode is enabled"),pivotColIds:I.array(I.enum(s,"Column ID that supports pivoting"),"Array of column IDs to use as pivot columns")},"Pivot configuration for the grid").nullable()},sG=e=>{const s=e.colModel.getCols().filter(r=>r.isAllowRowGroup());if(s.length===0)return;const i=s.map(r=>r.colId);return I.object({groupColIds:I.array(I.enum(i,"Column ID that supports row grouping"),"Array of column IDs to group by")},"Row grouping configuration for the grid")},iG=e=>{const{sortSvc:t}=e;if(!t)return;const i=e.colModel.getCols().filter(n=>n.isSortable());if(i.length===0)return;const r=i.map(n=>n.colId);return I.object({sortModel:I.array(I.object({colId:I.enum(r,"Column ID that supports sorting"),sort:I.enum(["asc","desc"],"Sort direction: ascending or descending"),type:I.enum(["default","absolute"],"Sort type: default or absolute values")}),"Array of sort configurations")},"Sort configuration for the grid").nullable()},rG={aggregation:L_,filter:j_,sort:iG,pivot:tG,columnVisibility:__,columnSizing:k_,rowGroup:sG};function nG(e,t){const s={};for(const a of F_){if(t?.exclude?.includes(a))continue;const l=rG[a](e,t);l&&(s[a]=l.nullable())}const i=e.colModel.colsList,r=t?.columns??{},n=new Array(i.length);let o="";for(let a=0,l=i.length;a<l;++a){const c=i[a].colId;n[a]=c;const u=r[c]?.description;a>0&&(o+=`
`),o+=u?`${c}: ${u}`:c}return I.object(s).define("allColumnIds",I.enum(n,o)).toJSON()}var Zh={moduleName:"AiToolkit",version:G,beans:[],dependsOn:[$,x_],apiFunctions:{getStructuredSchema:nG}};import{_ColumnMoveModule as oG,_PopupModule as aG,_SharedDragAndDropModule as lG}from"ag-grid-community";import{_HorizontalResizeModule as cG}from"ag-grid-community";import{_unwrapUserComp as uG}from"ag-grid-community";function dG(e){return e.sideBar?.comp.isDisplayed()??!1}function hG(e,t){e.sideBar?.comp.setDisplayed(t)}function pG(e,t){e.sideBar?.comp.setSideBarPosition(t)}function gG(e,t,s){e.sideBar?.comp.openToolPanel(t,"api",s)}function fG(e){e.sideBar?.comp.close("api")}function mG(e){return e.sideBar?.comp.openedItem()??null}function vG(e){e.sideBar?.comp.refresh()}function CG(e){return e.sideBar?.comp.isToolPanelShowing()??!1}function SG(e,t){const s=e.sideBar?.comp.getToolPanelInstance(t);return uG(s)}function bG(e){return e.sideBar?.comp.getDef()}import{BeanStub as yG}from"ag-grid-community";import{RefPlaceholder as wG,_findNextFocusableElement as xG,_focusInto as FG,_getActiveDomElement as Jh,_isVisible as TG,_removeFromParent as Qh,_setAriaControlsAndLabel as AG}from"ag-stack";import{Component as PG,KeyCode as sn,ManagedFocusFeature as RG,_addFocusableContainerListener as MG,_addGridCommonParams as ep,_focusNextGridCoreContainer as IG,_skipFocusableContainerListenerForAgGrid as EG}from"ag-grid-community";var DG=`.ag-tool-panel-wrapper{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-horizontal-size,var(--ag-side-bar-panel-width))}.ag-tool-panel-content{display:flex;height:100%;overflow:hidden auto}.ag-tool-panel-wrapper.ag-tool-panel-animating{
/* !important required to override .ag-hidden to tool panel remains visible while animating */display:block!important;transition:width var(--ag-side-bar-panel-animation-duration) ease-in-out}@media (prefers-reduced-motion:reduce){.ag-tool-panel-wrapper.ag-tool-panel-animating{transition:none}}.ag-tool-panel-external{background-color:var(--ag-wrapper-background-color);display:flex;flex-direction:row;width:100%}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);overflow:hidden auto;padding-top:var(--ag-side-button-bar-top-padding);position:relative;scrollbar-width:thin}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative}.ag-side-button:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}:where(.ag-ltr) .ag-side-button:before{left:0}:where(.ag-rtl) .ag-side-button:before{right:0}.ag-side-button:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}.ag-side-button.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color)}.ag-side-button.ag-selected:before{background-color:var(--ag-side-button-selected-underline-color)}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}`;import{_clearElement as LG}from"ag-stack";import{Component as kG,KeyCode as _G,_focusNextGridCoreContainer as GG,_stopPropagationForAgGrid as OG}from"ag-grid-community";import{RefPlaceholder as La,_setAriaExpanded as NG}from"ag-stack";import{Component as BG,_createIconNoSpan as VG}from"ag-grid-community";var HG={tag:"div",cls:"ag-side-button",role:"presentation",children:[{tag:"button",ref:"eToggleButton",cls:"ag-button ag-side-button-button",role:"tab",attrs:{type:"button",tabindex:"-1","aria-expanded":"false"},children:[{tag:"div",ref:"eIconWrapper",cls:"ag-side-button-icon-wrapper",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-side-button-label"}]}]},UG=class extends bw{constructor(e){super(),this.toolPanelDef=e,this.eToggleButton=La,this.eIconWrapper=La,this.eLabel=La}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(HG,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){const e=this.toolPanelDef,t=this.getLocaleTextFunc()(e.labelKey,e.labelDefault);this.eLabel.textContent=t}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",VG(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(e){this.toggleCss("ag-selected",e),NG(this.eToggleButton,e)}},zG={tag:"div",cls:"ag-side-buttons",role:"tablist"},WG=class extends yw{constructor(){super(zG),this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(e){if(!(e.key!==_G.TAB||!e.shiftKey)){if(GG(this.beans,!0)){e.preventDefault();return}OG(e)}}setActiveButton(e){for(const t of this.buttonComps)t.setSelected(e===t.getToolPanelId())}addButtonComp(e){const t=this.createBean(new UG(e));return this.buttonComps.push(t),this.appendChild(t),t.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:e.id})}),t}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),LG(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},$G={selector:"AG-SIDE-BAR-BUTTONS",component:WG},tp={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},sp={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},KG={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},xi={columns:tp,filters:sp,"filters-new":KG};function ka(e,t){if(e){if(e===!0)return{toolPanels:[tp,sp],defaultToolPanel:"columns"};if(typeof e=="string")return ka([e],t);if(Array.isArray(e)){const s=[];for(const i of e){const r=xi[i];if(!r){t.warn(215,{key:i,validKeys:Object.keys(xi)});continue}s.push(r)}return s.length===0?void 0:{toolPanels:s,defaultToolPanel:s[0].id}}return{toolPanels:jG(e.toolPanels,t),defaultToolPanel:e.defaultToolPanel,hiddenByDefault:e.hiddenByDefault,position:e.position,hideButtons:e.hideButtons}}}function jG(e,t){const s=[];return e&&e.forEach(i=>{const r=YG(i,t);r&&s.push(r)}),s}function YG(e,t){return typeof e!="string"?e:xi[e]?xi[e]:(t.warn(215,{key:e,validKeys:Object.keys(xi)}),null)}import{RefPlaceholder as qG,_initDetachedStyledRoot as XG,_setDisplayed as ZG}from"ag-stack";import{Component as JG}from"ag-grid-community";import{Component as QG}from"ag-grid-community";var eO=class extends ww{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"}),this.minWidth=100,this.maxWidth=null}postConstruct(){const e=this.beans.horizontalResizeSvc.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc(e),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent(e,t,s){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:s,started:e,ended:t})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd(e){return this.onResizing(e,!0)}onResizing(e,t=!1){const s=this.inverted?-1:1;let i=Math.max(this.minWidth,Math.floor(this.startingWidth-e*s));this.maxWidth!=null&&(i=Math.min(this.maxWidth,i)),this.elementToResize.style.setProperty("--ag-horizontal-size",`${i}px`),this.dispatchResizeEvent(!1,t,i)}};function tO(e,t,s){return e.getCompDetails(t,sO,void 0,s,!0)}var sO={name:"toolPanel",optionalMethods:["refresh","getState"]},iO={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},rO=class extends xw{constructor(){super(iO),this.eContent=qG,this.animationId=0,this.defParent=null,this.hasStyledRoot=!1}postConstruct(){const e=this.getGui(),t=this.resizeBar=this.createManagedBean(new eO);e.setAttribute("id",`ag-${this.getCompId()}`),t.elementToResize=e,this.appendChild(t)}ensureStyledRoot(){if(this.hasStyledRoot)return;this.hasStyledRoot=!0;const e=this.getGui(),[t,s]=XG(this.beans.environment,e);this.addDestroyFunc(s);const i=this.isDisplayed();ZG(e,!0),this.setGui(t),this.setDisplayed(i)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent(e){this.defParent=e}setToolPanelDef(e,t){const{id:s,minWidth:i,maxWidth:r,width:n,parent:o}=e;this.toolPanelId=s,this.defParent=o??null,n&&this.getGui().style.setProperty("--ag-side-bar-panel-width",`${n}px`);const a=tO(this.beans.userCompFactory,e,t);if(a==null)return!1;const l=a.newAgStackInstance();this.params=a.params,l.then(this.setToolPanelComponent.bind(this));const c=this.resizeBar;return i!=null&&(c.minWidth=i),r!=null&&(c.maxWidth=r),!0}setToolPanelComponent(e){this.toolPanelCompInstance=e;const{eContent:t}=this;t.appendChild(e.getGui()),this.addDestroyFunc(()=>{this.destroyBean(e)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(e){const t=this.gos.get("enableRtl"),s=e==="left",i=t?s:!s;this.resizeBar.inverted=i}refresh(){this.toolPanelCompInstance?.refresh?.(this.params)}refreshWithParams(e){return this.params=e,this.toolPanelCompInstance?.refresh?.(e)}animateDisplayed(e){if(this.isDisplayed()===e)return;const t=++this.animationId,{eContent:s}=this,i=()=>{this.animationId===t&&(r.classList.remove("ag-tool-panel-animating"),s.style.width="",r.style.width="")},r=this.getGui(),n=r.offsetWidth;this.setDisplayed(e),r.classList.add("ag-tool-panel-animating");const o=getComputedStyle(r).transitionDuration;if(!parseFloat(o)){i();return}r.style.transition="none",r.style.width="",s.style.width=`${s.offsetWidth}px`,r.style.width=`${n}px`;const a=r.offsetWidth;r.style.transition="",r.style.width=e?"":"0";const l=setTimeout(i,100);r.addEventListener("transitionstart",()=>clearTimeout(l),{once:!0}),r.addEventListener("transitionend",i,{once:!0})}},nO={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},oO=class extends Fw{constructor(){super(nO,[$G]),this.sideBarButtons=wG,this.toolPanelWrappers=[],this.registerCSS(DG)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));const{beans:e,gos:t}=this,{sideBar:s}=t.get("initialState")??{};this.setSideBarDef({sideBarDef:ka(t.get("sideBar"),e.log),sideBarState:s}),this.addManagedPropertyListener("sideBar",()=>this.setState()),e.sideBar.comp=this;const i=this.getFocusableElement();this.createManagedBean(new RG(i,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),MG(e,this,i),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown(e){if(e.defaultPrevented)return;const{beans:t,sideBarButtons:s}=this,i=this.getGui(),r=s.getGui(),n=Jh(t),o=i.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),a=e.target,l=e.shiftKey;if(!o)return IG(t,l,"force")?(e.preventDefault(),!0):(EG(e),!1);if(r.contains(n)){FG(o,l)&&e.preventDefault();return}if(!l)return;let c=null;o.contains(n)?c=xG({beans:t,rootNode:o,backwards:!0}):Ld(o,a)&&(c=Jo(o,a)),c||(c=r.querySelector(".ag-selected button"),c=TG(c)?c:null),c&&c!==e.target&&(e.preventDefault(),c.focus())}handleKeyDown(e){const t=Jh(this.beans),s=this.sideBarButtons;if(!s.getGui().contains(t))return;const i=s.getGui(),r=Array.prototype.slice.call(i.querySelectorAll(".ag-side-button")),n=r.findIndex(l=>l.contains(t));let o=null;switch(e.key){case sn.LEFT:case sn.UP:o=Math.max(0,n-1);break;case sn.RIGHT:case sn.DOWN:o=Math.min(n+1,r.length-1);break}if(o===null)return;const a=r[o].querySelector("button");a&&(a.focus(),e.preventDefault())}onToolPanelButtonClicked(e){const t=e.toolPanelId;this.openedItem()===t?this.openToolPanel(void 0,"sideBarButtonClicked"):this.openToolPanel(t,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:e,sideBarState:t,existingToolPanelWrappers:s}){if(this.setDisplayed(!1),this.sideBar=e,e&&this.sideBarButtons.setDisplayed(!e.hideButtons),e?.toolPanels){const i=e.toolPanels;if(this.createToolPanelsAndSideButtons(i,t,s),!this.toolPanelWrappers.length)return;const r=t?t.visible:!e.hiddenByDefault;if(this.setDisplayed(r),this.setSideBarPosition(t?t.position:e.position),r)if(t){const{openToolPanel:n}=t;n&&this.openToolPanel(n,"sideBarInitializing")}else this.openToolPanel(e.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",s=t?"right":"left";this.toggleCss("ag-side-bar-left",t),this.toggleCss("ag-side-bar-right",!t);for(const i of this.toolPanelWrappers)i.setResizerSizerSide(s);return this.dispatchSideBarUpdated(),this}setDisplayed(e,t){super.setDisplayed(e,t),this.dispatchSideBarUpdated()}getState(){const e={};for(const t of this.toolPanelWrappers)e[t.getToolPanelId()]=t.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:e}}createToolPanelsAndSideButtons(e,t,s){for(const i of e)this.createToolPanelAndSideButton(i,t?.toolPanels?.[i.id],s?.[i.id])}validateDef(e){const{id:t,toolPanel:s}=e;return t==null?(this.beans.log.warn(212),!1):ip(s)&&this.beans.filterManager?.isAdvFilterEnabled()?(this.beans.log.warn(213),!1):!0}createToolPanelAndSideButton(e,t,s){if(!this.validateDef(e)){this.destroyBean(s);return}let i;if(s)i=s,i.setDefParent(e.parent??null);else if(i=this.createBean(new rO),!i.setToolPanelDef(e,ep(this.gos,{initialState:t,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;i.setDisplayed(!1),this.renderToolPanelUnderParent(i,e.parent),this.toolPanelWrappers.push(i);const r=this.sideBarButtons.addButtonComp(e);AG(r.eToggleButton,i.getGui())}refresh(){for(const e of this.toolPanelWrappers)e.refresh()}renderToolPanelUnderParent(e,t){const s=t??e.getDefParent()??this.getGui();s!==this.getGui()&&(e.ensureStyledRoot(),s.classList.add("ag-tool-panel-external"));const i=e.getGui();i.parentElement!==s&&s.appendChild(i)}getWrapper(e){return this.toolPanelWrappers.find(t=>t.getToolPanelId()===e)}openToolPanel(e,t="api",s){const i=this.openedItem(),n=!!e&&!!i||t==="sideBarInitializing";for(const l of this.toolPanelWrappers){const c=e===l.getToolPanelId();c&&this.renderToolPanelUnderParent(l,s??null),n?l.setDisplayed(c):l.animateDisplayed(c)}const o=this.openedItem();i!==o&&(this.sideBarButtons.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,i??void 0,t))}getToolPanelInstance(e){const t=this.getWrapper(e);if(!t){this.beans.log.warn(214,{key:e});return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,s){const i=!!e&&!!t,r=this.eventSvc;t&&r.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:t,visible:!1,switchingToolPanel:i}),e&&r.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:e,visible:!0,switchingToolPanel:i})}close(e="api"){this.openToolPanel(void 0,e)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let e=null;for(const t of this.toolPanelWrappers)t.isDisplayed()&&(e=t.getToolPanelId());return e}setState(e){const t=ka(this.gos.get("sideBar"),this.beans.log),s={};t&&this.sideBar&&t.toolPanels?.forEach(i=>{const{id:r}=i;if(!r)return;const n=this.sideBar.toolPanels?.find(c=>c.id===r);if(!n||i.toolPanel!==n.toolPanel)return;const o=this.getWrapper(r);if(!o)return;const a=ep(this.gos,{...i.toolPanelParams??{},initialState:e?.toolPanels?.[r],onStateUpdated:()=>this.dispatchSideBarUpdated()});o.refreshWithParams(a)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(c=>c!==o),Qh(o.getGui()),s[r]=o)}),this.clearDownUi(),this.setSideBarDef({sideBarDef:t,sideBarState:e,existingToolPanelWrappers:s})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(const e of this.toolPanelWrappers)Qh(e.getGui()),this.destroyBean(e);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){this.sideBar?.toolPanels?.some(t=>ip(typeof t=="string"?t:t.toolPanel))&&this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function ip(e){return e==="agFiltersToolPanel"||e==="agNewFiltersToolPanel"}var aO={selector:"AG-SIDE-BAR",component:oO},lO=class extends Tw{constructor(){super(...arguments),this.beanName="sideBar"}getSelector(){return aO}},Fi={moduleName:"SideBar",version:G,beans:[lO],apiFunctions:{isSideBarVisible:dG,setSideBarVisible:hG,setSideBarPosition:pG,openToolPanel:gG,closeToolPanel:fG,getOpenedToolPanel:mG,refreshToolPanel:vG,isToolPanelShowing:CG,getToolPanelInstance:SG,getSideBar:bG},dependsOn:[$,cG]},cO='.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}:where(.ag-menu-list-no-focus-ring) .ag-compact-menu-option:focus-visible,:where(.ag-menu-list-no-focus-ring) .ag-menu-option:focus-visible{box-shadow:none}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}',rp=class extends Rd{constructor(){super({warnNoIcon:()=>this.beans.log.warn(227)})}},rn={moduleName:"MenuItem",version:G,userComponents:{agMenuItem:rp},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[cO]};import{_areEqual as _t,_clearElement as uO,_last as dO}from"ag-stack";import{Component as hO,FilterButtonComp as pO,_addGridCommonParams as gO}from"ag-grid-community";import{RefPlaceholder as np}from"ag-stack";import{Component as fO,PositionableFeature as mO}from"ag-grid-community";var vO=".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{flex:none;height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding)}.ag-column-select-column,.ag-column-select-column-group,.ag-column-select-header{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);position:relative}.ag-column-select-column,.ag-column-select-column-group{height:100%}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-column-group:where(:not(:last-child)),.ag-column-select-column:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}";import{RefPlaceholder as _a,_debounce as CO,_setDisplayed as As}from"ag-stack";import{AgCheckboxSelector as SO,AgInputTextFieldSelector as bO,Component as yO,KeyCode as wO,_createIconNoSpan as Ga}from"ag-grid-community";var xO=300,FO={tag:"div",cls:"ag-column-select-header",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-column-select-header-icon"},{tag:"ag-checkbox",ref:"eSelect",cls:"ag-column-select-header-checkbox"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-column-select-header-filter-wrapper"}]},TO=class extends Aw{constructor(){super(FO,[SO,bO]),this.eExpand=_a,this.eSelect=_a,this.eFilterTextField=_a}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:t=>{t.key===wO.SPACE&&(t.preventDefault(),this.onExpandClicked())}}),this.addManagedElementListeners(this.eSelect.getInputElement(),{click:this.onSelectClicked.bind(this)}),this.addManagedPropertyListener("functionsReadOnly",()=>this.onFunctionsReadOnlyPropChanged()),this.eFilterTextField.setClearButtonEnabled(!0).setSearchIcon(!0).onValueChange(()=>this.onFilterTextChanged()).onValueClear(()=>this.onFilterTextCleared()),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)});const e=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel(e("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel(e("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){const e=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(e),this.eSelect.toggleCss("ag-column-select-column-readonly",e)}init(e){this.params=e,this.eFilterTextField.setAutoComplete(e.browserAutoComplete);const t=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly(t),this.eSelect.toggleCss("ag-column-select-column-readonly",t),this.beans.colModel.ready&&this.showOrHideOptions()}createExpandIcons(){const e=this.beans;this.eExpand.appendChild(this.eExpandChecked=Ga("columnSelectOpen",e)),this.eExpand.appendChild(this.eExpandUnchecked=Ga("columnSelectClosed",e)),this.eExpand.appendChild(this.eExpandIndeterminate=Ga("columnSelectIndeterminate",e)),this.setExpandState(0)}showOrHideOptions(){const e=this.params,t=!e.suppressColumnFilter,s=!e.suppressColumnSelectAll,i=!e.suppressColumnExpandAll,r=!!this.beans.colModel.colDefTreeDepth,n=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(n("searchOoo","Search...")),As(this.eFilterTextField.getGui(),t),As(this.eSelect.getGui(),s),As(this.eExpand,i&&r)}onFilterTextChanged(){this.onFilterTextChangedDebounced||(this.onFilterTextChangedDebounced=CO(this,()=>{const e=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:e})},xO)),this.filterTextChangedTimeout=this.onFilterTextChangedDebounced()}onFilterTextCleared(){clearTimeout(this.filterTextChangedTimeout),this.dispatchLocalEvent({type:"filterChanged",filterText:this.eFilterTextField.getValue()})}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState(e){this.expandState=e,As(this.eExpandChecked,e===0),As(this.eExpandUnchecked,e===1),As(this.eExpandIndeterminate,e===2)}setSelectionState(e){this.selectState=e,this.eSelect.setValue(this.selectState)}},AO={selector:"AG-PRIMARY-COLS-HEADER",component:TO};import{_exists as op,_setAriaLabel as PO,_setAriaLevel as RO}from"ag-stack";import{Component as MO,DragSourceType as IO,_clamp as EO,isProvidedColumnGroup as DO}from"ag-grid-community";import{AgProvidedColumnGroup as LO,isProvidedColumnGroup as kO}from"ag-grid-community";import{_last as _O}from"ag-stack";function Ps(e){return!!e&&typeof e.children<"u"}function Gt(e){return Ps(e)?e.groupId:e.colId}function ap(e,t,s){const i=(o,a)=>{const c=o.children.map(Gt).includes(Gt(a)),u=_O(o.children),d=u&&Gt(u)!==Gt(a);return c&&d};if(!Ps(e))return!0;const r=e,n=s;if(i(r,n)||r.groupId===t&&!r.children.map(Gt).includes(Gt(n)))return r.children.push(n),!0;for(let o=r.children.length-1;o>=0&&!ap(r.children[o],t,s);o--);return!1}function lp(e){const t=(r,n)=>Ps(r)&&Ps(n)&&Gt(r)===Gt(n),s=(r,n)=>{if(!Ps(n))return r;const o=r,a=n;if(a.children&&a.groupId&&ap(o,a.groupId,a.children[0]))return o;for(const l of a.children)s(o,l);return o},i=[];for(let r=1;r<=e.length;r++){const n=e[r-1],o=e[r];t(n,o)?e[r]=s(n,o):i.push(n)}return i}function cp(e,t){const{colModel:s}=e,i=[],r=(o,a)=>{if(Ps(o)){const l=o,c=typeof l.groupId<"u"?l.groupId:l.headerName,u=new LO(l,c,!1,a),d=[];for(const h of l.children){const p=r(h,a+1);p&&d.push(p)}return u.children=d,u}else{const l=o,c=l.colId?l.colId:l.field,u=s.getNonPivotCol(c);return u||i.push(l),u}},n=[];for(const o of t){const a=r(o,0);a&&n.push(a)}return i.length>0&&e.log.warn(217,{invalidColIds:i}),n}function up(e,t){const s=dp(OO(e)),i=lp(s);t(i)}function GO(e,t){const s=dp(e),i=lp(s);t(i)}function dp(e){const t=(s,i)=>{let r;if(kO(s))if(s.isPadding())r=i;else{const o=Object.assign({},s.getColGroupDef());o.groupId=s.getGroupId(),o.children=[i],r=o}else{const o=Object.assign({},s.colDef);o.colId=s.colId,r=o}const n=s.getOriginalParent();return n?t(n,r):r};return e.map(s=>t(s,s.colDef))}function OO(e){return e.colsList.filter(t=>t.primary&&!t.showRowGroup)}import{LocalEventService as NO}from"ag-stack";var hp=class{constructor(e,t,s,i=!1,r){this.beans=e,this.depth=s,this.group=i,this.localEventService=new NO,this.cachedName=null,this.cachedNameVersion=-1,this.cachedNameOverride=null,i?(this.columnGroup=t,this._expanded=r,this.children=[]):this.column=t}get displayName(){const{beans:e,group:t,columnGroup:s,column:i}=this,{colNames:r,colModel:n}=e,o=n.colDefsVersion,a=t?n.groupHeaderNameOverrides.get(s.groupId)??null:i.headerNameOverride;return(o!==this.cachedNameVersion||a!==this.cachedNameOverride)&&(this.cachedNameVersion=o,this.cachedNameOverride=a,this.cachedName=t?r.getDisplayNameForProvidedColumnGroup(null,s,"columnToolPanel"):r.getDisplayNameForColumn(i,"columnToolPanel")),this.cachedName}get expanded(){return!!this._expanded}set expanded(e){e!==this._expanded&&(this._expanded=e,this.localEventService.dispatchEvent({type:"expandedChanged"}))}addEventListener(e,t){this.localEventService.addEventListener(e,t)}removeEventListener(e,t){this.localEventService.removeEventListener(e,t)}};import{isProvidedColumnGroup as BO}from"ag-grid-community";import{RefPlaceholder as Ti,_setAriaDescribedBy as VO,_setAriaExpanded as HO,_setAriaLabel as UO,_setDisplayed as Oa}from"ag-stack";import{AgCheckboxSelector as zO,Component as WO,DragSourceType as $O,KeyCode as Na,TouchListener as pp,_addGridCommonParams as KO,_createIcon as gp,_createIconNoSpan as jO,_getHeaderTooltipComponentDefinition as YO,_getShouldDisplayTooltip as qO,_getToolPanelClassesFromColDef as XO,_resolveHeaderTooltipValue as ZO}from"ag-grid-community";import{BeanStub as JO,_addGridCommonParams as QO}from"ag-grid-community";var eN={name:"columnLabelRenderer",optionalMethods:["refresh"],supportsJsFunction:!0};function fp(e){return e.columnLabelRenderer!=null||e.columnLabelRendererSelector!=null}var mp=class extends Pw{constructor(e,t,s,i,r,n){super(),this.eLabel=e,this.definition=t,this.source=s,this.column=i,this.columnGroup=r,this.getDisplayName=n,this.renderer=null,this.rendererClass=null,this.rendererVersion=0}postConstruct(){this.refresh()}refresh(){const e=this.getParams();this.renderer==null&&this.setFallback(e.displayName);const t=this.beans.userCompFactory.getCompDetails(this.definition,eN,void 0,e);if(!t){this.destroyRenderer(e.displayName);return}const{renderer:s}=this;if(s!=null&&this.rendererClass===t.componentClass&&s.refresh?.(t.params)===!0){this.rendererVersion++;return}this.createRenderer(t)}createRenderer(e){const t=++this.rendererVersion;e.newAgStackInstance().then(s=>{if(t!==this.rendererVersion||!this.isAlive()){this.destroyBean(s);return}if(s==null)return;const i=this.renderer;this.renderer=s,this.rendererClass=e.componentClass,this.eLabel.replaceChildren(s.getGui()),this.destroyBean(i)})}getParams(){const{gos:e,column:t,columnGroup:s,source:i}=this;return QO(e,{displayName:this.getDisplayName(),column:t,columnGroup:s,source:i})}setFallback(e){this.eLabel.textContent=e??""}destroyRenderer(e){this.rendererVersion++,this.destroyBean(this.renderer),this.renderer=null,this.rendererClass=null,e===void 0?this.eLabel.replaceChildren():this.setFallback(e)}destroy(){this.destroyRenderer(),super.destroy()}};function z(e){return!!e?.buttons?.includes("apply")}function Ae(e,t){if(!z(t))return;const s=e.sideBar?.comp.openedItem();if(!s)return;e.sideBar?.comp.getToolPanelInstance(s)?.refreshDeferredUi()}function vp(e,t,s,i,r){const n=tN(t);Cp(e,n,s,i,r)}function Cp(e,t,s,i,r){e.columnStateUpdateStrategy.getPivotMode(z(r))?iN(e,t,s,i,r):sN(e,t,s,i,r)}function tN(e){const t=[],s=i=>{for(const r of i)r.passesFilter&&(r.group?s(r.children):t.push(r.column))};return s(e),t}function sN(e,t,s,i,r){const n=e.columnStateUpdateStrategy,o=[];for(const a of t)a.colDef.lockVisible||n.isColumnVisibleInToolPanel(z(r),a)!==s&&o.push({colId:a.getId(),hide:!s});n.applyColumnState(z(r),o,i),Ae(e,r)}function iN(e,t,s,i,r){rN(e,t,s,i,r)}function rN(e,t,s,i,r){const n=e.columnStateUpdateStrategy,o=[],c=s?u=>{if(!n.isColumnSelectedInPivotModeToolPanel(z(r),u))if(u.isAllowValue()){const d=typeof u.aggFunc=="string"?u.aggFunc:e.aggFuncSvc?.getDefaultAggFunc(u);o.push({colId:u.getId(),aggFunc:d})}else u.isAllowRowGroup()?o.push({colId:u.getId(),rowGroup:!0}):u.isAllowPivot()&&o.push({colId:u.getId(),pivot:!0})}:u=>{n.isColumnSelectedInPivotModeToolPanel(z(r),u)&&o.push({colId:u.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};t.forEach(c),n.applyColumnState(z(r),o,i),Ae(e,r)}function Sp(e,t){const{columns:s,visibleState:i,pivotState:r,eventType:n}=t,o=e.columnStateUpdateStrategy,a=o.getPivotMode(z(t)),l=s.map(c=>{const u=c.colId;if(a){const d=r?.[u];return{colId:u,pivot:d?.pivot,rowGroup:d?.rowGroup,aggFunc:d?.aggFunc}}else return{colId:u,hide:!i?.[u]}});o.applyColumnState(z(t),l,n),Ae(e,t)}function nN(e){return{pivot:e.isPivotActive(),rowGroup:e.isRowGroupActive(),aggFunc:e.isValueActive()?e.aggFunc:void 0}}function bp(e,t,s){if(!s)return nN(e);const i=t.getRowGroupColumns(s).includes(e),r=t.getPivotColumns(s).includes(e),n=t.getValueColumns(s).includes(e);return{pivot:r,rowGroup:i,aggFunc:n?t.getColumnAggFunc(s,e):void 0}}import{Component as oN,_createIconNoSpan as yp,isProvidedColumnGroup as wp}from"ag-grid-community";import{_addGridCommonParams as xp}from"ag-grid-community";function Fp(e,t,s,i,r){const n=t?.colDef??s?.getColGroupDef(),o=n?.columnMenuItems;if(Array.isArray(o))return o;if(typeof o=="function")return o(xp(e,{column:t,columnGroup:s,defaultItems:r,source:i}));const a=e.getCallback("getColumnMenuItems");if(a)return a({column:t,columnGroup:s,defaultItems:r,source:i});if(i==="columnMenu"){const l=r,c=n?.mainMenuItems;if(Array.isArray(c))return c;if(typeof c=="function")return c(xp(e,{column:t,columnGroup:s,defaultItems:l}));const u=e.getCallback("getMainMenuItems");if(u)return u({column:t,columnGroup:s,defaultItems:l})}return r}var qe={addKey:"addToValues",addDefault:e=>`Add ${e} to values`,removeKey:"removeFromValues",removeDefault:e=>`Remove ${e} from values`,icon:"valuePanel"},Xe={addKey:"addToLabels",addDefault:e=>`Add ${e} to labels`,removeKey:"removeFromLabels",removeDefault:e=>`Remove ${e} from labels`,icon:"pivotPanel"},Rs={key:"scrollColumnIntoView",default:e=>`Scroll ${e} into View`,icon:"ensureColumnVisible"};function rt(e,t,s,i){return e(t,s(i),[i])}var Pe="separator";function Ba(e,t){if(!e?.length)return;let s=0,i=!0;for(const r of e){const n=r===t;n&&i||(e[s++]=r,i=n)}s>0&&e[s-1]===t&&s--,e.length=s}var Tp=(e,t)=>{if(!t)return[];let s=e;for(let i=0,r=t.length;i<r&&s;++i)s=s[t[i]];return Array.isArray(s)?s:[]},Ms=(e,t,s,i)=>{const r=e.aggData;r!==t&&(e.aggData=t,e.__localEventService&&aN(e,r,t,s,i))},Ap=(e,t,s,i)=>{Ms(e,t,s,i);const r=e.pinnedSibling;r&&Ms(r,t,s,i);const n=e.sibling;if(n){Ms(n,t,s,i);const o=n.pinnedSibling;o&&Ms(o,t,s,i)}},aN=(e,t,s,i,r)=>{if(!s){if(!t)return;const o=Object.keys(t);for(let a=0,l=o.length;a<l;++a){const c=o[a],u=i.colsById[c];u&&e.dispatchCellChangedEvent(u,void 0,t[c])}return}if(r){const o=r.cols;for(let a=0,l=o.length;a<l;++a){const{colId:c,column:u}=o[a],d=s[c],h=t?t[c]:void 0;d!==h&&e.dispatchCellChangedEvent(u,d,h)}if(!t||!r.checkRemoved)return;Pp(e,t,s,i);return}const n=Object.keys(s);for(let o=0,a=n.length;o<a;++o){const l=n[o],c=s[l],u=t?t[l]:void 0;if(c===u)continue;const d=i.colsById[l];d&&e.dispatchCellChangedEvent(d,c,u)}t&&Pp(e,t,s,i)},Pp=(e,t,s,i)=>{const r=Object.keys(t);for(let n=0,o=r.length;n<o;++n){const a=r[n];if(a in s)continue;const l=i.colsById[a];l&&e.dispatchCellChangedEvent(l,void 0,t[a])}},Rp=(e,t,s,i)=>{const r=t.getCol(s);let n=e._groupData;n||(n={},e._groupData=n);const o=r.colId,a=n[o];a!==i&&(n[o]=i,e.dispatchCellChangedEvent(r,i,a))},Mp=(e,t,s)=>{if(!e)return;const i=e.group;i!==s&&(e.group=s,e.updateHasChildren(),i&&!s&&(Ms(e,null,t.colModel),e.setAllChildrenCount(null)),e.dispatchRowEvent("groupChanged"))},Va=(e,t,s)=>{Mp(e,t,s),Mp(e.pinnedSibling,t,s)},Ai=(e,t)=>{const{gos:s,rowGroupColsSvc:i}=t;if(!i||!e)return!1;const r=s.get("groupLockGroupColumns");if(!e.isRowGroupActive()||r===0)return!1;if(r===-1)return!0;const n=i.columns.findIndex(o=>o.colId===e.colId);return r>n},Pi=(e,t,s)=>{const r=e(t,`${t==="groupBy"?"Group by":"Un-Group by"} ${s}`,[s]);return r.indexOf(s)>=0?r:`${r} ${s}`};import{AgPromise as lN,_STOP_PROPAGATION_CALLBACKS as cN,_addGridCommonParams as uN}from"ag-grid-community";import{_getRootNode as dN,_isBrowserFirefox as hN,_isBrowserSafari as pN}from"ag-stack";function gN(e){const t=dN(e),s="getSelection"in t?t.getSelection():null,i=[];for(let r=0;r<(s?.rangeCount??0);r++){const n=s?.getRangeAt(r);n&&i.push(n)}return{selection:s,ranges:i}}function fN(e,t){if(!e.gos.get("enableCellTextSelection")||!hN()&&!pN())return t();const{selection:i,ranges:r}=gN(e);t(),i?.removeAllRanges();for(const n of r)i?.addRange(n)}var mN={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},Ha={getMenuItemComp:(e,t,s)=>e.userCompFactory.getCompDetails(t,mN,"agMenuItem",uN(e.gos,s),!0)?.newAgStackInstance()??lN.resolve(),getPostProcessPopupParams:({column:e,node:t})=>({column:e,rowNode:t}),preserveRangesWhile:fN,stopPropagationCallbacks:cN,warnNoItem:(e,t)=>{e.log.warn(228,{menuItemOrString:t})}},vN=class extends li{constructor(){super(Ha)}},nn=class extends kr{constructor(e,t={column:null,node:null,value:null}){super(e,t,Ha)}},Ip=class extends Rw{constructor(e,t,s,i,r,n){super({tag:"div",cls:"ag-menu"}),this.column=e,this.mouseEventOrTouch=t,this.parentEl=s,this.params=i,this.eventType=r,this.source=n,this.displayName=null}postConstruct(){const{column:e,gos:t,source:s,beans:{colNames:i}}=this;this.initializeProperties(e);let r;e.isColumn?r=i.getDisplayNameForColumn(e,"columnToolPanel"):r=i.getDisplayNameForProvidedColumnGroup(null,e,"columnToolPanel"),this.displayName=r,this.buildMenuItemMap();let n=null,o=null;wp(e)?o=e:n=e;const a=t.get("functionsReadOnly");let l;this.isActive()?a?l=this.getDefaultTokens().filter(p=>!this.menuItemMap.get(p)?.mutatesState):l=this.getDefaultTokens():l=[];const c=Fp(t,n,o,s,l),u=this.mapMenuItems(c,n);if(this.allowEditHeaderName){const p=this.beans.colHeaderEditSvc.getEditColumnNameMenuItem(this.column);p&&u.unshift(p)}const d=n?.colDef??o?.getColGroupDef();if(u.length>0||d?.columnMenuItems!=null){const p=this.mouseEventOrTouch;"preventDefault"in p&&p.preventDefault()}u.length!==0&&this.displayContextMenu(u)}mapMenuItems(e,t){const{menuItemMap:s}=this,i=[];for(let o=0,a=e.length;o<a;++o){const l=e[o];if(typeof l=="string"){const c=l;if(s.has(c)){i.push(...this.resolveToolPanelToken(c));continue}}i.push(l)}const r=this.beans.menuItemMapper,n=r?r.mapWithStockItems(i,t,null,void 0,()=>this.getGui(),this.eventType):i.filter(o=>typeof o!="string");return Ba(n,Pe),n}initializeProperties(e){const t=this.beans.columnStateUpdateStrategy;let s;wp(e)?s=e.getLeafColumns():s=[e],this.columns=s;const i=t.getPivotMode(z(this.params));this.allowScrollIntoView=!i&&s.some(this.isColumnValidForScrollIntoView),this.allowGrouping=s.some(n=>n.primary&&n.isAllowRowGroup()),this.allowValues=s.some(n=>n.primary&&n.isAllowValue()),this.allowPivoting=i&&s.some(n=>n.isPrimary()&&n.isAllowPivot());const r=this.beans.colHeaderEditSvc;this.allowEditHeaderName=!!r?.isEditable(e)}buildMenuItemMap(){const e=this.getLocaleTextFunc(),{beans:t,displayName:s}=this,i=this.beans.columnStateUpdateStrategy,r=new Map;this.menuItemMap=r;const n=z(this.params),o=i.getPivotMode(n),a=new Set(i.getRowGroupColumns(n).map(p=>p.colId)),l=new Set(i.getValueColumns(n).map(p=>p.colId)),c=new Set(i.getPivotColumns(n).map(p=>p.colId));r.set("scrollIntoView",{allowedFunction:p=>!p.isPinned()&&!o&&this.isColumnValidForScrollIntoView(p),activeFunction:()=>!1,activateLabel:()=>rt(e,Rs.key,Rs.default,s),activateFunction:()=>{const p=this.columns.find(this.isColumnValidForScrollIntoView);p&&this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(p)},deActivateFunction:()=>{},addIcon:Rs.icon});const u=p=>p.primary&&p.isAllowRowGroup()&&!Ai(p,t);r.set("rowGroup",{allowedFunction:u,activeFunction:p=>a.has(p.colId),activateLabel:()=>Pi(e,"groupBy",s),deactivateLabel:()=>Pi(e,"ungroupBy",s),activateFunction:()=>{const p=this.addColumnsToList(i.getRowGroupColumns(n),u);i.setRowGroupColumns(n,p,this.eventType),Ae(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(i.getRowGroupColumns(n),u);i.setRowGroupColumns(n,p,this.eventType),Ae(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup",mutatesState:!0});const d=p=>p.primary&&p.isAllowValue();r.set("value",{allowedFunction:d,activeFunction:p=>l.has(p.colId),activateLabel:()=>rt(e,qe.addKey,qe.addDefault,s),deactivateLabel:()=>rt(e,qe.removeKey,qe.removeDefault,s),activateFunction:()=>{const p=this.addColumnsToList(i.getValueColumns(n),d);i.setValueColumns(n,p,this.eventType),Ae(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(i.getValueColumns(n),d);i.setValueColumns(n,p,this.eventType),Ae(this.beans,this.params)},addIcon:qe.icon,removeIcon:qe.icon,mutatesState:!0});const h=p=>o&&p.primary&&p.isAllowPivot();r.set("pivot",{allowedFunction:h,activeFunction:p=>c.has(p.colId),activateLabel:()=>rt(e,Xe.addKey,Xe.addDefault,s),deactivateLabel:()=>rt(e,Xe.removeKey,Xe.removeDefault,s),activateFunction:()=>{const p=this.addColumnsToList(i.getPivotColumns(n),h);i.setPivotColumns(n,p,this.eventType),Ae(this.beans,this.params)},deActivateFunction:()=>{const p=this.removeColumnsFromList(i.getPivotColumns(n),h);i.setPivotColumns(n,p,this.eventType),Ae(this.beans,this.params)},addIcon:Xe.icon,removeIcon:Xe.icon,mutatesState:!0})}isColumnValidForScrollIntoView(e){if(!e.isVisible())return!1;const s=e.getParent();return s?s.getDisplayedChildren()?.includes(e)??!0:!0}addColumnsToList(e,t){const s=new Set(e),i=[];for(let r=0,n=this.columns.length;r<n;++r){const o=this.columns[r];t(o)&&!s.has(o)&&i.push(o)}return e.concat(i)}removeColumnsFromList(e,t){const s=new Set(this.columns);return e.filter(i=>!t(i)||!s.has(i))}displayContextMenu(e){const t=this.getGui(),s=this.createBean(new nn),i=this.getLocaleTextFunc();let r=()=>{};t.appendChild(s.getGui()),s.addMenuItems(e),s.addManagedListeners(s,{closeMenu:()=>{this.parentEl.focus(),r()}});const n=this.beans.popupSvc,o=n.addPopup({modal:!0,eChild:t,closeOnEsc:!0,afterGuiAttached:()=>s.focusInto(),ariaLabel:i("ariaLabelContextMenu","Context Menu"),closedCallback:a=>{a instanceof KeyboardEvent&&this.parentEl.focus(),this.destroyBean(s)}});o&&(r=o.hideFunc),n.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:t})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting||this.allowEditHeaderName}getDefaultTokens(){const e=[],{menuItemMap:t,columns:s}=this;for(const[i,r]of t)s.some(n=>r.allowedFunction(n))&&e.push(i);return e}resolveToolPanelToken(e){const{menuItemMap:t,columns:s,displayName:i,beans:r}=this,n=t.get(e);if(!n)return[];const o=[],a=s.some(u=>n.allowedFunction(u)&&!n.activeFunction(u)),l=s.some(u=>n.allowedFunction(u)&&n.activeFunction(u)),c=!!n.mutatesState&&this.gos.get("functionsReadOnly");return a&&o.push({name:n.activateLabel(i),icon:yp(n.addIcon,r,null),disabled:c,action:()=>n.activateFunction()}),l&&n.removeIcon&&n.deactivateLabel&&o.push({name:n.deactivateLabel(i),icon:yp(n.removeIcon,r,null),disabled:c,action:()=>n.deActivateFunction?.()}),o}},CN={tag:"div",cls:"ag-column-select-column-group",children:[{tag:"span",ref:"eColumnGroupIcons",cls:"ag-column-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-column-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-column-group-opened-icon"}]},{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},Ep=class extends Mw{constructor(e,t,s,i,r,n){super(),this.modelItem=e,this.allowDragging=t,this.eventType=s,this.focusWrapper=i,this.params=r,this.source=n,this.cbSelect=Ti,this.eLabel=Ti,this.eGroupOpenedIcon=Ti,this.eGroupClosedIcon=Ti,this.eColumnGroupIcons=Ti,this.processingColumnStateChange=!1;const{columnGroup:o,depth:a}=e;this.columnGroup=o,this.columnDepth=a}get displayName(){return this.modelItem.displayName}postConstruct(){this.setTemplate(CN,[zO]);const{beans:e,cbSelect:t,eLabel:s,columnDepth:i,modelItem:r,focusWrapper:n,columnGroup:o,params:a,source:l}=this,{gos:c}=e,u=jO("columnDrag",e);this.eDragHandle=u,u.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");const d=t.getGui(),h=t.getInputElement();d.after(u),h.setAttribute("tabindex","-1"),fp(a)?this.labelRendererFeature=this.createManagedBean(new mp(s,a,l,null,o,()=>this.displayName)):s.textContent=this.displayName??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+i),this.getGui().style.setProperty("--ag-indentation-level",String(i)),this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>YO(o.getColGroupDef()),getLocation:()=>"columnToolPanelColumnGroup",getTooltipValue:()=>{const f=o.getColGroupDef(),m=this.displayName;return ZO(f,KO(c,{location:"columnToolPanelColumnGroup",colDef:f,column:o,value:m,valueFormatted:m}))},shouldDisplayTooltip:qO(c,()=>s),getAdditionalParams:()=>{const f=o.getColGroupDef();return{...f?{colDef:f}:{},column:o,valueFormatted:this.displayName}}})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(s,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(t,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(r,{expandedChanged:this.onExpandChanged.bind(this)}),this.addManagedEventListeners({columnHeaderNameChanged:this.onHeaderNameChanged.bind(this)});const p=new pp(this.getGui(),!1);this.addManagedListeners(p,{longTap:f=>this.onContextMenu(f.touchStart)}),this.addDestroyFunc(p.destroy.bind(p)),this.addManagedListeners(n,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)}),this.setOpenClosedIcons(),this.setupDragging(),this.onColumnStateChanged(),this.addVisibilityListenersToAllChildren(),this.refreshAriaExpanded(),this.refreshAriaLabel(),this.setupTooltip();const g=XO(o.getColGroupDef(),this.beans,null,o);for(const f of g)this.toggleCss(f,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){if(!this.columnGroup.getColGroupDef())return;const t=()=>this.tooltipFeature?.refreshTooltip();t(),this.addManagedEventListeners({newColumnsLoaded:t})}handleKeyDown(e){switch(e.key){case Na.LEFT:e.preventDefault(),this.modelItem.expanded=!1;break;case Na.RIGHT:e.preventDefault(),this.modelItem.expanded=!0;break;case Na.SPACE:e.preventDefault(),this.isSelectable()&&this.onSelectAllChanged(!this.isSelected());break}}onContextMenu(e){const t=this.createBean(new Ip(this.columnGroup,e,this.focusWrapper,this.params,this.eventType,this.source));this.addDestroyFunc(()=>{t.isAlive()&&this.destroyBean(t)})}addVisibilityListenersToAllChildren(){const e=this.onColumnStateChanged.bind(this);for(const t of this.columnGroup.getLeafColumns())this.addManagedListeners(t,{visibleChanged:e,columnValueChanged:e,columnPivotChanged:e,columnRowGroupChanged:e})}setupDragging(){if(!this.allowDragging){Oa(this.eDragHandle,!1);return}const e=this.beans,{gos:t,eventSvc:s,dragAndDrop:i}=e;let r=!t.get("suppressDragLeaveHidesColumns");const n={type:$O.ToolPanel,eElement:this.eDragHandle,dragItemName:()=>this.displayName,getDefaultIconName:()=>r?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{r=!t.get("suppressDragLeaveHidesColumns"),s.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{s.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:o=>{r&&Sp(e,{columns:this.columnGroup.getLeafColumns(),visibleState:o?.visibleState,pivotState:o?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{r&&this.onChangeCommon(!1)}};i.addDragSource(n,!0),this.addDestroyFunc(()=>i.removeDragSource(n))}createDragItem(){const e=this.columnGroup.getLeafColumns(),t={},s={},i=this.beans.columnStateUpdateStrategy,r=z(this.params);for(const n of e){const o=n.getId();t[o]=n.isVisible(),s[o]=bp(n,i,r)}return{columns:e,visibleState:t,pivotState:s}}setupExpandContract(){const{beans:e,eGroupClosedIcon:t,eGroupOpenedIcon:s,eColumnGroupIcons:i}=this;t.appendChild(gp("columnSelectClosed",e,null)),s.appendChild(gp("columnSelectOpen",e,null));const r=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(t,{click:r}),this.addManagedElementListeners(s,{click:r});const n=new pp(i,!0);this.addManagedListeners(n,{tap:r}),this.addDestroyFunc(n.destroy.bind(n))}onLabelClicked(){const e=!this.cbSelect.getValue();this.onChangeCommon(e)}onCheckboxChanged(e){this.onChangeCommon(e.selected)}getVisibleLeafColumns(){const e=[],t=s=>{for(const i of s)i.passesFilter&&(i.group?t(i.children):e.push(i.column))};return t(this.modelItem.children),e}onChangeCommon(e){this.refreshAriaLabel(),!this.processingColumnStateChange&&vp(this.beans,this.modelItem.children,e,this.eventType,this.params)}onHeaderNameChanged(e){e.columnGroup&&e.columnGroup.getGroupId()!==this.columnGroup.groupId||(this.labelRendererFeature?this.labelRendererFeature.refresh():this.eLabel.textContent=this.displayName??"",this.refreshAriaLabel())}refreshAriaLabel(){const{cbSelect:e,focusWrapper:t,displayName:s}=this,i=this.getLocaleTextFunc(),r=i("ariaColumnGroup","Column Group"),n=e.getValue(),o=n===void 0?i("ariaIndeterminate","indeterminate"):n?i("ariaVisible","visible"):i("ariaHidden","hidden"),a=i("ariaToggleVisibility","Press SPACE to toggle visibility");UO(t,`${s} ${r}`),e.setInputAriaLabel(`${a} (${o})`),VO(t,e.getInputElement().id)}onColumnStateChanged(){const e=this.workOutSelectedValue(),t=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;const s=this.cbSelect;s.setValue(e),s.setReadOnly(t),this.toggleCss("ag-column-select-column-group-readonly",t),this.processingColumnStateChange=!1}workOutSelectedValue(){const t=this.beans.columnStateUpdateStrategy.getPivotMode(z(this.params)),s=this.getVisibleLeafColumns();let i=0,r=0;for(const n of s)(t||!n.colDef.lockVisible)&&(this.isColumnChecked(n)?i++:r++);if(!(i>0&&r>0))return i>0}workOutReadOnlyValue(){const e=this.beans.columnStateUpdateStrategy.getPivotMode(z(this.params));let t=0;for(const s of this.columnGroup.getLeafColumns())e?s.isAnyFunctionAllowed()&&t++:s.colDef.lockVisible||t++;return t===0}isColumnChecked(e){const t=this.beans.columnStateUpdateStrategy;return t.getPivotMode(z(this.params))?t.isColumnSelectedInPivotModeToolPanel(z(this.params),e):t.isColumnVisibleInToolPanel(z(this.params),e)}onExpandOrContractClicked(){const e=this.modelItem,t=e.expanded;e.expanded=!t}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){const e=this.modelItem.expanded;Oa(this.eGroupClosedIcon,!e),Oa(this.eGroupOpenedIcon,e)}refreshAriaExpanded(){HO(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged(e){const t=this.cbSelect,s=t.getValue();!t.isReadOnly()&&(e&&!s||!e&&s)&&t.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected(e){this.cbSelect.setValue(e,!0)}},Ua=e=>BO(e)?e.getLeafColumns():e?[e]:[],SN=(e,t,s,i)=>{if(!t||!e)return null;const r=i.indexOf(t),n=s?r:r+1,o=bN(i,e,n);return n-o},bN=(e,t,s)=>{if(!t)return 0;const i=t[0],r=t.length;return e.indexOf(i)<s?r:0},Dp=(e,t,s,i)=>{const r=z(i);return e.get("suppressMovableColumns")||t.columnStateUpdateStrategy.getPivotMode(r)?!0:!!s.find(({colDef:a})=>!!a.suppressMovable||!!a.lockPosition)},Lp=(e,t,s,i,r)=>{if(!s)return;const{component:n}=s;let o=null,a=s.position==="top";if(n instanceof Ep?(o=n.getColumns()[0],a=!0):n&&(o=n.column),!o)return;const l=z(i),c=l?e.columnStateUpdateStrategy.getPrimaryColumns(l):e.colModel.getCols(),u=SN(t,o,a,c);u!=null&&(e.columnStateUpdateStrategy.moveColumns(l,t,u,r),Ae(e,i))},yN=e=>e.column;import{RefPlaceholder as kp,_setAriaDescribedBy as wN,_setAriaLabel as xN,_setDisplayed as FN}from"ag-stack";import{AgCheckboxSelector as TN,Component as AN,DragSourceType as PN,KeyCode as RN,TouchListener as MN,_addGridCommonParams as IN,_createIconNoSpan as EN,_getHeaderTooltipComponentDefinition as DN,_getShouldDisplayTooltip as LN,_getToolPanelClassesFromColDef as kN,_resolveHeaderTooltipValue as _N}from"ag-grid-community";var GN={tag:"div",cls:"ag-column-select-column",children:[{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},ON=class extends Iw{constructor(e,t,s,i,r,n,o){super(),this.modelItem=e,this.allowDragging=t,this.groupsExist=s,this.focusWrapper=i,this.params=r,this.eventType=n,this.source=o,this.eLabel=kp,this.cbSelect=kp,this.processingColumnStateChange=!1;const{column:a,depth:l}=e;this.column=a,this.columnDepth=l}get displayName(){return this.modelItem.displayName}postConstruct(){this.setTemplate(GN,[TN]);const{beans:e,cbSelect:t,eLabel:s,columnDepth:i,groupsExist:r,column:n,gos:o,focusWrapper:a}=this,l=EN("columnDrag",e);this.eDragHandle=l,l.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");const c=t.getGui(),u=t.getInputElement();c.after(l),u.setAttribute("tabindex","-1"),fp(this.params)?this.labelRendererFeature=this.createManagedBean(new mp(s,this.params,this.source,this.column,null,()=>this.displayName)):s.textContent=this.displayName,r&&this.addCss("ag-column-select-add-group-indent"),this.addCss(`ag-column-select-indent-${i}`),this.getGui().style.setProperty("--ag-indentation-level",String(i)),this.tooltipFeature=this.createOptionalManagedBean(e.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>DN(n.colDef),getLocation:()=>"columnToolPanelColumn",getTooltipValue:()=>{const g=this.displayName;return _N(n.colDef,IN(o,{location:"columnToolPanelColumn",colDef:n.colDef,column:n,value:g,valueFormatted:g}))},shouldDisplayTooltip:LN(o,()=>s),getAdditionalParams:()=>({colDef:n.colDef,column:n,valueFormatted:this.displayName})})),this.setupDragging();const d=this.onColumnStateChanged.bind(this);this.addManagedEventListeners({columnPivotModeChanged:d}),this.addManagedListeners(n,{columnValueChanged:d,columnPivotChanged:d,columnRowGroupChanged:d,visibleChanged:d,colDefChanged:this.onColDefChanged.bind(this),headerNameChanged:this.onColDefChanged.bind(this)}),this.addManagedListeners(a,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});const h=new MN(a);this.addManagedListeners(h,{longTap:g=>this.onContextMenu(g.touchStart)}),this.addDestroyFunc(h.destroy.bind(h)),this.addManagedPropertyListener("functionsReadOnly",this.onColumnStateChanged.bind(this)),this.addManagedListeners(t,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(s,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();const p=kN(n.colDef,this.beans,n,null);for(const g of p)this.toggleCss(g,!0)}getColumn(){return this.column}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}onContextMenu(e){const t=this.createBean(new Ip(this.column,e,this.focusWrapper,this.params,this.eventType,this.source));this.addDestroyFunc(()=>{t.isAlive()&&this.destroyBean(t)})}handleKeyDown(e){e.key===RN.SPACE&&(e.preventDefault(),this.isSelectable()&&this.onSelectAllChanged(!this.isSelected()))}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;const e=!this.cbSelect.getValue();this.onChangeCommon(e)}onCheckboxChanged(e){this.onChangeCommon(e.selected)}onChangeCommon(e){this.cbSelect.isReadOnly()||(this.refreshAriaLabel(),!this.processingColumnStateChange&&Cp(this.beans,[this.column],e,this.eventType,this.params))}onColDefChanged(){this.labelRendererFeature?this.labelRendererFeature.refresh():this.eLabel.textContent=this.displayName,this.refreshAriaLabel()}refreshAriaLabel(){const{cbSelect:e,focusWrapper:t,displayName:s}=this,i=this.getLocaleTextFunc(),r=i("ariaColumn","Column"),n=e.getValue()?i("ariaVisible","visible"):i("ariaHidden","hidden"),o=i("ariaToggleVisibility","Press SPACE to toggle visibility");xN(t,`${s} ${r}`),this.cbSelect.setInputAriaLabel(`${o} (${n})`),wN(t,e.getInputElement().id)}setupDragging(){const e=this.eDragHandle;if(!this.allowDragging){FN(e,!1);return}const t=this.beans,{gos:s,eventSvc:i,dragAndDrop:r}=t;z(this.params)&&e.setAttribute("data-column-tool-panel-deferred","");let n=!s.get("suppressDragLeaveHidesColumns");const o={type:PN.ToolPanel,eElement:e,dragItemName:()=>this.displayName,getDefaultIconName:()=>n&&!z(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{n=!s.get("suppressDragLeaveHidesColumns"),i.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{i.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:a=>{n&&!z(this.params)&&Sp(t,{columns:[this.column],visibleState:a?.visibleState,pivotState:a?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{n&&!z(this.params)&&this.onChangeCommon(!1)}};r.addDragSource(o,!0),this.addDestroyFunc(()=>r.removeDragSource(o))}createDragItem(){const e=this.column.colId,t={[e]:this.column.isVisible()},s=this.beans.columnStateUpdateStrategy,i={[e]:bp(this.column,s,z(this.params))};return{columns:[this.column],visibleState:t,pivotState:i}}onColumnStateChanged(){this.processingColumnStateChange=!0;const e=this.beans.columnStateUpdateStrategy,t=e.getPivotMode(z(this.params));if(t){const r=e.isColumnSelectedInPivotModeToolPanel(z(this.params),this.column);this.cbSelect.setValue(r)}else this.cbSelect.setValue(e.isColumnVisibleInToolPanel(z(this.params),this.column));let s,i;if(t){const r=this.gos.get("functionsReadOnly"),n=!this.column.isAnyFunctionAllowed();s=!r&&!n,i=s}else{const{enableRowGroup:r,enableValue:n,lockPosition:o,suppressMovable:a,lockVisible:l}=this.column.colDef,c=!!r||!!n,u=!!o||!!a;s=!l,i=c||!u}this.cbSelect.setReadOnly(!s),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!i),this.toggleCss("ag-column-select-column-readonly",!i&&!s),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged(e){const t=this.cbSelect;e!==t.getValue()&&(t.isReadOnly()||t.toggle())}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded(e){this.beans.log.warn(158)}},NN=class{constructor(e){this.items=e}getRowCount(){return this.items.length}getRow(e){return this.items[e]}},BN="ag-column-select-list",VN=class extends Ew{constructor(){super({tag:"div",cls:BN,role:"presentation"}),this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1,this.customColumnLayout=null}wireBeans(e){this.colModel=e.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(const e of this.destroyColumnItemFuncs)e();this.destroyColumnItemFuncs=[]}init(e,t,s,i){this.params=e;const{suppressSyncLayoutWithGrid:r,contractColumnSelection:n,suppressColumnMove:o}=e;this.allowDragging=t&&!(r&&z(e)),this.eventType=s,this.source=i,r||this.addManagedEventListeners({columnMoved:this.onColumnsChanged.bind(this)}),this.addManagedEventListeners({newColumnsLoaded:this.onColumnsChanged.bind(this)});const a=this.fireSelectionChangedEvent.bind(this);this.addManagedEventListeners({columnPivotChanged:a,columnPivotModeChanged:a,columnRowGroupChanged:a,columnValueChanged:a,columnVisible:a,newColumnsLoaded:a}),this.expandGroupsByDefault=!n;const l=o||r,c=this.createManagedBean(new Fs({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(u,d)=>{l||this.moveItems(u,d)}}));this.virtualList=c,this.appendChild(c.getGui()),c.setComponentCreator((u,d)=>(RO(d,u.depth+1),this.createComponentFromItem(u,d))),this.colModel.ready&&this.onColumnsChanged(),!l&&this.createItemDragFeature()}createItemDragFeature(){const{gos:e,beans:t,virtualList:s}=this;this.createManagedBean(new lh(this,s,{dragSourceType:IO.ToolPanel,addListeners:(i,r,n)=>{i.addManagedEventListeners({columnPanelItemDragStart:r,columnPanelItemDragEnd:n})},getCurrentDragValue:i=>yN(i),isMoveBlocked:i=>Dp(e,t,Ua(i),this.params),getNumRows:i=>i.getDisplayedColsList().length,moveItem:(i,r)=>Lp(t,Ua(i),r,this.params,this.eventType)}))}moveItems(e,t){const{gos:s,beans:i}=this,{modelItem:r}=e,{group:n,columnGroup:o,column:a,expanded:l}=r,c=Ua(n?o:a);if(Dp(s,i,c,this.params))return;const u=this.displayedColsList.indexOf(r),d=t?-1:1;let h=0;if(t){const g=e.columnDepth>0?a.parent?.children:null;g?.length&&a===g[0]&&(h=-1)}else n&&(h=l?r.children.length:0);const p=EO(u+h+d,0,this.displayedColsList.length-1);this.skipRefocus=!0,Lp(i,c,{rowIndex:p,position:t?"top":"bottom",component:this.virtualList.getComponentAt(p)},this.params,this.eventType),this.focusRowIfAlive(p-h).then(()=>{this.skipRefocus=!1})}createComponentFromItem(e,t){const{allowDragging:s,eventType:i,params:r,source:n,groupsExist:o}=this;if(e.group){const l=new Ep(e,s,i,t,r,n);return this.createBean(l),l}const a=new ON(e,s,o,t,r,i,n);return this.createBean(a),a}onColumnsChanged(){const e=this.params;this.hasLoadedInitialState||(this.hasLoadedInitialState=!0,this.isInitialState=!!e.initialState);const t=this.getExpandedStates(),s=this.colModel.pivotMode,i=z(e),r=i&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(i);if((!e.suppressSyncLayoutWithGrid||i)&&!s||r)this.buildTreeFromWhatGridIsDisplaying();else if(this.customColumnLayout&&!s){this.isInitialState=!1;return}else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(t),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){const e={};if(this.isInitialState){const{expandedGroupIds:t}=this.params.initialState;for(const s of t)e[s]=!0;return e}return this.allColsTree?(this.forEachItem(t=>{if(!t.group)return;const s=t.columnGroup;s&&(e[s.groupId]=t.expanded)}),e):{}}setExpandedStates(e){if(!this.allColsTree)return;const{isInitialState:t}=this;this.forEachItem(s=>{if(!s.group)return;const i=s.columnGroup;if(i){const r=e[i.groupId];(r!=null||t)&&(s.expanded=!!r)}})}buildTreeFromWhatGridIsDisplaying(){const e=z(this.params);if(e&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(e)){const t=this.beans.columnStateUpdateStrategy.getPrimaryColumns(e);if(t.length>0){GO(t,this.applyColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}up(this.colModel,this.applyColumnLayout.bind(this))}setColumnLayout(e){this.customColumnLayout=e,this.applyColumnLayout(e)}applyColumnLayout(e){const t=cp(this.beans,e);this.buildListModel(t),this.groupsExist=e.some(s=>s&&typeof s.children<"u"),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){const e=this.colModel;this.buildListModel(e.colDefTree),this.groupsExist=!!e.colDefTreeDepth}buildListModel(e){const t=this.onColumnExpanded.bind(this),s=a=>{a.addEventListener("expandedChanged",t);const l=a.removeEventListener.bind(a,"expandedChanged",t);this.destroyColumnItemFuncs.push(l)},i=this.beans,r=(a,l,c)=>{for(const u of a)DO(u)?n(u,l,c):o(u,l,c)},n=(a,l,c)=>{if(a.getColGroupDef()?.suppressColumnsToolPanel)return;if(a.padding){r(a.children,l,c);return}const h=new hp(i,a,l,!0,this.expandGroupsByDefault);c.push(h),s(h),r(a.children,l+1,h.children)},o=(a,l,c)=>{a.colDef?.suppressColumnsToolPanel||c.push(new hp(i,a,l))};this.destroyColumnTree(),r(e,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];const e=r=>{if(r.passesFilter&&(this.displayedColsList.push(r),r.group&&r.expanded)){const n=r.children;for(let o=0,a=n.length;o<a;++o)e(n[o])}},t=this.virtualList,s=this.allColsTree;for(let r=0,n=s.length;r<n;++r)e(s[r]);t.setModel(new NN(this.displayedColsList));let i=null;this.skipRefocus||(i=t.getLastFocusedRow()),t.refresh(),i!=null&&this.focusRowIfAlive(i),this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){const e=this.getLocaleTextFunc(),t=e("ariaColumnPanelList","Column List"),s=e("columns","Columns"),i=this.displayedColsList.length;PO(this.virtualList.getAriaElement(),`${t} ${i} ${s}`)}focusRowIfAlive(e){return e===-1?Promise.resolve():new Promise(t=>{window.setTimeout(()=>{this.isAlive()&&this.virtualList.focusRow(e),t()},0)})}forEachItem(e){const t=i=>{for(const r of i)e(r),r.group&&t(r.children)},s=this.allColsTree;s&&t(s)}doSetExpandedAll(e){this.forEachItem(t=>{t.group&&(t.expanded=e)})}setGroupsExpanded(e,t){if(!t){this.doSetExpandedAll(e);return}const s=new Set(t),i=new Set;this.forEachItem(n=>{if(!n.group)return;const o=n.columnGroup.groupId;s.has(o)&&(n.expanded=e,i.add(o))});const r=t.filter(n=>!i.has(n));r.length>0&&this.beans.log.warn(157,{unrecognisedGroupIds:r})}getExpandState(){let e=0,t=0;return this.forEachItem(s=>{s.group&&(s.expanded?e++:t++)}),e>0&&t>0?2:t>0?1:0}doSetSelectedAll(e){vp(this.beans,this.allColsTree,e,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let e=0;e<this.displayedColsList.length;e++)this.virtualList.getComponentAt(e)?.onColumnStateChanged?.()}getSelectionState(){let e=0,t=0;const s=this.beans.columnStateUpdateStrategy,i=s.getPivotMode(z(this.params));if(this.forEachItem(r=>{if(r.group||!r.passesFilter)return;const n=r.column,o=n.colDef;let a;if(i){if(!n.isAllowPivot()&&!n.isAllowRowGroup()&&!n.isAllowValue())return;a=s.isColumnSelectedInPivotModeToolPanel(z(this.params),n)??!1}else{if(o.lockVisible)return;a=s.isColumnVisibleInToolPanel(z(this.params),n)??!1}a?e++:t++}),!(e>0&&t>0))return!(e===0||t>0)}setFilterText(e){this.filterText=op(e)?e.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){const e=s=>op(this.filterText)?s.displayName?.toLowerCase().indexOf(this.filterText)!==-1:!0,t=(s,i)=>{let r=!1;if(s.group){const o=e(s);for(const a of s.children){const l=t(a,o||i);l&&(r=l)}}const n=i||r?!0:e(s);return s.passesFilter=n,n};for(const s of this.allColsTree)t(s,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){const e=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:e})}fireSelectionChangedEvent(){if(!this.allColsTree)return;const e=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:e})}getExpandedGroups(){const e=[];return this.allColsTree&&this.forEachItem(t=>{t.group&&t.expanded&&e.push(t.columnGroup.groupId)}),e}},HN={selector:"AG-PRIMARY-COLS-LIST",component:VN},UN={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},_p=class extends Dw{constructor(){super(UN,[AO,HN]),this.primaryColsHeaderPanel=np,this.primaryColsListPanel=np,this.registerCSS(vO)}init(e,t,s,i){const{primaryColsHeaderPanel:r,primaryColsListPanel:n}=this;r.init(t);const o=t.suppressColumnFilter,a=t.suppressColumnSelectAll;t.suppressColumnExpandAll&&o&&a&&r.setDisplayed(!1),this.addManagedListeners(n,{groupExpanded:c=>{r.setExpandState(c.state),t.onStateUpdated()},selectionChanged:c=>r.setSelectionState(c.state)}),n.init(t,e,s,i),this.addManagedListeners(r,{expandAll:n.doSetExpandedAll.bind(n,!0),collapseAll:n.doSetExpandedAll.bind(n,!1),selectAll:n.doSetSelectedAll.bind(n,!0),unselectAll:n.doSetSelectedAll.bind(n,!1),filterChanged:c=>n.setFilterText(c.filterText)}),this.positionableFeature=this.createManagedBean(new mO(this.getGui(),{minHeight:100}))}toggleResizable(e){this.positionableFeature.setResizable(e?{bottom:!0}:!1)}expandGroups(e){this.primaryColsListPanel.setGroupsExpanded(!0,e)}collapseGroups(e){this.primaryColsListPanel.setGroupsExpanded(!1,e)}setColumnLayout(e){this.primaryColsListPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},zN=".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select:where(:not(.ag-last-visible-child)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px}:where(.ag-column-panel) .ag-column-drop-vertical:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-column-panel-buttons:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-column-panel-buttons-button{line-height:1.5}:where(.ag-column-panel) .ag-column-panel-buttons-apply-button:not(:disabled){background-color:var(--ag-column-panel-apply-button-background-color);color:var(--ag-column-panel-apply-button-color)}",WN="ag-column-panel-deferred",$N=class extends Lw{constructor(){super({tag:"div",cls:"ag-column-panel"}),this.initialised=!1,this.childDestroyFuncs=[],this.isDeferModeEnabled=!1,this.isCommitting=!1,this.onDeferredApply=()=>{this.isCommitting=!0;try{this.beans.columnStateUpdateStrategy.commit(this.isDeferModeEnabled)}finally{this.isCommitting=!1}this.deferredButtonsComp?.updateValidity(!1),this.lastKnownGridState=this.captureGridState()},this.onDeferredCancel=()=>{this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy(),this.lastKnownGridState=this.captureGridState()},this.onPivotModePanelValueChanged=()=>{this.refreshToolPanelLayouts(),this.setLastVisible(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))},this.onColumnEverythingChanged=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;const e=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=e;return}const t=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,e);this.lastKnownGridState=e,t&&this.resetDeferredState()},this.onExternalGridChange=()=>{!this.isDeferModeEnabled||this.isCommitting||this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)&&(this.resetDeferredState(),this.lastKnownGridState=this.captureGridState())},this.registerCSS(zN)}wireBeans(e){this.colToolPanelFactory=e.colToolPanelFactory}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}init(e){const s={...gO(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...e};this.params=s,this.appliedParams=e;const{childDestroyFuncs:i,colToolPanelFactory:r,gos:n}=this,o=n.isModuleRegistered("SharedPivot"),a=o||n.isModuleRegistered("SharedRowGrouping");this.isDeferModeEnabled=z(s),this.toggleCss(WN,this.isDeferModeEnabled),!s.suppressPivotMode&&r&&o&&(this.pivotModePanel=r.createPivotModePanel(this,i,s,this.onPivotModePanelValueChanged));const l=this.createBean(new _p);if(this.primaryColsPanel=l,i.push(()=>this.destroyBean(this.primaryColsPanel)),l.init(!0,s,"toolPanelUi","columnsToolPanel"),l.addCss("ag-column-panel-column-select"),this.appendChild(l),r){!s.suppressRowGroups&&a&&(this.rowGroupDropZonePanel=r.createRowGroupPanel(this,i,s)),!s.suppressValues&&a&&(this.valuesDropZonePanel=r.createValuesPanel(this,i,s)),!s.suppressPivots&&o&&(this.pivotDropZonePanel=r.createPivotPanel(this,i,s)),this.setLastVisible();const[c]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});i.push(()=>c())}if(this.isDeferModeEnabled){const c=this.onExternalGridChange;i.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:c,columnVisible:c,columnRowGroupChanged:c,columnValueChanged:c,columnPivotChanged:c,columnPivotModeChanged:c,newColumnsLoaded:c,...s.suppressSyncLayoutWithGrid?{}:{columnMoved:c}}))}s.buttons&&(s.buttons.includes("apply")||this.beans.log.warn(298),s.buttons.length&&this.initDeferredButtons(s.buttons)),this.initialised=!0}initDeferredButtons(e){const t=this.createBean(new pO({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=t,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});const s=this.getLocaleTextFunc(),i=e.map(r=>({type:r,label:s(r==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",r==="apply"?"Apply":"Cancel")}));t.updateButtons(i),t.updateValidity(!1),t.addManagedListeners(t,{apply:this.onDeferredApply,cancel:this.onDeferredCancel}),this.appendChild(t)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){const{beans:e}=this,t=s=>(s??[]).map(i=>i.getColId());return{rowGroupColIds:t(e.rowGroupColsSvc?.columns),valueColIds:t(e.valueColsSvc?.columns),pivotColIds:t(e.pivotColsSvc?.columns),pivotMode:e.colModel.pivotMode,columnOrder:e.colModel.getCols().map(s=>s.colId),visibleColIds:e.colModel.getCols().filter(s=>s.isVisible()).map(s=>s.colId),sortState:e.colModel.getCols().filter(s=>s.getSort()).map(s=>`${s.colId}:${s.getSort()}:${s.getSortIndex()}`),aggFuncState:(e.valueColsSvc?.columns??[]).map(s=>s.aggFunc),widthState:e.colModel.getCols().map(s=>`${s.colId}:${s.getActualWidth()}`)}}isGridStateEqual(e,t){return _t(e.rowGroupColIds,t.rowGroupColIds)&&_t(e.valueColIds,t.valueColIds)&&_t(e.pivotColIds,t.pivotColIds)&&e.pivotMode===t.pivotMode&&_t(e.columnOrder,t.columnOrder)&&_t(e.visibleColIds,t.visibleColIds)&&_t(e.sortState,t.sortState)&&_t(e.aggFuncState,t.aggFuncState)&&_t(e.widthState,t.widthState)}refreshDeferredUi(){this.refreshToolPanelLayouts(),this.setLastVisible(),this.pivotModePanel?.refreshEditStrategy(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))}refreshToolPanelLayouts(){this.primaryColsPanel.syncLayoutWithGrid(),this.rowGroupDropZonePanel?.refreshGui(),this.valuesDropZonePanel?.refreshGui(),this.pivotDropZonePanel?.refresh()}setPivotModeSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.pivotModePanel=t.setPanelVisible(this.pivotModePanel,e,t.createPivotModePanel.bind(t,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible())}setRowGroupsSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.rowGroupDropZonePanel=t.setPanelVisible(this.rowGroupDropZonePanel,e,t.createRowGroupPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.setLastVisible())}setValuesSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.valuesDropZonePanel=t.setPanelVisible(this.valuesDropZonePanel,e,t.createValuesPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.setLastVisible())}setPivotSectionVisible(e){const t=this.colToolPanelFactory;t&&(this.pivotDropZonePanel=t.setPanelVisible(this.pivotDropZonePanel,e,t.createPivotPanel.bind(t,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed(e),this.setLastVisible())}setResizers(){for(const e of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!e)continue;const t=e.getGui();e.toggleResizable(!t.classList.contains("ag-last-column-drop")&&!t.classList.contains("ag-hidden")&&!t.classList.contains("ag-last-visible-child"))}}setLastVisible(){const e=this.getGui(),t=Array.prototype.slice.call(e.querySelectorAll(".ag-column-drop"));for(const r of t)r.classList.remove("ag-last-column-drop");const s=e.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),i=dO(s);i&&i.classList.add("ag-last-column-drop"),this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!i),this.setResizers()}resetChildrenHeight(){const t=this.getGui().children;for(let s=0;s<t.length;s++){const i=t[s]?.style;i?.removeProperty("height"),i?.removeProperty("flex")}}expandColumnGroups(e){this.primaryColsPanel.expandGroups(e)}collapseColumnGroups(e){this.primaryColsPanel.collapseGroups(e)}setColumnLayout(e){this.primaryColsPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsPanel.syncLayoutWithGrid()}destroyChildren(){const e=this.childDestroyFuncs;for(const t of e)t();e.length=0,uO(this.getGui())}refresh(e){const s=!!e.initialState&&e!==this.appliedParams?e.initialState:this.getState();return this.destroyChildren(),this.init({...e,initialState:s}),this.appliedParams=e,!0}getState(){return{expandedGroupIds:this.primaryColsPanel.getExpandedGroups()}}destroy(){this.destroyChildren(),super.destroy()}};import{BeanStub as KN}from"ag-grid-community";import{_addFocusableContainerListener as jN,_createIconNoSpan as YN}from"ag-grid-community";import{DragSourceType as Gp,_shouldUpdateColVisibilityAfterGroup as qN}from"ag-grid-community";import{_areEqual as XN,_clearElement as Op,_findFocusableElements as ZN,_findNextFocusableElement as za,_getActiveDomElement as Np,_isKeyboardMode as JN,_last as QN,_scrollHorizontallyToShow as Bp,_setAriaHidden as eB,_setAriaLabel as tB,_setAriaPosInSet as sB,_setAriaRole as iB,_setAriaSetSize as rB}from"ag-stack";import{Component as nB,KeyCode as Is,ManagedFocusFeature as oB,PositionableFeature as aB,_createElement as on,_createIconNoSpan as lB}from"ag-grid-community";var cB=".ag-column-drop{align-items:center;display:inline-flex;overflow:auto;position:relative;width:100%}.ag-column-drop-list{align-items:center;display:flex}.ag-column-drop-cell{align-items:center;background-color:var(--ag-column-drop-cell-background-color);border:var(--ag-column-drop-cell-border);border-radius:500px;color:var(--ag-column-drop-cell-text-color);display:flex;font-weight:400;padding:calc(var(--ag-spacing)*.25);position:relative;&:focus-visible{box-shadow:var(--ag-focus-shadow)}:where(.ag-drag-handle){color:var(--ag-column-drop-cell-drag-handle-color)}}:where(.ag-ltr) .ag-column-drop-cell{padding-left:calc(var(--ag-spacing)*.75)}:where(.ag-rtl) .ag-column-drop-cell{padding-right:calc(var(--ag-spacing)*.75)}.ag-column-drop-cell-text{flex:1 1 auto;margin:0 var(--ag-spacing);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-drop-vertical{align-items:stretch;display:flex;flex-direction:column;min-height:75px;overflow:hidden}.ag-column-drop-vertical-title-bar{align-items:center;display:flex;flex:none;padding:var(--ag-widget-container-vertical-padding) calc(var(--ag-spacing)*2) 0}.ag-column-drop-vertical-list{align-items:stretch;flex-direction:column;flex-grow:1;overflow-x:auto;padding-bottom:var(--ag-spacing);padding-left:var(--ag-spacing);padding-right:var(--ag-spacing);position:relative}:where(.ag-column-drop-empty) .ag-column-drop-vertical-list{overflow:hidden}.ag-column-drop-cell-button{cursor:pointer;min-width:0;opacity:.75}:where(.ag-ltr) .ag-column-drop-cell-button{margin-right:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-button{margin-left:calc(var(--ag-spacing)/4)}.ag-column-drop-cell-button:hover{opacity:1}:where(.ag-ltr) .ag-column-drop-cell-drag-handle{margin-left:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-drag-handle{margin-right:calc(var(--ag-spacing)/4)}.ag-column-drop-cell-drag-handle.ag-column-select-column-readonly{opacity:.5;pointer-events:none;:where(.ag-icon){opacity:.35}}.ag-column-drop-wrapper{display:flex}.ag-column-drop-horizontal-half-width{width:50%!important}.ag-column-drop-cell-ghost{opacity:.5}.ag-column-drop-horizontal{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:auto hidden;scrollbar-width:thin;white-space:nowrap}:where(.ag-ltr) .ag-column-drop-horizontal{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-column-drop-horizontal{padding-right:var(--ag-cell-horizontal-padding)}.ag-column-drop-horizontal-list{gap:var(--ag-cell-widget-spacing)}.ag-column-drop-vertical-cell{margin-top:var(--ag-spacing)}:where(.ag-ltr) .ag-column-drop-vertical-icon{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-column-drop-vertical-icon{margin-left:var(--ag-widget-horizontal-spacing)}.ag-select-agg-func-popup{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);height:calc(var(--ag-spacing)*5*3.5);padding:0;position:absolute}.ag-select-agg-func-virtual-list-item{cursor:default}:where(.ag-ltr) .ag-select-agg-func-virtual-list-item{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-select-agg-func-virtual-list-item{padding-right:calc(var(--ag-spacing)*2)}.ag-select-agg-func-virtual-list-item:hover{background-color:var(--ag-selected-row-background-color)}:where(.ag-ltr) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-left:solid var(--ag-border-width) var(--ag-border-color)}";function Vp(e,t,s){e==null||t==null||e.splice(s,0,...t)}var uB={tag:"div",cls:"ag-unselectable",role:"presentation"},Hp=class extends kw{constructor(e){super(uB),this.horizontal=e,this.state="notDragging",this.guiDestroyFunctions=[],this.childPillComponents=[],this.resizeEnabled=!1,this.addElementClasses(this.getGui()),this.ePillDropList=on({tag:"div"}),this.addElementClasses(this.ePillDropList,"list"),this.registerCSS(cB)}toggleResizable(e){this.positionableFeature.setResizable(e?{bottom:!0}:!1),this.resizeEnabled=e}isSourceEventFromTarget(e){const{dropZoneTarget:t,dragSource:s}=e;return t.contains(s.eElement)}destroy(){this.destroyGui(),super.destroy()}destroyGui(){for(const e of this.guiDestroyFunctions)e();this.guiDestroyFunctions.length=0,this.childPillComponents.length=0,Op(this.getGui()),Op(this.ePillDropList)}init(e){this.params=e??{},this.createManagedBean(new oB(this.getFocusableElement(),{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.onKeyDown.bind(this)})),this.setupDropTarget(),this.positionableFeature=new aB(this.getGui()),this.createManagedBean(this.positionableFeature),this.refreshGui(),this.addManagedElementListeners(this.getFocusableElement(),{focusin:this.onFocusIn.bind(this)})}onTabKeyDown(e){const t=ZN(this.getFocusableElement(),null,!0),s=t.length;if(s===0)return;const{shiftKey:i}=e,r=Np(this.beans),n=r===t[0],o=r===QN(t);s===1||n&&i||o&&!i||t[i?0:s-1].focus({preventScroll:!0})}onFocusIn(e){if(this.getFocusableElement().contains(e.relatedTarget))return;const s=e.target;s&&Bp(s)}onKeyDown(e){const{key:t}=e,{beans:s,horizontal:i,gos:r}=this,n=!i;let o=t===Is.DOWN,a=t===Is.UP;if(!n){const l=r.get("enableRtl");o=!l&&t===Is.RIGHT||l&&t===Is.LEFT,a=!l&&t===Is.LEFT||l&&t===Is.RIGHT}if(!(!o&&!a))if(e.preventDefault(),e.shiftKey)this.moveFocusedItem(a);else{const l=this.getFocusableElement(),c=za({beans:s,rootNode:l,backwards:a});c&&(c.focus(),Bp(c))}}moveFocusedItem(e){const t=this.getFocusedItem();if(t===-1)return;const s=e?-1:1;if(!this.normalizeAndUpdateInsertIndex(t,t+s))return;const r=this.childPillComponents[t];if(!r.isMovable())return;const n=r.getItem();this.focusItemAtIndex(this.insertIndex),this.rearrangeItems([n],!0)}addElementClasses(e,t){t=t?`-${t}`:"";const s=this.horizontal?"horizontal":"vertical";e.classList.add(`ag-column-drop${t}`,`ag-column-drop-${s}${t}`)}setupDropTarget(){this.dropTarget={getContainer:this.getGui.bind(this),getIconName:this.getIconName.bind(this),onDragging:this.onDragging.bind(this),onDragEnter:this.onDragEnter.bind(this),onDragLeave:this.onDragLeave.bind(this),onDragStop:this.onDragStop.bind(this),onDragCancel:this.onDragCancel.bind(this),isInterestedIn:this.isInterestedIn.bind(this)},this.beans.dragAndDrop?.addDropTarget(this.dropTarget)}minimumAllowedNewInsertIndex(){return 0}checkInsertIndex(e){const t=this.getNewInsertIndex(e);return t<0?!1:this.normalizeAndUpdateInsertIndex(this.insertIndex,t)}normalizeAndUpdateInsertIndex(e,t){const s=this.minimumAllowedNewInsertIndex(),i=Math.max(s,t),r=i!==e;return r&&(this.insertIndex=i),r}getNewInsertIndex(e){const t=e.event,s=this.horizontal?t.clientX:t.clientY,i=this.childPillComponents.map(n=>n.getGui().getBoundingClientRect()),r=i.findIndex(n=>this.horizontal?n.right>s&&n.left<s:n.top<s&&n.bottom>s);if(r===-1){const n=this.gos.get("enableRtl");return i.every(l=>s>(this.horizontal?l.right:l.bottom))?n&&this.horizontal?0:this.childPillComponents.length:i.every(l=>s<(this.horizontal?l.left:l.top))?n&&this.horizontal?this.childPillComponents.length:0:this.insertIndex}return this.insertIndex<=r?r+1:r}checkDragStartedBySelf(e){this.state==="notDragging"&&(this.state="rearrangeItems",this.potentialDndItems=this.getItems(e.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex(e),this.refreshGui())}onDragging(e){this.checkDragStartedBySelf(e),this.checkInsertIndex(e)&&this.refreshGui()}handleDragEnterEnd(e){}onDragEnter(e){const t=this.getItems(e.dragSource.getDragItem());this.state="newItemsIn";const s=t.filter(r=>this.isItemDroppable(r,e)),i=s.every(r=>this.childPillComponents.map(n=>n.getItem()).indexOf(r)!==-1);if(s.length!==0){if(this.potentialDndItems=s,i){this.state="notDragging";return}this.handleDragEnterEnd(e),this.checkInsertIndex(e),this.refreshGui()}}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd(e){}onDragLeave(e){if(this.state==="rearrangeItems"){const t=this.getItems(e.dragSource.getDragItem());this.removeItems(t)}this.isPotentialDndItems()&&(this.handleDragLeaveEnd(e),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}onDragCancel(e){this.isPotentialDndItems()&&(this.state==="newItemsIn"&&this.handleDragLeaveEnd(e),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}onDragStop(){this.isPotentialDndItems()&&(this.state==="newItemsIn"?this.addItems(this.potentialDndItems):this.rearrangeItems(this.potentialDndItems),this.potentialDndItems=[],this.refreshGui()),this.state="notDragging"}removeItems(e){const t=this.getExistingItems().filter(s=>!e.includes(s));this.updateItems(t),this.refreshGui()}addItems(e){if(!e)return;const t=this.getExistingItems().slice(),s=e.filter(i=>t.indexOf(i)<0);Vp(t,s,this.insertIndex),this.updateItems(t),this.refreshGui()}addItem(e){this.insertIndex=this.getExistingItems().length,this.addItems([e])}rearrangeItems(e,t){let s;return t?s=this.getExistingItems().filter(i=>e.indexOf(i)===-1):s=this.getNonGhostItems().slice(),Vp(s,e,this.insertIndex),XN(s,this.getExistingItems())?!1:(this.updateItems(s),this.refreshGui(),!0)}refreshGui(){let e=0;this.horizontal||(e=this.ePillDropList.scrollTop);const t=this.resizeEnabled,s=this.getFocusedItem(),i=this.beans,{eGridDiv:r}=i,n=JN();let o=null;n&&(o=za({beans:i,rootNode:r})??za({beans:i,rootNode:r,backwards:!0})),this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),e!==0&&(this.ePillDropList.scrollTop=e),t&&this.toggleResizable(t),n&&this.restoreFocus(s,o)}getFocusedItem(){const e=this.getGui(),t=Np(this.beans);return e.contains(t)?Array.from(e.querySelectorAll(".ag-column-drop-cell")).indexOf(t):-1}focusItemAtIndex(e){const t=this.getGui(),i=Array.from(t.querySelectorAll(".ag-column-drop-cell"))[e];i&&i.focus({preventScroll:!0})}restoreFocus(e,t){const s=this.getGui(),i=Array.from(s.querySelectorAll(".ag-column-drop-cell"));if(e===-1)return;i.length===0&&t.focus();const r=Math.min(i.length-1,e),n=i[r];n&&n.focus()}focusList(e){const t=e?this.childPillComponents.length-1:0;this.restoreFocus(t,this.getFocusableElement())}getNonGhostItems(){const e=this.getExistingItems();return this.isPotentialDndItems()?e.filter(t=>!this.potentialDndItems.includes(t)):e}addItemsToGui(){const t=this.getNonGhostItems().map(s=>this.createItemComponent(s,!1));if(this.isPotentialDndItems()){const s=this.potentialDndItems.map(i=>this.createItemComponent(i,!0));this.insertIndex>=t.length?t.push(...s):t.splice(this.insertIndex,0,...s)}this.appendChild(this.ePillDropList),t.forEach((s,i)=>{i>0&&this.addArrow(this.ePillDropList),this.ePillDropList.appendChild(s.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){const{childPillComponents:e,ePillDropList:t}=this,s=e.length,i=s===0;iB(t,i?"presentation":"listbox"),tB(t,i?null:this.getAriaLabel());for(let r=0;r<s;r++){const o=e[r].getGui();sB(o,r+1),rB(o,s)}}createItemComponent(e,t){const s=this.createPillComponent(e,this.dropTarget,t,this.horizontal);return s.addEventListener("columnRemove",this.removeItems.bind(this,[e])),this.createBean(s),this.guiDestroyFunctions.push(()=>this.destroyBean(s)),t||this.childPillComponents.push(s),s}addIconAndTitleToGui(){const{title:e,icon:t}=this.params;if(!e||!t)return;const s=on({tag:"div"});if(eB(s,!0),this.addElementClasses(s,"title-bar"),this.addElementClasses(t,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),s.appendChild(t),!this.horizontal){const i=on({tag:"span"});this.addElementClasses(i,"title"),i.textContent=e,s.appendChild(i)}this.appendChild(s)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){const{emptyMessage:e}=this.params;if(!e||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;const t=on({tag:"span"});t.textContent=e,this.addElementClasses(t,"empty-message"),this.ePillDropList.appendChild(t)}addArrow(e){if(this.horizontal){const t=this.gos.get("enableRtl"),s=lB(t?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(s,"cell-separator"),e.appendChild(s)}}};import{RefPlaceholder as dB}from"ag-stack";import{Component as hB,DragSourceType as pB,KeyCode as an,_addGridCommonParams as gB,_createElement as fB,_getHeaderTooltipComponentDefinition as mB,_resolveHeaderTooltipValue as vB,_resolvePivotSort as CB}from"ag-grid-community";import{RefPlaceholder as Wa,_setAriaLabel as SB,_setDisplayed as bB}from"ag-stack";import{Component as yB,KeyCode as wB,TouchListener as xB,_createIconNoSpan as Up}from"ag-grid-community";var FB={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},zp=class extends _w{constructor(e,t,s,i,r){super(),this.dragSourceDropTarget=e,this.ghost=t,this.horizontal=s,this.template=i,this.agComponents=r,this.eText=Wa,this.eDragHandle=Wa,this.eButton=Wa}postConstruct(){this.setTemplate(this.template??FB,this.agComponents);const e=this.getGui(),{beans:t,eDragHandle:s,eText:i,eButton:r}=this;this.addElementClasses(e),this.addElementClasses(s,"drag-handle"),this.addElementClasses(i,"text"),this.addElementClasses(r,"button"),s.appendChild(Up("columnDrag",t)),r.appendChild(Up("cancel",t)),this.tooltipFeature=this.createOptionalManagedBean(t.tooltipSvc?.createTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>this.getTooltipComponentDefinition(),getTooltipValue:()=>this.getTooltip(),getLocation:()=>this.getTooltipLocation(),getAdditionalParams:()=>this.getTooltipParams()})),this.setupComponents(),!this.ghost&&this.isDraggable()&&this.addDragSource(),this.setupAria(),this.setupTooltip(),this.activateTabIndex(),this.refreshDraggable()}isDraggable(){return!0}refreshDraggable(){this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!this.isDraggable())}setupAria(){const e=this.getLocaleTextFunc(),t=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(t,e),SB(this.getGui(),t.join(". "))}addAdditionalAriaInstructions(e,t){if(this.isRemovable()){const s=t("ariaDropZoneColumnComponentDescription","Press DELETE to remove");e.push(s)}}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}getTooltipLocation(){return"UNKNOWN"}getTooltipParams(){return{}}getTooltipComponentDefinition(){}getDragSourceId(){}getDefaultIconName(){return"notAllowed"}addDragSource(){const{beans:{dragAndDrop:e},eDragHandle:t}=this,s=this.createGetDragItem(),i=this.getDefaultIconName(),r={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:t,getDefaultIconName:()=>i,getDragItem:s,dragItemName:this.getDisplayName()};e?.addDragSource(r,!0),this.addDestroyFunc(()=>e?.removeDragSource(r))}setupComponents(){this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost&&this.addCss("ag-column-drop-cell-ghost")}isRemovable(){return!0}refreshRemove(){bB(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();const e={type:"columnRemove"};this.addGuiEventListener("keydown",s=>this.onKeyDown(s)),this.addManagedElementListeners(this.eButton,{click:s=>{this.dispatchLocalEvent(e),s.stopPropagation()}});const t=new xB(this.eButton);this.addManagedListeners(t,{tap:()=>this.dispatchLocalEvent(e)}),this.addDestroyFunc(t.destroy.bind(t))}onKeyDown(e){e.key===wB.DELETE&&this.isRemovable()&&(e.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"}))}getDisplayValue(){return this.getDisplayName()}addElementClasses(e,t){t=t?`-${t}`:"";const s=this.horizontal?"horizontal":"vertical";e.classList.add(`ag-column-drop-cell${t}`,`ag-column-drop-${s}-cell${t}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},TB=class extends zp{constructor(e,t,s,i,r,n){super(t,s,r),this.column=e,this.dropZonePurpose=i,this.updateParams=n,this.eSortIndicator=dB,this.popupShowing=!1,this.deferApply=z(n)}postConstruct(){const{sortSvc:e,colNames:t}=this.beans;this.template={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},e?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},e&&(this.agComponents=[e.SortIndicatorSelector]),this.displayName=t.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply&&this.eDragHandle.setAttribute("data-column-tool-panel-deferred",""),e&&(this.setupSort(),this.addManagedEventListeners({sortChanged:()=>{this.setupAria()}})),this.isGroupingZone()&&this.addManagedPropertyListener("groupLockGroupColumns",()=>{this.refreshRemove(),this.refreshDraggable(),this.setupAria()})}getItem(){return this.column}getDisplayName(){return this.displayName}getTooltip(){const e=this.column.colDef;return vB(e,gB(this.gos,{location:this.getTooltipLocation(),colDef:e,column:this.column,value:this.displayName,valueFormatted:this.displayName}))}getTooltipLocation(){switch(this.dropZonePurpose){case"rowGroup":return"rowGroupColumnsList";case"pivot":return"pivotColumnsList";case"aggregation":return"valueColumnsList"}}getTooltipParams(){return{colDef:this.column.colDef,column:this.column,valueFormatted:this.displayName}}getTooltipComponentDefinition(){return mB(this.column.colDef)}addAdditionalAriaInstructions(e,t){const s=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!s){const o=t("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");e.push(o)}const i=this.column.isSortable(),r=i&&this.isGroupingZone()&&!this.gos.get("rowGroupPanelSuppressSort"),n=i&&this.isPivotZone()&&!this.gos.get("pivotPanelSuppressSort");if(r||n){const o=t("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");e.push(o)}super.addAdditionalAriaInstructions(e,t)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){const e=this.getLocaleTextFunc(),{name:t,aggFuncName:s}=this.getColumnAndAggFuncName(),i=e("ariaDropZoneColumnComponentAggFuncSeparator"," of "),r={asc:e("ariaDropZoneColumnComponentSortAscending","ascending"),desc:e("ariaDropZoneColumnComponentSortDescending","descending")},n=this.getCurrentSortDirection(this.column),o=this.gos.get("rowGroupPanelSuppressSort");return[s&&`${s}${i}`,t,this.isGroupingZone()&&!o&&n&&`, ${r[n]}`].filter(a=>!!a).join("")}getColumnAndAggFuncName(){const e=this.displayName;let t="";if(this.isAggregationZone()){const s=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),i=typeof s=="string"?s:"agg";t=this.getLocaleTextFunc()(i,i)}return{name:e,aggFuncName:t}}setupSort(){this.column.isSortable()&&(this.isGroupingZone()?this.setupGroupSort():this.isPivotZone()&&this.setupPivotSort())}setupGroupSort(){this.gos.get("rowGroupPanelSuppressSort")||this.bindSort(this.getSortDefOverride.bind(this),(e,t)=>this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,e,t))}setupPivotSort(){this.gos.get("pivotPanelSuppressSort")||(this.bindSort(this.getPivotSortDefOverride.bind(this),e=>this.beans.columnStateUpdateStrategy.progressPivotSortFromEvent(this.deferApply,e)),this.addManagedEventListeners({gridColumnsChanged:()=>{this.eSortIndicator.refresh(),this.setupAria()}}))}bindSort(e,t){const{column:s,eSortIndicator:i}=this;i.setupSort(s,!0,e);const r=n=>{n.preventDefault(),t(s,n),this.column&&(i.refresh(),this.setupAria(),Ae(this.beans,this.updateParams))};this.addGuiEventListener("click",r),this.addGuiEventListener("keydown",n=>{n.key===an.ENTER&&r(n)})}getCurrentSortDirection(e){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,e)?.direction??null}getSortDefOverride(){if(this.deferApply)return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getPivotSortDefOverride(){const e=this.beans,t=CB(e,e.columnStateUpdateStrategy.getPivotSort(this.deferApply,this.column));return t===null?null:{type:"default",direction:t}}getDefaultIconName(){return"hide"}createGetDragItem(){const{column:e}=this;return()=>{const t={};return t[e.getId()]=e.isVisible(),{columns:[e],visibleState:t}}}setupComponents(){super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown(e){super.onKeyDown(e),e.key===an.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly")&&(e.preventDefault(),this.onShowAggFuncSelection())}getDisplayValue(){const{name:e,aggFuncName:t}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${t}(${e})`:e}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;const{aggFuncSvc:e,popupSvc:t}=this.beans,s=new Fs({cssIdentifier:"select-agg-func"}),i=e.getFuncNames(this.column),r=this.getGui(),n=s.getGui();s.setModel({getRow:function(p){return i[p]},getRowCount:function(){return i.length}}),this.createBean(s);const o=fB({tag:"div",cls:"ag-select-agg-func-popup"});o.style.top="0px",o.style.left="0px",o.appendChild(n),o.style.width=`${r.clientWidth}px`;const[a]=this.addManagedElementListeners(o,{focusout:p=>{!o.contains(p.relatedTarget)&&u&&u.hideFunc()}}),l=p=>{this.destroyBean(s),this.popupShowing=!1,p?.key==="Escape"&&r.focus(),a&&a()},c=this.getLocaleTextFunc(),u=t.addPopup({modal:!0,eChild:o,closeOnEsc:!0,closedCallback:l,ariaLabel:c("ariaLabelAggregationFunction","Aggregation Function")});u&&s.setComponentCreator(this.createAggSelect.bind(this,u.hideFunc)),s.addGuiEventListener("keydown",p=>{if(p.key===an.ENTER||p.key===an.SPACE){const g=s.getLastFocusedRow();if(g==null)return;const f=s.getComponentAt(g);f&&f.selectItem()}}),t.positionPopupByComponent({type:"aggFuncSelect",eventSource:r,ePopup:o,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),s.refresh();const d=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column);let h=i.findIndex(p=>p===d);h===-1&&(h=0),s.focusRow(h)}createAggSelect(e,t){const s=()=>{if(e(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,t,"toolPanelDragAndDrop"),this.column){const a=this.getGui().querySelector(".ag-column-drop-cell-text");a&&(a.textContent=this.getDisplayValue()),this.setupAria()}Ae(this.beans,this.updateParams)},i=this.getLocaleTextFunc(),r=(t||"").toString(),n=i(r,r);return new AB(s,n)}isGroupingAndLocked(){return this.isGroupingZone()&&Ai(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}isPivotZone(){return this.dropZonePurpose==="pivot"}getDragSourceType(){return pB.ToolPanel}destroy(){super.destroy(),this.column=null}},AB=class extends Gw{constructor(e,t){super({tag:"div",cls:"ag-select-agg-func-item",children:t}),this.selectItem=e,this.addGuiEventListener("click",this.selectItem)}},$a=class extends Hp{constructor(e,t,s,i=!1){super(e),this.dropZonePurpose=t,this.updateParams=s,this.embedded=i,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init(e){super.init(e),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems(e){return e.columns??[]}isInterestedIn(e,t){return e===Gp.HeaderCell?!0:e!==Gp.ToolPanel?!1:this.horizontal?!t.hasAttribute("data-column-tool-panel-deferred"):!0}minimumAllowedNewInsertIndex(){const{gos:e,rowGroupColsSvc:t}=this.beans,s=e.get("groupLockGroupColumns"),i=t?.columns.length??0;return s===-1?i:Math.min(s,i)}shouldToggleColumnVisibility(e,t){return this.isRowGroupPanel()&&qN(this.gos,t)&&!e.fromNudge}handleDragEnterEnd(e){if(this.shouldToggleColumnVisibility(e,!0)){const s=e.dragSource.getDragItem().columns;this.setColumnsVisible(s,!1,"uiColumnDragged")}}handleDragLeaveEnd(e){if(this.shouldToggleColumnVisibility(e,!1)){const t=e.dragSource.getDragItem();this.setColumnsVisible(t.columns,!0,"uiColumnDragged")}}setColumnsVisible(e,t,s){if(!e||z(this.updateParams))return;const i=e.filter(r=>!r.colDef.lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,i,t,s)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent(e,t,s,i){return new TB(e,t,s,this.dropZonePurpose,i,this.updateParams)}},Ka=class extends $a{constructor(e,t,s=!1){super(e,"pivot",t,s)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("pivotColumnsEmptyMessage","Drag here to set column labels"),s=e("pivots","Column Labels");super.init({icon:YN("pivotPanel",this.beans,null),emptyMessage:t,title:s}),this.horizontal&&!this.embedded&&jN(this.beans,this,this.getGui()),this.addManagedEventListeners({newColumnsLoaded:this.refresh.bind(this),columnPivotChanged:this.refresh.bind(this),columnPivotModeChanged:this.checkVisibility.bind(this)}),this.refresh()}getAriaLabel(){return this.getLocaleTextFunc()("ariaPivotDropZonePanelLabel","Column Labels")}refresh(){this.checkVisibility(),this.refreshGui()}checkVisibility(){const e=this.beans.colModel,t=e.pivotMode;if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(t);break;case"onlyWhenPivoting":{const s=e.isPivotActive();this.setDisplayed(t&&s);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(z(this.updateParams)))}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary)return!1;const s=this.beans.columnStateUpdateStrategy.getPivotColumns(z(this.updateParams)).includes(e);return e.isAllowPivot()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setPivotColumns(z(this.updateParams),e,"toolPanelUi"),Ae(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(z(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}};import{_addFocusableContainerListener as PB,_createIconNoSpan as RB}from"ag-grid-community";var ja=class extends $a{constructor(e,t,s=!1){super(e,"rowGroup",t,s)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("rowGroupColumnsEmptyMessage","Drag here to set row groups"),s=e("groups","Row Groups");super.init({icon:RB("rowGroupPanel",this.beans,null),emptyMessage:t,title:s}),this.horizontal&&!this.embedded&&PB(this.beans,this,this.getGui()),this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary||e.showRowGroup)return!1;const s=this.beans.columnStateUpdateStrategy.getRowGroupColumns(z(this.updateParams)).includes(e);return e.isAllowRowGroup()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setRowGroupColumns(z(this.updateParams),e,"toolPanelUi"),Ae(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(z(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}};import{_createIconNoSpan as MB}from"ag-grid-community";var IB=class extends $a{constructor(e,t){super(e,"aggregation",t)}postConstruct(){const e=this.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),s=e("values","Values");super.init({icon:MB("valuePanel",this.beans,null),emptyMessage:t,title:s}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){if(this.gos.get("functionsReadOnly")||!e.primary)return!1;const s=this.beans.columnStateUpdateStrategy.getValueColumns(z(this.updateParams)).includes(e);return e.isAllowValue()&&(!s||this.isSourceEventFromTarget(t))}updateItems(e){this.beans.columnStateUpdateStrategy.setValueColumns(z(this.updateParams),e,"toolPanelUi"),Ae(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(z(this.updateParams))}};import{RefPlaceholder as EB}from"ag-stack";import{AgToggleButtonSelector as DB,Component as LB}from"ag-grid-community";var kB={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},_B=class extends Ow{constructor(e,t){super(),this.params=e,this.onPivotModeValueChanged=t,this.cbPivotMode=EB}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(z(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){const{columnStateUpdateStrategy:e,ctrlsSvc:t}=this.beans;this.setTemplate(kB,[DB]);const s=this.cbPivotMode;s.setValue(this.getCurrentPivotMode());const i=this.getLocaleTextFunc();s.setLabel(i("pivotMode","Pivot Mode"));const r=()=>{const o=!!s.getValue();e.setPivotMode(z(this.params),o,"toolPanelUi"),this.onPivotModeValueChanged?.()},n=()=>{s.setValue(this.getCurrentPivotMode()),t.getHeaderRowContainerCtrl()?.refresh()};this.addManagedListeners(s,{fieldValueChanged:r}),this.addManagedEventListeners({newColumnsLoaded:n,columnPivotModeChanged:n})}},GB=class extends Nw{constructor(){super(...arguments),this.beanName="colToolPanelFactory"}setPanelVisible(e,t,s){return e?e.setDisplayed(t):t&&(e=s()),e}createRowGroupPanel(e,t,s){return this.createPanel(e,t,new ja(!1,s))}createValuesPanel(e,t,s){return this.createPanel(e,t,new IB(!1,s))}createPivotPanel(e,t,s){return this.createPanel(e,t,new Ka(!1,s))}createPivotModePanel(e,t,s,i,r){return this.createPanel(e,t,new _B(s,i),r)}createPanel(e,t,s,i){return s=e.createBean(s),t.push(()=>e.destroyBean(s)),i?e.prependChild(s):e.appendChild(s),s}};import{BeanStub as OB}from"ag-grid-community";import{_areEqual as ln}from"ag-stack";import{BeanStub as NB,_applyColumnState as Ri,_dispatchColumnChangedEvent as BB,_resolvePivotSort as Wp,_setColsVisible as VB,isColumnGroupAutoCol as HB,isSpecialCol as UB}from"ag-grid-community";var $p=()=>{};function Kp(e){return e==="desc"?null:e===null?"asc":"desc"}var zB=class extends Bw{constructor(){super(...arguments),this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState(e,t,s){this.getUpdateStrategy(e).applyColumnState(t,s)}commit(e){this.getUpdateStrategy(e).commit()}hasPendingChanges(e){return this.getUpdateStrategy(e).hasPendingChanges()}moveColumns(e,t,s,i){this.getUpdateStrategy(e).moveColumns(t,s,i)}reset(e){this.getUpdateStrategy(e).reset()}setColumnsVisible(e,t,s,i){this.getUpdateStrategy(e).setColumnsVisible(t,s,i)}isColumnVisibleInToolPanel(e,t){return this.getUpdateStrategy(e).isColumnVisibleInToolPanel(t)}setRowGroupColumns(e,t,s){this.getUpdateStrategy(e).setRowGroupColumns(t,s)}getRowGroupColumns(e){return this.getUpdateStrategy(e).getRowGroupColumns()}getPrimaryColumns(e){return this.getUpdateStrategy(e).getPrimaryColumns()}hasDeferredColumnOrder(e){return this.getUpdateStrategy(e).hasDeferredColumnOrder()}setValueColumns(e,t,s){this.getUpdateStrategy(e).setValueColumns(t,s)}getValueColumns(e){return this.getUpdateStrategy(e).getValueColumns()}setColumnAggFunc(e,t,s,i){this.getUpdateStrategy(e).setColumnAggFunc(t,s,i)}getColumnAggFunc(e,t){return this.getUpdateStrategy(e).getColumnAggFunc(t)}setPivotColumns(e,t,s){this.getUpdateStrategy(e).setPivotColumns(t,s)}getPivotColumns(e){return this.getUpdateStrategy(e).getPivotColumns()}setPivotMode(e,t,s){this.getUpdateStrategy(e).setPivotMode(t,s)}getPivotMode(e){return this.getUpdateStrategy(e).getPivotMode()}isColumnSelectedInPivotModeToolPanel(e,t){return this.getUpdateStrategy(e).isColumnSelectedInPivotModeToolPanel(t)}progressSortFromEvent(e,t,s){this.getUpdateStrategy(e).progressSortFromEvent(t,s)}getSortDef(e,t){return this.getUpdateStrategy(e).getSortDef(t)}progressPivotSortFromEvent(e,t){this.getUpdateStrategy(e).progressPivotSortFromEvent(t)}getPivotSort(e,t){return this.getUpdateStrategy(e).getPivotSort(t)}getUpdateStrategy(e){return e?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new WB(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new $B(this.beans))}},WB=class{constructor(e){this.beans=e,this.lastPivotColIds=[],this.reset=$p,this.commit=$p,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState(e,t){e.length&&Ri(this.beans,{state:e},t)}moveColumns(e,t,s){this.beans.colMoves?.moveColumns(e,t,s),jB(this.beans)}setColumnsVisible(e,t,s){VB(this.beans,e,t,s,!0)}setRowGroupColumns(e,t){this.beans.rowGroupColsSvc?.setColumns(e,t)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return Xa(this.beans)}setValueColumns(e,t){this.beans.valueColsSvc?.setColumns(e,t)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc(e,t,s){this.beans.valueColsSvc?.setColumnAggFunc(e,t,s)}getColumnAggFunc(e){return e.aggFunc}setPivotColumns(e,t){this.lastPivotColIds=e.map(s=>s.colId),this.beans.pivotColsSvc?.setColumns(e,t)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode(e,t){const{gos:s,colModel:i,ctrlsSvc:r}=this.beans;if(e===i.pivotMode)return;const n=this.beans.pivotColsSvc?.columns.map(o=>o.colId)??[];if(n.length>0&&(this.lastPivotColIds=n),!e){const o=this.beans.colModel.colDefList;Ri(this.beans,{state:o.map(a=>({colId:a.colId,pivot:!1,pivotIndex:null}))},t)}s.updateGridOptions({options:{pivotMode:e},source:t}),e&&this.lastPivotColIds.length>0&&this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,t),r.getHeaderRowContainerCtrl()?.refresh()}progressSortFromEvent(e,t){this.beans.sortSvc?.progressSortFromEvent(e,t)}isColumnVisibleInToolPanel(e){return e.isVisible()}isColumnSelectedInPivotModeToolPanel(e){return e.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.pivotMode}getSortDef(e){return e.getSortDef()}progressPivotSortFromEvent(e){e.pivotSort=Kp(Wp(this.beans,e.pivotSort)),BB(this.beans.eventSvc,"columnPivotChanged",[e],"uiColumnSorted")}getPivotSort(e){return e.pivotSort}},$B=class{constructor(e){this.beans=e,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){const{state:e,beans:t}=this,{columnState:s,columnOrder:i,rowGroup:r,aggregation:n,pivot:o,pivotMode:a,sort:l,aggFuncs:c}=e,u=d=>(d??[]).map(h=>h.colId);if(s)for(const[d,h]of s.patches){const p=t.colModel.getNonPivotColById(d);if(p&&(h.hide!==void 0&&h.hide!==!p.visible||h.rowGroup!==void 0&&!!h.rowGroup!==p.rowGroupActive||h.pivot!==void 0&&!!h.pivot!==p.pivotActive||h.aggFunc!==void 0&&((h.aggFunc??null)!==(p.aggFunc??null)||h.aggFunc!=null!==p.isValueActive())))return!0}if(i&&!ln(i.colIds,qa(t))||r&&!ln(r.colIds,u(t.rowGroupColsSvc?.columns))||n&&!ln(n.colIds,u(t.valueColsSvc?.columns))||o&&!ln(o.colIds,u(t.pivotColsSvc?.columns))||a&&a.pivotMode!==t.colModel.pivotMode)return!0;if(l){for(const[d,h]of l.sortDefsByColId){const p=t.colModel.getNonPivotColById(d);if(p&&(h?.direction??null)!==(p.getSortDef()?.direction??null))return!0}if(l.baselineCleared){const d=Xa(t);for(const h of d)if(!l.sortDefsByColId.has(h.colId)&&h.getSortDef()!==null)return!0}}if(c)for(const[d,h]of c.values){const p=t.colModel.getNonPivotColById(d);if(p&&h!==p.aggFunc)return!0}return!1}commit(){const{beans:e,state:t}=this,s=[];for(const n of Object.keys(t)){const o=t[n];o&&s.push({type:n,...o})}const i=s.sort((n,o)=>n.seq-o.seq),r=e.colModel;r.beginColBatch();try{for(const n of i)KB(n)||(r.endColBatch("toolPanelUi"),r.beginColBatch()),this.applyOperation(n)}finally{r.endColBatch("toolPanelUi")}this.reset()}applyOperation(e){const{beans:t}=this;switch(e.type){case"columnState":{Ri(t,{state:[...e.patches.values()]},e.eventType);break}case"columnOrder":{const s=e.colIds.map(i=>t.colModel.getNonPivotColById(i)).filter(i=>!!i&&Ii(i));if(!t.colModel.pivotMode)for(let i=0;i<s.length;i++){const r=s[i],n=t.colModel.colsList,o=n.findIndex(l=>Ii(l)),a=(o>=0?o:0)+i;n[a]!==r&&t.colMoves?.moveColumns([r],a,e.eventType,!0)}jp(t,s);break}case"rowGroup":{t.rowGroupColsSvc?.setColumns(e.colIds,e.eventType);break}case"aggregation":{t.valueColsSvc?.setColumns(e.colIds,e.eventType);break}case"pivot":{this.lastPivotColIds=e.colIds,t.pivotColsSvc?.setColumns(e.colIds,e.eventType);break}case"pivotMode":{const{colModel:s,ctrlsSvc:i,gos:r}=t;if(e.pivotMode!==s.pivotMode){const n=t.pivotColsSvc?.columns.map(o=>o.colId)??[];if(n.length>0&&(this.lastPivotColIds=n),!e.pivotMode){const a=t.colModel.colDefList.map(l=>({colId:l.colId,pivot:!1,pivotIndex:null}));Ri(t,{state:a},e.eventType)}if(r.updateGridOptions({options:{pivotMode:e.pivotMode},source:e.eventType}),e.pivotMode){const o=this.state.pivot?.colIds??this.lastPivotColIds;o.length>0&&t.pivotColsSvc?.setColumns(o,e.eventType)}i.getHeaderRowContainerCtrl()?.refresh()}break}case"sort":{const s=[];let i=0;for(const[r,n]of e.sortDefsByColId)s.push({colId:r,sort:n?.direction??null,sortIndex:n?.direction?i++:null,sortType:n?.type??void 0});Ri(t,{state:s,defaultState:e.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},e.eventType);break}case"aggFuncs":{for(const[s,i]of e.values){const r=t.colModel.getNonPivotColById(s);r&&t.valueColsSvc?.setColumnAggFunc(r,i,e.eventType)}break}}}applyColumnState(e,t){for(const i of e)cn(this.state,i);const s=Ei(this.state);s.seq=nt(this.sequence),this.sequence=s.seq,s.eventType=t}moveColumns(e,t,s){const i=new Set(e.map(l=>l.colId)),n=(this.state.columnOrder?.colIds??qa(this.beans)).filter(l=>!i.has(l)),o=e.map(l=>l.colId),a=nt(this.sequence);this.sequence=a,this.state.columnOrder={colIds:[...n.slice(0,t),...o,...n.slice(t)],eventType:s,seq:a}}setColumnsVisible(e,t,s){for(const r of e)r.colDef.lockVisible||cn(this.state,{colId:r.colId,hide:!t});const i=Ei(this.state);i.seq=nt(this.sequence),this.sequence=i.seq,i.eventType=s}setRowGroupColumns(e,t){Za(this.state,"rowGroup");const s=nt(this.sequence);this.sequence=s,this.state.rowGroup={colIds:e.map(i=>i.colId),eventType:t,seq:s}}setValueColumns(e,t){Za(this.state,"aggFunc");const s=new Set((this.beans.valueColsSvc?.columns??[]).map(n=>n.colId)),i=Yp(this.state);for(const n of e)if(!s.has(n.colId)&&!i.values.has(n.colId)){const o=n.aggFunc,a=o??this.beans.aggFuncSvc?.getDefaultAggFunc(n);a!=null&&i.values.set(n.colId,a)}const r=nt(this.sequence);this.sequence=r,i.seq=r,i.eventType=t,this.state.aggregation={colIds:e.map(n=>n.colId),eventType:t,seq:r}}setColumnAggFunc(e,t,s){cn(this.state,{colId:e.colId,aggFunc:t});const i=Ei(this.state);i.seq=nt(this.sequence),this.sequence=i.seq,i.eventType=s;const r=Yp(this.state);r.seq=i.seq,r.eventType=s,r.values.set(e.colId,t)}getColumnAggFunc(e){const t=e.colId;return this.state.aggFuncs?.values.has(t)?this.state.aggFuncs.values.get(t):e.aggFunc}isColumnVisibleInToolPanel(e){const t=this.state.columnState?.patches.get(e.colId);return t?.hide!==void 0?!t.hide:e.visible}isColumnSelectedInPivotModeToolPanel(e){const t=e.colId,s=this.state.columnState?.patches.get(t);let i;s?.rowGroup!==void 0?i=!!s.rowGroup:this.state.rowGroup?i=this.state.rowGroup.colIds.includes(t):i=e.rowGroupActive;let r;s?.pivot!==void 0?r=!!s.pivot:this.state.pivot?r=this.state.pivot.colIds.includes(t):r=e.pivotActive;let n;return s?.aggFunc!==void 0?n=s.aggFunc!=null:this.state.aggregation?n=this.state.aggregation.colIds.includes(t):n=e.isValueActive(),i||r||n}setPivotColumns(e,t){Za(this.state,"pivot");const s=nt(this.sequence);this.sequence=s,this.state.pivot={colIds:e.map(i=>i.colId),eventType:t,seq:s}}setPivotMode(e,t){const s=nt(this.sequence);this.sequence=s,this.state.pivotMode={pivotMode:e,eventType:t,seq:s}}getRowGroupColumns(){return Mi(this.beans,Ya(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,e=>e.rowGroup==null?void 0:!!e.rowGroup))}getPrimaryColumns(){return Mi(this.beans,this.state.columnOrder?.colIds??qa(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return Mi(this.beans,Ya(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,e=>e.aggFunc===void 0?void 0:e.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];const e=this.beans.pivotColsSvc?.columns,t=e?.length?e:Mi(this.beans,this.lastPivotColIds);return Mi(this.beans,Ya(this.state.pivot?.colIds,t,this.state.columnState?.patches,s=>s.pivot==null?void 0:!!s.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.pivotMode}getSortDef(e){const t=this.state.sort,s=e.colId,i=t?.sortDefsByColId;return i?.has(s)?i.get(s)??null:t?.baselineCleared?null:e.getSortDef()}progressPivotSortFromEvent(e){const t=Kp(Wp(this.beans,this.getPivotSort(e)));cn(this.state,{colId:e.colId,pivotSort:t});const s=Ei(this.state);s.seq=nt(this.sequence),this.sequence=s.seq,s.eventType="uiColumnSorted"}getPivotSort(e){const t=this.state.columnState?.patches.get(e.colId);return t?.pivotSort!==void 0?t.pivotSort:e.pivotSort}progressSortFromEvent(e,t){const s=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:i}=this.beans,r=e.colId;let n;s.sortDefsByColId.has(r)?n=s.sortDefsByColId.get(r):s.baselineCleared?n=null:n=e.getSortDef();const o=i?.getNextSortDirection(e,n);if(!o)return;const{gos:a}=this.beans;((a.get("multiSortKey")==="ctrl"?t.ctrlKey||t.metaKey:t.shiftKey)||a.get("alwaysMultiSort"))&&!a.get("suppressMultiSort")||(s.sortDefsByColId.clear(),s.baselineCleared=!0),s.sortDefsByColId.set(r,o.direction?o:null),s.seq=nt(this.sequence),this.sequence=s.seq,this.state.sort=s}};function KB(e){const t=e.type;return t==="rowGroup"||t==="aggregation"||t==="pivot"}function Mi(e,t){return t?t.map(s=>e.colModel.getNonPivotColById(s)).filter(s=>!!s):[]}function Ya(e,t,s,i){const r=[...e??t?.map(o=>o.colId)??[]];if(!s?.size)return r;const n=new Set(r);for(const[o,a]of s){const l=i(a);if(l===void 0)continue;if(l){n.has(o)||(r.push(o),n.add(o));continue}if(!n.has(o))continue;n.delete(o);const c=r.indexOf(o);c>=0&&r.splice(c,1)}return r}function jB(e){const t=e.colModel.colsList.filter(s=>Ii(s)).map(s=>e.colModel.getNonPivotCol(s.colId)).filter(s=>!!s);jp(e,t)}function jp(e,t){const s=e.colModel.colDefList;if(s.length===0)return;const i=new Set(t);e.colModel.replaceColDefList([...t,...s.filter(r=>Ii(r)&&!i.has(r))])}function qa(e){return Xa(e).map(t=>t.colId)}function Xa(e){return e.colModel.colDefList.filter(Ii)}function Ii(e){return e.primary?!HB(e)&&!UB(e):!1}function nt(e){return e+1}function cn(e,t){const s=Ei(e),i=s.patches.get(t.colId);s.patches.set(t.colId,i?{...i,...t}:t)}function Za(e,t){const s=e.columnState?.patches;if(s?.size)for(const[i,r]of s){if(!(t in r))continue;const n={...r};if(delete n[t],Object.keys(n).length===1){s.delete(i);continue}s.set(i,n)}}function Ei(e){let{columnState:t}=e;return t||(t={patches:new Map,seq:0,eventType:"toolPanelUi"},e.columnState=t),t}function Yp(e){let{aggFuncs:t}=e;return t||(t={values:new Map,seq:0,eventType:"toolPanelUi"},e.aggFuncs=t),t}var YB=class extends Vw{constructor(){super(...arguments),this.beanName="columnStateUpdateStrategy"}applyColumnState(e,t,s){this.delegate("applyColumnState",e,t,s)}commit(e){this.delegate("commit",e)}hasPendingChanges(e){return this.delegate("hasPendingChanges",e)}moveColumns(e,t,s,i){this.delegate("moveColumns",e,t,s,i)}reset(e){this.delegate("reset",e)}setColumnsVisible(e,t,s,i){this.delegate("setColumnsVisible",e,t,s,i)}isColumnVisibleInToolPanel(e,t){return this.delegate("isColumnVisibleInToolPanel",e,t)}setRowGroupColumns(e,t,s){this.delegate("setRowGroupColumns",e,t,s)}getRowGroupColumns(e){return this.delegate("getRowGroupColumns",e)}getPrimaryColumns(e){return this.delegate("getPrimaryColumns",e)}hasDeferredColumnOrder(e){return this.delegate("hasDeferredColumnOrder",e)}setValueColumns(e,t,s){this.delegate("setValueColumns",e,t,s)}getValueColumns(e){return this.delegate("getValueColumns",e)}setColumnAggFunc(e,t,s,i){this.delegate("setColumnAggFunc",e,t,s,i)}getColumnAggFunc(e,t){return this.delegate("getColumnAggFunc",e,t)}setPivotColumns(e,t,s){this.delegate("setPivotColumns",e,t,s)}getPivotColumns(e){return this.delegate("getPivotColumns",e)}setPivotMode(e,t,s){this.delegate("setPivotMode",e,t,s)}getPivotMode(e){return this.delegate("getPivotMode",e)}isColumnSelectedInPivotModeToolPanel(e,t){return this.delegate("isColumnSelectedInPivotModeToolPanel",e,t)}progressSortFromEvent(e,t,s){this.delegate("progressSortFromEvent",e,t,s)}getSortDef(e,t){return this.delegate("getSortDef",e,t)}progressPivotSortFromEvent(e,t){this.delegate("progressPivotSortFromEvent",e,t)}getPivotSort(e,t){return this.delegate("getPivotSort",e,t)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new zB))}delegate(e,...t){const s=this.getUpdateStrategy();return s[e].bind(s)(...t)}},Ja={moduleName:"SharedColumnStateUpdateStrategy",version:G,beans:[YB],dependsOn:[$]},qp={moduleName:"ColumnsToolPanel",version:G,beans:[GB],userComponents:{agColumnsToolPanel:$N},icons:{ensureColumnVisible:"column-arrow",columnsToolPanel:"columns",menuAddRowGroup:"group",menuRemoveRowGroup:"group",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},dependsOn:[$,Ja,Fi,oG,lG,aG,rn]};import{_ColumnMoveModule as qB,_PopupModule as XB,_SharedDragAndDropModule as ZB,_SharedMenuModule as JB}from"ag-grid-community";import{BeanStub as QB,_createIconNoSpan as Xp}from"ag-grid-community";var eV=class extends Hw{constructor(){super(...arguments),this.beanName="chartMenuItemMapper"}getChartItems(e){const t=this.beans,s=t.chartSvc,i=e==="pivotChart";if(!s)return null;const r=this.getLocaleTextFunc.bind(this),n=i?new tV(t,s,r):new sV(t,s,r),o=s.isEnterprise();let a=n.getMenuItem();if(a?.subMenu&&!o){const c=u=>({...u,subMenu:u.subMenu?.filter(d=>!d._enterprise).map(d=>c(d))});a=c(a)}const l=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;return l&&(a=this.filterAndOrderChartMenu(a,l,n.getConfigLookup())),this.cleanInternals(a)}cleanInternals(e){if(!e)return e;const t=s=>{delete s?._key,delete s?._enterprise;for(const i of s?.subMenu??[])t(i);return s};return t(e)}buildLookup(e){const t={},s=i=>{if(t[i._key]=i,i.subMenu)for(const r of i.subMenu)s(r)};return s(e),t}filterAndOrderChartMenu(e,t,s){const i=this.buildLookup(e),r={...e,subMenu:[]};for(const n of Object.keys(t)){const o=t[n],a=s[n];if(a===null)continue;if(a==null){this.warn(173,{group:n});continue}const l=i[a._key];if(l)if(l.subMenu){const c=o.map(u=>{const d=a[u];if(d==null){this.warn(174,{group:n,chartType:u});return}return i[d]}).filter(u=>u!==void 0);c.length>0&&(l.subMenu=c,r.subMenu?.push(l))}else r.subMenu?.push(l)}return r.subMenu?.length==0?null:r}},tV=class{constructor(e,t,s){this.beans=e,this.chartSvc=t,this.getLocaleTextFunc=s}getMenuItem(){const e=this.getLocaleTextFunc(),t=(s,i,r,n,o=!1)=>({name:e(s,i+"\u200E"),action:()=>this.chartSvc.createPivotChart({chartType:r}),_key:n,_enterprise:o});return{name:e("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),t("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),t("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped","groupedBar","pivotGroupedBar"),t("stackedBar","Stacked","stackedBar","pivotStackedBar"),t("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:e("pieChart","Pie"),subMenu:[t("pie","Pie","pie","pivotPie"),t("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:e("lineChart","Line"),subMenu:[t("lineChart","Line","line","pivotLineChart"),t("stackedLine","Stacked","stackedLine","pivotStackedLine"),t("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:e("areaChart","Area"),subMenu:[t("areaChart","Area","area","pivotArea"),t("stackedArea","Stacked","stackedArea","pivotStackedArea"),t("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter","scatter","pivotScatter"),t("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:e("statisticalChart","Statistical"),subMenu:[t("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemapChart","Treemap","treemap","pivotTreemap",!0),t("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:e("funnel","Funnel"),subMenu:[t("funnel","Funnel","funnel","pivotFunnel"),t("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),t("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),t("AreaColumnCombo","Area & Column","areaColumnCombo","pivotAreaColumnCombo")]}],icon:Xp("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"pivotColumnChart",column:"pivotGroupedColumn",stackedColumn:"pivotStackedColumn",normalizedColumn:"pivotNormalizedColumn"},barGroup:{_key:"pivotBarChart",bar:"pivotGroupedBar",stackedBar:"pivotStackedBar",normalizedBar:"pivotNormalizedBar"},pieGroup:{_key:"pivotPieChart",pie:"pivotPie",donut:"pivotDonut",doughnut:"pivotDonut"},lineGroup:{_key:"pivotLineChart",line:"pivotLineChart",stackedLine:"pivotStackedLine",normalizedLine:"pivotNormalizedLine"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},combinationGroup:{_key:"pivotCombinationChart",columnLineCombo:"pivotColumnLineCombo",areaColumnCombo:"pivotAreaColumnCombo",customCombo:null},hierarchicalGroup:{_key:"pivotHierarchicalChart",treemap:"pivotTreemap",sunburst:"pivotSunburst"},statisticalGroup:{_key:"pivotStatisticalChart",histogram:"pivotHistogram",rangeBar:null,rangeArea:null,boxPlot:null},funnelGroup:{_key:"pivotFunnel",funnel:"pivotFunnel",coneFunnel:"pivotConeFunnel",pyramid:"pivotPyramid"},polarGroup:null,specializedGroup:null}}},sV=class{constructor(e,t,s){this.beans=e,this.chartSvc=t,this.getLocaleTextFunc=s}getMenuItem(){const e=this.getLocaleTextFunc(),t=(s,i,r,n,o=!1)=>({name:e(s,i),action:()=>this.chartSvc.createChartFromCurrentRange(r),_key:n,_enterprise:o});return{name:e("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),t("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),t("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped","groupedBar","rangeGroupedBar"),t("stackedBar","Stacked","stackedBar","rangeStackedBar"),t("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:e("pieChart","Pie"),subMenu:[t("pie","Pie","pie","rangePie"),t("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:e("lineChart","Line"),subMenu:[t("lineChart","Line","line","rangeLineChart"),t("stackedLine","Stacked","stackedLine","rangeStackedLine"),t("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:e("areaChart","Area"),subMenu:[t("areaChart","Area","area","rangeArea"),t("stackedArea","Stacked","stackedArea","rangeStackedArea"),t("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter","scatter","rangeScatter"),t("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:e("polarChart","Polar"),subMenu:[t("radarLine","Radar Line","radarLine","rangeRadarLine"),t("radarArea","Radar Area","radarArea","rangeRadarArea"),t("nightingale","Nightingale","nightingale","rangeNightingale"),t("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),t("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:e("statisticalChart","Statistical"),subMenu:[t("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),t("histogramChart","Histogram","histogram","rangeHistogram",!1),t("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),t("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemap","Treemap","treemap","rangeTreemap"),t("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:e("specializedChart","Specialized"),subMenu:[t("heatmap","Heatmap","heatmap","rangeHeatmap"),t("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:e("funnel","Funnel"),subMenu:[t("funnel","Funnel","funnel","rangeFunnel"),t("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),t("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),t("AreaColumnCombo","Area & Column","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:Xp("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"rangeColumnChart",column:"rangeGroupedColumn",stackedColumn:"rangeStackedColumn",normalizedColumn:"rangeNormalizedColumn"},barGroup:{_key:"rangeBarChart",bar:"rangeGroupedBar",stackedBar:"rangeStackedBar",normalizedBar:"rangeNormalizedBar"},pieGroup:{_key:"rangePieChart",pie:"rangePie",donut:"rangeDonut",doughnut:"rangeDonut"},lineGroup:{_key:"rangeLineChart",line:"rangeLineChart",stackedLine:"rangeStackedLine",normalizedLine:"rangeNormalizedLine"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},polarGroup:{_key:"rangePolarChart",radarLine:"rangeRadarLine",radarArea:"rangeRadarArea",nightingale:"rangeNightingale",radialColumn:"rangeRadialColumn",radialBar:"rangeRadialBar"},statisticalGroup:{_key:"rangeStatisticalChart",boxPlot:"rangeBoxPlot",histogram:"rangeHistogram",rangeBar:"rangeRangeBar",rangeArea:"rangeRangeArea"},hierarchicalGroup:{_key:"rangeHierarchicalChart",treemap:"rangeTreemap",sunburst:"rangeSunburst"},specializedGroup:{_key:"rangeSpecializedChart",heatmap:"rangeHeatmap",waterfall:"rangeWaterfall"},funnelGroup:{_key:"rangeFunnel",funnel:"rangeFunnel",coneFunnel:"rangeConeFunnel",pyramid:"rangePyramid"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}};import{_findNextFocusableElement as iV,_getActiveDomElement as rV}from"ag-stack";import{BeanStub as nV,_addGridCommonParams as oV}from"ag-grid-community";var aV=class extends Uw{constructor(){super(...arguments),this.beanName="colChooserFactory"}createColumnSelectPanel(e,t,s,i){const r=e.createManagedBean(new _p),n=i??t?.colDef.columnChooserParams??{},{columnLabelRenderer:o,columnLabelRendererParams:a,columnLabelRendererSelector:l,contractColumnSelection:c,suppressColumnExpandAll:u,suppressColumnFilter:d,suppressColumnSelectAll:h,suppressSyncLayoutWithGrid:p,columnLayout:g}=n;return r.init(!!s,oV(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!c,suppressColumnExpandAll:!!u,suppressColumnFilter:!!d,suppressColumnSelectAll:!!h,suppressSyncLayoutWithGrid:!!g||!!p,columnLabelRenderer:o,columnLabelRendererParams:a,columnLabelRendererSelector:l,onStateUpdated:()=>{}}),"columnMenu","columnChooser"),g&&r.setColumnLayout(g),r}showColumnChooser({column:e,chooserParams:t,eventSource:s,headerPosition:i}){this.hideActiveColumnChooser();const r=this.createColumnSelectPanel(this,e,!0,t),n=this.getLocaleTextFunc(),o=this.beans,{focusSvc:a,menuUtils:l}=o,c=rV(o),u=s??(c instanceof HTMLElement?c:void 0),d=e??void 0,h=e?.allColsIndex??-1,p=e?a.focusedHeader??i??null:null;this.activeColumnChooserDialog=this.createBean(new ns({title:n("chooseColumns","Choose Columns"),component:r,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{iV({beans:o,rootNode:r.getGui()})?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,e)},closedCallback:g=>{const f=this.activeColumnChooser.getGui();this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,e),(d||u)&&l.restoreFocusOnClose({column:d,headerPosition:p,columnIndex:h,eventSource:u},f,g,!0)},postProcessPopupParams:{type:"columnChooser",column:e,eventSource:u}})),this.activeColumnChooser=r}hideActiveColumnChooser(){this.activeColumnChooserDialog=this.destroyBean(this.activeColumnChooserDialog)}destroy(){this.hideActiveColumnChooser(),super.destroy()}dispatchVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:!1,key:"columnChooser",column:t??null})}};import{BeanStub as lV,_getAvailableSortTypes as cV,_getDisplaySortForColumn as uV,_getGrandTotalRow as dV,_isClientSideRowModel as hV,_isLegacyMenuEnabled as pV}from"ag-grid-community";var gV=class extends zw{constructor(){super(...arguments),this.beanName="colMenuFactory"}createMenu(e,t,s,i,r){const n=e.createManagedBean(new nn(0,{column:s??null,node:null,value:null})),o=this.beans.menuItemMapper.mapWithStockItems(t,s??null,null,void 0,i,"columnMenu",r??null);return n.addMenuItems(o),n}getMenuItems(e=null,t=null){const s=this.getDefaultMenuOptions(e,t),i=[...Fp(this.gos,e,t,"columnMenu",s)];return Ba(i,Pe),i}getDefaultMenuOptions(e,t=null){const s=[],{beans:i,gos:r}=this,{colChooserFactory:n,rowGroupColsSvc:o,colModel:a,expansionSvc:l,sortSvc:c,menuSvc:u,pinnedCols:d,aggFuncSvc:h,colAutosize:p}=i,g=pV(r),f=()=>{!g&&n&&s.push("columnChooser"),s.push("resetColumns")};if(!e)return t&&i.colHeaderEditSvc?.isEditable(t)&&(s.push("editColumnName"),s.push(Pe)),f(),s;const{colDef:m}=e,v=d&&!m.lockPinned,C=o?.columns.length??0,S=C>0,w=dV(r),b=r.get("treeData"),y=e.primary,T=!y||h&&e.isAllowValue()&&(S||w||b);if(c&&!g&&e.isSortable()){const{isAbsoluteSort:x,isDefaultSort:F,isAscending:A,isDescending:P,direction:D}=uV(e,i),N=cV(r,e);N.has("default")&&(A&&F||s.push("sortAscending"),P&&F||s.push("sortDescending")),N.has("absolute")&&(A&&x||s.push("sortAbsoluteAscending"),P&&x||s.push("sortAbsoluteDescending")),D&&s.push("sortUnSort"),s.push(Pe)}if(u?.isFilterMenuItemEnabled(e)&&(s.push("columnFilter"),s.push(Pe)),v&&s.push("pinSubMenu"),T&&s.push("valueAggSubMenu"),i.showValuesAsSvc?.isMenuEligible(e)&&s.push("showValuesAsSubMenu"),i.calculatedColsSvc?.isEnabled()===!0&&y&&(s.push(Pe),a.pivotMode||s.push("calculatedColumn"),e?.isCalculatedCol&&(s.push("editCalculatedColumn"),s.push("removeCalculatedColumn")),s.push(Pe)),e&&i.colHeaderEditSvc?.isEditable(e)&&(s.push(Pe),s.push("editColumnName"),s.push(Pe)),(v||T)&&s.push(Pe),p&&(m.suppressAutoSize||s.push("autoSizeThis"),s.push("autoSizeAll"),s.push(Pe)),o&&r.isModuleRegistered("SharedRowGrouping")){const x=s.length;m.showRowGroup?s.push("rowUnGroup"):e.isAllowRowGroup()&&y&&(e.isRowGroupActive()?Ai(e,i)||s.push("rowUnGroup"):s.push("rowGroup")),s.length>x&&s.push(Pe)}return f(),l&&(hV(r)||r.get("ssrmExpandAllAffectsAllRows"))&&(b||C>(a.pivotMode?1:0))&&(s.push("expandAll"),s.push("contractAll")),s}};import{_exists as un}from"ag-stack";import{BeanStub as fV,_addGridCommonParams as mV,_attemptToRestoreCellFocus as vV,_getGrandTotalRow as CV}from"ag-grid-community";var Zp="ag-context-menu-open",SV=class extends Ww{constructor(){super(...arguments),this.beanName="contextMenuSvc",this.focusedCell=null}postConstruct(){this.menu=this.createManagedBean(new Pd({menuItemCallbacks:Ha,getMenuItems:this.getMenuItems.bind(this),mapMenuItems:this.mapWithStockItems.bind(this),beforeMenuOpen:this.beforeMenuOpen.bind(this),onMenuOpen:this.onMenuOpen.bind(this),onMenuClose:this.onMenuClose.bind(this),afterMenuDestroyed:this.afterMenuDestroyed.bind(this),onVisibleChanged:this.dispatchVisibleChangedEvent.bind(this),shouldBlockMenuOpen:()=>!!this.beans.overlays?.exclusive}))}hideActiveMenu(){this.menu.hideActiveMenu()}getMenuItems(e,t){const{column:s,node:i,value:r}=e,n=[],{clipboardSvc:o,chartSvc:a,csvCreator:l,excelCreator:c,colModel:u,rangeSvc:d,gos:h,notesSvc:p,pdfCreator:g}=this.beans,f=!!s?.isCalculatedCol;if(un(i)&&o&&s&&(h.get("suppressCutToClipboard")||n.push("cut"),n.push("copy","copyWithHeaders","copyWithGroupHeaders","paste","separator")),un(i)&&f&&n.push("separator","removeCalculatedColumn","separator"),un(i)&&s&&p?.hasDataSource()&&n.push("note"),h.get("enableCharts")&&a&&(u.pivotMode&&n.push("pivotChart"),d&&!d.isEmpty()&&n.push("chartRange")),un(i)){const S=h.get("enableRowPinning"),w=h.get("isRowPinnable");if(S){const F=i.level>-1&&i.footer,A=i.level===-1&&i.footer,P=CV(h);(A&&!(P==="pinnedBottom"||P==="pinnedTop")||!A&&!F)&&(w?.(i)??!0)&&n.push("pinRowSubMenu")}const b=h.get("suppressExcelExport")||!c,y=h.get("suppressCsvExport")||!l,T=h.get("suppressPdfExport")||!g;(!b||!y||!T)&&n.push("export")}const m=n.length?n:void 0,v=s?.getColDef().contextMenuItems;return Array.isArray(v)?v:typeof v=="function"?v(mV(h,{column:s,node:i,value:r,defaultItems:m,event:t})):h.getCallback("getContextMenuItems")?.({column:s,node:i,value:r,defaultItems:m,event:t})??n}getContextMenuPosition(e,t){const s=this.getRowCtrl(e),i=this.getCellGui(s,t);if(!i)return{x:0,y:s?.getRowYPosition()??0};const r=i.getBoundingClientRect();return{x:r.x+r.width/2,y:r.y+r.height/2}}showContextMenu(e){const t=e.rowNode??null,s=e.column??null;let{anchorToElement:i,value:r,source:n,noteParams:o}=e;t&&s&&r==null&&(r=this.beans.valueSvc.getDisplayValue(s,t,"edit",!1)),i==null&&(i=this.getContextMenuAnchorElement(t,s)),this.beans.menuUtils.onContextMenu({mouseEvent:e.mouseEvent??null,touchEvent:e.touchEvent??null,showMenuCallback:a=>this.menu.showMenu({node:t,column:s,value:r,noteParams:o},a,i),source:n})}handleContextMenuMouseEvent(e,t,s,i){const r=s?.findInfoForEvent(e||t),n=i?.rowNode??s?.rowNode??null,o=i?.column??r?.column??(s?.isFullWidth()?s.getNavigationColumn():null),a=i?{rowNode:i.rowNode,column:i.column}:s&&r?{rowNode:s.rowNode,location:"fullWidthRow",pinned:r.pinned==="left"||r.pinned==="right"?r.pinned:void 0}:void 0,{valueSvc:l,ctrlsSvc:c}=this.beans,u=o?l.getValue(o,n,"edit"):null,d=c.getGridBodyCtrl(),h=i?i.eGui:d.eGridBody;this.showContextMenu({mouseEvent:e,touchEvent:t,rowNode:n,column:o,value:u,anchorToElement:h,noteParams:a,source:"ui"})}beforeMenuOpen(e){e.column||this.beans.focusSvc.clearFocusedCell()}onMenuOpen(){const{ctrlsSvc:e,focusSvc:t}=this.beans;e.getGridBodyCtrl().eGridBody.classList.add(Zp),this.focusedCell=t.getFocusedCell()}onMenuClose(){this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.classList.remove(Zp)}afterMenuDestroyed(){const{beans:e,focusedCell:t}=this;vV(e,t)}dispatchVisibleChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"contextMenuVisibleChanged",visible:e,source:t})}getRowCtrl(e){const{rowIndex:t,rowPinned:s}=e||{};if(t!=null)return this.beans.rowRenderer.getRowByPosition({rowIndex:t,rowPinned:s})||void 0}getCellGui(e,t){return!e||!t?void 0:e.getCellCtrl(t)?.eGui||void 0}getContextMenuAnchorElement(e,t){const s=this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody,i=this.getRowCtrl(e);if(!i)return s;const r=this.getCellGui(i,t);return r||(i.isFullWidth()?i.getRowContentElement():s)}mapWithStockItems(e,t,s){const{column:i,node:r}=t;return this.beans.menuItemMapper.mapWithStockItems(e,i,r,t.noteParams,s,"contextMenu")}};import{RefPlaceholder as bV}from"ag-stack";import{AgPromise as Qa,BeanStub as yV,Component as wV,FilterComp as xV,_createElement as FV,_createIconNoSpan as el,_isColumnMenuAnchoringEnabled as TV,_isLegacyMenuEnabled as dn,_setColMenuVisible as Jp}from"ag-grid-community";var Ot="filterMenuTab",Nt="generalMenuTab",ls="columnsMenuTab",hn=[Nt,Ot,ls],AV=class extends Gu{constructor(){super(...arguments),this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(e,t,s,i,r){const{column:n,columnGroup:o}=this.splitColumnOrGroup(e),a=r?"filterMenuTab":void 0;this.showMenu(n,o,l=>{const c=l.getGui();this.beans.popupSvc.positionPopupUnderMouseEvent({type:s,additionalParams:{column:n},mouseEvent:t,ePopup:c}),a&&l.showTab?.(a),this.dispatchVisibleChangedEvent(!0,!1,n,o,a)},s,a,void 0,t.target,i)}splitColumnOrGroup(e){const t=e?.isColumn;return{column:t?e:void 0,columnGroup:t?void 0:e}}showMenuAfterButtonClick(e,t,s,i,r){let n=-1,o="left";this.gos.get("enableRtl")&&(n=1,o="right");const a=r?.filtersOnly?"filterMenuTab":void 0,l=a?[a]:void 0,c=dn(this.gos),u=(c?9:4)*n,d=c?-23:4,{column:h,columnGroup:p}=this.splitColumnOrGroup(e);return this.showMenu(h,p,g=>{const f=g.getGui();this.beans.popupSvc.positionPopupByComponent({type:s,additionalParams:{column:h},eventSource:t,ePopup:f,alignSide:o,nudgeX:u,nudgeY:d,position:"under",keepWithinBounds:!0}),a&&g.showTab?.(a),this.dispatchVisibleChangedEvent(!0,!1,h,p,a)},s,a,l,t,i,r?.suppressCloseOnEventSource)}showMenu(e,t,s,i,r,n,o,a,l){const c=this.getMenuParams(e,t,n,o);if(!c)return!1;const{menu:u,eMenuGui:d,anchorToElement:h,restoreFocusParams:p}=c,g=[],{menuUtils:f,popupSvc:m}=this.beans;g.push(C=>{const S=u.getGui();this.destroyBean(u),e&&(Jp(e,!1,"contextMenu"),f.restoreFocusOnClose(p,S,C)),a?.(C)});const v=this.getLocaleTextFunc();if(m.addPopup({modal:!0,eChild:d,closeOnEsc:!0,closedCallback:C=>{for(const S of g)S(C);this.dispatchVisibleChangedEvent(!1,!1,e,t,r)},afterGuiAttached:C=>u.afterGuiAttached(Object.assign({},{container:i},C)),positionCallback:r?()=>s(u):void 0,eventSourceToIgnore:l?o:void 0,ariaLabel:v("ariaLabelColumnMenu","Column Menu")}),r||(u.showTabBasedOnPreviousSelection?.(),s(u)),TV(this.gos)){const C=m.setPopupPositionRelatedToElement(d,h);C&&e&&this.addStopAnchoring(C,e,g)}return u.addEventListener("tabSelected",C=>{this.dispatchVisibleChangedEvent(!1,!0,e),this.lastSelectedTab=C.key,this.dispatchVisibleChangedEvent(!0,!0,e)}),e&&Jp(e,!0,"contextMenu"),this.activeMenu=u,u.addEventListener("destroyed",()=>{this.activeMenu===u&&(this.activeMenu=null)}),!0}addStopAnchoring(e,t,s){e.then(i=>{t.__addEventListener("leftChanged",i),t.__addEventListener("visibleChanged",i),s.push(()=>{t.__removeEventListener("leftChanged",i),t.__removeEventListener("visibleChanged",i)})})}getMenuParams(e,t,s,i){const{focusSvc:r,ctrlsSvc:n}=this.beans,o={column:e,headerPosition:r.focusedHeader,columnIndex:e?.allColsIndex??-1,eventSource:i},a=this.createMenu(e,t,o,s,i);return a?{menu:a,eMenuGui:a.getGui(),anchorToElement:i||n.getGridBodyCtrl().eGridBody,restoreFocusParams:o}:void 0}createMenu(e,t,s,i,r){if(dn(this.gos))return this.createBean(new PV(e,s,this.lastSelectedTab,i,r));{const n=this.beans.colMenuFactory.getMenuItems(e,t);return n.length?this.createBean(new RV(n,e,t,s,r)):void 0}}dispatchVisibleChangedEvent(e,t,s,i,r){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:t,key:this.lastSelectedTab??r??(dn(this.gos)?Nt:"columnMenu"),column:s??null,columnGroup:i??null})}isMenuEnabled(e){if(!dn(this.gos))return!0;const t=!this.beans.filterManager?.isFilterAllowed(e),s=e.colDef.menuTabs??hn;return(t&&s.includes(Ot)?s.length-1:s.length)>0}showMenuAfterContextMenuEvent(e,t,s){this.beans.menuUtils.onContextMenu({mouseEvent:t,touchEvent:s,source:"ui",showMenuCallback:i=>(this.showMenuAfterMouseEvent(e,i,"columnMenu"),!0)})}},PV=class extends Gu{constructor(e,t,s,i,r){super(),this.column=e,this.restoreFocusParams=t,this.initialSelection=s,this.restrictTo=i,this.sourceElement=r,this.tabFactories={},this.includeChecks={};const{tabFactories:n,includeChecks:o}=this;n[Nt]=this.createMainPanel.bind(this),n[Ot]=this.createFilterPanel.bind(this),n[ls]=this.createColumnsPanel.bind(this),o[Nt]=()=>!0,o[Ot]=()=>e?!!this.beans.filterManager?.isFilterAllowed(e):!1,o[ls]=()=>!0}postConstruct(){const e=this.getTabsToCreate().map(s=>this.createTab(s)),t=new Qo({items:e,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(t),this.mainMenuList?.setParentComponent(t),this.addDestroyFunc(()=>this.destroyBean(t))}getTabsToCreate(){return this.restrictTo?this.restrictTo:(this.column?.colDef.menuTabs??hn).filter(e=>this.isValidMenuTabItem(e)&&this.isNotSuppressed(e))}isValidMenuTabItem(e){let t=!0,s=hn;return this.restrictTo!=null&&(t=this.restrictTo.indexOf(e)>-1,s=this.restrictTo),t=t&&hn.indexOf(e)>-1,t||this.warn(175,{menuTabName:e,itemsToConsider:s}),t}isNotSuppressed(e){return this.includeChecks[e]()}createTab(e){return this.tabFactories[e]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(e){const{tabItemColumns:t,tabbedLayout:s,tabItemFilter:i,tabItemGeneral:r}=this;t&&e===ls?s.showItem(t):i&&e===Ot?s.showItem(i):r&&e===Nt?s.showItem(r):s.showFirstItem()}onTabItemClicked(e){let t=null;switch(e.item){case this.tabItemColumns:t=ls;break;case this.tabItemFilter:t=Ot;break;case this.tabItemGeneral:t=Nt;break}t&&this.activateTab(t)}activateTab(e){const t={type:"tabSelected",key:e};this.dispatchLocalEvent(t)}createMainPanel(){const{beans:e,column:t}=this,s=e.colMenuFactory,i=s.createMenu(this,s.getMenuItems(t),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=i,i.addEventListener("closeMenu",this.onHidePopup.bind(this));const r={title:el("legacyMenu",e,t),titleLabel:Nt.replace("MenuTab",""),bodyPromise:Qa.resolve(i.getGui()),name:Nt};return this.tabItemGeneral=r,r}onHidePopup(e){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}createFilterPanel(){const e=this.column?this.createBean(new xV(this.column,"COLUMN_MENU")):null;this.filterComp=e,e?.hasFilter()||this.error(119);const t=i=>e?.afterGuiAttached(i),s=()=>e?.afterGuiDetached();return this.tabItemFilter={title:el("filterTab",this.beans,this.column),titleLabel:Ot.replace("MenuTab",""),bodyPromise:Qa.resolve(e?.getGui()),afterAttachedCallback:t,afterDetachedCallback:s,name:Ot},this.tabItemFilter}createColumnsPanel(){const e=FV({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:t,column:s}=this,r=t.colChooserFactory.createColumnSelectPanel(this,s).getGui();r.classList.add("ag-menu-column-select"),e.appendChild(r);const n={title:el("columns",t,s),titleLabel:ls.replace("MenuTab",""),bodyPromise:Qa.resolve(e),name:ls};return this.tabItemColumns=n,n}afterGuiAttached(e){const{container:t,hidePopup:s}=e;this.tabbedLayout.setAfterAttachedParams({container:t,hidePopup:s}),s&&(this.hidePopupFunc=s,this.addDestroyFunc(s))}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},RV=class extends $w{constructor(e,t,s,i,r){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"}),this.menuItems=e,this.column=t,this.columnGroup=s,this.restoreFocusParams=i,this.sourceElement=r,this.eColumnMenu=bV}postConstruct(){const e=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui(),this.columnGroup);this.mainMenuList=e,e.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(e.getGui())}onHidePopup(e){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),this.mainMenuList.focusInto()}};function MV(e,t){const{contextMenuSvc:s}=e;if(!s)return;const{rowNode:i,column:r,value:n,x:o,y:a}=t||{};let{x:l,y:c}=s.getContextMenuPosition(i,r);o!=null&&(l=o),a!=null&&(c=a),s.showContextMenu({mouseEvent:new MouseEvent("mousedown",{clientX:l,clientY:c}),rowNode:i,column:r,value:n,source:"api"})}function IV(e,t){e.colChooserFactory?.showColumnChooser({chooserParams:t})}function EV(e){e.colChooserFactory?.hideActiveColumnChooser()}import{_exists as DV}from"ag-stack";import{BeanStub as LV,_createIconNoSpan as se,_getRowNode as Qp,_normalizeSortType as kV,_resetColumnState as _V}from"ag-grid-community";var GV={pinSubMenu:"PinnedColumn",pinLeft:"PinnedColumn",pinRight:"PinnedColumn",clearPinned:"PinnedColumn",pinRowSubMenu:"PinnedRow",pinBottom:"PinnedRow",pinTop:"PinnedRow",unpinRow:"PinnedRow",valueAggSubMenu:"SharedAggregation",showValuesAsSubMenu:"ShowValuesAs",autoSizeThis:"ColumnAutoSize",autoSizeAll:"ColumnAutoSize",rowGroup:"SharedRowGrouping",rowUnGroup:"SharedRowGrouping",resetColumns:"CommunityCore",expandAll:["CsrmHierarchy","ServerSideRowModel"],contractAll:["CsrmHierarchy","ServerSideRowModel"],copy:"Clipboard",copyWithHeaders:"Clipboard",copyWithGroupHeaders:"Clipboard",cut:"Clipboard",paste:"Clipboard",export:["CsvExport","ExcelExport","PdfExport"],note:"Notes",csvExport:"CsvExport",excelExport:"ExcelExport",pdfExport:"PdfExport",separator:"CommunityCore",pivotChart:"IntegratedCharts",chartRange:"IntegratedCharts",columnFilter:"ColumnFilter",columnChooser:"ColumnMenu",calculatedColumn:"CalculatedColumns",editCalculatedColumn:"CalculatedColumns",removeCalculatedColumn:"CalculatedColumns",editColumnName:"ColumnHeaderEdit",sortAscending:"Sort",sortDescending:"Sort",sortAbsoluteAscending:"Sort",sortAbsoluteDescending:"Sort",sortUnSort:"Sort"};function OV(e,t){const s=GV[t];s&&e.assertModuleRegistered(s,`menu item \`${t}\``)}var NV={sortAscending:{fallback:"Sort Ascending",getSortDef:()=>({type:"default",direction:"asc"})},sortDescending:{fallback:"Sort Descending",getSortDef:()=>({type:"default",direction:"desc"})},sortAbsoluteAscending:{fallback:"Sort Absolute Ascending",getSortDef:()=>({type:"absolute",direction:"asc"})},sortAbsoluteDescending:{fallback:"Sort Absolute Descending",getSortDef:()=>({type:"absolute",direction:"desc"})},sortUnSort:{fallback:"Clear Sort",getSortDef:e=>({type:kV(e.getSortDef()?.type),direction:null})}},BV=class extends Kw{constructor(){super(...arguments),this.beanName="menuItemMapper"}mapWithStockItems(e,t,s,i,r,n,o=null){if(!e)return[];const a=[],l=this.getLocaleTextFunc(),{beans:c,gos:u}=this,{aggFuncSvc:d,chartMenuItemMapper:h,clipboardSvc:p,colAutosize:g,colChooserFactory:f,colHeaderEditSvc:m,colModel:v,colNames:C,ctrlsSvc:S,csvCreator:w,excelCreator:b,expansionSvc:y,focusSvc:T,menuSvc:x,notesSvc:F,calculatedColsSvc:A,pdfCreator:P,pinnedCols:D,pinnedRowModel:N,pivotColsSvc:V,rangeSvc:L,rowGroupColsSvc:O,showValuesAsSvc:K,sortSvc:H,valueColsSvc:Z}=c,Y=k=>({node:M,column:re})=>{if(M){N.pinRow(M,k??null,re);return}L?.getCellRanges()?.forEach(W=>{L.forEachRowInRange(W,E=>{const U=Qp(c,E);U&&N.pinRow(U,k??null,null)})})},pe=(k,M,re,W)=>{switch(OV(u,k),k){case"pinSubMenu":return D&&M?{name:l("pinColumn","Pin Column"),icon:se("menuPin",c,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return D&&M?{name:l("pinLeft","Pin Left"),action:()=>D.setColsPinned([M],"left",W),checked:!!M&&M.isPinnedLeft()}:null;case"pinRight":return D&&M?{name:l("pinRight","Pin Right"),action:()=>D.setColsPinned([M],"right",W),checked:!!M&&M.isPinnedRight()}:null;case"clearPinned":return D&&M?{name:l("noPin","No Pin"),action:()=>D.setColsPinned([M],null,W),checked:!!M&&!M.isPinned()}:null;case"pinRowSubMenu":{const E=u.get("enableRowPinning"),U=[],q=s?.rowPinned??s?.pinnedSibling?.rowPinned;return q&&U.push("unpinRow"),E&&E!=="bottom"&&q!="top"&&U.push("pinTop"),E&&E!=="top"&&q!="bottom"&&U.push("pinBottom"),N?.isManual()?{name:l("pinRow","Pin Row"),icon:se("rowPin",c,M),subMenu:U}:null}case"pinTop":return N?.isManual()?{name:l("pinTop","Pin to Top"),icon:se("rowPinTop",c,M),action:Y("top")}:null;case"pinBottom":return N?.isManual()?{name:l("pinBottom","Pin to Bottom"),icon:se("rowPinBottom",c,M),action:Y("bottom")}:null;case"unpinRow":return N?.isManual()?{name:l("unpinRow","Unpin Row"),icon:se("rowUnpin",c,M),action:Y(null)}:null;case"valueAggSubMenu":return d&&Z&&(M?.primary||M?.pivotValueColumn)?{name:l("valueAggregation","Value Aggregation"),icon:se("menuValue",c,null),subMenu:HV(M,d,Z,l),disabled:u.get("functionsReadOnly")}:null;case"showValuesAsSubMenu":return K&&M&&K.isMenuEligible(M)?{name:l("showValuesAs","Show Values As"),icon:se("showValuesAs",c,null),subMenu:K.getMenuItems(M,l)}:null;case"autoSizeThis":return g?{name:l("autosizeThisColumn","Autosize This Column"),action:()=>M&&g.autoSizeColumn(M,W,u.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return g?{name:l("autosizeAllColumns","Autosize All Columns"),action:()=>g.autoSizeAllColumns({source:W,skipHeader:u.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return O?{name:Pi(l,"groupBy",C.getDisplayNameForColumn(M,"header")),disabled:u.get("functionsReadOnly")||M?.isRowGroupActive()||!M?.colDef.enableRowGroup,action:()=>O.addColumns([M],W),icon:se("menuAddRowGroup",c,null)}:null;case"rowUnGroup":if(O&&u.isModuleRegistered("SharedRowGrouping")){const E=M?.showRowGroup,U=u.get("groupLockGroupColumns");let q,ne,Se;if(E===!0)q=l("ungroupAll","Un-Group All"),ne=u.get("functionsReadOnly")||U===-1||U>=(O.columns.length??0),Se=()=>O.setColumns(O.columns.slice(0,U),W);else if(typeof E=="string"){const le=v.getNonPivotCol(E),Ee=le!=null?C.getDisplayNameForColumn(le,"header"):E;q=Pi(l,"ungroupBy",Ee),ne=u.get("functionsReadOnly")||Ai(le,c),Se=()=>{O.removeColumns([E],W)}}else q=Pi(l,"ungroupBy",C.getDisplayNameForColumn(M,"header")),ne=u.get("functionsReadOnly")||!M?.isRowGroupActive()||!M?.colDef.enableRowGroup||Ai(M,c),Se=()=>O.removeColumns([M],W);return{name:q,disabled:ne,action:Se,icon:se("menuRemoveRowGroup",c,null)}}else return null;case"scrollIntoView":{if(!S||!M||M.isPinned())return null;const E=C.getDisplayNameForColumn(M,"header");return{name:rt(l,Rs.key,Rs.default,E),icon:se(Rs.icon,c,null),action:()=>S.getScrollFeature().ensureColumnVisible(M)}}case"value":{if(!Z||!M?.primary||!M.isAllowValue())return null;const E=M.isValueActive(),U=C.getDisplayNameForColumn(M,"header");return{name:E?rt(l,qe.removeKey,qe.removeDefault,U):rt(l,qe.addKey,qe.addDefault,U),icon:se(qe.icon,c,null),disabled:u.get("functionsReadOnly"),action:()=>E?Z.removeColumns([M],W):Z.addColumns([M],W)}}case"pivot":{if(!V||!v.pivotMode||!M?.primary||!M.isAllowPivot())return null;const E=M.isPivotActive(),U=C.getDisplayNameForColumn(M,"header");return{name:E?rt(l,Xe.removeKey,Xe.removeDefault,U):rt(l,Xe.addKey,Xe.addDefault,U),icon:se(Xe.icon,c,null),disabled:u.get("functionsReadOnly"),action:()=>E?V.removeColumns([M],W):V.addColumns([M],W)}}case"resetColumns":return{name:l("resetColumns","Reset Columns"),action:()=>_V(c,W)};case"expandAll":return y?{name:l("expandAll","Expand All Row Groups"),action:()=>y.expandAll(!0)}:null;case"contractAll":return y?{name:l("collapseAll","Collapse All Row Groups"),action:()=>y.expandAll(!1)}:null;case"copy":return p?{name:l("copy","Copy"),shortcut:l("ctrlC","Ctrl+C"),icon:se("clipboardCopy",c,null),action:()=>p.copyToClipboard()}:null;case"copyWithHeaders":return p?{name:l("copyWithHeaders","Copy with Headers"),icon:se("clipboardCopy",c,null),action:()=>p.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return p?{name:l("copyWithGroupHeaders","Copy with Group Headers"),icon:se("clipboardCopy",c,null),action:()=>p.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(p){const E=T.getFocusedCell(),U=E?Qp(c,E):null,q=U?E?.column.isCellEditable(U):!1;return{name:l("cut","Cut"),shortcut:l("ctrlX","Ctrl+X"),icon:se("clipboardCut",c,null),disabled:!q||u.get("suppressCutToClipboard"),action:()=>p.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(p){const E=u.get("suppressClipboardApi")||u.get("suppressClipboardPaste")||!M||!s||!M.isCellEditable(s)||M.isSuppressPaste(s);return{name:l("paste","Paste"),shortcut:l("ctrlV","Ctrl+V"),icon:se("clipboardPaste",c,null),disabled:E,action:()=>p.pasteFromClipboard()}}else return null;case"export":{const E=[];return!u.get("suppressCsvExport")&&w&&E.push("csvExport"),!u.get("suppressExcelExport")&&b&&E.push("excelExport"),!u.get("suppressPdfExport")&&P&&E.push("pdfExport"),E.length?{name:l("export","Export"),subMenu:E,icon:se("save",c,null)}:null}case"csvExport":return w?{name:l("csvExport","CSV Export"),icon:se("csvExport",c,null),action:()=>w.exportDataAsCsv()}:null;case"excelExport":return b?{name:l("excelExport","Excel Export"),icon:se("excelExport",c,null),action:()=>b.exportDataAsExcel()}:null;case"pdfExport":return P?{name:l("pdfExport","PDF Export"),icon:se("pdfExport",c,null),action:()=>P.exportDataAsPdf()}:null;case"separator":return k;case"pivotChart":case"chartRange":return h.getChartItems(k);case"columnFilter":return x&&M?{name:l("columnFilter","Column Filter"),icon:se("filter",c,null),action:()=>x.showFilterMenu({column:M,buttonElement:re(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{const E=T.focusedHeader;return f?{name:l("columnChooser","Choose Columns"),icon:se("columns",c,null),action:()=>f.showColumnChooser({column:M,eventSource:re(),headerPosition:E})}:null}case"calculatedColumn":{if(!A?.isEnabled())return null;const E=T.focusedHeader??(M?{headerRowIndex:0,column:M}:null);return{name:l("calculatedColumnAdd","Add Calculated Column"),icon:se("calculatedColumnAdd",c,null),action:()=>A.openCalculatedColumnDialog(M,"add",!0,{eventSource:re(),headerPosition:E})}}case"editCalculatedColumn":{if(!A?.isEnabled()||!M?.isCalculatedCol)return null;const E=T.focusedHeader??{headerRowIndex:0,column:M};return{name:l("calculatedColumnEdit","Edit Calculated Column"),icon:se("calculatedColumnEdit",c,null),action:()=>A.openCalculatedColumnDialog(M,"edit",!0,{eventSource:re(),headerPosition:E})}}case"removeCalculatedColumn":return A?.isEnabled()&&M?.isCalculatedCol?{name:l("calculatedColumnRemove","Remove Calculated Column"),icon:se("calculatedColumnRemove",c,null),action:()=>A.removeCalculatedColumn(M)}:null;case"editColumnName":{const E=M??o;return E?m?.getEditColumnNameMenuItem(E)??null:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!H||!M)return null;const{fallback:E,getSortDef:U}=NV[k];return{name:l(k,E),icon:se(k,c,null),action:()=>H.setSortForColumn(M,U(M),!1,W)}}default:return this.warn(176,{key:k}),null}};for(const k of e){let M;if(typeof k=="string"){if(k==="note"){const E=VV({notesSvc:F,column:t,node:s,noteParams:i,localeTextFunc:l});E.length&&a.push(Pe,...E,Pe);continue}M=pe(k,t,r,n)}else M={...k};if(!M)continue;const re=M,{subMenu:W}=re;W&&W instanceof Array&&(re.subMenu=this.mapWithStockItems(W,t,s,i,r,n,o)),M!=null&&a.push(M)}return Ba(a,Pe),a}};function VV({notesSvc:e,column:t,node:s,noteParams:i,localeTextFunc:r}){const n=e?.hasDataSource()?i?e.getNoteAccess(i):t&&s?e.getNoteAccess({rowNode:s,column:t}):void 0:void 0;if(!n)return[];const o=[];return n.note?(n.canView&&(n.isReadOnly||n.isSuppressed)&&o.push({name:r("viewNote","View Note"),shortcut:r("shiftF2","Shift+F2"),action:()=>e.showNote(n.params,!0)}),!n.isReadOnly&&!n.isSuppressed&&o.push({name:r("editNote","Edit Note"),shortcut:r("shiftF2","Shift+F2"),disabled:!n.canEdit,action:n.canEdit?()=>e.showNote(n.params,!0):void 0}),o.push({name:r("deleteNote","Remove Note"),disabled:!n.canDelete,action:n.canDelete?()=>e.setNote({...n.params,note:void 0}):void 0}),o):(o.push({name:r("addNote","Add Note"),shortcut:r("shiftF2","Shift+F2"),disabled:!n.canCreate,action:n.canCreate?()=>e.showNote(n.params,!0):void 0}),o)}function HV(e,t,s,i){let r;if(e.primary)r=e;else{const o=e.pivotValueColumn;r=DV(o)?o:void 0}const n=[];if(r){const o=r.isValueActive(),a=t.getFuncNames(r);n.push({name:i("noAggregation","None"),action:()=>{s.removeColumns([r],"contextMenu"),s.setColumnAggFunc(r,void 0,"contextMenu")},checked:!o});for(const l of a)n.push({name:i(l,t.getDefaultFuncLabel(l)),action:()=>{s.setColumnAggFunc(r,l,"contextMenu"),s.addColumns([r],"contextMenu")},checked:o&&r.aggFunc===l})}return n}import{_findTabbableParent as UV,_getActiveDomElement as zV,_isNothingFocused as eg,_isVisible as WV,_last as $V}from"ag-stack";import{BeanStub as KV}from"ag-grid-community";var jV=class extends jw{constructor(){super(...arguments),this.beanName="menuUtils"}restoreFocusOnClose(e,t,s,i){const{eventSource:r}=e,n=s instanceof KeyboardEvent;if(!i&&!n||!r)return;const o=zV(this.beans);!t.contains(o)&&!eg(this.beans)||this.focusEventSourceOrHeaderCell(e)}closePopupAndRestoreFocusOnSelect(e,t,s){let i;s?.keyboardEvent&&(i=s.keyboardEvent),e(i&&{keyboardEvent:i});const r=this.beans,n=r.focusSvc,o=n.getFocusedCell();if(eg(r))if(o){const{rowIndex:a,rowPinned:l,column:c}=o;n.setFocusedCell({rowIndex:a,column:c,rowPinned:l,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusEventSourceOrHeaderCell(t)}onContextMenu(e){const{mouseEvent:t,touchEvent:s,showMenuCallback:i,source:r}=e;if(!this.gos.get("allowContextMenuWithControlKey")&&t&&(t.ctrlKey||t.metaKey)||(t&&this.blockMiddleClickScrollsIfNeeded(t),r==="ui"&&this.gos.get("suppressContextMenu")))return;const n=t??s.touches[0];if(i(n)){const o=t??s;o?.cancelable&&o.preventDefault()}}async focusEventSourceOrHeaderCell(e){const{column:t,columnIndex:s,headerPosition:i,eventSource:r}=e,{visibleCols:n,headerNavigation:o,focusSvc:a}=this.beans,l=await n.allCols.some(c=>c===t);if(this.isAlive()){if(r&&WV(r)){const c=UV(r);if(c){t?.isAlive()&&l&&o?.scrollToColumn(t),c.focus();return}}else if(i&&s!==-1){const c=n.allCols,u=c[s]||$V(c);u&&a.focusHeaderPosition({headerPosition:{headerRowIndex:i.headerRowIndex,column:u}})}}}blockMiddleClickScrollsIfNeeded(e){this.gos.get("suppressMiddleClickScrolls")&&e.which===2&&e.preventDefault()}};import{_focusInto as YV}from"ag-stack";import{BeanStub as qV,_createElement as XV}from"ag-grid-community";var ZV=class extends Yw{constructor(){super(...arguments),this.beanName="toolbarMenuBuilder"}showMenu(e){const{anchorElement:t,menuItems:s,ariaLabel:i,onClose:r}=e,{popupSvc:n,menuItemMapper:o}=this.beans;if(!n||!o)return;const a=XV({tag:"div",cls:"ag-menu"}),l=this.createBean(new nn);a.appendChild(l.getGui()),l.addMenuItems(o.mapWithStockItems(s,null,null,void 0,()=>t,"contextMenu"));let c;l.addManagedListeners(l,{closeMenu:()=>c?.()}),n.addPopup({modal:!0,eChild:a,closeOnEsc:!0,afterGuiAttached:u=>{c=u.hidePopup,YV(l.getGui())},ariaLabel:i,closedCallback:()=>{this.destroyBean(l),r?.()}}),n.positionPopupByComponent({type:"toolbar",eventSource:t,ePopup:a,position:"under",nudgeY:4,keepWithinBounds:!0})}},tg={moduleName:"MenuCore",version:G,beans:[BV,eV,jV,ZV],icons:{chart:"chart",columns:"columns",loadingMenuItems:"loading",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",save:"save",csvExport:"csv",excelExport:"excel",pdfExport:"pdf",sortAscending:"asc",sortDescending:"desc",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc",sortUnSort:"none"},dependsOn:[$,XB,JB,rn]},tl={moduleName:"ColumnMenu",version:G,beans:[AV,gV,aV],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:IV,hideColumnChooser:EV},dependsOn:[tg,Ja,ZB,qB]},sl={moduleName:"ContextMenu",version:G,beans:[SV],apiFunctions:{showContextMenu:MV},dependsOn:[tg]},JV={moduleName:"Menu",version:G,dependsOn:[tl,sl]};import{_EditCoreModule as QV}from"ag-grid-community";import{_missing as sg}from"ag-stack";import{AgAbstractCellEditor as e2,KeyCode as ig,_addGridCommonParams as t2,_consoleError as s2}from"ag-grid-community";var i2=10,rg=class extends qw{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"}),this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1,this.cachedRaw=this,this.seededValue=this}initialiseEditor(e){const{cellStartedEdit:t,values:s,valuesPage:i,eventKey:r}=this.params;this.pendingInitialEventKey=null,this.initialEventKeyProcessed=!1,sg(s)&&sg(i)&&this.beans.log.warn(180);const n=this.resolveAsyncMode(),{params:o,valueList:a}=this.buildRichSelectParams(n),l=this.createManagedBean(new Xr(o));this.eEditor=l,this.seededValue=this.params.value,l.addCss("ag-cell-editor"),this.appendChild(l);const c=this.getAsyncValuesSource(n);c&&l.setAsyncValuesSource({source:c,thresholdRows:this.params.valuesPageLoadThreshold??i2,useAsyncSearch:n.isFullAsync,onMisconfiguredSearchSource:n.isFullAsync?()=>this.beans.log.warn(294):void 0,onFirstValuesPageLoaded:()=>{this.pendingInitialEventKey!=null&&(this.consumeInitialEventKey(this.pendingInitialEventKey),this.pendingInitialEventKey=null)}}),this.eEditor.setValueList({valueList:a,refresh:!0,isInitial:!0}),n.isValuesPaged?(this.eEditor.resetAsyncValues(""),n.isFullAsync?this.consumeInitialEventKey(r):this.pendingInitialEventKey=r):a&&!Array.isArray(a)&&a.then(u=>{const d=this.getSearchStringCallback(u);d&&l.setSearchStringCreator(d),this.consumeInitialEventKey(r)}).catch(u=>{s2("Rich Select",u),this.consumeInitialEventKey(r)}),this.addManagedListeners(l,{fieldPickerValueSelected:this.onEditorPickerValueSelected.bind(this)}),this.focusAfterAttached=t}onEditorPickerValueSelected(e){if(this.gos.get("editType")!=="fullRow"){const{fromEnterKey:t,keyboardEvent:s}=e;setTimeout(()=>{this.isAlive()&&this.params.stopEditing(!t,s)})}}getPlaceholderText(e=this.isFullAsync()){const{valuePlaceholder:t}=this.params;if(t!==void 0)return t;const s=this.getLocaleTextFunc();return e?s("typeToSearchOoo","Type to search..."):s("advancedFilterBuilderSelectOption","Select an option...")}isFullAsync(){const{allowTyping:e,filterListAsync:t,values:s,valuesPage:i}=this.params,r=typeof s=="function"||typeof i=="function";return t&&!e?(this.beans.log.warn(294),!1):!r&&t?(this.beans.log.warn(294),!1):!!(e&&t&&r)}isValuesPaged(){return typeof this.params.valuesPage=="function"}resolveAsyncMode(){return{isValuesPaged:this.isValuesPaged(),isFullAsync:this.isFullAsync()}}getInitialValueList(e=this.resolveAsyncMode()){const t=this.params,{values:s}=t;if(!e.isValuesPaged){if(!s)return[];if(Array.isArray(s))return s;if(typeof s!="function")return[];if(!e.isFullAsync)return s({...t})}}buildRichSelectParams(e=this.resolveAsyncMode()){const t=this.params,{cellRenderer:s,cellRendererParams:i,cellHeight:r,value:n,values:o,formatValue:a,searchDebounceDelay:l,valueListGap:c,valueListMaxHeight:u,valueListMaxWidth:d,allowTyping:h,filterList:p,searchType:g,highlightMatch:f,eventKey:m,multiSelect:v,suppressDeselectAll:C,suppressMultiSelectPillRenderer:S}=t,{isValuesPaged:w,isFullAsync:b}=e,y=a??(D=>String(D??"")),x={value:n,cellRenderer:s,cellRendererParams:i,cellRowHeight:r,searchDebounceDelay:l,valueFormatter:D=>Array.isArray(D)?D.map(N=>y(N)).join(", "):y(D),pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"virtual-list",pickerGap:c,allowTyping:h,filterList:p,searchType:g,highlightMatch:f,maxPickerHeight:u,maxPickerWidth:d,placeholder:this.getPlaceholderText(b),initialInputValue:m?.length===1?m:m===ig.BACKSPACE?"":void 0,multiSelect:v,suppressDeselectAll:C,suppressMultiSelectPillRenderer:S},F=this.getInitialValueList(e),A=Array.isArray(o);return w?(F&&(x.valueList=F),b&&(x.allowNoResultsCopy=!0,x.filterList=!0)):A?(x.valueList=F,x.searchStringCreator=this.getSearchStringCallback(F)):typeof o=="function"&&b&&(x.allowNoResultsCopy=!0,x.filterList=!0),{params:x,valueList:F}}getAsyncValuesSource(e=this.resolveAsyncMode()){const{isFullAsync:t,isValuesPaged:s}=e;if(!(!t&&!s))return{searchValues:t?i=>this.getAsyncSearchValues(i):void 0,loadValuesPage:s?i=>this.getAsyncValuesPage(i):void 0,valuesPageInitialStartRow:s?i=>this.resolveValuesPageInitialStartRow(i):void 0,valuesPageSize:s?this.params.valuesPageSize:void 0}}getAsyncSearchValues(e){const{values:t}=this.params;return typeof t!="function"?[]:t({...this.params,search:e})}getAsyncValuesPage(e){const{valuesPage:t}=this.params;return typeof t!="function"?{values:[]}:t({...this.params,search:e.search,startRow:e.startRow,endRow:e.endRow,cursor:e.cursor})}resolveValuesPageInitialStartRow(e){if(e)return 0;const{valuesPageInitialStartRow:t,value:s}=this.params,i=typeof t=="function"?t(s):t;return Math.max(Math.floor(i??0),0)}getSearchStringCallback(e){if(typeof e[0]!="object")return;const t=this.params,{colDef:s,formatValue:i}=t,r=i??(o=>String(o??""));if(s.cellEditorParams?.formatValue)return o=>o.map(r);const{keyCreator:n}=s;if(n){this.beans.log.warn(266);const{column:o,node:a,data:l}=t;return c=>c.map(u=>{const d=t2(this.gos,{value:u,colDef:s,column:o,node:a,data:l});return n(d)})}return o=>o.map(r)}afterGuiAttached(){const{focusAfterAttached:e,params:t}=this;setTimeout(()=>{if(!this.isAlive())return;const s=this.eEditor,{allowTyping:i,eventKey:r,cellStartedEdit:n}=t;if(e){const o=s.getFocusableElement();o.focus({preventScroll:!0}),i&&r?.length!==1&&o.select()}n&&s.showPicker(),this.pendingInitialEventKey==null&&this.consumeInitialEventKey(r)})}consumeInitialEventKey(e){!e||this.initialEventKeyProcessed||(this.initialEventKeyProcessed=!0,this.processEventKey(e))}processEventKey(e){e&&(e===ig.BACKSPACE?this.eEditor.searchTextFromString(null):e?.length===1&&this.eEditor.searchTextFromString(e))}focusIn(){this.eEditor.getFocusableElement().focus()}agSetEditValue(e){this.params.value=e,this.eEditor.setValue(e??null,!0),this.seededValue=e??null}getValue(){const e=this.eEditor.getValue();if(e===this.seededValue)return this.params.value;if(Object.is(this.cachedRaw,e))return this.cachedParsed;const t=this.params.parseValue?.(e)??e;return this.cachedRaw=e,this.cachedParsed=t,t}isPopup(){return!1}getValidationElement(){return this.eEditor.getAriaElement()}getValidationErrors(){const{params:e}=this,{getValidationErrors:t}=e;return t?t({value:this.getValue(),internalErrors:null,cellEditorParams:e}):null}},ng={moduleName:"RichSelect",version:G,beans:[],userComponents:{agRichSelect:rg,agRichSelectCellEditor:rg},icons:{richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading"},dependsOn:[$,QV]};import{_ColumnFilterModule as r2}from"ag-grid-community";import{RefPlaceholder as Di,_areEqual as n2,_exists as o2,_getActiveDomElement as a2,_makeNull as l2,_setDisplayed as il}from"ag-stack";import{AgInputTextFieldSelector as c2,KeyCode as Li,ProvidedFilter as u2,_bindFilterCallback as og,_createIconNoSpan as d2}from"ag-grid-community";var pn="__AG_SELECT_ALL__",gn="__AG_ADD_SELECTION_TO_FILTER__",ki=[],h2=class{constructor(e,t,s,i){this.valueSvc=e,this.getValueFormatter=t,this.formatter=s,this.column=i,this.displayedKeys=[]}updateDisplayedValuesToAllAvailable(e,t,s){this.displayedKeys=Array.from(s)}updateDisplayedValuesToMatchMiniFilter(e,t,s,i,r){this.displayedKeys=[];const n=this.getValueFormatter();for(const o of s)if(o==null)r&&this.displayedKeys.push(o);else{const a=e(o),l=this.valueSvc.formatValue(this.column,null,a,n,!1),c=this.formatter(l);i(c)&&this.displayedKeys.push(o)}}getDisplayedValueCount(){return this.displayedKeys.length}getDisplayedItem(e){return this.displayedKeys[e]}getSelectAllItem(){return pn}getAddSelectionToFilterItem(){return gn}getDisplayedKeys(){return this.displayedKeys}forEachDisplayedKey(e){this.displayedKeys.forEach(e)}someDisplayedKey(e){return this.displayedKeys.some(e)}hasGroups(){return!1}refresh(){}};import{RefPlaceholder as fn,_setAriaChecked as p2,_setAriaDescribedBy as g2,_setAriaExpanded as f2,_setAriaLabel as m2,_setAriaLabelledBy as v2,_setAriaLevel as C2,_setDisplayed as rl,_toStringOrNull as ag}from"ag-stack";import{AgCheckboxSelector as S2,Component as b2,ComponentInstanceGuard as y2,_addGridCommonParams as w2,_createIcon as nl,_getCellRendererDetails as lg,_getShouldDisplayTooltip as x2,_isShowTooltipWhenTruncated as F2}from"ag-grid-community";var T2={tag:"div",cls:"ag-set-filter-item",attrs:{"aria-hidden":"true"},children:[{tag:"span",cls:"ag-set-filter-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-set-filter-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-set-filter-group-opened-icon"},{tag:"span",ref:"eGroupIndeterminateIcon",cls:"ag-set-filter-group-indeterminate-icon"}]},{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},A2={tag:"div",cls:"ag-set-filter-item",children:[{tag:"ag-checkbox",ref:"eCheckbox",cls:"ag-set-filter-item-checkbox"}]},P2=class extends Xw{constructor(e){super(e.isGroup?T2:A2,[S2]),this.eCheckbox=fn,this.eGroupOpenedIcon=fn,this.eGroupClosedIcon=fn,this.eGroupIndeterminateIcon=fn,this.rendererGuard=new y2,this.formattedValue=null,this.focusWrapper=e.focusWrapper,this.value=e.value,this.params=e.params,this.translate=e.translate,this.valueFormatter=e.valueFormatter,this.item=e.item,this.isSelected=e.isSelected,this.isTree=e.isTree,this.depth=e.depth??0,this.isGroup=e.isGroup,this.groupsExist=e.groupsExist,this.isExpanded=e.isExpanded,this.hasIndeterminateExpandState=e.hasIndeterminateExpandState}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>this.focusWrapper,getTooltipComponentDefinition:()=>this.params.colDef,getLocation:()=>"setFilterValue",shouldDisplayTooltip:()=>this.shouldDisplayTooltip?.()??!0,getAdditionalParams:()=>{const{colDef:e,column:t}=this.params,s={colDef:e,column:t,valueFormatted:this.formattedValue??void 0};return this.isTree&&(s.level=this.depth),s}})),this.addDestroyFunc(()=>this.destroyCellRendererComponent?.()),this.render(),this.eCheckbox.setLabelEllipsis(!0).setValue(this.isSelected,!0).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex","-1"),this.refreshVariableAriaLabels(),this.isTree&&(this.depth>0&&(this.addCss("ag-set-filter-indent-"+this.depth),this.getGui().style.setProperty("--ag-indentation-level",String(this.depth))),this.isGroup?this.setupExpansion():this.groupsExist&&this.addCss("ag-set-filter-add-group-indent"),C2(this.getAriaElement(),this.depth+1)),this.refreshAriaChecked(),!this.params.readOnly&&this.eCheckbox.onValueChange(e=>this.onCheckboxChanged(!!e))}getFocusableElement(){return this.focusWrapper}setupExpansion(){const{eGroupClosedIcon:e,eGroupOpenedIcon:t,eGroupIndeterminateIcon:s,hasIndeterminateExpandState:i,beans:r}=this;e.appendChild(nl("setFilterGroupClosed",r,null)),t.appendChild(nl("setFilterGroupOpen",r,null));const n=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(e,{click:n}),this.addManagedElementListeners(t,{click:n}),i&&(s.appendChild(nl("setFilterGroupIndeterminate",r,null)),this.addManagedElementListeners(s,{click:n})),this.setExpandedIcons(),this.refreshAriaExpanded()}onExpandOrContractClicked(){this.setExpanded(!this.isExpanded)}setExpanded(e,t){if(this.isGroup&&e!==this.isExpanded){this.isExpanded=e;const s={type:"expandedChanged",isExpanded:!!e,item:this.item};t||this.dispatchLocalEvent(s),this.setExpandedIcons(),this.refreshAriaExpanded()}}setExpandedIcons(){const{isExpanded:e,hasIndeterminateExpandState:t,eGroupClosedIcon:s,eGroupOpenedIcon:i,eGroupIndeterminateIcon:r}=this;rl(s,t?e===!1:!e),rl(i,e===!0),t&&rl(r,e===void 0)}onCheckboxChanged(e){this.isSelected=e;const t={type:"selectionChanged",isSelected:e,item:this.item};this.dispatchLocalEvent(t),this.refreshVariableAriaLabels(),this.refreshAriaChecked()}toggleSelected(){this.params.readOnly||this.setSelected(!this.isSelected)}setSelected(e,t){this.isSelected=e,this.eCheckbox.setValue(e,t),this.refreshAriaChecked()}refreshVariableAriaLabels(){if(!this.isTree)return;const e=this.getLocaleTextFunc(),t=this.eCheckbox.getValue(),s=t===void 0?e("ariaIndeterminate","indeterminate"):t?e("ariaVisible","visible"):e("ariaHidden","hidden"),i=e("ariaToggleVisibility","Press SPACE to toggle visibility");v2(this.eCheckbox.getInputElement(),void 0),this.eCheckbox.setInputAriaLabel(`${i} (${s})`)}setupFixedAriaLabels(e){if(!this.isTree)return;const s=this.getLocaleTextFunc()("ariaFilterValue","Filter Value"),i=this.getAriaElement();m2(i,`${e} ${s}`),g2(i,this.eCheckbox.getInputElement().id)}refreshAriaChecked(){const e=this.getAriaElement();p2(e,this.eCheckbox.getValue())}refreshAriaExpanded(){f2(this.getAriaElement(),!!this.isExpanded)}refresh(e,t,s){this.item=e,t!==this.isSelected&&this.setSelected(t,!0),this.setExpanded(s,!0);let i=this.cellRendererParams.value,r=this.formattedValue,n=!1;if(this.valueFunction){const h=this.valueFunction();i=h,r=h,n=!this.cellRendererComponent}const o=!!this.cellRendererComponent,a=this.pendingCellRendererClaim!=null;this.setTooltipAndCellRendererParams(i,r,!o),a&&this.renderCell(),n&&this.renderCellWithoutCellRenderer();const{cellRendererComponent:l,cellRendererParams:c,beans:u,params:d}=this;if(l){const h=lg(u.userCompFactory,d,c);if(!l.refresh?.(h?.params??c)){const g=l;this.cellRendererComponent=void 0,this.destroyCellRendererComponent=void 0,this.setTooltipAndCellRendererParams(i,r),this.renderCell(),this.destroyBean(g)}}}render(){const{params:{column:e}}=this;let{value:t}=this,s;typeof t=="function"?(this.valueFunction=t,s=this.valueFunction(),t=s):this.isTree?s=ag(t):s=this.getFormattedValue(e,t),s==null&&t==null&&(s=this.translate("blanks")),this.formattedValue=s,this.setTooltipAndCellRendererParams(t,s),this.renderCell()}setTooltipAndCellRendererParams(e,t,s=!0){const i=this.gos,r=this.rendererGuard.claim();if(this.rendererClaim=r,this.formattedValue=t,s)if(this.params.showTooltips&&(!F2(i)||!this.params.cellRenderer)){const n=t??ag(e);this.shouldDisplayTooltip=x2(i,()=>this.eCheckbox.getGui().querySelector(".ag-label")),this.tooltipFeature?.setTooltipAndRefresh(n)}else this.shouldDisplayTooltip=void 0,this.tooltipFeature?.setTooltipAndRefresh(null);this.cellRendererParams=w2(i,{value:e,valueFormatted:t,colDef:this.params.colDef,column:this.params.column,setTooltip:(n,o)=>{i.assertModuleRegistered("Tooltip",3),r.isCurrent()&&(this.shouldDisplayTooltip=o,this.tooltipFeature?.setTooltipAndRefresh(n))}})}getFormattedValue(e,t){return Vh(this.beans,e,t,this.valueFormatter)}renderCell(){const t=lg(this.beans.userCompFactory,this.params,this.cellRendererParams)?.newAgStackInstance(),s=this.rendererClaim;if(t==null){this.pendingCellRendererClaim=void 0,this.renderCellWithoutCellRenderer();return}this.pendingCellRendererClaim=s,t.then(i=>{if(this.pendingCellRendererClaim===s&&(this.pendingCellRendererClaim=void 0),i){if(!this.isAlive()||!s.isCurrent()){this.destroyBean(i);return}this.cellRendererComponent=i,this.eCheckbox.setLabel(i.getGui()),this.destroyCellRendererComponent=()=>this.destroyBean(i)}})}renderCellWithoutCellRenderer(){const{valueFormatted:e,value:t}=this.cellRendererParams;let s=e??t;typeof s!="string"&&(this.beans.log.warn(208),s=""),this.eCheckbox.setLabel(s),this.setupFixedAriaLabels(s)}destroy(){this.rendererGuard.invalidate(),this.pendingCellRendererClaim=void 0,super.destroy()}getComponentHolder(){return this.params.column.getColDef()}};import{_getDateParts as R2}from"ag-stack";var ol=class{constructor(e,t,s,i,r){this.log=e,this.formatter=t,this.treeListPathGetter=s,this.treeListFormatter=i,this.treeDataOrGrouping=r,this.allDisplayedItemsTree=new Map,this.activeDisplayedItemsFlat=[],this.selectAllItem={depth:0,filterPasses:!0,available:!0,treeKey:pn,children:this.allDisplayedItemsTree,expanded:!0,parentTreeKeys:[]},this.addSelectionToFilterItem={depth:0,filterPasses:!0,available:!0,treeKey:gn,expanded:!0,parentTreeKeys:[]}}updateParams(e,t){this.treeListPathGetter=e,this.treeListFormatter=t}updateDisplayedValuesToAllAvailable(e,t,s,i){i==="reload"?this.generateItemTree(e,t,s):i==="otherFilter"?(this.updateAvailable(s),this.updateExpandAll()):i==="miniFilter"&&(this.resetFilter(),this.updateExpandAll()),this.flattenItems()}updateDisplayedValuesToMatchMiniFilter(e,t,s,i,r,n){n==="reload"?this.generateItemTree(e,t,s):n==="otherFilter"&&this.updateAvailable(s),this.updateFilter(i,r),this.updateExpandAll(),this.flattenItems()}generateItemTree(e,t,s){const i=new Map;this.allDisplayedItemsTree=i;let r=!1;const n=this.getTreeListPathGetter(e,s);for(const o of t){const a=e(o),l=n(a)??[null],c=l.length;c>1&&(r=!0);const u=s.has(o);let d=i,h,p=[];for(let g=0;g<c;g++){const f=l[g];d||(d=new Map,h.children=d);const m=f?.toUpperCase()??null;if(h=d.get(m),h||(h={treeKey:f,depth:g,filterPasses:!0,expanded:!1,available:u,parentTreeKeys:p},d.set(m,h)),g===c-1){const v=h.keys;v?v.push(o):h.keys=[o]}d=h.children,p=[...p,f]}}this.groupsExist=r,this.updateAvailable(s),this.selectAllItem.children=i,this.selectAllItem.expanded=!1}getTreeListPathGetter(e,t){if(this.treeListPathGetter)return this.treeListPathGetter;if(this.treeDataOrGrouping)return i=>i;let s=!1;for(const i of t){const r=e(i);if(r instanceof Date){s=!0;break}else if(r!=null)break}return s?i=>R2(i,!1):(this.log.warn(211),i=>[String(i)])}flattenItems(){this.activeDisplayedItemsFlat=[];const e=t=>{for(const s of t.values())!s.filterPasses||!s.available||(this.activeDisplayedItemsFlat.push(s),s.children&&s.expanded&&e(s.children))};e(this.allDisplayedItemsTree)}resetFilter(){const e=t=>{const s=t.children;if(s)for(const i of s.values())e(i);t.filterPasses=!0};for(const t of this.allDisplayedItemsTree.values())e(t)}updateFilter(e,t){const s=i=>i.available?i.treeKey==null?t:e(this.formatter(this.treeListFormatter?this.treeListFormatter(i.treeKey,i.depth,i.parentTreeKeys):i.treeKey)):!1;for(const i of this.allDisplayedItemsTree.values())this.recursiveItemCheck(i,!1,s,"filterPasses")}getDisplayedValueCount(){return this.activeDisplayedItemsFlat.length}getDisplayedItem(e){return this.activeDisplayedItemsFlat[e]}getSelectAllItem(){return this.selectAllItem}getAddSelectionToFilterItem(){return this.addSelectionToFilterItem}getDisplayedKeys(){const e=[];return this.forEachDisplayedKey(t=>e.push(t)),e}forEachDisplayedKey(e){const t=(s,i)=>{const r=s.keys??ki;for(let o=0,a=r.length;o<a;++o)e(r[o]);const n=s.children;if(n&&(!s.expanded||!i))for(const o of n.values())o.filterPasses&&t(o,!1)};for(const s of this.activeDisplayedItemsFlat)t(s,!0)}someDisplayedKey(e){const t=(s,i)=>{const r=s.keys??ki;for(let o=0,a=r.length;o<a;++o)if(e(r[o]))return!0;const n=s.children;if(n&&(!s.expanded||!i)){for(const o of n.values())if(o.filterPasses&&t(o,!1))return!0}return!1};return this.activeDisplayedItemsFlat.some(s=>t(s,!0))}hasGroups(){return this.groupsExist}refresh(){this.updateExpandAll(),this.flattenItems()}updateExpandAll(){const e=(s,i,r)=>{for(const n of s.values()){if(!n.filterPasses||!n.available||!n.children)continue;if(i=i||!!n.expanded,r=r||!n.expanded,i&&r)return;const o=e(n.children,i,r);if(o===void 0)return;o?i=!0:r=!0}return i&&r?void 0:i},t=this.getSelectAllItem();t.expanded=e(t.children,!1,!1)}recursiveItemCheck(e,t,s,i){let r=!1;const n=e.children;if(n)for(const a of n.values()){const l=this.recursiveItemCheck(a,t||s(e),s,i);r=r||l}const o=t||r||s(e);return e[i]=o,o}updateAvailable(e){const t=s=>{const i=s.keys??ki;for(let r=0,n=i.length;r<n;++r)if(e.has(i[r]))return!0;return!1};for(const s of this.allDisplayedItemsTree.values())this.recursiveItemCheck(s,!1,t,"available")}},cg=class extends Zw{constructor(){super("setFilter","set-filter"),this.filterType="set",this.eMiniFilter=Di,this.eFilterLoading=Di,this.eFilterLoadingIcon=Di,this.eSetFilterList=Di,this.eFilterNoMatches=Di,this.hardRefreshVirtualList=!1,this.miniFilterText=null,this.addCurrentSelectionToFilter=!1,this.selectedKeys=new Set}setParams(e){super.setParams(e);const t=this.updateHandler(e.getHandler()),{column:s,textFormatter:i,treeList:r,treeListPathGetter:n,treeListFormatter:o}=e;this.formatter=og(i,this.beans.gos,s,"columnFilter")??Ra,this.displayValueModel=r?new ol(this.beans.log,this.formatter,n,o,t.isTreeDataOrGrouping()):new h2(this.beans.valueSvc,()=>this.handler.valueFormatter,this.formatter,s),t.valueModel.allKeys.then(a=>{this.isAlive()&&(this.updateDisplayedValues("reload",a??[]),this.resetSelectionState(a??[]))}),t.valueModel.isLoading()&&this.setIsLoading(!0),this.initialiseFilterBodyUi()}refresh(e){return this.params.treeList!==e.treeList?!1:(this.updateHandler(e.getHandler()),super.refresh(e))}updateParams(e,t){super.updateParams(e,t),this.updateMiniFilter(),this.eMiniFilter.setAutoComplete(e.browserAutoComplete),e.suppressSelectAll!==t.suppressSelectAll&&this.createVirtualListModel(e);const{column:s,textFormatter:i,treeListPathGetter:r,treeListFormatter:n}=e;this.formatter=og(i,this.beans.gos,s,"columnFilter")??Ra,this.displayValueModel instanceof ol&&this.displayValueModel.updateParams(r,n),this.handler.refreshFilterValues(!0)}updateHandler(e){if(this.handler!==e){for(const s of this.handlerDestroyFuncs??[])s();this.handlerDestroyFuncs=[...this.addManagedListeners(e,{anyFilterChanged:s=>{e.valueModel.allKeys.then(i=>{this.isAlive()&&(this.updateDisplayedValues("otherFilter",i??[]),s.updated&&(this.checkAndRefreshVirtualList(),this.showOrHideResults()))})},dataChanged:({hardRefresh:s})=>{e.valueModel.allKeys.then(i=>{this.isAlive()&&(this.updateDisplayedValues("reload",i??[]),this.setSelectedModel(this.state.model?.values??null),s&&(this.hardRefreshVirtualList=!0),this.checkAndRefreshVirtualList(),this.showOrHideResults())})}}),...this.addManagedListeners(e.valueModel,{loadingStart:()=>this.setIsLoading(!0),loadingEnd:()=>this.setIsLoading(!1)})],this.handler=e}return e}updateUiVisibility(){}createBodyTemplate(){return{tag:"div",cls:"ag-set-filter",children:[{tag:"div",ref:"eFilterLoading",cls:"ag-filter-loading ag-loading ag-hidden",children:[{tag:"span",ref:"eFilterLoadingIcon",cls:"ag-loading-icon"},{tag:"span",cls:"ag-loading-text",children:ve(this,"loadingOoo")}]},{tag:"ag-input-text-field",ref:"eMiniFilter",cls:"ag-mini-filter"},{tag:"div",ref:"eFilterNoMatches",cls:"ag-filter-no-matches ag-hidden",children:ve(this,"noMatches")},{tag:"div",ref:"eSetFilterList",cls:"ag-set-filter-list",role:"presentation"}]}}getAgComponents(){return[c2]}handleKeyDown(e){if(super.handleKeyDown(e),e.defaultPrevented)return;const t=()=>{if(!this.eSetFilterList.contains(a2(this.beans)))return;const s=this.virtualList.getLastFocusedRow();if(s==null)return;const i=this.virtualList.getComponentAt(s);if(i==null)return;e.preventDefault();const{readOnly:r}=this.params;if(!r)return i};switch(e.key){case Li.SPACE:t()?.toggleSelected();break;case Li.ENTER:this.handleKeyEnter(e);break;case Li.LEFT:t()?.setExpanded(!1);break;case Li.RIGHT:t()?.setExpanded(!0);break}}handleKeyEnter(e){e.preventDefault();const{excelMode:t,readOnly:s}=this.params;!t||s||(this.params.onAction("apply",void 0,e),this.params.excelMode==="mac"&&this.eMiniFilter.getInputElement().select())}setModelAndRefresh(e){return this.setSelectedModel(e).then(()=>{this.isAlive()&&(this.checkAndRefreshVirtualList(),this.showOrHideResults())})}setModelIntoUi(e){this.setMiniFilter(this.params.state.state?.miniFilterValue??null,!0);const t=e==null?null:e.values;return this.setModelAndRefresh(t)}getModelFromUi(){const e=this.getSelectedModel();return e?{values:e,filterType:this.filterType}:null}areNonNullModelsEqual(e,t){return n2(e.values,t.values)}setIsLoading(e){il(this.eFilterLoading,e),e||(this.hardRefreshVirtualList=!0)}initialiseFilterBodyUi(){this.initVirtualList(),this.initMiniFilter(),this.initLoading()}initLoading(){const e=d2("setFilterLoading",this.beans,this.params.column);e&&this.eFilterLoadingIcon.appendChild(e)}initVirtualList(){const e=ve(this,"ariaFilterList"),t=!!this.params.treeList,s=this.virtualList=this.createBean(new Fs({cssIdentifier:"filter",ariaRole:t?"tree":"listbox",listName:e})),i=this.eSetFilterList;t&&i.classList.add("ag-set-filter-tree-list"),i.appendChild(s.getGui());const{cellHeight:r}=this.params;r!=null&&s.setRowHeight(r);const n=(a,l)=>this.createSetListItem(a,t,l);s.setComponentCreator(n);const o=(a,l)=>this.updateSetListItem(a,l);s.setComponentUpdater(o),this.createVirtualListModel(this.params)}createVirtualListModel(e){let t;e.suppressSelectAll?t=new M2(this.displayValueModel):t=new I2(this.displayValueModel,this.showAddCurrentSelectionToFilter.bind(this)),e.treeList&&(t=new E2(t)),this.virtualList.setModel(t)}getSelectAllLabel(){const e=this.miniFilterText==null||!this.params.excelMode?"selectAll":"selectAllSearchResults";return ve(this,e)}getAddSelectionToFilterLabel(){return ve(this,"addCurrentSelectionToFilter")}createSetListItem(e,t,s){const i=this.displayValueModel.hasGroups(),{isSelected:r,isExpanded:n}=this.isSelectedExpanded(e),{value:o,depth:a,isGroup:l,hasIndeterminateExpandState:c,selectedListener:u,expandedListener:d}=this.newSetListItemAttributes(e),h={focusWrapper:s,value:o,params:this.params,translate:g=>ve(this,g),valueFormatter:this.handler.valueFormatter,item:e,isSelected:r,isTree:t,depth:a,groupsExist:i,isGroup:l,isExpanded:n,hasIndeterminateExpandState:c},p=this.createBean(new P2(h));return p.addEventListener("selectionChanged",u),d&&p.addEventListener("expandedChanged",d),p}newSetTreeItemAttributes(e){const t=this.displayValueModel,s=t.hasGroups();if(e===t.getSelectAllItem())return{value:()=>this.getSelectAllLabel(),isGroup:s,depth:e.depth,hasIndeterminateExpandState:!0,selectedListener:r=>this.onSelectAll(r.isSelected),expandedListener:r=>this.onExpandAll(r.item,r.isExpanded)};if(e===t.getAddSelectionToFilterItem())return{value:()=>this.getAddSelectionToFilterLabel(),depth:e.depth,isGroup:!1,hasIndeterminateExpandState:!1,selectedListener:r=>{this.addCurrentSelectionToFilter=r.isSelected,this.refreshAfterSelection()}};const i=e.children;return{value:this.params.treeListFormatter?.(e.treeKey,e.depth,e.parentTreeKeys)??e.treeKey,depth:e.depth,isGroup:!!i,selectedListener:r=>this.onTreeItemSelected(r.item,r.isSelected),expandedListener:i?r=>this.onExpandedChanged(r.item,r.isExpanded):void 0}}newSetListItemAttributes(e){return this.isSetFilterModelTreeItem(e)?this.newSetTreeItemAttributes(e):e===pn?{value:()=>this.getSelectAllLabel(),selectedListener:t=>this.onSelectAll(t.isSelected)}:e===gn?{value:()=>this.getAddSelectionToFilterLabel(),selectedListener:t=>{this.addCurrentSelectionToFilter=t.isSelected,this.refreshAfterSelection()}}:{value:this.handler.valueModel.allValues.get(e)??null,selectedListener:t=>this.onItemSelected(t.item,t.isSelected)}}updateSetListItem(e,t){const{isSelected:s,isExpanded:i}=this.isSelectedExpanded(e);t.refresh(e,s,i)}isSelectedExpanded(e){let t,s;if(this.isSetFilterModelTreeItem(e)){const i=this.displayValueModel;s=e.expanded,e===i.getSelectAllItem()?t=this.isSelectAllSelected():e===i.getAddSelectionToFilterItem()?t=this.isAddCurrentSelectionToFilterChecked():t=this.isTreeItemSelected(e)}else e===pn?t=this.isSelectAllSelected():e===gn?t=this.isAddCurrentSelectionToFilterChecked():t=this.selectedKeys.has(e);return{isSelected:t,isExpanded:s}}isSetFilterModelTreeItem(e){return e?.treeKey!==void 0}initMiniFilter(){const{eMiniFilter:e,params:t}=this;e.setClearButtonEnabled(!0).setSearchIcon(!0).setAutoComplete(t.browserAutoComplete),this.updateMiniFilter(),e.onValueChange(()=>this.onMiniFilterInput()).onValueClear(()=>this.onMiniFilterInput(!0)),e.setInputAriaLabel(ve(this,"ariaSearchFilterValues")),this.addManagedElementListeners(e.getInputElement(),{keydown:s=>this.onMiniFilterKeyDown(s)})}updateMiniFilter(){const{eMiniFilter:e,miniFilterText:t,params:s}=this;e.setDisplayed(!s.suppressMiniFilter),e.setValue(t)}afterGuiAttached(e){super.afterGuiAttached(e),this.resetExpansion(),this.refreshVirtualList();const{eMiniFilter:t}=this;t.setInputPlaceholder(ve(this,"searchOoo")),e?.suppressFocus||(t.isDisplayed()?t.getFocusableElement().focus():this.virtualList.awaitStable(()=>this.virtualList.focusRow(0)))}afterGuiDetached(){super.afterGuiDetached();const{column:e,excelMode:t,model:s,onStateChange:i}=this.params;this.beans.colFilter?.shouldKeepStateOnDetach(e)||(t&&this.resetMiniFilter(),(t||s!==this.state.model)&&(i({model:s,state:this.getState()}),this.showOrHideResults()))}canApply(e){return this.params.excelMode?e==null||e.values.length>0:!0}onNewRowsLoaded(){}setFilterValues(e){this.beans.log.warn(283),this.handler.setFilterValues(e)}resetFilterValues(){this.beans.log.warn(283),this.handler.resetFilterValues()}refreshFilterValues(){this.beans.log.warn(283),this.doRefreshFilterValues()}doRefreshFilterValues(){this.handler.refreshFilterValues()}onAnyFilterChanged(){}onMiniFilterInput(e=!1,t){if(!this.doSetMiniFilter(this.eMiniFilter.getValue()))return;if(t){this.showOrHideResults();return}const{applyMiniFilterWhileTyping:s,readOnly:i,excelMode:r}=this.params,n=!i&&(s||!!r),o=e&&n?"immediately":s&&!i?"debounce":void 0;this.updateUiAfterMiniFilterChange(n,o)}updateUiAfterMiniFilterChange(e,t){let s=t;if(e){const{excelMode:i,readOnly:r,model:n}=this.params;i&&!r&&this.miniFilterText==null?(this.setModelAndRefresh(n?.values??null),s==="immediately"&&(s=void 0)):this.selectAllMatchingMiniFilter(!0)}this.checkAndRefreshVirtualList(),this.onUiChanged(e?s:"prevent"),this.showOrHideResults()}showOrHideResults(){const e=this.miniFilterText!=null&&this.displayValueModel.getDisplayedValueCount()<1;il(this.eFilterNoMatches,e),il(this.eSetFilterList,!e)}resetMiniFilter(){this.eMiniFilter.setValue(null,!0),this.doSetMiniFilter(null)}onMiniFilterKeyDown(e){const{excelMode:t,readOnly:s}=this.params;e.key===Li.ENTER&&!t&&!s&&this.updateUiAfterMiniFilterChange(!0,"immediately")}focusRowIfAlive(e){return e==null?Promise.resolve():new Promise(t=>{window.setTimeout(()=>{this.isAlive()&&this.virtualList.focusRow(e),t()},0)})}onSelectAll(e){e?this.selectAllMatchingMiniFilter():this.deselectAllMatchingMiniFilter(),this.refreshAfterSelection()}onTreeItemSelected(e,t){const s=i=>{if(!i.filterPasses)return;const r=i.keys??ki;for(let o=0,a=r.length;o<a;++o)this.setKeySelected(r[o],t);const n=i.children;if(n)for(const o of n.values())s(o)};s(e),this.refreshAfterSelection()}onItemSelected(e,t){this.setKeySelected(e,t),this.refreshAfterSelection()}onExpandAll(e,t){const s=i=>{if(i.filterPasses&&i.available&&i.children){for(const r of i.children.values())s(r);i.expanded=t}};s(e),this.refreshAfterExpansion()}onExpandedChanged(e,t){e.expanded=t,this.refreshAfterExpansion()}refreshAfterExpansion(){const e=this.virtualList.getLastFocusedRow();this.updateDisplayedValues("expansion"),this.checkAndRefreshVirtualList(),this.focusRowIfAlive(e)}refreshAfterSelection(){const e=this.virtualList.getLastFocusedRow();this.checkAndRefreshVirtualList(),this.onUiChanged(),this.focusRowIfAlive(e)}setMiniFilter(e,t){this.eMiniFilter.setValue(e,t),this.onMiniFilterInput(!1,t)}doSetMiniFilter(e){return e=l2(e),this.miniFilterText===e?!1:(e===null&&(this.addCurrentSelectionToFilter=!1),this.miniFilterText=e,this.updateDisplayedValues("miniFilter"),!0)}getMiniFilter(){return this.miniFilterText}getUiChangeEventParams(){return{miniFilterValue:this.miniFilterText}}getState(){const e=this.miniFilterText;return e?{miniFilterValue:e}:void 0}checkAndRefreshVirtualList(){this.virtualList.refresh(!this.hardRefreshVirtualList),this.hardRefreshVirtualList&&(this.hardRefreshVirtualList=!1)}getFilterKeys(){return this.beans.log.warn(283),this.handler.getFilterKeys()}getFilterValues(){return this.beans.log.warn(283),this.handler.getFilterValues()}refreshVirtualList(){this.params.refreshValuesOnOpen?this.doRefreshFilterValues():this.checkAndRefreshVirtualList()}isSelectAllSelected(){if(this.params.defaultToNothingSelected){if(this.hasSelections()&&this.isEverythingVisibleSelected())return!0;if(this.isNothingVisibleSelected())return!1}else{if(this.hasSelections()&&this.isNothingVisibleSelected())return!1;if(this.isEverythingVisibleSelected())return!0}}isTreeItemSelected(e){const t=s=>{let i=!1,r=!1;const n=s.keys??ki;for(let a=0,l=n.length;a<l;++a)this.selectedKeys.has(n[a])?i=!0:r=!0;const o=s.children;if(o)for(const a of o.values()){if(!a.filterPasses||!a.available)continue;const l=t(a);if(l===void 0)return;l?i=!0:r=!0}return i&&r?void 0:i};return this.params.defaultToNothingSelected?this.hasSelections()&&t(e):t(e)}resetExpansion(){if(!this.params.treeList)return;const e=this.displayValueModel.getSelectAllItem();if(this.isSetFilterModelTreeItem(e)){const t=s=>{const i=s.children;if(i){for(const r of i.values())t(r);s.expanded=!1}};t(e),this.updateDisplayedValues("expansion")}}getModelAsString(e){return this.handler.getModelAsString(e)}getPositionableElement(){return this.eSetFilterList}updateDisplayedValues(e,t){if(e==="expansion"){this.displayValueModel.refresh();return}const s=this.handler,i=s.valueModel;if(this.miniFilterText==null){this.displayValueModel.updateDisplayedValuesToAllAvailable(a=>i.allValues.get(a)??null,t,i.availableKeys,e);return}const r=s.caseFormat(this.formatter(this.miniFilterText)||""),n=a=>a!=null&&s.caseFormat(a).includes(r),o=!!this.params.excelMode&&n(ve(this,"blanks"));this.displayValueModel.updateDisplayedValuesToMatchMiniFilter(a=>i.allValues.get(a)??null,t,i.availableKeys,n,o,e)}hasSelections(){return this.params.defaultToNothingSelected?this.selectedKeys.size>0:this.handler.valueModel.allValues.size!==this.selectedKeys.size}isInWindowsExcelMode(){return this.params.excelMode==="windows"}isAddCurrentSelectionToFilterChecked(){return this.isInWindowsExcelMode()&&this.addCurrentSelectionToFilter}showAddCurrentSelectionToFilter(){return this.isInWindowsExcelMode()&&o2(this.miniFilterText)&&this.miniFilterText.length>0}selectAllMatchingMiniFilter(e=!1){this.miniFilterText==null?this.selectedKeys=new Set(this.handler.valueModel.allValues.keys()):(e&&this.selectedKeys.clear(),this.displayValueModel.forEachDisplayedKey(t=>this.selectedKeys.add(t)))}deselectAllMatchingMiniFilter(){this.miniFilterText==null?this.selectedKeys.clear():this.displayValueModel.forEachDisplayedKey(e=>this.selectedKeys.delete(e))}setKeySelected(e,t){t?this.selectedKeys.add(e):(this.params.excelMode&&this.isEverythingVisibleSelected()&&this.resetSelectionState(this.displayValueModel.getDisplayedKeys()),this.selectedKeys.delete(e))}isEverythingVisibleSelected(){return!this.displayValueModel.someDisplayedKey(e=>!this.selectedKeys.has(e))}isNothingVisibleSelected(){return!this.displayValueModel.someDisplayedKey(e=>this.selectedKeys.has(e))}getSelectedModel(){if(!this.hasSelections())return null;const e=this.isAddCurrentSelectionToFilterChecked()?this.params.model?.values:void 0;if(e?.length){if(this.selectedKeys){const t=new Set([...e,...this.selectedKeys]);return Array.from(t)}return Array.from(e)}return Array.from(this.selectedKeys)}setSelectedModel(e){const t=this.handler,s=t.valueModel;return s.allKeys.then(i=>{if(e==null)this.resetSelectionState(i??[]);else{this.selectedKeys.clear();const r=new Map;s.allValues.forEach((n,o)=>{r.set(t.caseFormat(o),o)}),e.forEach(n=>{const o=t.caseFormat(as(n)),a=r.get(o);a!==void 0&&this.selectedKeys.add(a)})}})}resetSelectionState(e){this.params.defaultToNothingSelected?this.selectedKeys.clear():this.selectedKeys=new Set(e)}getFilterHandler(){return this.handler}destroy(){this.virtualList=this.destroyBean(this.virtualList);for(const e of this.handlerDestroyFuncs??[])e();this.handler=void 0,this.displayValueModel=void 0,this.selectedKeys.clear(),super.destroy()}},M2=class{constructor(e){this.model=e}getRowCount(){return this.model.getDisplayedValueCount()}getRow(e){return this.model.getDisplayedItem(e)}areRowsEqual(e,t){return e===t}},I2=class{constructor(e,t){this.model=e,this.showAddCurrentSelectionToFilter=t}getRowCount(){const t=this.showAddCurrentSelectionToFilter()?2:1;return this.model.getDisplayedValueCount()+t}getRow(e){if(e===0)return this.model.getSelectAllItem();const t=this.showAddCurrentSelectionToFilter(),s=t?2:1;return e===1&&t?this.model.getAddSelectionToFilterItem():this.model.getDisplayedItem(e-s)}areRowsEqual(e,t){return e===t}},E2=class{constructor(e){this.model=e}getRowCount(){return this.model.getRowCount()}getRow(e){return this.model.getRow(e)}areRowsEqual(e,t){return e==null&&t==null?!0:e?.treeKey===t?.treeKey&&e?.depth===t?.depth}};import{_debounce as D2,_last as L2,_toStringOrNull as al}from"ag-stack";import{BeanStub as k2,_addGridCommonParams as _2,_bindFilterCallback as G2,_isBlank as O2,_isClientSideRowModel as N2}from"ag-grid-community";import{AgPromise as B2,BeanStub as V2}from"ag-grid-community";var H2=class extends Jw{constructor(e,t,s,i,r){super(),this.createKey=e,this.caseFormat=t,this.getValue=s,this.isTreeDataOrGrouping=i,this.isTreeData=r}extractUniqueValuesAsync(e,t){return new B2(s=>{if(this.beans.rowModel.rowCountReady)s(this.extractUniqueValues(e,t));else{const[i]=this.addManagedEventListeners({rowCountReady:()=>{i?.(),s(this.extractUniqueValues(e,t))}})}})}extractUniqueValues(e,t){const s=new Map,i=this.extractExistingFormattedKeys(t),r=new Set,n=this.isTreeData(),o=this.isTreeDataOrGrouping(),a=this.beans.rowGroupColsSvc?.columns,l=this.gos.get("groupAllowUnbalanced"),c=(u,d)=>{const h=this.caseFormat(u);if(!r.has(h)){r.add(h);let p=u,g=as(d);const f=i?.get(h);f!=null&&(p=f,g=t.get(f)),s.set(p,g)}};return this.beans.rowModel.forEachLeafNode(u=>{if(!u.data||!e(u))return;if(o){this.addValueForTreeDataOrGrouping(u,n,a,c,l);return}const d=this.getValue(u);if(d!=null&&Array.isArray(d)){for(const h of d)c(this.createKey(h,u),h);d.length===0&&c(null,null)}else c(this.createKey(d,u),d)}),s}addValueForTreeDataOrGrouping(e,t,s=[],i,r){let n;if(t){if(e.childrenAfterGroup?.length)return;n=e.getRoute()??[e.key??e.id]}else n=s.map(a=>this.beans.valueSvc.getKeyForNode(a,e)),n.push(this.getValue(e));const o=Ma(n,t,r);i(this.createKey(o),o)}extractExistingFormattedKeys(e){if(!e)return null;const t=new Map;return e.forEach((s,i)=>{t.set(this.caseFormat(i),i)}),t}},ug=class{constructor(e){this.caseFormat=e,this.keys=null}isNull(){return this.keys==null}isEmpty(){return!this.keys?.size}update(e){const t=new Set;this.keys=t;const s=e?.values;if(s){const i=this.caseFormat;for(let r=0,n=s.length;r<n;r++)t.add(i(s[r]))}}has(e){return!!this.keys?.has(this.caseFormat(e))}destroy(){this.keys=null}};import{_defaultComparator as dg}from"ag-stack";import{AgPromise as mn,BeanStub as U2,_addGridCommonParams as z2}from"ag-grid-community";var hg=(e=>(e[e.PROVIDED_LIST=0]="PROVIDED_LIST",e[e.PROVIDED_CALLBACK=1]="PROVIDED_CALLBACK",e[e.TAKEN_FROM_GRID_VALUES=2]="TAKEN_FROM_GRID_VALUES",e))(hg||{}),ll=hg,W2=class extends Qw{constructor(e,t,s,i,r){super(),this.csrmValuesExtractor=e,this.caseFormat=t,this.createKey=s,this.isTreeDataOrGrouping=i,this.params=r,this.allValues=new Map,this.availableKeys=new Set,this.providedValues=null,this.initialised=!1}postConstruct(){const e=this.params,t=e.handlerParams.filterParams.values;this.updateParams(e),t==null?this.valuesType=2:(this.valuesType=Array.isArray(t)?0:1,this.providedValues=t),this.updateAllValues()}refresh(e){const t=e.handlerParams;if(t.source!=="colDef")return;const{values:s,suppressSorting:i}=t.filterParams,r=this.providedValues,n=this.params.handlerParams.filterParams.suppressSorting;this.params=e,this.updateParams(e),this.providedValues=s??null,(this.providedValues!==r||i!==n)&&(!s||s.length===0?(this.valuesType=2,this.providedValues=null):this.valuesType=Array.isArray(s)?0:1,this.updateAllValues())}updateParams(e){const{handlerParams:{colDef:t,filterParams:{comparator:s,treeList:i,treeListPathGetter:r}},usingComplexObjects:n}=e,o=s??t.comparator,a=this.isTreeDataOrGrouping();let l;a&&!o?l=p_():i&&!r&&!o?l=([c,u],[d,h])=>dg(u,h):l=([c,u],[d,h])=>o(u,h),this.entryComparator=l,this.keyComparator=o??dg,this.compareByValue=!!(n&&o||a||i&&!r)}updateAllValues(){return this.allKeys=new mn(e=>{switch(this.valuesType){case 2:this.getValuesFromRowsAsync().then(t=>{this.isAlive()&&e(this.processAllValues(t))});break;case 0:{e(this.processAllValues(this.uniqueValues(this.validateProvidedValues(this.providedValues))));break}case 1:{this.dispatchLocalEvent({type:"loadingStart"});const t=this.providedValues,{column:s,colDef:i}=this.params.handlerParams,r=z2(this.gos,{success:n=>{this.isAlive()&&(this.dispatchLocalEvent({type:"loadingEnd"}),e(this.processAllValues(this.uniqueValues(this.validateProvidedValues(n)))))},colDef:i,column:s});window.setTimeout(()=>t(r),0);break}}}),this.allKeys.then(e=>{this.updateAvailableKeys(e??[]),this.initialised=!0}),this.allKeys}getAvailableValues(e){return this.sortKeys(this.getValuesFromRows(e))}overrideValues(e){return this.allKeys.then(()=>{this.valuesType=0,this.providedValues=e})}refreshAvailable(){return new mn(e=>{if(this.showAvailableOnly()){this.allKeys.then(t=>{const s=t??[];this.updateAvailableKeys(s),e(!0)});return}e(!1)})}refreshAll(){return new mn(e=>{this.allKeys.then(()=>{this.updateAllValues().then(()=>{e()})})})}isLoading(){return!this.initialised&&this.valuesType===1}isInitialised(){return this.initialised}getValueForFormatter(e){return this.initialised?this.allValues.get(e):e}getAvailableKeys(e){return this.initialised?e.filter(t=>this.availableKeys.has(t)):e}getParamsForValuesFromRows(e){if(!this.csrmValuesExtractor){this.error(113);return}return e&&!this.params.handlerParams.filterParams.caseSensitive?this.allValues:void 0}getValuesFromRows(e){const t=this.getParamsForValuesFromRows(!0);return this.csrmValuesExtractor?.extractUniqueValues(e,t)??null}getValuesFromRowsAsync(){const e=this.getParamsForValuesFromRows(!1);return this.csrmValuesExtractor?.extractUniqueValuesAsync(()=>!0,e)??mn.resolve(null)}processAllValues(e){const t=this.sortKeys(e);return this.allValues=e??new Map,t}uniqueValues(e){const t=new Map,s=new Set,{caseFormat:i,createKey:r}=this;for(const n of e??[]){const o=as(n),a=r(o),l=i(a);s.has(l)||(s.add(l),t.set(a,o))}return t}validateProvidedValues(e){if(this.params.userKeyCreator&&e?.length){const t=e[0];t&&typeof t!="object"&&typeof t!="function"&&(this.createKey(t)==null?this.warn(209):this.warn(210))}return e}sortKeys(e){const t=e??new Map,s=this.params.handlerParams.filterParams;if(s.suppressSorting)return Array.from(t.keys());let i;return this.compareByValue?i=Array.from(t.entries()).sort(this.entryComparator).map(([r])=>r):i=Array.from(t.keys()).sort(this.keyComparator),s.excelMode&&t.has(null)&&(i=i.filter(r=>r!=null),i.push(null)),i}showAvailableOnly(){return this.valuesType===2}updateAvailableKeys(e){const t=this.showAvailableOnly()?this.getAvailableValues(s=>this.params.handlerParams.doesRowPassOtherFilter(s)):e;this.availableKeys=new Set(t),window.setTimeout(()=>{this.isAlive()&&this.dispatchLocalEvent({type:"availableValuesChanged"})})}};function pg(e,t){const{colDef:s,filterParams:i}=t,r=i.keyCreator??s.keyCreator,n=s.cellDataType,o=typeof n=="string"&&r===e.dataTypeSvc?.getFormatValue(n);return{usingComplexObjects:!!r,userKeyCreator:!!r&&!o}}var $2=class extends ex{constructor(){super(...arguments),this.filterType="set",this.treeDataTreeList=!1,this.groupingTreeList=!1,this.caseSensitive=!1,this.noValueFormatterSupplied=!1}init(e){this.updateParams(e);const t=this.isTreeDataOrGrouping.bind(this),s=()=>this.treeDataTreeList,i=this.createKey,r=this.caseFormat.bind(this),{gos:n,beans:o}=this,a=N2(n,o.rowModel)?this.createManagedBean(new H2(i,r,e.getValue,t,s)):void 0,l=this.createManagedBean(new W2(a,r,i,t,{handlerParams:e,...pg(this.beans,e)}));this.addManagedListeners(l,{availableValuesChanged:e.onModelAsStringChange}),this.valueModel=l,this.appliedModel=new ug(this.caseFormat.bind(this)),this.appliedModel.update(e.model),this.validateModel(e),this.addEventListenersForDataChanges()}refresh(e){this.updateParams(e),this.valueModel.refresh({handlerParams:e,...pg(this.beans,e)}),this.appliedModel.update(e.model),this.validateModel(e)}updateParams(e){this.params=e;const{colDef:t,filterParams:{caseSensitive:s,treeList:i,keyCreator:r,valueFormatter:n}}=e;this.caseSensitive=!!s;const o=!!t.showRowGroup;this.treeDataTreeList=this.gos.get("treeData")&&!!i&&o,this.groupingTreeList=!!this.beans.rowGroupColsSvc?.columns.length&&!!i&&o;const a=r??t.keyCreator;this.createKey=this.generateCreateKey(a,this.isTreeDataOrGrouping()),this.setValueFormatter(n,a,!!i,!!t.refData)}doesFilterPass(e){const t=this.appliedModel;return t.isNull()?!0:t.isEmpty()?!1:this.matchesKeys(e.node,t)??!1}createKeysMatcher(e){const t=new ug(this.caseFormat.bind(this));let s=this.caseSensitive;return t.update({filterType:"set",values:e}),i=>(s!==this.caseSensitive&&(s=this.caseSensitive,t.update({filterType:"set",values:e})),this.matchesKeys(i,t))}matchesKeys(e,t){if(this.treeDataTreeList)return this.doesFilterPassForTreeData(e,t);if(this.groupingTreeList)return this.doesFilterPassForGrouping(e,t);const s=this.params.getValue(e);return s!=null&&Array.isArray(s)?s.length===0?t.has(null):s.some(i=>t.has(this.createKey(i,e))):t.has(this.createKey(s,e))}createDisplayValueTree(e){const t=this.params.filterParams,s=new ol(this.beans.log,G2(t.textFormatter,this.beans.gos,this.params.column,"columnFilter")??Ra,t.treeListPathGetter,t.treeListFormatter,this.isTreeDataOrGrouping());return s.updateDisplayedValuesToAllAvailable(i=>this.valueModel.getValueForFormatter(i),e,new Set(e),"reload"),s.getSelectAllItem().children}getFormattedValue(e){let t=this.valueModel.getValueForFormatter(e);this.noValueFormatterSupplied&&this.isTreeDataOrGrouping()&&Array.isArray(t)&&(t=L2(t));const s=Vh(this.beans,this.params.column,t,this.valueFormatter);return s??al(t)??ve(this,"blanks")}getModelAsString(e,t){const{values:s}=e??{},i=t==="filterToolPanel";if(s==null)return i?ve(this,"filterSummaryListInactive"):"";const r=this.valueModel.getAvailableKeys(s),n=r.length,o=i?3:10,a=r.slice(0,o).map(l=>this.getFormattedValue(l));if(i){const l=a.join(ve(this,"filterSummaryListSeparator"));return n>3?ve(this,"filterSummaryListLong",[l,String(n-3)]):ve(this,"filterSummaryListShort",[l])}return`(${n}) ${a.join(",")}${n>10?",...":""}`}onAnyFilterChanged(){window.setTimeout(()=>{this.isAlive()&&this.valueModel.refreshAvailable().then(e=>{this.dispatchLocalEvent({type:"anyFilterChanged",updated:!!e})})})}onNewRowsLoaded(){this.syncAfterDataChange()}setFilterValues(e){this.valueModel.overrideValues(e).then(()=>{this.refreshFilterValues()})}resetFilterValues(){this.valueModel.valuesType=ll.TAKEN_FROM_GRID_VALUES,this.syncAfterDataChange()}refreshFilterValues(e){this.valueModel.isInitialised()&&this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged",hardRefresh:!0}),this.validateModel(this.params,void 0,!e)})}getFilterKeys(){return Array.from(this.valueModel.allValues.keys())}getFilterValues(){return Array.from(this.valueModel.allValues.values())}isTreeDataOrGrouping(){return this.treeDataTreeList||this.groupingTreeList}caseFormat(e){return e==null||typeof e!="string"||this.caseSensitive?e:e.toUpperCase()}addEventListenersForDataChanges(){this.addManagedPropertyListeners(["groupAllowUnbalanced"],()=>this.syncAfterDataChange());const e=D2(this,this.syncAfterDataChange.bind(this),0);this.addManagedEventListeners({cellValueChanged:t=>{t.column===this.params.column&&e()},dataTypesInferred:()=>e()})}syncAfterDataChange(){this.isValuesTakenFromGrid()&&this.valueModel.refreshAll().then(()=>{this.dispatchLocalEvent({type:"dataChanged"}),this.validateModel(this.params,{afterDataChange:!0})})}validateModel(e,t,s){const i=this.valueModel;i.allKeys.then(()=>{const r=e.model;if(r==null)return;const n=new Map,o=g=>n.set(this.caseFormat(g),g);if(s)for(const g of i.availableKeys)o(g);else i.allValues.forEach((g,f)=>o(f));const a=i.valuesType===ll.TAKEN_FROM_GRID_VALUES;if(a&&n.size===0&&r.values.length>0)return;const l=[];let c=!1;for(const g of r.values){const f=this.caseFormat(as(g)),m=n.get(f);m!==void 0?(l.push(m),m!==g&&(c=!0)):c=!0}const u=l.length,d=e.filterParams;if(u===0&&d.excelMode){e.onModelChange(null,t);return}const p=!d.defaultToNothingSelected&&(a||!d.suppressClearModelOnRefreshValues)&&u===n.size;if(c||!r.filterType||p){const g=p?null:{filterType:this.filterType,values:l};e.onModelChange(g,t)}})}isValuesTakenFromGrid(){return this.valueModel.valuesType===ll.TAKEN_FROM_GRID_VALUES}doesFilterPassForTreeData(e,t){if(!e.childrenAfterGroup?.length)return t.has(this.createKey(Ma(e.getRoute()??[e.key??e.id],!0,this.gos.get("groupAllowUnbalanced"))))}doesFilterPassForGrouping(e,t){const{params:s,gos:i,beans:{rowGroupColsSvc:r,valueSvc:n}}=this,o=(r?.columns??[]).map(a=>n.getKeyForNode(a,e));return o.push(s.getValue(e)),t.has(this.createKey(Ma(o,!1,i.get("groupAllowUnbalanced"))))}generateCreateKey(e,t){return t&&!e?(this.error(250),()=>null):e?(s,i=null)=>{const r=this.getKeyCreatorParams(s,i);return as(e(r))}:s=>as(al(s))}getKeyCreatorParams(e,t=null){const{colDef:s,column:i}=this.params;return _2(this.gos,{value:e,colDef:s,column:i,node:t,data:t?.data})}setValueFormatter(e,t,s,i){let r=e;if(!r){if(t&&!s){this.error(249);return}this.noValueFormatterSupplied=!0,r=n=>{const o=n.value;return O2(o)?ve(this,"blanks"):i?this.beans.valueSvc.formatValue(n.column,null,o,void 0,!1):al(o)}}this.valueFormatter=r}getCrossFilterModel(e){const{createKey:t,valueModel:s,params:i}=this;return e(t,s.availableKeys,i.model?.values)}destroy(){this.appliedModel.destroy(),super.destroy(),this.valueModel=void 0}};import{RefPlaceholder as K2}from"ag-stack";import{AgInputTextFieldSelector as j2,Component as Y2}from"ag-grid-community";var q2={tag:"div",cls:"ag-floating-filter-input ag-set-floating-filter-input",role:"presentation",children:[{tag:"ag-input-text-field",ref:"eFloatingFilterText"}]},X2=class extends tx{constructor(){super(q2,[j2]),this.eFloatingFilterText=K2}init(e){this.params=e,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(e)}setParams(e){const t=this.beans.colNames.getDisplayNameForColumn(e.column,"header",!0),s=this.getLocaleTextFunc();if(this.eFloatingFilterText.setInputAriaLabel(`${t} ${s("ariaFilterInput","Filter Input")}`),this.gos.get("enableFilterHandlers")){const i=e;this.updateFloatingFilterText(i.model)}}refresh(e){this.params=e,this.setParams(e)}onParentModelChanged(e){this.updateFloatingFilterText(e)}parentSetFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof cg)){this.beans.log.error(248);return}e(t)})}updateFloatingFilterText(e){e==null?this.eFloatingFilterText.setValue(""):this.gos.get("enableFilterHandlers")?this.eFloatingFilterText.setValue(this.params.getHandler().getModelAsString?.(e)??""):this.parentSetFilterInstance(t=>{this.eFloatingFilterText.setValue(t.getModelAsString(e))})}},gg={moduleName:"SetFilter",version:G,userComponents:{agSetColumnFilter:{classImp:cg,params:{useForm:!0},processParams:(e,t)=>(h_(e,t),e)},agSetColumnFloatingFilter:X2},dynamicBeans:{agSetColumnFilterHandler:$2},icons:{setFilterGroupClosed:"tree-closed",setFilterGroupOpen:"tree-open",setFilterGroupIndeterminate:"tree-indeterminate",setFilterLoading:"loading"},dependsOn:[$,r2]};import{_KeyboardNavigationModule as Z2}from"ag-grid-community";import{RefPlaceholder as cl,_clearElement as ul,_removeFromParent as J2}from"ag-stack";import{AgPromise as vn,Component as Q2,_addFocusableContainerListener as e3,_addGridCommonParams as fg}from"ag-grid-community";var t3=".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:auto hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4);scrollbar-width:thin}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}";function s3(e,t,s){return e.getCompDetails(t,i3,void 0,s,!0)}var i3={name:"statusPanel",optionalMethods:["refresh"]},r3={agAggregationComponent:{rowModels:["clientSide","serverSide"],warnArgs:[221]},agFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[222]},agSelectedRowCountComponent:{rowModels:["clientSide","serverSide"],warnArgs:[223]},agTotalAndFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[224]},agTotalRowCountComponent:{rowModels:["clientSide"],warnArgs:[225]}},n3={tag:"div",cls:"ag-status-bar",children:[{tag:"div",ref:"eStatusBarLeft",cls:"ag-status-bar-left",role:"status"},{tag:"div",ref:"eStatusBarCenter",cls:"ag-status-bar-center",role:"status"},{tag:"div",ref:"eStatusBarRight",cls:"ag-status-bar-right",role:"status"}]},o3=class extends sx{constructor(){super(n3),this.updateQueued=!1,this.panelsPromise=vn.resolve(),this.eStatusBarLeft=cl,this.eStatusBarCenter=cl,this.eStatusBarRight=cl,this.compDestroyFunctions={},this.registerCSS(t3)}wireBeans(e){this.userCompFactory=e.userCompFactory,this.statusBarSvc=e.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),e3(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){const e=this.gos,t=e.get("statusBar")?.statusPanels;return t&&t.filter(s=>{const{rowModels:i,warnArgs:r}=r3[s.statusPanel]??{};return!i||i.includes(e.get("rowModelType"))?!0:(this.beans.log.warn(...r),!1)})}processStatusPanels(e){const t=this.getValidPanels();if(t){const s=t.filter(n=>n.align==="left"),i=t.filter(n=>n.align==="center"),r=t.filter(n=>!n.align||n.align==="right");this.panelsPromise=vn.all([this.createAndRenderComponents(s,this.eStatusBarLeft,e),this.createAndRenderComponents(i,this.eStatusBarCenter,e),this.createAndRenderComponents(r,this.eStatusBarRight,e)])}else this.setDisplayed(!1)}handleStatusBarChanged(){this.updateQueued||(this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1}))}updateStatusBar(){const e=this.getValidPanels(),t=Array.isArray(e)&&e.length>0;this.setDisplayed(t);const s=new Map;if(t)for(const i of e){const r=i.key??i.statusPanel,n=this.statusBarSvc.getStatusPanel(r);if(n?.refresh){const o=fg(this.gos,{...i.statusPanelParams??{},key:r});n.refresh(o)&&(s.set(r,n),delete this.compDestroyFunctions[r],J2(n.getGui()))}}this.resetStatusBar(),t&&this.processStatusPanels(s)}resetStatusBar(){ul(this.eStatusBarLeft),ul(this.eStatusBarCenter),ul(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(const e of Object.values(this.compDestroyFunctions))e();this.compDestroyFunctions={}}createAndRenderComponents(e,t,s){const i=[];for(const r of e){const n=r.key||r.statusPanel,o=s.get(n);let a;if(o)a=vn.resolve(o);else{const l=s3(this.userCompFactory,r,fg(this.gos,{key:n}));if(l==null)continue;a=l.newAgStackInstance()}i.push({key:n,promise:a})}return vn.all(i.map(r=>r.promise)).then(()=>{for(const r of i)r.promise.then(n=>{const o=()=>{this.destroyBean(n)};this.isAlive()?(this.statusBarSvc.registerStatusPanel(r.key,n),t.appendChild(n.getGui()),this.compDestroyFunctions[r.key]=o):o()})})}},a3={selector:"AG-STATUS-BAR",component:o3};import{RefPlaceholder as _i,_exists as l3,_missing as dl,_parseBigIntOrNull as c3}from"ag-stack";import{Component as u3,_createCellId as d3,_formatNumberCommas as h3,_getRowBelow as p3,_getRowNode as g3,_isRowBefore as f3}from"ag-grid-community";import{RefPlaceholder as mg}from"ag-stack";import{Component as m3,_addGridCommonParams as v3}from"ag-grid-community";var C3={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},":\xA0",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},S3=BigInt(Number.MIN_SAFE_INTEGER),b3=BigInt(Number.MAX_SAFE_INTEGER),Gi=class extends ix{constructor(){super(C3),this.eLabel=mg,this.eValue=mg}setLabel(e,t){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()(e,t)}setValue(e,t){let s=null,i;typeof e=="bigint"?(i=e,e>=S3&&e<=b3&&(s=Number(e))):s=e,this.eValue.textContent=this.valueFormatter(v3(this.gos,{value:s,bigintValue:i,totalRows:t,key:this.key}))}},y3={selector:"AG-NAME-VALUE",component:Gi},vg=e=>{let t=0;return e.forEachNodeAfterFilter(s=>{s.data&&t++}),t},Oi=e=>{let t=0;return e.forEachNode(s=>{s.data&&t++}),t};function w3(e,t){return typeof e!="number"?"":h3(Math.round(e*100)/100,t)}var x3={tag:"div",cls:"ag-status-panel ag-status-panel-aggregations",children:[{tag:"ag-name-value",ref:"avgAggregationComp"},{tag:"ag-name-value",ref:"countAggregationComp"},{tag:"ag-name-value",ref:"minAggregationComp"},{tag:"ag-name-value",ref:"maxAggregationComp"},{tag:"ag-name-value",ref:"sumAggregationComp"}]},F3=class extends rx{constructor(){super(x3,[y3]),this.sumAggregationComp=_i,this.countAggregationComp=_i,this.minAggregationComp=_i,this.maxAggregationComp=_i,this.avgAggregationComp=_i}postConstruct(){this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this),modelUpdated:this.onCellSelectionChanged.bind(this)})}init(e){this.refresh(e)}refresh(e){this.params=e;const t=e.valueFormatter??(i=>{const{value:r,bigintValue:n}=i;return n!=null?n.toString():w3(r,this.getLocaleTextFunc.bind(this))}),s=["avg","count","min","max","sum"];for(const i of s){const r=this.getAllowedAggregationValueComponent(i);r&&(r.key=i,r.valueFormatter=t.bind(this))}return this.onCellSelectionChanged(),!0}setAggregationComponentValue(e,t,s){const i=this.getAllowedAggregationValueComponent(e),r=Oi(this.beans.rowModel);l3(i)&&i?(i.setValue(t,r),i.setDisplayed(s)):this.getAggregationValueComponent(e)?.setDisplayed(!1)}getAllowedAggregationValueComponent(e){const{aggFuncs:t}=this.params;return!t||t.includes(e)?this.getAggregationValueComponent(e):null}getAggregationValueComponent(e){const t=`${e}AggregationComp`;return this[t]}onCellSelectionChanged(){const e=this.beans,t=e.valueSvc,s=e.formula,i=e.rangeSvc,r=i?.getCellRanges();let n=0,o=0n,a=!1,l=!1,c=0,u=0,d=null,h=null,p=null,g=null;const f=A=>{if(typeof A=="number")if(n+=A,(d===null||A<d)&&(d=A),(h===null||A>h)&&(h=A),!Number.isInteger(A)||!Number.isSafeInteger(A))l=!0;else{const P=BigInt(A);o+=P,(p===null||P<p)&&(p=P),(g===null||P>g)&&(g=P)}else{a=!0,o+=A,(p===null||A<p)&&(p=A),(g===null||A>g)&&(g=A);const P=Number(A);n+=P,(d===null||P<d)&&(d=P),(h===null||P>h)&&(h=P)}u++},m={};if(r?.length&&i)for(let A=0;A<r.length;A++){const P=r[A];let D=i.getRangeStartRow(P);const N=i.getRangeEndRow(P);for(;!(dl(D)||!D||f3(N,D)||!D||!P.columns);)P.columns.forEach(L=>{if(D===null)return;const O=d3({rowPinned:D.rowPinned,column:L,rowIndex:D.rowIndex});if(m[O])return;m[O]=!0;const K=g3(e,D);if(dl(K))return;let H=t.getValueFromData(L,K);if(L.allowFormula&&s?.isFormula(H)&&(H=s.resolveValue(L,K)),!(dl(H)||H==="")&&(c++,!(typeof H=="object"&&"value"in H&&(H=H.value,H==="")))){if(typeof H=="string"){const Z=H.trim();if(Z==="")return;const Y=Number(Z);if(!Number.isFinite(Y))return;n+Y>=Number.MAX_SAFE_INTEGER||n+Y<=Number.MIN_SAFE_INTEGER||Y>=Number.MAX_SAFE_INTEGER||Y<=Number.MIN_SAFE_INTEGER?(H=c3(Z),H===null&&(H=Y)):H=Y}(typeof H=="number"&&!isNaN(H)||typeof H=="bigint")&&f(H)}}),D=p3(e,D)}const v=c>1,C=u>1,S=a&&!l;let w;S?w=o/BigInt(u):w=n/u;const b=C?S?o:n:null,y=C?S?p:d:null,T=C?S?g:h:null,x=C?w:null,F=C;this.setAggregationComponentValue("count",c,v),this.setAggregationComponentValue("sum",b,C),this.setAggregationComponentValue("min",y,C),this.setAggregationComponentValue("max",T,C),this.setAggregationComponentValue("avg",x,F)}};import{_formatNumberCommas as T3}from"ag-grid-community";var A3=class extends Gi{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);const e=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:e})}onDataChanged(){const{rowModel:e}=this.beans,t=Oi(e),s=vg(e);this.setValue(s,t),this.setDisplayed(t!==s)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>T3(t,this.getLocaleTextFunc.bind(this)))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as P3}from"ag-grid-community";var R3=class extends Gi{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");const e=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:e,selectionChanged:e})}onRowSelectionChanged(){const{selectionSvc:e,rowModel:t}=this.beans,s=e?.getSelectionCount()??0,i=Oi(t);if(this.setValue(s,i),s<0){this.setDisplayed(!0);return}this.setDisplayed(s>0)}init(e){this.refresh(e),this.onRowSelectionChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>t==null||t>=0?P3(t,this.getLocaleTextFunc.bind(this)):this.getLocaleTextFunc()("statusBarLastRowUnknown","?"))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as Cg}from"ag-grid-community";var M3=class extends Gi{postConstruct(){this.setLabel("totalAndFilteredRows","Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){const{rowModel:e}=this.beans,t=vg(e),s=Oi(e);this.setValue(t,s)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t,totalRows:s})=>{const i=this.getLocaleTextFunc.bind(this),r=Cg(t,i),n=Cg(s??t,i);if(t===s)return r;const o=i();return`${r} ${o("of","of")} ${n}`})}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_formatNumberCommas as I3}from"ag-grid-community";var E3=class extends Gi{postConstruct(){this.setLabel("totalRows","Total Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){const e=Oi(this.beans.rowModel);this.setValue(e,e)}init(e){this.refresh(e),this.onDataChanged()}updateValueFormatter(e){this.valueFormatter=e??(({value:t})=>I3(t,this.getLocaleTextFunc.bind(this)))}refresh(e){const{key:t,valueFormatter:s}=e;return this.key=t,this.updateValueFormatter(s),!0}};import{_unwrapUserComp as D3}from"ag-grid-community";function L3(e,t){const s=e.statusBarSvc?.getStatusPanel(t);return D3(s)}import{BeanStub as k3}from"ag-grid-community";var _3=class extends nx{constructor(){super(),this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel(e,t){this.comps.set(e,t)}unregisterStatusPanel(e){this.comps.delete(e)}unregisterAllComponents(){this.comps.clear()}getStatusPanel(e){return this.comps.get(e)}destroy(){this.unregisterAllComponents(),super.destroy()}},Sg={moduleName:"StatusBar",version:G,beans:[_3],userComponents:{agAggregationComponent:F3,agTotalRowCountComponent:E3,agFilteredRowCountComponent:A3,agTotalAndFilteredRowCountComponent:M3,agSelectedRowCountComponent:R3},selectors:[a3],apiFunctions:{getStatusPanel:L3},dependsOn:[$,Z2]};import{_clearElement as G3,_findFocusableElements as O3,_getActiveDomElement as N3,_removeFromParent as Cn,_scrollHorizontallyToShow as B3}from"ag-stack";import{Component as V3,KeyCode as Bt,ManagedFocusFeature as H3,_addFocusableContainerListener as U3,_addGridCommonParams as z3,_clamp as W3,_createElement as Sn,_unwrapUserComp as $3}from"ag-grid-community";var K3=".ag-toolbar{align-items:center;background-color:var(--ag-toolbar-background-color);border-bottom:var(--ag-header-row-border);color:var(--ag-toolbar-text-color);display:flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);min-height:var(--ag-header-height);overflow:auto hidden;scrollbar-width:thin;white-space:nowrap}.ag-toolbar-right-start{margin-inline-start:auto}.ag-toolbar-item{display:inline-flex}.ag-toolbar-item:where(:not(.ag-toolbar-panel)){font-weight:var(--ag-header-font-weight)}.ag-toolbar-button-wrapper{display:inline-flex;height:100%;padding:calc(var(--ag-spacing)*.25)}.ag-toolbar-button{align-items:center;background:transparent;border:0;color:var(--ag-toolbar-text-color);cursor:pointer;display:inline-flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);gap:var(--ag-spacing);line-height:1;outline:none;padding:var(--ag-spacing);white-space:nowrap}:where(.ag-toolbar-button) .ag-icon{color:var(--ag-icon-color)}.ag-toolbar-button-wrapper:hover{background-color:var(--ag-icon-button-hover-background-color);color:var(--ag-icon-button-hover-color)}:where(.ag-toolbar-button-wrapper:hover .ag-toolbar-button) .ag-icon,:where(.ag-toolbar-button-wrapper:hover) .ag-toolbar-button{color:var(--ag-icon-button-hover-color)}.ag-toolbar-button:focus-visible{box-shadow:var(--ag-focus-shadow)}:where(.ag-toolbar-button:focus):not(:focus-visible){box-shadow:none}.ag-toolbar-button:disabled{cursor:default;opacity:.5;pointer-events:none}.ag-toolbar>.ag-toolbar-button-wrapper:first-child>.ag-toolbar-button{border-start-start-radius:calc(var(--ag-border-radius) + 1px)}.ag-toolbar>.ag-toolbar-button-wrapper:last-child>.ag-toolbar-button{border-start-end-radius:calc(var(--ag-border-radius) + 1px)}.ag-toolbar-panel{display:inline-flex;flex:1 0 0;padding:0 calc(var(--ag-spacing)*2)}.ag-toolbar-input{align-items:center;display:inline-flex;margin:0 calc(var(--ag-spacing)*2);max-width:none;min-width:200px;position:relative}.ag-toolbar-input+.ag-toolbar-input{margin-inline-start:0}.ag-toolbar-right-start+.ag-toolbar-input{margin-inline-start:var(--ag-spacing)}.ag-toolbar>.ag-toolbar-input:first-child{margin-inline-start:var(--ag-spacing)}.ag-toolbar>.ag-toolbar-input:last-child{margin-inline-end:var(--ag-spacing)}.ag-toolbar-input-icon{align-items:center;color:var(--ag-icon-color);display:inline-flex;inset-inline-start:var(--ag-spacing);opacity:.5;pointer-events:none;position:absolute;z-index:1}.ag-toolbar-input-field{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-text-color);font-family:inherit;font-size:var(--ag-font-size);font-weight:inherit;line-height:1.5;outline:none;padding-block:calc(var(--ag-spacing)*.5);width:100%}.ag-toolbar-input .ag-toolbar-input-field{padding-inline-start:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}.ag-toolbar-input-widget{flex:1;min-width:0}.ag-toolbar-input-field:focus{border:var(--ag-input-focus-border);box-shadow:var(--ag-focus-shadow)}.ag-toolbar-input-field::-moz-placeholder{color:var(--ag-input-placeholder-text-color)}.ag-toolbar-input-field::placeholder{color:var(--ag-input-placeholder-text-color)}:where(.ag-toolbar-panel) .ag-column-drop-horizontal{background-color:transparent;border-bottom:none;font-family:var(--ag-cell-font-family);font-size:var(--ag-font-size);padding:0}.ag-toolbar .ag-column-drop-horizontal{border-bottom:none;overflow:visible;padding-inline-start:0}.ag-toolbar-button-chevron{align-items:center;display:inline-flex}.ag-toolbar-separator{align-self:stretch;border-inline-start:var(--ag-toolbar-separator-border);margin:calc(var(--ag-spacing)*1.75) 0;width:0}.ag-toolbar-find{background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);gap:calc(var(--ag-spacing)*.5);max-width:none;min-width:220px;width:280px}.ag-toolbar-find:focus-within{border:var(--ag-input-focus-border);box-shadow:var(--ag-focus-shadow)}.ag-toolbar-find .ag-toolbar-input-field{background-color:transparent;border:none;flex:1;min-width:0}.ag-toolbar-find .ag-toolbar-input-field:focus{border:none;box-shadow:none}.ag-toolbar-find-match-count{color:inherit;flex-shrink:0;font-size:var(--ag-font-size);font-variant-numeric:tabular-nums;opacity:.7;text-align:end;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap}.ag-toolbar-find-button{flex-shrink:0;padding:calc(var(--ag-spacing)*.5)}";function j3(e,t){if(typeof e=="string")return{toolbarItem:e,key:e};let s=e.toolbarItem,i=e.toolbarItemParams,r,n,o,a;return s==null?({label:r,tooltip:n,icon:o,action:a}=e,(a!=null||r!=null||o!=null)&&(s="agButtonToolbarItem",i=void 0)):s==="agMenuToolbarItem"&&({label:r,tooltip:n,icon:o}=e),{toolbarItem:s,toolbarItemParams:i,alignment:e.alignment,key:e.key??t(),label:r,tooltip:n,icon:o,action:a}}var Y3={name:"toolbarItem",optionalMethods:["refresh"]},q3={tag:"div",cls:"ag-toolbar",role:"toolbar"},X3=class extends ox{constructor(){super(q3),this.toolbarItems=new Map,this.nextKey=0,this.generation=0,this.registerCSS(K3)}postConstruct(){const e=this.getGui();this.beans.toolbar.setToolbar(this),this.processToolbarItems(),this.addManagedPropertyListeners(["toolbar"],this.updateToolbar.bind(this)),this.createManagedBean(new H3(e,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),this.addManagedElementListeners(e,{focusin:this.ensureFocusedItemVisible.bind(this)}),U3(this.beans,this,e)}ensureFocusedItemVisible(e){const t=this.getGui(),s=e.target;!s||!t.contains(s)||s===t||B3(s)}getFocusableContainerName(){return"toolbar"}getToolbarItemInstance(e){const t=this.toolbarItems.get(e);if(t)return $3(t)}onTabKeyDown(e){}handleKeyDown(e){const t=N3(this.beans);if(t instanceof HTMLInputElement)return;const{key:s}=e;if(s!==Bt.LEFT&&s!==Bt.RIGHT&&s!==Bt.PAGE_HOME&&s!==Bt.PAGE_END)return;const i=O3(this.getGui()),r=i.indexOf(t);if(r===-1)return;const n=this.gos.get("enableRtl");let o;switch(s){case Bt.LEFT:o=n?r+1:r-1;break;case Bt.RIGHT:o=n?r-1:r+1;break;case Bt.PAGE_HOME:o=0;break;case Bt.PAGE_END:o=i.length-1;break}o=W3(o,0,i.length-1),o!==r&&(i[o].focus(),e.preventDefault())}getValidItems(e){if(!e?.items)return;this.nextKey=0;const t=()=>`toolbar-item-${this.nextKey++}`;return e.items.map(s=>j3(s,t))}createItemParams(e,t){const{toolbarItem:s,...i}=e;return z3(this.gos,{...i,key:t})}processToolbarItems(){const e=this.gos.get("toolbar"),t=this.getValidItems(e),s=Array.isArray(t)&&t.length>0;if(this.setDisplayed(s),!s)return;const i=[],r=[],n=e?.alignment??"left";let o=n;for(const l of t){const c=l.toolbarItem==="separator",u=l.alignment??(c?o:n);(u==="right"?r:i).push(l),c||(o=u)}const a=++this.generation;this.createAndRenderComponents([...i,...r],i.length,a)}updateToolbar(){this.generation++,G3(this.getGui()),this.destroyToolbarItems(),this.processToolbarItems()}destroy(){this.generation++,this.destroyToolbarItems(),this.beans.toolbar?.clearToolbar(this),super.destroy()}destroyToolbarItems(){for(const e of this.toolbarItems.values())this.destroyBean(e);this.toolbarItems.clear()}createSeparator(){return Sn({tag:"div",cls:"ag-toolbar-separator",attrs:{role:"separator"}})}createAndRenderComponents(e,t,s){const i=this.getGui(),r=t<e.length;for(let n=0;n<e.length;n++){r&&n===t&&i.appendChild(Sn({tag:"div",cls:"ag-toolbar-right-start"}));const o=e[n];if(o.toolbarItem==="separator"){i.appendChild(this.createSeparator());continue}const{key:a}=o;if(o.toolbarItem==null){this.beans.log.error(301,{key:a});continue}const l=Sn({tag:"div"});i.appendChild(l);const c=this.beans.userCompFactory.getCompDetails(o,Y3,void 0,this.createItemParams(o,a),!0);if(c==null){Cn(l);continue}c.newAgStackInstance().then(u=>this.mountComponent(a,u,l,s))}}mountComponent(e,t,s,i){if(i!==this.generation){Cn(s),t!=null&&this.destroyBean(t);return}if(t==null){Cn(s);return}const r=this.toolbarItems.has(e);if(r||!this.isAlive()||s.parentNode!==this.getGui()){Cn(s),this.destroyBean(t),r&&this.beans.log.warn(303,{key:e});return}this.toolbarItems.set(e,t);const n=t.getGui();if("agToolbarButton"in t){const o=Sn({tag:"div",cls:"ag-toolbar-button-wrapper"});o.appendChild(n),s.replaceWith(o)}else s.replaceWith(n)}},Z3={selector:"AG-TOOLBAR",component:X3};import{RefPlaceholder as bg}from"ag-stack";import{Component as J3,_addGridCommonParams as Q3}from"ag-grid-community";import{FAST_TEST_TIMINGS as eH,_addOrRemoveAttribute as tH,_clearElement as sH,_setAriaLabel as iH,_setDisabled as rH,_setDisplayed as yg}from"ag-stack";import{_createElement as wg,_createIconNoSpan as hl}from"ag-grid-community";var xg=eH?0:300;function Fg(e,t,{label:s,iconName:i,initialValue:r}){const n=hl(i,e);let o;n&&(o=wg({tag:"span",cls:"ag-toolbar-input-icon",attrs:{"aria-hidden":"true"}}),o.appendChild(n)),t.setInputPlaceholder(`${s}...`).setInputAriaLabel(s).setValue(r,!0),t.addCss("ag-toolbar-input-widget");const a=t.getInputElement();return a.classList.add("ag-toolbar-input-field"),{eIconWrapper:o,eInput:a}}function Tg(e,{iconName:t,label:s,cls:i,disabled:r}){const n=wg({tag:"button",cls:i?`ag-toolbar-button ${i}`:"ag-toolbar-button",attrs:{type:"button","aria-label":s,title:s}});r&&rH(n,!0);const o=hl(t,e);return o&&n.appendChild(o),n}function Ag(e,{eIcon:t,eLabel:s,eGui:i,icon:r,label:n,hoverText:o}){if(sH(t),r){const l=hl(r,e);l&&t.appendChild(l)}yg(t,!!r);const a=!!n;s.textContent=n??"",yg(s,a),iH(i,o),tH(i,"title",o)}function Pg(e,t){const s=e.rowGroupPanelBuilder;return s||e.log.error(302,{itemName:t,moduleName:"RowGroupingPanel",...e.gos.getModuleErrorParams()}),s}var nH={tag:"button",cls:"ag-toolbar-item ag-toolbar-button",attrs:{type:"button"},children:[{tag:"span",ref:"eIcon",cls:"ag-toolbar-button-icon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-toolbar-button-label"}]},oH=class extends ax{constructor(){super(nH),this.agToolbarButton="agToolbarButton",this.eIcon=bg,this.eLabel=bg}init(e){this.applyParams(e),this.addManagedElementListeners(this.getGui(),{click:()=>this.invokeAction()})}refresh(e){return this.applyParams(e),!0}applyParams(e){this.params=e,Ag(this.beans,{eIcon:this.eIcon,eLabel:this.eLabel,eGui:this.getGui(),icon:e.icon,label:e.label,hoverText:e.tooltip??e.label})}invokeAction(){const{action:e,key:t}=this.params;if(!e)return;const s=Q3(this.gos,{key:t});e(s)}};import{_debounce as aH,_setDisabled as Rg}from"ag-stack";import{AgInputTextField as lH,Component as cH,_createElement as uH}from"ag-grid-community";var dH=0;function hH(e){return uH({tag:"label",cls:"ag-toolbar-find-match-count",attrs:{"aria-live":"polite",for:e}})}var pH=class extends lx{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-input ag-toolbar-find"})}init(e){if(!this.gos.isModuleRegistered("Find")){this.beans.log.error(302,{itemName:"agFindToolbarItem",moduleName:"Find",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const t=this.getLocaleTextFunc(),s=t("toolbarFind","Find"),i=this.getGui();let r;const n=()=>this.gos.updateGridOptions({options:{findSearchValue:this.eInput.value}});this.eInputField=this.createManagedBean(new lH({clearButton:!0,autoComplete:e.toolbarItemParams?.browserAutoComplete,onValueClear:()=>{clearTimeout(r),n()}}));const{eIconWrapper:o,eInput:a}=Fg(this.beans,this.eInputField,{label:s,iconName:"search",initialValue:this.gos.get("findSearchValue")}),l=`ag-toolbar-find-input-${++dH}`;a.id=l,o&&i.appendChild(o),this.eInput=a,i.appendChild(this.eInputField.getGui()),this.eMatchCount=hH(l),i.appendChild(this.eMatchCount),this.ePrevButton=Tg(this.beans,{iconName:"previous",label:t("toolbarFindPreviousMatch","Previous Match"),cls:"ag-toolbar-find-button",disabled:!0}),i.appendChild(this.ePrevButton),this.eNextButton=Tg(this.beans,{iconName:"next",label:t("toolbarFindNextMatch","Next Match"),cls:"ag-toolbar-find-button",disabled:!0}),i.appendChild(this.eNextButton);const c=aH(this,n,xg);this.addManagedElementListeners(this.eInput,{input:()=>r=c(),keydown:u=>{u.key==="Enter"&&(u.preventDefault(),n(),u.shiftKey?this.beans.findSvc?.previous():this.beans.findSvc?.next())}}),this.addManagedElementListeners(this.ePrevButton,{click:()=>this.beans.findSvc?.previous()}),this.addManagedElementListeners(this.eNextButton,{click:()=>this.beans.findSvc?.next()}),this.addManagedEventListeners({findChanged:u=>this.onFindChanged(u)}),this.addManagedPropertyListener("findSearchValue",({currentValue:u})=>{clearTimeout(r),this.eInputField.setValue(u??"",!0)}),this.syncMatchState()}refresh(e){return this.eInput?(this.eInputField.setAutoComplete(e.toolbarItemParams?.browserAutoComplete),this.eInputField.setValue(this.gos.get("findSearchValue"),!0),this.syncMatchState(),!0):!1}onFindChanged(e){this.updateMatchDisplay(e.findSearchValue,e.activeMatch?.numOverall??0,e.totalMatches)}syncMatchState(){const e=this.beans.findSvc,t=this.gos.get("findSearchValue"),s=e?.activeMatch?.numOverall??0,i=e?.totalMatches??0;this.updateMatchDisplay(t,s,i)}updateMatchDisplay(e,t,s){const i=!!e?.length;this.eMatchCount.textContent=i?`${t}/${s}`:"";const r=s>0;Rg(this.ePrevButton,!r),Rg(this.eNextButton,!r)}};import{RefPlaceholder as pl,_removeAriaExpanded as gH,_setAriaExpanded as gl,_setAriaHasPopup as fH,_setDisabled as mH,_setDisplayed as vH}from"ag-stack";import{Component as CH,_createIconNoSpan as SH}from"ag-grid-community";var bH={tag:"button",cls:"ag-toolbar-item ag-toolbar-button",attrs:{type:"button"},children:[{tag:"span",ref:"eIcon",cls:"ag-toolbar-button-icon",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-toolbar-button-label"},{tag:"span",ref:"eChevron",cls:"ag-toolbar-button-chevron",attrs:{"aria-hidden":"true"}}]},yH=class extends cx{constructor(){super(bH),this.agToolbarButton="agToolbarButton",this.eIcon=pl,this.eLabel=pl,this.eChevron=pl}init(e){const t=SH("selectOpen",this.beans);t&&this.eChevron.appendChild(t),this.beans.gos.assertModuleRegistered(["ContextMenu","ColumnMenu"],"AG Grid toolbar item: `agMenuToolbarItem`"),this.applyParams(e),this.addManagedElementListeners(this.getGui(),{click:()=>this.showMenu()})}refresh(e){return this.applyParams(e),!0}getAccessibleName(){const{tooltip:e,label:t}=this.params;return e??t??this.getLocaleTextFunc()("toolbarMenu","Menu")}applyParams(e){this.params=e;const t=this.getGui();Ag(this.beans,{eIcon:this.eIcon,eLabel:this.eLabel,eGui:t,icon:e.icon??"menu",label:e.label,hoverText:this.getAccessibleName()});const i=!!e.toolbarItemParams?.menuItems?.length;vH(this.eChevron,i),mH(t,!i),fH(t,i?"menu":!1),i?gl(t,!1):gH(t)}showMenu(){const e=this.params.toolbarItemParams?.menuItems;if(!e?.length)return;const t=this.beans.toolbarMenuBuilder;if(!t)return;const s=this.getGui();gl(s,!0),t.showMenu({anchorElement:s,menuItems:e,ariaLabel:this.getAccessibleName(),onClose:()=>{this.isAlive()&&(gl(s,!1),s.focus())}})}};import{Component as wH}from"ag-grid-community";var xH=class extends ux{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-panel"})}init(e){if(!this.gos.isModuleRegistered("Pivot")){this.beans.log.error(302,{itemName:"agPivotPanelToolbarItem",moduleName:"Pivot",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const t=Pg(this.beans,"agPivotPanelToolbarItem");if(!t){this.setDisplayed(!1);return}const s=this.createManagedBean(t.createPivotDropZone(!0,!0));this.getGui().appendChild(s.getGui()),s.setDisplayed(!0),this.addManagedListeners(s,{displayChanged:()=>s.setDisplayed(!0)}),this.setDisplayed(this.beans.colModel.pivotMode),this.addManagedEventListeners({columnPivotModeChanged:()=>this.setDisplayed(this.beans.colModel.pivotMode)})}refresh(e){return!0}};import{_debounce as FH}from"ag-stack";import{AgInputTextField as TH,Component as AH}from"ag-grid-community";var PH=class extends dx{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-input"})}init(e){if(!this.gos.isModuleRegistered("QuickFilter")){this.beans.log.error(302,{itemName:"agQuickFilterToolbarItem",moduleName:"QuickFilter",...this.gos.getModuleErrorParams()}),this.setDisplayed(!1);return}const s=this.getLocaleTextFunc()("toolbarQuickFilter","Filter"),i=this.getGui();let r;const n=u=>this.gos.updateGridOptions({options:{quickFilterText:u}});this.eInputField=this.createManagedBean(new TH({clearButton:!0,autoComplete:e.toolbarItemParams?.browserAutoComplete,onValueClear:()=>{clearTimeout(r),n("")}}));const{eIconWrapper:o,eInput:a}=Fg(this.beans,this.eInputField,{label:s,iconName:"filter",initialValue:this.gos.get("quickFilterText")});o&&i.appendChild(o),this.eInput=a,i.appendChild(this.eInputField.getGui());const l=FH(this,()=>n(this.eInput.value),xg);this.addManagedElementListeners(this.eInput,{input:()=>r=l()});const c=u=>{clearTimeout(r),this.eInputField.setValue(u??"",!0)};this.addManagedPropertyListener("quickFilterText",({currentValue:u})=>c(u))}refresh(e){return this.eInput?(this.eInputField.setAutoComplete(e.toolbarItemParams?.browserAutoComplete),this.eInputField.setValue(this.gos.get("quickFilterText"),!0),!0):!1}};import{Component as RH}from"ag-grid-community";var MH=class extends hx{constructor(){super({tag:"div",cls:"ag-toolbar-item ag-toolbar-panel"})}init(e){const t=Pg(this.beans,"agRowGroupPanelToolbarItem");if(!t){this.setDisplayed(!1);return}const s=this.createManagedBean(t.createRowGroupDropZone(!0,!0));this.getGui().appendChild(s.getGui())}refresh(e){return!0}};import{_unwrapUserComp as IH}from"ag-grid-community";function EH(e,t){const s=e.toolbar?.getToolbarItemInstance(t);return IH(s)}import{BeanStub as DH}from"ag-grid-community";var LH=class extends px{constructor(){super(...arguments),this.beanName="toolbar"}setToolbar(e){this.comp=e}clearToolbar(e){this.comp===e&&(this.comp=void 0)}getToolbarItemInstance(e){return this.comp?.getToolbarItemInstance(e)}hasItem(e){return!!this.gos.get("toolbar")?.items?.some(t=>t===e||typeof t=="object"&&t.toolbarItem===e)}},Mg={moduleName:"Toolbar",version:G,beans:[LH],userComponents:{agButtonToolbarItem:oH,agFindToolbarItem:pH,agMenuToolbarItem:yH,agPivotPanelToolbarItem:xH,agQuickFilterToolbarItem:PH,agRowGroupPanelToolbarItem:MH},icons:{filter:"filter"},selectors:[Z3],apiFunctions:{getToolbarItemInstance:EH},dependsOn:[$]};import{_SharedExportModule as kH}from"ag-grid-community";function Ig(e){return e.excelCreator?.getFactoryMode()==="MULTI_SHEET"?(e.log.warn(161),!1):!0}function _H(e,t){if(Ig(e))return e.excelCreator?.getDataAsExcel(t)}function GH(e,t){Ig(e)&&e.excelCreator?.exportDataAsExcel(t)}function OH(e,t){return e.excelCreator?.setFactoryMode("MULTI_SHEET"),e.excelCreator?.getSheetDataForExcel(t)}function NH(e,t){return e.excelCreator?.getMultipleSheetsAsExcel(t)}function BH(e,t){e.excelCreator?.exportMultipleSheetsAsExcel(t)}var Eg={moduleName:"ExcelExport",version:G,beans:[jM],apiFunctions:{getDataAsExcel:_H,exportDataAsExcel:GH,getSheetDataForExcel:OH,getMultipleSheetsAsExcel:NH,exportMultipleSheetsAsExcel:BH},dependsOn:[kH,$]};import{_SharedExportModule as VH}from"ag-grid-community";import{_downloadFile as HH}from"ag-stack";import{BaseCreator as UH}from"ag-grid-community";import{BaseGridSerializingSession as zH,_addGridCommonParams as Ni,_isFullWidthGroupRow as WH}from"ag-grid-community";function X(e,t,s=0){return e!=null&&Number.isFinite(e)&&e>=s?e:t}function Dg(e,t=0){return e!=null&&Number.isFinite(e)&&e>=t?e:void 0}var fl={A4:{width:595.28,height:841.89},Letter:{width:612,height:792}},Lg="A4",$H="landscape",Bi=36;function KH(e,t){let s;if(typeof e=="string"||e==null){const a=typeof e=="string"&&e in fl?e:Lg;s=fl[a]}else s=kg(e.width)&&kg(e.height)?e:fl[Lg];let{width:i,height:r}=s;const n=t==="portrait"||t==="landscape"?t:$H;return(n==="landscape"&&i<r||n==="portrait"&&i>r)&&([i,r]=[r,i]),{width:i,height:r}}function kg(e){return Number.isFinite(e)&&e>0}function jH(e){if(typeof e=="number"){const s=X(e,Bi);return{top:s,right:s,bottom:s,left:s}}const t=e??{};return{top:X(t.top,Bi),right:X(t.right,Bi),bottom:X(t.bottom,Bi),left:X(t.left,Bi)}}function YH(e){let t=0;for(const s of e){let i=0;for(const r of s.cells)i+=1+Math.floor(X(r.mergeAcross,0));t=Math.max(t,i)}return t}function qH(e,t,s){const i=[];for(let r=0;r<t;r++){const n=e[r]??null,o=n?.colKind==="row-number"?"auto":"grid";i.push(typeof s=="function"?s({column:n,index:r})??o:s??o)}return i}function XH(e){return e==="auto"?!0:e==="grid"?!1:!(Number.isFinite(e)&&e>=Number.EPSILON)}function ZH(e,t,s,i,r){if(!t)return[];const n=X(s,0),o=[],a=_g(e,t);for(let d=0;d<t;d++){const h=a[d],p=X(r?.[d],h,Number.EPSILON);o.push(JH(i[d]??"grid",h,p))}let l=0;for(const d of o)l+=d;if(!n){const d=[];for(let h=0;h<t;h++)d.push(0);return d}const c=l>n?n/l:1,u=[];for(const d of o)u.push(d*c);return u}function _g(e,t){const s=[];for(let i=0;i<t;i++){const r=e[i];s.push(r?X(r.getActualWidth(),100,Number.EPSILON):100)}return s}function JH(e,t,s){return e==="grid"?t:e==="auto"?s:X(e,s,Number.EPSILON)}function QH(e){const t=[];for(const s of e){if(s.type==="BODY")break;(s.type==="HEADER"||s.type==="HEADER_GROUPING")&&t.push(s)}return t}function Gg(e,t,s){let i=0;for(let r=0;r<s;r++)i+=e[t+r]??0;return i}function ml(e){return e==="HEADER"||e==="HEADER_GROUPING"}import{_hasOwn as e5}from"ag-stack";var bn=32,Og=126,vl=500,t5=600,Ng={Helvetica:{ascent:718,descent:207},"Helvetica-Bold":{ascent:718,descent:207},"Times-Roman":{ascent:683,descent:217},"Times-Bold":{ascent:683,descent:217},Courier:{ascent:629,descent:157},"Courier-Bold":{ascent:629,descent:157}},s5=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],i5=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584],r5=[250,333,408,500,500,833,778,180,333,333,500,564,250,333,250,278,500,500,500,500,500,500,500,500,500,500,278,278,564,564,564,444,921,722,667,667,722,611,556,722,722,333,389,722,611,889,722,722,556,722,667,556,611,722,722,944,722,722,611,333,278,333,469,500,333,444,500,444,500,444,333,500,500,278,278,500,278,778,500,500,500,500,333,389,278,500,500,722,500,500,444,480,200,480,541],n5=[250,333,555,500,500,1e3,833,278,333,333,500,570,250,333,250,278,500,500,500,500,500,500,500,500,500,500,333,333,570,570,570,500,930,722,667,722,722,667,611,778,778,389,500,778,667,944,722,778,611,778,722,556,667,722,722,1e3,722,722,667,333,278,333,581,500,333,500,556,444,556,444,333,500,556,278,333,556,278,833,556,500,556,556,444,389,333,556,500,722,500,500,444,394,220,394,520],o5=new Map([[8364,[556,556,500,500]],[8218,[222,278,333,333]],[402,[556,556,500,500]],[8222,[333,500,444,500]],[8230,[1e3,1e3,1e3,1e3]],[8224,[556,556,500,500]],[8225,[556,556,500,500]],[710,[333,333,333,333]],[8240,[1e3,1e3,1e3,1e3]],[352,[667,667,556,556]],[8249,[333,333,333,333]],[338,[1e3,1e3,889,1e3]],[381,[611,611,611,667]],[8216,[222,278,333,333]],[8217,[222,278,333,333]],[8220,[333,500,444,500]],[8221,[333,500,444,500]],[8226,[350,350,350,350]],[8211,[556,556,500,500]],[8212,[1e3,1e3,1e3,1e3]],[732,[333,333,333,333]],[8482,[1e3,1e3,980,1e3]],[353,[500,556,389,389]],[8250,[333,333,333,333]],[339,[944,944,722,722]],[382,[500,500,444,444]],[376,[667,667,722,722]]]),a5={Helvetica:0,"Helvetica-Bold":1,"Times-Roman":2,"Times-Bold":3,Courier:0,"Courier-Bold":0},l5=new Map([["\xC6","W"],["\xE6","m"],["\xD0","D"],["\xF0","o"],["\xD8","O"],["\xF8","o"],["\xDE","P"],["\xFE","p"],["\xDF","b"],["\u0152","W"],["\u0153","w"]]);function yn(e,t){const s=Bg(t);if(s==="Courier"||s==="Courier-Bold")return t5;const i=u5(s),r=e.codePointAt(0)??0;if(r>=bn&&r<=Og)return i[r-bn]??vl;const n=o5.get(r);if(n)return n[a5[s]];const o=d5(e).codePointAt(0)??0;return o>=bn&&o<=Og?i[o-bn]??vl:vl}function c5(e,t){const s=Ng[Bg(t)];return s.ascent/(s.ascent+s.descent)*e}function u5(e){switch(e){case"Helvetica-Bold":return i5;case"Times-Roman":return r5;case"Times-Bold":return n5;default:return s5}}function Bg(e){return e5(Ng,e)?e:"Helvetica"}function d5(e){const t=l5.get(e);return t||(e.normalize("NFD")[0]??"?")}var h5=new Map([[8364,128],[8218,130],[402,131],[8222,132],[8230,133],[8224,134],[8225,135],[710,136],[8240,137],[352,138],[8249,139],[338,140],[381,142],[8216,145],[8217,146],[8220,147],[8221,148],[8226,149],[8211,150],[8212,151],[732,152],[8482,153],[353,154],[8250,155],[339,156],[382,158],[376,159]]);function wn(e,t=!0){let s=t?"FEFF":"";for(const i of e)s+=p5(i.codePointAt(0)??65533);return`<${s}>`}function p5(e){if(e<=65535)return e.toString(16).toUpperCase().padStart(4,"0");const t=e-65536,s=55296+(t>>>10),i=56320+(t&1023);return`${s.toString(16).toUpperCase().padStart(4,"0")}${i.toString(16).toUpperCase().padStart(4,"0")}`}function Cl(e,t=!1,s=!1){const i=e.replace(/\r\n?/g,`
`),r=t?i:i.replace(/\n/g," ");let n="";for(const o of r){if(o===`
`){n+=o;continue}const a=o.codePointAt(0)??0;n+=s||Hg(a)!=null?o:"?"}return n}function g5(e,t,s,i,r=!1,n){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return[];if(r)return f5(e,t,s,i,n);const o=[],a=e.split(`
`);for(const l of a){if(!l.trim()){o.push("");continue}const c=l.trim().split(/\s+/);let u="",d=0;const h=xt(" ",s,i,n);for(const p of c){const g=xt(p,s,i,n),f=u?d+h+g:g;if(f<=t){u=u?`${u} ${p}`:p,d=f;continue}u&&o.push(u);const m=S5(p,t,s,i,n),v=m.length-1;for(let C=0;C<v;C++)o.push(m[C]);u=m[v]??"",d=xt(u,s,i,n)}u&&o.push(u)}return o}function f5(e,t,s,i,r){const n=[];for(const o of e.split(`
`)){if(!o){n.push("");continue}const a=Array.from(o);let l=0;for(;l<a.length;){let c=0,u=-1,d=l;for(;d<a.length;){const h=a[d],p=c+xt(h,s,i,r);if(p>t)break;c=p,d+=1,h===" "&&(u=d)}if(d===a.length){n.push(a.slice(l).join(""));break}d===l?d+=1:u>l&&(d=u),n.push(a.slice(l,d).join("")),l=d}}return n}function Vi(e){let t="";for(const s of e){const i=s.codePointAt(0)??0,r=Hg(i)??63;r===40?t+="\\(":r===41?t+="\\)":r===92?t+="\\\\":r>=32&&r<=126?t+=String.fromCharCode(r):t+=`\\${r.toString(8).padStart(3,"0")}`}return t}function m5(e,t,s){if(!Number.isFinite(t)||t<=0)return 0;let i=0;for(const r of e)i+=yn(r,s);return i/1e3*t}function Vg(e,t,s,i,r){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return"";if(xt(e,s,i,r)<=t)return e;const n="...",o=xt(n,s,i,r),a=o<=t,l=a?t-o:t;let c="",u=0;for(const d of e){const h=xt(d,s,i,r);if(u+h>l)break;c+=d,u+=h}return a?`${c}${n}`:c}function v5(e,t,s,i,r){if(!e||!Number.isFinite(t)||t<=0||!Number.isFinite(s)||s<=0)return"";let n="",o=0;for(const a of e){const l=xt(a,s,i,r);if(o+l>t)break;n+=a,o+=l}return n}function C5(e,t,s,i,r){return Vg(`${e}...`,t,s,i,r)}function _(e){return Number.isFinite(e)?Number.isInteger(e)?e.toString():e.toFixed(2):"0"}function Hg(e){return e>=32&&e<=126||e>=160&&e<=255?e:h5.get(e)}function S5(e,t,s,i,r){const n=[];let o="",a=0;for(const l of e){const c=xt(l,s,i,r);o&&a+c>t&&(n.push(o),o="",a=0),o+=l,a+=c}return o&&n.push(o),n}function xt(e,t,s,i){return i?i(e):m5(e,t,s)}function b5(e,t){return`${e}:${t}`}var y5=new Map([[40,41],[41,40],[60,62],[62,60],[91,93],[93,91],[123,125],[125,123],[171,187],[187,171],[8249,8250],[8250,8249],[8261,8262],[8262,8261],[8317,8318],[8318,8317],[8333,8334],[8334,8333],[9001,9002],[9002,9001],[12296,12297],[12297,12296],[12298,12299],[12299,12298],[12300,12301],[12301,12300],[12302,12303],[12303,12302],[12304,12305],[12305,12304],[12308,12309],[12309,12308],[12310,12311],[12311,12310],[12312,12313],[12313,12312],[12314,12315],[12315,12314],[65113,65114],[65114,65113],[65115,65116],[65116,65115],[65117,65118],[65118,65117],[65288,65289],[65289,65288],[65308,65310],[65310,65308],[65339,65341],[65341,65339],[65371,65373],[65373,65371],[65375,65376],[65376,65375],[65378,65379],[65379,65378]]);function xn(e,t="auto"){const s=x5(e),i=t==="auto"?F5(s):t,r=i==="rtl"?1:0,n=T5(s,r),o=s.filter(u=>!$g(u.codePoint)),a=n.filter((u,d)=>!$g(s[d].codePoint));let l=r,c=Number.POSITIVE_INFINITY;for(const u of a)l=Math.max(l,u),u%2&&(c=Math.min(c,u));if(Number.isFinite(c))for(let u=l;u>=c;u--){let d=0;for(;d<o.length;){for(;d<o.length&&a[d]<u;)d++;let h=d;for(;h<o.length&&a[h]>=u;)h++;Kg(o,d,h),Kg(a,d,h),d=h}}w5(o,a);for(let u=0;u<o.length;u++){const d=o[u],h=a[u]%2===1;if(d.direction=h?"rtl":"ltr",h){const p=y5.get(d.codePoint);p!=null&&(d.codePoint=p,d.text=String.fromCodePoint(p))}}return{characters:o,direction:i}}function w5(e,t){let s=0;for(;s<e.length;){if(!Sl(e[s].codePoint)){s++;continue}const i=s;for(;s<e.length&&Sl(e[s].codePoint);)s++;if(s>=e.length)break;const r=e.splice(i,s-i).reverse(),n=t.splice(i,s-i).reverse();e.splice(i+1,0,...r),t.splice(i+1,0,...n),s=i+r.length+1}}function Ug(e,t="auto"){const s=xn(e,t);return{text:s.characters.map(i=>i.text).join(""),direction:s.direction}}function x5(e){const t=[];let s=0;for(const i of e)t.push({text:i,codePoint:i.codePointAt(0)??65533,sourceIndex:s,direction:"ltr"}),s+=i.length;return t}function F5(e){for(const t of e){const s=Wg(t.codePoint);if(s==="R"||s==="AL")return"rtl";if(s==="L")return"ltr"}return"ltr"}function T5(e,t){const s=e.map(r=>Wg(r.codePoint));let i=t?"R":"L";for(let r=0;r<s.length;r++){const n=s[r];n==="NSM"?s[r]=r?s[r-1]:i:n==="AL"?(s[r]="R",i="R"):(n==="L"||n==="R")&&(i=n)}for(let r=0;r<s.length;r++){if(s[r]!=="N")continue;const n=zg(s,r,-1)??(t?"R":"L"),o=zg(s,r,1)??(t?"R":"L");s[r]=n===o?n:t?"R":"L"}return s.map(r=>t===0?r==="R"?1:r==="EN"||r==="AN"?2:0:r==="L"||r==="EN"||r==="AN"?2:1)}function zg(e,t,s){for(let i=t+s;i>=0&&i<e.length;i+=s){const r=e[i];if(r==="L"||r==="R")return r;if(r==="EN"||r==="AN")return"L"}}function Wg(e){return Sl(e)?"NSM":e>=48&&e<=57?"EN":e>=1632&&e<=1641||e>=1776&&e<=1785?"AN":e>=1424&&e<=1535||e>=64285&&e<=64335?"R":e>=1536&&e<=2303||e>=64336&&e<=65023||e>=65136&&e<=65279?"AL":e>=65&&e<=90||e>=97&&e<=122||e>=192&&e<=687||e>=880&&e<=1327||e>=12352&&e<=12543||e>=13312&&e<=40959?"L":"N"}function Sl(e){return e>=768&&e<=879||e>=1425&&e<=1479||e>=1552&&e<=1562||e>=1611&&e<=1631||e===1648||e>=1750&&e<=1773}function $g(e){return e===1564||e===8206||e===8207||e>=8234&&e<=8238||e>=8294&&e<=8297}function Kg(e,t,s){for(let i=t,r=s-1;i<r;i++,r--){const n=e[i];e[i]=e[r],e[r]=n}}var A5=["isol","fina","medi","init"],jg=["ccmp","locl","rlig","calt","liga"],P5=["kern","curs","mark","mkmk"],R5=new Set(["ar","fa","ps","sd","ug","ur"]);function M5(e,t,s,i){const r=e.normalize("NFC"),n=G5(r),o=O5(n,i),a=xn(r,s),l=new Map;for(const p of a.characters)l.set(p.sourceIndex,p);let c=[];for(const p of n){const g=l.get(p.sourceIndex);if(!g)continue;const f=t.getGlyphId(g.codePoint);c.push({glyphId:f,codePoint:p.codePoint,cluster:p.sourceIndex,unicode:p.text,xAdvance:t.getAdvanceWidth(f),yAdvance:0,xOffset:0,yOffset:0})}const u=t.getTable("GSUB");if(u){for(const p of jg.slice(0,2))c=bl(u,c,o,i,p);if(o==="arab"){const p=N5(n);for(const g of A5)c=bl(u,c,o,i,g,f=>p.get(f.cluster)===g)}for(const p of jg.slice(2))c=bl(u,c,o,i,p)}for(const p of c)p.xAdvance=t.getAdvanceWidth(p.glyphId);const d=t.getTable("GPOS");if(d)for(const p of P5)c=I5(d,c,o,i,p);const h=new Map;for(let p=0;p<a.characters.length;p++)h.set(a.characters[p].sourceIndex,p);return c.sort((p,g)=>{const f=h.get(p.cluster)??p.cluster,m=h.get(g.cluster)??g.cluster;return f-m}),{direction:a.direction,glyphs:c.map(({codePoint:p,...g})=>g)}}function bl(e,t,s,i,r,n){const o=new cf(e),a=rf(o,s,i,r);if(!a.length)return t;const l=Yg(t);try{for(const c of a)t=qg(o,c,t,n);return t}catch{return l}}function I5(e,t,s,i,r){const n=new cf(e),o=rf(n,s,i,r);if(!o.length)return t;const a=Yg(t);try{return E5(n,o,a),a}catch{return t}}function Yg(e){return e.map(t=>({...t}))}function qg(e,t,s,i){const r=e.u16(t),n=e.u16(t+4);for(let o=0;o<n;o++){const a=t+e.u16(t+6+o*2);if(r===1)ef(e,a,s,i);else if(r===2)s=Qg(e,a,s,i);else if(r===4)s=tf(e,a,s,i);else if(r===5)s=Xg(e,a,s);else if(r===6)s=Zg(e,a,s);else if(r===7&&e.u16(a)===1){const l=e.u16(a+2),c=a+e.u32(a+4);l===1?ef(e,c,s,i):l===2?s=Qg(e,c,s,i):l===4?s=tf(e,c,s,i):l===5?s=Xg(e,c,s):l===6&&(s=Zg(e,c,s))}}return s}function Xg(e,t,s){if(e.u16(t)!==3)return s;const i=e.u16(t+2),r=e.u16(t+4),n=[];for(let a=0;a<i;a++)n.push(t+e.u16(t+6+a*2));const o=t+6+i*2;return Jg(e,s,n,[],[],o,r)}function Zg(e,t,s){if(e.u16(t)!==3)return s;let i=t+2;const r=e.u16(i);i+=2;const n=[];for(let d=0;d<r;d++,i+=2)n.push(t+e.u16(i));const o=e.u16(i);i+=2;const a=[];for(let d=0;d<o;d++,i+=2)a.push(t+e.u16(i));const l=e.u16(i);i+=2;const c=[];for(let d=0;d<l;d++,i+=2)c.push(t+e.u16(i));const u=e.u16(i);return Jg(e,s,a,n,c,i+2,u)}function Jg(e,t,s,i,r,n,o){const a=e.u16(8);for(let l=0;l+s.length<=t.length;l++)if(yl(e,t,l,s,1)&&yl(e,t,l-1,i,-1)&&yl(e,t,l+s.length,r,1))for(let c=0;c<o;c++){const u=n+c*4,d=e.u16(u),h=t[l+d];if(!h)continue;const p=e.u16(u+2),g=a+e.u16(a+2+p*2);t=qg(e,g,t,f=>f===h)}return t}function yl(e,t,s,i,r){for(let n=0;n<i.length;n++){const o=t[s+n*r];if(!o||Ze(e,i[n],o.glyphId)<0)return!1}return!0}function Qg(e,t,s,i){if(e.u16(t)!==1)return s;const r=t+e.u16(t+2),n=e.u16(t+4);for(let o=s.length-1;o>=0;o--){const a=s[o];if(i&&!i(a))continue;const l=Ze(e,r,a.glyphId);if(l<0||l>=n)continue;const c=t+e.u16(t+6+l*2),u=e.u16(c),d=[];for(let h=0;h<u;h++)d.push({...a,glyphId:e.u16(c+2+h*2),unicode:h?"":a.unicode});s.splice(o,1,...d)}return s}function ef(e,t,s,i){const r=e.u16(t),n=t+e.u16(t+2);for(const o of s){if(i&&!i(o))continue;const a=Ze(e,n,o.glyphId);a<0||(r===1?o.glyphId=o.glyphId+e.i16(t+4)&65535:r===2&&a<e.u16(t+4)&&(o.glyphId=e.u16(t+6+a*2)))}}function tf(e,t,s,i){if(e.u16(t)!==1)return s;const r=t+e.u16(t+2),n=e.u16(t+4);for(let o=0;o<s.length;o++){const a=s[o];if(i&&!i(a))continue;const l=Ze(e,r,a.glyphId);if(l<0||l>=n)continue;const c=t+e.u16(t+6+l*2),u=e.u16(c);for(let d=0;d<u;d++){const h=c+e.u16(c+2+d*2),p=e.u16(h+2);if(p<2||o+p>s.length)continue;let g=!0;for(let v=1;v<p;v++)if(s[o+v].glyphId!==e.u16(h+2+v*2)){g=!1;break}if(!g)continue;const f=s.slice(o,o+p),m=e.u16(h);s.splice(o,p,{...a,glyphId:m,unicode:f.map(v=>v.unicode).join(""),xAdvance:f.reduce((v,C)=>v+C.xAdvance,0)});break}}return s}function E5(e,t,s){for(const i of t){const r=e.u16(i),n=e.u16(i+2),o=e.u16(i+4);for(let a=0;a<o;a++){let l=i+e.u16(i+6+a*2),c=r;r===9&&e.u16(l)===1&&(c=e.u16(l+2),l+=e.u32(l+4)),c===2?_5(e,l,s):c===3?D5(e,l,s,(n&1)!==0):c===4?L5(e,l,s):c===6&&k5(e,l,s)}}}function D5(e,t,s,i){if(e.u16(t)!==1)return;const r=t+e.u16(t+2),n=e.u16(t+4);for(let o=0;o+1<s.length;o++){const a=Ze(e,r,s[o].glyphId),l=Ze(e,r,s[o+1].glyphId);if(a<0||l<0||a>=n||l>=n)continue;const c=t+6+a*4,u=t+6+l*4,d=e.u16(c+(i?0:2)),h=e.u16(u+(i?2:0));if(!d||!h)continue;const p=Es(e,t+d),g=Es(e,t+h);!p||!g||(s[o].xAdvance+=p.x-g.x,s[o+1].yOffset+=s[o].yOffset+p.y-g.y)}}function L5(e,t,s){if(e.u16(t)!==1)return;const i=t+e.u16(t+2),r=t+e.u16(t+4),n=e.u16(t+6),o=t+e.u16(t+8),a=t+e.u16(t+10);for(let l=1;l<s.length;l++){const c=Ze(e,i,s[l].glyphId);if(c<0||c>=e.u16(o))continue;let u=l-1,d=-1;for(;u>=0&&(d=Ze(e,r,s[u].glyphId),!(d>=0));)u--;if(d<0||d>=e.u16(a))continue;const h=o+2+c*4,p=e.u16(h);if(p>=n)continue;const g=Es(e,o+e.u16(h+2)),f=e.u16(a+2+(d*n+p)*2);if(!f||!g)continue;const m=Es(e,a+f);if(!m)continue;let v=0;for(let C=u;C<l;C++)v+=s[C].xAdvance;s[l].xOffset+=m.x-g.x-v,s[l].yOffset+=m.y-g.y,s[l].xAdvance=0}}function k5(e,t,s){if(e.u16(t)!==1)return;const i=t+e.u16(t+2),r=t+e.u16(t+4),n=e.u16(t+6),o=t+e.u16(t+8),a=t+e.u16(t+10);for(let l=1;l<s.length;l++){const c=Ze(e,i,s[l].glyphId),u=Ze(e,r,s[l-1].glyphId);if(c<0||u<0||c>=e.u16(o)||u>=e.u16(a))continue;const d=o+2+c*4,h=e.u16(d);if(h>=n)continue;const p=Es(e,o+e.u16(d+2)),g=e.u16(a+2+(u*n+h)*2);if(!p||!g)continue;const f=Es(e,a+g);f&&(s[l].xOffset+=s[l-1].xOffset+f.x-p.x,s[l].yOffset+=s[l-1].yOffset+f.y-p.y,s[l].xAdvance=0)}}function Es(e,t){const s=e.u16(t);if(!(s<1||s>3))return{x:e.i16(t+2),y:e.i16(t+4)}}function _5(e,t,s){const i=e.u16(t),r=t+e.u16(t+2),n=e.u16(t+4),o=e.u16(t+6),a=of(n),l=of(o);for(let c=0;c+1<s.length;c++){const u=s[c],d=s[c+1],h=Ze(e,r,u.glyphId);if(h<0)continue;let p=-1;if(i===1){const g=e.u16(t+8);if(h>=g)continue;const f=t+e.u16(t+10+h*2),m=e.u16(f),v=2+a+l;for(let C=0;C<m;C++){const S=f+2+C*v;if(e.u16(S)===d.glyphId){p=S+2;break}}}else if(i===2){const g=t+e.u16(t+8),f=t+e.u16(t+10),m=e.u16(t+12),v=e.u16(t+14),C=nf(e,g,u.glyphId),S=nf(e,f,d.glyphId);C<m&&S<v&&(p=t+16+(C*v+S)*(a+l))}p>=0&&(sf(e,p,n,u),sf(e,p+a,o,d))}}function sf(e,t,s,i){let r=t;s&1&&(i.xOffset+=e.i16(r),r+=2),s&2&&(i.yOffset+=e.i16(r),r+=2),s&4&&(i.xAdvance+=e.i16(r),r+=2),s&8&&(i.yAdvance+=e.i16(r))}function rf(e,t,s,i){try{const r=e.u16(4),n=e.u16(6),o=e.u16(8),a=wl(e,r,t)??wl(e,r,"DFLT");if(a==null)return[];const l=r+a,c=B5(s),u=(c?wl(e,l+4,c,e.u16(l+2)):void 0)??e.u16(l);if(!u)return[];const d=l+u,h=e.u16(d+4),p=e.u16(d+2),g=[];p!==65535&&g.push(p);for(let v=0;v<h;v++)g.push(e.u16(d+6+v*2));const f=[];for(const v of g){const C=n+2+v*6;if(e.tag(C)!==i)continue;const S=n+e.u16(C+4),w=e.u16(S+2);for(let b=0;b<w;b++)f.push(e.u16(S+4+b*2))}const m=[];for(const v of f)m.push(o+e.u16(o+2+v*2));return m}catch{return[]}}function wl(e,t,s,i){const r=i??e.u16(t),n=i==null?t+2:t;for(let o=0;o<r;o++){const a=n+o*6;if(e.tag(a)===s)return e.u16(a+4)}}function Ze(e,t,s){const i=e.u16(t);if(i===1){const r=e.u16(t+2);for(let n=0;n<r;n++)if(e.u16(t+4+n*2)===s)return n}else if(i===2){const r=e.u16(t+2);for(let n=0;n<r;n++){const o=t+4+n*6,a=e.u16(o),l=e.u16(o+2);if(s>=a&&s<=l)return e.u16(o+4)+s-a}}return-1}function nf(e,t,s){const i=e.u16(t);if(i===1){const r=e.u16(t+2),n=e.u16(t+4);return s>=r&&s<r+n?e.u16(t+6+(s-r)*2):0}if(i===2){const r=e.u16(t+2);for(let n=0;n<r;n++){const o=t+4+n*6;if(s>=e.u16(o)&&s<=e.u16(o+2))return e.u16(o+4)}}return 0}function of(e){let t=0;for(let s=0;s<8;s++)e&1<<s&&t++;return t*2}function G5(e){const t=[];let s=0;for(const i of e)t.push({text:i,codePoint:i.codePointAt(0)??65533,sourceIndex:s}),s+=i.length;return t}function O5(e,t){const s=t?.toLowerCase().split("-")[0];if(s==="ja")return"kana";if(s==="zh")return"hani";let i=!1;for(const r of e){const n=r.codePoint;if(n>=1536&&n<=2303)return"arab";if(n>=1424&&n<=1535)return"hebr";if(n>=880&&n<=1023)return"grek";if(n>=1024&&n<=1327)return"cyrl";if(n>=12352&&n<=12543)return"kana";if(n>=13312&&n<=40959)return"hani";(n>=65&&n<=90||n>=97&&n<=122||n>=192&&n<=687)&&(i=!0)}return!i&&s&&R5.has(s)?"arab":"latn"}function N5(e){const t=new Map;for(let s=0;s<e.length;s++){const i=lf(e[s].codePoint);if(i==="U"||i==="T")continue;const r=af(e,s,-1),n=af(e,s,1),o=(i==="D"||i==="R")&&r==="D",a=i==="D"&&(n==="D"||n==="R");t.set(e[s].sourceIndex,o&&a?"medi":o?"fina":a?"init":"isol")}return t}function af(e,t,s){for(let i=t+s;i>=0&&i<e.length;i+=s){const r=lf(e[i].codePoint);if(r!=="T")return r}}function lf(e){return e>=1552&&e<=1562||e>=1611&&e<=1631||e===1648||e>=1750&&e<=1773?"T":e===1570||e===1571||e===1572||e===1573||e===1575||e===1577||e>=1583&&e<=1586||e===1608||e===1609||e===1649||e===1688?"R":e>=1568&&e<=1747?"D":"U"}function B5(e){if(!e)return;const t=e.toLowerCase(),s=t.split("-")[0];return{ar:"ARA ",bg:"BGR ",el:"ELL ",fa:"FAR ",he:"IWR ",ja:"JAN ",ur:"URD ",zh:t.includes("-tw")||t.includes("-hk")||t.includes("-hant")?"ZHT ":"ZHS "}[s]}var cf=class{constructor(e){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength)}u16(e){return this.ensure(e,2),this.view.getUint16(e,!1)}i16(e){return this.ensure(e,2),this.view.getInt16(e,!1)}u32(e){return this.ensure(e,4),this.view.getUint32(e,!1)}tag(e){return this.ensure(e,4),String.fromCharCode(this.data[e],this.data[e+1],this.data[e+2],this.data[e+3])}ensure(e,t){if(e<0||e+t>this.data.length)throw new Error("Invalid OpenType layout offset.")}},V5=new Set(["OS/2","cmap","cvt ","fpgm","gasp","glyf","head","hhea","hmtx","loca","maxp","name","post","prep"]);function H5(e,t){const s=X5(e.data),i=new DataView(s.buffer,s.byteOffset,s.byteLength);ot(s,0,12,t);const r=xl(s,0);if(Je(i,0)!==65536&&r!=="true")throw new Error(`AG Grid: PDF font "${t}" must be a static TrueType TTF font.`);const n=Z5(s,i,t);if(n.has("CFF ")||n.has("CFF2"))throw new Error(`AG Grid: PDF font "${t}" uses unsupported CFF outlines.`);const o=cs(n,"head",t),a=cs(n,"hhea",t),l=cs(n,"maxp",t),c=cs(n,"hmtx",t),u=cs(n,"cmap",t),d=cs(n,"loca",t),h=cs(n,"glyf",t),p=n.get("OS/2"),g=n.get("post"),f=n.get("name");us(s,o,54,t,"head"),us(s,a,36,t,"hhea"),us(s,l,6,t,"maxp");const m=Q(i,o.offset+18);if(!m)throw new Error(`AG Grid: PDF font "${t}" has an invalid unitsPerEm value.`);const v=Q(i,l.offset+4),C=at(i,o.offset+50);if(C!==0&&C!==1)throw new Error(`AG Grid: PDF font "${t}" uses an invalid glyph location format.`);us(s,d,(v+1)*(C?4:2),t,"loca");const S=Q(i,a.offset+34);if(!v||!S||S>v)throw new Error(`AG Grid: PDF font "${t}" has invalid horizontal metrics.`);us(s,c,S*4+Math.max(v-S,0)*2,t,"hmtx");const w=s4(i,p,t),b=J5(s,i,u,t),y=t4(i,c.offset,v,S),T=at(i,a.offset+4),x=at(i,a.offset+6),F=[at(i,o.offset+36),at(i,o.offset+38),at(i,o.offset+40),at(i,o.offset+42)],A=p&&p.length>=8?Q(i,p.offset+4):a4(e.weight),P=p&&p.length>=90&&Q(i,p.offset)>=2?at(i,p.offset+88):T,D=g&&g.length>=8?l4(i,g.offset+4):0,N=o4(i4(s,i,f)||t),V=new Map;return{data:s,postScriptName:N,unitsPerEm:m,ascent:T,descent:x,capHeight:P,bbox:F,italicAngle:D,weight:A,style:e.style??(D?"italic":"normal"),canSubset:w,getTable:L=>{const O=n.get(L);return O?s.subarray(O.offset,O.offset+O.length):void 0},getGlyphId:L=>{const O=V.get(L);if(O!=null)return O;const K=b(L),H=K>=0&&K<v?K:0;return V.set(L,H),H},getAdvanceWidth:L=>y[L]??y[0]??m,createSubset:L=>w?U5(s,i,n,d,h,v,C,L,t):s}}function U5(e,t,s,i,r,n,o,a,l){const c=z5(t,i.offset,n,o);W5(c,r.length,l);const u=$5(t,r,c,n,a,l),d=new Map;for(const[C,S]of s)V5.has(C)&&d.set(C,e.slice(S.offset,S.offset+S.length));const h=[],p=[];for(let C=0;C<n;C++){if(p.push(h.length),!u.has(C))continue;const S=c[C],w=c[C+1];for(let b=S;b<w;b++)h.push(e[r.offset+b]);o===0&&h.length%2&&h.push(0)}p.push(h.length),d.set("glyf",new Uint8Array(h)),d.set("loca",K5(p,o));const g=d.get("head");Ds(new DataView(g.buffer,g.byteOffset,g.byteLength),8,0);const f=j5(d),m=new DataView(f.buffer,f.byteOffset,f.byteLength),v=Y5(f,m,"head");return Ds(m,v+8,2981146554-uf(f)>>>0),f}function z5(e,t,s,i){const r=[];for(let n=0;n<=s;n++)r.push(i===0?Q(e,t+n*2)*2:Je(e,t+n*4));return r}function W5(e,t,s){let i=e[0];if(i!==0)throw new Error(`AG Grid: PDF font "${s}" contains invalid glyph offsets.`);for(let r=0;r<e.length;r++){const n=e[r];if(n<i||n>t)throw new Error(`AG Grid: PDF font "${s}" contains invalid glyph offsets.`);i=n}}function $5(e,t,s,i,r,n){const o=new Set([0]),a=[];for(const l of r)Number.isInteger(l)&&l>=0&&l<i&&!o.has(l)&&(o.add(l),a.push(l));for(;a.length;){const l=a.pop(),c=s[l],u=s[l+1];if(c===u)continue;let d=t.offset+c;const h=t.offset+u;if(d+10>h||at(e,d)>=0)continue;d+=10;let p=!0;for(;p;){if(d+4>h)throw new Error(`AG Grid: PDF font "${n}" contains a truncated composite glyph.`);const g=Q(e,d),f=Q(e,d+2);if(f>=i)throw new Error(`AG Grid: PDF font "${n}" contains an invalid composite glyph reference.`);o.has(f)||(o.add(f),a.push(f)),d+=4,d+=(g&1)!==0?4:2,(g&8)!==0?d+=2:(g&64)!==0?d+=4:(g&128)!==0&&(d+=8),p=(g&32)!==0}}return o}function K5(e,t){const s=t===0?2:4,i=new Uint8Array(e.length*s),r=new DataView(i.buffer);for(let n=0;n<e.length;n++)t===0?r.setUint16(n*2,e[n]/2,!1):r.setUint32(n*4,e[n],!1);return i}function j5(e){const t=Array.from(e.entries()).sort(([d],[h])=>d.localeCompare(h)),s=t.length,i=2**Math.floor(Math.log2(s)),r=i*16,n=Math.log2(i),o=s*16-r;let a=12+s*16;for(const[,d]of t)a+=df(d.length);const l=new Uint8Array(a),c=new DataView(l.buffer);Ds(c,0,65536),c.setUint16(4,s,!1),c.setUint16(6,r,!1),c.setUint16(8,n,!1),c.setUint16(10,o,!1);let u=12+s*16;for(let d=0;d<t.length;d++){const[h,p]=t[d],g=12+d*16;q5(l,g,h),Ds(c,g+4,uf(p)),Ds(c,g+8,u),Ds(c,g+12,p.length),l.set(p,u),u+=df(p.length)}return l}function Y5(e,t,s){const i=Q(t,4);for(let r=0;r<i;r++){const n=12+r*16;if(xl(e,n)===s)return Je(t,n+8)}return 0}function uf(e){let t=0;for(let s=0;s<e.length;s+=4){const i=(e[s]??0)<<24|(e[s+1]??0)<<16|(e[s+2]??0)<<8|(e[s+3]??0);t=t+(i>>>0)>>>0}return t}function df(e){return e+3&-4}function q5(e,t,s){for(let i=0;i<4;i++)e[t+i]=s.charCodeAt(i)}function Ds(e,t,s){e.setUint32(t,s>>>0,!1)}function X5(e){return e instanceof Uint8Array?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):new Uint8Array(e)}function Z5(e,t,s){const i=Q(t,4);ot(e,12,i*16,s);const r=new Map;for(let n=0;n<i;n++){const o=12+n*16,a=xl(e,o),l=Je(t,o+8),c=Je(t,o+12);ot(e,l,c,s),r.set(a,{offset:l,length:c})}return r}function cs(e,t,s){const i=e.get(t);if(!i)throw new Error(`AG Grid: PDF font "${s}" is missing the required ${t} table.`);return i}function J5(e,t,s,i){us(e,s,4,i,"cmap");const r=Q(t,s.offset+2);us(e,s,4+r*8,i,"cmap");let n,o;for(let a=0;a<r;a++){const l=s.offset+4+a*8,c=Q(t,l),u=Q(t,l+2),d=s.offset+Je(t,l+4);ot(e,d,2,i);const h=Q(t,d),p=c===0||c===3&&(u===1||u===10);p&&h===12&&n==null?n=d:p&&h===4&&o==null&&(o=d)}if(n!=null)return Q5(e,t,n,i);if(o!=null)return e4(e,t,o,i);throw new Error(`AG Grid: PDF font "${i}" does not contain a supported Unicode cmap.`)}function Q5(e,t,s,i){ot(e,s,16,i);const r=Je(t,s+4),n=Je(t,s+12);return ot(e,s,r,i),ot(e,s+16,n*12,i),o=>{let a=0,l=n-1;for(;a<=l;){const c=a+l>>>1,u=s+16+c*12,d=Je(t,u),h=Je(t,u+4);if(o<d)l=c-1;else if(o>h)a=c+1;else return Je(t,u+8)+o-d}return 0}}function e4(e,t,s,i){ot(e,s,14,i);const r=Q(t,s+2);ot(e,s,r,i);const n=Q(t,s+6)/2,o=s+14,a=o+n*2+2,l=a+n*2,c=l+n*2;return u=>{if(u>65535)return 0;for(let d=0;d<n;d++){const h=Q(t,o+d*2);if(u>h)continue;const p=Q(t,a+d*2);if(u<p)return 0;const g=at(t,l+d*2),f=c+d*2,m=Q(t,f);if(!m)return u+g&65535;const v=f+m+(u-p)*2;if(v+2>s+r)return 0;const C=Q(t,v);return C?C+g&65535:0}return 0}}function t4(e,t,s,i){const r=[];let n=0;for(let o=0;o<s;o++)o<i&&(n=Q(e,t+o*4)),r.push(n);return r}function s4(e,t,s){if(!t||t.length<10)return!0;const i=Q(e,t.offset+8);if((i&2)!==0)throw new Error(`AG Grid: PDF font "${s}" does not permit embedding.`);if((i&512)!==0)throw new Error(`AG Grid: PDF font "${s}" only permits bitmap embedding.`);return(i&256)===0}function i4(e,t,s){if(!s||s.length<6)return;const i=Q(t,s.offset+2),r=s.offset+Q(t,s.offset+4);if(s.offset+6+i*12>s.offset+s.length)return;let n;for(let o=0;o<i;o++){const a=s.offset+6+o*12,l=Q(t,a);if(Q(t,a+6)!==6)continue;const u=Q(t,a+8),d=r+Q(t,a+10);if(d<s.offset||d+u>s.offset+s.length)continue;const h=l===0||l===3?r4(e,d,u):n4(e,d,u);if(l===3)return h;n??(n=h)}return n}function r4(e,t,s){let i="";const r=t+s-s%2;for(let n=t;n<r;n+=2)i+=String.fromCharCode(e[n]<<8|e[n+1]);return i}function n4(e,t,s){let i="";for(let r=t,n=t+s;r<n;r++)i+=String.fromCharCode(e[r]);return i}function o4(e){return e.replace(/[^A-Za-z0-9_.+-]/g,"")||"CustomFont"}function a4(e){return e==="bold"?700:e==="normal"||e==null?400:e}function us(e,t,s,i,r){if(s>t.length)throw new Error(`AG Grid: PDF font "${i}" has a truncated ${r} table.`);ot(e,t.offset,s,i)}function ot(e,t,s,i){if(!Number.isSafeInteger(t)||!Number.isSafeInteger(s)||t<0||s<0||t+s>e.length)throw new Error(`AG Grid: PDF font "${i}" contains invalid table offsets.`)}function xl(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function Q(e,t){return e.getUint16(t,!1)}function at(e,t){return e.getInt16(t,!1)}function Je(e,t){return e.getUint32(t,!1)}function l4(e,t){return e.getInt32(t,!1)/65536}var Fl=new Set(["Helvetica","Helvetica-Bold","Times-Roman","Times-Bold","Courier","Courier-Bold"]),c4=new Set(Array.from(Fl,e=>Fn(e))),hf=class extends Error{constructor(e,t){super(`PDF font family "${e}" is not registered.`),this.family=e,this.registeredFamilies=t,this.name="PdfFontFamilyNotRegisteredError"}},pf=class{constructor(e){this.customFamilies=new Map,this.resolvedFonts=new Map,this.shapedRuns=new Map,this.nextFontIndex=1;for(const t of e??[])this.registerFamily(t)}resolve(e,t,s,i="Helvetica"){const r=e||i,n=gf(t,mf(r)),o=s??"normal",a=this.customFamilies.get(Fn(r));if(a){const c=u4(a.faces,n,o);return this.getOrCreateCustomFont(a.family,c)}if(!Fl.has(r))throw new hf(r,this.getRegisteredFamilyNames());const l=d4(r,n);return this.getOrCreateBuiltInFont(l)}measureText(e,t,s,i="auto",r){let n=0;if(s.trueType){const l=this.getShapedRun(e,s,i,r);for(const c of l.glyphs){const u=this.getAsciiFallbackFont(c.glyphId,c.unicode,s);u?n+=yn(c.unicode,u.family)/1e3*t:n+=c.xAdvance/s.trueType.unitsPerEm*t}return n}const o=Ug(e,i).text,a=s.builtInFamily??"Helvetica";for(const l of o)n+=yn(l,a);return n/1e3*t}encodeText(e,t,s="auto",i){const r=Ug(e,s);if(!t.trueType)return{operatorValue:`(${Vi(r.text)})`,visualText:r.text,direction:r.direction,logicalText:e};const n=this.getShapedRun(e,t,s,i),o=[];let a="";for(const l of n.glyphs){const c=this.getAsciiFallbackFont(l.glyphId,l.unicode,t);if(c){o.push({fontKey:c.key,operatorValue:`(${Vi(l.unicode)})`,xAdvance:yn(l.unicode,c.family)/1e3,yAdvance:0,xOffset:0,yOffset:0});continue}const u=b5(l.glyphId,l.unicode);let d=t.cidByMapping.get(u);if(d==null){if(t.mappingByCid.size>=65535)throw new Error(`AG Grid: PDF font "${t.family}" exceeded the 65,535 character-code limit.`);d=t.mappingByCid.size+1,t.cidByMapping.set(u,d),t.mappingByCid.set(d,{glyphId:l.glyphId,unicode:l.unicode})}a+=d.toString(16).padStart(4,"0"),o.push({fontKey:t.key,operatorValue:`<${d.toString(16).padStart(4,"0")}>`,xAdvance:l.xAdvance/t.trueType.unitsPerEm,yAdvance:l.yAdvance/t.trueType.unitsPerEm,xOffset:l.xOffset/t.trueType.unitsPerEm,yOffset:l.yOffset/t.trueType.unitsPerEm})}return{operatorValue:`<${a}>`,visualText:n.glyphs.map(l=>l.unicode).join(""),direction:n.direction,logicalText:e,glyphRun:n,positionedGlyphs:o}}getBaselineOffset(e,t){return t.trueType?t.trueType.ascent/t.trueType.unitsPerEm*e:c5(e,t.builtInFamily??"Helvetica")}getNaturalLineHeight(e,t){if(!t.trueType)return e;const s=(t.trueType.ascent-t.trueType.descent)/t.trueType.unitsPerEm*e;return Math.max(e,s)}getUsedFonts(){return Array.from(this.resolvedFonts.values()).sort((e,t)=>Number(e.key.slice(1))-Number(t.key.slice(1)))}getShapedRun(e,t,s,i){const r=`${t.key}\0${s}\0${i??""}\0${e}`;let n=this.shapedRuns.get(r);return n||(n=M5(e,t.trueType,s,i),this.shapedRuns.set(r,n)),n}getAsciiFallbackFont(e,t,s){if(e||t.length!==1)return;const i=t.codePointAt(0)??0;if(!(i<32||i>126))return this.resolve("Helvetica",s.weight,"normal")}getRegisteredFamilyNames(){return[...Array.from(this.customFamilies.values(),e=>e.family),...Fl]}registerFamily(e){const t=e.family.trim();if(!t)throw new Error("AG Grid: PDF font families require a non-empty family name.");if(!e.faces?.length)throw new Error(`AG Grid: PDF font family "${t}" requires at least one face.`);const s=Fn(t);if(this.customFamilies.has(s)||c4.has(s))throw new Error(`AG Grid: PDF font family "${t}" is registered more than once or uses a reserved name.`);const i=[],r=new Set;for(const n of e.faces){const o=H5(n,t),a=gf(n.weight,o.weight),l=n.style??o.style,c=`${a}:${l}`;if(r.has(c))throw new Error(`AG Grid: PDF font family "${t}" contains duplicate ${a} ${l} faces.`);r.add(c),i.push({weight:a,style:l,font:o})}this.customFamilies.set(s,{family:t,faces:i})}getOrCreateCustomFont(e,t){const s=`${Fn(e)}:${t.weight}:${t.style}`,i=this.resolvedFonts.get(s);if(i)return i;const r={key:`F${this.nextFontIndex++}`,family:e,weight:t.weight,style:t.style,trueType:t.font,cidByMapping:new Map,mappingByCid:new Map};return this.resolvedFonts.set(s,r),r}getOrCreateBuiltInFont(e){const t=this.resolvedFonts.get(e);if(t)return t;const s={key:`F${this.nextFontIndex++}`,family:e,weight:mf(e),style:"normal",builtInFamily:e,cidByMapping:new Map,mappingByCid:new Map};return this.resolvedFonts.set(e,s),s}};function u4(e,t,s){let i=e.filter(o=>o.style===s);!i.length&&s==="oblique"&&(i=e.filter(o=>o.style==="italic")),i.length||(i=e.filter(o=>o.style==="normal")),i.length||(i=e);let r=i[0],n=Math.abs(r.weight-t);for(let o=1;o<i.length;o++){const a=i[o],l=Math.abs(a.weight-t);(l<n||l===n&&a.weight>r.weight)&&(r=a,n=l)}return r}function d4(e,t){const s=t>=600;return e==="Times-Roman"||e==="Times-Bold"?s?"Times-Bold":"Times-Roman":e==="Courier"||e==="Courier-Bold"?s?"Courier-Bold":"Courier":s?"Helvetica-Bold":"Helvetica"}function gf(e,t=400){return e==="bold"?700:e==="normal"||e==null?ff(t):ff(e)}function ff(e){return Number.isFinite(e)?Math.min(Math.max(Math.round(e/100)*100,100),900):400}function mf(e){return e.endsWith("-Bold")?700:400}function Fn(e){return e.trim().toLowerCase()}function Tn(e){const t=[];for(let i=0;i<e.length;i+=2048){const r=Math.min(i+2048,e.length);let n="";for(let o=i;o<r;o++)n+=e[o].toString(16).padStart(2,"0");t.push(n)}return`${t.join(`
`)}>`}function h4(e){const t=e.indexOf(","),s=t>=0?e.slice(t+1):e;let i;try{i=atob(s.replace(/\s/g,""))}catch{throw new Error("AG Grid: PDF image data is not valid base64.")}const r=new Uint8Array(i.length);for(let n=0;n<i.length;n++)r[n]=i.charCodeAt(n);return r}var p4=new Set([192,193,194]),g4=new Set([195,197,198,199,201,202,203,205,206,207]);function f4(e){if(e.length<4||e[0]!==255||e[1]!==216)throw new Error("AG Grid: PDF image is not a valid JPEG file.");let t=2;for(;t<e.length;){for(;t<e.length&&e[t]!==255;)t++;for(;t<e.length&&e[t]===255;)t++;if(t>=e.length)break;const s=e[t++];if(s===217||s===218)break;if(s===1||s>=208&&s<=215)continue;if(t+2>e.length)break;const i=Tl(e,t);if(i<2||t+i>e.length)throw new Error("AG Grid: PDF image contains an invalid JPEG segment.");if(g4.has(s))throw new Error("AG Grid: PDF Export supports baseline, extended and progressive JPEG images only.");if(p4.has(s)){if(i<8)throw new Error("AG Grid: PDF image contains an invalid JPEG frame.");const r=e[t+2],n=Tl(e,t+3),o=Tl(e,t+5),a=e[t+7];if(r!==8||!o||!n||a!==1&&a!==3)throw new Error("AG Grid: PDF Export supports 8-bit greyscale and RGB JPEG images.");return{width:o,height:n,colorSpace:a===1?"DeviceGray":"DeviceRGB",bitsPerComponent:r,data:e,filter:"DCTDecode"}}t+=i}throw new Error("AG Grid: PDF image does not contain a supported JPEG frame.")}function Tl(e,t){return e[t]<<8|e[t+1]}var m4=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],v4=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],C4=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0],vf=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],S4=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],b4=class{constructor(e){this.data=e,this.byteIndex=0,this.bitBuffer=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.byteIndex>=this.data.length)throw new Error("AG Grid: PDF PNG image compressed data ended unexpectedly.");this.bitBuffer|=this.data[this.byteIndex++]<<this.bitCount,this.bitCount+=8}const t=e===32?4294967295:(1<<e)-1,s=this.bitBuffer&t;return this.bitBuffer>>>=e,this.bitCount-=e,s}alignToByte(){this.bitBuffer=0,this.bitCount=0}},Hi=class{constructor(e){this.symbolsByCode=new Map;const t=new Array(16).fill(0);let s=0;for(const o of e){if(o<0||o>15)throw new Error("AG Grid: PDF PNG image contains an invalid Huffman code length.");o&&(t[o]+=1,s=Math.max(s,o))}if(!s)throw new Error("AG Grid: PDF PNG image Huffman table has no symbols.");let i=0;for(let o=1;o<=15;o++)i+=t[o]<<15-o;if(i>32768)throw new Error("AG Grid: PDF PNG image contains an over-subscribed Huffman table.");const r=new Array(16).fill(0);let n=0;for(let o=1;o<=15;o++)n=n+t[o-1]<<1,r[o]=n;for(let o=0;o<e.length;o++){const a=e[o];if(!a)continue;const l=A4(r[a]++,a);this.symbolsByCode.set(a<<16|l,o)}this.maximumLength=s}decode(e){let t=0;for(let s=1;s<=this.maximumLength;s++){t|=e.readBits(1)<<s-1;const i=this.symbolsByCode.get(s<<16|t);if(i!=null)return i}throw new Error("AG Grid: PDF PNG image contains an invalid Huffman code.")}},y4=class{constructor(e){this.position=0,this.bytes=new Uint8Array(e)}get length(){return this.position}push(e){this.ensureCapacity(1),this.bytes[this.position]=e,this.position+=1}copyBackReference(e,t){this.ensureCapacity(t);const s=this.bytes;for(let i=0;i<t;i++)s[this.position]=s[this.position-e],this.position+=1}ensureCapacity(e){if(this.position+e>this.bytes.length)throw new Error("AG Grid: PDF PNG image data exceeds its expected dimensions.")}toBytes(){return this.position===this.bytes.length?this.bytes:this.bytes.subarray(0,this.position)}};function w4(e,t){if(e.length<6)throw new Error("AG Grid: PDF PNG image data is not a valid zlib stream.");const s=e[0]&15,i=e[0]<<8|e[1];if(s!==8||i%31!==0||(e[1]&32)!==0)throw new Error("AG Grid: PDF PNG image uses an unsupported zlib stream.");const r=new b4(e.subarray(2,e.length-4)),n=new y4(t);let o=!1;for(;!o;){o=r.readBits(1)===1;const c=r.readBits(2);if(c===0)x4(r,n);else if(c===1){const u=F4();Cf(r,n,u.literalLength,u.distance)}else if(c===2){const u=T4(r);Cf(r,n,u.literalLength,u.distance)}else throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE block.")}const a=n.toBytes(),l=e[e.length-4]*16777216+e[e.length-3]*65536+e[e.length-2]*256+e[e.length-1];if(P4(a)!==l>>>0)throw new Error("AG Grid: PDF PNG image data failed its zlib checksum.");return a}function x4(e,t){e.alignToByte();const s=e.readBits(16),i=e.readBits(16);if((s^65535)!==i)throw new Error("AG Grid: PDF PNG image contains an invalid stored DEFLATE block.");t.ensureCapacity(s);for(let r=0;r<s;r++)t.push(e.readBits(8))}function Cf(e,t,s,i){for(;;){const r=s.decode(e);if(r<256)t.push(r);else{if(r===256)return;if(r<=285){const n=r-257,o=v4[n]+e.readBits(C4[n]);if(!i)throw new Error("AG Grid: PDF PNG image contains a length without a DEFLATE distance table.");const a=i.decode(e);if(a>=vf.length)throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE distance.");const l=vf[a]+e.readBits(S4[a]);if(l>t.length)throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE back-reference.");t.copyBackReference(l,o)}else throw new Error("AG Grid: PDF PNG image contains an invalid DEFLATE length.")}}}function F4(){const e=new Array(288);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return{literalLength:new Hi(e),distance:new Hi(new Array(32).fill(5))}}function T4(e){const t=e.readBits(5)+257,s=e.readBits(5)+1,i=e.readBits(4)+4,r=new Array(19).fill(0);for(let c=0;c<i;c++)r[m4[c]]=e.readBits(3);const n=new Hi(r),o=[],a=t+s;for(;o.length<a;){const c=n.decode(e);if(c<=15)o.push(c);else if(c===16){if(!o.length)throw new Error("AG Grid: PDF PNG image contains an invalid repeated Huffman length.");const u=e.readBits(2)+3,d=o[o.length-1];Al(o,d,u,a)}else if(c===17)Al(o,0,e.readBits(3)+3,a);else if(c===18)Al(o,0,e.readBits(7)+11,a);else throw new Error("AG Grid: PDF PNG image contains an invalid Huffman length.")}const l=o.slice(t);return{literalLength:new Hi(o.slice(0,t)),distance:l.some(c=>c>0)?new Hi(l):void 0}}function Al(e,t,s,i){if(e.length+s>i)throw new Error("AG Grid: PDF PNG image contains too many Huffman lengths.");for(let r=0;r<s;r++)e.push(t)}function A4(e,t){let s=0;for(let i=0;i<t;i++)s=s<<1|e&1,e>>>=1;return s}function P4(e){let t=1,s=0;for(const i of e)t=(t+i)%65521,s=(s+t)%65521;return(s<<16|t)>>>0}var An=[137,80,78,71,13,10,26,10],Sf=4e6;function R4(e){M4(e);let t,s,i;const r=[];let n=An.length;for(;n+12<=e.length;){const g=Pl(e,n),f=O4(e,n+4),m=n+8,v=m+g;if(v+4>e.length)throw new Error("AG Grid: PDF image contains a truncated PNG chunk.");const C=e.subarray(m,v);if(f==="IHDR")t=I4(C);else if(f==="PLTE")s=C;else if(f==="tRNS")i=C;else if(f==="IDAT")r.push(C);else if(f==="IEND")break;n=v+4}if(!t||!r.length)throw new Error("AG Grid: PDF image is missing required PNG data.");const o=G4(r),a=t.bitDepth*t.channels,l=Math.ceil(t.width*a/8),c=(l+1)*t.height,u=w4(o,c);if(u.length!==c)throw new Error("AG Grid: PDF image PNG data does not match its dimensions.");const d=Math.max(1,Math.ceil(a/8)),h=D4(u,l,t.height,d),p=L4(h,t);return k4(p,t,s,i)}function M4(e){if(e.length<An.length)throw new Error("AG Grid: PDF image is not a valid PNG file.");for(let t=0;t<An.length;t++)if(e[t]!==An[t])throw new Error("AG Grid: PDF image is not a valid PNG file.")}function I4(e){if(e.length!==13)throw new Error("AG Grid: PDF image contains an invalid PNG header.");const t=Pl(e,0),s=Pl(e,4),i=e[8],r=e[9],n=e[10],o=e[11],a=e[12],l=E4(r),u=i===8||r===3&&(i===1||i===2||i===4);if(t&&s&&s>Sf/t)throw new Error(`AG Grid: PDF PNG images are limited to ${Sf.toLocaleString("en-GB")} pixels.`);if(!t||!s||!u||n!==0||o!==0||a!==0||!l)throw new Error("AG Grid: PDF Export supports non-interlaced, 8-bit PNG images and 1-, 2-, or 4-bit indexed PNG images.");return{width:t,height:s,bitDepth:i,colorType:r,channels:l,colorSpace:r===0||r===4?"DeviceGray":"DeviceRGB"}}function E4(e){return e===0||e===3?1:e===2?3:e===4?2:e===6?4:0}function D4(e,t,s,i){const r=new Uint8Array(t*s);let n=0;for(let o=0;o<s;o++){const a=e[n++],l=o*t;for(let c=0;c<t;c++){const u=e[n++],d=c>=i?r[l+c-i]:0,h=o>0?r[l+c-t]:0,p=o>0&&c>=i?r[l+c-t-i]:0;let g;if(a===0)g=u;else if(a===1)g=u+d;else if(a===2)g=u+h;else if(a===3)g=u+Math.floor((d+h)/2);else if(a===4)g=u+_4(d,h,p);else throw new Error("AG Grid: PDF image uses an invalid PNG scanline filter.");r[l+c]=g&255}}return r}function L4(e,t){if(t.bitDepth===8)return e;const s=new Uint8Array(t.width*t.height),i=Math.ceil(t.width*t.bitDepth/8),r=8/t.bitDepth,n=(1<<t.bitDepth)-1;for(let o=0;o<t.height;o++){const a=o*i,l=o*t.width;for(let c=0;c<t.width;c++){const u=e[a+Math.floor(c/r)],d=8-t.bitDepth*(c%r+1);s[l+c]=u>>>d&n}}return s}function k4(e,t,s,i){const r=t.width*t.height,n=t.colorSpace==="DeviceGray"?1:3,o=new Uint8Array(r*n),a=new Uint8Array(r);a.fill(255);let l=!1;for(let c=0;c<r;c++){const u=c*t.channels,d=c*n;if(t.colorType===0){const h=e[u];o[d]=h;const p=i?.length===2?Pn(i,0):-1;h===p&&(a[c]=0,l=!0)}else if(t.colorType===2)o[d]=e[u],o[d+1]=e[u+1],o[d+2]=e[u+2],i?.length===6&&e[u]===Pn(i,0)&&e[u+1]===Pn(i,2)&&e[u+2]===Pn(i,4)&&(a[c]=0,l=!0);else if(t.colorType===3){const h=e[u],p=h*3;if(!s||p+2>=s.length)throw new Error("AG Grid: PDF image contains an invalid PNG palette index.");o[d]=s[p],o[d+1]=s[p+1],o[d+2]=s[p+2];const g=i?.[h]??255;a[c]=g,g!==255&&(l=!0)}else t.colorType===4?(o[d]=e[u],a[c]=e[u+1],a[c]!==255&&(l=!0)):(o[d]=e[u],o[d+1]=e[u+1],o[d+2]=e[u+2],a[c]=e[u+3],a[c]!==255&&(l=!0))}return{width:t.width,height:t.height,colorSpace:t.colorSpace,bitsPerComponent:8,data:o,alpha:l?a:void 0}}function _4(e,t,s){const i=e+t-s,r=Math.abs(i-e),n=Math.abs(i-t),o=Math.abs(i-s);return r<=n&&r<=o?e:n<=o?t:s}function G4(e){let t=0;for(const r of e)t+=r.length;const s=new Uint8Array(t);let i=0;for(const r of e)s.set(r,i),i+=r.length;return s}function O4(e,t){return String.fromCharCode(e[t],e[t+1],e[t+2],e[t+3])}function Pn(e,t){return e[t]<<8|e[t+1]}function Pl(e,t){return e[t]*16777216+e[t+1]*65536+e[t+2]*256+e[t+3]}var bf=72/96,N4=4,B4=class{constructor(){this.resourceById=new Map}resolve(e){const t=e.id.trim();if(!t)throw new Error("AG Grid: PDF images require a non-empty id.");let s=this.resourceById.get(t);s||(s={...V4(e),id:t,key:`Im${this.resourceById.size+1}`},this.resourceById.set(t,s));const i=s.width*bf,r=s.height*bf,n=wf(e.width),o=wf(e.height);let a=n??i,l=o??r;return n!=null&&o==null?l=n*(s.height/s.width):o!=null&&n==null&&(a=o*(s.width/s.height)),{resource:s,width:a,height:l,alignment:e.alignment??"start",gap:U4(e.gap),altText:e.altText}}getResources(){return Array.from(this.resourceById.values())}};function yf(e,t){if(e.width<=t||e.width<=0)return e;const s=Math.max(t,0)/e.width;return{...e,width:e.width*s,height:e.height*s}}function V4(e){const t=h4(e.base64),s=e.imageType.toLowerCase();if(H4(e,s),s==="png")return R4(t);if(s==="jpg"||s==="jpeg")return f4(t);throw new Error(`AG Grid: PDF Export does not support "${e.imageType}" images.`)}function H4(e,t){const s=/^data:image\/([a-z0-9.+-]+)[;,]/i.exec(e.base64)?.[1].toLowerCase();if(!s)return;if(s!==t&&!(s==="jpeg"&&(t==="jpg"||t==="jpeg")))throw new Error(`AG Grid: PDF image "${e.id}" is a "${s}" data URL but its imageType is "${e.imageType}".`)}function wf(e){return e!=null&&Number.isFinite(e)&&e>0?e:void 0}function U4(e){return e!=null&&Number.isFinite(e)?Math.max(e,0):N4}var Rl={r:255,g:255,b:255},ds={backgroundColor:"#ffffff",dataBackgroundColor:"#ffffff",oddRowBackgroundColor:"#ffffff",foregroundColor:"#000000",headerBackgroundColor:"#ffffff",headerTextColor:"#000000",borderColor:"#000000"};function z4(e){const t=e??{},s=hs(t.backgroundColor,ds.backgroundColor),i=t.dataBackgroundColor?hs(t.dataBackgroundColor,ds.dataBackgroundColor,s):s,r=t.oddRowBackgroundColor?hs(t.oddRowBackgroundColor,ds.oddRowBackgroundColor,i??s):i,n=hs(t.headerBackgroundColor,ds.headerBackgroundColor,s),o=hs(t.borderColor,ds.borderColor,s??i),a=hs(t.foregroundColor,ds.foregroundColor,i??s),l=hs(t.headerTextColor,ds.headerTextColor,n??s);return{pageBackground:s,dataBackground:i,oddRowBackground:r,headerBackground:n,border:o,foreground:a,headerText:l}}function xf(e,t,s){return e==="HEADER"||e==="HEADER_GROUPING"?{background:t.headerBackground,border:t.border,text:t.headerText??t.foreground}:e==="CUSTOM"?{background:t.dataBackground,border:t.border,text:t.foreground}:e==="BODY"?{background:s%2===1?t.oddRowBackground??t.dataBackground:t.dataBackground,border:t.border,text:t.foreground}:{background:t.dataBackground,border:t.border,text:t.foreground}}function Vt(e,t,s){if(!e)return t;const i=Rn(e);if(i!==null){if(!i)return t;if(!(i.a<=0))return i.a<1?Ll(i,s??Rl):Dl(i)}}function Ft(e){const t=(Il(e.r)/255).toFixed(3),s=(Il(e.g)/255).toFixed(3),i=(Il(e.b)/255).toFixed(3);return`${t} ${s} ${i}`}function W4(e){const t=Rn(e);return t===null?!0:!!t&&t.a<=0}function hs(e,t,s){if(e){const r=Rn(e);if(r===null||r&&r.a<=0)return;if(r&&r.a>0)return r.a<1?Ll(r,s??Rl):Dl(r)}const i=Rn(t);if(!(!i||i.a<=0))return i.a<1?Ll(i,s??Rl):Dl(i)}function Rn(e){const t=e.trim().toLowerCase();if(!t||t==="transparent"||t==="none")return null;const s=t.match(/^color\(\s*srgb\s+(.+)\)$/);if(s){const n=s[1].trim(),[o,a]=n.split("/").map(p=>p.trim()),l=o.split(/\s+/).filter(Boolean);if(l.length<3)return;const c=Mn(l[0],!0),u=Mn(l[1],!0),d=Mn(l[2],!0);if(c==null||u==null||d==null)return;const h=a?Ml(a):1;return{r:c,g:u,b:d,a:h??1}}if(t.startsWith("#")){const n=t.slice(1);if(!/^(?:[0-9a-f]{3,4}|[0-9a-f]{6}|[0-9a-f]{8})$/.test(n))return;if(n.length===3||n.length===4){const o=Number.parseInt(n[0]+n[0],16),a=Number.parseInt(n[1]+n[1],16),l=Number.parseInt(n[2]+n[2],16),c=n.length===4?Number.parseInt(n[3]+n[3],16)/255:1;return{r:o,g:a,b:l,a:c}}if(n.length===6||n.length===8){const o=Number.parseInt(n.slice(0,2),16),a=Number.parseInt(n.slice(2,4),16),l=Number.parseInt(n.slice(4,6),16),c=n.length===8?Number.parseInt(n.slice(6,8),16)/255:1;return{r:o,g:a,b:l,a:c}}return}const i=t.match(/^rgba?\((.+)\)$/);if(i){const n=i[1].trim();let o,a;if(n.includes(",")){const h=n.split(",").map(p=>p.trim());if(h.length<3)return;o=h.slice(0,3),a=h[3]}else{const[h,p]=n.split("/").map(g=>g.trim());if(o=h.split(/\s+/).filter(Boolean),a=p,o.length<3)return}const[l,c,u]=o.slice(0,3).map(h=>Mn(h,!1));if(l==null||c==null||u==null)return;const d=a?Ml(a):1;return{r:l,g:c,b:u,a:d??1}}const r=t.match(/^hsla?\((.+)\)$/);if(r){const n=r[1].trim();let o,a;if(n.includes(",")){const p=n.split(",").map(g=>g.trim());if(p.length<3)return;o=p.slice(0,3),a=p[3]}else{const[p,g]=n.split("/").map(f=>f.trim());if(o=p.split(/\s+/).filter(Boolean),a=g,o.length<3)return}const l=Number.parseFloat(o[0]),c=Ff(o[1]),u=Ff(o[2]);if(!Number.isFinite(l)||c==null||u==null)return;const d=$4(l,c,u),h=a?Ml(a):1;return{...d,a:h??1}}}function Mn(e,t){const s=e.trim(),i=s.endsWith("%"),r=Number.parseFloat(s);return Number.isFinite(r)?i?lt(r/100*255):t&&r>=0&&r<=1?lt(r*255):lt(r):null}function Ml(e){const t=e.trim(),s=t.endsWith("%"),i=Number.parseFloat(t);return Number.isFinite(i)?El(s?i/100:i):null}function Ff(e){const t=e.trim();if(!t.endsWith("%"))return null;const s=Number.parseFloat(t.slice(0,-1));return Number.isFinite(s)?Math.max(0,Math.min(1,s/100)):null}function $4(e,t,s){const i=(e%360+360)%360,r=(1-Math.abs(2*s-1))*t,n=r*(1-Math.abs(i/60%2-1)),o=s-r/2;let a=0,l=0,c=0;return i<60?(a=r,l=n):i<120?(a=n,l=r):i<180?(l=r,c=n):i<240?(l=n,c=r):i<300?(a=n,c=r):(a=r,c=n),{r:lt((a+o)*255),g:lt((l+o)*255),b:lt((c+o)*255)}}function lt(e){return Math.max(0,Math.min(255,Math.round(e)))}function Il(e){return Number.isFinite(e)?lt(e):0}function El(e){return Math.max(0,Math.min(1,e))}function Dl(e){return{r:e.r,g:e.g,b:e.b}}function Ll(e,t){const s=El(e.a);return{r:lt(e.r*s+t.r*(1-s)),g:lt(e.g*s+t.g*(1-s)),b:lt(e.b*s+t.b*(1-s))}}function we(e,t){if(!(!e&&!t))return{...e??{},...t??{}}}var K4={top:0,right:0,bottom:8,left:0},j4={top:6,right:6,bottom:6,left:6},Y4={top:0,right:0,bottom:12,left:0},q4={top:3,right:6,bottom:3,left:6},X4="center",Z4="left",J4={top:0,right:0,bottom:0,left:0},Tf="ellipsis",Q4=24;function Af(e,t,s,i,r,n,o,a){if(e)return{text:e,style:o6(t,s,i,r,n,o,a)}}function e6(e,t,s,i,r,n){const o=ml(e.type),a=xf(e.type,r,n),l=Gl(t),c=_f(o?i:s,l),u=o?t.headerFontSize:t.fontSize,d=o?t.defaultHeaderStyle:t.defaultCellStyle,h=_l(we(d,e.style),t,c,a,r,u),p=[];let g=0,f=If(e.type,t);for(const S of e.cells){const w=Math.min((S.mergeAcross??0)+1,t.columnCount-g);if(w<=0)break;const b=_l(we(d,we(e.style,S.style)),t,c,a,r,u);Df(S,b,t);const y=Gg(t.columnWidths,g,w),T=Math.max(y-b.padding.left-b.padding.right,0),x=S.image?yf(Ef(t).resolve(S.image),T):void 0,F=x?Mf(x,b,S.value):void 0,A=x?x.width+(S.value?x.gap:0):0,P=Math.max(T-A,0),D=kl(S.value,P,b),N=Math.max(D.length,1),L=Math.max(N*b.lineHeight,x?.height??0)+b.padding.top+b.padding.bottom,O=Math.max(Math.floor(S.mergeDown??0)+1,1),K=!!S.covered;!K&&O===1&&(f=Math.max(f,L)),p.push({columnIndex:g,span:w,width:y,style:b,lines:D,hyperlink:S.hyperlink,image:x,imageOnRight:F,rowSpan:O,requiredHeight:L,covered:K}),g+=w}const m=o?t.headerRowHeight:t.rowHeight,v=m!=null,C=m??f;return{type:e.type,defaultCellStyle:h,cells:p,rowHeight:C,minimumHeight:If(e.type,t),fixedHeight:v}}function t6(e){let t=!1;for(const s of e)for(const i of s.cells)if(!i.covered&&i.rowSpan>1){t=!0;break}if(!t)return!1;for(let s=0;s<e.length;s++){const i=e[s];if(i.spanned=!0,!i.fixedHeight)for(const r of i.cells){if(r.covered||r.rowSpan<=1)continue;const n=Math.min(s+r.rowSpan,e.length);let o=0;for(let a=s;a<n;a++)o+=e[a].rowHeight;if(o<r.requiredHeight){const a=(r.requiredHeight-o)/(n-s);for(let l=s;l<n;l++)e[l].rowHeight+=a}}}for(let s=0;s<e.length;s++)for(const i of e[s].cells){if(i.covered||i.rowSpan<=1)continue;const r=Math.min(s+i.rowSpan,e.length);let n=0;for(let o=s;o<r;o++)n+=e[o].rowHeight;i.renderHeight=n}return!0}function In(e,t,s){if(!Number.isFinite(s)||s<=0)return;if(e.fixedHeight||e.spanned){const h=Math.min(e.rowHeight,s);return{row:e,cells:e.cells.map(p=>({measurement:p,lines:n6(p,p.renderHeight??h),showImage:!!p.image})),height:h,complete:!0}}const i=t?.lineOffsets??e.cells.map(()=>0),r=t?.imageRendered??e.cells.map(()=>!1),n=Pf(e,i,r);if(n<=s)return{row:e,cells:e.cells.map((h,p)=>({measurement:h,lines:h.lines.slice(i[p]??0),showImage:!!h.image&&!r[p]})),height:n,complete:!0};const o=[...i],a=[...r],l=[];let c=Math.min(e.minimumHeight,s),u=!1;for(let h=0;h<e.cells.length;h++){const p=e.cells[h],g=i[h]??0,f=Math.max(p.lines.length-g,0),m=Math.max(s-p.style.padding.top-p.style.padding.bottom,0),v=Math.floor(m/p.style.lineHeight),C=Math.min(f,v),S=p.lines.slice(g,g+C),w=!!p.image&&!r[h];C>0&&(u=!0,o[h]=g+C,c=Math.max(c,p.style.padding.top+C*p.style.lineHeight+p.style.padding.bottom)),w&&(u=!0,a[h]=!0,c=Math.max(c,Math.min(p.style.padding.top+p.image.height+p.style.padding.bottom,s))),l.push({measurement:p,lines:S,showImage:w})}if(!u)return;const d=e.cells.every((h,p)=>(o[p]??0)>=h.lines.length&&(!h.image||a[p]));return{row:e,cells:l,height:c,complete:d,nextState:d?void 0:{lineOffsets:o,imageRendered:a}}}function s6(e,t,s){const i=t?.lineOffsets??e.cells.map(()=>0),r=t?.imageRendered??e.cells.map(()=>!1),n=Number.isFinite(s)?Math.max(s,0):0,o=[];for(let a=0,l=e.cells.length;a<l;a++){const c=e.cells[a],u=c.lines.slice(i[a]??0),d=Math.max(n-c.style.padding.top-c.style.padding.bottom,0),h=Math.max(Math.floor(d/c.style.lineHeight),1);o.push({measurement:c,lines:En(u,h,c.style,Rf(c)),showImage:!!c.image&&!r[a]})}return{row:e,cells:o,height:Math.min(Pf(e,i,r),Math.max(n,e.minimumHeight)),complete:!0}}function i6(e,t,s,i,r,n){const o=[];for(let l=0;l<t.columnCount;l++)o.push(Q4);let a=0;for(const l of e){if(l.type==="CUSTOM")continue;const c=ml(l.type),u=xf(l.type,r,a),d=Gl(t),h=_f(c?i:s,d),p=c?t.headerFontSize:t.fontSize,g=c?t.defaultHeaderStyle:t.defaultCellStyle;let f=0;for(const m of l.cells){const v=Math.min((m.mergeAcross??0)+1,t.columnCount-f);if(v<=0)break;if(!r6(n,f,v)){f+=v;continue}const C=_l(we(g,we(l.style,m.style)),t,h,u,r,p);Df(m,C,t);const S=m.image?Ef(t).resolve(m.image):void 0,w=a6(m.value??"",C),b=S?S.width+(m.value?S.gap:0):0,y=w+b+C.padding.left+C.padding.right,T=Gg(o,f,v);if(y>T){const x=(y-T)/v;for(let F=f;F<f+v;F++)o[F]+=x}f+=v}l.type==="BODY"&&(a+=1)}return o}function r6(e,t,s){for(let i=t,r=t+s;i<r;i++)if(e[i])return!0;return!1}function kl(e,t,s){const i=n=>s.fontRegistry.measureText(n,s.fontSize,s.font,s.direction,s.language);let r;if(s.wrapText)r=g5(Cl(e,s.preserveLineBreaks,!!s.font.trueType),t,s.fontSize,s.fontFamily,s.preserveSpaces,i);else{const n=Cl(e,s.preserveLineBreaks,!!s.font.trueType),o=s.preserveLineBreaks?n.split(`
`):[n];r=[];for(const a of o)r.push(s.overflow==="clip"?v5(a,t,s.fontSize,s.fontFamily,i):Vg(a,t,s.fontSize,s.fontFamily,i));!s.preserveLineBreaks&&!r[0]&&(r=[])}return En(r,s.maxLines,s,t)}function Pf(e,t,s){let i=e.minimumHeight;for(let r=0;r<e.cells.length;r++){const n=e.cells[r],o=Math.max(n.lines.length-(t[r]??0),0);o>0&&(i=Math.max(i,n.style.padding.top+o*n.style.lineHeight+n.style.padding.bottom)),n.image&&!s[r]&&(i=Math.max(i,n.style.padding.top+n.image.height+n.style.padding.bottom))}return i}function n6(e,t){const s=Math.max(t-e.style.padding.top-e.style.padding.bottom,0),i=Math.floor(s/e.style.lineHeight);return En(e.lines,i,e.style,Rf(e))}function Rf(e){const t=e.width-e.style.padding.left-e.style.padding.right,s=e.image?e.image.width+e.image.gap:0;return Math.max(t-s,0)}function En(e,t,s,i){if(t==null||e.length<=t)return e;if(t<=0)return[];const r=e.slice(0,t);if(s.overflow==="ellipsis"){const n=r.length-1;r[n]=C5(r[n],i,s.fontSize,s.fontFamily,o=>s.fontRegistry.measureText(o,s.fontSize,s.font,s.direction,s.language))}return r}function Mf(e,t,s){const i=t.direction==="auto"?xn(s,t.direction).direction:t.direction;return e.alignment==="end"?i==="ltr":i==="rtl"}function If(e,t){const s=ml(e),i=s?t.defaultHeaderStyle:t.defaultCellStyle,r=s?t.headerFontSize:t.fontSize,n=X(i?.lineHeight,r,Number.EPSILON),o=Dn(i?.padding,{top:t.cellPadding,right:t.cellPadding,bottom:t.cellPadding,left:t.cellPadding});return n+o.top+o.bottom}function Ef(e){if(!e.imageRegistry)throw new Error("AG Grid: PDF layout options are missing the document image registry.");return e.imageRegistry}function o6(e,t,s,i,r,n,o){const a=we(s.defaultCellStyle,s.defaultHeaderStyle),l=X(a?.fontSize,o,Number.EPSILON),c=t==="title"?Math.max(l+4,14):Math.max(l+1,11),u=X(e?.fontSize,c,Number.EPSILON),d=n.resolve(e?.fontFamily,e?.fontWeight??r.weight,e?.fontStyle??r.style,r.family),h=Dn(e?.padding,t==="title"?j4:q4),p=Dn(e?.margin,t==="title"?K4:Y4),g=i.pageBackground??i.dataBackground,f=(t==="title"?i.headerText??i.foreground:i.foreground)??{r:0,g:0,b:0},m=Vt(e?.borderColor,void 0,g);return{fontSize:u,fontFamily:d.family,fontWeight:d.weight,fontStyle:d.style,font:d,fontRegistry:n,direction:e?.direction??s.direction??"auto",language:e?.language??s.language,lineHeight:X(e?.lineHeight,n.getNaturalLineHeight(u,d),Number.EPSILON),maxLines:Lf(e?.maxLines),overflow:e?.overflow??Tf,alignment:e?.alignment??X4,alignmentExplicit:e?.alignment!=null,padding:h,margin:p,textColor:Vt(e?.color,f,g)??f,backgroundColor:Vt(e?.backgroundColor,void 0,g),borderColor:m,borderWidth:kf(e?.borderWidth,m),wrapText:e?.wrapText??!1,preserveLineBreaks:e?.preserveLineBreaks??e?.wrapText??!1,preserveSpaces:e?.preserveSpaces??!1}}function _l(e,t,s,i,r,n){const o=Dn(e?.padding,{top:t.cellPadding,right:t.cellPadding,bottom:t.cellPadding,left:t.cellPadding}),a=X(e?.fontSize,n,Number.EPSILON),l=Gl(t),c=l.resolve(e?.fontFamily,e?.fontWeight??s.weight,e?.fontStyle??s.style,s.family),u=i.background??r.dataBackground??r.pageBackground,d=i.text??r.foreground??{r:0,g:0,b:0},h=Vt(e?.borderColor,i.border,u);return{fontSize:a,fontFamily:c.family,fontWeight:c.weight,fontStyle:c.style,font:c,fontRegistry:l,direction:e?.direction??t.direction??"auto",language:e?.language??t.language,lineHeight:X(e?.lineHeight,l.getNaturalLineHeight(a,c),Number.EPSILON),maxLines:Lf(e?.maxLines),overflow:e?.overflow??Tf,alignment:e?.alignment??Z4,alignmentExplicit:e?.alignment!=null,padding:o,margin:J4,textColor:Vt(e?.color,d,u)??d,backgroundColor:Vt(e?.backgroundColor,i.background,u),borderColor:h,borderWidth:kf(e?.borderWidth,h),wrapText:e?.wrapText??!1,preserveLineBreaks:e?.preserveLineBreaks??e?.wrapText??!1,preserveSpaces:e?.preserveSpaces??!1}}function a6(e,t){const s=Cl(e,t.preserveLineBreaks,!!t.font.trueType),i=t.preserveLineBreaks?s.split(`
`):[s];let r=0;for(const n of i)r=Math.max(r,t.fontRegistry.measureText(n,t.fontSize,t.font,t.direction,t.language));return r}function Dn(e,t){if(typeof e=="number"){const i=X(e,0);return{top:i,right:i,bottom:i,left:i}}const s=e??{};return{top:X(s.top,t.top),right:X(s.right,t.right),bottom:X(s.bottom,t.bottom),left:X(s.left,t.left)}}function Df(e,t,s){if(e.elementType!=="rowgroup"||!e.groupLevel)return;const i=e.groupLevel*(s.rowGroupIndentSize??0);(t.direction==="auto"?xn(e.value,t.direction).direction:t.direction)==="rtl"?t.padding.right+=i:t.padding.left+=i}function Lf(e){if(!(e==null||!Number.isFinite(e)||e<1))return Math.floor(e)}function kf(e,t){return X(e,t?1:0)}function Gl(e){return e.fontRegistry??(e.fontRegistry=new pf(void 0)),e.fontRegistry}function _f(e,t){return typeof e=="string"?t.resolve(e,void 0,void 0):e}var l6=4,c6=9;function u6(e,t,s,i,r,n){const o={};if(!e)return o;for(const a of["all","first","even"]){const l=e[a];l&&(o[a]=p6(l,t,s,i,r,n))}return o}function Gf(e,t){return t===1&&e.first?e.first:t%2===0&&e.even?e.even:e.all??{header:[],footer:[],headerHeight:0,footerHeight:0}}function d6(e,t){const s={Page:String(t.pageNumber),Pages:String(t.totalPages),Date:t.date,Time:t.time};return e.replace(/&\[(Page|Pages|Date|Time)\]/g,(i,r)=>s[r])}function h6(e,t){try{const s=new Intl.DateTimeFormat(t,{year:"numeric",month:"numeric",day:"numeric"}).format(e),i=new Intl.DateTimeFormat(t,{hour:"numeric",minute:"2-digit",second:"2-digit"}).format(e);return{date:Ln(s),time:Ln(i)}}catch{return{date:Ln(e.toLocaleDateString()),time:Ln(e.toLocaleTimeString())}}}function Ln(e){return e.replace(/[\u00a0\u202f]/g," ")}function p6(e,t,s,i,r,n){const o=Of(e.header,t,s,i,r,n),a=Of(e.footer,t,s,i,r,n);return{header:o,footer:a,headerHeight:Nf(o),footerHeight:Nf(a)}}function Of(e,t,s,i,r,n){if(!e?.length)return[];const o=[],a=s.foreground??{r:0,g:0,b:0},l=s.pageBackground??s.dataBackground,c=["Left","Center","Right"],u=Math.min(e.length,3);for(let d=0;d<u;d++){const h=e[d],p=h.style,g=X(p?.fontSize,c6,Number.EPSILON),f=r.resolve(p?.fontFamily,p?.fontWeight??i.weight,p?.fontStyle??i.style,i.family),m=X(p?.lineHeight,r.getNaturalLineHeight(g,f),Number.EPSILON),v=h.position??c[d];let C="left";v==="Center"?C="center":v==="Right"&&(C="right"),o.push({value:h.value??"",position:v,image:h.image?n.resolve(h.image):void 0,style:{fontSize:g,fontFamily:f.family,fontWeight:f.weight,fontStyle:f.style,font:f,fontRegistry:r,direction:p?.direction??t.direction??"auto",language:p?.language??t.language,lineHeight:m,maxLines:1,overflow:"ellipsis",alignment:C,alignmentExplicit:!0,padding:{top:0,right:0,bottom:0,left:0},margin:{top:0,right:0,bottom:0,left:0},textColor:Vt(p?.color,a,l)??a,borderWidth:0,wrapText:!1,preserveLineBreaks:!1,preserveSpaces:!1}})}return o}function Nf(e){let t=0;for(const s of e){const i=s.value?s.style.lineHeight:0;t=Math.max(t,i,s.image?.height??0)}return t?t+l6*2:0}function Bf(e,t,s,i,r,n,o){const a=Math.max(s.width-i.margin.left-i.margin.right,0),l=Math.max(a-n.margin.left-n.margin.right,0),c=Math.max(l-n.padding.left-n.padding.right,0);if(!l||!c)return t;const u=t-n.margin.top,d=Math.max(u-i.margin.bottom-n.margin.bottom,0),h=Math.max(d-n.padding.top-n.padding.bottom,0),p=Math.floor(h/n.lineHeight),g=En(kl(e,c,n),p,n,c);if(!g.length)return t;const f=g.length*n.lineHeight+n.padding.top+n.padding.bottom,m=u-f,v=i.margin.left+n.margin.left;n.backgroundColor&&(r.push(`${Ft(n.backgroundColor)} rg`),r.push(`${_(v)} ${_(m)} ${_(l)} ${_(f)} re f`)),n.borderColor&&n.borderWidth>0&&(r.push(`${_(n.borderWidth)} w`),r.push(`${Ft(n.borderColor)} RG`),r.push(`${_(v)} ${_(m)} ${_(l)} ${_(f)} re S`),r.push("0.5 w")),r.push(`${Ft(n.textColor)} rg`),r.push("BT"),r.push(`/${n.font.key} ${_(n.fontSize)} Tf`);let C=u-n.padding.top-o.getBaselineOffset(n.fontSize,n.font);for(const S of g){const w=o.encodeText(S,n.font,n.direction,n.language),b=Wf(S,v,l,n,o,w.direction);Ol(r,w,b,C,n),C-=n.lineHeight}return r.push("ET"),m-n.margin.bottom}function Vf(e,t,s,i,r,n,o,a){if(!e.length||s<=0)return;const c=Math.max(i.width-r.margin.left-r.margin.right,0)/3;if(!(c<=0))for(const u of e){const d=u.style,h=d6(u.value,o),p=u.image?yf(u.image,c):void 0,g=p?p.width+(h?p.gap:0):0,m=(h?kl(h,Math.max(c-g,0),d):[])[0];if(!m&&!p)continue;let v=0;u.position==="Center"?v=1:u.position==="Right"&&(v=2);const C=r.margin.left+c*v,S=m?a.measureText(m,d.fontSize,d.font,d.direction,d.language):0,w=Math.min(g+S,c);let b=C;u.position==="Center"?b+=(c-w)/2:u.position==="Right"&&(b+=c-w);const y=p?Mf(p,d,m??""):!1,T=y?b:b+g,x=t-(s-d.lineHeight)/2-a.getBaselineOffset(d.fontSize,d.font);if(p){const F=y?b+S+(m?p.gap:0):b,A=t-(s+p.height)/2;zf(n,p,F,A)}if(m){const F=a.encodeText(m,d.font,d.direction,d.language);n.push(`${Ft(d.textColor)} rg`),n.push("BT"),n.push(`/${d.font.key} ${_(d.fontSize)} Tf`),Ol(n,F,T,x,d),n.push("ET")}}}function g6(e,t,s,i){const r=i.encodeText(e.text,e.font,e.direction,e.language),n=i.measureText(e.text,e.fontSize,e.font,e.direction,e.language),o=i.getBaselineOffset(e.fontSize,e.font),a=e.rotation*Math.PI/180,l=Math.cos(a),c=Math.sin(a),u=o-e.lineHeight/2,d=t.width/2,h=t.height/2,p=d-l*(n/2)+c*u,g=h-c*(n/2)-l*u;s.push("q"),s.push("/Artifact BMC"),e.graphicsState&&s.push(`/${e.graphicsState.key} gs`),s.push(`${Ft(e.color)} rg`),s.push("BT"),s.push(`/${e.font.key} ${_(e.fontSize)} Tf`),C6(s,r,e.fontSize,l,c,p,g,e),s.push("ET"),s.push("EMC"),s.push("Q")}function f6(e,t,s,i,r,n){let o=t;for(const a of e){const l=In(a,void 0,a.rowHeight);l&&(o=Hf(l,o,s,i,r,n))}return o}function Hf(e,t,s,i,r,n){const o=e.row,a=t-e.height;let l=.5,c=s.margin.left,u=0;for(const d of e.cells){const h=d.measurement;if(h.covered){c+=h.width,u+=h.span;continue}const p=Math.max(t-s.margin.bottom,e.height),g=Math.min(h.renderHeight??e.height,p),f=t-g;l=Uf(i,c,f,h.width,g,h.style,s.drawCellBorders,l),m6(i,d.lines,c,t,f,h.width,g,h.style,n,h.hyperlink,r,h.image,h.imageOnRight??!1,h.rowSpan>1),d.showImage&&h.image&&v6(i,h.image,c,t,f,h.width,h.style,h.imageOnRight??!1),c+=h.width,u+=h.span}for(let d=u;d<s.columnCount;d++){const h=s.columnWidths[d];l=Uf(i,c,a,h,e.height,o.defaultCellStyle,s.drawCellBorders,l),c+=h}return l!==.5&&i.push("0.5 w"),a}function Uf(e,t,s,i,r,n,o,a){return n.backgroundColor&&(e.push(`${Ft(n.backgroundColor)} rg`),e.push(`${_(t)} ${_(s)} ${_(i)} ${_(r)} re f`)),o&&n.borderColor&&n.borderWidth>0&&(n.borderWidth!==a&&(e.push(`${_(n.borderWidth)} w`),a=n.borderWidth),e.push(`${Ft(n.borderColor)} RG`),e.push(`${_(t)} ${_(s)} ${_(i)} ${_(r)} re S`)),a}function m6(e,t,s,i,r,n,o,a,l,c,u,d,h,p){const g=a.padding,f=d?d.width+(t.length?d.gap:0):0,m=h?s:s+f,v=Math.max(n-f,0),C=Math.max(v-g.left-g.right,0),S=Math.max(o-g.top-g.bottom,0);if(!t.length||!C||!S)return;const w=a.font.key;e.push("q"),e.push(`${_(m+g.left)} ${_(r+g.bottom)} ${_(C)} ${_(S)} re W n`),e.push("BT"),e.push(`${Ft(a.textColor)} rg`),e.push(`/${w} ${_(a.fontSize)} Tf`);const b=t.length*a.lineHeight,y=p?Math.max((S-b)/2,0):0;let T=i-g.top-y,x=T-l.getBaselineOffset(a.fontSize,a.font);for(const F of t){const A=l.encodeText(F,a.font,a.direction,a.language),P=Wf(F,m,v,a,l,A.direction);if(Ol(e,A,P,x,a),c&&F){const D=Math.min(l.measureText(F,a.fontSize,a.font,a.direction,a.language),C),N=Math.max(T-a.lineHeight,r+g.bottom),V=Math.min(P+D,m+v-g.right);V>P&&T>N&&u.push({uri:c,rect:[P,N,V,T]})}x-=a.lineHeight,T-=a.lineHeight}e.push("ET"),e.push("Q")}function v6(e,t,s,i,r,n,o,a){const l=o.padding,c=Math.max(i-r-l.top-l.bottom,0),u=Math.max(n-l.left-l.right,0);if(!c||!u)return;const d=a?s+n-l.right-t.width:s+l.left,h=r+l.bottom+(c-t.height)/2;e.push("q"),e.push(`${_(s+l.left)} ${_(r+l.bottom)} ${_(u)} ${_(c)} re W n`),zf(e,t,d,h),e.push("Q")}function zf(e,t,s,i){e.push("q"),e.push(t.altText?`/Span << /ActualText ${wn(t.altText)} >> BDC`:"/Artifact BMC"),e.push(`${_(t.width)} 0 0 ${_(t.height)} ${_(s)} ${_(i)} cm /${t.resource.key} Do`),e.push("EMC"),e.push("Q")}function Wf(e,t,s,i,r,n){const o=r.measureText(e,i.fontSize,i.font,i.direction,i.language),a=t+i.padding.left,l=t+s-i.padding.right-o,c=Math.max(s-i.padding.left-i.padding.right,0);let u=a;return i.alignment==="center"?u=a+(c-o)/2:(i.alignment==="right"||!i.alignmentExplicit&&n==="rtl")&&(u=a+c-o),Math.max(a,Math.min(u,l))}function Ol(e,t,s,i,r){const n=t.positionedGlyphs;if(!n){e.push(`1 0 0 1 ${_(s)} ${_(i)} Tm ${t.operatorValue} Tj`);return}e.push(`/Span << /ActualText ${wn(t.logicalText)} >> BDC`);let o=r.font.key;e.push(`/${o} ${_(r.fontSize)} Tf`);let a=s,l=i;for(const c of n){c.fontKey!==o&&(o=c.fontKey,e.push(`/${o} ${_(r.fontSize)} Tf`));const u=a+c.xOffset*r.fontSize,d=l+c.yOffset*r.fontSize;e.push(`1 0 0 1 ${_(u)} ${_(d)} Tm ${c.operatorValue} Tj`),a+=c.xAdvance*r.fontSize,l+=c.yAdvance*r.fontSize}e.push("EMC")}function C6(e,t,s,i,r,n,o,a){const l=t.positionedGlyphs;if(!l){e.push(`${_(i)} ${_(r)} ${_(-r)} ${_(i)} ${_(n)} ${_(o)} Tm ${t.operatorValue} Tj`);return}let c=a.font.key;e.push(`/${c} ${_(s)} Tf`);let u=0,d=0;for(const h of l){h.fontKey!==c&&(c=h.fontKey,e.push(`/${c} ${_(s)} Tf`));const p=u+h.xOffset*s,g=d+h.yOffset*s,f=n+i*p-r*g,m=o+r*p+i*g;e.push(`${_(i)} ${_(r)} ${_(-r)} ${_(i)} ${_(f)} ${_(m)} Tm ${h.operatorValue} Tj`),u+=h.xAdvance*s,d+=h.yAdvance*s}}var S6=.12,b6=-45,$f={r:128,g:128,b:128},y6="GSWatermark";function w6(e,t,s,i,r){const n=e.watermark,o=n?.text.trim()??"",a=Math.max(0,Math.min(X(n?.opacity,S6),1));if(!o||a<=0)return;const l=n?.style,c=Math.min(t.width,t.height)/6,u=X(l?.fontSize,c,Number.EPSILON),d=r.resolve(l?.fontFamily,l?.fontWeight??700,l?.fontStyle??i.style,i.family),h=X(l?.lineHeight,r.getNaturalLineHeight(u,d),Number.EPSILON),p=s.pageBackground??s.dataBackground;return{text:o,opacity:a,rotation:X(n?.rotation,b6),pages:n?.pages??"all",fontSize:u,lineHeight:h,font:d,direction:l?.direction??e.direction??"auto",language:l?.language??e.language,color:Vt(l?.color,$f,p)??$f,graphicsState:a<1?{key:y6,opacity:a}:void 0}}function x6(e,t){return e.pages==="first"?t===1:e.pages==="odd"?t%2===1:e.pages==="even"?t%2===0:!0}var F6=class{constructor(){this.objects=[]}reserve(){return this.objects.push(""),this.objects.length}add(e){return this.objects.push(e),this.objects.length}set(e,t){this.objects[e-1]=t}build(e,t){let s=`%PDF-1.4
`;const i=[0],r=this.objects;for(let a=0;a<r.length;a++){const l=r[a],c=a+1;i[c]=s.length,s+=`${c} 0 obj
${l}
endobj
`}const n=s.length;s+=`xref
0 ${r.length+1}
`,s+=`0000000000 65535 f
`;for(let a=1;a<=r.length;a++)s+=`${String(i[a]).padStart(10,"0")} 00000 n
`;const o=[`/Size ${r.length+1}`,`/Root ${e} 0 R`];return t&&o.push(`/Info ${t} 0 R`),s+=`trailer
<< ${o.join(" ")} >>
`,s+=`startxref
${n}
%%EOF`,s}};function T6(e,t,s,i,r,n=[],o=[]){const a=new F6,l=[],c=[],u=[];for(const y of s){const T=y.trueType?M6(a,y):R6(a,y);l.push(`/${y.key} ${T} 0 R`)}for(const y of n){const T=Math.max(0,Math.min(y.opacity,1)),x=a.add(`<< /Type /ExtGState /ca ${_(T)} /CA ${_(T)} /BM /Normal >>`);c.push(`/${y.key} ${x} 0 R`)}for(const y of o){const T=A6(a,y);u.push(`/${y.key} ${T} 0 R`)}const d=a.reserve(),h=[],p=`<< ${l.join(" ")} >>`,g=c.length?` /ExtGState << ${c.join(" ")} >>`:"",f=u.length?` /XObject << ${u.join(" ")} >>`:"";for(const y of e){const T=y.content,x=`<< /Length ${T.length} >>
stream
${T}
endstream`,F=a.add(x),A=[];for(const V of y.annotations){const[L,O,K,H]=V.rect,Z=`${_(L)} ${_(O)} ${_(K)} ${_(H)}`,Y=Vi(k6(V.uri)),pe=a.add(`<< /Type /Annot /Subtype /Link /Rect [${Z}] /Border [0 0 0] /A << /S /URI /URI (${Y}) >> >>`);A.push(`${pe} 0 R`)}const P=A.length?` /Annots [${A.join(" ")}]`:"",D=`<< /Type /Page /Parent ${d} 0 R /MediaBox [0 0 ${_(t.width)} ${_(t.height)}] /Resources << /Font ${p}${g}${f} >> /Contents ${F} 0 R${P} >>`,N=a.add(D);h.push(N)}const m=[];for(const y of h)m.push(`${y} 0 R`);a.set(d,`<< /Type /Pages /Kids [${m.join(" ")}] /Count ${h.length} >>`);const v=r?.trim(),C=v?` /Lang (${Vi(v)})`:"",S=a.add(`<< /Type /Catalog /Pages ${d} 0 R${C} >>`),w=i?.trim()??"",b=w.length?a.add(`<< /Title ${P6(w)} >>`):void 0;return a.build(S,b)}function A6(e,t){let s;if(t.alpha){const o=Tn(t.alpha);s=e.add(`<< /Type /XObject /Subtype /Image /Width ${t.width} /Height ${t.height} /ColorSpace /DeviceGray /BitsPerComponent 8 /Filter /ASCIIHexDecode /Length ${o.length} >>
stream
${o}
endstream`)}const i=Tn(t.data),r=t.filter?`/Filter [/ASCIIHexDecode /${t.filter}]`:"/Filter /ASCIIHexDecode",n=s?` /SMask ${s} 0 R`:"";return e.add(`<< /Type /XObject /Subtype /Image /Width ${t.width} /Height ${t.height} /ColorSpace /${t.colorSpace} /BitsPerComponent ${t.bitsPerComponent} ${r}${n} /Length ${i.length} >>
stream
${i}
endstream`)}function P6(e){return/^[\x20-\x7e]*$/.test(e)?`(${Vi(e)})`:wn(e)}function R6(e,t){const s=t.builtInFamily??"Helvetica";return e.add(`<< /Type /Font /Subtype /Type1 /BaseFont /${s} /Encoding /WinAnsiEncoding >>`)}function M6(e,t){const s=t.trueType,i=s.canSubset?`AGGRID+${s.postScriptName}`:s.postScriptName,r=s.createSubset(Array.from(t.mappingByCid.values(),v=>v.glyphId)),n=Tn(r),o=e.add(`<< /Length ${n.length} /Length1 ${r.length} /Filter /ASCIIHexDecode >>
stream
${n}
endstream`),a=1e3/s.unitsPerEm,l=s.bbox.map(v=>_(v*a)).join(" "),c=t.style==="normal"&&!s.italicAngle?4:68,u=e.add(`<< /Type /FontDescriptor /FontName /${i} /Flags ${c} /FontBBox [${l}] /ItalicAngle ${_(s.italicAngle)} /Ascent ${_(s.ascent*a)} /Descent ${_(s.descent*a)} /CapHeight ${_(s.capHeight*a)} /StemV 80 /FontWeight ${t.weight} /FontFile2 ${o} 0 R >>`),d=I6(t),h=D6(t),p=e.add(`<< /Length ${h.length} /Filter /ASCIIHexDecode >>
stream
${h}
endstream`),g=e.add(`<< /Type /Font /Subtype /CIDFontType2 /BaseFont /${i} /CIDSystemInfo << /Registry (Adobe) /Ordering (Identity) /Supplement 0 >> /FontDescriptor ${u} 0 R /DW 1000${d?` /W [${d}]`:""} /CIDToGIDMap ${p} 0 R >>`),f=E6(t),m=e.add(`<< /Length ${f.length} >>
stream
${f}
endstream`);return e.add(`<< /Type /Font /Subtype /Type0 /BaseFont /${i} /Encoding /Identity-H /DescendantFonts [${g} 0 R] /ToUnicode ${m} 0 R >>`)}function I6(e){const t=e.trueType,s=Array.from(e.mappingByCid.entries()).sort(([n],[o])=>n-o),i=[],r=1e3/t.unitsPerEm;for(const[n,o]of s)i.push(`${n} [${_(t.getAdvanceWidth(o.glyphId)*r)}]`);return i.join(" ")}function E6(e){const t=[];for(const[i,r]of e.mappingByCid)r.unicode&&t.push(`<${L6(i,4)}> ${wn(r.unicode,!1)}`);const s=["/CIDInit /ProcSet findresource begin","12 dict begin","begincmap","/CIDSystemInfo << /Registry (Adobe) /Ordering (UCS) /Supplement 0 >> def","/CMapName /Adobe-Identity-UCS def","/CMapType 2 def","1 begincodespacerange","<0000> <FFFF>","endcodespacerange"];for(let i=0;i<t.length;i+=100){const r=t.slice(i,i+100);s.push(`${r.length} beginbfchar`,...r,"endbfchar")}return s.push("endcmap","CMapName currentdict /CMap defineresource pop","end","end"),s.join(`
`)}function D6(e){const t=e.mappingByCid.size,s=new Uint8Array((t+1)*2),i=new DataView(s.buffer);for(const[r,n]of e.mappingByCid)i.setUint16(r*2,n.glyphId,!1);return Tn(s)}function L6(e,t){return e.toString(16).toUpperCase().padStart(t,"0")}function k6(e){return encodeURI(_6(e)).replace(/%25([0-9a-f]{2})/gi,"%$1")}function _6(e){let t="";for(let s=0;s<e.length;s++){const i=e.charCodeAt(s);if(i>=55296&&i<=56319){const r=e.charCodeAt(s+1);r>=56320&&r<=57343?(t+=e[s]+e[s+1],s++):t+="\uFFFD"}else i>=56320&&i<=57343?t+="\uFFFD":t+=e[s]}return t}var Ht={fontSize:10,headerFontSize:11,cellPadding:4,repeatHeader:!0,drawCellBorders:!0,rowGroupIndentSize:12};function Kf(e,t,s){const i=s.page,r=KH(i?.size,i?.orientation),n=jH(i?.margin),o=z4(s.colors),a=new pf(s.fonts),l=new B4,c=t.length||Math.max(YH(e),1),u=Math.max(r.width-n.left-n.right,0),d=s.defaultCellStyle,h=we(d,s.defaultHeaderStyle),p=X(d?.fontSize,Ht.fontSize,Number.EPSILON),g=X(h?.fontSize,Ht.headerFontSize,Number.EPSILON),f=s.repeatHeader??Ht.repeatHeader,m=s.drawCellBorders??Ht.drawCellBorders,v=X(s.rowGroupIndentSize,Ht.rowGroupIndentSize),C=a.resolve(d?.fontFamily,d?.fontWeight,d?.fontStyle),S=a.resolve(h?.fontFamily??C.family,h?.fontWeight??700,h?.fontStyle??C.style,C.family),w=Af(s.documentTitle,s.documentTitleStyle,"title",s,o,S,a,Ht.headerFontSize),b=Af(s.documentSubtitle,s.documentSubtitleStyle,"subtitle",s,o,C,a,Ht.headerFontSize),y=w?.text??"",T=u6(s.headerFooterConfig,s,o,C,a,l),x=h6(new Date,s.language),F=w6(s,r,o,C,a),A=QH(e),P={columnCount:c,columnWidths:_g(t,c),margin:n,drawCellBorders:m,fontSize:p,headerFontSize:g,cellPadding:Ht.cellPadding,defaultCellStyle:d,defaultHeaderStyle:h,rowHeight:Dg(s.rowHeight,Number.EPSILON),headerRowHeight:Dg(s.headerRowHeight,Number.EPSILON),rowGroupIndentSize:v,fontRegistry:a,language:s.language,direction:s.direction,imageRegistry:l},D=qH(t,c,s.columnWidth),N=D.map(XH),V=N.includes(!0)?i6(e,P,C,S,o,N):void 0,L=ZH(t,c,u,D,V),O={...P,columnWidths:L},K=[],H=[],Z=new Set(A);let Y=0;for(const j of e){const ie=e6(j,O,C,S,o,Y);K.push(ie),Z.has(j)&&H.push(ie),j.type==="BODY"&&(Y+=1)}const pe=t6(H);let k=0;for(const j of H)k+=j.rowHeight;const M=[],re=[];let W=[],E=[],U=0,q={header:[],footer:[],headerHeight:0,footerHeight:0},ne=O,Se=Math.max(r.height-n.top-n.bottom,0),le=r.height-n.top,Ee=!1;const ms=j=>{W.length>j&&(Ee=!0)},et=j=>{Ee&&(M.push({content:W.join(`
`),annotations:E}),re.push(q)),U+=1,q=Gf(T,U);const ie=Math.max((r.height-n.top-n.bottom)/2,0),De=q.headerHeight+q.footerHeight;if(De>ie){const oe=ie/De;q={...q,headerHeight:q.headerHeight*oe,footerHeight:q.footerHeight*oe}}if(ne={...O,margin:{...O.margin,top:O.margin.top+q.headerHeight,bottom:O.margin.bottom+q.footerHeight}},Se=Math.max(r.height-ne.margin.top-ne.margin.bottom,0),W=["0.5 w"],E=[],Ee=!1,o.pageBackground&&(W.push(`${Ft(o.pageBackground)} rg`),W.push(`0 0 ${_(r.width)} ${_(r.height)} re f`)),le=r.height-ne.margin.top,U===1){if(w){const oe=W.length;le=Bf(w.text,le,r,ne,W,w.style,a),ms(oe)}if(b){const oe=W.length;le=Bf(b.text,le,r,ne,W,b.style,a),ms(oe)}}if(j&&H.length){const oe=W.length;le=f6(H,le,ne,W,E,a),ms(oe)}};et(!1),s.coverPage&&Ee&&et(!1);const Xt=j=>{const ie=Gf(T,j);return Math.max(r.height-n.top-n.bottom-ie.headerHeight-ie.footerHeight,0)},Lo=(j,ie)=>{if(!f||j.type!=="BODY"||!H.length)return!1;const De=Xt(U+1),oe=De-k;return!ie&&j.rowHeight<=De&&j.rowHeight>oe?!1:oe>0&&!!In(j,ie,oe)};for(const j of K){if(j===H[0]&&(f||pe)){const oe=Math.max(le-ne.margin.bottom,0);Ee&&k>oe&&k<=Xt(U+1)&&et(!1)}let ie,De=!1;for(;!De;){let oe=Math.max(le-ne.margin.bottom,0);const Qs=Ee?Xt(U+1):Se,ku=j.fixedHeight?Math.min(j.rowHeight,Qs):j.rowHeight;!ie&&Ee&&ku<=Qs&&ku>oe&&(et(Lo(j,ie)),oe=Math.max(le-ne.margin.bottom,0));let Zt=In(j,ie,oe);!Zt&&Ee&&(et(Lo(j,ie)),oe=Math.max(le-ne.margin.bottom,0),Zt=In(j,ie,oe)),Zt||(Zt=s6(j,ie,oe));const Ly=W.length;le=Hf(Zt,le,ne,W,E,a),ms(Ly),De=Zt.complete,ie=Zt.nextState,De||et(Lo(j,ie))}}(Ee||!M.length)&&(M.push({content:W.join(`
`),annotations:E}),re.push(q));const Lu=M.length;for(let j=0;j<Lu;j++){if(F&&x6(F,j+1)){const Qs=[];g6(F,r,Qs,a),M[j].content+=`
${Qs.join(`
`)}`}const ie=re[j],De=[],oe={pageNumber:j+1,totalPages:Lu,...x};Vf(ie.header,r.height-n.top,ie.headerHeight,r,O,De,oe,a),Vf(ie.footer,n.bottom+ie.footerHeight,ie.footerHeight,r,O,De,oe,a),De.length&&(M[j].content+=`
${De.join(`
`)}`)}return T6(M,r,a.getUsedFonts(),y,s.language,F?.graphicsState?[F.graphicsState]:[],l.getResources())}function ct(e,t){for(const s of t){const i=e[s];if(i!=null)return i}}function ut(e,t){const s=ct(e,t);return s==null?void 0:String(s).trim()||void 0}function Tt(e){if(e==null)return;if(typeof e=="number"&&Number.isFinite(e))return e;const t=String(e).trim().match(/^-?\d+(?:\.\d+)?/);if(!t)return;const s=Number.parseFloat(t[0]);return Number.isFinite(s)?s:void 0}function G6(e){const t=Tt(ct(e,["padding"])),s=Tt(ct(e,["paddingTop","padding-top"])),i=Tt(ct(e,["paddingRight","padding-right"])),r=Tt(ct(e,["paddingBottom","padding-bottom"])),n=Tt(ct(e,["paddingLeft","padding-left"]));if(s==null&&i==null&&r==null&&n==null)return t;const o={};return s!=null&&(o.top=s),i!=null&&(o.right=i),r!=null&&(o.bottom=r),n!=null&&(o.left=n),Object.keys(o).length?o:void 0}function O6(e){const t=ut(e,["whiteSpace","white-space"])?.toLowerCase(),s=ut(e,["whiteSpaceCollapse","white-space-collapse"])?.toLowerCase(),i=ut(e,["textWrapMode","text-wrap-mode"])?.toLowerCase(),r={};return t&&(t==="normal"?(r.wrapText=!0,r.preserveLineBreaks=!1,r.preserveSpaces=!1):t==="nowrap"?(r.wrapText=!1,r.preserveLineBreaks=!1,r.preserveSpaces=!1):t==="pre"?(r.wrapText=!1,r.preserveLineBreaks=!0,r.preserveSpaces=!0):t==="pre-line"?(r.wrapText=!0,r.preserveLineBreaks=!0,r.preserveSpaces=!1):(t==="pre-wrap"||t==="break-spaces")&&(r.wrapText=!0,r.preserveLineBreaks=!0,r.preserveSpaces=!0)),s==="preserve"||s==="preserve-breaks"||s==="break-spaces"?(r.preserveLineBreaks=!0,r.preserveSpaces=s!=="preserve-breaks"):s==="collapse"&&(r.preserveLineBreaks=!1,r.preserveSpaces=!1),(i==="wrap"||i==="nowrap")&&(r.wrapText=i==="wrap"),Object.keys(r).length?r:void 0}var N6=new Set(["none","hidden","dotted","dashed","solid","double","groove","ridge","inset","outset"]);function Ls(e,t){return e?t?.(e)??e:void 0}function Nl(e,t,s){return Ls(ut(e,t),s)}function B6(e){if(!e)return;const t=e.trim(),s=t.match(/(var\([^)]+\)|(?:rgb|hsl)a?\([^)]+\)|color\([^)]+\))\s*$/i);if(s)return s[1];const i=t.match(/(#[0-9a-fA-F]{3,8}|[a-zA-Z]+)\s*$/);if(!i)return;const r=i[1];if(!N6.has(r.toLowerCase()))return r}function kn(e,t){if(!e)return;const s={...e};return e.color?s.color=Ls(e.color,t):delete s.color,e.backgroundColor?s.backgroundColor=Ls(e.backgroundColor,t):delete s.backgroundColor,e.borderColor?s.borderColor=Ls(e.borderColor,t):delete s.borderColor,s}var V6=new Set(["http","https","mailto","tel"]);function jf(e){if(typeof e!="string")return;const t=e.trim(),s=/^([a-z][a-z\d+.-]*):/i.exec(t)?.[1].toLowerCase();return s&&V6.has(s)?e:void 0}function H6(e){if(e){if(e.startsWith("center"))return"center";if(e.startsWith("right")||e.startsWith("end"))return"right";if(e.startsWith("left")||e.startsWith("start"))return"left"}}function U6(e){return W6(e)}function z6(e){if(e==null)return;if(typeof e=="number")return Yf(e);const t=String(e).trim().toLowerCase();if(t==="bold"||t==="bolder")return"bold";if(t==="normal")return"normal";if(t==="lighter")return 300;if(/^\d+(?:\.\d+)?$/.test(t))return Yf(Number.parseFloat(t))}function W6(e){if(!e)return;const t=e.split(",")[0].trim().replace(/(^["'])|(["']$)/g,"").toLowerCase();return t.includes("helvetica-bold")?"Helvetica-Bold":t==="helvetica"||t==="arial"||t==="sans-serif"||t==="system-ui"?"Helvetica":t.includes("times-bold")?"Times-Bold":t.includes("times")||t==="serif"?"Times-Roman":t.includes("courier-bold")?"Courier-Bold":t.includes("courier")||t==="monospace"?"Courier":t}function Yf(e){return Number.isFinite(e)?Math.min(Math.max(Math.round(e/100)*100,100),900):void 0}function Bl(e,t){const s={};for(const v of e)v&&Object.assign(s,v);if(!Object.keys(s).length)return;const i={},r=Nl(s,["color"],t);r&&(i.color=r);const n=Nl(s,["backgroundColor","background-color","background"],t);n&&(i.backgroundColor=n);const o=Nl(s,["borderColor","border-color"],t)??Ls(B6(ut(s,["border","border-top"])),t);o&&(i.borderColor=o);const a=Tt(ct(s,["borderWidth","border-width"]))??Tt(ut(s,["border","border-top"]));a!=null&&(i.borderWidth=a);const l=Tt(ct(s,["fontSize","font-size"]));l!=null&&(i.fontSize=l);const c=Tt(ct(s,["lineHeight","line-height"]));c!=null&&(i.lineHeight=c);const u=U6(ut(s,["fontFamily","font-family"]));u&&(i.fontFamily=u);const d=z6(ct(s,["fontWeight","font-weight"]));d&&(i.fontWeight=d);const h=ut(s,["fontStyle","font-style"])?.toLowerCase();(h==="normal"||h==="italic"||h==="oblique")&&(i.fontStyle=h);const p=ut(s,["direction"])?.toLowerCase();(p==="ltr"||p==="rtl")&&(i.direction=p);const g=H6(ut(s,["textAlign","text-align"]));g&&(i.alignment=g);const f=G6(s);f!=null&&(i.padding=f);const m=O6(s);return m&&Object.assign(i,m),Object.keys(i).length?i:void 0}var $6=class extends gx{constructor(e){super(e),this.config=e,this.useGridHeaderLayout=!0,this.rows=[],this.columnsToExport=[],this.rowIndex=0,this.bodyRowIndex=-1}prepare(e){super.prepare(e),this.columnsToExport=[...e]}addCustomContent(e){if(e){if(typeof e=="string"){const t=Math.max(this.columnsToExport.length-1,0),s=e.split(/\r?\n/);for(const i of s)this.createRow("CUSTOM").cells.push({value:i,mergeAcross:t||void 0,elementType:"custom"});return}for(const t of e){const s=this.createRow("CUSTOM"),i=Math.max(this.columnsToExport.length,1);let r=0;for(const n of t){if(r>=i)break;const o=n?.mergeAcross,a=typeof o=="number"&&Number.isFinite(o)?Math.max(Math.floor(o),0):0,l=Math.min(a,i-r-1);s.cells.push({value:String(n?.data?.value??""),hyperlink:jf(n?.data?.hyperlink),image:n?.data?.image,mergeAcross:l||void 0,style:kn(n?.style,this.config.resolveColor),elementType:"custom"}),r+=l+1}}}}onNewHeaderGroupingRow(){const e=this.createRow("HEADER_GROUPING");return{onCell:this.createHeaderCellAccumulator(e)}}onNewHeaderRow(){const e=this.createRow("HEADER");return{onCell:this.createHeaderCellAccumulator(e)}}createHeaderCellAccumulator(e){return t=>{if(t.type==="covered"){e.cells.push({value:"",covered:!0});return}if(t.type==="column"){const r=t.column,n=this.extractHeaderValue(r);e.cells.push({value:n,mergeDown:t.rowSpan>1?t.rowSpan-1:void 0,elementType:"header",sourceColumn:r,style:we(this.resolveColumnHeaderPdfStyle(r),this.resolveCallbackPdfStyle({type:"header",accumulatedRowIndex:this.rowIndex,value:n,column:r}))});return}const s=t.column,i=s?this.extractGroupHeaderValue(s):"";e.cells.push({value:i,mergeAcross:t.columnSpan>1?t.columnSpan-1:void 0,elementType:"groupheader",sourceColumn:s,style:s?we(this.resolveColumnGroupHeaderPdfStyle(s),this.resolveCallbackPdfStyle({type:"groupheader",accumulatedRowIndex:this.rowIndex,value:i,column:s})):void 0})}}onNewBodyRow(e){const t=this.createRow("BODY",e),s=this.rowIndex,i=this.columnsToExport.length;let r=0,n=!1;return{onColumn:(o,a,l)=>{if(r>0){r-=1;return}const c=l??e;if(!c){t.cells.push({value:"",elementType:"cell",sourceColumn:o});return}const u=Math.max(c.uiLevel??c.level??0,0),d=this.isFullWidthGroupCell(c,a),h=this.isRowGroupCell(o,c,d);t.sourceNode||(t.sourceNode=c,t.rowPinned=c.rowPinned,t.groupLevel=u),n||(t.style=we(this.resolveRowPdfStyle(c),this.resolveCallbackPdfStyle({type:"row",accumulatedRowIndex:s,value:c.data,node:c})),n=!0);const p=this.resolveCellPdfStyle(o,c),g=this.extractPdfRowCellValue(o,c,a,s,h,d),f=String(g.valueFormatted??g.value??""),m=this.resolveCellImage(f,o,c,s),v=m?String(m.value??""):f,C=we(p,this.resolveCallbackPdfStyle({type:h?"rowgroup":"cell",accumulatedRowIndex:s,value:v,node:c,column:o})),S=Math.max(i-a,1),w=Math.min(o.getColSpan(c),S),b=w>1?w-1:void 0;b&&(r=b),t.cells.push({value:v,hyperlink:this.resolveCellHyperlink(v,o,c,s),image:m?.image,mergeAcross:b,style:C,elementType:h?"rowgroup":"cell",sourceColumn:o,sourceNode:c,groupLevel:u})}}}parse(){if(this.config.direction!=="rtl")return Kf(this.rows,this.columnsToExport,this.config);const e=this.rows.map(s=>({...s,cells:[...s.cells].reverse()})),t=[...this.columnsToExport].reverse();return Kf(e,t,this.config)}createRow(e,t){this.rowIndex+=1,e==="BODY"&&(this.bodyRowIndex+=1);const s={type:e,cells:[],sourceNode:t,rowPinned:t?.rowPinned,groupLevel:t?Math.max(t.uiLevel??t.level??0,0):void 0};return this.rows.push(s),s}resolveRowPdfStyle(e){if(this.shouldSkipGridStyles())return;const t=this.gos.get("rowStyle"),s=this.gos.getCallback("getRowStyle"),i=this.getNodeRowIndex(e),r=s?.({data:e.data,node:e,rowIndex:i});return Bl([t,r],this.config.resolveColor)}extractPdfRowCellValue(e,t,s,i,r,n){if(r&&!this.processCellCallback&&!this.processRowGroupCallback){const{value:o,valueFormatted:a}=this.valueSvc.getValueForDisplay({column:n?void 0:e,node:t,includeValueFormatted:!0,exporting:!0,from:this.valueFrom,transformValues:this.transformValues});return{value:o??"",valueFormatted:a}}return this.extractRowCellValue({column:e,node:t,currentColumnIndex:s,accumulatedRowIndex:i,type:"pdf",useRawFormula:!1})}resolveCellPdfStyle(e,t){if(this.shouldSkipGridStyles())return;const s=e.getColDef(),i=s.cellStyle;if(!i&&s.wrapText==null)return;const r=this.getNodeRowIndex(t);let n;if(typeof i=="function"){const a=this.valueSvc.getDisplayValue(e,t,this.valueFrom,this.transformValues),l=Ni(this.gos,{data:t.data,node:t,rowIndex:r,value:a,column:e,colDef:s});n=i(l)}else n=i;const o=s.wrapText==null?void 0:{wrapText:s.wrapText};return we(o,Bl([n],this.config.resolveColor))}resolveColumnHeaderPdfStyle(e){const t=e.getColDef();return we(this.resolveHeaderPdfStyle(t.headerStyle,{colDef:t,column:e,floatingFilter:!1}),this.shouldSkipGridStyles()||t.wrapHeaderText==null?void 0:{wrapText:t.wrapHeaderText})}resolveColumnGroupHeaderPdfStyle(e){const t=e.getColGroupDef();if(t)return we(this.resolveHeaderPdfStyle(t.headerStyle,{colDef:t,columnGroup:e,floatingFilter:!1}),this.shouldSkipGridStyles()||t.wrapHeaderText==null?void 0:{wrapText:t.wrapHeaderText})}resolveHeaderPdfStyle(e,t){if(!e||this.shouldSkipGridStyles())return;const s=typeof e=="function"?e(Ni(this.gos,t)):e;return Bl([s],this.config.resolveColor)}getNodeRowIndex(e){return e.rowIndex??Math.max(this.bodyRowIndex,0)}resolveCallbackPdfStyle(e){const t=this.config.processStyleCallback;if(!t)return;const s=t(Ni(this.gos,e));return kn(s,this.config.resolveColor)}resolveCellHyperlink(e,t,s,i){const r=this.config.processCellHyperlinkCallback;if(!r)return;const n={value:e,accumulatedRowIndex:i,node:s,column:t};return jf(r(Ni(this.gos,n)))}resolveCellImage(e,t,s,i){const r=this.config.addImageToCell;if(!r)return;const n={value:e,accumulatedRowIndex:i,node:s,column:t};return r(Ni(this.gos,n))??void 0}isRowGroupCell(e,t,s){return this.gos.get("treeData")||t.group?e.isRowGroupDisplayed(t.rowGroupColumn?.getColId()??"")||s:!1}isFullWidthGroupCell(e,t){return t===0&&WH(this.gos,e,this.colModel.pivotMode)}shouldSkipGridStyles(){return this.config.skipGridStyles===!0}};import{paramToVariableName as K6}from"ag-stack";import{_createElement as j6}from"ag-grid-community";var qf=["backgroundColor","dataBackgroundColor","oddRowBackgroundColor","foregroundColor","headerBackgroundColor","headerTextColor","borderColor"];function Xf(e,t){return!e||!t?t??e:{...e,...t}}function Zf(e,t){return e&&{...e,color:t(e.color),backgroundColor:t(e.backgroundColor),borderColor:t(e.borderColor)}}function Y6(e,t){if(!e||!t)return t??e;const s={};for(const i of["all","first","even"]){const r=e[i],n=t[i];(r||n)&&(s[i]={...r,...n})}return s}function q6(e,t){if(!e)return e;const s={};for(const i of["all","first","even"]){const r=e[i];r&&(s[i]=J6(r,t))}return s}function X6(e,t){return!e||!t?t??e:{...e,...t,style:{...e.style??{},...t.style??{}}}}function Z6(e,t){return e?.style?{...e,style:{...e.style,color:t(e.style.color)}}:e}function J6(e,t){return{header:Jf(e.header,t),footer:Jf(e.footer,t)}}function Jf(e,t){return e&&e.map(s=>({...s,style:s.style?{...s.style,color:t(s.style.color)}:void 0}))}function Q6(e,t,s,i){const r={...e,...t,...s},n=t?.dataBackgroundColor!=null||s?.dataBackgroundColor!=null,o=t?.oddRowBackgroundColor!=null||s?.oddRowBackgroundColor!=null,a=e.oddRowBackgroundColor==null||e.oddRowBackgroundColor===e.dataBackgroundColor,l=n&&!o&&a;r.oddRowBackgroundColor=l?r.dataBackgroundColor:r.oddRowBackgroundColor;for(const c of qf){const u=r[c];u&&(r[c]=i(u)??u)}return r}function eU(e){if(!e||typeof getComputedStyle!="function")return{};const t=getComputedStyle(e),s={};for(const n of qf){const o=K6(n),a=t.getPropertyValue(o).trim();if(!a)continue;const l=Qf(a,e);l&&(s[n]=l)}const i=em(e,".ag-header","color");i&&(s.headerTextColor=i);const r=em(e,".ag-header","backgroundColor");return r&&(s.headerBackgroundColor=r),s}function tU(e,t){return Ls(e,s=>s&&Qf(s,t)||void 0)}function Qf(e,t){if(typeof document>"u"||!t||typeof getComputedStyle!="function")return e;const s=j6({tag:"span"}),i=/\bvar\(/i.test(e);if(s.style.color=e,!s.style.color&&!i)return"";s.style.position="absolute",s.style.left="-99999px",s.style.top="-99999px",s.style.visibility="hidden",t.appendChild(s);const r=getComputedStyle(s).color;return s.remove(),r||""}function em(e,t,s){if(!e||typeof getComputedStyle!="function")return;const i=e.querySelector(t);if(!i)return;const r=getComputedStyle(i)[s].trim();if(!(!r||W4(r)))return r}var sU=class extends fx{constructor(){super(...arguments),this.beanName="pdfCreator"}getMergedParams(e){const t=this.gos.get("defaultPdfExportParams"),s=this.getResolveColorValueFn(),i={...t??{},...e??{}};i.direction??(i.direction=this.gos.get("enableRtl")?"rtl":"ltr"),i.colors=Q6(eU(this.beans.eRootDiv),t?.colors,e?.colors,s),t?.page&&e?.page&&(i.page={...t.page,...e.page}),i.defaultCellStyle=kn(we(t?.defaultCellStyle,e?.defaultCellStyle),s),i.defaultHeaderStyle=kn(we(t?.defaultHeaderStyle,e?.defaultHeaderStyle),s);const r=Xf(t?.documentTitleStyle,e?.documentTitleStyle);i.documentTitleStyle=Zf(r,s);const n=Xf(t?.documentSubtitleStyle,e?.documentSubtitleStyle);i.documentSubtitleStyle=Zf(n,s);const o=Y6(t?.headerFooterConfig,e?.headerFooterConfig);i.headerFooterConfig=q6(o,s);const a=X6(t?.watermark,e?.watermark);return i.watermark=Z6(a,s),i}export(e){if(this.isExportSuppressed()){this.warn(160);return}this.runExport(()=>{const t=this.getMergedParams(e),s=this.createPdfBlob(t);s&&HH(this.resolveFileName(t),s)})}exportDataAsPdf(e){this.export(e)}getDataAsPdf(e){if(this.isExportSuppressed()){this.warn(160);return}return this.createPdfBlob(this.getMergedParams(e))}createPdfBlob(e){try{const t=this.getData(e);return new Blob([t],{type:e.mimeType||"application/pdf"})}catch(t){if(t instanceof hf){this.error(330,{fontFamily:t.family,registeredFamilies:t.registeredFamilies});return}throw t}}getDefaultFileExtension(){return"pdf"}createSerializingSession(e){const{colModel:t,colNames:s,rowGroupColsSvc:i,valueSvc:r,gos:n,log:o}=this.beans,{processCellCallback:a,processHeaderCallback:l,processGroupHeaderCallback:c,processRowGroupCallback:u}=e??{},d=this.getResolveColorValueFn();return new $6({...e,colModel:t,colNames:s,rowGroupColsSvc:i,valueSvc:r,gos:n,log:o,resolveColor:d,processCellCallback:a||void 0,processHeaderCallback:l||void 0,processGroupHeaderCallback:c||void 0,processRowGroupCallback:u||void 0})}isExportSuppressed(){return this.gos.get("suppressPdfExport")}getResolveColorValueFn(){const{eRootDiv:e}=this.beans,t=new Map;return s=>{if(!s)return;const i=t.get(s);if(i!==void 0||t.has(s))return i;const r=tU(s,e);return t.set(s,r),r}}};function iU(e,t){return e.pdfCreator?.getDataAsPdf(t)}function rU(e,t){e.pdfCreator?.exportDataAsPdf(t)}var tm={moduleName:"PdfExport",version:G,beans:[sU],apiFunctions:{getDataAsPdf:iU,exportDataAsPdf:rU},dependsOn:[VH,$]};import{_ColumnFilterModule as nU}from"ag-grid-community";import{LocalEventService as oU,_removeFromArray as aU}from"ag-stack";import{AgPromise as Ut,FilterWrapperComp as lU,ProvidedFilter as cU,_getFilterModel as uU,_refreshFilterUi as dU,_refreshHandlerAndUi as sm,_updateFilterModel as hU}from"ag-grid-community";import{_focusInto as pU,_getActiveDomElement as gU,_isNothingFocused as fU,_setAriaRole as mU}from"ag-stack";import{AgPromise as ks,KeyCode as Ui,TabGuardComp as vU,_createElement as CU}from"ag-grid-community";var im=class extends mx{constructor(){super({tag:"div",cls:"ag-multi-filter ag-menu-list-compact"}),this.filterDefs=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.lastActivatedMenuItem=null}postConstruct(){this.initialiseTabGuard({onFocusIn:e=>this.onFocusIn(e)})}refreshGui(e){return e===this.lastOpenedInContainer?ks.resolve():(this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),ks.all(this.getFilterWrappers().map((t,s)=>{if(!t)return ks.resolve(null);const i=this.getFilterFromWrapper(t),r=this.getCompFromWrapper(t),n=this.filterDefs[s],o=PD(i,n);let a;if(n.display==="subMenu"&&e!=="toolPanel")a=this.insertFilterMenu(r,i,o).then(l=>l.getGui());else if(n.display==="subMenu"||n.display==="accordion"){const l=this.insertFilterGroup(i,r,o);a=ks.resolve(l.getGui())}else a=ks.resolve(r.getGui());return a})).then(t=>{t.forEach((s,i)=>{s&&(i>0&&this.appendChild(CU({tag:"div",cls:"ag-filter-separator"})),this.appendChild(s))}),this.filterGuis=t,this.lastOpenedInContainer=e}))}destroyChildren(){for(const e of this.guiDestroyFuncs)e();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(e,t,s){const i=e.getGui();mU(i,"dialog");const r=this.createBean(new vN),n={getGui:()=>e.getGui(),afterGuiAttached:o=>{e.afterGuiAttached?.(o),e!==t&&t.afterGuiAttached?.(o)}};return r.init({menuItemDef:{name:s,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:rp,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:n,contextParams:{column:null,node:null,value:null}}).then(()=>{r.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(r)),this.addManagedListeners(r,{menuItemActivated:a=>{this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==a.menuItem&&this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=a.menuItem}});const o=r.getGui();return r.addManagedElementListeners(o,{keydown:a=>{const{key:l}=a;switch(l){case Ui.UP:case Ui.RIGHT:case Ui.DOWN:case Ui.LEFT:a.preventDefault(),l===Ui.RIGHT&&r.openSubMenu(!0);break}},focusin:()=>r.activate(),focusout:()=>{!r.isSubMenuOpen()&&!r.isSubMenuOpening()&&r.deactivate()}}),r})}insertFilterGroup(e,t,s){const i=this.createBean(new it({title:s,cssIdentifier:"multi-filter"}));return this.guiDestroyFuncs.push(()=>this.destroyBean(i)),i.addItem(t.getGui()),i.toggleGroupExpand(!1),e.afterGuiAttached&&i.addManagedListeners(i,{expanded:()=>e.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})}),i}afterGuiAttached(e){let t;e?(this.hidePopup=e.hidePopup,t=this.refreshGui(e.container)):(this.hidePopup=void 0,t=ks.resolve());const s=e?.suppressFocus;t.then(()=>{const{filterDefs:i,filterGuis:r,beans:n}=this,o=this.getFilterWrappers();let a=!!s;i&&Br(i,(c,u)=>{const d=u===0,h=c.display&&c.display!=="inline",p=s||!d||h,g={...e??{},suppressFocus:p},f=o[u],m=f?this.getFilterFromWrapper(f):void 0;if(f){const v=this.getCompFromWrapper(f);v!==m&&v.afterGuiAttached(g)}if(m&&(this.executeFunctionIfExistsOnFilter(m,"afterGuiAttached",g),d&&!p&&(a=!0)),!s&&d&&h){const v=r[u];v&&(pU(v)||v.focus({preventScroll:!0}),a=!0)}});const l=gU(n);!a&&(fU(n)||this.getGui().contains(l))&&this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",e=>this.executeOnWrapper(e,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",e=>this.executeOnWrapper(e,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper(e,t){}executeFunctionIfExists(e,t){Br(this.getFilterWrappers(),s=>{s&&(t?.(s),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(s),e))})}executeFunctionIfExistsOnFilter(e,t,...s){const i=e[t];typeof i=="function"&&i.apply(e,s)}onFocusIn(e){const t=this.lastActivatedMenuItem;t!=null&&!t.getGui().contains(e.target)&&(t.deactivate(),this.lastActivatedMenuItem=null)}},rm=class extends im{constructor(){super(...arguments),this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init(e){this.params=e,this.filterDefs=Dt(e);const t=uU(this.beans.colFilter.model,e.column.getColId()),{filterChangedCallback:s}=e;this.filterChangedCallback=s;const i=this.filterDefs.map((r,n)=>this.createFilter(r,n,t));return new Ut(r=>{Ut.all(i).then(n=>{this.wrappers=n,this.refreshGui("columnMenu").then(()=>{r()})})}).then(()=>{for(const r of this.afterFiltersReadyFuncs)r();this.afterFiltersReadyFuncs.length=0})}refresh(e){return Ud(this.filterDefs,Dt(e))?!1:(this.params=e,!0)}isFilterActive(){return this.wrappers.some(e=>{if(!e)return!1;const{filter:t,handler:s,model:i}=e;return s?i!=null:t.isFilterActive()})}getLastActiveFilterIndex(){const e=this.activeFilterIndices;return e.length>0?e[e.length-1]:null}doesFilterPass(e,t){return this.wrappers.every((s,i)=>{if(!s||t!=null&&i===t)return!0;const{handler:r,filter:n,model:o}=s;return r?o==null||r.doesFilterPass({...e,model:o,handlerParams:s.handlerParams}):!n.isFilterActive()||n.doesFilterPass(e)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map(t=>{if(!t)return null;const s=t.filter;return typeof s.getModelFromUi=="function"?s.getModelFromUi():null})}}getModel(){return this.isFilterActive()?{filterType:this.filterType,filterModels:this.wrappers.map(t=>{if(!t)return null;const{filter:s,handler:i,model:r}=t;return i?r:s.isFilterActive()?s.getModel():null})}:null}setModel(e){const t=(i,r)=>new Ut(n=>{const o=i.setModel(r);o?o.then(n):n()}),s=[];return this.wrappers.forEach((i,r)=>{if(!i)return;const n=wt(e,r),{filter:o,filterParams:a,handler:l,handlerParams:c,state:u}=i;if(l){const d={model:n,state:u?.state};i.state=d,i.model=n,s.push(sm(()=>Ut.resolve({filter:o,filterParams:a}),l,c,n,d,"api").then(()=>{this.updateActiveListForHandler(r,i.model)}))}else s.push(t(o,n).then(()=>{this.updateActiveListForFilter(r,o)}))}),Ut.all(s).then(()=>{})}applyModel(e="api"){let t=!1;for(const s of this.wrappers)if(s){const i=s.filter;i instanceof cU&&(t=i.applyModel(e)||t)}return t}getChildFilterInstance(e){return this.wrappers[e]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(const e of this.wrappers)this.destroyBean(e?.filter),this.destroyBean(e?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper(e){return e.filter}getCompFromWrapper(e){return e.comp}executeOnWrapper(e,t){e.handler?.[t]?.()}createFilter(e,t,s){const i=this.params.column;let r=null,n;const o=this.beans,a=(p,g)=>{const f=this.wrappers[t];if(!f)return;const m={model:p,state:f.state?.state};f.state=m,f.model=p,sm(()=>Ut.resolve({filter:f.filter,filterParams:f.filterParams}),f.handler,f.handlerParams,p,m,"ui").then(()=>{this.onHandlerModelChanged(t,f.model,g)})},{compDetails:l,handler:c,handlerParams:u,createFilterUi:d}=o.colFilter.createFilterInstance(i,e,"agTextColumnFilter",(p,g)=>{const f={...p,filterChangedCallback:g?()=>{}:m=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(t,m))},doesRowPassOtherFilter:m=>p.doesRowPassOtherFilter(m)&&this.doesFilterPass({node:m,data:m.data},t),getValue:Hr(o,i,e,p.getValue)};return g&&(r=wt(s,t),n=this.updateDisplayParams(f,t,r,()=>l,()=>c,a)),f});if(!d)return Ut.resolve(null);let h;if(c){const{doesRowPassOtherFilter:p,getValue:g}=u;h={...u,onModelChange:a,doesRowPassOtherFilter:f=>p(f)&&this.doesFilterPass({node:f,data:f.data},t),getValue:Hr(o,i,e,g)},c.init?.({...h,model:r,source:"init"})}return d().then(p=>{if(!c)return{filter:p,comp:p};const g=l?.params,f=n(p);return{filter:p,comp:f,filterParams:g,handler:c,handlerParams:h,model:r}})}updateDisplayParams(e,t,s,i,r,n){const o=this.params.column,a=new oU;e.model=s,e.state={model:s},e.onModelChange=n,e.getHandler=r;const l=(u,d)=>{u.state=d,a.dispatchEvent({type:"filterStateChanged",column:o,state:d})};e.onStateChange=u=>{const d=this.wrappers[t];d&&(l(d,u),dU(d.filter,d.filterParams,d.model??null,u,"ui"))};const c=(u,d,h)=>{const p=this.wrappers[t];if(!p)return;const g=()=>p?.model??null;hU({action:d,filterParams:p.filterParams,getFilterUi:()=>{const f=Ut.resolve(p.filter);return{created:!0,filterParams:p.filterParams,compDetails:i(),create:()=>f,promise:f}},getModel:g,getState:()=>p?.state??{model:g()},updateState:f=>l(p,f),updateModel:f=>p.filterParams?.onModelChange(f,h),processModelToApply:p.handler?.processModelToApply?.bind(p.handler)})};return e.onAction=(u,d,h)=>{c(o,u,d),a.dispatchEvent({type:"filterAction",column:o,action:u,event:h})},u=>{const d=i()?.params;return this.createManagedBean(new lU(o,{comp:u,params:d,isHandler:!0},a,c,!1))}}executeWhenAllFiltersReady(e){(this.wrappers?.length??0)>0?e():this.afterFiltersReadyFuncs.push(e)}updateActiveListForFilter(e,t){this.updateActiveList(e,()=>t?.isFilterActive())}updateActiveListForHandler(e,t){this.updateActiveList(e,()=>t!=null)}updateActiveList(e,t){const s=this.activeFilterIndices;aU(this.activeFilterIndices,e),t()&&s.push(e)}onFilterModelChanged(e,t){this.updateActiveListForFilter(e,this.wrappers[e]?.filter),this.filterChanged(e,t)}onHandlerModelChanged(e,t,s){this.updateActiveListForHandler(e,t),this.filterChanged(e,s)}filterChanged(e,t){this.filterChangedCallback(t),this.wrappers.forEach((s,i)=>{if(e===i||!s)return;const{filter:r,handler:n}=s;n?.onAnyFilterChanged?.(),typeof r.onAnyFilterChanged=="function"&&r.onAnyFilterChanged()})}getModelAsString(e){if(!e?.filterModels?.length)return"";const t=this.getLastActiveFilterIndex()??0;return this.wrappers[t]?.filter?.getModelAsString?.(e.filterModels[t])??""}};import{_removeFromArray as SU}from"ag-stack";import{BeanStub as bU}from"ag-grid-community";var yU=class extends vx{constructor(){super(...arguments),this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init(e){this.params=e;const t=Dt(e.filterParams);this.filterDefs=t,t.forEach((s,i)=>{const r=this.beans.colFilter.createHandler(e.column,s,"agTextColumnFilter");if(this.handlerWrappers.push(r),!r){this.warn(278,{colId:e.column.getColId()});return}const{handler:n,handlerParams:o}=r;n.init?.({...this.updateHandlerParams(o,i,!0),model:wt(e.model,i),source:"init"})}),this.resetActiveList(e.model)}refresh(e){const{model:t,source:s}=e,i=s==="colDef";if(i){const a=Dt(e.filterParams);if(Ud(this.filterDefs,a))return!1;this.filterDefs=a}const{filterDefs:r,handlerWrappers:n}=this;this.params=e;let o=!1;for(let a=0,l=n.length;a<l;++a){const c=n[a];if(!c)continue;const u=this.updateHandlerParams(e,a,!1,r[a].filterParams);c.handlerParams=u;const d=c.handler.refresh?.({...u,model:wt(t,a),source:s});o||(o=d===!1)}return o&&i?!1:(s!=="floating"&&s!=="ui"&&this.resetActiveList(t),(e.additionalEventAttributes?.fromButtons||s==="floating")&&this.onAnyFilterChanged(),!0)}updateHandlerParams(e,t,s,i){const{onModelChange:r,doesRowPassOtherFilter:n,getValue:o}=e,a={...e,onModelChange:(l,c)=>r(Vr(this.params.model,this.handlerWrappers.length,l,t),c),doesRowPassOtherFilter:l=>n(l)&&this.doesFilterPass({node:l,data:l.data,model:this.params.model,handlerParams:a},t),getValue:Hr(this.beans,e.column,this.filterDefs[t],o),filterParams:this.updateFilterParams(e,s,i)};return a}updateFilterParams(e,t,s){const i=e.filterParams;s?.buttons&&t&&this.warn(292,{colId:e.column.getColId()});const r=s?{...i,...s}:i;if(!r.buttons)return r;if(s)return delete r.buttons,r;const{buttons:n,...o}=r;return o}doesFilterPass(e,t){const s=e.model?.filterModels;return s==null?!0:this.handlerWrappers.every((i,r)=>{const n=s[r];if(n==null||t!=null&&r===t)return!0;const o=i?.handler;return!o||o.doesFilterPass({...e,model:n,handlerParams:i.handlerParams})})}resetActiveList(e){this.activeFilterIndices=[];const t=e?.filterModels;if(t!=null)for(let s=0;s<this.handlerWrappers.length;s++)t[s]!=null&&this.activeFilterIndices.push(s)}updateActiveList(e,t){const s=this.activeFilterIndices;SU(s,e),t!=null&&s.push(e)}getLastActiveFilterIndex(){const e=this.activeFilterIndices;return e.length>0?e[e.length-1]:null}getModelAsString(e,t){const s=t==="filterToolPanel",i=()=>s?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!e?.filterModels?.length)return i();const r=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[r]?.handler.getModelAsString?.(e.filterModels[r],t)??i()}getHandler(e){return this.handlerWrappers[e]?.handler}onAnyFilterChanged(){Br(this.handlerWrappers,e=>e?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){Br(this.handlerWrappers,e=>e?.handler?.onNewRowsLoaded?.())}destroy(){for(const e of this.handlerWrappers)this.destroyBean(e?.handler);this.handlerWrappers.length=0,super.destroy()}};import{BeanStub as wU,_getDefaultSimpleFilter as xU,_getFilterParamsForDataType as FU}from"ag-grid-community";var TU=class extends Cx{constructor(){super(...arguments),this.beanName="multiFilter"}getParamsForDataType(e,t,s,i){let r=e?.filters;const n=this.beans;r||(r=[{filter:xU(s.baseDataType)},{filter:"agSetColumnFilter"}]);const o=this.getLocaleTextFunc();return r=r.map(a=>{const{filter:l,filterParams:c,filterValueGetter:u}=a;if(typeof l!="string")return a;const{filterParams:d,filterValueGetter:h}=FU(l,c,u??t,s,i,n,o);return{...a,filterParams:d,filterValueGetter:h}}),{filterParams:{...e,filters:r}}}};import{AgPromise as Vl,_getFilterDetails as AU,_isUseApplyButton as PU,_refreshFilterUi as RU}from"ag-grid-community";var nm=class extends im{constructor(){super(...arguments),this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init(e){this.params=e;const t=Dt(e).map(i=>{if(i.filterParams?.buttons){this.beans.log.warn(292,{colId:e.column.getColId()});const r={...i.filterParams};return delete r.buttons,{...i,filterParams:r}}return i});this.filterDefs=t,this.allState=e.state;const s=this.filterDefs.map((i,r)=>this.createFilter(i,r));return new Vl(i=>{Vl.all(s).then(r=>{if(!this.isAlive()){this.destroyBeans(r??[]),i();return}this.filters=r,this.refreshGui("columnMenu").then(()=>{i()})})})}refresh(e){const{model:t,state:s,source:i}=e;if(i==="colDef")return!1;this.params=e;const r=this.filterParams;if(s===this.allState)return!0;this.allState=s;const n=s.state;return this.filters.forEach((o,a)=>{const l=wt(t,a),c={state:n?.[a],model:wt(s.model,a)};RU(o,r[a],l,c,i)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance(e){return this.filters[e]??void 0}getNumChildFilters(){return this.filters.length}destroy(){this.filters=this.destroyBeans(this.filters),super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper(e){return e}getCompFromWrapper(e){return e}createFilter(e,t){const s=this.beans.userCompFactory,i=this.updateParams(e,this.params,t),r=AU(s,e,i,"agTextColumnFilter");return r?(this.filterParams[t]=r.params,r.newAgStackInstance()):Vl.resolve(null)}updateParams(e,t,s){const{doesRowPassOtherFilter:i,model:r,onModelChange:n,state:o,onStateChange:a,column:l,source:c,onAction:u,onUiChange:d,getValue:h}=t,p=wt(r,s),g=o?{model:wt(o.model,s),state:o.state?.[s]}:{model:p},f=()=>{const v=this.getHandler();this.filters.forEach((C,S)=>{s!==S&&(v.getHandler(S)?.onAnyFilterChanged?.(),C?.onAnyFilterChanged?.())})},m=this.beans.colFilter;return{...m.createBaseFilterParams(l),...e,doesRowPassOtherFilter:v=>i(v)&&this.getHandler().doesFilterPass({node:v,data:v.data,model:this.params.model,handlerParams:m.getHandlerParams(l)},s),model:p,state:g,onModelChange:(v,C)=>{const{filters:S,params:w}=this,b=Vr(w.model,S.length,v,s);this.updateActiveList(s,v),n(b,C),f()},onStateChange:v=>this.onStateChange(a,s,v),getHandler:()=>this.getHandler().getHandler(s),onAction:(v,C,S)=>{if(PU(t))return;const w=v==="apply"||v==="reset";w&&this.updateActiveList(s,wt(this.params.state.model,s)),u(v,C,S),w&&f()},onUiChange:d,source:c,getValue:Hr(this.beans,l,e,h)}}updateActiveList(e,t){this.getHandler().updateActiveList?.(e,t)}getHandler(){return this.params.getHandler()}onStateChange(e,t,s){const{model:i,state:r,valid:n}=s,o=this.validity;o[t]=n;const a=this.allState,l=Vr(a.model,this.filters.length,i,t),c=o.every(h=>h!==!1),u=[...a.state??[]];u[t]=r;const d={state:u,model:l,valid:c};this.allState=d,e(d)}getModelAsString(e){return this.getHandler().getModelAsString?.(e)??""}};import{_clearElement as MU,_setDisplayed as zi}from"ag-stack";import{AgPromise as IU,Component as EU,_getDefaultFloatingFilterType as DU,_getFloatingFilterCompDetails as LU,_mergeDeep as kU}from"ag-grid-community";var _U={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},GU=class extends Sx{constructor(){super(_U),this.floatingFilters=[],this.compDetailsList=[]}init(e){this.params=e;const{compDetailsList:t}=this.getCompDetailsList(e);return this.setParams(t)}setParams(e){const t=[];return e.forEach(s=>{const i=s?.newAgStackInstance();i!=null&&(this.compDetailsList.push(s),t.push(i))}),IU.all(t).then(s=>{s.forEach((i,r)=>{this.floatingFilters.push(i);const n=i.getGui();this.appendChild(n),r>0&&zi(n,!1)})})}refresh(e){this.params=e;const{compDetailsList:t,floatingFilterParamsList:s}=this.getCompDetailsList(e);if(t.length===this.compDetailsList.length&&t.every((r,n)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[n],r))){if(s.forEach((r,n)=>{this.floatingFilters[n].refresh?.(r)}),this.gos.get("enableFilterHandlers")){const r=e;if(r.model==null)this.floatingFilters.forEach((n,o)=>{zi(n.getGui(),o===0)});else{const n=r.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((o,a)=>{const l=n==null?a===0:a===n;zi(o.getGui(),l)})}}}else MU(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(t)}getCompDetailsList(e){const t=[],s=[],i=e.filterParams,r=e.currentParentModel,n=Dt(i);return n.forEach((o,a)=>{const l={...e,parentFilterInstance:u=>{this.parentMultiFilterInstance(d=>{const h=d.getChildFilterInstance(a);h!=null&&u(h)})},currentParentModel:()=>r()?.filterModels?.[a]??null};if(this.gos.get("enableFilterHandlers")){const u=l;u.model=u.model?.filterModels?.[a]??null;const{onModelChange:d,getHandler:h}=u;u.onModelChange=(p,g)=>d(Vr(this.params.model,n.length,p,a),g),u.getHandler=()=>h().getHandler(a)}kU(l.filterParams,o.filterParams);const c=this.getCompDetails(o,l);c&&(t.push(c),s.push(l))}),{compDetailsList:t,floatingFilterParamsList:s}}onParentModelChanged(e,t){t?.afterFloatingFilter||this.parentMultiFilterInstance(s=>{if(e==null)this.floatingFilters.forEach((i,r)=>{i.onParentModelChanged(null,t),zi(i.getGui(),r===0)});else{const i=s.getLastActiveFilterIndex();this.floatingFilters.forEach((r,n)=>{const o=e.filterModels.length>n?e.filterModels[n]:null;r.onParentModelChanged(o,t);const a=i==null?n===0:n===i;zi(r.getGui(),a)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(e,t){const{colFilter:s,frameworkOverrides:i,userCompFactory:r}=this.beans,n=DU(i,e,()=>s.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return LU(r,e,t,n)}parentMultiFilterInstance(e){this.params.parentFilterInstance(t=>{t instanceof rm||t instanceof nm||this.beans.log.error(120),e(t)})}},om={moduleName:"MultiFilter",version:G,userComponents:{agMultiColumnFilter:{getComp:e=>e.gos.get("enableFilterHandlers")?{classImp:nm,params:{useForm:!0}}:rm},agMultiColumnFloatingFilter:GU},beans:[TU],dynamicBeans:{agMultiColumnFilterHandler:yU},dependsOn:[$,nU,rn]};import{_ColumnFilterModule as OU,_PopupModule as NU}from"ag-grid-community";import{_exists as BU}from"ag-stack";import{BeanStub as VU}from"ag-grid-community";var HU=class extends bx{constructor(){super(...arguments),this.beanName="aggColNameSvc"}getHeaderName(e,t){if(this.gos.get("suppressAggFuncInHeader"))return t;const{valueColsSvc:s,colModel:i,rowGroupColsSvc:r}=this.beans,n=e.pivotValueColumn,o=BU(n);let a=null,l;if(o){const c=s?.columns??[],u=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&c.length===1,d=e.colDef.pivotTotalColumnIds!==void 0;if(u&&!d)return t;a=n?n.getAggFunc():null,l=!0}else{const c=e.isValueActive(),u=r?.columns.length!==0,d=i.pivotMode||u||this.gos.get("treeData");c&&d?(a=e.aggFunc,l=!0):l=!1}if(l){const c=typeof a=="string"?a:"func";return`${this.getLocaleTextFunc()(c,c)}(${t})`}return t}};import{_exists as am,_last as UU}from"ag-stack";import{BeanStub as zU}from"ag-grid-community";var lm={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},WU=["sum","avg","max","min","count","first","last"],$U=class extends yx{constructor(){super(...arguments),this.beanName="aggFuncSvc",this.aggFuncsMap=new Map,this.orderedFuncNames=[],this.initialised=!1}postConstruct(){this.init()}init(){this.initialised||(this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs")))}initialiseWithDefaultAggregations(){const e=this.aggFuncsMap;e.set("sum",KU),e.set("first",jU),e.set("last",YU),e.set("min",qU),e.set("max",XU),e.set("count",JU),e.set("avg",ez),this.initialised=!0,this.updateOrderedFuncNames()}getDefaultFuncLabel(e){return lm[e]??e}getDefaultAggFunc(e){const t=e.colDef.defaultAggFunc,s=r=>am(this.aggFuncsMap.get(r))&&this.getFuncNames(e).includes(r);if(am(t)&&s(t))return t;if(s("sum"))return"sum";const i=this.getFuncNames(e);return i?.length?i[0]:null}addAggFuncs(e){if(this.init(),!!e){for(const t of Object.keys(e))e[t]&&this.aggFuncsMap.set(t,e[t]);this.updateOrderedFuncNames()}}getAggFunc(e){return this.init(),this.aggFuncsMap.get(e)}getFuncNames(e){return e.colDef.allowedAggFuncs??this.orderedFuncNames.slice()}updateOrderedFuncNames(){const e=[];for(const t of WU)this.aggFuncsMap.has(t)&&e.push(t);for(const t of[...this.aggFuncsMap.keys()].sort())t in lm||e.push(t);this.orderedFuncNames=e}clear(){this.aggFuncsMap.clear(),this.orderedFuncNames=[]}};function KU(e){const{values:t}=e;let s=null;for(let i=0;i<t.length;i++){const r=t[i];typeof r=="number"?s===null?s=r:s+=typeof s=="number"?r:BigInt(r):typeof r=="bigint"&&(s===null?s=r:s=(typeof s=="bigint"?s:BigInt(s))+r)}return s}function jU(e){return e.values.length>0?e.values[0]:null}function YU(e){return e.values.length>0?UU(e.values):null}function qU(e){const{values:t}=e;let s=null;for(let i=0;i<t.length;i++){const r=t[i];(typeof r=="number"||typeof r=="bigint")&&(s===null||s>r)&&(s=r)}return s}function XU(e){const{values:t}=e;let s=null;for(let i=0;i<t.length;i++){const r=t[i];(typeof r=="number"||typeof r=="bigint")&&(s===null||s<r)&&(s=r)}return s}var ZU=Object.freeze({toString:function(){return this.value.toString()},toNumber:function(){return this.value}});function JU(e){const{values:t}=e;let s=0;for(let n=0;n<t.length;n++){const o=t[n];s+=o!=null&&typeof o.value=="number"?o.value:1}const i=e.rowNode?.aggData?.[e.column.getColId()];if(i?.value===s)return i;const r=Object.create(ZU);return r.value=s,r}var QU=Object.freeze({toString:function(){return typeof this.value=="number"||typeof this.value=="bigint"?this.value.toString():""},toNumber:function(){return this.value}});function ez(e){const{values:t}=e;let s=0,i=0;for(let a=0;a<t.length;a++){const l=t[a];let c=null;typeof l=="number"||typeof l=="bigint"?(c=l,i++):l!=null&&(typeof l.value=="number"||typeof l.value=="bigint")&&typeof l.count=="number"&&(c=l.value*(typeof l.value=="number"?l.count:BigInt(l.count)),i+=l.count),typeof c=="number"?s+=typeof s=="number"?c:BigInt(c):typeof c=="bigint"&&(s=(typeof s=="bigint"?s:BigInt(s))+c)}let r=null;i>0&&(r=s/(typeof s=="number"?i:BigInt(i)));const n=e.rowNode?.aggData?.[e.column?.getColId()];if(n?.count===i&&n.value===r)return n;const o=Object.create(QU);return o.count=i,o.value=r,o}import{BeanStub as tz,_getGroupAggFiltering as sz}from"ag-grid-community";var iz=class extends wx{constructor(){super(...arguments),this.beanName="aggChildrenSvc"}getAggregatedChildren(e,t,s){if(!e?.group)return[];if(e.rowPinned&&(e=e.pinnedSibling,!e))return[];const i=this.gos,r=cm(e,t,i);if(!s)return r;const n=[];return um(r,t,i,n),n}},cm=(e,t,s)=>{const i=t?.colDef,r=i?.pivotKeys;return r?e.leafGroup&&r.length&&!i.pivotTotalColumnIds?Tp(e.childrenMapped,r):e.childrenAfterFilter??e.childrenAfterGroup??[]:sz(s)||s.get("suppressAggFilteredOnly")?e.childrenAfterGroup??[]:e.childrenAfterFilter??e.childrenAfterGroup??[]},um=(e,t,s,i)=>{for(let r=0,n=e.length;r<n;++r){const o=e[r];o.group?um(cm(o,t,s),t,s,i):i.push(o)}};function rz(e,t){e.aggFuncSvc&&e.aggFuncSvc.addAggFuncs(t)}function nz(e){e.aggFuncSvc&&e.aggFuncSvc.clear()}function oz(e,t,s){e.valueColsSvc?.setColumnAggFunc?.(t,s,"api")}import{BeanStub as az,_forEachChangedGroupDepthFirst as dm,_getGrandTotalRow as lz,_getGroupAggFiltering as cz}from"ag-grid-community";var uz=class extends xx{constructor(){super(...arguments),this.beanName="aggStage",this.step="aggregate",this.refreshProps=["getGroupRowAgg","alwaysAggregateAtRootLevel","suppressAggFilteredOnly","grandTotalRow"],this.hadAgg=!1,this.prevValueColumns=null}destroy(){super.destroy(),this.prevValueColumns=null}refreshAggregateDependentCells(e,t){const s=this.beans,i=this.hadAgg,r=s.visibleCols.allCols;let n=!1;for(let a=0,l=r.length;a<l;++a){const c=r[a];if(c.showValuesAs!=null||i&&c.valueGetter!=null){n=!0;break}}if(!n)return;const o=s.rowRenderer.getAllRowCtrls();for(let a=0,l=o.length;a<l;++a){const c=o[a],u=c.rowNode;if(e?.has(u)||t?.hasRow(u))continue;const d=c.getAllCellCtrls();for(let h=0,p=d.length;h<p;++h){const g=d[h],f=g.column;(f.showValuesAs!=null||i&&f.valueGetter!=null)&&g.refreshOrDestroyCell(gz)}}}execute(e){this.aggregate(e,!1)}aggregateRootOnly(){this.aggregate(void 0,!0)}aggregate(e,t){const{gos:s,beans:i}=this,r=s.getCallback("getGroupRowAgg"),n=i.valueColsSvc?.columns;if(!n?.length&&!r){if(this.prevValueColumns=null,this.hadAgg&&!e&&!t){this.hadAgg=!1;const x=i.colModel,F=i.rowModel;dm(F.rootNode,F.hierarchical,void 0,A=>{Ap(A,null,x)})}return}this.hadAgg=!0;const o=i.colModel,a=i.aggFuncSvc,l=t||s.get("alwaysAggregateAtRootLevel")||!!lz(s)||o.pivotMode,c=!cz(s)&&!s.get("suppressAggFilteredOnly"),u=i.valueSvc,d=i.gridApi,h=i.gridOptions.context,p=n??[],g=p.length,f=e?.kind==="cells"?e:void 0;let m;const v=new Array(g);for(let x=0;x<g;++x){const F=p[x],A=f?f.getSlot(F.colId):-1;A>=0&&(m=f),v[x]={column:F,colId:F.colId,colDef:F.colDef,aggFunc:hm(F.aggFunc,a,F,i),colSlot:A}}const C=pz(o,i.pivotResultCols,a,i),S=this.prevValueColumns;let w;C||r||!n?this.prevValueColumns=null:(!t&&!e&&(this.prevValueColumns=n),w={cols:v,checkRemoved:S!==n});const b=g>0?new Array(g):null,y=i.rowModel,T=x=>{if(x.level===-1&&!l){Ms(x,null,o);return}let F;r?F=r({nodes:x.childrenAfterFilter}):b?C?F=hz(x,C,u,d,h):F=dz(x,v,g,b,m,c,u,d,h):F=null,Ap(x,F,o,w)};if(t){const x=y.rootNode;x&&T(x);return}dm(y.rootNode,y.hierarchical,e,T)}},dz=(e,t,s,i,r,n,o,a,l)=>{const c=(n?e.childrenAfterFilter:e.childrenAfterGroup)??[],u=c.length,d=e.data,h=Object.create(null),p=r?r.getSlot(e):-1,g=p>=0?e.aggData:void 0;let f=0;for(let m=0;m<s;++m){const v=t[m];p>=0&&!r.hasCellBySlot(p,v.colSlot)?(i[m]=null,g&&(h[v.colId]=g[v.colId])):(i[m]=new Array(u),++f)}if(f===0)return h;for(let m=0;m<u;++m){const v=c[m],C=v.aggData;if(C)for(let S=0;S<s;++S){const w=i[S];if(w!==null){const b=t[S],y=C[b.colId];w[m]=y!==void 0?y:o.getValueFromData(b.column,v)}}else for(let S=0;S<s;++S){const w=i[S];w!==null&&(w[m]=o.getValueFromData(t[S].column,v))}}for(let m=0;m<s;++m){const v=i[m];if(v===null)continue;const C=t[m],S=C.aggFunc;h[C.colId]=S?S({values:v,column:C.column,colDef:C.colDef,rowNode:e,data:d,aggregatedChildren:c,api:a,context:l}):null}return h},hz=(e,t,s,i,r)=>{const n=t.length,o=e.leafGroup,a=e.data,l=e.childrenMapped,c=e.childrenAfterFilter??[],u=Object.create(null);let d,h;for(let p=0;p<n;++p){const g=t[p],f=g.column,m=g.colId,v=g.totalColIds;let C,S;if(v!=null){const b=v.length;C=new Array(b);for(let y=0;y<b;++y)C[y]=u[v[y]];S=c}else if(o){const b=g.pivotKeys;(!h||b!==d)&&(d=b,h=Tp(l,b)),S=h;const y=S.length;C=new Array(y);for(let T=0;T<y;++T)C[T]=s.getValueFromData(f,S[T])}else{S=c;const b=S.length;C=new Array(b);for(let y=0;y<b;++y){const T=S[y],x=T.aggData,F=x?x[m]:void 0;C[y]=F!==void 0?F:s.getValueFromData(f,T)}}const w=g.aggFunc;u[m]=w?w({values:C,column:f,colDef:g.colDef,pivotResultColumn:g.pivotResultCol,rowNode:e,data:a,aggregatedChildren:S,api:i,context:r}):null}return u},hm=(e,t,s,i)=>{if(typeof e=="function")return e;if(e==null)return null;const r=t.getAggFunc(e);return typeof r!="function"?(i.log.warn(109,{inputValue:e.toString(),allSuggestions:t.getFuncNames(s)}),null):r},pz=(e,t,s,i)=>{if(!e.isPivotActive())return null;const r=t?.getAggregationOrderedList();if(!r||r.length===0)return null;const n=r.length,o=new Array(n);let a=0;for(let l=0;l<n;++l){const c=r[l],u=c.pivotValueColumn;if(!u)continue;const d=c.colDef;o[a++]={column:u,colId:c.colId,colDef:u.colDef,aggFunc:hm(u.aggFunc,s,u,i),pivotResultCol:c,pivotKeys:d.pivotKeys,totalColIds:d.pivotTotalColumnIds}}return a===0?null:(o.length=a,o)},gz={force:!1,newData:!1};import{BeanStub as fz,_forEachChangedGroupDepthFirst as mz,_getGroupAggFiltering as vz}from"ag-grid-community";var Cz=class extends Fx{constructor(){super(...arguments),this.beanName="filterAggStage",this.step="filter_aggregates",this.refreshProps=[],this.setAllChildrenCountTreeData=e=>{const t=e.childrenAfterAggFilter;let s=0;if(t){const r=t.length;s=r;for(let n=0;n<r;++n)s+=t[n].allChildrenCount??0}const i=s===0&&e.level>=0?null:s;e.setAllChildrenCount(i),e.pinnedSibling?.setAllChildrenCount(i)},this.setAllChildrenCountGridGrouping=e=>{const t=e.childrenAfterAggFilter;let s=0;for(let i=0,r=t.length;i<r;++i){const n=t[i];n.group?s+=n.allChildrenCount:s++}e.setAllChildrenCount(s),e.pinnedSibling?.setAllChildrenCount(s)}}wireBeans(e){this.filterManager=e.filterManager}execute(e){const{rowModel:t,colModel:s,groupStage:i}=this.beans,{filterManager:r}=this,n=s.pivotMode,o=r?.isAggregateFilterPresent()||r?.isAggregateQuickFilterPresent(),a=!!i?.treeData,l=g=>!g.node.group,c=g=>g.node.leafGroup,u=vz(this.gos)||(n?c:l),d=a?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,h=(g,f=!1)=>{if(g.childrenAfterFilter){if(g.childrenAfterAggFilter=g.childrenAfterFilter,f){const m=g.childrenAfterAggFilter;for(let v=0,C=m.length;v<C;++v)h(m[v],f)}g.hasChildren()?d(g):(g.setAllChildrenCount(null),g.pinnedSibling?.setAllChildrenCount(null))}g.sibling&&(g.sibling.childrenAfterAggFilter=g.childrenAfterAggFilter)},p=g=>{g.childrenAfterAggFilter=g.childrenAfterFilter?.filter(f=>u({node:f})&&r.doesRowPassAggregateFilters({rowNode:f})?(h(f,!0),!0):f.childrenAfterAggFilter?.length)||null,g.hasChildren()?d(g):(g.setAllChildrenCount(null),g.pinnedSibling?.setAllChildrenCount(null)),g.sibling&&(g.sibling.childrenAfterAggFilter=g.childrenAfterAggFilter)};mz(t.rootNode,t.hierarchical,e,o?p:h)}};import{BeanStub as Sz,_addGridCommonParams as bz,_getGrandTotalRow as yz,_getGroupTotalRowCallback as wz}from"ag-grid-community";import{GROUP_TOTAL_ROW_ID_PREFIX as xz,_createRowNodeSibling as Fz}from"ag-grid-community";function dt(e,t,s){let i=e.sibling;return i||(i=Fz(e,t),i.footer=!0,i.setRowTop(null),i.setRowIndex(null),i.oldRowTop=null,i.id=s??xz+e.id,i.sibling=e,e.sibling=i,i)}function Hl(e){const t=e.sibling;t&&(t._destroy(!1),e.sibling=void 0)}var Tz=class extends Tx{constructor(){super(...arguments),this.beanName="footerSvc"}addTotalRows(e,t,s,i,r,n){let o=e;if(r){const c=i&&yz(this.gos);return Az(n,c)&&s(dt(t,this.beans),o++),o}const a=wz(this.gos);return(i&&a({node:t}))===n&&s(dt(t,this.beans),o++),o}getTopDisplayIndex(e,t,s,i){let r=t;if(e[0].footer){if(t===0)return 0;r-=1}const n=e[e.length-1],o=r>=s.length;return n.footer&&o?n.rowIndex:i(r)}doesCellShowTotalPrefix(e,t){return!e.footer||!t?.getColDef().showRowGroup?!1:this.gos.get("treeData")?!0:e.level===-1?this.beans.showRowGroupCols?.columns[0]===t:!!e.rowGroupColumn&&t?.isRowGroupDisplayed(e.rowGroupColumn.getId())}applyTotalPrefix(e,t,s,i){const r=i.getColDef().cellRendererParams?.totalValueGetter;if(r){const n=bz(this.gos,{column:i,node:s,value:e,formattedValue:t});if(typeof r==="function")return r(n);if(typeof r=="string")return this.beans.expressionSvc?.evaluate(r,n);this.warn(179)}return s.level===-1?this.getLocaleTextFunc()("footerTotal","Total")+" ":this.getTotalValue(t??e)??""}getTotalValue(e){return this.getLocaleTextFunc()("footerTotal","Total")+" "+(e??"")}};function Az(e,t){switch(t){case"top":case"pinnedTop":return e==="top";case"bottom":case"pinnedBottom":return e==="bottom";default:return!1}}import{_indexMap as Pz}from"ag-stack";import{BeanStub as Rz,_dispatchColumnChangedEvent as Mz}from"ag-grid-community";var pm=class extends Ax{constructor(){super(...arguments),this.activeColSet=new Set,this.colsCache=null,this.extractColsWithIndex=null,this.extractColsWithValue=null,this.pendingChanged=null,this.reindexPending=!1,this.pendingStateOrder=null,this.pendingStateChanged=!1,this.compareByStateIndex=(e,t)=>{const s=this.pendingStateOrder;if(!s)return 0;const i=s.get(e),r=s.get(t);return i==null?r==null?0:1:r==null?-1:i-r}}extractAddColWithIndex(e,t){let s=this.extractColsWithIndex;s===null&&(s=[],this.extractColsWithIndex=s),s.push({col:e,key:t})}extractAddColWithValue(e){let t=this.extractColsWithValue;t===null&&(t=new Set,this.extractColsWithValue=t),t.add(e)}bucketByKey(e,t){t!=null?this.extractAddColWithIndex(e,t):this.extractAddColWithValue(e)}get columns(){let e=this.colsCache;return e===null&&(e=Array.from(this.activeColSet),this.colsCache=e),e}wireBeans(e){this.colModel=e.colModel}resetActiveCols(e){this.activeColSet=new Set(e),this.colsCache=e}setColActive(e,t,s,i=!1){return this.writeColActive(e,t,s)?(t?this.activeColSet.add(e):this.activeColSet.delete(e),i&&this.onColActiveChanged(e,t,s),this.colsCache=null,!0):!1}onColActiveChanged(e,t,s){}applyActiveCols(e,t,s,i,r){for(let n=0,o=e.length;n<o;++n){const a=e[n];!t.has(a)&&this.writeColActive(a,!1,i)&&r&&this.onColActiveChanged(a,!1,i)}for(const n of t)this.writeColActive(n,!0,i)&&r&&this.onColActiveChanged(n,!0,i);this.activeColSet=t,this.colsCache=s}onColActiveChangesComplete(e){}onColumnsChanged(){}stageChangedColsBetween(e,t){const s=Pz(t),i=e.length>0?new Set(e):null;let r=null,n=!1;for(let o=0,a=e.length;o<a;++o){const l=e[o],c=s.get(l);c===void 0?(n=!0,r??(r=this.pendingColChangeSet()),r.add(l)):c!==o&&(r??(r=this.pendingColChangeSet()),r.add(l))}for(let o=0,a=t.length;o<a;++o){const l=t[o];i?.has(l)||(n=!0,r??(r=this.pendingColChangeSet()),r.add(l))}return r===null?"none":(this.reindexPending=!0,n?"membership":"reorder")}setColumns(e,t){const s=e??[],i=this.colModel;if(i.colsList.length===0)return;const r=this.columns,n=[];for(let c=0,u=s.length;c<u;++c){const d=i.getNonPivotCol(s[c]);d&&n.push(d)}const o=this.expandActiveCols(n),a=Array.from(o),l=this.stageChangedColsBetween(r,a);l!=="none"&&(this.applyActiveCols(r,o,a,t,!0),i.flushColChanges(t,l))}seatActiveCol(e,t){e.add(t)}expandActiveCols(e){const t=new Set;for(let s=0,i=e.length;s<i;++s)this.seatActiveCol(t,e[s]);return t}stageColChange(e){this.reindexPending=!0,this.pendingColChangeSet().add(e)}stageColChanges(e){this.reindexPending=!0;const t=this.pendingColChangeSet();for(const s of e)t.add(s)}recordColChange(e){this.pendingColChangeSet().add(e)}pendingColChangeSet(){let e=this.pendingChanged;return e===null&&(e=new Set,this.pendingChanged=e),e}flushReindex(){this.reindexPending&&(this.reindexPending=!1,this.onColumnsChanged())}dispatchColChange(e){this.onColActiveChangesComplete(e);const t=this.pendingChanged;t&&(this.pendingChanged=null,Mz(this.eventSvc,this.eventName,Array.from(t),e))}addColumns(e,t){this.updateColList(e,!0,t)}removeColumns(e,t){this.updateColList(e,!1,t)}updateColList(e,t,s){if(!e||e.length===0)return;const i=this.colModel,r=new Set,n=t?null:this.columns;let o=!1;for(let a=0,l=e.length;a<l;++a){const c=e[a];if(!c)continue;const u=i.getNonPivotCol(c);if(u&&(r.add(u),this.setColActive(u,t,s,!0)&&(o=!0,!t)))for(let d=n.indexOf(u)+1,h=n.length;d<h;++d)r.add(n[d])}o&&(this.stageColChanges(r),i.flushColChanges(s,"membership"))}commitExtract(e){const t=this.extractColsWithIndex,s=this.extractColsWithValue,i=this.activeColSet,r=this.columns,n=new Set;if(t!==null){t.length>1&&t.sort((o,a)=>o.key-a.key);for(let o=0,a=t.length;o<a;++o)this.seatActiveCol(n,t[o].col)}if(s!==null){for(let o=0,a=r.length;o<a;++o){const l=r[o];s.has(l)&&this.seatActiveCol(n,l)}for(const o of s)i.has(o)||this.seatActiveCol(n,o)}this.applyActiveCols(r,n,null,e,!1),this.onColumnsChanged(),this.extractColsWithIndex=null,this.extractColsWithValue=null}recordPendingStateOrder(e,t){let s=this.pendingStateOrder;s===null&&(s=new Map,this.pendingStateOrder=s),s.set(e,t),this.pendingStateChanged=!0}sortByPendingState(){if(!this.pendingStateChanged)return;this.pendingStateChanged=!1;const e=this.columns;e.length>0&&this.sortPendingCols(e)&&this.resetActiveCols(e),this.onColumnsChanged(),this.pendingStateOrder=null}sortPendingCols(e){return this.pendingStateOrder?(e.sort(this.compareByStateIndex),!0):!1}},Ul=0,Iz=1,zl=2,Wi=(e,t)=>e.aggFunc===t?!1:(e.aggFunc=t,e.dispatchStateUpdatedEvent("aggFunc"),!0),gm=class extends pm{constructor(){super(...arguments),this.beanName="valueColsSvc",this.eventName="columnValueChanged"}wireBeans(e){super.wireBeans(e),this.aggFuncSvc=e.aggFuncSvc}extractCol(e,t){const s=e.colDef,i=s.aggFunc;let r;if(i!==void 0)r=i!==null&&i!=="";else if(t){const n=s.initialAggFunc;r=n!=null&&n!==""}else r=e.aggregationActive;if(!r){const n=e.showValuesAs?.def.defaultAggFunc;n&&(this.bucketCol(e,t),e.aggFunc||Wi(e,n));return}this.bucketCol(e,t),i!=null&&i!==""?Wi(e,i):e.aggFunc||Wi(e,s.initialAggFunc)}bucketCol(e,t){const s=e.colDef,i=s.valueIndex??(t?s.initialValueIndex:null);this.bucketByKey(e,i)}onColActiveChanged(e,t){const s=this.aggFuncSvc;t&&s&&!e.aggFunc&&Wi(e,s.getDefaultAggFunc(e))}writeColActive(e,t,s){return e.aggregationActive===t?!1:(e.aggregationActive=t,e.dispatchColEvent(this.eventName,s),!0)}setColumnAggFunc(e,t,s){if(!e)return;const i=this.colModel.getNonPivotCol(e);if(!i)return;const r=this.applyAggFunc(i,t,s);if(r===Ul)return;const n=r===zl;n?this.stageColChange(i):this.recordColChange(i),this.colModel.flushColChanges(s,n?"membership":"dispatch")}syncColState(e,t,s,i){const r=t?.aggFunc,n=r!==void 0?r:s?.aggFunc,o=t?.valueIndex,a=o!==void 0?o:s?.valueIndex;if(!(n===void 0&&a===void 0)){if(n!==void 0){if(typeof n!="string"&&n!=null){this.warn(33);return}this.applyAggFunc(e,n,i)}else typeof a=="number"&&!e.aggregationActive&&this.setColActive(e,!0,i,!0);typeof a=="number"&&e.aggregationActive&&this.recordPendingStateOrder(e,a)}}onColumnsChanged(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)e[t].aggregationActiveIndex=t}applyAggFunc(e,t,s){if(t!=null&&t!==""){const i=Wi(e,t);return this.setColActive(e,!0,s)?zl:i?Iz:Ul}return this.setColActive(e,!1,s)?zl:Ul}},Wl={moduleName:"SharedAggregation",version:G,beans:[$U,HU,Tz,gm],apiFunctions:{addAggFuncs:rz,clearAggFuncs:nz,setColumnAggFunc:oz},dependsOn:[$]},fm={moduleName:"AggregationStage",version:G,beans:[uz],rowModels:["clientSide"],dependsOn:[Wl]},$l={moduleName:"Aggregation",version:G,beans:[Cz,iz],rowModels:["clientSide"],dependsOn:[fm]},mm=class extends pm{writeColActive(e,t,s){return this.setActiveFlag(e,t)?(e.dispatchColEvent(this.eventName,s),e.dispatchStateUpdatedEvent(this.enableProp),!0):!1}wireBeans(e){super.wireBeans(e),this.groupHierarchCols=e.groupHierarchyColSvc}getActiveHierarchyCols(){const e=this.groupHierarchCols;return e?.columns.length?e:void 0}extractCol(e,t){const s=e.colDef,i=this.indexProp,r=this.initialIndexProp;let n=vm(s[this.enableProp],s[i]);if(n===void 0&&(n=t?vm(s[this.initialEnableProp],s[r]):this.activeColSet.has(e)),!n)return;const o=s[i]??(t?s[r]:null);this.bucketByKey(e,o)}getActiveVirtuals(e){return this.groupHierarchCols?.getVirtualCols(e)}seatActiveCol(e,t){const s=this.getActiveVirtuals(t);if(s!==void 0)for(let i=0,r=s.length;i<r;++i)e.add(s[i]);e.add(t)}setColActive(e,t,s,i=!1){if(t){const r=this.getActiveVirtuals(e);if(r!==void 0){const n=this.activeColSet;for(let o=0,a=r.length;o<a;++o){const l=r[o];n.add(l),this.writeColActive(l,!0,s)}}}return super.setColActive(e,t,s,i)}syncColState(e,t,s,i){const r=this.enableProp,n=this.indexProp;let o=t?.[r],a=t?.[n];o===void 0&&a===void 0&&(s&&(o=s[r],a=s[n]),o===void 0&&a===void 0)||(typeof a=="number"?(this.setColActive(e,!0,i),this.recordPendingStateOrder(e,a)):this.setColActive(e,!!o,i)&&(this.pendingStateChanged=!0))}sortPendingCols(e){const t=this.getActiveHierarchyCols();return t?(e.sort((s,i)=>t.compareVirtualColumns(s,i)??this.compareByStateIndex(s,i)),!0):super.sortPendingCols(e)}restoreColumnOrder(e,t){const s=this.columns;if(!s.length)return;const i=this.enableProp==="rowGroup",r=this.indexProp,n=new Set(Object.keys(e)),o=new Set(n);for(let f=0,m=s.length;f<m;++f){const v=s[f].colId;n.delete(v),o.add(v)}const a=[],l=Object.create(null);let c=0;const u=this.colModel.colDefList;for(let f=0,m=u.length;f<m;++f){const v=u[f].colId;o.has(v)&&(a.push(v),l[v]=c++)}let d=1e3,h=!1,p=0;const g=f=>{const m=l[f];for(let v=p;v<m;++v){const C=a[v];n.has(C)&&(e[C][r]=d++,n.delete(C))}p=m};for(let f=0,m=s.length;f<m;++f){const v=s[f],C=v.colId;if(e[C]?.colId!=null){g(C),e[C][r]=d++;continue}const S=v.colDef,w=i?S.rowGroupIndex:S.pivotIndex,b=i?S.initialRowGroupIndex:S.initialPivotIndex;if(w===null||w===void 0&&b==null){if(!h){const y=i?S.rowGroup:S.pivot,T=i?S.initialRowGroup:S.initialPivot;if(y||y===void 0&&T)g(C);else{for(const F of n)e[F][r]=d+l[F];d+=a.length,h=!0}}t[C]||(t[C]={colId:C}),t[C][r]=d++}}}};function vm(e,t){if(e!==void 0)return!!e;if(t!==void 0)return t!==null&&t>=0}var Cm=class extends mm{constructor(){super(...arguments),this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.enableProp="pivot",this.indexProp="pivotIndex",this.initialEnableProp="initialPivot",this.initialIndexProp="initialPivotIndex",this.hasPivotComparator=!1}postConstruct(){this.addManagedEventListeners({columnValueChanged:()=>{const e=this.beans;e.colModel.pivotMode&&e.sortSvc?.invalidate()}})}setActiveFlag(e,t){return e.pivotActive===t?!1:(e.pivotActive=t,!0)}onColumnsChanged(){const e=this.columns;let t=!1;for(let s=0,i=e.length;s<i;++s){const r=e[s];r.pivotActiveIndex=s,t||(t=r.colDef.pivotComparator!=null)}this.hasPivotComparator=t}hasInteractivePivotSort(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)if(e[t].pivotSort!==void 0)return!0;return!1}isStrictColumnOrder(){return this.hasPivotComparator&&!!this.gos.get("enableStrictPivotColumnOrder")||this.hasInteractivePivotSort()}reRankByPivotGroupOrder(e,t,s){const i=new Map;for(let l=0,c=e.length;l<c;++l){const u=Sm(e[l]);i.has(u)||i.set(u,i.size)}const r=i.size,n=[];for(let l=0,c=t.length;l<c;++l){const u=t[l],d=s[u];d!=null&&n.push({id:u,order:l,rank:i.get(Sm(d))??r})}n.sort(Ez);const o=n.length,a=new Array(o);for(let l=0;l<o;++l)a[l]=n[l].id;return a}},Sm=e=>{const t=e.colDef.pivotKeys;if(t!==void 0&&t.length>0)return t.join("");if(t!==void 0)return bm(e);let s="",i=e.originalParent;for(;i!=null;)i.isPadding()||(s=`${i.getGroupId()}\0${s}`),i=i.originalParent;return s!==""?s:bm(e)},bm=e=>`\0${e.colId}`,Ez=(e,t)=>e.rank-t.rank||e.order-t.order;import{_clamp as Dz,_shouldUpdateColVisibilityAfterGroup as Lz,dispatchColumnVisibleEvent as kz}from"ag-grid-community";var _z=class extends mm{constructor(){super(...arguments),this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.enableProp="rowGroup",this.indexProp="rowGroupIndex",this.initialEnableProp="initialRowGroup",this.initialIndexProp="initialRowGroupIndex",this.pendingVisibilityChanges=new Set}moveColumn(e,t,s){const i=this.columns,r=i.length;if(r===0||e<0||e>=r||(t=Dz(t,0,r-1),e===t))return;const n=i[e],o=i.slice();o.splice(t,0,o.splice(e,1)[0]),this.resetActiveCols(o),this.stageColChange(n),this.colModel.flushColChanges(s,"reorder")}onColActiveChanged(e,t,s){if(e.colKind!=="hierarchy"&&Lz(this.gos,t)){const i=!t;e.visible!==i&&(e.setVisible(i,s),this.pendingVisibilityChanges.add(e))}}onColActiveChangesComplete(e){const t=this.pendingVisibilityChanges;if(t.size){const s=Array.from(t);t.clear(),kz(this.eventSvc,s,e)}}setActiveFlag(e,t){return e.rowGroupActive===t?!1:(e.rowGroupActive=t,!0)}onColumnsChanged(){const e=this.columns;for(let t=0,s=e.length;t<s;++t)e[t].rowGroupActiveIndex=t}};import{AgColumn as Gz,BeanStub as Oz,GROUP_AUTO_COLUMN_ID as Kl,_addColumnDefaultAndTypes as Nz,_applyColumnState as Bz,_convertColumnEventSourceType as Vz,_getColumnStateFromColDef as Hz,_getLegacyTooltipFieldValue as Uz,_isCellTooltipConfigured as ym,_isClientSideRowModel as zz,_isColumnsSortingCoupledToGroup as Wz,_isGroupHideColumnsUntilExpanded as $z,_isGroupMultiAutoColumn as Kz,_isGroupUseEntireRow as jz,_mergeDeep as Yz,_resolveGroupTooltipValue as qz}from"ag-grid-community";var jl=e=>!!e&&(e.tooltipComponent!=null||e.tooltipComponentSelector!=null),Xz=class extends Px{constructor(){super(...arguments),this.beanName="autoColSvc",this.columns=[],this.modelEverUpdated=!1}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){const e=()=>{this.modelEverUpdated=!0,this.updateGroupColumnVisibility(!0)};this.addManagedEventListeners({modelUpdated:e}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],e)}refreshCols(e){const t=this.beans,{colModel:s,gos:i,rowGroupColsSvc:r}=t,n=s.pivotMode,o=jz(i,n),a=n?i.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),l=i.get("treeData"),c=r?.columns,d=!(c&&c.length>0||l)||a||o,h=this.columns;if(d)return h.length>0&&this.destroyColumns(),null;const p=Kz(i),g=!l&&p;if(l&&p&&this.warn(182),Zz(h,c,g)){for(let m=0,v=h.length;m<v;++m){const C=h[m],S=g?c[m]:void 0;C.setColDef(this.createAutoColDef(C.colId,S,m),null,e)}return h}const f=this.reconcileAutoCols(h,g?c:void 0,e);return this.columns=f,!this.modelEverUpdated&&zz(this.gos)&&this.updateGroupColumnVisibility(!1),f}updateColumns(e){const t=Vz(e.source),s=this.columns;for(let i=0,r=s.length;i<r;++i)this.updateOneAutoCol(s[i],i,t)}destroy(){this.destroyColumns(),super.destroy()}destroyColumns(){const e=this.columns;this.columns=[];for(let t=0,s=e.length;t<s;++t){const i=e[t];i.isAlive()&&i.destroy()}}reconcileAutoCols(e,t,s){const i=new Map;for(let n=0,o=e.length;n<o;++n){const a=e[n];i.set(a.colId,a)}let r;if(t){const n=t.length;r=new Array(n);for(let o=0;o<n;++o)r[o]=this.reuseOrCreateAutoCol(i,t[o],o,s)}else r=[this.reuseOrCreateAutoCol(i,void 0,void 0,s)];for(const n of i.values())n.isAlive()&&n.destroy();return r}reuseOrCreateAutoCol(e,t,s,i){const r=wm(t),n=e.get(r);return n!==void 0?(e.delete(r),n.setColDef(this.createAutoColDef(r,t,s),null,i),n):this.createOneAutoCol(r,t,s)}isSuppressAutoCol(){const e=this.gos;return e.get("groupDisplayType")==="custom"?!0:e.get("treeDataDisplayType")==="custom"}createOneAutoCol(e,t,s){const i=this.createAutoColDef(e,t,s),r=new Gz(i,null,e,!0,"auto-group");return this.beans.context.createBean(r),r}updateOneAutoCol(e,t,s){const i=this.beans,r=e.colDef,n=typeof r.showRowGroup=="string"?r.showRowGroup:void 0,o=n!=null?i.colModel.getNonPivotCol(n):void 0,a=e.colId,l=this.createAutoColDef(a,o??void 0,t);e.setColDef(l,null,s),Bz(i,{state:[Hz(i,l,a)]},s)}createAutoColDef(e,t,s){let i=this.createBaseColDef(t);const r=this.gos.get("autoGroupColumnDef");Yz(i,r),i=Nz(this.beans,i,e,!0),i.colId=e,r?.groupRowEditable==null&&(i.groupRowEditable=void 0),r?.groupRowValueSetter==null&&(i.groupRowValueSetter=void 0),this.gos.get("treeData")||!i.field&&!i.valueGetter&&!i.filterValueGetter&&i.filter!=="agGroupColumnFilter"&&(i.filter=!1),s&&s>0&&(i.headerCheckboxSelection=!1);const n=Wz(this.gos),o=i.valueGetter||i.field!=null;return n&&!o&&(i.sortIndex=void 0,i.initialSort=void 0),t||this.applyDynamicSingleColumnTooltips(i,r),i}applyDynamicSingleColumnTooltips(e,t){const s=this.beans.rowGroupColsSvc?.columns??[],i=s.some(a=>ym(a.colDef)),r=s.some(({colDef:a})=>jl(a)),n=!!t&&ym(t),o=jl(t);!i&&!r&&!n&&!o||(e.tooltip=void 0,e.tooltipField=void 0,e.tooltipValueGetter=void 0,e.tooltipComponent=void 0,e.tooltipComponentParams=void 0,e.tooltipComponentSelector=void 0,(i||n)&&(e.tooltip=a=>this.resolveDynamicSingleColumnTooltip(a,t)),!(!r&&!o)&&(e.tooltipComponentSelector=a=>this.resolveDynamicSingleColumnTooltipComponent(a,t)))}resolveDynamicSingleColumnTooltip(e,t){const s=!!e.node?.group,i=s?e.node?.rowGroupColumn?.colDef:t;if(i)return qz(i,e,()=>{if(s)return{resolved:!0,value:e.value};const{tooltipField:r}=i;if(!r||!e.data)return{resolved:!1};const n=!this.gos.get("suppressFieldDotNotation")&&r.includes(".");return{resolved:!0,value:Uz(e.data,r,n)}})}resolveDynamicSingleColumnTooltipComponent(e,t){const s=e.node?.group?e.node.rowGroupColumn?.colDef:t;if(jl(s))return s.tooltipComponentSelector?s.tooltipComponentSelector(e):{component:s.tooltipComponent,params:s.tooltipComponentParams}}createBaseColDef(e){const t=this.gos.get("autoGroupColumnDef"),i={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:e?.colId??!0};return t&&(t.cellRenderer||t.cellRendererSelector)||(i.cellRenderer="agGroupCellRenderer"),e&&(i.headerName=this.beans.colNames.getDisplayNameForColumn(e,"header")??void 0,i.headerValueGetter=e.colDef.headerValueGetter,i.headerTooltip=e.colDef.headerTooltip,i.headerTooltipValueGetter=e.colDef.headerTooltipValueGetter,i.tooltip=e.colDef.tooltip,i.tooltipField=e.colDef.tooltipField,i.tooltipValueGetter=e.colDef.tooltipValueGetter,i.tooltipComponent=e.colDef.tooltipComponent,i.tooltipComponentParams=e.colDef.tooltipComponentParams,i.tooltipComponentSelector=e.colDef.tooltipComponentSelector),i}getDeepestExpandedLevel(e,t){let s=-1;if(!e)return s;for(let i=0,r=e.length;i<r;++i){const n=e[i];if(!n.group||!n.expanded)continue;if(n.level>s&&(s=n.level),s>=t)return s;const o=this.getDeepestExpandedLevel(n.childrenAfterGroup,t);if(o>s&&(s=o),s>=t)return s}return s}updateGroupColumnVisibility(e){const t=this.columns;if(t.length===0)return;const{gos:s,visibleCols:i,rowModel:r}=this.beans,n=$z(s);let o=!1;if(!n)Fm(t)&&(o=!0);else if(t.length>1){const a=t.length-2,l=r?.rootNode?.childrenAfterGroup,c=this.getDeepestExpandedLevel(l,a);if(c>=a)Fm(t)&&(o=!0);else for(let u=0;u<t.length-1;u++)xm(t[u+1],c>=u)&&(o=!0)}o&&e&&i.refresh("api",!1)}},wm=e=>e?`${Kl}-${e.colId}`:Kl,Zz=(e,t,s)=>{if(!s||!t)return e.length===1&&e[0].colId===Kl;const i=t.length;if(e.length!==i)return!1;for(let r=0;r<i;++r)if(e[r].colId!==wm(t[r]))return!1;return!0},xm=(e,t)=>t!==e.visible?(e.setVisible(t,"api"),!0):!1,Fm=e=>{let t=!1;for(let s=0,i=e.length;s<i;++s)xm(e[s],!0)&&(t=!0);return t};import{BeanStub as Jz}from"ag-grid-community";var Yl=null,Tm=e=>{const t=Yl,s=new Uint32Array(1<<32-Math.clz32(e|63));return t&&s.set(t),Yl=s,s},Qz=(e,t,s,i)=>{const r=t-i,n=s-1;if(r===1){let c=0;for(;e[c].level===n;)++c;if(c<t-1){const u=e[c];e.copyWithin(c,c+1),e[t-1]=u}return e}if(i===1){let c=0;for(;e[c].level!==n;)++c;if(c>0){const u=e[c];e.copyWithin(1,0,c),e[0]=u}return e}const o=new Array(r);let a=0,l=0;for(let c=0;c<t;++c){const u=e[c];u.level===n?e[a++]=u:o[l++]=u}for(let c=0;c<r;++c)e[i+c]=o[c];return e},eW=(e,t)=>{let s=e[0].level+1,i=s,r=0,n=s,o=Yl;(!o||s>=o.length)&&(o=Tm(s)),++o[s];for(let d=1;d<t;++d){const h=e[d].level+1;h>s?(s=h,s>=o.length&&(o=Tm(s))):h<i&&(i=h),++o[h],r|=n-h,n=h}if(r>=0)return o.fill(0,i,s+1),e;const a=o[i],l=o[s];if(a+l===t)return o[i]=0,o[s]=0,Qz(e,t,s,l);let c=0;for(let d=s;d>=i;--d){const h=o[d];o[d]=c,c+=h}const u=new Array(t);for(let d=0;d<t;++d){const h=e[d];u[o[h.level+1]++]=h}return o.fill(0,i,s+1),u},Am=(e,t=e.length)=>{if(t===2){if(e[0].level<e[1].level){const s=e[0];e[0]=e[1],e[1]=s}return e}if(t>16)return eW(e,t);for(let s=1;s<t;s++){const i=e[s],r=i.level;let n=s-1;if(e[n].level<r){let o=s;do e[o]=e[n],o=n--;while(n>=0&&e[n].level<r);e[o]=i}}return e},tW=class{constructor(){this.kind="cells",this.rows=[],this.unsorted=!1,this.slots=new Map,this.bits=[],this.extraBits=null,this.colCount=0}addRow(e){let t=e;if(t==null)return;const s=this.slots;if(s.get(t)!==void 0){for(;t!=null&&s.get(t)>=0;)s.set(t,-1),t=t.parent;return}const i=this.rows;do s.set(t,-1),i.push(t),t=t.parent;while(t!=null&&!s.has(t));this.unsorted=!0}addCell(e,t){if(t==null){this.addRow(e);return}if(e==null)return;const s=this.slots,i=this.bits,r=s.get(t)??this.ensureCol(t);let n=s.get(e);if(n===void 0)n=this.ensureRow(e);else if(n<0)return;const o=r<32?i:this.extraBits[(r>>>5)-1],a=1<<(r&31),l=o[n];if((l&a)!==0)return;o[n]=l|a;let c=e.parent;for(;c!=null;){const u=s.get(c);if(u<0)break;const d=o[u];if((d&a)!==0)break;o[u]=d|a,c=c.parent}}hasRow(e){return this.slots.has(e)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;const e=Am(this.rows);return this.rows=e,e}getSlot(e){return this.slots.get(e)??-1}hasCellBySlot(e,t){return e<0?!0:t<32?t>=0&&(this.bits[e]&1<<t)!==0:(this.extraBits[(t>>>5)-1][e]&1<<(t&31))!==0}ensureRow(e){const t=this.slots,s=this.rows,i=this.bits,r=this.extraBits;let n=i.push(0);const o=n-1;if(r!==null)for(let l=0,c=r.length;l<c;++l)r[l].push(0);t.set(e,o),s.push(e),this.unsorted=!0;let a=e.parent;for(;a!=null&&!t.has(a);){if(t.set(a,n),s.push(a),n=i.push(0),r!==null)for(let l=0,c=r.length;l<c;++l)r[l].push(0);a=a.parent}return o}ensureCol(e){const t=this.colCount++;if(this.slots.set(e,t),t>=32){const s=(t>>>5)-1;let i=this.extraBits;i===null&&(i=[],this.extraBits=i),s>=i.length&&i.push(new Array(this.bits.length).fill(0))}return t}},Pm=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow(e){let t=e;if(t==null)return;const s=this.rowSet;if(s.has(t))return;const i=this.rows;do s.add(t),i.push(t),t=t.parent;while(t!=null&&!s.has(t));this.unsorted=!0}addCell(e,t){this.addRow(e)}hasRow(e){return this.rowSet.has(e)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;const e=Am(this.rows);return this.rows=e,e}},sW=class extends Rx{constructor(){super(...arguments),this.beanName="changedPathFactory"}newPath(e){return e?new tW:new Pm}ensureRowsPath(e){let t=e.changedPath;if(!t&&e.changedRowNodes&&!e.newData){const s=this.beans.rowModel;s.hierarchical&&(t=new Pm,e.changedPath=t,t.addRow(s.rootNode))}return t}};import{_exists as iW}from"ag-stack";import{_removeAriaExpanded as rW,_setAriaExpanded as nW}from"ag-stack";import{BeanStub as oW,_addGridCommonParams as Rm,_createGlobalRowEvent as aW}from"ag-grid-community";var Mm=class extends Mx{addExpandedCss(e,t){t.isExpandable()&&(e.push("ag-row-group"),e.push(t.expanded?"ag-row-group-expanded":"ag-row-group-contracted"))}getRowExpandedListeners(e){const{rowNode:t}=e,s=this.updateExpandedCss.bind(this,e,t);return{expandedChanged:s,hasChildrenChanged:s}}setExpanded(e,t,s,i){if(e.expanded===t)return;!t&&e.sticky&&this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(e.rowTop-e.stickyRowTop),e._expanded=t,e.dispatchRowEvent("expandedChanged");const r={...aW(e,this.gos,"rowGroupOpened"),expanded:t,event:s||null};this.dispatchExpandedEvent(r,i)}defaultExpanded(e){const s=this.beans.gos,i=e.level??0;if(e.master&&!e.group){const o=s.get("isMasterOpenByDefault");if(o){const l=Rm(s,{rowNode:e,data:e.data,level:i});return!!o(l)}const a=s.get("masterDefaultExpanded")??s.get("groupDefaultExpanded");return a===-1||i<a}const r=e.group&&s.get("isGroupOpenByDefault");if(!r){const o=s.get("groupDefaultExpanded");return o===-1||i<o}const n=Rm(s,{rowNode:e,field:e.field,key:e.key,level:i,rowGroupColumn:e.rowGroupColumn});return!!r(n)}isExpandable(e){return this.checkExpandable(e,e.hasChildren())}checkExpandable(e,t){return e.footer?!1:this.beans.colModel.pivotMode?t&&!e.leafGroup:t||e.master}updateExpandedCss(e,t){const s=t.isExpandable(),i=t.expanded==!0,r=e.getGui();if(!r)return;const n=r.rowComp;n.toggleCss("ag-row-group",s),n.toggleCss("ag-row-group-expanded",s&&i),n.toggleCss("ag-row-group-contracted",s&&!i),s?nW(r.element,i):rW(r.element)}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},lW=class extends Mm{constructor(){super(...arguments),this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState(e){const t=new Set(e.expandedRowGroupIds);this.beans.rowModel.forEachNode(s=>{const i=s.id;i&&(s._expanded=t.has(i))}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState(e=!1){const t=[],s=[];return this.beans.rowModel.forEachNode(i=>{const r=i.id;r&&(i.expanded?t.push(r):e&&i.isExpandable()&&s.push(r))}),{expandedRowGroupIds:t,collapsedRowGroupIds:s}}getExpansionState(){return this.getInternalExpansionState()}isExpanded(e){if(e.footer)return!!e._expanded;if(!this.checkExpandable(e,!!e.group))return!1;let t=e._expanded;return t===null&&(t=this.defaultExpanded(e)??!1,e._expanded=t),!!t}resetExpansion(){const{rowModel:e}=this.beans;e.forEachNode(t=>{!t.group&&!t.master||(t._expanded=null)}),this.onGroupExpandedOrCollapsed()}expandAll(e){const{gos:t,rowModel:s,colModel:i,eventSvc:r}=this.beans,n=t.get("treeData"),o=i.isPivotActive(),a=c=>{if(c)for(const u of c){const d=()=>{u._expanded=e,a(u.childrenAfterGroup)};if(u.master){d();continue}if(n){iW(u.childrenAfterGroup)&&d();continue}if(o){!u.leafGroup&&d();continue}u.group&&d()}},l=s.rootNode;l&&a(l.childrenAfterGroup),this.onGroupExpandedOrCollapsed(),r.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState(e){const t=this.getInternalExpansionState(!0),s=t.collapsedRowGroupIds.length===0;if(t.expandedRowGroupIds.length===0!==s)return s?e.expandAll():e.collapseAll()}dispatchExpandedEvent(e,t){if((this.events??(this.events=[])).push(e),t){this.dispatchExpandedEvents();return}let s=this.dispatchExpandedDebounced;if(!s){if(!this.isAlive())return;s=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=s}s()}dispatchExpandedEvents(){const{eventSvc:e,rowRenderer:t}=this.beans,s=this.events,i=s?.length;if(!i)return;this.events=null;const r=new Array(i);for(let n=0;n<i;++n)r[n]=s[n].node,e.dispatchEvent(s[n]);this.dispatchStateUpdatedEvent(),t.refreshCells({rowNodes:r})}debounce(e){const t=this.beans.animationFrameSvc;if(!t)return()=>window.setTimeout(e,0);let s=!1;return()=>{if(!t.active){window.setTimeout(e,0);return}s||(s=!0,t.addDestroyTask(()=>{s=!1,e()}))}}};import{BeanStub as cW,_getGrandTotalPinnedFloat as uW}from"ag-grid-community";import{_getGrandTotalRow as dW,_getGroupTotalRowCallback as hW,_isGroupMultiAutoColumn as pW}from"ag-grid-community";function Im(e){let t=e.get("groupHideParentOfSingleChild");return t||(t=e.get("groupRemoveSingleChildren"),!t&&e.get("groupRemoveLowestSingleChildren")&&(t="leafGroupsOnly")),{groupHideParentOfSingleChild:t,isGroupMultiAutoColumn:pW(e),hideOpenParents:e.get("groupHideOpenParents"),grandTotalRow:dW(e),groupTotalRow:hW(e)}}function Em(e,t,s){return e.groupHideParentOfSingleChild===!0&&s&&t.childrenAfterGroup.length===1}function Dm(e,t,s){return e.groupHideParentOfSingleChild==="leafGroupsOnly"&&s&&t.leafGroup&&t.childrenAfterGroup.length===1}function Lm(e,t,s,i,r,n){return i&&!s||r||n?!1:!e.hideOpenParents||t.master||t.level===-1?!0:!(!(i&&t.leafGroup)&&t.expanded)}var gW=class extends Ix{constructor(){super(...arguments),this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){const{beans:e,gos:t}=this,s=[],i=e.rowModel.rootNode;if(!i)return s;const r=e.colModel.pivotMode,n=r&&i.leafGroup&&i.aggData,o=n?[i]:i.childrenAfterSort,a=Im(t);this.recursivelyAddToRowsToDisplay(a,o,s,r,0);const l=s.length>0,c=a.grandTotalRow;if(!n&&l&&c){const d=dt(i,e),h=uW(c);h?this.beans.pinnedRowModel?.setGrandTotalPinned(h):this.addRowNodeToRowsToDisplay(a,d,s,0,c==="top")}return s}recursivelyAddToRowsToDisplay(e,t,s,i,r){if(!t?.length)return;const n=this.beans.masterDetailSvc;for(let o=0;o<t.length;o++){const a=t[o],l=a.hasChildren(),c=Em(e,a,l),u=Dm(e,a,l);if(Lm(e,a,l,i,c,u)&&this.addRowNodeToRowsToDisplay(e,a,s,r),!(i&&a.leafGroup))if(l){const h=c||u;if(a.expanded||h){const p=e.groupTotalRow({node:a});p||Hl(a);const g=h?r:r+1;let f;p==="top"&&(f=dt(a,this.beans),this.addRowNodeToRowsToDisplay(e,f,s,g));const m=n?.getDetail(a);m&&this.addRowNodeToRowsToDisplay(e,m,s,r),this.recursivelyAddToRowsToDisplay(e,a.childrenAfterSort,s,i,g),p==="bottom"&&(f=dt(a,this.beans),this.addRowNodeToRowsToDisplay(e,f,s,g))}}else{const h=n?.getDetail(a);h&&this.addRowNodeToRowsToDisplay(e,h,s,r)}}}addRowNodeToRowsToDisplay(e,t,s,i,r){r?s.unshift(t):s.push(t),t.setUiLevel(e.isGroupMultiAutoColumn?0:i)}};import{BeanStub as fW,_ChangedRowNodes as km,_csrmFirstLeaf as mW,_csrmReorderAllLeafs as vW,_getCellByPosition as CW,_isClientSideRowModel as SW,_prevOrNextDisplayedRow as bW}from"ag-grid-community";var yW=class extends Ex{constructor(){super(...arguments),this.beanName="groupEditSvc",this.pendingEditRefresh=null,this.dropGroupTarget=null,this.dropGroupTimer=null,this.dropGroupThrottled=!1,this.draggingGroups=null}postConstruct(){SW(this.gos)&&this.addManagedListeners(this.eventSvc,{cellValueChanged:e=>this.onCsrmCellChange(e),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop(e){return!e.rowDragManaged||!e.sameGrid||!this.gos.get("refreshAfterGroupEdit")?!1:!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.pivotMode}initDraggingGroups(e){const t=new Map,s=i=>{const r=i.childrenAfterGroup;if(r){if(t.has(i))return;const n=r.slice();t.set(i,n);for(const o of n)s(o)}};for(const i of e.rows)i.group&&s(i);this.draggingGroups=t}canSetParent(e){return e.sameGrid?this.beans.groupStage?.treeData?!0:e.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit")?!1:!!this.beans.rowGroupColsSvc?.columns?.length:!1}canDropRow(e,t){if(this.beans.groupStage?.treeData)return!wW(e,t.newParent);const{position:s,target:i,newParent:r,rootNode:n}=t,o=e.parent;if(e.group&&(Gm(e,i)||Gm(e,r)))return!1;if(s==="inside")return!0;if(r&&r!==o)return r!==n||o===n;const a=r??i?.parent??n;if(a!==o)return!1;const l=e.group?e.level:o.level??-1;let c=-1;return i?c=i.group?i.level:i.parent?.level??-1:a&&(c=a.level),!(l>=0&&c>=0&&c!==l)}fixRowsDrop(e,t,s,i){const r=!!this.beans.groupStage?.treeData;if(e.treeData=r,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!r)return;!this.draggingGroups&&this.isGroupingDrop(e)&&!e.suppressMoveWhenRowDragging&&this.initDraggingGroups(e);let o=e.target,a=null,l=!1;const c=e.rootNode,u=this.beans.rowModel,d=this.canStartGroup(o,r);this.updateDropTarget(e,s,d);const h=this.beans.pageBounds?.getLastRow?.()??u.getRowCount()-1;if(t&&(!o||i>=.5&&o.rowIndex===h?a=c:e.moved&&o&&this.dropGroupThrottled&&this.shouldDropTargetBeParent(e)&&(a=o),a||(a=o?.parent??c)),!s&&o&&d&&!(o.group&&o.expanded)&&this.startDropGroupDelay(o),a){if(o&&a===o&&a!==c){const p=a.expanded?bW(u,1,o):null;p?.parent===a?(o=p,i=-.5):l=!0}if(o&&!l){let p=o;for(;p&&p!==c&&p!==a;)o=p,p=p.parent}}e.target=o,e.newParent=a,e.yDelta=i,e.inside=l}clearNewSameParent(e,t){const s=e.newParent;s&&(!t||xW(e.rows,s))&&(e.newParent=null)}updateDropTarget(e,t,s){const i=s?e.target:null;this.dropGroupTarget&&this.dropGroupTarget!==i&&this.resetDragGroup(),i?.childrenAfterSort?.length&&(t&&this.dropGroupThrottled&&!i.expanded&&i.isExpandable?.()&&i.setExpanded(!0,void 0,!0),this.canDropInTarget(i,e)&&(this.dropGroupThrottled=!0,this.dropGroupTarget=i))}canDropInTarget(e,t){if(e.expanded)return!0;if(!e.group)return!1;if(t.pointerPos==="inside")return!0;if(t.treeData)return!1;const s=t.rows,i=e.level;for(let r=0,n=s.length;r<n;++r){const o=s[r];if(o!==e&&o.group&&o.level!==i)return!1}return!0}startDropGroupDelay(e){if(this.dropGroupTarget&&this.dropGroupTarget!==e&&this.resetDragGroup(),this.dropGroupTarget=e,this.dropGroupTimer!==null)return;const t=this.gos.get("rowDragInsertDelay");this.dropGroupTimer=window.setTimeout(()=>{this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},t)}resetDragGroup(){this.dropGroupTimer!==null&&(window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null),this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging(e){e&&(this.draggingGroups=null),this.resetDragGroup()}shouldDropTargetBeParent({target:e,rows:t,pointerPos:s,treeData:i}){if(!e||s==="none")return!1;if(s==="inside"||!i&&e.group&&!e.expanded)return!0;if(s==="above")return!1;const r=this.beans.rowModel;let o=e.rowIndex+1,a;do a=r.getRow(o++);while(a?.footer);const l=this.draggingGroups?.get(e)??e.childrenAfterGroup;if(a?.parent===e&&l?.length){const c=new Set(t);for(let u=0,d=l.length;u<d;++u){const h=l[u];if(h.rowIndex!==null&&!c.has(h))return!0}}return!1}dropGroupEdit(e){const{beans:t}=this,s=e.position,i=e.target??null,r=e.rootNode,n=e.newParent??i?.parent??r,o=t.focusSvc,a=o.getFocusedCell(),l=a&&CW(t,a),c=new Set,u=new km,d=u.updates;let h;const p=C=>{c.has(C)||(c.add(C),h??(h=this.newGroupValues(n)),this.setRowGroup(C,h)&&d.add(C))},g=C=>{const S=this.draggingGroups?.get(C)??C.childrenAfterGroup,w=S?.length;if(w)for(let b=0;b<w;++b){const y=S[b];y.sourceRowIndex>=0?p(y):g(y)}};for(const C of e.rows)if(C.group)g(C);else{const S=C.sourceRowIndex>=0&&!C.destroyed?C:this.csrmFirstLeaf(C);S&&p(S)}const f=s==="inside"?"above":s,m=s==="inside"?this.findFirstLeafForParent(n,c)??i:i;let v=!1;if(c.size&&f!=="none"&&(v=vW(r._leafs,c,m,f==="above")),!d.size&&!v)return!1;u.reordered=v;for(const C of c)u.updates.add(C);return this.csrmRefresh(u),l?l.focusCell():o.clearFocusedCell(),!0}canStartGroup(e,t){return!e||e.level<0||e.footer||e.detail?!1:e.group?!0:t}flushGroupEdits(){const e=this.pendingEditRefresh;e&&(this.pendingEditRefresh=null,this.csrmRefresh(e))}csrmRefresh(e){const t=this.beans.rowModel;t.rootNode&&t.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:e})}newGroupValues(e){const t=this.beans.rowGroupColsSvc?.columns??[],s=new Array(t.length);let i=-1,r=e;for(;r&&r.level>=0;){const n=t[r.level];if(n){const o=n.colId,a=r.level;s[a]=r.groupData?.[o]??r.key??void 0,a>i&&(i=a)}r=r.parent}return{values:s,columns:t,maxLevel:i}}setRowGroup(e,{values:t,columns:s,maxLevel:i}){if(i<0)return!1;const{valueSvc:r,changeDetectionSvc:n}=this.beans;let o=!1;n?.beginDeferred();try{for(let a=0;a<s.length;++a){const l=s[a];if(!l||a>i)continue;const c=t[a],u=r.getValueFromData(l,e);if(u===c||u==null&&c==null)continue;let d=c;const h=r.parseValue(l,e,c,u);h!==void 0&&(d=h),e.setDataValue(l,d,"rowDrag")&&(o=!0)}}finally{n?.endDeferred()}return o}onCsrmCellChange(e){const{column:t,node:s,source:i}=e;if(!this.gos.get("refreshAfterGroupEdit")||i==="rowDrag"||!t?.isRowGroupActive()||s.group||!s.data)return;if(this.beans.editSvc?.isBatchEditing()){let n=this.pendingEditRefresh;n||(n=_m(),this.pendingEditRefresh=n),n.updates.add(s)}else{const n=_m();n.updates.add(s),this.csrmRefresh(n)}}csrmFirstLeaf(e){if(!e)return null;const t=this.draggingGroups;let s=t?.get(e)??e.childrenAfterGroup;for(;s?.length;){const i=s[0];if(i.sourceRowIndex>=0)return i.destroyed?this.firstAliveChildLeaf(i):i;s=t?.get(i)??i.childrenAfterGroup}return mW(e)}firstAliveChildLeaf(e){const t=this.draggingGroups?.get(e)??e.childrenAfterGroup;if(t){for(const s of t)if(s.sourceRowIndex>=0&&!s.destroyed)return s}return null}findFirstLeafForParent(e,t){if(!e)return null;const s=this.draggingGroups?.get(e)??e?.childrenAfterGroup;if(!s)return null;for(let i=0,r=s.length;i<r;++i){const n=s[i];if(n.sourceRowIndex>=0&&!t.has(n))return n;const o=this.findFirstLeafForParent(n,t);if(o!==null)return o}return null}},_m=()=>{const e=new km;return e.reordered=!0,e},Gm=(e,t)=>{if(!e||!t)return!1;let s=t;for(;s;){if(s===e)return!0;s=s.parent}return!1},wW=(e,t)=>{if(!t||e.parent===t)return!1;let s=t;const i=e.id;for(;s;){if(s===e||i!=null&&s.id===i)return!0;s=s.parent}return!1},xW=(e,t)=>{for(let s=0,i=e.length;s<i;++s)if(e[s].parent!==t)return!1;return!0};import{BeanStub as FW,_forEachChangedGroupDepthFirst as Om}from"ag-grid-community";var ql=e=>{const t=e.sibling;t&&(t.childrenAfterFilter=e.childrenAfterFilter)},TW=e=>{e.childrenAfterFilter=e.childrenAfterGroup,ql(e)},Nm=(e,t)=>e.childrenAfterFilter&&e.childrenAfterFilter.length>0?!0:!!(e.data&&t.doesRowPassFilter(e)),Bm=(e,t,s)=>{const i=e.length;t??(t=e);const r=t.length;let n=0;for(let o=0;o<i;++o){const a=e[o];if(Nm(a,s)){if(n>=r||t[n]!==a)return Vm(e,i,o,t,n,s);++n}else if(n<r)return Vm(e,i,o,t,n,s)}return n===r?t:e},Vm=(e,t,s,i,r,n)=>{const o=r>0?i.slice(0,r):[];for(;s<t;){const a=e[s++];Nm(a,n)&&o.push(a)}return o},AW=class extends Dx{constructor(){super(...arguments),this.beanName="groupFilterStage",this.step="filter",this.refreshProps=["excludeChildrenWhenTreeDataFiltering"]}wireBeans(e){this.filterManager=e.filterManager}execute(e){const t=this.filterManager;t?.isChildFilterPresent()?this.doingTreeDataFiltering()?this.treeDataFilter(t):this.filterActive(t,e):Om(this.beans.rowModel.rootNode,!0,e,TW)}filterActive(e,t){const s=i=>{const r=i.childrenAfterGroup;r?i.childrenAfterFilter=Bm(r,i.childrenAfterFilter,e):i.childrenAfterFilter=r,ql(i)};Om(this.beans.rowModel.rootNode,!0,t,s)}treeDataFilter(e){const t=(i,r)=>{const n=i.childrenAfterGroup;n&&!r?i.childrenAfterFilter=Bm(n,i.childrenAfterFilter,e):i.childrenAfterFilter=n,ql(i)},s=(i,r)=>{const n=i.childrenAfterGroup;if(n)for(let o=0,a=n.length;o<a;++o){const l=n[o],c=r||e.doesRowPassFilter(l);l.childrenAfterGroup?s(l,c):t(l,c)}t(i,r)};s(this.beans.rowModel.rootNode,!1)}doingTreeDataFiltering(){return!!this.beans.groupStage?.treeData&&!this.gos.get("excludeChildrenWhenTreeDataFiltering")}};import{_reuseArrayIfEqual as PW}from"ag-stack";import{BeanStub as RW,_doDeltaSort as MW,_forEachChangedGroupDepthFirst as IW,_updateRowNodeAfterSort as EW}from"ag-grid-community";var DW=class extends Lx{constructor(){super(...arguments),this.beanName="groupSortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort","groupMaintainOrder"]}execute(e,t){const{gos:s,colModel:i,groupStage:r,rowGroupColsSvc:n,rowModel:o,rowNodeSorter:a,rowRenderer:l,sortSvc:c,showRowGroupCols:u}=this.beans,d=c?.getSortOptions()??[],h=d.length>0,p=s.getCallback("postSortRows"),g=h&&!p&&s.get("deltaSort")&&t,f=n?.columns,m=h&&f?.length&&!r?.treeData&&s.get("groupMaintainOrder")?LW(d,f):null,v=!m&&h?d:void 0,C=i.pivotMode;let S=!1;function w(b){const y=C&&b.leafGroup;let T;y||(T=m?m[b.level+1]:v);const x=b.childrenAfterSort,F=b.childrenAfterAggFilter,A=x?.[0];let P;T?g?P=MW(a,b,g,e,T):P=a.doFullSortInPlace(F?.slice()??[],T):P=PW(x,F),b.childrenAfterSort=P,EW(b),p?.({nodes:P}),S||(S=A!==P[0])}if(IW(o.rootNode,!0,e,w),S&&s.get("groupHideOpenParents")){const b=u?.columns;b?.length&&l.refreshCells({columns:b,force:!0})}}},LW=(e,t)=>{const s=e.length,i=t.length,r=i,n=new Map;for(let a=0;a<i;++a){const l=t[a];n.set(l,a),n.set(l.colId,a)}const o=new Array(i+1);for(let a=0;a<s;++a){const l=e[a],c=l.column,u=c.colDef,d=u.showRowGroup,h=u.field!=null||u.valueGetter!=null||u.comparator!=null;if(d===!0){for(let m=0;m<i;++m)(o[m]??(o[m]=[])).push(l);h&&(o[r]??(o[r]=[])).push(l);continue}const p=typeof d=="string",g=p?d:c,f=n.get(g);f!==void 0?((o[f]??(o[f]=[])).push(l),p&&h&&(o[r]??(o[r]=[])).push(l)):(!p||h)&&(o[r]??(o[r]=[])).push(l)}return o};import{BeanStub as kW}from"ag-grid-community";var _W=class extends kx{constructor(){super(...arguments),this.beanName="groupStage",this.step="group",this.refreshProps=["groupAllowUnbalanced","groupDefaultExpanded","groupDisplayType","groupHideOpenParents","initialGroupOrderComparator","treeData","treeDataChildrenField","treeDataParentIdField"],this.treeData=!1,this.grouping=!1,this.gosTreeData=!1,this.pivotMode=!1,this.hasTreeData=!1,this.hasRowGrouping=!1,this.needReset=!1,this.nested=!1,this.strategy=void 0,this.strategyType=void 0,this.columnsInvalidated=!1}postConstruct(){const e=this.gos;this.hasRowGrouping=e.isModuleRegistered("RowGrouping"),e.isModuleRegistered("TreeData")&&(this.hasTreeData=!0,this.gosTreeData=e.get("treeData")),this.addManagedEventListeners({showRowGroupColsSetChanged:()=>this.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf(e){return this.strategy?.nonLeafsById?.get(e)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange(e){const t=this.gos,s=this.strategy?.nestedDataGetter;return e.has("treeData")&&(this.gosTreeData=t.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0),this.strategy?.onPropChange?.(e),this.getNestedDataGetter()!==s}extractData(){const e=this.beans.rowModel.rootNode,t=this.nested?e?.childrenAfterGroup:e?._leafs;if(!t)return this.gos.get("rowData")??[];const s=t.length,i=new Array(s);let r=0;for(let n=0;n<s;++n){const o=t[n].data;o!=null&&(i[r++]=o)}return i.length=r,i}execute(e){const t=this.beans,s=t.rowModel,i=s.rootNode;if(!i)return!1;const r=this.getStrategy(),n=!!r?.nestedDataGetter,o=this.needReset;if(this.nested=n,o&&(this.needReset=!1,t.rowDragSvc?.cancelRowDrag(),e.animate=!1,OW(i,!n,t)),!r){s.hierarchical=!1;return}return s.hierarchical=!0,t.changedPathFactory?.ensureRowsPath(e,i),r.execute(i,e)||o}loadLeafs(e){return e.footer?GW(e):_n(e)}loadGroupData(e){const t=this.getStrategy();return t?t.loadGroupData(e):(e._groupData=null,null)}clearNonLeafs(){this.strategy?.clearNonLeafs()}getWantedStrategyType(){if(this.isAlive()){if(this.gosTreeData)return"tree";if(this.hasRowGrouping&&(this.beans.rowGroupColsSvc?.columns?.length||this.pivotMode))return"group"}return"none"}getStrategy(){let e=this.strategy;const t=this.beans.colModel.pivotMode;if(t!==this.pivotMode&&(this.pivotMode=t,this.columnsInvalidated=!0),e!==void 0&&!this.columnsInvalidated&&this.isAlive())return e;this.columnsInvalidated=!1;const s=this.getWantedStrategyType();if(s===this.strategyType)return e!==void 0?e:(this.strategy=null,null);if(e&&(this.strategy=this.destroyBean(e),this.needReset=!0),this.strategyType=s,this.treeData=s==="tree",this.grouping=s==="group",s==="none")return this.strategy=null,null;const i=s==="tree"?"treeGroupStrategy":"groupStrategy";return e=this.beans.registry.createDynamicBean(i,!1)??null,this.strategy=e&&this.createBean(e),e}},GW=e=>{const t=e.sibling;if(!t)return null;const s=t._leafs;return s!==void 0?s:_n(t)},_n=e=>{const t=e.childrenAfterGroup,s=t?.length;if(e._leafs=null,!s)return null;let i;const r=s===1?t[0]:null;if(r?.group&&r.sourceRowIndex<0)i=r._leafs,i===void 0&&(i=_n(r));else if(e.leafGroup)i=t;else{i=[];for(let n=0;n<s;++n){const o=t[n];if(o.sourceRowIndex>=0&&i.push(o),!o.group)continue;let a=o._leafs;if(a===void 0&&(a=_n(o)),a)for(let l=0,c=a.length;l<c;++l)i.push(a[l])}}return e._leafs=i,i},OW=(e,t,s)=>{const i=e._leafs,r=e.sibling;e.treeNodeFlags=0,e.childrenAfterGroup=i,e.childrenMapped=null,e._groupData=void 0,e.aggData=null,r&&(r.childrenAfterGroup=e.childrenAfterGroup,r.childrenAfterAggFilter=e.childrenAfterAggFilter,r.childrenAfterFilter=e.childrenAfterFilter,r.childrenAfterSort=e.childrenAfterSort,r.childrenMapped=null,r._groupData=void 0,r.aggData=null);for(let n=0,o=i.length??0;n<o;++n){const a=i[n],l=a.sibling;a._leafs=void 0,Hm(a),l&&Hm(l),a.parent=e,t&&(a.treeParent=null),Va(a,s,!1)}e.updateHasChildren()},Hm=e=>{e.key=null,e.treeNodeFlags=0,e.allChildrenCount=null,e.childrenAfterGroup=null,e.childrenAfterAggFilter=null,e.childrenAfterFilter=null,e.childrenAfterSort=null,e.childrenMapped=null,e.level=0,e._groupData=void 0};import{RefPlaceholder as $i,_setAriaRole as NW,_setDisplayed as Um,_setVisible as BW}from"ag-stack";import{Component as VW}from"ag-grid-community";import{_isElementInEventPath as zm,_removeAriaExpanded as HW,_setAriaExpanded as UW}from"ag-stack";import{BeanStub as zW,KeyCode as WW,_createIconNoSpan as $W,_getCellRendererDetails as Wm,_getCheckboxLocation as KW,_getCheckboxes as jW,_getInnerCellRendererDetails as Gn,_isRowSelection as YW,_isStopPropagationForAgGrid as $m,_stopPropagationForAgGrid as qW}from"ag-grid-community";function Km(e,t,s){let i=e;const r=i.level-t.level;if(r<=0||!s.get("groupHideOpenParents"))return!1;for(let o=0;o<r;o++){if(!(i.parent?.getFirstChild()===i))return!1;i=i.parent}return i===t}var jm=class extends _x{constructor(){super(...arguments),this.indentClass=null}init(e,t,s,i,r,n,o){this.params=o,this.eGui=t,this.eCheckbox=s,this.eExpanded=i,this.eContracted=r,this.comp=e,this.compClass=n;const{node:a,column:l}=o;if(this.node=a,this.displayedNode=a,!this.isEmbeddedRowMismatch()){if(a.footer){this.initFooterCell();return}if(!l){this.initFullWidthCell();return}this.displayedNode=this.beans.showRowGroupColValueSvc?.getDisplayedNode(a,l)??this.node,this.setupExpand(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}}initFooterCell(){const{node:e}=this.params;this.addGroupValue(),this.setupIndent(),e.level===-1||this.comp.toggleCss("ag-row-group-leaf-indent",!0)}initFullWidthCell(){const e=()=>{const{rowDragSvc:t}=this.beans;if(!this.params.rowDrag||!t)return;const s=t.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(s),this.eGui.insertAdjacentElement("afterbegin",s.getGui())};this.setupExpand(),e(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){const e=this.params.colDef?.cellAriaRole,t=this.params.column?.getColDef().cellAriaRole;return e||t||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;const{visibleCols:e}=this.beans,t=this.params.pinned==="left",s=this.params.pinned==="right",i=!t&&!s;return this.gos.get("enableRtl")?e.leftCols.length>0?!s:!i:e.leftCols.length>0?!t:!i}addGroupValue(){const{params:{value:e,valueFormatted:t}}=this,s=this.getInnerCompDetails();this.comp.setInnerRenderer(s,t??e??null)}setupExpand(){const{colModel:e}=this.beans,{eGridCell:t,suppressDoubleClickExpand:s}=this.params,i=(l,c)=>{const u=$W(l,this.beans,null);u&&(c.appendChild(u),this.addDestroyFunc(()=>u.remove()))};i("groupExpanded",this.eExpanded),i("groupContracted",this.eContracted);const r=this.comp,n=()=>{if(!this.isExpandable())return;const c=!!this.displayedNode.expanded;r.setExpandedDisplayed(c),r.setContractedDisplayed(!c),UW(t,c)},o=()=>{const l=this.isExpandable();r.toggleCss("ag-cell-expandable",l),r.toggleCss("ag-row-group",l);const c=!l&&e.pivotMode;r.toggleCss("ag-pivot-leaf-group",c);const u=!e.pivotMode&&(!this.displayedNode.footer||this.displayedNode.level!==-1);r.toggleCss("ag-row-group-leaf-indent",!l&&u);const d=this.getChildCount(),h=d>0?`(${d})`:"";r.setChildCount(h),l?n():(r.setExpandedDisplayed(!1),r.setContractedDisplayed(!1),HW(t))};!s&&!this.isGroupCellEditable(this.displayedNode)&&this.addManagedListeners(t,{dblclick:this.onCellDblClicked.bind(this)}),this.addManagedListeners(this.eExpanded,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(this.eContracted,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(t,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:o,masterChanged:o,groupChanged:o,hasChildrenChanged:o,expandedChanged:n}),o()}getInnerCompDetails(){const{userCompFactory:e,findSvc:t}=this.beans,s=this.params;if(s.fullWidth){const l=this.gos.get("groupRowRendererParams"),c=Gn(e,l,s);return c||(t?.isMatch(s.node,null)?Gn(e,{...l,innerRenderer:"agFindCellRenderer"},s):void 0)}const i=l=>l&&l.componentClass==this.compClass,r=Gn(e,s,s);if(r&&!i(r))return r;const{displayedNode:{rowGroupColumn:n}}=this,o=n?.colDef,a=n&&s.column?.isRowGroupDisplayed(n.getId());if(o&&a){const l=Wm(e,o,s);if(l)if(i(l)){if(o?.cellRendererParams?.innerRenderer)return Gn(e,o.cellRendererParams,s)}else return l}if(t?.isMatch(s.node,s.column))return Wm(e,{...o??s.colDef,cellRenderer:"agFindCellRenderer"},s)}getChildCount(){const{column:e,suppressCount:t}=this.params;if(t)return 0;const{allChildrenCount:s,rowGroupColumn:i}=this.displayedNode;return!((s??0)>0&&(!i||!e||e?.isRowGroupDisplayed(i.getId())))||this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!Km(this.node,this.displayedNode,this.gos)?0:s??0}isExpandable(){const{node:e,column:t,colDef:s}=this.params;if(!this.displayedNode.isExpandable()||e.rowPinned)return!1;if(!t)return!0;if(e.hasChildren()&&s){const{showRowGroup:n}=s;if(!n)return!1;if(n===!0)return!0}return e===this.displayedNode?e.rowGroupColumn&&t?.isRowGroupDisplayed(e.rowGroupColumn.getId())?!0:e.master?s?.showRowGroup===!0||s?.showRowGroup==null:!1:Km(this.node,this.displayedNode,this.gos)}setupIndent(){const{suppressPadding:e,node:t,colDef:s}=this.params;if(e)return;const i=()=>{let r=t.uiLevel;s&&s.showRowGroup!==!0&&(r=0);const n="ag-row-group-indent-"+r;n!==this.indentClass&&(this.indentClass&&this.comp.toggleCss(this.indentClass,!1),this.indentClass=n,this.comp.toggleCss(n,!0),this.eGui.style.setProperty("--ag-indentation-level",String(r)))};this.addManagedListeners(t,{uiLevelChanged:i.bind(this)}),i()}setupCheckbox(){const{node:e}=this.params;!e.footer&&!e.rowPinned&&!e.detail&&(this.addManagedPropertyListener("rowSelection",({currentValue:s,previousValue:i})=>{const r=typeof s=="object"?s:void 0,n=typeof i=="object"?i:void 0;r?.checkboxLocation!==n?.checkboxLocation&&(this.destroyCheckbox(),this.addCheckbox())}),this.addCheckbox())}addCheckbox(){const{selectionSvc:e}=this.beans;if(!e||!YW(this.gos))return;const{node:t,column:s}=this.params,i=this.gos.get("rowSelection"),r=KW(i);if(r==="selectionColumn")return;if(r==="autoGroupColumn"){const c=s?.getColDef().showRowGroup!=null,u=!s&&t.group;if(!(c||u))return}const n=typeof i=="object"?jW(i):this.params.checkbox;if(!(typeof n=="function"||n===!0))return;if(typeof s?.getColDef().showRowGroup=="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}const l=e.createCheckboxSelectionComponent();this.cbComp=l,this.createBean(l),l.init({rowNode:t,column:s,overrides:{isVisible:n,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(l.getGui()),this.comp.setCheckboxVisible(!0)}destroyCheckbox(){this.comp.setCheckboxSpacing(!1),this.comp.setCheckboxVisible(!1),this.cbComp?.getGui().remove(),this.cbComp=this.destroyBean(this.cbComp)}isGroupCellEditable(e){const t=this.params.column;return!!t&&(!!t.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&t.isCellEditable(e)}onExpandClicked(e){$m(e)||(qW(e),this.onExpandOrContract(e))}onKeyDown(e){!(e.key===WW.ENTER)||this.params.suppressEnterExpand||this.isGroupCellEditable(this.params.node)||this.onExpandOrContract(e)}onCellDblClicked(e){if($m(e))return;zm(this.eExpanded,e)||zm(this.eContracted,e)||this.onExpandOrContract(e)}onExpandOrContract(e){if(!this.isExpandable())return;const t=this.displayedNode;t.setExpanded(!t.expanded,e)}destroy(){super.destroy(),this.destroyCheckbox()}},XW={tag:"span",cls:"ag-cell-wrapper",children:[{tag:"span",ref:"eExpanded",cls:"ag-group-expanded ag-hidden"},{tag:"span",ref:"eContracted",cls:"ag-group-contracted ag-hidden"},{tag:"span",ref:"eCheckbox",cls:"ag-group-checkbox ag-invisible"},{tag:"span",ref:"eValue",cls:"ag-group-value"},{tag:"span",ref:"eChildCount",cls:"ag-group-child-count"}]},Ym=class extends Gx{constructor(){super(XW),this.eExpanded=$i,this.eContracted=$i,this.eCheckbox=$i,this.eValue=$i,this.eChildCount=$i}init(e){const t={setInnerRenderer:(n,o)=>this.setRenderDetails(n,o),setChildCount:n=>this.eChildCount.textContent=n,toggleCss:(n,o)=>this.toggleCss(n,o),setContractedDisplayed:n=>Um(this.eContracted,n),setExpandedDisplayed:n=>Um(this.eExpanded,n),setCheckboxVisible:n=>BW(this.eCheckbox,n),setCheckboxSpacing:n=>this.eCheckbox.classList.toggle("ag-group-checkbox-spacing",n)},s=this.createManagedBean(new jm),i=!e.colDef,r=this.getGui();s.init(t,r,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,e),i&&NW(r,s.getCellAriaRole())}setRenderDetails(e,t){e?e.newAgStackInstance().then(s=>{if(!s)return;const i=()=>this.destroyBean(s);this.isAlive()?(this.eValue.appendChild(s.getGui()),this.addDestroyFunc(i)):i()}):this.eValue.innerText=t}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},ZW=".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}";import{BeanStub as JW}from"ag-grid-community";var QW=class extends Ox{constructor(){super(...arguments),this.beanName="showRowGroupColValueSvc"}getGroupValue(e,t,s){if(!t)return e.group?{displayedNode:e,value:e.groupValue}:null;const i=this.beans.valueSvc,r=t.showRowGroup;if(!r)return null;if(e.level===-1&&e.footer)return{displayedNode:e,value:null};if(typeof r=="string"){const o=this.beans.colModel.colsById[r];if(o?.rowGroupActive&&o.rowGroupActiveIndex>e.level)return null;const a=this.getDisplayedNode(e,t,!0);if(a)return{displayedNode:a,value:i.getValueFromData(t,a,s)}}const n=i.getValueFromData(t,e,s);if(n==null){const o=this.getDisplayedNode(e,t);if(o)return{displayedNode:o,value:i.getValueFromData(t,o,s)}}return{displayedNode:e,value:n}}formatAndPrefixGroupColValue(e,t,s=!1){const i=this.formatGroupColValue(e,t,s),{value:r,displayedNode:n}=e,o=this.beans.footerSvc;return o?.doesCellShowTotalPrefix(n,t)?o.applyTotalPrefix(r,i,n,t):n.footer&&n.level===-1?null:i}formatGroupColValue(e,t,s=!1){const i=this.beans.valueSvc,{displayedNode:r,value:n}=e,o=r.rowGroupColumn,a=r.group&&!t;if(o&&(a||t?.isRowGroupDisplayed(o.colId))){if(s&&o.colDef.useValueFormatterForExport===!1)return null;const c=i.formatValue(o,r,n);return r.key===""&&!c?this.getLocaleTextFunc()("blanks","(Blanks)"):c}return!t||r.group||s&&t.colDef.useValueFormatterForExport===!1?null:i.formatValue(t,r,n)}getDisplayedNode(e,t,s=!1){const i=this.gos,r=i.get("groupHideOpenParents"),n=i.get("showOpenedGroup")&&!s;if(!r&&!n)return;const o=t.showRowGroup;if(o===!0)return e.group?void 0:e.parent??void 0;let a=e;for(;a&&a.rowGroupColumn?.colId!=o;){const l=a===a.parent?.getFirstChild();if(!n&&!l)return;a=a.parent}if(a!==e)return a??void 0}};import{_pushToMapArray as e7}from"ag-stack";import{BeanStub as t7}from"ag-grid-community";var s7=class extends Nx{constructor(){super(...arguments),this.beanName="showRowGroupCols",this.columns=[],this.sourceCols=[],this.colsSet=new Set}destroy(){super.destroy(),this.columns.length=0,this.colsSet.clear(),this.clearStamps()}clearStamps(){const e=this.sourceCols;for(let t=0,s=e.length;t<s;++t)e[t].showRowGroupCol=null;e.length=0}refresh(){const{colModel:e,rowGroupColsSvc:t}=this.beans,s=this.columns,i=this.colsSet;this.clearStamps();const r=this.sourceCols,n=s.length;let o=0,a=!1;const l=e.colsList;for(let c=0,u=l.length;c<u;++c){const d=l[c],p=d.colDef.showRowGroup;if(typeof p=="string"){const g=e.getNonPivotColById(p);g&&(g.showRowGroupCol=d,r.push(g))}else if(p===!0){const g=t?.columns;if(g)for(let f=0,m=g.length;f<m;++f){const v=g[f];v.showRowGroupCol=d,r.push(v)}}else continue;a||(a=o>=n||!i.has(d)),s[o++]=d}if(a||(a=o!==n),a){s.length=o,i.clear();for(let c=0;c<o;++c)i.add(s[c]);this.eventSvc.dispatchEvent({type:"showRowGroupColsSetChanged"})}}getSourceColumnsForGroupColumn(e){const t=e.showRowGroup;if(!t)return null;const{rowGroupColsSvc:s,colModel:i}=this.beans;if(t===!0)return s?s.columns:null;const r=i.getNonPivotCol(t);return r?[r]:null}isRowGroupDisplayed(e,t){const s=e.showRowGroup;return s===!0||s!=null&&s===t}interleaveSortedColumns(e){const t=this.beans.rowGroupColsSvc?.columns;if(!t)return e;const s=new Map;for(let n=0,o=t.length;n<o;++n){const a=t[n],l=a.sortDef.direction?a.showRowGroupCol:null;l&&e7(s,l,a)}if(s.size===0)return e;const i=new Set,r=[];for(let n=0,o=e.length;n<o;++n){const a=e[n],l=a.showRowGroupCol??a;if(i.has(l))continue;i.add(l),r.push(l);const c=s.get(l);for(let u=0,d=c?.length??0;u<d;++u)r.push(c[u])}return r}fillCoupledSortIndexMap(e,t){let s=-1;for(let i=0,r=e.length;i<r;++i){const n=e[i],o=n.showRowGroupCol;t.set(n,o&&o!==n?s:++s)}return s}isGroupSortMixed(e,t){const s=this.getSourceColumnsForGroupColumn(e);if(!s)return!0;for(let i=0,r=s.length;i<r;++i)if(t!==s[i].sortDef.direction)return!0;return!1}};import{BeanStub as i7,_isClientSideRowModel as r7,_isGroupRowsSticky as n7,_isServerSideRowModel as o7}from"ag-grid-community";import{_last as a7}from"ag-stack";import{BeanStub as l7,_getRowHeightForNode as c7,_isClientSideRowModel as u7,_isGroupRowsSticky as d7}from"ag-grid-community";var h7=class extends Bx{constructor(e,t){super(),this.createRowCon=e,this.destroyRowCtrls=t,this.stickyTopRowCtrls=[],this.stickyBottomRowCtrls=[],this.extraTopHeight=0,this.extraBottomHeight=0}postConstruct(){this.isClientSide=u7(this.gos),this.beans.ctrlsSvc.whenReady(this,e=>{this.gridBodyCtrl=e.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop(e){this.extraTopHeight!==e&&(this.extraTopHeight=e,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:e}))}setOffsetBottom(e){this.extraBottomHeight!==e&&(this.extraBottomHeight=e)}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup(e){return this.isClientSide?g7(e):p7(e)}getFirstPixelOfGroup(e){const t=e.footer&&e.sibling;return t?t.rowTop+t.rowHeight-1:e.hasChildren()?e.rowTop-1:0}updateStickyRows(e){const t=e==="top";let s=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight(e,new Set,s);const i=new Set,{rowModel:r,rowRenderer:n,pinnedRowModel:o,pageBounds:a,rowContainerHeight:l}=this.beans,{pageFirstPixel:c,pageLastPixel:u}=a.getCurrentPagePixelRange(),d=t?n.firstVisibleVPixel-this.extraTopHeight:n.lastVisibleVPixel-this.extraTopHeight,h=n.lastVisibleVPixel-n.firstVisibleVPixel,p=h>0?h*this.gos.get("stickyRowsMaxViewportRatio"):Number.MAX_SAFE_INTEGER,g=l.divStretchOffset??0,f=c+g,m=u+g,v=y=>{if(i.add(y),t){const T=this.getLastPixelOfGroup(y),x=d+s+y.rowHeight;T<x?y.stickyRowTop=s+(T-x):y.stickyRowTop=s}else{const T=this.getFirstPixelOfGroup(y),x=d-(s+y.rowHeight);T>x?y.stickyRowTop=s-(T-x):y.stickyRowTop=s}s=0,i.forEach(T=>{const x=T.stickyRowTop+T.rowHeight;s<x&&(s=x)})},C=this.areFooterRowsStickySuppressed(),S=this.gos.get("suppressGroupRowsSticky");let w=d;const b=y=>{if(!y.displayed||y.rowHeight>p)return!1;if(y.footer){if(C===!0||C==="grand"&&y.level===-1||C==="group"&&y.level>-1)return!1;if(y.level>-1){const x=y.sibling?.rowIndex,F=y.rowIndex,A=x!=null&&F!=null?x+1===F:!1;if(e==="bottom"&&A||e==="top"&&!A)return!1}if(y.level===-1&&o?.getGrandTotalPinned())return!1;if(e==="bottom"){if(y.level===-1)return!i.has(y);{const x=y.sibling,F=x?.rowIndex;if(F==null)return!1;const A=r.getRowBounds(F),P=A?.rowTop??x.rowTop,D=A?.rowHeight??x.rowHeight;if(P==null||D==null||P+D-1>w)return!1}}return!i.has(y)}return y.isExpandable()?S===!0||e==="bottom"?!1:!i.has(y)&&!!y.expanded:!1};for(let y=0;y<100;y++){let T=d+s;t||(T=d-s),t&&T<f?T=f:!t&&T>m&&(T=m),w=T;const x=r.getRowIndexAtPixel(T),F=r.getRow(x);if(F==null)break;const P=this.getStickyAncestors(F).find(N=>(t?N.rowIndex<x:N.rowIndex>x)&&b(N));if(P){if(s+P.rowHeight>p)break;v(P);continue}if((t?F.rowTop<T:F.rowTop+F.rowHeight>T)&&b(F)){if(s+F.rowHeight>p)break;v(F);continue}break}return t||i.forEach(y=>{y.stickyRowTop=s-(y.stickyRowTop+y.rowHeight)}),this.refreshNodesAndContainerHeight(e,i,s)}areFooterRowsStickySuppressed(){const e=this.gos.get("suppressStickyTotalRow");if(e===!0)return!0;const t=e==="group",s=e==="grand";return t&&s?!0:s?"grand":t?"group":!1}canRowsBeSticky(){const e=d7(this.gos),t=this.areFooterRowsStickySuppressed(),s=this.gos.get("suppressGroupRowsSticky");return e&&(!t||!s)}getStickyAncestors(e){const t=[];let s=e.footer?e.sibling:e.parent;for(;s;)s.sibling&&t.push(s.sibling),t.push(s),s=s.parent;return t.reverse()}checkStickyRows(){const e=this.updateStickyRows("top"),t=this.updateStickyRows("bottom");return e||t}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode(e){const t=new Set;if(this.stickyTopRowCtrls.some(s=>s.rowNode===e)){for(let s=0;s<this.stickyTopRowCtrls.length;s++){const i=this.stickyTopRowCtrls[s].rowNode;i!==e&&t.add(i)}this.refreshNodesAndContainerHeight("top",t,this.topContainerHeight)&&this.checkStickyRows();return}for(let s=0;s<this.stickyBottomRowCtrls.length;s++){const i=this.stickyBottomRowCtrls[s].rowNode;i!==e&&t.add(i)}this.refreshNodesAndContainerHeight("bottom",t,this.bottomContainerHeight)&&this.checkStickyRows()}refreshNodesAndContainerHeight(e,t,s){const i=e==="top",r=i?this.stickyTopRowCtrls:this.stickyBottomRowCtrls,n={},o=[];for(let p=0;p<r.length;p++){const g=r[p].rowNode;if(!t.has(g)){n[g.id]=r[p],g.sticky=!1;continue}o.push(r[p])}const a=new Set;for(let p=0;p<o.length;p++)a.add(o[p].rowNode);const l=[];t.forEach(p=>{a.has(p)||(p.sticky=!0,l.push(this.createRowCon(p,!1,!1)))});let c=!!l.length||o.length!==r.length;i?this.topContainerHeight!==s&&(this.topContainerHeight=s,this.gridBodyCtrl.setStickyTopHeight(s),c=!0):this.bottomContainerHeight!==s&&(this.bottomContainerHeight=s,this.gridBodyCtrl.setStickyBottomHeight(s),c=!0),this.destroyRowCtrls(n,!1);const u=[...o,...l];u.sort((p,g)=>g.rowNode.rowIndex-p.rowNode.rowIndex),i||u.reverse();for(const p of u)p.setRowTop(p.rowNode.stickyRowTop);const d=this.beans.pageBounds;let h=0;if(i){for(const p of t)p.rowIndex<d.getFirstRow()&&(h+=p.rowHeight);h>this.topContainerHeight&&(h=this.topContainerHeight),this.setOffsetTop(h)}else{for(const p of t)p.rowIndex>d.getLastRow()&&(h+=p.rowHeight);h>this.bottomContainerHeight&&(h=this.bottomContainerHeight),this.setOffsetBottom(h)}return c?(i?this.stickyTopRowCtrls=u:this.stickyBottomRowCtrls=u,!0):!1}ensureRowHeightsValid(){let e=!1;const t=s=>{const i=s.rowNode;if(i.rowHeightEstimated){const r=c7(this.beans,i);i.setRowHeight(r.height),e=!0}};return this.stickyTopRowCtrls.forEach(t),this.stickyBottomRowCtrls.forEach(t),e}};function p7(e){if(e.isExpandable()||e.footer){if(e.master&&e.detailNode)return e.detailNode.rowTop+e.detailNode.rowHeight;if(!e.sibling||Math.abs(e.sibling.rowIndex-e.rowIndex)===1){let s=e.childStore?.getStoreBounds();return e.footer&&(s=e.sibling?.childStore?.getStoreBounds()),(s?.heightPx??0)+(s?.topPx??0)}return e.footer?e.rowTop+e.rowHeight:e.sibling.rowTop+e.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function g7(e){if(e.isExpandable()||e.footer){if(e.footer&&e.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!e.sibling||Math.abs(e.sibling.rowIndex-e.rowIndex)===1){let i=e.footer&&e.sibling||e;for(;i.isExpandable()&&i.expanded;)if(i.master&&i.detailNode)i=i.detailNode;else if(i.childrenAfterSort){if(i.childrenAfterSort.length===0)break;i=a7(i.childrenAfterSort)}return i.rowTop+i.rowHeight}return e.footer?e.rowTop+e.rowHeight:e.sibling.rowTop+e.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var f7=class extends Vx{constructor(){super(...arguments),this.beanName="stickyRowSvc"}createStickyRowFeature(e,t,s){const i=this.gos;if(n7(i)&&r7(i)||o7(i))return e.createManagedBean(new h7(t,s))}},qm={moduleName:"GroupCellRenderer",version:G,userComponents:{agGroupRowRenderer:Ym,agGroupCellRenderer:Ym},dynamicBeans:{groupCellRendererCtrl:jm},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[ZW],dependsOn:[$]},Xm={moduleName:"GroupColumn",version:G,beans:[Xz,s7,QW,_z,Cm,gm],dependsOn:[$,qm]},Xl={moduleName:"ChangedPath",version:G,beans:[sW],dependsOn:[$]},_s={moduleName:"CsrmHierarchy",version:G,rowModels:["clientSide"],beans:[gW,lW],dependsOn:[Xl]},Zm={moduleName:"CsrmGroupStages",version:G,rowModels:["clientSide"],beans:[_W,AW,DW],dependsOn:[_s]},Zl={moduleName:"StickyRow",version:G,beans:[f7]},Jm={moduleName:"GroupEdit",version:G,beans:[yW],dependsOn:[_s]};import{AgColumn as m7,BeanStub as v7,GROUP_HIERARCHY_COLUMN_ID_PREFIX as C7,_addColumnDefaultAndTypes as Jl}from"ag-grid-community";import{_pushToMapArray as Qm}from"ag-stack";var S7=e=>{const t=e.edit,s=t.node,i=[];if(e.treeDepth===0){for(let a=s.next;a!==s;a=a.next)i.push(a.col);e.columns=i,e.columnTree=i;return}const r=new Map,n=new Set;for(let a=s.next;a!==s;a=a.next){const l=a.col;i.push(l);let c=l.originalParent;for(;c!==null&&!n.has(c);)n.add(c),Qm(r,c.originalParent,c),c=c.originalParent;Qm(r,l.originalParent,l)}let o=e.columnTree;for(const a of t.affectedParents){const l=r.get(a)??[];a!==null?a.children=l:o=l}e.columns=i,e.columnTree=o},ev=e=>{const t={col:null,prev:null,next:null},s=new Map,i=e.columns;let r=t;for(let o=0,a=i.length;o<a;++o){const l={col:i[o],prev:r,next:t};r.next=l,s.set(i[o].colId,l),r=l}r.next=t,t.prev=r;const n={node:t,byId:s,affectedParents:new Set,commit:S7};return e.edit=n,n},tv=(e,t,s)=>{const i=e.edit??ev(e),r=i.node,n=i.byId,o=s!=null?n.get(s):void 0,a=o??r.prev,l=a.next,c={col:t,prev:a,next:l};if(a.next=c,l.prev=c,n.set(t.colId,c),o){const d=o.col.originalParent;t.originalParent=d,e.treeDepth>0&&i.affectedParents.add(d);return}t.originalParent=null;const u=e.treeDepth;u>0&&(e.wrapperCache.wrap(t,u,e.buildToken),i.affectedParents.add(null))},b7=(e,t)=>{const s=t.length;if(s===0)return;const i=e.edit??ev(e),r=i.node,n=i.byId,o=e.wrapperCache,a=e.treeDepth,l=e.buildToken;for(let c=s-1;c>=0;--c){const u=t[c];u.buildToken=l,o.wrap(u,a,l);const d=r.next,h={col:u,prev:r,next:d};r.next=h,d.prev=h,n.set(u.colId,h)}a>0&&i.affectedParents.add(null)};import{MONTHS as sv,_getDateParts as y7,_parseDateTimeFromString as w7}from"ag-stack";var x7=({valueSvc:e,dataTypeSvc:t},s,i)=>{const r=i?e.getValueFromData(s,i):void 0;let n=null;return r instanceof Date?n=r:typeof r=="string"&&(n=(t?.getDateParserFunction(s)??w7)(r)??null),n},F7=(e,t,s,i)=>r=>{const n=x7(e,t,r.node),o=y7(n);return o?i?.(o[s])??o[s]:null},T7=({colNames:e},t,s)=>i=>{const r=e.getDisplayNameForColumn(t,i.location);return r?`${r} (${s})`:""},A7=Object.fromEntries(sv.map(e=>[e,e.toLowerCase()])),P7=e=>{const t=sv[Number.parseInt(e,10)-1]??e,s=A7[t]??e;return{month:t,localeKey:s}},iv={year:{label:"Year",index:0},quarter:{label:"Quarter",index:1,map:e=>Math.ceil(Number(e)/3).toString()},month:{label:"Month",index:1},formattedMonth:{label:"Month",localeKey:"month",index:1,map:(e,t)=>{const s=P7(e);return t(s.localeKey,s.month)}},day:{label:"Day",index:2},hour:{label:"Hour",index:3},minute:{label:"Minute",index:4},second:{label:"Second",index:5}},R7=class extends Hx{constructor(){super(...arguments),this.beanName="groupHierarchyColSvc",this.columns=[],this.sourceColumnMap=new Map,this.virtualColInfo=new Map}contributeTo(e){const{plan:t,matches:s}=this.planHierarchy(e.columns);if(t.length===0){this.columns.length>0&&this.clearColumns();return}s?this.reapplyDefs(t,e.source):this.rebuildColumns(t),b7(e,this.columns)}reapplyDefs(e,t){const{columns:s,gos:i}=this;for(let r=0,n=e.length;r<n;++r){const{sourceCol:o,part:a,colId:l}=e[r],c=s[r],u=this.createColDefForPart(a,o,l,c.colDef);c.setColDef(u,null,t)&&i.validateColDef(u,l,!0)}}rebuildColumns(e){const{sourceColumnMap:t,virtualColInfo:s,beans:i,gos:r}=this;t.clear(),s.clear();const n=new Array(e.length);for(let o=0,a=e.length;o<a;++o){const{sourceCol:l,part:c,colId:u}=e[o],d=this.createColDefForPart(c,l,u);r.validateColDef(d,u,!0);const h=new m7(d,null,u,!0,"hierarchy");i.context.createBean(h),n[o]=h;const p=t.get(l);s.set(h,{source:l,index:p?.length??0}),p?p.push(h):t.set(l,[h])}this.columns=n}planHierarchy(e){const t=this.gos.get("groupHierarchyConfig"),s=this.columns,i=[];let r=!0;for(let n=0,o=e.length;n<o;++n){const a=e[n],l=I7(a);if(l!=null)for(let c=0,u=l.length;c<u;++c){const d=l[c],h=M7(a.colId,d,t);if(h===null)continue;const p=i.length;r&&(p>=s.length||s[p].colId!==h)&&(r=!1),i.push({sourceCol:a,part:d,colId:h})}}return{plan:i,matches:r&&i.length===s.length}}destroy(){this.clearColumns(),super.destroy()}clearColumns(){this.columns=[],this.sourceColumnMap.clear(),this.virtualColInfo.clear()}compareVirtualColumns(e,t){const s=this.virtualColInfo,i=s.get(e),r=s.get(t);return i!==void 0&&r!==void 0?i.source===r.source?i.index-r.index:null:r?.source===e?1:i?.source===t?-1:null}getVirtualCols(e){return this.sourceColumnMap.get(e)}createColDefForPart(e,t,s,i){const{beans:r,gos:n}=this;if(typeof e!="string")return Jl(r,e,s,!0);const{enableRowGroup:o,enablePivot:a}=t.colDef,l={enableRowGroup:o,enablePivot:a,hide:!0,editable:!1},c=n.get("groupHierarchyConfig")??{};if(e in c){const g={...l,...c[e]};return g.colId??(g.colId=s),Jl(r,g,g.colId,!0)}const u=Jl(r,{colId:s,...l},s,!0);if(i?.valueGetter)return{...u,headerValueGetter:i.headerValueGetter,valueGetter:i.valueGetter};const d=iv[e],h=this.getLocaleTextFunc(),{map:p}=d;return{...u,headerValueGetter:T7(r,t,h(d.localeKey??e,d.label)),valueGetter:F7(r,t,d.index,p&&(g=>p(g,h)))}}},M7=(e,t,s)=>typeof t!="string"?t.colId||null:s?.[t]===void 0&&!(t in iv)?null:`${C7}-${e}-${t}`,I7=e=>{const t=e.colDef;return!t.rowGroup&&!t.enableRowGroup&&t.rowGroupIndex==null&&!t.pivot&&!t.enablePivot&&t.pivotIndex==null?null:t.groupHierarchy??t.rowGroupingHierarchy},E7={moduleName:"GroupHierarchy",version:G,beans:[R7],dependsOn:[Xl]};import{Component as D7,_createElement as L7}from"ag-grid-community";var k7=class extends Ux{constructor(){super()}postConstruct(){this.setGui(this.createNorthPanel());const e=this.onRowGroupChanged.bind(this);this.addManagedEventListeners({columnRowGroupChanged:e,newColumnsLoaded:e}),this.addManagedPropertyListener("rowGroupPanelShow",e),this.addManagedPropertyListener("pivotPanelShow",()=>this.onPivotPanelShow()),this.onRowGroupChanged()}createNorthPanel(){const e=L7({tag:"div",cls:"ag-column-drop-wrapper",role:"presentation"}),t=new ja(!0);this.rowGroupComp=this.createManagedBean(t);const s=new Ka(!0);this.pivotComp=this.createManagedBean(s),e.appendChild(t.getGui()),e.appendChild(s.getGui());const i=this.onDropPanelVisible.bind(this);return this.addManagedListeners(t,{displayChanged:i}),this.addManagedListeners(s,{displayChanged:i}),this.onDropPanelVisible(),e}onDropPanelVisible(){const{rowGroupComp:e,pivotComp:t}=this,s=e.isDisplayed()&&t.isDisplayed(),i="ag-column-drop-horizontal-half-width";e.toggleCss(i,s),t.toggleCss(i,s)}onRowGroupChanged(){const e=this.rowGroupComp;if(!e)return;const t=this.gos.get("rowGroupPanelShow");if(t==="always")e.setDisplayed(!0);else if(t==="onlyWhenGrouping"){const s=this.beans.rowGroupColsSvc?.columns?.length!==0;e.setDisplayed(s)}else e.setDisplayed(!1)}onPivotPanelShow(){const e=this.pivotComp;if(!e)return;const t=this.gos.get("pivotPanelShow");if(t==="always")e.setDisplayed(!0);else if(t==="onlyWhenPivoting"){const s=this.beans.colModel.isPivotActive();e.setDisplayed(s)}else e.setDisplayed(!1)}getFocusableContainers(){return[this.rowGroupComp,this.pivotComp].filter(e=>!!e)}},_7={selector:"AG-GRID-HEADER-DROP-ZONES",component:k7};import{BeanStub as G7}from"ag-grid-community";var O7=class extends zx{constructor(){super(...arguments),this.beanName="rowGroupPanelBuilder"}createRowGroupDropZone(e,t=!1){return new ja(e,void 0,t)}createPivotDropZone(e,t=!1){return new Ka(e,void 0,t)}};import{RefPlaceholder as rv,_clearElement as Ql,_setDisplayed as N7}from"ag-stack";import{AgPromise as Ki,AgSelect as B7,FilterComp as V7,TabGuardComp as H7,_createElement as U7}from"ag-grid-community";function z7(e){return e.buttons&&(e.buttons=[]),e}var W7={tag:"div",cls:"ag-group-filter",children:[{tag:"div",ref:"eGroupField"},{tag:"div",ref:"eUnderlyingFilter"}]},$7=class extends Wx{constructor(){super(W7),this.filterType="group",this.eGroupField=rv,this.eUnderlyingFilter=rv}wireBeans(e){this.groupFilterSvc=e.groupFilter}postConstruct(){this.initialiseTabGuard({})}init(e){return this.params=e,this.updateParams().then(()=>{this.addHandlerListeners(this.updateGroups.bind(this))})}refresh(e){const t=e;return this.params=t,t.source==="colDef"&&this.updateParams(),!0}updateParams(){return this.validateParams(),this.updateGroups()}validateParams(){const{colDef:e}=this.params;e.field&&this.beans.log.warn(234),e.filterValueGetter&&this.beans.log.warn(235),e.filterParams&&this.beans.log.warn(236)}addHandlerListeners(e){const t=this.addManagedListeners(this.getHandler(),{sourceColumnsChanged:()=>{this.updateGroups()},destroyed:()=>{for(const s of t)s();this.addHandlerListeners(e)}})}updateGroups(){const{sourceColumns:e,selectedColumn:t}=this.updateGroupField();return this.dispatchLocalEvent({type:"columnsChanged"}),this.getUnderlyingFilters(e,t)}updateGroupField(){this.groupColumn=this.params.column;const e=this.getHandler();if(!e)return{sourceColumns:null};const{sourceColumns:t,hasMultipleColumns:s,selectedColumn:i}=e,r=this.eGroupField;return Ql(r),this.eGroupFieldSelect&&this.destroyBean(this.eGroupFieldSelect),s&&t&&(this.createGroupFieldSelectElement(t,i),r.appendChild(this.eGroupFieldSelect.getGui()),r.appendChild(U7({tag:"div",cls:"ag-filter-separator"}))),N7(r,s),{sourceColumns:t,selectedColumn:i}}createGroupFieldSelectElement(e,t){const s=this.createManagedBean(new B7);this.eGroupFieldSelect=s;const i=this.getLocaleTextFunc();s.setLabel(i("groupFilterSelect","Select field:")),s.setLabelAlignment("top"),s.addOptions(e.map(r=>({value:r.colId,text:this.beans.colNames.getDisplayNameForColumn(r,"groupFilter",!1)??void 0}))),s.setValue(t.colId),s.onValueChange(r=>this.updateSelectedColumn(r)),s.addCss("ag-group-filter-field-select-wrapper"),e.length===1&&s.setDisabled(!0)}getUnderlyingFilters(e,t){if(!e)return this.filterColumnPairs=void 0,this.selectedFilter=void 0,Ki.resolve();const s=[],i=[],r=this.beans.colFilter;for(const n of e){const o=r.getOrCreateFilterUi(n);o&&s.push(o.then(a=>{a&&i.push({filter:a,column:n}),n.colId===t.colId&&(this.selectedFilter=a??void 0)}))}return Ki.all(s).then(()=>{this.filterColumnPairs=i})}addUnderlyingFilterElement(e){if(Ql(this.eUnderlyingFilter),!e)return Ki.resolve();const t=this.createManagedBean(new V7(e,"COLUMN_MENU"));return this.filterComp=t,t.hasFilter()?(this.eUnderlyingFilter.appendChild(t.getGui()),t.getFilter()?.then(()=>{t.afterGuiAttached?.(this.afterGuiAttachedParams),!this.afterGuiAttachedParams?.suppressFocus&&this.eGroupFieldSelect&&!this.eGroupFieldSelect.isDisabled()&&this.eGroupFieldSelect.getFocusableElement().focus()})??Ki.resolve()):Ki.resolve()}updateSelectedColumn(e){if(!e)return;this.filterComp?.afterGuiDetached(),this.destroyBean(this.filterComp);const t=this.getFilterColumnPair(e),s=t?.column;this.selectedFilter=t?.filter,this.getHandler().setSelectedColumn(s),this.dispatchLocalEvent({type:"columnsChanged"}),this.addUnderlyingFilterElement(s)}isFilterActive(){return this.groupFilterSvc.isFilterActive(this.groupColumn)}doesFilterPass(){return!0}getModel(){return null}setModel(){}afterGuiAttached(e){this.afterGuiAttachedParams=e,this.addUnderlyingFilterElement(this.getHandler().selectedColumn)}afterGuiDetached(){Ql(this.eUnderlyingFilter),this.selectedFilter?.afterGuiDetached?.()}getSelectedColumn(){return this.getHandler().selectedColumn}getHandler(){return this.params.getHandler()}getFilterColumnPair(e){if(e)return this.filterColumnPairs?.find(({column:t})=>t.colId===e)}};import{BeanStub as K7}from"ag-grid-community";var j7=class extends $x{init(e){this.params=e,this.validateModel(e),this.updateColumns(),this.addManagedEventListeners({columnRowGroupChanged:this.updateColumns.bind(this),filterDestroyed:t=>this.onFilterDestroyed(t)})}refresh(e){this.params=e,this.validateModel(e),e.source==="colDef"&&this.updateColumns()}doesFilterPass(){return!0}setSelectedColumn(e){this.selectedColumn=e,this.dispatchLocalEvent({type:"selectedColumnChanged"})}validateModel(e){e.model!=null&&e.onModelChange(null)}getSourceColumns(){const e=this.params.column;if(this.gos.get("treeData"))return this.warn(237),[];const t=this.beans.groupFilter.getSourceColumns(e);return t||(this.warn(183),[])}updateColumns(){const e=this.getSourceColumns(),t=e.filter(r=>r.isFilterAllowed());this.sourceColumns=t;let s,i;t.length?e.length===1?(s=t[0],i=!1):(s=this.selectedColumn,(!s||!t.some(r=>r.getId()===s.getId()))&&(s=t[0]),i=!0):(s=void 0,i=!1),this.selectedColumn=s,this.hasMultipleColumns=i,this.dispatchLocalEvent({type:"sourceColumnsChanged"})}onFilterDestroyed({column:e,source:t}){if(t==="gridDestroyed")return;const s=e.getColId();this.sourceColumns?.some(i=>i.colId===s)&&setTimeout(()=>{this.isAlive()&&this.updateColumns()})}};import{BeanStub as Y7}from"ag-grid-community";var q7=class extends Kx{constructor(){super(...arguments),this.beanName="groupFilter"}postConstruct(){this.addManagedEventListeners({columnRowGroupChanged:()=>this.updateFilterFlags("columnRowGroupChanged")})}isGroupFilter(e){return e.colDef.filter==="agGroupColumnFilter"}isFilterAllowed(e){const t=this.beans.colFilter;return!!this.getSourceColumns(e)?.some(s=>t?.isFilterAllowed(s))}isFilterActive(e){const t=this.beans.colFilter;return!!this.getSourceColumns(e)?.some(s=>t?.isFilterActive(s))}getSourceColumns(e){return this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(e)}updateFilterFlags(e,t){const{autoColSvc:s,colFilter:i}=this.beans,r=s?.columns;if(!(!r||!i))for(let n=0,o=r.length;n<o;++n){const a=r[n];this.isGroupFilter(a)&&i.setColFilterActive(a,this.isFilterActive(a),e,t)}}};import{RefPlaceholder as X7,_clearElement as Z7}from"ag-stack";import{AgInputTextField as J7,AgPromise as ec,Component as Q7,_isGroupMultiAutoColumn as e$}from"ag-grid-community";var t$={tag:"div",ref:"eFloatingFilter",cls:"ag-group-floating-filter ag-floating-filter-input",role:"presentation"},s$=class extends jx{constructor(){super(t$),this.eFloatingFilter=X7,this.haveAddedColumnListeners=!1}init(e){this.params=e;const t=e$(this.gos),s=this.onColChange.bind(this),i=r=>{t?this.setupUnderlyingFloatingFilterElement().then(()=>r()):(this.setupReadOnlyFloatingFilterElement(),r())};return this.gos.get("enableFilterHandlers")?new ec(r=>i(r)).then(()=>{this.addHandlerListeners(e,s)}):new ec(r=>{this.params.parentFilterInstance(n=>{this.parentFilterInstance=n,i(r)})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{columnsChanged:s})})}refresh(e){if(this.params=e,this.setParams(),this.gos.get("enableFilterHandlers"))if(this.showingUnderlyingFloatingFilter){const t=this.getSelectedColumn(),s=this.beans.colFilter.getFloatingFilterCompDetails(t,this.params.showParentFilter);this.underlyingFloatingFilter?.refresh?.(s?.params)}else this.updateDisplayedValue()}setParams(){const e=this.beans.colNames.getDisplayNameForColumn(this.params.column,"header",!0),t=this.getLocaleTextFunc();this.eFloatingFilterText?.setInputAriaLabel(`${e} ${t("ariaFilterInput","Filter Input")}`)}addHandlerListeners(e,t){const s=this.addManagedListeners(e.getHandler(),{selectedColumnChanged:t,sourceColumnsChanged:t,destroyed:()=>{for(const i of s)i();this.addHandlerListeners(this.params,t)}})}setupReadOnlyFloatingFilterElement(){this.eFloatingFilterText||(this.eFloatingFilterText=this.createManagedBean(new J7),this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams()),this.updateDisplayedValue(),this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui())}setupUnderlyingFloatingFilterElement(){this.showingUnderlyingFloatingFilter=!1,this.underlyingFloatingFilter=void 0,Z7(this.eFloatingFilter);const e=this.getSelectedColumn();if(e&&!e.isVisible()){const t=this.beans.colFilter,s=t.getFloatingFilterCompDetails(e,this.params.showParentFilter);if(s)return this.haveAddedColumnListeners||(this.haveAddedColumnListeners=!0,this.addManagedListeners(e,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)})),s.newAgStackInstance().then(i=>{this.underlyingFloatingFilter=i,this.underlyingFloatingFilter?.onParentModelChanged(t.getModelForColumn(e)),this.appendChild(i.getGui()),this.showingUnderlyingFloatingFilter=!0})}return this.setupReadOnlyFloatingFilterElement(),ec.resolve()}getSelectedColumn(){return this.gos.get("enableFilterHandlers")?this.params.getHandler().selectedColumn:this.parentFilterInstance.getSelectedColumn()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(e){if(!e.column)return;const t=this.beans.colFilter.getFloatingFilterCompDetails(e.column,this.params.showParentFilter);t&&this.underlyingFloatingFilter?.refresh?.(t.params)}onParentModelChanged(e,t){this.showingUnderlyingFloatingFilter?this.underlyingFloatingFilter?.onParentModelChanged(this.beans.colFilter.getModelForColumn(this.getSelectedColumn()),t):this.updateDisplayedValue()}updateDisplayedValue(){const e=this.eFloatingFilterText;if(!e)return;const t=this.beans.colFilter,s=this.getSelectedColumn(),i=r=>{if(!r)e.setValue(""),e.setDisplayed(!1);else{const n=s?t.getModelForColumn(s):null;e.setValue(n==null?"":r.getModelAsString?.(n)??""),e.setDisplayed(!0)}};s?this.gos.get("enableFilterHandlers")?i(t.getHandler(s)):t.getOrCreateFilterUi(s)?.then(r=>{i(r)}):i()}onColChange(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}};import{BeanStub as i$,RowNode as r$,_csrmFirstLeaf as nv,_forEachChangedGroupDepthFirst as ov}from"ag-grid-community";var n$=(e,t)=>{if(!e){t.length=0;return}const s=e.length;t.length=s;for(let i=0;i<s;i++){const r=e[i],n=r.colDef;t[i]={col:r,field:n.field,type:n.type,keyCreator:n.keyCreator,valueGetter:n.valueGetter}}},o$=(e,t)=>{const s=e.length;if(s!==t?.length)return!0;for(let i=0;i<s;i++){const r=e[i],n=t[i];if(r.col!==n)return!0;const o=n.colDef;if(r.field!==o.field||r.type!==o.type||r.valueGetter!==o.valueGetter||r.keyCreator!==o.keyCreator)return!0}return!1};function a$(e){if(!e)return!1;const t=e.length;if(t<2)return!1;let s=!1;for(let i=1;i<t;i++)if(av(e[i-1],e[i])>0){s=!0;break}return s?(e.sort(av),!0):!1}function av(e,t){const s=e.sourceRowIndex,i=t.sourceRowIndex,r=s>=0,n=i>=0,o=r&&n,a=!r&&!n;return o?s-i:a?e.__objectId-t.__objectId:r?1:-1}var l$=class extends Yx{constructor(){super(...arguments),this.groupCols=[],this.nonLeafsById=new Map,this.pivotMode=!1,this.groupEmpty=!1,this.checkGroupCols=!0}wireBeans(e){this.colModel=e.colModel,this.rowModel=e.rowModel,this.valueSvc=e.valueSvc,this.selectionSvc=e.selectionSvc,this.showRowGroupCols=e.showRowGroupCols,this.rowGroupColsSvc=e.rowGroupColsSvc}invalidateGroupCols(){this.checkGroupCols=!0}destroy(){super.destroy(),this.groupCols.length=0,this.nonLeafsById.clear()}clearNonLeafs(){const e=this.nonLeafsById;for(const t of e.values())t._destroy(null);e.clear()}loadGroupData(e){if(!e.group)return e._groupData=null,null;const t=e.rowGroupColumn,{valueSvc:s,showRowGroupCols:i}=this,r={};if(e._groupData=r,!t)return r;const n=nv(e),o=t.getId();if(!i)return r;const a=i.columns;for(let l=0,c=a.length;l<c;++l){const u=a[l];u.isRowGroupDisplayed(o)&&(r[u.colId]=n&&s.getValueFromData(t,n))}return r}execute(e,t){const s=t.changedPath;if(this.initRefresh(t)!=="skip"){const r=t.changedRowNodes;r?this.handleDeltaUpdate(e,s,r,!!t.animate):this.shotgunResetEverything(e)}this.positionLeafsAndGroups(e,s),this.orderGroups(e)}positionLeafsAndGroups(e,t){ov(e,!0,t,s=>{const i=s.childrenAfterGroup,r=i?.length;if(!r)return;const n=new Array(r);let o=0,a=!1,l;for(let c=0;c<r;++c){const u=i[c];if(!u.childrenAfterGroup?.length)a||(a=o!==c),n[o++]=u;else if(!l&&u.key===""){l=u;const d=r-1;a||(a=c!==d),n[d]=u}}if(a){for(let u=0;u<r;++u){const d=i[u];d.childrenAfterGroup?.length&&d!==l&&(n[o++]=d)}s.childrenAfterGroup=n;const c=s.sibling;c&&(c.childrenAfterGroup=n)}})}initRefresh(e){const{rowGroupColsSvc:t,colModel:s,gos:i}=this;this.pivotMode=s.pivotMode,this.groupEmpty=this.pivotMode||!i.get("groupAllowUnbalanced");const r=t?.columns,n=this.groupCols,o=e.afterColumnsChanged;if(o||!n||this.checkGroupCols)if(this.checkGroupCols=!1,n&&!o$(n,r)){if(o)return"skip"}else{e.animate=!1;const a=n[0]?.col.getId()!==r?.[0]?.getId();return n$(r,n),a?"refresh":"groupColsChanged"}return"refresh"}handleDeltaUpdate(e,t,{removals:s,updates:i,adds:r,reordered:n},o){const a=new Set;for(let l=0,c=s.length;l<c;++l){const u=s[l],d=this.removeFromParent(u);a.has(d)||(a.add(d),t?.addRow(d))}for(const l of i){const c=l.parent;if(t?.addRow(c),this.moveNodeInWrongPath(e,l)){a.add(c);const u=l.parent;t?.addRow(u),n||(n=(u?.childrenAfterGroup?.length??0)>1)}}if(r.size)for(const l of r){this.insertOneNode(e,l);const c=l.parent;t?.addRow(c),n||(n=(c?.childrenAfterGroup?.length??0)>1)}a.size&&(lv(a),this.removeEmptyGroups(a,o)),n&&this.sortChildren(e,t)}sortChildren(e,t){ov(e,!0,void 0,s=>{a$(s.childrenAfterGroup)&&t?.addRow(s)})}orderGroups(e){const t=this.gos.getCallback("initialGroupOrderComparator");if(!t)return;const s=this.beans,i=s.gridApi,r=s.gridOptions.context,n=(a,l)=>t({api:i,context:r,nodeA:a,nodeB:l}),o=a=>{const l=a.childrenAfterGroup,c=l?.length;if(!(!c||a.leafGroup)){c>1&&l.sort(n);for(let u=0,d=c;u<d;++u)o(l[u])}};o(e)}moveNodeInWrongPath(e,t){const{valueSvc:s}=this.beans,i=this.groupEmpty;let r=t.parent,n=!1;const o=this.groupCols;if(!o)return!1;for(let a=o.length-1;a>=0;--a){const{col:l}=o[a];let c=s.getKeyForNode(l,t);if(c==null||c===""){if(!i)continue;c=""}if(!r?.parent||r.key!==c){n=!0;break}r=r.parent}return n||(n=!!r?.parent),n?(this.removeFromParent(t),this.insertOneNode(e,t),t.setData(t.data),!0):!1}groupShouldBeRemoved(e){const t=this.getChildrenMappedKey(e.key,e.rowGroupColumn),s=e.parent?.childrenMapped;return(s?!s[t]:!0)?!1:!!e.group&&(e.childrenAfterGroup?.length??0)===0}removeEmptyGroups(e,t){const s=this.selectionSvc,i=Array.from(e),r=this.nonLeafsById;do{e.clear();for(let n=0;n<i.length;++n){let o=i[n];for(;o;){const a=o.parent;if(o.destroyed){i[n]=a,o=a;continue}if(!a)break;if(!this.groupShouldBeRemoved(o)){o=a;continue}e.add(a),this.removeFromParent(o),o.isSelected()&&s?.removeFromSelection?.(o,"rowGroupChanged"),i[n]=a,r.delete(o.id),o._destroy(t),o=a}}lv(e)}while(e.size)}removeFromParent(e){const t=e.parent;if(t){const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn),i=t.childrenMapped;i&&delete i[s]}return e.setRowTop(null),e.setRowIndex(null),t}addToParent(e,t){const s=t.childrenMapped??(t.childrenMapped={}),i=this.getChildrenMappedKey(e.key,e.rowGroupColumn);if(s[i]!==e){s[i]=e;let r=t.childrenAfterGroup;if(!r){t.childrenAfterGroup=r=[];const n=t.sibling;n&&(n.childrenAfterGroup=t.childrenAfterGroup)}r.push(e),Va(t,this.beans,!0),On(t)}}shotgunResetEverything(e){const t=this.nonLeafsById;for(const r of t.values())r.childrenAfterGroup=null,r.childrenMapped=null;e.leafGroup=!this.groupCols?.length,e.childrenAfterGroup=[],e.childrenMapped={},e.updateHasChildren();const s=e.sibling;s&&(s.childrenAfterGroup=e.childrenAfterGroup,s.childrenMapped=e.childrenMapped);const i=e._leafs;for(let r=0,n=i.length;r<n;++r)this.insertOneNode(e,i[r]);this.destroyStaleGroups(t)}destroyStaleGroups(e){const t=this.selectionSvc;for(const[s,i]of e)i.childrenAfterGroup===null&&(i.isSelected()&&t?.removeFromSelection?.(i,"rowGroupChanged"),e.delete(s),i._destroy(!1))}insertOneNode(e,t){let s=e;const{valueSvc:i,groupCols:r,groupEmpty:n}=this;if(!r)return;const o=r.length;for(let a=0;a<o;++a){const l=r[a],c=l.col;let u=i.getKeyForNode(c,t);if(u==null||u===""){if(!n)continue;u=""}const d=s.childrenMapped?.[this.getChildrenMappedKey(u,c)];if(d){s=d;continue}const h=s.level+1,p=h>=o-1,g=this.createGroup(s,l,u,h,p,t);this.addToParent(g,s),s=g}s.group||this.warn(184,{parentGroupData:s.data,childNodeData:t.data}),t.parent=s,t.level=s.level+1,s.childrenAfterGroup.push(t),s.updateHasChildren(),On(s)}createGroup(e,t,s,i,r,n){const o=t.col,a=(e.level>=0?e.id+"-":"row-group-")+(o.colId+"-"+s),l=this.nonLeafsById;let c=l.get(a),u=!0;if(c){if(c.childrenAfterGroup!==null)return c._expanded??(c._expanded=null),c;u=!1,On(c)}else c=new r$(this.beans),c.group=!0,c.key=s,c.id=a,c.aggData=null,l.set(a,c);const d=f=>{f.childrenAfterGroup=h,f.childrenMapped=p,f.parent=e,f.level=i,f.rowGroupIndex=i,f.leafGroup=r},h=[],p={};if(d(c),c.field=t.field??null,c.rowGroupColumn=o,c.groupValue=this.valueSvc.getValueFromData(o,n),c._expanded??(c._expanded=null),u)return c.setAllChildrenCount(0),c.updateHasChildren(),c;const g=c.sibling;return g&&d(g),c.dispatchRowEvent("hasChildrenChanged"),c}getChildrenMappedKey(e,t){return t?t.getId()+"-"+e:e}onShowRowGroupColsSetChanged(){const{rowModel:e,valueSvc:t}=this;for(const i of this.nonLeafsById.values()){i._groupData=void 0;const r=i.rowGroupColumn,n=r&&nv(i);i.groupValue=n&&t.getValueFromData(r,n)}const s=e.rootNode?._leafs;if(s)for(let i=0,r=s.length;i<r;++i){const n=s[i];n.parent._groupData=void 0}}},lv=e=>{for(const t of e){const s=t?.childrenAfterGroup;if(!s)continue;const i=s.length;let r=0;for(let n=0;n<i;++n){const o=s[n];o.parent===t&&!o.destroyed&&(r!==n&&(s[r]=o),++r)}i!==r&&(s.length=r,t.updateHasChildren(),On(t))}},On=e=>{for(;e._leafs!==void 0;){const t=e.parent;if(!t)break;e._leafs=void 0,e=t}};function c$(e,t){e.rowGroupColsSvc?.setColumns(t,"api")}function u$(e,t){e.rowGroupColsSvc?.removeColumns(t,"api")}function d$(e,t){e.rowGroupColsSvc?.addColumns(t,"api")}function h$(e,t,s){e.rowGroupColsSvc?.moveColumn(t,s,"api")}function p$(e){return e.rowGroupColsSvc?.columns??[]}var tc={moduleName:"SharedRowGrouping",version:G,apiFunctions:{setRowGroupColumns:c$,removeRowGroupColumns:u$,addRowGroupColumns:d$,getRowGroupColumns:p$,moveRowGroupColumn:h$},dependsOn:[$,Wl,Xm,Zl,E7]},sc={moduleName:"RowGrouping",version:G,dynamicBeans:{groupStrategy:l$},rowModels:["clientSide"],dependsOn:[tc,$l,_s,Zm,Jm]},cv={moduleName:"RowGroupingPanel",version:G,beans:[O7],selectors:[_7],icons:{pivotPanel:"pivot",rowGroupPanel:"group",panelDelimiter:"small-right",panelDelimiterRtl:"small-left"},dependsOn:[Ja,NU]},uv={moduleName:"GroupFilter",version:G,userComponents:{agGroupColumnFilter:{classImp:$7,processParams:z7},agGroupColumnFloatingFilter:s$},beans:[q7],dynamicBeans:{agGroupColumnFilterHandler:j7},dependsOn:[$,OU]};import{BeanStub as g$,RowNode as dv,_addGridCommonParams as f$,_addRowHeightChangedListener as m$,_getRowHeightAsNumber as hv,_getRowIdCallback as v$}from"ag-grid-community";var C$=class extends qx{constructor(){super(...arguments),this.beanName="rowModel",this.hierarchical=!1,this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={},this.rootNode=null,this.viewportChangedContext=!1}ensureRowHeightsValid(e,t,s,i){return!1}postConstruct(){const e=this.beans,t=new dv(e);this.rootNode=t,t.level=-1,this.rowHeight=hv(e),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),m$(this,()=>this.refreshRowHeight()),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>this.refreshRowHeight())}refreshRowHeight(){const e=hv(this.beans);e!==this.rowHeight&&(this.rowHeight=e,this.updateRowHeights())}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy(),this.rootNode=null}destroyDatasource(){const e=this.datasource;e&&(e.destroy?.(),this.beans.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getPageSize(){return this.gos.get("viewportRowModelPageSize")}getBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getBufferSize(),s=this.getPageSize(),i=e-t;return i<0?0:Math.floor(i/s)*s}calculateLastRow(e){if(e===-1)return e;const t=this.getBufferSize(),s=this.getPageSize(),i=e+t,r=Math.ceil(i/s)*s,n=this.rowCount-1;return Math.min(r,n)}onViewportChanged(e){const t=this.calculateFirstRow(e.firstRow),s=this.calculateLastRow(e.lastRow);(this.firstRow!==t||this.lastRow!==s)&&(this.firstRow=t,this.lastRow=s,this.purgeRowsNotInViewport(),this.viewportChangedContext=!0,this.datasource?.setViewportRange(this.firstRow,this.lastRow),this.viewportChangedContext=!1)}purgeRowsNotInViewport(){const e=this.rowNodesByIndex;for(const t of Object.keys(e)){const s=parseInt(t,10);if(s<this.firstRow||s>this.lastRow){if(this.isRowFocused(s)||this.beans.editSvc?.isRowEditing(e[s]))continue;delete e[s]}}}isRowFocused(e){const t=this.beans.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.datasource=e,this.rowCount=-1,e.init?e.init(f$(this.gos,{setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)})):this.warn(226)}getType(){return"viewport"}getRow(e){return this.rowNodesByIndex[e]||(this.rowNodesByIndex[e]=this.createBlankRowNode(e)),this.rowNodesByIndex[e]}getRowNode(e){let t;return this.forEachNode(s=>{s.id===e&&(t=s)}),t}getRowCount(){return this.rowCount===-1?0:this.rowCount}getRowIndexAtPixel(e){return this.rowHeight!==0?Math.floor(e/this.rowHeight):0}resetRowHeights(){}onRowHeightChanged(){}getRowBounds(e){const t=this.rowHeight;return{rowHeight:t,rowTop:t*e}}updateRowHeights(){const e=this.rowHeight;this.forEachNode(t=>{t.setRowHeight(e),t.setRowTop(e*t.rowIndex)}),this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}getOverlayType(){return null}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const s=e.rowIndex,i=t.rowIndex,r=s<this.firstRow||s>this.lastRow,n=i<this.firstRow||i>this.lastRow;if(r||n)return[];const o=[],a=s<=i?s:i,l=s<=i?i:s;for(let c=a;c<=l;c++)o.push(this.rowNodesByIndex[c]);return o}forEachNode(e){let t=0;for(const s of Object.keys(this.rowNodesByIndex)){const i=parseInt(s,10),r=this.rowNodesByIndex[i];e(r,t),t++}}setRowData(e){const t=v$(this.beans),s=new Map;if(t)for(const i of Object.values(this.rowNodesByIndex))s.set(i.id,i);for(let i=this.firstRow;i<=this.lastRow;i++){const r=e[i];if(!r)continue;let n,o;if(t?(n=t({data:r,rowPinned:void 0,level:0,parentKeys:void 0}),o=s.get(n)):o=this.rowNodesByIndex[i],o){const a=o.rowIndex;a!=null&&a!==i&&this.rowNodesByIndex[a]===o&&delete this.rowNodesByIndex[a],o.updateData(r),o.setRowIndex(i),o.setRowTop(this.rowHeight*i)}else o=this.createBlankRowNode(i),o.setDataAndId(r,n??i.toString()),this.beans.selectionSvc?.updateRowSelectable(o);this.rowNodesByIndex[i]=o}this.viewportChangedContext||this.eventSvc.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}createBlankRowNode(e){const t=new dv(this.beans),s=this.rowHeight;return t.setRowHeight(s),t.setRowTop(s*e),t.setRowIndex(e),t}setRowCount(e,t=!1){if(e===this.rowCount)return;this.rowCount=e;const s=this.eventSvc;s.dispatchEventOnce({type:"rowCountReady"}),s.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1})}isRowPresent(e){return!!this.getRowNode(e.id)}},pv={moduleName:"ViewportRowModel",version:G,rowModels:["viewport"],beans:[C$],dependsOn:[$]};import{CsvExportModule as S$,HighlightChangesModule as b$,_KeyboardNavigationModule as y$}from"ag-grid-community";function w$(e,t){e.clipboardSvc?.copyToClipboard(t)}function x$(e,t){e.clipboardSvc?.cutToClipboard(t)}function F$(e,t){e.clipboardSvc?.copySelectedRowsToClipboard(t)}function T$(e,t){e.clipboardSvc?.copySelectedRangeToClipboard(t)}function A$(e){e.clipboardSvc?.copyRangeDown()}function P$(e){e.clipboardSvc?.pasteFromClipboard()}import{_exists as R$,_getActiveDomElement as M$,_getDocument as gv,_last as I$,_removeFromArray as E$}from"ag-stack";import{BeanStub as D$,_createCellId as Gs,_forEachChangedGroupDepthFirst as L$,_getRowBelow as ic,_getRowNode as rc,_isClientSideRowModel as fv,_isSameRow as mv,isColumnSelectionCol as k$,isSpecialCol as _$}from"ag-grid-community";var Nn="paste",nc="dragCopy",oc="clipboard";function G$(e,t=","){const s=[],i=n=>n==="\r"||n===`
`;let r=!1;if(e==="")return[[""]];for(let n=0,o=0,a=0;a<e.length;a++){const l=e[a-1],c=e[a],u=e[a+1],d=()=>{s[n]||(s[n]=[]),s[n][o]||(s[n][o]="")};if(d(),c==='"'&&(r?u==='"'?(s[n][o]+='"',a++):r=!1:(l===void 0||l===t||i(l))&&(r=!0)),!r&&c!=='"'){if(c===t){o++,d();continue}else if(i(c)){o=0,n++,d(),c==="\r"&&u===`
`&&a++;continue}}s[n][o]+=c}return s}var O$=class extends Xx{constructor(){super(...arguments),this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){const{gos:e,rowModel:t,ctrlsSvc:s}=this.beans;fv(e,t)&&(this.clientSideRowModel=t),s.whenReady(this,i=>{this.gridCtrl=i.gridCtrl})}destroy(){super.destroy(),this.clientSideRowModel=null,this.gridCtrl=null}pasteFromClipboard(){!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&navigator.clipboard?.readText?navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch(t=>{this.warn(40,{error:t,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()}):this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let e=!1;const t=s=>{const i=Date.now();i-this.lastPasteOperationTime<50&&(e=!0,s.preventDefault()),this.lastPasteOperationTime=i};this.executeOnTempElement(s=>{s.addEventListener("paste",t),s.focus({preventScroll:!0})},s=>{const i=s.value;e?this.refocusLastFocusedCell():this.processClipboardData(i),s.removeEventListener("paste",t)})}refocusLastFocusedCell(){const{focusSvc:e}=this.beans,t=e.getFocusedCell();t&&e.setFocusedCell({rowIndex:t.rowIndex,column:t.column,rowPinned:t.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){const e=this.gos.get("clipboardDelimiter");return R$(e)?e:" "}processClipboardData(e){if(e==null)return;let t=G$(e,this.getClipboardDelimiter());const s=this.gos.getCallback("processDataFromClipboard");if(s&&(t=s({data:t})),t==null)return;this.gos.get("suppressLastEmptyLineOnPaste")&&this.removeLastLineIfBlank(t);const{rangeSvc:i,editSvc:r}=this.beans,n=(o,a,l,c)=>{i?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(t)?this.pasteIntoActiveRange(t,o,a,c):this.pasteStartingFromFocusedCell(t,o,a,l,c),r?.stopEditing(void 0,{source:Nn})};this.doPasteOperation(n)}doPasteOperation(e){const t="clipboard",{eventSvc:s,focusSvc:i,rowRenderer:r,gos:n,editSvc:o}=this.beans;s.dispatchEvent({type:"pasteStart",source:t});const{clientSideRowModel:a}=this,l=a?.rootNode,c=l&&this.beans.changedPathFactory?.newPath(n.get("aggregateOnlyChangedColumns")),u={},d=[],h=i.getFocusedCell();o?.beginBulkWrite();try{e(u,d,h,c)}finally{o?.endBulkWrite()}const p=d.slice();c&&(a.doAggregate(c),L$(l,a.hierarchical,c,g=>{p.push(g)})),r.refreshCells({rowNodes:p}),this.dispatchFlashCells(u),this.fireRowChanged(d),this.refocusLastFocusedCell(),s.dispatchEvent({type:"pasteEnd",source:t})}getPreProcessRangeCallback(e){return t=>{const{rangeSvc:s}=this.beans;if(!s)return;const{rowDiff:i,colDiff:r}=this.getAdjustedRangeDimensionForPaste(t,e);i!==0&&s.extendRangeRowCountBy(t,i),r!==0&&s.extendRangeColumnCountBy(t,r)}}getAdjustedRangeDimensionForPaste(e,t){const s=this.beans.rangeSvc,i=t.length,r=s.getRangeRowCount(e),n=r>=i&&r%i===0,o=t[0].length,a=e.columns.length,l=a>=o&&a%o===0;return{rowDiff:n?0:i-r,colDiff:l?0:o-a}}pasteIntoActiveRange(e,t,s,i){let r=0,n=0;const o=(a,l,c,u)=>{if(u-r>=e.length){if(u%e.length!==0)return;r+=n,n=0}const h=e[u-r];s.push(l);const p=this.gos.getCallback("processCellFromClipboard"),g=c.columns,f=g.findIndex(k$);f!==-1&&g.splice(f,1);for(let m=0;m<g.length;m++){const v=g[m];if(!v.isCellEditable(l)||v.isSuppressPaste(l))continue;let C=m;m>=h.length&&(C=m%h.length);const S=this.processCell(l,v,h[C],nc,p,!0);l.setDataValue(v,S,Nn),i?.addCell(l.parent,v.getId());const{rowIndex:w,rowPinned:b}=a,y=Gs({rowIndex:w,column:v,rowPinned:b});t[y]=!0}n++};this.iterateActiveRanges(o,!1,this.getPreProcessRangeCallback(e))}getDisplayedColumnsStartingAt(e){let t=e;const s=[],{visibleCols:i}=this.beans;for(;t&&_$(t);)t=i.getColAfter(t);for(;t!=null;)s.push(t),t=i.getColAfter(t);return s}pasteStartingFromFocusedCell(e,t,s,i,r){if(!i)return;const n={rowIndex:i.rowIndex,rowPinned:i.rowPinned},o=this.getDisplayedColumnsStartingAt(i.column);this.isPasteSingleValueIntoRange(e)?this.pasteSingleValueIntoRange(e,s,t,r):this.pasteMultipleValues(e,n,s,o,t,oc,r)}isPasteSingleValueIntoRange(e){const t=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste(e)&&!!t&&!t.isEmpty()}pasteSingleValueIntoRange(e,t,s,i){const r=e[0][0],n=(o,a,l)=>{t.push(a),l.columns.forEach(c=>this.updateCellValue(a,c,r,s,oc,i))};this.iterateActiveRanges(n)}hasOnlyOneValueToPaste(e){return e.length===1&&e[0].length===1}copyRangeDown(){const{rangeSvc:e,gos:t,formula:s,valueSvc:i}=this.beans;if(!e||e.isEmpty())return;const r=[],n=(o,a,l,c)=>{const u=t.getCallback("processCellForClipboard"),d=t.getCallback("processCellFromClipboard"),h=(p,g,f)=>{const{columns:m}=f;r.length?(a.push(g),m.forEach((v,C)=>{if(!v.isCellEditable(g)||v.isSuppressPaste(g))return;v.allowFormula&&s?.isFormula(r[C])&&(r[C]=s?.updateFormulaByOffset({value:r[C],rowDelta:1}));const w=this.processCell(g,v,r[C],nc,d,!0);g.setDataValue(v,w,Nn),c?.addCell(g.parent,v.getId());const{rowIndex:b,rowPinned:y}=p,T=Gs({rowIndex:b,column:v,rowPinned:y});o[T]=!0})):m.forEach(v=>{const C=this.processCell(g,v,i.getValue(v,g,"batch"),nc,u,!1,!0);r.push(C)})};this.iterateActiveRanges(h,!0)};this.doPasteOperation(n)}removeLastLineIfBlank(e){const t=I$(e);if(t?.length===1&&t[0]===""){if(e.length===1)return;E$(e,t)}}fireRowChanged(e){if(this.gos.get("editType")==="fullRow")for(const t of e)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:t,data:t.data,rowIndex:t.rowIndex,rowPinned:t.rowPinned})}shouldSkipPasteRow(e,t,s){if(e.detail||e.footer)return!0;if(s&&e.group){for(const i of t)if(i.isCellEditable(e))return!1;return!0}return!1}pasteMultipleValues(e,t,s,i,r,n,o){let a=t;const l=this.beans,{gos:c}=l,u=this.clientSideRowModel!=null&&!c.get("enableGroupEdit")&&!c.get("treeData"),d=()=>{for(;a;){const h=rc(l,a);if(a=ic(l,{rowPinned:a.rowPinned,rowIndex:a.rowIndex}),h!=null&&!this.shouldSkipPasteRow(h,i,u))return h}return null};for(const h of e){const p=d();p&&(h.forEach((g,f)=>this.updateCellValue(p,i[f],g,r,n,o)),s.push(p))}}updateCellValue(e,t,s,i,r,n){if(!e||!t?.isCellEditable(e)||t?.isSuppressPaste(e))return;const o=this.processCell(e,t,s,r,this.gos.getCallback("processCellFromClipboard"),!0);e.setDataValue(t,o,Nn);const{rowIndex:a,rowPinned:l}=e,c=Gs({rowIndex:a,column:t,rowPinned:l});i[c]=!0,n?.addCell(e.parent,t.getId())}copyToClipboard(e={}){this.copyOrCutToClipboard(e)}cutToClipboard(e={},t="api"){this.gos.get("suppressCutToClipboard")||(this.eventSvc.dispatchEvent({type:"cutStart",source:t}),this.copyOrCutToClipboard(e,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:t}))}copyOrCutToClipboard(e,t){let{includeHeaders:s,includeGroupHeaders:i}=e;const{gos:r,focusSvc:n}=this.beans;s==null&&(s=r.get("copyHeadersToClipboard")),i==null&&(i=r.get("copyGroupHeadersToClipboard"));const o={includeHeaders:s,includeGroupHeaders:i},a=r.get("rowSelection"),l=r.get("cellSelection");let c=null;this.shouldCopyCells(l,a)?(this.copySelectedRangeToClipboard(o),c=0):this.shouldCopyRows(a)?(this.copySelectedRowsToClipboard(o),c=1):n.isAnyCellFocused()&&(this.copyFocusedCellToClipboard(o),c=2),t&&c!==null&&this.clearCellsAfterCopy(c)}shouldCopyCells(e,t){const{rangeSvc:s,selectionSvc:i,gos:r}=this.beans;if(!s||s.isEmpty())return!1;if(e)return!(typeof t=="object"&&t.copySelectedRows&&!i?.isEmpty());{const n=r.get("suppressCopySingleCellRanges");return!(!s.isMoreThanOneCell()&&n)}}shouldCopyRows(e){const{selectionSvc:t,gos:s}=this.beans;return t?.isEmpty()??!0?!1:e&&typeof e!="string"?e.copySelectedRows??!1:!s.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy(e){const t=this.beans,{rangeSvc:s,focusSvc:i,eventSvc:r}=t;if(r.dispatchEvent({type:"keyShortcutChangedCellStart"}),e===0)s.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if(e===1)this.clearSelectedRows();else{const n=i.getFocusedCell();if(n==null)return;const o=rc(t,n);o&&this.clearCellValue(o,n.column)}r.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){const{selectionSvc:e,visibleCols:t}=this.beans,s=e?.getSelectedNodes()??[],i=t.allCols;for(const r of s)for(const n of i)this.clearCellValue(r,n)}clearCellValue(e,t){if(!t.isCellEditable(e))return;const s=this.beans.valueSvc.getDeleteValue(t,e);e.setDataValue(t,s,"clipboardSvc")}iterateActiveRanges(e,t,s){const i=this.beans.rangeSvc;if(!i||i.isEmpty())return;const r=i.getCellRanges(),n=t?[r[0]]:r;for(const o of n)this.iterateActiveRange({cellRange:o,rowCallback:e,preProcessRange:s})}iterateActiveRange(e){const{cellRange:t,preProcessRange:s,rowCallback:i}=e,{beans:r}=this,{rangeSvc:n}=r;if(!n)return;s&&s(t);let o=n.getRangeStartRow(t);const a=n.getRangeEndRow(t);let l=0,c=!1;for(;!c&&o!=null;){const u=rc(r,o);c=mv(o,a),i(o,u,t,l++),o=ic(r,o)}}copySelectedRangeToClipboard(e={}){const t=this.beans.rangeSvc;if(!t||t.isEmpty())return;const s=t.areAllRangesAbleToMerge(),{data:i,cellsToFlash:r}=s?this.buildDataFromMergedRanges(t,e):this.buildDataFromRanges(t,e);this.copyDataToClipboard(i),this.dispatchFlashCells(r)}buildDataFromMergedRanges(e,t){const s=new Set,i=e.getCellRanges(),r=new Map,n=[],o={},a=fv(this.gos,this.beans.rowModel),l=new Set;a||this.beans.rowModel.forEachNode(d=>{l.add(d.rowIndex)});for(const d of i){d.columns.forEach(g=>s.add(g));const{rowPositions:h,cellsToFlash:p}=this.getRangeRowPositionsAndCellsToFlash(e,d);for(const g of h){const f=l.has(g.rowIndex);if(!a&&!f)continue;const m=`${g.rowIndex}-${g.rowPinned||"null"}`;r.get(m)||(r.set(m,!0),n.push(g))}Object.assign(o,p)}const c=Array.from(s);return c.sort((d,h)=>d.allColsIndex-h.allColsIndex),{data:this.buildExportParams({columns:c,rowPositions:n,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}),cellsToFlash:o}}buildDataFromRanges(e,t){const s=e.getCellRanges(),i=[],r={};for(const n of s){const{rowPositions:o,cellsToFlash:a}=this.getRangeRowPositionsAndCellsToFlash(e,n);Object.assign(r,a),i.push(this.buildExportParams({columns:n.columns,rowPositions:o,includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders}))}return{data:i.join(`
`),cellsToFlash:r}}getRangeRowPositionsAndCellsToFlash(e,t){const s=[],i={},r=e.getRangeStartRow(t),n=e.getRangeEndRow(t);let o=r;for(;o;){s.push(o);for(const a of t.columns){const{rowIndex:l,rowPinned:c}=o,u=Gs({rowIndex:l,column:a,rowPinned:c});i[u]=!0}if(mv(o,n))break;o=ic(this.beans,o)}return{rowPositions:s,cellsToFlash:i}}getCellsToFlashFromRowNodes(e){const t=this.beans.visibleCols.allCols,s={};for(let i=0;i<e.length;i++){const{level:r,rowIndex:n,rowPinned:o,sibling:a}=e[i],l=r===-1?a?.rowIndex:n;if(l!=null)for(let c=0;c<t.length;c++){const u=t[c],d=Gs({rowIndex:l,column:u,rowPinned:o});s[d]=!0}}return s}copyFocusedCellToClipboard(e={}){let t=this.beans.focusSvc.getFocusedCell();if(t==null)return;t=this.beans.rowSpanSvc?.getCellStart(t)??t;const s=Gs(t),i={rowPinned:t.rowPinned,rowIndex:t.rowIndex},r=t.column,n=this.buildExportParams({columns:[r],rowPositions:[i],includeHeaders:e.includeHeaders,includeGroupHeaders:e.includeGroupHeaders});this.copyDataToClipboard(n),this.dispatchFlashCells({[s]:!0})}copySelectedRowsToClipboard(e={}){const{columnKeys:t,includeHeaders:s,includeGroupHeaders:i}=e,r=this.buildExportParams({columns:t,includeHeaders:s,includeGroupHeaders:i});this.copyDataToClipboard(r);const n=this.beans.selectionSvc?.getSelectedNodes()||[];this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(n))}buildExportParams(e){const{columns:t,rowPositions:s,includeHeaders:i=!1,includeGroupHeaders:r=!1}=e,{gos:n,csvCreator:o}=this.beans,a=({node:c,column:u})=>{const{value:d,valueFormatted:h}=this.beans.valueSvc.getValueForDisplay({column:u,node:c,includeValueFormatted:!0,from:"batch",transformValues:!0}),p=h??d??"",g=n.getCallback("processCellForClipboard");return g?g({column:u,node:c,value:p,type:oc,formatValue:f=>this.beans.valueSvc.formatValue(u,c,f)??f,parseValue:f=>this.beans.valueSvc.parseValue(u,c,f,d)??f}):p},l={columnKeys:t,rowPositions:s,skipColumnHeaders:!i,skipColumnGroupHeaders:!r,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!s,valueFrom:"batch",transformValues:!0,processCellCallback:n.getCallback("processCellForClipboard"),processRowGroupCallback:a,processHeaderCallback:n.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:n.getCallback("processGroupHeaderForClipboard")};return o.getDataAsCsv(l,!0)}dispatchFlashCells(e){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:e})},0)}processCell(e,t,s,i,r,n,o){const{valueSvc:a,formula:l}=this.beans;return r?r({column:t,node:e,value:s,type:i,formatValue:u=>a.formatValue(t,e??null,u)??u,parseValue:u=>a.parseValue(t,e??null,u,a.getValue(t,e,"edit"))}):n&&t.colDef.useValueParserForImport!==!1?a.parseValue(t,e??null,s,a.getValue(t,e,"edit")):o&&t.colDef.useValueFormatterForExport!==!1?l?.isFormula(s)?s:a.formatValue(t,e??null,s)??s:s}copyDataToClipboard(e){const t=this.gos.getCallback("sendToClipboard");if(t){t({data:e});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(e).catch(i=>{this.warn(40,{error:i,method:"writeText"}),this.copyDataToClipboardLegacy(e)});return}this.copyDataToClipboardLegacy(e)}copyDataToClipboardLegacy(e){this.executeOnTempElement(t=>{const s=gv(this.beans),i=M$(this.beans);t.value=e||" ",t.select(),t.focus({preventScroll:!0}),s.execCommand("copy")||this.warn(41),i?.focus!=null&&i.focus({preventScroll:!0})})}executeOnTempElement(e,t){if(!this.gridCtrl)return;const s=gv(this.beans),i=s.createElement("textarea"),r=i.style;r.width="1px",r.height="1px";const n=s.documentElement;r.top=n.scrollTop+"px",r.left=n.scrollLeft+"px",r.position="absolute",r.opacity="0",this.gridCtrl.getGui().appendChild(i);try{e(i)}catch{this.warn(42)}t?window.setTimeout(()=>{t(i),i.remove()},100):i.remove()}},vv={moduleName:"Clipboard",version:G,beans:[O$],apiFunctions:{copyToClipboard:w$,cutToClipboard:x$,copySelectedRowsToClipboard:F$,copySelectedRangeToClipboard:T$,copySelectedRangeDown:A$,pasteFromClipboard:P$},dependsOn:[$,S$,y$,b$]};import{CellStyleModule as N$,_SharedDragAndDropModule as B$}from"ag-grid-community";var V$='.ag-row-number-cell{background-color:var(--ag-header-background-color);border:none;color:var(--ag-header-text-color);font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}:where(.ag-ltr) .ag-row-number-cell{text-align:right}:where(.ag-rtl) .ag-row-number-cell{text-align:left}.ag-row-numbers-resizer{bottom:-2px;cursor:row-resize;height:4px;position:absolute;width:100%}:where(.ag-ltr) .ag-row-numbers-resizer{left:0}:where(.ag-rtl) .ag-row-numbers-resizer{right:0}.ag-grid-pinned-bottom-rows .ag-row-numbers-resizer{bottom:unset;top:-2px}:where(.ag-row-number-header.ag-row-number-selection-enabled){cursor:cell}.ag-row-number-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-row-number-range-selected{background-color:var(--ag-row-numbers-selected-color)}:where(.ag-ltr){:where(.ag-cell.ag-row-number-cell):not(.ag-cell-last-left-pinned),:where(.ag-row-number-header):not(.ag-header-cell-last-left-pinned){border-right:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik0zLjQ0NSA4LjkxMVY3LjQwOUg5Ljc1VjYuMDE0bDIuNTM1IDIuMTQ2LTIuNTM1IDIuMTQ2VjguOTExeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}:where(.ag-rtl){:where(.ag-cell.ag-row-number-cell):not(.ag-cell-first-right-pinned),:where(.ag-row-number-header):not(.ag-header-cell-first-right-pinned){border-left:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik01Ljk3OSA4LjkxMXYxLjM5NUwzLjQ0NSA4LjE2bDIuNTM0LTIuMTQ2djEuMzk1aDYuMzA2djEuNTAyeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}';import{Direction as H$}from"ag-stack";import{Component as U$,_getRowNode as z$}from"ag-grid-community";var W$={tag:"div",cls:"ag-row-numbers-resizer"},$$=class extends Zx{constructor(e){super(W$),this.cellCtrl=e,this.initialYPosition=-1,this.dragging=!1}postConstruct(){const{beans:e,cellCtrl:t}=this,{dragSvc:s,environment:i}=e;this.defaultRowHeight=i.getDefaultRowHeight(),s.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:this.onDragging.bind(this),onDragStop:this.onDragStop.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:!0,stopPropagationForTouch:!0});const r=t.getRowPosition();this.node=z$(this.beans,r)}onDragStart(e){if(!this.node)return;const{beans:{ctrlsSvc:t,eventSvc:s}}=this;t.get("gridCtrl").setResizeCursor(H$.Vertical,!0),this.dragging=!0,this.initialHeight=this.node.rowHeight,s.dispatchEvent({type:"rowResizeStarted",node:this.node,event:e,rowHeight:this.initialHeight})}onDragging(e){let{clientY:t}=e;if(this.cellCtrl.rowNode.rowPinned==="bottom"&&(t*=-1),this.initialYPosition===-1||!this.dragging){this.initialYPosition=t;return}const{beans:s,initialHeight:i,initialYPosition:r,defaultRowHeight:n,node:o}=this;if(i==null)return;const a=o?.rowHeight,l=Math.max(i-(r-t),n);if(a===l)return;o?.setRowHeight(l);const{rowRenderer:c,rowModel:u,pinnedRowModel:d}=s,h=!!o?.rowPinned;h&&c.redraw({afterScroll:!0}),(!h||d?.isManual())&&u.onRowHeightChanged({animate:!1})}onDragStop(e){this.beans.eventSvc.dispatchEvent({type:"rowResizeEnded",node:this.node,event:e,rowHeight:this.node?.rowHeight}),this.clearDragDetails(!0)}onDragCancel(){this.clearDragDetails(!0)}clearDragDetails(e){this.initialYPosition=-1,this.initialHeight=null,this.dragging=!1,e&&this.beans.ctrlsSvc.get("gridCtrl").setResizeCursor(!1)}destroy(){this.clearDragDetails(!1),this.node=void 0,super.destroy()}};import{_debounce as K$,_setAriaLabel as j$}from"ag-stack";import{KeyCode as ac,ROW_NUMBERS_COLUMN_ID as Y$,_BaseSingleColService as q$,_addGridCommonParams as X$,_convertColumnEventSourceType as Z$,_createElement as J$,_getFirstRow as Q$,_getRowNode as eK,_interpretAsRightClick as tK,_isRowNumbers as ji,_selectAllCells as sK,isRowNumberCol as Yi}from"ag-grid-community";import{_isRowNumbers as iK}from"ag-grid-community";function Cv(e){const t=iK(e);return!(!t||typeof t!="object"||!t.enableRowResizer)}var rK=class{constructor(e,t){this.beans=e,this.cellCtrl=t}refreshRowResizer(){!Cv(this.beans)||!this.isRowResizeSupported(this.cellCtrl.rowNode)?this.removeRowResizerFromCellComp():this.addResizerToCellComp()}isRowResizeSupported(e){const{pinnedRowModel:t,rowModel:s,visibleCols:i}=this.beans,r=!!s.onRowHeightChanged;return i.autoHeightCols.length?(this.beans.log.warn(276),!1):e.rowPinned!=null?t?.isManual()?r:!0:r}addResizerToCellComp(){const{beans:e,cellCtrl:t}=this;let{rowResizer:s}=this;if(!s){if(s=e.registry.createDynamicBean("rowNumberRowResizer",!1,t),!s)return;this.rowResizer=e.context.createBean(s)}t.comp.setRowResizerElement(s.getGui())}removeRowResizerFromCellComp(){const{rowResizer:e,beans:{context:t},cellCtrl:s}=this;e&&(s.comp?.setRowResizerElement(null),this.rowResizer=t.destroyBean(e))}destroy(){this.removeRowResizerFromCellComp()}},nK=()=>[],oK=class extends Jx{constructor(){super(...arguments),this.beanName="rowNumbersSvc",this.colKind="row-number",this.isIntegratedWithSelection=!1,this.rowNumberOverrides=null,this.lastColumnResized=0,this.boundValueGetter=e=>this.valueGetter(e),this.boundCellClass=e=>this.getCellClass(e)}wireBeans(e){this.rangeSvc=e.rangeSvc,this.ariaAnnounce=e.ariaAnnounce,this.visibleCols=e.visibleCols}postConstruct(){const e=K$(this,this.refreshCells.bind(this),10);this.addManagedEventListeners({columnResized:()=>{this.lastColumnResized=Date.now()},cellFocused:this.onGridCellFocused.bind(this),modelUpdated:t=>{e(!1,!t.keepRenderedRows)},rangeSelectionChanged:()=>this.refreshCells(!0),pinnedRowsChanged:()=>e(!1,!0)}),this.addManagedPropertyListeners(["rowNumbers","cellSelection"],t=>{this.updateColumns(t)}),this.refreshSelectionIntegration(),this.registerRangeSelectionExtension()}shouldSkipColumn(e){return ji(this.beans)&&Yi(e)}isAllColumnsSelectionCell(e){return ji(this.beans)&&Yi(e.column)}isAllColumnsRange(e,t){return!ji(this.beans)||t.length===0?!1:e.columns.length===t.length&&t.every(s=>e.columns.includes(s))}registerRangeSelectionExtension(){const e=this.rangeSvc;e&&(e.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>e.unregisterRangeSelectionExtension?.(this)))}isEnabled(){return!!ji(this.beans)}handleMouseDownOnCell(e,t){return!this.isIntegratedWithSelection||t.target.classList.contains("ag-row-numbers-resizer")?(this.rangeSvc&&t.preventDefault(),t.stopImmediatePropagation(),!1):(!t.shiftKey&&!tK(this.beans,t)&&this.focusFirstRenderedCellAtRowPosition(e),!0)}handleKeyDownOnCell(e,t){return this.isIntegratedWithSelection&&t.key===ac.ENTER?(this.selectRowCells(e,t),t.preventDefault(),!0):!1}selectRowCells(e,t){const s=this.rangeSvc;s&&s.handleCellKeyboardSelect(t,e)}updateColumns(e){const t=Z$(e.source);this.refreshSelectionIntegration();const s=this.column!==null;this.refreshCols()?this.refreshColDef(t):s&&this.beans.colModel.refreshAll(t)}destroy(){this.rowNumberOverrides=null,super.destroy()}setupForHeader(e){const{column:t,eGridHeader:s}=e.params;Yi(t)&&(j$(s,"Row Number"),this.addManagedElementListeners(s,{click:this.onHeaderClick.bind(this),keydown:this.onHeaderKeyDown.bind(this),focus:this.onHeaderFocus.bind(this)}))}onGridCellFocused(e){if(!this.isIntegratedWithSelection||e.rowIndex==null||!e.column)return;const t=this.beans.colModel.getCol(e.column);if(!t||!Yi(t))return;const i=this.getLocaleTextFunc()("ariaSelectAllRowCells","Press Enter to select all cells on this row");this.ariaAnnounce?.announceValue(i,"ariaSelectAllRowCells")}createRowNumbersRowResizerFeature(e){return Cv(this.beans)?new rK(this.beans,e):void 0}refreshSelectionIntegration(){const e=this.gos.get("cellSelection");this.refreshRowNumberOverrides(),this.isIntegratedWithSelection=!!this.rangeSvc&&!!e&&!this.isSuppressCellSelectionIntegration}refreshRowNumberOverrides(){const e=ji(this.beans);if(this.rowNumberOverrides={},this.isSuppressCellSelectionIntegration=!1,!e||typeof e!="object")return;e.suppressCellSelectionIntegration&&(this.isSuppressCellSelectionIntegration=!0);const t=["contextMenuItems","context","onCellClicked","onCellContextMenu","onCellDoubleClicked","headerTooltip","headerStyle","headerComponent","headerComponentParams","suppressHeaderKeyboardEvent","suppressNavigable","tooltip","tooltipField","tooltipValueGetter","tooltipComponent","tooltipComponentParams","tooltipComponentSelector","valueGetter","valueFormatter","width","maxWidth","minWidth","resizable","cellRenderer","cellRendererSelector","cellRendererParams"];for(const s of t)e[s]!=null&&(this.rowNumberOverrides[s]=e[s])}onHeaderFocus(){if(!this.isIntegratedWithSelection)return;const t=this.getLocaleTextFunc()("ariaSelectAllCells","Press Space or Enter to select all cells");this.ariaAnnounce?.announceValue(t,"ariaSelectAllCells")}onHeaderKeyDown(e){!this.isIntegratedWithSelection||e.key!==ac.SPACE&&e.key!==ac.ENTER||(e.preventDefault(),this.selectAllCellsFromHeader())}onHeaderClick(e){Date.now()-this.lastColumnResized<100||!this.isIntegratedWithSelection||this.column?.resizing||this.focusAllCellsFromHeaderClick()}selectAllCellsFromHeader(){sK(this.beans)}focusAllCellsFromHeaderClick(){this.selectAllCellsFromHeader(),this.focusFirstRenderedCellAtRowPosition()}refreshCells(e,t){const s=this.column;if(s){if(t){const i=this.beans.autoWidthCalc?.getPreferredWidthForElements([this.createDummyElement(s)],2);i!=null&&this.beans.colResize?.setColumnWidths([{key:s,newWidth:i}],!1,!0,"rowNumbersService")}this.beans.rowRenderer.refreshCells({columns:[s],force:e})}}createDummyElement(e){const t=J$({tag:"div",cls:"ag-cell-value ag-cell"});let s=String(this.beans.rowModel.getRowCount()+1);const i=this.rowNumberOverrides;if(typeof i?.valueFormatter=="function"){const r=X$(this.gos,{data:void 0,value:s,node:null,column:e,colDef:e.colDef});s=i.valueFormatter(r)}return t.textContent=s,t}createColDef(){const e=this.beans.contextMenuSvc,t=this.gos.get("enableRtl");return{minWidth:60,width:60,resizable:!1,valueGetter:this.boundValueGetter,contextMenuItems:this.isIntegratedWithSelection||!e?void 0:nK,...this.rowNumberOverrides,colId:Y$,chartDataType:"excluded",suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPinned:!0,pinned:t?"right":"left",lockPosition:t?"right":"left",editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,suppressSizeToFit:!0,suppressHeaderContextMenu:!0,headerClass:this.getHeaderClass(),cellClass:this.boundCellClass,cellAriaRole:"rowheader"}}valueGetter(e){const t=e.node,s=this.beans.formula?.active,i=t?.pinnedSibling;if(t?.rowPinned&&i){const r=s?i.formulaRowIndex:i.rowIndex;return`${r==null?"-":r+1}`}return String(((s?t?.formulaRowIndex:t?.rowIndex)||0)+1)}getHeaderClass(){const e=["ag-row-number-header"];return this.isIntegratedWithSelection&&e.push("ag-row-number-selection-enabled"),e}getCellClass(e){const t=this.rangeSvc,{node:s}=e,i=["ag-row-number-cell"],r=this.gos.get("cellSelection");if(!t||!r)return i;this.isIntegratedWithSelection&&i.push("ag-row-number-selection-enabled");const n=t.getCellRanges();if(!n.length)return i;const o=this.visibleCols.allCols.length-1,a=typeof r=="object"&&r.enableHeaderHighlight;for(const l of n)t.isRowInRange({rowIndex:s.rowIndex,rowPinned:s.rowPinned},l)&&(a&&i.push("ag-row-number-range-highlight"),l.columns.length===o&&i.push("ag-row-number-range-selected"));return i}focusFirstRenderedCellAtRowPosition(e){const t=this.beans.editSvc;if(t?.isEditing()&&t.isRangeSelectionEnabledWhileEditing?.()||!e&&(e=Q$(this.beans),!e))return;const s=this.beans,i=this.visibleCols,r=this.gos.get("enableRtl")?i.rightCols:i.leftCols;let n;if(r.length==1){const c=eK(s,e);if(!c)return;n=s.colViewport.getColsWithinViewport(c)}else n=r;const o=n.find(c=>!Yi(c));if(!o)return;const{rowPinned:a,rowIndex:l}=e;setTimeout(()=>{this.isAlive()&&s.focusSvc.setFocusedCell({rowIndex:l,rowPinned:a,column:o,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})})}},lc={moduleName:"RowNumbers",version:G,beans:[oK],dynamicBeans:{rowNumberRowResizer:$$},dependsOn:[$,N$,B$],css:[V$]};import{_ColumnFilterModule as Sv}from"ag-grid-community";import{RefPlaceholder as bv}from"ag-stack";import{Component as aK}from"ag-grid-community";import{RefPlaceholder as yv,_debounce as lK,_setDisplayed as qi}from"ag-stack";import{AgInputTextFieldSelector as cK,Component as uK,_createIconNoSpan as cc}from"ag-grid-community";var dK={tag:"div",cls:"ag-filter-toolpanel-search",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-filter-toolpanel-expand"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-filter-toolpanel-search-input"}]},hK=class extends Qx{constructor(){super(...arguments),this.eExpand=yv,this.eFilterTextField=yv}postConstruct(){this.setTemplate(dK,[cK]);const e=this.getLocaleTextFunc();this.eFilterTextField.setClearButtonEnabled(!0).setSearchIcon(!0).setInputAriaLabel(e("ariaFilterColumnsInput","Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)).onValueClear(()=>this.onSearchTextCleared()),this.createExpandIcons(),this.setExpandState(0),this.addManagedElementListeners(this.eExpand,{click:this.onExpandClicked.bind(this)}),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)})}init(e){this.params=e,this.eFilterTextField.setAutoComplete(e.browserAutoComplete),this.beans.colModel.ready&&this.showOrHideOptions()}createExpandIcons(){const{eExpand:e,beans:t}=this;e.appendChild(this.eExpandChecked=cc("accordionOpen",t)),e.appendChild(this.eExpandUnchecked=cc("accordionClosed",t)),e.appendChild(this.eExpandIndeterminate=cc("accordionIndeterminate",t))}showOrHideOptions(){const{params:e,eFilterTextField:t}=this,s=!e.suppressFilterSearch,i=!e.suppressExpandAll,r=this.getLocaleTextFunc();t.setInputPlaceholder(r("searchOoo","Search..."));const n=a=>a.getOriginalParent()&&a.isFilterAllowed(),o=this.beans.colModel.getCols().some(n);qi(t.getGui(),s),qi(this.eExpand,i&&o)}onSearchTextChanged(){this.onSearchTextChangedDebounced||(this.onSearchTextChangedDebounced=lK(this,()=>this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()}),300)),this.searchTextChangedTimeout=this.onSearchTextChangedDebounced()}onSearchTextCleared(){clearTimeout(this.searchTextChangedTimeout),this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()})}onExpandClicked(){const e=this.currentExpandState===0?{type:"collapseAll"}:{type:"expandAll"};this.dispatchLocalEvent(e)}setExpandState(e){this.currentExpandState=e,qi(this.eExpandChecked,e===0),qi(this.eExpandUnchecked,e===1),qi(this.eExpandIndeterminate,e===2)}},pK={selector:"AG-FILTERS-TOOL-PANEL-HEADER",component:hK};import{_clearElement as gK,_exists as uc,_getActiveDomElement as fK,_setAriaLabel as mK}from"ag-stack";import{Component as vK,_addGridCommonParams as CK,_mergeDeep as SK,isProvidedColumnGroup as wv}from"ag-grid-community";import{RefPlaceholder as Xi,_clearElement as bK,_setAriaExpanded as xv,_setAriaLabel as yK,_setAriaRole as wK,_setDisplayed as zt}from"ag-stack";import{Component as xK,FilterComp as FK,KeyCode as Fv,_createElement as TK,_createIconNoSpan as dc}from"ag-grid-community";var AK={tag:"div",cls:"ag-filter-toolpanel-instance",children:[{tag:"div",ref:"eFilterToolPanelHeader",cls:"ag-filter-toolpanel-header ag-filter-toolpanel-instance-header",role:"button",attrs:{"aria-expanded":"false"},children:[{tag:"div",ref:"eExpand",cls:"ag-filter-toolpanel-expand"},{tag:"span",ref:"eFilterName",cls:"ag-header-cell-text"},{tag:"span",ref:"eFilterIcon",cls:"ag-header-icon ag-filter-icon ag-filter-toolpanel-instance-header-icon"}]},{tag:"div",ref:"agFilterToolPanelBody",cls:"ag-filter-toolpanel-instance-body ag-filter"}]},Tv=class extends e0{constructor(e,t){super(AK),this.hideHeader=e,this.expandedCallback=t,this.eFilterToolPanelHeader=Xi,this.eFilterName=Xi,this.agFilterToolPanelBody=Xi,this.eFilterIcon=Xi,this.eExpand=Xi,this.expanded=!1}postConstruct(){const{beans:e,eExpand:t,eFilterIcon:s}=this,i=dc("accordionOpen",e);this.eExpandChecked=i;const r=dc("accordionClosed",e);this.eExpandUnchecked=r,t.appendChild(i),t.appendChild(r);const n=this.getLocaleTextFunc();yK(s,n("ariaFilterActive","Filter Active")),wK(s,"img")}setColumn(e){this.column=e;const{beans:t,eFilterToolPanelHeader:s,eFilterIcon:i,eExpandChecked:r,hideHeader:n}=this;this.eFilterName.innerText=t.colNames.getDisplayNameForColumn(e,"filterToolPanel",!1)||"",this.addManagedListeners(s,{click:this.toggleExpanded.bind(this),keydown:this.onKeyDown.bind(this)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),this.addInIcon("filterActive",i,e),zt(i,this.isFilterActive()),zt(r,!1),n?(zt(s,!1),s.removeAttribute("tabindex")):s.setAttribute("tabindex","0"),this.addManagedListeners(e,{filterChanged:this.onFilterChanged.bind(this)})}onKeyDown(e){const{key:t}=e,{ENTER:s,SPACE:i,LEFT:r,RIGHT:n}=Fv;t!==s&&t!==i&&t!==r&&t!==n||(e.preventDefault(),t===s||t===i?this.toggleExpanded():t===Fv.LEFT?this.collapse():this.expand())}getColumn(){return this.column}getColumnFilterName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"filterToolPanel",!1)}addCssClassToTitleBar(e){this.eFilterToolPanelHeader.classList.add(e)}addInIcon(e,t,s){if(t==null)return;const i=dc(e,this.beans,s);t.appendChild(i)}isFilterActive(){return!!this.beans.colFilter?.isFilterActive(this.column)}onFilterChanged(){zt(this.eFilterIcon,this.isFilterActive()),this.dispatchLocalEvent({type:"filterChanged"})}toggleExpanded(){this.expanded?this.collapse():this.expand()}expand(){this.expanded||(this.expanded=!0,xv(this.eFilterToolPanelHeader,!0),zt(this.eExpandChecked,!0),zt(this.eExpandUnchecked,!1),this.addFilterElement(),this.expandedCallback())}addFilterElement(e){const t=TK({tag:"div",cls:"ag-filter-toolpanel-instance-filter"}),s=this.createManagedBean(new FK(this.column,"TOOLBAR"));this.filterComp=s,s.hasFilter()&&s.getFilter()?.then(i=>{this.underlyingFilter=i,i&&(t.appendChild(s.getGui()),this.agFilterToolPanelBody.appendChild(t),s.afterGuiAttached({container:"toolPanel",suppressFocus:e}))})}collapse(){if(!this.expanded)return;this.expanded=!1,xv(this.eFilterToolPanelHeader,!1),this.removeFilterElement(),zt(this.eExpandChecked,!1),zt(this.eExpandUnchecked,!0);const e=this.filterComp;e?.afterGuiDetached(),this.destroyBean(e),this.expandedCallback()}removeFilterElement(){bK(this.agFilterToolPanelBody)}isExpanded(){return this.expanded}onPanelHidden(){if(!this.expanded)return;const e=this.underlyingFilter;e&&e.afterGuiDetached?.()}onFilterOpened(e){e.source==="COLUMN_MENU"&&e.column===this.column&&this.expanded&&this.collapse()}};import{RefPlaceholder as PK,_clearElement as RK,_setAriaLabel as MK,_setAriaRole as IK}from"ag-stack";import{Component as EK,_addGridCommonParams as DK,_createIconNoSpan as LK,_getHeaderTooltipComponentDefinition as kK,_getShouldDisplayTooltip as _K,_resolveHeaderTooltipValue as GK,isProvidedColumnGroup as Bn}from"ag-grid-community";var Wt=class extends t0{constructor(e,t,s,i,r){super(),this.columnGroup=e,this.childFilterComps=t,this.expandedCallback=s,this.depth=i,this.showingColumn=r,this.filterGroupComp=PK}postConstruct(){const e={cssIdentifier:"filter-toolpanel",direction:"vertical"};this.setTemplate({tag:"div",cls:"ag-filter-toolpanel-group-wrapper",children:[{tag:"ag-group-component",ref:"filterGroupComp"}]},[J],{filterGroupComp:e}),this.setGroupTitle();const{filterGroupComp:t,depth:s,childFilterComps:i,gos:r}=this;t.setAlignItems("stretch"),t.addCss(`ag-filter-toolpanel-group-level-${s}`),t.getGui().style.setProperty("--ag-indentation-level",String(s)),t.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s}-header`);for(const a of i)t.addItem(a),a.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${s+1}-header`),a.getGui().style.setProperty("--ag-indentation-level",String(s+1));const n=this.showingColumn?this.columnGroup:void 0,o=()=>n?.colDef??this.columnGroup.getColGroupDef();this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:()=>t.getTitleBarGui(),getTooltipComponentDefinition:()=>kK(o()),getLocation:()=>"filterToolPanelColumnGroup",getTooltipValue:()=>{const a=o(),l=this.filterGroupName;return GK(a,DK(r,{location:"filterToolPanelColumnGroup",colDef:a,column:this.columnGroup,value:l,valueFormatted:l}))},shouldDisplayTooltip:_K(r,()=>t.getGui().querySelector(".ag-group-title")),getAdditionalParams:()=>{const a=o();return{...a?{colDef:a}:{},column:this.columnGroup,valueFormatted:this.filterGroupName}}})),this.refreshFilterClass(),this.addExpandCollapseListeners(),this.addFilterChangedListeners(),this.setupTooltip(),this.addInIcon("filterActive")}setupTooltip(){const e=()=>this.tooltipFeature?.refreshTooltip();e(),this.addManagedEventListeners({newColumnsLoaded:e})}addCssClassToTitleBar(e){this.filterGroupComp.addCssClassToTitleBar(e)}onPanelHidden(){for(const e of this.childFilterComps)e.onPanelHidden()}isColumnGroup(){return Bn(this.columnGroup)}isExpanded(){return this.filterGroupComp.isExpanded()}getChildren(){return this.childFilterComps}getFilterGroupName(){return this.filterGroupName??""}getFilterGroupId(){return this.columnGroup.getId()}hideGroupItem(e,t){this.filterGroupComp.hideItem(e,t)}hideGroup(e){this.setDisplayed(!e)}addInIcon(e){const t=LK(e,this.beans);if(t){t.classList.add("ag-filter-toolpanel-group-instance-header-icon");const s=this.getLocaleTextFunc();MK(t,s("ariaFilterActive","Filter Active")),IK(t,"img")}this.filterGroupComp.addTitleBarWidget(t)}forEachToolPanelFilterChild(e){for(const t of this.childFilterComps)t instanceof Tv&&e(t)}addExpandCollapseListeners(){const e=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(s=>s.expand()),t=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(s=>s.collapse());this.addManagedListeners(this.filterGroupComp,{expanded:e,collapsed:t})}getColumns(){return Bn(this.columnGroup)?this.columnGroup.getLeafColumns():[this.columnGroup]}addFilterChangedListeners(){for(const e of this.getColumns())this.addManagedListeners(e,{filterChanged:()=>this.refreshFilterClass()});Bn(this.columnGroup)||this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)})}refreshFilterClass(){const e=this.getColumns(),t=()=>e.some(s=>s.isFilterActive());this.filterGroupComp.toggleCss("ag-has-filter",t())}onFilterOpened(e){e.source==="COLUMN_MENU"&&e.column===this.columnGroup&&this.isExpanded()&&this.collapse()}expand(){this.filterGroupComp.toggleGroupExpand(!0)}collapse(){this.filterGroupComp.toggleGroupExpand(!1)}setGroupTitle(){const e=this.columnGroup,t=Bn(e)?this.getColumnGroupName(e):this.getColumnName(e);this.filterGroupName=t,this.filterGroupComp.setTitle(t||"")}getColumnGroupName(e){return this.beans.colNames.getDisplayNameForProvidedColumnGroup(null,e,"filterToolPanel")}getColumnName(e){return this.beans.colNames.getDisplayNameForColumn(e,"filterToolPanel",!1)}destroyFilters(){this.childFilterComps=this.destroyBeans(this.childFilterComps),RK(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},OK=class extends s0{constructor(){super({tag:"div",cls:"ag-filter-list-panel",role:"group"}),this.initialised=!1,this.pendingStateRestore=!1,this.isRestoringState=!1,this.filterGroupComps=[],this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending=!1}wireBeans(e){this.colModel=e.colModel}init(e,t=!1){this.initialised=!0,this.pendingStateRestore=t;const s=CK(this.gos,{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});SK(s,e),this.params=s,s.suppressSyncLayoutWithGrid||this.addManagedEventListeners({columnMoved:()=>this.onColumnsChanged()}),this.addManagedEventListeners({newColumnsLoaded:()=>this.onColumnsChanged(),toolPanelVisibleChanged:i=>{i.key==="filters"&&!i.visible&&this.onPanelHidden()},dragStarted:()=>{this.suppressOnColumnsChanged=!0},dragStopped:()=>{this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending&&(this.onColumnsChangedPending=!1,this.onColumnsChanged())}}),this.colModel.ready&&this.onColumnsChanged()}onColumnsChanged(){if(this.suppressOnColumnsChanged){this.onColumnsChangedPending=!0;return}const e=this.colModel.pivotMode;!this.params.suppressSyncLayoutWithGrid&&!e?this.syncFilterLayout():this.buildTreeFromProvidedColumnDefs(),this.refreshAriaLabel()}syncFilterLayout(){up(this.colModel,this.setFiltersLayout.bind(this)),this.refreshAriaLabel()}buildTreeFromProvidedColumnDefs(){const e=this.colModel.colDefTree;this.recreateFilters(e)}setFiltersLayout(e){const t=cp(this.beans,e);this.recreateFilters(t)}recreateFilters(e){const t=fK(this.beans);this.isRestoringState=this.pendingStateRestore&&!!this.params.initialState,this.pendingStateRestore=!1;const s=this.getExpansionState();this.destroyFilters();const i=this.recursivelyAddComps(e,0,s);this.filterGroupComps=i;const r=i.length;if(r){for(const o of i)this.appendChild(o);this.setFirstAndLastVisible(0,r-1)}const n=this.searchFilterText;uc(n)&&this.searchFilters(n),this.fireExpandedEvent(),this.getGui().contains(t)&&t.focus(),this.isRestoringState=!1,this.refreshAriaLabel()}recursivelyAddComps(e,t,s){return e.map(i=>{if(wv(i))return this.recursivelyAddFilterGroupComps(i,t,s)?.flatMap(l=>l)??[];const r=i;if(!this.shouldDisplayFilter(r))return[];const n=t===0,o=new Tv(n,()=>this.onFilterExpanded());if(this.createBean(o),o.setColumn(r),s.get(r.getId())&&o.expand(),t>0)return o;const a=this.createBean(new Wt(r,[o],this.onGroupExpanded.bind(this),t,!0));return a.addCssClassToTitleBar("ag-filter-toolpanel-header"),s.get(a.getFilterGroupId())||a.collapse(),a}).flatMap(i=>i)}refreshAriaLabel(){const e=this.getLocaleTextFunc(),t=e("ariaFilterPanelList","Filter List"),s=e("filters","Filters"),l=this.getGui().querySelectorAll(".ag-filter-toolpanel-group-item:not(.ag-filter-toolpanel-group-wrapper, .ag-hidden)").length;mK(this.getAriaElement(),`${t} ${l} ${s}`)}recursivelyAddFilterGroupComps(e,t,s){if(!this.filtersExistInChildren(e.getChildren()))return;if(e.getColGroupDef()?.suppressFiltersToolPanel)return[];const r=e.isPadding()?t:t+1,n=this.recursivelyAddComps(e.getChildren(),r,s).flatMap(l=>l);if(e.isPadding())return n;const o=new Wt(e,n,this.onGroupExpanded.bind(this),t,!1);this.createBean(o),o.addCssClassToTitleBar("ag-filter-toolpanel-header");const a=s.get(o.getFilterGroupId());return(this.isRestoringState&&!a||a===!1)&&o.collapse(),[o]}filtersExistInChildren(e){return e.some(t=>wv(t)?this.filtersExistInChildren(t.getChildren()):this.shouldDisplayFilter(t))}shouldDisplayFilter(e){const t=e.colDef?.suppressFiltersToolPanel;return e.isFilterAllowed()&&!t}getExpansionState(){const e=new Map;if(this.isRestoringState){const{expandedColIds:s,expandedGroupIds:i}=this.params.initialState;for(const r of s)e.set(r,!0);for(const r of i)e.set(r,!0);return e}const t=s=>{e.set(s.getFilterGroupId(),s.isExpanded());for(const i of s.getChildren())i instanceof Wt?t(i):e.set(i.getColumn().getId(),i.isExpanded())};return this.filterGroupComps.forEach(t),e}refresh(){}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params,!0)}expandFilterGroups(e,t){const s=[],i=r=>{const n=r.getFilterGroupId();(!t||t.includes(n))&&(e&&r.isColumnGroup()?r.expand():r.collapse(),s.push(n));for(const a of r.getChildren())a instanceof Wt&&i(a)};if(this.filterGroupComps.forEach(i),this.onGroupExpanded(),t){const r=t.filter(n=>s.indexOf(n)<0);r.length>0&&this.beans.log.warn(166,{unrecognisedGroupIds:r})}}expandFilters(e,t){const s=[],i=r=>{if(r instanceof Wt){let a=!1;for(const l of r.getChildren())i(l)&&(e?(r.expand(),a=!0):r.isColumnGroup()||r.collapse());return a}const n=r.getColumn().colId,o=!t||t.includes(n);return o&&(e?r.expand():r.collapse(),s.push(n)),o};if(this.filterGroupComps.forEach(i),this.onGroupExpanded(),t){const r=t.filter(n=>s.indexOf(n)<0);r.length>0&&this.beans.log.warn(167,{unrecognisedColIds:r})}}onGroupExpanded(){this.fireExpandedEvent()}onFilterExpanded(){this.dispatchLocalEvent({type:"filterExpanded"})}fireExpandedEvent(){let e=0,t=0;const s=r=>{if(r.isColumnGroup()){r.isExpanded()?e++:t++;for(const n of r.getChildren())n instanceof Wt&&s(n)}};this.filterGroupComps.forEach(s);let i;e>0&&t>0?i=2:t>0?i=1:i=0,this.dispatchLocalEvent({type:"groupExpanded",state:i})}performFilterSearch(e){this.searchFilterText=uc(e)?e.toLowerCase():null,this.searchFilters(this.searchFilterText)}searchFilters(e){const t=n=>!uc(e)||n.toLowerCase().indexOf(e)!==-1,s=(n,o)=>{if(!(n instanceof Wt))return t(n.getColumnFilterName()||"");const a=n.getChildren(),l=t(n.getFilterGroupName()),c=o||l;if(c){n.hideGroup(!1);for(let d=0;d<a.length;d++)s(a[d],c),n.hideGroupItem(!1,d);return!0}let u=!1;return a.forEach((d,h)=>{const p=s(d,o);n.hideGroupItem(!p,h),p&&(u=!0)}),n.hideGroup(!u),u};let i,r;this.filterGroupComps.forEach((n,o)=>{s(n,!1);const a=n.getGui()?.classList.contains("ag-hidden");i===void 0?a||(i=o,r=o):!a&&r!==o&&(r=o)}),this.setFirstAndLastVisible(i,r),this.refreshAriaLabel()}setFirstAndLastVisible(e,t){this.filterGroupComps.forEach((s,i)=>{s.removeCss("ag-first-group-visible"),s.removeCss("ag-last-group-visible"),i===e&&s.addCss("ag-first-group-visible"),i===t&&s.addCss("ag-last-group-visible")})}onPanelHidden(){for(const e of this.filterGroupComps)e.onPanelHidden()}getExpandedFiltersAndGroups(){const e=[],t=new Set,s=i=>{if(i instanceof Wt){for(const n of i.getChildren())s(n);const r=i.getFilterGroupId();i.isExpanded()&&!t.has(r)&&e.push(r)}else i.isExpanded()&&t.add(i.getColumn().colId)};return this.filterGroupComps.forEach(s),{expandedGroupIds:e,expandedColIds:Array.from(t)}}destroyFilters(){this.filterGroupComps=this.destroyBeans(this.filterGroupComps),gK(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},NK={selector:"AG-FILTERS-TOOL-PANEL-LIST",component:OK},BK=".ag-filter-toolpanel{flex:1 1 0px;min-width:0}.ag-filter-toolpanel-header,.ag-filter-toolpanel-search{align-items:center;color:var(--ag-header-text-color);display:flex;font-weight:var(--ag-header-font-weight);padding:0 var(--ag-spacing);>:where(.ag-filter-icon),>:where(.ag-filter-toolpanel-expand),>:where(.ag-filter-toolpanel-search-input),>:where(.ag-header-cell-text){align-items:center;display:flex}}.ag-filter-toolpanel-header{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing);position:relative;&:focus-visible{border-radius:var(--ag-border-radius);box-shadow:inset var(--ag-focus-shadow)}}:where(.ag-ltr) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-ltr) .ag-filter-toolpanel-instance-header-icon{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-rtl) .ag-filter-toolpanel-instance-header-icon{margin-right:var(--ag-spacing)}.ag-filter-toolpanel-search{min-height:var(--ag-header-height);padding-bottom:var(--ag-spacing);padding-top:var(--ag-widget-container-vertical-padding)}:where(.ag-filter-toolpanel-group:not(.ag-has-filter)>.ag-group-title-bar) .ag-filter-toolpanel-group-instance-header-icon{display:none}.ag-filter-toolpanel-search-input{flex-grow:1;height:calc(var(--ag-spacing)*4)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar-icon{margin-left:var(--ag-spacing)}.ag-filter-toolpanel-expand{cursor:pointer}:where(.ag-ltr) .ag-filter-toolpanel-expand{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-expand{margin-left:var(--ag-spacing)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar,:where(.ag-ltr) .ag-filter-toolpanel-instance-header{padding-left:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar,:where(.ag-rtl) .ag-filter-toolpanel-instance-header{padding-right:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-ltr) .ag-filter-toolpanel-instance-body{margin-left:var(--ag-filter-tool-panel-group-indent)}:where(.ag-rtl) .ag-filter-toolpanel-instance-body{margin-right:var(--ag-filter-tool-panel-group-indent)}.ag-filter-toolpanel-instance-filter{background-color:var(--ag-chrome-background-color)}.ag-filter-toolpanel-group-level-0{border-top:none}",VK={tag:"div",cls:"ag-filter-toolpanel",children:[{tag:"ag-filters-tool-panel-header",ref:"filtersToolPanelHeaderPanel"},{tag:"ag-filters-tool-panel-list",ref:"filtersToolPanelListPanel"}]},HK=class extends i0{constructor(){super(VK,[pK,NK]),this.filtersToolPanelHeaderPanel=bv,this.filtersToolPanelListPanel=bv,this.initialised=!1,this.listenerDestroyFuncs=[],this.registerCSS(BK)}init(e){if(this.initialised){for(const l of this.listenerDestroyFuncs)l();this.listenerDestroyFuncs=[]}this.initialised=!0;const s={...{suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1},...e};this.params=s;const i=!!e.initialState&&e!==this.appliedParams;this.appliedParams=e;const{filtersToolPanelHeaderPanel:r,filtersToolPanelListPanel:n}=this;r.init(s),n.init(s,i);const{suppressExpandAll:o,suppressFilterSearch:a}=s;o&&a&&r.setDisplayed(!1),this.listenerDestroyFuncs.push(...this.addManagedListeners(r,{expandAll:()=>n.expandFilterGroups(!0),collapseAll:()=>n.expandFilterGroups(!1),searchChanged:l=>n.performFilterSearch(l.searchText)}),...this.addManagedListeners(n,{filterExpanded:s.onStateUpdated,groupExpanded:l=>{r.setExpandState(l.state),s.onStateUpdated()}}))}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}setFilterLayout(e){this.filtersToolPanelListPanel.setFiltersLayout(e)}expandFilterGroups(e){this.filtersToolPanelListPanel.expandFilterGroups(!0,e)}collapseFilterGroups(e){this.filtersToolPanelListPanel.expandFilterGroups(!1,e)}expandFilters(e){this.filtersToolPanelListPanel.expandFilters(!0,e)}collapseFilters(e){this.filtersToolPanelListPanel.expandFilters(!1,e)}syncLayoutWithGrid(){this.filtersToolPanelListPanel.syncFilterLayout()}refresh(e){return this.init(e),!0}getState(){return this.filtersToolPanelListPanel.getExpandedFiltersAndGroups()}};import{BeanStub as UK,FilterComp as zK}from"ag-grid-community";var WK=class extends r0{constructor(){super(...arguments),this.beanName="filterPanelSvc",this.states=new Map,this.orderedStates=[],this.initialStateApplied=!1,this.columnsLoaded=!1,this.isActive=!1}postConstruct(){if(!this.gos.get("enableFilterHandlers"))return;const e=this.updateFilterStates.bind(this),t=()=>this.dispatchStatesUpdates(void 0,!0),s=this.onFilterDestroyed.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>{this.columnsLoaded=!0,this.initialStateApplied||this.applyState(),e()},dataTypesInferred:e,filterChanged:e,filterDestroyed:s,filterHandlerDestroyed:s,filterOpened:t,filterClosed:t});const i=({column:r})=>{this.states.get(r.colId)?.refresh?.(),t()};this.addManagedListeners(this.beans.colFilter,{filterStateChanged:i,filterModelAsStringChanged:i})}updateParams(e,t){this.params=e;let s=!1;if(t&&(this.currState=t,this.columnsLoaded)){const i=new Set(t.filters?.map(r=>r.colId));for(const r of this.getIds())i.has(r)||this.remove(r);this.clear(),this.applyState(),this.updateFilterStates(),s=!0}s||this.dispatchStatesUpdates(),this.beans.colFilter?.setGlobalButtons(!!e.buttons?.length)}getIds(){return Array.from(this.states.keys())}getAvailable(){const e=this.beans,t=[];for(const s of e.colModel.colDefList){const i=s.colId;s.isFilterAllowed()&&!s.colDef.suppressFiltersToolPanel&&!this.states.get(i)&&t.push({id:i,name:Av(e,s)})}return t}add(e){this.createFilter(e,!0),this.dispatchStatesUpdates(e)}remove(e){const{states:t,orderedStates:s,beans:{colFilter:i,selectableFilter:r}}=this,n=t.get(e);if(!n)return;n.destroy?.();const o=n.state.column;t.delete(e),r?.clearActive(e),i?.destroyFilter(o),this.eventSvc.dispatchEvent({type:"filterSwitched",column:o});const a=s.indexOf(e);s.splice(a,1);const l=s[a];this.dispatchStatesUpdates(l)}getState(e){return this.states.get(e)?.state}updateFilterState(e,t,s,i){const r=this.getState(e);r&&(r[t]=s,i||this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:r}))}expand(e,t){const s=this.states.get(e);if(!s)return;s.destroy?.();const{handler:i,state:{column:r}}=s,n=this.createFilterState(r,i,t);this.states.set(e,n),this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:n.state})}updateType(e,t){const s=this.states.get(e);if(!s)return;const i=s.state;if(i.expanded===!1)return;const r=i.filterDefs;if(!r)return;const{colFilter:n,selectableFilter:o}=this.beans;o?.setActive(e,r,t),n.filterParamsChanged(e,"columnFilter");const a=i.column;this.eventSvc.dispatchEvent({type:"filterSwitched",column:a});const l=this.states.get(e);if(!l)return;const c=l.state;this.dispatchLocalEvent({type:"filterPanelStateChanged",id:e,state:c})}getActions(){const e=this.params?.buttons;if(!e?.length)return;const t=!!this.beans.colFilter?.canApplyAll();return{actions:e,canApply:t}}doAction(e){this.beans.colFilter?.updateAllModels(e)}getGridState(){const e=[];return this.states.forEach((t,s)=>{e.push({colId:s,expanded:t.state.expanded})}),{filters:e}}createFilter(e,t){const s=this.createFilterStateWrapper(e,t);s&&(this.states.set(e,s),this.orderedStates.push(e))}createFilterStateWrapper(e,t){const{colModel:s,colFilter:i}=this.beans,r=s.getNonPivotColById(e);if(r&&!r.colDef.suppressFiltersToolPanel){const n=i.getHandler(r,!0);if(n)return this.createFilterState(r,n,t)}}updateFilterStates(){if(!this.params)return;const e=this.beans.colFilter.getModel(),t=new Set;for(const s of Object.keys(e)){const i=this.states.get(s);i?i.refresh?.():this.createFilter(s),t.add(s)}this.states.forEach((s,i)=>{t.has(i)||s.refresh?.()}),this.dispatchStatesUpdates()}createFilterState(e,t,s){const i=this.beans,{colFilter:r,selectableFilter:n}=i,o=Av(i,e),a=e.colId,l=()=>!!this.params?.buttons&&r.hasUnappliedModel(a),c=l();if(s){const u=e.colDef,{filterDefs:d,activeFilterDef:h}=n?.getDefs(e,u)??{},p=this.createBean(new zK(e,"TOOLBAR",!0));return{state:{column:e,name:o,isEditing:c,expanded:s,detail:p.getGui(),activeFilterDef:h,filterDefs:d,afterGuiAttached:p.afterGuiAttached.bind(p),afterGuiDetached:p.afterGuiDetached.bind(p)},handler:t,refresh:()=>{this.updateFilterState(a,"isEditing",l())},destroy:()=>this.destroyBean(p)}}else{const u=e.colId,d=()=>t.getModelAsString?.(r.getStateForColumn(u).model,"filterToolPanel")??"";return{state:{column:e,name:o,isEditing:c,expanded:!1,summary:d()},handler:t,refresh:()=>{this.updateFilterState(u,"isEditing",l(),!0),this.updateFilterState(u,"summary",d())}}}}onFilterDestroyed({column:e,source:t}){const{colFilter:s,filterManager:i}=this.beans;if(!s?.isAlive()||!i?.isFilterAllowed(e))return;const r=this.states,n=e.getColId(),o=r.get(n);if(o){const a=this.createFilterStateWrapper(n,o.state.expanded);a?(o.destroy?.(),r.set(n,a)):this.remove(n),t==="api"&&this.dispatchStatesUpdates()}}dispatchStatesUpdates(e,t){this.dispatchLocalEvent({type:"filterPanelStatesChanged",activeId:e,action:t})}applyState(){if(this.params&&this.columnsLoaded){this.initialStateApplied=!0;for(const{colId:e,expanded:t}of this.currState?.filters??[])this.createFilter(e,t)}}destroy(){this.clear(),this.params=void 0,this.currState=void 0,super.destroy()}clear(){const{states:e,orderedStates:t}=this;e.forEach(s=>s.destroy?.()),e.clear(),t.length=0}};function Av(e,t){return e.colNames.getDisplayNameForColumn(t,"filterToolPanel")??t.colId}import{BeanStub as $K,_addGridCommonParams as KK,_getDefaultSimpleFilter as jK,_getFilterParamsForDataType as YK,_isSetFilterByDefault as qK}from"ag-grid-community";import{_removeFromParent as XK,_translate as ZK}from"ag-stack";var JK={addFilterCard:"Add Filter",ariaLabelAddFilterField:"Add Filter Field",ariaLabelFilterCardDelete:"Delete Filter",ariaLabelFilterCardHasEdits:"Has Edits",agTextColumnFilterDisplayName:"Simple Filter",agNumberColumnFilterDisplayName:"Simple Filter",agDateColumnFilterDisplayName:"Simple Filter",agSetColumnFilterDisplayName:"Selection Filter",agMultiColumnFilterDisplayName:"Combo Filter",addFilterPlaceholder:"Search columns..."};function Os(e,t){return ZK(e,JK,t)}function QK(e,t,s){let i=0;for(let r=0;r<s.length;r++){const n=s[r];n===t[i]?i++:XK(n)}for(;i<t.length;)e.appendChild(t[i++])}var e8=class extends n0{constructor(){super(...arguments),this.beanName="selectableFilter",this.selectedFilters=new Map,this.valueGetters=new Map}postConstruct(){const{gos:e,selectedFilters:t}=this,s=e.get("initialState")?.filter?.selectableFilters??{};for(const i of Object.keys(s))t.set(i,s[i])}getFilterValueGetter(e){return this.valueGetters.get(e)}isSelectable(e){return e.filter==="agSelectableColumnFilter"}getFilterDef(e,t){return this.getDefs(e,t).activeFilterDef}getDefs(e,t,s){if(!this.isSelectable(t))return;const i=this.beans,{gos:r,dataTypeSvc:n,colFilter:o}=i;let a=t.filterParams;const l=e.colDef;typeof a=="function"&&(a=a(KK(r,{column:e,colDef:l})));const c=n?.getBaseDataType(e),u=n?.getDataTypeDefinition(e),d=n?.getFormatValue(c),{filters:h,defaultFilterParams:p,defaultFilterIndex:g}=a??{},f=S=>{const{filter:w,filterParams:b,name:y,filterValueGetter:T=l.filterValueGetter}=S,x=p?{...p,...b}:b;let F;u&&d&&(w==="agMultiColumnFilter"?F=i.multiFilter?.getParamsForDataType(x,T,u,d):F=YK(w,x,T,u,d,i,this.getLocaleTextFunc()));let A;if(!y){let P=w;typeof w=="boolean"&&(P=o?.getDefaultFilterFromDataType(()=>c)),typeof P=="string"?A=Os(this,`${P}DisplayName`):(this.warn(280,{colId:e.colId}),A="")}return p||F||A?{...S,filterParams:x,name:A??y,...F}:S},m=(h??this.getDefaultFilters(e)).map(f);let v=s??this.selectedFilters.get(e.colId)??g??(!h&&qK(r)?1:0);v>=m.length&&(v=0);const C=m[v];return{filterDefs:m,activeFilterDef:C}}setActive(e,t,s,i){const r=t.indexOf(s);if(r<0)return;const{selectedFilters:n,valueGetters:o}=this;n.set(e,r);const a=s.filterValueGetter;a?o.set(e,a):o.delete(e),i||this.onChange()}clearActive(e){const{selectedFilters:t,valueGetters:s}=this;t.delete(e),s.delete(e),this.onChange()}getState(){return this.selectedFilters.size>0?Object.fromEntries(this.selectedFilters):void 0}setState(e){if(this.clearAll(),e){const t=this.beans.colModel;for(const s of Object.keys(e)){const i=t.getNonPivotColById(s);if(i){const r=this.getDefs(i,i.colDef,e[s]);r&&this.setActive(s,r.filterDefs,r.activeFilterDef,!0)}}}}destroy(){this.clearAll(),super.destroy()}clearAll(){const{selectedFilters:e,valueGetters:t}=this;e.clear(),t.clear()}onChange(){this.dispatchLocalEvent({type:"selectedFilterChanged"})}getDefaultFilters(e){const t=this.beans,{gos:s,dataTypeSvc:i}=t,r=s.isModuleRegistered("MultiFilter"),n=i?.getBaseDataType(e);return[{filter:jK(n,!1)},{filter:"agSetColumnFilter"},...r?[{filter:"agMultiColumnFilter"}]:[]]}};import{Component as t8,_createElement as s8}from"ag-grid-community";import{RefPlaceholder as i8,_focusInto as Pv,_getActiveDomElement as r8,_isNothingFocused as Rv,_removeFromParent as n8}from"ag-stack";import{Component as o8,FilterButtonComp as a8,_translateForFilter as l8}from"ag-grid-community";import{_clearElement as Mv}from"ag-stack";import{Component as c8,_createElement as u8,_createIconNoSpan as d8}from"ag-grid-community";var h8={tag:"div",cls:"ag-filter-card ag-filter-card-add"},p8=class extends o0{constructor(e){super(h8),this.options=new Map,this.setOptions(e)}postConstruct(){this.showButton()}refresh(e){this.setOptions(e);const{eSelect:t,options:s}=this;t&&t.setValueList({valueList:Array.from(s.keys()),refresh:!0})}showButton(){Mv(this.getGui()),this.destroySelect();const e=u8({tag:"button",cls:"ag-button ag-standard-button ag-filter-add-button",children:[{tag:"span",children:[()=>d8("filterAdd",this.beans)]},{tag:"span",cls:"ag-filter-add-button-label",children:Os(this,"addFilterCard")}]});this.activateTabIndex([e]);const t=this.showSelect.bind(this);e.addEventListener("click",t),this.removeButton=()=>{e.removeEventListener("click",t)},this.appendChild(e),e.focus()}showSelect(){Mv(this.getGui()),this.destroyButton();const e="ariaLabelAddFilterField",t={className:"ag-filter-add-select",pickerType:"virtual-list",pickerAriaLabelKey:e,pickerAriaLabelValue:Os(this,e),placeholder:Os(this,"addFilterPlaceholder"),value:"",valueList:Array.from(this.options.keys()),searchType:"matchAny",searchIcon:!0,allowTyping:!0,filterList:!0,highlightMatch:!0,valueFormatter:i=>this.options.get(i)},s=this.createManagedBean(new Xr(t));this.eSelect=s,this.appendChild(s.getGui()),s.showPicker(),s.getFocusableElement().focus(),s.addManagedListeners(s,{fieldPickerValueSelected:({value:i})=>this.dispatchLocalEvent({type:"filterSelected",id:i}),pickerHidden:()=>{this.showButton()}})}setOptions(e){const t=this.options;t.clear();for(const{id:s,name:i}of e)t.set(s,i)}destroySelect(){this.eSelect=this.destroyBean(this.eSelect)}destroyButton(){this.removeButton=this.removeButton?.()}destroy(){this.destroySelect(),this.destroyButton(),super.destroy()}};import{RefPlaceholder as Ns,_clearElement as g8,_removeFromParent as f8,_setAriaControls as Iv,_setAriaExpanded as m8,_setAriaLabel as Ev,_setDisplayed as v8}from"ag-stack";import{Component as C8,_createIcon as hc}from"ag-grid-community";import{RefPlaceholder as S8,_removeFromParent as b8}from"ag-stack";import{AgSelectSelector as y8,Component as w8}from"ag-grid-community";var x8={tag:"div",cls:"ag-filter-card-body",children:[{tag:"ag-select",cls:"ag-filter-type-select",ref:"eFilterType"}]},F8=class extends a0{constructor(){super(...arguments),this.eFilterType=S8}postConstruct(){const e={onValueChange:t=>this.dispatchLocalEvent({type:"filterTypeChanged",filterDef:t})};this.setTemplate(x8,[y8],{eFilterType:e}),this.eFilterType.setDisplayed(!1)}refresh(e){const t=this.state;this.state=e;const{activeFilterDef:s,filterDefs:i,detail:r,afterGuiAttached:n,afterGuiDetached:o}=e,{activeFilterDef:a,filterDefs:l,detail:c}=t??{},u=this.eFilterType;if(i!==l){u.clearOptions();const d=i?.map(h=>({value:h,text:h.name}));d&&u.clearOptions().addOptions(d).setValue(s,!0),u.setDisplayed(!!d)}else s!==a&&u.setValue(s,!0);r!==c&&(c&&(b8(c),o()),this.appendChild(r),n({container:"newFiltersToolPanel",suppressFocus:!0}))}};import{Component as T8}from"ag-grid-community";var A8={tag:"div",cls:"ag-filter-card-summary",attrs:{"aria-hidden":"true"}},P8=class extends l0{constructor(){super(A8)}refresh(e){this.getGui().textContent=e.summary}},R8={tag:"div",cls:"ag-filter-card",children:[{tag:"div",cls:"ag-filter-card-header",role:"presentation",children:[{tag:"div",cls:"ag-filter-card-heading",role:"heading",attrs:{"aria-level":"2"},children:[{tag:"button",ref:"eExpand",cls:"ag-button ag-filter-card-expand",children:[{tag:"span",ref:"eTitle",cls:"ag-filter-card-title"},{tag:"span",ref:"eEditing",cls:"ag-filter-card-editing-icon"},{tag:"span",ref:"eExpandIcon",cls:"ag-filter-card-expand-icon"}]}]},{tag:"button",ref:"eDelete",cls:"ag-button ag-filter-card-delete",children:[{tag:"span",ref:"eDeleteIcon",cls:"ag-filter-card-delete-icon"}]}]}]},M8=class extends c0{constructor(e){super(R8),this.id=e,this.eTitle=Ns,this.eExpand=Ns,this.eDelete=Ns,this.eExpandIcon=Ns,this.eDeleteIcon=Ns,this.eEditing=Ns}postConstruct(){const{beans:e,eDelete:t,eExpand:s,eDeleteIcon:i,eEditing:r,id:n}=this,o=e.filterPanelSvc;Ev(t,Os(this,"ariaLabelFilterCardDelete")),i.appendChild(hc("close",e,null)),this.activateTabIndex([s,t]),this.addManagedElementListeners(s,{click:()=>o.expand(n,!this.state?.expanded)}),this.addManagedElementListeners(t,{click:()=>o.remove(n)}),this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)}),r.appendChild(hc("filterCardEditing",e,null))}refresh(e){const{eExpand:t,eEditing:s,state:i,beans:r}=this;this.state=e;const{name:n,expanded:o,isEditing:a}=e;this.eTitle.textContent=n,v8(s,a),o!==i?.expanded&&this.toggleExpand(e);let l=o?null:`${n} ${e.summary}`;a&&(l=`${l??n}. ${Os(this,"ariaLabelFilterCardHasEdits")}`),Ev(t,l);const c=d=>{if(d)return f8(d.getGui()),this.destroyBean(d)},u=(d,h,p)=>(d||(d=this.createBean(new h),p?.(d),this.appendChild(d.getGui())),d.refresh(e),d);if(e.expanded){this.summaryComp=c(this.summaryComp);const d=u(this.detailComp,F8,p=>p.addManagedListeners(p,{filterTypeChanged:({filterDef:g})=>r.filterPanelSvc.updateType(this.id,g)}));this.detailComp=d;const h=`ag-${this.getCompId()}-filter`;d.getGui().id=h,Iv(t,h)}else this.detailComp=c(this.detailComp),this.summaryComp=u(this.summaryComp,P8),Iv(t,null)}toggleExpand(e){const t=!!e.expanded,{eExpandIcon:s,eExpand:i,beans:r}=this;g8(s),s.appendChild(hc(t?"filterCardCollapse":"filterCardExpand",r,null)),m8(i,t)}onFilterOpened(e){const{state:t,beans:s,id:i}=this;e.source==="COLUMN_MENU"&&e.column===t?.column&&t?.expanded&&s.filterPanelSvc.expand(i,!1)}destroy(){this.detailComp=this.destroyBean(this.detailComp),this.summaryComp=this.destroyBean(this.summaryComp),this.state=void 0,super.destroy()}};function I8(e){return!!e?.id}function E8(e){return!!e?.action}var D8={tag:"div",cls:"ag-filter-panel",children:[{tag:"div",cls:"ag-filter-panel-container",ref:"eContainer"}]},L8=class extends u0{constructor(){super(D8),this.eContainer=i8,this.filters=new Map}refresh(e){if(E8(e)){this.refreshActions();return}if(I8(e)){this.filters.get(e.id)?.refresh(e.state);return}const{eContainer:t,filters:s,beans:i}=this,r=i.filterPanelSvc,n=r.getIds(),o=new Map,a=!Rv(i),l=a?r8(i):void 0,c=a&&t.contains(l),u=[],d=[];for(const v of n){const C=s.get(v)??this.createBean(new M8(v));C.refresh(r.getState(v)),o.set(v,C),d.push(C.getGui())}this.filters=o;const h=[];s.forEach((v,C)=>{u.push(v.getGui()),o.has(C)||h.push(v)});let p=this.addFilterComp;p&&u.push(p.getGui());const g=r.getAvailable();g.length?(p||(p=this.createBean(new p8(g)),p.addManagedListeners(p,{filterSelected:({id:v})=>r.add(v)})),p.refresh(g),d.push(p.getGui())):p=this.destroyBean(p),this.addFilterComp=p,QK(t,d,u);for(const v of h)this.destroyBean(v);const f=e?.activeId,m=f&&o.get(f)?.getGui();m?Pv(m):c&&Rv(i)&&Pv(d[d.length-1]??t),this.refreshActions()}refreshActions(){const e=this.beans.filterPanelSvc,{actions:t,canApply:s}=e.getActions()??{};let i=this.buttonComp;if(t?.length){const r=t.map(n=>({type:n,label:l8(this,`${n}Filter`)}));if(!i){i=this.createBean(new a8({className:"ag-filter-panel-buttons"})),this.getGui().appendChild(i.getGui());const n={};for(const o of["apply","clear","reset","cancel"])n[o]=()=>e.doAction(o);i.addManagedListeners(i,n)}i.updateButtons(r),i.updateValidity(s!==!1)}else i&&(n8(i.getGui()),i=this.destroyBean(i));this.buttonComp=i}destroy(){this.beans.filterPanelSvc?.clear?.(),this.addFilterComp=this.destroyBean(this.addFilterComp),this.buttonComp=this.destroyBean(this.buttonComp);const e=this.filters;e.forEach(t=>this.destroyBean(t)),e.clear(),super.destroy()}},k8=".ag-filter-panel{display:flex;flex-direction:column;width:100%;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-filter-panel .ag-simple-filter-body-wrapper{padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel .ag-mini-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-vertical-spacing)}.ag-filter-panel-container{display:flex;flex:1;flex-direction:column;gap:var(--ag-widget-container-vertical-padding);overflow:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-card{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius)}.ag-filter-card-header{align-items:center;display:flex;flex-direction:row;gap:var(--ag-spacing);padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-heading{flex:1;overflow:hidden;padding-bottom:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing));padding-top:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing))}:where(.ag-ltr) .ag-filter-card-heading{padding-left:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-heading{padding-right:var(--ag-widget-horizontal-spacing)}.ag-filter-card-expand{align-items:center;display:flex;flex-direction:row;width:100%}.ag-filter-card-title{font-weight:var(--ag-header-font-weight);overflow:hidden;text-overflow:ellipsis}.ag-filter-card-expand-icon{display:flex;flex:1;justify-content:end}.ag-filter-card-editing-icon{margin:0 var(--ag-spacing)}.ag-filter-card-delete-icon,.ag-filter-card-editing-icon,.ag-filter-card-expand-icon,.ag-filter-card-summary{color:var(--ag-filter-panel-card-subtle-color)}.ag-filter-card-delete-icon,.ag-filter-card-expand-icon{transition:color .25s ease-in-out}.ag-filter-card-delete-icon:hover,.ag-filter-card-expand-icon:hover{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-card-heading:hover .ag-filter-card-expand-icon{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-add-button,.ag-filter-card-delete,.ag-filter-card-expand{border-radius:var(--ag-button-border-radius)}.ag-filter-card-summary,.ag-filter-type-select{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-filter-card-delete{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-delete{margin-left:var(--ag-widget-horizontal-spacing)}.ag-filter-card-summary{margin-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-type-select{padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-add{border:0;padding:0}.ag-filter-add-button{align-items:center;display:flex;flex-direction:row;line-height:1.5;width:100%}:where(.ag-ltr) .ag-filter-add-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-add-button-label{margin-right:var(--ag-spacing)}.ag-filter-add-select{border:0;.ag-rich-select-value{border:0;padding:calc(((1.5*var(--ag-font-size) + 2*var(--ag-button-vertical-padding)) - var(--ag-input-height))/2) var(--ag-spacing)}}:where(.ag-ltr) .ag-filter-add-select{.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)!important}}:where(.ag-rtl) .ag-filter-add-select{.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)!important}}.ag-filter-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel-buttons-button{line-height:1.5}.ag-filter-panel .ag-filter-panel-buttons-apply-button{background-color:var(--ag-filter-panel-apply-button-background-color);color:var(--ag-filter-panel-apply-button-color)}.ag-filter-panel-buttons:where(:last-child),.ag-filter-panel-container:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-panel .ag-set-filter-body-wrapper,.ag-filter-panel .ag-simple-filter-body-wrapper{padding-bottom:var(--ag-widget-container-vertical-padding)}",_8=class extends d0{constructor(){super(),this.registerCSS(k8)}init(e){if(!this.gos.get("enableFilterHandlers")){this.beans.log.warn(282),this.setTemplateFromElement(s8({tag:"div",cls:"ag-filter-panel"}));return}const t=this.beans.filterPanelSvc;t.isActive=!0,this.addDestroyFunc(()=>{t.isActive=!1}),this.updateParams(e,e.initialState);const s=this.createManagedBean(new L8);this.filterPanel=s;const i=r=>{s.refresh(r),e.onStateUpdated()};i(),this.addManagedListeners(t,{filterPanelStatesChanged:i,filterPanelStateChanged:i})}getGui(){return this.filterPanel?.getGui()??super.getGui()}refresh(e){return this.updateParams(e,e.initialState),!0}updateParams(e,t){this.beans.filterPanelSvc?.updateParams(e,t)}getState(){return this.beans.filterPanelSvc?.getGridState()??{}}},Dv={moduleName:"FiltersToolPanel",version:G,userComponents:{agFiltersToolPanel:HK},icons:{filtersToolPanel:"filter"},dependsOn:[Fi,$,Sv]},Lv={moduleName:"NewFiltersToolPanel",version:G,userComponents:{agNewFiltersToolPanel:_8},beans:[WK,e8],icons:{filterAdd:"filter-add",filtersToolPanel:"filter",richSelectOpen:"small-down",richSelectRemove:"cancel",richSelectLoading:"loading",filterCardExpand:"chevron-down",filterCardCollapse:"chevron-up",filterCardEditing:"edit"},dependsOn:[Fi,$,Sv]};import{EventApiModule as G8}from"ag-grid-community";import{RefPlaceholder as O8,_missing as N8}from"ag-stack";import{Component as B8,_getGridRegisteredModules as V8,createGrid as H8}from"ag-grid-community";import{_focusInto as U8,_missing as z8}from"ag-stack";import{BeanStub as W8,_addGridCommonParams as $8,_isSameRow as K8}from"ag-grid-community";var kv=class extends h0{constructor(){super(...arguments),this.loadRowDataVersion=0}wireBeans(e){this.environment=e.environment}init(e,t){this.params=t,this.comp=e,t.pinned==null&&(this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)}))}onFullWidthRowFocused(e){const t=this.params,s={rowIndex:t.node.rowIndex,rowPinned:t.node.rowPinned},i={rowIndex:e.rowIndex,rowPinned:e.rowPinned};K8(s,i)&&U8(this.comp.getGui(),e.fromBelow)}setAutoHeightClasses(){const e=this.gos.get("detailRowAutoHeight"),t=e?"ag-details-row-auto-height":"ag-details-row-fixed-height",s=e?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",i=this.comp;i.toggleCss(t,!0),i.toggleDetailGridCss(s,!0)}setupRefreshStrategy(){const e=this.params.refreshStrategy;if(e=="everything"||e=="nothing"||e=="rows"){this.refreshStrategy=e;return}e!=null&&this.warn(170,{providedStrategy:e}),this.refreshStrategy="rows"}createDetailGrid(){const{params:e,gos:t}=this;if(z8(e.detailGridOptions)){this.warn(171);return}const s=t.get("theme"),i=e.detailGridOptions.theme;i&&i!==s&&this.warn(267);const r={themeStyleContainer:this.environment.eStyleContainer,...e.detailGridOptions,theme:s};t.get("detailRowAutoHeight")&&(r.domLayout="autoHeight"),this.comp.setDetailGrid(r)}registerDetailWithMaster(e){const{params:t,beans:{selectionSvc:s,findSvc:i,expansionSvc:r}}=this,n=t.node.id,o=t.api,a={id:n,api:e},l=t.node;if(o.isDestroyed())return;o.addDetailGridInfo(n,a),l.detailGridInfo=a;const c=l.parent,u=()=>{s?.setDetailSelectionState(c,t.detailGridOptions,e)};i?.registerDetailGrid(l,e);function d(g){g.source==="rowDataChanged"||!c||s?.refreshMasterNodeState(c)}function h({source:g}){if(g==="expandAll")return e.expandAll();if(g==="collapseAll")return e.collapseAll()}function p({node:g,source:f}){g!==c||f==="masterDetail"||e.isDestroyed()||u()}e.addEventListener("firstDataRendered",()=>{if(e.isDestroyed()||o.isDestroyed())return;u(),e.addEventListener("selectionChanged",d),o.addEventListener("rowSelected",p),e.isModuleRegistered("CsrmSsrmSharedApiModule")&&(o.addEventListener("expandOrCollapseAll",h),r?.setDetailsExpansionState(e))}),this.addManagedListeners(c,{masterChanged:g=>{g.node.master||this.onDestroy(a)}}),this.addDestroyFunc(()=>this.onDestroy(a))}onDestroy(e){const{params:t}=this,s=t.node,i=t.api;s.detailGridInfo===e&&(i.isDestroyed()||i.removeDetailGridInfo(s.id),s.detailGridInfo=null)}loadRowData(){this.loadRowDataVersion++;const e=this.loadRowDataVersion,t=this.params;if(t.detailGridOptions?.rowModelType==="serverSide"){t.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}const s=t.getDetailRowData;if(!s){this.warn(172);return}const i=n=>{if(this.loadRowDataVersion===e){this.comp.setRowData(n);const a=t.node,l=a.detailGridInfo?.api,c=a.parent,u=this.gos.get("rowSelection"),d=!!u&&typeof u=="object"&&u.masterSelects==="detail";l&&c&&d&&this.beans.selectionSvc?.setDetailSelectionState(c,t.detailGridOptions,l)}},r={node:t.node,data:t.node.data,successCallback:i,context:$8(this.gos,{}).context};s(r)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},j8=class{constructor(e){this.parentWrapper=e}wrap(e,t,s,i){return this.parentWrapper.wrap(e,t,s,i)}},Y8={tag:"div",cls:"ag-details-row"},q8={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},X8=class extends p0{constructor(){super(...arguments),this.eDetailGrid=O8}wireBeans(e){this.context=e.context}init(e){this.params=e,this.selectAndSetTemplate();const t={toggleCss:(s,i)=>this.toggleCss(s,i),toggleDetailGridCss:(s,i)=>this.eDetailGrid.classList.toggle(s,i),setDetailGrid:s=>this.setDetailGrid(s),setRowData:s=>this.setRowData(s),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new kv),this.ctrl.init(t,e)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){const e=this.params;if(e.pinned){this.setTemplate(Y8);return}const t=()=>{this.setTemplate(q8)};if(N8(e.template))t();else if(typeof e.template=="string")this.setTemplate(e.template,[]);else if(typeof e.template=="function"){const s=e.template,i=s(e);this.setTemplate(i,[])}else this.beans.log.warn(168),t();this.eDetailGrid==null&&this.beans.log.warn(169)}setDetailGrid(e){if(!this.eDetailGrid)return;const t=this.context.getBean("frameworkCompWrapper"),s=new j8(t),{frameworkOverrides:i}=this.beans,r=H8(this.eDetailGrid,e,{frameworkOverrides:i,providedBeanInstances:{frameworkCompWrapper:s},modules:V8(this.params.api.getGridId(),e.rowModelType??"clientSide"),hasAncestorStyledRoot:!0});this.detailApi=r,this.ctrl?.registerDetailWithMaster(r),this.addDestroyFunc(()=>{r.destroy()})}setRowData(e){this.detailApi?.setGridOption("rowData",e)}};function Vn(e,t){const s=e.masterDetailSvc?.store;return s?t(s):void 0}function Z8(e,t,s){Vn(e,i=>{i[t]=s})}function J8(e,t){Vn(e,s=>{delete s[t]})}function Q8(e,t){return Vn(e,s=>s[t])}function ej(e,t){Vn(e,s=>{let i=0;Object.values(s).forEach(r=>{r&&t(r,i++)})})}var tj=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}";import{_exists as sj,_observeResize as ij}from"ag-stack";import{BeanStub as rj,DETAIL_ROW_ID_PREFIX as nj,RowNode as oj,_getClientSideRowModel as aj,_isClientSideRowModel as _v,_isServerSideRowModel as Gv}from"ag-grid-community";var lj=class extends g0{constructor(){super(...arguments),this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){const e=this.gos;_v(e)&&(this.enabled=this.isEnabled()),Gv(e)&&this.addEventListeners()}addEventListeners(){const e=i=>{this.setMaster(i.node,!1,!0)};let t;const s=()=>{if(t){for(const i of t)i();t=void 0}this.isEnabled()&&(t=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:e}))};s(),this.gos.addPropertyEventListener("masterDetail",s)}refreshModel(e){if(e.changedProps){const t=this.isEnabled();if(this.enabled!==t){this.setMasters(null);return}}e.rowDataUpdated&&this.setMasters(e.changedRowNodes)}setMaster(e,t,s){const i=e.master,r=this.isEnabled();let n=r;const o=this.gos,a=o.get("isRowMaster"),l=o.get("treeData");if(r)if(t||s){if(a){const c=e.data;n=!!c&&!!a(c)}}else n=i;l||(n&&t||!n&&i)&&(e._expanded??(e._expanded=null)),n!==i&&(e.master=n,e.dispatchRowEvent("masterChanged"))}setMasters(e){if(this.enabled=this.isEnabled(),e){for(const t of e.updates)this.setMaster(t,!1,!0);for(const t of e.adds)this.setMaster(t,!0,!1)}else{const t=aj(this.beans)?.rootNode?._leafs;if(t)for(let s=0,i=t.length;s<i;++s)this.setMaster(t[s],!0,!1)}}getDetail(e){if(!e.master||!e.expanded)return null;let t=e.detailNode;return t||(t=new oj(this.beans),t.detail=!0,t.selectable=!1,t.parent=e,sj(e.id)&&(t.id=nj+e.id),t.data=e.data,t.level=e.level+1,e.detailNode=t,t)}setupDetailRowAutoHeight(e,t){const{gos:s,beans:i}=this;if(!s.get("detailRowAutoHeight"))return;const r=()=>{const o=t.clientHeight;if(o!=null&&o>0){const a=()=>{const{rowModel:l,environment:c}=this.beans,{rowNode:u}=e;u.setRowHeight(o+c.getRowBorderWidth()),(_v(s,l)||Gv(s,l))&&l.onRowHeightChanged()};window.setTimeout(a,0)}},n=ij(i,t,r);e.addDestroyFunc(n),r()}destroy(){this.store={},super.destroy()}},cj={moduleName:"SharedMasterDetail",version:G,beans:[lj],userComponents:{agDetailCellRenderer:X8},dynamicBeans:{detailCellRendererCtrl:kv},apiFunctions:{addDetailGridInfo:Z8,removeDetailGridInfo:J8,getDetailGridInfo:Q8,forEachDetailGridInfo:ej},dependsOn:[$,qm,Zl],css:[tj]},Ov={moduleName:"MasterDetail",version:G,dependsOn:[cj,_s,G8]};import{_DragModule as uj,_KeyboardNavigationModule as dj}from"ag-grid-community";import{_last as Bs,_toStringOrNull as hj}from"ag-stack";import{_addGridCommonParams as pj,_getCellByPosition as Hn,_getFillHandle as pc,_getLastRow as gj,_getNormalisedMousePosition as Nv,_getRowAbove as gc,_getRowBelow as Zi,_getRowNode as fj,_isFiniteNumber as mj,_isRowBefore as vj,_isSameRow as Ue,_stopPropagationForAgGrid as Cj,isRowNumberCol as Sj}from"ag-grid-community";import{_getPageBody as Bv,_isVisible as bj,_last as yj,_setDisplayed as wj}from"ag-stack";import{Component as xj,_areCellsEqual as Fj,_getCellPositionForEvent as Tj,_isRowBefore as Aj}from"ag-grid-community";var Vv=class extends f0{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:e=>{let t=!1;if(this.dragging||(t=!0,this.dragging=!0,Bv(this.beans).classList?.add(this.getDraggingCssClass())),this.updateValuesOnMove(e),t){this.changedCalculatedValues=!1;return}this.beans.rangeSvc.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:Hv,mousedown:Hv})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove(e){const t=Tj(this.gos,e);!t||this.shouldSkipCell(t)||this.lastCellHovered&&Fj(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}clearDragProperties(){this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),Bv(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging&&this.destroy()}getType(){return this.type}refresh(e,t){const s=this.cellCtrl,i=this.getGui(),r=t??yj(this.beans.rangeSvc.getCellRanges()),n=r.startRow,o=r.endRow;if(n&&o&&(Aj(o,n)?(this.rangeStartRow=o,this.rangeEndRow=n):(this.rangeStartRow=n,this.rangeEndRow=o)),s!==e||!bj(i)){this.cellCtrl=e;const a=e.comp.getParentOfValue();a&&a.appendChild(i)}this.cellRange=r}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){wj(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded(e){if(!this.cellRange)return;const{id:t,type:s}=this.cellRange;if(!t||e.id!=null&&t!==e.id)return;const i=this.beans.rangeSvc?.getCellRanges().find(r=>r.id===t&&r.type===s);i&&i!==this.cellRange&&(this.cellRange=i)}},Hv=e=>{e.stopPropagation()};function Pj(e){const t=e.length;let s=0;if(t<=1)return e;for(let u=0;u<e.length;u++){const d=e[u],h=d.toString().split("e-");if(h.length>1){s=Math.max(s,parseInt(h[1],10));continue}Math.floor(d)!==d&&(s=Math.max(s,d.toString().split(".")[1].length))}let i=0,r=0,n=0,o=0;for(let u=0;u<t;u++){const d=e[u];i+=u,r+=d,o+=u*u,n+=u*d}const a=(t*n-i*r)/(t*o-i*i),l=r/t-a*i/t,c=[];for(let u=0;u<=t;u++)c.push(parseFloat((u*a+l).toFixed(s)));return c}function Rj(e,t,s){const i=e==="up"?-1:e==="down"?1:0;if(i===0)return 0;const r=s?.formulaRowIndex,n=t.formulaRowIndex;return r==null||n==null?i:n-r}var Ji=Symbol("fillOperationResultType"),Mj={[Ji]:"skip"},Ij={[Ji]:"default"};function Ej(e){return{[Ji]:"value",value:e}}function Dj(){return Mj}function Lj(){return Ij}function kj(e){return e!=null&&typeof e=="object"&&Ji in e?e:void 0}var _j={tag:"div",cls:"ag-fill-handle"},Gj=class extends Vv{constructor(){super(_j),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=0}postConstruct(){super.postConstruct(),this.addManagedElementListeners(this.getGui(),{dblclick:this.onDblClick.bind(this)})}onDblClick(e){Cj(e);const{cellRange:t,rangeStartRow:s,beans:i}=this,{rangeSvc:r,visibleCols:n}=i,o=gj(i);if(!o)return;const a=this.getFillHandleDirection();this.dragAxis=a==="xy"?"y":a;const l=r?.createCellRangeFromCellRangeParams({rowStartIndex:s.rowIndex,rowStartPinned:s.rowPinned,columnStart:t.columns[0],rowEndIndex:this.dragAxis==="x"?t.endRow?.rowIndex??null:o.rowIndex,rowEndPinned:this.dragAxis==="x"?t.endRow?.rowPinned:o.rowPinned,columnEnd:this.dragAxis==="x"?Bs(n.allCols):Bs(t.columns)});this.isUp=!1,this.isLeft=!1,l&&this.performFill({event:e,initialRange:t,finalRange:l}),this.dragAxis=void 0}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=Nv(this.beans,e));const{x:t,y:s}=this.initialXY,{x:i,y:r}=Nv(this.beans,e),n=Math.abs(t-i),o=Math.abs(s-r),a=this.getFillHandleDirection();let l;a==="xy"?l=n>o?"x":"y":l=a,l!==this.dragAxis&&(this.dragAxis=l,this.changedCalculatedValues=!0)}shouldSkipCell(e){return Sj(e.column)}onDrag(e){if(!this.initialPosition){const s=this.cellCtrl;if(!s)return;this.initialPosition=s.cellPosition}const t=this.getLastCellHovered();t&&this.markPathFrom(this.initialPosition,t)}onDragEnd(e){if(this.initialXY=null,!this.markedCells.length)return;const t=this.dragAxis==="x",{cellRange:s,rangeStartRow:i,rangeEndRow:r,beans:{rangeSvc:n}}=this,o=s.columns.length;let a;if(!this.isUp&&!this.isLeft)a=n.createCellRangeFromCellRangeParams({rowStartIndex:i.rowIndex,rowStartPinned:i.rowPinned,columnStart:s.columns[0],rowEndIndex:t?r.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?r.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[o-1]});else{const l=t?i:this.lastCellMarked;a=n.createCellRangeFromCellRangeParams({rowStartIndex:l.rowIndex,rowStartPinned:l.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:r.rowIndex,rowEndPinned:r.rowPinned,columnEnd:s.columns[o-1]})}a&&this.performFill({event:e,initialRange:s,finalRange:a,shouldUpdateRange:!0})}onDragCancel(){this.initialXY=null,this.markedCells.length&&this.clearMarkedPath()}performFill({event:e,initialRange:t,finalRange:s,shouldUpdateRange:i}){const{eventSvc:r,rangeSvc:n}=this.beans;r.dispatchEvent({type:"fillStart"}),this.handleValueChanged(t,s,e),i&&n.setCellRanges([s]),r.dispatchEvent({type:"fillEnd",initialRange:t,finalRange:s})}getFillHandleDirection(){const e=pc(this.gos)?.direction;return e?e!=="x"&&e!=="y"&&e!=="xy"?(this.beans.log.warn(177),"xy"):e:"xy"}handleValueChanged(e,t,s){const{beans:i}=this,{rangeSvc:r,gos:n,valueSvc:o}=i,a=r.getRangeEndRow(e),l=r.getRangeStartRow(e),c=r.getRangeEndRow(t),u=r.getRangeStartRow(t),d=this.dragAxis==="y";if(this.isReduce&&!pc(n)?.suppressClearOnFillReduction){const x=d?e.columns:e.columns.filter(A=>t.columns.indexOf(A)<0),F=d?Zi(i,c):u;F&&this.clearCellsInRange(F,a,x);return}const h=[],p=[],g=[],f=[];let m=!0,v=0,C;const S=()=>{h.length=0,p.length=0,g.length=0,f.length=0,v=0,C=void 0},w=(x,F)=>{let A=this.isUp?a:l,P=!1;for(d&&(m=!0,S());!P&&A;){const D=fj(i,A);if(!D)break;if(d&&x)b(h,x,D,()=>!Ue(A,this.isUp?l:a));else if(F){m=!0,S();for(const N of F)b(h,N,D,()=>N!==(this.isLeft?e.columns[0]:Bs(e.columns)))}P=Ue(A,this.isUp?u:c),A=this.isUp?gc(this.beans,A):Zi(i,A)}},b=(x,F,A,P)=>{let D,N=!1,V=F,L=A;if(m)D=o.getValue(F,A,"edit"),p.push(D),g.push(o.getValue(F,A,"edit",!0)),f.push(o.getValueForDisplay({column:F,node:A,from:"edit"}).valueFormatted),m=P();else{const{value:O,fromUserFunction:K,sourceCol:H,sourceRowNode:Z,includeUnchangedValue:Y,skipCell:pe}=this.processValues({event:s,values:x,initialValues:p,initialNonAggregatedValues:g,initialFormattedValues:f,col:F,rowNode:A,previousRowNode:C,idx:v++});if(V=H??F,L=Z??A,D=O,N=pe??!1,!N&&F.isCellEditable(A)){const k=o.getValue(F,A,"edit");if(!K){if(H){const re=H.colDef;if(re.useValueFormatterForExport!==!1&&re.valueFormatter){const W=o.getValueForDisplay({column:H,node:Z,includeValueFormatted:!0,from:"edit"}).valueFormatted;W!=null&&(D=W)}}F.colDef.useValueParserForImport!==!1&&(D=o.parseValue(F,A,H?D:hj(D),k))}K&&k===D?N=!Y:A.setDataValue(F,D,"rangeSvc")}}N||(C=A,x.push({value:D,column:V,rowNode:L}))},{changeDetectionSvc:y,editSvc:T}=this.beans;T?.beginBulkWrite();try{if(y?.beginDeferred(),d)e.columns.forEach(x=>{w(x)});else{const x=this.isLeft?[...t.columns].reverse():t.columns;w(void 0,x)}T?.stopEditing(void 0,{source:"fillHandle"})}finally{y?.endDeferred(),T?.endBulkWrite()}}clearCellsInRange(e,t,s){const i={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[i],restoreSourceInBatch:!0})}processValues(e){const{formula:t,valueSvc:s}=this.beans,{event:i,values:r,initialValues:n,initialNonAggregatedValues:o,initialFormattedValues:a,col:l,rowNode:c,previousRowNode:u,idx:d}=e,h=pc(this.gos)?.setFillValue,p=this.dragAxis==="y";let g;if(p?g=this.isUp?"up":"down":g=this.isLeft?"left":"right",h){const v=s.getValue(l,c,"edit"),C=pj(this.gos,{event:i,values:r.map(({value:b})=>b),initialValues:n,initialNonAggregatedValues:o,initialFormattedValues:a,currentIndex:d,currentCellValue:v,direction:g,column:l,rowNode:c,useValue:Ej,skipCell:Dj,useDefault:Lj}),S=h(C),w=kj(S);if(w){const b=w[Ji];if(b==="value")return{value:w.value,fromUserFunction:!0,includeUnchangedValue:!0};if(b==="skip")return{value:v,fromUserFunction:!0,skipCell:!0}}else if(S!==!1)return{value:S,fromUserFunction:!0}}const f=v=>mj(v)||typeof v=="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(v.trim()),m=r.every(({value:v})=>f(v));if(i.altKey||!m){const v=String(Bs(r)?.value??"");if(m&&n.length===1){const T=this.isUp||this.isLeft?-1:1;return{value:parseFloat(v)+1*T,fromUserFunction:!1}}const{value:C,column:S,rowNode:w}=r[d%r.length];let b;const y=S.allowFormula&&t?.isFormula(v);if(y){const T=Rj(g,c,u),x=g==="left"?-1:g==="right"?1:0;b=t.updateFormulaByOffset({value:v,rowDelta:T,columnDelta:x})}else b=C;return{value:b,fromUserFunction:!1,sourceCol:y?void 0:S,sourceRowNode:w}}return{value:Bs(Pj(r.map(({value:v})=>Number(v)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(const e of this.markedCells){if(!e.isAlive())continue;const{comp:t}=e;t.toggleCss("ag-selection-fill-top",!1),t.toggleCss("ag-selection-fill-right",!1),t.toggleCss("ag-selection-fill-bottom",!1),t.toggleCss("ag-selection-fill-left",!1)}this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1}clearCellValues(){this.cellValues.length=0}markPathFrom(e,t){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(Ue(t,e))return;const s=vj(t,e),{rangeStartRow:i,rangeEndRow:r}=this;s&&(t.rowPinned==i.rowPinned&&t.rowIndex>=i.rowIndex||i.rowPinned!=r.rowPinned&&t.rowPinned==r.rowPinned&&t.rowIndex<=r.rowIndex)?(this.reduceVertical(e,t),this.isReduce=!0):(this.extendVertical(e,t,s),this.isReduce=!1)}else{const s=e.column,i=t.column;if(s===i)return;const r=s.allColsIndex,n=i.allColsIndex;n<=r&&n>=this.cellRange.columns[0].allColsIndex?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,n<r),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const i=this.beans,{rangeSvc:r}=i;let n=e;do{const o=this.cellRange,a=o.columns.length;for(let l=0;l<a;l++){const c=o.columns[l],d={...{rowIndex:n.rowIndex,rowPinned:n.rowPinned},column:c},h=r.isCellInSpecificRange(d,o),p=Ue(n,e);if(s&&(this.isUp=!0),!p){const g=Hn(i,d);if(g){this.markedCells.push(g);const f=g.comp;h||(f.toggleCss("ag-selection-fill-left",l===0),f.toggleCss("ag-selection-fill-right",l===a-1)),f.toggleCss(s?"ag-selection-fill-top":"ag-selection-fill-bottom",Ue(n,t))}}}if(Ue(n,t))break}while(n=s?gc(this.beans,n):Zi(i,n))}reduceVertical(e,t){let s=e;const i=this.beans;do{const r=this.cellRange,n=r.columns.length,o=Ue(s,t);for(let a=0;a<n;a++){const c={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:r.columns[a]},u=Hn(i,c);u&&(this.markedCells.push(u),u.comp.toggleCss("ag-selection-fill-bottom",Ue(s,t)))}if(o)break}while(s=gc(i,s))}extendHorizontal(e,t,s){const i=this.beans,{visibleCols:r}=i,n=r.allCols,o=(s?t.column:e.column).allColsIndex,a=(s?this.cellRange.columns[0]:t.column).allColsIndex,l=s?0:1,c=n.slice(o+l,a+l),{rangeStartRow:u,rangeEndRow:d}=this;for(const h of c){let p=u,g;do{g=Ue(p,d);const f=Hn(i,{rowIndex:p.rowIndex,rowPinned:p.rowPinned,column:h});if(f){this.markedCells.push(f);const m=f.comp;m.toggleCss("ag-selection-fill-top",Ue(p,u)),m.toggleCss("ag-selection-fill-bottom",Ue(p,d)),s?(this.isLeft=!0,m.toggleCss("ag-selection-fill-left",h===c[0])):m.toggleCss("ag-selection-fill-right",h===Bs(c))}p=Zi(i,p)}while(!g)}}reduceHorizontal(e,t){const s=this.beans,{visibleCols:i}=s,r=i.allCols,n=t.column.allColsIndex,o=e.column.allColsIndex,a=r.slice(n,o),{rangeStartRow:l,rangeEndRow:c}=this;for(const u of a){let d=l,h;do{h=Ue(d,c);const p=Hn(this.beans,{rowIndex:d.rowIndex,rowPinned:d.rowPinned,column:u});p&&(this.markedCells.push(p),p.comp.toggleCss("ag-selection-fill-right",u===a[0])),d=Zi(s,d)}while(!h)}}refresh(e,t){const s=t??this.beans.rangeSvc.getCellRanges()[0];if(!s.startRow||!s.endRow){this.destroy();return}super.refresh(e,s)}};import{_last as Uv}from"ag-stack";import{CellRangeType as zv,_isSameRow as Oj}from"ag-grid-community";var Nj=class extends Vv{constructor(){super({tag:"div",cls:"ag-range-handle"}),this.type=1,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.beans.rangeSvc,i=this.cellRange??Uv(s.getCellRanges());i&&(this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.getCellRanges().length===2&&s.getCellRanges()[0].type===zv.DIMENSION&&i.type===zv.VALUE&&!Oj(this.endPosition,s.getRangeEndRow(i))&&s.updateRangeRowBoundary({cellRange:s.getCellRanges()[0],boundary:"end",cellPosition:{...this.endPosition,column:s.getCellRanges()[0].columns[0]},silent:!0}),s.extendRangeToCell(i,this.endPosition))}shouldSkipCell(e){return!1}onDragEnd(e){const t=this.cellRange??Uv(this.beans.rangeSvc.getCellRanges());t&&(this.fixRangeStartEnd(t),this.rangeFixed=!1)}onDragCancel(){this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.beans.rangeSvc,s=t.getRangeStartRow(e),i=t.getRangeEndRow(e),r=e.columns[0];e.startRow=s,e.endRow=i,e.startColumn=r}},Bj=".ag-cell-range-selected.ag-cell-range-chart,.ag-cell-range-selected:not(.ag-cell-focus),.ag-grid-viewport:not(.ag-has-focus) .ag-cell-range-single-cell:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color);&.ag-cell-range-chart{background-color:var(--ag-range-selection-chart-background-color)!important;&.ag-cell-range-chart-category{background-color:var(--ag-range-selection-chart-category-background-color)!important}}}.ag-cell-range-selected-1.ag-cell-range-chart,.ag-cell-range-selected-1.ag-formula-range,.ag-cell-range-selected-1:not(.ag-cell-focus),.ag-root:not(.ag-context-menu-open) .ag-grid-viewport:not(.ag-has-focus) .ag-cell-range-selected-1:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color)}.ag-cell-range-selected-2.ag-cell-range-chart,.ag-cell-range-selected-2.ag-formula-range,.ag-cell-range-selected-2:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-3.ag-cell-range-chart,.ag-cell-range-selected-3.ag-formula-range,.ag-cell-range-selected-3:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-4.ag-cell-range-chart,.ag-cell-range-selected-4.ag-formula-range,.ag-cell-range-selected-4:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell.ag-cell-range-selected:not(.ag-cell-range-single-cell){&.ag-cell-range-top{border-top-color:var(--ag-range-selection-border-color);border-top-style:var(--ag-range-selection-border-style)}&.ag-cell-range-right{border-right-color:var(--ag-range-selection-border-color);border-right-style:var(--ag-range-selection-border-style)}&.ag-cell-range-bottom{border-bottom-color:var(--ag-range-selection-border-color);border-bottom-style:var(--ag-range-selection-border-style)}&.ag-cell-range-left{border-left-color:var(--ag-range-selection-border-color);border-left-style:var(--ag-range-selection-border-style)}}.ag-cell.ag-selection-fill-top,.ag-cell.ag-selection-fill-top.ag-cell-range-selected{border-top:1px dashed;border-top-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-right,:where(.ag-ltr) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-right,:where(.ag-rtl) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}.ag-cell.ag-selection-fill-bottom,.ag-cell.ag-selection-fill-bottom.ag-cell-range-selected{border-bottom:1px dashed;border-bottom-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-left,:where(.ag-ltr) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-left,:where(.ag-rtl) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}.ag-fill-handle,.ag-range-handle{background-color:var(--ag-range-selection-border-color);bottom:-1px;height:6px;position:absolute;width:6px}:where(.ag-ltr) .ag-fill-handle,:where(.ag-ltr) .ag-range-handle{right:-1px}:where(.ag-rtl) .ag-fill-handle,:where(.ag-rtl) .ag-range-handle{left:-1px}.ag-fill-handle{cursor:crosshair}:where(.ag-ltr) .ag-range-handle{cursor:nwse-resize}:where(.ag-rtl) .ag-range-handle{cursor:nesw-resize}";function Vj(e){return e.rangeSvc?.getCellRanges()??null}function Hj(e,t){e.rangeSvc?.addCellRange(t)}function Wv(e){e.rangeSvc?.removeAllCellRanges()}import{AutoScrollService as Uj,_areEqual as $v,_exists as zj,_last as Re,_makeNull as Kv,_missing as Wj,_removeAllFromArray as $j,_removeFromArray as Un}from"ag-stack";import{BeanStub as Kj,KeyCode as jj,_areCellsEqual as Yj,_canScrollVertically as qj,_getAbsoluteRowIndex as jv,_getCellCtrlForEventTarget as Xj,_getEnableColumnSelection as Zj,_getFirstRow as fc,_getLastRow as mc,_getRowAbove as Qi,_getRowBelow as Vs,_getRowCtrlForEventTarget as Jj,_getRowNode as Qj,_getSuppressMultiRanges as e9,_interpretAsRightClick as t9,_isCellSelectionEnabled as zn,_isRowBefore as Me,_isSameRow as ht,_isUsingNewCellSelectionAPI as s9}from"ag-grid-community";import{_last as i9,_missing as r9,_requestAnimationFrame as n9,_setAriaSelected as o9}from"ag-stack";import{CellRangeType as Wn,_isSameRow as Yv}from"ag-grid-community";var er="ag-cell-range-selected",a9="ag-cell-range-chart",l9="ag-cell-range-single-cell",qv="ag-cell-range-chart-category",c9="ag-cell-range-handle",u9="ag-cell-range-top",d9="ag-cell-range-right",h9="ag-cell-range-bottom",p9="ag-cell-range-left";function g9(e){const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"?t.handle?.mode==="range":!1:e.get("enableRangeHandle")}function Xv(e){const t=e.get("cellSelection");return t!==void 0?typeof t!="boolean"?t.handle?.mode==="fill":!1:e.get("enableFillHandle")}var f9=class{constructor(e,t){this.beans=e,this.cellCtrl=t,this.rangeColorClass=null,this.handleColorClass=null,this.refreshScheduled=!1,this.rangeSvc=e.rangeSvc}setComp(e){this.cellComp=e,this.eGui=this.cellCtrl.eGui,this.onCellSelectionChanged()}unsetComp(){this.beans.context.destroyBean(this.selectionHandle)}onCellSelectionChanged(){const e=this.cellComp;if(!e)return;const{rangeSvc:t,cellCtrl:s,eGui:i}=this,r=t.getCellRangeCount(s.cellPosition);this.rangeCount=r;const n=this.getHasChartRange();this.hasChartRange=n,e.toggleCss(er,r!==0),e.toggleCss(`${er}-1`,r===1),e.toggleCss(`${er}-2`,r===2),e.toggleCss(`${er}-3`,r===3),e.toggleCss(`${er}-4`,r>=4),e.toggleCss(a9,n),o9(i,r>0?!0:void 0),e.toggleCss(l9,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){const e=this.getRangeBorders(),t=this.isSingleCell(),s=!t&&e.top,i=!t&&e.right,r=!t&&e.bottom,n=!t&&e.left,o=this.cellComp;o.toggleCss(u9,s),o.toggleCss(d9,i),o.toggleCss(h9,r),o.toggleCss(p9,n)}isSingleCell(){const{rangeSvc:e}=this;return this.rangeCount===1&&!!e&&!e.isMoreThanOneCell()}getHasChartRange(){const{rangeSvc:e}=this;if(!this.rangeCount||!e)return!1;const t=e.getCellRanges();return t.length>0&&t.every(s=>[Wn.DIMENSION,Wn.VALUE].includes(s.type))}updateRangeBordersIfRangeCount(){this.rangeCount>0&&(this.updateRangeBorders(),this.refreshRangeStyleAndHandle())}getRangeBorders(){const e=this.beans.gos.get("enableRtl");let t=!1,s=!1,i=!1,r=!1;const{rangeSvc:n,beans:{visibleCols:o},cellCtrl:{cellPosition:a}}=this,l=a.column,c=n.getCellRanges().filter(h=>n.isCellInSpecificRange(a,h));if(!c.length)return{top:t,right:s,bottom:i,left:r};let u,d;e?(u=o.getColAfter(l),d=o.getColBefore(l)):(u=o.getColBefore(l),d=o.getColAfter(l)),u||(r=!0),d||(s=!0);for(let h=0;h<c.length&&!(t&&s&&i&&r);h++){const p=c[h],g=n.getRangeStartRow(p),f=n.getRangeEndRow(p);!t&&Yv(g,a)&&(t=!0),!i&&Yv(f,a)&&(i=!0),!r&&u&&p.columns.indexOf(u)<0&&(r=!0),!s&&d&&p.columns.indexOf(d)<0&&(s=!0)}return{top:t,right:s,bottom:i,left:r}}refreshRangeStyleAndHandle(){const{context:e}=this.beans;if(e.isDestroyed())return;this.styleCellForRangeType();const t=this.getRangeForHandle();this.selectionHandle&&!t&&(this.selectionHandle=e.destroyBean(this.selectionHandle)),t&&this.addSelectionHandle(t),this.refreshHandleColor(t),this.cellComp.toggleCss(c9,!!this.selectionHandle)}scheduleRefreshRangeStyleAndHandle(){this.refreshScheduled||(this.refreshScheduled=!0,n9(this.beans,()=>{this.refreshScheduled=!1,this.refreshRangeStyleAndHandle()}))}styleCellForRangeType(){if(this.hasChartRange){const{rangeSvc:e}=this,t=e.getCellRanges()[0],i=t.type===Wn.DIMENSION&&e.isCellInSpecificRange(this.cellCtrl.cellPosition,t);this.cellComp.toggleCss(qv,i)}else this.cellComp.toggleCss(qv,!1),this.applyRangeColor(this.getRangeColorClass())}applyRangeColor(e){this.rangeColorClass&&this.rangeColorClass!==e&&(this.cellComp.toggleCss(this.rangeColorClass,!1),this.cellComp.toggleCss("ag-formula-range",!1)),e&&(this.cellComp.toggleCss(e,!0),this.cellComp.toggleCss("ag-formula-range",e.startsWith("ag-formula-range"))),this.rangeColorClass=e??null}getRangeColorClass(){const{rangeSvc:e,rangeCount:t}=this;if(!e||!t)return null;const s=e.getCellRanges();for(let i=s.length-1;i>=0;i--){const r=s[i],n=r.colorClass;if(n&&e.isCellInSpecificRange(this.cellCtrl.cellPosition,r))return n}return null}refreshHandleColor(e){const t=this.selectionHandle?.getGui?.(),s=e?.colorClass??null;if(!t){this.handleColorClass=null;return}this.handleColorClass&&this.handleColorClass!==s&&t.classList.remove(this.handleColorClass),s?t.classList.add(s):this.handleColorClass&&t.classList.remove(this.handleColorClass),this.handleColorClass=s??null}getRangeForHandle(){const{gos:e,editSvc:t}=this.beans,s=this.rangeSvc,i=s.getCellRanges(),r=i.length;if(this.rangeCount<1||r<1)return null;const n=t?.isRangeSelectionEnabledWhileEditing(),o=n?i:[i9(i)];for(const a of o){const{cellPosition:l,column:c}=this.cellCtrl,u=Xv(e)&&!c.isSuppressFillHandle(),d=g9(e);let p=!t?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(n||r===1&&(u||d));if(this.hasChartRange&&(p=a.type===Wn.VALUE),p&&a.endRow!=null&&s.isContiguousRange(a)&&s.isBottomRightCell(a,l))return a}return null}addSelectionHandle(e){const{editSvc:t,gos:s,context:i,registry:r}=this.beans,n=t?.isRangeSelectionEnabledWhileEditing(),o=e.type,l=!n&&Xv(s)&&r9(o)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==l&&(this.selectionHandle=i.destroyBean(this.selectionHandle)),!this.selectionHandle){const c=r.createDynamicBean(l===0?"fillHandle":"rangeHandle",!1);c&&(this.selectionHandle=i.createBean(c))}this.selectionHandle?.refresh(this.cellCtrl,e)}destroy(){this.unsetComp()}};import{BeanStub as m9,_isCellSelectionEnabled as Zv}from"ag-grid-community";var v9=class extends m0{constructor(e){super(),this.eContainer=e}postConstruct(){const{beans:e,gos:t,eContainer:s}=this,i=e.rangeSvc,r={eElement:s,onDragStart:i.onDragStart.bind(i),onDragStop:i.onDragStop.bind(i),onDragging:i.onDragging.bind(i)},n=e.dragSvc,o=n.addDragSource.bind(n,r),a=n.removeDragSource.bind(n,r);this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{Zv(t)?o():a()}),this.addDestroyFunc(a),Zv(t)&&o()}};import{BeanStub as C9}from"ag-grid-community";var S9=class extends v0{constructor(e,t){super(),this.column=e,this.eGui=t}postConstruct(){this.addManagedElementListeners(this.eGui,{click:e=>e&&this.onClick(e)})}onClick(e){this.beans.rangeSvc?.handleColumnSelection(this.column,e)}};import{BeanStub as b9}from"ag-grid-community";var y9=class extends C0{constructor(e,t){super(),this.column=e,this.comp=t,this.columnMap=new Map,this.isActive=!1,this.resetColumnMap()}postConstruct(){this.addManagedPropertyListener("cellSelection",()=>{this.refreshActive()}),this.refreshActive(),this.setupRangeHeaderHighlight()}resetColumnMap(){this.columnMap.clear();let e;this.column.isColumn?e=[this.column]:e=this.column.getDisplayedLeafColumns();for(const t of e)this.columnMap.set(t,!1)}refreshActive(){const{gos:e,rangeSvc:t}=this.beans,s=e.get("cellSelection");this.isActive=!!(s&&t&&typeof s=="object"&&s.enableHeaderHighlight)}setupRangeHeaderHighlight(){const e=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:e,columnPinned:e,columnMoved:e,columnGroupOpened:e}),e()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();const e=this.beans.rangeSvc.getCellRanges();let t=!1,s=!0;for(const i of e){if(t)break;for(const r of i.columns)this.columnMap.has(r)&&(this.columnMap.set(r,!0),t||(t=!0))}for(const i of Array.from(this.columnMap.values()))if(i===!1){s=!1;break}this.comp.toggleCss("ag-header-range-highlight",t&&s)}destroy(){super.destroy(),this.comp=null,this.column=null}},w9=class extends S0{constructor(){super(...arguments),this.beanName="rangeSvc",this.rangeSelectionExtensions=[],this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1,this.columnRangeSelectionCtx={}}wireBeans(e){this.rowModel=e.rowModel,this.dragSvc=e.dragSvc,this.colModel=e.colModel,this.visibleCols=e.visibleCols,this.cellNavigation=e.cellNavigation,this.ctrlsSvc=e.ctrlsSvc}postConstruct(){const e=this.onColumnsChanged.bind(this),t=()=>this.removeAllCellRanges(),s=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:e,columnVisible:e,columnValueChanged:e,columnPivotModeChanged:t,columnRowGroupChanged:t,columnPivotChanged:t,columnGroupOpened:s,columnMoved:s,columnPinned:s}),this.ctrlsSvc.whenReady(this,i=>{const r=i.gridBodyCtrl;this.autoScrollService=new Uj({scrollContainer:r.eGridViewport,scrollAxis:"xy",getVerticalPosition:()=>r.scrollFeature.getVScrollPosition().top,setVerticalPosition:n=>r.scrollFeature.setVerticalScrollPosition(n),getHorizontalPosition:()=>r.scrollFeature.getHScrollPosition().left,setHorizontalPosition:n=>r.scrollFeature.setHorizontalScrollPosition(n),shouldSkipVerticalScroll:()=>!qj(this.beans),shouldSkipHorizontalScroll:()=>!r.scrollFeature.isHorizontalScrollShowing(),getTopOffset:()=>r.getTopPinnedRowsOffset(),getBottomOffset:()=>r.getBottomPinnedRowsOffset()})})}registerRangeSelectionExtension(e){this.rangeSelectionExtensions.includes(e)||this.rangeSelectionExtensions.push(e)}unregisterRangeSelectionExtension(e){Un(this.rangeSelectionExtensions,e)}shouldSuppressRangeSelection(e){return this.rangeSelectionExtensions.some(t=>t.shouldSuppressRangeSelection?.(e))}shouldSkipColumn(e){return this.rangeSelectionExtensions.some(t=>t.shouldSkipColumn?.(e))}isAllColumnsSelectionCell(e){return this.rangeSelectionExtensions.some(t=>t.isAllColumnsSelectionCell?.(e))}isAllColumnsRange(e,t){return this.rangeSelectionExtensions.some(s=>s.isAllColumnsRange?.(e,t))}updateSelectionModeForCell(e){this.setSelectionMode(this.isAllColumnsSelectionCell(e))}onDragStart(e){const t=this.gos,s=e.target;if(!zn(t)||Jj(t,s)?.isSuppressMouseEvent(e)||this.shouldSuppressRangeSelection(s))return;const{shiftKey:i}=e,r=this.isMultiRange(e),n=i&&!!this.cellRanges?.length;!r&&(!n||zj(Re(this.cellRanges).type))&&this.removeAllCellRanges(!0);const o=this.dragSvc.startTarget;if(o&&this.updateValuesOnMove(o),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=r&&this.getCellRangeCount(this.lastCellHovered)>1,n||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=Re(this.cellRanges);else{const a={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},l=this.getColumnsFromModel([this.lastCellHovered.column]);if(!l?.length)return;this.draggingRange={startRow:a,endRow:a,columns:l,startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsSvc.getGridBodyCtrl().eGridViewport.addEventListener("scroll",this.bodyScrollListener,{passive:!0}),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}onDragging(e){const{dragging:t,lastCellHovered:s,newestRangeStartCell:i,autoScrollService:r,cellHasChanged:n}=this;if(!t||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const o=p=>s?.rowPinned===p&&i.rowPinned===p,a=o("top")||o("bottom");if(r.check(e,a),!n||!s)return;const l=i?.column,c=s?.column,u=this.calculateColumnsBetween(l,c);if(!u)return;const{rowIndex:d,rowPinned:h}=s;this.draggingRange.endRow={rowIndex:d,rowPinned:h},this.draggingRange.columns=u,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsSvc.getGridBodyCtrl().eGridViewport.removeEventListener("scroll",this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange&&(this.intersectionRange=!1,this.intersectLastRange()),this.dispatchChangedEvent(!1,!0,e)}onColumnsChanged(){this.refreshLastRangeStart();for(const t of this.cellRanges){const s=t.columns;t.columns=t.columns.filter(r=>r.isVisible()&&r.displayed),!$v(s,t.columns)&&this.dispatchChangedEvent(!1,!0,t.id)}const e=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(t=>t.columns.length>0),e>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=Re(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns,s=t.length;if(!s)return!1;let i=t[0].allColsIndex,r=i;for(let n=1;n<s;++n){const o=t[n].allColsIndex;o<i?i=o:o>r&&(r=o)}return r-i+1===s}getRangeStartRow(e){return e.startRow&&e.endRow?Me(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return Me(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount(e){const t=this.beans,s=this.getRangeStartRow(e),i=this.getRangeEndRow(e),r=jv(t,s);return jv(t,i)-r+1}handleCellMouseDown(e,t){const s=e.ctrlKey||e.metaKey;this.handleCellSelectionInput(t,{target:e.target,shiftKey:e.shiftKey,isRightClick:t9(this.beans,e),isMultiRange:this.isMultiRange(e),isMultiKey:s,preventDefault:()=>e.preventDefault()})}handleCellKeyboardSelect(e,t){const s=e.ctrlKey||e.metaKey;this.handleCellSelectionInput(t,{target:e.target,shiftKey:e.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(s),isMultiKey:s,preventDefault:()=>e.preventDefault()})}handleCellSelectionInput(e,t){const{target:s,shiftKey:i,isRightClick:r,isMultiRange:n,isMultiKey:o,preventDefault:a}=t;if(this.shouldSuppressRangeSelection(s))return;const l=this.isAllColumnsSelectionCell(e);if(l&&a(),i)return this.extendLatestRangeToCell(e);if(l&&r)return;this.updateSelectionModeForCell(e);const c=this.calculateColumnsBetween(e.column,e.column);if(!c)return;const u=l?this.findContainingRange({columns:c,startRow:e,endRow:e}):void 0;l&&!!u&&n&&o&&u?this.removeRowFromAllColumnsRange(e,u):this.setRangeToCell(e,n)}isMultiRange(e){return this.isMultiRangeForKeyState(e.ctrlKey||e.metaKey)}isMultiRangeForKeyState(e){const{editingWithRanges:t,allowMulti:s}=this.getMultiRangeContext();return t||(s?e:!1)}getMultiRangeContext(){const{gos:e,editSvc:t}=this.beans,s=!!t?.isEditing()&&!!t?.isRangeSelectionEnabledWhileEditing(),i=e9(e)&&!s;return{editingWithRanges:s,suppressMultiRanges:i,allowMulti:!i}}removeRowFromAllColumnsRange(e,t){const{beans:s,cellRanges:i}=this,r=fc(s),n=mc(s),o=this.getRangeStartRow(t),a=this.getRangeEndRow(t);if(!o&&ht(r,e))$n(t,Vs(s,r),"top");else if(!a&&ht(n,e))$n(t,Qi(s,n),"bottom");else if(ht(o,a))Un(i,t);else if(ht(o,e))$n(t,Vs(s,e),"top");else if(ht(a,e))$n(t,Qi(s,e),"bottom");else{const l=Qi(s,e),c=Vs(s,e);t.startRow=o,t.endRow=l??void 0,i.push({...t,startRow:c??void 0,endRow:a})}this.dispatchChangedEvent(!0,!0)}setRangeToCell(e,t=!1){const{gos:s}=this;if(!zn(s))return;this.updateSelectionModeForCell(e);const i=this.calculateColumnsBetween(e.column,e.column);if(!i)return;const{suppressMultiRanges:r}=this.getMultiRangeContext();(r||!t||Wj(this.cellRanges))&&this.removeAllCellRanges(!0);const n={rowIndex:e.rowIndex,rowPinned:e.rowPinned},o={startRow:n,endRow:n,columns:i,startColumn:e.column},a=this.ensureRangeStartColumn(o);a&&(this.cellRanges.push(o),this.setNewestRangeStartCell({...e,column:a}),this.onDragStop(),this.dispatchChangedEvent(!0,!0))}getRangeLastColumn(e){const t=e.columns[0],s=Re(e.columns);return this.newestRangeStartCell?.column===t?s:t}extendRangeRowCountBy(e,t){const{beans:s}=this,{startRow:i,endRow:r}=e;if(!i||!r)return;let n=0,o;const a=Me(r,i);a?o=i:o=r;const l=t>0?Vs:Qi,c=Math.abs(t);for(;n<c;){const d=l(s,o);if(!d)break;o=d,n++}if(n!==c)return;const u={...o,column:this.getRangeLastColumn(e)};this.updateRangeRowBoundary({cellRange:e,boundary:a?"start":"end",cellPosition:u})}extendRangeColumnCountBy(e,t){const{columns:s}=e;if(t===0)return;const i=this.getColumnsFromModel();if(!i)return;const r=this.ensureRangeStartColumn(e);if(!r)return;const n=Re(s),o=r===s[0]?n:s[0];if(!n||!o)return;let a=i.indexOf(r);const l=i.indexOf(o),c=l<a;c&&(a=l);const d=s.length+t;if(d<=0)return;const h=[];for(let p=a;p<a+d;p++){const g=i[p];if(!g)break;h.push(g)}if(h.length===d){if(c){const p=Re(h);e.startColumn=p,this.focusCellOnNewColumn(e,p)}e.columns=h,this.dispatchChangedEvent(!0,!0,e.id)}}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=Re(this.cellRanges);this.updateSelectionModeForCell(e),this.updateRangeRowBoundary({cellRange:t,boundary:"end",cellPosition:e})}extendRangeToCell(e,t){e&&(this.updateSelectionModeForCell(t),this.updateRangeRowBoundary({cellRange:e,boundary:"end",cellPosition:t}))}updateRangeRowBoundary(e){const{cellRange:t,boundary:s,cellPosition:i,silent:r=!1}=e,n=i.column,o=this.ensureRangeStartColumn(t);if(!o)return;const a=this.calculateColumnsBetween(o,n);!a||T9(t,i)||(s==="start"&&this.focusCellOnNewRow(t,i),t.columns=a,t[s==="start"?"startRow":"endRow"]={rowIndex:i.rowIndex,rowPinned:i.rowPinned},r||this.dispatchChangedEvent(!0,!0,t.id))}getRangeEdgeColumns(e){const t=this.visibleCols.allCols,s=e.columns;let i=-1,r=-1;for(let n=0,o=s.length;n<o;++n){const a=s[n].allColsIndex;a>-1&&((i===-1||a<i)&&(i=a),a>r&&(r=a))}return{left:t[i],right:t[r]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,i=Re(this.cellRanges),r=this.newestRangeStartCell,n=i.endRow.rowIndex,o=i.endRow.rowPinned,l={column:this.getRangeLastColumn(i),rowIndex:n,rowPinned:o},c=this.cellNavigation.getNextCellToFocus(t,l,s);if(c&&!this.shouldSkipColumn(c.column))return this.setCellRange({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,rowEndIndex:c.rowIndex,rowEndPinned:c.rowPinned,columnStart:r.column,columnEnd:c.column}),c}setCellRange(e){zn(this.gos)&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){if($v(this.cellRanges,e)||!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);const t=this.getColumnsFromModel(this.visibleCols.allCols)??[];let s=!1;for(const i of e){if(i.columns&&i.startRow){const r=this.getColumnsFromModel(i.columns);if(!r||r.length===0)continue;i.columns=r;const{startRow:n}=i;this.setNewestRangeStartCell({rowIndex:n.rowIndex,rowPinned:n.rowPinned,column:i.columns[0]})}!s&&t.length>0&&this.isAllColumnsRange(i,t)&&(s=!0),this.cellRanges.push(i)}this.setSelectionMode(s),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues(e){const{beans:t,eventSvc:s}=this,{cellEventSource:i="rangeSvc",dispatchWrapperEvents:r,wrapperEventSource:n="deleteKey",restoreSourceInBatch:o}=e;let{cellRanges:a}=e;r&&(s.dispatchEvent({type:"cellSelectionDeleteStart",source:n}),s.dispatchEvent({type:"rangeDeleteStart",source:n})),a||(a=this.cellRanges);const{valueSvc:l,editSvc:c}=t,u=!!c?.isBatchEditing(),{changeDetectionSvc:d}=t;c?.beginBulkWrite();try{d?.beginDeferred(),this.forEachEditableCellInRanges(a,(h,p)=>{if(o&&u){c?.batchResetToSourceValue({rowNode:h,column:p});return}const g=l.getDeleteValue(p,h);h.setDataValue(p,g,i)})}finally{d?.endDeferred(),c?.endBulkWrite()}r&&(s.dispatchEvent({type:"cellSelectionDeleteEnd",source:n}),s.dispatchEvent({type:"rangeDeleteEnd",source:n}))}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){const{columns:s,columnStart:i,columnEnd:r,rowStartIndex:n,rowStartPinned:o,rowEndIndex:a,rowEndPinned:l}=e,c=this.getColumnsFromParams(s,i,r);if(!c||!t&&c.columns.length===0)return;const{columns:u,startsOnTheRight:d}=c,h=Jv(n,o),p=Jv(a,l);return{startRow:h,endRow:p,columns:u,startColumn:this.getColumnFromModel(i)??(d?Re(u):u[0])}}addCellRange(e){const t=this.gos;if(!zn(t)||!this.verifyCellRanges(t))return;this.setSelectionMode(!1);const s=this.createCellRangeFromCellRangeParams(e);if(s)return s.startRow&&this.setNewestRangeStartCell({rowIndex:s.startRow.rowIndex,rowPinned:s.startRow.rowPinned,column:s.startColumn}),this.cellRanges.push(s),this.dispatchChangedEvent(!1,!0,s.id),s}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){const e=this.cellRanges.length;if(e===0)return!1;if(e>1)return!0;const t=this.cellRanges[0],s=this.getRangeStartRow(t),i=this.getRangeEndRow(t);return s.rowPinned!==i.rowPinned||s.rowIndex!==i.rowIndex||t.columns.length!==1}areAllRangesAbleToMerge(){const e=new Map;if(this.cellRanges.length<=1)return!0;for(const i of this.cellRanges)this.forEachRowInRange(i,r=>{const n=`${r.rowPinned||"normal"}_${r.rowIndex}`,o=e.get(n),a=i.columns.map(l=>l.getId());if(o){const l=a.filter(c=>o.indexOf(c)===-1);o.push(...l)}else e.set(n,a)});let s;for(const i of e.values()){const r=i.sort().join();if(s===void 0){s=r;continue}if(s!==r)return!1}return!0}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns?.includes(e.column),i=this.isRowInRange(e,t);return s&&i}isColumnInAnyRange(e){const{beans:t}=this,s=fc(t),i=mc(t);if(!s||!i)return!1;const r=e.isColumn?[e]:e.getDisplayedLeafColumns();return this.findContainingRange({columns:r,startRow:s,endRow:i},!0)!=null}findContainingRange({columns:e,startRow:t,endRow:s},i=!1){const r=this.cellRanges;for(let n=r.length-1;n>=0;n--){const o=r[n],a=e.every(c=>o.columns.includes(c));let l;if(i)l=ht(o.startRow,t)&&ht(o.endRow,s);else{const c=t&&this.isRowInRange(t,o),u=s&&this.isRowInRange(s,o);l=!!c&&!!u}if(a&&l)return o}}isBottomRightCell(e,t){const s=e.columns;let i=-1;for(let c=0,u=s.length;c<u;++c){const d=s[c].allColsIndex;d>i&&(i=d)}const{startRow:r,endRow:n}=e,o=Me(r,n)?n:r,a=t.column.allColsIndex===i,l=t.rowIndex===o.rowIndex&&Kv(t.rowPinned)===Kv(o.rowPinned);return a&&l}getCellRangeCount(e){return this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t){const s=this.getRangeStartRow(t),i=this.getRangeEndRow(t),r=ht(e,s),n=ht(e,i);if(r||n)return!0;const o=!Me(e,s),a=Me(e,i);return o&&a}intersectLastRange(e){const{editingWithRanges:t,suppressMultiRanges:s}=this.getMultiRangeContext();if(t||s||e&&this.dragging||this.isEmpty())return;const i=Re(this.cellRanges),r=this.getRangeStartRow(i),n=this.getRangeEndRow(i),o=[];for(const a of this.cellRanges.slice(0,-1)){const l=this.getRangeStartRow(a),c=this.getRangeEndRow(a),u=a.columns,d=u.filter(p=>i.columns.indexOf(p)===-1);if(d.length===u.length){o.push(a);continue}if(Me(n,l)||Me(c,r)){o.push(a);continue}const h=o.length;if(Me(l,r)){const p={columns:[...u],startColumn:i.startColumn,startRow:{...l},endRow:Qi(this.beans,r)};o.push(p)}if(d.length>0){const p={columns:d,startColumn:d.includes(i.startColumn)?i.startColumn:d[0],startRow:x9([{...r},{...l}]),endRow:F9([{...n},{...c}])};o.push(p)}Me(n,c)&&o.push({columns:[...u],startColumn:i.startColumn,startRow:Vs(this.beans,n),endRow:{...c}}),o.length-h===1&&(o[o.length-1].id=a.id)}this.cellRanges=o,e&&this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature(e,t,s){e.createManagedBean(new y9(t,s))}setSelectionMode(e){this.selectionMode=e?1:0}refreshRangeStart(e){const{columns:t}=e,s=this.ensureRangeStartColumn(e);if(!s)return;const i=(l,c)=>{const u=e.columns.filter(d=>d!==l);l?(e.startColumn=l,e.columns=c?[l,...u]:[...u,l]):e.columns=u},{left:r,right:n}=this.getRangeEdgeColumns(e);if(s===t[0]&&s!==r){i(r,!0);return}s===Re(t)&&s===n&&i(n,!1)}setNewestRangeStartCell(e){this.newestRangeStartCell=e}getColumnsFromParams(e,t,s){const i=!e&&!t&&!s;let r,n=!1;return i||e?r=this.getColumnsFromModel(i?void 0:e):t&&s&&(r=this.calculateColumnsBetween(t,s),r?.length&&(n=r[0]!==this.getColumnFromModel(t))),r?{columns:r,startsOnTheRight:n}:void 0}verifyCellRanges(e){const{suppressMultiRanges:t}=this.getMultiRangeContext(),s=s9(e)&&t&&this.cellRanges.length>1;return s&&this.warn(93),!s}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),i=this.getRangeEndRow(e);let r=s;for(;r&&(t(r),!ht(r,i));)r=Vs(this.beans,r)}forEachEditableCellInRanges(e,t){const{beans:s}=this;for(const i of e)this.forEachRowInRange(i,r=>{const n=Qj(s,r);if(n)for(let o=0;o<i.columns.length;o++){const a=this.getColumnFromModel(i.columns[o]);a?.isCellEditable(n)&&t(n,a)}})}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}updateValuesOnMove(e){const t=Xj(this.gos,e),s=t?.cellPosition;if(this.cellHasChanged=!1,!s||this.lastCellHovered&&Yj(s,this.lastCellHovered))return;const i=this.beans.editSvc;if(i?.isEditing(t,{withOpenEditor:!0})&&!i?.isRangeSelectionEnabledWhileEditing()){this.dragSvc.cancelDrag(e);return}this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s}dispatchChangedEvent(e,t,s){this.eventSvc.dispatchEvent({type:"cellSelectionChanged",started:e,finished:t,id:s}),this.eventSvc.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}getColumnFromModel(e){return typeof e=="string"?this.colModel.getCol(e):e}getColumnsFromModel(e){const{visibleCols:t,selectionMode:s}=this;(!e||s===1)&&(e=t.allCols);const i=[];for(const r of e){const n=this.getColumnFromModel(r);!n||this.shouldSkipColumn(n)||i.push(n)}return i.length?i:void 0}ensureRangeStartColumn(e){const t=this.getRangeStartColumn(e.columns,e.startColumn);if(t)return e.startColumn=t,t}getRangeStartColumn(e,t){const s=e[0],i=Re(e);if(!s||!i)return;if(!t||e.includes(t))return t??s;const r=t.allColsIndex,n=s.allColsIndex,o=i.allColsIndex;return r<0||n<0||o<0||r-n<=o-r?s:i}calculateColumnsBetween(e,t){const s=this.visibleCols.allCols,i=this.getColumnFromModel(e),r=this.getColumnFromModel(t),n=i===r,o=i.allColsIndex;if(o<0){this.warn(178,{colId:i.getId()});return}const a=n?o:r.allColsIndex;if(a<0){this.warn(178,{colId:r.getId()});return}if(n||this.selectionMode===1)return this.getColumnsFromModel([i]);const l=Math.min(o,a),c=l===o?a:o;return this.getColumnsFromModel(s.slice(l,c+1))}focusCellOnNewColumn(e,t){const{focusSvc:s}=this.beans,i=s.getFocusedCell();i&&this.isCellInSpecificRange(i,e)&&s.setFocusedCell({...i,column:t,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}focusCellOnNewRow(e,t){const{focusSvc:s}=this.beans,i=s.getFocusedCell();i&&this.isCellInSpecificRange(i,e)&&s.setFocusedCell({...t,column:i.column,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}createDragListenerFeature(e){return new v9(e)}createCellRangeFeature(e){return new f9(this.beans,e)}createHeaderGroupCellMouseListenerFeature(e,t){return new S9(e,t)}handleColumnSelection(e,t){const{gos:s,beans:i,columnRangeSelectionCtx:r,cellRanges:n}=this;if(!Zj(s))return;const{suppressMultiRanges:o,editingWithRanges:a}=this.getMultiRangeContext(),l=n.length>0,c=t.ctrlKey||t.metaKey,u=!a||c,d=fc(i),h=mc(i);if(!d||!h)return;if(t.key===jj.ENTER&&t.preventDefault(),t.shiftKey){const g=r.root;if(!g)return;const f=e.isColumn?e:Re(e.getLeafColumns()),m=this.findContainingRange({columns:[g],startRow:d,endRow:h},!0);if(!m){Un(n,r.lastCellRange),this.selectColumns(this.calculateColumnsBetween(g,f),d,h);return}this.updateRangeRowBoundary({cellRange:m,boundary:"end",cellPosition:{column:f,...h}});return}l&&(o||!c&&!a)&&this.removeAllCellRanges(!0);const p=(g,f)=>{const m=this.findContainingRange({columns:g,startRow:d,endRow:h},!0);if(m&&u)this.deselectColumnsFromRange(m,g);else{const v=this.selectColumns(g,d,h);v&&(r.lastCellRange=v)}r.root=f};if(e.isColumn)p([e],e);else{const g=e.getDisplayedLeafColumns();p(g,g[0])}}deselectColumnsFromRange(e,t){$j(e.columns,t),t.includes(e.startColumn)&&(e.startColumn=e.columns[0]),e.columns.length===0&&Un(this.cellRanges,e),this.dispatchChangedEvent(!0,!0)}selectColumns(e,t,s){return this.addCellRange({columns:e,columnStart:e[0],columnEnd:Re(e),rowStartIndex:t.rowIndex,rowStartPinned:t.rowPinned,rowEndIndex:s.rowIndex,rowEndPinned:s.rowPinned})}};function Jv(e,t){return e!=null?{rowIndex:e,rowPinned:t}:void 0}function x9(e){let t;for(const s of e)(t===void 0||Me(t,s))&&(t=s);return t}function F9(e){let t;for(const s of e)(t===void 0||Me(s,t))&&(t=s);return t}function T9(e,t){const{startRow:s,endRow:i}=e,r=Me(s,i)?i:s,n=t.rowIndex===r.rowIndex&&t.rowPinned===r.rowPinned,o=e.columns[0],a=Re(e.columns),l=e.startColumn===o?a:o;return t.column===l&&n}function $n(e,t,s){let i;s==="top"?i=!e.startRow||!e.endRow||Me(e.startRow,e.endRow)?"startRow":"endRow":i=!e.startRow||!e.endRow||Me(e.startRow,e.endRow)?"endRow":"startRow",e[i]=t??void 0}var Kn={moduleName:"CellSelection",version:G,beans:[w9],dynamicBeans:{fillHandle:Gj,rangeHandle:Nj},apiFunctions:{getCellRanges:Vj,addCellRange:Hj,clearRangeSelection:Wv,clearCellSelection:Wv},dependsOn:[$,dj,uj],css:[Bj]},A9={moduleName:"RangeSelection",version:G,dependsOn:[Kn]};import{_CsrmSsrmSharedApiModule as P9,_RowModelSharedApiModule as R9,_SharedRowSelectionModule as M9,_SortModule as I9,_SsrmInfiniteSharedApiModule as E9,onRowHeightChanged as D9,resetRowHeights as L9}from"ag-grid-community";import{RefPlaceholder as Qv}from"ag-stack";import{Component as k9,_createIconNoSpan as _9}from"ag-grid-community";var G9={tag:"div",cls:"ag-loading",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},O9=class extends b0{constructor(){super(G9),this.eLoadingIcon=Qv,this.eLoadingText=Qv}init(e){e.node.failedLoad?this.setupFailed():this.setupLoading()}setupFailed(){this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingError","ERR")}setupLoading(){const e=_9("groupLoading",this.beans,null);e&&this.eLoadingIcon.appendChild(e),this.eLoadingText.textContent=this.getLocaleTextFunc()("loadingOoo","Loading...")}refresh(e){return!1}},N9={moduleName:"LoadingCellRenderer",version:G,userComponents:{agLoadingCellRenderer:O9},icons:{groupLoading:"loading"},dependsOn:[$]};import{_ColumnGroupModule as B9}from"ag-grid-community";function V9(e){return e.colModel.pivotMode}function H9(e,t,s){return e.pivotResultCols?.lookupPivotResultCol(t,s)??null}function U9(e,t){e.valueColsSvc?.setColumns(t,"api")}function z9(e){return e.valueColsSvc?.columns??[]}function W9(e,t){e.valueColsSvc?.removeColumns(t,"api")}function $9(e,t){e.valueColsSvc?.addColumns(t,"api")}function K9(e,t){e.pivotColsSvc?.setColumns(t,"api")}function j9(e,t){e.pivotColsSvc?.removeColumns(t,"api")}function Y9(e,t){e.pivotColsSvc?.addColumns(t,"api")}function q9(e){return e.pivotColsSvc?.columns??[]}function X9(e,t){e.pivotResultCols?.setPivotResultCols(t,"api",!0)}function Z9(e){return e.pivotResultCols?.pivotCols??null}import{BeanStub as J9,_resolvePivotSort as Q9}from"ag-grid-community";var eC="PivotRowTotal_",eY=({headerName:e},{headerName:t})=>e&&!t?1:!e&&t?-1:!e&&!t?0:e<t?-1:e>t?1:0,tY=e=>(t,s)=>e(t.headerName,s.headerName),sY=()=>0,iY=(e,t,s)=>{if(e.children!=null)return!0;const i=e.pivotKeys;return i!=null?i.length>t:!s&&t===0},rY=(e,t)=>{const s=e.some(i=>i.children!=null);return i=>iY(i,t,s)},nY=(e,t,s)=>{const i=e.filter(t).sort(s),r=[];let n=0;for(let o=0,a=e.length;o<a;++o){const l=e[o];r.push(t(l)?i[n++]:l)}return r},oY=(e,t,s)=>{const i=e.children;if(!i)return null;const r=tC(i,t+1,s);return r?{...e,children:r}:null},tC=(e,t,s)=>{const i=e.length;if(t>=s.length||i===0)return null;const r=nY(e,rY(e,t),s[t]);let n=!1;for(let o=0;o<i;++o){const a=r[o],l=oY(a,t,s);l?(r[o]=l,n=!0):a!==e[o]&&(n=!0)}return n?r:null},aY=class extends y0{constructor(){super(...arguments),this.beanName="pivotColDefSvc"}wireBeans(e){this.colModel=e.colModel,this.pivotColsSvc=e.pivotColsSvc,this.valueColsSvc=e.valueColsSvc,this.colNames=e.colNames}postConstruct(){const e=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=e(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=e()});const t=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=t(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=t()})}createPivotColumnDefs(e){const t=this.createPivotColumnsFromUniqueValues(e);function s(r,n=[]){return r.forEach(o=>{o.children!==void 0?s(o.children,n):n.push(o)}),n}const i=s(t);return this.addRowGroupTotals(t,i),this.addExpandablePivotGroups(t,i),this.addPivotTotalsToGroups(t,i),t}createPivotColumnsFromUniqueValues(e){const t=this.pivotColsSvc?.columns??[],s=t.length;return this.recursivelyBuildGroup(0,e,[],s,t)}recursivelyBuildGroup(e,t,s,i,r){if(e>=i)return this.buildMeasureCols(s);const n=r[e],o=n.colDef,a=this.getPivotGroupComparator(n),l=this.valueColsSvc?.columns;if(l?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===i-1){const u=[];for(const d of t.keys()){const h=[...s,d],p=sC(d,o),g=this.createColDef(l[0],p,h);g.columnGroupShow="open",u.push(g)}return u.sort(a),u}const c=[];for(const u of t.keys()){const d=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,h=[...s,u];c.push({children:this.recursivelyBuildGroup(e+1,t.get(u),h,i,r),headerName:sC(u,o),pivotKeys:h,columnGroupShow:"open",openByDefault:d,groupId:this.generateColumnGroupId(h)})}return c.sort(a),c}buildMeasureCols(e){const t=this.valueColsSvc?.columns??[];return t.length===0?[this.createColDef(null,"-",e)]:t.map(s=>{const i=this.colNames.getDisplayNameForColumn(s,"header"),r=this.createColDef(s,i,e);return r.columnGroupShow="open",r})}addExpandablePivotGroups(e,t){const s=this.gos.get("suppressExpandablePivotGroups");if(s||this.gos.get("pivotColumnGroupTotals"))return;const i=(r,n,o)=>{if("children"in r){const{valueColsSvc:u}=this,{columns:d=[]}=u??{},h=new Map;r.children.forEach(f=>{i(f,n,h)});const p=!r.children.some(f=>f.children),g=p&&d.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(const f of d){const m=this.colNames.getDisplayNameForColumn(f,"header"),v=this.createColDef(f,m,r.pivotKeys);v.pivotTotalColumnIds=h.get(f.colId),v.columnGroupShow=s?"open":"closed",v.aggFunc=f.aggFunc,(!p||g)&&(r.children.push(v),n.push(v))}this.merge(o,h);return}const a=r.pivotValueColumn;if(!a)return;const l=a.colId;o.has(l)?o.get(l).push(r.colId):o.set(l,[r.colId])};e.forEach(r=>{i(r,t,new Map)})}addPivotTotalsToGroups(e,t){if(!this.gos.get("pivotColumnGroupTotals"))return;const s=this.gos.get("pivotColumnGroupTotals")==="after",i=this.valueColsSvc?.columns,r=i?.map(n=>n.aggFunc);if(!(!r||r.length<1||!this.sameAggFuncs(r))&&i){const n=i[0];e.forEach(o=>{this.recursivelyAddPivotTotal(o,t,n,s)})}}recursivelyAddPivotTotal(e,t,s,i){const r=e;if(!r.children){const o=e;return o.colId?[o.colId]:null}let n=[];if(r.children.forEach(o=>{const a=this.recursivelyAddPivotTotal(o,t,s,i);a&&(n=n.concat(a))}),r.children.length>1){const a=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),l=this.createColDef(s,a,e.pivotKeys,!0);l.pivotTotalColumnIds=n,l.aggFunc=s.aggFunc,l.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;const c=e.children;i?c.push(l):c.unshift(l),t.push(l)}return n}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const s=this.gos.get("pivotRowTotals")==="after",r=(this.valueColsSvc?.columns??[]).slice();s||r.reverse();const n=r.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let o=0;o<r.length;o++){const a=r[o],l=this.colNames.getDisplayNameForColumn(a,"header"),c=this.createColDef(a,l,[]),u=[];for(let h=0;h<t.length;h++){const p=t[h];p.pivotValueColumn===a&&u.push(p.colId)}c.pivotTotalColumnIds=u,c.colId=eC+c.colId;const d=n?{children:[c],pivotKeys:[],groupId:`${eC}_pivotGroup_${a.colId}`}:c;t.push(c),s?e.push(d):e.unshift(d)}}recreateColDef(e){const{pivotValueColumn:t,headerName:s,pivotKeys:i,pivotTotalColumnIds:r,columnGroupShow:n,colId:o,field:a,valueGetter:l,aggFunc:c}=e;if(!t)return e;const u=this.createColDef(t,s,i,!!r);return u.columnGroupShow=n,u.colId=o,u.field=a,u.valueGetter=l,u.aggFunc=c,u.pivotTotalColumnIds=r,this.gos.get("processPivotResultColDef")?.(u),u}createColDef(e,t,s,i=!1){const r={};if(e){const n=e.colDef;Object.assign(r,n),r.hide=!1,e.isCalculatedCol&&(r.calculatedExpression=void 0,r.allowFormula=void 0)}return r.headerName=t,r.colId=this.generateColumnId(s||[],e&&!i?e.colId:""),r.field=r.colId,r.valueGetter=n=>n.data?.[n.colDef.field],r.pivotKeys=s,r.pivotValueColumn=e,r.filter===!0&&(r.filter="agNumberColumnFilter"),r}sameAggFuncs(e){if(e.length==1)return!0;for(let t=1;t<e.length;t++)if(e[t]!==e[0])return!1;return!0}merge(e,t){t.forEach((s,i)=>{const n=[...e.has(i)?e.get(i):[],...s];e.set(i,n)})}generateColumnGroupId(e){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map(s=>s.colId).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${(this.pivotColsSvc?.columns??[]).map(i=>i.colId).join("-")}_${e.join("-")}_${t}`}getPivotGroupComparator(e){const t=Q9(this.beans,e.pivotSort);if(t===null)return sY;const s=e.colDef.pivotComparator,i=s?tY(s):eY;return t==="desc"?(r,n)=>i(n,r):i}orderPivotResultColDefs(e){const t=this.pivotColsSvc?.columns;if(!t?.length)return e;const s=[];for(let i=0,r=t.length;i<r;++i)s.push(this.getPivotGroupComparator(t[i]));return tC(e,0,s)??e}createColDefsFromFields(e){const t=this.pivotColsSvc?.columns??[],s=t.map(o=>this.getPivotGroupComparator(o)),i=new Map;for(let o=0;o<e.length;o++){const l=e[o].split(this.fieldSeparator);let c=i;for(let u=0;u<l.length;u++){const d=l[u];let h=c.get(d);h||(h=new Map,c.set(d,h)),c=h}}const r=(o,a,l,c,u)=>{const d=[];for(const[f,m]of l){const v=r(`${o}${this.fieldSeparator}${f}`,f,m,c+1,[...u,f]);d.push(v)}const h=c+1;if(h<t.length&&d.sort(s[h]),d.length===0){const f=u.slice(0,-1),m=this.colModel.getNonPivotCol(a);if(m){const C=this.colNames.getDisplayNameForColumn(m,"header")??a,S=this.createColDef(m,C,void 0,!1);return S.colId=o,S.aggFunc=m.aggFunc,S.valueGetter=w=>w.data?.[o],S.pivotKeys=f,S}return{colId:o,headerName:a,pivotKeys:f,valueGetter:C=>C.data?.[o]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&d.length===1&&"colId"in d[0]?(d[0].headerName=a,d[0]):{openByDefault:this.pivotDefaultExpanded===-1||c<this.pivotDefaultExpanded,groupId:o,headerName:a,children:d}},n=[];for(const[o,a]of i){const l=r(o,o,a,0,[o]);n.push(l)}return t.length>0&&n.sort(s[0]),n}};function sC(e,t){return t.refData?.[e]??e}import{_areEqual as lY,_pushToMapArray as cY}from"ag-stack";import{BeanStub as uY,_buildColumnTree as dY,_destroyColumnTreeAll as iC,_destroyColumnTreeUnused as hY}from"ag-grid-community";var pY=class extends w0{constructor(){super(...arguments),this.beanName="pivotResultCols",this.pivotCols=null,this.pivotTree=[],this.pivotTreeDepth=0,this.dependentsByValueCol=null,this.pivotHasMarryChildren=!1,this.pivotGroupsById=new Map,this.pivotColsByKey=new Map,this.pivotAllGroups=[],this.savedPivot=null,this.suppliedColDefs=null}wireBeans(e){this.colModel=e.colModel,this.visibleCols=e.visibleCols}lookupPivotResultCol(e,t){const s=this.pivotCols;if(s==null)return null;const i=this.colModel.getNonPivotCol(t);for(let r=0,n=s.length;r<n;++r){const o=s[r];if(o.pivotValueColumn===i&&lY(o.colDef.pivotKeys,e))return o}return null}getAggregationOrderedList(){const e=this.aggOrderedList;return e!==void 0?e:this.loadAggregationOrderedList()}buildAllCols(){const e=this.collectParkedPrimaries(),t=this.colModel.colsList;return e===null?t:t.concat(e)}buildColsInStateOrder(){const e=this.collectParkedPrimaries(),t=this.colModel.colsList;if(e===null)return t;for(let s=0,i=t.length;s<i;++s)e.push(t[s]);return e}collectParkedPrimaries(){const e=this.colModel.colDefList;let t=null;for(let s=0,i=e.length;s<i;++s){const r=e[s];r.inColsList||(t??(t=[]),t.push(r))}return t}loadAggregationOrderedList(){const e=this.pivotCols;if(!e||e.length===0)return this.aggOrderedList=null,null;let t=null,s=null;for(let r=0,n=e.length;r<n;++r){const o=e[r];o.colDef.pivotTotalColumnIds!=null?(s===null&&(s=[],t=e.slice(0,r)),s.push(o)):t!==null&&t.push(o)}const i=s===null?e:t.concat(s);return this.aggOrderedList=i,i}setPivotResultCols(e,t,s){if(this.aggOrderedList=void 0,!!this.colModel.ready){if(e)this.processPivotResultColDef(e),s?(this.suppliedColDefs=e,this.applyPivotResultColDefs(this.orderColDefs(e),t)):(this.suppliedColDefs=null,this.applyPivotResultColDefs(e,t));else if(this.pivotCols!=null)this.suppliedColDefs=null,this.clearPivotResultCols(t);else{this.suppliedColDefs=null;return}this.visibleCols.refresh(t,!1)}}resortPivotResultCols(e){const t=this.suppliedColDefs;t&&(this.aggOrderedList=void 0,this.applyPivotResultColDefs(this.orderColDefs(t),e),this.visibleCols.refresh(e,!1))}orderColDefs(e){return this.beans.pivotColDefSvc?.orderPivotResultColDefs(e)??e}destroy(){this.pivotCols&&iC(this.pivotCols,this.pivotAllGroups),this.pivotTree=[],this.pivotCols=null,this.pivotAllGroups=[],this.dependentsByValueCol=null;const e=this.savedPivot;e&&(this.savedPivot=null,iC(e.cols,e.groups)),super.destroy()}applyPivotResultColDefs(e,t){const s=this.beans,i=this.pivotCols,r=i?this.pivotTree:null,n=this.savedPivot,o=s.pivotColsSvc?.isStrictColumnOrder()??!1,a=r==null&&n!=null&&!o,l=r??n?.tree??null,c=r?i:n?.cols??null,u=r?this.pivotAllGroups:n?.groups??null,d=s.colModel.nextBuildToken(),h=dY(s,e,!1,this.pivotGroupsById,this.pivotColsByKey,s.colModel.colsById,t,!0,d,null);l&&l!==h.columnTree&&hY(c??[],u??[],d),this.pivotCols=h.columns,this.pivotTree=h.columnTree,this.pivotTreeDepth=h.treeDepth,this.pivotHasMarryChildren=h.marryChildren,this.pivotGroupsById=h.groupsById,this.pivotColsByKey=h.colsByKey,this.pivotAllGroups=h.allGroups,this.savedPivot=null,this.dependentsByValueCol=null,this.colModel.refreshCols(!a,t)}clearPivotResultCols(e){this.savedPivot={tree:this.pivotTree,cols:this.pivotCols,groups:this.pivotAllGroups},this.pivotCols=null,this.pivotTree=[],this.pivotTreeDepth=0,this.pivotHasMarryChildren=!1,this.pivotAllGroups=[],this.dependentsByValueCol=null,this.colModel.refreshCols(!1,e)}recreateColDefsForSource(e,t){const s=this.pivotCols;if(s==null)return;let i=this.dependentsByValueCol;if(i===null){i=new Map;for(let o=0,a=s.length;o<a;++o){const l=s[o],c=l.pivotValueColumn;c!=null&&cY(i,c,l)}this.dependentsByValueCol=i}const r=i.get(e);if(r===void 0)return;const n=this.beans.pivotColDefSvc;if(n)for(let o=0,a=r.length;o<a;++o){const l=r[o],c=n.recreateColDef(l.colDef);l.setColDef(c,c,t)}}processPivotResultColDef(e){const t=this.gos.get("processPivotResultColDef"),s=this.gos.get("processPivotResultColGroupDef");(t||s)&&rC(e,t,s)}},rC=(e,t,s)=>{for(let i=0,r=e.length;i<r;++i){const n=e[i],o=n.children;o?(s?.(n),rC(o,t,s)):t?.(n)}};import{_areEqual as gY,_jsonEquals as fY,_missing as mY}from"ag-stack";import{BeanStub as vY,_defaultPivotSort as CY,_forEachChangedGroupDepthFirst as SY}from"ag-grid-community";var nC="Exceeded maximum allowed pivot column count.",jn=e=>{const t={};return e.forEach((s,i)=>t[i]=s instanceof Map?jn(s):s),t},bY=class extends x0{constructor(){super(...arguments),this.beanName="pivotStage",this.step="pivot",this.refreshProps=["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups","enableStrictPivotColumnOrder"],this.uniqueValues=new Map,this.pivotOrderLastTime=[],this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.pivotResultCols=e.pivotResultCols,this.pivotColDefSvc=e.pivotColDefSvc}execute(e,t){return this.beans.colModel.isPivotActive()?this.executePivotOn(e,t):this.executePivotOff()}executePivotOff(){return this.aggregationColumnsHashLastTime=null,this.pivotOrderLastTime=[],this.uniqueValues=new Map,this.pivotResultCols.pivotCols?(this.pivotResultCols.setPivotResultCols(null,"rowModelUpdated"),!0):!1}executePivotOn(e,t){const{valueColsSvc:s,gos:i,rowGroupColsSvc:r,pivotColsSvc:n}=this.beans,o=s?.columns.length??1,a=i.get("pivotMaxGeneratedColumns");this.maxUniqueValues=a===-1?-1:a/o;let l;try{l=this.bucketUpRowNodes(e)}catch(y){if(y.message===nC)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:y.message}),this.lastTimeFailed=!0,!1;throw y}const c=this.setUniqueValues(l),u=s?.columns??[],d=u.map(y=>`${y.getId()}-${y.colDef.headerName}`).join("#"),h=u.map(y=>y.aggFunc?.toString()).join("#"),p=this.aggregationColumnsHashLastTime!==d,g=this.aggregationFuncsHashLastTime!==h;this.aggregationColumnsHashLastTime=d,this.aggregationFuncsHashLastTime=h;const f=(r?.columns??[]).map(y=>y.getId()).join("#"),m=f!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=f;const v=n?.columns??[],S=n?.isStrictColumnOrder()??!1?oC(this.uniqueValues,v,0,CY(this.beans)):[],w=!gY(S,this.pivotOrderLastTime);this.pivotOrderLastTime=S;const b=this.refreshProps.some(y=>t?.has(y));if(this.lastTimeFailed||c||p||m||g||w||b){const y=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(y,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues(e){return fY(jn(this.uniqueValues),jn(e))?!1:(this.uniqueValues=e,!0)}bucketUpRowNodes(e){const t=this.beans.rowModel;this.currentUniqueCount=0;const s=new Map;SY(t.rootNode,t.hierarchical,e,r=>{r.leafGroup&&(r.childrenMapped=null)});const i=r=>{if(r.leafGroup)this.bucketRowNode(r,s);else{const n=r.childrenAfterFilter;if(n)for(let o=0,a=n.length;o<a;++o)i(n[o])}};return i(t.rootNode),s}bucketRowNode(e,t){const s=this.beans.pivotColsSvc?.columns;s?.length===0?e.childrenMapped=null:e.childrenMapped=jn(this.bucketChildren(e.childrenAfterFilter,s,0,t)),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t=[],s,i){const r=new Map,n=t[s],o=this.maxUniqueValues!==-1;for(let l=0,c=e.length;l<c;++l){const u=e[l];let d=this.beans.valueSvc.getKeyForNode(n,u);if(mY(d)&&(d=""),!i.get(d)){this.currentUniqueCount+=1,i.set(d,new Map);const h=this.currentUniqueCount>this.maxUniqueValues;if(o&&h)throw new Error(nC)}r.has(d)||r.set(d,[]),r.get(d).push(u)}if(s===t.length-1)return r;const a=new Map;for(const l of r.keys())a.set(l,this.bucketChildren(r.get(l),t,s+1,i.get(l)));return a}};function oC(e,t,s,i){const r=t[s],n=[...e.keys()],o=r?.pivotSort,a=o===void 0?i:o;if(a!==null){const c=r?.colDef.pivotComparator;c?n.sort(c):n.sort(),a==="desc"&&n.reverse()}if(s===t.length-1)return n;const l=[];for(let c=0;c<n.length;c++){const u=n[c];l.push(u);const d=e.get(u);if(d instanceof Map){const h=oC(d,t,s+1,i);for(let p=0;p<h.length;p++)l.push(h[p])}}return l}var aC={moduleName:"SharedPivot",version:G,beans:[pY,aY,Cm],apiFunctions:{isPivotMode:V9,getPivotResultColumn:H9,setValueColumns:U9,getValueColumns:z9,removeValueColumns:W9,addValueColumns:$9,setPivotColumns:K9,removePivotColumns:j9,addPivotColumns:Y9,getPivotColumns:q9,setPivotResultColumns:X9,getPivotResultColumns:Z9},dependsOn:[tc,B9]},lC={moduleName:"Pivot",version:G,rowModels:["clientSide"],beans:[bY],dependsOn:[aC,sc,_s]};import{_removeFromArray as yY}from"ag-stack";import{BeanStub as wY,RowNode as xY}from"ag-grid-community";var cC=e=>{const t=e.split(".");if(t.includes("__proto__"))return()=>{};const s=t.length;return s<2?i=>i?.[e]:i=>{let r=0;do if(i=i?.[t[r++]],r===s)return i;while(typeof i=="object")}},Le=2147483648,Ge=1073741824,Yn=536870912,tr=268435455,vc=String.fromCodePoint(31,41150,8291),Cc=3,FY=class extends F0{constructor(){super(...arguments),this.nestedDataGetter=null,this.parentIdGetter=null,this.nonLeafsById=null,this.fullReload=!1}postConstruct(){this.onPropChange(null)}onPropChange(e){const t=this.gos;if(!e||e.has("treeDataParentIdField")){const s=t.get("treeDataParentIdField"),i=s?cC(s):null;this.fullReload||(this.fullReload=this.parentIdGetter!==i),this.parentIdGetter=i,i&&(this.nestedDataGetter=null)}if(!e||e.has("treeDataChildrenField")){const s=this.parentIdGetter?"":t.get("treeDataChildrenField"),i=s?cC(s):null;this.fullReload||(this.fullReload=this.nestedDataGetter!==i),this.nestedDataGetter=i}}destroy(){this.reset(),super.destroy()}reset(){this.clearNonLeafs(),this.fullReload=!0}clearNonLeafs(){const e=this.nonLeafsById;if(e){for(const t of e.values())t._destroy(null);e.clear(),this.nonLeafsById=null}}getNonLeaf(e){return this.nonLeafsById?.get(e)}loadGroupData(e){const t=e.key;if(t==null)return e._groupData=null,null;const s={};e._groupData=s;const i=this.beans.showRowGroupCols?.columns;if(i)for(let r=0,n=i.length;r<n;++r)s[i[r].colId]=t;return s}execute(e,t){this.fullReload&&this.reset();const{changedRowNodes:s,changedPath:i}=t,r=this.fullReload||!s&&!i,n=!!s&&this.flagUpdatedNodes(s);(r||n)&&(this.fullReload=!1,this.parentIdGetter?this.loadSelfRef(e,r):this.nestedDataGetter?this.loadNested(e,s,r):this.loadDataPath(e,r));const o=this.initRowsParents(e);this.destroyFillerRows(!!t.animate),this.initRowsChildrenSize(e);let a=this.preprocessRows(e);const l=o||(a&Le)!==0;a&=~Le;const c=this.traverseRoot(e,i);return a>0&&a!==c&&(this.handleCycles(e),this.traverseRoot(e,i)),e.treeNodeFlags=0,l}flagUpdatedNodes(e){const{adds:t,updates:s,removals:i}=e;let r=i.length>0;if(t.size>0){r=!0;for(const n of t)n.treeNodeFlags|=Ge}if(s.size>0){r=!0;for(const n of s)n.treeNodeFlags|=Ge}return r}initRowsParents(e){const t=e._leafs,s=t.length;let i=!1;for(let r=0;r<s;++r)this.initRowParent(t[r])&&(i=!0);return i}initRowParent(e){let t=!1;for(;;){const s=e.parent,i=e.treeParent;if(i===null){s&&(t=!0,this.hideRow(e));break}let r=i.treeNodeFlags+1;const n=s!==i;if(n&&(t=!0,r|=Ge,e.parent=i),n&&s&&(s.destroyed&&AY(i,s),s.treeNodeFlags|=Ge),i.sourceRowIndex>=0||i.treeNodeFlags&Yn||i.treeParent===null){i.treeNodeFlags=r;break}i.treeNodeFlags=r|Yn|e.treeNodeFlags&Ge,e=i}return t}destroyFillerRows(e){const t=this.nonLeafsById;if(t){for(const s of t.values())(s.treeParent===null||(s.treeNodeFlags&tr)===0)&&(t.delete(s.id),s._destroy(e),this.hideRow(s));t.size===0&&(this.nonLeafsById=null)}}initRowsChildrenSize(e){this.initRowChildrenSize(e);const t=e._leafs,s=t.length;for(let r=0;r<s;++r)this.initRowChildrenSize(t[r]);const i=this.nonLeafsById;if(i!==null)for(const r of i.values())this.initRowChildrenSize(r)}initRowChildrenSize(e){let{childrenAfterGroup:t,_leafs:s,treeNodeFlags:i}=e;const r=t?.length,n=i&tr;if(e.treeNodeFlags=i&~tr|((r||0)===n?0:Le),n===0&&e.level>=0){if(t!==null){e.childrenAfterGroup=null,e.childrenAfterFilter=null,e.childrenAfterAggFilter=null,e.childrenAfterSort=null;const o=e.sibling;o&&(o.childrenAfterGroup=null,o.childrenAfterFilter=null,o.childrenAfterAggFilter=null,o.childrenAfterSort=null)}}else if(r!==n||t===s)if(!t||t===s){e.childrenAfterGroup=t=new Array(n);const o=e.sibling;o&&(o.childrenAfterGroup=t)}else t.length=n}preprocessRows(e){const t=e._leafs,s=t.length;let i=0,r=!1;for(let n=0;n<s;++n){let o=t[n];for(;;){const a=o.treeParent;if(a===null)break;++i;let l=a.treeNodeFlags;const c=a.childrenAfterGroup,u=l&tr;if(l=l&~tr|u+1,(l&Le||c[u]!==o)&&(l|=Le,c[u]=o,r=!0),a.treeNodeFlags=l,a.data||(a.treeNodeFlags&Yn)===0||a.treeParent===null)break;a.treeNodeFlags=l&~Yn|o.treeNodeFlags&Ge,o=a}}return i|(r?Le:0)}traverseRoot(e,t){let s=0;const i=e.childrenAfterGroup;for(let r=0,n=i.length;r<n;++r)s+=this.traverse(i[r],0,!1,t);return s&~Le}traverse(e,t,s,i){const r=e.childrenAfterGroup,n=r?.length??0;let o=e.treeNodeFlags;e.treeNodeFlags=0,e.level=t,e.group!==!!n?(Va(e,this.beans,!!n),o|=Ge):e.hasChildren()!==!!n&&(e.updateHasChildren(),o|=Ge);const a=(o&(Ge|Le))!==0;n!==0||e.master?e._expanded??(e._expanded=null):e._expanded=void 0,s&&e.rowIndex!==null&&e.clearRowTopAndRowIndex(),s||(s=!e.expanded),++t,o&=Le;for(let c=0;c<n;++c){const u=r[c],d=this.traverse(u,t,s,i);o=o+(d&~Le)|d&Le}return a&&(o|=Le),o&Le&&(n>0&&i?.addRow(e),e._leafs=void 0),o+1}handleCycles(e){const t=new Set,s=n=>{if(t.has(n))return!1;t.add(n);for(const o of n.childrenAfterGroup??[])s(o);return!0};s(e);const i=e.childrenAfterGroup;i.length=0;const r=e._leafs;for(let n=0,o=r.length;n<o;++n){const a=r[n],l=a.treeParent;if(l&&s(a)){l.treeNodeFlags|=Le|Ge,a.parent=e;const c=l.childrenAfterGroup;yY(c,a),c.length===0&&(l.childrenAfterGroup=null),i.push(a),this.warn(270,{id:a.id,parentId:l?.id??""})}else l===e&&i.push(a)}}loadNested(e,t,s){if(!s&&t){for(const r of t.adds)r.key=r.id;return}const i=e._leafs;for(let r=0,n=i.length;r<n;++r){const o=i[r],a=o.id;o.key!==a&&qn(o,a)}}loadSelfRef(e,t){const s=e._leafs,i=s.length;if(!this.gos.get("getRowId")){for(let a=0;a<i;a++)s[a].treeParent=null;return}const n=this.beans.rowModel,o=this.parentIdGetter;for(let a=0;a<i;a++){const l=s[a];if(t||l.treeNodeFlags&Ge||l.treeParent?.destroyed){let c;const u=o?.(l.data);u!=null&&(c=n.getRowNode(u),c||this.warn(271,{id:l.id,parentId:u})),l.treeParent=c??e;const d=l.id;l.key!==d&&qn(l,d)}else l.treeParent??(l.treeParent=e)}}loadFlattened(e){const t=e._leafs;for(let s=0,i=t.length;s<i;++s){const r=t[s];r.treeParent=e;const n=r.id;r.key!==n&&qn(r,n)}}loadDataPath(e,t){const s=this.gos.get("getDataPath");if(!s){this.loadFlattened(e);return}const i=new Map,r=new Map;let n;t||(n=this.loadExistingDataPath(e,i,r));const o=e._leafs;for(let a=0,l=o.length;a<l;++a){const c=o[a];if(!t&&c.treeParent!==null&&(c.treeNodeFlags&Ge)===0)continue;const u=s(c.data),d=u?.length;if(!d){this.warn(185,{data:c.data});continue}const h=u[d-1];c.key!==h&&qn(c,h);const p=u.join(vc);r.set(c,p);const g=i.get(p);g===void 0?i.set(p,c):g!==c&&(n=this.duplicatedPath(i,n,g,c,p))}n&&this.processDuplicatePaths(n,r),this.buildFromPaths(e,i,r)}loadExistingDataPath(e,t,s){let i;const r=e._leafs;for(let n=0,o=r.length;n<o;++n){const a=r[n],l=a.treeParent;if(l===null||(a.treeNodeFlags&Ge)!==0)continue;let c=a.key,u=l;for(;u&&u!==e&&u!==a;){c=vc+c;const d=s.get(u);if(d!==void 0){c=d+c;break}c=u.key+c,u=u.treeParent}if(u!==a){s.set(a,c);const d=t.get(c);d===void 0?t.set(c,a):d!==a&&(i=this.duplicatedPath(t,i,d,a,c))}}return i}duplicatedPath(e,t,s,i,r){i.sourceRowIndex<s.sourceRowIndex&&e.set(r,i);const n=(t??(t=new Map)).get(r);return n===void 0?t.set(r,[s,i]):n.push(i),t}buildFromPaths(e,t,s){const i=new Array(48),r=e._leafs;for(let n=0,o=r.length;n<o;++n){const a=r[n],l=s.get(a);if(l===void 0)continue;const c=this.splitPathKey(i,l);let u=0,d=e;for(let h=c-1;h>=0;--h){const p=t.get(l.slice(0,i[h]));if(p){d=p,u=h+1;break}}u<c&&(d=this.buildMissingFillers(t,l,i,c,u,d)),a.treeParent=d}}splitPathKey(e,t){let s=0,i=0;const r=t.length;for(;i<r;){const n=t.indexOf(vc,i);if(n===-1)break;e[s++]=n,i=n+Cc}return s}buildMissingFillers(e,t,s,i,r,n){let o=0,a="row-group";n.sourceRowIndex<0&&n.treeParent&&(o=r,a=n.id);do{const l=r===0?0:s[r-1]+Cc,c=s[r],u=t.slice(0,c);let d=e.get(u);if(d===void 0){const h=l===0?u:t.slice(l,c);a=this.makeFillerIdBase(t,s,r,a,o)+h,d=this.getOrCreateFiller(h,a),e.set(u,d),o=r+1}else d.sourceRowIndex<0&&(a=d.id,o=r+1);d.treeParent=n,n=d,++r}while(r<i);return n}processDuplicatePaths(e,t){for(const s of e.values()){s.sort(TY);const i=s.length,r=new Array(i-1);for(let o=1;o<i;++o){const a=s[o];t.delete(a),a.treeParent=null,r[o-1]=a.data}const n=s[0];this.warn(186,{rowId:n.id,rowData:n.data,duplicateRowsData:r})}}getOrCreateFiller(e,t){const s=this.nonLeafsById??(this.nonLeafsById=new Map);let i=s.get(t);return i===void 0&&(i=new xY(this.beans),i.id=t,i.key=e,i.group=!0,i.leafGroup=!1,i.rowGroupIndex=null,s.set(t,i)),i}makeFillerIdBase(e,t,s,i,r){for(;r<s;){const n=r>0?t[r-1]+Cc:0,o=t[r];i+="-"+r+"-"+e.slice(n,o),++r}return i+"-"+s+"-"}hideRow(e){e.isSelected()&&this.beans.selectionSvc?.removeFromSelection?.(e,"rowDataChanged"),e.parent=null,e.group=!1,e.treeParent=null,e.treeNodeFlags=0,e.childrenAfterGroup=null,e.childrenAfterFilter=null,e.childrenAfterAggFilter=null,e.childrenAfterSort=null,e._leafs=void 0,e._groupData=null,e.aggData=null;const t=e.sibling;t&&(t.childrenAfterGroup=null,t.childrenAfterFilter=null,t.childrenAfterAggFilter=null,t.childrenAfterSort=null),e.updateHasChildren(),e.rowIndex!==null&&e.clearRowTopAndRowIndex()}onShowRowGroupColsSetChanged(){const e=this.beans.rowModel.rootNode._leafs;if(!e)return;for(let s=0,i=e.length;s<i;++s)e[s]._groupData=void 0;const t=this.nonLeafsById;if(t)for(const s of t.values())s._groupData=void 0}},TY=(e,t)=>e.sourceRowIndex-t.sourceRowIndex,AY=(e,t)=>{t._expanded!==void 0&&e._expanded===void 0&&e.treeParent!==null&&e.sourceRowIndex<0&&(e._expanded=t._expanded)},qn=(e,t)=>{const s=e._groupData!==void 0;e.key=t,e.groupValue=t;const i=e.sibling;i&&(i.key=t),s&&(e._groupData=void 0,e.setData(e.data))},uC={moduleName:"SharedTreeData",version:G,dependsOn:[$,Wl,Xm,Xl,Zl]},dC={moduleName:"TreeData",version:G,dynamicBeans:{treeGroupStrategy:FY},rowModels:["clientSide"],dependsOn:[uC,$l,_s,Zm,Jm]};import{_doOnce as PY,_exists as Sc}from"ag-stack";import{BeanStub as RY,RowNode as MY,_getGroupTotalRowCallback as hC,_getRowHeightAsNumber as IY,_getRowHeightForNode as pC}from"ag-grid-community";var EY="ag-Grid-MissingKey",DY=class extends T0{constructor(){super(...arguments),this.beanName="ssrmBlockUtils"}wireBeans(e){this.valueSvc=e.valueSvc,this.showRowGroupCols=e.showRowGroupCols,this.nodeManager=e.ssrmNodeManager,this.expansionSvc=e.expansionSvc,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}createRowNode(e){const t=new MY(this.beans),s=e.rowHeight!=null?e.rowHeight:IY(this.beans);return t.setRowHeight(s),t.group=e.group,t.leafGroup=e.leafGroup,t.level=e.level,t.uiLevel=e.level,t.parent=e.parent,t.stub=!0,t.__needsRefreshWhenVisible=!1,t.group&&(t.expanded=!1,t.field=e.field,t.rowGroupColumn=e.rowGroupColumn,t.rowGroupIndex=e.level),t}destroyRowNode(e,t=!1){e.childStore&&!t&&(this.destroyBean(e.childStore),e.childStore=null);const s=e.sibling;s&&!e.footer&&this.destroyRowNode(s,!1),e._destroy(!0),e.id!=null&&this.nodeManager.removeNode(e)}setTreeGroupInfo(e){e.updateHasChildren();const t=this.gos.get("getServerSideGroupKey"),s=e.hasChildren();s&&t!=null&&(e.key=t(e.data)),!s&&e.childStore!=null&&(this.destroyBean(e.childStore),e.childStore=null,e.master||(e.expanded=!1))}setRowGroupInfo(e){if(e.key=this.valueSvc.getValueFromData(e.rowGroupColumn,e),(e.key===null||e.key===void 0)&&PY(()=>{this.warn(190,{rowGroupId:e.rowGroupColumn?.getId(),data:e.data})},"SSBlock-BadKey"),this.gos.get("groupAllowUnbalanced")&&e.key===""){const r=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(r,e))}if(hC(this.beans.gos)({node:e})){const r=dt(e,this.beans);r.uiLevel=e.uiLevel+1}}setMasterDetailInfo(e){const t=this.gos.get("isRowMaster");t!=null?e.master=t(e.data):e.master=!0}updateDataIntoRowNode(e,t){e.updateData(t),this.gos.get("treeData")?(this.setTreeGroupInfo(e),this.setChildCountIntoRowNode(e),this.updateRowFooter(e)):e.group?(this.setChildCountIntoRowNode(e),this.updateRowFooter(e)):this.gos.get("masterDetail")}updateRowFooter(e){if(!e.footer){if(e.group&&hC(this.beans.gos)({node:e})&&!e.sibling){dt(e,this.beans);return}e.sibling&&Hl(e)}}setDataIntoRowNode(e,t,s,i){e.stub=!1;const r=this.gos.get("treeData");e.setDataAndId(t,s);const n=e.group;(r||!n)&&this.gos.get("masterDetail")&&this.setMasterDetailInfo(e),r?this.setTreeGroupInfo(e):n&&this.setRowGroupInfo(e),(r||n)&&(this.setGroupDataIntoRowNode(e),this.setChildCountIntoRowNode(e)),this.beans.selectionSvc?.updateRowSelectable(e),Sc(t)&&(e.setRowHeight(pC(this.beans,e,!1,i).height),e.sibling?.setRowHeight(pC(this.beans,e.sibling,!1,i).height))}setChildCountIntoRowNode(e){const t=this.gos.get("getChildCount");t&&e.setAllChildrenCount(t(e.data))}setGroupDataIntoRowNode(e){const t=e.key;e.groupValue=t,e.sibling&&(e.sibling.groupValue=t);const s=this.showRowGroupCols?.columns;if(!s)return;const i=this.gos.get("treeData");for(const r of s){let n=e._groupData;if(n||(n={},e._groupData=n),i)n[r.colId]=t;else if(r.isRowGroupDisplayed(e.rowGroupColumn.getId())){const o=this.valueSvc.getValueFromData(e.rowGroupColumn,e);n[r.colId]=o}}}clearDisplayIndex(e){e.clearRowTopAndRowIndex(),e.hasChildren()&&e.childStore&&e.childStore?.clearDisplayIndexes(),e.master&&e.detailNode&&e.detailNode?.clearRowTopAndRowIndex()}setDisplayIndex(e,t,s,i){const r=this.gos.get("groupAllowUnbalanced")&&e.group&&e.key==="";if(this.gos.get("groupHideOpenParents")&&e.group&&e.expanded||r?(e.setRowIndex(null),e.setRowTop(null)):(e.setRowIndex(t.value++),e.setRowTop(s.value),s.value+=e.rowHeight),e.setUiLevel(i),e.footer)return;if(e.master&&(e.expanded&&e.detailNode?(e.detailNode.setRowIndex(t.value++),e.detailNode.setRowTop(s.value),s.value+=e.detailNode.rowHeight):e.detailNode&&e.detailNode.clearRowTopAndRowIndex()),e.hasChildren()&&!!e.childStore){const l=e.childStore;e.expanded||r?l.setDisplayIndexes(t,s,r?i:i+1):l.clearDisplayIndexes()}}extractRowBounds(e,t){const s=i=>({rowHeight:i.rowHeight,rowTop:i.rowTop});if(e.rowIndex===t)return s(e);if(e.hasChildren()&&e.expanded&&e.childStore){const i=e.childStore;if(i.isDisplayIndexInStore(t))return i.getRowBounds(t)}else if(e.master&&e.expanded&&e.detailNode&&e.detailNode.rowIndex===t)return s(e.detailNode)}isPixelInNodeRange(e,t){return!Sc(e.rowTop)||!Sc(e.rowHeight)?!1:t>=e.rowTop&&t<e.rowTop+e.rowHeight}getIndexAtPixel(e,t){if(this.isPixelInNodeRange(e,t))return e.rowIndex;const s=e.master&&e.expanded,i=e.detailNode;if(s&&i&&this.isPixelInNodeRange(i,t))return i.rowIndex;if(e.hasChildren()&&e.expanded&&e.childStore){const r=e.childStore;if(r.isPixelInRange(t))return r.getRowIndexAtPixel(t)}return null}createNodeIdPrefix(e){const t=[];let s=e;for(;s&&s.level>=0;)s.key===""?t.push(EY):t.push(s.key),s=s.parent;if(t.length>0)return t.reverse().join("-")}checkOpenByDefault(e){const t=!!this.expansionSvc?.isNodeExpanded(e),s=e._expanded;!!s!==t?e.setExpanded(t):s===void 0&&(e._expanded=t)}};import{BeanStub as LY,_isServerSideRowModel as kY}from"ag-grid-community";var _Y=class extends A0{constructor(){super(...arguments),this.beanName="ssrmExpandListener"}postConstruct(){kY(this.gos)&&this.addManagedEventListeners({rowExpansionStateChanged:this.onRowExpandStateChanged.bind(this)})}onRowExpandStateChanged(){const e=this.beans,t=e.expansionSvc;e.rowModel.forEachNode(s=>{t.updateExpandedState(s)}),this.eventSvc.dispatchEvent({type:"storeUpdated"})}};import{_jsonEquals as GY}from"ag-stack";import{BeanStub as OY,_isServerSideRowModel as NY}from"ag-grid-community";var BY=class extends P0{constructor(){super(...arguments),this.beanName="ssrmFilterListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.filterManager=e.filterManager,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){NY(this.gos)&&this.addManagedEventListeners({advancedFilterEnabledChanged:()=>this.onFilterChanged(!0),filterChanged:()=>this.onFilterChanged()})}onFilterChanged(e){const t=this.serverSideRowModel.getParams();if(!t)return;const s=t.filterModel;let i,r;if(this.filterManager?.isAdvFilterEnabled()){i=this.filterManager.getAdvFilterModel();const l=e?Object.keys(s??{}):this.getAdvancedFilterColumns(s),c=this.getAdvancedFilterColumns(i);for(const u of l)c.add(u);r=Array.from(c)}else if(i=this.filterManager?.getFilterModel()??{},e){const l=this.getAdvancedFilterColumns(s);for(const c of Object.keys(i))l.add(c);r=Array.from(l)}else r=this.findChangedColumns(s,i);const n=this.listenerUtils.isSortingWithValueColumn(r),o=this.listenerUtils.isSortingWithSecondaryColumn(r),a={valueColChanged:n,secondaryColChanged:o,changedColumns:r};this.serverSideRowModel.refreshAfterFilter(i,a)}findChangedColumns(e,t){const s={};for(const r of Object.keys(e))s[r]=!0;for(const r of Object.keys(t))s[r]=!0;const i=[];for(const r of Object.keys(s))!GY(e[r],t[r])&&i.push(r);return i}getAdvancedFilterColumns(e){const t=new Set;if(!e)return t;const s=i=>{if(i.filterType==="join")for(const r of i.conditions)s(r);else t.add(i.colId)};return s(e),t}};import{BeanStub as VY}from"ag-grid-community";var HY=class extends R0{constructor(){super(...arguments),this.beanName="ssrmListenerUtils"}wireBeans(e){this.pivotResultCols=e.pivotResultCols,this.valueColsSvc=e.valueColsSvc}isSortingWithValueColumn(e){const t=(this.valueColsSvc?.columns??[]).map(s=>s.colId);for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>-1)return!0;return!1}isSortingWithSecondaryColumn(e){const t=this.pivotResultCols?.pivotCols;if(!t)return!1;const s=t.map(i=>i.colId);for(let i=0;i<e.length;i++)if(s.indexOf(e[i])>-1)return!0;return!1}};import{BeanStub as UY,_getSortModel as zY,_isServerSideRowModel as WY}from"ag-grid-community";var $Y=class extends M0{constructor(){super(...arguments),this.beanName="ssrmSortSvc"}wireBeans(e){this.sortSvc=e.sortSvc,this.serverSideRowModel=e.rowModel,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){WY(this.gos)&&this.addManagedEventListeners({sortChanged:this.onSortChanged.bind(this)})}onSortChanged(){const e=this.serverSideRowModel.getParams();if(!e)return;const t=zY(this.sortSvc),s=e.sortModel,i=this.findChangedColumnsInSort(t,s),r=this.listenerUtils.isSortingWithValueColumn(i),n=this.listenerUtils.isSortingWithSecondaryColumn(i),o={valueColChanged:r,secondaryColChanged:n,changedColumns:i};this.serverSideRowModel.refreshAfterSort(t,o)}findChangedColumnsInSort(e,t){let s=[];for(const n of[e,t])if(n){const o=n.map(a=>a.colId);s=s.concat(o)}const i=(n,o)=>{const a=n?n.sort:null,l=o?o.sort:null;return a!==l},r=(n,o)=>{const a=n?t.indexOf(n):-1,l=o?e.indexOf(o):-1;return a!==l};return s.filter(n=>{const o=t.find(l=>l.colId===n),a=e.find(l=>l.colId===n);return i(o,a)||r(o,a)})}};import{BeanStub as KY}from"ag-grid-community";var jY=class extends I0{constructor(){super(...arguments),this.beanName="ssrmNodeManager",this.rowNodes=new Map}addRowNode(e){const t=e.id;this.rowNodes.has(t)&&this.warn(187,{rowId:t,firstData:this.rowNodes.get(t).data,secondData:e.data}),this.rowNodes.set(t,e)}removeNode(e){const t=e.id;this.rowNodes.delete(t)}destroy(){this.clear(),super.destroy()}clear(){this.rowNodes.clear(),super.destroy()}};import{_areEqual as YY,_debounce as qY,_jsonEquals as XY}from"ag-stack";import{BeanStub as ZY,GRAND_TOTAL_ROW_ID as JY,GROUP_TOTAL_ROW_ID_PREFIX as gC,ROOT_NODE_ID as QY,RowNode as eq,_addRowHeightChangedListener as tq,_getRowHeightAsNumber as sq,_getRowHeightForNode as sr,_getSortModel as fC,_isGetRowHeightFunction as iq,_isRowSelection as rq}from"ag-grid-community";var nq=class extends E0{constructor(){super(...arguments),this.beanName="rowModel",this.hierarchical=!0,this.started=!1,this.managingPivotResultColumns=!1,this.onRowHeightChanged_debounced=qY(this,this.onRowHeightChanged.bind(this),100)}wireBeans(e){this.colModel=e.colModel,this.colNames=e.colNames,this.pivotResultCols=e.pivotResultCols,this.rowGroupColsSvc=e.rowGroupColsSvc,this.pivotColsSvc=e.pivotColsSvc,this.valueColsSvc=e.valueColsSvc,this.filterManager=e.filterManager,this.sortSvc=e.sortSvc,this.rowRenderer=e.rowRenderer,this.nodeManager=e.ssrmNodeManager,this.storeFactory=e.ssrmStoreFactory,this.pivotColDefSvc=e.pivotColDefSvc}ensureRowHeightsValid(){return!1}start(){this.started=!0,this.updateDatasource()}destroyDatasource(){this.datasource&&(this.datasource.destroy&&this.datasource.destroy(),this.rowRenderer.datasourceChanged(),this.datasource=void 0)}postConstruct(){const e=this.resetRootStore.bind(this);this.addManagedEventListeners({newColumnsLoaded:this.onColumnEverything.bind(this),storeUpdated:this.onStoreUpdated.bind(this),columnValueChanged:e,columnPivotChanged:this.onPivotChanged.bind(this),columnRowGroupChanged:e,columnPivotModeChanged:e}),tq(this,()=>this.onRowHeightStyleChanged()),this.addManagedPropertyListeners(["masterDetail","treeData","removePivotHeaderRowWhenSingleValueColumn","cacheBlockSize"],e),this.addManagedPropertyListeners(["groupAllowUnbalanced","groupTotalRow","grandTotalRow"],()=>this.onStoreUpdated()),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights()),this.verifyProps(),this.addManagedPropertyListener("serverSideDatasource",()=>this.updateDatasource())}updateDatasource(){const e=this.gos.get("serverSideDatasource");e&&this.setDatasource(e)}verifyProps(){rq(this.gos)&&!this.gos.exists("getRowId")&&this.warn(188,{feature:"selection"})}setDatasource(e){this.started&&(this.destroyDatasource(),this.datasource=e,this.resetRootStore())}applyRowData(e,t,s){const i=this.getRootStore();if(!i)return;const r=i.getChildStore(s);r&&r.applyRowData(e,t,e.rowData.length)}isLastRowIndexKnown(){const e=this.getRootStore();return e?e.isLastRowIndexKnown():!1}onColumnEverything(){if(!this.storeParams){this.resetRootStore();return}const e=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),t=this.columnsToValueObjects(this.valueColsSvc?.columns),s=this.columnsToValueObjects(this.pivotColsSvc?.columns),i=c=>{const u={};for(const p of c.oldCols)u[p.id]=p;const d=c.newCols.every(p=>{const g=u[p.id];return g&&delete u[p.id],g&&g.field===p.field&&g.aggFunc===p.aggFunc}),h=!c.allowRemovedColumns&&!!Object.values(u).length;return d&&!h},r=!XY(this.storeParams.sortModel,fC(this.sortSvc)),n=!i({oldCols:this.storeParams.rowGroupCols,newCols:e}),o=!i({oldCols:this.storeParams.pivotCols,newCols:s}),a=!!e?.length&&!i({oldCols:this.storeParams.valueCols,newCols:t,allowRemovedColumns:!0});if(r||n||o||a)this.resetRootStore();else{const c=this.createStoreParams();this.storeParams.rowGroupCols=c.rowGroupCols,this.storeParams.pivotCols=c.pivotCols,this.storeParams.valueCols=c.valueCols}}onPivotChanged(e){if(!this.arePivotColsUnchanged()){this.resetRootStore();return}const t=this.pivotResultCols;if(t?.suppliedColDefs){t.resortPivotResultCols(e.source);return}const s=this.pivotResultFields;this.managingPivotResultColumns&&s&&this.generateSecondaryColumns(s)}arePivotColsUnchanged(){const e=this.storeParams?.pivotCols;if(!e)return!1;const t=this.columnsToValueObjects(this.pivotColsSvc?.columns);return YY(e,t,(s,i)=>s.id===i.id&&s.field===i.field&&s.aggFunc===i.aggFunc)}destroyRootStore(){this.rootNode?.childStore&&(this.rootNode.childStore=this.destroyBean(this.rootNode.childStore),this.nodeManager.clear())}refreshAfterSort(e,t){this.storeParams&&(this.storeParams.sortModel=e);const s=this.getRootStore();s&&(s.refreshAfterSort(t),this.onStoreUpdated())}generateSecondaryColumns(e){if(!this.pivotColDefSvc){this.gos.assertModuleRegistered("SharedPivot",2);return}this.pivotResultFields=e;const t=this.pivotResultCols;if(t?.suppliedColDefs)return;const s=this.pivotColDefSvc.createColDefsFromFields(e);this.managingPivotResultColumns=!0,t?.setPivotResultCols(s,"rowModelUpdated")}onRowHeightStyleChanged(){const{rootNode:e,beans:t}=this;if(!e||t.rowAutoHeight?.active)return;const s=t.environment.getDefaultRowHeight();s!==this.lastDefaultRowHeight&&(this.lastDefaultRowHeight=s,this.resetRowHeights())}resetRowHeights(){if(!this.rootNode)return;const e=this.resetRowHeightsForAllRowNodes(),t=sr(this.beans,this.rootNode);if(this.rootNode.setRowHeight(t.height,t.estimated),this.rootNode.sibling){const s=sr(this.beans,this.rootNode.sibling);this.rootNode.sibling.setRowHeight(s.height,s.estimated)}e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode(t=>{const s=sr(this.beans,t);t.setRowHeight(s.height,s.estimated);const i=t.detailNode;if(i){const r=sr(this.beans,i);i.setRowHeight(r.height,r.estimated)}if(t.sibling){const r=sr(this.beans,t.sibling);i?.setRowHeight(r.height,r.estimated)}e=!0}),e}resetRootStore(){this.destroyRootStore(),this.rootNode=new eq(this.beans),this.rootNode.group=!0,this.rootNode.level=-1,this.beans.selectionSvc?.syncInRowNode(this.rootNode),this.datasource&&(this.storeParams=this.createStoreParams(),this.rootNode.childStore=this.createBean(this.storeFactory.createStore(this.storeParams,this.rootNode)),this.updateRowIndexesAndBounds()),this.managingPivotResultColumns&&(this.pivotResultCols?.setPivotResultCols(null,"api"),this.managingPivotResultColumns=!1,this.pivotResultFields=void 0),this.dispatchModelUpdated(!0)}columnsToValueObjects(e=[]){return e.map(t=>({id:t.getId(),aggFunc:t.aggFunc,displayName:this.colNames.getDisplayNameForColumn(t,"model"),field:t.field}))}createStoreParams(){const e=this.columnsToValueObjects(this.rowGroupColsSvc?.columns),t=this.columnsToValueObjects(this.valueColsSvc?.columns),s=this.columnsToValueObjects(this.pivotColsSvc?.columns),i=iq(this.gos);return{valueCols:t,rowGroupCols:e,pivotCols:s,pivotMode:this.colModel.pivotMode,filterModel:this.filterManager?.isAdvFilterEnabled()?this.filterManager?.getAdvFilterModel():this.filterManager?.getFilterModel()??{},sortModel:fC(this.sortSvc),datasource:this.datasource,lastAccessedSequence:{value:0},dynamicRowHeight:i}}getParams(){return this.storeParams}dispatchModelUpdated(e=!1){this.eventSvc.dispatchEvent({type:"modelUpdated",animate:!e,keepRenderedRows:!e,newPage:!1,newData:!1})}onStoreUpdated(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}onRowHeightChanged(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}updateRowIndexesAndBounds(){const e=this.getRootStore();e&&e.setDisplayIndexes({value:0},{value:0},0)}retryLoads(){const e=this.getRootStore();e&&(e.retryLoads(),this.onStoreUpdated())}getRow(e){const t=this.getRootStore();if(t)return t.getRowUsingDisplayIndex(e)}refreshAfterFilter(e,t){this.storeParams&&(this.storeParams.filterModel=e);const s=this.getRootStore();s&&(s.refreshAfterFilter(t),this.onStoreUpdated())}getRootStore(){return this.rootNode?.childStore}getRowCount(){const e=this.getRootStore();return e?e.getDisplayIndexEnd():0}getTopLevelRowCount(){const e=this.getRootStore();return e?e.getRowCount():1}getTopLevelRowDisplayedIndex(e){const t=this.getRootStore();return t?t.getTopLevelRowDisplayedIndex(e):e}getRowBounds(e){const t=this.getRootStore();return t?t.getRowBounds(e):{rowTop:0,rowHeight:sq(this.beans)}}getBlockStates(){const e=this.getRootStore();if(!e)return;const t={};return e.forEachStoreDeep(s=>{const i=s.getBlockStates();for(const r of Object.keys(i))t[r]=i[r]}),t}getRowIndexAtPixel(e){const t=this.getRootStore();return e<=0||!t?0:t.getRowIndexAtPixel(e)}isEmpty(){return!1}getOverlayType(){return this.getRootStore()?.getDisplayIndexEnd()===0?this.filterManager?.isAnyFilterPresent()?"noMatchingRows":"noRows":null}isRowsToRender(){return this.getRootStore()!=null&&this.getRowCount()>0}getType(){return"serverSide"}forEachNode(e){const t=this.getRootStore();t&&t.forEachNodeDeep(e)}forEachDisplayedNode(e){const t=(s,i)=>{s.stub||!s.displayed||e(s,i)};this.forEachNode(t)}forEachNodeAfterFilterAndSort(e,t=!1){const s=this.getRootStore();s&&s.forEachNodeDeepAfterFilterAndSort(e,void 0,t)}executeOnStore(e,t){if(!this.started)return!1;const s=this.getRootStore();if(!s)return!0;const i=s.getChildStore(e);return i&&t(i),!0}refreshStore(e={}){const t=e.route?e.route:[];this.executeOnStore(t,s=>s.refreshStore(e.purge==!0))}getStoreState(){const e=[],t=this.getRootStore();return t&&t.addStoreStates(e),e}getNodesInRangeForSelection(e,t){const s=e.rowIndex,i=t.rowIndex;if(s===null&&i===null)return[];if(i===null)return e?[e]:[];if(s===null)return[t];const r=[],[n,o]=[s,i].sort((a,l)=>a-l);return this.forEachNode(a=>{const l=a.rowIndex;l==null||a.stub||l>=n&&l<=o&&r.push(a)}),r.length!==o-n+1?null:r}getRowNode(e){if(typeof e!="string"&&(e=String(e)),e===JY)return this.getRootStore()?.getGrandTotalNode();let t;if(this.forEachNode(s=>{s.id===e&&(t=s),s.detailNode?.id===e&&(t=s.detailNode)}),!t&&e===QY)return this.rootNode;if(!t&&e.startsWith(gC)){const s=e.slice(gC.length),i=this.getRowNode(s);t=i?.sibling?.footer?i.sibling:void 0}return t}isRowPresent(e){return!!this.getRowNode(e.id)}setRowCount(e,t){const s=this.getRootStore();s&&s.setRowCount(e,t)}destroy(){this.destroyDatasource(),this.destroyRootStore(),super.destroy()}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}};import{_getServerSideRowModel as Xn}from"ag-grid-community";function oq(e){return e.selectionSvc?.getSelectionState()??null}function aq(e,t){e.selectionSvc?.setSelectionState(t,"api")}function lq(e,t){return e.ssrmTxnManager?.applyTransaction(t)}function cq(e,t){const s=t.startRow??0,i=t.route??[];if(s<0){e.log.warn(189,{startRow:s});return}Xn(e)?.applyRowData(t.successParams,s,i)}function uq(e,t,s){return e.ssrmTxnManager?.applyTransactionAsync(t,s)}function dq(e){Xn(e)?.retryLoads()}function hq(e){return e.ssrmTxnManager?.flushAsyncTransactions()}function pq(e,t){Xn(e)?.refreshStore(t)}function gq(e){return Xn(e)?.getStoreState()??[]}import{_exists as fq}from"ag-stack";import{RowNode as mq,_getRowHeightForNode as vq}from"ag-grid-community";import{BeanStub as Cq}from"ag-grid-community";var Zn=class extends D0{constructor(){super(...arguments),this.name="expand",this.expanded=new Set,this.collapsed=new Set,this.initialState=new Map}setExpandedState({expandedRowGroupIds:e,collapsedRowGroupIds:t}){this.expanded=new Set(e),this.collapsed=new Set(t);for(const s of this.expanded)this.initialState.set(s,!1);for(const s of this.collapsed)this.initialState.set(s,!0)}getExpandedState(){return{expandedRowGroupIds:Array.from(this.expanded),collapsedRowGroupIds:Array.from(this.collapsed)}}setRowExpanded(e,t){const s=e.id,i=this.initialState.get(s)===t;if(t){this.collapsed.delete(s),i||this.expanded.add(s);return}this.expanded.delete(s),i||this.collapsed.add(s)}isRowExpanded(e){const t=e.id;if(this.expanded.has(t))return!0;if(this.collapsed.has(t))return!1;const s=this.initialState.get(t);if(s!=null)return s;const i=this.getInitialRowState(e);return this.initialState.set(t,i),i}getInitialRowState(e){if(!e.isExpandable())return!1;const t=this.gos.getCallback("isServerSideGroupOpenByDefault");if(!t)return!1;const s={data:e.data,rowNode:e};return t(s)}isRowInitialised(e){return this.initialState.has(e)}expandAll(e){this.beans.rowModel.forEachNode(t=>{t.isExpandable()?this.setRowExpanded(t,e):e||this.expanded.delete(t.id)})}};import{BeanStub as Sq}from"ag-grid-community";var mC=class extends L0{constructor(){super(...arguments),this.name="expandAll",this.allExpanded=void 0,this.flipped=new Set}setExpandedState(e){this.allExpanded=e.expandAll,this.flipped=new Set(e.invertedRowGroupIds)}getExpandedState(){return{expandAll:this.allExpanded,invertedRowGroupIds:Array.from(this.flipped)}}setRowExpanded(e,t){const s=e.id;if(t===this.allExpanded){this.flipped.delete(s);return}this.flipped.add(s)}isRowExpanded(e){const t=e.id;return this.allExpanded!==this.flipped.has(t)}isRowInitialised(){return!0}expandAll(e){this.allExpanded=e,this.flipped.clear()}},bq=class extends Mm{constructor(){super(...arguments),this.beanName="expansionSvc"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}setStrategy(e){this.destroyBean(this.strategy),this.strategy=this.createManagedBean(e)}postConstruct(){const e=()=>{this.setStrategy(new Zn)};this.addManagedEventListeners({columnRowGroupChanged:e,columnPivotChanged:e,columnPivotModeChanged:e}),this.addManagedPropertyListener("ssrmExpandAllAffectsAllRows",t=>{t.currentValue||(this.setStrategy(new Zn),this.updateAllNodes(),this.dispatchStateUpdatedEvent())}),e()}setExpansionState(e){const t="expandAll"in e,s=this.isExpandAllStrategy(this.strategy);t!==s&&this.setStrategy(t?new mC:new Zn),this.strategy.setExpandedState(e),this.dispatchStateUpdatedEvent(),this.updateAllNodes()}getExpansionState(){return this.strategy.getExpandedState()}updateAllNodes(){this.serverSideRowModel.forEachNode(e=>{super.setExpanded(e,this.isNodeExpanded(e))})}isExpanded(e){let t=e._expanded;return t===!1||!e.isExpandable()?!1:(t===null&&(t=this.defaultExpanded(e),e._expanded=t),t)}isNodeExpanded(e){return this.strategy.isRowExpanded(e)&&e.isExpandable()}setExpanded(e,t,s,i){const r=e.isExpandable();if(!(!r&&!this.checkExpandable(e,!!e.group))){if(this.strategy.setRowExpanded(e,t),t&&!r){this.dispatchStateUpdatedEvent();return}super.setExpanded(e,t,s),this.dispatchStateUpdatedEvent(),this.updateExpandedState(e)}}resetExpansion(){this.setStrategy(new Zn),this.updateAllNodes(),this.dispatchStateUpdatedEvent()}expandAll(e){const t=this.beans.gos.get("ssrmExpandAllAffectsAllRows");!this.isExpandAllStrategy(this.strategy)&&t&&this.setStrategy(new mC),this.strategy.expandAll(e),this.updateAllNodes(),this.dispatchStateUpdatedEvent(),this.beans.eventSvc.dispatchEvent({type:"expandOrCollapseAll",source:e?"expandAll":"collapseAll"})}isExpandAllStrategy(e){return e.name==="expandAll"}onGroupExpandedOrCollapsed(){}setDetailsExpansionState(e){const{gos:t}=this.beans;if(!t.get("ssrmExpandAllAffectsAllRows"))return;const s=this.getExpansionState();if(s.expandAll===void 0)return;const r=s.expandAll&&s.invertedRowGroupIds.length===0;if((!s.expandAll&&s.invertedRowGroupIds.length===0)!==r)return r?e.expandAll():e.collapseAll()}dispatchExpandedEvent(e){this.eventSvc.dispatchEvent(e),this.beans.rowRenderer.refreshRowByNode(e.node)}updateExpandedState(e){const t=e.childStore;if(e.expanded){if(e.master&&!e.detailNode&&(e.detailNode=this.createDetailNode(e)),!t&&e.hasChildren()){const s=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(s,e))}}else t&&this.gos.get("purgeClosedRowNodes")&&(e.childStore=this.destroyBean(t))}createDetailNode(e){const t=new mq(this.beans);t.detail=!0,t.selectable=!1,t.parent=e,fq(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1;const s=200,i=vq(this.beans,t).height;return t.rowHeight=i||s,t}};import{BaseSelectionService as yq,_getGroupSelectsDescendants as vC,_getRowSelectionMode as CC,_isMultiRowSelection as wq,_isRowSelection as Jn,_isUsingNewRowSelectionAPI as xq}from"ag-grid-community";import{BeanStub as Fq,ROOT_NODE_ID as bc,_isMultiRowSelection as SC,_isUsingNewRowSelectionAPI as Tq}from"ag-grid-community";var yc=class extends k0{constructor(e){super(),this.selectionCtx=e,this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectAllUsed=!1,this.selectedNodes={},this.rootSelected=!1}getSelectedState(){const{selectAll:e,toggledNodes:t}=this.selectedState,s=[...t];return this.rootSelected&&!t.has(bc)&&s.push(bc),{selectAll:e,toggledNodes:s}}setSelectedState(e){if(typeof e!="object"){this.error(116);return}if(!("selectAll"in e)){this.error(116);return}if(typeof e.selectAll!="boolean"){this.error(117);return}if(!("toggledNodes"in e)||!Array.isArray(e.toggledNodes))return this.warn(197);const t={selectAll:e.selectAll,toggledNodes:new Set};let s=!1;e.toggledNodes.forEach(r=>{typeof r!="string"?this.warn(196,{key:r}):r===bc?s=!0:t.toggledNodes.add(r)});const i=t.selectAll||t.toggledNodes.size+(s?1:0)>1;if(Tq(this.gos)&&!SC(this.gos)&&i){this.warn(130);return}this.selectedState=t,this.rootSelected=s}deleteSelectionStateFromParent(e,t){if(this.selectedState.toggledNodes.size===0)return!1;let s=!1;for(const i of t)this.selectedState.toggledNodes.delete(i)&&(s=!0);return s}setNodesSelected(e){const{nodes:t,clearSelection:s,newValue:i,source:r}=e;if(t.length===0)return 0;const n=s&&i;if(!SC(this.gos)||n){if(t.length>1)return this.error(130),0;const c=t[0].primaryRow,u=c.level===-1;if(!u&&c.id===void 0||i&&!c.selectable)return 0;const d=i&&!u;return this.selectedNodes=d?{[c.id]:c}:{},this.selectedState={selectAll:!1,toggledNodes:new Set(d?[c.id]:[])},this.rootSelected=i&&u,1}const o=(c,u)=>{i&&c.selectable?this.selectedNodes[u]=c:delete this.selectedNodes[u],i===this.selectedState.selectAll||!c.selectable?this.selectedState.toggledNodes.delete(u):this.selectedState.toggledNodes.add(u)};let a=0;for(const c of t){const u=c.primaryRow;if(u.level===-1){const d=i&&u.selectable;d!==this.rootSelected&&a++,this.rootSelected=d}else{const d=u.id;if(d===void 0)continue;const h=this.isNodeSelected(u);o(u,d),this.isNodeSelected(u)!==h&&a++}}const l=t.length===1&&r==="api"?t[0].primaryRow:void 0;return l?.id!==void 0&&this.selectionCtx.setRoot(l),a}processNewRow(e){this.selectedNodes[e.id]&&(this.selectedNodes[e.id]=e)}isNodeSelected(e){if(e.level===-1)return this.rootSelected;const{selectAll:t,toggledNodes:s}=this.selectedState,i=s.has(e.id);return t?!i:i}getSelectedNodes(e=!1,t=!0){const{selectedState:{selectAll:s},selectedNodes:i,selectAllUsed:r}=this;if(t&&r&&this.warn(199),e&&s)return null;const n=Object.values(i),o=this.rootSelected?this.beans.rowModel.rootNode:null;return o&&n.push(o),n}getSelectedRows(){return(this.getSelectedNodes()??[]).map(t=>t.data).filter(t=>t!=null)}getSelectionCount(){return this.selectedState.selectAll?-1:this.selectedState.toggledNodes.size+(this.rootSelected?1:0)}isEmpty(){return!this.selectedState.selectAll&&!this.selectedState.toggledNodes?.size&&!this.rootSelected}selectAllRowNodes(){this.reset(!0)}deselectAllRowNodes(){this.reset(!1)}reset(e){this.selectedState={selectAll:e,toggledNodes:new Set},this.selectedNodes={},this.rootSelected=!1,this.selectAllUsed||(this.selectAllUsed=e)}getSelectAllState(){const{selectAll:e,toggledNodes:t}=this.selectedState;return t.size>0?null:e}};import{BeanStub as Aq,ROOT_NODE_ID as Qn,_isMultiRowSelection as Pq}from"ag-grid-community";var eo=class extends _0{constructor(e){super(),this.selectionCtx=e,this.selectedState={selectAllChildren:!1,toggledNodes:new Map},this.rootSelected=!1}wireBeans(e){this.rowModel=e.rowModel,this.rowGroupColsSvc=e.rowGroupColsSvc,this.filterManager=e.filterManager,this.selectionSvc=e.selectionSvc}postConstruct(){this.addManagedEventListeners({modelUpdated:()=>this.removeRedundantState(),columnRowGroupChanged:()=>this.selectionSvc.reset("rowGroupChanged")})}getSelectedState(){const{gos:e,rowGroupColsSvc:t,selectedState:s}=this,i=e.get("treeData"),r=(a,l,c)=>{const u={nodeId:c};if((i||t&&l<=t.columns.length)&&(u.selectAllChildren=a.selectAllChildren),a.toggledNodes.size){const d=[];a.toggledNodes.forEach((h,p)=>{const g=r(h,l+1,p);d.push(g)}),u.toggledNodes=d}return u},n=r(s,0),o=n.toggledNodes;return this.rootSelected&&!o?.some(a=>a.nodeId===Qn)&&(n.toggledNodes=[...o??[],{nodeId:Qn}]),n}setSelectedState(e){if("selectAll"in e){this.error(111);return}const t=(s,i)=>{if(typeof s!="object")throw this.error(243),new Error;if("selectAllChildren"in s&&typeof s.selectAllChildren!="boolean")throw this.error(244),new Error;if("toggledNodes"in s){if(!Array.isArray(s.toggledNodes))throw this.error(245),new Error;if(!s.toggledNodes.every(l=>typeof l=="object"&&"nodeId"in l&&typeof l.nodeId=="string"))throw this.error(246),new Error}const r=s.selectAllChildren??!i,n=s.toggledNodes?.map(a=>[a.nodeId,t(a,r)]);if(n?.some(([,a])=>r===a.selectAllChildren&&a.toggledNodes.size===0))throw this.error(247),new Error;return{selectAllChildren:r,toggledNodes:new Map(n)}};try{const s=e.toggledNodes,i=Array.isArray(s)&&s.some(n=>n?.nodeId===Qn),r=i?{...e,toggledNodes:s.filter(n=>n?.nodeId!==Qn)}:e;this.selectedState=t(r,!!r.selectAllChildren),this.rootSelected=i}catch{}}deleteSelectionStateFromParent(e,t){let s=this.selectedState;const i=[...e];for(;s&&i.length;)s=s.toggledNodes.get(i.pop());if(!s)return!1;let r=!1;for(const n of t)s?.toggledNodes.delete(n)&&(r=!0);return r&&this.removeRedundantState(),r}setNodesSelected({nodes:e,newValue:t,clearSelection:s,source:i}){if(e.length===0)return 0;const r=s&&t;if(!Pq(this.gos)||r){if(e.length>1)return this.error(130),0;const a=e[0].primaryRow;if(a.id===void 0&&a.level!==-1||t&&!a.selectable)return 0;this.deselectAllRowNodes()}let n=0;for(const a of e){const l=a.primaryRow;if(l.level===-1){const c=this.rootSelected;this.selectedState={selectAllChildren:t,toggledNodes:new Map},this.rootSelected=t,t!==c&&n++}else if(l.id!==void 0){const c=this.getRouteToNode(l),u=this.selectedState,d=this.isNodePathSelected(c,u);this.recursivelySelectNode(c,u,t),this.isNodePathSelected(c,u)!==d&&n++}}this.removeRedundantState();const o=e.length===1&&i==="api"?e[0].primaryRow:void 0;return o?.id!==void 0&&this.selectionCtx.setRoot(o),n}isNodeSelected(e){if(e.level===-1)return this.rootSelected;const t=this.getRouteToNode(e);return this.isNodePathSelected(t,this.selectedState)}isNodePathSelected([e,...t],s){if(t.length===0){const i=s.toggledNodes.has(e.id);return e.hasChildren()&&s.toggledNodes.get(e.id)?.toggledNodes.size?void 0:s.selectAllChildren?!i:i}if(s.toggledNodes.has(e.id)){const i=s.toggledNodes.get(e.id);if(i)return this.isNodePathSelected(t,i)}return s.selectAllChildren}getRouteToNode(e){const t=[];let s=e;for(;s.parent;)t.push(s),s=s.parent;return t.reverse()}removeRedundantState(){if(this.filterManager?.isAnyFilterPresent())return;const e=(t=this.selectedState,s,i)=>{if(t.toggledNodes.forEach((o,a)=>{e(o,a,t)}),s){const a=this.rowModel.getRowNode(s)?.childStore;if(a?.isLastRowIndexKnown()&&t.toggledNodes.size>=a.getRowCount()){for(const u of t.toggledNodes.entries()){const[d,h]=u;if(h.toggledNodes.size>0||!this.rowModel.getRowNode(d))return}t.selectAllChildren=!t.selectAllChildren,t.toggledNodes.clear()}}const r=t.toggledNodes.size===0,n=i?.selectAllChildren===t.selectAllChildren;r&&n&&i?.toggledNodes.delete(s)};e()}recursivelySelectNode([e,...t],s,i){if(!e)return;if(!t.length){const a=e.selectable;if(s.selectAllChildren===i||!a){s.toggledNodes.delete(e.id);return}const c={selectAllChildren:i,toggledNodes:new Map};s.toggledNodes.set(e.id,c);return}const n=s.toggledNodes.has(e.id),o=s.toggledNodes.get(e.id)??{selectAllChildren:s.selectAllChildren,toggledNodes:new Map};n||s.toggledNodes.set(e.id,o),this.recursivelySelectNode(t,o,i),s.selectAllChildren===o.selectAllChildren&&o.toggledNodes.size===0&&s.toggledNodes.delete(e.id)}getSelectedNodes(e=!1){if(this.warn(202),this.selectedState.selectAllChildren&&e)return null;const t=[];return this.rowModel.forEachNode(s=>{s.isSelected()&&t.push(s)}),t}processNewRow(){}getSelectedRows(){return(this.getSelectedNodes()??[]).map(t=>t.data).filter(t=>t!=null)}getSelectionCount(){return-1}isEmpty(){return!this.selectedState.selectAllChildren&&!this.selectedState.toggledNodes?.size&&!this.rootSelected}selectAllRowNodes(){this.reset(!0)}deselectAllRowNodes(){this.reset(!1)}reset(e){this.selectedState={selectAllChildren:e,toggledNodes:new Map},this.rootSelected=!1}getSelectAllState(){const{selectAllChildren:e,toggledNodes:t}=this.selectedState;return t.size>0?null:e}},Rq=class extends G0{constructor(){super(...arguments),this.beanName="selectionSvc"}postConstruct(){super.postConstruct(),this.addManagedPropertyListeners(["groupSelectsChildren","rowSelection"],()=>{const s=vC(this.gos),i=s&&this.selectionStrategy instanceof yc?eo:!s&&this.selectionStrategy instanceof eo?yc:void 0;i&&(this.destroyBean(this.selectionStrategy),this.selectionStrategy=this.createManagedBean(new i(this.selectionCtx)),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}),this.addManagedPropertyListeners(["rowSelection"],()=>{const s=CC(this.gos);s!==this.selectionMode&&(this.selectionMode=s,this.deselectAllRowNodes({source:"api"}))}),this.selectionMode=CC(this.gos);const t=vC(this.gos)?eo:yc;this.selectionStrategy=this.createManagedBean(new t(this.selectionCtx))}handleSelectionEvent(e,t,s){if(this.isRowSelectionBlocked(t))return 0;const i=this.inferNodeSelections(t,e.shiftKey,e.metaKey||e.ctrlKey,s);if(i==null)return 0;this.selectionCtx.selectAll=!1;let r;return"select"in i?(i.reset?this.selectionStrategy.deselectAllRowNodes({source:"api"}):this.selectionStrategy.setNodesSelected({nodes:i.deselect,newValue:!1,source:s}),r=this.selectionStrategy.setNodesSelected({nodes:i.select,newValue:!0,source:s})):r=this.selectionStrategy.setNodesSelected({nodes:[i.node],newValue:i.newValue,clearSelection:i.clearSelection,event:e,source:s}),this.shotgunResetNodeSelectionState(s),this.dispatchSelectionChanged(s),r}getSelectionState(){return this.selectionStrategy.getSelectedState()}setSelectionState(e,t){if(!Jn(this.gos)){e&&this.warn(132);return}Array.isArray(e)||(e?(this.selectionStrategy.setSelectedState(e),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged(t)):this.deselectAllRowNodes({source:t}))}setNodesSelected(e){if(!Jn(this.gos)&&e.newValue)return this.warn(132),0;const{nodes:t,...s}=e;if(t.length>1&&this.selectionMode!=="multiRow")return this.warn(130),0;const i={nodes:t.filter(n=>n.selectable),...s};if(!i.nodes.length)return 0;const r=this.selectionStrategy.setNodesSelected(i);return this.shotgunResetNodeSelectionState(i.source),this.dispatchSelectionChanged(i.source),r}deleteSelectionStateFromParent(e,t){this.selectionStrategy.deleteSelectionStateFromParent(e,t)&&(this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}shotgunResetNodeSelectionState(e){this.beans.rowModel.forEachNode(t=>{if(t.stub)return;const s=this.selectionStrategy.isNodeSelected(t);s!==t.isSelected()&&this.selectRowNode(t,s,void 0,e)}),this.syncRootNode(e)}syncRootNode(e){const t=this.beans.rowModel.rootNode;if(!t)return;const s=this.selectionStrategy.isNodeSelected(t);s!==t.isSelected()&&this.selectRowNode(t,s,void 0,e)}getSelectedNodes(){return this.selectionStrategy.getSelectedNodes()??[]}getSelectedRows(){return this.selectionStrategy.getSelectedRows()}getSelectionCount(){return this.selectionStrategy.getSelectionCount()}syncInRowNode(e){this.selectionStrategy.processNewRow(e);const t=this.selectionStrategy.isNodeSelected(e);if(t!=!1&&!e.selectable){this.selectionStrategy.setNodesSelected({nodes:[e],newValue:!1,source:"api"}),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api");return}e.__selected=t}reset(){this.selectionStrategy.deselectAllRowNodes({source:"api"}),this.selectionCtx.reset()}isEmpty(){return this.selectionStrategy.isEmpty()}hasNodesToSelect(){return!0}selectAllRowNodes(e){if(!Jn(this.gos)){this.warn(132);return}if(bC(this.beans.log,e),xq(this.gos)&&!wq(this.gos))return this.warn(130);this.selectionStrategy.selectAllRowNodes(e),this.selectionCtx.selectAll=!0,this.beans.rowModel.forEachNode(t=>{t.stub||this.selectRowNode(t,!0,void 0,e.source)}),this.syncRootNode(e.source),this.dispatchSelectionChanged(e.source)}deselectAllRowNodes(e){bC(this.beans.log,e),this.selectionStrategy.deselectAllRowNodes(e),this.selectionCtx.selectAll=!1,this.beans.rowModel.forEachNode(t=>{t.stub||this.selectRowNode(t,!1,void 0,e.source)}),this.syncRootNode(e.source),this.dispatchSelectionChanged(e.source)}getSelectAllState(e){return this.selectionStrategy.getSelectAllState(e)}getBestCostNodeSelection(){return this.warn(194,{method:"getBestCostNodeSelection"})}updateSelectable(){if(!Jn(this.gos))return;const e=[];this.beans.rowModel.forEachNode(t=>{!this.updateRowSelectable(t,!0)&&t.isSelected()&&e.push(t)}),e.length&&this.setNodesSelected({nodes:e,newValue:!1,source:"selectableChanged"})}dispatchSelectionChanged(e){this.eventSvc.dispatchEvent({type:"selectionChanged",source:e,selectedNodes:this.selectionStrategy instanceof eo?null:this.selectionStrategy.getSelectedNodes(!0,!1),serverSideState:this.getSelectionState()})}updateSelectableAfterGrouping(){return this.error(194,{method:"updateSelectableAfterGrouping"})}refreshMasterNodeState(){}setDetailSelectionState(){}};function bC(e,{selectAll:t}){(t==="filtered"||t==="currentPage")&&e.warn(195,{justCurrentPage:t==="currentPage"})}import{BeanStub as Mq}from"ag-grid-community";var Iq=class extends O0{constructor(){super(...arguments),this.beanName="rowChildrenSvc"}getHasChildrenValue(e){const t=this.gos.get("treeData"),s=this.gos.get("isServerSideGroup");return!e.stub&&!e.footer&&(t?!!s&&s(e.data):!!e.group)}};import{BeanStub as Eq,_addGridCommonParams as Dq,_getGrandTotalRow as Lq,_getMaxConcurrentDatasourceRequests as kq}from"ag-grid-community";var _q=class extends N0{constructor(){super(...arguments),this.beanName="lazyBlockLoadingSvc",this.outboundRequests=0,this.cacheLoadingNodesMap=new Map,this.isCheckQueued=!1,this.nextBlockToLoad=void 0}wireBeans(e){this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}postConstruct(){this.maxOutboundRequests=kq(this.gos)}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,setTimeout(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}onLoadComplete(){this.outboundRequests-=1,this.queueLoadCheck()}hasAvailableLoadBandwidth(){return this.maxOutboundRequests===void 0?!0:this.outboundRequests<this.maxOutboundRequests}queueLoadAction(){const e=this.getBlockToLoad();if(!e)return;const t=this.nextBlockToLoad?.cache===e.cache&&this.nextBlockToLoad.index===e.index;if(!t&&(!this.nextBlockToLoad||!t)){this.nextBlockToLoad=e,window.clearTimeout(this.loaderTimeout);const s=Number(this.nextBlockToLoad.index),i=this.nextBlockToLoad.cache,r=e.index+e.cache.getBlockSize();this.loaderTimeout=window.setTimeout(()=>{i.isAlive()&&(this.loaderTimeout=void 0,this.attemptLoad(i,s,r),this.nextBlockToLoad=void 0)},this.gos.get("blockLoadDebounceMillis"))}}attemptLoad(e,t,s){this.hasAvailableLoadBandwidth()&&(this.executeLoad(e,t,s),this.queueLoadCheck())}executeLoad(e,t,s){const i=e.getSsrmParams(),r=e.store.getParentNode(),n={startRow:t,endRow:s,rowGroupCols:i.rowGroupCols,valueCols:i.valueCols,pivotCols:i.pivotCols,pivotMode:i.pivotMode,groupKeys:r.getRoute()??[],filterModel:i.filterModel,sortModel:i.sortModel},o=this.cacheLoadingNodesMap.get(e),a=()=>{for(let f=0;f<s-t;f++)o.delete(t+f)},l=()=>{for(let f=0;f<s-t;f++)o.add(t+f)},c=f=>{this.onLoadComplete(),e.onLoadSuccess(t,s-t,f),a()},u=()=>{this.onLoadComplete(),e.onLoadFailed(t,s-t),a()},d=r.level===-1,h=d?e.store:void 0,p=d&&h?.grandTotalData===void 0&&!!Lq(this.gos),g=Dq(this.gos,{request:n,success:c,fail:u,parentNode:r,needsGrandTotal:p});l(),this.outboundRequests+=1,e.getSsrmParams().datasource?.getRows(g)}getBlockToLoad(){const e=this.rowRenderer.firstRenderedRow,t=this.rowRenderer.lastRenderedRow;for(let a=e;a<=t;a++){const l=this.rowModel.getRow(a);if(!l)continue;const c=l.parent?.childStore;if(!c)continue;const u=c.getCache(),d=u.getNodes().getBy("node",l);if(!(!d||this.cacheLoadingNodesMap.get(u)?.has(d.index))&&(l.__needsRefreshWhenVisible||l.stub&&!l.failedLoad))return{cache:u,index:u.getBlockStartIndex(d.index)}}let s=null,i=null,r=Number.MAX_SAFE_INTEGER;for(const a of this.cacheLoadingNodesMap.keys())a.getNodesToRefresh().forEach(c=>{if(c.rowIndex==null){i=c,s=a;return}const u=a.getNodes().getBy("node",c);if(!u||this.cacheLoadingNodesMap.get(a)?.has(u.index))return;const h=Math.abs(e-c.rowIndex),p=Math.abs(c.rowIndex-t);h<r&&(i=c,r=h,s=a),p<r&&(i=c,r=p,s=a)});if(!s)return;const n=s,o=n.getNodes().getBy("node",i)?.index;return o==null?void 0:{cache:n,index:n.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};import{BeanStub as Gq}from"ag-grid-community";import{BeanStub as Oq,ServerSideTransactionResultStatus as wc,_getGrandTotalPinnedFloat as Nq,_getGrandTotalRow as yC,_getGroupTotalRowCallback as Bq,_getRowHeightAsNumber as wC,_getRowIdCallback as Vq}from"ag-grid-community";import{BeanStub as Hq,GRAND_TOTAL_ROW_ID as ir,_getRowHeightAsNumber as Uq,_getRowHeightForNode as zq,_getRowIdCallback as Wq}from"ag-grid-community";var $q=class{constructor(...e){this.indexes=e,this.maps=new Map(this.indexes.map(t=>[t,new Map]))}getSize(){return this.maps.get(this.indexes[0]).size}getBy(e,t){return this.maps.get(e).get(t)}set(e){for(const t of this.indexes)this.maps.get(t).set(e[t],e)}delete(e){for(const t of this.indexes)this.maps.get(t).delete(e[t])}clear(){this.maps.forEach(e=>e.clear())}getIterator(e){return this.maps.get(e).values()}forEach(e){const t=this.getIterator(this.indexes[0]);let s;for(;(s=t.next())&&!s.done;)e(s.value)}find(e){const t=this.getIterator(this.indexes[0]);let s;for(;(s=t.next())&&!s.done;)if(e(s.value))return s.value}filter(e){const t=this.getIterator(this.indexes[0]);let s;const i=[];for(;(s=t.next())&&!s.done;)e(s.value)&&i.push(s.value);return i}},Kq=100,xc=class extends B0{constructor(e,t,s,i,r=!1){super(),this.live=!0,this.removedNodeCache=new Map,this.store=e,this.numberOfRows=t,this.isLastRowKnown=s,this.isLastRowInferred=r,this.storeParams=i}wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusSvc=e.focusSvc,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortSvc=e.sortSvc,this.lazyBlockLoadingSvc=e.lazyBlockLoadingSvc,this.colModel=e.colModel}postConstruct(){this.lazyBlockLoadingSvc.subscribe(this),this.nodeMap=new $q("index","id","node"),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set;const{blockUtils:e,gos:t,store:s}=this;this.defaultNodeIdPrefix=e.createNodeIdPrefix(s.getParentNode()),this.getRowIdFunc=Wq(this.beans),this.isMasterDetail=t.get("masterDetail")}destroy(){this.lazyBlockLoadingSvc.unsubscribe(this),this.numberOfRows=0,this.nodeMap.forEach(e=>this.blockUtils.destroyRowNode(e.node)),this.nodeMap.clear(),this.nodeDisplayIndexMap.clear(),this.nodesToRefresh.clear(),this.live=!1,super.destroy()}getRowByDisplayIndex(e){if(!this.store.isDisplayIndexInStore(e))return;const t=this.nodeDisplayIndexMap.get(e);if(t)return(t.stub||t.__needsRefreshWhenVisible)&&this.lazyBlockLoadingSvc.queueLoadCheck(),t;if(this.gos.get("groupHideOpenParents")||this.gos.get("groupAllowUnbalanced")){const l=this.nodeMap.find(c=>!!c.node.childStore?.isDisplayIndexInStore(e));if(l)return l.node.childStore?.getRowUsingDisplayIndex(e)}if(e===this.store.getDisplayIndexStart())return this.createStubNode(0,e);const i=this.nodeDisplayIndexMap.get(e-1);if(i){if(this.isMasterDetail&&i.master&&i.expanded)return i.detailNode;if(i.expanded&&i.childStore?.isDisplayIndexInStore(e))return i.childStore?.getRowUsingDisplayIndex(e);const l=this.nodeMap.getBy("node",i);return this.createStubNode(l.index+1,e)}const r=this.getSurroundingNodesByDisplayIndex(e);if(r==null){const l=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(l,e)}const{previousNode:n,nextNode:o}=r;if(n?.node.expanded&&n.node.childStore?.isDisplayIndexInStore(e))return n.node.childStore?.getRowUsingDisplayIndex(e);if(o){const l=o.node.rowIndex-e,c=o.index-l;return this.createStubNode(c,e)}const a=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(a,e)}createStubNode(e,t){const s=this.store.getRowBounds(t),i=this.createRowAtIndex(e,null,r=>{r.setRowIndex(t),r.setRowTop(s.rowTop),this.nodeDisplayIndexMap.set(t,r)});if(e===0&&this.gos.get("groupHideOpenParents")){const r=this.store.getParentNode().groupData;if(r)for(const n of Object.keys(r))Rp(i,this.colModel,n,r[n])}return this.lazyBlockLoadingSvc.queueLoadCheck(),i}getRowByStoreIndex(e){return this.nodeMap.getBy("index",e)?.node}skipDisplayIndexes(e,t,s){if(e===0)return;const i=Uq(this.beans);t.value+=e,s.value+=e*i}setDisplayIndexes(e,t,s){this.nodeDisplayIndexMap.clear();const i={};this.nodeMap.forEach(o=>{i[o.index]=o.node});let r=-1;for(const o of Object.keys(i)){const a=i[o],l=Number(o),c=l-1-r;this.skipDisplayIndexes(c,e,t);const u=l===0;if(a.firstChild!==u&&(a.firstChild=u,a.dispatchRowEvent("firstChildChanged")),u&&this.gos.get("groupHideOpenParents")){const d=this.store.getParentNode().groupData;if(d)for(const h of Object.keys(d))Rp(a,this.colModel,h,u?d[h]:void 0)}this.blockUtils.setDisplayIndex(a,e,t,s),a.rowIndex!=null&&this.nodeDisplayIndexMap.set(a.rowIndex,a),r=l}const n=this.numberOfRows-1-r;this.skipDisplayIndexes(n,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(e,t){this.numberOfRows=e,this.isLastRowInferred=!1,t!=null&&(this.isLastRowKnown=t,t===!1&&(this.numberOfRows+=1)),this.fireStoreUpdatedEvent()}getNodes(){return this.nodeMap}getNodeCachedByDisplayIndex(e){return this.nodeDisplayIndexMap.get(e)??null}getNodesToRefresh(){return this.nodesToRefresh}getSurroundingNodesByDisplayIndex(e){let t,s;return this.nodeMap.forEach(i=>{if(e>i.node.rowIndex){(s==null||s.node.rowIndex<i.node.rowIndex)&&(s=i);return}(t==null||t.node.rowIndex>i.node.rowIndex)&&(t=i)}),!s&&!t?null:{previousNode:s,nextNode:t}}getDisplayIndexFromStoreIndex(e){const t=this.nodeMap.getBy("index",e);if(t)return t.node.rowIndex;let s,i;if(this.nodeMap.forEach(o=>{if(e>o.index){(i==null||i.index<o.index)&&(i=o);return}(s==null||s.index>o.index)&&(s=o)}),!s)return this.store.getDisplayIndexEnd()-(this.numberOfRows-e);if(!i)return this.store.getDisplayIndexStart()+e;const r=e-i.index;return(i.node.childStore?.getDisplayIndexEnd()??i.node.rowIndex)+r}createRowAtIndex(e,t,s){const i=this.nodeMap.getBy("index",e);if(i){const{node:n}=i;if(n.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,n))return this.blockUtils.updateDataIntoRowNode(n,t),this.nodesToRefresh.delete(n),n;if(this.getRowIdFunc==null&&n.hasChildren()&&n.expanded)return this.nodesToRefresh.delete(n),n;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){const n=this.getRowId(t),o=n&&this.removedNodeCache?.get(n);if(o)return this.removedNodeCache?.delete(n),this.blockUtils.updateDataIntoRowNode(o,t),this.nodeMap.set({id:o.id,node:o,index:e}),this.nodesToRefresh.delete(o),o.__needsRefreshWhenVisible=!1,o;const a=this.nodeMap.getBy("id",n);if(a){this.nodeMap.delete(a);const{node:l,index:c}=a;return this.blockUtils.updateDataIntoRowNode(l,t),this.nodeMap.set({id:l.id,node:l,index:e}),this.nodesToRefresh.delete(l),l.__needsRefreshWhenVisible=!1,this.getBlockStartIndex(c)===this.getBlockStartIndex(e)||this.markBlockForVerify(c),l}}const r=this.blockUtils.createRowNode(this.store.getRowDetails());if(t!=null){const n=this.getPrefixedId(this.store.getIdSequence().value++);this.blockUtils.setDataIntoRowNode(r,t,n,void 0),this.blockUtils.checkOpenByDefault(r),this.nodeManager.addRowNode(r)}return this.nodeMap.set({id:r.id,node:r,index:e}),s&&s(r),r}getBlockStates(){const e={},t={};this.nodeMap.forEach(({node:n,index:o})=>{const a=this.getBlockStartIndex(o);!n.stub&&!n.failedLoad&&(e[a]=(e[a]??0)+1);let l="loaded";n.failedLoad?l="failed":this.lazyBlockLoadingSvc.isRowLoading(this,a)?l="loading":(this.nodesToRefresh.has(n)||n.stub)&&(l="needsLoading"),t[a]||(t[a]=new Set),t[a].add(l)});const s={loading:4,failed:3,needsLoading:2,loaded:1},i=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),r={};for(const n of Object.keys(t)){const a=[...t[n]].sort((u,d)=>(s[u]??0)-(s[d]??0))[0],l=Number(n)/this.getBlockSize(),c=i?`${i}-${l}`:String(l);r[c]={blockNumber:l,startRow:Number(n),endRow:Number(n)+this.getBlockSize(),pageStatus:a,loadedRowCount:e[n]??0}}return r}destroyRowAtIndex(e){const t=this.nodeMap.getBy("index",e);t&&(this.nodeMap.delete(t),this.nodeDisplayIndexMap.delete(t.node.rowIndex),this.nodesToRefresh.size>0?this.removedNodeCache.set(t.node.id,t.node):this.blockUtils.destroyRowNode(t.node),this.nodesToRefresh.delete(t.node))}getSsrmParams(){return this.store.getSsrmParams()}getPrefixedId(e){return this.defaultNodeIdPrefix?this.defaultNodeIdPrefix+"-"+e:e.toString()}markBlockForVerify(e){const[t,s]=this.getBlockBounds(e);this.nodeMap.filter(r=>r.index>=t&&r.index<s).forEach(({node:r})=>{r.__needsRefreshWhenVisible=!0})}doesNodeMatch(e,t){if(t.stub)return!1;const s=this.getRowId(e);return s===null?t.data===e:t.id===s}purgeStubsOutsideOfViewport(){const{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,s=this.getBlockStartIndex(e),[,i]=this.getBlockBounds(t);this.nodeMap.forEach(r=>{this.lazyBlockLoadingSvc.isRowLoading(this,r.index)||r.node.failedLoad||r.node.stub&&(r.index<s||r.index>i)&&this.destroyRowAtIndex(r.index)})}getBlocksDistanceFromRow(e,t){const s={};return e.forEach(({node:i,index:r})=>{const[n,o]=this.getBlockBounds(r);if(n in s)return;const a=Math.abs(i.rowIndex-t);let l;const c=this.nodeMap.getBy("index",[o-1]);c&&(l=Math.abs(c.node.rowIndex-t));const u=l==null||a<l?a:l;s[n]=u}),Object.entries(s)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;const{firstRenderedRow:e,lastRenderedRow:t}=this.rowRenderer,s=new Set,i=new Set;this.nodeMap.forEach(({index:p,node:g})=>{const f=this.getBlockStartIndex(p);s.add(f),g.rowIndex>=e&&g.rowIndex<=t&&i.add(f)});const r=Math.max(i.size,this.storeParams.maxBlocksInCache??0),o=s.size-r;if(o<=0)return;let a=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;i.forEach(p=>{a>p&&(a=p),l<p&&(l=p)});const c=this.nodeMap.filter(({node:p,index:g})=>{const f=this.getBlockStartIndex(g);return!(f>=a&&f<=l)&&!this.isNodeCached(p)});if(c.length===0)return;const u=e+(t-e)/2,d=this.getBlocksDistanceFromRow(c,u),h=this.getBlockSize();d.sort((p,g)=>Math.sign(g[1]-p[1]));for(let p=0;p<Math.min(o,d.length);p++){const g=Number(d[p][0]);for(let f=g;f<g+h;f++){const m=this.nodeMap.getBy("index",f);!m||this.isNodeCached(m.node)||this.destroyRowAtIndex(f)}}}isNodeFocused(e){const t=this.focusSvc.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){const t=e.isExpandable()&&e.expanded,s=this.gos.get("groupAllowUnbalanced")&&e.key==="",i=!!this.beans.editSvc?.isRowEditing(e);return t||this.isNodeFocused(e)||s||i}extractDuplicateIds(e){if(this.getRowIdFunc==null)return[];const t=new Set,s=new Set;return e.forEach(i=>{const r=this.getRowId(i);if(t.has(r)){s.add(r);return}t.add(r)}),[...s]}onLoadSuccess(e,t,s){if(!this.live)return;const i=s.groupLevelInfo;this.store.setStoreInfo(i);const r=this.store.getParentNode().level===-1,n=r&&this.getRowIdFunc!=null?ir:null;if(this.getRowIdFunc!=null){const d=this.extractDuplicateIds(s.rowData);if(d.length>0){const h=d.join(", ");this.warn(205,{duplicateIdText:h}),this.onLoadFailed(e,t);return}}s.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(s.pivotResultFields);const o=this.nodesToRefresh.size>0;let a=0,l;for(let d=0;d<s.rowData.length;d++){const h=s.rowData[d];if(n!=null&&this.getRowId(h)===n){l=h,a++;continue}const p=e+d-a,g=this.nodeMap.getBy("index",p);if(g?.node?.stub){this.createRowAtIndex(p,h);continue}if(g&&this.doesNodeMatch(h,g.node)){this.blockUtils.updateDataIntoRowNode(g.node,h),this.nodesToRefresh.delete(g.node),g.node.__needsRefreshWhenVisible=!1;continue}this.createRowAtIndex(p,h)}r&&(s.grandTotalData!==void 0&&(l=s.grandTotalData),l!==void 0&&this.setGrandTotalData(l));const c=s.rowData.length-a;if(s.rowCount!=null&&s.rowCount!==-1)this.numberOfRows=s.rowCount,this.isLastRowKnown=!0,this.isLastRowInferred=!1;else if(t>c)this.numberOfRows=e+c,this.isLastRowKnown=!0,this.isLastRowInferred=!0;else if(!this.isLastRowKnown){const d=e+c+1;d>this.numberOfRows&&(this.numberOfRows=d)}this.isLastRowKnown&&this.nodeMap.filter(h=>h.index>=this.numberOfRows).forEach(h=>this.destroyRowAtIndex(h.index)),this.gos.get("serverSideEnableClientSideSort")&&this.isStoreFullyLoaded()&&this.clientSideSortRows(),this.fireStoreUpdatedEvent();const u=this.nodesToRefresh.size===0;o&&u&&this.fireRefreshFinishedEvent()}fireRefreshFinishedEvent(){this.nodesToRefresh.size===0&&(this.removedNodeCache.forEach(t=>{this.blockUtils.destroyRowNode(t)}),this.removedNodeCache=new Map,this.store.fireRefreshFinishedEvent())}isStoreFullyLoaded(){const e=this.isLastRowKnown,t=this.nodeMap.getSize()===this.numberOfRows;if(!e||!t||this.nodesToRefresh.size>0)return!1;for(let s=0;s<this.numberOfRows;s++){const i=this.nodeMap.getBy("index",s);if(!i)return!1;const{node:r}=i;if(r.__needsRefreshWhenVisible||r.stub)return!1}return!0}isLastRowIndexKnown(){return this.isLastRowKnown}isLastRowIndexInferred(){return this.isLastRowInferred}onLoadFailed(e,t){if(!this.live)return;const s=this.nodesToRefresh.size>0;for(let r=e;r<e+t&&r<this.getRowCount();r++){let{node:n}=this.nodeMap.getBy("index",r)??{};n&&this.nodesToRefresh.delete(n),n?.stub||(n&&!n.stub&&this.destroyRowAtIndex(r),n=this.createRowAtIndex(r)),n.__needsRefreshWhenVisible=!1,n.failedLoad=!0}const i=this.nodesToRefresh.size===0;s&&i&&this.fireRefreshFinishedEvent(),this.fireStoreUpdatedEvent()}markNodesForRefresh(){this.nodeMap.forEach(e=>{e.node.stub&&!e.node.failedLoad||this.nodesToRefresh.add(e.node)}),this.lazyBlockLoadingSvc.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0?(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent()):this.isLastRowKnown&&this.isLastRowInferred&&(this.isLastRowKnown=!1)}isNodeInCache(e){return!!this.nodeMap.getBy("id",e)}fireStoreUpdatedEvent(){this.live&&this.store.fireStoreUpdatedEvent()}getRowId(e){if(this.getRowIdFunc==null)return null;const{level:t}=this.store.getRowDetails(),s=this.store.getParentNode().getRoute()??[];return this.getRowIdFunc({data:e,parentKeys:s.length>0?s:void 0,level:t})}setGrandTotalData(e){const t=this.store;if(t.grandTotalData=e,!(e==null||!t.getGrandTotalNode()))return this.createOrUpdateGrandTotalNode(e)}createOrUpdateGrandTotalNode(e){const t=this.store.getGrandTotalNode();if(t)return t._updateDataNoSibling(e),t;const s=this.store.getParentNode(),i=dt(s,this.beans,ir);i.group=!1,i.stub=!1,i.data=e;const r=zq(this.beans,i);return i.setRowHeight(r.height,r.estimated),this.nodeManager.addRowNode(i),i}getOrderedNodeMap(){const e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){const e=this.sortSvc?.getSortOptions()??[],t=e.some(o=>o.sort!=null),s=this.rowNodeSorter;if(!t||!s)return;const i=new Array(this.nodeMap.getSize()),r=this.nodeMap;r.forEach(o=>i[o.index]=o.node),r.clear();const n=s.doFullSortInPlace(i,e);for(let o=0,a=n.length;o<a;++o){const l=n[o];r.set({id:l.id,node:l,index:o})}}updateRowNodes(e){const t=[],{blockUtils:s,nodeMap:i}=this;for(const r of e){const n=this.getRowId(r);if(n===ir){const a=this.setGrandTotalData(r);a&&t.push(a);continue}const o=i.getBy("id",n);o&&(s.updateDataIntoRowNode(o.node,r),t.push(o.node))}return t}insertRowNodes(e,t){const s=this.store.getRowCount()-(this.store.getParentNode().sibling?1:0),i=t==null&&this.isLastRowKnown?s:t;if(i==null||s<i)return[];const r={};e.forEach(l=>{const c=this.getRowId(l);if(c===ir){this.setGrandTotalData(l);return}c&&this.isNodeInCache(c)||(r[c]=l)});const n=Object.values(r),o=n.length;if(o===0)return[];const a=this.nodeMap.filter(l=>l.index>=i);return a.forEach(l=>this.nodeMap.delete(l)),a.forEach(l=>{this.nodeMap.set({node:l.node,index:l.index+o,id:l.id})}),this.numberOfRows+=o,n.map((l,c)=>this.createRowAtIndex(i+c,l))}removeRowNodes(e,t){const s=[],i=[],r=new Set(e);r.delete(ir)&&this.setGrandTotalData(null);let n=0;const o=this.getOrderedNodeMap();let a=-1;for(const c of Object.keys(o)){a+=1;const u=o[c];if(r.has(u.id)){r.delete(u.id),this.destroyRowAtIndex(Number(c)),s.push(u.node),n+=1;continue}if(n===0)continue;const d=Number(c);a!==d&&i.push(u.node),this.nodeMap.delete(u),this.nodeMap.set({id:u.id,node:u.node,index:d-n})}return t!=null&&t>=0?(this.numberOfRows=t,this.isLastRowKnown=!0,this.isLastRowInferred=!1):this.numberOfRows-=n,r.size>0&&i.length>0&&(i.forEach(c=>c.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingSvc.queueLoadCheck()),s}getBlockSize(){return this.storeParams.cacheBlockSize||Kq}getBlockStartIndex(e){const t=this.getBlockSize();return e-e%t}getBlockBounds(e){const t=this.getBlockStartIndex(e),s=this.getBlockSize();return[t,t+s]}},jq=class extends V0{constructor(e,t,s){super(),this.idSequence={value:0},this.ssrmParams=e,this.parentRowNode=s,this.storeParams=t,this.level=s.level+1,this.group=e.rowGroupCols?this.level<e.rowGroupCols.length:!1,this.leafGroup=e.rowGroupCols?this.level===e.rowGroupCols.length-1:!1,this.info={}}wireBeans(e){this.blockUtils=e.ssrmBlockUtils,this.storeUtils=e.ssrmStoreUtils,this.selectionSvc=e.selectionSvc,this.rowGroupColsSvc=e.rowGroupColsSvc}postConstruct(){let e=1;if(this.level===0&&(e=this.storeUtils.getServerSideInitialRowCount()??1,this.eventSvc.dispatchEventOnce({type:"rowCountReady"})),this.cache=this.createManagedBean(new xc(this,e,!1,this.storeParams)),!this.gos.get("treeData")&&this.group&&this.rowGroupColsSvc){const s=this.ssrmParams.rowGroupCols[this.level];this.groupField=s.field,this.rowGroupColumn=this.rowGroupColsSvc.columns[this.level]}}destroy(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.grandTotalData=void 0,this.destroyGrandTotalRow(),this.destroyBean(this.cache),super.destroy()}getGrandTotalNode(){if(this.parentRowNode.level===-1){const e=this.parentRowNode.sibling;if(e?.footer)return e}}destroyGrandTotalRow(){const e=this.getGrandTotalNode();e&&(this.parentRowNode.sibling=void 0,this.blockUtils.destroyRowNode(e))}applyRowData(e,t,s){this.cache.onLoadSuccess(t,s,e)}applyTransaction(e){const t=Vq(this.beans);if(!t)return this.warn(206),{status:wc.Cancelled};const s=this.gos.getCallback("isApplyServerSideTransaction");if(s){const u={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!s(u))return{status:wc.Cancelled}}const i=this.cache.isStoreFullyLoaded();let r;e.update?.length&&(r=this.cache.updateRowNodes(e.update));let n;if(e.add?.length){let u=e.addIndex;u!=null&&u<0&&(u=void 0),n=this.cache.insertRowNodes(e.add,u)}let o;if(e.remove?.length){const u=e.remove.map(h=>t({level:this.level,parentKeys:this.parentRowNode.getRoute()??[],data:h})),d=[...new Set(u)];o=this.cache.removeRowNodes(d,e.rowCount)}const a=this.gos.get("serverSideEnableClientSideSort"),l=r?.length||n?.length;return i&&a&&l&&this.cache.clientSideSortRows(),this.updateSelectionAfterTransaction(r,o),{status:wc.Applied,update:r,add:n,remove:o}}updateSelectionAfterTransaction(e,t){if(!this.selectionSvc)return;const s=[];for(const i of e??[])i.isSelected()&&!i.selectable&&s.push(i);for(const i of t??[])i.isSelected()&&s.push(i);s.length&&this.selectionSvc.setNodesSelected({newValue:!1,clearSelection:!1,nodes:s,source:"rowDataChanged"})}clearDisplayIndexes(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.cache.getNodes().forEach(e=>this.blockUtils.clearDisplayIndex(e.node)),this.parentRowNode.sibling&&this.blockUtils.clearDisplayIndex(this.parentRowNode.sibling),this.cache.clearDisplayIndexes()}getDisplayIndexStart(){return this.displayIndexStart}getDisplayIndexEnd(){return this.displayIndexEnd}getRowCount(){const e=this.cache.getRowCount();return this.parentRowNode.sibling?e+1:e}setRowCount(e,t){this.cache.setRowCount(e,t)}isDisplayIndexInStore(e){return this.getRowCount()===0?!1:this.displayIndexStart<=e&&e<this.getDisplayIndexEnd()}getGroupTotalRowPosition(){if(this.parentRowNode.level!==-1&&!(this.cache.isLastRowIndexKnown()&&this.cache.getRowCount()===0))return Bq(this.gos)({node:this.parentRowNode})||void 0}setDisplayIndexes(e,t,s){this.displayIndexStart=e.value,this.topPx=t.value;const i=this.getGroupTotalRowPosition();!i&&this.parentRowNode.level>-1&&Hl(this.parentRowNode),i==="top"&&this.blockUtils.setDisplayIndex(dt(this.parentRowNode,this.beans),e,t,s);let r,n;if(this.parentRowNode.level===-1){const o=yC(this.gos);let a=this.getGrandTotalNode();o&&this.grandTotalData?a||(a=this.cache.createOrUpdateGrandTotalNode(this.grandTotalData)):a&&(this.destroyGrandTotalRow(),a=void 0);const l=Nq(o);this.beans.pinnedRowModel?.setGrandTotalPinned(l),a&&(l?this.blockUtils.clearDisplayIndex(a):o==="top"?r=a:o==="bottom"&&(n=a))}r&&this.blockUtils.setDisplayIndex(r,e,t,s),this.cache.setDisplayIndexes(e,t,s),i==="bottom"&&this.blockUtils.setDisplayIndex(dt(this.parentRowNode,this.beans),e,t,s),n&&this.blockUtils.setDisplayIndex(n,e,t,s),this.displayIndexEnd=e.value,this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t={value:0}){e(this,t.value++),this.cache.getNodes().forEach(s=>{const i=s.node.childStore;i&&i.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t={value:0}){this.cache.getNodes().forEach(s=>{e(s.node,t.value++);const i=s.node.childStore;i&&i.forEachNodeDeep(e,t)})}forEachNodeDeepAfterFilterAndSort(e,t={value:0},s=!1){const i=this.getGroupTotalRowPosition(),r=this.parentRowNode.sibling;i==="top"&&r&&e(r,t.value++);const n=this.parentRowNode.level===-1?yC(this.gos):void 0,o=this.getGrandTotalNode();n==="top"&&o&&e(o,t.value++);const a=this.cache.getOrderedNodeMap();for(const l of Object.values(a)){e(l.node,t.value++);const c=l.node.childStore;c&&c.forEachNodeDeepAfterFilterAndSort(e,t,s)}i==="bottom"&&r&&e(r,t.value++),n==="bottom"&&o&&e(o,t.value++)}retryLoads(){this.cache.getNodes().forEach(({node:e})=>{e.failedLoad&&(e.failedLoad=!1,e.__needsRefreshWhenVisible=!0,e.stub=!0)}),this.forEachChildStoreShallow(e=>e.retryLoads()),this.fireStoreUpdatedEvent()}getRowUsingDisplayIndex(e){return e===this.parentRowNode.sibling?.rowIndex?this.parentRowNode.sibling:this.cache.getRowByDisplayIndex(e)}getRowBounds(e){if(!this.isDisplayIndexInStore(e))return null;const t=this.cache.getNodeCachedByDisplayIndex(e);if(t){const a=this.blockUtils.extractRowBounds(t,e);if(a)return a}const{previousNode:s,nextNode:i}=this.cache.getSurroundingNodesByDisplayIndex(e)??{};if(s){const a=this.blockUtils.extractRowBounds(s.node,e);if(a!=null)return a}const r=wC(this.beans);if(i){const a=(i.node.rowIndex-e)*r;return{rowTop:i.node.rowTop-a,rowHeight:r}}const n=this.topPx+this.heightPx,o=(this.getDisplayIndexEnd()-e)*r;return{rowTop:n-o,rowHeight:r}}isPixelInRange(e){return e>=this.topPx&&e<this.topPx+this.heightPx}getRowIndexAtPixel(e){if(e<this.topPx)return this.getDisplayIndexStart();if(e>=this.topPx+this.heightPx)return this.getDisplayIndexEnd()-1;if(this.parentRowNode.sibling&&e>this.parentRowNode.sibling.rowTop&&e<this.parentRowNode.sibling.rowTop+this.parentRowNode.sibling.rowHeight)return this.parentRowNode.sibling.rowIndex;let t=Number.MAX_SAFE_INTEGER,s=null,i=Number.MAX_SAFE_INTEGER,r=null;if(this.cache.getNodes().forEach(({node:l})=>{const c=Math.abs(e-l.rowTop);if(l.rowTop<e){c<t&&(t=c,s=l);return}c<i&&(i=c,r=l)}),s=s,r=r,s){const l=this.blockUtils.getIndexAtPixel(s,e);if(l!=null)return l}const n=wC(this.beans);if(r){const l=r.rowTop,c=Math.ceil((l-e)/n);return r.rowIndex-c}const o=this.topPx+this.heightPx,a=Math.floor((o-e)/n);return this.getDisplayIndexEnd()-a}getChildStore(e){return this.storeUtils.getChildStore(e,this,t=>{const s=this.cache.getNodes().find(i=>i.node.key==t);return s?s.node:null})}forEachChildStoreShallow(e){this.cache.getNodes().forEach(({node:t})=>{t.childStore&&e(t.childStore)})}refreshAfterSort(e){if(this.storeUtils.isServerSideSortAllLevels()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e)){const s=this.cache.isStoreFullyLoaded(),i=this.gos.get("serverSideEnableClientSideSort");if(!(s&&i)){const n=this.cache.getRowCount(),o=this.cache.isLastRowIndexKnown(),a=this.cache.isLastRowIndexInferred();this.destroyBean(this.cache),this.cache=this.createManagedBean(new xc(this,n,o,this.storeParams,a));return}this.cache.clientSideSortRows()}this.forEachChildStoreShallow(s=>s.refreshAfterSort(e))}refreshAfterFilter(e){if(!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e)){this.refreshStore(!0);return}this.forEachChildStoreShallow(s=>s.refreshAfterFilter(e))}refreshStore(e){if(e){this.grandTotalData=void 0,this.destroyGrandTotalRow(),this.destroyBean(this.cache),this.cache=this.createManagedBean(new xc(this,1,!1,this.storeParams)),this.fireStoreUpdatedEvent();return}this.cache.markNodesForRefresh()}getTopLevelRowDisplayedIndex(e){return this.cache.getDisplayIndexFromStoreIndex(e)??e}isLastRowIndexKnown(){return this.cache.isLastRowIndexKnown()}getRowNodesInRange(e,t){return this.cache.getNodes().filter(({node:s})=>s.rowIndex>=e.rowIndex&&s.rowIndex<=t.rowIndex).map(({node:s})=>s)}addStoreStates(e){e.push({route:this.parentRowNode.getRoute()??[],rowCount:this.getRowCount(),lastRowIndexKnown:this.isLastRowIndexKnown(),info:this.info,maxBlocksInCache:this.storeParams.maxBlocksInCache,cacheBlockSize:this.storeParams.cacheBlockSize}),this.forEachChildStoreShallow(t=>t.addStoreStates(e))}getIdSequence(){return this.idSequence}getParentNode(){return this.parentRowNode}getRowDetails(){return{field:this.groupField,group:this.group,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn}}getSsrmParams(){return this.ssrmParams}setStoreInfo(e){e&&Object.assign(this.info,e)}fireStoreUpdatedEvent(){this.eventSvc.dispatchEvent({type:"storeUpdated"})}fireRefreshFinishedEvent(){this.eventSvc.dispatchEvent({type:"storeRefreshed",route:this.parentRowNode.getRoute()})}getBlockStates(){return this.cache.getBlockStates()}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}getCache(){return this.cache}getFirstNode(){return this.cache.getNodes().getBy("index",0)?.node??null}},Yq=class extends H0{constructor(){super(...arguments),this.beanName="ssrmStoreFactory"}wireBeans(e){this.colModel=e.colModel,this.rowGroupColsSvc=e.rowGroupColsSvc,this.pivotColsSvc=e.pivotColsSvc,this.rowAutoHeight=e.rowAutoHeight}createStore(e,t){const s=this.getStoreParams(e,t);return new jq(e,s,t)}getStoreParams(e,t){const s=this.getLevelSpecificParams(t),i=this.getBlockSize(s),r=this.getMaxBlocksInCache(e,s);return{cacheBlockSize:i,maxBlocksInCache:r}}getMaxBlocksInCache(e,t){const s=t?.maxBlocksInCache!=null?t.maxBlocksInCache:this.gos.get("maxBlocksInCache");if(s!=null&&s>=0){if(e.dynamicRowHeight){this.warn(203);return}if(this.rowAutoHeight?.active){this.warn(204);return}return s}}getBlockSize(e){const t=e?.cacheBlockSize!=null?e.cacheBlockSize:this.gos.get("cacheBlockSize");return t!=null&&t>0?t:100}getLevelSpecificParams(e){const t=this.gos.getCallback("getServerSideGroupLevelParams");if(!t)return;const s={level:e.level+1,parentRowNode:e.level>=0?e:void 0,rowGroupColumns:this.rowGroupColsSvc?.columns??[],pivotColumns:this.pivotColsSvc?.columns??[],pivotMode:this.colModel.pivotMode};return t(s)}};import{BeanStub as qq,_isServerSideRowModel as xC}from"ag-grid-community";var Xq=class extends U0{constructor(){super(...arguments),this.beanName="ssrmStoreUtils"}wireBeans(e){this.colModel=e.colModel,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}getChildStore(e,t,s){if(!e?.length)return t;const i=e[0],r=s(i);if(r){if(e.length===1&&!r.childStore){const a=this.serverSideRowModel.getParams();r.childStore=this.createBean(this.storeFactory.createStore(a,r))}const n=e.slice(1,e.length),o=r.childStore;return o?o.getChildStore(n):null}return null}isServerRefreshNeeded(e,t,s){if(s.valueColChanged||s.secondaryColChanged)return!0;const i=e.level+1;if(!(i<t.length))return!0;const o=t[i].id;return s.changedColumns.indexOf(o)>-1?!0:this.colModel.getCols().filter(u=>u.showRowGroup&&s.changedColumns.includes(u.getId())).map(u=>u.showRowGroup).some(u=>u===!0||u===o)}getServerSideInitialRowCount(){return this.gos.get("serverSideInitialRowCount")}isServerSideSortAllLevels(){return this.gos.get("serverSideSortAllLevels")&&xC(this.gos)}isServerSideOnlyRefreshFilteredGroups(){return this.gos.get("serverSideOnlyRefreshFilteredGroups")&&xC(this.gos)}};import{BeanStub as Zq,ServerSideTransactionResultStatus as Hs}from"ag-grid-community";var Jq=class extends z0{constructor(){super(...arguments),this.beanName="ssrmTxnManager",this.asyncTransactions=[]}wireBeans(e){this.valueCache=e.valueCache,this.serverSideRowModel=e.rowModel,this.selectionSvc=e.selectionSvc}applyTransactionAsync(e,t){this.asyncTransactionsTimeout==null&&this.scheduleExecuteAsync(),this.asyncTransactions.push({transaction:e,callback:t})}scheduleExecuteAsync(){const e=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimeout=window.setTimeout(()=>{this.executeAsyncTransactions()},e)}executeAsyncTransactions(){if(!this.asyncTransactions)return;const e=[],t=[],s=[];let i=!1;for(const r of this.asyncTransactions){let n;if(this.serverSideRowModel.executeOnStore(r.transaction.route,l=>{n=l.applyTransaction(r.transaction)})?n==null&&(n={status:Hs.StoreNotFound}):n={status:Hs.StoreNotStarted},t.push(n),n.status==Hs.StoreLoading){s.push(r);continue}r.callback&&e.push(()=>r.callback(n)),n.status===Hs.Applied&&(i=!0)}e.length>0&&window.setTimeout(()=>{for(const r of e)r()},0),this.asyncTransactionsTimeout=void 0,this.asyncTransactions=s,i&&(this.valueCache?.onDataChanged(),this.eventSvc.dispatchEvent({type:"storeUpdated"})),t.length>0&&this.eventSvc.dispatchEvent({type:"asyncTransactionsFlushed",results:t})}flushAsyncTransactions(){this.asyncTransactionsTimeout!=null&&clearTimeout(this.asyncTransactionsTimeout),this.executeAsyncTransactions()}applyTransaction(e){let t;if(this.serverSideRowModel.executeOnStore(e.route,i=>{t=i.applyTransaction(e)}))if(t){if(this.valueCache?.onDataChanged(),t.remove&&this.selectionSvc){const i=t.remove.map(r=>r.id);this.selectionSvc.deleteSelectionStateFromParent(e.route||[],i)}return this.eventSvc.dispatchEvent({type:"storeUpdated"}),t}else return{status:Hs.StoreNotFound};else return{status:Hs.StoreNotStarted}}},FC={moduleName:"ServerSideRowModel",version:G,rowModels:["serverSide"],beans:[nq,_Y,Xq,DY,jY,Jq,BY,Yq,HY,Rq,_q,Iq,bq,$Y],dependsOn:[$,I9,M9,aC,uC,N9]},TC={moduleName:"ServerSideRowModelApi",version:G,apiFunctions:{getServerSideSelectionState:oq,setServerSideSelectionState:aq,applyServerSideTransaction:lq,applyServerSideTransactionAsync:uq,applyServerSideRowData:cq,retryServerSideLoads:dq,flushServerSideAsyncTransactions:hq,refreshServerSide:pq,getServerSideGroupLevelState:gq,resetRowHeights:L9,onRowHeightChanged:D9},dependsOn:[$,R9,P9,E9]};import{RefPlaceholder as Qq,_isBrowserSafari as eX,_placeCaretAtEnd as tX}from"ag-stack";import{AgAbstractCellEditor as sX,KeyCode as Fc}from"ag-grid-community";import{_getDocument as Tc,_getWindow as AC,_placeCaretAtEnd as iX}from"ag-stack";import{AgContentEditableField as rX,_createElement as nX}from"ag-grid-community";var PC=/\$?[A-Za-z]+\$?[0-9]+(?::\$?[A-Za-z]+\$?[0-9]+)?/g,oX=/^(\$?)([A-Za-z]+)(\$?)([0-9]+)(?::(\$?)([A-Za-z]+)(\$?)([0-9]+))?$/,aX=/[A-Za-z0-9]/,rr=e=>!!e&&aX.test(e),to=e=>!!e&&/[A-Za-z]/.test(e),lX=e=>{if(!to(e[0]))return!1;for(let t=1,s=e.length;t<s;++t)if(!rr(e[t]))return!1;return!0},RC=e=>rr(e??void 0),MC=(e,t,s)=>{const i=t>0?e[t-1]:null;if(RC(i))return!1;if(s.endsWith(":"))return!0;const r=t+s.length,n=r<e.length?e[r]:null;return!RC(n)},Ac=(e,t={})=>{const i=(t.allowTrailingColon??!1)&&e.endsWith(":")?e.slice(0,-1):e,r=oX.exec(i);if(!r)return null;const[,n,o,a,l,c,u,d,h]=r;return{startCol:o,startRow:l,startColAbsolute:n==="$",startRowAbsolute:a==="$",...!!(u&&h)?{endCol:u,endRow:h,endColAbsolute:c==="$",endRowAbsolute:d==="$"}:null}},IC=e=>{const t=[];let s,i=0;for(PC.lastIndex=0;(s=PC.exec(e))!=null;){let r=s[0];const n=s.index??0,o=n+r.length;o<e.length&&e[o]===":"&&(r+=":"),MC(e,n,r)&&(t.push({ref:r,start:n,end:n+r.length,index:i}),i+=1)}return t},cX=".ag-formula-token{line-height:var(--ag-line-height,1.6)}.ag-formula-token-color-1{color:var(--ag-formula-token-1-color)}.ag-formula-token-color-2{color:var(--ag-formula-token-2-color)}.ag-formula-token-color-3{color:var(--ag-formula-token-3-color)}.ag-formula-token-color-4{color:var(--ag-formula-token-4-color)}.ag-formula-token-color-5{color:var(--ag-formula-token-5-color)}.ag-formula-token-color-6{color:var(--ag-formula-token-6-color)}.ag-formula-token-color-7{color:var(--ag-formula-token-7-color)}.ag-formula-range-color-1{--ag-range-selection-border-color:var(--ag-formula-token-1-color);--ag-range-selection-background-color:var(--ag-formula-token-1-background-color)}.ag-formula-range-color-2{--ag-range-selection-border-color:var(--ag-formula-token-2-color);--ag-range-selection-background-color:var(--ag-formula-token-2-background-color)}.ag-formula-range-color-3{--ag-range-selection-border-color:var(--ag-formula-token-3-color);--ag-range-selection-background-color:var(--ag-formula-token-3-background-color)}.ag-formula-range-color-4{--ag-range-selection-border-color:var(--ag-formula-token-4-color);--ag-range-selection-background-color:var(--ag-formula-token-4-background-color)}.ag-formula-range-color-5{--ag-range-selection-border-color:var(--ag-formula-token-5-color);--ag-range-selection-background-color:var(--ag-formula-token-5-background-color)}.ag-formula-range-color-6{--ag-range-selection-border-color:var(--ag-formula-token-6-color);--ag-range-selection-background-color:var(--ag-formula-token-6-background-color)}.ag-formula-range-color-7{--ag-range-selection-border-color:var(--ag-formula-token-7-color);--ag-range-selection-background-color:var(--ag-formula-token-7-background-color)}.ag-fill-handle.ag-formula-range-color-1,.ag-range-handle.ag-formula-range-color-1{background-color:var(--ag-formula-token-1-color)}.ag-fill-handle.ag-formula-range-color-2,.ag-range-handle.ag-formula-range-color-2{background-color:var(--ag-formula-token-2-color)}.ag-fill-handle.ag-formula-range-color-3,.ag-range-handle.ag-formula-range-color-3{background-color:var(--ag-formula-token-3-color)}.ag-fill-handle.ag-formula-range-color-4,.ag-range-handle.ag-formula-range-color-4{background-color:var(--ag-formula-token-4-color)}.ag-fill-handle.ag-formula-range-color-5,.ag-range-handle.ag-formula-range-color-5{background-color:var(--ag-formula-token-5-color)}.ag-fill-handle.ag-formula-range-color-6,.ag-range-handle.ag-formula-range-color-6{background-color:var(--ag-formula-token-6-color)}";import{_getDocument as uX}from"ag-stack";import{BeanStub as dX,KeyCode as At}from"ag-grid-community";var EC=new Set(["=","+","-","*","/","^",",","(",";","<",">","&"]),DC=(e,t)=>{for(let s=t-1;s>=0;s--){const i=e[s];if(i!=null&&i.trim()!=="")return i}return null};import{_getRowNode as LC,isSpecialCol as hX}from"ag-grid-community";var pX="ag-formula-token-color",gX="ag-formula-range-color",Pc=(e,t)=>{const s=t??0;return{tokenClass:`${pX}-${s+1}`,rangeClass:`${gX}-${s+1}`,colorIndex:s}},Rc=e=>{if(!e)return null;const t=/ag-formula-range-color-(\d+)/.exec(e);if(!t)return null;const s=parseInt(t[1],10);return Number.isFinite(s)?s-1:null},fX=(e,t,s)=>{if(!e)return;const{rangeClass:i}=Pc(t,s);e.colorClass=i},kC=(e,t)=>{const s=Ac(t,{allowTrailingColon:!0});if(!s)return null;const{formula:i}=e,{startCol:r,startRow:n,endCol:o,endRow:a}=s,l=r,c=o??r,u=i?.getColByRef(l),d=i?.getColByRef(c);if(!u||!d)return null;const h=parseInt(n,10)-1,p=a?parseInt(a,10)-1:h;if(h<0||p<0)return null;const g=e.rowModel;return!g?.getFormulaRow(h)||!g.getFormulaRow(p)?null:{rowStartIndex:h,rowEndIndex:p,columnStart:u,columnEnd:d}},mX=(e,t)=>{const s=e.rowModel;if(!s)return null;const{rowStartIndex:i,rowEndIndex:r}=t;let n=null;for(let a=i;a<=r;a++){const l=s.getFormulaRow(a)?.rowIndex;if(l!=null){n=l;break}}let o=null;for(let a=r;a>=i;a--){const l=s.getFormulaRow(a)?.rowIndex;if(l!=null){o=l;break}}return n==null||o==null?null:{...t,rowStartIndex:n,rowEndIndex:o}},vX=e=>{const t=e.rangeSvc?.getCellRanges(),s=t?.length?t[t.length-1]:null;return s?$t(e,s):null},$t=(e,t)=>{const{rangeSvc:s,formula:i}=e;if(!s||!i)return null;const r=s.getRangeStartRow(t),n=s.getRangeEndRow(t);if(!r||!n||r.rowPinned||n.rowPinned)return null;const o=LC(e,r),a=LC(e,n),l=o?.formulaRowIndex,c=a?.formulaRowIndex;if(l==null||c==null)return null;const u=Math.min(l,c)+1,d=Math.max(l,c)+1,h=t.columns?.filter(w=>!hX(w)&&!!i.getColRef(w));if(!h?.length)return null;const p=[...h],g=p[0],f=p[p.length-1],m=i.getColRef(g),v=i.getColRef(f);return!m||!v?null:m===v&&u===d?`${m}${u}`:`${m}${u}:${v}${d}`},Us=(e,t)=>{const s=IC(t),{formula:i}=e;if(!i)return s;const r=[];let n=0;for(const o of s)kC(e,o.ref)&&(r.push({...o,index:n}),n+=1);return r},_C=(e,t)=>Us(e,t).map(({ref:i,index:r})=>({ref:i,index:r})),CX=class extends W0{constructor(e){super(),this.field=e,this.functionAutocompleteList=null,this.functionAutocompleteToken=null,this.functionAutocompleteEntries=null,this.functionAutocompleteSearch=null}postConstruct(){this.addManagedElementListeners(this.field.getContentElement(),{keydown:this.onContentKeyDown.bind(this),mouseup:this.updateFunctionAutocomplete.bind(this),focusin:this.updateFunctionAutocomplete.bind(this),focusout:this.closeFunctionAutocomplete.bind(this)}),this.addDestroyFunc(()=>this.closeFunctionAutocomplete())}onPlainValueUpdated(){this.closeFunctionAutocomplete()}onFormulaValueUpdated(){this.updateFunctionAutocomplete()}onContentKeyDown(e){if(this.functionAutocompleteList)switch(e.key){case At.ENTER:case At.TAB:e.preventDefault(),e.stopPropagation(),this.confirmFunctionAutocomplete();return;case At.ESCAPE:e.preventDefault(),e.stopPropagation(),this.closeFunctionAutocomplete();return;case At.UP:case At.DOWN:this.functionAutocompleteList.onNavigationKeyDown(e,e.key);return}switch(e.key){case At.LEFT:case At.RIGHT:case At.PAGE_HOME:case At.PAGE_END:this.scheduleFunctionAutocompleteUpdate();break}}scheduleFunctionAutocompleteUpdate(){setTimeout(()=>{this.isAlive()&&this.updateFunctionAutocomplete()})}updateFunctionAutocomplete(){if(!this.isContentFocused()){this.closeFunctionAutocomplete();return}const{field:e,beans:t}=this,s=e.getCurrentValue();if(!s.trimStart().startsWith("=")){this.closeFunctionAutocomplete();return}const r=e.getCaretOffsetsForAutocomplete(s);if(!r){this.closeFunctionAutocomplete();return}if(bX(t,s,r.valueOffset)){this.closeFunctionAutocomplete();return}const n=SX(s,r.valueOffset,t.formula??null);if(!n){this.closeFunctionAutocomplete();return}const{prefix:o}=n;if(!o.length){this.closeFunctionAutocomplete();return}const a=this.getFunctionAutocompleteEntries();if(!a.length){this.closeFunctionAutocomplete();return}const l=o.toLocaleLowerCase();if(!a.some(({key:u})=>u.toLocaleLowerCase().startsWith(l))){this.closeFunctionAutocomplete();return}this.functionAutocompleteToken=n,this.openFunctionAutocomplete(a),this.functionAutocompleteList&&this.functionAutocompleteSearch!==o&&(this.functionAutocompleteList.setSearch(o),this.functionAutocompleteSearch=o)}getFunctionAutocompleteEntries(){const e=this.beans.formula,t=e?.active?e.getFunctionNames?.()??[]:[];return this.functionAutocompleteEntries?.length!==t.length&&(this.functionAutocompleteEntries=t.map(s=>({key:s}))),this.functionAutocompleteEntries}openFunctionAutocomplete(e){if(this.functionAutocompleteList||!e.length)return;const t=this.beans.popupSvc;if(!t)return;let s=null;const i=()=>{this.functionAutocompleteList&&s&&t.positionPopupByComponent(s)};this.functionAutocompleteList=this.createManagedBean(new ga({autocompleteEntries:e,onConfirmed:()=>this.confirmFunctionAutocomplete(),useStartsWithSearch:!0,autoSizeList:!0,maxVisibleItems:10,onListHeightChanged:i}));const r=this.functionAutocompleteList.getGui();s={ePopup:r,type:"autocomplete",eventSource:this.field.getGui(),position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0};const n=t.addPopup({eChild:r,anchorToElement:this.field.getGui(),positionCallback:i,ariaLabel:"Formula functions"});this.functionAutocompleteHidePopup=n.hideFunc,this.functionAutocompleteList.afterGuiAttached()}closeFunctionAutocomplete(){this.functionAutocompleteToken=null,this.functionAutocompleteSearch=null,this.functionAutocompleteList&&(this.functionAutocompleteHidePopup?.(),this.functionAutocompleteHidePopup=void 0,this.destroyBean(this.functionAutocompleteList),this.functionAutocompleteList=null)}confirmFunctionAutocomplete(){const e=this.functionAutocompleteToken,t=this.functionAutocompleteList?.getSelectedValue();if(!e||!t){this.closeFunctionAutocomplete();return}const{field:s}=this,i=s.getCurrentValue(),r=t.key,n=i.slice(0,e.start)+r+i.slice(e.end),o=e.start+r.length,a=n[o]==="("?n:n.slice(0,o)+"("+n.slice(o);s.getContentElement().focus({preventScroll:!0}),s.applyFormulaValueChange({currentValue:i,nextValue:a,caret:o+1}),this.closeFunctionAutocomplete()}isContentFocused(){return uX(this.beans).activeElement===this.field.getContentElement()}},SX=(e,t,s)=>{if(t<0||t>e.length||yX(e,t))return null;let i=t;for(;i>0&&rr(e[i-1]);)i--;let r=t;for(;r<e.length&&rr(e[r]);)r++;if(i===r)return null;let n=r;if(t!==r){const l=e.slice(t,r),c=Ac(l);c&&(!s||s.getColByRef(c.startCol))&&(n=t)}const o=e.slice(i,n);if(!o||!to(o[0])||e[i-1]==="$")return null;const a=DC(e,i);return a!=null&&!EC.has(a)?null:{start:i,end:n,prefix:e.slice(i,t)}},bX=(e,t,s)=>{for(const i of Us(e,t))if(s>=i.start&&s<=i.end)return!0;return!1},yX=(e,t)=>{let s=!1;for(let i=0;i<t&&i<e.length;i++)if(e[i]==='"'){if(e[i+1]==='"'){i++;continue}s=!s}return s};import{_last as Mc}from"ag-stack";import{BeanStub as wX,isSpecialCol as xX}from"ag-grid-community";var FX=class extends $0{constructor(e){super(),this.field=e,this.rangeSelectionEnabled=!1,this.trackedRangeRefs=new Map,this.trackedRanges=new Map,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.suppressSelectionChangeHandling=!1,this.handleEditorDeactivated=()=>{this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!0)}}postConstruct(){this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this)}),this.addDestroyFunc(()=>this.disableRangeSelectionWhileEditing()),this.addDestroyFunc(()=>this.unregisterActiveEditor())}onValueUpdated(e,t){if(this.skipNextValueUpdate){this.skipNextValueUpdate=!1;return}if(this.isActiveEditor()){if(t){this.enableRangeSelectionWhileEditing()&&(this.skipNextValueUpdate=!0,this.field.setValue(e,!0)),this.syncRangesFromFormula(e);return}this.disableRangeSelectionWhileEditing()}}setEditingCellRef(e,t,s){this.editingColumn=e,this.editingRowIndex=t??void 0,this.editingCellRef=s}setEditorActive(e){if(e){this.registerActiveEditor();return}this.unregisterActiveEditor()}withSelectionChangeHandlingSuppressed(e){const t=this.suppressSelectionChangeHandling;this.suppressSelectionChangeHandling=!0;try{e()}finally{this.suppressSelectionChangeHandling=t}}deactivateForFocusLoss(){this.isActiveEditor()&&(this.handleEditorDeactivated(),this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.unregisterActiveEditor())}registerActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;if(!t||!t.registerActiveEditor(e,this.handleEditorDeactivated))return;this.rangeSelectionEnabled=!1,this.suppressRangeEvents=!1,this.ignoreNextRangeEvent=!1,this.skipNextValueUpdate=!1,this.clearTrackedRanges(!1);const i=this.field.getCurrentValue(),r=i.trimStart().startsWith("=");this.onValueUpdated(i,r)}unregisterActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;t&&t.unregisterActiveEditor(e,this.handleEditorDeactivated)}isActiveEditor(){const e=this.field.getCompId(),{formulaInputManager:t}=this.beans;return!!t&&t.isActiveEditor(e)}getTrackedRefCount(e){return this.trackedRangeRefs.get(e)??0}hasTrackedRef(e){return this.getTrackedRefCount(e)>0}addTrackedRef(e){this.trackedRangeRefs.set(e,this.getTrackedRefCount(e)+1)}removeTrackedRef(e){const t=this.getTrackedRefCount(e)-1;if(t<=0){this.trackedRangeRefs.delete(e);return}this.trackedRangeRefs.set(e,t)}enableRangeSelectionWhileEditing(){return this.rangeSelectionEnabled?!1:(this.rangeSelectionEnabled=!0,this.beans.editSvc?.enableRangeSelectionWhileEditing?.(),!0)}disableRangeSelectionWhileEditing(){!this.rangeSelectionEnabled&&!this.trackedRangeRefs.size||(this.rangeSelectionEnabled=!1,this.beans.editSvc?.disableRangeSelectionWhileEditing?.(),this.clearTrackedRanges(this.isActiveEditor()))}clearTrackedRanges(e=!0){e&&Array.from(this.trackedRangeRefs.keys()).forEach(s=>this.removeRangeForRef(s)),this.trackedRangeRefs.clear(),this.trackedRanges.clear()}getLiveRanges(){return this.beans.rangeSvc?.getCellRanges()??[]}withSuppressedRangeEvents(e){this.suppressRangeEvents=!0,e(),this.suppressRangeEvents=!1}setCellRangesSilently(e){const t=this.beans.rangeSvc;t&&this.withSuppressedRangeEvents(()=>t.setCellRanges(e))}getColorIndexForTokenOrRef(e,t){return this.field.getColorIndexForToken(t??null)??this.field.getColorIndexForRef(e)}normaliseRefForComparison(e){return e?(e.endsWith(":")?e.slice(0,-1):e).replace(/\$/g,"").toUpperCase():null}tagRangeColor(e,t,s){const{rangeClass:i}=Pc(t,s);return e.colorClass===i?!1:(fX(e,t,s),!0)}trackRange(e,t,s){const i=this.trackedRanges.get(e),r=s!==void 0?s:i?.tokenIndex??null;i?i.ref!==t&&(this.removeTrackedRef(i.ref),this.addTrackedRef(t)):this.addTrackedRef(t),this.trackedRanges.set(e,{ref:t,tokenIndex:r})}getUntrackedFormulaRangesByRef(){const e=new Map,t=this.getLiveRanges();for(const s of t){if(this.trackedRanges.has(s)||Rc(s.colorClass)==null)continue;const i=$t(this.beans,s);if(!i||i===this.editingCellRef)continue;const r=e.get(i);r?r.push(s):e.set(i,[s])}return e}syncRangesFromFormula(e){const t=e??this.field.getCurrentValue()??"";if(!this.rangeSelectionEnabled){this.clearTrackedRanges();return}const s=_C(this.beans,t),i=new Map;for(const c of s){const{ref:u,index:d}=c;if(u===this.editingCellRef)continue;const h=i.get(u)??[];h.push(d),i.set(u,h)}for(const c of Array.from(this.trackedRangeRefs.keys()))i.has(c)||this.removeRangeForRef(c);if(!this.beans.rangeSvc)return;const n=new Set(this.getLiveRanges());for(const[c,u]of this.trackedRanges.entries())n.has(c)||(this.trackedRanges.delete(c),this.removeTrackedRef(u.ref));const o=this.getUntrackedFormulaRangesByRef();let a=!1;for(const[c,u]of i.entries()){const d=[];for(const[p,g]of this.trackedRanges.entries())g.ref===c&&d.push(p);const h=o.get(c);for(;d.length<u.length&&h?.length;){const p=h.shift();p&&d.push(p)}for(;d.length>u.length;){const p=d.pop();p&&this.removeTrackedRange(p)}for(;d.length<u.length;){const p=u[d.length],g=this.addRangeForRef(c,!1,p);if(!g)break;d.push(g)}for(let p=0;p<d.length&&p<u.length;p++){const g=d[p],f=u[p];this.trackRange(g,c,f);const m=this.getColorIndexForTokenOrRef(c,f);this.tagRangeColor(g,c,m)&&(a=!0)}}const l=[];for(const c of o.values())c.length&&l.push(...c);if(l.length){const c=this.getLiveRanges(),u=c.filter(d=>!l.includes(d));u.length!==c.length&&(this.setCellRangesSilently(u),a=!0)}a&&this.refreshRangeStyling()}onCellSelectionChanged(e){if(!this.isActiveEditor()||!this.rangeSelectionEnabled||!this.beans.editSvc?.isRangeSelectionEnabledWhileEditing?.())return;if(this.ignoreNextRangeEvent){this.ignoreNextRangeEvent=!1;return}if(this.suppressSelectionChangeHandling)return;const{finished:t,started:s}=e,i=this.getLiveRanges(),r=i.filter(d=>!this.isSpecialOnlyRange(d));if(r.length!==i.length){this.setCellRangesSilently(r),this.refocusEditingCell();return}const n=i.length?Mc(i):null,o=n?$t(this.beans,n):null,a=!!n&&!this.trackedRanges.has(n)&&!!o&&o!==this.editingCellRef,l=t&&(s||a),c=this.ensureTrackedRangeColors();if(this.suppressRangeEvents){c&&this.refreshRangeStyling();return}if((s||a)&&this.field.rememberCaret(),!a&&this.handleRemovedRangeTokens()){this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(this.updateTrackedRangeTokens())return;const u=vX(this.beans);if(!u||u===this.editingCellRef){this.refocusEditingCell();return}if(l){const{action:d,previousRef:h,tokenIndex:p}=this.field.applyRangeInsert(u);if(d==="none"){this.keepLatestSelectionOnly(n),this.beans.editSvc?.stopEditing(void 0,{source:"edit"});return}if(d==="replace"&&h===u){this.discardLatestRangeForRef(u),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}this.tagLatestRangeForRef(u,p),this.handleRangeTokenUpdate(h,u,!0,d==="insert",p),this.syncRangesFromFormula(this.field.getCurrentValue()),this.field.restoreCaretAfterToken(),this.refocusEditingCell();return}if(!s&&!t){const{previousRef:d,tokenIndex:h}=this.field.insertOrReplaceToken(u,!1);this.tagLatestRangeForRef(u,h),this.handleRangeTokenUpdate(d,u,!1,!1),this.refocusEditingCell();return}this.tagLatestRangeForRef(u),t&&(this.field.restoreCaretAfterToken(),this.refocusEditingCell())}keepLatestSelectionOnly(e){!e||this.getLiveRanges().length<=1||this.setCellRangesSilently([e])}isSpecialOnlyRange(e){const t=e.columns;return!!t?.length&&t.every(s=>xX(s))}handleRangeTokenUpdate(e,t,s,i,r){if(s){!i&&e&&e!==t&&this.removeRangeForRef(e,r),this.addRangeForRef(t,!0,r);return}if(i||!e){this.addTrackedRef(t);return}e!==t&&(this.removeTrackedRef(e),this.addTrackedRef(t))}addRangeForRef(e,t,s){const i=this.beans.rangeSvc;if(!i)return;let r;if(t)r=this.findLatestRangeForRef(e,!0)??this.findLatestRangeForRef(e,!1);else{const n=kC(this.beans,e);if(!n)return;const o=mX(this.beans,n);if(!o)return;this.withSuppressedRangeEvents(()=>{r=i.addCellRange(o)})}if(r){const n=this.getColorIndexForTokenOrRef(e,s);this.tagRangeColor(r,e,n),this.trackRange(r,e,s),this.refreshRangeStyling()}return r}findLatestRangeForRef(e,t){const s=this.getLiveRanges();for(let i=s.length-1;i>=0;i--){const r=s[i];if($t(this.beans,r)===e&&!(t&&this.trackedRanges.has(r)))return r}}tagLatestRangeForRef(e,t){const{trackedRanges:s}=this,i=this.getLiveRanges(),r=i.length?Mc(i):null;if(!r)return;const n=s.get(r)?.tokenIndex??null,o=this.getColorIndexForTokenOrRef(e,t??n);this.tagRangeColor(r,e,o),this.refreshRangeStyling()}discardLatestRangeForRef(e){const t=this.getLiveRanges();if(!t.length)return;const s=Mc(t);if($t(this.beans,s)===e){if(this.trackedRanges.has(s)){this.removeTrackedRange(s);return}this.setCellRangesSilently(t.slice(0,-1))}}ensureTrackedRangeColors(){const e=this.getLiveRanges();if(!e.length)return!1;let t=!1;for(const s of e){const i=this.trackedRanges.get(s),r=i?.ref??$t(this.beans,s);if(!r||!this.hasTrackedRef(r))continue;const n=i?.tokenIndex??null,o=this.field.getColorIndexForToken(n),a=Rc(s.colorClass),l=o??(this.field.hasColorForRef(r)?this.field.getColorIndexForRef(r):this.field.moveColorToRef(void 0,r,a??void 0));l!=null&&(this.tagRangeColor(s,r,l)&&(t=!0),this.trackedRanges.has(s)||this.trackRange(s,r,n))}return t}handleRemovedRangeTokens(){if(!this.beans.rangeSvc||this.trackedRanges.size===0)return!1;const e=this.field.getCurrentValue(),t=_C(this.beans,e).filter(({ref:l})=>l!==this.editingCellRef);if(!t.length)return!1;const s=this.getLiveRanges(),i=new Set(s),r=new Map;for(const l of s){const c=$t(this.beans,l);!c||c===this.editingCellRef||r.set(c,(r.get(c)??0)+1)}const n=new Map;for(const l of t){const{ref:c}=l;n.set(c,(n.get(c)??0)+1)}for(const[l,c]of Array.from(n.entries())){const u=r.get(l)??0,d=c-u;d>0?n.set(l,d):n.delete(l)}if(!n.size)return!1;const o=[];for(const[l,c]of Array.from(this.trackedRanges.entries())){if(i.has(l))continue;const{ref:u}=c,d=n.get(u)??0;d<=0||(n.set(u,d-1),o.push({range:l,tracked:c}))}if(!o.length)return!1;o.sort((l,c)=>(c.tracked.tokenIndex??-1)-(l.tracked.tokenIndex??-1));let a=!1;for(const{range:l,tracked:c}of o){const{ref:u,tokenIndex:d}=c;a=this.field.removeTokenRef(u,d??null)||a,this.trackedRanges.delete(l),this.removeTrackedRef(u)}return a&&this.syncRangesFromFormula(this.field.getCurrentValue()),a}refreshRangeStyling(){const{eventSvc:e}=this.beans;e&&(this.ensureTrackedRangeColors(),this.ignoreNextRangeEvent=!0,e.dispatchEvent({type:"cellSelectionChanged",started:!1,finished:!1}))}refocusEditingCell(){const{focusSvc:e}=this.beans,{editingColumn:t,editingRowIndex:s}=this;!e||t==null||s==null||e.setFocusedCell({column:t,rowIndex:s,rowPinned:null,preventScrollOnBrowserFocus:!0})}removeTrackedRange(e){const t=this.trackedRanges.get(e);if(!t)return;const s=this.getLiveRanges(),i=s.filter(r=>r!==e);i.length!==s.length&&this.setCellRangesSilently(i),this.trackedRanges.delete(e),this.removeTrackedRef(t.ref)}removeRangeForRef(e,t){if(!(!e||!this.hasTrackedRef(e))){if(t!=null){let s=!1;for(const[i,r]of Array.from(this.trackedRanges.entries())){const{ref:n,tokenIndex:o}=r;if(!(n!==e||o!==t)){this.removeTrackedRange(i),s=!0;break}}if(!s){for(const[i,r]of Array.from(this.trackedRanges.entries()))if(r.ref===e){this.removeTrackedRange(i);break}}return}for(const[s,i]of Array.from(this.trackedRanges.entries()))i.ref===e&&this.removeTrackedRange(s)}}updateTrackedRangeTokens(){if(!this.beans.rangeSvc)return!1;const e=this.getLiveRanges(),t=this.normaliseRefForComparison(this.editingCellRef);let s=!1;for(const i of e){const r=this.trackedRanges.get(i);if(!r)continue;const{ref:n,tokenIndex:o}=r,a=$t(this.beans,i),l=this.normaliseRefForComparison(n),c=this.normaliseRefForComparison(a);if(!a||!c||c===l||c===t)continue;const{colorClass:u}=i,h=this.field.getColorIndexForToken(o??null)??this.field.moveColorToRef(n,a,Rc(u)??void 0),p=this.field.replaceTokenRef(n,a,h,o);p!=null&&(this.tagRangeColor(i,a,h),this.trackRange(i,a,p??o??null),s=!0)}return s&&this.refreshRangeStyling(),s}},Ic=7,TX={"/":"\xF7","*":"\xD7"},AX={"\xF7":"/","\xD7":"*"},PX=class extends K0{constructor(){super({renderValueToElement:!1,className:"ag-formula-input-field"}),this.currentValue="",this.selectionCaretOffset=null,this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=null,this.focusFromMouseTime=null,this.suppressNextFocusCaretPlacement=!1,this.formulaColorByRef=new Map,this.registerCSS(cX),this.registerCSS(ha)}postConstruct(){super.postConstruct(),this.rangeSyncFeature=this.createManagedBean(new FX(this)),this.autocompleteFeature=this.createManagedBean(new CX(this)),this.addManagedElementListeners(this.getContentElement(),{input:this.onContentInput.bind(this),focus:this.onContentFocus.bind(this),blur:this.onContentBlur.bind(this),mousedown:this.onContentMouseDown.bind(this)})}setValue(e,t){const s=e==null?"":String(e),{isFormula:i,hasFormulaPrefix:r}=this.getFormulaState(s);return i?(this.applyFormulaValue(s,{currentValue:this.getCurrentValue(),silent:t}),this.rangeSyncFeature?.onValueUpdated(s,r),this):(this.applyPlainValue(s,{silent:t,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(s,r),this)}getCurrentValue(){const e=OC(this.getContentElement());return e!==this.currentValue&&this.setEditorValue(e,!0),this.currentValue}setEditingCellRef(e,t){const s=e?this.beans.formula?.getColRef(e):void 0,i=s&&t!=null&&t!==void 0?`${s}${t+1}`:void 0;if(!i){this.rangeSyncFeature?.setEditingCellRef(void 0,void 0,void 0);return}this.rangeSyncFeature?.setEditingCellRef(e,t,i)}rememberCaret(){const e=ps(this.beans,this.getContentElement(),this.getCurrentValue());this.selectionCaretOffset=e??this.currentValue.length}setEditorValue(e,t=!1){return this.currentValue=e,super.setValue(e,t),this}renderFormula(e){LX({beans:this.beans,contentElement:this.getContentElement(),getColorIndexForToken:this.getColorIndexForToken.bind(this),...e})}renderPlainValue(e,t){const s=this.getContentElement(),i=t??ps(this.beans,s,this.currentValue);s.textContent=e??"";const r=i!=null?Math.min(i,e.length):null;Lc(this.beans,s,r)}withSelectionChangeHandlingSuppressed(e){if(!this.rangeSyncFeature){e();return}this.rangeSyncFeature.withSelectionChangeHandlingSuppressed(e)}getColorIndexForRef(e){if(!Ec(this.beans))return null;const t=this.formulaColorByRef.get(e);if(t!=null)return t;const s=this.formulaColorByRef.size%Ic;return this.formulaColorByRef.set(e,s),s}getColorIndexForToken(e){return!Ec(this.beans)||e==null?null:e%Ic}hasColorForRef(e){return this.formulaColorByRef.has(e)}moveColorToRef(e,t,s){const i=e&&this.formulaColorByRef.has(e)?this.getColorIndexForRef(e):s??this.formulaColorByRef.get(t)??this.getColorIndexForRef(t);return e&&e!==t&&this.formulaColorByRef.delete(e),i==null?null:(this.formulaColorByRef.set(t,i),i)}updateFormulaColorsFromValue(e){if(e=e==null?"":String(e),!Ec(this.beans)){this.formulaColorByRef.clear();return}const t=RX(this.beans,e);let s=t.length!==this.formulaColorByRef.size;const i=new Map;t.forEach((r,n)=>{const o=n%Ic;i.set(r,o),this.formulaColorByRef.get(r)!==o&&(s=!0)}),s&&(this.formulaColorByRef.clear(),i.forEach((r,n)=>this.formulaColorByRef.set(n,r)))}onContentInput(){const e=this.getContentElement(),t=this.getCurrentValue(),s=ps(this.beans,e,t),i=OC(e),{isFormula:r,hasFormulaPrefix:n}=this.getFormulaState(i);if(!r){this.applyPlainValue(i,{caret:s,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(i,n);return}this.applyFormulaValue(i,{currentValue:t,caret:s??void 0,dispatch:!0}),this.rangeSyncFeature?.onValueUpdated(i,n)}onContentFocus(){if(this.rangeSyncFeature?.setEditorActive(!0),this.suppressNextFocusCaretPlacement){this.suppressNextFocusCaretPlacement=!1;return}const{focusFromMouseTime:e}=this,t=e!=null;this.focusFromMouseTime=null,!t&&iX(this.beans,this.getContentElement())}onContentBlur(e){this.focusFromMouseTime=null;const t=e.relatedTarget,s=t?.closest(".ag-cell-editor"),i=t?.closest(".ag-cell");!t||this.getGui().contains(t)||!s||!i||this.rangeSyncFeature?.deactivateForFocusLoss()}onContentMouseDown(){this.focusFromMouseTime=Date.now()}insertOrReplaceToken(e,t){const s=this.getTokenInsertOffsets(t);if(!s)return{};const{caretOffset:i,valueOffset:r}=s,n=t||this.lastTokenValueLength==null?0:this.lastTokenValueLength,o=this.getCurrentValue(),a=o.slice(0,r)+e+o.slice(r+n),l=Dc(this.beans,a,r)?.index??null;let c;return this.applyFormulaValueChange({currentValue:o,nextValue:a,caret:i+e.length,updateTracking:()=>{c=this.updateLastTokenTracking(e,i,r)}}),{previousRef:c,tokenIndex:l}}removeTokenRef(e,t){const s=this.getCurrentValue(),i=Us(this.beans,s);let r;if(t!=null&&(r=i.find(l=>l.index===t),r&&r.ref!==e&&(r=void 0)),r||(r=i.find(l=>l.ref===e)),!r)return!1;const n=s.slice(0,r.start)+s.slice(r.end),o=this.selectionCaretOffset??r.start,a=Math.min(o,n.length);return this.applyFormulaValueChange({currentValue:s,nextValue:n,caret:a,updateTracking:()=>{this.lastTokenValueOffset=null,this.lastTokenValueLength=null,this.lastTokenCaretOffset=a,this.lastTokenRef=void 0}}),!0}applyRangeInsert(e){const t=this.getCurrentValue(),s=this.getCaretOffsets(t);if(!s){const{previousRef:l,tokenIndex:c}=this.insertOrReplaceToken(e,!0);return{action:"insert",previousRef:l,tokenIndex:c}}const{valueOffset:i}=s,r=Dc(this.beans,t,i);if(r){const{end:l,ref:c}=r;if(c.endsWith(":")&&i===l){const{previousRef:h,tokenIndex:p}=this.insertOrReplaceToken(e,!0);return{action:"insert",previousRef:h,tokenIndex:p}}const{previousRef:u,tokenIndex:d}=this.replaceTokenAtMatch(r,e);return{action:"replace",previousRef:u,tokenIndex:d}}const n=MX(t,i);if(n){const l=t.slice(0,n.start)+e+t.slice(n.end),c=Dc(this.beans,l,n.start)?.index??null,{previousRef:u}=this.replaceTokenAtMatch(n,e,c);return{action:"replace",previousRef:u,tokenIndex:c}}if(!IX(t,i))return{action:"none"};const{previousRef:o,tokenIndex:a}=this.insertOrReplaceToken(e,!0);return{action:"insert",previousRef:o,tokenIndex:a}}restoreCaretAfterToken(){const t=(this.lastTokenCaretOffset??ps(this.beans,this.getContentElement(),this.getCurrentValue())??this.currentValue.length)+(this.lastTokenValueLength??0);this.selectionCaretOffset=null,this.suppressNextFocusCaretPlacement=!0,setTimeout(()=>{this.isAlive()&&(this.getContentElement().focus({preventScroll:!0}),Tc(this.beans).activeElement===this.getContentElement()&&(this.suppressNextFocusCaretPlacement=!1),Lc(this.beans,this.getContentElement(),t))})}replaceTokenAtMatch(e,t,s){const i=this.getCurrentValue(),r=i.slice(0,e.start)+t+i.slice(e.end);return this.applyFormulaValueChange({currentValue:i,nextValue:r,caret:e.start+t.length,updateTracking:()=>{this.updateLastTokenTracking(t,e.start,e.start)}}),{previousRef:e.ref,tokenIndex:s??e.index}}getValueOffsetFromCaret(e){const t=this.getContentElement();let s=e,i=0;for(const r of Array.from(t.childNodes)){const n=zs(r),o=so(r).length;if(s<=n)return i+(n===o?s:0);s-=n,i+=o}return this.currentValue.length}getTokenInsertOffsets(e){return this.getCaretOffsets(this.getCurrentValue(),{useCachedCaret:!0,useCachedValueOffset:!e})}getCaretOffsetsForAutocomplete(e){return this.getCaretOffsets(e)}getCaretOffsets(e,t={useCachedCaret:!1,useCachedValueOffset:!1}){const{beans:s}=this,{useCachedCaret:i,useCachedValueOffset:r}=t,n=this.getContentElement(),o=i?this.selectionCaretOffset??ps(s,n,e)??this.currentValue.length:ps(s,n,e);if(o==null)return null;const a=r&&this.lastTokenValueOffset!=null?this.lastTokenValueOffset:this.getValueOffsetFromCaret(o);return a==null?null:{caretOffset:o,valueOffset:a}}updateLastTokenTracking(e,t,s){const i=this.lastTokenRef;return this.lastTokenValueOffset=s,this.lastTokenValueLength=e.length,this.lastTokenCaretOffset=t,this.lastTokenRef=e,i}getFormulaState(e){const t=e.trimStart().startsWith("=");return{isFormula:this.beans.formula?.isFormula(e)??t,hasFormulaPrefix:t}}dispatchValueChanged(){this.dispatchLocalEvent({type:"fieldValueChanged"})}applyPlainValue(e,t){this.formulaColorByRef.clear(),this.renderPlainValue(e,t.caret),this.setEditorValue(e,t.silent),t.dispatch&&this.dispatchValueChanged(),this.autocompleteFeature?.onPlainValueUpdated()}applyFormulaValue(e,t){this.updateFormulaColorsFromValue(e),this.renderFormula({value:e,currentValue:t.currentValue??this.getCurrentValue(),caret:t.caret??void 0}),this.setEditorValue(e,t.silent),t.dispatch&&this.dispatchValueChanged(),this.autocompleteFeature?.onFormulaValueUpdated()}applyFormulaValueChange(e){const{currentValue:t,nextValue:s,caret:i}=e;this.updateFormulaColorsFromValue(s),e.updateTracking?.(),this.setEditorValue(s),this.renderFormula({currentValue:t,value:s,caret:i}),this.dispatchValueChanged(),this.autocompleteFeature?.onFormulaValueUpdated()}replaceTokenRef(e,t,s,i){const r=this.getContentElement();let n;if(i!=null&&(n=r.querySelector(`.ag-formula-token[data-formula-token-index="${i}"]`)??void 0,n&&BC(n)!==e&&(n=void 0)),n||(n=Array.from(r.querySelectorAll(".ag-formula-token")).find(d=>BC(d)===e)),!n)return null;const o=GC(r,n),a=GC(r,n,!0);if(o==null||a==null)return null;const l=this.getCurrentValue();s!=null&&this.formulaColorByRef.set(t,s);const c=l.slice(0,a)+t+l.slice(a+e.length),u=kX(n);return this.applyFormulaValueChange({currentValue:l,nextValue:c,caret:o+t.length,updateTracking:()=>{this.updateLastTokenTracking(t,o,a)}}),u??i??null}},Ec=e=>{const{gos:t,rangeSvc:s}=e;return!!s&&!!t.get("cellSelection")},RX=(e,t)=>{const s=[],i=new Set;for(const r of Us(e,t)){const n=r.ref;i.has(n)||(i.add(n),s.push(n))}return s},Dc=(e,t,s)=>{for(const i of Us(e,t))if(s>=i.start&&s<=i.end)return{ref:i.ref,start:i.start,end:i.end,index:i.index};return null},MX=(e,t)=>{for(const s of IC(e))if(t>=s.start&&t<=s.end)return{ref:s.ref,start:s.start,end:s.end,index:s.index};return null},IX=(e,t)=>{const s=DC(e,t);return s==null||EC.has(s)},EX=(e,t,s)=>{const i=[];let r=0;const n=Us(e,t),o=Tc(e);for(const a of n){a.start>r&&i.push(o.createTextNode(VC(t.slice(r,a.start))));const l=s(a.index);i.push(DX(a.ref,l,l!=null,a.index)),r=a.end}return r<t.length&&i.push(o.createTextNode(VC(t.slice(r)))),i.length||i.push(o.createTextNode("")),i},DX=(e,t,s,i)=>{const r={"aria-label":e,"data-formula-ref":e,"data-formula-token-index":i.toString()};let n;if(s&&t!=null){const a=Pc(e,t);n=a.tokenClass,r["data-formula-range-class"]=a.rangeClass}const o=nX({tag:"span",cls:"ag-formula-token",attrs:r,children:e});return n&&o.classList.add(n),o},LX=e=>{const{beans:t,contentElement:s,currentValue:i,value:r,getColorIndexForToken:n,caret:o}=e,a=o??ps(t,s,i),l=r.length;s.textContent="";for(const u of EX(t,r,n))s.append(u);const c=a!=null?Math.min(a,l):null;Lc(t,s,c)},GC=(e,t,s=!1)=>{if(!e.contains(t))return null;let i=0;for(const r of Array.from(e.childNodes)){if(r===t)return i;i+=s?so(r).length:zs(r)}return null},OC=e=>{let t="";return e.childNodes.forEach(s=>{t+=so(s)}),t},so=e=>e.nodeType===Node.TEXT_NODE?HC(e.textContent??""):e.nodeType===Node.ELEMENT_NODE?Array.from(e.childNodes).map(t=>so(t)).join(""):"",zs=e=>e.nodeType===Node.TEXT_NODE?e.textContent?.length??0:e.nodeType===Node.ELEMENT_NODE?Array.from(e.childNodes).reduce((t,s)=>t+zs(s),0):0,NC=(e,t)=>{let s=t;for(let i=0;i<e.childNodes.length;i++){const r=e.childNodes[i],n=zs(r);if(s>n){s-=n;continue}return r.nodeType===Node.TEXT_NODE?{node:r,localOffset:s}:NC(r,s)}return{node:e,localOffset:e.childNodes.length}},Lc=(e,t,s)=>{if(s==null)return;const i=AC(e),r=Tc(e),n=i.getSelection(),o=r.createRange(),{node:a,localOffset:l}=NC(t,s);if(!(!a||!n||!t.isConnected||!a.isConnected)){o.setStart(a,l),o.collapse(!0),n.removeAllRanges();try{n.addRange(o)}catch{}}},ps=(e,t,s)=>{const r=AC(e).getSelection();if(!r||r.rangeCount===0)return s?.length??null;const n=r.getRangeAt(0);if(!t.contains(n.startContainer))return s?.length??null;if(n.startContainer===t){let l=0;for(let c=0;c<n.startOffset;c++)l+=zs(t.childNodes[c]);return l}let o=n.startOffset,a=n.startContainer;for(;a&&a!==t;){let l=a.previousSibling;for(;l;)o+=zs(l),l=l.previousSibling;a=a.parentNode}return o},BC=e=>HC(e.textContent??e.dataset.formulaRef??""),kX=e=>{const t=e.dataset.formulaTokenIndex;if(!t)return null;const s=parseInt(t,10);return Number.isFinite(s)?s:null},VC=e=>e.replace(/[/*]/g,t=>TX[t]??t),HC=e=>e.replace(/[÷×]/g,t=>AX[t]??t),_X=class extends j0{constructor(){super({tag:"div",cls:"ag-cell-edit-wrapper"}),this.eEditor=Qq,this.focusAfterAttached=!1,this.cachedRaw=this,this.seededText=this}initialiseEditor(e){const t=this.createManagedBean(new PX);this.eEditor=t,t.addCss("ag-cell-editor"),this.appendChild(t),this.addManagedElementListeners(t.getContentElement(),{keydown:a=>this.onFormulaInputKeyDown(a,e.onKeyDown)});const{eventKey:s,cellStartedEdit:i}=e;let r,n=!1;i?(this.focusAfterAttached=!0,s===Fc.BACKSPACE||s===Fc.DELETE?r="":s?.length===1?r=s:(r=this.getStartValue(e),n=!0)):(r=this.getStartValue(e),n=!0);const o=r==null?"":String(r);this.eEditor.setEditingCellRef(e.column,e.rowIndex),this.eEditor.setValue(o,!0),this.seededText=n?this.eEditor.getCurrentValue():this}onFormulaInputKeyDown(e,t){const{key:s}=e;if(s!==Fc.TAB||e.defaultPrevented)return;const{focusSvc:i}=this.beans,r=i?.getFocusedCell();this.eEditor.withSelectionChangeHandlingSuppressed(()=>{t?.(e)});const n=i?.getFocusedCell();let o=!1;if(r&&n){const{rowIndex:l,rowPinned:c,column:u}=r,{rowIndex:d,rowPinned:h,column:p}=n;o=l!==d||c!==h||u!==p}const{defaultPrevented:a}=e;(a||o)&&e.preventDefault(),e.stopPropagation()}getStartValue(e){const{value:t}=e;return t?.toString()??t}agSetEditValue(e){this.params.value=e;const t=this.getStartValue(this.params);this.eEditor.setValue(t??"",!0),this.seededText=this.eEditor.getCurrentValue()}isPopup(){return!1}afterGuiAttached(){if(!this.focusAfterAttached)return;const{beans:e,eEditor:t}=this;eX()||this.focusIn(),tX(e,t.getContentElement())}focusIn(){this.eEditor.getContentElement().focus({preventScroll:!0})}getValue(){const e=this.eEditor.getCurrentValue(),{value:t,parseValue:s}=this.params;if(typeof e=="string"&&this.isFormulaText(e))return e;if(e===this.seededText||e==null&&t==null)return t;if(Object.is(this.cachedRaw,e))return this.cachedParsed;const i=s(String(e));return this.cachedRaw=e,this.cachedParsed=i,i}getValidationElement(){return this.eEditor.getContentElement()}getValidationErrors(){const{params:e}=this,t=this.eEditor.getCurrentValue(),s=this.getLocaleTextFunc(),{getValidationErrors:i,validateFormulas:r}=e;let n=null;if((r===!0||!!i)&&typeof t=="string"&&this.isFormulaText(t)){const a=this.beans.formula?.validateExpression(t);a&&(n=[a.getTranslatedMessage(s)])}return i?i({value:this.getValue(),internalErrors:n,cellEditorParams:e}):n}isFormulaText(e){const t=e==null?"":String(e);return this.beans.formula?.isFormula(t)??t.trimStart().startsWith("=")}},GX='.formula-error:after{background-color:var(--ag-invalid-color);content:"";height:12px;position:absolute;top:-6px;width:12px}:where(.ag-ltr) .formula-error:after{right:-6px;transform:rotate(45deg)}:where(.ag-rtl) .formula-error:after{left:-6px;transform:rotate(-45deg)}';function OX(e,t){const s=e.formula;return s?.isEvaluationActive()?t===void 0?s.hasCachedRows()?(s.refreshFormulas(!0),!0):!1:s.refreshRow(t):!1}import{_isExpressionString as NX}from"ag-stack";import{BeanStub as BX,_addGridCommonParams as VX}from"ag-grid-community";var HX=class extends Y0{constructor(){super(...arguments),this.beanName="formulaDataSvc",this.hasSource=!1}postConstruct(){const e=this.gos.get("formulaDataSource");e&&this.setDataSource(e)}hasDataSource(){return this.hasSource}getFormula(e){const t=this.dataSource?.getFormula(e);return NX(t)?t:void 0}setFormula(e){this.dataSource?.setFormula(e)}setDataSource(e){this.dataSource=e,this.hasSource=!0,e.init?.(this.createInitParams())}createInitParams(){return VX(this.gos,{})}destroy(){this.dataSource?.destroy?.(),super.destroy()}};import{BeanStub as UX}from"ag-grid-community";var zX=class extends q0{constructor(){super(...arguments),this.beanName="formulaInputManager",this.activeEditor=null,this.activeEditorDeactivate=null}postConstruct(){this.registerRangeSelectionExtension()}registerActiveEditor(e,t){if(this.activeEditor===e&&this.activeEditorDeactivate===t)return!1;const s=this.activeEditorDeactivate;return s&&s!==t&&s(),this.activeEditor=e,this.activeEditorDeactivate=t,!0}unregisterActiveEditor(e,t){this.activeEditor===e&&this.activeEditorDeactivate===t&&(this.activeEditor=null,this.activeEditorDeactivate=null)}isActiveEditor(e){return this.activeEditor===e}shouldSuppressRangeSelection(e){const t=e;return t?.closest?this.activeEditor!=null?!!t.closest(".ag-cell-editor"):!!t.closest(".ag-formula-input-field"):!1}registerRangeSelectionExtension(){const e=this.beans.rangeSvc;e&&(e.registerRangeSelectionExtension(this),this.addDestroyFunc(()=>e.unregisterRangeSelectionExtension?.(this)))}};import{_isExpressionString as kc,_parseBigIntOrNull as WX}from"ag-stack";import{BeanStub as $X,_convertColumnEventSourceType as KX}from"ag-grid-community";import{_isExpressionString as jX}from"ag-stack";import{_getClientSideRowModel as YX}from"ag-grid-community";function nr(e,t){if(!Number.isFinite(t)||t<0)return null;const s=YX(e);if(s)return s.getFormulaRow(t)??null;const i=e.rowModel.getRow(t);return i&&UC(i)?i:null}function _c(e){return e.formulaRowIndex??e.rowIndex??null}function UC(e){return!e.stub&&!e.failedLoad&&e.data!=null}var zC=[{symbol:"%",fixity:"postfix",precedence:100},{symbol:"-",fixity:"prefix",precedence:90},{symbol:"+",fixity:"prefix",precedence:90},{symbol:"^",fixity:"infix",precedence:80,associativity:"right"},{symbol:"*",fixity:"infix",precedence:70,associativity:"left",isAssociative:!0},{symbol:"/",fixity:"infix",precedence:70,associativity:"left"},{symbol:"+",fixity:"infix",precedence:60,associativity:"left",isAssociative:!0},{symbol:"-",fixity:"infix",precedence:60,associativity:"left"},{symbol:"&",fixity:"infix",precedence:55,associativity:"left",isAssociative:!0},{symbol:"=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<>",fixity:"infix",precedence:50,associativity:"left"},{symbol:">=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<=",fixity:"infix",precedence:50,associativity:"left"},{symbol:">",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<",fixity:"infix",precedence:50,associativity:"left"}],io=new Map;for(const e of zC){const t=io.get(e.symbol)??[];t.push(e),io.set(e.symbol,t)}function Ws(e,t){const s=io.get(e)??[];return t?s.find(i=>i.fixity===t):s[0]}var qX=[...new Set(zC.map(e=>e.symbol))].sort((e,t)=>t.length-e.length),Gc=io,XX={1:["invalidFormulaValidation","Invalid formula."],2:["formulaParseInvalidCellReference","Invalid cell reference: ${variable}."],3:["formulaParseInvalidRangeEndReference","Invalid range end reference."],4:["formulaParseUnterminatedString","Unterminated string."],5:["formulaParseUnexpectedCharacter","Unexpected character: ${variable}."],6:["formulaParseOperatorStackUnderflow","Operator stack underflow."],7:["formulaParseMissingOperand","Missing operand for '${variable}'."],8:["formulaParseInternalUnexpectedFrameDuringReduction","Internal error: unexpected frame during reduction."],9:["formulaParseInternalUnexpectedFrameBeforeOpenParen","Internal error: unexpected frame before '('."],10:["formulaParseMisplacedComma","Misplaced comma."],11:["formulaParseCommaOutsideFunctionCall","Comma outside of a function call."],12:["formulaParseInternalUnexpectedFrameBeforeCloseParen","Internal error: unexpected frame before ')'."],13:["formulaParseMismatchedParentheses","Mismatched parentheses."],14:["formulaParseUnsupportedOperand","Unsupported operand: ${variable}."],15:["formulaParseMismatchedParenthesesOrUnfinishedFunctionCall","Mismatched parentheses or unfinished function call."],16:["formulaParseInvalidExpression","Invalid expression."],17:["formulaParseFormulasMustBeginWithEquals","Formulas must begin with =."],18:["formulaSerializeStringContainsQuote",'String contains a quote (") which the tokenizer does not support.',"#PARSE!"],19:["formulaSerializeCannotProduceAbsoluteColumnLabelFromId","Cannot produce absolute COLUMN label from id '${variable}'."],20:["formulaSerializeCannotProduceAbsoluteRowIndexFromId","Cannot produce absolute ROW index from id '${variable}'."],21:["formulaSerializeCannotProduceRowIndexFromId","Cannot produce ROW index from id '${variable}'."],22:["formulaSerializeCannotMapColumnIdToA1Label","Cannot map column id '${variable}' to A1 label."],23:["formulaSerializeCannotParseAbsoluteRowIndex","Cannot parse absolute row index '${variable}'."],24:["formulaSerializeCannotMapRowIdToA1Index","Cannot map row id '${variable}' to A1 index."],25:["formulaEvalRangeNotAllowedInScalarContext","Range is not allowed in scalar context."],26:["formulaEvalUnknownReferenceToCell","Unknown reference to cell.","#REF!"],27:["formulaEvalUnsupportedOperation","Unsupported operation ${variable}.","#NAME?"],28:["formulaEvalInvalidAbsoluteRow","Invalid absolute row.","#REF!"],29:["formulaEvalUnrecognisedRowId","Unrecognised row id.","#REF!"],30:["formulaEvalInvalidAbsoluteColumn","Invalid absolute column.","#REF!"],31:["formulaEvalUnrecognisedColumnId","Unrecognised column id.","#REF!"],32:["formulaEvalUnrecognisedRowInRange","Unrecognised row in range.","#REF!"],33:["formulaEvalUnrecognisedReferenceToCell","Unrecognised reference to cell.","#REF!"],34:["formulaEvalIncompleteRangeReference","Incomplete range reference.","#REF!"],35:["formulaFunctionExpectedExactlyArguments","${variable}: expected exactly ${variable} arguments."],36:["formulaFunctionExpectedAtMostArguments","${variable}: expected at most ${variable} arguments."],37:["formulaFunctionExpectedAtLeastArguments","${variable}: expected at least ${variable} arguments."],38:["formulaFunctionInvalidCriteriaWildcardsWithComparator","Invalid criteria: wildcards with comparator.","#VALUE!"],39:["formulaFunctionNonNumericArgument","${variable}: non-numeric argument.","#VALUE!"],40:["formulaFunctionDivisionByZero","${variable}: division by zero.","#DIV/0!"],41:["formulaFunctionCannotCombineDatesWithBigInt","${variable}: cannot combine dates with BigInt.","#VALUE!"],42:["formulaFunctionRequiresAtLeastOneNumericValue","${variable}: requires at least one numeric value.","#PARSE!"],43:["formulaFunctionRequiresAtLeastOneValue","${variable}: requires at least one value."],44:["formulaFunctionAllValuesMustBeNumbers","${variable}: all values must be numbers.","#VALUE!"],45:["formulaFunctionArgumentMustBeRange","${variable}: ${variable} argument must be a range.","#VALUE!"],46:["formulaFunctionArgumentMustBeValue","${variable}: ${variable} argument must be a value.","#VALUE!"],47:["formulaFunctionRangesHaveDifferentSizes","${variable}: ranges have different sizes.","#VALUE!"],48:["formulaFunctionValuesMustBeNumeric","${variable}: values must be numeric.","#VALUE!"],49:["formulaFunctionValuesMustBeIntegers","${variable}: values must be integers.","#VALUE!"],50:["formulaFunctionUnsupportedValueType","${variable}: unsupported value type.","#VALUE!"],51:["formulaServiceCircularReference","Circular reference.","#CIRCREF!"],52:["formulaServiceExpectedParsableFormula","Expected parsable formula.","#PARSE!"],53:["formulaServiceInternalSchedulingError","Internal scheduling error."],54:["formulaFunctionDivNonNumericArgument","DIV: non-numeric argument.","#VALUE!"],55:["formulaFunctionDivDivisionByZero","DIV: division by zero.","#DIV/0!"],56:["formulaFunctionSumCannotCombineDatesWithBigInt","SUM: cannot combine dates with BigInt.","#VALUE!"],57:["formulaFunctionSumRequiresAtLeastOneNumericValue","SUM: requires at least one numeric value.","#PARSE!"],58:["formulaFunctionAvgRequiresAtLeastOneValue","AVG: requires at least one value."],59:["formulaFunctionMedianAllValuesMustBeNumbers","MEDIAN: all values must be numbers.","#VALUE!"],60:["formulaFunctionMedianRequiresAtLeastOneValue","MEDIAN: requires at least one value."],61:["formulaFunctionSumifFirstArgumentMustBeRange","SUMIF: first argument must be a range.","#VALUE!"],62:["formulaFunctionSumifSecondArgumentMustBeValue","SUMIF: second argument must be a value (criteria).","#VALUE!"],63:["formulaFunctionSumifThirdArgumentMustBeRange","SUMIF: third argument must be a range (sum_range).","#VALUE!"],64:["formulaFunctionSumifRangesHaveDifferentSizes","SUMIF: ranges have different sizes.","#VALUE!"],65:["formulaFunctionCountifFirstArgumentMustBeRange","COUNTIF: first argument must be a range.","#VALUE!"],66:["formulaFunctionCountifSecondArgumentMustBeValue","COUNTIF: second argument must be a value (criteria).","#VALUE!"],67:["formulaFunctionConcatUnsupportedValueType","CONCAT: unsupported value type.","#VALUE!"],68:["formulaFunctionMinRequiresAtLeastOneValue","MIN: requires at least one value."],69:["formulaFunctionMaxRequiresAtLeastOneValue","MAX: requires at least one value."],70:["formulaFunctionPercentNonNumericArgument","PERCENT: non-numeric argument.","#VALUE!"],71:["formulaFunctionPowerNonNumericArgument","POWER: non-numeric argument.","#VALUE!"]},WC=(e,t)=>{if(!t?.length)return e;let s=e,i=0;for(;i<t.length&&s.indexOf("${variable}")!==-1;)s=s.replace("${variable}",t[i++]);return s},$C=e=>{if(e?.length)return e.map(t=>String(t))},KC=e=>XX[e],ZX=(e,t)=>{const[,s]=KC(e);return WC(s,$C(t))},JX=(e,t)=>WC(e,$C(t)),QX=e=>{if(e?.length)return e.map(t=>String(t))},B=class extends Error{constructor(e,t,s){const i=typeof e=="string",r=!i&&Array.isArray(t)?QX(t):void 0,n=i?e:ZX(e,r);if(super(n),this.name="FormulaError",i)this.type=typeof t=="string"?t:"#ERROR!",this.errorId=null,this.localeKey=null,this.defaultMessage=e,this.variableValues=void 0;else{const[o,a,l]=KC(e);this.type=s??l??"#ERROR!",this.errorId=e,this.localeKey=o,this.defaultMessage=a,this.variableValues=r}}getTranslatedMessage(e){return this.localeKey?JX(e(this.localeKey,this.defaultMessage,this.variableValues),this.variableValues):this.message}},ce=class extends B{constructor(e,t,s,i){super(e,i,"#PARSE!"),this.errorStart=t,this.errorEnd=s}};function jC(e,t){if(e.type!=="operation")return null;if(!t(e.operation))return e.operation;for(const s of e.operands){const i=jC(s,t);if(i)return i}return null}var eZ=(e,t,s)=>{const i=t.trim();if(i.startsWith('"')&&i.endsWith('"')&&i.length>=2)return i.slice(1,-1);if(i.toLowerCase()==="true")return!0;if(i.toLowerCase()==="false")return!1;if(i.toLowerCase()==="null")return null;const r=Number(i);if(!isNaN(r))return r;if(i.startsWith("[")&&i.endsWith("]")&&i.length>2){const o=i.slice(1,-1),a=e.colModel.getCol(o)??null;if(!s&&!a)throw new ce(2,0,i.length,[i]);return{column:{id:a?.colId??o,absolute:!1},row:{id:"",absolute:!1,current:!0}}}const n=Ac(i);if(n){const{startCol:o,startRow:a,startColAbsolute:l,startRowAbsolute:c,endCol:u,endRow:d,endColAbsolute:h,endRowAbsolute:p}=n,g=(m,v,C,S,w)=>{const b=m||w?v.toUpperCase():e.formula?.getColByRef(v)?.colId,y=C||w?S:nr(e,Number(S)-1)?.id;if(b==null||y==null)throw new ce(2,0,0,[i]);return{column:{id:b,absolute:m},row:{id:y,absolute:C}}},f=g(l,o,c,a,s);if(u&&d){const m=g(h??!1,u,p??!1,d,s);f.endColumn=m.column,f.endRow=m.row}return f}};function tZ(e){const t=[];let s=0;const i=(r,n)=>{let o=n;const a=()=>r[o]==="$"?(o++,!0):!1,l=()=>{const h=o;for(;o<r.length&&/[A-Za-z]/.test(r[o]);)o++;return o>h},c=()=>{const h=o;for(;o<r.length&&/[0-9]/.test(r[o]);)o++;return o>h},u=()=>{const h=o;return a(),!l()||(a(),!c())?(o=h,!1):!0};if(!u())return 0;if(r[o]===":"){const h=o;if(o++,!u())throw new ce(3,h,o)}const d=r.slice(n,o);return MC(r,n,d)?o-n:0};for(;s<e.length;){const r=e[s];if(/\s/.test(r)){s++;continue}if(r==='"'){let o=s+1;for(;o<e.length&&e[o]!=='"';)o++;if(o>=e.length)throw new ce(4,s,e.length);t.push(e.slice(s,o+1)),s=o+1;continue}if(/[0-9]/.test(r)||r==="."&&/[0-9]/.test(e[s+1])){let o=s+1;for(;o<e.length&&/[0-9.]/.test(e[o]);)o++;t.push(e.slice(s,o)),s=o;continue}if(r==="["){const o=e.indexOf("]",s+1);if(o<0)throw new ce(5,s,s+1,[r]);t.push(e.slice(s,o+1)),s=o+1;continue}if(r==="$"||to(r)){const o=i(e,s);if(o>0){t.push(e.slice(s,s+o)),s+=o;continue}let a=s+1;for(;a<e.length&&rr(e[a]);)a++;t.push(e.slice(s,a)),s=a;continue}if(r==="("||r===")"||r===","){t.push(r),s++;continue}const n=qX.find(o=>e.startsWith(o,s));if(!n)throw new ce(5,s,s+1,[r]);t.push(n),s+=n.length}return t}function sZ(e,t){return e.fixity!=="infix"||t.fixity!=="infix"?!0:e.associativity==="right"&&e.precedence===t.precedence?!1:e.precedence>=t.precedence}function iZ(e,t){const s=Gc.get(e);if(!s)return null;const i=t!==void 0&&Gc.has(t);return t!==void 0&&!i&&!(t==="("||t===",")&&t!=="("||t===")"?s.find(o=>o.fixity==="postfix")??s.find(o=>o.fixity==="infix")??null:s.find(o=>o.fixity==="prefix")??s.find(o=>o.fixity==="infix")??null}function rZ(e,t,s){const i=tZ(t),r=[],n=[],o=()=>{const l=n.pop();if(!l)throw new ce(6,0,0);if(l.kind==="op"){const c=l.def;if(c.fixity!=="infix"){const h=r.pop();if(!h)throw new ce(7,0,0,[c.symbol]);if(c.symbol==="+"&&c.fixity==="prefix"){r.push(h);return}if(c.fixity==="postfix"&&c.symbol==="%"){r.push({type:"operation",operation:c.symbol,operands:[h]});return}c.symbol==="-"&&c.fixity==="prefix"?r.push({type:"operation",operation:"-",operands:[{type:"operand",value:0},h]}):r.push({type:"operation",operation:c.symbol,operands:[h]});return}const u=r.pop(),d=r.pop();if(!d||!u)throw new ce(7,0,0,[c.symbol]);r.push({type:"operation",operation:c.symbol,operands:[d,u]});return}throw new ce(8,0,0)};let a=0;for(;a<i.length;){const l=i[a];if(to(l[0])&&i[a+1]==="("){const d=l;n.push({kind:"function",name:d,args:[]}),n.push({kind:"parenthesis",outLen:r.length}),a+=2;continue}if(l==="("){n.push({kind:"parenthesis",outLen:r.length}),a++;continue}if(l===","){const d=i[a-1];if(d==null||d==="("||d===",")throw new ce(10,a,a+1);for(;;){const g=n[n.length-1];if(!g||g.kind==="parenthesis")break;if(g.kind==="op")o();else throw new ce(9,a,a+1)}const h=n[n.length-1];if(h?.kind!=="parenthesis")throw new ce(10,a,a+1);const p=n[n.length-2];if(p?.kind!=="function")throw new ce(11,a,a+1);r.length>h.outLen&&p.args.push(r.pop()),a++;continue}if(l===")"){if(i[a-1]===",")throw new ce(10,a,a+1);for(;;){const p=n[n.length-1];if(!p||p.kind==="parenthesis")break;if(p.kind==="op")o();else throw new ce(12,a,a+1)}const d=n[n.length-1];if(d?.kind!=="parenthesis")throw new ce(13,a,a+1);const h=d.outLen;if(n.pop(),n[n.length-1]?.kind==="function"){const p=n.pop();r.length>h&&p.args.push(r.pop()),r.push({type:"operation",operation:p.name,operands:p.args})}a++;continue}const c=Gc.has(l)?iZ(l,i[a-1]):null;if(c){for(;;){const d=n[n.length-1];if(d?.kind!=="op")break;if(sZ(d.def,c))o();else break}n.push({kind:"op",def:c}),a++;continue}const u=eZ(e,l,s);if(u===void 0)throw new ce(14,0,l.length,[l]);r.push({type:"operand",value:u}),a++}for(;n.length;)if(n[n.length-1].kind==="op")o();else throw new ce(15,0,0);if(r.length!==1)throw new ce(16,0,0);return r[0]}var ro=(e,t,s=!1)=>{if(!jX(t))throw new ce(17,0,1);const i=t.slice(1).trim();return JC(rZ(e,i,s))};function Oc(e,t){return e.type==="operation"&&e.operation.toUpperCase()===t.toUpperCase()}function YC(e,t=!1){return!e||e.type!=="operand"?t:!!e.value}function qC(e){if(e?.type!=="operand")return null;const t=e.value;return typeof t=="string"?t:typeof t=="number"||typeof t=="boolean"?String(t):null}function XC(e){if(!Oc(e,"COLUMN"))return null;const t=qC(e.operands[0]);if(t==null)return null;const s=YC(e.operands[1],!1);return{id:t,absolute:s}}function ZC(e){if(!Oc(e,"ROW"))return null;const t=qC(e.operands[0]);if(t==null)return null;const s=YC(e.operands[1],!1);return{id:t,absolute:s}}function nZ(e){if(!Oc(e,"REF"))return null;const t=e.operands;if(t.length!==2&&t.length!==4)return null;const s=XC(t[0]),i=ZC(t[1]);if(!s||!i)return null;const r={column:s,row:i};if(t.length===4){const n=XC(t[2]),o=ZC(t[3]);if(!n||!o)return null;r.endColumn=n,r.endRow=o}return{type:"operand",value:r}}function JC(e){if(e.type==="operation"){const t=e.operands.map(JC),s={type:"operation",operation:e.operation,operands:t};return nZ(s)??s}return e}var Nc=e=>e.type==="operation";function QC(e,t){const s=e.colModel.colsById[t];return s?e.formula?.getColRef(s)??null:null}function oZ(e,t){return e.formula?.getColByRef?.(t)?.colId??null}function aZ(e,t,s){const i=e.colsById[s];if(!i)return null;const r=t.indexOf(i);return r>=0?r:null}function lZ(e,t){return e[t]?.colId??null}function Bc(e,t){const s=e.rowModel?.getRowNode?.(t),i=s?_c(s):null;return i!=null?i+1:null}function eS(e,t){return nr(e,t-1)?.id??null}var cZ=/^[A-Za-z]+$/;function Vc(e){if(e.includes('"'))throw new B(18);return'"'+e+'"'}function uZ(e,t){const s=t.id,i=cZ.test(s);if(t.absolute){if(i)return s.toUpperCase();const r=QC(e,s);if(r)return r.toUpperCase();throw new B(19,[s])}if(i){const r=oZ(e,s);if(r)return r}return s}function dZ(e,t){const{id:s,absolute:i}=t;if(i){if(eS(e,Number(s))==null)throw new B(20,[s])}else if(Bc(e,s)==null)throw new B(21,[s]);return s}function hZ(e,t){const s=t.id;if(t.absolute)return s;const i=QC(e,s);if(i)return i.toUpperCase();throw new B(22,[s])}function pZ(e,t){const s=t.id;if(t.absolute){const r=Number(s);if(Number.isFinite(r)&&r>=1)return r;throw new B(23,[s])}const i=Bc(e,s);if(i!=null)return i;throw new B(24,[s])}function no(e,t,s,i){const r=i?t.id:s?hZ(e,t):pZ(e,t);return t.absolute?"$"+r:""+r}function gZ(e,t,s,i){if(i&&t.row.current&&!t.endColumn&&!t.endRow)return`[${t.column.id}]`;const r=no(e,t.column,!0,s)+no(e,t.row,!1,s),{endColumn:n,endRow:o}=t;return n&&o?r+":"+no(e,n,!0,s)+no(e,o,!1,s):r}function tS(e,t){return"COLUMN("+Vc(uZ(e,t))+(t.absolute?",true)":")")}function sS(e,t){return"ROW("+Vc(dZ(e,t))+(t.absolute?",true)":")")}function fZ(e,t,s){if(s&&t.row.current&&!t.endColumn&&!t.endRow)return`[${t.column.id}]`;const i="REF("+tS(e,t.column)+","+sS(e,t.row),{endColumn:r,endRow:n}=t;return r&&n?i+","+tS(e,r)+","+sS(e,n)+")":i+")"}function iS(e){if(e.operation!=="-"||e.operands.length!==2)return null;const[t,s]=e.operands;return t.type==="operand"&&t.value===0?s:null}function rS(e,t,s){if(!Nc(t)||iS(t))return!1;const i=Ws(t.operation,"infix");if(!i)return!1;const r=e.precedence,n=i.precedence;return n<r?!0:n>r?!1:e.associativity==="right"?s==="left"&&i.symbol===e.symbol:e.isAssociative?!1:s==="right"}function mZ(e){if(!Nc(e))return!1;const t=Ws(e.operation,"infix");return!!t&&t.symbol!=="^"}function nS(e,t,s,i,r=!1){function n(o){if(o.type==="operand"){const d=o.value;return typeof d=="string"?Vc(d):typeof d=="number"?""+d:typeof d=="boolean"?d?"TRUE":"FALSE":d==null?"NULL":s?fZ(e,d,r):gZ(e,d,i,r)}const a=o.operands,l=a.length;if(l===2&&o.operation==="-"){const d=iS(o);if(d){const h=n(d);return mZ(d)?"-("+h+")":"-"+h}}const c=o.operation.toUpperCase();if(l===1){const d=a[0],h=Ws(c,"postfix");if(h)return n(d)+h.symbol;const p=Ws(c,"prefix");if(p){const g=n(d);return Nc(d)&&Ws(d.operation,"infix")?p.symbol+"("+g+")":p.symbol+g}return c+"("+n(d)+")"}if(l===2){const d=Ws(c,"infix");if(d){const h=a[0],p=a[1],g=rS(d,h,"left")?"("+n(h)+")":n(h),f=rS(d,p,"right")?"("+n(p)+")":n(p);return g+d.symbol+f}}let u="";for(let d=0;d<l;d++)u+=(d===0?"":",")+n(a[d]);return c+"("+u+")"}return"="+n(t)}var oo=class{constructor(e,t,s,i,r,n){this.rowNode=e,this.column=t,this.formulaString=s,this.fromDataSource=i,this.beans=r,this.service=n,this._valueVersion=-1,this.errorType=null,this._value=void 0,this.astStale=!0,this.ast=null,this.errorId=null,this.errorMessage="",this.errorVariableValues=null,this.baseDataType=void 0}setComputedValue(e){this._value=e,this._valueVersion=this.service.valueCacheVersion,this.errorType=null,this.errorId=null,this.errorMessage="",this.errorVariableValues=null}setErrorFields(e,t,s,i){this.errorType=e,this.errorId=t,this.errorMessage=t==null?s:"",this.errorVariableValues=i,this._valueVersion=this.service.valueCacheVersion}isValueReady(){return this._valueVersion===this.service.valueCacheVersion}getValue(){return this.errorType??this._value}getAst(){if(!this.astStale)return this.ast;const e=ro(this.beans,this.formulaString)??null;return this.ast=e,this.astStale=!1,e}};function oS(e,t,s){let i=e.get(t);if(i?.has(s))throw new B(51);i||(i=new Set,e.set(t,i)),i.add(s)}function Hc(e,t,s){const i=e.get(t);i&&(i.delete(s),i.size===0&&e.delete(t))}function aS(e){return!!(e.endColumn&&e.endRow)}function Uc(e,t,s){const{row:i,column:r}=t;if(i.current&&!s?.row)throw new B(29);const n=i.current?s.row:i.absolute?nr(e,Number(i.id)-1):e.rowModel.getRowNode(i.id),o=r.absolute?e.formula.getColByRef(r.id):e.colModel.colsById[r.id];return!n||!i.current&&!UC(n)||!o?null:{row:n,column:o}}function lS(e,t,s,i){if(t.type==="operand"){const a=t.value;if(typeof a!="object"||a==null)return a;if(aS(a))throw new B(25);const l=Uc(e,a,i);if(!l)throw new B(26);return s.resolveAddrRef(l)}const r=e.formula?.getFunction(t.operation);if(!r)throw new B(27,[t.operation]);const{args:n,values:o}=SZ(e,t.operands,s,i);return r({row:i.row,column:i.column,args:n,values:o})}function cS(e,t,s,i){if(t.type==="operand"){const n=t.value;if(typeof n!="object"||n==null)return{kind:"value",value:n};if(aS(n))return yZ(e,n,s,i);const o=Uc(e,n,i);if(!o)throw new B(26);return{kind:"value",value:s.resolveAddrRef(o)}}return{kind:"value",value:lS(e,t,s,i)}}var vZ=class{constructor(e,t,s,i){this.beans=e,this.operandNodes=t,this.resolver=s,this.caller=i,this.i=0,this.res={done:!1,value:void 0}}next(){return this.i>=this.operandNodes.length?(this.res.done=!0,this.res.value=void 0,this.res):(this.res.done=!1,this.res.value=cS(this.beans,this.operandNodes[this.i++],this.resolver,this.caller),this.res)}[Symbol.iterator](){return this}},CZ=class{constructor(e,t,s,i){this.beans=e,this.operandNodes=t,this.resolver=s,this.caller=i,this.i=0,this.inner=null,this.res={done:!1,value:void 0}}next(){for(;;){if(this.inner){const t=this.inner.next();if(!t.done)return this.res.done=!1,this.res.value=t.value,this.res;this.inner=null;continue}if(this.i>=this.operandNodes.length)return this.res.done=!0,this.res.value=void 0,this.res;const e=cS(this.beans,this.operandNodes[this.i++],this.resolver,this.caller);if(e.kind==="value")return this.res.done=!1,this.res.value=e.value,this.res;this.inner=e[Symbol.iterator]()}}[Symbol.iterator](){return this}};function SZ(e,t,s,i){return{args:{[Symbol.iterator](){return new vZ(e,t,s,i)}},values:{[Symbol.iterator](){return new CZ(e,t,s,i)}}}}function ao(e,t,s){if(t.current){const n=s?.row?_c(s.row):null;if(n==null)throw new B(29);return n}if(t.absolute){const n=Number(t.id)-1;if(!Number.isFinite(n)||n<0)throw new B(28);return n}const i=e.rowModel?.getRowNode?.(t.id),r=i?_c(i):null;if(r==null)throw new B(29);return r}function lo(e,t){if(t.absolute){const i=e.formula?.getColByRef(t.id);if(!i)throw new B(30);return i}const s=e.colModel.colsById[t.id];if(!s)throw new B(31);return s}var bZ=class{constructor(e,t,s,i,r,n){this.beans=e,this.rowStartIndex=t,this.rowEndIndex=s,this.colStart=i,this.colEnd=r,this.resolver=n,this.cols=null,this.currentRowIndex=this.rowStartIndex,this.currentColIdx=-1,this.colStartIdx=-1,this.colEndIdx=-1,this.res={done:!1,value:void 0}}initColsOnce(){if(this.cols)return;this.cols=this.beans.colModel.colsList;const e=uS(this.beans,this.colStart,this.colEnd);if(!e){this.colStartIdx=-1,this.colEndIdx=-1;return}[this.colStartIdx,this.colEndIdx]=e,this.currentColIdx=this.colStartIdx}next(){if(!this.cols&&(this.initColsOnce(),this.colStartIdx<0))return this.res.done=!0,this.res;if(this.currentRowIndex<=this.rowEndIndex){const e=nr(this.beans,this.currentRowIndex);if(!e)throw new B(32);const t=this.cols[this.currentColIdx];return this.currentColIdx<this.colEndIdx?this.currentColIdx++:(this.currentColIdx=this.colStartIdx,this.currentRowIndex++),this.res.value=this.resolver.resolveAddrRef({row:e,column:t}),this.res}return this.res.done=!0,this.res.value=void 0,this.res}};function yZ(e,t,s,i){const r=ao(e,t.row,i),n=t.endRow?ao(e,t.endRow,i):r,o=Math.min(r,n),a=Math.max(r,n),l=lo(e,t.column),c=t.endColumn?lo(e,t.endColumn):l;return{kind:"range",rowStart:o,rowEnd:a,colStart:l,colEnd:c,[Symbol.iterator](){return new bZ(e,o,a,l,c,s)}}}function uS(e,t,s){const i=e.colModel.colsList;let r=null,n=null;for(let l=0;l<i.length&&(r===null||n===null);l++){const c=i[l];if(c===s&&(n=l),c===t&&(r=l),n!==null&&r!==null)break}if(r===null||n===null)return null;const o=Math.min(r,n),a=Math.max(r,n);return[o,a]}function*wZ(e,t,s,i,r){const n=e.colModel.colsList,o=uS(e,i,r);if(o==null)return;const[a,l]=o;for(let c=t;c<=s;c++){const u=nr(e,c);if(u)for(let d=a;d<=l;d++)yield{row:u,column:n[d]}}}function*xZ(e,t,s,i){const r=[t];for(;r.length;){const n=r.pop();if(n.type==="operand"){const o=n.value;if(typeof o!="object"||o==null)continue;if(!o.endColumn&&!o.endRow){const p=Uc(e,o,i);if(!p)throw new B(33);const g=s.ensureCellFormula(p.row,p.column);if(!g||g.isValueReady())continue;yield p;continue}if(!o.endColumn||!o.endRow)throw new B(34);const a=ao(e,o.row,i),l=ao(e,o.endRow,i),c=Math.min(a,l),u=Math.max(a,l),d=lo(e,o.column),h=lo(e,o.endColumn);for(const p of wZ(e,c,u,d,h)){const g=s.ensureCellFormula(p.row,p.column);!g||g.isValueReady()||(yield p)}continue}for(let o=0;o<n.operands.length;o++)r.push(n.operands[o])}}import{_isFiniteNumber as FZ}from"ag-grid-community";function ze(e,t,s){const i=e[Symbol.iterator](),r=new Array(s);for(let n=0;n<s;n++){const o=i.next();if(o.done)throw new B(35,[t,s]);r[n]=o.value}if(!i.next().done)throw new B(35,[t,s]);return r}function $s(e){return{*[Symbol.iterator](){for(const t of e)t!=null&&t!==""&&(yield t)}}}function dS(e,t,s,i){const r=[];for(const n of e)if(r.push(n),r.length>i)throw new B(36,[t,i]);if(r.length<s)throw new B(37,[t,s]);return r}var zc=e=>e.kind==="range",hS=e=>e.kind==="value",TZ=["<=",">=","<>","<",">","="];function AZ(e){for(const t of TZ)if(e.startsWith(t))return t;return null}function Wc(e){if(FZ(e))return e;if(e instanceof Date)return+e;if(typeof e=="string"){const t=Number(e);if(!Number.isNaN(t))return t}return null}function pS(e){if(e==null)return"";switch(typeof e){case"string":return e;case"number":return String(e);case"boolean":return e?"TRUE":"FALSE"}return e instanceof Date?String(+e):String(e)}function PZ(e){let t="^";for(let s=0;s<e.length;s++){const i=e[s];if(i==="~"&&s+1<e.length&&(e[s+1]==="*"||e[s+1]==="?")){t+="\\"+e[++s];continue}if(i==="*"){t+=".*";continue}if(i==="?"){t+=".";continue}/[-/\\^$*+?.()|[\]{}]/.test(i)?t+="\\"+i:t+=i}return t+="$",new RegExp(t,"i")}var RZ=(e,t,s)=>{let i=Wc(t),r=Wc(s);switch((i==null||r==null)&&(i=t,r=pS(s).toUpperCase()),e){case"<":return r<i;case">":return r>i;case"<=":return r<=i;case">=":return r>=i;case"=":return r===i;case"<>":return r!==i}return!1},MZ=(e,t,s)=>{const i=pS(s),r=t.test(i);return e==="="?r:!r},IZ=e=>e==null||e==="";function gS(e){if(typeof e=="number")return o=>Wc(o)===e;if(typeof e!="string")return o=>e===o;const t=e.trim();if(t==="")return IZ;const s=AZ(t),i=s?t.substring(s.length):t;if(!/[*?]/.test(i))return RZ.bind(null,s??"=",i.toUpperCase());if(s&&s!=="="&&s!=="<>")throw new B(38);const n=PZ(i);return MZ.bind(null,s??"=",n)}var fS=(e,t,s)=>{if(!s||t===0||s.absolute)return;const{visibleCols:i,colModel:r}=e,n=i.allCols,o=aZ(r,n,s.id);if(o==null)return;const a=o+t;if(a<0)return;const l=lZ(n,a);l&&(s.id=l)},mS=(e,t,s,i)=>{if(!s||t===0||s.absolute)return;if(i){const a=Number(s.id);if(!Number.isFinite(a))return;s.id=String(a+t);return}const r=Bc(e,s.id);if(r==null)return;const n=r+t;if(n<1)return;const o=eS(e,n);o&&(s.id=o)},EZ=e=>!!e&&typeof e=="object"&&e!==null&&"row"in e&&"column"in e,vS=(e,t,s,i,r)=>{if(t.type==="operand"){const{value:n}=t;if(!EZ(n))return;const{row:o,column:a,endRow:l,endColumn:c}=n;mS(e,s,o,r),fS(e,i,a),mS(e,s,l,r),fS(e,i,c);return}if(t.type==="operation")for(const n of t.operands)vS(e,n,s,i,r)},DZ=({values:e})=>{let t=0;for(const s of e)s!=null&&s!==""&&!isNaN(s)&&t++;return t},LZ=({values:e})=>{let t=0;for(const s of e)s!=null&&s!==""&&t++;return t},kZ=({values:e})=>{let t=0;for(const s of e)(s==null||s==="")&&t++;return t},_Z=({args:e})=>{const[t,s]=ze(e,"COUNTIF",2);if(!zc(t))throw new B(65);if(!hS(s))throw new B(66);const i=gS(s.value);let r=0;for(const n of t)i(n)&&r++;return r},GZ=()=>new Date,OZ=()=>{const e=new Date;return new Date(e.getFullYear(),e.getMonth(),e.getDate())},NZ=({values:e})=>{const[t,s]=ze(e,"EQUALS",2);return t===s},BZ=({values:e})=>{const[t,s]=ze(e,"NOT_EQUALS",2);return t!==s},VZ=({values:e})=>{const[t,s]=ze(e,"GT",2);return t>s},HZ=({values:e})=>{const[t,s]=ze(e,"GTE",2);return t>=s},UZ=({values:e})=>{const[t,s]=ze(e,"LT",2);return t<s},zZ=({values:e})=>{const[t,s]=ze(e,"LTE",2);return t<=s},WZ=({values:e})=>{const[t,s,i]=ze(e,"IF",3);return t?s:i},$Z=({values:e})=>{let t=null;for(const s of e)s!=null&&(t===null||s<t)&&(t=s);if(t===null)throw new B(68);return t},KZ=({values:e})=>{let t=null;for(const s of e)s!=null&&(t===null||s>t)&&(t=s);if(t===null)throw new B(69);return t};import{_isFiniteNumber as jZ}from"ag-grid-community";var CS=1440*60*1e3;function YZ(e){return e.getTime()/CS}function co(e){return new Date(e*CS)}function Ks(e){return e instanceof Date}function We(e,t){if(typeof t=="bigint"){const s=Number(t);if(Number.isFinite(s))return s;throw new B(48,[e])}if(jZ(t))return t;if(Ks(t))return YZ(t);if(typeof t=="boolean")return t?1:0;if(typeof t=="string"){const s=Number(t.trim());if(Number.isFinite(s))return s}throw new B(48,[e])}function js(e,t){return typeof t=="bigint"?t:We(e,t)}function pt(e,t){if(typeof t=="bigint")return t;if(!Number.isFinite(t)||!Number.isInteger(t))throw new B(49,[e]);return BigInt(t)}var SS=({values:e})=>{let t=1,s=null;for(const i of $s(e)){const r=js("PRODUCT",i);if(typeof r=="bigint"){if(s??(s=pt("PRODUCT",t)),r===0n)return 0n;s*=r;continue}if(s!=null){s*=pt("PRODUCT",r);continue}if(r===0)return 0;t*=r}return s??t},qZ=({values:e})=>{const[t,s]=ze($s(e),"DIVIDE",2),i=We("DIV",t),r=We("DIV",s);if(i==null||r==null)throw new B(54);if(r===0)throw new B(55);return i/r},$c=({values:e})=>{let t=!1,s=0,i=null,r=!1;for(const n of $s(e)){t||(t=Ks(n));const o=js("SUM",n);if(typeof o=="bigint"){if(t)throw new B(56);i??(i=pt("SUM",s)),i+=o,r=!0;continue}if(typeof i=="bigint"){if(t)throw new B(56);i+=pt("SUM",o),r=!0;continue}s+=o,r=!0}if(!r)throw new B(57);return typeof i=="bigint"?i:t?co(s):s},XZ=({values:e})=>{const[t,s]=ze($s(e),"MINUS",2),i=Ks(t),r=Ks(s);if(i||r){const a=We("MINUS",t),l=We("MINUS",s);return i&&!r?co(a-l):a-l}const n=js("MINUS",t),o=js("MINUS",s);return typeof n=="bigint"||typeof o=="bigint"?pt("MINUS",n)-pt("MINUS",o):n-o},ZZ=({values:e})=>{const[t]=ze(e,"PERCENT",1),s=We("PERCENT",t);if(s==null)throw new B(70);return s/100},bS=({values:e})=>{const[t,s]=ze(e,"POWER",2),i=We("POWER",t),r=We("POWER",s);if(i==null||r==null)throw new B(71);return Math.pow(i,r)},JZ=({values:e})=>{const[t,s=0]=dS(e,"ROUND",1,2),i=We("ROUND",t),r=Math.trunc(We("ROUND",s)),n=Math.pow(10,r);return Math.round(i*n)/n},QZ=({values:e})=>{let t=0,s=0,i=!0;for(const n of $s(e)){const o=We("AVG",n);o!=null&&(t+=o,s++,i&&(i=Ks(n)))}if(s===0)throw new B(58);const r=t/s;return i?co(r):r},eJ=({values:e})=>{let t=!0;const s=[];for(const n of $s(e)){const o=We("MEDIAN",n);if(o==null)throw new B(59);s.push(o),t&&(t=Ks(n))}if(s.length===0)throw new B(60);s.sort((n,o)=>n-o);const i=Math.floor(s.length/2),r=s.length%2===1?s[i]:(s[i-1]+s[i])/2;return t?co(r):r},tJ=()=>Math.random(),sJ=({args:e})=>{const[t,s,i]=dS(e,"SUMIF",2,3);if(!zc(t))throw new B(61);if(!hS(s))throw new B(62);if(i&&!zc(i))throw new B(63);const r=gS(s.value);if(!i){let d=0,h=null;for(const p of t)if(r(p)){const g=js("SUMIF",p);typeof g=="bigint"?(h??(h=pt("SUMIF",d)),h+=g):h!=null?h+=pt("SUMIF",g):d+=g}return h??d}const n=t.rowEnd-t.rowStart,o=i.rowEnd-i.rowStart;if(n!==o)throw new B(64);const a=t[Symbol.iterator](),l=i[Symbol.iterator]();let c=0,u=null;for(;;){const d=a.next(),h=l.next();if(d.done||h.done){if(d.done!==h.done)throw new B(64);break}if(r(d.value)){const p=js("SUMIF",h.value);typeof p=="bigint"?(u??(u=pt("SUMIF",c)),u+=p):u!=null?u+=pt("SUMIF",p):c+=p}}return u??c},Kc=({values:e})=>{let t="";for(const s of e)if(s!=null)switch(typeof s){case"string":{t+=s;break}case"number":{t+=String(s);break}case"boolean":{t+=s?"TRUE":"FALSE";break}case"object":{t+=s.toString();break}default:throw new B(67)}return t},yS={IF:WZ,NOW:GZ,TODAY:OZ,PRODUCT:SS,SUM:$c,ADD:$c,SUMIF:sJ,POWER:bS,MIN:$Z,MAX:KZ,AVERAGE:QZ,MEDIAN:eJ,ROUND:JZ,COUNT:DZ,COUNTA:LZ,COUNTBLANK:kZ,COUNTIF:_Z,RAND:tJ,CONCAT:Kc,CONCATENATE:Kc,"+":$c,"-":XZ,"*":SS,"/":qZ,"^":bS,"%":ZZ,"=":NZ,"&":Kc,"<>":BZ,">":VZ,">=":HZ,"<":UZ,"<=":zZ},jc={suppressFlash:!0,force:!0},wS="ABCDEFGHIJKLMNOPQRSTUVWXYZ",Yc=wS.length,iJ=class extends X0{constructor(){super(...arguments),this.beanName="formula",this.valueCacheVersion=0,this.active=!1,this.cachedResult=new Map,this.activeCtx=null,this.colRefMap=new Map,this.colToRefMap=new Map,this.functionNames=null,this.formulaDataSvc=void 0,this.formulaColumnsPresent=!1,this.calculatedColumnsActive=!1}hasCachedRows(){return this.cachedResult.size>0}setFormulasActive(e){const t=this.beans.calculatedColsSvc?.isEnabled()===!0;let s=!1,i=!1;for(let u=0,d=e.length;u<d;++u){const h=e[u];if(h.allowFormula&&(s=!0),h.isCalculatedCol&&(i=!0),s&&(i||!t))break}const r=s||i;this.formulaColumnsPresent=r;const n=s&&this.checkForEditableFormulaIncompatibleServices(e),o=i&&this.checkForBaseIncompatibleServices(),a=this.beans.rowModel.getType()==="clientSide",l=n&&a,c=o;(l!==this.active||c!==this.calculatedColumnsActive)&&(this.active=l,this.calculatedColumnsActive=c,this.rebuildColRefMap(),this.refreshFormulas(!0))}isEvaluationActive(){return this.active||this.calculatedColumnsActive}checkForBaseIncompatibleServices(){return this.gos.get("enableCellExpressions")?(this.warn(295,{blockedService:"Cell Expressions"}),!1):!0}checkForEditableFormulaIncompatibleServices(e){if(this.gos.get("masterDetail"))return this.warn(295,{blockedService:"Master Detail"}),!1;if(!this.checkForBaseIncompatibleServices())return!1;if(this.gos.get("treeData"))return this.warn(295,{blockedService:"Tree Data"}),!1;for(let t=0,s=e.length;t<s;++t){const i=e[t];if(i.isAllowPivot()||i.isPivotActive())return this.warn(295,{blockedService:"Column Pivoting"}),!1;if(i.isAllowRowGroup()||i.isRowGroupActive())return this.warn(295,{blockedService:"Row Groups"}),!1;if(i.isAllowValue()||i.isValueActive()||i.aggFunc)return this.warn(295,{blockedService:"Value Aggregation"}),!1}return!0}postConstruct(){this.setupFunctions(),this.formulaDataSvc=this.beans.formulaDataSvc;const e=o=>{this.onRowDataChanged(o.node)},t=o=>{this.onRowDataChanged(o.node)},s=()=>{this.isEvaluationActive()&&(this.rebuildColRefMap(),this.refreshFormulas(!0))},i=()=>{this.isEvaluationActive()&&(this.rebuildColRefMap(),this.cachedResult.size!==0&&this.bumpValueCacheAndRefresh())},r=()=>{const o=this.cachedResult;if(!this.isEvaluationActive()||o.size===0)return;let a=!1;for(const l of o.keys())if(l.rowPinned){o.delete(l),a=!0;const c=l.sibling;c&&o.delete(c)}a&&this.beans.rowRenderer.refreshCells(jc)},n=()=>{this.beans.rowModel.getType()==="clientSide"||!this.isEvaluationActive()||this.refreshFormulas(!0)};this.addManagedPropertyListeners(["masterDetail","enableCellExpressions"],o=>{this.formulaColumnsPresent&&this.beans.colModel.refreshAll(KX(o.source))}),this.addManagedListeners(this.beans.eventSvc,{cellValueChanged:e,rowNodeDataChanged:t,newColumnsLoaded:s,columnMoved:i,modelUpdated:n,storeUpdated:n,pinnedRowDataChanged:r,pinnedRowsChanged:r})}onRowDataChanged(e){!this.active&&!this.calculatedColumnsActive||e.rowPinned!=null&&e.pinnedSibling||(this.dropRow(e),this.bumpValueCacheAndRefresh(!1))}destroy(){this.active=!1,this.calculatedColumnsActive=!1,super.destroy(),this.cachedResult.clear(),this.colRefMap.clear(),this.colToRefMap.clear(),this.supportedOperations.clear(),this.functionNames=null,this.activeCtx=null,this.formulaDataSvc=void 0}dropRow(e){const t=this.cachedResult;let s=t.delete(e);const i=e.sibling;if(i){t.delete(i)&&(s=!0);const n=i.pinnedSibling;n&&t.delete(n)&&(s=!0)}const r=e.pinnedSibling;return r&&t.delete(r)&&(s=!0),s}onRowsChanged(e,t){if(!this.active&&!this.calculatedColumnsActive)return;if(t){this.refreshFormulas(!0);return}let s=!0;if(e){const{adds:i,removals:r,updates:n,reordered:o}=e;for(const a of r)this.dropRow(a);for(const a of n)this.dropRow(a);s=o||r.length>0||i.size>0||n.size>0}s&&this.bumpValueCacheAndRefresh()}bumpValueCacheAndRefresh(e=!0){this.valueCacheVersion++,this.beans.rowRenderer.refreshCells(e?jc:void 0)}updateFormulaByOffset(e){const{value:t,rowDelta:s=0,columnDelta:i=0,useRefFormat:r=!0}=e,n=this.beans;try{const o=!r,a=ro(n,t,o);return vS(n,a,s,i,o),nS(n,a,r,o)}catch{return t}}setupFunctions(){const e=this.supportedOperations=new Map,t=Object.keys(yS);for(let i=0,r=t.length;i<r;++i){const n=t[i];e.set(n,yS[n])}this.functionNames=null;const s=this.gos.get("formulaFuncs");if(s){const i=Object.keys(s);for(let r=0,n=i.length;r<n;++r){const o=i[r];e.set(o.toUpperCase(),s[o].func)}}}getFunctionNames(){return this.functionNames??this.buildFunctionNames()}buildFunctionNames(){const e=this.supportedOperations,t=[];for(const s of e.keys())lX(s)&&t.push(s);return t.sort((s,i)=>s.localeCompare(i)),this.functionNames=t,t}rebuildColRefMap(){const{beans:e,colRefMap:t,colToRefMap:s}=this;if(t.clear(),s.clear(),!this.isEvaluationActive())return;const i=e.colModel.colsList;if(!i)return;let r=0;for(let n=0,o=i.length;n<o;++n){const a=i[n];if(!a.primary)continue;let l="",c=r++;for(;l=wS[c%Yc]+l,!(c<Yc);)c=Math.floor(c/Yc)-1;a.formulaRef!==l&&(a.formulaRef=l,a.dispatchColEvent("formulaRefChanged","api")),t.set(l,a),s.set(a,l)}}getColByRef(e){return this.colRefMap.get(e.toUpperCase())??null}getColRef(e){return this.colToRefMap.get(e)??null}refreshFormulas(e){this.cachedResult.clear(),e&&this.beans.rowRenderer.refreshCells(jc)}refreshRow(e){if(!this.active&&!this.calculatedColumnsActive)return!1;let t=!1;if(typeof e=="string"){const{rowModel:s,pinnedRowModel:i}=this.beans,r=s.getRowNode(e);r&&this.dropRow(r)&&(t=!0);const n=i?.getPinnedRowById(e,"top");n&&this.dropRow(n)&&(t=!0);const o=i?.getPinnedRowById(e,"bottom");o&&this.dropRow(o)&&(t=!0)}else t=this.dropRow(e);return t&&this.bumpValueCacheAndRefresh(),t}isFormula(e){return this.active&&kc(e)}normaliseFormula(e,t=!1){const s=this.beans;try{return nS(s,ro(s,e),!t,!1)}catch{return null}}validateExpression(e){try{const t=ro(this.beans,e,!0),s=jC(t,i=>!!this.getFunction(i));return s?new B(27,[s]):null}catch(t){return t instanceof B?t:new B(1)}}getDataSourceFormula(e,t){if(!this.active||!this.formulaDataSvc?.hasDataSource())return;const s=this.ensureCellFormula(e,t);return s?.fromDataSource?s.formulaString:void 0}getFormulaError(e,t){const s=this.ensureCellFormula(t,e);if(!s)return null;s.isValueReady()||this.resolveValue(e,t);const i=s.errorType;if(!i)return null;const r=s.errorId;return r!=null?new B(r,s.errorVariableValues??void 0,i):new B(s.errorMessage,i)}getFunction(e){const t=this.supportedOperations;return t.get(e)??t.get(e.toUpperCase())}ensureCellFormula(e,t){const s=this.active,i=this.calculatedColumnsActive;if(s&&t.allowFormula){if(!i)return this.ensureEditableCellFormula(e,t);const n=t.calculatedExpression;return n===void 0?this.ensureEditableCellFormula(e,t):this.ensureCalculatedCellFormula(e,t,n??"")}if(!i)return null;const r=t.calculatedExpression;return r===void 0?null:this.ensureCalculatedCellFormula(e,t,r??"")}ensureEditableCellFormula(e,t){const s=this.cachedResult;let i=s.get(e);const r=i?.get(t);if(r!==void 0)return r;i||(i=new Map,s.set(e,i)),i.set(t,null);try{const n=this.formulaDataSvc,o=n?.hasDataSource()?n.getFormula({column:t,rowNode:e}):void 0;if(kc(o)){const l=new oo(e,t,o,!0,this.beans,this);return i.set(t,l),l}const a=this.fetchRawValue(t,e);if(kc(a)){const l=new oo(e,t,a,!1,this.beans,this);return i.set(t,l),l}return null}catch(n){throw i.delete(t),n}}ensureCalculatedCellFormula(e,t,s){if(e.stub||e.failedLoad||t.aggregationActive&&e.group||!e.data)return null;const i=this.cachedResult;let r=i.get(e);const n=r?.get(t);if(n!==void 0)return n;r||(r=new Map,i.set(e,r)),r.set(t,null);try{const o=s.trim();if(!o)return null;const a=o.startsWith("=")?o:`=${s}`,l=new oo(e,t,a,!1,this.beans,this);return r.set(t,l),l}catch(o){throw r.delete(t),o}}coerceFormulaValue(e,t){let s=e.baseDataType;if(s===void 0&&(s=this.beans.dataTypeSvc?.getBaseDataType(e.column)??null,e.baseDataType=s),s==="bigint")return WX(t)??t;if(s==="number"&&typeof t=="bigint"){const i=Number(t);return Number.isFinite(i)?i:t}return t}fetchRawValue(e,t){if(e.isCalculatedCol)return e.calculatedExpression?.trim()?void 0:"";const s=this.beans.valueSvc,i=e.pivotValueColumn;return i&&!t.group&&!t.rowPinned?this.leafInPivotBucket(e,t)?s.getValueFromData(i,t):void 0:s.getValueFromData(e,t)}leafInPivotBucket(e,t){const s=this.beans,i=s.pivotColsSvc?.columns,r=e.colDef.pivotKeys;if(!i||!r)return!1;const n=s.valueSvc;for(let o=0,a=r.length;o<a;++o){const l=i[o];if(!l||n.getKeyForNode(l,t)!==r[o])return!1}return!0}resolveAddrRef(e){const{row:t,column:s}=e,i=this.ensureCellFormula(t,s);if(i){if(!i.isValueReady())throw new B(53);if(i.errorType)throw i;return i.getValue()}return this.fetchRawValue(s,t)}makeFormulaFrame(e){const s=this.ensureCellFormula(e.row,e.column).getAst();if(!s)throw new B(52);const i=xZ(this.beans,s,this,e);return{address:e,ast:s,unresolvedDepIterator:i}}resolveValue(e,t){const s=this.ensureCellFormula(t,e);if(!s)return this.fetchRawValue(e,t);if(s.isValueReady())return s.getValue();const i=this.activeCtx,r=i??(this.activeCtx=new Map),n=[];try{for(oS(r,t,e),n.push(this.makeFormulaFrame({row:t,column:e}));n.length;){const{address:o,ast:a,unresolvedDepIterator:l}=n[n.length-1],{row:c,column:u}=o,d=this.ensureCellFormula(c,u);if(d.isValueReady()){if(n.pop(),Hc(r,c,u),d.errorType)throw d;continue}const h=l.next();if(!h.done){const f=h.value,m=this.ensureCellFormula(f.row,f.column);if(!m||m.isValueReady())continue;oS(r,f.row,f.column),n.push(this.makeFormulaFrame(f));continue}const p=lS(this.beans,a,this,o),g=this.coerceFormulaValue(d,p);if(d.errorType&&d.isValueReady())throw Hc(r,c,u),d;d.setComputedValue(g),Hc(r,c,u),n.pop()}if(!s.isValueReady())throw new B(53);return s.getValue()}catch(o){return this.errorAllVisitors(r,o)}finally{i||(this.activeCtx=null)}}errorAllVisitors(e,t){let s="#ERROR!",i=null,r,n=null;return t instanceof oo?(s=t.errorType??"#ERROR!",i=t.errorId,r=t.errorMessage,n=t.errorVariableValues):t instanceof B?(s=t.type,i=t.errorId,r=t.message,n=t.variableValues??null):r=String(t?.message??t),e.forEach((o,a)=>{for(const l of o)this.ensureCellFormula(a,l)?.setErrorFields(s,i,r,n)}),s}},qc={moduleName:"Formula",version:G,userComponents:{agFormulaCellEditor:_X},beans:[iJ,HX,zX],apiFunctions:{refreshFormulas:OX},dependsOn:[lc],css:[GX]};import{_PopupModule as rJ}from"ag-grid-community";var nJ='.ag-has-cell-notes:after{border-style:solid;content:"";pointer-events:none;position:absolute;top:0}:where(.ag-ltr) .ag-has-cell-notes:after{border-color:transparent var(--ag-note-indicator-color) transparent transparent;border-width:0 var(--ag-note-indicator-size) var(--ag-note-indicator-size) 0;right:0}:where(.ag-rtl) .ag-has-cell-notes:after{border-color:transparent transparent transparent var(--ag-note-indicator-color);border-width:0 0 var(--ag-note-indicator-size) var(--ag-note-indicator-size);left:0}.ag-notes-panel.ag-panel{background-color:var(--ag-note-popup-background-color);border:var(--ag-note-popup-border);width:100%}.ag-notes-panel-content-wrapper,.ag-notes-popup-content{min-height:0;min-width:0}.ag-notes-popup-content{display:flex;flex-direction:column;gap:calc(var(--ag-spacing)/2);height:100%;padding:var(--ag-note-popup-padding);width:100%}.ag-notes-popup-meta{color:var(--ag-note-popup-text-color);font-size:calc(var(--ag-font-size) - 1px)}:where(.ag-ltr) .ag-notes-popup-meta{padding-left:calc(var(--ag-spacing)/2)}:where(.ag-rtl) .ag-notes-popup-meta{padding-right:calc(var(--ag-spacing)/2)}.ag-notes-popup-body{display:flex;flex:1 1 auto;min-height:0;min-width:0}.ag-notes-popup-editor{display:flex;flex:1 1 auto;height:100%;min-width:0;width:100%}.ag-notes-popup-editor :where(.ag-text-area-input-wrapper){align-items:stretch;flex:1 1 auto;height:100%;min-width:0;width:100%}.ag-notes-popup-editor .ag-text-area-input{background-color:var(--ag-note-popup-input-background-color);color:var(--ag-note-popup-input-text-color);flex:1 1 auto;height:100%;min-width:0;padding:calc(var(--ag-spacing)/2);resize:none;width:100%}.ag-notes-popup-editor .ag-text-area-input[readonly]{background-color:var(--ag-note-popup-background-color);border:none}.ag-notes-popup-read-only :where(.ag-text-area-input-wrapper){background-color:var(--ag-input-disabled-background-color)}';function oJ(e,t){return e.notesSvc?.getNote(t)}function aJ(e,t){e.notesSvc?.setNote(t)}function lJ(e,t){e.notesSvc?.refreshNotes(t)}import{BeanStub as cJ,_addGridCommonParams as uJ}from"ag-grid-community";function Oe(e){return e.location==="fullWidthRow"}function uo(e){if(!(!e||typeof e.text!="string"||!e.text.trim()))return{...e}}var dJ=class extends Z0{constructor(){super(...arguments),this.beanName="notesDataSvc"}postConstruct(){this.setDataSource(this.gos.get("notesDataSource")),this.addManagedPropertyListener("notesDataSource",({currentValue:e})=>{this.setDataSource(e),this.beans.notesSvc?.onDataSourceChanged()})}hasDataSource(){return!!this.dataSource}supportsFullWidthRows(){return this.isFullWidthDataSource(this.dataSource)}getNote(e){const{dataSource:t}=this;if(Oe(e))return uo(this.isFullWidthDataSource(t)?t.getNote(e):void 0);const s=this.beans.colModel.getCol(e.column);if(s)return uo(t?.getNote({...e,column:s}))}setNote(e){const{dataSource:t}=this,s=uo(e.note);if(Oe(e)){this.isFullWidthDataSource(t)&&t.setNote({...e,note:s});return}const i=this.beans.colModel.getCol(e.column);i&&t?.setNote({...e,column:i,note:s})}setDataSource(e){this.dataSource!==e&&(this.dataSource?.destroy?.(),this.dataSource=e,e?.init?.(this.createInitParams()))}createInitParams(){return uJ(this.gos,{})}isFullWidthDataSource(e){return!!e&&"supportsFullWidthRows"in e&&e.supportsFullWidthRows===!0}destroy(){this.dataSource?.destroy?.(),super.destroy()}};import{BeanStub as hJ}from"ag-grid-community";import{_interpretAsRightClick as pJ,_isStopPropagationForAgGrid as gJ}from"ag-grid-community";import{RefPlaceholder as xS,_computeAlignedPosition as fJ,_findBestPlacement as mJ,_fitsWithinBounds as vJ,_getActiveDomElement as CJ,_getEffectivePlacements as SJ,_getRectSize as bJ,_setDisplayed as yJ,_toRelativeRect as wJ}from"ag-stack";import{AgInputTextAreaSelector as xJ,BeanStub as FJ,Component as TJ,KeyCode as AJ}from"ag-grid-community";var FS={width:290,height:150,minWidth:240,minHeight:150},PJ=["tl-tr","tr-br","br-tr","tr-tl","br-tl"],RJ=["tl-tr","tr-br","br-tr"],MJ={tag:"div",cls:"ag-notes-popup-content",children:[{tag:"div",ref:"eMeta",cls:"ag-notes-popup-meta"},{tag:"div",cls:"ag-notes-popup-body",children:[{tag:"ag-input-text-area",ref:"eEditor",cls:"ag-notes-popup-editor"}]}]},IJ=class extends J0{constructor(e,t){super(MJ,[xJ]),this.note=e,this.readOnly=t,this.eMeta=xS,this.eEditor=xS,this.initialText=e?.text.trim()??""}postConstruct(){const e=this.getLocaleTextFunc(),t=this.note?.author?.trim(),s=this.note?.updatedAt?.trim()||this.note?.createdAt?.trim(),i=[t,s].filter(n=>!!n);this.eMeta.textContent=i.join(" \xB7 "),yJ(this.eMeta,!!i.length),this.eEditor.setInputPlaceholder(this.readOnly?void 0:e("notePlaceholder","Add a note...")).setRows(8).setValue(this.note?.text??"",!0).setInputAriaLabel(e("ariaInputEditor","Input Editor"));const r=this.eEditor.getInputElement();r.setAttribute("title",""),r.readOnly=this.readOnly}focusEditor(){this.eEditor.getFocusableElement().focus();const t=this.eEditor.getInputElement(),s=t.value.length;t.setSelectionRange(s,s)}getEditedNote(){return EJ(this.note,this.eEditor.getValue())}isDirty(){return this.readOnly?!1:(this.eEditor.getValue()?.trim()??"")!==this.initialText}};function EJ(e,t){const s=t?.trim();if(s)return{...e??{},text:s}}var DJ=class extends Q0{constructor(e){super(),this.params=e,this.saveOnClose=!0,this.closed=!1}postConstruct(){const e=uo(this.params.note),t=this.createManagedBean(new IJ(e,!!this.params.readOnly));this.contentComp=t;const{x:s,y:i}=this.computeInitialPosition(),r=this.createManagedBean(new ns({...FS,modal:!0,resizable:!0,movable:!1,closable:!1,hideTitleBar:!0,cssIdentifier:"notes",x:s,y:i,closedCallback:a=>this.onDialogClosed(a)}));this.dialog=r,r.setBodyComponent(t);const n=r.getGui(),o=this.getLocaleTextFunc();n.classList.add("ag-notes-popup"),n.classList.toggle("ag-notes-popup-read-only",!!this.params.readOnly),n.setAttribute("aria-label",o("note","Note")),this.addManagedElementListeners(n,{keydown:a=>{a.key===AJ.TAB&&a.preventDefault()},pointerenter:()=>this.params.onPopupEnter(),pointerout:a=>this.onPotentialLeave(a.relatedTarget,!0),focusout:a=>{r.isResizing||this.onPotentialLeave(a.relatedTarget,!1)}}),this.params.focusEditor&&t.focusEditor()}hide(e=!0){this.saveOnClose=e,this.dialog?.close()}focusEditor(){this.contentComp?.focusEditor()}hasFocus(){return!!this.dialog?.getGui().contains(CJ(this.beans))}onPotentialLeave(e,t){const s=this.dialog?.getGui();s&&(e&&s.contains(e)||t&&this.hasFocus()||this.params.onPopupLeave())}computeInitialPosition(){return LJ({anchorRect:this.params.anchorToElement.getBoundingClientRect(),parentRect:this.beans.popupSvc.getParentRect(),popupSize:FS,placementMode:this.params.placementMode,enableRtl:this.gos.get("enableRtl")})}onDialogClosed(e){this.closed||(this.closed=!0,this.notifyClosed(e))}destroy(){this.closed||(this.closed=!0,this.notifyClosed()),super.destroy()}notifyClosed(e){const t=this.saveOnClose&&(this.contentComp?.isDirty()??!1),s=t?this.contentComp?.getEditedNote():void 0;this.params.onClosed(t,s,e)}};function LJ(e){const{anchorRect:t,parentRect:s,popupSize:i,placementMode:r,enableRtl:n}=e,o=wJ(t,s),a=bJ(s),l=r==="fullWidthRow"?RJ:PJ,c=SJ(l,n);for(const u of c){const d=fJ(o,i,u,0);if((u==="tl-tr"||u==="tr-tl")&&(d.y-=1),vJ(d,i,a))return d}return mJ(o,i,a,[...l.slice(1),l[0]],{gap:0,enableRtl:n})}var TS="ag-has-cell-notes",AS=class{constructor(e,t){this.beans=e,this.notesSvc=t,this.showTimer=0,this.hideTimer=0,this.suppressHoverUntilPointerLeave=!1,this.preserveActivePopupOwnerOnClose=!1}refresh(){if(this.refreshHasNotesStyling(),!this.activeTarget)return;const{canView:e,canCreate:t}=this.notesSvc.getNoteAccess(this.activeTarget.noteParams)||{};!e&&!t&&this.closeNotePopup(!1)}show(e){const t=this.getTarget(e?.pinned);t&&this.openPopup(t,e?.focusEditor)}hide(e=!0){this.closeNotePopup(e)}closeNotePopup(e=!0){this.clearShowTimer(),this.cancelHide(),this.popup?.hide(e)}destroy(){this.closeNotePopup(!1)}getNoteTrigger(){return this.beans.gos.get("noteTrigger")==="click"?"click":"hover"}onPointerEnter(e,t){if(t.pointerType!=="mouse"||this.suppressHoverUntilPointerLeave)return;if(this.getNoteTrigger()!=="hover"){e&&this.matchesActiveTarget(e)&&this.cancelHide();return}const s=e&&this.notesSvc.getNoteAccess(e.noteParams);if(this.cancelHide(),!e||!s?.canView||this.matchesActiveTarget(e))return;this.clearShowTimer();const i=this.notesSvc.getHoverGeneration();this.showTimer=window.setTimeout(()=>{i===this.notesSvc.getHoverGeneration()&&this.openPopup(e)},this.beans.gos.get("noteShowDelay"))}onPointerLeave(e){e.pointerType==="mouse"&&(this.suppressHoverUntilPointerLeave=!1,this.clearShowTimer(),!this.popup?.hasFocus()&&this.scheduleHide())}onContextMenu(){this.suppressHoverUntilPointerLeave=!0,this.closeNotePopup()}onClick(e,t){if(this.getNoteTrigger()!=="click"||gJ(t)||pJ(this.beans,t))return;const s=e&&this.notesSvc.getNoteAccess(e.noteParams);!e||!s?.canView||(this.suppressHoverUntilPointerLeave=!1,this.openPopup(e))}openPopup(e,t=!1){const s=this.notesSvc.getNoteAccess(e.noteParams);if(!s||!s.canView&&!(t&&s.canCreate))return;if(this.cancelHide(),this.clearShowTimer(),this.matchesActiveTarget(e)&&this.popup){t&&this.popup.focusEditor();return}const i=this.notesSvc.replaceActivePopupOwner(this);i?i.closeNotePopup():this.popup&&(this.preserveActivePopupOwnerOnClose=!0,this.closeNotePopup());const r=this.beans.context.createBean(new DJ({note:s.note??{text:""},readOnly:s.canView&&!s.canEdit,anchorToElement:e.anchorElement,placementMode:Oe(e.noteParams)?"fullWidthRow":"cell",focusEditor:t,onClosed:(n,o,a)=>this.onPopupClosed(n,o,a),onPopupEnter:()=>this.cancelHide(),onPopupLeave:()=>this.scheduleHide()}));this.popup=r,this.activeTarget=e}onPopupClosed(e,t,s){const i=this.activeTarget,r=this.popup,n=this.preserveActivePopupOwnerOnClose;this.popup=void 0,this.activeTarget=void 0,this.preserveActivePopupOwnerOnClose=!1,n||this.notesSvc.clearActivePopupOwner(this),r&&this.beans.context.destroyBean(r),i&&s instanceof KeyboardEvent&&s.key==="Escape"&&this.beans.focusSvc.setFocusedCell({rowIndex:i.rowNode.rowIndex,rowPinned:i.rowNode.rowPinned,column:i.focusColumn,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:s}),!(!e||!i)&&this.notesSvc.setNote({...i.noteParams,note:t,previousNote:this.notesSvc.getNoteAccess(i.noteParams)?.note,source:"ui"})}matchesActiveTarget(e){return GJ(this.activeTarget?.noteParams,e.noteParams)}scheduleHide(){this.cancelHide(),this.hideTimer=window.setTimeout(()=>this.closeNotePopup(),this.beans.gos.get("noteHideDelay"))}cancelHide(){this.hideTimer&&(window.clearTimeout(this.hideTimer),this.hideTimer=0)}clearShowTimer(){this.showTimer&&(window.clearTimeout(this.showTimer),this.showTimer=0)}},kJ=class extends AS{constructor(e,t,s){super(e,s),this.ctrl=t}refresh(){this.ctrl.isNoteHoverSuppressed()&&this.clearShowTimer(),super.refresh()}initialise(){this.ctrl.addManagedElementListeners(this.ctrl.eGui,{pointerenter:e=>{this.ctrl.isNoteHoverSuppressed()||this.onPointerEnter(this.getTarget(),e)},pointerleave:e=>this.onPointerLeave(e),click:e=>{this.ctrl.isNoteHoverSuppressed()||this.onClick(this.getTarget(),e)},contextmenu:()=>this.onContextMenu()}),this.refresh()}refreshHasNotesStyling(){const e=!!this.notesSvc.getNoteAccess(this.getPosition())?.note;this.ctrl.comp.toggleCss(TS,e&&!this.ctrl.isNoteHoverSuppressed())}getPosition(){return{rowNode:this.ctrl.rowNode,column:this.ctrl.column}}getTarget(){return{noteParams:this.getPosition(),rowNode:this.ctrl.rowNode,focusColumn:this.ctrl.column,anchorElement:this.ctrl.eGui}}},_J=class extends AS{constructor(e,t,s){super(e,s),this.ctrl=t}initialise(){for(const e of this.ctrl.getTargets())e.compBean.addManagedListeners(e.element,{pointerenter:t=>this.onPointerEnter(this.getTargetForElement(t.target),t),pointerleave:t=>this.onPointerLeave(t),click:t=>this.onClick(this.getTargetForElement(t.target),t),contextmenu:()=>this.onContextMenu()});this.refresh()}refreshHasNotesStyling(){if(this.ctrl.isFullWidth())for(const e of this.ctrl.getTargets()){const t=this.getNoteParamsForTarget(e),s=!!this.notesSvc.getNoteAccess(t)?.note;e.element.classList.toggle(TS,s)}}getNoteParamsForTarget(e){const t=e.pinned==="left"||e.pinned==="right"?e.pinned:void 0;return{rowNode:this.ctrl.rowNode,location:"fullWidthRow",pinned:t}}getTargetForElement(e){const t=this.ctrl.getTarget(e);if(t)return this.getNoteTargetForFullWidthTarget(t)}getNoteTargetForFullWidthTarget(e){return{noteParams:this.getNoteParamsForTarget(e),rowNode:this.ctrl.rowNode,focusColumn:e.column,anchorElement:e.element}}getTarget(e){let t,s;for(const i of this.ctrl.getTargets()){if(t)break;const r=this.getNoteTargetForFullWidthTarget(i);s||(s=r),(i.pinned==="left"||i.pinned==="right"?i.pinned:void 0)===e&&(t=r)}return t??s}};function GJ(e,t){return!e||!t?e===t:Oe(e)||Oe(t)?Oe(e)&&Oe(t)&&e.rowNode===t.rowNode&&e.pinned===t.pinned:e.rowNode===t.rowNode&&e.column===t.column}var OJ=class extends eF{constructor(){super(...arguments),this.beanName="notesSvc",this.hoverGeneration=0}postConstruct(){this.addManagedListeners(this.beans.eventSvc,{bodyScroll:()=>this.resetActivePopupState()})}hasDataSource(){return!!this.beans.notesDataSvc?.hasDataSource()}onDataSourceChanged(){this.resetActivePopupState(!1),this.beans.rowRenderer.redrawRows()}getHoverGeneration(){return this.hoverGeneration}createNotesFeature(e){if(!this.hasDataSource())return;const t=new kJ(this.beans,e,this);return t.initialise(),t}createFullWidthNotesFeature(e){if(!this.hasDataSource()||!this.beans.notesDataSvc?.supportsFullWidthRows())return;const t=new _J(this.beans,e,this);return t.initialise(),t}getNoteAccess(e){const{colModel:t,notesDataSvc:s}=this.beans;if(!this.hasDataSource()||Oe(e)&&!s.supportsFullWidthRows())return;Oe(e)&&e.pinned&&!this.gos.get("embedFullWidthRows")&&(e={...e,pinned:void 0});const i=Oe(e)?this.getColumnForFullWidth(e.pinned):t.getCol(e.column),r=s.getNote(e);if(!i)return;const n=i.isColumnFunc(e.rowNode,i.colDef.suppressNoteActions??null),o=!!r?.readOnly;return{params:e,rowNode:e.rowNode,column:i,note:r,isReadOnly:o,isSuppressed:n,canView:!!r,canCreate:!r&&!n,canEdit:!!r&&!n&&!o,canDelete:!!r&&!n&&!o}}getNote(e){return this.getNoteAccess(e)?.note}replaceActivePopupOwner(e){const t=this.activePopupOwner;if(t!==e)return this.activePopupOwner=e,t}clearActivePopupOwner(e){this.activePopupOwner===e&&(this.activePopupOwner=void 0)}resetActivePopupState(e=!0){this.hoverGeneration++,this.activePopupOwner?.closeNotePopup(e)}showNote(e,t=!1){const s=this.getNoteAccess(e);if(!s||!s.canView&&!(t&&s.canCreate))return!1;const{rowRenderer:i}=this.beans;if(Oe(s.params)){const o=i.getRowCtrlByNode(e.rowNode)?.getNotesFeature();return o?(o.show({pinned:s.params.pinned,focusEditor:t}),!0):!1}const r=i.getCellCtrls([e.rowNode],[s.column])[0];return r?(r.showNote(t),!0):!1}setNote(e){const{notesDataSvc:t}=this.beans;if(!this.hasDataSource())return;const s=this.getNoteAccess(e);if(!s)return;const{note:i}=e,r=e.previousNote??s.note,n=e.source??"api";!i&&!r||n==="ui"&&(s.isSuppressed||r?.readOnly)||(n==="api"&&this.activePopupOwner?.closeNotePopup(!1),t.setNote(Oe(s.params)?{...s.params,note:i}:{rowNode:s.rowNode,column:s.column,note:i}),this.refreshNotes(Oe(s.params)?{rowNodes:[e.rowNode]}:{rowNodes:[e.rowNode],columns:[s.column]}))}refreshNotes(e={}){const{rowRenderer:t}=this.beans;t.refreshCells({rowNodes:e.rowNodes,columns:e.columns,force:!0,suppressFlash:!0});const s=e.rowNodes,i=s?new Set(s):void 0;for(const r of t.getAllRowCtrls())r.isFullWidth()&&(i&&!i.has(r.rowNode)||r.refreshRow({force:!0,suppressFlash:!0}))}getColumnForFullWidth(e){const{visibleCols:t}=this.beans;switch(e){case"left":return t.leftCols[0];case"right":return t.rightCols[0];default:return t.centerCols[0]??t.allCols[0]}}},PS={moduleName:"Notes",version:G,beans:[dJ,OJ],apiFunctions:{getNote:oJ,setNote:aJ,refreshNotes:lJ},dependsOn:[$,rJ],css:[nJ]};import{_PopupModule as NJ}from"ag-grid-community";var BJ=".ag-column-header-edit-popup-content{box-sizing:border-box;display:flex;flex:1 1 auto;flex-direction:column;gap:calc(var(--ag-spacing)*2);min-width:0;padding:calc(var(--ag-spacing)*2)}.ag-column-header-edit-popup-editor{flex:1 1 auto}.ag-column-header-edit-popup-actions{display:flex;gap:var(--ag-widget-horizontal-spacing);justify-content:flex-end}.ag-column-header-edit-highlighted{background-color:var(--ag-column-header-edit-highlight-color)}";import{BeanStub as VJ,_createIconNoSpan as HJ,isProvidedColumnGroup as or}from"ag-grid-community";import{RefPlaceholder as ho,_getActiveDomElement as RS,_setDisplayed as UJ}from"ag-stack";import{AgInputTextFieldSelector as zJ,BeanStub as WJ,Component as $J,KeyCode as MS}from"ag-grid-community";var KJ=300,jJ=300,YJ={tag:"div",cls:"ag-column-header-edit-popup-content",children:[{tag:"ag-input-text-field",ref:"eEditor",cls:"ag-column-header-edit-popup-editor"},{tag:"div",ref:"eActions",cls:"ag-column-header-edit-popup-actions",children:[{tag:"button",ref:"eApply",cls:"ag-button ag-standard-button ag-column-header-edit-action ag-column-header-edit-action-apply"},{tag:"button",ref:"eCancel",cls:"ag-button ag-standard-button ag-column-header-edit-action"}]}]},qJ=class extends tF{constructor(e,t,s,i,r){super(YJ,[zJ]),this.initialValue=e,this.liveApply=t,this.onValueChange=s,this.onApply=i,this.onCancel=r,this.eEditor=ho,this.eActions=ho,this.eApply=ho,this.eCancel=ho}postConstruct(){const e=this.getLocaleTextFunc();this.eEditor.setValue(this.initialValue,!0).setInputAriaLabel(e("ariaColumnHeaderNameEditor","Column Name Editor")),UJ(this.eActions,!this.liveApply),this.liveApply?this.eEditor.onValueChange(t=>this.onValueChange(t??"")):(this.eApply.textContent=e("columnHeaderEditApply","Apply"),this.eCancel.textContent=e("columnHeaderEditCancel","Cancel"),this.eApply.type="button",this.eCancel.type="button",this.addManagedElementListeners(this.eApply,{click:()=>this.onApply()}),this.addManagedElementListeners(this.eCancel,{click:()=>this.onCancel()}))}focusEditor(){const e=this.eEditor.getInputElement();e.focus(),e.select()}getValue(){return this.eEditor.getValue()??""}setValue(e){this.eEditor.setValue(e,!0)}},XJ=class extends sF{constructor(e){super(),this.params=e,this.closed=!1,this.restoreFocusEl=null}postConstruct(){const{liveApply:e}=this.params,t=this.createManagedBean(new qJ(this.params.initialValue,e,r=>this.params.onApply(r),()=>this.commit(),()=>this.close()));this.contentComp=t;const s=this.getLocaleTextFunc(),i=this.createManagedBean(new ns({width:KJ,minWidth:jJ,minHeight:0,title:s("editColumnName","Edit Column Name"),component:t,closable:!0,centered:!0,movable:!0,resizable:!1,modal:!1,alwaysOnTop:!0,cssIdentifier:"column-header-edit",closedCallback:()=>this.onDialogClosed()}));this.dialog=i,this.addManagedElementListeners(i.getGui(),{keydown:r=>{r.key===MS.ENTER?(r.preventDefault(),e?this.close():this.commit()):r.key===MS.ESCAPE&&this.close()}}),this.focusEditorTimeout=window.setTimeout(()=>{this.focusEditorTimeout=void 0,this.restoreFocusEl=RS(this.beans),t.focusEditor()})}commit(){this.params.onApply(this.contentComp?.getValue()??""),this.close()}close(){this.dialog?.close()}setValue(e){this.contentComp?.setValue(e)}getValue(){return this.contentComp?.getValue()??""}onDialogClosed(){this.closed||(this.closed=!0,this.restoreFocus(),this.params.onClosed())}restoreFocus(){const e=this.restoreFocusEl;if(this.restoreFocusEl=null,!e?.isConnected)return;const t=RS(this.beans);(!t||t===t.ownerDocument.body||this.dialog?.getGui().contains(t))&&e.focus()}destroy(){this.focusEditorTimeout!=null&&(window.clearTimeout(this.focusEditorTimeout),this.focusEditorTimeout=void 0),this.closed||(this.closed=!0,this.restoreFocus(),this.params.onClosed()),super.destroy()}},ZJ=class extends iF{constructor(){super(...arguments),this.beanName="colHeaderEditSvc",this.activePopup=null,this.removePopupColListener=null,this.editingTarget=null}getOptions(){const e=this.gos.get("columnHeaderEdit");return typeof e=="object"&&e!=null?e:void 0}isLiveApplyMode(){return this.getOptions()?.applyMode!=="deferred"}isHighlightSuppressed(){return this.getOptions()?.suppressColumnHighlighting===!0}isHighlightedColumn(e){return!this.isHighlightSuppressed()&&this.editingTarget===e}isHighlightedGroup(e){return!this.isHighlightSuppressed()&&this.editingTarget===e}setEditingTarget(e){const t=this.editingTarget;this.editingTarget=e,this.dispatchHighlightChanged(t),e&&e!==t&&this.dispatchHighlightChanged(e)}dispatchHighlightChanged(e){e&&(or(e)?this.beans.eventSvc.dispatchEvent({type:"columnHeaderEditHighlightChanged",groupId:e.groupId}):this.beans.eventSvc.dispatchEvent({type:"columnHeaderEditHighlightChanged",colId:e.getColId()}))}isEditable(e){return or(e)?!!e.colGroupDef?.headerNameEditable:!!e.colDef.headerNameEditable&&!e.isCalculatedCol}getEditableHeaderName(e){const{colNames:t}=this.beans,s=or(e)?t.getDisplayNameForProvidedColumnGroup(null,e,"header"):t.getDisplayNameForColumn(e,"header");return s!=null?String(s):""}applyHeaderName(e,t){if(or(e)){const s=this.beans.colModel.groupHeaderNameOverrides,{groupId:i}=e;if((s.get(i)??null)===t)return;t==null?s.delete(i):s.set(i,t),this.beans.eventSvc.dispatchEvent({type:"columnHeaderNameChanged",column:null,columns:null,columnGroup:e,source:"uiColumnHeaderEdit"})}else e.setHeaderNameOverride(t,"uiColumnHeaderEdit")}postConstruct(){this.addManagedEventListeners({columnMenuVisibleChanged:e=>{!e.visible&&e.key==="columnChooser"&&this.destroyActivePopup()}})}getEditColumnNameMenuItem(e){return this.isEditable(e)?{name:this.getLocaleTextFunc()("editColumnName","Edit Column Name"),icon:HJ("columnHeaderEdit",this.beans,null),action:()=>this.showHeaderNameEditor(e)}:null}showHeaderNameEditor(e){this.destroyActivePopup();let t=this.getEditableHeaderName(e);const s=this.isLiveApplyMode(),i=this.createBean(new XJ({initialValue:t,liveApply:s,onApply:a=>{!s&&a===t||this.applyHeaderName(e,a)},onClosed:()=>this.destroyActivePopup()}));this.activePopup=i;const r=()=>{t=this.getEditableHeaderName(e),i.getValue()!==t&&i.setValue(t)},n=or(e),o=n?e.groupId:e.getColId();this.removePopupColListener=this.addManagedEventListeners({columnHeaderNameChanged:a=>{const l=n?a.columnGroup?.getGroupId():a.column?.getColId();(!l||l===o)&&r()}})[0],this.setEditingTarget(e)}destroyActivePopup(){this.removePopupColListener?.(),this.removePopupColListener=null,this.activePopup&&(this.destroyBean(this.activePopup),this.activePopup=null),this.setEditingTarget(null)}destroy(){this.destroyActivePopup(),super.destroy()}},IS={moduleName:"ColumnHeaderEdit",version:G,beans:[ZJ],dependsOn:[$,NJ],icons:{columnHeaderEdit:"edit"},css:[BJ]};import{_preInitErrMsg as JJ}from"ag-grid-community";var QJ=".ag-sparkline-wrapper{height:100%;inset-inline-start:var(--ag-internal-sparkline-inset,0);line-height:normal;position:absolute;top:0}";import{RefPlaceholder as eQ,_batchCall as tQ,_setAriaLabel as sQ,_setAriaLabelledBy as ES}from"ag-stack";import{Component as iQ,_formatNumberCommas as rQ}from"ag-grid-community";import{_isFiniteNumber as nQ}from"ag-grid-community";var oQ="Sparkline - ${chartType} displaying ${count} values between ${min} and ${max}. Starts at ${start} and ends at ${end}.",aQ="Sparkline - ${chartType} displaying 1 value, ${value}.",lQ="Sparkline - ${chartType} displaying no values.",cQ=(e,t)=>{const s=t?.type??"line";switch(s){case"line":return e("lineChart","Line");case"area":return e("areaChart","Area");case"bar":return e("barChart","Bar");default:return s}},uQ=(e,t)=>{let s=0,i=Number.POSITIVE_INFINITY,r=Number.NEGATIVE_INFINITY,n,o;for(const a of e){const l=gQ(a,t);l!=null&&(n==null&&(n=l),o=l,s++,i=Math.min(i,l),r=Math.max(r,l))}return s===0?{count:s}:{count:s,min:i,max:r,start:n,end:o}};function dQ(e){const{translate:t,chartType:s,summary:i,formatNumber:r}=e;let n,o,a,l;if(!hQ(i))n="ariaSparklineChartDescriptionEmpty",o=lQ,a=[s],l={chartType:s};else if(i.count===1){const c=r(i.start);n="ariaSparklineChartDescriptionSingleValue",o=aQ,a=[s,c],l={chartType:s,value:c}}else{const[c,u,d,h,p]=[i.count,i.min,i.max,i.start,i.end].map(r);n="ariaSparklineChartDescription",o=oQ,a=[s,c,u,d,h,p],l={chartType:s,count:c,min:u,max:d,start:h,end:p}}return{template:t(n,o,a),values:l}}var hQ=e=>e.count>0&&e.min!=null&&e.max!=null&&e.start!=null&&e.end!=null,pQ=(e,t)=>e.replace(/\$\{([^}]+)\}/g,(s,i)=>t[i]??s),gQ=(e,t)=>{if(typeof e=="number")return Number.isFinite(e)?e:null;if(e&&typeof e=="object"){const s=Array.isArray(e)?e[1]:e[t];return nQ(s)?s:null}return null},DS="ag-sparkline",fQ=class extends rF{constructor(){super({tag:"div",cls:`${DS}-wrapper`,children:[{tag:"span",ref:"eSparkline"}]}),this.eSparkline=eQ,this.cachedWidth=0,this.cachedHeight=0,this.dataRef=[],this.processedData=[]}postConstruct(){this.env=this.beans.environment,this.addManagedPropertyListeners(["chartThemeOverrides","chartThemes","styleNonce"],()=>this.refresh(this.params))}createListener(e=!0){return()=>this.updateSize(this.params?.column?.getActualWidth()??0,(this.params?.node.rowHeight??0)-2,e)}initGridObserver(){const e=this.createListener(),t=this.createListener(!1),s=this.params?.column,i=this.params?.node;s.__addEventListener("columnStateUpdated",e),i.__addEventListener("heightChanged",e),this.addDestroyFunc(()=>{s.__removeEventListener("columnStateUpdated",e),i.__removeEventListener("heightChanged",e)}),t()}updateSize(e,t,s=!0){const i=this.params?.colDef,r=(i?.rowDrag?1:0)+(i?.checkboxSelection?1:0)+(i?.dndSource?1:0),n=this.env,o=n.getDefaultCellHorizontalPadding(),a=r*(n.getDefaultIconSize()+n.getDefaultCellWidgetSpacing()),l=o-1+a;if(this.getGui().style.setProperty("--ag-internal-sparkline-inset",l+"px"),e-=2*o+a,e!==this.cachedWidth||t!==this.cachedHeight){this.cachedWidth=e,this.cachedHeight=t;const c=this.refresh.bind(this);s?tQ(()=>this.isAlive()&&c()):c()}}init(e){this.params=e;const{eParentOfValue:t}=e,s=`${DS}-cell-renderer-${this.getCompId()}`;this.getGui().setAttribute("id",s),ES(t,s),this.addDestroyFunc(()=>ES(t)),this.initGridObserver()}refresh(e=this.params){var t;this.params=e;const s=this.processData(e?.value);this.refreshAriaLabel(s);const i=this.cachedWidth,r=this.cachedHeight,n=this.gos.get("styleNonce");return!this.sparklineInstance&&e&&i>0&&r>0?(this.sparklineOptions={container:this.eSparkline,width:i,height:r,...e.sparklineOptions,...n?{styleNonce:n}:{},data:s,context:this.createContext()},(t=this.sparklineOptions).type??(t.type="line"),this.sparklineInstance=e.createSparkline(this.sparklineOptions),!0):this.sparklineInstance?(this.sparklineInstance.update({...this.sparklineOptions,data:s,width:i,height:r,context:this.createContext(),...n?{styleNonce:n}:{}}),!0):!1}refreshAriaLabel(e){const t=this.getLocaleTextFunc(),s=this.getLocaleTextFunc.bind(this),i=this.params?.sparklineOptions?.yKey??this.sparklineOptions?.yKey??"y",r=uQ(e,i),n=this.params?.sparklineOptions??this.sparklineOptions,{template:o,values:a}=dQ({translate:t,chartType:cQ(t,n),summary:r,formatNumber:l=>rQ(l,s)});sQ(this.getGui(),pQ(o,a))}processData(e){return e?.length?(this.dataRef!==e&&(this.dataRef=e,this.processedData=Array.isArray(e[0])?e.filter(t=>t!=null):e),this.processedData):e??[]}createContext(){return{data:this.params?.data,cellData:this.params?.value}}destroy(){super.destroy(),this.sparklineInstance?.destroy()}},LS="Sparklines",kS={moduleName:LS,version:G,dependsOn:[$],validate:()=>({isValid:!1,message:JJ(258)}),with:e=>(e.setup(),{moduleName:LS,version:G,dependsOn:[$],css:[QJ],userComponents:{agSparklineCellRenderer:{classImp:fQ,params:{createSparkline:e.createSparkline}}},validate:()=>({isValid:!0})})};import{BeanStub as mQ,_addGridCommonParams as _S,_mergeDeep as GS}from"ag-grid-community";import{_getLocaleTextFunc as vQ}from"ag-stack";var po=(e,t)=>t===!1||t===null?!1:OS(e)?t==="overwrite"?"overwrite":!1:typeof t=="string"?t:e==="sum"?"uniform":e==="avg"||e==null||t===!0?"overwrite":!1,OS=e=>e==="count"||e==="min"||e==="max"||e==="first"||e==="last",CQ=e=>e==="sum"||e==="avg",Qe=e=>{if(typeof e=="number")return e;if(typeof e=="bigint"||typeof e=="string"){const t=Number(e);return Number.isFinite(t)?t:0}if(typeof e=="boolean")return e?1:0;if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return Qe(e.toNumber());if("value"in e)return Qe(e.value)}return 0},NS=e=>Number.isFinite(e)?BigInt(Math.round(e)):0n,Ys=e=>{if(typeof e=="bigint")return e;if(typeof e=="number")return NS(e);if(typeof e=="boolean")return e?1n:0n;if(typeof e=="string")try{return BigInt(e)}catch{return NS(Number(e))}if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return Ys(e.toNumber());if("value"in e)return Ys(e.value)}return 0n},go=e=>{const t=typeof e;if(t==="number"||t==="bigint"||t==="boolean")return!0;if(t==="string")return Number.isFinite(Number(e));if(e!=null&&t==="object"){if(typeof e.toNumber=="function")return!0;if("value"in e)return go(e.value)}return!1},SQ=e=>{if(e.cellDataType==="bigint")return 0;const t=e.cellEditorParams;if(t==null||typeof t!="object")return;const s=t.precision;if(typeof s=="number"&&Number.isInteger(s)&&s>=0)return s;const i=t.step;if(typeof i=="number"&&Number.isInteger(i))return 0},Xc=e=>{if(e!=null&&typeof e=="object"){if(typeof e.toNumber=="function")return e.toNumber();if("value"in e)return e.value}return e},Zc=e=>{if(!go(e))return null;const t=Qe(e);return Number.isFinite(t)?t:null},ar=(e,t)=>{const s=e.aggData;return s?Zc(s[t.colId]):null},bQ=(e,t)=>Zc(e.getDataValue(t,"value")),yQ=(e,t,s)=>e?.lookupPivotResultCol(t,s)??null,qs=2,lr=(e,t)=>e==null||!t?null:e/t,wQ=e=>e==null||!Number.isFinite(e)?qs:Math.min(100,Math.max(0,e)),xQ="#N/A",FQ=e=>{if(e.notApplicable)return xQ;const t=typeof e.value=="bigint"?Number(e.value):e.value;return typeof t!="number"||!Number.isFinite(t)?"":`${(t*100).toFixed(wQ(e.precision))}%`},cr=e=>Zc(e.rawValue),TQ=e=>e.rowGroupActive||e.treeData?!0:"inapplicable",BS=e=>e.pivotActive?!0:"inapplicable",ur=e=>({transform:e,formatter:FQ}),AQ=e=>{const t=(i,r)=>vQ(e.localeSvc)(i,r),s={percentOfGrandTotal:{...ur(i=>lr(cr(i),i.grandTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfGrandTotal","% of Grand Total"),description:()=>t("percentOfGrandTotalDescription","Each value as a percentage of the column's grand total.")},percentOfColumnTotal:{...ur(i=>lr(cr(i),i.columnTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfColumnTotal","% of Column Total"),description:()=>t("percentOfColumnTotalDescription","Each value as a percentage of its column total \u2014 every column totals 100%.")},percentOfRowTotal:{...ur(i=>lr(cr(i),i.rowTotal())),displayName:()=>t("percentOfRowTotal","% of Row Total"),description:()=>t("percentOfRowTotalDescription","Each value as a percentage of the row total across the pivot columns."),applicability:BS},percentOfParentRowTotal:{...ur(i=>lr(cr(i),i.parentTotal())),defaultAggFunc:"sum",displayName:()=>t("percentOfParentRowTotal","% of Parent Row Total"),description:()=>t("percentOfParentRowTotalDescription","Each value as a percentage of its parent group."),applicability:TQ},percentOfParentColumnTotal:{...ur(i=>lr(cr(i),i.parentColumnTotal())),displayName:()=>t("percentOfParentColumnTotal","% of Parent Column Total"),description:()=>t("percentOfParentColumnTotalDescription","Each value as a percentage of its parent pivot column."),applicability:BS}};return Object.assign(Object.create(null),s)},VS=100,HS=1e4,PQ=class{constructor(e,t){this.column=e,this._beans=t}get rowGroups(){if(!this._rowGroups){const e=new Set;US(this._beans.rowGroupColsSvc?.columns,this.column,e),this._rowGroups=Array.from(e)}return this._rowGroups}get dimensions(){if(!this._dimensions){const e=new Set(this.rowGroups);US(this._beans.pivotColsSvc?.columns,this.column,e),this._dimensions=Array.from(e)}return this._dimensions}get valueColumns(){if(!this._valueColumns){const e=new Set(this.dimensions),t=this.column.colDef.pivotValueColumn??this.column,s=[],i=this._beans.valueColsSvc?.columns;for(let r=0,n=i?.length??0;r<n;++r){const o=i[r];o!==t&&!e.has(o)&&s.push(o)}this._valueColumns=s}return this._valueColumns}dimensionItems(e){const t=typeof e=="string"?e:e.getColId(),s=this._beans,i=s.pivotColsSvc?.columns;if(i&&s.colModel.isPivotActive()){for(let r=0,n=i.length;r<n;++r)if(i[r].getColId()===t)return RQ(s,r)}return MQ(s,t)}getColumn(e){return this._beans.colModel.getCol(e)??null}},RQ=(e,t)=>{const s=e.pivotResultCols?.getAggregationOrderedList();if(!s)return[];const i=new Set,r=[];for(let n=0,o=s.length;n<o&&r.length<VS;++n){const a=s[n].colDef.pivotKeys;a&&t<a.length&&!i.has(a[t])&&(i.add(a[t]),r.push(a[t]))}return r},MQ=(e,t)=>{const s=e.rowModel.rootNode,i=e.colModel.getCol(t)?.rowGroupActiveIndex??-1;if(!s||i<0)return[];let r=s.childrenAfterSort??[];for(let a=0;a<i&&r.length;++a){const l=[];for(let c=0,u=r.length;c<u&&l.length<HS;++c){const d=r[c].childrenAfterSort;if(d)for(let h=0,p=d.length;h<p&&l.length<HS;++h)l.push(d[h])}r=l}const n=new Set,o=[];for(let a=0,l=r.length;a<l&&o.length<VS;++a){const c=r[a].key;c!=null&&!n.has(c)&&(n.add(c),o.push(c))}return o},IQ=class{constructor(e,t,s,i,r,n,o){this.api=e,this.context=t,this._beans=s,this.column=i,this.type=r,this.active=n,this.columnLists=o}get currentParams(){return this.active?this.column.showValuesAs?.params:void 0}apply(e){this._beans.showValuesAsSvc?.setColumnShowValuesAs(this.column,e!=null?{type:this.type,params:e}:this.type)}},US=(e,t,s)=>{if(e)for(let i=0,r=e.length;i<r;++i){const n=e[i];n!==t&&s.add(n)}},EQ=class{constructor(e,t,s,i,r,n,o){this.api=e,this.context=t,this._beans=s,this.column=i,this.node=r,this.aggValue=n,this.params=o,this._rawValue=this}get rawValue(){let e=this._rawValue;return e===this&&(e=Xc(this.aggValue),this._rawValue=e),e}columnTotal(){const e=this.rootWithTotal();return e?ar(e,this.column):null}grandTotal(){const e=this.rootWithTotal();return e?this._beans.colModel.isPivotActive()?this.rowTotalAt(e):ar(e,this.column):null}rootWithTotal(){const e=this._beans.rowModel.rootNode;return e&&e.aggData==null&&this._beans.aggStage?.aggregateRootOnly(),e}parentTotal(){const e=this.node.parent;return e?(e.level===-1&&e.aggData==null&&this._beans.aggStage?.aggregateRootOnly(),ar(e,this.column)):null}parentColumnTotal(){const{pivotKeys:e,pivotValueColumn:t}=this.column.colDef;if(!e||!t||e.length===0)return null;const s=yQ(this._beans.pivotResultCols,e.slice(0,-1),t);return s?ar(this.node,s):null}rowTotal(){return this.rowTotalAt(this.node)}rowTotalAt(e){const t=this.column,s=t.pivotValueColumn,i=s?this._beans.pivotResultCols?.getAggregationOrderedList():null;if(s&&i){let r=0,n=!1;for(let o=0,a=i.length;o<a;++o){const l=i[o].colDef;if(l.pivotValueColumn===s&&!l.pivotTotalColumnIds){const c=ar(e,i[o]);c!=null&&(r+=c,n=!0)}}return n?r:null}return bQ(e,t)}},DQ=class extends nF{constructor(){super(...arguments),this.beanName="showValuesAsSvc"}wireBeans(e){this.colModel=e.colModel,this.rowRenderer=e.rowRenderer,this.gridApi=e.gridApi,this.gridOptions=e.gridOptions,this.groupStage=e.groupStage,this.pivotResultCols=e.pivotResultCols,this.valueColsSvc=e.valueColsSvc,this.dataTypeSvc=e.dataTypeSvc}destroy(){super.destroy(),this.cachedBuiltinModes=void 0,this.cachedResolvedBuiltinModes=void 0}resolveColumn(e,t){const s=e.colDef,i=s.showValuesAsDef;if(i===null){e.showValuesAsDef=null,this.setActive(e,null);return}if(!t&&s.showValuesAs===void 0){const a=e.showValuesAs;if(i!=null||a!=null){const l=e.showValuesAsDef?.precision??qs;if(e.showValuesAsDef=this.resolveConfig(e),a){const c=a.precision!==l?a.precision:void 0;this.applyActive(e,a.type,{type:a.type,params:a.params,precision:c})}}else e.showValuesAsDef=void 0;return}const r=this.colDefSelection(s);if(i==null&&r==null){e.showValuesAsDef=void 0,this.setActive(e,null);return}if(e.showValuesAsDef=this.resolveConfig(e),r==null){this.setActive(e,null);return}const n=typeof r=="string"?r:r.type,o=typeof r=="string"?void 0:r;n==null?this.setActive(e,null):this.applyActive(e,n,o)}colDefSelection(e){return e.showValuesAsDef===null?null:(e.showValuesAs!==void 0?e.showValuesAs:e.initialShowValuesAs)??null}get builtinModes(){return this.cachedBuiltinModes??(this.cachedBuiltinModes=AQ(this.beans)),this.cachedBuiltinModes}get resolvedBuiltinModes(){let e=this.cachedResolvedBuiltinModes;if(!e){const t=this.builtinModes;e=Object.create(null);for(const s of Object.keys(t)){const i=this.resolveMode(s,t[s],void 0);i&&(e[s]=i)}this.cachedResolvedBuiltinModes=e}return e}ensureConfig(e){e.showValuesAsDef??(e.showValuesAsDef=this.resolveConfig(e))}resolveConfig(e){const t=e.colDef.showValuesAsDef;if(t===null)return null;const s=this.resolvedBuiltinModes,i=t?.modes;let r;if(!i)r=s;else{r=Object.assign(Object.create(null),s);const n=this.builtinModes;for(const o of Object.keys(i)){const a=this.resolveMode(o,n[o],i[o]);a?r[o]=a:delete r[o]}}return{modes:r,precision:t?.precision??qs,suppressHeaderIndicator:t?.suppressHeaderIndicator}}resolveMode(e,t,s){if(s===null||s===!1)return null;let i;if(typeof s=="function"?i=s(t):s!=null&&s!==!0&&(i=s),!t&&!i)return null;const r={};GS(r,t,!0,!0),GS(r,i,!0,!0);const n=r.transformedDataType??"number",o=r.formatter??this.beans.dataTypeSvc?.getFormatValue(n)??null;return{type:e,def:r,formatter:o,transformedDataType:n}}setActive(e,t){e.showValuesAs=t}applyActive(e,t,s){const i=e.showValuesAsDef,r=i?.modes[t];if(!r){this.setActive(e,null);return}const n={type:r.type,def:r.def,formatter:r.formatter,transformedDataType:r.transformedDataType,params:s?.params,precision:s?.precision??i?.precision??qs,_applyingSig:-1,_applyingValue:!1},o=e.showValuesAs;this.setActive(e,o?Object.assign(o,n):n)}toColState(e){const t=e.showValuesAs;if(!t)return null;const{type:s,params:i,precision:r}=t,n=e.showValuesAsDef?.precision??qs;if(i===void 0&&r===n)return s;const o={type:s};return i!==void 0&&(o.params=i),r!==n&&(o.precision=r),o}isApplying(e){const t=e.showValuesAs;if(!t)return!1;const s=t.def,i=s.ready;if(i&&!i(t.params??s.params))return!1;const r=s.applicability;if(typeof r!="function")return Qc(r);const n=this.groupStage,o=this.pivotResultCols,a=(n?.grouping?1:0)|(o&&this.colModel.isPivotActive()?2:0)|(n?.treeData?4:0);if(t._applyingSig===a)return t._applyingValue;const l=Qc(r(this.buildApplicabilityParams(e)));return t._applyingSig=a,t._applyingValue=l,l}transform(e,t,s){const i=e.showValuesAs;if(!i)return s;const r=i.def,n=r.transform;if(!n)return Xc(s)??null;const o=i.params??r.params;return n(new EQ(this.gridApi,this.gridOptions.context,this.beans,e,t,s,o))??null}formatValue(e,t,s,i,r){const n=e.showValuesAs,o=n?.formatter;return o?o(_S(this.gos,{value:s,rawValue:Xc(i),aggValue:i,showValuesAsType:n.type,precision:n.precision,notApplicable:r,node:t,data:t?.data,colDef:e.colDef,column:e})):null}syncColState(e,t,s,i){const r=t?.showValuesAs,n=r!==void 0?r:s?.showValuesAs;if(n===void 0)return;const o=n!=null&&typeof n=="object"?n:void 0,a=o?o.type:n;if(!(a!=null&&e.showValuesAsDef===null)){if(a==null){if(e.showValuesAs==null)return;this.setActive(e,null)}else{const l=e.showValuesAs,c=e.showValuesAsDef?.precision??qs;if(!o&&l?.type===a&&l.params===void 0&&l.precision===c)return;this.ensureConfig(e),this.applyActive(e,a,o)}this.applyModeChangeEffects(e,i)}}getActiveModeLabel(e){const t=e.showValuesAs;return!t||!this.isApplying(e)?null:Jc(t.def,t.type)}isMenuEligible(e){const t=e.colDef;if(t.enableShowValuesAs===!1||e.showValuesAsDef===null)return!1;if(e.userProvidedColDef?.enableShowValuesAs===!0)return!0;if(t.enableShowValuesAs!==!0)return!1;if(e.aggregationActive)return!0;const s=this.dataTypeSvc?.getBaseDataType(e);return s==="number"||s==="bigint"}getMenuItems(e,t){this.ensureConfig(e);const s=e.showValuesAs?.type??null,i=[{name:t("showValuesAsNone","None"),action:()=>this.setColumnShowValuesAs(e,null),checked:s==null}];let r=null;const n=()=>(r??(r=new PQ(e,this.beans)),r),o=e.showValuesAsDef?.modes;for(const a of o?Object.keys(o):[]){const l=this.buildModeMenuItem(e,a,o[a],s,n);l&&i.push(l)}return i}buildModeMenuItem(e,t,s,i,r){const n=i===t,o=s.def,a=o.applicability;let l=!0;a!=null&&(l=typeof a=="function"?a(this.buildApplicabilityParams(e)):a);const c=LQ(l);if(c==="hidden"&&!n)return null;const u={name:Jc(o,t),checked:n,tooltip:this.modeTooltip(t,s)},d=o.menu,h=d?d(new IQ(this.gridApi,this.gridOptions.context,this.beans,e,t,n,r())):void 0;if(h&&h.length>1)u.subMenu=h;else{const p=h?.length===1?h[0]:null;u.action=p&&typeof p=="object"&&p.action?p.action:()=>this.setColumnShowValuesAs(e,t)}return c==="disabled"||c==="inapplicable"?u.disabled=!0:c!=="enabled"&&(u.cssClasses=["ag-show-values-as-inapplicable"]),u}modeTooltip(e,t){const s=Jc(t.def,e),i=zS(t.def.description);return i?`${s}: ${i}`:s}getActiveModeTooltip(e){const t=e.showValuesAs;return t?this.modeTooltip(t.type,t):null}setColumnShowValuesAs(e,t){if(t==null){if(e.showValuesAs==null)return;this.setActive(e,null)}else{const s=typeof t=="string"?t:t.type,i=typeof t=="string"?void 0:t;this.ensureConfig(e),this.applyActive(e,s,i)}this.applyModeChangeEffects(e)}applyModeChangeEffects(e,t){e.dispatchStateUpdatedEvent("showValuesAs"),this.eventSvc.dispatchEvent({type:"columnShowValuesAsChanged"}),!this.promoteToValueColumn(e,t)&&this.rowRenderer.refreshCells({columns:[e.colId],force:!0})}promoteToValueColumn(e,t="api"){const s=e.showValuesAs?.def.defaultAggFunc,i=this.valueColsSvc;return!s||e.aggregationActive||this.colModel.isPivotActive()||!i?!1:(i.setColumnAggFunc(e,s,t),!0)}buildApplicabilityParams(e){const t=this.groupStage;return _S(this.gos,{column:e,rowGroupActive:t?.hasRowGrouping?t.grouping:void 0,treeData:t?.hasTreeData?t.treeData:void 0,pivotActive:this.pivotResultCols?this.colModel.isPivotActive():void 0})}},Jc=(e,t)=>zS(e.displayName)??t,zS=e=>(typeof e=="function"?e():e)??null,Qc=e=>e==null||e===!0||e==="enabled",LQ=e=>e==="disabled"?"disabled":e===!1||e==="hide"?"hidden":Qc(e)?"enabled":"inapplicable",WS={moduleName:"ShowValuesAs",version:G,rowModels:["clientSide"],beans:[DQ],icons:{showValuesAs:"values-as"},dependsOn:[fm]},kQ=".ag-find-cell{display:block;overflow:hidden;text-overflow:ellipsis}.ag-find-match{background-color:var(--ag-find-match-background-color);color:var(--ag-find-match-color)}.ag-find-active-match{background-color:var(--ag-find-active-match-background-color);color:var(--ag-find-active-match-color)}";function _Q(e){e.findSvc?.next()}function GQ(e){e.findSvc?.previous()}function OQ(e){return e.findSvc?.totalMatches??0}function NQ(e,t,s){e.findSvc?.goTo(t,s)}function BQ(e){e.findSvc?.clearActive()}function VQ(e){return e.findSvc?.activeMatch}function HQ(e,t){const{node:s,column:i}=t;return e.findSvc?.getNumMatches(s,i)??0}function UQ(e,t){return e.findSvc?.getParts(t)??[]}function zQ(e){return e.findSvc?.refresh(!0)}import{_clearElement as WQ,_toString as $S}from"ag-stack";import{Component as $Q,_createElement as KQ}from"ag-grid-community";var jQ={tag:"span",cls:"ag-find-cell"},YQ=class extends oF{constructor(){super(jQ)}init(e){this.refresh(e)}refresh(e){const{node:t,column:s}=e,{findSvc:i,valueSvc:r}=this.beans,n=s,{value:o,valueFormatted:a}=r.getValueForDisplay({column:n,node:t,includeValueFormatted:!0,from:"edit",transformValues:n?.showValuesAs!=null}),l=a??o??"",c=this.getGui();WQ(c);const u=i?.getParts({value:l,node:t,column:s??null});if(!u)c.textContent=$S(l)??"",c.classList.remove("ag-find-cell-active-match");else{let d=!1;for(const{value:h,match:p,activeMatch:g}of u){const f=$S(h)??"";if(p){const m=KQ({tag:"mark",cls:"ag-find-match"});m.textContent=f,g&&(m.classList.add("ag-find-active-match"),d=!0),c.appendChild(m)}else c.appendChild(document.createTextNode(f))}c.classList.toggle("ag-find-cell-active-match",d)}return!0}};import{_debounce as qQ,_jsonEquals as XQ,_missing as eu,_toString as KS}from"ag-stack";import{BeanStub as ZQ,_addGridCommonParams as jS,_isClientSideRowModel as fo,_isFullWidthGroupRow as JQ,isSpecialCol as QQ}from"ag-grid-community";function YS(e){return e?.toLocaleLowerCase()}function dr(e,t,s){const i=t(KS(s));let r=0;if(i?.length){let n=-1;for(;n=i.indexOf(e,n+1),n!=-1;)r++}return r}var eee=class extends aF{constructor(){super(...arguments),this.beanName="findSvc",this.active=!1,this.topMatches=new Map,this.topNodes=[],this.topNumMatches=0,this.centerMatches=new Map,this.centerNodes=[],this.centerNumMatches=0,this.bottomMatches=new Map,this.bottomNodes=[],this.restoring=!1,this.caseFormat=YS,this.scrollOnRefresh=!1,this.totalMatches=0}postConstruct(){if(!fo(this.gos))return;const e=this.refresh.bind(this,!1),t=this.refresh.bind(this,!0),s=qQ(this,()=>{this.isAlive()&&t()},0);this.refreshDebounced=s,this.addManagedPropertyListener("findSearchValue",e),this.addManagedPropertyListener("findOptions",({currentValue:r,previousValue:n})=>{XQ(r,n)||e()}),this.addManagedPropertyListeners(["groupSuppressBlankHeader","showOpenedGroup"],t),this.addManagedEventListeners({modelUpdated:t,displayedColumnsChanged:t,pinnedRowDataChanged:t,cellValueChanged:s,rowNodeDataChanged:s,cellEditingStopped:s,cellEditValuesChanged:s,batchEditingStopped:s});const i=this.beans.rowSpanSvc;i?.active&&this.addManagedListeners(i,{spannedCellsUpdated:s}),e()}next(){this.findAcrossContainers(!1,["top",null,"bottom"],1,1)}previous(){this.findAcrossContainers(!0,["bottom",null,"top"],this.totalMatches,-1)}goTo(e,t){if(!t&&e===this.activeMatch?.numOverall)return;const{topMatches:s,topNumMatches:i,centerMatches:r,centerNumMatches:n,bottomMatches:o}=this;if(e<=i){this.goToInContainer(s,e,0);return}if(e<=n){this.goToInContainer(r,e,i);return}this.goToInContainer(o,e,i+n)}clearActive(){this.activeMatch&&this.setActive(void 0)}isMatch(e,t){return this.active&&!!this.getMatches(e.rowPinned).get(e)?.some(([s])=>s===t)}getNumMatches(e,t){return this.getMatches(e.rowPinned).get(e)?.find(([s])=>s===t)?.[1]??0}getParts(e){const{value:t,node:s,column:i,precedingNumMatches:r}=e,n=this.findSearchValue,o=KS(t)??"";if(eu(n))return[{value:o}];const a=this.caseFormat(o)??"",l=this.getActiveMatchNum(s,i)-(r??0);let c=0,u=0;const d=n.length,h=[];for(;;){const p=a.indexOf(n,c);if(p!=-1){u++,p>c&&h.push({value:o.slice(c,p)});const g=p+d;h.push({value:o.slice(p,g),match:!0,activeMatch:u===l}),c=g}else return c<o.length&&h.push({value:o.slice(c)}),h}}registerDetailGrid(e,t){const s=this.gos;if(!fo(s))return;const i=()=>s.get("findOptions")?.searchDetail,r=n=>{const a=this.centerMatches.get(e)?.[0]?.[1]??0;n!==a&&this.refreshDebounced()};t.addEventListener("findChanged",n=>{t.isDestroyed()||!this.isAlive()||!this.active||!i()||r(n.totalMatches)}),t.addEventListener("gridPreDestroyed",()=>{if(!this.isAlive()||!this.active||!i())return;const n=e.parent,o=this.findSearchValue;if(!n||!o)return;const a=s.get("detailCellRendererParams")?.getFindMatches?.({node:n,data:n.data,findSearchValue:s.get("findSearchValue"),updateMatches:this.refreshDebounced,getMatchesForValue:l=>dr(o,this.caseFormat,l)})??0;r(a)}),i()&&t.setGridOption("findSearchValue",s.get("findSearchValue"))}getState(){if(!fo(this.gos))return;const e=this.gos.get("findSearchValue")||void 0;return e?{searchValue:e,activeMatch:this.activeMatch?.numOverall}:void 0}setState({searchValue:e,activeMatch:t}){if(fo(this.gos))if(e!==void 0&&this.gos.updateGridOptions({options:{findSearchValue:e}}),t!=null){this.restoring=!0;try{this.goTo(t)}finally{this.restoring=!1}}else this.activeMatch&&this.setActive(void 0)}refresh(e){const t=new Set([...this.topNodes,...this.centerNodes,...this.bottomNodes]);this.topNodes=[],this.centerNodes=[],this.bottomNodes=[];const{topNodes:s,topMatches:i,centerMatches:r,centerNodes:n,bottomNodes:o,bottomMatches:a,beans:{gos:l,visibleCols:c,rowModel:u,valueSvc:d,pinnedRowModel:h,pagination:p,rowSpanSvc:g,masterDetailSvc:f,colModel:m},findSearchValue:v}=this,C=l.get("findOptions"),S=C?.caseSensitive?k=>k??void 0:YS;this.caseFormat=S;const w=l.get("findSearchValue"),b=S(w?.trim());this.findSearchValue=b,i.clear(),r.clear(),a.clear();const y=e?this.activeMatch:void 0;this.activeMatch=void 0;const T=l.get("masterDetail")&&C?.searchDetail&&f;if(eu(b)){if(this.active=!1,this.topNumMatches=0,this.centerNumMatches=0,this.totalMatches=0,this.refreshRows(t),T){const k=f.store;for(const M of Object.keys(k))k[M]?.api?.findClearActive()}eu(v)||this.dispatchFindChanged();return}const x=c.allCols,F=l.getCallback("isFullWidthRow"),A=l.get("detailCellRendererParams"),P=l.get("fullWidthCellRendererParams"),D=l.get("groupRowRendererParams"),N=Im(l),V=m.pivotMode;let L=0,O,K,H=!1;const Z=(k,M,re,W)=>{if(!re)return;let E=O.get(k);E||(E=[],O.set(k,E),K.push(k),W||t.add(k)),E.push([M,re]),L+=re},Y=k=>{if(H){let E=k.rowIndex,U=k.parent;for(;E==null&&U;)E=U.rowIndex,U=U.parent;if(E==null||!p.isRowInPage(E))return}const M=k.hasChildren();if(!Lm(N,k,M,V,Em(N,k,M),Dm(N,k,M)))return;const re=k.data;if(F?.({rowNode:k})){if(P){const E=P.getFindMatches?.({node:k,data:re,findSearchValue:w,updateMatches:this.refreshDebounced,getMatchesForValue:U=>dr(b,S,U)})??0;Z(k,null,E)}return}if(JQ(l,k,V)){let E;const U=D?.getFindText;if(U){const ne=d.getDisplayValue(void 0,k,"batch",!1);E=U(jS(l,{value:ne,node:k,data:re,column:null,colDef:null,getValueFormatted:()=>{const{valueFormatted:Se}=d.getValueForDisplay({node:k,includeValueFormatted:!0,from:"batch"});return Se}}))}else{const{value:ne,valueFormatted:Se}=d.getValueForDisplay({node:k,includeValueFormatted:!0,from:"batch"});E=Se??ne}const q=dr(b,S,E);Z(k,null,q);return}const W=k.level>0&&l.get("groupHideOpenParents")&&k.parent?.getFirstChild()===k&&!k.parent?.expanded;for(const E of x){if(QQ(E))continue;const U=g?.getCellSpan(E,k);if(U&&U.firstNode!==k||E.showRowGroup&&W)continue;let q;const ne=E.colDef,Se=E.showValuesAs!=null,le=Se?"edit":"batch",Ee=ne.getFindText;if(Ee){const et=d.getDisplayValue(E,k,le,Se);q=Ee(jS(l,{value:et,node:k,data:re,column:E,colDef:ne,getValueFormatted:()=>{const{valueFormatted:Xt}=d.getValueForDisplay({column:E,node:k,includeValueFormatted:!0,from:le,transformValues:Se});return Xt}}))}else{const{value:et,valueFormatted:Xt}=d.getValueForDisplay({column:E,node:k,includeValueFormatted:!0,from:le,transformValues:Se});q=Xt??et}const ms=dr(b,S,q);Z(k,E,ms)}if(k.master&&T){const E=k.detailNode;if(E){const U=E.detailGridInfo?.api;if(U){U.setGridOption("findSearchValue",w);const q=U.findGetTotalMatches();Z(E,null,q);return}}if(A){const U=A.getFindMatches?.({node:k,data:re,findSearchValue:w,updateMatches:this.refreshDebounced,getMatchesForValue:q=>dr(b,S,q)})??0;Z(E??{parent:k,dummy:!0},null,U,!E)}}};O=i,K=s,h?.forEachPinnedRow("top",Y),this.topNumMatches=L;let pe=L;O=r,K=n,L=0,H=!!p&&!!C?.currentPageOnly,u.forEachNodeAfterFilterAndSort(Y,!0),this.centerNumMatches=L,pe+=L,O=a,K=o,L=0,H=!1,h?.forEachPinnedRow("bottom",Y),pe+=L,this.totalMatches=pe,this.active=!0,this.refreshRows(t),y&&this.resetActiveMatch(y),this.dispatchFindChanged()}resetActiveMatch(e){const{column:t,numInMatch:s}=e;let i=e.node;if(i.dummy){const c=i.parent?.detailNode;if(!c)return;i=c}const r=i.rowPinned??null;if(!this.getMatches(r)?.get(i)?.some(([c,u])=>c===t&&u>=s))return;let o=0;r==null?o=this.topNumMatches:r==="bottom"&&(o=this.topNumMatches+this.centerNumMatches),(()=>{const c=this.getMatches(r);for(const u of c.keys()){const d=u===i,h=c.get(u);for(const[p,g]of h){if(d&&p===t){o+=s;return}o+=g}}})();const l={...e,node:i,numOverall:o};this.activeMatch=l,this.refreshRows(new Set([i]),t==null?void 0:new Set([t])),this.scrollOnRefresh&&(this.scrollOnRefresh=!1,this.scrollToActive(l)),this.setDetailActive(l)}refreshRows(e,t){e.size&&this.beans.rowRenderer.refreshCells({rowNodes:[...e],columns:t?[...t]:void 0,force:!0,suppressFlash:!0})}findAcrossContainers(e,t,s,i){if(!this.totalMatches){this.setActive();return}const r=this.activeMatch;let n=t;if(r){const{column:o,node:a,numInMatch:l,numOverall:c}=r,u=a.rowPinned??null,d=c+i;if(this.findInContainer(u,e,d,a,o,l))return;const p=t.indexOf(u),g=t.length;if(t.slice(p+1,g).some(m=>this.findInContainer(m,e,d)))return;n=t.slice(0,p+1)}n.some(o=>this.findInContainer(o,e,s))}findInContainer(e,t,s,i,r,n){const o=this.getMatches(e),a=this.getRowNodes(e),l=t?-1:1;if(i!=null){const h=o.get(i),p=h?.findIndex(([f])=>f===r);if(p!=null&&p!=-1){const[f,m]=h[p];if(t?n>1:n<m)return this.setActive({column:f,node:i,numInMatch:n+l,numOverall:s}),!0}const g=p!=null&&p!=-1?h?.[p+l]:void 0;if(g){const[f,m]=g;return this.setActive({column:f,node:i,numInMatch:t?m:1,numOverall:s}),!0}}let c;if(i==null)c=a[t?a.length-1:0];else{const h=a.findIndex(p=>p===i);c=a[h+l]}if(c==null)return!1;const u=o.get(c),d=u?.[t?u.length-1:0];if(d){const[h,p]=d;return this.setActive({column:h,node:c,numInMatch:t?p:1,numOverall:s}),!0}return!1}dispatchFindChanged(){const{eventSvc:e,activeMatch:t,totalMatches:s,findSearchValue:i}=this;e.dispatchEvent({type:"findChanged",activeMatch:t,totalMatches:s,findSearchValue:i})}setActive(e){if(e&&e.node.rowIndex==null&&!this.restoring){const s=e.node;let i=s.footer?s.sibling:s.parent;for(;i&&i.level!==-1;)i.expanded=!0,i=i.parent;this.activeMatch=e,this.scrollOnRefresh=!0,this.beans.expansionSvc?.onGroupExpandedOrCollapsed();return}const t=this.activeMatch;this.activeMatch=e,this.refreshAndScrollToActive(e,t),e&&this.setDetailActive(e),this.dispatchFindChanged()}setDetailActive({node:e,numInMatch:t}){e.detail&&e.detailGridInfo?.api?.findGoTo(t)}refreshAndScrollToActive(e,t){if(e||t){const s=new Set,i=new Set;let r=!1;const n=o=>{if(!o)return;const{node:a,column:l}=o;s.add(a),l==null?r=!0:i.add(l)};n(e),n(t),this.refreshRows(s,r?void 0:i)}e&&!this.restoring&&this.scrollToActive(e)}scrollToActive({node:{rowPinned:e,rowIndex:t},column:s}){const{ctrlsSvc:i,pagination:r,gos:n}=this.beans,o=i.getScrollFeature();e==null&&t!=null&&(r&&!n.get("findOptions")?.currentPageOnly&&!r.isRowInPage(t)&&r.goToPageWithIndex(t),o.ensureIndexVisible(t)),o.ensureColumnVisible(s)}goToInContainer(e,t,s){let i=s;for(const r of e.keys()){const n=e.get(r);for(const[o,a]of n){if(t<=i+a){this.setActive({column:o,node:r,numInMatch:t-i,numOverall:t});return}i+=a}}}getMatches(e){return e==="top"?this.topMatches:e==="bottom"?this.bottomMatches:this.centerMatches}getRowNodes(e){return e==="top"?this.topNodes:e==="bottom"?this.bottomNodes:this.centerNodes}getActiveMatchNum(e,t){const s=this.activeMatch;return s?.node===e&&s.column===t?s.numInMatch:0}destroy(){this.topMatches.clear(),this.topNodes.length=0,this.centerMatches.clear(),this.centerNodes.length=0,this.bottomMatches.clear(),this.bottomNodes.length=0,this.activeMatch=void 0,super.destroy()}},tee={moduleName:"FindCore",version:G,rowModels:["clientSide"],beans:[eee],userComponents:{agFindCellRenderer:YQ},css:[kQ]},qS={moduleName:"Find",version:G,apiFunctions:{findGetTotalMatches:OQ,findGoTo:NQ,findNext:_Q,findPrevious:GQ,findGetActiveMatch:VQ,findGetNumMatches:HQ,findGetParts:UQ,findClearActive:BQ,findRefresh:zQ},dependsOn:[$,tee]};import{_EditCoreModule as see}from"ag-grid-community";var iee=".ag-cell-batch-edit{background-color:var(--ag-cell-batch-edit-background-color);color:var(--ag-cell-batch-edit-text-color);display:inherit}.ag-row-batch-edit{background-color:var(--ag-row-batch-edit-background-color);color:var(--ag-row-batch-edit-text-color)}";import{_isClientSideRowModel as ree}from"ag-grid-community";function nee({editSvc:e,gos:t,rowModel:s,log:i}){if(!ree(t,s)){i.warn(289,{rowModelType:t.get("rowModelType")});return}e?.startBatchEditing()}function oee({editSvc:e}){e?.stopBatchEditing({cancel:!0,source:"api",forceCancel:!0})}function aee({editSvc:e}){e?.stopBatchEditing({source:"api",forceStop:!0,commit:!0})}function lee(e){return e.editSvc?.isBatchEditing()??!1}var XS={moduleName:"BatchEdit",version:G,beans:[],apiFunctions:{isBatchEditing:lee,startBatchEdit:nee,cancelBatchEdit:oee,commitBatchEdit:aee},dependsOn:[see,$],css:[iee]};import{ColumnApiModule as cee,TooltipModule as uee,_PopupModule as dee,_UserColumnService as hee}from"ag-grid-community";var pee=":where(.ag-calculated-column-panel .ag-panel-content-wrapper){padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-calculated-column-form{display:flex;flex:1 1 auto;flex-direction:column;gap:calc(var(--ag-spacing)*2);min-height:0;min-width:260px}.ag-calculated-column-expression-wrap{display:flex;flex:1 1 auto;flex-direction:column;gap:var(--ag-spacing)}.ag-calculated-column-expression-wrap :where(.ag-text-area){flex:1 1 auto}.ag-calculated-column-expression-wrap :where(.ag-text-area-input-wrapper){height:100%}.ag-calculated-column-expression-wrap .ag-text-area-input{height:100%;padding-top:calc(var(--ag-spacing)/2);resize:none}.ag-rtl .ag-calculated-column-expression-wrap .ag-text-area-input{direction:ltr;padding-left:var(--ag-input-padding-start)}.ag-calculated-column-expression-tools{display:flex;:where(.ag-field-set-wrapper){align-items:center;flex-wrap:nowrap;gap:var(--ag-spacing);justify-content:end}}:where(.ag-ltr) .ag-calculated-column-expression-tools{:where(.ag-label){text-align:right}}:where(.ag-rtl) .ag-calculated-column-expression-tools{:where(.ag-label){text-align:left}}.ag-standard-button.ag-calculated-column-expression-tool{padding:calc(var(--ag-spacing)/2)}.ag-calculated-column-suggestion-path{align-items:center;display:flex;gap:calc(var(--ag-spacing)/2)}.ag-calculated-column-suggestion-parent{min-width:0;overflow:hidden;text-overflow:ellipsis}.ag-calculated-column-suggestion-parent,.ag-calculated-column-suggestion-separator{color:var(--ag-calculated-column-parent-suggestion-color)}.ag-calculated-column-suggestion-separator{flex:none}.ag-calculated-column-suggestion-leaf{flex:none;overflow:hidden}.ag-calculated-column-picker-list{width:var(--ag-calculated-column-suggestion-list-width)}.ag-calculated-column-actions{display:flex;gap:calc(var(--ag-spacing)/2);justify-content:flex-end}.ag-calculated-column-action{min-width:72px}.ag-calculated-column-highlighted{background-color:var(--ag-calculated-column-highlight-color)}";import{_camelCaseToHumanText as gee,_findFocusableElements as fee,_getActiveDomElement as mee,_getDocument as vee,_isStringLargerThan as tu,_requestAnimationFrame as Cee}from"ag-stack";import{BeanStub as See,_addColumnDefaultAndTypes as bee,_createUserColumn as yee,_isCalculatedColumnsEnabled as wee,_mergedEqual as ZS,_normaliseCalculatedExpression as su,_warnOnce as mo}from"ag-grid-community";import{RefPlaceholder as gt,_getDocument as JS,_setAriaActiveDescendant as QS,_setAriaAutoComplete as xee,_setAriaControls as vo,_setAriaExpanded as iu,_setAriaHasPopup as eb,_setAriaInvalid as Fee,_setDisplayed as Co}from"ag-stack";import{AgFieldSetSelector as Tee,AgInputTextAreaSelector as Aee,AgInputTextFieldSelector as Pee,AgSelectSelector as Ree,Component as Mee,KeyCode as ft}from"ag-grid-community";import{_isHorizontalScrollShowing as tb}from"ag-stack";import{Component as Iee}from"ag-grid-community";var sb="\u203A",Eee={tag:"div",cls:"ag-autocomplete-row ag-calculated-column-suggestion",role:"presentation",children:[{tag:"div",cls:"ag-autocomplete-row-label ag-calculated-column-suggestion-label"}]},Dee=class extends lF{constructor(){super(Eee),this.tooltipValue=null}postConstruct(){this.tooltipFeature=this.createOptionalManagedBean(this.beans.tooltipSvc?.createHighlightTooltip({getGui:()=>this.getGui(),getTooltipComponentDefinition:()=>{},getTooltipValue:()=>this.tooltipValue,getLocation:()=>"calculatedColumnAutocomplete",shouldDisplayTooltip:()=>this.isTruncated()},this))}setState(e,t){this.suggestion=e,this.render(),this.updateSelected(t)}updateSelected(e){this.toggleCss("ag-autocomplete-row-selected",e),this.dispatchLocalEvent({type:"itemHighlighted",highlighted:e})}setSearchString(e){}render(){const e=this.suggestion,t=this.getGui(),s=t.lastElementChild;s.textContent="",s.classList.remove("ag-calculated-column-suggestion-path"),t.removeAttribute("aria-label");const i=e.displayPath;if(e.type!=="column"||!i||i.length<2){s.textContent=e.label,this.tooltipValue=e.label,this.tooltipFeature?.setTooltipAndRefresh(this.tooltipValue);return}s.classList.add("ag-calculated-column-suggestion-path");const r=i.join(` ${sb} `);t.setAttribute("aria-label",r),this.tooltipValue=r;const n=t.ownerDocument,o=i.length-1;for(let a=0,l=i.length;a<l;++a){const c=a===o,u=n.createElement("span");if(u.className=c?"ag-calculated-column-suggestion-leaf":"ag-calculated-column-suggestion-parent",u.textContent=i[a],s.appendChild(u),!c){const d=n.createElement("span");d.className="ag-calculated-column-suggestion-separator",d.textContent=sb,s.appendChild(d)}}this.tooltipFeature?.setTooltipAndRefresh(this.tooltipValue)}isTruncated(){const e=this.getGui().lastElementChild;if(tb(e))return!0;const t=e.children;for(const s of t)if(tb(s))return!0;return!1}};import{_DATA_TYPE_DERIVED_COL_DEF_PROPERTIES as Lee}from"ag-grid-community";var ru=["headerName","cellDataType","calculatedExpression","columnGroupShow"];function nu(e){const t={};for(let s=0,i=ru.length;s<i;++s){const r=ru[s];r in e&&(t[r]=e[r])}return t}function kee(e,t,s){if(s.cellDataType===void 0||s.cellDataType===e.cellDataType)return e;const i={...e};for(const r of Lee)s[r]===void 0&&t?.[r]===void 0&&delete i[r];return i}function So(e,t){let s=!1,i="",r=0;for(let n=0;n<e.length;n++){const o=e[n];if(o==='"'){e[n+1]==='"'?n++:s=!s;continue}if(!s&&o==="["){const a=e.indexOf("]",n+1);if(a===-1)continue;i+=e.slice(r,n),i+=`[${t(e.slice(n+1,a))}]`,r=a+1,n=a}}return i+e.slice(r)}function _ee(e,t,s,i){const r=Math.min(t,s),n=Math.max(t,s);if(r!==n)return Gee(e.slice(r,n).trim(),i)?ib(e,r,n):{start:r,end:n};if(rb(e,r)||Vee(e,r))return{start:r,end:n};const o=Oee(e,r,i);return o?ib(e,o.start,o.end):{start:r,end:n}}function Gee(e,t){for(let s=0,i=t.length;s<i;++s)if(t[s]===e)return!0;return!1}function Oee(e,t,s){const i=ou(e,t,s);if(i)return i;const r=Nee(e,t);if(r!=null){const o=ou(e,r,s);if(o)return o}const n=Bee(e,t);return n!=null?ou(e,n,s):null}function ou(e,t,s){for(let i=0,r=s.length;i<r;++i){const n=s[i];for(let o=0,a=n.length;o<a;++o){const l=t-o;if(l>=0&&e.startsWith(n,l))return{start:l,end:l+a}}}return null}function ib(e,t,s){for(;t>0&&e[t-1].trim()==="";)t--;for(;s<e.length&&e[s].trim()==="";)s++;return{start:t,end:s}}function Nee(e,t){for(let s=t-1;s>=0;--s)if(e[s].trim()!=="")return s;return null}function Bee(e,t){for(let s=t,i=e.length;s<i;++s)if(e[s].trim()!=="")return s;return null}function Vee(e,t){const s=e.lastIndexOf("[",t-1),i=e.lastIndexOf("]",t-1);return s>i}function rb(e,t){let s=!1;for(let i=0;i<t&&i<e.length;++i)if(e[i]==='"'){if(e[i+1]==='"'){i++;continue}s=!s}return s}var bo={cellDataType:"text",calculatedExpression:""},Hee=["text","number","date","boolean"],Uee=["columns","functions","operators"],nb=["+","-","*","/","^","&","=","<>",">",">=","<","<="],zee=[...nb].sort((e,t)=>t.length-e.length),Wee=nb.map(e=>({type:"operator",label:e,value:e})),$ee=6,Kee="ag-calculated-column-picker-list";function ob(e){return e.displayPath!=null&&e.displayPath.length>=2?e.searchText??e.label:e.label}var jee={tag:"div",cls:"ag-calculated-column-form",children:[{tag:"ag-input-text-field",ref:"eTitle"},{tag:"ag-select",ref:"eType"},{tag:"div",cls:"ag-calculated-column-expression-wrap",children:[{tag:"ag-input-text-area",ref:"eExpression"},{tag:"ag-field-set",cls:"ag-calculated-column-expression-tools",ref:"eExpressionTools",children:[{tag:"button",ref:"eColumns",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"},{tag:"button",ref:"eFunctions",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"},{tag:"button",ref:"eOperators",cls:"ag-button ag-standard-button ag-calculated-column-expression-tool"}]}]},{tag:"div",ref:"eActions",cls:"ag-calculated-column-actions",children:[{tag:"button",ref:"eApply",cls:"ag-button ag-standard-button ag-calculated-column-action ag-calculated-column-action-apply"},{tag:"button",ref:"eCancel",cls:"ag-button ag-standard-button ag-calculated-column-action"}]}]},Yee=class extends cF{constructor(e,t,s,i,r,n,o,a,l,c){super(jee,[Pee,Ree,Aee,Tee]),this.draft=e,this.dataTypeOptions=t,this.getColumnSuggestions=i,this.getFunctionSuggestions=r,this.onValidate=n,this.onApply=o,this.onCancel=a,this.liveApply=l,this.onDraftChange=c,this.eTitle=gt,this.eType=gt,this.eExpression=gt,this.eColumns=gt,this.eFunctions=gt,this.eOperators=gt,this.eApply=gt,this.eCancel=gt,this.eActions=gt,this.eExpressionTools=gt,this.activeReplacement=null,this.suggestionSource=null,this.titleValidationMessage=null,this.expressionValidationMessage=null,this.autocompleteList=null,this.suggestionType=null,this.suggestionSourceType=null,this.openSuggestions=[],this.expressionSelection=null,this.expressionPickers=new Set(s)}postConstruct(){this.setupFormFields(),this.setupAria(),this.setupActionButtons(),this.liveApply||this.setupValidationTooltips(),this.addFormFieldListeners(),this.setupExpressionEditor(),this.addActionListeners(),this.addFormListeners(),this.addDestroyFunc(()=>this.closeSuggestionPopup())}hideSuggestions(){this.activeReplacement=null,this.closeSuggestionPopup()}setupFormFields(){const e=this.getLocaleTextFunc(),t=this.eType.showPicker.bind(this.eType);this.eType.showPicker=()=>{this.hideSuggestions(),t()},this.eTitle.setLabel(e("calculatedColumnTitle","Title")).setLabelAlignment("top").setValue(this.draft.headerName,!0),this.eType.setLabel(e("calculatedColumnType","Type")).setLabelAlignment("top").addOptions(this.dataTypeOptions).setValue(this.draft.cellDataType,!0),this.eExpression.setLabel(e("calculatedColumnExpression","Expression")).setLabelAlignment("top").setAutoComplete(!1).setInputPlaceholder(e("calculatedColumnExpressionPlaceholder","Type here")).setRows(3).setValue(this.draft.calculatedExpression,!0),this.eExpressionTools.setDirection("horizontal").setLabelWidth("flex").setLabel(e("calculatedColumnExpressionToolsLabel","Insert")).setLabelSeparator(":")}setupAria(){const e=String(this.gos.get("tabIndex")),t=this.eExpression.getInputElement();xee(t,"list"),eb(t,"listbox");const s=[this.eColumns,this.eFunctions,this.eOperators];for(const i of s)i.setAttribute("tabindex",e),eb(i,"listbox"),iu(i,!1)}setupActionButtons(){const e=this.getLocaleTextFunc(),t=["Columns","Functions","Operators","Apply","Cancel"];for(const n of t){const o=this[`e${n}`];o.textContent=e(`calculatedColumn${n}`,n),o.type="button"}const s=this.expressionPickers.has("columns"),i=this.expressionPickers.has("functions"),r=this.expressionPickers.has("operators");Co(this.eColumns,s),Co(this.eFunctions,i),Co(this.eOperators,r),this.eExpressionTools.setDisplayed(s||i||r),Co(this.eActions,!this.liveApply)}addFormFieldListeners(){const e=this.draft.headerName;this.eTitle.onValueChange(t=>{if(this.liveApply){this.updateDraft({headerName:t||e});return}this.updateDraft({headerName:t??""}),this.setTitleError(this.validateTitle())}),this.eType.onValueChange(t=>{this.updateDraft({cellDataType:t??this.dataTypeOptions[0]?.value??bo.cellDataType})}),this.eExpression.onValueChange(t=>{this.updateDraft({calculatedExpression:t??""}),this.liveApply||this.setExpressionError(this.onValidate(this.draft)),this.refreshContextSuggestions()})}setupExpressionEditor(){const e=this.eExpression.getInputElement();e.setAttribute("spellcheck","false"),this.addManagedElementListeners(e,{click:()=>{this.rememberExpressionSelection(),this.refreshContextSuggestions()},input:()=>this.rememberExpressionSelection(),keydown:t=>this.onExpressionKeyDown(t),keyup:t=>this.onExpressionKeyUp(t),select:()=>this.rememberExpressionSelection()})}addActionListeners(){const e=this.expressionPickers,t=[["columns","column",this.eColumns],["functions","function",this.eFunctions],["operators","operator",this.eOperators]];for(const s of t){const[i,r,n]=s;e.has(i)&&this.addManagedElementListeners(n,{mousedown:()=>this.rememberExpressionSelection(),click:()=>this.openPicker(r,n)})}this.liveApply||(this.addManagedElementListeners(this.eApply,{click:()=>{const s=this.validateTitle();this.setTitleError(s),s==null&&this.setExpressionError(this.onApply(this.draft))}}),this.addManagedElementListeners(this.eCancel,{click:()=>this.onCancel()}))}addFormListeners(){this.addManagedElementListeners(this.getGui(),{keydown:e=>{e.target!==this.eExpression.getInputElement()&&this.onSuggestionKeyDown(e)},focusout:()=>window.setTimeout(()=>{this.getGui().contains(JS(this.beans).activeElement)||this.hideSuggestions()},0)})}validateTitle(){return this.draft.headerName.trim().length>0?null:this.getLocaleTextFunc()("calculatedColumnTitleEmpty","Enter a title")}setTitleError(e){this.titleValidationMessage=e;const t=this.eTitle.getInputElement();this.applyFieldError(t,e),this.titleTooltipFeature?.setTooltipAndRefresh(e),t.setAttribute("title","")}setExpressionError(e){this.expressionValidationMessage=e;const t=this.eExpression.getInputElement();this.applyFieldError(t,e),this.expressionTooltipFeature?.setTooltipAndRefresh(e),t.setAttribute("title","")}applyFieldError(e,t){const s=!!t;e.setCustomValidity(t??""),e.classList.toggle("invalid",s),Fee(e,s),this.eApply.disabled=!!this.titleValidationMessage||!!this.expressionValidationMessage}setupValidationTooltips(){this.titleTooltipFeature=this.createValidationTooltip(()=>this.eTitle.getInputElement(),()=>this.titleValidationMessage),this.expressionTooltipFeature=this.createValidationTooltip(()=>this.eExpression.getInputElement(),()=>this.expressionValidationMessage)}createValidationTooltip(e,t){return this.createOptionalManagedBean(this.beans.tooltipSvc?.createTooltip({getGui:e,getTooltipComponentDefinition:()=>{},getTooltipValue:t,getLocation:()=>"calculatedColumnExpression",shouldDisplayTooltip:()=>!!t()}))}updateDraft(e){this.draft={...this.draft,...e},this.onDraftChange?.(this.draft)}rememberExpressionSelection(){const e=this.eExpression.getInputElement(),t=e.value.length,s=e.selectionStart??t,i=e.selectionEnd??s;this.expressionSelection={start:s,end:i}}refreshContextSuggestions(){const e=this.eExpression.getInputElement(),t=e.value,s=e.selectionStart??t.length,i=t.lastIndexOf("[",s-1),r=t.lastIndexOf("]",s-1);if(i>r){const o=t.slice(i+1,s);this.showSuggestions("column",o,{start:i,end:s},e,"inline");return}const n=this.getFunctionToken(t,s);if(n){this.showSuggestions("function",n.prefix,{start:n.start,end:n.end},e,"inline");return}this.activeReplacement&&this.hideSuggestions()}openPicker(e,t){this.rememberExpressionSelection(),this.showSuggestions(e,"",this.expressionSelection,t,"picker")}getSuggestionsForType(e){return e==="column"?this.getColumnSuggestions():e==="function"?this.getFunctionSuggestions():Wee}showSuggestions(e,t,s,i,r){this.eType.hidePicker();const n=this.getSuggestionsForType(e),o=t.toLocaleLowerCase();if(!(!o||n.some(l=>ob(l).toLocaleLowerCase().includes(o)))){this.hideSuggestions();return}this.activeReplacement=s,this.suggestionSource=i,this.suggestionSourceType=r,this.openSuggestionPopup(e,n),this.autocompleteList?.setSearch(t),this.refreshAriaForSuggestions(),this.positionSuggestionPopup()}refreshAriaForSuggestions(){if(!this.autocompleteList||!this.suggestionSource){this.clearAriaForSuggestions();return}const e=this.autocompleteList.getListId(),t=this.eExpression.getInputElement(),s=this.suggestionSourceType==="inline",i=s?this.autocompleteList.getActiveOptionId():null,r=i&&JS(this.beans).getElementById(i)?i:null;vo(t,s?e:null),QS(t,r);for(const n of[this.eColumns,this.eFunctions,this.eOperators]){const o=this.suggestionSourceType==="picker"&&this.suggestionSource===n;iu(n,o),vo(n,o?e:null)}}clearAriaForSuggestions(){const e=this.eExpression.getInputElement();vo(e,null),QS(e,null);for(const t of[this.eColumns,this.eFunctions,this.eOperators])iu(t,!1),vo(t,null)}openSuggestionPopup(e,t){const s=this.beans.popupSvc;if(!s||(this.autocompleteList&&this.suggestionType!==e&&this.closeSuggestionPopup(),this.autocompleteList))return;this.suggestionType=e,this.openSuggestions=t;const i=this.createManagedBean(new ga({autocompleteEntries:this.createAutocompleteEntries(t),onConfirmed:()=>this.confirmSelectedSuggestion(),autoSizeList:!0,maxVisibleItems:$ee,onListHeightChanged:()=>this.positionSuggestionPopup(),onActiveOptionChanged:()=>this.refreshAriaForSuggestions(),rowComponentCreator:e==="column"?(r,n)=>this.createColumnSuggestionRow(r,n):void 0}));this.autocompleteList=i,this.hideSuggestionPopup=s.addPopup({eChild:i.getGui(),positionCallback:()=>this.positionSuggestionPopup(),alwaysOnTop:!0,ariaLabel:this.getLocaleTextFunc()("calculatedColumnSuggestions","Calculated Column Suggestions")}).hideFunc,i.afterGuiAttached(),this.refreshAriaForSuggestions()}createAutocompleteEntries(e){const t=[];for(let s=0,i=e.length;s<i;++s){const r=e[s],n={key:`${s}`,displayValue:ob(r),suggestion:r};t.push(n)}return t}createColumnSuggestionRow(e,t){const s=new Dee;return s.setState(e.suggestion,t),s}positionSuggestionPopup(){const e=this.suggestionSource,t=this.autocompleteList,s=this.beans.popupSvc;if(!e||!t||!s)return;const i=t.getGui(),r=this.suggestionSourceType==="picker";if(i.classList.toggle(Kee,r),r){i.style.width="";const n=this.getGui().offsetWidth;n>0&&(i.style.maxWidth=`${n}px`)}else{const n=this.eExpression.getInputElement().offsetWidth;n>0&&(i.style.width=`${n}px`),i.style.maxWidth=""}s.positionPopupByComponent({ePopup:i,type:"calculatedColumnAutocomplete",eventSource:e,position:"under",alignSide:this.gos.get("enableRtl")?"right":"left",keepWithinBounds:!0}),s.bringPopupToFront(i)}confirmSelectedSuggestion(){const e=this.autocompleteList?.getSelectedValue(),t=e?this.openSuggestions[Number(e.key)]:void 0;t?this.acceptSuggestion(t):this.hideSuggestions()}closeSuggestionPopup(){this.clearAriaForSuggestions(),this.suggestionSource=null,this.suggestionType=null,this.suggestionSourceType=null,this.openSuggestions=[],this.hideSuggestionPopup?.(),this.hideSuggestionPopup=void 0,this.autocompleteList&&(this.destroyBean(this.autocompleteList),this.autocompleteList=null)}onExpressionKeyDown(e){this.onSuggestionKeyDown(e)}onSuggestionKeyDown(e){const t=this.autocompleteList;if(t)switch(e.key){case ft.ESCAPE:e.preventDefault(),e.stopPropagation(),this.hideSuggestions();return;case ft.UP:case ft.DOWN:e.stopPropagation(),t.onNavigationKeyDown(e,e.key);return;case ft.TAB:case ft.ENTER:e.preventDefault(),e.stopPropagation(),this.confirmSelectedSuggestion();return}}onExpressionKeyUp(e){switch(e.key){case ft.ESCAPE:case ft.UP:case ft.DOWN:case ft.TAB:case ft.ENTER:return}this.refreshContextSuggestions()}acceptSuggestion(e){const t=this.eExpression.getInputElement(),s=t.value,i=this.getSuggestionInsertText(e),r=this.activeReplacement??this.expressionSelection,n=r?.start??t.selectionStart??s.length,o=r?.end??t.selectionEnd??n,{start:a,end:l}=e.type==="operator"?_ee(s,n,o,zee):{start:n,end:o},c=`${s.slice(0,a)}${i}${s.slice(l)}`;this.eExpression.setValue(c);const u=e.type==="function"&&i.endsWith("()")?a+i.length-1:a+i.length;t.setSelectionRange(u,u),this.expressionSelection={start:u,end:u},t.focus(),this.hideSuggestions()}getSuggestionInsertText(e){switch(e.type){case"column":return`[${e.value}]`;case"function":return`${e.value}()`;case"operator":return` ${e.value} `}}getFunctionToken(e,t){if(rb(e,t))return null;let s=t;for(;s>0&&/[A-Za-z0-9_.]/.test(e[s-1]);)s--;let i=t;for(;i<e.length&&/[A-Za-z0-9_.]/.test(e[i]);)i++;if(s===i||!/[A-Za-z_]/.test(e[s]))return null;const r=this.getPreviousNonSpaceChar(e,s);return r!=null&&!"([,+-*/^&=<>".includes(r)?null:{start:s,end:i,prefix:e.slice(s,t)}}getPreviousNonSpaceChar(e,t){for(let s=t-1;s>=0;s--)if(e[s]!==" ")return e[s];return null}};import{isSpecialCol as qee}from"ag-grid-community";function Xee(e,t,s){const i=t.filter(n=>n.getColId()!==s).map(n=>{const o=Jee(e,n);return{column:n,colId:n.getColId(),leafName:o[o.length-1],path:o,reference:""}}),r=new Map;for(const n of i)for(const o of au(n.path))r.set(o,(r.get(o)??0)+1);for(const n of i){const o=au(n.path).find(a=>r.get(a)===1);if(o){n.reference=o;continue}n.reference=`${lb(n.path)} (${Qee(n.colId)})`}return i}function Zee(e,t,s=!1){const i=new Set(e.map(o=>lu(o.reference,s))),r=new Map,n=lu(t,s);for(let o=0,a=e.length;o<a;++o){const l=au(e[o].path);for(let c=0,u=l.length;c<u;++c){const d=lu(l[c],s);r.set(d,(r.get(d)??0)+1)}}return(r.get(n)??0)>1&&!i.has(n)}function Jee(e,t){const s=ab(e.colNames.getDisplayNameForColumn(t,"header"),t.getColId()),i=[];let r=t.getOriginalParent();for(;r;)r.isPadding()||i.unshift(ab(e.colNames.getDisplayNameForProvidedColumnGroup(null,r,"header"),r.getGroupId())),r=r.getOriginalParent();return[...i,s]}function ab(e,t){return e?.trim()||t.trim()||t}function au(e){const t=[];for(let s=e.length-1;s>=0;s--){const i=lb(e.slice(s));i&&t.push(i)}return t}function lb(e){return e.filter(Boolean).join(" ")}function Qee(e){return encodeURIComponent(e)}function lu(e,t){return t?e.toLocaleLowerCase():e}function cb(e,t){const[s,i]=e.type==="ambiguous"?["calculatedColumnExpressionAmbiguousReference",'Ambiguous column reference "${variable}". Use the Columns list or a more specific group path.']:["calculatedColumnExpressionUnknownReference",'Unknown column reference "${variable}".'];return t(s,i,[e.reference]).replace("${variable}",e.reference)}function ub(e,t,s){const i=t.filter(l=>!qee(l)),r=Xee(e,i,s),n=new Map(r.map(l=>[l.reference,l.colId])),o=new Map,a=new Map(r.map(l=>[l.colId,l.reference]));for(let l=0,c=r.length;l<c;++l){const u=r[l],d=cu(u.reference),h=o.get(d)??[];h.push(u.colId),o.set(d,h)}return{suggestions:r.map(({leafName:l,path:c,reference:u})=>({type:"column",label:u,value:u,searchText:`${u} ${l}`,displayPath:c})),toInternalExpression(l){let c;const u=So(l,d=>{const h=n.get(d);if(h!=null)return h;const p=o.get(cu(d)),g=p?.length===1?p[0]:void 0;if(g!=null)return g;const f=(p?.length??0)>1||Zee(r,d,!0);return c??(c={type:f?"ambiguous":"unknown",reference:d}),d});return c!==void 0?{error:c}:{expression:u}},toInternalExpressionBestEffort(l){return So(l,c=>{const u=n.get(c);if(u!=null)return u;const d=o.get(cu(c));return d?.length===1?d[0]:c})},toDisplayExpression(l){return So(l,c=>a.get(c)??c)}}}function cu(e){return e.toLocaleLowerCase()}var ete=256;function yo(e){return e?.getFirstRealParent()?.groupId??null}var tte={text:"dataTypeText",number:"dataTypeNumber",bigint:"dataTypeBigInt",boolean:"dataTypeBoolean",date:"dataTypeDate",dateString:"dataTypeDateString",dateTime:"dataTypeDateTime",dateTimeString:"dataTypeDateTimeString",object:"dataTypeObject"},ste=class extends uF{constructor(){super(...arguments),this.beanName="calculatedColsSvc",this.dynamicColumns=new Map,this.inactiveDynamicColumns=new Map,this.lastCalculatedColIndex=0,this.validationStatesByColId=new Map,this.validationStatesInitialised=!1,this.lifecycleInitialised=!1,this.knownCalculatedColumns=new Map,this.suppressValidationChecks=0,this.openDialogsByColId=new Map,this.scheduledLiveApplyColIds=new Set,this.pendingLiveApplyUpdatesByColId=new Map,this.formulaErrorsByExpression=new Map}postConstruct(){this.userColumnSvc=this.beans.userColumnSvc,this.userColumnSvc.registerOwner(()=>this.isEnabled(),ru),this.addManagedEventListeners({newColumnsLoaded:e=>{this.checkColumnLifecycle(e.source),this.checkValidationStates(e.source)}}),this.addManagedPropertyListener("calculatedColumns",()=>{this.isEnabled()||this.clearDynamicColumnInstances(),this.refreshDynamicColumns("gridOptionsChanged"),this.refreshOpenDialogHighlights()})}isEnabled(){return wee(this.gos.get("calculatedColumns"))}isHighlightedColumn(e){return e!=null&&this.isEnabled()&&this.getOptions()?.suppressColumnHighlighting!==!0&&this.openDialogsByColId.get(e.colId)?.highlight===!0}refreshCalculatedColumnHighlight(e){if(e==null)return;const t=this.beans.rowRenderer.getCellCtrls(null,[e]);for(const s of t)s.refreshCalculatedColumnCss();this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.refresh()}refreshOpenDialogHighlights(){const e=this.beans.colModel.colsById;for(const[t,s]of this.openDialogsByColId)s.highlight&&this.refreshCalculatedColumnHighlight(e[t]??null)}updateCalculatedColumn(e,t,s=!0){if(!this.isEnabled())return;const i="calculatedColumn",{colModel:r}=this.beans,n=r.getCol(e);if(!n?.isCalculatedCol)return;const o=n.colDef.calculatedExpression,a={...t},l=su(a.calculatedExpression);if(l!==void 0){if(a.calculatedExpression=l,s&&!tu(l,0,!0)){mo("updateCalculatedColumn: calculatedExpression cannot be empty.");return}if(s&&(!this.validateColumnReferences(l)||!this.validateFormulaExpression(l)))return}const c=n.colId,u=this.getUpdatedCalculatedColDef(n,a),d=bee(this.beans,u,c);if(!ZS(d,n.colDef)){const f=this.dynamicColumns.get(c);f?(f.colDef=u,this.recordCreatedColumn(c,u,this.userColumnSvc.getEntry(c)?.parentGroupId??null)):this.setDeclaredColOverride(n,u),this.refreshDynamicColumns(i),l!==void 0&&this.beans.formula?.refreshFormulas(!1)}const p=r.colsById[c]??n,g=p.colDef.calculatedExpression??"";l!==void 0&&o!==g&&this.dispatchExpressionChangedEvent(this.getEventCommonParams(p,g,i),o??""),s&&this.checkValidationStates(i,!0),this.refreshCalculatedColumn(c)}getFormulaError(e){const t=this.formulaErrorsByExpression,s=t.get(e);if(s!==void 0)return s;t.size>=ete&&t.clear();const i=this.beans.formula?.validateExpression(`=${e}`)??null;return t.set(e,i),i}getFormulaExpressionError(e){return this.getFormulaError(e)?.getTranslatedMessage(this.getLocaleTextFunc())??null}validateFormulaExpression(e){const t=this.getFormulaExpressionError(e);return t?(mo(t),!1):!0}getInvalidColumnReference(e){const t=this.beans.colModel.colsById;let s;return So(e,i=>(s==null&&!t[i]&&(s=i),i)),s}validateColumnReferences(e){const t=this.getInvalidColumnReference(e);return t!=null?(mo(cb({type:"unknown",reference:t},this.getLocaleTextFunc())),!1):!0}openCalculatedColumnDialog(e,t,s=!0,i){if(!this.isEnabled())return;const r=this.isLiveApplyMode();if(t==="add"){const a=this.createUniqueColId(),l=this.getLocaleTextFunc()("calculatedColumnDefaultTitle","Untitled"),c={colId:a,headerName:l,...this.getDefaultDraft()};if(r){const u=this.addDynamicCalculatedColumn(c,e);u&&this.showDialog(c,()=>null,!0,u,s,void 0,i,e);return}this.showDialog(c,u=>{this.addDynamicCalculatedColumn(u,e)&&this.focusCalculatedColumn(u.colId)},!1,void 0,s,void 0,i,e);return}if(!e?.isCalculatedCol)return;const n=ub(this.beans,this.beans.colModel.colsList,e.colId),o=this.toDraft(e,n);this.showDialog(o,a=>{const{colId:l,...c}=this.toColDef(a);this.updateCalculatedColumn(e.colId,c)},r,e,s,n,i,e)}addDynamicCalculatedColumn(e,t){const s=e.colId,i=this.toColDef(e),r=t?.colDef.columnGroupShow;r!=null&&(i.columnGroupShow=r),this.inactiveDynamicColumns.delete(s),this.dynamicColumns.set(s,{colDef:i,anchorColId:t?.colId??null,instance:null}),this.recordCreatedColumn(s,i,yo(t)),this.refreshDynamicColumns("calculatedColumn");const n=this.beans.colModel.colsById[s];return n&&this.dispatchCreatedOrRemovedEvent("calculatedColumnCreated",this.getEventCommonParams(n,e.calculatedExpression,"calculatedColumn")),this.checkValidationStates("calculatedColumn",!0),n??void 0}removeCalculatedColumn(e){if(!this.isEnabled()||!e?.isCalculatedCol)return;const t="calculatedColumn",s=e.colDef.calculatedExpression??"",i=e.colId;this.closeCalculatedColumnDialog(i);const r=this.dynamicColumns.delete(i);if(r)for(const n of this.dynamicColumns.values())n.anchorColId===i&&(n.anchorColId=null);this.userColumnSvc.removeColumn(i,!r),this.refreshDynamicColumns(t),this.dispatchCreatedOrRemovedEvent("calculatedColumnRemoved",this.getEventCommonParams(e,s,t)),this.checkValidationStates(t,!0)}recordCreatedColumn(e,t,s){this.userColumnSvc.setCreatedColumn(e,nu(t),s)}isLiveApplyMode(){return this.getOptions()?.applyMode!=="deferred"}getOptions(){const e=this.gos.get("calculatedColumns");return typeof e=="object"&&e!=null?e:void 0}setDeclaredColOverride(e,t){const s=this.userColumnSvc,i=e.colId,r=nu(s.getDeclaredDef(i)??{}),n=nu(t),o={},a=Object.keys(n);for(let c=0,u=a.length;c<u;++c){const d=a[c];n[d]!==r[d]&&(o[d]=n[d])}const l=Object.keys(r);for(let c=0,u=l.length;c<u;++c){const d=l[c];d in n||(o[d]=void 0)}Object.keys(o).length?s.setOverride(i,o):s.clearColumn(i)}contributeTo(e){if(!this.isEnabled())return;const{dynamicColumns:t}=this,s=this.userColumnSvc;if(t.size===0)return;const i=e.source,r=e.buildToken,n=e.newColDefs;t.forEach((o,a)=>{const l=this.getOrCreateColumn(o,a,r,i,n);l.buildToken=r;const c=o.anchorColId;c!=null&&c!==a&&!s.getEntry(c)?.removed?(l.anchoredToColId=c,tv(e,l,c)):(l.anchoredToColId=void 0,tv(e,l))})}clearDynamicColumnInstances(){this.dynamicColumns.forEach(e=>{e.instance=null})}resetDynamicColumnDefs(e=!1){return e||this.inactiveDynamicColumns.clear(),this.dynamicColumns.size?(e&&this.dynamicColumns.forEach((t,s)=>{t.parentGroupId=yo(t.instance),t.instance=null,this.inactiveDynamicColumns.set(s,t)}),this.dynamicColumns.clear(),!0):!1}adoptUserColumns(){if(!this.isEnabled())return!1;const e=this.userColumnSvc,t=this.dynamicColumns,s=n=>{const o=e.getEntry(n);return o?.created===!0&&o.properties?.calculatedExpression!=null},i=n=>{let o=!1;return n.forEach((a,l)=>{s(l)||(n.delete(l),o=!0)}),o};let r=i(t);return i(this.inactiveDynamicColumns),e.forEachEntry((n,o)=>{const a=n.properties;if(!n.created||a?.calculatedExpression==null)return;const l=this.toCalculatedColDef({...a},o),c=t.get(o);if(c){ZS(l,c.colDef)||(c.colDef=l,r=!0);const u=c.instance;u!==null&&(n.parentGroupId??null)!==yo(u)&&(c.anchorColId=this.findAnchorInGroup(n.parentGroupId),r=!0);return}if(e.isDeclared(o)){mo(`userColumns: colId '${o}' is declared in columnDefs; skipping.`);return}this.inactiveDynamicColumns.delete(o),t.set(o,{colDef:l,anchorColId:this.findAnchorInGroup(n.parentGroupId),instance:null}),r=!0}),r}findAnchorInGroup(e){if(e==null)return null;const{colModel:t}=this.beans,s=this.userColumnSvc,i=t.colDefList;for(let r=i.length-1;r>=0;--r){const n=i[r];if(yo(n)!==e)continue;const o=n.colId;if(!s.getEntry(o)?.removed&&(s.isDeclared(o)||this.dynamicColumns.has(o)))return o}return null}restoreDynamicColumnDefs(e){if(!this.isEnabled())return!1;const t=this.inactiveDynamicColumns;if(!t.size)return!1;let s=!1;for(let i=0,r=e.length;i<r;++i){const n=e[i].colId,o=t.get(n);o!==void 0&&(t.delete(n),this.dynamicColumns.has(n)||(this.dynamicColumns.set(n,o),this.recordCreatedColumn(n,o.colDef,o.parentGroupId??null),s=!0))}return s}getOrCreateColumn(e,t,s,i,r){const n=this.beans,o=e.instance;if(o!==null)return o.buildToken=s,o.reapplyColDef(e.colDef,i,r),o;const a=yee(n,e.colDef,t,!0,s);return e.instance=a,a}refreshDynamicColumns(e){this.suppressValidationChecks++;try{this.beans.colModel.rebuildCols(e)}finally{this.suppressValidationChecks--}}createUniqueColId(){const{colModel:e}=this.beans,t=this.userColumnSvc,s=this.inactiveDynamicColumns;let i=this.lastCalculatedColIndex,r;do r=`calculated_${++i}`;while(e.getCol(r)!==void 0||s.has(r)||t.getEntry(r)!==void 0);return this.lastCalculatedColIndex=i,r}getUpdatedCalculatedColDef(e,t){const s=e.colId,i=this.dynamicColumns.get(s),r=e.getUserProvidedColDef(),n=this.userColumnSvc,o=n.getEntry(s)?.properties,a=n.getDeclaredDef(s)??r,l=o?{...a,...o}:a,c=i?.colDef??l??e.colDef,u={...t};delete u.colId;const d={...kee(c,r,u),...u};return d.calculatedExpression??(d.calculatedExpression=c.calculatedExpression),this.toCalculatedColDef(d,s)}showDialog(e,t,s,i,r=!0,n,o,a){const l=this.openDialogsByColId.get(e.colId);if(l){this.beans.menuSvc?.hidePopupMenu(),r&&l.dialog.getGui().focus({preventScroll:!0});return}const c={resolved:!1},u=this.beans,d=n??ub(u,u.colModel.colsList,e.colId),h=b=>{if(!tu(b.calculatedExpression,0,!0))return{valid:!1,error:this.getLocaleTextFunc()("calculatedColumnExpressionEmpty","Enter an expression")};const y=d.toInternalExpression(b.calculatedExpression);if("error"in y)return{valid:!1,error:cb(y.error,this.getLocaleTextFunc())};const T=this.getFormulaExpressionError(y.expression);return T?{valid:!1,error:T}:{valid:!0,expression:y.expression}},p=b=>{const y=h(b);return y.valid?null:y.error},g=b=>{if(c.resolved)return null;const y=h(b);return y.valid?(c.resolved=!0,t({...b,calculatedExpression:y.expression}),c.close?.(),null):y.error},f=()=>{c.resolved||(c.resolved=!0,c.close?.())},m=s?b=>this.scheduleLiveApplyUpdate(b,d):void 0,v=this.getDataTypeOptions(e.cellDataType),C=this.createManagedBean(new Yee(e,v,this.getExpressionPickers(),()=>d.suggestions,()=>this.getFunctionSuggestions(),p,g,f,s,m)),S=this.createManagedBean(new ns({title:this.getLocaleTextFunc()("calculatedColumn","Calculated Column"),component:C,minWidth:320,width:400,minHeight:380,height:380,centered:!0,movable:!0,resizable:!0,modal:!1,cssIdentifier:"calculated-column",closedCallback:b=>{a&&this.restoreFocusOnDialogClose(a,C.getGui(),b,o)}}));if(c.close=()=>S.close(),this.openDialogsByColId.set(e.colId,{dialog:S,highlight:i!=null}),this.refreshCalculatedColumnHighlight(i??null),r){const b=fee(C.getGui());b.length&&b[0].focus({preventScroll:!0})}const w=this.addManagedElementListeners(S.getGui(),{mousedown:()=>C.hideSuggestions()});S.addDestroyFunc(()=>{for(let b=0,y=w.length;b<y;++b)w[b]()}),S.addDestroyFunc(()=>{s&&this.isAlive()&&!this.beans.context.isDestroyed()?this.flushLiveApplyUpdate(e.colId):this.cancelLiveApplyUpdate(e.colId),this.openDialogsByColId.get(e.colId)?.dialog===S&&(this.openDialogsByColId.delete(e.colId),this.refreshCalculatedColumnHighlight(i??null))}),S.addEventListener("destroyed",()=>this.destroyBean(C))}restoreFocusOnDialogClose(e,t,s,i){if(!i?.eventSource)return;const r={column:e,columnIndex:e.allColsIndex,headerPosition:i.headerPosition,eventSource:i.eventSource};this.beans.menuUtils?.restoreFocusOnClose(r,t,s,!0),mee(this.beans)===vee(this.beans).body&&i.headerPosition&&this.beans.focusSvc.focusHeaderPosition({headerPosition:i.headerPosition})}scheduleLiveApplyUpdate(e,t){const s=e.colId;this.pendingLiveApplyUpdatesByColId.set(s,{draft:e,mapper:t}),!this.scheduledLiveApplyColIds.has(s)&&(this.scheduledLiveApplyColIds.add(s),Cee(this.beans,()=>{this.scheduledLiveApplyColIds.delete(s),this.flushLiveApplyUpdate(s)}))}flushLiveApplyUpdate(e){const t=this.pendingLiveApplyUpdatesByColId.get(e);if(t===void 0)return;this.pendingLiveApplyUpdatesByColId.delete(e);const{draft:s,mapper:i}=t,{colId:r,...n}=this.toColDef({...s,calculatedExpression:i.toInternalExpressionBestEffort(s.calculatedExpression)});this.updateCalculatedColumn(e,n,!1)}cancelLiveApplyUpdate(e){this.pendingLiveApplyUpdatesByColId.delete(e)}closeCalculatedColumnDialog(e){const t=this.openDialogsByColId.get(e);t!==void 0&&(this.cancelLiveApplyUpdate(e),t.dialog.close())}getDefaultDraft(){const e=this.getDataTypeOptions()[0]?.value??bo.cellDataType;return{...bo,cellDataType:e}}getDataTypeOptions(e){const t=this.getOptions()?.dataTypes,s=t?this.getValidConfiguredDataTypes(t):[...Hee];return e!=null&&s.indexOf(e)<0&&s.push(e),s.map(i=>({value:i,text:this.getDataTypeDisplayName(i)}))}getValidConfiguredDataTypes(e){const t=this.beans.dataTypeSvc;if(!t)return[...e];const s=[];for(const i of e)t.isDataTypeRegistered(i)?s.push(i):this.warn(304,{dataType:i});return s}getDataTypeDisplayName(e){const t=tte[e];return t!=null?this.getLocaleTextFunc()(t,this.formatDataTypeName(e)):this.formatDataTypeName(e)}formatDataTypeName(e){return gee(e.replace(/[_-]+/g,"."))??e}getExpressionPickers(){const e=this.getOptions()?.expressionPickers;return e===void 0?[...Uee]:e??[]}toDraft(e,t){const s=e.colDef,i=e.colId,r=s.cellDataType,n=this.beans.colNames.getDisplayNameForColumn(e,"header");return{colId:i,headerName:n??s.headerName??i,cellDataType:typeof r=="string"?r:bo.cellDataType,calculatedExpression:t.toDisplayExpression(s.calculatedExpression??"")}}focusCalculatedColumn(e){window.setTimeout(()=>{const t=this.beans,s=this.isAlive()&&t.headerNavigation?.getHeaderPositionForColumn(e,!1);s&&t.focusSvc.focusHeaderPosition({headerPosition:s})},0)}toColDef(e){return{colId:e.colId,headerName:e.headerName,calculatedExpression:su(e.calculatedExpression)??"",cellDataType:e.cellDataType,editable:!1,suppressPaste:!0}}toCalculatedColDef(e,t){return{...e,colId:t,calculatedExpression:su(e.calculatedExpression),editable:!1,suppressPaste:!0,field:void 0,valueGetter:void 0,valueSetter:void 0,cellEditor:void 0,cellEditorSelector:void 0}}getExpressionValidationState(e){return tu(e,0,!0)?this.getInvalidColumnReference(e)!=null?"unknownReference":this.getFormulaExpressionError(e)==null?"valid":"invalidExpression":"valid"}forEachCalculatedColumn(e){const t=this.beans.colModel.colsList;for(let s=0,i=t.length;s<i;++s){const r=t[s];r.isCalculatedCol&&e(r,r.colId,r.colDef.calculatedExpression??"")}}checkColumnLifecycle(e){const t=this.knownCalculatedColumns,s=new Map,i=this.lifecycleInitialised&&this.suppressValidationChecks===0;this.forEachCalculatedColumn((r,n,o)=>{if(s.set(n,{column:r,expression:o}),!i)return;const a=t.get(n);a==null?this.dispatchCreatedOrRemovedEvent("calculatedColumnCreated",this.getEventCommonParams(r,o,e)):a.expression!==o&&this.dispatchExpressionChangedEvent(this.getEventCommonParams(r,o,e),a.expression)}),t.forEach((r,n)=>{s.has(n)||(this.closeCalculatedColumnDialog(n),i&&this.dispatchCreatedOrRemovedEvent("calculatedColumnRemoved",this.getEventCommonParams(r.column,r.expression,e)))}),this.knownCalculatedColumns=s,this.lifecycleInitialised=!0}checkValidationStates(e,t=!1){if(this.suppressValidationChecks>0)return;const s=t||this.validationStatesInitialised,i=this.validationStatesByColId,r=new Map;this.forEachCalculatedColumn((n,o,a)=>{const l=this.getExpressionValidationState(a);r.set(o,l);const c=i.get(o),u=c!==void 0;if(s&&(u&&c!==l||!u&&l!=="valid")){const h=l==="valid";this.dispatchValidationStateChangedEvent(this.getEventCommonParams(n,a,e),h,h?void 0:l)}}),this.validationStatesByColId=r,this.validationStatesInitialised=!0}getEventCommonParams(e,t,s){return{column:e,columns:[e],expression:t,source:s}}dispatchCreatedOrRemovedEvent(e,t){this.eventSvc.dispatchEvent({type:e,...t})}dispatchExpressionChangedEvent(e,t){this.eventSvc.dispatchEvent({type:"calculatedColumnExpressionChanged",...e,oldExpression:t})}dispatchValidationStateChangedEvent(e,t,s){this.eventSvc.dispatchEvent({type:"calculatedColumnValidationStateChanged",...e,valid:t,reason:s})}getFunctionSuggestions(){return(this.beans.formula?.getFunctionNames()??[]).map(e=>({type:"function",value:e,label:e}))}refreshCalculatedColumn(e){window.setTimeout(()=>{const t=this.beans,s=this.isAlive()&&t.colModel.colsById[e];s&&t.rowRenderer.refreshCells({columns:[s],force:!0})},0)}},db={moduleName:"CalculatedColumns",version:G,beans:[ste,hee],dependsOn:[qc,dee,cee,uee],icons:{calculatedColumnsHeader:"fx",calculatedColumnAdd:"plus",calculatedColumnEdit:"edit",calculatedColumnRemove:"minus"},css:[pee]};import{BeanStub as ite}from"ag-grid-community";var rte=class{constructor(e,t,s){this.params=e;const{aggregatedChildren:i,column:r,newValue:n}=e,o=Ys(n),a=Ys(e.oldValue),l=i.length,c=BigInt(l);this.children=i,this.column=r,this.count=l,this.bigCount=c,this.newValue=n,this.strategy=po(s,t?.distribution),s==="avg"?(this.target=o*c,this.oldTarget=a*c):(this.target=o,this.oldTarget=a),this.getVal=t?.getValue,this.setVal=t?.setValue}run(){const{strategy:e,newValue:t}=this;if(e===!1)return!1;if(e==="overwrite")return this.writeAll(t);const{target:s,oldTarget:i}=this;return s===0n&&!go(t)?this.writeAll(t):e==="increment"&&s===i?!1:e==="uniform"?this.writeUniformDirect(s):e==="increment"?this.writeIncrementDirect(s-i):this.writePercentage()}readOne(e){const{children:t,column:s,getVal:i}=this,r=t[e];if(i){const{colDef:n,api:o,context:a}=this.params;return Ys(i({node:r,data:r.data,column:s,colDef:n,api:o,context:a,groupParams:this.params}))}return Ys(r.getDataValue(s,"value"))}writeOne(e,t){const{children:s,column:i,setVal:r}=this,n=s[e];if(r){const{colDef:o,api:a,context:l}=this.params;return r({node:n,data:n.data,column:i,colDef:o,api:a,context:l,groupParams:this.params,value:t})}return n.setDataValue(i,t,"data")}writeAll(e){const{count:t}=this;let s=!1;for(let i=0;i<t;++i)this.writeOne(i,e)&&(s=!0);return s}writeUniformDirect(e){const{count:t,bigCount:s}=this,i=e/s,r=e-i*s,n=Number(r<0n?-r:r),o=r>=0n?1n:-1n;let a=!1;for(let l=0;l<t;++l)this.writeOne(l,l<n?i+o:i)&&(a=!0);return a}writeIncrementDirect(e){const{count:t,bigCount:s}=this,i=e/s,r=e-i*s,n=Number(r<0n?-r:r),o=r>=0n?1n:-1n;let a=!1;for(let l=0;l<t;++l)this.writeOne(l,this.readOne(l)+i+(l<n?o:0n))&&(a=!0);return a}writePercentage(){const{count:e,target:t}=this;let s=0n;const i=new Array(e);for(let a=0;a<e;++a){const l=this.readOne(a);i[a]=l,s+=l}if(s===0n)return this.writeUniformDirect(t);let r=0n;for(let a=0;a<e;++a){const l=i[a]*t/s;i[a]=l,r+=l}let n=t-r;for(let a=0;n>0n&&a<e;++a,--n)++i[a];for(let a=0;n<0n&&a<e;++a,++n)--i[a];let o=!1;for(let a=0;a<e;++a)this.writeOne(a,i[a])&&(o=!0);return o}},nte=class{constructor(e,t,s){this.params=e;const{aggregatedChildren:i,column:r,colDef:n,newValue:o}=e,a=Qe(o),l=i.length,c=s==="avg";this.children=i,this.column=r,this.count=l,this.newValue=o,this.strategy=po(s,t?.distribution),this.isAvg=c,c?(this.target=a*l,this.oldTarget=Qe(e.oldValue)*l):(this.target=a,this.oldTarget=Qe(e.oldValue));const u=t?.precision;u===!1?this.precision=void 0:typeof u=="number"?this.precision=Number.isInteger(u)&&u>=0?u:void 0:this.precision=SQ(n),this.getVal=t?.getValue,this.setVal=t?.setValue}run(){const{strategy:e,newValue:t}=this;if(e===!1)return!1;if(e==="overwrite")return this.writeAll(t);if(this.target===0&&!go(t))return this.writeAll(t);if(e==="increment"&&this.target===this.oldTarget)return!1;switch(e){case"uniform":return this.distributeUniform();case"increment":return this.distributeIncrement();default:return this.isAvg?this.distributePercentageAvg():this.distributePercentage()}}readOne(e){const{column:t,getVal:s}=this;if(s){const{colDef:i,api:r,context:n}=this.params;return Qe(s({node:e,data:e.data,column:t,colDef:i,api:r,context:n,groupParams:this.params}))}return Qe(e.getDataValue(t,"value"))}readValueAndCount(e){const{column:t,getVal:s}=this;let i;if(s){const{colDef:r,api:n,context:o}=this.params;i=s({node:e,data:e.data,column:t,colDef:r,api:n,context:o,groupParams:this.params})}else i=e.getDataValue(t);if(e.group){if(i!=null&&typeof i=="object"){const{value:r,count:n}=i;if(r!=null&&typeof n=="number"&&n>0)return typeof r=="number"?i:{value:Qe(r),count:n}}return{value:Qe(i),count:e.allLeafChildren?.length||1}}return{value:Qe(i),count:1}}writeOne(e,t){const{column:s,setVal:i}=this;if(i){const{colDef:r,api:n,context:o}=this.params;return i({node:e,data:e.data,column:s,colDef:r,api:n,context:o,groupParams:this.params,value:t})}return e.setDataValue(s,t,"data")}writeAll(e){const{children:t,count:s}=this;let i=!1;for(let r=0;r<s;++r)this.writeOne(t[r],e)&&(i=!0);return i}distributeUniform(){const{children:e,count:t,target:s,precision:i}=this;if(i===void 0)return this.writeAll(s/t);const r=10**i,n=Math.round(s*r),o=Math.trunc(n/t),a=n-o*t,l=Math.abs(a),c=a>=0?1:-1;let u=!1;for(let d=0;d<t;++d)this.writeOne(e[d],(d<l?o+c:o)/r)&&(u=!0);return u}distributeIncrement(){const{children:e,count:t,target:s,oldTarget:i,precision:r}=this;if(r===void 0){const h=(s-i)/t;let p=!1;for(let g=0;g<t;++g){const f=e[g];this.writeOne(f,this.readOne(f)+h)&&(p=!0)}return p}const n=10**r,o=Math.round(s*n)-Math.round(i*n),a=Math.trunc(o/t),l=o-a*t,c=Math.abs(l),u=l>=0?1:-1;let d=!1;for(let h=0;h<t;++h){const p=e[h],g=Math.round(this.readOne(p)*n);this.writeOne(p,(g+a+(h<c?u:0))/n)&&(d=!0)}return d}distributePercentage(){const{children:e,count:t,target:s,precision:i}=this,r=new Array(t);let n=0;for(let p=0;p<t;++p){const g=this.readOne(e[p]);r[p]=g,n+=g}if(n===0)return this.distributeUniform();if(i===void 0){const p=s/n;let g=!1;for(let f=0;f<t;++f)this.writeOne(e[f],r[f]*p)&&(g=!0);return g}const o=10**i,a=Math.round(s*o);let l=0;for(let p=0;p<t;++p){const g=Math.round(r[p]/n*a);r[p]=g,l+=g}const c=a-l,u=Math.abs(c),d=c>=0?1:-1;let h=!1;for(let p=0;p<t;++p)this.writeOne(e[p],(r[p]+(p<u?d:0))/o)&&(h=!0);return h}distributePercentageAvg(){const{children:e,count:t,target:s,precision:i}=this,r=new Array(t),n=new Array(t);let o=0,a=0;for(let m=0;m<t;++m){const v=this.readValueAndCount(e[m]),C=v.count;n[m]=C,a+=C;const S=v.value*C;r[m]=S,o+=S}if(o===0)return this.distributeUniform();const l=s/t*a;if(i===void 0){const m=l/o;let v=!1;for(let C=0;C<t;++C)this.writeOne(e[C],r[C]*m/n[C])&&(v=!0);return v}const c=10**i,u=Math.round(l*c);let d=0;for(let m=0;m<t;++m){const v=Math.round(r[m]/o*u);r[m]=v,d+=v}const h=u-d,p=Math.abs(h),g=h>=0?1:-1;let f=!1;for(let m=0;m<t;++m)this.writeOne(e[m],(r[m]+(m<p?g:0))/(c*n[m]))&&(f=!0);return f}},hb=(e,t)=>{const{aggregatedChildren:s,colDef:i}=e;if(s.length===0)return!1;const r=i.aggFunc??null,n=pb(t,r);return n===!1?!1:typeof n=="function"?n(e)??!0:i.cellDataType==="bigint"?new rte(e,n,r).run():new nte(e,n,r).run()};function pb(e,t){if(!e)return;const s=e.distribution;if(s===!1||s===null)return!1;const i=OS(t),r=e.default;if(typeof s=="object"){const n=typeof t=="string"?s[t]:void 0;return n!==void 0?uu(n,i,e):i?!1:uu(r,!1,e)??du(e)}if(i)return s==="overwrite"?du(e,"overwrite"):!1;if(s===void 0&&!CQ(t)){const n=uu(r,!1,e);if(n!==void 0)return n}return e}function uu(e,t,s){if(e===!1||e===null)return!1;if(e!==void 0){if(typeof e=="function")return e;if(typeof e=="object"){const i=e.distribution;if(t&&i!=="overwrite"&&i!==!0)return!1;const{precision:r,getValue:n,setValue:o}=s;return{distribution:t?"overwrite":i,precision:e.precision??r,getValue:e.getValue??n,setValue:e.setValue??o}}return t&&e!=="overwrite"&&e!==!0?!1:du(s,t?"overwrite":e)}}function du(e,t){return{distribution:t,precision:e.precision,getValue:e.getValue,setValue:e.setValue}}var ote=class extends dF{constructor(){super(...arguments),this.beanName="rowGroupingEditValueSvc"}isGroupCellEditable(e,t){const s=t.colDef;if(!t.isColumnFunc(e,s.groupRowEditable))return!1;const i=s.groupRowValueSetter;if(typeof i=="function")return!0;const r=s.aggFunc??null;if(typeof i=="object"){const n=pb(i,r);return typeof n=="function"||n!==!1&&po(r,n?.distribution)!==!1}return po(r,i??void 0)!==!1}setGroupDataValue(e,t,s,i,r,n){const o=t.colDef;let a=o.groupRowValueSetter;if(a==null){const u=o.groupRowEditable;a=u&&t.isColumnFunc(e,u)?!0:void 0}if(!a)return;const l=this.gos.addCommon({node:e,data:e.data,oldValue:i,newValue:s,colDef:o,column:t,eventSource:r,valueChanged:n,aggregatedChildren:this.beans.aggChildrenSvc?.getAggregatedChildren(e,t)??[]});return(typeof a=="function"?a(l):hb(l,a===!0?void 0:a))??!0}},gb={moduleName:"RowGroupingEdit",version:G,beans:[ote],dependsOn:[$,tc]};import{_PopupModule as ate,_SharedDragAndDropModule as lte,_preInitErrMsg as fb}from"ag-grid-community";import{BeanStub as cte}from"ag-grid-community";var ute=class extends hF{constructor(e){super(),this.beanName="agChartsExports",this.isEnterprise=!1,this.create=e.create,this._Theme=e._Theme,this._Scene=e._Scene,this.isEnterprise=e.isEnterprise,this._Util=e._Util}};import{BeanStub as dte}from"ag-grid-community";import{_parseDateTimeFromString as hte}from"ag-stack";function mb(e){return e.chart!=null?e.chart:e}var pte=new Set(["__proto__","constructor","prototype"]);function Kt(e,t,s){if(e==null)return s;const i=t.split(".");let r=e;for(;i.length>1;)if(r=r[i.shift()],r==null)return s;const n=r[i[0]];return n??s}function gte(e,t,s){if(e==null)return;const i=t.split(".");let r=e;i.filter(n=>!pte.has(n)).forEach((n,o)=>{r[n]||(r[n]={}),o<i.length-1&&(r=r[n])}),r[i[i.length-1]]=s}var fte={column:"bar",groupedColumn:"bar",stackedColumn:"bar",normalizedColumn:"bar",bar:"bar",groupedBar:"bar",stackedBar:"bar",normalizedBar:"bar",line:"line",stackedLine:"line",normalizedLine:"line",scatter:"scatter",bubble:"bubble",pie:"pie",donut:"donut",doughnut:"donut",area:"area",stackedArea:"area",normalizedArea:"area",histogram:"histogram",radarLine:"radar-line",radarArea:"radar-area",nightingale:"nightingale",radialColumn:"radial-column",radialBar:"radial-bar",sunburst:"sunburst",rangeBar:"range-bar",rangeArea:"range-area",boxPlot:"box-plot",treemap:"treemap",heatmap:"heatmap",waterfall:"waterfall",funnel:"funnel",coneFunnel:"cone-funnel",pyramid:"pyramid"},mte=new Set(["columnLineCombo","areaColumnCombo","customCombo"]),vte=["grouped","stacked","normalized"],vb={area:{isCartesian:!0,canInvert:!0},bar:{isCartesian:!0,canInvert:!0},histogram:{isCartesian:!0},line:{isCartesian:!0,canInvert:!0},pie:{isPie:!0},donut:{isPie:!0,canInvert:!0},scatter:{isCartesian:!0},bubble:{isCartesian:!0},"radial-column":{isPolar:!0,isEnterprise:!0,isRadial:!0,canInvert:!0},"radial-bar":{isPolar:!0,isEnterprise:!0,isRadial:!0,canInvert:!0},"radar-line":{isPolar:!0,isEnterprise:!0,canInvert:!0},"radar-area":{isPolar:!0,isEnterprise:!0,canInvert:!0},nightingale:{isPolar:!0,isEnterprise:!0,canInvert:!0},"range-bar":{isCartesian:!0,isStatistical:!0,isEnterprise:!0,canSwitchDirection:!0},"range-area":{isCartesian:!0,isStatistical:!0,isEnterprise:!0},"box-plot":{isCartesian:!0,isStatistical:!0,isEnterprise:!0,canSwitchDirection:!0},treemap:{isEnterprise:!0,isHierarchical:!0},sunburst:{isEnterprise:!0,isHierarchical:!0},heatmap:{isCartesian:!0,isEnterprise:!0},waterfall:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},funnel:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},"cone-funnel":{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0},pyramid:{isCartesian:!0,isEnterprise:!0,canSwitchDirection:!0}};function Cte(e){return!!vb[e]}function hu(e){return mte.has(e)}function Pt(e,t){return!!vb[e]?.[t]}function Ste(e){return Pt(ee(e),"isEnterprise")}var bte=new Set(["stackedColumn","normalizedColumn","stackedBar","normalizedBar"]);function yte(e){return bte.has(e)}function jt(e){return Pt(e,"isCartesian")}function pu(e){return e==="funnel"||e==="cone-funnel"||e==="pyramid"}function gu(e){return Pt(e,"isPolar")}function wte(e){return Pt(e,"isRadial")}function gs(e){return Pt(e,"isHierarchical")}function xte(e){return Pt(e,"isStatistical")}function hr(e){return e==="doughnut"?"donut":e}function Cb(e){return fte[e]}function ee(e){return Cb(e)??"line"}function Sb(e){return Pt(e,"isPie")}function Fte(e){return e==="pie"||e==="waterfall"||e==="histogram"||e==="funnel"||e==="coneFunnel"||e==="pyramid"}function fu(e){return gs(ee(e))?void 0:1}function wo(e){return gs(ee(e))?2:Fte(e)?1:void 0}function bb(e){return!hu(e)&&Pt(ee(e),"canInvert")}function Tte(e){return Pt(ee(e),"canSwitchDirection")}function mu(e){switch(e){case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":case"stackedLine":case"normalizedLine":case"stackedArea":case"normalizedArea":return`${e}Full`;case"doughnut":return"donut";case"areaColumnCombo":return"AreaColumnCombo";default:return e}}import{_warnForGrid as Ate}from"ag-grid-community";var yb=["number","category","grouped-category","log","time"];function Pte(e){switch(e){case"bar":case"stackedBar":case"normalizedBar":return["number","category"];case"groupedBar":return["number","grouped-category"];case"column":case"stackedColumn":case"normalizedColumn":case"line":case"stackedLine":case"normalizedLine":case"area":case"stackedArea":case"normalizedArea":case"histogram":return["category","number"];case"groupedColumn":return["grouped-category","number"];case"scatter":case"bubble":return["number","number"];default:return}}function Rte(e,t,s,i,r){const{chartOptionsToRestore:n,chartPaletteToRestore:o,chartThemeToRestore:a,agChartsExports:l}=e,c=kte(e),u=vu(c,l._Theme),d=u?{baseTheme:c}:wb(e,c)??{},h=e.getGridOptionsChartThemeOverrides(),p=e.apiChartThemeOverrides,g=ee(e.chartType),f=e.crossFiltering?Ite(t,e,g):void 0,C=[u?Dte(e,s,(()=>{const S=w=>w?Object.keys(w).some(b=>Kt(w[b],"title.enabled",!1)):!1;return S(h)||S(p)})()):void 0,Lte(),i,f,h,p,{...n??{}},r].filter(S=>!!S).reduce((S,w)=>({baseTheme:S,overrides:w}),d);if(o&&c===a){const S=e.agChartsExports._Theme.getChartTheme(d).palette;Mte(o,S)||(C.palette=o)}return C}function Mte(e,t){const s=(i,r)=>i===r?!0:i?.length!==r?.length?!1:i?.every((n,o)=>n===r?.[o])??!1;return s(e.fills,t.fills)&&s(e.strokes,t.strokes)}function vu(e,t){return Object.keys(t.themes).includes(e)}function Ite(e,t,s){const r={tooltip:{delay:500},legend:{listeners:{legendItemClick:o=>{const a=e.getChart(),l=[o.seriesId,`${o.seriesId}-filtered-out`];for(const c of a.series.filter(u=>l.includes(u.id)))c.toggleSeriesItem(void 0,"category",o.itemId,void 0)}}},listeners:{click:o=>t.crossFilterCallback(o,!0)}};if(s==="pie"||s==="donut")return{[s]:{series:{fills:{$applyCycle:[{$cacheMax:{$size:{$path:["./data",{$path:"/data"}]}}},{$palette:"fills"},{$if:[{$eq:[{$value:"$parentIndex"},0]},{$mix:[{$value:"$1"},{$ref:"backgroundColor"},.7]},{$value:"$1"}]}]},strokes:{$applyCycle:[{$cacheMax:{$size:{$path:["./data",{$path:"/data"}]}}},{$palette:"strokes"},{$if:[{$eq:[{$value:"$parentIndex"},0]},{$mix:[{$value:"$1"},{$ref:"backgroundColor"},.7]},{$value:"$1"}]}]}},...r}};const n={};return s!=="line"&&(n.fill={$if:[{$isEven:[{$value:"$index"}]},{$palette:"fill"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"fill"}]},{$ref:"backgroundColor"},.7]}]}),{[s]:{series:{stroke:{$if:[{$isEven:[{$value:"$index"}]},{$palette:"stroke"},{$mix:[{$path:["../$prevIndex/fill",{$palette:"stroke"}]},{$ref:"backgroundColor"},.7]}]},...n},...r}}}var Ete=yb.reduce((e,t)=>({...e,[t]:{title:{_enabledFromTheme:!0}}}),{});function Dte(e,t,s){const i=e.getExtraPaddingDirections();return{common:{...t?{animation:{duration:500}}:void 0,axes:Ete,padding:{top:!s&&i.includes("top")?40:20,right:i.includes("right")?30:20,bottom:i.includes("bottom")?40:20,left:i.includes("left")?30:20}}}}function Lte(){return{pie:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}},donut:{series:{title:{_enabledFromTheme:!0},calloutLabel:{_enabledFromTheme:!0},sectorLabel:{enabled:!1,_enabledFromTheme:!0}}}}}function kte(e){let t=e.getChartThemeName();const s=e.getChartThemes();return s.includes(t)||(t=s[0]),t}function wb(e,t){const{customChartThemes:s}=e,i=s?.[t];return i||Ate(e.gridId,140,{name:t}),i}function Cu(e,t){const s={highlightedItem:{strokeWidth:2}};return t||(s.unhighlightedSeries={opacity:1}),e||(s.unhighlightedItem={opacity:1}),s}var Xs=class{constructor(e){this.chartProxyParams=e,this.clearThemeOverrides=!1,this.agChartsExports=e.agChartsExports,this.chart=e.chartInstance,this.chartType=e.chartType,this.crossFiltering=e.crossFiltering,this.crossFilterCallback=e.crossFilterCallback,this.standaloneChartType=ee(this.chartType),this.chart==null?this.chart=e.agChartsExports.create(this.getCommonChartOptions()):this.clearThemeOverrides=!0}crossFilteringReset(){}update(e){this.getChartRef().update(this.getUpdateOptions(e,this.getCommonChartOptions(e.updatedOverrides)))}updateThemeOverrides(e){this.getChartRef().updateDelta({theme:{overrides:e}})}getChart(){return mb(this.chart)}getChartRef(){return this.chart}downloadChart(e,t,s){const{chart:i}=this,r=mb(i),n=t||r.title.node.getPlainText(),{width:o,height:a}=e||{};i.download({width:o,height:a,fileName:n,fileFormat:s})}getChartImageDataURL(e){return this.getChart().getCanvasDataURL(e)}getChartOptions(){return this.chart.getOptions()}getChartThemeOverrides(){return this.getChartOptions().theme.overrides??{}}getChartPalette(){return this.agChartsExports._Theme.getChartTheme(this.getChartOptions().theme).palette}setPaired(e){const t=ee(this.chartProxyParams.chartType);this.chart.updateDelta({theme:{overrides:{[t]:{paired:e}}}})}isPaired(){const e=ee(this.chartProxyParams.chartType);return Kt(this.getChartThemeOverrides(),`${e}.paired`,!0)}lookupCustomChartTheme(e){return wb(this.chartProxyParams,e)}getSeriesGroupType(){}transformCategoryData(e,t){return e.map((s,i)=>{const r=s[t],n=r?.toString?r.toString():"",o={...s};return o[t]={id:i,value:r,toString:()=>n},o})}getCommonChartOptions(e){const t=this.clearThemeOverrides?{}:this.chart?.getOptions()??{},s=this.chart!=null?this.getActiveFormattingPanelOverrides():void 0;this.clearThemeOverrides=!1;const i=this.chartProxyParams,r=i.styleNonce,n=Rte(i,this,this.agChartsExports.isEnterprise,this.getChartThemeDefaults(),e??s);return{...t,mode:"integrated",...r?{styleNonce:r}:{},suppressFieldDotNotation:!0,theme:n,container:i.parentElement,enableRtl:i.enableRtl}}getChartThemeDefaults(){const e={enabled:!0,snap:!0,label:{enabled:!1}},t=this.agChartsExports.isEnterprise?{zoom:{enabled:!0},animation:{enabled:!0,duration:500},axes:{number:{crosshair:e},category:{crosshair:e},log:{crosshair:e},time:{crosshair:e}}}:{};t.minHeight=0,t.minWidth=0,t.navigator={enabled:!1,height:18},t.context=this.chartProxyParams.context;const s={common:t};return this.setSeriesChartThemeDefaults(s),s}setSeriesChartThemeDefaults(e){const t=this.getSeriesChartThemeDefaults();t&&(e[this.standaloneChartType]=t)}getSeriesChartThemeDefaults(){}getActiveFormattingPanelOverrides(){return this.clearThemeOverrides?{}:this.chart?.getOptions().theme?.overrides??{}}destroy({keepChartInstance:e=!1}={}){if(e)return this.chart.resetAnimations(),this.chart;this.destroyChart()}destroyChart(){this.chart&&(this.chart.destroy(),this.chart=void 0)}},Yt=class extends Xs{constructor(){super(...arguments),this.crossFilteringAllPoints=new Set,this.crossFilteringSelectedPoints=[],this.isSingleSeries=!1}getUpdateOptions(e,t){const s=this.getAxes(e,t);return{...t,data:this.getData(e,s),axes:s,series:this.getSeries(e)}}getData(e,t){const s=["area","line"].includes(this.standaloneChartType);return this.crossFiltering&&s?this.getCrossFilterData(e):this.getDataTransformedData(e,t)}getDataTransformedData(e,t){const s=t.x.type,{categories:i,data:r}=e,[n]=i;switch(s){case"category":return this.transformCategoryData(r,n.id);case"time":return this.transformTimeData(r,n.id,n.convertTime);default:return r}}getXAxisType(e){return e.grouping?"grouped-category":this.isXAxisOfType(e,"time",t=>t instanceof Date)?"time":this.isXAxisOfType(e,"number")?"number":"category"}isXAxisOfType(e,t,s){const[i]=e.categories;if(i?.chartDataType)return i.chartDataType===t;if(!s)return!1;const r=e.data[0];return r?s(r[i.id]):!1}transformTimeData(e,t,s){return e[0]?.[t]instanceof Date?e:e.map(r=>{const n=r[t];return typeof n=="string"?{...r,[t]:s?s(n):hte(n)}:r})}crossFilteringReset(){this.crossFilteringSelectedPoints=[],this.crossFilteringAllPoints.clear()}crossFilteringPointSelected(e){return this.crossFilteringSelectedPoints.length==0||this.crossFilteringSelectedPoints.includes(e)}crossFilteringDeselectedPoints(){return this.crossFilteringSelectedPoints.length>0&&this.crossFilteringAllPoints.size!==this.crossFilteringSelectedPoints.length}extractLineAreaCrossFilterSeries(e,t){const[s]=t.categories,i=r=>this.standaloneChartType==="area"?t.getCrossFilteringContext().lastSelectedChartId===t.chartId?r+"-total":r:r+"-total";return e.map(r=>(r.yKey=i(r.yKey),r.listeners={seriesNodeClick:n=>{const o=n.datum[r.xKey],a=n.event.metaKey||n.event.ctrlKey;this.crossFilteringAddSelectedPoint(a,o),this.crossFilterCallback(n)}},r.marker={itemStyler:n=>{const o=n.datum[s.id],a=n.highlightState==="highlighted-item";return{fill:a?"yellow":n.fill,size:a?14:this.crossFilteringPointSelected(o)?8:0}}},this.standaloneChartType==="area"&&(r.fillOpacity=this.crossFilteringDeselectedPoints()?.3:1),this.standaloneChartType==="line"&&(r.strokeOpacity=this.crossFilteringDeselectedPoints()?.3:1),r))}getCrossFilterData(e){this.crossFilteringAllPoints.clear();const[t]=e.categories,s=e.fields[0].colId,i=`${s}-filtered-out`,r=e.getCrossFilteringContext().lastSelectedChartId;return e.data.map(n=>{const o=n[t.id];this.crossFilteringAllPoints.add(o);const a=this.crossFilteringPointSelected(o);return this.standaloneChartType==="area"&&r===e.chartId&&(n[`${s}-total`]=a?n[s]:n[s]+n[i]),this.standaloneChartType==="line"&&(n[`${s}-total`]=a?n[s]:n[s]+n[i]),n})}crossFilteringAddSelectedPoint(e,t){e?this.crossFilteringSelectedPoints.push(t):this.crossFilteringSelectedPoints=[t]}isHorizontal(e){const t=this.standaloneChartType;if(t!=="waterfall"&&t!=="box-plot"&&t!=="range-bar")return!1;const s=e.theme,i=r=>{const n=r?.overrides?.[t]?.series?.direction;return n!=null?n==="horizontal":typeof r?.baseTheme=="object"?i(r.baseTheme):!1};return i(s)}getSeriesChartThemeDefaults(){return{series:{highlight:Cu(this.crossFiltering,this.isSingleSeries)}}}},_te=class extends Yt{getSeries(e){const t=e.fields[0];return[{type:this.standaloneChartType,xKey:t.colId,xName:t.displayName,yName:this.chartProxyParams.translate("histogramFrequency"),areaPlot:!1}]}getAxes(e){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}},Gte=class extends Yt{constructor(){super(...arguments),this.isSingleSeries=!0}getAxes(e,t){const s=this.isHorizontal(t),i=s?"y":"x",r=s?"x":"y";return{[i]:{type:this.getXAxisType(e),position:s?"left":"bottom"},[r]:{type:"number",position:s?"bottom":"left"}}}getSeries(e){const[t]=e.categories,[s]=e.fields;return[{type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:s.colId,yName:s.displayName??void 0}]}},Ote=class extends Xs{getUpdateOptions(e,t){return{...t,data:this.transformFunnelCategories(e),series:this.getSeries(e)}}transformFunnelCategories(e){const{data:t}=e,[{id:s}]=e.categories;return t.map((i,r)=>({...i,[s]:{name:i[s],id:r,toString:()=>String(i[s])}}))}getSeriesChartThemeDefaults(){const e={crosshair:{enabled:!1}};return{zoom:{enabled:!1},...this.chartType!=="pyramid"&&{axes:{category:e,number:e}}}}getSeries(e){const[{id:t}]=e.categories,[{colId:s}]=e.fields;return[{type:this.standaloneChartType,stageKey:t,valueKey:s}]}};import{GROUP_AUTO_COLUMN_ID as Nte}from"ag-grid-community";var xo="AG-GRID-DEFAULT-LABEL-KEY";function Bte(e,t){const s=xb(e,i,r);return Su(s);function i(o){return t.length}function r(o,a){const l=t[a],c=o[l];return n(c)}function n(o){return o==null?null:String(o)}}function Vte(e,t){const s=xb(e,i,r);return Su(s);function i(n){return t(n)?.length??0}function r(n,o){const a=t(n);return a&&a[o]}}function Su(e,t=null,s){const{depth:i,rootValues:r,value:n,children:o}=e;if(r)return r.map(l=>({[xo]:t,...l}));if(i===0)return[{[xo]:t,...n}];const a=[];for(const[l,c]of o.entries())a.push(...Su(c,l,!0));return s?[{[xo]:t,children:a,...n??{}}]:a}function xb(e,t,s){const i={depth:0,children:new Map};for(const n of e){const o=t(n);r(n,o,s,0,i)}return i;function r(n,o,a,l,c){if(l===o)return l===0?(c.rootValues||(c.rootValues=[]),c.rootValues.push(n)):c.value=n,c;{const u=a(n,l),d=c.children.get(u),h=r(n,o,a,l+1,d||{depth:0,children:new Map});return c.children.set(u,h),c.depth=Math.max(1+h.depth,c.depth),c}}}var Hte=class extends Xs{getUpdateOptions(e,t){const{fields:s}=e,[i,r]=s;return{...t,series:this.getSeries(i,r),data:this.getData(e,i,r)}}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"}}}getSeries(e,t){return[{type:this.standaloneChartType,labelKey:xo,sizeKey:e?.colId,sizeName:e?.displayName??void 0,colorKey:t?.colId,colorName:t?.displayName??void 0}]}getData(e,t,s){const{categories:i,data:r,groupData:n,grouping:o}=e;if(o){const a=s?r.concat(n?.map(l=>{const c={...l};return delete c[t.colId],c})??[]):r;return Vte(a,l=>l[Nte]?.value??null)}else{const a=i.map(({id:l})=>l);return Bte(r,a)}}},Ute=class extends Xs{getAxes(e){const t=this.standaloneChartType==="radial-bar";return{angle:{type:t?"angle-number":"angle-category"},radius:{type:t?"radius-category":"radius-number"}}}getSeries(e){const{fields:t,categories:s,seriesGroupType:i}=e,[r]=s,n=this.standaloneChartType==="radial-bar",o=this.getSeriesGroupTypeOptions(i);return t.map(a=>({type:this.standaloneChartType,angleKey:n?a.colId:r.id,angleName:n?a.displayName??void 0:r.name,radiusKey:n?r.id:a.colId,radiusName:n?r.name:a.displayName??void 0,...o}))}getSeriesGroupType(){const e=this.standaloneChartType;if(!["nightingale","radial-bar","radial-column"].includes(e))return;const t=this.getChart().series?.[0]?.properties.toJson(),s=()=>t.normalizedTo?"normalized":"stacked";return e==="nightingale"?t.grouped?"grouped":s():t.stacked?s():"grouped"}getUpdateOptions(e,t){const s=this.getAxes(e);return{...t,data:this.getData(e,s),axes:s,series:this.getSeries(e)}}getData(e,t){if(t.angle.type==="angle-category"||t.radius.type==="radius-category"){const[i]=e.categories;return this.transformCategoryData(e.data,i.id)}else return e.data}getSeriesGroupTypeOptions(e){return e?{grouped:e==="grouped"||void 0,stacked:e!=="grouped"||void 0,normalizedTo:e==="normalized"?100:void 0}:{}}getSeriesChartThemeDefaults(){return{series:{highlight:Cu(this.crossFiltering)}}}},zte="AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY",Wte="AG-GRID-DEFAULT-HEATMAP-SERIES-KEY",$te="AG-GRID-DEFAULT-HEATMAP-VALUE-KEY";function Kte(e,t){return e.reduce((s,i,r,n)=>s.concat(t(i,r,n)),new Array)}var jte=class extends Xs{getUpdateOptions(e,t){const s=Wte,i=$te,r=zte;return{...t,series:this.getSeries(e,s,i,r),data:this.getData(e,s,i,r)}}getSeries(e,t,s,i){const[r]=e.categories;return[{type:this.standaloneChartType,yKey:i,xKey:t,colorKey:s,yName:r.name,xName:void 0,colorName:void 0}]}getData(e,t,s,i){const[r]=e.categories;return Kte(e.data,(n,o)=>{const a=n[r.id],l=a==null?"":String(a),c={id:o,value:a,toString:()=>l};return e.fields.map(({colId:u,displayName:d})=>({...n,[t]:d,[s]:n[u],[i]:c}))})}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200},position:"right"},series:{tooltip:{renderer:Yte}}}}};function Yte(e){const{xKey:t,yKey:s,colorKey:i,yName:r,datum:n}=e;return{title:"",data:[{label:r,value:n[s]},{label:n[t],value:i&&n[i]}].map(({label:a,value:l})=>({label:String(a),value:String(l)}))}}import{BeanStub as qte,CellRangeType as pr,_normalizeSortType as Xte,_resolveSortOptions as Zte,isColumnGroupAutoCol as Jte}from"ag-grid-community";import{_hasOwn as Qte,_last as ese}from"ag-stack";import{BeanStub as tse,GROUP_AUTO_COLUMN_ID as sse,_isClientSideRowModel as ise,_isServerSideRowModel as rse}from"ag-grid-community";var nse=class extends pF{wireBeans(e){this.sortSvc=e.sortSvc,this.gridRowModel=e.rowModel,this.colModel=e.colModel,this.pivotResultCols=e.pivotResultCols,this.rowNodeSorter=e.rowNodeSorter}getData(e){if(e.crossFiltering){if(e.grouping)return this.warn(141),{chartData:[],colNames:{}};if(!ise(this.gos))return this.warn(142),{chartData:[],colNames:{}}}rse(this.gos)&&e.pivoting&&this.updatePivotKeysForSSRM();const s=this.extractRowsFromGridRowModel(e);return s.chartData=this.aggregateRowsByDimension(e,s.chartData),s}extractRowsFromGridRowModel(e){const{crossFiltering:t,startRow:s,endRow:i,valueCols:r,dimensionCols:n,grouping:o,crossFilteringSort:a,combineGroupValues:l}=e;let c=[];const u={},d={},h={};let p={},g=[],f;if(t)p=this.getFilteredRowNodes(),g=this.getAllRowNodes(a),f=g.length;else{const w=this.gridRowModel.getRowCount()-1;s===i&&s===0&&n.length===0&&r.length===0?f=0:f=(i>=0?Math.min(i,w):w)-s+1}if(f>0)for(const w of r){let b=[];const y=w.colDef.pivotKeys;y&&(b=y.slice());const T=w.colDef.headerName;T&&b.push(T),b.length>0&&(u[w.getId()]=b)}let m=0,v=0;const C={};for(let w=0;w<f;w++){const b=t?g[w]:this.gridRowModel.getRow(w+s);if(b.footer||b.detail){m++;continue}const y={node:b};for(const T of n){const x=T.colId,F=this.colModel.getCol(x);if(F){const A=b.getDataValue(F,"data");if(o){const P=A?.toString?String(A.toString()):" ",D=this.getGroupLabels(b,P),N=D.slice().reverse();let V={value:N,id:v++,toString:()=>N.filter(Boolean).join(" - ")};if(l){const O=V.toString(),K=C[O];K?V=K:C[O]=V}y[x]=V,b.group&&(d[D.toString()]=w-m);const L=D.slice(1,D.length).toString();L&&(h[L]=d[L])}else y[x]=A}else y[mt]=w+1}for(const T of r){const x=T.colId;if(t){const F=x+"-filtered-out",A=b.getDataValue(T,"data");let P=A;A!=null&&(typeof A.toNumber=="function"?P=A.toNumber():typeof A.value=="number"&&(P=A.value)),p[b.id]?(y[x]=P,y[F]=e.aggFunc||e.isScatter?void 0:0):(y[x]=e.aggFunc||e.isScatter?void 0:0,y[F]=P)}else{let F=b.getDataValue(T,"data");F&&typeof F.value=="number"&&(F=F.value),F&&Qte(F,"toString")&&(F=parseFloat(F.toString())),y[x]=F!=null&&typeof F.toNumber=="function"?F.toNumber():F}}c.push(y)}let S;if(o){const w=Object.values(h),b=c;c=[],S=[];for(let y=0;y<b.length;y++)(w.includes(y)?S:c).push(b[y])}return{chartData:c,colNames:u,groupChartData:S}}aggregateRowsByDimension(e,t){const s=e.dimensionCols;if(!e.aggFunc||s.length===0)return t;const r=ese(s)?.colId,n={},o=[];for(const a of t){let l=n;for(const c of s){const u=c.colId,d=a[u];if(u===r){let h=l[d];if(!h){h={__children:[]};for(const p of s){const g=p.colId;h[g]=a[g]}l[d]=h,o.push(h)}h.__children.push(a)}else l[d]||(l[d]={}),l=l[d]}}if(this.gos.assertModuleRegistered("SharedAggregation",1)){const a=e.aggFunc,l=typeof a=="function"?a:typeof a=="string"?this.beans.aggFuncSvc.getAggFunc(a):null;if(typeof l!="function")return this.warn(109,{inputValue:String(a),allSuggestions:[]}),o;const c=this.beans.gridApi,u=this.gos.get("context");for(const d of o)for(const h of e.valueCols){const p=h.colId;if(e.crossFiltering){const g=d.__children.filter(S=>typeof S[p]<"u").map(S=>S[p]),f=l({values:g,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[p]=typeof f?.value<"u"?f.value:f;const m=`${p}-filtered-out`,v=d.__children.filter(S=>typeof S[m]<"u").map(S=>S[m]),C=l({values:v,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[m]=typeof C?.value<"u"?C.value:C}else{const g=d.__children.map(m=>m[p]),f=l({values:g,column:h,colDef:h.colDef,pivotResultColumn:void 0,rowNode:void 0,data:void 0,aggregatedChildren:[],api:c,context:u});d[p]=typeof f?.value<"u"?f.value:f}}}return o}updatePivotKeysForSSRM(){const e=this.pivotResultCols?.pivotCols;if(!e)return;const t=this.extractPivotKeySeparator(e);for(const s of e)if(t==="")s.colDef.pivotKeys=[];else{const i=s.colId.split(t);s.colDef.pivotKeys=i.slice(0,i.length-1)}}extractPivotKeySeparator(e){if(e.length===0)return"";const t=(i,r)=>{const n=i.getGroupId();return i.getParent()?t(i.getParent(),n):r.split(n)[1][0]},s=e[0];return s.getParent()==null?"":t(s.getParent(),s.colId)}getGroupLabels(e,t){const s=[t];for(;e&&e.level!==0;)if(e=e.parent,e)if(e.group){const i=this.colModel.getCol(sse);if(i){const r=e.getDataValue(i,"data"),n=r?.toString?String(r.toString()):" ";s.push(n)}}else s.push(e.key);return s}getFilteredRowNodes(){const e={};return this.gridRowModel.forEachNodeAfterFilterAndSort(t=>{e[t.id]=t}),e}getAllRowNodes(e){const t=[];this.gridRowModel.forEachNode(r=>{t.push(r)});const s=this.rowNodeSorter;if(!s)return t;const i=e===!0?this.sortSvc?.getSortOptions():e;return!i||i.length==0?t:s.doFullSortInPlace(t,i)}};import{BeanStub as ose,_getRowNode as ase}from"ag-grid-community";var lse=class extends gF{constructor(){super(...arguments),this.valueColsWithoutSeriesType=new Set}wireBeans(e){this.colModel=e.colModel,this.colNames=e.colNames}postConstruct(){const e=()=>this.valueColsWithoutSeriesType.clear();this.addManagedEventListeners({newColumnsLoaded:e,rowDataUpdated:e})}getColumn(e){return this.colModel.colsById[e]??null}getAllDisplayedColumns(){return this.beans.visibleCols.allCols}getColDisplayName(e){return this.colNames.getDisplayNameForColumn(e,"chart")}getColGroupDisplayName(e){return this.colNames.getDisplayNameForColumnGroup(e,"chart")}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getGroupDisplayColumns(){return this.beans.showRowGroupCols?.columns??[]}isPivotMode(){return this.colModel.pivotMode}isPivotActive(){return this.colModel.isPivotActive()}getChartColumns(){const e=this.colModel.colsList,t=new Set,s=new Set;for(const i of e){const r=i.colDef,n=r.chartDataType;if(n)switch(n){case"category":case"time":t.add(i);continue;case"series":s.add(i);continue;case"excluded":continue;default:this.warn(153,{chartDataType:n});break}if(r.colId==="ag-Grid-AutoColumn"){t.add(i);continue}if(!i.primary){s.add(i);continue}(this.isInferredValueCol(i)?s:t).add(i)}return{dimensionCols:t,valueCols:s}}isInferredValueCol(e){const t=e.colId;if(t==="ag-Grid-AutoColumn")return!1;const s=ase(this.beans,{rowIndex:0,rowPinned:null});if(!s)return this.valueColsWithoutSeriesType.has(t);let i=s.getDataValue(e,"data");i==null&&(i=this.extractLeafData(s,e)),i!=null&&(typeof i.toNumber=="function"?i=i.toNumber():typeof i.value=="number"&&(i=i.value));const r=typeof i=="number"||e.colDef.cellDataType==="number"||["series","time"].includes(e.colDef.chartDataType);return r?this.valueColsWithoutSeriesType.add(t):i==null&&e.colDef.cellDataType!=="number"&&this.warn(265,{colId:t}),r}extractLeafData(e,t){const s=e.data&&e.getDataValue(t,"data");if(s!=null)return s;const i=e.childrenAfterGroup;if(i)for(let r=0,n=i.length;r<n;++r){const o=i[r],a=this.extractLeafData(o,t);if(a!=null)return a}return null}destroy(){this.valueColsWithoutSeriesType.clear(),super.destroy()}};import{BeanStub as cse}from"ag-grid-community";var use=new Set(["line","groupedColumn","stackedColumn","area","stackedArea"]),dse=class extends fF{constructor(e){super(),this.suppressComboChartWarnings=!1,this.chartDataModel=e,this.seriesChartTypes=e.params.seriesChartTypes??[]}postConstruct(){this.initComboCharts()}update(e){this.seriesChartTypes=e??this.seriesChartTypes,this.initComboCharts(),this.updateSeriesChartTypes()}initComboCharts(){const e=this.seriesChartTypes&&this.seriesChartTypes.length>0;(this.chartDataModel.chartType==="customCombo"||e)&&(this.chartDataModel.chartType="customCombo",this.savedCustomSeriesChartTypes=this.seriesChartTypes||[])}updateSeriesChartTypes(){if(this.chartDataModel.isComboChart()){if(this.seriesChartTypes=this.seriesChartTypes.map(e=>{const t=["groupedColumn","stackedColumn","stackedArea"].includes(e.chartType);return e.secondaryAxis=t?!1:e.secondaryAxis,e}),this.chartDataModel.chartType==="customCombo"){this.updateSeriesChartTypesForCustomCombo();return}this.updateChartSeriesTypesForBuiltInCombos()}}updateSeriesChartTypesForCustomCombo(){!(this.seriesChartTypes&&this.seriesChartTypes.length>0)&&!this.suppressComboChartWarnings&&this.warn(150),this.seriesChartTypes=this.seriesChartTypes.map(i=>(use.has(i.chartType)||(this.warn(151,{chartType:i.chartType}),i.chartType="line"),i));const t=i=>{(!this.savedCustomSeriesChartTypes||this.savedCustomSeriesChartTypes.length===0)&&(this.savedCustomSeriesChartTypes=this.seriesChartTypes);const r=this.savedCustomSeriesChartTypes.find(n=>n.colId===i.colId);return r||(i.selected&&!this.suppressComboChartWarnings&&this.warn(152,{colId:i.colId}),{colId:i.colId,chartType:"line",secondaryAxis:!1})},s=this.chartDataModel.valueColState.map(t);this.seriesChartTypes=s,this.savedCustomSeriesChartTypes=s,this.suppressComboChartWarnings=!0}updateChartSeriesTypesForBuiltInCombos(){const{chartType:e,valueColState:t}=this.chartDataModel,s=e==="columnLineCombo"?"groupedColumn":"stackedArea",i=e==="columnLineCombo"?"line":"groupedColumn",r=t.filter(o=>o.selected),n=Math.ceil(r.length/2);this.seriesChartTypes=r.map((o,a)=>{const l=a>=n?i:s;return{colId:o.colId,chartType:l,secondaryAxis:!1}})}},mt="AG-GRID-DEFAULT-CATEGORY",hse=class extends mF{constructor(e){super(),this.unlinked=!1,this.chartData=[],this.valueColState=[],this.dimensionColState=[],this.colNames={},this.crossFiltering=!1,this.crossFilteringSort=!0,this.grouping=!1,this.useGroupColumnAsCategory=!1,this.params=e,this.chartId=e.chartId,this.setParams(e)}wireBeans(e){this.rangeSvc=e.rangeSvc,this.chartTranslation=e.chartTranslation}setParams(e){const{chartType:t,pivotChart:s,chartThemeName:i,switchCategorySeries:r,aggFunc:n,cellRange:o,suppressChartRanges:a,unlinkChart:l,crossFiltering:c,crossFilteringSort:u,seriesGroupType:d,useGroupColumnAsCategory:h}=e;this.chartType=t,this.pivotChart=s??!1,this.chartThemeName=i,this.switchCategorySeries=!!r,this.aggFunc=n,this.referenceCellRange=o,this.suppliedCellRange=o,this.suppressChartRanges=a??!1,this.unlinked=!!l,this.crossFiltering=!!c,this.crossFilteringSort=u??!0,this.seriesGroupType=d,this.useGroupColumnAsCategory=!!h}postConstruct(){this.datasource=this.createManagedBean(new nse),this.chartColSvc=this.createManagedBean(new lse),this.comboChartModel=this.createManagedBean(new dse(this)),this.updateCellRanges({setColsFromRange:!0}),this.updateData()}updateModel(e){const{cellRange:t,seriesChartTypes:s}=e,i=t!==this.suppliedCellRange;i&&(this.dimensionCellRange=void 0,this.valueCellRange=void 0),this.setParams(e),this.updateSelectedDimensions(t?.columns),this.updateCellRanges({setColsFromRange:!0,isExplicitRangeChange:i}),(this.isComboChart()||s)&&this.comboChartModel.update(s),this.unlinked||this.updateData()}updateCellRanges(e){const{updatedColState:t,resetOrder:s,maintainColState:i,setColsFromRange:r,updateOrder:n,isExplicitRangeChange:o}=e??{};this.valueCellRange&&(this.referenceCellRange=this.valueCellRange);const{dimensionCols:a,valueCols:l}=this.chartColSvc.getChartColumns(),c=this.getAllColumnsFromRanges();t&&this.updateColumnState(t,s),this.setDimensionCellRange(a,c,t),this.setValueCellRange(l,c,r),!t&&!i&&(this.resetColumnState(n,o),this.syncDimensionCellRange()),this.comboChartModel.updateSeriesChartTypes()}updateData(){const{startRow:e,endRow:t}=this.getRowIndexes();this.pivotChart&&this.resetColumnState(),this.grouping=this.isGrouping();const s={aggFunc:this.aggFunc,dimensionCols:this.getSelectedDimensions(),grouping:this.grouping,pivoting:this.isPivotActive(),crossFiltering:this.crossFiltering,crossFilteringSort:this.getCrossFilteringSort(),valueCols:this.getSelectedValueCols(),startRow:e,endRow:t,isScatter:["scatter","bubble"].includes(this.chartType),combineGroupValues:xte(ee(this.chartType))},{chartData:i,colNames:r,groupChartData:n}=this.datasource.getData(s);this.chartData=i,this.groupChartData=n,this.colNames=r,this.categoryAxisType=void 0}isGrouping(){const e=this.gos.get("treeData"),t=e?null:this.chartColSvc.getRowGroupColumns(),s=e||t&&t.length>0,i=this.getSelectedDimensions().map(({colId:o})=>o),n=this.chartColSvc.getGroupDisplayColumns().map(o=>o.colId).some(o=>i.includes(o));return!!s&&n}getSelectedValueCols(){return this.valueColState.filter(e=>e.selected).map(e=>e.column)}getSelectedDimensions(){return this.dimensionColState.filter(e=>e.selected)}getValueColState(){return this.valueColState.map(this.displayNameMapper.bind(this))}displayNameMapper(e){const{column:t}=e;if(t){const s=this.getColDisplayName(t);e.displayName=this.isPivotMode()?this.getPivotDisplayName(t,s):s}else{const s=this.colNames[e.colId];e.displayName=s?s.join(" - "):this.getColDisplayName(t)}return e}getPivotDisplayName(e,t){let s=!1,i=[t];const r=n=>{if(!n)return;const o=this.chartColSvc.getColGroupDisplayName(n);o?.length?(i.unshift(o),r(n.getParent())):s=!0};if(r(e.getParent()),s){const n=this.colNames[e.colId];n&&(i=n)}return i.join(" - ")}getColDisplayName(e){return this.chartColSvc.getColDisplayName(e)}isPivotMode(){return this.chartColSvc.isPivotMode()}getChartDataType(e){const t=this.chartColSvc.getColumn(e);return t?t.colDef.chartDataType:void 0}getConvertTime(e){const t=this.chartColSvc.getColumn(e);if(t?.colDef.cellDataType==="dateString")return this.beans.dataTypeSvc?.getDateParserFunction(t)}isPivotActive(){return this.chartColSvc.isPivotActive()}createCellRange(e,...t){return{id:this.chartId,startRow:this.referenceCellRange.startRow,endRow:this.referenceCellRange.endRow,columns:t,startColumn:e===pr.DIMENSION||this.referenceCellRange.startColumn==null?t[0]:this.referenceCellRange.startColumn,type:e}}getAllColumnsFromRanges(){if(this.pivotChart)return new Set(this.chartColSvc.getAllDisplayedColumns());const e=this.dimensionCellRange||this.valueCellRange?[]:this.referenceCellRange.columns;return this.dimensionCellRange&&e.push(...this.dimensionCellRange.columns),this.valueCellRange&&e.push(...this.valueCellRange.columns),new Set(e)}getRowIndexes(){let e=0,t=0;const{rangeSvc:s,valueCellRange:i,dimensionCellRange:r}=this,n=i||r;if(s&&n){e=s.getRangeStartRow(n).rowIndex;const o=s.getRangeEndRow(n);t=o.rowPinned==="bottom"?-1:o.rowIndex}return{startRow:e,endRow:t}}getSelectedColIds(e){return new Set(e.filter(t=>t.selected).map(t=>t.colId))}isColumnSelectable(e,t,s,i){return s&&!e.isVisible()&&i.has(e.colId)?!0:t.has(e)&&(s||e.isVisible())}resetColumnState(e,t){const{dimensionCols:s,valueCols:i}=this.chartColSvc.getChartColumns(),r=this.getAllColumnsFromRanges(),n=this.valueColState.length<1,o=n||e?void 0:new Map(this.valueColState.map(S=>[S.colId,S.order])),a=!this.pivotChart&&this.gos.get("includeHiddenColumnsInCharts"),l=t?new Set:this.getSelectedColIds(this.dimensionColState),c=t?new Set:this.getSelectedColIds(this.valueColState);this.dimensionColState=[],this.valueColState=[];const u=gs(ee(this.chartType));let d=!1,h=1;const p=this.suppliedCellRange.columns[0],g=this.gos.get("treeData"),f=g?null:this.chartColSvc.getRowGroupColumns(),m=g||f&&f.length>0;s.forEach(S=>{const w=Jte(S),b=this.crossFiltering&&this.aggFunc?p.getColId()===S.colId:this.useGroupColumnAsCategory&&m&&w||(!d||u)&&this.isColumnSelectable(S,r,a,l);this.dimensionColState.push({column:S,colId:S.colId,displayName:this.getColDisplayName(S),selected:b,order:h++}),b&&(d=!0)});const v={colId:mt,displayName:this.chartTranslation.translate("defaultCategory"),selected:!d,order:0};this.dimensionColState.unshift(v);const C=this.referenceCellRange.columns.filter(S=>i.has(S));if(i.forEach(S=>{n&&this.referenceCellRange.columns.includes(S)&&(S=C.shift()),this.valueColState.push({column:S,colId:S.colId,displayName:this.getColDisplayName(S),selected:this.isColumnSelectable(S,r,a,c),order:h++})}),o){let S=Math.max(...o.values())+1;this.valueColState.forEach(w=>{w.order=o.has(w.colId)?o.get(w.colId):S++}),this.valueColState.sort((w,b)=>w.order-b.order)}}updateColumnState(e,t){const s=c=>c.colId===e.colId,{dimensionColState:i,valueColState:r}=this,n=i.find(s),o=r.find(s);if(n)if(gs(ee(this.chartType)))n.selected=e.selected;else{const u=e.selected?n:i.filter(d=>d!==n).find(({selected:d})=>d);i.forEach(d=>d.selected=d===u)}else o&&(o.selected=e.selected);const a=[...i,...r],l=[];t||(a.forEach((c,u)=>{u===e.order&&l.push(e.colId),c.colId!==e.colId&&l.push(c.colId)}),a.forEach(c=>{const u=l.indexOf(c.colId);c.order=u>=0?l.indexOf(c.colId):a.length-1})),this.reorderColState()}reorderColState(){const e=(t,s)=>t.order-s.order;this.dimensionColState.sort(e),this.valueColState.sort(e)}setDimensionCellRange(e,t,s){this.dimensionCellRange=void 0;const i=gs(ee(this.chartType));if(!s&&!this.dimensionColState.length){const a=new Array;e.forEach(l=>{a.length>0&&!i||!t.has(l)||a.push(l)}),a.length>0&&(this.dimensionCellRange=this.createCellRange(pr.DIMENSION,...a));return}let r=s?[s]:[];if(this.crossFiltering&&this.aggFunc){const a=this.suppliedCellRange.columns[0];r=this.dimensionColState.filter(l=>l.colId===a.getColId())}else(i||r.length===0||r.some(({column:a})=>!a||!e.has(a)))&&(r=this.dimensionColState.filter(a=>a.selected));const n=r.length===1?r[0].colId===mt:!1,o=r.map(({column:a})=>a).filter(a=>a!=null);o.length>0&&!n&&(this.dimensionCellRange=this.createCellRange(pr.DIMENSION,...o))}setValueCellRange(e,t,s){this.valueCellRange=void 0;const i=[],r=wo(this.chartType);let n=0;if(e.forEach(o=>{s?(r==null||n<r)&&t.has(o)&&(i.push(o),n++):this.valueColState.some(a=>a.selected&&a.colId===o.colId)&&i.push(o)}),i.length>0){let o=[];this.valueColState.length>0?o=this.valueColState.map(a=>a.colId):t.forEach(a=>o.push(a.colId)),i.sort((a,l)=>o.indexOf(a.colId)-o.indexOf(l.colId)),this.valueCellRange=this.createCellRange(pr.VALUE,...i)}}resetCellRanges(e,t){if(!e&&!t)return;const{dimensionCols:s,valueCols:i}=this.chartColSvc.getChartColumns(),r=this.getAllColumnsFromRanges();e&&this.setDimensionCellRange(s,r),t&&this.setValueCellRange(i,r)}updateSelectedDimensions(e){const t=new Set(e.map(i=>i.colId));if(gs(ee(this.chartType))){const i=this.dimensionColState.filter(n=>t.has(n.colId)),r=new Set(i.map(n=>n.colId));this.dimensionColState=this.dimensionColState.map(n=>({...n,selected:r.has(n.colId)}))}else{const r=(this.dimensionColState.find(n=>t.has(n.colId))||this.dimensionColState[0]).colId;this.dimensionColState=this.dimensionColState.map(n=>({...n,selected:n.colId===r}))}}syncDimensionCellRange(){const e=this.getSelectedDimensions();if(e.length===0)return;const t=e.map(({column:s})=>s).filter(s=>s!=null);t.length>0&&(this.dimensionCellRange=this.createCellRange(pr.DIMENSION,...t))}isComboChart(e){return hu(e??this.chartType)}getCrossFilteringSort(){const e=this.crossFilteringSort;if(typeof e=="boolean")return e;const t=[];return e.forEach(({sort:s,colId:i})=>{const r=this.chartColSvc.getColumn(i);r&&t.push({sort:s,column:r,type:Xte(r.getSortDef()?.type),colComparator:void 0,leafComparator:void 0,descending:!1,absolute:!1})}),Zte(t,this.beans.colModel),t}},Fb=class extends Yt{getAxes(e,t){return{x:{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},y:{type:"number",position:this.isHorizontal(t)?"bottom":"left"}}}computeSeriesStatistics(e,t){const{data:s,fields:i}=e,[r]=e.categories,n=r.id||mt,o=this.groupDataByCategory(n,s);return Array.from(o).map(([a,l])=>{const c={[r.id]:a};return i.forEach((u,d)=>{const h=l.map(g=>g[u.colId]).filter(g=>typeof g=="number"&&!isNaN(g)),p=t(h);for(const g of Object.keys(p)){const f=`${g}:${d}`;c[f]=h.length>0?p[g]:null}}),c})}groupDataByCategory(e,t){const s=i=>{if(e===mt)return 1;const r=i[e];return r==null?"":r instanceof Date?r.getTime():r};return t.reduce((i,r)=>{const n=s(r),o=i.get(n);return o?o.push(r):i.set(n,[r]),i},new Map)}},pse=class extends Fb{getSeries(e){const[t]=e.categories;return e.fields.map((s,i)=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yName:s.displayName??void 0,minName:"Min",q1Name:"Q1",medianName:"Median",q3Name:"Q3",maxName:"Max",minKey:`min:${i}`,q1Key:`q1:${i}`,medianKey:`median:${i}`,q3Key:`q3:${i}`,maxKey:`max:${i}`}))}getData(e){return this.computeSeriesStatistics(e,t=>{const s=t.sort((i,r)=>i-r);return{min:s[0],q1:this.quantile(s,.25),median:this.quantile(s,.5),q3:this.quantile(s,.75),max:s[s.length-1]}})}quantile(e,t){const s=(e.length-1)*t,i=Math.floor(s),r=s-i;return e[i+1]!==void 0?e[i]+r*(e[i+1]-e[i]):e[i]}},gse=class extends Fb{getSeries(e){const[t]=e.categories;return e.fields.map((s,i)=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yName:s.displayName??void 0,yLowName:"Min",yHighName:"Max",yLowKey:`min:${i}`,yHighKey:`max:${i}`}))}getData(e){return this.computeSeriesStatistics(e,t=>({min:Math.min(...t),max:Math.max(...t)}))}},fse=class extends vF{constructor(){super(...arguments),this.beanName="enterpriseChartProxyFactory"}createChartProxy(e){switch(e.chartType){case"histogram":return new _te(e);case"radarLine":case"radarArea":case"nightingale":case"radialColumn":case"radialBar":return new Ute(e);case"rangeBar":case"rangeArea":return new gse(e);case"boxPlot":return new pse(e);case"treemap":case"sunburst":return new Hte(e);case"heatmap":return new jte(e);case"waterfall":return new Gte(e);case"funnel":case"coneFunnel":case"pyramid":return new Ote(e)}}};import{_findFocusableElements as Tb,_findNextFocusableElement as mse}from"ag-stack";import{BeanStub as vse,TabGuardComp as Cse}from"ag-grid-community";import{Component as Sse}from"ag-grid-community";import{_removeFromParent as bse}from"ag-stack";import{BeanStub as yse}from"ag-grid-community";var Ab=class extends CF{constructor(e,t,s,i){super(),this.chartController=e,this.eGui=t,this.cssClass=s,this.createPanels=i,this.panels=[]}postConstruct(){this.addManagedListeners(this.chartController,{chartUpdated:()=>this.refreshPanels(!0),chartApiUpdate:()=>this.refreshPanels(!1)})}addComponent(e){this.createBean(e),this.panels.push(e),e.addCss(this.cssClass),this.eGui.appendChild(e.getGui())}refreshPanels(e){const t=this.chartController.getChartType(),s=this.chartController.isGrouping(),i=ee(t);e&&t===this.chartType&&s===this.isGrouping||(this.destroyPanels(),this.createPanels(t,i),this.chartType=t,this.isGrouping=s)}destroyPanels(){for(const e of this.panels)bse(e.getGui()),this.destroyBean(e);this.panels=[]}destroy(){this.destroyPanels(),super.destroy()}};import{AgInputNumberFieldSelector as wse,Component as xse}from"ag-grid-community";var Fse=class extends SF{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("animation.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("animation"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultNumberInputParams("animation.duration","durationMillis",{min:0});this.setTemplate(`<div>
<ag-group-component data-ref="animationGroup">
<ag-input-number-field data-ref="animationHeightInput"></ag-input>
</ag-group-component>
</div>`,[J,wse],{animationGroup:e,animationHeightInput:t})}};import{AgCheckboxSelector as Tse,Component as Ase}from"ag-grid-community";var Pb=class extends Xo{constructor(e){super({...e,dialogCallbacks:th})}},vt={selector:"AG-COLOR-PICKER",component:Pb},Pse=class extends bF{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("crosshair.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("crosshair"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.label.enabled","crosshairLabel"),s=this.chartMenuParamsFactory.getDefaultCheckboxParams("crosshair.snap","crosshairSnap"),i=this.chartMenuParamsFactory.getDefaultColorPickerParams("crosshair.stroke","color");this.setTemplate(`<div>
<ag-group-component data-ref="crosshairGroup">
<ag-checkbox data-ref="crosshairLabelCheckbox"></ag-checkbox>
<ag-checkbox data-ref="crosshairSnapCheckbox"></ag-checkbox>
<ag-color-picker data-ref="crosshairStrokeColorPicker"></ag-color-picker>
</ag-group-component>
</div>`,[J,Tse,vt],{crosshairGroup:e,crosshairLabelCheckbox:t,crosshairSnapCheckbox:s,crosshairStrokeColorPicker:i})}};import{AgCheckboxSelector as Rse,Component as Mse}from"ag-grid-community";var Ise=class extends yF{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("navigator.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("navigator"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultSliderParams("navigator.height","height",60);t.minValue=10;const s=this.chartMenuParamsFactory.getDefaultCheckboxParams("navigator.miniChart.enabled","miniChart");this.setTemplate(`<div>
<ag-group-component data-ref="navigatorGroup">
<ag-slider data-ref="navigatorHeightSlider"></ag-slider>
<ag-checkbox data-ref="navigatorMiniChartCheckbox"></ag-checkbox>
</ag-group-component>
</div>`,[J,Te,Rse],{navigatorGroup:e,navigatorHeightSlider:t,navigatorMiniChartCheckbox:s})}};import{RefPlaceholder as Ese}from"ag-stack";import{AgCheckboxSelector as Dse,Component as Lse}from"ag-grid-community";var kse=class extends wF{constructor(e){super(),this.chartMenuParamsFactory=e,this.zoomScrollingStepInput=Ese}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("zoom.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("zoom"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableScrolling","scrollingZoom"),s=this.chartMenuParamsFactory.getDefaultSliderParams("zoom.scrollingStep","scrollingStep",1);s.step=.01,s.minValue=s.step;const i=this.chartMenuParamsFactory.getDefaultCheckboxParams("zoom.enableSelecting","selectingZoom");t.onValueChange=(r=>n=>{r&&(r(n),this.zoomScrollingStepInput.setDisabled(!n))})(t.onValueChange),this.setTemplate(`<div>
<ag-group-component data-ref="zoomGroup">
<ag-checkbox data-ref="zoomSelectingCheckbox"></ag-checkbox>
<ag-checkbox data-ref="zoomScrollingCheckbox"></ag-checkbox>
<ag-slider data-ref="zoomScrollingStepInput"></ag-slider>
</ag-group-component>
</div>`,[J,Dse,Te],{zoomGroup:e,zoomScrollingCheckbox:t,zoomScrollingStepInput:s,zoomSelectingCheckbox:i}),this.zoomScrollingStepInput.setDisabled(!t.value)}},_se=["navigator","zoom","animation","crosshair"],Gse=class extends xF{constructor(e){super('<div class="ag-chart-advanced-settings-wrapper"></div>'),this.chartMenuContext=e}postConstruct(){this.chartPanelFeature=this.createManagedBean(new Ab(this.chartMenuContext.chartController,this.getGui(),"ag-chart-advanced-settings-section",(e,t)=>this.createPanels(e,t))),this.chartPanelFeature.refreshPanels()}createPanels(e,t){for(const s of _se){if(!this.isGroupPanelShownForSeries(s,t))continue;const i=this.createPanel(s);this.chartPanelFeature.addComponent(i)}}isGroupPanelShownForSeries(e,t){return e==="animation"||jt(t)&&!pu(t)}createPanel(e){const{chartMenuParamsFactory:t,chartAxisMenuParamsFactory:s}=this.chartMenuContext;switch(e){case"navigator":return new Ise(t);case"zoom":return new kse(t);case"animation":return new Fse(t);case"crosshair":return new Pse(s)}}},Ose=class extends FF{constructor(){super(...arguments),this.beanName="advSettingsMenuFactory"}showMenu(e,t){this.hideMenu();const s=this.createBean(new Nse(e));this.activeDialog=this.createBean(new ns({title:this.beans.chartTranslation.translate("advancedSettings"),component:s,width:300,height:400,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{Tb(s.getGui())[0]?.focus()},closedCallback:()=>{this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=void 0,t?.focus({preventScroll:!0})}})),this.activeMenu=s}hideMenu(){this.activeDialog&&this.destroyBean(this.activeDialog)}destroy(){this.activeMenu=this.destroyBean(this.activeMenu),this.activeDialog=this.destroyBean(this.activeDialog),super.destroy()}},Nse=class extends TF{constructor(e){super('<div class="ag-chart-advanced-settings"></div>'),this.chartMenuContext=e}postConstruct(){this.advancedSettingsPanel=this.createManagedBean(new Gse(this.chartMenuContext)),this.getGui().appendChild(this.advancedSettingsPanel.getGui()),this.initialiseTabGuard({onTabKeyDown:this.onTabKeyDown.bind(this),focusTrapActive:!0})}onTabKeyDown(e){if(e.defaultPrevented)return;e.preventDefault();const t=e.shiftKey,s=this.advancedSettingsPanel.getGui(),i=mse({beans:this.beans,rootNode:s,backwards:t});if(i)i.focus();else{const r=Tb(s);r.length&&r[t?r.length-1:0].focus()}}};import{RefPlaceholder as Bse,_focusInto as Vse,_isNothingFocused as Hse}from"ag-stack";import{BeanStub as Use,Component as zse,_addGridCommonParams as Wse,_createIconNoSpan as $se}from"ag-grid-community";var Kse=class extends AF{constructor(){super(...arguments),this.beanName="chartMenuListFactory"}wireBeans(e){this.popupSvc=e.popupSvc,this.chartMenuSvc=e.chartMenuSvc,this.chartTranslation=e.chartTranslation}showMenuList(e){const{eventSource:t,showMenu:s,chartMenuContext:i}=e,r=this.chartMenuSvc.doChartToolPanelsExist(i.chartController),n=this.mapWithStockItems(this.getMenuItems(i.chartController,r),i,s,t,r);if(!n.length)return;const o=this.createBean(new jse(n));this.activeChartMenuList=o;let a=-1,l="left";this.gos.get("enableRtl")&&(a=1,l="right");const c=o.getGui();this.popupSvc.addPopup({modal:!0,eChild:c,closeOnEsc:!0,alwaysOnTop:!0,closedCallback:()=>{this.destroyBean(o),this.activeChartMenuList=void 0,Hse(this.beans)&&t.focus({preventScroll:!0})},afterGuiAttached:u=>o.afterGuiAttached(u),positionCallback:()=>{this.popupSvc.positionPopupByComponent({type:"chartMenu",eventSource:t,ePopup:c,alignSide:l,nudgeX:4*a,nudgeY:4,position:"under",keepWithinBounds:!0})},ariaLabel:"Chart Menu"})}getMenuItems(e,t){const s=[...t?["chartEdit"]:[],...e.isEnterprise()?["chartAdvancedSettings"]:[],e.isChartLinked()?"chartUnlink":"chartLink","chartDownload"],i=this.gos.get("chartMenuItems");return i?Array.isArray(i)?i:i(Wse(this.gos,{defaultItems:s,chartId:e.getChartId()})):s}mapWithStockItems(e,t,s,i,r){if(!e)return[];const n=[];for(const o of e){let a;if(typeof o=="string"?a=this.getStockMenuItem(o,t,s,i,r):a={...o},!a)continue;const{subMenu:l}=a;Array.isArray(l)&&(a.subMenu=this.mapWithStockItems(l,t,s,i,r)),n.push(a)}return n}getStockMenuItem(e,t,s,i,r){switch(e){case"chartEdit":return r?this.createMenuItem(this.chartTranslation.translate("chartEdit"),"chartsMenuEdit",s):null;case"chartAdvancedSettings":return this.createMenuItem(this.chartTranslation.translate("chartAdvancedSettings"),"chartsMenuAdvancedSettings",()=>this.chartMenuSvc.openAdvancedSettings(t,i));case"chartUnlink":return t.chartController.isChartLinked()?this.createMenuItem(this.chartTranslation.translate("chartUnlink"),"unlinked",()=>this.chartMenuSvc.toggleLinked(t)):null;case"chartLink":return t.chartController.isChartLinked()?null:this.createMenuItem(this.chartTranslation.translate("chartLink"),"linked",()=>this.chartMenuSvc.toggleLinked(t));case"chartDownload":return this.createMenuItem(this.chartTranslation.translate("chartDownload"),"chartsDownload",()=>this.chartMenuSvc.downloadChart(t))}return null}createMenuItem(e,t,s){return{name:e,icon:$se(t,this.beans,null),action:s}}destroy(){this.destroyBean(this.activeChartMenuList),super.destroy()}},jse=class extends PF{constructor(e){super(`
<div data-ref="eChartsMenu" role="presentation" class="ag-menu ag-chart-menu-popup"></div>
`),this.menuItems=e,this.eChartsMenu=Bse}postConstruct(){this.mainMenuList=this.createManagedBean(new nn(0)),this.mainMenuList.addMenuItems(this.menuItems),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eChartsMenu.appendChild(this.mainMenuList.getGui())}onHidePopup(){this.hidePopupFunc?.()}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),Vse(this.mainMenuList.getGui())}};import{BeanStub as Yse}from"ag-grid-community";var qse=class extends RF{constructor(){super(...arguments),this.beanName="chartCrossFilterSvc"}filter(e,t=!1){const s=this.beans.filterManager,i=s?.getFilterModel()??{};if(t){Object.keys(i).length>0&&s?.setFilterModel(null);return}let r=Rb(e);r.indexOf("-filtered-out")&&(r=r.replace("-filtered-out","")),this.updateFilters(i,e,r)}updateFilters(e,t,s){const i=Rb(t),r=this.convertRawValue(s,t.datum[i]);if(r===void 0)return;const n=this.beans.filterManager;n?.getColumnFilterInstance(s).then(o=>{const a=o?.filterType;let l,c=g=>g;if(a==="multi"){const g=Zse(o);l=g.setFilter,c=g.processModel??c}else a==="set"&&(l=o);if(!l){this.warn(154,{colId:s});return}const u=t.event.metaKey||t.event.ctrlKey,d=l.getFilterHandler().getCrossFilterModel((g,f,m)=>Jse(u,g(r),f,m)),h=c(d),p=u?{...e}:{};p[s]=h,n?.setFilterModel(p)})}convertRawValue(e,t){const{colModel:s,dataTypeSvc:i}=this.beans,r=s.colsById[e],n=r?.colDef;return n&&i&&n.chartDataType==="time"&&n.cellDataType==="dateString"?i.getDateFormatterFunction(r)(t):t}};function Xse(e,t,s){const i=new Array(s);for(let r=0;r<s;r++)i[r]=r===t?e:null;return{filterType:"multi",filterModels:i}}function Zse(e){const t=e.getNumChildFilters();for(let s=0;s<t;s++){const i=e.getChildFilterInstance(s);if(i?.filterType==="set")return{setFilter:i,processModel:r=>Xse(r,s,t)}}return{}}function Rb(e){return e.xKey||e.calloutLabelKey}function Jse(e,t,s,i){let r;if(e)if(s.has(t)&&(i==null||i.includes(t)))if(r=[],i==null)for(const n of s)n!==t&&r.push(n);else for(const n of i)n!==t&&s.has(n)&&r.push(n);else{if(i==null)r=Array.from(s);else{r=[];for(const n of i)s.has(n)&&r.push(n)}r.push(t)}else r=[t];return{filterType:"set",values:r}}import{BeanStub as Qse}from"ag-grid-community";var eie=["chartUnlink","chartLink","chartDownload","chartMenu"],Fo={settings:"chartSettings",data:"chartData",format:"chartFormat"},tie=class extends MF{constructor(){super(...arguments),this.beanName="chartMenuSvc"}wireBeans(e){this.advSettingsMenuFactory=e.advSettingsMenuFactory}downloadChart(e,t,s,i){e.chartController.getChartProxy().downloadChart(t,s,i)}toggleLinked(e){e.chartController.detachChartRange()}openAdvancedSettings(e,t){this.advSettingsMenuFactory?.showMenu(e,t)}hideAdvancedSettings(){this.advSettingsMenuFactory?.hideMenu()}getChartToolbarOptions(){const e=["chartMenu"],t=this.gos.getCallback("getChartToolbarItems");return t?t({defaultItems:e}).filter(i=>eie.includes(i)?!0:(this.warn(155,{option:i}),!1)):e}getChartToolPanels(e){const t=this.gos.get("chartToolPanelsDef");let i=t?.panels?.map(o=>{const a=Fo[o];return a||this.warn(156,{panel:o}),a}).filter(o=>!!o)??Object.values(Fo);e.isPivotChart()&&(i=i.filter(o=>o!=="chartData"));const r=t?.defaultToolPanel,n=r&&Fo[r]||i[0];return{panels:i,defaultPanel:n}}doesChartToolbarExist(){return this.getChartToolbarOptions().length>0}doChartToolPanelsExist(e){const{panels:t}=this.getChartToolPanels(e);return t.length>0}};import{BeanStub as sie}from"ag-grid-community";var iie={pivotChartTitle:"Pivot Chart",rangeChartTitle:"Range Chart",settings:"Chart",data:"Set Up",format:"Customize",categories:"Categories",defaultCategory:"(None)",series:"Series",switchCategorySeries:"Switch Category / Series",categoryValues:"Category Values",seriesLabels:"Series Labels",aggregate:"Aggregate",xyValues:"X Y Values",paired:"Paired Mode",axis:"Axis",xAxis:"Horizontal Axis",yAxis:"Vertical Axis",polarAxis:"Polar Axis",radiusAxis:"Radius Axis",navigator:"Navigator",zoom:"Zoom",animation:"Animation",crosshair:"Crosshair",color:"Color",thickness:"Thickness",preferredLength:"Preferred Length",xType:"X Type",axisType:"Axis Type",automatic:"Automatic",category:"Category",number:"Number",time:"Time",timeFormat:"Time Format",autoRotate:"Auto Rotate",labelRotation:"Rotation",circle:"Circle",polygon:"Polygon",square:"Square",cross:"Cross",diamond:"Diamond",plus:"Plus",triangle:"Triangle",heart:"Heart",orientation:"Orientation",fixed:"Fixed",parallel:"Parallel",perpendicular:"Perpendicular",radiusAxisPosition:"Position",ticks:"Ticks",gridLines:"Grid Lines",width:"Width",height:"Height",length:"Length",padding:"Padding",spacing:"Spacing",chartStyle:"Chart Style",title:"Title",chartTitles:"Titles",chartTitle:"Chart Title",chartSubtitle:"Subtitle",horizontalAxisTitle:"Horizontal Axis Title",verticalAxisTitle:"Vertical Axis Title",polarAxisTitle:"Polar Axis Title",titlePlaceholder:"Chart Title",background:"Background",font:"Font",weight:"Weight",top:"Top",right:"Right",bottom:"Bottom",left:"Left",labels:"Labels",calloutLabels:"Callout Labels",sectorLabels:"Sector Labels",positionRatio:"Position Ratio",size:"Size",shape:"Shape",minSize:"Minimum Size",maxSize:"Maximum Size",legend:"Legend",position:"Position",markerSize:"Marker Size",markerStroke:"Marker Stroke",markerPadding:"Marker Padding",itemSpacing:"Item Spacing",itemPaddingX:"Item Padding X",itemPaddingY:"Item Padding Y",layoutHorizontalSpacing:"Horizontal Spacing",layoutVerticalSpacing:"Vertical Spacing",strokeWidth:"Stroke Width",offset:"Offset",offsets:"Offsets",tooltips:"Tooltips",callout:"Callout",markers:"Markers",shadow:"Shadow",blur:"Blur",xOffset:"X Offset",yOffset:"Y Offset",lineWidth:"Line Width",lineDash:"Line Dash",lineDashOffset:"Dash Offset",scrollingZoom:"Scrolling",scrollingStep:"Scrolling Step",selectingZoom:"Selecting",durationMillis:"Duration (ms)",crosshairLabel:"Label",crosshairSnap:"Snap to Node",normal:"Normal",bold:"Bold",italic:"Italic",boldItalic:"Bold Italic",predefined:"Predefined",fillOpacity:"Fill Opacity",strokeColor:"Line Color",strokeOpacity:"Line Opacity",miniChart:"Mini-Chart",histogramBinCount:"Bin count",connectorLine:"Connector Line",seriesItems:"Series Items",seriesItemType:"Item Type",seriesItemPositive:"Positive",seriesItemNegative:"Negative",seriesItemLabels:"Item Labels",columnGroup:"Column",barGroup:"Bar",pieGroup:"Pie",lineGroup:"Line",scatterGroup:"X Y (Scatter)",areaGroup:"Area",polarGroup:"Polar",statisticalGroup:"Statistical",hierarchicalGroup:"Hierarchical",specializedGroup:"Specialized",combinationGroup:"Combination",groupedColumnTooltip:"Grouped",stackedColumnTooltip:"Stacked",normalizedColumnTooltip:"100% Stacked",groupedBarTooltip:"Grouped",stackedBarTooltip:"Stacked",normalizedBarTooltip:"100% Stacked",pieTooltip:"Pie",donutTooltip:"Donut",lineTooltip:"Line",stackedLineTooltip:"Stacked",normalizedLineTooltip:"100% Stacked",groupedAreaTooltip:"Area",stackedAreaTooltip:"Stacked",normalizedAreaTooltip:"100% Stacked",scatterTooltip:"Scatter",bubbleTooltip:"Bubble",histogramTooltip:"Histogram",radialColumnTooltip:"Radial Column",radialBarTooltip:"Radial Bar",radarLineTooltip:"Radar Line",radarAreaTooltip:"Radar Area",nightingaleTooltip:"Nightingale",rangeBarTooltip:"Range Bar",rangeAreaTooltip:"Range Area",boxPlotTooltip:"Box Plot",treemapTooltip:"Treemap",sunburstTooltip:"Sunburst",waterfallTooltip:"Waterfall",heatmapTooltip:"Heatmap",columnLineComboTooltip:"Column & Line",areaColumnComboTooltip:"Area & Column",customComboTooltip:"Custom Combination",innerRadius:"Inner Radius",startAngle:"Start Angle",endAngle:"End Angle",reverseDirection:"Reverse Direction",groupPadding:"Group Padding",seriesPadding:"Series Padding",tile:"Tile",whisker:"Whisker",cap:"Cap",capLengthRatio:"Length Ratio",labelPlacement:"Placement",inside:"Inside",outside:"Outside",noDataToChart:"No data available to be charted.",pivotChartRequiresPivotMode:"Pivot Chart requires Pivot Mode enabled.",chartSettingsToolbarTooltip:"Menu",chartLinkToolbarTooltip:"Linked to Grid",chartUnlinkToolbarTooltip:"Unlinked from Grid",chartDownloadToolbarTooltip:"Download Chart",chartMenuToolbarTooltip:"Menu",chartEdit:"Edit Chart",chartAdvancedSettings:"Advanced Settings",chartLink:"Link to Grid",chartUnlink:"Unlink from Grid",chartDownload:"Download Chart",histogramFrequency:"Frequency",seriesChartType:"Series Chart Type",seriesType:"Series Type",secondaryAxis:"Secondary Axis",seriesAdd:"Add a series",categoryAdd:"Add a category",bar:"Bar",column:"Column",histogram:"Histogram",advancedSettings:"Advanced Settings",direction:"Direction",horizontal:"Horizontal",vertical:"Vertical",seriesGroupType:"Group Type",groupedSeriesGroupType:"Grouped",stackedSeriesGroupType:"Stacked",normalizedSeriesGroupType:"100% Stacked",legendEnabled:"Enabled",groupedColumnFull:"Grouped Column",stackedColumnFull:"Stacked Column",normalizedColumnFull:"100% Stacked Column",groupedBarFull:"Grouped Bar",stackedBarFull:"Stacked Bar",normalizedBarFull:"100% Stacked Bar",stackedAreaFull:"Stacked Area",normalizedAreaFull:"100% Stacked Area",stackedLineFull:"Stacked Line",normalizedLineFull:"100% Stacked Line",customCombo:"Custom Combination",funnel:"Funnel",coneFunnel:"Cone Funnel",pyramid:"Pyramid",funnelGroup:"Funnel",funnelTooltip:"Funnel",coneFunnelTooltip:"Cone Funnel",pyramidTooltip:"Pyramid",dropOff:"Drop-Off",stageLabels:"Stage Labels",reverse:"Reverse",tooltipMode:"Tooltip Mode",tooltipModeSingle:"Single",tooltipModeShared:"Multiple",tooltipModeCompact:"Compact",groupedColumn:"Grouped",stackedColumn:"Stacked",pie:"Pie",donut:"Donut",line:"Line",scatter:"Scatter",bubble:"Bubble",area:"Area",stackedArea:"Stacked",radarLine:"Radar Line",radarArea:"Radar Area",nightingale:"Nightingale",radialColumn:"Radial Column",radialBar:"Radial Bar",boxPlot:"Box Plot",rangeBar:"Range Bar",rangeArea:"Range Area",treemap:"Treemap",sunburst:"Sunburst",waterfall:"Waterfall",heatmap:"Heatmap",columnLineCombo:"Column & Line",AreaColumnCombo:"Area & Column",ariaChartMenuClose:"Close Chart Edit Menu",ariaChartSelected:"Selected",group:"Group",timeFormatSlashesDDMMYYYY:"DD/MM/YYYY",timeFormatSlashesMMDDYYYY:"MM/DD/YYYY",timeFormatSlashesDDMMYY:"DD/MM/YY",timeFormatSlashesMMDDYY:"MM/DD/YY",timeFormatDotsDDMYY:"DD.M.YY",timeFormatDotsMDDYY:"M.DD.YY",timeFormatDashesYYYYMMDD:"YYYY-MM-DD",timeFormatSpacesDDMMMMYYYY:"DD MMMM YYYY",timeFormatHHMMSS:"HH:MM:SS",timeFormatHHMMSSAmPm:"HH:MM:SS AM/PM",sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},rie=class extends IF{constructor(){super(...arguments),this.beanName="chartTranslation"}translate(e){const t=this.getLocaleTextFunc(),s=iie[e];return t(e,s)}};import{_focusInto as nie,_initDetachedStyledRoot as oie}from"ag-stack";import{BeanStub as aie}from"ag-grid-community";import{RefPlaceholder as gr,_clearElement as lie,_focusInto as cie,_getAbsoluteHeight as uie,_getAbsoluteWidth as die,_removeFromParent as hie,_setDisplayed as Mb}from"ag-stack";import{Component as pie,_addGridCommonParams as gie,_errMsg as Ib,_focusGridInnerElement as fie,_mergeDeep as mie}from"ag-grid-community";import{BeanStub as vie}from"ag-grid-community";import{_createValidationWarning as Cie,_emitValidationWarning as Eb}from"ag-grid-community";var Zs=e=>t=>t==null?!0:e(t),Db=e=>typeof e=="string",bu=e=>typeof e=="boolean",Sie=e=>typeof e=="object",Ct=(e,t)=>s=>Cie(316,{property:e,value:s,expectedType:t}),Lb=e=>`${e} is not supported in AG Charts Community ('ag-charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`,bie=["doughnut"],yu=["type","chartId","chartType","chartThemeName","chartThemeOverrides","unlinkChart"];function yie(e){return!!Cb(e)||hu(e)}function wie(e){return bie.includes(e)}var xie=e=>Zs(t=>{if(yie(t))return!0;if(wie(t)){const s=hr(t);return e.deprecated(312,{chartType:t,renamedChartType:s}),s}return!1}),Fie=Zs(e=>typeof e=="object"),Tie=Zs(e=>typeof e=="object"),Aie=Zs(e=>typeof e=="string"||typeof e=="function"),kb=e=>({property:"chartType",validationFn:Zs(t=>e||!t||!Ste(t)),warnMessage:t=>Lb(`The '${t}' chart type`)}),_b=e=>({property:"switchCategorySeries",validationFn:Zs(t=>{if(!t||e)return!0}),warnMessage:()=>Lb("'switchCategorySeries' has been ignored as it"),warnIfFixed:!0}),wu=e=>[{property:"chartId",validationFn:Db,warnMessage:Ct("chartId","string")},{property:"chartType",validationFn:xie(e),warnMessage:Ct("chartType","ChartType")},{property:"chartThemeName",validationFn:Db,warnMessage:Ct("chartThemeName","string")},{property:"chartThemeOverrides",validationFn:Fie,warnMessage:Ct("chartThemeOverrides","AgChartThemeOverrides")},{property:"unlinkChart",validationFn:bu,warnMessage:Ct("unlinkChart","boolean")}],Gb=e=>[{property:"cellRange",validationFn:Tie,warnMessage:Ct("cellRange","ChartParamsCellRange")},{property:"suppressChartRanges",validationFn:bu,warnMessage:Ct("suppressChartRanges","boolean")},{property:"aggFunc",validationFn:Aie,warnMessage:Ct("aggFunc","string or IAggFunc")},_b(e)];function Pie(e,t,s){switch(e.type){case"rangeChartUpdate":return Mie(e,t,s);case"pivotChartUpdate":return Iie(e,s);case"crossFilterChartUpdate":return Eie(e,t,s);default:return s.warn(320,{property:"'type'",allowed:["rangeChartUpdate","pivotChartUpdate","crossFilterChartUpdate"],value:e.type}),!1}}function Rie(e,t,s){return To(e,[kb(t),_b(t)],s)}function Mie(e,t,s){const i=[...wu(s),kb(t),...Gb(t),{property:"seriesChartTypes",validationFn:r=>r===void 0||Array.isArray(r)&&r.every(Sie),warnMessage:Ct("seriesChartTypes","Array of SeriesChartType")},{property:"useGroupColumnAsCategory",validationFn:bu,warnMessage:Ct("useGroupColumnAsCategory","boolean")}];return To(e,i,s,[...yu,"cellRange","suppressChartRanges","switchCategorySeries","aggFunc","seriesChartTypes","seriesGroupType","useGroupColumnAsCategory"],"UpdateRangeChartParams")}function Iie(e,t){const s=[...wu(t)];return To(e,s,t,[...yu],"UpdatePivotChartParams")}function Eie(e,t,s){const i=[...wu(s),...Gb(t)];return To(e,i,s,[...yu,"cellRange","suppressChartRanges","aggFunc"],"UpdateCrossFilterChartParams")}function To(e,t,s,i,r){let n;for(const o of t){const{property:a,validationFn:l,warnMessage:c,warnIfFixed:u}=o;if(a in e){const d=e[a],h=l(d);if(h===!0)continue;if(h===!1)return Eb(c(d),s),!1;n=n||{...e},n[a]=h,u&&Eb(c(d),s)}}if(i){for(const o of Object.keys(e))if(!i.includes(o))return s.warn(313,{paramsType:r,property:o}),!1}return n||!0}var Ob=["ag-default","ag-material","ag-sheets","ag-polychroma","ag-vivid"],Die=class extends EF{constructor(e){super(),this.model=e,this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(e){this.rangeSvc=e.rangeSvc,this.agChartsExports=e.agChartsExports}postConstruct(){this.setChartRange(),this.model.unlinked&&this.rangeSvc&&this.rangeSvc.setCellRanges([]);const e=this.updateForGridChange.bind(this,{});this.addManagedEventListeners({cellSelectionChanged:t=>{t.id&&t.id===this.model.chartId&&this.updateForRangeChange()},columnMoved:this.updateForGridChange.bind(this,{updateOrder:!0}),columnPinned:e,columnVisible:e,columnRowGroupChanged:e,modelUpdated:e,cellValueChanged:this.updateForDataChange.bind(this),cellEditValuesChanged:this.updateForDataChange.bind(this)})}update(e){if(!this.validUpdateType(e))return!1;const t=Pie(e,this.agChartsExports.isEnterprise,this.beans.log);if(!t)return!1;const s=t===!0?e:t;return this.applyValidatedChartParams(s),!0}applyValidatedChartParams(e){const{chartId:t,chartType:s,chartThemeName:i,unlinkChart:r}=e,o={...{chartId:t,pivotChart:this.model.pivotChart,chartType:s??this.model.chartType,chartThemeName:i??this.model.chartThemeName,unlinkChart:r??this.model.unlinked,cellRange:this.model.suppliedCellRange,switchCategorySeries:this.model.switchCategorySeries,aggFunc:this.model.aggFunc,seriesChartTypes:void 0,suppressChartRanges:!1,crossFiltering:!1}};switch(e.type){case"rangeChartUpdate":o.cellRange=this.createCellRange(e)??this.model.suppliedCellRange,o.switchCategorySeries=e.switchCategorySeries??this.model.switchCategorySeries,o.aggFunc=e.aggFunc??this.model.aggFunc,o.seriesChartTypes=e.seriesChartTypes,o.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges,o.seriesGroupType=e.seriesGroupType??this.model.seriesGroupType,o.useGroupColumnAsCategory=e.useGroupColumnAsCategory??this.model.useGroupColumnAsCategory;break;case"crossFilterChartUpdate":o.cellRange=this.createCellRange(e)??this.model.suppliedCellRange,o.switchCategorySeries=!1,o.aggFunc=e.aggFunc??this.model.aggFunc,o.crossFiltering=!0,o.crossFilteringSort=this.model.crossFilteringSort,o.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges;break;case"pivotChartUpdate":o.switchCategorySeries=!1;break}this.model.updateModel(o),o.unlinkChart||o.suppressChartRanges?this.rangeSvc?.setCellRanges([]):this.setChartRange()}updateForGridChange(e){if(this.model.unlinked)return;const{maintainColState:t,setColsFromRange:s,updateOrder:i}=e??{};this.model.updateCellRanges({maintainColState:t,setColsFromRange:s,updateOrder:i}),this.model.updateData(),this.setChartRange()}updateForDataChange(){this.model.unlinked||(this.model.updateData(),this.raiseChartModelUpdateEvent())}updateForRangeChange(){this.updateForGridChange({setColsFromRange:!0}),this.raiseChartRangeSelectionChangedEvent()}updateForPanelChange(e){this.model.updateCellRanges(e),this.model.updateData(),e.skipAnimation&&this.getChartProxy().getChartRef().skipAnimations(),this.setChartRange(),this.raiseChartRangeSelectionChangedEvent()}updateThemeOverrides(e){this.chartProxy.updateThemeOverrides(e)}getChartUpdateParams(e){const s=this.getSelectedValueColState().map(a=>({colId:a.colId,displayName:a.displayName})),i=this.getChartData(),r=this.getSelectedDimensions(),n=this.model,o={data:i,groupData:n.groupChartData,grouping:this.isGrouping(),categories:r.map(({colId:a,displayName:l})=>{const c=n.categoryAxisType??n.getChartDataType(a);return{id:a,name:l,chartDataType:c,convertTime:c==="time"?n.getConvertTime(a):void 0}}),fields:s,chartId:this.getChartId(),getCrossFilteringContext:()=>({lastSelectedChartId:"xxx"}),seriesChartTypes:this.getSeriesChartTypes(),updatedOverrides:e,seriesGroupType:n.seriesGroupType};return this.isCategorySeriesSwitched()?this.invertCategorySeriesParams(o):o}invertCategorySeriesParams(e){const[t]=e.categories,s=[{id:mt,name:""}],i=e.data.map((n,o)=>{const a=`${t.id}:${o}`,l=n[t.id],c=l==null?"":String(l);return{colId:a,displayName:c}}),r=e.fields.map(n=>{const o={[mt]:n.displayName};for(const[a,l]of e.data.entries()){const c=`${t.id}:${a}`,u=l[n.colId];o[c]=u}return o});return{...e,categories:s,fields:i,data:r}}getChartModel(){const e=this.model.pivotChart?"pivot":"range",t=this.isComboChart()?this.model.comboChartModel.seriesChartTypes:void 0;return{modelType:e,chartId:this.model.chartId,chartType:this.model.chartType,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy?.getChartThemeOverrides(),chartPalette:this.chartProxy?.getChartPalette(),cellRange:this.getCellRangeParams(),switchCategorySeries:this.model.switchCategorySeries,suppressChartRanges:this.model.suppressChartRanges,aggFunc:this.model.aggFunc,unlinkChart:this.model.unlinked,seriesChartTypes:t,seriesGroupType:this.model.seriesGroupType,useGroupColumnAsCategory:this.model.useGroupColumnAsCategory}}getChartId(){return this.model.chartId}getChartData(){return this.model.chartData}getChartType(){return this.model.chartType}setChartType(e){this.updateMultiSeriesAndCategory(this.model.chartType,e),this.model.chartType=e,this.model.comboChartModel.updateSeriesChartTypes(),this.model.switchCategorySeries=!1,this.model.categoryAxisType=void 0,this.model.seriesGroupType=void 0,this.raiseChartModelUpdateEvent()}isCategorySeriesSwitched(){return this.model.switchCategorySeries&&!this.model.isGrouping()}switchCategorySeries(e){bb(this.getChartType())&&(this.model.switchCategorySeries=e,this.raiseChartModelUpdateEvent())}getAggFunc(){return this.model.aggFunc}setAggFunc(e,t){this.model.aggFunc!==e&&(this.model.aggFunc=e,!t&&(this.model.updateData(),this.raiseChartModelUpdateEvent()))}updateMultiSeriesAndCategory(e,t){const s=(a,l)=>{let c=0;for(const u of a)u.selected&&(c>=l?u.selected=!1:c++);c===0&&(a[0].selected=!0)},i=fu(t),r=wo(t),n=i!=null&&(fu(e)??100)>(i??100),o=r!=null&&(wo(e)??100)>(r??100);n&&s(this.model.dimensionColState,i),o&&s(this.model.valueColState,r),(n||o)&&(this.model.resetCellRanges(n,o),this.setChartRange(!0))}setChartThemeName(e,t){this.model.chartThemeName=e,t||this.raiseChartModelUpdateEvent()}getChartThemeName(){return this.model.chartThemeName}isPivotChart(){return this.model.pivotChart}isPivotMode(){return this.model.isPivotMode()}isGrouping(){return this.model.isGrouping()}isCrossFilterChart(){return this.model.crossFiltering}getThemeNames(){return this.gos.get("chartThemes")||Ob}getThemes(){return this.getThemeNames().map(t=>{const i=vu(t,this.agChartsExports._Theme)?t:this.chartProxy.lookupCustomChartTheme(t);return this.agChartsExports._Theme.getChartTheme(i)})}getPalettes(){return this.getThemes().map(t=>t.palette)}getSelectedValueColState(){return this.model.getValueColState().filter(e=>e.selected)}getSelectedDimensions(){return this.model.getSelectedDimensions()}getColStateForMenu(){return{dimensionCols:this.model.dimensionColState,valueCols:this.model.getValueColState()}}setChartRange(e=!1){this.rangeSvc&&!this.model.suppressChartRanges&&!this.model.unlinked&&this.rangeSvc.setCellRanges(this.getCellRanges()),e||this.raiseChartModelUpdateEvent()}detachChartRange(){this.model.unlinked=!this.model.unlinked,this.model.unlinked?this.rangeSvc&&this.rangeSvc.setCellRanges([]):this.updateForGridChange(),this.dispatchLocalEvent({type:"chartLinkedChanged"})}setChartProxy(e){this.chartProxy=e}getChartProxy(){return this.chartProxy}isActiveXYChart(){return["scatter","bubble"].includes(this.getChartType())}isChartLinked(){return!this.model.unlinked}customComboExists(){const e=this.model.comboChartModel.savedCustomSeriesChartTypes;return e&&e.length>0}getSeriesChartTypes(){return this.model.comboChartModel.seriesChartTypes}isComboChart(e){return this.model.isComboChart(e)}updateSeriesChartType(e,t,s){const i=this.model.comboChartModel.seriesChartTypes.find(r=>r.colId===e);if(i){const r=this.model.chartType!=="customCombo";r&&(this.model.chartType="customCombo");const n=i.chartType;t!=null&&(i.chartType=t),s!=null&&(i.secondaryAxis=s),this.model.comboChartModel.savedCustomSeriesChartTypes=this.model.comboChartModel.seriesChartTypes,this.model.comboChartModel.updateSeriesChartTypes(),this.updateForDataChange(),r&&this.dispatchLocalEvent({type:"chartTypeChanged"}),n!==t&&this.dispatchLocalEvent({type:"chartSeriesChartTypeChanged"}),this.raiseChartOptionsChangedEvent()}}getActiveSeriesChartTypes(){const e=this.getSelectedValueColState().map(t=>t.colId);return this.getSeriesChartTypes().filter(t=>e.includes(t.colId))}getChartSeriesTypes(e){const t=e??this.getChartType();return this.isComboChart(t)?["line","bar","area"]:[ee(t)]}getChartSeriesType(){const e=this.getSeriesChartTypes();if(e.length===0)return"bar";const t=e[0].chartType;return t==="columnLineCombo"?"bar":t==="areaColumnCombo"?"area":ee(t)}getCellRanges(){return[this.model.dimensionCellRange,this.model.valueCellRange].filter(e=>e)}createCellRange(e){return e.cellRange&&this.rangeSvc?.createPartialCellRangeFromRangeParams(e.cellRange,!0)}validUpdateType(e){if(!e.type)return this.warn(136),!1;const t={"Range Chart":()=>!this.isPivotChart()&&!this.isCrossFilterChart(),"Pivot Chart":()=>this.isPivotChart(),"Cross Filter Chart":()=>this.isCrossFilterChart()},s=Object.keys(t).find(r=>t[r]())??"Range Chart",i=e.type===`${s[0].toLowerCase()}${s.slice(1).replace(/ /g,"")}Update`;return i||this.warn(137,{currentChartType:s,type:e.type}),i}getCellRangeParams(){const e=this.getCellRanges(),t=e[0],s=t?.startRow||null,i=t?.endRow||null;return{rowStartIndex:s?.rowIndex??null,rowStartPinned:s?.rowPinned,rowEndIndex:i?.rowIndex??null,rowEndPinned:i?.rowPinned,columns:e.reduce((r,n)=>r.concat(n.columns.map(o=>o.getId())),[])}}setCategoryAxisType(e){this.model.categoryAxisType=e,this.raiseChartModelUpdateEvent()}getSeriesGroupType(){return this.model.seriesGroupType??this.chartProxy.getSeriesGroupType()}setSeriesGroupType(e){this.model.seriesGroupType=e,this.raiseChartModelUpdateEvent()}raiseChartModelUpdateEvent(){this.dispatchLocalEvent({type:"chartModelUpdate"}),this.raiseChartOptionsChangedEvent()}raiseChartUpdatedEvent(){this.dispatchLocalEvent({type:"chartUpdated"})}raiseChartApiUpdateEvent(){this.dispatchLocalEvent({type:"chartApiUpdate"})}raiseChartOptionsChangedEvent(){const{chartId:e,chartType:t}=this.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:e,chartType:t,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy?.getChartThemeOverrides()})}raiseChartRangeSelectionChangedEvent(){this.eventSvc.dispatchEvent({type:"chartRangeSelectionChanged",id:this.model.chartId,chartId:this.model.chartId,cellRange:this.getCellRangeParams()})}destroy(){super.destroy(),this.rangeSvc&&this.rangeSvc.setCellRanges([])}},Lie=class extends Yt{getAxes(e){const t={x:{type:this.getXAxisType(e),position:"bottom"},y:{type:"number",position:"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:s=>Math.round(s.value)+"%"}),t}getSeries(e){const[t]=e.categories,s=e.fields.map(i=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:i.colId,yName:i.displayName,normalizedTo:this.chartType==="normalizedArea"?100:void 0,stacked:["normalizedArea","stackedArea"].includes(this.chartType)}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(s,e):s}isNormalised(){return!this.crossFiltering&&this.chartType==="normalizedArea"}},kie=new Set(["bar","groupedBar","stackedBar","normalizedBar"]),_ie=class extends Yt{getAxes(e){const t={x:{type:this.getXAxisType(e),position:this.isHorizontal()?"left":"bottom"},y:{type:"number",position:this.isHorizontal()?"bottom":"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:s=>Math.round(s.value)+"%"}),t}getSeries(e){const[t]=e.categories,s=e.fields.map(i=>({type:this.standaloneChartType,direction:this.isHorizontal()?"horizontal":"vertical",stacked:this.crossFiltering||yte(this.chartType),normalizedTo:this.isNormalised()?100:void 0,xKey:t.id,xName:t.name,yKey:i.colId,yName:i.displayName}));return this.crossFiltering?this.extractCrossFilterSeries(s):s}extractCrossFilterSeries(e){const t=[];for(let s=0;s<e.length;s++){const r={...e[s],listeners:{seriesNodeClick:this.crossFilterCallback}},n={...r,yKey:`${r.yKey}-filtered-out`,showInLegend:!1};t.push(r),t.push(n)}return t}isNormalised(){const e=["normalizedColumn","normalizedBar"];return!this.crossFiltering&&e.includes(this.chartType)}isHorizontal(){return kie.has(this.chartType)}},Gie=class extends Yt{getAxes(e){const t={x:{type:this.getXAxisType(e),position:"bottom"},y:{type:"number",position:"left"}};return this.isNormalised()&&(t.y.label={...t.y.label,formatter:s=>Math.round(s.value)+"%"}),t}getSeries(e){const[t]=e.categories,s=["normalizedLine","stackedLine"].includes(this.chartType),i=e.fields.map(r=>({type:this.standaloneChartType,xKey:t.id,xName:t.name,yKey:r.colId,yName:r.displayName,normalizedTo:s&&this.isNormalised()?100:void 0,stacked:s}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(i,e):i}isNormalised(){const e=["normalizedLine"];return!this.crossFiltering&&e.includes(this.chartType)}},Oie=class extends Yt{getAxes(e){return{x:{type:"number",position:"bottom"},y:{type:"number",position:"left"}}}getSeries(e){const[t]=e.categories,s=this.isPaired(),i=this.getSeriesDefinitions(e.fields,s),r=t.id===mt?void 0:t,n=i.map(o=>o?.sizeField?{type:"bubble",xKey:o.xField.colId,xName:o.xField.displayName??void 0,yKey:o.yField.colId,yName:o.yField.displayName??void 0,title:`${o.yField.displayName} vs ${o.xField.displayName}`,sizeKey:o.sizeField.colId,sizeName:o.sizeField.displayName??"",labelKey:r?r.id:o.yField.colId,labelName:r?r.name:void 0}:{type:"scatter",xKey:o.xField.colId,xName:o.xField.displayName??void 0,yKey:o.yField.colId,yName:o.yField.displayName??void 0,title:`${o.yField.displayName} vs ${o.xField.displayName}`,labelKey:r?r.id:o.yField.colId,labelName:r?r.name:void 0});return this.crossFiltering?this.extractCrossFilterSeries(n,e):n}extractCrossFilterSeries(e,t){const{data:s}=t,i=l=>`${l}-filtered-out`,r=(l,c)=>{const u=[1/0,-1/0];if(c!=null)for(const d of l){const h=d[c]??d[i(c)];h<u[0]&&(u[0]=h),h>u[1]&&(u[1]=h)}if(u[0]<=u[1])return u},n=l=>{let c;if(l.type==="bubble"){const{sizeKey:u}=l;c=r(s,u)}return{...l,...c!=null?{sizeDomain:c}:{},highlight:{highlightedItem:{fill:"yellow"}},listeners:{...l.listeners,seriesNodeClick:this.crossFilterCallback}}},o=l=>{const{yKey:c,xKey:u}=l;let d={};return l.type==="bubble"&&(d={sizeKey:i(l.sizeKey)}),{...l,...d,yKey:i(c),xKey:i(u),showInLegend:!1,listeners:{...l.listeners,seriesNodeClick:h=>{const p=h.datum[i(u)],g={...h,xKey:u,datum:{...h.datum,[u]:p}};this.crossFilterCallback(g)}}}},a=e.map(n);return[...a,...a.map(o)]}getSeriesDefinitions(e,t){if(e.length<2)return[];const s=this.chartType==="bubble";if(t)return s?e.map((r,n)=>n%3===0?{xField:r,yField:e[n+1],sizeField:e[n+2]}:null).filter(r=>r?.yField&&r.sizeField):e.map((r,n)=>n%2===0?{xField:r,yField:e[n+1]}:null).filter(r=>r?.yField);const i=e[0];return s?e.map((r,n)=>n%2===1?{xField:i,yField:r,sizeField:e[n+1]}:null).filter(r=>r?.sizeField):e.filter((r,n)=>n>0).map(r=>({xField:i,yField:r}))}},Nie=class extends Yt{getAxes(e){const t=e?e.fields:[],s=new Map(t.map(o=>[o.colId,o])),{primaryYKeys:i,secondaryYKeys:r}=this.getYKeys(t,e.seriesChartTypes),n={x:{type:this.getXAxisType(e),position:"bottom"}};return i.length>0&&(n.y={type:"number",position:"left"}),r.length>0&&r.forEach(o=>{if(!(s.get(o)?.colId===o))return;const c={type:"number",position:"right"};n[`y_${o}`]=c}),n}getSeries(e){const{fields:t,seriesChartTypes:s}=e,[i]=e.categories;return t.map(r=>{const n=s.find(o=>o.colId===r.colId);if(n){const o=n.chartType,l=["groupedColumn","groupedBar"].includes(o)?{grouped:!0}:{},c=n.secondaryAxis?`y_${r.colId}`:"y";return{type:ee(o),xKey:i.id,yKey:r.colId,yName:r.displayName,yKeyAxis:c,stacked:["stackedArea","stackedColumn"].includes(o),...l}}})}getYKeys(e,t){const s=[],i=[];for(const r of e){const n=r.colId,o=t.find(a=>a.colId===n);o&&(o.secondaryAxis?i.push(n):s.push(n))}return{primaryYKeys:s,secondaryYKeys:i}}setSeriesChartThemeDefaults(e){const t=this.getSeriesChartThemeDefaults();if(!t)return;const s=new Set;for(const i of this.chartProxyParams.seriesChartTypes)s.add(i.chartType);for(const i of s){const r=ee(i);e[r]=t}}};function Bie(e){const t=e.currentOffset;e.currentOffset-=e.offsetAmount;const s=e.currentOffset;return e.currentOffset-=e.offsetAmount,{outerRadiusOffset:t,innerRadiusOffset:s}}var Vie=class extends Xs{getUpdateOptions(e,t){return{...t,data:this.crossFiltering?this.getCrossFilterData(e):e.data,series:this.getSeries(e)}}getSeries(e){const[t]=e.categories,s=e.fields.length,i={currentOffset:0,offsetAmount:s>1?20:40},r=this.getFields(e).map(n=>{const o={type:this.standaloneChartType,angleKey:n.colId,angleName:n.displayName,sectorLabelKey:n.colId,calloutLabelName:t.name,calloutLabelKey:t.id};if(this.chartType==="donut"||this.chartType==="doughnut"){const{outerRadiusOffset:a,innerRadiusOffset:l}=Bie(i),c=n.displayName?{title:{text:n.displayName,showInLegend:s>1}}:void 0;return{...o,type:"donut",outerRadiusOffset:a,innerRadiusOffset:l,...c}}return o});return this.crossFiltering?this.extractCrossFilterSeries(r):r}getCrossFilterData(e){const t=e.fields[0].colId,s=`${t}-filtered-out`;return e.data.map(i=>{const r=i[t]+i[s];return i[`${t}-total`]=r,i[s]=1,i[t]=i[t]/r,i})}extractCrossFilterSeries(e){const t=e[0],s=t.angleKey,i={...t,radiusMin:0,radiusMax:1,listeners:{seriesNodeClick:this.crossFilterCallback},legendItemKey:t.calloutLabelKey,angleKey:`${s}-total`},r={...i,radiusKey:s,sectorLabelKey:`${s}-total`};return[{...i,radiusKey:`${s}-filtered-out`,showInLegend:!1},r]}getFields(e){return this.chartType==="pie"?e.fields.slice(0,1):e.fields}getSeriesChartThemeDefaults(){return{series:{highlight:Cu(this.crossFiltering)}}}};import{AgPromise as Hie,Component as Uie}from"ag-grid-community";import{RefPlaceholder as zie,_clearElement as Wie}from"ag-stack";import{Component as $ie,_createElement as Kie,_createIconNoSpan as jie}from"ag-grid-community";var Yie=class extends DF{constructor(){super('<div class="ag-chart-menu" data-ref="eMenu"></div>'),this.eMenu=zie,this.buttonListenersDestroyFuncs=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}updateParams(e){const{buttons:t}=e;this.createButtons(t)}createButtons(e){for(const s of this.buttonListenersDestroyFuncs)s?.();this.buttonListenersDestroyFuncs=[];const t=this.eMenu;Wie(t);for(const s of e){const{buttonName:i,iconName:r,callback:n}=s,o=this.createButton(r),a=this.chartTranslation.translate(i+"ToolbarTooltip");a&&o instanceof HTMLElement&&(o.title=a),this.buttonListenersDestroyFuncs.push(...this.addManagedElementListeners(o,{click:l=>n(l.currentTarget)})),t.appendChild(o)}}createButton(e){const t=jie(e,this.beans);t.classList.add("ag-chart-menu-icon");const s=Kie({tag:"button",attrs:{type:"button"},cls:"ag-chart-menu-toolbar-button"});return s.appendChild(t),s}destroy(){this.buttonListenersDestroyFuncs=[],super.destroy()}};import{AgPromise as qie,Component as Xie,_createElement as Nb}from"ag-grid-community";import{_getDocument as Zie,_setDisplayed as Jie}from"ag-stack";import{AgToggleButton as Qie,Component as ere}from"ag-grid-community";import{AgSelect as tre,AgToggleButton as sre}from"ag-grid-community";import{AgSelect as ire,Component as rre}from"ag-grid-community";import{_escapeString as nre,_getActiveDomElement as ore,_removeFromParent as are}from"ag-stack";import{AgSelect as lre,Component as cre,DragSourceType as Bb}from"ag-grid-community";var ure=".ag-pill-select{display:flex;flex-direction:column}.ag-pill-select .ag-column-drop-list{padding:0}:where(.ag-pill-select){.ag-select{padding-top:var(--ag-spacing)}.ag-picker-field-wrapper{background-color:transparent;border:0}.ag-picker-field-display{cursor:pointer;font-weight:500}.ag-picker-field-display,.ag-picker-field-icon{color:var(--ag-chart-menu-label-color)}}",dre=class extends LF{constructor(e){super('<div class="ag-pill-select" role="presentation"></div>'),this.config=e??{};const{selectedValueList:t,valueFormatter:s,valueList:i}=this.config;this.selectedValues=t??[],this.valueList=i??[],this.valueFormatter=s??(r=>nre(r)),this.registerCSS(ure)}postConstruct(){const{ariaLabel:e,onValuesChange:t,dragSourceId:s}=this.config;this.dropZonePanel=this.createManagedBean(new pre({getValues:()=>this.selectedValues,setValues:r=>this.updateValues(r),isDraggable:()=>this.selectedValues.length>1},r=>this.valueFormatter(r),e,s)),this.getGui().appendChild(this.dropZonePanel.getGui()),this.initSelect(),t!=null&&(this.onValuesChange=t)}setValues(e,t){const{added:s,removed:i,updated:r}=this.getChanges(this.valueList,e);let n=!1;return(s.length||i.length||r.length)&&(n=!0),this.valueList=e,this.updateValues(t,n,!0),this}setValueFormatter(e){return this.valueFormatter=e,this}initSelect(){const e=this.createSelectOptions();if(!e.length)return!1;const{selectPlaceholder:t}=this.config;return this.eSelect=this.createBean(new lre({options:e,placeholder:t,onValueChange:s=>this.addValue(s),pickerIcon:"chartsMenuAdd"})),this.getGui().appendChild(this.eSelect.getGui()),!0}createSelectOptions(){const e=[],{maxSelection:t}=this.config;if(t&&this.selectedValues.length>=t)return e;for(const s of this.valueList)this.selectedValues.includes(s)||e.push({value:s,text:this.valueFormatter(s)});return e}addValue(e){this.dropZonePanel.addItem(e)}updateValues(e,t,s){const i=this.selectedValues;this.selectedValues=e;const r=this.getChanges(i,e),n=t||r.added.length||r.removed.length,o=ore(this.beans),a=this.eSelect?.getGui().contains(o),l=this.dropZonePanel?.getGui().contains(o);s||this.onValuesChange?.(r);const c=n?!this.refreshSelect():!1;this.dropZonePanel.refreshGui(),n&&a&&(c?this.dropZonePanel.focusList(!0):this.eSelect?.getFocusableElement().focus()),l&&!e.length&&this.eSelect?.getFocusableElement().focus()}getChanges(e,t){const s=t.filter(n=>!e.includes(n)),i=e.filter(n=>!t.includes(n)),r=t.filter((n,o)=>e[o]!==n);return{added:s,removed:i,updated:r,selected:t}}refreshSelect(){if(!this.eSelect)return this.initSelect();const e=this.createSelectOptions();return e.length?(this.eSelect.clearOptions().addOptions(e).setValue(void 0,!0),!0):(are(this.eSelect.getGui()),this.eSelect=this.destroyBean(this.eSelect),!1)}destroy(){this.destroyBean(this.eSelect),super.destroy()}},hre=class extends zp{constructor(e,t,s,i,r,n){super(t,s,!1),this.value=e,this.valueFormatter=i,this.draggable=r,this.sourceId=n}getItem(){return this.value}getDisplayName(){return this.valueFormatter(this.value)}getAriaDisplayName(){return this.getDisplayName()}getTooltip(){}createGetDragItem(){return()=>({value:this.value})}getDragSourceType(){return Bb.ChartPanel}getDragSourceId(){return this.sourceId}isMovable(){return this.isDraggable()}isDraggable(){return this.draggable}},pre=class extends Hp{constructor(e,t,s,i){super(!1),this.model=e,this.valueFormatter=t,this.ariaLabel=s,this.sourceId=i}postConstruct(){super.init()}isItemDroppable(e,t){return this.isSourceEventFromTarget(t)||this.sourceId!=null&&this.sourceId===t.dragSource.sourceId}updateItems(e){this.model.setValues(e)}getExistingItems(){return this.model.getValues()}getIconName(){return this.isPotentialDndItems()?"move":"notAllowed"}getAriaLabel(){return this.ariaLabel}createPillComponent(e,t,s){return new hre(e,t,s,this.valueFormatter,this.model.isDraggable(),this.sourceId)}getItems(e){return[e.value]}isInterestedIn(e){return e===Bb.ChartPanel}},Vb=class extends kF{constructor(e,t,s,i){super(i),this.chartController=e,this.allowMultipleSelection=t,this.maxSelection=s}wireBeans(e){this.chartTranslation=e.chartTranslation}addItem(e){this.groupComp.addItem(e)}createGroup(e,t,s,i,r){if(this.allowMultipleSelection){const n=e.filter(o=>o.selected);this.valuePillSelect=this.groupComp.createManagedBean(new dre({valueList:e,selectedValueList:n,valueFormatter:t,selectPlaceholder:this.chartTranslation.translate(s),dragSourceId:i,onValuesChange:o=>this.onValueChange(o),maxSelection:this.maxSelection})),this.groupComp.addItem(this.valuePillSelect)}else{const n=this.createValueSelectParams(e);n.onValueChange=o=>{for(const a of e)a.selected=!1;o.selected=!0,o.colId===mt&&this.chartController.setAggFunc(void 0,!0),this.chartController.updateForPanelChange({updatedColState:o,skipAnimation:r?.()})},this.valueSelect=this.groupComp.createManagedBean(new ire(n)),this.groupComp.addItem(this.valueSelect)}}refreshValueSelect(e){if(!this.valueSelect)return;const{options:t,value:s}=this.createValueSelectParams(e);this.valueSelect.clearOptions().addOptions(t).setValue(s,!0)}createValueSelectParams(e){let t;return{options:e.map(i=>{const r=i.displayName??"";return i.selected&&(t=i),{value:i,text:r}}),value:t}}onValueChange({added:e,updated:t,removed:s,selected:i}){let r,n;const o=()=>{i.forEach((a,l)=>{a.order=l}),n=!0};e.length?(r=e[0],r.selected=!0,o()):s.length?(r=s[0],r.selected=!1):t.length&&(o(),r=t[0]),r&&this.chartController.updateForPanelChange({updatedColState:r,resetOrder:n})}destroy(){this.valuePillSelect=void 0,this.valueSelect=void 0,super.destroy()}},gre="sum",fre=class extends Vb{constructor(e,t,s,i,r){super(e,s,void 0,'<div id="categoriesGroup"></div>'),this.title=t,this.dimensionCols=i,this.isOpen=r}postConstruct(){this.groupComp=this.createBean(new it({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.createGroup(this.dimensionCols,e=>e.displayName??"","categoryAdd","categorySelect",()=>!this.chartController.getAggFunc()),this.createAggFuncControls(this.dimensionCols),this.getGui().appendChild(this.groupComp.getGui())}refresh(e){this.valuePillSelect?.setValues(e,e.filter(t=>t.selected)),this.refreshValueSelect(e),this.refreshAggFuncControls(e,this.chartController.getAggFunc())}createAggFuncControls(e){const t=this.chartController.getAggFunc();this.groupComp.addItem(this.aggFuncToggle=this.createBean(new sre({label:this.chartTranslation.translate("aggregate"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:t!=null,onValueChange:s=>{const i=s?gre:void 0;this.chartController.setAggFunc(i),this.aggFuncSelect?.setValue(i,!0),this.aggFuncSelect?.setDisplayed(i!=null)}}))),this.groupComp.addItem(this.aggFuncSelect=this.createBean(new tre({options:[{value:"sum",text:this.chartTranslation.translate("sum")},{value:"first",text:this.chartTranslation.translate("first")},{value:"last",text:this.chartTranslation.translate("last")},{value:"min",text:this.chartTranslation.translate("min")},{value:"max",text:this.chartTranslation.translate("max")},{value:"count",text:this.chartTranslation.translate("count")},{value:"avg",text:this.chartTranslation.translate("avg")}],value:typeof t=="string"?t:void 0,onValueChange:s=>{this.chartController.setAggFunc(s)}}))),this.refreshAggFuncControls(e,t)}refreshAggFuncControls(e,t){const i=e.filter(r=>r.selected).some(r=>r.colId!==mt);this.aggFuncToggle?.setValue(t!=null),this.aggFuncSelect?.setValue(typeof t=="string"?t:void 0,!0),this.aggFuncToggle?.setDisplayed(i),this.aggFuncSelect?.setDisplayed(i&&t!=null)}clearAggFuncControls(){this.aggFuncToggle=this.destroyBean(this.aggFuncToggle),this.aggFuncSelect=this.destroyBean(this.aggFuncSelect)}destroy(){this.clearAggFuncControls(),this.groupComp=this.destroyBean(this.groupComp),super.destroy()}};import{RefPlaceholder as mre}from"ag-stack";import{AgSelect as Hb,AgToggleButton as vre,Component as Cre}from"ag-grid-community";import{BeanStub as Sre,_toFiniteNumber as bre}from"ag-grid-community";var St=class extends _F{constructor(e){super(),this.chartOptionsProxy=e}wireBeans(e){this.chartTranslation=e.chartTranslation}getDefaultColorPickerParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslation.translate(t??"color"),labelWidth:"flex",inputWidth:"flex",labelAlignment:"top",pickerGap:6},s)}getDefaultNumberInputParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslation.translate(t),labelAlignment:"top",labelWidth:"flex",inputWidth:"flex",precision:s?.precision,step:s?.step,min:s?.min,max:s?.max},{parseInputValue:i=>bre(i)??void 0,formatInputValue:i=>i==null?"":`${i}`})}getDefaultSliderParams(e,t,s,i){let r=this.chartOptionsProxy.getValue(e)??0;i&&Array.isArray(r)&&(r=r[0]);const n=this.getDefaultSliderParamsWithoutValueParams(r,t,s);return n.onValueChange=o=>this.chartOptionsProxy.setValue(e,i?[o]:o),n}getDefaultSliderParamsWithoutValueParams(e,t,s){return{label:this.chartTranslation.translate(t),minValue:0,maxValue:Math.max(e,s),textFieldWidth:45,value:`${e}`}}getDefaultCheckboxParams(e,t,s){const i=this.chartOptionsProxy.getValue(e),r={label:this.chartTranslation.translate(t),value:i,readOnly:s?.readOnly,passive:s?.passive};return r.onValueChange=n=>{this.chartOptionsProxy.setValue(e,typeof n=="boolean"?n:void 0)},r}getDefaultToggleParams(e,t,s){const i=this.chartOptionsProxy.getValue(e),r={label:this.chartTranslation.translate(t),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:i,readOnly:s?.readOnly,passive:s?.passive};return r.onValueChange=n=>{this.chartOptionsProxy.setValue(e,typeof n=="boolean"?n:void 0)},r}getDefaultSelectParams(e,t,s){return this.getDefaultSelectParamsWithoutValueParams(t,s,this.chartOptionsProxy.getValue(e),i=>{this.chartOptionsProxy.setValue(e,i)})}getDefaultSelectParamsWithoutValueParams(e,t,s,i){return{label:this.chartTranslation.translate(e),labelAlignment:"top",options:t,pickerGap:6,value:s,onValueChange:i}}getDefaultFontPanelParams(e,t){const s=i=>`${e}.${i}`;return this.addEnableParams(s("enabled"),{name:this.chartTranslation.translate(t),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this,keyMapper:s})}addValueParams(e,t,s){const i=this.chartOptionsProxy.getValue(e);return t.value=s?.formatInputValue?s.formatInputValue(i):i,t.onValueChange=r=>{const n=s?.parseInputValue?s.parseInputValue(r):r;this.chartOptionsProxy.setValue(e,n)},t}addEnableParams(e,t){return t.enabled=this.chartOptionsProxy.getValue(e)??!1,t.onEnableChange=s=>this.chartOptionsProxy.setValue(e,s),t}getChartOptions(){return this.chartOptionsProxy}},yre=class extends GF{constructor(e,t){super(),this.chartMenuContext=e,this.isOpen=t,this.chartSpecificGroup=mre,this.hasContent=!1}wireBeans(e){this.chartTranslation=e.chartTranslation,this.chartSvc=e.chartSvc}postConstruct(){const t={title:this.getTitle(),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen,items:[...this.createDirectionSelect(),this.createReverseSelect(),this.createGroupTypeSelect()]};this.setTemplate(`
<div id="chartSpecificGroup">
<ag-group-component data-ref="chartSpecificGroup"></ag-group-component>
</div>`,[J],{chartSpecificGroup:t}),this.setDisplayed(this.hasContent)}refresh(){this.hasContent=!1,this.chartSpecificGroup.setTitle(this.getTitle()),this.updateDirectionSelect(),this.updateReverseSelect(),this.updateGroupTypeSelect(),this.setDisplayed(this.hasContent)}getTitle(){const e=this.chartMenuContext.chartController.getChartType();return this.chartTranslation.translate(mu(e))}createDirectionSelect(){if(!this.chartSvc.isEnterprise())return[];const{chartOptionsService:e,chartController:t}=this.chartMenuContext,s=e.getSeriesOptionsProxy(()=>ee(t.getChartType())),i=this.createManagedBean(new St(s)),r=["horizontal","vertical"].map(a=>({value:a,text:this.chartTranslation.translate(a)})),n=i.getDefaultSelectParams("direction","direction",r),o=n.onValueChange;return n.onValueChange=a=>{o(a),t.raiseChartModelUpdateEvent()},this.directionSelect=this.createManagedBean(new Hb(n)),this.updateDirectionSelect(),[this.directionSelect]}createReverseSelect(){const{chartMenuParamsFactory:e}=this.chartMenuContext,t=e.getDefaultToggleParams("series.reverse","reverse");return this.reverseToggle=this.createManagedBean(new vre(t)),this.updateReverseSelect(),this.reverseToggle}updateReverseSelect(){const e=this.chartMenuContext.chartController.getChartType()==="pyramid";this.updateDisplayed(this.reverseToggle,e)}updateDirectionSelect(){const e=Tte(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.directionSelect,e)}createGroupTypeSelect(){const{chartController:e,chartMenuParamsFactory:t}=this.chartMenuContext;return this.groupTypeSelect=this.createManagedBean(new Hb(t.getDefaultSelectParamsWithoutValueParams("seriesGroupType",vte.map(s=>({value:s,text:this.chartTranslation.translate(`${s}SeriesGroupType`)})),e.getSeriesGroupType(),s=>e.setSeriesGroupType(s)))),this.updateGroupTypeSelect(),this.groupTypeSelect}updateGroupTypeSelect(){const e=["radialColumn","radialBar","nightingale"].includes(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.groupTypeSelect,e)}updateDisplayed(e,t){e?.setDisplayed(t),e&&(this.hasContent=this.hasContent||t)}};import{_areEqual as wre,_clearElement as xre}from"ag-stack";import{AgCheckbox as Fre,AgSelect as Tre,Component as Are}from"ag-grid-community";var Pre=class extends OF{constructor(e,t,s){super('<div id="seriesChartTypeGroup"></div>'),this.chartController=e,this.columns=t,this.isOpen=s,this.selectedColIds=[],this.chartTypeComps=new Map,this.secondaryAxisComps=new Map}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){this.createSeriesChartTypeGroup(this.columns)}refresh(e){wre(this.getValidColIds(e),this.selectedColIds)?this.refreshComps():this.recreate(e)}recreate(e){this.isOpen=this.seriesChartTypeGroupComp.isExpanded(),xre(this.getGui()),this.destroyBean(this.seriesChartTypeGroupComp),this.columns=e,this.selectedColIds=[],this.clearComps(),this.postConstruct()}getValidColIds(e){const t=this.chartController.getSeriesChartTypes();return e.filter(s=>s.selected&&!!t.filter(i=>i.colId===s.colId)[0]).map(({colId:s})=>s)}createSeriesChartTypeGroup(e){this.seriesChartTypeGroupComp=this.createBean(new it({title:this.chartTranslation.translate("seriesChartType"),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen}));const t=this.chartController.getSeriesChartTypes();for(const s of e){if(!s.selected)continue;const i=t.filter(c=>c.colId===s.colId)[0];if(!i)continue;this.selectedColIds.push(s.colId);const r=this.seriesChartTypeGroupComp.createManagedBean(new it({title:s.displayName,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-format-sub-level"})),n=c=>["groupedColumn","stackedColumn","stackedArea"].includes(c),o=this.seriesChartTypeGroupComp.createManagedBean(new Fre({label:this.chartTranslation.translate("secondaryAxis"),labelWidth:"flex",disabled:n(i.chartType),value:!!i.secondaryAxis,onValueChange:c=>this.chartController.updateSeriesChartType(s.colId,void 0,c)}));r.addItem(o);const a=["line","area","stackedArea","groupedColumn","stackedColumn"].map(c=>({value:c,text:this.chartTranslation.translate(mu(c))})),l=r.createManagedBean(new Tre({options:a,value:i.chartType,onValueChange:c=>this.chartController.updateSeriesChartType(s.colId,c)}));r.addItem(l),this.seriesChartTypeGroupComp.addItem(r),this.chartTypeComps.set(s.colId,l),this.secondaryAxisComps.set(s.colId,o)}this.getGui().appendChild(this.seriesChartTypeGroupComp.getGui())}refreshComps(){const e=this.chartController.getSeriesChartTypes();for(const t of this.selectedColIds){const s=e.find(n=>n.colId===t);if(!s)continue;const i=this.chartTypeComps.get(t),r=this.secondaryAxisComps.get(t);i?.setValue(s.chartType),r?.setValue(!!s.secondaryAxis),r?.setDisabled(this.isSecondaryAxisDisabled(s.chartType))}}clearComps(){this.chartTypeComps.clear(),this.secondaryAxisComps.clear()}isSecondaryAxisDisabled(e){return["groupedColumn","stackedColumn","stackedArea"].includes(e)}destroy(){this.clearComps(),this.seriesChartTypeGroupComp=this.destroyBean(this.seriesChartTypeGroupComp),super.destroy()}};import{AgToggleButton as Rre}from"ag-grid-community";var Mre=class extends Vb{constructor(e,t,s,i,r,n,o){super(e,i,r,'<div id="seriesGroup"></div>'),this.chartOptionsService=t,this.title=s,this.valueCols=n,this.isOpen=o}postConstruct(){if(this.groupComp=this.createBean(new it({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.chartController.isActiveXYChart()){const e=this.groupComp.createManagedBean(new Rre({label:this.chartTranslation.translate("paired"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartOptionsService.getPairedMode(),onValueChange:t=>{this.chartOptionsService.setPairedMode(!!t),this.chartController.updateForGridChange({maintainColState:!0})}}));this.groupComp.addItem(e)}this.createGroup(this.valueCols,this.generateGetSeriesLabel(this.valueCols),"seriesAdd","seriesSelect"),this.getGui().appendChild(this.groupComp.getGui())}refresh(e){this.valuePillSelect?.setValueFormatter(this.generateGetSeriesLabel(e)),this.valuePillSelect?.setValues(e,e.filter(t=>t.selected)),this.refreshValueSelect(e)}generateGetSeriesLabel(e){if(!this.chartController.isActiveXYChart())return n=>n.displayName??"";const t=e.filter(n=>n.selected),s=this.chartController.getChartType()==="bubble",i=this.chartOptionsService.getPairedMode(),r=new Map;return r.set(0,"X"),r.set(1,"Y"),r.set(2,"size"),n=>{const o=n.displayName??"";if(!n.selected)return o;const a=t.indexOf(n);if(a===-1)return o;let l;return i?l=r.get(a%(s?3:2)):a===0?l="X":l=s&&a%2===0?"size":"Y",`${o} (${l})`}}destroy(){this.groupComp=this.destroyBean(this.groupComp),super.destroy()}},Ire={groups:[{type:"categories",isOpen:!0},{type:"series",isOpen:!0},{type:"seriesChartType",isOpen:!0},{type:"chartSpecific",isOpen:!0}]},Ere=class extends NF{constructor(e){super('<div class="ag-chart-data-wrapper ag-scrollable-container"></div>'),this.chartMenuContext=e,this.isSwitchCategorySeriesToggled=!1,this.restoreSwitchCategorySeriesToggleFocus=!1,this.panels=[],this.chartController=e.chartController}wireBeans(e){this.chartTranslation=e.chartTranslation,this.chartSvc=e.chartSvc}postConstruct(){this.createSwitchCategorySeriesToggle(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched(),this.updatePanels();const e=this.updatePanels.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:e,chartApiUpdate:e})}destroy(){this.clearPanelComponents(),super.destroy()}updatePanels(){const e=this.chartType,t=this.isSwitchCategorySeriesToggled,{dimensionCols:s,valueCols:i}=this.chartController.getColStateForMenu();this.chartType=this.chartController.getChartType(),this.isSwitchCategorySeriesToggled=this.chartController.isCategorySeriesSwitched();const r=this.isSwitchCategorySeriesToggled!==t;this.canRefresh(e,this.chartType)&&!r?(this.categoriesDataPanel?.refresh(s),this.seriesDataPanel?.refresh(i),this.seriesChartTypePanel?.refresh(i),this.chartSpecificPanel?.refresh()):this.recreatePanels(s,i);const n=bb(this.chartType)&&this.chartSvc.isEnterprise()&&!this.chartController.isGrouping();Jie(this.switchCategorySeriesToggle.getGui(),n),r&&this.switchCategorySeriesToggle?.setValue(this.chartController.isCategorySeriesSwitched()),this.restoreSwitchCategorySeriesToggleFocus&&(this.restoreSwitchCategorySeriesToggleFocus=!1,n&&this.switchCategorySeriesToggle.getFocusableElement().focus())}canRefresh(e,t){if(e===void 0)return!1;if(e===t)return!0;const s=i=>["columnLineCombo","areaColumnCombo","customCombo"].includes(i);return!!(s(e)&&s(t))}recreatePanels(e,t){this.clearPanelComponents();const{chartType:s}=this;if(!s)return;const i=this.chartController.isCategorySeriesSwitched();this.getDataPanelDef().groups?.forEach(({type:r,isOpen:n})=>{r===(i?"series":"categories")?(this.categoriesDataPanel=this.createBean(new fre(this.chartController,this.getCategoryGroupTitle(i),this.getCategoryGroupMultipleSelect(s,i),e,n)),this.panels.push(this.categoriesDataPanel)):r===(i?"categories":"series")?(this.seriesDataPanel=this.createBean(new Mre(this.chartController,this.chartMenuContext.chartOptionsService,this.getSeriesGroupTitle(i),this.getSeriesGroupMultipleSelect(s,i),this.getSeriesGroupMaxSelection(s,i),t,n)),this.panels.push(this.seriesDataPanel)):r==="seriesChartType"?this.chartController.isComboChart()&&(this.seriesChartTypePanel=this.createBean(new Pre(this.chartController,t,n)),this.panels.push(this.seriesChartTypePanel)):r==="chartSpecific"?(this.chartSpecificPanel=this.createBean(new yre(this.chartMenuContext,n)),this.panels.push(this.chartSpecificPanel)):this.beans.log.warn(144,{type:r})}),(i?this.categoriesDataPanel:this.seriesDataPanel)?.addItem(this.switchCategorySeriesToggle.getGui()),this.addPanelComponents()}addPanelComponents(){if(!this.panels.length)return;const t=Zie(this.beans).createDocumentFragment();for(const s of this.panels)s.addCss("ag-chart-data-section"),t.appendChild(s.getGui());this.getGui().appendChild(t)}clearPanelComponents(){for(const e of this.panels)e.getGui().remove(),this.destroyBean(e);this.panels=[]}getDataPanelDef(){return this.gos.get("chartToolPanelsDef")?.dataPanel??Ire}getCategoryGroupTitle(e){return e?this.chartTranslation.translate("seriesLabels"):this.chartTranslation.translate(this.chartController.isActiveXYChart()?"labels":"categories")}getCategoryGroupMultipleSelect(e,t){return t?!1:fu(e)!==1}getSeriesGroupTitle(e){return e?this.chartTranslation.translate("categoryValues"):this.chartTranslation.translate(this.chartController.isActiveXYChart()?"xyValues":"series")}getSeriesGroupMultipleSelect(e,t){return this.getSeriesGroupMaxSelection(e,t)!==1}getSeriesGroupMaxSelection(e,t){if(!t)return wo(e)}createSwitchCategorySeriesToggle(){this.switchCategorySeriesToggle=this.createManagedBean(new Qie({label:this.chartTranslation.translate("switchCategorySeries"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartController.isCategorySeriesSwitched(),onValueChange:e=>{this.restoreSwitchCategorySeriesToggleFocus=!0,this.chartController.switchCategorySeries(e)}}))}};import{Component as Dre}from"ag-grid-community";import{RefPlaceholder as Ao,_removeFromParent as Ub,_setDisplayed as Lre}from"ag-stack";import{AgCheckbox as kre,AgSelectSelector as _re,Component as Gre}from"ag-grid-community";import{RefPlaceholder as Po,_exists as Ore,_getActiveDomElement as Nre,_setFixedWidth as Bre}from"ag-stack";import{AgAbstractLabel as Vre,AgInputNumberFieldSelector as Hre}from"ag-grid-community";var Ure=class extends BF{constructor(e){super(e,`<div class="ag-angle-select">
<div data-ref="eLabel"></div>
<div class="ag-wrapper ag-angle-select-wrapper">
<div class="ag-angle-select-field">
<div data-ref="eParentCircle" class="ag-angle-select-parent-circle">
<div data-ref="eChildCircle" class="ag-angle-select-child-circle"></div>
</div>
</div>
<ag-input-number-field data-ref="eAngleValue"></ag-input-number-field>
</div>
</div>`,[Hre]),this.eLabel=Po,this.eParentCircle=Po,this.eChildCircle=Po,this.eAngleValue=Po,this.radius=0,this.offsetX=0,this.offsetY=0}wireBeans(e){this.dragSvc=e.dragSvc}postConstruct(){super.postConstruct();const{value:e,onValueChange:t}=this.config;e!=null&&this.setValue(e,void 0,!0),t!=null&&this.onValueChange(t),this.dragListener={eElement:this.eParentCircle,dragStartPixels:0,onDragStart:()=>{this.parentCircleRect=this.eParentCircle.getBoundingClientRect()},onDragging:s=>this.calculateAngleDrag(s),onDragStop:()=>{}},this.dragSvc?.addDragSource(this.dragListener),this.eAngleValue.setLabel("").setLabelWidth(5).setInputWidth(45).setMin(0).setMax(360).setValue(`${this.degrees}`).onValueChange(s=>{(s==null||s==="")&&(s="0"),s=this.eAngleValue.normalizeValue(s);let i=parseFloat(s);i>180&&(i=i-360),this.setValue(i)}),this.updateNumberInput(),Ore(this.getValue())&&this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString()),this.addManagedListeners(this,{fieldValueChanged:()=>{this.eAngleValue.getInputElement().contains(Nre(this.beans))||this.updateNumberInput()}})}updateNumberInput(){const e=this.normalizeNegativeValue(this.getValue());this.eAngleValue.setValue(e.toString())}positionChildCircle(e){const t=this.parentCircleRect||{width:24,height:24},s=this.eChildCircle,i=t.width/2,r=t.height/2;s.style.left=`${i+Math.cos(e)*8}px`,s.style.top=`${r+Math.sin(e)*8}px`}calculatePolar(){const e=this.offsetX,t=this.offsetY,s=Math.atan2(t,e);this.degrees=this.toDegrees(s),this.radius=Math.sqrt(e*e+t*t),this.positionChildCircle(s)}calculateCartesian(){const e=this.toRadians(this.getValue()),t=this.getRadius();this.setOffsetX(Math.cos(e)*t).setOffsetY(Math.sin(e)*t)}setOffsetX(e){return this.offsetX!==e&&(this.offsetX=e,this.calculatePolar()),this}setOffsetY(e){return this.offsetY!==e&&(this.offsetY=e,this.calculatePolar()),this}calculateAngleDrag(e){const t=this.parentCircleRect,s=t.width/2,i=t.height/2,r=e.clientX-t.left,n=e.clientY-t.top,o=r-s,a=n-i,l=Math.atan2(a,o);this.setValue(l,!0)}toDegrees(e){return e/Math.PI*180}toRadians(e){return e/180*Math.PI}normalizeNegativeValue(e){return e<0?360+e:e}normalizeAngle180(e){return e%=Math.PI*2,e<-Math.PI?e+=Math.PI*2:e>=Math.PI&&(e-=Math.PI*2),e}getRadius(){return this.radius}setRadius(e){return this.radius===e?this:(this.radius=e,this.calculateCartesian(),this)}onValueChange(e){return this.addManagedListeners(this,{fieldValueChanged:()=>{e(this.degrees)}}),this}getValue(e){return e?this.toRadians(this.degrees):this.degrees}setValue(e,t,s){let i;return t?i=e:i=this.normalizeAngle180(this.toRadians(e)),e=this.toDegrees(i),this.degrees!==e&&(this.degrees=Math.floor(e),this.calculateCartesian(),this.positionChildCircle(i),s||this.dispatchLocalEvent({type:"fieldValueChanged"})),this}setWidth(e){return Bre(this.getGui(),e),this}setDisabled(e){return super.setDisabled(e),this.eAngleValue.setDisabled(e),this}destroy(){this.dragSvc?.removeDragSource(this.dragListener),super.destroy()}};import{RefPlaceholder as zre,_defaultComparator as Wre,_removeFromParent as $re}from"ag-stack";import{AgSelectSelector as Kre,Component as jre}from"ag-grid-community";var qt=class extends VF{constructor(e){super(),this.params=e,this.fontGroup=zre,this.activeComps=[],this.chartOptions=e.chartMenuParamsFactory.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{cssIdentifier:e="charts-format-sub-level",name:t,enabled:s,onEnableChange:i,suppressEnabledCheckbox:r}=this.params,n={cssIdentifier:e,direction:"vertical",suppressOpenCloseIcons:!0,title:t,enabled:s,suppressEnabledCheckbox:!0,onEnableChange:o=>{i&&i(o)},useToggle:!r};this.setTemplate(`<div class="ag-font-panel">
<ag-group-component data-ref="fontGroup">
<ag-select data-ref="familySelect"></ag-select>
<ag-select data-ref="weightStyleSelect"></ag-select>
<div class="ag-charts-font-size-color">
<ag-select data-ref="sizeSelect"></ag-select>
<ag-color-picker data-ref="colorPicker"></ag-color-picker>
</div>
</ag-group-component>
</div>`,[J,Kre,vt],{fontGroup:n,familySelect:this.getFamilySelectParams(),weightStyleSelect:this.getWeightStyleSelectParams(),sizeSelect:this.getSizeSelectParams(),colorPicker:this.getColorPickerParams()}),this.toggleCss("ag-font-panel-no-header",!t)}addItem(e,t){t?this.fontGroup.prependItem(e):this.fontGroup.addItem(e),this.activeComps.push(e)}setEnabled(e){this.fontGroup.setEnabled(e)}getColorPickerParams(){const{chartMenuParamsFactory:e,keyMapper:t,fontValueWhenUnset:s}=this.params,i=e.getDefaultColorPickerParams(t("color"));if(i.value??(i.value=s?.("color")),i.value==null){const r=this.chartOptions.getValue(t("placement"));if(typeof r=="string"){const n=r.startsWith("inside")?"insideStyle":"outsideStyle";i.value=this.chartOptions.getValue(t(`${n}.color`))}}return i}getFamilySelectParams(){const e=["Arial, sans-serif","Aria Black, sans-serif","Book Antiqua, serif","Charcoal, sans-serif","Comic Sans MS, cursive","Courier, monospace","Courier New, monospace","Gadget, sans-serif","Geneva, sans-serif","Helvetica, sans-serif","Impact, sans-serif","Lucida Console, monospace","Lucida Grande, sans-serif","Lucida Sans Unicode, sans-serif","Monaco, monospace","Palatino Linotype, serif","Palatino, serif","Times New Roman, serif","Times, serif","Verdana, sans-serif"],t=e.map(r=>({value:r,text:r})),s=this.getInitialFontValue("fontFamily");let i=e[0];if(s){const r=Yre(s),o=e.map(a=>a.toLowerCase()).indexOf(r.toLowerCase());o>=0?i=e[o]:(t.push({value:s,text:r}),i=s)}return t.sort(({text:r},{text:n})=>Wre(r,n)),this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("font",t,`${i}`,r=>this.setFont({fontFamily:r}))}getSizeSelectParams(){const e=[8,10,12,14,16,18,20,22,24,26,28,30,32,34,36],t=this.getInitialFontValue("fontSize");t!=null&&!e.includes(t)&&e.push(t);const s=e.sort((i,r)=>i-r).map(i=>({value:`${i}`,text:`${i}`}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("size",s,t==null?void 0:`${t}`,i=>this.setFont({fontSize:parseInt(i,10)}))}getWeightStyleSelectParams(){const e=this.getInitialFontValue("fontWeight")??"normal",t=this.getInitialFontValue("fontStyle")??"normal",s=[{name:"normal",weight:"normal",style:"normal"},{name:"bold",weight:"bold",style:"normal"},{name:"italic",weight:"normal",style:"italic"},{name:"boldItalic",weight:"bold",style:"italic"}];let i=s.find(n=>n.weight===e&&n.style===t);i||(i={name:"predefined",weight:e,style:t},s.unshift(i));const r=s.map(n=>({value:n.name,text:this.chartTranslation.translate(n.name)}));return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams("weight",r,i.name,n=>{const o=s.find(a=>a.name===n);this.setFont({fontWeight:o.weight,fontStyle:o.style})})}destroyActiveComps(){for(const e of this.activeComps)$re(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActiveComps(),super.destroy()}setFont(e){const{keyMapper:t}=this.params;for(const s of Object.keys(e)){const i=e[s];i&&this.chartOptions.setValue(t(s),i)}}getInitialFontValue(e){const{keyMapper:t,fontValueWhenUnset:s}=this.params;return this.chartOptions.getValue(t(e))??s?.(e)}};function Yre(e){const t=e.split(",");if(t.length===1)return e;const s=t[0];if(!s.startsWith('"')&&!s.startsWith("'"))return s;const i=s[0],r=[];for(const n of t)if(r.push(n),n.trim().endsWith(i))return r.join(",").slice(1,-1);return e}import{RefPlaceholder as qre}from"ag-stack";import{Component as Xre}from"ag-grid-community";var Zre=class extends HF{constructor(e){super(),this.chartMenuUtils=e,this.axisTicksSizeSlider=qre}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuUtils:e}=this,t=e.addEnableParams("tick.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("ticks"),suppressEnabledCheckbox:!0,useToggle:!0}),s=e.getDefaultColorPickerParams("tick.stroke"),i=e.getDefaultSliderParams("tick.width","width",10),r=e.getDefaultSliderParams("tick.size","length",30);this.setTemplate(`<div>
<ag-group-component data-ref="axisTicksGroup">
<ag-color-picker data-ref="axisTicksColorPicker"></ag-color-picker>
<ag-slider data-ref="axisTicksWidthSlider"></ag-slider>
<ag-slider data-ref="axisTicksSizeSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{axisTicksGroup:t,axisTicksColorPicker:s,axisTicksWidthSlider:i,axisTicksSizeSlider:r})}setTickSizeSliderDisplayed(e){this.axisTicksSizeSlider.setDisplayed(e)}};import{Component as Jre}from"ag-grid-community";var Qre=class extends UF{constructor(e){super(),this.chartMenuUtils=e,this.chartOptions=e.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("gridLine.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("gridLines"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.getGridLineColorPickerParams("color"),s=this.getGridLineWidthSliderParams("thickness"),i=this.getGridLineDashSliderParams("lineDash");this.setTemplate(`<div>
<ag-group-component data-ref="gridLineGroup">
<ag-color-picker data-ref="gridLineColorPicker"></ag-color-picker>
<ag-slider data-ref="gridLineWidthSlider"></ag-slider>
<ag-slider data-ref="gridLineLineDashSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{gridLineGroup:e,gridLineColorPicker:t,gridLineWidthSlider:s,gridLineLineDashSlider:i})}getGridLineColorPickerParams(e){return this.chartMenuUtils.getDefaultColorPickerParams("gridLine.style",e,{formatInputValue:t=>t?.[0]?.stroke,parseInputValue:t=>{const s=this.chartOptions.getValue("gridLine.style")??[];return s.length===0?[{stroke:t,lineDash:[]}]:[{...s[0],stroke:t}]}})}getGridLineWidthSliderParams(e){return this.chartMenuUtils.getDefaultSliderParams("gridLine.width",e,10)}getGridLineDashSliderParams(e){const s=this.chartOptions.getValue("gridLine.style")?.[0]?.lineDash?.[0],i=this.chartMenuUtils.getDefaultSliderParamsWithoutValueParams(s??0,e,30);return i.onValueChange=r=>{const n=this.chartOptions.getValue("gridLine.style.0.stroke");this.chartOptions.setValue("gridLine.style",[{lineDash:[r],stroke:n}])},i}},ene="%d %B %Y",Ro=class extends zF{constructor(e,t){super(),this.axisType=e,this.options=t,this.axisGroup=Ao,this.axisTypeSelect=Ao,this.axisPositionSelect=Ao,this.axisTimeFormatSelect=Ao,this.activePanels=[],this.updateFuncs=[];const{chartOptionsService:s,seriesType:i,chartController:r}=t;this.chartOptionsService=s,this.chartController=r,this.chartOptionsSeriesProxy=s.getSeriesOptionsProxy(()=>i)}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,registerGroupComponent:s}=this.options,i=this.axisType,r={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate(i),expanded:e,suppressEnabledCheckbox:!0},n=t.getCartesianAxisOptionsProxy(this.axisType),o=this.createManagedBean(new St(n)),a=this.createManagedBean(new St(t.getCartesianAxisThemeOverridesProxy(this.axisType))),l=this.getAxisTypeSelectParams(o,t.getCartesianAxisAppliedThemeOverridesProxy(this.axisType)),c=this.getAxisPositionSelectParams(o),u=this.getAxisTimeFormatSelectParams(o),d=this.getAxisColorInputParams(a),h=this.getAxisLineWidthSliderParams(a);this.setTemplate(`<div>
<ag-group-component data-ref="axisGroup">
<ag-select data-ref="axisTypeSelect"></ag-select>
<ag-select data-ref="axisTimeFormatSelect"></ag-select>
<ag-select data-ref="axisPositionSelect"></ag-select>
<ag-color-picker data-ref="axisColorInput"></ag-color-picker>
<ag-slider data-ref="axisLineWidthSlider"></ag-slider>
</ag-group-component>
</div>`,[J,_re,vt,Te],{axisGroup:r,axisTypeSelect:l??void 0,axisPositionSelect:c??void 0,axisTimeFormatSelect:u??void 0,axisColorInput:d,axisLineWidthSlider:h}),s(this.axisGroup),this.axisTypeSelect.setDisplayed(!!l.options?.length),c||this.removeTemplateComponent(this.axisPositionSelect);const p=()=>{const f=n.getValue("type")==="time";Lre(this.axisTimeFormatSelect.getGui(),f)};u?(p(),this.addManagedEventListeners({chartOptionsChanged:()=>{p()}})):this.removeTemplateComponent(this.axisTimeFormatSelect),this.initGridLines(a),this.initAxisTicks(a),this.initAxisLabels(a);const g=()=>{for(const f of this.updateFuncs)f()};this.addManagedListeners(this.chartController,{chartUpdated:g,chartModelUpdate:()=>setTimeout(()=>{this.isAlive()&&(this.refreshAxisTypeSelect(o),p())})})}getAxisTypeSelectParams(e,t){const s=e.getChartOptions(),i=this.getAxisTypeSelectOptions(),r=e.getDefaultSelectParams("type","axisType",i);return r.onValueChange=n=>{const o=s.getValue("type");if(n===o)return;const a=t.getValue("*"),l=o==="time",c=n==="time",u=l!==c?c?ene:void 0:null;u===void 0&&s.clearValue?.("label","format"),this.chartOptionsService.setCartesianCategoryAxisType(this.axisType,n),u!=null&&s.setValue("label.format",u),t.setValue("*",a)},r}refreshAxisTypeSelect(e){const t=this.getAxisTypeSelectOptions(),s=!!t.length;this.axisTypeSelect.setDisplayed(s),s&&this.axisTypeSelect.clearOptions().addOptions(t).setValue(e.getChartOptions().getValue("type"))}getAxisTypeSelectOptions(){const e=this.chartController,t=e.getChartType(),s=()=>{const i=e.getChartData()[0];return i?e.getSelectedDimensions().every(r=>!isNaN(parseFloat(i[r.colId]))):!1};return["heatmap","histogram","boxPlot","rangeBar","scatter","bubble"].includes(t)||e.isGrouping()||!this.isCategoryAxis()||e.isCategorySeriesSwitched()||!s()?[]:["category","number","time"].map(i=>({value:i,text:this.translate(i)}))}isCategoryAxis(){const e=this.chartOptionsSeriesProxy.getValue("direction")==="horizontal";return e&&this.axisType==="yAxis"||!e&&this.axisType==="xAxis"}getAxisPositionSelectParams(e){const t=((s,i)=>{if(s==="heatmap")return null;if(i==="xAxis")return[{value:"top",text:this.translate("top")},{value:"bottom",text:this.translate("bottom")}];if(i==="yAxis")return[{value:"left",text:this.translate("left")},{value:"right",text:this.translate("right")}]})(this.chartController.getChartType(),this.axisType);return t?e.getDefaultSelectParams("position","position",t):null}getAxisTimeFormatSelectParams(e){if(!this.isCategoryAxis())return null;const t=[{value:"%d/%m/%Y",text:this.translate("timeFormatSlashesDDMMYYYY")},{value:"%m/%d/%Y",text:this.translate("timeFormatSlashesMMDDYYYY")},{value:"%d/%m/%y",text:this.translate("timeFormatSlashesDDMMYY")},{value:"%m/%d/%y",text:this.translate("timeFormatSlashesMMDDYY")},{value:"%d.%e.%y",text:this.translate("timeFormatDotsDDMYY")},{value:"%e.%d.%y",text:this.translate("timeFormatDotsMDDYY")},{value:"%Y-%m-%d",text:this.translate("timeFormatDashesYYYYMMDD")},{value:"%d %B %Y",text:this.translate("timeFormatSpacesDDMMMMYYYY")},{value:"%H:%M:%S",text:this.translate("timeFormatHHMMSS")},{value:"%I:%M:%S %p",text:this.translate("timeFormatHHMMSSAmPm")}];return e.getDefaultSelectParams("label.format","timeFormat",t)}getAxisColorInputParams(e){return e.getDefaultColorPickerParams("line.stroke")}getAxisLineWidthSliderParams(e){const t=e.getChartOptions(),s=()=>t.getValue("line.enabled")?t.getValue("line.width"):null,i=n=>{t.setValues([{expression:"line.enabled",value:n!=null},{expression:"line.width",value:n??0}])},r=e.getDefaultSliderParamsWithoutValueParams(s()??0,"thickness",10);return r.onValueChange=n=>{i(n===0?null:n)},r}initGridLines(e){if(this.chartController.getChartType()==="heatmap")return;const s=this.createBean(new Qre(e));this.axisGroup.addItem(s),this.activePanels.push(s)}initAxisTicks(e){if(!this.hasConfigurableAxisTicks())return;const t=this.createBean(new Zre(e));this.axisGroup.addItem(t),this.activePanels.push(t);const s=()=>t.setTickSizeSliderDisplayed(this.isGroupedCategoryAxis());this.updateFuncs.push(s),s()}hasConfigurableAxisTicks(){switch(this.chartController.getChartType()){case"radarLine":case"radarArea":case"rangeBar":case"boxPlot":case"waterfall":return!1;default:return!0}}initAxisLabels(e){const t={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:i=>`label.${i}`},s=this.createBean(new qt(t));this.axisGroup.addItem(s),this.activePanels.push(s),this.addAdditionalLabelComps(s,e)}addAdditionalLabelComps(e,t){this.addLabelPadding(e,t);const s=this.createRotationWidget("labelRotation",t),i=this.initLabelRotation(s,t);e.addItem(i),e.addItem(s)}initLabelRotation(e,t){const s=t.getChartOptions(),i=()=>s.getValue("label.rotation"),r=()=>s.getValue("label.autoRotate"),n=u=>{u&&(this.prevRotation=i()),s.setValues([{expression:"label.autoRotate",value:u},{expression:"label.rotation",value:u?void 0:this.prevRotation}]),e.setDisplayed(!u)},a=typeof i()=="number"?!1:r(),l=this.createBean(new kre({label:this.translate("autoRotate"),value:a,onValueChange:n}));e.setDisplayed(!a);const c=()=>l.setDisplayed(this.isGroupedCategoryAxis());return this.updateFuncs.push(c),c(),l}createRotationWidget(e,t){const s=t.getChartOptions(),i=()=>s.getValue("label.rotation"),r=l=>s.setValue("label.rotation",l),o=`${this.chartTranslation.translate(e)} \xB0`,a=new Ure({label:o,labelWidth:"flex",value:i()??0,onValueChange:r});return this.updateFuncs.push(()=>{a.setValue(i()??0)}),this.createBean(a)}isGroupedCategoryAxis(){return this.chartOptionsService.getCartesianAxisOptionsProxy(this.axisType).getValue("type")==="grouped-category"?!this.isCategoryAxis():!0}addLabelPadding(e,t){const s=this.createBean(new ye(t.getDefaultSliderParams("label.spacing","padding",30)));e.addItem(s)}translate(e){return this.chartTranslation.translate(e)}removeTemplateComponent(e){Ub(e.getGui()),this.destroyBean(e)}destroyActivePanels(){for(const e of this.activePanels)Ub(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{RefPlaceholder as tne}from"ag-stack";import{AgSelect as sne,Component as ine}from"ag-grid-community";var rne=class extends WF{constructor(e){super(),this.options=e,this.axisGroup=tne}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,registerGroupComponent:s}=this.options,i={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("polarAxis"),expanded:e,suppressEnabledCheckbox:!0},r=this.createManagedBean(new St(t.getPolarAxisThemeOverridesProxy("angle"))),n=r.getDefaultColorPickerParams("line.stroke"),o=r.getDefaultSliderParams("line.width","thickness",10);this.setTemplate(`<div>
<ag-group-component data-ref="axisGroup">
<ag-color-picker data-ref="axisColorInput"></ag-color-picker>
<ag-slider data-ref="axisLineWidthSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{axisGroup:i,axisColorInput:n,axisLineWidthSlider:o}),s(this.axisGroup),this.initAxis(r),this.initAxisLabels(r),this.initRadiusAxis()}createSingleAxisParamsFactory(e){return this.createManagedBean(new St(this.options.chartOptionsService.getPolarAxisThemeOverridesProxy(e,"thisAxis")))}initAxis(e){const t=this.options.chartController.getChartType();if(["radarLine","radarArea"].includes(t)){const i=[{value:"circle",text:this.translate("circle")},{value:"polygon",text:this.translate("polygon")}];this.axisGroup.addItem(this.createSelect({chartAxisThemeOverrides:e,labelKey:"shape",options:i,property:"shape"}))}t!=="pie"&&this.axisGroup.addItem(this.createSlider({chartAxisThemeOverrides:this.createSingleAxisParamsFactory("radius"),labelKey:"innerRadius",defaultMaxValue:1,property:"innerRadiusRatio"}))}initAxisLabels(e){const t={name:this.translate("labels"),enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:r=>`label.${r}`},s=this.createManagedBean(new qt(t)),i=this.createOrientationWidget();s.addItem(i),this.axisGroup.addItem(s)}createOrientationWidget(){const e=[{value:"fixed",text:this.translate("fixed")},{value:"parallel",text:this.translate("parallel")},{value:"perpendicular",text:this.translate("perpendicular")}];return this.createSelect({chartAxisThemeOverrides:this.createSingleAxisParamsFactory("angle"),labelKey:"orientation",options:e,property:"label.orientation",valueWhenUnset:"fixed"})}initRadiusAxis(){const e=ee(this.options.chartController.getChartType());if(!wte(e))return;const t=this.options.chartOptionsService.getPolarCategoryAxisType();if(!t)return;const s=this.createSingleAxisParamsFactory(t),i=[this.createSlider({chartAxisThemeOverrides:s,labelKey:"groupPadding",defaultMaxValue:1,property:"paddingInner"}),this.createSlider({chartAxisThemeOverrides:s,labelKey:"seriesPadding",defaultMaxValue:1,property:"groupPaddingInner"})],r=this.createManagedBean(new it({cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,enabled:!0,suppressEnabledCheckbox:!0,title:this.translate("padding"),items:i})).hideEnabledCheckbox(!0).hideOpenCloseIcons(!0);this.axisGroup.addItem(r)}createSlider(e){const{labelKey:t,defaultMaxValue:s,step:i=.05,property:r,chartAxisThemeOverrides:n}=e,o=n.getDefaultSliderParams(r,t,s);return o.step=i,this.createManagedBean(new ye(o))}createSelect(e){const{labelKey:t,options:s,property:i,chartAxisThemeOverrides:r,valueWhenUnset:n}=e,o=r.getDefaultSelectParams(i,t,s);return o.value??(o.value=n),this.createManagedBean(new sne(o))}translate(e){return this.chartTranslation.translate(e)}};import{RefPlaceholder as nne}from"ag-stack";import{Component as one}from"ag-grid-community";import{Component as ane}from"ag-grid-community";var lne=class extends $F{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("background.visible",{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("background"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuUtils.getDefaultColorPickerParams("background.fill");this.setTemplate(`<div>
<ag-group-component data-ref="chartBackgroundGroup">
<ag-color-picker data-ref="colorPicker"></ag-color-picker>
</ag-group-component>
<div>`,[J,vt],{chartBackgroundGroup:e,colorPicker:t})}};import{RefPlaceholder as cne}from"ag-stack";import{Component as une}from"ag-grid-community";var dne=class extends KF{constructor(e,t){super(),this.chartMenuUtils=e,this.chartController=t,this.paddingTopSlider=cne}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("padding"),suppressEnabledCheckbox:!0},t=s=>this.chartMenuUtils.getDefaultSliderParams("padding."+s,s,200);this.setTemplate(`<div>
<ag-group-component data-ref="chartPaddingGroup">
<ag-slider data-ref="paddingTopSlider"></ag-slider>
<ag-slider data-ref="paddingRightSlider"></ag-slider>
<ag-slider data-ref="paddingBottomSlider"></ag-slider>
<ag-slider data-ref="paddingLeftSlider"></ag-slider>
</ag-group-component>
<div>`,[J,Te],{chartPaddingGroup:e,paddingTopSlider:t("top"),paddingRightSlider:t("right"),paddingBottomSlider:t("bottom"),paddingLeftSlider:t("left")}),this.addManagedEventListeners({chartOptionsChanged:s=>{this.updateTopPadding(s.chartOptions)}})}updateTopPadding(e){const t=[...this.chartController.getChartSeriesTypes(),"common"].map(s=>{const i=e?.[s]?.padding;return typeof i=="number"?i:i?.top}).find(s=>s!=null);t!=null&&this.paddingTopSlider.setValue(`${t}`)}},hne=class extends jF{constructor(e){super(),this.options=e,this.chartGroup=nne}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartController:e,chartMenuParamsFactory:t,isExpandedOnInit:s,registerGroupComponent:i}=this.options,r={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartStyle"),expanded:s,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new dne(t,e)),this.createManagedBean(new lne(t))]};this.setTemplate(`<div>
<ag-group-component data-ref="chartGroup"></ag-group-component>
</div>`,[J],{chartGroup:r}),i(this.chartGroup)}};import{BeanStub as pne}from"ag-grid-community";var gne=class extends YF{constructor(e){super(),this.groupContainer=e,this.id=0,this.groupComponents=new Map}addGroupComponent(e){const t=this.id++;this.groupComponents.set(t,e),e.isExpanded()&&(this.expandedGroupComponent=t),e.onExpandedChange(s=>{if(s){const i=this.expandedGroupComponent;if(this.expandedGroupComponent=t,i!=null){const r=e.getGui(),n=r.offsetTop-this.groupContainer.parentElement.scrollTop;this.groupComponents.get(i)?.toggleGroupExpand(!1,!0);let o=r.offsetTop-n;o<0&&(o=0),o!==this.groupContainer.parentElement.scrollTop&&(this.groupContainer.parentElement.scrollTop=o)}}else this.expandedGroupComponent=void 0})}destroy(){this.groupComponents.clear(),super.destroy()}};import{RefPlaceholder as zb}from"ag-stack";import{AgCheckbox as fne,AgSelect as mne,Component as vne}from"ag-grid-community";var Cne=2,Sne=class extends qF{constructor(e,t){super(),this.options=e,this.legendGroup=zb,this.enabledGroup=zb,this.isGradient=["treemap","sunburst","heatmap"].includes(e.seriesType),this.key=this.isGradient?"gradientLegend":"legend",this.chartController=t.chartController}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuParamsFactory:e,isExpandedOnInit:t,registerGroupComponent:s}=this.options,i=this.createManagedBean(new mne(e.getDefaultSelectParams(`${this.key}.position`,"position",["top","right","bottom","left"].map(o=>({value:o,text:this.chartTranslation.translate(o)})))));this.enabledGroup=this.createManagedBean(new it(e.addEnableParams(`${this.key}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("legendEnabled"),suppressEnabledCheckbox:!0,useToggle:!0,items:[this.createLabelPanel(e),i,...this.getItems(e)]})));const r={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("legend"),suppressEnabledCheckbox:!0,expanded:t,items:[this.enabledGroup]};this.setTemplate(`<div>
<ag-group-component data-ref="legendGroup">
</ag-group-component>
</div>`,[J],{legendGroup:r}),s(this.legendGroup);const n=this.updateLegendEnabledState.bind(this);this.addManagedListeners(this.chartController,{chartModelUpdate:n,chartApiUpdate:n})}updateLegendEnabledState(){const{valueCols:e}=this.chartController.getColStateForMenu();this.enabledGroup.setEnabled(e.filter(t=>t.selected).length>1)}getItems(e){const t=(s,i,r)=>{const n=e.getDefaultSliderParams(`${this.key}.${s}`,i,r);return this.createManagedBean(new ye(n))};return this.isGradient?[this.createManagedBean(new fne(e.addValueParams("gradientLegend.reverseOrder",{label:this.chartTranslation.translate("reverseDirection"),labelWidth:"flex"}))),t("gradient.thickness","thickness",40),t("gradient.preferredLength","preferredLength",300),t("spacing","spacing",200)]:[t("spacing","spacing",200),t("item.marker.size","markerSize",40),this.createMarkerStrokeSlider(e),t("item.marker.padding.right","itemSpacing",20),this.createItemPaddingSlider(e,"layoutHorizontalSpacing",["left","right"]),this.createItemPaddingSlider(e,"layoutVerticalSpacing",["top","bottom"])]}createMarkerStrokeSlider(e){const t=`${this.key}.item.marker.strokeWidth`,s=e.getDefaultSliderParams(t,"markerStroke",10);if(e.getChartOptions().getValue(t)==null){const i=this.getRenderedMarkerStrokeWidths();i.length>0&&(s.value=i.length===1?`${i[0]}`:"")}return this.createManagedBean(new ye(s))}getRenderedMarkerStrokeWidths(){const e=this.chartController.getChartProxy().getChart().ctx.legendManager.getData(),t=new Set;for(let s=0,i=e.length;s<i;++s){const r=e[s].symbol?.marker;r&&t.add(Math.min(r.strokeWidth??1,Cne))}return[...t]}createItemPaddingSlider(e,t,s){const i=o=>`${this.key}.item.padding.${o}`,r=e.getDefaultSliderParams(i(s[0]),t,50),n=e.getChartOptions();return r.onValueChange=o=>n.setValues(s.map(a=>({expression:i(a),value:o}))),this.createManagedBean(new ye(r))}createLabelPanel(e){const t=this.isGradient?"gradientLegend.scale.label":"legend.item.label",s={enabled:!0,suppressEnabledCheckbox:!0,chartMenuParamsFactory:e,keyMapper:i=>`${t}.${i}`,cssIdentifier:"charts-format-sub-level-no-header"};return this.createManagedBean(new qt(s))}};import{RefPlaceholder as bne,_removeFromParent as yne}from"ag-stack";import{AgSelect as xu,Component as wne}from"ag-grid-community";import{RefPlaceholder as xne,_removeFromParent as Fne}from"ag-stack";import{Component as Tne}from"ag-grid-community";var Ane=class extends XF{constructor(e){super(),this.params=e,this.toggleableGroup=xne,this.activeComps=[],this.chartOptions=e.chartMenuParamsFactory.getChartOptions()}postConstruct(){const{tag:e,cssIdentifier:t="charts-format-sub-level",title:s,suppressEnabledCheckbox:i}=this.params,r=this.params.chartMenuParamsFactory.addEnableParams(`${e}.enabled`,{cssIdentifier:t,direction:"vertical",suppressOpenCloseIcons:!0,title:s,suppressEnabledCheckbox:!0,useToggle:!i});this.setTemplate(`<div class="ag-toggleable-group-panel">
<ag-group-component data-ref="toggleableGroup">
</ag-group-component>
</div>`,[J],{toggleableGroup:r}),this.toggleCss("ag-toggleable-group-panel-no-header",!s)}addItem(e,t){t?this.toggleableGroup.prependItem(e):this.toggleableGroup.addItem(e),this.activeComps.push(e)}setEnabled(e){this.toggleableGroup.setEnabled(e)}destroyActiveComps(){for(const e of this.activeComps)Fne(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActiveComps(),super.destroy()}};import{Component as Pne}from"ag-grid-community";var Rne=class extends ZF{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("callout"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="calloutGroup">
<ag-slider data-ref="calloutLengthSlider"></ag-slider>
<ag-slider data-ref="calloutStrokeWidthSlider"></ag-slider>
<ag-slider data-ref="labelOffsetSlider"></ag-slider>
</ag-group-component>
</div>`,[J,Te],{calloutGroup:e,calloutLengthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.length","length",40),calloutStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLine.strokeWidth","strokeWidth",10),labelOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("calloutLabel.offset","offset",30)})}};import{Component as Mne}from"ag-grid-community";var Ine=class extends JF{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("cap"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0},t=this.chartMenuUtils.getDefaultSliderParams("cap.lengthRatio","capLengthRatio",1);t.step=.05,this.setTemplate(`<div>
<ag-group-component data-ref="capsGroup">
<ag-slider data-ref="capLengthRatioSlider"></ag-slider>
</ag-group-component>
</div>`,[J,Te],{capsGroup:e,capLengthRatioSlider:t})}};import{Component as Ene}from"ag-grid-community";var Dne=class extends QF{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("connectorLine"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="lineGroup">
<ag-color-picker data-ref="lineColorPicker"></ag-color-picker>
<ag-slider data-ref="lineStrokeWidthSlider"></ag-slider>
<ag-slider data-ref="lineOpacitySlider"></ag-slider>
<ag-slider data-ref="lineDashSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{lineGroup:e,lineColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("line.stroke"),lineStrokeWidthSlider:this.getSliderParams("strokeWidth",10,"line.strokeWidth"),lineDashSlider:this.getSliderParams("lineDash",30,"line.lineDash",1,!0),lineOpacitySlider:this.getSliderParams("strokeOpacity",1,"line.strokeOpacity",.05)})}getSliderParams(e,t,s,i=1,r=!1){const n=this.chartMenuUtils.getDefaultSliderParams(s,e,t,r);return n.step=i,n}};import{AgSelectSelector as Lne,Component as kne}from"ag-grid-community";function Wb(e){return["square","circle","cross","diamond","plus","triangle","heart"].map(t=>({value:t,text:e.translate(t)}))}var _ne=class extends eT{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.chartMenuUtils.addEnableParams("marker.enabled",{cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("markers"),suppressEnabledCheckbox:!0,useToggle:!0,suppressOpenCloseIcons:!0});this.setTemplate(`<div>
<ag-group-component data-ref="seriesMarkersGroup">
<ag-select data-ref="seriesMarkerShapeSelect"></ag-select>
<ag-slider data-ref="seriesMarkerSizeSlider"></ag-slider>
<ag-slider data-ref="seriesMarkerStrokeWidthSlider"></ag-slider>
</ag-group-component>
</div>`,[J,Lne,Te],{seriesMarkersGroup:e,seriesMarkerShapeSelect:this.chartMenuUtils.getDefaultSelectParams("marker.shape","shape",Wb(this.chartTranslation)),seriesMarkerSizeSlider:this.chartMenuUtils.getDefaultSliderParams("marker.size","size",60),seriesMarkerStrokeWidthSlider:this.chartMenuUtils.getDefaultSliderParams("marker.strokeWidth","strokeWidth",10)})}};import{RefPlaceholder as Gne,_removeFromParent as One}from"ag-stack";import{AgSelectSelector as Nne,Component as Bne}from"ag-grid-community";var Vne=class extends tT{constructor(e){super(),this.chartMenuUtils=e,this.seriesItemsGroup=Gne,this.activePanels=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("seriesItems"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="seriesItemsGroup">
<ag-select data-ref="seriesItemSelect"></ag-select>
</ag-group-component>
</div>`,[J,Nne],{seriesItemsGroup:e,seriesItemSelect:this.getSeriesItemsParams()}),this.initSeriesControls()}getSeriesItemsParams(){const e=[{value:"positive",text:this.chartTranslation.translate("seriesItemPositive")},{value:"negative",text:this.chartTranslation.translate("seriesItemNegative")}],t=s=>{this.destroyActivePanels(),this.initSeriesControls(s)};return this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesItemType",e,"positive",t)}initSeriesControls(e="positive"){this.initSlider("strokeWidth",10,`item.${e}.strokeWidth`),this.initSlider("lineDash",30,`item.${e}.lineDash`,1,!0),this.initSlider("strokeOpacity",1,`item.${e}.strokeOpacity`,.05,!1),this.initSlider("fillOpacity",1,`item.${e}.fillOpacity`,.05,!1),this.initItemLabels(e)}initSlider(e,t,s,i=1,r=!1){const n=this.chartMenuUtils.getDefaultSliderParams(s,e,t,r);n.step=i;const o=this.seriesItemsGroup.createManagedBean(new ye(n));this.seriesItemsGroup.addItem(o),this.activePanels.push(o)}initItemLabels(e){const t=this.chartMenuUtils.getDefaultFontPanelParams(`item.${e}.label`,"seriesItemLabels"),s=this.createBean(new qt(t));this.seriesItemsGroup.addItem(s),this.activePanels.push(s)}destroyActivePanels(){for(const e of this.activePanels)One(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{Component as Hne}from"ag-grid-community";var Une=class extends sT{constructor(e,t="shadow"){super(),this.chartMenuUtils=e,this.propertyKey=t}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e=this.propertyKey,t=this.chartMenuUtils.addEnableParams(`${e}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslation.translate("shadow"),suppressEnabledCheckbox:!0,useToggle:!0}),s=this.chartMenuUtils.getDefaultColorPickerParams(`${e}.color`);this.setTemplate(`<div>
<ag-group-component data-ref="shadowGroup">
<ag-color-picker data-ref="shadowColorPicker"></ag-color-picker>
<ag-slider data-ref="shadowBlurSlider"></ag-slider>
<ag-slider data-ref="shadowXOffsetSlider"></ag-slider>
<ag-slider data-ref="shadowYOffsetSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{shadowGroup:t,shadowColorPicker:s,shadowBlurSlider:this.getSliderParams("blur",0,20),shadowXOffsetSlider:this.getSliderParams("xOffset",-10,10),shadowYOffsetSlider:this.getSliderParams("yOffset",-10,10)})}getSliderParams(e,t,s){const i=`${this.propertyKey}.${e}`,r=this.chartMenuUtils.getDefaultSliderParams(i,e,s);return r.minValue=t,r}};import{Component as zne}from"ag-grid-community";var Wne=class extends iT{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="groupSpacing">
<ag-slider data-ref="groupPaddingSlider"></ag-slider>
<ag-slider data-ref="groupSpacingSlider"></ag-slider>
</ag-group-component>
<ag-group-component data-ref="tileSpacing">
<ag-slider data-ref="tilePaddingSlider"></ag-slider>
<ag-slider data-ref="tileSpacingSlider"></ag-slider>
</ag-group-component>
</div>`,[J,Te],{groupSpacing:{...e,title:this.chartTranslation.translate("group")},tileSpacing:{...e,title:this.chartTranslation.translate("tile")},groupPaddingSlider:this.getSliderParams("padding","group.padding"),groupSpacingSlider:this.getSliderParams("spacing","group.gap"),tilePaddingSlider:this.getSliderParams("padding","tile.padding"),tileSpacingSlider:this.getSliderParams("spacing","tile.gap")})}getSliderParams(e,t){return this.chartMenuUtils.getDefaultSliderParams(t,e,10)}};import{RefPlaceholder as $ne}from"ag-stack";import{AgSelectSelector as Kne,Component as jne}from"ag-grid-community";function Yne(e){return e[0].toUpperCase()+e.substring(1)}var qne=class extends rT{constructor(e){super(),this.chartMenuUtils=e,this.tooltipMode=$ne}postConstruct(){const{chartMenuUtils:e,beans:t}=this,s="tooltip",i=t.chartTranslation,r=e.addEnableParams(`${s}.enabled`,{cssIdentifier:"charts-format-sub-level",direction:"vertical",suppressOpenCloseIcons:!0,title:i.translate("tooltips"),suppressEnabledCheckbox:!0,useToggle:!0}),n="tooltipMode",o=["single","shared","compact"].map(c=>({value:c,text:i.translate(`${n}${Yne(c)}`)})),a=`${s}.mode`,l=e.getDefaultSelectParams(a,n,o);this.setTemplate(`<div>
<ag-group-component data-ref="tooltipGroup">
<ag-select data-ref="tooltipMode"></ag-select>
</ag-group-component>
</div>`,[J,Kne],{tooltipGroup:r,tooltipMode:l}),this.addManagedEventListeners({chartOptionsChanged:()=>{const c=e.getChartOptions().getValue(a);this.tooltipMode.setValue(c,!0)}})}};import{Component as Xne}from"ag-grid-community";var Zne=class extends nT{constructor(e){super(),this.chartMenuUtils=e}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const e={cssIdentifier:"charts-format-sub-level",direction:"vertical",title:this.chartTranslation.translate("whisker"),enabled:!0,suppressOpenCloseIcons:!0,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="whiskersGroup">
<ag-color-picker data-ref="whiskerColorPicker"></ag-color-picker>
<ag-slider data-ref="whiskerThicknessSlider"></ag-slider>
<ag-slider data-ref="whiskerOpacitySlider"></ag-slider>
<ag-slider data-ref="whiskerLineDashSlider"></ag-slider>
<ag-slider data-ref="whiskerLineDashOffsetSlider"></ag-slider>
</ag-group-component>
</div>`,[J,vt,Te],{whiskersGroup:e,whiskerColorPicker:this.chartMenuUtils.getDefaultColorPickerParams("whisker.stroke"),whiskerThicknessSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeWidth","strokeWidth",10),whiskerOpacitySlider:this.chartMenuUtils.getDefaultSliderParams("whisker.strokeOpacity","strokeOpacity",1),whiskerLineDashSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDash","lineDash",30,!0),whiskerLineDashOffsetSlider:this.chartMenuUtils.getDefaultSliderParams("whisker.lineDashOffset","lineDashOffset",30)})}},ae="tooltips",Ce="strokeWidth",fr="lineWidth",xe="lineDash",he="lineOpacity",Fe="fillOpacity",de="labels",Rt="shadow",Mo="stageLabels",mr="markers",Jne=class extends oT{constructor(e){super(),this.options=e,this.seriesGroup=bne,this.activePanels=[],this.widgetFuncs={lineWidth:()=>this.initStrokeWidth(fr),[Ce]:()=>this.initStrokeWidth("strokeWidth"),lineColor:()=>this.initLineColor(),[xe]:()=>this.initLineDash(),[he]:()=>this.initOpacity("strokeOpacity"),[Fe]:()=>this.initOpacity("fillOpacity"),markers:()=>new _ne(this.chartMenuUtils),[de]:()=>this.initLabels(),sectorLabels:()=>this.initSectorLabels(),[Rt]:()=>new Une(this.chartMenuUtils),[ae]:()=>new qne(this.options.chartMenuParamsFactory),bins:()=>this.initBins(),whiskers:()=>new Zne(this.chartMenuUtils),caps:()=>new Ine(this.chartMenuUtils),connectorLine:()=>new Dne(this.chartMenuUtils),seriesItems:()=>new Vne(this.chartMenuUtils),tileSpacing:()=>new Wne(this.chartMenuUtils),shape:()=>this.initShape(),size:()=>this.initSize("size","size"),minSize:()=>this.initSize("minSize","minSize"),maxSize:()=>this.initSize("maxSize","maxSize"),dropoff:()=>this.initDropOff(),stageLabels:()=>this.initStageLabels()},this.seriesWidgetMappings={bar:[ae,Ce,xe,he,Fe,de,Rt],pie:[ae,Ce,he,Fe,de,"sectorLabels",Rt],donut:[ae,Ce,he,Fe,de,"sectorLabels",Rt],line:[ae,fr,xe,he,mr,de],scatter:[ae,"shape","size",Ce,de],bubble:[ae,"shape","minSize","maxSize",Ce,de],area:[ae,fr,xe,he,Fe,mr,de,Rt],histogram:[ae,"bins",Ce,xe,he,Fe,de,Rt],"radial-column":[ae,Ce,xe,he,Fe,de],"radial-bar":[ae,Ce,xe,he,Fe,de],"radar-line":[ae,Ce,xe,he,mr,de],"radar-area":[ae,Ce,xe,he,Fe,mr,de],nightingale:[ae,Ce,xe,he,Fe,de],"box-plot":[ae,Ce,xe,he,Fe,"whiskers","caps"],"range-bar":[ae,Ce,xe,he,Fe,de],"range-area":[ae,fr,xe,he,Fe,mr,de,Rt],treemap:[ae,"tileSpacing"],sunburst:[ae],heatmap:[ae,de,"lineColor",fr,he],waterfall:[ae,"connectorLine","seriesItems"],funnel:[ae,Ce,xe,he,Fe,de,"dropoff",Mo,Rt],"cone-funnel":[ae,Ce,xe,he,Fe,de,Mo],pyramid:[ae,Ce,xe,he,Fe,de,Mo,Rt]},this.seriesType=e.seriesType}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{isExpandedOnInit:e,chartOptionsService:t,chartController:s,registerGroupComponent:i}=this.options,r={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.translate("series"),expanded:e,suppressEnabledCheckbox:!0};this.setTemplate(`<div>
<ag-group-component data-ref="seriesGroup">
</ag-group-component>
</div>`,[J],{seriesGroup:r}),i(this.seriesGroup),this.chartMenuUtils=this.createManagedBean(new St(t.getSeriesOptionsProxy(()=>this.seriesType))),this.addManagedListeners(s,{chartSeriesChartTypeChanged:this.refreshWidgets.bind(this)}),this.refreshWidgets()}refreshWidgets(){const{chartController:e}=this.options;this.destroyActivePanels(),e.getChartProxy().getChart().waitForUpdate().then(()=>{if(this.isAlive()){e.isComboChart()&&(this.updateSeriesType(),this.initSeriesSelect());for(const i of this.seriesWidgetMappings[this.seriesType]??[]){const r=this.widgetFuncs[i]();let n;if(Array.isArray(r)){const o=this.createBean(r[0]);n=o,r[1](o)}else n=this.createBean(r);this.seriesGroup.addItem(n),this.activePanels.push(n)}}}).catch(s=>this.beans.log.error(105,{e:s}))}initSeriesSelect(){const e=this.createBean(new xu(this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams("seriesType",this.getSeriesSelectOptions(),`${this.seriesType}`,t=>{this.seriesType=t,this.refreshWidgets()})));this.seriesGroup.addItem(e),this.activePanels.push(e)}initLineColor(){return new Pb(this.chartMenuUtils.getDefaultColorPickerParams("stroke","strokeColor"))}initStrokeWidth(e,t){return new ye(this.chartMenuUtils.getDefaultSliderParams(t?`${t}.${e}`:"strokeWidth",e,10))}initLineDash(e){return new ye(this.chartMenuUtils.getDefaultSliderParams(e?`${e}.lineDash`:"lineDash","lineDash",30,!0))}initOpacity(e,t){const s=this.chartMenuUtils.getDefaultSliderParams(t?`${t}.${e}`:e,e,1);return s.step=.05,new ye(s)}initDropOff(){return[new Ane({tag:"dropOff",cssIdentifier:"charts-format-sub-level",title:this.translate("dropOff"),suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils}),s=>{for(const i of[this.initStrokeWidth("strokeWidth","dropOff"),this.initLineDash("dropOff"),this.initOpacity("strokeOpacity","dropOff"),this.initOpacity("fillOpacity","dropOff")]){const r=s.createManagedBean(i);s.addItem(r),this.activePanels.push(r)}}]}initLabels(){const e=Sb(this.seriesType),t=e?"calloutLabel":"label",s=e?"calloutLabels":"labels",i=this.chartMenuUtils.getDefaultFontPanelParams(t,s);return[new qt(i),o=>{if(e){const a=o.createManagedBean(new Rne(this.chartMenuUtils));o.addItem(a),this.activePanels.push(a)}if(this.seriesType==="range-bar"){const a=[{value:"inside",text:this.translate("inside")},{value:"outside",text:this.translate("outside")}],l=o.createManagedBean(new xu(this.chartMenuUtils.getDefaultSelectParams("label.placement","labelPlacement",a)));o.addItem(l),this.activePanels.push(l);const c=o.createManagedBean(new ye(this.chartMenuUtils.getDefaultSliderParams("label.padding","padding",200)));o.addItem(c),this.activePanels.push(c)}}]}initSectorLabels(){const e=this.chartMenuUtils.getDefaultFontPanelParams("sectorLabel","sectorLabels");return[new qt(e),i=>{const r=this.chartMenuUtils.getDefaultSliderParams("sectorLabel.positionRatio","positionRatio",1);r.step=.05;const n=i.createManagedBean(new ye(r));i.addItem(n)}]}initStageLabels(){const e=this.chartMenuUtils.getDefaultFontPanelParams("stageLabel",Mo);return e.fontValueWhenUnset=t=>{const s=this.chartMenuUtils.getChartOptions().getValue("direction")==="horizontal";return this.options.chartOptionsService.getCartesianAxisThemeOverridesProxy(s?"xAxis":"yAxis").getValue(`label.${t}`)},new qt(e)}initBins(){const e=this.chartMenuUtils.getDefaultSliderParams("binCount","histogramBinCount",20),t=this.chartMenuUtils.getChartOptions(),s=(t.getValue("bins")??t.getValue("calculatedBins",!0)).length;return e.value=`${s}`,e.maxValue=Math.max(s,20),new ye(e)}initShape(){return new xu(this.chartMenuUtils.getDefaultSelectParams("shape","shape",Wb(this.chartTranslation)))}initSize(e,t){return new ye(this.chartMenuUtils.getDefaultSliderParams(e,t,60))}getSeriesSelectOptions(){const e=this.getActiveSeriesTypes();return["area","bar","line"].filter(t=>e.includes(t)).map(t=>({value:t,text:this.translate(t)}))}updateSeriesType(){const e=this.getActiveSeriesTypes();!e.includes(this.seriesType)&&e.length>0&&(this.seriesType=e[0])}getActiveSeriesTypes(){return this.options.chartController.getActiveSeriesChartTypes().map(e=>ee(e.chartType))}translate(e){return this.chartTranslation.translate(e)}destroyActivePanels(){for(const e of this.activePanels)yne(e.getGui()),this.destroyBean(e)}destroy(){this.destroyActivePanels(),super.destroy()}};import{RefPlaceholder as Qne}from"ag-stack";import{Component as eoe}from"ag-grid-community";import{AgInputTextField as toe,Component as soe}from"ag-grid-community";var vr=class extends aT{constructor(e,t,s){super("<div></div>"),this.chartMenuUtils=e,this.name=t,this.key=s,this.chartOptions=e.getChartOptions()}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){this.initFontPanel()}hasTitle(){const e=this.chartOptions.getValue(this.key);return e?.enabled&&e.text&&e.text.length>0}initFontPanel(){const e=this.hasTitle(),t={name:this.chartTranslation.translate(this.name),enabled:e,suppressEnabledCheckbox:!1,chartMenuParamsFactory:this.chartMenuUtils,keyMapper:s=>`${this.key}.${s}`,onEnableChange:s=>this.onEnableChange(s)};this.fontPanel=this.createManagedBean(new qt(t)),this.fontPanel.addItem(this.createBean(new toe(this.getTextInputParams())),!0),this.fontPanel.addItem(this.createBean(new ye(this.getSpacingSliderParams()))),this.getGui().appendChild(this.fontPanel.getGui())}getTextInputParams(){return this.chartMenuUtils.addValueParams(`${this.key}.text`,{label:this.chartTranslation.translate("title"),labelAlignment:"top"})}getSpacingSliderParams(){return this.chartMenuUtils.getDefaultSliderParams(`${this.key}.spacing`,"spacing",100)}onEnableChange(e){this.chartOptions.setValue(`${this.key}.enabled`,e)}},ioe=class extends vr{wireBeans(e){super.wireBeans(e),this.chartMenuSvc=e.chartMenuSvc}postConstruct(){this.titlePlaceholder=this.chartTranslation.translate("titlePlaceholder"),super.postConstruct(),this.addManagedEventListeners({chartTitleEdit:()=>{this.fontPanel.setEnabled(this.hasTitle())}})}getTextInputParams(){const e=super.getTextInputParams();return this.shouldOverrideTextWithPlaceholder(e.value)&&(e.value=this.titlePlaceholder),e}getSpacingSliderParams(){const e=super.getSpacingSliderParams();return e.value="10",e}onEnableChange(e){if(this.chartMenuSvc.doesChartToolbarExist()){const s=this.chartOptions.getValue("padding.top");this.chartOptions.setValue("padding.top",e?s-20:s+20)}this.chartOptions.setValue(`${this.key}.enabled`,e);const t=this.chartOptions.getValue(`${this.key}.text`);e&&this.shouldOverrideTextWithPlaceholder(t)&&this.chartOptions.setValue(`${this.key}.text`,this.titlePlaceholder)}shouldOverrideTextWithPlaceholder(e){return e==="Title"||e?.trim().length===0}},roe=class extends lT{constructor(e){super(),this.options=e,this.titleGroup=Qne}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){const{chartMenuParamsFactory:e,chartOptionsService:t,seriesType:s,isExpandedOnInit:i=!1,registerGroupComponent:r}=this.options,n=[];if(jt(s)&&s!=="pyramid"){const a=l=>this.createManagedBean(new St(t.getCartesianAxisThemeOverridesProxy(l)));n.push(this.createManagedBean(new vr(a("xAxis"),"horizontalAxisTitle","title"))),n.push(this.createManagedBean(new vr(a("yAxis"),"verticalAxisTitle","title")))}else if(gu(s)){const a=this.createManagedBean(new St(t.getPolarAxisThemeOverridesProxy("radius","thisAxis")));n.push(this.createManagedBean(new vr(a,"polarAxisTitle","title")))}const o={cssIdentifier:"charts-format-top-level",direction:"vertical",title:this.chartTranslation.translate("chartTitles"),expanded:i,suppressEnabledCheckbox:!0,items:[this.createManagedBean(new ioe(e,"chartTitle","title")),this.createManagedBean(new vr(e,"chartSubtitle","subtitle")),...n]};this.setTemplate(`<div>
<ag-group-component data-ref="titleGroup"></ag-group-component>
</div>`,[J],{titleGroup:o}),r(this.titleGroup)}},noe={groups:[{type:"chart"},{type:"titles"},{type:"legend"},{type:"series"},{type:"axis"}]},$b=["axis","horizontalAxis","verticalAxis"],ooe=class extends cT{constructor(e){super('<div class="ag-chart-format-wrapper"></div>'),this.chartMenuContext=e}postConstruct(){this.groupExpansionFeature=this.createManagedBean(new gne(this.getGui())),this.chartPanelFeature=this.createManagedBean(new Ab(this.chartMenuContext.chartController,this.getGui(),"ag-chart-format-section",(e,t)=>this.createPanels(t))),this.chartPanelFeature.refreshPanels()}createPanels(e){let t=!1;this.getFormatPanelDef().groups?.forEach(({type:s,isOpen:i=!1})=>{if(!this.isGroupPanelShownInSeries(s,e))return;i&&(t&&this.beans.log.warn(145,{group:s}),t=!0);const r=o=>this.groupExpansionFeature.addGroupComponent(o),n={...this.chartMenuContext,isExpandedOnInit:i,seriesType:e,registerGroupComponent:r};switch(s){case"chart":this.chartPanelFeature.addComponent(new hne(n));break;case"titles":this.chartPanelFeature.addComponent(new roe(n));break;case"legend":this.chartPanelFeature.addComponent(new Sne(n,this.chartMenuContext));break;case"axis":gu(e)?this.chartPanelFeature.addComponent(new rne(n)):jt(e)&&(this.chartPanelFeature.addComponent(new Ro("xAxis",n)),this.chartPanelFeature.addComponent(new Ro("yAxis",n)));break;case"horizontalAxis":this.chartPanelFeature.addComponent(new Ro("xAxis",n));break;case"verticalAxis":this.chartPanelFeature.addComponent(new Ro("yAxis",n));break;case"series":this.chartPanelFeature.addComponent(new Jne(n));break;default:this.beans.log.warn(147,{group:s})}})}getFormatPanelDef(){const e=this.gos.get("chartToolPanelsDef")?.formatPanel;return e||noe}isGroupPanelShownInSeries(e,t){const s=["chart","titles","legend","series"].includes(e)||jt(t)&&$b.includes(e)||gu(t)&&e==="axis",i=pu(t)&&e==="legend"||pu(t)&&$b.includes(e);return s&&!i}};import{RefPlaceholder as Cr,_areEqual as aoe,_clearElement as Kb,_getAbsoluteWidth as loe,_radioCssClass as jb,_setDisplayed as coe}from"ag-stack";import{Component as uoe,_createElement as doe,_createIconNoSpan as Yb}from"ag-grid-community";import{_setAriaLabel as hoe}from"ag-stack";import{Component as poe,KeyCode as qb,_createElement as goe}from"ag-grid-community";import{Component as foe}from"ag-grid-community";var moe="ag-chart-mini-thumbnail-canvas",fs=class extends uT{constructor(e,t,s){super(),this.agChartsExports=t,this.tooltipName=s,this.size=58,this.padding=5;const{_Scene:i}=t;this.root=new i.Group;const r=e.ownerDocument.createElement("canvas"),n=new i.Scene({canvasElement:r,pixelRatio:e.ownerDocument.defaultView?.devicePixelRatio??1,width:this.size,height:this.size,willReadFrequently:!1});n.canvas.element.classList.add(moe),n.setRoot(this.root),n.setContainer(e),this.scene=n}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){this.scene.canvas.element.title=this.chartTranslation.translate(this.tooltipName);try{this.scene.render()}catch(e){this.beans.log.error(108,{e})}}};import{_last as Xb}from"ag-stack";function Sr(e){const{stacked:t,size:s,padding:i,xScalePadding:r,xScaleDomain:n,yScaleDomain:o,agChartsExports:{_Scene:a}}=e,l=new a.CategoryScale;l.domain=n,l.range=[i,s-i],l.paddingInner=r,l.paddingOuter=r;const c=new a.LinearScale;c.domain=o,c.range=[s-i,i];const u=(d,h,p)=>d.map((g,f)=>{const m=p.convert(g),v=new a.Rect;return v.x=h.convert(f),v.y=m,v.width=h.bandwidth,v.height=p.convert(0)-m,v.strokeWidth=0,v.crisp=!0,v});return t?e.data.map(d=>u(d,l,c)):u(e.data,l,c)}function voe(e,t,s,i){const r=[],n=[];for(const l of t)for(const[c,u]of l)r.push(c),n.push(u);const o=new e.LinearScale;o.domain=[Math.min(...r),Math.max(...r)],o.range=[i,s-i];const a=new e.LinearScale;return a.domain=[Math.min(...n),Math.max(...n)],a.range=[s-i,i],{xScale:o,yScale:a}}function Zb(e,t,s,i){const r=[0,t[0].length-1],n=t.reduce((l,c)=>{for(const u of c)u<l[0]&&(l[0]=u),u>l[1]&&(l[1]=u);return l},[1/0,-1/0]);n[0]--,n[n.length-1]++;const o=new e.LinearScale;o.domain=r,o.range=[i,s-i];const a=new e.LinearScale;return a.domain=n,a.range=[s-i,i],{xScale:o,yScale:a}}function Jb(e,t,s){return e.map(i=>i.map((r,n)=>[n>0?"lineTo":"moveTo",t.convert(n),s.convert(r)]))}function Coe(e,t,s){return e.map(([i,r],n)=>[n>0?"lineTo":"moveTo",t.convert(i),s.convert(r)])}function Soe(e){const t=e[0],s=e[1],i=Xb(e);return(s[1]!==i[1]||s[2]!==i[2])&&e.push([t[0],s[1],s[2]]),e}function Qb(e,t){const s=new e.Path;return t.forEach(([i,r,n])=>s.path[i](r,n)),s}function boe(e,t,s){return e.map((i,r,n)=>{const a=[...s?yoe(n,r,t):ey(i,t)].reverse().map(([u,d,h])=>["lineTo",d,h]),l=i[0],c=Xb(a);return(l[1]!==c[1]||l[2]!==c[2])&&a.push(["lineTo",l[1],l[2]]),[...i,...a]})}function yoe(e,t,s){return t===0?ey(e[t],s):[...e[t-1]]}function ey(e,t){return e.map(([s,i])=>[s,i,t.convert(0)])}function ty(e,t){const s=Qb(e,t);return s.fill=void 0,s.lineCap="round",s.strokeWidth=3,s}function woe({_Scene:e},t,s,i,r){const{xScale:n,yScale:o}=voe(e,s,i,r),u=s.map(h=>Coe(h,n,o)).map(h=>Soe(h)).map(h=>ty(e,h)).reduce((h,p)=>h.concat(p),[]),d=new e.Group;return d.setClipRect(new e.BBox(r,r,i-r*2,i-r*2)),d.append(u),t.append(d),u}function Fu({_Scene:e},t,s,i,r){const{xScale:n,yScale:o}=Zb(e,s,i,r),l=Jb(s,n,o).map(u=>ty(e,u)),c=new e.Group;return c.setClipRect(new e.BBox(r,r,i-r*2,i-r*2)),c.append(l),t.append(c),l}function xoe(e,t,s,i,r,n=!1){const{xScale:o,yScale:a}=Zb(e,s,i,r),l=boe(Jb(s,o,a),a,n),c=new e.Group;c.setClipRect(new e.BBox(r,r,i-r*2,i-r*2));const u=l.map(d=>Qb(e,d));return c.append(u),t.append(c),u}function sy(e){return e.map((t,s,i)=>t.map((r,n)=>i.slice(0,s+1).reduce((o,a)=>o+a[n],0)))}function iy(e){const t=e.map((s,i)=>e.reduce((r,n)=>Math.max(r,n[i]),0));return e.map(s=>s.map((i,r)=>i/t[r]*19))}function ry(e,t,s,i,r,n,o=0){const{_Scene:a}=e,l=new a.LinearScale;l.domain=[0,7],l.range=[-Math.PI,Math.PI].map(g=>g+Math.PI/2);const c=new a.LinearScale;c.domain=[0,10],c.range=[r,n];const u=[],d=i/2,h=s.map(g=>{const f=new a.Path;return f.strokeWidth=1,f.strokeOpacity=.5,f.lineCap="round",f.fill=void 0,f.fillOpacity=.8,g.forEach((m,v)=>{const C=l.convert(v),S=r+n-c.convert(m),w=S*Math.cos(C)+d,b=S*Math.sin(C)+d;if(f.path[v>0?"lineTo":"moveTo"](w,b),o>0){const y=new a.Marker({shape:"circle"});y.x=w,y.y=b,y.size=o,u.push(y)}}),f.path.closePath(),f}),p=new a.Group;return p.append([...h,...u]),t.append(p),{paths:h,markers:u}}function Io(e){let[t,s]=[1/0,-1/0];return{processedData:e.reduce((r,n,o)=>{const a=o>0?r[o-1]:void 0;r[o]??(r[o]=[]);const l=r[o];return n.forEach((c,u)=>{a&&(c+=a[u]),l[u]=c,l[u]<t&&(t=l[u]),l[u]>s&&(s=l[u])}),r},[]),min:t,max:s}}var Foe=[[[13,16],[13,12],[3,12],[3,16]],[[12,11],[12,7],[4,7],[4,11]],[[10.125,6],[10.125,1.5],[5.875,1.5],[5.875,6]]],Tu=class extends fs{constructor(e,t,s,i,r,n="funnelTooltip",o=Foe){super(e,t,n),this.shapes=woe(t,this.root,o,this.size,this.padding),this.updateColors(s,i)}updateColors(e,t){for(const s of this.shapes)s.fill=e[0],s.stroke=t[0],s.strokeWidth=0}},Toe={chartType:"funnel",miniChart:Tu},Aoe=[[[13,16],[10.75,11.5],[5.25,11.5],[3,16]],[[10.75,11.5],[8.875,6],[7.125,6],[5.25,11.5]],[[8.875,6],[8.875,1.5],[7.125,1.5],[7.125,6]]],Poe=class extends Tu{constructor(e,t,s,i,r,n="coneFunnelTooltip"){super(e,t,s,i,r,n,Aoe)}updateColors(e,t){this.shapes.forEach((s,i)=>{s.fill=e[0],s.fillOpacity=1-i*.2,s.stroke=t[0],s.strokeWidth=0})}},Roe={chartType:"coneFunnel",miniChart:Poe},Moe=[[[8,16],[10,12],[6,12]],[[10.5,11],[12.5,7],[3.5,7],[5.5,11]],[[13,6],[15.5,1.5],[.5,1.5],[3,6]]],Ioe=class extends Tu{constructor(e,t,s,i,r,n="pyramidTooltip"){super(e,t,s,i,r,n,Moe)}updateColors(e,t){this.shapes.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i],s.strokeWidth=0})}},Eoe={chartType:"pyramid",miniChart:Ioe},Ie=class extends fs{constructor(e,t,s){super(e,t,s),this.stroke="gray",this.axisOvershoot=3}postConstruct(){const{_Scene:e}=this.agChartsExports,t=this.size,s=this.padding,i=new e.Line;i.x1=s,i.y1=s,i.x2=s,i.y2=t-s+this.axisOvershoot,i.stroke=this.stroke;const r=new e.Line;r.x1=s-this.axisOvershoot+1,r.y1=t-s,r.x2=t-s+1,r.y2=t-s,r.stroke=this.stroke;const n=this.root;n.append(i),n.append(r),super.postConstruct()}},Doe=class extends Ie{constructor(e,t,s,i){super(e,t,"groupedColumnTooltip"),this.columnData=[2,3,4];const{root:r,columnData:n,size:o,padding:a}=this;this.columns=Sr({stacked:!1,root:r,data:n,size:o,padding:a,xScaleDomain:[0,1,2],yScaleDomain:[0,4],xScalePadding:.3,agChartsExports:t}),r.append(this.columns),this.updateColors(s,i)}updateColors(e,t){this.columns.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]})}},Loe={chartType:"groupedColumn",miniChart:Doe};import{_flatten as koe}from"ag-stack";var _oe=[[8,12,16],[6,9,12],[2,3,4]],ny=class extends Ie{constructor(e,t,s,i,r,n=_oe,o=[0,16],a="stackedColumnTooltip"){super(e,t,a);const{root:l,size:c,padding:u}=this;this.stackedColumns=Sr({stacked:!0,root:l,data:n,size:c,padding:u,xScaleDomain:[0,1,2],yScaleDomain:o,xScalePadding:.3,agChartsExports:t}),l.append(koe(this.stackedColumns)),this.updateColors(s,i)}updateColors(e,t){this.stackedColumns.forEach((s,i)=>{for(const r of s)r.fill=e[i],r.stroke=t[i]})}},Goe={chartType:"stackedColumn",miniChart:ny},Ooe=[[10,10,10],[6,7,8],[2,4,6]],Noe=class extends ny{constructor(e,t,s,i,r){super(e,t,s,i,r,Ooe,[0,10],"normalizedColumnTooltip")}},Boe={chartType:"normalizedColumn",miniChart:Noe},Voe=class extends Ie{constructor(e,t,s,i){super(e,t,"groupedBarTooltip");const{_Scene:r}=t,n=this.padding,o=this.size,a=[2,3,4],l=new r.CategoryScale;l.domain=[0,1,2],l.range=[n,o-n],l.paddingInner=.3,l.paddingOuter=.3;const c=new r.LinearScale;c.domain=[0,4],c.range=[o-n,n];const u=c.convert(0),d=l.bandwidth;this.bars=a.map((h,p)=>{const g=new r.Rect;return g.x=n,g.y=l.convert(p),g.width=u-c.convert(h),g.height=d,g.strokeWidth=0,g.crisp=!0,g}),this.updateColors(s,i),this.root.append(this.bars)}updateColors(e,t){this.bars.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]})}},Hoe={chartType:"groupedBar",miniChart:Voe};import{_flatten as Uoe}from"ag-stack";var zoe=[[8,12,16],[6,9,12],[2,3,4]],oy=class extends Ie{constructor(e,t,s,i,r,n=zoe,o=[0,16],a="stackedBarTooltip"){super(e,t,a);const{_Scene:l}=t,c=this.size,u=this.padding,d=new l.CategoryScale;d.domain=[0,1,2],d.range=[u,c-u],d.paddingInner=.3,d.paddingOuter=.3;const h=new l.LinearScale;h.domain=o,h.range=[c-u,u];const p=h.convert(0),g=d.bandwidth;this.bars=n.map(f=>f.map((m,v)=>{const C=new l.Rect;return C.x=u,C.y=d.convert(v),C.width=p-h.convert(m),C.height=g,C.strokeWidth=0,C.crisp=!0,C})),this.updateColors(s,i),this.root.append(Uoe(this.bars))}updateColors(e,t){this.bars.forEach((s,i)=>s.forEach(r=>{r.fill=e[i],r.stroke=t[i]}))}},Woe={chartType:"stackedBar",miniChart:oy},$oe=[[10,10,10],[6,7,8],[2,4,6]],Koe=class extends oy{constructor(e,t,s,i,r){super(e,t,s,i,r,$oe,[0,10],"normalizedBarTooltip")}},joe={chartType:"normalizedBar",miniChart:Koe},ay=class extends fs{constructor(e,t,s,i,r,n=.6,o="donutTooltip"){super(e,t,o);const{size:a,padding:l,agChartsExports:{_Scene:c}}=this,u=(a-l*2)/2,d=u+l,h=c.toRadians,p=[[h(-90),h(30)],[h(30),h(120)],[h(120),h(180)],[h(180),h(210)],[h(210),h(240)],[h(240),h(270)]];this.sectors=p.map(([g,f])=>{const m=new c.Sector;return m.centerX=d,m.centerY=d,m.innerRadius=u*n,m.outerRadius=u,m.startAngle=g,m.endAngle=f,m.stroke=void 0,m.strokeWidth=0,m.inset=.75,m}),this.updateColors(s,i),this.root.append(this.sectors)}updateColors(e,t){this.sectors.forEach((s,i)=>{s.fill=e[i%e.length],s.stroke=t[i%t.length]})}},ly={chartType:"donut",miniChart:ay},Yoe=class extends ay{constructor(e,t,s,i,r){super(e,t,s,i,r,0,"pieTooltip")}},qoe={chartType:"pie",miniChart:Yoe},Au=[[1,3,5],[2,6,4],[5,3,1]],Pu=class extends Ie{constructor(e,t,s,i,r,n=Au,o="lineTooltip"){super(e,t,o);const{size:a,padding:l,root:c}=this;this.lines=Fu(t,c,n,a,l),this.updateColors(s,i)}updateColors(e,t){this.lines.forEach((s,i)=>{s.stroke=e[i]})}},Xoe={chartType:"line",miniChart:Pu},cy=sy(Au),Zoe=class extends Pu{constructor(e,t,s,i,r,n=cy,o="stackedLineTooltip"){super(e,t,s,i,r,n,o)}},Joe={chartType:"stackedLine",miniChart:Zoe},Qoe=iy(cy),eae=class extends Pu{constructor(e,t,s,i,r,n=Qoe,o="normalizedLineTooltip"){super(e,t,s,i,r,n,o)}},tae={chartType:"normalizedLine",miniChart:eae},sae=class extends Ie{constructor(e,t,s,i){super(e,t,"scatterTooltip");const{size:r,padding:n,agChartsExports:{_Scene:o}}=this,a=[[[.3,3],[1.1,.9],[2,.4],[3.4,2.4]],[[0,.3],[1,2],[2.4,1.4],[3,0]]],l=new o.LinearScale;l.domain=[-.5,4],l.range=[n*2,r-n];const c=new o.LinearScale;c.domain=[-.5,3.5],c.range=[r-n,n];const u=[];a.forEach(h=>{h.forEach(([p,g])=>{const f=new o.Arc;f.strokeWidth=0,f.centerX=l.convert(p),f.centerY=c.convert(g),f.radius=2.5,u.push(f)})}),this.points=u,this.updateColors(s,i);const d=new o.Group;d.setClipRect(new o.BBox(n,n,r-n*2,r-n*2)),d.append(this.points),this.root.append(d)}updateColors(e,t){this.points.forEach((s,i)=>{s.stroke=t[i%t.length],s.fill=e[i%e.length]})}},iae={chartType:"scatter",miniChart:sae},rae=class extends Ie{constructor(e,t,s,i){super(e,t,"bubbleTooltip");const{size:r,padding:n,agChartsExports:{_Scene:o}}=this,a=[[[.1,.3,5],[.5,.4,7],[.2,.8,7]],[[.8,.7,5],[.7,.3,9]]],l=new o.LinearScale;l.domain=[0,1],l.range=[n*2,r-n];const c=new o.LinearScale;c.domain=[0,1],c.range=[r-n,n];const u=[];a.forEach(h=>{h.forEach(([p,g,f])=>{const m=new o.Arc;m.strokeWidth=0,m.centerX=l.convert(p),m.centerY=c.convert(g),m.radius=f,m.fillOpacity=.7,u.push(m)})}),this.points=u,this.updateColors(s,i);const d=new o.Group;d.setClipRect(new o.BBox(n,n,r-n*2,r-n*2)),d.append(this.points),this.root.append(d)}updateColors(e,t){this.points.forEach((s,i)=>{s.stroke=t[i%t.length],s.fill=e[i%e.length]})}},nae={chartType:"bubble",miniChart:rae},uy=Au,dy=class extends Ie{constructor(e,t,s,i,r,n=uy,o="groupedAreaTooltip",a=!1){super(e,t,o),this.areas=xoe(t._Scene,this.root,n,this.size,this.padding,a),this.updateColors(s,i)}updateColors(e,t){this.areas.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i],s.strokeWidth=1,s.strokeOpacity=.75,s.fillOpacity=.7})}},oae={chartType:"area",miniChart:dy},hy=sy(uy),py=class extends dy{constructor(e,t,s,i,r,n=hy,o="stackedAreaTooltip"){super(e,t,s,i,r,n,o,!0)}updateColors(e,t){this.areas.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]})}},aae={chartType:"stackedArea",miniChart:py},lae=iy(hy),cae=class extends py{constructor(e,t,s,i,r,n=lae,o="normalizedAreaTooltip"){super(e,t,s,i,r,n,o)}},uae={chartType:"normalizedArea",miniChart:cae},dae=class extends Ie{constructor(e,t,s,i){super(e,t,"histogramTooltip");const{padding:r,size:n,agChartsExports:{_Scene:o}}=this,a=[2,5,11,13,10,6,1],l=new o.LinearScale;l.domain=[0,a.length],l.range=[r,n-r];const c=new o.LinearScale;c.domain=[0,a.reduce((d,h)=>Math.max(d,h),0)],c.range=[n-r,r];const u=c.convert(0);this.bars=a.map((d,h)=>{const p=c.convert(d),g=l.convert(h),f=l.convert(h+1),m=new o.Rect;return m.x=g,m.y=p,m.width=f-g,m.height=u-p,m.strokeWidth=1,m.strokeOpacity=.75,m.crisp=!0,m}),this.updateColors(s,i),this.root.append(this.bars)}updateColors([e],[t]){for(const s of this.bars)s.fill=e,s.stroke=t}},hae={chartType:"histogram",miniChart:dae},Js=class extends fs{constructor(e,t,s){super(e,t,s),this.stroke="gray",this.showRadiusAxisLine=!0,this.showAngleAxisLines=!0}postConstruct(){const{_Scene:e}=this.agChartsExports,t=this.size,s=this.padding,i=s*2,r=(t-i)/2,n=this.showAngleAxisLines?[r,r*.8,r*.6,r*.4]:[],o=new e.Line;o.x1=t/2,o.y1=s,o.x2=t/2,o.y2=t-s-r-n[n.length-1],o.stroke=this.stroke,o.strokeOpacity=.5,o.fill=void 0,o.visible=this.showRadiusAxisLine;const a=s+r;this.gridLines=n.map((c,u)=>{const d=new e.Path;return d.path.arc(a,a,c,0,2*Math.PI),d.strokeWidth=1,d.stroke=this.stroke,d.strokeOpacity=u===0?.5:.2,d.fill=void 0,d});const l=this.root;l.append(o),this.gridLines.length>0&&l.append(this.gridLines),super.postConstruct()}},pae=class extends Js{constructor(e,t,s,i){super(e,t,"radialColumnTooltip"),this.data=[[6,8,10,2,6,5],[4,4,3,6,4,4],[5,4,2,9,8,9]],this.showRadiusAxisLine=!1;const{padding:r,size:n,data:o,agChartsExports:{_Scene:a}}=this,l=(n-r*2)/2,u=l*.4,d=new a.CategoryScale;d.domain=o[0].map((v,C)=>C),d.range=[0,2*Math.PI],d.paddingInner=0,d.paddingOuter=0;const h=d.bandwidth*.7,{processedData:p,max:g}=Io(o),f=new a.LinearScale;f.domain=[0,g],f.range=[u,l];const m=this.size/2;this.series=p.map((v,C)=>{const w=C===0?void 0:p[C-1],b=new a.TranslatableGroup({zIndex:1e6}),y=v.map((T,x)=>{const F=w?.[x],A=f.convert(T),P=f.convert(F??0),D=d.convert(x),N=D+h,V=a.getRadialColumnWidth(D,N,l,.5,.5),L=new a.RadialColumnShape;return L.columnWidth=V,L.innerRadius=P,L.outerRadius=A,L.startAngle=D,L.endAngle=N,L.isBeveled=!0,L.axisInnerRadius=u,L.axisOuterRadius=l,L.stroke=void 0,L.strokeWidth=0,L});return b.append(y),b.translationX=m,b.translationY=m,b}),this.root.append(this.series),this.updateColors(s,i)}updateColors(e,t){this.series.forEach((s,i)=>{for(const r of s.children())r.fill=e[i%e.length],r.stroke=t[i%t.length]})}},gae={chartType:"radialColumn",miniChart:pae},fae=class extends Js{constructor(e,t,s,i){super(e,t,"radialBarTooltip"),this.data=[[6,8,10],[4,4,3],[5,4,2]],this.showRadiusAxisLine=!1;const{size:r,padding:n,data:o,agChartsExports:{_Scene:a}}=this,l=(r-n)/2,u=l*.4,d=new a.CategoryScale;d.domain=o[0].map((S,w)=>w),d.range=[u,l],d.paddingInner=.5,d.paddingOuter=0;const h=d.bandwidth,{processedData:p,max:g}=Io(o),f=new a.LinearScale;f.domain=[0,Math.ceil(g*1.5)];const m=3/2*Math.PI,v=m+2*Math.PI;f.range=[m,v];const C=r/2;this.series=p.map((S,w)=>{const b=w<0?void 0:p[w-1],y=new a.Group({zIndex:1e6}),T=S.map((x,F)=>{const A=b?.[F]??0,P=d.convert(F),D=P-h,N=f.convert(A),V=f.convert(x),L=new a.Sector;return L.centerX=C,L.centerY=C,L.innerRadius=D,L.outerRadius=P,L.startAngle=N,L.endAngle=V,L.stroke=void 0,L.strokeWidth=0,L});return y.append(T),y}),this.root.append(this.series),this.updateColors(s,i)}updateColors(e,t){this.series.forEach((s,i)=>{for(const r of s.children())r.fill=e[i%e.length],r.stroke=t[i%t.length]})}},mae={chartType:"radialBar",miniChart:fae},vae=class extends Js{constructor(e,t,s,i){super(e,t,"radarLineTooltip"),this.markerSize=4,this.data=[[8,7,8,7,8,8,7,8],[6,8,5,10,6,7,4,6],[0,3,3,5,4,4,2,0]],this.showRadiusAxisLine=!1;const{size:r,padding:n,root:o,data:a}=this,l=(r-n*2)/2,c=0,{paths:u,markers:d}=ry(t,o,a,r,l,c,this.markerSize);this.lines=u,this.markers=d,this.updateColors(s,i)}updateColors(e,t){this.lines.forEach((s,i)=>{const r=this.data[i].length;s.stroke=e[i];const n=i*r,o=n+r,a=this.markers.slice(n,o);for(const l of a)l.stroke=t[i],l.fill=e[i]})}},Cae={chartType:"radarLine",miniChart:vae},Sae=class extends Js{constructor(e,t,s,i){super(e,t,"radarAreaTooltip"),this.data=[[8,10,5,7,4,1,5,8],[1,1,2,7,7,8,10,1],[4,5,9,9,4,2,3,4]];const{size:r,padding:n,root:o,data:a}=this;this.showRadiusAxisLine=!1;const l=(r-n*2)/2,c=l-r*.3;this.areas=ry(t,o,a,r,l,c).paths,this.updateColors(s,i)}updateColors(e,t){this.areas.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]})}},bae={chartType:"radarArea",miniChart:Sae},yae=class extends Js{constructor(e,t,s,i){super(e,t,"nightingaleTooltip"),this.data=[[6,10,9,8,7,8],[4,6,5,4,5,5],[3,5,4,3,4,7]],this.showRadiusAxisLine=!1;const{size:r,padding:n,data:o,agChartsExports:{_Scene:a}}=this,l=(r-n*2)/2,c=new a.CategoryScale;c.domain=o[0].map((f,m)=>m),c.range=[-Math.PI,Math.PI],c.paddingInner=0,c.paddingOuter=0;const u=c.bandwidth*.7,{processedData:d,max:h}=Io(o),p=new a.LinearScale;p.domain=[0,h],p.range=[0,l];const g=r/2;this.series=d.map((f,m)=>{const v=m<0?void 0:d[m-1],C=new a.Group({zIndex:1e6}),S=f.map((w,b)=>{const y=v?.[b],T=p.convert(w),x=p.convert(y??0),F=c.convert(b),A=F+u,P=new a.Sector;return P.centerX=g,P.centerY=g,P.innerRadius=x,P.outerRadius=T,P.startAngle=F,P.endAngle=A,P.stroke=void 0,P.strokeWidth=0,P});return C.append(S),C}),this.root.append(this.series),this.updateColors(s,i)}updateColors(e,t){this.series.forEach((s,i)=>{for(const r of s.children())r.fill=e[i%e.length],r.stroke=t[i%t.length]})}},wae={chartType:"nightingale",miniChart:yae},xae=class extends Ie{constructor(e,t,s,i){super(e,t,"rangeBarTooltip");const r=[3,3.5,3];this.bars=this.createRangeBar(this.root,r,this.size,this.padding,"vertical"),this.updateColors(s,i)}updateColors(e,t){this.bars.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]})}createRangeBar(e,t,s,i,r){const n=r==="horizontal",o=2*i,{_Scene:a}=this.agChartsExports,l=new a.CategoryScale;l.domain=t.map((g,f)=>f),l.range=[i,s-i],l.paddingInner=.3,l.paddingOuter=.3;const c=.7,u=1.3,d=new a.LinearScale;d.domain=[t.reduce((g,f)=>Math.min(g,f),1/0)*c,t.reduce((g,f)=>Math.max(g,f),0)*u],d.range=[o,s-o];const h=l.bandwidth,p=t.map((g,f)=>{const[m,v]=[g*c,g*u],C=l.convert(f),S=d.convert(m),w=d.convert(v)-S,b=new a.Rect;return b.x=n?S:C,b.y=n?C:S,b.width=n?w:h,b.height=n?h:w,b.strokeWidth=0,b.crisp=!0,b});return e.append(p),p}},Fae={chartType:"rangeBar",miniChart:xae},Tae=class extends Ie{constructor(e,t,s,i){super(e,t,"rangeAreaTooltip");const r=4,n=[Ru({offset:.375*r,length:r,pattern:{low:3,high:5,period:r}}),Ru({offset:.375*r,length:r,pattern:{low:2.25,high:4.25,period:r}}),Ru({offset:.75*r,length:r,pattern:{low:2.5,high:4.5,period:r}})],o=1.75,a=n.map(u=>u.map(([d,h])=>({x:d,low:h-.5*o,high:h+.5*o}))),{lines:l,areas:c}=this.createRangeArea(this.root,a,this.size,this.padding);this.lines=l,this.areas=c,this.updateColors(s,i)}updateColors(e,t){e=fy(e,1,2),t=fy(t,1,2),this.lines.forEach(([s,i],r)=>{s.fill=void 0,s.stroke=t[r],i.fill=void 0,i.stroke=t[r]}),this.areas.forEach((s,i)=>{s.fill=e[i]})}createRangeArea(e,t,s,i){const r=t.reduce((f,m)=>m.reduce((v,{x:C})=>Math.min(v,C),f),1/0),n=t.reduce((f,m)=>m.reduce((v,{x:C})=>Math.max(v,C),f),-1/0),o=t.reduce((f,m)=>m.reduce((v,{low:C})=>Math.min(v,C),f),1/0),a=t.reduce((f,m)=>m.reduce((v,{high:C})=>Math.max(v,C),f),-1/0),{_Scene:l}=this.agChartsExports,c=new l.LinearScale;c.domain=[r,n],c.range=[i,s-i];const u=2*i,d=new l.LinearScale;d.domain=[o,a],d.range=[s-u,u];const h=[],p=[];return t.map(f=>{const m=new l.Path,v=new l.Path,C=new l.Path;return h.push([m,v]),p.push(C),m.strokeWidth=0,v.strokeWidth=0,C.strokeWidth=0,C.fillOpacity=.8,m.path.clear(),v.path.clear(),C.path.clear(),f.map((S,w)=>{const{x:b,low:y,high:T}=S,x=c.convert(b),F=d.convert(y),A=d.convert(T),P=w>0?"lineTo":"moveTo";return m.path[P](x,A),v.path[P](x,F),C.path[P](x,A),[x,F]})}).forEach((f,m)=>{const v=f.length-1,C=p[m];for(let S=v;S>=0;S--){const[w,b]=f[S];C.path.lineTo(w,b)}}),e.append(p.concat(...h)),{lines:h,areas:p}}};function Ru(e){const{offset:t,length:s,pattern:i}=e,r=a(t,s,i),n=0,o=s;return(r.length===0||r[0][0]!==n)&&r.unshift(l(n,t,i)),r[r.length-1][0]!==o&&r.push(l(o,t,i)),r;function a(u,d,h){const{period:p}=h,g=u/p,m=[0,.5].map(C=>C-g).map(gy).sort((C,S)=>C-S);return Array.from({length:Math.floor(m.length*(p/d))},(C,S)=>m[S%m.length]+Math.floor(S/m.length)).map(C=>C*p).map(C=>l(C,u,h))}function l(u,d,h){return[u,c(d+u,h)]}function c(u,d){const{low:h,high:p,period:g}=d,f=gy(u/g),m=f>.5?1-2*(f-.5):2*f;return h+(p-h)*m}}function gy(e){const t=e%1;return t<0?t+1:t}function fy(e,t,s){const i=[...e],r=i[t];return i[t]=i[s],i[s]=r,i}var Aae={chartType:"rangeArea",miniChart:Tae},Pae=class extends Ie{constructor(e,t,s,i,r){super(e,t,"boxPlotTooltip");const{size:n,padding:o,agChartsExports:{_Scene:a}}=this,l=[11,11.5,10.5],c=1.2,u=1.1,d=.9,h=.8,p=new a.LinearScale;p.domain=[l.reduce((v,C)=>Math.min(v,C),1/0)*h,l.reduce((v,C)=>Math.max(v,C),0)*c],p.range=[n-1.5*o,o];const g=new a.CategoryScale;g.domain=l.map((v,C)=>C),g.range=[o,n-o],g.paddingInner=.4,g.paddingOuter=.2;const f=Math.round(g.bandwidth),m=Math.round(g.bandwidth/2);this.boxPlotGroups=l.map((v,C)=>{const[S,w,b,y]=[v*h,v*d,v*u,v*c],T=Math.round(p.convert(b)),x=Math.round(g.convert(C)),F=Math.round(x+f),A=Math.round(p.convert(w)),P=Math.round(p.convert(S)),D=Math.round(p.convert(v)),N=Math.round(p.convert(y)),V=x+m,L=new a.Group,O=new a.Rect,K=new a.Line,H=new a.Line,Z=new a.Line,Y=new a.Line,pe=new a.Line;return O.x=x,O.y=T,O.width=f,O.height=A-T,O.strokeWidth=1,O.strokeOpacity=.75,O.crisp=!0,this.setLineProperties(K,x,F,D,D),this.setLineProperties(H,V,V,N,T),this.setLineProperties(Z,V,V,P,A),this.setLineProperties(Y,x,F,N,N),this.setLineProperties(pe,x,F,P,P),L.append([O,K,H,Z,Y,pe]),L}),this.updateColors(s,i,r),this.root.append(this.boxPlotGroups)}updateColors(e,t,s){const{_Theme:i}=this.agChartsExports;this.boxPlotGroups.forEach((r,n)=>{for(const o of r.children()){const a=e[n%e.length];o.fill=s?a:i.resolveOperation({$mix:[a,{$ref:"backgroundColor"},.7]}),o.stroke=t[n%t.length]}})}setLineProperties(e,t,s,i,r){e.x1=t,e.x2=s,e.y1=i,e.y2=r,e.strokeOpacity=.75}},Rae={chartType:"boxPlot",miniChart:Pae},Mae=class extends fs{constructor(e,t,s,i,r){super(e,t,"treemapTooltip");const{size:n,padding:o,agChartsExports:{_Scene:a}}=this,l=[[1,1],[3,2,1]],u=l.length%2===0?.3:.2,d=[o,n-o],h=l.length,p=h*(h+1)/2,g=u/(h-1),f=d[1]-d[0],m=f-u;let v=d[0];this.rects=l.reduce((S,w,b)=>{S??(S=[]);const y=(h-b)/p,T=m*y,x=w.length,F=w.reduce((V,L)=>V+L,0),A=u/(x-1||1),P=x>1?f-u:f;let D=d[0];const N=w.map(V=>{const L=new a.Rect,O=P*V/F;return L.x=v,L.y=D,L.width=T,L.height=O,L.strokeWidth=.75,L.crisp=!0,D+=O+A,L});return v+=T+g,S.push(...N),S},[]),this.updateColors(s,i,r);const C=new a.Group;C.setClipRect(new a.BBox(o,o,n-o,n-o)),C.append(this.rects),this.root.append(C)}updateColors(e,t,s){const{_Theme:i}=this.agChartsExports;this.rects.forEach((r,n)=>{r.fill=e[n%t.length],r.stroke=s?t[n%t.length]:i.resolveOperation({$ref:"backgroundColor"})})}},Iae={chartType:"treemap",miniChart:Mae},Eae=class extends Js{constructor(e,t,s,i){super(e,t,"sunburstTooltip"),this.data=[[[],[]],[[],[]],[[],[]]],this.angleOffset=-Math.PI/2,this.innerRadiusRatio=0,this.showRadiusAxisLine=!1,this.showAngleAxisLines=!1;const{data:r,size:n,padding:o,angleOffset:a,innerRadiusRatio:l,agChartsExports:{_Scene:c}}=this,u=(n-o*2)/2,d=[a+0,a+2*Math.PI],h=Math.abs(d[1]-d[0]),p=[u*l,u],g=Math.abs(p[1]-p[0]);let f=0;const m=(b,y)=>{for(const T of b){const x=y+1;f=Math.max(f,x),m(T,x)}};m(r,0);const v=g/f,C=this.size/2,S=d[0];this.series=[];const w=(b,y,T,x,F)=>{if(!Array.isArray(b))return;const P=y+1;let D=T;b.forEach((N,V,L)=>{let O=F;O||(O=new c.Group,this.series.push(O));const K=p[0]+y*v,H=p[0]+P*v,Z=1/L.length,Y=D,pe=Y+x*Z,k=new c.Sector;k.centerX=C,k.centerY=C,k.innerRadius=K,k.outerRadius=H,k.startAngle=Y,k.endAngle=pe,k.stroke=void 0,k.strokeWidth=0,k.inset=.75,D=pe,O.append(k),w(N,P,Y,Math.abs(pe-Y),O)})};w(r,0,S,h),this.root.append(this.series),this.updateColors(s,i)}updateColors(e,t){this.series.forEach((s,i)=>{for(const r of s.children())r.fill=e[i%e.length],r.stroke=t[i%t.length]})}},Dae={chartType:"sunburst",miniChart:Eae},Lae=class extends fs{constructor(e,t,s,i,r){super(e,t,"heatmapTooltip");const{size:n,padding:o,agChartsExports:{_Scene:a}}=this,l=3,c=Array.from({length:l},(m,v)=>Array.from({length:l},(C,S)=>S)),u=c.map((m,v)=>v),d=new a.CategoryScale;d.domain=u,d.range=[o,n-o],d.paddingInner=.01,d.paddingOuter=.1;const h=new a.CategoryScale;h.domain=u,h.range=[o,n-o],h.paddingInner=.01,h.paddingOuter=.1;const p=d.bandwidth??0,g=h.bandwidth??0;this.rects=c.reduce((m,v,C)=>{m??(m=[]);const S=v.map((w,b)=>{const y=new a.Rect;return y.x=d.convert(C),y.y=h.convert(b),y.width=p,y.height=g,y.strokeWidth=0,y.crisp=!0,y});return m.push(...S),m},[]),this.updateColors(s,i,r);const f=new a.Group;f.setClipRect(new a.BBox(o,o,n-o,n-o)),f.append(this.rects),this.root.append(f)}updateColors(e,t,s){const{_Theme:i,_Util:r}=this.agChartsExports,n=s?[e[0],e[1]]:i.resolveOperation({$palette:"divergingColors"}),o=s?t[0]:i.resolveOperation({$ref:"backgroundColor"}),a=r.interpolateColor(n[0],n[1]);this.rects.forEach((l,c)=>{l.fill=a(c*.2),l.stroke=o})}},kae={chartType:"heatmap",miniChart:Lae},_ae=class extends Ie{constructor(e,t,s,i,r){super(e,t,"waterfallTooltip"),this.data=[4,3,-3,6,-3],this.bars=this.createWaterfall(this.root,this.data,this.size,this.padding,"vertical").bars,this.updateColors(s,i,r)}updateColors(e,t,s){const{data:i,agChartsExports:{_Theme:r}}=this,n={fill:s?e[0]:r.resolveOperation({$palette:"altUp.fill"}),stroke:s?t[0]:r.resolveOperation({$palette:"altUp.stroke"})},o={fill:s?e[1]:r.resolveOperation({$palette:"altDown.fill"}),stroke:s?t[1]:r.resolveOperation({$palette:"altDown.stroke"})};this.bars.forEach((a,l)=>{const c=i[l]>=0;a.fill=c?n.fill:o.fill,a.stroke=c?n.stroke:o.stroke})}createWaterfall(e,t,s,i,r){const n=2*i,{processedData:o,min:a,max:l}=Io(t.map(S=>[S])),c=o.reduce((S,w)=>S.concat(w),[]),{_Scene:u}=this.agChartsExports,d=new u.LinearScale;d.domain=[Math.min(a,0),l],d.range=[s-n,n];const h=new u.CategoryScale;h.domain=t.map((S,w)=>w),h.range=[i,s-i],h.paddingInner=.2,h.paddingOuter=.3;const p=h.bandwidth,g=new u.Path;g.stroke="#575757",g.strokeWidth=0;const f=Math.floor(g.strokeWidth)%2/2,m=g.path;m.clear();const v=r==="horizontal",C=c.map((S,w)=>{const b=w>0?c[w-1]:0,T=t[w]>0,x=Math.round(d.convert(S)),F=Math.round(d.convert(b)),A=(T?x:F)-f,P=(T?F:x)+f,D=Math.abs(P-A),N=h.convert(w),V=new u.Rect;V.x=v?A:N,V.y=v?N:A,V.width=v?D:p,V.height=v?p:D,V.strokeWidth=0,V.crisp=!0;const L=x+f,O=F+f;if(w>0){const Z=v?O:V.x,Y=v?V.y:O;m.lineTo(Z,Y)}const K=v?L:V.x,H=v?V.y:L;return m.moveTo(K,H),V});return e.append([g,...C]),{bars:C}}},Gae={chartType:"waterfall",miniChart:_ae},Oae=class extends Ie{constructor(e,t,s,i){super(e,t,"columnLineComboTooltip"),this.columnData=[3,4],this.lineData=[[5,4,6,5,4]];const{root:r,columnData:n,lineData:o,size:a,padding:l}=this;this.columns=Sr({stacked:!1,root:r,data:n,size:a,padding:l,xScaleDomain:[0,1],yScaleDomain:[0,4],xScalePadding:.5,agChartsExports:t}),r.append(this.columns),this.lines=Fu(t,r,o,a,l),this.updateColors(s,i)}updateColors(e,t){this.columns.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]}),this.lines.forEach((s,i)=>{s.stroke=e[i+2]})}},Nae={chartType:"columnLineCombo",miniChart:Oae},Bae=class extends Ie{constructor(e,t,s,i){super(e,t,"areaColumnComboTooltip"),this.columnData=[3,4.5],this.areaData=[[5,4,6,5,4]];const{root:r,columnData:n,areaData:o,size:a,padding:l,agChartsExports:{_Scene:c}}=this;this.columns=Sr({stacked:!1,root:r,data:n,size:a,padding:l,xScaleDomain:[0,1],yScaleDomain:[0,6],xScalePadding:.5,agChartsExports:t});const u=new c.CategoryScale;u.range=[l,a-l],u.domain=[0,1,2,3,4],u.paddingInner=1,u.paddingOuter=0;const d=new c.LinearScale;d.range=[a-l,l],d.domain=[0,6];const h=[],p=d.convert(0),g=u.convert(0);o.forEach((v,C)=>{const S=h[C]||(h[C]=[]);v.forEach((b,y)=>{const T=b,x=y,F=u.convert(x),A=d.convert(T);S[y]={x:F,y:A}});const w=u.convert(v.length-1);h[C].push({x:w,y:p},{x:g,y:p})}),this.areas=h.map(v=>{const C=new c.Path;C.strokeWidth=0,C.fillOpacity=.8;const S=C.path;return v.forEach((w,b)=>S[b>0?"lineTo":"moveTo"](w.x,w.y)),C});const f=new c.Group;f.setClipRect(new c.BBox(l,l,a-l*2,a-l*2));const m=new c.Group;m.setClipRect(new c.BBox(l,l,a-l*2,a-l*2)),f.append(this.areas),m.append(this.columns),r.append(f),r.append(m),this.updateColors(s,i)}updateColors(e,t){this.areas.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]}),this.columns.forEach((s,i)=>{s.fill=e[i+1],s.stroke=t[i+1]})}},Vae={chartType:"areaColumnCombo",miniChart:Bae},Hae=class extends fs{constructor(e,t,s,i){super(e,t,"customComboTooltip"),this.columnData=[3,4],this.lineData=[[5,4,6,5,4]];const{root:r,columnData:n,lineData:o,size:a,padding:l,agChartsExports:{_Scene:c}}=this;this.columns=Sr({stacked:!1,root:r,data:n,size:a,padding:l,xScaleDomain:[0,1],yScaleDomain:[0,4],xScalePadding:.5,agChartsExports:t}),r.append(this.columns),this.lines=Fu(this.agChartsExports,r,o,a,l);const u="grey",d=3,h=new c.Line;h.x1=l,h.y1=l,h.x2=l,h.y2=a-l+d,h.stroke=u;const p=new c.Line;p.x1=l-d+1,p.y1=a-l,p.x2=a-l+1,p.y2=a-l,p.stroke=u;const g=new c.Path;this.buildPenIconPath(g),g.fill="whitesmoke",g.stroke="darkslategrey",g.strokeWidth=1,r.append([p,h,g]),this.updateColors(s,i)}updateColors(e,t){this.columns.forEach((s,i)=>{s.fill=e[i],s.stroke=t[i]}),this.lines.forEach((s,i)=>{s.stroke=e[i+2]})}buildPenIconPath(e){const{path:t}=e;t.moveTo(25.76,43.46),t.lineTo(31.27,48.53),t.moveTo(49.86,22),t.lineTo(49.86,22),t.cubicCurveTo(49.01994659053345,21.317514933510974,47.89593834348529,21.09645997825817,46.86,21.41),t.lineTo(46.86,21.41),t.cubicCurveTo(45.55460035985361,21.77260167850787,44.38777081121966,22.517979360321792,43.51,23.55),t.lineTo(25.51,43.8),t.lineTo(25.43,43.89),t.lineTo(23.01,51.89),t.lineTo(22.83,52.46),t.lineTo(31.02,48.86),t.lineTo(49.02,28.52),t.lineTo(49.02,28.52),t.cubicCurveTo(49.940716461596224,27.521914221246085,50.54302631059587,26.2720342455763,50.75,24.93),t.lineTo(50.75,24.93),t.cubicCurveTo(50.95363374988308,23.866379846512814,50.62080640232334,22.77066734274871,49.86,22),t.closePath(),t.moveTo(41.76,25.5),t.lineTo(47.34,30.5),t.moveTo(40.74,26.65),t.lineTo(46.25,31.71)}},Uae={chartType:"customCombo",miniChart:Hae},my={columnGroup:{column:{range:!0,pivot:!0,enterprise:!1,icon:Loe},stackedColumn:{range:!0,pivot:!0,enterprise:!1,icon:Goe},normalizedColumn:{range:!0,pivot:!0,enterprise:!1,icon:Boe}},barGroup:{bar:{range:!0,pivot:!0,enterprise:!1,icon:Hoe},stackedBar:{range:!0,pivot:!0,enterprise:!1,icon:Woe},normalizedBar:{range:!0,pivot:!0,enterprise:!1,icon:joe}},pieGroup:{pie:{range:!0,pivot:!0,enterprise:!1,icon:qoe},donut:{range:!0,pivot:!0,enterprise:!1,icon:ly},doughnut:{range:!0,pivot:!0,enterprise:!1,icon:ly}},lineGroup:{line:{range:!0,pivot:!0,enterprise:!1,icon:Xoe},stackedLine:{range:!0,pivot:!0,enterprise:!1,icon:Joe},normalizedLine:{range:!0,pivot:!0,enterprise:!1,icon:tae}},scatterGroup:{scatter:{range:!0,pivot:!0,enterprise:!1,icon:iae},bubble:{range:!0,pivot:!0,enterprise:!1,icon:nae}},areaGroup:{area:{range:!0,pivot:!0,enterprise:!1,icon:oae},stackedArea:{range:!0,pivot:!0,enterprise:!1,icon:aae},normalizedArea:{range:!0,pivot:!0,enterprise:!1,icon:uae}},polarGroup:{radarLine:{range:!0,pivot:!1,enterprise:!0,icon:Cae},radarArea:{range:!0,pivot:!1,enterprise:!0,icon:bae},nightingale:{range:!0,pivot:!1,enterprise:!0,icon:wae},radialColumn:{range:!0,pivot:!1,enterprise:!0,icon:gae},radialBar:{range:!0,pivot:!1,enterprise:!0,icon:mae}},statisticalGroup:{boxPlot:{range:!0,pivot:!1,enterprise:!0,icon:Rae},histogram:{range:!0,pivot:!1,enterprise:!1,icon:hae},rangeBar:{range:!0,pivot:!1,enterprise:!0,icon:Fae},rangeArea:{range:!0,pivot:!1,enterprise:!0,icon:Aae}},hierarchicalGroup:{treemap:{range:!0,pivot:!0,enterprise:!0,icon:Iae},sunburst:{range:!0,pivot:!0,enterprise:!0,icon:Dae}},specializedGroup:{heatmap:{range:!0,pivot:!1,enterprise:!0,icon:kae},waterfall:{range:!0,pivot:!1,enterprise:!0,icon:Gae}},combinationGroup:{columnLineCombo:{range:!0,pivot:!0,enterprise:!1,icon:Nae},areaColumnCombo:{range:!0,pivot:!0,enterprise:!1,icon:Vae},customCombo:{range:!0,pivot:!0,enterprise:!1,icon:Uae}},funnelGroup:{funnel:{range:!0,pivot:!1,enterprise:!0,icon:Toe},coneFunnel:{range:!0,pivot:!1,enterprise:!0,icon:Roe},pyramid:{range:!0,pivot:!1,enterprise:!0,icon:Eoe}}},zae={columnGroup:["column","stackedColumn","normalizedColumn"],barGroup:["bar","stackedBar","normalizedBar"],pieGroup:["pie","donut"],lineGroup:["line","stackedLine","normalizedLine"],areaGroup:["area","stackedArea","normalizedArea"],scatterGroup:["scatter","bubble"],polarGroup:["radarLine","radarArea","nightingale","radialColumn","radialBar"],statisticalGroup:["boxPlot","histogram","rangeBar","rangeArea"],hierarchicalGroup:["treemap","sunburst"],specializedGroup:["heatmap","waterfall"],funnelGroup:["funnel","coneFunnel","pyramid"],combinationGroup:["columnLineCombo","areaColumnCombo","customCombo"]},Wae=class extends dT{constructor(e,t,s,i,r=zae){super('<div class="ag-chart-settings-mini-wrapper"></div>'),this.wrappers=new Map,this.chartController=e,this.fills=t,this.strokes=s,this.isCustomTheme=i,this.chartGroups={...r}}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){!this.chartController.customComboExists()&&this.chartGroups.combinationGroup&&(this.chartGroups.combinationGroup=this.chartGroups.combinationGroup.filter(n=>n!=="customCombo"));const e=this.getGui(),t=this.chartController.isEnterprise(),s=this.chartController.isPivotChart(),i=!s,r=Object.keys(this.chartGroups).map(n=>{const o=n in my?my[n]:void 0;if(!o)return this.beans.log.warn(148,{group:n}),null;const l=(this.chartGroups[n]??[]).map(c=>{const u=c in o?o[c]:void 0;return u?!t&&u.enterprise?null:i&&u.range||s&&u.pivot?u:null:(this.beans.log.warn(149,{group:n,chartType:c}),null)}).filter(c=>c!=null);return l.length===0?null:{label:this.chartTranslation.translate(n),items:l}}).filter(n=>n!=null);for(const{label:n,items:o}of r){const a=this.createBean(new it({title:n,suppressEnabledCheckbox:!0,enabled:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-settings",direction:"horizontal",suppressKeyboardNavigation:!0}));for(const l of o){const{miniChart:c,chartType:u}=l.icon,d=goe({tag:"div",cls:"ag-chart-mini-thumbnail",role:"button",attrs:{tabindex:"0"}}),h=u,p=()=>{this.chartController.setChartType(h),this.updateSelectedMiniChart()};this.addManagedListeners(d,{click:p,keydown:g=>{(g.key==qb.ENTER||g.key===qb.SPACE)&&(g.preventDefault(),p())}}),this.wrappers.set(h,d),this.createBean(new c(d,this.beans.agChartsExports,this.fills,this.strokes,this.isCustomTheme)),a.addItem(d)}e.appendChild(a.getGui())}this.updateSelectedMiniChart()}updateSelectedMiniChart(){const e=this.chartController.getChartType();this.wrappers.forEach((t,s)=>{const i=s===e;t.classList.toggle("ag-selected",i);const r=this.chartTranslation.translate(mu(s)),n=i?`${r}. ${this.chartTranslation.translate("ariaChartSelected")}`:r;hoe(t,n)})}destroy(){this.wrappers.clear(),super.destroy()}},$ae=class extends hT{constructor(e){super(`<div class="ag-chart-settings-wrapper">
<div data-ref="eMiniChartsContainer" class="ag-chart-settings-mini-charts-container ag-scrollable-container"></div>
<div data-ref="eNavBar" class="ag-chart-settings-nav-bar">
<div data-ref="ePrevBtn" class="ag-chart-settings-prev">
<button type="button" class="ag-button ag-chart-settings-prev-button"></button>
</div>
<div data-ref="eCardSelector" class="ag-chart-settings-card-selector"></div>
<div data-ref="eNextBtn" class="ag-chart-settings-next">
<button type="button" class="ag-button ag-chart-settings-next-button"></button>
</div>
</div>
</div>`),this.chartController=e,this.eMiniChartsContainer=Cr,this.eNavBar=Cr,this.eCardSelector=Cr,this.ePrevBtn=Cr,this.eNextBtn=Cr,this.miniChartsContainers=[],this.cardItems=[],this.activePaletteIndex=0,this.palettes=[],this.themes=[]}postConstruct(){this.resetPalettes();const e=this.gos.get("enableRtl");this.ePrevBtn.insertAdjacentElement("afterbegin",Yb(e?"chartsThemeNext":"chartsThemePrevious",this.beans)),this.eNextBtn.insertAdjacentElement("afterbegin",Yb(e?"chartsThemePrevious":"chartsThemeNext",this.beans)),this.addManagedElementListeners(this.ePrevBtn,{click:()=>this.setActivePalette(this.getPrev(),"left")}),this.addManagedElementListeners(this.eNextBtn,{click:()=>this.setActivePalette(this.getNext(),"right")});const t=()=>this.resetPalettes(!0);this.addManagedListeners(this.chartController,{chartTypeChanged:t,chartApiUpdate:t}),this.scrollSelectedIntoView()}scrollSelectedIntoView(){setTimeout(()=>{if(!this.isAlive())return;const e=i=>!i.getGui().classList.contains("ag-hidden"),s=this.miniChartsContainers.find(e).getGui().querySelector(".ag-selected");if(s){const i=s.offsetParent;i&&this.eMiniChartsContainer.scrollTo(0,i.offsetTop)}},250)}resetPalettes(e){const t=this.chartController.getPalettes(),s=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(aoe(t,this.palettes)&&!e||this.isAnimating)return;this.palettes=t,this.themes=this.chartController.getThemeNames(),this.activePaletteIndex=this.themes.findIndex(r=>r===this.chartController.getChartThemeName()),this.cardItems=[],Kb(this.eCardSelector),this.destroyMiniCharts();const{themes:i}=this;this.palettes.forEach((r,n)=>{const o=this.activePaletteIndex===n,{fills:a=[],strokes:l=[]}=r,c=i[n],u=!vu(c,this.beans.agChartsExports._Theme),d=this.createBean(new Wae(this.chartController,a,l,u,s));this.miniChartsContainers.push(d),this.eMiniChartsContainer.appendChild(d.getGui()),this.addCardLink(n),o?d.updateSelectedMiniChart():d.setDisplayed(!1)}),coe(this.eNavBar,this.palettes.length>1),jb(this.cardItems[this.activePaletteIndex],"ag-selected","ag-not-selected")}addCardLink(e){const t=doe({tag:"div",cls:"ag-chart-settings-card-item"});this.addManagedElementListeners(t,{click:()=>{this.setActivePalette(e,e<this.activePaletteIndex?"left":"right")}}),this.eCardSelector.appendChild(t),this.cardItems.push(t)}getPrev(){let e=this.activePaletteIndex-1;return e<0&&(e=this.palettes.length-1),e}getNext(){let e=this.activePaletteIndex+1;return e>=this.palettes.length&&(e=0),e}setActivePalette(e,t){if(this.isAnimating||this.activePaletteIndex===e)return;jb(this.cardItems[e],"ag-selected","ag-not-selected");const s=this.miniChartsContainers[this.activePaletteIndex],i=s.getGui(),r=this.miniChartsContainers[e],n=r.getGui();s.updateSelectedMiniChart(),r.updateSelectedMiniChart();const o=t==="left"?-1:1,a=n.style.left=`${loe(this.getGui())*o}px`;this.activePaletteIndex=e,this.isAnimating=!0;const l="ag-animating";r.setDisplayed(!0),s.addCss(l),r.addCss(l),this.chartController.setChartThemeName(this.themes[e]),window.setTimeout(()=>{i.style.left=`${-parseFloat(a)}px`,n.style.left="0px"},0),window.setTimeout(()=>{this.isAnimating=!1,s.removeCss(l),r.removeCss(l),s.setDisplayed(!1)},300)}destroyMiniCharts(){Kb(this.eMiniChartsContainer),this.miniChartsContainers=this.destroyBeans(this.miniChartsContainers)}destroy(){this.destroyMiniCharts(),super.destroy()}},Kae="data",jae="format",Yae=class extends pT{constructor(e,t){super(),this.panels=e,this.chartMenuContext=t,this.tabs=[]}wireBeans(e){this.chartTranslation=e.chartTranslation}postConstruct(){for(const e of this.panels){const t=e.replace("chart","").toLowerCase(),s=this.createPanel(t),i=this.createTab(e,t,s);this.tabs.push(i),this.addDestroyFunc(()=>this.destroyBean(s))}this.tabbedLayout=new Qo({items:this.tabs,cssClass:"ag-chart-tabbed-menu",keepScrollPosition:!0,suppressFocusBodyOnOpen:!0,suppressTrapFocus:!0,enableCloseButton:!0,closeButtonAriaLabel:this.chartTranslation.translate("ariaChartMenuClose"),onCloseClicked:()=>{this.eventSource?.focus({preventScroll:!0}),this.dispatchLocalEvent({type:"closed"})}}),this.createBean(this.tabbedLayout)}createTab(e,t,s){const i=Nb({tag:"div",cls:`ag-chart-tab ag-chart-${t}`});this.createBean(s),i.appendChild(s.getGui());const r=this.chartTranslation.translate(t);return{title:Nb({tag:"div",children:r}),titleLabel:r,bodyPromise:qie.resolve(i),getScrollableContainer:()=>i.querySelector(".ag-scrollable-container")||i,name:e}}showTab(e){const t=this.tabs[e];this.tabbedLayout.showItem(t)}getGui(){return this.tabbedLayout?.getGui()}showMenu(e,t){this.eventSource=e,t||this.tabbedLayout?.focusHeader(!0)}destroy(){this.parentComponent?.isAlive()&&this.destroyBean(this.parentComponent),super.destroy()}createPanel(e){switch(e){case Kae:return new Ere(this.chartMenuContext);case jae:return new ooe(this.chartMenuContext);default:return new $ae(this.chartMenuContext.chartController)}}},qae=class extends gT{constructor(e,t,s){super('<div class="ag-chart-menu-wrapper"></div>'),this.eChartContainer=e,this.eMenuPanelContainer=t,this.chartMenuContext=s,this.buttons={chartLink:{iconName:"linked",callback:()=>this.chartMenuSvc.toggleLinked(this.chartMenuContext)},chartUnlink:{iconName:"unlinked",callback:()=>this.chartMenuSvc.toggleLinked(this.chartMenuContext)},chartDownload:{iconName:"chartsDownload",callback:()=>this.chartMenuSvc.downloadChart(this.chartMenuContext)},chartMenu:{iconName:"chartsMenu",callback:i=>this.showMenuList(i)}},this.panels=[],this.menuVisible=!1,this.chartController=s.chartController}wireBeans(e){this.chartMenuSvc=e.chartMenuSvc,this.chartMenuListFactory=e.chartMenuListFactory}postConstruct(){this.chartToolbar=this.createManagedBean(new Yie),this.getGui().appendChild(this.chartToolbar.getGui()),this.refreshToolbarAndPanels(),this.addManagedEventListeners({chartCreated:e=>{e.chartId===this.chartController.getChartId()&&this.gos.get("chartToolPanelsDef")?.defaultToolPanel&&this.showMenu({panel:this.defaultPanel,suppressFocus:!0})}}),this.addManagedListeners(this.chartController,{chartLinkedChanged:this.refreshToolbarAndPanels.bind(this)}),this.refreshMenuClasses(),this.addManagedListeners(this.chartController,{chartApiUpdate:this.refreshToolbarAndPanels.bind(this)})}isVisible(){return this.menuVisible}getExtraPaddingDirections(){return["chartMenu","chartLink","chartUnlink","chartDownload"].some(e=>this.chartToolbarOptions.includes(e))?["top"]:[]}refreshToolbarAndPanels(){this.initToolbarOptionsAndPanels(),this.updateToolbar()}initToolbarOptionsAndPanels(){const{panels:e,defaultPanel:t}=this.chartMenuSvc.getChartToolPanels(this.chartController);this.panels=e,this.defaultPanel=t,this.chartToolbarOptions=this.chartMenuSvc.getChartToolbarOptions()}updateToolbar(){const e=this.chartToolbarOptions.map(t=>{const{iconName:s,callback:i}=this.buttons[t];return{buttonName:t,iconName:s,callback:i}});this.chartToolbar.updateParams({buttons:e})}createMenuPanel(e){const t=this.menuPanel=this.createBean(new Yo({height:"100%",closable:!0,hideTitleBar:!0,cssIdentifier:"chart-menu"}));return t.setParentComponent(this),this.eMenuPanelContainer.appendChild(t.getGui()),this.tabbedMenu=this.createBean(new Yae(this.panels,this.chartMenuContext)),this.addManagedListeners(this.tabbedMenu,{closed:()=>{this.hideMenu()}}),this.addManagedListeners(t,{destroyed:()=>this.destroyBean(this.tabbedMenu)}),new Hie(s=>{window.setTimeout(()=>{t.setBodyComponent(this.tabbedMenu),this.tabbedMenu.showTab(e),s(t)},100)})}showContainer(e,t){this.menuPanel&&(this.menuVisible=!0,this.refreshMenuClasses(),this.tabbedMenu.showMenu(e,t))}showMenu(e){const{panel:t,eventSource:s,suppressFocus:i}=e??{};if(this.menuPanel&&!t)this.showContainer(s,i);else{const r=t||this.defaultPanel;let n=this.panels.indexOf(r);n<0&&(this.beans.log.warn(143,{panel:t}),n=this.panels.indexOf(this.defaultPanel)),this.menuPanel?(this.tabbedMenu.showTab(n),this.showContainer(s,i)):this.createMenuPanel(n).then(()=>this.showContainer(s,i))}}hideMenu(){this.menuVisible=!1,this.refreshMenuClasses()}refreshMenuClasses(){this.eChartContainer.classList.toggle("ag-chart-menu-visible",this.menuVisible),this.eChartContainer.classList.toggle("ag-chart-menu-hidden",!this.menuVisible)}showMenuList(e){this.chartMenuListFactory.showMenuList({eventSource:e,showMenu:()=>this.showMenu({eventSource:e}),chartMenuContext:this.chartMenuContext})}destroy(){super.destroy(),this.menuPanel?.isAlive()&&this.destroyBean(this.menuPanel),this.tabbedMenu?.isAlive()&&this.destroyBean(this.tabbedMenu)}};import{BeanStub as Xae}from"ag-grid-community";var vy=["number","category","time","grouped-category"],Zae=["angle-category","angle-number","radius-category","radius-number"],Jae=[...vy,...Zae],Qae=class extends fT{constructor(e){super(),this.chartController=e}getChartThemeOverridesProxy(){return{getValue:e=>this.getChartOption(e),setValue:(e,t)=>this.setChartThemeOverrides([{expression:e,value:t}]),setValues:e=>this.setChartThemeOverrides(e)}}getAxisThemeOverridesProxy(){return{getValue:e=>this.getAxisProperty(e),setValue:(e,t)=>this.setAxisThemeOverrides([{expression:e,value:t}]),setValues:e=>this.setAxisThemeOverrides(e)}}getCartesianAxisOptionsProxy(e){return{getValue:t=>this.getCartesianAxisProperty(e,t),setValue:(t,s)=>this.setCartesianAxisOptions(e,[{expression:t,value:s}]),setValues:t=>this.setCartesianAxisOptions(e,t),clearValue:(t,s)=>this.clearCartesianAxisOptions(e,t,s)}}getCartesianAxisThemeOverridesProxy(e){return{getValue:t=>this.getCartesianAxisProperty(e,t),setValue:(t,s)=>this.setCartesianAxisThemeOverrides(e,[{expression:t,value:s}]),setValues:t=>this.setCartesianAxisThemeOverrides(e,t)}}getCartesianAxisAppliedThemeOverridesProxy(e){return{getValue:t=>this.getCartesianAxisThemeOverride(e,t==="*"?null:t),setValue:(t,s)=>this.setCartesianAxisThemeOverrides(e,[{expression:t==="*"?null:t,value:s}]),setValues:t=>this.setCartesianAxisThemeOverrides(e,t)}}getPolarAxisThemeOverridesProxy(e,t="allAxes"){const s=i=>t==="allAxes"?this.setAxisThemeOverrides(i):this.setPolarAxisThemeOverrides(e,i);return{getValue:i=>this.getPolarAxisProperty(e,i),setValue:(i,r)=>s([{expression:i,value:r}]),setValues:s}}getPolarCategoryAxisType(){for(const e of this.getChartAxes()){if(e.type==="angle-category")return"angle";if(e.type==="radius-category")return"radius"}}getSeriesOptionsProxy(e){return{getValue:(t,s)=>this.getSeriesOption(e(),t,s),setValue:(t,s)=>this.setSeriesOptions(e(),[{expression:t,value:s}]),setValues:t=>this.setSeriesOptions(e(),t)}}getPersistedChartThemeOverrides(e,t,s,i){const r=this.getRetainedChartThemeOverrideKeys(s,i),n=this.getRetainedChartAxisThemeOverrideKeys(null,s,i),o=this.createChartOptions();for(const a of r){const l=this.retrieveChartOptionsThemeOverride(e,s,a);l!==void 0&&this.assignChartOptionsThemeOverride(o,i,a,l)}return t&&this.assignPersistedAxisOverrides({existingAxes:t,retainedChartAxisThemeOverrideKeys:n,existingChartOptions:e,targetChartOptions:o,existingChartType:s,targetChartType:i}),o.theme.overrides}assignPersistedAxisOverrides(e){const{existingAxes:t,retainedChartAxisThemeOverrideKeys:s,existingChartOptions:i,targetChartOptions:r,existingChartType:n,targetChartType:o}=e;for(const{expression:a,targetAxisTypes:l}of s)for(const c of t.map(u=>u.type)){const u=this.retrieveChartOptionsThemeOverride(i,n,["axes",c,a].join("."));if(u!==void 0)for(const d of l)this.assignChartOptionsThemeOverride(r,o,["axes",d,a].join("."),u)}}getRetainedChartThemeOverrideKeys(e,t){const s=["animation"],i=["zoom","navigator"],r=((n,o)=>{const a=new Array;return jt(ee(n))&&jt(ee(o))&&a.push(...i),a})(e,t);return[...s,...r]}getRetainedChartAxisThemeOverrideKeys(e,t,s){return jt(ee(t))&&jt(ee(s))?this.getRetainedCartesianAxisThemeOverrideKeys(e).map(r=>({expression:r,targetAxisTypes:vy})):[]}getRetainedCartesianAxisThemeOverrideKeys(e){const t=e==="xAxis"?["",".top",".bottom"]:e==="yAxis"?["",".left",".right"]:["",".left",".right",".top",".bottom"],s=["crosshair"],i=new Array;for(const r of s)for(const n of t)i.push(`${r}${n}`);return i}getChartOption(e){return this.readProcessed({kind:"chart"},e)}readProcessed(e,t){const s=this.getChart().chartOptions?.processedOptions;if(!s)return;let i;switch(e.kind){case"chart":i=s;break;case"axis":i=this.pickProcessedAxis(s.axes,e.direction);break;case"series":i=Array.isArray(s.series)?s.series.find(r=>Mu(e.seriesType,r)):void 0;break}return Kt(i,t,void 0)}pickProcessedAxis(e,t){if(!(!e||typeof e!="object"))return e[t]}setChartThemeOverrides(e){const t=this.getChartType(),s=this.createChartOptions();for(const{expression:i,value:r}of e)this.assignChartOptionsThemeOverride(s,t,i,r);this.applyChartOptions(s)}applyChartOptions(e,t){if(Object.keys(e).length===0)return;this.updateChart(e),!t?.silent&&this.raiseChartOptionsChangedEvent()}awaitChartOptionUpdate(e){this.chartController.getChartProxy().getChart().waitForUpdate().then(()=>e()).catch(s=>this.error(108,{e:s}))}getAxisProperty(e){return this.readProcessed({kind:"axis",direction:"x"},e)}setAxisThemeOverrides(e){const t=this.getChart(),s=this.getChartType(),i=this.createChartOptions();for(const{expression:r,value:n}of e)for(const o of Object.values(t.axes??{}))this.isValidAxisType(o)&&this.assignChartAxisThemeOverride(i,s,o.type,null,r,n);this.applyChartOptions(i)}setPolarAxisThemeOverrides(e,t){const s=this.getChartType(),i=this.createChartOptions();for(const{expression:r,value:n}of t)for(const o of this.getChartAxes())!o.type.startsWith(e)||!this.isValidAxisType(o)||this.assignChartAxisThemeOverride(i,s,o.type,null,r,n);this.applyChartOptions(i)}getCartesianAxisProperty(e,t){return this.readProcessed({kind:"axis",direction:e==="xAxis"?"x":"y"},t)}getPolarAxisProperty(e,t){return this.readProcessed({kind:"axis",direction:e},t)}getCartesianAxisThemeOverride(e,t){const s=this.getChartAxes(),i=this.getCartesianAxis(s,e);if(!i||!this.isValidAxisType(i))return;const r=this.getChartType(),n=this.getChart().getOptions();return this.retrieveChartAxisThemeOverride(n,r,i.type,e==="yAxis"?["left","right"]:["bottom","top"],t)}setCartesianAxisThemeOverrides(e,t){const s=this.getChartAxes(),i=this.getCartesianAxis(s,e);if(!i||!this.isValidAxisType(i))return;const r=this.getChartType(),n=this.createChartOptions();for(const{expression:o,value:a}of t)this.assignChartAxisThemeOverride(n,r,i.type,e==="yAxis"?["left","right"]:["bottom","top"],o,a);this.applyChartOptions(n)}setCartesianAxisOptions(e,t){this.updateCartesianAxisOptions(e,s=>{const i=e==="yAxis"?"y":"x";for(const{expression:r,value:n}of t)this.assignChartOption(s,`axes.${i}.${r}`,n)})}clearCartesianAxisOptions(e,t,s){this.updateCartesianAxisOptions(e,i=>{const r=e==="yAxis"?"y":"x";this.clearChartOption(i,`axes.${r}.${t}`,s)})}updateCartesianAxisOptions(e,t){const s=this.getChart().getOptions(),i="axes"in s?s.axes:void 0;if(!s||!i)return;const r=this.getChartAxes(),n=this.getCartesianAxis(r,e);if(!n)return;const o=this.createChartOptions();o.axes=i,t(o,n,s),this.applyChartOptions(o)}setCartesianCategoryAxisType(e,t){this.updateCartesianAxisOptions(e,(s,i,r)=>{const n=this.getChartType();this.assignPersistedAxisOverrides({existingAxes:[i],retainedChartAxisThemeOverrideKeys:this.getRetainedChartAxisThemeOverrideKeys(e,n,n),existingChartOptions:r,targetChartOptions:s,existingChartType:n,targetChartType:n}),this.assignChartOption(s,"axes.x.type",t),this.chartController.setCategoryAxisType(t)})}getCartesianAxis(e,t){if(!(e.length<2))switch(t){case"xAxis":return e[0].direction==="x"?e[0]:e[1];case"yAxis":return e[1].direction==="y"?e[1]:e[0]}}getSeriesOption(e,t,s){if(s){const o=this.getChart().series.find(a=>Mu(e,a));return Kt(o,t,void 0)}const i=this.readProcessed({kind:"series",seriesType:e},t);if(i!==void 0)return i;const r=this.getChart().series.find(o=>Mu(e,o))?.properties,n=Kt(r,t,void 0);return n!==void 0?n:Kt(r?.toJson(),t,void 0)}setSeriesOptions(e,t){const s=this.createChartOptions();for(const{expression:i,value:r}of t)this.assignChartOptionsSeriesThemeOverride(s,e,`series.${i}`,r);this.applyChartOptions(s)}getPairedMode(){return this.chartController.getChartProxy().isPaired()}setPairedMode(e){this.chartController.getChartProxy().setPaired(e)}getChartAxes(){const e=this.getChart();return Object.values(e.axes??{})}retrieveChartAxisThemeOverride(e,t,s,i,r){if(i)for(const n of i){const o=this.retrieveChartOptionsThemeOverride(e,t,["axes",s,n,...r?[r]:[]].join("."));if(o!==void 0)return o}else return this.retrieveChartOptionsThemeOverride(e,t,["axes",s,...r?[r]:[]].join("."))}assignChartAxisThemeOverride(e,t,s,i,r,n){if(i)for(const o of i)this.assignChartOptionsThemeOverride(e,t,["axes",s,o,...r?[r]:[]].join("."),n);else this.assignChartOptionsThemeOverride(e,t,["axes",s,...r?[r]:[]].join("."),n)}isValidAxisType(e){return Jae.includes(e.type)}getChartType(){return this.chartController.getChartType()}getChart(){return this.chartController.getChartProxy().getChart()}updateChart(e){const t=this.chartController.getChartProxy().getChartRef();t.skipAnimations(),t.updateDelta(e)}createChartOptions(){return{theme:{overrides:{}}}}retrieveChartOptionsThemeOverride(e,t,s){const i=this.getChartThemeOverridesSeriesTypeKeys(t);for(const r of i){const n=this.retrieveChartOptionsSeriesThemeOverride(e,r,s);if(n!==void 0)return n}}assignChartOptionsThemeOverride(e,t,s,i){const r=this.getChartThemeOverridesSeriesTypeKeys(t);for(const n of r)this.assignChartOptionsSeriesThemeOverride(e,n,s,i)}retrieveChartOptionsSeriesThemeOverride(e,t,s){return this.retrieveChartOption(e,["theme","overrides",t,...s?[s]:[]].join("."))}assignChartOptionsSeriesThemeOverride(e,t,s,i){this.assignChartOption(e,["theme","overrides",t,...s?[s]:[]].join("."),i)}getChartThemeOverridesSeriesTypeKeys(e){const t=this.chartController.getChartSeriesTypes(e);return this.chartController.isComboChart()&&t.push("common"),t}retrieveChartOption(e,t){return Kt(e,t,void 0)}assignChartOption(e,t,s){gte(e,t,s)}clearChartOption(e,t,s){const i=Kt(e,t,void 0);i&&delete i[s]}raiseChartOptionsChangedEvent(){const e=this.chartController.getChartModel();this.eventSvc.dispatchEvent({type:"chartOptionsChanged",chartId:e.chartId,chartType:e.chartType,chartThemeName:this.chartController.getChartThemeName(),chartOptions:e.chartOptions})}};function Mu(e,t){return Cte(e)&&t.type===e}var ele=class extends mT{constructor(e){super(`
<div style="height: 100%; width: 100%;">
<div class="ag-chart" data-ref="eWrapper">
<div data-ref="eChartContainer" class="ag-chart-components-wrapper ag-chart-menu-hidden">
<div data-ref="eChart" class="ag-chart-canvas-wrapper"></div>
<div data-ref="eEmpty" class="ag-chart-empty-text ag-unselectable"></div>
</div>
<div data-ref="eMenuContainer" class="ag-chart-docked-container"></div>
</div>
</div>
`),this.eChart=gr,this.eWrapper=gr,this.eChartContainer=gr,this.eMenuContainer=gr,this.eEmpty=gr,this.params=e}wireBeans(e){this.crossFilterService=e.chartCrossFilterSvc,this.chartTranslation=e.chartTranslation,this.chartMenuSvc=e.chartMenuSvc,this.focusSvc=e.focusSvc,this.popupSvc=e.popupSvc,this.enterpriseChartProxyFactory=e.enterpriseChartProxyFactory}postConstruct(){const e={...this.params,chartType:hr(this.params.chartType),chartThemeName:this.getThemeName()},t=this.createBean(new hse(e));this.chartController=this.createManagedBean(new Die(t)),this.chartOptionsService=this.createManagedBean(new Qae(this.chartController)),this.validateCustomThemes(),this.createChart(),this.params.insideDialog&&this.addDialog(),this.addMenu(),this.addManagedElementListeners(this.getGui(),{focusin:this.setActiveChartCellRange.bind(this)}),this.addManagedListeners(this.chartController,{chartModelUpdate:this.update.bind(this)}),this.addManagedPropertyListeners(["chartThemeOverrides","chartThemes"],this.reactivePropertyUpdate.bind(this)),this.update(),this.raiseChartCreatedEvent()}createChart(){let e;this.chartProxy&&(e=this.chartProxy.destroy({keepChartInstance:!0}));const t=(c,u)=>{const d=this.params.crossFilteringContext;d.lastSelectedChartId=u?"":this.chartController.getChartId(),u&&this.params.crossFilteringResetCallback(),this.crossFilterService.filter(c,u)},{gos:s,chartController:i,beans:r,params:n,eChart:o}=this,a=i.getChartType(),l={gridId:r.context.getId(),agChartsExports:r.agChartsExports,chartType:a,chartInstance:e,getChartThemeName:this.getChartThemeName.bind(this),getChartThemes:this.getChartThemes.bind(this),customChartThemes:s.get("customChartThemes"),styleNonce:s.get("styleNonce"),getGridOptionsChartThemeOverrides:()=>this.getGridOptionsChartThemeOverrides(),getExtraPaddingDirections:()=>this.chartMenu?.getExtraPaddingDirections()??[],apiChartThemeOverrides:n.chartThemeOverrides,crossFiltering:n.crossFiltering??!1,crossFilterCallback:t,parentElement:o,grouping:i.isGrouping(),chartThemeToRestore:n.chartThemeName,chartOptionsToRestore:n.chartOptionsToRestore,chartPaletteToRestore:n.chartPaletteToRestore,seriesChartTypes:i.getSeriesChartTypes(),translate:c=>this.chartTranslation.translate(c),context:gie(s,{}),enableRtl:s.get("enableRtl")};if(n.chartOptionsToRestore=void 0,this.chartType=a,this.chartProxy=this.createChartProxy(l),!this.chartProxy){this.beans.log.warn(138,{chartType:l.chartType});return}i.setChartProxy(this.chartProxy),this.createMenuContext()}createMenuContext(){if(this.chartMenuContext)return;const e=this.createManagedBean(new St(this.chartOptionsService.getChartThemeOverridesProxy())),t=this.createManagedBean(new St(this.chartOptionsService.getAxisThemeOverridesProxy()));this.chartMenuContext={chartController:this.chartController,chartOptionsService:this.chartOptionsService,chartMenuParamsFactory:e,chartAxisMenuParamsFactory:t}}getChartThemeName(){return this.chartController.getChartThemeName()}getChartThemes(){return this.chartController.getThemeNames()}getGridOptionsChartThemeOverrides(){return this.gos.get("chartThemeOverrides")}createChartProxy(e){const{chartType:t}=e;switch(t){case"column":case"bar":case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":return new _ie(e);case"pie":case"donut":case"doughnut":return new Vie(e);case"area":case"stackedArea":case"normalizedArea":return new Lie(e);case"line":case"stackedLine":case"normalizedLine":return new Gie(e);case"scatter":case"bubble":return new Oie(e);case"columnLineCombo":case"areaColumnCombo":case"customCombo":return new Nie(e)}const s=this.enterpriseChartProxyFactory?.createChartProxy(e);if(!s)throw Ib(251,{chartType:t});return s}addDialog(){const e=this.chartTranslation.translate(this.params.pivotChart?"pivotChartTitle":"rangeChartTitle"),{width:t,height:s}=this.getBestDialogSize(),i=this.params.focusDialogOnOpen?()=>setTimeout(()=>cie(this.getGui())):void 0;this.chartDialog=new ns({resizable:!0,movable:!0,maximizable:!0,title:e,width:t,height:s,component:this,centered:!0,closable:!0,afterGuiAttached:i,postProcessPopupParams:{type:"chart"}}),this.createBean(this.chartDialog),this.chartDialog.addEventListener("destroyed",()=>{this.destroy(),this.chartMenuSvc.hideAdvancedSettings();const r=this.focusSvc.getFocusedCell();setTimeout(()=>{this.focusSvc.isAlive()&&(r?this.focusSvc.setFocusedCell({...r,forceBrowserFocus:!0}):fie(this.beans))})})}getBestDialogSize(){const e=this.popupSvc.getPopupParent(),t=die(e)*.75,s=uie(e)*.75,i=.553,r=this.chartProxy.getChart();let n=this.params.insideDialog?850:r.width,o=this.params.insideDialog?470:r.height;return(n>t||o>s)&&(n=Math.min(n,t),o=Math.round(n*i),o>s&&(o=s,n=Math.min(n,Math.round(o/i)))),{width:n,height:o}}addMenu(){this.params.crossFiltering||(this.chartMenu=this.createBean(new qae(this.eChartContainer,this.eMenuContainer,this.chartMenuContext)),this.eChartContainer.appendChild(this.chartMenu.getGui()))}update(e){if(e?.chartId&&!this.chartController.update(e))return;const t=this.chartTypeChanged(e),s=t||this.chartEmpty?(r=>{const n=this.chartType,o=r,a=this.chartProxy.getChart(),l=a?.getOptions(),c=Object.values(a?.axes??{});return this.chartOptionsService.getPersistedChartThemeOverrides(l,c,n,o??n)})(t):void 0;t&&this.createChart(),s&&e?.chartThemeOverrides&&mie(s,e.chartThemeOverrides);const i=s??e?.chartThemeOverrides;this.updateChart(i),e?.chartId&&this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartApiUpdateEvent()})}updateChart(e){const{chartProxy:t}=this,s=this.chartController.getSelectedValueColState(),i=this.chartController.getChartData(),r=this.handleEmptyChart(i,s.length);if(this.chartEmpty=r,r){e&&this.chartController.updateThemeOverrides(e);return}const n=this.chartController.getChartUpdateParams(e);t.update(n),this.chartProxy.getChart().waitForUpdate().then(()=>{this.chartController.raiseChartUpdatedEvent()})}chartTypeChanged(e){const[t,s]=[this.chartController.getChartType(),e?.chartType],i=s?hr(s):void 0;return this.chartType!==t?i??t:i&&t!==i?i:null}getChartModel(){return this.chartController.getChartModel()}getChartImageDataURL(e){return this.chartProxy.getChartImageDataURL(e)}handleEmptyChart(e,t){const s=this.chartController.isPivotChart()&&!this.chartController.isPivotMode(),i=this.chartController.getChartType();let r=1;this.chartController.isActiveXYChart()?r=i==="bubble"?3:2:gs(ee(i))&&(r=0);const n=t<r||e.length===0;if(this.eChart){const o=s||n;Mb(this.eChart,!o),Mb(this.eEmpty,o)}return s?(this.eEmpty.textContent=this.chartTranslation.translate("pivotChartRequiresPivotMode"),!0):n?(this.eEmpty.textContent=this.chartTranslation.translate("noDataToChart"),!0):!1}downloadChart(e,t,s){this.chartProxy.downloadChart(e,t,s)}openChartToolPanel(e){const t=e&&Fo[e];this.chartMenu.showMenu({panel:t})}closeChartToolPanel(){this.chartMenu.hideMenu()}getChartId(){return this.chartController.getChartId()}getUnderlyingChart(){return this.chartProxy.getChartRef()}crossFilteringReset(){this.chartProxy.crossFilteringReset()}setMaximized(e){this.chartDialog?.setMaximized(e)}setActiveChartCellRange(e){this.getGui().contains(e.relatedTarget)||this.chartController.setChartRange(!0)}getThemeName(){const e=this.gos.get("chartThemes")||Ob;if(e.length===0)throw new Error(Ib(254));const{chartThemeName:t}=this.params;return e.includes(t)?t:e[0]}getAllKeysInObjects(e){const t={};for(const s of e.filter(i=>i!=null))for(const i of Object.keys(s))t[i]=null;return Object.keys(t)}validateCustomThemes(){const e=this.getChartThemes(),t=this.gos.get("customChartThemes");if(t)for(const s of this.getAllKeysInObjects([t]))e.includes(s)||this.beans.log.warn(139,{customThemeName:s})}reactivePropertyUpdate(){this.chartController.setChartThemeName(this.getThemeName(),!0);const e=this.getChartId(),t=this.chartController.isCrossFilterChart()?"crossFilter":this.getChartModel().modelType,s=this.gos.get("chartThemeOverrides")||{};this.update({type:`${t}ChartUpdate`,chartId:e,chartThemeOverrides:s})}raiseChartCreatedEvent(){this.chartProxy.getChart().waitForUpdate().then(()=>{this.eventSvc.dispatchEvent({type:"chartCreated",chartId:this.chartController.getChartId()})})}raiseChartDestroyedEvent(){this.eventSvc.dispatchEvent({type:"chartDestroyed",chartId:this.chartController.getChartId()})}destroy(){super.destroy(),this.chartProxy&&this.chartProxy.destroy(),this.destroyBean(this.chartMenu),this.chartDialog?.isAlive()&&this.destroyBean(this.chartDialog),this.onDestroyColorSchemeChangeListener?.();const e=this.getGui();lie(e),hie(e),this.raiseChartDestroyedEvent()}};import{_errMsg as tle}from"ag-grid-community";var br=!1;function sle(e){const t=e.version;return e.version==null&&(e.version=Sle(e)),e=fe("23.0.0",e,ile),e=fe("24.0.0",e,rle),e=fe("25.1.0",e,nle),e=fe("26.0.0",e,ole),e=fe("26.1.0",e,ale),e=fe("26.2.0",e,lle),e=fe("28.0.0",e,cle),e=fe("28.2.0",e,ule),e=fe("29.0.0",e,dle),e=fe("29.1.0",e,Cy),e=fe("29.2.0",e,Sy),e=fe("30.0.0",e,hle),e=fe("31.0.0",e,ple),e=fe("32.0.0",e,gle),e=fe("33.0.0",e,fle),e=fe("34.0.0",e,mle),e=fe("36.0.0",e,vle),e=Cle(e),e=fe(G,e,s=>s),br&&t!==e.version&&console.log("AG Grid: ChartModel migration complete",{model:e}),e}function ile(e){return e=me("chartOptions.legend.item.marker.type","shape",e),e=me("chartOptions.seriesDefaults.marker.type","shape",e),e=me("chartOptions.legend.padding","spacing",e),e}function rle(e){e=te("chartOptions.seriesDefaults.marker.minSize",e);const{chartType:t,chartPalette:s,chartOptions:{xAxis:i,yAxis:r,...n},...o}=e,l=Pte(t)?.map((u,d)=>({type:u,...d===0?i:r}));return{chartType:t,chartThemeName:{borneo:"ag-default",material:"ag-material",bright:"ag-vivid"}[s]??"ag-default",chartOptions:{...n,axes:l,xAxis:i,yAxis:r},...o}}function nle(e){return e=me("chartOptions.seriesDefaults.label.minRequiredAngle","minAngle",e),e}function ole(e){return e=Mt("chartOptions.seriesDefaults.highlightStyle",e,({dimOpacity:s,...i})=>({...i,...s!=null?{series:{dimOpacity:s}}:{}})),e=te("chart",e),e=te("chartOptions.seriesDefaults.tooltipClass",e),e=te("chartOptions.seriesDefaults.tooltipTracking",e),e=yy("chartOptions.axes[].label.rotation",0,e),e=yy("chartOptions.axes[].label.rotation",335,e),e}function ale(e){const t=({item:s,series:i,...r})=>({item:{...r,...s},...i?{series:i}:{}});return e=Mt("chartOptions.seriesDefaults.highlightStyle",e,t),e=Mt("chartOptions.series[].highlightStyle",e,t),e}function lle(e){e=Eo("chartOptions.seriesDefaults.fill.opacity","chartOptions.seriesDefaults.fillOpacity",e),e=Eo("chartOptions.seriesDefaults.stroke.opacity","chartOptions.seriesDefaults.strokeOpacity",e),e=Eo("chartOptions.seriesDefaults.stroke.width","chartOptions.seriesDefaults.strokeWidth",e),e=te("chartOptions.seriesDefaults.fill",e),e=te("chartOptions.seriesDefaults.stroke",e),e=te("chartOptions.seriesDefaults.callout.colors",e),e=te("chartOptions.xAxis",e),e=te("chartOptions.yAxis",e);const{chartType:t,chartOptions:{axes:s,series:i,seriesDefaults:r,...n},...o}=e,a=hr(t),l=ee(a),c=[l],u={};if(!Sb(l)){const h={top:{},bottom:{},left:{},right:{}},p=s.map(({type:g,...f})=>({[g]:{...h,...f}})).reduce(Fy,{});for(const g of yb.filter(f=>p[f]==null))p[g]={...h};u.axes=p}const d=c.map(h=>({[h]:{...u,series:r,...n}})).reduce(Fy,{});return e={...o,chartType:a,chartOptions:d},e}function cle(e){return e=te("chartOptions.*.title.padding",e),e=te("chartOptions.*.subtitle.padding",e),e=te("chartOptions.*.axes.*.title.padding",e),e=Iu("chartOptions.*.axes.*.title.enabled",!1,e),e}function ule(e){return e=me("chartOptions.pie.series.callout","calloutLine",e),e=me("chartOptions.pie.series.label","calloutLabel",e),e=me("chartOptions.pie.series.labelKey","sectorLabelKey",e),e=me("chartOptions.pie.series.labelName","sectorLabelName",e),e=me("chartOptions.donut.series.callout","calloutLine",e),e=me("chartOptions.donut.series.label","calloutLabel",e),e=me("chartOptions.donut.series.labelKey","sectorLabelKey",e),e=me("chartOptions.donut.series.labelName","sectorLabelName",e),e}function dle(e){return e=yr("chartOptions.scatter.series.fill","chartOptions.scatter.series.marker.fill",e),e=yr("chartOptions.scatter.series.fillOpacity","chartOptions.scatter.series.marker.fillOpacity",e),e=yr("chartOptions.scatter.series.stroke","chartOptions.scatter.series.marker.stroke",e),e=yr("chartOptions.scatter.series.strokeOpacity","chartOptions.scatter.series.marker.strokeOpacity",e),e=yr("chartOptions.scatter.series.strokeWidth","chartOptions.scatter.series.marker.strokeWidth",e),e=Eo("chartOptions.scatter.series.paired","chartOptions.scatter.paired",e),e}function Cy(e){return e=te("chartOptions.axes[].tick.count",e),e}function Sy(e){return e=Mt("chartOptions.*.tooltip",e,({tracking:s,...i})=>{const r={...i};return s===!1?(r.position??(r.position={type:"pointer"}),r.range??(r.range="nearest")):s===!0&&(r.position??(r.position={type:"node"}),r.range??(r.range="nearest")),r}),e}function hle(e){return e=me("chartOptions.pie.series.labelKey","sectorLabelKey",e),e=me("chartOptions.pie.series.labelName","sectorLabelName",e),e=Cy(e),e=Sy(e),e=te("chartOptions.*.series.flipXY",e),e=wy("chartOptions.common.legend.enabled",!0,e),e=Iu("chartOptions.common.legend.position","right",e),e}function ple(e){const t={"ag-pastel":"ag-sheets","ag-solar":"ag-polychroma"},s=me("chartOptions.column","bar",e),i=t[s.chartThemeName]||s.chartThemeName;return{...s,chartThemeName:i}}function gle(e){return e=$e("chartOptions.*.autoSize",!0,e,(t,s)=>{t[s]===!0||t[s]===!1&&(t.minHeight=600,t.minWidth=300),delete t[s]}),e}function fle(e){return e=te("chartOptions.*.axes.category.label.format",e),e=te("chartOptions.*.axes.category.crosshair.label.format",e),e=te("chartOptions.*.axes.angle-category.label.format",e),e=te("chartOptions.*.axes.radius-category.label.format",e),e=me("chartOptions.*.axes.*.label.padding","spacing",e),e=me("chartOptions.*.navigator.miniChart.label.padding","spacing",e),e=te("chartOptions.*.axes.*.crossLines.label.className",e),e=$e("chartOptions.*.axes.*.crossLines.label.position",!0,e,(t,s)=>{typeof t[s]=="string"&&(t[s]=t[s].replace(/([A-Z])/,"-$1").toLowerCase())}),e=te("chartOptions.bullet",e),e=xy("chartOptions.bar.series.label.placement",e,{inside:"inside-center",outside:"inside-end"}),e=xy("chartOptions.waterfall.series.item.*.label.placement",e,{inside:"inside-center",start:"outside-start",end:"outside-end"}),e=te("chartOptions.*.navigator.min",e),e=te("chartOptions.*.navigator.max",e),e=te("chartOptions.*.zoom.ratioX",e),e=te("chartOptions.*.zoom.ratioY",e),e=te("chartOptions.*.zoom.rangeX",e),e=te("chartOptions.*.zoom.rangeY",e),e}function mle(e){return $e("chartOptions.series[].highlightStyle",!0,e,(s,i)=>{const r=s[i];if(r==null)return;const n={};if(r.item&&(n.highlightedItem=r.item),r.series){const{dimOpacity:o,...a}=r.series;o!=null&&(n.unhighlightedSeries={opacity:o}),Object.keys(a).length>0&&(n.highlightedSeries=a)}delete s[i],s.highlight=n}),e}function vle(e){return e=me("chartOptions.bubble.series.size","minSize",e),e}function Cle(e){return e=te("chartOptions.*.width",e),e=te("chartOptions.*.height",e),e=Iu("chartOptions.*.axes.category.label.autoRotate",!0,e),e}function Sle(e){const t=e;if(e.version!=null)return e.version;const s=(c,...u)=>Object.keys(c||{}).some(d=>u.includes(d)),i=t.chartOptions,r=s(i,"seriesDefaults")?i?.seriesDefaults:i?.[Object.keys(i)[0]],n={"27.0.0":s(t,"seriesChartTypes"),"26.2.0":!s(i,"seriesDefaults"),"26.1.0":s(r?.highlightStyle,"item"),"26.0.0":s(r?.highlightStyle,"series"),"25.1.0":s(r?.label,"minAngle"),"25.0.0":s(t,"modelType","aggFunc","unlinkChart","suppressChartRanges")||s(r,"lineDash","lineDashOffset"),"24.0.0":s(t,"chartThemeName","chart")||s(i,"series"),"23.2.0":s(i,"navigator"),"23.0.0":s(i?.legend?.item?.marker,"shape"),"22.1.0":s(t,"chartPalette","chartType")},o="27.1.0",a=Object.entries(n).filter(([c,u])=>u);br&&console.log("AG Grid: ChartModel migration",{heuristicVersionCandidates:a});const[l=o]=a[0];return br&&console.log("AG Grid: ChartModel migration",{heuristicVersion:l}),l}function fe(e,t,s){if(by(e)>by(t.version)){br&&console.log("AG Grid: ChartModel migration",{migratingTo:e});const i=s(t);return i.version=e,br&&console.log("AG Grid: ChartModel migration",{migratedTo:e,result:i}),i}return t}function ble(e){const t=e.includes("-beta")?e.replace(/-beta.*/,""):e,s=typeof t=="string"?t.split(".").map(i=>Number(i)):[];if(s.length!==3||s.some(i=>isNaN(i)))throw new Error(tle(253,{version:t}));return{major:s[0],minor:s[1],patch:s[2]}}function by(e){const{major:t,minor:s,patch:i}=ble(e);return t*1e4+s*100+i}function yy(e,t,s){return $e(e,!0,s,(i,r)=>{i[r]===t&&delete i[r]})}function Iu(e,t,s){return $e(e,!1,s,(i,r)=>{i[r]==null&&(i[r]=t)})}function wy(e,t,s){typeof e=="string"&&(e=e.split("."));const i=e[0];return e.length>1&&(s[i]=wy(e.slice(1),t,s[i]??{})),Object.keys(s).includes(i)||(s[i]=t),s}function Eo(e,t,s){let i,r=!1;return s=$e(e,!0,s,(n,o)=>{r=!0,i=n[o],delete n[o]}),r?$e(t,!1,s,(n,o)=>{n[o]=i}):s}function yr(e,t,s){let i,r=!1;return s=$e(e,!0,s,(n,o)=>{r=!0,i=n[o],delete n[o]}),r?$e(t,!1,s,(n,o)=>{n[o]===void 0&&(n[o]=i)}):s}function me(e,t,s){return $e(e,!0,s,(i,r)=>{i[t]=i[r],delete i[r]})}function te(e,t){return $e(e,!0,t,(s,i)=>delete s[i])}function $e(e,t,s,i){const r=e instanceof Array?e:e.split("."),n=r.slice(0,r.length-1),o=r[r.length-1];return Mt(n,s,a=>{const l=Object.keys(a).includes(o);if(t&&!l)return a;const c={...a};return i(c,o),c})}function Mt(e,t,s){const i=e instanceof Array?e:e.split(".");if(t={...t},i.length===0)return s(t);if(i[0].startsWith("{")){const r=i[0].substring(1,i[0].lastIndexOf("}")).split(",");for(const n of r)t[n]!=null&&(t[n]=Mt(i.slice(1),t[n],s))}else if(i[0].endsWith("[]")){const r=i[0].substring(0,e[0].indexOf("["));t[r]instanceof Array&&(t[r]=t[r].map(n=>Mt(i.slice(1),n,s)))}else if(i[0]==="*")for(const r of Object.keys(t))t[r]=Mt(i.slice(1),t[r],s);else t[i[0]]!=null&&(t[i[0]]=Mt(i.slice(1),t[i[0]],s));return t}function xy(e,t,s){return $e(e,!0,t,(i,r)=>{typeof i[r]=="string"&&(i[r]=s[r]??r)})}var Fy=(e,t)=>({...e,...t}),yle=class extends vT{constructor(){super(...arguments),this.beanName="chartSvc",this.activeCharts=new Set,this.activeChartComps=new Set,this.crossFilteringContext={lastSelectedChartId:""},this.isEnterprise=()=>this.agChartsExports.isEnterprise}wireBeans(e){this.visibleCols=e.visibleCols,this.rangeSvc=e.rangeSvc,this.agChartsExports=e.agChartsExports}updateChart(e){if(this.activeChartComps.size===0){this.warn(124);return}const t=[...this.activeChartComps].find(s=>s.getChartId()===e.chartId);if(!t){this.warn(125,{chartId:e.chartId});return}t.update(e)}getChartModels(){const e=[],t=s=>({...s,version:G});for(const s of this.activeChartComps)e.push(t(s.getChartModel()));return e}getChartRef(e){let t;for(const s of this.activeCharts)s.chartId===e&&(t=s);return t}getChartComp(e){let t;for(const s of this.activeChartComps)s.getChartId()===e&&(t=s);return t}getChartImageDataURL(e){let t;for(const s of this.activeChartComps)s.getChartId()===e.chartId&&(t=s.getChartImageDataURL(e.fileFormat));return t}downloadChart(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e.chartId)?.downloadChart(e.dimensions,e.fileName,e.fileFormat)}openChartToolPanel(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e.chartId)?.openChartToolPanel(e.panel)}closeChartToolPanel(e){Array.from(this.activeChartComps).find(s=>s.getChartId()===e)?.closeChartToolPanel()}createChartFromCurrentRange(e="groupedColumn",t){const s=this.getSelectedRange();return this.createChart({cellRange:s,chartType:e,focusDialogOnOpen:!t})}restoreChart(e,t){if(!e){this.warn(126);return}e.version!==G&&(e=sle(e));let s,i,r,n;if(e.modelType==="pivot"?(this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"}),s=this.createCellRange(void 0,!0),i=!0,r=!0):(s=this.createCellRange(e.cellRange),n=e.chartPalette,r=e.suppressChartRanges),!!s)return this.createChart({...e,cellRange:s,pivotChart:i,suppressChartRanges:r,chartContainer:t,chartOptionsToRestore:e.chartOptions,chartPaletteToRestore:n})}createRangeChart(e,t){const s=this.createCellRange(e.cellRange);if(s)return this.createChart({...e,cellRange:s,focusDialogOnOpen:!t})}createPivotChart(e,t){this.gos.updateGridOptions({options:{pivotMode:!0},source:"pivotChart"});const s=this.createCellRange(void 0,!0);if(s)return this.createChart({...e,cellRange:s,pivotChart:!0,suppressChartRanges:!0,focusDialogOnOpen:!t})}createCrossFilterChart(e,t){const s=this.createCellRange(e.cellRange);if(!s)return;const r=typeof e.suppressChartRanges<"u"&&e.suppressChartRanges!==null?e.suppressChartRanges:!0;return this.createChart({...e,cellRange:s,suppressChartRanges:r,crossFiltering:!0,crossFilteringSort:e.sort,focusDialogOnOpen:!t})}createChart(e){const t=Rie(e,this.agChartsExports.isEnterprise,this.beans.log);if(!t)return;e=t===!0?e:t;const{chartType:s,chartContainer:i}=e,r=this.gos.getCallback("createChartContainer"),n=!(i||r),o={...e,chartId:this.generateId(),chartType:hr(s),insideDialog:n,crossFilteringContext:this.crossFilteringContext,crossFilteringResetCallback:()=>{for(const d of this.activeChartComps)d.crossFilteringReset()}},a=new ele(o);this.createBean(a);let l=a.getGui(),c;n||([l,c]=oie(this.beans.environment,l),i?.appendChild(l));const u={destroyChart:()=>{this.activeCharts.has(u)&&(this.destroyBean(a),c?.(),i&&l.remove(),this.activeChartComps.delete(a),this.activeCharts.delete(u))},focusChart:()=>{nie(a.getGui())},chartElement:l,chart:a.getUnderlyingChart(),chartId:a.getChartModel().chartId,setMaximized:a.setMaximized.bind(a)};return this.activeCharts.add(u),this.activeChartComps.add(a),!i&&r?r(u):i||a.addEventListener("destroyed",()=>{this.activeChartComps.delete(a),this.activeCharts.delete(u)}),u}getSelectedRange(){const e=this.rangeSvc?.getCellRanges();if(!e||e.length===0)return{columns:[]};const t=new Set;let s=Number.MAX_VALUE,i=-Number.MAX_VALUE;for(const{startRow:n,endRow:o,columns:a}of e){if(!(n&&o))continue;for(const h of a)t.add(h);let{rowIndex:l,rowPinned:c}=n,{rowIndex:u,rowPinned:d}=o;if(c==="top"){if(d==="top")continue;l=0}if(d==="bottom"){if(c==="bottom")continue;u=this.beans.pageBounds.getLastRow()}l!==void 0&&(s=Math.min(s,l)),u!==void 0&&(i=Math.max(i,u))}if(s===Number.MAX_VALUE||i===-Number.MAX_VALUE)return{columns:[]};const r=Array.from(t);return{columns:r,startColumn:r[0],startRow:{rowIndex:s,rowPinned:void 0},endRow:{rowIndex:i,rowPinned:void 0}}}generateId(){return`id-${Math.random().toString(36).substring(2,18)}`}createCellRange(e,t){const s=t?{rowStartIndex:null,rowStartPinned:void 0,rowEndIndex:null,rowEndPinned:void 0,columns:this.visibleCols.allCols.map(r=>r.colId)}:e,i=s&&this.rangeSvc?.createPartialCellRangeFromRangeParams(s,!0);return i||this.warn(127,{allRange:t}),i}destroy(){for(const e of this.activeCharts)e.destroyChart();super.destroy()}};function wle(e){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartModels())}function xle(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartRef(t))}function Fle(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.getChartImageDataURL(t))}function Tle(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.downloadChart(t))}function Ale(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.openChartToolPanel(t))}function Ple(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.closeChartToolPanel(t.chartId))}function Rle(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createRangeChart(t,!0))}function Mle(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createPivotChart(t,!0))}function Ile(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.createCrossFilterChart(t,!0))}function Ele(e,t){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.updateChart(t))}function Dle(e,t,s){return e.frameworkOverrides.wrapIncoming(()=>e.chartSvc?.restoreChart(t,s))}var Lle='.ag-chart{background-color:var(--ag-wrapper-background-color);display:flex;height:100%;position:relative;width:100%}.ag-chart-components-wrapper{display:flex}.ag-chart-canvas-wrapper,.ag-chart-components-wrapper{flex:1 1 auto;position:relative}.ag-chart-menu{background:var(--ag-background-color);background-color:color-mix(in srgb,transparent,var(--ag-background-color) 30%);border-radius:var(--ag-border-radius);display:flex;flex-direction:row;gap:20px;padding:4px 2px;position:absolute;top:8px;width:auto;--ag-icon-size:20px}:where(.ag-ltr) .ag-chart-menu{justify-content:right;right:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}:where(.ag-rtl) .ag-chart-menu{justify-content:left;left:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}.ag-chart-docked-container{min-width:var(--ag-chart-menu-panel-width);position:relative}:where(.ag-chart-menu-hidden)~.ag-chart-docked-container{display:none}.ag-chart-tabbed-menu{display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.ag-chart-tabbed-menu-header{cursor:default;flex:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-tabbed-menu-body{align-items:stretch;display:flex;flex:1 1 auto;overflow:hidden;position:relative}.ag-chart-tabbed-menu-body:after{background:linear-gradient(var(--ag-background-color),transparent);content:"";display:block;height:16px;left:0;position:absolute;right:0;top:0}.ag-chart-tab{overflow:hidden;overflow-y:auto;width:100%}.ag-chart-settings{overflow-x:hidden}.ag-chart-settings-wrapper{display:flex;flex-direction:column;height:100%;overflow:hidden;position:relative;width:100%}.ag-chart-settings-nav-bar{align-items:center;border-top:solid var(--ag-border-width) var(--ag-border-color);display:flex;height:30px;padding:0 10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-chart-settings-card-selector{align-items:center;display:flex;flex:1 1 auto;height:100%;justify-content:space-around;padding:0 10px}.ag-chart-settings-card-item{background-color:var(--ag-foreground-color);border-radius:4px;cursor:pointer;height:8px;position:relative;width:8px;&.ag-not-selected{opacity:.2}&.ag-selected{background-color:var(--ag-accent-color)}}.ag-chart-settings-card-item:before{background-color:transparent;content:" ";display:block;height:20px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:50%;width:20px}.ag-chart-settings-next,.ag-chart-settings-prev{flex:none;position:relative}.ag-chart-settings-next:focus-within,.ag-chart-settings-prev:focus-within{border-radius:1px;box-shadow:var(--ag-focus-shadow)}.ag-chart-settings-next-button,.ag-chart-settings-prev-button{cursor:pointer;height:100%;left:0;opacity:0;position:absolute;top:0;width:100%}.ag-chart-settings-mini-charts-container{flex:1 1 auto;overflow:hidden auto;position:relative}.ag-chart-settings-mini-wrapper{display:flex;flex-direction:column;left:0;min-height:100%;overflow:hidden;padding-bottom:var(--ag-widget-container-vertical-padding);position:absolute;top:0;width:100%;&.ag-animating{transition:left .3s;transition-timing-function:ease-in-out}}.ag-chart-mini-thumbnail{border:solid var(--ag-border-width) var(--ag-border-color);border-radius:5px;cursor:pointer;padding:1px;&.ag-selected{border-color:var(--ag-accent-color);border-width:calc(var(--ag-border-width) + 1px);padding:unset}&:focus-visible{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}}.ag-chart-mini-thumbnail-canvas{display:block}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper,.ag-chart-format-wrapper{display:flex;flex-direction:column;padding-bottom:16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper{height:100%;overflow-y:auto}.ag-chart-advanced-settings{background-color:var(--ag-chrome-background-color)}.ag-chart-advanced-settings,.ag-chart-advanced-settings-wrapper{width:100%}.ag-chart-advanced-settings-wrapper{padding-bottom:0}.ag-chart-advanced-settings-section{border-bottom:solid var(--ag-border-width) var(--ag-border-color);display:flex;margin:0;padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding)}.ag-chart-empty-text{align-items:center;background-color:var(--ag-background-color);display:flex;height:100%;justify-content:center;top:0;width:100%}.ag-charts-font-size-color{align-self:stretch;display:flex;justify-content:space-between}.ag-chart-menu-icon{border-radius:var(--ag-border-radius);cursor:pointer;margin:2px 0;opacity:.8}.ag-chart-menu-icon:hover{opacity:1}.ag-chart-menu-toolbar-button{background-color:unset;border:0;border-radius:1px;padding:0 2px}.ag-chart-data-column-drag-handle{margin-left:var(--ag-spacing)}.ag-chart-data-section,.ag-chart-format-section{display:flex;margin:0;:where(.ag-label:not(.ag-group-title-bar)){color:var(--ag-chart-menu-label-color)}:where(.ag-label-align-top .ag-label){margin-bottom:var(--ag-widget-vertical-spacing);margin-top:calc(var(--ag-widget-vertical-spacing)*.5)}:where(.ag-slider.ag-label-align-top .ag-label){margin-bottom:0}.ag-label{display:inline-block}}.ag-chart-menu-panel{--ag-panel-background-color:var(--ag-chrome-background-color)}:where(.ag-ltr) .ag-chart-menu-panel{border-left:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-chart-menu-panel{border-right:solid var(--ag-border-width) var(--ag-border-color)}.ag-chart-data-wrapper,.ag-chart-format-wrapper{margin:0;padding:0}.ag-group{.ag-charts-data-group-item{padding-bottom:var(--ag-widget-container-vertical-padding);position:relative}.ag-charts-data-group-item:where(:not(:last-child)){margin-bottom:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-title-bar{background-color:unset;position:relative}.ag-charts-data-group-item:where(:not(.ag-charts-format-sub-level-group,.ag-pill-select,.ag-select)){height:var(--ag-list-item-height)}.ag-charts-data-group-item:where(.ag-picker-field){margin-top:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-item,.ag-charts-format-top-level-group-item{margin:var(--ag-spacing) 0}.ag-charts-format-sub-level-group-container{display:flex;flex-direction:column;padding:var(--ag-widget-vertical-spacing) 0}.ag-charts-settings-group-container{border-top:none;display:grid;font-weight:500;grid-template-columns:60px 1fr 60px 1fr 60px;row-gap:8px;:where(.ag-chart-mini-thumbnail:nth-child(3n+1)){grid-column:1}:where(.ag-chart-mini-thumbnail:nth-child(3n+2)){grid-column:3}:where(.ag-chart-mini-thumbnail:nth-child(3n+3)){grid-column:5}}.ag-charts-data-group-title-bar,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-title-bar{border-top:none;font-weight:500;margin:0;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:relative}.ag-charts-format-sub-level-group-title-bar{background:none;font-weight:500;padding:var(--ag-widget-vertical-spacing) 0}&.ag-charts-data-group,&.ag-charts-format-top-level-group{border-top:solid var(--ag-border-width) var(--ag-border-color)}.ag-charts-data-group-container,.ag-charts-format-top-level-group-container,.ag-charts-settings-group-container{margin:0;padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-format-sub-level-group-item,.ag-charts-format-sub-level-no-header-group-item,.ag-charts-format-top-level-group-item{margin-bottom:var(--ag-widget-vertical-spacing)}&.ag-charts-format-sub-level-group,&.ag-charts-format-top-level-group,.ag-charts-format-sub-level-group-item:last-child,.ag-charts-format-top-level-group-item{margin:0;padding:0}.ag-charts-advanced-settings-top-level-group-container{margin:0}.ag-charts-advanced-settings-top-level-group-container,.ag-charts-advanced-settings-top-level-group-title-bar{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-advanced-settings-top-level-group-item{margin-bottom:0;margin-top:calc(var(--ag-widget-vertical-spacing)*2)}}.ag-chart-settings-card-item.ag-not-selected:hover{opacity:.35}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{.ag-charts-canvas-center,.ag-charts-canvas-overlay>*,.ag-charts-proxy-elem,.ag-charts-proxy-legend-toolbar,.ag-charts-series-area,.ag-charts-toolbar{pointer-events:none}}.ag-angle-select{align-items:center;display:flex}.ag-angle-select-wrapper{display:flex}.ag-angle-select-parent-circle{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:12px;display:block;height:24px;position:relative;width:24px}.ag-angle-select-child-circle{background-color:var(--ag-foreground-color);border-radius:3px;height:6px;left:12px;margin-left:-3px;margin-top:-4px;position:absolute;top:4px;width:6px}:where(.ag-ltr) .ag-angle-select-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-angle-select-field{margin-left:calc(var(--ag-spacing)*2)}.ag-range-field{align-items:center;display:flex;:where(.ag-input-wrapper){height:100%}}.ag-range-field-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;height:100%;overflow:visible;padding:0;width:100%;&:disabled{opacity:.5}}.ag-range-field-input{&::-webkit-slider-runnable-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-webkit-slider-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-webkit-slider-runnable-track{background-color:var(--ag-accent-color)}}.ag-range-field-input{&::-moz-range-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-moz-ag-range-thumb{-moz-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-moz-ag-range-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-moz-ag-range-track{background-color:var(--ag-accent-color)}}',Ty=28,Ay=6;function Eu(e){return e?.match(/\d+\.\d+\.\d+/)}function kle({gridMajorVersion:e,chartsMajorVersion:t}){const s=parseInt(e,10),i=parseInt(t,10),r=s-Ty,n=i-Ay,o=r>=0;return r===n&&o}function _le(e){if(!e||!Eu(e))return;const[t,s]=e.split(".")||[],i=`${t}.${s}.x`,n=parseInt(t,10)-Ty+Ay;if(n<0)return;const a=`${n}.${s}.x`;return{gridMajorMinor:i,chartsMajorMinor:a}}function Do({type:e,gridVersion:t,chartsVersion:s}){const i="AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.";if(!t)return i;const r=_le(t);if(!r)return i;const{gridMajorMinor:n,chartsMajorMinor:o}=r;return e==="incompatible"?`AG Grid version ${t} and AG Charts version ${s} is not supported. AG Grid version ${n} should be used with AG Chart ${o}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`:e==="invalidCharts"?`AG Grid version ${n} should be used with AG Chart ${o} not ${s}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`:i}function Gle({gridVersion:e,chartsVersion:t}){if(!Eu(t))return{isValid:!1,message:Do({type:"invalidCharts",gridVersion:e,chartsVersion:t})};if(!Eu(e))return{isValid:!1,message:Do({type:"invalidGrid",gridVersion:e,chartsVersion:t})};const[s,i]=e.split(".")||[],[r,n,o]=t.split(".")||[],a=kle({gridMajorVersion:s,chartsMajorVersion:r});return a&&i===n||o.includes("beta")?{isValid:!0}:!a||i!==n?{isValid:!1,message:Do({type:"incompatible",gridVersion:e,chartsVersion:t})}:{isValid:!1,message:Do({type:"invalid",gridVersion:e,chartsVersion:t})}}var Ole={linked:"linked",unlinked:"unlinked",chartsMenu:"menu-alt",chartsDownload:"save",chartsMenuEdit:"chart",chartsMenuAdvancedSettings:"settings",chartsMenuAdd:"plus",chartsColorPicker:"small-down",chartsThemePrevious:"previous",chartsThemeNext:"next"},Nle={getChartModels:wle,getChartRef:xle,getChartImageDataURL:Fle,downloadChart:Tle,openChartToolPanel:Ale,closeChartToolPanel:Ple,createRangeChart:Rle,createPivotChart:Mle,createCrossFilterChart:Ile,updateChart:Ele,restoreChart:Dle},Du=[Kn,$,lte,ate,rn],Py="IntegratedCharts",Ble={moduleName:"GridCharts",version:G,dependsOn:Du,validate:()=>({isValid:!1,message:`AG Grid: As of v33, the "GridChartsModule" has been deprecated. Please use "IntegratedChartsModule.with(...)" instead.
${fb(257)}`})},Ry={moduleName:Py,version:G,dependsOn:Du,validate:()=>({isValid:!1,message:fb(257)}),with:e=>{if(e.setup(),e.setGridContext?.(!0),e.isEnterprise&&e.setLicenseKey){const t={setLicenseKey:e.setLicenseKey};ei.setChartsLicenseManager(t)}return{moduleName:Py,version:G,icons:Ole,apiFunctions:Nle,dependsOn:Du,css:[Lle],validate:()=>Gle({gridVersion:G,chartsVersion:e.VERSION}),beans:[ute.bind(null,e),yle,rie,qse,Kse,tie,fse,Ose]}}};import{AllCommunityModule as Vle}from"ag-grid-community";var My=[Vle,vv,qp,Eg,tm,Dv,Lv,Ov,tl,sl,Kn,ng,lc,sc,cv,uv,FC,TC,qc,PS,IS,gg,om,$h,Fi,Sg,Mg,pv,lC,WS,dC,qS,XS,db,gb,Zh],Iy="AllEnterprise",Hle={with:e=>({moduleName:Iy,version:G,dependsOn:[...My,Ry.with(e),kS.with(e)]}),moduleName:Iy,version:G,dependsOn:My};export*from"ag-grid-community";export{$h as AdvancedFilterModule,$l as AggregationModule,Zh as AiToolkitModule,Hle as AllEnterpriseModule,XS as BatchEditModule,db as CalculatedColumnsModule,Kn as CellSelectionModule,vv as ClipboardModule,IS as ColumnHeaderEditModule,tl as ColumnMenuModule,qp as ColumnsToolPanelModule,sl as ContextMenuModule,Eg as ExcelExportModule,Dv as FiltersToolPanelModule,qS as FindModule,qc as FormulaModule,Ble as GridChartsModule,uv as GroupFilterModule,Ry as IntegratedChartsModule,ko as LicenseManager,Ov as MasterDetailModule,JV as MenuModule,om as MultiFilterModule,Lv as NewFiltersToolPanelModule,PS as NotesModule,tm as PdfExportModule,lC as PivotModule,A9 as RangeSelectionModule,ng as RichSelectModule,gb as RowGroupingEditModule,sc as RowGroupingModule,cv as RowGroupingPanelModule,lc as RowNumbersModule,TC as ServerSideRowModelApiModule,FC as ServerSideRowModelModule,gg as SetFilterModule,WS as ShowValuesAsModule,Fi as SideBarModule,kS as SparklinesModule,Sg as StatusBarModule,Mg as ToolbarModule,dC as TreeDataModule,pv as ViewportRowModelModule,Xo as _AgColorPicker,kI as _AgColorPickerSelector,Pd as _AgContextMenuService,qo as _AgDialog,it as _AgGroupComponent,J as _AgGroupComponentSelector,fd as _AgInputRange,md as _AgInputRangeSelector,li as _AgMenuItemComponent,Rd as _AgMenuItemRenderer,kr as _AgMenuList,Yo as _AgPanel,ye as _AgSlider,Te as _AgSliderSelector,Qo as _AgTabbedLayout,hd as _AgVirtualList,gd as _AgVirtualListDragFeature,hb as distributeGroupValue,KM as exportMultipleSheetsAsExcel,$o as getMultipleSheetsAsExcel};