ag-grid-enterprise 32.3.2 → 32.3.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,6 +1,6 @@
1
- var Yo=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Au=Object.getOwnPropertyNames,Ru=Object.prototype.hasOwnProperty,qo=(e,t)=>{for(var s in t)Yo(e,s,{get:t[s],enumerable:!0})},Xo=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Au(t))!Ru.call(e,r)&&r!==s&&Yo(e,r,{get:()=>t[r],enumerable:!(i=Fu(t,r))||i.enumerable});return e},Zo=(e,t,s)=>(Xo(e,t,"default"),s&&Xo(s,t,"default")),Jo={};qo(Jo,{AdvancedFilterModule:()=>cr,AgDialog:()=>Ze,AgGroupComponent:()=>pe,AgGroupComponentSelector:()=>G,AgMenuItemComponent:()=>Et,AgMenuItemRenderer:()=>ke,AgMenuList:()=>Je,AgMenuPanel:()=>ji,AgPanel:()=>Ls,AgPrimaryCols:()=>Ci,AgRichSelect:()=>Rt,ClipboardModule:()=>ra,ColumnsToolPanelModule:()=>Ma,EnterpriseCoreModule:()=>H,ExcelExportModule:()=>Va,FiltersToolPanelModule:()=>Wa,GridChartsModule:()=>hi,GroupCellRenderer:()=>ht,GroupCellRendererCtrl:()=>Lt,LicenseManager:()=>Hi,MasterDetailModule:()=>qa,MenuModule:()=>so,MultiFilter:()=>ms,MultiFilterModule:()=>oo,PillDragComp:()=>Es,PillDropZonePanel:()=>Is,PivotDropZonePanel:()=>ts,RangeSelectionModule:()=>$s,RichSelectModule:()=>no,RowGroupDropZonePanel:()=>ss,RowGroupingModule:()=>gi,ServerSideRowModelModule:()=>xo,SetFilter:()=>Li,SetFilterModule:()=>Do,SideBarModule:()=>as,SparklinesModule:()=>Oo,StatusBarModule:()=>Ho,TabbedLayout:()=>Os,ToolPanelColDefService:()=>fa,ValuesDropZonePanel:()=>mi,ViewportRowModelModule:()=>zo,VirtualList:()=>Ge,VirtualListDragFeature:()=>ks,agCharts:()=>Jr,exportMultipleSheetsAsExcel:()=>Ba,getMultipleSheetsAsExcel:()=>Pi});import{ClientSideRowModelModule as Eu}from"ag-grid-community";import{CommunityFeaturesModule as Iu,ModuleRegistry as Du}from"ag-grid-community";import{CsvExportModule as Lu}from"ag-grid-community";import{InfiniteRowModelModule as ku}from"ag-grid-community";import{ModuleNames as Vi,_FilterCoreModule as Gu,_defineModule as _i}from"ag-grid-community";import{ModuleNames as Ou,_defineModule as Bu}from"ag-grid-community";import{BeanStub as Nu,_getDocument as Vu}from"ag-grid-community";import{_missingOrEmpty as Ui}from"ag-grid-community";var _u=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],a=e[3];s=this.ff(s,i,r,a,t[0],7,-680876936),a=this.ff(a,s,i,r,t[1],12,-389564586),r=this.ff(r,a,s,i,t[2],17,606105819),i=this.ff(i,r,a,s,t[3],22,-1044525330),s=this.ff(s,i,r,a,t[4],7,-176418897),a=this.ff(a,s,i,r,t[5],12,1200080426),r=this.ff(r,a,s,i,t[6],17,-1473231341),i=this.ff(i,r,a,s,t[7],22,-45705983),s=this.ff(s,i,r,a,t[8],7,1770035416),a=this.ff(a,s,i,r,t[9],12,-1958414417),r=this.ff(r,a,s,i,t[10],17,-42063),i=this.ff(i,r,a,s,t[11],22,-1990404162),s=this.ff(s,i,r,a,t[12],7,1804603682),a=this.ff(a,s,i,r,t[13],12,-40341101),r=this.ff(r,a,s,i,t[14],17,-1502002290),i=this.ff(i,r,a,s,t[15],22,1236535329),s=this.gg(s,i,r,a,t[1],5,-165796510),a=this.gg(a,s,i,r,t[6],9,-1069501632),r=this.gg(r,a,s,i,t[11],14,643717713),i=this.gg(i,r,a,s,t[0],20,-373897302),s=this.gg(s,i,r,a,t[5],5,-701558691),a=this.gg(a,s,i,r,t[10],9,38016083),r=this.gg(r,a,s,i,t[15],14,-660478335),i=this.gg(i,r,a,s,t[4],20,-405537848),s=this.gg(s,i,r,a,t[9],5,568446438),a=this.gg(a,s,i,r,t[14],9,-1019803690),r=this.gg(r,a,s,i,t[3],14,-187363961),i=this.gg(i,r,a,s,t[8],20,1163531501),s=this.gg(s,i,r,a,t[13],5,-1444681467),a=this.gg(a,s,i,r,t[2],9,-51403784),r=this.gg(r,a,s,i,t[7],14,1735328473),i=this.gg(i,r,a,s,t[12],20,-1926607734),s=this.hh(s,i,r,a,t[5],4,-378558),a=this.hh(a,s,i,r,t[8],11,-2022574463),r=this.hh(r,a,s,i,t[11],16,1839030562),i=this.hh(i,r,a,s,t[14],23,-35309556),s=this.hh(s,i,r,a,t[1],4,-1530992060),a=this.hh(a,s,i,r,t[4],11,1272893353),r=this.hh(r,a,s,i,t[7],16,-155497632),i=this.hh(i,r,a,s,t[10],23,-1094730640),s=this.hh(s,i,r,a,t[13],4,681279174),a=this.hh(a,s,i,r,t[0],11,-358537222),r=this.hh(r,a,s,i,t[3],16,-722521979),i=this.hh(i,r,a,s,t[6],23,76029189),s=this.hh(s,i,r,a,t[9],4,-640364487),a=this.hh(a,s,i,r,t[12],11,-421815835),r=this.hh(r,a,s,i,t[15],16,530742520),i=this.hh(i,r,a,s,t[2],23,-995338651),s=this.ii(s,i,r,a,t[0],6,-198630844),a=this.ii(a,s,i,r,t[7],10,1126891415),r=this.ii(r,a,s,i,t[14],15,-1416354905),i=this.ii(i,r,a,s,t[5],21,-57434055),s=this.ii(s,i,r,a,t[12],6,1700485571),a=this.ii(a,s,i,r,t[3],10,-1894986606),r=this.ii(r,a,s,i,t[10],15,-1051523),i=this.ii(i,r,a,s,t[1],21,-2054922799),s=this.ii(s,i,r,a,t[8],6,1873313359),a=this.ii(a,s,i,r,t[15],10,-30611744),r=this.ii(r,a,s,i,t[6],15,-1560198380),i=this.ii(i,r,a,s,t[13],21,1309151649),s=this.ii(s,i,r,a,t[4],6,-145523070),a=this.ii(a,s,i,r,t[11],10,-1120210379),r=this.ii(r,a,s,i,t[2],15,718787259),i=this.ii(i,r,a,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(a,e[3])}cmn(e,t,s,i,r,a){return t=this.add32(this.add32(t,e),this.add32(i,a)),this.add32(t<<r|t>>>32-r,s)}ff(e,t,s,i,r,a,o){return this.cmn(t&s|~t&i,e,t,r,a,o)}gg(e,t,s,i,r,a,o){return this.cmn(t&i|s&~i,e,t,r,a,o)}hh(e,t,s,i,r,a,o){return this.cmn(t^s^i,e,t,r,a,o)}ii(e,t,s,i,r,a,o){return this.cmn(s^(t|~i),e,t,r,a,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}},Ts={"01":"GRID","02":"CHARTS","0102":"BOTH"},Qo="https://ag-grid.com/licensing/",en=class ae{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new _u,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(ae.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=ae.getGridReleaseDate(),a=ae.formatDate(r);this.outputExpiredKey(t.expiry,a,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(ae.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),a=s.substring(0,i),[o,n,l]=ae.extractBracketedInformation(s);return{md5:r,license:a,version:o,isTrial:n,type:l}}getLicenseDetails(t){const s=ae.chartsLicenseManager?"BOTH":"GRID";if(Ui(t))return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const i=ae.getGridReleaseDate(),{md5:r,license:a,version:o,isTrial:n,type:l}=ae.extractLicenseComponents(t);let c=r===this.md5.md5(a)&&t.indexOf("For_Trialing_ag-Grid_Only")===-1,h,d,u=null,p=!1,g;function m(){h=u<new Date,d=void 0}if(c&&(u=ae.extractExpiry(a),c=!isNaN(u.getTime()),c))switch(d=i>u,o){case"legacy":case"2":{n&&m();break}case"3":Ui(l)?c=!1:(g=l,l!==Ts["01"]&&l!==Ts["0102"]||s==="BOTH"&&g!=="BOTH"?(c=!1,p=!0):n&&m())}return c?{licenseKey:t,valid:c,expiry:ae.formatDate(u),expired:d,version:o,isTrial:n,trialExpired:h,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}:{licenseKey:t,valid:c,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!Ui(this.watermarkMessage)}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.indexOf("forceWatermark")!==-1:!1}isWebsiteUrl(){return this.getHostname().match(/^((?:[\w-]+\.)?ag-grid\.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(),a=t.getFullYear();return i+" "+s[r]+" "+a}static getGridReleaseDate(){return new Date(parseInt(ae.decode(ae.RELEASE_INFORMATION),10))}static decode(t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i="",r,a,o,n,l,c,h,d=0;const u=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;d<u.length;)n=s.indexOf(u.charAt(d++)),l=s.indexOf(u.charAt(d++)),c=s.indexOf(u.charAt(d++)),h=s.indexOf(u.charAt(d++)),r=n<<2|l>>4,a=(l&15)<<4|c>>2,o=(c&3)<<6|h,i=i+String.fromCharCode(r),c!=64&&(i=i+String.fromCharCode(a)),h!=64&&(i=i+String.fromCharCode(o));return i=ae.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}static setLicenseKey(t){this.licenseKey=t,this.chartsLicenseManager&&this.chartsLicenseManager.setLicenseKey(t,!0)}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const s=t.match(/\[(.*?)\]/g).map(n=>n.replace("[","").replace("]",""));if(!s||s.length===0)return["legacy",!1,void 0];const i=s.filter(n=>n==="TRIAL").length===1,r=s.filter(n=>n.indexOf("v")===0)[0],a=r?r.replace("v",""):"legacy",o=Ts[s.filter(n=>Ts[n])[0]];return[a,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 ${Qo}.`," ","*"),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 ${Qo}.`," ","*"),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 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"}};en.RELEASE_INFORMATION="MTczMDI4MjY0MzYwNg==";var Ms=en;import{Component as Uu,RefPlaceholder as Hu}from"ag-grid-community";var zu=class extends Uu{constructor(){super(`<div class="ag-watermark">
1
+ var Yo=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Au=Object.getOwnPropertyNames,Ru=Object.prototype.hasOwnProperty,qo=(e,t)=>{for(var s in t)Yo(e,s,{get:t[s],enumerable:!0})},Xo=(e,t,s,i)=>{if(t&&typeof t=="object"||typeof t=="function")for(let r of Au(t))!Ru.call(e,r)&&r!==s&&Yo(e,r,{get:()=>t[r],enumerable:!(i=Fu(t,r))||i.enumerable});return e},Zo=(e,t,s)=>(Xo(e,t,"default"),s&&Xo(s,t,"default")),Jo={};qo(Jo,{AdvancedFilterModule:()=>cr,AgDialog:()=>Ze,AgGroupComponent:()=>pe,AgGroupComponentSelector:()=>G,AgMenuItemComponent:()=>Et,AgMenuItemRenderer:()=>ke,AgMenuList:()=>Je,AgMenuPanel:()=>ji,AgPanel:()=>Ls,AgPrimaryCols:()=>Ci,AgRichSelect:()=>Rt,ClipboardModule:()=>ra,ColumnsToolPanelModule:()=>Ma,EnterpriseCoreModule:()=>H,ExcelExportModule:()=>Va,FiltersToolPanelModule:()=>Wa,GridChartsModule:()=>hi,GroupCellRenderer:()=>ht,GroupCellRendererCtrl:()=>Lt,LicenseManager:()=>Hi,MasterDetailModule:()=>qa,MenuModule:()=>so,MultiFilter:()=>ms,MultiFilterModule:()=>oo,PillDragComp:()=>Es,PillDropZonePanel:()=>Is,PivotDropZonePanel:()=>ts,RangeSelectionModule:()=>$s,RichSelectModule:()=>no,RowGroupDropZonePanel:()=>ss,RowGroupingModule:()=>gi,ServerSideRowModelModule:()=>xo,SetFilter:()=>Li,SetFilterModule:()=>Do,SideBarModule:()=>as,SparklinesModule:()=>Oo,StatusBarModule:()=>Ho,TabbedLayout:()=>Os,ToolPanelColDefService:()=>fa,ValuesDropZonePanel:()=>mi,ViewportRowModelModule:()=>zo,VirtualList:()=>Ge,VirtualListDragFeature:()=>ks,agCharts:()=>Jr,exportMultipleSheetsAsExcel:()=>Ba,getMultipleSheetsAsExcel:()=>Pi});import{ClientSideRowModelModule as Eu}from"ag-grid-community";import{CommunityFeaturesModule as Iu,ModuleRegistry as Du}from"ag-grid-community";import{CsvExportModule as Lu}from"ag-grid-community";import{InfiniteRowModelModule as ku}from"ag-grid-community";import{ModuleNames as Vi,_FilterCoreModule as Gu,_defineModule as _i}from"ag-grid-community";import{ModuleNames as Ou,_defineModule as Bu}from"ag-grid-community";import{BeanStub as Nu,_getDocument as Vu}from"ag-grid-community";import{_missingOrEmpty as Ui}from"ag-grid-community";var _u=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],a=e[3];s=this.ff(s,i,r,a,t[0],7,-680876936),a=this.ff(a,s,i,r,t[1],12,-389564586),r=this.ff(r,a,s,i,t[2],17,606105819),i=this.ff(i,r,a,s,t[3],22,-1044525330),s=this.ff(s,i,r,a,t[4],7,-176418897),a=this.ff(a,s,i,r,t[5],12,1200080426),r=this.ff(r,a,s,i,t[6],17,-1473231341),i=this.ff(i,r,a,s,t[7],22,-45705983),s=this.ff(s,i,r,a,t[8],7,1770035416),a=this.ff(a,s,i,r,t[9],12,-1958414417),r=this.ff(r,a,s,i,t[10],17,-42063),i=this.ff(i,r,a,s,t[11],22,-1990404162),s=this.ff(s,i,r,a,t[12],7,1804603682),a=this.ff(a,s,i,r,t[13],12,-40341101),r=this.ff(r,a,s,i,t[14],17,-1502002290),i=this.ff(i,r,a,s,t[15],22,1236535329),s=this.gg(s,i,r,a,t[1],5,-165796510),a=this.gg(a,s,i,r,t[6],9,-1069501632),r=this.gg(r,a,s,i,t[11],14,643717713),i=this.gg(i,r,a,s,t[0],20,-373897302),s=this.gg(s,i,r,a,t[5],5,-701558691),a=this.gg(a,s,i,r,t[10],9,38016083),r=this.gg(r,a,s,i,t[15],14,-660478335),i=this.gg(i,r,a,s,t[4],20,-405537848),s=this.gg(s,i,r,a,t[9],5,568446438),a=this.gg(a,s,i,r,t[14],9,-1019803690),r=this.gg(r,a,s,i,t[3],14,-187363961),i=this.gg(i,r,a,s,t[8],20,1163531501),s=this.gg(s,i,r,a,t[13],5,-1444681467),a=this.gg(a,s,i,r,t[2],9,-51403784),r=this.gg(r,a,s,i,t[7],14,1735328473),i=this.gg(i,r,a,s,t[12],20,-1926607734),s=this.hh(s,i,r,a,t[5],4,-378558),a=this.hh(a,s,i,r,t[8],11,-2022574463),r=this.hh(r,a,s,i,t[11],16,1839030562),i=this.hh(i,r,a,s,t[14],23,-35309556),s=this.hh(s,i,r,a,t[1],4,-1530992060),a=this.hh(a,s,i,r,t[4],11,1272893353),r=this.hh(r,a,s,i,t[7],16,-155497632),i=this.hh(i,r,a,s,t[10],23,-1094730640),s=this.hh(s,i,r,a,t[13],4,681279174),a=this.hh(a,s,i,r,t[0],11,-358537222),r=this.hh(r,a,s,i,t[3],16,-722521979),i=this.hh(i,r,a,s,t[6],23,76029189),s=this.hh(s,i,r,a,t[9],4,-640364487),a=this.hh(a,s,i,r,t[12],11,-421815835),r=this.hh(r,a,s,i,t[15],16,530742520),i=this.hh(i,r,a,s,t[2],23,-995338651),s=this.ii(s,i,r,a,t[0],6,-198630844),a=this.ii(a,s,i,r,t[7],10,1126891415),r=this.ii(r,a,s,i,t[14],15,-1416354905),i=this.ii(i,r,a,s,t[5],21,-57434055),s=this.ii(s,i,r,a,t[12],6,1700485571),a=this.ii(a,s,i,r,t[3],10,-1894986606),r=this.ii(r,a,s,i,t[10],15,-1051523),i=this.ii(i,r,a,s,t[1],21,-2054922799),s=this.ii(s,i,r,a,t[8],6,1873313359),a=this.ii(a,s,i,r,t[15],10,-30611744),r=this.ii(r,a,s,i,t[6],15,-1560198380),i=this.ii(i,r,a,s,t[13],21,1309151649),s=this.ii(s,i,r,a,t[4],6,-145523070),a=this.ii(a,s,i,r,t[11],10,-1120210379),r=this.ii(r,a,s,i,t[2],15,718787259),i=this.ii(i,r,a,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(a,e[3])}cmn(e,t,s,i,r,a){return t=this.add32(this.add32(t,e),this.add32(i,a)),this.add32(t<<r|t>>>32-r,s)}ff(e,t,s,i,r,a,o){return this.cmn(t&s|~t&i,e,t,r,a,o)}gg(e,t,s,i,r,a,o){return this.cmn(t&i|s&~i,e,t,r,a,o)}hh(e,t,s,i,r,a,o){return this.cmn(t^s^i,e,t,r,a,o)}ii(e,t,s,i,r,a,o){return this.cmn(s^(t|~i),e,t,r,a,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}},Ts={"01":"GRID","02":"CHARTS","0102":"BOTH"},Qo="https://ag-grid.com/licensing/",en=class ae{constructor(t){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=t,this.md5=new _u,this.md5.init()}validateLicense(){const t=this.getLicenseDetails(ae.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=ae.getGridReleaseDate(),a=ae.formatDate(r);this.outputExpiredKey(t.expiry,a,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(ae.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),a=s.substring(0,i),[o,n,l]=ae.extractBracketedInformation(s);return{md5:r,license:a,version:o,isTrial:n,type:l}}getLicenseDetails(t){const s=ae.chartsLicenseManager?"BOTH":"GRID";if(Ui(t))return{licenseKey:t,valid:!1,missing:!0,currentLicenseType:s};const i=ae.getGridReleaseDate(),{md5:r,license:a,version:o,isTrial:n,type:l}=ae.extractLicenseComponents(t);let c=r===this.md5.md5(a)&&t.indexOf("For_Trialing_ag-Grid_Only")===-1,h,d,u=null,p=!1,g;function m(){h=u<new Date,d=void 0}if(c&&(u=ae.extractExpiry(a),c=!isNaN(u.getTime()),c))switch(d=i>u,o){case"legacy":case"2":{n&&m();break}case"3":Ui(l)?c=!1:(g=l,l!==Ts["01"]&&l!==Ts["0102"]||s==="BOTH"&&g!=="BOTH"?(c=!1,p=!0):n&&m())}return c?{licenseKey:t,valid:c,expiry:ae.formatDate(u),expired:d,version:o,isTrial:n,trialExpired:h,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}:{licenseKey:t,valid:c,incorrectLicenseType:p,currentLicenseType:s,suppliedLicenseType:g}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!Ui(this.watermarkMessage)}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.indexOf("forceWatermark")!==-1:!1}isWebsiteUrl(){return this.getHostname().match(/^((?:[\w-]+\.)?ag-grid\.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(),a=t.getFullYear();return i+" "+s[r]+" "+a}static getGridReleaseDate(){return new Date(parseInt(ae.decode(ae.RELEASE_INFORMATION),10))}static decode(t){const s="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/=";let i="",r,a,o,n,l,c,h,d=0;const u=t.replace(/[^A-Za-z0-9+/=]/g,"");for(;d<u.length;)n=s.indexOf(u.charAt(d++)),l=s.indexOf(u.charAt(d++)),c=s.indexOf(u.charAt(d++)),h=s.indexOf(u.charAt(d++)),r=n<<2|l>>4,a=(l&15)<<4|c>>2,o=(c&3)<<6|h,i=i+String.fromCharCode(r),c!=64&&(i=i+String.fromCharCode(a)),h!=64&&(i=i+String.fromCharCode(o));return i=ae.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}static setLicenseKey(t){this.licenseKey=t,this.chartsLicenseManager&&this.chartsLicenseManager.setLicenseKey(t,!0)}static extractBracketedInformation(t){if(!t.includes("["))return["legacy",!1,void 0];const s=t.match(/\[(.*?)\]/g).map(n=>n.replace("[","").replace("]",""));if(!s||s.length===0)return["legacy",!1,void 0];const i=s.filter(n=>n==="TRIAL").length===1,r=s.filter(n=>n.indexOf("v")===0)[0],a=r?r.replace("v",""):"legacy",o=Ts[s.filter(n=>Ts[n])[0]];return[a,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 ${Qo}.`," ","*"),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 ${Qo}.`," ","*"),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 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"}};en.RELEASE_INFORMATION="MTczMTQzMDQwMzMxOQ==";var Ms=en;import{Component as Uu,RefPlaceholder as Hu}from"ag-grid-community";var zu=class extends Uu{constructor(){super(`<div class="ag-watermark">
2
2
  <div data-ref="eLicenseTextRef" class="ag-watermark-text"></div>
3
- </div>`),this.eLicenseTextRef=Hu}wireBeans(e){this.licenseManager=e.licenseManager}postConstruct(){const e=this.shouldDisplayWatermark();this.setDisplayed(e),e&&(this.eLicenseTextRef.innerText=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCssClass("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5e3))}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},Wu={selector:"AG-WATERMARK",component:zu},Hi=class extends Nu{constructor(){super(...arguments),this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){this.licenseManager=new Ms(Vu(this.gos)),this.licenseManager.validateLicense()}static getLicenseDetails(e){return new Ms(null).getLicenseDetails(e)}getWatermarkSelector(){return Wu}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(e){Ms.setLicenseKey(e)}static setChartsLicenseManager(e){Ms.setChartsLicenseManager(e)}},Ku="32.3.2";import{Component as $u,_createIconNoSpan as tn,_isNodeOrElement as ju,_loadTemplate as Fs,_setAriaExpanded as Yu,_warnOnce as qu}from"ag-grid-community";var ke=class extends $u{constructor(){super(),this.setTemplate("<div></div>")}init(e){this.params=e,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addIcon(){if(this.params.isCompact)return;const e=Fs(`<span data-ref="eIcon" class="${this.getClassName("part")} ${this.getClassName("icon")}" role="presentation"></span>`),{checked:t,icon:s}=this.params;t?e.appendChild(tn("check",this.gos)):s&&(ju(s)?e.appendChild(s):typeof s=="string"?e.innerHTML=s:qu("menu item icon must be DOM node or string")),this.getGui().appendChild(e)}addName(){const e=Fs(`<span data-ref="eName" class="${this.getClassName("part")} ${this.getClassName("text")}">${this.params.name||""}</span>`);this.getGui().appendChild(e)}addShortcut(){if(this.params.isCompact)return;const e=Fs(`<span data-ref="eShortcut" class="${this.getClassName("part")} ${this.getClassName("shortcut")}">${this.params.shortcut||""}</span>`);this.getGui().appendChild(e)}addSubMenu(){const e=Fs(`<span data-ref="ePopupPointer" class="${this.getClassName("part")} ${this.getClassName("popup-pointer")}"></span>`),t=this.getGui();if(this.params.subMenu){const s=this.gos.get("enableRtl")?"smallLeft":"smallRight";Yu(t,!1),e.appendChild(tn(s,this.gos))}t.appendChild(e)}getClassName(e){return`${this.cssClassPrefix}-${e}`}destroy(){super.destroy()}},H=Bu({version:Ku,moduleName:Ou.EnterpriseCoreModule,beans:[Hi],userComponents:[{name:"agMenuItem",classImp:ke}]});import{AgCheckboxSelector as Xu,AgToggleButton as Zu,Component as As,KeyCode as Ft,RefPlaceholder as nt,_createIcon as sn,_setAriaExpanded as Ju,_setDisplayed as Xe}from"ag-grid-community";function Qu(e){const t=e.cssIdentifier||"default",s=e.direction||"vertical";return`
3
+ </div>`),this.eLicenseTextRef=Hu}wireBeans(e){this.licenseManager=e.licenseManager}postConstruct(){const e=this.shouldDisplayWatermark();this.setDisplayed(e),e&&(this.eLicenseTextRef.innerText=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCssClass("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5e3))}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},Wu={selector:"AG-WATERMARK",component:zu},Hi=class extends Nu{constructor(){super(...arguments),this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){this.licenseManager=new Ms(Vu(this.gos)),this.licenseManager.validateLicense()}static getLicenseDetails(e){return new Ms(null).getLicenseDetails(e)}getWatermarkSelector(){return Wu}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey(e){Ms.setLicenseKey(e)}static setChartsLicenseManager(e){Ms.setChartsLicenseManager(e)}},Ku="32.3.3";import{Component as $u,_createIconNoSpan as tn,_isNodeOrElement as ju,_loadTemplate as Fs,_setAriaExpanded as Yu,_warnOnce as qu}from"ag-grid-community";var ke=class extends $u{constructor(){super(),this.setTemplate("<div></div>")}init(e){this.params=e,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addIcon(){if(this.params.isCompact)return;const e=Fs(`<span data-ref="eIcon" class="${this.getClassName("part")} ${this.getClassName("icon")}" role="presentation"></span>`),{checked:t,icon:s}=this.params;t?e.appendChild(tn("check",this.gos)):s&&(ju(s)?e.appendChild(s):typeof s=="string"?e.innerHTML=s:qu("menu item icon must be DOM node or string")),this.getGui().appendChild(e)}addName(){const e=Fs(`<span data-ref="eName" class="${this.getClassName("part")} ${this.getClassName("text")}">${this.params.name||""}</span>`);this.getGui().appendChild(e)}addShortcut(){if(this.params.isCompact)return;const e=Fs(`<span data-ref="eShortcut" class="${this.getClassName("part")} ${this.getClassName("shortcut")}">${this.params.shortcut||""}</span>`);this.getGui().appendChild(e)}addSubMenu(){const e=Fs(`<span data-ref="ePopupPointer" class="${this.getClassName("part")} ${this.getClassName("popup-pointer")}"></span>`),t=this.getGui();if(this.params.subMenu){const s=this.gos.get("enableRtl")?"smallLeft":"smallRight";Yu(t,!1),e.appendChild(tn(s,this.gos))}t.appendChild(e)}getClassName(e){return`${this.cssClassPrefix}-${e}`}destroy(){super.destroy()}},H=Bu({version:Ku,moduleName:Ou.EnterpriseCoreModule,beans:[Hi],userComponents:[{name:"agMenuItem",classImp:ke}]});import{AgCheckboxSelector as Xu,AgToggleButton as Zu,Component as As,KeyCode as Ft,RefPlaceholder as nt,_createIcon as sn,_setAriaExpanded as Ju,_setDisplayed as Xe}from"ag-grid-community";function Qu(e){const t=e.cssIdentifier||"default",s=e.direction||"vertical";return`
4
4
  <div class="ag-group ag-${t}-group" role="presentation">
5
5
  <div data-ref="eToolbar" class="ag-group-toolbar ag-${t}-group-toolbar">
6
6
  <ag-checkbox data-ref="cbGroupEnabled"></ag-checkbox>
@@ -132,7 +132,7 @@ var Yo=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Au=Object.getOwn
132
132
  <button class="ag-button ag-standard-button ag-advanced-filter-builder-apply-button" data-ref="eApplyFilterButton"></button>
133
133
  <button class="ag-button ag-standard-button ag-advanced-filter-builder-cancel-button" data-ref="eCancelFilterButton"></button>
134
134
  </div>
135
- </div>`),this.eList=Zi,this.eApplyFilterButton=Zi,this.eCancelFilterButton=Zi,this.validationMessage=null}wireBeans(e){this.filterManager=e.filterManager,this.advancedFilterService=e.advancedFilterService,this.advancedFilterExpressionService=e.advancedFilterExpressionService}postConstruct(){const{showMoveButtons:e}=this.gos.get("advancedFilterBuilderParams")??{};this.showMove=!!e,this.addManagedPropertyListener("advancedFilterBuilderParams",({currentValue:t})=>{this.showMove=!!t?.showMoveButtons,this.refreshList(!1)}),this.filterModel=this.setupFilterModel(),this.setupVirtualList(),this.dragFeature=this.createManagedBean(new Ef(this,this.virtualList)),this.setupButtons()}refresh(){let e=this.virtualList.getLastFocusedRow();this.setupFilterModel(),this.validateItems(),this.refreshList(!1),e!=null&&(this.virtualList.getComponentAt(e)||(e=0),this.virtualList.focusRow(e))}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(){this.virtualList=this.createManagedBean(new Ge({cssIdentifier:"advanced-filter-builder",ariaRole:"tree",listName:this.advancedFilterExpressionService.translate("ariaAdvancedFilterBuilderList")})),this.virtualList.setComponentCreator(this.createItemComponent.bind(this)),this.virtualList.setComponentUpdater(this.updateItemComponent.bind(this)),this.virtualList.setRowHeight(40),this.eList.appendChild(this.virtualList.getGui()),this.virtualList.setModel({getRowCount:()=>this.items.length,getRow:e=>this.items[e],areRowsEqual:(e,t)=>e===t}),this.buildList(),this.virtualList.refresh()}setupButtons(){this.eApplyFilterButton.innerText=this.advancedFilterExpressionService.translate("advancedFilterBuilderApply"),this.activateTabIndex([this.eApplyFilterButton]),this.addManagedElementListeners(this.eApplyFilterButton,{click:()=>{this.advancedFilterService.setModel(this.filterModel),this.filterManager?.onFilterChanged({source:"advancedFilter"}),this.close()}}),this.validationTooltipFeature=this.createManagedBean(new Im({getGui:()=>this.eApplyFilterButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.validationMessage,getTooltipShowDelayOverride:()=>1e3})),this.validate();const e=t=>this.addOrRemoveCssClass("ag-advanced-filter-builder-validation",t);this.addManagedListeners(this.eApplyFilterButton,{mouseenter:()=>e(!0),mouseleave:()=>e(!1)}),this.eCancelFilterButton.innerText=this.advancedFilterExpressionService.translate("advancedFilterBuilderCancel"),this.activateTabIndex([this.eCancelFilterButton]),this.addManagedElementListeners(this.eCancelFilterButton,{click:()=>this.close()})}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",a=r?i.filterModel:i.parent;if(!a||this.isChildOrSelf(a,e.filterModel)||i===e)return;this.removeItemFromParent(e);let o;r?o=0:(o=a.conditions.indexOf(i.filterModel),o===-1?o=a.conditions.length:s==="bottom"&&(o+=1)),a.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.advancedFilterService.getModel());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)=>{s.push({filterModel:t,level:i,parent:r,valid:!0,showMove:this.showMove}),t.filterType==="join"&&(t.conditions.forEach(a=>e(a,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=[];this.items.forEach(s=>{s.valid||t.push(s.filterModel)}),this.buildList(),t.length&&this.items.forEach(s=>{s.filterModel&&t.includes(s.filterModel)&&(s.valid=!1)})}this.virtualList.refresh(e),this.validate()}updateItemComponent(e,t){const s=this.items.indexOf(e),i=(n,l)=>{const h=this.items.find(d=>d.filterModel===n)?.parent;if(h){const{conditions:d}=h;i(h,l),l.push(d[d.length-1]===n)}},r=[],{filterModel:a}=e;a&&(i(a,r),r[0]=!1);const o=a?.filterType==="join"&&!!a.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 nr(e,this.dragFeature,t):new If(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 nr&&this.updateItemComponent(e,s),s}addItem(e,t){const{parent:s,level:i,filterModel:r}=e,a=r?.filterType==="join",o=t?{filterType:"join",type:"AND",conditions:[]}:{},n=a?r:s;let l=a?0:n.conditions.indexOf(r);l>=0?(a||(l+=1),n.conditions.splice(l,0,o)):n.conditions.push(o);let c=this.items.indexOf(e);const h=c>=0;if(h){e.filterModel&&c++;const d=[{filterModel:o,level:a?i+1:i,parent:n,valid:t,showMove:this.showMove}];this.items.splice(c,0,...d)}this.refreshList(h),h&&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",a=this.items.indexOf(e),o=!r&&a>=0;o&&this.items.splice(a,1),this.refreshList(o),a>=0&&this.virtualList.focusRow(a)}moveItemUpDown(e,t){const s=this.items.indexOf(e),i=t?s-1:s+1;if(i===0||!t&&!this.canMoveDown(e,s))return;const r=this.items[i],a=this.removeItemFromParent(e),{level:o,filterModel:n,parent:l}=e,{level:c,filterModel:h,parent:d}=r;if(t)if(c===o&&h.filterType==="join")h.conditions.push(n);else if(c<=o){const p=d.conditions.indexOf(h);d.conditions.splice(p,0,n)}else l.conditions[a-1].conditions.push(n);else if(c===o)if(h.filterType==="join")h.conditions.splice(0,0,n);else{const p=d.conditions.indexOf(h);d.conditions.splice(p+1,0,n)}else if(a<l.conditions.length)l.conditions.splice(a+1,0,n);else{const p=this.items.find(m=>m.filterModel===l),g=p.parent.conditions.indexOf(p.filterModel)+1;p.parent.conditions.splice(g,0,n)}this.refreshList(!1);const u=this.items.findIndex(({filterModel:p})=>p===n);if(u>=0){const p=this.virtualList.getComponentAt(u);p instanceof nr&&p.focusMoveButton(t)}}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.advancedFilterService.getCtrl().toggleFilterBuilder({source:"ui"})}validate(){let e=!this.items.every(({valid:t})=>t);e?this.validationMessage=this.advancedFilterExpressionService.translate("advancedFilterBuilderValidationIncomplete"):(e=JSON.stringify(this.filterModel)===this.stringifiedModel,e?this.validationMessage=this.advancedFilterExpressionService.translate("advancedFilterBuilderValidationAlreadyApplied"):this.validationMessage=null),Lm(this.eApplyFilterButton,e),this.validationTooltipFeature.refreshToolTip()}validateItems(){const e=s=>{s.type=void 0},t=s=>{delete s.filter};this.items.forEach(s=>{if(!s.valid||!s.filterModel||s.filterModel.filterType==="join")return;const{filterModel:i}=s,{colId:r}=i,a=this.advancedFilterExpressionService.getColumnAutocompleteEntries().find(({key:c})=>c===r),o=this.advancedFilterExpressionService.getColumnDetails(i.colId);if(!a||!o.column){s.valid=!1,i.colId=void 0,e(i),t(i);return}const l=this.advancedFilterExpressionService.getDataTypeExpressionOperator(o.baseCellDataType).operators[i.type];if(!l){s.valid=!1,e(i),t(i);return}if(l.numOperands>0&&!Dm(i.filter)){s.valid=!1;return}})}},Bf=class extends rm{constructor(e){super(),this.enabled=e}wireBeans(e){this.ctrlsService=e.ctrlsService,this.popupService=e.popupService,this.advancedFilterExpressionService=e.advancedFilterExpressionService,this.environment=e.environment}postConstruct(){this.hasAdvancedFilterParent=!!this.gos.get("advancedFilterParent"),this.ctrlsService.whenReady(this,()=>this.setAdvancedFilterComp()),this.addManagedEventListeners({advancedFilterEnabledChanged:({enabled:e})=>this.onEnabledChanged(e)}),this.addManagedPropertyListener("advancedFilterParent",()=>this.updateComps()),this.addDestroyFunc(()=>{this.destroyAdvancedFilterComp(),this.destroyBean(this.eBuilderComp),this.eBuilderDialog&&this.eBuilderDialog.isAlive()&&this.destroyBean(this.eBuilderDialog)})}setupHeaderComp(e){this.eHeaderComp&&(this.eHeaderComp?.getGui().remove(),this.destroyBean(this.eHeaderComp)),this.eHeaderComp=this.createManagedBean(new Rf(this.enabled&&!this.hasAdvancedFilterParent)),e.insertAdjacentElement("beforebegin",this.eHeaderComp.getGui())}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:a,minWidth:o}=this.getBuilderDialogSize();this.eBuilderComp=this.createBean(new Of),this.eBuilderDialog=this.createBean(new Ze({title:this.advancedFilterExpressionService.translate("advancedFilterBuilderTitle"),component:this.eBuilderComp,width:r,height:a,resizable:!0,movable:!0,maximizable:!0,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.eventService.dispatchEvent({type:"advancedFilterBuilderVisibleChanged",source:e,visible:t})}getBuilderDialogSize(){const e=this.gos.get("advancedFilterBuilderParams")?.minWidth??500,t=this.popupService.getPopupParent(),s=Math.round(om(t))-2,i=Math.round(am(t)*.75)-2,r=Math.min(Math.max(600,e),s),a=Math.min(600,i);return{width:r,height:a,minWidth:e}}onEnabledChanged(e){this.enabled=e,this.updateComps()}updateComps(){this.setAdvancedFilterComp(),this.setHeaderCompEnabled(),this.eventService.dispatchEvent({type:"headerHeightChanged"})}setAdvancedFilterComp(){if(this.destroyAdvancedFilterComp(),!this.enabled)return;const e=this.gos.get("advancedFilterParent");if(this.hasAdvancedFilterParent=!!e,e){const t=this.createBean(new Vn),s=t.getGui();this.environment.applyThemeClasses(s),s.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr"),e.appendChild(s),this.eFilterComp=t}}setHeaderCompEnabled(){this.eHeaderComp?.setEnabled(this.enabled&&!this.hasAdvancedFilterParent)}destroyAdvancedFilterComp(){this.eFilterComp&&(nm(this.eFilterComp.getGui()),this.destroyBean(this.eFilterComp))}},Nf=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],a=this.operatorEndPositions[t];s=sr(r,e,a==null?this.params.expression.length:a+1)}let i=this.params.advancedFilterExpressionService.getJoinOperatorAutocompleteEntries();return(t||t==null&&this.activeOperator)&&(i=i.filter(({key:r})=>r===this.parsedOperator)),this.params.advancedFilterExpressionService.generateAutocompleteListParams(i,"join",s)}updateExpression(e,t,s){let{expression:i}=this.params;const r=t.displayValue??t.key;if(s===0)for(let n=this.operatorEndPositions.length-1;n>0;n--){const l=this.operatorEndPositions[n];l!=null&&(i=Be(i,this.operatorStartPositions[n],l,r).updatedValue)}const a=this.operatorStartPositions.length>s?this.operatorStartPositions[s]:e,o=(this.operatorEndPositions.length>s?this.operatorEndPositions[s]:void 0)??ir(i,e,!0).endPosition;return Be(i,a,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.advancedFilterExpressionService.getExpressionJoinOperators(),i=Hs(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.advancedFilterExpressionService.translate("advancedFilterValidationJoinOperatorMismatch"),startPosition:e-t.length+1,endPosition:e}),!1}else this.parsedOperator=i;return t!==r&&(rr(this.params,t,r,e),this.operators[this.activeOperator]=r),!0}else return i===null?!1:(this.validationError||(this.validationError={message:this.params.advancedFilterExpressionService.translate("advancedFilterValidationInvalidJoinOperator"),startPosition:e-t.length+1,endPosition:e}),!0)}},Vf=class nu{constructor(t,s){this.params=t,this.startPosition=s,this.expectingExpression=!0,this.expectingOperator=!1,this.expressionParsers=[],this.operatorParser=new Nf(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 nu(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 we(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.advancedFilterExpressionService.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.advancedFilterExpressionService.translate(s),startPosition:this.params.expression.length,endPosition:this.params.expression.length}:null}getFunctionString(t){const s=this.expressionParsers.length>1,i=this.expressionParsers.map(r=>r.getFunctionString(t)).join(` ${this.operatorParser.getFunction()} `);return s?`(${i})`:i}getFunctionParsed(t){const s=this.operatorParser.getFunction(),i=this.expressionParsers.map(a=>a.getFunctionParsed(t)),r=s==="&&"?"every":"some";return(a,o,n)=>i[r](l=>l(a,o,n))}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 a=this.operatorParser.getLastOperatorEndPosition();return a==null||t<=a+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,a=this.getExpressionParserIndex(t);if(a==null){const l=i==="column"?this.params.advancedFilterExpressionService.getColumnValue(s):s.displayValue??s.key;return Be(r,this.startPosition,this.startPosition,l,!0)}const n=this.expressionParsers[a].updateExpression(t,s,i);return n??(i==="column"?Be(r,t,r.length-1,this.params.advancedFilterExpressionService.getColumnValue(s),!0):this.endPosition!=null&&t>this.endPosition+1?null:this.operatorParser.updateExpression(t,s,a))}getModel(){return this.expressionParsers.length>1?{filterType:"join",type:this.operatorParser.getModel(),conditions:this.expressionParsers.map(t=>t.getModel())}:this.expressionParsers[0].getModel()}getColumnAutocompleteListParams(){return this.params.advancedFilterExpressionService.generateAutocompleteListParams(this.params.advancedFilterExpressionService.getColumnAutocompleteEntries(),"column","")}getExpressionParserIndex(t){let s;for(let i=0;i<this.expressionParsers.length&&!(this.expressionParsers[i].startPosition>t);i++)s=i;return s}},_f=class{constructor(e){this.params=e,this.valid=!1}parseExpression(){this.joinExpressionParser=new Vf(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}=e;return s<this.params.expression.length?this.params.advancedFilterExpressionService.translate("advancedFilterValidationMessage",[t,this.params.expression.slice(s,i+1).trim()]):this.params.advancedFilterExpressionService.translate("advancedFilterValidationMessageAtEnd",[t])}getFunctionString(){const e=this.createFunctionParams();return{functionString:`return ${this.joinExpressionParser.getFunctionString(e)};`,params:e}}getFunctionParsed(){const e=this.createFunctionParams();return{expressionFunction:this.joinExpressionParser.getFunctionParsed(e),params:e}}getAutocompleteListParams(e){return this.joinExpressionParser.getAutocompleteListParams(e)??{enabled:!1}}updateExpression(e,t,s){return this.joinExpressionParser.updateExpression(e,t,s)}getModel(){return this.isValid()?this.joinExpressionParser.getModel():null}createFunctionParams(){return{operands:[],operators:[],evaluatorParams:[]}}},Uf=class extends Qg{constructor(){super(...arguments),this.beanName="advancedFilterService",this.appliedExpression=null,this.expression=null,this.isValid=!0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.dataTypeService=e.dataTypeService,this.advancedFilterExpressionService=e.advancedFilterExpressionService}postConstruct(){this.setEnabled(this.gos.get("enableAdvancedFilter"),!0),this.ctrl=this.createManagedBean(new Bf(this.enabled)),this.expressionProxy={getValue:(e,t)=>{const s=this.columnModel.getColDefCol(e);return s?this.valueService.getValue(s,t,!0):void 0}},this.addManagedPropertyListener("enableAdvancedFilter",e=>this.setEnabled(!!e.currentValue)),this.addManagedEventListeners({newColumnsLoaded:e=>this.onNewColumnsLoaded(e)}),this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter",()=>this.updateValidity())}isEnabled(){return this.enabled}isFilterPresent(){return!!this.expressionFunction}doesFilterPass(e){return this.expressionFunction(this.expressionProxy,e,this.expressionParams)}getModel(){const e=this.createExpressionParser(this.appliedExpression);return e?.parseExpression(),e?.getModel()??null}setModel(e){const t=(i,r)=>{if(i.filterType==="join"){const a=this.advancedFilterExpressionService.parseJoinOperator(i),o=i.conditions.map(n=>t(n)).filter(n=>em(n)).join(` ${a} `);return r||i.conditions.length<=1?o:`(${o})`}else return this.advancedFilterExpressionService.parseColumnFilterModel(i)},s=e?t(e,!0):null;this.setExpressionDisplayValue(s),this.applyExpression(),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 _f({expression:e,columnModel:this.columnModel,dataTypeService:this.dataTypeService,valueService:this.valueService,advancedFilterExpressionService:this.advancedFilterExpressionService}):null}getDefaultExpression(e){const t=this.advancedFilterExpressionService.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=tm(this.gos)||sm(this.gos);e&&!i&&im("Advanced Filter is only supported with the Client-Side Row Model or Server-Side Row Model."),this.enabled=e&&i,!t&&this.enabled!==s&&this.eventService.dispatchEvent({type:"advancedFilterEnabledChanged",enabled:this.enabled})}applyExpression(){const e=this.createExpressionParser(this.expression);e?.parseExpression(),this.applyExpressionFromParser(e)}applyExpressionFromParser(e){if(this.isValid=!e||e.isValid(),!e||!this.isValid){this.expressionFunction=null,this.expressionParams=null,this.appliedExpression=null;return}const{expressionFunction:t,params:s}=this.getFunction(e);this.expressionFunction=t,this.expressionParams=s,this.appliedExpression=this.expression}getFunction(e){if(this.gos.get("suppressAdvancedFilterEval"))return e.getFunctionParsed();{const{functionString:t,params:s}=e.getFunctionString();return{expressionFunction:new Function("expressionProxy","node","params",t),params:s}}}updateValidity(){this.advancedFilterExpressionService.resetColumnCaches();const e=this.createExpressionParser(this.expression);e?.parseExpression();const s=(!e||e.isValid())!==this.isValid;return this.applyExpressionFromParser(e),this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp(),s}onNewColumnsLoaded(e){if(e.source!=="gridInitializing"||!this.dataTypeService?.isPendingInference())return;this.ctrl.setInputDisabled(!0);const[t]=this.addManagedEventListeners({dataTypesInferred:()=>{t?.(),this.ctrl.setInputDisabled(!1)}})}},lr="32.3.2",zn=_i({version:lr,moduleName:`${Vi.AdvancedFilterModule}-core`,beans:[Uf,Pf],dependantModules:[H,Gu]}),Hf=_i({version:lr,moduleName:`${Vi.AdvancedFilterModule}-api`,apiFunctions:{getAdvancedFilterModel:pf,setAdvancedFilterModel:gf,showAdvancedFilterBuilder:mf,hideAdvancedFilterBuilder:ff},dependantModules:[zn]}),cr=_i({version:lr,moduleName:Vi.AdvancedFilterModule,dependantModules:[zn,Hf]}),hr={};qo(hr,{GridChartsModule:()=>hi,agCharts:()=>Jr});import{AgCharts as zf,time as Wf}from"ag-charts-community";import{ModuleNames as dr,_defineModule as ur}from"ag-grid-community";import{ModuleNames as pr,_defineModule as gr}from"ag-grid-community";import{AutoScrollService as Kf,BeanStub as $f,CellCtrl as jf,_areEqual as Yf,_exists as qf,_existsAndNotEmpty as Xf,_getCtrlForEventTarget as Zf,_getSuppressMultiRanges as zs,_includes as Wn,_isCellSelectionEnabled as Ws,_isDomLayout as Jf,_isUsingNewCellSelectionAPI as Qf,_last as oe,_makeNull as Kn,_missing as eC,_shallowCompare as tC,_warnOnce as $n}from"ag-grid-community";import{BeanStub as sC,SelectionHandleType as iC}from"ag-grid-community";import{SelectionHandleType as rC,_getFillHandle as mr,_last as Ks,_toStringOrNull as aC,_warnOnce as oC}from"ag-grid-community";import{Component as nC,SelectionHandleType as lC,_isVisible as cC,_last as hC,_setDisplayed as dC}from"ag-grid-community";import{CellRangeType as jn,SelectionHandleType as uC,_last as Yn}from"ag-grid-community";function pC(e){return e.rangeService?.getCellRanges()??null}function gC(e,t){e.rangeService?.addCellRange(t)}function qn(e){e.rangeService?.removeAllCellRanges()}var mC=class extends $f{constructor(){super(...arguments),this.beanName="rangeService",this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}wireBeans(e){this.rowModel=e.rowModel,this.dragService=e.dragService,this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.cellNavigationService=e.cellNavigationService,this.pinnedRowModel=e.pinnedRowModel,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService,this.valueService=e.valueService}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.ctrlsService.whenReady(this,i=>{const r=i.gridBodyCtrl;this.autoScrollService=new Kf({scrollContainer:r.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>r.getScrollFeature().getVScrollPosition().top,setVerticalPosition:a=>r.getScrollFeature().setVerticalScrollPosition(a),getHorizontalPosition:()=>r.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:a=>r.getScrollFeature().setHorizontalScrollPosition(a),shouldSkipVerticalScroll:()=>!Jf(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!r.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const e=this.visibleColsService.getAllCols();this.cellRanges.forEach(s=>{const i=s.columns;s.columns=s.columns.filter(a=>a.isVisible()&&e.indexOf(a)!==-1),!Yf(i,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const t=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),t>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=oe(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns;if(!t.length)return!1;const s=this.visibleColsService.getAllCols(),i=t.map(r=>s.indexOf(r)).sort((r,a)=>r-a);return oe(i)-i[0]+1===t.length}getRangeStartRow(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(e,t=!1){if(!Ws(this.gos))return;const s=this.calculateColumnsBetween(e.column,e.column);if(!s)return;(zs(this.gos)||!t||eC(this.cellRanges))&&this.removeAllCellRanges(!0);const r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},a={startRow:r,endRow:r,columns:s,startColumn:e.column};this.cellRanges.push(a),this.setNewestRangeStartCell(e),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=oe(this.cellRanges);this.updateRangeEnd(t,e)}updateRangeEnd(e,t,s=!1){const i=t.column,r=this.calculateColumnsBetween(e.startColumn,i);!r||this.isLastCellOfRange(e,t)||(e.columns=r,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},s||this.dispatchChangedEvent(!0,!0,e.id))}refreshRangeStart(e){const{startColumn:t,columns:s}=e,i=(l,c)=>{const h=e.columns.filter(d=>d!==l);l?(e.startColumn=l,e.columns=c?[l,...h]:[...h,l]):e.columns=h},{left:r,right:a}=this.getRangeEdgeColumns(e);if(t===s[0]&&t!==r){i(r,!0);return}if(t===oe(s)&&t===a){i(a,!1);return}}getRangeEdgeColumns(e){const t=this.visibleColsService.getAllCols(),s=e.columns.map(i=>t.indexOf(i)).filter(i=>i>-1).sort((i,r)=>i-r);return{left:t[s[0]],right:t[oe(s)]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,i=oe(this.cellRanges),r=this.newestRangeStartCell,a=i.columns[0],o=oe(i.columns),n=i.endRow.rowIndex,l=i.endRow.rowPinned,h={column:r.column===a?o:a,rowIndex:n,rowPinned:l},d=this.cellNavigationService.getNextCellToFocus(t,h,s);if(d)return this.setCellRange({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,rowEndIndex:d.rowIndex,rowEndPinned:d.rowPinned,columnStart:r.column,columnEnd:d.column}),d}setCellRange(e){Ws(this.gos)&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){tC(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach(t=>{t.columns&&t.startRow&&this.setNewestRangeStartCell({rowIndex:t.startRow.rowIndex,rowPinned:t.startRow.rowPinned,column:t.columns[0]}),this.cellRanges.push(t)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(e){this.newestRangeStartCell=e}clearCellRangeCellValues(e){let{cellRanges:t}=e;const{cellEventSource:s="rangeService",dispatchWrapperEvents:i,wrapperEventSource:r="deleteKey"}=e;i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteStart",source:r}),this.eventService.dispatchEvent({type:"rangeDeleteStart",source:r})),t||(t=this.cellRanges),t.forEach(a=>{this.forEachRowInRange(a,o=>{const n=this.rowPositionUtils.getRowNode(o);if(n)for(let l=0;l<a.columns.length;l++){const c=this.columnModel.getCol(a.columns[l]);if(!c||!c.isCellEditable(n))continue;const h=this.valueService.getDeleteValue(c,n);n.setDataValue(c,h,s)}})}),i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteEnd",source:r}),this.eventService.dispatchEvent({type:"rangeDeleteEnd",source:r}))}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){let s,i=!1;if(e.columns)s=e.columns.map(o=>this.columnModel.getCol(o)).filter(o=>o);else{const o=this.columnModel.getCol(e.columnStart),n=this.columnModel.getCol(e.columnEnd);if(!o||!n)return;s=this.calculateColumnsBetween(o,n),s&&s.length&&(i=s[0]!==o)}if(!s||!t&&s.length===0)return;const r=e.rowStartIndex!=null?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,a=e.rowEndIndex!=null?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0;return{startRow:r,endRow:a,columns:s,startColumn:i?oe(s):s[0]}}addCellRange(e){const t=this.gos;if(!Ws(t))return;if(Qf(t)&&zs(t)&&this.cellRanges.length>0)return $n("cannot add multiple ranges when `cellSelection.suppressMultiRanges = true`");const s=this.createCellRangeFromCellRangeParams(e);s&&(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))}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;this.cellRanges.forEach(i=>{this.forEachRowInRange(i,r=>{const a=`${r.rowPinned||"normal"}_${r.rowIndex}`,o=e.get(a),n=i.columns.map(l=>l.getId());if(o){const l=n.filter(c=>o.indexOf(c)===-1);o.push(...l)}else e.set(a,n)})});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}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),i=this.getRangeEndRow(e);let r=s;for(;r&&(t(r),!this.rowPositionUtils.sameRow(r,i));)r=this.cellNavigationService.getRowBelow(r)}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns!==null&&Wn(t.columns,e.column),i=this.isRowInRange(e.rowIndex,e.rowPinned,t);return s&&i}isLastCellOfRange(e,t){const{startRow:s,endRow:i}=e,r=this.rowPositionUtils.before(s,i)?i:s,a=t.rowIndex===r.rowIndex&&t.rowPinned===r.rowPinned,o=e.columns[0],n=oe(e.columns),l=e.startColumn===o?n:o;return t.column===l&&a}isBottomRightCell(e,t){const s=this.visibleColsService.getAllCols(),i=e.columns.map(c=>s.indexOf(c)).sort((c,h)=>c-h),{startRow:r,endRow:a}=e,o=this.rowPositionUtils.before(r,a)?a:r,n=s.indexOf(t.column)===oe(i),l=t.rowIndex===o.rowIndex&&Kn(t.rowPinned)===Kn(o.rowPinned);return n&&l}getCellRangeCount(e){return this.isEmpty()?0:this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t,s){const i=this.getRangeStartRow(s),r=this.getRangeEndRow(s),a={rowIndex:e,rowPinned:t||null},o=a.rowIndex===i.rowIndex&&a.rowPinned==i.rowPinned,n=a.rowIndex===r.rowIndex&&a.rowPinned==r.rowPinned;if(o||n)return!0;const l=!this.rowPositionUtils.before(a,i),c=this.rowPositionUtils.before(a,r);return l&&c}getDraggingRange(){return this.draggingRange}onDragStart(e){if(!Ws(this.gos))return;const{ctrlKey:t,metaKey:s,shiftKey:i}=e,r=t||s,o=!zs(this.gos)?r:!1,n=i&&Xf(this.cellRanges);!o&&(!n||qf(oe(this.cellRanges).type))&&this.removeAllCellRanges(!0);const l=this.dragService.getStartTarget();if(l&&this.updateValuesOnMove(l),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=o&&this.getCellRangeCount(this.lastCellHovered)>1,n||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=oe(this.cellRanges);else{const c={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[this.lastCellHovered.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}intersectLastRange(e){if(e&&this.dragging||zs(this.gos)||this.isEmpty())return;const t=this.rowPositionUtils,s=oe(this.cellRanges),i=this.getRangeStartRow(s),r=this.getRangeEndRow(s),a=[];this.cellRanges.slice(0,-1).forEach(o=>{const n=this.getRangeStartRow(o),l=this.getRangeEndRow(o),c=o.columns,h=c.filter(u=>s.columns.indexOf(u)===-1);if(h.length===c.length){a.push(o);return}if(t.before(r,n)||t.before(l,i)){a.push(o);return}const d=a.length;if(t.before(n,i)){const u={columns:[...c],startColumn:s.startColumn,startRow:{...n},endRow:this.cellNavigationService.getRowAbove(i)};a.push(u)}if(h.length>0){const u={columns:h,startColumn:Wn(h,s.startColumn)?s.startColumn:h[0],startRow:this.rowMax([{...i},{...n}]),endRow:this.rowMin([{...r},{...l}])};a.push(u)}t.before(r,l)&&a.push({columns:[...c],startColumn:s.startColumn,startRow:this.cellNavigationService.getRowBelow(r),endRow:{...l}}),a.length-d===1&&(a[a.length-1].id=o.id)}),this.cellRanges=a,e&&this.dispatchChangedEvent(!1,!0)}rowMax(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(t,s))&&(t=s)}),t}rowMin(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(s,t))&&(t=s)}),t}updateValuesOnMove(e){const t=Zf(this.gos,e,jf.DOM_DATA_KEY_CELL_CTRL),s=t?.getCellPosition();if(this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))){if(t?.isEditing()){this.dragService.cancelDrag(e);return}this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s}}onDragging(e){if(!this.dragging||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const t=this.lastCellHovered,s=a=>t&&t.rowPinned===a&&this.newestRangeStartCell.rowPinned===a,i=s("top")||s("bottom");if(this.autoScrollService.check(e,i),!this.cellHasChanged)return;const r=this.calculateColumnsBetween(this.newestRangeStartCell.column,t.column);r&&(this.draggingRange.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(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)}dispatchChangedEvent(e,t,s){this.eventService.dispatchEvent({type:"cellSelectionChanged",started:e,finished:t,id:s}),this.eventService.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}calculateColumnsBetween(e,t){const s=this.visibleColsService.getAllCols(),i=e===t,r=s.indexOf(e),a=h=>$n(`column ${h.getId()} is not visible`);if(r<0){a(e);return}const o=i?r:s.indexOf(t);if(o<0){a(t);return}if(i)return[e];const n=Math.min(r,o),l=n===r?o:r,c=[];for(let h=n;h<=l;h++)c.push(s[h]);return c}},Xn=class extends nC{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}wireBeans(e){this.dragService=e.dragService,this.rangeService=e.rangeService,this.mouseEventService=e.mouseEventService,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService}postConstruct(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:e=>{this.dragging=!0,this.rangeService.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearDragProperties(),this.shouldDestroyOnEndDragging&&this.destroy()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedElementListeners(this.getGui(),{mousedown:this.preventRangeExtension.bind(this)})}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(e){this.cellCtrl=e}getCellRange(){return this.cellRange}setCellRange(e){this.cellRange=e}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(e){this.rangeStartRow=e}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(e){this.rangeEndRow=e}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(e){e.stopPropagation()}onDragStart(e){[this.cellHoverListener]=this.addManagedElementListeners(this.ctrlsService.get("gridCtrl").getGui(),{mousemove:this.updateValuesOnMove.bind(this)}),document.body.classList.add(this.getDraggingCssClass())}getDraggingCssClass(){return`ag-dragging-${this.type===lC.FILL?"fill":"range"}-handle`}updateValuesOnMove(e){const t=this.mouseEventService.getCellPositionForEvent(e);!t||this.lastCellHovered&&this.cellPositionUtils.equals(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}clearDragProperties(){this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass())}getType(){return this.type}refresh(e){const t=this.getCellCtrl(),s=this.getGui(),i=hC(this.rangeService.getCellRanges()),r=i.startRow,a=i.endRow;if(r&&a&&(this.rowPositionUtils.before(a,r)?(this.setRangeStartRow(a),this.setRangeEndRow(r)):(this.setRangeStartRow(r),this.setRangeEndRow(a))),t!==e||!cC(s)){this.setCellCtrl(e);const o=e.getComp().getParentOfValue();o&&o.appendChild(s)}this.setCellRange(i)}clearValues(){this.lastCellHovered=void 0,this.removeListeners()}removeListeners(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)}destroy(){if(!this.shouldDestroyOnEndDragging&&this.isDragging()){dC(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const e=this.getGui();e.parentElement&&e.parentElement.removeChild(e)}};function fC(e){const t=e.length;let s=0;if(t<=1)return e;for(let d=0;d<e.length;d++){const u=e[d],p=u.toString().split("e-");if(p.length>1){s=Math.max(s,parseInt(p[1],10));continue}Math.floor(u)!==u&&(s=Math.max(s,u.toString().split(".")[1].length))}let i=0,r=0,a=0,o=0,n=0;for(let d=0;d<t;d++)n=e[d],i+=d,r+=n,o+=d*d,a+=d*n;const l=(t*a-i*r)/(t*o-i*i),c=r/t-l*i/t,h=[];for(let d=0;d<=t;d++)h.push(parseFloat((d*l+c).toFixed(s)));return h}var CC=class extends Xn{constructor(){super('<div class="ag-fill-handle"></div>'),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=rC.FILL}wireBeans(e){super.wireBeans(e),this.valueService=e.valueService,this.navigationService=e.navigationService,this.cellNavigationService=e.cellNavigationService,this.visibleColsService=e.visibleColsService}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:t,y:s}=this.initialXY,{x:i,y:r}=this.mouseEventService.getNormalisedPosition(e),a=Math.abs(t-i),o=Math.abs(s-r),n=this.getFillHandleDirection();let l;n==="xy"?l=a>o?"x":"y":l=n,l!==this.dragAxis&&(this.dragAxis=l,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const s=this.getCellCtrl();if(!s)return;this.initialPosition=s.getCellPosition()}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",s=this.getCellRange(),i=s.columns.length,r=this.getRangeStartRow(),a=this.getRangeEndRow();let o;if(!this.isUp&&!this.isLeft)o=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:s.columns[0],rowEndIndex:t?a.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?a.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[i-1]});else{const n=t?r:this.lastCellMarked;o=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:n.rowIndex,rowStartPinned:n.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:a.rowIndex,rowEndPinned:a.rowPinned,columnEnd:s.columns[i-1]})}o&&(this.eventService.dispatchEvent({type:"fillStart"}),this.handleValueChanged(s,o,e),this.rangeService.setCellRanges([o]),this.eventService.dispatchEvent({type:"fillEnd",initialRange:s,finalRange:o}))}onDragCancel(){this.initialXY=null,this.markedCells.length&&this.clearMarkedPath()}getFillHandleDirection(){const e=mr(this.gos)?.direction;return e?e!=="x"&&e!=="y"&&e!=="xy"?(oC("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}handleValueChanged(e,t,s){const i=this.rangeService.getRangeEndRow(e),r=this.rangeService.getRangeStartRow(e),a=this.rangeService.getRangeEndRow(t),o=this.rangeService.getRangeStartRow(t),n=this.dragAxis==="y";if(this.isReduce&&!mr(this.gos)?.suppressClearOnFillReduction){const f=n?e.columns:e.columns.filter(S=>t.columns.indexOf(S)<0),v=n?this.cellNavigationService.getRowBelow(a):o;v&&this.clearCellsInRange(v,i,f);return}const l=[],c=[],h=[],d=[];let u=!0,p=0;const g=()=>{l.length=0,c.length=0,h.length=0,d.length=0,p=0},m=(f,v)=>{let S=this.isUp?i:r,y=!1;for(n&&(u=!0,g());!y&&S;){const w=this.rowPositionUtils.getRowNode(S);if(!w)break;n&&f?C(l,f,w,()=>!this.rowPositionUtils.sameRow(S,this.isUp?r:i)):v&&(u=!0,g(),v.forEach(b=>C(l,b,w,()=>b!==(this.isLeft?e.columns[0]:Ks(e.columns))))),y=this.rowPositionUtils.sameRow(S,this.isUp?o:a),S=this.isUp?this.cellNavigationService.getRowAbove(S):this.cellNavigationService.getRowBelow(S)}},C=(f,v,S,y)=>{let w,b=!1;if(u)w=this.valueService.getValue(v,S),c.push(w),h.push(this.valueService.getValue(v,S,void 0,!0)),d.push(this.valueService.formatValue(v,S,w)),u=y();else{const{value:P,fromUserFunction:F,sourceCol:A,sourceRowNode:M}=this.processValues({event:s,values:f,initialValues:c,initialNonAggregatedValues:h,initialFormattedValues:d,col:v,rowNode:S,idx:p++});if(w=P,v.isCellEditable(S)){const I=this.valueService.getValue(v,S);F||(A&&A.getColDef()?.useValueFormatterForExport!==!1&&(w=this.valueService.formatValue(A,M,w)??w),v.getColDef().useValueParserForImport!==!1&&(w=this.valueService.parseValue(v,S,A?w:aC(w),I))),!F||I!==w?S.setDataValue(v,w,"rangeService"):b=!0}}b||f.push({value:w,column:v,rowNode:S})};if(n)e.columns.forEach(f=>{m(f)});else{const f=this.isLeft?[...t.columns].reverse():t.columns;m(void 0,f)}}clearCellsInRange(e,t,s){const i={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[i]})}processValues(e){const{event:t,values:s,initialValues:i,initialNonAggregatedValues:r,initialFormattedValues:a,col:o,rowNode:n,idx:l}=e,c=mr(this.gos)?.setFillValue,h=this.dragAxis==="y";let d;if(h?d=this.isUp?"up":"down":d=this.isLeft?"left":"right",c){const p=this.gos.addGridCommonParams({event:t,values:s.map(({value:m})=>m),initialValues:i,initialNonAggregatedValues:r,initialFormattedValues:a,currentIndex:l,currentCellValue:this.valueService.getValue(o,n),direction:d,column:o,rowNode:n}),g=c(p);if(g!==!1)return{value:g,fromUserFunction:!0}}const u=!s.some(({value:p})=>{const g=parseFloat(p);return isNaN(g)||g.toString()!==p.toString()});if(t.altKey||!u){if(u&&i.length===1){const C=this.isUp||this.isLeft?-1:1;return{value:parseFloat(Ks(s).value)+1*C,fromUserFunction:!1}}const{value:p,column:g,rowNode:m}=s[l%s.length];return{value:p,fromUserFunction:!1,sourceCol:g,sourceRowNode:m}}return{value:Ks(fC(s.map(({value:p})=>Number(p)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("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(this.rowPositionUtils.sameRow(t,e))return;const s=this.rowPositionUtils.before(t,e),i=this.getRangeStartRow(),r=this.getRangeEndRow();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=this.visibleColsService.getAllCols(),a=r.indexOf(s),o=r.indexOf(i);o<=a&&o>=r.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,o<a),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const{navigationService:i,rangeService:r}=this;let a=e;do{const o=this.getCellRange(),n=o.columns.length;for(let l=0;l<n;l++){const c=o.columns[l],d={...{rowIndex:a.rowIndex,rowPinned:a.rowPinned},column:c},u=r.isCellInSpecificRange(d,o),p=this.rowPositionUtils.sameRow(a,e);if(s&&(this.isUp=!0),!p){const g=i.getCellByPosition(d);if(g){this.markedCells.push(g);const m=g.getComp();u||(m.addOrRemoveCssClass("ag-selection-fill-left",l===0),m.addOrRemoveCssClass("ag-selection-fill-right",l===n-1)),m.addOrRemoveCssClass(s?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(a,t))}}}if(this.rowPositionUtils.sameRow(a,t))break}while(a=s?this.cellNavigationService.getRowAbove(a):this.cellNavigationService.getRowBelow(a))}reduceVertical(e,t){let s=e;do{const i=this.getCellRange(),r=i.columns.length,a=this.rowPositionUtils.sameRow(s,t);for(let o=0;o<r;o++){const l={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:i.columns[o]},c=this.navigationService.getCellByPosition(l);c&&(this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(s,t)))}if(a)break}while(s=this.cellNavigationService.getRowAbove(s))}extendHorizontal(e,t,s){const i=this.visibleColsService.getAllCols(),r=i.indexOf(s?t.column:e.column),a=i.indexOf(s?this.getCellRange().columns[0]:t.column),o=s?0:1,n=i.slice(r+o,a+o),l=this.getRangeStartRow(),c=this.getRangeEndRow();n.forEach(h=>{let d=l,u=!1;do{u=this.rowPositionUtils.sameRow(d,c);const p=this.navigationService.getCellByPosition({rowIndex:d.rowIndex,rowPinned:d.rowPinned,column:h});if(p){this.markedCells.push(p);const g=p.getComp();g.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(d,l)),g.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(d,c)),s?(this.isLeft=!0,g.addOrRemoveCssClass("ag-selection-fill-left",h===n[0])):g.addOrRemoveCssClass("ag-selection-fill-right",h===Ks(n))}d=this.cellNavigationService.getRowBelow(d)}while(!u)})}reduceHorizontal(e,t){const s=this.visibleColsService.getAllCols(),i=s.indexOf(t.column),r=s.indexOf(e.column),a=s.slice(i,r),o=this.getRangeStartRow(),n=this.getRangeEndRow();a.forEach(l=>{let c=o,h=!1;do{h=this.rowPositionUtils.sameRow(c,n);const d=this.navigationService.getCellByPosition({rowIndex:c.rowIndex,rowPinned:c.rowPinned,column:l});d&&(this.markedCells.push(d),d.getComp().addOrRemoveCssClass("ag-selection-fill-right",l===a[0])),c=this.cellNavigationService.getRowBelow(c)}while(!h)})}refresh(e){const t=this.rangeService.getCellRanges()[0];if(!t.startRow||!t.endRow){this.destroy();return}super.refresh(e)}},vC=class extends Xn{constructor(){super('<div class="ag-range-handle"></div>'),this.type=uC.RANGE,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.rangeService.getCellRanges(),i=Yn(s);this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.length===2&&s[0].type===jn.DIMENSION&&i.type===jn.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(s[0],{...this.endPosition,column:s[0].columns[0]},!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const t=Yn(this.rangeService.getCellRanges());this.fixRangeStartEnd(t),this.rangeFixed=!1}onDragCancel(){this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.rangeService.getRangeStartRow(e),s=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=t,e.endRow=s,e.startColumn=i}},SC=class extends sC{constructor(){super(...arguments),this.beanName="selectionHandleFactory"}createSelectionHandle(e){return this.createBean(e===iC.RANGE?new vC:new CC)}},fr="32.3.2",Zn=gr({version:fr,moduleName:`${pr.RangeSelectionModule}-core`,beans:[mC,SC],dependantModules:[H]}),yC=gr({version:fr,moduleName:`${pr.RangeSelectionModule}-api`,apiFunctions:{getCellRanges:pC,addCellRange:gC,clearRangeSelection:qn,clearCellSelection:qn},dependantModules:[Zn]}),$s=gr({version:fr,moduleName:pr.RangeSelectionModule,dependantModules:[Zn,yC]});import{BeanStub as wC,TabGuardComp as xC}from"ag-grid-community";import{Component as bC}from"ag-grid-community";import{ChartMappings as Jn}from"ag-grid-community";import{BeanStub as PC,_removeFromParent as TC}from"ag-grid-community";import{AgInputNumberFieldSelector as MC,Component as FC}from"ag-grid-community";import{AgCheckboxSelector as AC,Component as RC}from"ag-grid-community";import{AgPickerField as EC,_getDocument as IC}from"ag-grid-community";import{_Util as DC}from"ag-charts-community";import{Component as LC,KeyCode as xe,RefPlaceholder as be,_exists as kC,_setDisplayed as GC}from"ag-grid-community";import{_Util as Qe}from"ag-charts-community";import{AgInputTextField as OC,RefPlaceholder as BC}from"ag-grid-community";import{_Util as Cr}from"ag-charts-community";import{AgCheckboxSelector as NC,Component as VC}from"ag-grid-community";import{AgAbstractLabel as _C,AgInputNumberFieldSelector as UC,RefPlaceholder as vr}from"ag-grid-community";import{AgAbstractInputField as HC}from"ag-grid-community";import{AgCheckboxSelector as zC,Component as WC,RefPlaceholder as KC}from"ag-grid-community";import{BeanStub as $C,Component as jC,RefPlaceholder as YC,_createIconNoSpan as qC,_isNothingFocused as XC}from"ag-grid-community";import{BeanStub as ZC,_includes as Qn,_isClientSideRowModel as JC,_warnOnce as QC}from"ag-grid-community";import{BeanStub as ev,_warnOnce as el}from"ag-grid-community";import{BeanStub as tv}from"ag-grid-community";import{BeanStub as sv,_warnOnce as js}from"ag-grid-community";import{VERSION as iv,_ModuleSupport as rv}from"ag-charts-community";import{Component as av,RefPlaceholder as Ys,_clearElement as ov,_getAbsoluteHeight as nv,_getAbsoluteWidth as lv,_includes as tl,_mergeDeep as cv,_removeFromParent as hv,_setDisplayed as sl,_warnOnce as il}from"ag-grid-community";import{BeanStub as dv,_warnOnce as rl}from"ag-grid-community";import{_ModuleSupport as uv,_Theme as pv}from"ag-charts-community";import{_includes as al,_warnOnce as gv}from"ag-grid-community";import{_Theme as ol}from"ag-charts-community";import{BeanStub as mv,CellRangeType as Vt,_includes as nl}from"ag-grid-community";import{BeanStub as fv,ModuleNames as Cv,_includes as vv,_isClientSideRowModel as Sv,_isServerSideRowModel as yv,_last as wv,_values as xv,_warnOnce as ll}from"ag-grid-community";import{BeanStub as bv,_missingOrEmpty as Pv,_warnOnce as Tv}from"ag-grid-community";import{BeanStub as Mv,_warnOnce as Sr}from"ag-grid-community";import{_warnOnce as _t}from"ag-grid-community";import{_ModuleSupport as Fv}from"ag-charts-community";import{AgCharts as Av,_ModuleSupport as Rv,_Theme as Ev}from"ag-charts-community";import{_includes as Iv}from"ag-grid-community";import{_Util as cl}from"ag-charts-community";import{GROUP_AUTO_COLUMN_ID as Dv}from"ag-grid-community";import{AgPromise as Lv,Component as kv,_warnOnce as Gv}from"ag-grid-community";import{Component as Ov,RefPlaceholder as Bv,_clearElement as Nv,_createIconNoSpan as Vv,_getDocument as _v}from"ag-grid-community";import{AgPromise as Uv,Component as Hv}from"ag-grid-community";import{AgToggleButton as zv,Component as Wv,_getDocument as Kv,_setDisplayed as $v,_warnOnce as jv}from"ag-grid-community";import{AgSelect as Yv,AgToggleButton as qv}from"ag-grid-community";import{AgSelect as Xv,Component as Zv}from"ag-grid-community";import{AgSelect as Jv,Component as Qv,DragSourceType as hl,_escapeString as eS,_getActiveDomElement as tS,_removeFromParent as sS}from"ag-grid-community";import{AgSelect as dl,ChartMappings as iS,Component as rS,RefPlaceholder as aS}from"ag-grid-community";import{BeanStub as oS}from"ag-grid-community";import{AgCheckbox as nS,AgSelect as lS,Component as cS,_areEqual as hS,_clearElement as dS}from"ag-grid-community";import{AgToggleButton as uS}from"ag-grid-community";import{Component as pS,_warnOnce as yr}from"ag-grid-community";import{AgCheckbox as gS,AgSelectSelector as mS,Component as fS,RefPlaceholder as qs,_removeFromParent as ul,_setDisplayed as CS}from"ag-grid-community";import{AgAbstractLabel as vS,AgInputNumberFieldSelector as SS,RefPlaceholder as Xs,_exists as yS,_getActiveDomElement as wS,_setFixedWidth as xS}from"ag-grid-community";import{AgSelectSelector as bS,Component as PS,RefPlaceholder as TS,_capitalise as MS,_includes as FS,_removeFromParent as AS}from"ag-grid-community";import{Component as RS}from"ag-grid-community";import{Component as ES}from"ag-grid-community";import{AgSelect as IS,Component as DS,RefPlaceholder as LS}from"ag-grid-community";import{Component as kS,RefPlaceholder as GS}from"ag-grid-community";import{Component as OS}from"ag-grid-community";import{Component as BS,RefPlaceholder as NS}from"ag-grid-community";import{BeanStub as VS}from"ag-grid-community";import{AgCheckbox as _S,AgSelect as US,Component as HS,RefPlaceholder as zS}from"ag-grid-community";import{AgSelect as wr,AgToggleButton as WS,Component as KS,RefPlaceholder as $S,_errorOnce as jS,_removeFromParent as YS}from"ag-grid-community";import{Component as qS}from"ag-grid-community";import{Component as XS}from"ag-grid-community";import{Component as ZS}from"ag-grid-community";import{AgSelectSelector as JS,Component as QS}from"ag-grid-community";import{AgSelectSelector as ey,Component as ty,RefPlaceholder as sy,_removeFromParent as iy}from"ag-grid-community";import{Component as ry}from"ag-grid-community";import{Component as ay}from"ag-grid-community";import{Component as oy}from"ag-grid-community";import{Component as ny,RefPlaceholder as ly}from"ag-grid-community";import{AgInputTextField as cy,Component as hy}from"ag-grid-community";import{Component as dy,RefPlaceholder as Ut,_clearElement as pl,_createIconNoSpan as gl,_getAbsoluteWidth as uy,_radioCssClass as ml,_setDisplayed as py,_shallowCompare as gy}from"ag-grid-community";import{Component as my,KeyCode as fl,_setAriaLabel as fy,_warnOnce as Cl}from"ag-grid-community";Zo(hr,Ty);import{_Scene as ne}from"ag-charts-community";import{_Scene as vl}from"ag-charts-community";import{Component as Cy,_errorOnce as vy}from"ag-grid-community";import{_Scene as Sl}from"ag-charts-community";import{_Scene as xr}from"ag-charts-community";import{_Scene as br}from"ag-charts-community";import{_Scene as yl}from"ag-charts-community";import{_Scene as Ht}from"ag-charts-community";import{_Scene as zt}from"ag-charts-community";import{_Scene as Pr}from"ag-charts-community";import{_Scene as Tr}from"ag-charts-community";import{_Scene as Mr}from"ag-charts-community";import{_Scene as Wt}from"ag-charts-community";import{_Scene as wl}from"ag-charts-community";import{_Scene as Zs}from"ag-charts-community";import{_Scene as Js}from"ag-charts-community";import{_Scene as Fr}from"ag-charts-community";import{_Scene as Kt}from"ag-charts-community";import{_Scene as Pe,_Theme as Sy,_Util as yy}from"ag-charts-community";import{_Scene as Ar,_Theme as wy}from"ag-charts-community";import{_Scene as xl}from"ag-charts-community";import{_Scene as $t,_Theme as bl,_Util as xy}from"ag-charts-community";import{_Scene as Qs,_Theme as ei}from"ag-charts-community";import{_Scene as Rr}from"ag-charts-community";import{_Scene as Er}from"ag-charts-community";import{BeanStub as by,_errorOnce as Py}from"ag-grid-community";import*as Ty from"ag-charts-community";var Pl={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,isEnterprise:!0,canSwitchDirection:!0},"range-area":{isCartesian:!0,isEnterprise:!0},"box-plot":{isCartesian:!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}};function My(e){return!!Pl[e]}function Ir(e){return Jn.COMBO_CHART_TYPES.includes(e)}function Ne(e,t){return!!Pl[e]?.[t]}function Fy(e){return Ne(O(e),"isEnterprise")}var Ay=new Set(["stackedColumn","normalizedColumn","stackedBar","normalizedBar"]);function Ry(e){return Ay.has(e)}function Ve(e){return Ne(e,"isCartesian")}function Dr(e){return Ne(e,"isPolar")}function Ey(e){return Ne(e,"isRadial")}function et(e){return Ne(e,"isHierarchical")}function jt(e){return e==="doughnut"?"donut":e}function Tl(e){return Jn.CHART_TYPE_TO_SERIES_TYPE[e]}function O(e){return Tl(e)??"line"}function Ml(e){return Ne(e,"isPie")}function Iy(e){return e==="pie"||e==="waterfall"||e==="histogram"}function Lr(e){return et(O(e))?void 0:1}function ti(e){return et(O(e))?2:Iy(e)?1:void 0}function Fl(e){return!Ir(e)&&Ne(O(e),"canInvert")}function Dy(e){return Ne(O(e),"canSwitchDirection")}function kr(e){switch(e){case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":case"stackedArea":case"normalizedArea":return`${e}Full`;case"doughnut":return"donut";case"areaColumnCombo":return"AreaColumnCombo";default:return e}}var Al=class extends PC{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.addCssClass(this.cssClass),this.eGui.appendChild(e.getGui())}refreshPanels(e){const t=this.chartController.getChartType(),s=this.chartController.isGrouping(),i=O(t);e&&t===this.chartType&&s===this.isGrouping||(this.destroyPanels(),this.createPanels(t,i),this.chartType=t,this.isGrouping=s)}destroyPanels(){this.panels.forEach(e=>{TC(e.getGui()),this.destroyBean(e)}),this.panels=[]}destroy(){this.destroyPanels(),super.destroy()}},Ly=class extends FC{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslationService=e.chartTranslationService}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("animation.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslationService.translate("animation"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultNumberInputParams("animation.duration","durationMillis",{min:0});this.setTemplate(`<div>
135
+ </div>`),this.eList=Zi,this.eApplyFilterButton=Zi,this.eCancelFilterButton=Zi,this.validationMessage=null}wireBeans(e){this.filterManager=e.filterManager,this.advancedFilterService=e.advancedFilterService,this.advancedFilterExpressionService=e.advancedFilterExpressionService}postConstruct(){const{showMoveButtons:e}=this.gos.get("advancedFilterBuilderParams")??{};this.showMove=!!e,this.addManagedPropertyListener("advancedFilterBuilderParams",({currentValue:t})=>{this.showMove=!!t?.showMoveButtons,this.refreshList(!1)}),this.filterModel=this.setupFilterModel(),this.setupVirtualList(),this.dragFeature=this.createManagedBean(new Ef(this,this.virtualList)),this.setupButtons()}refresh(){let e=this.virtualList.getLastFocusedRow();this.setupFilterModel(),this.validateItems(),this.refreshList(!1),e!=null&&(this.virtualList.getComponentAt(e)||(e=0),this.virtualList.focusRow(e))}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(){this.virtualList=this.createManagedBean(new Ge({cssIdentifier:"advanced-filter-builder",ariaRole:"tree",listName:this.advancedFilterExpressionService.translate("ariaAdvancedFilterBuilderList")})),this.virtualList.setComponentCreator(this.createItemComponent.bind(this)),this.virtualList.setComponentUpdater(this.updateItemComponent.bind(this)),this.virtualList.setRowHeight(40),this.eList.appendChild(this.virtualList.getGui()),this.virtualList.setModel({getRowCount:()=>this.items.length,getRow:e=>this.items[e],areRowsEqual:(e,t)=>e===t}),this.buildList(),this.virtualList.refresh()}setupButtons(){this.eApplyFilterButton.innerText=this.advancedFilterExpressionService.translate("advancedFilterBuilderApply"),this.activateTabIndex([this.eApplyFilterButton]),this.addManagedElementListeners(this.eApplyFilterButton,{click:()=>{this.advancedFilterService.setModel(this.filterModel),this.filterManager?.onFilterChanged({source:"advancedFilter"}),this.close()}}),this.validationTooltipFeature=this.createManagedBean(new Im({getGui:()=>this.eApplyFilterButton,getLocation:()=>"advancedFilter",getTooltipValue:()=>this.validationMessage,getTooltipShowDelayOverride:()=>1e3})),this.validate();const e=t=>this.addOrRemoveCssClass("ag-advanced-filter-builder-validation",t);this.addManagedListeners(this.eApplyFilterButton,{mouseenter:()=>e(!0),mouseleave:()=>e(!1)}),this.eCancelFilterButton.innerText=this.advancedFilterExpressionService.translate("advancedFilterBuilderCancel"),this.activateTabIndex([this.eCancelFilterButton]),this.addManagedElementListeners(this.eCancelFilterButton,{click:()=>this.close()})}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",a=r?i.filterModel:i.parent;if(!a||this.isChildOrSelf(a,e.filterModel)||i===e)return;this.removeItemFromParent(e);let o;r?o=0:(o=a.conditions.indexOf(i.filterModel),o===-1?o=a.conditions.length:s==="bottom"&&(o+=1)),a.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.advancedFilterService.getModel());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)=>{s.push({filterModel:t,level:i,parent:r,valid:!0,showMove:this.showMove}),t.filterType==="join"&&(t.conditions.forEach(a=>e(a,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=[];this.items.forEach(s=>{s.valid||t.push(s.filterModel)}),this.buildList(),t.length&&this.items.forEach(s=>{s.filterModel&&t.includes(s.filterModel)&&(s.valid=!1)})}this.virtualList.refresh(e),this.validate()}updateItemComponent(e,t){const s=this.items.indexOf(e),i=(n,l)=>{const h=this.items.find(d=>d.filterModel===n)?.parent;if(h){const{conditions:d}=h;i(h,l),l.push(d[d.length-1]===n)}},r=[],{filterModel:a}=e;a&&(i(a,r),r[0]=!1);const o=a?.filterType==="join"&&!!a.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 nr(e,this.dragFeature,t):new If(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 nr&&this.updateItemComponent(e,s),s}addItem(e,t){const{parent:s,level:i,filterModel:r}=e,a=r?.filterType==="join",o=t?{filterType:"join",type:"AND",conditions:[]}:{},n=a?r:s;let l=a?0:n.conditions.indexOf(r);l>=0?(a||(l+=1),n.conditions.splice(l,0,o)):n.conditions.push(o);let c=this.items.indexOf(e);const h=c>=0;if(h){e.filterModel&&c++;const d=[{filterModel:o,level:a?i+1:i,parent:n,valid:t,showMove:this.showMove}];this.items.splice(c,0,...d)}this.refreshList(h),h&&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",a=this.items.indexOf(e),o=!r&&a>=0;o&&this.items.splice(a,1),this.refreshList(o),a>=0&&this.virtualList.focusRow(a)}moveItemUpDown(e,t){const s=this.items.indexOf(e),i=t?s-1:s+1;if(i===0||!t&&!this.canMoveDown(e,s))return;const r=this.items[i],a=this.removeItemFromParent(e),{level:o,filterModel:n,parent:l}=e,{level:c,filterModel:h,parent:d}=r;if(t)if(c===o&&h.filterType==="join")h.conditions.push(n);else if(c<=o){const p=d.conditions.indexOf(h);d.conditions.splice(p,0,n)}else l.conditions[a-1].conditions.push(n);else if(c===o)if(h.filterType==="join")h.conditions.splice(0,0,n);else{const p=d.conditions.indexOf(h);d.conditions.splice(p+1,0,n)}else if(a<l.conditions.length)l.conditions.splice(a+1,0,n);else{const p=this.items.find(m=>m.filterModel===l),g=p.parent.conditions.indexOf(p.filterModel)+1;p.parent.conditions.splice(g,0,n)}this.refreshList(!1);const u=this.items.findIndex(({filterModel:p})=>p===n);if(u>=0){const p=this.virtualList.getComponentAt(u);p instanceof nr&&p.focusMoveButton(t)}}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.advancedFilterService.getCtrl().toggleFilterBuilder({source:"ui"})}validate(){let e=!this.items.every(({valid:t})=>t);e?this.validationMessage=this.advancedFilterExpressionService.translate("advancedFilterBuilderValidationIncomplete"):(e=JSON.stringify(this.filterModel)===this.stringifiedModel,e?this.validationMessage=this.advancedFilterExpressionService.translate("advancedFilterBuilderValidationAlreadyApplied"):this.validationMessage=null),Lm(this.eApplyFilterButton,e),this.validationTooltipFeature.refreshToolTip()}validateItems(){const e=s=>{s.type=void 0},t=s=>{delete s.filter};this.items.forEach(s=>{if(!s.valid||!s.filterModel||s.filterModel.filterType==="join")return;const{filterModel:i}=s,{colId:r}=i,a=this.advancedFilterExpressionService.getColumnAutocompleteEntries().find(({key:c})=>c===r),o=this.advancedFilterExpressionService.getColumnDetails(i.colId);if(!a||!o.column){s.valid=!1,i.colId=void 0,e(i),t(i);return}const l=this.advancedFilterExpressionService.getDataTypeExpressionOperator(o.baseCellDataType).operators[i.type];if(!l){s.valid=!1,e(i),t(i);return}if(l.numOperands>0&&!Dm(i.filter)){s.valid=!1;return}})}},Bf=class extends rm{constructor(e){super(),this.enabled=e}wireBeans(e){this.ctrlsService=e.ctrlsService,this.popupService=e.popupService,this.advancedFilterExpressionService=e.advancedFilterExpressionService,this.environment=e.environment}postConstruct(){this.hasAdvancedFilterParent=!!this.gos.get("advancedFilterParent"),this.ctrlsService.whenReady(this,()=>this.setAdvancedFilterComp()),this.addManagedEventListeners({advancedFilterEnabledChanged:({enabled:e})=>this.onEnabledChanged(e)}),this.addManagedPropertyListener("advancedFilterParent",()=>this.updateComps()),this.addDestroyFunc(()=>{this.destroyAdvancedFilterComp(),this.destroyBean(this.eBuilderComp),this.eBuilderDialog&&this.eBuilderDialog.isAlive()&&this.destroyBean(this.eBuilderDialog)})}setupHeaderComp(e){this.eHeaderComp&&(this.eHeaderComp?.getGui().remove(),this.destroyBean(this.eHeaderComp)),this.eHeaderComp=this.createManagedBean(new Rf(this.enabled&&!this.hasAdvancedFilterParent)),e.insertAdjacentElement("beforebegin",this.eHeaderComp.getGui())}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:a,minWidth:o}=this.getBuilderDialogSize();this.eBuilderComp=this.createBean(new Of),this.eBuilderDialog=this.createBean(new Ze({title:this.advancedFilterExpressionService.translate("advancedFilterBuilderTitle"),component:this.eBuilderComp,width:r,height:a,resizable:!0,movable:!0,maximizable:!0,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.eventService.dispatchEvent({type:"advancedFilterBuilderVisibleChanged",source:e,visible:t})}getBuilderDialogSize(){const e=this.gos.get("advancedFilterBuilderParams")?.minWidth??500,t=this.popupService.getPopupParent(),s=Math.round(om(t))-2,i=Math.round(am(t)*.75)-2,r=Math.min(Math.max(600,e),s),a=Math.min(600,i);return{width:r,height:a,minWidth:e}}onEnabledChanged(e){this.enabled=e,this.updateComps()}updateComps(){this.setAdvancedFilterComp(),this.setHeaderCompEnabled(),this.eventService.dispatchEvent({type:"headerHeightChanged"})}setAdvancedFilterComp(){if(this.destroyAdvancedFilterComp(),!this.enabled)return;const e=this.gos.get("advancedFilterParent");if(this.hasAdvancedFilterParent=!!e,e){const t=this.createBean(new Vn),s=t.getGui();this.environment.applyThemeClasses(s),s.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr"),e.appendChild(s),this.eFilterComp=t}}setHeaderCompEnabled(){this.eHeaderComp?.setEnabled(this.enabled&&!this.hasAdvancedFilterParent)}destroyAdvancedFilterComp(){this.eFilterComp&&(nm(this.eFilterComp.getGui()),this.destroyBean(this.eFilterComp))}},Nf=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],a=this.operatorEndPositions[t];s=sr(r,e,a==null?this.params.expression.length:a+1)}let i=this.params.advancedFilterExpressionService.getJoinOperatorAutocompleteEntries();return(t||t==null&&this.activeOperator)&&(i=i.filter(({key:r})=>r===this.parsedOperator)),this.params.advancedFilterExpressionService.generateAutocompleteListParams(i,"join",s)}updateExpression(e,t,s){let{expression:i}=this.params;const r=t.displayValue??t.key;if(s===0)for(let n=this.operatorEndPositions.length-1;n>0;n--){const l=this.operatorEndPositions[n];l!=null&&(i=Be(i,this.operatorStartPositions[n],l,r).updatedValue)}const a=this.operatorStartPositions.length>s?this.operatorStartPositions[s]:e,o=(this.operatorEndPositions.length>s?this.operatorEndPositions[s]:void 0)??ir(i,e,!0).endPosition;return Be(i,a,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.advancedFilterExpressionService.getExpressionJoinOperators(),i=Hs(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.advancedFilterExpressionService.translate("advancedFilterValidationJoinOperatorMismatch"),startPosition:e-t.length+1,endPosition:e}),!1}else this.parsedOperator=i;return t!==r&&(rr(this.params,t,r,e),this.operators[this.activeOperator]=r),!0}else return i===null?!1:(this.validationError||(this.validationError={message:this.params.advancedFilterExpressionService.translate("advancedFilterValidationInvalidJoinOperator"),startPosition:e-t.length+1,endPosition:e}),!0)}},Vf=class nu{constructor(t,s){this.params=t,this.startPosition=s,this.expectingExpression=!0,this.expectingOperator=!1,this.expressionParsers=[],this.operatorParser=new Nf(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 nu(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 we(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.advancedFilterExpressionService.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.advancedFilterExpressionService.translate(s),startPosition:this.params.expression.length,endPosition:this.params.expression.length}:null}getFunctionString(t){const s=this.expressionParsers.length>1,i=this.expressionParsers.map(r=>r.getFunctionString(t)).join(` ${this.operatorParser.getFunction()} `);return s?`(${i})`:i}getFunctionParsed(t){const s=this.operatorParser.getFunction(),i=this.expressionParsers.map(a=>a.getFunctionParsed(t)),r=s==="&&"?"every":"some";return(a,o,n)=>i[r](l=>l(a,o,n))}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 a=this.operatorParser.getLastOperatorEndPosition();return a==null||t<=a+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,a=this.getExpressionParserIndex(t);if(a==null){const l=i==="column"?this.params.advancedFilterExpressionService.getColumnValue(s):s.displayValue??s.key;return Be(r,this.startPosition,this.startPosition,l,!0)}const n=this.expressionParsers[a].updateExpression(t,s,i);return n??(i==="column"?Be(r,t,r.length-1,this.params.advancedFilterExpressionService.getColumnValue(s),!0):this.endPosition!=null&&t>this.endPosition+1?null:this.operatorParser.updateExpression(t,s,a))}getModel(){return this.expressionParsers.length>1?{filterType:"join",type:this.operatorParser.getModel(),conditions:this.expressionParsers.map(t=>t.getModel())}:this.expressionParsers[0].getModel()}getColumnAutocompleteListParams(){return this.params.advancedFilterExpressionService.generateAutocompleteListParams(this.params.advancedFilterExpressionService.getColumnAutocompleteEntries(),"column","")}getExpressionParserIndex(t){let s;for(let i=0;i<this.expressionParsers.length&&!(this.expressionParsers[i].startPosition>t);i++)s=i;return s}},_f=class{constructor(e){this.params=e,this.valid=!1}parseExpression(){this.joinExpressionParser=new Vf(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}=e;return s<this.params.expression.length?this.params.advancedFilterExpressionService.translate("advancedFilterValidationMessage",[t,this.params.expression.slice(s,i+1).trim()]):this.params.advancedFilterExpressionService.translate("advancedFilterValidationMessageAtEnd",[t])}getFunctionString(){const e=this.createFunctionParams();return{functionString:`return ${this.joinExpressionParser.getFunctionString(e)};`,params:e}}getFunctionParsed(){const e=this.createFunctionParams();return{expressionFunction:this.joinExpressionParser.getFunctionParsed(e),params:e}}getAutocompleteListParams(e){return this.joinExpressionParser.getAutocompleteListParams(e)??{enabled:!1}}updateExpression(e,t,s){return this.joinExpressionParser.updateExpression(e,t,s)}getModel(){return this.isValid()?this.joinExpressionParser.getModel():null}createFunctionParams(){return{operands:[],operators:[],evaluatorParams:[]}}},Uf=class extends Qg{constructor(){super(...arguments),this.beanName="advancedFilterService",this.appliedExpression=null,this.expression=null,this.isValid=!0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.dataTypeService=e.dataTypeService,this.advancedFilterExpressionService=e.advancedFilterExpressionService}postConstruct(){this.setEnabled(this.gos.get("enableAdvancedFilter"),!0),this.ctrl=this.createManagedBean(new Bf(this.enabled)),this.expressionProxy={getValue:(e,t)=>{const s=this.columnModel.getColDefCol(e);return s?this.valueService.getValue(s,t,!0):void 0}},this.addManagedPropertyListener("enableAdvancedFilter",e=>this.setEnabled(!!e.currentValue)),this.addManagedEventListeners({newColumnsLoaded:e=>this.onNewColumnsLoaded(e)}),this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter",()=>this.updateValidity())}isEnabled(){return this.enabled}isFilterPresent(){return!!this.expressionFunction}doesFilterPass(e){return this.expressionFunction(this.expressionProxy,e,this.expressionParams)}getModel(){const e=this.createExpressionParser(this.appliedExpression);return e?.parseExpression(),e?.getModel()??null}setModel(e){const t=(i,r)=>{if(i.filterType==="join"){const a=this.advancedFilterExpressionService.parseJoinOperator(i),o=i.conditions.map(n=>t(n)).filter(n=>em(n)).join(` ${a} `);return r||i.conditions.length<=1?o:`(${o})`}else return this.advancedFilterExpressionService.parseColumnFilterModel(i)},s=e?t(e,!0):null;this.setExpressionDisplayValue(s),this.applyExpression(),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 _f({expression:e,columnModel:this.columnModel,dataTypeService:this.dataTypeService,valueService:this.valueService,advancedFilterExpressionService:this.advancedFilterExpressionService}):null}getDefaultExpression(e){const t=this.advancedFilterExpressionService.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=tm(this.gos)||sm(this.gos);e&&!i&&im("Advanced Filter is only supported with the Client-Side Row Model or Server-Side Row Model."),this.enabled=e&&i,!t&&this.enabled!==s&&this.eventService.dispatchEvent({type:"advancedFilterEnabledChanged",enabled:this.enabled})}applyExpression(){const e=this.createExpressionParser(this.expression);e?.parseExpression(),this.applyExpressionFromParser(e)}applyExpressionFromParser(e){if(this.isValid=!e||e.isValid(),!e||!this.isValid){this.expressionFunction=null,this.expressionParams=null,this.appliedExpression=null;return}const{expressionFunction:t,params:s}=this.getFunction(e);this.expressionFunction=t,this.expressionParams=s,this.appliedExpression=this.expression}getFunction(e){if(this.gos.get("suppressAdvancedFilterEval"))return e.getFunctionParsed();{const{functionString:t,params:s}=e.getFunctionString();return{expressionFunction:new Function("expressionProxy","node","params",t),params:s}}}updateValidity(){this.advancedFilterExpressionService.resetColumnCaches();const e=this.createExpressionParser(this.expression);e?.parseExpression();const s=(!e||e.isValid())!==this.isValid;return this.applyExpressionFromParser(e),this.ctrl.refreshComp(),this.ctrl.refreshBuilderComp(),s}onNewColumnsLoaded(e){if(e.source!=="gridInitializing"||!this.dataTypeService?.isPendingInference())return;this.ctrl.setInputDisabled(!0);const[t]=this.addManagedEventListeners({dataTypesInferred:()=>{t?.(),this.ctrl.setInputDisabled(!1)}})}},lr="32.3.3",zn=_i({version:lr,moduleName:`${Vi.AdvancedFilterModule}-core`,beans:[Uf,Pf],dependantModules:[H,Gu]}),Hf=_i({version:lr,moduleName:`${Vi.AdvancedFilterModule}-api`,apiFunctions:{getAdvancedFilterModel:pf,setAdvancedFilterModel:gf,showAdvancedFilterBuilder:mf,hideAdvancedFilterBuilder:ff},dependantModules:[zn]}),cr=_i({version:lr,moduleName:Vi.AdvancedFilterModule,dependantModules:[zn,Hf]}),hr={};qo(hr,{GridChartsModule:()=>hi,agCharts:()=>Jr});import{AgCharts as zf,time as Wf}from"ag-charts-community";import{ModuleNames as dr,_defineModule as ur}from"ag-grid-community";import{ModuleNames as pr,_defineModule as gr}from"ag-grid-community";import{AutoScrollService as Kf,BeanStub as $f,CellCtrl as jf,_areEqual as Yf,_exists as qf,_existsAndNotEmpty as Xf,_getCtrlForEventTarget as Zf,_getSuppressMultiRanges as zs,_includes as Wn,_isCellSelectionEnabled as Ws,_isDomLayout as Jf,_isUsingNewCellSelectionAPI as Qf,_last as oe,_makeNull as Kn,_missing as eC,_shallowCompare as tC,_warnOnce as $n}from"ag-grid-community";import{BeanStub as sC,SelectionHandleType as iC}from"ag-grid-community";import{SelectionHandleType as rC,_getFillHandle as mr,_last as Ks,_toStringOrNull as aC,_warnOnce as oC}from"ag-grid-community";import{Component as nC,SelectionHandleType as lC,_isVisible as cC,_last as hC,_setDisplayed as dC}from"ag-grid-community";import{CellRangeType as jn,SelectionHandleType as uC,_last as Yn}from"ag-grid-community";function pC(e){return e.rangeService?.getCellRanges()??null}function gC(e,t){e.rangeService?.addCellRange(t)}function qn(e){e.rangeService?.removeAllCellRanges()}var mC=class extends $f{constructor(){super(...arguments),this.beanName="rangeService",this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1}wireBeans(e){this.rowModel=e.rowModel,this.dragService=e.dragService,this.columnModel=e.columnModel,this.visibleColsService=e.visibleColsService,this.cellNavigationService=e.cellNavigationService,this.pinnedRowModel=e.pinnedRowModel,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService,this.valueService=e.valueService}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.ctrlsService.whenReady(this,i=>{const r=i.gridBodyCtrl;this.autoScrollService=new Kf({scrollContainer:r.getBodyViewportElement(),scrollAxis:"xy",getVerticalPosition:()=>r.getScrollFeature().getVScrollPosition().top,setVerticalPosition:a=>r.getScrollFeature().setVerticalScrollPosition(a),getHorizontalPosition:()=>r.getScrollFeature().getHScrollPosition().left,setHorizontalPosition:a=>r.getScrollFeature().setHorizontalScrollPosition(a),shouldSkipVerticalScroll:()=>!Jf(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!r.getScrollFeature().isHorizontalScrollShowing()})})}onColumnsChanged(){this.refreshLastRangeStart();const e=this.visibleColsService.getAllCols();this.cellRanges.forEach(s=>{const i=s.columns;s.columns=s.columns.filter(a=>a.isVisible()&&e.indexOf(a)!==-1),!Yf(i,s.columns)&&this.dispatchChangedEvent(!1,!0,s.id)});const t=this.cellRanges.length;this.cellRanges=this.cellRanges.filter(s=>s.columns.length>0),t>this.cellRanges.length&&this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){const e=oe(this.cellRanges);e&&this.refreshRangeStart(e)}isContiguousRange(e){const t=e.columns;if(!t.length)return!1;const s=this.visibleColsService.getAllCols(),i=t.map(r=>s.indexOf(r)).sort((r,a)=>r-a);return oe(i)-i[0]+1===t.length}getRangeStartRow(e){return e.startRow&&e.endRow?this.rowPositionUtils.before(e.startRow,e.endRow)?e.startRow:e.endRow:{rowIndex:0,rowPinned:this.pinnedRowModel.getPinnedTopRowCount()>0?"top":null}}getRangeEndRow(e){if(e.startRow&&e.endRow)return this.rowPositionUtils.before(e.startRow,e.endRow)?e.endRow:e.startRow;const t=this.pinnedRowModel.getPinnedBottomRowCount();return t>0?{rowIndex:t-1,rowPinned:"bottom"}:{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}setRangeToCell(e,t=!1){if(!Ws(this.gos))return;const s=this.calculateColumnsBetween(e.column,e.column);if(!s)return;(zs(this.gos)||!t||eC(this.cellRanges))&&this.removeAllCellRanges(!0);const r={rowIndex:e.rowIndex,rowPinned:e.rowPinned},a={startRow:r,endRow:r,columns:s,startColumn:e.column};this.cellRanges.push(a),this.setNewestRangeStartCell(e),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}extendLatestRangeToCell(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=oe(this.cellRanges);this.updateRangeEnd(t,e)}updateRangeEnd(e,t,s=!1){const i=t.column,r=this.calculateColumnsBetween(e.startColumn,i);!r||this.isLastCellOfRange(e,t)||(e.columns=r,e.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},s||this.dispatchChangedEvent(!0,!0,e.id))}refreshRangeStart(e){const{startColumn:t,columns:s}=e,i=(l,c)=>{const h=e.columns.filter(d=>d!==l);l?(e.startColumn=l,e.columns=c?[l,...h]:[...h,l]):e.columns=h},{left:r,right:a}=this.getRangeEdgeColumns(e);if(t===s[0]&&t!==r){i(r,!0);return}if(t===oe(s)&&t===a){i(a,!1);return}}getRangeEdgeColumns(e){const t=this.visibleColsService.getAllCols(),s=e.columns.map(i=>t.indexOf(i)).filter(i=>i>-1).sort((i,r)=>i-r);return{left:t[s[0]],right:t[oe(s)]}}extendLatestRangeInDirection(e){if(this.isEmpty()||!this.newestRangeStartCell)return;const t=e.key,s=e.ctrlKey||e.metaKey,i=oe(this.cellRanges),r=this.newestRangeStartCell,a=i.columns[0],o=oe(i.columns),n=i.endRow.rowIndex,l=i.endRow.rowPinned,h={column:r.column===a?o:a,rowIndex:n,rowPinned:l},d=this.cellNavigationService.getNextCellToFocus(t,h,s);if(d)return this.setCellRange({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,rowEndIndex:d.rowIndex,rowEndPinned:d.rowPinned,columnStart:r.column,columnEnd:d.column}),d}setCellRange(e){Ws(this.gos)&&(this.removeAllCellRanges(!0),this.addCellRange(e))}setCellRanges(e){tC(this.cellRanges,e)||(this.removeAllCellRanges(!0),e.forEach(t=>{t.columns&&t.startRow&&this.setNewestRangeStartCell({rowIndex:t.startRow.rowIndex,rowPinned:t.startRow.rowPinned,column:t.columns[0]}),this.cellRanges.push(t)}),this.dispatchChangedEvent(!1,!0))}setNewestRangeStartCell(e){this.newestRangeStartCell=e}clearCellRangeCellValues(e){let{cellRanges:t}=e;const{cellEventSource:s="rangeService",dispatchWrapperEvents:i,wrapperEventSource:r="deleteKey"}=e;i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteStart",source:r}),this.eventService.dispatchEvent({type:"rangeDeleteStart",source:r})),t||(t=this.cellRanges),t.forEach(a=>{this.forEachRowInRange(a,o=>{const n=this.rowPositionUtils.getRowNode(o);if(n)for(let l=0;l<a.columns.length;l++){const c=this.columnModel.getCol(a.columns[l]);if(!c||!c.isCellEditable(n))continue;const h=this.valueService.getDeleteValue(c,n);n.setDataValue(c,h,s)}})}),i&&(this.eventService.dispatchEvent({type:"cellSelectionDeleteEnd",source:r}),this.eventService.dispatchEvent({type:"rangeDeleteEnd",source:r}))}createCellRangeFromCellRangeParams(e){return this.createPartialCellRangeFromRangeParams(e,!1)}createPartialCellRangeFromRangeParams(e,t){let s,i=!1;if(e.columns)s=e.columns.map(o=>this.columnModel.getCol(o)).filter(o=>o);else{const o=this.columnModel.getCol(e.columnStart),n=this.columnModel.getCol(e.columnEnd);if(!o||!n)return;s=this.calculateColumnsBetween(o,n),s&&s.length&&(i=s[0]!==o)}if(!s||!t&&s.length===0)return;const r=e.rowStartIndex!=null?{rowIndex:e.rowStartIndex,rowPinned:e.rowStartPinned||null}:void 0,a=e.rowEndIndex!=null?{rowIndex:e.rowEndIndex,rowPinned:e.rowEndPinned||null}:void 0;return{startRow:r,endRow:a,columns:s,startColumn:i?oe(s):s[0]}}addCellRange(e){const t=this.gos;if(!Ws(t))return;if(Qf(t)&&zs(t)&&this.cellRanges.length>0)return $n("cannot add multiple ranges when `cellSelection.suppressMultiRanges = true`");const s=this.createCellRangeFromCellRangeParams(e);s&&(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))}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;this.cellRanges.forEach(i=>{this.forEachRowInRange(i,r=>{const a=`${r.rowPinned||"normal"}_${r.rowIndex}`,o=e.get(a),n=i.columns.map(l=>l.getId());if(o){const l=n.filter(c=>o.indexOf(c)===-1);o.push(...l)}else e.set(a,n)})});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}forEachRowInRange(e,t){const s=this.getRangeStartRow(e),i=this.getRangeEndRow(e);let r=s;for(;r&&(t(r),!this.rowPositionUtils.sameRow(r,i));)r=this.cellNavigationService.getRowBelow(r)}removeAllCellRanges(e){this.isEmpty()||(this.onDragStop(),this.cellRanges.length=0,e||this.dispatchChangedEvent(!1,!0))}onBodyScroll(){this.dragging&&this.lastMouseEvent&&this.onDragging(this.lastMouseEvent)}isCellInAnyRange(e){return this.getCellRangeCount(e)>0}isCellInSpecificRange(e,t){const s=t.columns!==null&&Wn(t.columns,e.column),i=this.isRowInRange(e.rowIndex,e.rowPinned,t);return s&&i}isLastCellOfRange(e,t){const{startRow:s,endRow:i}=e,r=this.rowPositionUtils.before(s,i)?i:s,a=t.rowIndex===r.rowIndex&&t.rowPinned===r.rowPinned,o=e.columns[0],n=oe(e.columns),l=e.startColumn===o?n:o;return t.column===l&&a}isBottomRightCell(e,t){const s=this.visibleColsService.getAllCols(),i=e.columns.map(c=>s.indexOf(c)).sort((c,h)=>c-h),{startRow:r,endRow:a}=e,o=this.rowPositionUtils.before(r,a)?a:r,n=s.indexOf(t.column)===oe(i),l=t.rowIndex===o.rowIndex&&Kn(t.rowPinned)===Kn(o.rowPinned);return n&&l}getCellRangeCount(e){return this.isEmpty()?0:this.cellRanges.filter(t=>this.isCellInSpecificRange(e,t)).length}isRowInRange(e,t,s){const i=this.getRangeStartRow(s),r=this.getRangeEndRow(s),a={rowIndex:e,rowPinned:t||null},o=a.rowIndex===i.rowIndex&&a.rowPinned==i.rowPinned,n=a.rowIndex===r.rowIndex&&a.rowPinned==r.rowPinned;if(o||n)return!0;const l=!this.rowPositionUtils.before(a,i),c=this.rowPositionUtils.before(a,r);return l&&c}getDraggingRange(){return this.draggingRange}onDragStart(e){if(!Ws(this.gos))return;const{ctrlKey:t,metaKey:s,shiftKey:i}=e,r=t||s,o=!zs(this.gos)?r:!1,n=i&&Xf(this.cellRanges);!o&&(!n||qf(oe(this.cellRanges).type))&&this.removeAllCellRanges(!0);const l=this.dragService.getStartTarget();if(l&&this.updateValuesOnMove(l),!!this.lastCellHovered){if(this.dragging=!0,this.lastMouseEvent=e,this.intersectionRange=o&&this.getCellRangeCount(this.lastCellHovered)>1,n||this.setNewestRangeStartCell(this.lastCellHovered),this.cellRanges.length>0)this.draggingRange=oe(this.cellRanges);else{const c={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned};this.draggingRange={startRow:c,endRow:c,columns:[this.lastCellHovered.column],startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsService.getGridBodyCtrl().addScrollEventListener(this.bodyScrollListener),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}}intersectLastRange(e){if(e&&this.dragging||zs(this.gos)||this.isEmpty())return;const t=this.rowPositionUtils,s=oe(this.cellRanges),i=this.getRangeStartRow(s),r=this.getRangeEndRow(s),a=[];this.cellRanges.slice(0,-1).forEach(o=>{const n=this.getRangeStartRow(o),l=this.getRangeEndRow(o),c=o.columns,h=c.filter(u=>s.columns.indexOf(u)===-1);if(h.length===c.length){a.push(o);return}if(t.before(r,n)||t.before(l,i)){a.push(o);return}const d=a.length;if(t.before(n,i)){const u={columns:[...c],startColumn:s.startColumn,startRow:{...n},endRow:this.cellNavigationService.getRowAbove(i)};a.push(u)}if(h.length>0){const u={columns:h,startColumn:Wn(h,s.startColumn)?s.startColumn:h[0],startRow:this.rowMax([{...i},{...n}]),endRow:this.rowMin([{...r},{...l}])};a.push(u)}t.before(r,l)&&a.push({columns:[...c],startColumn:s.startColumn,startRow:this.cellNavigationService.getRowBelow(r),endRow:{...l}}),a.length-d===1&&(a[a.length-1].id=o.id)}),this.cellRanges=a,e&&this.dispatchChangedEvent(!1,!0)}rowMax(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(t,s))&&(t=s)}),t}rowMin(e){let t;return e.forEach(s=>{(t===void 0||this.rowPositionUtils.before(s,t))&&(t=s)}),t}updateValuesOnMove(e){const t=Zf(this.gos,e,jf.DOM_DATA_KEY_CELL_CTRL),s=t?.getCellPosition();if(this.cellHasChanged=!1,!(!s||this.lastCellHovered&&this.cellPositionUtils.equals(s,this.lastCellHovered))){if(t?.isEditing()){this.dragService.cancelDrag(e);return}this.lastCellHovered&&(this.cellHasChanged=!0),this.lastCellHovered=s}}onDragging(e){if(!this.dragging||!e)return;this.updateValuesOnMove(e.target),this.lastMouseEvent=e;const t=this.lastCellHovered,s=a=>t&&t.rowPinned===a&&this.newestRangeStartCell.rowPinned===a,i=s("top")||s("bottom");if(this.autoScrollService.check(e,i),!this.cellHasChanged)return;const r=this.calculateColumnsBetween(this.newestRangeStartCell.column,t.column);r&&(this.draggingRange.endRow={rowIndex:t.rowIndex,rowPinned:t.rowPinned},this.draggingRange.columns=r,this.dispatchChangedEvent(!1,!1,this.draggingRange.id))}onDragStop(){if(!this.dragging)return;const{id:e}=this.draggingRange;this.autoScrollService.ensureCleared(),this.ctrlsService.getGridBodyCtrl().removeScrollEventListener(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)}dispatchChangedEvent(e,t,s){this.eventService.dispatchEvent({type:"cellSelectionChanged",started:e,finished:t,id:s}),this.eventService.dispatchEvent({type:"rangeSelectionChanged",started:e,finished:t,id:s})}calculateColumnsBetween(e,t){const s=this.visibleColsService.getAllCols(),i=e===t,r=s.indexOf(e),a=h=>$n(`column ${h.getId()} is not visible`);if(r<0){a(e);return}const o=i?r:s.indexOf(t);if(o<0){a(t);return}if(i)return[e];const n=Math.min(r,o),l=n===r?o:r,c=[];for(let h=n;h<=l;h++)c.push(s[h]);return c}},Xn=class extends nC{constructor(){super(...arguments),this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}wireBeans(e){this.dragService=e.dragService,this.rangeService=e.rangeService,this.mouseEventService=e.mouseEventService,this.rowPositionUtils=e.rowPositionUtils,this.cellPositionUtils=e.cellPositionUtils,this.ctrlsService=e.ctrlsService}postConstruct(){this.dragService.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragStart:this.onDragStart.bind(this),onDragging:e=>{this.dragging=!0,this.rangeService.autoScrollService.check(e),this.changedCalculatedValues&&(this.onDrag(e),this.changedCalculatedValues=!1)},onDragStop:e=>{this.dragging=!1,this.onDragEnd(e),this.clearDragProperties(),this.shouldDestroyOnEndDragging&&this.destroy()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedElementListeners(this.getGui(),{mousedown:this.preventRangeExtension.bind(this)})}isDragging(){return this.dragging}getCellCtrl(){return this.cellCtrl}setCellCtrl(e){this.cellCtrl=e}getCellRange(){return this.cellRange}setCellRange(e){this.cellRange=e}getRangeStartRow(){return this.rangeStartRow}setRangeStartRow(e){this.rangeStartRow=e}getRangeEndRow(){return this.rangeEndRow}setRangeEndRow(e){this.rangeEndRow=e}getLastCellHovered(){return this.lastCellHovered}preventRangeExtension(e){e.stopPropagation()}onDragStart(e){[this.cellHoverListener]=this.addManagedElementListeners(this.ctrlsService.get("gridCtrl").getGui(),{mousemove:this.updateValuesOnMove.bind(this)}),document.body.classList.add(this.getDraggingCssClass())}getDraggingCssClass(){return`ag-dragging-${this.type===lC.FILL?"fill":"range"}-handle`}updateValuesOnMove(e){const t=this.mouseEventService.getCellPositionForEvent(e);!t||this.lastCellHovered&&this.cellPositionUtils.equals(t,this.lastCellHovered)||(this.lastCellHovered=t,this.changedCalculatedValues=!0)}clearDragProperties(){this.clearValues(),this.rangeService.autoScrollService.ensureCleared(),document.body.classList.remove(this.getDraggingCssClass())}getType(){return this.type}refresh(e){const t=this.getCellCtrl(),s=this.getGui(),i=hC(this.rangeService.getCellRanges()),r=i.startRow,a=i.endRow;if(r&&a&&(this.rowPositionUtils.before(a,r)?(this.setRangeStartRow(a),this.setRangeEndRow(r)):(this.setRangeStartRow(r),this.setRangeEndRow(a))),t!==e||!cC(s)){this.setCellCtrl(e);const o=e.getComp().getParentOfValue();o&&o.appendChild(s)}this.setCellRange(i)}clearValues(){this.lastCellHovered=void 0,this.removeListeners()}removeListeners(){this.cellHoverListener&&(this.cellHoverListener(),this.cellHoverListener=void 0)}destroy(){if(!this.shouldDestroyOnEndDragging&&this.isDragging()){dC(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.removeListeners();const e=this.getGui();e.parentElement&&e.parentElement.removeChild(e)}};function fC(e){const t=e.length;let s=0;if(t<=1)return e;for(let d=0;d<e.length;d++){const u=e[d],p=u.toString().split("e-");if(p.length>1){s=Math.max(s,parseInt(p[1],10));continue}Math.floor(u)!==u&&(s=Math.max(s,u.toString().split(".")[1].length))}let i=0,r=0,a=0,o=0,n=0;for(let d=0;d<t;d++)n=e[d],i+=d,r+=n,o+=d*d,a+=d*n;const l=(t*a-i*r)/(t*o-i*i),c=r/t-l*i/t,h=[];for(let d=0;d<=t;d++)h.push(parseFloat((d*l+c).toFixed(s)));return h}var CC=class extends Xn{constructor(){super('<div class="ag-fill-handle"></div>'),this.markedCells=[],this.cellValues=[],this.isUp=!1,this.isLeft=!1,this.isReduce=!1,this.type=rC.FILL}wireBeans(e){super.wireBeans(e),this.valueService=e.valueService,this.navigationService=e.navigationService,this.cellNavigationService=e.cellNavigationService,this.visibleColsService=e.visibleColsService}updateValuesOnMove(e){super.updateValuesOnMove(e),this.initialXY||(this.initialXY=this.mouseEventService.getNormalisedPosition(e));const{x:t,y:s}=this.initialXY,{x:i,y:r}=this.mouseEventService.getNormalisedPosition(e),a=Math.abs(t-i),o=Math.abs(s-r),n=this.getFillHandleDirection();let l;n==="xy"?l=a>o?"x":"y":l=n,l!==this.dragAxis&&(this.dragAxis=l,this.changedCalculatedValues=!0)}onDrag(e){if(!this.initialPosition){const s=this.getCellCtrl();if(!s)return;this.initialPosition=s.getCellPosition()}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",s=this.getCellRange(),i=s.columns.length,r=this.getRangeStartRow(),a=this.getRangeEndRow();let o;if(!this.isUp&&!this.isLeft)o=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:r.rowIndex,rowStartPinned:r.rowPinned,columnStart:s.columns[0],rowEndIndex:t?a.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:t?a.rowPinned:this.lastCellMarked.rowPinned,columnEnd:t?this.lastCellMarked.column:s.columns[i-1]});else{const n=t?r:this.lastCellMarked;o=this.rangeService.createCellRangeFromCellRangeParams({rowStartIndex:n.rowIndex,rowStartPinned:n.rowPinned,columnStart:t?this.lastCellMarked.column:s.columns[0],rowEndIndex:a.rowIndex,rowEndPinned:a.rowPinned,columnEnd:s.columns[i-1]})}o&&(this.eventService.dispatchEvent({type:"fillStart"}),this.handleValueChanged(s,o,e),this.rangeService.setCellRanges([o]),this.eventService.dispatchEvent({type:"fillEnd",initialRange:s,finalRange:o}))}onDragCancel(){this.initialXY=null,this.markedCells.length&&this.clearMarkedPath()}getFillHandleDirection(){const e=mr(this.gos)?.direction;return e?e!=="x"&&e!=="y"&&e!=="xy"?(oC("valid values for fillHandleDirection are 'x', 'y' and 'xy'. Default to 'xy'."),"xy"):e:"xy"}handleValueChanged(e,t,s){const i=this.rangeService.getRangeEndRow(e),r=this.rangeService.getRangeStartRow(e),a=this.rangeService.getRangeEndRow(t),o=this.rangeService.getRangeStartRow(t),n=this.dragAxis==="y";if(this.isReduce&&!mr(this.gos)?.suppressClearOnFillReduction){const f=n?e.columns:e.columns.filter(S=>t.columns.indexOf(S)<0),v=n?this.cellNavigationService.getRowBelow(a):o;v&&this.clearCellsInRange(v,i,f);return}const l=[],c=[],h=[],d=[];let u=!0,p=0;const g=()=>{l.length=0,c.length=0,h.length=0,d.length=0,p=0},m=(f,v)=>{let S=this.isUp?i:r,y=!1;for(n&&(u=!0,g());!y&&S;){const w=this.rowPositionUtils.getRowNode(S);if(!w)break;n&&f?C(l,f,w,()=>!this.rowPositionUtils.sameRow(S,this.isUp?r:i)):v&&(u=!0,g(),v.forEach(b=>C(l,b,w,()=>b!==(this.isLeft?e.columns[0]:Ks(e.columns))))),y=this.rowPositionUtils.sameRow(S,this.isUp?o:a),S=this.isUp?this.cellNavigationService.getRowAbove(S):this.cellNavigationService.getRowBelow(S)}},C=(f,v,S,y)=>{let w,b=!1;if(u)w=this.valueService.getValue(v,S),c.push(w),h.push(this.valueService.getValue(v,S,void 0,!0)),d.push(this.valueService.formatValue(v,S,w)),u=y();else{const{value:P,fromUserFunction:F,sourceCol:A,sourceRowNode:M}=this.processValues({event:s,values:f,initialValues:c,initialNonAggregatedValues:h,initialFormattedValues:d,col:v,rowNode:S,idx:p++});if(w=P,v.isCellEditable(S)){const I=this.valueService.getValue(v,S);F||(A&&A.getColDef()?.useValueFormatterForExport!==!1&&(w=this.valueService.formatValue(A,M,w)??w),v.getColDef().useValueParserForImport!==!1&&(w=this.valueService.parseValue(v,S,A?w:aC(w),I))),!F||I!==w?S.setDataValue(v,w,"rangeService"):b=!0}}b||f.push({value:w,column:v,rowNode:S})};if(n)e.columns.forEach(f=>{m(f)});else{const f=this.isLeft?[...t.columns].reverse():t.columns;m(void 0,f)}}clearCellsInRange(e,t,s){const i={startRow:e,endRow:t,columns:s,startColumn:s[0]};this.rangeService.clearCellRangeCellValues({cellRanges:[i]})}processValues(e){const{event:t,values:s,initialValues:i,initialNonAggregatedValues:r,initialFormattedValues:a,col:o,rowNode:n,idx:l}=e,c=mr(this.gos)?.setFillValue,h=this.dragAxis==="y";let d;if(h?d=this.isUp?"up":"down":d=this.isLeft?"left":"right",c){const p=this.gos.addGridCommonParams({event:t,values:s.map(({value:m})=>m),initialValues:i,initialNonAggregatedValues:r,initialFormattedValues:a,currentIndex:l,currentCellValue:this.valueService.getValue(o,n),direction:d,column:o,rowNode:n}),g=c(p);if(g!==!1)return{value:g,fromUserFunction:!0}}const u=!s.some(({value:p})=>{const g=parseFloat(p);return isNaN(g)||g.toString()!==p.toString()});if(t.altKey||!u){if(u&&i.length===1){const C=this.isUp||this.isLeft?-1:1;return{value:parseFloat(Ks(s).value)+1*C,fromUserFunction:!1}}const{value:p,column:g,rowNode:m}=s[l%s.length];return{value:p,fromUserFunction:!1,sourceCol:g,sourceRowNode:m}}return{value:Ks(fC(s.map(({value:p})=>Number(p)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){this.markedCells.forEach(e=>{if(!e.isAlive())return;const t=e.getComp();t.addOrRemoveCssClass("ag-selection-fill-top",!1),t.addOrRemoveCssClass("ag-selection-fill-right",!1),t.addOrRemoveCssClass("ag-selection-fill-bottom",!1),t.addOrRemoveCssClass("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(this.rowPositionUtils.sameRow(t,e))return;const s=this.rowPositionUtils.before(t,e),i=this.getRangeStartRow(),r=this.getRangeEndRow();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=this.visibleColsService.getAllCols(),a=r.indexOf(s),o=r.indexOf(i);o<=a&&o>=r.indexOf(this.getCellRange().columns[0])?(this.reduceHorizontal(e,t),this.isReduce=!0):(this.extendHorizontal(e,t,o<a),this.isReduce=!1)}this.lastCellMarked=t}extendVertical(e,t,s){const{navigationService:i,rangeService:r}=this;let a=e;do{const o=this.getCellRange(),n=o.columns.length;for(let l=0;l<n;l++){const c=o.columns[l],d={...{rowIndex:a.rowIndex,rowPinned:a.rowPinned},column:c},u=r.isCellInSpecificRange(d,o),p=this.rowPositionUtils.sameRow(a,e);if(s&&(this.isUp=!0),!p){const g=i.getCellByPosition(d);if(g){this.markedCells.push(g);const m=g.getComp();u||(m.addOrRemoveCssClass("ag-selection-fill-left",l===0),m.addOrRemoveCssClass("ag-selection-fill-right",l===n-1)),m.addOrRemoveCssClass(s?"ag-selection-fill-top":"ag-selection-fill-bottom",this.rowPositionUtils.sameRow(a,t))}}}if(this.rowPositionUtils.sameRow(a,t))break}while(a=s?this.cellNavigationService.getRowAbove(a):this.cellNavigationService.getRowBelow(a))}reduceVertical(e,t){let s=e;do{const i=this.getCellRange(),r=i.columns.length,a=this.rowPositionUtils.sameRow(s,t);for(let o=0;o<r;o++){const l={...{rowIndex:s.rowIndex,rowPinned:s.rowPinned},column:i.columns[o]},c=this.navigationService.getCellByPosition(l);c&&(this.markedCells.push(c),c.getComp().addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(s,t)))}if(a)break}while(s=this.cellNavigationService.getRowAbove(s))}extendHorizontal(e,t,s){const i=this.visibleColsService.getAllCols(),r=i.indexOf(s?t.column:e.column),a=i.indexOf(s?this.getCellRange().columns[0]:t.column),o=s?0:1,n=i.slice(r+o,a+o),l=this.getRangeStartRow(),c=this.getRangeEndRow();n.forEach(h=>{let d=l,u=!1;do{u=this.rowPositionUtils.sameRow(d,c);const p=this.navigationService.getCellByPosition({rowIndex:d.rowIndex,rowPinned:d.rowPinned,column:h});if(p){this.markedCells.push(p);const g=p.getComp();g.addOrRemoveCssClass("ag-selection-fill-top",this.rowPositionUtils.sameRow(d,l)),g.addOrRemoveCssClass("ag-selection-fill-bottom",this.rowPositionUtils.sameRow(d,c)),s?(this.isLeft=!0,g.addOrRemoveCssClass("ag-selection-fill-left",h===n[0])):g.addOrRemoveCssClass("ag-selection-fill-right",h===Ks(n))}d=this.cellNavigationService.getRowBelow(d)}while(!u)})}reduceHorizontal(e,t){const s=this.visibleColsService.getAllCols(),i=s.indexOf(t.column),r=s.indexOf(e.column),a=s.slice(i,r),o=this.getRangeStartRow(),n=this.getRangeEndRow();a.forEach(l=>{let c=o,h=!1;do{h=this.rowPositionUtils.sameRow(c,n);const d=this.navigationService.getCellByPosition({rowIndex:c.rowIndex,rowPinned:c.rowPinned,column:l});d&&(this.markedCells.push(d),d.getComp().addOrRemoveCssClass("ag-selection-fill-right",l===a[0])),c=this.cellNavigationService.getRowBelow(c)}while(!h)})}refresh(e){const t=this.rangeService.getCellRanges()[0];if(!t.startRow||!t.endRow){this.destroy();return}super.refresh(e)}},vC=class extends Xn{constructor(){super('<div class="ag-range-handle"></div>'),this.type=uC.RANGE,this.rangeFixed=!1}onDrag(e){const t=this.getLastCellHovered();if(!t)return;const s=this.rangeService.getCellRanges(),i=Yn(s);this.rangeFixed||(this.fixRangeStartEnd(i),this.rangeFixed=!0),this.endPosition={rowIndex:t.rowIndex,rowPinned:t.rowPinned,column:t.column},s.length===2&&s[0].type===jn.DIMENSION&&i.type===jn.VALUE&&!this.rowPositionUtils.sameRow(this.endPosition,this.rangeService.getRangeEndRow(i))&&this.rangeService.updateRangeEnd(s[0],{...this.endPosition,column:s[0].columns[0]},!0),this.rangeService.extendLatestRangeToCell(this.endPosition)}onDragEnd(e){const t=Yn(this.rangeService.getCellRanges());this.fixRangeStartEnd(t),this.rangeFixed=!1}onDragCancel(){this.rangeFixed=!1}fixRangeStartEnd(e){const t=this.rangeService.getRangeStartRow(e),s=this.rangeService.getRangeEndRow(e),i=e.columns[0];e.startRow=t,e.endRow=s,e.startColumn=i}},SC=class extends sC{constructor(){super(...arguments),this.beanName="selectionHandleFactory"}createSelectionHandle(e){return this.createBean(e===iC.RANGE?new vC:new CC)}},fr="32.3.3",Zn=gr({version:fr,moduleName:`${pr.RangeSelectionModule}-core`,beans:[mC,SC],dependantModules:[H]}),yC=gr({version:fr,moduleName:`${pr.RangeSelectionModule}-api`,apiFunctions:{getCellRanges:pC,addCellRange:gC,clearRangeSelection:qn,clearCellSelection:qn},dependantModules:[Zn]}),$s=gr({version:fr,moduleName:pr.RangeSelectionModule,dependantModules:[Zn,yC]});import{BeanStub as wC,TabGuardComp as xC}from"ag-grid-community";import{Component as bC}from"ag-grid-community";import{ChartMappings as Jn}from"ag-grid-community";import{BeanStub as PC,_removeFromParent as TC}from"ag-grid-community";import{AgInputNumberFieldSelector as MC,Component as FC}from"ag-grid-community";import{AgCheckboxSelector as AC,Component as RC}from"ag-grid-community";import{AgPickerField as EC,_getDocument as IC}from"ag-grid-community";import{_Util as DC}from"ag-charts-community";import{Component as LC,KeyCode as xe,RefPlaceholder as be,_exists as kC,_setDisplayed as GC}from"ag-grid-community";import{_Util as Qe}from"ag-charts-community";import{AgInputTextField as OC,RefPlaceholder as BC}from"ag-grid-community";import{_Util as Cr}from"ag-charts-community";import{AgCheckboxSelector as NC,Component as VC}from"ag-grid-community";import{AgAbstractLabel as _C,AgInputNumberFieldSelector as UC,RefPlaceholder as vr}from"ag-grid-community";import{AgAbstractInputField as HC}from"ag-grid-community";import{AgCheckboxSelector as zC,Component as WC,RefPlaceholder as KC}from"ag-grid-community";import{BeanStub as $C,Component as jC,RefPlaceholder as YC,_createIconNoSpan as qC,_isNothingFocused as XC}from"ag-grid-community";import{BeanStub as ZC,_includes as Qn,_isClientSideRowModel as JC,_warnOnce as QC}from"ag-grid-community";import{BeanStub as ev,_warnOnce as el}from"ag-grid-community";import{BeanStub as tv}from"ag-grid-community";import{BeanStub as sv,_warnOnce as js}from"ag-grid-community";import{VERSION as iv,_ModuleSupport as rv}from"ag-charts-community";import{Component as av,RefPlaceholder as Ys,_clearElement as ov,_getAbsoluteHeight as nv,_getAbsoluteWidth as lv,_includes as tl,_mergeDeep as cv,_removeFromParent as hv,_setDisplayed as sl,_warnOnce as il}from"ag-grid-community";import{BeanStub as dv,_warnOnce as rl}from"ag-grid-community";import{_ModuleSupport as uv,_Theme as pv}from"ag-charts-community";import{_includes as al,_warnOnce as gv}from"ag-grid-community";import{_Theme as ol}from"ag-charts-community";import{BeanStub as mv,CellRangeType as Vt,_includes as nl}from"ag-grid-community";import{BeanStub as fv,ModuleNames as Cv,_includes as vv,_isClientSideRowModel as Sv,_isServerSideRowModel as yv,_last as wv,_values as xv,_warnOnce as ll}from"ag-grid-community";import{BeanStub as bv,_missingOrEmpty as Pv,_warnOnce as Tv}from"ag-grid-community";import{BeanStub as Mv,_warnOnce as Sr}from"ag-grid-community";import{_warnOnce as _t}from"ag-grid-community";import{_ModuleSupport as Fv}from"ag-charts-community";import{AgCharts as Av,_ModuleSupport as Rv,_Theme as Ev}from"ag-charts-community";import{_includes as Iv}from"ag-grid-community";import{_Util as cl}from"ag-charts-community";import{GROUP_AUTO_COLUMN_ID as Dv}from"ag-grid-community";import{AgPromise as Lv,Component as kv,_warnOnce as Gv}from"ag-grid-community";import{Component as Ov,RefPlaceholder as Bv,_clearElement as Nv,_createIconNoSpan as Vv,_getDocument as _v}from"ag-grid-community";import{AgPromise as Uv,Component as Hv}from"ag-grid-community";import{AgToggleButton as zv,Component as Wv,_getDocument as Kv,_setDisplayed as $v,_warnOnce as jv}from"ag-grid-community";import{AgSelect as Yv,AgToggleButton as qv}from"ag-grid-community";import{AgSelect as Xv,Component as Zv}from"ag-grid-community";import{AgSelect as Jv,Component as Qv,DragSourceType as hl,_escapeString as eS,_getActiveDomElement as tS,_removeFromParent as sS}from"ag-grid-community";import{AgSelect as dl,ChartMappings as iS,Component as rS,RefPlaceholder as aS}from"ag-grid-community";import{BeanStub as oS}from"ag-grid-community";import{AgCheckbox as nS,AgSelect as lS,Component as cS,_areEqual as hS,_clearElement as dS}from"ag-grid-community";import{AgToggleButton as uS}from"ag-grid-community";import{Component as pS,_warnOnce as yr}from"ag-grid-community";import{AgCheckbox as gS,AgSelectSelector as mS,Component as fS,RefPlaceholder as qs,_removeFromParent as ul,_setDisplayed as CS}from"ag-grid-community";import{AgAbstractLabel as vS,AgInputNumberFieldSelector as SS,RefPlaceholder as Xs,_exists as yS,_getActiveDomElement as wS,_setFixedWidth as xS}from"ag-grid-community";import{AgSelectSelector as bS,Component as PS,RefPlaceholder as TS,_capitalise as MS,_includes as FS,_removeFromParent as AS}from"ag-grid-community";import{Component as RS}from"ag-grid-community";import{Component as ES}from"ag-grid-community";import{AgSelect as IS,Component as DS,RefPlaceholder as LS}from"ag-grid-community";import{Component as kS,RefPlaceholder as GS}from"ag-grid-community";import{Component as OS}from"ag-grid-community";import{Component as BS,RefPlaceholder as NS}from"ag-grid-community";import{BeanStub as VS}from"ag-grid-community";import{AgCheckbox as _S,AgSelect as US,Component as HS,RefPlaceholder as zS}from"ag-grid-community";import{AgSelect as wr,AgToggleButton as WS,Component as KS,RefPlaceholder as $S,_errorOnce as jS,_removeFromParent as YS}from"ag-grid-community";import{Component as qS}from"ag-grid-community";import{Component as XS}from"ag-grid-community";import{Component as ZS}from"ag-grid-community";import{AgSelectSelector as JS,Component as QS}from"ag-grid-community";import{AgSelectSelector as ey,Component as ty,RefPlaceholder as sy,_removeFromParent as iy}from"ag-grid-community";import{Component as ry}from"ag-grid-community";import{Component as ay}from"ag-grid-community";import{Component as oy}from"ag-grid-community";import{Component as ny,RefPlaceholder as ly}from"ag-grid-community";import{AgInputTextField as cy,Component as hy}from"ag-grid-community";import{Component as dy,RefPlaceholder as Ut,_clearElement as pl,_createIconNoSpan as gl,_getAbsoluteWidth as uy,_radioCssClass as ml,_setDisplayed as py,_shallowCompare as gy}from"ag-grid-community";import{Component as my,KeyCode as fl,_setAriaLabel as fy,_warnOnce as Cl}from"ag-grid-community";Zo(hr,Ty);import{_Scene as ne}from"ag-charts-community";import{_Scene as vl}from"ag-charts-community";import{Component as Cy,_errorOnce as vy}from"ag-grid-community";import{_Scene as Sl}from"ag-charts-community";import{_Scene as xr}from"ag-charts-community";import{_Scene as br}from"ag-charts-community";import{_Scene as yl}from"ag-charts-community";import{_Scene as Ht}from"ag-charts-community";import{_Scene as zt}from"ag-charts-community";import{_Scene as Pr}from"ag-charts-community";import{_Scene as Tr}from"ag-charts-community";import{_Scene as Mr}from"ag-charts-community";import{_Scene as Wt}from"ag-charts-community";import{_Scene as wl}from"ag-charts-community";import{_Scene as Zs}from"ag-charts-community";import{_Scene as Js}from"ag-charts-community";import{_Scene as Fr}from"ag-charts-community";import{_Scene as Kt}from"ag-charts-community";import{_Scene as Pe,_Theme as Sy,_Util as yy}from"ag-charts-community";import{_Scene as Ar,_Theme as wy}from"ag-charts-community";import{_Scene as xl}from"ag-charts-community";import{_Scene as $t,_Theme as bl,_Util as xy}from"ag-charts-community";import{_Scene as Qs,_Theme as ei}from"ag-charts-community";import{_Scene as Rr}from"ag-charts-community";import{_Scene as Er}from"ag-charts-community";import{BeanStub as by,_errorOnce as Py}from"ag-grid-community";import*as Ty from"ag-charts-community";var Pl={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,isEnterprise:!0,canSwitchDirection:!0},"range-area":{isCartesian:!0,isEnterprise:!0},"box-plot":{isCartesian:!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}};function My(e){return!!Pl[e]}function Ir(e){return Jn.COMBO_CHART_TYPES.includes(e)}function Ne(e,t){return!!Pl[e]?.[t]}function Fy(e){return Ne(O(e),"isEnterprise")}var Ay=new Set(["stackedColumn","normalizedColumn","stackedBar","normalizedBar"]);function Ry(e){return Ay.has(e)}function Ve(e){return Ne(e,"isCartesian")}function Dr(e){return Ne(e,"isPolar")}function Ey(e){return Ne(e,"isRadial")}function et(e){return Ne(e,"isHierarchical")}function jt(e){return e==="doughnut"?"donut":e}function Tl(e){return Jn.CHART_TYPE_TO_SERIES_TYPE[e]}function O(e){return Tl(e)??"line"}function Ml(e){return Ne(e,"isPie")}function Iy(e){return e==="pie"||e==="waterfall"||e==="histogram"}function Lr(e){return et(O(e))?void 0:1}function ti(e){return et(O(e))?2:Iy(e)?1:void 0}function Fl(e){return!Ir(e)&&Ne(O(e),"canInvert")}function Dy(e){return Ne(O(e),"canSwitchDirection")}function kr(e){switch(e){case"groupedColumn":case"stackedColumn":case"normalizedColumn":case"groupedBar":case"stackedBar":case"normalizedBar":case"stackedArea":case"normalizedArea":return`${e}Full`;case"doughnut":return"donut";case"areaColumnCombo":return"AreaColumnCombo";default:return e}}var Al=class extends PC{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.addCssClass(this.cssClass),this.eGui.appendChild(e.getGui())}refreshPanels(e){const t=this.chartController.getChartType(),s=this.chartController.isGrouping(),i=O(t);e&&t===this.chartType&&s===this.isGrouping||(this.destroyPanels(),this.createPanels(t,i),this.chartType=t,this.isGrouping=s)}destroyPanels(){this.panels.forEach(e=>{TC(e.getGui()),this.destroyBean(e)}),this.panels=[]}destroy(){this.destroyPanels(),super.destroy()}},Ly=class extends FC{constructor(e){super(),this.chartMenuParamsFactory=e}wireBeans(e){this.chartTranslationService=e.chartTranslationService}postConstruct(){const e=this.chartMenuParamsFactory.addEnableParams("animation.enabled",{cssIdentifier:"charts-advanced-settings-top-level",direction:"vertical",suppressOpenCloseIcons:!0,title:this.chartTranslationService.translate("animation"),suppressEnabledCheckbox:!0,useToggle:!0}),t=this.chartMenuParamsFactory.getDefaultNumberInputParams("animation.duration","durationMillis",{min:0});this.setTemplate(`<div>
136
136
  <ag-group-component data-ref="animationGroup">
137
137
  <ag-input-number-field data-ref="animationHeightInput"></ag-input>
138
138
  </ag-group-component>
@@ -188,7 +188,7 @@ var Yo=Object.defineProperty,Fu=Object.getOwnPropertyDescriptor,Au=Object.getOwn
188
188
  </ag-group-component>
189
189
  </div>`,[G,zC,ie],{zoomGroup:e,zoomScrollingCheckbox:t,zoomScrollingStepInput:s,zoomSelectingCheckbox:i}),this.zoomScrollingStepInput.setDisabled(!t.value)}},Hy=["navigator","zoom","animation","crosshair"],zy=class extends bC{constructor(e){super('<div class="ag-chart-advanced-settings-wrapper"></div>'),this.chartMenuContext=e}postConstruct(){this.chartPanelFeature=this.createManagedBean(new Al(this.chartMenuContext.chartController,this.getGui(),"ag-chart-advanced-settings-section",(e,t)=>this.createPanels(e,t))),this.chartPanelFeature.refreshPanels()}createPanels(e,t){Hy.forEach(s=>{if(!this.isGroupPanelShownForSeries(s,t))return;const i=this.createPanel(s);this.chartPanelFeature.addComponent(i)})}isGroupPanelShownForSeries(e,t){return e==="animation"||Ve(t)}createPanel(e){const{chartMenuParamsFactory:t,chartAxisMenuParamsFactory:s}=this.chartMenuContext;switch(e){case"navigator":return new _y(t);case"zoom":return new Uy(t);case"animation":return new Ly(t);case"crosshair":return new By(s)}}},Wy=class extends wC{constructor(){super(...arguments),this.beanName="advancedSettingsMenuFactory"}wireBeans(e){this.focusService=e.focusService,this.chartTranslationService=e.chartTranslationService}showMenu(e,t){this.hideMenu();const s=this.createBean(new Ky(e));this.activeDialog=this.createBean(new Ze({title:this.chartTranslationService.translate("advancedSettings"),component:s,width:300,height:400,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{this.focusService.findFocusableElements(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()}},Ky=class extends xC{constructor(e){super('<div class="ag-chart-advanced-settings"></div>'),this.chartMenuContext=e}wireBeans(e){this.focusService=e.focusService}postConstruct(){this.advancedSettingsPanel=this.createManagedBean(new zy(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=this.focusService.findNextFocusableElement(s,!1,t);if(i)i.focus();else{const r=this.focusService.findFocusableElements(s);r.length&&r[t?r.length-1:0].focus()}}},$y=class extends $C{constructor(){super(...arguments),this.beanName="chartMenuListFactory"}wireBeans(e){this.popupService=e.popupService,this.chartMenuService=e.chartMenuService,this.chartTranslationService=e.chartTranslationService}showMenuList(e){const{eventSource:t,showMenu:s,chartMenuContext:i}=e,r=this.chartMenuService.doChartToolPanelsExist(i.chartController),a=this.mapWithStockItems(this.getMenuItems(i.chartController,r),i,s,t,r);if(!a.length)return;const o=this.createBean(new jy(a));this.activeChartMenuList=o;let n=-1,l="left";this.gos.get("enableRtl")&&(n=1,l="right");const c=o.getGui();this.popupService.addPopup({modal:!0,eChild:c,closeOnEsc:!0,closedCallback:()=>{this.destroyBean(o),this.activeChartMenuList=void 0,XC(this.gos)&&t.focus({preventScroll:!0})},afterGuiAttached:h=>o.afterGuiAttached(h),positionCallback:()=>{this.popupService.positionPopupByComponent({type:"chartMenu",eventSource:t,ePopup:c,alignSide:l,nudgeX:4*n,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(this.gos.addGridCommonParams({defaultItems:s})):s}mapWithStockItems(e,t,s,i,r){if(!e)return[];const a=[];return e.forEach(o=>{let n;if(typeof o=="string"?n=this.getStockMenuItem(o,t,s,i,r):n={...o},!n)return;const{subMenu:l}=n;Array.isArray(l)&&(n.subMenu=this.mapWithStockItems(l,t,s,i,r)),a.push(n)}),a}getStockMenuItem(e,t,s,i,r){switch(e){case"chartEdit":return r?this.createMenuItem(this.chartTranslationService.translate("chartEdit"),"chartsMenuEdit",s):null;case"chartAdvancedSettings":return this.createMenuItem(this.chartTranslationService.translate("chartAdvancedSettings"),"chartsMenuAdvancedSettings",()=>this.chartMenuService.openAdvancedSettings(t,i));case"chartUnlink":return t.chartController.isChartLinked()?this.createMenuItem(this.chartTranslationService.translate("chartUnlink"),"unlinked",()=>this.chartMenuService.toggleLinked(t)):null;case"chartLink":return t.chartController.isChartLinked()?null:this.createMenuItem(this.chartTranslationService.translate("chartLink"),"linked",()=>this.chartMenuService.toggleLinked(t));case"chartDownload":return this.createMenuItem(this.chartTranslationService.translate("chartDownload"),"save",()=>this.chartMenuService.downloadChart(t))}return null}createMenuItem(e,t,s){return{name:e,icon:qC(t,this.gos,null),action:s}}destroy(){this.destroyBean(this.activeChartMenuList),super.destroy()}},jy=class extends jC{constructor(e){super(`
190
190
  <div data-ref="eChartsMenu" role="presentation" class="ag-menu ag-chart-menu-popup"></div>
191
- `),this.menuItems=e,this.eChartsMenu=YC}wireBeans(e){this.focusService=e.focusService}postConstruct(){this.mainMenuList=this.createManagedBean(new Je(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)),this.focusService.focusInto(this.mainMenuList.getGui())}},Yy=class Wo extends ZC{constructor(){super(...arguments),this.beanName="chartCrossFilterService"}wireBeans(t){this.columnModel=t.columnModel,this.valueService=t.valueService,this.filterManager=t.filterManager,JC(this.gos)&&(this.clientSideRowModel=t.rowModel)}filter(t,s=!1){const i=this.filterManager?.getFilterModel()??{};if(s){this.resetFilters(i);return}const r=Wo.extractFilterColId(t);this.isValidColumnFilter(r)?this.updateFilters(i,t,r):QC("cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: '"+r+"'")}resetFilters(t){Object.keys(t).length>0&&(this.filterManager?.setFilterModel(null),this.filterManager?.onFilterChanged({source:"api"}))}updateFilters(t,s,i){const r=Wo.extractFilterColId(s),a=s.datum[r];if(a===void 0)return;const o=a.toString();if(s.event.metaKey||s.event.ctrlKey){const n=this.getCurrentGridValuesForCategory(i),l=Qn(n,o);let c;l?c=n.filter(h=>h!==o):(c=n,c.push(o)),t[i]=this.getUpdatedFilterModel(i,c)}else{const n=[o];t={[i]:this.getUpdatedFilterModel(i,n)}}this.filterManager?.setFilterModel(t)}getUpdatedFilterModel(t,s){return this.getColumnFilterType(t)==="agMultiColumnFilter"?{filterType:"multi",filterModels:[null,{filterType:"set",values:s}]}:{filterType:"set",values:s}}getCurrentGridValuesForCategory(t){const s=[],i=this.getColumnById(t);return this.clientSideRowModel?.forEachNodeAfterFilter(r=>{if(i&&!r.group){const a=this.valueService.getValue(i,r)+"";s.includes(a)||s.push(a)}}),s}static extractFilterColId(t){return t.xKey||t.calloutLabelKey}isValidColumnFilter(t){t.indexOf("-filtered-out")&&(t=t.replace("-filtered-out",""));const s=this.getColumnFilterType(t);return typeof s=="boolean"?s:Qn(["agSetColumnFilter","agMultiColumnFilter"],s)}getColumnFilterType(t){const s=this.getColumnById(t);if(s)return s.getColDef().filter}getColumnById(t){return this.columnModel.getCol(t)}},qy=["chartUnlink","chartLink","chartDownload","chartMenu"],si={settings:"chartSettings",data:"chartData",format:"chartFormat"},Xy=class extends ev{constructor(){super(...arguments),this.beanName="chartMenuService"}wireBeans(e){this.advancedSettingsMenuFactory=e.advancedSettingsMenuFactory}downloadChart(e,t,s,i){e.chartController.getChartProxy().downloadChart(t,s,i)}toggleLinked(e){e.chartController.detachChartRange()}openAdvancedSettings(e,t){this.advancedSettingsMenuFactory.showMenu(e,t)}hideAdvancedSettings(){this.advancedSettingsMenuFactory.hideMenu()}getChartToolbarOptions(){const e=["chartMenu"],t=this.gos.getCallback("getChartToolbarItems");return t?t({defaultItems:e}).filter(i=>qy.includes(i)?!0:(el(`'${i}' is not a valid Chart Toolbar Option`),!1)):e}getChartToolPanels(e){const t=this.gos.get("chartToolPanelsDef");let i=t?.panels?.map(o=>{const n=si[o];return n||el(`Invalid panel in chartToolPanelsDef.panels: '${o}'`),n}).filter(o=>!!o)??Object.values(si);e.isPivotChart()&&(i=i.filter(o=>o!=="chartData"));const r=t?.defaultToolPanel,a=r&&si[r]||i[0];return{panels:i,defaultPanel:a}}doesChartToolbarExist(){return this.getChartToolbarOptions().length>0}doChartToolPanelsExist(e){const{panels:t}=this.getChartToolPanels(e);return t.length>0}},El=class lu extends tv{constructor(){super(...arguments),this.beanName="chartTranslationService"}translate(t){const s=this.localeService.getLocaleTextFunc(),i=lu.DEFAULT_TRANSLATIONS[t];return s(t,i)}};El.DEFAULT_TRANSLATIONS={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",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",invalidColor:"Color value is invalid",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",customCombo:"Custom Combination",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"};var Zy=El,tt="32.3.2",Il=["number","category","grouped-category","log","time"];function Jy(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"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 st(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 a=r[i[0]];return a??s}function Qy(e,t,s){if(e==null)return;const i=t.split(".");let r=e;i.forEach((a,o)=>{r[a]||(r[a]={}),o<i.length-1&&(r=r[a])}),r[i[i.length-1]]=s}function ew(e,t,s,i,r){const{chartOptionsToRestore:a,chartPaletteToRestore:o,chartThemeToRestore:n}=e,l=ow(e),c=Or(l),h=c?{baseTheme:l}:Dl(e,l)??{},d=e.getGridOptionsChartThemeOverrides(),u=e.apiChartThemeOverrides,p=O(e.chartType),g=e.crossFiltering?sw(t,e,p):void 0,f=[c?rw(e,s,(()=>{const v=S=>S?Object.keys(S).some(y=>st(S[y],"title.enabled",!1)):!1;return v(d)||v(u)})()):void 0,aw(),i,g,d,u,{...a??{}},r].filter(v=>!!v).reduce((v,S)=>({baseTheme:v,overrides:S}),h);if(o&&l===n){const v=ol.getChartTheme(h).palette;tw(o,v)||(f.palette=o)}return f}function tw(e,t){const s=(i,r)=>i===r?!0:i?.length!==r?.length?!1:i?.every((a,o)=>a===r?.[o])??!1;return s(e.fills,t.fills)&&s(e.strokes,t.strokes)}function Or(e){return al(Object.keys(ol.themes),e)}function sw(e,t,s){const i={listeners:{legendItemClick:r=>{e.getChart().series.forEach(o=>{o.toggleSeriesItem(r.itemId,r.enabled),o.toggleSeriesItem(`${r.itemId}-filtered-out`,r.enabled)})}}};return{[s]:{tooltip:{delay:500},legend:i,listeners:{click:r=>t.crossFilterCallback(r,!0)}}}}var iw=Il.reduce((e,t)=>({...e,[t]:{title:{_enabledFromTheme:!0}}}),{});function rw(e,t,s){const i=e.getExtraPaddingDirections();return{common:{...t?{animation:{duration:500}}:void 0,axes:iw,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 aw(){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 ow(e){let t=e.getChartThemeName();const s=e.getChartThemes();return al(s,t)||(t=s[0]),t}function Dl(e,t){const{customChartThemes:s}=e,i=s&&s[t];return i||gv(`no stock theme exists with the name '${t}' and no custom chart theme with that name was supplied to 'customChartThemes'`),i}var nw=class cu extends fv{wireBeans(t){this.sortController=t.sortController,this.gridRowModel=t.rowModel,this.columnModel=t.columnModel,this.valueService=t.valueService,this.pivotResultColsService=t.pivotResultColsService,this.rowNodeSorter=t.rowNodeSorter,this.aggregationStage=t.aggregationStage}getData(t){if(t.crossFiltering){if(t.grouping)return ll("crossing filtering with row grouping is not supported."),{chartData:[],columnNames:{}};if(!Sv(this.gos))return ll("crossing filtering is only supported in the client side row model."),{chartData:[],columnNames:{}}}yv(this.gos)&&t.pivoting&&this.updatePivotKeysForSSRM();const i=this.extractRowsFromGridRowModel(t);return i.chartData=this.aggregateRowsByDimension(t,i.chartData),i}extractRowsFromGridRowModel(t){const{crossFiltering:s,startRow:i,endRow:r,valueCols:a,dimensionCols:o,grouping:n}=t;let l=[];const c={},h={},d={};let u={},p=[],g;if(s)u=this.getFilteredRowNodes(),p=this.getAllRowNodes(),g=p.length;else{const v=this.gridRowModel.getRowCount()-1;i===r&&i===0&&o.length===0&&a.length===0?g=0:g=(r>=0?Math.min(r,v):v)-i+1}g>0&&a.forEach(v=>{let S=[];const y=v.getColDef().pivotKeys;y&&(S=y.slice());const w=v.getColDef().headerName;w&&S.push(w),S.length>0&&(c[v.getId()]=S)});let m=0,C=0;for(let v=0;v<g;v++){const S=s?p[v]:this.gridRowModel.getRow(v+i);if(S.footer||S.detail){m++;continue}const y={};o.forEach(w=>{const b=w.colId,P=this.columnModel.getCol(b);if(P){const F=this.valueService.getValue(P,S);if(n){const A=F?.toString?String(F.toString()):"",M=cu.getGroupLabels(S,A);y[b]={labels:M,id:C++,toString:function(){return this.labels.filter(B=>!!B).reverse().join(" - ")}},S.group&&(h[M.toString()]=v-m);const I=M.slice(1,M.length).toString();I&&(d[I]=h[I])}else y[b]=F}else y[Te.DEFAULT_CATEGORY]=v+1}),a.forEach(w=>{const b=w.getColId();if(s){const P=b+"-filtered-out",F=this.valueService.getValue(w,S),A=F!=null&&typeof F.toNumber=="function"?F.toNumber():F;u[S.id]?(y[b]=A,y[P]=t.aggFunc||t.isScatter?void 0:0):(y[b]=t.aggFunc||t.isScatter?void 0:0,y[P]=A)}else{let P=this.valueService.getValue(w,S);P&&Object.prototype.hasOwnProperty.call(P,"toString")&&(P=parseFloat(P.toString())),y[b]=P!=null&&typeof P.toNumber=="function"?P.toNumber():P}}),l.push(y)}let f;if(n){const v=xv(d),S=l;l=[],f=[];for(let y=0;y<S.length;y++)(vv(v,y)?f:l).push(S[y])}return{chartData:l,columnNames:c,groupChartData:f}}aggregateRowsByDimension(t,s){const i=t.dimensionCols;if(!t.aggFunc||i.length===0)return s;const r=wv(i),a=r&&r.colId,o={},n=[];if(s.forEach(l=>{let c=o;i.forEach(h=>{const d=h.colId,u=l[d];if(d===a){let p=c[u];p||(p={__children:[]},i.forEach(g=>{const m=g.colId;p[m]=l[m]}),c[u]=p,n.push(p)),p.__children.push(l)}else c[u]||(c[u]={}),c=c[u]})}),this.gos.assertModuleRegistered(Cv.RowGroupingModule,"Charting Aggregation")){const l=this.aggregationStage;n.forEach(c=>t.valueCols.forEach(h=>{if(t.crossFiltering)t.valueCols.forEach(d=>{const u=d.getColId(),p=c.__children.filter(v=>typeof v[u]<"u").map(v=>v[u]),g=l.aggregateValues(p,t.aggFunc);c[d.getId()]=g&&typeof g.value<"u"?g.value:g;const m=`${u}-filtered-out`,C=c.__children.filter(v=>typeof v[m]<"u").map(v=>v[m]),f=l.aggregateValues(C,t.aggFunc);c[m]=f&&typeof f.value<"u"?f.value:f});else{const d=c.__children.map(p=>p[h.getId()]),u=l.aggregateValues(d,t.aggFunc);c[h.getId()]=u&&typeof u.value<"u"?u.value:u}}))}return n}updatePivotKeysForSSRM(){const t=this.pivotResultColsService.getPivotResultCols()?.list;if(!t)return;const s=this.extractPivotKeySeparator(t);t.forEach(i=>{if(s==="")i.getColDef().pivotKeys=[];else{const r=i.getColId().split(s);i.getColDef().pivotKeys=r.slice(0,r.length-1)}})}extractPivotKeySeparator(t){if(t.length===0)return"";const s=(r,a)=>{const o=r.getGroupId();return r.getParent()?s(r.getParent(),o):a.split(o)[1][0]},i=t[0];return i.getParent()==null?"":s(i.getParent(),i.getColId())}static getGroupLabels(t,s){const i=[s];for(;t&&t.level!==0;)t=t.parent,t&&i.push(t.key);return i}getFilteredRowNodes(){const t={};return this.gridRowModel.forEachNodeAfterFilterAndSort(s=>{t[s.id]=s}),t}getAllRowNodes(){const t=[];return this.gridRowModel.forEachNode(s=>{t.push(s)}),this.sortRowNodes(t)}sortRowNodes(t){const s=this.sortController.getSortOptions();return!s||s.length==0?t:this.rowNodeSorter.doFullSort(t,s)}},lw=class extends bv{constructor(){super(...arguments),this.beanName="chartColumnService",this.valueColsWithoutSeriesType=new Set}wireBeans(e){this.columnModel=e.columnModel,this.showRowGroupColsService=e.showRowGroupColsService,this.columnNameService=e.columnNameService,this.visibleColsService=e.visibleColsService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.rowPositionUtils=e.rowPositionUtils}postConstruct(){const e=()=>this.valueColsWithoutSeriesType.clear();this.addManagedEventListeners({newColumnsLoaded:e,rowDataUpdated:e})}getColumn(e){return this.columnModel.getColDefCol(e)}getAllDisplayedColumns(){return this.visibleColsService.getAllCols()}getColDisplayName(e,t){const s="chart",i=this.columnNameService.getDisplayNameForColumn(e,s);if(t){const r=[i],a=o=>{if(!o)return;const n=this.columnNameService.getDisplayNameForColumnGroup(o,s);Pv(n)||(r.unshift(n),a(o.getParent()))};return a(e.getParent()),r.join(" - ")}return i}getRowGroupColumns(){return this.funcColsService.getRowGroupColumns()}getGroupDisplayColumns(){return this.showRowGroupColsService?.getShowRowGroupCols()??[]}isPivotMode(){return this.columnModel.isPivotMode()}isPivotActive(){return this.columnModel.isPivotActive()}getChartColumns(){const e=this.columnModel.getCols(),t=new Set,s=new Set;return e.forEach(i=>{const r=i.getColDef(),a=r.chartDataType;if(a)switch(a){case"category":case"time":t.add(i);return;case"series":s.add(i);return;case"excluded":return;default:Tv(`unexpected chartDataType value '${a}' supplied, instead use 'category', 'series' or 'excluded'`);break}if(r.colId==="ag-Grid-AutoColumn"){t.add(i);return}if(!i.isPrimary()){s.add(i);return}(this.isInferredValueCol(i)?s:t).add(i)}),{dimensionCols:t,valueCols:s}}isInferredValueCol(e){const t=e.getColId();if(t==="ag-Grid-AutoColumn")return!1;const s=this.rowPositionUtils.getRowNode({rowIndex:0,rowPinned:null});if(!s)return this.valueColsWithoutSeriesType.has(t);let i=this.valueService.getValue(e,s);i==null&&(i=this.extractLeafData(s,e)),i!=null&&typeof i.toNumber=="function"&&(i=i.toNumber());const r=typeof i=="number";return r&&this.valueColsWithoutSeriesType.add(t),r}extractLeafData(e,t){if(!e.allLeafChildren)return null;for(let s=0;s<e.allLeafChildren.length;s++){const i=e.allLeafChildren[s],r=this.valueService.getValue(t,i);if(r!=null)return r}return null}destroy(){this.valueColsWithoutSeriesType.clear(),super.destroy()}},Ll=class hu extends Mv{constructor(t){super(),this.suppressComboChartWarnings=!1,this.chartDataModel=t,this.seriesChartTypes=t.params.seriesChartTypes??[]}postConstruct(){this.initComboCharts()}update(t){this.seriesChartTypes=t??this.seriesChartTypes,this.initComboCharts(),this.updateSeriesChartTypes()}initComboCharts(){const t=this.seriesChartTypes&&this.seriesChartTypes.length>0;(this.chartDataModel.chartType==="customCombo"||t)&&(this.chartDataModel.chartType="customCombo",this.savedCustomSeriesChartTypes=this.seriesChartTypes||[])}updateSeriesChartTypes(){if(this.chartDataModel.isComboChart()){if(this.seriesChartTypes=this.seriesChartTypes.map(t=>{const s=["groupedColumn","stackedColumn","stackedArea"].includes(t.chartType);return t.secondaryAxis=s?!1:t.secondaryAxis,t}),this.chartDataModel.chartType==="customCombo"){this.updateSeriesChartTypesForCustomCombo();return}this.updateChartSeriesTypesForBuiltInCombos()}}updateSeriesChartTypesForCustomCombo(){!(this.seriesChartTypes&&this.seriesChartTypes.length>0)&&!this.suppressComboChartWarnings&&Sr("'seriesChartTypes' are required when the 'customCombo' chart type is specified."),this.seriesChartTypes=this.seriesChartTypes.map(r=>(hu.SUPPORTED_COMBO_CHART_TYPES.includes(r.chartType)||(Sr(`invalid chartType '${r.chartType}' supplied in 'seriesChartTypes', converting to 'line' instead.`),r.chartType="line"),r));const s=r=>{(!this.savedCustomSeriesChartTypes||this.savedCustomSeriesChartTypes.length===0)&&(this.savedCustomSeriesChartTypes=this.seriesChartTypes);const a=this.savedCustomSeriesChartTypes.find(o=>o.colId===r.colId);return a||(r.selected&&!this.suppressComboChartWarnings&&Sr(`no 'seriesChartType' found for colId = '${r.colId}', defaulting to 'line'.`),{colId:r.colId,chartType:"line",secondaryAxis:!1})},i=this.chartDataModel.valueColState.map(s);this.seriesChartTypes=i,this.savedCustomSeriesChartTypes=i,this.suppressComboChartWarnings=!0}updateChartSeriesTypesForBuiltInCombos(){const{chartType:t,valueColState:s}=this.chartDataModel,i=t==="columnLineCombo"?"groupedColumn":"stackedArea",r=t==="columnLineCombo"?"line":"groupedColumn",a=s.filter(n=>n.selected),o=Math.ceil(a.length/2);this.seriesChartTypes=a.map((n,l)=>{const c=l>=o?r:i;return{colId:n.colId,chartType:c,secondaryAxis:!1}})}};Ll.SUPPORTED_COMBO_CHART_TYPES=["line","groupedColumn","stackedColumn","area","stackedArea"];var cw=Ll,kl=class Ko extends mv{constructor(t){super(),this.unlinked=!1,this.chartData=[],this.valueColState=[],this.dimensionColState=[],this.columnNames={},this.crossFiltering=!1,this.grouping=!1,this.params=t,this.chartId=t.chartId,this.setParams(t)}wireBeans(t){this.rangeService=t.rangeService,this.chartTranslationService=t.chartTranslationService}setParams(t){const{chartType:s,pivotChart:i,chartThemeName:r,switchCategorySeries:a,aggFunc:o,cellRange:n,suppressChartRanges:l,unlinkChart:c,crossFiltering:h,seriesGroupType:d}=t;this.chartType=s,this.pivotChart=i??!1,this.chartThemeName=r,this.switchCategorySeries=!!a,this.aggFunc=o,this.referenceCellRange=n,this.suppliedCellRange=n,this.suppressChartRanges=l??!1,this.unlinked=!!c,this.crossFiltering=!!h,this.seriesGroupType=d}postConstruct(){this.datasource=this.createManagedBean(new nw),this.chartColumnService=this.createManagedBean(new lw),this.comboChartModel=this.createManagedBean(new cw(this)),this.updateCellRanges({setColsFromRange:!0}),this.updateData()}updateModel(t){const{cellRange:s,seriesChartTypes:i}=t;s!==this.suppliedCellRange&&(this.dimensionCellRange=void 0,this.valueCellRange=void 0),this.setParams(t),this.updateSelectedDimensions(s?.columns),this.updateCellRanges({setColsFromRange:!0}),(this.isComboChart()||i)&&this.comboChartModel.update(i),this.unlinked||this.updateData()}updateCellRanges(t){const{updatedColState:s,resetOrder:i,maintainColState:r,setColsFromRange:a}=t??{};this.valueCellRange&&(this.referenceCellRange=this.valueCellRange);const{dimensionCols:o,valueCols:n}=this.chartColumnService.getChartColumns(),l=this.getAllColumnsFromRanges();s&&this.updateColumnState(s,i),this.setDimensionCellRange(o,l,s),this.setValueCellRange(n,l,a),!s&&!r&&(this.resetColumnState(),this.syncDimensionCellRange()),this.comboChartModel.updateSeriesChartTypes()}updateData(){const{startRow:t,endRow:s}=this.getRowIndexes();this.pivotChart&&this.resetColumnState(),this.grouping=this.isGrouping();const i={aggFunc:this.aggFunc,dimensionCols:this.getSelectedDimensions(),grouping:this.grouping,pivoting:this.isPivotActive(),crossFiltering:this.crossFiltering,valueCols:this.getSelectedValueCols(),startRow:t,endRow:s,isScatter:nl(["scatter","bubble"],this.chartType)},{chartData:r,columnNames:a,groupChartData:o}=this.datasource.getData(i);this.chartData=r,this.groupChartData=o,this.columnNames=a,this.categoryAxisType=void 0}isGrouping(){const t=this.gos.get("treeData"),s=t?null:this.chartColumnService.getRowGroupColumns(),i=t||s&&s.length>0,r=this.getSelectedDimensions().map(({colId:n})=>n),o=this.chartColumnService.getGroupDisplayColumns().map(n=>n.getColId()).some(n=>r.includes(n));return!!i&&o}getSelectedValueCols(){return this.valueColState.filter(t=>t.selected).map(t=>t.column)}getSelectedDimensions(){return this.dimensionColState.filter(t=>t.selected)}getColDisplayName(t,s){return this.chartColumnService.getColDisplayName(t,s)}isPivotMode(){return this.chartColumnService.isPivotMode()}getChartDataType(t){const s=this.chartColumnService.getColumn(t);return s?s.getColDef().chartDataType:void 0}isPivotActive(){return this.chartColumnService.isPivotActive()}createCellRange(t,...s){return{id:this.chartId,startRow:this.referenceCellRange.startRow,endRow:this.referenceCellRange.endRow,columns:s,startColumn:t===Vt.DIMENSION||this.referenceCellRange.startColumn==null?s[0]:this.referenceCellRange.startColumn,type:t}}getAllColumnsFromRanges(){if(this.pivotChart)return new Set(this.chartColumnService.getAllDisplayedColumns());const t=this.dimensionCellRange||this.valueCellRange?[]:this.referenceCellRange.columns;return this.dimensionCellRange&&t.push(...this.dimensionCellRange.columns),this.valueCellRange&&t.push(...this.valueCellRange.columns),new Set(t)}getRowIndexes(){let t=0,s=0;const{rangeService:i,valueCellRange:r,dimensionCellRange:a}=this,o=r||a;if(i&&o){t=i.getRangeStartRow(o).rowIndex;const n=i.getRangeEndRow(o);s=n.rowPinned==="bottom"?-1:n.rowIndex}return{startRow:t,endRow:s}}resetColumnState(){const{dimensionCols:t,valueCols:s}=this.chartColumnService.getChartColumns(),i=this.getAllColumnsFromRanges(),r=this.valueColState.length<1;this.dimensionColState=[],this.valueColState=[];const a=et(O(this.chartType));let o=!1,n=1;const l=this.suppliedCellRange.columns[0];t.forEach(d=>{const u=d.getColId()==="ag-Grid-AutoColumn";let p=!1;this.crossFiltering&&this.aggFunc?l.getColId()===d.getColId()&&(p=!0):p=u?!0:(!o||a)&&i.has(d),this.dimensionColState.push({column:d,colId:d.getColId(),displayName:this.getColDisplayName(d),selected:p,order:n++}),p&&(o=!0)});const c={colId:Ko.DEFAULT_CATEGORY,displayName:this.chartTranslationService.translate("defaultCategory"),selected:!o,order:0};this.dimensionColState.unshift(c);const h=this.referenceCellRange.columns.filter(d=>s.has(d));s.forEach(d=>{r&&nl(this.referenceCellRange.columns,d)&&(d=h.shift()),this.valueColState.push({column:d,colId:d.getColId(),displayName:this.getColDisplayName(d),selected:i.has(d),order:n++})})}updateColumnState(t,s){const i=h=>h.colId===t.colId,{dimensionColState:r,valueColState:a}=this,o=r.find(i),n=a.find(i);if(o)if(et(O(this.chartType)))o.selected=t.selected;else{const d=t.selected?o:r.filter(u=>u!==o).find(({selected:u})=>u);r.forEach(u=>u.selected=u===d)}else n&&(n.selected=t.selected);const l=[...r,...a],c=[];s||(l.forEach((h,d)=>{d===t.order&&c.push(t.colId),h.colId!==t.colId&&c.push(h.colId)}),l.forEach(h=>{const d=c.indexOf(h.colId);h.order=d>=0?c.indexOf(h.colId):l.length-1})),this.reorderColState()}reorderColState(){const t=(s,i)=>s.order-i.order;this.dimensionColState.sort(t),this.valueColState.sort(t)}setDimensionCellRange(t,s,i){this.dimensionCellRange=void 0;const r=et(O(this.chartType));if(!i&&!this.dimensionColState.length){const l=new Array;t.forEach(c=>{l.length>0&&!r||!s.has(c)||l.push(c)}),l.length>0&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...l));return}let a=i?[i]:[];if(this.crossFiltering&&this.aggFunc){const l=this.suppliedCellRange.columns[0];a=this.dimensionColState.filter(c=>c.colId===l.getColId())}else(r||a.length===0||a.some(({column:l})=>!l||!t.has(l)))&&(a=this.dimensionColState.filter(l=>l.selected));const o=a.length===1?a[0].colId===Ko.DEFAULT_CATEGORY:!1,n=a.map(({column:l})=>l).filter(l=>l!=null);n.length>0&&!o&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...n))}setValueCellRange(t,s,i){this.valueCellRange=void 0;const r=[],a=ti(this.chartType);let o=0;if(t.forEach(n=>{i?(a==null||o<a)&&s.has(n)&&(r.push(n),o++):this.valueColState.some(l=>l.selected&&l.colId===n.getColId())&&r.push(n)}),r.length>0){let n=[];this.valueColState.length>0?n=this.valueColState.map(l=>l.colId):s.forEach(l=>n.push(l.getColId())),r.sort((l,c)=>n.indexOf(l.getColId())-n.indexOf(c.getColId())),this.valueCellRange=this.createCellRange(Vt.VALUE,...r)}}resetCellRanges(t,s){if(!t&&!s)return;const{dimensionCols:i,valueCols:r}=this.chartColumnService.getChartColumns(),a=this.getAllColumnsFromRanges();t&&this.setDimensionCellRange(i,a),s&&this.setValueCellRange(r,a)}updateSelectedDimensions(t){const s=new Set(t.map(r=>r.getColId()));if(et(O(this.chartType))){const r=this.dimensionColState.filter(o=>s.has(o.colId)),a=new Set(r.map(o=>o.colId));this.dimensionColState=this.dimensionColState.map(o=>({...o,selected:a.has(o.colId)}))}else{const a=(this.dimensionColState.find(o=>s.has(o.colId))||this.dimensionColState[0]).colId;this.dimensionColState=this.dimensionColState.map(o=>({...o,selected:o.colId===a}))}}syncDimensionCellRange(){const t=this.getSelectedDimensions();if(t.length===0)return;const s=t.map(({column:i})=>i).filter(i=>i!=null);s.length>0&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...s))}isComboChart(t){return Ir(t??this.chartType)}};kl.DEFAULT_CATEGORY="AG-GRID-DEFAULT-CATEGORY";var Te=kl,ut=e=>t=>t==null?!0:e(t),Gl=e=>typeof e=="string",Ol=e=>typeof e=="boolean",hw=e=>typeof e=="object",Me=(e,t)=>s=>`AG Grid - unable to update chart as invalid params supplied: \`${e}: ${s}\`, expected ${t}.`,Bl=e=>`${e} is not supported in AG Charts Community (either 'ag-grid-charts-enterprise' or '@ag-grid-enterprise/charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`,z=class Q{static isEnterprise(){return Fv.enterpriseModule.isEnterprise}static isValidChartType(t){return!!Tl(t)||Ir(t)}static isLegacyChartType(t){return Q.legacyChartTypes.includes(t)}static validateUpdateParams(t){switch(t.type){case"rangeChartUpdate":return Q.validateUpdateRangeChartParams(t);case"pivotChartUpdate":return Q.validateUpdatePivotChartParams(t);case"crossFilterChartUpdate":return Q.validateUpdateCrossFilterChartParams(t);default:return _t(`Invalid value supplied for 'type': ${t.type}. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.`),!1}}static validateCreateParams(t){return ii(t,[Q.enterpriseChartTypeValidation,Q.switchCategorySeriesValidation])}static validateUpdateRangeChartParams(t){const s=[...Q.commonUpdateValidations,Q.enterpriseChartTypeValidation,...Q.cellRangeValidations,{property:"seriesChartTypes",validationFn:i=>i===void 0||Array.isArray(i)&&i.every(hw),warnMessage:Me("seriesChartTypes","Array of SeriesChartType")}];return ii(t,s,[...Q.baseUpdateChartParams,"cellRange","suppressChartRanges","switchCategorySeries","aggFunc","seriesChartTypes","seriesGroupType"],"UpdateRangeChartParams")}static validateUpdatePivotChartParams(t){const s=[...Q.commonUpdateValidations];return ii(t,s,[...Q.baseUpdateChartParams],"UpdatePivotChartParams")}static validateUpdateCrossFilterChartParams(t){const s=[...Q.commonUpdateValidations,...Q.cellRangeValidations];return ii(t,s,[...Q.baseUpdateChartParams,"cellRange","suppressChartRanges","aggFunc"],"UpdateCrossFilterChartParams")}};z.legacyChartTypes=["doughnut"],z.baseUpdateChartParams=["type","chartId","chartType","chartThemeName","chartThemeOverrides","unlinkChart"],z.validateChartType=ut(e=>{if(z.isValidChartType(e))return!0;if(z.isLegacyChartType(e)){const t=jt(e);return _t(`The chart type '${e}' has been deprecated. Please use '${t}' instead.`),t}return!1}),z.validateAgChartThemeOverrides=ut(e=>typeof e=="object"),z.validateChartParamsCellRange=ut(e=>typeof e=="object"),z.validateAggFunc=ut(e=>typeof e=="string"||typeof e=="function"),z.enterpriseChartTypeValidation={property:"chartType",validationFn:ut(e=>z.isEnterprise()||!e||!Fy(e)),warnMessage:e=>Bl(`The '${e}' chart type`)},z.switchCategorySeriesValidation={property:"switchCategorySeries",validationFn:ut(e=>{if(!e||z.isEnterprise())return!0}),warnMessage:()=>Bl("'switchCategorySeries' has been ignored as it"),warnIfFixed:!0},z.commonUpdateValidations=[{property:"chartId",validationFn:Gl,warnMessage:Me("chartId","string")},{property:"chartType",validationFn:z.validateChartType,warnMessage:Me("chartType","ChartType")},{property:"chartThemeName",validationFn:Gl,warnMessage:Me("chartThemeName","string")},{property:"chartThemeOverrides",validationFn:z.validateAgChartThemeOverrides,warnMessage:Me("chartThemeOverrides","AgChartThemeOverrides")},{property:"unlinkChart",validationFn:Ol,warnMessage:Me("unlinkChart","boolean")}],z.cellRangeValidations=[{property:"cellRange",validationFn:z.validateChartParamsCellRange,warnMessage:Me("cellRange","ChartParamsCellRange")},{property:"suppressChartRanges",validationFn:Ol,warnMessage:Me("suppressChartRanges","boolean")},{property:"aggFunc",validationFn:z.validateAggFunc,warnMessage:Me("aggFunc","string or IAggFunc")},z.switchCategorySeriesValidation];var Nl=z;function ii(e,t,s,i){let r;for(const a of t){const{property:o,validationFn:n,warnMessage:l,warnIfFixed:c}=a;if(o in e){const h=e[o],d=n(h);if(d===!0)continue;if(d===!1)return _t(l(h)),!1;r=r||{...e},r[o]=d,c&&_t(l(h))}}if(s){for(const a in e)if(!s.includes(a))return _t(`Unexpected property supplied. ${i} does not contain: \`${a}\`.`),!1}return r||!0}var Vl=["ag-default","ag-material","ag-sheets","ag-polychroma","ag-vivid"],dw=class extends dv{constructor(e){super(),this.model=e,this.isEnterprise=()=>uv.enterpriseModule.isEnterprise}wireBeans(e){this.rangeService=e.rangeService}postConstruct(){this.setChartRange(),this.model.unlinked&&this.rangeService&&this.rangeService.setCellRanges([]);const e=this.updateForGridChange.bind(this,{});this.addManagedEventListeners({cellSelectionChanged:t=>{t.id&&t.id===this.model.chartId&&this.updateForRangeChange()},columnMoved:e,columnPinned:e,columnVisible:e,columnRowGroupChanged:e,modelUpdated:e,cellValueChanged:this.updateForDataChange.bind(this)})}update(e){if(!this.validUpdateType(e))return!1;const t=Nl.validateUpdateParams(e);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;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.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges;break;case"pivotChartUpdate":o.switchCategorySeries=!1;break}this.model.updateModel(o),o.unlinkChart||o.suppressChartRanges?this.rangeService?.setCellRanges([]):this.setChartRange()}updateForGridChange(e){if(this.model.unlinked)return;const{maintainColState:t,setColsFromRange:s}=e??{};this.model.updateCellRanges({maintainColState:t,setColsFromRange:s}),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(o=>({colId:o.colId,displayName:o.displayName})),i=this.getChartData(),r=this.getSelectedDimensions(),a={data:i,groupData:this.model.groupChartData,grouping:this.isGrouping(),categories:r.map(o=>({id:o.colId,name:o.displayName,chartDataType:this.model.categoryAxisType??this.model.getChartDataType(o.colId)})),fields:s,chartId:this.getChartId(),getCrossFilteringContext:()=>({lastSelectedChartId:"xxx"}),seriesChartTypes:this.getSeriesChartTypes(),updatedOverrides:e,seriesGroupType:this.model.seriesGroupType};return this.isCategorySeriesSwitched()?this.invertCategorySeriesParams(a):a}invertCategorySeriesParams(e){const[t]=e.categories,s=[{id:Te.DEFAULT_CATEGORY,name:""}],i=e.data.map((a,o)=>{const n=`${t.id}:${o}`,l=a[t.id],c=l==null?"":String(l);return{colId:n,displayName:c}}),r=e.fields.map(a=>{const o={[Te.DEFAULT_CATEGORY]:a.displayName};for(const[n,l]of e.data.entries()){const c=`${t.id}:${n}`,h=l[a.colId];o[c]=h}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}}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(),this.raiseChartOptionsChangedEvent()}isCategorySeriesSwitched(){return this.model.switchCategorySeries&&!this.model.isGrouping()}switchCategorySeries(e){Fl(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=(n,l)=>{let c=0;for(const h of n)h.selected&&(c>=l?h.selected=!1:c++);c===0&&(n[0].selected=!0)},i=Lr(t),r=ti(t),a=i!=null&&(Lr(e)??100)>(i??100),o=r!=null&&(ti(e)??100)>(r??100);a&&s(this.model.dimensionColState,i),o&&s(this.model.valueColState,r),(a||o)&&(this.model.resetCellRanges(a,o),this.setChartRange(!0))}setChartThemeName(e,t){this.model.chartThemeName=e,t||(this.raiseChartModelUpdateEvent(),this.raiseChartOptionsChangedEvent())}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")||Vl}getThemes(){return this.getThemeNames().map(t=>{const i=Or(t)?t:this.chartProxy.lookupCustomChartTheme(t);return pv.getChartTheme(i)})}getPalettes(){return this.getThemes().map(t=>t.palette)}getThemeTemplateParameters(){return this.getThemes().map(t=>t.getTemplateParameters())}getValueColState(){return this.model.valueColState.map(this.displayNameMapper.bind(this))}getSelectedValueColState(){return this.getValueColState().filter(e=>e.selected)}getSelectedDimensions(){return this.model.getSelectedDimensions()}displayNameMapper(e){const{column:t}=e;if(t)e.displayName=this.model.getColDisplayName(t,this.model.isPivotMode());else{const s=this.model.columnNames[e.colId];e.displayName=s?s.join(" - "):this.model.getColDisplayName(t)}return e}getColStateForMenu(){return{dimensionCols:this.model.dimensionColState,valueCols:this.getValueColState()}}setChartRange(e=!1){this.rangeService&&!this.model.suppressChartRanges&&!this.model.unlinked&&this.rangeService.setCellRanges(this.getCellRanges()),e||this.raiseChartModelUpdateEvent()}detachChartRange(){this.model.unlinked=!this.model.unlinked,this.model.unlinked?this.rangeService&&this.rangeService.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 a=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"}),a!==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"]:[O(t)]}getChartSeriesType(){const e=this.getSeriesChartTypes();if(e.length===0)return"bar";const t=e[0].chartType;return t==="columnLineCombo"?"bar":t==="areaColumnCombo"?"area":O(t)}getCellRanges(){return[this.model.dimensionCellRange,this.model.valueCellRange].filter(e=>e)}createCellRange(e){return e.cellRange&&this.rangeService?.createPartialCellRangeFromRangeParams(e.cellRange,!0)}validUpdateType(e){if(!e.type)return rl("Unable to update chart as the 'type' is missing. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'."),!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||rl(`Unable to update chart as a '${e.type}' update type is not permitted on a ${s}.`),i}getCellRangeParams(){const e=this.getCellRanges(),t=e[0],s=t&&t.startRow||null,i=t&&t.endRow||null;return{rowStartIndex:s&&s.rowIndex,rowStartPinned:s&&s.rowPinned,rowEndIndex:i&&i.rowIndex,rowEndPinned:i&&i.rowPinned,columns:e.reduce((r,a)=>r.concat(a.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"})}raiseChartUpdatedEvent(){this.dispatchLocalEvent({type:"chartUpdated"})}raiseChartApiUpdateEvent(){this.dispatchLocalEvent({type:"chartApiUpdate"})}raiseChartOptionsChangedEvent(){const{chartId:e,chartType:t}=this.getChartModel();this.eventService.dispatchEvent({type:"chartOptionsChanged",chartId:e,chartType:t,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy.getChartThemeOverrides()})}raiseChartRangeSelectionChangedEvent(){this.eventService.dispatchEvent({type:"chartRangeSelectionChanged",id:this.model.chartId,chartId:this.model.chartId,cellRange:this.getCellRangeParams()})}destroy(){super.destroy(),this.rangeService&&this.rangeService.setCellRanges([])}};function _l(e){return e.chart!=null?e.chart:e}var Yt=class{constructor(e){this.chartProxyParams=e,this.clearThemeOverrides=!1,this.isEnterpriseCharts=Rv.enterpriseModule.isEnterprise,this.chart=e.chartInstance,this.chartType=e.chartType,this.crossFiltering=e.crossFiltering,this.crossFilterCallback=e.crossFilterCallback,this.standaloneChartType=O(this.chartType),this.chart==null?this.chart=Av.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 _l(this.chart)}getChartRef(){return this.chart}downloadChart(e,t,s){const{chart:i}=this,r=_l(i),a=t||(r.title?r.title.text:"chart"),{width:o,height:n}=e||{};i.download({width:o,height:n,fileName:a,fileFormat:s})}getChartImageDataURL(e){return this.getChart().getCanvasDataURL(e)}getChartOptions(){return this.chart.getOptions()}getChartThemeOverrides(){return this.getChartOptions().theme.overrides??{}}getChartPalette(){return Ev.getChartTheme(this.getChartOptions().theme).palette}setPaired(e){const t=O(this.chartProxyParams.chartType);this.chart.updateDelta({theme:{overrides:{[t]:{paired:e}}}})}isPaired(){const e=O(this.chartProxyParams.chartType);return st(this.getChartThemeOverrides(),`${e}.paired`,!0)}lookupCustomChartTheme(e){return Dl(this.chartProxyParams,e)}getSeriesGroupType(){}transformCategoryData(e,t){return e.map((s,i)=>{const r=s[t],a=r&&r.toString?r.toString():"",o={...s};return o[t]={id:i,value:r,toString:()=>a},o})}getCommonChartOptions(e){const t=this.clearThemeOverrides?{}:this.chart?.getOptions()??{},s=this.chart!=null?this.getActiveFormattingPanelOverrides():void 0;this.clearThemeOverrides=!1;const i=ew(this.chartProxyParams,this,this.isEnterpriseCharts,this.getChartThemeDefaults(),e??s),r={...t,mode:"integrated"};return r.theme=i,r.container=this.chartProxyParams.parentElement,r}getChartThemeDefaults(){const e=this.getSeriesChartThemeDefaults(),t=e?{[this.standaloneChartType]:e}:{},s={enabled:!0,snap:!0,label:{enabled:!1}},i=this.isEnterpriseCharts?{zoom:{enabled:!0},animation:{enabled:!0,duration:500},axes:{number:{crosshair:s},category:{crosshair:s},log:{crosshair:s},time:{crosshair:s}}}:{};return i.minHeight=0,i.minWidth=0,i.navigator={enabled:!1},{common:i,...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)}},_e=class extends Yt{constructor(e){super(e),this.crossFilteringAllPoints=new Set,this.crossFilteringSelectedPoints=[]}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[0].type,{categories:i,data:r}=e,[a]=i;switch(s){case"category":return this.transformCategoryData(r,a.id);case"time":return this.transformTimeData(r,a.id);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){return e[0]?.[t]instanceof Date?e:e.map(i=>{const r=i[t];return typeof r=="string"?{...i,[t]:new Date(r)}:i})}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={nodeClick:a=>{const o=a.datum[r.xKey],n=a.event.metaKey||a.event.ctrlKey;this.crossFilteringAddSelectedPoint(n,o),this.crossFilterCallback(a)}},r.marker={itemStyler:a=>{const o=a.datum[s.id];return{fill:a.highlighted?"yellow":a.fill,size:a.highlighted?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(a=>{const o=a[t.id];this.crossFilteringAllPoints.add(o);const n=this.crossFilteringPointSelected(o);return this.standaloneChartType==="area"&&r===e.chartId&&(a[`${s}-total`]=n?a[s]:a[s]+a[i]),this.standaloneChartType==="line"&&(a[`${s}-total`]=n?a[s]:a[s]+a[i]),a})}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 a=r?.overrides?.[t]?.series?.direction;return a!=null?a==="horizontal":typeof r?.baseTheme=="object"?i(r.baseTheme):!1};return i(s)}},uw=class extends _e{constructor(e){super(e)}getAxes(e){const t=[{type:this.getXAxisType(e),position:"bottom"},{type:"number",position:"left"}];if(this.isNormalised()){const s=t[1];s.label={...s.label,formatter:i=>Math.round(i.value)+"%"}}return 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"}};function Ul(e,t){const s=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return t?`rgba(${s}, ${i}, ${r}, ${t})`:`rgba(${s}, ${i}, ${r})`}function Hl(e,t){return e.map(s=>{const i=cl.Color.fromString(s);return new cl.Color(i.r,i.g,i.b,t).toHexString()})}var pw=new Set(["bar","groupedBar","stackedBar","normalizedBar"]),gw=class extends _e{constructor(e){super(e)}getAxes(e){const t=[{type:this.getXAxisType(e),position:this.isHorizontal()?"left":"bottom"},{type:"number",position:this.isHorizontal()?"bottom":"left"}];if(this.isNormalised()){const s=t[1];s.label={...s.label,formatter:i=>Math.round(i.value)+"%"}}return t}getSeries(e){const[t]=e.categories,s=e.fields.map(i=>({type:this.standaloneChartType,direction:this.isHorizontal()?"horizontal":"vertical",stacked:this.crossFiltering||Ry(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=this.getChartPalette(),s=(a,o)=>({...a,highlightStyle:{item:{fill:void 0}},fill:t?.fills?.[o],stroke:t?.strokes?.[o],listeners:{nodeClick:this.crossFilterCallback}}),i=a=>{const o=a.yKey+"-filtered-out";return{...a,yKey:o,fill:Ul(a.fill,"0.3"),stroke:Ul(a.stroke,"0.3"),showInLegend:!1}},r=[];for(let a=0;a<e.length;a++){const o=e[a];r.push(s(o,a)),r.push(i(s(o,a)))}return r}isNormalised(){const e=["normalizedColumn","normalizedBar"];return!this.crossFiltering&&Iv(e,this.chartType)}isHorizontal(){return pw.has(this.chartType)}},mw=class extends _e{constructor(e){super(e)}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[{type:"number",position:"bottom"},{type:"number",position:"left"}]}},fw=class extends _e{constructor(e){super(e)}getAxes(e){return[{type:this.getXAxisType(e),position:"bottom"},{type:"number",position:"left"}]}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}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(s,e):s}},Cw=class extends _e{constructor(e){super(e)}getAxes(e){return[{type:"number",position:"bottom"},{type:"number",position:"left"}]}getSeries(e){const[t]=e.categories,s=this.isPaired(),i=this.getSeriesDefinitions(e.fields,s),r=t.id===Te.DEFAULT_CATEGORY?void 0:t,a=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(a,e):a}extractCrossFilterSeries(e,t){const{data:s}=t,i=this.getChartPalette(),r=c=>`${c}-filtered-out`,a=(c,h)=>{const d=[1/0,-1/0];if(h!=null)for(const u of c){const p=u[h]??u[r(h)];p<d[0]&&(d[0]=p),p>d[1]&&(d[1]=p)}if(d[0]<=d[1])return d},o=(c,h)=>{const d=i?.fills?.[h],u=i?.strokes?.[h];let p;if(c.type==="bubble"){const{sizeKey:g}=c;p=a(s,g)}return{...c,fill:d,stroke:u,domain:p,highlightStyle:{item:{fill:"yellow"}},listeners:{...c.listeners,nodeClick:this.crossFilterCallback}}},n=c=>{const{yKey:h,xKey:d}=c;let u={};return c.type==="bubble"&&(u={sizeKey:r(c.sizeKey)}),{...c,...u,yKey:r(h),xKey:r(d),fillOpacity:.3,strokeOpacity:.3,showInLegend:!1,listeners:{...c.listeners,nodeClick:p=>{const g=p.datum[r(d)],m={...p,xKey:d,datum:{...p.datum,[d]:g}};this.crossFilterCallback(m)}}}},l=e.map(o);return[...l,...l.map(n)]}getSeriesDefinitions(e,t){if(e.length<2)return[];const s=this.chartType==="bubble";if(t)return s?e.map((r,a)=>a%3===0?{xField:r,yField:e[a+1],sizeField:e[a+2]}:null).filter(r=>r&&r.yField&&r.sizeField):e.map((r,a)=>a%2===0?{xField:r,yField:e[a+1]}:null).filter(r=>r&&r.yField);const i=e[0];return s?e.map((r,a)=>a%2===1?{xField:i,yField:r,sizeField:e[a+1]}:null).filter(r=>r&&r.sizeField):e.filter((r,a)=>a>0).map(r=>({xField:i,yField:r}))}},vw=class extends _e{constructor(e){super(e)}getAxes(e,t){return[{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},{type:"number",position:this.isHorizontal(t)?"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}]}},Sw=class extends _e{constructor(e){super(e)}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),a=[{type:this.getXAxisType(e),position:"bottom"}];return i.length>0&&a.push({type:"number",keys:i,position:"left"}),r.length>0&&r.forEach(o=>{const n=s.get(o);if(!(n&&n.colId===o))return;const c={type:"number",keys:[o],position:"right"};a.push(c)}),a}getSeries(e){const{fields:t,seriesChartTypes:s}=e,[i]=e.categories;return t.map(r=>{const a=s.find(o=>o.colId===r.colId);if(a){const o=a.chartType,l=["groupedColumn","groupedBar"].includes(o)?{grouped:!0}:{};return{type:O(o),xKey:i.id,yKey:r.colId,yName:r.displayName,stacked:["stackedArea","stackedColumn"].includes(o),...l}}})}getYKeys(e,t){const s=[],i=[];return e.forEach(r=>{const a=r.colId,o=t.find(n=>n.colId===a);o&&(o.secondaryAxis?i.push(a):s.push(a))}),{primaryYKeys:s,secondaryYKeys:i}}},ri="AG-GRID-DEFAULT-LABEL-KEY";function yw(e,t){const s=zl(e,i,r);return Br(s);function i(o){return t.length}function r(o,n){const l=t[n],c=o[l];return a(c)}function a(o){return o==null?null:String(o)}}function ww(e,t){const s=zl(e,i,r);return Br(s);function i(a){return t(a)?.length??0}function r(a,o){const n=t(a);if(!n)return null;const l=n.length-1-o;return n[l]}}function Br(e,t=null,s){const{depth:i,rootValues:r,value:a,children:o}=e;if(r)return r.map(l=>({[ri]:t,...l}));if(i===0)return[{[ri]:t,...a}];const n=[];for(const[l,c]of o.entries())n.push(...Br(c,l,!0));return s?[{[ri]:t,children:n,...a??{}}]:n}function zl(e,t,s){const i={depth:0,children:new Map};return e.forEach(a=>{const o=t(a);r(a,o,s,0,i)}),i;function r(a,o,n,l,c){if(l===o)return l===0?(c.rootValues||(c.rootValues=[]),c.rootValues.push(a)):c.value=a,c;{const h=n(a,l),d=c.children.get(h),u=r(a,o,n,l+1,d||{depth:0,children:new Map});return c.children.set(h,u),c.depth=Math.max(1+u.depth,c.depth),c}}}var xw=class extends Yt{constructor(e){super(e)}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}}}}getSeries(e,t){return[{type:this.standaloneChartType,labelKey:ri,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:a,grouping:o}=e;if(o){const n=s?r.concat(a?.map(l=>{const c={...l};return delete c[t.colId],c})??[]):r;return ww(n,l=>l[Dv]?.labels??null)}else{const n=i.map(({id:l})=>l);return yw(r,n)}}};function bw(e){const t=e.currentOffset;e.currentOffset-=e.offsetAmount;const s=e.currentOffset;return e.currentOffset-=e.offsetAmount,{outerRadiusOffset:t,innerRadiusOffset:s}}var Pw=class extends Yt{constructor(e){super(e)}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(a=>{const o={type:this.standaloneChartType,angleKey:a.colId,angleName:a.displayName,sectorLabelKey:a.colId,calloutLabelName:t.name,calloutLabelKey:t.id};if(this.chartType==="donut"||this.chartType==="doughnut"){const{outerRadiusOffset:n,innerRadiusOffset:l}=bw(i),c=a.displayName?{title:{text:a.displayName,showInLegend:s>1}}:void 0;return{...o,type:"donut",outerRadiusOffset:n,innerRadiusOffset:l,...c,calloutLine:{colors:this.getChartPalette()?.strokes}}}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=this.getChartPalette(),s=n=>({...n,legendItemKey:n.calloutLabelKey,calloutLabel:{enabled:!1},highlightStyle:{item:{fill:void 0}},radiusKey:n.angleKey,angleKey:n.angleKey+"-total",radiusMin:0,radiusMax:1,listeners:{nodeClick:this.crossFilterCallback}}),i=(n,l)=>({...o,radiusKey:l+"-filtered-out",fills:Hl(n.fills??t?.fills??[],.3),strokes:Hl(n.strokes??t?.strokes??[],.3),showInLegend:!1}),r=e[0],a=r.angleKey,o=s(r);return[i(s(r),a),o]}getFields(e){return this.chartType==="pie"?e.fields.slice(0,1):e.fields}},Tw=class extends Yt{constructor(e){super(e)}getAxes(e){const t=this.standaloneChartType==="radial-bar";return[{type:t?"angle-number":"angle-category"},{type:t?"radius-category":"radius-number"}]}getSeries(e){const{fields:t,categories:s,seriesGroupType:i}=e,[r]=s,a=this.standaloneChartType==="radial-bar",o=this.getSeriesGroupTypeOptions(i);return t.map(n=>({type:this.standaloneChartType,angleKey:a?n.colId:r.id,angleName:a?n.displayName??void 0:r.name,radiusKey:a?r.id:n.colId,radiusName:a?r.name:n.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.some(i=>i.type==="angle-category"||i.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}:{}}};function Mw(e,t){return e.reduce((s,i,r,a)=>s.concat(t(i,r,a)),new Array)}var Fw="AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY",Aw="AG-GRID-DEFAULT-HEATMAP-SERIES-KEY",Rw="AG-GRID-DEFAULT-HEATMAP-VALUE-KEY",Ew=class extends Yt{constructor(e){super(e)}getUpdateOptions(e,t){const s=Aw,i=Rw,r=Fw;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 Mw(e.data,(a,o)=>{const n=a[r.id],l=n==null?"":String(n),c={id:o,value:n,toString:()=>l};return e.fields.map(({colId:h,displayName:d})=>({...a,[t]:d,[s]:a[h],[i]:c}))})}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200}},series:{tooltip:{renderer:Iw}}}}};function Iw(e){const{xKey:t,yKey:s,colorKey:i,yName:r,datum:a}=e;return{title:"",content:[{label:r,value:a[s]},{label:a[t],value:i&&a[i]}].map(({label:l,value:c})=>`<b>${Wl(String(l))}:</b> ${Wl(String(c))}`).join("<br>")}}function Wl(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;"},s=`[${Object.keys(t).join("")}]`,i=new RegExp(s,"g");return e.replace(i,r=>t[r])}var Kl=class extends _e{constructor(e){super(e)}getAxes(e,t){return[{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},{type:"number",position:this.isHorizontal(t)?"bottom":"left"}]}computeSeriesStatistics(e,t){const{data:s,fields:i}=e,[r]=e.categories,a=r.id||Te.DEFAULT_CATEGORY,o=this.groupDataByCategory(a,s);return Array.from(o).map(([n,l])=>{const c={[r.id]:n};return i.forEach((h,d)=>{const u=l.map(p=>p[h.colId]).filter(p=>typeof p=="number"&&!isNaN(p));Object.entries(t(u)).forEach(([p,g])=>{const m=`${p}:${d}`;c[m]=u.length>0?g:null})}),c})}groupDataByCategory(e,t){const s=i=>{if(e===Te.DEFAULT_CATEGORY)return 1;const r=i[e];return r==null?"":r instanceof Date?r.getTime():r};return t.reduce((i,r)=>{const a=s(r),o=i.get(a);return o?o.push(r):i.set(a,[r]),i},new Map)}},Dw=class extends Kl{constructor(e){super(e)}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]}},Lw=class extends Kl{constructor(e){super(e)}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)}))}},kw=class extends Ov{constructor(){super('<div class="ag-chart-menu" data-ref="eMenu"></div>'),this.eMenu=Bv,this.buttonListenersDestroyFuncs=[]}wireBeans(e){this.chartTranslationService=e.chartTranslationService}updateParams(e){const{buttons:t}=e;this.createButtons(t)}createButtons(e){this.buttonListenersDestroyFuncs.forEach(s=>s?.()),this.buttonListenersDestroyFuncs=[];const t=this.eMenu;Nv(t),e.forEach(s=>{const{buttonName:i,iconName:r,callback:a}=s,o=this.createButton(r),n=this.chartTranslationService.translate(i+"ToolbarTooltip");n&&o instanceof HTMLElement&&(o.title=n),this.buttonListenersDestroyFuncs.push(...this.addManagedElementListeners(o,{click:l=>a(l.currentTarget)})),t.appendChild(o)})}createButton(e){const t=Vv(e,this.gos,void 0,!0);t.classList.add("ag-chart-menu-icon");const s=_v(this.gos).createElement("button");return s.appendChild(t),s.classList.add("ag-chart-menu-toolbar-button"),s}destroy(){this.buttonListenersDestroyFuncs=[],super.destroy()}},Gw=class extends Qv{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=>eS(r))}postConstruct(){const{ariaLabel:e,onValuesChange:t,dragSourceId:s}=this.config;this.dropZonePanel=this.createManagedBean(new Bw({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 a=!1;return(s.length||i.length||r.length)&&(a=!0),this.valueList=e,this.updateValues(t,a,!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 Jv({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;return t&&this.selectedValues.length>=t||this.valueList.forEach(s=>{this.selectedValues.includes(s)||e.push({value:s,text:this.valueFormatter(s)})}),e}addValue(e){this.dropZonePanel.addItem(e)}updateValues(e,t,s){const i=this.selectedValues;this.selectedValues=e;const r=this.getChanges(i,e),a=t||r.added.length||r.removed.length,o=tS(this.gos),n=this.eSelect?.getGui().contains(o),l=this.dropZonePanel?.getGui().contains(o);s||this.onValuesChange?.(r);const c=a?!this.refreshSelect():!1;this.dropZonePanel.refreshGui(),a&&n&&(c?this.dropZonePanel.focusList(!0):this.eSelect?.getFocusableElement().focus()),l&&!e.length&&this.eSelect?.getFocusableElement().focus()}getChanges(e,t){const s=t.filter(a=>!e.includes(a)),i=e.filter(a=>!t.includes(a)),r=t.filter((a,o)=>e[o]!==a);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):(sS(this.eSelect.getGui()),this.eSelect=this.destroyBean(this.eSelect),!1)}destroy(){this.destroyBean(this.eSelect),super.destroy()}},Ow=class extends Es{constructor(e,t,s,i,r,a){super(t,s,!1),this.value=e,this.valueFormatter=i,this.draggable=r,this.sourceId=a}getItem(){return this.value}getDisplayName(){return this.valueFormatter(this.value)}getAriaDisplayName(){return this.getDisplayName()}getTooltip(){}createGetDragItem(){return()=>({value:this.value})}getDragSourceType(){return hl.ChartPanel}getDragSourceId(){return this.sourceId}isDraggable(){return this.draggable}},Bw=class extends Is{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 Ow(e,t,s,this.valueFormatter,this.model.isDraggable(),this.sourceId)}getItems(e){return[e.value]}isInterestedIn(e){return e===hl.ChartPanel}},$l=class extends Zv{constructor(e,t,s,i){super(i),this.chartController=e,this.allowMultipleSelection=t,this.maxSelection=s}wireBeans(e){this.chartTranslationService=e.chartTranslationService}addItem(e){this.groupComp.addItem(e)}createGroup(e,t,s,i,r){if(this.allowMultipleSelection){const a=e.filter(o=>o.selected);this.valuePillSelect=this.groupComp.createManagedBean(new Gw({valueList:e,selectedValueList:a,valueFormatter:t,selectPlaceholder:this.chartTranslationService.translate(s),dragSourceId:i,onValuesChange:o=>this.onValueChange(o),maxSelection:this.maxSelection})),this.groupComp.addItem(this.valuePillSelect)}else{const a=this.createValueSelectParams(e);a.onValueChange=o=>{e.forEach(n=>{n.selected=!1}),o.selected=!0,o.colId===Te.DEFAULT_CATEGORY&&this.chartController.setAggFunc(void 0,!0),this.chartController.updateForPanelChange({updatedColState:o,skipAnimation:r?.()})},this.valueSelect=this.groupComp.createManagedBean(new Xv(a)),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,a;const o=()=>{i.forEach((n,l)=>{n.order=l}),a=!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:a})}destroy(){this.valuePillSelect=void 0,this.valueSelect=void 0,super.destroy()}},Nw="sum",Vw=class extends $l{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 pe({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 qv({label:this.chartTranslationService.translate("aggregate"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:t!=null,onValueChange:s=>{const i=s?Nw:void 0;this.chartController.setAggFunc(i),this.aggFuncSelect?.setValue(i,!0),this.aggFuncSelect?.setDisplayed(i!=null)}}))),this.groupComp.addItem(this.aggFuncSelect=this.createBean(new Yv({options:[{value:"sum",text:this.chartTranslationService.translate("sum")},{value:"first",text:this.chartTranslationService.translate("first")},{value:"last",text:this.chartTranslationService.translate("last")},{value:"min",text:this.chartTranslationService.translate("min")},{value:"max",text:this.chartTranslationService.translate("max")},{value:"count",text:this.chartTranslationService.translate("count")},{value:"avg",text:this.chartTranslationService.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!==Te.DEFAULT_CATEGORY);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()}},it=class extends oS{constructor(e){super(),this.chartOptionsProxy=e}wireBeans(e){this.chartTranslationService=e.chartTranslationService}getDefaultColorPickerParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslationService.translate(t??"color"),labelWidth:"flex",inputWidth:"flex",labelAlignment:"top",pickerGap:6},s)}getDefaultNumberInputParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslationService.translate(t),labelAlignment:"top",labelWidth:"flex",inputWidth:"flex",precision:s?.precision,step:s?.step,min:s?.min,max:s?.max},{parseInputValue:i=>{const r=Number(i);return isNaN(r)?void 0:r},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 a=this.getDefaultSliderParamsWithoutValueParams(r,t,s);return a.onValueChange=o=>this.chartOptionsProxy.setValue(e,i?[o]:o),a}getDefaultSliderParamsWithoutValueParams(e,t,s){return{label:this.chartTranslationService.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.chartTranslationService.translate(t),value:i,readOnly:s?.readOnly,passive:s?.passive};return r.onValueChange=a=>{this.chartOptionsProxy.setValue(e,typeof a=="boolean"?a: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.chartTranslationService.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.chartTranslationService.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 a=s?.parseInputValue?s.parseInputValue(r):r;this.chartOptionsProxy.setValue(e,a)},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}},_w=class extends rS{constructor(e,t){super(),this.chartMenuContext=e,this.isOpen=t,this.chartSpecificGroup=aS,this.hasContent=!1}wireBeans(e){this.chartTranslationService=e.chartTranslationService,this.chartService=e.chartService}postConstruct(){const t={title:this.getTitle(),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen,items:[...this.createDirectionSelect(),this.createGroupTypeSelect()]};this.setTemplate(`
191
+ `),this.menuItems=e,this.eChartsMenu=YC}wireBeans(e){this.focusService=e.focusService}postConstruct(){this.mainMenuList=this.createManagedBean(new Je(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)),this.focusService.focusInto(this.mainMenuList.getGui())}},Yy=class Wo extends ZC{constructor(){super(...arguments),this.beanName="chartCrossFilterService"}wireBeans(t){this.columnModel=t.columnModel,this.valueService=t.valueService,this.filterManager=t.filterManager,JC(this.gos)&&(this.clientSideRowModel=t.rowModel)}filter(t,s=!1){const i=this.filterManager?.getFilterModel()??{};if(s){this.resetFilters(i);return}const r=Wo.extractFilterColId(t);this.isValidColumnFilter(r)?this.updateFilters(i,t,r):QC("cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: '"+r+"'")}resetFilters(t){Object.keys(t).length>0&&(this.filterManager?.setFilterModel(null),this.filterManager?.onFilterChanged({source:"api"}))}updateFilters(t,s,i){const r=Wo.extractFilterColId(s),a=s.datum[r];if(a===void 0)return;const o=a.toString();if(s.event.metaKey||s.event.ctrlKey){const n=this.getCurrentGridValuesForCategory(i),l=Qn(n,o);let c;l?c=n.filter(h=>h!==o):(c=n,c.push(o)),t[i]=this.getUpdatedFilterModel(i,c)}else{const n=[o];t={[i]:this.getUpdatedFilterModel(i,n)}}this.filterManager?.setFilterModel(t)}getUpdatedFilterModel(t,s){return this.getColumnFilterType(t)==="agMultiColumnFilter"?{filterType:"multi",filterModels:[null,{filterType:"set",values:s}]}:{filterType:"set",values:s}}getCurrentGridValuesForCategory(t){const s=[],i=this.getColumnById(t);return this.clientSideRowModel?.forEachNodeAfterFilter(r=>{if(i&&!r.group){const a=this.valueService.getValue(i,r)+"";s.includes(a)||s.push(a)}}),s}static extractFilterColId(t){return t.xKey||t.calloutLabelKey}isValidColumnFilter(t){t.indexOf("-filtered-out")&&(t=t.replace("-filtered-out",""));const s=this.getColumnFilterType(t);return typeof s=="boolean"?s:Qn(["agSetColumnFilter","agMultiColumnFilter"],s)}getColumnFilterType(t){const s=this.getColumnById(t);if(s)return s.getColDef().filter}getColumnById(t){return this.columnModel.getCol(t)}},qy=["chartUnlink","chartLink","chartDownload","chartMenu"],si={settings:"chartSettings",data:"chartData",format:"chartFormat"},Xy=class extends ev{constructor(){super(...arguments),this.beanName="chartMenuService"}wireBeans(e){this.advancedSettingsMenuFactory=e.advancedSettingsMenuFactory}downloadChart(e,t,s,i){e.chartController.getChartProxy().downloadChart(t,s,i)}toggleLinked(e){e.chartController.detachChartRange()}openAdvancedSettings(e,t){this.advancedSettingsMenuFactory.showMenu(e,t)}hideAdvancedSettings(){this.advancedSettingsMenuFactory.hideMenu()}getChartToolbarOptions(){const e=["chartMenu"],t=this.gos.getCallback("getChartToolbarItems");return t?t({defaultItems:e}).filter(i=>qy.includes(i)?!0:(el(`'${i}' is not a valid Chart Toolbar Option`),!1)):e}getChartToolPanels(e){const t=this.gos.get("chartToolPanelsDef");let i=t?.panels?.map(o=>{const n=si[o];return n||el(`Invalid panel in chartToolPanelsDef.panels: '${o}'`),n}).filter(o=>!!o)??Object.values(si);e.isPivotChart()&&(i=i.filter(o=>o!=="chartData"));const r=t?.defaultToolPanel,a=r&&si[r]||i[0];return{panels:i,defaultPanel:a}}doesChartToolbarExist(){return this.getChartToolbarOptions().length>0}doChartToolPanelsExist(e){const{panels:t}=this.getChartToolPanels(e);return t.length>0}},El=class lu extends tv{constructor(){super(...arguments),this.beanName="chartTranslationService"}translate(t){const s=this.localeService.getLocaleTextFunc(),i=lu.DEFAULT_TRANSLATIONS[t];return s(t,i)}};El.DEFAULT_TRANSLATIONS={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",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",invalidColor:"Color value is invalid",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",customCombo:"Custom Combination",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"};var Zy=El,tt="32.3.3",Il=["number","category","grouped-category","log","time"];function Jy(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"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 st(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 a=r[i[0]];return a??s}function Qy(e,t,s){if(e==null)return;const i=t.split(".");let r=e;i.forEach((a,o)=>{r[a]||(r[a]={}),o<i.length-1&&(r=r[a])}),r[i[i.length-1]]=s}function ew(e,t,s,i,r){const{chartOptionsToRestore:a,chartPaletteToRestore:o,chartThemeToRestore:n}=e,l=ow(e),c=Or(l),h=c?{baseTheme:l}:Dl(e,l)??{},d=e.getGridOptionsChartThemeOverrides(),u=e.apiChartThemeOverrides,p=O(e.chartType),g=e.crossFiltering?sw(t,e,p):void 0,f=[c?rw(e,s,(()=>{const v=S=>S?Object.keys(S).some(y=>st(S[y],"title.enabled",!1)):!1;return v(d)||v(u)})()):void 0,aw(),i,g,d,u,{...a??{}},r].filter(v=>!!v).reduce((v,S)=>({baseTheme:v,overrides:S}),h);if(o&&l===n){const v=ol.getChartTheme(h).palette;tw(o,v)||(f.palette=o)}return f}function tw(e,t){const s=(i,r)=>i===r?!0:i?.length!==r?.length?!1:i?.every((a,o)=>a===r?.[o])??!1;return s(e.fills,t.fills)&&s(e.strokes,t.strokes)}function Or(e){return al(Object.keys(ol.themes),e)}function sw(e,t,s){const i={listeners:{legendItemClick:r=>{e.getChart().series.forEach(o=>{o.toggleSeriesItem(r.itemId,r.enabled),o.toggleSeriesItem(`${r.itemId}-filtered-out`,r.enabled)})}}};return{[s]:{tooltip:{delay:500},legend:i,listeners:{click:r=>t.crossFilterCallback(r,!0)}}}}var iw=Il.reduce((e,t)=>({...e,[t]:{title:{_enabledFromTheme:!0}}}),{});function rw(e,t,s){const i=e.getExtraPaddingDirections();return{common:{...t?{animation:{duration:500}}:void 0,axes:iw,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 aw(){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 ow(e){let t=e.getChartThemeName();const s=e.getChartThemes();return al(s,t)||(t=s[0]),t}function Dl(e,t){const{customChartThemes:s}=e,i=s&&s[t];return i||gv(`no stock theme exists with the name '${t}' and no custom chart theme with that name was supplied to 'customChartThemes'`),i}var nw=class cu extends fv{wireBeans(t){this.sortController=t.sortController,this.gridRowModel=t.rowModel,this.columnModel=t.columnModel,this.valueService=t.valueService,this.pivotResultColsService=t.pivotResultColsService,this.rowNodeSorter=t.rowNodeSorter,this.aggregationStage=t.aggregationStage}getData(t){if(t.crossFiltering){if(t.grouping)return ll("crossing filtering with row grouping is not supported."),{chartData:[],columnNames:{}};if(!Sv(this.gos))return ll("crossing filtering is only supported in the client side row model."),{chartData:[],columnNames:{}}}yv(this.gos)&&t.pivoting&&this.updatePivotKeysForSSRM();const i=this.extractRowsFromGridRowModel(t);return i.chartData=this.aggregateRowsByDimension(t,i.chartData),i}extractRowsFromGridRowModel(t){const{crossFiltering:s,startRow:i,endRow:r,valueCols:a,dimensionCols:o,grouping:n}=t;let l=[];const c={},h={},d={};let u={},p=[],g;if(s)u=this.getFilteredRowNodes(),p=this.getAllRowNodes(),g=p.length;else{const v=this.gridRowModel.getRowCount()-1;i===r&&i===0&&o.length===0&&a.length===0?g=0:g=(r>=0?Math.min(r,v):v)-i+1}g>0&&a.forEach(v=>{let S=[];const y=v.getColDef().pivotKeys;y&&(S=y.slice());const w=v.getColDef().headerName;w&&S.push(w),S.length>0&&(c[v.getId()]=S)});let m=0,C=0;for(let v=0;v<g;v++){const S=s?p[v]:this.gridRowModel.getRow(v+i);if(S.footer||S.detail){m++;continue}const y={};o.forEach(w=>{const b=w.colId,P=this.columnModel.getCol(b);if(P){const F=this.valueService.getValue(P,S);if(n){const A=F?.toString?String(F.toString()):"",M=cu.getGroupLabels(S,A);y[b]={labels:M,id:C++,toString:function(){return this.labels.filter(B=>!!B).reverse().join(" - ")}},S.group&&(h[M.toString()]=v-m);const I=M.slice(1,M.length).toString();I&&(d[I]=h[I])}else y[b]=F}else y[Te.DEFAULT_CATEGORY]=v+1}),a.forEach(w=>{const b=w.getColId();if(s){const P=b+"-filtered-out",F=this.valueService.getValue(w,S),A=F!=null&&typeof F.toNumber=="function"?F.toNumber():F;u[S.id]?(y[b]=A,y[P]=t.aggFunc||t.isScatter?void 0:0):(y[b]=t.aggFunc||t.isScatter?void 0:0,y[P]=A)}else{let P=this.valueService.getValue(w,S);P&&Object.prototype.hasOwnProperty.call(P,"toString")&&(P=parseFloat(P.toString())),y[b]=P!=null&&typeof P.toNumber=="function"?P.toNumber():P}}),l.push(y)}let f;if(n){const v=xv(d),S=l;l=[],f=[];for(let y=0;y<S.length;y++)(vv(v,y)?f:l).push(S[y])}return{chartData:l,columnNames:c,groupChartData:f}}aggregateRowsByDimension(t,s){const i=t.dimensionCols;if(!t.aggFunc||i.length===0)return s;const r=wv(i),a=r&&r.colId,o={},n=[];if(s.forEach(l=>{let c=o;i.forEach(h=>{const d=h.colId,u=l[d];if(d===a){let p=c[u];p||(p={__children:[]},i.forEach(g=>{const m=g.colId;p[m]=l[m]}),c[u]=p,n.push(p)),p.__children.push(l)}else c[u]||(c[u]={}),c=c[u]})}),this.gos.assertModuleRegistered(Cv.RowGroupingModule,"Charting Aggregation")){const l=this.aggregationStage;n.forEach(c=>t.valueCols.forEach(h=>{if(t.crossFiltering)t.valueCols.forEach(d=>{const u=d.getColId(),p=c.__children.filter(v=>typeof v[u]<"u").map(v=>v[u]),g=l.aggregateValues(p,t.aggFunc);c[d.getId()]=g&&typeof g.value<"u"?g.value:g;const m=`${u}-filtered-out`,C=c.__children.filter(v=>typeof v[m]<"u").map(v=>v[m]),f=l.aggregateValues(C,t.aggFunc);c[m]=f&&typeof f.value<"u"?f.value:f});else{const d=c.__children.map(p=>p[h.getId()]),u=l.aggregateValues(d,t.aggFunc);c[h.getId()]=u&&typeof u.value<"u"?u.value:u}}))}return n}updatePivotKeysForSSRM(){const t=this.pivotResultColsService.getPivotResultCols()?.list;if(!t)return;const s=this.extractPivotKeySeparator(t);t.forEach(i=>{if(s==="")i.getColDef().pivotKeys=[];else{const r=i.getColId().split(s);i.getColDef().pivotKeys=r.slice(0,r.length-1)}})}extractPivotKeySeparator(t){if(t.length===0)return"";const s=(r,a)=>{const o=r.getGroupId();return r.getParent()?s(r.getParent(),o):a.split(o)[1][0]},i=t[0];return i.getParent()==null?"":s(i.getParent(),i.getColId())}static getGroupLabels(t,s){const i=[s];for(;t&&t.level!==0;)t=t.parent,t&&i.push(t.key);return i}getFilteredRowNodes(){const t={};return this.gridRowModel.forEachNodeAfterFilterAndSort(s=>{t[s.id]=s}),t}getAllRowNodes(){const t=[];return this.gridRowModel.forEachNode(s=>{t.push(s)}),this.sortRowNodes(t)}sortRowNodes(t){const s=this.sortController.getSortOptions();return!s||s.length==0?t:this.rowNodeSorter.doFullSort(t,s)}},lw=class extends bv{constructor(){super(...arguments),this.beanName="chartColumnService",this.valueColsWithoutSeriesType=new Set}wireBeans(e){this.columnModel=e.columnModel,this.showRowGroupColsService=e.showRowGroupColsService,this.columnNameService=e.columnNameService,this.visibleColsService=e.visibleColsService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.rowPositionUtils=e.rowPositionUtils}postConstruct(){const e=()=>this.valueColsWithoutSeriesType.clear();this.addManagedEventListeners({newColumnsLoaded:e,rowDataUpdated:e})}getColumn(e){return this.columnModel.getColDefCol(e)}getAllDisplayedColumns(){return this.visibleColsService.getAllCols()}getColDisplayName(e,t){const s="chart",i=this.columnNameService.getDisplayNameForColumn(e,s);if(t){const r=[i],a=o=>{if(!o)return;const n=this.columnNameService.getDisplayNameForColumnGroup(o,s);Pv(n)||(r.unshift(n),a(o.getParent()))};return a(e.getParent()),r.join(" - ")}return i}getRowGroupColumns(){return this.funcColsService.getRowGroupColumns()}getGroupDisplayColumns(){return this.showRowGroupColsService?.getShowRowGroupCols()??[]}isPivotMode(){return this.columnModel.isPivotMode()}isPivotActive(){return this.columnModel.isPivotActive()}getChartColumns(){const e=this.columnModel.getCols(),t=new Set,s=new Set;return e.forEach(i=>{const r=i.getColDef(),a=r.chartDataType;if(a)switch(a){case"category":case"time":t.add(i);return;case"series":s.add(i);return;case"excluded":return;default:Tv(`unexpected chartDataType value '${a}' supplied, instead use 'category', 'series' or 'excluded'`);break}if(r.colId==="ag-Grid-AutoColumn"){t.add(i);return}if(!i.isPrimary()){s.add(i);return}(this.isInferredValueCol(i)?s:t).add(i)}),{dimensionCols:t,valueCols:s}}isInferredValueCol(e){const t=e.getColId();if(t==="ag-Grid-AutoColumn")return!1;const s=this.rowPositionUtils.getRowNode({rowIndex:0,rowPinned:null});if(!s)return this.valueColsWithoutSeriesType.has(t);let i=this.valueService.getValue(e,s);i==null&&(i=this.extractLeafData(s,e)),i!=null&&typeof i.toNumber=="function"&&(i=i.toNumber());const r=typeof i=="number";return r&&this.valueColsWithoutSeriesType.add(t),r}extractLeafData(e,t){if(!e.allLeafChildren)return null;for(let s=0;s<e.allLeafChildren.length;s++){const i=e.allLeafChildren[s],r=this.valueService.getValue(t,i);if(r!=null)return r}return null}destroy(){this.valueColsWithoutSeriesType.clear(),super.destroy()}},Ll=class hu extends Mv{constructor(t){super(),this.suppressComboChartWarnings=!1,this.chartDataModel=t,this.seriesChartTypes=t.params.seriesChartTypes??[]}postConstruct(){this.initComboCharts()}update(t){this.seriesChartTypes=t??this.seriesChartTypes,this.initComboCharts(),this.updateSeriesChartTypes()}initComboCharts(){const t=this.seriesChartTypes&&this.seriesChartTypes.length>0;(this.chartDataModel.chartType==="customCombo"||t)&&(this.chartDataModel.chartType="customCombo",this.savedCustomSeriesChartTypes=this.seriesChartTypes||[])}updateSeriesChartTypes(){if(this.chartDataModel.isComboChart()){if(this.seriesChartTypes=this.seriesChartTypes.map(t=>{const s=["groupedColumn","stackedColumn","stackedArea"].includes(t.chartType);return t.secondaryAxis=s?!1:t.secondaryAxis,t}),this.chartDataModel.chartType==="customCombo"){this.updateSeriesChartTypesForCustomCombo();return}this.updateChartSeriesTypesForBuiltInCombos()}}updateSeriesChartTypesForCustomCombo(){!(this.seriesChartTypes&&this.seriesChartTypes.length>0)&&!this.suppressComboChartWarnings&&Sr("'seriesChartTypes' are required when the 'customCombo' chart type is specified."),this.seriesChartTypes=this.seriesChartTypes.map(r=>(hu.SUPPORTED_COMBO_CHART_TYPES.includes(r.chartType)||(Sr(`invalid chartType '${r.chartType}' supplied in 'seriesChartTypes', converting to 'line' instead.`),r.chartType="line"),r));const s=r=>{(!this.savedCustomSeriesChartTypes||this.savedCustomSeriesChartTypes.length===0)&&(this.savedCustomSeriesChartTypes=this.seriesChartTypes);const a=this.savedCustomSeriesChartTypes.find(o=>o.colId===r.colId);return a||(r.selected&&!this.suppressComboChartWarnings&&Sr(`no 'seriesChartType' found for colId = '${r.colId}', defaulting to 'line'.`),{colId:r.colId,chartType:"line",secondaryAxis:!1})},i=this.chartDataModel.valueColState.map(s);this.seriesChartTypes=i,this.savedCustomSeriesChartTypes=i,this.suppressComboChartWarnings=!0}updateChartSeriesTypesForBuiltInCombos(){const{chartType:t,valueColState:s}=this.chartDataModel,i=t==="columnLineCombo"?"groupedColumn":"stackedArea",r=t==="columnLineCombo"?"line":"groupedColumn",a=s.filter(n=>n.selected),o=Math.ceil(a.length/2);this.seriesChartTypes=a.map((n,l)=>{const c=l>=o?r:i;return{colId:n.colId,chartType:c,secondaryAxis:!1}})}};Ll.SUPPORTED_COMBO_CHART_TYPES=["line","groupedColumn","stackedColumn","area","stackedArea"];var cw=Ll,kl=class Ko extends mv{constructor(t){super(),this.unlinked=!1,this.chartData=[],this.valueColState=[],this.dimensionColState=[],this.columnNames={},this.crossFiltering=!1,this.grouping=!1,this.params=t,this.chartId=t.chartId,this.setParams(t)}wireBeans(t){this.rangeService=t.rangeService,this.chartTranslationService=t.chartTranslationService}setParams(t){const{chartType:s,pivotChart:i,chartThemeName:r,switchCategorySeries:a,aggFunc:o,cellRange:n,suppressChartRanges:l,unlinkChart:c,crossFiltering:h,seriesGroupType:d}=t;this.chartType=s,this.pivotChart=i??!1,this.chartThemeName=r,this.switchCategorySeries=!!a,this.aggFunc=o,this.referenceCellRange=n,this.suppliedCellRange=n,this.suppressChartRanges=l??!1,this.unlinked=!!c,this.crossFiltering=!!h,this.seriesGroupType=d}postConstruct(){this.datasource=this.createManagedBean(new nw),this.chartColumnService=this.createManagedBean(new lw),this.comboChartModel=this.createManagedBean(new cw(this)),this.updateCellRanges({setColsFromRange:!0}),this.updateData()}updateModel(t){const{cellRange:s,seriesChartTypes:i}=t;s!==this.suppliedCellRange&&(this.dimensionCellRange=void 0,this.valueCellRange=void 0),this.setParams(t),this.updateSelectedDimensions(s?.columns),this.updateCellRanges({setColsFromRange:!0}),(this.isComboChart()||i)&&this.comboChartModel.update(i),this.unlinked||this.updateData()}updateCellRanges(t){const{updatedColState:s,resetOrder:i,maintainColState:r,setColsFromRange:a}=t??{};this.valueCellRange&&(this.referenceCellRange=this.valueCellRange);const{dimensionCols:o,valueCols:n}=this.chartColumnService.getChartColumns(),l=this.getAllColumnsFromRanges();s&&this.updateColumnState(s,i),this.setDimensionCellRange(o,l,s),this.setValueCellRange(n,l,a),!s&&!r&&(this.resetColumnState(),this.syncDimensionCellRange()),this.comboChartModel.updateSeriesChartTypes()}updateData(){const{startRow:t,endRow:s}=this.getRowIndexes();this.pivotChart&&this.resetColumnState(),this.grouping=this.isGrouping();const i={aggFunc:this.aggFunc,dimensionCols:this.getSelectedDimensions(),grouping:this.grouping,pivoting:this.isPivotActive(),crossFiltering:this.crossFiltering,valueCols:this.getSelectedValueCols(),startRow:t,endRow:s,isScatter:nl(["scatter","bubble"],this.chartType)},{chartData:r,columnNames:a,groupChartData:o}=this.datasource.getData(i);this.chartData=r,this.groupChartData=o,this.columnNames=a,this.categoryAxisType=void 0}isGrouping(){const t=this.gos.get("treeData"),s=t?null:this.chartColumnService.getRowGroupColumns(),i=t||s&&s.length>0,r=this.getSelectedDimensions().map(({colId:n})=>n),o=this.chartColumnService.getGroupDisplayColumns().map(n=>n.getColId()).some(n=>r.includes(n));return!!i&&o}getSelectedValueCols(){return this.valueColState.filter(t=>t.selected).map(t=>t.column)}getSelectedDimensions(){return this.dimensionColState.filter(t=>t.selected)}getColDisplayName(t,s){return this.chartColumnService.getColDisplayName(t,s)}isPivotMode(){return this.chartColumnService.isPivotMode()}getChartDataType(t){const s=this.chartColumnService.getColumn(t);return s?s.getColDef().chartDataType:void 0}isPivotActive(){return this.chartColumnService.isPivotActive()}createCellRange(t,...s){return{id:this.chartId,startRow:this.referenceCellRange.startRow,endRow:this.referenceCellRange.endRow,columns:s,startColumn:t===Vt.DIMENSION||this.referenceCellRange.startColumn==null?s[0]:this.referenceCellRange.startColumn,type:t}}getAllColumnsFromRanges(){if(this.pivotChart)return new Set(this.chartColumnService.getAllDisplayedColumns());const t=this.dimensionCellRange||this.valueCellRange?[]:this.referenceCellRange.columns;return this.dimensionCellRange&&t.push(...this.dimensionCellRange.columns),this.valueCellRange&&t.push(...this.valueCellRange.columns),new Set(t)}getRowIndexes(){let t=0,s=0;const{rangeService:i,valueCellRange:r,dimensionCellRange:a}=this,o=r||a;if(i&&o){t=i.getRangeStartRow(o).rowIndex;const n=i.getRangeEndRow(o);s=n.rowPinned==="bottom"?-1:n.rowIndex}return{startRow:t,endRow:s}}resetColumnState(){const{dimensionCols:t,valueCols:s}=this.chartColumnService.getChartColumns(),i=this.getAllColumnsFromRanges(),r=this.valueColState.length<1;this.dimensionColState=[],this.valueColState=[];const a=et(O(this.chartType));let o=!1,n=1;const l=this.suppliedCellRange.columns[0];t.forEach(d=>{const u=d.getColId()==="ag-Grid-AutoColumn";let p=!1;this.crossFiltering&&this.aggFunc?l.getColId()===d.getColId()&&(p=!0):p=u?!0:(!o||a)&&i.has(d),this.dimensionColState.push({column:d,colId:d.getColId(),displayName:this.getColDisplayName(d),selected:p,order:n++}),p&&(o=!0)});const c={colId:Ko.DEFAULT_CATEGORY,displayName:this.chartTranslationService.translate("defaultCategory"),selected:!o,order:0};this.dimensionColState.unshift(c);const h=this.referenceCellRange.columns.filter(d=>s.has(d));s.forEach(d=>{r&&nl(this.referenceCellRange.columns,d)&&(d=h.shift()),this.valueColState.push({column:d,colId:d.getColId(),displayName:this.getColDisplayName(d),selected:i.has(d),order:n++})})}updateColumnState(t,s){const i=h=>h.colId===t.colId,{dimensionColState:r,valueColState:a}=this,o=r.find(i),n=a.find(i);if(o)if(et(O(this.chartType)))o.selected=t.selected;else{const d=t.selected?o:r.filter(u=>u!==o).find(({selected:u})=>u);r.forEach(u=>u.selected=u===d)}else n&&(n.selected=t.selected);const l=[...r,...a],c=[];s||(l.forEach((h,d)=>{d===t.order&&c.push(t.colId),h.colId!==t.colId&&c.push(h.colId)}),l.forEach(h=>{const d=c.indexOf(h.colId);h.order=d>=0?c.indexOf(h.colId):l.length-1})),this.reorderColState()}reorderColState(){const t=(s,i)=>s.order-i.order;this.dimensionColState.sort(t),this.valueColState.sort(t)}setDimensionCellRange(t,s,i){this.dimensionCellRange=void 0;const r=et(O(this.chartType));if(!i&&!this.dimensionColState.length){const l=new Array;t.forEach(c=>{l.length>0&&!r||!s.has(c)||l.push(c)}),l.length>0&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...l));return}let a=i?[i]:[];if(this.crossFiltering&&this.aggFunc){const l=this.suppliedCellRange.columns[0];a=this.dimensionColState.filter(c=>c.colId===l.getColId())}else(r||a.length===0||a.some(({column:l})=>!l||!t.has(l)))&&(a=this.dimensionColState.filter(l=>l.selected));const o=a.length===1?a[0].colId===Ko.DEFAULT_CATEGORY:!1,n=a.map(({column:l})=>l).filter(l=>l!=null);n.length>0&&!o&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...n))}setValueCellRange(t,s,i){this.valueCellRange=void 0;const r=[],a=ti(this.chartType);let o=0;if(t.forEach(n=>{i?(a==null||o<a)&&s.has(n)&&(r.push(n),o++):this.valueColState.some(l=>l.selected&&l.colId===n.getColId())&&r.push(n)}),r.length>0){let n=[];this.valueColState.length>0?n=this.valueColState.map(l=>l.colId):s.forEach(l=>n.push(l.getColId())),r.sort((l,c)=>n.indexOf(l.getColId())-n.indexOf(c.getColId())),this.valueCellRange=this.createCellRange(Vt.VALUE,...r)}}resetCellRanges(t,s){if(!t&&!s)return;const{dimensionCols:i,valueCols:r}=this.chartColumnService.getChartColumns(),a=this.getAllColumnsFromRanges();t&&this.setDimensionCellRange(i,a),s&&this.setValueCellRange(r,a)}updateSelectedDimensions(t){const s=new Set(t.map(r=>r.getColId()));if(et(O(this.chartType))){const r=this.dimensionColState.filter(o=>s.has(o.colId)),a=new Set(r.map(o=>o.colId));this.dimensionColState=this.dimensionColState.map(o=>({...o,selected:a.has(o.colId)}))}else{const a=(this.dimensionColState.find(o=>s.has(o.colId))||this.dimensionColState[0]).colId;this.dimensionColState=this.dimensionColState.map(o=>({...o,selected:o.colId===a}))}}syncDimensionCellRange(){const t=this.getSelectedDimensions();if(t.length===0)return;const s=t.map(({column:i})=>i).filter(i=>i!=null);s.length>0&&(this.dimensionCellRange=this.createCellRange(Vt.DIMENSION,...s))}isComboChart(t){return Ir(t??this.chartType)}};kl.DEFAULT_CATEGORY="AG-GRID-DEFAULT-CATEGORY";var Te=kl,ut=e=>t=>t==null?!0:e(t),Gl=e=>typeof e=="string",Ol=e=>typeof e=="boolean",hw=e=>typeof e=="object",Me=(e,t)=>s=>`AG Grid - unable to update chart as invalid params supplied: \`${e}: ${s}\`, expected ${t}.`,Bl=e=>`${e} is not supported in AG Charts Community (either 'ag-grid-charts-enterprise' or '@ag-grid-enterprise/charts-enterprise' hasn't been loaded). See https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/ for more details.`,z=class Q{static isEnterprise(){return Fv.enterpriseModule.isEnterprise}static isValidChartType(t){return!!Tl(t)||Ir(t)}static isLegacyChartType(t){return Q.legacyChartTypes.includes(t)}static validateUpdateParams(t){switch(t.type){case"rangeChartUpdate":return Q.validateUpdateRangeChartParams(t);case"pivotChartUpdate":return Q.validateUpdatePivotChartParams(t);case"crossFilterChartUpdate":return Q.validateUpdateCrossFilterChartParams(t);default:return _t(`Invalid value supplied for 'type': ${t.type}. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.`),!1}}static validateCreateParams(t){return ii(t,[Q.enterpriseChartTypeValidation,Q.switchCategorySeriesValidation])}static validateUpdateRangeChartParams(t){const s=[...Q.commonUpdateValidations,Q.enterpriseChartTypeValidation,...Q.cellRangeValidations,{property:"seriesChartTypes",validationFn:i=>i===void 0||Array.isArray(i)&&i.every(hw),warnMessage:Me("seriesChartTypes","Array of SeriesChartType")}];return ii(t,s,[...Q.baseUpdateChartParams,"cellRange","suppressChartRanges","switchCategorySeries","aggFunc","seriesChartTypes","seriesGroupType"],"UpdateRangeChartParams")}static validateUpdatePivotChartParams(t){const s=[...Q.commonUpdateValidations];return ii(t,s,[...Q.baseUpdateChartParams],"UpdatePivotChartParams")}static validateUpdateCrossFilterChartParams(t){const s=[...Q.commonUpdateValidations,...Q.cellRangeValidations];return ii(t,s,[...Q.baseUpdateChartParams,"cellRange","suppressChartRanges","aggFunc"],"UpdateCrossFilterChartParams")}};z.legacyChartTypes=["doughnut"],z.baseUpdateChartParams=["type","chartId","chartType","chartThemeName","chartThemeOverrides","unlinkChart"],z.validateChartType=ut(e=>{if(z.isValidChartType(e))return!0;if(z.isLegacyChartType(e)){const t=jt(e);return _t(`The chart type '${e}' has been deprecated. Please use '${t}' instead.`),t}return!1}),z.validateAgChartThemeOverrides=ut(e=>typeof e=="object"),z.validateChartParamsCellRange=ut(e=>typeof e=="object"),z.validateAggFunc=ut(e=>typeof e=="string"||typeof e=="function"),z.enterpriseChartTypeValidation={property:"chartType",validationFn:ut(e=>z.isEnterprise()||!e||!Fy(e)),warnMessage:e=>Bl(`The '${e}' chart type`)},z.switchCategorySeriesValidation={property:"switchCategorySeries",validationFn:ut(e=>{if(!e||z.isEnterprise())return!0}),warnMessage:()=>Bl("'switchCategorySeries' has been ignored as it"),warnIfFixed:!0},z.commonUpdateValidations=[{property:"chartId",validationFn:Gl,warnMessage:Me("chartId","string")},{property:"chartType",validationFn:z.validateChartType,warnMessage:Me("chartType","ChartType")},{property:"chartThemeName",validationFn:Gl,warnMessage:Me("chartThemeName","string")},{property:"chartThemeOverrides",validationFn:z.validateAgChartThemeOverrides,warnMessage:Me("chartThemeOverrides","AgChartThemeOverrides")},{property:"unlinkChart",validationFn:Ol,warnMessage:Me("unlinkChart","boolean")}],z.cellRangeValidations=[{property:"cellRange",validationFn:z.validateChartParamsCellRange,warnMessage:Me("cellRange","ChartParamsCellRange")},{property:"suppressChartRanges",validationFn:Ol,warnMessage:Me("suppressChartRanges","boolean")},{property:"aggFunc",validationFn:z.validateAggFunc,warnMessage:Me("aggFunc","string or IAggFunc")},z.switchCategorySeriesValidation];var Nl=z;function ii(e,t,s,i){let r;for(const a of t){const{property:o,validationFn:n,warnMessage:l,warnIfFixed:c}=a;if(o in e){const h=e[o],d=n(h);if(d===!0)continue;if(d===!1)return _t(l(h)),!1;r=r||{...e},r[o]=d,c&&_t(l(h))}}if(s){for(const a in e)if(!s.includes(a))return _t(`Unexpected property supplied. ${i} does not contain: \`${a}\`.`),!1}return r||!0}var Vl=["ag-default","ag-material","ag-sheets","ag-polychroma","ag-vivid"],dw=class extends dv{constructor(e){super(),this.model=e,this.isEnterprise=()=>uv.enterpriseModule.isEnterprise}wireBeans(e){this.rangeService=e.rangeService}postConstruct(){this.setChartRange(),this.model.unlinked&&this.rangeService&&this.rangeService.setCellRanges([]);const e=this.updateForGridChange.bind(this,{});this.addManagedEventListeners({cellSelectionChanged:t=>{t.id&&t.id===this.model.chartId&&this.updateForRangeChange()},columnMoved:e,columnPinned:e,columnVisible:e,columnRowGroupChanged:e,modelUpdated:e,cellValueChanged:this.updateForDataChange.bind(this)})}update(e){if(!this.validUpdateType(e))return!1;const t=Nl.validateUpdateParams(e);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;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.suppressChartRanges=e.suppressChartRanges??this.model.suppressChartRanges;break;case"pivotChartUpdate":o.switchCategorySeries=!1;break}this.model.updateModel(o),o.unlinkChart||o.suppressChartRanges?this.rangeService?.setCellRanges([]):this.setChartRange()}updateForGridChange(e){if(this.model.unlinked)return;const{maintainColState:t,setColsFromRange:s}=e??{};this.model.updateCellRanges({maintainColState:t,setColsFromRange:s}),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(o=>({colId:o.colId,displayName:o.displayName})),i=this.getChartData(),r=this.getSelectedDimensions(),a={data:i,groupData:this.model.groupChartData,grouping:this.isGrouping(),categories:r.map(o=>({id:o.colId,name:o.displayName,chartDataType:this.model.categoryAxisType??this.model.getChartDataType(o.colId)})),fields:s,chartId:this.getChartId(),getCrossFilteringContext:()=>({lastSelectedChartId:"xxx"}),seriesChartTypes:this.getSeriesChartTypes(),updatedOverrides:e,seriesGroupType:this.model.seriesGroupType};return this.isCategorySeriesSwitched()?this.invertCategorySeriesParams(a):a}invertCategorySeriesParams(e){const[t]=e.categories,s=[{id:Te.DEFAULT_CATEGORY,name:""}],i=e.data.map((a,o)=>{const n=`${t.id}:${o}`,l=a[t.id],c=l==null?"":String(l);return{colId:n,displayName:c}}),r=e.fields.map(a=>{const o={[Te.DEFAULT_CATEGORY]:a.displayName};for(const[n,l]of e.data.entries()){const c=`${t.id}:${n}`,h=l[a.colId];o[c]=h}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}}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(),this.raiseChartOptionsChangedEvent()}isCategorySeriesSwitched(){return this.model.switchCategorySeries&&!this.model.isGrouping()}switchCategorySeries(e){Fl(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=(n,l)=>{let c=0;for(const h of n)h.selected&&(c>=l?h.selected=!1:c++);c===0&&(n[0].selected=!0)},i=Lr(t),r=ti(t),a=i!=null&&(Lr(e)??100)>(i??100),o=r!=null&&(ti(e)??100)>(r??100);a&&s(this.model.dimensionColState,i),o&&s(this.model.valueColState,r),(a||o)&&(this.model.resetCellRanges(a,o),this.setChartRange(!0))}setChartThemeName(e,t){this.model.chartThemeName=e,t||(this.raiseChartModelUpdateEvent(),this.raiseChartOptionsChangedEvent())}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")||Vl}getThemes(){return this.getThemeNames().map(t=>{const i=Or(t)?t:this.chartProxy.lookupCustomChartTheme(t);return pv.getChartTheme(i)})}getPalettes(){return this.getThemes().map(t=>t.palette)}getThemeTemplateParameters(){return this.getThemes().map(t=>t.getTemplateParameters())}getValueColState(){return this.model.valueColState.map(this.displayNameMapper.bind(this))}getSelectedValueColState(){return this.getValueColState().filter(e=>e.selected)}getSelectedDimensions(){return this.model.getSelectedDimensions()}displayNameMapper(e){const{column:t}=e;if(t)e.displayName=this.model.getColDisplayName(t,this.model.isPivotMode());else{const s=this.model.columnNames[e.colId];e.displayName=s?s.join(" - "):this.model.getColDisplayName(t)}return e}getColStateForMenu(){return{dimensionCols:this.model.dimensionColState,valueCols:this.getValueColState()}}setChartRange(e=!1){this.rangeService&&!this.model.suppressChartRanges&&!this.model.unlinked&&this.rangeService.setCellRanges(this.getCellRanges()),e||this.raiseChartModelUpdateEvent()}detachChartRange(){this.model.unlinked=!this.model.unlinked,this.model.unlinked?this.rangeService&&this.rangeService.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 a=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"}),a!==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"]:[O(t)]}getChartSeriesType(){const e=this.getSeriesChartTypes();if(e.length===0)return"bar";const t=e[0].chartType;return t==="columnLineCombo"?"bar":t==="areaColumnCombo"?"area":O(t)}getCellRanges(){return[this.model.dimensionCellRange,this.model.valueCellRange].filter(e=>e)}createCellRange(e){return e.cellRange&&this.rangeService?.createPartialCellRangeFromRangeParams(e.cellRange,!0)}validUpdateType(e){if(!e.type)return rl("Unable to update chart as the 'type' is missing. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'."),!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||rl(`Unable to update chart as a '${e.type}' update type is not permitted on a ${s}.`),i}getCellRangeParams(){const e=this.getCellRanges(),t=e[0],s=t&&t.startRow||null,i=t&&t.endRow||null;return{rowStartIndex:s&&s.rowIndex,rowStartPinned:s&&s.rowPinned,rowEndIndex:i&&i.rowIndex,rowEndPinned:i&&i.rowPinned,columns:e.reduce((r,a)=>r.concat(a.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"})}raiseChartUpdatedEvent(){this.dispatchLocalEvent({type:"chartUpdated"})}raiseChartApiUpdateEvent(){this.dispatchLocalEvent({type:"chartApiUpdate"})}raiseChartOptionsChangedEvent(){const{chartId:e,chartType:t}=this.getChartModel();this.eventService.dispatchEvent({type:"chartOptionsChanged",chartId:e,chartType:t,chartThemeName:this.getChartThemeName(),chartOptions:this.chartProxy.getChartThemeOverrides()})}raiseChartRangeSelectionChangedEvent(){this.eventService.dispatchEvent({type:"chartRangeSelectionChanged",id:this.model.chartId,chartId:this.model.chartId,cellRange:this.getCellRangeParams()})}destroy(){super.destroy(),this.rangeService&&this.rangeService.setCellRanges([])}};function _l(e){return e.chart!=null?e.chart:e}var Yt=class{constructor(e){this.chartProxyParams=e,this.clearThemeOverrides=!1,this.isEnterpriseCharts=Rv.enterpriseModule.isEnterprise,this.chart=e.chartInstance,this.chartType=e.chartType,this.crossFiltering=e.crossFiltering,this.crossFilterCallback=e.crossFilterCallback,this.standaloneChartType=O(this.chartType),this.chart==null?this.chart=Av.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 _l(this.chart)}getChartRef(){return this.chart}downloadChart(e,t,s){const{chart:i}=this,r=_l(i),a=t||(r.title?r.title.text:"chart"),{width:o,height:n}=e||{};i.download({width:o,height:n,fileName:a,fileFormat:s})}getChartImageDataURL(e){return this.getChart().getCanvasDataURL(e)}getChartOptions(){return this.chart.getOptions()}getChartThemeOverrides(){return this.getChartOptions().theme.overrides??{}}getChartPalette(){return Ev.getChartTheme(this.getChartOptions().theme).palette}setPaired(e){const t=O(this.chartProxyParams.chartType);this.chart.updateDelta({theme:{overrides:{[t]:{paired:e}}}})}isPaired(){const e=O(this.chartProxyParams.chartType);return st(this.getChartThemeOverrides(),`${e}.paired`,!0)}lookupCustomChartTheme(e){return Dl(this.chartProxyParams,e)}getSeriesGroupType(){}transformCategoryData(e,t){return e.map((s,i)=>{const r=s[t],a=r&&r.toString?r.toString():"",o={...s};return o[t]={id:i,value:r,toString:()=>a},o})}getCommonChartOptions(e){const t=this.clearThemeOverrides?{}:this.chart?.getOptions()??{},s=this.chart!=null?this.getActiveFormattingPanelOverrides():void 0;this.clearThemeOverrides=!1;const i=ew(this.chartProxyParams,this,this.isEnterpriseCharts,this.getChartThemeDefaults(),e??s),r={...t,mode:"integrated"};return r.theme=i,r.container=this.chartProxyParams.parentElement,r}getChartThemeDefaults(){const e=this.getSeriesChartThemeDefaults(),t=e?{[this.standaloneChartType]:e}:{},s={enabled:!0,snap:!0,label:{enabled:!1}},i=this.isEnterpriseCharts?{zoom:{enabled:!0},animation:{enabled:!0,duration:500},axes:{number:{crosshair:s},category:{crosshair:s},log:{crosshair:s},time:{crosshair:s}}}:{};return i.minHeight=0,i.minWidth=0,i.navigator={enabled:!1},{common:i,...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)}},_e=class extends Yt{constructor(e){super(e),this.crossFilteringAllPoints=new Set,this.crossFilteringSelectedPoints=[]}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[0].type,{categories:i,data:r}=e,[a]=i;switch(s){case"category":return this.transformCategoryData(r,a.id);case"time":return this.transformTimeData(r,a.id);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){return e[0]?.[t]instanceof Date?e:e.map(i=>{const r=i[t];return typeof r=="string"?{...i,[t]:new Date(r)}:i})}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={nodeClick:a=>{const o=a.datum[r.xKey],n=a.event.metaKey||a.event.ctrlKey;this.crossFilteringAddSelectedPoint(n,o),this.crossFilterCallback(a)}},r.marker={itemStyler:a=>{const o=a.datum[s.id];return{fill:a.highlighted?"yellow":a.fill,size:a.highlighted?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(a=>{const o=a[t.id];this.crossFilteringAllPoints.add(o);const n=this.crossFilteringPointSelected(o);return this.standaloneChartType==="area"&&r===e.chartId&&(a[`${s}-total`]=n?a[s]:a[s]+a[i]),this.standaloneChartType==="line"&&(a[`${s}-total`]=n?a[s]:a[s]+a[i]),a})}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 a=r?.overrides?.[t]?.series?.direction;return a!=null?a==="horizontal":typeof r?.baseTheme=="object"?i(r.baseTheme):!1};return i(s)}},uw=class extends _e{constructor(e){super(e)}getAxes(e){const t=[{type:this.getXAxisType(e),position:"bottom"},{type:"number",position:"left"}];if(this.isNormalised()){const s=t[1];s.label={...s.label,formatter:i=>Math.round(i.value)+"%"}}return 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"}};function Ul(e,t){const s=parseInt(e.slice(1,3),16),i=parseInt(e.slice(3,5),16),r=parseInt(e.slice(5,7),16);return t?`rgba(${s}, ${i}, ${r}, ${t})`:`rgba(${s}, ${i}, ${r})`}function Hl(e,t){return e.map(s=>{const i=cl.Color.fromString(s);return new cl.Color(i.r,i.g,i.b,t).toHexString()})}var pw=new Set(["bar","groupedBar","stackedBar","normalizedBar"]),gw=class extends _e{constructor(e){super(e)}getAxes(e){const t=[{type:this.getXAxisType(e),position:this.isHorizontal()?"left":"bottom"},{type:"number",position:this.isHorizontal()?"bottom":"left"}];if(this.isNormalised()){const s=t[1];s.label={...s.label,formatter:i=>Math.round(i.value)+"%"}}return t}getSeries(e){const[t]=e.categories,s=e.fields.map(i=>({type:this.standaloneChartType,direction:this.isHorizontal()?"horizontal":"vertical",stacked:this.crossFiltering||Ry(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=this.getChartPalette(),s=(a,o)=>({...a,highlightStyle:{item:{fill:void 0}},fill:t?.fills?.[o],stroke:t?.strokes?.[o],listeners:{nodeClick:this.crossFilterCallback}}),i=a=>{const o=a.yKey+"-filtered-out";return{...a,yKey:o,fill:Ul(a.fill,"0.3"),stroke:Ul(a.stroke,"0.3"),showInLegend:!1}},r=[];for(let a=0;a<e.length;a++){const o=e[a];r.push(s(o,a)),r.push(i(s(o,a)))}return r}isNormalised(){const e=["normalizedColumn","normalizedBar"];return!this.crossFiltering&&Iv(e,this.chartType)}isHorizontal(){return pw.has(this.chartType)}},mw=class extends _e{constructor(e){super(e)}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[{type:"number",position:"bottom"},{type:"number",position:"left"}]}},fw=class extends _e{constructor(e){super(e)}getAxes(e){return[{type:this.getXAxisType(e),position:"bottom"},{type:"number",position:"left"}]}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}));return this.crossFiltering?this.extractLineAreaCrossFilterSeries(s,e):s}},Cw=class extends _e{constructor(e){super(e)}getAxes(e){return[{type:"number",position:"bottom"},{type:"number",position:"left"}]}getSeries(e){const[t]=e.categories,s=this.isPaired(),i=this.getSeriesDefinitions(e.fields,s),r=t.id===Te.DEFAULT_CATEGORY?void 0:t,a=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(a,e):a}extractCrossFilterSeries(e,t){const{data:s}=t,i=this.getChartPalette(),r=c=>`${c}-filtered-out`,a=(c,h)=>{const d=[1/0,-1/0];if(h!=null)for(const u of c){const p=u[h]??u[r(h)];p<d[0]&&(d[0]=p),p>d[1]&&(d[1]=p)}if(d[0]<=d[1])return d},o=(c,h)=>{const d=i?.fills?.[h],u=i?.strokes?.[h];let p;if(c.type==="bubble"){const{sizeKey:g}=c;p=a(s,g)}return{...c,fill:d,stroke:u,domain:p,highlightStyle:{item:{fill:"yellow"}},listeners:{...c.listeners,nodeClick:this.crossFilterCallback}}},n=c=>{const{yKey:h,xKey:d}=c;let u={};return c.type==="bubble"&&(u={sizeKey:r(c.sizeKey)}),{...c,...u,yKey:r(h),xKey:r(d),fillOpacity:.3,strokeOpacity:.3,showInLegend:!1,listeners:{...c.listeners,nodeClick:p=>{const g=p.datum[r(d)],m={...p,xKey:d,datum:{...p.datum,[d]:g}};this.crossFilterCallback(m)}}}},l=e.map(o);return[...l,...l.map(n)]}getSeriesDefinitions(e,t){if(e.length<2)return[];const s=this.chartType==="bubble";if(t)return s?e.map((r,a)=>a%3===0?{xField:r,yField:e[a+1],sizeField:e[a+2]}:null).filter(r=>r&&r.yField&&r.sizeField):e.map((r,a)=>a%2===0?{xField:r,yField:e[a+1]}:null).filter(r=>r&&r.yField);const i=e[0];return s?e.map((r,a)=>a%2===1?{xField:i,yField:r,sizeField:e[a+1]}:null).filter(r=>r&&r.sizeField):e.filter((r,a)=>a>0).map(r=>({xField:i,yField:r}))}},vw=class extends _e{constructor(e){super(e)}getAxes(e,t){return[{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},{type:"number",position:this.isHorizontal(t)?"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}]}},Sw=class extends _e{constructor(e){super(e)}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),a=[{type:this.getXAxisType(e),position:"bottom"}];return i.length>0&&a.push({type:"number",keys:i,position:"left"}),r.length>0&&r.forEach(o=>{const n=s.get(o);if(!(n&&n.colId===o))return;const c={type:"number",keys:[o],position:"right"};a.push(c)}),a}getSeries(e){const{fields:t,seriesChartTypes:s}=e,[i]=e.categories;return t.map(r=>{const a=s.find(o=>o.colId===r.colId);if(a){const o=a.chartType,l=["groupedColumn","groupedBar"].includes(o)?{grouped:!0}:{};return{type:O(o),xKey:i.id,yKey:r.colId,yName:r.displayName,stacked:["stackedArea","stackedColumn"].includes(o),...l}}})}getYKeys(e,t){const s=[],i=[];return e.forEach(r=>{const a=r.colId,o=t.find(n=>n.colId===a);o&&(o.secondaryAxis?i.push(a):s.push(a))}),{primaryYKeys:s,secondaryYKeys:i}}},ri="AG-GRID-DEFAULT-LABEL-KEY";function yw(e,t){const s=zl(e,i,r);return Br(s);function i(o){return t.length}function r(o,n){const l=t[n],c=o[l];return a(c)}function a(o){return o==null?null:String(o)}}function ww(e,t){const s=zl(e,i,r);return Br(s);function i(a){return t(a)?.length??0}function r(a,o){const n=t(a);if(!n)return null;const l=n.length-1-o;return n[l]}}function Br(e,t=null,s){const{depth:i,rootValues:r,value:a,children:o}=e;if(r)return r.map(l=>({[ri]:t,...l}));if(i===0)return[{[ri]:t,...a}];const n=[];for(const[l,c]of o.entries())n.push(...Br(c,l,!0));return s?[{[ri]:t,children:n,...a??{}}]:n}function zl(e,t,s){const i={depth:0,children:new Map};return e.forEach(a=>{const o=t(a);r(a,o,s,0,i)}),i;function r(a,o,n,l,c){if(l===o)return l===0?(c.rootValues||(c.rootValues=[]),c.rootValues.push(a)):c.value=a,c;{const h=n(a,l),d=c.children.get(h),u=r(a,o,n,l+1,d||{depth:0,children:new Map});return c.children.set(h,u),c.depth=Math.max(1+u.depth,c.depth),c}}}var xw=class extends Yt{constructor(e){super(e)}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}}}}getSeries(e,t){return[{type:this.standaloneChartType,labelKey:ri,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:a,grouping:o}=e;if(o){const n=s?r.concat(a?.map(l=>{const c={...l};return delete c[t.colId],c})??[]):r;return ww(n,l=>l[Dv]?.labels??null)}else{const n=i.map(({id:l})=>l);return yw(r,n)}}};function bw(e){const t=e.currentOffset;e.currentOffset-=e.offsetAmount;const s=e.currentOffset;return e.currentOffset-=e.offsetAmount,{outerRadiusOffset:t,innerRadiusOffset:s}}var Pw=class extends Yt{constructor(e){super(e)}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(a=>{const o={type:this.standaloneChartType,angleKey:a.colId,angleName:a.displayName,sectorLabelKey:a.colId,calloutLabelName:t.name,calloutLabelKey:t.id};if(this.chartType==="donut"||this.chartType==="doughnut"){const{outerRadiusOffset:n,innerRadiusOffset:l}=bw(i),c=a.displayName?{title:{text:a.displayName,showInLegend:s>1}}:void 0;return{...o,type:"donut",outerRadiusOffset:n,innerRadiusOffset:l,...c,calloutLine:{colors:this.getChartPalette()?.strokes}}}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=this.getChartPalette(),s=n=>({...n,legendItemKey:n.calloutLabelKey,calloutLabel:{enabled:!1},highlightStyle:{item:{fill:void 0}},radiusKey:n.angleKey,angleKey:n.angleKey+"-total",radiusMin:0,radiusMax:1,listeners:{nodeClick:this.crossFilterCallback}}),i=(n,l)=>({...o,radiusKey:l+"-filtered-out",fills:Hl(n.fills??t?.fills??[],.3),strokes:Hl(n.strokes??t?.strokes??[],.3),showInLegend:!1}),r=e[0],a=r.angleKey,o=s(r);return[i(s(r),a),o]}getFields(e){return this.chartType==="pie"?e.fields.slice(0,1):e.fields}},Tw=class extends Yt{constructor(e){super(e)}getAxes(e){const t=this.standaloneChartType==="radial-bar";return[{type:t?"angle-number":"angle-category"},{type:t?"radius-category":"radius-number"}]}getSeries(e){const{fields:t,categories:s,seriesGroupType:i}=e,[r]=s,a=this.standaloneChartType==="radial-bar",o=this.getSeriesGroupTypeOptions(i);return t.map(n=>({type:this.standaloneChartType,angleKey:a?n.colId:r.id,angleName:a?n.displayName??void 0:r.name,radiusKey:a?r.id:n.colId,radiusName:a?r.name:n.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.some(i=>i.type==="angle-category"||i.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}:{}}};function Mw(e,t){return e.reduce((s,i,r,a)=>s.concat(t(i,r,a)),new Array)}var Fw="AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY",Aw="AG-GRID-DEFAULT-HEATMAP-SERIES-KEY",Rw="AG-GRID-DEFAULT-HEATMAP-VALUE-KEY",Ew=class extends Yt{constructor(e){super(e)}getUpdateOptions(e,t){const s=Aw,i=Rw,r=Fw;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 Mw(e.data,(a,o)=>{const n=a[r.id],l=n==null?"":String(n),c={id:o,value:n,toString:()=>l};return e.fields.map(({colId:h,displayName:d})=>({...a,[t]:d,[s]:a[h],[i]:c}))})}getSeriesChartThemeDefaults(){return{gradientLegend:{gradient:{preferredLength:200}},series:{tooltip:{renderer:Iw}}}}};function Iw(e){const{xKey:t,yKey:s,colorKey:i,yName:r,datum:a}=e;return{title:"",content:[{label:r,value:a[s]},{label:a[t],value:i&&a[i]}].map(({label:l,value:c})=>`<b>${Wl(String(l))}:</b> ${Wl(String(c))}`).join("<br>")}}function Wl(e){const t={"&":"&amp;","<":"&lt;",">":"&gt;"},s=`[${Object.keys(t).join("")}]`,i=new RegExp(s,"g");return e.replace(i,r=>t[r])}var Kl=class extends _e{constructor(e){super(e)}getAxes(e,t){return[{type:this.getXAxisType(e),position:this.isHorizontal(t)?"left":"bottom"},{type:"number",position:this.isHorizontal(t)?"bottom":"left"}]}computeSeriesStatistics(e,t){const{data:s,fields:i}=e,[r]=e.categories,a=r.id||Te.DEFAULT_CATEGORY,o=this.groupDataByCategory(a,s);return Array.from(o).map(([n,l])=>{const c={[r.id]:n};return i.forEach((h,d)=>{const u=l.map(p=>p[h.colId]).filter(p=>typeof p=="number"&&!isNaN(p));Object.entries(t(u)).forEach(([p,g])=>{const m=`${p}:${d}`;c[m]=u.length>0?g:null})}),c})}groupDataByCategory(e,t){const s=i=>{if(e===Te.DEFAULT_CATEGORY)return 1;const r=i[e];return r==null?"":r instanceof Date?r.getTime():r};return t.reduce((i,r)=>{const a=s(r),o=i.get(a);return o?o.push(r):i.set(a,[r]),i},new Map)}},Dw=class extends Kl{constructor(e){super(e)}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]}},Lw=class extends Kl{constructor(e){super(e)}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)}))}},kw=class extends Ov{constructor(){super('<div class="ag-chart-menu" data-ref="eMenu"></div>'),this.eMenu=Bv,this.buttonListenersDestroyFuncs=[]}wireBeans(e){this.chartTranslationService=e.chartTranslationService}updateParams(e){const{buttons:t}=e;this.createButtons(t)}createButtons(e){this.buttonListenersDestroyFuncs.forEach(s=>s?.()),this.buttonListenersDestroyFuncs=[];const t=this.eMenu;Nv(t),e.forEach(s=>{const{buttonName:i,iconName:r,callback:a}=s,o=this.createButton(r),n=this.chartTranslationService.translate(i+"ToolbarTooltip");n&&o instanceof HTMLElement&&(o.title=n),this.buttonListenersDestroyFuncs.push(...this.addManagedElementListeners(o,{click:l=>a(l.currentTarget)})),t.appendChild(o)})}createButton(e){const t=Vv(e,this.gos,void 0,!0);t.classList.add("ag-chart-menu-icon");const s=_v(this.gos).createElement("button");return s.appendChild(t),s.classList.add("ag-chart-menu-toolbar-button"),s}destroy(){this.buttonListenersDestroyFuncs=[],super.destroy()}},Gw=class extends Qv{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=>eS(r))}postConstruct(){const{ariaLabel:e,onValuesChange:t,dragSourceId:s}=this.config;this.dropZonePanel=this.createManagedBean(new Bw({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 a=!1;return(s.length||i.length||r.length)&&(a=!0),this.valueList=e,this.updateValues(t,a,!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 Jv({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;return t&&this.selectedValues.length>=t||this.valueList.forEach(s=>{this.selectedValues.includes(s)||e.push({value:s,text:this.valueFormatter(s)})}),e}addValue(e){this.dropZonePanel.addItem(e)}updateValues(e,t,s){const i=this.selectedValues;this.selectedValues=e;const r=this.getChanges(i,e),a=t||r.added.length||r.removed.length,o=tS(this.gos),n=this.eSelect?.getGui().contains(o),l=this.dropZonePanel?.getGui().contains(o);s||this.onValuesChange?.(r);const c=a?!this.refreshSelect():!1;this.dropZonePanel.refreshGui(),a&&n&&(c?this.dropZonePanel.focusList(!0):this.eSelect?.getFocusableElement().focus()),l&&!e.length&&this.eSelect?.getFocusableElement().focus()}getChanges(e,t){const s=t.filter(a=>!e.includes(a)),i=e.filter(a=>!t.includes(a)),r=t.filter((a,o)=>e[o]!==a);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):(sS(this.eSelect.getGui()),this.eSelect=this.destroyBean(this.eSelect),!1)}destroy(){this.destroyBean(this.eSelect),super.destroy()}},Ow=class extends Es{constructor(e,t,s,i,r,a){super(t,s,!1),this.value=e,this.valueFormatter=i,this.draggable=r,this.sourceId=a}getItem(){return this.value}getDisplayName(){return this.valueFormatter(this.value)}getAriaDisplayName(){return this.getDisplayName()}getTooltip(){}createGetDragItem(){return()=>({value:this.value})}getDragSourceType(){return hl.ChartPanel}getDragSourceId(){return this.sourceId}isDraggable(){return this.draggable}},Bw=class extends Is{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 Ow(e,t,s,this.valueFormatter,this.model.isDraggable(),this.sourceId)}getItems(e){return[e.value]}isInterestedIn(e){return e===hl.ChartPanel}},$l=class extends Zv{constructor(e,t,s,i){super(i),this.chartController=e,this.allowMultipleSelection=t,this.maxSelection=s}wireBeans(e){this.chartTranslationService=e.chartTranslationService}addItem(e){this.groupComp.addItem(e)}createGroup(e,t,s,i,r){if(this.allowMultipleSelection){const a=e.filter(o=>o.selected);this.valuePillSelect=this.groupComp.createManagedBean(new Gw({valueList:e,selectedValueList:a,valueFormatter:t,selectPlaceholder:this.chartTranslationService.translate(s),dragSourceId:i,onValuesChange:o=>this.onValueChange(o),maxSelection:this.maxSelection})),this.groupComp.addItem(this.valuePillSelect)}else{const a=this.createValueSelectParams(e);a.onValueChange=o=>{e.forEach(n=>{n.selected=!1}),o.selected=!0,o.colId===Te.DEFAULT_CATEGORY&&this.chartController.setAggFunc(void 0,!0),this.chartController.updateForPanelChange({updatedColState:o,skipAnimation:r?.()})},this.valueSelect=this.groupComp.createManagedBean(new Xv(a)),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,a;const o=()=>{i.forEach((n,l)=>{n.order=l}),a=!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:a})}destroy(){this.valuePillSelect=void 0,this.valueSelect=void 0,super.destroy()}},Nw="sum",Vw=class extends $l{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 pe({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 qv({label:this.chartTranslationService.translate("aggregate"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:t!=null,onValueChange:s=>{const i=s?Nw:void 0;this.chartController.setAggFunc(i),this.aggFuncSelect?.setValue(i,!0),this.aggFuncSelect?.setDisplayed(i!=null)}}))),this.groupComp.addItem(this.aggFuncSelect=this.createBean(new Yv({options:[{value:"sum",text:this.chartTranslationService.translate("sum")},{value:"first",text:this.chartTranslationService.translate("first")},{value:"last",text:this.chartTranslationService.translate("last")},{value:"min",text:this.chartTranslationService.translate("min")},{value:"max",text:this.chartTranslationService.translate("max")},{value:"count",text:this.chartTranslationService.translate("count")},{value:"avg",text:this.chartTranslationService.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!==Te.DEFAULT_CATEGORY);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()}},it=class extends oS{constructor(e){super(),this.chartOptionsProxy=e}wireBeans(e){this.chartTranslationService=e.chartTranslationService}getDefaultColorPickerParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslationService.translate(t??"color"),labelWidth:"flex",inputWidth:"flex",labelAlignment:"top",pickerGap:6},s)}getDefaultNumberInputParams(e,t,s){return this.addValueParams(e,{label:this.chartTranslationService.translate(t),labelAlignment:"top",labelWidth:"flex",inputWidth:"flex",precision:s?.precision,step:s?.step,min:s?.min,max:s?.max},{parseInputValue:i=>{const r=Number(i);return isNaN(r)?void 0:r},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 a=this.getDefaultSliderParamsWithoutValueParams(r,t,s);return a.onValueChange=o=>this.chartOptionsProxy.setValue(e,i?[o]:o),a}getDefaultSliderParamsWithoutValueParams(e,t,s){return{label:this.chartTranslationService.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.chartTranslationService.translate(t),value:i,readOnly:s?.readOnly,passive:s?.passive};return r.onValueChange=a=>{this.chartOptionsProxy.setValue(e,typeof a=="boolean"?a: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.chartTranslationService.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.chartTranslationService.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 a=s?.parseInputValue?s.parseInputValue(r):r;this.chartOptionsProxy.setValue(e,a)},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}},_w=class extends rS{constructor(e,t){super(),this.chartMenuContext=e,this.isOpen=t,this.chartSpecificGroup=aS,this.hasContent=!1}wireBeans(e){this.chartTranslationService=e.chartTranslationService,this.chartService=e.chartService}postConstruct(){const t={title:this.getTitle(),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen,items:[...this.createDirectionSelect(),this.createGroupTypeSelect()]};this.setTemplate(`
192
192
  <div id="chartSpecificGroup">
193
193
  <ag-group-component data-ref="chartSpecificGroup"></ag-group-component>
194
194
  </div>`,[G],{chartSpecificGroup:t}),this.setDisplayed(this.hasContent)}refresh(){this.hasContent=!1,this.chartSpecificGroup.setTitle(this.getTitle()),this.updateDirectionSelect(),this.updateGroupTypeSelect(),this.setDisplayed(this.hasContent)}getTitle(){const e=this.chartMenuContext.chartController.getChartType();return this.chartTranslationService.translate(kr(e))}createDirectionSelect(){if(!this.chartService.isEnterprise())return[];const{chartOptionsService:e,chartController:t}=this.chartMenuContext,s=e.getSeriesOptionsProxy(()=>O(t.getChartType())),i=this.createManagedBean(new it(s)),r=["horizontal","vertical"].map(n=>({value:n,text:this.chartTranslationService.translate(n)})),a=i.getDefaultSelectParams("direction","direction",r),o=a.onValueChange;return a.onValueChange=n=>{o(n),t.raiseChartModelUpdateEvent()},this.directionSelect=this.createManagedBean(new dl(a)),this.updateDirectionSelect(),[this.directionSelect]}updateDirectionSelect(){const e=Dy(this.chartMenuContext.chartController.getChartType());this.updateDisplayed(this.directionSelect,e)}createGroupTypeSelect(){const{chartController:e,chartMenuParamsFactory:t}=this.chartMenuContext;return this.groupTypeSelect=this.createManagedBean(new dl(t.getDefaultSelectParamsWithoutValueParams("seriesGroupType",iS.SERIES_GROUP_TYPES.map(s=>({value:s,text:this.chartTranslationService.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)}},Uw=class extends cS{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.chartTranslationService=e.chartTranslationService}postConstruct(){this.createSeriesChartTypeGroup(this.columns)}refresh(e){hS(this.getValidColIds(e),this.selectedColIds)?this.refreshComps():this.recreate(e)}recreate(e){this.isOpen=this.seriesChartTypeGroupComp.isExpanded(),dS(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 pe({title:this.chartTranslationService.translate("seriesChartType"),enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen}));const t=this.chartController.getSeriesChartTypes();e.forEach(s=>{if(!s.selected)return;const i=t.filter(c=>c.colId===s.colId)[0];if(!i)return;this.selectedColIds.push(s.colId);const r=this.seriesChartTypeGroupComp.createManagedBean(new pe({title:s.displayName,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!0,cssIdentifier:"charts-format-sub-level"})),a=c=>["groupedColumn","stackedColumn","stackedArea"].includes(c),o=this.seriesChartTypeGroupComp.createManagedBean(new nS({label:this.chartTranslationService.translate("secondaryAxis"),labelWidth:"flex",disabled:a(i.chartType),value:!!i.secondaryAxis,onValueChange:c=>this.chartController.updateSeriesChartType(s.colId,void 0,c)}));r.addItem(o);const n=["line","area","stackedArea","groupedColumn","stackedColumn"].map(c=>({value:c,text:this.chartTranslationService.translate(kr(c))})),l=r.createManagedBean(new lS({options:n,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();this.selectedColIds.forEach(t=>{const s=e.find(a=>a.colId===t);if(!s)return;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()}},Hw=class extends $l{constructor(e,t,s,i,r,a,o){super(e,i,r,'<div id="seriesGroup"></div>'),this.chartOptionsService=t,this.title=s,this.valueCols=a,this.isOpen=o}postConstruct(){if(this.groupComp=this.createBean(new pe({title:this.title,enabled:!0,suppressEnabledCheckbox:!0,suppressOpenCloseIcons:!1,cssIdentifier:"charts-data",expanded:this.isOpen})),this.chartController.isActiveXYChart()){const e=this.groupComp.createManagedBean(new uS({label:this.chartTranslationService.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 a=>a.displayName??"";const t=e.filter(a=>a.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"),a=>{const o=a.displayName??"";if(!a.selected)return o;const n=t.indexOf(a);if(n===-1)return o;let l;return i?l=r.get(n%(s?3:2)):n===0?l="X":l=s&&n%2===0?"size":"Y",`${o} (${l})`}}destroy(){this.groupComp=this.destroyBean(this.groupComp),super.destroy()}},zw={groups:[{type:"categories",isOpen:!0},{type:"series",isOpen:!0},{type:"seriesChartType",isOpen:!0},{type:"chartSpecific",isOpen:!0}]},Ww=class extends Wv{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.chartTranslationService=e.chartTranslationService,this.chartService=e.chartService}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 a=Fl(this.chartType)&&this.chartService.isEnterprise()&&!this.chartController.isGrouping();$v(this.switchCategorySeriesToggle.getGui(),a),r&&this.switchCategorySeriesToggle?.setValue(this.chartController.isCategorySeriesSwitched()),this.restoreSwitchCategorySeriesToggleFocus&&(this.restoreSwitchCategorySeriesToggleFocus=!1,a&&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:a})=>{r===(i?"series":"categories")?(this.categoriesDataPanel=this.createBean(new Vw(this.chartController,this.getCategoryGroupTitle(i),this.getCategoryGroupMultipleSelect(s,i),e,a)),this.panels.push(this.categoriesDataPanel)):r===(i?"categories":"series")?(this.seriesDataPanel=this.createBean(new Hw(this.chartController,this.chartMenuContext.chartOptionsService,this.getSeriesGroupTitle(i),this.getSeriesGroupMultipleSelect(s,i),this.getSeriesGroupMaxSelection(s,i),t,a)),this.panels.push(this.seriesDataPanel)):r==="seriesChartType"?this.chartController.isComboChart()&&(this.seriesChartTypePanel=this.createBean(new Uw(this.chartController,t,a)),this.panels.push(this.seriesChartTypePanel)):r==="chartSpecific"?(this.chartSpecificPanel=this.createBean(new _w(this.chartMenuContext,a)),this.panels.push(this.chartSpecificPanel)):jv(`Invalid charts data panel group name supplied: '${r}'`)}),(i?this.categoriesDataPanel:this.seriesDataPanel)?.addItem(this.switchCategorySeriesToggle.getGui()),this.addPanelComponents()}addPanelComponents(){if(!this.panels.length)return;const t=Kv(this.gos).createDocumentFragment();for(const s of this.panels)s.addCssClass("ag-chart-data-section"),t.appendChild(s.getGui());this.getGui().appendChild(t)}clearPanelComponents(){const e=this.getGui();this.panels.forEach(t=>{e.removeChild(t.getGui()),this.destroyBean(t)}),this.panels=[]}getDataPanelDef(){return this.gos.get("chartToolPanelsDef")?.dataPanel??zw}getCategoryGroupTitle(e){return e?this.chartTranslationService.translate("seriesLabels"):this.chartTranslationService.translate(this.chartController.isActiveXYChart()?"labels":"categories")}getCategoryGroupMultipleSelect(e,t){return t?!1:Lr(e)!==1}getSeriesGroupTitle(e){return e?this.chartTranslationService.translate("categoryValues"):this.chartTranslationService.translate(this.chartController.isActiveXYChart()?"xyValues":"series")}getSeriesGroupMultipleSelect(e,t){return this.getSeriesGroupMaxSelection(e,t)!==1}getSeriesGroupMaxSelection(e,t){if(!t)return ti(e)}createSwitchCategorySeriesToggle(){this.switchCategorySeriesToggle=this.createManagedBean(new zv({label:this.chartTranslationService.translate("switchCategorySeries"),labelAlignment:"left",labelWidth:"flex",inputWidth:"flex",value:this.chartController.isCategorySeriesSwitched(),onValueChange:e=>{this.restoreSwitchCategorySeriesToggleFocus=!0,this.chartController.switchCategorySeries(e)}}))}},Kw=class extends vS{constructor(e){super(e,`<div class="ag-angle-select">
@@ -329,7 +329,7 @@ ${kc("readText")}`),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()})
329
329
  `;let a=!1;if(t==="")return[[""]];for(let o=0,n=0,l=0;l<t.length;l++){const c=t[l-1],h=t[l],d=t[l+1],u=()=>{i[o]||(i[o]=[]),i[o][n]||(i[o][n]="")};if(u(),h==='"'&&(a?d==='"'?(i[o][n]+='"',l++):a=!1:(c===void 0||c===s||r(c))&&(a=!0)),!a&&h!=='"'){if(h===s){n++,u();continue}else if(r(h)){n=0,o++,u(),h==="\r"&&d===`
330
330
  `&&l++;continue}}i[o][n]+=h}return i}doPasteOperation(t){const s="clipboard";this.eventService.dispatchEvent({type:"pasteStart",source:s});let i;if(this.clientSideRowModel){const l=this.gos.get("aggregateOnlyChangedColumns");i=new cb(l,this.clientSideRowModel.getRootNode())}const r={},a=[],o=this.focusService.getFocusedCell();t(r,a,o,i);const n=[...a];i&&(this.clientSideRowModel.doAggregate(i),i.forEachChangedNodeDepthFirst(l=>{n.push(l)})),this.rowRenderer.refreshCells({rowNodes:n}),this.dispatchFlashCells(r),this.fireRowChanged(a),this.refocusLastFocusedCell(),this.eventService.dispatchEvent({type:"pasteEnd",source:s})}pasteIntoActiveRange(t,s,i,r,a){const o=this.getRangeSize(t)%s.length!=0;let n=0,l=0;const c=(h,d,u,p)=>{if(p-n>=s.length){if(o)return;n+=l,l=0}const m=s[p-n];r.push(d);const C=this.gos.getCallback("processCellFromClipboard");u.forEach((f,v)=>{if(!f.isCellEditable(d)||f.isSuppressPaste(d))return;v>=m.length&&(v=v%m.length);const S=this.processCell(d,f,m[v],sa,C,!0);d.setDataValue(f,S,ta),a&&a.addParentNode(d.parent,[f]);const{rowIndex:y,rowPinned:w}=h,b=this.cellPositionUtils.createIdFromValues({rowIndex:y,column:f,rowPinned:w});i[b]=!0}),l++};this.iterateActiveRanges(!1,c)}getDisplayedColumnsStartingAt(t){let s=t;const i=[];for(;s!=null;)i.push(s),s=this.visibleColsService.getColAfter(s);return i}pasteStartingFromFocusedCell(t,s,i,r,a){if(!r)return;const o={rowIndex:r.rowIndex,rowPinned:r.rowPinned},n=this.getDisplayedColumnsStartingAt(r.column);this.isPasteSingleValueIntoRange(t)?this.pasteSingleValueIntoRange(t,i,s,a):this.pasteMultipleValues(t,o,i,n,s,Lc,a)}isPasteSingleValueIntoRange(t){return this.hasOnlyOneValueToPaste(t)&&this.rangeService!=null&&!this.rangeService.isEmpty()}pasteSingleValueIntoRange(t,s,i,r){const a=t[0][0],o=(n,l,c)=>{s.push(l),c.forEach(h=>this.updateCellValue(l,h,a,i,Lc,r))};this.iterateActiveRanges(!1,o)}hasOnlyOneValueToPaste(t){return t.length===1&&t[0].length===1}copyRangeDown(){if(!this.rangeService||this.rangeService.isEmpty())return;const t=[],s=(i,r,a,o)=>{const n=this.gos.getCallback("processCellForClipboard"),l=this.gos.getCallback("processCellFromClipboard"),c=(h,d,u)=>{t.length?(r.push(d),u.forEach((p,g)=>{if(!p.isCellEditable(d)||p.isSuppressPaste(d))return;const m=this.processCell(d,p,t[g],sa,l,!0);d.setDataValue(p,m,ta),o&&o.addParentNode(d.parent,[p]);const{rowIndex:C,rowPinned:f}=h,v=this.cellPositionUtils.createIdFromValues({rowIndex:C,column:p,rowPinned:f});i[v]=!0})):u.forEach(p=>{const g=this.processCell(d,p,this.valueService.getValue(p,d),sa,n,!1,!0);t.push(g)})};this.iterateActiveRanges(!0,c)};this.doPasteOperation(s)}removeLastLineIfBlank(t){const s=pb(t);if(s&&s.length===1&&s[0]===""){if(t.length===1)return;gb(t,s)}}fireRowChanged(t){this.gos.get("editType")==="fullRow"&&t.forEach(s=>{this.eventService.dispatchEvent({type:"rowValueChanged",node:s,data:s.data,rowIndex:s.rowIndex,rowPinned:s.rowPinned})})}pasteMultipleValues(t,s,i,r,a,o,n){let l=s;const c=this.clientSideRowModel!=null&&!this.gos.get("enableGroupEdit")&&!this.gos.get("treeData"),h=()=>{for(;;){if(!l)return null;const d=this.rowPositionUtils.getRowNode(l);if(l=this.cellNavigationService.getRowBelow({rowPinned:l.rowPinned,rowIndex:l.rowIndex}),d==null)return null;if(!(d.detail||d.footer||c&&d.group))return d}};t.forEach(d=>{const u=h();u&&(d.forEach((p,g)=>this.updateCellValue(u,r[g],p,a,o,n)),i.push(u))})}updateCellValue(t,s,i,r,a,o){if(!t||!s||!s.isCellEditable(t)||s.isSuppressPaste(t))return;const n=this.processCell(t,s,i,a,this.gos.getCallback("processCellFromClipboard"),!0);t.setDataValue(s,n,ta);const{rowIndex:l,rowPinned:c}=t,h=this.cellPositionUtils.createIdFromValues({rowIndex:l,column:s,rowPinned:c});r[h]=!0,o&&o.addParentNode(t.parent,[s])}copyToClipboard(t={}){this.copyOrCutToClipboard(t)}cutToClipboard(t={},s="api"){this.gos.get("suppressCutToClipboard")||(this.eventService.dispatchEvent({type:"cutStart",source:s}),this.copyOrCutToClipboard(t,!0),this.eventService.dispatchEvent({type:"cutEnd",source:s}))}copyOrCutToClipboard(t,s){let{includeHeaders:i,includeGroupHeaders:r}=t;i==null&&(i=this.gos.get("copyHeadersToClipboard")),r==null&&(r=this.gos.get("copyGroupHeadersToClipboard"));const a={includeHeaders:i,includeGroupHeaders:r},o=this.gos.get("rowSelection"),n=this.gos.get("cellSelection");let l=null;this.shouldCopyCells(n,o)?(this.copySelectedRangeToClipboard(a),l=0):this.shouldCopyRows(o)?(this.copySelectedRowsToClipboard(a),l=1):this.focusService.isAnyCellFocused()&&(this.copyFocusedCellToClipboard(a),l=2),s&&l!==null&&this.clearCellsAfterCopy(l)}shouldCopyCells(t,s){if(!this.rangeService||this.rangeService.isEmpty())return!1;if(t)return!(typeof s=="object"&&s.copySelectedRows&&!this.selectionService.isEmpty());{const i=this.gos.get("suppressCopySingleCellRanges");return!(!this.rangeService.isMoreThanOneCell()&&i)}}shouldCopyRows(t){return this.selectionService.isEmpty()?!1:t&&typeof t!="string"?t.copySelectedRows??!1:!this.gos.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy(t){if(this.eventService.dispatchEvent({type:"keyShortcutChangedCellStart"}),t===0)this.rangeService.clearCellRangeCellValues({cellEventSource:"clipboardService"});else if(t===1)this.clearSelectedRows();else{const s=this.focusService.getFocusedCell();if(s==null)return;const i=this.rowPositionUtils.getRowNode(s);i&&this.clearCellValue(i,s.column)}this.eventService.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){const t=this.selectionService.getSelectedNodes(),s=this.visibleColsService.getAllCols();for(const i of t)for(const r of s)this.clearCellValue(i,r)}clearCellValue(t,s){if(!s.isCellEditable(t))return;const i=this.valueService.getDeleteValue(s,t);t.setDataValue(s,i,"clipboardService")}iterateActiveRanges(t,s,i){if(!this.rangeService||this.rangeService.isEmpty())return;const r=this.rangeService.getCellRanges();t?this.iterateActiveRange(r[0],s,i,!0):r.forEach((a,o)=>this.iterateActiveRange(a,s,i,o===r.length-1))}iterateActiveRange(t,s,i,r){if(!this.rangeService)return;let a=this.rangeService.getRangeStartRow(t);const o=this.rangeService.getRangeEndRow(t);i&&t.columns&&i(t.columns);let n=0,l=!1;for(;!l&&a!=null;){const c=this.rowPositionUtils.getRowNode(a);l=this.rowPositionUtils.sameRow(a,o),s(a,c,t.columns,n++,l&&r),a=this.cellNavigationService.getRowBelow(a)}}copySelectedRangeToClipboard(t={}){if(!this.rangeService||this.rangeService.isEmpty())return;const s=this.rangeService.areAllRangesAbleToMerge(),{data:i,cellsToFlash:r}=s?this.buildDataFromMergedRanges(this.rangeService,t):this.buildDataFromRanges(this.rangeService,t);this.copyDataToClipboard(i),this.dispatchFlashCells(r)}buildDataFromMergedRanges(t,s){const i=new Set,r=t.getCellRanges(),a=new Map,o=[],n={};r.forEach(d=>{d.columns.forEach(g=>i.add(g));const{rowPositions:u,cellsToFlash:p}=this.getRangeRowPositionsAndCellsToFlash(t,d);u.forEach(g=>{const m=`${g.rowIndex}-${g.rowPinned||"null"}`;a.get(m)||(a.set(m,!0),o.push(g))}),Object.assign(n,p)});const l=this.visibleColsService.getAllCols(),c=Array.from(i);return c.sort((d,u)=>{const p=l.indexOf(d),g=l.indexOf(u);return p-g}),{data:this.buildExportParams({columns:c,rowPositions:o,includeHeaders:s.includeHeaders,includeGroupHeaders:s.includeGroupHeaders}),cellsToFlash:n}}buildDataFromRanges(t,s){const i=t.getCellRanges(),r=[],a={};return i.forEach(o=>{const{rowPositions:n,cellsToFlash:l}=this.getRangeRowPositionsAndCellsToFlash(t,o);Object.assign(a,l),r.push(this.buildExportParams({columns:o.columns,rowPositions:n,includeHeaders:s.includeHeaders,includeGroupHeaders:s.includeGroupHeaders}))}),{data:r.join(`
331
331
  `),cellsToFlash:a}}getRangeRowPositionsAndCellsToFlash(t,s){const i=[],r={},a=t.getRangeStartRow(s),o=t.getRangeEndRow(s);let n=a;for(;n&&(i.push(n),s.columns.forEach(l=>{const{rowIndex:c,rowPinned:h}=n,d=this.cellPositionUtils.createIdFromValues({rowIndex:c,column:l,rowPinned:h});r[d]=!0}),!this.rowPositionUtils.sameRow(n,o));)n=this.cellNavigationService.getRowBelow(n);return{rowPositions:i,cellsToFlash:r}}getCellsToFlashFromRowNodes(t){const s=this.visibleColsService.getAllCols(),i={};for(let r=0;r<t.length;r++){const{rowIndex:a,rowPinned:o}=t[r];if(a!=null)for(let n=0;n<s.length;n++){const l=s[n],c=this.cellPositionUtils.createIdFromValues({rowIndex:a,column:l,rowPinned:o});i[c]=!0}}return i}copyFocusedCellToClipboard(t={}){const s=this.focusService.getFocusedCell();if(s==null)return;const i=this.cellPositionUtils.createId(s),r={rowPinned:s.rowPinned,rowIndex:s.rowIndex},a=s.column,o=this.buildExportParams({columns:[a],rowPositions:[r],includeHeaders:t.includeHeaders,includeGroupHeaders:t.includeGroupHeaders});this.copyDataToClipboard(o),this.dispatchFlashCells({[i]:!0})}copySelectedRowsToClipboard(t={}){const{columnKeys:s,includeHeaders:i,includeGroupHeaders:r}=t,a=this.buildExportParams({columns:s,includeHeaders:i,includeGroupHeaders:r});this.copyDataToClipboard(a);const o=this.selectionService.getSelectedNodes()||[];this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(o))}buildExportParams(t){const{columns:s,rowPositions:i,includeHeaders:r=!1,includeGroupHeaders:a=!1}=t,o={columnKeys:s,rowPositions:i,skipColumnHeaders:!r,skipColumnGroupHeaders:!a,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!i,processCellCallback:this.gos.getCallback("processCellForClipboard"),processRowGroupCallback:n=>this.processRowGroupCallback(n),processHeaderCallback:this.gos.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:this.gos.getCallback("processGroupHeaderForClipboard")};return this.csvCreator.getDataAsCsv(o,!0)}processRowGroupCallback(t){const{node:s,column:i}=t,r=this.gos.get("treeData"),a=this.gos.get("suppressGroupMaintainValueType");let n=(()=>{if(r||a||!i)return s.key;const c=s.groupData?.[i.getId()];return!c||!s.rowGroupColumn||s.rowGroupColumn.getColDef().useValueFormatterForExport===!1?c:this.valueService.formatValue(s.rowGroupColumn,s,c)??c})();if(t.node.footer){let c="";n&&n.length&&(c=` ${n}`),n=`Total${c}`}const l=this.gos.getCallback("processCellForClipboard");if(l){let c=s.rowGroupColumn;return!c&&s.footer&&s.level===-1&&(c=this.funcColsService.getRowGroupColumns()[0]),l({value:n,node:s,column:c,type:"clipboard",formatValue:h=>this.valueService.formatValue(c,s,h)??h,parseValue:h=>this.valueService.parseValue(c,s,h,this.valueService.getValue(c,s))})}return n}dispatchFlashCells(t){window.setTimeout(()=>{this.eventService.dispatchEvent({type:"flashCells",cells:t})},0)}processCell(t,s,i,r,a,o,n){return a?a({column:s,node:t,value:i,type:r,formatValue:c=>this.valueService.formatValue(s,t??null,c)??c,parseValue:c=>this.valueService.parseValue(s,t??null,c,this.valueService.getValue(s,t))}):o&&s.getColDef().useValueParserForImport!==!1?this.valueService.parseValue(s,t??null,i,this.valueService.getValue(s,t)):n&&s.getColDef().useValueFormatterForExport!==!1?this.valueService.formatValue(s,t??null,i)??i:i}copyDataToClipboard(t){const s=this.gos.getCallback("sendToClipboard");if(s){s({data:t});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText(t).catch(r=>{di(`${r}
332
- ${kc("writeText")}`),this.copyDataToClipboardLegacy(t)});return}this.copyDataToClipboardLegacy(t)}copyDataToClipboardLegacy(t){this.executeOnTempElement(s=>{const i=Dc(this.gos),r=db(this.gos);s.value=t||" ",s.select(),s.focus({preventScroll:!0}),i.execCommand("copy")||di("Browser did not allow document.execCommand('copy'). Ensure api.copySelectedRowsToClipboard() is invoked via a user event, i.e. button click, otherwise the browser will prevent it for security reasons."),r!=null&&r.focus!=null&&r.focus({preventScroll:!0})})}executeOnTempElement(t,s){const i=Dc(this.gos),r=i.createElement("textarea");r.style.width="1px",r.style.height="1px",r.style.top=i.documentElement.scrollTop+"px",r.style.left=i.documentElement.scrollLeft+"px",r.style.position="absolute",r.style.opacity="0";const a=this.gridCtrl.getGui();a.appendChild(r);try{t(r)}catch{di("Browser does not support document.execCommand('copy') for clipboard operations")}s?window.setTimeout(()=>{s(r),a.removeChild(r)},100):a.removeChild(r)}getRangeSize(t){const s=t.getCellRanges();let i=0,r=0;return s.length>0&&(i=t.getRangeStartRow(s[0]).rowIndex,r=t.getRangeEndRow(s[0]).rowIndex),i-r+1}},ia="32.3.2",Gc=ea({version:ia,moduleName:`${Qr.ClipboardModule}-core`,beans:[wb],dependantModules:[H,nb]}),xb=ea({version:ia,moduleName:`${Qr.ClipboardModule}-api`,apiFunctions:{copyToClipboard:mb,cutToClipboard:fb,copySelectedRowsToClipboard:Cb,copySelectedRangeToClipboard:vb,copySelectedRangeDown:Sb,pasteFromClipboard:yb},dependantModules:[Gc]}),ra=ea({version:ia,moduleName:Qr.ClipboardModule,dependantModules:[Gc,xb]});import{ModuleNames as bb,_defineModule as Pb}from"ag-grid-community";import{ModuleNames as aa,_ColumnFilterModule as Tb,_FloatingFilterModule as Mb,_defineModule as Qt}from"ag-grid-community";import{BeanStub as Fb,_exists as Oc,_existsAndNotEmpty as Ab,_includes as Rb,_iterateObject as Eb,_last as Ib}from"ag-grid-community";import{BeanStub as Db,_errorOnce as Lb,_getGrandTotalRow as kb,_getGroupAggFiltering as Gb,_missingOrEmpty as Ob}from"ag-grid-community";import{AgColumn as Bb,BeanStub as Nb,GROUP_AUTO_COLUMN_ID as Bc,_isColumnsSortingCoupledToGroup as Vb,_isGroupMultiAutoColumn as _b,_mergeDeep as Ub,_missing as oa,_warnOnce as Hb}from"ag-grid-community";import{BeanStub as zb}from"ag-grid-community";import{Component as Wb,_setAriaRole as Kb}from"ag-grid-community";import{_createIconNoSpan as $b}from"ag-grid-community";import{DragSourceType as Nc}from"ag-grid-community";import{Component as jb,DragSourceType as Yb,KeyCode as ui,RefPlaceholder as qb,SortIndicatorSelector as Xb,_loadTemplate as Zb}from"ag-grid-community";import{_createIconNoSpan as Jb}from"ag-grid-community";import{BeanStub as Qb,_getGroupAggFiltering as eP}from"ag-grid-community";import{AgPromise as mt,AgSelect as tP,FilterWrapperComp as sP,RefPlaceholder as Vc,TabGuardComp as iP,_clearElement as na,_loadTemplate as rP,_setDisplayed as la,_warnOnce as es}from"ag-grid-community";import{AgInputTextField as aP,AgPromise as _c,Component as oP,RefPlaceholder as nP,_clearElement as lP}from"ag-grid-community";import{BeanStub as cP}from"ag-grid-community";import{BeanStub as hP,RowNode as Uc,_areEqual as ca,_exists as Hc,_existsAndNotEmpty as ha,_removeFromArray as dP,_warnOnce as uP}from"ag-grid-community";import{BeanStub as pP,_warnOnce as zc}from"ag-grid-community";import{RowNode as Wc}from"ag-grid-community";import{BeanStub as gP,_cloneObject as mP,_iterateObject as Kc}from"ag-grid-community";import{BeanStub as fP,_iterateObject as CP,_missing as vP}from"ag-grid-community";import{BeanStub as SP}from"ag-grid-community";import{_createIconNoSpan as yP}from"ag-grid-community";var wP={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},xP=class extends Fb{constructor(){super(...arguments),this.beanName="aggFuncService",this.aggFuncsMap={},this.initialised=!1}postConstruct(){this.init()}init(){this.initialised||(this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs")))}initialiseWithDefaultAggregations(){const e=this.aggFuncsMap;e.sum=bP,e.first=PP,e.last=TP,e.min=MP,e.max=FP,e.count=AP,e.avg=RP,this.initialised=!0}isAggFuncPossible(e,t){const s=this.getFuncNames(e),i=Rb(s,t),r=Oc(this.aggFuncsMap[t]);return i&&r}getDefaultFuncLabel(e){return wP[e]??e}getDefaultAggFunc(e){const t=e.getColDef().defaultAggFunc;if(Oc(t)&&this.isAggFuncPossible(e,t))return t;if(this.isAggFuncPossible(e,"sum"))return"sum";const s=this.getFuncNames(e);return Ab(s)?s[0]:null}addAggFuncs(e){this.init(),Eb(e,(t,s)=>{this.aggFuncsMap[t]=s})}getAggFunc(e){return this.init(),this.aggFuncsMap[e]}getFuncNames(e){const t=e.getColDef().allowedAggFuncs;return t??Object.keys(this.aggFuncsMap).sort()}clear(){this.aggFuncsMap={}}};function bP(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 PP(e){return e.values.length>0?e.values[0]:null}function TP(e){return e.values.length>0?Ib(e.values):null}function MP(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 FP(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 AP(e){const{values:t}=e;let s=0;for(let r=0;r<t.length;r++){const a=t[r];s+=a!=null&&typeof a.value=="number"?a.value:1}const i=e.rowNode?.aggData?.[e.column.getColId()];return i&&i.value===s?i:{value:s,toString:function(){return this.value.toString()},toNumber:function(){return this.value}}}function RP(e){const{values:t}=e;let s=0,i=0;for(let o=0;o<t.length;o++){const n=t[o];let l=null;typeof n=="number"||typeof n=="bigint"?(l=n,i++):n!=null&&(typeof n.value=="number"||typeof n.value=="bigint")&&typeof n.count=="number"&&(l=n.value*(typeof n.value=="number"?n.count:BigInt(n.count)),i+=n.count),typeof l=="number"?s+=typeof s=="number"?l:BigInt(l):typeof l=="bigint"&&(s=(typeof s=="bigint"?s:BigInt(s))+l)}let r=null;i>0&&(r=s/(typeof s=="number"?i:BigInt(i)));const a=e.rowNode?.aggData?.[e.column?.getColId()];return a&&a.count===i&&a.value===r?a:{count:i,value:r,toString:function(){return typeof this.value=="number"||typeof this.value=="bigint"?this.value.toString():""},toNumber:function(){return this.value}}}var EP=class extends Db{constructor(){super(...arguments),this.beanName="aggregationStage"}wireBeans(e){this.columnModel=e.columnModel,this.aggFuncService=e.aggFuncService,this.funcColsService=e.funcColsService,this.pivotResultColsService=e.pivotResultColsService,this.valueService=e.valueService}execute(e){const t=Ob(this.funcColsService.getValueColumns()),s=!this.gos.getCallback("getGroupRowAgg"),i=e.changedPath&&e.changedPath.isActive();if(t&&s&&i)return;const r=this.createAggDetails(e);this.recursivelyCreateAggData(r)}createAggDetails(e){const t=this.columnModel.isPivotActive(),s=this.funcColsService.getValueColumns(),i=t?this.funcColsService.getPivotColumns():[];return{alwaysAggregateAtRootLevel:this.gos.get("alwaysAggregateAtRootLevel"),groupIncludeTotalFooter:!!kb(this.gos),changedPath:e.changedPath,valueColumns:s,pivotColumns:i,filteredOnly:!this.isSuppressAggFilteredOnly(),userAggFunc:this.gos.getCallback("getGroupRowAgg")}}isSuppressAggFilteredOnly(){return Gb(this.gos)!==void 0||this.gos.get("suppressAggFilteredOnly")}recursivelyCreateAggData(e){const t=s=>{if(!s.hasChildren()){s.aggData&&s.setAggData(null);return}if(s.level===-1&&!e.groupIncludeTotalFooter){const a=!this.columnModel.isPivotMode();if(!e.alwaysAggregateAtRootLevel&&a){s.setAggData(null);return}}this.aggregateRowNode(s,e)};e.changedPath.forEachChangedNodeDepthFirst(t,!0)}aggregateRowNode(e,t){const s=t.valueColumns.length===0,i=t.pivotColumns.length===0;let r;t.userAggFunc?r=t.userAggFunc({nodes:e.childrenAfterFilter}):s?r=null:i?r=this.aggregateRowNodeUsingValuesOnly(e,t):r=this.aggregateRowNodeUsingValuesAndPivot(e),e.setAggData(r),e.sibling&&e.sibling.setAggData(r)}aggregateRowNodeUsingValuesAndPivot(e){const t={},s=this.pivotResultColsService.getPivotResultCols()?.list??[];let i=!0;for(let r=0;r<s.length;r++){const a=s[r],o=a.getColDef();if(o.pivotTotalColumnIds!=null){i=!1;continue}const n=o.pivotKeys??[];let l;e.leafGroup?l=this.getValuesFromMappedSet(e.childrenMapped,n,o.pivotValueColumn):l=this.getValuesPivotNonLeaf(e,o.colId),t[o.colId]=this.aggregateValues(l,o.pivotValueColumn.getAggFunc(),o.pivotValueColumn,e,a)}if(!i)for(let r=0;r<s.length;r++){const a=s[r],o=a.getColDef();if(o.pivotTotalColumnIds==null||!o.pivotTotalColumnIds.length)continue;const n=o.pivotTotalColumnIds.map(l=>t[l]);t[o.colId]=this.aggregateValues(n,o.pivotValueColumn.getAggFunc(),o.pivotValueColumn,e,a)}return t}aggregateRowNodeUsingValuesOnly(e,t){const s={},i=t.changedPath.isActive()?t.changedPath.getValueColumnsForNode(e,t.valueColumns):t.valueColumns,r=t.changedPath.isActive()?t.changedPath.getNotValueColumnsForNode(e,t.valueColumns):null,a=this.getValuesNormal(e,i,t.filteredOnly),o=e.aggData;return i.forEach((n,l)=>{s[n.getId()]=this.aggregateValues(a[l],n.getAggFunc(),n,e)}),r&&o&&r.forEach(n=>{s[n.getId()]=o[n.getId()]}),s}getValuesPivotNonLeaf(e,t){return e.childrenAfterFilter.map(s=>s.aggData[t])}getValuesFromMappedSet(e,t,s){let i=e;for(let r=0;r<t.length;r++){const a=t[r];i=i?i[a]:null}return i?i.map(r=>this.valueService.getValue(s,r)):[]}getValuesNormal(e,t,s){const i=[];t.forEach(()=>i.push([]));const r=t.length,a=s?e.childrenAfterFilter:e.childrenAfterGroup,o=a.length;for(let n=0;n<o;n++){const l=a[n];for(let c=0;c<r;c++){const h=t[c],d=this.valueService.getValue(h,l);i[c].push(d)}}return i}aggregateValues(e,t,s,i,r){const a=typeof t=="string"?this.aggFuncService.getAggFunc(t):t;if(typeof a!="function")return Lb(`unrecognised aggregation function ${t}`),null;const o=a,n=this.gos.addGridCommonParams({values:e,column:s,colDef:s?s.getColDef():void 0,pivotResultColumn:r,rowNode:i,data:i?i.data:void 0});return o(n)}},IP=class extends Nb{constructor(){super(...arguments),this.beanName="autoColService"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.columnFactory=e.columnFactory}createAutoCols(e){const t=[],s=this.gos.get("treeData");let i=_b(this.gos);return s&&i&&(Hb('you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data'),i=!1),i?e.forEach((r,a)=>{t.push(this.createOneAutoCol(r,a))}):t.push(this.createOneAutoCol()),t}updateAutoCols(e,t){e.forEach((s,i)=>this.updateOneAutoCol(s,i,t))}createOneAutoCol(e,t){let s;e?s=`${Bc}-${e.getId()}`:s=Bc;const i=this.createAutoColDef(s,e,t);i.colId=s;const r=new Bb(i,null,s,!0);return this.createBean(r),r}updateOneAutoCol(e,t,s){const i=e.getColDef(),r=typeof i.showRowGroup=="string"?i.showRowGroup:void 0,a=r!=null?this.columnModel.getColDefCol(r):void 0,o=this.createAutoColDef(e.getId(),a??void 0,t);e.setColDef(o,null,s),this.columnFactory.applyColumnState(e,o,s)}createAutoColDef(e,t,s){let i=this.createBaseColDef(t);const r=this.gos.get("autoGroupColumnDef");Ub(i,r),i=this.columnFactory.addColumnDefaultAndTypes(i,e),this.gos.get("treeData")||oa(i.field)&&oa(i.valueGetter)&&oa(i.filterValueGetter)&&i.filter!=="agGroupColumnFilter"&&(i.filter=!1),s&&s>0&&(i.headerCheckboxSelection=!1);const a=Vb(this.gos),o=i.valueGetter||i.field!=null;return a&&!o&&(i.sortIndex=void 0,i.initialSort=void 0),i}createBaseColDef(e){const t=this.gos.get("autoGroupColumnDef"),i={headerName:this.localeService.getLocaleTextFunc()("group","Group")};if(t&&(t.cellRenderer||t.cellRendererSelector)||(i.cellRenderer="agGroupCellRenderer"),e){const a=e.getColDef();Object.assign(i,{headerName:this.columnNameService.getDisplayNameForColumn(e,"header"),headerValueGetter:a.headerValueGetter}),a.cellRenderer&&Object.assign(i,{cellRendererParams:{innerRenderer:a.cellRenderer,innerRendererParams:a.cellRendererParams}}),i.showRowGroup=e.getColId()}else i.showRowGroup=!0;return i}},DP=class extends Es{constructor(e,t,s,i,r){super(t,s,r,`
332
+ ${kc("writeText")}`),this.copyDataToClipboardLegacy(t)});return}this.copyDataToClipboardLegacy(t)}copyDataToClipboardLegacy(t){this.executeOnTempElement(s=>{const i=Dc(this.gos),r=db(this.gos);s.value=t||" ",s.select(),s.focus({preventScroll:!0}),i.execCommand("copy")||di("Browser did not allow document.execCommand('copy'). Ensure api.copySelectedRowsToClipboard() is invoked via a user event, i.e. button click, otherwise the browser will prevent it for security reasons."),r!=null&&r.focus!=null&&r.focus({preventScroll:!0})})}executeOnTempElement(t,s){const i=Dc(this.gos),r=i.createElement("textarea");r.style.width="1px",r.style.height="1px",r.style.top=i.documentElement.scrollTop+"px",r.style.left=i.documentElement.scrollLeft+"px",r.style.position="absolute",r.style.opacity="0";const a=this.gridCtrl.getGui();a.appendChild(r);try{t(r)}catch{di("Browser does not support document.execCommand('copy') for clipboard operations")}s?window.setTimeout(()=>{s(r),a.removeChild(r)},100):a.removeChild(r)}getRangeSize(t){const s=t.getCellRanges();let i=0,r=0;return s.length>0&&(i=t.getRangeStartRow(s[0]).rowIndex,r=t.getRangeEndRow(s[0]).rowIndex),i-r+1}},ia="32.3.3",Gc=ea({version:ia,moduleName:`${Qr.ClipboardModule}-core`,beans:[wb],dependantModules:[H,nb]}),xb=ea({version:ia,moduleName:`${Qr.ClipboardModule}-api`,apiFunctions:{copyToClipboard:mb,cutToClipboard:fb,copySelectedRowsToClipboard:Cb,copySelectedRangeToClipboard:vb,copySelectedRangeDown:Sb,pasteFromClipboard:yb},dependantModules:[Gc]}),ra=ea({version:ia,moduleName:Qr.ClipboardModule,dependantModules:[Gc,xb]});import{ModuleNames as bb,_defineModule as Pb}from"ag-grid-community";import{ModuleNames as aa,_ColumnFilterModule as Tb,_FloatingFilterModule as Mb,_defineModule as Qt}from"ag-grid-community";import{BeanStub as Fb,_exists as Oc,_existsAndNotEmpty as Ab,_includes as Rb,_iterateObject as Eb,_last as Ib}from"ag-grid-community";import{BeanStub as Db,_errorOnce as Lb,_getGrandTotalRow as kb,_getGroupAggFiltering as Gb,_missingOrEmpty as Ob}from"ag-grid-community";import{AgColumn as Bb,BeanStub as Nb,GROUP_AUTO_COLUMN_ID as Bc,_isColumnsSortingCoupledToGroup as Vb,_isGroupMultiAutoColumn as _b,_mergeDeep as Ub,_missing as oa,_warnOnce as Hb}from"ag-grid-community";import{BeanStub as zb}from"ag-grid-community";import{Component as Wb,_setAriaRole as Kb}from"ag-grid-community";import{_createIconNoSpan as $b}from"ag-grid-community";import{DragSourceType as Nc}from"ag-grid-community";import{Component as jb,DragSourceType as Yb,KeyCode as ui,RefPlaceholder as qb,SortIndicatorSelector as Xb,_loadTemplate as Zb}from"ag-grid-community";import{_createIconNoSpan as Jb}from"ag-grid-community";import{BeanStub as Qb,_getGroupAggFiltering as eP}from"ag-grid-community";import{AgPromise as mt,AgSelect as tP,FilterWrapperComp as sP,RefPlaceholder as Vc,TabGuardComp as iP,_clearElement as na,_loadTemplate as rP,_setDisplayed as la,_warnOnce as es}from"ag-grid-community";import{AgInputTextField as aP,AgPromise as _c,Component as oP,RefPlaceholder as nP,_clearElement as lP}from"ag-grid-community";import{BeanStub as cP}from"ag-grid-community";import{BeanStub as hP,RowNode as Uc,_areEqual as ca,_exists as Hc,_existsAndNotEmpty as ha,_removeFromArray as dP,_warnOnce as uP}from"ag-grid-community";import{BeanStub as pP,_warnOnce as zc}from"ag-grid-community";import{RowNode as Wc}from"ag-grid-community";import{BeanStub as gP,_cloneObject as mP,_iterateObject as Kc}from"ag-grid-community";import{BeanStub as fP,_iterateObject as CP,_missing as vP}from"ag-grid-community";import{BeanStub as SP}from"ag-grid-community";import{_createIconNoSpan as yP}from"ag-grid-community";var wP={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},xP=class extends Fb{constructor(){super(...arguments),this.beanName="aggFuncService",this.aggFuncsMap={},this.initialised=!1}postConstruct(){this.init()}init(){this.initialised||(this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs")))}initialiseWithDefaultAggregations(){const e=this.aggFuncsMap;e.sum=bP,e.first=PP,e.last=TP,e.min=MP,e.max=FP,e.count=AP,e.avg=RP,this.initialised=!0}isAggFuncPossible(e,t){const s=this.getFuncNames(e),i=Rb(s,t),r=Oc(this.aggFuncsMap[t]);return i&&r}getDefaultFuncLabel(e){return wP[e]??e}getDefaultAggFunc(e){const t=e.getColDef().defaultAggFunc;if(Oc(t)&&this.isAggFuncPossible(e,t))return t;if(this.isAggFuncPossible(e,"sum"))return"sum";const s=this.getFuncNames(e);return Ab(s)?s[0]:null}addAggFuncs(e){this.init(),Eb(e,(t,s)=>{this.aggFuncsMap[t]=s})}getAggFunc(e){return this.init(),this.aggFuncsMap[e]}getFuncNames(e){const t=e.getColDef().allowedAggFuncs;return t??Object.keys(this.aggFuncsMap).sort()}clear(){this.aggFuncsMap={}}};function bP(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 PP(e){return e.values.length>0?e.values[0]:null}function TP(e){return e.values.length>0?Ib(e.values):null}function MP(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 FP(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 AP(e){const{values:t}=e;let s=0;for(let r=0;r<t.length;r++){const a=t[r];s+=a!=null&&typeof a.value=="number"?a.value:1}const i=e.rowNode?.aggData?.[e.column.getColId()];return i&&i.value===s?i:{value:s,toString:function(){return this.value.toString()},toNumber:function(){return this.value}}}function RP(e){const{values:t}=e;let s=0,i=0;for(let o=0;o<t.length;o++){const n=t[o];let l=null;typeof n=="number"||typeof n=="bigint"?(l=n,i++):n!=null&&(typeof n.value=="number"||typeof n.value=="bigint")&&typeof n.count=="number"&&(l=n.value*(typeof n.value=="number"?n.count:BigInt(n.count)),i+=n.count),typeof l=="number"?s+=typeof s=="number"?l:BigInt(l):typeof l=="bigint"&&(s=(typeof s=="bigint"?s:BigInt(s))+l)}let r=null;i>0&&(r=s/(typeof s=="number"?i:BigInt(i)));const a=e.rowNode?.aggData?.[e.column?.getColId()];return a&&a.count===i&&a.value===r?a:{count:i,value:r,toString:function(){return typeof this.value=="number"||typeof this.value=="bigint"?this.value.toString():""},toNumber:function(){return this.value}}}var EP=class extends Db{constructor(){super(...arguments),this.beanName="aggregationStage"}wireBeans(e){this.columnModel=e.columnModel,this.aggFuncService=e.aggFuncService,this.funcColsService=e.funcColsService,this.pivotResultColsService=e.pivotResultColsService,this.valueService=e.valueService}execute(e){const t=Ob(this.funcColsService.getValueColumns()),s=!this.gos.getCallback("getGroupRowAgg"),i=e.changedPath&&e.changedPath.isActive();if(t&&s&&i)return;const r=this.createAggDetails(e);this.recursivelyCreateAggData(r)}createAggDetails(e){const t=this.columnModel.isPivotActive(),s=this.funcColsService.getValueColumns(),i=t?this.funcColsService.getPivotColumns():[];return{alwaysAggregateAtRootLevel:this.gos.get("alwaysAggregateAtRootLevel"),groupIncludeTotalFooter:!!kb(this.gos),changedPath:e.changedPath,valueColumns:s,pivotColumns:i,filteredOnly:!this.isSuppressAggFilteredOnly(),userAggFunc:this.gos.getCallback("getGroupRowAgg")}}isSuppressAggFilteredOnly(){return Gb(this.gos)!==void 0||this.gos.get("suppressAggFilteredOnly")}recursivelyCreateAggData(e){const t=s=>{if(!s.hasChildren()){s.aggData&&s.setAggData(null);return}if(s.level===-1&&!e.groupIncludeTotalFooter){const a=!this.columnModel.isPivotMode();if(!e.alwaysAggregateAtRootLevel&&a){s.setAggData(null);return}}this.aggregateRowNode(s,e)};e.changedPath.forEachChangedNodeDepthFirst(t,!0)}aggregateRowNode(e,t){const s=t.valueColumns.length===0,i=t.pivotColumns.length===0;let r;t.userAggFunc?r=t.userAggFunc({nodes:e.childrenAfterFilter}):s?r=null:i?r=this.aggregateRowNodeUsingValuesOnly(e,t):r=this.aggregateRowNodeUsingValuesAndPivot(e),e.setAggData(r),e.sibling&&e.sibling.setAggData(r)}aggregateRowNodeUsingValuesAndPivot(e){const t={},s=this.pivotResultColsService.getPivotResultCols()?.list??[];let i=!0;for(let r=0;r<s.length;r++){const a=s[r],o=a.getColDef();if(o.pivotTotalColumnIds!=null){i=!1;continue}const n=o.pivotKeys??[];let l;e.leafGroup?l=this.getValuesFromMappedSet(e.childrenMapped,n,o.pivotValueColumn):l=this.getValuesPivotNonLeaf(e,o.colId),t[o.colId]=this.aggregateValues(l,o.pivotValueColumn.getAggFunc(),o.pivotValueColumn,e,a)}if(!i)for(let r=0;r<s.length;r++){const a=s[r],o=a.getColDef();if(o.pivotTotalColumnIds==null||!o.pivotTotalColumnIds.length)continue;const n=o.pivotTotalColumnIds.map(l=>t[l]);t[o.colId]=this.aggregateValues(n,o.pivotValueColumn.getAggFunc(),o.pivotValueColumn,e,a)}return t}aggregateRowNodeUsingValuesOnly(e,t){const s={},i=t.changedPath.isActive()?t.changedPath.getValueColumnsForNode(e,t.valueColumns):t.valueColumns,r=t.changedPath.isActive()?t.changedPath.getNotValueColumnsForNode(e,t.valueColumns):null,a=this.getValuesNormal(e,i,t.filteredOnly),o=e.aggData;return i.forEach((n,l)=>{s[n.getId()]=this.aggregateValues(a[l],n.getAggFunc(),n,e)}),r&&o&&r.forEach(n=>{s[n.getId()]=o[n.getId()]}),s}getValuesPivotNonLeaf(e,t){return e.childrenAfterFilter.map(s=>s.aggData[t])}getValuesFromMappedSet(e,t,s){let i=e;for(let r=0;r<t.length;r++){const a=t[r];i=i?i[a]:null}return i?i.map(r=>this.valueService.getValue(s,r)):[]}getValuesNormal(e,t,s){const i=[];t.forEach(()=>i.push([]));const r=t.length,a=s?e.childrenAfterFilter:e.childrenAfterGroup,o=a.length;for(let n=0;n<o;n++){const l=a[n];for(let c=0;c<r;c++){const h=t[c],d=this.valueService.getValue(h,l);i[c].push(d)}}return i}aggregateValues(e,t,s,i,r){const a=typeof t=="string"?this.aggFuncService.getAggFunc(t):t;if(typeof a!="function")return Lb(`unrecognised aggregation function ${t}`),null;const o=a,n=this.gos.addGridCommonParams({values:e,column:s,colDef:s?s.getColDef():void 0,pivotResultColumn:r,rowNode:i,data:i?i.data:void 0});return o(n)}},IP=class extends Nb{constructor(){super(...arguments),this.beanName="autoColService"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.columnFactory=e.columnFactory}createAutoCols(e){const t=[],s=this.gos.get("treeData");let i=_b(this.gos);return s&&i&&(Hb('you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data'),i=!1),i?e.forEach((r,a)=>{t.push(this.createOneAutoCol(r,a))}):t.push(this.createOneAutoCol()),t}updateAutoCols(e,t){e.forEach((s,i)=>this.updateOneAutoCol(s,i,t))}createOneAutoCol(e,t){let s;e?s=`${Bc}-${e.getId()}`:s=Bc;const i=this.createAutoColDef(s,e,t);i.colId=s;const r=new Bb(i,null,s,!0);return this.createBean(r),r}updateOneAutoCol(e,t,s){const i=e.getColDef(),r=typeof i.showRowGroup=="string"?i.showRowGroup:void 0,a=r!=null?this.columnModel.getColDefCol(r):void 0,o=this.createAutoColDef(e.getId(),a??void 0,t);e.setColDef(o,null,s),this.columnFactory.applyColumnState(e,o,s)}createAutoColDef(e,t,s){let i=this.createBaseColDef(t);const r=this.gos.get("autoGroupColumnDef");Ub(i,r),i=this.columnFactory.addColumnDefaultAndTypes(i,e),this.gos.get("treeData")||oa(i.field)&&oa(i.valueGetter)&&oa(i.filterValueGetter)&&i.filter!=="agGroupColumnFilter"&&(i.filter=!1),s&&s>0&&(i.headerCheckboxSelection=!1);const a=Vb(this.gos),o=i.valueGetter||i.field!=null;return a&&!o&&(i.sortIndex=void 0,i.initialSort=void 0),i}createBaseColDef(e){const t=this.gos.get("autoGroupColumnDef"),i={headerName:this.localeService.getLocaleTextFunc()("group","Group")};if(t&&(t.cellRenderer||t.cellRendererSelector)||(i.cellRenderer="agGroupCellRenderer"),e){const a=e.getColDef();Object.assign(i,{headerName:this.columnNameService.getDisplayNameForColumn(e,"header"),headerValueGetter:a.headerValueGetter}),a.cellRenderer&&Object.assign(i,{cellRendererParams:{innerRenderer:a.cellRenderer,innerRendererParams:a.cellRendererParams}}),i.showRowGroup=e.getColId()}else i.showRowGroup=!0;return i}},DP=class extends Es{constructor(e,t,s,i,r){super(t,s,r,`
333
333
  <span role="option">
334
334
  <span data-ref="eDragHandle" class="ag-drag-handle ag-column-drop-cell-drag-handle" role="presentation"></span>
335
335
  <span data-ref="eText" class="ag-column-drop-cell-text" aria-hidden="true"></span>
@@ -343,14 +343,14 @@ ${kc("writeText")}`),this.copyDataToClipboardLegacy(t)});return}this.copyDataToC
343
343
  </div>
344
344
  `),this.eGroupField=Vc,this.eUnderlyingFilter=Vc}wireBeans(e){this.filterManager=e.filterManager,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService}postConstruct(){this.initialiseTabGuard({})}init(e){return this.updateParams(e).then(()=>{this.addManagedEventListeners({columnRowGroupChanged:()=>this.onColumnRowGroupChanged(),filterDestroyed:t=>this.onFilterDestroyed(t)})})}refresh(e){return this.updateParams(e),!0}updateParams(e){return this.params=e,this.validateParams(),this.updateGroups()}validateParams(){const{colDef:e}=this.params;e.field&&es('Group Column Filter does not work with the colDef property "field". This property will be ignored.'),e.filterValueGetter&&es('Group Column Filter does not work with the colDef property "filterValueGetter". This property will be ignored.'),e.filterParams&&es('Group Column Filter does not work with the colDef property "filterParams". This property will be ignored.')}updateGroups(){const e=this.updateGroupField();return this.getUnderlyingFilters(e)}getSourceColumns(){if(this.groupColumn=this.params.column,this.gos.get("treeData"))return es("Group Column Filter does not work with Tree Data enabled. Please disable Tree Data, or use a different filter."),[];const e=this.funcColsService.getSourceColumnsForGroupColumn(this.groupColumn);return e||(es("Group Column Filter only works on group columns. Please use a different filter."),[])}updateGroupField(){na(this.eGroupField),this.eGroupFieldSelect&&this.destroyBean(this.eGroupFieldSelect);const e=this.getSourceColumns(),t=e.filter(s=>s.isFilterAllowed());return t.length?(e.length===1?(this.selectedColumn=t[0],la(this.eGroupField,!1)):((!this.selectedColumn||!t.some(s=>s.getId()===this.selectedColumn.getId()))&&(this.selectedColumn=t[0]),this.createGroupFieldSelectElement(t),this.eGroupField.appendChild(this.eGroupFieldSelect.getGui()),this.eGroupField.appendChild(rP('<div class="ag-filter-separator"></div>')),la(this.eGroupField,!0)),t):(this.selectedColumn=void 0,la(this.eGroupField,!1),null)}createGroupFieldSelectElement(e){this.eGroupFieldSelect=this.createManagedBean(new tP);const t=this.localeService.getLocaleTextFunc();this.eGroupFieldSelect.setLabel(t("groupFilterSelect","Select field:")),this.eGroupFieldSelect.setLabelAlignment("top"),this.eGroupFieldSelect.addOptions(e.map(s=>({value:s.getId(),text:this.columnNameService.getDisplayNameForColumn(s,"groupFilter",!1)??void 0}))),this.eGroupFieldSelect.setValue(this.selectedColumn.getId()),this.eGroupFieldSelect.onValueChange(s=>this.updateSelectedColumn(s)),this.eGroupFieldSelect.addCssClass("ag-group-filter-field-select-wrapper"),e.length===1&&this.eGroupFieldSelect.setDisabled(!0)}getUnderlyingFilters(e){if(!e)return this.filterColumnPairs=void 0,this.selectedFilter=void 0,this.groupColumn.setFilterActive(!1,"columnRowGroupChanged"),mt.resolve();const t=[],s=[];return e.forEach(i=>{const r=this.filterManager.getOrCreateFilterWrapper(i);r?.filterPromise&&t.push(r.filterPromise.then(a=>(a&&s.push({filter:a,column:i}),i.getId()===this.selectedColumn.getId()&&(this.selectedFilter=a??void 0),a)))}),mt.all(t).then(()=>{this.filterColumnPairs=s,this.groupColumn.setFilterActive(this.isFilterActive(),"columnRowGroupChanged")})}addUnderlyingFilterElement(){if(na(this.eUnderlyingFilter),!this.selectedColumn)return mt.resolve();const e=this.createManagedBean(new sP(this.selectedColumn,"COLUMN_MENU"));return this.filterWrapperComp=e,e.hasFilter()?(this.eUnderlyingFilter.appendChild(e.getGui()),e.getFilter()?.then(()=>{e.afterGuiAttached?.(this.afterGuiAttachedParams),!this.afterGuiAttachedParams?.suppressFocus&&this.eGroupFieldSelect&&!this.eGroupFieldSelect.isDisabled()&&this.eGroupFieldSelect.getFocusableElement().focus()})??mt.resolve()):mt.resolve()}updateSelectedColumn(e){if(!e)return;this.filterWrapperComp?.afterGuiDetached(),this.destroyBean(this.filterWrapperComp);const t=this.getFilterColumnPair(e);this.selectedColumn=t?.column,this.selectedFilter=t?.filter,this.dispatchLocalEvent({type:"selectedColumnChanged"}),this.addUnderlyingFilterElement()}isFilterActive(){return!!this.filterColumnPairs?.some(({filter:e})=>e.isFilterActive())}doesFilterPass(){return!0}getModel(){return null}setModel(){return mt.resolve()}afterGuiAttached(e){this.afterGuiAttachedParams=e,this.addUnderlyingFilterElement()}afterGuiDetached(){na(this.eUnderlyingFilter),this.selectedFilter?.afterGuiDetached?.()}onColumnRowGroupChanged(){this.updateGroups().then(()=>{this.dispatchLocalEvent({type:"columnRowGroupChanged"})})}onFilterDestroyed({column:e,source:t}){if(t==="gridDestroyed")return;const s=e.getColId();this.filterColumnPairs?.some(({column:i})=>i.getColId()===s)&&setTimeout(()=>{this.isAlive()&&this.updateGroups()})}getFilterColumnPair(e){if(e)return this.filterColumnPairs?.find(({column:t})=>t.getId()===e)}getSelectedFilter(){return this.selectedFilter}getSelectedColumn(){return this.selectedColumn}isFilterAllowed(){return!!this.selectedColumn}destroy(){super.destroy()}},VP=class extends oP{constructor(){super(`
345
345
  <div data-ref="eFloatingFilter" class="ag-group-floating-filter ag-floating-filter-input" role="presentation"></div>
346
- `),this.eFloatingFilter=nP,this.haveAddedColumnListeners=!1}wireBeans(e){this.columnNameService=e.columnNameService,this.filterManager=e.filterManager}init(e){this.params=e;const t=this.gos.get("groupDisplayType")==="multipleColumns";return new _c(s=>{this.params.parentFilterInstance(i=>{this.parentFilterInstance=i,t?this.setupUnderlyingFloatingFilterElement().then(()=>s()):(this.setupReadOnlyFloatingFilterElement(),s())})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{selectedColumnChanged:this.onSelectedColumnChanged.bind(this),columnRowGroupChanged:this.onColumnRowGroupChanged.bind(this)})})}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e,this.setParams()}setParams(){const e=this.columnNameService.getDisplayNameForColumn(this.params.column,"header",!0),t=this.localeService.getLocaleTextFunc();this.eFloatingFilterText?.setInputAriaLabel(`${e} ${t("ariaFilterInput","Filter Input")}`)}setupReadOnlyFloatingFilterElement(){this.eFloatingFilterText||(this.eFloatingFilterText=this.createManagedBean(new aP),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,lP(this.eFloatingFilter);const e=this.parentFilterInstance.getSelectedColumn();if(e&&!e.isVisible()){const t=this.filterManager.getFloatingFilterCompDetails(e,this.params.showParentFilter);if(t)return this.haveAddedColumnListeners||(this.haveAddedColumnListeners=!0,this.addManagedListeners(e,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)})),t.newAgStackInstance().then(s=>{this.underlyingFloatingFilter=s,this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel()),this.appendChild(s.getGui()),this.showingUnderlyingFloatingFilter=!0})}return this.setupReadOnlyFloatingFilterElement(),_c.resolve()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(e){if(!e.column)return;const t=this.filterManager.getFloatingFilterCompDetails(e.column,this.params.showParentFilter);t&&(this.underlyingFloatingFilter?.refresh?this.underlyingFloatingFilter.refresh(t.params):this.underlyingFloatingFilter?.onParamsUpdated?.(t.params))}onParentModelChanged(e,t){this.showingUnderlyingFloatingFilter?this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel(),t):this.updateDisplayedValue()}updateDisplayedValue(){if(!this.parentFilterInstance||!this.eFloatingFilterText)return;const e=this.parentFilterInstance.getSelectedFilter();if(!e){this.eFloatingFilterText.setValue(""),this.eFloatingFilterText.setDisplayed(!1);return}if(this.eFloatingFilterText.setDisplayed(!0),e.getModelAsString){const t=e.getModel();this.eFloatingFilterText.setValue(t==null?"":e.getModelAsString(t))}else this.eFloatingFilterText.setValue("")}onSelectedColumnChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}onColumnRowGroupChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}destroy(){super.destroy()}},ua=class{constructor(){this.allSets={},this.allParents=[]}removeFromChildrenAfterGroup(e,t){const s=this.getSet(e);s.removeFromChildrenAfterGroup[t.id]=!0}isRemoveFromAllLeafChildren(e,t){return!!this.getSet(e).removeFromAllLeafChildren[t.id]}preventRemoveFromAllLeafChildren(e,t){const s=this.getSet(e);delete s.removeFromAllLeafChildren[t.id]}removeFromAllLeafChildren(e,t){const s=this.getSet(e);s.removeFromAllLeafChildren[t.id]=!0}getSet(e){return this.allSets[e.id]||(this.allSets[e.id]={removeFromAllLeafChildren:{},removeFromChildrenAfterGroup:{}},this.allParents.push(e)),this.allSets[e.id]}getAllParents(){return this.allParents}flush(){this.allParents.forEach(e=>{const t=this.allSets[e.id];e.childrenAfterGroup=e.childrenAfterGroup.filter(i=>!t.removeFromChildrenAfterGroup[i.id]),e.allLeafChildren=e.allLeafChildren?.filter(i=>!t.removeFromAllLeafChildren[i.id])??null,e.updateHasChildren();const s=e.sibling;s&&(s.childrenAfterGroup=e.childrenAfterGroup,s.allLeafChildren=e.allLeafChildren)}),this.allSets={},this.allParents.length=0}};function _P(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($c(e[i-1],e[i])>0){s=!0;break}return s?(e.sort($c),!0):!1}function $c(e,t){const s=e.sourceRowIndex,i=t.sourceRowIndex,r=s>=0,a=i>=0,o=r&&a,n=!r&&!a;return o?s-i:n?e.__objectId-t.__objectId:r?1:-1}var UP=class extends hP{wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.selectionService=e.selectionService,this.showRowGroupColsService=e.showRowGroupColsService}execute(e){const t=this.createGroupingDetails(e);if(t.transactions)this.handleTransaction(t);else{const s=e.afterColumnsChanged===!0;this.shotgunResetEverything(t,s)}this.positionLeafsAndGroups(e.changedPath),this.orderGroups(t)}positionLeafsAndGroups(e){e.forEachChangedNodeDepthFirst(t=>{if(t.childrenAfterGroup){const s=[],i=[];let r;t.childrenAfterGroup.forEach(a=>{a.childrenAfterGroup?.length?a.key===""&&!r?r=a:i.push(a):s.push(a)}),r&&i.push(r),t.childrenAfterGroup=[...s,...i]}},!1)}createGroupingDetails(e){const{rowNode:t,changedPath:s,rowNodeTransactions:i,rowNodesOrderChanged:r}=e,a=this.funcColsService.getRowGroupColumns();return{expandByDefault:this.gos.get("groupDefaultExpanded"),groupedCols:a,rootNode:t,pivotMode:this.columnModel.isPivotMode(),groupedColCount:a?.length??0,transactions:i,rowNodesOrderChanged:!!r,changedPath:s,groupAllowUnbalanced:this.gos.get("groupAllowUnbalanced"),isGroupOpenByDefault:this.gos.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:this.gos.getCallback("initialGroupOrderComparator"),suppressGroupMaintainValueType:this.gos.get("suppressGroupMaintainValueType"),keyCreators:a?.map(n=>n.getColDef().keyCreator)??[]}}handleTransaction(e){e.transactions.forEach(t=>{const s=new ua;ha(t.remove)&&this.removeNodes(t.remove,e,s),ha(t.update)&&this.moveNodesInWrongPath(t.update,e,s),ha(t.add)&&this.insertNodes(t.add,e);const i=s.getAllParents().slice();s.flush(),this.removeEmptyGroups(i,e)}),e.rowNodesOrderChanged&&this.sortChildren(e)}sortChildren(e){e.changedPath.forEachChangedNodeDepthFirst(t=>{_P(t.childrenAfterGroup)&&e.changedPath.addParentNode(t)},!1,!0)}orderGroups(e){const t=e.initialGroupOrderComparator;Hc(t)&&s(e.rootNode);function s(i){Hc(i.childrenAfterGroup)&&!i.leafGroup&&(i.childrenAfterGroup.sort((a,o)=>t({nodeA:a,nodeB:o})),i.childrenAfterGroup.forEach(a=>s(a)))}}getExistingPathForNode(e,t){const s=[];let i=e.parent;for(;i&&i!==t.rootNode;)s.push({key:i.key,rowGroupColumn:i.rowGroupColumn,field:i.field}),i=i.parent;return s.reverse(),s}moveNodesInWrongPath(e,t,s){e.forEach(i=>{t.changedPath.isActive()&&t.changedPath.addParentNode(i.parent);const r=l=>l.key,a=this.getExistingPathForNode(i,t).map(r),o=this.getGroupInfo(i,t).map(r);ca(a,o)||this.moveNode(i,t,s)})}moveNode(e,t,s){if(this.removeNodesFromParents([e],t,s),this.insertOneNode(e,t,s),e.setData(e.data),t.changedPath.isActive()){const i=e.parent;t.changedPath.addParentNode(i)}}removeNodes(e,t,s){this.removeNodesFromParents(e,t,s),t.changedPath.isActive()&&e.forEach(i=>t.changedPath.addParentNode(i.parent))}forEachParentGroup(e,t,s){let i=t;for(;i&&i!==e.rootNode;)s(i),i=i.parent}removeNodesFromParents(e,t,s){const i=s==null,r=s||new ua;e.forEach(a=>{this.removeFromParent(a,r),this.forEachParentGroup(t,a.parent,o=>{r.removeFromAllLeafChildren(o,a)})}),i&&r.flush()}removeEmptyGroups(e,t){let s=!0;const i=r=>{const a=this.getChildrenMappedKey(r.key,r.rowGroupColumn),o=r.parent;return(o?.childrenMapped?!o.childrenMapped[a]:!0)?!1:!!r.group&&(r.childrenAfterGroup?.length??0)===0};for(;s;){s=!1;const r=new ua;e.forEach(a=>{this.forEachParentGroup(t,a,o=>{i(o)&&(s=!0,this.removeFromParent(o,r),o.setSelectedParams({newValue:!1,source:"rowGroupChanged"}))})}),r.flush()}}removeFromParent(e,t){e.parent&&(t?t.removeFromChildrenAfterGroup(e.parent,e):(dP(e.parent.childrenAfterGroup,e),e.parent.updateHasChildren()));const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn);e.parent?.childrenMapped&&delete e.parent.childrenMapped[s],e.setRowTop(null),e.setRowIndex(null)}addToParent(e,t){const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn);t?.childrenMapped&&t.childrenMapped[s]!==e&&(t.childrenMapped[s]=e,t.childrenAfterGroup.push(e),t.setGroup(!0))}areGroupColsEqual(e,t){return e==null||t==null||e.pivotMode!==t.pivotMode?!1:ca(e.groupedCols,t.groupedCols)&&ca(e.keyCreators,t.keyCreators)}checkAllGroupDataAfterColsChanged(e){const t=s=>{s&&s.forEach(i=>{if(!i.group)return;const a={field:i.field,key:i.key,rowGroupColumn:i.rowGroupColumn,leafNode:i.allLeafChildren?.[0]};this.setGroupData(i,a,e),t(i.childrenAfterGroup)})};t(e.rootNode.childrenAfterGroup)}shotgunResetEverything(e,t){if(this.noChangeInGroupingColumns(e,t))return;this.selectionService.filterFromSelection(a=>a&&!a.group);const{groupedCols:s}=e,i=e.rootNode;i.leafGroup=s.length===0,i.childrenAfterGroup=[],i.childrenMapped={},i.updateHasChildren();const r=i.sibling;r&&(r.childrenAfterGroup=i.childrenAfterGroup,r.childrenMapped=i.childrenMapped),this.insertNodes(i.allLeafChildren,e)}noChangeInGroupingColumns(e,t){let s=!1;const i=this.showRowGroupColsService.getShowRowGroupCols(),r=i?i.map(a=>a.getId()).join("-"):"";return t&&(s=this.areGroupColsEqual(e,this.oldGroupingDetails),this.oldGroupDisplayColIds!==r&&this.checkAllGroupDataAfterColsChanged(e)),this.oldGroupingDetails=e,this.oldGroupDisplayColIds=r,s}insertNodes(e,t){e.forEach(s=>{this.insertOneNode(s,t),t.changedPath.isActive()&&t.changedPath.addParentNode(s.parent)})}insertOneNode(e,t,s){const i=this.getGroupInfo(e,t),r=this.findParentForNode(e,i,t,s);r.group||uP("duplicate group keys for row data, keys should be unique",[r.data,e.data]),e.parent=r,e.level=i.length,r.childrenAfterGroup.push(e),r.updateHasChildren()}findParentForNode(e,t,s,i){let r=s.rootNode;return t.forEach((a,o)=>{r=this.getOrCreateNextNode(r,a,o,s),i?.isRemoveFromAllLeafChildren(r,e)?i?.preventRemoveFromAllLeafChildren(r,e):r.allLeafChildren.push(e)}),r}getOrCreateNextNode(e,t,s,i){const r=this.getChildrenMappedKey(t.key,t.rowGroupColumn);let a=e?.childrenMapped?.[r];return a||(a=this.createGroup(t,e,s,i),this.addToParent(a,e)),a}createGroup(e,t,s,i){const r=new Uc(this.beans);return r.group=!0,r.field=e.field,r.rowGroupColumn=e.rowGroupColumn,this.setGroupData(r,e,i),r.key=e.key,r.id=this.createGroupId(r,t,s),r.level=s,r.leafGroup=s===i.groupedColCount-1,r.allLeafChildren=[],r.setAllChildrenCount(0),r.rowGroupIndex=s,r.childrenAfterGroup=[],r.childrenMapped={},r.updateHasChildren(),r.parent=t,this.setExpandedInitialValue(i,r),r}createGroupId(e,t,s){const i=(r,a)=>{if(!r.rowGroupColumn)return null;const o=a?i(a,a.parent,0):null;return`${o==null?"":o+"-"}${r.rowGroupColumn.getColId()}-${r.key}`};return Uc.ID_PREFIX_ROW_GROUP+i(e,t,s)}setGroupData(e,t,s){e.groupData={},this.showRowGroupColsService.getShowRowGroupCols().forEach(r=>{const a=e.rowGroupColumn;a!==null&&r.isRowGroupDisplayed(a.getId())&&(s.suppressGroupMaintainValueType?e.groupData[r.getColId()]=t.key:e.groupData[r.getColId()]=this.valueService.getValue(a,t.leafNode))})}getChildrenMappedKey(e,t){return t?t.getId()+"-"+e:e}setExpandedInitialValue(e,t){if(e.pivotMode&&t.leafGroup){t.expanded=!1;return}const s=e.isGroupOpenByDefault;if(s){const i={rowNode:t,field:t.field,key:t.key,level:t.level,rowGroupColumn:t.rowGroupColumn};t.expanded=s(i)==!0;return}if(e.expandByDefault===-1){t.expanded=!0;return}t.expanded=t.level<e.expandByDefault}getGroupInfo(e,t){const s=[];return t.groupedCols.forEach(i=>{let r=this.valueService.getKeyForNode(i,e),a=r!=null&&r!=="";if((t.pivotMode||!t.groupAllowUnbalanced)&&!a&&(r="",a=!0),a){const n={key:r,field:i.getColDef().field,rowGroupColumn:i,leafNode:e};s.push(n)}}),s}},HP=(e,t)=>e.treeNode.oldSourceRowIndex-t.treeNode.oldSourceRowIndex,K=Object.freeze([]),zP=K.values(),pi=(e,t)=>{e.parent=null,e.treeNode=null,t?e.childrenAfterGroup=[]:(e.level=0,e.childrenAfterGroup=null,e.allLeafChildren=null)},WP=class yu{constructor(t,s,i){this.parent=t,this.key=s,this.level=i,this.children=null,this.invalidatedHead=null,this.invalidatedNext=void 0,this.row=null,this.oldRow=null,this.duplicateRows=null,this.childrenAfterGroup=K,this.allLeafChildren=K,this.childrenChanged=!1,this.leafChildrenChanged=!1,this.oldSourceRowIndex=-1}isEmptyFillerNode(){return!this.row?.data&&!this.children?.size}hasChildren(){return!!this.children?.size}enumChildren(){return this.children?.values()??zP}upsertKey(t){typeof t!="string"&&(t=String(t));let s=this.children?.get(t);return s||(s=new yu(this,t,this.level+1),(this.children??(this.children=new Map))?.set(s.key,s)),s}destroy(){const{row:t,parent:s}=this;s!==null&&(s?.children?.delete(this.key),t!==null&&pi(t,!0),this.parent=null)}setRow(t){const{level:s,row:i,childrenAfterGroup:r}=this;if(s<0)i!==null&&i!==t&&pi(i,!0);else{if(i===t)return!1;i!==null?(t.allLeafChildren=i.allLeafChildren??this.allLeafChildren??K,pi(i,!1)):t.allLeafChildren=this.allLeafChildren??K}return t.level=s,t.childrenAfterGroup=r,t.treeNode=this,this.row=t,!0}removeRow(t){const{level:s,row:i,duplicateRows:r,childrenAfterGroup:a}=this;if(i===t){const o=this.popDuplicateRow();o?(this.row=o,o.childrenAfterGroup=a,s>=0&&(o.allLeafChildren=i.allLeafChildren??this.allLeafChildren??K)):this.row=null}else{if(!r?.delete(t))return!1;r.size===0&&(this.duplicateRows=null)}return pi(t,s<0),!0}addDuplicateRow(t){const{level:s}=this;let i=this.duplicateRows;if(i===null)i=new Set,this.duplicateRows=i;else if(i.has(t))return!1;return i.add(t),t.treeNode=this,t.level=s,s>=0&&(t.allLeafChildren=K),t.childrenAfterGroup=K,!0}sortFirstDuplicateRow(){const t=this.duplicateRows,s=this.row;if(!s||!t)return s;let i=s;for(const r of t)r.sourceRowIndex<i.sourceRowIndex&&(i=r);return i!==s&&(i.childrenAfterGroup=this.childrenAfterGroup,i.allLeafChildren=s.allLeafChildren??this.allLeafChildren??K,s.childrenAfterGroup=K,s.allLeafChildren=K,t.delete(i),t.add(s),this.row=i),i}popDuplicateRow(){let t=null;const s=this.duplicateRows;return s!==null&&(t=s.values().next().value,t!==null&&s.delete(t)&&s.size===0&&(this.duplicateRows=null)),t}dequeueInvalidated(){const t=this.invalidatedHead;return t!==null&&(this.invalidatedHead=t.invalidatedNext??null,t.invalidatedNext=void 0),t}invalidate(){let t=this,s=this.parent;for(;s!==null&&t.invalidatedNext===void 0;)t.invalidatedNext=s.invalidatedHead,s.invalidatedHead=t,t=s,s=t.parent}invalidateOrder(){const t=this.parent;t!==null&&!t.childrenChanged&&((this.children?.size??0)>1||!t.row?.data)&&(t.childrenChanged=!0,t.invalidate())}getRowPosition(){const t=this.row;return t?.data?t.sourceRowIndex:this.childrenAfterGroup[0]?.treeNode?.oldSourceRowIndex??this.oldSourceRowIndex}updateChildrenAfterGroup(){this.childrenChanged=!1;const t=this.children?.size??0;if(t===0)return this.childrenAfterGroup.length===0?!1:(this.leafChildrenChanged=!0,this.childrenAfterGroup=K,this.row.childrenAfterGroup=K,!0);let s=!1,i=this.childrenAfterGroup;i===K?(i=new Array(t),this.childrenAfterGroup=i,this.row.childrenAfterGroup=i,s=!0):i.length!==t&&(i.length=t,s=!0);let r=0,a=-1,o=!1;for(const n of this.enumChildren()){const l=n.getRowPosition();l<a&&(o=!0),a=l,n.oldSourceRowIndex=l;const c=n.row;i[r]!==c&&(i[r]=c,s=!0),++r}return s&&(this.leafChildrenChanged=!0),o&&this.reorderChildrenList(i),s||o}reorderChildrenList(t){const s=t.length,i=this.children;t.sort(HP),i.clear();for(let r=0;r<s;++r){const a=t[r].treeNode;i.set(a.key,a)}}updateAllLeafChildren(){const{parent:t,row:s,childrenAfterGroup:i}=this;this.leafChildrenChanged=!1;let r=!1;const a=i.length;if(a===0)r=s.allLeafChildren?.length!==0,s.allLeafChildren=K,this.allLeafChildren=K;else if(a===1&&i[0].allLeafChildren?.length)s.allLeafChildren=i[0].allLeafChildren,this.allLeafChildren=null,r=!0;else{let o=this.allLeafChildren;(o===K||o===null)&&(o=[],this.allLeafChildren=o);const n=o.length;let l=0;for(let c=0;c<a;++c){const h=i[c],d=h.allLeafChildren,u=d.length;if(u)for(let p=0;p<u;++p){const g=d[p];(l>=n||o[l]!==g)&&(o[l]=g,r=!0),++l}else(l>=n||o[l]!==h)&&h&&(o[l]=h,r=!0),++l}n!==l&&(o.length=l,r=!0),s.allLeafChildren!==o&&(s.allLeafChildren=o,r=!0)}r&&t&&(t.leafChildrenChanged=!0)}},jc=e=>(e.treeNodeFlags&1)!==0,Yc=e=>(e.treeNodeFlags&2)!==0,qc=e=>(e.treeNodeFlags&4)!==0,KP=e=>(e.treeNodeFlags&8)!==0,Xc=e=>(e.treeNodeFlags&16)!==0,Zc=(e,t)=>{t?e.treeNodeFlags|=2:e.treeNodeFlags&=-3},$P=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|4)},jP=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|12)},Ue=e=>{e.treeNodeFlags|=16},Jc=e=>{e.treeNodeFlags=1|e.treeNodeFlags&-29},is=e=>{e.treeNodeFlags=0},YP=class extends pP{constructor(){super(...arguments),this.rowsPendingDestruction=null,this.root=new WP(null,"",-1)}wireBeans(e){this.beans=e,this.showRowGroupColsService=e.showRowGroupColsService}destroy(){const e=this.root.row;e!==null&&(this.root.removeRow(e),is(e)),this.destroyTree(this.root),this.commitDestroyedRows(),super.destroy()}execute(e){const{rowNodeTransactions:t,rowNodesOrderChanged:s,changedPath:i}=e,r=e.rowNode,a=this.gos,o={changedPath:i,expandByDefault:a.get("groupDefaultExpanded"),suppressGroupMaintainValueType:a.get("suppressGroupMaintainValueType"),getDataPath:a.get("getDataPath"),isGroupOpenByDefault:a.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:a.getCallback("initialGroupOrderComparator")};this.root.setRow(r),r.leafGroup=!1;const l=r.sibling;l&&(l.childrenAfterGroup=r.childrenAfterGroup,l.childrenMapped=r.childrenMapped),t?this.handleTransaction(o,t,s):this.handleRowData(o,r,e.afterColumnsChanged===!0)}handleRowData(e,t,s){const i=this.root;if(s||this.oldGroupDisplayColIds===void 0){const r=this.showRowGroupColsService?.getShowRowGroupCols()?.map(a=>a.getId()).join("-")??"";if(s){this.oldGroupDisplayColIds!==r&&this.checkAllGroupDataAfterColsChanged(i.row?.childrenAfterGroup);return}this.oldGroupDisplayColIds=r}this.clearTree(i),this.addOrUpdateRows(e,t.allLeafChildren,!1),this.commitTree(e)}handleTransaction(e,t,s){for(const{remove:i,update:r,add:a}of t)this.removeRows(i),this.addOrUpdateRows(e,r,!0),this.addOrUpdateRows(e,a,!1);s&&this.handleRowNodesOrderChanged(),this.commitTree(e)}handleRowNodesOrderChanged(){const e=this.root.row?.allLeafChildren;if(e)for(let t=0,s=e.length;t<s;++t){const i=e[t].treeNode;i&&i.oldSourceRowIndex!==t&&i.invalidateOrder()}}checkAllGroupDataAfterColsChanged(e){for(let t=0,s=e?.length??0;t<s;++t){const i=e[t];this.setGroupData(i,i.treeNode?.key??i.key),this.checkAllGroupDataAfterColsChanged(i.childrenAfterGroup)}}addOrUpdateRows(e,t,s){for(let i=0,r=t?.length??0;i<r;++i){const a=t[i],o=this.upsertPath(this.getDataPath(e,a));o&&this.addOrUpdateRow(o,a,s)}}removeRows(e){for(let t=0,s=e?.length??0;t<s;++t){const i=e[t],r=i.treeNode;r!==null&&this.removeRow(r,i)}}getDataPath({getDataPath:e},{data:t}){const s=e?.(t)||K;return s.length||zc("getDataPath() should not return an empty path",[t]),s}upsertPath(e){let t=this.root;const s=e.length-1;for(let i=0;i<=s;++i){const r=t.upsertKey(e[i]);if(i>=s)return r.invalidate(),r;t=r}return null}addOrUpdateRow(e,t,s){const{level:i,row:r}=e;if(i<0)return;let a=!1;if(r!==t){const o=t.treeNode;o!==null&&o!==e&&(o.removeRow(t),o.invalidate()),r===null?(e.setRow(t),a=!0):r.data?e.addDuplicateRow(t)&&(a=!0):(e.setRow(t),this.destroyRow(r,!0),a=!0)}s&&!qc(t)&&($P(t),a=!0),a&&e.invalidate(),this.rowsPendingDestruction?.delete(t)}removeRow(e,t){const{parent:s,level:i}=e;if(i<0)return;let r=!1;e.removeRow(t)&&(r=!0,s&&(s.childrenChanged=!0),this.destroyRow(t,!t.data)),r&&e.invalidate()}commitTree(e){const t=this.root;this.commitInvalidatedChildren(e,t);const s=t.row;t.childrenChanged&&t.updateChildrenAfterGroup()&&Ue(s),s.updateHasChildren(),Xc(s)&&e.changedPath?.isActive()&&e.changedPath.addParentNode(s),Jc(s),this.commitDestroyedRows()}commitInvalidatedChildren(e,t){for(;;){const s=t.dequeueInvalidated();if(s===null)break;s.parent===t&&this.commitChild(e,t,s)}}commitChild(e,t,s){if(s.isEmptyFillerNode()){this.clearTree(s);return}this.commitNodePreOrder(t,s),this.commitInvalidatedChildren(e,s),this.commitNodePostOrder(e,t,s)}commitNodePreOrder(e,t){let s=t.row;if(s===null?(s=this.createFillerRow(t),t.setRow(s)):(s=t.sortFirstDuplicateRow(),s.allChildrenCount===void 0&&(s.allChildrenCount=null)),s.parent=e.row,t.oldRow!==s)for(const r of t.enumChildren()){const a=r.row;a!==null&&(a.parent=s)}const i=t.key;s.key!==i?(s.key=i,jP(s),this.setGroupData(s,i)):s.groupData||this.setGroupData(s,i)}commitNodePostOrder(e,t,s){const i=s.row,r=s.oldRow;if(s.isEmptyFillerNode()){this.clearTree(s);return}s.childrenChanged&&s.updateChildrenAfterGroup()&&Ue(i),s.leafChildrenChanged&&s.updateAllLeafChildren();const a=s.getRowPosition();s.oldSourceRowIndex!==a&&(s.oldSourceRowIndex=a,t.childrenChanged=!0);const o=!!i.childrenAfterGroup?.length,n=o||!i.data,l=i.group;l!==n?(Ue(i),i.setGroup(n),!n&&!i.expanded&&Zc(i,!1)):i.hasChildren()!==o&&(Ue(i),i.updateHasChildren()),i.group&&!Yc(i)&&(r!==i&&r!==null&&r.group&&Yc(r)&&!e.isGroupOpenByDefault?i.expanded=r.expanded:i.expanded=this.getExpandedInitialValue(e,i),Zc(i,!0)),qc(i)&&(Ue(t.row),KP(i)&&i.setData(i.data)),r!==i&&(s.oldRow=i,r!==null&&(l||s.hasChildren())&&Ue(i),t.childrenChanged=!0,Ue(t.row)),Xc(i)?e.changedPath?.isActive()&&e.changedPath.addParentNode(i):jc(i)||(i.childrenAfterFilter||(i.childrenAfterFilter=i.childrenAfterGroup.slice()),i.childrenAfterAggFilter||(i.childrenAfterAggFilter=i.childrenAfterFilter.slice()),i.childrenAfterSort||(i.childrenAfterSort=i.childrenAfterAggFilter.slice())),Jc(i),s.duplicateRows?.size&&!s.duplicateRowsWarned&&(s.duplicateRowsWarned=!0,zc("duplicate group keys for row data, keys should be unique",[i.id,i.data,...Array.from(s.duplicateRows).map(c=>c.data)]))}createFillerRow(e){const t=new Wc(this.beans);t.key=e.key,t.group=!0,t.field=null,t.leafGroup=!1,t.rowGroupIndex=null,t.allChildrenCount=null;let s=e.level+"-"+e.key,i=e.parent;for(;i!==null;){const r=i.parent;if(r===null)break;s=`${i.level}-${i.key}-${s}`,i=r}return t.id=Wc.ID_PREFIX_ROW_GROUP+s,t}setGroupData(e,t){const s={};e.groupData=s;const i=this.showRowGroupColsService?.getShowRowGroupCols();if(i)for(const r of i)s[r.getColId()]=t}getExpandedInitialValue(e,t){const s=e.isGroupOpenByDefault;return s?s({rowNode:t,field:t.field,key:t.key,level:t.level,rowGroupColumn:t.rowGroupColumn})==!0:e.expandByDefault===-1||t.level<e.expandByDefault}clearTree(e){const{parent:t,oldRow:s,row:i,level:r}=e;if(t!==null&&s!==null&&(t.childrenChanged=!0,t.row!==null&&Ue(t.row)),i!==null&&r>=0){let a=e.row;for(;a!==null&&e.removeRow(a);)this.destroyRow(a,!a.data),a=e.row}for(const a of e.enumChildren())this.clearTree(a);e.destroy()}destroyTree(e){const{row:t,level:s,duplicateRows:i}=e;if(t&&(s>=0&&!t.data?this.destroyRow(t,!0):is(t)),i)for(const r of i)s>=0&&!r.data?this.destroyRow(r,!0):is(r);for(const r of e.enumChildren())this.destroyTree(r);e.destroy()}destroyRow(e,t){if(!jc(e)){is(e);return}if(!t){(this.rowsPendingDestruction??(this.rowsPendingDestruction=new Set)).add(e);return}is(e),e.setRowIndex(null),e.setRowTop(null),!e.data&&e.isSelected()&&e.setSelectedParams({newValue:!1,source:"rowGroupChanged"})}commitDestroyedRows(){const{rowsPendingDestruction:e}=this;if(e!==null){this.rowsPendingDestruction=null;for(const t of e)this.destroyRow(t,!0)}}},qP=class extends cP{constructor(){super(...arguments),this.beanName="groupStage"}wireBeans(e){this.selectableService=e.selectableService}execute(e){const t=this.gos.get("treeData")?YP:UP;let s=this.strategy;s?.constructor!==t&&(this.destroyBean(s),s=this.createManagedBean(new t),this.strategy=s),s.execute(e),this.selectableService.updateSelectableAfterGrouping()}destroy(){this.destroyBean(this.strategy),this.strategy=void 0,super.destroy()}},Qc="PivotRowTotal_",XP=class extends gP{constructor(){super(...arguments),this.beanName="pivotColDefService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.columnNameService=e.columnNameService}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(a,o=[]){return a.forEach(n=>{n.children!==void 0?s(n.children,o):o.push(n)}),o}const i=s(t);this.addRowGroupTotals(t,i),this.addExpandablePivotGroups(t,i),this.addPivotTotalsToGroups(t,i);const r=i.map(a=>mP(a));return{pivotColumnGroupDefs:t,pivotColumnDefs:r}}createPivotColumnsFromUniqueValues(e){const t=this.funcColsService.getPivotColumns(),s=t.length;return this.recursivelyBuildGroup(0,e,[],s,t)}recursivelyBuildGroup(e,t,s,i,r){const a=this.funcColsService.getValueColumns();if(e>=i)return this.buildMeasureCols(s);const o=r[e].getColDef(),n=this.headerNameComparator.bind(this,o.pivotComparator);if(a.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===i-1){const c=[];return Kc(t,h=>{const d=[...s,h],u=this.createColDef(a[0],h,d);u.columnGroupShow="open",c.push(u)}),c.sort(n),c}const l=[];return Kc(t,(c,h)=>{const d=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,u=[...s,c];l.push({children:this.recursivelyBuildGroup(e+1,h,u,i,r),headerName:c,pivotKeys:u,columnGroupShow:"open",openByDefault:d,groupId:this.generateColumnGroupId(u)})}),l.sort(n),l}buildMeasureCols(e){const t=this.funcColsService.getValueColumns();return t.length===0?[this.createColDef(null,"-",e)]:t.map(s=>{const i=this.columnNameService.getDisplayNameForColumn(s,"header");return{...this.createColDef(s,i,e),columnGroupShow:"open"}})}addExpandablePivotGroups(e,t){const s=this.gos.get("suppressExpandablePivotGroups");if(s||this.gos.get("pivotColumnGroupTotals"))return;const i=(r,a,o)=>{if("children"in r){const c=new Map;r.children.forEach(d=>{i(d,a,c)});const h=!r.children.some(d=>d.children);this.funcColsService.getValueColumns().forEach(d=>{const u=this.columnNameService.getDisplayNameForColumn(d,"header"),p=this.createColDef(d,u,r.pivotKeys);p.pivotTotalColumnIds=c.get(d.getColId()),p.columnGroupShow=s?"open":"closed",p.aggFunc=d.getAggFunc(),h||(r.children.push(p),a.push(p))}),this.merge(o,c);return}if(!r.pivotValueColumn)return;const n=r.pivotValueColumn.getColId();o.has(n)?o.get(n).push(r.colId):o.set(n,[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.funcColsService.getValueColumns(),r=i.map(o=>o.getAggFunc());if(!r||r.length<1||!this.sameAggFuncs(r))return;const a=i[0];e.forEach(o=>{this.recursivelyAddPivotTotal(o,t,a,s)})}recursivelyAddPivotTotal(e,t,s,i){const r=e;if(!r.children){const o=e;return o.colId?[o.colId]:null}let a=[];if(r.children.forEach(o=>{const n=this.recursivelyAddPivotTotal(o,t,s,i);n&&(a=a.concat(n))}),r.children.length>1){const n=this.localeService.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),l=this.createColDef(s,n,e.pivotKeys,!0);l.pivotTotalColumnIds=a,l.aggFunc=s.getAggFunc(),l.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;const c=e.children;i?c.push(l):c.unshift(l),t.push(l)}return a}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const s=this.gos.get("pivotRowTotals")==="after",r=this.funcColsService.getValueColumns().slice();s||r.reverse();const a=r.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let o=0;o<r.length;o++){const n=r[o],l=this.columnNameService.getDisplayNameForColumn(n,"header"),c=this.createColDef(n,l,[]),h=[];for(let u=0;u<t.length;u++){const p=t[u];p.pivotValueColumn===n&&h.push(p.colId)}c.pivotTotalColumnIds=h,c.colId=Qc+c.colId;const d=a?{children:[c],pivotKeys:[],groupId:`${Qc}_pivotGroup_${n.getColId()}`}:c;t.push(c),s?e.push(d):e.unshift(d)}}createColDef(e,t,s,i=!1){const r={};if(e){const a=e.getColDef();Object.assign(r,a),r.hide=!1}return r.headerName=t,r.colId=this.generateColumnId(s||[],e&&!i?e.getColId():""),r.field=r.colId,r.valueGetter=a=>a.data?.[a.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}headerNameComparator(e,t,s){return e?e(t.headerName,s.headerName):t.headerName&&!s.headerName?1:!t.headerName&&s.headerName?-1:!t.headerName||!s.headerName?0:t.headerName<s.headerName?-1:t.headerName>s.headerName?1:0}merge(e,t){t.forEach((s,i)=>{const a=[...e.has(i)?e.get(i):[],...s];e.set(i,a)})}generateColumnGroupId(e){return`pivotGroup_${this.funcColsService.getPivotColumns().map(s=>s.getColId()).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${this.funcColsService.getPivotColumns().map(i=>i.getColId()).join("-")}_${e.join("-")}_${t}`}createColDefsFromFields(e){const t={};for(let r=0;r<e.length;r++){const o=e[r].split(this.fieldSeparator);let n=t;for(let l=0;l<o.length;l++){const c=o[l];n[c]==null&&(n[c]={}),n=n[c]}}const s=(r,a,o,n)=>{const l=[];for(const d in o){const u=o[d],p=s(`${r}${this.fieldSeparator}${d}`,d,u,n+1);l.push(p)}if(l.length===0){const d=this.columnModel.getColDefCol(a);if(d){const p=this.columnNameService.getDisplayNameForColumn(d,"header")??a,g=this.createColDef(d,p,void 0,!1);return g.colId=r,g.aggFunc=d.getAggFunc(),g.valueGetter=m=>m.data?.[r],g}return{colId:r,headerName:a,valueGetter:p=>p.data?.[r]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&l.length===1&&"colId"in l[0]?(l[0].headerName=a,l[0]):{openByDefault:this.pivotDefaultExpanded===-1||n<this.pivotDefaultExpanded,groupId:r,headerName:a,children:l}},i=[];for(const r in t){const a=t[r],o=s(r,r,a,0);i.push(o)}return i}},eh="Exceeded maximum allowed pivot column count.",ZP=class extends fP{constructor(){super(...arguments),this.beanName="pivotStage",this.uniqueValues={},this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.pivotColDefService=e.pivotColDefService}execute(e){const t=e.changedPath;this.columnModel.isPivotActive()?this.executePivotOn(t):this.executePivotOff(t)}executePivotOff(e){this.aggregationColumnsHashLastTime=null,this.uniqueValues={},this.pivotResultColsService.isPivotResultColsPresent()&&(this.pivotResultColsService.setPivotResultCols(null,"rowModelUpdated"),e&&e.setInactive())}executePivotOn(e){const t=this.funcColsService.getValueColumns().length??1,s=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=s===-1?-1:s/t;let i;try{i=this.bucketUpRowNodes(e)}catch(f){if(f.message===eh){this.pivotResultColsService.setPivotResultCols([],"rowModelUpdated"),this.eventService.dispatchEvent({type:"pivotMaxColumnsExceeded",message:f.message}),this.lastTimeFailed=!0;return}throw f}const r=this.setUniqueValues(i),a=this.funcColsService.getValueColumns(),o=a.map(f=>`${f.getId()}-${f.getColDef().headerName}`).join("#"),n=a.map(f=>f.getAggFunc().toString()).join("#"),l=this.aggregationColumnsHashLastTime!==o,c=this.aggregationFuncsHashLastTime!==n;this.aggregationColumnsHashLastTime=o,this.aggregationFuncsHashLastTime=n;const h=this.funcColsService.getRowGroupColumns().map(f=>f.getId()).join("#"),d=h!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=h;const u=this.gos.get("pivotRowTotals"),p=this.gos.get("pivotColumnGroupTotals"),g=this.gos.get("suppressExpandablePivotGroups"),m=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),C=u!==this.pivotRowTotalsLastTime||p!==this.pivotColumnGroupTotalsLastTime||g!==this.suppressExpandablePivotGroupsLastTime||m!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=u,this.pivotColumnGroupTotalsLastTime=p,this.suppressExpandablePivotGroupsLastTime=g,this.removePivotHeaderRowWhenSingleValueColumnLastTime=m,this.lastTimeFailed||r||l||d||c||C){const{pivotColumnGroupDefs:f,pivotColumnDefs:v}=this.pivotColDefService.createPivotColumnDefs(this.uniqueValues);this.pivotColumnDefs=v,this.pivotResultColsService.setPivotResultCols(f,"rowModelUpdated"),e&&e.setInactive()}this.lastTimeFailed=!1}setUniqueValues(e){const t=JSON.stringify(e),s=JSON.stringify(this.uniqueValues);return t!==s?(this.uniqueValues=e,!0):!1}bucketUpRowNodes(e){this.currentUniqueCount=0;const t={};e.forEachChangedNodeDepthFirst(i=>{i.leafGroup&&(i.childrenMapped=null)});const s=i=>{i.leafGroup?this.bucketRowNode(i,t):i.childrenAfterFilter?.forEach(s)};return e.executeFromRootNode(s),t}bucketRowNode(e,t){const s=this.funcColsService.getPivotColumns();s.length===0?e.childrenMapped=null:e.childrenMapped=this.bucketChildren(e.childrenAfterFilter,s,0,t),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t,s,i){const r={},a=t[s];if(e.forEach(o=>{let n=this.valueService.getKeyForNode(a,o);if(vP(n)&&(n=""),!i[n]){this.currentUniqueCount+=1,i[n]={};const l=this.maxUniqueValues!==-1,c=this.currentUniqueCount>this.maxUniqueValues;if(l&&c)throw Error(eh)}r[n]||(r[n]=[]),r[n].push(o)}),s===t.length-1)return r;{const o={};return CP(r,(n,l)=>{o[n]=this.bucketChildren(l,t,s+1,i[n])}),o}}getPivotColumnDefs(){return this.pivotColumnDefs}};function JP(e,t,s){e.aggFuncService&&e.aggFuncService.addAggFuncs({key:s})}function QP(e,t){e.aggFuncService&&e.aggFuncService.addAggFuncs(t)}function eT(e){e.aggFuncService&&e.aggFuncService.clear()}function tT(e,t,s){e.funcColsService.setColumnAggFunc(t,s,"api")}function sT(e){return e.columnModel.isPivotMode()}function iT(e,t,s){return e.pivotResultColsService.lookupPivotResultCol(t,s)}function rT(e,t){e.funcColsService.setValueColumns(t,"api")}function aT(e){return e.funcColsService.getValueColumns()}function oT(e,t){e.funcColsService.removeValueColumns([t],"api")}function nT(e,t){e.funcColsService.removeValueColumns(t,"api")}function lT(e,t){e.funcColsService.addValueColumns([t],"api")}function cT(e,t){e.funcColsService.addValueColumns(t,"api")}function hT(e,t){e.funcColsService.setRowGroupColumns(t,"api")}function dT(e,t){e.funcColsService.removeRowGroupColumns([t],"api")}function uT(e,t){e.funcColsService.removeRowGroupColumns(t,"api")}function pT(e,t){e.funcColsService.addRowGroupColumns([t],"api")}function gT(e,t){e.funcColsService.addRowGroupColumns(t,"api")}function mT(e,t,s){e.funcColsService.moveRowGroupColumn(t,s,"api")}function fT(e){return e.funcColsService.getRowGroupColumns()}function CT(e,t){e.funcColsService.setPivotColumns(t,"api")}function vT(e,t){e.funcColsService.removePivotColumns([t],"api")}function ST(e,t){e.funcColsService.removePivotColumns(t,"api")}function yT(e,t){e.funcColsService.addPivotColumns([t],"api")}function wT(e,t){e.funcColsService.addPivotColumns(t,"api")}function xT(e){return e.funcColsService.getPivotColumns()}function bT(e,t){e.pivotResultColsService.setPivotResultCols(t,"api")}function PT(e){const t=e.pivotResultColsService.getPivotResultCols();return t?t.list:null}var TT=class extends SP{constructor(){super(...arguments),this.beanName="showRowGroupColsService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}refresh(){this.showRowGroupCols=[],this.showRowGroupColsMap={},this.columnModel.getCols().forEach(e=>{const s=e.getColDef().showRowGroup,i=typeof s=="string";!i&&!(s===!0)||(this.showRowGroupCols.push(e),i?this.showRowGroupColsMap[s]=e:this.funcColsService.getRowGroupColumns().forEach(o=>{this.showRowGroupColsMap[o.getId()]=e}))})}getShowRowGroupCols(){return this.showRowGroupCols}getShowRowGroupCol(e){return this.showRowGroupColsMap[e]}},rs="32.3.2",pa=Qt({version:rs,moduleName:`${aa.RowGroupingModule}-core`,beans:[EP,BP,qP,XP,ZP,xP,IP,TT,OP],userComponents:[{name:"agGroupRowRenderer",classImp:ht},{name:"agGroupCellRenderer",classImp:ht}],controllers:[{name:"groupCellRendererCtrl",classImp:Lt}],dependantModules:[H]}),MT=Qt({version:rs,moduleName:`${aa.RowGroupingModule}-api`,apiFunctions:{addAggFunc:JP,addAggFuncs:QP,clearAggFuncs:eT,setColumnAggFunc:tT,isPivotMode:sT,getPivotResultColumn:iT,setValueColumns:rT,getValueColumns:aT,removeValueColumn:oT,removeValueColumns:nT,addValueColumn:lT,addValueColumns:cT,setRowGroupColumns:hT,removeRowGroupColumn:dT,removeRowGroupColumns:uT,addRowGroupColumn:pT,addRowGroupColumns:gT,getRowGroupColumns:fT,moveRowGroupColumn:mT,setPivotColumns:CT,removePivotColumn:vT,removePivotColumns:ST,addPivotColumn:yT,addPivotColumns:wT,getPivotColumns:xT,setPivotResultColumns:bT,getPivotResultColumns:PT},dependantModules:[pa]}),th=Qt({version:rs,moduleName:"@ag-grid-enterprise/group-filter",userComponents:[{name:"agGroupColumnFilter",classImp:NP}],dependantModules:[pa,Tb]}),FT=Qt({version:rs,moduleName:"@ag-grid-enterprise/group-floating-filter",userComponents:[{name:"agGroupColumnFloatingFilter",classImp:VP}],dependantModules:[th,Mb]}),gi=Qt({version:rs,moduleName:aa.RowGroupingModule,dependantModules:[pa,MT,th,FT]}),mi=class extends da{constructor(e){super(e,"aggregation")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),s=e("values","Values");super.init({icon:yP("valuePanel",this.gos,null),emptyMessage:t,title:s}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getTooltipParams(){const e=super.getTooltipParams();return e.location="valueColumnsList",e}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowValue()&&(!e.isValueActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setValueColumns(e,"toolPanelUi")}getExistingItems(){return this.funcColsService.getValueColumns()}};import{ModuleNames as ga,_defineModule as ma}from"ag-grid-community";import{AgProvidedColumnGroup as AT,BeanStub as RT,_warnOnce as ET,isProvidedColumnGroup as IT}from"ag-grid-community";import{_includes as sh,_last as DT}from"ag-grid-community";function ft(e){return!!e&&typeof e.children<"u"}function He(e){return ft(e)?e.groupId:e.colId}function ih(e,t,s){const i=(o,n)=>{const l=o.children.map(He),c=sh(l,He(n)),h=DT(o.children),d=h&&He(h)!==He(n);return c&&d};if(!ft(e))return!0;const r=e,a=s;if(i(r,a))return r.children.push(a),!0;if(r.groupId===t){const o=r.children.map(He);if(!sh(o,He(a)))return r.children.push(a),!0}for(let o=r.children.length-1;o>=0&&!ih(r.children[o],t,s);o--);return!1}function LT(e){const t=(r,a)=>ft(r)&&ft(a)&&He(r)===He(a),s=(r,a)=>{if(!ft(a))return r;const o=r,n=a;return n.children&&n.groupId&&ih(o,n.groupId,n.children[0])||n.children.forEach(l=>s(o,l)),o},i=[];for(let r=1;r<=e.length;r++){const a=e[r-1],o=e[r];t(a,o)?e[r]=s(a,o):i.push(a)}return i}var fa=class extends RT{constructor(){super(...arguments),this.beanName="toolPanelColDefService"}wireBeans(e){this.columnModel=e.columnModel}createColumnTree(e){const t=[],s=(r,a)=>{if(ft(r)){const o=r,n=typeof o.groupId<"u"?o.groupId:o.headerName,l=new AT(o,n,!1,a),c=[];return o.children.forEach(h=>{const d=s(h,a+1);d&&c.push(d)}),l.setChildren(c),l}else{const o=r,n=o.colId?o.colId:o.field,l=this.columnModel.getColDefCol(n);return l||t.push(o),l}},i=[];return e.forEach(r=>{const a=s(r,0);a&&i.push(a)}),t.length>0&&ET("unable to find grid columns for the supplied colDef(s):",t),i}syncLayoutWithGrid(e){const t=this.getLeafPathTrees(),s=LT(t);e(s)}getLeafPathTrees(){const e=(i,r)=>{let a;if(IT(i))if(i.isPadding())a=r;else{const n=Object.assign({},i.getColGroupDef());n.groupId=i.getGroupId(),n.children=[r],a=n}else{const n=Object.assign({},i.getColDef());n.colId=i.getColId(),a=n}const o=i.getOriginalParent();return o?e(o,a):a};return this.columnModel.getCols().filter(i=>{const r=i.getColDef();return i.isPrimary()&&!r.showRowGroup}).map(i=>e(i,i.getColDef()))}};import{_unwrapUserComp as kT}from"ag-grid-community";function GT(e){return e.sideBarService?.getSideBarComp().isDisplayed()??!1}function OT(e,t){e.sideBarService?.getSideBarComp().setDisplayed(t)}function BT(e,t){e.sideBarService?.getSideBarComp().setSideBarPosition(t)}function NT(e,t){e.sideBarService?.getSideBarComp().openToolPanel(t,"api")}function VT(e){e.sideBarService?.getSideBarComp().close("api")}function _T(e){return e.sideBarService?.getSideBarComp().openedItem()??null}function UT(e){e.sideBarService?.getSideBarComp().refresh()}function HT(e){return e.sideBarService?.getSideBarComp().isToolPanelShowing()??!1}function zT(e,t){const s=e.sideBarService?.getSideBarComp().getToolPanelInstance(t);return kT(s)}function WT(e){return e.sideBarService?.getSideBarComp().getDef()}import{BeanStub as KT}from"ag-grid-community";import{Component as $T,KeyCode as fi,ManagedFocusFeature as jT,ModuleNames as rh,RefPlaceholder as YT,_addFocusableContainerListener as qT,_getActiveDomElement as ah,_removeFromParent as oh,_setAriaControls as XT,_warnOnce as Ca}from"ag-grid-community";import{Component as ZT,KeyCode as JT,_clearElement as QT,_stopPropagationForAgGrid as eM}from"ag-grid-community";import{Component as tM,RefPlaceholder as va,_createIconNoSpan as sM,_setAriaExpanded as iM}from"ag-grid-community";var rM=class extends tM{constructor(e){super(),this.eToggleButton=va,this.eIconWrapper=va,this.eLabel=va,this.toolPanelDef=e}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const e=this.createTemplate();this.setTemplate(e,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation">
346
+ `),this.eFloatingFilter=nP,this.haveAddedColumnListeners=!1}wireBeans(e){this.columnNameService=e.columnNameService,this.filterManager=e.filterManager}init(e){this.params=e;const t=this.gos.get("groupDisplayType")==="multipleColumns";return new _c(s=>{this.params.parentFilterInstance(i=>{this.parentFilterInstance=i,t?this.setupUnderlyingFloatingFilterElement().then(()=>s()):(this.setupReadOnlyFloatingFilterElement(),s())})}).then(()=>{this.addManagedListeners(this.parentFilterInstance,{selectedColumnChanged:this.onSelectedColumnChanged.bind(this),columnRowGroupChanged:this.onColumnRowGroupChanged.bind(this)})})}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e,this.setParams()}setParams(){const e=this.columnNameService.getDisplayNameForColumn(this.params.column,"header",!0),t=this.localeService.getLocaleTextFunc();this.eFloatingFilterText?.setInputAriaLabel(`${e} ${t("ariaFilterInput","Filter Input")}`)}setupReadOnlyFloatingFilterElement(){this.eFloatingFilterText||(this.eFloatingFilterText=this.createManagedBean(new aP),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,lP(this.eFloatingFilter);const e=this.parentFilterInstance.getSelectedColumn();if(e&&!e.isVisible()){const t=this.filterManager.getFloatingFilterCompDetails(e,this.params.showParentFilter);if(t)return this.haveAddedColumnListeners||(this.haveAddedColumnListeners=!0,this.addManagedListeners(e,{visibleChanged:this.onColumnVisibleChanged.bind(this),colDefChanged:this.onColDefChanged.bind(this)})),t.newAgStackInstance().then(s=>{this.underlyingFloatingFilter=s,this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel()),this.appendChild(s.getGui()),this.showingUnderlyingFloatingFilter=!0})}return this.setupReadOnlyFloatingFilterElement(),_c.resolve()}onColumnVisibleChanged(){this.setupUnderlyingFloatingFilterElement()}onColDefChanged(e){if(!e.column)return;const t=this.filterManager.getFloatingFilterCompDetails(e.column,this.params.showParentFilter);t&&(this.underlyingFloatingFilter?.refresh?this.underlyingFloatingFilter.refresh(t.params):this.underlyingFloatingFilter?.onParamsUpdated?.(t.params))}onParentModelChanged(e,t){this.showingUnderlyingFloatingFilter?this.underlyingFloatingFilter?.onParentModelChanged(this.parentFilterInstance.getSelectedFilter()?.getModel(),t):this.updateDisplayedValue()}updateDisplayedValue(){if(!this.parentFilterInstance||!this.eFloatingFilterText)return;const e=this.parentFilterInstance.getSelectedFilter();if(!e){this.eFloatingFilterText.setValue(""),this.eFloatingFilterText.setDisplayed(!1);return}if(this.eFloatingFilterText.setDisplayed(!0),e.getModelAsString){const t=e.getModel();this.eFloatingFilterText.setValue(t==null?"":e.getModelAsString(t))}else this.eFloatingFilterText.setValue("")}onSelectedColumnChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}onColumnRowGroupChanged(){this.showingUnderlyingFloatingFilter||this.updateDisplayedValue()}destroy(){super.destroy()}},ua=class{constructor(){this.allSets={},this.allParents=[]}removeFromChildrenAfterGroup(e,t){const s=this.getSet(e);s.removeFromChildrenAfterGroup[t.id]=!0}isRemoveFromAllLeafChildren(e,t){return!!this.getSet(e).removeFromAllLeafChildren[t.id]}preventRemoveFromAllLeafChildren(e,t){const s=this.getSet(e);delete s.removeFromAllLeafChildren[t.id]}removeFromAllLeafChildren(e,t){const s=this.getSet(e);s.removeFromAllLeafChildren[t.id]=!0}getSet(e){return this.allSets[e.id]||(this.allSets[e.id]={removeFromAllLeafChildren:{},removeFromChildrenAfterGroup:{}},this.allParents.push(e)),this.allSets[e.id]}getAllParents(){return this.allParents}flush(){this.allParents.forEach(e=>{const t=this.allSets[e.id];e.childrenAfterGroup=e.childrenAfterGroup.filter(i=>!t.removeFromChildrenAfterGroup[i.id]),e.allLeafChildren=e.allLeafChildren?.filter(i=>!t.removeFromAllLeafChildren[i.id])??null,e.updateHasChildren();const s=e.sibling;s&&(s.childrenAfterGroup=e.childrenAfterGroup,s.allLeafChildren=e.allLeafChildren)}),this.allSets={},this.allParents.length=0}};function _P(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($c(e[i-1],e[i])>0){s=!0;break}return s?(e.sort($c),!0):!1}function $c(e,t){const s=e.sourceRowIndex,i=t.sourceRowIndex,r=s>=0,a=i>=0,o=r&&a,n=!r&&!a;return o?s-i:n?e.__objectId-t.__objectId:r?1:-1}var UP=class extends hP{wireBeans(e){this.beans=e,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.selectionService=e.selectionService,this.showRowGroupColsService=e.showRowGroupColsService}execute(e){const t=this.createGroupingDetails(e);if(t.transactions)this.handleTransaction(t);else{const s=e.afterColumnsChanged===!0;this.shotgunResetEverything(t,s)}this.positionLeafsAndGroups(e.changedPath),this.orderGroups(t)}positionLeafsAndGroups(e){e.forEachChangedNodeDepthFirst(t=>{if(t.childrenAfterGroup){const s=[],i=[];let r;t.childrenAfterGroup.forEach(a=>{a.childrenAfterGroup?.length?a.key===""&&!r?r=a:i.push(a):s.push(a)}),r&&i.push(r),t.childrenAfterGroup=[...s,...i]}},!1)}createGroupingDetails(e){const{rowNode:t,changedPath:s,rowNodeTransactions:i,rowNodesOrderChanged:r}=e,a=this.funcColsService.getRowGroupColumns();return{expandByDefault:this.gos.get("groupDefaultExpanded"),groupedCols:a,rootNode:t,pivotMode:this.columnModel.isPivotMode(),groupedColCount:a?.length??0,transactions:i,rowNodesOrderChanged:!!r,changedPath:s,groupAllowUnbalanced:this.gos.get("groupAllowUnbalanced"),isGroupOpenByDefault:this.gos.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:this.gos.getCallback("initialGroupOrderComparator"),suppressGroupMaintainValueType:this.gos.get("suppressGroupMaintainValueType"),keyCreators:a?.map(n=>n.getColDef().keyCreator)??[]}}handleTransaction(e){e.transactions.forEach(t=>{const s=new ua;ha(t.remove)&&this.removeNodes(t.remove,e,s),ha(t.update)&&this.moveNodesInWrongPath(t.update,e,s),ha(t.add)&&this.insertNodes(t.add,e);const i=s.getAllParents().slice();s.flush(),this.removeEmptyGroups(i,e)}),e.rowNodesOrderChanged&&this.sortChildren(e)}sortChildren(e){e.changedPath.forEachChangedNodeDepthFirst(t=>{_P(t.childrenAfterGroup)&&e.changedPath.addParentNode(t)},!1,!0)}orderGroups(e){const t=e.initialGroupOrderComparator;Hc(t)&&s(e.rootNode);function s(i){Hc(i.childrenAfterGroup)&&!i.leafGroup&&(i.childrenAfterGroup.sort((a,o)=>t({nodeA:a,nodeB:o})),i.childrenAfterGroup.forEach(a=>s(a)))}}getExistingPathForNode(e,t){const s=[];let i=e.parent;for(;i&&i!==t.rootNode;)s.push({key:i.key,rowGroupColumn:i.rowGroupColumn,field:i.field}),i=i.parent;return s.reverse(),s}moveNodesInWrongPath(e,t,s){e.forEach(i=>{t.changedPath.isActive()&&t.changedPath.addParentNode(i.parent);const r=l=>l.key,a=this.getExistingPathForNode(i,t).map(r),o=this.getGroupInfo(i,t).map(r);ca(a,o)||this.moveNode(i,t,s)})}moveNode(e,t,s){if(this.removeNodesFromParents([e],t,s),this.insertOneNode(e,t,s),e.setData(e.data),t.changedPath.isActive()){const i=e.parent;t.changedPath.addParentNode(i)}}removeNodes(e,t,s){this.removeNodesFromParents(e,t,s),t.changedPath.isActive()&&e.forEach(i=>t.changedPath.addParentNode(i.parent))}forEachParentGroup(e,t,s){let i=t;for(;i&&i!==e.rootNode;)s(i),i=i.parent}removeNodesFromParents(e,t,s){const i=s==null,r=s||new ua;e.forEach(a=>{this.removeFromParent(a,r),this.forEachParentGroup(t,a.parent,o=>{r.removeFromAllLeafChildren(o,a)})}),i&&r.flush()}removeEmptyGroups(e,t){let s=!0;const i=r=>{const a=this.getChildrenMappedKey(r.key,r.rowGroupColumn),o=r.parent;return(o?.childrenMapped?!o.childrenMapped[a]:!0)?!1:!!r.group&&(r.childrenAfterGroup?.length??0)===0};for(;s;){s=!1;const r=new ua;e.forEach(a=>{this.forEachParentGroup(t,a,o=>{i(o)&&(s=!0,this.removeFromParent(o,r),o.setSelectedParams({newValue:!1,source:"rowGroupChanged"}))})}),r.flush()}}removeFromParent(e,t){e.parent&&(t?t.removeFromChildrenAfterGroup(e.parent,e):(dP(e.parent.childrenAfterGroup,e),e.parent.updateHasChildren()));const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn);e.parent?.childrenMapped&&delete e.parent.childrenMapped[s],e.setRowTop(null),e.setRowIndex(null)}addToParent(e,t){const s=this.getChildrenMappedKey(e.key,e.rowGroupColumn);t?.childrenMapped&&t.childrenMapped[s]!==e&&(t.childrenMapped[s]=e,t.childrenAfterGroup.push(e),t.setGroup(!0))}areGroupColsEqual(e,t){return e==null||t==null||e.pivotMode!==t.pivotMode?!1:ca(e.groupedCols,t.groupedCols)&&ca(e.keyCreators,t.keyCreators)}checkAllGroupDataAfterColsChanged(e){const t=s=>{s&&s.forEach(i=>{if(!i.group)return;const a={field:i.field,key:i.key,rowGroupColumn:i.rowGroupColumn,leafNode:i.allLeafChildren?.[0]};this.setGroupData(i,a,e),t(i.childrenAfterGroup)})};t(e.rootNode.childrenAfterGroup)}shotgunResetEverything(e,t){if(this.noChangeInGroupingColumns(e,t))return;this.selectionService.filterFromSelection(a=>a&&!a.group);const{groupedCols:s}=e,i=e.rootNode;i.leafGroup=s.length===0,i.childrenAfterGroup=[],i.childrenMapped={},i.updateHasChildren();const r=i.sibling;r&&(r.childrenAfterGroup=i.childrenAfterGroup,r.childrenMapped=i.childrenMapped),this.insertNodes(i.allLeafChildren,e)}noChangeInGroupingColumns(e,t){let s=!1;const i=this.showRowGroupColsService.getShowRowGroupCols(),r=i?i.map(a=>a.getId()).join("-"):"";return t&&(s=this.areGroupColsEqual(e,this.oldGroupingDetails),this.oldGroupDisplayColIds!==r&&this.checkAllGroupDataAfterColsChanged(e)),this.oldGroupingDetails=e,this.oldGroupDisplayColIds=r,s}insertNodes(e,t){e.forEach(s=>{this.insertOneNode(s,t),t.changedPath.isActive()&&t.changedPath.addParentNode(s.parent)})}insertOneNode(e,t,s){const i=this.getGroupInfo(e,t),r=this.findParentForNode(e,i,t,s);r.group||uP("duplicate group keys for row data, keys should be unique",[r.data,e.data]),e.parent=r,e.level=i.length,r.childrenAfterGroup.push(e),r.updateHasChildren()}findParentForNode(e,t,s,i){let r=s.rootNode;return t.forEach((a,o)=>{r=this.getOrCreateNextNode(r,a,o,s),i?.isRemoveFromAllLeafChildren(r,e)?i?.preventRemoveFromAllLeafChildren(r,e):r.allLeafChildren.push(e)}),r}getOrCreateNextNode(e,t,s,i){const r=this.getChildrenMappedKey(t.key,t.rowGroupColumn);let a=e?.childrenMapped?.[r];return a||(a=this.createGroup(t,e,s,i),this.addToParent(a,e)),a}createGroup(e,t,s,i){const r=new Uc(this.beans);return r.group=!0,r.field=e.field,r.rowGroupColumn=e.rowGroupColumn,this.setGroupData(r,e,i),r.key=e.key,r.id=this.createGroupId(r,t,s),r.level=s,r.leafGroup=s===i.groupedColCount-1,r.allLeafChildren=[],r.setAllChildrenCount(0),r.rowGroupIndex=s,r.childrenAfterGroup=[],r.childrenMapped={},r.updateHasChildren(),r.parent=t,this.setExpandedInitialValue(i,r),r}createGroupId(e,t,s){const i=(r,a)=>{if(!r.rowGroupColumn)return null;const o=a?i(a,a.parent,0):null;return`${o==null?"":o+"-"}${r.rowGroupColumn.getColId()}-${r.key}`};return Uc.ID_PREFIX_ROW_GROUP+i(e,t,s)}setGroupData(e,t,s){e.groupData={},this.showRowGroupColsService.getShowRowGroupCols().forEach(r=>{const a=e.rowGroupColumn;a!==null&&r.isRowGroupDisplayed(a.getId())&&(s.suppressGroupMaintainValueType?e.groupData[r.getColId()]=t.key:e.groupData[r.getColId()]=this.valueService.getValue(a,t.leafNode))})}getChildrenMappedKey(e,t){return t?t.getId()+"-"+e:e}setExpandedInitialValue(e,t){if(e.pivotMode&&t.leafGroup){t.expanded=!1;return}const s=e.isGroupOpenByDefault;if(s){const i={rowNode:t,field:t.field,key:t.key,level:t.level,rowGroupColumn:t.rowGroupColumn};t.expanded=s(i)==!0;return}if(e.expandByDefault===-1){t.expanded=!0;return}t.expanded=t.level<e.expandByDefault}getGroupInfo(e,t){const s=[];return t.groupedCols.forEach(i=>{let r=this.valueService.getKeyForNode(i,e),a=r!=null&&r!=="";if((t.pivotMode||!t.groupAllowUnbalanced)&&!a&&(r="",a=!0),a){const n={key:r,field:i.getColDef().field,rowGroupColumn:i,leafNode:e};s.push(n)}}),s}},HP=(e,t)=>e.treeNode.oldSourceRowIndex-t.treeNode.oldSourceRowIndex,K=Object.freeze([]),zP=K.values(),pi=(e,t)=>{e.parent=null,e.treeNode=null,t?e.childrenAfterGroup=[]:(e.level=0,e.childrenAfterGroup=null,e.allLeafChildren=null)},WP=class yu{constructor(t,s,i){this.parent=t,this.key=s,this.level=i,this.children=null,this.invalidatedHead=null,this.invalidatedNext=void 0,this.row=null,this.oldRow=null,this.duplicateRows=null,this.childrenAfterGroup=K,this.allLeafChildren=K,this.childrenChanged=!1,this.leafChildrenChanged=!1,this.oldSourceRowIndex=-1}isEmptyFillerNode(){return!this.row?.data&&!this.children?.size}hasChildren(){return!!this.children?.size}enumChildren(){return this.children?.values()??zP}upsertKey(t){typeof t!="string"&&(t=String(t));let s=this.children?.get(t);return s||(s=new yu(this,t,this.level+1),(this.children??(this.children=new Map))?.set(s.key,s)),s}destroy(){const{row:t,parent:s}=this;s!==null&&(s?.children?.delete(this.key),t!==null&&pi(t,!0),this.parent=null)}setRow(t){const{level:s,row:i,childrenAfterGroup:r}=this;if(s<0)i!==null&&i!==t&&pi(i,!0);else{if(i===t)return!1;i!==null?(t.allLeafChildren=i.allLeafChildren??this.allLeafChildren??K,pi(i,!1)):t.allLeafChildren=this.allLeafChildren??K}return t.level=s,t.childrenAfterGroup=r,t.treeNode=this,this.row=t,!0}removeRow(t){const{level:s,row:i,duplicateRows:r,childrenAfterGroup:a}=this;if(i===t){const o=this.popDuplicateRow();o?(this.row=o,o.childrenAfterGroup=a,s>=0&&(o.allLeafChildren=i.allLeafChildren??this.allLeafChildren??K)):this.row=null}else{if(!r?.delete(t))return!1;r.size===0&&(this.duplicateRows=null)}return pi(t,s<0),!0}addDuplicateRow(t){const{level:s}=this;let i=this.duplicateRows;if(i===null)i=new Set,this.duplicateRows=i;else if(i.has(t))return!1;return i.add(t),t.treeNode=this,t.level=s,s>=0&&(t.allLeafChildren=K),t.childrenAfterGroup=K,!0}sortFirstDuplicateRow(){const t=this.duplicateRows,s=this.row;if(!s||!t)return s;let i=s;for(const r of t)r.sourceRowIndex<i.sourceRowIndex&&(i=r);return i!==s&&(i.childrenAfterGroup=this.childrenAfterGroup,i.allLeafChildren=s.allLeafChildren??this.allLeafChildren??K,s.childrenAfterGroup=K,s.allLeafChildren=K,t.delete(i),t.add(s),this.row=i),i}popDuplicateRow(){let t=null;const s=this.duplicateRows;return s!==null&&(t=s.values().next().value,t!==null&&s.delete(t)&&s.size===0&&(this.duplicateRows=null)),t}dequeueInvalidated(){const t=this.invalidatedHead;return t!==null&&(this.invalidatedHead=t.invalidatedNext??null,t.invalidatedNext=void 0),t}invalidate(){let t=this,s=this.parent;for(;s!==null&&t.invalidatedNext===void 0;)t.invalidatedNext=s.invalidatedHead,s.invalidatedHead=t,t=s,s=t.parent}invalidateOrder(){const t=this.parent;t!==null&&!t.childrenChanged&&((this.children?.size??0)>1||!t.row?.data)&&(t.childrenChanged=!0,t.invalidate())}getRowPosition(){const t=this.row;return t?.data?t.sourceRowIndex:this.childrenAfterGroup[0]?.treeNode?.oldSourceRowIndex??this.oldSourceRowIndex}updateChildrenAfterGroup(){this.childrenChanged=!1;const t=this.children?.size??0;if(t===0)return this.childrenAfterGroup.length===0?!1:(this.leafChildrenChanged=!0,this.childrenAfterGroup=K,this.row.childrenAfterGroup=K,!0);let s=!1,i=this.childrenAfterGroup;i===K?(i=new Array(t),this.childrenAfterGroup=i,this.row.childrenAfterGroup=i,s=!0):i.length!==t&&(i.length=t,s=!0);let r=0,a=-1,o=!1;for(const n of this.enumChildren()){const l=n.getRowPosition();l<a&&(o=!0),a=l,n.oldSourceRowIndex=l;const c=n.row;i[r]!==c&&(i[r]=c,s=!0),++r}return s&&(this.leafChildrenChanged=!0),o&&this.reorderChildrenList(i),s||o}reorderChildrenList(t){const s=t.length,i=this.children;t.sort(HP),i.clear();for(let r=0;r<s;++r){const a=t[r].treeNode;i.set(a.key,a)}}updateAllLeafChildren(){const{parent:t,row:s,childrenAfterGroup:i}=this;this.leafChildrenChanged=!1;let r=!1;const a=i.length;if(a===0)r=s.allLeafChildren?.length!==0,s.allLeafChildren=K,this.allLeafChildren=K;else if(a===1&&i[0].allLeafChildren?.length)s.allLeafChildren=i[0].allLeafChildren,this.allLeafChildren=null,r=!0;else{let o=this.allLeafChildren;(o===K||o===null)&&(o=[],this.allLeafChildren=o);const n=o.length;let l=0;for(let c=0;c<a;++c){const h=i[c],d=h.allLeafChildren,u=d.length;if(u)for(let p=0;p<u;++p){const g=d[p];(l>=n||o[l]!==g)&&(o[l]=g,r=!0),++l}else(l>=n||o[l]!==h)&&h&&(o[l]=h,r=!0),++l}n!==l&&(o.length=l,r=!0),s.allLeafChildren!==o&&(s.allLeafChildren=o,r=!0)}r&&t&&(t.leafChildrenChanged=!0)}},jc=e=>(e.treeNodeFlags&1)!==0,Yc=e=>(e.treeNodeFlags&2)!==0,qc=e=>(e.treeNodeFlags&4)!==0,KP=e=>(e.treeNodeFlags&8)!==0,Xc=e=>(e.treeNodeFlags&16)!==0,Zc=(e,t)=>{t?e.treeNodeFlags|=2:e.treeNodeFlags&=-3},$P=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|4)},jP=e=>{const t=e.treeNodeFlags;t&1&&(e.treeNodeFlags=t|12)},Ue=e=>{e.treeNodeFlags|=16},Jc=e=>{e.treeNodeFlags=1|e.treeNodeFlags&-29},is=e=>{e.treeNodeFlags=0},YP=class extends pP{constructor(){super(...arguments),this.rowsPendingDestruction=null,this.root=new WP(null,"",-1)}wireBeans(e){this.beans=e,this.showRowGroupColsService=e.showRowGroupColsService}destroy(){const e=this.root.row;e!==null&&(this.root.removeRow(e),is(e)),this.destroyTree(this.root),this.commitDestroyedRows(),super.destroy()}execute(e){const{rowNodeTransactions:t,rowNodesOrderChanged:s,changedPath:i}=e,r=e.rowNode,a=this.gos,o={changedPath:i,expandByDefault:a.get("groupDefaultExpanded"),suppressGroupMaintainValueType:a.get("suppressGroupMaintainValueType"),getDataPath:a.get("getDataPath"),isGroupOpenByDefault:a.getCallback("isGroupOpenByDefault"),initialGroupOrderComparator:a.getCallback("initialGroupOrderComparator")};this.root.setRow(r),r.leafGroup=!1;const l=r.sibling;l&&(l.childrenAfterGroup=r.childrenAfterGroup,l.childrenMapped=r.childrenMapped),t?this.handleTransaction(o,t,s):this.handleRowData(o,r,e.afterColumnsChanged===!0)}handleRowData(e,t,s){const i=this.root;if(s||this.oldGroupDisplayColIds===void 0){const r=this.showRowGroupColsService?.getShowRowGroupCols()?.map(a=>a.getId()).join("-")??"";if(s){this.oldGroupDisplayColIds!==r&&this.checkAllGroupDataAfterColsChanged(i.row?.childrenAfterGroup);return}this.oldGroupDisplayColIds=r}this.clearTree(i),this.addOrUpdateRows(e,t.allLeafChildren,!1),this.commitTree(e)}handleTransaction(e,t,s){for(const{remove:i,update:r,add:a}of t)this.removeRows(i),this.addOrUpdateRows(e,r,!0),this.addOrUpdateRows(e,a,!1);s&&this.handleRowNodesOrderChanged(),this.commitTree(e)}handleRowNodesOrderChanged(){const e=this.root.row?.allLeafChildren;if(e)for(let t=0,s=e.length;t<s;++t){const i=e[t].treeNode;i&&i.oldSourceRowIndex!==t&&i.invalidateOrder()}}checkAllGroupDataAfterColsChanged(e){for(let t=0,s=e?.length??0;t<s;++t){const i=e[t];this.setGroupData(i,i.treeNode?.key??i.key),this.checkAllGroupDataAfterColsChanged(i.childrenAfterGroup)}}addOrUpdateRows(e,t,s){for(let i=0,r=t?.length??0;i<r;++i){const a=t[i],o=this.upsertPath(this.getDataPath(e,a));o&&this.addOrUpdateRow(o,a,s)}}removeRows(e){for(let t=0,s=e?.length??0;t<s;++t){const i=e[t],r=i.treeNode;r!==null&&this.removeRow(r,i)}}getDataPath({getDataPath:e},{data:t}){const s=e?.(t)||K;return s.length||zc("getDataPath() should not return an empty path",[t]),s}upsertPath(e){let t=this.root;const s=e.length-1;for(let i=0;i<=s;++i){const r=t.upsertKey(e[i]);if(i>=s)return r.invalidate(),r;t=r}return null}addOrUpdateRow(e,t,s){const{level:i,row:r}=e;if(i<0)return;let a=!1;if(r!==t){const o=t.treeNode;o!==null&&o!==e&&(o.removeRow(t),o.invalidate()),r===null?(e.setRow(t),a=!0):r.data?e.addDuplicateRow(t)&&(a=!0):(e.setRow(t),this.destroyRow(r,!0),a=!0)}s&&!qc(t)&&($P(t),a=!0),a&&e.invalidate(),this.rowsPendingDestruction?.delete(t)}removeRow(e,t){const{parent:s,level:i}=e;if(i<0)return;let r=!1;e.removeRow(t)&&(r=!0,s&&(s.childrenChanged=!0),this.destroyRow(t,!t.data)),r&&e.invalidate()}commitTree(e){const t=this.root;this.commitInvalidatedChildren(e,t);const s=t.row;t.childrenChanged&&t.updateChildrenAfterGroup()&&Ue(s),s.updateHasChildren(),Xc(s)&&e.changedPath?.isActive()&&e.changedPath.addParentNode(s),Jc(s),this.commitDestroyedRows()}commitInvalidatedChildren(e,t){for(;;){const s=t.dequeueInvalidated();if(s===null)break;s.parent===t&&this.commitChild(e,t,s)}}commitChild(e,t,s){if(s.isEmptyFillerNode()){this.clearTree(s);return}this.commitNodePreOrder(t,s),this.commitInvalidatedChildren(e,s),this.commitNodePostOrder(e,t,s)}commitNodePreOrder(e,t){let s=t.row;if(s===null?(s=this.createFillerRow(t),t.setRow(s)):(s=t.sortFirstDuplicateRow(),s.allChildrenCount===void 0&&(s.allChildrenCount=null)),s.parent=e.row,t.oldRow!==s)for(const r of t.enumChildren()){const a=r.row;a!==null&&(a.parent=s)}const i=t.key;s.key!==i?(s.key=i,jP(s),this.setGroupData(s,i)):s.groupData||this.setGroupData(s,i)}commitNodePostOrder(e,t,s){const i=s.row,r=s.oldRow;if(s.isEmptyFillerNode()){this.clearTree(s);return}s.childrenChanged&&s.updateChildrenAfterGroup()&&Ue(i),s.leafChildrenChanged&&s.updateAllLeafChildren();const a=s.getRowPosition();s.oldSourceRowIndex!==a&&(s.oldSourceRowIndex=a,t.childrenChanged=!0);const o=!!i.childrenAfterGroup?.length,n=o||!i.data,l=i.group;l!==n?(Ue(i),i.setGroup(n),!n&&!i.expanded&&Zc(i,!1)):i.hasChildren()!==o&&(Ue(i),i.updateHasChildren()),i.group&&!Yc(i)&&(r!==i&&r!==null&&r.group&&Yc(r)&&!e.isGroupOpenByDefault?i.expanded=r.expanded:i.expanded=this.getExpandedInitialValue(e,i),Zc(i,!0)),qc(i)&&(Ue(t.row),KP(i)&&i.setData(i.data)),r!==i&&(s.oldRow=i,r!==null&&(l||s.hasChildren())&&Ue(i),t.childrenChanged=!0,Ue(t.row)),Xc(i)?e.changedPath?.isActive()&&e.changedPath.addParentNode(i):jc(i)||(i.childrenAfterFilter||(i.childrenAfterFilter=i.childrenAfterGroup.slice()),i.childrenAfterAggFilter||(i.childrenAfterAggFilter=i.childrenAfterFilter.slice()),i.childrenAfterSort||(i.childrenAfterSort=i.childrenAfterAggFilter.slice())),Jc(i),s.duplicateRows?.size&&!s.duplicateRowsWarned&&(s.duplicateRowsWarned=!0,zc("duplicate group keys for row data, keys should be unique",[i.id,i.data,...Array.from(s.duplicateRows).map(c=>c.data)]))}createFillerRow(e){const t=new Wc(this.beans);t.key=e.key,t.group=!0,t.field=null,t.leafGroup=!1,t.rowGroupIndex=null,t.allChildrenCount=null;let s=e.level+"-"+e.key,i=e.parent;for(;i!==null;){const r=i.parent;if(r===null)break;s=`${i.level}-${i.key}-${s}`,i=r}return t.id=Wc.ID_PREFIX_ROW_GROUP+s,t}setGroupData(e,t){const s={};e.groupData=s;const i=this.showRowGroupColsService?.getShowRowGroupCols();if(i)for(const r of i)s[r.getColId()]=t}getExpandedInitialValue(e,t){const s=e.isGroupOpenByDefault;return s?s({rowNode:t,field:t.field,key:t.key,level:t.level,rowGroupColumn:t.rowGroupColumn})==!0:e.expandByDefault===-1||t.level<e.expandByDefault}clearTree(e){const{parent:t,oldRow:s,row:i,level:r}=e;if(t!==null&&s!==null&&(t.childrenChanged=!0,t.row!==null&&Ue(t.row)),i!==null&&r>=0){let a=e.row;for(;a!==null&&e.removeRow(a);)this.destroyRow(a,!a.data),a=e.row}for(const a of e.enumChildren())this.clearTree(a);e.destroy()}destroyTree(e){const{row:t,level:s,duplicateRows:i}=e;if(t&&(s>=0&&!t.data?this.destroyRow(t,!0):is(t)),i)for(const r of i)s>=0&&!r.data?this.destroyRow(r,!0):is(r);for(const r of e.enumChildren())this.destroyTree(r);e.destroy()}destroyRow(e,t){if(!jc(e)){is(e);return}if(!t){(this.rowsPendingDestruction??(this.rowsPendingDestruction=new Set)).add(e);return}is(e),e.setRowIndex(null),e.setRowTop(null),!e.data&&e.isSelected()&&e.setSelectedParams({newValue:!1,source:"rowGroupChanged"})}commitDestroyedRows(){const{rowsPendingDestruction:e}=this;if(e!==null){this.rowsPendingDestruction=null;for(const t of e)this.destroyRow(t,!0)}}},qP=class extends cP{constructor(){super(...arguments),this.beanName="groupStage"}wireBeans(e){this.selectableService=e.selectableService}execute(e){const t=this.gos.get("treeData")?YP:UP;let s=this.strategy;s?.constructor!==t&&(this.destroyBean(s),s=this.createManagedBean(new t),this.strategy=s),s.execute(e),this.selectableService.updateSelectableAfterGrouping()}destroy(){this.destroyBean(this.strategy),this.strategy=void 0,super.destroy()}},Qc="PivotRowTotal_",XP=class extends gP{constructor(){super(...arguments),this.beanName="pivotColDefService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.columnNameService=e.columnNameService}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(a,o=[]){return a.forEach(n=>{n.children!==void 0?s(n.children,o):o.push(n)}),o}const i=s(t);this.addRowGroupTotals(t,i),this.addExpandablePivotGroups(t,i),this.addPivotTotalsToGroups(t,i);const r=i.map(a=>mP(a));return{pivotColumnGroupDefs:t,pivotColumnDefs:r}}createPivotColumnsFromUniqueValues(e){const t=this.funcColsService.getPivotColumns(),s=t.length;return this.recursivelyBuildGroup(0,e,[],s,t)}recursivelyBuildGroup(e,t,s,i,r){const a=this.funcColsService.getValueColumns();if(e>=i)return this.buildMeasureCols(s);const o=r[e].getColDef(),n=this.headerNameComparator.bind(this,o.pivotComparator);if(a.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&e===i-1){const c=[];return Kc(t,h=>{const d=[...s,h],u=this.createColDef(a[0],h,d);u.columnGroupShow="open",c.push(u)}),c.sort(n),c}const l=[];return Kc(t,(c,h)=>{const d=this.pivotDefaultExpanded===-1||e<this.pivotDefaultExpanded,u=[...s,c];l.push({children:this.recursivelyBuildGroup(e+1,h,u,i,r),headerName:c,pivotKeys:u,columnGroupShow:"open",openByDefault:d,groupId:this.generateColumnGroupId(u)})}),l.sort(n),l}buildMeasureCols(e){const t=this.funcColsService.getValueColumns();return t.length===0?[this.createColDef(null,"-",e)]:t.map(s=>{const i=this.columnNameService.getDisplayNameForColumn(s,"header");return{...this.createColDef(s,i,e),columnGroupShow:"open"}})}addExpandablePivotGroups(e,t){const s=this.gos.get("suppressExpandablePivotGroups");if(s||this.gos.get("pivotColumnGroupTotals"))return;const i=(r,a,o)=>{if("children"in r){const c=new Map;r.children.forEach(d=>{i(d,a,c)});const h=!r.children.some(d=>d.children);this.funcColsService.getValueColumns().forEach(d=>{const u=this.columnNameService.getDisplayNameForColumn(d,"header"),p=this.createColDef(d,u,r.pivotKeys);p.pivotTotalColumnIds=c.get(d.getColId()),p.columnGroupShow=s?"open":"closed",p.aggFunc=d.getAggFunc(),h||(r.children.push(p),a.push(p))}),this.merge(o,c);return}if(!r.pivotValueColumn)return;const n=r.pivotValueColumn.getColId();o.has(n)?o.get(n).push(r.colId):o.set(n,[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.funcColsService.getValueColumns(),r=i.map(o=>o.getAggFunc());if(!r||r.length<1||!this.sameAggFuncs(r))return;const a=i[0];e.forEach(o=>{this.recursivelyAddPivotTotal(o,t,a,s)})}recursivelyAddPivotTotal(e,t,s,i){const r=e;if(!r.children){const o=e;return o.colId?[o.colId]:null}let a=[];if(r.children.forEach(o=>{const n=this.recursivelyAddPivotTotal(o,t,s,i);n&&(a=a.concat(n))}),r.children.length>1){const n=this.localeService.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),l=this.createColDef(s,n,e.pivotKeys,!0);l.pivotTotalColumnIds=a,l.aggFunc=s.getAggFunc(),l.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;const c=e.children;i?c.push(l):c.unshift(l),t.push(l)}return a}addRowGroupTotals(e,t){if(!this.gos.get("pivotRowTotals"))return;const s=this.gos.get("pivotRowTotals")==="after",r=this.funcColsService.getValueColumns().slice();s||r.reverse();const a=r.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let o=0;o<r.length;o++){const n=r[o],l=this.columnNameService.getDisplayNameForColumn(n,"header"),c=this.createColDef(n,l,[]),h=[];for(let u=0;u<t.length;u++){const p=t[u];p.pivotValueColumn===n&&h.push(p.colId)}c.pivotTotalColumnIds=h,c.colId=Qc+c.colId;const d=a?{children:[c],pivotKeys:[],groupId:`${Qc}_pivotGroup_${n.getColId()}`}:c;t.push(c),s?e.push(d):e.unshift(d)}}createColDef(e,t,s,i=!1){const r={};if(e){const a=e.getColDef();Object.assign(r,a),r.hide=!1}return r.headerName=t,r.colId=this.generateColumnId(s||[],e&&!i?e.getColId():""),r.field=r.colId,r.valueGetter=a=>a.data?.[a.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}headerNameComparator(e,t,s){return e?e(t.headerName,s.headerName):t.headerName&&!s.headerName?1:!t.headerName&&s.headerName?-1:!t.headerName||!s.headerName?0:t.headerName<s.headerName?-1:t.headerName>s.headerName?1:0}merge(e,t){t.forEach((s,i)=>{const a=[...e.has(i)?e.get(i):[],...s];e.set(i,a)})}generateColumnGroupId(e){return`pivotGroup_${this.funcColsService.getPivotColumns().map(s=>s.getColId()).join("-")}_${e.join("-")}`}generateColumnId(e,t){return`pivot_${this.funcColsService.getPivotColumns().map(i=>i.getColId()).join("-")}_${e.join("-")}_${t}`}createColDefsFromFields(e){const t={};for(let r=0;r<e.length;r++){const o=e[r].split(this.fieldSeparator);let n=t;for(let l=0;l<o.length;l++){const c=o[l];n[c]==null&&(n[c]={}),n=n[c]}}const s=(r,a,o,n)=>{const l=[];for(const d in o){const u=o[d],p=s(`${r}${this.fieldSeparator}${d}`,d,u,n+1);l.push(p)}if(l.length===0){const d=this.columnModel.getColDefCol(a);if(d){const p=this.columnNameService.getDisplayNameForColumn(d,"header")??a,g=this.createColDef(d,p,void 0,!1);return g.colId=r,g.aggFunc=d.getAggFunc(),g.valueGetter=m=>m.data?.[r],g}return{colId:r,headerName:a,valueGetter:p=>p.data?.[r]}}return this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&l.length===1&&"colId"in l[0]?(l[0].headerName=a,l[0]):{openByDefault:this.pivotDefaultExpanded===-1||n<this.pivotDefaultExpanded,groupId:r,headerName:a,children:l}},i=[];for(const r in t){const a=t[r],o=s(r,r,a,0);i.push(o)}return i}},eh="Exceeded maximum allowed pivot column count.",ZP=class extends fP{constructor(){super(...arguments),this.beanName="pivotStage",this.uniqueValues={},this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans(e){this.valueService=e.valueService,this.columnModel=e.columnModel,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.pivotColDefService=e.pivotColDefService}execute(e){const t=e.changedPath;this.columnModel.isPivotActive()?this.executePivotOn(t):this.executePivotOff(t)}executePivotOff(e){this.aggregationColumnsHashLastTime=null,this.uniqueValues={},this.pivotResultColsService.isPivotResultColsPresent()&&(this.pivotResultColsService.setPivotResultCols(null,"rowModelUpdated"),e&&e.setInactive())}executePivotOn(e){const t=this.funcColsService.getValueColumns().length??1,s=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=s===-1?-1:s/t;let i;try{i=this.bucketUpRowNodes(e)}catch(f){if(f.message===eh){this.pivotResultColsService.setPivotResultCols([],"rowModelUpdated"),this.eventService.dispatchEvent({type:"pivotMaxColumnsExceeded",message:f.message}),this.lastTimeFailed=!0;return}throw f}const r=this.setUniqueValues(i),a=this.funcColsService.getValueColumns(),o=a.map(f=>`${f.getId()}-${f.getColDef().headerName}`).join("#"),n=a.map(f=>f.getAggFunc().toString()).join("#"),l=this.aggregationColumnsHashLastTime!==o,c=this.aggregationFuncsHashLastTime!==n;this.aggregationColumnsHashLastTime=o,this.aggregationFuncsHashLastTime=n;const h=this.funcColsService.getRowGroupColumns().map(f=>f.getId()).join("#"),d=h!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=h;const u=this.gos.get("pivotRowTotals"),p=this.gos.get("pivotColumnGroupTotals"),g=this.gos.get("suppressExpandablePivotGroups"),m=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),C=u!==this.pivotRowTotalsLastTime||p!==this.pivotColumnGroupTotalsLastTime||g!==this.suppressExpandablePivotGroupsLastTime||m!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=u,this.pivotColumnGroupTotalsLastTime=p,this.suppressExpandablePivotGroupsLastTime=g,this.removePivotHeaderRowWhenSingleValueColumnLastTime=m,this.lastTimeFailed||r||l||d||c||C){const{pivotColumnGroupDefs:f,pivotColumnDefs:v}=this.pivotColDefService.createPivotColumnDefs(this.uniqueValues);this.pivotColumnDefs=v,this.pivotResultColsService.setPivotResultCols(f,"rowModelUpdated"),e&&e.setInactive()}this.lastTimeFailed=!1}setUniqueValues(e){const t=JSON.stringify(e),s=JSON.stringify(this.uniqueValues);return t!==s?(this.uniqueValues=e,!0):!1}bucketUpRowNodes(e){this.currentUniqueCount=0;const t={};e.forEachChangedNodeDepthFirst(i=>{i.leafGroup&&(i.childrenMapped=null)});const s=i=>{i.leafGroup?this.bucketRowNode(i,t):i.childrenAfterFilter?.forEach(s)};return e.executeFromRootNode(s),t}bucketRowNode(e,t){const s=this.funcColsService.getPivotColumns();s.length===0?e.childrenMapped=null:e.childrenMapped=this.bucketChildren(e.childrenAfterFilter,s,0,t),e.sibling&&(e.sibling.childrenMapped=e.childrenMapped)}bucketChildren(e,t,s,i){const r={},a=t[s];if(e.forEach(o=>{let n=this.valueService.getKeyForNode(a,o);if(vP(n)&&(n=""),!i[n]){this.currentUniqueCount+=1,i[n]={};const l=this.maxUniqueValues!==-1,c=this.currentUniqueCount>this.maxUniqueValues;if(l&&c)throw Error(eh)}r[n]||(r[n]=[]),r[n].push(o)}),s===t.length-1)return r;{const o={};return CP(r,(n,l)=>{o[n]=this.bucketChildren(l,t,s+1,i[n])}),o}}getPivotColumnDefs(){return this.pivotColumnDefs}};function JP(e,t,s){e.aggFuncService&&e.aggFuncService.addAggFuncs({key:s})}function QP(e,t){e.aggFuncService&&e.aggFuncService.addAggFuncs(t)}function eT(e){e.aggFuncService&&e.aggFuncService.clear()}function tT(e,t,s){e.funcColsService.setColumnAggFunc(t,s,"api")}function sT(e){return e.columnModel.isPivotMode()}function iT(e,t,s){return e.pivotResultColsService.lookupPivotResultCol(t,s)}function rT(e,t){e.funcColsService.setValueColumns(t,"api")}function aT(e){return e.funcColsService.getValueColumns()}function oT(e,t){e.funcColsService.removeValueColumns([t],"api")}function nT(e,t){e.funcColsService.removeValueColumns(t,"api")}function lT(e,t){e.funcColsService.addValueColumns([t],"api")}function cT(e,t){e.funcColsService.addValueColumns(t,"api")}function hT(e,t){e.funcColsService.setRowGroupColumns(t,"api")}function dT(e,t){e.funcColsService.removeRowGroupColumns([t],"api")}function uT(e,t){e.funcColsService.removeRowGroupColumns(t,"api")}function pT(e,t){e.funcColsService.addRowGroupColumns([t],"api")}function gT(e,t){e.funcColsService.addRowGroupColumns(t,"api")}function mT(e,t,s){e.funcColsService.moveRowGroupColumn(t,s,"api")}function fT(e){return e.funcColsService.getRowGroupColumns()}function CT(e,t){e.funcColsService.setPivotColumns(t,"api")}function vT(e,t){e.funcColsService.removePivotColumns([t],"api")}function ST(e,t){e.funcColsService.removePivotColumns(t,"api")}function yT(e,t){e.funcColsService.addPivotColumns([t],"api")}function wT(e,t){e.funcColsService.addPivotColumns(t,"api")}function xT(e){return e.funcColsService.getPivotColumns()}function bT(e,t){e.pivotResultColsService.setPivotResultCols(t,"api")}function PT(e){const t=e.pivotResultColsService.getPivotResultCols();return t?t.list:null}var TT=class extends SP{constructor(){super(...arguments),this.beanName="showRowGroupColsService"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}refresh(){this.showRowGroupCols=[],this.showRowGroupColsMap={},this.columnModel.getCols().forEach(e=>{const s=e.getColDef().showRowGroup,i=typeof s=="string";!i&&!(s===!0)||(this.showRowGroupCols.push(e),i?this.showRowGroupColsMap[s]=e:this.funcColsService.getRowGroupColumns().forEach(o=>{this.showRowGroupColsMap[o.getId()]=e}))})}getShowRowGroupCols(){return this.showRowGroupCols}getShowRowGroupCol(e){return this.showRowGroupColsMap[e]}},rs="32.3.3",pa=Qt({version:rs,moduleName:`${aa.RowGroupingModule}-core`,beans:[EP,BP,qP,XP,ZP,xP,IP,TT,OP],userComponents:[{name:"agGroupRowRenderer",classImp:ht},{name:"agGroupCellRenderer",classImp:ht}],controllers:[{name:"groupCellRendererCtrl",classImp:Lt}],dependantModules:[H]}),MT=Qt({version:rs,moduleName:`${aa.RowGroupingModule}-api`,apiFunctions:{addAggFunc:JP,addAggFuncs:QP,clearAggFuncs:eT,setColumnAggFunc:tT,isPivotMode:sT,getPivotResultColumn:iT,setValueColumns:rT,getValueColumns:aT,removeValueColumn:oT,removeValueColumns:nT,addValueColumn:lT,addValueColumns:cT,setRowGroupColumns:hT,removeRowGroupColumn:dT,removeRowGroupColumns:uT,addRowGroupColumn:pT,addRowGroupColumns:gT,getRowGroupColumns:fT,moveRowGroupColumn:mT,setPivotColumns:CT,removePivotColumn:vT,removePivotColumns:ST,addPivotColumn:yT,addPivotColumns:wT,getPivotColumns:xT,setPivotResultColumns:bT,getPivotResultColumns:PT},dependantModules:[pa]}),th=Qt({version:rs,moduleName:"@ag-grid-enterprise/group-filter",userComponents:[{name:"agGroupColumnFilter",classImp:NP}],dependantModules:[pa,Tb]}),FT=Qt({version:rs,moduleName:"@ag-grid-enterprise/group-floating-filter",userComponents:[{name:"agGroupColumnFloatingFilter",classImp:VP}],dependantModules:[th,Mb]}),gi=Qt({version:rs,moduleName:aa.RowGroupingModule,dependantModules:[pa,MT,th,FT]}),mi=class extends da{constructor(e){super(e,"aggregation")}postConstruct(){const e=this.localeService.getLocaleTextFunc(),t=e("valueColumnsEmptyMessage","Drag here to aggregate"),s=e("values","Values");super.init({icon:yP("valuePanel",this.gos,null),emptyMessage:t,title:s}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.localeService.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getTooltipParams(){const e=super.getTooltipParams();return e.location="valueColumnsList",e}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable(e,t){return this.gos.get("functionsReadOnly")||!e.isPrimary()?!1:e.isAllowValue()&&(!e.isValueActive()||this.isSourceEventFromTarget(t))}updateItems(e){this.funcColsService.setValueColumns(e,"toolPanelUi")}getExistingItems(){return this.funcColsService.getValueColumns()}};import{ModuleNames as ga,_defineModule as ma}from"ag-grid-community";import{AgProvidedColumnGroup as AT,BeanStub as RT,_warnOnce as ET,isProvidedColumnGroup as IT}from"ag-grid-community";import{_includes as sh,_last as DT}from"ag-grid-community";function ft(e){return!!e&&typeof e.children<"u"}function He(e){return ft(e)?e.groupId:e.colId}function ih(e,t,s){const i=(o,n)=>{const l=o.children.map(He),c=sh(l,He(n)),h=DT(o.children),d=h&&He(h)!==He(n);return c&&d};if(!ft(e))return!0;const r=e,a=s;if(i(r,a))return r.children.push(a),!0;if(r.groupId===t){const o=r.children.map(He);if(!sh(o,He(a)))return r.children.push(a),!0}for(let o=r.children.length-1;o>=0&&!ih(r.children[o],t,s);o--);return!1}function LT(e){const t=(r,a)=>ft(r)&&ft(a)&&He(r)===He(a),s=(r,a)=>{if(!ft(a))return r;const o=r,n=a;return n.children&&n.groupId&&ih(o,n.groupId,n.children[0])||n.children.forEach(l=>s(o,l)),o},i=[];for(let r=1;r<=e.length;r++){const a=e[r-1],o=e[r];t(a,o)?e[r]=s(a,o):i.push(a)}return i}var fa=class extends RT{constructor(){super(...arguments),this.beanName="toolPanelColDefService"}wireBeans(e){this.columnModel=e.columnModel}createColumnTree(e){const t=[],s=(r,a)=>{if(ft(r)){const o=r,n=typeof o.groupId<"u"?o.groupId:o.headerName,l=new AT(o,n,!1,a),c=[];return o.children.forEach(h=>{const d=s(h,a+1);d&&c.push(d)}),l.setChildren(c),l}else{const o=r,n=o.colId?o.colId:o.field,l=this.columnModel.getColDefCol(n);return l||t.push(o),l}},i=[];return e.forEach(r=>{const a=s(r,0);a&&i.push(a)}),t.length>0&&ET("unable to find grid columns for the supplied colDef(s):",t),i}syncLayoutWithGrid(e){const t=this.getLeafPathTrees(),s=LT(t);e(s)}getLeafPathTrees(){const e=(i,r)=>{let a;if(IT(i))if(i.isPadding())a=r;else{const n=Object.assign({},i.getColGroupDef());n.groupId=i.getGroupId(),n.children=[r],a=n}else{const n=Object.assign({},i.getColDef());n.colId=i.getColId(),a=n}const o=i.getOriginalParent();return o?e(o,a):a};return this.columnModel.getCols().filter(i=>{const r=i.getColDef();return i.isPrimary()&&!r.showRowGroup}).map(i=>e(i,i.getColDef()))}};import{_unwrapUserComp as kT}from"ag-grid-community";function GT(e){return e.sideBarService?.getSideBarComp().isDisplayed()??!1}function OT(e,t){e.sideBarService?.getSideBarComp().setDisplayed(t)}function BT(e,t){e.sideBarService?.getSideBarComp().setSideBarPosition(t)}function NT(e,t){e.sideBarService?.getSideBarComp().openToolPanel(t,"api")}function VT(e){e.sideBarService?.getSideBarComp().close("api")}function _T(e){return e.sideBarService?.getSideBarComp().openedItem()??null}function UT(e){e.sideBarService?.getSideBarComp().refresh()}function HT(e){return e.sideBarService?.getSideBarComp().isToolPanelShowing()??!1}function zT(e,t){const s=e.sideBarService?.getSideBarComp().getToolPanelInstance(t);return kT(s)}function WT(e){return e.sideBarService?.getSideBarComp().getDef()}import{BeanStub as KT}from"ag-grid-community";import{Component as $T,KeyCode as fi,ManagedFocusFeature as jT,ModuleNames as rh,RefPlaceholder as YT,_addFocusableContainerListener as qT,_getActiveDomElement as ah,_removeFromParent as oh,_setAriaControls as XT,_warnOnce as Ca}from"ag-grid-community";import{Component as ZT,KeyCode as JT,_clearElement as QT,_stopPropagationForAgGrid as eM}from"ag-grid-community";import{Component as tM,RefPlaceholder as va,_createIconNoSpan as sM,_setAriaExpanded as iM}from"ag-grid-community";var rM=class extends tM{constructor(e){super(),this.eToggleButton=va,this.eIconWrapper=va,this.eLabel=va,this.toolPanelDef=e}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){const e=this.createTemplate();this.setTemplate(e,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}createTemplate(){return`<div class="ag-side-button" role="presentation">
347
347
  <button type="button" data-ref="eToggleButton" tabindex="-1" role="tab" aria-expanded="false" class="ag-button ag-side-button-button">
348
348
  <div data-ref="eIconWrapper" class="ag-side-button-icon-wrapper" aria-hidden="true"></div>
349
349
  <span data-ref="eLabel" class="ag-side-button-label"></span>
350
350
  </button>
351
351
  </div>`}setLabel(){const e=this.localeService.getLocaleTextFunc(),t=this.toolPanelDef,s=e(t.labelKey,t.labelDefault);this.eLabel.innerText=s}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",sM(this.toolPanelDef.iconKey,this.gos))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected(e){this.addOrRemoveCssClass("ag-selected",e),iM(this.eToggleButton,e)}getButtonElement(){return this.eToggleButton}},aM=class extends ZT{constructor(){super('<div class="ag-side-buttons" role="tablist"></div>'),this.buttonComps=[]}wireBeans(e){this.focusService=e.focusService,this.visibleColsService=e.visibleColsService}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown(e){if(!(e.key!==JT.TAB||!e.shiftKey)){if(this.focusService.focusNextGridCoreContainer(!0)){e.preventDefault();return}eM(e)}}setActiveButton(e){this.buttonComps.forEach(t=>{t.setSelected(e===t.getToolPanelId())})}addButtonComp(e){const t=this.createBean(new rM(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),QT(this.getGui()),super.destroy()}destroy(){this.clearButtons(),super.destroy()}},oM={selector:"AG-SIDE-BAR-BUTTONS",component:aM};import{_warnOnce as nM}from"ag-grid-community";var nh={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columns",toolPanel:"agColumnsToolPanel"},lh={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filter",toolPanel:"agFiltersToolPanel"},Sa={columns:nh,filters:lh};function ya(e){if(!e)return;if(e===!0)return{toolPanels:[nh,lh],defaultToolPanel:"columns"};if(typeof e=="string")return ya([e]);if(Array.isArray(e)){const s=[];return e.forEach(i=>{const r=Sa[i];if(!r){ch(i);return}s.push(r)}),s.length===0?void 0:{toolPanels:s,defaultToolPanel:s[0].id}}return{toolPanels:lM(e.toolPanels),defaultToolPanel:e.defaultToolPanel,hiddenByDefault:e.hiddenByDefault,position:e.position}}function ch(e){nM(`the key ${e} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(Sa).join(",")}`)}function lM(e){const t=[];return e&&e.forEach(s=>{let i=null;if(typeof s=="string"){const r=Sa[s];if(!r){ch(s);return}i=r}else i=s;t.push(i)}),t}import{Component as cM,_warnOnce as hM}from"ag-grid-community";import{Component as dM}from"ag-grid-community";var uM=class extends dM{constructor(){super('<div class="ag-tool-panel-horizontal-resize"></div>'),this.minWidth=100,this.maxWidth=null}wireBeans(e){this.horizontalResizeService=e.horizontalResizeService}setElementToResize(e){this.elementToResize=e}postConstruct(){const e=this.horizontalResizeService.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.setInverted(this.gos.get("enableRtl"))}dispatchResizeEvent(e,t,s){this.eventService.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.width=`${i}px`,this.dispatchResizeEvent(!1,t,i)}setInverted(e){this.inverted=e}setMaxWidth(e){this.maxWidth=e}setMinWidth(e){e!=null?this.minWidth=e:this.minWidth=100}},pM=class extends cM{wireBeans(e){this.userComponentFactory=e.userComponentFactory}constructor(){super('<div class="ag-tool-panel-wrapper" role="tabpanel"/>')}postConstruct(){const e=this.getGui(),t=this.resizeBar=this.createManagedBean(new uM);e.setAttribute("id",`ag-${this.getCompId()}`),t.setElementToResize(e),this.appendChild(t)}getToolPanelId(){return this.toolPanelId}setToolPanelDef(e,t){const{id:s,minWidth:i,maxWidth:r,width:a}=e;this.toolPanelId=s,this.width=a;const o=this.userComponentFactory.getToolPanelCompDetails(e,t),n=o.newAgStackInstance();if(this.params=o.params,n==null){hM(`error processing tool panel component ${s}. You need to specify 'toolPanel'`);return}n.then(this.setToolPanelComponent.bind(this)),i!=null&&this.resizeBar.setMinWidth(i),r!=null&&this.resizeBar.setMaxWidth(r)}setToolPanelComponent(e){this.toolPanelCompInstance=e,this.appendChild(e.getGui()),this.addDestroyFunc(()=>{this.destroyBean(e)}),this.width&&(this.getGui().style.width=`${this.width}px`)}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide(e){const t=this.gos.get("enableRtl"),s=e==="left",i=t?s:!s;this.resizeBar.setInverted(i)}refresh(){this.toolPanelCompInstance?.refresh(this.params)}},gM=class extends $T{constructor(){super(`<div class="ag-side-bar ag-unselectable">
352
352
  <ag-side-bar-buttons data-ref="sideBarButtons"></ag-side-bar-buttons>
353
- </div>`,[oM]),this.sideBarButtons=YT,this.toolPanelWrappers=[]}wireBeans(e){this.focusService=e.focusService,this.filterManager=e.filterManager,this.sideBarService=e.sideBarService}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));const{sideBar:e}=this.gos.get("initialState")??{};this.setSideBarDef({sideBarDef:ya(this.gos.get("sideBar")),sideBarState:e}),this.addManagedPropertyListener("sideBar",this.onSideBarUpdated.bind(this)),this.sideBarService.registerSideBarComp(this);const t=this.getFocusableElement();this.createManagedBean(new jT(t,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),qT(this,t,this.focusService)}onTabKeyDown(e){if(e.defaultPrevented)return;const{focusService:t,sideBarButtons:s}=this,i=this.getGui(),r=s.getGui(),a=ah(this.gos),o=i.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),n=e.target;if(!o)return t.focusNextGridCoreContainer(e.shiftKey,!0);if(r.contains(a)){t.focusInto(o,e.shiftKey)&&e.preventDefault();return}if(!e.shiftKey)return;let l=null;o.contains(a)?l=this.focusService.findNextFocusableElement(o,void 0,!0):t.isTargetUnderManagedComponent(o,n)&&e.shiftKey&&(l=this.focusService.findFocusableElementBeforeTabGuard(o,n)),l||(l=r.querySelector(".ag-selected button")),l&&l!==e.target&&(e.preventDefault(),l.focus())}handleKeyDown(e){const t=ah(this.gos);if(!this.sideBarButtons.getGui().contains(t))return;const s=this.sideBarButtons.getGui(),i=Array.prototype.slice.call(s.querySelectorAll(".ag-side-button")),r=i.findIndex(n=>n.contains(t));let a=null;switch(e.key){case fi.LEFT:case fi.UP:a=Math.max(0,r-1);break;case fi.RIGHT:case fi.DOWN:a=Math.min(r+1,i.length-1);break}if(a===null)return;const o=i[a].querySelector("button");o&&(o.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,this.sideBar&&this.sideBar.toolPanels){const i=this.sideBar.toolPanels;if(this.createToolPanelsAndSideButtons(i,t,s),!this.toolPanelWrappers.length)return;const r=t?t.visible:!this.sideBar.hiddenByDefault;if(this.setDisplayed(r),this.setSideBarPosition(t?t.position:this.sideBar.position),r)if(t){const{openToolPanel:a}=t;a&&this.openToolPanel(a,"sideBarInitializing")}else this.openToolPanel(this.sideBar.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",s=t?"right":"left";return this.addOrRemoveCssClass("ag-side-bar-left",t),this.addOrRemoveCssClass("ag-side-bar-right",!t),this.toolPanelWrappers.forEach(i=>{i.setResizerSizerSide(s)}),this.dispatchSideBarUpdated(),this}setDisplayed(e,t){super.setDisplayed(e,t),this.dispatchSideBarUpdated()}getState(){const e={};return this.toolPanelWrappers.forEach(t=>{e[t.getToolPanelId()]=t.getToolPanelInstance()?.getState?.()}),{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){if(e.id==null)return Ca("please review all your toolPanel components, it seems like at least one of them doesn't have an id"),!1;if(e.toolPanel==="agColumnsToolPanel"&&!this.gos.assertModuleRegistered(rh.ColumnsToolPanelModule,"Column Tool Panel"))return!1;if(e.toolPanel==="agFiltersToolPanel"){if(!this.gos.assertModuleRegistered(rh.FiltersToolPanelModule,"Filters Tool Panel"))return!1;if(this.filterManager?.isAdvancedFilterEnabled())return Ca("Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled."),!1}return!0}createToolPanelAndSideButton(e,t,s){if(!this.validateDef(e))return;const i=this.sideBarButtons.addButtonComp(e);let r;s?r=s:(r=this.createBean(new pM),r.setToolPanelDef(e,{initialState:t,onStateUpdated:()=>this.dispatchSideBarUpdated()})),r.setDisplayed(!1);const a=r.getGui();this.appendChild(a),this.toolPanelWrappers.push(r),XT(i.getButtonElement(),a)}refresh(){this.toolPanelWrappers.forEach(e=>e.refresh())}openToolPanel(e,t="api"){const s=this.openedItem();if(s===e)return;this.toolPanelWrappers.forEach(a=>{const o=e===a.getToolPanelId();a.setDisplayed(o)});const i=this.openedItem();s!==i&&(this.sideBarButtons.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,s??void 0,t))}getToolPanelInstance(e){const t=this.toolPanelWrappers.filter(s=>s.getToolPanelId()===e)[0];if(!t){Ca(`unable to lookup Tool Panel as invalid key supplied: ${e}`);return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,s){const i=!!e&&!!t;t&&this.eventService.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:t,visible:!1,switchingToolPanel:i}),e&&this.eventService.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;return this.toolPanelWrappers.forEach(t=>{t.isDisplayed()&&(e=t.getToolPanelId())}),e}onSideBarUpdated(){const e=ya(this.gos.get("sideBar")),t={};e&&this.sideBar&&e.toolPanels?.forEach(s=>{const{id:i}=s;if(!i)return;const r=this.sideBar.toolPanels?.find(l=>l.id===i);if(!r||s.toolPanel!==r.toolPanel)return;const a=this.toolPanelWrappers.find(l=>l.getToolPanelId()===i);if(!a)return;const o=this.gos.addGridCommonParams({...s.toolPanelParams??{},onStateUpdated:()=>this.dispatchSideBarUpdated()});a.getToolPanelInstance()?.refresh(o)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(l=>l!==a),oh(a.getGui()),t[i]=a)}),this.clearDownUi(),this.setSideBarDef({sideBarDef:e,existingToolPanelWrappers:t})}dispatchSideBarUpdated(){this.eventService.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){this.toolPanelWrappers.forEach(e=>{oh(e.getGui()),this.destroyBean(e)}),this.toolPanelWrappers.length=0}destroy(){this.destroyToolPanelWrappers(),super.destroy()}},mM={selector:"AG-SIDE-BAR",component:gM},fM=class extends KT{constructor(){super(...arguments),this.beanName="sideBarService"}registerSideBarComp(e){this.sideBarComp=e}getSideBarComp(){return this.sideBarComp}getSideBarSelector(){return mM}},wa="32.3.2",hh=ma({version:wa,moduleName:`${ga.SideBarModule}-core`,beans:[fa,fM],dependantModules:[H]}),CM=ma({version:wa,moduleName:`${ga.SideBarModule}-api`,apiFunctions:{isSideBarVisible:GT,setSideBarVisible:OT,setSideBarPosition:BT,openToolPanel:NT,closeToolPanel:VT,getOpenedToolPanel:_T,refreshToolPanel:UT,isToolPanelShowing:HT,getToolPanelInstance:zT,getSideBar:WT},dependantModules:[hh]}),as=ma({version:wa,moduleName:ga.SideBarModule,dependantModules:[hh,CM]});import{Component as vM,ModuleNames as SM,_clearElement as yM,_last as wM}from"ag-grid-community";import{Component as xM,PositionableFeature as bM,RefPlaceholder as dh}from"ag-grid-community";import{AgCheckboxSelector as PM,AgInputTextFieldSelector as TM,Component as MM,KeyCode as uh,RefPlaceholder as xa,_createIconNoSpan as ba,_debounce as FM,_setDisplayed as Ct}from"ag-grid-community";import{Component as AM,_exists as ph,_includes as RM,_setAriaLabel as EM,_setAriaLevel as IM,_warnOnce as DM,isProvidedColumnGroup as LM}from"ag-grid-community";import{LocalEventService as kM}from"ag-grid-community";import{BeanStub as GM,DragSourceType as OM,isProvidedColumnGroup as BM}from"ag-grid-community";import{AgCheckboxSelector as NM,Component as VM,DragSourceType as _M,KeyCode as Pa,RefPlaceholder as os,TouchListener as UM,_createIcon as gh,_createIconNoSpan as HM,_getToolPanelClassesFromColDef as zM,_setAriaDescribedBy as WM,_setAriaExpanded as KM,_setAriaLabel as $M,_setDisplayed as Ta}from"ag-grid-community";import{Component as jM,_createIconNoSpan as mh,isColumn as YM,isProvidedColumnGroup as qM}from"ag-grid-community";import{AgCheckboxSelector as XM,Component as ZM,DragSourceType as JM,KeyCode as QM,RefPlaceholder as fh,_createIconNoSpan as eF,_escapeString as tF,_getToolPanelClassesFromColDef as sF,_setAriaDescribedBy as iF,_setAriaLabel as rF,_setDisplayed as aF,_warnOnce as oF}from"ag-grid-community";import{AgToggleButtonSelector as nF,Component as lF,RefPlaceholder as cF}from"ag-grid-community";import{BeanStub as hF}from"ag-grid-community";var Ch=300,dF=class extends MM{constructor(){super(`<div class="ag-column-select-header" role="presentation">
353
+ </div>`,[oM]),this.sideBarButtons=YT,this.toolPanelWrappers=[]}wireBeans(e){this.focusService=e.focusService,this.filterManager=e.filterManager,this.sideBarService=e.sideBarService}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));const{sideBar:e}=this.gos.get("initialState")??{};this.setSideBarDef({sideBarDef:ya(this.gos.get("sideBar")),sideBarState:e}),this.addManagedPropertyListener("sideBar",this.onSideBarUpdated.bind(this)),this.sideBarService.registerSideBarComp(this);const t=this.getFocusableElement();this.createManagedBean(new jT(t,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),qT(this,t,this.focusService)}onTabKeyDown(e){if(e.defaultPrevented)return;const{focusService:t,sideBarButtons:s}=this,i=this.getGui(),r=s.getGui(),a=ah(this.gos),o=i.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),n=e.target;if(!o)return t.focusNextGridCoreContainer(e.shiftKey,!0);if(r.contains(a)){t.focusInto(o,e.shiftKey)&&e.preventDefault();return}if(!e.shiftKey)return;let l=null;o.contains(a)?l=this.focusService.findNextFocusableElement(o,void 0,!0):t.isTargetUnderManagedComponent(o,n)&&e.shiftKey&&(l=this.focusService.findFocusableElementBeforeTabGuard(o,n)),l||(l=r.querySelector(".ag-selected button")),l&&l!==e.target&&(e.preventDefault(),l.focus())}handleKeyDown(e){const t=ah(this.gos);if(!this.sideBarButtons.getGui().contains(t))return;const s=this.sideBarButtons.getGui(),i=Array.prototype.slice.call(s.querySelectorAll(".ag-side-button")),r=i.findIndex(n=>n.contains(t));let a=null;switch(e.key){case fi.LEFT:case fi.UP:a=Math.max(0,r-1);break;case fi.RIGHT:case fi.DOWN:a=Math.min(r+1,i.length-1);break}if(a===null)return;const o=i[a].querySelector("button");o&&(o.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,this.sideBar&&this.sideBar.toolPanels){const i=this.sideBar.toolPanels;if(this.createToolPanelsAndSideButtons(i,t,s),!this.toolPanelWrappers.length)return;const r=t?t.visible:!this.sideBar.hiddenByDefault;if(this.setDisplayed(r),this.setSideBarPosition(t?t.position:this.sideBar.position),r)if(t){const{openToolPanel:a}=t;a&&this.openToolPanel(a,"sideBarInitializing")}else this.openToolPanel(this.sideBar.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition(e){e||(e="right"),this.position=e;const t=e==="left",s=t?"right":"left";return this.addOrRemoveCssClass("ag-side-bar-left",t),this.addOrRemoveCssClass("ag-side-bar-right",!t),this.toolPanelWrappers.forEach(i=>{i.setResizerSizerSide(s)}),this.dispatchSideBarUpdated(),this}setDisplayed(e,t){super.setDisplayed(e,t),this.dispatchSideBarUpdated()}getState(){const e={};return this.toolPanelWrappers.forEach(t=>{e[t.getToolPanelId()]=t.getToolPanelInstance()?.getState?.()}),{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){if(e.id==null)return Ca("please review all your toolPanel components, it seems like at least one of them doesn't have an id"),!1;if(e.toolPanel==="agColumnsToolPanel"&&!this.gos.assertModuleRegistered(rh.ColumnsToolPanelModule,"Column Tool Panel"))return!1;if(e.toolPanel==="agFiltersToolPanel"){if(!this.gos.assertModuleRegistered(rh.FiltersToolPanelModule,"Filters Tool Panel"))return!1;if(this.filterManager?.isAdvancedFilterEnabled())return Ca("Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled."),!1}return!0}createToolPanelAndSideButton(e,t,s){if(!this.validateDef(e))return;const i=this.sideBarButtons.addButtonComp(e);let r;s?r=s:(r=this.createBean(new pM),r.setToolPanelDef(e,{initialState:t,onStateUpdated:()=>this.dispatchSideBarUpdated()})),r.setDisplayed(!1);const a=r.getGui();this.appendChild(a),this.toolPanelWrappers.push(r),XT(i.getButtonElement(),a)}refresh(){this.toolPanelWrappers.forEach(e=>e.refresh())}openToolPanel(e,t="api"){const s=this.openedItem();if(s===e)return;this.toolPanelWrappers.forEach(a=>{const o=e===a.getToolPanelId();a.setDisplayed(o)});const i=this.openedItem();s!==i&&(this.sideBarButtons.setActiveButton(e),this.raiseToolPanelVisibleEvent(e,s??void 0,t))}getToolPanelInstance(e){const t=this.toolPanelWrappers.filter(s=>s.getToolPanelId()===e)[0];if(!t){Ca(`unable to lookup Tool Panel as invalid key supplied: ${e}`);return}return t.getToolPanelInstance()}raiseToolPanelVisibleEvent(e,t,s){const i=!!e&&!!t;t&&this.eventService.dispatchEvent({type:"toolPanelVisibleChanged",source:s,key:t,visible:!1,switchingToolPanel:i}),e&&this.eventService.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;return this.toolPanelWrappers.forEach(t=>{t.isDisplayed()&&(e=t.getToolPanelId())}),e}onSideBarUpdated(){const e=ya(this.gos.get("sideBar")),t={};e&&this.sideBar&&e.toolPanels?.forEach(s=>{const{id:i}=s;if(!i)return;const r=this.sideBar.toolPanels?.find(l=>l.id===i);if(!r||s.toolPanel!==r.toolPanel)return;const a=this.toolPanelWrappers.find(l=>l.getToolPanelId()===i);if(!a)return;const o=this.gos.addGridCommonParams({...s.toolPanelParams??{},onStateUpdated:()=>this.dispatchSideBarUpdated()});a.getToolPanelInstance()?.refresh(o)===!0&&(this.toolPanelWrappers=this.toolPanelWrappers.filter(l=>l!==a),oh(a.getGui()),t[i]=a)}),this.clearDownUi(),this.setSideBarDef({sideBarDef:e,existingToolPanelWrappers:t})}dispatchSideBarUpdated(){this.eventService.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){this.toolPanelWrappers.forEach(e=>{oh(e.getGui()),this.destroyBean(e)}),this.toolPanelWrappers.length=0}destroy(){this.destroyToolPanelWrappers(),super.destroy()}},mM={selector:"AG-SIDE-BAR",component:gM},fM=class extends KT{constructor(){super(...arguments),this.beanName="sideBarService"}registerSideBarComp(e){this.sideBarComp=e}getSideBarComp(){return this.sideBarComp}getSideBarSelector(){return mM}},wa="32.3.3",hh=ma({version:wa,moduleName:`${ga.SideBarModule}-core`,beans:[fa,fM],dependantModules:[H]}),CM=ma({version:wa,moduleName:`${ga.SideBarModule}-api`,apiFunctions:{isSideBarVisible:GT,setSideBarVisible:OT,setSideBarPosition:BT,openToolPanel:NT,closeToolPanel:VT,getOpenedToolPanel:_T,refreshToolPanel:UT,isToolPanelShowing:HT,getToolPanelInstance:zT,getSideBar:WT},dependantModules:[hh]}),as=ma({version:wa,moduleName:ga.SideBarModule,dependantModules:[hh,CM]});import{Component as vM,ModuleNames as SM,_clearElement as yM,_last as wM}from"ag-grid-community";import{Component as xM,PositionableFeature as bM,RefPlaceholder as dh}from"ag-grid-community";import{AgCheckboxSelector as PM,AgInputTextFieldSelector as TM,Component as MM,KeyCode as uh,RefPlaceholder as xa,_createIconNoSpan as ba,_debounce as FM,_setDisplayed as Ct}from"ag-grid-community";import{Component as AM,_exists as ph,_includes as RM,_setAriaLabel as EM,_setAriaLevel as IM,_warnOnce as DM,isProvidedColumnGroup as LM}from"ag-grid-community";import{LocalEventService as kM}from"ag-grid-community";import{BeanStub as GM,DragSourceType as OM,isProvidedColumnGroup as BM}from"ag-grid-community";import{AgCheckboxSelector as NM,Component as VM,DragSourceType as _M,KeyCode as Pa,RefPlaceholder as os,TouchListener as UM,_createIcon as gh,_createIconNoSpan as HM,_getToolPanelClassesFromColDef as zM,_setAriaDescribedBy as WM,_setAriaExpanded as KM,_setAriaLabel as $M,_setDisplayed as Ta}from"ag-grid-community";import{Component as jM,_createIconNoSpan as mh,isColumn as YM,isProvidedColumnGroup as qM}from"ag-grid-community";import{AgCheckboxSelector as XM,Component as ZM,DragSourceType as JM,KeyCode as QM,RefPlaceholder as fh,_createIconNoSpan as eF,_escapeString as tF,_getToolPanelClassesFromColDef as sF,_setAriaDescribedBy as iF,_setAriaLabel as rF,_setDisplayed as aF,_warnOnce as oF}from"ag-grid-community";import{AgToggleButtonSelector as nF,Component as lF,RefPlaceholder as cF}from"ag-grid-community";import{BeanStub as hF}from"ag-grid-community";var Ch=300,dF=class extends MM{constructor(){super(`<div class="ag-column-select-header" role="presentation">
354
354
  <div data-ref="eExpand" class="ag-column-select-header-icon"></div>
355
355
  <ag-checkbox data-ref="eSelect" class="ag-column-select-header-checkbox"></ag-checkbox>
356
356
  <ag-input-text-field class="ag-column-select-header-filter-wrapper" data-ref="eFilterTextField"></ag-input-text-field>
@@ -369,8 +369,8 @@ ${kc("writeText")}`),this.copyDataToClipboardLegacy(t)});return}this.copyDataToC
369
369
  <ag-primary-cols-list data-ref="primaryColsListPanel"></ag-primary-cols-list>
370
370
  </div>`,[uF,vF]),this.primaryColsHeaderPanel=dh,this.primaryColsListPanel=dh}init(e,t,s){this.allowDragging=e,this.params=t,this.eventType=s,this.primaryColsHeaderPanel.init(this.params);const i=this.params.suppressColumnFilter,r=this.params.suppressColumnSelectAll;this.params.suppressColumnExpandAll&&i&&r&&this.primaryColsHeaderPanel.setDisplayed(!1),this.addManagedListeners(this.primaryColsListPanel,{groupExpanded:this.onGroupExpanded.bind(this),selectionChanged:this.onSelectionChange.bind(this)}),this.primaryColsListPanel.init(this.params,this.allowDragging,this.eventType),this.addManagedListeners(this.primaryColsHeaderPanel,{expandAll:this.onExpandAll.bind(this),collapseAll:this.onCollapseAll.bind(this),selectAll:this.onSelectAll.bind(this),unselectAll:this.onUnselectAll.bind(this),filterChanged:this.onFilterChanged.bind(this)}),this.positionableFeature=new bM(this.getGui(),{minHeight:100}),this.createManagedBean(this.positionableFeature)}toggleResizable(e){this.positionableFeature.setResizable(e?{bottom:!0}:!1)}onExpandAll(){this.primaryColsListPanel.doSetExpandedAll(!0)}onCollapseAll(){this.primaryColsListPanel.doSetExpandedAll(!1)}expandGroups(e){this.primaryColsListPanel.setGroupsExpanded(!0,e)}collapseGroups(e){this.primaryColsListPanel.setGroupsExpanded(!1,e)}setColumnLayout(e){this.primaryColsListPanel.setColumnLayout(e)}onFilterChanged(e){this.primaryColsListPanel.setFilterText(e.filterText)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}onSelectAll(){this.primaryColsListPanel.doSetSelectedAll(!0)}onUnselectAll(){this.primaryColsListPanel.doSetSelectedAll(!1)}onGroupExpanded(e){this.primaryColsHeaderPanel.setExpandState(e.state),this.params.onStateUpdated()}onSelectionChange(e){this.primaryColsHeaderPanel.setSelectionState(e.state)}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},wh=class extends lF{constructor(){super(...arguments),this.cbPivotMode=cF}wireBeans(e){this.columnModel=e.columnModel,this.ctrlsService=e.ctrlsService}createTemplate(){return`<div class="ag-pivot-mode-panel">
371
371
  <ag-toggle-button data-ref="cbPivotMode" class="ag-pivot-mode-select"></ag-toggle-button>
372
- </div>`}postConstruct(){this.setTemplate(this.createTemplate(),[nF]),this.cbPivotMode.setValue(this.columnModel.isPivotMode());const e=this.localeService.getLocaleTextFunc();this.cbPivotMode.setLabel(e("pivotMode","Pivot Mode")),this.addManagedListeners(this.cbPivotMode,{fieldValueChanged:this.onBtPivotMode.bind(this)});const t=this.onPivotModeChanged.bind(this);this.addManagedEventListeners({newColumnsLoaded:t,columnPivotModeChanged:t})}onBtPivotMode(){const e=!!this.cbPivotMode.getValue();e!==this.columnModel.isPivotMode()&&(this.gos.updateGridOptions({options:{pivotMode:e},source:"toolPanelUi"}),this.ctrlsService.getHeaderRowContainerCtrls().forEach(t=>t.refresh()))}onPivotModeChanged(){const e=this.columnModel.isPivotMode();this.cbPivotMode.setValue(e)}},SF=class extends vM{constructor(){super('<div class="ag-column-panel"></div>'),this.initialised=!1,this.childDestroyFuncs=[]}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}init(e){const t=this.gos.addGridCommonParams({suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1});if(this.params={...t,...e},this.isRowGroupingModuleLoaded()&&!this.params.suppressPivotMode&&(this.pivotModePanel=this.createBean(new wh),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotModePanel)),this.appendChild(this.pivotModePanel)),this.primaryColsPanel=this.createBean(new Ci),this.childDestroyFuncs.push(()=>this.destroyBean(this.primaryColsPanel)),this.primaryColsPanel.init(!0,this.params,"toolPanelUi"),this.primaryColsPanel.addCssClass("ag-column-panel-column-select"),this.appendChild(this.primaryColsPanel),this.isRowGroupingModuleLoaded()){this.params.suppressRowGroups||(this.rowGroupDropZonePanel=this.createBean(new ss(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.rowGroupDropZonePanel)),this.appendChild(this.rowGroupDropZonePanel)),this.params.suppressValues||(this.valuesDropZonePanel=this.createBean(new mi(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.valuesDropZonePanel)),this.appendChild(this.valuesDropZonePanel)),this.params.suppressPivots||(this.pivotDropZonePanel=this.createBean(new ts(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotDropZonePanel)),this.appendChild(this.pivotDropZonePanel)),this.setLastVisible();const[s]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});this.childDestroyFuncs.push(()=>s())}this.initialised=!0}setPivotModeSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.pivotModePanel?this.pivotModePanel.setDisplayed(e):e&&(this.pivotModePanel=this.createBean(new wh),this.getGui().insertBefore(this.pivotModePanel.getGui(),this.getGui().firstChild),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotModePanel))),this.setLastVisible())}setRowGroupsSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.rowGroupDropZonePanel?this.rowGroupDropZonePanel.setDisplayed(e):e&&(this.rowGroupDropZonePanel=this.createManagedBean(new ss(!1)),this.appendChild(this.rowGroupDropZonePanel)),this.setLastVisible())}setValuesSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.valuesDropZonePanel?this.valuesDropZonePanel.setDisplayed(e):e&&(this.valuesDropZonePanel=this.createManagedBean(new mi(!1)),this.appendChild(this.valuesDropZonePanel)),this.setLastVisible())}setPivotSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.pivotDropZonePanel?this.pivotDropZonePanel.setDisplayed(e):e&&(this.pivotDropZonePanel=this.createManagedBean(new ts(!1)),this.appendChild(this.pivotDropZonePanel),this.pivotDropZonePanel.setDisplayed(e)),this.setLastVisible())}setResizers(){[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel].forEach(e=>{if(!e)return;const t=e.getGui();e.toggleResizable(!t.classList.contains("ag-last-column-drop")&&!t.classList.contains("ag-hidden"))})}setLastVisible(){const e=this.getGui();Array.prototype.slice.call(e.querySelectorAll(".ag-column-drop")).forEach(r=>r.classList.remove("ag-last-column-drop"));const s=e.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),i=wM(s);i&&i.classList.add("ag-last-column-drop"),this.setResizers()}resetChildrenHeight(){const t=this.getGui().children;for(let s=0;s<t.length;s++){const i=t[s];i.style.removeProperty("height"),i.style.removeProperty("flex")}}isRowGroupingModuleLoaded(){return this.gos.assertModuleRegistered(SM.RowGroupingModule,"Row Grouping")}expandColumnGroups(e){this.primaryColsPanel.expandGroups(e)}collapseColumnGroups(e){this.primaryColsPanel.collapseGroups(e)}setColumnLayout(e){this.primaryColsPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsPanel.syncLayoutWithGrid()}destroyChildren(){this.childDestroyFuncs.forEach(e=>e()),this.childDestroyFuncs.length=0,yM(this.getGui())}refresh(e){return this.destroyChildren(),this.init(e),!0}getState(){return{expandedGroupIds:this.primaryColsPanel.getExpandedGroups()}}destroy(){this.destroyChildren(),super.destroy()}},yF=class extends hF{constructor(){super(...arguments),this.beanName="modelItemUtils"}wireBeans(e){this.aggFuncService=e.aggFuncService,this.columnModel=e.columnModel,this.columnApplyStateService=e.columnApplyStateService}selectAllChildren(e,t,s){const i=this.extractAllLeafColumns(e);this.setAllColumns(i,t,s)}setColumn(e,t,s){this.setAllColumns([e],t,s)}setAllColumns(e,t,s){this.columnModel.isPivotMode()?this.setAllPivot(e,t,s):this.setAllVisible(e,t,s)}extractAllLeafColumns(e){const t=[],s=i=>{i.forEach(r=>{r.isPassesFilter()&&(r.isGroup()?s(r.getChildren()):t.push(r.getColumn()))})};return s(e),t}setAllVisible(e,t,s){const i=[];e.forEach(r=>{r.getColDef().lockVisible||r.isVisible()!=t&&i.push({colId:r.getId(),hide:!t})}),i.length>0&&this.columnApplyStateService.applyColumnState({state:i},s)}setAllPivot(e,t,s){this.setAllPivotActive(e,t,s)}setAllPivotActive(e,t,s){const i=[],o=t?n=>{if(!n.isAnyFunctionActive())if(n.isAllowValue()){const l=typeof n.getAggFunc()=="string"?n.getAggFunc():this.aggFuncService?.getDefaultAggFunc(n);i.push({colId:n.getId(),aggFunc:l})}else n.isAllowRowGroup()?i.push({colId:n.getId(),rowGroup:!0}):n.isAllowPivot()&&i.push({colId:n.getId(),pivot:!0})}:n=>{(n.isPivotActive()||n.isRowGroupActive()||n.isValueActive())&&i.push({colId:n.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};e.forEach(o),i.length>0&&this.columnApplyStateService.applyColumnState({state:i},s)}updateColumns(e){const{columns:t,visibleState:s,pivotState:i,eventType:r}=e,a=t.map(o=>{const n=o.getColId();if(this.columnModel.isPivotMode()){const l=i?.[n];return{colId:n,pivot:l?.pivot,rowGroup:l?.rowGroup,aggFunc:l?.aggFunc}}else return{colId:n,hide:!s?.[n]}});this.columnApplyStateService.applyColumnState({state:a},r)}createPivotState(e){return{pivot:e.isPivotActive(),rowGroup:e.isRowGroupActive(),aggFunc:e.isValueActive()?e.getAggFunc():void 0}}},wF="32.3.2",Ma=Pb({version:wF,moduleName:bb.ColumnsToolPanelModule,beans:[yF],userComponents:[{name:"agColumnsToolPanel",classImp:SF},{name:"agMenuItem",classImp:ke}],dependantModules:[H,gi,as]});import{ModuleNames as Fa,_defineModule as Aa}from"ag-grid-community";import{_CsvExportCoreModule as xF}from"ag-grid-community";import{_getHeaderClassesFromColDef as bF,_warnOnce as xh}from"ag-grid-community";import{BaseCreator as PF,Downloader as bh,RowType as Ph,ZipContainer as W}from"ag-grid-community";import{_last as TF,_mergeDeep as MF,_warnOnce as FF}from"ag-grid-community";import{BaseGridSerializingSession as AF,RowType as Ra}from"ag-grid-community";import{_escapeString as RF}from"ag-grid-community";import{XmlFactory as Th}from"ag-grid-community";import{ExcelFactoryMode as Mh,_escapeString as EF,_warnOnce as Ea}from"ag-grid-community";import{_escapeString as IF}from"ag-grid-community";import{_compose as DF,_escapeString as LF,_iterateObject as kF}from"ag-grid-community";import{_escapeString as Fh}from"ag-grid-community";import{ExcelFactoryMode as Ah,_warnOnce as GF}from"ag-grid-community";var OF=9525,Rh={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},BF=e=>Math.round(e*96/72),vt=e=>Math.ceil(e*OF),NF=e=>{if(e===void 0)return;const s=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(e||"Automatic");return Math.max(s,0)},vi=(e,t)=>{if(!t)return;let s;return typeof t=="number"?s=t:s=t({rowIndex:e}),s},VF=(e,t)=>{const{colSpan:s,column:i}=e.position;if(e.width)if(s){const r=t.slice(i-1,i+s-1);let a=0;for(let o=0;o<r.length;o++){const n=r[o].getActualWidth();if(e.width<a+n){e.position.colSpan=o+1,e.totalWidth=e.width,e.width=e.totalWidth-a;break}a+=n}}else e.totalWidth=e.width},_F=(e,t)=>{const{rowSpan:s,row:i}=e.position;if(e.height)if(s){let r=0,a=0;for(let o=i;o<i+s;o++){const n=BF(vi(o,t)||20);if(e.height<r+n){e.position.rowSpan=a+1,e.totalHeight=e.height,e.height=e.totalHeight-r;break}r+=n,a++}}else e.totalHeight=e.height},se=(e,t)=>{const s=Th.createHeader({encoding:"UTF-8",standalone:"yes"}),i=Th.createXml(e);return t?i:`${s}${i}`},St=e=>{const i=String.fromCharCode,r=Math.floor(e/26),a=e%26;return!r||e===26?i(65+e-1):a?r<26?i(65+r-1)+i(65+a-1):St(r)+i(65+a-1):St(r-1)+"Z"},Ia=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},UF=e=>{const t=[];for(const s of e.keys()){const i=s.toString(),r={name:"t",textNode:RF(Ia(i),!1)};i.trim().length!==i.length&&(r.properties={rawMap:{"xml:space":"preserve"}}),t.push({name:"si",children:[r]})}return t},HF={getTemplate(e){const{name:t,ContentType:s,Extension:i,PartName:r}=e;return{name:t,properties:{rawMap:{Extension:i,PartName:r,ContentType:s}}}}},zF=HF,Si=e=>e==="jpg"?"jpeg":e,WF={getTemplate(e){const t=new Array(e).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${d+1}.xml`})),s=E.worksheetImages.size,i=E.worksheetHeaderFooterImages.size,r=E.worksheetDataTables.size,a={};E.workbookImageIds.forEach(h=>{a[Si(h.type)]=!0});const o=new Array(s).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${d+1}.xml`})),n=new Array(r).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${E.getTableNameFromIndex(d)}.xml`})),l=Object.keys(a).map(h=>({name:"Default",ContentType:`image/${h}`,Extension:h}));i&&l.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});const c=[...l,{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"},...t,{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"},...o,...n,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"}].map(h=>zF.getTemplate(h));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:c}}},KF=WF,$F={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}]}}},jF=$F,Eh=(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()}]}),YF=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&&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}},qF=(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:[YF(e)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),Ih=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},XF=(e,t)=>({name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:e.color}},children:Ih(e)},{name:"a:srgbClr",properties:{rawMap:{val:t.color}},children:Ih(t)}]}),ZF=(e,t)=>{let s;if(e.transparency){const i=Math.min(Math.max(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(XF({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"}]}]}},JF=(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 a=e.rotation;s.properties={rawMap:{rot:Math.min(Math.max(a,0),360)*6e4}}}return{name:"xdr:spPr",children:[s,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},QF=e=>{e.fitCell=!!e.fitCell||!e.width||!e.height;const{position:t={},fitCell:s,width:i=0,height:r=0,totalHeight:a,totalWidth:o}=e,{offsetX:n=0,offsetY:l=0,row:c=1,rowSpan:h=1,column:d=1,colSpan:u=1}=t;return{from:{row:c-1,col:d-1,offsetX:vt(n),offsetY:vt(l)},to:{row:c-1+(s?1:h-1),col:d-1+(s?1:u-1),offsetX:vt(i+n),offsetY:vt(r+l)},height:vt(a||r),width:vt(o||i)}},eA=(e,t,s,i)=>({name:"xdr:pic",children:[qF(e,t+1),ZF(e,s+1),JF(e,i)]}),tA={getTemplate(e){const{sheetIndex:t}=e,s=E.worksheetImages.get(t),i=E.worksheetImageIds.get(t),r=s.map((a,o)=>{const n=QF(a);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[Eh("from",n.from),Eh("to",n.to),eA(a,o,i.get(a.id).index,n),{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}}},sA=tA,iA={getTemplate(e){const{Id:t,Type:s,Target:i}=e;return{name:"Relationship",properties:{rawMap:{Id:t,Type:s,Target:i}}}}},rA=iA,aA={getTemplate(e){const t=e.map(s=>rA.getTemplate(s));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:t}}},ns=aA,oA={getTemplate(e){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:e.size,uniqueCount:e.size}},children:UF(e)}}},nA=oA,lA=e=>{switch(e){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},cA={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},hA=["Dashed","DashDot","DashDotDot"],dA={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"},uA={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},pA={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},gA=e=>e?dA[e]||e:"none",ze=e=>e==null?e:(e.charAt(0)==="#"&&(e=e.substring(1)),e.length===6?"FF"+e:e),yi=(e,t)=>{if(!e)return"thin";const s=lA(t);if(e==="Continuous")return s;const i=cA[e];return s==="medium"&&hA.some(r=>r===i)?`medium${i}`:`${i.charAt(0).toLowerCase()}${i.substring(1)}`},mA=e=>uA[e]||"general",fA=e=>pA[e]||void 0,ls=e=>({name:"color",properties:{rawMap:{rgb:ze(e||"#000000")}}}),CA={getTemplate(e){const{left:t,right:s,top:i,bottom:r,diagonal:a}=e,o=t?[ls(t.color)]:void 0,n=s?[ls(s.color)]:void 0,l=i?[ls(i.color)]:void 0,c=r?[ls(r.color)]:void 0,h=a?[ls(a.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:t&&t.style}},children:o},{name:"right",properties:{rawMap:{style:s&&s.style}},children:n},{name:"top",properties:{rawMap:{style:i&&i.style}},children:l},{name:"bottom",properties:{rawMap:{style:r&&r.style}},children:c},{name:"diagonal",properties:{rawMap:{style:a&&a.style}},children:h}]}}},vA=CA,SA={getTemplate(e){return{name:"borders",properties:{rawMap:{count:e.length}},children:e.map(t=>vA.getTemplate(t))}}},yA=SA,wA=e=>{const s=["Context","LeftToRight","RightToLeft"].indexOf(e);return Math.max(s,0)},xA={getTemplate(e){const{horizontal:t,indent:s,readingOrder:i,rotate:r,shrinkToFit:a,vertical:o,wrapText:n}=e;return{name:"alignment",properties:{rawMap:{horizontal:t&&mA(t),indent:s,readingOrder:i&&wA(i),textRotation:r,shrinkToFit:a,vertical:o&&fA(o),wrapText:n}}}}},bA=xA,PA={getTemplate(e){const t=e.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:e.hideFormula===!0?1:0,locked:t}}}}},TA=PA,MA={getTemplate(e){const{alignment:t,borderId:s,fillId:i,fontId:r,numFmtId:a,protection:o,quotePrefix:n,xfId:l}=e,c=[];return t&&c.push(bA.getTemplate(t)),o&&c.push(TA.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:a?1:void 0,numFmtId:a,quotePrefix:n?1:void 0,xfId:l}},children:c.length?c:void 0}}},Dh=MA,FA={getTemplate(e){return{name:"cellStyleXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dh.getTemplate(t))}}},AA=FA,RA={getTemplate(e){const{builtinId:t,name:s,xfId:i}=e;return{name:"cellStyle",properties:{rawMap:{builtinId:t,name:s,xfId:i}}}}},EA=RA,IA={getTemplate(e){return{name:"cellStyles",properties:{rawMap:{count:e.length}},children:e.map(t=>EA.getTemplate(t))}}},DA=IA,LA={getTemplate(e){return{name:"cellXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dh.getTemplate(t))}}},kA=LA,GA={getTemplate(e){const{patternType:t,fgTheme:s,fgTint:i,fgRgb:r,bgRgb:a,bgIndexed:o}=e,n={name:"patternFill",properties:{rawMap:{patternType:t}}};return(s||i||r)&&(n.children=[{name:"fgColor",properties:{rawMap:{theme:s,tint:i,rgb:r}}}]),(o||a)&&(n.children||(n.children=[]),n.children.push({name:"bgColor",properties:{rawMap:{indexed:o,rgb:a}}})),{name:"fill",children:[n]}}},OA=GA,BA={getTemplate(e){return{name:"fills",properties:{rawMap:{count:e.length}},children:e.map(t=>OA.getTemplate(t))}}},NA=BA,VA={getTemplate(e){const{size:t,colorTheme:s,color:i="FF000000",fontName:r="Calibri",family:a,scheme:o,italic:n,bold:l,strikeThrough:c,outline:h,shadow:d,underline:u,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 a&&g.push({name:"family",properties:{rawMap:{val:a}}}),o&&g.push({name:"scheme",properties:{rawMap:{val:o}}}),n&&g.push({name:"i"}),l&&g.push({name:"b"}),c&&g.push({name:"strike"}),h&&g.push({name:"outline"}),d&&g.push({name:"shadow"}),u&&g.push({name:"u",properties:{rawMap:{val:u}}}),p&&g.push({name:"vertAlign",properties:{rawMap:{val:p}}}),{name:"font",children:g}}},_A=VA,UA={getTemplate(e){return{name:"fonts",properties:{rawMap:{count:e.length}},children:e.map(t=>_A.getTemplate(t))}}},HA=UA;function zA(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]=IF(i))}return t.join("")}var WA={getTemplate(e){let{formatCode:t,numFmtId:s}=e;return t.length&&(t=zA(t)),{name:"numFmt",properties:{rawMap:{formatCode:t,numFmtId:s}}}}},KA=WA,$A={getTemplate(e){return{name:"numFmts",properties:{rawMap:{count:e.length}},children:e.map(t=>KA.getTemplate(t))}}},jA=$A,wi,yt,cs,hs,ds,Lh,xi,kh,Da,Gh=(e,t)=>(e.indexOf("mixedStyle")!==-1&&t>1&&(e+=`_${t}`),e),Oh=()=>{wi={base:0},yt=[],cs=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],hs=[{patternType:"none"},{patternType:"gray125"}],ds=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],Lh=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],xi=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],kh=[{builtinId:0,name:"Normal",xfId:0}]},YA=e=>{const t=gA(e.pattern),s=ze(e.color),i=ze(e.patternColor);let r=hs.findIndex(a=>{const{patternType:o,fgRgb:n,bgRgb:l}=a;return!(o!=t||n!=s||l!=i)});return r===-1&&(r=hs.length,hs.push({patternType:t,fgRgb:s,bgRgb:i})),r},qA=e=>{if(Rh[e])return Rh[e];let t=yt.findIndex(s=>s.formatCode===e);return t===-1?(t=yt.length+164,yt.push({formatCode:e,numFmtId:t})):t=yt[t].numFmtId,t},XA=e=>{const{borderBottom:t,borderTop:s,borderLeft:i,borderRight:r}=e;let a,o,n,l,c,h,d,u;i&&(n=yi(i.lineStyle,i.weight),d=ze(i.color)),r&&(l=yi(r.lineStyle,r.weight),u=ze(r.color)),t&&(a=yi(t.lineStyle,t.weight),c=ze(t.color)),s&&(o=yi(s.lineStyle,s.weight),h=ze(s.color));let p=ds.findIndex(g=>{const{left:m,right:C,top:f,bottom:v}=g;if(!m&&(n||d)||!C&&(l||u)||!f&&(o||h)||!v&&(a||c))return!1;const{style:S,color:y}=m||{},{style:w,color:b}=C||{},{style:P,color:F}=f||{},{style:A,color:M}=v||{};return!(S!=n||y!=d||w!=l||b!=u||P!=o||F!=h||A!=a||M!=c)});return p===-1&&(p=ds.length,ds.push({left:{style:n,color:d},right:{style:l,color:u},top:{style:o,color:h},bottom:{style:a,color:c},diagonal:{style:void 0,color:void 0}})),p},ZA=e=>{const{fontName:t="Calibri",color:s,size:i,bold:r,italic:a,outline:o,shadow:n,strikeThrough:l,underline:c,family:h,verticalAlign:d}=e,u=ze(s),p=NF(h),g=c?c.toLocaleLowerCase():void 0,m=d?d.toLocaleLowerCase():void 0;let C=cs.findIndex(f=>!(f.fontName!=t||f.color!=u||f.size!=i||f.bold!=r||f.italic!=a||f.outline!=o||f.shadow!=n||f.strikeThrough!=l||f.underline!=g||f.verticalAlign!=m||f.family!=p));return C===-1&&(C=cs.length,cs.push({fontName:t,color:u,size:i,bold:r,italic:a,outline:o,shadow:n,strikeThrough:l,underline:g,verticalAlign:m,family:p?.toString()})),C},JA=e=>{const{alignment:t,borders:s,font:i,interior:r,numberFormat:a,protection:o,quotePrefix:n}=e;let{id:l}=e,c=0,h=0,d=0,u=0;l&&(l=Gh(l,Da),wi[l]==null&&(r&&(c=YA(r)),s&&(h=XA(s)),i&&(d=ZA(i)),a&&(u=qA(a.format)),wi[l]=xi.length,xi.push({alignment:t,borderId:h||0,fillId:c||0,fontId:d||0,numFmtId:u||0,protection:o,quotePrefix:n,xfId:0})))},QA={getTemplate(e){const t=jA.getTemplate(yt),s=HA.getTemplate(cs.map(l=>({...l,size:l.size!=null?l.size:e}))),i=NA.getTemplate(hs),r=yA.getTemplate(ds),a=AA.getTemplate(Lh),o=kA.getTemplate(xi),n=DA.getTemplate(kh);return Oh(),{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,a,o,n,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},eR=(e,t)=>wi[Gh(e,t)]||0,tR=(e,t)=>{Da=t,Da===1&&Oh(),e.forEach(JA)},sR=QA,iR={getTemplate(e,t){const{name:s,columns:i,rowCount:r,displayName:a,headerRowIndex:o,showRowStripes:n,showColumnStripes:l,showFilterButtons:c,highlightFirstColumn:h,highlightLastColumn:d}=e||{};if(!e||!s||!Array.isArray(i)||!i.length||!r)return{name:"table"};const u=i.map((S,y)=>({name:"filterColumn",properties:{rawMap:{colId:y.toString(),hiddenButton:c[y]?0:1}}})),p=o+1,g=(t+1).toString(),m=`A${p}`,C=`${String.fromCharCode(64+i.length)}${p+r}`,f=`${m}:${C}`,v=t?`${a}_${t+1}`:a;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:s,displayName:v,ref:f,totalsRowShown:0,id:g}},children:[{name:"autoFilter",properties:{rawMap:{ref:f}},children:u},{name:"tableColumns",properties:{rawMap:{count:i.length}},children:i.map((S,y)=>({name:"tableColumn",properties:{rawMap:{id:(y+1).toString(),name:S,dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:h?1:0,showLastColumn:d?1:0,showRowStripes:n?1:0,showColumnStripes:l?1:0}}}]}}},rR=iR,ue=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,children:[{name:`a:${s}`,properties:{rawMap:{val:i,lastClr:r}}}]}},aR={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[ue(["dk1","sysClr","windowText","000000"]),ue(["lt1","sysClr","window","FFFFFF"]),ue(["dk2","srgbClr","44546A"]),ue(["lt2","srgbClr","E7E6E6"]),ue(["accent1","srgbClr","4472C4"]),ue(["accent2","srgbClr","ED7D31"]),ue(["accent3","srgbClr","A5A5A5"]),ue(["accent4","srgbClr","FFC000"]),ue(["accent5","srgbClr","5B9BD5"]),ue(["accent6","srgbClr","70AD47"]),ue(["hlink","srgbClr","0563C1"]),ue(["folHlink","srgbClr","954F72"])]}}},oR=aR,x=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,properties:{rawMap:{script:i,typeface:s,panose:r}}}},nR={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[x(["latin","Calibri Light",void 0,"020F0302020204030204"]),x(["ea",""]),x(["cs",""]),x(["font","\u6E38\u30B4\u30B7\u30C3\u30AF Light","Jpan"]),x(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),x(["font","\u7B49\u7EBF Light","Hans"]),x(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),x(["font","Times New Roman","Arab"]),x(["font","Times New Roman","Hebr"]),x(["font","Tahoma","Thai"]),x(["font","Nyala","Ethi"]),x(["font","Vrinda","Beng"]),x(["font","Shruti","Gujr"]),x(["font","MoolBoran","Khmr"]),x(["font","Tunga","Knda"]),x(["font","Raavi","Guru"]),x(["font","Euphemia","Cans"]),x(["font","Plantagenet Cherokee","Cher"]),x(["font","Microsoft Yi Baiti","Yiii"]),x(["font","Microsoft Himalaya","Tibt"]),x(["font","MV Boli","Thaa"]),x(["font","Mangal","Deva"]),x(["font","Gautami","Telu"]),x(["font","Latha","Taml"]),x(["font","Estrangelo Edessa","Syrc"]),x(["font","Kalinga","Orya"]),x(["font","Kartika","Mlym"]),x(["font","DokChampa","Laoo"]),x(["font","Iskoola Pota","Sinh"]),x(["font","Mongolian Baiti","Mong"]),x(["font","Times New Roman","Viet"]),x(["font","Microsoft Uighur","Uigh"]),x(["font","Sylfaen","Geor"]),x(["font","Arial","Armn"]),x(["font","Leelawadee UI","Bugi"]),x(["font","Microsoft JhengHei","Bopo"]),x(["font","Javanese Text","Java"]),x(["font","Segoe UI","Lisu"]),x(["font","Myanmar Text","Mymr"]),x(["font","Ebrima","Nkoo"]),x(["font","Nirmala UI","Olck"]),x(["font","Ebrima","Osma"]),x(["font","Phagspa","Phag"]),x(["font","Estrangelo Edessa","Syrn"]),x(["font","Estrangelo Edessa","Syrj"]),x(["font","Estrangelo Edessa","Syre"]),x(["font","Nirmala UI","Sora"]),x(["font","Microsoft Tai Le","Tale"]),x(["font","Microsoft New Tai Lue","Talu"]),x(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[x(["latin","Calibri",void 0,"020F0502020204030204"]),x(["ea",""]),x(["cs",""]),x(["font","\u6E38\u30B4\u30B7\u30C3\u30AF","Jpan"]),x(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),x(["font","\u7B49\u7EBF","Hans"]),x(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),x(["font","Arial","Arab"]),x(["font","Arial","Hebr"]),x(["font","Tahoma","Thai"]),x(["font","Nyala","Ethi"]),x(["font","Vrinda","Beng"]),x(["font","Shruti","Gujr"]),x(["font","DaunPenh","Khmr"]),x(["font","Tunga","Knda"]),x(["font","Raavi","Guru"]),x(["font","Euphemia","Cans"]),x(["font","Plantagenet Cherokee","Cher"]),x(["font","Microsoft Yi Baiti","Yiii"]),x(["font","Microsoft Himalaya","Tibt"]),x(["font","MV Boli","Thaa"]),x(["font","Mangal","Deva"]),x(["font","Gautami","Telu"]),x(["font","Latha","Taml"]),x(["font","Estrangelo Edessa","Syrc"]),x(["font","Kalinga","Orya"]),x(["font","Kartika","Mlym"]),x(["font","DokChampa","Laoo"]),x(["font","Iskoola Pota","Sinh"]),x(["font","Mongolian Baiti","Mong"]),x(["font","Arial","Viet"]),x(["font","Microsoft Uighur","Uigh"]),x(["font","Sylfaen","Geor"]),x(["font","Arial","Armn"]),x(["font","Leelawadee UI","Bugi"]),x(["font","Microsoft JhengHei","Bopo"]),x(["font","Javanese Text","Java"]),x(["font","Segoe UI","Lisu"]),x(["font","Myanmar Text","Mymr"]),x(["font","Ebrima","Nkoo"]),x(["font","Nirmala UI","Olck"]),x(["font","Ebrima","Osma"]),x(["font","Phagspa","Phag"]),x(["font","Estrangelo Edessa","Syrn"]),x(["font","Estrangelo Edessa","Syrj"]),x(["font","Estrangelo Edessa","Syre"]),x(["font","Nirmala UI","Sora"]),x(["font","Microsoft Tai Le","Tale"]),x(["font","Microsoft New Tai Lue","Talu"]),x(["font","Ebrima","Tfng"])]}]}}},lR=nR,ye=(e,t,s)=>({name:`a:${e}`,properties:{rawMap:{val:t}},children:s}),La=e=>{const[t,s,i,r,a,o]=e,n=[];return n.push(ye("satMod",i)),r&&n.push(ye("lumMod",r)),a&&n.push(ye("tint",a)),o&&n.push(ye("shade",o)),{name:"a:gs",properties:{rawMap:{pos:t}},children:[{name:"a:schemeClr",properties:{rawMap:{val:s}},children:n}]}},bi=(e,t)=>({name:"a:solidFill",children:[ye("schemeClr",e,t)]}),ka=e=>{const[t,s,i,r,a]=e,[o,n]=a;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:t}},children:[{name:"a:gsLst",children:[La(s),La(i),La(r)]},{name:"a:lin",properties:{rawMap:{ang:o,scaled:n}}}]}},Ga=e=>{const[t,s,i,r]=e;return{name:"a:ln",properties:{rawMap:{w:t,cap:s,cmpd:i,algn:r}},children:[bi("phClr"),ye("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},Oa=e=>{const t=[];if(e){const[s,i,r,a,o]=e;t.push({name:"a:outerShdw",properties:{rawMap:{blurRad:s,dist:i,dir:r,algn:a,rotWithShape:o}},children:[ye("srgbClr","000000",[ye("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},t.length?{children:t}:{})]}},cR=()=>({name:"a:fillStyleLst",children:[bi("phClr"),ka(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),ka(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),hR=()=>({name:"a:lnStyleLst",children:[Ga(["6350","flat","sng","ctr"]),Ga(["12700","flat","sng","ctr"]),Ga(["19050","flat","sng","ctr"])]}),dR=()=>({name:"a:effectStyleLst",children:[Oa(),Oa(),Oa(["57150","19050","5400000","ctr","0"])]}),uR=()=>({name:"a:bgFillStyleLst",children:[bi("phClr"),bi("phClr",[ye("tint","95000"),ye("satMod","170000")]),ka(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),pR={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[cR(),hR(),dR(),uR()]}}},gR=pR,mR={getTemplate(){return{name:"a:themeElements",children:[oR.getTemplate(),lR.getTemplate(),gR.getTemplate()]}}},fR=mR,CR={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[fR.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},vR=CR,SR=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),yR=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),wR=e=>({name:"v:formulas",children:e.map(t=>({name:"v:f",properties:{rawMap:{eqn:t}}}))}),xR=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),Bh=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 bR(e,t,s,i,r){return(e-t)/(s-t)*(r-i)+i}var PR=(e,t)=>{let s;const{recolor:i,brightness:r,contrast:a,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={}),a!=null&&a!==50){let n="1";a>=0&&(a<50?n=String(a/50):a<100?n=String(50/(100-a)):a===100&&(n="2147483647f")),s.gain=n}r!=null&&r!==50&&(s.blacklevel=bR(r,0,100,-.5,.5).toString())}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${t}`,title:o}}],rawMap:s}}},TR=()=>{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:[yR(),wR(e),xR(),Bh({aspectratio:!0})]}},Nh=e=>Math.floor((e??0)*.74999943307122),MR=(e,t)=>{const{width:s=0,height:i=0,altText:r}=e,a=Nh(s),o=Nh(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: ${a}pt; height: ${o}pt; z-index: ${t+1}`,type:"#_x0000_t75",alt:r}},children:[PR(e,t+1),Bh({rotation:!0})]}},FR={getTemplate(e){const t=E.worksheetHeaderFooterImages.get(e.sheetIndex)||[],s=[SR(),TR(),...t.map((i,r)=>MR(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}}},AR=FR,RR={getTemplate(e,t){const s=(t+1).toString();return{name:"sheet",properties:{rawMap:{name:e,sheetId:s,"r:id":`rId${s}`}}}}},ER=RR,IR={getTemplate(e){return{name:"sheets",children:e.map((t,s)=>ER.getTemplate(t,s))}}},DR=IR,LR={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}}}]},DR.getTemplate(e)]}}},kR=LR,GR=e=>Math.ceil((e-12)/7+1),OR={getTemplate(e){const{min:t,max:s,outlineLevel:i,s:r,width:a,hidden:o,bestFit:n}=e;let l=1,c="0";return a>1&&(l=GR(a),c="1"),{name:"col",properties:{rawMap:{min:t,max:s,outlineLevel:i??void 0,width:l,style:r,hidden:o?"1":"0",bestFit:n?"1":"0",customWidth:c}}}}},BR=OR,NR={getTemplate(e){return{name:"mergeCell",properties:{rawMap:{ref:e}}}}},VR=NR,_R=e=>{const t=e.charAt(0).toLowerCase();return t==="s"?"inlineStr":t},UR={getTemplate(e,t,s){const{ref:i,data:r,styleId:a}=e,{type:o,value:n}=r||{type:"empty",value:null};let l=o;o==="f"?l="str":o.charAt(0)===o.charAt(0).toUpperCase()&&(l=_R(o));const c={name:"c",properties:{rawMap:{r:i,t:l==="empty"?void 0:l,s:a?eR(a,s):void 0}}};if(l==="empty")return c;let h;return l==="str"&&o==="f"?h=[{name:"f",textNode:Fh(Ia(n),!1)}]:l==="inlineStr"?h=[{name:"is",children:[{name:"t",textNode:Fh(Ia(n),!1)}]}]:h=[{name:"v",textNode:n}],Object.assign({},c,{children:h})}},HR=UR,zR=(e,t)=>{const s=[];let i=0;for(let r=0;r<e.length;r++){const a=e[r];a.mergeAcross&&(s.push({pos:r,excelPos:i}),i+=a.mergeAcross),i++}if(s.length)for(let r=s.length-1;r>=0;r--){const a=[],o=e[s[r].pos];for(let n=1;n<=o.mergeAcross;n++)a.push({ref:`${St(s[r].excelPos+1+n)}${t+1}`,styleId:o.styleId,data:{type:"empty",value:null}});a.length&&e.splice(s[r].pos+1,0,...a)}},WR=e=>e.data?.value!==""||e.styleId!==void 0,KR={getTemplate(e,t,s){const{collapsed:i,hidden:r,height:a,outlineLevel:o,cells:n=[]}=e;zR(n,t);const l=n.filter(WR).map((c,h)=>HR.getTemplate(c,h,s));return{name:"row",properties:{rawMap:{r:t+1,collapsed:i?"1":"0",hidden:r?"1":"0",ht:a,customHeight:a!=null?"1":"0",spans:"1:1",outlineLevel:o||void 0}},children:l}}},$R=KR,jR=(e,t,s)=>{const i=[],r=[];e.forEach((n,l)=>{const c=n.cells;let h=0,d;c.forEach((u,p)=>{const g=p+h+1,m=St(g),C=l+1;if(u.mergeAcross){h+=u.mergeAcross;const v=St(p+h+1);i.push(`${m}${C}:${v}${C}`)}t[g-1]||(t[g-1]={});const{collapsibleRanges:f}=u;f&&f.forEach(v=>{r.push([g+v[0],g+v[1]])}),d=t[g-1],d.min=g,d.max=g,u.ref=`${m}${C}`})}),r.sort((n,l)=>n[0]!==l[0]?n[0]-l[0]:l[1]-n[1]);const a=new Map,o=new Map;return r.filter(n=>{const l=n.toString();return a.get(l)?!1:(a.set(l,!0),!0)}).forEach(n=>{const l=t.find(h=>h.min==n[0]&&h.max==n[1]),c=o.get(n[0]);t.push({min:n[0],max:n[1],outlineLevel:s?void 0:c||1,width:(l||{width:100}).width}),o.set(n[0],(c||0)+1)}),i},YR=e=>!e||e!=="Portrait"&&e!=="Landscape"?"portrait":e.toLocaleLowerCase(),qR=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},XR=e=>(kF({"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"},(s,i)=>{e=e.replace(s,i)}),e),ZR=e=>e==="Center"?"C":e==="Right"?"R":"L",JR=(e,t)=>(t&&(e+="&amp;&quot;",e+=t.fontName||"Calibri",t.bold!==t.italic?e+=t.bold?",Bold":",Italic":t.bold?e+=",Bold Italic":e+=",Regular",e+="&quot;",t.size&&(e+=`&amp;${t.size}`),t.strikeThrough&&(e+="&amp;S"),t.underline&&(e+=`&amp;${t.underline==="Double"?"E":"U"}`),t.color&&(e+=`&amp;K${t.color.replace("#","").toUpperCase()}`)),e),QR=(e,t,s)=>e.reduce((i,r,a)=>{const o=ZR(r.position),n=JR(`${i}&amp;${o}`,r.font),l=["Left","Center","Right"];r.position||(r.position=l[a]);const{image:c}=r;if(r.value==="&[Picture]"&&c){const h=`${o}${t}${s}`;E.addHeaderFooterImageToMap(c,h)}return`${n}${LF(XR(r.value))}`},""),eE=e=>{const t=["all","first","even"],s=[];return t.forEach(i=>{const r=e[i],a=i==="all"?"odd":i;if(r)for(const[o,n]of Object.entries(r)){const l=`${o.charAt(0).toUpperCase()}${o.slice(1)}`,c=o[0].toUpperCase();if(n){const h=i==="all"?"":i.toUpperCase();s.push({name:`${a}${l}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:QR(n,c,h)})}}}),s},tE=e=>t=>(e.length&&t.children.push({name:"cols",children:e.map(s=>BR.getTemplate(s))}),t),sE=(e,t)=>s=>(e.length&&s.children.push({name:"sheetData",children:e.map((i,r)=>$R.getTemplate(i,r,t))}),s),iE=e=>t=>(e.length&&t.children.push({name:"mergeCells",properties:{rawMap:{count:e.length}},children:e.map(s=>VR.getTemplate(s))}),t),rE=e=>t=>{const{top:s=.75,right:i=.7,bottom:r=.75,left:a=.7,header:o=.3,footer:n=.3}=e;return t.children.push({name:"pageMargins",properties:{rawMap:{bottom:r,footer:n,header:o,left:a,right:i,top:s}}}),t},aE=e=>t=>(e&&t.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:YR(e.orientation),paperSize:qR(e.pageSize)}}}),t),oE=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:eE(e)}),t},nE=e=>t=>(e&&t.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}]}),t),lE=e=>t=>(E.worksheetImages.get(e)?.length&&t.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),cE=e=>t=>(E.worksheetHeaderFooterImages.get(e)&&t.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),hE=(e=0,t=0)=>{const s=e>0||t>0;return s?[{name:"pane",properties:{rawMap:{state:s?"frozen":void 0,topLeftCell:s?`${St(e+1)}${t+1}`:void 0,xSplit:e===0?void 0:e,ySplit:t===0?void 0:t}}}]:void 0},dE=(e=!1,t,s)=>i=>(i.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:e===!0?"1":"0",workbookViewId:"0"}},children:hE(t,s)}]}),i),uE=()=>e=>(e.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),e),pE=e=>t=>{const s=e.reduce((i,r)=>r.outlineLevel&&r.outlineLevel>i?r.outlineLevel:i,0);return t.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:s||void 0}}}),t},gE={getTemplate(e){const{worksheet:t,currentSheet:s,config:i}=e,{margins:r={},pageSetup:a,headerFooterConfig:o,suppressColumnOutline:n,rightToLeft:l,frozenRowCount:c,frozenColumnCount:h}=i,{table:d}=t,{rows:u,columns:p}=d,g=p&&p.length?jR(u,p,!!n):[],{worksheetDataTables:m}=E,C=m.get(s),f=DF(uE(),dE(l,h,c),pE(u),tE(p),sE(u,s+1),iE(g),rE(r),aE(a),oE(o),lE(s),cE(s),nE(C)),{children:v}=f({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}}},mE=gE,me=class wu{static createExcel(t,s,i){this.addSheetName(s),tR(t,this.sheetNames.length);const r=Object.assign({},i);return i.exportAsExcelTable&&(i.columnModel.isPivotActive()&&(this.showExcelTableNonCompatibleFeaturesWarning("pivot mode"),r.exportAsExcelTable=!1),i.gos.get("masterDetail")&&(this.showExcelTableNonCompatibleFeaturesWarning("master/detail"),r.exportAsExcelTable=!1)),this.processTableConfig(s,r),this.createWorksheet(s,r)}static showExcelTableNonCompatibleFeaturesWarning(t){Ea(`Excel table export does not work with ${t}. The exported Excel file will not contain any Excel tables.
373
- Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromIndex(t){return`table${t+1}`}static getSanitizedTableName(t){return t.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}static addTableToSheet(t,s){if(this.worksheetDataTables.has(t)){Ea("Unable to add data table to Excel sheet: A table already exists.");return}this.worksheetDataTables.set(t,s)}static processTableConfig(t,s){if(!s.exportAsExcelTable)return;const i=typeof s.exportAsExcelTable=="boolean"?{}:s.exportAsExcelTable,{name:r,showColumnStripes:a,showRowStripes:o,showFilterButton:n,highlightFirstColumn:l,highlightLastColumn:c}=i,h=this.getSanitizedTableName(r||wu.defaultTableDisplayName),d=this.sheetNames.length-1,{table:u}=t,{rows:p,columns:g}=u,m=s.columnModel.getHeaderRowCount(),C=m-1,f=p.length,v=g.length,S=[],y=[];for(let w=0;w<v;w++){const b=g[w];S.push(b.displayName||""),y.push(n==="match"||n===void 0?b.filterAllowed??!1:n)}if(!S||!S.length||!f||!h){Ea("Unable to add data table to Excel sheet: Missing required parameters.");return}this.addTableToSheet(d,{name:this.getTableNameFromIndex(d),displayName:h,columns:S,showFilterButtons:y,headerRowIndex:C,rowCount:f-m,showRowStripes:o??!0,showColumnStripes:a??!1,highlightFirstColumn:l??!1,highlightLastColumn:c??!1})}static addHeaderFooterImageToMap(t,s){const i=this.sheetNames.length-1,r=t;r.headerFooterPosition=s,this.buildImageMap({imageToAdd:r,idx:i});let a=this.worksheetHeaderFooterImages.get(i);a||(a=[],this.worksheetHeaderFooterImages.set(i,a)),a.find(o=>o.id===t.id)||a.push(t)}static addBodyImageToMap(t,s,i,r,a){const o=this.sheetNames.length,{row:n,column:l}=t.position||{},c=t;r&&(s!=null&&i!=null&&(!n||!l)&&(t.position||(t.position={}),t.position=Object.assign({},t.position,{row:s,column:r.indexOf(i)+1})),VF(c,r),_F(c,a)),this.buildImageMap({imageToAdd:c,idx:o});let h=this.worksheetImageIds.get(o);h||(h=new Map,this.worksheetImageIds.set(o,h));const d=this.worksheetImages.get(o);d?d.push(c):this.worksheetImages.set(o,[c]),h.get(t.id)||h.set(t.id,{index:h.size,type:t.imageType})}static buildImageMap(t){const{imageToAdd:s,idx:i}=t,r=this.images.get(s.id);if(r){const a=r.find(o=>o.sheetId===i);a?a.image.push(s):r.push({sheetId:i,image:[s]})}else this.images.set(s.id,[{sheetId:i,image:[s]}]),this.workbookImageIds.set(s.id,{type:s.imageType,index:this.workbookImageIds.size})}static addSheetName(t){const s=EF(t.name)||"";let i="";for(;this.sheetNames.indexOf(`${s}${i}`)!==-1;)i===""?i="_1":i=`_${parseInt(i.slice(1),10)+1}`;t.name=`${s}${i}`,this.sheetNames.push(t.name)}static getStringPosition(t){return this.sharedStrings.has(t)?this.sharedStrings.get(t):(this.sharedStrings.set(t,this.sharedStrings.size),this.sharedStrings.size-1)}static resetFactory(){this.sharedStrings=new Map,this.images=new Map,this.worksheetImages=new Map,this.worksheetHeaderFooterImages=new Map,this.workbookImageIds=new Map,this.worksheetImageIds=new Map,this.worksheetDataTables=new Map,this.sheetNames=[],this.factoryMode=Mh.SINGLE_SHEET}static createWorkbook(t){return se(kR.getTemplate(this.sheetNames,t))}static createStylesheet(t){return se(sR.getTemplate(t))}static createSharedStrings(){return se(nA.getTemplate(this.sharedStrings))}static createCore(t){return se(jF.getTemplate(t))}static createContentTypes(t){return se(KF.getTemplate(t))}static createRels(){const t=ns.getTemplate([{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"}]);return se(t)}static createTheme(){return se(vR.getTemplate())}static createTable(t,s){return se(rR.getTemplate(t,s))}static createWorkbookRels(t){const s=new Array(t).fill(void 0).map((r,a)=>({Id:`rId${a+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${a+1}.xml`})),i=ns.getTemplate([...s,{Id:`rId${t+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${t+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${t+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return se(i)}static createDrawing(t){return se(sA.getTemplate({sheetIndex:t}))}static createDrawingRel(t){const s=this.worksheetImageIds.get(t)||[],i=[];for(const[r,a]of s){const{index:o,type:n}=a;i.push({Id:`rId${o+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${this.workbookImageIds.get(r).index+1}.${Si(n)}`})}return se(ns.getTemplate(i))}static createVmlDrawing(t){return se(AR.getTemplate({sheetIndex:t}),!0)}static createVmlDrawingRel(t){const s=this.worksheetHeaderFooterImages.get(t)||[],i=[];for(let r=0;r<s.length;r++){const a=s[r],o=this.workbookImageIds.get(a.id);if(!o)continue;const{index:n,type:l}=o;i.push({Id:`rId${r+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${n+1}.${Si(l)}`})}return se(ns.getTemplate(i))}static createRelationships({drawingIndex:t,vmlDrawingIndex:s,tableIndex:i}={}){if(t===void 0&&s===void 0&&i===void 0)return"";const r=[];t!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/drawing${t+1}.xml`}),s!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${s+1}.vml`}),i!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",Target:`../tables/${this.getTableNameFromIndex(i)}.xml`});const a=ns.getTemplate(r);return se(a)}static createWorksheet(t,s){return se(mE.getTemplate({worksheet:t,currentSheet:this.sheetNames.length-1,config:s}))}};me.sharedStrings=new Map,me.sheetNames=[],me.images=new Map,me.worksheetImages=new Map,me.worksheetHeaderFooterImages=new Map,me.workbookImageIds=new Map,me.worksheetImageIds=new Map,me.worksheetDataTables=new Map,me.defaultTableDisplayName="AG-GRID-TABLE",me.factoryMode=Mh.SINGLE_SHEET;var E=me,fE=class extends AF{constructor(e){super(e),this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.config=Object.assign({},e),this.stylesByIds={},this.config.baseExcelStyles.forEach(t=>{this.stylesByIds[t.id]=t}),this.excelStyles=[...this.config.baseExcelStyles,{id:"_quotePrefix",quotePrefix:1}]}addCustomContent(e){e.forEach(t=>{const s=this.rows.length+1;let i;!this.config.suppressRowOutline&&t.outlineLevel!=null&&(i=t.outlineLevel);const r={height:vi(s,t.height||this.config.rowHeight),cells:(t.cells||[]).map((a,o)=>{const n=this.addImage(s,this.columnsToExport[o],a.data?.value);let l=null;a.styleId&&(l=typeof a.styleId=="string"?[a.styleId]:a.styleId);const c=this.getStyleId(l);if(n)return this.createCell(c,this.getDataTypeForValue(n.value),n.value==null?"":n.value);const h=a.data?.value??"",d=this.getDataTypeForValue(h);return a.mergeAcross?this.createMergedCell(c,d,h,a.mergeAcross):this.createCell(c,d,h)}),outlineLevel:i};t.collapsed!=null&&(r.collapsed=t.collapsed),t.hidden!=null&&(r.hidden=t.hidden),this.rows.push(r)})}onNewHeaderGroupingRow(){const e=[],{freezeRows:t,headerRowHeight:s}=this.config;return this.rows.push({cells:e,height:vi(this.rows.length+1,s)}),t&&this.frozenRowCount++,{onColumn:(i,r,a,o,n)=>{const l=this.config.styleLinker({rowType:Ra.HEADER_GROUPING,rowIndex:1,value:`grouping-${r}`,columnGroup:i});e.push({...this.createMergedCell(this.getStyleId(l),this.getDataTypeForValue("string"),r,o),collapsibleRanges:n})}}}onNewHeaderRow(){const{freezeRows:e,headerRowHeight:t}=this.config;return e&&this.frozenRowCount++,this.onNewRow(this.onNewHeaderColumn,t)}onNewBodyRow(e){const{freezeRows:t,rowHeight:s}=this.config;this.skipFrozenRows||(t==="headersAndPinnedRows"&&e?.rowPinned==="top"?this.frozenRowCount++:typeof t=="function"?t({...this.gos.getGridCommonParams(),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.columnsToExport=[...e],this.cols=e.map((t,s)=>this.convertColumnToExcel(t,s))}parse(){const e=this.rows.reduce((r,a)=>Math.max(r,a.cells.length),0);for(;this.cols.length<e;)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));const{config:t}=this;let s;if(t.sheetName!=null){const{sheetName:r}=t,a=typeof r=="function"?r(this.gos.getGridCommonParams()):r;s=String(a).substring(0,31)}else s="ag-grid";const i={name:s,table:{columns:this.cols,rows:this.rows}};return this.createExcel(i)}addRowOutlineIfNecessary(e){const{gos:t,suppressRowOutline:s,rowGroupExpandState:i="expanded"}=this.config;if(t.get("groupHideOpenParents")||s||e.level==null)return;const a=e.footer?1:0,o=TF(this.rows),n=Math.min(e.level+a,7);if(o.outlineLevel=n,i==="expanded")return;const l=i==="collapsed";if(e.isExpandable()){const c=!l&&e.expanded;o.collapsed=!c}o.hidden=!!e.parent&&e.parent.level!==-1&&(l||this.isAnyParentCollapsed(e.parent))}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)??"",a=e?e.isFilterAllowed():!1;return s?typeof s=="number"?{width:s,displayName:r,filterAllowed:a}:{width:s({column:e,index:t}),displayName:r,filterAllowed:a}:e?{width:Math.max(e.getActualWidth(),75),displayName:r,filterAllowed:a}:{displayName:r,filterAllowed:a}}onNewHeaderColumn(e,t){return s=>{const i=this.extractHeaderValue(s),r=this.config.styleLinker({rowType:Ra.HEADER,rowIndex:e,value:i,column:s});t.push(this.createCell(this.getStyleId(r),this.getDataTypeForValue("string"),i))}}onNewBodyColumn(e,t){let s=0;const{freezeColumns:i,rightToLeft:r}=this.config;return(a,o,n)=>{if(s>0){s-=1;return}if(!this.skipFrozenColumns){const g=a.getPinned();i==="pinned"&&g&&(g===!0||g==="left")!==r?this.frozenColumnCount++:typeof i=="function"&&i({...this.gos.getGridCommonParams(),column:a})?this.frozenColumnCount++:this.skipFrozenColumns=!0}const{value:l,valueFormatted:c}=this.extractRowCellValue(a,o,e,"excel",n),h=this.config.styleLinker({rowType:Ra.BODY,rowIndex:e,value:l,column:a,node:n}),d=this.getStyleId(h),u=a.getColSpan(n),p=this.addImage(e,a,l);p?t.push(this.createCell(d,this.getDataTypeForValue(p.value),p.value==null?"":p.value)):u>1?(s=u-1,t.push(this.createMergedCell(d,this.getDataTypeForValue(l),l,u-1))):t.push(this.createCell(d,this.getDataTypeForValue(l),l,c))}}onNewRow(e,t){const s=[];return this.rows.push({cells:s,height:vi(this.rows.length+1,t)}),{onColumn:e.bind(this,this.rows.length,s)()}}createExcel(e){const{excelStyles:t,config:s}=this;return this.frozenColumnCount&&(s.frozenColumnCount=this.frozenColumnCount),this.frozenRowCount&&(s.frozenRowCount=this.frozenRowCount),E.createExcel(t,e,s)}getDataTypeForValue(e){return e===void 0?"empty":this.isNumerical(e)?"n":"s"}getTypeFromStyle(e,t){if(this.isFormula(t))return"f";if(e&&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:FF(`Unrecognized data type for excel export [${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 E.addBodyImageToMap(i.image,e,t,this.columnsToExport,this.config.rowHeight),i}createCell(e,t,s,i){const r=this.getStyleById(e);!r?.dataType&&t==="s"&&i&&(s=i);const a=this.getTypeFromStyle(r,s)||t,{value:o,escaped:n}=this.getCellValue(a,s),l=[];return r&&l.push(e),n&&l.push("_quotePrefix"),e=this.getStyleId(l)||void 0,{styleId:e,data:{type:a,value:o}}}createMergedCell(e,t,s,i){const r=s??"";return{styleId:this.getStyleById(e)?e:void 0,data:{type:t,value:t==="s"?E.getStringPosition(r).toString():s},mergeAcross:i}}getCellValue(e,t){let s=!1;if(t==null||e==="s"&&t==="")return{value:"",escaped:!1};if(e==="s")t&&t[0]==="'"&&(s=!0,t=t.slice(1)),t=E.getStringPosition(t).toString();else if(e==="f")t=t.slice(1);else if(e==="n"){const i=Number(t);isNaN(i)?t="":t!==""&&(t=i.toString())}return{value:t,escaped:s}}getStyleId(e){if(!e||!e.length)return null;if(e.length===1)return e[0];const t=e.join("-");return this.mixedStyles[t]||this.addNewMixedStyle(e),this.mixedStyles[t].excelID}deepCloneObject(e){return JSON.parse(JSON.stringify(e))}addNewMixedStyle(e){this.mixedStyleCounter+=1;const t=`mixedStyle${this.mixedStyleCounter}`,s={};for(const r of e)for(const a of this.excelStyles)a.id===r&&MF(s,this.deepCloneObject(a));s.id=t,s.name=t;const i=e.join("-");this.mixedStyles[i]={excelID:t,key:i,result:s},this.excelStyles.push(s),this.stylesByIds[t]=s}isFormula(e){return e==null?!1:this.config.autoConvertFormulas&&e.toString().startsWith("=")}isNumerical(e){return typeof e=="bigint"?!0:isFinite(e)&&e!==""&&!isNaN(parseFloat(e))}getStyleById(e){return e==null?null:this.stylesByIds[e]||null}},CE=()=>{W.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]);const{images:e}=E;if(!e.size)return;W.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let t=0;e.forEach(s=>{const i=s[0].image[0],{base64:r,imageType:a}=i;W.addFile(`xl/media/image${++t}.${Si(a)}`,r,!0)})},vE=e=>{let t=0,s=0,i=0;const{images:r,worksheetDataTables:a,worksheetImages:o,worksheetHeaderFooterImages:n}=E;for(let l=0;l<e.length;l++){const c=e[l];W.addFile(`xl/worksheets/sheet${l+1}.xml`,c,!1);const h=r.size>0&&o.has(l),d=a.size>0&&a.has(l),u=r.size&&n.has(l);if(!h&&!d&&!u)continue;let p,g,m;h&&(SE(l,t),g=t,t++),u&&(yE(l,s),m=s,s++),d&&(p=i++);const C=`xl/worksheets/_rels/sheet${l+1}.xml.rels`;W.addFile(C,E.createRelationships({tableIndex:p,drawingIndex:g,vmlDrawingIndex:m}))}},SE=(e,t)=>{const s="xl/drawings",i=`${s}/drawing${t+1}.xml`,r=`${s}/_rels/drawing${t+1}.xml.rels`;W.addFile(r,E.createDrawingRel(e)),W.addFile(i,E.createDrawing(e))},yE=(e,t)=>{const s="xl/drawings",i=`${s}/vmlDrawing${t+1}.vml`,r=`${s}/_rels/vmlDrawing${t+1}.vml.rels`;W.addFile(i,E.createVmlDrawing(e)),W.addFile(r,E.createVmlDrawingRel(e))},wE=()=>{const{worksheetDataTables:e}=E,t=e,s=Array.from(t.keys());for(let i=0;i<s.length;i++){const r=s[i],a=t.get(r);a&&W.addFile(`xl/tables/${a.name}.xml`,E.createTable(a,i))}},xE=(e,t,s,i)=>{W.addFile("xl/workbook.xml",E.createWorkbook(i)),W.addFile("xl/styles.xml",E.createStylesheet(e)),W.addFile("xl/sharedStrings.xml",E.createSharedStrings()),W.addFile("xl/theme/theme1.xml",E.createTheme()),W.addFile("xl/_rels/workbook.xml.rels",E.createWorkbookRels(s)),W.addFile("docProps/core.xml",E.createCore(t)),W.addFile("[Content_Types].xml",E.createContentTypes(s)),W.addFile("_rels/.rels",E.createRels())},Vh=(e,t={})=>{if(!e||e.length===0)return xh("Invalid params supplied to createExcelFileForExcel() - `ExcelExportParams.data` is empty."),E.resetFactory(),!1;const{fontSize:s=11,author:i="AG Grid",activeTab:r=0}=t,a=e.length,o=Math.max(Math.min(r,a-1),0);return CE(),wE(),vE(e),xE(s,i,a,o),E.resetFactory(),!0},_h=e=>{const{data:t,fontSize:s,author:i,activeSheetIndex:r}=e,a=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return Vh(t,{author:i,fontSize:s,activeTab:r})?W.getZipFile(a):Promise.resolve(void 0)},Pi=e=>{const{data:t,fontSize:s,author:i,activeSheetIndex:r}=e,a=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";if(Vh(t,{author:i,fontSize:s,activeTab:r}))return W.getUncompressedZipFile(a)},Ba=e=>{const{fileName:t="export.xlsx"}=e;_h(e).then(s=>{if(s){const i=typeof t=="function"?t():t;bh.download(i,s)}})},bE=class extends PF{constructor(){super(...arguments),this.beanName="excelCreator"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.stylingService=e.stylingService,this.gridSerializer=e.gridSerializer,this.gos=e.gos}postConstruct(){this.setBeans({gridSerializer:this.gridSerializer,gos:this.gos})}getMergedParams(e){const t=this.gos.get("defaultExcelExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){xh("Export cancelled. Export is not allowed as per your configuration.");return}const t=this.getMergedParams(e),i={data:[this.getData(t)],fontSize:t.fontSize,author:t.author,mimeType:t.mimeType};this.packageCompressedFile(i).then(r=>{if(r){const{fileName:a}=t,o=typeof a=="function"?a(this.gos.getGridCommonParams()):a;bh.download(this.getFileName(o),r)}})}exportDataAsExcel(e){this.export(e)}getDataAsExcel(e){const t=this.getMergedParams(e),i={data:[this.getData(t)],fontSize:t.fontSize,author:t.author,mimeType:t.mimeType};return this.packageFile(i)}setFactoryMode(e){E.factoryMode=e}getFactoryMode(){return E.factoryMode}getSheetDataForExcel(e){const t=this.getMergedParams(e);return this.getData(t)}getMultipleSheetsAsExcel(e){return Pi(e)}exportMultipleSheetsAsExcel(e){Ba(e)}getDefaultFileExtension(){return"xlsx"}createSerializingSession(e){const{columnModel:t,columnNameService:s,funcColsService:i,valueService:r,gos:a}=this,o={...e,columnModel:t,columnNameService:s,funcColsService:i,valueService:r,gos:a,suppressRowOutline:e.suppressRowOutline||e.skipRowGroups,headerRowHeight:e.headerRowHeight||e.rowHeight,baseExcelStyles:this.gos.get("excelStyles")||[],rightToLeft:e.rightToLeft??this.gos.get("enableRtl"),styleLinker:this.styleLinker.bind(this)};return new fE(o)}styleLinker(e){const{rowType:t,rowIndex:s,value:i,column:r,columnGroup:a,node:o}=e,n=t===Ph.HEADER,l=t===Ph.HEADER_GROUPING,c=n?r:a;let h=[];if(n||l)return h.push("header"),l&&h.push("headerGroup"),c&&(h=h.concat(bF(c.getDefinition(),this.gos,r||null,a||null))),h;const d=this.gos.get("excelStyles"),u=["cell"];if(!d||!d.length)return u;const p=d.map(m=>m.id),g=r.getDefinition();return this.stylingService.processAllCellClasses(g,this.gos.addGridCommonParams({value:i,data:o.data,node:o,colDef:g,column:r,rowIndex:s}),m=>{p.indexOf(m)>-1&&u.push(m)}),u.sort((m,C)=>p.indexOf(m)<p.indexOf(C)?-1:1)}isExportSuppressed(){return this.gos.get("suppressExcelExport")}packageCompressedFile(e){return _h(e)}packageFile(e){return Pi(e)}};function Uh(e){return e.excelCreator?.getFactoryMode()===Ah.MULTI_SHEET?(GF("The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'"),!1):!0}function PE(e,t){if(Uh(e))return e.excelCreator?.getDataAsExcel(t)}function TE(e,t){Uh(e)&&e.excelCreator?.exportDataAsExcel(t)}function ME(e,t){return e.excelCreator?.setFactoryMode(Ah.MULTI_SHEET),e.excelCreator?.getSheetDataForExcel(t)}function FE(e,t){return e.excelCreator?.getMultipleSheetsAsExcel(t)}function AE(e,t){e.excelCreator?.exportMultipleSheetsAsExcel(t)}var Na="32.3.2",Hh=Aa({version:Na,moduleName:`${Fa.ExcelExportModule}-core`,beans:[bE],dependantModules:[xF,H]}),RE=Aa({version:Na,moduleName:`${Fa.ExcelExportModule}-api`,apiFunctions:{getDataAsExcel:PE,exportDataAsExcel:TE,getSheetDataForExcel:ME,getMultipleSheetsAsExcel:FE,exportMultipleSheetsAsExcel:AE},dependantModules:[Hh]}),Va=Aa({version:Na,moduleName:Fa.ExcelExportModule,dependantModules:[Hh,RE]});import{ModuleNames as EE,_ColumnFilterModule as IE,_defineModule as DE}from"ag-grid-community";import{Component as LE,RefPlaceholder as zh}from"ag-grid-community";import{AgInputTextFieldSelector as kE,Component as GE,RefPlaceholder as Wh,_createIconNoSpan as _a,_debounce as OE,_setDisplayed as us}from"ag-grid-community";import{Component as BE,_clearElement as NE,_exists as Ua,_flatten as Ha,_getActiveDomElement as VE,_includes as Kh,_mergeDeep as _E,_setAriaLabel as UE,_warnOnce as $h,isProvidedColumnGroup as jh}from"ag-grid-community";import{Component as HE,FilterWrapperComp as zE,KeyCode as Yh,RefPlaceholder as ps,_clearElement as WE,_createIconNoSpan as za,_loadTemplate as KE,_setAriaExpanded as qh,_setDisplayed as We}from"ag-grid-community";import{Component as $E,RefPlaceholder as jE,_clearElement as YE,_createIconNoSpan as qE,isProvidedColumnGroup as Ti}from"ag-grid-community";var XE=class extends GE{constructor(){super(...arguments),this.eExpand=Wh,this.eFilterTextField=Wh}wireBeans(e){this.columnModel=e.columnModel}postConstruct(){this.setTemplate(`<div class="ag-filter-toolpanel-search" role="presentation">
372
+ </div>`}postConstruct(){this.setTemplate(this.createTemplate(),[nF]),this.cbPivotMode.setValue(this.columnModel.isPivotMode());const e=this.localeService.getLocaleTextFunc();this.cbPivotMode.setLabel(e("pivotMode","Pivot Mode")),this.addManagedListeners(this.cbPivotMode,{fieldValueChanged:this.onBtPivotMode.bind(this)});const t=this.onPivotModeChanged.bind(this);this.addManagedEventListeners({newColumnsLoaded:t,columnPivotModeChanged:t})}onBtPivotMode(){const e=!!this.cbPivotMode.getValue();e!==this.columnModel.isPivotMode()&&(this.gos.updateGridOptions({options:{pivotMode:e},source:"toolPanelUi"}),this.ctrlsService.getHeaderRowContainerCtrls().forEach(t=>t.refresh()))}onPivotModeChanged(){const e=this.columnModel.isPivotMode();this.cbPivotMode.setValue(e)}},SF=class extends vM{constructor(){super('<div class="ag-column-panel"></div>'),this.initialised=!1,this.childDestroyFuncs=[]}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}init(e){const t=this.gos.addGridCommonParams({suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1});if(this.params={...t,...e},this.isRowGroupingModuleLoaded()&&!this.params.suppressPivotMode&&(this.pivotModePanel=this.createBean(new wh),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotModePanel)),this.appendChild(this.pivotModePanel)),this.primaryColsPanel=this.createBean(new Ci),this.childDestroyFuncs.push(()=>this.destroyBean(this.primaryColsPanel)),this.primaryColsPanel.init(!0,this.params,"toolPanelUi"),this.primaryColsPanel.addCssClass("ag-column-panel-column-select"),this.appendChild(this.primaryColsPanel),this.isRowGroupingModuleLoaded()){this.params.suppressRowGroups||(this.rowGroupDropZonePanel=this.createBean(new ss(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.rowGroupDropZonePanel)),this.appendChild(this.rowGroupDropZonePanel)),this.params.suppressValues||(this.valuesDropZonePanel=this.createBean(new mi(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.valuesDropZonePanel)),this.appendChild(this.valuesDropZonePanel)),this.params.suppressPivots||(this.pivotDropZonePanel=this.createBean(new ts(!1)),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotDropZonePanel)),this.appendChild(this.pivotDropZonePanel)),this.setLastVisible();const[s]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});this.childDestroyFuncs.push(()=>s())}this.initialised=!0}setPivotModeSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.pivotModePanel?this.pivotModePanel.setDisplayed(e):e&&(this.pivotModePanel=this.createBean(new wh),this.getGui().insertBefore(this.pivotModePanel.getGui(),this.getGui().firstChild),this.childDestroyFuncs.push(()=>this.destroyBean(this.pivotModePanel))),this.setLastVisible())}setRowGroupsSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.rowGroupDropZonePanel?this.rowGroupDropZonePanel.setDisplayed(e):e&&(this.rowGroupDropZonePanel=this.createManagedBean(new ss(!1)),this.appendChild(this.rowGroupDropZonePanel)),this.setLastVisible())}setValuesSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.valuesDropZonePanel?this.valuesDropZonePanel.setDisplayed(e):e&&(this.valuesDropZonePanel=this.createManagedBean(new mi(!1)),this.appendChild(this.valuesDropZonePanel)),this.setLastVisible())}setPivotSectionVisible(e){this.isRowGroupingModuleLoaded()&&(this.pivotDropZonePanel?this.pivotDropZonePanel.setDisplayed(e):e&&(this.pivotDropZonePanel=this.createManagedBean(new ts(!1)),this.appendChild(this.pivotDropZonePanel),this.pivotDropZonePanel.setDisplayed(e)),this.setLastVisible())}setResizers(){[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel].forEach(e=>{if(!e)return;const t=e.getGui();e.toggleResizable(!t.classList.contains("ag-last-column-drop")&&!t.classList.contains("ag-hidden"))})}setLastVisible(){const e=this.getGui();Array.prototype.slice.call(e.querySelectorAll(".ag-column-drop")).forEach(r=>r.classList.remove("ag-last-column-drop"));const s=e.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),i=wM(s);i&&i.classList.add("ag-last-column-drop"),this.setResizers()}resetChildrenHeight(){const t=this.getGui().children;for(let s=0;s<t.length;s++){const i=t[s];i.style.removeProperty("height"),i.style.removeProperty("flex")}}isRowGroupingModuleLoaded(){return this.gos.assertModuleRegistered(SM.RowGroupingModule,"Row Grouping")}expandColumnGroups(e){this.primaryColsPanel.expandGroups(e)}collapseColumnGroups(e){this.primaryColsPanel.collapseGroups(e)}setColumnLayout(e){this.primaryColsPanel.setColumnLayout(e)}syncLayoutWithGrid(){this.primaryColsPanel.syncLayoutWithGrid()}destroyChildren(){this.childDestroyFuncs.forEach(e=>e()),this.childDestroyFuncs.length=0,yM(this.getGui())}refresh(e){return this.destroyChildren(),this.init(e),!0}getState(){return{expandedGroupIds:this.primaryColsPanel.getExpandedGroups()}}destroy(){this.destroyChildren(),super.destroy()}},yF=class extends hF{constructor(){super(...arguments),this.beanName="modelItemUtils"}wireBeans(e){this.aggFuncService=e.aggFuncService,this.columnModel=e.columnModel,this.columnApplyStateService=e.columnApplyStateService}selectAllChildren(e,t,s){const i=this.extractAllLeafColumns(e);this.setAllColumns(i,t,s)}setColumn(e,t,s){this.setAllColumns([e],t,s)}setAllColumns(e,t,s){this.columnModel.isPivotMode()?this.setAllPivot(e,t,s):this.setAllVisible(e,t,s)}extractAllLeafColumns(e){const t=[],s=i=>{i.forEach(r=>{r.isPassesFilter()&&(r.isGroup()?s(r.getChildren()):t.push(r.getColumn()))})};return s(e),t}setAllVisible(e,t,s){const i=[];e.forEach(r=>{r.getColDef().lockVisible||r.isVisible()!=t&&i.push({colId:r.getId(),hide:!t})}),i.length>0&&this.columnApplyStateService.applyColumnState({state:i},s)}setAllPivot(e,t,s){this.setAllPivotActive(e,t,s)}setAllPivotActive(e,t,s){const i=[],o=t?n=>{if(!n.isAnyFunctionActive())if(n.isAllowValue()){const l=typeof n.getAggFunc()=="string"?n.getAggFunc():this.aggFuncService?.getDefaultAggFunc(n);i.push({colId:n.getId(),aggFunc:l})}else n.isAllowRowGroup()?i.push({colId:n.getId(),rowGroup:!0}):n.isAllowPivot()&&i.push({colId:n.getId(),pivot:!0})}:n=>{(n.isPivotActive()||n.isRowGroupActive()||n.isValueActive())&&i.push({colId:n.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};e.forEach(o),i.length>0&&this.columnApplyStateService.applyColumnState({state:i},s)}updateColumns(e){const{columns:t,visibleState:s,pivotState:i,eventType:r}=e,a=t.map(o=>{const n=o.getColId();if(this.columnModel.isPivotMode()){const l=i?.[n];return{colId:n,pivot:l?.pivot,rowGroup:l?.rowGroup,aggFunc:l?.aggFunc}}else return{colId:n,hide:!s?.[n]}});this.columnApplyStateService.applyColumnState({state:a},r)}createPivotState(e){return{pivot:e.isPivotActive(),rowGroup:e.isRowGroupActive(),aggFunc:e.isValueActive()?e.getAggFunc():void 0}}},wF="32.3.3",Ma=Pb({version:wF,moduleName:bb.ColumnsToolPanelModule,beans:[yF],userComponents:[{name:"agColumnsToolPanel",classImp:SF},{name:"agMenuItem",classImp:ke}],dependantModules:[H,gi,as]});import{ModuleNames as Fa,_defineModule as Aa}from"ag-grid-community";import{_CsvExportCoreModule as xF}from"ag-grid-community";import{_getHeaderClassesFromColDef as bF,_warnOnce as xh}from"ag-grid-community";import{BaseCreator as PF,Downloader as bh,RowType as Ph,ZipContainer as W}from"ag-grid-community";import{_last as TF,_mergeDeep as MF,_warnOnce as FF}from"ag-grid-community";import{BaseGridSerializingSession as AF,RowType as Ra}from"ag-grid-community";import{_escapeString as RF}from"ag-grid-community";import{XmlFactory as Th}from"ag-grid-community";import{ExcelFactoryMode as Mh,_escapeString as EF,_warnOnce as Ea}from"ag-grid-community";import{_escapeString as IF}from"ag-grid-community";import{_compose as DF,_escapeString as LF,_iterateObject as kF}from"ag-grid-community";import{_escapeString as Fh}from"ag-grid-community";import{ExcelFactoryMode as Ah,_warnOnce as GF}from"ag-grid-community";var OF=9525,Rh={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},BF=e=>Math.round(e*96/72),vt=e=>Math.ceil(e*OF),NF=e=>{if(e===void 0)return;const s=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf(e||"Automatic");return Math.max(s,0)},vi=(e,t)=>{if(!t)return;let s;return typeof t=="number"?s=t:s=t({rowIndex:e}),s},VF=(e,t)=>{const{colSpan:s,column:i}=e.position;if(e.width)if(s){const r=t.slice(i-1,i+s-1);let a=0;for(let o=0;o<r.length;o++){const n=r[o].getActualWidth();if(e.width<a+n){e.position.colSpan=o+1,e.totalWidth=e.width,e.width=e.totalWidth-a;break}a+=n}}else e.totalWidth=e.width},_F=(e,t)=>{const{rowSpan:s,row:i}=e.position;if(e.height)if(s){let r=0,a=0;for(let o=i;o<i+s;o++){const n=BF(vi(o,t)||20);if(e.height<r+n){e.position.rowSpan=a+1,e.totalHeight=e.height,e.height=e.totalHeight-r;break}r+=n,a++}}else e.totalHeight=e.height},se=(e,t)=>{const s=Th.createHeader({encoding:"UTF-8",standalone:"yes"}),i=Th.createXml(e);return t?i:`${s}${i}`},St=e=>{const i=String.fromCharCode,r=Math.floor(e/26),a=e%26;return!r||e===26?i(65+e-1):a?r<26?i(65+r-1)+i(65+a-1):St(r)+i(65+a-1):St(r-1)+"Z"},Ia=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},UF=e=>{const t=[];for(const s of e.keys()){const i=s.toString(),r={name:"t",textNode:RF(Ia(i),!1)};i.trim().length!==i.length&&(r.properties={rawMap:{"xml:space":"preserve"}}),t.push({name:"si",children:[r]})}return t},HF={getTemplate(e){const{name:t,ContentType:s,Extension:i,PartName:r}=e;return{name:t,properties:{rawMap:{Extension:i,PartName:r,ContentType:s}}}}},zF=HF,Si=e=>e==="jpg"?"jpeg":e,WF={getTemplate(e){const t=new Array(e).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${d+1}.xml`})),s=E.worksheetImages.size,i=E.worksheetHeaderFooterImages.size,r=E.worksheetDataTables.size,a={};E.workbookImageIds.forEach(h=>{a[Si(h.type)]=!0});const o=new Array(s).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${d+1}.xml`})),n=new Array(r).fill(void 0).map((h,d)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${E.getTableNameFromIndex(d)}.xml`})),l=Object.keys(a).map(h=>({name:"Default",ContentType:`image/${h}`,Extension:h}));i&&l.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});const c=[...l,{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"},...t,{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"},...o,...n,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"}].map(h=>zF.getTemplate(h));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:c}}},KF=WF,$F={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}]}}},jF=$F,Eh=(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()}]}),YF=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&&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}},qF=(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:[YF(e)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),Ih=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},XF=(e,t)=>({name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:e.color}},children:Ih(e)},{name:"a:srgbClr",properties:{rawMap:{val:t.color}},children:Ih(t)}]}),ZF=(e,t)=>{let s;if(e.transparency){const i=Math.min(Math.max(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(XF({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"}]}]}},JF=(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 a=e.rotation;s.properties={rawMap:{rot:Math.min(Math.max(a,0),360)*6e4}}}return{name:"xdr:spPr",children:[s,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},QF=e=>{e.fitCell=!!e.fitCell||!e.width||!e.height;const{position:t={},fitCell:s,width:i=0,height:r=0,totalHeight:a,totalWidth:o}=e,{offsetX:n=0,offsetY:l=0,row:c=1,rowSpan:h=1,column:d=1,colSpan:u=1}=t;return{from:{row:c-1,col:d-1,offsetX:vt(n),offsetY:vt(l)},to:{row:c-1+(s?1:h-1),col:d-1+(s?1:u-1),offsetX:vt(i+n),offsetY:vt(r+l)},height:vt(a||r),width:vt(o||i)}},eA=(e,t,s,i)=>({name:"xdr:pic",children:[qF(e,t+1),ZF(e,s+1),JF(e,i)]}),tA={getTemplate(e){const{sheetIndex:t}=e,s=E.worksheetImages.get(t),i=E.worksheetImageIds.get(t),r=s.map((a,o)=>{const n=QF(a);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[Eh("from",n.from),Eh("to",n.to),eA(a,o,i.get(a.id).index,n),{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}}},sA=tA,iA={getTemplate(e){const{Id:t,Type:s,Target:i}=e;return{name:"Relationship",properties:{rawMap:{Id:t,Type:s,Target:i}}}}},rA=iA,aA={getTemplate(e){const t=e.map(s=>rA.getTemplate(s));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:t}}},ns=aA,oA={getTemplate(e){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:e.size,uniqueCount:e.size}},children:UF(e)}}},nA=oA,lA=e=>{switch(e){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},cA={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},hA=["Dashed","DashDot","DashDotDot"],dA={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"},uA={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},pA={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},gA=e=>e?dA[e]||e:"none",ze=e=>e==null?e:(e.charAt(0)==="#"&&(e=e.substring(1)),e.length===6?"FF"+e:e),yi=(e,t)=>{if(!e)return"thin";const s=lA(t);if(e==="Continuous")return s;const i=cA[e];return s==="medium"&&hA.some(r=>r===i)?`medium${i}`:`${i.charAt(0).toLowerCase()}${i.substring(1)}`},mA=e=>uA[e]||"general",fA=e=>pA[e]||void 0,ls=e=>({name:"color",properties:{rawMap:{rgb:ze(e||"#000000")}}}),CA={getTemplate(e){const{left:t,right:s,top:i,bottom:r,diagonal:a}=e,o=t?[ls(t.color)]:void 0,n=s?[ls(s.color)]:void 0,l=i?[ls(i.color)]:void 0,c=r?[ls(r.color)]:void 0,h=a?[ls(a.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:t&&t.style}},children:o},{name:"right",properties:{rawMap:{style:s&&s.style}},children:n},{name:"top",properties:{rawMap:{style:i&&i.style}},children:l},{name:"bottom",properties:{rawMap:{style:r&&r.style}},children:c},{name:"diagonal",properties:{rawMap:{style:a&&a.style}},children:h}]}}},vA=CA,SA={getTemplate(e){return{name:"borders",properties:{rawMap:{count:e.length}},children:e.map(t=>vA.getTemplate(t))}}},yA=SA,wA=e=>{const s=["Context","LeftToRight","RightToLeft"].indexOf(e);return Math.max(s,0)},xA={getTemplate(e){const{horizontal:t,indent:s,readingOrder:i,rotate:r,shrinkToFit:a,vertical:o,wrapText:n}=e;return{name:"alignment",properties:{rawMap:{horizontal:t&&mA(t),indent:s,readingOrder:i&&wA(i),textRotation:r,shrinkToFit:a,vertical:o&&fA(o),wrapText:n}}}}},bA=xA,PA={getTemplate(e){const t=e.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:e.hideFormula===!0?1:0,locked:t}}}}},TA=PA,MA={getTemplate(e){const{alignment:t,borderId:s,fillId:i,fontId:r,numFmtId:a,protection:o,quotePrefix:n,xfId:l}=e,c=[];return t&&c.push(bA.getTemplate(t)),o&&c.push(TA.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:a?1:void 0,numFmtId:a,quotePrefix:n?1:void 0,xfId:l}},children:c.length?c:void 0}}},Dh=MA,FA={getTemplate(e){return{name:"cellStyleXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dh.getTemplate(t))}}},AA=FA,RA={getTemplate(e){const{builtinId:t,name:s,xfId:i}=e;return{name:"cellStyle",properties:{rawMap:{builtinId:t,name:s,xfId:i}}}}},EA=RA,IA={getTemplate(e){return{name:"cellStyles",properties:{rawMap:{count:e.length}},children:e.map(t=>EA.getTemplate(t))}}},DA=IA,LA={getTemplate(e){return{name:"cellXfs",properties:{rawMap:{count:e.length}},children:e.map(t=>Dh.getTemplate(t))}}},kA=LA,GA={getTemplate(e){const{patternType:t,fgTheme:s,fgTint:i,fgRgb:r,bgRgb:a,bgIndexed:o}=e,n={name:"patternFill",properties:{rawMap:{patternType:t}}};return(s||i||r)&&(n.children=[{name:"fgColor",properties:{rawMap:{theme:s,tint:i,rgb:r}}}]),(o||a)&&(n.children||(n.children=[]),n.children.push({name:"bgColor",properties:{rawMap:{indexed:o,rgb:a}}})),{name:"fill",children:[n]}}},OA=GA,BA={getTemplate(e){return{name:"fills",properties:{rawMap:{count:e.length}},children:e.map(t=>OA.getTemplate(t))}}},NA=BA,VA={getTemplate(e){const{size:t,colorTheme:s,color:i="FF000000",fontName:r="Calibri",family:a,scheme:o,italic:n,bold:l,strikeThrough:c,outline:h,shadow:d,underline:u,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 a&&g.push({name:"family",properties:{rawMap:{val:a}}}),o&&g.push({name:"scheme",properties:{rawMap:{val:o}}}),n&&g.push({name:"i"}),l&&g.push({name:"b"}),c&&g.push({name:"strike"}),h&&g.push({name:"outline"}),d&&g.push({name:"shadow"}),u&&g.push({name:"u",properties:{rawMap:{val:u}}}),p&&g.push({name:"vertAlign",properties:{rawMap:{val:p}}}),{name:"font",children:g}}},_A=VA,UA={getTemplate(e){return{name:"fonts",properties:{rawMap:{count:e.length}},children:e.map(t=>_A.getTemplate(t))}}},HA=UA;function zA(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]=IF(i))}return t.join("")}var WA={getTemplate(e){let{formatCode:t,numFmtId:s}=e;return t.length&&(t=zA(t)),{name:"numFmt",properties:{rawMap:{formatCode:t,numFmtId:s}}}}},KA=WA,$A={getTemplate(e){return{name:"numFmts",properties:{rawMap:{count:e.length}},children:e.map(t=>KA.getTemplate(t))}}},jA=$A,wi,yt,cs,hs,ds,Lh,xi,kh,Da,Gh=(e,t)=>(e.indexOf("mixedStyle")!==-1&&t>1&&(e+=`_${t}`),e),Oh=()=>{wi={base:0},yt=[],cs=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],hs=[{patternType:"none"},{patternType:"gray125"}],ds=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],Lh=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],xi=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],kh=[{builtinId:0,name:"Normal",xfId:0}]},YA=e=>{const t=gA(e.pattern),s=ze(e.color),i=ze(e.patternColor);let r=hs.findIndex(a=>{const{patternType:o,fgRgb:n,bgRgb:l}=a;return!(o!=t||n!=s||l!=i)});return r===-1&&(r=hs.length,hs.push({patternType:t,fgRgb:s,bgRgb:i})),r},qA=e=>{if(Rh[e])return Rh[e];let t=yt.findIndex(s=>s.formatCode===e);return t===-1?(t=yt.length+164,yt.push({formatCode:e,numFmtId:t})):t=yt[t].numFmtId,t},XA=e=>{const{borderBottom:t,borderTop:s,borderLeft:i,borderRight:r}=e;let a,o,n,l,c,h,d,u;i&&(n=yi(i.lineStyle,i.weight),d=ze(i.color)),r&&(l=yi(r.lineStyle,r.weight),u=ze(r.color)),t&&(a=yi(t.lineStyle,t.weight),c=ze(t.color)),s&&(o=yi(s.lineStyle,s.weight),h=ze(s.color));let p=ds.findIndex(g=>{const{left:m,right:C,top:f,bottom:v}=g;if(!m&&(n||d)||!C&&(l||u)||!f&&(o||h)||!v&&(a||c))return!1;const{style:S,color:y}=m||{},{style:w,color:b}=C||{},{style:P,color:F}=f||{},{style:A,color:M}=v||{};return!(S!=n||y!=d||w!=l||b!=u||P!=o||F!=h||A!=a||M!=c)});return p===-1&&(p=ds.length,ds.push({left:{style:n,color:d},right:{style:l,color:u},top:{style:o,color:h},bottom:{style:a,color:c},diagonal:{style:void 0,color:void 0}})),p},ZA=e=>{const{fontName:t="Calibri",color:s,size:i,bold:r,italic:a,outline:o,shadow:n,strikeThrough:l,underline:c,family:h,verticalAlign:d}=e,u=ze(s),p=NF(h),g=c?c.toLocaleLowerCase():void 0,m=d?d.toLocaleLowerCase():void 0;let C=cs.findIndex(f=>!(f.fontName!=t||f.color!=u||f.size!=i||f.bold!=r||f.italic!=a||f.outline!=o||f.shadow!=n||f.strikeThrough!=l||f.underline!=g||f.verticalAlign!=m||f.family!=p));return C===-1&&(C=cs.length,cs.push({fontName:t,color:u,size:i,bold:r,italic:a,outline:o,shadow:n,strikeThrough:l,underline:g,verticalAlign:m,family:p?.toString()})),C},JA=e=>{const{alignment:t,borders:s,font:i,interior:r,numberFormat:a,protection:o,quotePrefix:n}=e;let{id:l}=e,c=0,h=0,d=0,u=0;l&&(l=Gh(l,Da),wi[l]==null&&(r&&(c=YA(r)),s&&(h=XA(s)),i&&(d=ZA(i)),a&&(u=qA(a.format)),wi[l]=xi.length,xi.push({alignment:t,borderId:h||0,fillId:c||0,fontId:d||0,numFmtId:u||0,protection:o,quotePrefix:n,xfId:0})))},QA={getTemplate(e){const t=jA.getTemplate(yt),s=HA.getTemplate(cs.map(l=>({...l,size:l.size!=null?l.size:e}))),i=NA.getTemplate(hs),r=yA.getTemplate(ds),a=AA.getTemplate(Lh),o=kA.getTemplate(xi),n=DA.getTemplate(kh);return Oh(),{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,a,o,n,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},eR=(e,t)=>wi[Gh(e,t)]||0,tR=(e,t)=>{Da=t,Da===1&&Oh(),e.forEach(JA)},sR=QA,iR={getTemplate(e,t){const{name:s,columns:i,rowCount:r,displayName:a,headerRowIndex:o,showRowStripes:n,showColumnStripes:l,showFilterButtons:c,highlightFirstColumn:h,highlightLastColumn:d}=e||{};if(!e||!s||!Array.isArray(i)||!i.length||!r)return{name:"table"};const u=i.map((S,y)=>({name:"filterColumn",properties:{rawMap:{colId:y.toString(),hiddenButton:c[y]?0:1}}})),p=o+1,g=(t+1).toString(),m=`A${p}`,C=`${String.fromCharCode(64+i.length)}${p+r}`,f=`${m}:${C}`,v=t?`${a}_${t+1}`:a;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:s,displayName:v,ref:f,totalsRowShown:0,id:g}},children:[{name:"autoFilter",properties:{rawMap:{ref:f}},children:u},{name:"tableColumns",properties:{rawMap:{count:i.length}},children:i.map((S,y)=>({name:"tableColumn",properties:{rawMap:{id:(y+1).toString(),name:S,dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:h?1:0,showLastColumn:d?1:0,showRowStripes:n?1:0,showColumnStripes:l?1:0}}}]}}},rR=iR,ue=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,children:[{name:`a:${s}`,properties:{rawMap:{val:i,lastClr:r}}}]}},aR={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[ue(["dk1","sysClr","windowText","000000"]),ue(["lt1","sysClr","window","FFFFFF"]),ue(["dk2","srgbClr","44546A"]),ue(["lt2","srgbClr","E7E6E6"]),ue(["accent1","srgbClr","4472C4"]),ue(["accent2","srgbClr","ED7D31"]),ue(["accent3","srgbClr","A5A5A5"]),ue(["accent4","srgbClr","FFC000"]),ue(["accent5","srgbClr","5B9BD5"]),ue(["accent6","srgbClr","70AD47"]),ue(["hlink","srgbClr","0563C1"]),ue(["folHlink","srgbClr","954F72"])]}}},oR=aR,x=e=>{const[t,s,i,r]=e;return{name:`a:${t}`,properties:{rawMap:{script:i,typeface:s,panose:r}}}},nR={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[x(["latin","Calibri Light",void 0,"020F0302020204030204"]),x(["ea",""]),x(["cs",""]),x(["font","\u6E38\u30B4\u30B7\u30C3\u30AF Light","Jpan"]),x(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),x(["font","\u7B49\u7EBF Light","Hans"]),x(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),x(["font","Times New Roman","Arab"]),x(["font","Times New Roman","Hebr"]),x(["font","Tahoma","Thai"]),x(["font","Nyala","Ethi"]),x(["font","Vrinda","Beng"]),x(["font","Shruti","Gujr"]),x(["font","MoolBoran","Khmr"]),x(["font","Tunga","Knda"]),x(["font","Raavi","Guru"]),x(["font","Euphemia","Cans"]),x(["font","Plantagenet Cherokee","Cher"]),x(["font","Microsoft Yi Baiti","Yiii"]),x(["font","Microsoft Himalaya","Tibt"]),x(["font","MV Boli","Thaa"]),x(["font","Mangal","Deva"]),x(["font","Gautami","Telu"]),x(["font","Latha","Taml"]),x(["font","Estrangelo Edessa","Syrc"]),x(["font","Kalinga","Orya"]),x(["font","Kartika","Mlym"]),x(["font","DokChampa","Laoo"]),x(["font","Iskoola Pota","Sinh"]),x(["font","Mongolian Baiti","Mong"]),x(["font","Times New Roman","Viet"]),x(["font","Microsoft Uighur","Uigh"]),x(["font","Sylfaen","Geor"]),x(["font","Arial","Armn"]),x(["font","Leelawadee UI","Bugi"]),x(["font","Microsoft JhengHei","Bopo"]),x(["font","Javanese Text","Java"]),x(["font","Segoe UI","Lisu"]),x(["font","Myanmar Text","Mymr"]),x(["font","Ebrima","Nkoo"]),x(["font","Nirmala UI","Olck"]),x(["font","Ebrima","Osma"]),x(["font","Phagspa","Phag"]),x(["font","Estrangelo Edessa","Syrn"]),x(["font","Estrangelo Edessa","Syrj"]),x(["font","Estrangelo Edessa","Syre"]),x(["font","Nirmala UI","Sora"]),x(["font","Microsoft Tai Le","Tale"]),x(["font","Microsoft New Tai Lue","Talu"]),x(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[x(["latin","Calibri",void 0,"020F0502020204030204"]),x(["ea",""]),x(["cs",""]),x(["font","\u6E38\u30B4\u30B7\u30C3\u30AF","Jpan"]),x(["font","\uB9D1\uC740 \uACE0\uB515","Hang"]),x(["font","\u7B49\u7EBF","Hans"]),x(["font","\u65B0\u7D30\u660E\u9AD4","Hant"]),x(["font","Arial","Arab"]),x(["font","Arial","Hebr"]),x(["font","Tahoma","Thai"]),x(["font","Nyala","Ethi"]),x(["font","Vrinda","Beng"]),x(["font","Shruti","Gujr"]),x(["font","DaunPenh","Khmr"]),x(["font","Tunga","Knda"]),x(["font","Raavi","Guru"]),x(["font","Euphemia","Cans"]),x(["font","Plantagenet Cherokee","Cher"]),x(["font","Microsoft Yi Baiti","Yiii"]),x(["font","Microsoft Himalaya","Tibt"]),x(["font","MV Boli","Thaa"]),x(["font","Mangal","Deva"]),x(["font","Gautami","Telu"]),x(["font","Latha","Taml"]),x(["font","Estrangelo Edessa","Syrc"]),x(["font","Kalinga","Orya"]),x(["font","Kartika","Mlym"]),x(["font","DokChampa","Laoo"]),x(["font","Iskoola Pota","Sinh"]),x(["font","Mongolian Baiti","Mong"]),x(["font","Arial","Viet"]),x(["font","Microsoft Uighur","Uigh"]),x(["font","Sylfaen","Geor"]),x(["font","Arial","Armn"]),x(["font","Leelawadee UI","Bugi"]),x(["font","Microsoft JhengHei","Bopo"]),x(["font","Javanese Text","Java"]),x(["font","Segoe UI","Lisu"]),x(["font","Myanmar Text","Mymr"]),x(["font","Ebrima","Nkoo"]),x(["font","Nirmala UI","Olck"]),x(["font","Ebrima","Osma"]),x(["font","Phagspa","Phag"]),x(["font","Estrangelo Edessa","Syrn"]),x(["font","Estrangelo Edessa","Syrj"]),x(["font","Estrangelo Edessa","Syre"]),x(["font","Nirmala UI","Sora"]),x(["font","Microsoft Tai Le","Tale"]),x(["font","Microsoft New Tai Lue","Talu"]),x(["font","Ebrima","Tfng"])]}]}}},lR=nR,ye=(e,t,s)=>({name:`a:${e}`,properties:{rawMap:{val:t}},children:s}),La=e=>{const[t,s,i,r,a,o]=e,n=[];return n.push(ye("satMod",i)),r&&n.push(ye("lumMod",r)),a&&n.push(ye("tint",a)),o&&n.push(ye("shade",o)),{name:"a:gs",properties:{rawMap:{pos:t}},children:[{name:"a:schemeClr",properties:{rawMap:{val:s}},children:n}]}},bi=(e,t)=>({name:"a:solidFill",children:[ye("schemeClr",e,t)]}),ka=e=>{const[t,s,i,r,a]=e,[o,n]=a;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:t}},children:[{name:"a:gsLst",children:[La(s),La(i),La(r)]},{name:"a:lin",properties:{rawMap:{ang:o,scaled:n}}}]}},Ga=e=>{const[t,s,i,r]=e;return{name:"a:ln",properties:{rawMap:{w:t,cap:s,cmpd:i,algn:r}},children:[bi("phClr"),ye("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},Oa=e=>{const t=[];if(e){const[s,i,r,a,o]=e;t.push({name:"a:outerShdw",properties:{rawMap:{blurRad:s,dist:i,dir:r,algn:a,rotWithShape:o}},children:[ye("srgbClr","000000",[ye("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},t.length?{children:t}:{})]}},cR=()=>({name:"a:fillStyleLst",children:[bi("phClr"),ka(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),ka(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),hR=()=>({name:"a:lnStyleLst",children:[Ga(["6350","flat","sng","ctr"]),Ga(["12700","flat","sng","ctr"]),Ga(["19050","flat","sng","ctr"])]}),dR=()=>({name:"a:effectStyleLst",children:[Oa(),Oa(),Oa(["57150","19050","5400000","ctr","0"])]}),uR=()=>({name:"a:bgFillStyleLst",children:[bi("phClr"),bi("phClr",[ye("tint","95000"),ye("satMod","170000")]),ka(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),pR={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[cR(),hR(),dR(),uR()]}}},gR=pR,mR={getTemplate(){return{name:"a:themeElements",children:[oR.getTemplate(),lR.getTemplate(),gR.getTemplate()]}}},fR=mR,CR={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[fR.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},vR=CR,SR=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),yR=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),wR=e=>({name:"v:formulas",children:e.map(t=>({name:"v:f",properties:{rawMap:{eqn:t}}}))}),xR=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),Bh=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 bR(e,t,s,i,r){return(e-t)/(s-t)*(r-i)+i}var PR=(e,t)=>{let s;const{recolor:i,brightness:r,contrast:a,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={}),a!=null&&a!==50){let n="1";a>=0&&(a<50?n=String(a/50):a<100?n=String(50/(100-a)):a===100&&(n="2147483647f")),s.gain=n}r!=null&&r!==50&&(s.blacklevel=bR(r,0,100,-.5,.5).toString())}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${t}`,title:o}}],rawMap:s}}},TR=()=>{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:[yR(),wR(e),xR(),Bh({aspectratio:!0})]}},Nh=e=>Math.floor((e??0)*.74999943307122),MR=(e,t)=>{const{width:s=0,height:i=0,altText:r}=e,a=Nh(s),o=Nh(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: ${a}pt; height: ${o}pt; z-index: ${t+1}`,type:"#_x0000_t75",alt:r}},children:[PR(e,t+1),Bh({rotation:!0})]}},FR={getTemplate(e){const t=E.worksheetHeaderFooterImages.get(e.sheetIndex)||[],s=[SR(),TR(),...t.map((i,r)=>MR(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}}},AR=FR,RR={getTemplate(e,t){const s=(t+1).toString();return{name:"sheet",properties:{rawMap:{name:e,sheetId:s,"r:id":`rId${s}`}}}}},ER=RR,IR={getTemplate(e){return{name:"sheets",children:e.map((t,s)=>ER.getTemplate(t,s))}}},DR=IR,LR={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}}}]},DR.getTemplate(e)]}}},kR=LR,GR=e=>Math.ceil((e-12)/7+1),OR={getTemplate(e){const{min:t,max:s,outlineLevel:i,s:r,width:a,hidden:o,bestFit:n}=e;let l=1,c="0";return a>1&&(l=GR(a),c="1"),{name:"col",properties:{rawMap:{min:t,max:s,outlineLevel:i??void 0,width:l,style:r,hidden:o?"1":"0",bestFit:n?"1":"0",customWidth:c}}}}},BR=OR,NR={getTemplate(e){return{name:"mergeCell",properties:{rawMap:{ref:e}}}}},VR=NR,_R=e=>{const t=e.charAt(0).toLowerCase();return t==="s"?"inlineStr":t},UR={getTemplate(e,t,s){const{ref:i,data:r,styleId:a}=e,{type:o,value:n}=r||{type:"empty",value:null};let l=o;o==="f"?l="str":o.charAt(0)===o.charAt(0).toUpperCase()&&(l=_R(o));const c={name:"c",properties:{rawMap:{r:i,t:l==="empty"?void 0:l,s:a?eR(a,s):void 0}}};if(l==="empty")return c;let h;return l==="str"&&o==="f"?h=[{name:"f",textNode:Fh(Ia(n),!1)}]:l==="inlineStr"?h=[{name:"is",children:[{name:"t",textNode:Fh(Ia(n),!1)}]}]:h=[{name:"v",textNode:n}],Object.assign({},c,{children:h})}},HR=UR,zR=(e,t)=>{const s=[];let i=0;for(let r=0;r<e.length;r++){const a=e[r];a.mergeAcross&&(s.push({pos:r,excelPos:i}),i+=a.mergeAcross),i++}if(s.length)for(let r=s.length-1;r>=0;r--){const a=[],o=e[s[r].pos];for(let n=1;n<=o.mergeAcross;n++)a.push({ref:`${St(s[r].excelPos+1+n)}${t+1}`,styleId:o.styleId,data:{type:"empty",value:null}});a.length&&e.splice(s[r].pos+1,0,...a)}},WR=e=>e.data?.value!==""||e.styleId!==void 0,KR={getTemplate(e,t,s){const{collapsed:i,hidden:r,height:a,outlineLevel:o,cells:n=[]}=e;zR(n,t);const l=n.filter(WR).map((c,h)=>HR.getTemplate(c,h,s));return{name:"row",properties:{rawMap:{r:t+1,collapsed:i?"1":"0",hidden:r?"1":"0",ht:a,customHeight:a!=null?"1":"0",spans:"1:1",outlineLevel:o||void 0}},children:l}}},$R=KR,jR=(e,t,s)=>{const i=[],r=[];e.forEach((n,l)=>{const c=n.cells;let h=0,d;c.forEach((u,p)=>{const g=p+h+1,m=St(g),C=l+1;if(u.mergeAcross){h+=u.mergeAcross;const v=St(p+h+1);i.push(`${m}${C}:${v}${C}`)}t[g-1]||(t[g-1]={});const{collapsibleRanges:f}=u;f&&f.forEach(v=>{r.push([g+v[0],g+v[1]])}),d=t[g-1],d.min=g,d.max=g,u.ref=`${m}${C}`})}),r.sort((n,l)=>n[0]!==l[0]?n[0]-l[0]:l[1]-n[1]);const a=new Map,o=new Map;return r.filter(n=>{const l=n.toString();return a.get(l)?!1:(a.set(l,!0),!0)}).forEach(n=>{const l=t.find(h=>h.min==n[0]&&h.max==n[1]),c=o.get(n[0]);t.push({min:n[0],max:n[1],outlineLevel:s?void 0:c||1,width:(l||{width:100}).width}),o.set(n[0],(c||0)+1)}),i},YR=e=>!e||e!=="Portrait"&&e!=="Landscape"?"portrait":e.toLocaleLowerCase(),qR=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},XR=e=>(kF({"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"},(s,i)=>{e=e.replace(s,i)}),e),ZR=e=>e==="Center"?"C":e==="Right"?"R":"L",JR=(e,t)=>(t&&(e+="&amp;&quot;",e+=t.fontName||"Calibri",t.bold!==t.italic?e+=t.bold?",Bold":",Italic":t.bold?e+=",Bold Italic":e+=",Regular",e+="&quot;",t.size&&(e+=`&amp;${t.size}`),t.strikeThrough&&(e+="&amp;S"),t.underline&&(e+=`&amp;${t.underline==="Double"?"E":"U"}`),t.color&&(e+=`&amp;K${t.color.replace("#","").toUpperCase()}`)),e),QR=(e,t,s)=>e.reduce((i,r,a)=>{const o=ZR(r.position),n=JR(`${i}&amp;${o}`,r.font),l=["Left","Center","Right"];r.position||(r.position=l[a]);const{image:c}=r;if(r.value==="&[Picture]"&&c){const h=`${o}${t}${s}`;E.addHeaderFooterImageToMap(c,h)}return`${n}${LF(XR(r.value))}`},""),eE=e=>{const t=["all","first","even"],s=[];return t.forEach(i=>{const r=e[i],a=i==="all"?"odd":i;if(r)for(const[o,n]of Object.entries(r)){const l=`${o.charAt(0).toUpperCase()}${o.slice(1)}`,c=o[0].toUpperCase();if(n){const h=i==="all"?"":i.toUpperCase();s.push({name:`${a}${l}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:QR(n,c,h)})}}}),s},tE=e=>t=>(e.length&&t.children.push({name:"cols",children:e.map(s=>BR.getTemplate(s))}),t),sE=(e,t)=>s=>(e.length&&s.children.push({name:"sheetData",children:e.map((i,r)=>$R.getTemplate(i,r,t))}),s),iE=e=>t=>(e.length&&t.children.push({name:"mergeCells",properties:{rawMap:{count:e.length}},children:e.map(s=>VR.getTemplate(s))}),t),rE=e=>t=>{const{top:s=.75,right:i=.7,bottom:r=.75,left:a=.7,header:o=.3,footer:n=.3}=e;return t.children.push({name:"pageMargins",properties:{rawMap:{bottom:r,footer:n,header:o,left:a,right:i,top:s}}}),t},aE=e=>t=>(e&&t.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:YR(e.orientation),paperSize:qR(e.pageSize)}}}),t),oE=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:eE(e)}),t},nE=e=>t=>(e&&t.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}]}),t),lE=e=>t=>(E.worksheetImages.get(e)?.length&&t.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),cE=e=>t=>(E.worksheetHeaderFooterImages.get(e)&&t.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++t.rIdCounter}`}}}),t),hE=(e=0,t=0)=>{const s=e>0||t>0;return s?[{name:"pane",properties:{rawMap:{state:s?"frozen":void 0,topLeftCell:s?`${St(e+1)}${t+1}`:void 0,xSplit:e===0?void 0:e,ySplit:t===0?void 0:t}}}]:void 0},dE=(e=!1,t,s)=>i=>(i.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:e===!0?"1":"0",workbookViewId:"0"}},children:hE(t,s)}]}),i),uE=()=>e=>(e.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),e),pE=e=>t=>{const s=e.reduce((i,r)=>r.outlineLevel&&r.outlineLevel>i?r.outlineLevel:i,0);return t.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:s||void 0}}}),t},gE={getTemplate(e){const{worksheet:t,currentSheet:s,config:i}=e,{margins:r={},pageSetup:a,headerFooterConfig:o,suppressColumnOutline:n,rightToLeft:l,frozenRowCount:c,frozenColumnCount:h}=i,{table:d}=t,{rows:u,columns:p}=d,g=p&&p.length?jR(u,p,!!n):[],{worksheetDataTables:m}=E,C=m.get(s),f=DF(uE(),dE(l,h,c),pE(u),tE(p),sE(u,s+1),iE(g),rE(r),aE(a),oE(o),lE(s),cE(s),nE(C)),{children:v}=f({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}}},mE=gE,me=class wu{static createExcel(t,s,i){this.addSheetName(s),tR(t,this.sheetNames.length);const r=Object.assign({},i);return i.exportAsExcelTable&&(i.columnModel.isPivotActive()&&(this.showExcelTableNonCompatibleFeaturesWarning("pivot mode"),r.exportAsExcelTable=!1),i.gos.get("masterDetail")&&(this.showExcelTableNonCompatibleFeaturesWarning("master/detail"),r.exportAsExcelTable=!1)),this.processTableConfig(s,r),this.createWorksheet(s,r)}static showExcelTableNonCompatibleFeaturesWarning(t){Ea(`Excel table export does not work with ${t}. The exported Excel file will not contain any Excel tables.
373
+ Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromIndex(t){return`table${t+1}`}static getSanitizedTableName(t){return t.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}static addTableToSheet(t,s){if(this.worksheetDataTables.has(t)){Ea("Unable to add data table to Excel sheet: A table already exists.");return}this.worksheetDataTables.set(t,s)}static processTableConfig(t,s){if(!s.exportAsExcelTable)return;const i=typeof s.exportAsExcelTable=="boolean"?{}:s.exportAsExcelTable,{name:r,showColumnStripes:a,showRowStripes:o,showFilterButton:n,highlightFirstColumn:l,highlightLastColumn:c}=i,h=this.getSanitizedTableName(r||wu.defaultTableDisplayName),d=this.sheetNames.length-1,{table:u}=t,{rows:p,columns:g}=u,m=s.columnModel.getHeaderRowCount(),C=m-1,f=p.length,v=g.length,S=[],y=[];for(let w=0;w<v;w++){const b=g[w];S.push(b.displayName||""),y.push(n==="match"||n===void 0?b.filterAllowed??!1:n)}if(!S||!S.length||!f||!h){Ea("Unable to add data table to Excel sheet: Missing required parameters.");return}this.addTableToSheet(d,{name:this.getTableNameFromIndex(d),displayName:h,columns:S,showFilterButtons:y,headerRowIndex:C,rowCount:f-m,showRowStripes:o??!0,showColumnStripes:a??!1,highlightFirstColumn:l??!1,highlightLastColumn:c??!1})}static addHeaderFooterImageToMap(t,s){const i=this.sheetNames.length-1,r=t;r.headerFooterPosition=s,this.buildImageMap({imageToAdd:r,idx:i});let a=this.worksheetHeaderFooterImages.get(i);a||(a=[],this.worksheetHeaderFooterImages.set(i,a)),a.find(o=>o.id===t.id)||a.push(t)}static addBodyImageToMap(t,s,i,r,a){const o=this.sheetNames.length,{row:n,column:l}=t.position||{},c=t;r&&(s!=null&&i!=null&&(!n||!l)&&(t.position||(t.position={}),t.position=Object.assign({},t.position,{row:s,column:r.indexOf(i)+1})),VF(c,r),_F(c,a)),this.buildImageMap({imageToAdd:c,idx:o});let h=this.worksheetImageIds.get(o);h||(h=new Map,this.worksheetImageIds.set(o,h));const d=this.worksheetImages.get(o);d?d.push(c):this.worksheetImages.set(o,[c]),h.get(t.id)||h.set(t.id,{index:h.size,type:t.imageType})}static buildImageMap(t){const{imageToAdd:s,idx:i}=t,r=this.images.get(s.id);if(r){const a=r.find(o=>o.sheetId===i);a?a.image.push(s):r.push({sheetId:i,image:[s]})}else this.images.set(s.id,[{sheetId:i,image:[s]}]),this.workbookImageIds.set(s.id,{type:s.imageType,index:this.workbookImageIds.size})}static addSheetName(t){const s=EF(t.name)||"";let i="";for(;this.sheetNames.indexOf(`${s}${i}`)!==-1;)i===""?i="_1":i=`_${parseInt(i.slice(1),10)+1}`;t.name=`${s}${i}`,this.sheetNames.push(t.name)}static getStringPosition(t){return this.sharedStrings.has(t)?this.sharedStrings.get(t):(this.sharedStrings.set(t,this.sharedStrings.size),this.sharedStrings.size-1)}static resetFactory(){this.sharedStrings=new Map,this.images=new Map,this.worksheetImages=new Map,this.worksheetHeaderFooterImages=new Map,this.workbookImageIds=new Map,this.worksheetImageIds=new Map,this.worksheetDataTables=new Map,this.sheetNames=[],this.factoryMode=Mh.SINGLE_SHEET}static createWorkbook(t){return se(kR.getTemplate(this.sheetNames,t))}static createStylesheet(t){return se(sR.getTemplate(t))}static createSharedStrings(){return se(nA.getTemplate(this.sharedStrings))}static createCore(t){return se(jF.getTemplate(t))}static createContentTypes(t){return se(KF.getTemplate(t))}static createRels(){const t=ns.getTemplate([{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"}]);return se(t)}static createTheme(){return se(vR.getTemplate())}static createTable(t,s){return se(rR.getTemplate(t,s))}static createWorkbookRels(t){const s=new Array(t).fill(void 0).map((r,a)=>({Id:`rId${a+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${a+1}.xml`})),i=ns.getTemplate([...s,{Id:`rId${t+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${t+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${t+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return se(i)}static createDrawing(t){return se(sA.getTemplate({sheetIndex:t}))}static createDrawingRel(t){const s=this.worksheetImageIds.get(t)||[],i=[];for(const[r,a]of s){const{index:o,type:n}=a;i.push({Id:`rId${o+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${this.workbookImageIds.get(r).index+1}.${Si(n)}`})}return se(ns.getTemplate(i))}static createVmlDrawing(t){return se(AR.getTemplate({sheetIndex:t}),!0)}static createVmlDrawingRel(t){const s=this.worksheetHeaderFooterImages.get(t)||[],i=[];for(let r=0;r<s.length;r++){const a=s[r],o=this.workbookImageIds.get(a.id);if(!o)continue;const{index:n,type:l}=o;i.push({Id:`rId${r+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${n+1}.${Si(l)}`})}return se(ns.getTemplate(i))}static createRelationships({drawingIndex:t,vmlDrawingIndex:s,tableIndex:i}={}){if(t===void 0&&s===void 0&&i===void 0)return"";const r=[];t!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",Target:`../drawings/drawing${t+1}.xml`}),s!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing",Target:`../drawings/vmlDrawing${s+1}.vml`}),i!=null&&r.push({Id:`rId${r.length+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",Target:`../tables/${this.getTableNameFromIndex(i)}.xml`});const a=ns.getTemplate(r);return se(a)}static createWorksheet(t,s){return se(mE.getTemplate({worksheet:t,currentSheet:this.sheetNames.length-1,config:s}))}};me.sharedStrings=new Map,me.sheetNames=[],me.images=new Map,me.worksheetImages=new Map,me.worksheetHeaderFooterImages=new Map,me.workbookImageIds=new Map,me.worksheetImageIds=new Map,me.worksheetDataTables=new Map,me.defaultTableDisplayName="AG-GRID-TABLE",me.factoryMode=Mh.SINGLE_SHEET;var E=me,fE=class extends AF{constructor(e){super(e),this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.config=Object.assign({},e),this.stylesByIds={},this.config.baseExcelStyles.forEach(t=>{this.stylesByIds[t.id]=t}),this.excelStyles=[...this.config.baseExcelStyles,{id:"_quotePrefix",quotePrefix:1}]}addCustomContent(e){e.forEach(t=>{const s=this.rows.length+1;let i;!this.config.suppressRowOutline&&t.outlineLevel!=null&&(i=t.outlineLevel);const r={height:vi(s,t.height||this.config.rowHeight),cells:(t.cells||[]).map((a,o)=>{const n=this.addImage(s,this.columnsToExport[o],a.data?.value);let l=null;a.styleId&&(l=typeof a.styleId=="string"?[a.styleId]:a.styleId);const c=this.getStyleId(l);if(n)return this.createCell(c,this.getDataTypeForValue(n.value),n.value==null?"":n.value);const h=a.data?.value??"",d=this.getDataTypeForValue(h);return a.mergeAcross?this.createMergedCell(c,d,h,a.mergeAcross):this.createCell(c,d,h)}),outlineLevel:i};t.collapsed!=null&&(r.collapsed=t.collapsed),t.hidden!=null&&(r.hidden=t.hidden),this.rows.push(r)})}onNewHeaderGroupingRow(){const e=[],{freezeRows:t,headerRowHeight:s}=this.config;return this.rows.push({cells:e,height:vi(this.rows.length+1,s)}),t&&this.frozenRowCount++,{onColumn:(i,r,a,o,n)=>{const l=this.config.styleLinker({rowType:Ra.HEADER_GROUPING,rowIndex:1,value:`grouping-${r}`,columnGroup:i});e.push({...this.createMergedCell(this.getStyleId(l),this.getDataTypeForValue("string"),r,o),collapsibleRanges:n})}}}onNewHeaderRow(){const{freezeRows:e,headerRowHeight:t}=this.config;return e&&this.frozenRowCount++,this.onNewRow(this.onNewHeaderColumn,t)}onNewBodyRow(e){const{freezeRows:t,rowHeight:s}=this.config;this.skipFrozenRows||(t==="headersAndPinnedRows"&&e?.rowPinned==="top"?this.frozenRowCount++:typeof t=="function"?t({...this.gos.getGridCommonParams(),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.columnsToExport=[...e],this.cols=e.map((t,s)=>this.convertColumnToExcel(t,s))}parse(){const e=this.rows.reduce((r,a)=>Math.max(r,a.cells.length),0);for(;this.cols.length<e;)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));const{config:t}=this;let s;if(t.sheetName!=null){const{sheetName:r}=t,a=typeof r=="function"?r(this.gos.getGridCommonParams()):r;s=String(a).substring(0,31)}else s="ag-grid";const i={name:s,table:{columns:this.cols,rows:this.rows}};return this.createExcel(i)}addRowOutlineIfNecessary(e){const{gos:t,suppressRowOutline:s,rowGroupExpandState:i="expanded"}=this.config;if(t.get("groupHideOpenParents")||s||e.level==null)return;const a=e.footer?1:0,o=TF(this.rows),n=Math.min(e.level+a,7);if(o.outlineLevel=n,i==="expanded")return;const l=i==="collapsed";if(e.isExpandable()){const c=!l&&e.expanded;o.collapsed=!c}o.hidden=!!e.parent&&e.parent.level!==-1&&(l||this.isAnyParentCollapsed(e.parent))}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)??"",a=e?e.isFilterAllowed():!1;return s?typeof s=="number"?{width:s,displayName:r,filterAllowed:a}:{width:s({column:e,index:t}),displayName:r,filterAllowed:a}:e?{width:Math.max(e.getActualWidth(),75),displayName:r,filterAllowed:a}:{displayName:r,filterAllowed:a}}onNewHeaderColumn(e,t){return s=>{const i=this.extractHeaderValue(s),r=this.config.styleLinker({rowType:Ra.HEADER,rowIndex:e,value:i,column:s});t.push(this.createCell(this.getStyleId(r),this.getDataTypeForValue("string"),i))}}onNewBodyColumn(e,t){let s=0;const{freezeColumns:i,rightToLeft:r}=this.config;return(a,o,n)=>{if(s>0){s-=1;return}if(!this.skipFrozenColumns){const g=a.getPinned();i==="pinned"&&g&&(g===!0||g==="left")!==r?this.frozenColumnCount++:typeof i=="function"&&i({...this.gos.getGridCommonParams(),column:a})?this.frozenColumnCount++:this.skipFrozenColumns=!0}const{value:l,valueFormatted:c}=this.extractRowCellValue(a,o,e,"excel",n),h=this.config.styleLinker({rowType:Ra.BODY,rowIndex:e,value:l,column:a,node:n}),d=this.getStyleId(h),u=a.getColSpan(n),p=this.addImage(e,a,l);p?t.push(this.createCell(d,this.getDataTypeForValue(p.value),p.value==null?"":p.value)):u>1?(s=u-1,t.push(this.createMergedCell(d,this.getDataTypeForValue(l),l,u-1))):t.push(this.createCell(d,this.getDataTypeForValue(l),l,c))}}onNewRow(e,t){const s=[];return this.rows.push({cells:s,height:vi(this.rows.length+1,t)}),{onColumn:e.bind(this,this.rows.length,s)()}}createExcel(e){const{excelStyles:t,config:s}=this;return this.frozenColumnCount&&(s.frozenColumnCount=this.frozenColumnCount),this.frozenRowCount&&(s.frozenRowCount=this.frozenRowCount),E.createExcel(t,e,s)}getDataTypeForValue(e){return e===void 0?"empty":this.isNumerical(e)?"n":"s"}getTypeFromStyle(e,t){if(this.isFormula(t))return"f";if(e&&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:FF(`Unrecognized data type for excel export [${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 E.addBodyImageToMap(i.image,e,t,this.columnsToExport,this.config.rowHeight),i}createCell(e,t,s,i){const r=this.getStyleById(e);!r?.dataType&&t==="s"&&i&&(s=i);const a=this.getTypeFromStyle(r,s)||t,{value:o,escaped:n}=this.getCellValue(a,s),l=[];return r&&l.push(e),n&&l.push("_quotePrefix"),e=this.getStyleId(l)||void 0,{styleId:e,data:{type:a,value:o}}}createMergedCell(e,t,s,i){const r=s??"";return{styleId:this.getStyleById(e)?e:void 0,data:{type:t,value:t==="s"?E.getStringPosition(r).toString():s},mergeAcross:i}}getCellValue(e,t){let s=!1;if(t==null||e==="s"&&t==="")return{value:"",escaped:!1};if(e==="s")t&&t[0]==="'"&&(s=!0,t=t.slice(1)),t=E.getStringPosition(t).toString();else if(e==="f")t=t.slice(1);else if(e==="n"){const i=Number(t);isNaN(i)?t="":t!==""&&(t=i.toString())}return{value:t,escaped:s}}getStyleId(e){if(!e||!e.length)return null;if(e.length===1)return e[0];const t=e.join("-");return this.mixedStyles[t]||this.addNewMixedStyle(e),this.mixedStyles[t].excelID}deepCloneObject(e){return JSON.parse(JSON.stringify(e))}addNewMixedStyle(e){this.mixedStyleCounter+=1;const t=`mixedStyle${this.mixedStyleCounter}`,s={};for(const r of e)for(const a of this.excelStyles)a.id===r&&MF(s,this.deepCloneObject(a));s.id=t,s.name=t;const i=e.join("-");this.mixedStyles[i]={excelID:t,key:i,result:s},this.excelStyles.push(s),this.stylesByIds[t]=s}isFormula(e){return e==null?!1:this.config.autoConvertFormulas&&e.toString().startsWith("=")}isNumerical(e){return typeof e=="bigint"?!0:isFinite(e)&&e!==""&&!isNaN(parseFloat(e))}getStyleById(e){return e==null?null:this.stylesByIds[e]||null}},CE=()=>{W.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]);const{images:e}=E;if(!e.size)return;W.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let t=0;e.forEach(s=>{const i=s[0].image[0],{base64:r,imageType:a}=i;W.addFile(`xl/media/image${++t}.${Si(a)}`,r,!0)})},vE=e=>{let t=0,s=0,i=0;const{images:r,worksheetDataTables:a,worksheetImages:o,worksheetHeaderFooterImages:n}=E;for(let l=0;l<e.length;l++){const c=e[l];W.addFile(`xl/worksheets/sheet${l+1}.xml`,c,!1);const h=r.size>0&&o.has(l),d=a.size>0&&a.has(l),u=r.size&&n.has(l);if(!h&&!d&&!u)continue;let p,g,m;h&&(SE(l,t),g=t,t++),u&&(yE(l,s),m=s,s++),d&&(p=i++);const C=`xl/worksheets/_rels/sheet${l+1}.xml.rels`;W.addFile(C,E.createRelationships({tableIndex:p,drawingIndex:g,vmlDrawingIndex:m}))}},SE=(e,t)=>{const s="xl/drawings",i=`${s}/drawing${t+1}.xml`,r=`${s}/_rels/drawing${t+1}.xml.rels`;W.addFile(r,E.createDrawingRel(e)),W.addFile(i,E.createDrawing(e))},yE=(e,t)=>{const s="xl/drawings",i=`${s}/vmlDrawing${t+1}.vml`,r=`${s}/_rels/vmlDrawing${t+1}.vml.rels`;W.addFile(i,E.createVmlDrawing(e)),W.addFile(r,E.createVmlDrawingRel(e))},wE=()=>{const{worksheetDataTables:e}=E,t=e,s=Array.from(t.keys());for(let i=0;i<s.length;i++){const r=s[i],a=t.get(r);a&&W.addFile(`xl/tables/${a.name}.xml`,E.createTable(a,i))}},xE=(e,t,s,i)=>{W.addFile("xl/workbook.xml",E.createWorkbook(i)),W.addFile("xl/styles.xml",E.createStylesheet(e)),W.addFile("xl/sharedStrings.xml",E.createSharedStrings()),W.addFile("xl/theme/theme1.xml",E.createTheme()),W.addFile("xl/_rels/workbook.xml.rels",E.createWorkbookRels(s)),W.addFile("docProps/core.xml",E.createCore(t)),W.addFile("[Content_Types].xml",E.createContentTypes(s)),W.addFile("_rels/.rels",E.createRels())},Vh=(e,t={})=>{if(!e||e.length===0)return xh("Invalid params supplied to createExcelFileForExcel() - `ExcelExportParams.data` is empty."),E.resetFactory(),!1;const{fontSize:s=11,author:i="AG Grid",activeTab:r=0}=t,a=e.length,o=Math.max(Math.min(r,a-1),0);return CE(),wE(),vE(e),xE(s,i,a,o),E.resetFactory(),!0},_h=e=>{const{data:t,fontSize:s,author:i,activeSheetIndex:r}=e,a=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";return Vh(t,{author:i,fontSize:s,activeTab:r})?W.getZipFile(a):Promise.resolve(void 0)},Pi=e=>{const{data:t,fontSize:s,author:i,activeSheetIndex:r}=e,a=e.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet";if(Vh(t,{author:i,fontSize:s,activeTab:r}))return W.getUncompressedZipFile(a)},Ba=e=>{const{fileName:t="export.xlsx"}=e;_h(e).then(s=>{if(s){const i=typeof t=="function"?t():t;bh.download(i,s)}})},bE=class extends PF{constructor(){super(...arguments),this.beanName="excelCreator"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.funcColsService=e.funcColsService,this.valueService=e.valueService,this.stylingService=e.stylingService,this.gridSerializer=e.gridSerializer,this.gos=e.gos}postConstruct(){this.setBeans({gridSerializer:this.gridSerializer,gos:this.gos})}getMergedParams(e){const t=this.gos.get("defaultExcelExportParams");return Object.assign({},t,e)}export(e){if(this.isExportSuppressed()){xh("Export cancelled. Export is not allowed as per your configuration.");return}const t=this.getMergedParams(e),i={data:[this.getData(t)],fontSize:t.fontSize,author:t.author,mimeType:t.mimeType};this.packageCompressedFile(i).then(r=>{if(r){const{fileName:a}=t,o=typeof a=="function"?a(this.gos.getGridCommonParams()):a;bh.download(this.getFileName(o),r)}})}exportDataAsExcel(e){this.export(e)}getDataAsExcel(e){const t=this.getMergedParams(e),i={data:[this.getData(t)],fontSize:t.fontSize,author:t.author,mimeType:t.mimeType};return this.packageFile(i)}setFactoryMode(e){E.factoryMode=e}getFactoryMode(){return E.factoryMode}getSheetDataForExcel(e){const t=this.getMergedParams(e);return this.getData(t)}getMultipleSheetsAsExcel(e){return Pi(e)}exportMultipleSheetsAsExcel(e){Ba(e)}getDefaultFileExtension(){return"xlsx"}createSerializingSession(e){const{columnModel:t,columnNameService:s,funcColsService:i,valueService:r,gos:a}=this,o={...e,columnModel:t,columnNameService:s,funcColsService:i,valueService:r,gos:a,suppressRowOutline:e.suppressRowOutline||e.skipRowGroups,headerRowHeight:e.headerRowHeight||e.rowHeight,baseExcelStyles:this.gos.get("excelStyles")||[],rightToLeft:e.rightToLeft??this.gos.get("enableRtl"),styleLinker:this.styleLinker.bind(this)};return new fE(o)}styleLinker(e){const{rowType:t,rowIndex:s,value:i,column:r,columnGroup:a,node:o}=e,n=t===Ph.HEADER,l=t===Ph.HEADER_GROUPING,c=n?r:a;let h=[];if(n||l)return h.push("header"),l&&h.push("headerGroup"),c&&(h=h.concat(bF(c.getDefinition(),this.gos,r||null,a||null))),h;const d=this.gos.get("excelStyles"),u=["cell"];if(!d||!d.length)return u;const p=d.map(m=>m.id),g=r.getDefinition();return this.stylingService.processAllCellClasses(g,this.gos.addGridCommonParams({value:i,data:o.data,node:o,colDef:g,column:r,rowIndex:s}),m=>{p.indexOf(m)>-1&&u.push(m)}),u.sort((m,C)=>p.indexOf(m)<p.indexOf(C)?-1:1)}isExportSuppressed(){return this.gos.get("suppressExcelExport")}packageCompressedFile(e){return _h(e)}packageFile(e){return Pi(e)}};function Uh(e){return e.excelCreator?.getFactoryMode()===Ah.MULTI_SHEET?(GF("The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'"),!1):!0}function PE(e,t){if(Uh(e))return e.excelCreator?.getDataAsExcel(t)}function TE(e,t){Uh(e)&&e.excelCreator?.exportDataAsExcel(t)}function ME(e,t){return e.excelCreator?.setFactoryMode(Ah.MULTI_SHEET),e.excelCreator?.getSheetDataForExcel(t)}function FE(e,t){return e.excelCreator?.getMultipleSheetsAsExcel(t)}function AE(e,t){e.excelCreator?.exportMultipleSheetsAsExcel(t)}var Na="32.3.3",Hh=Aa({version:Na,moduleName:`${Fa.ExcelExportModule}-core`,beans:[bE],dependantModules:[xF,H]}),RE=Aa({version:Na,moduleName:`${Fa.ExcelExportModule}-api`,apiFunctions:{getDataAsExcel:PE,exportDataAsExcel:TE,getSheetDataForExcel:ME,getMultipleSheetsAsExcel:FE,exportMultipleSheetsAsExcel:AE},dependantModules:[Hh]}),Va=Aa({version:Na,moduleName:Fa.ExcelExportModule,dependantModules:[Hh,RE]});import{ModuleNames as EE,_ColumnFilterModule as IE,_defineModule as DE}from"ag-grid-community";import{Component as LE,RefPlaceholder as zh}from"ag-grid-community";import{AgInputTextFieldSelector as kE,Component as GE,RefPlaceholder as Wh,_createIconNoSpan as _a,_debounce as OE,_setDisplayed as us}from"ag-grid-community";import{Component as BE,_clearElement as NE,_exists as Ua,_flatten as Ha,_getActiveDomElement as VE,_includes as Kh,_mergeDeep as _E,_setAriaLabel as UE,_warnOnce as $h,isProvidedColumnGroup as jh}from"ag-grid-community";import{Component as HE,FilterWrapperComp as zE,KeyCode as Yh,RefPlaceholder as ps,_clearElement as WE,_createIconNoSpan as za,_loadTemplate as KE,_setAriaExpanded as qh,_setDisplayed as We}from"ag-grid-community";import{Component as $E,RefPlaceholder as jE,_clearElement as YE,_createIconNoSpan as qE,isProvidedColumnGroup as Ti}from"ag-grid-community";var XE=class extends GE{constructor(){super(...arguments),this.eExpand=Wh,this.eFilterTextField=Wh}wireBeans(e){this.columnModel=e.columnModel}postConstruct(){this.setTemplate(`<div class="ag-filter-toolpanel-search" role="presentation">
374
374
  <div data-ref="eExpand" class="ag-filter-toolpanel-expand"></div>
375
375
  <ag-input-text-field data-ref="eFilterTextField" class="ag-filter-toolpanel-search-input"></ag-input-text-field>
376
376
  </div>`,[kE]);const e=this.localeService.getLocaleTextFunc();this.eFilterTextField.setAutoComplete(!1).setInputAriaLabel(e("ariaFilterColumnsInput","Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)),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.columnModel.isReady()&&this.showOrHideOptions()}createExpandIcons(){this.eExpand.appendChild(this.eExpandChecked=_a("columnSelectOpen",this.gos)),this.eExpand.appendChild(this.eExpandUnchecked=_a("columnSelectClosed",this.gos)),this.eExpand.appendChild(this.eExpandIndeterminate=_a("columnSelectIndeterminate",this.gos))}showOrHideOptions(){const e=!this.params.suppressFilterSearch,t=!this.params.suppressExpandAll,s=this.localeService.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(s("searchOoo","Search..."));const i=a=>a.getOriginalParent()&&a.isFilterAllowed(),r=this.columnModel.getCols().some(i);us(this.eFilterTextField.getGui(),e),us(this.eExpand,t&&r)}onSearchTextChanged(){this.onSearchTextChangedDebounced||(this.onSearchTextChangedDebounced=OE(()=>{this.dispatchLocalEvent({type:"searchChanged",searchText:this.eFilterTextField.getValue()})},300)),this.onSearchTextChangedDebounced()}onExpandClicked(){const e=this.currentExpandState===0?{type:"collapseAll"}:{type:"expandAll"};this.dispatchLocalEvent(e)}setExpandState(e){this.currentExpandState=e,us(this.eExpandChecked,this.currentExpandState===0),us(this.eExpandUnchecked,this.currentExpandState===1),us(this.eExpandIndeterminate,this.currentExpandState===2)}},ZE={selector:"AG-FILTERS-TOOL-PANEL-HEADER",component:XE},Xh=class extends HE{constructor(e,t){super(`
@@ -386,14 +386,14 @@ Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromInd
386
386
  </div>`,[G],{filterGroupComp:t}),this.setGroupTitle(),this.filterGroupComp.setAlignItems("stretch"),this.filterGroupComp.addCssClass(`ag-filter-toolpanel-group-level-${this.depth}`),this.filterGroupComp.getGui().style.setProperty("--ag-indentation-level",String(this.depth)),this.filterGroupComp.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${this.depth}-header`),this.childFilterComps.forEach(s=>{this.filterGroupComp.addItem(s),s.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${this.depth+1}-header`),s.getGui().style.setProperty("--ag-indentation-level",String(this.depth+1))}),this.refreshFilterClass(),this.addExpandCollapseListeners(),this.addFilterChangedListeners(),this.setupTooltip(),this.addInIcon("filter")}setupTooltip(){if(!this.showingColumn)return;const t=this.gos.get("tooltipShowMode")==="whenTruncated";let s;t&&(s=()=>{const a=this.filterGroupComp.getGui().querySelector(".ag-group-title");return a?a.scrollWidth>a.clientWidth:!0});const i=()=>{const r=this.columnGroup.getColDef().headerTooltip;this.setTooltip({newTooltipText:r,location:"filterToolPanelColumnGroup",shouldDisplayTooltip:s})};i(),this.addManagedEventListeners({newColumnsLoaded:i})}getTooltipParams(){const t=super.getTooltipParams();return t.location="filterToolPanelColumnGroup",t}addCssClassToTitleBar(t){this.filterGroupComp.addCssClassToTitleBar(t)}refreshFilters(t){this.childFilterComps.forEach(s=>{s instanceof xu?s.refreshFilters(t):s.refreshFilter(t)})}isColumnGroup(){return Ti(this.columnGroup)}isExpanded(){return this.filterGroupComp.isExpanded()}getChildren(){return this.childFilterComps}getFilterGroupName(){return this.filterGroupName?this.filterGroupName:""}getFilterGroupId(){return this.columnGroup.getId()}hideGroupItem(t,s){this.filterGroupComp.hideItem(t,s)}hideGroup(t){this.setDisplayed(!t)}addInIcon(t){const s=qE(t,this.gos);s&&s.classList.add("ag-filter-toolpanel-group-instance-header-icon"),this.filterGroupComp.addTitleBarWidget(s)}forEachToolPanelFilterChild(t){this.childFilterComps.forEach(s=>{s instanceof Xh&&t(s)})}addExpandCollapseListeners(){const t=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(i=>i.expand()),s=this.isColumnGroup()?()=>this.expandedCallback():()=>this.forEachToolPanelFilterChild(i=>i.collapse());this.addManagedListeners(this.filterGroupComp,{expanded:t,collapsed:s})}getColumns(){return Ti(this.columnGroup)?this.columnGroup.getLeafColumns():[this.columnGroup]}addFilterChangedListeners(){this.getColumns().forEach(t=>{this.addManagedListeners(t,{filterChanged:()=>this.refreshFilterClass()})}),Ti(this.columnGroup)||this.addManagedEventListeners({filterOpened:this.onFilterOpened.bind(this)})}refreshFilterClass(){const t=this.getColumns(),s=()=>t.some(i=>i.isFilterActive());this.filterGroupComp.addOrRemoveCssClass("ag-has-filter",s())}onFilterOpened(t){t.source==="COLUMN_MENU"&&t.column===this.columnGroup&&this.isExpanded()&&this.collapse()}expand(){this.filterGroupComp.toggleGroupExpand(!0)}collapse(){this.filterGroupComp.toggleGroupExpand(!1)}setGroupTitle(){this.filterGroupName=Ti(this.columnGroup)?this.getColumnGroupName(this.columnGroup):this.getColumnName(this.columnGroup),this.filterGroupComp.setTitle(this.filterGroupName||"")}getColumnGroupName(t){return this.columnNameService.getDisplayNameForProvidedColumnGroup(null,t,"filterToolPanel")}getColumnName(t){return this.columnNameService.getDisplayNameForColumn(t,"filterToolPanel",!1)}destroyFilters(){this.childFilterComps=this.destroyBeans(this.childFilterComps),YE(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},JE=class extends BE{constructor(){super('<div class="ag-filter-list-panel"></div>'),this.initialised=!1,this.hasLoadedInitialState=!1,this.isInitialState=!1,this.filterGroupComps=[],this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending=!1}wireBeans(e){this.toolPanelColDefService=e.toolPanelColDefService,this.columnModel=e.columnModel}init(e){this.initialised=!0;const t=this.gos.addGridCommonParams({suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});_E(t,e),this.params=t,this.params.suppressSyncLayoutWithGrid||this.addManagedEventListeners({columnMoved:()=>this.onColumnsChanged()}),this.addManagedEventListeners({newColumnsLoaded:()=>this.onColumnsChanged(),toolPanelVisibleChanged:s=>{s.key==="filters"&&this.refreshFilters(s.visible)},dragStarted:()=>{this.suppressOnColumnsChanged=!0},dragStopped:()=>{this.suppressOnColumnsChanged=!1,this.onColumnsChangedPending&&(this.onColumnsChangedPending=!1,this.onColumnsChanged())}}),this.columnModel.isReady()&&this.onColumnsChanged()}onColumnsChanged(){if(this.suppressOnColumnsChanged){this.onColumnsChangedPending=!0;return}const e=this.columnModel.isPivotMode();!this.params.suppressSyncLayoutWithGrid&&!e?this.syncFilterLayout():this.buildTreeFromProvidedColumnDefs(),this.refreshAriaLabel()}syncFilterLayout(){this.toolPanelColDefService.syncLayoutWithGrid(this.setFiltersLayout.bind(this)),this.refreshAriaLabel()}buildTreeFromProvidedColumnDefs(){const e=this.columnModel.getColDefColTree();this.recreateFilters(e)}setFiltersLayout(e){const t=this.toolPanelColDefService.createColumnTree(e);this.recreateFilters(t)}recreateFilters(e){const t=VE(this.gos);this.hasLoadedInitialState||(this.hasLoadedInitialState=!0,this.isInitialState=!!this.params.initialState);const s=this.getExpansionState();this.destroyFilters(),this.filterGroupComps=this.recursivelyAddComps(e,0,s);const i=this.filterGroupComps.length;i&&(this.filterGroupComps.forEach(r=>this.appendChild(r)),this.setFirstAndLastVisible(0,i-1)),Ua(this.searchFilterText)&&this.searchFilters(this.searchFilterText),this.fireExpandedEvent(),this.getGui().contains(t)&&t.focus(),this.isInitialState=!1,this.refreshAriaLabel()}recursivelyAddComps(e,t,s){return Ha(e.map(i=>{if(jh(i))return Ha(this.recursivelyAddFilterGroupComps(i,t,s));const r=i;if(!this.shouldDisplayFilter(r))return[];const a=t===0,o=new Xh(a,()=>this.onFilterExpanded());if(this.createBean(o),o.setColumn(r),s.get(r.getId())&&o.expand(),t>0)return o;const n=this.createBean(new Ke(r,[o],this.onGroupExpanded.bind(this),t,!0));return n.addCssClassToTitleBar("ag-filter-toolpanel-header"),s.get(n.getFilterGroupId())||n.collapse(),n}))}refreshAriaLabel(){const e=this.localeService.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;UE(this.getAriaElement(),`${t} ${l} ${s}`)}recursivelyAddFilterGroupComps(e,t,s){if(!this.filtersExistInChildren(e.getChildren()))return;const i=e.getColGroupDef();if(i&&i.suppressFiltersToolPanel)return[];const r=e.isPadding()?t:t+1,a=Ha(this.recursivelyAddComps(e.getChildren(),r,s));if(e.isPadding())return a;const o=new Ke(e,a,this.onGroupExpanded.bind(this),t,!1);this.createBean(o),o.addCssClassToTitleBar("ag-filter-toolpanel-header");const n=s.get(o.getFilterGroupId());return(this.isInitialState&&!n||n===!1)&&o.collapse(),[o]}filtersExistInChildren(e){return e.some(t=>jh(t)?this.filtersExistInChildren(t.getChildren()):this.shouldDisplayFilter(t))}shouldDisplayFilter(e){const t=e.getColDef()&&e.getColDef().suppressFiltersToolPanel;return e.isFilterAllowed()&&!t}getExpansionState(){const e=new Map;if(this.isInitialState){const{expandedColIds:s,expandedGroupIds:i}=this.params.initialState;return s.forEach(r=>e.set(r,!0)),i.forEach(r=>e.set(r,!0)),e}const t=s=>{e.set(s.getFilterGroupId(),s.isExpanded()),s.getChildren().forEach(i=>{i instanceof Ke?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)}expandFilterGroups(e,t){const s=[],i=r=>{const a=r.getFilterGroupId();(!t||Kh(t,a))&&(e&&r.isColumnGroup()?r.expand():r.collapse(),s.push(a)),r.getChildren().forEach(n=>{n instanceof Ke&&i(n)})};if(this.filterGroupComps.forEach(i),this.onGroupExpanded(),t){const r=t.filter(a=>s.indexOf(a)<0);r.length>0&&$h("unable to find groups for these supplied groupIds:",r)}}expandFilters(e,t){const s=[],i=r=>{if(r instanceof Ke){let n=!1;return r.getChildren().forEach(l=>{i(l)&&(e?(r.expand(),n=!0):r.isColumnGroup()||r.collapse())}),n}const a=r.getColumn().getColId(),o=!t||Kh(t,a);return o&&(e?r.expand():r.collapse(),s.push(a)),o};if(this.filterGroupComps.forEach(i),this.onGroupExpanded(),t){const r=t.filter(a=>s.indexOf(a)<0);r.length>0&&$h("unable to find columns for these supplied colIds:"+r)}}onGroupExpanded(){this.fireExpandedEvent()}onFilterExpanded(){this.dispatchLocalEvent({type:"filterExpanded"})}fireExpandedEvent(){let e=0,t=0;const s=r=>{r.isColumnGroup()&&(r.isExpanded()?e++:t++,r.getChildren().forEach(a=>{a instanceof Ke&&s(a)}))};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=Ua(e)?e.toLowerCase():null,this.searchFilters(this.searchFilterText)}searchFilters(e){const t=a=>!Ua(e)||a.toLowerCase().indexOf(e)!==-1,s=(a,o)=>{if(!(a instanceof Ke))return t(a.getColumnFilterName()||"");const n=a.getChildren(),l=t(a.getFilterGroupName()),c=o||l;if(c){a.hideGroup(!1);for(let d=0;d<n.length;d++)s(n[d],c),a.hideGroupItem(!1,d);return!0}let h=!1;return n.forEach((d,u)=>{const p=s(d,o);a.hideGroupItem(!p,u),p&&(h=!0)}),a.hideGroup(!h),h};let i,r;this.filterGroupComps.forEach((a,o)=>{s(a,!1),i===void 0?a.containsCssClass("ag-hidden")||(i=o,r=o):!a.containsCssClass("ag-hidden")&&r!==o&&(r=o)}),this.setFirstAndLastVisible(i,r),this.refreshAriaLabel()}setFirstAndLastVisible(e,t){this.filterGroupComps.forEach((s,i)=>{s.removeCssClass("ag-first-group-visible"),s.removeCssClass("ag-last-group-visible"),i===e&&s.addCssClass("ag-first-group-visible"),i===t&&s.addCssClass("ag-last-group-visible")})}refreshFilters(e){this.filterGroupComps.forEach(t=>t.refreshFilters(e))}getExpandedFiltersAndGroups(){const e=[],t=new Set,s=i=>{if(i instanceof Ke){i.getChildren().forEach(a=>s(a));const r=i.getFilterGroupId();i.isExpanded()&&!t.has(r)&&e.push(r)}else i.isExpanded()&&t.add(i.getColumn().getColId())};return this.filterGroupComps.forEach(s),{expandedGroupIds:e,expandedColIds:Array.from(t)}}destroyFilters(){this.filterGroupComps=this.destroyBeans(this.filterGroupComps),NE(this.getGui())}destroy(){this.destroyFilters(),super.destroy()}},QE={selector:"AG-FILTERS-TOOL-PANEL-LIST",component:JE},eI=class extends LE{constructor(){super(`<div class="ag-filter-toolpanel">
387
387
  <ag-filters-tool-panel-header data-ref="filtersToolPanelHeaderPanel"></ag-filters-tool-panel-header>
388
388
  <ag-filters-tool-panel-list data-ref="filtersToolPanelListPanel"></ag-filters-tool-panel-list>
389
- </div>`,[ZE,QE]),this.filtersToolPanelHeaderPanel=zh,this.filtersToolPanelListPanel=zh,this.initialised=!1,this.listenerDestroyFuncs=[]}init(e){this.initialised&&(this.listenerDestroyFuncs.forEach(r=>r()),this.listenerDestroyFuncs=[]),this.initialised=!0;const t=this.gos.addGridCommonParams({suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});this.params={...t,...e},this.filtersToolPanelHeaderPanel.init(this.params),this.filtersToolPanelListPanel.init(this.params);const s=this.params.suppressExpandAll,i=this.params.suppressFilterSearch;s&&i&&this.filtersToolPanelHeaderPanel.setDisplayed(!1),this.listenerDestroyFuncs.push(...this.addManagedListeners(this.filtersToolPanelHeaderPanel,{expandAll:this.onExpandAll.bind(this),collapseAll:this.onCollapseAll.bind(this),searchChanged:this.onSearchChanged.bind(this)}),...this.addManagedListeners(this.filtersToolPanelListPanel,{filterExpanded:this.onFilterExpanded.bind(this),groupExpanded:this.onGroupExpanded.bind(this)}))}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}onExpandAll(){this.filtersToolPanelListPanel.expandFilterGroups(!0)}onCollapseAll(){this.filtersToolPanelListPanel.expandFilterGroups(!1)}onSearchChanged(e){this.filtersToolPanelListPanel.performFilterSearch(e.searchText)}setFilterLayout(e){this.filtersToolPanelListPanel.setFiltersLayout(e)}onFilterExpanded(){this.params.onStateUpdated()}onGroupExpanded(e){this.filtersToolPanelHeaderPanel.setExpandState(e.state),this.params.onStateUpdated()}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()}destroy(){super.destroy()}},tI="32.3.2",Wa=DE({version:tI,moduleName:EE.FiltersToolPanelModule,beans:[],userComponents:[{name:"agFiltersToolPanel",classImp:eI}],dependantModules:[as,H,IE]});import{ModuleNames as Ka,_defineModule as $a}from"ag-grid-community";import{Component as sI,ModuleRegistry as iI,RefPlaceholder as rI,_missing as aI,_warnOnce as Zh,createGrid as oI}from"ag-grid-community";import{BeanStub as nI,_missing as lI,_warnOnce as ja}from"ag-grid-community";import{BeanStub as cI,_exists as hI,_iterateObject as dI}from"ag-grid-community";var Jh=class extends nI{constructor(){super(...arguments),this.loadRowDataVersion=0}wireBeans(e){this.focusService=e.focusService,this.rowPositionUtils=e.rowPositionUtils,this.environment=e.environment}init(e,t){this.params=t,this.comp=e,t.pinned==null&&(this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.addThemeToDetailGrid(),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};this.rowPositionUtils.sameRow(s,i)&&this.focusService.focusInto(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";this.comp.addOrRemoveCssClass(t,!0),this.comp.addOrRemoveDetailGridCssClass(s,!0)}setupRefreshStrategy(){const e=this.params.refreshStrategy;if(e=="everything"||e=="nothing"||e=="rows"){this.refreshStrategy=e;return}e!=null&&ja("invalid cellRendererParams.refreshStrategy = '"+e+"' supplied, defaulting to refreshStrategy = 'rows'."),this.refreshStrategy="rows"}addThemeToDetailGrid(){for(const e of this.environment.getThemeClasses())this.comp.addOrRemoveDetailGridCssClass(e,!0)}createDetailGrid(){if(lI(this.params.detailGridOptions)){ja("could not find detail grid options for master detail, please set gridOptions.detailCellRendererParams.detailGridOptions");return}const e={...this.params.detailGridOptions};this.gos.get("detailRowAutoHeight")&&(e.domLayout="autoHeight"),e.theme||(e.theme=this.gos.get("theme")),this.comp.setDetailGrid(e)}registerDetailWithMaster(e){const t=this.params.node.id,s=this.params.api,i={id:t,api:e},r=this.params.node;s.isDestroyed()||(s.addDetailGridInfo(t,i),r.detailGridInfo=i,this.addDestroyFunc(()=>{r.detailGridInfo===i&&(s.isDestroyed()||s.removeDetailGridInfo(t),r.detailGridInfo=null)}))}loadRowData(){this.loadRowDataVersion++;const e=this.loadRowDataVersion;if(this.params.detailGridOptions?.rowModelType==="serverSide"){this.params.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}const t=this.params.getDetailRowData;if(!t){ja("could not find getDetailRowData for master / detail, please set gridOptions.detailCellRendererParams.getDetailRowData");return}const s=r=>{this.loadRowDataVersion===e&&this.comp.setRowData(r)},i={node:this.params.node,data:this.params.node.data,successCallback:s,context:this.gos.getGridCommonParams().context};t(i)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},uI=class{constructor(e){this.parentWrapper=e}wrap(e,t,s,i){return this.parentWrapper.wrap(e,t,s,i)}},pI=class extends sI{constructor(){super(...arguments),this.eDetailGrid=rI}wireBeans(e){this.context=e.context}init(e){this.params=e,this.selectAndSetTemplate();const t={addOrRemoveCssClass:(s,i)=>this.addOrRemoveCssClass(s,i),addOrRemoveDetailGridCssClass:(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 Jh),this.ctrl.init(t,e)}refresh(){return this.ctrl&&this.ctrl.refresh()}destroy(){super.destroy()}selectAndSetTemplate(){if(this.params.pinned){this.setTemplate('<div class="ag-details-row"></div>');return}const e=()=>{this.setTemplate(`<div class="ag-details-row" role="gridcell">
389
+ </div>`,[ZE,QE]),this.filtersToolPanelHeaderPanel=zh,this.filtersToolPanelListPanel=zh,this.initialised=!1,this.listenerDestroyFuncs=[]}init(e){this.initialised&&(this.listenerDestroyFuncs.forEach(r=>r()),this.listenerDestroyFuncs=[]),this.initialised=!0;const t=this.gos.addGridCommonParams({suppressExpandAll:!1,suppressFilterSearch:!1,suppressSyncLayoutWithGrid:!1});this.params={...t,...e},this.filtersToolPanelHeaderPanel.init(this.params),this.filtersToolPanelListPanel.init(this.params);const s=this.params.suppressExpandAll,i=this.params.suppressFilterSearch;s&&i&&this.filtersToolPanelHeaderPanel.setDisplayed(!1),this.listenerDestroyFuncs.push(...this.addManagedListeners(this.filtersToolPanelHeaderPanel,{expandAll:this.onExpandAll.bind(this),collapseAll:this.onCollapseAll.bind(this),searchChanged:this.onSearchChanged.bind(this)}),...this.addManagedListeners(this.filtersToolPanelListPanel,{filterExpanded:this.onFilterExpanded.bind(this),groupExpanded:this.onGroupExpanded.bind(this)}))}setVisible(e){super.setDisplayed(e),e&&!this.initialised&&this.init(this.params)}onExpandAll(){this.filtersToolPanelListPanel.expandFilterGroups(!0)}onCollapseAll(){this.filtersToolPanelListPanel.expandFilterGroups(!1)}onSearchChanged(e){this.filtersToolPanelListPanel.performFilterSearch(e.searchText)}setFilterLayout(e){this.filtersToolPanelListPanel.setFiltersLayout(e)}onFilterExpanded(){this.params.onStateUpdated()}onGroupExpanded(e){this.filtersToolPanelHeaderPanel.setExpandState(e.state),this.params.onStateUpdated()}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()}destroy(){super.destroy()}},tI="32.3.3",Wa=DE({version:tI,moduleName:EE.FiltersToolPanelModule,beans:[],userComponents:[{name:"agFiltersToolPanel",classImp:eI}],dependantModules:[as,H,IE]});import{ModuleNames as Ka,_defineModule as $a}from"ag-grid-community";import{Component as sI,ModuleRegistry as iI,RefPlaceholder as rI,_missing as aI,_warnOnce as Zh,createGrid as oI}from"ag-grid-community";import{BeanStub as nI,_missing as lI,_warnOnce as ja}from"ag-grid-community";import{BeanStub as cI,_exists as hI,_iterateObject as dI}from"ag-grid-community";var Jh=class extends nI{constructor(){super(...arguments),this.loadRowDataVersion=0}wireBeans(e){this.focusService=e.focusService,this.rowPositionUtils=e.rowPositionUtils,this.environment=e.environment}init(e,t){this.params=t,this.comp=e,t.pinned==null&&(this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.addThemeToDetailGrid(),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};this.rowPositionUtils.sameRow(s,i)&&this.focusService.focusInto(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";this.comp.addOrRemoveCssClass(t,!0),this.comp.addOrRemoveDetailGridCssClass(s,!0)}setupRefreshStrategy(){const e=this.params.refreshStrategy;if(e=="everything"||e=="nothing"||e=="rows"){this.refreshStrategy=e;return}e!=null&&ja("invalid cellRendererParams.refreshStrategy = '"+e+"' supplied, defaulting to refreshStrategy = 'rows'."),this.refreshStrategy="rows"}addThemeToDetailGrid(){for(const e of this.environment.getThemeClasses())this.comp.addOrRemoveDetailGridCssClass(e,!0)}createDetailGrid(){if(lI(this.params.detailGridOptions)){ja("could not find detail grid options for master detail, please set gridOptions.detailCellRendererParams.detailGridOptions");return}const e={...this.params.detailGridOptions};this.gos.get("detailRowAutoHeight")&&(e.domLayout="autoHeight"),e.theme||(e.theme=this.gos.get("theme")),this.comp.setDetailGrid(e)}registerDetailWithMaster(e){const t=this.params.node.id,s=this.params.api,i={id:t,api:e},r=this.params.node;s.isDestroyed()||(s.addDetailGridInfo(t,i),r.detailGridInfo=i,this.addDestroyFunc(()=>{r.detailGridInfo===i&&(s.isDestroyed()||s.removeDetailGridInfo(t),r.detailGridInfo=null)}))}loadRowData(){this.loadRowDataVersion++;const e=this.loadRowDataVersion;if(this.params.detailGridOptions?.rowModelType==="serverSide"){this.params.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}const t=this.params.getDetailRowData;if(!t){ja("could not find getDetailRowData for master / detail, please set gridOptions.detailCellRendererParams.getDetailRowData");return}const s=r=>{this.loadRowDataVersion===e&&this.comp.setRowData(r)},i={node:this.params.node,data:this.params.node.data,successCallback:s,context:this.gos.getGridCommonParams().context};t(i)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},uI=class{constructor(e){this.parentWrapper=e}wrap(e,t,s,i){return this.parentWrapper.wrap(e,t,s,i)}},pI=class extends sI{constructor(){super(...arguments),this.eDetailGrid=rI}wireBeans(e){this.context=e.context}init(e){this.params=e,this.selectAndSetTemplate();const t={addOrRemoveCssClass:(s,i)=>this.addOrRemoveCssClass(s,i),addOrRemoveDetailGridCssClass:(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 Jh),this.ctrl.init(t,e)}refresh(){return this.ctrl&&this.ctrl.refresh()}destroy(){super.destroy()}selectAndSetTemplate(){if(this.params.pinned){this.setTemplate('<div class="ag-details-row"></div>');return}const e=()=>{this.setTemplate(`<div class="ag-details-row" role="gridcell">
390
390
  <div data-ref="eDetailGrid" class="ag-details-grid" role="presentation"></div>
391
- </div>`)};if(aI(this.params.template))e();else if(typeof this.params.template=="string")this.setTemplate(this.params.template,[]);else if(typeof this.params.template=="function"){const t=this.params.template,s=t(this.params);this.setTemplate(s,[])}else Zh("detailCellRendererParams.template should be function or string"),e();this.eDetailGrid==null&&Zh('Reference to eDetailGrid was missing from the details template. Please add data-ref="eDetailGrid" to the template.')}setDetailGrid(e){if(!this.eDetailGrid)return;const t=this.context.getBean("frameworkComponentWrapper"),s=new uI(t),i=this.getFrameworkOverrides(),r=oI(this.eDetailGrid,e,{frameworkOverrides:i,providedBeanInstances:{frameworkComponentWrapper:s},modules:iI.__getGridRegisteredModules(this.params.api.getGridId())});this.detailApi=r,this.ctrl.registerDetailWithMaster(r),this.addDestroyFunc(()=>{r?.destroy()})}setRowData(e){this.detailApi&&this.detailApi.setGridOption("rowData",e)}},gI=class extends cI{constructor(){super(...arguments),this.beanName="detailGridApiService",this.detailGridInfoMap={}}addDetailGridInfo(e,t){this.detailGridInfoMap[e]=t}removeDetailGridInfo(e){delete this.detailGridInfoMap[e]}getDetailGridInfo(e){return this.detailGridInfoMap[e]}forEachDetailGridInfo(e){let t=0;dI(this.detailGridInfoMap,(s,i)=>{hI(i)&&(e(i,t),t++)})}destroy(){this.detailGridInfoMap={},super.destroy()}};function mI(e,t,s){e.detailGridApiService?.addDetailGridInfo(t,s)}function fI(e,t){e.detailGridApiService?.removeDetailGridInfo(t)}function CI(e,t){return e.detailGridApiService?.getDetailGridInfo(t)}function vI(e,t){e.detailGridApiService?.forEachDetailGridInfo(t)}var Ya="32.3.2",Qh=$a({version:Ya,moduleName:`${Ka.MasterDetailModule}-core`,userComponents:[{name:"agGroupRowRenderer",classImp:ht},{name:"agGroupCellRenderer",classImp:ht},{name:"agDetailCellRenderer",classImp:pI}],controllers:[{name:"detailCellRenderer",classImp:Jh},{name:"groupCellRendererCtrl",classImp:Lt}],dependantModules:[H]}),SI=$a({version:Ya,moduleName:`${Ka.MasterDetailModule}-api`,beans:[gI],apiFunctions:{addDetailGridInfo:mI,removeDetailGridInfo:fI,getDetailGridInfo:CI,forEachDetailGridInfo:vI},dependantModules:[Qh]}),qa=$a({version:Ya,moduleName:Ka.MasterDetailModule,dependantModules:[Qh,SI]});import{ModuleNames as Xa,_CommunityMenuApiModule as yI,_defineModule as Za}from"ag-grid-community";import{BeanStub as wI,ModuleNames as xI,_createIconNoSpan as ed,_warnOnce as td}from"ag-grid-community";import{BeanStub as bI}from"ag-grid-community";import{BeanStub as PI,_isClientSideRowModel as TI,_removeRepeatsFromArray as MI}from"ag-grid-community";import{BeanStub as FI,Component as AI,ModuleNames as Mi,_exists as sd,_isIOSUserAgent as RI,_isNothingFocused as EI,_missingOrEmpty as II}from"ag-grid-community";import{AgPromise as Ja,BeanStub as id,Component as DI,FilterWrapperComp as LI,ModuleNames as kI,RefPlaceholder as GI,_createIconNoSpan as Qa,_warnOnce as OI,isColumn as BI}from"ag-grid-community";import{BeanStub as NI,ModuleNames as Re,_createIconNoSpan as j,_escapeString as eo,_exists as VI,_warnOnce as _I}from"ag-grid-community";import{BeanStub as UI,_getActiveDomElement as HI,_isNothingFocused as rd,_isVisible as zI,_last as WI}from"ag-grid-community";var KI=class bu extends wI{constructor(){super(...arguments),this.beanName="chartMenuItemMapper"}wireBeans(t){this.chartService=t.chartService}getChartItems(t){if(!this.chartService){this.gos.assertModuleRegistered(xI.GridChartsModule,`the Context Menu key "${t}"`);return}const s=t==="pivotChart"?new $I(this.gos,this.chartService,this.localeService):new jI(this.gos,this.chartService,this.localeService),i=this.chartService.isEnterprise();let r=s.getMenuItem();if(r&&r.subMenu&&!i){const o=n=>({...n,subMenu:n.subMenu?.filter(l=>!l._enterprise).map(l=>o(l))});r=o(r)}const a=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;return a&&(r=bu.filterAndOrderChartMenu(r,a,s.getConfigLookup())),this.cleanInternals(r)}cleanInternals(t){if(!t)return t;const s=i=>(delete i?._key,delete i?._enterprise,i?.subMenu?.forEach(r=>s(r)),i);return s(t)}static buildLookup(t){const s={},i=r=>{s[r._key]=r,r.subMenu&&r.subMenu.forEach(a=>i(a))};return i(t),s}static filterAndOrderChartMenu(t,s,i){const r=this.buildLookup(t),a={...t,subMenu:[]};if(Object.entries(s).forEach(([o,n])=>{const l=i[o];if(l===null)return;if(l==null){td(`invalid chartGroupsDef config '${o}'`);return}const c=r[l._key];if(c)if(c.subMenu){const h=n.map(d=>{const u=l[d];if(u==null){td(`invalid chartGroupsDef config '${o}.${d}'`);return}return r[u]}).filter(d=>d!==void 0);h.length>0&&(c.subMenu=h,a.subMenu?.push(c))}else a.subMenu?.push(c)}),a.subMenu?.length!=0)return a}},$I=class{constructor(e,t,s){this.gos=e,this.chartService=t,this.localeService=s}getMenuItem(){const e=this.localeService.getLocaleTextFunc(),t=(s,i,r,a,o=!1)=>({name:e(s,i),action:()=>this.chartService.createPivotChart({chartType:r}),_key:a,_enterprise:o});return{name:e("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped&lrm;","groupedColumn","pivotGroupedColumn"),t("stackedColumn","Stacked&lrm;","stackedColumn","pivotStackedColumn"),t("normalizedColumn","100% Stacked&lrm;","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped&lrm;","groupedBar","pivotGroupedBar"),t("stackedBar","Stacked&lrm;","stackedBar","pivotStackedBar"),t("normalizedBar","100% Stacked&lrm;","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:e("pieChart","Pie"),subMenu:[t("pie","Pie&lrm;","pie","pivotPie"),t("donut","Donut&lrm;","donut","pivotDonut")]},t("line","Line&lrm;","line","pivotLineChart"),{_key:"pivotXYChart",name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter&lrm;","scatter","pivotScatter"),t("bubble","Bubble&lrm;","bubble","pivotBubble")]},{_key:"pivotAreaChart",name:e("areaChart","Area"),subMenu:[t("area","Area&lrm;","area","pivotArea"),t("stackedArea","Stacked&lrm;","stackedArea","pivotStackedArea"),t("normalizedArea","100% Stacked&lrm;","normalizedArea","pivotNormalizedArea")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:e("statisticalChart","Statistical"),subMenu:[t("histogramChart","Histogram&lrm;","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemapChart","Treemap&lrm;","treemap","pivotTreemap",!0),t("sunburstChart","Sunburst&lrm;","sunburst","pivotSunburst",!0)]},{_key:"pivotCombinationChart",name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line&lrm;","columnLineCombo","pivotColumnLineCombo"),t("AreaColumnCombo","Area & Column&lrm;","areaColumnCombo","pivotAreaColumnCombo")]}],icon:ed("chart",this.gos,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"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},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},polarGroup:null,specializedGroup:null}}},jI=class{constructor(e,t,s){this.gos=e,this.chartService=t,this.localeService=s}getMenuItem(){const e=this.localeService.getLocaleTextFunc(),t=(s,i,r,a,o=!1)=>({name:e(s,i),action:()=>this.chartService.createChartFromCurrentRange(r),_key:a,_enterprise:o});return{name:e("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped&lrm;","groupedColumn","rangeGroupedColumn"),t("stackedColumn","Stacked&lrm;","stackedColumn","rangeStackedColumn"),t("normalizedColumn","100% Stacked&lrm;","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped&lrm;","groupedBar","rangeGroupedBar"),t("stackedBar","Stacked&lrm;","stackedBar","rangeStackedBar"),t("normalizedBar","100% Stacked&lrm;","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:e("pieChart","Pie"),subMenu:[t("pie","Pie&lrm;","pie","rangePie"),t("donut","Donut&lrm;","donut","rangeDonut")],_key:"rangePieChart"},t("line","Line&lrm;","line","rangeLineChart"),{name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter&lrm;","scatter","rangeScatter"),t("bubble","Bubble&lrm;","bubble","rangeBubble")],_key:"rangeXYChart"},{name:e("areaChart","Area"),subMenu:[t("area","Area&lrm;","area","rangeArea"),t("stackedArea","Stacked&lrm;","stackedArea","rangeStackedArea"),t("normalizedArea","100% Stacked&lrm;","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:e("polarChart","Polar"),subMenu:[t("radarLine","Radar Line&lrm;","radarLine","rangeRadarLine"),t("radarArea","Radar Area&lrm;","radarArea","rangeRadarArea"),t("nightingale","Nightingale&lrm;","nightingale","rangeNightingale"),t("radialColumn","Radial Column&lrm;","radialColumn","rangeRadialColumn"),t("radialBar","Radial Bar&lrm;","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:e("statisticalChart","Statistical"),subMenu:[t("boxPlot","Box Plot&lrm;","boxPlot","rangeBoxPlot",!0),t("histogramChart","Histogram&lrm;","histogram","rangeHistogram",!1),t("rangeBar","Range Bar&lrm;","rangeBar","rangeRangeBar",!0),t("rangeArea","Range Area&lrm;","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemap","Treemap&lrm;","treemap","rangeTreemap"),t("sunburst","Sunburst&lrm;","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:e("specializedChart","Specialized"),subMenu:[t("heatmap","Heatmap&lrm;","heatmap","rangeHeatmap"),t("waterfall","Waterfall&lrm;","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line&lrm;","columnLineCombo","rangeColumnLineCombo"),t("AreaColumnCombo","Area & Column&lrm;","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:ed("chart",this.gos,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"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},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"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}},YI=class extends bI{constructor(){super(...arguments),this.beanName="columnChooserFactory"}wireBeans(e){this.focusService=e.focusService,this.menuUtils=e.menuUtils,this.visibleColsService=e.visibleColsService}createColumnSelectPanel(e,t,s,i){const r=e.createManagedBean(new Ci),a=i??t?.getColDef().columnChooserParams??t?.getColDef().columnsMenuParams??{},{contractColumnSelection:o,suppressColumnExpandAll:n,suppressColumnFilter:l,suppressColumnSelectAll:c,suppressSyncLayoutWithGrid:h,columnLayout:d}=a;return r.init(!!s,this.gos.addGridCommonParams({suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!o,suppressColumnExpandAll:!!n,suppressColumnFilter:!!l,suppressColumnSelectAll:!!c,suppressSyncLayoutWithGrid:!!d||!!h,onStateUpdated:()=>{}}),"columnMenu"),d&&r.setColumnLayout(d),r}showColumnChooser({column:e,chooserParams:t,eventSource:s}){this.hideActiveColumnChooser();const i=this.createColumnSelectPanel(this,e,!0,t),r=this.localeService.getLocaleTextFunc(),a=this.visibleColsService.getAllCols().indexOf(e),o=e?this.focusService.getFocusedHeader():null;this.activeColumnChooserDialog=this.createBean(new Ze({title:r("chooseColumns","Choose Columns"),component:i,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{this.focusService.findNextFocusableElement(i.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,e)},closedCallback:n=>{const l=this.activeColumnChooser.getGui();this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,e),e&&this.menuUtils.restoreFocusOnClose({column:e,headerPosition:o,columnIndex:a,eventSource:s},l,n,!0)},postProcessPopupParams:{type:"columnChooser",column:e,eventSource:s}})),this.activeColumnChooser=i}hideActiveColumnChooser(){this.activeColumnChooserDialog&&this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent(e,t){this.eventService.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:!1,key:"columnChooser",column:t??null})}},wt="separator",qI=class extends PI{constructor(){super(...arguments),this.beanName="columnMenuFactory"}wireBeans(e){this.menuItemMapper=e.menuItemMapper,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.menuService=e.menuService}createMenu(e,t,s,i){const r=e.createManagedBean(new Je(0,{column:s??null,node:null,value:null})),a=this.menuItemMapper.mapWithStockItems(t,s??null,i,"columnMenu");return r.addMenuItems(a),r}getMenuItems(e,t){const s=this.getDefaultMenuOptions(e);let i;const r=e?.getColDef().mainMenuItems;if(Array.isArray(r))i=r;else if(typeof r=="function")i=r(this.gos.addGridCommonParams({column:e,defaultItems:s}));else{const a=this.gos.getCallback("getMainMenuItems");a&&e?i=a({column:e,defaultItems:s}):i=s}return MI(i,wt),i}getDefaultMenuOptions(e){const t=[],s=this.menuService.isLegacyMenuEnabled();if(!e)return s||t.push("columnChooser"),t.push("resetColumns"),t;const i=!e.getColDef().lockPinned,r=this.funcColsService.getRowGroupColumns().length,a=r>0,o=e.isAllowValue(),n=e.isAllowRowGroup(),l=e.isPrimary(),c=this.columnModel.isPivotMode(),h=TI(this.gos),d=this.gos.get("treeData"),u=l&&a&&o||!l;if(!s&&e.isSortable()){const m=e.getSort();m!=="asc"&&t.push("sortAscending"),m!=="desc"&&t.push("sortDescending"),m&&t.push("sortUnSort"),t.push(wt)}return this.menuService.isFilterMenuItemEnabled(e)&&(t.push("columnFilter"),t.push(wt)),i&&t.push("pinSubMenu"),u&&t.push("valueAggSubMenu"),(i||u)&&t.push(wt),t.push("autoSizeThis"),t.push("autoSizeAll"),t.push(wt),e.getColDef().showRowGroup?t.push("rowUnGroup"):n&&e.isPrimary()&&(e.isRowGroupActive()?this.columnModel.isColGroupLocked(e)||t.push("rowUnGroup"):t.push("rowGroup")),t.push(wt),s||t.push("columnChooser"),t.push("resetColumns"),h&&(d||r>(c?1:0))&&(t.push("expandAll"),t.push("contractAll")),t}},XI="ag-menu",ad="ag-context-menu-open",ZI=class extends FI{constructor(){super(...arguments),this.beanName="contextMenuFactory"}wireBeans(e){this.popupService=e.popupService,this.ctrlsService=e.ctrlsService,this.columnModel=e.columnModel,this.menuUtils=e.menuUtils,this.rangeService=e.rangeService,this.focusService=e.focusService}hideActiveMenu(){this.destroyBean(this.activeMenu)}getMenuItems(e,t,s){const i=[];if(sd(e)&&this.gos.isModuleRegistered(Mi.ClipboardModule)&&t&&(this.gos.get("suppressCutToClipboard")||i.push("cut"),i.push("copy","copyWithHeaders","copyWithGroupHeaders","paste","separator")),this.gos.get("enableCharts")&&this.gos.isModuleRegistered(Mi.GridChartsModule)&&(this.columnModel.isPivotMode()&&i.push("pivotChart"),this.rangeService&&!this.rangeService.isEmpty()&&i.push("chartRange")),sd(e)){const n=!this.gos.isModuleRegistered(Mi.CsvExportModule),l=!this.gos.isModuleRegistered(Mi.ExcelExportModule),c=this.gos.get("suppressExcelExport")||l,h=this.gos.get("suppressCsvExport")||n;!RI()&&(!c||!h)&&i.push("export")}const r=i.length?i:void 0,a=t?.getColDef().contextMenuItems;if(Array.isArray(a))return a;if(typeof a=="function")return a(this.gos.addGridCommonParams({column:t,node:e,value:s,defaultItems:r}));const o=this.gos.getCallback("getContextMenuItems");return o?o({column:t,node:e,value:s,defaultItems:r}):i}onContextMenu(e,t,s,i,r,a){this.menuUtils.onContextMenu(e,t,o=>this.showMenu(s,i,r,o,a))}showMenu(e,t,s,i,r){const a=this.getMenuItems(e,t,s),o=this.ctrlsService.getGridBodyCtrl().getGui();if(a===void 0||II(a))return!1;const n=new JI(a,t,e,s);this.createBean(n);const l=n.getGui();t||this.focusService.clearFocusedCell();const c={column:t,rowNode:e,type:"contextMenu",mouseEvent:i,ePopup:l,nudgeY:1},h=this.localeService.getLocaleTextFunc(),d=this.popupService.addPopup({modal:!0,eChild:l,closeOnEsc:!0,closedCallback:p=>{o.classList.remove(ad),this.destroyBean(n),this.dispatchVisibleChangedEvent(!1,p===void 0?"api":"ui")},click:i,positionCallback:()=>{const p=this.gos.get("enableRtl");this.popupService.positionPopupUnderMouseEvent({...c,nudgeX:p?(l.offsetWidth+1)*-1:1})},anchorToElement:r,ariaLabel:h("ariaLabelContextMenu","Context Menu")});d&&(o.classList.add(ad),n.afterGuiAttached({container:"contextMenu",hidePopup:d.hideFunc})),this.activeMenu&&this.hideActiveMenu(),this.activeMenu=n,n.addEventListener("destroyed",()=>{this.activeMenu===n&&(this.activeMenu=null)}),d&&n.addEventListener("closeMenu",p=>d.hideFunc({mouseEvent:p.mouseEvent??void 0,keyboardEvent:p.keyboardEvent??void 0,forceHide:!0}));const u=i&&i instanceof MouseEvent&&i.type==="mousedown";return this.dispatchVisibleChangedEvent(!0,u?"api":"ui"),!0}dispatchVisibleChangedEvent(e,t="ui"){this.eventService.dispatchEvent({type:"contextMenuVisibleChanged",visible:e,source:t})}},JI=class extends AI{constructor(e,t,s,i){super(`<div class="${XI}" role="presentation"></div>`),this.menuItems=e,this.column=t,this.node=s,this.value=i,this.menuList=null,this.focusedCell=null}wireBeans(e){this.focusService=e.focusService,this.menuItemMapper=e.menuItemMapper,this.cellPositionUtils=e.cellPositionUtils}postConstruct(){const e=this.createManagedBean(new Je(0,{column:this.column,node:this.node,value:this.value})),t=this.menuItemMapper.mapWithStockItems(this.menuItems,null,()=>this.getGui(),"contextMenu");e.addMenuItems(t),this.appendChild(e),this.menuList=e,e.addEventListener("closeMenu",s=>this.dispatchLocalEvent(s))}afterGuiAttached(e){e.hidePopup&&this.addDestroyFunc(e.hidePopup),this.focusedCell=this.focusService.getFocusedCell(),this.menuList&&this.focusService.focusInto(this.menuList.getGui())}restoreFocusedCell(){const e=this.focusService.getFocusedCell();if(e&&this.focusedCell&&this.cellPositionUtils.equals(e,this.focusedCell)){const{rowIndex:t,rowPinned:s,column:i}=this.focusedCell;EI(this.gos)&&this.focusService.setFocusedCell({rowIndex:t,column:i,rowPinned:s,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!this.focusService.isKeyboardMode()})}}destroy(){this.restoreFocusedCell(),super.destroy()}},$e="filterMenuTab",je="generalMenuTab",Ye="columnsMenuTab",Fi=[je,$e,Ye],QI=class extends id{constructor(){super(...arguments),this.beanName="enterpriseMenuFactory"}wireBeans(e){this.popupService=e.popupService,this.focusService=e.focusService,this.ctrlsService=e.ctrlsService,this.visibleColsService=e.visibleColsService,this.filterManager=e.filterManager,this.menuUtils=e.menuUtils,this.menuService=e.menuService,this.columnMenuFactory=e.columnMenuFactory}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(e,t,s,i){const{column:r,columnGroup:a}=this.splitColumnOrGroup(e),o=i?"filterMenuTab":void 0;this.showMenu(r,a,n=>{const l=n.getGui();this.popupService.positionPopupUnderMouseEvent({type:s,column:r,mouseEvent:t,ePopup:l}),o&&n.showTab?.(o),this.dispatchVisibleChangedEvent(!0,!1,r,a,o)},s,o,void 0,t.target)}splitColumnOrGroup(e){const t=e&&BI(e);return{column:t?e:void 0,columnGroup:t?void 0:e}}showMenuAfterButtonClick(e,t,s,i){let r=-1,a="left";this.gos.get("enableRtl")&&(r=1,a="right");const o=i?"filterMenuTab":void 0,n=o?[o]:void 0,l=this.menuService.isLegacyMenuEnabled(),c=(l?9:4)*r,h=l?-23:4,{column:d,columnGroup:u}=this.splitColumnOrGroup(e);this.showMenu(d,u,p=>{const g=p.getGui();this.popupService.positionPopupByComponent({type:s,column:d,eventSource:t,ePopup:g,alignSide:a,nudgeX:c,nudgeY:h,position:"under",keepWithinBounds:!0}),o&&p.showTab?.(o),this.dispatchVisibleChangedEvent(!0,!1,d,u,o)},s,o,n,t)}showMenu(e,t,s,i,r,a,o){const n=this.getMenuParams(e,t,a,o);if(!n)return;const{menu:l,eMenuGui:c,anchorToElement:h,restoreFocusParams:d}=n,u=[];u.push(g=>{const m=l.getGui();this.destroyBean(l),e&&(e.setMenuVisible(!1,"contextMenu"),this.menuUtils.restoreFocusOnClose(d,m,g))});const p=this.localeService.getLocaleTextFunc();if(this.popupService.addPopup({modal:!0,eChild:c,closeOnEsc:!0,closedCallback:g=>{u.forEach(m=>m(g)),this.dispatchVisibleChangedEvent(!1,!1,e,t,r)},afterGuiAttached:g=>l.afterGuiAttached(Object.assign({},{container:i},g)),positionCallback:r?()=>s(l):void 0,ariaLabel:p("ariaLabelColumnMenu","Column Menu")}),r||(l.showTabBasedOnPreviousSelection?.(),s(l)),this.menuService.isColumnMenuAnchoringEnabled()){const g=this.popupService.setPopupPositionRelatedToElement(c,h);g&&e&&this.addStopAnchoring(g,e,u)}l.addEventListener("tabSelected",g=>{this.dispatchVisibleChangedEvent(!1,!0,e),this.lastSelectedTab=g.key,this.dispatchVisibleChangedEvent(!0,!0,e)}),e?.setMenuVisible(!0,"contextMenu"),this.activeMenu=l,l.addEventListener("destroyed",()=>{this.activeMenu===l&&(this.activeMenu=null)})}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 r={column:e,headerPosition:this.focusService.getFocusedHeader(),columnIndex:this.visibleColsService.getAllCols().indexOf(e),eventSource:i},a=this.createMenu(e,t,r,s,i);return a?{menu:a,eMenuGui:a.getGui(),anchorToElement:i||this.ctrlsService.getGridBodyCtrl().getGui(),restoreFocusParams:r}:void 0}createMenu(e,t,s,i,r){if(this.menuService.isLegacyMenuEnabled())return this.createBean(new eD(e,s,this.lastSelectedTab,i,r));{const a=this.columnMenuFactory.getMenuItems(e,t);return a.length?this.createBean(new tD(a,e,s,r)):void 0}}dispatchVisibleChangedEvent(e,t,s,i,r){this.eventService.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:t,key:this.lastSelectedTab??r??(this.menuService.isLegacyMenuEnabled()?je:"columnMenu"),column:s??null,columnGroup:i??null})}isMenuEnabled(e){if(!this.menuService.isLegacyMenuEnabled())return!0;const t=!this.filterManager?.isFilterAllowed(e),s=e.getColDef().menuTabs??Fi;return(t&&s.includes($e)?s.length-1:s.length)>0}showMenuAfterContextMenuEvent(e,t,s){this.menuUtils.onContextMenu(t,s,i=>(this.showMenuAfterMouseEvent(e,i,"columnMenu"),!0))}},eD=class extends id{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={},this.tabFactories[je]=this.createMainPanel.bind(this),this.tabFactories[$e]=this.createFilterPanel.bind(this),this.tabFactories[Ye]=this.createColumnsPanel.bind(this),this.includeChecks[je]=()=>!0,this.includeChecks[$e]=()=>e?!!this.filterManager?.isFilterAllowed(e):!1,this.includeChecks[Ye]=()=>!0}wireBeans(e){this.filterManager=e.filterManager,this.columnChooserFactory=e.columnChooserFactory,this.columnMenuFactory=e.columnMenuFactory,this.menuUtils=e.menuUtils}postConstruct(){const e=this.getTabsToCreate().map(t=>this.createTab(t));this.tabbedLayout=new Os({items:e,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)}),this.createBean(this.tabbedLayout),this.mainMenuList&&this.mainMenuList.setParentComponent(this.tabbedLayout),this.addDestroyFunc(()=>this.destroyBean(this.tabbedLayout))}getTabsToCreate(){return this.restrictTo?this.restrictTo:(this.column?.getColDef().menuTabs??Fi).filter(e=>this.isValidMenuTabItem(e)).filter(e=>this.isNotSuppressed(e)).filter(e=>this.isModuleLoaded(e))}isModuleLoaded(e){return e===Ye?this.gos.isModuleRegistered(kI.ColumnsToolPanelModule):!0}isValidMenuTabItem(e){let t=!0,s=Fi;return this.restrictTo!=null&&(t=this.restrictTo.indexOf(e)>-1,s=this.restrictTo),t=t&&Fi.indexOf(e)>-1,t||OI(`Trying to render an invalid menu item '${e}'. Check that your 'menuTabs' contains one of [${s}]`),t}isNotSuppressed(e){return this.includeChecks[e]()}createTab(e){return this.tabFactories[e]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(e){this.tabItemColumns&&e===Ye?this.tabbedLayout.showItem(this.tabItemColumns):this.tabItemFilter&&e===$e?this.tabbedLayout.showItem(this.tabItemFilter):this.tabItemGeneral&&e===je?this.tabbedLayout.showItem(this.tabItemGeneral):this.tabbedLayout.showFirstItem()}onTabItemClicked(e){let t=null;switch(e.item){case this.tabItemColumns:t=Ye;break;case this.tabItemFilter:t=$e;break;case this.tabItemGeneral:t=je;break}t&&this.activateTab(t)}activateTab(e){const t={type:"tabSelected",key:e};this.dispatchLocalEvent(t)}createMainPanel(){return this.mainMenuList=this.columnMenuFactory.createMenu(this,this.columnMenuFactory.getMenuItems(this.column),this.column,()=>this.sourceElement??this.getGui()),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.tabItemGeneral={title:Qa("menu",this.gos,this.column),titleLabel:je.replace("MenuTab",""),bodyPromise:Ja.resolve(this.mainMenuList.getGui()),name:je},this.tabItemGeneral}onHidePopup(e){this.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}createFilterPanel(){const e=this.column?this.createBean(new LI(this.column,"COLUMN_MENU")):null;if(this.filterComp=e,!e?.hasFilter())throw new Error("AG Grid - Unable to instantiate filter");const t=i=>e.afterGuiAttached(i),s=()=>e.afterGuiDetached();return this.tabItemFilter={title:Qa("filter",this.gos,this.column),titleLabel:$e.replace("MenuTab",""),bodyPromise:Ja.resolve(e?.getGui()),afterAttachedCallback:t,afterDetachedCallback:s,name:$e},this.tabItemFilter}createColumnsPanel(){const e=document.createElement("div");e.classList.add("ag-menu-column-select-wrapper");const s=this.columnChooserFactory.createColumnSelectPanel(this,this.column).getGui();return s.classList.add("ag-menu-column-select"),e.appendChild(s),this.tabItemColumns={title:Qa("columns",this.gos,this.column),titleLabel:Ye.replace("MenuTab",""),bodyPromise:Ja.resolve(e),name:Ye},this.tabItemColumns}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)}},tD=class extends DI{constructor(e,t,s,i){super(`
391
+ </div>`)};if(aI(this.params.template))e();else if(typeof this.params.template=="string")this.setTemplate(this.params.template,[]);else if(typeof this.params.template=="function"){const t=this.params.template,s=t(this.params);this.setTemplate(s,[])}else Zh("detailCellRendererParams.template should be function or string"),e();this.eDetailGrid==null&&Zh('Reference to eDetailGrid was missing from the details template. Please add data-ref="eDetailGrid" to the template.')}setDetailGrid(e){if(!this.eDetailGrid)return;const t=this.context.getBean("frameworkComponentWrapper"),s=new uI(t),i=this.getFrameworkOverrides(),r=oI(this.eDetailGrid,e,{frameworkOverrides:i,providedBeanInstances:{frameworkComponentWrapper:s},modules:iI.__getGridRegisteredModules(this.params.api.getGridId())});this.detailApi=r,this.ctrl.registerDetailWithMaster(r),this.addDestroyFunc(()=>{r?.destroy()})}setRowData(e){this.detailApi&&this.detailApi.setGridOption("rowData",e)}},gI=class extends cI{constructor(){super(...arguments),this.beanName="detailGridApiService",this.detailGridInfoMap={}}addDetailGridInfo(e,t){this.detailGridInfoMap[e]=t}removeDetailGridInfo(e){delete this.detailGridInfoMap[e]}getDetailGridInfo(e){return this.detailGridInfoMap[e]}forEachDetailGridInfo(e){let t=0;dI(this.detailGridInfoMap,(s,i)=>{hI(i)&&(e(i,t),t++)})}destroy(){this.detailGridInfoMap={},super.destroy()}};function mI(e,t,s){e.detailGridApiService?.addDetailGridInfo(t,s)}function fI(e,t){e.detailGridApiService?.removeDetailGridInfo(t)}function CI(e,t){return e.detailGridApiService?.getDetailGridInfo(t)}function vI(e,t){e.detailGridApiService?.forEachDetailGridInfo(t)}var Ya="32.3.3",Qh=$a({version:Ya,moduleName:`${Ka.MasterDetailModule}-core`,userComponents:[{name:"agGroupRowRenderer",classImp:ht},{name:"agGroupCellRenderer",classImp:ht},{name:"agDetailCellRenderer",classImp:pI}],controllers:[{name:"detailCellRenderer",classImp:Jh},{name:"groupCellRendererCtrl",classImp:Lt}],dependantModules:[H]}),SI=$a({version:Ya,moduleName:`${Ka.MasterDetailModule}-api`,beans:[gI],apiFunctions:{addDetailGridInfo:mI,removeDetailGridInfo:fI,getDetailGridInfo:CI,forEachDetailGridInfo:vI},dependantModules:[Qh]}),qa=$a({version:Ya,moduleName:Ka.MasterDetailModule,dependantModules:[Qh,SI]});import{ModuleNames as Xa,_CommunityMenuApiModule as yI,_defineModule as Za}from"ag-grid-community";import{BeanStub as wI,ModuleNames as xI,_createIconNoSpan as ed,_warnOnce as td}from"ag-grid-community";import{BeanStub as bI}from"ag-grid-community";import{BeanStub as PI,_isClientSideRowModel as TI,_removeRepeatsFromArray as MI}from"ag-grid-community";import{BeanStub as FI,Component as AI,ModuleNames as Mi,_exists as sd,_isIOSUserAgent as RI,_isNothingFocused as EI,_missingOrEmpty as II}from"ag-grid-community";import{AgPromise as Ja,BeanStub as id,Component as DI,FilterWrapperComp as LI,ModuleNames as kI,RefPlaceholder as GI,_createIconNoSpan as Qa,_warnOnce as OI,isColumn as BI}from"ag-grid-community";import{BeanStub as NI,ModuleNames as Re,_createIconNoSpan as j,_escapeString as eo,_exists as VI,_warnOnce as _I}from"ag-grid-community";import{BeanStub as UI,_getActiveDomElement as HI,_isNothingFocused as rd,_isVisible as zI,_last as WI}from"ag-grid-community";var KI=class bu extends wI{constructor(){super(...arguments),this.beanName="chartMenuItemMapper"}wireBeans(t){this.chartService=t.chartService}getChartItems(t){if(!this.chartService){this.gos.assertModuleRegistered(xI.GridChartsModule,`the Context Menu key "${t}"`);return}const s=t==="pivotChart"?new $I(this.gos,this.chartService,this.localeService):new jI(this.gos,this.chartService,this.localeService),i=this.chartService.isEnterprise();let r=s.getMenuItem();if(r&&r.subMenu&&!i){const o=n=>({...n,subMenu:n.subMenu?.filter(l=>!l._enterprise).map(l=>o(l))});r=o(r)}const a=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;return a&&(r=bu.filterAndOrderChartMenu(r,a,s.getConfigLookup())),this.cleanInternals(r)}cleanInternals(t){if(!t)return t;const s=i=>(delete i?._key,delete i?._enterprise,i?.subMenu?.forEach(r=>s(r)),i);return s(t)}static buildLookup(t){const s={},i=r=>{s[r._key]=r,r.subMenu&&r.subMenu.forEach(a=>i(a))};return i(t),s}static filterAndOrderChartMenu(t,s,i){const r=this.buildLookup(t),a={...t,subMenu:[]};if(Object.entries(s).forEach(([o,n])=>{const l=i[o];if(l===null)return;if(l==null){td(`invalid chartGroupsDef config '${o}'`);return}const c=r[l._key];if(c)if(c.subMenu){const h=n.map(d=>{const u=l[d];if(u==null){td(`invalid chartGroupsDef config '${o}.${d}'`);return}return r[u]}).filter(d=>d!==void 0);h.length>0&&(c.subMenu=h,a.subMenu?.push(c))}else a.subMenu?.push(c)}),a.subMenu?.length!=0)return a}},$I=class{constructor(e,t,s){this.gos=e,this.chartService=t,this.localeService=s}getMenuItem(){const e=this.localeService.getLocaleTextFunc(),t=(s,i,r,a,o=!1)=>({name:e(s,i),action:()=>this.chartService.createPivotChart({chartType:r}),_key:a,_enterprise:o});return{name:e("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped&lrm;","groupedColumn","pivotGroupedColumn"),t("stackedColumn","Stacked&lrm;","stackedColumn","pivotStackedColumn"),t("normalizedColumn","100% Stacked&lrm;","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped&lrm;","groupedBar","pivotGroupedBar"),t("stackedBar","Stacked&lrm;","stackedBar","pivotStackedBar"),t("normalizedBar","100% Stacked&lrm;","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:e("pieChart","Pie"),subMenu:[t("pie","Pie&lrm;","pie","pivotPie"),t("donut","Donut&lrm;","donut","pivotDonut")]},t("line","Line&lrm;","line","pivotLineChart"),{_key:"pivotXYChart",name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter&lrm;","scatter","pivotScatter"),t("bubble","Bubble&lrm;","bubble","pivotBubble")]},{_key:"pivotAreaChart",name:e("areaChart","Area"),subMenu:[t("area","Area&lrm;","area","pivotArea"),t("stackedArea","Stacked&lrm;","stackedArea","pivotStackedArea"),t("normalizedArea","100% Stacked&lrm;","normalizedArea","pivotNormalizedArea")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:e("statisticalChart","Statistical"),subMenu:[t("histogramChart","Histogram&lrm;","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemapChart","Treemap&lrm;","treemap","pivotTreemap",!0),t("sunburstChart","Sunburst&lrm;","sunburst","pivotSunburst",!0)]},{_key:"pivotCombinationChart",name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line&lrm;","columnLineCombo","pivotColumnLineCombo"),t("AreaColumnCombo","Area & Column&lrm;","areaColumnCombo","pivotAreaColumnCombo")]}],icon:ed("chart",this.gos,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"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},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},polarGroup:null,specializedGroup:null}}},jI=class{constructor(e,t,s){this.gos=e,this.chartService=t,this.localeService=s}getMenuItem(){const e=this.localeService.getLocaleTextFunc(),t=(s,i,r,a,o=!1)=>({name:e(s,i),action:()=>this.chartService.createChartFromCurrentRange(r),_key:a,_enterprise:o});return{name:e("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:e("columnChart","Column"),subMenu:[t("groupedColumn","Grouped&lrm;","groupedColumn","rangeGroupedColumn"),t("stackedColumn","Stacked&lrm;","stackedColumn","rangeStackedColumn"),t("normalizedColumn","100% Stacked&lrm;","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:e("barChart","Bar"),subMenu:[t("groupedBar","Grouped&lrm;","groupedBar","rangeGroupedBar"),t("stackedBar","Stacked&lrm;","stackedBar","rangeStackedBar"),t("normalizedBar","100% Stacked&lrm;","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:e("pieChart","Pie"),subMenu:[t("pie","Pie&lrm;","pie","rangePie"),t("donut","Donut&lrm;","donut","rangeDonut")],_key:"rangePieChart"},t("line","Line&lrm;","line","rangeLineChart"),{name:e("xyChart","X Y (Scatter)"),subMenu:[t("scatter","Scatter&lrm;","scatter","rangeScatter"),t("bubble","Bubble&lrm;","bubble","rangeBubble")],_key:"rangeXYChart"},{name:e("areaChart","Area"),subMenu:[t("area","Area&lrm;","area","rangeArea"),t("stackedArea","Stacked&lrm;","stackedArea","rangeStackedArea"),t("normalizedArea","100% Stacked&lrm;","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:e("polarChart","Polar"),subMenu:[t("radarLine","Radar Line&lrm;","radarLine","rangeRadarLine"),t("radarArea","Radar Area&lrm;","radarArea","rangeRadarArea"),t("nightingale","Nightingale&lrm;","nightingale","rangeNightingale"),t("radialColumn","Radial Column&lrm;","radialColumn","rangeRadialColumn"),t("radialBar","Radial Bar&lrm;","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:e("statisticalChart","Statistical"),subMenu:[t("boxPlot","Box Plot&lrm;","boxPlot","rangeBoxPlot",!0),t("histogramChart","Histogram&lrm;","histogram","rangeHistogram",!1),t("rangeBar","Range Bar&lrm;","rangeBar","rangeRangeBar",!0),t("rangeArea","Range Area&lrm;","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:e("hierarchicalChart","Hierarchical"),subMenu:[t("treemap","Treemap&lrm;","treemap","rangeTreemap"),t("sunburst","Sunburst&lrm;","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:e("specializedChart","Specialized"),subMenu:[t("heatmap","Heatmap&lrm;","heatmap","rangeHeatmap"),t("waterfall","Waterfall&lrm;","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:e("combinationChart","Combination"),subMenu:[t("columnLineCombo","Column & Line&lrm;","columnLineCombo","rangeColumnLineCombo"),t("AreaColumnCombo","Area & Column&lrm;","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:ed("chart",this.gos,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"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},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"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}},YI=class extends bI{constructor(){super(...arguments),this.beanName="columnChooserFactory"}wireBeans(e){this.focusService=e.focusService,this.menuUtils=e.menuUtils,this.visibleColsService=e.visibleColsService}createColumnSelectPanel(e,t,s,i){const r=e.createManagedBean(new Ci),a=i??t?.getColDef().columnChooserParams??t?.getColDef().columnsMenuParams??{},{contractColumnSelection:o,suppressColumnExpandAll:n,suppressColumnFilter:l,suppressColumnSelectAll:c,suppressSyncLayoutWithGrid:h,columnLayout:d}=a;return r.init(!!s,this.gos.addGridCommonParams({suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!o,suppressColumnExpandAll:!!n,suppressColumnFilter:!!l,suppressColumnSelectAll:!!c,suppressSyncLayoutWithGrid:!!d||!!h,onStateUpdated:()=>{}}),"columnMenu"),d&&r.setColumnLayout(d),r}showColumnChooser({column:e,chooserParams:t,eventSource:s}){this.hideActiveColumnChooser();const i=this.createColumnSelectPanel(this,e,!0,t),r=this.localeService.getLocaleTextFunc(),a=this.visibleColsService.getAllCols().indexOf(e),o=e?this.focusService.getFocusedHeader():null;this.activeColumnChooserDialog=this.createBean(new Ze({title:r("chooseColumns","Choose Columns"),component:i,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{this.focusService.findNextFocusableElement(i.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,e)},closedCallback:n=>{const l=this.activeColumnChooser.getGui();this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,e),e&&this.menuUtils.restoreFocusOnClose({column:e,headerPosition:o,columnIndex:a,eventSource:s},l,n,!0)},postProcessPopupParams:{type:"columnChooser",column:e,eventSource:s}})),this.activeColumnChooser=i}hideActiveColumnChooser(){this.activeColumnChooserDialog&&this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent(e,t){this.eventService.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:!1,key:"columnChooser",column:t??null})}},wt="separator",qI=class extends PI{constructor(){super(...arguments),this.beanName="columnMenuFactory"}wireBeans(e){this.menuItemMapper=e.menuItemMapper,this.columnModel=e.columnModel,this.funcColsService=e.funcColsService,this.menuService=e.menuService}createMenu(e,t,s,i){const r=e.createManagedBean(new Je(0,{column:s??null,node:null,value:null})),a=this.menuItemMapper.mapWithStockItems(t,s??null,i,"columnMenu");return r.addMenuItems(a),r}getMenuItems(e,t){const s=this.getDefaultMenuOptions(e);let i;const r=e?.getColDef().mainMenuItems;if(Array.isArray(r))i=r;else if(typeof r=="function")i=r(this.gos.addGridCommonParams({column:e,defaultItems:s}));else{const a=this.gos.getCallback("getMainMenuItems");a&&e?i=a({column:e,defaultItems:s}):i=s}return MI(i,wt),i}getDefaultMenuOptions(e){const t=[],s=this.menuService.isLegacyMenuEnabled();if(!e)return s||t.push("columnChooser"),t.push("resetColumns"),t;const i=!e.getColDef().lockPinned,r=this.funcColsService.getRowGroupColumns().length,a=r>0,o=e.isAllowValue(),n=e.isAllowRowGroup(),l=e.isPrimary(),c=this.columnModel.isPivotMode(),h=TI(this.gos),d=this.gos.get("treeData"),u=l&&a&&o||!l;if(!s&&e.isSortable()){const m=e.getSort();m!=="asc"&&t.push("sortAscending"),m!=="desc"&&t.push("sortDescending"),m&&t.push("sortUnSort"),t.push(wt)}return this.menuService.isFilterMenuItemEnabled(e)&&(t.push("columnFilter"),t.push(wt)),i&&t.push("pinSubMenu"),u&&t.push("valueAggSubMenu"),(i||u)&&t.push(wt),t.push("autoSizeThis"),t.push("autoSizeAll"),t.push(wt),e.getColDef().showRowGroup?t.push("rowUnGroup"):n&&e.isPrimary()&&(e.isRowGroupActive()?this.columnModel.isColGroupLocked(e)||t.push("rowUnGroup"):t.push("rowGroup")),t.push(wt),s||t.push("columnChooser"),t.push("resetColumns"),h&&(d||r>(c?1:0))&&(t.push("expandAll"),t.push("contractAll")),t}},XI="ag-menu",ad="ag-context-menu-open",ZI=class extends FI{constructor(){super(...arguments),this.beanName="contextMenuFactory"}wireBeans(e){this.popupService=e.popupService,this.ctrlsService=e.ctrlsService,this.columnModel=e.columnModel,this.menuUtils=e.menuUtils,this.rangeService=e.rangeService,this.focusService=e.focusService}hideActiveMenu(){this.destroyBean(this.activeMenu)}getMenuItems(e,t,s){const i=[];if(sd(e)&&this.gos.isModuleRegistered(Mi.ClipboardModule)&&t&&(this.gos.get("suppressCutToClipboard")||i.push("cut"),i.push("copy","copyWithHeaders","copyWithGroupHeaders","paste","separator")),this.gos.get("enableCharts")&&this.gos.isModuleRegistered(Mi.GridChartsModule)&&(this.columnModel.isPivotMode()&&i.push("pivotChart"),this.rangeService&&!this.rangeService.isEmpty()&&i.push("chartRange")),sd(e)){const n=!this.gos.isModuleRegistered(Mi.CsvExportModule),l=!this.gos.isModuleRegistered(Mi.ExcelExportModule),c=this.gos.get("suppressExcelExport")||l,h=this.gos.get("suppressCsvExport")||n;!RI()&&(!c||!h)&&i.push("export")}const r=i.length?i:void 0,a=t?.getColDef().contextMenuItems;if(Array.isArray(a))return a;if(typeof a=="function")return a(this.gos.addGridCommonParams({column:t,node:e,value:s,defaultItems:r}));const o=this.gos.getCallback("getContextMenuItems");return o?o({column:t,node:e,value:s,defaultItems:r}):i}onContextMenu(e,t,s,i,r,a){this.menuUtils.onContextMenu(e,t,o=>this.showMenu(s,i,r,o,a))}showMenu(e,t,s,i,r){const a=this.getMenuItems(e,t,s),o=this.ctrlsService.getGridBodyCtrl().getGui();if(a===void 0||II(a))return!1;const n=new JI(a,t,e,s);this.createBean(n);const l=n.getGui();t||this.focusService.clearFocusedCell();const c={column:t,rowNode:e,type:"contextMenu",mouseEvent:i,ePopup:l,nudgeY:1},h=this.localeService.getLocaleTextFunc(),d=this.popupService.addPopup({modal:!0,eChild:l,closeOnEsc:!0,closedCallback:p=>{o.classList.remove(ad),this.destroyBean(n),this.dispatchVisibleChangedEvent(!1,p===void 0?"api":"ui")},click:i,positionCallback:()=>{const p=this.gos.get("enableRtl");this.popupService.positionPopupUnderMouseEvent({...c,nudgeX:p?(l.offsetWidth+1)*-1:1})},anchorToElement:r,ariaLabel:h("ariaLabelContextMenu","Context Menu")});d&&(o.classList.add(ad),n.afterGuiAttached({container:"contextMenu",hidePopup:d.hideFunc})),this.activeMenu&&this.hideActiveMenu(),this.activeMenu=n,n.addEventListener("destroyed",()=>{this.activeMenu===n&&(this.activeMenu=null)}),d&&n.addEventListener("closeMenu",p=>d.hideFunc({mouseEvent:p.mouseEvent??void 0,keyboardEvent:p.keyboardEvent??void 0,forceHide:!0}));const u=i&&i instanceof MouseEvent&&i.type==="mousedown";return this.dispatchVisibleChangedEvent(!0,u?"api":"ui"),!0}dispatchVisibleChangedEvent(e,t="ui"){this.eventService.dispatchEvent({type:"contextMenuVisibleChanged",visible:e,source:t})}},JI=class extends AI{constructor(e,t,s,i){super(`<div class="${XI}" role="presentation"></div>`),this.menuItems=e,this.column=t,this.node=s,this.value=i,this.menuList=null,this.focusedCell=null}wireBeans(e){this.focusService=e.focusService,this.menuItemMapper=e.menuItemMapper,this.cellPositionUtils=e.cellPositionUtils}postConstruct(){const e=this.createManagedBean(new Je(0,{column:this.column,node:this.node,value:this.value})),t=this.menuItemMapper.mapWithStockItems(this.menuItems,null,()=>this.getGui(),"contextMenu");e.addMenuItems(t),this.appendChild(e),this.menuList=e,e.addEventListener("closeMenu",s=>this.dispatchLocalEvent(s))}afterGuiAttached(e){e.hidePopup&&this.addDestroyFunc(e.hidePopup),this.focusedCell=this.focusService.getFocusedCell(),this.menuList&&this.focusService.focusInto(this.menuList.getGui())}restoreFocusedCell(){const e=this.focusService.getFocusedCell();if(e&&this.focusedCell&&this.cellPositionUtils.equals(e,this.focusedCell)){const{rowIndex:t,rowPinned:s,column:i}=this.focusedCell;EI(this.gos)&&this.focusService.setFocusedCell({rowIndex:t,column:i,rowPinned:s,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!this.focusService.isKeyboardMode()})}}destroy(){this.restoreFocusedCell(),super.destroy()}},$e="filterMenuTab",je="generalMenuTab",Ye="columnsMenuTab",Fi=[je,$e,Ye],QI=class extends id{constructor(){super(...arguments),this.beanName="enterpriseMenuFactory"}wireBeans(e){this.popupService=e.popupService,this.focusService=e.focusService,this.ctrlsService=e.ctrlsService,this.visibleColsService=e.visibleColsService,this.filterManager=e.filterManager,this.menuUtils=e.menuUtils,this.menuService=e.menuService,this.columnMenuFactory=e.columnMenuFactory}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent(e,t,s,i){const{column:r,columnGroup:a}=this.splitColumnOrGroup(e),o=i?"filterMenuTab":void 0;this.showMenu(r,a,n=>{const l=n.getGui();this.popupService.positionPopupUnderMouseEvent({type:s,column:r,mouseEvent:t,ePopup:l}),o&&n.showTab?.(o),this.dispatchVisibleChangedEvent(!0,!1,r,a,o)},s,o,void 0,t.target)}splitColumnOrGroup(e){const t=e&&BI(e);return{column:t?e:void 0,columnGroup:t?void 0:e}}showMenuAfterButtonClick(e,t,s,i){let r=-1,a="left";this.gos.get("enableRtl")&&(r=1,a="right");const o=i?"filterMenuTab":void 0,n=o?[o]:void 0,l=this.menuService.isLegacyMenuEnabled(),c=(l?9:4)*r,h=l?-23:4,{column:d,columnGroup:u}=this.splitColumnOrGroup(e);this.showMenu(d,u,p=>{const g=p.getGui();this.popupService.positionPopupByComponent({type:s,column:d,eventSource:t,ePopup:g,alignSide:a,nudgeX:c,nudgeY:h,position:"under",keepWithinBounds:!0}),o&&p.showTab?.(o),this.dispatchVisibleChangedEvent(!0,!1,d,u,o)},s,o,n,t)}showMenu(e,t,s,i,r,a,o){const n=this.getMenuParams(e,t,a,o);if(!n)return;const{menu:l,eMenuGui:c,anchorToElement:h,restoreFocusParams:d}=n,u=[];u.push(g=>{const m=l.getGui();this.destroyBean(l),e&&(e.setMenuVisible(!1,"contextMenu"),this.menuUtils.restoreFocusOnClose(d,m,g))});const p=this.localeService.getLocaleTextFunc();if(this.popupService.addPopup({modal:!0,eChild:c,closeOnEsc:!0,closedCallback:g=>{u.forEach(m=>m(g)),this.dispatchVisibleChangedEvent(!1,!1,e,t,r)},afterGuiAttached:g=>l.afterGuiAttached(Object.assign({},{container:i},g)),positionCallback:r?()=>s(l):void 0,ariaLabel:p("ariaLabelColumnMenu","Column Menu")}),r||(l.showTabBasedOnPreviousSelection?.(),s(l)),this.menuService.isColumnMenuAnchoringEnabled()){const g=this.popupService.setPopupPositionRelatedToElement(c,h);g&&e&&this.addStopAnchoring(g,e,u)}l.addEventListener("tabSelected",g=>{this.dispatchVisibleChangedEvent(!1,!0,e),this.lastSelectedTab=g.key,this.dispatchVisibleChangedEvent(!0,!0,e)}),e?.setMenuVisible(!0,"contextMenu"),this.activeMenu=l,l.addEventListener("destroyed",()=>{this.activeMenu===l&&(this.activeMenu=null)})}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 r={column:e,headerPosition:this.focusService.getFocusedHeader(),columnIndex:this.visibleColsService.getAllCols().indexOf(e),eventSource:i},a=this.createMenu(e,t,r,s,i);return a?{menu:a,eMenuGui:a.getGui(),anchorToElement:i||this.ctrlsService.getGridBodyCtrl().getGui(),restoreFocusParams:r}:void 0}createMenu(e,t,s,i,r){if(this.menuService.isLegacyMenuEnabled())return this.createBean(new eD(e,s,this.lastSelectedTab,i,r));{const a=this.columnMenuFactory.getMenuItems(e,t);return a.length?this.createBean(new tD(a,e,s,r)):void 0}}dispatchVisibleChangedEvent(e,t,s,i,r){this.eventService.dispatchEvent({type:"columnMenuVisibleChanged",visible:e,switchingTab:t,key:this.lastSelectedTab??r??(this.menuService.isLegacyMenuEnabled()?je:"columnMenu"),column:s??null,columnGroup:i??null})}isMenuEnabled(e){if(!this.menuService.isLegacyMenuEnabled())return!0;const t=!this.filterManager?.isFilterAllowed(e),s=e.getColDef().menuTabs??Fi;return(t&&s.includes($e)?s.length-1:s.length)>0}showMenuAfterContextMenuEvent(e,t,s){this.menuUtils.onContextMenu(t,s,i=>(this.showMenuAfterMouseEvent(e,i,"columnMenu"),!0))}},eD=class extends id{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={},this.tabFactories[je]=this.createMainPanel.bind(this),this.tabFactories[$e]=this.createFilterPanel.bind(this),this.tabFactories[Ye]=this.createColumnsPanel.bind(this),this.includeChecks[je]=()=>!0,this.includeChecks[$e]=()=>e?!!this.filterManager?.isFilterAllowed(e):!1,this.includeChecks[Ye]=()=>!0}wireBeans(e){this.filterManager=e.filterManager,this.columnChooserFactory=e.columnChooserFactory,this.columnMenuFactory=e.columnMenuFactory,this.menuUtils=e.menuUtils}postConstruct(){const e=this.getTabsToCreate().map(t=>this.createTab(t));this.tabbedLayout=new Os({items:e,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)}),this.createBean(this.tabbedLayout),this.mainMenuList&&this.mainMenuList.setParentComponent(this.tabbedLayout),this.addDestroyFunc(()=>this.destroyBean(this.tabbedLayout))}getTabsToCreate(){return this.restrictTo?this.restrictTo:(this.column?.getColDef().menuTabs??Fi).filter(e=>this.isValidMenuTabItem(e)).filter(e=>this.isNotSuppressed(e)).filter(e=>this.isModuleLoaded(e))}isModuleLoaded(e){return e===Ye?this.gos.isModuleRegistered(kI.ColumnsToolPanelModule):!0}isValidMenuTabItem(e){let t=!0,s=Fi;return this.restrictTo!=null&&(t=this.restrictTo.indexOf(e)>-1,s=this.restrictTo),t=t&&Fi.indexOf(e)>-1,t||OI(`Trying to render an invalid menu item '${e}'. Check that your 'menuTabs' contains one of [${s}]`),t}isNotSuppressed(e){return this.includeChecks[e]()}createTab(e){return this.tabFactories[e]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab(e){this.tabItemColumns&&e===Ye?this.tabbedLayout.showItem(this.tabItemColumns):this.tabItemFilter&&e===$e?this.tabbedLayout.showItem(this.tabItemFilter):this.tabItemGeneral&&e===je?this.tabbedLayout.showItem(this.tabItemGeneral):this.tabbedLayout.showFirstItem()}onTabItemClicked(e){let t=null;switch(e.item){case this.tabItemColumns:t=Ye;break;case this.tabItemFilter:t=$e;break;case this.tabItemGeneral:t=je;break}t&&this.activateTab(t)}activateTab(e){const t={type:"tabSelected",key:e};this.dispatchLocalEvent(t)}createMainPanel(){return this.mainMenuList=this.columnMenuFactory.createMenu(this,this.columnMenuFactory.getMenuItems(this.column),this.column,()=>this.sourceElement??this.getGui()),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.tabItemGeneral={title:Qa("menu",this.gos,this.column),titleLabel:je.replace("MenuTab",""),bodyPromise:Ja.resolve(this.mainMenuList.getGui()),name:je},this.tabItemGeneral}onHidePopup(e){this.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}createFilterPanel(){const e=this.column?this.createBean(new LI(this.column,"COLUMN_MENU")):null;if(this.filterComp=e,!e?.hasFilter())throw new Error("AG Grid - Unable to instantiate filter");const t=i=>e.afterGuiAttached(i),s=()=>e.afterGuiDetached();return this.tabItemFilter={title:Qa("filter",this.gos,this.column),titleLabel:$e.replace("MenuTab",""),bodyPromise:Ja.resolve(e?.getGui()),afterAttachedCallback:t,afterDetachedCallback:s,name:$e},this.tabItemFilter}createColumnsPanel(){const e=document.createElement("div");e.classList.add("ag-menu-column-select-wrapper");const s=this.columnChooserFactory.createColumnSelectPanel(this,this.column).getGui();return s.classList.add("ag-menu-column-select"),e.appendChild(s),this.tabItemColumns={title:Qa("columns",this.gos,this.column),titleLabel:Ye.replace("MenuTab",""),bodyPromise:Ja.resolve(e),name:Ye},this.tabItemColumns}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)}},tD=class extends DI{constructor(e,t,s,i){super(`
392
392
  <div data-ref="eColumnMenu" role="presentation" class="ag-menu ag-column-menu"></div>
393
- `),this.menuItems=e,this.column=t,this.restoreFocusParams=s,this.sourceElement=i,this.eColumnMenu=GI}wireBeans(e){this.columnMenuFactory=e.columnMenuFactory,this.menuUtils=e.menuUtils,this.focusService=e.focusService}postConstruct(){this.mainMenuList=this.columnMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui()),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(this.mainMenuList.getGui())}onHidePopup(e){this.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),this.focusService.focusInto(this.mainMenuList.getGui())}};function sD(e,t){const{rowNode:s,column:i,value:r,x:a,y:o}=t||{};let{x:n,y:l}=e.menuService.getContextMenuPosition(s,i);a!=null&&(n=a),o!=null&&(l=o),e.menuService.showContextMenu({mouseEvent:new MouseEvent("mousedown",{clientX:n,clientY:l}),rowNode:s,column:i,value:r})}function iD(e,t){e.menuService.showColumnChooser({chooserParams:t})}function rD(e){e.menuService.hideColumnChooser()}var aD=class extends NI{constructor(){super(...arguments),this.beanName="menuItemMapper"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.columnApplyStateService=e.columnApplyStateService,this.funcColsService=e.funcColsService,this.focusService=e.focusService,this.rowPositionUtils=e.rowPositionUtils,this.chartMenuItemMapper=e.chartMenuItemMapper,this.menuService=e.menuService,this.sortController=e.sortController,this.columnAutosizeService=e.columnAutosizeService,this.expansionService=e.expansionService,this.clipboardService=e.clipboardService,this.aggFuncService=e.aggFuncService,this.csvCreator=e.csvCreator,this.excelCreator=e.excelCreator}mapWithStockItems(e,t,s,i){if(!e)return[];const r=[];return e.forEach(a=>{let o;if(typeof a=="string"?o=this.getStockMenuItem(a,t,s,i):o={...a},!o)return;const n=o,{subMenu:l}=n;l&&l instanceof Array&&(n.subMenu=this.mapWithStockItems(l,t,s,i)),o!=null&&r.push(o)}),r}getStockMenuItem(e,t,s,i){const r=this.localeService.getLocaleTextFunc(),a=this.gos.get("skipHeaderOnAutoSize");switch(e){case"pinSubMenu":return{name:r("pinColumn","Pin Column"),icon:j("menuPin",this.gos,null),subMenu:["clearPinned","pinLeft","pinRight"]};case"pinLeft":return{name:r("pinLeft","Pin Left"),action:()=>this.columnModel.setColsPinned([t],"left",i),checked:!!t&&t.isPinnedLeft()};case"pinRight":return{name:r("pinRight","Pin Right"),action:()=>this.columnModel.setColsPinned([t],"right",i),checked:!!t&&t.isPinnedRight()};case"clearPinned":return{name:r("noPin","No Pin"),action:()=>this.columnModel.setColsPinned([t],null,i),checked:!!t&&!t.isPinned()};case"valueAggSubMenu":return this.gos.assertModuleRegistered(Re.RowGroupingModule,"Aggregation from Menu")?!t?.isPrimary()&&!t?.getColDef().pivotValueColumn?null:{name:r("valueAggregation","Value Aggregation"),icon:j("menuValue",this.gos,null),subMenu:this.createAggregationSubMenu(t,this.aggFuncService),disabled:this.gos.get("functionsReadOnly")}:null;case"autoSizeThis":return{name:r("autosizeThisColumn","Autosize This Column"),action:()=>this.columnAutosizeService.autoSizeColumn(t,i,a)};case"autoSizeAll":return{name:r("autosizeAllColumns","Autosize All Columns"),action:()=>this.columnAutosizeService.autoSizeAllColumns(i,a)};case"rowGroup":return{name:r("groupBy","Group by")+" "+eo(this.columnNameService.getDisplayNameForColumn(t,"header")),disabled:this.gos.get("functionsReadOnly")||t?.isRowGroupActive()||!t?.getColDef().enableRowGroup,action:()=>this.funcColsService.addRowGroupColumns([t],i),icon:j("menuAddRowGroup",this.gos,null)};case"rowUnGroup":{const o=j("menuRemoveRowGroup",this.gos,null),n=t?.getColDef().showRowGroup,l=this.gos.get("groupLockGroupColumns");if(n===!0)return{name:r("ungroupAll","Un-Group All"),disabled:this.gos.get("functionsReadOnly")||l===-1||l>=this.funcColsService.getRowGroupColumns().length,action:()=>this.funcColsService.setRowGroupColumns(this.funcColsService.getRowGroupColumns().slice(0,l),i),icon:o};if(typeof n=="string"){const c=this.columnModel.getColDefCol(n),h=c!=null?eo(this.columnNameService.getDisplayNameForColumn(c,"header")):n;return{name:r("ungroupBy","Un-Group by")+" "+h,disabled:this.gos.get("functionsReadOnly")||c!=null&&this.columnModel.isColGroupLocked(c),action:()=>this.funcColsService.removeRowGroupColumns([n],i),icon:o}}return{name:r("ungroupBy","Un-Group by")+" "+eo(this.columnNameService.getDisplayNameForColumn(t,"header")),disabled:this.gos.get("functionsReadOnly")||!t?.isRowGroupActive()||!t?.getColDef().enableRowGroup||this.columnModel.isColGroupLocked(t),action:()=>this.funcColsService.removeRowGroupColumns([t],i),icon:o}}case"resetColumns":return{name:r("resetColumns","Reset Columns"),action:()=>this.columnApplyStateService.resetColumnState(i)};case"expandAll":return{name:r("expandAll","Expand All Row Groups"),action:()=>this.expansionService.expandAll(!0)};case"contractAll":return{name:r("collapseAll","Collapse All Row Groups"),action:()=>this.expansionService.expandAll(!1)};case"copy":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy from Menu")?{name:r("copy","Copy"),shortcut:r("ctrlC","Ctrl+C"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard()}:null;case"copyWithHeaders":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy with Headers from Menu")?{name:r("copyWithHeaders","Copy with Headers"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy with Group Headers from Menu")?{name:r("copyWithGroupHeaders","Copy with Group Headers"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(this.gos.assertModuleRegistered(Re.ClipboardModule,"Cut from Menu")){const o=this.focusService.getFocusedCell(),n=o?this.rowPositionUtils.getRowNode(o):null,l=n?o?.column.isCellEditable(n):!1;return{name:r("cut","Cut"),shortcut:r("ctrlX","Ctrl+X"),icon:j("clipboardCut",this.gos,null),disabled:!l||this.gos.get("suppressCutToClipboard"),action:()=>this.clipboardService.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Paste from Clipboard")?{name:r("paste","Paste"),shortcut:r("ctrlV","Ctrl+V"),disabled:!0,icon:j("clipboardPaste",this.gos,null),action:()=>this.clipboardService.pasteFromClipboard()}:null;case"export":{const o=[],n=this.gos.isModuleRegistered(Re.CsvExportModule),l=this.gos.isModuleRegistered(Re.ExcelExportModule);return!this.gos.get("suppressCsvExport")&&n&&o.push("csvExport"),!this.gos.get("suppressExcelExport")&&l&&o.push("excelExport"),{name:r("export","Export"),subMenu:o,icon:j("save",this.gos,null)}}case"csvExport":return{name:r("csvExport","CSV Export"),icon:j("csvExport",this.gos,null),action:()=>this.csvCreator?.exportDataAsCsv()};case"excelExport":return{name:r("excelExport","Excel Export"),icon:j("excelExport",this.gos,null),action:()=>this.excelCreator?.exportDataAsExcel()};case"separator":return"separator";case"pivotChart":case"chartRange":return this.chartMenuItemMapper.getChartItems(e)??null;case"columnFilter":return t?{name:r("columnFilter","Column Filter"),icon:j("filter",this.gos,null),action:()=>this.menuService.showFilterMenu({column:t,buttonElement:s(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":return this.gos.isModuleRegistered(Re.ColumnsToolPanelModule)?{name:r("columnChooser","Choose Columns"),icon:j("columns",this.gos,null),action:()=>this.menuService.showColumnChooser({column:t,eventSource:s()})}:null;case"sortAscending":return{name:r("sortAscending","Sort Ascending"),icon:j("sortAscending",this.gos,null),action:()=>this.sortController.setSortForColumn(t,"asc",!1,i)};case"sortDescending":return{name:r("sortDescending","Sort Descending"),icon:j("sortDescending",this.gos,null),action:()=>this.sortController.setSortForColumn(t,"desc",!1,i)};case"sortUnSort":return{name:r("sortUnSort","Clear Sort"),icon:j("sortUnSort",this.gos,null),action:()=>this.sortController.setSortForColumn(t,null,!1,i)};default:return _I(`unknown menu item type ${e}`),null}}createAggregationSubMenu(e,t){const s=this.localeService.getLocaleTextFunc();let i;if(e.isPrimary())i=e;else{const a=e.getColDef().pivotValueColumn;i=VI(a)?a:void 0}const r=[];if(i){const a=i.isValueActive(),o=t.getFuncNames(i);r.push({name:s("noAggregation","None"),action:()=>{this.funcColsService.removeValueColumns([i],"contextMenu"),this.funcColsService.setColumnAggFunc(i,void 0,"contextMenu")},checked:!a}),o.forEach(n=>{r.push({name:s(n,t.getDefaultFuncLabel(n)),action:()=>{this.funcColsService.setColumnAggFunc(i,n,"contextMenu"),this.funcColsService.addValueColumns([i],"contextMenu")},checked:a&&i.getAggFunc()===n})})}return r}},oD=class extends UI{constructor(){super(...arguments),this.beanName="menuUtils"}wireBeans(e){this.focusService=e.focusService,this.headerNavigationService=e.headerNavigationService,this.visibleColsService=e.visibleColsService}restoreFocusOnClose(e,t,s,i){const{eventSource:r}=e,a=s instanceof KeyboardEvent;if(!i&&!a||!r)return;const o=HI(this.gos);!t.contains(o)&&!rd(this.gos)||this.focusHeaderCell(e)}closePopupAndRestoreFocusOnSelect(e,t,s){let i;s&&s.keyboardEvent&&(i=s.keyboardEvent),e(i&&{keyboardEvent:i});const r=this.focusService.getFocusedCell();if(rd(this.gos))if(r){const{rowIndex:a,rowPinned:o,column:n}=r;this.focusService.setFocusedCell({rowIndex:a,column:n,rowPinned:o,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(t)}onContextMenu(e,t,s){if(!this.gos.get("allowContextMenuWithControlKey")&&e&&(e.ctrlKey||e.metaKey)||(e&&this.blockMiddleClickScrollsIfNeeded(e),this.gos.get("suppressContextMenu")))return;const i=e??t.touches[0];if(s(i)){const r=e??t;r&&r.cancelable&&r.preventDefault()}}async focusHeaderCell(e){const{column:t,columnIndex:s,headerPosition:i,eventSource:r}=e,a=await this.visibleColsService.getAllCols().some(o=>o===t);if(!(t&&!t.isAlive())){if(a&&r&&zI(r)){const o=this.focusService.findTabbableParent(r);o&&(t&&this.headerNavigationService.scrollToColumn(t),o.focus())}else if(i&&s!==-1){const o=this.visibleColsService.getAllCols(),n=o[s]||WI(o);n&&this.focusService.focusHeaderPosition({headerPosition:{headerRowIndex:i.headerRowIndex,column:n}})}}}blockMiddleClickScrollsIfNeeded(e){this.gos.get("suppressMiddleClickScrolls")&&e.which===2&&e.preventDefault()}},to="32.3.2",od=Za({version:to,moduleName:`${Xa.MenuModule}-core`,beans:[QI,ZI,aD,KI,YI,qI,oD],dependantModules:[H],userComponents:[{name:"agMenuItem",classImp:ke}]}),nD=Za({version:to,moduleName:`${Xa.MenuModule}-api`,apiFunctions:{showContextMenu:sD,showColumnChooser:iD,hideColumnChooser:rD},dependantModules:[od,yI]}),so=Za({version:to,moduleName:Xa.MenuModule,dependantModules:[od,nD]});import{ModuleNames as nd,_ColumnFilterModule as lD,_ReadOnlyFloatingFilterModule as cD,_defineModule as io}from"ag-grid-community";import{AgPromise as Ee,KeyCode as gs,ProvidedFilter as ld,TabGuardComp as hD,_forEachReverse as cd,_getActiveDomElement as dD,_isNothingFocused as uD,_loadTemplate as pD,_removeFromArray as gD}from"ag-grid-community";import{AgPromise as mD,Component as fD,_clearElement as CD,_mergeDeep as vD,_setDisplayed as ro,getDefaultFloatingFilterType as SD}from"ag-grid-community";var ms=class Pu extends hD{constructor(){super('<div class="ag-multi-filter ag-menu-list-compact"></div>'),this.filterDefs=[],this.filters=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.activeFilterIndices=[],this.lastActivatedMenuItem=null,this.afterFiltersReadyFuncs=[]}wireBeans(t){this.filterManager=t.filterManager,this.userComponentFactory=t.userComponentFactory,this.focusService=t.focusService}postConstruct(){this.initialiseTabGuard({onFocusIn:t=>this.onFocusIn(t)})}static getFilterDefs(t){const{filters:s}=t;return s&&s.length>0?s:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}init(t){this.params=t,this.filterDefs=Pu.getFilterDefs(t);const{column:s,filterChangedCallback:i}=t;this.column=s,this.filterChangedCallback=i;const r=[];return this.filterDefs.forEach((a,o)=>{const n=this.createFilter(a,o);n!=null&&r.push(n)}),new Ee(a=>{Ee.all(r).then(o=>{this.filters=o,this.refreshGui("columnMenu").then(()=>{a()})})}).then(()=>{this.afterFiltersReadyFuncs.forEach(a=>a()),this.afterFiltersReadyFuncs.length=0})}refreshGui(t){return t===this.lastOpenedInContainer?Ee.resolve():(this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),Ee.all(this.filters.map((s,i)=>{const r=this.filterDefs[i],a=this.getFilterTitle(s,r);let o;if(r.display==="subMenu"&&t!=="toolPanel")o=this.insertFilterMenu(s,a).then(n=>n.getGui());else if(r.display==="subMenu"||r.display==="accordion"){const n=this.insertFilterGroup(s,a);o=Ee.resolve(n.getGui())}else o=Ee.resolve(s.getGui());return o})).then(s=>{s.forEach((i,r)=>{r>0&&this.appendChild(pD('<div class="ag-filter-separator"></div>')),this.appendChild(i)}),this.filterGuis=s,this.lastOpenedInContainer=t}))}getFilterTitle(t,s){return s.title!=null?s.title:t instanceof ld?t.getFilterTitle():"Filter"}destroyChildren(){this.guiDestroyFuncs.forEach(t=>t()),this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(t,s){const i=this.createBean(new Et);return i.init({menuItemDef:{name:s,subMenu:[],cssClasses:["ag-multi-filter-menu-item"],menuItem:ke,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:t,contextParams:{column:null,node:null,value:null}}).then(()=>{i.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(i)),this.addManagedListeners(i,{menuItemActivated:a=>{this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==a.menuItem&&this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=a.menuItem}});const r=i.getGui();return i.addManagedElementListeners(r,{keydown:a=>{const{key:o}=a;switch(o){case gs.UP:case gs.RIGHT:case gs.DOWN:case gs.LEFT:a.preventDefault(),o===gs.RIGHT&&i.openSubMenu(!0);break}},focusin:()=>i.activate(),focusout:()=>{!i.isSubMenuOpen()&&!i.isSubMenuOpening()&&i.deactivate()}}),i})}insertFilterGroup(t,s){const i=this.createBean(new pe({title:s,cssIdentifier:"multi-filter"}));return this.guiDestroyFuncs.push(()=>this.destroyBean(i)),i.addItem(t.getGui()),i.toggleGroupExpand(!1),t.afterGuiAttached&&i.addManagedListeners(i,{expanded:()=>t.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})}),i}isFilterActive(){return this.filters.some(t=>t.isFilterActive())}getLastActiveFilterIndex(){return this.activeFilterIndices.length>0?this.activeFilterIndices[this.activeFilterIndices.length-1]:null}doesFilterPass(t,s){let i=!0;return this.filters.forEach(r=>{!i||r===s||!r.isFilterActive()||(i=r.doesFilterPass(t))}),i}getFilterType(){return"multi"}getModelFromUi(){return{filterType:this.getFilterType(),filterModels:this.filters.map(s=>{const i=s;return typeof i.getModelFromUi=="function"?i.getModelFromUi():null})}}getModel(){return this.isFilterActive()?{filterType:this.getFilterType(),filterModels:this.filters.map(s=>s.isFilterActive()?s.getModel():null)}:null}setModel(t){const s=(r,a)=>new Ee(o=>{const n=r.setModel(a);n?n.then(()=>o()):o()});let i=[];return t==null?i=this.filters.map((r,a)=>s(r,null).then(()=>{this.updateActiveList(a)})):this.filters.forEach((r,a)=>{const o=t.filterModels.length>a?t.filterModels[a]:null,n=s(r,o).then(()=>{this.updateActiveList(a)});i.push(n)}),Ee.all(i).then(()=>{})}applyModel(t="api"){let s=!1;return this.filters.forEach(i=>{i instanceof ld&&(s=i.applyModel(t)||s)}),s}getChildFilterInstance(t){return this.filters[t]}afterGuiAttached(t){let s;t?(this.hidePopup=t.hidePopup,s=this.refreshGui(t.container)):(this.hidePopup=void 0,s=Ee.resolve());const i=t?.suppressFocus;s.then(()=>{const{filterDefs:r}=this;let a=!!i;r&&cd(r,(n,l)=>{const c=l===0,h=n.display&&n.display!=="inline",d=i||!c||h,u={...t??{},suppressFocus:d},p=this.filters?.[l];if(p&&(this.executeFunctionIfExistsOnFilter(p,"afterGuiAttached",u),c&&!d&&(a=!0)),!i&&c&&h){const g=this.filterGuis[l];g&&(this.focusService.focusInto(g)||g.focus(),a=!0)}});const o=dD(this.gos);!a&&(uD(this.gos)||this.getGui().contains(o))&&this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged")}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded")}destroy(){this.filters.forEach(t=>this.destroyBean(t)),this.filters.length=0,this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeFunctionIfExists(t,...s){cd(this.filters,i=>{this.executeFunctionIfExistsOnFilter(i,t,s)})}executeFunctionIfExistsOnFilter(t,s,...i){const r=t[s];typeof r=="function"&&r.apply(t,i)}createFilter(t,s){const{filterModifiedCallback:i,doesRowPassOtherFilter:r}=this.params;let a;const o={...this.filterManager.createFilterParams(this.column,this.column.getColDef()),filterModifiedCallback:i,filterChangedCallback:c=>{this.executeWhenAllFiltersReady(()=>this.filterChanged(s,c))},doesRowPassOtherFilter:c=>r(c)&&this.doesFilterPass({node:c,data:c.data},a)},n=this.userComponentFactory.getFilterDetails(t,o,"agTextColumnFilter");if(!n)return null;const l=n.newAgStackInstance();return l&&l.then(c=>a=c),l}executeWhenAllFiltersReady(t){this.filters&&this.filters.length>0?t():this.afterFiltersReadyFuncs.push(t)}updateActiveList(t){const s=this.filters[t];gD(this.activeFilterIndices,t),s.isFilterActive()&&this.activeFilterIndices.push(t)}filterChanged(t,s){this.updateActiveList(t),this.filterChangedCallback(s);const i=this.filters[t];this.filters.forEach(r=>{r!==i&&typeof r.onAnyFilterChanged=="function"&&r.onAnyFilterChanged()})}onFocusIn(t){this.lastActivatedMenuItem!=null&&!this.lastActivatedMenuItem.getGui().contains(t.target)&&(this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=null)}getModelAsString(t){if(!this.filters||!t?.filterModels?.length)return"";const s=this.getLastActiveFilterIndex()??0;return this.filters[s].getModelAsString?.(t.filterModels[s])??""}},yD=class extends fD{constructor(){super('<div class="ag-multi-floating-filter ag-floating-filter-input"></div>'),this.floatingFilters=[],this.compDetailsList=[]}wireBeans(e){this.userComponentFactory=e.userComponentFactory,this.filterManager=e.filterManager}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))}),mD.all(t).then(s=>{s.forEach((i,r)=>{this.floatingFilters.push(i);const a=i.getGui();this.appendChild(a),r>0&&ro(a,!1)})})}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e;const{compDetailsList:t,floatingFilterParamsList:s}=this.getCompDetailsList(e);t.length===this.compDetailsList.length&&t.every((r,a)=>!this.filterManager?.areFilterCompsDifferent(this.compDetailsList[a],r))?s.forEach((r,a)=>{const o=this.floatingFilters[a];let n=!1;o.refresh&&o.refresh(r)!==null&&(n=!0),n||o.onParamsUpdated?.(r)}):(CD(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(t))}getCompDetailsList(e){const t=[],s=[],i=e.filterParams;return ms.getFilterDefs(i).forEach((r,a)=>{const o={...e,parentFilterInstance:l=>{this.parentMultiFilterInstance(c=>{const h=c.getChildFilterInstance(a);h!=null&&l(h)})}};vD(o.filterParams,r.filterParams);const n=this.getCompDetails(r,o);n&&(t.push(n),s.push(o))}),{compDetailsList:t,floatingFilterParamsList:s}}onParentModelChanged(e,t){t&&t.afterFloatingFilter||this.parentMultiFilterInstance(s=>{if(e==null)this.floatingFilters.forEach((i,r)=>{i.onParentModelChanged(null,t),ro(i.getGui(),r===0)});else{const i=s.getLastActiveFilterIndex();this.floatingFilters.forEach((r,a)=>{const o=e.filterModels.length>a?e.filterModels[a]:null;r.onParentModelChanged(o,t);const n=i==null?a===0:a===i;ro(r.getGui(),n)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(e,t){const s=SD(this.frameworkOverrides,e,()=>this.filterManager.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return this.userComponentFactory.getFloatingFilterCompDetails(e,t,s)}parentMultiFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof ms))throw new Error("AG Grid - MultiFloatingFilterComp expects MultiFilter as its parent");e(t)})}},ao="32.3.2",hd=io({version:ao,moduleName:`${nd.MultiFilterModule}-core`,userComponents:[{name:"agMultiColumnFilter",classImp:ms},{name:"agMenuItem",classImp:ke}],dependantModules:[H,lD]}),wD=io({version:ao,moduleName:"@ag-grid-enterprise/multi-floating-filter",userComponents:[{name:"agMultiColumnFloatingFilter",classImp:yD}],dependantModules:[hd,cD]}),oo=io({version:ao,moduleName:nd.MultiFilterModule,dependantModules:[hd,wD]});import{ModuleNames as xD,_EditCoreModule as bD,_defineModule as PD}from"ag-grid-community";import{PopupComponent as TD,_missing as MD,_warnOnce as dd}from"ag-grid-community";var ud=class extends TD{constructor(){super('<div class="ag-cell-edit-wrapper"></div>')}init(e){this.params=e;const{cellStartedEdit:t,values:s}=e;MD(s)&&dd("agRichSelectCellEditor requires cellEditorParams.values to be set");const{params:i,valuesPromise:r}=this.buildRichSelectParams();this.richSelect=this.createManagedBean(new Rt(i)),this.richSelect.addCssClass("ag-cell-editor"),this.appendChild(this.richSelect),r&&r.then(a=>{this.richSelect.setValueList({valueList:a,refresh:!0});const o=this.getSearchStringCallback(a);o&&this.richSelect.setSearchStringCreator(o)}),this.addManagedListeners(this.richSelect,{fieldPickerValueSelected:this.onEditorPickerValueSelected.bind(this)}),this.focusAfterAttached=t}onEditorPickerValueSelected(e){setTimeout(()=>this.params.stopEditing(!e.fromEnterKey))}buildRichSelectParams(){const{cellRenderer:e,cellHeight:t,value:s,values:i,formatValue:r,searchDebounceDelay:a,valueListGap:o,valueListMaxHeight:n,valueListMaxWidth:l,allowTyping:c,filterList:h,searchType:d,highlightMatch:u,valuePlaceholder:p,eventKey:g,multiSelect:m,suppressDeselectAll:C,suppressMultiSelectPillRenderer:f}=this.params,v={value:s,cellRenderer:e,cellRowHeight:t,searchDebounceDelay:a,valueFormatter:r,pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"virtual-list",pickerGap:o,allowTyping:c,filterList:h,searchType:d,highlightMatch:u,maxPickerHeight:n,maxPickerWidth:l,placeholder:p,initialInputValue:g?.length===1?g:void 0,multiSelect:m,suppressDeselectAll:C,suppressMultiSelectPillRenderer:f};let S,y;return typeof i=="function"?S=i(this.params):S=i??[],Array.isArray(S)?(v.valueList=S,v.searchStringCreator=this.getSearchStringCallback(S)):y=S,m&&c&&(this.params.allowTyping=v.allowTyping=!1,dd("agRichSelectCellEditor cannot have `multiSelect` and `allowTyping` set to `true`. AllowTyping has been turned off.")),{params:v,valuesPromise:y}}getSearchStringCallback(e){const{colDef:t}=this.params;if(!(typeof e[0]!="object"||!t.keyCreator))return s=>s.map(i=>{const r=this.gos.addGridCommonParams({value:i,colDef:this.params.colDef,column:this.params.column,node:this.params.node,data:this.params.data});return t.keyCreator(r)})}afterGuiAttached(){const{focusAfterAttached:e,params:t}=this;setTimeout(()=>{if(!this.isAlive())return;if(e){const i=this.richSelect.getFocusableElement();i.focus();const{allowTyping:r,eventKey:a}=this.params;r&&(!a||a.length!==1)&&i.select()}this.richSelect.showPicker();const{eventKey:s}=t;s&&s?.length===1&&this.richSelect.searchTextFromString(s)})}focusIn(){this.richSelect.getFocusableElement().focus()}getValue(){return this.richSelect.getValue()}isPopup(){return!1}},FD="32.3.2",no=PD({version:FD,moduleName:xD.RichSelectModule,beans:[],userComponents:[{name:"agRichSelect",classImp:ud},{name:"agRichSelectCellEditor",classImp:ud}],dependantModules:[H,bD]});import{ModuleNames as lo,RowModelHelperService as AD,_CsrmSsrmSharedApiModule as RD,_RowNodeBlockModule as ED,_SsrmInfiniteSharedApiModule as ID,_defineModule as co}from"ag-grid-community";import{BeanStub as DD,RowNode as LD,_doOnce as kD,_exists as Ie,_getGroupTotalRowCallback as pd,_getRowHeightAsNumber as GD,_getRowHeightForNode as gd,_missing as md,_warnOnce as fs}from"ag-grid-community";import{BeanStub as OD,RowNode as BD,_exists as ho,_getRowHeightForNode as ND,_isServerSideRowModel as VD,_missing as _D}from"ag-grid-community";import{BeanStub as UD,_isServerSideRowModel as HD}from"ag-grid-community";import{BeanStub as zD}from"ag-grid-community";import{BeanStub as WD,_isServerSideRowModel as KD}from"ag-grid-community";import{BeanStub as $D,_warnOnce as uo}from"ag-grid-community";import{BeanStub as jD,ModuleNames as YD,NumberSequence as fd,RowNode as qD,_debounce as XD,_errorOnce as ZD,_getRowHeightAsNumber as JD,_getRowHeightForNode as Cs,_isGetRowHeightFunction as QD,_isRowSelection as eL,_jsonEquals as tL,_warnOnce as Cd}from"ag-grid-community";import{NumberSequence as Ai,RowNodeBlock as sL,ServerSideTransactionResultStatus as vs,_errorOnce as vd,_getAllValuesInObject as iL,_getRowIdCallback as Sd,_insertIntoArray as rL,_missing as aL,_missingOrEmpty as oL,_warnOnce as nL}from"ag-grid-community";import{BeanStub as lL,NumberSequence as Ri,ServerSideTransactionResultStatus as po,_getGroupTotalRowCallback as yd,_getRowHeightAsNumber as wd,_getRowIdCallback as cL,_warnOnce as hL}from"ag-grid-community";import{BeanStub as dL,_getRowHeightAsNumber as uL,_getRowIdCallback as pL,_warnOnce as gL}from"ag-grid-community";import{BeanStub as mL}from"ag-grid-community";import{_warnOnce as fL}from"ag-grid-community";import{ExpansionService as CL}from"ag-grid-community";import{BeanStub as vL,_getGroupSelectsDescendants as xd,_getRowSelectionMode as go,_isUsingNewRowSelectionAPI as SL,_warnOnce as Ss}from"ag-grid-community";import{BeanStub as yL,_errorOnce as mo,_isMultiRowSelection as bd,_isUsingNewRowSelectionAPI as wL,_last as xL,_warnOnce as Ei,isSelectionUIEvent as bL}from"ag-grid-community";import{BeanStub as PL,_errorOnce as Pd,_isMultiRowSelection as TL,_last as Td,_warnOnce as ML,isSelectionUIEvent as FL}from"ag-grid-community";import{BeanStub as AL,_warnOnce as Md}from"ag-grid-community";import{BeanStub as RL,_isServerSideRowModel as EL,_missingOrEmpty as IL,_warnOnce as Fd}from"ag-grid-community";import{BeanStub as DL,ServerSideTransactionResultStatus as xt,_isServerSideRowModel as LL}from"ag-grid-community";var kL="ag-Grid-MissingKey",GL=class extends DD{constructor(){super(...arguments),this.beanName="ssrmBlockUtils"}wireBeans(e){this.valueService=e.valueService,this.showRowGroupColsService=e.showRowGroupColsService,this.nodeManager=e.ssrmNodeManager,this.beans=e,this.expansionService=e.expansionService,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}createRowNode(e){const t=new LD(this.beans),s=e.rowHeight!=null?e.rowHeight:GD(this.gos);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}destroyRowNodes(e){e&&e.forEach(t=>this.destroyRowNode(t))}destroyRowNode(e,t=!1){e.childStore&&!t&&(this.destroyBean(e.childStore),e.childStore=null),e.sibling&&!e.footer&&this.destroyRowNode(e.sibling,!1),e.clearRowTopAndRowIndex(),e.id!=null&&this.nodeManager.removeNode(e)}setTreeGroupInfo(e){e.updateHasChildren();const t=this.gos.get("getServerSideGroupKey");e.hasChildren()&&t!=null&&(e.key=t(e.data)),!e.hasChildren()&&e.childStore!=null&&(this.destroyBean(e.childStore),e.childStore=null,e.expanded=!1)}setRowGroupInfo(e){if(e.key=this.valueService.getValue(e.rowGroupColumn,e),(e.key===null||e.key===void 0)&&kD(()=>{fs("null and undefined values are not allowed for server side row model keys"),e.rowGroupColumn&&fs(`column = ${e.rowGroupColumn.getId()}`),fs("data is "+e.data)},"ServerSideBlock-CannotHaveNullOrUndefinedForKey"),this.gos.get("groupAllowUnbalanced")&&e.key===""){const r=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(r,e))}pd(this.beans.gos)({node:e})&&(e.createFooter(),e.sibling&&(e.sibling.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)):e.group?(this.setChildCountIntoRowNode(e),e.footer||(pd(this.beans.gos)({node:e})?e.sibling?e.sibling.updateData(t):e.createFooter():e.sibling&&e.destroyFooter())):this.gos.get("masterDetail")}setDataIntoRowNode(e,t,s,i){e.stub=!1;const r=this.gos.get("treeData");Ie(t)?(e.setDataAndId(t,s),r?this.setTreeGroupInfo(e):e.group?this.setRowGroupInfo(e):this.gos.get("masterDetail")&&this.setMasterDetailInfo(e)):(e.setDataAndId(void 0,void 0),e.key=null),(r||e.group)&&(this.setGroupDataIntoRowNode(e),this.setChildCountIntoRowNode(e)),Ie(t)&&(e.setRowHeight(gd(this.gos,e,!1,i).height),e.sibling?.setRowHeight(gd(this.gos,e.sibling,!1,i).height))}setChildCountIntoRowNode(e){const t=this.gos.get("getChildCount");t&&e.setAllChildrenCount(t(e.data))}setGroupDataIntoRowNode(e){const t=this.showRowGroupColsService?.getShowRowGroupCols()??[],s=this.gos.get("treeData");t.forEach(i=>{if(e.groupData==null&&(e.groupData={}),s)e.groupData[i.getColId()]=e.key;else if(i.isRowGroupDisplayed(e.rowGroupColumn.getId())){const r=this.valueService.getValue(e.rowGroupColumn,e);e.groupData[i.getColId()]=r}})}clearDisplayIndex(e){e.clearRowTopAndRowIndex(),e.hasChildren()&&Ie(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.next()),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.next()),e.detailNode.setRowTop(s.value),s.value+=e.detailNode.rowHeight):e.detailNode&&e.detailNode.clearRowTopAndRowIndex()),e.hasChildren()&&Ie(e.childStore)){const l=e.childStore;e.expanded||r?l.setDisplayIndexes(t,s,r?i:i+1):l.clearDisplayIndexes()}}binarySearchForDisplayIndex(e,t){let s=0,i=t.length-1;if(md(i)||md(s)){fs(`error: topPointer = ${i}, bottomPointer = ${s}`);return}for(;;){const r=Math.floor((s+i)/2),a=t[r];if(a.rowIndex===e)return a;const o=a.master&&a.expanded,n=a.detailNode;if(o&&n&&n.rowIndex===e)return a.detailNode;const l=a.childStore;if(a.expanded&&l&&l.isDisplayIndexInStore(e))return l.getRowUsingDisplayIndex(e);if(a.rowIndex<e)s=r+1;else if(a.rowIndex>e)i=r-1;else{fs(`error: unable to locate rowIndex = ${e} in cache`);return}}}extractRowBounds(e,t){const s=i=>({rowHeight:i.rowHeight,rowTop:i.rowTop});if(e.rowIndex===t)return s(e);if(e.hasChildren()&&e.expanded&&Ie(e.childStore)){const i=e.childStore;if(i.isDisplayIndexInStore(t))return i.getRowBounds(t)}else if(e.master&&e.expanded&&Ie(e.detailNode)&&e.detailNode.rowIndex===t)return s(e.detailNode)}isPixelInNodeRange(e,t){return!Ie(e.rowTop)||!Ie(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 e.detailNode.rowIndex;if(e.hasChildren()&&e.expanded&&Ie(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(kL):t.push(s.key),s=s.parent;if(t.length>0)return t.reverse().join("-")}checkOpenByDefault(e){return this.expansionService.checkOpenByDefault(e)}},OL=class extends OD{constructor(){super(...arguments),this.beanName="ssrmExpandListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory,this.beans=e}postConstruct(){VD(this.gos)&&this.addManagedEventListeners({rowGroupOpened:this.onRowGroupOpened.bind(this)})}onRowGroupOpened(e){const t=e.node;if(t.expanded){if(t.master)this.createDetailNode(t);else if(_D(t.childStore)){const s=this.serverSideRowModel.getParams();t.childStore=this.createBean(this.storeFactory.createStore(s,t))}}else this.gos.get("purgeClosedRowNodes")&&ho(t.childStore)&&(t.childStore=this.destroyBean(t.childStore));this.eventService.dispatchEvent({type:"storeUpdated"})}createDetailNode(e){if(ho(e.detailNode))return e.detailNode;const t=new BD(this.beans);t.detail=!0,t.selectable=!1,t.parent=e,ho(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1;const s=200,i=ND(this.gos,t).height;return t.rowHeight=i||s,e.detailNode=t,t}},BL=class extends UD{constructor(){super(...arguments),this.beanName="ssrmFilterListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.filterManager=e.filterManager,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){HD(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?.isAdvancedFilterEnabled()){i=this.filterManager.getAdvancedFilterModel();const l=e?Object.keys(s??{}):this.getAdvancedFilterColumns(s),c=this.getAdvancedFilterColumns(i);l.forEach(h=>c.add(h)),r=Array.from(c)}else if(i=this.filterManager?.getFilterModel()??{},e){const l=this.getAdvancedFilterColumns(s);Object.keys(i).forEach(c=>l.add(c)),r=Array.from(l)}else r=this.findChangedColumns(s,i);const a=this.listenerUtils.isSortingWithValueColumn(r),o=this.listenerUtils.isSortingWithSecondaryColumn(r),n={valueColChanged:a,secondaryColChanged:o,changedColumns:r};this.serverSideRowModel.refreshAfterFilter(i,n)}findChangedColumns(e,t){const s={};Object.keys(e).forEach(r=>s[r]=!0),Object.keys(t).forEach(r=>s[r]=!0);const i=[];return Object.keys(s).forEach(r=>{const a=JSON.stringify(e[r]),o=JSON.stringify(t[r]);a!=o&&i.push(r)}),i}getAdvancedFilterColumns(e){const t=new Set;if(!e)return t;const s=i=>{i.filterType==="join"?i.conditions.forEach(r=>s(r)):t.add(i.colId)};return s(e),t}},NL=class extends zD{constructor(){super(...arguments),this.beanName="ssrmListenerUtils"}wireBeans(e){this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService}isSortingWithValueColumn(e){const t=this.funcColsService.getValueColumns().map(s=>s.getColId());for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>-1)return!0;return!1}isSortingWithSecondaryColumn(e){const t=this.pivotResultColsService.getPivotResultCols();if(!t)return!1;const s=t.list.map(i=>i.getColId());for(let i=0;i<e.length;i++)if(s.indexOf(e[i])>-1)return!0;return!1}},VL=class extends WD{constructor(){super(...arguments),this.beanName="ssrmSortService"}wireBeans(e){this.sortController=e.sortController,this.serverSideRowModel=e.rowModel,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){KD(this.gos)&&this.addManagedEventListeners({sortChanged:this.onSortChanged.bind(this)})}onSortChanged(){const e=this.serverSideRowModel.getParams();if(!e)return;const t=this.sortController.getSortModel(),s=e.sortModel,i=this.findChangedColumnsInSort(t,s),r=this.listenerUtils.isSortingWithValueColumn(i),a=this.listenerUtils.isSortingWithSecondaryColumn(i),o={valueColChanged:r,secondaryColChanged:a,changedColumns:i};this.serverSideRowModel.refreshAfterSort(t,o)}findChangedColumnsInSort(e,t){let s=[];[e,t].forEach(a=>{if(a){const o=a.map(n=>n.colId);s=s.concat(o)}});const i=(a,o)=>{const n=a?a.sort:null,l=o?o.sort:null;return n!==l},r=(a,o)=>{const n=a?t.indexOf(a):-1,l=o?e.indexOf(o):-1;return n!==l};return s.filter(a=>{const o=t.find(l=>l.colId===a),n=e.find(l=>l.colId===a);return i(o,n)||r(o,n)})}},_L=class extends $D{constructor(){super(...arguments),this.beanName="ssrmNodeManager",this.rowNodes={}}addRowNode(e){const t=e.id;this.rowNodes[t]&&(uo(`Duplicate node id ${e.id}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`),uo("first instance",this.rowNodes[t].data),uo("second instance",e.data)),this.rowNodes[t]=e}removeNode(e){const t=e.id;this.rowNodes[t]&&(this.rowNodes[t]=void 0)}destroy(){this.clear(),super.destroy()}clear(){this.rowNodes={},super.destroy()}},fo=class extends sL{constructor(e,t,s){super(0),this.nodeIdSequence=new Ai,this.info={},this.ssrmParams=e,this.parentRowNode=s,this.level=s.level+1,this.groupLevel=e.rowGroupCols?this.level<e.rowGroupCols.length:void 0,this.leafGroup=e.rowGroupCols?this.level===e.rowGroupCols.length-1:!1}wireBeans(e){this.storeUtils=e.ssrmStoreUtils,this.blockUtils=e.ssrmBlockUtils,this.funcColsService=e.funcColsService,this.rowNodeBlockLoader=e.rowNodeBlockLoader,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController,this.selectionService=e.selectionService,this.nodeManager=e.ssrmNodeManager,this.filterManager=e.filterManager,this.transactionManager=e.ssrmTransactionManager,this.serverSideRowModel=e.rowModel}postConstruct(){if(this.usingTreeData=this.gos.get("treeData"),this.nodeIdPrefix=this.blockUtils.createNodeIdPrefix(this.parentRowNode),!this.usingTreeData&&this.groupLevel){const i=this.ssrmParams.rowGroupCols[this.level];this.groupField=i.field,this.rowGroupColumn=this.funcColsService.getRowGroupColumns()[this.level]}let e=1;const t=this.parentRowNode.level===-1,s=this.storeUtils.getServerSideInitialRowCount();t&&s!=null&&(e=s),this.initialiseRowNodes(e),this.rowNodeBlockLoader.addBlock(this),this.addDestroyFunc(()=>this.rowNodeBlockLoader.removeBlock(this)),this.postSortFunc=this.gos.getCallback("postSortRows"),s!=null&&this.eventService.dispatchEventOnce({type:"rowCountReady"})}destroy(){this.destroyRowNodes(),super.destroy()}destroyRowNodes(){this.blockUtils.destroyRowNodes(this.allRowNodes),this.allRowNodes=[],this.nodesAfterSort=[],this.nodesAfterFilter=[],this.allNodesMap={}}initialiseRowNodes(e,t=!1){this.destroyRowNodes();for(let s=0;s<e;s++){const i=this.blockUtils.createRowNode({field:this.groupField,group:this.groupLevel,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn});t&&(i.failedLoad=!0),this.allRowNodes.push(i),this.nodesAfterFilter.push(i),this.nodesAfterSort.push(i)}}getBlockStateJson(){return{id:this.nodeIdPrefix?this.nodeIdPrefix:"",state:this.getState()}}loadFromDatasource(){this.storeUtils.loadFromDatasource({startRow:void 0,endRow:void 0,parentBlock:this,parentNode:this.parentRowNode,storeParams:this.ssrmParams,success:this.success.bind(this,this.getVersion()),fail:this.pageLoadFailed.bind(this,this.getVersion())})}getStartRow(){return 0}getEndRow(){return this.nodesAfterSort.length}createDataNode(e,t){const s=this.blockUtils.createRowNode({field:this.groupField,group:this.groupLevel,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn});t!=null?rL(this.allRowNodes,s,t):this.allRowNodes.push(s);const i=this.prefixId(this.nodeIdSequence.next());return this.blockUtils.setDataIntoRowNode(s,e,i,void 0),this.nodeManager.addRowNode(s),this.blockUtils.checkOpenByDefault(s),this.allNodesMap[s.id]=s,s}prefixId(e){return this.nodeIdPrefix?this.nodeIdPrefix+"-"+e:e.toString()}processServerFail(){this.initialiseRowNodes(1,!0),this.fireStoreUpdatedEvent(),this.flushAsyncTransactions()}processServerResult(e){if(!this.isAlive())return;const t=e.groupLevelInfo;t&&Object.assign(this.info,t),e.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(e.pivotResultFields);const s=this.allRowNodes.length>0?this.allNodesMap:void 0;this.allRowNodes=[],this.nodesAfterSort=[],this.nodesAfterFilter=[],this.allNodesMap={},e.rowData||nL('"params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'),this.createOrRecycleNodes(s,e.rowData),s&&this.blockUtils.destroyRowNodes(iL(s)),this.level===0&&this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.filterAndSortNodes(),this.fireStoreUpdatedEvent(),this.flushAsyncTransactions()}createOrRecycleNodes(e,t){if(!t)return;const s=r=>{if(!e)return;const a=Sd(this.gos);if(!a)return;const o=this.parentRowNode.getRoute()??[],n=this.level,l=a({data:r,parentKeys:o.length>0?o:void 0,level:n}),c=e[l];if(c)return delete e[l],c},i=(r,a)=>{this.allNodesMap[r.id]=r,this.blockUtils.updateDataIntoRowNode(r,a),this.allRowNodes.push(r)};t.forEach(r=>{const a=s(r);a?i(a,r):this.createDataNode(r)})}flushAsyncTransactions(){window.setTimeout(()=>this.transactionManager.flushAsyncTransactions(),0)}filterAndSortNodes(){this.filterRowNodes(),this.sortRowNodes()}sortRowNodes(){const e=this.storeUtils.isServerSideSortAllLevels()||this.storeUtils.isServerSideSortOnServer(),t=this.sortController.getSortOptions(),s=!t||t.length==0;if(e||s){this.nodesAfterSort=this.nodesAfterFilter;return}if(this.nodesAfterSort=this.rowNodeSorter.doFullSort(this.nodesAfterFilter,t),this.postSortFunc){const i={nodes:this.nodesAfterSort};this.postSortFunc(i)}}filterRowNodes(){const e=!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||this.storeUtils.isServerSideFilterOnServer(),t=this.groupLevel;if(e||t){this.nodesAfterFilter=this.allRowNodes;return}this.nodesAfterFilter=this.filterManager?this.allRowNodes.filter(s=>this.filterManager.doesRowPassFilter({rowNode:s})):this.allRowNodes}clearDisplayIndexes(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.allRowNodes.forEach(e=>this.blockUtils.clearDisplayIndex(e))}getDisplayIndexEnd(){return this.displayIndexEnd}isDisplayIndexInStore(e){return this.getRowCount()===0?!1:e>=this.displayIndexStart&&e<this.displayIndexEnd}setDisplayIndexes(e,t,s){this.displayIndexStart=e.peek(),this.topPx=t.value;const i={};this.nodesAfterSort.forEach(r=>{this.blockUtils.setDisplayIndex(r,e,t,s),i[r.id]=!0}),this.allRowNodes.forEach(r=>{i[r.id]||this.blockUtils.clearDisplayIndex(r)}),this.displayIndexEnd=e.peek(),this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t=new Ai){e(this,t.next()),this.allRowNodes.forEach(s=>{const i=s.childStore;i&&i.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t=new Ai){this.allRowNodes.forEach(s=>{e(s,t.next());const i=s.childStore;i&&i.forEachNodeDeep(e,t)})}forEachNodeDeepAfterFilterAndSort(e,t=new Ai,s=!1){this.nodesAfterSort.forEach(i=>{e(i,t.next());const r=i.childStore;r&&r.forEachNodeDeepAfterFilterAndSort(e,t,s)}),s&&this.parentRowNode.sibling&&e(this.parentRowNode.sibling,t.next())}getRowUsingDisplayIndex(e){return this.isDisplayIndexInStore(e)?this.blockUtils.binarySearchForDisplayIndex(e,this.nodesAfterSort):void 0}getRowBounds(e){for(let t=0;t<this.nodesAfterSort.length;t++){const s=this.nodesAfterSort[t],i=this.blockUtils.extractRowBounds(s,e);if(i)return i}return null}isPixelInRange(e){return e>=this.topPx&&e<this.topPx+this.heightPx}getRowIndexAtPixel(e){if(e<=this.topPx)return this.nodesAfterSort[0].rowIndex;if(e>=this.topPx+this.heightPx){const a=this.nodesAfterSort[this.nodesAfterSort.length-1];if(!a)return null;const o=a.rowTop+a.rowHeight;if(e>=o&&a.expanded){if(a.childStore&&a.childStore.getRowCount()>0)return a.childStore.getRowIndexAtPixel(e);if(a.detailNode)return a.detailNode.rowIndex}return a.rowIndex}let i=null;return this.nodesAfterSort.forEach(a=>{const o=this.blockUtils.getIndexAtPixel(a,e);o!=null&&(i=o)}),i??this.displayIndexEnd-1}getChildStore(e){return this.storeUtils.getChildStore(e,this,t=>this.allRowNodes.find(i=>i.key==t))}forEachChildStoreShallow(e){this.allRowNodes.forEach(t=>{const s=t.childStore;s&&e(s)})}refreshAfterFilter(e){const t=this.storeUtils.isServerSideFilterOnServer(),s=this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e);if(!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||t&&s){this.refreshStore(!0),this.sortRowNodes();return}this.filterRowNodes(),this.sortRowNodes(),this.forEachChildStoreShallow(r=>r.refreshAfterFilter(e))}refreshAfterSort(e){const t=this.storeUtils.isServerSideSortOnServer(),s=this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e);if(this.storeUtils.isServerSideSortAllLevels()||t&&s){this.refreshStore(!0),this.filterRowNodes();return}this.filterRowNodes(),this.sortRowNodes(),this.forEachChildStoreShallow(r=>r.refreshAfterSort(e))}applyTransaction(e){switch(this.getState()){case"failed":return{status:vs.StoreLoadingFailed};case"loading":return{status:vs.StoreLoading};case"needsLoading":return{status:vs.StoreWaitingToLoad}}const t=this.gos.getCallback("isApplyServerSideTransaction");if(t){const r={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!t(r))return{status:vs.Cancelled}}const s={status:vs.Applied,remove:[],update:[],add:[]},i=[];return this.executeAdd(e,s),this.executeRemove(e,s,i),this.executeUpdate(e,s,i),this.filterAndSortNodes(),this.updateSelection(i),s}updateSelection(e){e.length>0&&(this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,clearSelection:!1,source:"rowDataChanged"}),this.eventService.dispatchEvent({type:"selectionChanged",source:"rowDataChanged"}))}executeAdd(e,t){const{add:s,addIndex:i}=e;if(oL(s))return;typeof i=="number"&&i>=0?s.reverse().forEach(a=>{const o=this.createDataNode(a,i);t.add.push(o)}):s.forEach(a=>{const o=this.createDataNode(a);t.add.push(o)})}executeRemove(e,t,s){const{remove:i}=e;if(i==null)return;const r={};i.forEach(a=>{const o=this.lookupRowNode(a);o&&(o.isSelected()&&s.push(o),o.clearRowTopAndRowIndex(),r[o.id]=!0,delete this.allNodesMap[o.id],t.remove.push(o),this.nodeManager.removeNode(o))}),this.allRowNodes=this.allRowNodes.filter(a=>!r[a.id])}executeUpdate(e,t,s){const{update:i}=e;i?.forEach(r=>{const a=this.lookupRowNode(r);a&&(this.blockUtils.updateDataIntoRowNode(a,r),!a.selectable&&a.isSelected()&&s.push(a),t.update.push(a))})}lookupRowNode(e){const t=Sd(this.gos);if(t!=null){const s=this.parentRowNode.getRoute()??[],i=t({data:e,parentKeys:s.length>0?s:void 0,level:this.level}),r=this.allNodesMap[i];return r||(vd(`could not find row id=${i}, data item was not found for this id`),null)}else{const s=this.allRowNodes.find(i=>i.data===e);return s||(vd("could not find data item as object was not found",e),null)}}addStoreStates(e){e.push({suppressInfiniteScroll:!0,route:this.parentRowNode.getRoute()??[],rowCount:this.allRowNodes.length,info:this.info}),this.forEachChildStoreShallow(t=>t.addStoreStates(e))}refreshStore(e){if(e){const t=this.nodesAfterSort?this.nodesAfterSort.length:1;this.initialiseRowNodes(t)}this.scheduleLoad(),this.fireStoreUpdatedEvent()}retryLoads(){this.getState()==="failed"&&(this.initialiseRowNodes(1),this.scheduleLoad()),this.forEachChildStoreShallow(e=>e.retryLoads())}scheduleLoad(){this.setStateWaitingToLoad(),this.rowNodeBlockLoader.checkBlockToLoad()}fireStoreUpdatedEvent(){this.eventService.dispatchEvent({type:"storeUpdated"})}getRowCount(){return this.nodesAfterSort.length}getTopLevelRowDisplayedIndex(e){return this.nodesAfterSort[e].rowIndex}isLastRowIndexKnown(){return this.getState()=="loaded"}getRowNodesInRange(e,t){const s=[];let i=!1;return aL(e)&&(i=!0),this.nodesAfterSort.forEach(a=>{const o=a===e||a===t;(i||o)&&s.push(a),o&&(i=!i)}),i?[]:s}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}},Co=class extends mL{constructor(){super(...arguments),this.beanName="lazyBlockLoadingService",this.cacheLoadingNodesMap=new Map,this.isCheckQueued=!1,this.nextBlockToLoad=void 0}wireBeans(e){this.rowNodeBlockLoader=e.rowNodeBlockLoader,this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}postConstruct(){this.addManagedListeners(this.rowNodeBlockLoader,{blockLoaded:()=>this.queueLoadCheck()})}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,window.queueMicrotask(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}queueLoadAction(){const e=this.getBlockToLoad();if(!e)return;const t=this.nextBlockToLoad&&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){const i=this.rowNodeBlockLoader.getAvailableLoadingCount();i!=null&&i===0||(this.rowNodeBlockLoader.registerLoads(1),this.executeLoad(e,t,s),this.queueLoadCheck())}executeLoad(e,t,s){const i=e.getSsrmParams(),r={startRow:t,endRow:s,rowGroupCols:i.rowGroupCols,valueCols:i.valueCols,pivotCols:i.pivotCols,pivotMode:i.pivotMode,groupKeys:e.store.getParentNode().getRoute()??[],filterModel:i.filterModel,sortModel:i.sortModel},a=this.cacheLoadingNodesMap.get(e),o=()=>{for(let d=0;d<s-t;d++)a.delete(t+d)},n=()=>{for(let d=0;d<s-t;d++)a.add(t+d)},l=d=>{this.rowNodeBlockLoader.loadComplete(),e.onLoadSuccess(t,s-t,d),o()},c=()=>{this.rowNodeBlockLoader.loadComplete(),e.onLoadFailed(t,s-t),o()},h=this.gos.addGridCommonParams({request:r,success:l,fail:c,parentNode:e.store.getParentNode()});n(),e.getSsrmParams().datasource?.getRows(h)}getBlockToLoad(){const e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow();for(let n=e;n<=t;n++){const l=this.rowModel.getRow(n);if(!l)continue;const c=l.parent&&l.parent.childStore;if(!c||!(c instanceof ys))continue;const h=c.getCache(),d=h.getNodes().getBy("node",l);if(!(!d||this.cacheLoadingNodesMap.get(h)?.has(d.index))&&(l.__needsRefreshWhenVisible||l.stub&&!l.failedLoad))return{cache:h,index:h.getBlockStartIndex(d.index)}}let s=null,i=null,r=Number.MAX_SAFE_INTEGER;for(const n of this.cacheLoadingNodesMap.keys())n.getNodesToRefresh().forEach(c=>{if(c.rowIndex==null){i=c,s=n;return}const h=n.getNodes().getBy("node",c);if(!h||this.cacheLoadingNodesMap.get(n)?.has(h.index))return;const u=Math.abs(e-c.rowIndex),p=Math.abs(c.rowIndex-t);u<r&&(i=c,r=u,s=n),p<r&&(i=c,r=p,s=n)});if(!s)return;const a=s,o=a.getNodes().getBy("node",i)?.index;return o==null?void 0:{cache:a,index:a.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};Co.DEFAULT_BLOCK_SIZE=100;var UL=class{constructor(...e){if(e.length<1)throw new Error("AG Grid: At least one index must be provided.");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){const s=this.maps.get(e);if(!s)throw new Error(`AG Grid: ${String(e)} not found`);return s.get(t)}set(e){this.indexes.forEach(t=>{const s=this.maps.get(t);if(!s)throw new Error(`AG Grid: ${String(t)} not found`);s.set(e[t],e)})}delete(e){this.indexes.forEach(t=>{const s=this.maps.get(t);if(!s)throw new Error(`AG Grid: ${String(t)} not found`);s.delete(e[t])})}clear(){this.maps.forEach(e=>e.clear())}getIterator(e){const t=this.maps.get(e);if(!t)throw new Error(`AG Grid: ${String(e)} not found`);return t.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}},vo=class extends dL{constructor(e,t,s,i){super(),this.live=!0,this.removedNodeCache=new Map,this.store=e,this.numberOfRows=t,this.isLastRowKnown=s,this.storeParams=i}wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusService=e.focusService,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController,this.lazyBlockLoadingService=e.lazyBlockLoadingService}postConstruct(){this.lazyBlockLoadingService.subscribe(this),this.nodeMap=new UL("index","id","node"),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set,this.defaultNodeIdPrefix=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),this.getRowIdFunc=pL(this.gos),this.isMasterDetail=this.gos.get("masterDetail")}destroy(){this.lazyBlockLoadingService.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.lazyBlockLoadingService.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:a,nextNode:o}=r;if(a&&a.node.expanded&&a.node.childStore?.isDisplayIndexInStore(e))return a.node.childStore?.getRowUsingDisplayIndex(e);if(o){const l=o.node.rowIndex-e,c=o.index-l;return this.createStubNode(c,e)}const n=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(n,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;for(const a in r)i.setGroupValue(a,r[a])}return this.lazyBlockLoadingService.queueLoadCheck(),i}getRowByStoreIndex(e){return this.nodeMap.getBy("index",e)?.node}skipDisplayIndexes(e,t,s){if(e===0)return;const i=uL(this.gos);t.skip(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 in i){const n=i[o],l=Number(o),c=l-1-r;this.skipDisplayIndexes(c,e,t);const h=l===0;if(n.setFirstChild(h),h&&this.gos.get("groupHideOpenParents")){const d=this.store.getParentNode().groupData;for(const u in d)n.setGroupValue(u,h?d[u]:void 0)}this.blockUtils.setDisplayIndex(n,e,t,s),n.rowIndex!=null&&this.nodeDisplayIndexMap.set(n.rowIndex,n),r=l}const a=this.numberOfRows-1-r;this.skipDisplayIndexes(a,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(e,t){if(e<0)throw new Error("AG Grid: setRowCount can only accept a positive row count.");this.numberOfRows=e,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}if(t==null||t.node.rowIndex>i.node.rowIndex){t=i;return}}),!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}if(s==null||s.index>o.index){s=o;return}}),!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:a}=i;if(a.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,a))return this.blockUtils.updateDataIntoRowNode(a,t),this.nodesToRefresh.delete(a),a;if(this.getRowIdFunc==null&&a.hasChildren()&&a.expanded)return this.nodesToRefresh.delete(a),a;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){const a=this.getRowId(t),o=a&&this.removedNodeCache?.get(a);if(o)return this.removedNodeCache?.delete(a),this.blockUtils.updateDataIntoRowNode(o,t),this.nodeMap.set({id:o.id,node:o,index:e}),this.nodesToRefresh.delete(o),o.__needsRefreshWhenVisible=!1,o;const n=this.nodeMap.getBy("id",a);if(n){this.nodeMap.delete(n);const{node:l,index:c}=n;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 a=this.getPrefixedId(this.store.getIdSequence().next());this.blockUtils.setDataIntoRowNode(r,t,a,void 0),this.serverSideRowModel.setPaused(!0),this.blockUtils.checkOpenByDefault(r),this.serverSideRowModel.setPaused(!1),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:a,index:o})=>{const n=this.getBlockStartIndex(o);!a.stub&&!a.failedLoad&&(e[n]=(e[n]??0)+1);let l="loaded";a.failedLoad?l="failed":this.lazyBlockLoadingService.isRowLoading(this,n)?l="loading":(this.nodesToRefresh.has(a)||a.stub)&&(l="needsLoading"),t[n]||(t[n]=new Set),t[n].add(l)});const s={loading:4,failed:3,needsLoading:2,loaded:1},i=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),r={};return Object.entries(t).forEach(([a,o])=>{const l=[...o].sort((d,u)=>(s[d]??0)-(s[u]??0))[0],c=Number(a)/this.getBlockSize(),h=i?`${i}-${c}`:String(c);r[h]={blockNumber:c,startRow:Number(a),endRow:Number(a)+this.getBlockSize(),pageStatus:l,loadedRowCount:e[a]??0}}),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 e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow(),s=this.getBlockStartIndex(e),[,i]=this.getBlockBounds(t);this.nodeMap.forEach(r=>{this.lazyBlockLoadingService.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[a,o]=this.getBlockBounds(r);if(a in s)return;const n=Math.abs(i.rowIndex-t);let l;const c=this.nodeMap.getBy("index",[o-1]);c&&(l=Math.abs(c.node.rowIndex-t));const h=l==null||n<l?n:l;s[a]=h}),Object.entries(s)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;const e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow(),s=new Set,i=new Set;this.nodeMap.forEach(({index:p,node:g})=>{const m=this.getBlockStartIndex(p);s.add(m),g.rowIndex>=e&&g.rowIndex<=t&&i.add(m)});const r=Math.max(i.size,this.storeParams.maxBlocksInCache??0),o=s.size-r;if(o<=0)return;let n=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;i.forEach(p=>{n>p&&(n=p),l<p&&(l=p)});const c=this.nodeMap.filter(({node:p,index:g})=>{const m=this.getBlockStartIndex(g);return!(m>=n&&m<=l)&&!this.isNodeCached(p)});if(c.length===0)return;const h=e+(t-e)/2,d=this.getBlocksDistanceFromRow(c,h),u=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 m=g;m<g+u;m++){const C=this.nodeMap.getBy("index",m);!C||this.isNodeCached(C.node)||this.destroyRowAtIndex(m)}}}isNodeFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){const t=this.gos.get("groupAllowUnbalanced")&&e.key==="";return e.isExpandable()&&e.expanded||this.isNodeFocused(e)||t}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;if(this.store.setStoreInfo(i),this.getRowIdFunc!=null){const o=this.extractDuplicateIds(s.rowData);if(o.length>0){const n=o.join(", ");gL(`Unable to display rows as duplicate row ids (${n}) were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.`),this.onLoadFailed(e,t);return}}s.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(s.pivotResultFields);const r=this.nodesToRefresh.size>0;if(s.rowData.forEach((o,n)=>{const l=e+n,c=this.nodeMap.getBy("index",l);if(c?.node?.stub){this.createRowAtIndex(l,o);return}if(c&&this.doesNodeMatch(o,c.node)){this.blockUtils.updateDataIntoRowNode(c.node,o),this.nodesToRefresh.delete(c.node),c.node.__needsRefreshWhenVisible=!1;return}this.createRowAtIndex(l,o)}),s.rowCount!=null&&s.rowCount!==-1)this.numberOfRows=s.rowCount,this.isLastRowKnown=!0;else if(t>s.rowData.length)this.numberOfRows=e+s.rowData.length,this.isLastRowKnown=!0;else if(!this.isLastRowKnown){const o=e+s.rowData.length+1;o>this.numberOfRows&&(this.numberOfRows=o)}this.isLastRowKnown&&this.nodeMap.filter(n=>n.index>=this.numberOfRows).forEach(n=>this.destroyRowAtIndex(n.index)),this.fireStoreUpdatedEvent();const a=this.nodesToRefresh.size===0;r&&a&&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;let s=-1;return this.nodeMap.find(r=>(s+=1,!!(r.index!==s||r.node.__needsRefreshWhenVisible||r.node.stub)))==null}isLastRowIndexKnown(){return this.isLastRowKnown}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:a}=this.nodeMap.getBy("index",r)??{};a&&this.nodesToRefresh.delete(a),(!a||!a.stub)&&(a&&!a.stub&&this.destroyRowAtIndex(r),a=this.createRowAtIndex(r)),a.__needsRefreshWhenVisible=!1,a.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.lazyBlockLoadingService.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0&&(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent())}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})}getOrderedNodeMap(){const e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){const e=this.sortController.getSortOptions();if(!e.some(r=>r.sort!=null))return;const s=new Array(this.nodeMap.getSize());this.nodeMap.forEach(r=>s[r.index]=r.node),this.nodeMap.clear(),this.rowNodeSorter.doFullSort(s,e).forEach((r,a)=>{this.nodeMap.set({id:r.id,node:r,index:a})})}updateRowNodes(e){if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const t=[];return e.forEach(s=>{const i=this.getRowId(s),r=this.nodeMap.getBy("id",i);r&&(this.blockUtils.updateDataIntoRowNode(r.node,s),t.push(r.node))}),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[];if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const r={};e.forEach(l=>{const c=this.getRowId(l);c&&this.isNodeInCache(c)||(r[c]=l)});const a=Object.values(r),o=a.length;if(o===0)return[];const n=this.nodeMap.filter(l=>l.index>=i);return n.forEach(l=>this.nodeMap.delete(l)),n.forEach(l=>{this.nodeMap.set({node:l.node,index:l.index+o,id:l.id})}),this.numberOfRows+=o,a.map((l,c)=>this.createRowAtIndex(i+c,l))}removeRowNodes(e){if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const t=[],s=[];let i=0;const r=[...e],a=this.getOrderedNodeMap();let o=-1;for(const n in a){o+=1;const l=a[n],c=r.findIndex(d=>d===l.id);if(c!==-1){r.splice(c,1),this.destroyRowAtIndex(Number(n)),t.push(l.node),i+=1;continue}if(i===0)continue;const h=Number(n);o!==h&&s.push(l.node),this.nodeMap.delete(a[n]),this.nodeMap.set({id:l.id,node:l.node,index:h-i})}return this.numberOfRows-=this.isLastRowIndexKnown()?e.length:i,r.length>0&&s.length>0&&(s.forEach(n=>n.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingService.queueLoadCheck()),t}getBlockSize(){return this.storeParams.cacheBlockSize||Co.DEFAULT_BLOCK_SIZE}getBlockStartIndex(e){const t=this.getBlockSize();return e-e%t}getBlockBounds(e){const t=this.getBlockStartIndex(e),s=this.getBlockSize();return[t,t+s]}},ys=class extends lL{constructor(e,t,s){super(),this.idSequence=new Ri,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.selectionService=e.selectionService,this.funcColsService=e.funcColsService}postConstruct(){let e=1;if(this.level===0&&(e=this.storeUtils.getServerSideInitialRowCount()??1,this.eventService.dispatchEventOnce({type:"rowCountReady"})),this.cache=this.createManagedBean(new vo(this,e,!1,this.storeParams)),!this.gos.get("treeData")&&this.group){const s=this.ssrmParams.rowGroupCols[this.level];this.groupField=s.field,this.rowGroupColumn=this.funcColsService.getRowGroupColumns()[this.level]}}destroy(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.destroyBean(this.cache),super.destroy()}applyRowData(e,t,s){this.cache.onLoadSuccess(t,s,e)}applyTransaction(e){const t=cL(this.gos);if(!t)return hL("getRowId callback must be implemented for transactions to work. Transaction was ignored."),{status:po.Cancelled};const s=this.gos.getCallback("isApplyServerSideTransaction");if(s){const h={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!s(h))return{status:po.Cancelled}}const i=this.cache.isStoreFullyLoaded();let r;e.update?.length&&(r=this.cache.updateRowNodes(e.update));let a;if(e.add?.length){let h=e.addIndex;h!=null&&h<0&&(h=void 0),a=this.cache.insertRowNodes(e.add,h)}let o;if(e.remove?.length){const h=e.remove.map(u=>t({level:this.level,parentKeys:this.parentRowNode.getRoute()??[],data:u})),d=[...new Set(h)];o=this.cache.removeRowNodes(d)}const n=this.gos.get("serverSideEnableClientSideSort"),l=r?.length||a?.length;return i&&n&&l&&this.cache.clientSideSortRows(),this.updateSelectionAfterTransaction(r,o),{status:po.Applied,update:r,add:a,remove:o}}updateSelectionAfterTransaction(e,t){const s=[];e?.forEach(i=>{i.isSelected()&&!i.selectable&&s.push(i)}),t?.forEach(i=>{i.isSelected()&&s.push(i)}),s.length&&this.selectionService.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(){return this.parentRowNode.sibling?this.cache.getRowCount()+1:this.cache.getRowCount()}setRowCount(e,t){this.cache.setRowCount(e,t)}isDisplayIndexInStore(e){return this.cache.getRowCount()===0?!1:this.displayIndexStart<=e&&e<this.getDisplayIndexEnd()}setDisplayIndexes(e,t,s){this.displayIndexStart=e.peek(),this.topPx=t.value;const i=this.parentRowNode.level>-1&&yd(this.gos)({node:this.parentRowNode});i||this.parentRowNode.destroyFooter(),i==="top"&&(this.parentRowNode.createFooter(),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,e,t,s)),this.cache.setDisplayIndexes(e,t,s),i==="bottom"&&(this.parentRowNode.createFooter(),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,e,t,s)),this.displayIndexEnd=e.peek(),this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t=new Ri){e(this,t.next()),this.cache.getNodes().forEach(s=>{const i=s.node.childStore;i&&i.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t=new Ri){this.cache.getNodes().forEach(s=>{e(s.node,t.next());const i=s.node.childStore;i&&i.forEachNodeDeep(e,t)})}forEachNodeDeepAfterFilterAndSort(e,t=new Ri,s=!1){const i=this.parentRowNode.level>-1&&yd(this.gos)({node:this.parentRowNode});i==="top"&&e(this.parentRowNode.sibling,t.next());const r=this.cache.getOrderedNodeMap();for(const a in r){const o=r[a];e(o.node,t.next());const n=o.node.childStore;n&&n.forEachNodeDeepAfterFilterAndSort(e,t,s)}i==="bottom"&&e(this.parentRowNode.sibling,t.next())}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 this.parentRowNode.sibling&&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 n=this.blockUtils.extractRowBounds(t,e);if(n)return n}const{previousNode:s,nextNode:i}=this.cache.getSurroundingNodesByDisplayIndex(e)??{};if(s){const n=this.blockUtils.extractRowBounds(s.node,e);if(n!=null)return n}const r=wd(this.gos);if(i){const n=(i.node.rowIndex-e)*r;return{rowTop:i.node.rowTop-n,rowHeight:r}}const a=this.topPx+this.heightPx,o=(this.getDisplayIndexEnd()-e)*r;return{rowTop:a-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 a=wd(this.gos);if(r){const l=r.rowTop,c=Math.ceil((l-e)/a);return r.rowIndex-c}const o=this.topPx+this.heightPx,n=Math.floor((o-e)/a);return this.getDisplayIndexEnd()-n}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 a=this.cache.getRowCount(),o=this.cache.isLastRowIndexKnown();this.destroyBean(this.cache),this.cache=this.createManagedBean(new vo(this,a,o,this.storeParams));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.destroyBean(this.cache),this.cache=this.createManagedBean(new vo(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({suppressInfiniteScroll:!1,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.eventService.dispatchEvent({type:"storeUpdated"})}fireRefreshFinishedEvent(){this.eventService.dispatchEvent({type:"storeRefreshed",route:this.parentRowNode.getRoute()})}getBlockStates(){return this.cache.getBlockStates()}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}getCache(){return this.cache}},HL=class extends jD{constructor(){super(...arguments),this.beanName="rowModel",this.onRowHeightChanged_debounced=XD(this.onRowHeightChanged.bind(this),100),this.pauseStoreUpdateListening=!1,this.started=!1,this.managingPivotResultColumns=!1}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.filterManager=e.filterManager,this.sortController=e.sortController,this.rowRenderer=e.rowRenderer,this.nodeManager=e.ssrmNodeManager,this.storeFactory=e.ssrmStoreFactory,this.beans=e,this.pivotColDefService=e.pivotColDefService}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:e,columnRowGroupChanged:e,columnPivotModeChanged:e}),this.addManagedPropertyListeners(["masterDetail","treeData","removePivotHeaderRowWhenSingleValueColumn","suppressServerSideInfiniteScroll","cacheBlockSize"],e),this.addManagedPropertyListener("groupAllowUnbalanced",()=>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(){this.gos.exists("initialGroupOrderComparator")&&Cd("initialGroupOrderComparator cannot be used with Server Side Row Model."),eL(this.gos)&&!this.gos.exists("getRowId")&&Cd("getRowId callback must be provided for Server Side Row Model selection to work correctly.")}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 instanceof ys?r.applyRowData(e,t,e.rowData.length):r instanceof fo&&r.processServerResult(e))}isLastRowIndexKnown(){const e=this.getRootStore();return e?e.isLastRowIndexKnown():!1}onColumnEverything(){if(!this.storeParams){this.resetRootStore();return}const e=this.columnsToValueObjects(this.funcColsService.getRowGroupColumns()),t=this.columnsToValueObjects(this.funcColsService.getValueColumns()),s=this.columnsToValueObjects(this.funcColsService.getPivotColumns()),i=c=>{const h={};c.oldCols.forEach(p=>h[p.id]=p);const d=c.newCols.every(p=>{const g=h[p.id];return g&&delete h[p.id],g&&g.field===p.field&&g.aggFunc===p.aggFunc}),u=!c.allowRemovedColumns&&!!Object.values(h).length;return d&&!u},r=!tL(this.storeParams.sortModel,this.sortController.getSortModel()),a=!i({oldCols:this.storeParams.rowGroupCols,newCols:e}),o=!i({oldCols:this.storeParams.pivotCols,newCols:s}),n=!!e?.length&&!i({oldCols:this.storeParams.valueCols,newCols:t,allowRemovedColumns:!0});if(r||a||o||n)this.resetRootStore();else{const c=this.createStoreParams();this.storeParams.rowGroupCols=c.rowGroupCols,this.storeParams.pivotCols=c.pivotCols,this.storeParams.valueCols=c.valueCols}}destroyRootStore(){!this.rootNode||!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.pivotColDefService){this.gos.assertModuleRegistered(YD.RowGroupingModule,"pivotResultFields");return}const t=this.pivotColDefService.createColDefsFromFields(e);this.managingPivotResultColumns=!0,this.pivotResultColsService.setPivotResultCols(t,"rowModelUpdated")}resetRowHeights(){const e=this.resetRowHeightsForAllRowNodes(),t=Cs(this.gos,this.rootNode);if(this.rootNode.setRowHeight(t.height,t.estimated),this.rootNode.sibling){const s=Cs(this.gos,this.rootNode.sibling);this.rootNode.sibling.setRowHeight(s.height,s.estimated)}e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode(t=>{const s=Cs(this.gos,t);t.setRowHeight(s.height,s.estimated);const i=t.detailNode;if(i){const r=Cs(this.gos,i);i.setRowHeight(r.height,r.estimated)}if(t.sibling){const r=Cs(this.gos,t.sibling);i.setRowHeight(r.height,r.estimated)}e=!0}),e}resetRootStore(){this.destroyRootStore(),this.rootNode=new qD(this.beans),this.rootNode.group=!0,this.rootNode.level=-1,this.datasource&&(this.storeParams=this.createStoreParams(),this.rootNode.childStore=this.createBean(this.storeFactory.createStore(this.storeParams,this.rootNode)),this.updateRowIndexesAndBounds()),this.managingPivotResultColumns&&(this.pivotResultColsService.setPivotResultCols(null,"api"),this.managingPivotResultColumns=!1),this.dispatchModelUpdated(!0)}columnsToValueObjects(e){return e.map(t=>({id:t.getId(),aggFunc:t.getAggFunc(),displayName:this.columnNameService.getDisplayNameForColumn(t,"model"),field:t.getColDef().field}))}createStoreParams(){const e=this.columnsToValueObjects(this.funcColsService.getRowGroupColumns()),t=this.columnsToValueObjects(this.funcColsService.getValueColumns()),s=this.columnsToValueObjects(this.funcColsService.getPivotColumns()),i=QD(this.gos);return{valueCols:t,rowGroupCols:e,pivotCols:s,pivotMode:this.columnModel.isPivotMode(),filterModel:this.filterManager?.isAdvancedFilterEnabled()?this.filterManager?.getAdvancedFilterModel():this.filterManager?.getFilterModel()??{},sortModel:this.sortController.getSortModel(),datasource:this.datasource,lastAccessedSequence:new fd,dynamicRowHeight:i}}getParams(){return this.storeParams}dispatchModelUpdated(e=!1){this.eventService.dispatchEvent({type:"modelUpdated",animate:!e,keepRenderedRows:!e,newPage:!1,newData:!1})}onStoreUpdated(){this.pauseStoreUpdateListening||(this.updateRowIndexesAndBounds(),this.dispatchModelUpdated())}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}onRowHeightChanged(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}updateRowIndexesAndBounds(){const e=this.getRootStore();e&&e.setDisplayIndexes(new fd,{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)}setPaused(e){this.pauseStoreUpdateListening=e}expandAll(e){this.pauseStoreUpdateListening=!0,this.forEachNode(t=>{t.stub||t.hasChildren()&&t.setExpanded(e)}),this.pauseStoreUpdateListening=!1,this.onStoreUpdated()}refreshAfterFilter(e,t){this.storeParams&&(this.storeParams.filterModel=e);const s=this.getRootStore();s&&(s.refreshAfterFilter(t),this.onStoreUpdated())}getRootStore(){if(this.rootNode&&this.rootNode.childStore)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:JD(this.gos)}}getBlockStates(){const e=this.getRootStore();if(!e)return;const t={};return e.forEachStoreDeep(s=>{if(s instanceof fo){const{id:i,state:r}=s.getBlockStateJson();t[i]=r}else if(s instanceof ys)Object.entries(s.getBlockStates()).forEach(([i,r])=>{t[i]=r});else throw new Error("AG Grid: Unsupported store type")}),t}getRowIndexAtPixel(e){const t=this.getRootStore();return e<=0||!t?0:t.getRowIndexAtPixel(e)}isEmpty(){return!1}isRowsToRender(){return this.getRootStore()!=null&&this.getRowCount()>0}getType(){return"serverSide"}forEachNode(e){const t=this.getRootStore();t&&t.forEachNodeDeep(e)}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=[],[a,o]=[s,i].sort((n,l)=>n-l);return this.forEachNode(n=>{const l=n.rowIndex;l==null||n.stub||l>=a&&l<=o&&r.push(n)}),r.length!==o-a+1?e?[e,t]:[]:r}getRowNode(e){let t;return this.forEachNode(s=>{s.id===e&&(t=s),s.detailNode&&s.detailNode.id===e&&(t=s.detailNode)}),t}isRowPresent(e){return!!this.getRowNode(e.id)}setRowCount(e,t){const s=this.getRootStore();if(s){if(s instanceof ys){s.setRowCount(e,t);return}ZD("Infinite scrolling must be enabled in order to set the row count.")}}destroy(){this.destroyDatasource(),this.destroyRootStore(),super.destroy()}};function zL(e){return e.selectionService.getSelectionState()}function WL(e,t){e.selectionService.setSelectionState(t,"api")}function KL(e,t){return e.ssrmTransactionManager?.applyTransaction(t)}function $L(e,t){const s=t.startRow??0,i=t.route??[];if(s<0){fL(`invalid value ${t.startRow} for startRow, the value should be >= 0`);return}e.rowModelHelperService?.getServerSideRowModel()?.applyRowData(t.successParams,s,i)}function jL(e,t,s){return e.ssrmTransactionManager?.applyTransactionAsync(t,s)}function YL(e){e.rowModelHelperService?.getServerSideRowModel()?.retryLoads()}function qL(e){return e.ssrmTransactionManager?.flushAsyncTransactions()}function XL(e,t){e.rowModelHelperService?.getServerSideRowModel()?.refreshStore(t)}function ZL(e){return e.rowModelHelperService?.getServerSideRowModel()?.getStoreState()??[]}var JL=class extends CL{constructor(){super(...arguments),this.beanName="expansionService",this.queuedRowIds=new Set}wireBeans(e){super.wireBeans(e),this.serverSideRowModel=e.rowModel}postConstruct(){super.postConstruct(),this.addManagedEventListeners({columnRowGroupChanged:()=>{this.queuedRowIds.clear()}})}checkOpenByDefault(e){if(!e.isExpandable())return;if(this.queuedRowIds.has(e.id)){this.queuedRowIds.delete(e.id),e.setExpanded(!0);return}const t=this.gos.getCallback("isServerSideGroupOpenByDefault");if(!t)return;const s={data:e.data,rowNode:e};t(s)&&e.setExpanded(!0)}expandRows(e){e.forEach(t=>{const s=this.serverSideRowModel.getRowNode(t);s?s.setExpanded(!0):this.queuedRowIds.add(t)})}expandAll(e){this.serverSideRowModel.expandAll(e)}onGroupExpandedOrCollapsed(){}},Ad=class{constructor(){this.root=null,this.end=null,this.cachedRange=[]}init(e){this.rowModel=e}reset(){this.root=null,this.end=null,this.cachedRange.length=0}setRoot(e){this.root=e,this.end=null,this.cachedRange.length=0}setEndRange(e){this.end=e,this.cachedRange.length=0}getRoot(){return this.root}getRange(){if(this.cachedRange.length===0){const e=this.root?this.rowModel.getRowNode(this.root):void 0,t=this.end?this.rowModel.getRowNode(this.end):void 0;if(e==null||t==null)return this.cachedRange;this.cachedRange=this.rowModel.getNodesInRangeForSelection(e,t)}return this.cachedRange}isInRange(e){return this.root===null?!1:this.getRange().some(t=>t.id===e)}truncate(e){const t=this.getRange();if(t.length===0)return{keep:[],discard:[]};const s=t[0].id===this.root,i=t.findIndex(r=>r.id===e);if(i>-1){const r=t.slice(0,i),a=t.slice(i+1);return this.setEndRange(e),s?{keep:r,discard:a}:{keep:a,discard:r}}else return{keep:t,discard:[]}}extend(e,t=!1){if(this.root==null){const a=this.getRange().slice(),o=this.rowModel.getRowNode(e);return o&&(t&&o.depthFirstSearch(n=>!n.group&&a.push(n)),a.push(o)),this.setRoot(e),{keep:a,discard:[]}}const s=this.rowModel.getRowNode(e),i=this.rowModel.getRowNode(this.root);if(s==null)return{keep:this.getRange(),discard:[]};if(i==null)return{keep:this.getRange().concat(s),discard:[]};if(this.rowModel.getNodesInRangeForSelection(i,s).find(a=>a.id===this.end))return this.setEndRange(e),{keep:this.getRange(),discard:[]};{const a=this.getRange().slice();return this.setEndRange(e),{keep:this.getRange(),discard:a}}}},So=class extends yL{constructor(){super(...arguments),this.selectionCtx=new Ad,this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectAllUsed=!1,this.selectedNodes={}}wireBeans(e){this.rowModel=e.rowModel}postConstruct(){this.selectionCtx.init(this.rowModel)}getSelectedState(){return{selectAll:this.selectedState.selectAll,toggledNodes:[...this.selectedState.toggledNodes]}}setSelectedState(e){const t={selectAll:!1,toggledNodes:new Set};if(typeof e!="object")return mo("The provided selection state should be an object.");if(!("selectAll"in e))return mo("Invalid selection state. The state must conform to `IServerSideSelectionState`.");if(typeof e.selectAll=="boolean")t.selectAll=e.selectAll;else return mo("selectAll must be of boolean type.");if("toggledNodes"in e&&Array.isArray(e.toggledNodes))e.toggledNodes.forEach(i=>{typeof i=="string"?t.toggledNodes.add(i):Ei(`Provided ids must be of string type. Invalid id provided: ${i}`)});else return Ei("`toggledNodes` must be an array of string ids.");const s=t.selectAll||t.toggledNodes.size>1;if(wL(this.gos)&&!bd(this.gos)&&s)return Ei("cannot multi select unless selection mode is 'multiRow'");this.selectedState=t}deleteSelectionStateFromParent(e,t){if(this.selectedState.toggledNodes.size===0)return!1;let s=!1;return t.forEach(i=>{this.selectedState.toggledNodes.delete(i)&&(s=!0)}),s}overrideSelectionValue(e,t){if(!bL(t))return e;const s=this.selectionCtx.getRoot(),i=s?this.rowModel.getRowNode(s):null;return i?i.isSelected()??!1:!0}setNodesSelected(e){const{nodes:t,clearSelection:s,newValue:i,rangeSelect:r,source:a}=e;if(t.length===0)return 0;const o=s&&i&&!r;if(!bd(this.gos)||o){if(t.length>1)throw new Error("AG Grid: cannot select multiple rows when rowSelection.mode is set to 'singleRow'");const l=t[0];return i&&l.selectable?(this.selectedNodes={[l.id]:l},this.selectedState={selectAll:!1,toggledNodes:new Set([l.id])}):(this.selectedNodes={},this.selectedState={selectAll:!1,toggledNodes:new Set}),l.selectable&&this.selectionCtx.setRoot(l.id),1}const n=(l,c=i)=>{c&&l.selectable?this.selectedNodes[l.id]=l:delete this.selectedNodes[l.id],c===this.selectedState.selectAll||!l.selectable?this.selectedState.toggledNodes.delete(l.id):this.selectedState.toggledNodes.add(l.id)};if(r){if(t.length>1)throw new Error("AG Grid: cannot select multiple rows when using rangeSelect");const l=t[0],c=this.overrideSelectionValue(i,a);if(this.selectionCtx.isInRange(l.id)){const h=this.selectionCtx.truncate(l.id);c&&h.discard.forEach(d=>n(d,!1)),h.keep.forEach(d=>n(d,c))}else if(this.selectionCtx.getRoot()!==l.id){const u=this.selectionCtx.extend(l.id);c&&u.discard.forEach(p=>n(p,!1)),u.keep.forEach(p=>n(p,c))}return 1}return t.forEach(l=>n(l)),this.selectionCtx.setRoot(xL(t).id),1}processNewRow(e){this.selectedNodes[e.id]&&(this.selectedNodes[e.id]=e)}isNodeSelected(e){const t=this.selectedState.toggledNodes.has(e.id);return this.selectedState.selectAll?!t:t}getSelectedNodes(){return this.selectAllUsed&&Ei("getSelectedNodes and getSelectedRows functions cannot be used with select all functionality with the server-side row model.\n Use `api.getServerSideSelectionState()` instead."),Object.values(this.selectedNodes)}getSelectedRows(){return this.getSelectedNodes().map(e=>e.data)}getSelectionCount(){return this.selectedState.selectAll?-1:this.selectedState.toggledNodes.size}clearOtherNodes(e,t){const s=this.selectedState.selectAll?1:this.selectedState.toggledNodes.size-1;return this.selectedState={selectAll:!1,toggledNodes:new Set([e.id])},this.rowModel.forEachNode(i=>{i!==e&&i.selectThisNode(!1,void 0,t)}),this.eventService.dispatchEvent({type:"selectionChanged",source:t}),s}isEmpty(){return!this.selectedState.selectAll&&!this.selectedState.toggledNodes?.size}selectAllRowNodes(){this.selectedState={selectAll:!0,toggledNodes:new Set},this.selectedNodes={},this.selectAllUsed=!0,this.selectionCtx.reset()}deselectAllRowNodes(){this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectedNodes={},this.selectionCtx.reset()}getSelectAllState(){return this.selectedState.selectAll?this.selectedState.toggledNodes.size>0?null:!0:this.selectedState.toggledNodes.size>0?null:!1}},yo=class extends PL{constructor(){super(...arguments),this.selectionCtx=new Ad,this.selectedState={selectAllChildren:!1,toggledNodes:new Map}}wireBeans(e){this.rowModel=e.rowModel,this.funcColsService=e.funcColsService,this.filterManager=e.filterManager,this.selectionService=e.selectionService}postConstruct(){this.addManagedEventListeners({modelUpdated:()=>this.removeRedundantState(),columnRowGroupChanged:()=>this.selectionService.reset("rowGroupChanged")}),this.selectionCtx.init(this.rowModel)}getSelectedState(){const e=this.gos.get("treeData"),t=(s,i,r)=>{const a={nodeId:r};if((e||i<=this.funcColsService.getRowGroupColumns().length)&&(a.selectAllChildren=s.selectAllChildren),s.toggledNodes.size){const o=[];s.toggledNodes.forEach((n,l)=>{const c=t(n,i+1,l);o.push(c)}),a.toggledNodes=o}return a};return t(this.selectedState,0)}setSelectedState(e){if("selectAll"in e)return Pd("Invalid selection state. When `groupSelectsChildren` is enabled, the state must conform to `IServerSideGroupSelectionState`.");const t=(s,i)=>{if(typeof s!="object")throw new Error("Each provided state object must be an object.");if("selectAllChildren"in s&&typeof s.selectAllChildren!="boolean")throw new Error("`selectAllChildren` must be a boolean value or undefined.");if("toggledNodes"in s){if(!Array.isArray(s.toggledNodes))throw new Error("`toggledNodes` must be an array.");if(!s.toggledNodes.every(l=>typeof l=="object"&&"nodeId"in l&&typeof l.nodeId=="string"))throw new Error("Every `toggledNode` requires an associated string id.")}const r=s.selectAllChildren??!i,a=s.toggledNodes?.map(n=>[n.nodeId,t(n,r)]);if(a?.some(([,n])=>r===n.selectAllChildren&&n.toggledNodes.size===0))throw new Error(`
393
+ `),this.menuItems=e,this.column=t,this.restoreFocusParams=s,this.sourceElement=i,this.eColumnMenu=GI}wireBeans(e){this.columnMenuFactory=e.columnMenuFactory,this.menuUtils=e.menuUtils,this.focusService=e.focusService}postConstruct(){this.mainMenuList=this.columnMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui()),this.mainMenuList.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild(this.mainMenuList.getGui())}onHidePopup(e){this.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,e)}afterGuiAttached({hidePopup:e}){e&&(this.hidePopupFunc=e,this.addDestroyFunc(e)),this.focusService.focusInto(this.mainMenuList.getGui())}};function sD(e,t){const{rowNode:s,column:i,value:r,x:a,y:o}=t||{};let{x:n,y:l}=e.menuService.getContextMenuPosition(s,i);a!=null&&(n=a),o!=null&&(l=o),e.menuService.showContextMenu({mouseEvent:new MouseEvent("mousedown",{clientX:n,clientY:l}),rowNode:s,column:i,value:r})}function iD(e,t){e.menuService.showColumnChooser({chooserParams:t})}function rD(e){e.menuService.hideColumnChooser()}var aD=class extends NI{constructor(){super(...arguments),this.beanName="menuItemMapper"}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.columnApplyStateService=e.columnApplyStateService,this.funcColsService=e.funcColsService,this.focusService=e.focusService,this.rowPositionUtils=e.rowPositionUtils,this.chartMenuItemMapper=e.chartMenuItemMapper,this.menuService=e.menuService,this.sortController=e.sortController,this.columnAutosizeService=e.columnAutosizeService,this.expansionService=e.expansionService,this.clipboardService=e.clipboardService,this.aggFuncService=e.aggFuncService,this.csvCreator=e.csvCreator,this.excelCreator=e.excelCreator}mapWithStockItems(e,t,s,i){if(!e)return[];const r=[];return e.forEach(a=>{let o;if(typeof a=="string"?o=this.getStockMenuItem(a,t,s,i):o={...a},!o)return;const n=o,{subMenu:l}=n;l&&l instanceof Array&&(n.subMenu=this.mapWithStockItems(l,t,s,i)),o!=null&&r.push(o)}),r}getStockMenuItem(e,t,s,i){const r=this.localeService.getLocaleTextFunc(),a=this.gos.get("skipHeaderOnAutoSize");switch(e){case"pinSubMenu":return{name:r("pinColumn","Pin Column"),icon:j("menuPin",this.gos,null),subMenu:["clearPinned","pinLeft","pinRight"]};case"pinLeft":return{name:r("pinLeft","Pin Left"),action:()=>this.columnModel.setColsPinned([t],"left",i),checked:!!t&&t.isPinnedLeft()};case"pinRight":return{name:r("pinRight","Pin Right"),action:()=>this.columnModel.setColsPinned([t],"right",i),checked:!!t&&t.isPinnedRight()};case"clearPinned":return{name:r("noPin","No Pin"),action:()=>this.columnModel.setColsPinned([t],null,i),checked:!!t&&!t.isPinned()};case"valueAggSubMenu":return this.gos.assertModuleRegistered(Re.RowGroupingModule,"Aggregation from Menu")?!t?.isPrimary()&&!t?.getColDef().pivotValueColumn?null:{name:r("valueAggregation","Value Aggregation"),icon:j("menuValue",this.gos,null),subMenu:this.createAggregationSubMenu(t,this.aggFuncService),disabled:this.gos.get("functionsReadOnly")}:null;case"autoSizeThis":return{name:r("autosizeThisColumn","Autosize This Column"),action:()=>this.columnAutosizeService.autoSizeColumn(t,i,a)};case"autoSizeAll":return{name:r("autosizeAllColumns","Autosize All Columns"),action:()=>this.columnAutosizeService.autoSizeAllColumns(i,a)};case"rowGroup":return{name:r("groupBy","Group by")+" "+eo(this.columnNameService.getDisplayNameForColumn(t,"header")),disabled:this.gos.get("functionsReadOnly")||t?.isRowGroupActive()||!t?.getColDef().enableRowGroup,action:()=>this.funcColsService.addRowGroupColumns([t],i),icon:j("menuAddRowGroup",this.gos,null)};case"rowUnGroup":{const o=j("menuRemoveRowGroup",this.gos,null),n=t?.getColDef().showRowGroup,l=this.gos.get("groupLockGroupColumns");if(n===!0)return{name:r("ungroupAll","Un-Group All"),disabled:this.gos.get("functionsReadOnly")||l===-1||l>=this.funcColsService.getRowGroupColumns().length,action:()=>this.funcColsService.setRowGroupColumns(this.funcColsService.getRowGroupColumns().slice(0,l),i),icon:o};if(typeof n=="string"){const c=this.columnModel.getColDefCol(n),h=c!=null?eo(this.columnNameService.getDisplayNameForColumn(c,"header")):n;return{name:r("ungroupBy","Un-Group by")+" "+h,disabled:this.gos.get("functionsReadOnly")||c!=null&&this.columnModel.isColGroupLocked(c),action:()=>this.funcColsService.removeRowGroupColumns([n],i),icon:o}}return{name:r("ungroupBy","Un-Group by")+" "+eo(this.columnNameService.getDisplayNameForColumn(t,"header")),disabled:this.gos.get("functionsReadOnly")||!t?.isRowGroupActive()||!t?.getColDef().enableRowGroup||this.columnModel.isColGroupLocked(t),action:()=>this.funcColsService.removeRowGroupColumns([t],i),icon:o}}case"resetColumns":return{name:r("resetColumns","Reset Columns"),action:()=>this.columnApplyStateService.resetColumnState(i)};case"expandAll":return{name:r("expandAll","Expand All Row Groups"),action:()=>this.expansionService.expandAll(!0)};case"contractAll":return{name:r("collapseAll","Collapse All Row Groups"),action:()=>this.expansionService.expandAll(!1)};case"copy":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy from Menu")?{name:r("copy","Copy"),shortcut:r("ctrlC","Ctrl+C"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard()}:null;case"copyWithHeaders":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy with Headers from Menu")?{name:r("copyWithHeaders","Copy with Headers"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Copy with Group Headers from Menu")?{name:r("copyWithGroupHeaders","Copy with Group Headers"),icon:j("clipboardCopy",this.gos,null),action:()=>this.clipboardService.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(this.gos.assertModuleRegistered(Re.ClipboardModule,"Cut from Menu")){const o=this.focusService.getFocusedCell(),n=o?this.rowPositionUtils.getRowNode(o):null,l=n?o?.column.isCellEditable(n):!1;return{name:r("cut","Cut"),shortcut:r("ctrlX","Ctrl+X"),icon:j("clipboardCut",this.gos,null),disabled:!l||this.gos.get("suppressCutToClipboard"),action:()=>this.clipboardService.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":return this.gos.assertModuleRegistered(Re.ClipboardModule,"Paste from Clipboard")?{name:r("paste","Paste"),shortcut:r("ctrlV","Ctrl+V"),disabled:!0,icon:j("clipboardPaste",this.gos,null),action:()=>this.clipboardService.pasteFromClipboard()}:null;case"export":{const o=[],n=this.gos.isModuleRegistered(Re.CsvExportModule),l=this.gos.isModuleRegistered(Re.ExcelExportModule);return!this.gos.get("suppressCsvExport")&&n&&o.push("csvExport"),!this.gos.get("suppressExcelExport")&&l&&o.push("excelExport"),{name:r("export","Export"),subMenu:o,icon:j("save",this.gos,null)}}case"csvExport":return{name:r("csvExport","CSV Export"),icon:j("csvExport",this.gos,null),action:()=>this.csvCreator?.exportDataAsCsv()};case"excelExport":return{name:r("excelExport","Excel Export"),icon:j("excelExport",this.gos,null),action:()=>this.excelCreator?.exportDataAsExcel()};case"separator":return"separator";case"pivotChart":case"chartRange":return this.chartMenuItemMapper.getChartItems(e)??null;case"columnFilter":return t?{name:r("columnFilter","Column Filter"),icon:j("filter",this.gos,null),action:()=>this.menuService.showFilterMenu({column:t,buttonElement:s(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":return this.gos.isModuleRegistered(Re.ColumnsToolPanelModule)?{name:r("columnChooser","Choose Columns"),icon:j("columns",this.gos,null),action:()=>this.menuService.showColumnChooser({column:t,eventSource:s()})}:null;case"sortAscending":return{name:r("sortAscending","Sort Ascending"),icon:j("sortAscending",this.gos,null),action:()=>this.sortController.setSortForColumn(t,"asc",!1,i)};case"sortDescending":return{name:r("sortDescending","Sort Descending"),icon:j("sortDescending",this.gos,null),action:()=>this.sortController.setSortForColumn(t,"desc",!1,i)};case"sortUnSort":return{name:r("sortUnSort","Clear Sort"),icon:j("sortUnSort",this.gos,null),action:()=>this.sortController.setSortForColumn(t,null,!1,i)};default:return _I(`unknown menu item type ${e}`),null}}createAggregationSubMenu(e,t){const s=this.localeService.getLocaleTextFunc();let i;if(e.isPrimary())i=e;else{const a=e.getColDef().pivotValueColumn;i=VI(a)?a:void 0}const r=[];if(i){const a=i.isValueActive(),o=t.getFuncNames(i);r.push({name:s("noAggregation","None"),action:()=>{this.funcColsService.removeValueColumns([i],"contextMenu"),this.funcColsService.setColumnAggFunc(i,void 0,"contextMenu")},checked:!a}),o.forEach(n=>{r.push({name:s(n,t.getDefaultFuncLabel(n)),action:()=>{this.funcColsService.setColumnAggFunc(i,n,"contextMenu"),this.funcColsService.addValueColumns([i],"contextMenu")},checked:a&&i.getAggFunc()===n})})}return r}},oD=class extends UI{constructor(){super(...arguments),this.beanName="menuUtils"}wireBeans(e){this.focusService=e.focusService,this.headerNavigationService=e.headerNavigationService,this.visibleColsService=e.visibleColsService}restoreFocusOnClose(e,t,s,i){const{eventSource:r}=e,a=s instanceof KeyboardEvent;if(!i&&!a||!r)return;const o=HI(this.gos);!t.contains(o)&&!rd(this.gos)||this.focusHeaderCell(e)}closePopupAndRestoreFocusOnSelect(e,t,s){let i;s&&s.keyboardEvent&&(i=s.keyboardEvent),e(i&&{keyboardEvent:i});const r=this.focusService.getFocusedCell();if(rd(this.gos))if(r){const{rowIndex:a,rowPinned:o,column:n}=r;this.focusService.setFocusedCell({rowIndex:a,column:n,rowPinned:o,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(t)}onContextMenu(e,t,s){if(!this.gos.get("allowContextMenuWithControlKey")&&e&&(e.ctrlKey||e.metaKey)||(e&&this.blockMiddleClickScrollsIfNeeded(e),this.gos.get("suppressContextMenu")))return;const i=e??t.touches[0];if(s(i)){const r=e??t;r&&r.cancelable&&r.preventDefault()}}async focusHeaderCell(e){const{column:t,columnIndex:s,headerPosition:i,eventSource:r}=e,a=await this.visibleColsService.getAllCols().some(o=>o===t);if(!(t&&!t.isAlive())){if(a&&r&&zI(r)){const o=this.focusService.findTabbableParent(r);o&&(t&&this.headerNavigationService.scrollToColumn(t),o.focus())}else if(i&&s!==-1){const o=this.visibleColsService.getAllCols(),n=o[s]||WI(o);n&&this.focusService.focusHeaderPosition({headerPosition:{headerRowIndex:i.headerRowIndex,column:n}})}}}blockMiddleClickScrollsIfNeeded(e){this.gos.get("suppressMiddleClickScrolls")&&e.which===2&&e.preventDefault()}},to="32.3.3",od=Za({version:to,moduleName:`${Xa.MenuModule}-core`,beans:[QI,ZI,aD,KI,YI,qI,oD],dependantModules:[H],userComponents:[{name:"agMenuItem",classImp:ke}]}),nD=Za({version:to,moduleName:`${Xa.MenuModule}-api`,apiFunctions:{showContextMenu:sD,showColumnChooser:iD,hideColumnChooser:rD},dependantModules:[od,yI]}),so=Za({version:to,moduleName:Xa.MenuModule,dependantModules:[od,nD]});import{ModuleNames as nd,_ColumnFilterModule as lD,_ReadOnlyFloatingFilterModule as cD,_defineModule as io}from"ag-grid-community";import{AgPromise as Ee,KeyCode as gs,ProvidedFilter as ld,TabGuardComp as hD,_forEachReverse as cd,_getActiveDomElement as dD,_isNothingFocused as uD,_loadTemplate as pD,_removeFromArray as gD}from"ag-grid-community";import{AgPromise as mD,Component as fD,_clearElement as CD,_mergeDeep as vD,_setDisplayed as ro,getDefaultFloatingFilterType as SD}from"ag-grid-community";var ms=class Pu extends hD{constructor(){super('<div class="ag-multi-filter ag-menu-list-compact"></div>'),this.filterDefs=[],this.filters=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.activeFilterIndices=[],this.lastActivatedMenuItem=null,this.afterFiltersReadyFuncs=[]}wireBeans(t){this.filterManager=t.filterManager,this.userComponentFactory=t.userComponentFactory,this.focusService=t.focusService}postConstruct(){this.initialiseTabGuard({onFocusIn:t=>this.onFocusIn(t)})}static getFilterDefs(t){const{filters:s}=t;return s&&s.length>0?s:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}init(t){this.params=t,this.filterDefs=Pu.getFilterDefs(t);const{column:s,filterChangedCallback:i}=t;this.column=s,this.filterChangedCallback=i;const r=[];return this.filterDefs.forEach((a,o)=>{const n=this.createFilter(a,o);n!=null&&r.push(n)}),new Ee(a=>{Ee.all(r).then(o=>{this.filters=o,this.refreshGui("columnMenu").then(()=>{a()})})}).then(()=>{this.afterFiltersReadyFuncs.forEach(a=>a()),this.afterFiltersReadyFuncs.length=0})}refreshGui(t){return t===this.lastOpenedInContainer?Ee.resolve():(this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),Ee.all(this.filters.map((s,i)=>{const r=this.filterDefs[i],a=this.getFilterTitle(s,r);let o;if(r.display==="subMenu"&&t!=="toolPanel")o=this.insertFilterMenu(s,a).then(n=>n.getGui());else if(r.display==="subMenu"||r.display==="accordion"){const n=this.insertFilterGroup(s,a);o=Ee.resolve(n.getGui())}else o=Ee.resolve(s.getGui());return o})).then(s=>{s.forEach((i,r)=>{r>0&&this.appendChild(pD('<div class="ag-filter-separator"></div>')),this.appendChild(i)}),this.filterGuis=s,this.lastOpenedInContainer=t}))}getFilterTitle(t,s){return s.title!=null?s.title:t instanceof ld?t.getFilterTitle():"Filter"}destroyChildren(){this.guiDestroyFuncs.forEach(t=>t()),this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu(t,s){const i=this.createBean(new Et);return i.init({menuItemDef:{name:s,subMenu:[],cssClasses:["ag-multi-filter-menu-item"],menuItem:ke,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:t,contextParams:{column:null,node:null,value:null}}).then(()=>{i.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(i)),this.addManagedListeners(i,{menuItemActivated:a=>{this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==a.menuItem&&this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=a.menuItem}});const r=i.getGui();return i.addManagedElementListeners(r,{keydown:a=>{const{key:o}=a;switch(o){case gs.UP:case gs.RIGHT:case gs.DOWN:case gs.LEFT:a.preventDefault(),o===gs.RIGHT&&i.openSubMenu(!0);break}},focusin:()=>i.activate(),focusout:()=>{!i.isSubMenuOpen()&&!i.isSubMenuOpening()&&i.deactivate()}}),i})}insertFilterGroup(t,s){const i=this.createBean(new pe({title:s,cssIdentifier:"multi-filter"}));return this.guiDestroyFuncs.push(()=>this.destroyBean(i)),i.addItem(t.getGui()),i.toggleGroupExpand(!1),t.afterGuiAttached&&i.addManagedListeners(i,{expanded:()=>t.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})}),i}isFilterActive(){return this.filters.some(t=>t.isFilterActive())}getLastActiveFilterIndex(){return this.activeFilterIndices.length>0?this.activeFilterIndices[this.activeFilterIndices.length-1]:null}doesFilterPass(t,s){let i=!0;return this.filters.forEach(r=>{!i||r===s||!r.isFilterActive()||(i=r.doesFilterPass(t))}),i}getFilterType(){return"multi"}getModelFromUi(){return{filterType:this.getFilterType(),filterModels:this.filters.map(s=>{const i=s;return typeof i.getModelFromUi=="function"?i.getModelFromUi():null})}}getModel(){return this.isFilterActive()?{filterType:this.getFilterType(),filterModels:this.filters.map(s=>s.isFilterActive()?s.getModel():null)}:null}setModel(t){const s=(r,a)=>new Ee(o=>{const n=r.setModel(a);n?n.then(()=>o()):o()});let i=[];return t==null?i=this.filters.map((r,a)=>s(r,null).then(()=>{this.updateActiveList(a)})):this.filters.forEach((r,a)=>{const o=t.filterModels.length>a?t.filterModels[a]:null,n=s(r,o).then(()=>{this.updateActiveList(a)});i.push(n)}),Ee.all(i).then(()=>{})}applyModel(t="api"){let s=!1;return this.filters.forEach(i=>{i instanceof ld&&(s=i.applyModel(t)||s)}),s}getChildFilterInstance(t){return this.filters[t]}afterGuiAttached(t){let s;t?(this.hidePopup=t.hidePopup,s=this.refreshGui(t.container)):(this.hidePopup=void 0,s=Ee.resolve());const i=t?.suppressFocus;s.then(()=>{const{filterDefs:r}=this;let a=!!i;r&&cd(r,(n,l)=>{const c=l===0,h=n.display&&n.display!=="inline",d=i||!c||h,u={...t??{},suppressFocus:d},p=this.filters?.[l];if(p&&(this.executeFunctionIfExistsOnFilter(p,"afterGuiAttached",u),c&&!d&&(a=!0)),!i&&c&&h){const g=this.filterGuis[l];g&&(this.focusService.focusInto(g)||g.focus(),a=!0)}});const o=dD(this.gos);!a&&(uD(this.gos)||this.getGui().contains(o))&&this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged")}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded")}destroy(){this.filters.forEach(t=>this.destroyBean(t)),this.filters.length=0,this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeFunctionIfExists(t,...s){cd(this.filters,i=>{this.executeFunctionIfExistsOnFilter(i,t,s)})}executeFunctionIfExistsOnFilter(t,s,...i){const r=t[s];typeof r=="function"&&r.apply(t,i)}createFilter(t,s){const{filterModifiedCallback:i,doesRowPassOtherFilter:r}=this.params;let a;const o={...this.filterManager.createFilterParams(this.column,this.column.getColDef()),filterModifiedCallback:i,filterChangedCallback:c=>{this.executeWhenAllFiltersReady(()=>this.filterChanged(s,c))},doesRowPassOtherFilter:c=>r(c)&&this.doesFilterPass({node:c,data:c.data},a)},n=this.userComponentFactory.getFilterDetails(t,o,"agTextColumnFilter");if(!n)return null;const l=n.newAgStackInstance();return l&&l.then(c=>a=c),l}executeWhenAllFiltersReady(t){this.filters&&this.filters.length>0?t():this.afterFiltersReadyFuncs.push(t)}updateActiveList(t){const s=this.filters[t];gD(this.activeFilterIndices,t),s.isFilterActive()&&this.activeFilterIndices.push(t)}filterChanged(t,s){this.updateActiveList(t),this.filterChangedCallback(s);const i=this.filters[t];this.filters.forEach(r=>{r!==i&&typeof r.onAnyFilterChanged=="function"&&r.onAnyFilterChanged()})}onFocusIn(t){this.lastActivatedMenuItem!=null&&!this.lastActivatedMenuItem.getGui().contains(t.target)&&(this.lastActivatedMenuItem.deactivate(),this.lastActivatedMenuItem=null)}getModelAsString(t){if(!this.filters||!t?.filterModels?.length)return"";const s=this.getLastActiveFilterIndex()??0;return this.filters[s].getModelAsString?.(t.filterModels[s])??""}},yD=class extends fD{constructor(){super('<div class="ag-multi-floating-filter ag-floating-filter-input"></div>'),this.floatingFilters=[],this.compDetailsList=[]}wireBeans(e){this.userComponentFactory=e.userComponentFactory,this.filterManager=e.filterManager}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))}),mD.all(t).then(s=>{s.forEach((i,r)=>{this.floatingFilters.push(i);const a=i.getGui();this.appendChild(a),r>0&&ro(a,!1)})})}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e;const{compDetailsList:t,floatingFilterParamsList:s}=this.getCompDetailsList(e);t.length===this.compDetailsList.length&&t.every((r,a)=>!this.filterManager?.areFilterCompsDifferent(this.compDetailsList[a],r))?s.forEach((r,a)=>{const o=this.floatingFilters[a];let n=!1;o.refresh&&o.refresh(r)!==null&&(n=!0),n||o.onParamsUpdated?.(r)}):(CD(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(t))}getCompDetailsList(e){const t=[],s=[],i=e.filterParams;return ms.getFilterDefs(i).forEach((r,a)=>{const o={...e,parentFilterInstance:l=>{this.parentMultiFilterInstance(c=>{const h=c.getChildFilterInstance(a);h!=null&&l(h)})}};vD(o.filterParams,r.filterParams);const n=this.getCompDetails(r,o);n&&(t.push(n),s.push(o))}),{compDetailsList:t,floatingFilterParamsList:s}}onParentModelChanged(e,t){t&&t.afterFloatingFilter||this.parentMultiFilterInstance(s=>{if(e==null)this.floatingFilters.forEach((i,r)=>{i.onParentModelChanged(null,t),ro(i.getGui(),r===0)});else{const i=s.getLastActiveFilterIndex();this.floatingFilters.forEach((r,a)=>{const o=e.filterModels.length>a?e.filterModels[a]:null;r.onParentModelChanged(o,t);const n=i==null?a===0:a===i;ro(r.getGui(),n)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails(e,t){const s=SD(this.frameworkOverrides,e,()=>this.filterManager.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return this.userComponentFactory.getFloatingFilterCompDetails(e,t,s)}parentMultiFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof ms))throw new Error("AG Grid - MultiFloatingFilterComp expects MultiFilter as its parent");e(t)})}},ao="32.3.3",hd=io({version:ao,moduleName:`${nd.MultiFilterModule}-core`,userComponents:[{name:"agMultiColumnFilter",classImp:ms},{name:"agMenuItem",classImp:ke}],dependantModules:[H,lD]}),wD=io({version:ao,moduleName:"@ag-grid-enterprise/multi-floating-filter",userComponents:[{name:"agMultiColumnFloatingFilter",classImp:yD}],dependantModules:[hd,cD]}),oo=io({version:ao,moduleName:nd.MultiFilterModule,dependantModules:[hd,wD]});import{ModuleNames as xD,_EditCoreModule as bD,_defineModule as PD}from"ag-grid-community";import{PopupComponent as TD,_missing as MD,_warnOnce as dd}from"ag-grid-community";var ud=class extends TD{constructor(){super('<div class="ag-cell-edit-wrapper"></div>')}init(e){this.params=e;const{cellStartedEdit:t,values:s}=e;MD(s)&&dd("agRichSelectCellEditor requires cellEditorParams.values to be set");const{params:i,valuesPromise:r}=this.buildRichSelectParams();this.richSelect=this.createManagedBean(new Rt(i)),this.richSelect.addCssClass("ag-cell-editor"),this.appendChild(this.richSelect),r&&r.then(a=>{this.richSelect.setValueList({valueList:a,refresh:!0});const o=this.getSearchStringCallback(a);o&&this.richSelect.setSearchStringCreator(o)}),this.addManagedListeners(this.richSelect,{fieldPickerValueSelected:this.onEditorPickerValueSelected.bind(this)}),this.focusAfterAttached=t}onEditorPickerValueSelected(e){setTimeout(()=>this.params.stopEditing(!e.fromEnterKey))}buildRichSelectParams(){const{cellRenderer:e,cellHeight:t,value:s,values:i,formatValue:r,searchDebounceDelay:a,valueListGap:o,valueListMaxHeight:n,valueListMaxWidth:l,allowTyping:c,filterList:h,searchType:d,highlightMatch:u,valuePlaceholder:p,eventKey:g,multiSelect:m,suppressDeselectAll:C,suppressMultiSelectPillRenderer:f}=this.params,v={value:s,cellRenderer:e,cellRowHeight:t,searchDebounceDelay:a,valueFormatter:r,pickerAriaLabelKey:"ariaLabelRichSelectField",pickerAriaLabelValue:"Rich Select Field",pickerType:"virtual-list",pickerGap:o,allowTyping:c,filterList:h,searchType:d,highlightMatch:u,maxPickerHeight:n,maxPickerWidth:l,placeholder:p,initialInputValue:g?.length===1?g:void 0,multiSelect:m,suppressDeselectAll:C,suppressMultiSelectPillRenderer:f};let S,y;return typeof i=="function"?S=i(this.params):S=i??[],Array.isArray(S)?(v.valueList=S,v.searchStringCreator=this.getSearchStringCallback(S)):y=S,m&&c&&(this.params.allowTyping=v.allowTyping=!1,dd("agRichSelectCellEditor cannot have `multiSelect` and `allowTyping` set to `true`. AllowTyping has been turned off.")),{params:v,valuesPromise:y}}getSearchStringCallback(e){const{colDef:t}=this.params;if(!(typeof e[0]!="object"||!t.keyCreator))return s=>s.map(i=>{const r=this.gos.addGridCommonParams({value:i,colDef:this.params.colDef,column:this.params.column,node:this.params.node,data:this.params.data});return t.keyCreator(r)})}afterGuiAttached(){const{focusAfterAttached:e,params:t}=this;setTimeout(()=>{if(!this.isAlive())return;if(e){const i=this.richSelect.getFocusableElement();i.focus();const{allowTyping:r,eventKey:a}=this.params;r&&(!a||a.length!==1)&&i.select()}this.richSelect.showPicker();const{eventKey:s}=t;s&&s?.length===1&&this.richSelect.searchTextFromString(s)})}focusIn(){this.richSelect.getFocusableElement().focus()}getValue(){return this.richSelect.getValue()}isPopup(){return!1}},FD="32.3.3",no=PD({version:FD,moduleName:xD.RichSelectModule,beans:[],userComponents:[{name:"agRichSelect",classImp:ud},{name:"agRichSelectCellEditor",classImp:ud}],dependantModules:[H,bD]});import{ModuleNames as lo,RowModelHelperService as AD,_CsrmSsrmSharedApiModule as RD,_RowNodeBlockModule as ED,_SsrmInfiniteSharedApiModule as ID,_defineModule as co}from"ag-grid-community";import{BeanStub as DD,RowNode as LD,_doOnce as kD,_exists as Ie,_getGroupTotalRowCallback as pd,_getRowHeightAsNumber as GD,_getRowHeightForNode as gd,_missing as md,_warnOnce as fs}from"ag-grid-community";import{BeanStub as OD,RowNode as BD,_exists as ho,_getRowHeightForNode as ND,_isServerSideRowModel as VD,_missing as _D}from"ag-grid-community";import{BeanStub as UD,_isServerSideRowModel as HD}from"ag-grid-community";import{BeanStub as zD}from"ag-grid-community";import{BeanStub as WD,_isServerSideRowModel as KD}from"ag-grid-community";import{BeanStub as $D,_warnOnce as uo}from"ag-grid-community";import{BeanStub as jD,ModuleNames as YD,NumberSequence as fd,RowNode as qD,_debounce as XD,_errorOnce as ZD,_getRowHeightAsNumber as JD,_getRowHeightForNode as Cs,_isGetRowHeightFunction as QD,_isRowSelection as eL,_jsonEquals as tL,_warnOnce as Cd}from"ag-grid-community";import{NumberSequence as Ai,RowNodeBlock as sL,ServerSideTransactionResultStatus as vs,_errorOnce as vd,_getAllValuesInObject as iL,_getRowIdCallback as Sd,_insertIntoArray as rL,_missing as aL,_missingOrEmpty as oL,_warnOnce as nL}from"ag-grid-community";import{BeanStub as lL,NumberSequence as Ri,ServerSideTransactionResultStatus as po,_getGroupTotalRowCallback as yd,_getRowHeightAsNumber as wd,_getRowIdCallback as cL,_warnOnce as hL}from"ag-grid-community";import{BeanStub as dL,_getRowHeightAsNumber as uL,_getRowIdCallback as pL,_warnOnce as gL}from"ag-grid-community";import{BeanStub as mL}from"ag-grid-community";import{_warnOnce as fL}from"ag-grid-community";import{ExpansionService as CL}from"ag-grid-community";import{BeanStub as vL,_getGroupSelectsDescendants as xd,_getRowSelectionMode as go,_isUsingNewRowSelectionAPI as SL,_warnOnce as Ss}from"ag-grid-community";import{BeanStub as yL,_errorOnce as mo,_isMultiRowSelection as bd,_isUsingNewRowSelectionAPI as wL,_last as xL,_warnOnce as Ei,isSelectionUIEvent as bL}from"ag-grid-community";import{BeanStub as PL,_errorOnce as Pd,_isMultiRowSelection as TL,_last as Td,_warnOnce as ML,isSelectionUIEvent as FL}from"ag-grid-community";import{BeanStub as AL,_warnOnce as Md}from"ag-grid-community";import{BeanStub as RL,_isServerSideRowModel as EL,_missingOrEmpty as IL,_warnOnce as Fd}from"ag-grid-community";import{BeanStub as DL,ServerSideTransactionResultStatus as xt,_isServerSideRowModel as LL}from"ag-grid-community";var kL="ag-Grid-MissingKey",GL=class extends DD{constructor(){super(...arguments),this.beanName="ssrmBlockUtils"}wireBeans(e){this.valueService=e.valueService,this.showRowGroupColsService=e.showRowGroupColsService,this.nodeManager=e.ssrmNodeManager,this.beans=e,this.expansionService=e.expansionService,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}createRowNode(e){const t=new LD(this.beans),s=e.rowHeight!=null?e.rowHeight:GD(this.gos);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}destroyRowNodes(e){e&&e.forEach(t=>this.destroyRowNode(t))}destroyRowNode(e,t=!1){e.childStore&&!t&&(this.destroyBean(e.childStore),e.childStore=null),e.sibling&&!e.footer&&this.destroyRowNode(e.sibling,!1),e.clearRowTopAndRowIndex(),e.id!=null&&this.nodeManager.removeNode(e)}setTreeGroupInfo(e){e.updateHasChildren();const t=this.gos.get("getServerSideGroupKey");e.hasChildren()&&t!=null&&(e.key=t(e.data)),!e.hasChildren()&&e.childStore!=null&&(this.destroyBean(e.childStore),e.childStore=null,e.expanded=!1)}setRowGroupInfo(e){if(e.key=this.valueService.getValue(e.rowGroupColumn,e),(e.key===null||e.key===void 0)&&kD(()=>{fs("null and undefined values are not allowed for server side row model keys"),e.rowGroupColumn&&fs(`column = ${e.rowGroupColumn.getId()}`),fs("data is "+e.data)},"ServerSideBlock-CannotHaveNullOrUndefinedForKey"),this.gos.get("groupAllowUnbalanced")&&e.key===""){const r=this.serverSideRowModel.getParams();e.childStore=this.createBean(this.storeFactory.createStore(r,e))}pd(this.beans.gos)({node:e})&&(e.createFooter(),e.sibling&&(e.sibling.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)):e.group?(this.setChildCountIntoRowNode(e),e.footer||(pd(this.beans.gos)({node:e})?e.sibling?e.sibling.updateData(t):e.createFooter():e.sibling&&e.destroyFooter())):this.gos.get("masterDetail")}setDataIntoRowNode(e,t,s,i){e.stub=!1;const r=this.gos.get("treeData");Ie(t)?(e.setDataAndId(t,s),r?this.setTreeGroupInfo(e):e.group?this.setRowGroupInfo(e):this.gos.get("masterDetail")&&this.setMasterDetailInfo(e)):(e.setDataAndId(void 0,void 0),e.key=null),(r||e.group)&&(this.setGroupDataIntoRowNode(e),this.setChildCountIntoRowNode(e)),Ie(t)&&(e.setRowHeight(gd(this.gos,e,!1,i).height),e.sibling?.setRowHeight(gd(this.gos,e.sibling,!1,i).height))}setChildCountIntoRowNode(e){const t=this.gos.get("getChildCount");t&&e.setAllChildrenCount(t(e.data))}setGroupDataIntoRowNode(e){const t=this.showRowGroupColsService?.getShowRowGroupCols()??[],s=this.gos.get("treeData");t.forEach(i=>{if(e.groupData==null&&(e.groupData={}),s)e.groupData[i.getColId()]=e.key;else if(i.isRowGroupDisplayed(e.rowGroupColumn.getId())){const r=this.valueService.getValue(e.rowGroupColumn,e);e.groupData[i.getColId()]=r}})}clearDisplayIndex(e){e.clearRowTopAndRowIndex(),e.hasChildren()&&Ie(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.next()),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.next()),e.detailNode.setRowTop(s.value),s.value+=e.detailNode.rowHeight):e.detailNode&&e.detailNode.clearRowTopAndRowIndex()),e.hasChildren()&&Ie(e.childStore)){const l=e.childStore;e.expanded||r?l.setDisplayIndexes(t,s,r?i:i+1):l.clearDisplayIndexes()}}binarySearchForDisplayIndex(e,t){let s=0,i=t.length-1;if(md(i)||md(s)){fs(`error: topPointer = ${i}, bottomPointer = ${s}`);return}for(;;){const r=Math.floor((s+i)/2),a=t[r];if(a.rowIndex===e)return a;const o=a.master&&a.expanded,n=a.detailNode;if(o&&n&&n.rowIndex===e)return a.detailNode;const l=a.childStore;if(a.expanded&&l&&l.isDisplayIndexInStore(e))return l.getRowUsingDisplayIndex(e);if(a.rowIndex<e)s=r+1;else if(a.rowIndex>e)i=r-1;else{fs(`error: unable to locate rowIndex = ${e} in cache`);return}}}extractRowBounds(e,t){const s=i=>({rowHeight:i.rowHeight,rowTop:i.rowTop});if(e.rowIndex===t)return s(e);if(e.hasChildren()&&e.expanded&&Ie(e.childStore)){const i=e.childStore;if(i.isDisplayIndexInStore(t))return i.getRowBounds(t)}else if(e.master&&e.expanded&&Ie(e.detailNode)&&e.detailNode.rowIndex===t)return s(e.detailNode)}isPixelInNodeRange(e,t){return!Ie(e.rowTop)||!Ie(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 e.detailNode.rowIndex;if(e.hasChildren()&&e.expanded&&Ie(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(kL):t.push(s.key),s=s.parent;if(t.length>0)return t.reverse().join("-")}checkOpenByDefault(e){return this.expansionService.checkOpenByDefault(e)}},OL=class extends OD{constructor(){super(...arguments),this.beanName="ssrmExpandListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory,this.beans=e}postConstruct(){VD(this.gos)&&this.addManagedEventListeners({rowGroupOpened:this.onRowGroupOpened.bind(this)})}onRowGroupOpened(e){const t=e.node;if(t.expanded){if(t.master)this.createDetailNode(t);else if(_D(t.childStore)){const s=this.serverSideRowModel.getParams();t.childStore=this.createBean(this.storeFactory.createStore(s,t))}}else this.gos.get("purgeClosedRowNodes")&&ho(t.childStore)&&(t.childStore=this.destroyBean(t.childStore));this.eventService.dispatchEvent({type:"storeUpdated"})}createDetailNode(e){if(ho(e.detailNode))return e.detailNode;const t=new BD(this.beans);t.detail=!0,t.selectable=!1,t.parent=e,ho(e.id)&&(t.id="detail_"+e.id),t.data=e.data,t.level=e.level+1;const s=200,i=ND(this.gos,t).height;return t.rowHeight=i||s,e.detailNode=t,t}},BL=class extends UD{constructor(){super(...arguments),this.beanName="ssrmFilterListener"}wireBeans(e){this.serverSideRowModel=e.rowModel,this.filterManager=e.filterManager,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){HD(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?.isAdvancedFilterEnabled()){i=this.filterManager.getAdvancedFilterModel();const l=e?Object.keys(s??{}):this.getAdvancedFilterColumns(s),c=this.getAdvancedFilterColumns(i);l.forEach(h=>c.add(h)),r=Array.from(c)}else if(i=this.filterManager?.getFilterModel()??{},e){const l=this.getAdvancedFilterColumns(s);Object.keys(i).forEach(c=>l.add(c)),r=Array.from(l)}else r=this.findChangedColumns(s,i);const a=this.listenerUtils.isSortingWithValueColumn(r),o=this.listenerUtils.isSortingWithSecondaryColumn(r),n={valueColChanged:a,secondaryColChanged:o,changedColumns:r};this.serverSideRowModel.refreshAfterFilter(i,n)}findChangedColumns(e,t){const s={};Object.keys(e).forEach(r=>s[r]=!0),Object.keys(t).forEach(r=>s[r]=!0);const i=[];return Object.keys(s).forEach(r=>{const a=JSON.stringify(e[r]),o=JSON.stringify(t[r]);a!=o&&i.push(r)}),i}getAdvancedFilterColumns(e){const t=new Set;if(!e)return t;const s=i=>{i.filterType==="join"?i.conditions.forEach(r=>s(r)):t.add(i.colId)};return s(e),t}},NL=class extends zD{constructor(){super(...arguments),this.beanName="ssrmListenerUtils"}wireBeans(e){this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService}isSortingWithValueColumn(e){const t=this.funcColsService.getValueColumns().map(s=>s.getColId());for(let s=0;s<e.length;s++)if(t.indexOf(e[s])>-1)return!0;return!1}isSortingWithSecondaryColumn(e){const t=this.pivotResultColsService.getPivotResultCols();if(!t)return!1;const s=t.list.map(i=>i.getColId());for(let i=0;i<e.length;i++)if(s.indexOf(e[i])>-1)return!0;return!1}},VL=class extends WD{constructor(){super(...arguments),this.beanName="ssrmSortService"}wireBeans(e){this.sortController=e.sortController,this.serverSideRowModel=e.rowModel,this.listenerUtils=e.ssrmListenerUtils}postConstruct(){KD(this.gos)&&this.addManagedEventListeners({sortChanged:this.onSortChanged.bind(this)})}onSortChanged(){const e=this.serverSideRowModel.getParams();if(!e)return;const t=this.sortController.getSortModel(),s=e.sortModel,i=this.findChangedColumnsInSort(t,s),r=this.listenerUtils.isSortingWithValueColumn(i),a=this.listenerUtils.isSortingWithSecondaryColumn(i),o={valueColChanged:r,secondaryColChanged:a,changedColumns:i};this.serverSideRowModel.refreshAfterSort(t,o)}findChangedColumnsInSort(e,t){let s=[];[e,t].forEach(a=>{if(a){const o=a.map(n=>n.colId);s=s.concat(o)}});const i=(a,o)=>{const n=a?a.sort:null,l=o?o.sort:null;return n!==l},r=(a,o)=>{const n=a?t.indexOf(a):-1,l=o?e.indexOf(o):-1;return n!==l};return s.filter(a=>{const o=t.find(l=>l.colId===a),n=e.find(l=>l.colId===a);return i(o,n)||r(o,n)})}},_L=class extends $D{constructor(){super(...arguments),this.beanName="ssrmNodeManager",this.rowNodes={}}addRowNode(e){const t=e.id;this.rowNodes[t]&&(uo(`Duplicate node id ${e.id}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`),uo("first instance",this.rowNodes[t].data),uo("second instance",e.data)),this.rowNodes[t]=e}removeNode(e){const t=e.id;this.rowNodes[t]&&(this.rowNodes[t]=void 0)}destroy(){this.clear(),super.destroy()}clear(){this.rowNodes={},super.destroy()}},fo=class extends sL{constructor(e,t,s){super(0),this.nodeIdSequence=new Ai,this.info={},this.ssrmParams=e,this.parentRowNode=s,this.level=s.level+1,this.groupLevel=e.rowGroupCols?this.level<e.rowGroupCols.length:void 0,this.leafGroup=e.rowGroupCols?this.level===e.rowGroupCols.length-1:!1}wireBeans(e){this.storeUtils=e.ssrmStoreUtils,this.blockUtils=e.ssrmBlockUtils,this.funcColsService=e.funcColsService,this.rowNodeBlockLoader=e.rowNodeBlockLoader,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController,this.selectionService=e.selectionService,this.nodeManager=e.ssrmNodeManager,this.filterManager=e.filterManager,this.transactionManager=e.ssrmTransactionManager,this.serverSideRowModel=e.rowModel}postConstruct(){if(this.usingTreeData=this.gos.get("treeData"),this.nodeIdPrefix=this.blockUtils.createNodeIdPrefix(this.parentRowNode),!this.usingTreeData&&this.groupLevel){const i=this.ssrmParams.rowGroupCols[this.level];this.groupField=i.field,this.rowGroupColumn=this.funcColsService.getRowGroupColumns()[this.level]}let e=1;const t=this.parentRowNode.level===-1,s=this.storeUtils.getServerSideInitialRowCount();t&&s!=null&&(e=s),this.initialiseRowNodes(e),this.rowNodeBlockLoader.addBlock(this),this.addDestroyFunc(()=>this.rowNodeBlockLoader.removeBlock(this)),this.postSortFunc=this.gos.getCallback("postSortRows"),s!=null&&this.eventService.dispatchEventOnce({type:"rowCountReady"})}destroy(){this.destroyRowNodes(),super.destroy()}destroyRowNodes(){this.blockUtils.destroyRowNodes(this.allRowNodes),this.allRowNodes=[],this.nodesAfterSort=[],this.nodesAfterFilter=[],this.allNodesMap={}}initialiseRowNodes(e,t=!1){this.destroyRowNodes();for(let s=0;s<e;s++){const i=this.blockUtils.createRowNode({field:this.groupField,group:this.groupLevel,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn});t&&(i.failedLoad=!0),this.allRowNodes.push(i),this.nodesAfterFilter.push(i),this.nodesAfterSort.push(i)}}getBlockStateJson(){return{id:this.nodeIdPrefix?this.nodeIdPrefix:"",state:this.getState()}}loadFromDatasource(){this.storeUtils.loadFromDatasource({startRow:void 0,endRow:void 0,parentBlock:this,parentNode:this.parentRowNode,storeParams:this.ssrmParams,success:this.success.bind(this,this.getVersion()),fail:this.pageLoadFailed.bind(this,this.getVersion())})}getStartRow(){return 0}getEndRow(){return this.nodesAfterSort.length}createDataNode(e,t){const s=this.blockUtils.createRowNode({field:this.groupField,group:this.groupLevel,leafGroup:this.leafGroup,level:this.level,parent:this.parentRowNode,rowGroupColumn:this.rowGroupColumn});t!=null?rL(this.allRowNodes,s,t):this.allRowNodes.push(s);const i=this.prefixId(this.nodeIdSequence.next());return this.blockUtils.setDataIntoRowNode(s,e,i,void 0),this.nodeManager.addRowNode(s),this.blockUtils.checkOpenByDefault(s),this.allNodesMap[s.id]=s,s}prefixId(e){return this.nodeIdPrefix?this.nodeIdPrefix+"-"+e:e.toString()}processServerFail(){this.initialiseRowNodes(1,!0),this.fireStoreUpdatedEvent(),this.flushAsyncTransactions()}processServerResult(e){if(!this.isAlive())return;const t=e.groupLevelInfo;t&&Object.assign(this.info,t),e.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(e.pivotResultFields);const s=this.allRowNodes.length>0?this.allNodesMap:void 0;this.allRowNodes=[],this.nodesAfterSort=[],this.nodesAfterFilter=[],this.allNodesMap={},e.rowData||nL('"params.data" is missing from Server-Side Row Model success() callback. Please use the "data" attribute. If no data is returned, set an empty list.'),this.createOrRecycleNodes(s,e.rowData),s&&this.blockUtils.destroyRowNodes(iL(s)),this.level===0&&this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.filterAndSortNodes(),this.fireStoreUpdatedEvent(),this.flushAsyncTransactions()}createOrRecycleNodes(e,t){if(!t)return;const s=r=>{if(!e)return;const a=Sd(this.gos);if(!a)return;const o=this.parentRowNode.getRoute()??[],n=this.level,l=a({data:r,parentKeys:o.length>0?o:void 0,level:n}),c=e[l];if(c)return delete e[l],c},i=(r,a)=>{this.allNodesMap[r.id]=r,this.blockUtils.updateDataIntoRowNode(r,a),this.allRowNodes.push(r)};t.forEach(r=>{const a=s(r);a?i(a,r):this.createDataNode(r)})}flushAsyncTransactions(){window.setTimeout(()=>this.transactionManager.flushAsyncTransactions(),0)}filterAndSortNodes(){this.filterRowNodes(),this.sortRowNodes()}sortRowNodes(){const e=this.storeUtils.isServerSideSortAllLevels()||this.storeUtils.isServerSideSortOnServer(),t=this.sortController.getSortOptions(),s=!t||t.length==0;if(e||s){this.nodesAfterSort=this.nodesAfterFilter;return}if(this.nodesAfterSort=this.rowNodeSorter.doFullSort(this.nodesAfterFilter,t),this.postSortFunc){const i={nodes:this.nodesAfterSort};this.postSortFunc(i)}}filterRowNodes(){const e=!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||this.storeUtils.isServerSideFilterOnServer(),t=this.groupLevel;if(e||t){this.nodesAfterFilter=this.allRowNodes;return}this.nodesAfterFilter=this.filterManager?this.allRowNodes.filter(s=>this.filterManager.doesRowPassFilter({rowNode:s})):this.allRowNodes}clearDisplayIndexes(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.allRowNodes.forEach(e=>this.blockUtils.clearDisplayIndex(e))}getDisplayIndexEnd(){return this.displayIndexEnd}isDisplayIndexInStore(e){return this.getRowCount()===0?!1:e>=this.displayIndexStart&&e<this.displayIndexEnd}setDisplayIndexes(e,t,s){this.displayIndexStart=e.peek(),this.topPx=t.value;const i={};this.nodesAfterSort.forEach(r=>{this.blockUtils.setDisplayIndex(r,e,t,s),i[r.id]=!0}),this.allRowNodes.forEach(r=>{i[r.id]||this.blockUtils.clearDisplayIndex(r)}),this.displayIndexEnd=e.peek(),this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t=new Ai){e(this,t.next()),this.allRowNodes.forEach(s=>{const i=s.childStore;i&&i.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t=new Ai){this.allRowNodes.forEach(s=>{e(s,t.next());const i=s.childStore;i&&i.forEachNodeDeep(e,t)})}forEachNodeDeepAfterFilterAndSort(e,t=new Ai,s=!1){this.nodesAfterSort.forEach(i=>{e(i,t.next());const r=i.childStore;r&&r.forEachNodeDeepAfterFilterAndSort(e,t,s)}),s&&this.parentRowNode.sibling&&e(this.parentRowNode.sibling,t.next())}getRowUsingDisplayIndex(e){return this.isDisplayIndexInStore(e)?this.blockUtils.binarySearchForDisplayIndex(e,this.nodesAfterSort):void 0}getRowBounds(e){for(let t=0;t<this.nodesAfterSort.length;t++){const s=this.nodesAfterSort[t],i=this.blockUtils.extractRowBounds(s,e);if(i)return i}return null}isPixelInRange(e){return e>=this.topPx&&e<this.topPx+this.heightPx}getRowIndexAtPixel(e){if(e<=this.topPx)return this.nodesAfterSort[0].rowIndex;if(e>=this.topPx+this.heightPx){const a=this.nodesAfterSort[this.nodesAfterSort.length-1];if(!a)return null;const o=a.rowTop+a.rowHeight;if(e>=o&&a.expanded){if(a.childStore&&a.childStore.getRowCount()>0)return a.childStore.getRowIndexAtPixel(e);if(a.detailNode)return a.detailNode.rowIndex}return a.rowIndex}let i=null;return this.nodesAfterSort.forEach(a=>{const o=this.blockUtils.getIndexAtPixel(a,e);o!=null&&(i=o)}),i??this.displayIndexEnd-1}getChildStore(e){return this.storeUtils.getChildStore(e,this,t=>this.allRowNodes.find(i=>i.key==t))}forEachChildStoreShallow(e){this.allRowNodes.forEach(t=>{const s=t.childStore;s&&e(s)})}refreshAfterFilter(e){const t=this.storeUtils.isServerSideFilterOnServer(),s=this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e);if(!this.storeUtils.isServerSideOnlyRefreshFilteredGroups()||t&&s){this.refreshStore(!0),this.sortRowNodes();return}this.filterRowNodes(),this.sortRowNodes(),this.forEachChildStoreShallow(r=>r.refreshAfterFilter(e))}refreshAfterSort(e){const t=this.storeUtils.isServerSideSortOnServer(),s=this.storeUtils.isServerRefreshNeeded(this.parentRowNode,this.ssrmParams.rowGroupCols,e);if(this.storeUtils.isServerSideSortAllLevels()||t&&s){this.refreshStore(!0),this.filterRowNodes();return}this.filterRowNodes(),this.sortRowNodes(),this.forEachChildStoreShallow(r=>r.refreshAfterSort(e))}applyTransaction(e){switch(this.getState()){case"failed":return{status:vs.StoreLoadingFailed};case"loading":return{status:vs.StoreLoading};case"needsLoading":return{status:vs.StoreWaitingToLoad}}const t=this.gos.getCallback("isApplyServerSideTransaction");if(t){const r={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!t(r))return{status:vs.Cancelled}}const s={status:vs.Applied,remove:[],update:[],add:[]},i=[];return this.executeAdd(e,s),this.executeRemove(e,s,i),this.executeUpdate(e,s,i),this.filterAndSortNodes(),this.updateSelection(i),s}updateSelection(e){e.length>0&&(this.selectionService.setNodesSelected({newValue:!1,nodes:e,suppressFinishActions:!0,clearSelection:!1,source:"rowDataChanged"}),this.eventService.dispatchEvent({type:"selectionChanged",source:"rowDataChanged"}))}executeAdd(e,t){const{add:s,addIndex:i}=e;if(oL(s))return;typeof i=="number"&&i>=0?s.reverse().forEach(a=>{const o=this.createDataNode(a,i);t.add.push(o)}):s.forEach(a=>{const o=this.createDataNode(a);t.add.push(o)})}executeRemove(e,t,s){const{remove:i}=e;if(i==null)return;const r={};i.forEach(a=>{const o=this.lookupRowNode(a);o&&(o.isSelected()&&s.push(o),o.clearRowTopAndRowIndex(),r[o.id]=!0,delete this.allNodesMap[o.id],t.remove.push(o),this.nodeManager.removeNode(o))}),this.allRowNodes=this.allRowNodes.filter(a=>!r[a.id])}executeUpdate(e,t,s){const{update:i}=e;i?.forEach(r=>{const a=this.lookupRowNode(r);a&&(this.blockUtils.updateDataIntoRowNode(a,r),!a.selectable&&a.isSelected()&&s.push(a),t.update.push(a))})}lookupRowNode(e){const t=Sd(this.gos);if(t!=null){const s=this.parentRowNode.getRoute()??[],i=t({data:e,parentKeys:s.length>0?s:void 0,level:this.level}),r=this.allNodesMap[i];return r||(vd(`could not find row id=${i}, data item was not found for this id`),null)}else{const s=this.allRowNodes.find(i=>i.data===e);return s||(vd("could not find data item as object was not found",e),null)}}addStoreStates(e){e.push({suppressInfiniteScroll:!0,route:this.parentRowNode.getRoute()??[],rowCount:this.allRowNodes.length,info:this.info}),this.forEachChildStoreShallow(t=>t.addStoreStates(e))}refreshStore(e){if(e){const t=this.nodesAfterSort?this.nodesAfterSort.length:1;this.initialiseRowNodes(t)}this.scheduleLoad(),this.fireStoreUpdatedEvent()}retryLoads(){this.getState()==="failed"&&(this.initialiseRowNodes(1),this.scheduleLoad()),this.forEachChildStoreShallow(e=>e.retryLoads())}scheduleLoad(){this.setStateWaitingToLoad(),this.rowNodeBlockLoader.checkBlockToLoad()}fireStoreUpdatedEvent(){this.eventService.dispatchEvent({type:"storeUpdated"})}getRowCount(){return this.nodesAfterSort.length}getTopLevelRowDisplayedIndex(e){return this.nodesAfterSort[e].rowIndex}isLastRowIndexKnown(){return this.getState()=="loaded"}getRowNodesInRange(e,t){const s=[];let i=!1;return aL(e)&&(i=!0),this.nodesAfterSort.forEach(a=>{const o=a===e||a===t;(i||o)&&s.push(a),o&&(i=!i)}),i?[]:s}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}},Co=class extends mL{constructor(){super(...arguments),this.beanName="lazyBlockLoadingService",this.cacheLoadingNodesMap=new Map,this.isCheckQueued=!1,this.nextBlockToLoad=void 0}wireBeans(e){this.rowNodeBlockLoader=e.rowNodeBlockLoader,this.rowRenderer=e.rowRenderer,this.rowModel=e.rowModel}postConstruct(){this.addManagedListeners(this.rowNodeBlockLoader,{blockLoaded:()=>this.queueLoadCheck()})}subscribe(e){this.cacheLoadingNodesMap.set(e,new Set)}unsubscribe(e){this.cacheLoadingNodesMap.delete(e)}queueLoadCheck(){this.isCheckQueued||(this.isCheckQueued=!0,window.queueMicrotask(()=>{this.queueLoadAction(),this.isCheckQueued=!1}))}queueLoadAction(){const e=this.getBlockToLoad();if(!e)return;const t=this.nextBlockToLoad&&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){const i=this.rowNodeBlockLoader.getAvailableLoadingCount();i!=null&&i===0||(this.rowNodeBlockLoader.registerLoads(1),this.executeLoad(e,t,s),this.queueLoadCheck())}executeLoad(e,t,s){const i=e.getSsrmParams(),r={startRow:t,endRow:s,rowGroupCols:i.rowGroupCols,valueCols:i.valueCols,pivotCols:i.pivotCols,pivotMode:i.pivotMode,groupKeys:e.store.getParentNode().getRoute()??[],filterModel:i.filterModel,sortModel:i.sortModel},a=this.cacheLoadingNodesMap.get(e),o=()=>{for(let d=0;d<s-t;d++)a.delete(t+d)},n=()=>{for(let d=0;d<s-t;d++)a.add(t+d)},l=d=>{this.rowNodeBlockLoader.loadComplete(),e.onLoadSuccess(t,s-t,d),o()},c=()=>{this.rowNodeBlockLoader.loadComplete(),e.onLoadFailed(t,s-t),o()},h=this.gos.addGridCommonParams({request:r,success:l,fail:c,parentNode:e.store.getParentNode()});n(),e.getSsrmParams().datasource?.getRows(h)}getBlockToLoad(){const e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow();for(let n=e;n<=t;n++){const l=this.rowModel.getRow(n);if(!l)continue;const c=l.parent&&l.parent.childStore;if(!c||!(c instanceof ys))continue;const h=c.getCache(),d=h.getNodes().getBy("node",l);if(!(!d||this.cacheLoadingNodesMap.get(h)?.has(d.index))&&(l.__needsRefreshWhenVisible||l.stub&&!l.failedLoad))return{cache:h,index:h.getBlockStartIndex(d.index)}}let s=null,i=null,r=Number.MAX_SAFE_INTEGER;for(const n of this.cacheLoadingNodesMap.keys())n.getNodesToRefresh().forEach(c=>{if(c.rowIndex==null){i=c,s=n;return}const h=n.getNodes().getBy("node",c);if(!h||this.cacheLoadingNodesMap.get(n)?.has(h.index))return;const u=Math.abs(e-c.rowIndex),p=Math.abs(c.rowIndex-t);u<r&&(i=c,r=u,s=n),p<r&&(i=c,r=p,s=n)});if(!s)return;const a=s,o=a.getNodes().getBy("node",i)?.index;return o==null?void 0:{cache:a,index:a.getBlockStartIndex(o)}}isRowLoading(e,t){return this.cacheLoadingNodesMap.get(e)?.has(t)??!1}};Co.DEFAULT_BLOCK_SIZE=100;var UL=class{constructor(...e){if(e.length<1)throw new Error("AG Grid: At least one index must be provided.");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){const s=this.maps.get(e);if(!s)throw new Error(`AG Grid: ${String(e)} not found`);return s.get(t)}set(e){this.indexes.forEach(t=>{const s=this.maps.get(t);if(!s)throw new Error(`AG Grid: ${String(t)} not found`);s.set(e[t],e)})}delete(e){this.indexes.forEach(t=>{const s=this.maps.get(t);if(!s)throw new Error(`AG Grid: ${String(t)} not found`);s.delete(e[t])})}clear(){this.maps.forEach(e=>e.clear())}getIterator(e){const t=this.maps.get(e);if(!t)throw new Error(`AG Grid: ${String(e)} not found`);return t.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}},vo=class extends dL{constructor(e,t,s,i){super(),this.live=!0,this.removedNodeCache=new Map,this.store=e,this.numberOfRows=t,this.isLastRowKnown=s,this.storeParams=i}wireBeans(e){this.rowRenderer=e.rowRenderer,this.blockUtils=e.ssrmBlockUtils,this.focusService=e.focusService,this.nodeManager=e.ssrmNodeManager,this.serverSideRowModel=e.rowModel,this.rowNodeSorter=e.rowNodeSorter,this.sortController=e.sortController,this.lazyBlockLoadingService=e.lazyBlockLoadingService}postConstruct(){this.lazyBlockLoadingService.subscribe(this),this.nodeMap=new UL("index","id","node"),this.nodeDisplayIndexMap=new Map,this.nodesToRefresh=new Set,this.defaultNodeIdPrefix=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),this.getRowIdFunc=pL(this.gos),this.isMasterDetail=this.gos.get("masterDetail")}destroy(){this.lazyBlockLoadingService.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.lazyBlockLoadingService.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:a,nextNode:o}=r;if(a&&a.node.expanded&&a.node.childStore?.isDisplayIndexInStore(e))return a.node.childStore?.getRowUsingDisplayIndex(e);if(o){const l=o.node.rowIndex-e,c=o.index-l;return this.createStubNode(c,e)}const n=this.store.getRowCount()-(this.store.getDisplayIndexEnd()-e);return this.createStubNode(n,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;for(const a in r)i.setGroupValue(a,r[a])}return this.lazyBlockLoadingService.queueLoadCheck(),i}getRowByStoreIndex(e){return this.nodeMap.getBy("index",e)?.node}skipDisplayIndexes(e,t,s){if(e===0)return;const i=uL(this.gos);t.skip(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 in i){const n=i[o],l=Number(o),c=l-1-r;this.skipDisplayIndexes(c,e,t);const h=l===0;if(n.setFirstChild(h),h&&this.gos.get("groupHideOpenParents")){const d=this.store.getParentNode().groupData;for(const u in d)n.setGroupValue(u,h?d[u]:void 0)}this.blockUtils.setDisplayIndex(n,e,t,s),n.rowIndex!=null&&this.nodeDisplayIndexMap.set(n.rowIndex,n),r=l}const a=this.numberOfRows-1-r;this.skipDisplayIndexes(a,e,t),this.purgeExcessRows()}getRowCount(){return this.numberOfRows}setRowCount(e,t){if(e<0)throw new Error("AG Grid: setRowCount can only accept a positive row count.");this.numberOfRows=e,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}if(t==null||t.node.rowIndex>i.node.rowIndex){t=i;return}}),!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}if(s==null||s.index>o.index){s=o;return}}),!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:a}=i;if(a.__needsRefreshWhenVisible=!1,this.doesNodeMatch(t,a))return this.blockUtils.updateDataIntoRowNode(a,t),this.nodesToRefresh.delete(a),a;if(this.getRowIdFunc==null&&a.hasChildren()&&a.expanded)return this.nodesToRefresh.delete(a),a;this.destroyRowAtIndex(e)}if(t&&this.getRowIdFunc!=null){const a=this.getRowId(t),o=a&&this.removedNodeCache?.get(a);if(o)return this.removedNodeCache?.delete(a),this.blockUtils.updateDataIntoRowNode(o,t),this.nodeMap.set({id:o.id,node:o,index:e}),this.nodesToRefresh.delete(o),o.__needsRefreshWhenVisible=!1,o;const n=this.nodeMap.getBy("id",a);if(n){this.nodeMap.delete(n);const{node:l,index:c}=n;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 a=this.getPrefixedId(this.store.getIdSequence().next());this.blockUtils.setDataIntoRowNode(r,t,a,void 0),this.serverSideRowModel.setPaused(!0),this.blockUtils.checkOpenByDefault(r),this.serverSideRowModel.setPaused(!1),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:a,index:o})=>{const n=this.getBlockStartIndex(o);!a.stub&&!a.failedLoad&&(e[n]=(e[n]??0)+1);let l="loaded";a.failedLoad?l="failed":this.lazyBlockLoadingService.isRowLoading(this,n)?l="loading":(this.nodesToRefresh.has(a)||a.stub)&&(l="needsLoading"),t[n]||(t[n]=new Set),t[n].add(l)});const s={loading:4,failed:3,needsLoading:2,loaded:1},i=this.blockUtils.createNodeIdPrefix(this.store.getParentNode()),r={};return Object.entries(t).forEach(([a,o])=>{const l=[...o].sort((d,u)=>(s[d]??0)-(s[u]??0))[0],c=Number(a)/this.getBlockSize(),h=i?`${i}-${c}`:String(c);r[h]={blockNumber:c,startRow:Number(a),endRow:Number(a)+this.getBlockSize(),pageStatus:l,loadedRowCount:e[a]??0}}),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 e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow(),s=this.getBlockStartIndex(e),[,i]=this.getBlockBounds(t);this.nodeMap.forEach(r=>{this.lazyBlockLoadingService.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[a,o]=this.getBlockBounds(r);if(a in s)return;const n=Math.abs(i.rowIndex-t);let l;const c=this.nodeMap.getBy("index",[o-1]);c&&(l=Math.abs(c.node.rowIndex-t));const h=l==null||n<l?n:l;s[a]=h}),Object.entries(s)}purgeExcessRows(){if(this.purgeStubsOutsideOfViewport(),this.store.getDisplayIndexEnd()==null||this.storeParams.maxBlocksInCache==null)return;const e=this.rowRenderer.getFirstVirtualRenderedRow(),t=this.rowRenderer.getLastVirtualRenderedRow(),s=new Set,i=new Set;this.nodeMap.forEach(({index:p,node:g})=>{const m=this.getBlockStartIndex(p);s.add(m),g.rowIndex>=e&&g.rowIndex<=t&&i.add(m)});const r=Math.max(i.size,this.storeParams.maxBlocksInCache??0),o=s.size-r;if(o<=0)return;let n=Number.MAX_SAFE_INTEGER,l=Number.MIN_SAFE_INTEGER;i.forEach(p=>{n>p&&(n=p),l<p&&(l=p)});const c=this.nodeMap.filter(({node:p,index:g})=>{const m=this.getBlockStartIndex(g);return!(m>=n&&m<=l)&&!this.isNodeCached(p)});if(c.length===0)return;const h=e+(t-e)/2,d=this.getBlocksDistanceFromRow(c,h),u=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 m=g;m<g+u;m++){const C=this.nodeMap.getBy("index",m);!C||this.isNodeCached(C.node)||this.destroyRowAtIndex(m)}}}isNodeFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e.rowIndex}isNodeCached(e){const t=this.gos.get("groupAllowUnbalanced")&&e.key==="";return e.isExpandable()&&e.expanded||this.isNodeFocused(e)||t}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;if(this.store.setStoreInfo(i),this.getRowIdFunc!=null){const o=this.extractDuplicateIds(s.rowData);if(o.length>0){const n=o.join(", ");gL(`Unable to display rows as duplicate row ids (${n}) were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.`),this.onLoadFailed(e,t);return}}s.pivotResultFields&&this.serverSideRowModel.generateSecondaryColumns(s.pivotResultFields);const r=this.nodesToRefresh.size>0;if(s.rowData.forEach((o,n)=>{const l=e+n,c=this.nodeMap.getBy("index",l);if(c?.node?.stub){this.createRowAtIndex(l,o);return}if(c&&this.doesNodeMatch(o,c.node)){this.blockUtils.updateDataIntoRowNode(c.node,o),this.nodesToRefresh.delete(c.node),c.node.__needsRefreshWhenVisible=!1;return}this.createRowAtIndex(l,o)}),s.rowCount!=null&&s.rowCount!==-1)this.numberOfRows=s.rowCount,this.isLastRowKnown=!0;else if(t>s.rowData.length)this.numberOfRows=e+s.rowData.length,this.isLastRowKnown=!0;else if(!this.isLastRowKnown){const o=e+s.rowData.length+1;o>this.numberOfRows&&(this.numberOfRows=o)}this.isLastRowKnown&&this.nodeMap.filter(n=>n.index>=this.numberOfRows).forEach(n=>this.destroyRowAtIndex(n.index)),this.fireStoreUpdatedEvent();const a=this.nodesToRefresh.size===0;r&&a&&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;let s=-1;return this.nodeMap.find(r=>(s+=1,!!(r.index!==s||r.node.__needsRefreshWhenVisible||r.node.stub)))==null}isLastRowIndexKnown(){return this.isLastRowKnown}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:a}=this.nodeMap.getBy("index",r)??{};a&&this.nodesToRefresh.delete(a),(!a||!a.stub)&&(a&&!a.stub&&this.destroyRowAtIndex(r),a=this.createRowAtIndex(r)),a.__needsRefreshWhenVisible=!1,a.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.lazyBlockLoadingService.queueLoadCheck(),this.isLastRowKnown&&this.numberOfRows===0&&(this.numberOfRows=1,this.isLastRowKnown=!1,this.fireStoreUpdatedEvent())}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})}getOrderedNodeMap(){const e={};return this.nodeMap.forEach(t=>e[t.index]=t),e}clearDisplayIndexes(){this.nodeDisplayIndexMap.clear()}clientSideSortRows(){const e=this.sortController.getSortOptions();if(!e.some(r=>r.sort!=null))return;const s=new Array(this.nodeMap.getSize());this.nodeMap.forEach(r=>s[r.index]=r.node),this.nodeMap.clear(),this.rowNodeSorter.doFullSort(s,e).forEach((r,a)=>{this.nodeMap.set({id:r.id,node:r,index:a})})}updateRowNodes(e){if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const t=[];return e.forEach(s=>{const i=this.getRowId(s),r=this.nodeMap.getBy("id",i);r&&(this.blockUtils.updateDataIntoRowNode(r.node,s),t.push(r.node))}),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[];if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const r={};e.forEach(l=>{const c=this.getRowId(l);c&&this.isNodeInCache(c)||(r[c]=l)});const a=Object.values(r),o=a.length;if(o===0)return[];const n=this.nodeMap.filter(l=>l.index>=i);return n.forEach(l=>this.nodeMap.delete(l)),n.forEach(l=>{this.nodeMap.set({node:l.node,index:l.index+o,id:l.id})}),this.numberOfRows+=o,a.map((l,c)=>this.createRowAtIndex(i+c,l))}removeRowNodes(e){if(this.getRowIdFunc==null)throw new Error("AG Grid: Transactions can only be applied when row ids are supplied.");const t=[],s=[];let i=0;const r=[...e],a=this.getOrderedNodeMap();let o=-1;for(const n in a){o+=1;const l=a[n],c=r.findIndex(d=>d===l.id);if(c!==-1){r.splice(c,1),this.destroyRowAtIndex(Number(n)),t.push(l.node),i+=1;continue}if(i===0)continue;const h=Number(n);o!==h&&s.push(l.node),this.nodeMap.delete(a[n]),this.nodeMap.set({id:l.id,node:l.node,index:h-i})}return this.numberOfRows-=this.isLastRowIndexKnown()?e.length:i,r.length>0&&s.length>0&&(s.forEach(n=>n.__needsRefreshWhenVisible=!0),this.lazyBlockLoadingService.queueLoadCheck()),t}getBlockSize(){return this.storeParams.cacheBlockSize||Co.DEFAULT_BLOCK_SIZE}getBlockStartIndex(e){const t=this.getBlockSize();return e-e%t}getBlockBounds(e){const t=this.getBlockStartIndex(e),s=this.getBlockSize();return[t,t+s]}},ys=class extends lL{constructor(e,t,s){super(),this.idSequence=new Ri,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.selectionService=e.selectionService,this.funcColsService=e.funcColsService}postConstruct(){let e=1;if(this.level===0&&(e=this.storeUtils.getServerSideInitialRowCount()??1,this.eventService.dispatchEventOnce({type:"rowCountReady"})),this.cache=this.createManagedBean(new vo(this,e,!1,this.storeParams)),!this.gos.get("treeData")&&this.group){const s=this.ssrmParams.rowGroupCols[this.level];this.groupField=s.field,this.rowGroupColumn=this.funcColsService.getRowGroupColumns()[this.level]}}destroy(){this.displayIndexStart=void 0,this.displayIndexEnd=void 0,this.destroyBean(this.cache),super.destroy()}applyRowData(e,t,s){this.cache.onLoadSuccess(t,s,e)}applyTransaction(e){const t=cL(this.gos);if(!t)return hL("getRowId callback must be implemented for transactions to work. Transaction was ignored."),{status:po.Cancelled};const s=this.gos.getCallback("isApplyServerSideTransaction");if(s){const h={transaction:e,parentNode:this.parentRowNode,groupLevelInfo:this.info};if(!s(h))return{status:po.Cancelled}}const i=this.cache.isStoreFullyLoaded();let r;e.update?.length&&(r=this.cache.updateRowNodes(e.update));let a;if(e.add?.length){let h=e.addIndex;h!=null&&h<0&&(h=void 0),a=this.cache.insertRowNodes(e.add,h)}let o;if(e.remove?.length){const h=e.remove.map(u=>t({level:this.level,parentKeys:this.parentRowNode.getRoute()??[],data:u})),d=[...new Set(h)];o=this.cache.removeRowNodes(d)}const n=this.gos.get("serverSideEnableClientSideSort"),l=r?.length||a?.length;return i&&n&&l&&this.cache.clientSideSortRows(),this.updateSelectionAfterTransaction(r,o),{status:po.Applied,update:r,add:a,remove:o}}updateSelectionAfterTransaction(e,t){const s=[];e?.forEach(i=>{i.isSelected()&&!i.selectable&&s.push(i)}),t?.forEach(i=>{i.isSelected()&&s.push(i)}),s.length&&this.selectionService.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(){return this.parentRowNode.sibling?this.cache.getRowCount()+1:this.cache.getRowCount()}setRowCount(e,t){this.cache.setRowCount(e,t)}isDisplayIndexInStore(e){return this.cache.getRowCount()===0?!1:this.displayIndexStart<=e&&e<this.getDisplayIndexEnd()}setDisplayIndexes(e,t,s){this.displayIndexStart=e.peek(),this.topPx=t.value;const i=this.parentRowNode.level>-1&&yd(this.gos)({node:this.parentRowNode});i||this.parentRowNode.destroyFooter(),i==="top"&&(this.parentRowNode.createFooter(),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,e,t,s)),this.cache.setDisplayIndexes(e,t,s),i==="bottom"&&(this.parentRowNode.createFooter(),this.blockUtils.setDisplayIndex(this.parentRowNode.sibling,e,t,s)),this.displayIndexEnd=e.peek(),this.heightPx=t.value-this.topPx}forEachStoreDeep(e,t=new Ri){e(this,t.next()),this.cache.getNodes().forEach(s=>{const i=s.node.childStore;i&&i.forEachStoreDeep(e,t)})}forEachNodeDeep(e,t=new Ri){this.cache.getNodes().forEach(s=>{e(s.node,t.next());const i=s.node.childStore;i&&i.forEachNodeDeep(e,t)})}forEachNodeDeepAfterFilterAndSort(e,t=new Ri,s=!1){const i=this.parentRowNode.level>-1&&yd(this.gos)({node:this.parentRowNode});i==="top"&&e(this.parentRowNode.sibling,t.next());const r=this.cache.getOrderedNodeMap();for(const a in r){const o=r[a];e(o.node,t.next());const n=o.node.childStore;n&&n.forEachNodeDeepAfterFilterAndSort(e,t,s)}i==="bottom"&&e(this.parentRowNode.sibling,t.next())}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 this.parentRowNode.sibling&&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 n=this.blockUtils.extractRowBounds(t,e);if(n)return n}const{previousNode:s,nextNode:i}=this.cache.getSurroundingNodesByDisplayIndex(e)??{};if(s){const n=this.blockUtils.extractRowBounds(s.node,e);if(n!=null)return n}const r=wd(this.gos);if(i){const n=(i.node.rowIndex-e)*r;return{rowTop:i.node.rowTop-n,rowHeight:r}}const a=this.topPx+this.heightPx,o=(this.getDisplayIndexEnd()-e)*r;return{rowTop:a-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 a=wd(this.gos);if(r){const l=r.rowTop,c=Math.ceil((l-e)/a);return r.rowIndex-c}const o=this.topPx+this.heightPx,n=Math.floor((o-e)/a);return this.getDisplayIndexEnd()-n}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 a=this.cache.getRowCount(),o=this.cache.isLastRowIndexKnown();this.destroyBean(this.cache),this.cache=this.createManagedBean(new vo(this,a,o,this.storeParams));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.destroyBean(this.cache),this.cache=this.createManagedBean(new vo(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({suppressInfiniteScroll:!1,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.eventService.dispatchEvent({type:"storeUpdated"})}fireRefreshFinishedEvent(){this.eventService.dispatchEvent({type:"storeRefreshed",route:this.parentRowNode.getRoute()})}getBlockStates(){return this.cache.getBlockStates()}getStoreBounds(){return{topPx:this.topPx,heightPx:this.heightPx}}getCache(){return this.cache}},HL=class extends jD{constructor(){super(...arguments),this.beanName="rowModel",this.onRowHeightChanged_debounced=XD(this.onRowHeightChanged.bind(this),100),this.pauseStoreUpdateListening=!1,this.started=!1,this.managingPivotResultColumns=!1}wireBeans(e){this.columnModel=e.columnModel,this.columnNameService=e.columnNameService,this.pivotResultColsService=e.pivotResultColsService,this.funcColsService=e.funcColsService,this.filterManager=e.filterManager,this.sortController=e.sortController,this.rowRenderer=e.rowRenderer,this.nodeManager=e.ssrmNodeManager,this.storeFactory=e.ssrmStoreFactory,this.beans=e,this.pivotColDefService=e.pivotColDefService}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:e,columnRowGroupChanged:e,columnPivotModeChanged:e}),this.addManagedPropertyListeners(["masterDetail","treeData","removePivotHeaderRowWhenSingleValueColumn","suppressServerSideInfiniteScroll","cacheBlockSize"],e),this.addManagedPropertyListener("groupAllowUnbalanced",()=>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(){this.gos.exists("initialGroupOrderComparator")&&Cd("initialGroupOrderComparator cannot be used with Server Side Row Model."),eL(this.gos)&&!this.gos.exists("getRowId")&&Cd("getRowId callback must be provided for Server Side Row Model selection to work correctly.")}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 instanceof ys?r.applyRowData(e,t,e.rowData.length):r instanceof fo&&r.processServerResult(e))}isLastRowIndexKnown(){const e=this.getRootStore();return e?e.isLastRowIndexKnown():!1}onColumnEverything(){if(!this.storeParams){this.resetRootStore();return}const e=this.columnsToValueObjects(this.funcColsService.getRowGroupColumns()),t=this.columnsToValueObjects(this.funcColsService.getValueColumns()),s=this.columnsToValueObjects(this.funcColsService.getPivotColumns()),i=c=>{const h={};c.oldCols.forEach(p=>h[p.id]=p);const d=c.newCols.every(p=>{const g=h[p.id];return g&&delete h[p.id],g&&g.field===p.field&&g.aggFunc===p.aggFunc}),u=!c.allowRemovedColumns&&!!Object.values(h).length;return d&&!u},r=!tL(this.storeParams.sortModel,this.sortController.getSortModel()),a=!i({oldCols:this.storeParams.rowGroupCols,newCols:e}),o=!i({oldCols:this.storeParams.pivotCols,newCols:s}),n=!!e?.length&&!i({oldCols:this.storeParams.valueCols,newCols:t,allowRemovedColumns:!0});if(r||a||o||n)this.resetRootStore();else{const c=this.createStoreParams();this.storeParams.rowGroupCols=c.rowGroupCols,this.storeParams.pivotCols=c.pivotCols,this.storeParams.valueCols=c.valueCols}}destroyRootStore(){!this.rootNode||!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.pivotColDefService){this.gos.assertModuleRegistered(YD.RowGroupingModule,"pivotResultFields");return}const t=this.pivotColDefService.createColDefsFromFields(e);this.managingPivotResultColumns=!0,this.pivotResultColsService.setPivotResultCols(t,"rowModelUpdated")}resetRowHeights(){const e=this.resetRowHeightsForAllRowNodes(),t=Cs(this.gos,this.rootNode);if(this.rootNode.setRowHeight(t.height,t.estimated),this.rootNode.sibling){const s=Cs(this.gos,this.rootNode.sibling);this.rootNode.sibling.setRowHeight(s.height,s.estimated)}e&&this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let e=!1;return this.forEachNode(t=>{const s=Cs(this.gos,t);t.setRowHeight(s.height,s.estimated);const i=t.detailNode;if(i){const r=Cs(this.gos,i);i.setRowHeight(r.height,r.estimated)}if(t.sibling){const r=Cs(this.gos,t.sibling);i.setRowHeight(r.height,r.estimated)}e=!0}),e}resetRootStore(){this.destroyRootStore(),this.rootNode=new qD(this.beans),this.rootNode.group=!0,this.rootNode.level=-1,this.datasource&&(this.storeParams=this.createStoreParams(),this.rootNode.childStore=this.createBean(this.storeFactory.createStore(this.storeParams,this.rootNode)),this.updateRowIndexesAndBounds()),this.managingPivotResultColumns&&(this.pivotResultColsService.setPivotResultCols(null,"api"),this.managingPivotResultColumns=!1),this.dispatchModelUpdated(!0)}columnsToValueObjects(e){return e.map(t=>({id:t.getId(),aggFunc:t.getAggFunc(),displayName:this.columnNameService.getDisplayNameForColumn(t,"model"),field:t.getColDef().field}))}createStoreParams(){const e=this.columnsToValueObjects(this.funcColsService.getRowGroupColumns()),t=this.columnsToValueObjects(this.funcColsService.getValueColumns()),s=this.columnsToValueObjects(this.funcColsService.getPivotColumns()),i=QD(this.gos);return{valueCols:t,rowGroupCols:e,pivotCols:s,pivotMode:this.columnModel.isPivotMode(),filterModel:this.filterManager?.isAdvancedFilterEnabled()?this.filterManager?.getAdvancedFilterModel():this.filterManager?.getFilterModel()??{},sortModel:this.sortController.getSortModel(),datasource:this.datasource,lastAccessedSequence:new fd,dynamicRowHeight:i}}getParams(){return this.storeParams}dispatchModelUpdated(e=!1){this.eventService.dispatchEvent({type:"modelUpdated",animate:!e,keepRenderedRows:!e,newPage:!1,newData:!1})}onStoreUpdated(){this.pauseStoreUpdateListening||(this.updateRowIndexesAndBounds(),this.dispatchModelUpdated())}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}onRowHeightChanged(){this.updateRowIndexesAndBounds(),this.dispatchModelUpdated()}updateRowIndexesAndBounds(){const e=this.getRootStore();e&&e.setDisplayIndexes(new fd,{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)}setPaused(e){this.pauseStoreUpdateListening=e}expandAll(e){this.pauseStoreUpdateListening=!0,this.forEachNode(t=>{t.stub||t.hasChildren()&&t.setExpanded(e)}),this.pauseStoreUpdateListening=!1,this.onStoreUpdated()}refreshAfterFilter(e,t){this.storeParams&&(this.storeParams.filterModel=e);const s=this.getRootStore();s&&(s.refreshAfterFilter(t),this.onStoreUpdated())}getRootStore(){if(this.rootNode&&this.rootNode.childStore)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:JD(this.gos)}}getBlockStates(){const e=this.getRootStore();if(!e)return;const t={};return e.forEachStoreDeep(s=>{if(s instanceof fo){const{id:i,state:r}=s.getBlockStateJson();t[i]=r}else if(s instanceof ys)Object.entries(s.getBlockStates()).forEach(([i,r])=>{t[i]=r});else throw new Error("AG Grid: Unsupported store type")}),t}getRowIndexAtPixel(e){const t=this.getRootStore();return e<=0||!t?0:t.getRowIndexAtPixel(e)}isEmpty(){return!1}isRowsToRender(){return this.getRootStore()!=null&&this.getRowCount()>0}getType(){return"serverSide"}forEachNode(e){const t=this.getRootStore();t&&t.forEachNodeDeep(e)}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=[],[a,o]=[s,i].sort((n,l)=>n-l);return this.forEachNode(n=>{const l=n.rowIndex;l==null||n.stub||l>=a&&l<=o&&r.push(n)}),r.length!==o-a+1?e?[e,t]:[]:r}getRowNode(e){let t;return this.forEachNode(s=>{s.id===e&&(t=s),s.detailNode&&s.detailNode.id===e&&(t=s.detailNode)}),t}isRowPresent(e){return!!this.getRowNode(e.id)}setRowCount(e,t){const s=this.getRootStore();if(s){if(s instanceof ys){s.setRowCount(e,t);return}ZD("Infinite scrolling must be enabled in order to set the row count.")}}destroy(){this.destroyDatasource(),this.destroyRootStore(),super.destroy()}};function zL(e){return e.selectionService.getSelectionState()}function WL(e,t){e.selectionService.setSelectionState(t,"api")}function KL(e,t){return e.ssrmTransactionManager?.applyTransaction(t)}function $L(e,t){const s=t.startRow??0,i=t.route??[];if(s<0){fL(`invalid value ${t.startRow} for startRow, the value should be >= 0`);return}e.rowModelHelperService?.getServerSideRowModel()?.applyRowData(t.successParams,s,i)}function jL(e,t,s){return e.ssrmTransactionManager?.applyTransactionAsync(t,s)}function YL(e){e.rowModelHelperService?.getServerSideRowModel()?.retryLoads()}function qL(e){return e.ssrmTransactionManager?.flushAsyncTransactions()}function XL(e,t){e.rowModelHelperService?.getServerSideRowModel()?.refreshStore(t)}function ZL(e){return e.rowModelHelperService?.getServerSideRowModel()?.getStoreState()??[]}var JL=class extends CL{constructor(){super(...arguments),this.beanName="expansionService",this.queuedRowIds=new Set}wireBeans(e){super.wireBeans(e),this.serverSideRowModel=e.rowModel}postConstruct(){super.postConstruct(),this.addManagedEventListeners({columnRowGroupChanged:()=>{this.queuedRowIds.clear()}})}checkOpenByDefault(e){if(!e.isExpandable())return;if(this.queuedRowIds.has(e.id)){this.queuedRowIds.delete(e.id),e.setExpanded(!0);return}const t=this.gos.getCallback("isServerSideGroupOpenByDefault");if(!t)return;const s={data:e.data,rowNode:e};t(s)&&e.setExpanded(!0)}expandRows(e){e.forEach(t=>{const s=this.serverSideRowModel.getRowNode(t);s?s.setExpanded(!0):this.queuedRowIds.add(t)})}expandAll(e){this.serverSideRowModel.expandAll(e)}onGroupExpandedOrCollapsed(){}},Ad=class{constructor(){this.root=null,this.end=null,this.cachedRange=[]}init(e){this.rowModel=e}reset(){this.root=null,this.end=null,this.cachedRange.length=0}setRoot(e){this.root=e,this.end=null,this.cachedRange.length=0}setEndRange(e){this.end=e,this.cachedRange.length=0}getRoot(){return this.root}getRange(){if(this.cachedRange.length===0){const e=this.root?this.rowModel.getRowNode(this.root):void 0,t=this.end?this.rowModel.getRowNode(this.end):void 0;if(e==null||t==null)return this.cachedRange;this.cachedRange=this.rowModel.getNodesInRangeForSelection(e,t)}return this.cachedRange}isInRange(e){return this.root===null?!1:this.getRange().some(t=>t.id===e)}truncate(e){const t=this.getRange();if(t.length===0)return{keep:[],discard:[]};const s=t[0].id===this.root,i=t.findIndex(r=>r.id===e);if(i>-1){const r=t.slice(0,i),a=t.slice(i+1);return this.setEndRange(e),s?{keep:r,discard:a}:{keep:a,discard:r}}else return{keep:t,discard:[]}}extend(e,t=!1){if(this.root==null){const a=this.getRange().slice(),o=this.rowModel.getRowNode(e);return o&&(t&&o.depthFirstSearch(n=>!n.group&&a.push(n)),a.push(o)),this.setRoot(e),{keep:a,discard:[]}}const s=this.rowModel.getRowNode(e),i=this.rowModel.getRowNode(this.root);if(s==null)return{keep:this.getRange(),discard:[]};if(i==null)return{keep:this.getRange().concat(s),discard:[]};if(this.rowModel.getNodesInRangeForSelection(i,s).find(a=>a.id===this.end))return this.setEndRange(e),{keep:this.getRange(),discard:[]};{const a=this.getRange().slice();return this.setEndRange(e),{keep:this.getRange(),discard:a}}}},So=class extends yL{constructor(){super(...arguments),this.selectionCtx=new Ad,this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectAllUsed=!1,this.selectedNodes={}}wireBeans(e){this.rowModel=e.rowModel}postConstruct(){this.selectionCtx.init(this.rowModel)}getSelectedState(){return{selectAll:this.selectedState.selectAll,toggledNodes:[...this.selectedState.toggledNodes]}}setSelectedState(e){const t={selectAll:!1,toggledNodes:new Set};if(typeof e!="object")return mo("The provided selection state should be an object.");if(!("selectAll"in e))return mo("Invalid selection state. The state must conform to `IServerSideSelectionState`.");if(typeof e.selectAll=="boolean")t.selectAll=e.selectAll;else return mo("selectAll must be of boolean type.");if("toggledNodes"in e&&Array.isArray(e.toggledNodes))e.toggledNodes.forEach(i=>{typeof i=="string"?t.toggledNodes.add(i):Ei(`Provided ids must be of string type. Invalid id provided: ${i}`)});else return Ei("`toggledNodes` must be an array of string ids.");const s=t.selectAll||t.toggledNodes.size>1;if(wL(this.gos)&&!bd(this.gos)&&s)return Ei("cannot multi select unless selection mode is 'multiRow'");this.selectedState=t}deleteSelectionStateFromParent(e,t){if(this.selectedState.toggledNodes.size===0)return!1;let s=!1;return t.forEach(i=>{this.selectedState.toggledNodes.delete(i)&&(s=!0)}),s}overrideSelectionValue(e,t){if(!bL(t))return e;const s=this.selectionCtx.getRoot(),i=s?this.rowModel.getRowNode(s):null;return i?i.isSelected()??!1:!0}setNodesSelected(e){const{nodes:t,clearSelection:s,newValue:i,rangeSelect:r,source:a}=e;if(t.length===0)return 0;const o=s&&i&&!r;if(!bd(this.gos)||o){if(t.length>1)throw new Error("AG Grid: cannot select multiple rows when rowSelection.mode is set to 'singleRow'");const l=t[0];return i&&l.selectable?(this.selectedNodes={[l.id]:l},this.selectedState={selectAll:!1,toggledNodes:new Set([l.id])}):(this.selectedNodes={},this.selectedState={selectAll:!1,toggledNodes:new Set}),l.selectable&&this.selectionCtx.setRoot(l.id),1}const n=(l,c=i)=>{c&&l.selectable?this.selectedNodes[l.id]=l:delete this.selectedNodes[l.id],c===this.selectedState.selectAll||!l.selectable?this.selectedState.toggledNodes.delete(l.id):this.selectedState.toggledNodes.add(l.id)};if(r){if(t.length>1)throw new Error("AG Grid: cannot select multiple rows when using rangeSelect");const l=t[0],c=this.overrideSelectionValue(i,a);if(this.selectionCtx.isInRange(l.id)){const h=this.selectionCtx.truncate(l.id);c&&h.discard.forEach(d=>n(d,!1)),h.keep.forEach(d=>n(d,c))}else if(this.selectionCtx.getRoot()!==l.id){const u=this.selectionCtx.extend(l.id);c&&u.discard.forEach(p=>n(p,!1)),u.keep.forEach(p=>n(p,c))}return 1}return t.forEach(l=>n(l)),this.selectionCtx.setRoot(xL(t).id),1}processNewRow(e){this.selectedNodes[e.id]&&(this.selectedNodes[e.id]=e)}isNodeSelected(e){const t=this.selectedState.toggledNodes.has(e.id);return this.selectedState.selectAll?!t:t}getSelectedNodes(){return this.selectAllUsed&&Ei("getSelectedNodes and getSelectedRows functions cannot be used with select all functionality with the server-side row model.\n Use `api.getServerSideSelectionState()` instead."),Object.values(this.selectedNodes)}getSelectedRows(){return this.getSelectedNodes().map(e=>e.data)}getSelectionCount(){return this.selectedState.selectAll?-1:this.selectedState.toggledNodes.size}clearOtherNodes(e,t){const s=this.selectedState.selectAll?1:this.selectedState.toggledNodes.size-1;return this.selectedState={selectAll:!1,toggledNodes:new Set([e.id])},this.rowModel.forEachNode(i=>{i!==e&&i.selectThisNode(!1,void 0,t)}),this.eventService.dispatchEvent({type:"selectionChanged",source:t}),s}isEmpty(){return!this.selectedState.selectAll&&!this.selectedState.toggledNodes?.size}selectAllRowNodes(){this.selectedState={selectAll:!0,toggledNodes:new Set},this.selectedNodes={},this.selectAllUsed=!0,this.selectionCtx.reset()}deselectAllRowNodes(){this.selectedState={selectAll:!1,toggledNodes:new Set},this.selectedNodes={},this.selectionCtx.reset()}getSelectAllState(){return this.selectedState.selectAll?this.selectedState.toggledNodes.size>0?null:!0:this.selectedState.toggledNodes.size>0?null:!1}},yo=class extends PL{constructor(){super(...arguments),this.selectionCtx=new Ad,this.selectedState={selectAllChildren:!1,toggledNodes:new Map}}wireBeans(e){this.rowModel=e.rowModel,this.funcColsService=e.funcColsService,this.filterManager=e.filterManager,this.selectionService=e.selectionService}postConstruct(){this.addManagedEventListeners({modelUpdated:()=>this.removeRedundantState(),columnRowGroupChanged:()=>this.selectionService.reset("rowGroupChanged")}),this.selectionCtx.init(this.rowModel)}getSelectedState(){const e=this.gos.get("treeData"),t=(s,i,r)=>{const a={nodeId:r};if((e||i<=this.funcColsService.getRowGroupColumns().length)&&(a.selectAllChildren=s.selectAllChildren),s.toggledNodes.size){const o=[];s.toggledNodes.forEach((n,l)=>{const c=t(n,i+1,l);o.push(c)}),a.toggledNodes=o}return a};return t(this.selectedState,0)}setSelectedState(e){if("selectAll"in e)return Pd("Invalid selection state. When `groupSelectsChildren` is enabled, the state must conform to `IServerSideGroupSelectionState`.");const t=(s,i)=>{if(typeof s!="object")throw new Error("Each provided state object must be an object.");if("selectAllChildren"in s&&typeof s.selectAllChildren!="boolean")throw new Error("`selectAllChildren` must be a boolean value or undefined.");if("toggledNodes"in s){if(!Array.isArray(s.toggledNodes))throw new Error("`toggledNodes` must be an array.");if(!s.toggledNodes.every(l=>typeof l=="object"&&"nodeId"in l&&typeof l.nodeId=="string"))throw new Error("Every `toggledNode` requires an associated string id.")}const r=s.selectAllChildren??!i,a=s.toggledNodes?.map(n=>[n.nodeId,t(n,r)]);if(a?.some(([,n])=>r===n.selectAllChildren&&n.toggledNodes.size===0))throw new Error(`
394
394
  Row selection state could not be parsed due to invalid data. Ensure all child state has toggledNodes or does not conform with the parent rule.
395
395
  Please rebuild the selection state and reapply it.
396
- `);return{selectAllChildren:r,toggledNodes:new Map(a)}};try{this.selectedState=t(e,!!e.selectAllChildren)}catch(s){Pd(s.message)}}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;return t.forEach(a=>{s?.toggledNodes.delete(a)&&(r=!0)}),r&&this.removeRedundantState(),r}overrideSelectionValue(e,t){if(!FL(t))return e;const s=this.selectionCtx.getRoot(),i=s?this.rowModel.getRowNode(s):null;return i?i.isSelected()??!1:!0}setNodesSelected({nodes:e,newValue:t,rangeSelect:s,clearSelection:i,source:r}){if(e.length===0)return 0;if(s){if(e.length>1)throw new Error("AG Grid: cannot select multiple rows when using rangeSelect");const o=e[0],n=this.overrideSelectionValue(t,r);if(this.selectionCtx.isInRange(o.id)){const l=this.selectionCtx.truncate(o.id);return n&&this.selectRange(l.discard,!1),this.selectRange(l.keep,n),1}else if(this.selectionCtx.getRoot()!==o.id){const h=this.selectionCtx.extend(o.id,!0);return n&&this.selectRange(h.discard,!1),this.selectRange(h.keep,n),1}return 1}const a=i&&t&&!s;if(!TL(this.gos)||a){if(e.length>1)throw new Error("AG Grid: cannot select multiple rows when rowSelection.mode is set to 'singleRow'");this.deselectAllRowNodes()}return e.forEach(o=>{const n=this.getRouteToNode(o);this.recursivelySelectNode(n,this.selectedState,t)}),this.removeRedundantState(),this.selectionCtx.setRoot(Td(e).id),1}selectRange(e,t){const s=e.map(this.getRouteToNode).sort((r,a)=>a.length-r.length),i=new Set;s.forEach(r=>{i.has(Td(r))||(r.forEach(a=>i.add(a)),this.recursivelySelectNode(r,this.selectedState,t))}),this.removeRedundantState()}isNodeSelected(e){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);if(e.hasChildren()){const r=s.toggledNodes.get(e.id);if(r&&r.toggledNodes.size)return}return 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,n)=>{e(o,n,t)}),s){const n=this.rowModel.getRowNode(s)?.childStore;if(n?.isLastRowIndexKnown()&&t.toggledNodes.size>=n.getRowCount()){for(const h of t.toggledNodes.entries()){const[d,u]=h;if(u.toggledNodes.size>0||!this.rowModel.getRowNode(d))return}t.selectAllChildren=!t.selectAllChildren,t.toggledNodes.clear()}}const r=t.toggledNodes.size===0,a=i?.selectAllChildren===t.selectAllChildren;r&&a&&i?.toggledNodes.delete(s)};e()}recursivelySelectNode([e,...t],s,i){if(!e)return;if(!t.length){const n=e.selectable;if(s.selectAllChildren===i||!n){s.toggledNodes.delete(e.id);return}const c={selectAllChildren:i,toggledNodes:new Map};s.toggledNodes.set(e.id,c);return}const a=s.toggledNodes.has(e.id),o=s.toggledNodes.get(e.id)??{selectAllChildren:s.selectAllChildren,toggledNodes:new Map};a||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(){ML("`getSelectedNodes` and `getSelectedRows` functions cannot be used with `groupSelectsChildren` and the server-side row model.\n Use `api.getServerSideSelectionState()` instead.");const e=[];return this.rowModel.forEachNode(t=>{t.isSelected()&&e.push(t)}),e}processNewRow(){}getSelectedRows(){return this.getSelectedNodes().map(e=>e.data)}getSelectionCount(){return-1}isEmpty(){return!this.selectedState.selectAllChildren&&!this.selectedState.toggledNodes?.size}selectAllRowNodes(){this.selectedState={selectAllChildren:!0,toggledNodes:new Map},this.selectionCtx.reset()}deselectAllRowNodes(){this.selectedState={selectAllChildren:!1,toggledNodes:new Map},this.selectionCtx.reset()}getSelectAllState(){return this.selectedState.selectAllChildren?this.selectedState.toggledNodes.size>0?null:!0:this.selectedState.toggledNodes.size>0?null:!1}},QL=class extends vL{constructor(){super(...arguments),this.beanName="selectionService"}wireBeans(e){this.rowModel=e.rowModel}postConstruct(){this.addManagedPropertyListeners(["groupSelectsChildren","rowSelection"],()=>{const s=xd(this.gos),i=s&&this.selectionStrategy instanceof So?yo:!s&&this.selectionStrategy instanceof yo?So:void 0;i&&(this.destroyBean(this.selectionStrategy),this.selectionStrategy=this.createManagedBean(new i),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}),this.addManagedPropertyListeners(["rowSelection"],()=>{const s=go(this.gos);s!==this.selectionMode&&(this.selectionMode=s,this.deselectAllRowNodes({source:"api"}))}),this.selectionMode=go(this.gos);const t=xd(this.gos)?yo:So;this.selectionStrategy=this.createManagedBean(new t)}getSelectionState(){return this.selectionStrategy.getSelectedState()}setSelectionState(e,t){Array.isArray(e)||(this.selectionStrategy.setSelectedState(e),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged(t))}setNodesSelected(e){const{nodes:t,...s}=e;if(t.length>1&&this.selectionMode!=="multiRow")return Ss("cannot multi select unless selection mode is 'multiRow'"),0;if(t.length>1&&e.rangeSelect)return Ss("cannot use range selection when multi selecting rows"),0;const i={nodes:t.filter(a=>a.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.rowModel.forEachNode(t=>{if(t.stub)return;const s=this.selectionStrategy.isNodeSelected(t);s!==t.isSelected()&&t.selectThisNode(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.setSelectedInitialValue(t)}reset(){this.selectionStrategy.deselectAllRowNodes({source:"api"})}isEmpty(){return this.selectionStrategy.isEmpty()}hasNodesToSelect(){return!0}selectAllRowNodes(e){if(Rd(e),SL(this.gos)&&go(this.gos)!=="multiRow")return Ss("cannot multi select unless selection mode is 'multiRow'");this.selectionStrategy.selectAllRowNodes(e),this.rowModel.forEachNode(t=>{t.stub||t.selectThisNode(!0,void 0,e.source)}),this.dispatchSelectionChanged(e.source)}deselectAllRowNodes(e){Rd(e),this.selectionStrategy.deselectAllRowNodes(e),this.rowModel.forEachNode(t=>{t.stub||t.selectThisNode(!1,void 0,e.source)}),this.dispatchSelectionChanged(e.source)}getSelectAllState(e,t){return this.selectionStrategy.getSelectAllState(e,t)}updateGroupsFromChildrenSelections(){return!1}getBestCostNodeSelection(){Ss("calling gridApi.getBestCostNodeSelection() is only possible when using rowModelType=`clientSide`.")}filterFromSelection(){}dispatchSelectionChanged(e){this.eventService.dispatchEvent({type:"selectionChanged",source:e})}};function Rd({justCurrentPage:e,justFiltered:t}){(e||t)&&Ss(`selecting just ${e?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`)}var e0=class extends AL{constructor(){super(...arguments),this.beanName="ssrmStoreFactory"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}createStore(e,t){const s=this.getStoreParams(e,t),i=s.suppressInfiniteScroll?fo:ys;return new i(e,s,t)}getStoreParams(e,t){const s=this.getLevelSpecificParams(t),i=this.isInfiniteScroll(s),r=this.getBlockSize(i,s),a=this.getMaxBlocksInCache(i,e,s);return{suppressInfiniteScroll:!i,cacheBlockSize:r,maxBlocksInCache:a}}getMaxBlocksInCache(e,t,s){if(!e)return;const i=s&&s.maxBlocksInCache!=null?s.maxBlocksInCache:this.gos.get("maxBlocksInCache");if(i!=null&&i>=0){if(t.dynamicRowHeight){Md("Server Side Row Model does not support Dynamic Row Height and Cache Purging. Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.");return}if(this.columnModel.isAutoRowHeightActive()){Md("Server Side Row Model does not support Auto Row Height and Cache Purging. Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.");return}return i}}getBlockSize(e,t){if(!e)return;const s=t&&t.cacheBlockSize!=null?t.cacheBlockSize:this.gos.get("cacheBlockSize");return s!=null&&s>0?s: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.funcColsService.getRowGroupColumns(),pivotColumns:this.funcColsService.getPivotColumns(),pivotMode:this.columnModel.isPivotMode()};return t(s)}isInfiniteScroll(e){return!(e&&e.suppressInfiniteScroll!=null?e.suppressInfiniteScroll:this.isSuppressServerSideInfiniteScroll())}isSuppressServerSideInfiniteScroll(){return this.gos.get("suppressServerSideInfiniteScroll")}},t0=class extends RL{constructor(){super(...arguments),this.beanName="ssrmStoreUtils"}wireBeans(e){this.columnModel=e.columnModel,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}loadFromDatasource(e){const{storeParams:t,parentBlock:s,parentNode:i}=e,r=i.getRoute()??[];if(!t.datasource)return;const a={startRow:e.startRow,endRow:e.endRow,rowGroupCols:t.rowGroupCols,valueCols:t.valueCols,pivotCols:t.pivotCols,pivotMode:t.pivotMode,groupKeys:r,filterModel:t.filterModel,sortModel:t.sortModel},o=this.gos.addGridCommonParams({success:e.success,fail:e.fail,request:a,parentNode:e.parentNode});window.setTimeout(()=>{if(!t.datasource||!s.isAlive()){e.fail();return}t.datasource.getRows(o)},0)}getChildStore(e,t,s){if(IL(e))return t;const i=e[0],r=s(i);if(r){if(e.length===1&&!r.childStore){const n=this.serverSideRowModel.getParams();r.childStore=this.createBean(this.storeFactory.createStore(n,r))}const a=e.slice(1,e.length),o=r.childStore;return o?o.getChildStore(a):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.columnModel.getCols().filter(h=>h.getColDef().showRowGroup&&s.changedColumns.includes(h.getId())).map(h=>h.getColDef().showRowGroup).some(h=>h===!0||h===o)}getServerSideInitialRowCount(){return this.gos.get("serverSideInitialRowCount")}assertRowModelIsServerSide(e){return EL(this.gos)?!0:(Fd(`The '${e}' property can only be used with the Server Side Row Model.`),!1)}assertNotTreeData(e){return this.gos.get("treeData")?(Fd(`The '${e}' property cannot be used while using tree data.`),!1):!0}isServerSideSortAllLevels(){return this.gos.get("serverSideSortAllLevels")&&this.assertRowModelIsServerSide("serverSideSortAllLevels")}isServerSideOnlyRefreshFilteredGroups(){return this.gos.get("serverSideOnlyRefreshFilteredGroups")&&this.assertRowModelIsServerSide("serverSideOnlyRefreshFilteredGroups")}isServerSideSortOnServer(){return this.gos.get("serverSideSortOnServer")&&this.assertRowModelIsServerSide("serverSideSortOnServer")&&this.assertNotTreeData("serverSideSortOnServer")}isServerSideFilterOnServer(){return this.gos.get("serverSideFilterOnServer")&&this.assertRowModelIsServerSide("serverSideFilterOnServer")&&this.assertNotTreeData("serverSideFilterOnServer")}},s0=class extends DL{constructor(){super(...arguments),this.beanName="ssrmTransactionManager",this.asyncTransactions=[]}wireBeans(e){this.valueCache=e.valueCache,this.serverSideRowModel=e.rowModel,this.selectionService=e.selectionService}postConstruct(){LL(this.gos)}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;this.asyncTransactions.forEach(r=>{let a;if(this.serverSideRowModel.executeOnStore(r.transaction.route,l=>{a=l.applyTransaction(r.transaction)})?a==null&&(a={status:xt.StoreNotFound}):a={status:xt.StoreNotStarted},t.push(a),a.status==xt.StoreLoading){s.push(r);return}r.callback&&e.push(()=>r.callback(a)),a.status===xt.Applied&&(i=!0)}),e.length>0&&window.setTimeout(()=>{e.forEach(r=>r())},0),this.asyncTransactionsTimeout=void 0,this.asyncTransactions=s,i&&(this.valueCache.onDataChanged(),this.eventService.dispatchEvent({type:"storeUpdated"})),t.length>0&&this.eventService.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){const i=t.remove.map(r=>r.id);this.selectionService.deleteSelectionStateFromParent(e.route||[],i)}return this.eventService.dispatchEvent({type:"storeUpdated"}),t}else return{status:xt.StoreNotFound};else return{status:xt.StoreNotStarted}}},wo="32.3.2",Ed=co({version:wo,moduleName:`${lo.ServerSideRowModelModule}-core`,rowModel:"serverSide",beans:[HL,OL,VL,t0,GL,_L,s0,BL,e0,NL,QL,JL,Co],dependantModules:[H,ED]}),i0=co({version:wo,moduleName:`${lo.ServerSideRowModelModule}-api`,beans:[AD],apiFunctions:{getServerSideSelectionState:zL,setServerSideSelectionState:WL,applyServerSideTransaction:KL,applyServerSideTransactionAsync:jL,applyServerSideRowData:$L,retryServerSideLoads:YL,flushServerSideAsyncTransactions:qL,refreshServerSide:XL,getServerSideGroupLevelState:ZL},dependantModules:[Ed,RD,ID]}),xo=co({version:wo,moduleName:lo.ServerSideRowModelModule,dependantModules:[Ed,i0]});import{ModuleNames as Id,_ColumnFilterModule as r0,_FloatingFilterModule as a0,_defineModule as bo}from"ag-grid-community";import{AgInputTextFieldSelector as o0,AgPromise as Dd,GROUP_AUTO_COLUMN_ID as n0,KeyCode as ws,ProvidedFilter as l0,RefPlaceholder as Ii,_areEqual as c0,_getActiveDomElement as h0,_last as d0,_makeNull as Ld,_setDisplayed as Po,_toStringOrNull as To,_warnOnce as u0}from"ag-grid-community";import{AgCheckboxSelector as p0,Component as g0,RefPlaceholder as Di,_createIcon as Mo,_setAriaChecked as m0,_setAriaDescribedBy as f0,_setAriaExpanded as C0,_setAriaLabel as v0,_setAriaLabelledBy as S0,_setAriaLevel as y0,_setDisplayed as Fo,_toStringOrNull as kd,_warnOnce as w0}from"ag-grid-community";import{_last as x0,_makeNull as b0,_toStringOrNull as P0}from"ag-grid-community";import{AgPromise as bt,LocalEventService as T0,_defaultComparator as Ao,_errorOnce as M0,_exists as F0,_isClientSideRowModel as A0,_makeNull as Ro,_warnOnce as Gd}from"ag-grid-community";import{AgPromise as R0,_makeNull as E0}from"ag-grid-community";import{_warnOnce as I0}from"ag-grid-community";import{AgInputTextFieldSelector as D0,Component as L0,RefPlaceholder as k0}from"ag-grid-community";var J=class{};J.SELECT_ALL="__AG_SELECT_ALL__",J.ADD_SELECTION_TO_FILTER="__AG_ADD_SELECTION_TO_FILTER__";var G0={loadingOoo:"Loading...",blanks:"(Blanks)",searchOoo:"Search...",selectAll:"(Select All)",selectAllSearchResults:"(Select All Search Results)",addCurrentSelectionToFilter:"Add current selection to filter",noMatches:"No matches."},O0=class extends g0{constructor(e){super(e.isGroup?`
396
+ `);return{selectAllChildren:r,toggledNodes:new Map(a)}};try{this.selectedState=t(e,!!e.selectAllChildren)}catch(s){Pd(s.message)}}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;return t.forEach(a=>{s?.toggledNodes.delete(a)&&(r=!0)}),r&&this.removeRedundantState(),r}overrideSelectionValue(e,t){if(!FL(t))return e;const s=this.selectionCtx.getRoot(),i=s?this.rowModel.getRowNode(s):null;return i?i.isSelected()??!1:!0}setNodesSelected({nodes:e,newValue:t,rangeSelect:s,clearSelection:i,source:r}){if(e.length===0)return 0;if(s){if(e.length>1)throw new Error("AG Grid: cannot select multiple rows when using rangeSelect");const o=e[0],n=this.overrideSelectionValue(t,r);if(this.selectionCtx.isInRange(o.id)){const l=this.selectionCtx.truncate(o.id);return n&&this.selectRange(l.discard,!1),this.selectRange(l.keep,n),1}else if(this.selectionCtx.getRoot()!==o.id){const h=this.selectionCtx.extend(o.id,!0);return n&&this.selectRange(h.discard,!1),this.selectRange(h.keep,n),1}return 1}const a=i&&t&&!s;if(!TL(this.gos)||a){if(e.length>1)throw new Error("AG Grid: cannot select multiple rows when rowSelection.mode is set to 'singleRow'");this.deselectAllRowNodes()}return e.forEach(o=>{const n=this.getRouteToNode(o);this.recursivelySelectNode(n,this.selectedState,t)}),this.removeRedundantState(),this.selectionCtx.setRoot(Td(e).id),1}selectRange(e,t){const s=e.map(this.getRouteToNode).sort((r,a)=>a.length-r.length),i=new Set;s.forEach(r=>{i.has(Td(r))||(r.forEach(a=>i.add(a)),this.recursivelySelectNode(r,this.selectedState,t))}),this.removeRedundantState()}isNodeSelected(e){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);if(e.hasChildren()){const r=s.toggledNodes.get(e.id);if(r&&r.toggledNodes.size)return}return 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,n)=>{e(o,n,t)}),s){const n=this.rowModel.getRowNode(s)?.childStore;if(n?.isLastRowIndexKnown()&&t.toggledNodes.size>=n.getRowCount()){for(const h of t.toggledNodes.entries()){const[d,u]=h;if(u.toggledNodes.size>0||!this.rowModel.getRowNode(d))return}t.selectAllChildren=!t.selectAllChildren,t.toggledNodes.clear()}}const r=t.toggledNodes.size===0,a=i?.selectAllChildren===t.selectAllChildren;r&&a&&i?.toggledNodes.delete(s)};e()}recursivelySelectNode([e,...t],s,i){if(!e)return;if(!t.length){const n=e.selectable;if(s.selectAllChildren===i||!n){s.toggledNodes.delete(e.id);return}const c={selectAllChildren:i,toggledNodes:new Map};s.toggledNodes.set(e.id,c);return}const a=s.toggledNodes.has(e.id),o=s.toggledNodes.get(e.id)??{selectAllChildren:s.selectAllChildren,toggledNodes:new Map};a||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(){ML("`getSelectedNodes` and `getSelectedRows` functions cannot be used with `groupSelectsChildren` and the server-side row model.\n Use `api.getServerSideSelectionState()` instead.");const e=[];return this.rowModel.forEachNode(t=>{t.isSelected()&&e.push(t)}),e}processNewRow(){}getSelectedRows(){return this.getSelectedNodes().map(e=>e.data)}getSelectionCount(){return-1}isEmpty(){return!this.selectedState.selectAllChildren&&!this.selectedState.toggledNodes?.size}selectAllRowNodes(){this.selectedState={selectAllChildren:!0,toggledNodes:new Map},this.selectionCtx.reset()}deselectAllRowNodes(){this.selectedState={selectAllChildren:!1,toggledNodes:new Map},this.selectionCtx.reset()}getSelectAllState(){return this.selectedState.selectAllChildren?this.selectedState.toggledNodes.size>0?null:!0:this.selectedState.toggledNodes.size>0?null:!1}},QL=class extends vL{constructor(){super(...arguments),this.beanName="selectionService"}wireBeans(e){this.rowModel=e.rowModel}postConstruct(){this.addManagedPropertyListeners(["groupSelectsChildren","rowSelection"],()=>{const s=xd(this.gos),i=s&&this.selectionStrategy instanceof So?yo:!s&&this.selectionStrategy instanceof yo?So:void 0;i&&(this.destroyBean(this.selectionStrategy),this.selectionStrategy=this.createManagedBean(new i),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged("api"))}),this.addManagedPropertyListeners(["rowSelection"],()=>{const s=go(this.gos);s!==this.selectionMode&&(this.selectionMode=s,this.deselectAllRowNodes({source:"api"}))}),this.selectionMode=go(this.gos);const t=xd(this.gos)?yo:So;this.selectionStrategy=this.createManagedBean(new t)}getSelectionState(){return this.selectionStrategy.getSelectedState()}setSelectionState(e,t){Array.isArray(e)||(this.selectionStrategy.setSelectedState(e),this.shotgunResetNodeSelectionState(),this.dispatchSelectionChanged(t))}setNodesSelected(e){const{nodes:t,...s}=e;if(t.length>1&&this.selectionMode!=="multiRow")return Ss("cannot multi select unless selection mode is 'multiRow'"),0;if(t.length>1&&e.rangeSelect)return Ss("cannot use range selection when multi selecting rows"),0;const i={nodes:t.filter(a=>a.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.rowModel.forEachNode(t=>{if(t.stub)return;const s=this.selectionStrategy.isNodeSelected(t);s!==t.isSelected()&&t.selectThisNode(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.setSelectedInitialValue(t)}reset(){this.selectionStrategy.deselectAllRowNodes({source:"api"})}isEmpty(){return this.selectionStrategy.isEmpty()}hasNodesToSelect(){return!0}selectAllRowNodes(e){if(Rd(e),SL(this.gos)&&go(this.gos)!=="multiRow")return Ss("cannot multi select unless selection mode is 'multiRow'");this.selectionStrategy.selectAllRowNodes(e),this.rowModel.forEachNode(t=>{t.stub||t.selectThisNode(!0,void 0,e.source)}),this.dispatchSelectionChanged(e.source)}deselectAllRowNodes(e){Rd(e),this.selectionStrategy.deselectAllRowNodes(e),this.rowModel.forEachNode(t=>{t.stub||t.selectThisNode(!1,void 0,e.source)}),this.dispatchSelectionChanged(e.source)}getSelectAllState(e,t){return this.selectionStrategy.getSelectAllState(e,t)}updateGroupsFromChildrenSelections(){return!1}getBestCostNodeSelection(){Ss("calling gridApi.getBestCostNodeSelection() is only possible when using rowModelType=`clientSide`.")}filterFromSelection(){}dispatchSelectionChanged(e){this.eventService.dispatchEvent({type:"selectionChanged",source:e})}};function Rd({justCurrentPage:e,justFiltered:t}){(e||t)&&Ss(`selecting just ${e?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`)}var e0=class extends AL{constructor(){super(...arguments),this.beanName="ssrmStoreFactory"}wireBeans(e){this.columnModel=e.columnModel,this.funcColsService=e.funcColsService}createStore(e,t){const s=this.getStoreParams(e,t),i=s.suppressInfiniteScroll?fo:ys;return new i(e,s,t)}getStoreParams(e,t){const s=this.getLevelSpecificParams(t),i=this.isInfiniteScroll(s),r=this.getBlockSize(i,s),a=this.getMaxBlocksInCache(i,e,s);return{suppressInfiniteScroll:!i,cacheBlockSize:r,maxBlocksInCache:a}}getMaxBlocksInCache(e,t,s){if(!e)return;const i=s&&s.maxBlocksInCache!=null?s.maxBlocksInCache:this.gos.get("maxBlocksInCache");if(i!=null&&i>=0){if(t.dynamicRowHeight){Md("Server Side Row Model does not support Dynamic Row Height and Cache Purging. Either a) remove getRowHeight() callback or b) remove maxBlocksInCache property. Purging has been disabled.");return}if(this.columnModel.isAutoRowHeightActive()){Md("Server Side Row Model does not support Auto Row Height and Cache Purging. Either a) remove colDef.autoHeight or b) remove maxBlocksInCache property. Purging has been disabled.");return}return i}}getBlockSize(e,t){if(!e)return;const s=t&&t.cacheBlockSize!=null?t.cacheBlockSize:this.gos.get("cacheBlockSize");return s!=null&&s>0?s: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.funcColsService.getRowGroupColumns(),pivotColumns:this.funcColsService.getPivotColumns(),pivotMode:this.columnModel.isPivotMode()};return t(s)}isInfiniteScroll(e){return!(e&&e.suppressInfiniteScroll!=null?e.suppressInfiniteScroll:this.isSuppressServerSideInfiniteScroll())}isSuppressServerSideInfiniteScroll(){return this.gos.get("suppressServerSideInfiniteScroll")}},t0=class extends RL{constructor(){super(...arguments),this.beanName="ssrmStoreUtils"}wireBeans(e){this.columnModel=e.columnModel,this.serverSideRowModel=e.rowModel,this.storeFactory=e.ssrmStoreFactory}loadFromDatasource(e){const{storeParams:t,parentBlock:s,parentNode:i}=e,r=i.getRoute()??[];if(!t.datasource)return;const a={startRow:e.startRow,endRow:e.endRow,rowGroupCols:t.rowGroupCols,valueCols:t.valueCols,pivotCols:t.pivotCols,pivotMode:t.pivotMode,groupKeys:r,filterModel:t.filterModel,sortModel:t.sortModel},o=this.gos.addGridCommonParams({success:e.success,fail:e.fail,request:a,parentNode:e.parentNode});window.setTimeout(()=>{if(!t.datasource||!s.isAlive()){e.fail();return}t.datasource.getRows(o)},0)}getChildStore(e,t,s){if(IL(e))return t;const i=e[0],r=s(i);if(r){if(e.length===1&&!r.childStore){const n=this.serverSideRowModel.getParams();r.childStore=this.createBean(this.storeFactory.createStore(n,r))}const a=e.slice(1,e.length),o=r.childStore;return o?o.getChildStore(a):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.columnModel.getCols().filter(h=>h.getColDef().showRowGroup&&s.changedColumns.includes(h.getId())).map(h=>h.getColDef().showRowGroup).some(h=>h===!0||h===o)}getServerSideInitialRowCount(){return this.gos.get("serverSideInitialRowCount")}assertRowModelIsServerSide(e){return EL(this.gos)?!0:(Fd(`The '${e}' property can only be used with the Server Side Row Model.`),!1)}assertNotTreeData(e){return this.gos.get("treeData")?(Fd(`The '${e}' property cannot be used while using tree data.`),!1):!0}isServerSideSortAllLevels(){return this.gos.get("serverSideSortAllLevels")&&this.assertRowModelIsServerSide("serverSideSortAllLevels")}isServerSideOnlyRefreshFilteredGroups(){return this.gos.get("serverSideOnlyRefreshFilteredGroups")&&this.assertRowModelIsServerSide("serverSideOnlyRefreshFilteredGroups")}isServerSideSortOnServer(){return this.gos.get("serverSideSortOnServer")&&this.assertRowModelIsServerSide("serverSideSortOnServer")&&this.assertNotTreeData("serverSideSortOnServer")}isServerSideFilterOnServer(){return this.gos.get("serverSideFilterOnServer")&&this.assertRowModelIsServerSide("serverSideFilterOnServer")&&this.assertNotTreeData("serverSideFilterOnServer")}},s0=class extends DL{constructor(){super(...arguments),this.beanName="ssrmTransactionManager",this.asyncTransactions=[]}wireBeans(e){this.valueCache=e.valueCache,this.serverSideRowModel=e.rowModel,this.selectionService=e.selectionService}postConstruct(){LL(this.gos)}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;this.asyncTransactions.forEach(r=>{let a;if(this.serverSideRowModel.executeOnStore(r.transaction.route,l=>{a=l.applyTransaction(r.transaction)})?a==null&&(a={status:xt.StoreNotFound}):a={status:xt.StoreNotStarted},t.push(a),a.status==xt.StoreLoading){s.push(r);return}r.callback&&e.push(()=>r.callback(a)),a.status===xt.Applied&&(i=!0)}),e.length>0&&window.setTimeout(()=>{e.forEach(r=>r())},0),this.asyncTransactionsTimeout=void 0,this.asyncTransactions=s,i&&(this.valueCache.onDataChanged(),this.eventService.dispatchEvent({type:"storeUpdated"})),t.length>0&&this.eventService.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){const i=t.remove.map(r=>r.id);this.selectionService.deleteSelectionStateFromParent(e.route||[],i)}return this.eventService.dispatchEvent({type:"storeUpdated"}),t}else return{status:xt.StoreNotFound};else return{status:xt.StoreNotStarted}}},wo="32.3.3",Ed=co({version:wo,moduleName:`${lo.ServerSideRowModelModule}-core`,rowModel:"serverSide",beans:[HL,OL,VL,t0,GL,_L,s0,BL,e0,NL,QL,JL,Co],dependantModules:[H,ED]}),i0=co({version:wo,moduleName:`${lo.ServerSideRowModelModule}-api`,beans:[AD],apiFunctions:{getServerSideSelectionState:zL,setServerSideSelectionState:WL,applyServerSideTransaction:KL,applyServerSideTransactionAsync:jL,applyServerSideRowData:$L,retryServerSideLoads:YL,flushServerSideAsyncTransactions:qL,refreshServerSide:XL,getServerSideGroupLevelState:ZL},dependantModules:[Ed,RD,ID]}),xo=co({version:wo,moduleName:lo.ServerSideRowModelModule,dependantModules:[Ed,i0]});import{ModuleNames as Id,_ColumnFilterModule as r0,_FloatingFilterModule as a0,_defineModule as bo}from"ag-grid-community";import{AgInputTextFieldSelector as o0,AgPromise as Dd,GROUP_AUTO_COLUMN_ID as n0,KeyCode as ws,ProvidedFilter as l0,RefPlaceholder as Ii,_areEqual as c0,_getActiveDomElement as h0,_last as d0,_makeNull as Ld,_setDisplayed as Po,_toStringOrNull as To,_warnOnce as u0}from"ag-grid-community";import{AgCheckboxSelector as p0,Component as g0,RefPlaceholder as Di,_createIcon as Mo,_setAriaChecked as m0,_setAriaDescribedBy as f0,_setAriaExpanded as C0,_setAriaLabel as v0,_setAriaLabelledBy as S0,_setAriaLevel as y0,_setDisplayed as Fo,_toStringOrNull as kd,_warnOnce as w0}from"ag-grid-community";import{_last as x0,_makeNull as b0,_toStringOrNull as P0}from"ag-grid-community";import{AgPromise as bt,LocalEventService as T0,_defaultComparator as Ao,_errorOnce as M0,_exists as F0,_isClientSideRowModel as A0,_makeNull as Ro,_warnOnce as Gd}from"ag-grid-community";import{AgPromise as R0,_makeNull as E0}from"ag-grid-community";import{_warnOnce as I0}from"ag-grid-community";import{AgInputTextFieldSelector as D0,Component as L0,RefPlaceholder as k0}from"ag-grid-community";var J=class{};J.SELECT_ALL="__AG_SELECT_ALL__",J.ADD_SELECTION_TO_FILTER="__AG_ADD_SELECTION_TO_FILTER__";var G0={loadingOoo:"Loading...",blanks:"(Blanks)",searchOoo:"Search...",selectAll:"(Select All)",selectAllSearchResults:"(Select All Search Results)",addCurrentSelectionToFilter:"Add current selection to filter",noMatches:"No matches."},O0=class extends g0{constructor(e){super(e.isGroup?`
397
397
  <div class="ag-set-filter-item" aria-hidden="true">
398
398
  <span class="ag-set-filter-group-icons">
399
399
  <span class="ag-set-filter-group-closed-icon" data-ref="eGroupClosedIcon"></span>
@@ -413,7 +413,7 @@ Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromInd
413
413
  </div>`}getAgComponents(){return[o0]}handleKeyDown(e){if(super.handleKeyDown(e),!e.defaultPrevented)switch(e.key){case ws.SPACE:this.handleKeySpace(e);break;case ws.ENTER:this.handleKeyEnter(e);break;case ws.LEFT:this.handleKeyLeft(e);break;case ws.RIGHT:this.handleKeyRight(e);break}}handleKeySpace(e){this.getComponentForKeyEvent(e)?.toggleSelected()}handleKeyEnter(e){if(!this.setFilterParams)return;const{excelMode:t,readOnly:s}=this.setFilterParams||{};!t||s||(e.preventDefault(),this.onBtApply(!1,!1,e),this.setFilterParams.excelMode==="mac"&&this.eMiniFilter.getInputElement().select())}handleKeyLeft(e){this.getComponentForKeyEvent(e)?.setExpanded(!1)}handleKeyRight(e){this.getComponentForKeyEvent(e)?.setExpanded(!0)}getComponentForKeyEvent(e){if(!this.eSetFilterList.contains(h0(this.gos))||!this.virtualList)return;const t=this.virtualList.getLastFocusedRow();if(t==null)return;const s=this.virtualList.getComponentAt(t);if(s==null)return;e.preventDefault();const{readOnly:i}=this.setFilterParams??{};if(!i)return s}getCssIdentifier(){return"set-filter"}setModel(e){return e==null&&this.valueModel?.getModel()==null?(this.setMiniFilter(null),Dd.resolve()):super.setModel(e)}refresh(e){if(this.applyExcelModeOptions(e),!super.refresh(e))return!1;const t=this.setFilterParams;return["treeList","treeListPathGetter","caseSensitive","comparator","excelMode"].some(i=>e[i]!==t?.[i])||this.haveColDefParamsChanged(e)?!1:(super.updateParams(e),this.updateSetFilterOnParamsChange(e),this.updateMiniFilter(),e.suppressSelectAll!==t?.suppressSelectAll&&this.createVirtualListModel(e),this.valueModel?.updateOnParamsChange(e).then(()=>{this.refreshFilterValues()}),!0)}haveColDefParamsChanged(e){const{colDef:t,keyCreator:s}=e,{colDef:i,keyCreator:r}=this.setFilterParams??{},a=s??t.keyCreator,o=r??i?.keyCreator,n=t.filterValueGetter!==i?.filterValueGetter,l=a!==o,c=!!this.dataTypeService&&!!a&&this.dataTypeService.getFormatValue(t.cellDataType)===a&&t.valueFormatter!==i?.valueFormatter;return n||l||c}setModelAndRefresh(e){return this.valueModel?this.valueModel.setModel(e).then(()=>{this.isAlive()&&this.checkAndRefreshVirtualList()}):Dd.resolve()}resetUiToDefaults(){return this.setMiniFilter(null),this.setModelAndRefresh(null)}setModelIntoUi(e){this.setMiniFilter(null);const t=e==null?null:e.values;return this.setModelAndRefresh(t)}getModelFromUi(){if(!this.valueModel)throw new Error("Value model has not been created.");const e=this.valueModel.getModel();return e?{values:e,filterType:this.getFilterType()}:null}getFilterType(){return"set"}getValueModel(){return this.valueModel}areModelsEqual(e,t){return e==null&&t==null?!0:e!=null&&t!=null&&c0(e.values,t.values)}setParams(e){this.applyExcelModeOptions(e),super.setParams(e),this.updateSetFilterOnParamsChange(e);const t=e.keyCreator??e.colDef.keyCreator;this.valueModel=new U0({filterParams:e,setIsLoading:s=>this.setIsLoading(s),translate:s=>this.translateForSetFilter(s),caseFormat:s=>this.caseFormat(s),createKey:this.createKey,valueFormatter:this.valueFormatter,usingComplexObjects:!!t,gos:this.gos,funcColsService:this.funcColsService,valueService:this.valueService,treeDataTreeList:this.treeDataTreeList,groupingTreeList:this.groupingTreeList,addManagedEventListeners:s=>this.addManagedEventListeners(s)}),this.initialiseFilterBodyUi(),this.addEventListenersForDataChanges()}onAddCurrentSelectionToFilterChange(e){if(!this.valueModel)throw new Error("Value model has not been created.");this.valueModel.setAddCurrentSelectionToFilter(e)}setValueFormatter(e,t,s,i){let r=e;if(!r){if(t&&!s)throw new Error("AG Grid: Must supply a Value Formatter in Set Filter params when using a Key Creator");this.noValueFormatterSupplied=!0,i||(r=a=>To(a.value))}this.valueFormatter=r}generateCreateKey(e,t){if(t&&!e)throw new Error("AG Grid: Must supply a Key Creator in Set Filter params when `treeList = true` on a group column, and Tree Data or Row Grouping is enabled.");return e?(s,i=null)=>{const r=this.getKeyCreatorParams(s,i);return Ld(e(r))}:s=>Ld(To(s))}getFormattedValue(e){let t=this.valueModel.getValue(e);this.noValueFormatterSupplied&&(this.treeDataTreeList||this.groupingTreeList)&&Array.isArray(t)&&(t=d0(t));const s=this.valueService.formatValue(this.setFilterParams.column,null,t,this.valueFormatter,!1);return s??To(t)??this.translateForSetFilter("blanks")}applyExcelModeOptions(e){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,u0('The Set Filter Parameter "defaultToNothingSelected" value was ignored because it does not work when "excelMode" is used.'))}addEventListenersForDataChanges(){this.isValuesTakenFromGrid()&&(this.addManagedEventListeners({cellValueChanged:e=>{this.setFilterParams&&e.column===this.setFilterParams.column&&this.syncAfterDataChange()}}),this.addManagedPropertyListeners(["treeData","getDataPath","groupAllowUnbalanced"],()=>{this.syncAfterDataChange()}))}syncAfterDataChange(){if(!this.valueModel)throw new Error("Value model has not been created.");return this.valueModel.refreshValues().then(()=>{this.checkAndRefreshVirtualList(),(!this.applyActive||this.areModelsEqual(this.getModel(),this.getModelFromUi()))&&this.onBtApply(!1,!0)})}setIsLoading(e){Po(this.eFilterLoading,e),e||(this.hardRefreshVirtualList=!0)}initialiseFilterBodyUi(){this.initVirtualList(),this.initMiniFilter()}initVirtualList(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const t=this.localeService.getLocaleTextFunc()("ariaFilterList","Filter List"),s=!!this.setFilterParams.treeList,i=this.virtualList=this.createBean(new Ge({cssIdentifier:"filter",ariaRole:s?"tree":"listbox",listName:t})),r=this.eSetFilterList;s&&r.classList.add("ag-set-filter-tree-list"),r&&r.appendChild(i.getGui());const{cellHeight:a}=this.setFilterParams;a!=null&&i.setRowHeight(a);const o=(l,c)=>this.createSetListItem(l,s,c);i.setComponentCreator(o);const n=(l,c)=>this.updateSetListItem(l,c);i.setComponentUpdater(n),this.createVirtualListModel(this.setFilterParams)}createVirtualListModel(e){if(!this.valueModel)return;let t;e.suppressSelectAll?t=new H0(this.valueModel):t=new z0(this.valueModel,()=>this.isSelectAllSelected()),e.treeList&&(t=new W0(t)),this.virtualList?.setModel(t)}getSelectAllLabel(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const e=this.valueModel.getMiniFilter()==null||!this.setFilterParams.excelMode?"selectAll":"selectAllSearchResults";return this.translateForSetFilter(e)}getAddSelectionToFilterLabel(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");return this.translateForSetFilter("addCurrentSelectionToFilter")}createSetListItem(e,t,s){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const i=this.valueModel.hasGroups(),{isSelected:r,isExpanded:a}=this.isSelectedExpanded(e),{value:o,depth:n,isGroup:l,hasIndeterminateExpandState:c,selectedListener:h,expandedListener:d}=this.newSetListItemAttributes(e),u={focusWrapper:s,value:o,params:this.setFilterParams,translate:g=>this.translateForSetFilter(g),valueFormatter:this.valueFormatter,item:e,isSelected:r,isTree:t,depth:n,groupsExist:i,isGroup:l,isExpanded:a,hasIndeterminateExpandState:c},p=this.createBean(new O0(u));return p.addEventListener("selectionChanged",h),d&&p.addEventListener("expandedChanged",d),p}newSetTreeItemAttributes(e){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const t=this.valueModel.hasGroups();return e.key===J.SELECT_ALL?{value:()=>this.getSelectAllLabel(),isGroup:t,depth:e.depth,hasIndeterminateExpandState:!0,selectedListener:s=>this.onSelectAll(s.isSelected),expandedListener:s=>this.onExpandAll(s.item,s.isExpanded)}:e.key===J.ADD_SELECTION_TO_FILTER?{value:()=>this.getAddSelectionToFilterLabel(),depth:e.depth,isGroup:!1,hasIndeterminateExpandState:!1,selectedListener:s=>{this.onAddCurrentSelectionToFilterChange(s.isSelected)}}:e.children?{value:this.setFilterParams.treeListFormatter?.(e.treeKey,e.depth,e.parentTreeKeys)??e.treeKey,depth:e.depth,isGroup:!0,selectedListener:s=>this.onGroupItemSelected(s.item,s.isSelected),expandedListener:s=>this.onExpandedChanged(s.item,s.isExpanded)}:{value:this.setFilterParams.treeListFormatter?.(e.treeKey,e.depth,e.parentTreeKeys)??e.treeKey,depth:e.depth,selectedListener:s=>this.onItemSelected(s.item.key,s.isSelected)}}newSetListItemAttributes(e){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");return this.isSetFilterModelTreeItem(e)?this.newSetTreeItemAttributes(e):e===J.SELECT_ALL?{value:()=>this.getSelectAllLabel(),selectedListener:t=>this.onSelectAll(t.isSelected)}:e===J.ADD_SELECTION_TO_FILTER?{value:()=>this.getAddSelectionToFilterLabel(),selectedListener:t=>{this.onAddCurrentSelectionToFilterChange(t.isSelected)}}:{value:this.valueModel.getValue(e),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;return this.isSetFilterModelTreeItem(e)?(s=e.expanded,e.key===J.SELECT_ALL?t=this.isSelectAllSelected():e.key===J.ADD_SELECTION_TO_FILTER?t=this.valueModel.isAddCurrentSelectionToFilterChecked():e.children?t=this.areAllChildrenSelected(e):t=this.valueModel.isKeySelected(e.key)):e===J.SELECT_ALL?t=this.isSelectAllSelected():e===J.ADD_SELECTION_TO_FILTER?t=this.valueModel.isAddCurrentSelectionToFilterChecked():t=this.valueModel.isKeySelected(e),{isSelected:t,isExpanded:s}}isSetFilterModelTreeItem(e){return e?.treeKey!==void 0}initMiniFilter(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const{eMiniFilter:e,localeService:t}=this,s=t.getLocaleTextFunc();e.setDisplayed(!this.setFilterParams.suppressMiniFilter),e.setValue(this.valueModel.getMiniFilter()),e.onValueChange(()=>this.onMiniFilterInput()),e.setInputAriaLabel(s("ariaSearchFilterValues","Search filter values")),this.addManagedElementListeners(e.getInputElement(),{keydown:i=>this.onMiniFilterKeyDown(i)})}updateMiniFilter(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const{eMiniFilter:e}=this;e.isDisplayed()!==!this.setFilterParams.suppressMiniFilter&&e.setDisplayed(!this.setFilterParams.suppressMiniFilter);const t=this.valueModel.getMiniFilter();e.getValue()!==t&&e.setValue(t)}afterGuiAttached(e){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");super.afterGuiAttached(e),this.resetExpansion(),this.refreshVirtualList();const{eMiniFilter:t}=this;t.setInputPlaceholder(this.translateForSetFilter("searchOoo")),(!e||!e.suppressFocus)&&(t.isDisplayed()?t.getFocusableElement().focus():this.virtualList?.awaitStable(()=>this.virtualList?.focusRow(0)))}afterGuiDetached(){super.afterGuiDetached(),this.setFilterParams?.excelMode&&this.resetMiniFilter();const e=this.getModel();(this.setFilterParams?.excelMode||!this.areModelsEqual(e,this.getModelFromUi()))&&(this.resetUiToActiveModel(e),this.showOrHideResults())}applyModel(e="api"){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");this.setFilterParams.excelMode&&e!=="rowDataUpdated"&&this.valueModel.isEverythingVisibleSelected()&&this.valueModel.selectAllMatchingMiniFilter();const t=this.valueModel.showAddCurrentSelectionToFilter()&&this.valueModel.isAddCurrentSelectionToFilterChecked();if(t&&!this.getModel())return!1;const s=super.applyModel(e),i=this.getModel();return i?(t||this.valueModel.setAppliedModelKeys(new Set),i.values.forEach(r=>{this.valueModel.addToAppliedModelKeys(r)})):t||this.valueModel.setAppliedModelKeys(null),s}isModelValid(e){return this.setFilterParams&&this.setFilterParams.excelMode?e==null||e.values.length>0:!0}doesFilterPass(e){if(!this.setFilterParams||!this.valueModel||!this.valueModel.getCaseFormattedAppliedModelKeys())return!0;if(!this.valueModel.hasAnyAppliedModelKey())return!1;const{node:t,data:s}=e;if(this.treeDataTreeList)return this.doesFilterPassForTreeData(t,s);if(this.groupingTreeList)return this.doesFilterPassForGrouping(t);const i=this.getValueFromNode(t);return i!=null&&Array.isArray(i)?i.length===0?this.valueModel.hasAppliedModelKey(null):i.some(r=>this.isInAppliedModel(this.createKey(r,t))):this.isInAppliedModel(this.createKey(i,t))}doesFilterPassForTreeData(e,t){return e.childrenAfterGroup?.length?!1:this.isInAppliedModel(this.createKey(Eo(this.getDataPath(t),!0,this.gos.get("groupAllowUnbalanced"))))}doesFilterPassForGrouping(e){const t=this.funcColsService.getRowGroupColumns().map(s=>this.valueService.getKeyForNode(s,e));return t.push(this.getValueFromNode(e)),this.isInAppliedModel(this.createKey(Eo(t,!1,this.gos.get("groupAllowUnbalanced"))))}isInAppliedModel(e){return this.valueModel.hasAppliedModelKey(e)}getValueFromNode(e){return this.setFilterParams.getValue(e)}getKeyCreatorParams(e,t=null){return{value:e,colDef:this.setFilterParams.colDef,column:this.setFilterParams.column,node:t,data:t?.data,api:this.setFilterParams.api,context:this.setFilterParams.context}}onNewRowsLoaded(){this.isValuesTakenFromGrid()&&this.syncAfterDataChange()}isValuesTakenFromGrid(){return this.valueModel?this.valueModel.getValuesType()===2:!1}setFilterValues(e){if(!this.valueModel)throw new Error("Value model has not been created.");this.valueModel.overrideValues(e).then(()=>{this.checkAndRefreshVirtualList(),this.onUiChanged()})}resetFilterValues(){if(!this.valueModel)throw new Error("Value model has not been created.");this.valueModel.setValuesType(2),this.syncAfterDataChange()}refreshFilterValues(){if(!this.valueModel)throw new Error("Value model has not been created.");this.valueModel.isInitialised()&&this.valueModel.refreshValues().then(()=>{this.hardRefreshVirtualList=!0,this.checkAndRefreshVirtualList(),this.onUiChanged()})}onAnyFilterChanged(){setTimeout(()=>{if(this.isAlive()){if(!this.valueModel)throw new Error("Value model has not been created.");this.valueModel.refreshAfterAnyFilterChanged().then(e=>{e&&(this.checkAndRefreshVirtualList(),this.showOrHideResults())})}},0)}onMiniFilterInput(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");if(!this.valueModel.setMiniFilter(this.eMiniFilter.getValue()))return;const{applyMiniFilterWhileTyping:e,readOnly:t}=this.setFilterParams||{};!t&&e?this.filterOnAllVisibleValues(!1):this.updateUiAfterMiniFilterChange()}updateUiAfterMiniFilterChange(){if(!this.setFilterParams)throw new Error("Set filter params have not been provided.");if(!this.valueModel)throw new Error("Value model has not been created.");const{excelMode:e,readOnly:t}=this.setFilterParams||{};e==null||t?this.checkAndRefreshVirtualList():this.valueModel.getMiniFilter()==null?this.resetUiToActiveModel(this.getModel()):(this.valueModel.selectAllMatchingMiniFilter(!0),this.checkAndRefreshVirtualList(),this.onUiChanged()),this.showOrHideResults()}showOrHideResults(){if(!this.valueModel)throw new Error("Value model has not been created.");const e=this.valueModel.getMiniFilter()!=null&&this.valueModel.getDisplayedValueCount()<1;Po(this.eFilterNoMatches,e),Po(this.eSetFilterList,!e)}resetMiniFilter(){this.eMiniFilter.setValue(null,!0),this.valueModel?.setMiniFilter(null)}resetUiToActiveModel(e,t){this.setModelAndRefresh(e==null?null:e.values).then(()=>{this.onUiChanged(!1,"prevent"),t?.()})}handleCancelEnd(e){this.setMiniFilter(null),super.handleCancelEnd(e)}onMiniFilterKeyDown(e){const{excelMode:t,readOnly:s}=this.setFilterParams||{};e.key===ws.ENTER&&!t&&!s&&this.filterOnAllVisibleValues()}filterOnAllVisibleValues(e=!0){const{readOnly:t}=this.setFilterParams||{};if(!this.valueModel)throw new Error("Value model has not been created.");if(t)throw new Error("Unable to filter in readOnly mode.");this.valueModel.selectAllMatchingMiniFilter(!0),this.checkAndRefreshVirtualList(),this.onUiChanged(!1,e?"immediately":"debounce"),this.showOrHideResults()}focusRowIfAlive(e){e!=null&&window.setTimeout(()=>{if(!this.virtualList)throw new Error("Virtual list has not been created.");this.isAlive()&&this.virtualList.focusRow(e)},0)}onSelectAll(e){if(!this.valueModel)throw new Error("Value model has not been created.");if(!this.virtualList)throw new Error("Virtual list has not been created.");e?this.valueModel.selectAllMatchingMiniFilter():this.valueModel.deselectAllMatchingMiniFilter(),this.refreshAfterSelection()}onGroupItemSelected(e,t){const s=i=>{i.children?i.children.forEach(r=>s(r)):this.selectItem(i.key,t)};s(e),this.refreshAfterSelection()}onItemSelected(e,t){if(!this.valueModel)throw new Error("Value model has not been created.");if(!this.virtualList)throw new Error("Virtual list has not been created.");this.selectItem(e,t),this.refreshAfterSelection()}selectItem(e,t){t?this.valueModel.selectKey(e):this.valueModel.deselectKey(e)}onExpandAll(e,t){const s=i=>{i.filterPasses&&i.available&&i.children&&(i.children.forEach(r=>s(r)),i.expanded=t)};s(e),this.refreshAfterExpansion()}onExpandedChanged(e,t){e.expanded=t,this.refreshAfterExpansion()}refreshAfterExpansion(){const e=this.virtualList.getLastFocusedRow();this.valueModel.updateDisplayedValues("expansion"),this.checkAndRefreshVirtualList(),this.focusRowIfAlive(e)}refreshAfterSelection(){const e=this.virtualList.getLastFocusedRow();this.checkAndRefreshVirtualList(),this.onUiChanged(),this.focusRowIfAlive(e)}setMiniFilter(e){this.eMiniFilter.setValue(e),this.onMiniFilterInput()}getMiniFilter(){return this.valueModel?this.valueModel.getMiniFilter():null}checkAndRefreshVirtualList(){if(!this.virtualList)throw new Error("Virtual list has not been created.");this.virtualList.refresh(!this.hardRefreshVirtualList),this.hardRefreshVirtualList&&(this.hardRefreshVirtualList=!1)}getFilterKeys(){return this.valueModel?this.valueModel.getKeys():[]}getFilterValues(){return this.valueModel?this.valueModel.getValues():[]}getValues(){return this.getFilterKeys()}refreshVirtualList(){this.setFilterParams&&this.setFilterParams.refreshValuesOnOpen?this.refreshFilterValues():this.checkAndRefreshVirtualList()}translateForSetFilter(e){return this.localeService.getLocaleTextFunc()(e,G0[e])}isSelectAllSelected(){if(!this.setFilterParams||!this.valueModel)return!1;if(this.setFilterParams.defaultToNothingSelected){if(this.valueModel.hasSelections()&&this.valueModel.isEverythingVisibleSelected())return!0;if(this.valueModel.isNothingVisibleSelected())return!1}else{if(this.valueModel.hasSelections()&&this.valueModel.isNothingVisibleSelected())return!1;if(this.valueModel.isEverythingVisibleSelected())return!0}}areAllChildrenSelected(e){const t=s=>{if(s.children){let i=!1,r=!1;return s.children.some(o=>{if(!o.filterPasses||!o.available)return!1;const n=t(o);return n===void 0?!0:(n?i=!0:r=!0,i&&r)})?void 0:i}else return this.valueModel.isKeySelected(s.key)};return this.setFilterParams.defaultToNothingSelected?this.valueModel.hasSelections()&&t(e):t(e)}destroy(){this.virtualList!=null&&(this.virtualList.destroy(),this.virtualList=null),super.destroy()}caseFormat(e){return e==null||typeof e!="string"||this.caseSensitive?e:e.toUpperCase()}resetExpansion(){if(!this.setFilterParams?.treeList)return;const e=this.valueModel?.getSelectAllItem();if(this.isSetFilterModelTreeItem(e)){const t=s=>{s.children&&(s.children.forEach(i=>t(i)),s.expanded=!1)};t(e),this.valueModel.updateDisplayedValues("expansion")}}getModelAsString(e){return this.filterModelFormatter.getModelAsString(e,this)}getPositionableElement(){return this.eSetFilterList}},H0=class{constructor(e){this.model=e}getRowCount(){return this.model.getDisplayedValueCount()}getRow(e){return this.model.getDisplayedItem(e)}areRowsEqual(e,t){return e===t}},z0=class{constructor(e,t){this.model=e,this.isSelectAllSelected=t}getRowCount(){const t=this.model.showAddCurrentSelectionToFilter()?2:1;return this.model.getDisplayedValueCount()+t}getRow(e){if(e===0)return this.model.getSelectAllItem();const t=this.model.showAddCurrentSelectionToFilter(),s=t?2:1;return e===1&&t?this.model.getAddSelectionToFilterItem():this.model.getDisplayedItem(e-s)}areRowsEqual(e,t){return e===t}},W0=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!=null&&t!=null&&e.treeKey===t.treeKey&&e.depth===t.depth}},K0=class extends L0{constructor(){super(`
414
414
  <div class="ag-floating-filter-input ag-set-floating-filter-input" role="presentation">
415
415
  <ag-input-text-field data-ref="eFloatingFilterText"></ag-input-text-field>
416
- </div>`,[D0]),this.eFloatingFilterText=k0,this.availableValuesListenerAdded=!1,this.filterModelFormatter=new Od}wireBeans(e){this.columnNameService=e.columnNameService}destroy(){super.destroy()}init(e){this.params=e,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(e)}setParams(e){const t=this.columnNameService.getDisplayNameForColumn(e.column,"header",!0),s=this.localeService.getLocaleTextFunc();this.eFloatingFilterText.setInputAriaLabel(`${t} ${s("ariaFilterInput","Filter Input")}`)}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e,this.setParams(e)}onParentModelChanged(e){this.updateFloatingFilterText(e)}parentSetFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof Li))throw new Error("AG Grid - SetFloatingFilter expects SetFilter as its parent");e(t)})}addAvailableValuesListener(){this.parentSetFilterInstance(e=>{const t=e.getValueModel();t&&this.addManagedListeners(t,{availableValuesChanged:()=>this.updateFloatingFilterText()})}),this.availableValuesListenerAdded=!0}updateFloatingFilterText(e){this.availableValuesListenerAdded||this.addAvailableValuesListener(),this.parentSetFilterInstance(t=>{this.eFloatingFilterText.setValue(this.filterModelFormatter.getModelAsString(e,t))})}},Io="32.3.2",Nd=bo({version:Io,moduleName:`${Id.SetFilterModule}-core`,userComponents:[{name:"agSetColumnFilter",classImp:Li}],dependantModules:[H,r0]}),$0=bo({version:Io,moduleName:"@ag-grid-enterprise/set-floating-filter",userComponents:[{name:"agSetColumnFloatingFilter",classImp:K0}],dependantModules:[Nd,a0]}),Do=bo({version:Io,moduleName:Id.SetFilterModule,dependantModules:[Nd,$0]});import{ModuleNames as j0,_defineModule as Y0}from"ag-grid-community";import{Component as q0,RefPlaceholder as X0}from"ag-grid-community";import{_warnOnce as Vd}from"ag-grid-community";import{_Util as _d}from"ag-charts-community";import{_Scale as Z0,_Scene as qe,_Util as J0}from"ag-charts-community";import{_warnOnce as Q0}from"ag-grid-community";import{_Scene as ki}from"ag-charts-community";import{_errorOnce as ek}from"ag-grid-community";import{_Scale as tk,_Scene as Lo,_Util as sk}from"ag-charts-community";import{_ModuleSupport as ik,_Scale as rk,_Util as ak}from"ag-charts-community";import{_Scene as De,_Util as ok}from"ag-charts-community";import{_ModuleSupport as nk,_Scale as lk,_Util as ck}from"ag-charts-community";import{_Scale as hk,_Scene as Pt,_Util as dk}from"ag-charts-community";import{BeanStub as uk}from"ag-grid-community";function Gi(e,t="solid"){const s={solid:[],dash:[4,3],dot:[1,3],dashDot:[4,3,1,3],dashDotDot:[4,3,1,3,1,3],shortDot:[1,1],shortDash:[3,1],shortDashDot:[3,1,1,1],shortDashDotDot:[3,1,1,1,1,1],longDash:[8,3],longDashDot:[8,3,1,3],longDashDotDot:[8,3,1,3,1,3]},i={solid:[],dash:[3,3],dot:[0,3],dashDot:[3,3,0,3],dashDotDot:[3,3,0,3,0,3],shortDot:[0,2],shortDash:[2,2],shortDashDot:[2,2,0,2],shortDashDotDot:[2,2,0,2,0,2],longDash:[7,3],longDashDot:[7,3,0,3],longDashDotDot:[7,3,0,3,0,3]};return e==="round"||e==="square"?i[t]==null?(Ud(t),i.solid):i[t]:s[t]==null?(Ud(t),s.solid):s[t]}function Ud(e){Q0(`'${e}' is not a valid 'lineDash' option.`)}function Hd(e){switch(e){case"circle":return ki.Circle;case"square":return ki.Square;case"diamond":return ki.Diamond;default:return ki.Circle}}var pk=`
416
+ </div>`,[D0]),this.eFloatingFilterText=k0,this.availableValuesListenerAdded=!1,this.filterModelFormatter=new Od}wireBeans(e){this.columnNameService=e.columnNameService}destroy(){super.destroy()}init(e){this.params=e,this.eFloatingFilterText.setDisabled(!0).addGuiEventListener("click",()=>this.params.showParentFilter()),this.setParams(e)}setParams(e){const t=this.columnNameService.getDisplayNameForColumn(e.column,"header",!0),s=this.localeService.getLocaleTextFunc();this.eFloatingFilterText.setInputAriaLabel(`${t} ${s("ariaFilterInput","Filter Input")}`)}onParamsUpdated(e){this.refresh(e)}refresh(e){this.params=e,this.setParams(e)}onParentModelChanged(e){this.updateFloatingFilterText(e)}parentSetFilterInstance(e){this.params.parentFilterInstance(t=>{if(!(t instanceof Li))throw new Error("AG Grid - SetFloatingFilter expects SetFilter as its parent");e(t)})}addAvailableValuesListener(){this.parentSetFilterInstance(e=>{const t=e.getValueModel();t&&this.addManagedListeners(t,{availableValuesChanged:()=>this.updateFloatingFilterText()})}),this.availableValuesListenerAdded=!0}updateFloatingFilterText(e){this.availableValuesListenerAdded||this.addAvailableValuesListener(),this.parentSetFilterInstance(t=>{this.eFloatingFilterText.setValue(this.filterModelFormatter.getModelAsString(e,t))})}},Io="32.3.3",Nd=bo({version:Io,moduleName:`${Id.SetFilterModule}-core`,userComponents:[{name:"agSetColumnFilter",classImp:Li}],dependantModules:[H,r0]}),$0=bo({version:Io,moduleName:"@ag-grid-enterprise/set-floating-filter",userComponents:[{name:"agSetColumnFloatingFilter",classImp:K0}],dependantModules:[Nd,a0]}),Do=bo({version:Io,moduleName:Id.SetFilterModule,dependantModules:[Nd,$0]});import{ModuleNames as j0,_defineModule as Y0}from"ag-grid-community";import{Component as q0,RefPlaceholder as X0}from"ag-grid-community";import{_warnOnce as Vd}from"ag-grid-community";import{_Util as _d}from"ag-charts-community";import{_Scale as Z0,_Scene as qe,_Util as J0}from"ag-charts-community";import{_warnOnce as Q0}from"ag-grid-community";import{_Scene as ki}from"ag-charts-community";import{_errorOnce as ek}from"ag-grid-community";import{_Scale as tk,_Scene as Lo,_Util as sk}from"ag-charts-community";import{_ModuleSupport as ik,_Scale as rk,_Util as ak}from"ag-charts-community";import{_Scene as De,_Util as ok}from"ag-charts-community";import{_ModuleSupport as nk,_Scale as lk,_Util as ck}from"ag-charts-community";import{_Scale as hk,_Scene as Pt,_Util as dk}from"ag-charts-community";import{BeanStub as uk}from"ag-grid-community";function Gi(e,t="solid"){const s={solid:[],dash:[4,3],dot:[1,3],dashDot:[4,3,1,3],dashDotDot:[4,3,1,3,1,3],shortDot:[1,1],shortDash:[3,1],shortDashDot:[3,1,1,1],shortDashDotDot:[3,1,1,1,1,1],longDash:[8,3],longDashDot:[8,3,1,3],longDashDotDot:[8,3,1,3,1,3]},i={solid:[],dash:[3,3],dot:[0,3],dashDot:[3,3,0,3],dashDotDot:[3,3,0,3,0,3],shortDot:[0,2],shortDash:[2,2],shortDashDot:[2,2,0,2],shortDashDotDot:[2,2,0,2,0,2],longDash:[7,3],longDashDot:[7,3,0,3],longDashDotDot:[7,3,0,3,0,3]};return e==="round"||e==="square"?i[t]==null?(Ud(t),i.solid):i[t]:s[t]==null?(Ud(t),s.solid):s[t]}function Ud(e){Q0(`'${e}' is not a valid 'lineDash' option.`)}function Hd(e){switch(e){case"circle":return ki.Circle;case"square":return ki.Square;case"diamond":return ki.Diamond;default:return ki.Circle}}var pk=`
417
417
  .ag-sparkline-tooltip-wrapper {
418
418
  position: absolute;
419
419
  user-select: none;
@@ -456,7 +456,7 @@ Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromInd
456
456
  ${l}
457
457
  </div>`}var Le="ag-sparkline-tooltip",xk=class{constructor(){this.created=!1,this.element=document.createElement("div")}isVisible(){const{element:e}=this;if(e.classList)return!e.classList.contains(`${Le}-wrapper-hidden`);const t=e.getAttribute("class");return t?t.split(" ").indexOf(`${Le}-wrapper-hidden`)<0:!1}updateClass(e){this.created||(document.body.appendChild(this.element),this.created=!0);const t=[`${Le}-wrapper`];e!==!0&&t.push(`${Le}-wrapper-hidden`),this.element.setAttribute("class",t.join(" "))}show(e,t){this.toggle(!1);const{element:s}=this;if(t!==void 0)s.innerHTML=t;else if(!s.innerHTML)return;const i=e.position?.xOffset??10,r=e.position?.yOffset??0;let a=e.pageX+i,o=e.pageY+r;const n=s.getBoundingClientRect();let l=window.innerWidth-n.width;if(e.container){const c=e.container.getBoundingClientRect();l=c.left+(c.width-n.width)}a>l&&(a=e.pageX-s.clientWidth-i),typeof scrollX<"u"&&(a+=scrollX),typeof scrollY<"u"&&(o+=scrollY),s.style.left=`${Math.round(a)}px`,s.style.top=`${Math.round(o)}px`,this.toggle(!0)}toggle(e){this.updateClass(e)}destroy(){const{parentNode:e}=this.element;e&&e.removeChild(this.element)}},{extent:bk}=J0,{BandScale:Pk}=Z0,Tk=class{constructor(){this.enabled=!0,this.shape="circle",this.size=0,this.fill="rgb(124, 181, 236)",this.stroke="rgb(124, 181, 236)",this.strokeWidth=1,this.formatter=void 0}},Mk=class{constructor(){this.stroke="rgb(124, 181, 236)",this.strokeWidth=1}},Fk=class{constructor(){this.xLine={enabled:!0,stroke:"rgba(0,0,0, 0.54)",strokeWidth:1,lineDash:"solid",lineCap:void 0},this.yLine={enabled:!1,stroke:"rgba(0,0,0, 0.54)",strokeWidth:1,lineDash:"solid",lineCap:void 0}}},Ak=class extends Go{constructor(){super(),this.fill="rgba(124, 181, 236, 0.25)",this.strokePath=new qe.Path,this.fillPath=new qe.Path,this.xCrosshairLine=new qe.Line,this.yCrosshairLine=new qe.Line,this.areaSparklineGroup=new qe.Group,this.xAxisLine=new qe.Line,this.markers=new qe.Group,this.markerSelection=qe.Selection.select(this.markers,()=>this.markerFactory()),this.markerSelectionData=[],this.marker=new Tk,this.line=new Mk,this.crosshairs=new Fk,this.rootGroup.append(this.areaSparklineGroup),this.xAxisLine.zIndex=500,this.fillPath.zIndex=50,this.strokePath.zIndex=1e3,this.xCrosshairLine.zIndex=2e3,this.yCrosshairLine.zIndex=2e3,this.markers.zIndex=2500,this.areaSparklineGroup.append([this.fillPath,this.xAxisLine,this.strokePath,this.xCrosshairLine,this.yCrosshairLine,this.markers])}markerFactory(){const{shape:e}=this.marker,t=Hd(e);return new t}getNodeData(){return this.markerSelectionData}update(){const e=this.generateNodeData();if(!e)return;const{nodeData:t,fillData:s,strokeData:i}=e;this.markerSelectionData=t,this.updateSelection(t),this.updateNodes(),this.updateStroke(i),this.updateFill(s)}updateYScaleDomain(){const{yData:e,yScale:t}=this,s=bk(e);let i=0,r=1;s!=null&&(i=this.min=s[0],r=this.max=s[1]),i=i<0?i:0,r=r<0?0:r,t.domain=[i,r]}generateNodeData(){const{data:e,yData:t,xData:s,xScale:i,yScale:r}=this;if(!e)return;const a=!(i instanceof Pk),o=a?0:i.bandwidth/2,n=t.length,l=[],c=[],h=[];let d,u,p,g;const m=r.convert(0);for(let C=0;C<n;C++){const f=t[C],v=s[C],S=i.convert(a?i.toDomain(v):v)+o,y=f===void 0?NaN:r.convert(f);C+1<n&&(g=i.convert(a?i.toDomain(s[C+1]):s[C+1])+o),h.push({seriesDatum:{x:v,y:f},point:{x:S,y}}),f===void 0&&p!==void 0?(c.push({seriesDatum:void 0,point:{x:p,y:m}}),g!==void 0&&c.push({seriesDatum:void 0,point:{x:g,y:m}})):f!==void 0&&(c.push({seriesDatum:{x:v,y:f},point:{x:S,y}}),l.push({seriesDatum:{x:v,y:f},point:{x:S,y}}),d=d!==void 0?d:S,u=S),p=S}return c.push({seriesDatum:void 0,point:{x:u,y:m}},{seriesDatum:void 0,point:{x:d,y:m}}),{nodeData:l,fillData:c,strokeData:h}}updateAxisLine(){const{xScale:e,yScale:t,axis:{stroke:s,strokeWidth:i},xAxisLine:r}=this,a=t.convert(0);r.x1=e.range[0],r.x2=e.range[1],r.y1=r.y2=a,r.stroke=s,r.strokeWidth=i}updateSelection(e){this.markerSelection.update(e)}updateNodes(){const{highlightedDatum:e,highlightStyle:t,marker:s}=this,{size:i,fill:r,stroke:a,strokeWidth:o}=t,n=s.formatter;this.markerSelection.each((l,c,h)=>{const{point:d,seriesDatum:u}=c;if(!d)return;const p=c===e,g=p&&r!==void 0?r:s.fill,m=p&&a!==void 0?a:s.stroke,C=p&&o!==void 0?o:s.strokeWidth,f=p&&i!==void 0?i:s.size;let v;if(n){const S=h===0,y=h===this.markerSelectionData.length-1,w=u.y===this.min,b=u.y===this.max;v=n({datum:c,xValue:u.x,yValue:u.y,min:w,max:b,first:S,last:y,fill:g,stroke:m,strokeWidth:C,size:f,highlighted:p})}l.size=v&&v.size!=null?v.size:f,l.fill=v&&v.fill!=null?v.fill:g,l.stroke=v&&v.stroke!=null?v.stroke:m,l.strokeWidth=v&&v.strokeWidth!=null?v.strokeWidth:C,l.translationX=d.x,l.translationY=d.y,l.visible=v&&v.enabled!=null?v.enabled:s.enabled&&l.size>0})}updateStroke(e){const{strokePath:t,yData:s,line:i}=this,r=t.path;if(r.clear(),s.length<2)return;const a=e.length;let o=!0;for(let n=0;n<a;n++){const{point:l,seriesDatum:c}=e[n],h=l.x,d=l.y;c.y==null?o=!0:o?(r.moveTo(h,d),o=!1):r.lineTo(h,d)}t.lineJoin=t.lineCap="round",t.fill=void 0,t.stroke=i.stroke,t.strokeWidth=i.strokeWidth}updateFill(e){const{fillPath:t,yData:s,fill:i}=this,r=t.path,a=e.length;if(r.clear(),!(s.length<2)){for(let o=0;o<a;o++){const{point:n}=e[o],l=n.x,c=n.y;o>0?r.lineTo(l,c):r.moveTo(l,c)}r.closePath(),t.lineJoin="round",t.stroke=void 0,t.fill=i}}updateXCrosshairLine(){const{yScale:e,xCrosshairLine:t,highlightedDatum:s,crosshairs:{xLine:i}}=this;if(!i.enabled||s==null){t.strokeWidth=0;return}t.y1=e.range[0],t.y2=e.range[1],t.x1=t.x2=s.point.x,t.stroke=i.stroke,t.strokeWidth=i.strokeWidth??1,t.lineCap=i.lineCap==="round"||i.lineCap==="square"?i.lineCap:void 0;const{lineDash:r}=i;t.lineDash=Array.isArray(r)?r:Gi(t.lineCap,i.lineDash)}updateYCrosshairLine(){const{xScale:e,yCrosshairLine:t,highlightedDatum:s,crosshairs:{yLine:i}}=this;if(!i.enabled||s==null){t.strokeWidth=0;return}t.x1=e.range[0],t.x2=e.range[1],t.y1=t.y2=s.point.y,t.stroke=i.stroke,t.strokeWidth=i.strokeWidth??1,t.lineCap=i.lineCap==="round"||i.lineCap==="square"?i.lineCap:void 0;const{lineDash:r}=i;t.lineDash=Array.isArray(r)?r:Gi(t.lineCap,i.lineDash)}getTooltipHtml(e){const{dataType:t}=this,{seriesDatum:s}=e,i=s.y,r=s.x,a=this.formatNumericDatum(i),o=t==="array"||t==="object"?this.formatDatum(r):void 0,n={content:a,title:o},l=this.processedOptions?.tooltip?.renderer;return l?Tt(l({context:this.context,datum:s,yValue:i,xValue:r}),n):Tt(n)}},Rk=class{constructor(){this.enabled=!0,this.fontSize=8,this.fontFamily="Verdana, sans-serif",this.fontStyle=void 0,this.fontWeight=void 0,this.color="rgba(70, 70, 70, 1)"}},{extent:Ek}=ok,Ik=class extends Rk{constructor(){super(...arguments),this.formatter=void 0,this.placement="insideEnd"}},$d=class extends Go{constructor(){super(),this.fill="rgb(124, 181, 236)",this.stroke="silver",this.strokeWidth=0,this.paddingInner=.1,this.paddingOuter=.2,this.valueAxisDomain=void 0,this.formatter=void 0,this.axisLine=new De.Line,this.bandWidth=0,this.sparklineGroup=new De.Group,this.rectGroup=new De.Group,this.labelGroup=new De.Group,this.rectSelection=De.Selection.select(this.rectGroup,De.Rect),this.labelSelection=De.Selection.select(this.labelGroup,De.Text),this.nodeSelectionData=[],this.label=new Ik,this.rootGroup.append(this.sparklineGroup),this.rectGroup.zIndex=50,this.axisLine.zIndex=500,this.labelGroup.zIndex=1500,this.sparklineGroup.append([this.rectGroup,this.axisLine,this.labelGroup]),this.axisLine.lineCap="round",this.label.enabled=!1}getNodeData(){return this.nodeSelectionData}update(){this.updateSelections(),this.updateNodes()}updateSelections(){const e=this.generateNodeData();e&&(this.nodeSelectionData=e,this.updateRectSelection(e),this.updateLabelSelection(e))}updateNodes(){this.updateRectNodes(),this.updateLabelNodes()}calculateStep(e){const{xScale:t,paddingInner:s,paddingOuter:i,smallestInterval:r}=this,o=(t.domain[1]-t.domain[0])/(r?.x??1)+1,l=Math.min(o,50),c=l-1;return e/Math.max(1,2*i+c*s+l)}updateYScaleDomain(){const{yScale:e,yData:t,valueAxisDomain:s}=this,i=Ek(t);let r=0,a=1;i!=null&&(r=this.min=i[0],a=this.max=i[1]),r=r<0?r:0,a=a<0?0:a,s&&(s[1]<a&&(s[1]=a),s[0]>r&&(s[0]=r)),e.domain=s||[r,a]}updateRectSelection(e){this.rectSelection.update(e)}updateRectNodes(){const{highlightedDatum:e,formatter:t,fill:s,stroke:i,strokeWidth:r}=this,{fill:a,stroke:o,strokeWidth:n}=this.highlightStyle;this.rectSelection.each((l,c,h)=>{const d=c===e,u=d&&a!==void 0?a:s,p=d&&o!==void 0?o:i,g=d&&n!==void 0?n:r;let m;const{x:C,y:f,width:v,height:S,seriesDatum:y}=c;if(t){const w=h===0,b=h===this.nodeSelectionData.length-1,P=y.y===this.min,F=y.y===this.max;m=t({datum:c,xValue:y.x,yValue:y.y,width:v,height:S,min:P,max:F,first:w,last:b,fill:u,stroke:p,strokeWidth:g,highlighted:d})}l.fill=m&&m.fill||u,l.stroke=m&&m.stroke||p,l.strokeWidth=m&&m.strokeWidth||g,l.x=C,l.y=f,l.width=v,l.height=S,l.visible=l.height>0})}updateLabelSelection(e){this.labelSelection.update(e,t=>{t.tag=1,t.pointerEvents=De.PointerEvents.None})}updateLabelNodes(){const{label:{enabled:e,fontStyle:t,fontWeight:s,fontSize:i,fontFamily:r,color:a}}=this;this.labelSelection.each((o,n)=>{const l=n.label;l&&e?(o.fontStyle=t,o.fontWeight=s,o.fontSize=i,o.fontFamily=r,o.textAlign=l.textAlign,o.textBaseline=l.textBaseline,o.text=l.text,o.x=l.x,o.y=l.y,o.fill=a,o.visible=!0):o.visible=!1})}getTooltipHtml(e){const{dataType:t}=this,{seriesDatum:s}=e,i=s.y,r=s.x,a=this.formatNumericDatum(i),o=t==="array"||t==="object"?this.formatDatum(r):void 0,n={content:a,title:o},l=this.processedOptions?.tooltip?.renderer;return l?Tt(l({context:this.context,datum:s,yValue:i,xValue:r}),n):Tt(n)}formatLabelValue(e){return e%1!==0?e.toFixed(1):e.toFixed(0)}},{isNumber:Dk}=ak,{BandScale:jd}=rk,Lk=class extends $d{updateYScaleRange(){const{seriesRect:e,yScale:t}=this;t.range=[0,e.width]}updateXScaleRange(){const{xScale:e,seriesRect:t,paddingOuter:s,paddingInner:i}=this;if(e instanceof jd)e.range=[0,t.height],e.paddingInner=i,e.paddingOuter=s;else{const r=this.calculateStep(t.height),a=r*s;this.bandWidth=r*(1-i),e.range=[a,t.height-a-this.bandWidth]}}updateAxisLine(){const{yScale:e,axis:{stroke:t,strokeWidth:s},axisLine:i,seriesRect:r}=this,a=e.convert(0);i.x1=i.x2=a,i.y1=0,i.y2=r.height,i.stroke=t,i.strokeWidth=s+(s%2===1?1:0)}generateNodeData(){const{data:e,yData:t,xData:s,xScale:i,yScale:r,fill:a,stroke:o,strokeWidth:n,label:l}=this;if(!e)return;const{fontStyle:c,fontWeight:h,fontSize:d,fontFamily:u,color:p,formatter:g,placement:m}=l,C=[],f=r.convert(0),v=!(i instanceof jd);for(let S=0,y=t.length;S<y;S++){let w=t[S];const b=s[S],P=w===void 0;P&&(w=0);const F=i.convert(v?i.toDomain(b):b),A=Math.min(w===void 0?NaN:r.convert(w),f),M=Math.max(w===void 0?NaN:r.convert(w),f),I=v?this.bandWidth:i.bandwidth,B=M-A,R={x:f,y:F};let D;g?D=g({value:w}):D=w!==void 0&&Dk(w)?this.formatLabelValue(w):"";const U=F+I/2;let N;const fe="middle";let V;const L=w!==void 0&&w>=0,k=4;if(m==="center")N=A+B/2,V="center";else if(m==="outsideEnd")N=A+(L?B+k:-k),V=L?"start":"end";else if(m==="insideEnd"){N=A+(L?B-k:k),V=L?"end":"start";const Mt=ik.CachedTextMeasurerPool.measureText(D,{font:u}).width||20,Bi=f+Mt,Ni=f-Mt;(L&&N<Bi||!L&&N>Ni)&&(N=f+k*(L?1:-1),V=L?"start":"end")}else N=f+k*(L?1:-1),V=L?"start":"end";C.push({x:A,y:F,width:B,height:I,fill:a,stroke:o,strokeWidth:n,seriesDatum:{x:b,y:P?void 0:w},point:R,label:{x:N,y:U,text:D,fontStyle:c,fontWeight:h,fontSize:d,fontFamily:u,textAlign:V,textBaseline:fe,fill:p}})}return C}getDistance(e,t){return Math.abs(e.y-t.y)}},{isNumber:kk}=ck,{BandScale:Yd}=lk,Gk=class extends $d{updateYScaleRange(){const{seriesRect:e,yScale:t}=this;t.range=[e.height,0]}updateXScaleRange(){const{xScale:e,seriesRect:t,paddingOuter:s,paddingInner:i}=this;if(e instanceof Yd)e.range=[0,t.width],e.paddingInner=i,e.paddingOuter=s;else{const r=this.calculateStep(t.width),a=r*s;this.bandWidth=r*(1-i),e.range=[a,t.width-a-this.bandWidth]}}updateAxisLine(){const{yScale:e,axis:{stroke:t,strokeWidth:s},axisLine:i,seriesRect:r}=this,a=e.convert(0);i.x1=0,i.x2=r.width,i.y1=i.y2=a,i.stroke=t,i.strokeWidth=s+(s%2===1?1:0)}generateNodeData(){const{data:e,yData:t,xData:s,xScale:i,yScale:r,fill:a,stroke:o,strokeWidth:n,label:l}=this;if(!e)return;const{fontStyle:c,fontWeight:h,fontSize:d,fontFamily:u,color:p,formatter:g,placement:m}=l,C=[],f=r.convert(0),v=!(i instanceof Yd);for(let S=0,y=t.length;S<y;S++){let w=t[S];const b=s[S],P=w===void 0;P&&(w=0);const F=Math.min(w===void 0?NaN:r.convert(w),f),A=i.convert(v?i.toDomain(b):b),M=Math.max(w===void 0?NaN:r.convert(w),f),I=v?this.bandWidth:i.bandwidth,B=M-F,R={x:A+I/2,y:f};let D;g?D=g({value:w}):D=w!==void 0&&kk(w)?this.formatLabelValue(w):"";const U=A+I/2;let N;const fe="center";let V;const L=w!==void 0&&w>=0,k=2;if(m==="center")N=F+B/2,V="middle";else if(m==="outsideEnd")N=F+(L?-k:B+k),V=L?"bottom":"top";else if(m==="insideEnd"){N=F+(L?k:B-k),V=L?"top":"bottom";const Mt=nk.CachedTextMeasurerPool.measureText(D,{font:u}).height||10,Bi=f-Mt,Ni=f+Mt;(L&&N>Bi||!L&&N<Ni)&&(N=f+k*(L?-1:1),V=L?"bottom":"top")}else N=f+k*(L?-1:1),V=L?"bottom":"top";C.push({x:A,y:F,width:I,height:B,fill:a,stroke:o,strokeWidth:n,seriesDatum:{x:b,y:P?void 0:w},point:R,label:{x:U,y:N,text:D,fontStyle:c,fontWeight:h,fontSize:d,fontFamily:u,textAlign:fe,textBaseline:V,fill:p}})}return C}},{extent:Ok}=dk,{BandScale:qd}=hk,Bk=class{constructor(){this.enabled=!0,this.shape="circle",this.size=0,this.fill="rgb(124, 181, 236)",this.stroke="rgb(124, 181, 236)",this.strokeWidth=1,this.formatter=void 0}},Nk=class{constructor(){this.stroke="rgb(124, 181, 236)",this.strokeWidth=1}},Vk=class{constructor(){this.xLine={enabled:!0,stroke:"rgba(0,0,0, 0.54)",strokeWidth:1,lineDash:"solid",lineCap:void 0},this.yLine={enabled:!1,stroke:"rgba(0,0,0, 0.54)",strokeWidth:1,lineDash:"solid",lineCap:void 0}}},_k=class extends Go{constructor(){super(),this.linePath=new Pt.Path,this.xCrosshairLine=new Pt.Line,this.yCrosshairLine=new Pt.Line,this.lineSparklineGroup=new Pt.Group,this.markers=new Pt.Group,this.markerSelection=Pt.Selection.select(this.markers,()=>this.markerFactory()),this.markerSelectionData=[],this.marker=new Bk,this.line=new Nk,this.crosshairs=new Vk,this.rootGroup.append(this.lineSparklineGroup),this.linePath.zIndex=1e3,this.xCrosshairLine.zIndex=2e3,this.yCrosshairLine.zIndex=2e3,this.markers.zIndex=2500,this.lineSparklineGroup.append([this.linePath,this.xCrosshairLine,this.yCrosshairLine,this.markers])}getNodeData(){return this.markerSelectionData}markerFactory(){const{shape:e}=this.marker,t=Hd(e);return new t}onMarkerShapeChange(){this.markerSelection=this.markerSelection.clear(),this.scheduleLayout()}update(){const e=this.generateNodeData();e&&(this.markerSelectionData=e,this.updateSelection(e),this.updateNodes(),this.updateLine())}updateYScaleDomain(){const{yData:e,yScale:t}=this,s=Ok(e);let i=0,r=1;if(s!=null&&(i=this.min=s[0],r=this.max=s[1]),i===r){const a=Math.abs(i*.01);i-=a,r+=a}t.domain=[i,r]}generateNodeData(){const{data:e,yData:t,xData:s,xScale:i,yScale:r}=this;if(!e)return;const a=!(i instanceof qd),o=a?0:i.bandwidth/2,n=[];for(let l=0;l<t.length;l++){const c=t[l],h=s[l];if(c==null)continue;const d=i.convert(a?i.toDomain(h):h)+o,u=c===void 0?NaN:r.convert(c);n.push({seriesDatum:{x:h,y:c},point:{x:d,y:u}})}return n}updateSelection(e){this.markerSelection.update(e)}updateNodes(){const{highlightedDatum:e,highlightStyle:t,marker:s}=this,{size:i,fill:r,stroke:a,strokeWidth:o}=t,n=s.formatter;this.markerSelection.each((l,c,h)=>{const d=c===e,u=d&&r!==void 0?r:s.fill,p=d&&a!==void 0?a:s.stroke,g=d&&o!==void 0?o:s.strokeWidth,m=d&&i!==void 0?i:s.size;let C;const{seriesDatum:f,point:v}=c;if(n){const S=h===0,y=h===this.markerSelectionData.length-1,w=f.y===this.min,b=f.y===this.max;C=n({datum:c,xValue:f.x,yValue:f.y,min:w,max:b,first:S,last:y,fill:u,stroke:p,strokeWidth:g,size:m,highlighted:d})}l.size=C&&C.size!=null?C.size:m,l.fill=C&&C.fill!=null?C.fill:u,l.stroke=C&&C.stroke!=null?C.stroke:p,l.strokeWidth=C&&C.strokeWidth!=null?C.strokeWidth:g,l.translationX=v.x,l.translationY=v.y,l.visible=C&&C.enabled!=null?C.enabled:s.enabled&&l.size>0})}updateLine(){const{linePath:e,yData:t,xData:s,xScale:i,yScale:r,line:a}=this,o=e.path;if(o.clear(),t.length<2)return;const n=!(i instanceof qd),l=t.length,c=n?0:i.bandwidth/2;let h=!0;for(let d=0;d<l;d++){const u=s[d],p=t[d],g=i.convert(n?i.toDomain(u):u)+c,m=p===void 0?NaN:r.convert(p);p==null?h=!0:h?(o.moveTo(g,m),h=!1):o.lineTo(g,m)}e.fill=void 0,e.stroke=a.stroke,e.strokeWidth=a.strokeWidth}updateXCrosshairLine(){const{yScale:e,xCrosshairLine:t,highlightedDatum:s,crosshairs:{xLine:i}}=this;if(!i.enabled||s==null){t.strokeWidth=0;return}t.y1=e.range[0],t.y2=e.range[1],t.x1=t.x2=s.point.x,t.stroke=i.stroke,t.strokeWidth=i.strokeWidth??1,t.lineCap=i.lineCap==="round"||i.lineCap==="square"?i.lineCap:void 0;const{lineDash:r}=i;t.lineDash=Array.isArray(r)?r:Gi(t.lineCap,i.lineDash)}updateYCrosshairLine(){const{xScale:e,yCrosshairLine:t,highlightedDatum:s,crosshairs:{yLine:i}}=this;if(!i.enabled||s==null){t.strokeWidth=0;return}t.x1=e.range[0],t.x2=e.range[1],t.y1=t.y2=s.point.y,t.stroke=i.stroke,t.strokeWidth=i.strokeWidth??1,t.lineCap=i.lineCap==="round"||i.lineCap==="square"?i.lineCap:void 0;const{lineDash:r}=i;t.lineDash=Array.isArray(r)?r:Gi(t.lineCap,i.lineDash)}getTooltipHtml(e){const{dataType:t}=this,{seriesDatum:s}=e,i=s.y,r=s.x,a=this.formatNumericDatum(i),o=t==="array"||t==="object"?this.formatDatum(r):void 0,n={content:a,title:o},l=this.processedOptions?.tooltip?.renderer;return l?Tt(l({context:this.context,datum:s,yValue:i,xValue:r}),n):Tt(n)}},{isNumber:Uk}=_d,Hk=class{static create(e,t){e=_d.deepClone(e);const s=zk(e.type);return t&&(s.tooltip=t),Kk(s,e),Wk(s,e),e.data&&(s.data=e.data),s.processedOptions=e,s}};function zk(e="line"){switch(e){case"column":return new Gk;case"bar":return new Lk;case"area":return new Ak;case"line":default:return new _k}}function Wk(e,t){switch(t.type){case"bar":Xd(e,t);break;case"column":Xd(e,t);break;case"area":jk(e,t);break;case"line":default:$k(e,t);break}}function Kk(e,t){T(e,"context",t.context,t),T(e,"width",t.width,t),T(e,"height",t.height,t),T(e,"container",t.container,t),T(e,"xKey",t.xKey,t),T(e,"yKey",t.yKey,t),t.padding&&Yk(e.padding,t.padding),t.axis&&Xk(e.axis,t.axis),t.highlightStyle&&Zk(e.highlightStyle,t.highlightStyle)}function $k(e,t){t.marker&&Zd(e.marker,t.marker),t.line&&Jd(e.line,t.line),t.crosshairs&&Qd(e.crosshairs,t.crosshairs)}function jk(e,t){T(e,"fill",t.fill,t),t.marker&&Zd(e.marker,t.marker),t.line&&Jd(e.line,t.line),t.crosshairs&&Qd(e.crosshairs,t.crosshairs)}function Xd(e,t){T(e,"valueAxisDomain",t.valueAxisDomain,t),T(e,"fill",t.fill,t),T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t),T(e,"paddingInner",t.paddingInner,t),T(e,"paddingOuter",t.paddingOuter,t),T(e,"formatter",t.formatter,t),t.label&&qk(e.label,t.label)}function Yk(e,t){T(e,"top",t.top,t),T(e,"right",t.right,t),T(e,"bottom",t.bottom,t),T(e,"left",t.left,t)}function Zd(e,t){T(e,"enabled",t.enabled,t),T(e,"size",t.size,t),T(e,"shape",t.shape,t),T(e,"fill",t.fill,t),T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t),T(e,"formatter",t.formatter,t)}function qk(e,t){T(e,"enabled",t.enabled,t),T(e,"fontStyle",t.fontStyle,t),T(e,"fontWeight",t.fontWeight,t),T(e,"fontSize",t.fontSize,t),T(e,"fontFamily",t.fontFamily,t),T(e,"textAlign",t.textAlign,t),T(e,"textBaseline",t.textBaseline,t),T(e,"color",t.color,t),T(e,"formatter",t.formatter,t),T(e,"placement",t.placement,t)}function Jd(e,t){T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t)}function Xk(e,t){T(e,"type",t.type,t),T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t)}function Zk(e,t){T(e,"fill",t.fill,t),T(e,"size",t.size,t),T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t)}function Qd(e,t){e.xLine&&t.xLine&&eu(e.xLine,t.xLine),e.yLine&&t.yLine&&eu(e.yLine,t.yLine)}function eu(e,t){T(e,"enabled",t.enabled,t),T(e,"stroke",t.stroke,t),T(e,"strokeWidth",t.strokeWidth,t),T(e,"lineDash",t.lineDash,t),T(e,"lineCap",t.lineCap,t)}var tu=(e,t,s)=>Uk(t)?!0:(Vd(`${e} must be a number, the value you provided is not a valid number. Using the default of ${s}px.`),!1),Jk={xOffset:tu,yOffset:tu};function T(e,t,s,i){if(t in i)if(t in e){const r=Jk[t];(r?r(t,s,e[t]):!0)&&e[t]!==s&&(e[t]=s)}else Vd(`Property ${t} does not exist on the target object.`)}var Qk=class extends q0{constructor(){super(`<div class="ag-sparkline-wrapper">
458
458
  <span data-ref="eSparkline"></span>
459
- </div>`),this.eSparkline=X0}wireBeans(e){this.resizeObserverService=e.resizeObserverService,this.sparklineTooltipSingleton=e.sparklineTooltipSingleton}init(e){let t=!0;const s=()=>{const{clientWidth:r,clientHeight:a}=this.getGui();if(!(r===0||a===0))if(t){const o={data:e.value,width:r,height:a,context:{data:e.data},...e.sparklineOptions};this.sparkline=Hk.create(o,this.sparklineTooltipSingleton.getSparklineTooltip()),this.eSparkline.appendChild(this.sparkline.canvasElement),t=!1}else this.sparkline.width=r,this.sparkline.height=a},i=this.resizeObserverService.observeResize(this.getGui(),s);this.addDestroyFunc(()=>i())}refresh(e){return this.sparkline?(this.sparkline.data=e.value,this.sparkline.context={data:e.data},!0):!1}destroy(){this.sparkline&&this.sparkline.destroy(),super.destroy()}},eG=class extends uk{constructor(){super(...arguments),this.beanName="sparklineTooltipSingleton"}postConstruct(){this.tooltip=new xk}getSparklineTooltip(){return this.tooltip}destroy(){this.tooltip&&this.tooltip.destroy(),super.destroy()}},tG="32.3.2",Oo=Y0({version:tG,moduleName:j0.SparklinesModule,beans:[eG],userComponents:[{name:"agSparklineCellRenderer",classImp:Qk}],dependantModules:[H]});import{ModuleNames as Bo,_defineModule as No}from"ag-grid-community";import{Component as sG,RefPlaceholder as bs,_exists as iG,_formatNumberTwoDecimalPlacesAndCommas as rG,_isClientSideRowModel as aG,_isServerSideRowModel as oG,_missing as Vo,_missingOrEmpty as nG,_warnOnce as lG}from"ag-grid-community";import{Component as cG,RefPlaceholder as su}from"ag-grid-community";var Ps=class extends cG{constructor(){super(`<div class="ag-status-name-value">
459
+ </div>`),this.eSparkline=X0}wireBeans(e){this.resizeObserverService=e.resizeObserverService,this.sparklineTooltipSingleton=e.sparklineTooltipSingleton}init(e){let t=!0;const s=()=>{const{clientWidth:r,clientHeight:a}=this.getGui();if(!(r===0||a===0))if(t){const o={data:e.value,width:r,height:a,context:{data:e.data},...e.sparklineOptions};this.sparkline=Hk.create(o,this.sparklineTooltipSingleton.getSparklineTooltip()),this.eSparkline.appendChild(this.sparkline.canvasElement),t=!1}else this.sparkline.width=r,this.sparkline.height=a},i=this.resizeObserverService.observeResize(this.getGui(),s);this.addDestroyFunc(()=>i())}refresh(e){return this.sparkline?(this.sparkline.data=e.value,this.sparkline.context={data:e.data},!0):!1}destroy(){this.sparkline&&this.sparkline.destroy(),super.destroy()}},eG=class extends uk{constructor(){super(...arguments),this.beanName="sparklineTooltipSingleton"}postConstruct(){this.tooltip=new xk}getSparklineTooltip(){return this.tooltip}destroy(){this.tooltip&&this.tooltip.destroy(),super.destroy()}},tG="32.3.3",Oo=Y0({version:tG,moduleName:j0.SparklinesModule,beans:[eG],userComponents:[{name:"agSparklineCellRenderer",classImp:Qk}],dependantModules:[H]});import{ModuleNames as Bo,_defineModule as No}from"ag-grid-community";import{Component as sG,RefPlaceholder as bs,_exists as iG,_formatNumberTwoDecimalPlacesAndCommas as rG,_isClientSideRowModel as aG,_isServerSideRowModel as oG,_missing as Vo,_missingOrEmpty as nG,_warnOnce as lG}from"ag-grid-community";import{Component as cG,RefPlaceholder as su}from"ag-grid-community";var Ps=class extends cG{constructor(){super(`<div class="ag-status-name-value">
460
460
  <span data-ref="eLabel"></span>:&nbsp;
461
461
  <span data-ref="eValue" class="ag-status-name-value-value"></span>
462
462
  </div>`),this.eLabel=su,this.eValue=su}setLabel(e,t){this.setDisplayed(!1);const s=this.localeService.getLocaleTextFunc();this.eLabel.innerHTML=s(e,t)}setValue(e){this.eValue.innerHTML=e}},hG={selector:"AG-NAME-VALUE",component:Ps},dG=class extends sG{constructor(){super(`<div class="ag-status-panel ag-status-panel-aggregations">
@@ -469,4 +469,4 @@ Please turn off ${t} to enable Excel table exports.`)}static getTableNameFromInd
469
469
  <div data-ref="eStatusBarLeft" class="ag-status-bar-left" role="status"></div>
470
470
  <div data-ref="eStatusBarCenter" class="ag-status-bar-center" role="status"></div>
471
471
  <div data-ref="eStatusBarRight" class="ag-status-bar-right" role="status"></div>
472
- </div>`),this.updateQueued=!1,this.panelsPromise=Oi.resolve(),this.eStatusBarLeft=_o,this.eStatusBarCenter=_o,this.eStatusBarRight=_o,this.compDestroyFunctions={}}wireBeans(e){this.userComponentFactory=e.userComponentFactory,this.statusBarService=e.statusBarService}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this))}processStatusPanels(e){const t=this.gos.get("statusBar")?.statusPanels;if(t){const s=t.filter(a=>a.align==="left"),i=t.filter(a=>a.align==="center"),r=t.filter(a=>!a.align||a.align==="right");this.panelsPromise=Oi.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.gos.get("statusBar")?.statusPanels,t=Array.isArray(e)&&e.length>0;this.setDisplayed(t);const s=new Map;t&&e.forEach(i=>{const r=i.key??i.statusPanel,a=this.statusBarService.getStatusPanel(r);if(a?.refresh){const o=this.gos.addGridCommonParams(i.statusPanelParams??{});a.refresh(o)&&(s.set(r,a),delete this.compDestroyFunctions[r],DG(a.getGui()))}}),this.resetStatusBar(),t&&this.processStatusPanels(s)}resetStatusBar(){this.eStatusBarLeft.innerHTML="",this.eStatusBarCenter.innerHTML="",this.eStatusBarRight.innerHTML="",this.destroyComponents(),this.statusBarService.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){Object.values(this.compDestroyFunctions).forEach(e=>e()),this.compDestroyFunctions={}}createAndRenderComponents(e,t,s){const i=[];return e.forEach(r=>{const a=r.key||r.statusPanel,o=s.get(a);let n;if(o)n=Oi.resolve(o);else{const l={};if(n=this.userComponentFactory.getStatusPanelCompDetails(r,l).newAgStackInstance(),n==null)return}i.push({key:a,promise:n})}),Oi.all(i.map(r=>r.promise)).then(()=>{i.forEach(r=>{r.promise.then(a=>{const o=()=>{this.destroyBean(a)};this.isAlive()?(this.statusBarService.registerStatusPanel(r.key,a),t.appendChild(a.getGui()),this.compDestroyFunctions[r.key]=o):o()})})})}},kG={selector:"AG-STATUS-BAR",component:LG},GG=class extends EG{constructor(){super(),this.beanName="statusBarService",this.allComponents=new Map}registerStatusPanel(e,t){this.allComponents.set(e,t)}unregisterStatusPanel(e){this.allComponents.delete(e)}unregisterAllComponents(){this.allComponents.clear()}getStatusPanel(e){return this.allComponents.get(e)}getStatusPanelSelector(){return kG}destroy(){this.unregisterAllComponents(),super.destroy()}},Uo="32.3.2",ru=No({version:Uo,moduleName:`${Bo.StatusBarModule}-core`,beans:[GG],userComponents:[{name:"agAggregationComponent",classImp:dG},{name:"agSelectedRowCountComponent",classImp:yG},{name:"agTotalRowCountComponent",classImp:FG},{name:"agFilteredRowCountComponent",classImp:mG},{name:"agTotalAndFilteredRowCountComponent",classImp:bG}],dependantModules:[H]}),OG=No({version:Uo,moduleName:`${Bo.StatusBarModule}-api`,apiFunctions:{getStatusPanel:RG},dependantModules:[ru]}),Ho=No({version:Uo,moduleName:Bo.StatusBarModule,dependantModules:[ru,OG]});import{ModuleNames as BG,_defineModule as NG}from"ag-grid-community";import{BeanStub as VG,RowNode as _G,_getRowHeightAsNumber as au,_iterateObject as UG,_missing as HG,_warnOnce as zG}from"ag-grid-community";var WG="32.3.2",KG=class extends VG{constructor(){super(...arguments),this.beanName="rowModel",this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={}}wireBeans(e){this.rowRenderer=e.rowRenderer,this.focusService=e.focusService,this.beans=e}ensureRowHeightsValid(e,t,s,i){return!1}postConstruct(){this.rowHeight=au(this.gos),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=au(this.gos),this.updateRowHeights()})}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy()}destroyDatasource(){this.viewportDatasource&&(this.viewportDatasource.destroy&&this.viewportDatasource.destroy(),this.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getViewportRowModelPageSize(){return this.gos.get("viewportRowModelPageSize")}getViewportRowModelBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getViewportRowModelBufferSize(),s=this.getViewportRowModelPageSize(),i=e-t;return i<0?0:Math.floor(i/s)*s}calculateLastRow(e){if(e===-1)return e;const t=this.getViewportRowModelBufferSize(),s=this.getViewportRowModelPageSize(),i=e+t,r=Math.ceil(i/s)*s,a=this.rowCount-1;return Math.min(r,a)}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.viewportDatasource&&this.viewportDatasource.setViewportRange(this.firstRow,this.lastRow))}purgeRowsNotInViewport(){Object.keys(this.rowNodesByIndex).forEach(e=>{const t=parseInt(e,10);if(t<this.firstRow||t>this.lastRow){if(this.isRowFocused(t))return;delete this.rowNodesByIndex[t]}})}isRowFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.viewportDatasource=e,this.rowCount=-1,e.init?e.init({setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)}):zG("viewport is missing init method.")}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}getRowBounds(e){return{rowHeight:this.rowHeight,rowTop:this.rowHeight*e}}updateRowHeights(){this.forEachNode(e=>{e.setRowHeight(this.rowHeight),e.setRowTop(this.rowHeight*e.rowIndex)}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const s=e.rowIndex,i=t.rowIndex,r=s<this.firstRow||s>this.lastRow,a=i<this.firstRow||i>this.lastRow;if(r||a)return[];const o=[],n=s<=i?s:i,l=s<=i?i:s;for(let c=n;c<=l;c++)o.push(this.rowNodesByIndex[c]);return o}forEachNode(e){let t=0;Object.keys(this.rowNodesByIndex).forEach(s=>{const i=parseInt(s,10),r=this.rowNodesByIndex[i];e(r,t),t++})}setRowData(e){UG(e,(t,s)=>{const i=parseInt(t,10);if(i>=this.firstRow&&i<=this.lastRow){let r=this.rowNodesByIndex[i];HG(r)&&(r=this.createBlankRowNode(i),this.rowNodesByIndex[i]=r),r.setDataAndId(s,i.toString())}})}createBlankRowNode(e){const t=new _G(this.beans);return t.setRowHeight(this.rowHeight),t.setRowTop(this.rowHeight*e),t.setRowIndex(e),t}setRowCount(e,t=!1){e!==this.rowCount&&(this.rowCount=e,this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1}))}isRowPresent(e){return!!this.getRowNode(e.id)}},zo=NG({version:WG,moduleName:BG.ViewportRowModelModule,rowModel:"viewport",beans:[KG],dependantModules:[H]});Zo(Jo,hr);export*from"ag-grid-community";export*from"ag-grid-community";Du.__registerModules([Iu,Eu,ku,Lu,cr,hi,ra,Ma,Va,Wa,qa,so,oo,$s,no,gi,xo,Do,as,Oo,Ho,zo],!1,void 0);export{cr as AdvancedFilterModule,Ze as AgDialog,pe as AgGroupComponent,G as AgGroupComponentSelector,Et as AgMenuItemComponent,ke as AgMenuItemRenderer,Je as AgMenuList,ji as AgMenuPanel,Ls as AgPanel,Ci as AgPrimaryCols,Rt as AgRichSelect,ra as ClipboardModule,Ma as ColumnsToolPanelModule,H as EnterpriseCoreModule,Va as ExcelExportModule,Wa as FiltersToolPanelModule,hi as GridChartsModule,ht as GroupCellRenderer,Lt as GroupCellRendererCtrl,Hi as LicenseManager,qa as MasterDetailModule,so as MenuModule,ms as MultiFilter,oo as MultiFilterModule,Es as PillDragComp,Is as PillDropZonePanel,ts as PivotDropZonePanel,$s as RangeSelectionModule,no as RichSelectModule,ss as RowGroupDropZonePanel,gi as RowGroupingModule,xo as ServerSideRowModelModule,Li as SetFilter,Do as SetFilterModule,as as SideBarModule,Oo as SparklinesModule,Ho as StatusBarModule,Os as TabbedLayout,fa as ToolPanelColDefService,mi as ValuesDropZonePanel,zo as ViewportRowModelModule,Ge as VirtualList,ks as VirtualListDragFeature,Jr as agCharts,Ba as exportMultipleSheetsAsExcel,Pi as getMultipleSheetsAsExcel};
472
+ </div>`),this.updateQueued=!1,this.panelsPromise=Oi.resolve(),this.eStatusBarLeft=_o,this.eStatusBarCenter=_o,this.eStatusBarRight=_o,this.compDestroyFunctions={}}wireBeans(e){this.userComponentFactory=e.userComponentFactory,this.statusBarService=e.statusBarService}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this))}processStatusPanels(e){const t=this.gos.get("statusBar")?.statusPanels;if(t){const s=t.filter(a=>a.align==="left"),i=t.filter(a=>a.align==="center"),r=t.filter(a=>!a.align||a.align==="right");this.panelsPromise=Oi.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.gos.get("statusBar")?.statusPanels,t=Array.isArray(e)&&e.length>0;this.setDisplayed(t);const s=new Map;t&&e.forEach(i=>{const r=i.key??i.statusPanel,a=this.statusBarService.getStatusPanel(r);if(a?.refresh){const o=this.gos.addGridCommonParams(i.statusPanelParams??{});a.refresh(o)&&(s.set(r,a),delete this.compDestroyFunctions[r],DG(a.getGui()))}}),this.resetStatusBar(),t&&this.processStatusPanels(s)}resetStatusBar(){this.eStatusBarLeft.innerHTML="",this.eStatusBarCenter.innerHTML="",this.eStatusBarRight.innerHTML="",this.destroyComponents(),this.statusBarService.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){Object.values(this.compDestroyFunctions).forEach(e=>e()),this.compDestroyFunctions={}}createAndRenderComponents(e,t,s){const i=[];return e.forEach(r=>{const a=r.key||r.statusPanel,o=s.get(a);let n;if(o)n=Oi.resolve(o);else{const l={};if(n=this.userComponentFactory.getStatusPanelCompDetails(r,l).newAgStackInstance(),n==null)return}i.push({key:a,promise:n})}),Oi.all(i.map(r=>r.promise)).then(()=>{i.forEach(r=>{r.promise.then(a=>{const o=()=>{this.destroyBean(a)};this.isAlive()?(this.statusBarService.registerStatusPanel(r.key,a),t.appendChild(a.getGui()),this.compDestroyFunctions[r.key]=o):o()})})})}},kG={selector:"AG-STATUS-BAR",component:LG},GG=class extends EG{constructor(){super(),this.beanName="statusBarService",this.allComponents=new Map}registerStatusPanel(e,t){this.allComponents.set(e,t)}unregisterStatusPanel(e){this.allComponents.delete(e)}unregisterAllComponents(){this.allComponents.clear()}getStatusPanel(e){return this.allComponents.get(e)}getStatusPanelSelector(){return kG}destroy(){this.unregisterAllComponents(),super.destroy()}},Uo="32.3.3",ru=No({version:Uo,moduleName:`${Bo.StatusBarModule}-core`,beans:[GG],userComponents:[{name:"agAggregationComponent",classImp:dG},{name:"agSelectedRowCountComponent",classImp:yG},{name:"agTotalRowCountComponent",classImp:FG},{name:"agFilteredRowCountComponent",classImp:mG},{name:"agTotalAndFilteredRowCountComponent",classImp:bG}],dependantModules:[H]}),OG=No({version:Uo,moduleName:`${Bo.StatusBarModule}-api`,apiFunctions:{getStatusPanel:RG},dependantModules:[ru]}),Ho=No({version:Uo,moduleName:Bo.StatusBarModule,dependantModules:[ru,OG]});import{ModuleNames as BG,_defineModule as NG}from"ag-grid-community";import{BeanStub as VG,RowNode as _G,_getRowHeightAsNumber as au,_iterateObject as UG,_missing as HG,_warnOnce as zG}from"ag-grid-community";var WG="32.3.3",KG=class extends VG{constructor(){super(...arguments),this.beanName="rowModel",this.firstRow=-1,this.lastRow=-1,this.rowCount=-1,this.rowNodesByIndex={}}wireBeans(e){this.rowRenderer=e.rowRenderer,this.focusService=e.focusService,this.beans=e}ensureRowHeightsValid(e,t,s,i){return!1}postConstruct(){this.rowHeight=au(this.gos),this.addManagedEventListeners({viewportChanged:this.onViewportChanged.bind(this)}),this.addManagedPropertyListener("viewportDatasource",()=>this.updateDatasource()),this.addManagedPropertyListener("rowHeight",()=>{this.rowHeight=au(this.gos),this.updateRowHeights()})}start(){this.updateDatasource()}isLastRowIndexKnown(){return!0}destroy(){this.destroyDatasource(),super.destroy()}destroyDatasource(){this.viewportDatasource&&(this.viewportDatasource.destroy&&this.viewportDatasource.destroy(),this.rowRenderer.datasourceChanged(),this.firstRow=-1,this.lastRow=-1)}updateDatasource(){const e=this.gos.get("viewportDatasource");e&&this.setViewportDatasource(e)}getViewportRowModelPageSize(){return this.gos.get("viewportRowModelPageSize")}getViewportRowModelBufferSize(){return this.gos.get("viewportRowModelBufferSize")}calculateFirstRow(e){const t=this.getViewportRowModelBufferSize(),s=this.getViewportRowModelPageSize(),i=e-t;return i<0?0:Math.floor(i/s)*s}calculateLastRow(e){if(e===-1)return e;const t=this.getViewportRowModelBufferSize(),s=this.getViewportRowModelPageSize(),i=e+t,r=Math.ceil(i/s)*s,a=this.rowCount-1;return Math.min(r,a)}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.viewportDatasource&&this.viewportDatasource.setViewportRange(this.firstRow,this.lastRow))}purgeRowsNotInViewport(){Object.keys(this.rowNodesByIndex).forEach(e=>{const t=parseInt(e,10);if(t<this.firstRow||t>this.lastRow){if(this.isRowFocused(t))return;delete this.rowNodesByIndex[t]}})}isRowFocused(e){const t=this.focusService.getFocusCellToUseAfterRefresh();return!t||t.rowPinned!=null?!1:t.rowIndex===e}setViewportDatasource(e){this.destroyDatasource(),this.viewportDatasource=e,this.rowCount=-1,e.init?e.init({setRowCount:this.setRowCount.bind(this),setRowData:this.setRowData.bind(this),getRow:this.getRow.bind(this)}):zG("viewport is missing init method.")}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}getRowBounds(e){return{rowHeight:this.rowHeight,rowTop:this.rowHeight*e}}updateRowHeights(){this.forEachNode(e=>{e.setRowHeight(this.rowHeight),e.setRowTop(this.rowHeight*e.rowIndex)}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:!0,animate:!1})}getTopLevelRowCount(){return this.getRowCount()}getTopLevelRowDisplayedIndex(e){return e}isEmpty(){return this.rowCount>0}isRowsToRender(){return this.rowCount>0}getNodesInRangeForSelection(e,t){const s=e.rowIndex,i=t.rowIndex,r=s<this.firstRow||s>this.lastRow,a=i<this.firstRow||i>this.lastRow;if(r||a)return[];const o=[],n=s<=i?s:i,l=s<=i?i:s;for(let c=n;c<=l;c++)o.push(this.rowNodesByIndex[c]);return o}forEachNode(e){let t=0;Object.keys(this.rowNodesByIndex).forEach(s=>{const i=parseInt(s,10),r=this.rowNodesByIndex[i];e(r,t),t++})}setRowData(e){UG(e,(t,s)=>{const i=parseInt(t,10);if(i>=this.firstRow&&i<=this.lastRow){let r=this.rowNodesByIndex[i];HG(r)&&(r=this.createBlankRowNode(i),this.rowNodesByIndex[i]=r),r.setDataAndId(s,i.toString())}})}createBlankRowNode(e){const t=new _G(this.beans);return t.setRowHeight(this.rowHeight),t.setRowTop(this.rowHeight*e),t.setRowIndex(e),t}setRowCount(e,t=!1){e!==this.rowCount&&(this.rowCount=e,this.eventService.dispatchEventOnce({type:"rowCountReady"}),this.eventService.dispatchEvent({type:"modelUpdated",newData:!1,newPage:!1,keepRenderedRows:t,animate:!1}))}isRowPresent(e){return!!this.getRowNode(e.id)}},zo=NG({version:WG,moduleName:BG.ViewportRowModelModule,rowModel:"viewport",beans:[KG],dependantModules:[H]});Zo(Jo,hr);export*from"ag-grid-community";export*from"ag-grid-community";Du.__registerModules([Iu,Eu,ku,Lu,cr,hi,ra,Ma,Va,Wa,qa,so,oo,$s,no,gi,xo,Do,as,Oo,Ho,zo],!1,void 0);export{cr as AdvancedFilterModule,Ze as AgDialog,pe as AgGroupComponent,G as AgGroupComponentSelector,Et as AgMenuItemComponent,ke as AgMenuItemRenderer,Je as AgMenuList,ji as AgMenuPanel,Ls as AgPanel,Ci as AgPrimaryCols,Rt as AgRichSelect,ra as ClipboardModule,Ma as ColumnsToolPanelModule,H as EnterpriseCoreModule,Va as ExcelExportModule,Wa as FiltersToolPanelModule,hi as GridChartsModule,ht as GroupCellRenderer,Lt as GroupCellRendererCtrl,Hi as LicenseManager,qa as MasterDetailModule,so as MenuModule,ms as MultiFilter,oo as MultiFilterModule,Es as PillDragComp,Is as PillDropZonePanel,ts as PivotDropZonePanel,$s as RangeSelectionModule,no as RichSelectModule,ss as RowGroupDropZonePanel,gi as RowGroupingModule,xo as ServerSideRowModelModule,Li as SetFilter,Do as SetFilterModule,as as SideBarModule,Oo as SparklinesModule,Ho as StatusBarModule,Os as TabbedLayout,fa as ToolPanelColDefService,mi as ValuesDropZonePanel,zo as ViewportRowModelModule,Ge as VirtualList,ks as VirtualListDragFeature,Jr as agCharts,Ba as exportMultipleSheetsAsExcel,Pi as getMultipleSheetsAsExcel};