From bbbf44a04e0578f91876df79e3bfa85978dff109 Mon Sep 17 00:00:00 2001 From: natxocc Date: Thu, 30 Apr 2026 00:16:49 +0200 Subject: [PATCH] Upload package and main modified --- .gitignore | 2 +- ag-grid/dist/package.json | 131 + ag-grid/dist/package/main.esm.mjs | 66843 ++++++++++++++++++++++++++++ ag-grid/dist/package/package.json | 131 + dist/sigpro-grid.esm.min.js | 70 + dist/sigpro-grid.min.js | 70 + 6 files changed, 67246 insertions(+), 1 deletion(-) create mode 100644 ag-grid/dist/package.json create mode 100644 ag-grid/dist/package/main.esm.mjs create mode 100644 ag-grid/dist/package/package.json create mode 100644 dist/sigpro-grid.esm.min.js create mode 100644 dist/sigpro-grid.min.js diff --git a/.gitignore b/.gitignore index f426ef2..8232064 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,5 @@ node_modules/ .DS_Store -dist/ +#dist/ *.log .env \ No newline at end of file diff --git a/ag-grid/dist/package.json b/ag-grid/dist/package.json new file mode 100644 index 0000000..9e6dcff --- /dev/null +++ b/ag-grid/dist/package.json @@ -0,0 +1,131 @@ +{ + "name": "ag-grid-enterprise", + "version": "35.2.0", + "description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", + "main": "./dist/package/main.cjs.js", + "types": "./dist/types/src/main.d.ts", + "module": "./dist/package/main.esm.mjs", + "exports": { + ".": { + "import": "./dist/package/main.esm.mjs", + "types": "./dist/types/src/main.d.ts", + "require": "./dist/package/main.cjs.js", + "default": "./dist/package/main.cjs.js" + }, + "./styles/ag-grid-no-native-widgets.css": "./styles/ag-grid-no-native-widgets.css", + "./styles/ag-grid-no-native-widgets.min.css": "./styles/ag-grid-no-native-widgets.min.css", + "./styles/ag-grid.css": "./styles/ag-grid.css", + "./styles/ag-grid.min.css": "./styles/ag-grid.min.css", + "./styles/ag-theme-alpine-no-font.css": "./styles/ag-theme-alpine-no-font.css", + "./styles/ag-theme-alpine-no-font.min.css": "./styles/ag-theme-alpine-no-font.min.css", + "./styles/ag-theme-alpine.css": "./styles/ag-theme-alpine.css", + "./styles/ag-theme-alpine.min.css": "./styles/ag-theme-alpine.min.css", + "./styles/ag-theme-balham-no-font.css": "./styles/ag-theme-balham-no-font.css", + "./styles/ag-theme-balham-no-font.min.css": "./styles/ag-theme-balham-no-font.min.css", + "./styles/ag-theme-balham.css": "./styles/ag-theme-balham.css", + "./styles/ag-theme-balham.min.css": "./styles/ag-theme-balham.min.css", + "./styles/ag-theme-material-no-font.css": "./styles/ag-theme-material-no-font.css", + "./styles/ag-theme-material-no-font.min.css": "./styles/ag-theme-material-no-font.min.css", + "./styles/ag-theme-material.css": "./styles/ag-theme-material.css", + "./styles/ag-theme-material.min.css": "./styles/ag-theme-material.min.css", + "./styles/ag-theme-quartz-no-font.css": "./styles/ag-theme-quartz-no-font.css", + "./styles/ag-theme-quartz-no-font.min.css": "./styles/ag-theme-quartz-no-font.min.css", + "./styles/ag-theme-quartz.css": "./styles/ag-theme-quartz.css", + "./styles/ag-theme-quartz.min.css": "./styles/ag-theme-quartz.min.css", + "./styles/agGridAlpineFont.css": "./styles/agGridAlpineFont.css", + "./styles/agGridAlpineFont.min.css": "./styles/agGridAlpineFont.min.css", + "./styles/agGridBalhamFont.css": "./styles/agGridBalhamFont.css", + "./styles/agGridBalhamFont.min.css": "./styles/agGridBalhamFont.min.css", + "./styles/agGridClassicFont.css": "./styles/agGridClassicFont.css", + "./styles/agGridClassicFont.min.css": "./styles/agGridClassicFont.min.css", + "./styles/agGridMaterialFont.css": "./styles/agGridMaterialFont.css", + "./styles/agGridMaterialFont.min.css": "./styles/agGridMaterialFont.min.css", + "./styles/agGridQuartzFont.css": "./styles/agGridQuartzFont.css", + "./styles/agGridQuartzFont.min.css": "./styles/agGridQuartzFont.min.css", + "./styles": "./styles/_index.scss" + }, + "sideEffects": [ + "./styles/ag-grid-no-native-widgets.css", + "./styles/ag-grid-no-native-widgets.min.css", + "./styles/ag-grid.css", + "./styles/ag-grid.min.css", + "./styles/ag-theme-alpine-no-font.css", + "./styles/ag-theme-alpine-no-font.min.css", + "./styles/ag-theme-alpine.css", + "./styles/ag-theme-alpine.min.css", + "./styles/ag-theme-balham-no-font.css", + "./styles/ag-theme-balham-no-font.min.css", + "./styles/ag-theme-balham.css", + "./styles/ag-theme-balham.min.css", + "./styles/ag-theme-material-no-font.css", + "./styles/ag-theme-material-no-font.min.css", + "./styles/ag-theme-material.css", + "./styles/ag-theme-material.min.css", + "./styles/ag-theme-quartz-no-font.css", + "./styles/ag-theme-quartz-no-font.min.css", + "./styles/ag-theme-quartz.css", + "./styles/ag-theme-quartz.min.css", + "./styles/agGridAlpineFont.css", + "./styles/agGridAlpineFont.min.css", + "./styles/agGridBalhamFont.css", + "./styles/agGridBalhamFont.min.css", + "./styles/agGridClassicFont.css", + "./styles/agGridClassicFont.min.css", + "./styles/agGridMaterialFont.css", + "./styles/agGridMaterialFont.min.css", + "./styles/agGridQuartzFont.css", + "./styles/agGridQuartzFont.min.css" + ], + "repository": { + "type": "git", + "url": "https://github.com/ag-grid/ag-grid.git" + }, + "keywords": [ + "ag", + "ag-grid", + "datagrid", + "data-grid", + "datatable", + "data-table", + "grid", + "table", + "react", + "table", + "angular", + "angular-component", + "react", + "react-component", + "reactjs", + "vue", + "vuejs" + ], + "author": "Sean Landsman ", + "license": "Commercial", + "bugs": { + "url": "https://github.com/ag-grid/ag-grid/issues" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie >= 0", + "not ie_mob >= 0", + "not blackberry > 0" + ], + "homepage": "https://www.ag-grid.com/", + "dependencies": { + "ag-grid-community": "35.2.0" + }, + "optionalDependencies": { + "ag-charts-community": "13.2.0", + "ag-charts-enterprise": "13.2.0" + }, + "devDependencies": { + "ag-charts-community": "13.2.0", + "ag-charts-enterprise": "13.2.0", + "@types/jest": "^29.5.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.7.0", + "jest-canvas-mock": "2.5.2", + "canvas": "^3.2.1" + } +} diff --git a/ag-grid/dist/package/main.esm.mjs b/ag-grid/dist/package/main.esm.mjs new file mode 100644 index 0000000..3e47fd7 --- /dev/null +++ b/ag-grid/dist/package/main.esm.mjs @@ -0,0 +1,66843 @@ +// packages/ag-grid-enterprise/src/license/gridLicenseManager.ts +import { BeanStub, _getDocument } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/license/shared/licenseManager.ts +import { _exists, _logPreInitWarn } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/license/shared/md5.ts +var MD5 = class { + constructor() { + this.ieCompatibility = false; + } + init() { + this.ieCompatibility = this.md5("hello") != "5d41402abc4b2a76b9719d911017c592"; + } + md5cycle(x, k) { + let a = x[0], b = x[1], c = x[2], d = x[3]; + a = this.ff(a, b, c, d, k[0], 7, -680876936); + d = this.ff(d, a, b, c, k[1], 12, -389564586); + c = this.ff(c, d, a, b, k[2], 17, 606105819); + b = this.ff(b, c, d, a, k[3], 22, -1044525330); + a = this.ff(a, b, c, d, k[4], 7, -176418897); + d = this.ff(d, a, b, c, k[5], 12, 1200080426); + c = this.ff(c, d, a, b, k[6], 17, -1473231341); + b = this.ff(b, c, d, a, k[7], 22, -45705983); + a = this.ff(a, b, c, d, k[8], 7, 1770035416); + d = this.ff(d, a, b, c, k[9], 12, -1958414417); + c = this.ff(c, d, a, b, k[10], 17, -42063); + b = this.ff(b, c, d, a, k[11], 22, -1990404162); + a = this.ff(a, b, c, d, k[12], 7, 1804603682); + d = this.ff(d, a, b, c, k[13], 12, -40341101); + c = this.ff(c, d, a, b, k[14], 17, -1502002290); + b = this.ff(b, c, d, a, k[15], 22, 1236535329); + a = this.gg(a, b, c, d, k[1], 5, -165796510); + d = this.gg(d, a, b, c, k[6], 9, -1069501632); + c = this.gg(c, d, a, b, k[11], 14, 643717713); + b = this.gg(b, c, d, a, k[0], 20, -373897302); + a = this.gg(a, b, c, d, k[5], 5, -701558691); + d = this.gg(d, a, b, c, k[10], 9, 38016083); + c = this.gg(c, d, a, b, k[15], 14, -660478335); + b = this.gg(b, c, d, a, k[4], 20, -405537848); + a = this.gg(a, b, c, d, k[9], 5, 568446438); + d = this.gg(d, a, b, c, k[14], 9, -1019803690); + c = this.gg(c, d, a, b, k[3], 14, -187363961); + b = this.gg(b, c, d, a, k[8], 20, 1163531501); + a = this.gg(a, b, c, d, k[13], 5, -1444681467); + d = this.gg(d, a, b, c, k[2], 9, -51403784); + c = this.gg(c, d, a, b, k[7], 14, 1735328473); + b = this.gg(b, c, d, a, k[12], 20, -1926607734); + a = this.hh(a, b, c, d, k[5], 4, -378558); + d = this.hh(d, a, b, c, k[8], 11, -2022574463); + c = this.hh(c, d, a, b, k[11], 16, 1839030562); + b = this.hh(b, c, d, a, k[14], 23, -35309556); + a = this.hh(a, b, c, d, k[1], 4, -1530992060); + d = this.hh(d, a, b, c, k[4], 11, 1272893353); + c = this.hh(c, d, a, b, k[7], 16, -155497632); + b = this.hh(b, c, d, a, k[10], 23, -1094730640); + a = this.hh(a, b, c, d, k[13], 4, 681279174); + d = this.hh(d, a, b, c, k[0], 11, -358537222); + c = this.hh(c, d, a, b, k[3], 16, -722521979); + b = this.hh(b, c, d, a, k[6], 23, 76029189); + a = this.hh(a, b, c, d, k[9], 4, -640364487); + d = this.hh(d, a, b, c, k[12], 11, -421815835); + c = this.hh(c, d, a, b, k[15], 16, 530742520); + b = this.hh(b, c, d, a, k[2], 23, -995338651); + a = this.ii(a, b, c, d, k[0], 6, -198630844); + d = this.ii(d, a, b, c, k[7], 10, 1126891415); + c = this.ii(c, d, a, b, k[14], 15, -1416354905); + b = this.ii(b, c, d, a, k[5], 21, -57434055); + a = this.ii(a, b, c, d, k[12], 6, 1700485571); + d = this.ii(d, a, b, c, k[3], 10, -1894986606); + c = this.ii(c, d, a, b, k[10], 15, -1051523); + b = this.ii(b, c, d, a, k[1], 21, -2054922799); + a = this.ii(a, b, c, d, k[8], 6, 1873313359); + d = this.ii(d, a, b, c, k[15], 10, -30611744); + c = this.ii(c, d, a, b, k[6], 15, -1560198380); + b = this.ii(b, c, d, a, k[13], 21, 1309151649); + a = this.ii(a, b, c, d, k[4], 6, -145523070); + d = this.ii(d, a, b, c, k[11], 10, -1120210379); + c = this.ii(c, d, a, b, k[2], 15, 718787259); + b = this.ii(b, c, d, a, k[9], 21, -343485551); + x[0] = this.add32(a, x[0]); + x[1] = this.add32(b, x[1]); + x[2] = this.add32(c, x[2]); + x[3] = this.add32(d, x[3]); + } + cmn(q, a, b, x, s2, t) { + a = this.add32(this.add32(a, q), this.add32(x, t)); + return this.add32(a << s2 | a >>> 32 - s2, b); + } + ff(a, b, c, d, x, s2, t) { + return this.cmn(b & c | ~b & d, a, b, x, s2, t); + } + gg(a, b, c, d, x, s2, t) { + return this.cmn(b & d | c & ~d, a, b, x, s2, t); + } + hh(a, b, c, d, x, s2, t) { + return this.cmn(b ^ c ^ d, a, b, x, s2, t); + } + ii(a, b, c, d, x, s2, t) { + return this.cmn(c ^ (b | ~d), a, b, x, s2, t); + } + md51(s2) { + const n = s2.length; + const state = [1732584193, -271733879, -1732584194, 271733878]; + let i; + for (i = 64; i <= s2.length; i += 64) { + this.md5cycle(state, this.md5blk(s2.substring(i - 64, i))); + } + s2 = s2.substring(i - 64); + const tail = [0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]; + for (i = 0; i < s2.length; i++) { + tail[i >> 2] |= s2.charCodeAt(i) << (i % 4 << 3); + } + tail[i >> 2] |= 128 << (i % 4 << 3); + if (i > 55) { + this.md5cycle(state, tail); + for (i = 0; i < 16; i++) { + tail[i] = 0; + } + } + tail[14] = n * 8; + this.md5cycle(state, tail); + return state; + } + /* there needs to be support for Unicode here, * unless we pretend that we can redefine the MD-5 + * algorithm for multi-byte characters (perhaps by adding every four 16-bit characters and + * shortening the sum to 32 bits). Otherwise I suthis.ggest performing MD-5 as if every character + * was two bytes--e.g., 0040 0025 = @%--but then how will an ordinary MD-5 sum be matched? + * There is no way to standardize text to something like UTF-8 before transformation; speed cost is + * utterly prohibitive. The JavaScript standard itself needs to look at this: it should start + * providing access to strings as preformed UTF-8 8-bit unsigned value arrays. + */ + md5blk(s2) { + const md5blks = []; + for (let i = 0; i < 64; i += 4) { + md5blks[i >> 2] = s2.charCodeAt(i) + (s2.charCodeAt(i + 1) << 8) + (s2.charCodeAt(i + 2) << 16) + (s2.charCodeAt(i + 3) << 24); + } + return md5blks; + } + rhex(n) { + const hex_chr = "0123456789abcdef".split(""); + let s2 = "", j = 0; + for (; j < 4; j++) { + s2 += hex_chr[n >> j * 8 + 4 & 15] + hex_chr[n >> j * 8 & 15]; + } + return s2; + } + hex(x) { + for (let i = 0; i < x.length; i++) { + x[i] = this.rhex(x[i]); + } + return x.join(""); + } + md5(s2) { + return this.hex(this.md51(s2)); + } + add32(a, b) { + return this.ieCompatibility ? this.add32Compat(a, b) : this.add32Std(a, b); + } + /* this function is much faster, so if possible we use it. Some IEs are the only ones I know of that + need the idiotic second function, generated by an if clause. */ + add32Std(a, b) { + return a + b & 4294967295; + } + add32Compat(x, y) { + const lsw = (x & 65535) + (y & 65535), msw = (x >> 16) + (y >> 16) + (lsw >> 16); + return msw << 16 | lsw & 65535; + } +}; + +// packages/ag-grid-enterprise/src/license/shared/licenseManager.ts +var LICENSE_TYPES = { + "01": "GRID", + "02": "CHARTS", + "0102": "BOTH" +}; +var LICENSING_HELP_URL = "https://www.ag-grid.com/licensing/"; +var _LicenseManager = class _LicenseManager { + constructor(document2) { + this.watermarkMessage = void 0; + this.totalMessageLength = 124; + this.document = document2; + this.md5 = new MD5(); + this.md5.init(); + } + validateLicense() { + const licenseDetails = this.getLicenseDetails(_LicenseManager.licenseKey); + const currentLicenseName = `AG Grid ${licenseDetails.currentLicenseType === "BOTH" ? "and AG Charts " : ""}Enterprise`; + const suppliedLicenseName = licenseDetails.suppliedLicenseType === void 0 ? "" : `AG ${licenseDetails.suppliedLicenseType === "BOTH" ? "Grid and AG Charts" : licenseDetails.suppliedLicenseType === "GRID" ? "Grid" : "Charts"} Enterprise`; + if (licenseDetails.missing) { + if (!this.isWebsiteUrl() || this.isForceWatermark()) { + this.outputMissingLicenseKey(currentLicenseName); + } + } else if (licenseDetails.expired) { + const gridReleaseDate = _LicenseManager.getGridReleaseDate(); + const formattedReleaseDate = _LicenseManager.formatDate(gridReleaseDate); + this.outputExpiredKey(licenseDetails.expiry, formattedReleaseDate, currentLicenseName, suppliedLicenseName); + } else if (!licenseDetails.valid) { + this.outputInvalidLicenseKey( + !!licenseDetails.incorrectLicenseType, + currentLicenseName, + suppliedLicenseName + ); + } else if (licenseDetails.isTrial && licenseDetails.trialExpired) { + this.outputExpiredTrialKey(licenseDetails.expiry, currentLicenseName, suppliedLicenseName); + } + } + static extractExpiry(license) { + const restrictionHashed = license.substring(license.lastIndexOf("_") + 1, license.length); + return new Date(parseInt(_LicenseManager.decode(restrictionHashed), 10)); + } + static extractLicenseComponents(licenseKey) { + let cleanedLicenseKey = licenseKey.replace(/[\u200B-\u200D\uFEFF]/g, ""); + cleanedLicenseKey = cleanedLicenseKey.replace(/\r?\n|\r/g, ""); + if (licenseKey.length <= 32) { + return { md5: null, license: licenseKey, version: null, isTrial: null }; + } + const hashStart = cleanedLicenseKey.length - 32; + const md5 = cleanedLicenseKey.substring(hashStart); + const license = cleanedLicenseKey.substring(0, hashStart); + const [version, isTrial, type] = _LicenseManager.extractBracketedInformation(cleanedLicenseKey); + return { md5, license, version, isTrial, type }; + } + getLicenseDetails(licenseKey) { + const currentLicenseType = _LicenseManager.chartsLicenseManager ? "BOTH" : "GRID"; + if (!licenseKey?.length) { + return { + licenseKey, + valid: false, + missing: true, + currentLicenseType + }; + } + const gridReleaseDate = _LicenseManager.getGridReleaseDate(); + const { md5, license, version, isTrial, type } = _LicenseManager.extractLicenseComponents(licenseKey); + let valid = md5 === this.md5.md5(license) && !licenseKey.includes("For_Trialing_ag-Grid_Only"); + let trialExpired = void 0; + let expired = void 0; + let expiry = null; + let incorrectLicenseType = false; + let suppliedLicenseType = void 0; + function handleTrial() { + const now = /* @__PURE__ */ new Date(); + trialExpired = expiry < now; + expired = void 0; + } + if (valid) { + expiry = _LicenseManager.extractExpiry(license); + valid = !isNaN(expiry.getTime()); + if (valid) { + expired = gridReleaseDate > expiry; + switch (version) { + case "legacy": + case "2": { + if (isTrial) { + handleTrial(); + } + break; + } + case "3": { + if (!type?.length) { + valid = false; + } else { + suppliedLicenseType = type; + if (type !== LICENSE_TYPES["01"] && type !== LICENSE_TYPES["0102"] || currentLicenseType === "BOTH" && suppliedLicenseType !== "BOTH") { + valid = false; + incorrectLicenseType = true; + } else if (isTrial) { + handleTrial(); + } + } + } + } + } + } + if (!valid) { + return { + licenseKey, + valid, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + return { + licenseKey, + valid, + expiry: _LicenseManager.formatDate(expiry), + expired, + version, + isTrial, + trialExpired, + incorrectLicenseType, + currentLicenseType, + suppliedLicenseType + }; + } + isDisplayWatermark() { + return this.isForceWatermark() || !this.isLocalhost() && !this.isWebsiteUrl() && !!this.watermarkMessage?.length; + } + getWatermarkMessage() { + return this.watermarkMessage || ""; + } + getHostname() { + const win = this.document.defaultView || window; + const loc = win.location; + const { hostname = "" } = loc; + return hostname; + } + isForceWatermark() { + const win = this.document.defaultView || window; + const loc = win.location; + const { pathname } = loc; + return pathname ? pathname.includes("forceWatermark") : false; + } + isWebsiteUrl() { + const hostname = this.getHostname(); + return hostname.match(/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/) !== null; + } + isLocalhost() { + const hostname = this.getHostname(); + return hostname.match(/^(?:127\.0\.0\.1|localhost)$/) !== null; + } + static formatDate(date) { + const monthNames = [ + "January", + "February", + "March", + "April", + "May", + "June", + "July", + "August", + "September", + "October", + "November", + "December" + ]; + const day = date.getDate(); + const monthIndex = date.getMonth(); + const year = date.getFullYear(); + return day + " " + monthNames[monthIndex] + " " + year; + } + static getGridReleaseDate() { + return new Date(parseInt(_LicenseManager.decode(_LicenseManager.RELEASE_INFORMATION), 10)); + } + static decode(input) { + const keystr = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/="; + let t = ""; + let n, r, i; + let s2, o, u, a; + let f = 0; + const e = input.replace(/[^A-Za-z0-9+/=]/g, ""); + while (f < e.length) { + s2 = keystr.indexOf(e.charAt(f++)); + o = keystr.indexOf(e.charAt(f++)); + u = keystr.indexOf(e.charAt(f++)); + a = keystr.indexOf(e.charAt(f++)); + n = s2 << 2 | o >> 4; + r = (o & 15) << 4 | u >> 2; + i = (u & 3) << 6 | a; + t = t + String.fromCharCode(n); + if (u != 64) { + t = t + String.fromCharCode(r); + } + if (a != 64) { + t = t + String.fromCharCode(i); + } + } + t = _LicenseManager.utf8_decode(t); + return t; + } + static utf8_decode(input) { + input = input.replace(/rn/g, "n"); + let t = ""; + for (let n = 0; n < input.length; n++) { + const r = input.charCodeAt(n); + if (r < 128) { + t += String.fromCharCode(r); + } else if (r > 127 && r < 2048) { + t += String.fromCharCode(r >> 6 | 192); + t += String.fromCharCode(r & 63 | 128); + } else { + t += String.fromCharCode(r >> 12 | 224); + t += String.fromCharCode(r >> 6 & 63 | 128); + t += String.fromCharCode(r & 63 | 128); + } + } + return t; + } + static setChartsLicenseManager(dependantLicenseManager) { + this.chartsLicenseManager = dependantLicenseManager; + this.chartsLicenseManager?.setLicenseKey(this.licenseKey, true); + } + static setLicenseKey(licenseKey) { + if (_exists(this.licenseKey) && this.licenseKey !== licenseKey) { + _logPreInitWarn( + 291, + void 0, + "AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used." + ); + } + this.licenseKey = licenseKey; + this.chartsLicenseManager?.setLicenseKey(licenseKey, true); + } + static extractBracketedInformation(licenseKey) { + if (!licenseKey.includes("[")) { + return ["legacy", false, void 0]; + } + const matches = licenseKey.match(/\[(.*?)\]/g).map((match) => match.replace("[", "").replace("]", "")); + if (!matches || matches.length === 0) { + return ["legacy", false, void 0]; + } + const isTrial = matches.filter((match) => match === "TRIAL").length === 1; + const rawVersion = matches.filter((match) => match.indexOf("v") === 0)[0]; + const version = rawVersion ? rawVersion.replace("v", "") : "legacy"; + const type = LICENSE_TYPES[matches.filter((match) => LICENSE_TYPES[match])[0]]; + return [version, isTrial, type]; + } + centerPadAndOutput(input) { + const paddingRequired = this.totalMessageLength - input.length; + } + padAndOutput(input, padding = "*", terminateWithPadding = "") { + } + outputInvalidLicenseKey(incorrectLicenseType, currentLicenseName, suppliedLicenseName) { + } + outputExpiredTrialKey(formattedExpiryDate, currentLicenseName, suppliedLicenseName) { + } + outputMissingLicenseKey(currentLicenseName) { + } + outputExpiredKey(formattedExpiryDate, formattedReleaseDate, currentLicenseName, suppliedLicenseName) { + } +}; +// eslint-disable-next-line no-restricted-syntax +_LicenseManager.RELEASE_INFORMATION = "MTc3NDQyNTc0Nzc3NQ=="; +var LicenseManager = _LicenseManager; + +// packages/ag-grid-enterprise/src/license/watermark.ts +import { Component, RefPlaceholder } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/license/watermark.css +var watermark_default = '.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}'; + +// packages/ag-grid-enterprise/src/license/watermark.ts +var WatermarkElement = { + tag: "div", + cls: "ag-watermark", + children: [{ tag: "div", ref: "eLicenseTextRef", cls: "ag-watermark-text" }] +}; +var AgWatermark = class extends Component { + constructor() { + super(WatermarkElement); + this.eLicenseTextRef = RefPlaceholder; + this.registerCSS(watermark_default); + } + wireBeans(beans) { + this.licenseManager = beans.licenseManager; + } + postConstruct() { + const show = this.shouldDisplayWatermark(); + this.setDisplayed(show); + if (show) { + this.eLicenseTextRef.textContent = this.licenseManager.getWatermarkMessage(); + window.setTimeout(() => this.addCss("ag-opacity-zero"), 0); + window.setTimeout(() => this.setDisplayed(false), 5e3); + } + } + shouldDisplayWatermark() { + return this.licenseManager.isDisplayWatermark(); + } +}; +var AgWatermarkSelector = { + selector: "AG-WATERMARK", + component: AgWatermark +}; + +// packages/ag-grid-enterprise/src/license/gridLicenseManager.ts +var GridLicenseManager = class extends BeanStub { + constructor() { + super(...arguments); + this.beanName = "licenseManager"; + } + postConstruct() { + this.validateLicense(); + } + validateLicense() { + const beans = this.beans; + if (beans.withinStudio) { + this.licenseManager = { + isDisplayWatermark: () => false, + getWatermarkMessage: () => "" + }; + } else { + const licenseManager = new LicenseManager(_getDocument(beans)); + this.licenseManager = licenseManager; + licenseManager.validateLicense(); + } + } + static getLicenseDetails(licenseKey) { + return new LicenseManager(null).getLicenseDetails(licenseKey); + } + getWatermarkSelector() { + return AgWatermarkSelector; + } + isDisplayWatermark() { + return this.licenseManager.isDisplayWatermark(); + } + getWatermarkMessage() { + return this.licenseManager.getWatermarkMessage(); + } + static setLicenseKey(licenseKey) { + LicenseManager.setLicenseKey(licenseKey); + } + static setChartsLicenseManager(chartsLicenseManager) { + LicenseManager.setChartsLicenseManager(chartsLicenseManager); + } +}; + +// packages/ag-grid-enterprise/src/excelExport/excelCreator.ts +import { + BaseCreator, + _addGridCommonParams as _addGridCommonParams2, + _downloadFile, + _getHeaderClassesFromColDef, + _getHeaderRowCount, + _warn as _warn3 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/excelSerializingSession.ts +import { + BaseGridSerializingSession, + _addGridCommonParams, + _isExpressionString, + _last, + _mergeDeep, + _warn +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts +import { _escapeString } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/assets/excelConstants.ts +var INCH_TO_EMU = 9525; +var numberFormatMap = { + "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 +}; + +// packages/ag-grid-enterprise/src/excelExport/assets/xmlFactory.ts +var LINE_SEPARATOR = "\r\n"; +function returnAttributeIfPopulated(key, value, booleanTransformer) { + if (!value && value !== "" && value !== 0) { + return ""; + } + let xmlValue = value; + if (typeof value === "boolean") { + if (booleanTransformer) { + xmlValue = booleanTransformer(value); + } + } + return ` ${key}="${xmlValue}"`; +} +function createXmlHeader(headerElement = {}) { + const headerStart = ""; + const keys = ["version"]; + if (!headerElement.version) { + headerElement.version = "1.0"; + } + if (headerElement.encoding) { + keys.push("encoding"); + } + if (headerElement.standalone) { + keys.push("standalone"); + } + const att = keys.map((key) => `${key}="${headerElement[key]}"`).join(" "); + return `${headerStart}xml ${att} ${headerEnd}`; +} +function createXml(xmlElement, booleanTransformer) { + let props = ""; + if (xmlElement.properties) { + if (xmlElement.properties.prefixedAttributes) { + xmlElement.properties.prefixedAttributes.forEach((prefixedSet) => { + for (const key of Object.keys(prefixedSet.map)) { + props += returnAttributeIfPopulated( + prefixedSet.prefix + key, + prefixedSet.map[key], + booleanTransformer + ); + } + }); + } + if (xmlElement.properties.rawMap) { + for (const key of Object.keys(xmlElement.properties.rawMap)) { + props += returnAttributeIfPopulated(key, xmlElement.properties.rawMap[key], booleanTransformer); + } + } + } + let result = "<" + xmlElement.name + props; + if (!xmlElement.children && xmlElement.textNode == null) { + return result + "/>" + LINE_SEPARATOR; + } + if (xmlElement.textNode != null) { + return result + ">" + xmlElement.textNode + "" + LINE_SEPARATOR; + } + result += ">" + LINE_SEPARATOR; + if (xmlElement.children) { + for (const it of xmlElement.children) { + result += createXml(it, booleanTransformer); + } + } + return result + "" + LINE_SEPARATOR; +} + +// packages/ag-grid-enterprise/src/excelExport/assets/excelUtils.ts +var pointsToPixel = (points) => { + return Math.round(points * 96 / 72); +}; +var pixelsToEMU = (value) => { + return Math.ceil(value * INCH_TO_EMU); +}; +var getFontFamilyId = (name) => { + if (name === void 0) { + return; + } + const families = ["Automatic", "Roman", "Swiss", "Modern", "Script", "Decorative"]; + const pos = families.indexOf(name || "Automatic"); + return Math.max(pos, 0); +}; +var getHeightFromProperty = (rowIndex, height) => { + if (!height) { + return; + } + let finalHeight; + if (typeof height === "number") { + finalHeight = height; + } else { + const heightFunc = height; + finalHeight = heightFunc({ rowIndex }); + } + return finalHeight; +}; +var setExcelImageTotalWidth = (image, columnsToExport) => { + const { colSpan, column } = image.position; + if (!image.width) { + return; + } + if (colSpan) { + const columnsInSpan = columnsToExport.slice(column - 1, column + colSpan - 1); + let totalWidth = 0; + for (let i = 0; i < columnsInSpan.length; i++) { + const colWidth = columnsInSpan[i].getActualWidth(); + if (image.width < totalWidth + colWidth) { + image.position.colSpan = i + 1; + image.totalWidth = image.width; + image.width = image.totalWidth - totalWidth; + break; + } + totalWidth += colWidth; + } + } else { + image.totalWidth = image.width; + } +}; +var setExcelImageTotalHeight = (image, rowHeight) => { + const { rowSpan, row } = image.position; + if (!image.height) { + return; + } + if (rowSpan) { + let totalHeight = 0; + let counter = 0; + for (let i = row; i < row + rowSpan; i++) { + const nextRowHeight = pointsToPixel(getHeightFromProperty(i, rowHeight) || 20); + if (image.height < totalHeight + nextRowHeight) { + image.position.rowSpan = counter + 1; + image.totalHeight = image.height; + image.height = image.totalHeight - totalHeight; + break; + } + totalHeight += nextRowHeight; + counter++; + } + } else { + image.totalHeight = image.height; + } +}; +var createXmlPart = (body, skipHeader) => { + const header = createXmlHeader({ + encoding: "UTF-8", + standalone: "yes" + }); + const xmlBody = createXml(body); + if (skipHeader) { + return xmlBody; + } + return `${header}${xmlBody}`; +}; +var getExcelColumnName = (colIdx) => { + const startCode = 65; + const tableWidth = 26; + const fromCharCode = String.fromCharCode; + const pos = Math.floor(colIdx / tableWidth); + const tableIdx = colIdx % tableWidth; + if (!pos || colIdx === tableWidth) { + return fromCharCode(startCode + colIdx - 1); + } + if (!tableIdx) { + return getExcelColumnName(pos - 1) + "Z"; + } + if (pos < tableWidth) { + return fromCharCode(startCode + pos - 1) + fromCharCode(startCode + tableIdx - 1); + } + return getExcelColumnName(pos) + fromCharCode(startCode + tableIdx - 1); +}; +var sanitizeTableName = (name) => { + return name.replaceAll("\n", "_x000a_"); +}; +var replaceInvisibleCharacters = (str) => { + if (str == null) { + return null; + } + let newString = ""; + for (let i = 0; i < str.length; i++) { + const point = str.charCodeAt(i); + if (point >= 0 && point <= 31 && point !== 10) { + const convertedCode = point.toString(16).toUpperCase(); + const paddedCode = convertedCode.padStart(4, "0"); + const newValue = `_x${paddedCode}_`; + newString += newValue; + } else { + newString += str[i]; + } + } + return newString; +}; +var buildSharedString = (strMap) => { + const ret = []; + for (const key of strMap.keys()) { + const textNode = key.toString(); + const child = { + name: "t", + textNode: _escapeString(replaceInvisibleCharacters(textNode)) + }; + const preserveSpaces = textNode.trim().length !== textNode.length; + if (preserveSpaces) { + child.properties = { + rawMap: { + "xml:space": "preserve" + } + }; + } + ret.push({ + name: "si", + children: [child] + }); + } + return ret; +}; + +// packages/ag-grid-enterprise/src/excelExport/excelSerializingSession.ts +var ExcelSerializingSession = class extends BaseGridSerializingSession { + constructor(config) { + super(config); + this.mixedStyles = {}; + this.mixedStyleCounter = 0; + this.rows = []; + this.frozenRowCount = 0; + this.skipFrozenRows = false; + this.frozenColumnCount = 0; + this.skipFrozenColumns = false; + this.formulaSvc = config.formulaSvc; + this.config = Object.assign({}, config); + this.workbook = config.workbook; + this.stylesByIds = {}; + for (const style of this.config.baseExcelStyles) { + this.stylesByIds[style.id] = style; + } + const quotePrefixStyle = { id: "_quotePrefix", quotePrefix: 1 }; + this.stylesByIds[quotePrefixStyle.id] = quotePrefixStyle; + this.excelStyles = [...this.config.baseExcelStyles, quotePrefixStyle]; + } + addCustomContent(customContent) { + for (const row of customContent) { + const rowLen = this.rows.length + 1; + let outlineLevel; + if (!this.config.suppressRowOutline && row.outlineLevel != null) { + outlineLevel = row.outlineLevel; + } + const rowObj = { + height: getHeightFromProperty(rowLen, row.height || this.config.rowHeight), + cells: (row.cells || []).map((cell, idx) => { + const image = this.addImage(rowLen, this.columnsToExport[idx], cell.data?.value); + let excelStyles = null; + if (cell.styleId) { + excelStyles = typeof cell.styleId === "string" ? [cell.styleId] : cell.styleId; + } + const excelStyleId = this.getStyleId(excelStyles); + if (image) { + return this.createCell( + excelStyleId, + this.getDataTypeForValue(image.value), + image.value == null ? "" : image.value + ); + } + const value = cell.data?.value ?? ""; + const type = this.getDataTypeForValue(value); + if (cell.mergeAcross) { + return this.createMergedCell(excelStyleId, type, value, cell.mergeAcross); + } + return this.createCell(excelStyleId, type, value); + }), + outlineLevel + }; + if (row.collapsed != null) { + rowObj.collapsed = row.collapsed; + } + if (row.hidden != null) { + rowObj.hidden = row.hidden; + } + this.rows.push(rowObj); + } + } + onNewHeaderGroupingRow() { + const currentCells = []; + const { freezeRows, headerRowHeight } = this.config; + this.rows.push({ + cells: currentCells, + height: getHeightFromProperty(this.rows.length + 1, headerRowHeight) + }); + if (freezeRows) { + this.frozenRowCount++; + } + return { + onColumn: (columnGroup, header, index, span, collapsibleGroupRanges) => { + const styleIds = this.config.styleLinker({ + rowType: "HEADER_GROUPING", + rowIndex: 1, + value: `grouping-${header}`, + columnGroup + }); + currentCells.push({ + ...this.createMergedCell( + this.getStyleId(styleIds), + this.getDataTypeForValue("string"), + header, + span + ), + collapsibleRanges: collapsibleGroupRanges + }); + } + }; + } + onNewHeaderRow() { + const { freezeRows, headerRowHeight } = this.config; + if (freezeRows) { + this.frozenRowCount++; + } + return this.onNewRow(this.onNewHeaderColumn, headerRowHeight); + } + onNewBodyRow(node) { + const { freezeRows, rowHeight } = this.config; + if (!this.skipFrozenRows) { + if (freezeRows === "headersAndPinnedRows" && node?.rowPinned === "top") { + this.frozenRowCount++; + } else if (typeof freezeRows === "function") { + if (freezeRows(_addGridCommonParams(this.gos, { node }))) { + this.frozenRowCount++; + } else { + this.skipFrozenRows = true; + } + } else { + this.skipFrozenRows = true; + } + } + const rowAccumulator = this.onNewRow(this.onNewBodyColumn, rowHeight); + if (node) { + this.addRowOutlineIfNecessary(node); + } + return rowAccumulator; + } + prepare(columnsToExport) { + super.prepare(columnsToExport); + this.columnsToExport = [...columnsToExport]; + this.cols = columnsToExport.map((col, i) => this.convertColumnToExcel(col, i)); + } + parse() { + const longestRow = this.rows.reduce((a, b) => Math.max(a, b.cells.length), 0); + while (this.cols.length < longestRow) { + this.cols.push(this.convertColumnToExcel(null, this.cols.length + 1)); + } + const worksheet = this.createWorksheet(); + return this.addWorksheetToWorkbook(worksheet); + } + createWorksheet() { + const { sheetName } = this.config; + let name; + if (sheetName != null) { + const sheetNameValue = typeof sheetName === "function" ? sheetName(_addGridCommonParams(this.gos, {})) : sheetName; + name = String(sheetNameValue).substring(0, 31); + } else { + name = "ag-grid"; + } + return { + name, + table: { + columns: this.cols, + rows: this.rows + } + }; + } + addRowOutlineIfNecessary(node) { + const { gos, suppressRowOutline, rowGroupExpandState = "expanded" } = this.config; + const isGroupHideOpenParents = gos.get("groupHideOpenParents"); + if (isGroupHideOpenParents || suppressRowOutline || node.level == null) { + return; + } + const padding = node.footer ? 1 : 0; + const currentRow = _last(this.rows); + if (node.uiLevel == null || node.level === node.uiLevel) { + const outlineLevel = Math.min(node.level + padding, 7); + currentRow.outlineLevel = outlineLevel; + } + if (rowGroupExpandState === "expanded") { + return; + } + const collapseAll = rowGroupExpandState === "collapsed"; + if (node.isExpandable()) { + const isExpanded = !collapseAll && node.expanded; + currentRow.collapsed = !isExpanded; + } + currentRow.hidden = // always show the node if there is no parent to be expanded + !!node.parent && // or if it is a child of the root node + node.parent.level !== -1 && (collapseAll || this.isAnyParentCollapsed(node.parent)); + } + isAnyParentCollapsed(node) { + while (node && node.level !== -1) { + if (!node.expanded) { + return true; + } + node = node.parent; + } + return false; + } + convertColumnToExcel(column, index) { + const columnWidth = this.config.columnWidth; + const headerValue = column ? this.extractHeaderValue(column) : void 0; + const displayName = headerValue ?? ""; + const filterAllowed = column ? column.isFilterAllowed() : false; + if (columnWidth) { + if (typeof columnWidth === "number") { + return { width: columnWidth, displayName, filterAllowed }; + } + return { width: columnWidth({ column, index }), displayName, filterAllowed }; + } + if (column) { + const smallestUsefulWidth = 75; + return { width: Math.max(column.getActualWidth(), smallestUsefulWidth), displayName, filterAllowed }; + } + return { + displayName, + filterAllowed + }; + } + onNewHeaderColumn(rowIndex, currentCells) { + return (column) => { + const nameForCol = this.extractHeaderValue(column); + const styleIds = this.config.styleLinker({ + rowType: "HEADER", + rowIndex, + value: nameForCol, + column + }); + currentCells.push( + this.createCell(this.getStyleId(styleIds), this.getDataTypeForValue("string"), nameForCol) + ); + }; + } + onNewBodyColumn(rowIndex, currentCells) { + let skipCols = 0; + const { freezeColumns, rightToLeft } = this.config; + return (column, index, node) => { + if (skipCols > 0) { + skipCols -= 1; + return; + } + if (!this.skipFrozenColumns) { + const pinned = column.getPinned(); + const isPinnedLeft = pinned === true || pinned === "left"; + if (freezeColumns === "pinned" && pinned && isPinnedLeft !== rightToLeft) { + this.frozenColumnCount++; + } else if (typeof freezeColumns === "function" && freezeColumns(_addGridCommonParams(this.gos, { column }))) { + this.frozenColumnCount++; + } else { + this.skipFrozenColumns = true; + } + } + const { value: valueForCell, valueFormatted } = this.extractRowCellValue({ + column, + node, + currentColumnIndex: index, + accumulatedRowIndex: rowIndex, + type: "excel", + useRawFormula: true + }); + const rawValueForCell = valueForCell; + const valueForCellString = typeof rawValueForCell === "bigint" ? rawValueForCell.toString() : rawValueForCell; + const styleIds = this.config.styleLinker({ + rowType: "BODY", + rowIndex, + value: rawValueForCell, + column, + node + }); + const excelStyleId = this.getStyleId(styleIds); + const colSpan = column.getColSpan(node); + const addedImage = this.addImage(rowIndex, column, valueForCellString); + if (addedImage) { + currentCells.push( + this.createCell( + excelStyleId, + this.getDataTypeForValue(addedImage.value), + addedImage.value == null ? "" : addedImage.value + ) + ); + } else if (colSpan > 1) { + skipCols = colSpan - 1; + currentCells.push( + this.createMergedCell( + excelStyleId, + this.getDataTypeForValue(rawValueForCell), + valueForCellString, + colSpan - 1 + ) + ); + } else { + const isFormula = column.isAllowFormula() && this.formulaSvc?.isFormula(valueForCellString); + const cell = this.createCell( + excelStyleId, + isFormula ? "f" : this.getDataTypeForValue(rawValueForCell), + isFormula ? this.formulaSvc?.updateFormulaByOffset({ + value: valueForCellString, + rowDelta: rowIndex - (node.formulaRowIndex + 1), + useRefFormat: false + }) : valueForCellString, + valueFormatted + ); + currentCells.push(cell); + } + }; + } + onNewRow(onNewColumnAccumulator, height) { + const currentCells = []; + this.rows.push({ + cells: currentCells, + height: getHeightFromProperty(this.rows.length + 1, height) + }); + return { + onColumn: onNewColumnAccumulator.bind(this, this.rows.length, currentCells)() + }; + } + addWorksheetToWorkbook(worksheet) { + const { excelStyles, config } = this; + this.mapSharedStrings(worksheet); + if (this.frozenColumnCount) { + config.frozenColumnCount = this.frozenColumnCount; + } + if (this.frozenRowCount) { + config.frozenRowCount = this.frozenRowCount; + } + return this.workbook.addWorksheet(excelStyles, worksheet, config); + } + mapSharedStrings(worksheet) { + let emptyStringPosition; + for (const row of worksheet.table.rows) { + for (const cell of row.cells) { + const data = cell.data; + if (!data || data.type !== "s") { + continue; + } + const value = data.value; + if (value == null) { + continue; + } + if (value === "") { + emptyStringPosition ?? (emptyStringPosition = this.workbook.getStringPosition("").toString()); + data.value = emptyStringPosition; + continue; + } + data.value = this.workbook.getStringPosition(String(value)).toString(); + } + } + } + getDataTypeForValue(valueForCell) { + if (valueForCell === void 0) { + return "empty"; + } + let dataType = "s"; + try { + if (this.isNumerical(valueForCell)) { + dataType = "n"; + } + } catch (e) { + } + return dataType; + } + getTypeFromStyle(style, value) { + if (this.isFormula(value)) { + return "f"; + } + if (style?.dataType) { + switch (style.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: + _warn(162, { id: style.id, dataType: style.dataType }); + } + } + return null; + } + addImage(rowIndex, column, value) { + if (!this.config.addImageToCell) { + return; + } + const addedImage = this.config.addImageToCell(rowIndex, column, value); + if (!addedImage) { + return; + } + this.workbook.addBodyImageToMap( + addedImage.image, + rowIndex, + column, + this.columnsToExport, + this.config.rowHeight + ); + return addedImage; + } + createCell(styleId, type, value, valueFormatted) { + const actualStyle = this.getStyleById(styleId); + if (!actualStyle?.dataType && type === "s" && valueFormatted != null) { + value = valueFormatted; + } + const processedType = this.getTypeFromStyle(actualStyle, value) || type; + const { value: processedValue, escaped } = this.getCellValue(processedType, value); + const styles = []; + if (actualStyle) { + styles.push(styleId); + } + if (escaped) { + styles.push("_quotePrefix"); + } + styleId = this.getStyleId(styles) || void 0; + return { + styleId, + data: { + type: processedType, + value: processedValue + } + }; + } + createMergedCell(styleId, type, value, numOfCells) { + const valueToUse = value == null ? "" : value; + return { + styleId: this.getStyleById(styleId) ? styleId : void 0, + data: { + type, + value: type === "s" ? String(valueToUse) : value + }, + mergeAcross: numOfCells + }; + } + getCellValue(type, value) { + let escaped = false; + if (value == null || type === "s" && value === "") { + return { value: "", escaped: false }; + } + if (type === "s") { + value = String(value); + if (value[0] === "'") { + escaped = true; + value = value.slice(1); + } + } else if (type === "f") { + value = this.addXlfnPrefix(value).slice(1); + } else if (type === "n") { + const numberValue = Number(value); + if (isNaN(numberValue)) { + value = ""; + } else if (value !== "") { + value = numberValue.toString(); + } + } + return { value, escaped }; + } + addXlfnPrefix(value) { + if (!value) { + return value; + } + const concatRegex = /(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi; + return value.replace(concatRegex, (_match, prefix, fn, openParen) => `${prefix}_xlfn.${fn}${openParen}`); + } + getStyleId(styleIds) { + if (!styleIds?.length) { + return null; + } + const filteredStyleIds = styleIds.filter((styleId) => this.stylesByIds[styleId] != null); + if (!filteredStyleIds.length) { + return null; + } + if (filteredStyleIds.length === 1) { + return filteredStyleIds[0]; + } + const key = filteredStyleIds.join("-"); + if (!this.mixedStyles[key]) { + this.addNewMixedStyle(filteredStyleIds); + } + return this.mixedStyles[key].excelID; + } + addNewMixedStyle(styleIds) { + this.mixedStyleCounter += 1; + const excelId = `mixedStyle${this.mixedStyleCounter}`; + const resultantStyle = {}; + for (const styleId of styleIds) { + const excelStyle = this.stylesByIds[styleId]; + if (excelStyle) { + _mergeDeep(resultantStyle, excelStyle, true, true); + } + } + resultantStyle.id = excelId; + const key = styleIds.join("-"); + this.mixedStyles[key] = { + excelID: excelId, + key, + result: resultantStyle + }; + this.excelStyles.push(resultantStyle); + this.stylesByIds[excelId] = resultantStyle; + } + isFormula(value) { + if (value == null) { + return false; + } + const strValue = String(value); + return this.config.autoConvertFormulas && _isExpressionString(strValue); + } + isNumerical(value) { + if (typeof value === "bigint") { + return false; + } + return isFinite(value) && value !== "" && !isNaN(parseFloat(value)); + } + getStyleById(styleId) { + if (styleId == null) { + return null; + } + return this.stylesByIds[styleId] || null; + } +}; + +// packages/ag-grid-enterprise/src/excelExport/excelXlsxFactory.ts +import { _escapeString as _escapeString7, _warn as _warn2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/contentType.ts +var contentTypeFactory = { + getTemplate(config) { + const { name, ContentType, Extension, PartName } = config; + return { + name, + properties: { + rawMap: { + Extension, + PartName, + ContentType + } + } + }; + } +}; +var contentType_default = contentTypeFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/contentTypes.ts +var _normaliseImageExtension = (ext) => ext === "jpg" ? "jpeg" : ext; +var contentTypesFactory = { + getTemplate({ sheetLen, hasCustomProperties }) { + const worksheets = new Array(sheetLen).fill(void 0).map((v, i) => ({ + name: "Override", + ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml", + PartName: `/xl/worksheets/sheet${i + 1}.xml` + })); + const sheetsWithImages = XLSX_WORKSHEET_IMAGES.size; + const headerFooterImages = XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.size; + const imageTypesObject = {}; + XLSX_WORKBOOK_IMAGE_IDS.forEach((v) => { + imageTypesObject[_normaliseImageExtension(v.type)] = true; + }); + const imageDocs = new Array(sheetsWithImages).fill(void 0).map((v, i) => ({ + name: "Override", + ContentType: "application/vnd.openxmlformats-officedocument.drawing+xml", + PartName: `/xl/drawings/drawing${i + 1}.xml` + })); + const tableDocs = []; + XLSX_WORKSHEET_DATA_TABLES.forEach(({ name }) => { + tableDocs.push({ + name: "Override", + ContentType: "application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml", + PartName: `/xl/tables/${name}.xml` + }); + }); + const customPropertiesDocs = hasCustomProperties ? [ + { + name: "Override", + ContentType: "application/vnd.openxmlformats-officedocument.custom-properties+xml", + PartName: "/docProps/custom.xml" + } + ] : []; + const imageTypes = Object.keys(imageTypesObject).map((ext) => ({ + name: "Default", + ContentType: `image/${ext}`, + Extension: ext + })); + if (headerFooterImages) { + imageTypes.push({ + name: "Default", + Extension: "vml", + ContentType: "application/vnd.openxmlformats-officedocument.vmlDrawing" + }); + } + const children = [ + ...imageTypes, + { + 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" + }, + ...worksheets, + { + 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" + }, + ...imageDocs, + ...tableDocs, + { + name: "Override", + ContentType: "application/vnd.openxmlformats-package.core-properties+xml", + PartName: "/docProps/core.xml" + }, + ...customPropertiesDocs + ].map((contentType) => contentType_default.getTemplate(contentType)); + return { + name: "Types", + properties: { + rawMap: { + xmlns: "http://schemas.openxmlformats.org/package/2006/content-types" + } + }, + children + }; + } +}; +var contentTypes_default = contentTypesFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/core.ts +var coreFactory = { + getTemplate(author) { + const dt = /* @__PURE__ */ new Date(); + const jsonDate = dt.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: author + }, + { + name: "dc:title", + textNode: "Workbook" + }, + { + name: "dcterms:created", + properties: { + rawMap: { + "xsi:type": "dcterms:W3CDTF" + } + }, + textNode: jsonDate + }, + { + name: "dcterms:modified", + properties: { + rawMap: { + "xsi:type": "dcterms:W3CDTF" + } + }, + textNode: jsonDate + } + ] + }; + } +}; +var core_default = coreFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/customProperties.ts +import { _escapeString as _escapeString2 } from "ag-grid-community"; +var DEFAULT_FMTID = "{D5CDD505-2E9C-101B-9397-08002B2CF9AE}"; +var buildPropertyElements = (metadata) => { + const keys = Object.keys(metadata).filter((name) => name && metadata[name] != null); + return keys.map((name, index) => ({ + name: "property", + properties: { + rawMap: { + fmtid: DEFAULT_FMTID, + pid: (index + 2).toString(), + name: _escapeString2(name) ?? "" + } + }, + children: [ + { + name: "vt:lpwstr", + textNode: _escapeString2(replaceInvisibleCharacters(String(metadata[name]))) ?? "" + } + ] + })); +}; +var customPropertiesFactory = { + getTemplate(metadata) { + return { + name: "Properties", + properties: { + rawMap: { + xmlns: "http://schemas.openxmlformats.org/officeDocument/2006/custom-properties", + "xmlns:vt": "http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes" + } + }, + children: buildPropertyElements(metadata) + }; + } +}; +var customProperties_default = customPropertiesFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/drawing.ts +var getAnchor = (name, imageAnchor) => ({ + name: `xdr:${name}`, + children: [ + { + name: "xdr:col", + textNode: imageAnchor.col.toString() + }, + { + name: "xdr:colOff", + textNode: imageAnchor.offsetX.toString() + }, + { + name: "xdr:row", + textNode: imageAnchor.row.toString() + }, + { + name: "xdr:rowOff", + textNode: imageAnchor.offsetY.toString() + } + ] +}); +var getExt = (image) => { + const children = [ + { + 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" + } + } + } + ] + } + ]; + const recolor = image.recolor?.toLowerCase(); + switch (recolor) { + case "grayscale": + case "sepia": + case "washout": + children.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 + }; +}; +var getNvPicPr = (image, index) => ({ + name: "xdr:nvPicPr", + children: [ + { + name: "xdr:cNvPr", + properties: { + rawMap: { + id: index, + name: image.id, + descr: image.altText != null ? image.altText : void 0 + } + }, + children: [getExt(image)] + }, + { + name: "xdr:cNvPicPr", + properties: { + rawMap: { + preferRelativeResize: "0" + } + }, + children: [ + { + name: "a:picLocks" + } + ] + } + ] +}); +var getColorDetails = (color) => { + if (!color.saturation && !color.tint) { + return; + } + const ret = []; + if (color.saturation) { + ret.push({ + name: "a:satMod", + properties: { + rawMap: { + val: color.saturation * 1e3 + } + } + }); + } + if (color.tint) { + ret.push({ + name: "a:tint", + properties: { + rawMap: { + val: color.tint * 1e3 + } + } + }); + } + return ret; +}; +var getDuoTone = (primaryColor, secondaryColor) => { + return { + name: "a:duotone", + children: [ + { + name: "a:prstClr", + properties: { + rawMap: { + val: primaryColor.color + } + }, + children: getColorDetails(primaryColor) + }, + { + name: "a:srgbClr", + properties: { + rawMap: { + val: secondaryColor.color + } + }, + children: getColorDetails(secondaryColor) + } + ] + }; +}; +var getBlipFill = (image, index) => { + let blipChildren; + if (image.transparency) { + const transparency = Math.min(Math.max(image.transparency, 0), 100); + blipChildren = [ + { + name: "a:alphaModFix", + properties: { + rawMap: { + amt: 1e5 - Math.round(transparency * 1e3) + } + } + } + ]; + } + if (image.recolor) { + if (!blipChildren) { + blipChildren = []; + } + switch (image.recolor.toLocaleLowerCase()) { + case "grayscale": + blipChildren.push({ name: "a:grayscl" }); + break; + case "sepia": + blipChildren.push(getDuoTone({ color: "black" }, { color: "D9C3A5", tint: 50, saturation: 180 })); + break; + case "washout": + blipChildren.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${index}`, + "xmlns:r": "http://schemas.openxmlformats.org/officeDocument/2006/relationships" + } + }, + children: blipChildren + }, + { + name: "a:stretch", + children: [ + { + name: "a:fillRect" + } + ] + } + ] + }; +}; +var getSpPr = (image, imageBoxSize) => { + const xfrm = { + name: "a:xfrm", + children: [ + { + name: "a:off", + properties: { + rawMap: { + x: 0, + y: 0 + } + } + }, + { + name: "a:ext", + properties: { + rawMap: { + cx: imageBoxSize.width, + cy: imageBoxSize.height + } + } + } + ] + }; + if (image.rotation) { + const rotation = image.rotation; + xfrm.properties = { + rawMap: { + rot: Math.min(Math.max(rotation, 0), 360) * 6e4 + } + }; + } + const prstGeom = { + name: "a:prstGeom", + properties: { + rawMap: { + prst: "rect" + } + }, + children: [{ name: "a:avLst" }] + }; + const ret = { + name: "xdr:spPr", + children: [xfrm, prstGeom] + }; + return ret; +}; +var getImageBoxSize = (image) => { + image.fitCell = !!image.fitCell || !image.width || !image.height; + const { position = {}, fitCell, width = 0, height = 0, totalHeight, totalWidth } = image; + const { offsetX = 0, offsetY = 0, row = 1, rowSpan = 1, column = 1, colSpan = 1 } = position; + return { + from: { + row: row - 1, + col: column - 1, + offsetX: pixelsToEMU(offsetX), + offsetY: pixelsToEMU(offsetY) + }, + to: { + row: row - 1 + (fitCell ? 1 : rowSpan - 1), + col: column - 1 + (fitCell ? 1 : colSpan - 1), + offsetX: pixelsToEMU(width + offsetX), + offsetY: pixelsToEMU(height + offsetY) + }, + height: pixelsToEMU(totalHeight || height), + width: pixelsToEMU(totalWidth || width) + }; +}; +var getPicture = (image, currentIndex, worksheetImageIndex, imageBoxSize) => { + return { + name: "xdr:pic", + children: [ + getNvPicPr(image, currentIndex + 1), + getBlipFill(image, worksheetImageIndex + 1), + getSpPr(image, imageBoxSize) + ] + }; +}; +var drawingFactory = { + getTemplate(config) { + const { sheetIndex } = config; + const sheetImages = XLSX_WORKSHEET_IMAGES.get(sheetIndex); + const sheetImageIds = XLSX_WORKSHEET_IMAGE_IDS.get(sheetIndex); + const children = sheetImages.map((image, idx) => { + const boxSize = getImageBoxSize(image); + return { + name: "xdr:twoCellAnchor", + properties: { + rawMap: { + editAs: "absolute" + } + }, + children: [ + getAnchor("from", boxSize.from), + getAnchor("to", boxSize.to), + getPicture(image, idx, sheetImageIds.get(image.id).index, boxSize), + { 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 + }; + } +}; +var drawing_default = drawingFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/relationship.ts +var relationshipFactory = { + getTemplate(config) { + const { Id, Type, Target } = config; + return { + name: "Relationship", + properties: { + rawMap: { + Id, + Type, + Target + } + } + }; + } +}; +var relationship_default = relationshipFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/relationships.ts +var relationshipsFactory = { + getTemplate(c) { + const children = c.map((relationship) => relationship_default.getTemplate(relationship)); + return { + name: "Relationships", + properties: { + rawMap: { + xmlns: "http://schemas.openxmlformats.org/package/2006/relationships" + } + }, + children + }; + } +}; +var relationships_default = relationshipsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/sharedStrings.ts +var sharedStrings = { + getTemplate(strings) { + return { + name: "sst", + properties: { + rawMap: { + xmlns: "http://schemas.openxmlformats.org/spreadsheetml/2006/main", + count: strings.size, + uniqueCount: strings.size + } + }, + children: buildSharedString(strings) + }; + } +}; +var sharedStrings_default = sharedStrings; + +// packages/ag-grid-enterprise/src/excelExport/assets/excelLegacyConvert.ts +var getWeightName = (value) => { + switch (value) { + case 1: + return "thin"; + case 2: + return "medium"; + case 3: + return "thick"; + default: + return "hair"; + } +}; +var mappedBorderNames = { + None: "None", + Dot: "Dotted", + Dash: "Dashed", + Double: "Double", + DashDot: "DashDot", + DashDotDot: "DashDotDot", + SlantDashDot: "SlantDashDot", + Continuous: "Continuous" +}; +var mediumBorders = ["Dashed", "DashDot", "DashDotDot"]; +var colorMap = { + 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" +}; +var horizontalAlignmentMap = { + Automatic: "general", + Left: "left", + Center: "center", + Right: "right", + Fill: "fill", + Justify: "justify", + CenterAcrossSelection: "centerContinuous", + Distributed: "distributed", + JustifyDistributed: "justify" +}; +var verticalAlignmentMap = { + Automatic: void 0, + Top: "top", + Bottom: "bottom", + Center: "center", + Justify: "justify", + Distributed: "distributed", + JustifyDistributed: "justify" +}; +var convertLegacyPattern = (name) => { + if (!name) { + return "none"; + } + return colorMap[name] || name; +}; +var convertLegacyColor = (color) => { + if (color == void 0) { + return color; + } + if (color.charAt(0) === "#") { + color = color.substring(1); + } + return color.length === 6 ? "FF" + color : color; +}; +var convertLegacyBorder = (type, weight) => { + if (!type) { + return "thin"; + } + const namedWeight = getWeightName(weight); + if (type === "Continuous") { + return namedWeight; + } + const mappedName = mappedBorderNames[type]; + if (namedWeight === "medium" && mediumBorders.some((type2) => type2 === mappedName)) { + return `medium${mappedName}`; + } + return `${mappedName.charAt(0).toLowerCase()}${mappedName.substring(1)}`; +}; +var convertLegacyHorizontalAlignment = (alignment) => { + return horizontalAlignmentMap[alignment] || "general"; +}; +var convertLegacyVerticalAlignment = (alignment) => { + return verticalAlignmentMap[alignment] || void 0; +}; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/border.ts +var getBorderColor = (color) => { + return { + name: "color", + properties: { + rawMap: { + rgb: convertLegacyColor(color || "#000000") + } + } + }; +}; +var borderFactory = { + getTemplate(border) { + const { left, right, top, bottom, diagonal } = border; + const leftChildren = left ? [getBorderColor(left.color)] : void 0; + const rightChildren = right ? [getBorderColor(right.color)] : void 0; + const topChildren = top ? [getBorderColor(top.color)] : void 0; + const bottomChildren = bottom ? [getBorderColor(bottom.color)] : void 0; + const diagonalChildren = diagonal ? [getBorderColor(diagonal.color)] : void 0; + return { + name: "border", + children: [ + { + name: "left", + properties: { rawMap: { style: left?.style } }, + children: leftChildren + }, + { + name: "right", + properties: { rawMap: { style: right?.style } }, + children: rightChildren + }, + { + name: "top", + properties: { rawMap: { style: top?.style } }, + children: topChildren + }, + { + name: "bottom", + properties: { rawMap: { style: bottom?.style } }, + children: bottomChildren + }, + { + name: "diagonal", + properties: { rawMap: { style: diagonal?.style } }, + children: diagonalChildren + } + ] + }; + } +}; +var border_default = borderFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/borders.ts +var bordersFactory = { + getTemplate(borders) { + return { + name: "borders", + properties: { + rawMap: { + count: borders.length + } + }, + children: borders.map((border) => border_default.getTemplate(border)) + }; + } +}; +var borders_default = bordersFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/alignment.ts +var getReadingOrderId = (readingOrder) => { + const order = ["Context", "LeftToRight", "RightToLeft"]; + const pos = order.indexOf(readingOrder); + return Math.max(pos, 0); +}; +var alignmentFactory = { + getTemplate(alignment) { + const { horizontal, indent, readingOrder, rotate, shrinkToFit, vertical, wrapText } = alignment; + return { + name: "alignment", + properties: { + rawMap: { + horizontal: horizontal && convertLegacyHorizontalAlignment(horizontal), + indent, + readingOrder: readingOrder && getReadingOrderId(readingOrder), + textRotation: rotate, + shrinkToFit, + vertical: vertical && convertLegacyVerticalAlignment(vertical), + wrapText + } + } + }; + } +}; +var alignment_default = alignmentFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/protection.ts +var protectionFactory = { + getTemplate(protection) { + const locked = protection.protected === false ? 0 : 1; + const hidden = protection.hideFormula === true ? 1 : 0; + return { + name: "protection", + properties: { + rawMap: { + hidden, + locked + } + } + }; + } +}; +var protection_default = protectionFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/xf.ts +var xfFactory = { + getTemplate(xf) { + const { alignment, borderId, fillId, fontId, numFmtId, protection, quotePrefix, xfId } = xf; + const children = []; + if (alignment) { + children.push(alignment_default.getTemplate(alignment)); + } + if (protection) { + children.push(protection_default.getTemplate(protection)); + } + return { + name: "xf", + properties: { + rawMap: { + applyAlignment: alignment ? 1 : void 0, + applyProtection: protection ? 1 : void 0, + applyBorder: borderId ? 1 : void 0, + applyFill: fillId ? 1 : void 0, + borderId, + fillId, + applyFont: fontId ? 1 : void 0, + fontId, + applyNumberFormat: numFmtId ? 1 : void 0, + numFmtId, + quotePrefix: quotePrefix ? 1 : void 0, + xfId + } + }, + children: children.length ? children : void 0 + }; + } +}; +var xf_default = xfFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/cellStyleXfs.ts +var cellStylesXfsFactory = { + getTemplate(xfs) { + return { + name: "cellStyleXfs", + properties: { + rawMap: { + count: xfs.length + } + }, + children: xfs.map((xf) => xf_default.getTemplate(xf)) + }; + } +}; +var cellStyleXfs_default = cellStylesXfsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/cellStyle.ts +var borderFactory2 = { + getTemplate(cellStyle) { + const { builtinId, name, xfId } = cellStyle; + return { + name: "cellStyle", + properties: { + rawMap: { + builtinId, + name, + xfId + } + } + }; + } +}; +var cellStyle_default = borderFactory2; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/cellStyles.ts +var cellStylesFactory = { + getTemplate(cellStyles) { + return { + name: "cellStyles", + properties: { + rawMap: { + count: cellStyles.length + } + }, + children: cellStyles.map((cellStyle) => cellStyle_default.getTemplate(cellStyle)) + }; + } +}; +var cellStyles_default = cellStylesFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/cellXfs.ts +var cellXfsFactory = { + getTemplate(xfs) { + return { + name: "cellXfs", + properties: { + rawMap: { + count: xfs.length + } + }, + children: xfs.map((xf) => xf_default.getTemplate(xf)) + }; + } +}; +var cellXfs_default = cellXfsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/fill.ts +var fillFactory = { + getTemplate(fill) { + const { patternType, fgTheme, fgTint, fgRgb, bgRgb, bgIndexed } = fill; + const pf = { + name: "patternFill", + properties: { + rawMap: { + patternType + } + } + }; + if (fgTheme || fgTint || fgRgb) { + pf.children = [ + { + name: "fgColor", + properties: { + rawMap: { + theme: fgTheme, + tint: fgTint, + rgb: fgRgb + } + } + } + ]; + } + if (bgIndexed || bgRgb) { + if (!pf.children) { + pf.children = []; + } + pf.children.push({ + name: "bgColor", + properties: { + rawMap: { + indexed: bgIndexed, + rgb: bgRgb + } + } + }); + } + return { + name: "fill", + children: [pf] + }; + } +}; +var fill_default = fillFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/fills.ts +var fillsFactory = { + getTemplate(fills) { + return { + name: "fills", + properties: { + rawMap: { + count: fills.length + } + }, + children: fills.map((fill) => fill_default.getTemplate(fill)) + }; + } +}; +var fills_default = fillsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/font.ts +var fontFactory = { + getTemplate(font) { + const { + size, + colorTheme, + color = "FF000000", + fontName = "Calibri", + family, + scheme, + italic, + bold, + strikeThrough, + outline, + shadow: shadow2, + underline, + verticalAlign + } = font; + const children = [ + { name: "sz", properties: { rawMap: { val: size } } }, + { name: "color", properties: { rawMap: { theme: colorTheme, rgb: color } } }, + { name: "name", properties: { rawMap: { val: fontName } } } + ]; + if (family) { + children.push({ name: "family", properties: { rawMap: { val: family } } }); + } + if (scheme) { + children.push({ name: "scheme", properties: { rawMap: { val: scheme } } }); + } + if (italic) { + children.push({ name: "i" }); + } + if (bold) { + children.push({ name: "b" }); + } + if (strikeThrough) { + children.push({ name: "strike" }); + } + if (outline) { + children.push({ name: "outline" }); + } + if (shadow2) { + children.push({ name: "shadow" }); + } + if (underline) { + children.push({ name: "u", properties: { rawMap: { val: underline } } }); + } + if (verticalAlign) { + children.push({ name: "vertAlign", properties: { rawMap: { val: verticalAlign } } }); + } + return { name: "font", children }; + } +}; +var font_default = fontFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/fonts.ts +var fontsFactory = { + getTemplate(fonts) { + return { + name: "fonts", + properties: { + rawMap: { + count: fonts.length + } + }, + children: fonts.map((font) => font_default.getTemplate(font)) + }; + } +}; +var fonts_default = fontsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/numberFormat.ts +import { _escapeString as _escapeString3 } from "ag-grid-community"; +function prepareString(str) { + const split = str.split(/(\[[^\]]*\])/); + for (let i = 0; i < split.length; i++) { + let currentString = split[i]; + if (!currentString.length) { + continue; + } + if (!currentString.startsWith("[")) { + currentString = currentString.replace(/\$/g, '"$"'); + } + split[i] = _escapeString3(currentString); + } + return split.join(""); +} +var numberFormatFactory = { + getTemplate(numberFormat) { + let { formatCode, numFmtId } = numberFormat; + if (formatCode.length) { + formatCode = prepareString(formatCode); + } + return { + name: "numFmt", + properties: { + rawMap: { + formatCode, + numFmtId + } + } + }; + } +}; +var numberFormat_default = numberFormatFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/numberFormats.ts +var numberFormatsFactory = { + getTemplate(numberFormats) { + return { + name: "numFmts", + properties: { + rawMap: { + count: numberFormats.length + } + }, + children: numberFormats.map((numberFormat) => numberFormat_default.getTemplate(numberFormat)) + }; + } +}; +var numberFormats_default = numberFormatsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/styles/stylesheet.ts +var stylesMap; +var registeredNumberFmts; +var registeredFonts; +var registeredFills; +var registeredBorders; +var registeredCellStyleXfs; +var registeredCellXfs; +var registeredCellStyles; +var currentSheet; +var getStyleName = (name, currentSheet2) => { + if (name.includes("mixedStyle") && currentSheet2 > 1) { + name += `_${currentSheet2}`; + } + return name; +}; +var resetStylesheetValues = () => { + stylesMap = { base: 0 }; + registeredNumberFmts = []; + registeredFonts = [{ fontName: "Calibri", colorTheme: "1", family: "2", scheme: "minor" }]; + registeredFills = [{ patternType: "none" }, { patternType: "gray125" }]; + registeredBorders = [{ left: void 0, right: void 0, top: void 0, bottom: void 0, diagonal: void 0 }]; + registeredCellStyleXfs = [{ borderId: 0, fillId: 0, fontId: 0, numFmtId: 0 }]; + registeredCellXfs = [{ borderId: 0, fillId: 0, fontId: 0, numFmtId: 0, xfId: 0 }]; + registeredCellStyles = [{ builtinId: 0, name: "Normal", xfId: 0 }]; +}; +var registerFill = (fill) => { + const convertedPattern = convertLegacyPattern(fill.pattern); + const convertedFillColor = convertLegacyColor(fill.color); + const convertedPatternColor = convertLegacyColor(fill.patternColor); + let pos = registeredFills.findIndex((currentFill) => { + const { patternType, fgRgb, bgRgb } = currentFill; + return !(patternType != convertedPattern || fgRgb != convertedFillColor || bgRgb != convertedPatternColor); + }); + if (pos === -1) { + pos = registeredFills.length; + registeredFills.push({ + patternType: convertedPattern, + fgRgb: convertedFillColor, + bgRgb: convertedPatternColor + }); + } + return pos; +}; +var registerNumberFmt = (format) => { + if (numberFormatMap[format]) { + return numberFormatMap[format]; + } + let pos = registeredNumberFmts.findIndex((currentFormat) => currentFormat.formatCode === format); + if (pos === -1) { + pos = registeredNumberFmts.length + 164; + registeredNumberFmts.push({ formatCode: format, numFmtId: pos }); + } else { + pos = registeredNumberFmts[pos].numFmtId; + } + return pos; +}; +var registerBorders = (borders) => { + const { borderBottom, borderTop, borderLeft, borderRight } = borders; + let bottomStyle; + let topStyle; + let leftStyle; + let rightStyle; + let bottomColor; + let topColor; + let leftColor; + let rightColor; + if (borderLeft) { + leftStyle = convertLegacyBorder(borderLeft.lineStyle, borderLeft.weight); + leftColor = convertLegacyColor(borderLeft.color); + } + if (borderRight) { + rightStyle = convertLegacyBorder(borderRight.lineStyle, borderRight.weight); + rightColor = convertLegacyColor(borderRight.color); + } + if (borderBottom) { + bottomStyle = convertLegacyBorder(borderBottom.lineStyle, borderBottom.weight); + bottomColor = convertLegacyColor(borderBottom.color); + } + if (borderTop) { + topStyle = convertLegacyBorder(borderTop.lineStyle, borderTop.weight); + topColor = convertLegacyColor(borderTop.color); + } + let pos = registeredBorders.findIndex((currentBorder) => { + const { left, right, top, bottom } = currentBorder; + if (!left && (leftStyle || leftColor)) { + return false; + } + if (!right && (rightStyle || rightColor)) { + return false; + } + if (!top && (topStyle || topColor)) { + return false; + } + if (!bottom && (bottomStyle || bottomColor)) { + return false; + } + const { style: clS, color: clC } = left || {}; + const { style: crS, color: crC } = right || {}; + const { style: ctS, color: ctC } = top || {}; + const { style: cbS, color: cbC } = bottom || {}; + if (clS != leftStyle || clC != leftColor) { + return false; + } + if (crS != rightStyle || crC != rightColor) { + return false; + } + if (ctS != topStyle || ctC != topColor) { + return false; + } + if (cbS != bottomStyle || cbC != bottomColor) { + return false; + } + return true; + }); + if (pos === -1) { + pos = registeredBorders.length; + registeredBorders.push({ + left: { + style: leftStyle, + color: leftColor + }, + right: { + style: rightStyle, + color: rightColor + }, + top: { + style: topStyle, + color: topColor + }, + bottom: { + style: bottomStyle, + color: bottomColor + }, + diagonal: { + style: void 0, + color: void 0 + } + }); + } + return pos; +}; +var registerFont = (font) => { + const { + fontName: name = "Calibri", + color, + size, + bold, + italic, + outline, + shadow: shadow2, + strikeThrough, + underline, + family, + verticalAlign + } = font; + const convertedColor = convertLegacyColor(color); + const familyId = getFontFamilyId(family); + const convertedUnderline = underline ? underline.toLocaleLowerCase() : void 0; + const convertedVerticalAlign = verticalAlign ? verticalAlign.toLocaleLowerCase() : void 0; + let pos = registeredFonts.findIndex((currentFont) => { + return !(currentFont.fontName != name || currentFont.color != convertedColor || currentFont.size != size || currentFont.bold != bold || currentFont.italic != italic || currentFont.outline != outline || currentFont.shadow != shadow2 || currentFont.strikeThrough != strikeThrough || currentFont.underline != convertedUnderline || currentFont.verticalAlign != convertedVerticalAlign || currentFont.family != familyId); + }); + if (pos === -1) { + pos = registeredFonts.length; + registeredFonts.push({ + fontName: name, + color: convertedColor, + size, + bold, + italic, + outline, + shadow: shadow2, + strikeThrough, + underline: convertedUnderline, + verticalAlign: convertedVerticalAlign, + family: familyId != null ? familyId.toString() : void 0 + }); + } + return pos; +}; +var registerStyle = (config) => { + const { alignment, borders, font, interior, numberFormat, protection, quotePrefix } = config; + let { id } = config; + let currentFill = 0; + let currentBorder = 0; + let currentFont = 0; + let currentNumberFmt = 0; + if (!id) { + return; + } + id = getStyleName(id, currentSheet); + if (stylesMap[id] != void 0) { + return; + } + if (interior) { + currentFill = registerFill(interior); + } + if (borders) { + currentBorder = registerBorders(borders); + } + if (font) { + currentFont = registerFont(font); + } + if (numberFormat) { + currentNumberFmt = registerNumberFmt(numberFormat.format); + } + stylesMap[id] = registeredCellXfs.length; + registeredCellXfs.push({ + alignment, + borderId: currentBorder || 0, + fillId: currentFill || 0, + fontId: currentFont || 0, + numFmtId: currentNumberFmt || 0, + protection, + quotePrefix, + xfId: 0 + }); +}; +var stylesheetFactory = { + getTemplate(defaultFontSize) { + const numberFormats = numberFormats_default.getTemplate(registeredNumberFmts); + const fonts = fonts_default.getTemplate( + registeredFonts.map((font) => ({ ...font, size: font.size != null ? font.size : defaultFontSize })) + ); + const fills = fills_default.getTemplate(registeredFills); + const borders = borders_default.getTemplate(registeredBorders); + const cellStylesXfs = cellStyleXfs_default.getTemplate(registeredCellStyleXfs); + const cellXfs = cellXfs_default.getTemplate(registeredCellXfs); + const cellStyles = cellStyles_default.getTemplate(registeredCellStyles); + resetStylesheetValues(); + return { + 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: [ + numberFormats, + fonts, + fills, + borders, + cellStylesXfs, + cellXfs, + cellStyles, + { + name: "tableStyles", + properties: { + rawMap: { + count: 0, + defaultPivotStyle: "PivotStyleLight16", + defaultTableStyle: "TableStyleMedium2" + } + } + } + ] + }; + } +}; +var getStyleId = (name, currentSheet2) => { + return stylesMap[getStyleName(name, currentSheet2)] || 0; +}; +var registerStyles = (styles, _currentSheet) => { + currentSheet = _currentSheet; + if (currentSheet === 1) { + resetStylesheetValues(); + } + styles.forEach(registerStyle); +}; +var stylesheet_default = stylesheetFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/table.ts +import { _escapeString as _escapeString4 } from "ag-grid-community"; +var tableFactory = { + getTemplate(dataTable, idx) { + const { + name, + columns, + rowRange, + displayName, + showRowStripes, + showColumnStripes, + showFilterButtons, + highlightFirstColumn, + highlightLastColumn + } = dataTable || {}; + const noRows = !rowRange || rowRange[0] - rowRange[1] === 0; + if (!dataTable || !name || !Array.isArray(columns) || !columns.length || noRows) { + return { name: "table" }; + } + const filterColumns = columns.map((col, idx2) => ({ + name: "filterColumn", + properties: { + rawMap: { + colId: idx2.toString(), + // For filters, this should start with 0 + hiddenButton: showFilterButtons[idx2] ? 0 : 1 + } + } + })); + const firstCell = `A${rowRange[0]}`; + const lastCell = `${getExcelColumnName(columns.length)}${rowRange[1]}`; + const ref = `${firstCell}:${lastCell}`; + const id = `${idx + 1}`; + const displayNameToUse = idx ? `${displayName}_${id}` : displayName; + 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: displayNameToUse, + displayName: displayNameToUse, + ref, + totalsRowShown: 0, + id + } + }, + children: [ + { + name: "autoFilter", + properties: { + rawMap: { + ref + } + }, + children: filterColumns + }, + { + name: "tableColumns", + properties: { + rawMap: { + count: columns.length + } + }, + children: columns.map((col, idx2) => ({ + name: "tableColumn", + properties: { + rawMap: { + id: (idx2 + 1).toString(), + name: _escapeString4(sanitizeTableName(col)), + dataCellStyle: "Normal" + } + } + })) + }, + { + name: "tableStyleInfo", + properties: { + rawMap: { + name: "TableStyleLight1", + showFirstColumn: highlightFirstColumn ? 1 : 0, + showLastColumn: highlightLastColumn ? 1 : 0, + showRowStripes: showRowStripes ? 1 : 0, + showColumnStripes: showColumnStripes ? 1 : 0 + } + } + } + ] + }; + } +}; +var table_default = tableFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/themes/office/colorScheme.ts +var getColorChildren = (props) => { + const [type, innerType, val, lastClr] = props; + return { + name: `a:${type}`, + children: [ + { + name: `a:${innerType}`, + properties: { + rawMap: { + val, + lastClr + } + } + } + ] + }; +}; +var colorScheme = { + getTemplate() { + return { + name: "a:clrScheme", + properties: { + rawMap: { + name: "Office" + } + }, + children: [ + getColorChildren(["dk1", "sysClr", "windowText", "000000"]), + getColorChildren(["lt1", "sysClr", "window", "FFFFFF"]), + getColorChildren(["dk2", "srgbClr", "44546A"]), + getColorChildren(["lt2", "srgbClr", "E7E6E6"]), + getColorChildren(["accent1", "srgbClr", "4472C4"]), + getColorChildren(["accent2", "srgbClr", "ED7D31"]), + getColorChildren(["accent3", "srgbClr", "A5A5A5"]), + getColorChildren(["accent4", "srgbClr", "FFC000"]), + getColorChildren(["accent5", "srgbClr", "5B9BD5"]), + getColorChildren(["accent6", "srgbClr", "70AD47"]), + getColorChildren(["hlink", "srgbClr", "0563C1"]), + getColorChildren(["folHlink", "srgbClr", "954F72"]) + ] + }; + } +}; +var colorScheme_default = colorScheme; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/themes/office/fontScheme.ts +var getFont = (props) => { + const [type, typeface, script, panose] = props; + return { + name: `a:${type}`, + properties: { + rawMap: { + script, + typeface, + panose + } + } + }; +}; +var fontScheme = { + getTemplate() { + return { + name: "a:fontScheme", + properties: { + rawMap: { + name: "Office" + } + }, + children: [ + { + name: "a:majorFont", + children: [ + getFont(["latin", "Calibri Light", void 0, "020F0302020204030204"]), + getFont(["ea", ""]), + getFont(["cs", ""]), + getFont(["font", "\u6E38\u30B4\u30B7\u30C3\u30AF Light", "Jpan"]), + getFont(["font", "\uB9D1\uC740 \uACE0\uB515", "Hang"]), + getFont(["font", "\u7B49\u7EBF Light", "Hans"]), + getFont(["font", "\u65B0\u7D30\u660E\u9AD4", "Hant"]), + getFont(["font", "Times New Roman", "Arab"]), + getFont(["font", "Times New Roman", "Hebr"]), + getFont(["font", "Tahoma", "Thai"]), + getFont(["font", "Nyala", "Ethi"]), + getFont(["font", "Vrinda", "Beng"]), + getFont(["font", "Shruti", "Gujr"]), + getFont(["font", "MoolBoran", "Khmr"]), + getFont(["font", "Tunga", "Knda"]), + getFont(["font", "Raavi", "Guru"]), + getFont(["font", "Euphemia", "Cans"]), + getFont(["font", "Plantagenet Cherokee", "Cher"]), + getFont(["font", "Microsoft Yi Baiti", "Yiii"]), + getFont(["font", "Microsoft Himalaya", "Tibt"]), + getFont(["font", "MV Boli", "Thaa"]), + getFont(["font", "Mangal", "Deva"]), + getFont(["font", "Gautami", "Telu"]), + getFont(["font", "Latha", "Taml"]), + getFont(["font", "Estrangelo Edessa", "Syrc"]), + getFont(["font", "Kalinga", "Orya"]), + getFont(["font", "Kartika", "Mlym"]), + getFont(["font", "DokChampa", "Laoo"]), + getFont(["font", "Iskoola Pota", "Sinh"]), + getFont(["font", "Mongolian Baiti", "Mong"]), + getFont(["font", "Times New Roman", "Viet"]), + getFont(["font", "Microsoft Uighur", "Uigh"]), + getFont(["font", "Sylfaen", "Geor"]), + getFont(["font", "Arial", "Armn"]), + getFont(["font", "Leelawadee UI", "Bugi"]), + getFont(["font", "Microsoft JhengHei", "Bopo"]), + getFont(["font", "Javanese Text", "Java"]), + getFont(["font", "Segoe UI", "Lisu"]), + getFont(["font", "Myanmar Text", "Mymr"]), + getFont(["font", "Ebrima", "Nkoo"]), + getFont(["font", "Nirmala UI", "Olck"]), + getFont(["font", "Ebrima", "Osma"]), + getFont(["font", "Phagspa", "Phag"]), + getFont(["font", "Estrangelo Edessa", "Syrn"]), + getFont(["font", "Estrangelo Edessa", "Syrj"]), + getFont(["font", "Estrangelo Edessa", "Syre"]), + getFont(["font", "Nirmala UI", "Sora"]), + getFont(["font", "Microsoft Tai Le", "Tale"]), + getFont(["font", "Microsoft New Tai Lue", "Talu"]), + getFont(["font", "Ebrima", "Tfng"]) + ] + }, + { + name: "a:minorFont", + children: [ + getFont(["latin", "Calibri", void 0, "020F0502020204030204"]), + getFont(["ea", ""]), + getFont(["cs", ""]), + getFont(["font", "\u6E38\u30B4\u30B7\u30C3\u30AF", "Jpan"]), + getFont(["font", "\uB9D1\uC740 \uACE0\uB515", "Hang"]), + getFont(["font", "\u7B49\u7EBF", "Hans"]), + getFont(["font", "\u65B0\u7D30\u660E\u9AD4", "Hant"]), + getFont(["font", "Arial", "Arab"]), + getFont(["font", "Arial", "Hebr"]), + getFont(["font", "Tahoma", "Thai"]), + getFont(["font", "Nyala", "Ethi"]), + getFont(["font", "Vrinda", "Beng"]), + getFont(["font", "Shruti", "Gujr"]), + getFont(["font", "DaunPenh", "Khmr"]), + getFont(["font", "Tunga", "Knda"]), + getFont(["font", "Raavi", "Guru"]), + getFont(["font", "Euphemia", "Cans"]), + getFont(["font", "Plantagenet Cherokee", "Cher"]), + getFont(["font", "Microsoft Yi Baiti", "Yiii"]), + getFont(["font", "Microsoft Himalaya", "Tibt"]), + getFont(["font", "MV Boli", "Thaa"]), + getFont(["font", "Mangal", "Deva"]), + getFont(["font", "Gautami", "Telu"]), + getFont(["font", "Latha", "Taml"]), + getFont(["font", "Estrangelo Edessa", "Syrc"]), + getFont(["font", "Kalinga", "Orya"]), + getFont(["font", "Kartika", "Mlym"]), + getFont(["font", "DokChampa", "Laoo"]), + getFont(["font", "Iskoola Pota", "Sinh"]), + getFont(["font", "Mongolian Baiti", "Mong"]), + getFont(["font", "Arial", "Viet"]), + getFont(["font", "Microsoft Uighur", "Uigh"]), + getFont(["font", "Sylfaen", "Geor"]), + getFont(["font", "Arial", "Armn"]), + getFont(["font", "Leelawadee UI", "Bugi"]), + getFont(["font", "Microsoft JhengHei", "Bopo"]), + getFont(["font", "Javanese Text", "Java"]), + getFont(["font", "Segoe UI", "Lisu"]), + getFont(["font", "Myanmar Text", "Mymr"]), + getFont(["font", "Ebrima", "Nkoo"]), + getFont(["font", "Nirmala UI", "Olck"]), + getFont(["font", "Ebrima", "Osma"]), + getFont(["font", "Phagspa", "Phag"]), + getFont(["font", "Estrangelo Edessa", "Syrn"]), + getFont(["font", "Estrangelo Edessa", "Syrj"]), + getFont(["font", "Estrangelo Edessa", "Syre"]), + getFont(["font", "Nirmala UI", "Sora"]), + getFont(["font", "Microsoft Tai Le", "Tale"]), + getFont(["font", "Microsoft New Tai Lue", "Talu"]), + getFont(["font", "Ebrima", "Tfng"]) + ] + } + ] + }; + } +}; +var fontScheme_default = fontScheme; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/themes/office/formatScheme.ts +var getPropertyVal = (name, val, children) => ({ + name: `a:${name}`, + properties: { + rawMap: { + val + } + }, + children +}); +var getGs = (props) => { + const [pos, schemeColor, satMod, lumMod, tint, shade] = props; + const children = []; + children.push(getPropertyVal("satMod", satMod)); + if (lumMod) { + children.push(getPropertyVal("lumMod", lumMod)); + } + if (tint) { + children.push(getPropertyVal("tint", tint)); + } + if (shade) { + children.push(getPropertyVal("shade", shade)); + } + return { + name: "a:gs", + properties: { + rawMap: { + pos + } + }, + children: [ + { + name: "a:schemeClr", + properties: { + rawMap: { + val: schemeColor + } + }, + children + } + ] + }; +}; +var getSolidFill = (val, children) => ({ + name: "a:solidFill", + children: [getPropertyVal("schemeClr", val, children)] +}); +var getGradFill = (props) => { + const [rotWithShape, gs1, gs2, gs3, lin] = props; + const [ang, scaled] = lin; + return { + name: "a:gradFill", + properties: { + rawMap: { + rotWithShape + } + }, + children: [ + { + name: "a:gsLst", + children: [getGs(gs1), getGs(gs2), getGs(gs3)] + }, + { + name: "a:lin", + properties: { + rawMap: { + ang, + scaled + } + } + } + ] + }; +}; +var getLine = (props) => { + const [w, cap, cmpd, algn] = props; + return { + name: "a:ln", + properties: { + rawMap: { w, cap, cmpd, algn } + }, + children: [ + getSolidFill("phClr"), + getPropertyVal("prstDash", "solid"), + { + name: "a:miter", + properties: { + rawMap: { + lim: "800000" + } + } + } + ] + }; +}; +var getEffectStyle = (shadow2) => { + const children = []; + if (shadow2) { + const [blurRad, dist, dir, algn, rotWithShape] = shadow2; + children.push({ + name: "a:outerShdw", + properties: { + rawMap: { blurRad, dist, dir, algn, rotWithShape } + }, + children: [getPropertyVal("srgbClr", "000000", [getPropertyVal("alpha", "63000")])] + }); + } + return { + name: "a:effectStyle", + children: [ + Object.assign( + {}, + { + name: "a:effectLst" + }, + children.length ? { children } : {} + ) + ] + }; +}; +var getFillStyleList = () => ({ + name: "a:fillStyleLst", + children: [ + getSolidFill("phClr"), + getGradFill([ + "1", + ["0", "phClr", "105000", "110000", "67000"], + ["50000", "phClr", "103000", "105000", "73000"], + ["100000", "phClr", "109000", "105000", "81000"], + ["5400000", "0"] + ]), + getGradFill([ + "1", + ["0", "phClr", "103000", "102000", "94000"], + ["50000", "phClr", "110000", "100000", void 0, "100000"], + ["100000", "phClr", "120000", "99000", void 0, "78000"], + ["5400000", "0"] + ]) + ] +}); +var getLineStyleList = () => ({ + name: "a:lnStyleLst", + children: [ + getLine(["6350", "flat", "sng", "ctr"]), + getLine(["12700", "flat", "sng", "ctr"]), + getLine(["19050", "flat", "sng", "ctr"]) + ] +}); +var getEffectStyleList = () => ({ + name: "a:effectStyleLst", + children: [getEffectStyle(), getEffectStyle(), getEffectStyle(["57150", "19050", "5400000", "ctr", "0"])] +}); +var getBgFillStyleList = () => ({ + name: "a:bgFillStyleLst", + children: [ + getSolidFill("phClr"), + getSolidFill("phClr", [getPropertyVal("tint", "95000"), getPropertyVal("satMod", "170000")]), + getGradFill([ + "1", + ["0", "phClr", "150000", "102000", "93000", "98000"], + ["50000", "phClr", "130000", "103000", "98000", "90000"], + ["100000", "phClr", "120000", void 0, void 0, "63000"], + ["5400000", "0"] + ]) + ] +}); +var formatScheme = { + getTemplate() { + return { + name: "a:fmtScheme", + properties: { + rawMap: { + name: "Office" + } + }, + children: [getFillStyleList(), getLineStyleList(), getEffectStyleList(), getBgFillStyleList()] + }; + } +}; +var formatScheme_default = formatScheme; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/themes/office/themeElements.ts +var themeElements = { + getTemplate() { + return { + name: "a:themeElements", + children: [colorScheme_default.getTemplate(), fontScheme_default.getTemplate(), formatScheme_default.getTemplate()] + }; + } +}; +var themeElements_default = themeElements; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/themes/office.ts +var officeTheme = { + getTemplate() { + return { + name: "a:theme", + properties: { + prefixedAttributes: [ + { + prefix: "xmlns:", + map: { + a: "http://schemas.openxmlformats.org/drawingml/2006/main" + } + } + ], + rawMap: { + name: "Office Theme" + } + }, + children: [ + themeElements_default.getTemplate(), + { + name: "a:objectDefaults" + }, + { + name: "a:extraClrSchemeLst" + } + ] + }; + } +}; +var office_default = officeTheme; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/vmlDrawing.ts +var getShapeLayout = () => ({ + name: "o:shapelayout", + properties: { + prefixedAttributes: [ + { + prefix: "v:", + map: { + ext: "edit" + } + } + ] + }, + children: [ + { + name: "o:idmap", + properties: { + prefixedAttributes: [ + { + prefix: "v:", + map: { + ext: "edit" + } + } + ], + rawMap: { + data: "1" + } + } + } + ] +}); +var getStroke = () => ({ + name: "v:stroke", + properties: { + rawMap: { + joinstyle: "miter" + } + } +}); +var getFormulas = (formulas) => ({ + name: "v:formulas", + children: formulas.map((formula) => ({ + name: "v:f", + properties: { + rawMap: { + eqn: formula + } + } + })) +}); +var getPath = () => ({ + name: "v:path", + properties: { + prefixedAttributes: [ + { + prefix: "o:", + map: { + connecttype: "rect", + extrusionok: "f" + } + } + ], + rawMap: { + gradientshapeok: "t" + } + } +}); +var getLock = (params) => { + const { aspectratio, rotation } = params || {}; + const rawMap = {}; + if (aspectratio) { + rawMap.aspectratio = "t"; + } + if (rotation) { + rawMap.rotation = "t"; + } + return { + name: "o:lock", + properties: { + prefixedAttributes: [ + { + prefix: "v:", + map: { + ext: "edit" + } + } + ], + rawMap + } + }; +}; +function mapNumber(value, startSource, endSource, startTarget, endTarget) { + return (value - startSource) / (endSource - startSource) * (endTarget - startTarget) + startTarget; +} +var getImageData = (image, idx) => { + let rawMap; + const { recolor, brightness, contrast, id } = image; + if (recolor) { + rawMap = {}; + if (recolor === "Washout" || recolor === "Grayscale") { + rawMap.gain = "19661f"; + rawMap.blacklevel = "22938f"; + } + if (recolor === "Black & White" || recolor === "Grayscale") { + rawMap.grayscale = "t"; + if (recolor === "Black & White") { + rawMap.bilevel = "t"; + } + } + } + if (!recolor || recolor === "Grayscale") { + if (!rawMap) { + rawMap = {}; + } + if (contrast != null && contrast !== 50) { + let gain = "1"; + if (contrast >= 0) { + if (contrast < 50) { + gain = String(contrast / 50); + } else if (contrast < 100) { + gain = String(50 / (100 - contrast)); + } else if (contrast === 100) { + gain = "2147483647f"; + } + } + rawMap.gain = gain; + } + if (brightness != null && brightness !== 50) { + rawMap.blacklevel = mapNumber(brightness, 0, 100, -0.5, 0.5).toString(); + } + } + return { + name: "v:imagedata", + properties: { + prefixedAttributes: [ + { + prefix: "o:", + map: { + relid: `rId${idx}`, + title: id + } + } + ], + rawMap + } + }; +}; +var getShapeType = () => { + const formulas = [ + "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: [getStroke(), getFormulas(formulas), getPath(), getLock({ aspectratio: true })] + }; +}; +var pixelToPoint = (value) => Math.floor((value ?? 0) * 0.74999943307122); +var getShape = (image, idx) => { + const { width = 0, height = 0, altText } = image; + const imageWidth = pixelToPoint(width); + const imageHeight = pixelToPoint(height); + return { + name: "v:shape", + properties: { + rawMap: { + id: image.headerFooterPosition, + "o:spid": "_x0000_s1025", + style: `position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${imageWidth}pt; height: ${imageHeight}pt; z-index: ${idx + 1}`, + type: "#_x0000_t75", + alt: altText + } + }, + children: [getImageData(image, idx + 1), getLock({ rotation: true })] + }; +}; +var vmlDrawingFactory = { + getTemplate(params) { + const headerFooterImages = XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.get(params.sheetIndex) || []; + const children = [ + getShapeLayout(), + getShapeType(), + ...headerFooterImages.map((img, idx) => getShape(img, idx)) + ]; + 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 + }; + } +}; +var vmlDrawing_default = vmlDrawingFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/sheet.ts +var sheetFactory = { + getTemplate(name, idx) { + const sheetId = (idx + 1).toString(); + return { + name: "sheet", + properties: { + rawMap: { + name, + sheetId, + "r:id": `rId${sheetId}` + } + } + }; + } +}; +var sheet_default = sheetFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/sheets.ts +var sheetsFactory = { + getTemplate(names) { + return { + name: "sheets", + children: names.map((sheet, idx) => sheet_default.getTemplate(sheet, idx)) + }; + } +}; +var sheets_default = sheetsFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/workbook.ts +var workbookFactory = { + getTemplate(names, activeTab) { + 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 + } + } + } + ] + }, + sheets_default.getTemplate(names) + ] + }; + } +}; +var workbook_default = workbookFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/worksheet.ts +import { _escapeString as _escapeString6 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/column.ts +var getExcelCellWidth = (width) => Math.ceil((width - 12) / 7 + 1); +var colFactory = { + getTemplate(config) { + const { min, max, outlineLevel, s: s2, width, hidden, bestFit } = config; + let excelWidth = 1; + let customWidth = "0"; + if (width > 1) { + excelWidth = getExcelCellWidth(width); + customWidth = "1"; + } + return { + name: "col", + properties: { + rawMap: { + min, + max, + outlineLevel: outlineLevel != null ? outlineLevel : void 0, + width: excelWidth, + style: s2, + hidden: hidden ? "1" : "0", + bestFit: bestFit ? "1" : "0", + customWidth + } + } + }; + } +}; +var column_default = colFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/mergeCell.ts +var mergeCellFactory = { + getTemplate(ref) { + return { + name: "mergeCell", + properties: { + rawMap: { + ref + } + } + }; + } +}; +var mergeCell_default = mergeCellFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/cell.ts +import { _escapeString as _escapeString5 } from "ag-grid-community"; +var convertLegacyType = (type) => { + const t = type.charAt(0).toLowerCase(); + return t === "s" ? "inlineStr" : t; +}; +var cellFactory = { + getTemplate(config, idx, currentSheet2) { + const { ref, data, styleId } = config; + const { type, value } = data || { type: "empty", value: null }; + let convertedType = type; + if (type === "f") { + convertedType = "str"; + } else if (type.charAt(0) === type.charAt(0).toUpperCase()) { + convertedType = convertLegacyType(type); + } + const obj = { + name: "c", + properties: { + rawMap: { + r: ref, + t: convertedType === "empty" ? void 0 : convertedType, + s: styleId ? getStyleId(styleId, currentSheet2) : void 0 + } + } + }; + if (convertedType === "empty") { + return obj; + } + let children; + if (convertedType === "str" && type === "f") { + children = [ + { + name: "f", + textNode: _escapeString5(replaceInvisibleCharacters(value)) + } + ]; + } else if (convertedType === "inlineStr") { + children = [ + { + name: "is", + children: [ + { + name: "t", + textNode: _escapeString5(replaceInvisibleCharacters(value)) + } + ] + } + ]; + } else { + children = [ + { + name: "v", + textNode: value + } + ]; + } + return Object.assign({}, obj, { children }); + } +}; +var cell_default = cellFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/row.ts +var addEmptyCells = (cells, rowIdx) => { + const mergeMap = []; + let posCounter = 0; + for (let i = 0; i < cells.length; i++) { + const cell = cells[i]; + if (cell.mergeAcross) { + mergeMap.push({ + pos: i, + excelPos: posCounter + }); + posCounter += cell.mergeAcross; + } + posCounter++; + } + if (mergeMap.length) { + for (let i = mergeMap.length - 1; i >= 0; i--) { + const mergedCells = []; + const cell = cells[mergeMap[i].pos]; + for (let j = 1; j <= cell.mergeAcross; j++) { + mergedCells.push({ + ref: `${getExcelColumnName(mergeMap[i].excelPos + 1 + j)}${rowIdx + 1}`, + styleId: cell.styleId, + data: { type: "empty", value: null } + }); + } + if (mergedCells.length) { + cells.splice(mergeMap[i].pos + 1, 0, ...mergedCells); + } + } + } +}; +var shouldDisplayCell = (cell) => cell.data?.value !== "" || cell.styleId !== void 0; +var rowFactory = { + getTemplate(config, idx, currentSheet2) { + const { collapsed, hidden, height, outlineLevel, cells = [] } = config; + addEmptyCells(cells, idx); + const children = cells.filter(shouldDisplayCell).map((cell, idx2) => cell_default.getTemplate(cell, idx2, currentSheet2)); + return { + name: "row", + properties: { + rawMap: { + r: idx + 1, + collapsed: collapsed ? "1" : "0", + hidden: hidden ? "1" : "0", + ht: height, + customHeight: height != null ? "1" : "0", + spans: "1:1", + outlineLevel: outlineLevel || void 0 + } + }, + children + }; + } +}; +var row_default = rowFactory; + +// packages/ag-grid-enterprise/src/excelExport/files/ooxml/worksheet.ts +var getMergedCellsAndAddColumnGroups = (rows, cols, suppressColumnOutline) => { + const mergedCells = []; + const cellsWithCollapsibleGroups = []; + rows.forEach((currentRow, rowIdx) => { + const cells = currentRow.cells; + let merges = 0; + let lastCol; + cells.forEach((currentCell, cellIdx) => { + const min = cellIdx + merges + 1; + const start = getExcelColumnName(min); + const outputRow = rowIdx + 1; + if (currentCell.mergeAcross) { + merges += currentCell.mergeAcross; + const end = getExcelColumnName(cellIdx + merges + 1); + mergedCells.push(`${start}${outputRow}:${end}${outputRow}`); + } + if (!cols[min - 1]) { + cols[min - 1] = {}; + } + const { collapsibleRanges } = currentCell; + if (collapsibleRanges) { + collapsibleRanges.forEach((range) => { + cellsWithCollapsibleGroups.push([min + range[0], min + range[1]]); + }); + } + lastCol = cols[min - 1]; + lastCol.min = min; + lastCol.max = min; + currentCell.ref = `${start}${outputRow}`; + }); + }); + cellsWithCollapsibleGroups.sort((a, b) => { + if (a[0] !== b[0]) { + return a[0] - b[0]; + } + return b[1] - a[1]; + }); + const rangeMap = /* @__PURE__ */ new Map(); + const outlineLevel = /* @__PURE__ */ new Map(); + cellsWithCollapsibleGroups.filter((currentRange) => { + const rangeString = currentRange.toString(); + const inMap = rangeMap.get(rangeString); + if (inMap) { + return false; + } + rangeMap.set(rangeString, true); + return true; + }).forEach((range) => { + const refCol = cols.find((col) => col.min == range[0] && col.max == range[1]); + const currentOutlineLevel = outlineLevel.get(range[0]); + cols.push({ + min: range[0], + max: range[1], + outlineLevel: suppressColumnOutline ? void 0 : currentOutlineLevel || 1, + width: (refCol || { width: 100 }).width + }); + outlineLevel.set(range[0], (currentOutlineLevel || 0) + 1); + }); + return mergedCells; +}; +var getPageOrientation = (orientation) => { + if (!orientation || orientation !== "Portrait" && orientation !== "Landscape") { + return "portrait"; + } + return orientation.toLocaleLowerCase(); +}; +var getPageSize = (pageSize) => { + if (pageSize == null) { + return 1; + } + const positions = [ + "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" + ]; + const pos = positions.indexOf(pageSize); + return pos === -1 ? 1 : pos + 1; +}; +var replaceHeaderFooterTokens = (value) => { + const map = { + "&[Page]": "&P", + "&[Pages]": "&N", + "&[Date]": "&D", + "&[Time]": "&T", + "&[Tab]": "&A", + "&[Path]": "&Z", + "&[File]": "&F", + "&[Picture]": "&G" + }; + for (const key of Object.keys(map)) { + value = value.replace(key, map[key]); + } + return value; +}; +var getHeaderPosition = (position) => { + if (position === "Center") { + return "C"; + } + if (position === "Right") { + return "R"; + } + return "L"; +}; +var applyHeaderFontStyle = (headerString, font) => { + if (!font) { + return headerString; + } + headerString += "&""; + headerString += font.fontName || "Calibri"; + if (font.bold !== font.italic) { + headerString += font.bold ? ",Bold" : ",Italic"; + } else if (font.bold) { + headerString += ",Bold Italic"; + } else { + headerString += ",Regular"; + } + headerString += """; + if (font.size) { + headerString += `&${font.size}`; + } + if (font.strikeThrough) { + headerString += "&S"; + } + if (font.underline) { + headerString += `&${font.underline === "Double" ? "E" : "U"}`; + } + if (font.color) { + headerString += `&K${font.color.replace("#", "").toUpperCase()}`; + } + return headerString; +}; +var processHeaderFooterContent = (content, location, rule) => content.reduce((prev, curr, idx) => { + const pos = getHeaderPosition(curr.position); + const output = applyHeaderFontStyle(`${prev}&${pos}`, curr.font); + const PositionMap = ["Left", "Center", "Right"]; + if (!curr.position) { + curr.position = PositionMap[idx]; + } + const { image } = curr; + if (curr.value === "&[Picture]" && image) { + const imagePosition = `${pos}${location}${rule}`; + addXlsxHeaderFooterImageToMap(image, imagePosition); + } + return `${output}${_escapeString6(replaceHeaderFooterTokens(curr.value))}`; +}, ""); +var buildHeaderFooter = (headerFooterConfig) => { + const rules = ["all", "first", "even"]; + const headersAndFooters = []; + rules.forEach((rule) => { + const headerFooter = headerFooterConfig[rule]; + const namePrefix = rule === "all" ? "odd" : rule; + if (!headerFooter) { + return; + } + for (const key of Object.keys(headerFooter)) { + const value = headerFooter[key]; + const nameSuffix = `${key.charAt(0).toUpperCase()}${key.slice(1)}`; + const location = key[0].toUpperCase(); + if (value) { + const normalizedRule = rule === "all" ? "" : rule.toUpperCase(); + headersAndFooters.push({ + name: `${namePrefix}${nameSuffix}`, + properties: { + rawMap: { "xml:space": "preserve" } + }, + textNode: processHeaderFooterContent(value, location, normalizedRule) + }); + } + } + }); + return headersAndFooters; +}; +var addColumns = (columns) => { + return (params) => { + if (columns.length) { + params.children.push({ + name: "cols", + children: columns.map((column) => column_default.getTemplate(column)) + }); + } + return params; + }; +}; +var addSheetData = (rows, sheetNumber) => { + return (params) => { + if (rows.length) { + params.children.push({ + name: "sheetData", + children: rows.map((row, idx) => row_default.getTemplate(row, idx, sheetNumber)) + }); + } + return params; + }; +}; +var getPasswordHash = (password) => { + const passwordLength = password.length; + if (!passwordLength) { + return ""; + } + const passwordArray = new Array(passwordLength + 1); + passwordArray[0] = passwordLength; + for (let i = 1; i <= passwordLength; i++) { + passwordArray[i] = password.charCodeAt(i - 1) & 255; + } + let verifier = 0; + for (let i = passwordArray.length - 1; i >= 0; i--) { + const passwordByte = passwordArray[i]; + const intermediate1 = (verifier & 16384) === 0 ? 0 : 1; + const intermediate2 = verifier << 1 & 32767; + verifier = (intermediate1 | intermediate2) ^ passwordByte; + } + return (verifier ^ 52811).toString(16).toUpperCase().padStart(4, "0"); +}; +var addSheetProtection = (protectSheet) => { + return (params) => { + if (!protectSheet) { + return params; + } + const sheetProtection = typeof protectSheet === "boolean" ? {} : protectSheet; + const rawMap = { + sheet: 1 + }; + const passwordHash = sheetProtection.password ? getPasswordHash(sheetProtection.password) : ""; + if (passwordHash) { + rawMap.password = passwordHash; + } + const defaults = { + autoFilter: false, + deleteColumns: false, + deleteRows: false, + formatCells: false, + formatColumns: false, + formatRows: false, + insertColumns: false, + insertHyperlinks: false, + insertRows: false, + pivotTables: false, + selectLockedCells: true, + selectUnlockedCells: true + }; + Object.keys(defaults).forEach( + (key) => { + const allow = sheetProtection[key]; + if (allow == null || allow === defaults[key]) { + return; + } + rawMap[key] = allow ? 0 : 1; + } + ); + params.children.push({ + name: "sheetProtection", + properties: { + rawMap + } + }); + return params; + }; +}; +var addMergeCells = (mergeCells) => { + return (params) => { + if (mergeCells.length) { + params.children.push({ + name: "mergeCells", + properties: { + rawMap: { + count: mergeCells.length + } + }, + children: mergeCells.map((mergedCell) => mergeCell_default.getTemplate(mergedCell)) + }); + } + return params; + }; +}; +var addPageMargins = (margins) => { + return (params) => { + const { top = 0.75, right = 0.7, bottom = 0.75, left = 0.7, header = 0.3, footer = 0.3 } = margins; + params.children.push({ + name: "pageMargins", + properties: { + rawMap: { bottom, footer, header, left, right, top } + } + }); + return params; + }; +}; +var addPageSetup = (pageSetup) => { + return (params) => { + if (pageSetup) { + params.children.push({ + name: "pageSetup", + properties: { + rawMap: { + horizontalDpi: 0, + verticalDpi: 0, + orientation: getPageOrientation(pageSetup.orientation), + paperSize: getPageSize(pageSetup.pageSize) + } + } + }); + } + return params; + }; +}; +var addHeaderFooter = (headerFooterConfig) => { + return (params) => { + if (!headerFooterConfig) { + return params; + } + const differentFirst = headerFooterConfig.first != null ? 1 : 0; + const differentOddEven = headerFooterConfig.even != null ? 1 : 0; + params.children.push({ + name: "headerFooter", + properties: { + rawMap: { + differentFirst, + differentOddEven + } + }, + children: buildHeaderFooter(headerFooterConfig) + }); + return params; + }; +}; +var addExcelTableRel = (excelTable) => { + return (params) => { + if (excelTable) { + params.children.push({ + name: "tableParts", + properties: { + rawMap: { + count: "1" + } + }, + children: [ + { + name: "tablePart", + properties: { + rawMap: { + "r:id": `rId${++params.rIdCounter}` + } + } + } + ] + }); + } + return params; + }; +}; +var addDrawingRel = (currentSheet2) => { + return (params) => { + const worksheetImages = XLSX_WORKSHEET_IMAGES.get(currentSheet2); + if (worksheetImages?.length) { + params.children.push({ + name: "drawing", + properties: { + rawMap: { + "r:id": `rId${++params.rIdCounter}` + } + } + }); + } + return params; + }; +}; +var addVmlDrawingRel = (currentSheet2) => { + return (params) => { + if (XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.get(currentSheet2)) { + params.children.push({ + name: "legacyDrawingHF", + properties: { + rawMap: { + "r:id": `rId${++params.rIdCounter}` + } + } + }); + } + return params; + }; +}; +var getPane = (xSplit = 0, ySplit = 0) => { + const shouldSplit = xSplit > 0 || ySplit > 0; + return shouldSplit ? [ + { + name: "pane", + properties: { + rawMap: { + state: shouldSplit ? "frozen" : void 0, + topLeftCell: shouldSplit ? `${getExcelColumnName(xSplit + 1)}${ySplit + 1}` : void 0, + xSplit: xSplit === 0 ? void 0 : xSplit, + ySplit: ySplit === 0 ? void 0 : ySplit + } + } + } + ] : void 0; +}; +var addSheetViews = (rtl = false, xSplit, ySplit) => { + return (params) => { + params.children.push({ + name: "sheetViews", + children: [ + { + name: "sheetView", + properties: { + rawMap: { + rightToLeft: rtl === true ? "1" : "0", + workbookViewId: "0" + } + }, + children: getPane(xSplit, ySplit) + } + ] + }); + return params; + }; +}; +var addSheetPr = () => { + return (params) => { + params.children.push({ + name: "sheetPr", + children: [ + { + name: "outlinePr", + properties: { + rawMap: { + summaryBelow: 0 + } + } + } + ] + }); + return params; + }; +}; +var addSheetFormatPr = (rows) => { + return (params) => { + const maxOutline = rows.reduce((prev, row) => { + if (row.outlineLevel && row.outlineLevel > prev) { + return row.outlineLevel; + } + return prev; + }, 0); + params.children.push({ + name: "sheetFormatPr", + properties: { + rawMap: { + baseColWidth: 10, + defaultRowHeight: 16, + outlineLevelRow: maxOutline ? maxOutline : void 0 + } + } + }); + return params; + }; +}; +var worksheetFactory = { + getTemplate(params) { + const { worksheet, currentSheet: currentSheet2, config } = params; + const { + margins = {}, + pageSetup, + headerFooterConfig, + suppressColumnOutline, + rightToLeft, + frozenRowCount, + frozenColumnCount, + protectSheet + } = config; + const { table } = worksheet; + const { rows, columns } = table; + const mergedCells = columns?.length ? getMergedCellsAndAddColumnGroups(rows, columns, !!suppressColumnOutline) : []; + const worksheetExcelTables = XLSX_WORKSHEET_DATA_TABLES.get(currentSheet2); + const { children } = [ + addSheetPr(), + addSheetViews(rightToLeft, frozenColumnCount, frozenRowCount), + addSheetFormatPr(rows), + addColumns(columns), + addSheetData(rows, currentSheet2 + 1), + addSheetProtection(protectSheet), + addMergeCells(mergedCells), + addPageMargins(margins), + addPageSetup(pageSetup), + addHeaderFooter(headerFooterConfig), + addDrawingRel(currentSheet2), + addVmlDrawingRel(currentSheet2), + addExcelTableRel(worksheetExcelTables) + ].reduce((composed, f) => f(composed), { 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 + }; + } +}; +var worksheet_default = worksheetFactory; + +// packages/ag-grid-enterprise/src/excelExport/excelXlsxFactory.ts +var XLSX_SHARED_STRINGS = /* @__PURE__ */ new Map(); +var XLSX_SHEET_NAMES = []; +var XLSX_SHEET_DATA = []; +var XLSX_SHEET_CONTENT_INDICES = /* @__PURE__ */ new Map(); +var XLSX_IMAGES = /* @__PURE__ */ new Map(); +var XLSX_WORKSHEET_IMAGES = /* @__PURE__ */ new Map(); +var XLSX_WORKSHEET_HEADER_FOOTER_IMAGES = /* @__PURE__ */ new Map(); +var XLSX_WORKBOOK_IMAGE_IDS = /* @__PURE__ */ new Map(); +var XLSX_WORKSHEET_IMAGE_IDS = /* @__PURE__ */ new Map(); +var XLSX_WORKSHEET_DATA_TABLES = /* @__PURE__ */ new Map(); +var DEFAULT_TABLE_DISPLAY_NAME = "AG-GRID-TABLE"; +var XLSX_FACTORY_MODE = "SINGLE_SHEET"; +function getXlsxFactoryMode() { + return XLSX_FACTORY_MODE; +} +function setXlsxFactoryMode(factoryMode) { + XLSX_FACTORY_MODE = factoryMode; +} +function createXlsxExcel(styles, worksheet, config) { + addSheetName(worksheet); + registerStyles(styles, XLSX_SHEET_NAMES.length); + const newConfig = Object.assign({}, config); + if (config.exportAsExcelTable && config.pivotModeActive) { + _warn2(163, { featureName: "pivot mode" }); + newConfig.exportAsExcelTable = false; + } + processTableConfig(worksheet, newConfig); + const worksheetXml = createWorksheet(worksheet, newConfig); + registerSheetXml(worksheetXml); + return worksheetXml; +} +function getXlsxSanitizedTableName(name) { + return name.replace(/^[^a-zA-Z_]+/, "_").replace(/\s/g, "_").replace(/[^a-zA-Z0-9_]/g, "_"); +} +function addXlsxTableToSheet(sheetIndex, table) { + if (XLSX_WORKSHEET_DATA_TABLES.has(sheetIndex)) { + _warn2(164); + return; + } + XLSX_WORKSHEET_DATA_TABLES.set(sheetIndex, table); +} +function processTableConfig(worksheet, config) { + const { exportAsExcelTable, prependContent, appendContent, headerRowCount = 0 } = config; + if (!exportAsExcelTable) { + return; + } + const tableConfig = typeof exportAsExcelTable === "boolean" ? {} : exportAsExcelTable; + const { name, showColumnStripes, showRowStripes, showFilterButton, highlightFirstColumn, highlightLastColumn } = tableConfig; + const tableName = getXlsxSanitizedTableName(name || DEFAULT_TABLE_DISPLAY_NAME); + const sheetIndex = XLSX_SHEET_NAMES.length - 1; + const { table } = worksheet; + const { rows, columns } = table; + const skipTopRows = prependContent ? prependContent.length : 0; + const removeFromBottom = appendContent ? appendContent.length : 0; + const tableRowCount = rows.length; + const tableColCount = columns.length; + const tableColumns = []; + const showFilterButtons = []; + for (let i = 0; i < tableColCount; i++) { + const col = columns[i]; + tableColumns.push(col.displayName || ""); + showFilterButtons.push( + showFilterButton === "match" || showFilterButton === void 0 ? col.filterAllowed ?? false : showFilterButton + ); + } + if (!tableColumns?.length || !tableRowCount || !tableName) { + _warn2(165); + return; + } + addXlsxTableToSheet(sheetIndex, { + name: `table${XLSX_WORKSHEET_DATA_TABLES.size + 1}`, + displayName: tableName, + columns: tableColumns, + showFilterButtons, + rowRange: [headerRowCount + skipTopRows, headerRowCount + (tableRowCount - headerRowCount) - removeFromBottom], + showRowStripes: showRowStripes ?? true, + showColumnStripes: showColumnStripes ?? false, + highlightFirstColumn: highlightFirstColumn ?? false, + highlightLastColumn: highlightLastColumn ?? false + }); +} +function addXlsxHeaderFooterImageToMap(image, position) { + const sheetIndex = XLSX_SHEET_NAMES.length - 1; + const headerFooterImage = image; + headerFooterImage.headerFooterPosition = position; + buildImageMap({ imageToAdd: headerFooterImage, idx: sheetIndex }); + let headerFooterImagesForSheet = XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.get(sheetIndex); + if (!headerFooterImagesForSheet) { + headerFooterImagesForSheet = []; + XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.set(sheetIndex, headerFooterImagesForSheet); + } + if (!headerFooterImagesForSheet.find((img) => img.id === image.id)) { + headerFooterImagesForSheet.push(image); + } +} +function addXlsxBodyImageToMap(image, rowIndex, col, columnsToExport, rowHeight) { + const sheetIndex = XLSX_SHEET_NAMES.length; + const { row, column } = image.position || {}; + const calculatedImage = image; + if (columnsToExport) { + if (rowIndex != null && col != null && (!row || !column)) { + if (!image.position) { + image.position = {}; + } + image.position = Object.assign({}, image.position, { + row: rowIndex, + column: columnsToExport.indexOf(col) + 1 + }); + } + setExcelImageTotalWidth(calculatedImage, columnsToExport); + setExcelImageTotalHeight(calculatedImage, rowHeight); + } + buildImageMap({ imageToAdd: calculatedImage, idx: sheetIndex }); + let worksheetImageIdMap = XLSX_WORKSHEET_IMAGE_IDS.get(sheetIndex); + if (!worksheetImageIdMap) { + worksheetImageIdMap = /* @__PURE__ */ new Map(); + XLSX_WORKSHEET_IMAGE_IDS.set(sheetIndex, worksheetImageIdMap); + } + const sheetImages = XLSX_WORKSHEET_IMAGES.get(sheetIndex); + if (!sheetImages) { + XLSX_WORKSHEET_IMAGES.set(sheetIndex, [calculatedImage]); + } else { + sheetImages.push(calculatedImage); + } + if (!worksheetImageIdMap.get(image.id)) { + worksheetImageIdMap.set(image.id, { index: worksheetImageIdMap.size, type: image.imageType }); + } +} +function buildImageMap(params) { + const { imageToAdd, idx } = params; + const mappedImagesToSheet = XLSX_IMAGES.get(imageToAdd.id); + if (mappedImagesToSheet) { + const currentSheetImages = mappedImagesToSheet.find((currentImage) => currentImage.sheetId === idx); + if (currentSheetImages) { + currentSheetImages.image.push(imageToAdd); + } else { + mappedImagesToSheet.push({ + sheetId: idx, + image: [imageToAdd] + }); + } + } else { + XLSX_IMAGES.set(imageToAdd.id, [{ sheetId: idx, image: [imageToAdd] }]); + XLSX_WORKBOOK_IMAGE_IDS.set(imageToAdd.id, { + type: imageToAdd.imageType, + index: XLSX_WORKBOOK_IMAGE_IDS.size + }); + } +} +function addSheetName(worksheet) { + const name = _escapeString7(worksheet.name) || ""; + let append = ""; + while (XLSX_SHEET_NAMES.indexOf(`${name}${append}`) !== -1) { + if (append === "") { + append = "_1"; + } else { + const curr = parseInt(append.slice(1), 10); + append = `_${curr + 1}`; + } + } + worksheet.name = `${name}${append}`; + XLSX_SHEET_NAMES.push(worksheet.name); +} +function getXlsxStringPosition(str) { + if (XLSX_SHARED_STRINGS.has(str)) { + return XLSX_SHARED_STRINGS.get(str); + } + XLSX_SHARED_STRINGS.set(str, XLSX_SHARED_STRINGS.size); + return XLSX_SHARED_STRINGS.size - 1; +} +function resetXlsxFactory() { + XLSX_SHARED_STRINGS.clear(); + XLSX_IMAGES.clear(); + XLSX_WORKSHEET_IMAGES.clear(); + XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.clear(); + XLSX_WORKBOOK_IMAGE_IDS.clear(); + XLSX_WORKSHEET_IMAGE_IDS.clear(); + XLSX_WORKSHEET_DATA_TABLES.clear(); + XLSX_SHEET_NAMES = []; + XLSX_SHEET_DATA = []; + XLSX_SHEET_CONTENT_INDICES = /* @__PURE__ */ new Map(); + XLSX_FACTORY_MODE = "SINGLE_SHEET"; +} +function createXlsxWorkbook(currentSheet2) { + return createXmlPart(workbook_default.getTemplate(XLSX_SHEET_NAMES, currentSheet2)); +} +function createXlsxStylesheet(defaultFontSize) { + return createXmlPart(stylesheet_default.getTemplate(defaultFontSize)); +} +function createXlsxSharedStrings() { + return createXmlPart(sharedStrings_default.getTemplate(XLSX_SHARED_STRINGS)); +} +function createXlsxCore(author) { + return createXmlPart(core_default.getTemplate(author)); +} +function createXlsxCustomProperties(metadata) { + return createXmlPart(customProperties_default.getTemplate(metadata)); +} +function createXlsxContentTypes(sheetLen, hasCustomProperties) { + return createXmlPart(contentTypes_default.getTemplate({ sheetLen, hasCustomProperties })); +} +function createXlsxRels(hasCustomProperties) { + const relationships = [ + { + 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" + } + ]; + if (hasCustomProperties) { + relationships.push({ + Id: "rId3", + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties", + Target: "docProps/custom.xml" + }); + } + const rs = relationships_default.getTemplate(relationships); + return createXmlPart(rs); +} +function createXlsxTheme() { + return createXmlPart(office_default.getTemplate()); +} +function createXlsxTable(dataTable, index) { + return createXmlPart(table_default.getTemplate(dataTable, index)); +} +function createXlsxWorkbookRels(sheetLen) { + const worksheets = new Array(sheetLen).fill(void 0).map((v, i) => ({ + Id: `rId${i + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet", + Target: `worksheets/sheet${i + 1}.xml` + })); + const rs = relationships_default.getTemplate([ + ...worksheets, + { + Id: `rId${sheetLen + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme", + Target: "theme/theme1.xml" + }, + { + Id: `rId${sheetLen + 2}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles", + Target: "styles.xml" + }, + { + Id: `rId${sheetLen + 3}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings", + Target: "sharedStrings.xml" + } + ]); + return createXmlPart(rs); +} +function createXlsxDrawing(sheetIndex) { + return createXmlPart(drawing_default.getTemplate({ sheetIndex })); +} +function createXlsxDrawingRel(sheetIndex) { + const worksheetImageIds = XLSX_WORKSHEET_IMAGE_IDS.get(sheetIndex) || []; + const XMLArr = []; + for (const [key, value] of worksheetImageIds) { + const { index, type } = value; + XMLArr.push({ + Id: `rId${index + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", + Target: `../media/image${XLSX_WORKBOOK_IMAGE_IDS.get(key).index + 1}.${_normaliseImageExtension(type)}` + }); + } + return createXmlPart(relationships_default.getTemplate(XMLArr)); +} +function createXlsxVmlDrawing(sheetIndex) { + return createXmlPart(vmlDrawing_default.getTemplate({ sheetIndex }), true); +} +function createXlsxVmlDrawingRel(sheetIndex) { + const worksheetHeaderFooterImages = XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.get(sheetIndex) || []; + const XMLArr = []; + for (let i = 0; i < worksheetHeaderFooterImages.length; i++) { + const headerFooterImage = worksheetHeaderFooterImages[i]; + const workbookImage = XLSX_WORKBOOK_IMAGE_IDS.get(headerFooterImage.id); + if (!workbookImage) { + continue; + } + const { index, type } = workbookImage; + XMLArr.push({ + Id: `rId${i + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/image", + Target: `../media/image${index + 1}.${_normaliseImageExtension(type)}` + }); + } + return createXmlPart(relationships_default.getTemplate(XMLArr)); +} +function createXlsxRelationships({ + drawingIndex, + vmlDrawingIndex, + tableName +} = {}) { + if (drawingIndex === void 0 && vmlDrawingIndex === void 0 && tableName === void 0) { + return ""; + } + const config = []; + if (drawingIndex != null) { + config.push({ + Id: `rId${config.length + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing", + Target: `../drawings/drawing${drawingIndex + 1}.xml` + }); + } + if (vmlDrawingIndex != null) { + config.push({ + Id: `rId${config.length + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing", + Target: `../drawings/vmlDrawing${vmlDrawingIndex + 1}.vml` + }); + } + if (tableName != null) { + config.push({ + Id: `rId${config.length + 1}`, + Type: "http://schemas.openxmlformats.org/officeDocument/2006/relationships/table", + Target: `../tables/${tableName}.xml` + }); + } + const rs = relationships_default.getTemplate(config); + return createXmlPart(rs); +} +function createWorksheet(worksheet, config) { + return createXmlPart( + worksheet_default.getTemplate({ + worksheet, + currentSheet: XLSX_SHEET_NAMES.length - 1, + config + }) + ); +} +var reorderSheetSpecificMap = (map, order) => { + if (!map.size) { + return; + } + const remapped = /* @__PURE__ */ new Map(); + order.forEach((originalIdx, newIdx) => { + if (map.has(originalIdx)) { + remapped.set(newIdx, map.get(originalIdx)); + } + }); + map.clear(); + remapped.forEach((value, key) => map.set(key, value)); +}; +var registerSheetXml = (worksheetXml) => { + const indices = XLSX_SHEET_CONTENT_INDICES.get(worksheetXml) ?? []; + indices.push(XLSX_SHEET_NAMES.length - 1); + XLSX_SHEET_CONTENT_INDICES.set(worksheetXml, indices); + XLSX_SHEET_DATA.push(worksheetXml); +}; +var getSheetOrderFromRefs = (data) => { + const refMap = new Map(XLSX_SHEET_CONTENT_INDICES); + const order = []; + for (const sheetData of data) { + const indices = refMap.get(sheetData); + if (!indices?.length) { + return null; + } + const idx = indices.shift(); + order.push(idx); + refMap.set(sheetData, indices); + } + return order; +}; +var getSheetOrderFromData = (data) => { + if (!data.length || XLSX_SHEET_DATA.length === 0) { + return null; + } + const consumed = /* @__PURE__ */ new Set(); + const order = []; + for (const sheetData of data) { + const matchIndex = XLSX_SHEET_DATA.findIndex((value, idx) => !consumed.has(idx) && value === sheetData); + if (matchIndex === -1) { + return null; + } + consumed.add(matchIndex); + order.push(matchIndex); + } + return order; +}; +var reorderSheetState = (order) => { + const indexRemap = /* @__PURE__ */ new Map(); + order.forEach((originalIdx, newIdx) => indexRemap.set(originalIdx, newIdx)); + XLSX_SHEET_NAMES = order.map((idx) => XLSX_SHEET_NAMES[idx]); + XLSX_SHEET_DATA = order.map((idx) => XLSX_SHEET_DATA[idx]); + reorderSheetSpecificMap(XLSX_WORKSHEET_IMAGES, order); + reorderSheetSpecificMap(XLSX_WORKSHEET_HEADER_FOOTER_IMAGES, order); + reorderSheetSpecificMap(XLSX_WORKSHEET_DATA_TABLES, order); + reorderSheetSpecificMap(XLSX_WORKSHEET_IMAGE_IDS, order); + XLSX_IMAGES.forEach((sheetImages) => { + sheetImages.forEach((entry) => { + const remappedId = indexRemap.get(entry.sheetId); + if (remappedId != null) { + entry.sheetId = remappedId; + } + }); + }); + XLSX_SHEET_CONTENT_INDICES = /* @__PURE__ */ new Map(); + XLSX_SHEET_DATA.forEach((xml, idx) => { + const indices = XLSX_SHEET_CONTENT_INDICES.get(xml) ?? []; + indices.push(idx); + XLSX_SHEET_CONTENT_INDICES.set(xml, indices); + }); +}; +var syncXlsxOrderWithSheetData = (data) => { + if (data.length <= 1) { + return; + } + const order = getSheetOrderFromRefs(data) ?? getSheetOrderFromData(data); + if (!order) { + return; + } + reorderSheetState(order); +}; +var Workbook = class { + getStringPosition(str) { + return getXlsxStringPosition(str); + } + addBodyImageToMap(image, rowIndex, col, columnsToExport, rowHeight) { + addXlsxBodyImageToMap(image, rowIndex, col, columnsToExport, rowHeight); + } + addHeaderFooterImageToMap(image, position) { + addXlsxHeaderFooterImageToMap(image, position); + } + addWorksheet(styles, worksheet, config) { + return createXlsxExcel(styles, worksheet, config); + } + syncOrderWithSheetData(data) { + syncXlsxOrderWithSheetData(data); + } + reset() { + resetXlsxFactory(); + } + setFactoryMode(factoryMode) { + setXlsxFactoryMode(factoryMode); + } + getFactoryMode() { + return getXlsxFactoryMode(); + } + getSheetNames() { + return [...XLSX_SHEET_NAMES]; + } +}; + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/zipContainerHelper.ts +import { _errMsg } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/compress.ts +var compressBlob = async (data) => { + let chunksSize = 0; + const chunks = []; + const writeCompressedData = new WritableStream({ + write: (chunk) => { + chunks.push(chunk); + chunksSize += chunk.length; + } + }); + const readable = new ReadableStream({ + start: (controller) => { + const reader = new FileReader(); + reader.onload = (e) => { + if (e.target?.result) { + controller.enqueue(e.target.result); + } + controller.close(); + }; + reader.readAsArrayBuffer(data); + } + }); + const compressStream = new window.CompressionStream("deflate-raw"); + await readable.pipeThrough(compressStream).pipeTo(writeCompressedData); + return { + size: chunksSize, + content: new Blob(chunks) + }; +}; +var deflateLocalFile = async (rawContent) => { + const contentAsBlob = new Blob([rawContent]); + const { size: compressedSize, content: compressedContent } = await compressBlob(contentAsBlob); + const compressedContentAsUint8Array = new Uint8Array(await compressedContent.arrayBuffer()); + return { + size: compressedSize, + content: compressedContentAsUint8Array + }; +}; + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/convert.ts +var convertTime = (date) => { + let time = date.getHours(); + time <<= 6; + time = time | date.getMinutes(); + time <<= 5; + time = time | date.getSeconds() / 2; + return time; +}; +var convertDate = (date) => { + let dt = date.getFullYear() - 1980; + dt <<= 4; + dt = dt | date.getMonth() + 1; + dt <<= 5; + dt = dt | date.getDate(); + return dt; +}; +function convertDecToHex(number, bytes) { + let hex = ""; + for (let i = 0; i < bytes; i++) { + hex += String.fromCharCode(number & 255); + number >>>= 8; + } + return hex; +} + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/crcTable.ts +var getCrcFromCrc32TableAndByteArray = (content) => { + if (!content.length) { + return 0; + } + let crc = 0 ^ -1; + let j = 0; + let k = 0; + let l = 0; + for (let i = 0; i < content.length; i++) { + j = content[i]; + k = (crc ^ j) & 255; + l = crcTable[k]; + crc = crc >>> 8 ^ l; + } + return crc ^ -1; +}; +var getCrcFromCrc32Table = (content) => { + if (!content.length) { + return 0; + } + if (typeof content === "string") { + return getCrcFromCrc32TableAndByteArray(new TextEncoder().encode(content)); + } + return getCrcFromCrc32TableAndByteArray(content); +}; +var crcTable = /* @__PURE__ */ new Uint32Array([ + 0, + 1996959894, + 3993919788, + 2567524794, + 124634137, + 1886057615, + 3915621685, + 2657392035, + 249268274, + 2044508324, + 3772115230, + 2547177864, + 162941995, + 2125561021, + 3887607047, + 2428444049, + 498536548, + 1789927666, + 4089016648, + 2227061214, + 450548861, + 1843258603, + 4107580753, + 2211677639, + 325883990, + 1684777152, + 4251122042, + 2321926636, + 335633487, + 1661365465, + 4195302755, + 2366115317, + 997073096, + 1281953886, + 3579855332, + 2724688242, + 1006888145, + 1258607687, + 3524101629, + 2768942443, + 901097722, + 1119000684, + 3686517206, + 2898065728, + 853044451, + 1172266101, + 3705015759, + 2882616665, + 651767980, + 1373503546, + 3369554304, + 3218104598, + 565507253, + 1454621731, + 3485111705, + 3099436303, + 671266974, + 1594198024, + 3322730930, + 2970347812, + 795835527, + 1483230225, + 3244367275, + 3060149565, + 1994146192, + 31158534, + 2563907772, + 4023717930, + 1907459465, + 112637215, + 2680153253, + 3904427059, + 2013776290, + 251722036, + 2517215374, + 3775830040, + 2137656763, + 141376813, + 2439277719, + 3865271297, + 1802195444, + 476864866, + 2238001368, + 4066508878, + 1812370925, + 453092731, + 2181625025, + 4111451223, + 1706088902, + 314042704, + 2344532202, + 4240017532, + 1658658271, + 366619977, + 2362670323, + 4224994405, + 1303535960, + 984961486, + 2747007092, + 3569037538, + 1256170817, + 1037604311, + 2765210733, + 3554079995, + 1131014506, + 879679996, + 2909243462, + 3663771856, + 1141124467, + 855842277, + 2852801631, + 3708648649, + 1342533948, + 654459306, + 3188396048, + 3373015174, + 1466479909, + 544179635, + 3110523913, + 3462522015, + 1591671054, + 702138776, + 2966460450, + 3352799412, + 1504918807, + 783551873, + 3082640443, + 3233442989, + 3988292384, + 2596254646, + 62317068, + 1957810842, + 3939845945, + 2647816111, + 81470997, + 1943803523, + 3814918930, + 2489596804, + 225274430, + 2053790376, + 3826175755, + 2466906013, + 167816743, + 2097651377, + 4027552580, + 2265490386, + 503444072, + 1762050814, + 4150417245, + 2154129355, + 426522225, + 1852507879, + 4275313526, + 2312317920, + 282753626, + 1742555852, + 4189708143, + 2394877945, + 397917763, + 1622183637, + 3604390888, + 2714866558, + 953729732, + 1340076626, + 3518719985, + 2797360999, + 1068828381, + 1219638859, + 3624741850, + 2936675148, + 906185462, + 1090812512, + 3747672003, + 2825379669, + 829329135, + 1181335161, + 3412177804, + 3160834842, + 628085408, + 1382605366, + 3423369109, + 3138078467, + 570562233, + 1426400815, + 3317316542, + 2998733608, + 733239954, + 1555261956, + 3268935591, + 3050360625, + 752459403, + 1541320221, + 2607071920, + 3965973030, + 1969922972, + 40735498, + 2617837225, + 3943577151, + 1913087877, + 83908371, + 2512341634, + 3803740692, + 2075208622, + 213261112, + 2463272603, + 3855990285, + 2094854071, + 198958881, + 2262029012, + 4057260610, + 1759359992, + 534414190, + 2176718541, + 4139329115, + 1873836001, + 414664567, + 2282248934, + 4279200368, + 1711684554, + 285281116, + 2405801727, + 4167216745, + 1634467795, + 376229701, + 2685067896, + 3608007406, + 1308918612, + 956543938, + 2808555105, + 3495958263, + 1231636301, + 1047427035, + 2932959818, + 3654703836, + 1088359270, + 936918e3, + 2847714899, + 3736837829, + 1202900863, + 817233897, + 3183342108, + 3401237130, + 1404277552, + 615818150, + 3134207493, + 3453421203, + 1423857449, + 601450431, + 3009837614, + 3294710456, + 1567103746, + 711928724, + 3020668471, + 3272380065, + 1510334235, + 755167117 +]); + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/zipContainerHelper.ts +function _utf8_encode(s2) { + const stringFromCharCode = String.fromCharCode; + function ucs2decode(string) { + const output = []; + if (!string) { + return []; + } + const len = string.length; + let counter = 0; + let value; + let extra; + while (counter < len) { + value = string.charCodeAt(counter++); + if (value >= 55296 && value <= 56319 && counter < len) { + extra = string.charCodeAt(counter++); + if ((extra & 64512) == 56320) { + output.push(((value & 1023) << 10) + (extra & 1023) + 65536); + } else { + output.push(value); + counter--; + } + } else { + output.push(value); + } + } + return output; + } + function checkScalarValue(point) { + if (point >= 55296 && point <= 57343) { + throw new Error(_errMsg(255, { point })); + } + } + function createByte(point, shift) { + return stringFromCharCode(point >> shift & 63 | 128); + } + function encodeCodePoint(point) { + if ((point & 4294967168) == 0) { + return stringFromCharCode(point); + } + let symbol = ""; + if ((point & 4294965248) == 0) { + symbol = stringFromCharCode(point >> 6 & 31 | 192); + } else if ((point & 4294901760) == 0) { + checkScalarValue(point); + symbol = stringFromCharCode(point >> 12 & 15 | 224); + symbol += createByte(point, 6); + } else if ((point & 4292870144) == 0) { + symbol = stringFromCharCode(point >> 18 & 7 | 240); + symbol += createByte(point, 12); + symbol += createByte(point, 6); + } + symbol += stringFromCharCode(point & 63 | 128); + return symbol; + } + const codePoints = ucs2decode(s2); + const length = codePoints.length; + let index = -1; + let codePoint; + let byteString = ""; + while (++index < length) { + codePoint = codePoints[index]; + byteString += encodeCodePoint(codePoint); + } + return byteString; +} +var getHeaders = (currentFile, isCompressed, offset, rawSize, rawContent, deflatedSize) => { + const { content, path, created: creationDate } = currentFile; + const time = convertTime(creationDate); + const dt = convertDate(creationDate); + const crcFlag = getCrcFromCrc32Table(rawContent); + const zipSize = deflatedSize !== void 0 ? deflatedSize : rawSize; + const utfPath = _utf8_encode(path); + const isUTF8 = utfPath !== path; + let extraFields = ""; + if (isUTF8) { + const uExtraFieldPath = convertDecToHex(1, 1) + convertDecToHex(getCrcFromCrc32Table(utfPath), 4) + utfPath; + extraFields = "up" + convertDecToHex(uExtraFieldPath.length, 2) + uExtraFieldPath; + } + const commonHeader = "\0" + // version needed to extract + (isUTF8 ? "\0\b" : "\0\0") + // Language encoding flag (EFS) (12th bit turned on) + convertDecToHex(isCompressed ? 8 : 0, 2) + // As per ECMA-376 Part 2 specs + convertDecToHex(time, 2) + // last modified time + convertDecToHex(dt, 2) + // last modified date + convertDecToHex(zipSize ? crcFlag : 0, 4) + convertDecToHex(deflatedSize ?? rawSize, 4) + // compressed size + convertDecToHex(rawSize, 4) + // uncompressed size + convertDecToHex(utfPath.length, 2) + // file name length + convertDecToHex(extraFields.length, 2); + const localFileHeader = "PK" + commonHeader + utfPath + extraFields; + const centralDirectoryHeader = "PK\0" + commonHeader + // file header + "\0\0\0\0\0\0" + (content ? "\0\0\0\0" : "\0\0\0") + // external file attributes + convertDecToHex(offset, 4) + // relative offset of local header + utfPath + // file name + extraFields; + return { + localFileHeader: Uint8Array.from(localFileHeader, (c) => c.charCodeAt(0)), + centralDirectoryHeader: Uint8Array.from(centralDirectoryHeader, (c) => c.charCodeAt(0)) + }; +}; +var getDecodedContent = (content) => { + let contentToUse; + if (typeof content === "string") { + const base64String = atob(content.split(";base64,")[1]); + contentToUse = Uint8Array.from(base64String, (c) => c.charCodeAt(0)); + } else { + contentToUse = content; + } + return { + size: contentToUse.length, + content: contentToUse + }; +}; +var preprocessFileForZip = async (currentFile) => { + const { content } = currentFile; + const { size: rawSize, content: rawContent } = !content ? { size: 0, content: Uint8Array.from([]) } : getDecodedContent(content); + let deflatedContent; + let deflatedSize; + let deflationPerformed = false; + const shouldDeflate = currentFile.type === "file" && rawContent && rawSize > 0; + if (shouldDeflate) { + const result = await deflateLocalFile(rawContent); + deflatedContent = result.content; + deflatedSize = result.size; + deflationPerformed = true; + } + return { + rawContent, + rawSize, + deflatedContent, + deflatedSize, + isCompressed: deflationPerformed + }; +}; +var getHeaderAndContent = (currentFile, offset) => { + const { content } = currentFile; + const { content: rawContent } = !content ? { content: Uint8Array.from([]) } : getDecodedContent(content); + const headers = getHeaders(currentFile, false, offset, rawContent.length, rawContent, void 0); + return { + ...headers, + content: rawContent, + isCompressed: false + }; +}; +var buildCentralDirectoryEnd = (tLen, cLen, lLen) => { + const str = "PK\0\0\0\0" + convertDecToHex(tLen, 2) + // total number of entries in the central folder + convertDecToHex(tLen, 2) + // total number of entries in the central folder + convertDecToHex(cLen, 4) + // size of the central folder + convertDecToHex(lLen, 4) + // central folder start offset + "\0\0"; + return Uint8Array.from(str, (c) => c.charCodeAt(0)); +}; + +// packages/ag-grid-enterprise/src/excelExport/zipContainer/zipContainer.ts +var ZipContainer = class { + constructor() { + this.folders = []; + this.files = []; + } + addFolders(paths) { + paths.forEach(this.addFolder.bind(this)); + } + addFolder(path) { + this.folders.push({ + path, + created: /* @__PURE__ */ new Date(), + isBase64: false, + type: "folder" + }); + } + addFile(path, content, isBase64 = false) { + this.files.push({ + path, + created: /* @__PURE__ */ new Date(), + content: isBase64 ? content : new TextEncoder().encode(content), + isBase64, + type: "file" + }); + } + async getZipFile(mimeType = "application/zip") { + const textOutput = await this.buildCompressedFileStream(); + this.clearStream(); + return new Blob([textOutput], { type: mimeType }); + } + getUncompressedZipFile(mimeType = "application/zip") { + const textOutput = this.buildFileStream(); + this.clearStream(); + return new Blob([textOutput], { type: mimeType }); + } + clearStream() { + this.folders = []; + this.files = []; + } + packageFiles(files) { + let fileLen = 0; + let folderLen = 0; + for (const currentFile of files) { + const { localFileHeader, centralDirectoryHeader, content } = currentFile; + fileLen += localFileHeader.length + content.length; + folderLen += centralDirectoryHeader.length; + } + const fileData = new Uint8Array(fileLen); + const folderData = new Uint8Array(folderLen); + let fileOffset = 0; + let folderOffset = 0; + for (const currentFile of files) { + const { localFileHeader, centralDirectoryHeader, content } = currentFile; + fileData.set(localFileHeader, fileOffset); + fileOffset += localFileHeader.length; + fileData.set(content, fileOffset); + fileOffset += content.length; + folderData.set(centralDirectoryHeader, folderOffset); + folderOffset += centralDirectoryHeader.length; + } + const folderEnd = buildCentralDirectoryEnd(files.length, folderLen, fileLen); + const result = new Uint8Array(fileData.length + folderData.length + folderEnd.length); + result.set(fileData); + result.set(folderData, fileData.length); + result.set(folderEnd, fileData.length + folderData.length); + return result; + } + async buildCompressedFileStream() { + const totalFiles = [...this.folders, ...this.files]; + const preprocessed = await Promise.all(totalFiles.map(preprocessFileForZip)); + const processed = []; + let offset = 0; + for (let i = 0; i < totalFiles.length; i++) { + const currentFile = totalFiles[i]; + const { rawContent, rawSize, deflatedContent, deflatedSize, isCompressed } = preprocessed[i]; + const headers = getHeaders(currentFile, isCompressed, offset, rawSize, rawContent, deflatedSize); + const contentToUse = deflatedContent ?? rawContent; + processed.push({ + ...headers, + content: contentToUse, + isCompressed + }); + offset += headers.localFileHeader.length + contentToUse.length; + } + return this.packageFiles(processed); + } + buildFileStream() { + const totalFiles = [...this.folders, ...this.files]; + const readyFiles = []; + let lL = 0; + for (const currentFile of totalFiles) { + const readyFile = getHeaderAndContent(currentFile, lL); + const { localFileHeader, content } = readyFile; + readyFiles.push(readyFile); + lL += localFileHeader.length + content.length; + } + return this.packageFiles(readyFiles); + } +}; + +// packages/ag-grid-enterprise/src/excelExport/excelCreator.ts +var createExcelXMLCoreFolderStructure = (zipContainer) => { + zipContainer.addFolders(["_rels/", "docProps/", "xl/", "xl/theme/", "xl/_rels/", "xl/worksheets/"]); + if (!XLSX_IMAGES.size) { + return; + } + zipContainer.addFolders(["xl/worksheets/_rels", "xl/drawings/", "xl/drawings/_rels", "xl/media/"]); + let imgCounter = 0; + XLSX_IMAGES.forEach((value) => { + const firstImage = value[0].image[0]; + const { base64, imageType } = firstImage; + zipContainer.addFile(`xl/media/image${++imgCounter}.${_normaliseImageExtension(imageType)}`, base64, true); + }); +}; +var createExcelXmlWorksheets = (zipContainer, data) => { + let imageRelationCounter = 0; + let headerFooterImageCounter = 0; + for (let i = 0; i < data.length; i++) { + const value = data[i]; + zipContainer.addFile(`xl/worksheets/sheet${i + 1}.xml`, value, false); + const hasImages = XLSX_IMAGES.size > 0 && XLSX_WORKSHEET_IMAGES.has(i); + const tableData = XLSX_WORKSHEET_DATA_TABLES.size > 0 && XLSX_WORKSHEET_DATA_TABLES.get(i); + const hasHeaderFooterImages = XLSX_IMAGES.size && XLSX_WORKSHEET_HEADER_FOOTER_IMAGES.has(i); + if (!hasImages && !tableData && !hasHeaderFooterImages) { + continue; + } + let tableName; + let drawingIndex; + let vmlDrawingIndex; + if (hasImages) { + createExcelXmlDrawings(zipContainer, i, imageRelationCounter); + drawingIndex = imageRelationCounter; + imageRelationCounter++; + } + if (hasHeaderFooterImages) { + createExcelVmlDrawings(zipContainer, i, headerFooterImageCounter); + vmlDrawingIndex = headerFooterImageCounter; + headerFooterImageCounter++; + } + if (tableData) { + tableName = tableData.name; + } + const worksheetRelFile = `xl/worksheets/_rels/sheet${i + 1}.xml.rels`; + zipContainer.addFile( + worksheetRelFile, + createXlsxRelationships({ + tableName, + drawingIndex, + vmlDrawingIndex + }) + ); + } +}; +var createExcelXmlDrawings = (zipContainer, sheetIndex, drawingIndex) => { + const drawingFolder = "xl/drawings"; + const drawingFileName = `${drawingFolder}/drawing${drawingIndex + 1}.xml`; + const relFileName = `${drawingFolder}/_rels/drawing${drawingIndex + 1}.xml.rels`; + zipContainer.addFile(relFileName, createXlsxDrawingRel(sheetIndex)); + zipContainer.addFile(drawingFileName, createXlsxDrawing(sheetIndex)); +}; +var createExcelVmlDrawings = (zipContainer, sheetIndex, drawingIndex) => { + const drawingFolder = "xl/drawings"; + const drawingFileName = `${drawingFolder}/vmlDrawing${drawingIndex + 1}.vml`; + const relFileName = `${drawingFolder}/_rels/vmlDrawing${drawingIndex + 1}.vml.rels`; + zipContainer.addFile(drawingFileName, createXlsxVmlDrawing(sheetIndex)); + zipContainer.addFile(relFileName, createXlsxVmlDrawingRel(sheetIndex)); +}; +var createExcelXmlTables = (zipContainer) => { + const tablesDataByWorksheet = XLSX_WORKSHEET_DATA_TABLES; + const worksheetKeys = Array.from(tablesDataByWorksheet.keys()); + for (let i = 0; i < worksheetKeys.length; i++) { + const sheetIndex = worksheetKeys[i]; + const table = tablesDataByWorksheet.get(sheetIndex); + if (!table) { + continue; + } + zipContainer.addFile(`xl/tables/${table.name}.xml`, createXlsxTable(table, i)); + } +}; +var createExcelXmlCoreSheets = (zipContainer, fontSize, author, sheetLen, activeTab, customMetadata) => { + const hasCustomMetadata = !!customMetadata && Object.keys(customMetadata).some((key) => customMetadata[key] != null); + zipContainer.addFile("xl/workbook.xml", createXlsxWorkbook(activeTab)); + zipContainer.addFile("xl/styles.xml", createXlsxStylesheet(fontSize)); + zipContainer.addFile("xl/sharedStrings.xml", createXlsxSharedStrings()); + zipContainer.addFile("xl/theme/theme1.xml", createXlsxTheme()); + zipContainer.addFile("xl/_rels/workbook.xml.rels", createXlsxWorkbookRels(sheetLen)); + zipContainer.addFile("docProps/core.xml", createXlsxCore(author)); + if (hasCustomMetadata) { + zipContainer.addFile("docProps/custom.xml", createXlsxCustomProperties(customMetadata)); + } + zipContainer.addFile("[Content_Types].xml", createXlsxContentTypes(sheetLen, hasCustomMetadata)); + zipContainer.addFile("_rels/.rels", createXlsxRels(hasCustomMetadata)); +}; +var createExcelFileForExcel = (zipContainer, data, options = {}, workbook) => { + if (!data || data.length === 0) { + _warn3(159); + workbook.reset(); + return false; + } + workbook.syncOrderWithSheetData(data); + const { fontSize = 11, author = "AG Grid", activeTab = 0, customMetadata } = options; + const len = data.length; + const activeTabWithinBounds = Math.max(Math.min(activeTab, len - 1), 0); + createExcelXMLCoreFolderStructure(zipContainer); + createExcelXmlTables(zipContainer); + createExcelXmlWorksheets(zipContainer, data); + createExcelXmlCoreSheets(zipContainer, fontSize, author, len, activeTabWithinBounds, customMetadata); + workbook.reset(); + return true; +}; +var getMultipleSheetsAsExcelCompressed = (params, workbook = new Workbook()) => { + const { data, fontSize, author, activeSheetIndex, customMetadata } = params; + const mimeType = params.mimeType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + const zipContainer = new ZipContainer(); + if (!createExcelFileForExcel( + zipContainer, + data, + { + author, + fontSize, + activeTab: activeSheetIndex, + customMetadata + }, + workbook + )) { + return Promise.resolve(void 0); + } + return zipContainer.getZipFile(mimeType); +}; +var getMultipleSheetsAsExcel = (params, workbook = new Workbook()) => { + const { data, fontSize, author, activeSheetIndex: activeTab, customMetadata } = params; + const mimeType = params.mimeType || "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"; + const zipContainer = new ZipContainer(); + if (!createExcelFileForExcel( + zipContainer, + data, + { + author, + fontSize, + activeTab, + customMetadata + }, + workbook + )) { + return; + } + return zipContainer.getUncompressedZipFile(mimeType); +}; +var exportMultipleSheetsAsExcel = (params) => { + const { fileName = "export.xlsx" } = params; + const workbook = new Workbook(); + getMultipleSheetsAsExcelCompressed(params, workbook).then((contents) => { + if (contents) { + const downloadFileName = typeof fileName === "function" ? fileName() : fileName; + _downloadFile(downloadFileName, contents); + } + }); +}; +var ExcelCreator = class extends BaseCreator { + constructor() { + super(...arguments); + this.beanName = "excelCreator"; + this.workbook = new Workbook(); + } + getMergedParams(params) { + const baseParams = this.gos.get("defaultExcelExportParams"); + return Object.assign({}, baseParams, params); + } + export(userParams) { + if (this.isExportSuppressed()) { + _warn3(160); + return; + } + const exportFunc = () => { + const mergedParams = this.getMergedParams(userParams); + const data = this.getData(mergedParams); + const { fontSize, author, mimeType, customMetadata } = mergedParams; + const exportParams = { + data: [data], + fontSize, + author, + mimeType, + customMetadata + }; + this.packageCompressedFile(exportParams).then((packageFile) => { + if (packageFile) { + const { fileName } = mergedParams; + const providedFileName = typeof fileName === "function" ? fileName(_addGridCommonParams2(this.gos, {})) : fileName; + _downloadFile(this.getFileName(providedFileName), packageFile); + } + }); + }; + const { overlays } = this.beans; + if (overlays) { + overlays.showExportOverlay(exportFunc); + } else { + exportFunc(); + } + } + exportDataAsExcel(params) { + this.export(params); + } + getDataAsExcel(params) { + const mergedParams = this.getMergedParams(params); + const data = this.getData(mergedParams); + const { fontSize, author, mimeType, customMetadata } = mergedParams; + const exportParams = { + data: [data], + fontSize, + author, + mimeType, + customMetadata + }; + return this.packageFile(exportParams); + } + setFactoryMode(factoryMode) { + this.workbook.setFactoryMode(factoryMode); + } + getFactoryMode() { + return this.workbook.getFactoryMode(); + } + getSheetDataForExcel(params) { + const mergedParams = this.getMergedParams(params); + return this.getData(mergedParams); + } + getMultipleSheetsAsExcel(params) { + return getMultipleSheetsAsExcel(params, this.workbook); + } + exportMultipleSheetsAsExcel(params) { + getMultipleSheetsAsExcelCompressed(params, this.workbook).then((contents) => { + const { fileName = "export.xlsx" } = params; + if (contents) { + const downloadFileName = typeof fileName === "function" ? fileName() : fileName; + _downloadFile(downloadFileName, contents); + } + }); + } + getDefaultFileExtension() { + return "xlsx"; + } + createSerializingSession(params) { + const { colModel, colNames, rowGroupColsSvc, valueSvc, formula, gos } = this.beans; + const baseExcelStyles = gos.get("excelStyles") || []; + const styleLinker = this.createStyleLinker(baseExcelStyles); + const config = { + ...params, + colModel, + colNames, + rowGroupColsSvc, + valueSvc, + formulaSvc: formula, + gos, + suppressRowOutline: params.suppressRowOutline || params.skipRowGroups, + headerRowHeight: params.headerRowHeight || params.rowHeight, + baseExcelStyles, + rightToLeft: params.rightToLeft ?? gos.get("enableRtl"), + styleLinker, + headerRowCount: _getHeaderRowCount(colModel), + pivotModeActive: colModel.isPivotActive(), + workbook: this.workbook + }; + return new ExcelSerializingSession(config); + } + createStyleLinker(baseExcelStyles) { + const styleIds = []; + const styleIdsSet = /* @__PURE__ */ new Set(); + const styleIdOrder = /* @__PURE__ */ new Map(); + baseExcelStyles.forEach((it, idx) => { + styleIds.push(it.id); + styleIdsSet.add(it.id); + styleIdOrder.set(it.id, idx); + }); + const { gos, cellStyles } = this.beans; + return (params) => { + const { rowType, rowIndex, value, column, columnGroup, node } = params; + const isHeader = rowType === "HEADER"; + const isGroupHeader = rowType === "HEADER_GROUPING"; + const col = isHeader ? column : columnGroup; + let headerClasses = []; + if (isHeader || isGroupHeader) { + headerClasses.push("header"); + if (isGroupHeader) { + headerClasses.push("headerGroup"); + } + if (col) { + headerClasses = headerClasses.concat( + _getHeaderClassesFromColDef( + col.getDefinition(), + gos, + column || null, + columnGroup || null + ) + ); + } + return headerClasses; + } + const applicableStyles = ["cell"]; + if (!styleIds.length) { + return applicableStyles; + } + const colDef = column.getDefinition(); + cellStyles?.processAllCellClasses( + colDef, + _addGridCommonParams2(gos, { + value, + data: node.data, + node, + colDef, + column, + rowIndex + }), + (className) => { + if (styleIdsSet.has(className)) { + applicableStyles.push(className); + } + } + ); + return applicableStyles.sort((left, right) => { + const leftIdx = styleIdOrder.get(left) ?? -1; + const rightIdx = styleIdOrder.get(right) ?? -1; + return leftIdx === rightIdx ? 0 : leftIdx < rightIdx ? -1 : 1; + }); + }; + } + isExportSuppressed() { + return this.gos.get("suppressExcelExport"); + } + packageCompressedFile(params) { + return getMultipleSheetsAsExcelCompressed(params, this.workbook); + } + packageFile(params) { + return getMultipleSheetsAsExcel(params, this.workbook); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agVirtualList.ts +import { + KeyCode, + RefPlaceholder as RefPlaceholder2, + _AgTabGuardComp, + _createAgElement, + _getAriaPosInSet, + _observeResize, + _requestAnimationFrame, + _setAriaLabel, + _setAriaPosInSet, + _setAriaRole, + _setAriaSetSize, + _waitUntil +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agVirtualList.css +var agVirtualList_default = ":where(.ag-virtual-list-viewport) .ag-tab-guard{position:sticky}.ag-virtual-list-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:auto;position:relative;width:100%}.ag-virtual-list-container{overflow:hidden;position:relative}.ag-virtual-list-item{height:var(--ag-list-item-height);position:absolute;width:100%}"; + +// packages/ag-grid-enterprise/src/agStack/agVirtualList.ts +function getVirtualListTemplate(cssIdentifier) { + return { + tag: "div", + cls: `ag-virtual-list-viewport ag-${cssIdentifier}-virtual-list-viewport`, + role: "presentation", + children: [ + { + tag: "div", + ref: "eContainer", + cls: `ag-virtual-list-container ag-${cssIdentifier}-virtual-list-container` + } + ] + }; +} +var AgVirtualList = class extends _AgTabGuardComp { + constructor(stopPropagationCallbacks, params) { + super(getVirtualListTemplate(params?.cssIdentifier || "default")); + this.stopPropagationCallbacks = stopPropagationCallbacks; + this.renderedRows = /* @__PURE__ */ new Map(); + this.rowHeight = 20; + this.pageSize = -1; + this.isScrolling = false; + this.isHeightFromTheme = true; + this.eContainer = RefPlaceholder2; + this.awaitStableCallbacks = []; + this.registerCSS(agVirtualList_default); + const { cssIdentifier = "default", ariaRole = "listbox", listName, moveItemCallback } = params || {}; + this.cssIdentifier = cssIdentifier; + this.ariaRole = ariaRole; + this.listName = listName; + this.moveItemCallback = moveItemCallback; + } + postConstruct() { + this.addScrollListener(); + this.rowHeight = this.getItemHeight(); + this.addResizeObserver(); + this.initialiseTabGuard( + { + onFocusIn: (e) => this.onFocusIn(e), + onFocusOut: (e) => this.onFocusOut(e), + focusInnerElement: (fromBottom) => this.focusInnerElement(fromBottom), + onTabKeyDown: (e) => this.onTabKeyDown(e), + handleKeyDown: (e) => this.handleKeyDown(e) + }, + this.stopPropagationCallbacks + ); + this.refreshAriaProperties(); + this.addManagedEventListeners({ stylesChanged: this.onStylesChanged.bind(this) }); + } + onStylesChanged(e) { + if (e.listItemHeightChanged) { + this.rowHeight = this.getItemHeight(); + this.refresh(); + } + } + refreshAriaProperties() { + const translate = this.getLocaleTextFunc(); + const listName = translate("ariaDefaultListName", this.listName || "List"); + const ariaEl = this.eContainer; + _setAriaRole(ariaEl, this.model?.getRowCount() > 0 ? this.ariaRole : "presentation"); + _setAriaLabel(ariaEl, listName); + } + addResizeObserver() { + const listener = () => _requestAnimationFrame(this.beans, () => this.drawVirtualRows()); + const destroyObserver = _observeResize(this.beans, this.getGui(), listener); + this.addDestroyFunc(destroyObserver); + } + focusInnerElement(fromBottom) { + this.focusRow(fromBottom ? this.model.getRowCount() - 1 : 0); + return true; + } + onFocusIn(e) { + const target = e.target; + if (target.classList.contains("ag-virtual-list-item")) { + this.lastFocusedRowIndex = _getAriaPosInSet(target) - 1; + } + } + onFocusOut(e) { + if (!this.getFocusableElement().contains(e.relatedTarget)) { + this.lastFocusedRowIndex = null; + } + } + handleKeyDown(e) { + const { key, shiftKey } = e; + switch (key) { + case KeyCode.UP: + case KeyCode.DOWN: + { + const isUp = key === KeyCode.UP; + e.preventDefault(); + if (shiftKey) { + this.moveItem(isUp); + } else { + this.navigate(isUp); + } + } + break; + case KeyCode.PAGE_HOME: + case KeyCode.PAGE_END: + case KeyCode.PAGE_UP: + case KeyCode.PAGE_DOWN: + if (this.navigateToPage(key) !== null) { + e.preventDefault(); + } + break; + } + } + onTabKeyDown(e) { + this.stopPropagationCallbacks?.stopPropagation(e); + this.forceFocusOutOfContainer(e.shiftKey); + } + getNextRow(up) { + if (this.lastFocusedRowIndex == null) { + return void 0; + } + const nextRow = this.lastFocusedRowIndex + (up ? -1 : 1); + if (nextRow < 0 || nextRow >= this.model.getRowCount()) { + return void 0; + } + return nextRow; + } + moveItem(up) { + if (!this.moveItemCallback) { + return; + } + const item = this.getComponentAt(this.lastFocusedRowIndex); + if (!item) { + return; + } + this.moveItemCallback(item, up); + } + navigate(up) { + const nextRow = this.getNextRow(up); + if (nextRow === void 0) { + return; + } + this.focusRow(nextRow); + } + navigateToPage(key, fromItem = "focused") { + let hasFocus = false; + if (fromItem === "focused") { + fromItem = this.getLastFocusedRow(); + hasFocus = true; + } + const rowCount = this.model.getRowCount() - 1; + let newIndex = -1; + if (key === KeyCode.PAGE_HOME) { + newIndex = 0; + } else if (key === KeyCode.PAGE_END) { + newIndex = rowCount; + } else if (key === KeyCode.PAGE_DOWN) { + newIndex = Math.min(fromItem + this.pageSize, rowCount); + } else if (key === KeyCode.PAGE_UP) { + newIndex = Math.max(fromItem - this.pageSize, 0); + } + if (newIndex === -1) { + return null; + } + if (hasFocus) { + this.focusRow(newIndex); + } else { + this.ensureIndexVisible(newIndex); + } + return newIndex; + } + getLastFocusedRow() { + return this.lastFocusedRowIndex; + } + focusRow(rowNumber) { + if (this.isScrolling) { + return; + } + this.isScrolling = true; + this.ensureIndexVisible(rowNumber); + _requestAnimationFrame(this.beans, () => { + this.isScrolling = false; + if (!this.isAlive()) { + return; + } + const renderedRow = this.renderedRows.get(rowNumber); + if (renderedRow) { + renderedRow.eDiv.focus(); + } + }); + } + getComponentAt(rowIndex) { + const comp = this.renderedRows.get(rowIndex); + return comp && comp.rowComponent; + } + forEachRenderedRow(func) { + this.renderedRows.forEach((value, key) => func(value.rowComponent, key)); + } + getItemHeight() { + if (!this.isHeightFromTheme) { + return this.rowHeight; + } + return this.beans.environment.getDefaultListItemHeight(); + } + /** + * Returns true if the view had to be scrolled, otherwise, false. + */ + ensureIndexVisible(index, scrollPartialIntoView = true) { + const lastRow = this.model.getRowCount(); + if (typeof index !== "number" || index < 0 || index >= lastRow) { + return false; + } + const rowTopPixel = index * this.rowHeight; + const rowBottomPixel = rowTopPixel + this.rowHeight; + const eGui = this.getGui(); + const viewportTopPixel = eGui.scrollTop; + const viewportHeight = eGui.offsetHeight; + const viewportBottomPixel = viewportTopPixel + viewportHeight; + const diff = scrollPartialIntoView ? 0 : this.rowHeight; + const viewportScrolledPastRow = viewportTopPixel > rowTopPixel + diff; + const viewportScrolledBeforeRow = viewportBottomPixel < rowBottomPixel - diff; + if (viewportScrolledPastRow) { + eGui.scrollTop = rowTopPixel; + return true; + } + if (viewportScrolledBeforeRow) { + const newScrollPosition = rowBottomPixel - viewportHeight; + eGui.scrollTop = newScrollPosition; + return true; + } + return false; + } + setComponentCreator(componentCreator) { + this.componentCreator = componentCreator; + } + setComponentUpdater(componentUpdater) { + this.componentUpdater = componentUpdater; + } + getRowHeight() { + return this.rowHeight; + } + getScrollTop() { + return this.getGui().scrollTop; + } + setRowHeight(rowHeight) { + this.isHeightFromTheme = false; + this.rowHeight = rowHeight; + this.refresh(); + } + refresh(softRefresh) { + if (this.model == null || !this.isAlive()) { + return; + } + const rowCount = this.model.getRowCount(); + this.eContainer.style.height = `${rowCount * this.rowHeight}px`; + this.refreshAriaProperties(); + this.awaitStable(() => { + if (!this.isAlive()) { + return; + } + if (this.canSoftRefresh(softRefresh)) { + this.drawVirtualRows(true); + } else { + this.clearVirtualRows(); + this.drawVirtualRows(); + } + }); + } + awaitStable(callback) { + this.awaitStableCallbacks.push(callback); + if (this.awaitStableCallbacks.length > 1) { + return; + } + const rowCount = this.model.getRowCount(); + _waitUntil( + this, + () => this.eContainer.clientHeight >= rowCount * this.rowHeight, + () => { + if (!this.isAlive()) { + return; + } + const callbacks = this.awaitStableCallbacks; + this.awaitStableCallbacks = []; + for (const c of callbacks) { + c(); + } + } + ); + } + canSoftRefresh(softRefresh) { + return !!(softRefresh && this.renderedRows.size && typeof this.model.areRowsEqual === "function" && this.componentUpdater); + } + clearVirtualRows() { + this.renderedRows.forEach((_, rowIndex) => this.removeRow(rowIndex)); + } + drawVirtualRows(softRefresh) { + if (!this.isAlive() || !this.model) { + return; + } + const gui = this.getGui(); + const topPixel = gui.scrollTop; + const bottomPixel = topPixel + gui.offsetHeight; + if (topPixel === bottomPixel) { + this.clearVirtualRows(); + } else { + const firstRow = Math.floor(topPixel / this.rowHeight); + const lastRow = Math.floor(bottomPixel / this.rowHeight); + this.pageSize = Math.floor((bottomPixel - topPixel) / this.rowHeight); + this.ensureRowsRendered(firstRow, lastRow, softRefresh); + } + } + ensureRowsRendered(start, finish, softRefresh) { + this.renderedRows.forEach((_, rowIndex) => { + if ((rowIndex < start || rowIndex > finish) && rowIndex !== this.lastFocusedRowIndex) { + this.removeRow(rowIndex); + } + }); + if (softRefresh) { + this.refreshRows(); + } + for (let rowIndex = start; rowIndex <= finish; rowIndex++) { + if (this.renderedRows.has(rowIndex)) { + continue; + } + if (rowIndex < this.model.getRowCount()) { + this.insertRow(rowIndex); + } + } + } + insertRow(rowIndex) { + const { model } = this; + if (rowIndex < 0 || rowIndex >= model.getRowCount()) { + return; + } + const { cssIdentifier, ariaRole, renderedRows, eContainer } = this; + const value = model.getRow(rowIndex); + const role = ariaRole === "tree" ? "treeitem" : "option"; + const eDiv = _createAgElement({ + tag: "div", + cls: `ag-virtual-list-item ag-${cssIdentifier}-virtual-list-item`, + role, + attrs: { tabindex: "-1" } + }); + _setAriaSetSize(eDiv, model.getRowCount()); + _setAriaPosInSet(eDiv, rowIndex + 1); + const rowHeight = this.rowHeight; + eDiv.style.height = `${rowHeight}px`; + eDiv.style.top = `${rowHeight * rowIndex}px`; + const rowComponent = this.componentCreator(value, eDiv); + rowComponent.addGuiEventListener("focusin", () => this.lastFocusedRowIndex = rowIndex); + eDiv.appendChild(rowComponent.getGui()); + if (renderedRows.has(rowIndex - 1)) { + renderedRows.get(rowIndex - 1).eDiv.insertAdjacentElement("afterend", eDiv); + } else if (renderedRows.has(rowIndex + 1)) { + renderedRows.get(rowIndex + 1).eDiv.insertAdjacentElement("beforebegin", eDiv); + } else { + eContainer.appendChild(eDiv); + } + renderedRows.set(rowIndex, { rowComponent, eDiv, value }); + } + removeRow(rowIndex) { + const component = this.renderedRows.get(rowIndex); + component.eDiv.remove(); + this.destroyBean(component.rowComponent); + this.renderedRows.delete(rowIndex); + } + refreshRows() { + const rowCount = this.model.getRowCount(); + this.renderedRows.forEach((row, rowIndex) => { + if (rowIndex >= rowCount) { + this.removeRow(rowIndex); + } else { + const newValue = this.model.getRow(rowIndex); + if (this.model.areRowsEqual?.(row.value, newValue)) { + this.componentUpdater(newValue, row.rowComponent); + } else { + this.removeRow(rowIndex); + } + } + }); + } + addScrollListener() { + this.addGuiEventListener("scroll", () => this.drawVirtualRows(), { passive: true }); + } + setModel(model) { + this.model = model; + } + getAriaElement() { + return this.eContainer; + } + destroy() { + if (!this.isAlive()) { + return; + } + this.clearVirtualRows(); + this.awaitStableCallbacks.length = 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agVirtualListDragFeature.ts +import { AutoScrollService, _AgBeanStub, _radioCssClass } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agVirtualListDragFeature.css +var agVirtualListDragFeature_default = '.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}'; + +// packages/ag-grid-enterprise/src/agStack/agVirtualListDragFeature.ts +var LIST_ITEM_HOVERED = "ag-list-item-hovered"; +var AgVirtualListDragFeature = class extends _AgBeanStub { + constructor(comp, virtualList, params) { + super(); + this.comp = comp; + this.virtualList = virtualList; + this.params = params; + this.currentDragValue = null; + this.lastHoveredListItem = null; + } + postConstruct() { + this.beans.environment.addGlobalCSS(agVirtualListDragFeature_default, "component-AgVirtualListDragFeature"); + this.params.addListeners(this, this.listItemDragStart.bind(this), this.listItemDragEnd.bind(this)); + this.createDropTarget(); + this.createAutoScrollService(); + } + listItemDragStart(event) { + this.currentDragValue = this.params.getCurrentDragValue(event); + this.moveBlocked = this.params.isMoveBlocked(this.currentDragValue); + } + listItemDragEnd() { + window.setTimeout(() => { + this.currentDragValue = null; + this.moveBlocked = false; + }, 10); + } + createDropTarget() { + const dropTarget = { + isInterestedIn: (type) => type === this.params.dragSourceType, + getIconName: () => this.moveBlocked ? "pinned" : "move", + getContainer: () => this.comp.getGui(), + onDragging: (e) => this.onDragging(e), + onDragStop: () => this.onDragStop(), + onDragLeave: () => this.onDragLeave(), + onDragCancel: () => this.onDragCancel() + }; + this.beans.dragAndDrop?.addDropTarget(dropTarget); + } + createAutoScrollService() { + const virtualListGui = this.virtualList.getGui(); + this.autoScrollService = new AutoScrollService({ + scrollContainer: virtualListGui, + scrollAxis: "y", + getVerticalPosition: () => virtualListGui.scrollTop, + setVerticalPosition: (position) => virtualListGui.scrollTop = position + }); + } + onDragging(e) { + if (!this.currentDragValue || this.moveBlocked) { + return; + } + const hoveredListItem = this.getListDragItem(e); + const comp = this.virtualList.getComponentAt(hoveredListItem.rowIndex); + if (!comp) { + return; + } + const el = comp.getGui().parentElement; + if (this.lastHoveredListItem && this.lastHoveredListItem.rowIndex === hoveredListItem.rowIndex && this.lastHoveredListItem.position === hoveredListItem.position) { + return; + } + this.autoScrollService.check(e.event); + this.clearHoveredItems(); + this.lastHoveredListItem = hoveredListItem; + _radioCssClass(el, LIST_ITEM_HOVERED); + _radioCssClass(el, `ag-item-highlight-${hoveredListItem.position}`); + } + getListDragItem(e) { + const virtualListGui = this.virtualList.getGui(); + const paddingTop = Number.parseFloat(window.getComputedStyle(virtualListGui).paddingTop); + const rowHeight = this.virtualList.getRowHeight(); + const scrollTop = this.virtualList.getScrollTop(); + const rowIndex = Math.max(0, (e.y - paddingTop + scrollTop) / rowHeight); + const maxLen = this.params.getNumRows(this.comp) - 1; + const normalizedRowIndex = Math.min(maxLen, rowIndex) | 0; + return { + rowIndex: normalizedRowIndex, + position: Math.round(rowIndex) > rowIndex || rowIndex > maxLen ? "bottom" : "top", + component: this.virtualList.getComponentAt(normalizedRowIndex) + }; + } + onDragStop() { + if (this.moveBlocked) { + return; + } + this.params.moveItem(this.currentDragValue, this.lastHoveredListItem); + this.clearDragProperties(); + } + onDragCancel() { + this.clearDragProperties(); + } + onDragLeave() { + this.clearDragProperties(); + } + clearDragProperties() { + this.clearHoveredItems(); + this.autoScrollService.ensureCleared(); + } + clearHoveredItems() { + const virtualListGui = this.virtualList.getGui(); + for (const el of virtualListGui.querySelectorAll(`.${LIST_ITEM_HOVERED}`)) { + for (const cls of [LIST_ITEM_HOVERED, "ag-item-highlight-top", "ag-item-highlight-bottom"]) { + el.classList.remove(cls); + } + } + this.lastHoveredListItem = null; + } +}; + +// packages/ag-grid-enterprise/src/agStack/agSlider.ts +import { AgAbstractLabel, AgInputNumberFieldSelector, RefPlaceholder as RefPlaceholder3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agInputRange.ts +import { AgAbstractInputField } from "ag-grid-community"; +var AgInputRange = class extends AgAbstractInputField { + constructor(config) { + super(config, "ag-range-field", "range"); + } + postConstruct() { + super.postConstruct(); + const { min, max, step } = this.config; + if (min != null) { + this.setMinValue(min); + } + if (max != null) { + this.setMaxValue(max); + } + this.setStep(step || 1); + } + addInputListeners() { + this.addManagedElementListeners(this.eInput, { + input: (e) => { + const value = e.target.value; + this.setValue(value); + } + }); + } + setMinValue(value) { + this.min = value; + this.eInput.setAttribute("min", value.toString()); + return this; + } + setMaxValue(value) { + this.max = value; + this.eInput.setAttribute("max", value.toString()); + return this; + } + setStep(value) { + this.eInput.setAttribute("step", value.toString()); + return this; + } + setValue(value, silent) { + if (this.min != null) { + value = Math.max(parseFloat(value), this.min).toString(); + } + if (this.max != null) { + value = Math.min(parseFloat(value), this.max).toString(); + } + const ret = super.setValue(value, silent); + this.eInput.value = value; + return ret; + } +}; +var AgInputRangeSelector = { + selector: "AG-INPUT-RANGE", + component: AgInputRange +}; + +// packages/ag-grid-enterprise/src/agStack/agSlider.ts +var AgSlider = class extends AgAbstractLabel { + constructor(config) { + super( + config, + /* html */ + `
+ +
+ + +
+
`, + [AgInputRangeSelector, AgInputNumberFieldSelector] + ); + this.eLabel = RefPlaceholder3; + this.eSlider = RefPlaceholder3; + this.eText = RefPlaceholder3; + this.labelAlignment = "top"; + } + postConstruct() { + super.postConstruct(); + this.eSlider.addCss("ag-slider-field"); + const { minValue, maxValue, textFieldWidth, step, value, onValueChange } = this.config; + if (minValue != null) { + this.setMinValue(minValue); + } + if (maxValue != null) { + this.setMaxValue(maxValue); + } + if (textFieldWidth != null) { + this.setTextFieldWidth(textFieldWidth); + } + if (step != null) { + this.setStep(step); + } + if (value != null) { + this.setValue(value); + } + if (onValueChange != null) { + this.onValueChange(onValueChange); + } + } + onValueChange(callbackFn) { + this.addManagedListeners(this.eText, { + fieldValueChanged: () => { + const textValue = parseFloat(this.eText.getValue()); + this.eSlider.setValue(textValue.toString(), true); + callbackFn(textValue || 0); + } + }); + this.addManagedListeners(this.eSlider, { + fieldValueChanged: () => { + const sliderValue = this.eSlider.getValue(); + this.eText.setValue(sliderValue, true); + callbackFn(parseFloat(sliderValue)); + } + }); + return this; + } + setSliderWidth(width) { + this.eSlider.setWidth(width); + return this; + } + setTextFieldWidth(width) { + this.eText.setWidth(width); + return this; + } + setMinValue(minValue) { + this.eSlider.setMinValue(minValue); + this.eText.setMin(minValue); + return this; + } + setMaxValue(maxValue) { + this.eSlider.setMaxValue(maxValue); + this.eText.setMax(maxValue); + return this; + } + getValue() { + return this.eText.getValue(); + } + setValue(value, silent) { + if (this.getValue() === value) { + return this; + } + this.eText.setValue(value, true); + this.eSlider.setValue(value, true); + if (!silent) { + this.dispatchLocalEvent({ type: "fieldValueChanged" }); + } + return this; + } + setStep(step) { + this.eSlider.setStep(step); + this.eText.setStep(step); + return this; + } +}; +var AgSliderSelector = { + selector: "AG-SLIDER", + component: AgSlider +}; + +// packages/ag-grid-enterprise/src/agStack/agColorPicker.ts +import { AgPickerField, _createElement } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agColorPanel.ts +import { KeyCode as KeyCode2, RefPlaceholder as RefPlaceholder5, _AgComponentStub, _exists as _exists2, _setDisplayed } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agColorInput.ts +import { AgInputTextField, RefPlaceholder as RefPlaceholder4 } from "ag-grid-community"; +var AgColorInput = class extends AgInputTextField { + constructor() { + super({ + template: { + tag: "div", + cls: "ag-color-input", + role: "presentation", + children: [ + { tag: "div", ref: "eLabel", cls: "ag-input-field-label" }, + { + tag: "div", + ref: "eWrapper", + cls: "ag-wrapper ag-input-wrapper", + role: "presentation", + children: [ + { tag: "input", ref: "eInput", cls: "ag-input-field-input" }, + { tag: "div", ref: "eColor", cls: "ag-color-input-color" } + ] + } + ] + } + }); + this.eColor = RefPlaceholder4; + } + wireBeans(beans) { + this.color = beans.agChartsExports._Util.Color; + } + setColor(color) { + const rgbaColor = color.toRgbaString(); + this.setValue(this.color.fromString(rgbaColor).toHexString().toUpperCase(), true); + this.eColor.style.backgroundColor = rgbaColor; + } + setValue(value, silent) { + const isValid = this.color.validColorString(value ?? ""); + this.eInput.setCustomValidity( + isValid ? "" : this.getLocaleTextFunc()("invalidColor", "Color value is invalid") + ); + super.setValue(value, silent); + if (isValid && !silent) { + this.dispatchLocalEvent({ type: "colorChanged" }); + } + return this; + } + onColorChanged(callback) { + this.addManagedListeners(this, { colorChanged: () => callback(this.color.fromString(this.value)) }); + } +}; +var AgColorInputSelector = { + selector: "AG-COLOR-INPUT", + component: AgColorInput +}; + +// packages/ag-grid-enterprise/src/agStack/agColorPanel.ts +var maxRecentColors = 8; +var sharedRecentColors = []; +var AgColorPanel = class extends _AgComponentStub { + constructor(config) { + super( + /* html */ + `
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+ +
+
+
`, + [AgColorInputSelector] + ); + this.H = 1; + // in the [0, 1] range + this.S = 1; + // in the [0, 1] range + this.B = 1; + // in the [0, 1] range + this.A = 1; + this.isSpectrumDragging = false; + this.isSpectrumHueDragging = false; + this.isSpectrumAlphaDragging = false; + this.colorChanged = false; + this.spectrumColor = RefPlaceholder5; + this.spectrumVal = RefPlaceholder5; + this.spectrumDragger = RefPlaceholder5; + this.spectrumHue = RefPlaceholder5; + this.spectrumHueSlider = RefPlaceholder5; + this.spectrumAlpha = RefPlaceholder5; + this.spectrumAlphaSlider = RefPlaceholder5; + this.colorInput = RefPlaceholder5; + this.recentColors = RefPlaceholder5; + this.picker = config.picker; + } + wireBeans(beans) { + this._Color = beans.agChartsExports._Util.Color; + } + postConstruct() { + this.initTabIndex(); + this.initRecentColors(); + this.addGuiEventListener("focus", () => this.spectrumColor.focus()); + this.addGuiEventListener("keydown", (e) => { + if (e.key === KeyCode2.ENTER && !e.defaultPrevented) { + this.destroy(); + } + }); + this.addManagedListeners(this.spectrumColor, { keydown: (e) => this.moveDragger(e) }); + this.addManagedListeners(this.spectrumAlphaSlider, { keydown: (e) => this.moveAlphaSlider(e) }); + this.addManagedListeners(this.spectrumHueSlider, { keydown: (e) => this.moveHueSlider(e) }); + this.addManagedListeners(this.spectrumVal, { mousedown: this.onSpectrumDraggerDown.bind(this) }); + this.addManagedListeners(this.spectrumHue, { mousedown: this.onSpectrumHueDown.bind(this) }); + this.addManagedListeners(this.spectrumAlpha, { mousedown: this.onSpectrumAlphaDown.bind(this) }); + this.addGuiEventListener("mousemove", (e) => { + this.onSpectrumDraggerMove(e); + this.onSpectrumHueMove(e); + this.onSpectrumAlphaMove(e); + }); + this.addManagedListeners(document, { mouseup: this.onMouseUp.bind(this) }); + this.colorInput.onColorChanged(this.setColor.bind(this)); + this.addManagedListeners(this.recentColors, { + click: this.onRecentColorClick.bind(this), + keydown: (e) => { + if (e.key === KeyCode2.ENTER || e.key === KeyCode2.SPACE) { + e.preventDefault(); + this.onRecentColorClick(e); + } + } + }); + } + initTabIndex() { + const tabIndex = this.tabIndex = this.gos.get("tabIndex").toString(); + this.spectrumColor.setAttribute("tabindex", tabIndex); + this.spectrumHueSlider.setAttribute("tabindex", tabIndex); + this.spectrumAlphaSlider.setAttribute("tabindex", tabIndex); + } + refreshSpectrumRect() { + return this.spectrumValRect = this.spectrumVal.getBoundingClientRect(); + } + refreshHueRect() { + return this.spectrumHueRect = this.spectrumHue.getBoundingClientRect(); + } + refreshAlphaRect() { + return this.spectrumAlphaRect = this.spectrumAlpha.getBoundingClientRect(); + } + onSpectrumDraggerDown(e) { + e.preventDefault(); + this.refreshSpectrumRect(); + this.isSpectrumDragging = true; + this.moveDragger(e); + } + onSpectrumDraggerMove(e) { + if (this.isSpectrumDragging) { + this.moveDragger(e); + } + } + onSpectrumHueDown(e) { + this.refreshHueRect(); + this.isSpectrumHueDragging = true; + this.moveHueSlider(e); + } + onSpectrumHueMove(e) { + if (this.isSpectrumHueDragging) { + this.moveHueSlider(e); + } + } + onSpectrumAlphaDown(e) { + this.refreshAlphaRect(); + this.isSpectrumAlphaDragging = true; + this.moveAlphaSlider(e); + } + onSpectrumAlphaMove(e) { + if (this.isSpectrumAlphaDragging) { + this.moveAlphaSlider(e); + } + } + onMouseUp() { + this.isSpectrumDragging = false; + this.isSpectrumHueDragging = false; + this.isSpectrumAlphaDragging = false; + } + moveDragger(e) { + const valRect = this.spectrumValRect; + if (!valRect) { + return; + } + let x; + let y; + if (e instanceof MouseEvent) { + x = e.clientX - valRect.left; + y = e.clientY - valRect.top; + } else { + const isLeft = e.key === KeyCode2.LEFT; + const isRight = e.key === KeyCode2.RIGHT; + const isUp = e.key === KeyCode2.UP; + const isDown = e.key === KeyCode2.DOWN; + const isVertical = isUp || isDown; + const isHorizontal = isLeft || isRight; + if (!isVertical && !isHorizontal) { + return; + } + e.preventDefault(); + const { x: currentX, y: currentY } = this.getSpectrumValue(); + x = currentX + (isHorizontal ? isLeft ? -5 : 5 : 0); + y = currentY + (isVertical ? isUp ? -5 : 5 : 0); + } + x = Math.max(x, 0); + x = Math.min(x, valRect.width); + y = Math.max(y, 0); + y = Math.min(y, valRect.height); + this.setSpectrumValue(x / valRect.width, 1 - y / valRect.height); + } + moveHueSlider(e) { + const rect = this.spectrumHueRect; + if (!rect) { + return; + } + const x = this.moveSlider(this.spectrumHueSlider, e); + if (x == null) { + return; + } + this.H = 1 - x / rect.width; + this.update(); + } + moveAlphaSlider(e) { + const rect = this.spectrumAlphaRect; + if (!rect) { + return; + } + const x = this.moveSlider(this.spectrumAlphaSlider, e); + if (x == null) { + return; + } + this.A = x / rect.width; + this.update(); + } + moveSlider(slider, e) { + const sliderRect = slider.getBoundingClientRect(); + const parentRect = slider.parentElement?.getBoundingClientRect(); + if (!slider || !parentRect) { + return null; + } + const offset = sliderRect.width / 2; + let x; + if (e instanceof MouseEvent) { + x = Math.floor(e.clientX - parentRect.left); + } else { + const isLeft = e.key === KeyCode2.LEFT; + const isRight = e.key === KeyCode2.RIGHT; + if (!isLeft && !isRight) { + return null; + } + e.preventDefault(); + const diff = isLeft ? -5 : 5; + x = parseFloat(slider.style.left) + offset + diff; + } + x = Math.max(x, 0); + x = Math.min(x, parentRect.width); + slider.style.left = x - offset + "px"; + return x; + } + update(suppressColorInputUpdate) { + const { A, S, B, H, _Color } = this; + const hue = H * 360; + const color = _Color.fromHSB(hue, S, B, A); + const rgbaColor = color.toRgbaString(); + const colorWithoutAlpha = _Color.fromHSB(hue, S, B); + const rgbaColorWithoutAlpha = colorWithoutAlpha.toRgbaString(); + const spectrumColor = _Color.fromHSB(hue, 1, 1); + const spectrumRgbaColor = spectrumColor.toRgbaString(); + const colorPicker = this.picker; + const existingColor = _Color.fromString(colorPicker.getValue()); + if (existingColor.toRgbaString() !== rgbaColor) { + this.colorChanged = true; + } + colorPicker.setValue(rgbaColor); + this.spectrumColor.style.backgroundColor = spectrumRgbaColor; + this.spectrumDragger.style.backgroundColor = rgbaColorWithoutAlpha; + this.spectrumHueSlider.style.backgroundColor = spectrumRgbaColor; + this.spectrumAlpha.style.setProperty( + "--ag-internal-spectrum-alpha-color-from", + _Color.fromHSB(hue, S, B, 0).toRgbaString() + ); + this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color-to", rgbaColorWithoutAlpha); + this.spectrumAlpha.style.setProperty("--ag-internal-spectrum-alpha-color", rgbaColor); + if (!suppressColorInputUpdate) { + this.colorInput.setColor(color); + } + } + /** + * @param saturation In the [0, 1] interval. + * @param brightness In the [0, 1] interval. + */ + setSpectrumValue(saturation, brightness, suppressColorInputUpdate) { + const valRect = this.spectrumValRect || this.refreshSpectrumRect(); + if (valRect == null) { + return; + } + const dragger = this.spectrumDragger; + const draggerRect = dragger.getBoundingClientRect(); + saturation = Math.max(0, saturation); + saturation = Math.min(1, saturation); + brightness = Math.max(0, brightness); + brightness = Math.min(1, brightness); + this.S = saturation; + this.B = brightness; + dragger.style.left = saturation * valRect.width - draggerRect.width / 2 + "px"; + dragger.style.top = (1 - brightness) * valRect.height - draggerRect.height / 2 + "px"; + this.update(suppressColorInputUpdate); + } + getSpectrumValue() { + const dragger = this.spectrumDragger; + const draggerRect = dragger.getBoundingClientRect(); + const x = parseFloat(dragger.style.left) + draggerRect.width / 2; + const y = parseFloat(dragger.style.top) + draggerRect.height / 2; + return { x, y }; + } + initRecentColors() { + const recentColors = sharedRecentColors; + const colorsHtmlStr = recentColors.map((color, index) => { + return ( + /* html */ + `
` + ); + }); + this.recentColors.innerHTML = colorsHtmlStr.join(""); + _setDisplayed(this.recentColors, !!recentColors.length); + } + setValue(val) { + const color = this._Color.fromString(val); + this.setColor(color, true); + } + setColor(color, updateColorInput) { + const [h, s2, b] = color.toHSB(); + this.H = (isNaN(h) ? 0 : h) / 360; + this.A = color.a; + const spectrumHueRect = this.spectrumHueRect || this.refreshHueRect(); + const spectrumAlphaRect = this.spectrumAlphaRect || this.refreshAlphaRect(); + this.spectrumHueSlider.style.left = `${(this.H - 1) * -spectrumHueRect.width - this.spectrumHueSlider.getBoundingClientRect().width / 2}px`; + this.spectrumAlphaSlider.style.left = `${this.A * spectrumAlphaRect.width - this.spectrumAlphaSlider.getBoundingClientRect().width / 2}px`; + this.setSpectrumValue(s2, b, !updateColorInput); + } + onRecentColorClick(e) { + const target = e.target; + if (!_exists2(target.id)) { + return; + } + const id = parseInt(target.id, 10); + this.setValue(sharedRecentColors[id]); + this.destroy(); + } + addRecentColor() { + const color = this._Color.fromHSB(this.H * 360, this.S, this.B, this.A); + const rgbaColor = color.toRgbaString(); + let recentColors = sharedRecentColors; + if (!this.colorChanged || recentColors[0] === rgbaColor) { + return; + } + recentColors = recentColors.filter((currentColor) => currentColor != rgbaColor); + recentColors = [rgbaColor].concat(recentColors); + if (recentColors.length > maxRecentColors) { + recentColors = recentColors.slice(0, maxRecentColors); + } + sharedRecentColors = recentColors; + } + destroy() { + this.addRecentColor(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agDialog.ts +import { _AgComponentStub as _AgComponentStub3, _AgTabGuardFeature, _findNextFocusableElement, _setDisplayed as _setDisplayed3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agPanel.ts +import { + RefPlaceholder as RefPlaceholder6, + _AgComponentStub as _AgComponentStub2, + _AgPositionableFeature, + _getActiveDomElement, + _getInnerHeight, + _getInnerWidth, + _isVisible, + _setDisplayed as _setDisplayed2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agPanel.css +var agPanel_default = ".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-family:var(--ag-panel-title-bar-font-family);font-size:var(--ag-panel-title-bar-font-size);font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-panel-title-bar-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*2);margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-left:var(--ag-spacing);margin-right:calc(var(--ag-spacing)*2)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}"; + +// packages/ag-grid-enterprise/src/agStack/agPanel.ts +function getTemplate(cssIdentifier) { + cssIdentifier ?? (cssIdentifier = cssIdentifier || "default"); + return { + tag: "div", + cls: `ag-panel ag-${cssIdentifier}-panel`, + attrs: { tabindex: "-1" }, + children: [ + { + tag: "div", + ref: "eTitleBar", + cls: `ag-panel-title-bar ag-${cssIdentifier}-panel-title-bar ag-unselectable`, + children: [ + { + tag: "span", + ref: "eTitle", + cls: `ag-panel-title-bar-title ag-${cssIdentifier}-panel-title-bar-title` + }, + { + tag: "div", + ref: "eTitleBarButtons", + cls: `ag-panel-title-bar-buttons ag-${cssIdentifier}-panel-title-bar-buttons` + } + ] + }, + { + tag: "div", + ref: "eContentWrapper", + cls: `ag-panel-content-wrapper ag-${cssIdentifier}-panel-content-wrapper` + } + ] + }; +} +var AgPanel = class extends _AgComponentStub2 { + constructor(config) { + super(getTemplate(config.cssIdentifier)); + this.config = config; + this.closable = true; + this.eContentWrapper = RefPlaceholder6; + this.eTitleBar = RefPlaceholder6; + this.eTitleBarButtons = RefPlaceholder6; + this.eTitle = RefPlaceholder6; + this.registerCSS(agPanel_default); + } + postConstruct() { + const { + component, + closable, + hideTitleBar, + title, + minWidth = 250, + width, + minHeight = 250, + height, + centered, + popup, + x, + y, + postProcessPopupParams + } = this.config; + const beans = this.beans; + const positionableFeature = this.createManagedBean( + new _AgPositionableFeature( + this.getGui(), + { + minWidth, + width, + minHeight, + height, + centered, + x, + y, + popup, + calculateTopBuffer: () => this.positionableFeature.getHeight() - this.getBodyHeight() + } + ) + ); + this.positionableFeature = positionableFeature; + const eGui = this.getGui(); + if (component) { + this.setBodyComponent(component); + } + if (!hideTitleBar) { + if (title) { + this.setTitle(title); + } + this.setClosable(closable != null ? closable : this.closable); + } else { + _setDisplayed2(this.eTitleBar, false); + } + this.addManagedElementListeners(this.eTitleBar, { + mousedown: (e) => { + if (eGui.contains(e.relatedTarget) || eGui.contains(_getActiveDomElement(beans)) || this.eTitleBarButtons.contains(e.target)) { + e.preventDefault(); + return; + } + const focusEl = this.eContentWrapper.querySelector( + "button, [href], input, select, textarea, [tabindex]" + ); + if (focusEl) { + focusEl.focus(); + } + } + }); + if (popup && positionableFeature.isPositioned()) { + return; + } + if (this.renderComponent) { + this.renderComponent(); + } + let postProcessCallback; + if (postProcessPopupParams) { + const { type, eventSource, mouseEvent } = postProcessPopupParams; + postProcessCallback = () => beans.popupSvc?.callPostProcessPopup(postProcessPopupParams, type, eGui, eventSource, mouseEvent); + } + positionableFeature.initialisePosition(postProcessCallback); + this.eContentWrapper.style.height = "0"; + } + renderComponent() { + const eGui = this.getGui(); + eGui.focus(); + this.close = () => { + eGui.remove(); + this.destroy(); + }; + } + getHeight() { + return this.positionableFeature.getHeight(); + } + setHeight(height) { + this.positionableFeature.setHeight(height); + } + getWidth() { + return this.positionableFeature.getWidth(); + } + setWidth(width) { + this.positionableFeature.setWidth(width); + } + setClosable(closable) { + if (closable !== this.closable) { + this.closable = closable; + } + if (closable) { + const closeButtonComp = this.closeButtonComp = new _AgComponentStub2({ tag: "div", cls: "ag-button" }); + this.createBean(closeButtonComp); + const eGui = closeButtonComp.getGui(); + const child = this.beans.iconSvc.createIconNoSpan("close", this.beans); + child.classList.add("ag-panel-title-bar-button-icon"); + eGui.appendChild(child); + this.addTitleBarButton(closeButtonComp); + closeButtonComp.addManagedElementListeners(eGui, { click: this.onBtClose.bind(this) }); + } else if (this.closeButtonComp) { + const eGui = this.closeButtonComp.getGui(); + eGui.remove(); + this.closeButtonComp = this.destroyBean(this.closeButtonComp); + } + } + setBodyComponent(bodyComponent) { + bodyComponent.setParentComponent(this); + this.eContentWrapper.appendChild(bodyComponent.getGui()); + } + addTitleBarButton(button, position) { + const eTitleBarButtons = this.eTitleBarButtons; + const buttons = eTitleBarButtons.children; + const len = buttons.length; + if (position == null) { + position = len; + } + position = Math.max(0, Math.min(position, len)); + button.addCss("ag-panel-title-bar-button"); + const eGui = button.getGui(); + if (position === 0) { + eTitleBarButtons.prepend(eGui); + } else if (position === len) { + eTitleBarButtons.append(eGui); + } else { + buttons[position - 1].after(eGui); + } + button.setParentComponent(this); + } + getBodyHeight() { + return _getInnerHeight(this.eContentWrapper); + } + getBodyWidth() { + return _getInnerWidth(this.eContentWrapper); + } + setTitle(title) { + this.eTitle.innerText = title; + } + // called when user hits the 'x' in the top right + onBtClose() { + this.close(); + } + destroy() { + if (this.closeButtonComp) { + this.closeButtonComp = this.destroyBean(this.closeButtonComp); + } + const eGui = this.getGui(); + if (eGui && _isVisible(eGui)) { + this.close(); + } + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agDialog.ts +var AgDialog = class extends AgPanel { + constructor(config, callbacks) { + super({ ...config, popup: true }); + this.callbacks = callbacks; + this.isMaximizable = false; + this.isMaximized = false; + this.maximizeListeners = []; + this.resizeListenerDestroy = null; + this.lastPosition = { + x: 0, + y: 0, + width: 0, + height: 0 + }; + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + } + postConstruct() { + const eGui = this.getGui(); + const { movable, resizable, maximizable, modal } = this.config; + this.addCss("ag-dialog"); + super.postConstruct(); + this.tabGuardFeature = this.createManagedBean( + new _AgTabGuardFeature(this, this.callbacks?.stopPropagationCallbacks) + ); + this.tabGuardFeature.initialiseTabGuard({ + isFocusableContainer: true, + onFocusIn: () => { + this.popupSvc?.bringPopupToFront(eGui); + }, + onTabKeyDown: (e) => { + if (modal) { + return; + } + const backwards = e.shiftKey; + const nextFocusableElement = _findNextFocusableElement(this.beans, eGui, false, backwards); + if (!nextFocusableElement || this.tabGuardFeature.getTabGuardCtrl().isTabGuard(nextFocusableElement)) { + if (this.callbacks?.focusNextContainer(this.beans, backwards)) { + e.preventDefault(); + } + } + } + }); + if (movable) { + this.setMovable(movable); + } + if (maximizable) { + this.setMaximizable(maximizable); + } + if (resizable) { + this.setResizable(resizable); + } + if (!this.config.modal) { + this.callbacks?.configureFocusableContainer(this.beans, this); + } + } + setAllowFocus(allowFocus) { + this.tabGuardFeature.getTabGuardCtrl().setAllowFocus(allowFocus); + } + renderComponent() { + const eGui = this.getGui(); + const { alwaysOnTop, modal, title, afterGuiAttached } = this.config; + const translate = this.getLocaleTextFunc(); + const addPopupRes = this.popupSvc?.addPopup({ + modal, + eChild: eGui, + closeOnEsc: true, + closedCallback: this.onClosed.bind(this), + alwaysOnTop, + ariaLabel: title || translate("ariaLabelDialog", "Dialog"), + afterGuiAttached + }); + if (addPopupRes) { + this.close = addPopupRes.hideFunc; + } + } + onClosed(event) { + this.destroy(); + this.config.closedCallback?.(event); + } + setMaximized(maximized) { + if (this.isMaximizable && maximized !== this.isMaximized) { + this.toggleMaximize(); + } + } + toggleMaximize() { + const position = this.positionableFeature.getPosition(); + if (this.isMaximized) { + const { x, y, width, height } = this.lastPosition; + this.setWidth(width); + this.setHeight(height); + this.positionableFeature.offsetElement(x, y); + } else { + this.lastPosition.width = this.getWidth(); + this.lastPosition.height = this.getHeight(); + this.lastPosition.x = position.x; + this.lastPosition.y = position.y; + this.positionableFeature.offsetElement(0, 0); + this.setHeight("100%"); + this.setWidth("100%"); + } + this.isMaximized = !this.isMaximized; + this.refreshMaximizeIcon(); + } + refreshMaximizeIcon() { + _setDisplayed3(this.maximizeIcon, !this.isMaximized); + _setDisplayed3(this.minimizeIcon, this.isMaximized); + } + clearMaximizebleListeners() { + if (this.maximizeListeners.length) { + for (const destroyListener of this.maximizeListeners) { + destroyListener(); + } + this.maximizeListeners.length = 0; + } + if (this.resizeListenerDestroy) { + this.resizeListenerDestroy(); + this.resizeListenerDestroy = null; + } + } + destroy() { + this.maximizeButtonComp = this.destroyBean(this.maximizeButtonComp); + this.clearMaximizebleListeners(); + super.destroy(); + } + setResizable(resizable) { + this.positionableFeature.setResizable(resizable); + } + setMovable(movable) { + this.positionableFeature.setMovable(movable, this.eTitleBar); + } + setMaximizable(maximizable) { + if (!maximizable) { + this.clearMaximizebleListeners(); + if (this.maximizeButtonComp) { + this.destroyBean(this.maximizeButtonComp); + this.maximizeButtonComp = this.maximizeIcon = this.minimizeIcon = void 0; + } + return; + } + const eTitleBar = this.eTitleBar; + if (!eTitleBar || maximizable === this.isMaximizable) { + return; + } + this.isMaximizable = maximizable; + const maximizeButtonComp = this.buildMaximizeAndMinimizeElements(); + this.refreshMaximizeIcon(); + maximizeButtonComp.addManagedElementListeners(maximizeButtonComp.getGui(), { + click: this.toggleMaximize.bind(this) + }); + this.addTitleBarButton(maximizeButtonComp, 0); + this.maximizeListeners.push( + ...this.addManagedElementListeners(eTitleBar, { + dblclick: this.toggleMaximize.bind(this) + }) + ); + [this.resizeListenerDestroy] = this.addManagedListeners(this.positionableFeature, { + resize: () => { + this.isMaximized = false; + this.refreshMaximizeIcon(); + } + }); + } + buildMaximizeAndMinimizeElements() { + const maximizeButtonComp = this.maximizeButtonComp = this.createBean(new _AgComponentStub3({ tag: "div", cls: "ag-dialog-button" })); + const eGui = maximizeButtonComp.getGui(); + const iconSvc = this.beans.iconSvc; + this.maximizeIcon = iconSvc.createIconNoSpan("maximize"); + eGui.appendChild(this.maximizeIcon); + this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"); + this.minimizeIcon = iconSvc.createIconNoSpan("minimize"); + eGui.appendChild(this.minimizeIcon); + this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"); + return maximizeButtonComp; + } +}; + +// packages/ag-grid-enterprise/src/agStack/agColorPicker.ts +var AgColorPicker = class extends AgPickerField { + constructor(config) { + super({ + pickerAriaLabelKey: "ariaLabelColorPicker", + pickerAriaLabelValue: "Color Picker", + pickerType: "ag-list", + className: "ag-color-picker", + pickerIcon: "chartsColorPicker", + ...config + }); + } + postConstruct() { + this.eDisplayFieldColor = _createElement({ + tag: "span", + cls: "ag-color-picker-color" + }); + this.eDisplayFieldText = _createElement({ + tag: "span", + cls: "ag-color-picker-value" + }); + this.eDisplayField.append(this.eDisplayFieldColor, this.eDisplayFieldText); + super.postConstruct(); + if (this.value) { + this.setValue(this.value); + } + } + createPickerComponent() { + const eGuiRect = this.eWrapper.getBoundingClientRect(); + const parentRect = this.beans.popupSvc.getParentRect(); + const colorDialog = this.createBean( + new AgDialog( + { + closable: false, + modal: true, + hideTitleBar: true, + minWidth: 190, + width: 190, + height: 250, + x: eGuiRect.right - parentRect.left - 190, + y: eGuiRect.top - parentRect.top - 250 - (this.config.pickerGap ?? 0), + postProcessPopupParams: { + type: "colorPicker", + eventSource: this.eWrapper + } + }, + this.config.dialogCallbacks + ) + ); + return colorDialog; + } + renderAndPositionPicker() { + const pickerComponent = this.pickerComponent; + const colorPanel = this.createBean( + new AgColorPanel({ picker: this }) + ); + pickerComponent.addCss("ag-color-dialog"); + colorPanel.addDestroyFunc(() => { + if (pickerComponent.isAlive()) { + this.destroyBean(pickerComponent); + } + }); + pickerComponent.setParentComponent(this); + pickerComponent.setBodyComponent(colorPanel); + colorPanel.setValue(this.getValue()); + colorPanel.getGui().focus(); + pickerComponent.addDestroyFunc(() => { + if (!this.isDestroyingPicker) { + this.beforeHidePicker(); + this.isDestroyingPicker = true; + if (colorPanel.isAlive()) { + this.destroyBean(colorPanel); + } + if (this.isAlive()) { + this.getFocusableElement().focus(); + } + } else { + this.isDestroyingPicker = false; + } + }); + return () => this.pickerComponent?.close(); + } + setValue(color) { + if (this.value === color) { + return this; + } + this.eDisplayFieldColor.style.backgroundColor = color; + this.eDisplayFieldText.textContent = this.beans.agChartsExports._Util.Color.fromString( + color + ).toHexString().toUpperCase(); + return super.setValue(color); + } + getValue() { + return this.value; + } +}; +var AgColorPickerSelector = { + selector: "AG-COLOR-PICKER", + component: AgColorPicker +}; + +// packages/ag-grid-enterprise/src/agStack/agMenuList.ts +import { AgPromise, KeyCode as KeyCode5, _AgTabGuardComp as _AgTabGuardComp3, _createAgElement as _createAgElement2, _last as _last2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agMenuItemComponent.ts +import { + KeyCode as KeyCode4, + _AgBeanStub as _AgBeanStub2, + _createElement as _createElement2, + _setAriaDisabled, + _setAriaExpanded, + _setAriaHasPopup, + _setAriaRole as _setAriaRole2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agMenuPanel.ts +import { KeyCode as KeyCode3, _AgTabGuardComp as _AgTabGuardComp2 } from "ag-grid-community"; +var AgMenuPanel = class extends _AgTabGuardComp2 { + constructor(wrappedComponent) { + super(); + this.setTemplateFromElement(wrappedComponent.getGui(), void 0, void 0, true); + } + postConstruct() { + this.initialiseTabGuard({ + onTabKeyDown: (e) => this.onTabKeyDown(e), + handleKeyDown: (e) => this.handleKeyDown(e) + }); + } + handleKeyDown(e) { + if (e.key === KeyCode3.ESCAPE) { + this.closePanel(); + } + } + onTabKeyDown(e) { + if (e.defaultPrevented) { + return; + } + this.closePanel(); + e.preventDefault(); + } + closePanel() { + const menuItem = this.parentComponent; + menuItem.closeSubMenu(); + setTimeout(() => menuItem.getGui().focus(), 0); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agMenuItemComponent.ts +var AgMenuItemComponent = class extends _AgBeanStub2 { + constructor(callbacks) { + super(); + this.callbacks = callbacks; + this.ACTIVATION_DELAY = 80; + this.isActive = false; + this.subMenuIsOpen = false; + this.subMenuIsOpening = false; + this.suppressRootStyles = true; + this.suppressAria = true; + this.suppressFocus = true; + } + init(params) { + const { menuItemDef, isAnotherSubMenuOpen, level, childComponent, contextParams } = params; + this.params = params.menuItemDef; + this.level = level; + this.isAnotherSubMenuOpen = isAnotherSubMenuOpen; + this.childComponent = childComponent; + this.contextParams = contextParams; + this.cssClassPrefix = this.params.menuItemParams?.cssClassPrefix ?? "ag-menu-option"; + return this.callbacks.getMenuItemComp(this.beans, this.params, { + ...menuItemDef, + level, + isAnotherSubMenuOpen, + openSubMenu: (activateFirstItem) => this.openSubMenu(activateFirstItem), + closeSubMenu: () => this.closeSubMenu(), + closeMenu: (event) => this.closeMenu(event), + updateTooltip: (tooltip, shouldDisplayTooltip) => this.refreshTooltip(tooltip, shouldDisplayTooltip), + onItemActivated: () => this.onItemActivated() + }).then((comp) => { + if (!comp) { + return; + } + this.menuItemComp = comp; + const configureDefaults = comp.configureDefaults?.(); + if (configureDefaults) { + this.configureDefaults(configureDefaults === true ? void 0 : configureDefaults); + } + }); + } + addListeners(eGui, params) { + if (!params?.suppressClick) { + this.addManagedElementListeners(eGui, { click: (e) => this.onItemSelected(e) }); + } + if (!params?.suppressKeyboardSelect) { + this.addManagedElementListeners(eGui, { + keydown: (e) => { + if (e.key === KeyCode4.ENTER || e.key === KeyCode4.SPACE) { + e.preventDefault(); + this.onItemSelected(e); + } + } + }); + } + if (!params?.suppressMouseDown) { + this.addManagedElementListeners(eGui, { + mousedown: (e) => { + e.stopPropagation(); + e.preventDefault(); + } + }); + } + if (!params?.suppressMouseOver) { + this.addManagedElementListeners(eGui, { + mouseenter: () => this.onMouseEnter(), + mouseleave: () => this.onMouseLeave() + }); + } + } + isDisabled() { + return !!this.params.disabled; + } + openSubMenu(activateFirstItem = false, event) { + this.closeSubMenu(); + if (!this.params.subMenu) { + return; + } + this.subMenuIsOpening = true; + const ePopup = _createElement2({ tag: "div", cls: "ag-menu", role: "presentation" }); + this.eSubMenuGui = ePopup; + let destroySubMenu; + let afterGuiAttached = () => { + this.subMenuIsOpening = false; + }; + if (this.childComponent) { + const menuPanel = this.createBean( + new AgMenuPanel(this.childComponent) + ); + menuPanel.setParentComponent(this); + const subMenuGui = menuPanel.getGui(); + const mouseEvent = "mouseenter"; + const mouseEnterListener = () => this.cancelDeactivate(); + subMenuGui.addEventListener(mouseEvent, mouseEnterListener); + destroySubMenu = () => { + subMenuGui.removeEventListener(mouseEvent, mouseEnterListener); + this.destroyBean(menuPanel); + }; + ePopup.appendChild(subMenuGui); + if (this.childComponent.afterGuiAttached) { + afterGuiAttached = () => { + this.childComponent.afterGuiAttached(); + this.subMenuIsOpening = false; + }; + } + } else if (this.params.subMenu) { + const childMenu = this.createBean( + new AgMenuList(this.level + 1, this.contextParams, this.callbacks) + ); + childMenu.setParentComponent(this); + childMenu.addMenuItems(this.params.subMenu); + ePopup.appendChild(childMenu.getGui()); + this.addManagedListeners(childMenu, { closeMenu: (e) => this.dispatchLocalEvent(e) }); + childMenu.addGuiEventListener("mouseenter", () => this.cancelDeactivate()); + destroySubMenu = () => this.destroyBean(childMenu); + if (activateFirstItem) { + afterGuiAttached = () => { + childMenu.activateFirstItem(); + this.subMenuIsOpening = false; + }; + } + } + const popupSvc = this.beans.popupSvc; + const positionCallback = () => { + const eventSource = this.eGui; + popupSvc?.positionPopupForMenu({ + eventSource, + ePopup, + event: event instanceof MouseEvent ? event : void 0, + additionalParams: this.callbacks.getPostProcessPopupParams(this.contextParams) + }); + }; + const translate = this.getLocaleTextFunc(); + const addPopupRes = popupSvc?.addPopup({ + modal: true, + eChild: ePopup, + positionCallback, + anchorToElement: this.eGui, + ariaLabel: translate("ariaLabelSubMenu", "SubMenu"), + afterGuiAttached + }); + this.subMenuIsOpen = true; + this.setAriaExpanded(true); + this.hideSubMenu = () => { + if (addPopupRes) { + addPopupRes.hideFunc(); + } + this.subMenuIsOpen = false; + this.setAriaExpanded(false); + destroySubMenu(); + this.menuItemComp.setExpanded?.(false); + this.eSubMenuGui = void 0; + }; + this.menuItemComp.setExpanded?.(true); + } + setAriaExpanded(expanded) { + if (!this.suppressAria) { + _setAriaExpanded(this.eGui, expanded); + } + } + closeSubMenu() { + if (!this.hideSubMenu) { + return; + } + this.hideSubMenu(); + this.hideSubMenu = null; + this.setAriaExpanded(false); + } + isSubMenuOpen() { + return this.subMenuIsOpen; + } + isSubMenuOpening() { + return this.subMenuIsOpening; + } + activate(openSubMenu, fromKeyNav) { + this.cancelActivate(); + if (this.params.disabled && !fromKeyNav) { + return; + } + this.isActive = true; + if (!this.suppressRootStyles) { + this.eGui.classList.add(`${this.cssClassPrefix}-active`); + } + this.menuItemComp.setActive?.(true); + if (!this.suppressFocus) { + this.callbacks.preserveRangesWhile(this.beans, () => this.eGui.focus({ preventScroll: !fromKeyNav })); + } + if (openSubMenu && this.params.subMenu) { + window.setTimeout(() => { + if (this.isAlive() && this.isActive) { + this.openSubMenu(); + } + }, 300); + } + this.onItemActivated(); + } + deactivate() { + this.cancelDeactivate(); + if (!this.suppressRootStyles) { + this.eGui.classList.remove(`${this.cssClassPrefix}-active`); + } + this.menuItemComp.setActive?.(false); + this.isActive = false; + if (this.subMenuIsOpen) { + this.closeSubMenu(); + } + } + getGui() { + return this.menuItemComp.getGui(); + } + getParentComponent() { + return this.parentComponent; + } + setParentComponent(component) { + this.parentComponent = component; + } + getSubMenuGui() { + return this.eSubMenuGui; + } + onItemSelected(event) { + this.menuItemComp.select?.(); + if (this.params.action) { + this.beans.frameworkOverrides.wrapOutgoing( + () => this.params.action( + this.gos.addCommon({ + ...this.contextParams + }) + ) + ); + } else { + this.openSubMenu(event && event.type === "keydown", event); + } + if (this.params.subMenu && !this.params.action || this.params.suppressCloseOnSelect) { + return; + } + this.closeMenu(event); + } + closeMenu(event) { + const e = { + type: "closeMenu" + }; + if (event) { + if (event instanceof MouseEvent) { + e.mouseEvent = event; + } else { + e.keyboardEvent = event; + } + } + this.dispatchLocalEvent(e); + } + onItemActivated() { + const event = { + type: "menuItemActivated", + menuItem: this + }; + this.dispatchLocalEvent(event); + } + cancelActivate() { + if (this.activateTimeoutId) { + window.clearTimeout(this.activateTimeoutId); + this.activateTimeoutId = 0; + } + } + cancelDeactivate() { + if (this.deactivateTimeoutId) { + window.clearTimeout(this.deactivateTimeoutId); + this.deactivateTimeoutId = 0; + } + } + onMouseEnter() { + this.cancelDeactivate(); + if (this.isAnotherSubMenuOpen()) { + this.activateTimeoutId = window.setTimeout(() => this.activate(true), this.ACTIVATION_DELAY); + } else { + this.activate(true); + } + } + onMouseLeave() { + this.cancelActivate(); + if (this.isSubMenuOpen()) { + this.deactivateTimeoutId = window.setTimeout(() => this.deactivate(), this.ACTIVATION_DELAY); + } else { + this.deactivate(); + } + } + refreshRootElementGui(suppressRootStyles) { + let eGui = this.menuItemComp.getGui(); + const { + cssClassPrefix, + params: { cssClasses, disabled } + } = this; + const rootElement = this.menuItemComp.getRootElement?.(); + if (rootElement) { + if (!suppressRootStyles) { + eGui.classList.add("ag-menu-option-custom"); + } + eGui = rootElement; + } + this.suppressRootStyles = !!suppressRootStyles; + if (!this.suppressRootStyles) { + eGui.classList.add(cssClassPrefix); + for (const it of cssClasses ?? []) { + eGui.classList.add(it); + } + if (disabled) { + eGui.classList.add(`${cssClassPrefix}-disabled`); + } + } + return eGui; + } + applyAriaProperties(eGui) { + const { + params: { checked, subMenu, subMenuRole, disabled } + } = this; + const hasCheck = checked != null; + _setAriaRole2(eGui, hasCheck ? "menuitemcheckbox" : "menuitem"); + if (subMenu) { + _setAriaHasPopup(eGui, subMenuRole ?? "menu"); + } + if (disabled) { + _setAriaDisabled(eGui, true); + } + } + configureDefaults(configParams) { + if (!this.menuItemComp) { + setTimeout(() => this.configureDefaults(configParams)); + return; + } + const { suppressRootStyles, suppressTooltip, suppressAria, suppressTabIndex, suppressFocus } = configParams || {}; + const { + params: { tooltip, disabled } + } = this; + const eGui = this.eGui = this.refreshRootElementGui(!!suppressRootStyles); + this.suppressAria = !!suppressAria; + if (!suppressAria) { + this.applyAriaProperties(eGui); + } + if (!suppressTabIndex) { + eGui.setAttribute("tabindex", "-1"); + } + if (!suppressTooltip) { + this.refreshTooltip(tooltip); + } + if (!disabled) { + this.addListeners(eGui, configParams); + } + this.suppressFocus = !!suppressFocus; + } + refreshTooltip(tooltip, shouldDisplayTooltip) { + this.tooltip = tooltip; + this.tooltipFeature = this.destroyBean(this.tooltipFeature); + if (!tooltip || !this.menuItemComp) { + return; + } + const tooltipFeature = this.beans.registry.createDynamicBean( + "tooltipFeature", + false, + { + getGui: () => this.getGui(), + getTooltipValue: () => this.tooltip, + getLocation: () => "menu", + shouldDisplayTooltip + } + ); + if (tooltipFeature) { + this.tooltipFeature = this.createBean(tooltipFeature); + } + } + destroy() { + this.tooltipFeature = this.destroyBean(this.tooltipFeature); + this.menuItemComp?.destroy?.(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agMenuList.ts +var AgMenuList = class extends _AgTabGuardComp3 { + constructor(level = 0, menuActionParams, callbacks) { + super({ tag: "div", cls: "ag-menu-list", role: "menu" }); + this.level = level; + this.menuActionParams = menuActionParams; + this.callbacks = callbacks; + this.menuItems = []; + } + postConstruct() { + this.initialiseTabGuard({ + onTabKeyDown: (e) => this.onTabKeyDown(e), + handleKeyDown: (e) => this.callbacks.preserveRangesWhile(this.beans, () => this.handleKeyDown(e)), + onFocusIn: (e) => this.handleFocusIn(e), + onFocusOut: (e) => this.handleFocusOut(e) + }); + } + onTabKeyDown(e) { + const parent = this.getParentComponent(); + const isManaged = parent?.getGui()?.classList.contains("ag-focus-managed"); + if (!isManaged) { + e.preventDefault(); + } + if (e.shiftKey) { + this.closeIfIsChild(e); + } + } + handleKeyDown(e) { + switch (e.key) { + case KeyCode5.UP: + case KeyCode5.RIGHT: + case KeyCode5.DOWN: + case KeyCode5.LEFT: + e.preventDefault(); + this.handleNavKey(e.key); + break; + case KeyCode5.ESCAPE: + if (this.closeIfIsChild()) { + this.callbacks.stopPropagationCallbacks.stopPropagation(e); + } + break; + } + } + handleFocusIn(e) { + const oldFocusedElement = e.relatedTarget; + if (!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(oldFocusedElement) && (this.getGui().contains(oldFocusedElement) || this.activeMenuItem?.getSubMenuGui()?.contains(oldFocusedElement))) { + return; + } + if (this.activeMenuItem) { + this.activeMenuItem.activate(); + } else { + this.activateFirstItem(); + } + } + handleFocusOut(e) { + const newFocusedElement = e.relatedTarget; + if (!this.activeMenuItem || this.getGui().contains(newFocusedElement) || this.activeMenuItem.getSubMenuGui()?.contains(newFocusedElement)) { + return; + } + if (!this.activeMenuItem.isSubMenuOpening()) { + this.activeMenuItem.deactivate(); + } + } + clearActiveItem() { + if (this.activeMenuItem) { + this.activeMenuItem.deactivate(); + this.activeMenuItem = null; + } + } + addMenuItems(menuItems) { + if (menuItems == null) { + return; + } + AgPromise.all( + menuItems.map((menuItemOrString) => { + if (menuItemOrString === "separator") { + return AgPromise.resolve({ eGui: this.createSeparator() }); + } else if (typeof menuItemOrString === "string") { + this.callbacks.warnNoItem?.(menuItemOrString); + return AgPromise.resolve({ eGui: null }); + } else { + return this.addItem(menuItemOrString); + } + }) + ).then((elements) => { + for (const element of elements ?? []) { + if (element?.eGui) { + this.appendChild(element.eGui); + if (element.comp) { + this.menuItems.push(element.comp); + } + } + } + }); + } + addItem(menuItemDef) { + const menuItem = this.createManagedBean( + new AgMenuItemComponent(this.callbacks) + ); + return menuItem.init({ + menuItemDef, + isAnotherSubMenuOpen: () => this.menuItems.some((m) => m.isSubMenuOpen()), + level: this.level, + contextParams: this.menuActionParams + }).then(() => { + menuItem.setParentComponent(this); + this.addManagedListeners(menuItem, { + closeMenu: (event) => { + this.dispatchLocalEvent(event); + }, + menuItemActivated: (event) => { + if (this.activeMenuItem && this.activeMenuItem !== event.menuItem) { + this.activeMenuItem.deactivate(); + } + this.activeMenuItem = event.menuItem; + } + }); + return { + comp: menuItem, + eGui: menuItem.getGui() + }; + }); + } + activateFirstItem() { + const item = this.menuItems.filter((currentItem) => !currentItem.isDisabled())[0]; + if (!item) { + return; + } + item.activate(); + } + createSeparator() { + const part = { tag: "div", cls: "ag-menu-separator-part" }; + return _createAgElement2({ + tag: "div", + cls: "ag-menu-separator", + attrs: { + "aria-hidden": "true" + }, + children: [part, part, part, part] + }); + } + handleNavKey(key) { + switch (key) { + case KeyCode5.UP: + case KeyCode5.DOWN: { + const nextItem = this.findNextItem(key === KeyCode5.UP); + if (nextItem && nextItem !== this.activeMenuItem) { + nextItem.activate(false, true); + } + return; + } + } + const left = this.gos.get("enableRtl") ? KeyCode5.RIGHT : KeyCode5.LEFT; + if (key === left) { + this.closeIfIsChild(); + } else { + this.openChild(); + } + } + closeIfIsChild(e) { + const parentItem = this.getParentComponent(); + if (parentItem && parentItem instanceof AgMenuItemComponent) { + if (e) { + e.preventDefault(); + } + parentItem.closeSubMenu(); + parentItem.getGui().focus(); + return true; + } + return false; + } + openChild() { + if (this.activeMenuItem) { + this.activeMenuItem.openSubMenu(true); + } + } + findNextItem(up) { + const items = [...this.menuItems]; + if (!items.length) { + return; + } + if (!this.activeMenuItem) { + return up ? _last2(items) : items[0]; + } + if (up) { + items.reverse(); + } + let nextItem; + let foundCurrent = false; + for (const item of items) { + if (!foundCurrent) { + if (item === this.activeMenuItem) { + foundCurrent = true; + } + continue; + } + nextItem = item; + break; + } + if (foundCurrent && !nextItem) { + return items[0]; + } + return nextItem || this.activeMenuItem; + } + destroy() { + this.clearActiveItem(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/agStack/agContextMenuService.ts +import { + _AgBeanStub as _AgBeanStub3, + _AgComponentStub as _AgComponentStub4, + _anchorElementToMouseMoveEvent, + _createAgElement as _createAgElement3, + _focusInto, + _getPageBody, + _getRootNode, + _isPromise, + _isVisible as _isVisible2 +} from "ag-grid-community"; +var CSS_MENU = "ag-menu"; +var CSS_CONTEXT_MENU_LOADING_ICON = "ag-context-menu-loading-icon"; +var AgContextMenuService = class extends _AgBeanStub3 { + constructor(params) { + super(); + this.params = params; + this.destroyLoadingSpinner = null; + this.lastPromise = 0; + } + hideActiveMenu() { + this.destroyBean(this.activeMenu); + } + showMenu(menuActionParams, mouseEvent, anchorToElement) { + const { getMenuItems, shouldBlockMenuOpen: shouldBlockMenu } = this.params; + const menuItems = getMenuItems(menuActionParams, mouseEvent); + if (_isPromise(menuItems)) { + const currentPromise = this.lastPromise + 1; + this.lastPromise = currentPromise; + if (!this.destroyLoadingSpinner) { + this.createLoadingIcon(mouseEvent); + } + menuItems.then((menuItems2) => { + if (this.lastPromise !== currentPromise) { + return; + } + const { target } = mouseEvent; + const isFromFakeEvent = !target; + const shouldShowMenu = ( + // check if there are actual menu items to be displayed + menuItems2?.length && // check if the element that triggered the context menu was removed from the DOM + (isFromFakeEvent || _isVisible2(target)) && !shouldBlockMenu?.() + ); + if (shouldShowMenu) { + this.createContextMenu({ menuItems: menuItems2, menuActionParams, mouseEvent, anchorToElement }); + } + this.destroyLoadingSpinner?.(); + }); + return true; + } + if (!menuItems?.length) { + return false; + } + this.createContextMenu({ menuItems, menuActionParams, mouseEvent, anchorToElement }); + return true; + } + createLoadingIcon(mouseEvent) { + const { beans } = this; + const translate = this.getLocaleTextFunc(); + const loadingIcon = beans.iconSvc.createIconNoSpan("loadingMenuItems"); + const wrapperEl = _createAgElement3({ tag: "div", cls: CSS_CONTEXT_MENU_LOADING_ICON }); + wrapperEl.appendChild(loadingIcon); + const rootNode = _getRootNode(beans); + const targetEl = _getPageBody(beans); + if (!targetEl) { + return; + } + targetEl.appendChild(wrapperEl); + beans.ariaAnnounce?.announceValue( + translate("ariaLabelLoadingContextMenu", "Loading Context Menu"), + "contextmenu" + ); + beans.environment.applyThemeClasses(wrapperEl); + _anchorElementToMouseMoveEvent(wrapperEl, mouseEvent, beans); + const mouseMoveCallback = (e) => { + _anchorElementToMouseMoveEvent(wrapperEl, e, beans); + }; + rootNode.addEventListener("mousemove", mouseMoveCallback); + this.destroyLoadingSpinner = () => { + rootNode.removeEventListener("mousemove", mouseMoveCallback); + wrapperEl.remove(); + this.destroyLoadingSpinner = null; + }; + } + createContextMenu(params) { + const { + mapMenuItems, + menuItemCallbacks, + beforeMenuOpen, + onMenuClose, + afterMenuDestroyed, + onVisibleChanged, + onMenuOpen + } = this.params; + const { menuItems, menuActionParams, mouseEvent, anchorToElement } = params; + const popupSvc = this.beans.popupSvc; + const getMenuItems = mapMenuItems ? (getGui) => mapMenuItems(menuItems, menuActionParams, getGui) : () => menuItems; + const menu = new ContextMenu(getMenuItems, menuActionParams, menuItemCallbacks); + this.createBean(menu); + const eMenuGui = menu.getGui(); + beforeMenuOpen?.(menuActionParams); + const positionParams = { + additionalParams: menuItemCallbacks.getPostProcessPopupParams(menuActionParams), + type: "contextMenu", + mouseEvent, + ePopup: eMenuGui, + // move one pixel away so that accidentally double clicking + // won't show the browser's contextmenu + nudgeY: 1 + }; + const translate = this.getLocaleTextFunc(); + const addPopupRes = popupSvc?.addPopup({ + modal: true, + eChild: eMenuGui, + closeOnEsc: true, + closedCallback: (e) => { + menuItemCallbacks.preserveRangesWhile(this.beans, () => { + onMenuClose?.(); + this.destroyBean(menu); + afterMenuDestroyed?.(); + onVisibleChanged?.(false, e === void 0 ? "api" : "ui"); + }); + }, + click: mouseEvent, + positionCallback: () => { + const isRtl = this.gos.get("enableRtl"); + popupSvc?.positionPopupUnderMouseEvent({ + ...positionParams, + nudgeX: isRtl ? (eMenuGui.offsetWidth + 1) * -1 : 1 + }); + }, + // so when browser is scrolled down, or grid is scrolled, context menu stays with cell + anchorToElement, + ariaLabel: translate("ariaLabelContextMenu", "Context Menu") + }); + if (addPopupRes) { + onMenuOpen?.(); + menu.afterGuiAttached({ container: "contextMenu", hidePopup: addPopupRes.hideFunc }); + } + if (this.activeMenu) { + this.hideActiveMenu(); + } + this.activeMenu = menu; + menu.addEventListener("destroyed", () => { + if (this.activeMenu === menu) { + this.activeMenu = null; + } + }); + if (addPopupRes) { + menu.addEventListener( + "closeMenu", + (e) => addPopupRes.hideFunc({ + mouseEvent: e.mouseEvent ?? void 0, + keyboardEvent: e.keyboardEvent ?? void 0, + forceHide: true + }) + ); + } + const isApi = mouseEvent && mouseEvent instanceof MouseEvent && mouseEvent.type === "mousedown"; + onVisibleChanged?.(true, isApi ? "api" : "ui"); + } + destroy() { + this.destroyLoadingSpinner?.(); + super.destroy(); + } +}; +var ContextMenu = class extends _AgComponentStub4 { + constructor(getMenuItems, menuActionParams, callbacks) { + super({ tag: "div", cls: CSS_MENU, role: "presentation" }); + this.getMenuItems = getMenuItems; + this.menuActionParams = menuActionParams; + this.callbacks = callbacks; + this.menuList = null; + } + postConstruct() { + const menuList = this.createManagedBean( + new AgMenuList(0, this.menuActionParams, this.callbacks) + ); + const menuItemsMapped = this.getMenuItems(() => this.getGui()); + menuList.addMenuItems(menuItemsMapped); + this.appendChild(menuList); + this.menuList = menuList; + menuList.addEventListener("closeMenu", (e) => this.dispatchLocalEvent(e)); + } + afterGuiAttached({ hidePopup }) { + if (hidePopup) { + this.addDestroyFunc(hidePopup); + } + const menuList = this.menuList; + if (menuList) { + this.callbacks.preserveRangesWhile(this.beans, () => _focusInto(menuList.getGui())); + } + } +}; + +// packages/ag-grid-enterprise/src/agStack/agMenuItemRenderer.ts +import { + _AgComponentStub as _AgComponentStub5, + _createAgElement as _createAgElement4, + _isNodeOrElement, + _setAriaChecked, + _setAriaExpanded as _setAriaExpanded2 +} from "ag-grid-community"; +var AgMenuItemRenderer = class extends _AgComponentStub5 { + constructor(callbacks) { + super({ tag: "div" }); + this.callbacks = callbacks; + } + init(params) { + this.params = params; + this.cssClassPrefix = this.params.cssClassPrefix ?? "ag-menu-option"; + this.addAriaAttributes(); + this.addIcon(); + this.addName(); + this.addShortcut(); + this.addSubMenu(); + } + configureDefaults() { + return true; + } + addAriaAttributes() { + const { checked, subMenu } = this.params; + const eGui = this.getGui(); + if (checked) { + _setAriaChecked(eGui, checked); + } + if (subMenu) { + _setAriaExpanded2(eGui, false); + } + } + addIcon() { + if (this.params.isCompact) { + return; + } + const iconWrapper = _createAgElement4({ + tag: "span", + ref: "eIcon", + cls: `${this.getClassName("part")} ${this.getClassName("icon")}`, + role: "presentation" + }); + const { checked, icon } = this.params; + if (checked) { + iconWrapper.appendChild(this.beans.iconSvc.createIconNoSpan("check")); + } else if (icon) { + if (_isNodeOrElement(icon)) { + iconWrapper.appendChild(icon); + } else if (typeof icon === "string") { + iconWrapper.innerHTML = icon; + } else { + this.callbacks?.warnNoIcon?.(); + } + } + this.getGui().appendChild(iconWrapper); + } + addName() { + const name = _createAgElement4({ + tag: "span", + ref: "eName", + cls: `${this.getClassName("part")} ${this.getClassName("text")}`, + children: this.params.name || "" + }); + this.getGui().appendChild(name); + } + addShortcut() { + if (this.params.isCompact) { + return; + } + const shortcut = _createAgElement4({ + tag: "span", + ref: "eShortcut", + cls: `${this.getClassName("part")} ${this.getClassName("shortcut")}`, + children: this.params.shortcut || "" + }); + this.getGui().appendChild(shortcut); + } + addSubMenu() { + const pointer = _createAgElement4({ + tag: "span", + ref: "ePopupPointer", + cls: `${this.getClassName("part")} ${this.getClassName("popup-pointer")}` + }); + const eGui = this.getGui(); + if (this.params.subMenu) { + const iconName = this.gos.get("enableRtl") ? "subMenuOpenRtl" : "subMenuOpen"; + pointer.appendChild(this.beans.iconSvc.createIconNoSpan(iconName)); + } + eGui.appendChild(pointer); + } + getClassName(suffix) { + return `${this.cssClassPrefix}-${suffix}`; + } +}; + +// packages/ag-grid-enterprise/src/agStack/agTabbedLayout.ts +import { + KeyCode as KeyCode6, + RefPlaceholder as RefPlaceholder7, + _AgTabGuardComp as _AgTabGuardComp4, + _clearElement, + _createAgElement as _createAgElement5, + _findNextFocusableElement as _findNextFocusableElement2, + _focusInto as _focusInto2, + _getActiveDomElement as _getActiveDomElement2, + _getDocument as _getDocument2, + _isKeyboardMode, + _setAriaLabel as _setAriaLabel2, + _setAriaRole as _setAriaRole3 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/misc/enterpriseFocusUtils.ts +import { TabGuardClassNames, _FOCUS_MANAGED_CLASS, _findFocusableElements } from "ag-grid-community"; +function findFocusableElementBeforeTabGuard(rootNode, referenceElement) { + if (!referenceElement) { + return null; + } + const focusableElements = _findFocusableElements(rootNode); + const referenceIndex = focusableElements.indexOf(referenceElement); + if (referenceIndex === -1) { + return null; + } + let lastTabGuardIndex = -1; + for (let i = referenceIndex - 1; i >= 0; i--) { + if (focusableElements[i].classList.contains(TabGuardClassNames.TAB_GUARD_TOP)) { + lastTabGuardIndex = i; + break; + } + } + if (lastTabGuardIndex <= 0) { + return null; + } + return focusableElements[lastTabGuardIndex - 1]; +} +function isTargetUnderManagedComponent(rootNode, target) { + if (!target) { + return false; + } + const managedContainers = rootNode.querySelectorAll(`.${_FOCUS_MANAGED_CLASS}`); + if (!managedContainers.length) { + return false; + } + for (let i = 0; i < managedContainers.length; i++) { + if (managedContainers[i].contains(target)) { + return true; + } + } + return false; +} + +// packages/ag-grid-enterprise/src/agStack/agTabbedLayout.ts +function getTabbedLayoutTemplate(cssClass) { + return { + tag: "div", + cls: `ag-tabs ${cssClass}`, + children: [ + { tag: "div", ref: "eHeader" }, + { + tag: "div", + ref: "eBody", + role: "presentation", + cls: "ag-tabs-body" + cssClass ? ` ${cssClass}-body` : "" + } + ] + }; +} +var AgTabbedLayout = class extends _AgTabGuardComp4 { + constructor(params) { + super(getTabbedLayoutTemplate(params.cssClass)); + this.eHeader = RefPlaceholder7; + this.eBody = RefPlaceholder7; + this.items = []; + this.tabbedItemScrollMap = /* @__PURE__ */ new Map(); + this.params = params; + } + postConstruct() { + this.setupHeader(); + if (this.params.items) { + for (const item of this.params.items) { + this.addItem(item); + } + } + this.initialiseTabGuard({ + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.handleKeyDown.bind(this), + focusInnerElement: this.focusInnerElement.bind(this), + focusTrapActive: true + }); + this.addDestroyFunc(() => this.activeItem?.tabbedItem?.afterDetachedCallback?.()); + } + setupHeader() { + const { enableCloseButton, cssClass } = this.params; + const addCssClasses = (el, suffix) => { + el.classList.add(`ag-tabs-${suffix}`); + if (cssClass) { + el.classList.add(`${cssClass}-${suffix}`); + } + }; + if (enableCloseButton) { + this.setupCloseButton(addCssClasses); + this.eTabHeader = _createAgElement5({ tag: "div", role: "presentation" }); + addCssClasses(this.eHeader, "header-wrapper"); + this.eHeader.appendChild(this.eTabHeader); + } else { + this.eTabHeader = this.eHeader; + } + _setAriaRole3(this.eTabHeader, "tablist"); + addCssClasses(this.eTabHeader, "header"); + } + setupCloseButton(addCssClasses) { + const eCloseButton = _createAgElement5({ tag: "button" }); + addCssClasses(eCloseButton, "close-button"); + const eIcon = this.beans.iconSvc.createIconNoSpan("close"); + _setAriaLabel2(eCloseButton, this.params.closeButtonAriaLabel); + eCloseButton.appendChild(eIcon); + this.addManagedElementListeners(eCloseButton, { click: () => this.params.onCloseClicked?.() }); + const eCloseButtonWrapper = _createAgElement5({ tag: "div", role: "presentation" }); + addCssClasses(eCloseButtonWrapper, "close-button-wrapper"); + eCloseButtonWrapper.appendChild(eCloseButton); + this.eHeader.appendChild(eCloseButtonWrapper); + this.eCloseButton = eCloseButton; + } + handleKeyDown(e) { + switch (e.key) { + case KeyCode6.RIGHT: + case KeyCode6.LEFT: { + if (!this.eTabHeader.contains(_getActiveDomElement2(this.beans))) { + return; + } + const isRightKey = e.key === KeyCode6.RIGHT; + const isRtl = this.gos.get("enableRtl"); + const currentPosition = this.items.indexOf(this.activeItem); + const nextPosition = isRightKey !== isRtl ? Math.min(currentPosition + 1, this.items.length - 1) : Math.max(currentPosition - 1, 0); + if (currentPosition === nextPosition) { + return; + } + e.preventDefault(); + const nextItem = this.items[nextPosition]; + this.showItemWrapper(nextItem); + nextItem.eHeaderButton.focus(); + break; + } + case KeyCode6.UP: + case KeyCode6.DOWN: + e.stopPropagation(); + break; + } + } + onTabKeyDown(e) { + if (e.defaultPrevented) { + return; + } + const { beans, eHeader, eBody, activeItem, params } = this; + const { suppressTrapFocus, enableCloseButton } = params; + const activeElement = _getActiveDomElement2(beans); + const target = e.target; + const backwards = e.shiftKey; + if (eHeader.contains(activeElement)) { + e.preventDefault(); + if (enableCloseButton && backwards && !this.eCloseButton?.contains(activeElement)) { + this.eCloseButton?.focus(); + } else if (suppressTrapFocus && backwards) { + findFocusableElementBeforeTabGuard(_getDocument2(beans).body, target)?.focus(); + } else { + this.focusBody(e.shiftKey); + } + return; + } + let nextEl = null; + if (isTargetUnderManagedComponent(eBody, target)) { + if (backwards) { + nextEl = findFocusableElementBeforeTabGuard(eBody, target); + } + if (!nextEl && !suppressTrapFocus) { + nextEl = activeItem.eHeaderButton; + } + } + if (!nextEl && eBody.contains(activeElement)) { + nextEl = _findNextFocusableElement2(beans, eBody, false, backwards); + if (!nextEl) { + if (suppressTrapFocus && !backwards) { + this.forceFocusOutOfContainer(backwards); + } else if (enableCloseButton && !backwards) { + e.preventDefault(); + this.eCloseButton?.focus(); + } else { + e.preventDefault(); + this.focusHeader(); + } + return; + } + } + if (nextEl) { + e.preventDefault(); + nextEl.focus(); + } + } + focusInnerElement(fromBottom) { + if (fromBottom) { + return this.focusBody(true); + } else { + this.focusHeader(); + return true; + } + } + focusHeader(preventScroll) { + this.activeItem.eHeaderButton.focus({ preventScroll }); + } + focusBody(fromBottom) { + return _focusInto2(this.eBody, fromBottom); + } + setAfterAttachedParams(params) { + this.afterAttachedParams = params; + } + showFirstItem() { + if (this.items.length > 0) { + this.showItemWrapper(this.items[0]); + } + } + addItem(item) { + const eHeaderButton = _createAgElement5({ + tag: "span", + cls: "ag-tab", + role: "tab", + attrs: { tabindex: "-1" } + }); + eHeaderButton.appendChild(item.title); + this.eTabHeader.appendChild(eHeaderButton); + _setAriaLabel2(eHeaderButton, item.titleLabel); + const wrapper = { + tabbedItem: item, + eHeaderButton + }; + this.items.push(wrapper); + eHeaderButton.addEventListener("click", this.showItemWrapper.bind(this, wrapper)); + } + showItem(tabbedItem) { + const itemWrapper = this.items.find((wrapper) => wrapper.tabbedItem === tabbedItem); + if (itemWrapper) { + this.showItemWrapper(itemWrapper); + } + } + showItemWrapper(wrapper) { + const { tabbedItem, eHeaderButton } = wrapper; + this.params.onItemClicked?.({ item: tabbedItem }); + if (this.activeItem === wrapper) { + this.params.onActiveItemClicked?.(); + return; + } + if (this.lastScrollListener) { + this.lastScrollListener = this.lastScrollListener(); + } + _clearElement(this.eBody); + tabbedItem.bodyPromise.then((body) => { + this.eBody.appendChild(body); + const onlyUnmanaged = !_isKeyboardMode(); + if (!this.params.suppressFocusBodyOnOpen) { + _focusInto2(this.eBody, false, onlyUnmanaged); + } + if (tabbedItem.afterAttachedCallback) { + tabbedItem.afterAttachedCallback(this.afterAttachedParams); + } + if (this.params.keepScrollPosition) { + const scrollableContainer = tabbedItem.getScrollableContainer?.() || body; + [this.lastScrollListener] = this.addManagedElementListeners(scrollableContainer, { + scroll: () => { + this.tabbedItemScrollMap.set(tabbedItem.name, scrollableContainer.scrollTop); + } + }); + const scrollPosition = this.tabbedItemScrollMap.get(tabbedItem.name); + if (scrollPosition !== void 0) { + setTimeout(() => { + scrollableContainer.scrollTop = scrollPosition; + }, 0); + } + } + }); + if (this.activeItem) { + this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"); + this.activeItem.tabbedItem.afterDetachedCallback?.(); + } + eHeaderButton.classList.add("ag-tab-selected"); + this.activeItem = wrapper; + } +}; + +// packages/ag-grid-enterprise/src/agStack/agGroupComponent.ts +import { + AgCheckboxSelector, + AgToggleButton, + KeyCode as KeyCode7, + RefPlaceholder as RefPlaceholder8, + _AgComponentStub as _AgComponentStub6, + _isComponent, + _removeFromParent, + _setAriaExpanded as _setAriaExpanded3, + _setAriaRole as _setAriaRole4, + _setDisplayed as _setDisplayed4 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/agStack/agGroupComponent.css +var agGroupComponent_default = ".ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}"; + +// packages/ag-grid-enterprise/src/agStack/agGroupComponent.ts +function getAgGroupComponentTemplate(params) { + const cssIdentifier = params.cssIdentifier || "default"; + const direction = params.direction || "vertical"; + return { + tag: "div", + cls: `ag-group ag-${cssIdentifier}-group`, + role: "presentation", + children: [ + { + tag: "div", + ref: "eToolbar", + cls: `ag-group-toolbar ag-${cssIdentifier}-group-toolbar`, + children: [{ tag: "ag-checkbox", ref: "cbGroupEnabled" }] + }, + { + tag: "div", + ref: "eContainer", + cls: `ag-group-container ag-group-container-${direction} ag-${cssIdentifier}-group-container` + } + ] + }; +} +var AgGroupComponent = class extends _AgComponentStub6 { + constructor(params = {}) { + super( + getAgGroupComponentTemplate(params), + [AgCheckboxSelector] + ); + this.params = params; + this.suppressEnabledCheckbox = true; + this.suppressToggleExpandOnEnableChange = false; + this.eToolbar = RefPlaceholder8; + this.cbGroupEnabled = RefPlaceholder8; + this.eContainer = RefPlaceholder8; + this.registerCSS(agGroupComponent_default); + const { + enabled, + items, + suppressEnabledCheckbox, + expanded, + suppressToggleExpandOnEnableChange, + useToggle: toggleMode + } = params; + this.cssIdentifier = params.cssIdentifier || "default"; + this.enabled = enabled != null ? enabled : true; + this.items = items || []; + this.useToggle = toggleMode ?? false; + this.alignItems = params.alignItems || "center"; + this.expanded = expanded == null ? true : expanded; + if (suppressEnabledCheckbox != null) { + this.suppressEnabledCheckbox = suppressEnabledCheckbox; + } + if (suppressToggleExpandOnEnableChange != null) { + this.suppressToggleExpandOnEnableChange = suppressToggleExpandOnEnableChange; + } + } + postConstruct() { + this.setupTitleBar(); + if (this.items.length) { + const initialItems = this.items; + this.items = []; + this.addItems(initialItems); + } + const localeTextFunc = this.getLocaleTextFunc(); + this.cbGroupEnabled.setLabel(localeTextFunc("enabled", "Enabled")); + if (this.enabled) { + this.setEnabled(this.enabled, void 0, true); + } + this.setAlignItems(this.alignItems); + const { onEnableChange, onExpandedChange, suppressOpenCloseIcons } = this.params; + this.hideEnabledCheckbox(this.suppressEnabledCheckbox); + this.hideOpenCloseIcons(suppressOpenCloseIcons ?? false); + this.refreshChildDisplay(); + _setDisplayed4(this.eContainer, this.expanded); + this.cbGroupEnabled.onValueChange((newSelection) => { + this.setEnabled(newSelection, true, this.suppressToggleExpandOnEnableChange); + this.dispatchEnableChangeEvent(newSelection); + }); + if (onEnableChange != null) { + this.onEnableChange(onEnableChange); + } + if (onExpandedChange != null) { + this.onExpandedChange(onExpandedChange); + } + } + refreshChildDisplay() { + _setDisplayed4(this.eToolbar, this.expanded && !this.suppressEnabledCheckbox); + this.eTitleBar?.refreshOnExpand(this.expanded); + } + isExpanded() { + return this.expanded; + } + setAlignItems(alignment) { + if (this.alignItems !== alignment) { + this.removeCss(`ag-group-item-alignment-${this.alignItems}`); + } + this.alignItems = alignment; + const newCls = `ag-group-item-alignment-${this.alignItems}`; + this.addCss(newCls); + return this; + } + toggleGroupExpand(expanded, silent) { + if (this.eTitleBar?.isSuppressCollapse() && !this.useToggle) { + expanded = true; + silent = true; + } else { + expanded = expanded != null ? expanded : !this.expanded; + if (this.expanded === expanded) { + return this; + } + } + this.expanded = expanded; + this.refreshChildDisplay(); + _setDisplayed4(this.eContainer, expanded); + if (!silent) { + this.dispatchLocalEvent({ + type: expanded ? "expanded" : "collapsed" + }); + } + return this; + } + addItems(items) { + for (const item of items) { + this.addItem(item); + } + } + prependItem(item) { + this.insertItem(item, true); + } + addItem(item) { + this.insertItem(item, false); + } + updateItems(newItems) { + const oldItems = this.items; + let newIndex = 0; + for (let prevIndex = 0; prevIndex < oldItems.length; ++prevIndex) { + const ePrevItem = oldItems[prevIndex]; + if (ePrevItem === newItems[newIndex]) { + newIndex++; + } else { + const el = _isComponent(ePrevItem) ? ePrevItem.getGui() : ePrevItem; + _removeFromParent(el); + } + } + while (newIndex < newItems.length) { + this.insertItem(newItems[newIndex++]); + } + this.items = newItems; + } + insertItem(item, prepend) { + const container = this.eContainer; + const el = _isComponent(item) ? item.getGui() : item; + el.classList.add("ag-group-item", `ag-${this.cssIdentifier}-group-item`); + if (prepend) { + container.prepend(el); + this.items.unshift(el); + } else { + container.appendChild(el); + this.items.push(el); + } + } + hideItem(hide, index) { + const itemToHide = this.items[index]; + _setDisplayed4(itemToHide, !hide); + } + getItemIndex(item) { + const el = _isComponent(item) ? item.getGui() : item; + return this.items.indexOf(el); + } + setTitle(title) { + this.eTitleBar?.setTitle(title); + return this; + } + addTitleBarWidget(el) { + this.eTitleBar?.addWidget(el); + return this; + } + addCssClassToTitleBar(cssClass) { + this.eTitleBar?.addCss(cssClass); + } + dispatchEnableChangeEvent(enabled) { + const event = { + type: "enableChange", + enabled + }; + this.dispatchLocalEvent(event); + } + setEnabled(enabled, skipToggle, skipExpand) { + this.enabled = enabled; + this.refreshDisabledStyles(); + if (!skipExpand) { + this.toggleGroupExpand(enabled); + } + if (!skipToggle) { + this.cbGroupEnabled.setValue(enabled); + this.eToggle?.setValue(enabled); + } + return this; + } + isEnabled() { + return this.enabled; + } + onEnableChange(callbackFn) { + this.addManagedListeners(this, { enableChange: (event) => callbackFn(event.enabled) }); + return this; + } + onExpandedChange(callbackFn) { + this.addManagedListeners(this, { + expanded: () => callbackFn(true), + collapsed: () => callbackFn(false) + }); + return this; + } + hideEnabledCheckbox(hide) { + this.suppressEnabledCheckbox = hide; + this.refreshChildDisplay(); + this.refreshDisabledStyles(); + return this; + } + hideOpenCloseIcons(hide) { + this.eTitleBar?.hideOpenCloseIcons(hide); + return this; + } + refreshDisabledStyles() { + const disabled = !this.enabled; + this.eContainer.classList.toggle("ag-disabled", disabled); + this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox && disabled); + this.eContainer.classList.toggle("ag-disabled-group-container", disabled); + } + setupTitleBar() { + const titleBar = this.useToggle ? this.createToggleTitleBar() : this.createDefaultTitleBar(); + this.eToolbar.insertAdjacentElement("beforebegin", titleBar.getGui()); + } + createDefaultTitleBar() { + const titleBar = this.createManagedBean( + new DefaultTitleBar(this.params) + ); + this.eTitleBar = titleBar; + titleBar.refreshOnExpand(this.expanded); + this.addManagedListeners(titleBar, { + expandedChanged: (event) => this.toggleGroupExpand(event.expanded) + }); + return titleBar; + } + createToggleTitleBar() { + const eToggle = this.createManagedBean( + new AgToggleButton({ + value: this.enabled, + label: this.params.title, + labelAlignment: "left", + labelWidth: "flex", + onValueChange: (enabled) => { + this.setEnabled(enabled, true); + this.dispatchEnableChangeEvent(enabled); + } + }) + ); + eToggle.addCss("ag-group-title-bar"); + eToggle.addCss(`ag-${this.params.cssIdentifier ?? "default"}-group-title-bar ag-unselectable`); + this.eToggle = eToggle; + this.toggleGroupExpand(this.enabled); + return eToggle; + } +}; +var TITLE_BAR_DISABLED_CLASS = "ag-disabled-group-title-bar"; +function getDefaultTitleBarTemplate(params) { + const cssIdentifier = params.cssIdentifier ?? "default"; + return { + tag: "div", + cls: `ag-group-title-bar ag-${cssIdentifier}-group-title-bar ag-unselectable`, + role: params.suppressKeyboardNavigation ? "presentation" : "group", + children: [ + { + tag: "span", + ref: "eGroupOpenedIcon", + cls: `ag-group-title-bar-icon ag-${cssIdentifier}-group-title-bar-icon`, + role: "presentation" + }, + { + tag: "span", + ref: "eGroupClosedIcon", + cls: `ag-group-title-bar-icon ag-${cssIdentifier}-group-title-bar-icon`, + role: "presentation" + }, + { tag: "span", ref: "eTitle", cls: `ag-group-title ag-${cssIdentifier}-group-title` } + ] + }; +} +var DefaultTitleBar = class extends _AgComponentStub6 { + constructor(params = {}) { + super(getDefaultTitleBarTemplate(params)); + this.suppressOpenCloseIcons = false; + this.suppressKeyboardNavigation = false; + this.eGroupOpenedIcon = RefPlaceholder8; + this.eGroupClosedIcon = RefPlaceholder8; + this.eTitle = RefPlaceholder8; + const { title, suppressOpenCloseIcons, suppressKeyboardNavigation } = params; + if (!!title && title.length > 0) { + this.title = title; + } + if (suppressOpenCloseIcons != null) { + this.suppressOpenCloseIcons = suppressOpenCloseIcons; + } + this.suppressKeyboardNavigation = suppressKeyboardNavigation ?? false; + } + postConstruct() { + this.setTitle(this.title); + this.hideOpenCloseIcons(this.suppressOpenCloseIcons); + this.setupExpandContract(); + } + setupExpandContract() { + const iconSvc = this.beans.iconSvc; + this.eGroupClosedIcon.appendChild(iconSvc.createIconNoSpan("accordionClosed")); + this.eGroupOpenedIcon.appendChild(iconSvc.createIconNoSpan("accordionOpen")); + this.addManagedElementListeners(this.getGui(), { + click: () => this.dispatchExpandChanged(), + keydown: (e) => { + switch (e.key) { + case KeyCode7.ENTER: + case KeyCode7.SPACE: + e.preventDefault(); + this.dispatchExpandChanged(); + break; + case KeyCode7.RIGHT: + case KeyCode7.LEFT: + e.preventDefault(); + this.dispatchExpandChanged(e.key === KeyCode7.RIGHT); + break; + } + } + }); + } + refreshOnExpand(expanded) { + this.refreshAriaStatus(expanded); + this.refreshOpenCloseIcons(expanded); + } + refreshAriaStatus(expanded) { + if (!this.suppressOpenCloseIcons) { + _setAriaExpanded3(this.getGui(), expanded); + } + } + refreshOpenCloseIcons(expanded) { + const showIcon = !this.suppressOpenCloseIcons; + _setDisplayed4(this.eGroupOpenedIcon, showIcon && expanded); + _setDisplayed4(this.eGroupClosedIcon, showIcon && !expanded); + } + isSuppressCollapse() { + return this.suppressOpenCloseIcons; + } + dispatchExpandChanged(expanded) { + const event = { + type: "expandedChanged", + expanded + }; + this.dispatchLocalEvent(event); + } + setTitle(title) { + const eGui = this.getGui(); + const hasTitle = !!title && title.length > 0; + title = hasTitle ? title : void 0; + this.eTitle.textContent = title ?? ""; + _setDisplayed4(eGui, hasTitle); + if (title !== this.title) { + this.title = title; + } + const disabled = eGui.classList.contains(TITLE_BAR_DISABLED_CLASS); + this.refreshDisabledStyles(disabled); + return this; + } + addWidget(el) { + this.getGui().appendChild(el); + return this; + } + hideOpenCloseIcons(hide) { + this.suppressOpenCloseIcons = hide; + if (hide) { + this.dispatchExpandChanged(true); + } + return this; + } + refreshDisabledStyles(disabled) { + const eGui = this.getGui(); + if (disabled) { + eGui.classList.add(TITLE_BAR_DISABLED_CLASS); + eGui.removeAttribute("tabindex"); + _setAriaRole4(eGui, "presentation"); + } else { + eGui.classList.remove(TITLE_BAR_DISABLED_CLASS); + if (typeof this.title === "string" && !this.suppressKeyboardNavigation) { + this.activateTabIndex([eGui]); + _setAriaRole4(eGui, "group"); + } else { + eGui.removeAttribute("tabindex"); + _setAriaRole4(eGui, "presentation"); + } + } + } +}; +var AgGroupComponentSelector = { + selector: "AG-GROUP-COMPONENT", + component: AgGroupComponent +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterModule.ts +import { + TooltipModule, + _FilterCoreModule, + _FilterValueModule, + _PopupModule, + _SharedDragAndDropModule +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/version.ts +var VERSION = "35.2.0"; + +// packages/ag-grid-enterprise/src/agGridEnterpriseModule.ts +var EnterpriseCoreModule = { + moduleName: "EnterpriseCore", + version: VERSION, + beans: [GridLicenseManager], + icons: { + // accordion open (filter tool panel group, charts group) + accordionOpen: "tree-open", + // accordion closed (filter tool panel group, charts group) + accordionClosed: "tree-closed", + // accordion indeterminate - shown when some children are expanded and + // others are collapsed (filter tool panel group, charts group) + accordionIndeterminate: "tree-indeterminate", + // dialog title bar + close: "cross", + // X (remove) on column 'pill' after adding it to a drop zone list + cancel: "cancel", + // button in chart regular size window title bar (click to maximise) + maximize: "maximize", + // button in chart maximised window title bar (click to make regular size) + minimize: "minimize", + // drag handle used to pick up draggable columns + columnDrag: "grip" + }, + dependsOn: [], + setLicenseKey: GridLicenseManager.setLicenseKey +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advanced-filter.css +var advanced_filter_default = '.ag-advanced-filter-header{align-items:center;background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);display:flex;position:relative}.ag-advanced-filter{align-items:center;display:flex;width:100%}.ag-advanced-filter-buttons{display:contents}.ag-advanced-filter-header-cell{height:100%;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding)}.ag-advanced-filter-apply-button,.ag-advanced-filter-builder-button{align-items:center;background-color:unset;border:0;display:flex;font-size:var(--ag-font-size);font-weight:600;line-height:normal;padding:var(--ag-spacing);white-space:nowrap;&:where(.ag-standard-button):where(:not(:disabled)){cursor:pointer;&:where(.ag-standard-button):hover{background-color:var(--ag-row-hover-color)}}}:where(.ag-ltr) .ag-advanced-filter-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-button{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-advanced-filter-builder-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-advanced-filter-builder-button-label{margin-right:var(--ag-spacing)}.ag-advanced-filter-builder{display:flex;flex-direction:column;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-advanced-filter-builder-list{flex:1;overflow:auto}.ag-advanced-filter-builder-button-panel{border-top:var(--ag-advanced-filter-builder-button-bar-border);display:flex;justify-content:flex-end;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-advanced-filter-builder-apply-button,:where(.ag-ltr) .ag-advanced-filter-builder-cancel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-advanced-filter-builder-apply-button,:where(.ag-rtl) .ag-advanced-filter-builder-cancel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-advanced-filter-builder-item-wrapper{align-items:center;display:flex;flex:1 1 auto;justify-content:space-between;overflow:hidden}:where(.ag-ltr) .ag-advanced-filter-builder-item-wrapper{padding-left:calc(var(--ag-icon-size)/2);padding-right:var(--ag-icon-size)}:where(.ag-rtl) .ag-advanced-filter-builder-item-wrapper{padding-left:var(--ag-icon-size);padding-right:calc(var(--ag-icon-size)/2)}:where(.ag-virtual-list-viewport) .ag-advanced-filter-builder-item-wrapper .ag-tab-guard{position:absolute}.ag-advanced-filter-builder-item-tree-line{width:var(--ag-advanced-filter-builder-indent-size)}.ag-advanced-filter-builder-item-tree-line-root{width:var(--ag-icon-size)}.ag-advanced-filter-builder-item-tree-line-root:before{height:50%;top:50%}.ag-advanced-filter-builder-item-tree-line-horizontal,.ag-advanced-filter-builder-item-tree-line-vertical,.ag-advanced-filter-builder-item-tree-line-vertical-bottom,.ag-advanced-filter-builder-item-tree-line-vertical-top{align-items:center;display:flex;height:100%;position:relative}.ag-advanced-filter-builder-item-tree-line-horizontal:after,.ag-advanced-filter-builder-item-tree-line-horizontal:before,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:after,.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before,.ag-advanced-filter-builder-item-tree-line-vertical-top:after,.ag-advanced-filter-builder-item-tree-line-vertical-top:before,.ag-advanced-filter-builder-item-tree-line-vertical:after,.ag-advanced-filter-builder-item-tree-line-vertical:before{content:"";height:100%;position:absolute}.ag-advanced-filter-builder-item-tree-line-horizontal:after{border-bottom:var(--ag-border-width) solid var(--ag-border-color);height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size))}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-horizontal:after{left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-horizontal:after{right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical:before{top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-top:before{height:50%;top:0;width:calc(var(--ag-advanced-filter-builder-indent-size) - var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-top:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{height:calc(50% - var(--ag-icon-size)*1.5/2);top:calc(50% + var(--ag-icon-size)*1.5/2);width:calc(var(--ag-icon-size)/2)}:where(.ag-ltr) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-left:var(--ag-border-width) solid var(--ag-border-color);left:calc(var(--ag-icon-size)/2)}:where(.ag-rtl) .ag-advanced-filter-builder-item-tree-line-vertical-bottom:before{border-right:var(--ag-border-width) solid var(--ag-border-color);right:calc(var(--ag-icon-size)/2)}.ag-advanced-filter-builder-item-condition{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing)}.ag-advanced-filter-builder-item,.ag-advanced-filter-builder-item-buttons,.ag-advanced-filter-builder-item-condition,.ag-advanced-filter-builder-item-tree-lines,.ag-advanced-filter-builder-pill,.ag-advanced-filter-builder-pill-wrapper{align-items:center;display:flex;height:100%}.ag-advanced-filter-builder-pill-wrapper{margin:0 var(--ag-spacing)}.ag-advanced-filter-builder-pill{border-radius:var(--ag-border-radius);min-height:calc(100% - var(--ag-spacing)*3);min-width:calc(var(--ag-spacing)*2);padding:var(--ag-spacing) calc(var(--ag-spacing)*2);position:relative}:where(.ag-advanced-filter-builder-pill){.ag-advanced-filter-builder-value-number{font-family:monospace;font-weight:700}.ag-advanced-filter-builder-value-empty{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-advanced-filter-builder-pill){.ag-picker-field-display{margin-left:var(--ag-spacing)}}.ag-advanced-filter-builder-pill-display{font-weight:500;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-advanced-filter-builder-join-pill{background-color:var(--ag-advanced-filter-builder-join-pill-color);cursor:pointer}.ag-advanced-filter-builder-column-pill{background-color:var(--ag-advanced-filter-builder-column-pill-color);cursor:pointer}.ag-advanced-filter-builder-option-pill{background-color:var(--ag-advanced-filter-builder-option-pill-color);cursor:pointer}.ag-advanced-filter-builder-value-pill{background-color:var(--ag-advanced-filter-builder-value-pill-color);cursor:text;max-width:140px;:where(.ag-advanced-filter-builder-pill-display){display:block}}.ag-advanced-filter-builder-item-buttons{display:flex;gap:var(--ag-spacing);padding:0 calc(var(--ag-spacing)*.5)}.ag-advanced-filter-builder-item-button{color:var(--ag-subtle-text-color);cursor:pointer;position:relative}.ag-advanced-filter-builder-item-button,.ag-advanced-filter-builder-pill{&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-advanced-filter-builder-item-button-disabled{cursor:default;opacity:.5}.ag-advanced-filter-builder-virtual-list-container{top:var(--ag-spacing)}.ag-advanced-filter-builder-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height)}.ag-advanced-filter-builder-virtual-list-item:hover{background-color:var(--ag-row-hover-color);:where(.ag-advanced-filter-builder-item-button){opacity:1}}.ag-advanced-filter-builder-invalid{color:var(--ag-subtle-text-color);cursor:default;margin:0 var(--ag-spacing)}:where(.ag-advanced-filter-builder-validation) .ag-advanced-filter-builder-invalid{color:var(--ag-invalid-color)}:where(.ag-advanced-filter-builder-virtual-list-item-highlight) .ag-advanced-filter-builder-item-button:focus-visible{opacity:1}'; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterApi.ts +function getAdvancedFilterModel(beans) { + return beans.filterManager?.getAdvFilterModel() ?? null; +} +function setAdvancedFilterModel(beans, advancedFilterModel) { + beans.filterManager?.setAdvFilterModel(advancedFilterModel); +} +function showAdvancedFilterBuilder(beans) { + beans.filterManager?.toggleAdvFilterBuilder(true, "api"); +} +function hideAdvancedFilterBuilder(beans) { + beans.filterManager?.toggleAdvFilterBuilder(false, "api"); +} + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterExpressionService.ts +import { BeanStub as BeanStub2, _exists as _exists3, _parseDateTimeFromString, _serialiseDate, _toStringOrNull } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterLocaleText.ts +var ADVANCED_FILTER_LOCALE_TEXT = { + ariaAdvancedFilterBuilderItem: (variableValues) => `${variableValues[0]}. Level ${variableValues[1]}. Press ENTER to edit`, + ariaAdvancedFilterBuilderItemValidation: (variableValues) => `${variableValues[0]}. Level ${variableValues[1]}. ${variableValues[2]} Press ENTER to edit`, + ariaAdvancedFilterBuilderList: "Advanced Filter Builder List", + ariaAdvancedFilterBuilderFilterItem: "Filter Condition", + ariaAdvancedFilterBuilderGroupItem: "Filter Group", + ariaAdvancedFilterBuilderColumn: "Column", + ariaAdvancedFilterBuilderOption: "Option", + ariaAdvancedFilterBuilderValue: "Value", + ariaAdvancedFilterBuilderJoinOperator: "Join Operator", + ariaAdvancedFilterInput: "Advanced Filter Input", + ariaLabelAdvancedFilterAutocomplete: "Advanced Filter Autocomplete", + advancedFilterContains: "contains", + advancedFilterNotContains: "does not contain", + advancedFilterTextEquals: "equals", + advancedFilterTextNotEqual: "does not equal", + advancedFilterStartsWith: "begins with", + advancedFilterEndsWith: "ends with", + advancedFilterBlank: "is blank", + advancedFilterNotBlank: "is not blank", + advancedFilterEquals: "=", + advancedFilterNotEqual: "!=", + advancedFilterGreaterThan: ">", + advancedFilterGreaterThanOrEqual: ">=", + advancedFilterLessThan: "<", + advancedFilterLessThanOrEqual: "<=", + advancedFilterTrue: "is true", + advancedFilterFalse: "is false", + advancedFilterAnd: "AND", + advancedFilterOr: "OR", + advancedFilterApply: "Apply", + advancedFilterReset: "Reset", + advancedFilterCancel: "Cancel", + advancedFilterClear: "Clear", + advancedFilterBuilder: "Builder", + advancedFilterValidationMissingColumn: "Column is missing", + advancedFilterValidationMissingOption: "Option is missing", + advancedFilterValidationMissingValue: "Value is missing", + advancedFilterValidationInvalidColumn: "Column not found", + advancedFilterValidationInvalidOption: "Option not found", + advancedFilterValidationMissingQuote: "Value is missing an end quote", + advancedFilterValidationNotANumber: "Value is not a number", + advancedFilterValidationNotABigInt: "Value is not a big integer", + advancedFilterValidationInvalidDate: "Value is not a valid date", + advancedFilterValidationMissingCondition: "Condition is missing", + advancedFilterValidationJoinOperatorMismatch: "Join operators within a condition must be the same", + advancedFilterValidationInvalidJoinOperator: "Join operator not found", + advancedFilterValidationMissingEndBracket: "Missing end bracket", + advancedFilterValidationExtraEndBracket: "Too many end brackets", + advancedFilterValidationMessage: (variableValues) => `Expression has an error. ${variableValues[0]} - ${variableValues[1]}.`, + advancedFilterValidationMessageAtEnd: (variableValues) => `Expression has an error. ${variableValues[0]} at end of expression.`, + advancedFilterBuilderTitle: "Advanced Filter", + advancedFilterBuilderApply: "Apply", + advancedFilterBuilderCancel: "Cancel", + advancedFilterBuilderClear: "Clear", + advancedFilterBuilderReset: "Reset", + advancedFilterBuilderAddButtonTooltip: "Add Filter or Group", + advancedFilterBuilderRemoveButtonTooltip: "Remove", + advancedFilterBuilderMoveUpButtonTooltip: "Move Up", + advancedFilterBuilderMoveDownButtonTooltip: "Move Down", + advancedFilterBuilderAddJoin: "Add Group", + advancedFilterBuilderAddCondition: "Add Filter", + advancedFilterBuilderSelectColumn: "Select a column", + advancedFilterBuilderSelectOption: "Select an option", + advancedFilterBuilderEnterValue: "Enter a value...", + advancedFilterBuilderValidationAlreadyApplied: "Current filter already applied.", + advancedFilterBuilderValidationIncomplete: "Not all conditions are complete.", + advancedFilterBuilderValidationSelectColumn: "Must select a column.", + advancedFilterBuilderValidationSelectOption: "Must select an option.", + advancedFilterBuilderValidationEnterValue: "Must enter a value." +}; + +// packages/ag-grid-enterprise/src/advancedFilter/colFilterExpressionParser.ts +import { _parseBigIntOrNull } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/filterExpressionUtils.ts +function getSearchString(value, position, endPosition) { + if (!value) { + return ""; + } + const numChars = endPosition - position; + return numChars ? value.slice(0, value.length - numChars) : value; +} +function updateExpression(expression, startPosition, endPosition, updatedValuePart, appendSpace, appendQuote, empty) { + const secondPartStartPosition = endPosition + (!expression.length || empty ? 0 : 1); + let positionOffset = 0; + if (appendSpace) { + if (expression[secondPartStartPosition] === " ") { + positionOffset = 1; + } else { + updatedValuePart += " "; + if (appendQuote) { + updatedValuePart += `"`; + } + } + } + const updatedValue = expression.slice(0, startPosition) + updatedValuePart + expression.slice(secondPartStartPosition); + return { updatedValue, updatedPosition: startPosition + updatedValuePart.length + positionOffset }; +} +function findStartPosition(expression, position, endPosition) { + let startPosition = position; + while (startPosition < endPosition) { + const char = expression[startPosition]; + if (char !== " ") { + break; + } + startPosition++; + } + return startPosition; +} +function findEndPosition(expression, position, includeCloseBracket, isStartPositionUnknown) { + let endPosition = position; + let isEmpty = false; + while (endPosition < expression.length) { + const char = expression[endPosition]; + if (char === "(") { + if (isStartPositionUnknown && expression[endPosition - 1] === " ") { + isEmpty = true; + } else { + endPosition = endPosition - 1; + } + break; + } else if (char === " " || includeCloseBracket && char === ")") { + endPosition = endPosition - 1; + break; + } + endPosition++; + } + return { endPosition, isEmpty }; +} +function checkAndUpdateExpression(params, userValue, displayValue, endPosition) { + if (displayValue !== userValue) { + params.expression = updateExpression( + params.expression, + endPosition - userValue.length + 1, + endPosition, + displayValue + ).updatedValue; + } +} + +// packages/ag-grid-enterprise/src/advancedFilter/colFilterExpressionParser.ts +var ColumnParser = class { + constructor(params, startPosition) { + this.params = params; + this.startPosition = startPosition; + this.type = "column"; + this.valid = true; + this.hasStartChar = false; + this.hasEndChar = false; + this.colName = ""; + } + parse(char, position) { + if (char === COL_FILTER_EXPRESSION_START_CHAR && !this.colName) { + this.hasStartChar = true; + } else if (char === COL_FILTER_EXPRESSION_END_CHAR && this.hasStartChar) { + const isMatch = this.parseColumn(false, position); + if (isMatch) { + this.hasEndChar = true; + return false; + } else { + this.colName += char; + } + } else { + this.colName += char; + } + return void 0; + } + getDisplayValue() { + return (this.hasStartChar ? COL_FILTER_EXPRESSION_START_CHAR : "") + this.colName + (this.hasEndChar ? COL_FILTER_EXPRESSION_END_CHAR : ""); + } + getColId() { + return this.colId; + } + complete(position) { + this.parseColumn(true, position); + } + getValidationError() { + return this.valid ? null : { + message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidColumn"), + startPosition: this.startPosition, + endPosition: this.endPosition ?? this.params.expression.length - 1 + }; + } + parseColumn(fromComplete, endPosition) { + this.endPosition = endPosition; + const colValue = this.params.advFilterExpSvc.getColId(this.colName); + if (colValue && this.hasStartChar) { + this.colId = colValue.colId; + checkAndUpdateExpression(this.params, this.colName, colValue.columnName, endPosition - 1); + this.colName = colValue.columnName; + this.column = this.params.colModel.getColDefCol(this.colId); + if (this.column) { + this.baseCellDataType = this.params.dataTypeSvc?.getBaseDataType(this.column) ?? "text"; + return true; + } + } + if (fromComplete) { + this.valid = false; + } + this.baseCellDataType = "text"; + return false; + } +}; +var OperatorParser = class { + constructor(params, startPosition, baseCellDataType) { + this.params = params; + this.startPosition = startPosition; + this.baseCellDataType = baseCellDataType; + this.type = "operator"; + this.valid = true; + this.expectedNumOperands = 0; + this.operator = ""; + } + parse(char, position) { + if (char === " " || char === ")") { + const isMatch = this.parseOperator(false, position - 1); + if (isMatch) { + return true; + } else { + this.operator += char; + } + } else { + this.operator += char; + } + return void 0; + } + complete(position) { + this.parseOperator(true, position); + } + getValidationError() { + return this.valid ? null : { + message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidOption"), + startPosition: this.startPosition, + endPosition: this.endPosition ?? this.params.expression.length - 1 + }; + } + getDisplayValue() { + return this.operator; + } + getOperatorKey() { + return this.parsedOperator; + } + parseOperator(fromComplete, endPosition) { + const operatorForType = this.params.advFilterExpSvc.getDataTypeExpressionOperator(this.baseCellDataType); + const parsedOperator = operatorForType.findOperator(this.operator); + this.endPosition = endPosition; + if (parsedOperator) { + this.parsedOperator = parsedOperator; + const operator = operatorForType.operators[parsedOperator]; + this.expectedNumOperands = operator.numOperands; + const operatorDisplayValue = operator.displayValue; + checkAndUpdateExpression(this.params, this.operator, operatorDisplayValue, endPosition); + this.operator = operatorDisplayValue; + return true; + } + const isPartialMatch = parsedOperator === null; + if (fromComplete || !isPartialMatch) { + this.valid = false; + } + return false; + } +}; +var OperandParser = class { + constructor(params, startPosition, baseCellDataType, column) { + this.params = params; + this.startPosition = startPosition; + this.baseCellDataType = baseCellDataType; + this.column = column; + this.type = "operand"; + this.valid = true; + this.operand = ""; + this.validationMessage = null; + this.filterValidationSetters = { + number: () => { + if (this.quotes || isNaN(this.modelValue)) { + this.valid = false; + this.validationMessage = this.params.advFilterExpSvc.translate("advancedFilterValidationNotANumber"); + } + }, + bigint: () => { + if (this.quotes || _parseBigIntOrNull(this.modelValue) === null) { + this.valid = false; + this.validationMessage = this.params.advFilterExpSvc.translate("advancedFilterValidationNotABigInt"); + } + }, + date: (modelValue) => { + if (modelValue == null) { + this.valid = false; + this.validationMessage = this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidDate"); + } + }, + dateString: (...args) => this.filterValidationSetters.date(...args), + dateTime: (...args) => this.filterValidationSetters.date(...args), + dateTimeString: (...args) => this.filterValidationSetters.date(...args), + boolean() { + }, + object() { + }, + text() { + } + }; + } + parse(char, position) { + if (char === " ") { + if (this.quotes) { + this.operand += char; + } else { + this.parseOperand(false, position); + return true; + } + } else if (char === ")") { + if (this.baseCellDataType === "number" || !this.quotes) { + this.parseOperand(false, position - 1); + return true; + } else { + this.operand += char; + } + } else if (!this.operand && !this.quotes && (char === `'` || char === `"`)) { + this.quotes = char; + } else if (this.quotes && char === this.quotes) { + this.parseOperand(false, position); + return false; + } else { + this.operand += char; + } + return void 0; + } + complete(position) { + this.parseOperand(true, position); + } + getValidationError() { + return this.validationMessage ? { + message: this.validationMessage, + startPosition: this.startPosition, + endPosition: this.endPosition ?? this.params.expression.length - 1 + } : null; + } + getRawValue() { + return this.operand; + } + getModelValue() { + return this.modelValue; + } + parseOperand(fromComplete, position) { + const { advFilterExpSvc } = this.params; + this.endPosition = position; + this.modelValue = this.operand; + if (fromComplete && this.quotes) { + this.valid = false; + this.validationMessage = advFilterExpSvc.translate("advancedFilterValidationMissingQuote"); + } else if (this.modelValue === "") { + this.valid = false; + this.validationMessage = advFilterExpSvc.translate("advancedFilterValidationMissingValue"); + } else { + const modelValue = advFilterExpSvc.getOperandModelValue(this.operand, this.baseCellDataType, this.column); + if (modelValue != null) { + this.modelValue = modelValue; + } + this.filterValidationSetters[this.baseCellDataType](modelValue); + } + } +}; +var COL_FILTER_EXPRESSION_START_CHAR = "["; +var COL_FILTER_EXPRESSION_END_CHAR = "]"; +var ColFilterExpressionParser = class { + constructor(params, startPosition) { + this.params = params; + this.startPosition = startPosition; + this.isAwaiting = true; + this.operandValueGetters = { + number: Number, + bigint: (operand) => _parseBigIntOrNull(operand), + date: (operand) => this.params.valueSvc.parseValue(this.columnParser.column, null, operand, void 0), + dateString: (operand) => this.operandValueGetters.date(operand), + dateTime: (operand) => this.operandValueGetters.date(operand), + dateTimeString: (operand) => this.operandValueGetters.date(operand), + boolean: (operand) => operand, + object: (operand) => operand, + text: (operand) => operand + }; + } + parseExpression() { + let i = this.startPosition; + const { expression } = this.params; + while (i < expression.length) { + const char = expression[i]; + if (char === " " && this.isAwaiting) { + } else { + this.isAwaiting = false; + if (!this.parser) { + let parser; + if (!this.columnParser) { + this.columnParser = new ColumnParser(this.params, i); + parser = this.columnParser; + } else if (!this.operatorParser) { + this.operatorParser = new OperatorParser(this.params, i, this.columnParser.baseCellDataType); + parser = this.operatorParser; + } else { + this.operandParser = new OperandParser( + this.params, + i, + this.columnParser.baseCellDataType, + this.columnParser.column + ); + parser = this.operandParser; + } + this.parser = parser; + } + const hasCompletedOnPrevChar = this.parser.parse(char, i); + if (hasCompletedOnPrevChar != null) { + if (this.isComplete()) { + return this.returnEndPosition(hasCompletedOnPrevChar ? i - 1 : i, true); + } + this.parser = void 0; + this.isAwaiting = true; + } + } + i++; + } + this.parser?.complete?.(i - 1); + return this.returnEndPosition(i); + } + isValid() { + return this.isComplete() && this.columnParser.valid && this.operatorParser.valid && (!this.operandParser || this.operandParser.valid); + } + getValidationError() { + const validationError = this.columnParser?.getValidationError() ?? this.operatorParser?.getValidationError() ?? this.operandParser?.getValidationError(); + if (validationError) { + return validationError; + } + const endPosition = this.params.expression.length; + let translateKey; + if (!this.columnParser) { + translateKey = "advancedFilterValidationMissingColumn"; + } else if (!this.operatorParser) { + translateKey = "advancedFilterValidationMissingOption"; + } else if (this.operatorParser.expectedNumOperands && !this.operandParser) { + translateKey = "advancedFilterValidationMissingValue"; + } + if (translateKey) { + return { + message: this.params.advFilterExpSvc.translate(translateKey), + startPosition: endPosition, + endPosition + }; + } + return null; + } + getFunction(params) { + return this.getFunctionCommon(params, (operandIndex, operatorIndex, colId, evaluatorParamsIndex) => { + return (expressionProxy, node, p) => p.operators[operatorIndex].evaluator( + expressionProxy.getValue(colId, node), + node, + p.evaluatorParams[evaluatorParamsIndex], + operandIndex == null ? void 0 : p.operands[operandIndex] + ); + }); + } + getAutocompleteListParams(position) { + if (this.isColumnPosition(position)) { + return this.getColumnAutocompleteListParams(position); + } + if (this.isOperatorPosition(position)) { + return this.getOperatorAutocompleteListParams(position); + } + if (this.isBeyondEndPosition(position)) { + return void 0; + } + return { enabled: false }; + } + updateExpression(position, updateEntry, type) { + const { expression } = this.params; + if (this.isColumnPosition(position)) { + return updateExpression( + this.params.expression, + this.startPosition, + this.columnParser?.getColId() ? this.columnParser.endPosition : findEndPosition(expression, position).endPosition, + this.params.advFilterExpSvc.getColumnValue(updateEntry), + true + ); + } else if (this.isOperatorPosition(position)) { + const baseCellDataType = this.getBaseCellDataTypeFromOperatorAutocompleteType(type); + const hasOperand = this.hasOperand(baseCellDataType, updateEntry.key); + const doesOperandNeedQuotes = hasOperand && this.doesOperandNeedQuotes(baseCellDataType); + let update; + if (this.operatorParser?.startPosition != null && position < this.operatorParser.startPosition) { + update = updateExpression( + expression, + position, + position, + updateEntry.displayValue ?? updateEntry.key, + hasOperand, + doesOperandNeedQuotes + ); + } else { + let endPosition; + let empty = false; + if (this.operatorParser?.getOperatorKey()) { + endPosition = this.operatorParser.endPosition; + } else { + const { endPosition: calculatedEndPosition, isEmpty } = findEndPosition( + expression, + position, + true, + true + ); + endPosition = calculatedEndPosition; + empty = isEmpty; + } + update = updateExpression( + expression, + findStartPosition(expression, this.columnParser.endPosition + 1, endPosition), + endPosition, + updateEntry.displayValue ?? updateEntry.key, + hasOperand, + doesOperandNeedQuotes, + empty + ); + } + return { ...update, hideAutocomplete: !hasOperand }; + } + return null; + } + getModel() { + const colId = this.columnParser.getColId(); + const model = { + filterType: this.columnParser.baseCellDataType, + colId, + type: this.operatorParser.getOperatorKey() + }; + if (this.operatorParser.expectedNumOperands) { + model.filter = this.operandParser.getModelValue(); + } + return model; + } + getFunctionCommon(params, processFunc) { + const colId = this.columnParser.getColId(); + const operator = this.operatorParser?.getOperatorKey(); + const { operators, evaluatorParams, operands } = params; + const operatorForColumn = this.params.advFilterExpSvc.getExpressionOperator( + this.columnParser.baseCellDataType, + operator + ); + const operatorIndex = this.addToListAndGetIndex(operators, operatorForColumn); + const evaluatorParamsForColumn = this.params.advFilterExpSvc.getExpressionEvaluatorParams(colId); + const evaluatorParamsIndex = this.addToListAndGetIndex(evaluatorParams, evaluatorParamsForColumn); + const operandIndex = this.operatorParser?.expectedNumOperands === 0 ? void 0 : this.addToListAndGetIndex(operands, this.getOperandValue()); + return processFunc(operandIndex, operatorIndex, colId, evaluatorParamsIndex); + } + getOperandValue() { + const { baseCellDataType, column } = this.columnParser; + const operand = this.operandValueGetters[baseCellDataType](this.operandParser.getRawValue()); + if (baseCellDataType === "dateString" || baseCellDataType === "dateTimeString") { + return this.params.dataTypeSvc?.getDateParserFunction(column)(operand) ?? operand; + } + return operand; + } + isComplete() { + return !!(this.operatorParser && (!this.operatorParser.expectedNumOperands || this.operatorParser.expectedNumOperands && this.operandParser)); + } + isColumnPosition(position) { + return this.columnParser?.endPosition == null || position <= this.columnParser.endPosition + 1; + } + isOperatorPosition(position) { + return this.operatorParser?.endPosition == null || position <= this.operatorParser.endPosition + 1; + } + isBeyondEndPosition(position) { + return this.isComplete() && this.endPosition != null && position > this.endPosition + 1 && this.endPosition + 1 < this.params.expression.length; + } + returnEndPosition(returnPosition, treatAsEnd) { + this.endPosition = treatAsEnd ? returnPosition : returnPosition - 1; + return returnPosition; + } + getColumnAutocompleteListParams(position) { + return this.params.advFilterExpSvc.generateAutocompleteListParams( + this.params.advFilterExpSvc.getColumnAutocompleteEntries(), + "column", + this.getColumnSearchString(position) + ); + } + getColumnSearchString(position) { + const columnName = this.columnParser?.getDisplayValue() ?? ""; + const searchString = getSearchString( + columnName, + position, + this.columnParser?.endPosition == null ? this.params.expression.length : this.columnParser.endPosition + 1 + ); + const containsStartChar = this.columnParser?.hasStartChar && searchString.length > 0; + const containsEndChar = this.columnParser?.hasEndChar && searchString.length === columnName.length + 2; + if (containsStartChar) { + return searchString.slice(1, containsEndChar ? -1 : void 0); + } + return searchString; + } + getOperatorAutocompleteListParams(position) { + const column = this.columnParser?.column; + if (!column) { + return { enabled: false }; + } + const baseCellDataType = this.columnParser.baseCellDataType; + const searchString = this.operatorParser?.startPosition != null && position < this.operatorParser.startPosition ? "" : getSearchString( + this.operatorParser?.getDisplayValue() ?? "", + position, + this.operatorParser?.endPosition == null ? this.params.expression.length : this.operatorParser.endPosition + 1 + ); + return this.params.advFilterExpSvc.generateAutocompleteListParams( + this.params.advFilterExpSvc.getOperatorAutocompleteEntries(column, baseCellDataType), + `operator-${baseCellDataType}`, + searchString + ); + } + getBaseCellDataTypeFromOperatorAutocompleteType(type) { + return type?.replace("operator-", ""); + } + hasOperand(baseCellDataType, operator) { + return !baseCellDataType || !operator || (this.params.advFilterExpSvc.getExpressionOperator(baseCellDataType, operator)?.numOperands ?? 0) > 0; + } + doesOperandNeedQuotes(baseCellDataType) { + return baseCellDataType !== "number" && baseCellDataType !== "bigint"; + } + addToListAndGetIndex(list, value) { + const index = list.length; + list.push(value); + return index; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/filterExpressionOperators.ts +function findMatch(searchValue, values, getDisplayValue) { + let partialMatch = false; + const searchValueLowerCase = searchValue.toLocaleLowerCase(); + const partialSearchValue = searchValueLowerCase + " "; + const parsedValue = Object.keys(values).find((key) => { + const value = values[key]; + const displayValueLowerCase = getDisplayValue(value).toLocaleLowerCase(); + if (displayValueLowerCase.startsWith(partialSearchValue)) { + partialMatch = true; + } + return displayValueLowerCase === searchValueLowerCase; + }); + if (parsedValue) { + return parsedValue; + } else if (partialMatch) { + return null; + } else { + return void 0; + } +} +function getEntries(operators, activeOperatorKeys) { + const keys = activeOperatorKeys ?? Object.keys(operators); + return keys.map((key) => ({ + key, + displayValue: operators[key].displayValue + })); +} +var TextFilterExpressionOperators = class { + constructor(params) { + this.params = params; + this.initOperators(); + } + getEntries(activeOperators) { + return getEntries(this.operators, activeOperators); + } + findOperator(displayValue) { + return findMatch(displayValue, this.operators, ({ displayValue: displayValue2 }) => displayValue2); + } + initOperators() { + const { translate } = this.params; + this.operators = { + contains: { + displayValue: translate("advancedFilterContains"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, false, (v, o) => v.includes(o)), + numOperands: 1 + }, + notContains: { + displayValue: translate("advancedFilterNotContains"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, true, (v, o) => !v.includes(o)), + numOperands: 1 + }, + equals: { + displayValue: translate("advancedFilterTextEquals"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, false, (v, o) => v === o), + numOperands: 1 + }, + notEqual: { + displayValue: translate("advancedFilterTextNotEqual"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, true, (v, o) => v != o), + numOperands: 1 + }, + startsWith: { + displayValue: translate("advancedFilterStartsWith"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, false, (v, o) => v.startsWith(o)), + numOperands: 1 + }, + endsWith: { + displayValue: translate("advancedFilterEndsWith"), + evaluator: (value, node, params, operand1) => this.evaluateExpression(value, node, params, operand1, false, (v, o) => v.endsWith(o)), + numOperands: 1 + }, + blank: { + displayValue: translate("advancedFilterBlank"), + evaluator: (value) => value == null || typeof value === "string" && value.trim().length === 0, + numOperands: 0 + }, + notBlank: { + displayValue: translate("advancedFilterNotBlank"), + evaluator: (value) => value != null && (typeof value !== "string" || value.trim().length > 0), + numOperands: 0 + } + }; + } + evaluateExpression(value, node, params, operand, nullsMatch, expression) { + if (value == null) { + return nullsMatch; + } + return params.caseSensitive ? expression(params.valueConverter(value, node), operand) : expression(params.valueConverter(value, node).toLocaleLowerCase(), operand.toLocaleLowerCase()); + } +}; +var ScalarFilterExpressionOperators = class { + constructor(params) { + this.params = params; + this.initOperators(); + } + getEntries(activeOperators) { + return getEntries(this.operators, activeOperators); + } + findOperator(displayValue) { + return findMatch(displayValue, this.operators, ({ displayValue: displayValue2 }) => displayValue2); + } + initOperators() { + const { translate, equals } = this.params; + this.operators = { + equals: { + displayValue: translate("advancedFilterEquals"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInEquals, + equals + ), + numOperands: 1 + }, + notEqual: { + displayValue: translate("advancedFilterNotEqual"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInEquals, + (v, o) => !equals(v, o) + ), + numOperands: 1 + }, + greaterThan: { + displayValue: translate("advancedFilterGreaterThan"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInGreaterThan, + (v, o) => v > o + ), + numOperands: 1 + }, + greaterThanOrEqual: { + displayValue: translate("advancedFilterGreaterThanOrEqual"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInGreaterThan, + (v, o) => v >= o + ), + numOperands: 1 + }, + lessThan: { + displayValue: translate("advancedFilterLessThan"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInLessThan, + (v, o) => v < o + ), + numOperands: 1 + }, + lessThanOrEqual: { + displayValue: translate("advancedFilterLessThanOrEqual"), + evaluator: (value, node, params, operand1) => this.evaluateSingleOperandExpression( + value, + node, + params, + operand1, + !!params.includeBlanksInLessThan, + (v, o) => v <= o + ), + numOperands: 1 + }, + blank: { + displayValue: translate("advancedFilterBlank"), + evaluator: (value) => value == null, + numOperands: 0 + }, + notBlank: { + displayValue: translate("advancedFilterNotBlank"), + evaluator: (value) => value != null, + numOperands: 0 + } + }; + } + evaluateSingleOperandExpression(value, node, params, operand, nullsMatch, expression) { + if (value == null) { + return nullsMatch; + } + return expression(params.valueConverter(value, node), operand); + } +}; +var BooleanFilterExpressionOperators = class { + constructor(params) { + this.params = params; + this.initOperators(); + } + getEntries(activeOperators) { + return getEntries(this.operators, activeOperators); + } + findOperator(displayValue) { + return findMatch(displayValue, this.operators, ({ displayValue: displayValue2 }) => displayValue2); + } + initOperators() { + const { translate } = this.params; + this.operators = { + true: { + displayValue: translate("advancedFilterTrue"), + evaluator: (value) => !!value, + numOperands: 0 + }, + false: { + displayValue: translate("advancedFilterFalse"), + evaluator: (value) => value === false, + numOperands: 0 + }, + blank: { + displayValue: translate("advancedFilterBlank"), + evaluator: (value) => value == null, + numOperands: 0 + }, + notBlank: { + displayValue: translate("advancedFilterNotBlank"), + evaluator: (value) => value != null, + numOperands: 0 + } + }; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterExpressionService.ts +var AdvancedFilterExpressionService = class extends BeanStub2 { + constructor() { + super(...arguments); + this.beanName = "advFilterExpSvc"; + this.filterOperandGetters = { + number: (model) => _toStringOrNull(model.filter) ?? "", + bigint: (model) => _toStringOrNull(model.filter) ?? "", + date: (model) => { + const column = this.colModel.getColDefCol(model.colId); + if (!column) { + return null; + } + return this.valueSvc.formatValue( + column, + null, + _parseDateTimeFromString(_toStringOrNull(model.filter) ?? "") + ); + }, + dateTime: (model) => this.filterOperandGetters.date(model), + dateString: (model) => { + const column = this.colModel.getColDefCol(model.colId); + if (!column) { + return null; + } + const { filter } = model; + const dateFormatFn = this.dataTypeSvc?.getDateFormatterFunction(column); + const dateStringStringValue = dateFormatFn?.(_parseDateTimeFromString(_toStringOrNull(model.filter) ?? "") ?? void 0) ?? filter; + return this.valueSvc.formatValue(column, null, dateStringStringValue); + }, + dateTimeString: (model) => this.filterOperandGetters.dateString(model), + boolean: () => null, + object: () => null, + text: () => null + }; + this.operandModelValueGetters = { + number: (operand) => _exists3(operand) ? Number(operand) : null, + bigint: (operand) => operand, + date: (operand, column, baseCellDataType) => _serialiseDate( + this.valueSvc.parseValue(column, null, operand, void 0), + !!this.dataTypeSvc?.getDateIncludesTimeFlag(baseCellDataType) + ), + dateTime: (...args) => this.operandModelValueGetters.date(...args), + dateString: (operand, column, baseCellDataType) => { + const parsedDateString = this.valueSvc.parseValue(column, null, operand, void 0); + if (this.dataTypeSvc) { + return _serialiseDate( + this.dataTypeSvc.getDateParserFunction(column)(parsedDateString) ?? null, + this.dataTypeSvc.getDateIncludesTimeFlag(baseCellDataType) + ); + } + return parsedDateString; + }, + dateTimeString: (...args) => this.operandModelValueGetters.dateString(...args), + boolean: (operand) => operand, + object: (operand) => operand, + text: (operand) => operand + }; + this.columnNameToIdMap = {}; + this.columnAutocompleteEntries = null; + this.expressionEvaluatorParams = {}; + } + wireBeans(beans) { + this.valueSvc = beans.valueSvc; + this.colModel = beans.colModel; + this.colNames = beans.colNames; + this.dataTypeSvc = beans.dataTypeSvc; + } + postConstruct() { + this.expressionJoinOperators = this.generateExpressionJoinOperators(); + this.expressionOperators = this.generateExpressionOperators(); + } + parseJoinOperator(model) { + const { type } = model; + return this.expressionJoinOperators[type] ?? type; + } + getColumnDisplayValue(model) { + const { colId } = model; + const columnEntries = this.getColumnAutocompleteEntries(); + const columnEntry = columnEntries.find(({ key }) => key === colId); + let columnName; + if (columnEntry) { + columnName = columnEntry.displayValue; + this.columnNameToIdMap[columnName.toLocaleUpperCase()] = { colId, columnName }; + } else { + columnName = colId; + } + return columnName; + } + getOperatorDisplayValue(model) { + return this.getExpressionOperator(model.filterType, model.type)?.displayValue ?? model.type; + } + getOperandModelValue(operand, baseCellDataType, column) { + return this.operandModelValueGetters[baseCellDataType](operand, column, baseCellDataType); + } + getOperandDisplayValue(model, skipFormatting) { + const { filter, filterType } = model; + if (filter == null) { + return ""; + } + let operand1 = this.filterOperandGetters[filterType]( + model + ); + if (filterType !== "number" && filterType !== "bigint") { + operand1 ?? (operand1 = _toStringOrNull(filter) ?? ""); + if (!skipFormatting) { + operand1 = `"${operand1}"`; + } + } + return skipFormatting ? operand1 : ` ${operand1}`; + } + parseColumnFilterModel(model) { + const columnName = this.getColumnDisplayValue(model) ?? ""; + const operator = this.getOperatorDisplayValue(model) ?? ""; + const operands = this.getOperandDisplayValue(model); + return `[${columnName}] ${operator}${operands}`; + } + updateAutocompleteCache(updateEntry, type) { + if (type === "column") { + const { key: colId, displayValue } = updateEntry; + this.columnNameToIdMap[updateEntry.displayValue.toLocaleUpperCase()] = { + colId, + columnName: displayValue + }; + } + } + translate(key, variableValues) { + let defaultValue = ADVANCED_FILTER_LOCALE_TEXT[key]; + if (typeof defaultValue === "function") { + defaultValue = defaultValue(variableValues); + } + return this.getLocaleTextFunc()(key, defaultValue, variableValues); + } + generateAutocompleteListParams(entries, type, searchString) { + return { + enabled: true, + type, + searchString, + entries + }; + } + getColumnAutocompleteEntries() { + if (this.columnAutocompleteEntries) { + return this.columnAutocompleteEntries; + } + const columns = this.colModel.getColDefCols() ?? []; + const entries = []; + const includeHiddenColumns = this.gos.get("includeHiddenColumnsInAdvancedFilter"); + for (const column of columns) { + if (column.getColDef().filter && (includeHiddenColumns || column.isVisible() || column.isRowGroupActive())) { + entries.push({ + key: column.getColId(), + displayValue: this.colNames.getDisplayNameForColumn(column, "advancedFilter") + }); + } + } + entries.sort((a, b) => { + const aValue = a.displayValue ?? ""; + const bValue = b.displayValue ?? ""; + if (aValue < bValue) { + return -1; + } else if (bValue > aValue) { + return 1; + } + return 0; + }); + return entries; + } + getOperatorAutocompleteEntries(column, baseCellDataType) { + const activeOperators = this.getActiveOperators(column); + return this.getDataTypeExpressionOperator(baseCellDataType).getEntries(activeOperators); + } + getJoinOperatorAutocompleteEntries() { + return Object.entries(this.expressionJoinOperators).map(([key, displayValue]) => ({ key, displayValue })); + } + getDefaultAutocompleteListParams(searchString) { + return this.generateAutocompleteListParams(this.getColumnAutocompleteEntries(), "column", searchString); + } + getDataTypeExpressionOperator(baseCellDataType) { + return this.expressionOperators[baseCellDataType]; + } + getExpressionOperator(baseCellDataType, operator) { + return this.getDataTypeExpressionOperator(baseCellDataType)?.operators?.[operator]; + } + getExpressionJoinOperators() { + return this.expressionJoinOperators; + } + getColId(columnName) { + const upperCaseColumnName = columnName.toLocaleUpperCase(); + const cachedColId = this.columnNameToIdMap[upperCaseColumnName]; + if (cachedColId) { + return cachedColId; + } + const columnAutocompleteEntries = this.getColumnAutocompleteEntries(); + const colEntry = columnAutocompleteEntries.find( + ({ displayValue }) => displayValue.toLocaleUpperCase() === upperCaseColumnName + ); + if (colEntry) { + const { key: colId, displayValue } = colEntry; + const colValue = { colId, columnName: displayValue }; + this.columnNameToIdMap[upperCaseColumnName] = colValue; + return colValue; + } + return null; + } + getExpressionEvaluatorParams(colId) { + let params = this.expressionEvaluatorParams[colId]; + if (params) { + return params; + } + const column = this.colModel.getColDefCol(colId); + if (!column) { + return { valueConverter: (v) => v }; + } + const baseCellDataType = this.dataTypeSvc?.getBaseDataType(column); + switch (baseCellDataType) { + case "dateTimeString": + case "dateString": + params = { + valueConverter: this.dataTypeSvc?.getDateParserFunction(column) ?? ((v) => v) + }; + break; + case "object": + if (column.getColDef().filterValueGetter) { + params = { valueConverter: (v) => v }; + } else { + params = { + valueConverter: (value, node) => this.valueSvc.formatValue(column, node, value) ?? (typeof value.toString === "function" ? value.toString() : "") + }; + } + break; + case "text": + case void 0: + params = { valueConverter: (v) => _toStringOrNull(v) }; + break; + default: + params = { valueConverter: (v) => v }; + break; + } + const { filterParams } = column.getColDef(); + if (filterParams) { + ["caseSensitive", "includeBlanksInEquals", "includeBlanksInLessThan", "includeBlanksInGreaterThan"].forEach( + (param) => { + const paramValue = filterParams[param]; + if (paramValue) { + params[param] = paramValue; + } + } + ); + } + this.expressionEvaluatorParams[colId] = params; + return params; + } + getColumnDetails(colId) { + const column = this.colModel.getColDefCol(colId) ?? void 0; + const baseCellDataType = (column ? this.dataTypeSvc?.getBaseDataType(column) : void 0) ?? "text"; + return { column, baseCellDataType }; + } + generateExpressionOperators() { + const translate = (key, variableValues) => this.translate(key, variableValues); + const dateOperatorsParams = { + translate, + equals: (v, o) => v.getTime() === o.getTime() + }; + return { + text: new TextFilterExpressionOperators({ translate }), + boolean: new BooleanFilterExpressionOperators({ translate }), + object: new TextFilterExpressionOperators({ translate }), + number: new ScalarFilterExpressionOperators({ translate, equals: (v, o) => v === o }), + bigint: new ScalarFilterExpressionOperators({ translate, equals: (v, o) => v === o }), + date: new ScalarFilterExpressionOperators(dateOperatorsParams), + dateString: new ScalarFilterExpressionOperators(dateOperatorsParams), + dateTime: new ScalarFilterExpressionOperators(dateOperatorsParams), + dateTimeString: new ScalarFilterExpressionOperators(dateOperatorsParams) + }; + } + getColumnValue({ displayValue }) { + return `${COL_FILTER_EXPRESSION_START_CHAR}${displayValue}${COL_FILTER_EXPRESSION_END_CHAR}`; + } + generateExpressionJoinOperators() { + return { + AND: this.translate("advancedFilterAnd"), + OR: this.translate("advancedFilterOr") + }; + } + getActiveOperators(column) { + const filterOptions = column.getColDef().filterParams?.filterOptions; + if (!filterOptions) { + return void 0; + } + const isValid = filterOptions.every((filterOption) => typeof filterOption === "string"); + return isValid ? filterOptions : void 0; + } + resetColumnCaches() { + this.columnAutocompleteEntries = null; + this.columnNameToIdMap = {}; + this.expressionEvaluatorParams = {}; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterService.ts +import { BeanStub as BeanStub6, _exists as _exists11, _isClientSideRowModel, _isServerSideRowModel, _warn as _warn4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterCtrl.ts +import { BeanStub as BeanStub5, _getAbsoluteHeight, _getAbsoluteWidth, _removeFromParent as _removeFromParent4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/dialog.ts +import { _STOP_PROPAGATION_CALLBACKS, _focusNextGridCoreContainer } from "ag-grid-community"; +var DIALOG_CALLBACKS = { + stopPropagationCallbacks: _STOP_PROPAGATION_CALLBACKS, + focusNextContainer: (beans, backwards) => { + return _focusNextGridCoreContainer(beans, backwards); + }, + configureFocusableContainer: (beans, dialog) => { + const gridCtrl = beans.ctrlsSvc.get("gridCtrl"); + gridCtrl.addFocusableContainer(dialog); + dialog.addDestroyFunc(() => gridCtrl.removeFocusableContainer(dialog)); + } +}; +var Dialog = class extends AgDialog { + constructor(config) { + super(config, DIALOG_CALLBACKS); + } + getFocusableContainerName() { + return "dialog"; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterComp.ts +import { + AgFilterButtonSelector, + Component as Component4, + RefPlaceholder as RefPlaceholder11, + _createIconNoSpan, + _makeNull as _makeNull2, + _setDisabled, + _setDisplayed as _setDisplayed5 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocomplete.ts +import { + AgInputTextFieldSelector, + Component as Component3, + KeyCode as KeyCode9, + RefPlaceholder as RefPlaceholder10, + _isNothingFocused, + _makeNull +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocomplete.css +var agAutocomplete_default = ".ag-autocomplete{align-items:center;display:flex;width:100%;>:where(.ag-text-field){flex:1 1 auto}}.ag-autocomplete-list-popup{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-autocomplete-list{height:calc(var(--ag-row-height)*6.5);min-width:200px;position:relative;width:100%}.ag-autocomplete-virtual-list-item{cursor:default;display:flex;height:var(--ag-list-item-height);&:focus-visible:after{content:none}}.ag-autocomplete-virtual-list-item:hover{background-color:var(--ag-row-hover-color)}.ag-autocomplete-row{align-items:center;display:flex;flex:1 1 auto;overflow:hidden}.ag-autocomplete-row-label{margin:0 var(--ag-widget-container-horizontal-padding);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-autocomplete-row-selected{background-color:var(--ag-selected-row-background-color)}"; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocompleteList.ts +import { AgPopupComponent, KeyCode as KeyCode8, RefPlaceholder as RefPlaceholder9, _exists as _exists5, _fuzzySuggestions, _isVisible as _isVisible3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/virtualList.ts +import { _STOP_PROPAGATION_CALLBACKS as _STOP_PROPAGATION_CALLBACKS2 } from "ag-grid-community"; +var VirtualList = class extends AgVirtualList { + constructor(params) { + super(_STOP_PROPAGATION_CALLBACKS2, params); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocompleteRow.ts +import { Component as Component2, _clearElement as _clearElement2, _createElement as _createElement3, _exists as _exists4 } from "ag-grid-community"; +var AgAutocompleteRowElement = { + tag: "div", + cls: "ag-autocomplete-row", + role: "presentation", + children: [{ tag: "div", cls: "ag-autocomplete-row-label" }] +}; +var AgAutocompleteRow = class extends Component2 { + constructor() { + super(AgAutocompleteRowElement); + this.hasHighlighting = false; + } + setState(value, selected) { + this.value = value; + this.render(); + this.updateSelected(selected); + } + updateSelected(selected) { + this.toggleCss("ag-autocomplete-row-selected", selected); + } + setSearchString(searchString) { + let keepHighlighting = false; + const { value } = this; + if (value && _exists4(searchString)) { + const index = value.toLocaleLowerCase().indexOf(searchString.toLocaleLowerCase()); + if (index >= 0) { + keepHighlighting = true; + this.hasHighlighting = true; + const highlightEndIndex = index + searchString.length; + const child = this.getGui().lastElementChild; + _clearElement2(child); + child.append( + // Start part + value.slice(0, index), + // Highlighted part wrapped in bold tag + _createElement3({ tag: "b", children: value.slice(index, highlightEndIndex) }), + // End part + value.slice(highlightEndIndex) + ); + } + } + if (!keepHighlighting && this.hasHighlighting) { + this.hasHighlighting = false; + this.render(); + } + } + render() { + this.getGui().lastElementChild.textContent = this.value ?? "\xA0"; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocompleteList.ts +var AgAutocompleteListElement = { + tag: "div", + cls: "ag-autocomplete-list-popup", + children: [ + { + tag: "div", + ref: "eList", + cls: "ag-autocomplete-list" + } + ] +}; +var AgAutocompleteList = class extends AgPopupComponent { + constructor(params) { + super(AgAutocompleteListElement); + this.params = params; + this.eList = RefPlaceholder9; + this.searchString = ""; + this.lastAutoListHeight = null; + } + postConstruct() { + this.autocompleteEntries = this.params.autocompleteEntries; + this.virtualList = this.createManagedBean(new VirtualList({ cssIdentifier: "autocomplete" })); + this.virtualList.setComponentCreator(this.createRowComponent.bind(this)); + this.eList.appendChild(this.virtualList.getGui()); + this.virtualList.setModel({ + getRowCount: () => this.autocompleteEntries.length, + getRow: (index) => this.autocompleteEntries[index] + }); + const virtualListGui = this.virtualList.getGui(); + this.addManagedListeners(virtualListGui, { + click: () => this.params.onConfirmed(), + mousemove: this.onMouseMove.bind(this), + mousedown: (e) => e.preventDefault() + }); + this.setSelectedValue(0); + this.updateListHeight(); + } + onNavigationKeyDown(event, key) { + event.preventDefault(); + const oldIndex = this.autocompleteEntries.indexOf(this.selectedValue); + const newIndex = key === KeyCode8.UP ? oldIndex - 1 : oldIndex + 1; + this.checkSetSelectedValue(newIndex); + } + setSearch(searchString) { + this.searchString = searchString; + if (_exists5(searchString)) { + this.runSearch(); + } else { + this.autocompleteEntries = this.params.autocompleteEntries; + this.virtualList.refresh(); + this.checkSetSelectedValue(0); + this.updateListHeight(); + } + this.updateSearchInList(); + } + runContainsSearch(searchString, searchStrings) { + let topMatch; + let topMatchStartsWithSearchString = false; + const lowerCaseSearchString = searchString.toLocaleLowerCase(); + const allMatches = searchStrings.filter((string) => { + const lowerCaseString = string.toLocaleLowerCase(); + const index = lowerCaseString.indexOf(lowerCaseSearchString); + const startsWithSearchString = index === 0; + const isMatch = index >= 0; + if (isMatch && (!topMatch || !topMatchStartsWithSearchString && startsWithSearchString || topMatchStartsWithSearchString === startsWithSearchString && string.length < topMatch.length)) { + topMatch = string; + topMatchStartsWithSearchString = startsWithSearchString; + } + return isMatch; + }); + if (!topMatch && allMatches.length) { + topMatch = allMatches[0]; + } + return { topMatch, allMatches }; + } + runStartsWithSearch(searchString, searchStrings) { + const lowerCaseSearchString = searchString.toLocaleLowerCase(); + const allMatches = searchStrings.filter( + (string) => string.toLocaleLowerCase().startsWith(lowerCaseSearchString) + ); + const topMatch = allMatches[0]; + return { topMatch, allMatches }; + } + runSearch() { + const { autocompleteEntries, useFuzzySearch, useStartsWithSearch, forceLastSelection } = this.params; + const searchStrings = autocompleteEntries.map((v) => v.displayValue ?? v.key); + let matchingStrings; + let topSuggestion; + if (useFuzzySearch) { + matchingStrings = _fuzzySuggestions({ + inputValue: this.searchString, + allSuggestions: searchStrings, + hideIrrelevant: true + }).values; + topSuggestion = matchingStrings.length ? matchingStrings[0] : void 0; + } else { + const matches = useStartsWithSearch ? this.runStartsWithSearch(this.searchString, searchStrings) : this.runContainsSearch(this.searchString, searchStrings); + matchingStrings = matches.allMatches; + topSuggestion = matches.topMatch; + } + let filteredEntries = autocompleteEntries.filter( + ({ key, displayValue }) => matchingStrings.includes(displayValue ?? key) + ); + if (!filteredEntries.length && this.selectedValue && forceLastSelection?.(this.selectedValue, this.searchString)) { + filteredEntries = [this.selectedValue]; + } + this.autocompleteEntries = filteredEntries; + this.virtualList.refresh(); + this.updateListHeight(); + if (!topSuggestion) { + return; + } + const topSuggestionIndex = matchingStrings.indexOf(topSuggestion); + this.checkSetSelectedValue(topSuggestionIndex); + } + updateSearchInList() { + this.virtualList.forEachRenderedRow((row) => row.setSearchString(this.searchString)); + } + updateListHeight() { + if (!this.params.autoSizeList) { + return; + } + const rowCount = this.autocompleteEntries.length; + const rowHeight = this.virtualList.getRowHeight(); + const maxItems = this.params.maxVisibleItems ?? rowCount; + const visibleCount = Math.min(rowCount, maxItems); + let height = visibleCount * rowHeight; + if (rowCount === 0) { + height = rowHeight; + } + if (this.lastAutoListHeight === height) { + return; + } + this.lastAutoListHeight = height; + this.eList.style.height = `${height}px`; + if (_isVisible3(this.eList)) { + this.params.onListHeightChanged?.(); + } + } + checkSetSelectedValue(index) { + if (index >= 0 && index < this.autocompleteEntries.length) { + this.setSelectedValue(index); + } + } + setSelectedValue(index) { + const value = this.autocompleteEntries[index]; + if (this.selectedValue === value) { + return; + } + this.selectedValue = value; + this.virtualList.ensureIndexVisible(index); + this.virtualList.forEachRenderedRow((cmp, idx) => { + cmp.updateSelected(index === idx); + }); + } + createRowComponent(value) { + const row = new AgAutocompleteRow(); + this.createBean(row); + row.setState(value.displayValue ?? value.key, value === this.selectedValue); + return row; + } + onMouseMove(mouseEvent) { + const virtualList = this.virtualList; + const rect = virtualList.getGui().getBoundingClientRect(); + const scrollTop = virtualList.getScrollTop(); + const mouseY = mouseEvent.clientY - rect.top + scrollTop; + const row = Math.floor(mouseY / virtualList.getRowHeight()); + this.checkSetSelectedValue(row); + } + afterGuiAttached() { + this.virtualList.refresh(); + this.updateListHeight(); + } + getSelectedValue() { + if (!this.autocompleteEntries.length) { + return null; + } + return this.selectedValue ?? null; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/autocomplete/agAutocomplete.ts +var AgAutocompleteElement = { + tag: "div", + cls: "ag-autocomplete", + role: "presentation", + children: [ + { + tag: "ag-input-text-field", + ref: "eAutocompleteInput" + } + ] +}; +var AgAutocomplete = class extends Component3 { + constructor() { + super(AgAutocompleteElement, [AgInputTextFieldSelector]); + this.eAutocompleteInput = RefPlaceholder10; + this.isListOpen = false; + this.lastPosition = 0; + this.valid = true; + this.registerCSS(agAutocomplete_default); + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + } + postConstruct() { + this.eAutocompleteInput.onValueChange((value) => this.onValueChanged(value)); + this.eAutocompleteInput.getInputElement().setAttribute("autocomplete", "off"); + this.addGuiEventListener("keydown", this.onKeyDown.bind(this)); + this.addGuiEventListener("click", this.updatePositionAndList.bind(this)); + this.addDestroyFunc(() => { + this.destroyBean(this.autocompleteList); + }); + this.addGuiEventListener("focusout", () => this.onFocusOut()); + } + onValueChanged(value) { + const parsedValue = _makeNull(value); + this.updateValue(parsedValue); + this.updateAutocompleteList(parsedValue); + } + updateValue(value) { + this.updateLastPosition(); + this.dispatchLocalEvent({ + type: "eventValueChanged", + value + }); + this.validate(value); + } + updateAutocompleteList(value) { + const autocompleteListParams = this.listGenerator?.(value, this.lastPosition) ?? { enabled: false }; + if (!autocompleteListParams.type || autocompleteListParams.type !== this.autocompleteListParams?.type) { + if (this.isListOpen) { + this.closeList(); + } + } + const isListOpen = this.isListOpen; + this.autocompleteListParams = autocompleteListParams; + if (autocompleteListParams?.enabled) { + if (!isListOpen) { + this.openList(); + } + const { searchString } = autocompleteListParams; + this.autocompleteList.setSearch(searchString ?? ""); + } else if (isListOpen) { + this.closeList(); + } + } + onKeyDown(event) { + const key = event.key; + this.updateLastPosition(); + switch (key) { + case KeyCode9.ENTER: + this.onEnterKeyDown(event); + break; + case KeyCode9.TAB: + this.onTabKeyDown(event); + break; + case KeyCode9.DOWN: + case KeyCode9.UP: + this.onUpDownKeyDown(event, key); + break; + case KeyCode9.LEFT: + case KeyCode9.RIGHT: + case KeyCode9.PAGE_HOME: + case KeyCode9.PAGE_END: + setTimeout(() => { + this.updatePositionAndList(); + }); + break; + case KeyCode9.ESCAPE: + this.onEscapeKeyDown(event); + break; + case KeyCode9.SPACE: + if (event.ctrlKey && !this.isListOpen) { + event.preventDefault(); + this.forceOpenList(); + } + break; + } + } + confirmSelection() { + const selectedValue = this.autocompleteList?.getSelectedValue(); + if (selectedValue) { + this.closeList(); + this.dispatchLocalEvent({ + type: "eventOptionSelected", + value: this.getValue(), + position: this.lastPosition, + updateEntry: selectedValue, + autocompleteType: this.autocompleteListParams.type + }); + } + } + onTabKeyDown(event) { + if (this.isListOpen) { + event.preventDefault(); + event.stopPropagation(); + this.confirmSelection(); + } + } + onEnterKeyDown(event) { + event.preventDefault(); + if (this.isListOpen) { + this.confirmSelection(); + } else { + this.onCompleted(); + } + } + onUpDownKeyDown(event, key) { + event.preventDefault(); + if (!this.isListOpen) { + this.forceOpenList(); + } else { + this.autocompleteList?.onNavigationKeyDown(event, key); + } + } + onEscapeKeyDown(event) { + if (this.isListOpen) { + event.preventDefault(); + event.stopPropagation(); + this.closeList(); + this.setCaret(this.lastPosition, true); + } + } + onFocusOut() { + if (this.isListOpen) { + this.closeList(); + } + } + updatePositionAndList() { + this.updateLastPosition(); + this.updateAutocompleteList(this.eAutocompleteInput.getValue() ?? null); + } + setCaret(position, setFocus) { + if (setFocus || _isNothingFocused(this.beans)) { + this.eAutocompleteInput.getFocusableElement().focus(); + } + const eInput = this.eAutocompleteInput.getInputElement(); + eInput.setSelectionRange(position, position); + if (position === eInput.value.length) { + eInput.scrollLeft = eInput.scrollWidth; + } + } + forceOpenList() { + this.onValueChanged(this.eAutocompleteInput.getValue()); + } + updateLastPosition() { + this.lastPosition = this.eAutocompleteInput.getInputElement().selectionStart ?? 0; + } + validate(value) { + if (!this.validator) { + return; + } + const validationMessage = this.validationMessage = this.validator(value); + this.eAutocompleteInput.getInputElement().setCustomValidity(validationMessage ?? ""); + this.valid = !validationMessage; + this.dispatchLocalEvent({ + type: "eventValidChanged", + isValid: this.valid, + validationMessage + }); + } + openList() { + this.isListOpen = true; + this.autocompleteList = this.createBean( + new AgAutocompleteList({ + autocompleteEntries: this.autocompleteListParams.entries, + onConfirmed: () => this.confirmSelection(), + forceLastSelection: this.forceLastSelection + }) + ); + const ePopupGui = this.autocompleteList.getGui(); + const positionParams = { + ePopup: ePopupGui, + type: "autocomplete", + eventSource: this.getGui(), + position: "under", + alignSide: this.gos.get("enableRtl") ? "right" : "left", + keepWithinBounds: true + }; + const addPopupRes = this.popupSvc.addPopup({ + eChild: ePopupGui, + anchorToElement: this.getGui(), + positionCallback: () => this.popupSvc.positionPopupByComponent(positionParams), + ariaLabel: this.listAriaLabel + }); + this.hidePopup = addPopupRes.hideFunc; + this.autocompleteList.afterGuiAttached(); + } + closeList() { + this.isListOpen = false; + this.hidePopup(); + this.destroyBean(this.autocompleteList); + this.autocompleteList = null; + } + onCompleted() { + if (this.isListOpen) { + this.closeList(); + } + this.dispatchLocalEvent({ + type: "eventValueConfirmed", + value: this.getValue(), + isValid: this.isValid() + }); + } + getValue() { + return _makeNull(this.eAutocompleteInput.getValue()); + } + setInputPlaceholder(placeholder) { + this.eAutocompleteInput.setInputPlaceholder(placeholder); + return this; + } + setInputAriaLabel(label) { + this.eAutocompleteInput.setInputAriaLabel(label); + return this; + } + setListAriaLabel(label) { + this.listAriaLabel = label; + return this; + } + setListGenerator(listGenerator) { + this.listGenerator = listGenerator; + return this; + } + setValidator(validator) { + this.validator = validator; + return this; + } + isValid() { + return this.valid; + } + setValue(params) { + const { value, position, silent, updateListOnlyIfOpen, restoreFocus } = params; + this.eAutocompleteInput.setValue(value, true); + this.setCaret(position ?? this.lastPosition, restoreFocus); + if (!silent) { + this.updateValue(value); + } + if (!updateListOnlyIfOpen || this.isListOpen) { + this.updateAutocompleteList(value); + } + } + setForceLastSelection(forceLastSelection) { + this.forceLastSelection = forceLastSelection; + return this; + } + setInputDisabled(disabled) { + this.eAutocompleteInput.setDisabled(disabled); + return this; + } +}; +var AgAutocompleteSelector = { + selector: "AG-AUTOCOMPLETE", + component: AgAutocomplete +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterComp.ts +var DEFAULT_ADVANCED_FILTER_PARAMS = { + buttons: ["apply"], + suppressBuilderButton: false +}; +var ButtonLocaleMap = { + apply: "advancedFilterApply", + clear: "advancedFilterClear", + cancel: "advancedFilterCancel", + reset: "advancedFilterReset" +}; +var AdvancedFilterElement = { + tag: "div", + cls: "ag-advanced-filter", + role: "presentation", + attrs: { tabindex: "-1" }, + children: [ + { tag: "ag-autocomplete", ref: "eAutocomplete" }, + { + tag: "ag-filter-button", + ref: "eButtons", + cls: "ag-advanced-filter-buttons" + }, + { + tag: "button", + ref: "eBuilderFilterButton", + cls: "ag-button ag-advanced-filter-builder-button", + children: [ + { tag: "span", ref: "eBuilderFilterButtonIcon", attrs: { "aria-hidden": "true" } }, + { tag: "span", ref: "eBuilderFilterButtonLabel", cls: "ag-advanced-filter-builder-button-label" } + ] + } + ] +}; +var AdvancedFilterComp = class extends Component4 { + constructor() { + super(AdvancedFilterElement, [AgAutocompleteSelector, AgFilterButtonSelector]); + this.eAutocomplete = RefPlaceholder11; + this.eButtons = RefPlaceholder11; + this.eBuilderFilterButton = RefPlaceholder11; + this.eBuilderFilterButtonIcon = RefPlaceholder11; + this.eBuilderFilterButtonLabel = RefPlaceholder11; + this.expressionParser = null; + this.isApplyDisabled = true; + this.builderOpen = false; + } + wireBeans(beans) { + this.advFilterExpSvc = beans.advFilterExpSvc; + this.advancedFilter = beans.advancedFilter; + this.filterManager = beans.filterManager; + this.registry = beans.registry; + } + postConstruct() { + this.tooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.getGui(), + getTooltipShowDelayOverride: () => 1e3, + getLocation: () => "advancedFilter" + }) + ); + this.eAutocomplete.setListGenerator((_value, position) => this.generateAutocompleteListParams(position)).setValidator(() => this.validateValue()).setForceLastSelection( + (lastSelection, searchString) => this.forceLastSelection(lastSelection, searchString) + ).setInputAriaLabel(this.advFilterExpSvc.translate("ariaAdvancedFilterInput")).setListAriaLabel(this.advFilterExpSvc.translate("ariaLabelAdvancedFilterAutocomplete")); + this.refresh(); + this.addManagedListeners(this.eAutocomplete, { + eventValueChanged: ({ value }) => this.onValueChanged(value), + eventValueConfirmed: ({ isValid }) => this.onValueConfirmed(isValid), + eventOptionSelected: ({ position, updateEntry, autocompleteType }) => this.onOptionSelected(position, updateEntry, autocompleteType), + eventValidChanged: ({ isValid, validationMessage }) => this.onValidChanged(isValid, validationMessage) + }); + const { buttons, suppressBuilderButton } = { + ...DEFAULT_ADVANCED_FILTER_PARAMS, + ...this.gos.get("advancedFilterParams") + }; + this.setupButtons(buttons); + this.setupBuilderButton(suppressBuilderButton); + this.beans.gos.addManagedPropertyListener("advancedFilterParams", (event) => { + const currentValue = { ...DEFAULT_ADVANCED_FILTER_PARAMS, ...event.currentValue }; + const previousValue = { ...DEFAULT_ADVANCED_FILTER_PARAMS, ...event.previousValue }; + if (currentValue.buttons !== previousValue.buttons) { + const buttons2 = currentValue.buttons.map((type) => ({ + type, + label: this.advFilterExpSvc.translate(ButtonLocaleMap[type]) + })); + this.eButtons.updateButtons(buttons2); + } + if (currentValue.suppressBuilderButton !== previousValue.suppressBuilderButton) { + _setDisplayed5(this.eBuilderFilterButton, !currentValue.suppressBuilderButton); + } + }); + } + refresh() { + const expression = this.advancedFilter.getExpressionDisplayValue(); + this.eAutocomplete.setValue({ + value: expression ?? "", + position: expression?.length, + updateListOnlyIfOpen: true + }); + } + setInputDisabled(disabled) { + this.eAutocomplete.setInputDisabled(disabled); + this.eButtons.updateValidity( + !disabled && !this.isApplyDisabled && !this.advancedFilter.isCurrentExpressionApplied() + ); + } + setupButtons(actions) { + const buttons = actions.map((type) => ({ + type, + label: this.advFilterExpSvc.translate(ButtonLocaleMap[type]) + })); + const getListener = (action) => () => { + this.updateModel(action); + }; + this.eButtons.addManagedListeners(this.eButtons, { + apply: getListener("apply"), + clear: getListener("clear"), + reset: getListener("reset"), + cancel: getListener("cancel") + }); + this.eButtons.updateButtons(buttons); + } + updateModel(action) { + switch (action) { + case "apply": + this.onValueConfirmed(this.eAutocomplete.isValid()); + break; + case "reset": + this.advancedFilter.setModel(null); + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + break; + case "cancel": + this.advancedFilter.setModel(this.advancedFilter.getModel()); + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + break; + case "clear": + this.eAutocomplete.setValue({ + value: "", + restoreFocus: true + }); + break; + } + } + setupBuilderButton(suppressed) { + this.eBuilderFilterButtonIcon.appendChild(_createIconNoSpan("advancedFilterBuilder", this.beans)); + this.eBuilderFilterButtonLabel.textContent = this.advFilterExpSvc.translate("advancedFilterBuilder"); + this.activateTabIndex([this.eBuilderFilterButton]); + this.addManagedElementListeners(this.eBuilderFilterButton, { click: () => this.openBuilder() }); + this.addManagedListeners(this.advancedFilter.getCtrl(), { + advancedFilterBuilderClosed: () => this.closeBuilder() + }); + _setDisplayed5(this.eBuilderFilterButton, !suppressed); + } + onValueChanged(value) { + value = _makeNull2(value); + this.advancedFilter.setExpressionDisplayValue(value); + this.expressionParser = this.advancedFilter.createExpressionParser(value); + const updatedExpression = this.expressionParser?.parseExpression(); + if (updatedExpression && updatedExpression !== value) { + this.eAutocomplete.setValue({ value: updatedExpression, silent: true, restoreFocus: true }); + } + } + onValueConfirmed(isValid) { + if (!isValid || this.isApplyDisabled) { + return; + } + this.eButtons?.updateValidity(false); + this.advancedFilter.applyExpression(); + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + } + onOptionSelected(position, updateEntry, type) { + const { updatedValue, updatedPosition, hideAutocomplete } = this.updateExpression(position, updateEntry, type); + this.eAutocomplete.setValue({ + value: updatedValue, + position: updatedPosition, + updateListOnlyIfOpen: hideAutocomplete, + restoreFocus: true + }); + } + validateValue() { + return this.expressionParser?.isValid() ? null : this.expressionParser?.getValidationMessage() ?? null; + } + onValidChanged(isValid, validationMessage) { + this.isApplyDisabled = !isValid || this.advancedFilter.isCurrentExpressionApplied(); + this.eButtons.updateValidity(!this.isApplyDisabled); + this.tooltipFeature?.setTooltipAndRefresh(validationMessage); + } + generateAutocompleteListParams(position) { + return this.expressionParser ? this.expressionParser.getAutocompleteListParams(position) : this.advFilterExpSvc.getDefaultAutocompleteListParams(""); + } + updateExpression(position, updateEntry, type) { + this.advFilterExpSvc.updateAutocompleteCache(updateEntry, type); + return this.expressionParser?.updateExpression(position, updateEntry, type) ?? this.advancedFilter.getDefaultExpression(updateEntry); + } + forceLastSelection({ key, displayValue }, searchString) { + return !!searchString.toLocaleLowerCase().match(`^${(displayValue ?? key).toLocaleLowerCase()}\\s*$`); + } + openBuilder() { + if (this.builderOpen) { + return; + } + this.builderOpen = true; + _setDisabled(this.eBuilderFilterButton, true); + this.advancedFilter.getCtrl().toggleFilterBuilder({ source: "ui", eventSource: this.eBuilderFilterButton }); + } + closeBuilder() { + if (!this.builderOpen) { + return; + } + this.builderOpen = false; + _setDisabled(this.eBuilderFilterButton, false); + this.eBuilderFilterButton.focus(); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterHeaderComp.ts +import { + Component as Component5, + KeyCode as KeyCode10, + _clearElement as _clearElement3, + _findNextFocusableElement as _findNextFocusableElement3, + _focusInto as _focusInto3, + _getActiveDomElement as _getActiveDomElement3, + _getFloatingFiltersHeight, + _setAriaColIndex, + _setAriaColSpan, + _setAriaRole as _setAriaRole5, + _setAriaRowIndex, + _setDisplayed as _setDisplayed6 +} from "ag-grid-community"; +var AdvancedFilterHeaderElement = { + tag: "div", + cls: "ag-advanced-filter-header", + role: "row" +}; +var AdvancedFilterHeaderComp = class extends Component5 { + constructor(enabled) { + super(AdvancedFilterHeaderElement); + this.enabled = enabled; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.focusSvc = beans.focusSvc; + this.ctrlsSvc = beans.ctrlsSvc; + } + postConstruct() { + this.setupAdvancedFilter(this.enabled); + this.addDestroyFunc(() => this.destroyBean(this.eAdvancedFilter)); + const heightListener = () => { + if (this.enabled) { + this.setEnabledHeight(); + } + }; + this.addManagedEventListeners({ + gridColumnsChanged: () => this.onGridColumnsChanged(), + columnHeaderHeightChanged: heightListener, + stylesChanged: heightListener + }); + this.addManagedPropertyListener("headerHeight", heightListener); + this.addManagedPropertyListener("floatingFiltersHeight", heightListener); + this.addGuiEventListener("keydown", (event) => this.onKeyDown(event)); + this.addGuiEventListener("focusout", (event) => { + if (!this.getFocusableElement().contains(event.relatedTarget)) { + this.focusSvc.clearAdvancedFilterColumn(); + } + }); + } + getFocusableElement() { + return this.eAdvancedFilter?.getGui() ?? this.getGui(); + } + setEnabled(enabled) { + if (enabled === this.enabled) { + return; + } + this.setupAdvancedFilter(enabled); + } + refresh() { + this.eAdvancedFilter?.refresh(); + } + getHeight() { + return this.height; + } + setInputDisabled(disabled) { + this.eAdvancedFilter?.setInputDisabled(disabled); + } + setupAdvancedFilter(enabled) { + const eGui = this.getGui(); + if (enabled) { + this.eAdvancedFilter = this.createBean(new AdvancedFilterComp()); + const eAdvancedFilterGui = this.eAdvancedFilter.getGui(); + this.eAdvancedFilter.addCss("ag-advanced-filter-header-cell"); + this.setEnabledHeight(); + this.setAriaRowIndex(); + _setAriaRole5(eAdvancedFilterGui, "gridcell"); + _setAriaColIndex(eAdvancedFilterGui, 1); + this.setAriaColumnCount(eAdvancedFilterGui); + eGui.appendChild(eAdvancedFilterGui); + } else { + _clearElement3(eGui); + this.destroyBean(this.eAdvancedFilter); + this.height = 0; + } + _setDisplayed6(eGui, enabled); + this.enabled = enabled; + } + setEnabledHeight() { + const eGui = this.getGui(); + this.height = _getFloatingFiltersHeight(this.beans); + const height = `${this.height}px`; + eGui.style.height = height; + eGui.style.minHeight = height; + } + setAriaColumnCount(eAdvancedFilterGui) { + _setAriaColSpan(eAdvancedFilterGui, this.colModel.getCols().length); + } + setAriaRowIndex() { + _setAriaRowIndex(this.getGui(), this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount() ?? 0); + } + onGridColumnsChanged() { + if (!this.eAdvancedFilter) { + return; + } + this.setAriaColumnCount(this.eAdvancedFilter.getGui()); + this.setAriaRowIndex(); + } + onKeyDown(event) { + switch (event.key) { + case KeyCode10.ENTER: { + if (this.hasFocus()) { + if (_focusInto3(this.getFocusableElement())) { + event.preventDefault(); + } + } + break; + } + case KeyCode10.ESCAPE: + if (!this.hasFocus()) { + this.getFocusableElement().focus(); + } + break; + case KeyCode10.UP: + this.navigateUpDown(true, event); + break; + case KeyCode10.DOWN: + this.navigateUpDown(false, event); + break; + case KeyCode10.TAB: + if (this.hasFocus()) { + this.navigateLeftRight(event); + } else { + const nextFocusableEl = _findNextFocusableElement3( + this.beans, + this.getFocusableElement(), + null, + event.shiftKey + ); + if (nextFocusableEl) { + event.preventDefault(); + nextFocusableEl.focus(); + } else { + this.navigateLeftRight(event); + } + } + break; + } + } + navigateUpDown(backwards, event) { + if (this.hasFocus()) { + if (this.focusSvc.focusNextFromAdvancedFilter(backwards)) { + event.preventDefault(); + } + } + } + navigateLeftRight(event) { + if (event.shiftKey ? this.focusSvc.focusLastHeader() : this.focusSvc.focusNextFromAdvancedFilter(false, true)) { + event.preventDefault(); + } + } + hasFocus() { + return _getActiveDomElement3(this.beans) === this.getFocusableElement(); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderComp.ts +import { Component as Component13, FilterButtonComp, RefPlaceholder as RefPlaceholder17, _exists as _exists10, _removeFromParent as _removeFromParent3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderDragFeature.ts +import { BeanStub as BeanStub3, DragSourceType } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/features/virtualListDragFeature.ts +var VirtualListDragFeature = class extends AgVirtualListDragFeature { +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderDragFeature.ts +var AdvancedFilterBuilderDragFeature = class extends BeanStub3 { + constructor(comp, virtualList) { + super(); + this.comp = comp; + this.virtualList = virtualList; + } + postConstruct() { + this.createManagedBean( + new VirtualListDragFeature(this.comp, this.virtualList, { + dragSourceType: DragSourceType.AdvancedFilterBuilder, + addListeners: (parent, listItemDragStart, listItemDragEnd) => { + parent.addManagedListeners(this, { + advancedFilterBuilderDragStarted: listItemDragStart, + advancedFilterBuilderDragEnded: listItemDragEnd + }); + }, + getCurrentDragValue: (listItemDragStartEvent) => this.getCurrentDragValue(listItemDragStartEvent), + isMoveBlocked: () => false, + getNumRows: (comp) => comp.getNumItems(), + moveItem: (currentDragValue, lastHoveredListItem) => this.moveItem(currentDragValue, lastHoveredListItem) + }) + ); + } + getCurrentDragValue(listItemDragStartEvent) { + return listItemDragStartEvent.item; + } + moveItem(currentDragValue, lastHoveredListItem) { + this.comp.moveItem(currentDragValue, lastHoveredListItem); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderItemAddComp.ts +import { Component as Component9, RefPlaceholder as RefPlaceholder14, _setAriaLabel as _setAriaLabel5, _setAriaLevel } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/addDropdownComp.ts +import { + AgInputTextFieldSelector as AgInputTextFieldSelector3, + _setAriaLabel as _setAriaLabel4, + _setAriaLabelledBy, + _setDisplayed as _setDisplayed8, + _stopPropagationForAgGrid as _stopPropagationForAgGrid2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/agRichSelect.ts +import { + AgInputTextFieldSelector as AgInputTextFieldSelector2, + AgPickerField as AgPickerField2, + KeyCode as KeyCode13, + RefPlaceholder as RefPlaceholder13, + _addGridCommonParams as _addGridCommonParams4, + _addOrRemoveAttribute as _addOrRemoveAttribute2, + _clearElement as _clearElement6, + _createIconNoSpan as _createIconNoSpan3, + _debounce, + _exists as _exists7, + _fuzzySuggestions as _fuzzySuggestions2, + _getActiveDomElement as _getActiveDomElement5, + _getEditorRendererDetails as _getEditorRendererDetails2, + _isElementOverflowingCallback as _isElementOverflowingCallback2, + _isEventFromPrintableCharacter, + _isVisible as _isVisible4, + _setAriaActiveDescendant as _setAriaActiveDescendant2, + _setScrollLeft, + _stopPropagationForAgGrid +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/richSelect/richSelectAsyncRequestsFeature.ts +import { _consoleError } from "ag-grid-community"; +var DEFAULT_VALUES_PAGE_SIZE = 100; +function createRichSelectAsyncRequestBindings(params) { + const { host, source, useAsyncSearch, onMisconfiguredSearchSource, onFirstValuesPageLoaded } = params; + const controller = new RichSelectAsyncRequestsFeature({ + host, + source, + onMisconfiguredSearchSource, + onFirstValuesPageLoaded: onFirstValuesPageLoaded ?? (() => { + }) + }); + const hasPagedSource = typeof source.loadValuesPage === "function"; + return { + controller, + hasPagedSource, + onSearch: useAsyncSearch ? (searchString) => controller.onSearch(searchString) : void 0, + onLoadMoreRows: hasPagedSource ? (direction) => controller.loadValuesPage(direction ?? "down") : void 0 + }; +} +var RichSelectAsyncRequestsFeature = class { + constructor(ctrlParams) { + this.ctrlParams = ctrlParams; + this.currentSearchRequest = 0; + this.currentValuesPageRequest = 0; + this.valuesPageLoading = false; + this.valuesPageHasMoreNext = false; + this.valuesPageHasMorePrev = false; + this.valuesPageLoadedValues = []; + this.valuesPageSearch = ""; + this.valuesPageWindowStartRow = 0; + this.destroyed = false; + } + destroy() { + this.destroyed = true; + this.currentSearchRequest++; + this.currentValuesPageRequest++; + } + onSearch(searchString) { + if (this.destroyed) { + return; + } + if (this.isValuesPaged()) { + this.resetValuesPage(searchString); + return; + } + const currentRequest = ++this.currentSearchRequest; + const { host, source, onMisconfiguredSearchSource } = this.ctrlParams; + host.setValueList({ refresh: true, valueList: void 0 }); + if (!searchString) { + return; + } + if (typeof source.searchValues !== "function") { + onMisconfiguredSearchSource?.(); + return; + } + let valuesPromise; + try { + valuesPromise = source.searchValues(searchString); + } catch (error) { + _consoleError("Rich Select", error); + if (currentRequest === this.currentSearchRequest) { + host.setValueList({ refresh: true, valueList: [] }); + } + return; + } + if (Array.isArray(valuesPromise)) { + onMisconfiguredSearchSource?.(); + host.setValueList({ refresh: true, valueList: valuesPromise }); + return; + } + host.setValueList({ + valueList: valuesPromise.then((results) => { + if (currentRequest === this.currentSearchRequest) { + return results; + } + }).catch((error) => { + _consoleError("Rich Select", error); + if (currentRequest === this.currentSearchRequest) { + return []; + } + }), + refresh: true + }); + } + resetValuesPage(searchString) { + if (this.destroyed) { + return; + } + this.valuesPageSearch = searchString; + this.valuesPageLoadedValues = []; + this.valuesPageWindowStartRow = this.resolveValuesPageStartRow(searchString); + this.valuesPageNextCursor = void 0; + this.valuesPageHasMoreNext = true; + this.valuesPageHasMorePrev = this.valuesPageWindowStartRow > 0; + this.valuesPageLoading = false; + this.currentValuesPageRequest++; + this.ctrlParams.host.setValueList({ valueList: void 0, refresh: true, isInitial: true }); + this.loadValuesPage("down"); + } + loadValuesPage(direction) { + if (this.destroyed) { + return; + } + const valuesPage = this.ctrlParams.source.loadValuesPage; + if (typeof valuesPage !== "function" || this.valuesPageLoading) { + return; + } + if (direction === "up" && !this.valuesPageHasMorePrev || direction === "down" && !this.valuesPageHasMoreNext) { + return; + } + const pageSize = Math.max(this.ctrlParams.source.valuesPageSize ?? DEFAULT_VALUES_PAGE_SIZE, 1); + const startRow = direction === "up" ? Math.max(this.valuesPageWindowStartRow - pageSize, 0) : this.valuesPageWindowStartRow + this.valuesPageLoadedValues.length; + const endRow = direction === "up" ? this.valuesPageWindowStartRow : startRow + pageSize; + if (startRow >= endRow) { + if (direction === "up") { + this.valuesPageHasMorePrev = false; + } else { + this.valuesPageHasMoreNext = false; + } + return; + } + const requestVersion = this.currentValuesPageRequest; + const requestParams = { + search: this.valuesPageSearch, + startRow, + endRow, + cursor: direction === "down" ? this.valuesPageNextCursor : void 0 + }; + this.valuesPageLoading = true; + if (this.valuesPageLoadedValues.length === 0) { + this.ctrlParams.host.setIsLoading(); + } + let pageResultOrPromise; + try { + pageResultOrPromise = valuesPage(requestParams); + } catch (error) { + this.handleValuesPageError(error, requestVersion); + return; + } + Promise.resolve(pageResultOrPromise).then( + (pageResult) => this.applyValuesPageResult(pageResult, pageSize, requestVersion, direction, startRow, endRow) + ).catch((error) => this.handleValuesPageError(error, requestVersion)); + } + applyValuesPageResult(pageResult, pageSize, requestVersion, direction, requestStartRow, requestEndRow) { + if (this.destroyed || requestVersion !== this.currentValuesPageRequest) { + return; + } + this.valuesPageLoading = false; + const isFirstLoadedPage = this.valuesPageLoadedValues.length === 0; + const values = pageResult?.values ?? []; + if (direction === "up") { + if (values.length) { + this.valuesPageLoadedValues = [...values, ...this.valuesPageLoadedValues]; + this.valuesPageWindowStartRow = requestStartRow; + } + const expectedCount = requestEndRow - requestStartRow; + this.valuesPageHasMorePrev = requestStartRow > 0 && values.length >= expectedCount; + } else { + if (values.length) { + this.valuesPageLoadedValues = [...this.valuesPageLoadedValues, ...values]; + } + this.valuesPageNextCursor = pageResult?.cursor; + const loadedRowCount = this.valuesPageLoadedValues.length; + if (typeof pageResult?.lastRow === "number") { + this.valuesPageHasMoreNext = this.valuesPageWindowStartRow + loadedRowCount < pageResult.lastRow; + } else if (pageResult?.cursor !== void 0) { + this.valuesPageHasMoreNext = !!pageResult.cursor; + } else { + this.valuesPageHasMoreNext = values.length >= pageSize; + } + } + this.ctrlParams.host.setValueList({ + valueList: this.valuesPageLoadedValues, + refresh: true, + isInitial: true, + scrollToCurrentValue: isFirstLoadedPage, + prependedRowCount: direction === "up" ? values.length : void 0 + }); + if (isFirstLoadedPage) { + this.ctrlParams.onFirstValuesPageLoaded(); + } + } + handleValuesPageError(error, requestVersion) { + _consoleError("Rich Select", error); + if (this.destroyed || requestVersion !== this.currentValuesPageRequest) { + return; + } + this.valuesPageLoading = false; + this.valuesPageHasMoreNext = false; + this.valuesPageHasMorePrev = false; + this.ctrlParams.host.setValueList({ valueList: this.valuesPageLoadedValues, refresh: true, isInitial: true }); + } + resolveValuesPageStartRow(searchString) { + if (searchString) { + return 0; + } + const startRow = this.ctrlParams.source.valuesPageInitialStartRow?.(searchString); + return Math.max(Math.floor(startRow ?? 0), 0); + } + isValuesPaged() { + return typeof this.ctrlParams.source.loadValuesPage === "function"; + } +}; + +// packages/ag-grid-enterprise/src/widgets/AgPillContainer.ts +import { + Component as Component7, + KeyCode as KeyCode11, + _clearElement as _clearElement4, + _findFocusableElements as _findFocusableElements2, + _findNextFocusableElement as _findNextFocusableElement4, + _getActiveDomElement as _getActiveDomElement4, + _getDocument as _getDocument3, + _setAriaPosInSet as _setAriaPosInSet2, + _setAriaRole as _setAriaRole6, + _setAriaSetSize as _setAriaSetSize2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/agPill.ts +import { Component as Component6, RefPlaceholder as RefPlaceholder12 } from "ag-grid-community"; +var AgPillElement = { + tag: "div", + cls: "ag-pill", + role: "option", + children: [ + { + tag: "span", + ref: "eText", + cls: "ag-pill-text" + }, + { + tag: "span", + ref: "eButton", + cls: "ag-button ag-pill-button", + role: "presentation" + } + ] +}; +var AgPill = class extends Component6 { + constructor(config) { + super(AgPillElement); + this.config = config; + this.eText = RefPlaceholder12; + this.eButton = RefPlaceholder12; + } + postConstruct() { + const { config, eButton } = this; + const { onKeyDown, onButtonClick } = config; + this.getGui().setAttribute("tabindex", String(this.gos.get("tabIndex"))); + this.addGuiEventListener("focus", () => { + this.eButton.focus(); + }); + if (onKeyDown) { + this.addGuiEventListener("keydown", onKeyDown); + } + if (onButtonClick) { + this.addManagedElementListeners(eButton, { + click: onButtonClick + }); + } + } + toggleCloseButtonClass(className, force) { + this.eButton.classList.toggle(className, force); + } + setText(text) { + this.eText.textContent = text; + } + getText() { + return this.eText.textContent; + } +}; + +// packages/ag-grid-enterprise/src/widgets/AgPillContainer.ts +var AgPillContainerElement = { + tag: "div", + cls: "ag-pill-container" +}; +var AgPillContainer = class extends Component7 { + constructor() { + super(AgPillContainerElement); + this.pills = []; + } + init(params) { + this.params = params; + this.getKey = params.valueFormatter ?? ((v) => String(v)); + this.refresh(); + } + refresh() { + this.clearPills(); + const { params, onPillKeyDown, getKey } = this; + let values = params.getValue(); + if (!Array.isArray(values)) { + if (values == null) { + return; + } + values = [values]; + } + const valueFormatter = params.valueFormatter ?? ((v) => String(v)); + const len = values.length; + _setAriaRole6(this.getGui(), len === 0 ? "presentation" : "listbox"); + for (let i = 0; i < len; i++) { + const value = values[i]; + const pill = this.createBean( + new AgPill({ + onButtonClick: () => this.onPillButtonClick(pill), + onKeyDown: onPillKeyDown.bind(this) + }) + ); + const pillGui = pill.getGui(); + _setAriaPosInSet2(pillGui, i + 1); + _setAriaSetSize2(pillGui, len); + if (params.onPillMouseDown) { + pill.addGuiEventListener("mousedown", params.onPillMouseDown); + } + if (params.announceItemFocus) { + pill.addGuiEventListener("focus", params.announceItemFocus); + } + pill.setText(valueFormatter(value) ?? ""); + pill.toggleCloseButtonClass("ag-icon-cancel", true); + this.appendChild(pillGui); + this.pills.push({ key: getKey(value) ?? i.toString(), pill }); + } + } + onNavigationKeyDown(e) { + const { key } = e; + const isRtl = this.gos.get("enableRtl"); + const isPrevious = !isRtl && key === KeyCode11.LEFT || isRtl && key === KeyCode11.RIGHT; + const isNext = !isRtl && key === KeyCode11.RIGHT || isRtl && key === KeyCode11.LEFT; + if (!this.pills.length || !isPrevious && !isNext) { + return; + } + e.preventDefault(); + const { beans, params } = this; + const activeEl = _getActiveDomElement4(beans); + const eGui = this.getGui(); + const focusableElements = _findFocusableElements2(eGui); + if (eGui.contains(activeEl)) { + const activePill = focusableElements.find((el) => el.contains(activeEl)); + if (activePill && activePill !== activeEl) { + activePill.focus(); + } + const nextFocusableEl = _findNextFocusableElement4(beans, eGui, false, isPrevious); + if (nextFocusableEl) { + nextFocusableEl.focus(); + } else if (isNext) { + params.focusAfterForwardBoundary?.(); + } + } else if (focusableElements.length > 0) { + focusableElements[isNext ? 0 : focusableElements.length - 1].focus(); + } + } + clearPills() { + const eGui = this.getGui(); + if (eGui.contains(_getActiveDomElement4(this.beans)) && this.params.eWrapper) { + this.params.eWrapper.focus(); + } + _clearElement4(eGui); + this.destroyBeans(this.pills.map(({ pill }) => pill)); + this.pills = []; + } + onPillButtonClick(pill) { + this.deletePill(pill); + } + onPillKeyDown(e) { + const key = e.key; + if (key === KeyCode11.LEFT || key === KeyCode11.RIGHT) { + e.stopPropagation(); + if (this.params.onHorizontalArrowKeyDown) { + this.params.onHorizontalArrowKeyDown(e); + } else { + this.onNavigationKeyDown(e); + } + return; + } + if (key !== KeyCode11.DELETE && key !== KeyCode11.BACKSPACE) { + return; + } + e.preventDefault(); + const eDoc = _getDocument3(this.beans); + const pillIndex = this.pills.findIndex(({ pill }) => pill.getGui().contains(eDoc.activeElement)); + if (pillIndex === -1) { + return; + } + const pillObj = this.pills[pillIndex]; + if (pillObj?.pill) { + this.deletePill(pillObj.pill, pillIndex); + } + } + deletePill(p, restoreFocusToIndex) { + const { getKey, pills, params } = this; + const pillKey = (pills[restoreFocusToIndex ?? -1] ?? pills.find(({ pill }) => pill === p))?.key; + const values = (params.getValue() || []).filter((val) => getKey(val) !== pillKey); + params.setValue(values); + if (!values.length) { + if (params.focusAfterDelete) { + params.focusAfterDelete(); + } else { + params.eWrapper?.focus(); + } + } else if (restoreFocusToIndex != null) { + const { pill } = pills[Math.min(restoreFocusToIndex, pills.length - 1)]; + if (pill) { + pill.getFocusableElement().focus(); + } + } + } + destroy() { + this.clearPills(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/widgets/agRichSelect.css +var agRichSelect_default = ".ag-rich-select{cursor:default;height:100%}.ag-rich-select-value{align-items:center;background-color:var(--ag-picker-button-background-color);display:flex;height:100%;padding:var(--ag-spacing);:where(.ag-picker-field-display){overflow:hidden;text-overflow:ellipsis;&:where(.ag-display-as-placeholder){opacity:.5}}}.ag-virtual-list-viewport.ag-rich-select-list{background-color:var(--ag-picker-list-background-color);border:var(--ag-picker-list-border);border-radius:var(--ag-input-border-radius);box-shadow:var(--ag-dropdown-shadow);height:auto;position:relative;width:100%;:where(.ag-rich-select-loading){display:flex;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);:where(.ag-loading-text){overflow:hidden;text-overflow:ellipsis}}}.ag-rich-select-row{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;padding:0 var(--ag-spacing);white-space:nowrap}.ag-rich-select-row-selected{background-color:var(--ag-selected-row-background-color)}.ag-rich-select-row-highlighted,.ag-rich-select-row:hover{background-image:linear-gradient(var(--ag-row-hover-color),var(--ag-row-hover-color))}.ag-rich-select-row-text-highlight{font-weight:700}.ag-rich-select-field-input{flex:1 1 auto;:where(.ag-input-field-input){border:none!important;box-shadow:none!important;padding:0!important;text-overflow:ellipsis;&::-moz-placeholder{opacity:.8}&::placeholder{opacity:.8}}}:where(.ag-ltr) .ag-rich-select-field-input{left:var(--ag-spacing)}:where(.ag-rtl) .ag-rich-select-field-input{right:var(--ag-spacing)}.ag-rich-select-typing-multi{:where(.ag-picker-field-display){flex:0 1 auto;max-width:100%;min-width:0}:where(.ag-rich-select-pill-display){align-items:center;display:flex;flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden;:where(.ag-pill-container){flex:0 1 auto;max-width:100%;min-width:0;overflow:hidden}}:where(.ag-rich-select-field-input){flex:0 0 auto;max-width:100%;min-width:0;:where(.ag-input-wrapper){flex:0 0 auto;max-width:100%}:where(.ag-input-field-input){max-width:100%;min-width:1ch;width:auto}}}:where(.ag-ltr) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-left:.25rem}:where(.ag-rich-select-deselect-button){margin-left:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-left:auto}}:where(.ag-rtl) .ag-rich-select-typing-multi{:where(.ag-rich-select-field-input){margin-right:.25rem}:where(.ag-rich-select-deselect-button){margin-right:auto}:where(.ag-rich-select-deselect-button.ag-hidden+.ag-picker-field-icon){margin-right:auto}}:where(.ag-popup-editor) .ag-rich-select-value{height:var(--ag-row-height);min-width:200px}.ag-rich-select-virtual-list-item{cursor:default;height:var(--ag-list-item-height)}.ag-pill-container{display:flex;flex-wrap:nowrap;gap:.25rem;min-width:0}.ag-pill{align-items:center;background:var(--ag-select-cell-background-color);border:var(--ag-select-cell-border);border-radius:var(--ag-border-radius);display:flex;padding:0 .25rem;white-space:nowrap}.ag-pill-button{border:none;padding:0}:where(.ag-ltr) .ag-pill-button{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-pill-button{margin-right:var(--ag-spacing)}.ag-pill-button:hover{color:var(--ag-accent-color);cursor:pointer}"; + +// packages/ag-grid-enterprise/src/widgets/agRichSelectList.ts +import { + KeyCode as KeyCode12, + _addOrRemoveAttribute, + _createElement as _createElement5, + _createIconNoSpan as _createIconNoSpan2, + _requestAnimationFrame as _requestAnimationFrame2, + _setAriaActiveDescendant, + _setAriaControlsAndLabel, + _setAriaLabel as _setAriaLabel3, + _setDisplayed as _setDisplayed7 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/agRichSelectRow.ts +import { + Component as Component8, + _addGridCommonParams as _addGridCommonParams3, + _clearElement as _clearElement5, + _createElement as _createElement4, + _exists as _exists6, + _getEditorRendererDetails, + _isElementOverflowingCallback, + _setAriaSelected, + _toString +} from "ag-grid-community"; +var RichSelectRowElement = { tag: "div", cls: "ag-rich-select-row", role: "presentation" }; +var RichSelectRow = class extends Component8 { + constructor(params) { + super(RichSelectRowElement); + this.params = params; + this.valueFormatter = resolveRichSelectValueFormatter(params.valueFormatter); + } + wireBeans(beans) { + this.userCompFactory = beans.userCompFactory; + this.registry = beans.registry; + } + postConstruct() { + this.tooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean( + "highlightTooltipFeature", + false, + { + getGui: () => this.getGui(), + shouldDisplayTooltip: () => this.shouldDisplayTooltip?.() ?? true + }, + this + ) + ); + } + setState(value) { + const formattedValue = this.valueFormatter(value); + const rendererSuccessful = this.populateWithRenderer(value, formattedValue); + if (!rendererSuccessful) { + this.populateWithoutRenderer(value, formattedValue); + } + this.value = value; + } + highlightString(matchString) { + const { parsedValue, params } = this; + if (params.cellRenderer || !_exists6(parsedValue)) { + return; + } + let hasMatch = _exists6(matchString); + if (hasMatch) { + const index = parsedValue?.toLocaleLowerCase().indexOf(matchString.toLocaleLowerCase()); + if (index >= 0) { + const highlightEndIndex = index + matchString.length; + const child = this.getGui().querySelector("span"); + if (child) { + _clearElement5(child); + child.append( + // Start part + parsedValue.slice(0, index), + // Highlighted part wrapped in bold tag + _createElement4({ + tag: "span", + cls: "ag-rich-select-row-text-highlight", + children: parsedValue.slice(index, highlightEndIndex) + }), + // End part + parsedValue.slice(highlightEndIndex) + ); + } + } else { + hasMatch = false; + } + } + if (!hasMatch) { + this.renderValueWithoutRenderer(parsedValue); + } + } + updateSelected(selected) { + const eGui = this.getGui(); + _setAriaSelected(eGui.parentElement, selected); + this.toggleCss("ag-rich-select-row-selected", selected); + } + getValue() { + return this.value; + } + toggleHighlighted(highlighted) { + this.toggleCss("ag-rich-select-row-highlighted", highlighted); + this.dispatchLocalEvent({ + type: "itemHighlighted", + highlighted + }); + } + populateWithoutRenderer(value, valueFormatted) { + const eGui = this.getGui(); + const span = _createElement4({ tag: "span" }); + span.style.overflow = "hidden"; + span.style.textOverflow = "ellipsis"; + const parsedValue = _toString(_exists6(valueFormatted) ? valueFormatted : value); + this.parsedValue = _exists6(parsedValue) ? parsedValue : null; + eGui.appendChild(span); + this.renderValueWithoutRenderer(parsedValue); + this.shouldDisplayTooltip = _isElementOverflowingCallback(() => span); + this.tooltipFeature?.setTooltipAndRefresh(this.parsedValue); + } + renderValueWithoutRenderer(value) { + const span = this.getGui().querySelector("span"); + if (!span) { + return; + } + span.textContent = _exists6(value) ? value : "\xA0"; + } + populateWithRenderer(value, valueFormatted) { + let cellRendererPromise; + let userCompDetails; + const { cellRenderer, cellRendererParams } = this.params; + if (cellRenderer) { + const richSelect = this.getParentComponent()?.getParentComponent(); + userCompDetails = _getEditorRendererDetails( + this.userCompFactory, + this.params, + _addGridCommonParams3(this.gos, { + value, + valueFormatted, + cellRendererParams, + getValue: () => richSelect?.getValue(), + setValue: (value2) => { + richSelect?.setValue(value2, true); + }, + setTooltip: (value2, shouldDisplayTooltip) => { + this.gos.assertModuleRegistered("Tooltip", 3); + this.shouldDisplayTooltip = shouldDisplayTooltip; + this.tooltipFeature?.setTooltipAndRefresh(value2); + } + }) + ); + } + if (userCompDetails) { + cellRendererPromise = userCompDetails.newAgStackInstance(); + } + if (cellRendererPromise) { + _bindCellRendererToHtmlElement(cellRendererPromise, this.getGui()); + } + if (cellRendererPromise) { + cellRendererPromise.then((childComponent) => { + this.addDestroyFunc(() => { + this.destroyBean(childComponent); + }); + }); + return true; + } + return false; + } +}; + +// packages/ag-grid-enterprise/src/widgets/agRichSelectList.ts +var LIST_COMPONENT_NAME = "ag-rich-select-list"; +var ROW_COMPONENT_NAME = "ag-rich-select-row"; +var STATE_LOADING = 0; +var STATE_READY_WITH_RESULTS = 1; +var STATE_NO_RESULTS = 2; +var STATE_READY_FOR_INPUT = 3; +var AgRichSelectList = class extends VirtualList { + constructor(params, richSelectWrapper, getSearchString2) { + super({ cssIdentifier: "rich-select" }); + this.params = params; + this.richSelectWrapper = richSelectWrapper; + this.getSearchString = getSearchString2; + this.lastRowHovered = -1; + this.selectedItems = /* @__PURE__ */ new Set(); + this.loadingState = STATE_READY_FOR_INPUT; + this.loadMoreRowsThreshold = 10; + this.valueFormatter = resolveRichSelectValueFormatter(params.valueFormatter); + this.setComponentCreator(this.createRowComponent.bind(this)); + this.setComponentUpdater(() => { + }); + } + postConstruct() { + super.postConstruct(); + const translate = this.getLocaleTextFunc(); + this.loadingLabel = translate("loadingOoo", "Loading..."); + this.noMatchesLabel = translate("noMatches", "No matches to show"); + this.eLoadingIcon = _createIconNoSpan2("richSelectLoading", this.beans, null); + this.eStateCompLabel = _createElement5({ tag: "span", cls: "ag-loading-text", children: this.loadingLabel }); + this.eStateComp = _createElement5({ + tag: "div", + cls: "ag-rich-select-loading", + children: [ + { + tag: "span", + cls: "ag-loading-icon", + children: [this.eLoadingIcon ? () => this.eLoadingIcon : void 0] + }, + { tag: "span", cls: "ag-loading-text", children: [() => this.eStateCompLabel] } + ] + }); + this.appendChild(this.eStateComp); + const { cellRowHeight, pickerAriaLabelKey, pickerAriaLabelValue } = this.params; + if (cellRowHeight) { + this.setRowHeight(cellRowHeight); + } + const eGui = this.getGui(); + const eListAriaEl = this.getAriaElement(); + this.addManagedListeners(eGui, { + mousemove: this.onMouseMove.bind(this), + mouseout: this.onMouseOut.bind(this), + mousedown: this.onMouseDown.bind(this), + click: this.onClick.bind(this), + scroll: this.onGuiScroll.bind(this) + }); + eGui.classList.add(LIST_COMPONENT_NAME); + const listId = `${LIST_COMPONENT_NAME}-${this.getCompId()}`; + eListAriaEl.setAttribute("id", listId); + const ariaLabel = translate(pickerAriaLabelKey, pickerAriaLabelValue); + _setAriaLabel3(eListAriaEl, ariaLabel); + _setAriaControlsAndLabel(this.richSelectWrapper, eListAriaEl); + } + setIsLoading() { + this.setLoadingState(STATE_LOADING); + } + setLoadingState(state) { + const hasChanged = this.loadingState !== state; + this.loadingState = state; + this.toggleStateComp(); + this.toggleVisibility(); + if (hasChanged) { + const stateAnnouncement = this.getStateAnnouncementText(state); + if (stateAnnouncement) { + this.stateAnnouncementCallback?.(stateAnnouncement); + } + } + } + toggleStateComp() { + const { eStateComp, eStateCompLabel, eLoadingIcon, loadingState, loadingLabel, noMatchesLabel, params } = this; + if (!eStateComp) { + return; + } + if (loadingState === STATE_LOADING) { + eStateCompLabel.textContent = loadingLabel; + if (eLoadingIcon) { + _setDisplayed7(eLoadingIcon, true); + } + _setDisplayed7(eStateComp, true); + return; + } + if (loadingState === STATE_NO_RESULTS && params.allowNoResultsCopy) { + eStateCompLabel.textContent = noMatchesLabel; + if (eLoadingIcon) { + _setDisplayed7(eLoadingIcon, false); + } + _setDisplayed7(eStateComp, true); + return; + } + _setDisplayed7(eStateComp, false); + } + shouldBeVisible() { + if (this.loadingState === STATE_NO_RESULTS) { + return !!this.params.allowNoResultsCopy; + } + return this.loadingState !== STATE_READY_FOR_INPUT; + } + toggleVisibility(forceVisible) { + const eListGui = this.getGui(); + if (forceVisible === void 0) { + _setDisplayed7(eListGui, this.shouldBeVisible()); + } else { + _setDisplayed7(eListGui, forceVisible); + } + this.scheduleMaybeRequestMoreRows(); + } + setLoadMoreRowsCallback(callback, thresholdRows = 10) { + this.loadMoreRowsCallback = callback; + this.loadMoreRowsThreshold = Math.max(thresholdRows, 1); + this.maybeRequestMoreRows(); + } + setStateAnnouncementCallback(callback) { + this.stateAnnouncementCallback = callback; + } + navigateToPage(key) { + const newIndex = super.navigateToPage(key, this.lastRowHovered); + if (newIndex != null) { + _requestAnimationFrame2(this.beans, () => { + if (!this.isAlive()) { + return null; + } + this.highlightIndex(newIndex); + }); + } + return newIndex; + } + drawVirtualRows(softRefresh) { + super.drawVirtualRows(softRefresh); + this.refreshSelectedItems(); + if (this.lastRowHovered !== -1) { + this.updateRenderedHighlightState(this.lastRowHovered); + } + } + highlightFilterMatch(searchString) { + this.forEachRenderedRow((cmp) => { + cmp.highlightString(searchString); + }); + } + onNavigationKeyDown(key, announceItem) { + _requestAnimationFrame2(this.beans, () => { + if (!this.currentList || !this.isAlive()) { + return; + } + const len = this.currentList.length; + const oldIndex = this.lastRowHovered; + const diff = key === KeyCode12.DOWN ? 1 : -1; + const newIndex = Math.min(Math.max(oldIndex === -1 ? 0 : oldIndex + diff, 0), len - 1); + this.highlightIndex(newIndex); + announceItem(); + }); + } + selectValue(value) { + if (!this.currentList || value == null) { + return false; + } + const selectedPositions = this.getIndicesForValues(value); + const refresh = selectedPositions.length > 0; + if (refresh) { + this.refresh(); + this.ensureIndexVisible(selectedPositions[0]); + this.refresh(true); + } + this.selectListItems(Array.isArray(value) ? value : [value]); + if (refresh) { + this.highlightIndex(selectedPositions[0], true); + } + return refresh; + } + selectListItems(values, append = false) { + if (!append) { + this.selectedItems.clear(); + } + for (let i = 0; i < values.length; i++) { + const currentItem = values[i]; + if (this.findItemInSelected(currentItem) !== void 0) { + continue; + } + this.selectedItems.add(currentItem); + } + this.refreshSelectedItems(); + } + getCurrentList() { + return this.currentList; + } + setCurrentList(list) { + const newState = getListStateBasedOnResults(list); + this.setLoadingState(newState); + list || (list = []); + this.currentList = list; + this.setModel({ + getRowCount: () => list.length, + getRow: (index) => list[index], + areRowsEqual: (oldRow, newRow) => oldRow === newRow + }); + } + offsetHoveredIndexOnPrependedRows(prependedRowCount) { + if (prependedRowCount <= 0 || this.lastRowHovered < 0) { + return; + } + this.lastRowHovered += prependedRowCount; + } + restoreScrollOnPrependedRows(previousScrollTop, prependedRowCount) { + if (prependedRowCount <= 0) { + return; + } + const eGui = this.getGui(); + const rowHeight = this.getRowHeight(); + const nextScrollTop = previousScrollTop + prependedRowCount * rowHeight; + this.awaitStable(() => { + if (!this.isAlive()) { + return; + } + eGui.scrollTop = nextScrollTop; + }); + } + getSelectedItems() { + return this.selectedItems; + } + getLastItemHovered() { + return this.currentList?.[this.lastRowHovered]; + } + highlightIndex(index, preventUnnecessaryScroll) { + if (!this.currentList) { + return; + } + if (index < 0 || index >= this.currentList.length) { + this.lastRowHovered = -1; + this.setActiveOption(); + } else { + this.lastRowHovered = index; + const wasScrolled = this.ensureIndexVisible(index, !preventUnnecessaryScroll); + if (wasScrolled && !preventUnnecessaryScroll) { + this.refresh(true); + } + } + this.updateRenderedHighlightState(index); + } + updateRenderedHighlightState(index) { + let activeOptionId; + this.forEachRenderedRow((cmp, idx) => { + const highlighted = index === idx; + cmp.toggleHighlighted(highlighted); + if (highlighted) { + activeOptionId = `${ROW_COMPONENT_NAME}-${cmp.getCompId()}`; + } + }); + this.setActiveOption(activeOptionId); + } + setActiveOption(activeOptionId) { + _setAriaActiveDescendant(this.richSelectWrapper, activeOptionId ?? null); + _addOrRemoveAttribute(this.richSelectWrapper, "data-active-option", activeOptionId); + } + getIndicesForValues(values) { + const { currentList } = this; + if (!currentList || currentList.length === 0 || values === void 0) { + return []; + } + const valuesToFind = Array.isArray(values) ? values : [values]; + if (valuesToFind.length === 0) { + return []; + } + const positions = []; + let formattedList; + for (const value of valuesToFind) { + let idx = currentList.indexOf(value); + if (idx === -1 && value != null) { + formattedList ?? (formattedList = currentList.map((item) => this.valueFormatter(item))); + const formattedValue = this.getComparableFormattedValue(value); + idx = formattedList.indexOf(formattedValue); + } + if (idx >= 0) { + positions.push(idx); + } + } + return positions; + } + toggleListItemSelection(value) { + const item = this.findItemInSelected(value); + if (item !== void 0) { + this.selectedItems.delete(item); + } else { + this.selectedItems.add(value); + } + this.refreshSelectedItems(); + this.dispatchValueSelected(); + } + refreshSelectedItems() { + this.forEachRenderedRow((cmp) => { + const selected = this.findItemInSelected(cmp.getValue()) !== void 0; + cmp.updateSelected(selected); + }); + } + findItemInSelected(value) { + if (typeof value === "object") { + if (this.selectedItems.has(value)) { + return value; + } + const valueFormatted = this.valueFormatter(value); + for (const item of this.selectedItems) { + if (this.valueFormatter(item) === valueFormatted) { + return item; + } + } + } else { + return this.selectedItems.has(value) ? value : void 0; + } + } + getComparableFormattedValue(value) { + return value != null && typeof value === "object" ? this.valueFormatter(value) : String(value ?? ""); + } + createRowComponent(value, listItemElement) { + const row = new RichSelectRow(this.params); + listItemElement.setAttribute("id", `${ROW_COMPONENT_NAME}-${row.getCompId()}`); + row.setParentComponent(this); + this.createBean(row); + row.setState(value); + const { highlightMatch, searchType = "fuzzy" } = this.params; + if (highlightMatch && searchType !== "fuzzy") { + row.highlightString(this.getSearchString()); + } + return row; + } + getRowForMouseEvent(e) { + if (!this.model) { + return -1; + } + const eGui = this.getGui(); + const rect = eGui.getBoundingClientRect(); + const scrollTop = this.getScrollTop(); + const mouseY = e.clientY - rect.top + scrollTop; + return Math.min(Math.max(Math.floor(mouseY / this.getRowHeight()), 0), this.model.getRowCount() - 1); + } + onMouseMove(e) { + const row = this.getRowForMouseEvent(e); + if (row !== -1 && row != this.lastRowHovered) { + this.lastRowHovered = row; + this.highlightIndex(row, true); + } + } + onGuiScroll() { + this.maybeRequestMoreRows(true); + } + scheduleMaybeRequestMoreRows() { + if (this.beans) { + _requestAnimationFrame2(this.beans, () => this.maybeRequestMoreRows(false)); + return; + } + this.maybeRequestMoreRows(false); + } + maybeRequestMoreRows(fromScrollEvent = false) { + const callback = this.loadMoreRowsCallback; + const currentList = this.currentList; + if (!callback || !currentList || this.loadingState === STATE_LOADING) { + return; + } + const eGui = this.getGui(); + if (eGui.clientHeight <= 0) { + return; + } + const remainingPixels = eGui.scrollHeight - (eGui.scrollTop + eGui.clientHeight); + const remainingRows = remainingPixels / this.getRowHeight(); + const rowsFromTop = eGui.scrollTop / this.getRowHeight(); + const hasVerticalOverflow = eGui.scrollHeight > eGui.clientHeight; + if (rowsFromTop <= this.loadMoreRowsThreshold && (fromScrollEvent || !hasVerticalOverflow)) { + callback("up"); + } + if (remainingRows <= this.loadMoreRowsThreshold) { + callback("down"); + } + } + getStateAnnouncementText(state) { + if (state === STATE_LOADING) { + return this.loadingLabel; + } + if (state === STATE_NO_RESULTS && this.params.allowNoResultsCopy) { + return this.noMatchesLabel; + } + return void 0; + } + onMouseDown(e) { + e.preventDefault(); + } + onMouseOut(e) { + if (!this.getGui().contains(e.relatedTarget)) { + this.highlightIndex(-1); + } + } + onClick(e) { + const { multiSelect } = this.params; + if (!this.currentList?.length) { + return; + } + const row = this.getRowForMouseEvent(e); + const item = this.currentList[row]; + if (multiSelect) { + this.toggleListItemSelection(item); + } else { + this.selectListItems([item]); + this.dispatchValueSelected(); + } + } + dispatchValueSelected() { + this.dispatchLocalEvent({ + type: "richSelectListRowSelected", + fromEnterKey: false, + value: this.selectedItems + }); + } + destroy() { + super.destroy(); + this.eStateComp = void 0; + } +}; +function getListStateBasedOnResults(valueList) { + if (!valueList) { + return STATE_READY_FOR_INPUT; + } + if (valueList.length) { + return STATE_READY_WITH_RESULTS; + } + return STATE_NO_RESULTS; +} + +// packages/ag-grid-enterprise/src/widgets/agRichSelect.ts +var ON_SEARCH_CALLBACK_DEBOUNCE_DELAY = 300; +var AgRichSelectElement = { + tag: "div", + cls: "ag-picker-field", + role: "presentation", + children: [ + { tag: "div", ref: "eLabel" }, + { + tag: "div", + ref: "eWrapper", + cls: "ag-wrapper ag-picker-field-wrapper ag-rich-select-value ag-picker-collapsed", + children: [ + { tag: "span", ref: "eDisplayField", cls: "ag-picker-field-display" }, + { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" }, + { + tag: "span", + ref: "eDeselect", + cls: "ag-rich-select-deselect-button ag-picker-field-icon", + role: "presentation" + }, + { tag: "span", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } } + ] + } + ] +}; +var AgRichSelect = class extends AgPickerField2 { + constructor(config) { + const valueFormatter = resolveRichSelectValueFormatter(config?.valueFormatter); + const resolvedAgComponents = config?.agComponents?.includes(AgInputTextFieldSelector2) ? config.agComponents : [AgInputTextFieldSelector2, ...config?.agComponents ?? []]; + super({ + ...config, + // prevents undefined values from being passed to the picker which can cause + // issues with the list component's value selection and highlighting logic + pickerAriaLabelKey: config?.pickerAriaLabelKey ?? "ariaLabelRichSelectField", + pickerAriaLabelValue: config?.pickerAriaLabelValue ?? "Rich Select Field", + pickerType: config?.pickerType ?? "ag-list", + className: config?.className ?? "ag-rich-select", + pickerIcon: config?.pickerIcon ?? "richSelectOpen", + ariaRole: config?.ariaRole ?? "combobox", + template: config?.template ?? AgRichSelectElement, + agComponents: resolvedAgComponents, + modalPicker: config?.modalPicker ?? false, + valueFormatter, + maxPickerHeight: config?.maxPickerHeight ?? "calc(var(--ag-row-height) * 6.5)" + }); + this.searchString = ""; + this.loadMoreRowsThreshold = 10; + this.hasPagedAsyncSource = false; + this.searchStringCreator = null; + this.eInput = RefPlaceholder13; + this.eDeselect = RefPlaceholder13; + this.skipWrapperAnnouncement = false; + this.onPillHorizontalArrowKeyDown = (e) => { + this.handleHorizontalNavigationKey(e); + }; + this.valueFormatter = valueFormatter; + const { value, valueList, searchStringCreator, onSearch } = config ?? {}; + if (value !== void 0) { + this.value = value; + } + if (searchStringCreator) { + this.searchStringCreator = searchStringCreator; + } + if (valueList != null) { + this.setValueList({ valueList, isInitial: true }); + } + const { searchDebounceDelay = ON_SEARCH_CALLBACK_DEBOUNCE_DELAY } = this.config; + if (onSearch) { + this.onSearchCallbackDebounced = _debounce(this, onSearch, searchDebounceDelay); + } + this.registerCSS(agRichSelect_default); + } + wireBeans(beans) { + this.userCompFactory = beans.userCompFactory; + this.ariaAnnounce = beans.ariaAnnounce; + this.registry = beans.registry; + } + postConstruct() { + this.tooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.getGui(), + shouldDisplayTooltip: () => this.shouldDisplayTooltip?.() ?? true + }) + ); + super.postConstruct(); + this.createListComponent(); + this.eDeselect.appendChild(_createIconNoSpan3("richSelectRemove", this.beans)); + const { allowTyping, placeholder, multiSelect, suppressDeselectAll, suppressMultiSelectPillRenderer } = this.config; + this.eDeselect.classList.add("ag-hidden"); + if (allowTyping) { + this.eInput.setAutoComplete(false).setInputPlaceholder(placeholder); + if (!multiSelect) { + this.eDisplayField.classList.add("ag-hidden"); + } else { + this.eWrapper.classList.add("ag-rich-select-typing-multi"); + if (!suppressMultiSelectPillRenderer) { + this.eDisplayField.classList.add("ag-rich-select-pill-display"); + } + } + } else { + this.eInput.setDisplayed(false); + } + this.setupAriaProperties(); + const { searchDebounceDelay = 300 } = this.config; + this.clearSearchString = _debounce(this, this.clearSearchString.bind(this), searchDebounceDelay); + this.renderSelectedValue(); + if (allowTyping) { + this.eInput.onValueChange((value) => { + this.openPickerOnTypingIfNeeded(value); + this.updateTypingMultiSelectPlaceholder(value); + this.searchTextFromString(value); + }); + } + this.addManagedElementListeners(this.eWrapper, { focus: this.onWrapperFocus.bind(this) }); + this.addManagedElementListeners(this.eWrapper, { focusout: this.onWrapperFocusOut.bind(this) }); + if (!suppressDeselectAll) { + this.addManagedElementListeners(this.eDeselect, { + mousedown: this.onDeselectAllMouseDown.bind(this), + click: this.onDeselectAllClick.bind(this) + }); + } + } + setupAriaProperties() { + const { eWrapper, gos } = this; + eWrapper.tabIndex = gos.get("tabIndex"); + const translate = this.getLocaleTextFunc(); + this.ariaDeleteSelection = translate("ariaLabelRichSelectDeleteSelection", "Press DELETE to deselect item"); + this.ariaDeselectAllItems = translate( + "ariaLabelRichSelectDeselectAllItems", + "Press DELETE to deselect all items" + ); + this.ariaToggleSelection = translate("ariaLabelRichSelectToggleSelection", "Press SPACE to toggle selection"); + } + createListComponent() { + this.listComponent = this.createBean( + new AgRichSelectList(this.config, this.getFocusableElement(), () => this.searchString) + ); + this.listComponent.setLoadMoreRowsCallback(this.loadMoreRowsCallback, this.loadMoreRowsThreshold); + this.listComponent.setStateAnnouncementCallback((value) => this.announceAriaValue(value)); + this.listComponent.setParentComponent(this); + this.addManagedListeners(this.listComponent, { + richSelectListRowSelected: (e) => { + this.onListValueSelected(e.value, e.fromEnterKey); + } + }); + } + renderSelectedValue(fromPicker) { + const { value, eDisplayField, config, gos } = this; + const { + allowTyping, + cellRenderer, + cellRendererParams, + initialInputValue, + multiSelect, + suppressDeselectAll, + suppressMultiSelectPillRenderer, + onSearch + } = config; + const valueFormatted = this.valueFormatter(value); + const isTypingMultiSelect = !!(allowTyping && multiSelect); + if (allowTyping) { + const inputValue = isTypingMultiSelect ? initialInputValue ?? this.eInput.getValue() ?? "" : initialInputValue ?? (value === "" ? "" : valueFormatted); + this.eInput.setValue(inputValue, !!fromPicker && !!onSearch); + if (!isTypingMultiSelect) { + return; + } + this.updateTypingMultiSelectPlaceholder(inputValue); + } + if (multiSelect && !suppressDeselectAll) { + const isEmpty = value == null || Array.isArray(value) && value.length === 0; + this.eDeselect.classList.toggle("ag-hidden", isEmpty); + } + let userCompDetails; + if (multiSelect && !suppressMultiSelectPillRenderer) { + this.createOrUpdatePillContainer(eDisplayField); + return; + } + if (cellRenderer && !allowTyping) { + userCompDetails = _getEditorRendererDetails2( + this.userCompFactory, + config, + _addGridCommonParams4(this.gos, { + value, + valueFormatted, + cellRendererParams, + getValue: () => this.getValue(), + setValue: (value2) => { + this.setValue(value2, true); + }, + setTooltip: (value2, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + this.shouldDisplayTooltip = shouldDisplayTooltip; + this.tooltipFeature?.setTooltipAndRefresh(value2); + } + }) + ); + } + let userCompDetailsPromise; + if (userCompDetails) { + userCompDetailsPromise = userCompDetails.newAgStackInstance(); + } + if (userCompDetailsPromise) { + _clearElement6(eDisplayField); + _bindCellRendererToHtmlElement(userCompDetailsPromise, eDisplayField); + userCompDetailsPromise.then((renderer) => { + this.addDestroyFunc(() => this.destroyBean(renderer)); + }); + } else { + if (value != null) { + eDisplayField.innerText = valueFormatted; + eDisplayField.classList.remove("ag-display-as-placeholder"); + } else { + const { placeholder } = config; + if (_exists7(placeholder)) { + eDisplayField.textContent = placeholder; + eDisplayField.classList.add("ag-display-as-placeholder"); + } else { + _clearElement6(eDisplayField); + } + } + this.shouldDisplayTooltip = _isElementOverflowingCallback2(() => this.eDisplayField); + this.tooltipFeature?.setTooltipAndRefresh(valueFormatted ?? null); + } + } + createPickerComponent() { + const { values } = this; + if (values) { + this.setValueList({ valueList: values }); + } + return this.listComponent; + } + setSearchStringCreator(searchStringFn) { + this.searchStringCreator = searchStringFn; + } + setAsyncValuesSource(params) { + const { source, thresholdRows, useAsyncSearch, onMisconfiguredSearchSource, onFirstValuesPageLoaded } = params; + this.asyncRequests?.destroy(); + const asyncRequestBindings = createRichSelectAsyncRequestBindings({ + host: { + setValueList: (valueListParams) => this.setValueList(valueListParams), + setIsLoading: () => this.setIsLoading() + }, + source, + useAsyncSearch, + onMisconfiguredSearchSource, + onFirstValuesPageLoaded + }); + this.asyncRequests = asyncRequestBindings.controller; + this.hasPagedAsyncSource = asyncRequestBindings.hasPagedSource; + if (asyncRequestBindings.onSearch) { + const { searchDebounceDelay = ON_SEARCH_CALLBACK_DEBOUNCE_DELAY } = this.config; + this.onSearchCallbackDebounced = _debounce(this, asyncRequestBindings.onSearch, searchDebounceDelay); + } else if (!this.config.onSearch) { + this.onSearchCallbackDebounced = void 0; + } + this.setLoadMoreRowsCallback(asyncRequestBindings.onLoadMoreRows, thresholdRows ?? this.loadMoreRowsThreshold); + } + resetAsyncValues(searchString = "") { + if (!this.hasPagedAsyncSource) { + return; + } + this.asyncRequests?.resetValuesPage(searchString); + } + setLoadMoreRowsCallback(callback, thresholdRows = 10) { + this.loadMoreRowsCallback = callback; + this.loadMoreRowsThreshold = Math.max(thresholdRows, 1); + this.listComponent?.setLoadMoreRowsCallback(this.loadMoreRowsCallback, this.loadMoreRowsThreshold); + } + setIsLoading() { + this.listComponent?.setIsLoading(); + } + setValueListInternal(params) { + const { listComponent, isPickerDisplayed, value } = this; + const { valueList, refresh, isInitial, scrollToCurrentValue = true, prependedRowCount = 0 } = params; + if (isInitial) { + this.setValues(valueList); + } + if (!listComponent) { + return; + } + const previousScrollTop = prependedRowCount > 0 ? listComponent.getScrollTop() : void 0; + if (prependedRowCount > 0) { + listComponent.offsetHoveredIndexOnPrependedRows(prependedRowCount); + } + listComponent.setCurrentList(valueList); + if (!refresh) { + return; + } + if (isPickerDisplayed && previousScrollTop != null && prependedRowCount > 0) { + listComponent.restoreScrollOnPrependedRows?.(previousScrollTop, prependedRowCount); + } + if (this.values) { + listComponent.refresh(true); + const hasCurrentValueInLoadedList = value != null && listComponent.getIndicesForValues(value).length > 0; + if (isPickerDisplayed && hasCurrentValueInLoadedList && scrollToCurrentValue) { + listComponent.selectValue(value); + } + } else if (isPickerDisplayed) { + const hasRefreshed = listComponent.selectValue(value); + if (!hasRefreshed) { + listComponent.refresh(); + } + } + this.alignPickerToComponent(); + } + setValueList(params) { + const { valueList } = params; + if (!valueList || Array.isArray(valueList)) { + this.setValueListInternal(params); + return; + } + this.listComponent?.setIsLoading(); + valueList.then((values) => { + if (values !== void 0) { + this.setValueListInternal({ ...params, valueList: values }); + } + }).catch(() => { + this.setValueListInternal({ ...params, valueList: [], refresh: true }); + }); + } + /** + * This method updates the list of select options + */ + setValues(values) { + this.values = values; + this.searchStrings = this.getSearchStringsFromValues(values || []); + } + showPicker() { + const { listComponent, value } = this; + if (!listComponent) { + return; + } + super.showPicker(); + const valueToUse = value ?? null; + listComponent.selectValue(valueToUse); + const idx = listComponent.getIndicesForValues(valueToUse)[0]; + if (idx != null) { + this.tooltipFeature?.attemptToHideTooltip(); + listComponent.highlightIndex(idx); + } else { + listComponent.refresh(); + } + } + createOrUpdatePillContainer(container) { + if (!this.pillContainer) { + const pillContainer = this.pillContainer = this.createBean(new AgPillContainer()); + this.addDestroyFunc(() => { + this.destroyBean(this.pillContainer); + this.pillContainer = null; + }); + _clearElement6(container); + container.appendChild(pillContainer.getGui()); + const { config, eWrapper, ariaDeleteSelection } = this; + pillContainer.init({ + eWrapper, + valueFormatter: this.valueFormatter, + onPillMouseDown: (e) => { + e.stopImmediatePropagation(); + }, + announceItemFocus: () => { + this.announceAriaValue(ariaDeleteSelection); + }, + focusAfterDelete: config.allowTyping ? () => this.focusTypingInputAtBoundary() : void 0, + focusAfterForwardBoundary: config.allowTyping ? () => this.focusTypingInputAtBoundary() : void 0, + onHorizontalArrowKeyDown: this.onPillHorizontalArrowKeyDown, + getValue: () => this.getValue(), + setValue: (value) => this.setValue(value, true) + }); + } + const previousPillCount = this.pillContainer.getGui().childElementCount; + this.doWhileBlockingAnnouncement(() => this.pillContainer?.refresh()); + this.scrollTypingMultiSelectPillsToEndOnAdd(previousPillCount); + } + scrollTypingMultiSelectPillsToEndOnAdd(previousPillCount) { + const { allowTyping, multiSelect, suppressMultiSelectPillRenderer } = this.config; + if (!allowTyping || !multiSelect || suppressMultiSelectPillRenderer) { + return; + } + const ePillContainer = this.pillContainer?.getGui(); + if (!ePillContainer || ePillContainer.childElementCount <= previousPillCount) { + return; + } + _setScrollLeft(ePillContainer, ePillContainer.scrollWidth, this.isRtl()); + } + doWhileBlockingAnnouncement(func) { + this.skipWrapperAnnouncement = true; + func(); + this.skipWrapperAnnouncement = false; + } + isPreviousHorizontalNavigation(key) { + return key === KeyCode13.LEFT !== this.isRtl(); + } + isRtl() { + return !!this.gos?.get("enableRtl"); + } + isTypingInputAtPillBoundary() { + const inputEl = this.eInput.getInputElement(); + const { selectionStart, selectionEnd, value } = inputEl; + if (selectionStart == null || selectionEnd == null || selectionStart !== selectionEnd) { + return false; + } + const isRtl = this.isRtl(); + return isRtl ? selectionStart === (value ?? "").length : selectionStart === 0; + } + focusTypingInputAtBoundary() { + const inputEl = this.eInput.getInputElement(); + inputEl.focus(); + const caret = this.isRtl() ? inputEl.value.length : 0; + inputEl.setSelectionRange(caret, caret); + } + getActiveElementForKeyboardNavigation() { + if (this.beans?.eRootDiv) { + return _getActiveDomElement5(this.beans); + } + const inputEl = this.getTypingInputElement(); + if (!inputEl) { + return document.activeElement; + } + return inputEl.ownerDocument?.activeElement ?? document.activeElement; + } + onWrapperFocus() { + const { eInput, config } = this; + const { allowTyping, multiSelect, suppressDeselectAll } = config; + if (allowTyping) { + const focusableEl = eInput.getFocusableElement(); + focusableEl.focus(); + focusableEl.select(); + } else if (multiSelect && !suppressDeselectAll && !this.skipWrapperAnnouncement) { + this.announceAriaValue(this.ariaDeselectAllItems); + } + } + onWrapperFocusOut(e) { + if (!this.eWrapper.contains(e.relatedTarget)) { + this.hidePicker(); + } + } + onDeselectAllMouseDown(e) { + e.stopImmediatePropagation(); + } + onDeselectAllClick() { + this.setValue([], true); + } + buildSearchStringFromKeyboardEvent(searchKey) { + let { key } = searchKey; + if (key === KeyCode13.BACKSPACE) { + this.searchString = this.searchString.slice(0, -1); + key = ""; + } else if (!_isEventFromPrintableCharacter(searchKey)) { + return; + } + searchKey.preventDefault(); + this.searchTextFromCharacter(key); + } + searchTextFromCharacter(char) { + this.searchString += char; + this.runSearch(); + this.clearSearchString(); + } + searchTextFromString(str) { + if (str == null) { + str = ""; + } + this.searchString = str; + if (this.onSearchCallbackDebounced) { + this.setValueList({ valueList: void 0, refresh: true }); + } + this.runSearch(); + } + getSearchStringsFromValues(values) { + if (typeof values[0] === "object" && this.searchStringCreator) { + return this.searchStringCreator(values); + } + return values.map((value) => value === "" ? "" : this.valueFormatter(value)); + } + filterListModel(filteredValues) { + const { filterList } = this.config; + if (!filterList) { + return; + } + this.setValueList({ valueList: filteredValues, refresh: true }); + } + runSearch() { + if (!this.listComponent) { + return; + } + if (this.onSearchCallbackDebounced) { + this.onSearchCallbackDebounced(this.searchString); + return; + } + const searchStrings = this.searchStrings; + if (!searchStrings) { + this.listComponent.highlightIndex(-1); + return; + } + const { suggestions, filteredValues } = this.getSuggestionsAndFilteredValues(this.searchString, searchStrings); + const { filterList, highlightMatch, searchType = "fuzzy" } = this.config; + const shouldFilter = !!(filterList && this.searchString !== ""); + this.filterListModel(shouldFilter ? filteredValues : this.values || []); + if (!this.highlightEmptyValue()) { + this.highlightListValue(suggestions, filteredValues, shouldFilter); + } + if (highlightMatch && searchType !== "fuzzy") { + this.listComponent?.highlightFilterMatch(this.searchString); + } + this.listComponent?.toggleVisibility(); + } + highlightEmptyValue() { + if (this.searchString === "") { + const emptyIdx = this.searchStrings?.indexOf(""); + if (emptyIdx !== void 0 && emptyIdx !== -1) { + this.listComponent?.highlightIndex(emptyIdx); + return true; + } + } + return false; + } + highlightListValue(suggestions, filteredValues, shouldFilter) { + if (suggestions.length) { + const topSuggestionIndex = shouldFilter ? 0 : this.searchStrings?.indexOf(suggestions[0]); + if (topSuggestionIndex !== void 0) { + this.listComponent?.highlightIndex(topSuggestionIndex); + } + } else { + this.listComponent?.highlightIndex(-1); + if (!shouldFilter || filteredValues.length) { + this.listComponent?.ensureIndexVisible(0); + } else if (shouldFilter) { + const eAriaEl = this.getFocusableElement(); + _addOrRemoveAttribute2(eAriaEl, "data-active-option", null); + _setAriaActiveDescendant2(eAriaEl, null); + } + } + } + getSuggestionsAndFilteredValues(searchValue, valueList) { + let suggestions = []; + const filteredValues = []; + if (!searchValue.length) { + return { suggestions, filteredValues }; + } + const { searchType = "fuzzy", filterList } = this.config; + const values = this.values || []; + if (searchType === "fuzzy") { + const fuzzySearchResult = _fuzzySuggestions2({ + inputValue: searchValue, + allSuggestions: valueList, + hideIrrelevant: true + }); + suggestions = fuzzySearchResult.values; + const indices = fuzzySearchResult.indices; + if (filterList && indices.length) { + for (let i = 0; i < indices.length; i++) { + filteredValues.push(values[indices[i]]); + } + } + } else { + suggestions = valueList.filter((val, idx) => { + const currentValue = val.toLocaleLowerCase(); + const valueToMatch = this.searchString.toLocaleLowerCase(); + const isMatch = searchType === "match" ? currentValue.startsWith(valueToMatch) : currentValue.includes(valueToMatch); + if (filterList && isMatch) { + filteredValues.push(values[idx]); + } + return isMatch; + }); + } + return { suggestions, filteredValues }; + } + clearSearchString() { + this.searchString = ""; + } + setValue(value, silent, fromPicker, skipRendering) { + if (this.value === value) { + this.updateTypingMultiSelectPlaceholder(); + return this; + } + const isArray = Array.isArray(value); + if (value != null) { + if (!isArray) { + const indices = this.listComponent?.getIndicesForValues(value); + if (!indices?.length) { + return this; + } + } + if (!fromPicker) { + this.listComponent?.selectValue(value); + } + } + super.setValue(value, silent); + if (!skipRendering) { + this.renderSelectedValue(fromPicker); + } else { + this.updateTypingMultiSelectPlaceholder(); + } + return this; + } + onNavigationKeyDown(event, key, announceItem) { + event.preventDefault(); + const isDown = key === KeyCode13.DOWN; + if (!this.isPickerDisplayed && isDown) { + this.showPicker(); + return; + } + this.listComponent?.onNavigationKeyDown(key, announceItem); + } + onEnterKeyDown(e) { + const isTypingMultiSelect = !!(this.config.allowTyping && this.config.multiSelect); + if (!this.isPickerDisplayed) { + if (isTypingMultiSelect) { + e.preventDefault(); + this.dispatchPickerEventAndHidePicker(this.value, true); + } + return; + } + e.preventDefault(); + if (this.listComponent?.getCurrentList()) { + const lastRowHovered = this.listComponent.getLastItemHovered(); + if (isTypingMultiSelect) { + if (lastRowHovered !== void 0) { + const values = this.getCurrentSelectionWithAppendedItem(lastRowHovered); + this.listComponent.selectValue(values); + this.setValue(values, false, true); + this.resetTypingMultiSelectSearchState(); + this.hidePicker(); + } + return; + } + if (this.config.multiSelect || lastRowHovered === void 0) { + this.dispatchPickerEventAndHidePicker(this.value, true); + } else { + this.onListValueSelected(/* @__PURE__ */ new Set([lastRowHovered]), true); + } + } + } + getCurrentSelectionWithAppendedItem(item) { + const value = this.getValue(); + const values = Array.isArray(value) ? [...value] : value != null ? [value] : []; + if (!values.some((selectedValue) => this.areValuesEquivalent(selectedValue, item))) { + values.push(item); + } + return values; + } + areValuesEquivalent(left, right) { + if (left === right) { + return true; + } + if (typeof left === "object" && typeof right === "object" && left != null && right != null) { + return this.valueFormatter(left) === this.valueFormatter(right); + } + return false; + } + resetTypingMultiSelectSearchState() { + this.searchString = ""; + this.eInput.setValue("", true); + if (this.onSearchCallbackDebounced) { + this.setValueList({ valueList: void 0, refresh: true }); + return; + } + if (this.config.filterList && this.values) { + this.setValueList({ valueList: this.values, refresh: true }); + } + } + updateTypingMultiSelectPlaceholder(inputValue) { + const { allowTyping, multiSelect, placeholder } = this.config; + if (!allowTyping || !multiSelect) { + return; + } + const currentInputValue = inputValue ?? this.eInput.getValue() ?? ""; + const hasInputValue = currentInputValue.length > 0; + const value = this.value; + const hasSelectedValues = (Array.isArray(value) ? value.length > 0 : value != null) || (this.listComponent?.getSelectedItems().size ?? 0) > 0; + const nextPlaceholder = !hasInputValue && !hasSelectedValues ? placeholder : ""; + this.eInput.setInputPlaceholder(nextPlaceholder); + this.updateTypingMultiSelectInputSize(currentInputValue, nextPlaceholder); + } + updateTypingMultiSelectInputSize(inputValue, placeholder) { + const inputEl = this.getTypingInputElement(); + if (!inputEl) { + return; + } + const widthSource = inputValue || placeholder || ""; + const nextSize = Math.max(1, Math.min(widthSource.length + 1, 32)); + if (inputEl.size !== nextSize) { + inputEl.size = nextSize; + } + if (inputValue) { + const ePillContainer = this.pillContainer?.getGui(); + if (ePillContainer) { + _setScrollLeft(ePillContainer, ePillContainer.scrollWidth, this.isRtl()); + } + } + } + getTypingInputElement() { + const getInputElement = this.eInput.getInputElement; + if (typeof getInputElement !== "function") { + return; + } + return getInputElement.call(this.eInput); + } + openPickerOnTypingIfNeeded(value) { + const { + isPickerDisplayed, + config: { allowTyping, multiSelect } + } = this; + if (allowTyping && multiSelect && !isPickerDisplayed && !!value) { + this.showPicker(); + } + } + onDeleteKeyDown(e) { + const { eWrapper, beans } = this; + const activeEl = _getActiveDomElement5(beans); + if (activeEl === eWrapper) { + e.preventDefault(); + this.setValue([], true); + } + } + onBackspaceKeyDown(e) { + if (!this.isTypingInputAtPillBoundary()) { + return; + } + const value = this.getValue(); + const selectedValues = Array.isArray(value) ? value : value != null ? [value] : Array.from(this.listComponent?.getSelectedItems() ?? []); + if (!selectedValues.length) { + return; + } + e.preventDefault(); + this.setValue(selectedValues.slice(0, -1), true); + } + onTabKeyDown() { + const { config, isPickerDisplayed, listComponent } = this; + const { multiSelect } = config; + if (!isPickerDisplayed || !listComponent) { + return; + } + if (multiSelect) { + const values = this.getValueFromSet(listComponent.getSelectedItems()); + if (values) { + this.setValue(values, false, true, true); + } + } else { + const lastItemHovered = listComponent.getLastItemHovered(); + if (lastItemHovered !== void 0) { + this.setValue(lastItemHovered, false, true); + } + } + this.hidePicker(); + } + getValueFromSet(valueSet) { + const { multiSelect } = this.config; + if (!multiSelect) { + return valueSet.size ? valueSet.values().next().value : null; + } + const selectedValues = Array.from(valueSet); + return selectedValues.length ? selectedValues : null; + } + onListValueSelected(valueSet, fromEnterKey) { + const newValue = this.getValueFromSet(valueSet); + this.setValue(newValue, false, true); + const { multiSelect, allowTyping } = this.config; + if (multiSelect && allowTyping) { + this.resetTypingMultiSelectSearchState(); + this.hidePicker(); + } else if (!multiSelect) { + this.dispatchPickerEventAndHidePicker(newValue, fromEnterKey); + } + } + dispatchPickerEventAndHidePicker(value, fromEnterKey) { + const event = { + type: "fieldPickerValueSelected", + fromEnterKey, + value + }; + this.dispatchLocalEvent(event); + this.hidePicker(); + } + getFocusableElement() { + const { allowTyping } = this.config; + if (allowTyping) { + return this.eInput.getFocusableElement(); + } + return super.getFocusableElement(); + } + handleHorizontalNavigationKey(e) { + const { allowTyping, multiSelect } = this.config; + if (!allowTyping) { + e.preventDefault(); + this.listComponent?.highlightIndex(-1); + this.pillContainer?.onNavigationKeyDown(e); + return; + } + const pillContainer = this.pillContainer; + if (!pillContainer) { + return; + } + if (!multiSelect) { + return; + } + const activeEl = this.getActiveElementForKeyboardNavigation(); + const isPrevious = this.isPreviousHorizontalNavigation(e.key); + const inputEl = this.eInput.getInputElement(); + if (activeEl === inputEl) { + if (isPrevious && this.isTypingInputAtPillBoundary()) { + this.listComponent?.highlightIndex(-1); + pillContainer.onNavigationKeyDown(e); + } + return; + } + if (pillContainer.getGui().contains(activeEl)) { + this.listComponent?.highlightIndex(-1); + const activeBefore = activeEl; + pillContainer.onNavigationKeyDown(e); + if (!isPrevious && this.getActiveElementForKeyboardNavigation() === activeBefore) { + this.focusTypingInputAtBoundary(); + } + } + } + handlePageNavigationKey(e, key) { + const { allowTyping } = this.config; + if (allowTyping && (key === KeyCode13.PAGE_HOME || key === KeyCode13.PAGE_END)) { + e.preventDefault(); + const inputEl = this.eInput.getInputElement(); + const target = key === KeyCode13.PAGE_HOME ? 0 : inputEl.value.length; + inputEl.setSelectionRange(target, target); + return; + } + e.preventDefault(); + if (this.pickerComponent) { + this.listComponent?.navigateToPage(key); + } + } + handleVerticalNavigationKey(e, key, isComposing) { + if (isComposing) { + return; + } + this.onNavigationKeyDown(e, key, () => { + if (this.config.multiSelect) { + this.doWhileBlockingAnnouncement(() => this.eWrapper.focus()); + this.announceAriaValue(this.ariaToggleSelection); + } + }); + } + handleEscapeKey(e) { + if (!this.isPickerDisplayed) { + return; + } + if (_isVisible4(this.listComponent.getGui())) { + e.preventDefault(); + _stopPropagationForAgGrid(e); + } + this.hidePicker(); + } + handleEnterKey(e, isComposing) { + if (isComposing) { + e.preventDefault(); + return; + } + this.onEnterKeyDown(e); + } + handleSpaceKey(e, isComposing) { + const { allowTyping, multiSelect } = this.config; + const { isPickerDisplayed, listComponent } = this; + const shouldToggleSelectionWithSpace = !isComposing && isPickerDisplayed && multiSelect && !!listComponent && (!allowTyping || (this.eInput.getValue() ?? "") === ""); + if (!allowTyping || isComposing || shouldToggleSelectionWithSpace) { + e.preventDefault(); + } + if (shouldToggleSelectionWithSpace && listComponent) { + const lastItemHovered = listComponent.getLastItemHovered(); + if (lastItemHovered !== void 0) { + listComponent.toggleListItemSelection(lastItemHovered); + } + } + } + handleBackspaceKey(e, isComposing) { + if (!isComposing && this.config.allowTyping && this.config.multiSelect) { + this.onBackspaceKeyDown(e); + } + } + handleDeleteKey(e) { + if (this.config.multiSelect && !this.config.suppressDeselectAll) { + this.onDeleteKeyDown(e); + } + } + handleSearchWithoutTyping(e) { + if (!this.config.allowTyping) { + this.buildSearchStringFromKeyboardEvent(e); + } + } + onKeyDown(e) { + const { key, isComposing } = e; + switch (key) { + case KeyCode13.LEFT: + case KeyCode13.RIGHT: + this.handleHorizontalNavigationKey(e); + break; + case KeyCode13.PAGE_HOME: + case KeyCode13.PAGE_END: + case KeyCode13.PAGE_UP: + case KeyCode13.PAGE_DOWN: + this.handlePageNavigationKey(e, key); + break; + case KeyCode13.DOWN: + case KeyCode13.UP: + this.handleVerticalNavigationKey(e, key, isComposing); + break; + case KeyCode13.ESCAPE: + this.handleEscapeKey(e); + break; + case KeyCode13.ENTER: + this.handleEnterKey(e, isComposing); + break; + case KeyCode13.SPACE: + this.handleSpaceKey(e, isComposing); + break; + case KeyCode13.BACKSPACE: + this.handleBackspaceKey(e, isComposing); + break; + case KeyCode13.TAB: + this.onTabKeyDown(); + break; + case KeyCode13.DELETE: + this.handleDeleteKey(e); + break; + default: + this.handleSearchWithoutTyping(e); + } + } + announceAriaValue(value) { + this.ariaAnnounce?.announceValue(value, "richSelect"); + } + destroy() { + this.asyncRequests?.destroy(); + this.asyncRequests = void 0; + this.hasPagedAsyncSource = false; + if (this.listComponent) { + this.listComponent = this.destroyBean(this.listComponent); + } + this.searchStrings = void 0; + super.destroy(); + } +}; +function _bindCellRendererToHtmlElement(cellRendererPromise, eTarget) { + cellRendererPromise.then((cellRenderer) => { + const gui = cellRenderer.getGui(); + if (gui != null) { + eTarget.appendChild(gui); + } + }); +} +function resolveRichSelectValueFormatter(valueFormatter) { + return (value) => valueFormatter?.(value) ?? String(value ?? ""); +} + +// packages/ag-grid-enterprise/src/advancedFilter/builder/addDropdownComp.ts +var AddDropdownCompElement = { + tag: "div", + cls: "ag-picker-field", + role: "presentation", + children: [ + { tag: "div", ref: "eLabel" }, + { + tag: "div", + ref: "eWrapper", + cls: "ag-wrapper ag-picker-collapsed", + children: [ + { tag: "div", ref: "eDisplayField", cls: "ag-picker-field-display" }, + { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" }, + { + tag: "span", + ref: "eDeselect", + cls: "ag-rich-select-deselect-button ag-picker-field-icon", + role: "presentation" + }, + { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } } + ] + } + ] +}; +var AddDropdownComp = class extends AgRichSelect { + constructor(params) { + super({ + ...params, + template: AddDropdownCompElement, + agComponents: [AgInputTextFieldSelector3] + }); + this.params = params; + } + showPicker() { + setTimeout(() => super.showPicker()); + } + hidePicker() { + setTimeout(() => super.hidePicker()); + } + postConstruct() { + super.postConstruct(); + const { wrapperClassName, ariaLabel } = this.params; + _setDisplayed8(this.eDisplayField, false); + if (wrapperClassName) { + this.eWrapper.classList.add(wrapperClassName); + } + _setAriaLabelledBy(this.eWrapper, ""); + _setAriaLabel4(this.eWrapper, ariaLabel); + } + onEnterKeyDown(event) { + _stopPropagationForAgGrid2(event); + if (this.isPickerDisplayed) { + super.onEnterKeyDown(event); + } else { + event.preventDefault(); + this.showPicker(); + } + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderItemNavigationFeature.ts +import { + BeanStub as BeanStub4, + KeyCode as KeyCode14, + _getActiveDomElement as _getActiveDomElement6, + _isStopPropagationForAgGrid, + _stopPropagationForAgGrid as _stopPropagationForAgGrid3 +} from "ag-grid-community"; +var AdvancedFilterBuilderItemNavigationFeature = class extends BeanStub4 { + constructor(eGui, focusWrapper, eFocusableComp) { + super(); + this.eGui = eGui; + this.focusWrapper = focusWrapper; + this.eFocusableComp = eFocusableComp; + } + postConstruct() { + this.addManagedElementListeners(this.eGui, { + keydown: (event) => { + switch (event.key) { + case KeyCode14.TAB: + if (!event.defaultPrevented) { + _stopPropagationForAgGrid3(event); + } + break; + case KeyCode14.UP: + case KeyCode14.DOWN: + _stopPropagationForAgGrid3(event); + break; + case KeyCode14.ESCAPE: + if (_isStopPropagationForAgGrid(event)) { + return; + } + if (this.eGui.contains(_getActiveDomElement6(this.beans))) { + event.preventDefault(); + _stopPropagationForAgGrid3(event); + this.focusWrapper.focus(); + } + break; + } + } + }); + const highlightClass = "ag-advanced-filter-builder-virtual-list-item-highlight"; + this.addManagedListeners(this.focusWrapper, { + keydown: (event) => { + if (event.key === KeyCode14.ENTER) { + if (_isStopPropagationForAgGrid(event)) { + return; + } + if (_getActiveDomElement6(this.beans) === this.focusWrapper) { + event.preventDefault(); + _stopPropagationForAgGrid3(event); + this.eFocusableComp.getFocusableElement().focus(); + } + } + }, + focusin: () => { + this.focusWrapper.classList.add(highlightClass); + }, + focusout: (event) => { + if (!this.focusWrapper.contains(event.relatedTarget)) { + this.focusWrapper.classList.remove(highlightClass); + } + } + }); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderUtils.ts +function getAdvancedFilterBuilderAddButtonParams(translate, maxPickerWidth) { + return { + pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderAddField", + pickerAriaLabelValue: "Advanced Filter Builder Add Field", + pickerType: "ag-list", + valueList: [ + { + key: "condition", + displayValue: translate("advancedFilterBuilderAddCondition") + }, + { + key: "join", + displayValue: translate("advancedFilterBuilderAddJoin") + } + ], + valueFormatter: (value) => value == null ? "" : value.displayValue ?? value.key, + pickerIcon: "advancedFilterBuilderAdd", + maxPickerWidth: `${maxPickerWidth ?? 120}px`, + wrapperClassName: "ag-advanced-filter-builder-item-button", + ariaLabel: translate("advancedFilterBuilderAddButtonTooltip") + }; +} + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderItemAddComp.ts +var ItemAddElement = { + tag: "div", + cls: "ag-advanced-filter-builder-item-wrapper", + role: "presentation", + children: [ + { + tag: "div", + ref: "eItem", + cls: "ag-advanced-filter-builder-item", + role: "presentation", + children: [ + { + tag: "div", + cls: "ag-advanced-filter-builder-item-tree-lines", + attrs: { "aria-hidden": "true" }, + children: [ + { + tag: "div", + cls: "ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-top ag-advanced-filter-builder-item-tree-line-horizontal" + } + ] + } + ] + } + ] +}; +var AdvancedFilterBuilderItemAddComp = class extends Component9 { + constructor(item, focusWrapper) { + super(ItemAddElement); + this.item = item; + this.focusWrapper = focusWrapper; + this.eItem = RefPlaceholder14; + } + wireBeans(beans) { + this.advFilterExpSvc = beans.advFilterExpSvc; + this.registry = beans.registry; + } + postConstruct() { + _setAriaLevel(this.focusWrapper, 2); + const addButtonParams = getAdvancedFilterBuilderAddButtonParams( + (key) => this.advFilterExpSvc.translate(key), + this.gos.get("advancedFilterBuilderParams")?.addSelectWidth + ); + const eAddButton = this.createManagedBean(new AddDropdownComp(addButtonParams)); + this.addManagedListeners(eAddButton, { + fieldPickerValueSelected: ({ value }) => { + this.dispatchLocalEvent({ + type: "advancedFilterBuilderAdded", + item: this.item, + isJoin: value.key === "join" + }); + } + }); + this.eItem.appendChild(eAddButton.getGui()); + this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => eAddButton.getGui(), + getLocation: () => "advancedFilter", + getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip") + }) + ); + this.createManagedBean( + new AdvancedFilterBuilderItemNavigationFeature(this.getGui(), this.focusWrapper, eAddButton) + ); + _setAriaLabel5( + this.focusWrapper, + this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem", [ + this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip"), + `${this.item.level + 1}` + ]) + ); + } + afterAdd() { + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderItemComp.ts +import { + DragSourceType as DragSourceType2, + KeyCode as KeyCode16, + RefPlaceholder as RefPlaceholder16, + TabGuardComp, + _createElement as _createElement6, + _createIconNoSpan as _createIconNoSpan4, + _removeAriaExpanded, + _setAriaDisabled as _setAriaDisabled2, + _setAriaExpanded as _setAriaExpanded4, + _setAriaLabel as _setAriaLabel8, + _setAriaLevel as _setAriaLevel2, + _setDisplayed as _setDisplayed10, + _setVisible, + _stopPropagationForAgGrid as _stopPropagationForAgGrid6 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/conditionPillWrapperComp.ts +import { Component as Component10, _exists as _exists8, _removeFromParent as _removeFromParent2, _toStringOrNull as _toStringOrNull2 } from "ag-grid-community"; +var ConditionPillWrapperComp = class extends Component10 { + constructor() { + super({ tag: "div", cls: "ag-advanced-filter-builder-item-condition", role: "presentation" }); + this.validationMessage = null; + } + wireBeans(beans) { + this.advFilterExpSvc = beans.advFilterExpSvc; + } + init(params) { + const { item, createPill } = params; + this.item = item; + this.createPill = createPill; + this.filterModel = item.filterModel; + this.setupColumnCondition(this.filterModel); + this.validate(); + this.addDestroyFunc(() => this.destroyBeans([this.eColumnPill, this.eOperatorPill, this.eOperandPill])); + } + getDragName() { + return this.filterModel.colId ? this.advFilterExpSvc.parseColumnFilterModel(this.filterModel) : this.getDefaultColumnDisplayValue(); + } + getAriaLabel() { + return `${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderFilterItem")} ${this.getDragName()}`; + } + getValidationMessage() { + return this.validationMessage; + } + getFocusableElement() { + return this.eColumnPill.getFocusableElement(); + } + setupColumnCondition(filterModel) { + const columnDetails = this.advFilterExpSvc.getColumnDetails(filterModel.colId); + this.baseCellDataType = columnDetails.baseCellDataType; + this.column = columnDetails.column; + this.numOperands = this.getNumOperands(this.getOperatorKey()); + this.eColumnPill = this.createPill({ + key: this.getColumnKey(), + displayValue: this.getColumnDisplayValue() ?? this.getDefaultColumnDisplayValue(), + cssClass: "ag-advanced-filter-builder-column-pill", + isSelect: true, + getEditorParams: () => ({ values: this.advFilterExpSvc.getColumnAutocompleteEntries() }), + update: (key) => this.setColumnKey(key), + pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderColumnSelectField", + pickerAriaLabelValue: "Advanced Filter Builder Column Select Field", + ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderColumn") + }); + this.getGui().appendChild(this.eColumnPill.getGui()); + if (_exists8(this.getColumnKey())) { + this.createOperatorPill(); + if (this.hasOperand()) { + this.createOperandPill(); + } + } + } + createOperatorPill() { + this.eOperatorPill = this.createPill({ + key: this.getOperatorKey(), + displayValue: this.getOperatorDisplayValue() ?? this.getDefaultOptionSelectValue(), + cssClass: "ag-advanced-filter-builder-option-pill", + isSelect: true, + getEditorParams: () => ({ values: this.getOperatorAutocompleteEntries() }), + update: (key) => this.setOperatorKey(key), + pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderOptionSelectField", + pickerAriaLabelValue: "Advanced Filter Builder Option Select Field", + ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderOption") + }); + this.eColumnPill.getGui().insertAdjacentElement("afterend", this.eOperatorPill.getGui()); + } + createOperandPill() { + const { filter } = this.filterModel; + const key = (typeof filter === "number" || typeof filter === "bigint" ? _toStringOrNull2(filter) : filter) ?? ""; + this.eOperandPill = this.createPill({ + key, + // Convert from the input format to display format. + // Input format matches model format except for numbers, but these get stringified anyway + valueFormatter: (value) => this.advFilterExpSvc.getOperandDisplayValue({ ...this.filterModel, filter: value }, true), + baseCellDataType: this.baseCellDataType, + cssClass: "ag-advanced-filter-builder-value-pill", + isSelect: false, + update: (key2) => this.setOperand(key2), + ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderValue") + }); + this.getGui().appendChild(this.eOperandPill.getGui()); + } + getColumnKey() { + return this.filterModel.colId; + } + getColumnDisplayValue() { + return this.advFilterExpSvc.getColumnDisplayValue(this.filterModel); + } + getOperatorKey() { + return this.filterModel.type; + } + getOperatorDisplayValue() { + return this.advFilterExpSvc.getOperatorDisplayValue(this.filterModel); + } + getOperandDisplayValue() { + return this.advFilterExpSvc.getOperandDisplayValue(this.filterModel, true); + } + hasOperand() { + return this.numOperands > 0; + } + getOperatorAutocompleteEntries() { + return this.column ? this.advFilterExpSvc.getOperatorAutocompleteEntries(this.column, this.baseCellDataType) : []; + } + setColumnKey(colId) { + if (!this.eOperatorPill) { + this.createOperatorPill(); + } + const newColumnDetails = this.advFilterExpSvc.getColumnDetails(colId); + this.column = newColumnDetails.column; + const newBaseCellDataType = newColumnDetails.baseCellDataType; + if (this.baseCellDataType !== newBaseCellDataType) { + this.baseCellDataType = newBaseCellDataType; + this.setOperatorKey(void 0); + if (this.eOperatorPill) { + _removeFromParent2(this.eOperatorPill.getGui()); + this.destroyBean(this.eOperatorPill); + this.createOperatorPill(); + } + this.validate(); + } + this.filterModel.colId = colId; + this.filterModel.filterType = this.baseCellDataType; + } + setOperatorKey(operator) { + const newNumOperands = this.getNumOperands(operator); + if (newNumOperands !== this.numOperands) { + this.numOperands = newNumOperands; + if (newNumOperands === 0) { + this.destroyOperandPill(); + } else { + this.createOperandPill(); + if (this.baseCellDataType !== "number") { + this.setOperand(""); + } + } + } + this.filterModel.type = operator; + this.validate(); + } + setOperand(operand) { + let parsedOperand = operand; + if (this.baseCellDataType === "number") { + parsedOperand = _exists8(operand) ? Number(operand) : ""; + } + this.filterModel.filter = parsedOperand; + this.validate(); + } + getNumOperands(operator) { + return this.advFilterExpSvc.getExpressionOperator(this.baseCellDataType, operator)?.numOperands ?? 0; + } + destroyOperandPill() { + delete this.filterModel.filter; + this.eOperandPill?.getGui().remove(); + this.destroyBean(this.eOperandPill); + this.eOperandPill = void 0; + } + validate() { + let validationMessage = null; + if (!_exists8(this.getColumnKey())) { + validationMessage = this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectColumn"); + } else if (!_exists8(this.getOperatorKey())) { + validationMessage = this.advFilterExpSvc.translate("advancedFilterBuilderValidationSelectOption"); + } else if (this.numOperands > 0 && !_exists8(this.getOperandDisplayValue())) { + validationMessage = this.advFilterExpSvc.translate("advancedFilterBuilderValidationEnterValue"); + } + this.item.valid = !validationMessage; + if (validationMessage !== this.validationMessage) { + this.validationMessage = validationMessage; + this.dispatchLocalEvent({ + type: "advancedFilterBuilderValidChanged" + }); + } + } + getDefaultColumnDisplayValue() { + return this.advFilterExpSvc.translate("advancedFilterBuilderSelectColumn"); + } + getDefaultOptionSelectValue() { + return this.advFilterExpSvc.translate("advancedFilterBuilderSelectOption"); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/inputPillComp.ts +import { + AgInputDateField, + AgInputNumberField, + AgInputTextField as AgInputTextField2, + Component as Component11, + KeyCode as KeyCode15, + RefPlaceholder as RefPlaceholder15, + _exists as _exists9, + _setAriaDescribedBy, + _setAriaLabel as _setAriaLabel6, + _setDisplayed as _setDisplayed9, + _stopPropagationForAgGrid as _stopPropagationForAgGrid4 +} from "ag-grid-community"; +var inputComponentDescriptors = { + number: [AgInputNumberField], + bigint: [AgInputTextField2], + boolean: [AgInputTextField2], + object: [AgInputTextField2], + text: [AgInputTextField2], + date: [AgInputDateField], + dateString: [AgInputDateField], + dateTime: [AgInputDateField, (i) => i.setIncludeTime(true)], + dateTimeString: [AgInputDateField, (i) => i.setIncludeTime(true)] +}; +var InputPillElement = { + tag: "div", + cls: "ag-advanced-filter-builder-pill-wrapper", + role: "presentation", + children: [ + { + tag: "div", + ref: "ePill", + cls: "ag-advanced-filter-builder-pill", + role: "button", + children: [ + { + tag: "span", + ref: "eLabel", + cls: "ag-advanced-filter-builder-pill-display" + } + ] + } + ] +}; +var InputPillComp = class extends Component11 { + constructor(params) { + super(InputPillElement); + this.params = params; + this.ePill = RefPlaceholder15; + this.eLabel = RefPlaceholder15; + const { value, valueFormatter } = params; + this.value = value; + this.displayValue = valueFormatter(value); + } + wireBeans(beans) { + this.advFilterExpSvc = beans.advFilterExpSvc; + } + postConstruct() { + const { cssClass, ariaLabel } = this.params; + this.ePill.classList.add(cssClass); + this.activateTabIndex([this.ePill]); + this.eLabel.id = `${this.getCompId()}`; + _setAriaDescribedBy(this.ePill, this.eLabel.id); + _setAriaLabel6(this.ePill, ariaLabel); + this.renderValue(); + this.addManagedListeners(this.ePill, { + click: (event) => { + event.preventDefault(); + this.showEditor(); + }, + keydown: (event) => { + if (event.key === KeyCode15.ENTER) { + event.preventDefault(); + _stopPropagationForAgGrid4(event); + this.showEditor(); + } + } + }); + this.addDestroyFunc(() => this.destroyBean(this.eEditor)); + } + getFocusableElement() { + return this.ePill; + } + showEditor() { + if (this.eEditor) { + return; + } + _setDisplayed9(this.ePill, false); + this.eEditor = this.createEditorComp(this.params.type); + this.eEditor.setValue(this.value); + const eEditorGui = this.eEditor.getGui(); + this.eEditor.addManagedElementListeners(eEditorGui, { + keydown: (event) => { + switch (event.key) { + case KeyCode15.ENTER: + event.preventDefault(); + _stopPropagationForAgGrid4(event); + this.updateValue(true); + break; + case KeyCode15.ESCAPE: + event.preventDefault(); + _stopPropagationForAgGrid4(event); + this.hideEditor(true); + break; + } + }, + focusout: () => this.updateValue(false) + }); + this.getGui().appendChild(eEditorGui); + this.eEditor.getFocusableElement().focus(); + } + /** + * Responsible for instantiating an InputField and calling some of the setup methods + */ + createEditorComp(type) { + const [Comp, postConstruct] = inputComponentDescriptors[type]; + const instance = this.createBean(new Comp()); + postConstruct?.(instance); + return instance; + } + hideEditor(keepFocus) { + const { eEditor } = this; + if (!eEditor) { + return; + } + this.eEditor = void 0; + eEditor.getGui().remove(); + this.destroyBean(eEditor); + _setDisplayed9(this.ePill, true); + if (keepFocus) { + this.ePill.focus(); + } + } + renderValue() { + let value; + const { displayValue, eLabel, params } = this; + const { type } = params; + const { classList } = eLabel; + classList.remove( + "ag-advanced-filter-builder-value-empty", + "ag-advanced-filter-builder-value-number", + "ag-advanced-filter-builder-value-text" + ); + if (!_exists9(displayValue)) { + value = this.advFilterExpSvc.translate("advancedFilterBuilderEnterValue"); + classList.add("ag-advanced-filter-builder-value-empty"); + } else if (type === "number" || type === "bigint") { + value = displayValue; + classList.add("ag-advanced-filter-builder-value-number"); + } else { + value = `"${displayValue}"`; + classList.add("ag-advanced-filter-builder-value-text"); + } + eLabel.textContent = value; + } + updateValue(keepFocus) { + if (!this.eEditor) { + return; + } + const value = this.eEditor.getValue() ?? ""; + this.dispatchLocalEvent({ + type: "fieldValueChanged", + value + }); + this.value = value; + this.displayValue = this.params.valueFormatter(value); + this.renderValue(); + this.hideEditor(keepFocus); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/joinPillWrapperComp.ts +import { Component as Component12 } from "ag-grid-community"; +var JoinPillWrapperComp = class extends Component12 { + wireBeans(beans) { + this.advFilterExpSvc = beans.advFilterExpSvc; + } + constructor() { + super({ + tag: "div", + cls: "ag-advanced-filter-builder-item-condition", + role: "presentation" + }); + } + init(params) { + const { item, createPill } = params; + const filterModel = item.filterModel; + this.filterModel = filterModel; + this.ePill = createPill({ + key: filterModel.type, + displayValue: this.advFilterExpSvc.parseJoinOperator(filterModel), + cssClass: "ag-advanced-filter-builder-join-pill", + isSelect: true, + getEditorParams: () => ({ + values: this.advFilterExpSvc.getJoinOperatorAutocompleteEntries() + }), + update: (key) => filterModel.type = key, + pickerAriaLabelKey: "ariaLabelAdvancedFilterBuilderJoinSelectField", + pickerAriaLabelValue: "Advanced Filter Builder Join Operator Select Field", + ariaLabel: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderJoinOperator") + }); + this.getGui().appendChild(this.ePill.getGui()); + this.addDestroyFunc(() => this.destroyBean(this.ePill)); + } + getDragName() { + return this.advFilterExpSvc.parseJoinOperator(this.filterModel); + } + getAriaLabel() { + return `${this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderGroupItem")} ${this.getDragName()}`; + } + getValidationMessage() { + return null; + } + getFocusableElement() { + return this.ePill.getFocusableElement(); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/selectPillComp.ts +import { + AgInputTextFieldSelector as AgInputTextFieldSelector4, + _setAriaLabel as _setAriaLabel7, + _setAriaLabelledBy as _setAriaLabelledBy2, + _stopPropagationForAgGrid as _stopPropagationForAgGrid5 +} from "ag-grid-community"; +var SelectPillElement = { + tag: "div", + cls: "ag-picker-field ag-advanced-filter-builder-pill-wrapper", + role: "presentation", + children: [ + { tag: "div", ref: "eLabel" }, + { + tag: "div", + ref: "eWrapper", + cls: "ag-wrapper ag-advanced-filter-builder-pill ag-picker-collapsed", + children: [ + { + tag: "div", + ref: "eDisplayField", + cls: "ag-picker-field-display ag-advanced-filter-builder-pill-display" + }, + { tag: "ag-input-text-field", ref: "eInput", cls: "ag-rich-select-field-input" }, + { + tag: "span", + ref: "eDeselect", + cls: "ag-rich-select-deselect-button ag-picker-field-icon", + role: "presentation" + }, + { tag: "div", ref: "eIcon", cls: "ag-picker-field-icon", attrs: { "aria-hidden": "true" } } + ] + } + ] +}; +var SelectPillComp = class extends AgRichSelect { + constructor(params) { + super({ + ...params, + template: SelectPillElement, + agComponents: [AgInputTextFieldSelector4] + }); + this.params = params; + } + getFocusableElement() { + return this.eWrapper; + } + showPicker() { + setTimeout(() => super.showPicker()); + } + hidePicker() { + setTimeout(() => super.hidePicker()); + } + postConstruct() { + super.postConstruct(); + const { wrapperClassName, ariaLabel } = this.params; + this.eWrapper.classList.add(wrapperClassName); + _setAriaLabelledBy2(this.eWrapper, ""); + _setAriaLabel7(this.eWrapper, ariaLabel); + } + createPickerComponent() { + if (!this.values) { + const { values } = this.params.getEditorParams(); + this.values = values; + const key = this.value.key; + const value = values.find((value2) => value2.key === key) ?? { + key, + displayValue: this.value.displayValue + }; + this.value = value; + } + return super.createPickerComponent(); + } + onEnterKeyDown(event) { + _stopPropagationForAgGrid5(event); + if (this.isPickerDisplayed) { + super.onEnterKeyDown(event); + } else { + event.preventDefault(); + this.showPicker(); + } + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderItemComp.ts +var AdvancedFilterBuilderItemElement = { + tag: "div", + cls: "ag-advanced-filter-builder-item-wrapper", + role: "presentation", + children: [ + { + tag: "div", + cls: "ag-advanced-filter-builder-item", + role: "presentation", + children: [ + { + tag: "div", + ref: "eTreeLines", + cls: "ag-advanced-filter-builder-item-tree-lines", + attrs: { "aria-hidden": "true" } + }, + { + tag: "span", + ref: "eDragHandle", + cls: "ag-drag-handle", + attrs: { "aria-hidden": "true" } + }, + { + tag: "span", + ref: "eValidation", + cls: "ag-advanced-filter-builder-item-button ag-advanced-filter-builder-invalid", + attrs: { "aria-hidden": "true" } + } + ] + }, + { + tag: "div", + ref: "eButtons", + cls: "ag-advanced-filter-builder-item-buttons", + children: [ + { tag: "span", ref: "eMoveUpButton", cls: "ag-advanced-filter-builder-item-button", role: "button" }, + { tag: "span", ref: "eMoveDownButton", cls: "ag-advanced-filter-builder-item-button", role: "button" }, + { tag: "div", ref: "eAddButton", role: "presentation" }, + { tag: "span", ref: "eRemoveButton", cls: "ag-advanced-filter-builder-item-button", role: "button" } + ] + } + ] +}; +var AdvancedFilterBuilderItemComp = class extends TabGuardComp { + constructor(item, dragFeature, focusWrapper) { + super(AdvancedFilterBuilderItemElement); + this.item = item; + this.dragFeature = dragFeature; + this.focusWrapper = focusWrapper; + this.eTreeLines = RefPlaceholder16; + this.eDragHandle = RefPlaceholder16; + this.eButtons = RefPlaceholder16; + this.eValidation = RefPlaceholder16; + this.eMoveUpButton = RefPlaceholder16; + this.eMoveDownButton = RefPlaceholder16; + this.eAddButton = RefPlaceholder16; + this.eRemoveButton = RefPlaceholder16; + this.moveUpDisabled = false; + this.moveDownDisabled = false; + } + wireBeans(beans) { + this.dragAndDrop = beans.dragAndDrop; + this.advFilterExpSvc = beans.advFilterExpSvc; + this.registry = beans.registry; + } + postConstruct() { + const { filterModel, level, showMove } = this.item; + const isJoin = filterModel.filterType === "join"; + this.ePillWrapper = this.createManagedBean(isJoin ? new JoinPillWrapperComp() : new ConditionPillWrapperComp()); + this.ePillWrapper.init({ item: this.item, createPill: (params) => this.createPill(params) }); + this.eDragHandle.insertAdjacentElement("afterend", this.ePillWrapper.getGui()); + if (level === 0) { + const eTreeLine = _createElement6({ + tag: "div", + cls: "ag-advanced-filter-builder-item-tree-line ag-advanced-filter-builder-item-tree-line-vertical-bottom ag-advanced-filter-builder-item-tree-line-root" + }); + this.eTreeLines.appendChild(eTreeLine); + _setDisplayed10(this.eDragHandle, false); + _setDisplayed10(this.eButtons, false); + _setAriaExpanded4(this.focusWrapper, true); + } else { + this.setupTreeLines(level); + this.eDragHandle.appendChild(_createIconNoSpan4("advancedFilterBuilderDrag", this.beans)); + this.setupValidation(); + this.setupMoveButtons(showMove); + this.setupAddButton(); + this.setupRemoveButton(); + this.setupDragging(); + this.updateAriaExpanded(); + } + _setAriaLevel2(this.focusWrapper, level + 1); + this.initialiseTabGuard({}); + this.createManagedBean( + new AdvancedFilterBuilderItemNavigationFeature(this.getGui(), this.focusWrapper, this.ePillWrapper) + ); + this.updateAriaLabel(); + this.addManagedListeners(this.ePillWrapper, { + advancedFilterBuilderValueChanged: () => this.dispatchLocalEvent({ + type: "advancedFilterBuilderValueChanged" + }), + advancedFilterBuilderValidChanged: () => this.updateValidity() + }); + } + setState(params) { + const { level } = this.item; + if (level === 0) { + return; + } + const { showMove } = this.item; + const { disableMoveUp, disableMoveDown, treeLines, showStartTreeLine } = params; + this.updateTreeLines(treeLines, showStartTreeLine); + this.updateAriaExpanded(); + if (showMove) { + this.moveUpDisabled = !!disableMoveUp; + this.moveDownDisabled = !!disableMoveDown; + this.eMoveUpButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled", disableMoveUp); + this.eMoveDownButton.classList.toggle("ag-advanced-filter-builder-item-button-disabled", disableMoveDown); + _setAriaDisabled2(this.eMoveUpButton, !!disableMoveUp); + _setAriaDisabled2(this.eMoveDownButton, !!disableMoveDown); + this.moveUpTooltipFeature?.refreshTooltip(); + this.moveDownTooltipFeature?.refreshTooltip(); + } + } + focusMoveButton(backwards) { + (backwards ? this.eMoveUpButton : this.eMoveDownButton).focus(); + } + afterAdd() { + this.ePillWrapper.getFocusableElement().focus(); + } + setupTreeLines(level) { + for (let i = 0; i < level; i++) { + this.eTreeLines.appendChild( + _createElement6({ tag: "div", cls: "ag-advanced-filter-builder-item-tree-line" }) + ); + } + } + updateTreeLines(treeLines, showStartTreeLine) { + const lastTreeLineIndex = treeLines.length - 1; + const { children } = this.eTreeLines; + for (let i = 0; i < lastTreeLineIndex; i++) { + const eTreeLine2 = children.item(i); + if (eTreeLine2) { + eTreeLine2.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical", !treeLines[i]); + } + } + const eTreeLine = children.item(lastTreeLineIndex); + if (eTreeLine) { + eTreeLine.classList.add("ag-advanced-filter-builder-item-tree-line-horizontal"); + const isLastChild = treeLines[lastTreeLineIndex]; + eTreeLine.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical-top", isLastChild); + eTreeLine.classList.toggle("ag-advanced-filter-builder-item-tree-line-vertical", !isLastChild); + } + this.eDragHandle.classList.toggle( + "ag-advanced-filter-builder-item-tree-line-vertical-bottom", + showStartTreeLine + ); + } + setupValidation() { + this.eValidation.appendChild(_createIconNoSpan4("advancedFilterBuilderInvalid", this.beans)); + this.validationTooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eValidation, + getLocation: () => "advancedFilter", + getTooltipValue: () => this.ePillWrapper.getValidationMessage(), + getTooltipShowDelayOverride: () => 1e3 + }) + ); + this.updateValidity(); + } + setupAddButton() { + const addButtonParams = getAdvancedFilterBuilderAddButtonParams( + (key) => this.advFilterExpSvc.translate(key), + this.gos.get("advancedFilterBuilderParams")?.addSelectWidth + ); + const eAddButton = this.createManagedBean(new AddDropdownComp(addButtonParams)); + this.addManagedListeners(eAddButton, { + fieldPickerValueSelected: ({ value }) => this.dispatchLocalEvent({ + type: "advancedFilterBuilderAdded", + item: this.item, + isJoin: value.key === "join" + }) + }); + this.eAddButton.appendChild(eAddButton.getGui()); + this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eAddButton, + getLocation: () => "advancedFilter", + getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderAddButtonTooltip") + }) + ); + } + setupRemoveButton() { + this.eRemoveButton.appendChild(_createIconNoSpan4("advancedFilterBuilderRemove", this.beans)); + this.addManagedListeners(this.eRemoveButton, { + click: () => this.removeItem(), + keydown: (event) => { + if (event.key === KeyCode16.ENTER) { + event.preventDefault(); + _stopPropagationForAgGrid6(event); + this.removeItem(); + } + } + }); + this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eRemoveButton, + getLocation: () => "advancedFilter", + getTooltipValue: () => this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip") + }) + ); + _setAriaLabel8(this.eRemoveButton, this.advFilterExpSvc.translate("advancedFilterBuilderRemoveButtonTooltip")); + this.activateTabIndex([this.eRemoveButton]); + } + setupMoveButtons(showMove) { + if (showMove) { + this.eMoveUpButton.appendChild(_createIconNoSpan4("advancedFilterBuilderMoveUp", this.beans)); + this.addManagedListeners(this.eMoveUpButton, { + click: () => this.moveItem(true), + keydown: (event) => { + if (event.key === KeyCode16.ENTER) { + event.preventDefault(); + _stopPropagationForAgGrid6(event); + this.moveItem(true); + } + } + }); + this.moveUpTooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eMoveUpButton, + getLocation: () => "advancedFilter", + getTooltipValue: () => this.moveUpDisabled ? null : this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip") + }) + ); + _setAriaLabel8( + this.eMoveUpButton, + this.advFilterExpSvc.translate("advancedFilterBuilderMoveUpButtonTooltip") + ); + this.eMoveDownButton.appendChild(_createIconNoSpan4("advancedFilterBuilderMoveDown", this.beans)); + this.addManagedListeners(this.eMoveDownButton, { + click: () => this.moveItem(false), + keydown: (event) => { + if (event.key === KeyCode16.ENTER) { + event.preventDefault(); + _stopPropagationForAgGrid6(event); + this.moveItem(false); + } + } + }); + this.moveDownTooltipFeature = this.createOptionalManagedBean( + this.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.eMoveDownButton, + getLocation: () => "advancedFilter", + getTooltipValue: () => this.moveDownDisabled ? null : this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip") + }) + ); + _setAriaLabel8( + this.eMoveDownButton, + this.advFilterExpSvc.translate("advancedFilterBuilderMoveDownButtonTooltip") + ); + this.activateTabIndex([this.eMoveUpButton, this.eMoveDownButton]); + } else { + _setDisplayed10(this.eMoveUpButton, false); + _setDisplayed10(this.eMoveDownButton, false); + } + } + updateValidity() { + _setVisible(this.eValidation, !this.item.valid); + this.validationTooltipFeature?.refreshTooltip(); + this.updateAriaLabel(); + } + createPill(params) { + const { key, cssClass, update, ariaLabel } = params; + const onUpdated = (key2) => { + if (key2 == null) { + return; + } + update(key2); + this.dispatchLocalEvent({ + type: "advancedFilterBuilderValueChanged" + }); + }; + if (params.isSelect) { + const { getEditorParams, pickerAriaLabelKey, pickerAriaLabelValue, displayValue } = params; + const advancedFilterBuilderParams = this.gos.get("advancedFilterBuilderParams"); + const minPickerWidth = `${advancedFilterBuilderParams?.pillSelectMinWidth ?? 140}px`; + const maxPickerWidth = `${advancedFilterBuilderParams?.pillSelectMaxWidth ?? 200}px`; + const comp = this.createBean( + new SelectPillComp({ + pickerAriaLabelKey, + pickerAriaLabelValue, + pickerType: "ag-list", + value: { + key, + displayValue + }, + valueFormatter: (value) => value == null ? "" : value.displayValue ?? value.key, + variableWidth: true, + minPickerWidth, + maxPickerWidth, + getEditorParams, + wrapperClassName: cssClass, + ariaLabel, + pickerIcon: "advancedFilterBuilderSelectOpen" + }) + ); + this.addManagedListeners(comp, { + fieldPickerValueSelected: ({ value }) => onUpdated(value?.key) + }); + return comp; + } else { + const { baseCellDataType, valueFormatter } = params; + const comp = this.createBean( + new InputPillComp({ + value: key, + valueFormatter, + cssClass, + type: baseCellDataType, + ariaLabel + }) + ); + this.addManagedListeners(comp, { fieldValueChanged: ({ value }) => onUpdated(value) }); + return comp; + } + } + setupDragging() { + const dragSource = { + type: DragSourceType2.AdvancedFilterBuilder, + eElement: this.eDragHandle, + dragItemName: () => this.ePillWrapper.getDragName(), + getDefaultIconName: () => "notAllowed", + getDragItem: () => ({}), + onDragStarted: () => this.dragFeature.dispatchLocalEvent({ + type: "advancedFilterBuilderDragStarted", + item: this.item + }), + onDragStopped: () => this.dragFeature.dispatchLocalEvent({ + type: "advancedFilterBuilderDragEnded" + }) + }; + this.dragAndDrop.addDragSource(dragSource, true); + this.addDestroyFunc(() => this.dragAndDrop.removeDragSource(dragSource)); + } + updateAriaLabel() { + const wrapperLabel = this.ePillWrapper.getAriaLabel(); + const level = `${this.item.level + 1}`; + const validationMessage = this.ePillWrapper.getValidationMessage(); + let ariaLabel; + if (validationMessage) { + ariaLabel = this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItemValidation", [ + wrapperLabel, + level, + validationMessage + ]); + } else { + ariaLabel = this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderItem", [wrapperLabel, level]); + } + _setAriaLabel8(this.focusWrapper, ariaLabel); + } + updateAriaExpanded() { + _removeAriaExpanded(this.focusWrapper); + const { filterModel } = this.item; + if (filterModel?.filterType === "join" && filterModel.conditions.length) { + _setAriaExpanded4(this.focusWrapper, true); + } + } + removeItem() { + this.dispatchLocalEvent({ + type: "advancedFilterBuilderRemoved", + item: this.item + }); + } + moveItem(backwards) { + this.dispatchLocalEvent({ + type: "advancedFilterBuilderMoved", + item: this.item, + backwards + }); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/builder/advancedFilterBuilderComp.ts +var ButtonLocaleMap2 = { + apply: "advancedFilterBuilderApply", + clear: "advancedFilterBuilderClear", + cancel: "advancedFilterBuilderCancel", + reset: "advancedFilterBuilderReset" +}; +var AdvancedFilterBuilderElement = { + tag: "div", + cls: "ag-advanced-filter-builder", + role: "presentation", + attrs: { tabindex: "-1" }, + children: [ + { + tag: "div", + ref: "eList", + cls: "ag-advanced-filter-builder-list", + role: "presentation" + } + ] +}; +var AdvancedFilterBuilderComp = class extends Component13 { + constructor() { + super(AdvancedFilterBuilderElement); + this.eList = RefPlaceholder17; + } + wireBeans(beans) { + this.filterManager = beans.filterManager; + this.advancedFilter = beans.advancedFilter; + this.advFilterExpSvc = beans.advFilterExpSvc; + } + postConstruct() { + const params = this.gos.get("advancedFilterBuilderParams"); + this.params = { buttons: ["apply", "cancel"], ...params }; + this.addManagedPropertyListener("advancedFilterBuilderParams", ({ currentValue }) => { + this.params.showMoveButtons = !!currentValue?.showMoveButtons; + this.params.buttons = currentValue?.buttons ?? ["apply", "cancel"]; + this.refreshList(false); + }); + this.filterModel = this.setupFilterModel(); + this.setupVirtualList(); + this.dragFeature = this.createManagedBean(new AdvancedFilterBuilderDragFeature(this, this.virtualList)); + this.resetButtonsPanel(this.params.buttons); + } + refresh() { + const virtualList = this.virtualList; + let indexToFocus = virtualList.getLastFocusedRow(); + this.setupFilterModel(); + this.validateItems(); + this.refreshList(false); + if (indexToFocus != null) { + if (!virtualList.getComponentAt(indexToFocus)) { + indexToFocus = 0; + } + virtualList.focusRow(indexToFocus); + } + } + getNumItems() { + return this.items.length; + } + moveItem(item, destination) { + if (!destination || !item) { + return; + } + this.moveItemToIndex(item, destination.rowIndex, destination.position); + } + afterGuiAttached() { + this.virtualList.awaitStable(() => this.virtualList.focusRow(0)); + } + setupVirtualList() { + const virtualList = this.virtualList = this.createManagedBean( + new VirtualList({ + cssIdentifier: "advanced-filter-builder", + ariaRole: "tree", + listName: this.advFilterExpSvc.translate("ariaAdvancedFilterBuilderList"), + moveItemCallback: this.virtualListMoveItemCallback.bind(this) + }) + ); + virtualList.setComponentCreator(this.createItemComponent.bind(this)); + virtualList.setComponentUpdater(this.updateItemComponent.bind(this)); + virtualList.setRowHeight(40); + this.eList.appendChild(virtualList.getGui()); + virtualList.setModel({ + getRowCount: () => this.items?.length || 0, + getRow: (index) => this.items[index], + areRowsEqual: (oldRow, newRow) => oldRow === newRow + }); + this.buildList(); + virtualList.refresh(); + } + resetButtonsPanel(actions) { + const hasButtons = actions && actions.length > 0; + let eButtonsPanel = this.eButtons; + if (hasButtons) { + const buttons = actions.map((type) => ({ + type, + label: this.advFilterExpSvc.translate(ButtonLocaleMap2[type]) + })); + if (!eButtonsPanel) { + eButtonsPanel = this.createBean(new FilterButtonComp()); + this.appendChild(eButtonsPanel.getGui()); + const getListener = (action) => ({ event }) => { + this.updateModel(action); + this.afterAction(action, event); + }; + eButtonsPanel.addManagedListeners(eButtonsPanel, { + apply: getListener("apply"), + clear: getListener("clear"), + reset: getListener("reset"), + cancel: getListener("cancel") + }); + this.eButtons = eButtonsPanel; + } + eButtonsPanel.updateButtons(buttons); + const applyButton = eButtonsPanel.getApplyButton(); + if (applyButton) { + const mouseListener = (isEnter) => this.toggleCss("ag-advanced-filter-builder-validation", isEnter); + this.addManagedElementListeners(applyButton, { + mouseenter: () => mouseListener(true), + mouseleave: () => mouseListener(false) + }); + } + } else if (eButtonsPanel) { + _removeFromParent3(eButtonsPanel.getGui()); + this.eButtons = this.destroyBean(eButtonsPanel); + } + } + updateModel(action) { + switch (action) { + case "apply": + this.advancedFilter.setModel(this.filterModel); + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + break; + case "reset": + this.advancedFilter.setModel(null); + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + break; + case "cancel": + break; + case "clear": + this.filterModel = this.formatFilterModel(null); + this.refreshList(false); + break; + } + } + afterAction(action, event) { + switch (action) { + case "apply": { + event?.preventDefault(); + this.close(); + break; + } + case "reset": { + this.close(); + break; + } + case "cancel": { + this.close(); + break; + } + } + } + removeItemFromParent(item) { + const sourceParentIndex = item.parent.conditions.indexOf(item.filterModel); + item.parent.conditions.splice(sourceParentIndex, 1); + return sourceParentIndex; + } + moveItemToIndex(item, destinationRowIndex, destinationPosition) { + const destinationItem = this.items[destinationRowIndex]; + const destinationIsParent = destinationItem.filterModel?.filterType === "join" && destinationPosition === "bottom"; + const destinationParent = destinationIsParent ? destinationItem.filterModel : destinationItem.parent; + if (!destinationParent) { + return; + } + if (this.isChildOrSelf(destinationParent, item.filterModel) || destinationItem === item) { + return; + } + this.removeItemFromParent(item); + let destinationParentIndex; + if (destinationIsParent) { + destinationParentIndex = 0; + } else { + destinationParentIndex = destinationParent.conditions.indexOf(destinationItem.filterModel); + if (destinationParentIndex === -1) { + destinationParentIndex = destinationParent.conditions.length; + } else if (destinationPosition === "bottom") { + destinationParentIndex += 1; + } + } + destinationParent.conditions.splice(destinationParentIndex, 0, item.filterModel); + this.refreshList(false); + } + isChildOrSelf(modelToCheck, potentialParentModel) { + return modelToCheck === potentialParentModel || potentialParentModel.filterType === "join" && potentialParentModel.conditions.some((condition) => this.isChildOrSelf(modelToCheck, condition)); + } + setupFilterModel() { + const filterModel = this.formatFilterModel(this.advancedFilter.getModel()); + this.stringifiedModel = JSON.stringify(filterModel); + return filterModel; + } + formatFilterModel(filterModel) { + filterModel = filterModel ?? { + filterType: "join", + type: "AND", + conditions: [] + }; + if (filterModel.filterType !== "join") { + filterModel = { + filterType: "join", + type: "AND", + conditions: [filterModel] + }; + } + return filterModel; + } + buildList() { + const parseFilterModel = (filterModel, items, level, parent) => { + items.push({ filterModel, level, parent, valid: true, showMove: this.params.showMoveButtons }); + if (filterModel.filterType === "join") { + for (const childFilterModel of filterModel.conditions) { + parseFilterModel(childFilterModel, items, level + 1, filterModel); + } + if (level === 0) { + items.push({ filterModel: null, level: level + 1, parent: filterModel, valid: true }); + } + } + }; + this.items = []; + parseFilterModel(this.filterModel, this.items, 0); + } + refreshList(softRefresh) { + if (!softRefresh) { + const invalidModels = []; + for (const item of this.items) { + if (!item.valid) { + invalidModels.push(item.filterModel); + } + } + this.buildList(); + if (invalidModels.length) { + for (const item of this.items) { + if (item.filterModel && invalidModels.includes(item.filterModel)) { + item.valid = false; + } + } + } + } + this.virtualList.refresh(softRefresh); + this.validate(); + } + updateItemComponent(item, comp) { + const index = this.items.indexOf(item); + const populateTreeLines = (filterModel2, treeLines2) => { + const parentItem = this.items.find((itemToCheck) => itemToCheck.filterModel === filterModel2); + const parentFilterModel = parentItem?.parent; + if (parentFilterModel) { + const { conditions } = parentFilterModel; + populateTreeLines(parentFilterModel, treeLines2); + treeLines2.push(conditions[conditions.length - 1] === filterModel2); + } + }; + const treeLines = []; + const { filterModel } = item; + if (filterModel) { + populateTreeLines(filterModel, treeLines); + treeLines[0] = false; + } + const showStartTreeLine = filterModel?.filterType === "join" && !!filterModel.conditions.length; + comp.setState({ + disableMoveUp: index === 1, + disableMoveDown: !this.canMoveDown(item, index), + treeLines, + showStartTreeLine + }); + } + createItemComponent(item, focusWrapper) { + const itemComp = this.createBean( + item.filterModel ? new AdvancedFilterBuilderItemComp(item, this.dragFeature, focusWrapper) : new AdvancedFilterBuilderItemAddComp(item, focusWrapper) + ); + itemComp.addManagedListeners(itemComp, { + advancedFilterBuilderRemoved: ({ item: item2 }) => this.removeItem(item2), + advancedFilterBuilderValueChanged: () => this.validate(), + advancedFilterBuilderAdded: ({ item: item2, isJoin }) => this.addItem(item2, isJoin), + advancedFilterBuilderMoved: ({ item: item2, backwards }) => this.moveItemUpDown(item2, backwards) + }); + if (itemComp instanceof AdvancedFilterBuilderItemComp) { + this.updateItemComponent(item, itemComp); + } + return itemComp; + } + addItem(item, isJoin) { + const { parent: itemParent, level, filterModel: itemFilterModel } = item; + const itemIsJoin = itemFilterModel?.filterType === "join"; + const filterModel = isJoin ? { + filterType: "join", + type: "AND", + conditions: [] + } : {}; + const parent = itemIsJoin ? itemFilterModel : itemParent; + let insertIndex = itemIsJoin ? 0 : parent.conditions.indexOf(itemFilterModel); + if (insertIndex >= 0) { + if (!itemIsJoin) { + insertIndex += 1; + } + parent.conditions.splice(insertIndex, 0, filterModel); + } else { + parent.conditions.push(filterModel); + } + let index = this.items.indexOf(item); + const softRefresh = index >= 0; + if (softRefresh) { + if (item.filterModel) { + index++; + } + const newItems = [ + { + filterModel, + level: itemIsJoin ? level + 1 : level, + parent, + valid: isJoin, + showMove: this.params.showMoveButtons + } + ]; + this.items.splice(index, 0, ...newItems); + } + this.refreshList(softRefresh); + if (softRefresh) { + this.virtualList.getComponentAt(index)?.afterAdd(); + } + } + removeItem(item) { + const parent = item.parent; + const { filterModel } = item; + const parentIndex = parent.conditions.indexOf(filterModel); + parent.conditions.splice(parentIndex, 1); + const isJoin = item.filterModel?.filterType === "join"; + const index = this.items.indexOf(item); + const softRefresh = !isJoin && index >= 0; + if (softRefresh) { + this.items.splice(index, 1); + } + this.refreshList(softRefresh); + if (index >= 0) { + this.virtualList.focusRow(index); + } + } + moveItemUpDown(item, backwards, fromVirtualList) { + const itemIndex = this.items.indexOf(item); + const destinationIndex = backwards ? itemIndex - 1 : itemIndex + 1; + if (destinationIndex === 0 || !backwards && !this.canMoveDown(item, itemIndex)) { + return; + } + const destinationItem = this.items[destinationIndex]; + const indexInParent = this.removeItemFromParent(item); + const { level, filterModel, parent } = item; + const { + level: destinationLevel, + filterModel: destinationFilterModel, + parent: destinationParent + } = destinationItem; + if (backwards) { + if (destinationLevel === level && destinationFilterModel.filterType === "join") { + destinationFilterModel.conditions.push(filterModel); + } else if (destinationLevel <= level) { + const destinationIndex2 = destinationParent.conditions.indexOf(destinationFilterModel); + destinationParent.conditions.splice(destinationIndex2, 0, filterModel); + } else { + const newParentItem = parent.conditions[indexInParent - 1]; + newParentItem.conditions.push(filterModel); + } + } else if (destinationLevel === level) { + if (destinationFilterModel.filterType === "join") { + destinationFilterModel.conditions.splice(0, 0, filterModel); + } else { + const destinationIndex2 = destinationParent.conditions.indexOf(destinationFilterModel); + destinationParent.conditions.splice(destinationIndex2 + 1, 0, filterModel); + } + } else if (indexInParent < parent.conditions.length) { + parent.conditions.splice(indexInParent + 1, 0, filterModel); + } else { + const parentItem = this.items.find((itemToCheck) => itemToCheck.filterModel === parent); + const destinationIndex2 = parentItem.parent.conditions.indexOf(parentItem.filterModel) + 1; + parentItem.parent.conditions.splice(destinationIndex2, 0, filterModel); + } + this.refreshList(false); + const newIndex = this.items.findIndex( + ({ filterModel: filterModelToCheck }) => filterModelToCheck === filterModel + ); + if (newIndex < 0) { + return; + } + const comp = this.virtualList.getComponentAt(newIndex); + if (!(comp instanceof AdvancedFilterBuilderItemComp)) { + return; + } + if (!fromVirtualList) { + comp.focusMoveButton(backwards); + } + } + virtualListMoveItemCallback(itemComp, isUp) { + const item = itemComp.item; + const from = this.items.indexOf(item); + if (from <= 0 || from === this.items.length - 1) { + return; + } + if (isUp && from === 1 || !isUp && !this.canMoveDown(item, from)) { + return; + } + this.moveItemUpDown(item, isUp, true); + this.virtualList.focusRow(from + (isUp ? -1 : 1)); + } + canMoveDown(item, index) { + return !(item.level === 1 && index === this.items.length - 2 || item.level === 1 && item.parent.conditions[item.parent.conditions.length - 1] === item.filterModel); + } + close() { + this.advancedFilter.getCtrl().toggleFilterBuilder({ source: "ui" }); + } + validate() { + let isValid = this.items.every(({ valid }) => valid); + let validationMessage = null; + if (isValid) { + isValid = JSON.stringify(this.filterModel) !== this.stringifiedModel; + if (!isValid) { + validationMessage = this.advFilterExpSvc.translate("advancedFilterBuilderValidationAlreadyApplied"); + } + } else { + validationMessage = this.advFilterExpSvc.translate("advancedFilterBuilderValidationIncomplete"); + } + this.eButtons?.updateValidity(isValid, validationMessage); + } + validateItems() { + const clearOperator = (filterModel) => { + filterModel.type = void 0; + }; + const clearOperand = (filterModel) => { + delete filterModel.filter; + }; + for (const item of this.items) { + if (!item.valid || !item.filterModel || item.filterModel.filterType === "join") { + continue; + } + const { filterModel } = item; + const { colId } = filterModel; + const hasColumn = this.advFilterExpSvc.getColumnAutocompleteEntries().find(({ key }) => key === colId); + const columnDetails = this.advFilterExpSvc.getColumnDetails(filterModel.colId); + if (!hasColumn || !columnDetails.column) { + item.valid = false; + filterModel.colId = void 0; + clearOperator(filterModel); + clearOperand(filterModel); + continue; + } + const operatorForType = this.advFilterExpSvc.getDataTypeExpressionOperator(columnDetails.baseCellDataType); + const operator = operatorForType.operators[filterModel.type]; + if (!operator) { + item.valid = false; + clearOperator(filterModel); + clearOperand(filterModel); + continue; + } + if (operator.numOperands > 0 && !_exists10(filterModel.filter)) { + item.valid = false; + } + } + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterCtrl.ts +var AdvancedFilterCtrl = class extends BeanStub5 { + constructor(enabled) { + super(); + this.enabled = enabled; + } + wireBeans(beans) { + this.ctrlsSvc = beans.ctrlsSvc; + this.popupSvc = beans.popupSvc; + this.advFilterExpSvc = beans.advFilterExpSvc; + this.environment = beans.environment; + } + postConstruct() { + this.hasAdvancedFilterParent = !!this.gos.get("advancedFilterParent"); + this.ctrlsSvc.whenReady(this, () => this.setAdvancedFilterComp()); + this.addManagedEventListeners({ + advancedFilterEnabledChanged: ({ enabled }) => this.onEnabledChanged(enabled) + }); + this.addManagedPropertyListener("advancedFilterParent", () => this.updateComps()); + this.addManagedPropertyListener("advancedFilterBuilderParams", (event) => { + if (event.currentValue?.suppressFullScreenButton !== event.previousValue?.suppressFullScreenButton) { + this.eBuilderDialog?.setMaximizable(event.currentValue?.suppressFullScreenButton ?? true); + } + }); + this.addDestroyFunc(() => { + this.destroyAdvancedFilterComp(); + this.destroyBean(this.eBuilderComp); + if (this.eBuilderDialog?.isAlive()) { + this.destroyBean(this.eBuilderDialog); + } + }); + } + setupHeaderComp(eCompToInsertBefore) { + if (this.eHeaderComp) { + this.eHeaderComp?.getGui().remove(); + this.destroyBean(this.eHeaderComp); + } + this.eHeaderComp = this.createManagedBean( + new AdvancedFilterHeaderComp(this.enabled && !this.hasAdvancedFilterParent) + ); + eCompToInsertBefore.insertAdjacentElement("beforebegin", this.eHeaderComp.getGui()); + } + focusHeaderComp() { + if (this.eHeaderComp) { + this.eHeaderComp.getFocusableElement().focus(); + return true; + } + return false; + } + refreshComp() { + this.eFilterComp?.refresh(); + this.eHeaderComp?.refresh(); + } + refreshBuilderComp() { + this.eBuilderComp?.refresh(); + } + getHeaderHeight() { + return this.eHeaderComp?.getHeight() ?? 0; + } + setInputDisabled(disabled) { + this.eFilterComp?.setInputDisabled(disabled); + this.eHeaderComp?.setInputDisabled(disabled); + } + toggleFilterBuilder(params) { + const { source, force, eventSource } = params; + if (force && this.eBuilderDialog || force === false && !this.eBuilderDialog) { + return; + } + if (this.eBuilderDialog) { + this.builderDestroySource = source; + this.destroyBean(this.eBuilderDialog); + return; + } + this.setInputDisabled(true); + const { width, height, minWidth } = this.getBuilderDialogSize(); + const { suppressFullScreenButton } = { + suppressFullScreenButton: false, + ...this.gos.get("advancedFilterBuilderParams") + }; + this.eBuilderComp = this.createBean(new AdvancedFilterBuilderComp()); + this.eBuilderDialog = this.createBean( + new Dialog({ + title: this.advFilterExpSvc.translate("advancedFilterBuilderTitle"), + component: this.eBuilderComp, + width, + height, + resizable: true, + movable: true, + maximizable: !suppressFullScreenButton, + centered: true, + closable: true, + minWidth, + afterGuiAttached: () => this.eBuilderComp?.afterGuiAttached(), + postProcessPopupParams: { + type: "advancedFilterBuilder", + eventSource + } + }) + ); + this.dispatchFilterBuilderVisibleChangedEvent(source, true); + this.eBuilderDialog.addEventListener("destroyed", () => { + this.destroyBean(this.eBuilderComp); + this.eBuilderComp = void 0; + this.eBuilderDialog = void 0; + this.setInputDisabled(false); + this.dispatchLocalEvent({ + type: "advancedFilterBuilderClosed" + }); + this.dispatchFilterBuilderVisibleChangedEvent(this.builderDestroySource ?? "ui", false); + this.builderDestroySource = void 0; + }); + } + dispatchFilterBuilderVisibleChangedEvent(source, visible) { + this.eventSvc.dispatchEvent({ + type: "advancedFilterBuilderVisibleChanged", + source, + visible + }); + } + getBuilderDialogSize() { + const minWidth = this.gos.get("advancedFilterBuilderParams")?.minWidth ?? 500; + const popupParent = this.popupSvc.getPopupParent(); + const maxWidth = Math.round(_getAbsoluteWidth(popupParent)) - 2; + const maxHeight = Math.round(_getAbsoluteHeight(popupParent) * 0.75) - 2; + const width = Math.min(Math.max(700, minWidth), maxWidth); + const height = Math.min(600, maxHeight); + return { width, height, minWidth }; + } + onEnabledChanged(enabled) { + this.enabled = enabled; + this.updateComps(); + } + updateComps() { + this.setAdvancedFilterComp(); + this.setHeaderCompEnabled(); + this.eventSvc.dispatchEvent({ + type: "headerHeightChanged" + }); + } + setAdvancedFilterComp() { + this.destroyAdvancedFilterComp(); + if (!this.enabled) { + return; + } + const advancedFilterParent = this.gos.get("advancedFilterParent"); + this.hasAdvancedFilterParent = !!advancedFilterParent; + if (advancedFilterParent) { + const eAdvancedFilterComp = this.createBean(new AdvancedFilterComp()); + const eAdvancedFilterCompGui = eAdvancedFilterComp.getGui(); + this.environment.applyThemeClasses(eAdvancedFilterCompGui); + eAdvancedFilterCompGui.classList.add(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr"); + advancedFilterParent.appendChild(eAdvancedFilterCompGui); + this.eFilterComp = eAdvancedFilterComp; + } + } + setHeaderCompEnabled() { + this.eHeaderComp?.setEnabled(this.enabled && !this.hasAdvancedFilterParent); + } + destroyAdvancedFilterComp() { + if (this.eFilterComp) { + _removeFromParent4(this.eFilterComp.getGui()); + this.destroyBean(this.eFilterComp); + } + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/joinFilterExpressionParser.ts +var OperatorParser2 = class { + constructor(params) { + this.params = params; + this.operators = []; + this.operatorStartPositions = []; + this.operatorEndPositions = []; + this.activeOperator = 0; + this.validationError = null; + } + parseExpression(i) { + this.operators.push(""); + this.operatorStartPositions.push(i); + this.operatorEndPositions.push(void 0); + const { expression } = this.params; + while (i < expression.length) { + const char = expression[i]; + if (char === " ") { + const isComplete = this.parseOperator(i - 1); + if (isComplete) { + this.activeOperator++; + return i - 1; + } else { + this.operators[this.activeOperator] += char; + } + } else { + this.operators[this.activeOperator] += char; + } + i++; + } + this.parseOperator(i - 1); + return i; + } + 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(position, operatorIndex) { + let searchString; + if (operatorIndex == null) { + searchString = ""; + } else { + const operator = this.operators[operatorIndex]; + const operatorEndPosition = this.operatorEndPositions[operatorIndex]; + searchString = getSearchString( + operator, + position, + operatorEndPosition == null ? this.params.expression.length : operatorEndPosition + 1 + ); + } + let entries = this.params.advFilterExpSvc.getJoinOperatorAutocompleteEntries(); + if (operatorIndex || operatorIndex == null && this.activeOperator) { + entries = entries.filter(({ key }) => key === this.parsedOperator); + } + return this.params.advFilterExpSvc.generateAutocompleteListParams(entries, "join", searchString); + } + updateExpression(position, updateEntry, operatorIndex) { + let { expression } = this.params; + const updatedValuePart = updateEntry.displayValue ?? updateEntry.key; + if (operatorIndex === 0) { + for (let i = this.operatorEndPositions.length - 1; i > 0; i--) { + const operatorEndPosition = this.operatorEndPositions[i]; + if (operatorEndPosition == null) { + continue; + } + expression = updateExpression( + expression, + this.operatorStartPositions[i], + operatorEndPosition, + updatedValuePart + ).updatedValue; + } + } + const startPosition = this.operatorStartPositions.length > operatorIndex ? this.operatorStartPositions[operatorIndex] : position; + const endPosition = (this.operatorEndPositions.length > operatorIndex ? this.operatorEndPositions[operatorIndex] : void 0) ?? findEndPosition(expression, position, true).endPosition; + return updateExpression(expression, startPosition, endPosition, updatedValuePart, true); + } + getNumOperators() { + return this.operators.length; + } + getLastOperatorEndPosition() { + return this.operatorEndPositions[this.operatorEndPositions.length - 1]; + } + parseOperator(endPosition) { + const operator = this.operators.length > this.activeOperator ? this.operators[this.activeOperator] : ""; + const joinOperators = this.params.advFilterExpSvc.getExpressionJoinOperators(); + const parsedValue = findMatch(operator, joinOperators, (v) => v); + if (parsedValue) { + this.operatorEndPositions[this.activeOperator] = endPosition; + const displayValue = joinOperators[parsedValue]; + if (this.activeOperator) { + if (parsedValue !== this.parsedOperator) { + if (!this.validationError) { + this.validationError = { + message: this.params.advFilterExpSvc.translate( + "advancedFilterValidationJoinOperatorMismatch" + ), + startPosition: endPosition - operator.length + 1, + endPosition + }; + } + return false; + } + } else { + this.parsedOperator = parsedValue; + } + if (operator !== displayValue) { + checkAndUpdateExpression(this.params, operator, displayValue, endPosition); + this.operators[this.activeOperator] = displayValue; + } + return true; + } else if (parsedValue === null) { + return false; + } else { + if (!this.validationError) { + this.validationError = { + message: this.params.advFilterExpSvc.translate("advancedFilterValidationInvalidJoinOperator"), + startPosition: endPosition - operator.length + 1, + endPosition + }; + } + return true; + } + } +}; +var JoinFilterExpressionParser = class _JoinFilterExpressionParser { + constructor(params, startPosition) { + this.params = params; + this.startPosition = startPosition; + this.expectingExpression = true; + this.expectingOperator = false; + this.expressionParsers = []; + this.operatorParser = new OperatorParser2(this.params); + this.missingEndBracket = false; + this.extraEndBracket = false; + } + parseExpression() { + let i = this.startPosition; + const { expression } = this.params; + while (i < expression.length) { + const char = expression[i]; + if (char === "(" && !this.expectingOperator) { + const nestedParser = new _JoinFilterExpressionParser(this.params, i + 1); + i = nestedParser.parseExpression(); + this.expressionParsers.push(nestedParser); + this.expectingExpression = false; + this.expectingOperator = true; + } else if (char === ")") { + this.endPosition = i - 1; + if (this.startPosition === 0) { + this.extraEndBracket = true; + } + return i; + } else if (char === " ") { + } else if (this.expectingExpression) { + const nestedParser = new ColFilterExpressionParser(this.params, i); + i = nestedParser.parseExpression(); + this.expressionParsers.push(nestedParser); + this.expectingExpression = false; + this.expectingOperator = true; + } else if (this.expectingOperator) { + i = this.operatorParser.parseExpression(i); + this.expectingOperator = false; + this.expectingExpression = true; + } + i++; + } + if (this.startPosition > 0) { + this.missingEndBracket = true; + } + return i; + } + isValid() { + return !this.missingEndBracket && !this.extraEndBracket && this.expressionParsers.length === this.operatorParser.getNumOperators() + 1 && this.operatorParser.isValid() && this.expressionParsers.every((expressionParser) => expressionParser.isValid()); + } + getValidationError() { + const operatorError = this.operatorParser.getValidationError(); + for (let i = 0; i < this.expressionParsers.length; i++) { + const expressionError = this.expressionParsers[i].getValidationError(); + if (expressionError) { + return operatorError && operatorError.startPosition < expressionError.startPosition ? operatorError : expressionError; + } + } + if (operatorError) { + return operatorError; + } + if (this.extraEndBracket) { + return { + message: this.params.advFilterExpSvc.translate("advancedFilterValidationExtraEndBracket"), + startPosition: this.endPosition + 1, + endPosition: this.endPosition + 1 + }; + } + let translateKey; + if (this.expressionParsers.length === this.operatorParser.getNumOperators()) { + translateKey = "advancedFilterValidationMissingCondition"; + } else if (this.missingEndBracket) { + translateKey = "advancedFilterValidationMissingEndBracket"; + } + if (translateKey) { + return { + message: this.params.advFilterExpSvc.translate(translateKey), + startPosition: this.params.expression.length, + endPosition: this.params.expression.length + }; + } + return null; + } + getFunction(params) { + const operator = this.operatorParser.getFunction(); + const funcs = this.expressionParsers.map((expressionParser) => expressionParser.getFunction(params)); + const arrayFunc = operator === "&&" ? "every" : "some"; + return (expressionProxy, node, p) => funcs[arrayFunc]((func) => func(expressionProxy, node, p)); + } + getAutocompleteListParams(position) { + if (this.endPosition != null && position > this.endPosition + 1) { + return void 0; + } + if (!this.expressionParsers.length) { + return this.getColumnAutocompleteListParams(); + } + const expressionParserIndex = this.getExpressionParserIndex(position); + if (expressionParserIndex == null) { + if (this.params.expression[position] === "(") { + return { enabled: false }; + } + return this.getColumnAutocompleteListParams(); + } + const expressionParser = this.expressionParsers[expressionParserIndex]; + const autocompleteType = expressionParser.getAutocompleteListParams(position); + if (!autocompleteType) { + if (expressionParserIndex < this.expressionParsers.length - 1) { + return this.operatorParser.getAutocompleteListParams(position, expressionParserIndex); + } + if (this.expressionParsers.length === this.operatorParser.getNumOperators()) { + const operatorEndPosition = this.operatorParser.getLastOperatorEndPosition(); + return operatorEndPosition == null || position <= operatorEndPosition + 1 ? this.operatorParser.getAutocompleteListParams(position, this.operatorParser.getNumOperators() - 1) : this.getColumnAutocompleteListParams(); + } + if (this.params.expression[position - 1] === ")") { + return { enabled: false }; + } + return this.operatorParser.getAutocompleteListParams(position); + } + return autocompleteType; + } + updateExpression(position, updateEntry, type) { + const expression = this.params.expression; + const expressionParserIndex = this.getExpressionParserIndex(position); + if (expressionParserIndex == null) { + const updatedValuePart = type === "column" ? this.params.advFilterExpSvc.getColumnValue(updateEntry) : updateEntry.displayValue ?? updateEntry.key; + return updateExpression(expression, this.startPosition, this.startPosition, updatedValuePart, true); + } + const expressionParser = this.expressionParsers[expressionParserIndex]; + const updatedExpression = expressionParser.updateExpression(position, updateEntry, type); + if (updatedExpression == null) { + if (type === "column") { + return updateExpression( + expression, + position, + expression.length - 1, + this.params.advFilterExpSvc.getColumnValue(updateEntry), + true + ); + } else if (this.endPosition != null && position > this.endPosition + 1) { + return null; + } else { + return this.operatorParser.updateExpression(position, updateEntry, expressionParserIndex); + } + } + return updatedExpression; + } + getModel() { + if (this.expressionParsers.length > 1) { + return { + filterType: "join", + type: this.operatorParser.getModel(), + conditions: this.expressionParsers.map((parser) => parser.getModel()) + }; + } else { + return this.expressionParsers[0].getModel(); + } + } + getColumnAutocompleteListParams() { + return this.params.advFilterExpSvc.generateAutocompleteListParams( + this.params.advFilterExpSvc.getColumnAutocompleteEntries(), + "column", + "" + ); + } + getExpressionParserIndex(position) { + let expressionParserIndex; + for (let i = 0; i < this.expressionParsers.length; i++) { + const expressionParserToCheck = this.expressionParsers[i]; + if (expressionParserToCheck.startPosition > position) { + break; + } + expressionParserIndex = i; + } + return expressionParserIndex; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/filterExpressionParser.ts +var FilterExpressionParser = class { + constructor(params) { + this.params = params; + this.valid = false; + } + parseExpression() { + this.joinExpressionParser = new JoinFilterExpressionParser(this.params, 0); + const i = this.joinExpressionParser.parseExpression(); + this.valid = i >= this.params.expression.length - 1 && this.joinExpressionParser.isValid(); + return this.params.expression; + } + isValid() { + return this.valid; + } + getValidationMessage() { + const error = this.joinExpressionParser.getValidationError(); + if (!error) { + return null; + } + const { message, startPosition, endPosition } = error; + return startPosition < this.params.expression.length ? this.params.advFilterExpSvc.translate("advancedFilterValidationMessage", [ + message, + this.params.expression.slice(startPosition, endPosition + 1).trim() + ]) : this.params.advFilterExpSvc.translate("advancedFilterValidationMessageAtEnd", [message]); + } + getFunction() { + const params = this.createFunctionParams(); + return { + expressionFunction: this.joinExpressionParser.getFunction(params), + params + }; + } + getAutocompleteListParams(position) { + return this.joinExpressionParser.getAutocompleteListParams(position) ?? { enabled: false }; + } + updateExpression(position, updateEntry, type) { + return this.joinExpressionParser.updateExpression(position, updateEntry, type); + } + getModel() { + return this.isValid() ? this.joinExpressionParser.getModel() : null; + } + createFunctionParams() { + return { + operands: [], + operators: [], + evaluatorParams: [] + }; + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterService.ts +var AdvancedFilterService = class extends BeanStub6 { + constructor() { + super(...arguments); + this.beanName = "advancedFilter"; + this.appliedExpression = null; + /** The value displayed in the input, which may be invalid */ + this.expression = null; + this.isValid = true; + } + wireBeans(beans) { + this.valueSvc = beans.valueSvc; + this.colModel = beans.colModel; + this.dataTypeSvc = beans.dataTypeSvc; + this.advFilterExpSvc = beans.advFilterExpSvc; + this.filterValueSvc = beans.filterValueSvc; + this.filterManager = beans.filterManager; + } + postConstruct() { + this.setEnabled(this.gos.get("enableAdvancedFilter"), true); + this.ctrl = this.createManagedBean(new AdvancedFilterCtrl(this.enabled)); + this.expressionProxy = { + getValue: (colId, node) => { + const column = this.colModel.getColDefCol(colId); + return column ? this.filterValueSvc.getValue(column, node) : void 0; + } + }; + this.addManagedPropertyListener("enableAdvancedFilter", (event) => this.setEnabled(!!event.currentValue)); + this.addManagedEventListeners({ + newColumnsLoaded: (event) => this.onNewColumnsLoaded(event) + }); + this.addManagedPropertyListener("includeHiddenColumnsInAdvancedFilter", () => { + const updatedValidity = this.updateValidity(); + if (updatedValidity) { + this.filterManager?.onFilterChanged({ source: "advancedFilter" }); + } + }); + } + isEnabled() { + return this.enabled; + } + isFilterPresent() { + return !!this.expressionFunction; + } + doesFilterPass(node) { + return this.expressionFunction(this.expressionProxy, node, this.expressionParams); + } + getModel() { + const expressionParser = this.createExpressionParser(this.appliedExpression); + expressionParser?.parseExpression(); + return expressionParser?.getModel() ?? null; + } + setModel(model) { + const parseModel = (model2, isFirstParent) => { + if (model2.filterType === "join") { + const operator = this.advFilterExpSvc.parseJoinOperator(model2); + const expression2 = model2.conditions.map((condition) => parseModel(condition)).filter((condition) => _exists11(condition)).join(` ${operator} `); + return isFirstParent || model2.conditions.length <= 1 ? expression2 : `(${expression2})`; + } else { + return this.advFilterExpSvc.parseColumnFilterModel(model2); + } + }; + const expression = model ? parseModel(model, true) : null; + this.setExpressionDisplayValue(expression); + this.applyExpression(); + this.ctrl.refreshComp(); + this.ctrl.refreshBuilderComp(); + } + getExpressionDisplayValue() { + return this.expression; + } + setExpressionDisplayValue(expression) { + this.expression = expression; + } + isCurrentExpressionApplied() { + return this.appliedExpression === this.expression; + } + createExpressionParser(expression) { + if (!expression) { + return null; + } + return new FilterExpressionParser({ + expression, + colModel: this.colModel, + dataTypeSvc: this.dataTypeSvc, + valueSvc: this.valueSvc, + advFilterExpSvc: this.advFilterExpSvc + }); + } + getDefaultExpression(updateEntry) { + const updatedValue = this.advFilterExpSvc.getColumnValue(updateEntry) + " "; + return { + updatedValue, + updatedPosition: updatedValue.length + }; + } + isHeaderActive() { + return !this.gos.get("advancedFilterParent"); + } + getCtrl() { + return this.ctrl; + } + setEnabled(enabled, silent) { + const previousValue = this.enabled; + const isValidRowModel = _isClientSideRowModel(this.gos) || _isServerSideRowModel(this.gos); + if (enabled && !isValidRowModel) { + _warn4(123); + } + this.enabled = enabled && isValidRowModel; + if (!silent && this.enabled !== previousValue) { + this.eventSvc.dispatchEvent({ + type: "advancedFilterEnabledChanged", + enabled: this.enabled + }); + } + } + applyExpression() { + const expressionParser = this.createExpressionParser(this.expression); + expressionParser?.parseExpression(); + this.applyExpressionFromParser(expressionParser); + } + getAppliedExpressionDisplayValue() { + return this.appliedExpression; + } + applyExpressionFromParser(expressionParser) { + this.isValid = !expressionParser || expressionParser.isValid(); + if (!expressionParser || !this.isValid) { + this.expressionFunction = null; + this.expressionParams = null; + this.appliedExpression = null; + return; + } + const { expressionFunction, params } = expressionParser.getFunction(); + this.expressionFunction = expressionFunction; + this.expressionParams = params; + this.appliedExpression = this.expression; + } + updateValidity() { + this.advFilterExpSvc.resetColumnCaches(); + const expressionParser = this.createExpressionParser(this.expression); + expressionParser?.parseExpression(); + const isValid = !expressionParser || expressionParser.isValid(); + const updatedValidity = isValid !== this.isValid; + this.applyExpressionFromParser(expressionParser); + this.ctrl.refreshComp(); + this.ctrl.refreshBuilderComp(); + return updatedValidity; + } + onNewColumnsLoaded(event) { + if (event.source !== "gridInitializing" || !this.dataTypeSvc?.isPendingInference) { + return; + } + this.ctrl.setInputDisabled(true); + const [destroyFunc] = this.addManagedEventListeners({ + dataTypesInferred: () => { + destroyFunc?.(); + this.ctrl.setInputDisabled(false); + } + }); + } +}; + +// packages/ag-grid-enterprise/src/advancedFilter/advancedFilterModule.ts +var AdvancedFilterModule = { + moduleName: "AdvancedFilter", + version: VERSION, + beans: [AdvancedFilterService, AdvancedFilterExpressionService], + icons: { + // Builder button in Advanced Filter + advancedFilterBuilder: "group", + // drag handle used to pick up Advanced Filter Builder rows + advancedFilterBuilderDrag: "grip", + // Advanced Filter Builder row validation error + advancedFilterBuilderInvalid: "not-allowed", + // shown on Advanced Filter Builder rows to move them up + advancedFilterBuilderMoveUp: "up", + // shown on Advanced Filter Builder rows to move them down + advancedFilterBuilderMoveDown: "down", + // shown on Advanced Filter Builder rows to add new rows + advancedFilterBuilderAdd: "plus", + // shown on Advanced Filter Builder rows to remove row + advancedFilterBuilderRemove: "minus", + // shown on Advanced Filter Builder selection pills + advancedFilterBuilderSelectOpen: "small-down", + // remove for rich select editor pills + richSelectRemove: "cancel", + // loading async values + richSelectLoading: "loading" + }, + apiFunctions: { + getAdvancedFilterModel, + setAdvancedFilterModel, + showAdvancedFilterBuilder, + hideAdvancedFilterBuilder + }, + dependsOn: [ + EnterpriseCoreModule, + _FilterCoreModule, + _SharedDragAndDropModule, + _PopupModule, + _FilterValueModule, + TooltipModule + ], + css: [advanced_filter_default] +}; + +// packages/ag-grid-enterprise/src/aiToolkit/aiToolkitModule.ts +import { ColumnApiModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/aiToolkit/structuredSchema.ts +import { STRUCTURED_SCHEMA_FEATURES } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/aiToolkit/schemaBuilder.ts +var BaseSchemaBuilder = class { + constructor(description) { + this._defs = {}; + this._nullable = false; + this.description = description; + } + _collectNestedDefs(schemas) { + const allDefs = { ...this._defs }; + for (const schema of schemas) { + if (schema && typeof schema === "object" && "$defs" in schema) { + Object.assign(allDefs, schema.$defs); + delete schema.$defs; + } + } + return allDefs; + } + _toJSON(additionalProperties = {}) { + const result = { + type: this._nullable ? [this.type, "null"] : this.type, + description: this.description, + ...additionalProperties + }; + if (Object.keys(this._defs).length > 0) { + result.$defs = this._defs; + } + return result; + } + nullable() { + this._nullable = true; + return this; + } + define(id, schema) { + this._defs[id] = schema; + return this; + } +}; +var StringSchemaBuilder = class extends BaseSchemaBuilder { + constructor(descriptionOrOptions) { + super(typeof descriptionOrOptions === "string" ? descriptionOrOptions : descriptionOrOptions?.description); + this.type = "string"; + if (typeof descriptionOrOptions === "object" && descriptionOrOptions) { + this._pattern = descriptionOrOptions.pattern; + this._format = descriptionOrOptions.format; + } + } + pattern(input) { + this._pattern = input; + return this; + } + format(input) { + this._format = input; + return this; + } + toJSON() { + return this._toJSON({ + pattern: this._pattern, + format: this._format + }); + } +}; +var NumberSchemaBuilder = class extends BaseSchemaBuilder { + constructor(descriptionOrOptions) { + super(typeof descriptionOrOptions === "string" ? descriptionOrOptions : descriptionOrOptions?.description); + this.type = "number"; + if (typeof descriptionOrOptions === "object" && descriptionOrOptions) { + this._minimum = descriptionOrOptions.minimum; + this._maximum = descriptionOrOptions.maximum; + this._exclusiveMinimum = descriptionOrOptions.exclusiveMinimum; + this._exclusiveMaximum = descriptionOrOptions.exclusiveMaximum; + this._multipleOf = descriptionOrOptions.multipleOf; + } + } + minimum(value) { + this._minimum = value; + return this; + } + exclusiveMinimum(value) { + this._exclusiveMinimum = value; + return this; + } + maximum(value) { + this._maximum = value; + return this; + } + exclusiveMaximum(value) { + this._exclusiveMaximum = value; + return this; + } + multipleOf(value) { + this._multipleOf = value; + return this; + } + toJSON() { + return this._toJSON({ + minimum: this._minimum, + exclusiveMinimum: this._exclusiveMinimum, + maximum: this._maximum, + exclusiveMaximum: this._exclusiveMaximum, + multipleOf: this._multipleOf + }); + } +}; +var EnumSchemaBuilder = class extends BaseSchemaBuilder { + constructor(_enum, description) { + super(description); + this._enum = _enum; + this.type = "string"; + } + toJSON() { + return this._toJSON({ + enum: this._enum + }); + } +}; +var LiteralSchemaBuilder = class extends EnumSchemaBuilder { + constructor(value, description) { + super([value], description); + } +}; +var BooleanSchemaBuilder = class extends BaseSchemaBuilder { + constructor(description) { + super(description); + this.type = "boolean"; + } + toJSON() { + return this._toJSON(); + } +}; +var ArraySchemaBuilder = class extends BaseSchemaBuilder { + constructor(items, descriptionOrOptions) { + super(typeof descriptionOrOptions === "string" ? descriptionOrOptions : descriptionOrOptions?.description); + this.items = items; + this.type = "array"; + if (typeof descriptionOrOptions === "object" && descriptionOrOptions) { + this._minItems = descriptionOrOptions.minItems; + this._maxItems = descriptionOrOptions.maxItems; + } + } + minItems(value) { + this._minItems = value; + return this; + } + maxItems(value) { + this._maxItems = value; + return this; + } + toJSON() { + const itemsSchema = this.items.toJSON(); + const allDefs = this._collectNestedDefs([itemsSchema]); + this._defs = allDefs; + return this._toJSON({ + items: itemsSchema, + minItems: this._minItems, + maxItems: this._maxItems + }); + } +}; +var ObjectSchemaBuilder = class extends BaseSchemaBuilder { + constructor(properties, description) { + super(description); + this.properties = properties; + this.type = "object"; + } + toJSON() { + const propertySchemas = Object.fromEntries( + Object.keys(this.properties).map((key) => [key, this.properties[key].toJSON()]) + ); + const allDefs = this._collectNestedDefs(Object.values(propertySchemas)); + this._defs = allDefs; + return this._toJSON({ + required: Object.keys(this.properties), + additionalProperties: false, + properties: propertySchemas + }); + } +}; +var UnionSchemaBuilder = class { + constructor(schemas, description) { + this.schemas = schemas; + this._nullable = false; + this._defs = {}; + this.description = description; + } + nullable() { + this._nullable = true; + return this; + } + define(id, schema) { + this._defs[id] = schema; + return this; + } + _collectNestedDefs(schemas) { + const allDefs = this._defs; + for (const schema of schemas) { + if (schema && typeof schema === "object" && "$defs" in schema) { + Object.assign(allDefs, schema.$defs); + delete schema.$defs; + } + } + return allDefs; + } + toJSON() { + const schemaJsons = this.schemas.map((x) => x.toJSON()); + const allDefs = this._collectNestedDefs(schemaJsons); + const result = { + anyOf: this._nullable ? [...schemaJsons, { type: "null" }] : schemaJsons + }; + if (this.description) { + result.description = this.description; + } + if (Object.keys(allDefs).length > 0) { + result.$defs = allDefs; + } + return result; + } +}; +var ReferenceSchemaBuilder = class { + constructor(id) { + this.id = id; + } + nullable() { + return this; + } + toJSON() { + return { + $ref: `#/$defs/${this.id}` + }; + } +}; +var s = { + string: (descriptionOrOptions) => new StringSchemaBuilder(descriptionOrOptions), + number: (descriptionOrOptions) => new NumberSchemaBuilder(descriptionOrOptions), + enum: (values, description) => new EnumSchemaBuilder(values, description), + boolean: (description) => new BooleanSchemaBuilder(description), + array: (items, descriptionOrOptions) => new ArraySchemaBuilder(items, descriptionOrOptions), + object: (properties, description) => new ObjectSchemaBuilder(properties, description), + union: (schemas, description) => new UnionSchemaBuilder(schemas, description), + literal: (value, description) => new LiteralSchemaBuilder(value, description), + ref: (id) => new ReferenceSchemaBuilder(id) +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/aggregationFeatureSchema.ts +var buildAggregationFeatureSchema = (beans) => { + const { aggFuncSvc } = beans; + if (!aggFuncSvc) { + return; + } + const columns = beans.colModel.getCols(); + const aggregatableColumns = columns.filter((col) => col.isAllowValue() && aggFuncSvc.getFuncNames(col).length > 0); + if (aggregatableColumns.length === 0) { + return; + } + return s.object( + { + aggregationModel: s.array( + s.union( + aggregatableColumns.map( + (col) => s.object({ + colId: s.literal(col.getColId(), "Column identifier"), + aggFunc: s.enum(beans.aggFuncSvc?.getFuncNames(col) || [], "Aggregation function") + }) + ) + ), + "Array of column aggregations" + ) + }, + "Aggregation configuration for the grid" + ).nullable(); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/columnSizingFeatureSchema.ts +var buildColumnSizingFeatureSchema = (beans) => { + const columns = beans.colModel.getCols(); + const resizableColumns = columns.filter((col) => col.isResizable()); + if (resizableColumns.length === 0) { + return; + } + const resizableColumnIds = resizableColumns.map((col) => col.getColId()); + return s.object( + { + columnSizingModel: s.array( + s.union([ + s.object({ + colId: s.ref("resizableColumnId"), + width: s.number("Fixed width in pixels").minimum(20) + }), + s.object({ + colId: s.ref("resizableColumnId"), + flex: s.number("Flex sizing ratio").minimum(0) + }) + ]), + "Array of column sizing configurations" + ) + }, + "Column sizing configuration for the grid" + ).define("resizableColumnId", s.enum(resizableColumnIds, "Column ID that supports resizing")); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/columnVisibilityFeatureSchema.ts +var buildColumnVisibilityFeatureSchema = () => { + return s.object( + { + hiddenColIds: s.array(s.ref("allColumnIds"), "Array of column IDs to hide") + }, + "Column visibility configuration for the grid" + ).nullable(); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/advancedFilterFeatureSchema.ts +var buildAdvancedFilterFeatureSchema = ({ colModel, dataTypeSvc }) => { + if (!dataTypeSvc) { + return; + } + const columns = colModel.getCols(); + const dataTypes = { + boolean: [], + object: [], + date: [], + dateString: [], + dateTime: [], + dateTimeString: [], + number: [], + bigint: [], + text: [] + }; + for (const col of columns) { + const dataType = dataTypeSvc.getBaseDataType(col); + if (dataType) { + dataTypes[dataType].push(col.colId); + } + } + const columnFilterModels = []; + const defs = {}; + for (const key of Object.keys(dataTypes)) { + if (dataTypes[key].length > 0) { + const ref = `${key}AdvancedFilterModel`; + const builder = DataTypeSchemaBuilders[key]; + defs[ref] = builder(dataTypes[key]); + columnFilterModels.push({ $ref: `#/$defs/${ref}` }); + } + } + defs.joinAdvancedFilterModel = s.object({ + filterType: s.literal("join", "Filter type identifier for joining multiple advanced filter conditions"), + type: s.enum(["AND", "OR"], "Logical operator to combine multiple advanced filter conditions"), + conditions: s.array(s.ref("advancedFilterModel"), "Array of advanced filter conditions to be combined") + }); + defs.advancedFilterModel = { + anyOf: [...columnFilterModels, { $ref: "#/$defs/joinAdvancedFilterModel" }] + }; + return s.object( + { + advancedFilterModel: s.ref("advancedFilterModel") + }, + "Advanced filter configuration for the grid" + ).nullable(); +}; +var buildBooleanFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("boolean", "Filter type identifier for boolean column filters"), + colId: s.enum(colIds, "Column identifier for the boolean column to filter"), + type: s.enum(["true", "false"], "Boolean value to filter by") + }); +}; +var buildObjectFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("object", "Filter type identifier for object column filters"), + colId: s.enum(colIds, "Column identifier for the object column to filter"), + filter: s.string("Filter value to compare against object column values").nullable(), + type: s.enum( + ["equals", "notEqual", "contains", "notContains", "startsWith", "endsWith", "blank", "notBlank"], + "Object filter operation type" + ) + }); +}; +var buildDateFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("date", "Filter type identifier for date column filters"), + colId: s.enum(colIds, "Column identifier for the date column to filter"), + filter: s.string({ pattern: "^\\d{4}-\\d{2}-\\d{2}$", description: "Date value in YYYY-MM-DD format" }).nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "Date filter operation type" + ) + }); +}; +var buildDateStringFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("date", "Filter type identifier for date string column filters"), + colId: s.enum(colIds, "Column identifier for the date string column to filter"), + filter: s.string({ pattern: "^\\d{4}-\\d{2}-\\d{2}$", description: "Date value in YYYY-MM-DD format" }).nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "Date string filter operation type" + ) + }); +}; +var buildDateTimeFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("dateTime", "Filter type identifier for datetime column filters"), + colId: s.enum(colIds, "Column identifier for the datetime column to filter"), + filter: s.string({ + pattern: "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$", + description: "DateTime value in YYYY-MM-DDTHH:mm:ss format" + }).nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "DateTime filter operation type" + ) + }); +}; +var buildDateTimeStringFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("dateTimeString", "Filter type identifier for datetime string column filters"), + colId: s.enum(colIds, "Column identifier for the datetime string column to filter"), + filter: s.string({ + pattern: "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$", + description: "DateTime value in YYYY-MM-DD HH:mm:ss format" + }).nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "DateTime string filter operation type" + ) + }); +}; +var buildNumberFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("number", "Filter type identifier for number column filters"), + colId: s.enum(colIds, "Column identifier for the number column to filter"), + filter: s.number("Numeric value to filter by").nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "Number filter operation type" + ) + }); +}; +var buildBigIntFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("bigint", "Filter type identifier for bigint column filters"), + colId: s.enum(colIds, "Column identifier for the bigint column to filter"), + filter: s.string({ + pattern: "^-?\\d+$", + description: "BigInt value to filter by" + }).nullable(), + type: s.enum( + [ + "equals", + "notEqual", + "lessThan", + "lessThanOrEqual", + "greaterThan", + "greaterThanOrEqual", + "blank", + "notBlank" + ], + "BigInt filter operation type" + ) + }); +}; +var buildTextFilterSchema = (colIds) => { + return s.object({ + filterType: s.literal("text", "Filter type identifier for text column filters"), + colId: s.enum(colIds, "Column identifier for the text column to filter"), + filter: s.string("Text value to filter by").nullable(), + type: s.enum( + ["equals", "notEqual", "contains", "notContains", "startsWith", "endsWith", "blank", "notBlank"], + "Text filter operation type" + ) + }); +}; +var DataTypeSchemaBuilders = { + boolean: buildBooleanFilterSchema, + object: buildObjectFilterSchema, + date: buildDateFilterSchema, + dateString: buildDateStringFilterSchema, + dateTime: buildDateTimeFilterSchema, + dateTimeString: buildDateTimeStringFilterSchema, + number: buildNumberFilterSchema, + bigint: buildBigIntFilterSchema, + text: buildTextFilterSchema +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/filterFeatureSchema.ts +var TextFilterKey = "agTextColumnFilter"; +var NumberFilterKey = "agNumberColumnFilter"; +var DateFilterKey = "agDateColumnFilter"; +var SetFilterKey = "agSetColumnFilter"; +var MultiFilterKey = "agMultiColumnFilter"; +var SimpleFilterKeys = [TextFilterKey, NumberFilterKey, DateFilterKey]; +var buildFilterFeatureSchema = (beans, params) => { + const { advancedFilter } = beans; + if (advancedFilter?.isEnabled()) { + return buildAdvancedFilterFeatureSchema(beans); + } else { + return buildColumnFilterFeatureSchema(beans, params); + } +}; +var buildColumnFilterFeatureSchema = (beans, params) => { + const { gos, colFilter, colModel } = beans; + if (!colFilter) { + return; + } + const columns = colModel.getCols(); + const filterableColumns = columns.filter((col) => col.isFilterAllowed()); + if (filterableColumns.length === 0) { + return; + } + const filterSchemas = {}; + const enableFilterHandlers = gos.get("enableFilterHandlers"); + for (const column of filterableColumns) { + const columnParams = params?.columns ? params.columns[column.getColId()] : void 0; + const colDef = column.getColDef(); + const defaultFilter = colFilter.getDefaultFilter(column); + const includeSetValues = columnParams?.includeSetValues ?? false; + const filter = buildColumnFilterSchema( + colDef.filter, + colDef.filterParams, + defaultFilter, + (isMulti = false, multiIndex = 0) => { + if (!includeSetValues) { + return []; + } + let handler = void 0; + if (!isMulti) { + handler = colFilter.getHandler(column, true); + } else if (enableFilterHandlers) { + const multiHandler = colFilter.getHandler(column, true); + handler = multiHandler.getHandler(multiIndex); + } + if (!handler) { + return []; + } + return handler.getFilterKeys(); + } + ); + if (filter) { + filterSchemas[column.colId] = filter.nullable(); + } + } + return s.object({ + filterModel: s.object(filterSchemas) + }).nullable(); +}; +function buildColumnFilterSchema(filter, filterParams, defaultFilter, getKeys) { + let filterKey = void 0; + if (typeof filter === "string") { + filterKey = filter; + } else if (typeof filter === "object" && typeof filter.component === "string") { + filterKey = filter.component; + } else if (filter === true || typeof filter === "object" && filter.component === true) { + filterKey = defaultFilter; + } + if (!filterKey) { + return null; + } + if (SimpleFilterKeys.includes(filterKey)) { + const maxConditions = filterParams?.maxNumConditions; + const filterOptions = filterParams?.filterOptions ? filterParams.filterOptions.map((option) => { + if (typeof option === "string") { + return option; + } + if (typeof option === "object" && option.displayKey) { + return option.displayKey; + } + return null; + }).filter(Boolean) : void 0; + const useIsoSeparator = filterParams?.useIsoSeparator || false; + return buildSimpleFilterSchema(filterKey, { maxConditions, filterOptions, useIsoSeparator }); + } else if (filterKey === SetFilterKey) { + return buildSetFilterSchema(getKeys); + } else if (filterKey === MultiFilterKey) { + return buildMultiFilterSchema(filterParams.filters, defaultFilter, getKeys); + } + return null; +} +var buildSimpleFilterSchema = (filterKey, params) => { + if (filterKey === DateFilterKey) { + return buildDateFilterSchema2(params); + } else if (filterKey === NumberFilterKey) { + return buildNumberFilterSchema2(params); + } else { + return buildTextFilterSchema2(params); + } +}; +var buildJoinSchema = (schema, filterType, maxConditions = 2) => { + if (maxConditions === 1) { + return schema; + } + return s.object({ + filterType: s.literal(filterType, `Filter type identifier for ${filterType} filters with multiple conditions`), + operator: s.enum( + ["AND", "OR"], + "Logical operator to combine multiple filter conditions. Must be included even with a single filter to adhere to the API." + ), + conditions: s.array(schema, "Array of filter conditions to be combined").minItems(2).maxItems(maxConditions) + }); +}; +var buildTextFilterSchema2 = (params) => { + const options = params.filterOptions ?? [ + "contains", + "notContains", + "equals", + "notEqual", + "startsWith", + "endsWith", + "blank", + "notBlank" + ]; + const schema = s.object({ + filterType: s.literal("text", "Filter type identifier for text filters"), + type: s.enum(options, "Text filter operation type"), + filter: s.string("Primary filter value").nullable(), + filterTo: s.string("Secondary filter value for range operations").nullable() + }); + return buildJoinSchema(schema, "text", params.maxConditions); +}; +var buildNumberFilterSchema2 = (params) => { + const options = params.filterOptions ?? [ + "equals", + "notEqual", + "greaterThan", + "greaterThanOrEqual", + "lessThan", + "lessThanOrEqual", + "inRange", + "blank", + "notBlank" + ]; + const schema = s.object({ + filterType: s.literal("number", "Filter type identifier for number filters"), + type: s.enum(options, "Number filter operation type"), + filter: s.number("Primary filter value").nullable(), + filterTo: s.number("Secondary filter value for range operations").nullable() + }); + return buildJoinSchema(schema, "number", params.maxConditions); +}; +var buildDateFilterSchema2 = (params) => { + const options = params.filterOptions ?? [ + "equals", + "notEqual", + "lessThan", + "greaterThan", + "inRange", + "blank", + "notBlank" + ]; + const pattern = params.useIsoSeparator ? "^\\d{4}-\\d{2}-\\d{2}T\\d{2}:\\d{2}:\\d{2}$" : "^\\d{4}-\\d{2}-\\d{2} \\d{2}:\\d{2}:\\d{2}$"; + const schema = s.object({ + filterType: s.literal("date", "Filter type identifier for date filters"), + type: s.enum(options, "Date filter operation type"), + dateFrom: s.string({ pattern, description: "Primary date filter value in YYYY-MM-DD HH:mm:ss format" }).nullable(), + dateTo: s.string({ + pattern, + description: "Secondary date filter value for range operations in YYYY-MM-DD HH:mm:ss format" + }).nullable() + }); + return buildJoinSchema(schema, "date", params.maxConditions); +}; +var buildSetFilterSchema = (getKeys) => { + const values = getKeys ? getKeys().filter(Boolean) : []; + return s.object({ + filterType: s.literal("set", "Filter type identifier for set filters"), + values: s.array( + values.length > 0 ? s.enum(values, "Available values to filter by") : s.string("Filter values"), + "Array of values to include in the filter" + ) + }); +}; +var buildMultiFilterSchema = (filters, defaultFilter, getKeys = () => []) => { + return s.object({ + filterType: s.literal("multi", "Filter type identifier for multi-condition filters"), + filterModels: s.array( + s.union( + filters.map( + (filter, index) => buildColumnFilterSchema( + filter.filter, + filter.filterParams, + defaultFilter, + () => getKeys(true, index) + ) + ), + "Union of different filter types that can be combined" + ).nullable(), + "Array of filter conditions to be combined with AND/OR logic" + ) + }); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/pivotFeatureSchema.ts +var buildPivotFeatureSchema = (beans) => { + const columns = beans.colModel.getCols(); + const pivotableColumnIds = columns.filter((col) => col.isAllowPivot()).map((col) => col.getColId()); + if (pivotableColumnIds.length === 0) { + return; + } + return s.object( + { + pivotMode: s.boolean("Whether pivot mode is enabled"), + pivotColIds: s.array( + s.enum(pivotableColumnIds, "Column ID that supports pivoting"), + "Array of column IDs to use as pivot columns" + ) + }, + "Pivot configuration for the grid" + ).nullable(); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/rowGroupFeatureSchema.ts +var buildRowGroupFeatureSchema = (beans) => { + const columns = beans.colModel.getCols(); + const groupableColumns = columns.filter((col) => col.isAllowRowGroup()); + if (groupableColumns.length === 0) { + return; + } + const groupableColumnIds = groupableColumns.map((col) => col.getColId()); + return s.object( + { + groupColIds: s.array( + s.enum(groupableColumnIds, "Column ID that supports row grouping"), + "Array of column IDs to group by" + ) + }, + "Row grouping configuration for the grid" + ); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/features/sortFeatureSchema.ts +var buildSortFeatureSchema = (beans) => { + const { sortSvc } = beans; + if (!sortSvc) { + return; + } + const columns = beans.colModel.getCols(); + const sortableColumns = columns.filter((col) => col.isSortable()); + if (sortableColumns.length === 0) { + return; + } + const sortableColumnIds = sortableColumns.map((col) => col.getColId()); + return s.object( + { + sortModel: s.array( + s.object({ + colId: s.enum(sortableColumnIds, "Column ID that supports sorting"), + sort: s.enum(["asc", "desc"], "Sort direction: ascending or descending"), + type: s.enum(["default", "absolute"], "Sort type: default or absolute values") + }), + "Array of sort configurations" + ) + }, + "Sort configuration for the grid" + ).nullable(); +}; + +// packages/ag-grid-enterprise/src/aiToolkit/structuredSchema.ts +var StructuredSchemaBuilderMap = { + aggregation: buildAggregationFeatureSchema, + filter: buildFilterFeatureSchema, + sort: buildSortFeatureSchema, + pivot: buildPivotFeatureSchema, + columnVisibility: buildColumnVisibilityFeatureSchema, + columnSizing: buildColumnSizingFeatureSchema, + rowGroup: buildRowGroupFeatureSchema +}; +function getStructuredSchema(beans, params) { + const allColumnIds = beans.colModel.getCols().map((col) => col.getColId()); + const features = {}; + for (const feature of STRUCTURED_SCHEMA_FEATURES) { + if (params?.exclude?.includes(feature)) { + continue; + } + const builder = StructuredSchemaBuilderMap[feature]; + const schema2 = builder(beans, params); + if (schema2) { + features[feature] = schema2.nullable(); + } + } + const columnParams = params?.columns ?? {}; + const descriptions = allColumnIds.map((colId) => { + if (columnParams[colId]?.description) { + return `${colId}: ${columnParams[colId].description}`; + } else { + return colId; + } + }).filter(Boolean).join("\n"); + const schema = s.object(features).define("allColumnIds", s.enum(allColumnIds, descriptions)); + return schema.toJSON(); +} + +// packages/ag-grid-enterprise/src/aiToolkit/aiToolkitModule.ts +var AiToolkitModule = { + moduleName: "AiToolkit", + version: VERSION, + beans: [], + dependsOn: [EnterpriseCoreModule, ColumnApiModule], + apiFunctions: { + getStructuredSchema + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnsToolPanelModule.ts +import { _ColumnMoveModule, _PopupModule as _PopupModule2, _SharedDragAndDropModule as _SharedDragAndDropModule2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/sideBarModule.ts +import { _HorizontalResizeModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/sideBarApi.ts +import { _unwrapUserComp } from "ag-grid-community"; +function isSideBarVisible(beans) { + return beans.sideBar?.comp.isDisplayed() ?? false; +} +function setSideBarVisible(beans, show) { + beans.sideBar?.comp.setDisplayed(show); +} +function setSideBarPosition(beans, position) { + beans.sideBar?.comp.setSideBarPosition(position); +} +function openToolPanel(beans, key, parent) { + beans.sideBar?.comp.openToolPanel(key, "api", parent); +} +function closeToolPanel(beans) { + beans.sideBar?.comp.close("api"); +} +function getOpenedToolPanel(beans) { + return beans.sideBar?.comp.openedItem() ?? null; +} +function refreshToolPanel(beans) { + beans.sideBar?.comp.refresh(); +} +function isToolPanelShowing(beans) { + return beans.sideBar?.comp.isToolPanelShowing() ?? false; +} +function getToolPanelInstance(beans, id) { + const comp = beans.sideBar?.comp.getToolPanelInstance(id); + return _unwrapUserComp(comp); +} +function getSideBar(beans) { + return beans.sideBar?.comp.getDef(); +} + +// packages/ag-grid-enterprise/src/sideBar/sideBarService.ts +import { BeanStub as BeanStub7 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/agSideBar.ts +import { + Component as Component18, + KeyCode as KeyCode18, + ManagedFocusFeature, + RefPlaceholder as RefPlaceholder20, + _addFocusableContainerListener, + _addGridCommonParams as _addGridCommonParams5, + _findNextFocusableElement as _findNextFocusableElement5, + _focusInto as _focusInto4, + _focusNextGridCoreContainer as _focusNextGridCoreContainer3, + _getActiveDomElement as _getActiveDomElement7, + _isVisible as _isVisible5, + _removeFromParent as _removeFromParent5, + _setAriaControlsAndLabel as _setAriaControlsAndLabel2, + _skipFocusableContainerListenerForAgGrid, + _warn as _warn6 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/agSideBar.css +var agSideBar_default = '.ag-tool-panel-wrapper{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-horizontal-size,var(--ag-side-bar-panel-width))}.ag-tool-panel-content{display:flex;height:100%;overflow:hidden auto}.ag-tool-panel-wrapper.ag-tool-panel-animating{\n /* !important required to override .ag-hidden to tool panel remains visible while animating */display:block!important;transition:width var(--ag-side-bar-panel-animation-duration) ease-in-out}@media (prefers-reduced-motion:reduce){.ag-tool-panel-wrapper.ag-tool-panel-animating{transition:none}}.ag-tool-panel-external{display:flex;flex-direction:row}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);padding-top:var(--ag-side-button-bar-top-padding);position:relative}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative}.ag-side-button:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}:where(.ag-ltr) .ag-side-button:before{left:0}:where(.ag-rtl) .ag-side-button:before{right:0}.ag-side-button:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}.ag-side-button.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color)}.ag-side-button.ag-selected:before{background-color:var(--ag-side-button-selected-underline-color)}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}'; + +// packages/ag-grid-enterprise/src/sideBar/agSideBarButtons.ts +import { + Component as Component15, + KeyCode as KeyCode17, + _clearElement as _clearElement7, + _focusNextGridCoreContainer as _focusNextGridCoreContainer2, + _stopPropagationForAgGrid as _stopPropagationForAgGrid7 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/sideBarButtonComp.ts +import { Component as Component14, RefPlaceholder as RefPlaceholder18, _createIconNoSpan as _createIconNoSpan5, _setAriaExpanded as _setAriaExpanded5 } from "ag-grid-community"; +var SideBarButtonElement = { + tag: "div", + cls: "ag-side-button", + role: "presentation", + children: [ + { + tag: "button", + ref: "eToggleButton", + cls: "ag-button ag-side-button-button", + role: "tab", + attrs: { type: "button", tabindex: "-1", "aria-expanded": "false" }, + children: [ + { + tag: "div", + ref: "eIconWrapper", + cls: "ag-side-button-icon-wrapper", + attrs: { "aria-hidden": "true" } + }, + { tag: "span", ref: "eLabel", cls: "ag-side-button-label" } + ] + } + ] +}; +var SideBarButtonComp = class extends Component14 { + constructor(toolPanelDef) { + super(); + this.toolPanelDef = toolPanelDef; + this.eToggleButton = RefPlaceholder18; + this.eIconWrapper = RefPlaceholder18; + this.eLabel = RefPlaceholder18; + } + getToolPanelId() { + return this.toolPanelDef.id; + } + postConstruct() { + this.setTemplate(SideBarButtonElement, []); + this.setLabel(); + this.setIcon(); + this.addManagedElementListeners(this.eToggleButton, { click: this.onButtonPressed.bind(this) }); + this.eToggleButton.setAttribute("id", `ag-${this.getCompId()}-button`); + } + setLabel() { + const def = this.toolPanelDef; + const label = this.getLocaleTextFunc()(def.labelKey, def.labelDefault); + this.eLabel.textContent = label; + } + setIcon() { + this.eIconWrapper.insertAdjacentElement( + "afterbegin", + _createIconNoSpan5(this.toolPanelDef.iconKey, this.beans) + ); + } + onButtonPressed() { + this.dispatchLocalEvent({ type: "toggleButtonClicked" }); + } + setSelected(selected) { + this.toggleCss("ag-selected", selected); + _setAriaExpanded5(this.eToggleButton, selected); + } +}; + +// packages/ag-grid-enterprise/src/sideBar/agSideBarButtons.ts +var SideBarElement = { tag: "div", cls: "ag-side-buttons", role: "tablist" }; +var AgSideBarButtons = class extends Component15 { + constructor() { + super(SideBarElement); + this.buttonComps = []; + } + postConstruct() { + this.addManagedElementListeners(this.getFocusableElement(), { keydown: this.handleKeyDown.bind(this) }); + } + handleKeyDown(e) { + if (e.key !== KeyCode17.TAB || !e.shiftKey) { + return; + } + if (_focusNextGridCoreContainer2(this.beans, true)) { + e.preventDefault(); + return; + } + _stopPropagationForAgGrid7(e); + } + setActiveButton(id) { + for (const comp of this.buttonComps) { + comp.setSelected(id === comp.getToolPanelId()); + } + } + addButtonComp(def) { + const buttonComp = this.createBean(new SideBarButtonComp(def)); + this.buttonComps.push(buttonComp); + this.appendChild(buttonComp); + buttonComp.addEventListener("toggleButtonClicked", () => { + this.dispatchLocalEvent({ + type: "sideBarButtonClicked", + toolPanelId: def.id + }); + }); + return buttonComp; + } + clearButtons() { + this.buttonComps = this.destroyBeans(this.buttonComps); + _clearElement7(this.getGui()); + } + destroy() { + this.clearButtons(); + super.destroy(); + } +}; +var AgSideBarButtonsSelector = { + selector: "AG-SIDE-BAR-BUTTONS", + component: AgSideBarButtons +}; + +// packages/ag-grid-enterprise/src/sideBar/sideBarDefParser.ts +import { _warn as _warn5 } from "ag-grid-community"; +var DEFAULT_COLUMN_COMP = { + id: "columns", + labelDefault: "Columns", + labelKey: "columns", + iconKey: "columnsToolPanel", + toolPanel: "agColumnsToolPanel" +}; +var DEFAULT_FILTER_COMP = { + id: "filters", + labelDefault: "Filters", + labelKey: "filters", + iconKey: "filtersToolPanel", + toolPanel: "agFiltersToolPanel" +}; +var DEFAULT_NEW_FILTER_COMP = { + id: "filters-new", + labelDefault: "Filters", + labelKey: "filters", + iconKey: "filtersToolPanel", + toolPanel: "agNewFiltersToolPanel" +}; +var DEFAULT_BY_KEY = { + columns: DEFAULT_COLUMN_COMP, + filters: DEFAULT_FILTER_COMP, + "filters-new": DEFAULT_NEW_FILTER_COMP +}; +function parseSideBarDef(toParse) { + if (!toParse) { + return void 0; + } + if (toParse === true) { + return { + toolPanels: [DEFAULT_COLUMN_COMP, DEFAULT_FILTER_COMP], + defaultToolPanel: "columns" + }; + } + if (typeof toParse === "string") { + return parseSideBarDef([toParse]); + } + if (Array.isArray(toParse)) { + const comps = []; + for (const key of toParse) { + const lookupResult = DEFAULT_BY_KEY[key]; + if (!lookupResult) { + _warn5(215, { key, defaultByKey: DEFAULT_BY_KEY }); + continue; + } + comps.push(lookupResult); + } + if (comps.length === 0) { + return void 0; + } + return { + toolPanels: comps, + defaultToolPanel: comps[0].id + }; + } + return { + toolPanels: parseComponents(toParse.toolPanels), + defaultToolPanel: toParse.defaultToolPanel, + hiddenByDefault: toParse.hiddenByDefault, + position: toParse.position, + hideButtons: toParse.hideButtons + }; +} +function parseComponents(from) { + const result = []; + if (!from) { + return result; + } + from.forEach((it) => { + const parsed = parseOneComponent(it); + if (!parsed) { + return; + } + result.push(parsed); + }); + return result; +} +function parseOneComponent(it) { + if (typeof it !== "string") { + return it; + } + if (DEFAULT_BY_KEY[it]) { + return DEFAULT_BY_KEY[it]; + } + _warn5(215, { key: it, defaultByKey: DEFAULT_BY_KEY }); + return null; +} + +// packages/ag-grid-enterprise/src/sideBar/toolPanelWrapper.ts +import { Component as Component17, RefPlaceholder as RefPlaceholder19 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/agHorizontalResize.ts +import { Component as Component16 } from "ag-grid-community"; +var AgHorizontalResize = class extends Component16 { + constructor() { + super({ tag: "div", cls: "ag-tool-panel-horizontal-resize" }); + this.minWidth = 100; + this.maxWidth = null; + } + postConstruct() { + const finishedWithResizeFunc = this.beans.horizontalResizeSvc.addResizeBar({ + eResizeBar: this.getGui(), + dragStartPixels: 1, + onResizeStart: this.onResizeStart.bind(this), + onResizing: this.onResizing.bind(this), + onResizeEnd: this.onResizeEnd.bind(this) + }); + this.addDestroyFunc(finishedWithResizeFunc); + this.inverted = this.gos.get("enableRtl"); + } + dispatchResizeEvent(start, end, width) { + this.eventSvc.dispatchEvent({ + type: "toolPanelSizeChanged", + width, + started: start, + ended: end + }); + } + onResizeStart() { + this.startingWidth = this.elementToResize.offsetWidth; + this.dispatchResizeEvent(true, false, this.startingWidth); + } + onResizeEnd(delta) { + return this.onResizing(delta, true); + } + onResizing(delta, isEnd = false) { + const direction = this.inverted ? -1 : 1; + let newWidth = Math.max(this.minWidth, Math.floor(this.startingWidth - delta * direction)); + if (this.maxWidth != null) { + newWidth = Math.min(this.maxWidth, newWidth); + } + this.elementToResize.style.setProperty("--ag-horizontal-size", `${newWidth}px`); + this.dispatchResizeEvent(false, isEnd, newWidth); + } +}; + +// packages/ag-grid-enterprise/src/sideBar/toolPanelWrapper.ts +function getToolPanelCompDetails(userCompFactory, toolPanelDef, params) { + return userCompFactory.getCompDetails(toolPanelDef, ToolPanelComponent, void 0, params, true); +} +var ToolPanelComponent = { + name: "toolPanel", + optionalMethods: ["refresh", "getState"] +}; +var ToolPanelElement = { + tag: "div", + cls: "ag-tool-panel-wrapper", + role: "tabpanel", + children: [ + { + tag: "div", + cls: "ag-tool-panel-content", + ref: "eContent" + } + ] +}; +var ToolPanelWrapper = class extends Component17 { + constructor() { + super(ToolPanelElement); + this.eContent = RefPlaceholder19; + this.animationId = 0; + this.defParent = null; + } + postConstruct() { + const eGui = this.getGui(); + const resizeBar = this.resizeBar = this.createManagedBean(new AgHorizontalResize()); + eGui.setAttribute("id", `ag-${this.getCompId()}`); + resizeBar.elementToResize = eGui; + this.appendChild(resizeBar); + } + getToolPanelId() { + return this.toolPanelId; + } + getDefParent() { + return this.defParent; + } + setDefParent(parent) { + this.defParent = parent; + } + setToolPanelDef(toolPanelDef, params) { + const { id, minWidth, maxWidth, width, parent } = toolPanelDef; + this.toolPanelId = id; + this.defParent = parent ?? null; + if (width) { + this.getGui().style.setProperty("--ag-side-bar-panel-width", `${width}px`); + } + const compDetails = getToolPanelCompDetails(this.beans.userCompFactory, toolPanelDef, params); + if (compDetails == null) { + return false; + } + const componentPromise = compDetails.newAgStackInstance(); + this.params = compDetails.params; + componentPromise.then(this.setToolPanelComponent.bind(this)); + const resizeBar = this.resizeBar; + if (minWidth != null) { + resizeBar.minWidth = minWidth; + } + if (maxWidth != null) { + resizeBar.maxWidth = maxWidth; + } + return true; + } + setToolPanelComponent(compInstance) { + this.toolPanelCompInstance = compInstance; + const { eContent } = this; + eContent.appendChild(compInstance.getGui()); + this.addDestroyFunc(() => { + this.destroyBean(compInstance); + }); + } + getToolPanelInstance() { + return this.toolPanelCompInstance; + } + setResizerSizerSide(side) { + const isRtl = this.gos.get("enableRtl"); + const isLeft = side === "left"; + const inverted = isRtl ? isLeft : !isLeft; + this.resizeBar.inverted = inverted; + } + refresh() { + this.toolPanelCompInstance?.refresh(this.params); + } + animateDisplayed(displayed) { + if (this.isDisplayed() === displayed) { + return; + } + const id = ++this.animationId; + const { eContent } = this; + const cleanup2 = () => { + if (this.animationId === id) { + eGui.classList.remove("ag-tool-panel-animating"); + eContent.style.width = ""; + eGui.style.width = ""; + } + }; + const eGui = this.getGui(); + const currentWrapperWidth = eGui.offsetWidth; + this.setDisplayed(displayed); + eGui.classList.add("ag-tool-panel-animating"); + const durationStr = getComputedStyle(eGui).transitionDuration; + if (!parseFloat(durationStr)) { + cleanup2(); + return; + } + eGui.style.transition = "none"; + eGui.style.width = ""; + eContent.style.width = `${eContent.offsetWidth}px`; + eGui.style.width = `${currentWrapperWidth}px`; + const _ = eGui.offsetWidth; + eGui.style.transition = ""; + eGui.style.width = displayed ? "" : "0"; + const fallbackTimeout = setTimeout(cleanup2, 100); + eGui.addEventListener("transitionstart", () => clearTimeout(fallbackTimeout), { once: true }); + eGui.addEventListener("transitionend", cleanup2, { once: true }); + } +}; + +// packages/ag-grid-enterprise/src/sideBar/agSideBar.ts +var AgSideBarElement = { + tag: "div", + cls: "ag-side-bar ag-unselectable", + children: [ + { + tag: "ag-side-bar-buttons", + ref: "sideBarButtons" + } + ] +}; +var AgSideBar = class extends Component18 { + constructor() { + super(AgSideBarElement, [AgSideBarButtonsSelector]); + this.sideBarButtons = RefPlaceholder20; + this.toolPanelWrappers = []; + this.registerCSS(agSideBar_default); + } + postConstruct() { + this.sideBarButtons.addEventListener("sideBarButtonClicked", this.onToolPanelButtonClicked.bind(this)); + const { beans, gos } = this; + const { sideBar: sideBarState } = gos.get("initialState") ?? {}; + this.setSideBarDef({ + sideBarDef: parseSideBarDef(gos.get("sideBar")), + sideBarState + }); + this.addManagedPropertyListener("sideBar", () => this.setState()); + beans.sideBar.comp = this; + const eGui = this.getFocusableElement(); + this.createManagedBean( + new ManagedFocusFeature(eGui, { + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.handleKeyDown.bind(this) + }) + ); + _addFocusableContainerListener(beans, this, eGui); + this.addManagedPropertyListener("enableAdvancedFilter", this.onAdvancedFilterChanged.bind(this)); + } + getFocusableContainerName() { + return "sideBar"; + } + onTabKeyDown(e) { + if (e.defaultPrevented) { + return; + } + const { beans, sideBarButtons } = this; + const eGui = this.getGui(); + const sideBarGui = sideBarButtons.getGui(); + const activeElement = _getActiveDomElement7(beans); + const openPanel = eGui.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"); + const target = e.target; + const backwards = e.shiftKey; + if (!openPanel) { + if (_focusNextGridCoreContainer3(beans, backwards, true)) { + e.preventDefault(); + return true; + } + _skipFocusableContainerListenerForAgGrid(e); + return false; + } + if (sideBarGui.contains(activeElement)) { + if (_focusInto4(openPanel, backwards)) { + e.preventDefault(); + } + return; + } + if (!backwards) { + return; + } + let nextEl = null; + if (openPanel.contains(activeElement)) { + nextEl = _findNextFocusableElement5(beans, openPanel, void 0, true); + } else if (isTargetUnderManagedComponent(openPanel, target)) { + nextEl = findFocusableElementBeforeTabGuard(openPanel, target); + } + if (!nextEl) { + nextEl = sideBarGui.querySelector(".ag-selected button"); + nextEl = _isVisible5(nextEl) ? nextEl : null; + } + if (nextEl && nextEl !== e.target) { + e.preventDefault(); + nextEl.focus(); + } + } + handleKeyDown(e) { + const currentButton = _getActiveDomElement7(this.beans); + const sideBarButtons = this.sideBarButtons; + if (!sideBarButtons.getGui().contains(currentButton)) { + return; + } + const sideBarGui = sideBarButtons.getGui(); + const buttons = Array.prototype.slice.call(sideBarGui.querySelectorAll(".ag-side-button")); + const currentPos = buttons.findIndex((button) => button.contains(currentButton)); + let nextPos = null; + switch (e.key) { + case KeyCode18.LEFT: + case KeyCode18.UP: + nextPos = Math.max(0, currentPos - 1); + break; + case KeyCode18.RIGHT: + case KeyCode18.DOWN: + nextPos = Math.min(currentPos + 1, buttons.length - 1); + break; + } + if (nextPos === null) { + return; + } + const innerButton = buttons[nextPos].querySelector("button"); + if (innerButton) { + innerButton.focus(); + e.preventDefault(); + } + } + onToolPanelButtonClicked(event) { + const id = event.toolPanelId; + const openedItem = this.openedItem(); + if (openedItem === id) { + this.openToolPanel(void 0, "sideBarButtonClicked"); + } else { + this.openToolPanel(id, "sideBarButtonClicked"); + } + } + clearDownUi() { + this.sideBarButtons.clearButtons(); + this.destroyToolPanelWrappers(); + } + setSideBarDef({ + sideBarDef, + sideBarState, + existingToolPanelWrappers + }) { + this.setDisplayed(false); + this.sideBar = sideBarDef; + if (sideBarDef) { + this.sideBarButtons.setDisplayed(!sideBarDef.hideButtons); + } + if (sideBarDef?.toolPanels) { + const toolPanelDefs = sideBarDef.toolPanels; + this.createToolPanelsAndSideButtons(toolPanelDefs, sideBarState, existingToolPanelWrappers); + if (!this.toolPanelWrappers.length) { + return; + } + const shouldDisplaySideBar = sideBarState ? sideBarState.visible : !sideBarDef.hiddenByDefault; + this.setDisplayed(shouldDisplaySideBar); + this.setSideBarPosition(sideBarState ? sideBarState.position : sideBarDef.position); + if (shouldDisplaySideBar) { + if (sideBarState) { + const { openToolPanel: openToolPanel2 } = sideBarState; + if (openToolPanel2) { + this.openToolPanel(openToolPanel2, "sideBarInitializing"); + } + } else { + this.openToolPanel(sideBarDef.defaultToolPanel, "sideBarInitializing"); + } + } + } + } + getDef() { + return this.sideBar; + } + setSideBarPosition(position) { + if (!position) { + position = "right"; + } + this.position = position; + const isLeft = position === "left"; + const resizerSide = isLeft ? "right" : "left"; + this.toggleCss("ag-side-bar-left", isLeft); + this.toggleCss("ag-side-bar-right", !isLeft); + for (const wrapper of this.toolPanelWrappers) { + wrapper.setResizerSizerSide(resizerSide); + } + this.dispatchSideBarUpdated(); + return this; + } + setDisplayed(displayed, options) { + super.setDisplayed(displayed, options); + this.dispatchSideBarUpdated(); + } + getState() { + const toolPanels = {}; + for (const wrapper of this.toolPanelWrappers) { + toolPanels[wrapper.getToolPanelId()] = wrapper.getToolPanelInstance()?.getState?.(); + } + return { + visible: this.isDisplayed(), + position: this.position, + openToolPanel: this.openedItem(), + toolPanels + }; + } + createToolPanelsAndSideButtons(defs, sideBarState, existingToolPanelWrappers) { + for (const def of defs) { + this.createToolPanelAndSideButton( + def, + sideBarState?.toolPanels?.[def.id], + existingToolPanelWrappers?.[def.id] + ); + } + } + validateDef(def) { + const { id, toolPanel } = def; + if (id == null) { + _warn6(212); + return false; + } + if (isFilterPanel(toolPanel)) { + if (this.beans.filterManager?.isAdvFilterEnabled()) { + _warn6(213); + return false; + } + } + return true; + } + createToolPanelAndSideButton(def, initialState, existingToolPanelWrapper) { + if (!this.validateDef(def)) { + this.destroyBean(existingToolPanelWrapper); + return; + } + let wrapper; + if (existingToolPanelWrapper) { + wrapper = existingToolPanelWrapper; + wrapper.setDefParent(def.parent ?? null); + } else { + wrapper = this.createBean(new ToolPanelWrapper()); + const created = wrapper.setToolPanelDef( + def, + _addGridCommonParams5(this.gos, { + initialState, + onStateUpdated: () => this.dispatchSideBarUpdated() + }) + ); + if (!created) { + return; + } + } + wrapper.setDisplayed(false); + this.renderToolPanelUnderParent(wrapper, def.parent); + this.toolPanelWrappers.push(wrapper); + const button = this.sideBarButtons.addButtonComp(def); + _setAriaControlsAndLabel2(button.eToggleButton, wrapper.getGui()); + } + refresh() { + for (const wrapper of this.toolPanelWrappers) { + wrapper.refresh(); + } + } + renderToolPanelUnderParent(wrapper, externalParent) { + const wrapperGui = wrapper.getGui(); + if (externalParent) { + this.beans.environment.applyThemeClasses(externalParent, ["ag-external", "ag-tool-panel-external"]); + wrapperGui.classList.add(this.gos.get("enableRtl") ? "ag-rtl" : "ag-ltr"); + } + const correctParent = externalParent ?? wrapper.getDefParent() ?? this.getGui(); + if (wrapperGui.parentElement !== correctParent) { + correctParent.appendChild(wrapperGui); + } + } + getWrapper(key) { + return this.toolPanelWrappers.find((wrapper) => wrapper.getToolPanelId() === key); + } + openToolPanel(key, source = "api", parent) { + const currentlyOpenedKey = this.openedItem(); + const switchingToolPanel = !!key && !!currentlyOpenedKey; + const skipAnimation = switchingToolPanel || source === "sideBarInitializing"; + for (const wrapper of this.toolPanelWrappers) { + const show = key === wrapper.getToolPanelId(); + if (show) { + this.renderToolPanelUnderParent(wrapper, parent ?? null); + } + if (skipAnimation) { + wrapper.setDisplayed(show); + } else { + wrapper.animateDisplayed(show); + } + } + const newlyOpenedKey = this.openedItem(); + const openToolPanelChanged = currentlyOpenedKey !== newlyOpenedKey; + if (openToolPanelChanged) { + this.sideBarButtons.setActiveButton(key); + this.raiseToolPanelVisibleEvent(key, currentlyOpenedKey ?? void 0, source); + } + } + getToolPanelInstance(key) { + const toolPanelWrapper = this.getWrapper(key); + if (!toolPanelWrapper) { + _warn6(214, { key }); + return; + } + return toolPanelWrapper.getToolPanelInstance(); + } + raiseToolPanelVisibleEvent(key, previousKey, source) { + const switchingToolPanel = !!key && !!previousKey; + const eventSvc = this.eventSvc; + if (previousKey) { + eventSvc.dispatchEvent({ + type: "toolPanelVisibleChanged", + source, + key: previousKey, + visible: false, + switchingToolPanel + }); + } + if (key) { + eventSvc.dispatchEvent({ + type: "toolPanelVisibleChanged", + source, + key, + visible: true, + switchingToolPanel + }); + } + } + close(source = "api") { + this.openToolPanel(void 0, source); + } + isToolPanelShowing() { + return !!this.openedItem(); + } + openedItem() { + let activeToolPanel = null; + for (const wrapper of this.toolPanelWrappers) { + if (wrapper.isDisplayed()) { + activeToolPanel = wrapper.getToolPanelId(); + } + } + return activeToolPanel; + } + setState(sideBarState) { + const sideBarDef = parseSideBarDef(this.gos.get("sideBar")); + const existingToolPanelWrappers = {}; + if (sideBarDef && this.sideBar) { + sideBarDef.toolPanels?.forEach((toolPanelDef) => { + const { id } = toolPanelDef; + if (!id) { + return; + } + const existingToolPanelDef = this.sideBar.toolPanels?.find( + (toolPanelDefToCheck) => toolPanelDefToCheck.id === id + ); + if (!existingToolPanelDef || toolPanelDef.toolPanel !== existingToolPanelDef.toolPanel) { + return; + } + const toolPanelWrapper = this.getWrapper(id); + if (!toolPanelWrapper) { + return; + } + const params = _addGridCommonParams5(this.gos, { + ...toolPanelDef.toolPanelParams ?? {}, + initialState: sideBarState?.toolPanels?.[id], + onStateUpdated: () => this.dispatchSideBarUpdated() + }); + const hasRefreshed = toolPanelWrapper.getToolPanelInstance()?.refresh(params); + if (hasRefreshed !== true) { + return; + } + this.toolPanelWrappers = this.toolPanelWrappers.filter((toolPanel) => toolPanel !== toolPanelWrapper); + _removeFromParent5(toolPanelWrapper.getGui()); + existingToolPanelWrappers[id] = toolPanelWrapper; + }); + } + this.clearDownUi(); + this.setSideBarDef({ sideBarDef, sideBarState, existingToolPanelWrappers }); + } + dispatchSideBarUpdated() { + this.eventSvc.dispatchEvent({ type: "sideBarUpdated" }); + } + destroyToolPanelWrappers() { + for (const wrapper of this.toolPanelWrappers) { + _removeFromParent5(wrapper.getGui()); + this.destroyBean(wrapper); + } + this.toolPanelWrappers.length = 0; + } + onAdvancedFilterChanged() { + const needsRefresh = this.sideBar?.toolPanels?.some( + (toolPanel) => isFilterPanel(typeof toolPanel === "string" ? toolPanel : toolPanel.toolPanel) + ); + if (needsRefresh) { + this.setState(); + } + } + destroy() { + this.destroyToolPanelWrappers(); + super.destroy(); + } +}; +function isFilterPanel(toolPanel) { + return toolPanel === "agFiltersToolPanel" || toolPanel === "agNewFiltersToolPanel"; +} +var AgSideBarSelector = { + selector: "AG-SIDE-BAR", + component: AgSideBar +}; + +// packages/ag-grid-enterprise/src/sideBar/sideBarService.ts +var SideBarService = class extends BeanStub7 { + constructor() { + super(...arguments); + this.beanName = "sideBar"; + } + getSelector() { + return AgSideBarSelector; + } +}; + +// packages/ag-grid-enterprise/src/sideBar/sideBarModule.ts +var SideBarModule = { + moduleName: "SideBar", + version: VERSION, + beans: [SideBarService], + apiFunctions: { + isSideBarVisible, + setSideBarVisible, + setSideBarPosition, + openToolPanel, + closeToolPanel, + getOpenedToolPanel, + refreshToolPanel, + isToolPanelShowing, + getToolPanelInstance, + getSideBar + }, + dependsOn: [EnterpriseCoreModule, _HorizontalResizeModule] +}; + +// packages/ag-grid-enterprise/src/widgets/menu.css +var menu_default = '.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}'; + +// packages/ag-grid-enterprise/src/widgets/menuItemRenderer.ts +import { _warn as _warn7 } from "ag-grid-community"; +var MenuItemRenderer = class extends AgMenuItemRenderer { + constructor() { + super({ warnNoIcon: () => _warn7(227) }); + } +}; + +// packages/ag-grid-enterprise/src/widgets/menuItemModule.ts +var MenuItemModule = { + moduleName: "MenuItem", + version: VERSION, + userComponents: { + agMenuItem: MenuItemRenderer + }, + icons: { + // indicates the currently active pin state in the "Pin column" sub-menu of the column menu + check: "tick", + // icon for sub menu item + subMenuOpen: "small-right", + // version of subMenuOpen used in RTL mode + subMenuOpenRtl: "small-left" + }, + css: [menu_default] +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnToolPanel.ts +import { + Component as Component25, + FilterButtonComp as FilterButtonComp2, + _addGridCommonParams as _addGridCommonParams7, + _areEqual, + _clearElement as _clearElement8, + _last as _last4, + _warn as _warn12 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryCols.ts +import { Component as Component24, PositionableFeature, RefPlaceholder as RefPlaceholder24 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryCols.css +var agPrimaryCols_default = ".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{flex:none;height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding)}.ag-column-select-column,.ag-column-select-column-group,.ag-column-select-header{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);position:relative}.ag-column-select-column,.ag-column-select-column-group{height:100%}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-column-group:where(:not(:last-child)),.ag-column-select-column:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}"; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryColsHeader.ts +import { + AgCheckboxSelector as AgCheckboxSelector2, + AgInputTextFieldSelector as AgInputTextFieldSelector5, + Component as Component19, + KeyCode as KeyCode19, + RefPlaceholder as RefPlaceholder21, + _createIconNoSpan as _createIconNoSpan6, + _debounce as _debounce2, + _setDisplayed as _setDisplayed11 +} from "ag-grid-community"; +var DEBOUNCE_DELAY = 300; +var AgPrimaryColsHeaderElement = { + tag: "div", + cls: "ag-column-select-header", + role: "presentation", + children: [ + { tag: "div", ref: "eExpand", cls: "ag-column-select-header-icon" }, + { tag: "ag-checkbox", ref: "eSelect", cls: "ag-column-select-header-checkbox" }, + { tag: "ag-input-text-field", ref: "eFilterTextField", cls: "ag-column-select-header-filter-wrapper" } + ] +}; +var AgPrimaryColsHeader = class extends Component19 { + constructor() { + super(AgPrimaryColsHeaderElement, [AgCheckboxSelector2, AgInputTextFieldSelector5]); + this.eExpand = RefPlaceholder21; + this.eSelect = RefPlaceholder21; + this.eFilterTextField = RefPlaceholder21; + } + postConstruct() { + this.createExpandIcons(); + this.addManagedListeners(this.eExpand, { + click: this.onExpandClicked.bind(this), + keydown: (e) => { + if (e.key === KeyCode19.SPACE) { + e.preventDefault(); + this.onExpandClicked(); + } + } + }); + this.addManagedElementListeners(this.eSelect.getInputElement(), { click: this.onSelectClicked.bind(this) }); + this.addManagedPropertyListener("functionsReadOnly", () => this.onFunctionsReadOnlyPropChanged()); + this.eFilterTextField.setAutoComplete(false).onValueChange(() => this.onFilterTextChanged()); + this.addManagedEventListeners({ newColumnsLoaded: this.showOrHideOptions.bind(this) }); + const translate = this.getLocaleTextFunc(); + this.eSelect.setInputAriaLabel(translate("ariaColumnSelectAll", "Toggle All Columns Visibility")); + this.eFilterTextField.setInputAriaLabel(translate("ariaFilterColumnsInput", "Filter Columns Input")); + this.activateTabIndex([this.eExpand]); + } + onFunctionsReadOnlyPropChanged() { + const readOnly = this.gos.get("functionsReadOnly"); + this.eSelect.setReadOnly(readOnly); + this.eSelect.toggleCss("ag-column-select-column-readonly", readOnly); + } + init(params) { + this.params = params; + const readOnly = this.gos.get("functionsReadOnly"); + this.eSelect.setReadOnly(readOnly); + this.eSelect.toggleCss("ag-column-select-column-readonly", readOnly); + if (this.beans.colModel.ready) { + this.showOrHideOptions(); + } + } + createExpandIcons() { + const beans = this.beans; + this.eExpand.appendChild(this.eExpandChecked = _createIconNoSpan6("columnSelectOpen", beans)); + this.eExpand.appendChild(this.eExpandUnchecked = _createIconNoSpan6("columnSelectClosed", beans)); + this.eExpand.appendChild(this.eExpandIndeterminate = _createIconNoSpan6("columnSelectIndeterminate", beans)); + this.setExpandState(0 /* EXPANDED */); + } + // we only show expand / collapse if we are showing columns + showOrHideOptions() { + const params = this.params; + const showFilter = !params.suppressColumnFilter; + const showSelect = !params.suppressColumnSelectAll; + const showExpand = !params.suppressColumnExpandAll; + const groupsPresent = !!this.beans.colModel.colDefCols?.treeDepth; + const translate = this.getLocaleTextFunc(); + this.eFilterTextField.setInputPlaceholder(translate("searchOoo", "Search...")); + _setDisplayed11(this.eFilterTextField.getGui(), showFilter); + _setDisplayed11(this.eSelect.getGui(), showSelect); + _setDisplayed11(this.eExpand, showExpand && groupsPresent); + } + onFilterTextChanged() { + if (!this.onFilterTextChangedDebounced) { + this.onFilterTextChangedDebounced = _debounce2( + this, + () => { + const filterText = this.eFilterTextField.getValue(); + this.dispatchLocalEvent({ type: "filterChanged", filterText }); + }, + DEBOUNCE_DELAY + ); + } + this.onFilterTextChangedDebounced(); + } + onSelectClicked() { + this.dispatchLocalEvent({ type: this.selectState ? "unselectAll" : "selectAll" }); + } + onExpandClicked() { + this.dispatchLocalEvent({ type: this.expandState === 0 /* EXPANDED */ ? "collapseAll" : "expandAll" }); + } + setExpandState(state) { + this.expandState = state; + _setDisplayed11(this.eExpandChecked, state === 0 /* EXPANDED */); + _setDisplayed11(this.eExpandUnchecked, state === 1 /* COLLAPSED */); + _setDisplayed11(this.eExpandIndeterminate, state === 2 /* INDETERMINATE */); + } + setSelectionState(state) { + this.selectState = state; + this.eSelect.setValue(this.selectState); + } +}; +var AgPrimaryColsHeaderSelector = { + selector: "AG-PRIMARY-COLS-HEADER", + component: AgPrimaryColsHeader +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryColsList.ts +import { + Component as Component23, + DragSourceType as DragSourceType5, + _exists as _exists12, + _setAriaLabel as _setAriaLabel11, + _setAriaLevel as _setAriaLevel3, + _warn as _warn11, + isProvidedColumnGroup as isProvidedColumnGroup4 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/common/toolPanelColDefService.ts +import { AgProvidedColumnGroup, _warn as _warn8, isProvidedColumnGroup } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sideBar/common/sideBarUtils.ts +import { _last as _last3 } from "ag-grid-community"; +function isColGroupDef(colDef) { + return !!colDef && typeof colDef.children !== "undefined"; +} +function getId(colDef) { + return isColGroupDef(colDef) ? colDef.groupId : colDef.colId; +} +function addChildrenToGroup(tree, groupId, colDef) { + const subGroupIsSplit = (currentSubGroup, currentSubGroupToAdd) => { + const existingChildIds = currentSubGroup.children.map(getId); + const childGroupAlreadyExists = existingChildIds.includes(getId(currentSubGroupToAdd)); + const lastChild = _last3(currentSubGroup.children); + const lastChildIsDifferent = lastChild && getId(lastChild) !== getId(currentSubGroupToAdd); + return childGroupAlreadyExists && lastChildIsDifferent; + }; + if (!isColGroupDef(tree)) { + return true; + } + const currentGroup = tree; + const groupToAdd = colDef; + if (subGroupIsSplit(currentGroup, groupToAdd)) { + currentGroup.children.push(groupToAdd); + return true; + } + if (currentGroup.groupId === groupId) { + const existingChildIds = currentGroup.children.map(getId); + const colDefAlreadyPresent = existingChildIds.includes(getId(groupToAdd)); + if (!colDefAlreadyPresent) { + currentGroup.children.push(groupToAdd); + return true; + } + } + for (let i = currentGroup.children.length - 1; i >= 0; i--) { + if (addChildrenToGroup(currentGroup.children[i], groupId, colDef)) { + break; + } + } + return false; +} +function mergeLeafPathTrees(leafPathTrees) { + const matchingRootGroupIds = (pathA, pathB) => { + const bothPathsAreGroups = isColGroupDef(pathA) && isColGroupDef(pathB); + return bothPathsAreGroups && getId(pathA) === getId(pathB); + }; + const mergeTrees = (treeA, treeB) => { + if (!isColGroupDef(treeB)) { + return treeA; + } + const mergeResult = treeA; + const groupToMerge = treeB; + if (groupToMerge.children && groupToMerge.groupId) { + const added = addChildrenToGroup(mergeResult, groupToMerge.groupId, groupToMerge.children[0]); + if (added) { + return mergeResult; + } + } + for (const child of groupToMerge.children) { + mergeTrees(mergeResult, child); + } + return mergeResult; + }; + const mergeColDefs = []; + for (let i = 1; i <= leafPathTrees.length; i++) { + const first = leafPathTrees[i - 1]; + const second = leafPathTrees[i]; + if (matchingRootGroupIds(first, second)) { + leafPathTrees[i] = mergeTrees(first, second); + } else { + mergeColDefs.push(first); + } + } + return mergeColDefs; +} + +// packages/ag-grid-enterprise/src/sideBar/common/toolPanelColDefService.ts +function toolPanelCreateColumnTree(colModel, colDefs) { + const invalidColIds = []; + const createDummyColGroup = (abstractColDef, depth) => { + if (isColGroupDef(abstractColDef)) { + const groupDef = abstractColDef; + const groupId = typeof groupDef.groupId !== "undefined" ? groupDef.groupId : groupDef.headerName; + const group = new AgProvidedColumnGroup(groupDef, groupId, false, depth); + const children = []; + for (const def of groupDef.children) { + const child = createDummyColGroup(def, depth + 1); + if (child) { + children.push(child); + } + } + group.setChildren(children); + return group; + } else { + const colDef = abstractColDef; + const key = colDef.colId ? colDef.colId : colDef.field; + const column = colModel.getColDefCol(key); + if (!column) { + invalidColIds.push(colDef); + } + return column; + } + }; + const mappedResults = []; + for (const colDef of colDefs) { + const result = createDummyColGroup(colDef, 0); + if (result) { + mappedResults.push(result); + } + } + if (invalidColIds.length > 0) { + _warn8(217, { invalidColIds }); + } + return mappedResults; +} +function syncLayoutWithGrid(colModel, syncLayoutCallback) { + const leafPathTrees = getLeafPathTrees(getGridPrimaryColumns(colModel)); + const mergedColumnTrees = mergeLeafPathTrees(leafPathTrees); + syncLayoutCallback(mergedColumnTrees); +} +function syncLayoutWithColumns(columns, syncLayoutCallback) { + const leafPathTrees = getLeafPathTrees(columns); + const mergedColumnTrees = mergeLeafPathTrees(leafPathTrees); + syncLayoutCallback(mergedColumnTrees); +} +function getLeafPathTrees(columns) { + const getLeafPathTree = (node, childDef) => { + let leafPathTree; + if (isProvidedColumnGroup(node)) { + if (node.isPadding()) { + leafPathTree = childDef; + } else { + const groupDef = Object.assign({}, node.getColGroupDef()); + groupDef.groupId = node.getGroupId(); + groupDef.children = [childDef]; + leafPathTree = groupDef; + } + } else { + const colDef = Object.assign({}, node.getColDef()); + colDef.colId = node.getColId(); + leafPathTree = colDef; + } + const parent = node.getOriginalParent(); + if (parent) { + return getLeafPathTree(parent, leafPathTree); + } else { + return leafPathTree; + } + }; + return columns.map((col) => getLeafPathTree(col, col.getColDef())); +} +function getGridPrimaryColumns(colModel) { + return colModel.getCols().filter((column) => { + const colDef = column.getColDef(); + return column.isPrimary() && !colDef.showRowGroup; + }); +} + +// packages/ag-grid-enterprise/src/columnToolPanel/columnModelItem.ts +import { LocalEventService } from "ag-grid-community"; +var ColumnModelItem = class { + constructor(displayName, columnOrGroup, depth, group = false, expanded) { + this.displayName = displayName; + this.depth = depth; + this.group = group; + this.localEventService = new LocalEventService(); + if (group) { + this.columnGroup = columnOrGroup; + this._expanded = expanded; + this.children = []; + } else { + this.column = columnOrGroup; + } + } + get expanded() { + return !!this._expanded; + } + set expanded(expanded) { + if (expanded === this._expanded) { + return; + } + this._expanded = expanded; + this.localEventService.dispatchEvent({ type: "expandedChanged" }); + } + addEventListener(eventType, listener) { + this.localEventService.addEventListener(eventType, listener); + } + removeEventListener(eventType, listener) { + this.localEventService.removeEventListener(eventType, listener); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnMoveUtils.ts +import { isProvidedColumnGroup as isProvidedColumnGroup3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelColumnGroupComp.ts +import { + AgCheckboxSelector as AgCheckboxSelector3, + Component as Component21, + DragSourceType as DragSourceType3, + KeyCode as KeyCode20, + RefPlaceholder as RefPlaceholder22, + TouchListener, + _createIcon, + _createIconNoSpan as _createIconNoSpan8, + _getShouldDisplayTooltip, + _getToolPanelClassesFromColDef, + _setAriaDescribedBy as _setAriaDescribedBy2, + _setAriaExpanded as _setAriaExpanded6, + _setAriaLabel as _setAriaLabel9, + _setDisplayed as _setDisplayed12 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelDeferredUiUtils.ts +function isDeferredMode(params) { + return !!params?.buttons?.includes("apply"); +} +function refreshDeferredToolPanelUi(beans, params) { + if (!isDeferredMode(params)) { + return; + } + const openedPanelId = beans.sideBar?.comp.openedItem(); + if (!openedPanelId) { + return; + } + const toolPanel = beans.sideBar?.comp.getToolPanelInstance(openedPanelId); + toolPanel?.refreshDeferredUi(); +} + +// packages/ag-grid-enterprise/src/columnToolPanel/modelItemUtils.ts +function selectAllChildren(beans, colTree, selectAllChecked, eventType, params) { + const cols = extractAllLeafColumns(colTree); + setAllColumns(beans, cols, selectAllChecked, eventType, params); +} +function setAllColumns(beans, cols, selectAllChecked, eventType, params) { + const updateStrategy = beans.columnStateUpdateStrategy; + const isPivotMode2 = updateStrategy.getPivotMode(isDeferredMode(params)); + if (isPivotMode2) { + setAllPivot(beans, cols, selectAllChecked, eventType, params); + } else { + setAllVisible(beans, cols, selectAllChecked, eventType, params); + } +} +function extractAllLeafColumns(allItems) { + const res = []; + const recursiveFunc = (items) => { + for (const item of items) { + if (!item.passesFilter) { + continue; + } + if (item.group) { + recursiveFunc(item.children); + } else { + res.push(item.column); + } + } + }; + recursiveFunc(allItems); + return res; +} +function setAllVisible(beans, columns, visible, eventType, params) { + const updateStrategy = beans.columnStateUpdateStrategy; + const colStateItems = []; + for (const col of columns) { + if (col.getColDef().lockVisible) { + continue; + } + if (updateStrategy.isColumnVisibleInToolPanel(isDeferredMode(params), col) !== visible) { + colStateItems.push({ + colId: col.getId(), + hide: !visible + }); + } + } + updateStrategy.applyColumnState(isDeferredMode(params), colStateItems, eventType); + refreshDeferredToolPanelUi(beans, params); +} +function setAllPivot(beans, columns, value, eventType, params) { + setAllPivotActive(beans, columns, value, eventType, params); +} +function setAllPivotActive(beans, columns, value, eventType, params) { + const updateStrategy = beans.columnStateUpdateStrategy; + const colStateItems = []; + const turnOnAction = (col) => { + if (updateStrategy.isColumnSelectedInPivotModeToolPanel(isDeferredMode(params), col)) { + return; + } + if (col.isAllowValue()) { + const aggFunc = typeof col.getAggFunc() === "string" ? col.getAggFunc() : beans.aggFuncSvc?.getDefaultAggFunc(col); + colStateItems.push({ + colId: col.getId(), + aggFunc + }); + } else if (col.isAllowRowGroup()) { + colStateItems.push({ + colId: col.getId(), + rowGroup: true + }); + } else if (col.isAllowPivot()) { + colStateItems.push({ + colId: col.getId(), + pivot: true + }); + } + }; + const turnOffAction = (col) => { + const isActive = updateStrategy.isColumnSelectedInPivotModeToolPanel(isDeferredMode(params), col); + if (isActive) { + colStateItems.push({ + colId: col.getId(), + pivot: false, + rowGroup: false, + aggFunc: null + }); + } + }; + const action = value ? turnOnAction : turnOffAction; + columns.forEach(action); + updateStrategy.applyColumnState(isDeferredMode(params), colStateItems, eventType); + refreshDeferredToolPanelUi(beans, params); +} +function updateColumns(beans, params) { + const { columns, visibleState, pivotState, eventType } = params; + const updateStrategy = beans.columnStateUpdateStrategy; + const isPivotMode2 = updateStrategy.getPivotMode(isDeferredMode(params)); + const state = columns.map((column) => { + const colId = column.getColId(); + if (isPivotMode2) { + const pivotStateForColumn = pivotState?.[colId]; + return { + colId, + pivot: pivotStateForColumn?.pivot, + rowGroup: pivotStateForColumn?.rowGroup, + aggFunc: pivotStateForColumn?.aggFunc + }; + } else { + return { + colId, + hide: !visibleState?.[colId] + }; + } + }); + updateStrategy.applyColumnState(isDeferredMode(params), state, eventType); + refreshDeferredToolPanelUi(beans, params); +} +function createPivotState(column) { + return { + pivot: column.isPivotActive(), + rowGroup: column.isRowGroupActive(), + aggFunc: column.isValueActive() ? column.getAggFunc() : void 0 + }; +} +function createPivotStateForToolPanel(column, updateStrategy, deferApply) { + if (!deferApply) { + return createPivotState(column); + } + const rowGroup = updateStrategy.getRowGroupColumns(deferApply).includes(column); + const pivot = updateStrategy.getPivotColumns(deferApply).includes(column); + const value = updateStrategy.getValueColumns(deferApply).includes(column); + return { + pivot, + rowGroup, + aggFunc: value ? updateStrategy.getColumnAggFunc(deferApply, column) : void 0 + }; +} + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelContextMenu.ts +import { Component as Component20, _createIconNoSpan as _createIconNoSpan7, _focusInto as _focusInto5, isColumn, isProvidedColumnGroup as isProvidedColumnGroup2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/aggregation/aggDataUtils.ts +var getNodesFromMappedSet = (mappedSet, keys) => { + if (!keys) { + return []; + } + let mapPointer = mappedSet; + for (let i = 0, len = keys.length; i < len && mapPointer; ++i) { + mapPointer = mapPointer[keys[i]]; + } + return Array.isArray(mapPointer) ? mapPointer : []; +}; +var setAggData = (rowNode, newAggData, colModel) => { + const oldAggData = rowNode.aggData; + if (oldAggData === newAggData) { + return; + } + rowNode.aggData = newAggData; + if (rowNode.__localEventService) { + fireAggDataChangedEvents(rowNode, oldAggData, newAggData, colModel); + } +}; +var setAggDataWithSiblings = (rowNode, newAggData, colModel) => { + setAggData(rowNode, newAggData, colModel); + const pinnedSibling = rowNode.pinnedSibling; + if (pinnedSibling) { + setAggData(pinnedSibling, newAggData, colModel); + } + const sibling = rowNode.sibling; + if (sibling) { + setAggData(sibling, newAggData, colModel); + const siblingPinnedSibling = sibling.pinnedSibling; + if (siblingPinnedSibling) { + setAggData(siblingPinnedSibling, newAggData, colModel); + } + } +}; +var fireAggDataChangedEvents = (rowNode, oldAggData, newAggData, colModel) => { + if (!newAggData) { + if (!oldAggData) { + return; + } + const oldKeys2 = Object.keys(oldAggData); + for (let i = 0, len = oldKeys2.length; i < len; ++i) { + const colId = oldKeys2[i]; + const column = colModel.getColById(colId); + if (column) { + rowNode.dispatchCellChangedEvent(column, void 0, oldAggData[colId]); + } + } + return; + } + const newKeys = Object.keys(newAggData); + for (let i = 0, len = newKeys.length; i < len; ++i) { + const colId = newKeys[i]; + const value = newAggData[colId]; + const oldValue = oldAggData ? oldAggData[colId] : void 0; + if (value === oldValue) { + continue; + } + const column = colModel.getColById(colId); + if (column) { + rowNode.dispatchCellChangedEvent(column, value, oldValue); + } + } + if (!oldAggData) { + return; + } + const oldKeys = Object.keys(oldAggData); + for (let i = 0, len = oldKeys.length; i < len; ++i) { + const colId = oldKeys[i]; + if (colId in newAggData) { + continue; + } + const column = colModel.getColById(colId); + if (column) { + rowNode.dispatchCellChangedEvent(column, void 0, oldAggData[colId]); + } + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingUtils.ts +var setRowNodeGroupValue = (rowNode, colModel, colKey, newValue) => { + const column = colModel.getCol(colKey); + let groupData = rowNode._groupData; + if (!groupData) { + groupData = {}; + rowNode._groupData = groupData; + } + const columnId = column.getColId(); + const oldValue = groupData[columnId]; + if (oldValue === newValue) { + return; + } + groupData[columnId] = newValue; + rowNode.dispatchCellChangedEvent(column, newValue, oldValue); +}; +var doSetRowNodeGroup = (rowNode, beans, group) => { + if (!rowNode) { + return; + } + const oldGroup = rowNode.group; + if (oldGroup === group) { + return; + } + rowNode.group = group; + rowNode.updateHasChildren(); + if (oldGroup && !group) { + setAggData(rowNode, null, beans.colModel); + rowNode.setAllChildrenCount(null); + } + beans.selectionSvc?.updateRowSelectable(rowNode); + rowNode.dispatchRowEvent("groupChanged"); +}; +var setRowNodeGroup = (rowNode, beans, group) => { + doSetRowNodeGroup(rowNode, beans, group); + doSetRowNodeGroup(rowNode.pinnedSibling, beans, group); +}; +var isRowGroupColLocked = (column, beans) => { + const { gos, rowGroupColsSvc } = beans; + if (!rowGroupColsSvc || !column) { + return false; + } + const groupLockGroupColumns = gos.get("groupLockGroupColumns"); + if (!column.isRowGroupActive() || groupLockGroupColumns === 0) { + return false; + } + if (groupLockGroupColumns === -1) { + return true; + } + const colIndex = rowGroupColsSvc.columns.findIndex((groupCol) => groupCol.getColId() === column.getColId()); + return groupLockGroupColumns > colIndex; +}; +var getGroupingLocaleText = (localeTextFunc, key, displayName) => { + const prefix = key === "groupBy" ? "Group by" : "Un-Group by"; + const localStr = localeTextFunc(key, `${prefix} ${displayName}`, [displayName]); + if (localStr.indexOf(displayName) >= 0) { + return localStr; + } else { + return `${localStr} ${displayName}`; + } +}; + +// packages/ag-grid-enterprise/src/widgets/menuItemComponent.ts +import { AgPromise as AgPromise2, _STOP_PROPAGATION_CALLBACKS as _STOP_PROPAGATION_CALLBACKS3, _addGridCommonParams as _addGridCommonParams6, _warn as _warn9 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/misc/enterpriseDomUtils.ts +import { _getRootNode as _getRootNode2, _isBrowserFirefox, _isBrowserSafari } from "ag-grid-community"; +function _getTextSelectionRanges(beans) { + const rootNode = _getRootNode2(beans); + const selection = "getSelection" in rootNode ? rootNode.getSelection() : null; + const ranges = []; + for (let i = 0; i < (selection?.rangeCount ?? 0); i++) { + const range = selection?.getRangeAt(i); + if (range) { + ranges.push(range); + } + } + return { selection, ranges }; +} +function _preserveRangesWhile(beans, fn) { + const enableCellTextSelection = beans.gos.get("enableCellTextSelection"); + if (!enableCellTextSelection) { + return fn(); + } + if (!_isBrowserFirefox() && !_isBrowserSafari()) { + return fn(); + } + const { selection, ranges } = _getTextSelectionRanges(beans); + fn(); + selection?.removeAllRanges(); + for (const range of ranges) { + selection?.addRange(range); + } +} + +// packages/ag-grid-enterprise/src/widgets/menuItemComponent.ts +var MenuItemComponentType = { + name: "menuItem", + optionalMethods: ["setActive", "select", "setExpanded", "configureDefaults"] +}; +var MENU_ITEM_CALLBACKS = { + getMenuItemComp: (beans, def, params) => { + const compDetails = beans.userCompFactory.getCompDetails( + def, + MenuItemComponentType, + "agMenuItem", + _addGridCommonParams6(beans.gos, params), + true + ); + return compDetails?.newAgStackInstance() ?? AgPromise2.resolve(); + }, + getPostProcessPopupParams: ({ column, node }) => ({ + column, + rowNode: node + }), + preserveRangesWhile: _preserveRangesWhile, + stopPropagationCallbacks: _STOP_PROPAGATION_CALLBACKS3, + warnNoItem: (menuItemOrString) => { + _warn9(228, { menuItemOrString }); + } +}; +var MenuItemComponent = class extends AgMenuItemComponent { + constructor() { + super(MENU_ITEM_CALLBACKS); + } +}; + +// packages/ag-grid-enterprise/src/widgets/menuList.ts +var MenuList = class extends AgMenuList { + constructor(level, menuActionParams = { + column: null, + node: null, + value: null + }) { + super(level, menuActionParams, MENU_ITEM_CALLBACKS); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelContextMenu.ts +var ToolPanelContextMenu = class extends Component20 { + constructor(column, mouseEventOrTouch, parentEl, params = {}) { + super({ tag: "div", cls: "ag-menu" }); + this.column = column; + this.mouseEventOrTouch = mouseEventOrTouch; + this.parentEl = parentEl; + this.params = params; + this.displayName = null; + } + postConstruct() { + const { + column, + beans: { colNames } + } = this; + this.initializeProperties(column); + let displayName; + if (isColumn(column)) { + displayName = colNames.getDisplayNameForColumn(column, "columnToolPanel"); + } else { + displayName = colNames.getDisplayNameForProvidedColumnGroup(null, column, "columnToolPanel"); + } + this.displayName = displayName; + this.buildMenuItemMap(); + if (this.isActive()) { + const mouseEventOrTouch = this.mouseEventOrTouch; + if ("preventDefault" in mouseEventOrTouch) { + mouseEventOrTouch.preventDefault(); + } + const menuItemsMapped = this.getMappedMenuItems(); + if (menuItemsMapped.length === 0) { + return; + } + this.displayContextMenu(menuItemsMapped); + } + } + initializeProperties(column) { + const updateStrategy = this.beans.columnStateUpdateStrategy; + let columns; + if (isProvidedColumnGroup2(column)) { + columns = column.getLeafColumns(); + } else { + columns = [column]; + } + this.columns = columns; + const isPivotMode2 = updateStrategy.getPivotMode(isDeferredMode(this.params)); + this.allowScrollIntoView = !isPivotMode2 && columns.some(this.isColumnValidForScrollIntoView); + this.allowGrouping = columns.some((col) => col.isPrimary() && col.isAllowRowGroup()); + this.allowValues = columns.some((col) => col.isPrimary() && col.isAllowValue()); + this.allowPivoting = isPivotMode2 && columns.some((col) => col.isPrimary() && col.isAllowPivot()); + } + buildMenuItemMap() { + const localeTextFunc = this.getLocaleTextFunc(); + const { beans, displayName } = this; + const updateStrategy = this.beans.columnStateUpdateStrategy; + const menuItemMap = /* @__PURE__ */ new Map(); + this.menuItemMap = menuItemMap; + const deferMode = isDeferredMode(this.params); + const isPivotMode2 = updateStrategy.getPivotMode(deferMode); + const rowGroupColIdSet = new Set( + updateStrategy.getRowGroupColumns(deferMode).map((col) => col.getColId()) + ); + const valueColIdSet = new Set(updateStrategy.getValueColumns(deferMode).map((col) => col.getColId())); + const pivotColIdSet = new Set(updateStrategy.getPivotColumns(deferMode).map((col) => col.getColId())); + menuItemMap.set("scrollIntoView", { + allowedFunction: (col) => !col.isPinned() && !isPivotMode2 && this.isColumnValidForScrollIntoView(col), + activeFunction: () => false, + activateLabel: () => localeTextFunc("scrollColumnIntoView", `Scroll ${displayName} into View`, [displayName]), + activateFunction: () => { + const firstVisibleColumn = this.columns.find(this.isColumnValidForScrollIntoView); + if (firstVisibleColumn) { + this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(firstVisibleColumn); + } + }, + deActivateFunction: () => { + }, + addIcon: "ensureColumnVisible" + }); + const rowGroupAllowed = (col) => col.isPrimary() && col.isAllowRowGroup() && !isRowGroupColLocked(col, beans); + menuItemMap.set("rowGroup", { + allowedFunction: rowGroupAllowed, + activeFunction: (col) => rowGroupColIdSet.has(col.getColId()), + activateLabel: () => getGroupingLocaleText(localeTextFunc, "groupBy", displayName), + deactivateLabel: () => getGroupingLocaleText(localeTextFunc, "ungroupBy", displayName), + activateFunction: () => { + const columns = this.addColumnsToList(updateStrategy.getRowGroupColumns(deferMode), rowGroupAllowed); + updateStrategy.setRowGroupColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + deActivateFunction: () => { + const columns = this.removeColumnsFromList( + updateStrategy.getRowGroupColumns(deferMode), + rowGroupAllowed + ); + updateStrategy.setRowGroupColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + addIcon: "menuAddRowGroup", + removeIcon: "menuRemoveRowGroup" + }); + const valueAllowed = (col) => col.isPrimary() && col.isAllowValue(); + menuItemMap.set("value", { + allowedFunction: valueAllowed, + activeFunction: (col) => valueColIdSet.has(col.getColId()), + activateLabel: () => localeTextFunc("addToValues", `Add ${displayName} to values`, [displayName]), + deactivateLabel: () => localeTextFunc("removeFromValues", `Remove ${displayName} from values`, [displayName]), + activateFunction: () => { + const columns = this.addColumnsToList(updateStrategy.getValueColumns(deferMode), valueAllowed); + updateStrategy.setValueColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + deActivateFunction: () => { + const columns = this.removeColumnsFromList(updateStrategy.getValueColumns(deferMode), valueAllowed); + updateStrategy.setValueColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + addIcon: "valuePanel", + removeIcon: "valuePanel" + }); + const pivotAllowed = (col) => isPivotMode2 && col.isPrimary() && col.isAllowPivot(); + menuItemMap.set("pivot", { + allowedFunction: pivotAllowed, + activeFunction: (col) => pivotColIdSet.has(col.getColId()), + activateLabel: () => localeTextFunc("addToLabels", `Add ${displayName} to labels`, [displayName]), + deactivateLabel: () => localeTextFunc("removeFromLabels", `Remove ${displayName} from labels`, [displayName]), + activateFunction: () => { + const columns = this.addColumnsToList(updateStrategy.getPivotColumns(deferMode), pivotAllowed); + updateStrategy.setPivotColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + deActivateFunction: () => { + const columns = this.removeColumnsFromList(updateStrategy.getPivotColumns(deferMode), pivotAllowed); + updateStrategy.setPivotColumns(deferMode, columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.params); + }, + addIcon: "pivotPanel", + removeIcon: "pivotPanel" + }); + } + isColumnValidForScrollIntoView(col) { + const isVisible = col.isVisible(); + if (!isVisible) { + return false; + } + const parent = col.getParent(); + if (!parent) { + return true; + } + return parent.getDisplayedChildren()?.includes(col) ?? true; + } + addColumnsToList(columnList, predicate) { + return [...columnList].concat(this.columns.filter((col) => predicate(col) && !columnList.includes(col))); + } + removeColumnsFromList(columnList, predicate) { + return columnList.filter((col) => !predicate(col) || !this.columns.includes(col)); + } + displayContextMenu(menuItemsMapped) { + const eGui = this.getGui(); + const menuList = this.createBean(new MenuList()); + const localeTextFunc = this.getLocaleTextFunc(); + let hideFunc = () => { + }; + eGui.appendChild(menuList.getGui()); + menuList.addMenuItems(menuItemsMapped); + menuList.addManagedListeners(menuList, { + closeMenu: () => { + this.parentEl.focus(); + hideFunc(); + } + }); + const popupSvc = this.beans.popupSvc; + const addPopupRes = popupSvc.addPopup({ + modal: true, + eChild: eGui, + closeOnEsc: true, + afterGuiAttached: () => _focusInto5(menuList.getGui()), + ariaLabel: localeTextFunc("ariaLabelContextMenu", "Context Menu"), + closedCallback: (e) => { + if (e instanceof KeyboardEvent) { + this.parentEl.focus(); + } + this.destroyBean(menuList); + } + }); + if (addPopupRes) { + hideFunc = addPopupRes.hideFunc; + } + popupSvc.positionPopupUnderMouseEvent({ + type: "columnContextMenu", + mouseEvent: this.mouseEventOrTouch, + ePopup: eGui + }); + } + isActive() { + return this.allowScrollIntoView || this.allowGrouping || this.allowValues || this.allowPivoting; + } + getMappedMenuItems() { + const ret = []; + const { menuItemMap, columns, displayName, beans } = this; + for (const val of menuItemMap.values()) { + const isInactive = columns.some((col) => val.allowedFunction(col) && !val.activeFunction(col)); + const isActive = columns.some((col) => val.allowedFunction(col) && val.activeFunction(col)); + if (isInactive) { + ret.push({ + name: val.activateLabel(displayName), + icon: _createIconNoSpan7(val.addIcon, beans, null), + action: () => val.activateFunction() + }); + } + if (isActive && val.removeIcon && val.deactivateLabel) { + ret.push({ + name: val.deactivateLabel(displayName), + icon: _createIconNoSpan7(val.removeIcon, beans, null), + action: () => val.deActivateFunction?.() + }); + } + } + return ret; + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelColumnGroupComp.ts +var ToolPanelColumnGroupElement = { + tag: "div", + cls: "ag-column-select-column-group", + children: [ + { + tag: "span", + ref: "eColumnGroupIcons", + cls: "ag-column-group-icons", + children: [ + { tag: "span", ref: "eGroupClosedIcon", cls: "ag-column-group-closed-icon" }, + { tag: "span", ref: "eGroupOpenedIcon", cls: "ag-column-group-opened-icon" } + ] + }, + { tag: "ag-checkbox", ref: "cbSelect", cls: "ag-column-select-checkbox" }, + { tag: "span", ref: "eLabel", cls: "ag-column-select-column-label" } + ] +}; +var ToolPanelColumnGroupComp = class extends Component21 { + constructor(modelItem, allowDragging, eventType, focusWrapper, params) { + super(); + this.modelItem = modelItem; + this.allowDragging = allowDragging; + this.eventType = eventType; + this.focusWrapper = focusWrapper; + this.params = params; + this.cbSelect = RefPlaceholder22; + this.eLabel = RefPlaceholder22; + this.eGroupOpenedIcon = RefPlaceholder22; + this.eGroupClosedIcon = RefPlaceholder22; + this.eColumnGroupIcons = RefPlaceholder22; + this.processingColumnStateChange = false; + const { columnGroup, depth, displayName } = modelItem; + this.columnGroup = columnGroup; + this.columnDepth = depth; + this.displayName = displayName; + } + postConstruct() { + this.setTemplate(ToolPanelColumnGroupElement, [AgCheckboxSelector3]); + const { beans, cbSelect, eLabel, displayName, columnDepth, modelItem, focusWrapper, columnGroup } = this; + const { registry, gos } = beans; + const eDragHandle = _createIconNoSpan8("columnDrag", beans); + this.eDragHandle = eDragHandle; + eDragHandle.classList.add("ag-drag-handle", "ag-column-select-column-group-drag-handle"); + const checkboxGui = cbSelect.getGui(); + const checkboxInput = cbSelect.getInputElement(); + checkboxGui.after(eDragHandle); + checkboxInput.setAttribute("tabindex", "-1"); + eLabel.textContent = displayName ?? ""; + this.setupExpandContract(); + this.addCss("ag-column-select-indent-" + columnDepth); + this.getGui().style.setProperty("--ag-indentation-level", String(columnDepth)); + this.tooltipFeature = this.createOptionalManagedBean( + registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.focusWrapper, + getLocation: () => "columnToolPanelColumnGroup", + shouldDisplayTooltip: _getShouldDisplayTooltip(gos, () => eLabel) + }) + ); + this.addManagedEventListeners({ columnPivotModeChanged: this.onColumnStateChanged.bind(this) }); + this.addManagedElementListeners(eLabel, { click: this.onLabelClicked.bind(this) }); + this.addManagedListeners(cbSelect, { fieldValueChanged: this.onCheckboxChanged.bind(this) }); + this.addManagedListeners(modelItem, { expandedChanged: this.onExpandChanged.bind(this) }); + const touchListener = new TouchListener(this.getGui(), false); + this.addManagedListeners(touchListener, { + longTap: (e) => this.onContextMenu(e.touchStart) + }); + this.addDestroyFunc(touchListener.destroy.bind(touchListener)); + this.addManagedListeners(focusWrapper, { + keydown: this.handleKeyDown.bind(this), + contextmenu: this.onContextMenu.bind(this) + }); + this.setOpenClosedIcons(); + this.setupDragging(); + this.onColumnStateChanged(); + this.addVisibilityListenersToAllChildren(); + this.refreshAriaExpanded(); + this.refreshAriaLabel(); + this.setupTooltip(); + const classes = _getToolPanelClassesFromColDef(columnGroup.getColGroupDef(), gos, null, columnGroup); + for (const c of classes) { + this.toggleCss(c, true); + } + } + getColumns() { + return this.columnGroup.getLeafColumns(); + } + setupTooltip() { + const colGroupDef = this.columnGroup.getColGroupDef(); + if (!colGroupDef) { + return; + } + const refresh = () => this.tooltipFeature?.setTooltipAndRefresh(colGroupDef.headerTooltip); + refresh(); + this.addManagedEventListeners({ newColumnsLoaded: refresh }); + } + handleKeyDown(e) { + switch (e.key) { + case KeyCode20.LEFT: + e.preventDefault(); + this.modelItem.expanded = false; + break; + case KeyCode20.RIGHT: + e.preventDefault(); + this.modelItem.expanded = true; + break; + case KeyCode20.SPACE: + e.preventDefault(); + if (this.isSelectable()) { + this.onSelectAllChanged(!this.isSelected()); + } + break; + } + } + onContextMenu(e) { + const { columnGroup, gos } = this; + if (gos.get("functionsReadOnly")) { + return; + } + const contextMenu = this.createBean(new ToolPanelContextMenu(columnGroup, e, this.focusWrapper, this.params)); + this.addDestroyFunc(() => { + if (contextMenu.isAlive()) { + this.destroyBean(contextMenu); + } + }); + } + addVisibilityListenersToAllChildren() { + const listener = this.onColumnStateChanged.bind(this); + for (const column of this.columnGroup.getLeafColumns()) { + this.addManagedListeners(column, { + visibleChanged: listener, + columnValueChanged: listener, + columnPivotChanged: listener, + columnRowGroupChanged: listener + }); + } + } + setupDragging() { + if (!this.allowDragging) { + _setDisplayed12(this.eDragHandle, false); + return; + } + const beans = this.beans; + const { gos, eventSvc, dragAndDrop } = beans; + let hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + const dragSource = { + type: DragSourceType3.ToolPanel, + eElement: this.eDragHandle, + dragItemName: this.displayName, + getDefaultIconName: () => hideColumnOnExit ? "hide" : "notAllowed", + getDragItem: () => this.createDragItem(), + onDragStarted: () => { + hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + eventSvc.dispatchEvent({ + type: "columnPanelItemDragStart", + column: this.columnGroup + }); + }, + onDragStopped: () => { + eventSvc.dispatchEvent({ + type: "columnPanelItemDragEnd" + }); + }, + onGridEnter: (dragItem) => { + if (hideColumnOnExit) { + updateColumns(beans, { + columns: this.columnGroup.getLeafColumns(), + visibleState: dragItem?.visibleState, + pivotState: dragItem?.pivotState, + eventType: this.eventType, + buttons: this.params.buttons + }); + } + }, + onGridExit: () => { + if (hideColumnOnExit) { + this.onChangeCommon(false); + } + } + }; + dragAndDrop.addDragSource(dragSource, true); + this.addDestroyFunc(() => dragAndDrop.removeDragSource(dragSource)); + } + createDragItem() { + const columns = this.columnGroup.getLeafColumns(); + const visibleState = {}; + const pivotState = {}; + const updateStrategy = this.beans.columnStateUpdateStrategy; + const deferApply = isDeferredMode(this.params); + for (const col of columns) { + const colId = col.getId(); + visibleState[colId] = col.isVisible(); + pivotState[colId] = createPivotStateForToolPanel(col, updateStrategy, deferApply); + } + return { + columns, + visibleState, + pivotState + }; + } + setupExpandContract() { + const { beans, eGroupClosedIcon, eGroupOpenedIcon, eColumnGroupIcons } = this; + eGroupClosedIcon.appendChild(_createIcon("columnSelectClosed", beans, null)); + eGroupOpenedIcon.appendChild(_createIcon("columnSelectOpen", beans, null)); + const listener = this.onExpandOrContractClicked.bind(this); + this.addManagedElementListeners(eGroupClosedIcon, { click: listener }); + this.addManagedElementListeners(eGroupOpenedIcon, { click: listener }); + const touchListener = new TouchListener(eColumnGroupIcons, true); + this.addManagedListeners(touchListener, { tap: listener }); + this.addDestroyFunc(touchListener.destroy.bind(touchListener)); + } + onLabelClicked() { + const nextState = !this.cbSelect.getValue(); + this.onChangeCommon(nextState); + } + onCheckboxChanged(event) { + this.onChangeCommon(event.selected); + } + getVisibleLeafColumns() { + const childColumns = []; + const extractCols = (children) => { + for (const child of children) { + if (child.passesFilter) { + if (child.group) { + extractCols(child.children); + } else { + childColumns.push(child.column); + } + } + } + }; + extractCols(this.modelItem.children); + return childColumns; + } + onChangeCommon(nextState) { + this.refreshAriaLabel(); + if (this.processingColumnStateChange) { + return; + } + selectAllChildren(this.beans, this.modelItem.children, nextState, this.eventType, this.params); + } + refreshAriaLabel() { + const { cbSelect, focusWrapper, displayName } = this; + const translate = this.getLocaleTextFunc(); + const columnLabel = translate("ariaColumnGroup", "Column Group"); + const checkboxValue = cbSelect.getValue(); + const state = checkboxValue === void 0 ? translate("ariaIndeterminate", "indeterminate") : checkboxValue ? translate("ariaVisible", "visible") : translate("ariaHidden", "hidden"); + const visibilityLabel = translate("ariaToggleVisibility", "Press SPACE to toggle visibility"); + _setAriaLabel9(focusWrapper, `${displayName} ${columnLabel}`); + cbSelect.setInputAriaLabel(`${visibilityLabel} (${state})`); + _setAriaDescribedBy2(focusWrapper, cbSelect.getInputElement().id); + } + onColumnStateChanged() { + const selectedValue = this.workOutSelectedValue(); + const readOnlyValue = this.workOutReadOnlyValue(); + this.processingColumnStateChange = true; + const cbSelect = this.cbSelect; + cbSelect.setValue(selectedValue); + cbSelect.setReadOnly(readOnlyValue); + this.toggleCss("ag-column-select-column-group-readonly", readOnlyValue); + this.processingColumnStateChange = false; + } + workOutSelectedValue() { + const updateStrategy = this.beans.columnStateUpdateStrategy; + const pivotMode = updateStrategy.getPivotMode(isDeferredMode(this.params)); + const visibleLeafColumns = this.getVisibleLeafColumns(); + let checkedCount = 0; + let uncheckedCount = 0; + for (const column of visibleLeafColumns) { + if (pivotMode || !column.getColDef().lockVisible) { + if (this.isColumnChecked(column)) { + checkedCount++; + } else { + uncheckedCount++; + } + } + } + if (checkedCount > 0 && uncheckedCount > 0) { + return void 0; + } + return checkedCount > 0; + } + workOutReadOnlyValue() { + const pivotMode = this.beans.columnStateUpdateStrategy.getPivotMode(isDeferredMode(this.params)); + let colsThatCanAction = 0; + for (const col of this.columnGroup.getLeafColumns()) { + if (pivotMode) { + if (col.isAnyFunctionAllowed()) { + colsThatCanAction++; + } + } else if (!col.getColDef().lockVisible) { + colsThatCanAction++; + } + } + return colsThatCanAction === 0; + } + isColumnChecked(column) { + const updateStrategy = this.beans.columnStateUpdateStrategy; + if (updateStrategy.getPivotMode(isDeferredMode(this.params))) { + return updateStrategy.isColumnSelectedInPivotModeToolPanel(isDeferredMode(this.params), column); + } + return updateStrategy.isColumnVisibleInToolPanel(isDeferredMode(this.params), column); + } + onExpandOrContractClicked() { + const modelItem = this.modelItem; + const oldState = modelItem.expanded; + modelItem.expanded = !oldState; + } + onExpandChanged() { + this.setOpenClosedIcons(); + this.refreshAriaExpanded(); + } + setOpenClosedIcons() { + const folderOpen = this.modelItem.expanded; + _setDisplayed12(this.eGroupClosedIcon, !folderOpen); + _setDisplayed12(this.eGroupOpenedIcon, folderOpen); + } + refreshAriaExpanded() { + _setAriaExpanded6(this.focusWrapper, this.modelItem.expanded); + } + getDisplayName() { + return this.displayName; + } + onSelectAllChanged(value) { + const cbSelect = this.cbSelect; + const cbValue = cbSelect.getValue(); + const readOnly = cbSelect.isReadOnly(); + if (!readOnly && (value && !cbValue || !value && cbValue)) { + cbSelect.toggle(); + } + } + isSelected() { + return this.cbSelect.getValue(); + } + isSelectable() { + return !this.cbSelect.isReadOnly(); + } + setSelected(selected) { + this.cbSelect.setValue(selected, true); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnMoveUtils.ts +var getCurrentColumnsBeingMoved = (column) => { + if (isProvidedColumnGroup3(column)) { + return column.getLeafColumns(); + } + return column ? [column] : []; +}; +var getMoveTargetIndex = (currentColumns, lastHoveredColumn, isBefore, allColumns) => { + if (!lastHoveredColumn || !currentColumns) { + return null; + } + const targetColumnIndex = allColumns.indexOf(lastHoveredColumn); + const adjustedTarget = isBefore ? targetColumnIndex : targetColumnIndex + 1; + const diff = getMoveDiff(allColumns, currentColumns, adjustedTarget); + return adjustedTarget - diff; +}; +var getMoveDiff = (allColumns, currentColumns, end) => { + if (!currentColumns) { + return 0; + } + const targetColumn = currentColumns[0]; + const span = currentColumns.length; + const currentIndex = allColumns.indexOf(targetColumn); + if (currentIndex < end) { + return span; + } + return 0; +}; +var isMoveBlocked = (gos, beans, currentColumns, params) => { + const deferMode = isDeferredMode(params); + const preventMoving = gos.get("suppressMovableColumns") || beans.columnStateUpdateStrategy.getPivotMode(deferMode); + if (preventMoving) { + return true; + } + const hasNotMovable = currentColumns.find(({ colDef }) => !!colDef.suppressMovable || !!colDef.lockPosition); + return !!hasNotMovable; +}; +var moveItem = (beans, currentColumns, lastHoveredListItem, params) => { + if (!lastHoveredListItem) { + return; + } + const { component } = lastHoveredListItem; + let lastHoveredColumn = null; + let isBefore = lastHoveredListItem.position === "top"; + if (component instanceof ToolPanelColumnGroupComp) { + const columns = component.getColumns(); + lastHoveredColumn = columns[0]; + isBefore = true; + } else if (component) { + lastHoveredColumn = component.column; + } + if (!lastHoveredColumn) { + return; + } + const deferMode = isDeferredMode(params); + const allColumns = deferMode ? beans.columnStateUpdateStrategy.getPrimaryColumns(deferMode) : beans.colModel.getCols(); + const targetIndex = getMoveTargetIndex(currentColumns, lastHoveredColumn, isBefore, allColumns); + if (targetIndex != null) { + beans.columnStateUpdateStrategy.moveColumns(deferMode, currentColumns, targetIndex, "toolPanelUi"); + refreshDeferredToolPanelUi(beans, params); + } +}; +var getCurrentDragValue = (listItemDragStartEvent) => { + return listItemDragStartEvent.column; +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/toolPanelColumnComp.ts +import { + AgCheckboxSelector as AgCheckboxSelector4, + Component as Component22, + DragSourceType as DragSourceType4, + KeyCode as KeyCode21, + RefPlaceholder as RefPlaceholder23, + TouchListener as TouchListener2, + _createIconNoSpan as _createIconNoSpan9, + _getShouldDisplayTooltip as _getShouldDisplayTooltip2, + _getToolPanelClassesFromColDef as _getToolPanelClassesFromColDef2, + _setAriaDescribedBy as _setAriaDescribedBy3, + _setAriaLabel as _setAriaLabel10, + _setDisplayed as _setDisplayed13, + _warn as _warn10 +} from "ag-grid-community"; +var ToolPanelColumnElement = { + tag: "div", + cls: "ag-column-select-column", + children: [ + { tag: "ag-checkbox", ref: "cbSelect", cls: "ag-column-select-checkbox" }, + { tag: "span", ref: "eLabel", cls: "ag-column-select-column-label" } + ] +}; +var ToolPanelColumnComp = class extends Component22 { + constructor(modelItem, allowDragging, groupsExist, focusWrapper, params) { + super(); + this.modelItem = modelItem; + this.allowDragging = allowDragging; + this.groupsExist = groupsExist; + this.focusWrapper = focusWrapper; + this.params = params; + this.eLabel = RefPlaceholder23; + this.cbSelect = RefPlaceholder23; + this.processingColumnStateChange = false; + const { column, depth, displayName } = modelItem; + this.column = column; + this.columnDepth = depth; + this.displayName = displayName; + } + postConstruct() { + this.setTemplate(ToolPanelColumnElement, [AgCheckboxSelector4]); + const { + beans, + cbSelect, + displayName, + eLabel, + columnDepth: indent, + groupsExist, + column, + gos, + focusWrapper + } = this; + const eDragHandle = _createIconNoSpan9("columnDrag", beans); + this.eDragHandle = eDragHandle; + eDragHandle.classList.add("ag-drag-handle", "ag-column-select-column-drag-handle"); + const checkboxGui = cbSelect.getGui(); + const checkboxInput = cbSelect.getInputElement(); + checkboxGui.after(eDragHandle); + checkboxInput.setAttribute("tabindex", "-1"); + eLabel.textContent = displayName; + if (groupsExist) { + this.addCss("ag-column-select-add-group-indent"); + } + this.addCss(`ag-column-select-indent-${indent}`); + this.getGui().style.setProperty("--ag-indentation-level", String(indent)); + this.tooltipFeature = this.createOptionalManagedBean( + beans.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.focusWrapper, + getLocation: () => "columnToolPanelColumn", + shouldDisplayTooltip: _getShouldDisplayTooltip2(gos, () => eLabel), + getAdditionalParams: () => ({ + colDef: column.getColDef() + }) + }) + ); + this.setupDragging(); + const onColStateChanged = this.onColumnStateChanged.bind(this); + this.addManagedEventListeners({ columnPivotModeChanged: onColStateChanged }); + this.addManagedListeners(column, { + columnValueChanged: onColStateChanged, + columnPivotChanged: onColStateChanged, + columnRowGroupChanged: onColStateChanged, + visibleChanged: onColStateChanged + }); + this.addManagedListeners(focusWrapper, { + keydown: this.handleKeyDown.bind(this), + contextmenu: this.onContextMenu.bind(this) + }); + const touchListener = new TouchListener2(focusWrapper); + this.addManagedListeners(touchListener, { + longTap: (e) => this.onContextMenu(e.touchStart) + }); + this.addDestroyFunc(touchListener.destroy.bind(touchListener)); + this.addManagedPropertyListener("functionsReadOnly", this.onColumnStateChanged.bind(this)); + this.addManagedListeners(cbSelect, { fieldValueChanged: this.onCheckboxChanged.bind(this) }); + this.addManagedElementListeners(eLabel, { click: this.onLabelClicked.bind(this) }); + this.onColumnStateChanged(); + this.refreshAriaLabel(); + this.setupTooltip(); + const classes = _getToolPanelClassesFromColDef2(column.getColDef(), gos, column, null); + for (const c of classes) { + this.toggleCss(c, true); + } + } + getColumn() { + return this.column; + } + setupTooltip() { + const refresh = () => this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip); + refresh(); + this.addManagedEventListeners({ newColumnsLoaded: refresh }); + } + onContextMenu(e) { + const { column, gos } = this; + if (gos.get("functionsReadOnly")) { + return; + } + const contextMenu = this.createBean(new ToolPanelContextMenu(column, e, this.focusWrapper, this.params)); + this.addDestroyFunc(() => { + if (contextMenu.isAlive()) { + this.destroyBean(contextMenu); + } + }); + } + handleKeyDown(e) { + if (e.key === KeyCode21.SPACE) { + e.preventDefault(); + if (this.isSelectable()) { + this.onSelectAllChanged(!this.isSelected()); + } + } + } + onLabelClicked() { + if (this.gos.get("functionsReadOnly")) { + return; + } + const nextState = !this.cbSelect.getValue(); + this.onChangeCommon(nextState); + } + onCheckboxChanged(event) { + this.onChangeCommon(event.selected); + } + onChangeCommon(nextState) { + if (this.cbSelect.isReadOnly()) { + return; + } + this.refreshAriaLabel(); + if (this.processingColumnStateChange) { + return; + } + setAllColumns(this.beans, [this.column], nextState, "toolPanelUi", this.params); + } + refreshAriaLabel() { + const { cbSelect, focusWrapper, displayName } = this; + const translate = this.getLocaleTextFunc(); + const columnLabel = translate("ariaColumn", "Column"); + const state = cbSelect.getValue() ? translate("ariaVisible", "visible") : translate("ariaHidden", "hidden"); + const visibilityLabel = translate("ariaToggleVisibility", "Press SPACE to toggle visibility"); + _setAriaLabel10(focusWrapper, `${displayName} ${columnLabel}`); + this.cbSelect.setInputAriaLabel(`${visibilityLabel} (${state})`); + _setAriaDescribedBy3(focusWrapper, cbSelect.getInputElement().id); + } + setupDragging() { + const eDragHandle = this.eDragHandle; + if (!this.allowDragging) { + _setDisplayed13(eDragHandle, false); + return; + } + const beans = this.beans; + const { gos, eventSvc, dragAndDrop } = beans; + if (isDeferredMode(this.params)) { + eDragHandle.setAttribute("data-column-tool-panel-deferred", ""); + } + let hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + const dragSource = { + type: DragSourceType4.ToolPanel, + eElement: eDragHandle, + dragItemName: this.displayName, + getDefaultIconName: () => hideColumnOnExit && !isDeferredMode(this.params) ? "hide" : "notAllowed", + getDragItem: () => this.createDragItem(), + onDragStarted: () => { + hideColumnOnExit = !gos.get("suppressDragLeaveHidesColumns"); + eventSvc.dispatchEvent({ + type: "columnPanelItemDragStart", + column: this.column + }); + }, + onDragStopped: () => { + eventSvc.dispatchEvent({ + type: "columnPanelItemDragEnd" + }); + }, + onGridEnter: (dragItem) => { + if (hideColumnOnExit && !isDeferredMode(this.params)) { + updateColumns(beans, { + columns: [this.column], + visibleState: dragItem?.visibleState, + pivotState: dragItem?.pivotState, + eventType: "toolPanelUi", + buttons: this.params.buttons + }); + } + }, + onGridExit: () => { + if (hideColumnOnExit && !isDeferredMode(this.params)) { + this.onChangeCommon(false); + } + } + }; + dragAndDrop.addDragSource(dragSource, true); + this.addDestroyFunc(() => dragAndDrop.removeDragSource(dragSource)); + } + createDragItem() { + const colId = this.column.getColId(); + const visibleState = { [colId]: this.column.isVisible() }; + const updateStrategy = this.beans.columnStateUpdateStrategy; + const pivotState = { + [colId]: createPivotStateForToolPanel(this.column, updateStrategy, isDeferredMode(this.params)) + }; + return { + columns: [this.column], + visibleState, + pivotState + }; + } + onColumnStateChanged() { + this.processingColumnStateChange = true; + const updateStrategy = this.beans.columnStateUpdateStrategy; + const isPivotMode2 = updateStrategy.getPivotMode(isDeferredMode(this.params)); + if (isPivotMode2) { + const anyFunctionActive = updateStrategy.isColumnSelectedInPivotModeToolPanel( + isDeferredMode(this.params), + this.column + ); + this.cbSelect.setValue(anyFunctionActive); + } else { + this.cbSelect.setValue(updateStrategy.isColumnVisibleInToolPanel(isDeferredMode(this.params), this.column)); + } + let canBeToggled = true; + let canBeDragged = true; + if (isPivotMode2) { + const functionsReadOnly = this.gos.get("functionsReadOnly"); + const noFunctionsAllowed = !this.column.isAnyFunctionAllowed(); + canBeToggled = !functionsReadOnly && !noFunctionsAllowed; + canBeDragged = canBeToggled; + } else { + const { enableRowGroup, enableValue, lockPosition, suppressMovable, lockVisible } = this.column.getColDef(); + const forceDraggable = !!enableRowGroup || !!enableValue; + const disableDraggable = !!lockPosition || !!suppressMovable; + canBeToggled = !lockVisible; + canBeDragged = forceDraggable || !disableDraggable; + } + this.cbSelect.setReadOnly(!canBeToggled); + this.eDragHandle.classList.toggle("ag-column-select-column-readonly", !canBeDragged); + this.toggleCss("ag-column-select-column-readonly", !canBeDragged && !canBeToggled); + this.cbSelect.setPassive(false); + this.processingColumnStateChange = false; + } + getDisplayName() { + return this.displayName; + } + onSelectAllChanged(value) { + const cbSelect = this.cbSelect; + if (value !== cbSelect.getValue()) { + if (!cbSelect.isReadOnly()) { + cbSelect.toggle(); + } + } + } + isSelected() { + return this.cbSelect.getValue(); + } + isSelectable() { + return !this.cbSelect.isReadOnly(); + } + isExpandable() { + return false; + } + setExpanded(_value) { + _warn10(158); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryColsList.ts +var UIColumnModel = class { + constructor(items) { + this.items = items; + } + getRowCount() { + return this.items.length; + } + getRow(index) { + return this.items[index]; + } +}; +var PRIMARY_COLS_LIST_PANEL_CLASS = "ag-column-select-list"; +var AgPrimaryColsList = class extends Component23 { + constructor() { + super({ tag: "div", cls: PRIMARY_COLS_LIST_PANEL_CLASS, role: "presentation" }); + this.destroyColumnItemFuncs = []; + this.hasLoadedInitialState = false; + this.isInitialState = false; + this.skipRefocus = false; + } + wireBeans(beans) { + this.colModel = beans.colModel; + } + destroy() { + this.destroyColumnTree(); + super.destroy(); + } + destroyColumnTree() { + this.allColsTree = []; + for (const f of this.destroyColumnItemFuncs) { + f(); + } + this.destroyColumnItemFuncs = []; + } + init(params, allowDragging, eventType) { + this.params = params; + const { suppressSyncLayoutWithGrid, contractColumnSelection, suppressColumnMove } = params; + this.allowDragging = allowDragging; + this.eventType = eventType; + if (!suppressSyncLayoutWithGrid) { + this.addManagedEventListeners({ columnMoved: this.onColumnsChanged.bind(this) }); + } + this.addManagedEventListeners({ + newColumnsLoaded: this.onColumnsChanged.bind(this) + }); + const listener = this.fireSelectionChangedEvent.bind(this); + this.addManagedEventListeners({ + columnPivotChanged: listener, + columnPivotModeChanged: listener, + columnRowGroupChanged: listener, + columnValueChanged: listener, + columnVisible: listener, + newColumnsLoaded: listener + }); + this.expandGroupsByDefault = !contractColumnSelection; + const isPreventMove = suppressColumnMove || suppressSyncLayoutWithGrid; + const virtualList = this.createManagedBean( + new VirtualList({ + cssIdentifier: "column-select", + ariaRole: "tree", + moveItemCallback: (item, isUp) => { + if (isPreventMove) { + return; + } + this.moveItems(item, isUp); + } + }) + ); + this.virtualList = virtualList; + this.appendChild(virtualList.getGui()); + virtualList.setComponentCreator((item, listItemElement) => { + _setAriaLevel3(listItemElement, item.depth + 1); + return this.createComponentFromItem(item, listItemElement); + }); + if (this.colModel.ready) { + this.onColumnsChanged(); + } + if (isPreventMove) { + return; + } + this.createItemDragFeature(); + } + createItemDragFeature() { + const { gos, beans, virtualList } = this; + this.createManagedBean( + new VirtualListDragFeature(this, virtualList, { + dragSourceType: DragSourceType5.ToolPanel, + addListeners: (parent, listItemDragStart, listItemDragEnd) => { + parent.addManagedEventListeners({ + columnPanelItemDragStart: listItemDragStart, + columnPanelItemDragEnd: listItemDragEnd + }); + }, + getCurrentDragValue: (listItemDragStartEvent) => getCurrentDragValue(listItemDragStartEvent), + isMoveBlocked: (currentDragValue) => isMoveBlocked(gos, beans, getCurrentColumnsBeingMoved(currentDragValue), this.params), + getNumRows: (comp) => comp.getDisplayedColsList().length, + moveItem: (currentDragValue, lastHoveredListItem) => moveItem(beans, getCurrentColumnsBeingMoved(currentDragValue), lastHoveredListItem, this.params) + }) + ); + } + moveItems(item, isUp) { + const { gos, beans } = this; + const { modelItem } = item; + const { group, columnGroup, column, expanded } = modelItem; + const currentColumns = getCurrentColumnsBeingMoved(group ? columnGroup : column); + if (isMoveBlocked(gos, beans, currentColumns, this.params)) { + return; + } + const currentIndex = this.displayedColsList.indexOf(modelItem); + const diff = isUp ? -1 : 1; + let movePadding = 0; + if (isUp) { + const children = item.columnDepth > 0 ? column.getParent()?.getChildren() : null; + if (children?.length && column === children[0]) { + movePadding = -1; + } + } else if (group) { + movePadding = expanded ? modelItem.children.length : 0; + } + const nextItem = Math.min(Math.max(currentIndex + movePadding + diff, 0), this.displayedColsList.length - 1); + this.skipRefocus = true; + moveItem( + beans, + currentColumns, + { + rowIndex: nextItem, + position: isUp ? "top" : "bottom", + component: this.virtualList.getComponentAt(nextItem) + }, + this.params + ); + this.focusRowIfAlive(nextItem - movePadding).then(() => { + this.skipRefocus = false; + }); + } + createComponentFromItem(item, listItemElement) { + const allowDragging = this.allowDragging; + if (item.group) { + const renderedGroup = new ToolPanelColumnGroupComp( + item, + allowDragging, + this.eventType, + listItemElement, + this.params + ); + this.createBean(renderedGroup); + return renderedGroup; + } + const columnComp = new ToolPanelColumnComp(item, allowDragging, this.groupsExist, listItemElement, this.params); + this.createBean(columnComp); + return columnComp; + } + onColumnsChanged() { + const params = this.params; + if (!this.hasLoadedInitialState) { + this.hasLoadedInitialState = true; + this.isInitialState = !!params.initialState; + } + const expandedStates = this.getExpandedStates(); + const pivotModeActive = this.colModel.isPivotMode(); + const deferApply = isDeferredMode(params); + const hasDeferredColumnOrder = deferApply && this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(deferApply); + const shouldSyncColumnLayoutWithGrid = (!params.suppressSyncLayoutWithGrid || deferApply) && !pivotModeActive || hasDeferredColumnOrder; + if (shouldSyncColumnLayoutWithGrid) { + this.buildTreeFromWhatGridIsDisplaying(); + } else { + this.buildTreeFromProvidedColumnDefs(); + } + this.setExpandedStates(expandedStates); + this.markFilteredColumns(); + this.flattenAndFilterModel(); + this.isInitialState = false; + } + getDisplayedColsList() { + return this.displayedColsList; + } + getExpandedStates() { + const res = {}; + if (this.isInitialState) { + const { expandedGroupIds } = this.params.initialState; + for (const id of expandedGroupIds) { + res[id] = true; + } + return res; + } + if (!this.allColsTree) { + return {}; + } + this.forEachItem((item) => { + if (!item.group) { + return; + } + const colGroup = item.columnGroup; + if (colGroup) { + res[colGroup.getId()] = item.expanded; + } + }); + return res; + } + setExpandedStates(states) { + if (!this.allColsTree) { + return; + } + const { isInitialState } = this; + this.forEachItem((item) => { + if (!item.group) { + return; + } + const colGroup = item.columnGroup; + if (colGroup) { + const expanded = states[colGroup.getId()]; + const groupExistedLastTime = expanded != null; + if (groupExistedLastTime || isInitialState) { + item.expanded = !!expanded; + } + } + }); + } + buildTreeFromWhatGridIsDisplaying() { + const deferApply = isDeferredMode(this.params); + if (deferApply && this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(deferApply)) { + const columnOrder = this.beans.columnStateUpdateStrategy.getPrimaryColumns(deferApply); + if (columnOrder.length > 0) { + syncLayoutWithColumns(columnOrder, this.setColumnLayout.bind(this)); + return; + } + } + if (this.params.suppressSyncLayoutWithGrid) { + this.buildTreeFromProvidedColumnDefs(); + return; + } + syncLayoutWithGrid(this.colModel, this.setColumnLayout.bind(this)); + } + setColumnLayout(colDefs) { + const columnTree = toolPanelCreateColumnTree(this.colModel, colDefs); + this.buildListModel(columnTree); + this.groupsExist = colDefs.some((colDef) => { + return colDef && typeof colDef.children !== "undefined"; + }); + this.markFilteredColumns(); + this.flattenAndFilterModel(); + } + buildTreeFromProvidedColumnDefs() { + const colModel = this.colModel; + this.buildListModel(colModel.getColDefColTree()); + this.groupsExist = !!colModel.colDefCols?.treeDepth; + } + buildListModel(columnTree) { + const columnExpandedListener = this.onColumnExpanded.bind(this); + const addListeners = (item) => { + item.addEventListener("expandedChanged", columnExpandedListener); + const removeFunc = item.removeEventListener.bind(item, "expandedChanged", columnExpandedListener); + this.destroyColumnItemFuncs.push(removeFunc); + }; + const colNames = this.beans.colNames; + const recursivelyBuild = (tree, depth, parentList) => { + for (const child of tree) { + if (isProvidedColumnGroup4(child)) { + createGroupItem(child, depth, parentList); + } else { + createColumnItem(child, depth, parentList); + } + } + }; + const createGroupItem = (columnGroup, depth, parentList) => { + const columnGroupDef = columnGroup.getColGroupDef(); + const skipThisGroup = columnGroupDef?.suppressColumnsToolPanel; + if (skipThisGroup) { + return; + } + if (columnGroup.isPadding()) { + recursivelyBuild(columnGroup.getChildren(), depth, parentList); + return; + } + const displayName = colNames.getDisplayNameForProvidedColumnGroup(null, columnGroup, "columnToolPanel"); + const item = new ColumnModelItem( + displayName, + columnGroup, + depth, + true, + this.expandGroupsByDefault + ); + parentList.push(item); + addListeners(item); + recursivelyBuild(columnGroup.getChildren(), depth + 1, item.children); + }; + const createColumnItem = (column, depth, parentList) => { + const skipThisColumn = column.getColDef()?.suppressColumnsToolPanel; + if (skipThisColumn) { + return; + } + const displayName = colNames.getDisplayNameForColumn(column, "columnToolPanel"); + parentList.push(new ColumnModelItem(displayName, column, depth)); + }; + this.destroyColumnTree(); + recursivelyBuild(columnTree, 0, this.allColsTree); + } + onColumnExpanded() { + this.flattenAndFilterModel(); + } + flattenAndFilterModel() { + this.displayedColsList = []; + const recursiveFunc = (item) => { + if (!item.passesFilter) { + return; + } + this.displayedColsList.push(item); + if (item.group && item.expanded) { + item.children.forEach(recursiveFunc); + } + }; + const virtualList = this.virtualList; + this.allColsTree.forEach(recursiveFunc); + virtualList.setModel(new UIColumnModel(this.displayedColsList)); + let focusedRow = null; + if (!this.skipRefocus) { + focusedRow = virtualList.getLastFocusedRow(); + } + virtualList.refresh(); + if (focusedRow != null) { + this.focusRowIfAlive(focusedRow); + } + this.notifyListeners(); + this.refreshAriaLabel(); + } + refreshAriaLabel() { + const translate = this.getLocaleTextFunc(); + const columnListName = translate("ariaColumnPanelList", "Column List"); + const localeColumns = translate("columns", "Columns"); + const items = this.displayedColsList.length; + _setAriaLabel11(this.virtualList.getAriaElement(), `${columnListName} ${items} ${localeColumns}`); + } + focusRowIfAlive(rowIndex) { + if (rowIndex === -1) { + return Promise.resolve(); + } + return new Promise((res) => { + window.setTimeout(() => { + if (this.isAlive()) { + this.virtualList.focusRow(rowIndex); + } + res(); + }, 0); + }); + } + forEachItem(callback) { + const recursiveFunc = (items) => { + for (const item of items) { + callback(item); + if (item.group) { + recursiveFunc(item.children); + } + } + }; + const allColsTree = this.allColsTree; + if (!allColsTree) { + return; + } + recursiveFunc(allColsTree); + } + doSetExpandedAll(value) { + this.forEachItem((item) => { + if (item.group) { + item.expanded = value; + } + }); + } + setGroupsExpanded(expand, groupIds) { + if (!groupIds) { + this.doSetExpandedAll(expand); + return; + } + const expandedGroupIds = []; + this.forEachItem((item) => { + if (!item.group) { + return; + } + const groupId = item.columnGroup.getId(); + if (groupIds.indexOf(groupId) >= 0) { + item.expanded = expand; + expandedGroupIds.push(groupId); + } + }); + const unrecognisedGroupIds = groupIds.filter((groupId) => !expandedGroupIds.includes(groupId)); + if (unrecognisedGroupIds.length > 0) { + _warn11(157, { unrecognisedGroupIds }); + } + } + getExpandState() { + let expandedCount = 0; + let notExpandedCount = 0; + this.forEachItem((item) => { + if (!item.group) { + return; + } + if (item.expanded) { + expandedCount++; + } else { + notExpandedCount++; + } + }); + if (expandedCount > 0 && notExpandedCount > 0) { + return 2 /* INDETERMINATE */; + } + if (notExpandedCount > 0) { + return 1 /* COLLAPSED */; + } + return 0 /* EXPANDED */; + } + doSetSelectedAll(selectAllChecked) { + selectAllChildren(this.beans, this.allColsTree, selectAllChecked, this.eventType, this.params); + this.syncVisibleSelectionState(); + this.fireSelectionChangedEvent(); + } + syncVisibleSelectionState() { + for (let i = 0; i < this.displayedColsList.length; i++) { + const comp = this.virtualList.getComponentAt(i); + comp?.onColumnStateChanged?.(); + } + } + getSelectionState() { + let checkedCount = 0; + let uncheckedCount = 0; + const updateStrategy = this.beans.columnStateUpdateStrategy; + const pivotMode = updateStrategy.getPivotMode(isDeferredMode(this.params)); + this.forEachItem((item) => { + if (item.group) { + return; + } + if (!item.passesFilter) { + return; + } + const column = item.column; + const colDef = column.getColDef(); + let checked; + if (pivotMode) { + const noPivotModeOptionsAllowed = !column.isAllowPivot() && !column.isAllowRowGroup() && !column.isAllowValue(); + if (noPivotModeOptionsAllowed) { + return; + } + checked = updateStrategy.isColumnSelectedInPivotModeToolPanel(isDeferredMode(this.params), column) ?? false; + } else { + if (colDef.lockVisible) { + return; + } + checked = updateStrategy.isColumnVisibleInToolPanel(isDeferredMode(this.params), column) ?? false; + } + if (checked) { + checkedCount++; + } else { + uncheckedCount++; + } + }); + if (checkedCount > 0 && uncheckedCount > 0) { + return void 0; + } + return !(checkedCount === 0 || uncheckedCount > 0); + } + setFilterText(filterText) { + this.filterText = _exists12(filterText) ? filterText.toLowerCase() : null; + this.markFilteredColumns(); + this.flattenAndFilterModel(); + } + markFilteredColumns() { + const passesFilter = (item) => { + if (!_exists12(this.filterText)) { + return true; + } + const displayName = item.displayName; + return displayName == null || displayName.toLowerCase().indexOf(this.filterText) !== -1; + }; + const recursivelyCheckFilter = (item, parentPasses) => { + let atLeastOneChildPassed = false; + if (item.group) { + const groupPasses = passesFilter(item); + for (const child of item.children) { + const childPasses = recursivelyCheckFilter(child, groupPasses || parentPasses); + if (childPasses) { + atLeastOneChildPassed = childPasses; + } + } + } + const filterPasses = parentPasses || atLeastOneChildPassed ? true : passesFilter(item); + item.passesFilter = filterPasses; + return filterPasses; + }; + for (const item of this.allColsTree) { + recursivelyCheckFilter(item, false); + } + } + notifyListeners() { + this.fireGroupExpandedEvent(); + this.fireSelectionChangedEvent(); + } + fireGroupExpandedEvent() { + const expandState = this.getExpandState(); + this.dispatchLocalEvent({ type: "groupExpanded", state: expandState }); + } + fireSelectionChangedEvent() { + if (!this.allColsTree) { + return; + } + const selectionState = this.getSelectionState(); + this.dispatchLocalEvent({ type: "selectionChanged", state: selectionState }); + } + getExpandedGroups() { + const expandedGroupIds = []; + if (!this.allColsTree) { + return expandedGroupIds; + } + this.forEachItem((item) => { + if (item.group && item.expanded) { + expandedGroupIds.push(item.columnGroup.getId()); + } + }); + return expandedGroupIds; + } +}; +var AgPrimaryColsListSelector = { + selector: "AG-PRIMARY-COLS-LIST", + component: AgPrimaryColsList +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/agPrimaryCols.ts +var AgPrimaryColsElement = { + tag: "div", + cls: "ag-column-select", + children: [ + { tag: "ag-primary-cols-header", ref: "primaryColsHeaderPanel" }, + { tag: "ag-primary-cols-list", ref: "primaryColsListPanel" } + ] +}; +var AgPrimaryCols = class extends Component24 { + constructor() { + super(AgPrimaryColsElement, [AgPrimaryColsHeaderSelector, AgPrimaryColsListSelector]); + this.primaryColsHeaderPanel = RefPlaceholder24; + this.primaryColsListPanel = RefPlaceholder24; + this.registerCSS(agPrimaryCols_default); + } + // we allow dragging in the toolPanel, but not when this component appears in the column menu + init(allowDragging, params, eventType) { + const { primaryColsHeaderPanel, primaryColsListPanel } = this; + primaryColsHeaderPanel.init(params); + const hideFilter = params.suppressColumnFilter; + const hideSelect = params.suppressColumnSelectAll; + const hideExpand = params.suppressColumnExpandAll; + if (hideExpand && hideFilter && hideSelect) { + primaryColsHeaderPanel.setDisplayed(false); + } + this.addManagedListeners(primaryColsListPanel, { + groupExpanded: (event) => { + primaryColsHeaderPanel.setExpandState(event.state); + params.onStateUpdated(); + }, + selectionChanged: (event) => primaryColsHeaderPanel.setSelectionState(event.state) + }); + primaryColsListPanel.init(params, allowDragging, eventType); + this.addManagedListeners(primaryColsHeaderPanel, { + expandAll: primaryColsListPanel.doSetExpandedAll.bind(primaryColsListPanel, true), + collapseAll: primaryColsListPanel.doSetExpandedAll.bind(primaryColsListPanel, false), + selectAll: primaryColsListPanel.doSetSelectedAll.bind(primaryColsListPanel, true), + unselectAll: primaryColsListPanel.doSetSelectedAll.bind(primaryColsListPanel, false), + filterChanged: (event) => primaryColsListPanel.setFilterText(event.filterText) + }); + this.positionableFeature = this.createManagedBean(new PositionableFeature(this.getGui(), { minHeight: 100 })); + } + toggleResizable(resizable) { + this.positionableFeature.setResizable(resizable ? { bottom: true } : false); + } + expandGroups(groupIds) { + this.primaryColsListPanel.setGroupsExpanded(true, groupIds); + } + collapseGroups(groupIds) { + this.primaryColsListPanel.setGroupsExpanded(false, groupIds); + } + setColumnLayout(colDefs) { + this.primaryColsListPanel.setColumnLayout(colDefs); + } + syncLayoutWithGrid() { + this.primaryColsListPanel.onColumnsChanged(); + } + getExpandedGroups() { + return this.primaryColsListPanel.getExpandedGroups(); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnToolPanel.css +var columnToolPanel_default = ".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select:where(:not(.ag-last-visible-child)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px}:where(.ag-column-panel) .ag-column-drop-vertical:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-column-panel-buttons:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-column-panel-buttons-button{line-height:1.5}:where(.ag-column-panel) .ag-column-panel-buttons-apply-button:not(:disabled){background-color:var(--ag-column-panel-apply-button-background-color);color:var(--ag-column-panel-apply-button-color)}"; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnToolPanel.ts +var DEFERRED_TOOL_PANEL_CLASS = "ag-column-panel-deferred"; +var ColumnToolPanel = class extends Component25 { + constructor() { + super({ tag: "div", cls: "ag-column-panel" }); + this.initialised = false; + this.childDestroyFuncs = []; + this.isDeferModeEnabled = false; + this.isCommitting = false; + this.onDeferredApply = () => { + this.isCommitting = true; + try { + this.beans.columnStateUpdateStrategy.commit(this.isDeferModeEnabled); + } finally { + this.isCommitting = false; + } + this.deferredButtonsComp?.updateValidity(false); + this.lastKnownGridState = this.captureGridState(); + }; + this.onDeferredCancel = () => { + this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled); + this.deferredButtonsComp?.updateValidity(false); + this.refreshToolPanelLayouts(); + this.pivotModePanel?.refreshEditStrategy(); + this.lastKnownGridState = this.captureGridState(); + }; + this.onPivotModePanelValueChanged = () => { + this.refreshToolPanelLayouts(); + this.setLastVisible(); + this.deferredButtonsComp?.updateValidity( + this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled) + ); + }; + /** Handles columnEverythingChanged — only resets staged changes on true no-ops. */ + this.onColumnEverythingChanged = () => { + if (!this.isDeferModeEnabled || this.isCommitting) { + return; + } + const currentState = this.captureGridState(); + if (!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)) { + this.lastKnownGridState = currentState; + return; + } + const isNoOp = this.lastKnownGridState && this.isGridStateEqual(this.lastKnownGridState, currentState); + this.lastKnownGridState = currentState; + if (!isNoOp) { + return; + } + this.resetDeferredState(); + }; + this.onExternalGridChange = () => { + if (!this.isDeferModeEnabled || this.isCommitting) { + return; + } + if (!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)) { + return; + } + this.resetDeferredState(); + this.lastKnownGridState = this.captureGridState(); + }; + this.registerCSS(columnToolPanel_default); + } + wireBeans(beans) { + this.colToolPanelFactory = beans.colToolPanelFactory; + } + // lazy initialise the panel + setVisible(visible) { + super.setDisplayed(visible); + if (visible && !this.initialised) { + this.init(this.params); + } + } + init(params) { + const defaultParams = _addGridCommonParams7(this.gos, { + suppressColumnMove: false, + suppressColumnSelectAll: false, + suppressColumnFilter: false, + suppressColumnExpandAll: false, + contractColumnSelection: false, + suppressPivotMode: false, + suppressRowGroups: false, + suppressValues: false, + suppressPivots: false, + suppressSyncLayoutWithGrid: false + }); + const mergedParams = { + ...defaultParams, + ...params + }; + this.params = mergedParams; + const { childDestroyFuncs, colToolPanelFactory, gos } = this; + const hasPivotModule = gos.isModuleRegistered("SharedPivot"); + const hasRowGroupingModule = hasPivotModule || gos.isModuleRegistered("SharedRowGrouping"); + this.isDeferModeEnabled = isDeferredMode(mergedParams); + this.toggleCss(DEFERRED_TOOL_PANEL_CLASS, this.isDeferModeEnabled); + if (!mergedParams.suppressPivotMode && colToolPanelFactory && hasPivotModule) { + this.pivotModePanel = colToolPanelFactory.createPivotModePanel( + this, + childDestroyFuncs, + mergedParams, + this.onPivotModePanelValueChanged + ); + } + const primaryColsPanel = this.createBean(new AgPrimaryCols()); + this.primaryColsPanel = primaryColsPanel; + childDestroyFuncs.push(() => this.destroyBean(this.primaryColsPanel)); + primaryColsPanel.init(true, mergedParams, "toolPanelUi"); + primaryColsPanel.addCss("ag-column-panel-column-select"); + this.appendChild(primaryColsPanel); + if (colToolPanelFactory) { + if (!mergedParams.suppressRowGroups && hasRowGroupingModule) { + this.rowGroupDropZonePanel = colToolPanelFactory.createRowGroupPanel( + this, + childDestroyFuncs, + mergedParams + ); + } + if (!mergedParams.suppressValues && hasRowGroupingModule) { + this.valuesDropZonePanel = colToolPanelFactory.createValuesPanel(this, childDestroyFuncs, mergedParams); + } + if (!mergedParams.suppressPivots && hasPivotModule) { + this.pivotDropZonePanel = colToolPanelFactory.createPivotPanel(this, childDestroyFuncs, mergedParams); + } + this.setLastVisible(); + const [pivotModeListener] = this.addManagedEventListeners({ + columnPivotModeChanged: () => { + this.resetChildrenHeight(); + this.setLastVisible(); + } + }); + childDestroyFuncs.push(() => pivotModeListener()); + } + if (this.isDeferModeEnabled) { + const resetListener = this.onExternalGridChange; + childDestroyFuncs.push( + ...this.addManagedEventListeners({ + columnEverythingChanged: this.onColumnEverythingChanged, + sortChanged: resetListener, + columnVisible: resetListener, + columnRowGroupChanged: resetListener, + columnValueChanged: resetListener, + columnPivotChanged: resetListener, + columnPivotModeChanged: resetListener, + newColumnsLoaded: resetListener, + ...mergedParams.suppressSyncLayoutWithGrid ? {} : { columnMoved: resetListener } + }) + ); + } + if (mergedParams.buttons) { + if (!mergedParams.buttons.includes("apply")) { + _warn12(298); + } + if (mergedParams.buttons.length) { + this.initDeferredButtons(mergedParams.buttons); + } + } + this.initialised = true; + } + initDeferredButtons(buttons) { + const buttonComp = this.createBean(new FilterButtonComp2({ className: "ag-column-panel-buttons" })); + this.deferredButtonsComp = buttonComp; + this.childDestroyFuncs.push(() => { + this.deferredButtonsComp = this.destroyBean(this.deferredButtonsComp); + }); + const translate = this.getLocaleTextFunc(); + const buttonDefs = buttons.map((type) => ({ + type, + label: translate( + type === "apply" ? "applyColumnToolPanel" : "cancelColumnToolPanel", + type === "apply" ? "Apply" : "Cancel" + ) + })); + buttonComp.updateButtons(buttonDefs); + buttonComp.updateValidity(false); + buttonComp.addManagedListeners(buttonComp, { + apply: this.onDeferredApply, + cancel: this.onDeferredCancel + }); + this.appendChild(buttonComp); + } + resetDeferredState() { + this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled); + this.deferredButtonsComp?.updateValidity(false); + this.refreshToolPanelLayouts(); + this.pivotModePanel?.refreshEditStrategy(); + } + captureGridState() { + const { beans } = this; + const getColIds = (cols) => (cols ?? []).map((c) => c.getColId()); + return { + rowGroupColIds: getColIds(beans.rowGroupColsSvc?.columns), + valueColIds: getColIds(beans.valueColsSvc?.columns), + pivotColIds: getColIds(beans.pivotColsSvc?.columns), + pivotMode: beans.colModel.isPivotMode(), + columnOrder: beans.colModel.getCols().map((c) => c.getColId()), + visibleColIds: beans.colModel.getCols().filter((c) => c.isVisible()).map((c) => c.getColId()), + sortState: beans.colModel.getCols().filter((c) => c.getSort()).map((c) => `${c.getColId()}:${c.getSort()}:${c.getSortIndex()}`), + aggFuncState: (beans.valueColsSvc?.columns ?? []).map((c) => c.getAggFunc()), + widthState: beans.colModel.getCols().map((c) => `${c.getColId()}:${c.getActualWidth()}`) + }; + } + isGridStateEqual(a, b) { + return _areEqual(a.rowGroupColIds, b.rowGroupColIds) && _areEqual(a.valueColIds, b.valueColIds) && _areEqual(a.pivotColIds, b.pivotColIds) && a.pivotMode === b.pivotMode && _areEqual(a.columnOrder, b.columnOrder) && _areEqual(a.visibleColIds, b.visibleColIds) && _areEqual(a.sortState, b.sortState) && _areEqual(a.aggFuncState, b.aggFuncState) && _areEqual(a.widthState, b.widthState); + } + refreshDeferredUi() { + this.refreshToolPanelLayouts(); + this.setLastVisible(); + this.pivotModePanel?.refreshEditStrategy(); + this.deferredButtonsComp?.updateValidity( + this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled) + ); + } + refreshToolPanelLayouts() { + this.primaryColsPanel.syncLayoutWithGrid(); + this.rowGroupDropZonePanel?.refreshGui(); + this.valuesDropZonePanel?.refreshGui(); + this.pivotDropZonePanel?.refresh(); + } + setPivotModeSectionVisible(visible) { + const colToolPanelFactory = this.colToolPanelFactory; + if (!colToolPanelFactory) { + return; + } + this.pivotModePanel = colToolPanelFactory.setPanelVisible( + this.pivotModePanel, + visible, + colToolPanelFactory.createPivotModePanel.bind( + colToolPanelFactory, + this, + this.childDestroyFuncs, + this.params, + this.onPivotModePanelValueChanged, + true + ) + ); + this.setLastVisible(); + } + setRowGroupsSectionVisible(visible) { + const colToolPanelFactory = this.colToolPanelFactory; + if (!colToolPanelFactory) { + return; + } + this.rowGroupDropZonePanel = colToolPanelFactory.setPanelVisible( + this.rowGroupDropZonePanel, + visible, + colToolPanelFactory.createRowGroupPanel.bind(colToolPanelFactory, this, this.childDestroyFuncs, this.params) + ); + this.setLastVisible(); + } + setValuesSectionVisible(visible) { + const colToolPanelFactory = this.colToolPanelFactory; + if (!colToolPanelFactory) { + return; + } + this.valuesDropZonePanel = colToolPanelFactory.setPanelVisible( + this.valuesDropZonePanel, + visible, + colToolPanelFactory.createValuesPanel.bind(colToolPanelFactory, this, this.childDestroyFuncs, this.params) + ); + this.setLastVisible(); + } + setPivotSectionVisible(visible) { + const colToolPanelFactory = this.colToolPanelFactory; + if (!colToolPanelFactory) { + return; + } + this.pivotDropZonePanel = colToolPanelFactory.setPanelVisible( + this.pivotDropZonePanel, + visible, + colToolPanelFactory.createPivotPanel.bind(colToolPanelFactory, this, this.childDestroyFuncs, this.params) + ); + this.pivotDropZonePanel?.setDisplayed(visible); + this.setLastVisible(); + } + setResizers() { + for (const panel of [ + this.primaryColsPanel, + this.rowGroupDropZonePanel, + this.valuesDropZonePanel, + this.pivotDropZonePanel + ]) { + if (!panel) { + continue; + } + const eGui = panel.getGui(); + panel.toggleResizable( + !eGui.classList.contains("ag-last-column-drop") && !eGui.classList.contains("ag-hidden") && !eGui.classList.contains("ag-last-visible-child") + ); + } + } + setLastVisible() { + const eGui = this.getGui(); + const columnDrops = Array.prototype.slice.call(eGui.querySelectorAll(".ag-column-drop")); + for (const columnDrop of columnDrops) { + columnDrop.classList.remove("ag-last-column-drop"); + } + const columnDropEls = eGui.querySelectorAll(".ag-column-drop:not(.ag-hidden)"); + const lastVisible = _last4(columnDropEls); + if (lastVisible) { + lastVisible.classList.add("ag-last-column-drop"); + } + this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child", !lastVisible); + this.setResizers(); + } + resetChildrenHeight() { + const eGui = this.getGui(); + const children = eGui.children; + for (let i = 0; i < children.length; i++) { + const { style } = children[i]; + style.removeProperty("height"); + style.removeProperty("flex"); + } + } + expandColumnGroups(groupIds) { + this.primaryColsPanel.expandGroups(groupIds); + } + collapseColumnGroups(groupIds) { + this.primaryColsPanel.collapseGroups(groupIds); + } + setColumnLayout(colDefs) { + this.primaryColsPanel.setColumnLayout(colDefs); + } + syncLayoutWithGrid() { + this.primaryColsPanel.syncLayoutWithGrid(); + } + destroyChildren() { + const childDestroyFuncs = this.childDestroyFuncs; + for (const func of childDestroyFuncs) { + func(); + } + childDestroyFuncs.length = 0; + _clearElement8(this.getGui()); + } + refresh(params) { + this.destroyChildren(); + this.init(params); + return true; + } + getState() { + return { + expandedGroupIds: this.primaryColsPanel.getExpandedGroups() + }; + } + destroy() { + this.destroyChildren(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnToolPanelFactory.ts +import { BeanStub as BeanStub8 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/pivotDropZonePanel.ts +import { _addFocusableContainerListener as _addFocusableContainerListener2, _createIconNoSpan as _createIconNoSpan12 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/baseDropZonePanel.ts +import { DragSourceType as DragSourceType7, _shouldUpdateColVisibilityAfterGroup } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/pillDropZonePanel.ts +import { + Component as Component26, + KeyCode as KeyCode22, + ManagedFocusFeature as ManagedFocusFeature2, + PositionableFeature as PositionableFeature2, + _areEqual as _areEqual2, + _clearElement as _clearElement9, + _createElement as _createElement7, + _createIconNoSpan as _createIconNoSpan10, + _findFocusableElements as _findFocusableElements3, + _findNextFocusableElement as _findNextFocusableElement6, + _getActiveDomElement as _getActiveDomElement8, + _isKeyboardMode as _isKeyboardMode2, + _last as _last5, + _setAriaHidden, + _setAriaLabel as _setAriaLabel12, + _setAriaPosInSet as _setAriaPosInSet3, + _setAriaRole as _setAriaRole7, + _setAriaSetSize as _setAriaSetSize3 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/pillDropZonePanel.css +var pillDropZonePanel_default = ".ag-column-drop{align-items:center;display:inline-flex;overflow:auto;position:relative;width:100%}.ag-column-drop-list{align-items:center;display:flex}.ag-column-drop-cell{align-items:center;background-color:var(--ag-column-drop-cell-background-color);border:var(--ag-column-drop-cell-border);border-radius:500px;color:var(--ag-column-drop-cell-text-color);display:flex;padding:calc(var(--ag-spacing)*.25);position:relative;&:focus-visible{box-shadow:var(--ag-focus-shadow)}:where(.ag-drag-handle){color:var(--ag-column-drop-cell-drag-handle-color)}}:where(.ag-ltr) .ag-column-drop-cell{padding-left:calc(var(--ag-spacing)*.75)}:where(.ag-rtl) .ag-column-drop-cell{padding-right:calc(var(--ag-spacing)*.75)}.ag-column-drop-cell-text{flex:1 1 auto;margin:0 var(--ag-spacing);overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-drop-vertical{align-items:stretch;display:flex;flex-direction:column;min-height:75px;overflow:hidden}.ag-column-drop-vertical-title-bar{align-items:center;display:flex;flex:none;padding:var(--ag-widget-container-vertical-padding) calc(var(--ag-spacing)*2) 0}.ag-column-drop-vertical-list{align-items:stretch;flex-direction:column;flex-grow:1;overflow-x:auto;padding-bottom:var(--ag-spacing);padding-left:var(--ag-spacing);padding-right:var(--ag-spacing);position:relative}:where(.ag-column-drop-empty) .ag-column-drop-vertical-list{overflow:hidden}.ag-column-drop-cell-button{cursor:pointer;min-width:0;opacity:.75}:where(.ag-ltr) .ag-column-drop-cell-button{margin-right:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-button{margin-left:calc(var(--ag-spacing)/4)}.ag-column-drop-cell-button:hover{opacity:1}:where(.ag-ltr) .ag-column-drop-cell-drag-handle{margin-left:calc(var(--ag-spacing)/4)}:where(.ag-rtl) .ag-column-drop-cell-drag-handle{margin-right:calc(var(--ag-spacing)/4)}.ag-column-drop-wrapper{display:flex}.ag-column-drop-horizontal-half-width{width:50%!important}.ag-column-drop-cell-ghost{opacity:.5}.ag-column-drop-horizontal{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:hidden;white-space:nowrap}:where(.ag-ltr) .ag-column-drop-horizontal{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-column-drop-horizontal{padding-right:var(--ag-cell-horizontal-padding)}.ag-column-drop-horizontal-list{gap:var(--ag-cell-widget-spacing)}.ag-column-drop-vertical-cell{margin-top:var(--ag-spacing)}:where(.ag-ltr) .ag-column-drop-vertical-icon{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-column-drop-vertical-icon{margin-left:var(--ag-widget-horizontal-spacing)}.ag-select-agg-func-popup{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);height:calc(var(--ag-spacing)*5*3.5);padding:0;position:absolute}.ag-select-agg-func-virtual-list-item{cursor:default}:where(.ag-ltr) .ag-select-agg-func-virtual-list-item{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-select-agg-func-virtual-list-item{padding-right:calc(var(--ag-spacing)*2)}.ag-select-agg-func-virtual-list-item:hover{background-color:var(--ag-selected-row-background-color)}:where(.ag-ltr) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-column-drop-horizontal-half-width:where(:not(:last-child)){border-left:solid var(--ag-border-width) var(--ag-border-color)}"; + +// packages/ag-grid-enterprise/src/widgets/pillDropZonePanel.ts +function _insertArrayIntoArray(dest, src, toIndex) { + if (dest == null || src == null) { + return; + } + dest.splice(toIndex, 0, ...src); +} +var PillDropZonePanelElement = { tag: "div", cls: "ag-unselectable", role: "presentation" }; +var PillDropZonePanel = class extends Component26 { + constructor(horizontal) { + super(PillDropZonePanelElement); + this.horizontal = horizontal; + this.state = "notDragging"; + this.guiDestroyFunctions = []; + this.childPillComponents = []; + this.resizeEnabled = false; + this.addElementClasses(this.getGui()); + this.ePillDropList = _createElement7({ tag: "div" }); + this.addElementClasses(this.ePillDropList, "list"); + this.registerCSS(pillDropZonePanel_default); + } + toggleResizable(resizable) { + this.positionableFeature.setResizable(resizable ? { bottom: true } : false); + this.resizeEnabled = resizable; + } + isSourceEventFromTarget(draggingEvent) { + const { dropZoneTarget, dragSource } = draggingEvent; + return dropZoneTarget.contains(dragSource.eElement); + } + destroy() { + this.destroyGui(); + super.destroy(); + } + destroyGui() { + for (const func of this.guiDestroyFunctions) { + func(); + } + this.guiDestroyFunctions.length = 0; + this.childPillComponents.length = 0; + _clearElement9(this.getGui()); + _clearElement9(this.ePillDropList); + } + init(params) { + this.params = params ?? {}; + this.createManagedBean( + new ManagedFocusFeature2(this.getFocusableElement(), { + onTabKeyDown: this.onTabKeyDown.bind(this), + handleKeyDown: this.onKeyDown.bind(this) + }) + ); + this.setupDropTarget(); + this.positionableFeature = new PositionableFeature2(this.getGui()); + this.createManagedBean(this.positionableFeature); + this.refreshGui(); + _setAriaLabel12(this.ePillDropList, this.getAriaLabel()); + } + onTabKeyDown(e) { + const focusableElements = _findFocusableElements3(this.getFocusableElement(), null, true); + const len = focusableElements.length; + if (len === 0) { + return; + } + const { shiftKey } = e; + const activeEl = _getActiveDomElement8(this.beans); + const isFirstFocused = activeEl === focusableElements[0]; + const isLastFocused = activeEl === _last5(focusableElements); + const shouldAllowDefaultTab = len === 1 || isFirstFocused && shiftKey || isLastFocused && !shiftKey; + if (!shouldAllowDefaultTab) { + focusableElements[shiftKey ? 0 : len - 1].focus(); + } + } + onKeyDown(e) { + const { key } = e; + const isVertical = !this.horizontal; + let isNext = key === KeyCode22.DOWN; + let isPrevious = key === KeyCode22.UP; + if (!isVertical) { + const isRtl = this.gos.get("enableRtl"); + isNext = !isRtl && key === KeyCode22.RIGHT || isRtl && key === KeyCode22.LEFT; + isPrevious = !isRtl && key === KeyCode22.LEFT || isRtl && key === KeyCode22.RIGHT; + } + if (!isNext && !isPrevious) { + return; + } + e.preventDefault(); + if (e.shiftKey) { + this.moveFocusedItem(isPrevious); + } else { + const el = _findNextFocusableElement6(this.beans, this.getFocusableElement(), false, isPrevious); + if (el) { + el.focus(); + } + } + } + moveFocusedItem(isPrevious) { + const currentItemIndex = this.getFocusedItem(); + if (currentItemIndex === -1) { + return; + } + const diff = isPrevious ? -1 : 1; + const changed = this.normalizeAndUpdateInsertIndex(currentItemIndex, currentItemIndex + diff); + if (!changed) { + return; + } + const comp = this.childPillComponents[currentItemIndex]; + if (!comp.isMovable()) { + return; + } + const currentItem = comp.getItem(); + this.focusItemAtIndex(this.insertIndex); + this.rearrangeItems([currentItem], true); + } + addElementClasses(el, suffix) { + suffix = suffix ? `-${suffix}` : ""; + const direction = this.horizontal ? "horizontal" : "vertical"; + el.classList.add(`ag-column-drop${suffix}`, `ag-column-drop-${direction}${suffix}`); + } + setupDropTarget() { + this.dropTarget = { + getContainer: this.getGui.bind(this), + getIconName: this.getIconName.bind(this), + onDragging: this.onDragging.bind(this), + onDragEnter: this.onDragEnter.bind(this), + onDragLeave: this.onDragLeave.bind(this), + onDragStop: this.onDragStop.bind(this), + onDragCancel: this.onDragCancel.bind(this), + isInterestedIn: this.isInterestedIn.bind(this) + }; + this.beans.dragAndDrop?.addDropTarget(this.dropTarget); + } + minimumAllowedNewInsertIndex() { + return 0; + } + checkInsertIndex(draggingEvent) { + const newIndex = this.getNewInsertIndex(draggingEvent); + if (newIndex < 0) { + return false; + } + return this.normalizeAndUpdateInsertIndex(this.insertIndex, newIndex); + } + normalizeAndUpdateInsertIndex(currentIndex, index) { + const minimumAllowedIndex = this.minimumAllowedNewInsertIndex(); + const newAdjustedIndex = Math.max(minimumAllowedIndex, index); + const changed = newAdjustedIndex !== currentIndex; + if (changed) { + this.insertIndex = newAdjustedIndex; + } + return changed; + } + getNewInsertIndex(draggingEvent) { + const mouseEvent = draggingEvent.event; + const mouseLocation = this.horizontal ? mouseEvent.clientX : mouseEvent.clientY; + const boundsList = this.childPillComponents.map((comp) => comp.getGui().getBoundingClientRect()); + const hoveredIndex = boundsList.findIndex( + (rect) => this.horizontal ? rect.right > mouseLocation && rect.left < mouseLocation : rect.top < mouseLocation && rect.bottom > mouseLocation + ); + if (hoveredIndex === -1) { + const enableRtl = this.gos.get("enableRtl"); + const isLast = boundsList.every((rect) => mouseLocation > (this.horizontal ? rect.right : rect.bottom)); + if (isLast) { + return enableRtl && this.horizontal ? 0 : this.childPillComponents.length; + } + const isFirst = boundsList.every((rect) => mouseLocation < (this.horizontal ? rect.left : rect.top)); + if (isFirst) { + return enableRtl && this.horizontal ? this.childPillComponents.length : 0; + } + return this.insertIndex; + } + if (this.insertIndex <= hoveredIndex) { + return hoveredIndex + 1; + } + return hoveredIndex; + } + checkDragStartedBySelf(draggingEvent) { + if (this.state !== "notDragging") { + return; + } + this.state = "rearrangeItems"; + this.potentialDndItems = this.getItems(draggingEvent.dragSource.getDragItem()); + this.refreshGui(); + this.checkInsertIndex(draggingEvent); + this.refreshGui(); + } + onDragging(draggingEvent) { + this.checkDragStartedBySelf(draggingEvent); + if (this.checkInsertIndex(draggingEvent)) { + this.refreshGui(); + } + } + handleDragEnterEnd(_) { + } + onDragEnter(draggingEvent) { + const dragItems = this.getItems(draggingEvent.dragSource.getDragItem()); + this.state = "newItemsIn"; + const goodDragItems = dragItems.filter((item) => this.isItemDroppable(item, draggingEvent)); + const alreadyPresent = goodDragItems.every( + (item) => this.childPillComponents.map((cmp) => cmp.getItem()).indexOf(item) !== -1 + ); + if (goodDragItems.length === 0) { + return; + } + this.potentialDndItems = goodDragItems; + if (alreadyPresent) { + this.state = "notDragging"; + return; + } + this.handleDragEnterEnd(draggingEvent); + this.checkInsertIndex(draggingEvent); + this.refreshGui(); + } + isPotentialDndItems() { + return !!this.potentialDndItems?.length; + } + handleDragLeaveEnd(_) { + } + onDragLeave(draggingEvent) { + if (this.state === "rearrangeItems") { + const items = this.getItems(draggingEvent.dragSource.getDragItem()); + this.removeItems(items); + } + if (this.isPotentialDndItems()) { + this.handleDragLeaveEnd(draggingEvent); + this.potentialDndItems = []; + this.refreshGui(); + } + this.state = "notDragging"; + } + onDragCancel(draggingEvent) { + if (this.isPotentialDndItems()) { + if (this.state === "newItemsIn") { + this.handleDragLeaveEnd(draggingEvent); + } + this.potentialDndItems = []; + this.refreshGui(); + } + this.state = "notDragging"; + } + onDragStop() { + if (this.isPotentialDndItems()) { + if (this.state === "newItemsIn") { + this.addItems(this.potentialDndItems); + } else { + this.rearrangeItems(this.potentialDndItems); + } + this.potentialDndItems = []; + this.refreshGui(); + } + this.state = "notDragging"; + } + removeItems(itemsToRemove) { + const newItemList = this.getExistingItems().filter((item) => !itemsToRemove.includes(item)); + this.updateItems(newItemList); + this.refreshGui(); + } + addItems(itemsToAdd) { + if (!itemsToAdd) { + return; + } + const newItemList = this.getExistingItems().slice(); + const itemsToAddNoDuplicates = itemsToAdd.filter((item) => newItemList.indexOf(item) < 0); + _insertArrayIntoArray(newItemList, itemsToAddNoDuplicates, this.insertIndex); + this.updateItems(newItemList); + this.refreshGui(); + } + addItem(item) { + this.insertIndex = this.getExistingItems().length; + this.addItems([item]); + } + rearrangeItems(itemsToAdd, fromKeyboard) { + let newItemList; + if (!fromKeyboard) { + newItemList = this.getNonGhostItems().slice(); + } else { + newItemList = this.getExistingItems().filter((item) => itemsToAdd.indexOf(item) === -1); + } + _insertArrayIntoArray(newItemList, itemsToAdd, this.insertIndex); + if (_areEqual2(newItemList, this.getExistingItems())) { + return false; + } + this.updateItems(newItemList); + this.refreshGui(); + return true; + } + refreshGui() { + let scrollTop = 0; + if (!this.horizontal) { + scrollTop = this.ePillDropList.scrollTop; + } + const resizeEnabled = this.resizeEnabled; + const focusedIndex = this.getFocusedItem(); + const { eGridDiv } = this.beans; + const isKeyboardMode = _isKeyboardMode2(); + let alternateElement = null; + if (isKeyboardMode) { + alternateElement = _findNextFocusableElement6(this.beans, eGridDiv) ?? _findNextFocusableElement6(this.beans, eGridDiv, false, true); + } + this.toggleResizable(false); + this.destroyGui(); + this.addIconAndTitleToGui(); + this.addEmptyMessageToGui(); + this.addItemsToGui(); + if (scrollTop !== 0) { + this.ePillDropList.scrollTop = scrollTop; + } + if (resizeEnabled) { + this.toggleResizable(resizeEnabled); + } + if (isKeyboardMode) { + this.restoreFocus(focusedIndex, alternateElement); + } + } + getFocusedItem() { + const eGui = this.getGui(); + const activeElement = _getActiveDomElement8(this.beans); + if (!eGui.contains(activeElement)) { + return -1; + } + const items = Array.from(eGui.querySelectorAll(".ag-column-drop-cell")); + return items.indexOf(activeElement); + } + focusItemAtIndex(index) { + const eGui = this.getGui(); + const items = Array.from(eGui.querySelectorAll(".ag-column-drop-cell")); + const item = items[index]; + if (!item) { + return; + } + item.focus({ preventScroll: true }); + } + restoreFocus(index, alternateElement) { + const eGui = this.getGui(); + const items = Array.from(eGui.querySelectorAll(".ag-column-drop-cell")); + if (index === -1) { + return; + } + if (items.length === 0) { + alternateElement.focus(); + } + const indexToFocus = Math.min(items.length - 1, index); + const el = items[indexToFocus]; + if (el) { + el.focus(); + } + } + focusList(fromBottom) { + const index = fromBottom ? this.childPillComponents.length - 1 : 0; + this.restoreFocus(index, this.getFocusableElement()); + } + getNonGhostItems() { + const existingItems = this.getExistingItems(); + if (this.isPotentialDndItems()) { + return existingItems.filter((item) => !this.potentialDndItems.includes(item)); + } + return existingItems; + } + addItemsToGui() { + const nonGhostItems = this.getNonGhostItems(); + const itemsToAddToGui = nonGhostItems.map((item) => this.createItemComponent(item, false)); + if (this.isPotentialDndItems()) { + const dndItems = this.potentialDndItems.map((item) => this.createItemComponent(item, true)); + if (this.insertIndex >= itemsToAddToGui.length) { + itemsToAddToGui.push(...dndItems); + } else { + itemsToAddToGui.splice(this.insertIndex, 0, ...dndItems); + } + } + this.appendChild(this.ePillDropList); + itemsToAddToGui.forEach((itemComponent, index) => { + if (index > 0) { + this.addArrow(this.ePillDropList); + } + this.ePillDropList.appendChild(itemComponent.getGui()); + }); + this.addAriaLabelsToComponents(); + } + addAriaLabelsToComponents() { + const { childPillComponents, ePillDropList } = this; + const len = childPillComponents.length; + _setAriaRole7(ePillDropList, len === 0 ? "presentation" : "listbox"); + for (let i = 0; i < len; i++) { + const comp = childPillComponents[i]; + const eGui = comp.getGui(); + _setAriaPosInSet3(eGui, i + 1); + _setAriaSetSize3(eGui, len); + } + } + createItemComponent(item, ghost) { + const itemComponent = this.createPillComponent(item, this.dropTarget, ghost, this.horizontal); + itemComponent.addEventListener("columnRemove", this.removeItems.bind(this, [item])); + this.createBean(itemComponent); + this.guiDestroyFunctions.push(() => this.destroyBean(itemComponent)); + if (!ghost) { + this.childPillComponents.push(itemComponent); + } + return itemComponent; + } + addIconAndTitleToGui() { + const { title, icon: eGroupIcon } = this.params; + if (!title || !eGroupIcon) { + return; + } + const eTitleBar = _createElement7({ tag: "div" }); + _setAriaHidden(eTitleBar, true); + this.addElementClasses(eTitleBar, "title-bar"); + this.addElementClasses(eGroupIcon, "icon"); + this.toggleCss("ag-column-drop-empty", this.isExistingItemsEmpty()); + eTitleBar.appendChild(eGroupIcon); + if (!this.horizontal) { + const eTitle = _createElement7({ tag: "span" }); + this.addElementClasses(eTitle, "title"); + eTitle.textContent = title; + eTitleBar.appendChild(eTitle); + } + this.appendChild(eTitleBar); + } + isExistingItemsEmpty() { + return this.getExistingItems().length === 0; + } + addEmptyMessageToGui() { + const { emptyMessage } = this.params; + if (!emptyMessage || !this.isExistingItemsEmpty() || this.isPotentialDndItems()) { + return; + } + const eMessage = _createElement7({ tag: "span" }); + eMessage.textContent = emptyMessage; + this.addElementClasses(eMessage, "empty-message"); + this.ePillDropList.appendChild(eMessage); + } + addArrow(eParent) { + if (this.horizontal) { + const enableRtl = this.gos.get("enableRtl"); + const icon = _createIconNoSpan10(enableRtl ? "panelDelimiterRtl" : "panelDelimiter", this.beans); + this.addElementClasses(icon, "cell-separator"); + eParent.appendChild(icon); + } + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/dropZoneColumnComp.ts +import { Component as Component28, DragSourceType as DragSourceType6, KeyCode as KeyCode24, RefPlaceholder as RefPlaceholder26, _createElement as _createElement8 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/pillDragComp.ts +import { + Component as Component27, + KeyCode as KeyCode23, + RefPlaceholder as RefPlaceholder25, + TouchListener as TouchListener3, + _createIconNoSpan as _createIconNoSpan11, + _setAriaLabel as _setAriaLabel13, + _setDisplayed as _setDisplayed14 +} from "ag-grid-community"; +var PillDragCompElement = { + tag: "span", + role: "option", + children: [ + { + tag: "span", + ref: "eDragHandle", + cls: "ag-drag-handle ag-column-drop-cell-drag-handle", + role: "presentation" + }, + { tag: "span", ref: "eText", cls: "ag-column-drop-cell-text", attrs: { "aria-hidden": "true" } }, + { tag: "span", ref: "eButton", cls: "ag-column-drop-cell-button", role: "presentation" } + ] +}; +var PillDragComp = class extends Component27 { + constructor(dragSourceDropTarget, ghost, horizontal, template, agComponents) { + super(); + this.dragSourceDropTarget = dragSourceDropTarget; + this.ghost = ghost; + this.horizontal = horizontal; + this.template = template; + this.agComponents = agComponents; + this.eText = RefPlaceholder25; + this.eDragHandle = RefPlaceholder25; + this.eButton = RefPlaceholder25; + } + postConstruct() { + this.setTemplate(this.template ?? PillDragCompElement, this.agComponents); + const eGui = this.getGui(); + const { beans, eDragHandle, eText, eButton } = this; + this.addElementClasses(eGui); + this.addElementClasses(eDragHandle, "drag-handle"); + this.addElementClasses(eText, "text"); + this.addElementClasses(eButton, "button"); + eDragHandle.appendChild(_createIconNoSpan11("columnDrag", beans)); + eButton.appendChild(_createIconNoSpan11("cancel", beans)); + this.tooltipFeature = this.createOptionalManagedBean( + beans.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.getGui() + }) + ); + this.setupComponents(); + if (!this.ghost && this.isDraggable()) { + this.addDragSource(); + } + this.setupAria(); + this.setupTooltip(); + this.activateTabIndex(); + this.refreshDraggable(); + } + isDraggable() { + return true; + } + refreshDraggable() { + this.eDragHandle.classList.toggle("ag-column-select-column-readonly", !this.isDraggable()); + } + setupAria() { + const translate = this.getLocaleTextFunc(); + const ariaInstructions = [this.getAriaDisplayName()]; + this.addAdditionalAriaInstructions(ariaInstructions, translate); + _setAriaLabel13(this.getGui(), ariaInstructions.join(". ")); + } + addAdditionalAriaInstructions(ariaInstructions, translate) { + if (this.isRemovable()) { + const deleteAria = translate("ariaDropZoneColumnComponentDescription", "Press DELETE to remove"); + ariaInstructions.push(deleteAria); + } + } + setupTooltip() { + const refresh = () => this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip()); + refresh(); + this.addManagedEventListeners({ newColumnsLoaded: refresh }); + } + getDragSourceId() { + return void 0; + } + getDefaultIconName() { + return "notAllowed"; + } + addDragSource() { + const { + beans: { dragAndDrop }, + eDragHandle + } = this; + const getDragItem = this.createGetDragItem(); + const defaultIconName = this.getDefaultIconName(); + const dragSource = { + type: this.getDragSourceType(), + sourceId: this.getDragSourceId(), + eElement: eDragHandle, + getDefaultIconName: () => defaultIconName, + getDragItem, + dragItemName: this.getDisplayName() + }; + dragAndDrop?.addDragSource(dragSource, true); + this.addDestroyFunc(() => dragAndDrop?.removeDragSource(dragSource)); + } + setupComponents() { + this.eText.textContent = this.getDisplayValue(); + this.setupRemove(); + if (this.ghost) { + this.addCss("ag-column-drop-cell-ghost"); + } + } + isRemovable() { + return true; + } + refreshRemove() { + _setDisplayed14(this.eButton, this.isRemovable()); + } + setupRemove() { + this.refreshRemove(); + const agEvent = { type: "columnRemove" }; + this.addGuiEventListener("keydown", (e) => this.onKeyDown(e)); + this.addManagedElementListeners(this.eButton, { + click: (mouseEvent) => { + this.dispatchLocalEvent(agEvent); + mouseEvent.stopPropagation(); + } + }); + const touchListener = new TouchListener3(this.eButton); + this.addManagedListeners(touchListener, { + tap: () => this.dispatchLocalEvent(agEvent) + }); + this.addDestroyFunc(touchListener.destroy.bind(touchListener)); + } + onKeyDown(e) { + const isDelete = e.key === KeyCode23.DELETE; + if (isDelete) { + if (this.isRemovable()) { + e.preventDefault(); + this.dispatchLocalEvent({ type: "columnRemove" }); + } + } + } + getDisplayValue() { + return this.getDisplayName(); + } + addElementClasses(el, suffix) { + suffix = suffix ? `-${suffix}` : ""; + const direction = this.horizontal ? "horizontal" : "vertical"; + el.classList.add(`ag-column-drop-cell${suffix}`, `ag-column-drop-${direction}-cell${suffix}`); + } + destroy() { + super.destroy(); + this.dragSourceDropTarget = null; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/dropZoneColumnComp.ts +var DropZoneColumnComp = class extends PillDragComp { + constructor(column, dragSourceDropTarget, ghost, dropZonePurpose, horizontal, updateParams) { + super(dragSourceDropTarget, ghost, horizontal); + this.column = column; + this.dropZonePurpose = dropZonePurpose; + this.updateParams = updateParams; + this.eSortIndicator = RefPlaceholder26; + this.popupShowing = false; + this.deferApply = isDeferredMode(updateParams); + } + postConstruct() { + const { sortSvc, colNames } = this.beans; + this.template = { + tag: "span", + role: "option", + children: [ + { + tag: "span", + ref: "eDragHandle", + cls: "ag-drag-handle ag-column-drop-cell-drag-handle", + role: "presentation" + }, + { tag: "span", ref: "eText", cls: "ag-column-drop-cell-text", attrs: { "aria-hidden": "true" } }, + sortSvc ? { tag: "ag-sort-indicator", ref: "eSortIndicator" } : void 0, + { tag: "span", ref: "eButton", cls: "ag-column-drop-cell-button", role: "presentation" } + ] + }; + if (sortSvc) { + this.agComponents = [sortSvc.getSortIndicatorSelector()]; + } + this.displayName = colNames.getDisplayNameForColumn(this.column, "columnDrop"); + super.postConstruct(); + if (this.deferApply) { + this.eDragHandle.setAttribute("data-column-tool-panel-deferred", ""); + } + if (sortSvc) { + this.setupSort(); + this.addManagedEventListeners({ + sortChanged: () => { + this.setupAria(); + } + }); + } + if (this.isGroupingZone()) { + this.addManagedPropertyListener("groupLockGroupColumns", () => { + this.refreshRemove(); + this.refreshDraggable(); + this.setupAria(); + }); + } + } + getItem() { + return this.column; + } + getDisplayName() { + return this.displayName; + } + getTooltip() { + return this.column.getColDef().headerTooltip; + } + addAdditionalAriaInstructions(ariaInstructions, translate) { + const isSortSuppressed = this.gos.get("rowGroupPanelSuppressSort"); + const isFunctionsReadOnly = this.gos.get("functionsReadOnly"); + if (this.isAggregationZone() && !isFunctionsReadOnly) { + const aggregationMenuAria = translate( + "ariaDropZoneColumnValueItemDescription", + "Press ENTER to change the aggregation type" + ); + ariaInstructions.push(aggregationMenuAria); + } + if (this.isGroupingZone() && this.column.isSortable() && !isSortSuppressed) { + const sortProgressAria = translate("ariaDropZoneColumnGroupItemDescription", "Press ENTER to sort"); + ariaInstructions.push(sortProgressAria); + } + super.addAdditionalAriaInstructions(ariaInstructions, translate); + } + isMovable() { + return this.isDraggable(); + } + isDraggable() { + return this.isReadOnly(); + } + isRemovable() { + return this.isReadOnly(); + } + isReadOnly() { + return !this.isGroupingAndLocked() && !this.gos.get("functionsReadOnly"); + } + getAriaDisplayName() { + const translate = this.getLocaleTextFunc(); + const { name, aggFuncName } = this.getColumnAndAggFuncName(); + const aggSeparator = translate("ariaDropZoneColumnComponentAggFuncSeparator", " of "); + const sortDirection = { + asc: translate("ariaDropZoneColumnComponentSortAscending", "ascending"), + desc: translate("ariaDropZoneColumnComponentSortDescending", "descending") + }; + const columnSort = this.getCurrentSortDirection(this.column); + const isSortSuppressed = this.gos.get("rowGroupPanelSuppressSort"); + return [ + aggFuncName && `${aggFuncName}${aggSeparator}`, + name, + this.isGroupingZone() && !isSortSuppressed && columnSort && `, ${sortDirection[columnSort]}` + ].filter((part) => !!part).join(""); + } + getColumnAndAggFuncName() { + const name = this.displayName; + let aggFuncName = ""; + if (this.isAggregationZone()) { + const aggFunc = this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply, this.column); + const aggFuncString = typeof aggFunc === "string" ? aggFunc : "agg"; + const localeTextFunc = this.getLocaleTextFunc(); + aggFuncName = localeTextFunc(aggFuncString, aggFuncString); + } + return { name, aggFuncName }; + } + setupSort() { + if (!this.column.isSortable() || !this.isGroupingZone()) { + return; + } + const { gos, column, eSortIndicator } = this; + if (!gos.get("rowGroupPanelSuppressSort")) { + eSortIndicator.setupSort(column, true, this.getSortDefOverride.bind(this)); + const performSort = (event) => { + event.preventDefault(); + this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply, column, event); + eSortIndicator.refresh(); + this.setupAria(); + refreshDeferredToolPanelUi(this.beans, this.updateParams); + }; + this.addGuiEventListener("click", performSort); + this.addGuiEventListener("keydown", (e) => { + const isEnter = e.key === KeyCode24.ENTER; + if (isEnter && this.isGroupingZone()) { + performSort(e); + } + }); + } + } + getCurrentSortDirection(column) { + return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply, column)?.direction ?? null; + } + getSortDefOverride() { + if (!this.deferApply) { + return void 0; + } + return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply, this.column); + } + getDefaultIconName() { + return "hide"; + } + createGetDragItem() { + const { column } = this; + return () => { + const visibleState = {}; + visibleState[column.getId()] = column.isVisible(); + return { + columns: [column], + visibleState + }; + }; + } + setupComponents() { + super.setupComponents(); + if (this.isAggregationZone() && !this.gos.get("functionsReadOnly")) { + this.addGuiEventListener("click", this.onShowAggFuncSelection.bind(this)); + } + } + onKeyDown(e) { + super.onKeyDown(e); + const isEnter = e.key === KeyCode24.ENTER; + if (isEnter && this.isAggregationZone() && !this.gos.get("functionsReadOnly")) { + e.preventDefault(); + this.onShowAggFuncSelection(); + } + } + getDisplayValue() { + const { name, aggFuncName } = this.getColumnAndAggFuncName(); + return this.isAggregationZone() ? `${aggFuncName}(${name})` : name; + } + onShowAggFuncSelection() { + if (this.popupShowing) { + return; + } + this.popupShowing = true; + const { aggFuncSvc, popupSvc } = this.beans; + const virtualList = new VirtualList({ cssIdentifier: "select-agg-func" }); + const rows = aggFuncSvc.getFuncNames(this.column); + const eGui = this.getGui(); + const virtualListGui = virtualList.getGui(); + virtualList.setModel({ + getRow: function(index) { + return rows[index]; + }, + getRowCount: function() { + return rows.length; + } + }); + this.createBean(virtualList); + const ePopup = _createElement8({ tag: "div", cls: "ag-select-agg-func-popup" }); + ePopup.style.top = "0px"; + ePopup.style.left = "0px"; + ePopup.appendChild(virtualListGui); + ePopup.style.width = `${eGui.clientWidth}px`; + const [focusoutListener] = this.addManagedElementListeners(ePopup, { + focusout: (e) => { + if (!ePopup.contains(e.relatedTarget) && addPopupRes) { + addPopupRes.hideFunc(); + } + } + }); + const popupHiddenFunc = (callbackEvent) => { + this.destroyBean(virtualList); + this.popupShowing = false; + if (callbackEvent?.key === "Escape") { + eGui.focus(); + } + if (focusoutListener) { + focusoutListener(); + } + }; + const translate = this.getLocaleTextFunc(); + const addPopupRes = popupSvc.addPopup({ + modal: true, + eChild: ePopup, + closeOnEsc: true, + closedCallback: popupHiddenFunc, + ariaLabel: translate("ariaLabelAggregationFunction", "Aggregation Function") + }); + if (addPopupRes) { + virtualList.setComponentCreator(this.createAggSelect.bind(this, addPopupRes.hideFunc)); + } + virtualList.addGuiEventListener("keydown", (e) => { + if (e.key === KeyCode24.ENTER || e.key === KeyCode24.SPACE) { + const row = virtualList.getLastFocusedRow(); + if (row == null) { + return; + } + const comp = virtualList.getComponentAt(row); + if (comp) { + comp.selectItem(); + } + } + }); + popupSvc.positionPopupByComponent({ + type: "aggFuncSelect", + eventSource: eGui, + ePopup, + keepWithinBounds: true, + additionalParams: { + column: this.column + }, + position: "under" + }); + virtualList.refresh(); + const currentAggFunc = this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply, this.column); + let rowToFocus = rows.findIndex((r) => r === currentAggFunc); + if (rowToFocus === -1) { + rowToFocus = 0; + } + virtualList.focusRow(rowToFocus); + } + createAggSelect(hidePopup, value) { + const itemSelected = () => { + hidePopup(); + this.getGui().focus(); + this.beans.columnStateUpdateStrategy.setColumnAggFunc( + this.deferApply, + this.column, + value, + "toolPanelDragAndDrop" + ); + if (this.column) { + const eText = this.getGui().querySelector(".ag-column-drop-cell-text"); + if (eText) { + eText.textContent = this.getDisplayValue(); + } + this.setupAria(); + } + refreshDeferredToolPanelUi(this.beans, this.updateParams); + }; + const localeTextFunc = this.getLocaleTextFunc(); + const aggFuncString = (value || "").toString(); + const aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString); + const comp = new AggItemComp(itemSelected, aggFuncStringTranslated); + return comp; + } + isGroupingAndLocked() { + return this.isGroupingZone() && isRowGroupColLocked(this.column, this.beans); + } + isAggregationZone() { + return this.dropZonePurpose === "aggregation"; + } + isGroupingZone() { + return this.dropZonePurpose === "rowGroup"; + } + getDragSourceType() { + return DragSourceType6.ToolPanel; + } + destroy() { + super.destroy(); + this.column = null; + } +}; +var AggItemComp = class extends Component28 { + constructor(itemSelected, value) { + super({ tag: "div", cls: "ag-select-agg-func-item", children: value }); + this.selectItem = itemSelected; + this.addGuiEventListener("click", this.selectItem); + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/baseDropZonePanel.ts +var BaseDropZonePanel = class extends PillDropZonePanel { + constructor(horizontal, dropZonePurpose, updateParams) { + super(horizontal); + this.dropZonePurpose = dropZonePurpose; + this.updateParams = updateParams; + this.addElementClasses(this.getGui(), this.dropZonePurpose.toLowerCase()); + } + init(params) { + super.init(params); + this.addManagedEventListeners({ newColumnsLoaded: this.refreshGui.bind(this) }); + this.addManagedPropertyListeners( + ["functionsReadOnly", "rowGroupPanelSuppressSort", "groupLockGroupColumns"], + this.refreshGui.bind(this) + ); + } + getItems(dragItem) { + return dragItem.columns ?? []; + } + isInterestedIn(type, sourceElement) { + if (type === DragSourceType7.HeaderCell) { + return true; + } + if (type !== DragSourceType7.ToolPanel) { + return false; + } + if (!this.horizontal) { + return true; + } + return !sourceElement.hasAttribute("data-column-tool-panel-deferred"); + } + minimumAllowedNewInsertIndex() { + const { gos, rowGroupColsSvc } = this.beans; + const numberOfLockedCols = gos.get("groupLockGroupColumns"); + const numberOfGroupCols = rowGroupColsSvc?.columns.length ?? 0; + if (numberOfLockedCols === -1) { + return numberOfGroupCols; + } + return Math.min(numberOfLockedCols, numberOfGroupCols); + } + showOrHideColumnOnExit(draggingEvent) { + return this.isRowGroupPanel() && _shouldUpdateColVisibilityAfterGroup(this.gos, true) && !draggingEvent.fromNudge; + } + handleDragEnterEnd(draggingEvent) { + const hideColumnOnExit = this.showOrHideColumnOnExit(draggingEvent); + if (hideColumnOnExit) { + const dragItem = draggingEvent.dragSource.getDragItem(); + const columns = dragItem.columns; + this.setColumnsVisible(columns, false, "uiColumnDragged"); + } + } + handleDragLeaveEnd(draggingEvent) { + const showColumnOnExit = this.showOrHideColumnOnExit(draggingEvent); + if (showColumnOnExit) { + const dragItem = draggingEvent.dragSource.getDragItem(); + this.setColumnsVisible(dragItem.columns, true, "uiColumnDragged"); + } + } + setColumnsVisible(columns, visible, source) { + if (!columns) { + return; + } + if (isDeferredMode(this.updateParams)) { + return; + } + const allowedCols = columns.filter((c) => !c.getColDef().lockVisible); + this.beans.columnStateUpdateStrategy.setColumnsVisible(false, allowedCols, visible, source); + } + isRowGroupPanel() { + return this.dropZonePurpose === "rowGroup"; + } + createPillComponent(column, dropTarget, ghost, horizontal) { + return new DropZoneColumnComp(column, dropTarget, ghost, this.dropZonePurpose, horizontal, this.updateParams); + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/pivotDropZonePanel.ts +var PivotDropZonePanel = class extends BaseDropZonePanel { + constructor(horizontal, params) { + super(horizontal, "pivot", params); + } + postConstruct() { + const localeTextFunc = this.getLocaleTextFunc(); + const emptyMessage = localeTextFunc("pivotColumnsEmptyMessage", "Drag here to set column labels"); + const title = localeTextFunc("pivots", "Column Labels"); + super.init({ + icon: _createIconNoSpan12("pivotPanel", this.beans, null), + emptyMessage, + title + }); + if (this.horizontal) { + _addFocusableContainerListener2(this.beans, this, this.getGui()); + } + this.addManagedEventListeners({ + newColumnsLoaded: this.refresh.bind(this), + columnPivotChanged: this.refresh.bind(this), + columnPivotModeChanged: this.checkVisibility.bind(this) + }); + this.refresh(); + } + getAriaLabel() { + const translate = this.getLocaleTextFunc(); + return translate("ariaPivotDropZonePanelLabel", "Column Labels"); + } + refresh() { + this.checkVisibility(); + this.refreshGui(); + } + checkVisibility() { + const colModel = this.beans.colModel; + const pivotMode = colModel.isPivotMode(); + if (this.horizontal) { + switch (this.gos.get("pivotPanelShow")) { + case "always": + this.setDisplayed(pivotMode); + break; + case "onlyWhenPivoting": { + const pivotActive = colModel.isPivotActive(); + this.setDisplayed(pivotMode && pivotActive); + break; + } + default: + this.setDisplayed(false); + break; + } + } else { + this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(isDeferredMode(this.updateParams))); + } + } + isItemDroppable(column, draggingEvent) { + if (this.gos.get("functionsReadOnly") || !column.isPrimary()) { + return false; + } + const isActive = this.beans.columnStateUpdateStrategy.getPivotColumns(isDeferredMode(this.updateParams)).includes(column); + return column.isAllowPivot() && (!isActive || this.isSourceEventFromTarget(draggingEvent)); + } + updateItems(columns) { + this.beans.columnStateUpdateStrategy.setPivotColumns(isDeferredMode(this.updateParams), columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.updateParams); + } + getIconName() { + return this.isPotentialDndItems() ? "pivot" : "notAllowed"; + } + getExistingItems() { + return this.beans.columnStateUpdateStrategy.getPivotColumns(isDeferredMode(this.updateParams)); + } + getFocusableContainerName() { + return "pivotToolbar"; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/rowGroupDropZonePanel.ts +import { _addFocusableContainerListener as _addFocusableContainerListener3, _createIconNoSpan as _createIconNoSpan13 } from "ag-grid-community"; +var RowGroupDropZonePanel = class extends BaseDropZonePanel { + constructor(horizontal, params) { + super(horizontal, "rowGroup", params); + } + postConstruct() { + const localeTextFunc = this.getLocaleTextFunc(); + const emptyMessage = localeTextFunc("rowGroupColumnsEmptyMessage", "Drag here to set row groups"); + const title = localeTextFunc("groups", "Row Groups"); + super.init({ + icon: _createIconNoSpan13("rowGroupPanel", this.beans, null), + emptyMessage, + title + }); + if (this.horizontal) { + _addFocusableContainerListener3(this.beans, this, this.getGui()); + } + this.addManagedEventListeners({ columnRowGroupChanged: this.refreshGui.bind(this) }); + } + getAriaLabel() { + const translate = this.getLocaleTextFunc(); + const label = translate("ariaRowGroupDropZonePanelLabel", "Row Groups"); + return label; + } + isItemDroppable(column, draggingEvent) { + if (this.gos.get("functionsReadOnly") || !column.isPrimary() || column.colDef.showRowGroup) { + return false; + } + const isActive = this.beans.columnStateUpdateStrategy.getRowGroupColumns(isDeferredMode(this.updateParams)).includes(column); + return column.isAllowRowGroup() && (!isActive || this.isSourceEventFromTarget(draggingEvent)); + } + updateItems(columns) { + this.beans.columnStateUpdateStrategy.setRowGroupColumns( + isDeferredMode(this.updateParams), + columns, + "toolPanelUi" + ); + refreshDeferredToolPanelUi(this.beans, this.updateParams); + } + getIconName() { + return this.isPotentialDndItems() ? "group" : "notAllowed"; + } + getExistingItems() { + return this.beans.columnStateUpdateStrategy.getRowGroupColumns(isDeferredMode(this.updateParams)); + } + getFocusableContainerName() { + return "rowGroupToolbar"; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/valueDropZonePanel.ts +import { _createIconNoSpan as _createIconNoSpan14 } from "ag-grid-community"; +var ValuesDropZonePanel = class extends BaseDropZonePanel { + constructor(horizontal, params) { + super(horizontal, "aggregation", params); + } + postConstruct() { + const localeTextFunc = this.getLocaleTextFunc(); + const emptyMessage = localeTextFunc("valueColumnsEmptyMessage", "Drag here to aggregate"); + const title = localeTextFunc("values", "Values"); + super.init({ + icon: _createIconNoSpan14("valuePanel", this.beans, null), + emptyMessage, + title + }); + this.addManagedEventListeners({ columnValueChanged: this.refreshGui.bind(this) }); + } + getAriaLabel() { + const translate = this.getLocaleTextFunc(); + const label = translate("ariaValuesDropZonePanelLabel", "Values"); + return label; + } + getIconName() { + return this.isPotentialDndItems() ? "aggregate" : "notAllowed"; + } + isItemDroppable(column, draggingEvent) { + if (this.gos.get("functionsReadOnly") || !column.isPrimary()) { + return false; + } + const isActive = this.beans.columnStateUpdateStrategy.getValueColumns(isDeferredMode(this.updateParams)).includes(column); + return column.isAllowValue() && (!isActive || this.isSourceEventFromTarget(draggingEvent)); + } + updateItems(columns) { + this.beans.columnStateUpdateStrategy.setValueColumns(isDeferredMode(this.updateParams), columns, "toolPanelUi"); + refreshDeferredToolPanelUi(this.beans, this.updateParams); + } + getExistingItems() { + return this.beans.columnStateUpdateStrategy.getValueColumns(isDeferredMode(this.updateParams)); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/pivotModePanel.ts +import { AgToggleButtonSelector, Component as Component29, RefPlaceholder as RefPlaceholder27 } from "ag-grid-community"; +var PivotModePanelElement = { + tag: "div", + cls: "ag-pivot-mode-panel", + children: [ + { + tag: "ag-toggle-button", + ref: "cbPivotMode", + cls: "ag-pivot-mode-select" + } + ] +}; +var PivotModePanel = class extends Component29 { + constructor(params, onPivotModeValueChanged) { + super(); + this.params = params; + this.onPivotModeValueChanged = onPivotModeValueChanged; + this.cbPivotMode = RefPlaceholder27; + } + getCurrentPivotMode() { + return this.beans.columnStateUpdateStrategy.getPivotMode(isDeferredMode(this.params)); + } + syncFromGrid() { + this.cbPivotMode.setValue(this.getCurrentPivotMode()); + } + refreshEditStrategy() { + this.syncFromGrid(); + } + postConstruct() { + this.setTemplate(PivotModePanelElement, [AgToggleButtonSelector]); + const cbPivotMode = this.cbPivotMode; + cbPivotMode.setValue(this.getCurrentPivotMode()); + const localeTextFunc = this.getLocaleTextFunc(); + cbPivotMode.setLabel(localeTextFunc("pivotMode", "Pivot Mode")); + const onBtPivotMode = () => { + const newValue = !!cbPivotMode.getValue(); + this.beans.columnStateUpdateStrategy.setPivotMode(isDeferredMode(this.params), newValue, "toolPanelUi"); + this.onPivotModeValueChanged?.(); + }; + const onPivotModeChanged = () => { + cbPivotMode.setValue(this.getCurrentPivotMode()); + }; + this.addManagedListeners(cbPivotMode, { fieldValueChanged: onBtPivotMode }); + this.addManagedEventListeners({ + newColumnsLoaded: onPivotModeChanged, + columnPivotModeChanged: onPivotModeChanged + }); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnToolPanelFactory.ts +var ColumnToolPanelFactory = class extends BeanStub8 { + constructor() { + super(...arguments); + this.beanName = "colToolPanelFactory"; + } + setPanelVisible(existingPanel, visible, createFunc) { + if (existingPanel) { + existingPanel.setDisplayed(visible); + } else if (visible) { + existingPanel = createFunc(); + } + return existingPanel; + } + createRowGroupPanel(parent, destroyFuncs, params) { + return this.createPanel(parent, destroyFuncs, new RowGroupDropZonePanel(false, params)); + } + createValuesPanel(parent, destroyFuncs, params) { + return this.createPanel(parent, destroyFuncs, new ValuesDropZonePanel(false, params)); + } + createPivotPanel(parent, destroyFuncs, params) { + return this.createPanel(parent, destroyFuncs, new PivotDropZonePanel(false, params)); + } + createPivotModePanel(parent, destroyFuncs, params, onPivotModeValueChanged, prepend) { + return this.createPanel(parent, destroyFuncs, new PivotModePanel(params, onPivotModeValueChanged), prepend); + } + createPanel(parent, destroyFuncs, panel, prepend) { + panel = parent.createBean(panel); + destroyFuncs.push(() => parent.destroyBean(panel)); + if (prepend) { + parent.prependChild(panel); + } else { + parent.appendChild(panel); + } + return panel; + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/updates/columnStateUpdateStrategy.ts +import { BeanStub as BeanStub10 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/columnToolPanel/updates/columnStateUpdateExecutionStrategy.ts +import { BeanStub as BeanStub9, _applyColumnState, _areEqual as _areEqual3, isColumnGroupAutoCol, isSpecialCol } from "ag-grid-community"; +var noop = () => { +}; +var ColumnStateUpdateExecutionStrategy = class extends BeanStub9 { + constructor() { + super(...arguments); + this.beanName = "columnStateUpdateExecutionStrategy"; + } + applyColumnState(deferMode, state, eventType) { + this.getUpdateStrategy(deferMode).applyColumnState(state, eventType); + } + commit(deferMode) { + this.getUpdateStrategy(deferMode).commit(); + } + hasPendingChanges(deferMode) { + return this.getUpdateStrategy(deferMode).hasPendingChanges(); + } + moveColumns(deferMode, columns, targetIndex, eventType) { + this.getUpdateStrategy(deferMode).moveColumns(columns, targetIndex, eventType); + } + reset(deferMode) { + this.getUpdateStrategy(deferMode).reset(); + } + setColumnsVisible(deferMode, columns, visible, eventType) { + this.getUpdateStrategy(deferMode).setColumnsVisible(columns, visible, eventType); + } + isColumnVisibleInToolPanel(deferMode, column) { + return this.getUpdateStrategy(deferMode).isColumnVisibleInToolPanel(column); + } + setRowGroupColumns(deferMode, columns, eventType) { + this.getUpdateStrategy(deferMode).setRowGroupColumns(columns, eventType); + } + getRowGroupColumns(deferMode) { + return this.getUpdateStrategy(deferMode).getRowGroupColumns(); + } + getPrimaryColumns(deferMode) { + return this.getUpdateStrategy(deferMode).getPrimaryColumns(); + } + hasDeferredColumnOrder(deferMode) { + return this.getUpdateStrategy(deferMode).hasDeferredColumnOrder(); + } + setValueColumns(deferMode, columns, eventType) { + this.getUpdateStrategy(deferMode).setValueColumns(columns, eventType); + } + getValueColumns(deferMode) { + return this.getUpdateStrategy(deferMode).getValueColumns(); + } + setColumnAggFunc(deferMode, column, aggFunc, eventType) { + this.getUpdateStrategy(deferMode).setColumnAggFunc(column, aggFunc, eventType); + } + getColumnAggFunc(deferMode, column) { + return this.getUpdateStrategy(deferMode).getColumnAggFunc(column); + } + setPivotColumns(deferMode, columns, eventType) { + this.getUpdateStrategy(deferMode).setPivotColumns(columns, eventType); + } + getPivotColumns(deferMode) { + return this.getUpdateStrategy(deferMode).getPivotColumns(); + } + setPivotMode(deferMode, pivotMode, eventType) { + this.getUpdateStrategy(deferMode).setPivotMode(pivotMode, eventType); + } + getPivotMode(deferMode) { + return this.getUpdateStrategy(deferMode).getPivotMode(); + } + isColumnSelectedInPivotModeToolPanel(deferMode, column) { + return this.getUpdateStrategy(deferMode).isColumnSelectedInPivotModeToolPanel(column); + } + progressSortFromEvent(deferMode, column, event) { + this.getUpdateStrategy(deferMode).progressSortFromEvent(column, event); + } + getSortDef(deferMode, column) { + return this.getUpdateStrategy(deferMode).getSortDef(column); + } + getUpdateStrategy(deferApply) { + return deferApply ? this.getDeferredUpdateStrategy() : this.getSyncUpdateStrategy(); + } + getSyncUpdateStrategy() { + return this.syncUpdateStrategy ?? (this.syncUpdateStrategy = new SynchronousColumnStateUpdateStrategy(this.beans)); + } + getDeferredUpdateStrategy() { + return this.deferredUpdateStrategy ?? (this.deferredUpdateStrategy = new DeferredColumnStateUpdateStrategy(this.beans)); + } +}; +var SynchronousColumnStateUpdateStrategy = class { + constructor(beans) { + this.beans = beans; + this.lastPivotColIds = []; + this.reset = noop; + this.commit = noop; + this.hasPendingChanges = () => false; + this.hasDeferredColumnOrder = () => false; + } + applyColumnState(state, eventType) { + if (state.length === 0) { + return; + } + _applyColumnState(this.beans, { state }, eventType); + } + moveColumns(columns, targetIndex, eventType) { + this.beans.colMoves?.moveColumns(columns, targetIndex, eventType); + syncPrimaryColDefOrderFromCurrentColumns(this.beans); + } + setColumnsVisible(columns, visible, eventType) { + const allowedCols = columns.filter((column) => !column.getColDef().lockVisible); + this.beans.colModel.setColsVisible(allowedCols, visible, eventType); + } + setRowGroupColumns(columns, eventType) { + this.beans.rowGroupColsSvc?.setColumns(columns, eventType); + } + getRowGroupColumns() { + return this.beans.rowGroupColsSvc?.columns ?? []; + } + getPrimaryColumns() { + return getPrimaryColumns(this.beans); + } + setValueColumns(columns, eventType) { + this.beans.valueColsSvc?.setColumns(columns, eventType); + } + getValueColumns() { + return this.beans.valueColsSvc?.columns ?? []; + } + setColumnAggFunc(column, aggFunc, eventType) { + this.beans.valueColsSvc?.setColumnAggFunc?.(column, aggFunc, eventType); + } + getColumnAggFunc(column) { + return column.getAggFunc(); + } + setPivotColumns(columns, eventType) { + this.lastPivotColIds = columns.map((column) => column.getColId()); + this.beans.pivotColsSvc?.setColumns(columns, eventType); + } + getPivotColumns() { + return this.beans.pivotColsSvc?.columns ?? []; + } + setPivotMode(pivotMode, eventType) { + const { colModel, gos, ctrlsSvc } = this.beans; + if (pivotMode === colModel.isPivotMode()) { + return; + } + const currentPivotColIds = this.beans.pivotColsSvc?.columns.map((col) => col.getColId()) ?? []; + if (currentPivotColIds.length > 0) { + this.lastPivotColIds = currentPivotColIds; + } + if (!pivotMode) { + const cols = this.beans.colModel.getColDefCols() ?? []; + _applyColumnState( + this.beans, + { + state: cols.map((col) => ({ + colId: col.getColId(), + pivot: false, + pivotIndex: null + })) + }, + eventType + ); + } + gos.updateGridOptions({ options: { pivotMode }, source: eventType }); + if (pivotMode && this.lastPivotColIds.length > 0) { + this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds, eventType); + } + for (const c of ctrlsSvc.getHeaderRowContainerCtrls()) { + c.refresh(); + } + } + progressSortFromEvent(column, event) { + this.beans.sortSvc?.progressSortFromEvent(column, event); + } + isColumnVisibleInToolPanel(column) { + return column.isVisible(); + } + isColumnSelectedInPivotModeToolPanel(column) { + return column.isAnyFunctionActive(); + } + getPivotMode() { + return this.beans.colModel.isPivotMode(); + } + getSortDef(column) { + return column.getSortDef(); + } +}; +var DeferredColumnStateUpdateStrategy = class { + constructor(beans) { + this.beans = beans; + this.state = {}; + this.sequence = 0; + this.lastPivotColIds = []; + } + reset() { + this.sequence = 0; + this.state = {}; + } + hasPendingChanges() { + const { state, beans } = this; + const { columnState, columnOrder, rowGroup, aggregation, pivot, pivotMode, sort, aggFuncs } = state; + const getColIds = (cols) => (cols ?? []).map((c) => c.getColId()); + if (columnState) { + for (const [colId, patch] of columnState.patches) { + const column = beans.colModel.getColDefCol(colId); + if (!column) { + continue; + } + if (patch.hide !== void 0 && patch.hide !== !column.isVisible() || patch.rowGroup !== void 0 && !!patch.rowGroup !== column.isRowGroupActive() || patch.pivot !== void 0 && !!patch.pivot !== column.isPivotActive() || patch.aggFunc !== void 0 && (patch.aggFunc ?? null) !== (column.getAggFunc() ?? null)) { + return true; + } + } + } + if (columnOrder && !_areEqual3(columnOrder.colIds, getPrimaryColumnIds(beans))) { + return true; + } + if (rowGroup && !_areEqual3(rowGroup.colIds, getColIds(beans.rowGroupColsSvc?.columns))) { + return true; + } + if (aggregation && !_areEqual3(aggregation.colIds, getColIds(beans.valueColsSvc?.columns))) { + return true; + } + if (pivot && !_areEqual3(pivot.colIds, getColIds(beans.pivotColsSvc?.columns))) { + return true; + } + if (pivotMode && pivotMode.pivotMode !== beans.colModel.isPivotMode()) { + return true; + } + if (sort) { + for (const [colId, sortDef] of sort.sortDefsByColId) { + const column = beans.colModel.getColDefCol(colId); + if (!column) { + continue; + } + if ((sortDef?.direction ?? null) !== (column.getSortDef()?.direction ?? null)) { + return true; + } + } + if (sort.baselineCleared) { + const primaryColumns = getPrimaryColumns(beans); + for (const col of primaryColumns) { + if (!sort.sortDefsByColId.has(col.getColId()) && col.getSortDef() !== null) { + return true; + } + } + } + } + if (aggFuncs) { + for (const [colId, aggFunc] of aggFuncs.values) { + const column = beans.colModel.getColDefCol(colId); + if (!column) { + continue; + } + if (aggFunc !== column.getAggFunc()) { + return true; + } + } + } + return false; + } + commit() { + const { beans, state } = this; + const operations = []; + for (const type of Object.keys(state)) { + const operation = state[type]; + if (operation) { + operations.push({ type, ...operation }); + } + } + const sortedEntries = operations.sort((a, b) => a.seq - b.seq); + for (const operation of sortedEntries) { + switch (operation.type) { + case "columnState": { + _applyColumnState(beans, { state: [...operation.patches.values()] }, operation.eventType); + break; + } + case "columnOrder": { + const orderedColumns = operation.colIds.map((colId) => beans.colModel.getColDefCol(colId)).filter((column) => !!column && isPrimaryColDefColumn(column)); + if (!beans.colModel.isPivotMode()) { + for (let i = 0; i < orderedColumns.length; i++) { + const column = orderedColumns[i]; + const allColumns = beans.colModel.getCols(); + const nonPrimaryPrefix = allColumns.findIndex((col) => isPrimaryColDefColumn(col)); + const targetIndex = (nonPrimaryPrefix >= 0 ? nonPrimaryPrefix : 0) + i; + if (allColumns[targetIndex] !== column) { + beans.colMoves?.moveColumns([column], targetIndex, operation.eventType, true); + } + } + } + syncPrimaryColDefOrder(beans, orderedColumns); + break; + } + case "rowGroup": { + beans.rowGroupColsSvc?.setColumns(operation.colIds, operation.eventType); + break; + } + case "aggregation": { + beans.valueColsSvc?.setColumns(operation.colIds, operation.eventType); + break; + } + case "pivot": { + this.lastPivotColIds = operation.colIds; + beans.pivotColsSvc?.setColumns(operation.colIds, operation.eventType); + break; + } + case "pivotMode": { + const { colModel, ctrlsSvc, gos, stateSvc } = beans; + if (operation.pivotMode !== colModel.isPivotMode()) { + const currentPivotColIds = beans.pivotColsSvc?.columns.map((col) => col.getColId()) ?? []; + if (currentPivotColIds.length > 0) { + this.lastPivotColIds = currentPivotColIds; + } + const previousPivotColIds = stateSvc?.getState().pivot?.pivotColIds ?? currentPivotColIds; + const pivotColIds = operation.pivotMode ? this.state.pivot?.colIds ?? this.lastPivotColIds : previousPivotColIds; + stateSvc?.setState( + { + ...stateSvc.getState(), + pivot: { + pivotMode: operation.pivotMode, + pivotColIds + } + }, + ["pivot"] + ); + if (!operation.pivotMode) { + const cols = beans.colModel.getColDefCols() ?? []; + _applyColumnState( + beans, + { + state: cols.map((col) => ({ + colId: col.getColId(), + pivot: false, + pivotIndex: null + })) + }, + operation.eventType + ); + } + gos.updateGridOptions({ + options: { pivotMode: operation.pivotMode }, + source: operation.eventType + }); + if (operation.pivotMode && pivotColIds.length > 0) { + beans.pivotColsSvc?.setColumns(pivotColIds, operation.eventType); + } + for (const c of ctrlsSvc.getHeaderRowContainerCtrls()) { + c.refresh(); + } + } + break; + } + case "sort": { + const sortState = []; + let sortIndex = 0; + for (const [colId, sortDef] of operation.sortDefsByColId) { + sortState.push({ + colId, + sort: sortDef?.direction ?? null, + sortIndex: sortDef?.direction ? sortIndex++ : null, + sortType: sortDef?.type ?? void 0 + }); + } + _applyColumnState( + beans, + { + state: sortState, + defaultState: operation.baselineCleared ? { sort: null, sortIndex: null, sortType: void 0 } : void 0 + }, + operation.eventType + ); + break; + } + case "aggFuncs": { + for (const [colId, aggFunc] of operation.values) { + const column = beans.colModel.getColDefCol(colId); + if (!column) { + continue; + } + beans.valueColsSvc?.setColumnAggFunc?.(column, aggFunc, operation.eventType); + } + break; + } + } + } + this.reset(); + } + applyColumnState(state, eventType) { + for (const patch of state) { + mergeColumnStatePatch(this.state, patch); + } + const columnState = ensureColumnStateDraft(this.state); + columnState.seq = nextSeq(this.sequence); + this.sequence = columnState.seq; + columnState.eventType = eventType; + } + moveColumns(columns, targetIndex, eventType) { + const movingColIds = new Set(columns.map((column) => column.getColId())); + const orderedColIds = this.state.columnOrder?.colIds ?? getPrimaryColumnIds(this.beans); + const remaining = orderedColIds.filter((colId) => !movingColIds.has(colId)); + const movedIds = columns.map((column) => column.getColId()); + const seq = nextSeq(this.sequence); + this.sequence = seq; + this.state.columnOrder = { + colIds: [...remaining.slice(0, targetIndex), ...movedIds, ...remaining.slice(targetIndex)], + eventType, + seq + }; + } + setColumnsVisible(columns, visible, eventType) { + for (const column of columns) { + if (column.getColDef().lockVisible) { + continue; + } + mergeColumnStatePatch(this.state, { colId: column.getColId(), hide: !visible }); + } + const columnState = ensureColumnStateDraft(this.state); + columnState.seq = nextSeq(this.sequence); + this.sequence = columnState.seq; + columnState.eventType = eventType; + } + setRowGroupColumns(columns, eventType) { + clearDeferredFunctionPatches(this.state, "rowGroup"); + const seq = nextSeq(this.sequence); + this.sequence = seq; + this.state.rowGroup = { + colIds: columns.map((column) => column.getColId()), + eventType, + seq + }; + } + setValueColumns(columns, eventType) { + clearDeferredFunctionPatches(this.state, "aggFunc"); + const liveValueColIds = new Set((this.beans.valueColsSvc?.columns ?? []).map((col) => col.getColId())); + const aggFuncs = ensureAggFuncsDraft(this.state); + for (const col of columns) { + if (!liveValueColIds.has(col.getColId()) && !aggFuncs.values.has(col.getColId())) { + const existingAggFunc = col.getAggFunc(); + const aggFunc = existingAggFunc != null ? existingAggFunc : this.beans.aggFuncSvc?.getDefaultAggFunc(col); + if (aggFunc != null) { + aggFuncs.values.set(col.getColId(), aggFunc); + } + } + } + const seq = nextSeq(this.sequence); + this.sequence = seq; + aggFuncs.seq = seq; + aggFuncs.eventType = eventType; + this.state.aggregation = { + colIds: columns.map((column) => column.getColId()), + eventType, + seq + }; + } + setColumnAggFunc(column, aggFunc, eventType) { + mergeColumnStatePatch(this.state, { colId: column.getColId(), aggFunc }); + const columnState = ensureColumnStateDraft(this.state); + columnState.seq = nextSeq(this.sequence); + this.sequence = columnState.seq; + columnState.eventType = eventType; + const aggFuncs = ensureAggFuncsDraft(this.state); + aggFuncs.seq = columnState.seq; + aggFuncs.eventType = eventType; + aggFuncs.values.set(column.getColId(), aggFunc); + } + getColumnAggFunc(column) { + const colId = column.getColId(); + if (this.state.aggFuncs?.values.has(colId)) { + return this.state.aggFuncs.values.get(colId); + } + return column.getAggFunc(); + } + isColumnVisibleInToolPanel(column) { + const columnState = this.state.columnState?.patches.get(column.getColId()); + if (columnState?.hide !== void 0) { + return !columnState.hide; + } + return column.isVisible(); + } + isColumnSelectedInPivotModeToolPanel(column) { + const colId = column.getColId(); + const columnState = this.state.columnState?.patches.get(colId); + let rowGroupActive; + if (columnState?.rowGroup !== void 0) { + rowGroupActive = !!columnState.rowGroup; + } else if (this.state.rowGroup) { + rowGroupActive = this.state.rowGroup.colIds.includes(colId); + } else { + rowGroupActive = column.isRowGroupActive(); + } + let pivotActive; + if (columnState?.pivot !== void 0) { + pivotActive = !!columnState.pivot; + } else if (this.state.pivot) { + pivotActive = this.state.pivot.colIds.includes(colId); + } else { + pivotActive = column.isPivotActive(); + } + let valueActive; + if (columnState?.aggFunc !== void 0) { + valueActive = columnState.aggFunc != null; + } else if (this.state.aggregation) { + valueActive = this.state.aggregation.colIds.includes(colId); + } else { + valueActive = column.isValueActive(); + } + return rowGroupActive || pivotActive || valueActive; + } + setPivotColumns(columns, eventType) { + clearDeferredFunctionPatches(this.state, "pivot"); + const seq = nextSeq(this.sequence); + this.sequence = seq; + this.state.pivot = { + colIds: columns.map((column) => column.getColId()), + eventType, + seq + }; + } + setPivotMode(pivotMode, eventType) { + const seq = nextSeq(this.sequence); + this.sequence = seq; + this.state.pivotMode = { + pivotMode, + eventType, + seq + }; + } + getRowGroupColumns() { + return getDraftColumns( + this.beans, + getDraftFunctionColumnIds( + this.state.rowGroup?.colIds, + this.beans.rowGroupColsSvc?.columns, + this.state.columnState?.patches, + (patch) => patch.rowGroup == null ? void 0 : !!patch.rowGroup + ) + ); + } + getPrimaryColumns() { + return getDraftColumns(this.beans, this.state.columnOrder?.colIds ?? getPrimaryColumnIds(this.beans)); + } + hasDeferredColumnOrder() { + return !!this.state.columnOrder; + } + getValueColumns() { + return getDraftColumns( + this.beans, + getDraftFunctionColumnIds( + this.state.aggregation?.colIds, + this.beans.valueColsSvc?.columns, + this.state.columnState?.patches, + (patch) => patch.aggFunc === void 0 ? void 0 : patch.aggFunc != null + ) + ); + } + getPivotColumns() { + if (!this.getPivotMode()) { + return []; + } + const livePivotColumns = this.beans.pivotColsSvc?.columns; + const fallbackColumns = livePivotColumns?.length ? livePivotColumns : getDraftColumns(this.beans, this.lastPivotColIds); + return getDraftColumns( + this.beans, + getDraftFunctionColumnIds( + this.state.pivot?.colIds, + fallbackColumns, + this.state.columnState?.patches, + (patch) => patch.pivot == null ? void 0 : !!patch.pivot + ) + ); + } + getPivotMode() { + return this.state.pivotMode?.pivotMode ?? this.beans.colModel.isPivotMode(); + } + getSortDef(column) { + const draftSortState = this.state.sort; + const colId = column.getColId(); + const sortDefsByColId = draftSortState?.sortDefsByColId; + if (sortDefsByColId?.has(colId)) { + return sortDefsByColId.get(colId) ?? null; + } + if (draftSortState?.baselineCleared) { + return null; + } + return column.getSortDef(); + } + progressSortFromEvent(column, event) { + const currentDraft = this.state.sort ?? { + sortDefsByColId: /* @__PURE__ */ new Map(), + baselineCleared: false, + seq: 0, + eventType: "toolPanelUi" + }; + const { sortSvc } = this.beans; + const colId = column.getColId(); + let currentSortDef; + if (currentDraft.sortDefsByColId.has(colId)) { + currentSortDef = currentDraft.sortDefsByColId.get(colId); + } else if (currentDraft.baselineCleared) { + currentSortDef = null; + } else { + currentSortDef = column.getSortDef(); + } + const nextSortDef = sortSvc?.getNextSortDirection(column, currentSortDef); + if (!nextSortDef) { + return; + } + const { gos } = this.beans; + const sortUsingCtrl = gos.get("multiSortKey") === "ctrl"; + const multiSort = sortUsingCtrl ? event.ctrlKey || event.metaKey : event.shiftKey; + const doingMultiSort = (multiSort || gos.get("alwaysMultiSort")) && !gos.get("suppressMultiSort"); + if (!doingMultiSort) { + currentDraft.sortDefsByColId.clear(); + currentDraft.baselineCleared = true; + } + currentDraft.sortDefsByColId.set(colId, nextSortDef.direction ? nextSortDef : null); + currentDraft.seq = nextSeq(this.sequence); + this.sequence = currentDraft.seq; + this.state.sort = currentDraft; + } +}; +function getDraftColumns(beans, colIds) { + if (!colIds) { + return []; + } + return colIds.map((colId) => beans.colModel.getColDefCol(colId)).filter((column) => !!column); +} +function getDraftFunctionColumnIds(draftColIds, liveColumns, columnStatePatches, getPatchState) { + const colIds = [...draftColIds ?? liveColumns?.map((column) => column.getColId()) ?? []]; + if (!columnStatePatches?.size) { + return colIds; + } + const colIdsSet = new Set(colIds); + for (const [colId, patch] of columnStatePatches) { + const nextState = getPatchState(patch); + if (nextState === void 0) { + continue; + } + if (nextState) { + if (!colIdsSet.has(colId)) { + colIds.push(colId); + colIdsSet.add(colId); + } + continue; + } + if (!colIdsSet.has(colId)) { + continue; + } + colIdsSet.delete(colId); + const index = colIds.indexOf(colId); + if (index >= 0) { + colIds.splice(index, 1); + } + } + return colIds; +} +function syncPrimaryColDefOrderFromCurrentColumns(beans) { + const orderedPrimaryColumns = beans.colModel.getCols().filter((column) => isPrimaryColDefColumn(column)).map((column) => beans.colModel.getColDefCol(column.getColId())).filter((column) => !!column); + syncPrimaryColDefOrder(beans, orderedPrimaryColumns); +} +function syncPrimaryColDefOrder(beans, orderedPrimaryColumns) { + const colDefCols = getMutablePrimaryColDefCollection(beans); + if (!colDefCols) { + return; + } + const orderedSet = new Set(orderedPrimaryColumns); + colDefCols.list = [ + ...orderedPrimaryColumns, + ...colDefCols.list.filter((col) => isPrimaryColDefColumn(col) && !orderedSet.has(col)) + ]; +} +function getPrimaryColumnIds(beans) { + return getPrimaryColumns(beans).map((column) => column.getColId()); +} +function getPrimaryColumns(beans) { + return (beans.colModel.getColDefCols() ?? beans.colModel.getCols()).filter( + (column) => isPrimaryColDefColumn(column) + ); +} +function getMutablePrimaryColDefCollection(beans) { + const colDefCols = beans.colModel.colDefCols; + const colDefList = colDefCols?.list; + if (!Array.isArray(colDefList)) { + return void 0; + } + return colDefCols; +} +function isPrimaryColDefColumn(column) { + if (!column.isPrimary()) { + return false; + } + return !isColumnGroupAutoCol(column) && !isSpecialCol(column); +} +function nextSeq(sequence) { + return sequence + 1; +} +function mergeColumnStatePatch(state, patch) { + const columnState = ensureColumnStateDraft(state); + const existing = columnState.patches.get(patch.colId); + columnState.patches.set(patch.colId, existing ? { ...existing, ...patch } : patch); +} +function clearDeferredFunctionPatches(state, patchKey) { + const patches = state.columnState?.patches; + if (!patches?.size) { + return; + } + for (const [colId, patch] of patches) { + if (!(patchKey in patch)) { + continue; + } + const nextPatch = { ...patch }; + delete nextPatch[patchKey]; + if (Object.keys(nextPatch).length === 1) { + patches.delete(colId); + continue; + } + patches.set(colId, nextPatch); + } +} +function ensureColumnStateDraft(state) { + let { columnState } = state; + if (!columnState) { + columnState = { + patches: /* @__PURE__ */ new Map(), + seq: 0, + eventType: "toolPanelUi" + }; + state.columnState = columnState; + } + return columnState; +} +function ensureAggFuncsDraft(state) { + let { aggFuncs } = state; + if (!aggFuncs) { + aggFuncs = { + values: /* @__PURE__ */ new Map(), + seq: 0, + eventType: "toolPanelUi" + }; + state.aggFuncs = aggFuncs; + } + return aggFuncs; +} + +// packages/ag-grid-enterprise/src/columnToolPanel/updates/columnStateUpdateStrategy.ts +var ColumnStateUpdateStrategy = class extends BeanStub10 { + constructor() { + super(...arguments); + this.beanName = "columnStateUpdateStrategy"; + } + applyColumnState(deferMode, state, eventType) { + this.delegate("applyColumnState", deferMode, state, eventType); + } + commit(deferMode) { + this.delegate("commit", deferMode); + } + hasPendingChanges(deferMode) { + return this.delegate("hasPendingChanges", deferMode); + } + moveColumns(deferMode, columns, targetIndex, eventType) { + this.delegate("moveColumns", deferMode, columns, targetIndex, eventType); + } + reset(deferMode) { + this.delegate("reset", deferMode); + } + setColumnsVisible(deferMode, columns, visible, eventType) { + this.delegate("setColumnsVisible", deferMode, columns, visible, eventType); + } + isColumnVisibleInToolPanel(deferMode, column) { + return this.delegate("isColumnVisibleInToolPanel", deferMode, column); + } + setRowGroupColumns(deferMode, columns, eventType) { + this.delegate("setRowGroupColumns", deferMode, columns, eventType); + } + getRowGroupColumns(deferMode) { + return this.delegate("getRowGroupColumns", deferMode); + } + getPrimaryColumns(deferMode) { + return this.delegate("getPrimaryColumns", deferMode); + } + hasDeferredColumnOrder(deferMode) { + return this.delegate("hasDeferredColumnOrder", deferMode); + } + setValueColumns(deferMode, columns, eventType) { + this.delegate("setValueColumns", deferMode, columns, eventType); + } + getValueColumns(deferMode) { + return this.delegate("getValueColumns", deferMode); + } + setColumnAggFunc(deferMode, column, aggFunc, eventType) { + this.delegate("setColumnAggFunc", deferMode, column, aggFunc, eventType); + } + getColumnAggFunc(deferMode, column) { + return this.delegate("getColumnAggFunc", deferMode, column); + } + setPivotColumns(deferMode, columns, eventType) { + this.delegate("setPivotColumns", deferMode, columns, eventType); + } + getPivotColumns(deferMode) { + return this.delegate("getPivotColumns", deferMode); + } + setPivotMode(deferMode, pivotMode, eventType) { + this.delegate("setPivotMode", deferMode, pivotMode, eventType); + } + getPivotMode(deferMode) { + return this.delegate("getPivotMode", deferMode); + } + isColumnSelectedInPivotModeToolPanel(deferMode, column) { + return this.delegate("isColumnSelectedInPivotModeToolPanel", deferMode, column); + } + progressSortFromEvent(deferMode, column, event) { + this.delegate("progressSortFromEvent", deferMode, column, event); + } + getSortDef(deferMode, column) { + return this.delegate("getSortDef", deferMode, column); + } + getUpdateStrategy() { + return this.executionStrategy ?? (this.executionStrategy = this.createManagedBean(new ColumnStateUpdateExecutionStrategy())); + } + delegate(method, ...args) { + const strategy = this.getUpdateStrategy(); + const fn = strategy[method].bind(strategy); + return fn(...args); + } +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/updates/columnStateUpdateStrategyModule.ts +var SharedColumnStateUpdateStrategyModule = { + moduleName: "SharedColumnStateUpdateStrategy", + version: VERSION, + beans: [ColumnStateUpdateStrategy], + dependsOn: [EnterpriseCoreModule] +}; + +// packages/ag-grid-enterprise/src/columnToolPanel/columnsToolPanelModule.ts +var ColumnsToolPanelModule = { + moduleName: "ColumnsToolPanel", + version: VERSION, + beans: [ColumnToolPanelFactory], + userComponents: { agColumnsToolPanel: ColumnToolPanel }, + icons: { + ensureColumnVisible: "column-arrow", + // column tool panel tab + columnsToolPanel: "columns", + // "Group by {column-name}" item in column header menu + menuAddRowGroup: "group", + // "Un-Group by {column-name}" item in column header menu + menuRemoveRowGroup: "group", + // identifies the pivot drop zone + pivotPanel: "pivot", + // "Row groups" drop zone in column tool panel + rowGroupPanel: "group", + // columns tool panel Values drop zone + valuePanel: "aggregation", + // column tool panel column group contracted (click to expand) + columnSelectClosed: "tree-closed", + // column tool panel column group expanded (click to contract) + columnSelectOpen: "tree-open", + // column tool panel header expand/collapse all button, shown when some children are expanded and + // others are collapsed + columnSelectIndeterminate: "tree-indeterminate" + }, + dependsOn: [ + EnterpriseCoreModule, + SharedColumnStateUpdateStrategyModule, + SideBarModule, + _ColumnMoveModule, + _SharedDragAndDropModule2, + _PopupModule2, + MenuItemModule + ] +}; + +// packages/ag-grid-enterprise/src/menu/menuModule.ts +import { _ColumnMoveModule as _ColumnMoveModule2, _PopupModule as _PopupModule3, _SharedDragAndDropModule as _SharedDragAndDropModule3, _SharedMenuModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/menu/chartMenuItemMapper.ts +import { BeanStub as BeanStub11, _createIconNoSpan as _createIconNoSpan15, _warn as _warn13 } from "ag-grid-community"; +var ChartMenuItemMapper = class extends BeanStub11 { + constructor() { + super(...arguments); + this.beanName = "chartMenuItemMapper"; + } + getChartItems(key) { + const beans = this.beans; + const chartSvc = beans.chartSvc; + const isPivot = key === "pivotChart"; + if (!chartSvc) { + return null; + } + const getLocaleTextFunc = this.getLocaleTextFunc.bind(this); + const builder = isPivot ? new PivotMenuItemMapper(beans, chartSvc, getLocaleTextFunc) : new RangeMenuItemMapper(beans, chartSvc, getLocaleTextFunc); + const isEnterprise = chartSvc.isEnterprise(); + let topLevelMenuItem = builder.getMenuItem(); + if (topLevelMenuItem?.subMenu && !isEnterprise) { + const filterEnterpriseItems = (m) => ({ + ...m, + subMenu: m.subMenu?.filter((menu) => !menu._enterprise).map((menu) => filterEnterpriseItems(menu)) + }); + topLevelMenuItem = filterEnterpriseItems(topLevelMenuItem); + } + const chartGroupsDef = this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef; + if (chartGroupsDef) { + topLevelMenuItem = this.filterAndOrderChartMenu( + topLevelMenuItem, + chartGroupsDef, + builder.getConfigLookup() + ); + } + return this.cleanInternals(topLevelMenuItem); + } + // Remove our internal _key and _enterprise properties so this does not leak out of the class on the menu items. + cleanInternals(menuItem) { + if (!menuItem) { + return menuItem; + } + const removeKeys = (m) => { + delete m?._key; + delete m?._enterprise; + for (const s2 of m?.subMenu ?? []) { + removeKeys(s2); + } + return m; + }; + return removeKeys(menuItem); + } + buildLookup(menuItem) { + const itemLookup = {}; + const addItem = (item) => { + itemLookup[item._key] = item; + if (item.subMenu) { + for (const s2 of item.subMenu) { + addItem(s2); + } + } + }; + addItem(menuItem); + return itemLookup; + } + /** + * Make the MenuItem match the charts provided and their ordering on the ChartGroupsDef config object as provided by the user. + */ + filterAndOrderChartMenu(topLevelMenuItem, chartGroupsDef, configLookup) { + const menuItemLookup = this.buildLookup(topLevelMenuItem); + const orderedAndFiltered = { ...topLevelMenuItem, subMenu: [] }; + for (const group of Object.keys(chartGroupsDef)) { + const chartTypes = chartGroupsDef[group]; + const chartConfigGroup = configLookup[group]; + if (chartConfigGroup === null) { + continue; + } + if (chartConfigGroup == void 0) { + _warn13(173, { group }); + continue; + } + const menuItem = menuItemLookup[chartConfigGroup._key]; + if (menuItem) { + if (menuItem.subMenu) { + const subMenus = chartTypes.map((chartType) => { + const itemKey = chartConfigGroup[chartType]; + if (itemKey == void 0) { + _warn13(174, { group, chartType }); + return void 0; + } + return menuItemLookup[itemKey]; + }).filter((s2) => s2 !== void 0); + if (subMenus.length > 0) { + menuItem.subMenu = subMenus; + orderedAndFiltered.subMenu?.push(menuItem); + } + } else { + orderedAndFiltered.subMenu?.push(menuItem); + } + } + } + if (orderedAndFiltered.subMenu?.length == 0) { + return null; + } + return orderedAndFiltered; + } +}; +var PivotMenuItemMapper = class { + constructor(beans, chartSvc, getLocaleTextFunc) { + this.beans = beans; + this.chartSvc = chartSvc; + this.getLocaleTextFunc = getLocaleTextFunc; + } + getMenuItem() { + const localeTextFunc = this.getLocaleTextFunc(); + const getMenuItem = (localeKey, defaultText, chartType, key, enterprise = false) => { + return { + // will have a LRM character appended to ensure correct display in RTL languages + name: localeTextFunc(localeKey, defaultText + "\u200E"), + action: () => this.chartSvc.createPivotChart({ chartType }), + _key: key, + _enterprise: enterprise + }; + }; + return { + name: localeTextFunc("pivotChart", "Pivot Chart"), + _key: "pivotChart", + subMenu: [ + { + _key: "pivotColumnChart", + name: localeTextFunc("columnChart", "Column"), + subMenu: [ + getMenuItem("groupedColumn", "Grouped", "groupedColumn", "pivotGroupedColumn"), + getMenuItem("stackedColumn", "Stacked", "stackedColumn", "pivotStackedColumn"), + getMenuItem("normalizedColumn", "100% Stacked", "normalizedColumn", "pivotNormalizedColumn") + ] + }, + { + _key: "pivotBarChart", + name: localeTextFunc("barChart", "Bar"), + subMenu: [ + getMenuItem("groupedBar", "Grouped", "groupedBar", "pivotGroupedBar"), + getMenuItem("stackedBar", "Stacked", "stackedBar", "pivotStackedBar"), + getMenuItem("normalizedBar", "100% Stacked", "normalizedBar", "pivotNormalizedBar") + ] + }, + { + _key: "pivotPieChart", + name: localeTextFunc("pieChart", "Pie"), + subMenu: [ + getMenuItem("pie", "Pie", "pie", "pivotPie"), + getMenuItem("donut", "Donut", "donut", "pivotDonut") + ] + }, + { + _key: "pivotLineChart", + name: localeTextFunc("lineChart", "Line"), + subMenu: [ + getMenuItem("lineChart", "Line", "line", "pivotLineChart"), + getMenuItem("stackedLine", "Stacked", "stackedLine", "pivotStackedLine"), + getMenuItem("normalizedLine", "100% Stacked", "normalizedLine", "pivotNormalizedLine") + ] + }, + { + _key: "pivotAreaChart", + name: localeTextFunc("areaChart", "Area"), + subMenu: [ + getMenuItem("areaChart", "Area", "area", "pivotArea"), + getMenuItem("stackedArea", "Stacked", "stackedArea", "pivotStackedArea"), + getMenuItem("normalizedArea", "100% Stacked", "normalizedArea", "pivotNormalizedArea") + ] + }, + { + _key: "pivotXYChart", + name: localeTextFunc("xyChart", "X Y (Scatter)"), + subMenu: [ + getMenuItem("scatter", "Scatter", "scatter", "pivotScatter"), + getMenuItem("bubble", "Bubble", "bubble", "pivotBubble") + ] + }, + { + _key: "pivotStatisticalChart", + _enterprise: false, + // histogram chart is available in both community and enterprise distributions + name: localeTextFunc("statisticalChart", "Statistical"), + subMenu: [getMenuItem("histogramChart", "Histogram", "histogram", "pivotHistogram", false)] + }, + { + _key: "pivotHierarchicalChart", + _enterprise: true, + name: localeTextFunc("hierarchicalChart", "Hierarchical"), + subMenu: [ + getMenuItem("treemapChart", "Treemap", "treemap", "pivotTreemap", true), + getMenuItem("sunburstChart", "Sunburst", "sunburst", "pivotSunburst", true) + ] + }, + { + _key: "pivotFunnel", + name: localeTextFunc("funnel", "Funnel"), + subMenu: [ + getMenuItem("funnel", "Funnel", "funnel", "pivotFunnel"), + getMenuItem("coneFunnel", "Cone Funnel", "coneFunnel", "pivotConeFunnel"), + getMenuItem("pyramid", "Pyramid", "pyramid", "pivotPyramid") + ] + }, + { + _key: "pivotCombinationChart", + name: localeTextFunc("combinationChart", "Combination"), + subMenu: [ + getMenuItem("columnLineCombo", "Column & Line", "columnLineCombo", "pivotColumnLineCombo"), + getMenuItem("AreaColumnCombo", "Area & Column", "areaColumnCombo", "pivotAreaColumnCombo") + ] + } + ], + icon: _createIconNoSpan15("chart", this.beans, void 0) + }; + } + getConfigLookup() { + return { + columnGroup: { + _key: "pivotColumnChart", + column: "pivotGroupedColumn", + stackedColumn: "pivotStackedColumn", + normalizedColumn: "pivotNormalizedColumn" + }, + barGroup: { + _key: "pivotBarChart", + bar: "pivotGroupedBar", + stackedBar: "pivotStackedBar", + normalizedBar: "pivotNormalizedBar" + }, + pieGroup: { + _key: "pivotPieChart", + pie: "pivotPie", + donut: "pivotDonut", + doughnut: "pivotDonut" + }, + lineGroup: { + _key: "pivotLineChart", + line: "pivotLineChart", + stackedLine: "pivotStackedLine", + normalizedLine: "pivotNormalizedLine" + }, + areaGroup: { + _key: "pivotAreaChart", + area: "pivotArea", + stackedArea: "pivotStackedArea", + normalizedArea: "pivotNormalizedArea" + }, + scatterGroup: { + _key: "pivotXYChart", + bubble: "pivotBubble", + scatter: "pivotScatter" + }, + combinationGroup: { + _key: "pivotCombinationChart", + columnLineCombo: "pivotColumnLineCombo", + areaColumnCombo: "pivotAreaColumnCombo", + customCombo: null + // Not currently supported + }, + hierarchicalGroup: { + _key: "pivotHierarchicalChart", + treemap: "pivotTreemap", + sunburst: "pivotSunburst" + }, + statisticalGroup: { + _key: "pivotStatisticalChart", + histogram: "pivotHistogram", + // Some statistical charts do not currently support pivot mode + rangeBar: null, + rangeArea: null, + boxPlot: null + }, + funnelGroup: { + _key: "pivotFunnel", + funnel: "pivotFunnel", + coneFunnel: "pivotConeFunnel", + pyramid: "pivotPyramid" + }, + // Polar charts do not support pivot mode + polarGroup: null, + // Specialized charts do not currently support pivot mode + specializedGroup: null + }; + } +}; +var RangeMenuItemMapper = class { + constructor(beans, chartSvc, getLocaleTextFunc) { + this.beans = beans; + this.chartSvc = chartSvc; + this.getLocaleTextFunc = getLocaleTextFunc; + } + getMenuItem() { + const localeTextFunc = this.getLocaleTextFunc(); + const getMenuItem = (localeKey, defaultText, chartType, key, enterprise = false) => { + return { + name: localeTextFunc(localeKey, defaultText), + action: () => this.chartSvc.createChartFromCurrentRange(chartType), + _key: key, + _enterprise: enterprise + }; + }; + return { + name: localeTextFunc("chartRange", "Chart Range"), + _key: "chartRange", + subMenu: [ + { + name: localeTextFunc("columnChart", "Column"), + subMenu: [ + getMenuItem("groupedColumn", "Grouped", "groupedColumn", "rangeGroupedColumn"), + getMenuItem("stackedColumn", "Stacked", "stackedColumn", "rangeStackedColumn"), + getMenuItem("normalizedColumn", "100% Stacked", "normalizedColumn", "rangeNormalizedColumn") + ], + _key: "rangeColumnChart" + }, + { + name: localeTextFunc("barChart", "Bar"), + subMenu: [ + getMenuItem("groupedBar", "Grouped", "groupedBar", "rangeGroupedBar"), + getMenuItem("stackedBar", "Stacked", "stackedBar", "rangeStackedBar"), + getMenuItem("normalizedBar", "100% Stacked", "normalizedBar", "rangeNormalizedBar") + ], + _key: "rangeBarChart" + }, + { + name: localeTextFunc("pieChart", "Pie"), + subMenu: [ + getMenuItem("pie", "Pie", "pie", "rangePie"), + getMenuItem("donut", "Donut", "donut", "rangeDonut") + ], + _key: "rangePieChart" + }, + { + name: localeTextFunc("lineChart", "Line"), + subMenu: [ + getMenuItem("lineChart", "Line", "line", "rangeLineChart"), + getMenuItem("stackedLine", "Stacked", "stackedLine", "rangeStackedLine"), + getMenuItem("normalizedLine", "100% Stacked", "normalizedLine", "rangeNormalizedLine") + ], + _key: "rangeLineChart" + }, + { + name: localeTextFunc("areaChart", "Area"), + subMenu: [ + getMenuItem("areaChart", "Area", "area", "rangeArea"), + getMenuItem("stackedArea", "Stacked", "stackedArea", "rangeStackedArea"), + getMenuItem("normalizedArea", "100% Stacked", "normalizedArea", "rangeNormalizedArea") + ], + _key: "rangeAreaChart" + }, + { + name: localeTextFunc("xyChart", "X Y (Scatter)"), + subMenu: [ + getMenuItem("scatter", "Scatter", "scatter", "rangeScatter"), + getMenuItem("bubble", "Bubble", "bubble", "rangeBubble") + ], + _key: "rangeXYChart" + }, + { + name: localeTextFunc("polarChart", "Polar"), + subMenu: [ + getMenuItem("radarLine", "Radar Line", "radarLine", "rangeRadarLine"), + getMenuItem("radarArea", "Radar Area", "radarArea", "rangeRadarArea"), + getMenuItem("nightingale", "Nightingale", "nightingale", "rangeNightingale"), + getMenuItem("radialColumn", "Radial Column", "radialColumn", "rangeRadialColumn"), + getMenuItem("radialBar", "Radial Bar", "radialBar", "rangeRadialBar") + ], + _key: "rangePolarChart", + _enterprise: true + }, + { + name: localeTextFunc("statisticalChart", "Statistical"), + subMenu: [ + getMenuItem("boxPlot", "Box Plot", "boxPlot", "rangeBoxPlot", true), + getMenuItem("histogramChart", "Histogram", "histogram", "rangeHistogram", false), + getMenuItem("rangeBar", "Range Bar", "rangeBar", "rangeRangeBar", true), + getMenuItem("rangeArea", "Range Area", "rangeArea", "rangeRangeArea", true) + ], + _key: "rangeStatisticalChart", + _enterprise: false + // histogram chart is available in both community and enterprise distributions + }, + { + name: localeTextFunc("hierarchicalChart", "Hierarchical"), + subMenu: [ + getMenuItem("treemap", "Treemap", "treemap", "rangeTreemap"), + getMenuItem("sunburst", "Sunburst", "sunburst", "rangeSunburst") + ], + _key: "rangeHierarchicalChart", + _enterprise: true + }, + { + name: localeTextFunc("specializedChart", "Specialized"), + subMenu: [ + getMenuItem("heatmap", "Heatmap", "heatmap", "rangeHeatmap"), + getMenuItem("waterfall", "Waterfall", "waterfall", "rangeWaterfall") + ], + _key: "rangeSpecializedChart", + _enterprise: true + }, + { + name: localeTextFunc("funnel", "Funnel"), + subMenu: [ + getMenuItem("funnel", "Funnel", "funnel", "rangeFunnel"), + getMenuItem("coneFunnel", "Cone Funnel", "coneFunnel", "rangeConeFunnel"), + getMenuItem("pyramid", "Pyramid", "pyramid", "rangePyramid") + ], + _key: "rangeFunnel", + _enterprise: true + }, + { + name: localeTextFunc("combinationChart", "Combination"), + subMenu: [ + getMenuItem("columnLineCombo", "Column & Line", "columnLineCombo", "rangeColumnLineCombo"), + getMenuItem("AreaColumnCombo", "Area & Column", "areaColumnCombo", "rangeAreaColumnCombo") + ], + _key: "rangeCombinationChart" + } + ], + icon: _createIconNoSpan15("chart", this.beans, void 0) + }; + } + getConfigLookup() { + return { + columnGroup: { + _key: "rangeColumnChart", + column: "rangeGroupedColumn", + stackedColumn: "rangeStackedColumn", + normalizedColumn: "rangeNormalizedColumn" + }, + barGroup: { + _key: "rangeBarChart", + bar: "rangeGroupedBar", + stackedBar: "rangeStackedBar", + normalizedBar: "rangeNormalizedBar" + }, + pieGroup: { + _key: "rangePieChart", + pie: "rangePie", + donut: "rangeDonut", + doughnut: "rangeDonut" + }, + lineGroup: { + _key: "rangeLineChart", + line: "rangeLineChart", + stackedLine: "rangeStackedLine", + normalizedLine: "rangeNormalizedLine" + }, + areaGroup: { + _key: "rangeAreaChart", + area: "rangeArea", + stackedArea: "rangeStackedArea", + normalizedArea: "rangeNormalizedArea" + }, + scatterGroup: { + _key: "rangeXYChart", + bubble: "rangeBubble", + scatter: "rangeScatter" + }, + polarGroup: { + _key: "rangePolarChart", + radarLine: "rangeRadarLine", + radarArea: "rangeRadarArea", + nightingale: "rangeNightingale", + radialColumn: "rangeRadialColumn", + radialBar: "rangeRadialBar" + }, + statisticalGroup: { + _key: "rangeStatisticalChart", + boxPlot: "rangeBoxPlot", + histogram: "rangeHistogram", + rangeBar: "rangeRangeBar", + rangeArea: "rangeRangeArea" + }, + hierarchicalGroup: { + _key: "rangeHierarchicalChart", + treemap: "rangeTreemap", + sunburst: "rangeSunburst" + }, + specializedGroup: { + _key: "rangeSpecializedChart", + heatmap: "rangeHeatmap", + waterfall: "rangeWaterfall" + }, + funnelGroup: { + _key: "rangeFunnel", + funnel: "rangeFunnel", + coneFunnel: "rangeConeFunnel", + pyramid: "rangePyramid" + }, + combinationGroup: { + _key: "rangeCombinationChart", + columnLineCombo: "rangeColumnLineCombo", + areaColumnCombo: "rangeAreaColumnCombo", + customCombo: null + // Not currently supported + } + }; + } +}; + +// packages/ag-grid-enterprise/src/menu/columnChooserFactory.ts +import { BeanStub as BeanStub12, _addGridCommonParams as _addGridCommonParams8, _findNextFocusableElement as _findNextFocusableElement7 } from "ag-grid-community"; +var ColumnChooserFactory = class extends BeanStub12 { + constructor() { + super(...arguments); + this.beanName = "colChooserFactory"; + } + createColumnSelectPanel(parent, column, draggable, params) { + const columnSelectPanel = parent.createManagedBean(new AgPrimaryCols()); + const columnChooserParams = params ?? column?.getColDef().columnChooserParams ?? {}; + const { + contractColumnSelection, + suppressColumnExpandAll, + suppressColumnFilter, + suppressColumnSelectAll, + suppressSyncLayoutWithGrid, + columnLayout + } = columnChooserParams; + columnSelectPanel.init( + !!draggable, + _addGridCommonParams8(this.gos, { + suppressColumnMove: false, + suppressValues: false, + suppressPivots: false, + suppressRowGroups: false, + suppressPivotMode: false, + contractColumnSelection: !!contractColumnSelection, + suppressColumnExpandAll: !!suppressColumnExpandAll, + suppressColumnFilter: !!suppressColumnFilter, + suppressColumnSelectAll: !!suppressColumnSelectAll, + suppressSyncLayoutWithGrid: !!columnLayout || !!suppressSyncLayoutWithGrid, + onStateUpdated: () => { + } + }), + "columnMenu" + ); + if (columnLayout) { + columnSelectPanel.setColumnLayout(columnLayout); + } + return columnSelectPanel; + } + showColumnChooser({ + column, + chooserParams, + eventSource, + headerPosition: providedHeaderPosition + }) { + this.hideActiveColumnChooser(); + const columnSelectPanel = this.createColumnSelectPanel(this, column, true, chooserParams); + const translate = this.getLocaleTextFunc(); + const beans = this.beans; + const { visibleCols, focusSvc, menuUtils } = beans; + const columnIndex = visibleCols.allCols.indexOf(column); + const headerPosition = column ? focusSvc.focusedHeader ?? providedHeaderPosition ?? null : null; + this.activeColumnChooserDialog = this.createBean( + new Dialog({ + title: translate("chooseColumns", "Choose Columns"), + component: columnSelectPanel, + width: 300, + height: 300, + resizable: true, + movable: true, + centered: true, + closable: true, + afterGuiAttached: () => { + _findNextFocusableElement7(beans, columnSelectPanel.getGui())?.focus({ + preventScroll: true + }); + this.dispatchVisibleChangedEvent(true, column); + }, + closedCallback: (event) => { + const eComp = this.activeColumnChooser.getGui(); + this.destroyBean(this.activeColumnChooser); + this.activeColumnChooser = void 0; + this.activeColumnChooserDialog = void 0; + this.dispatchVisibleChangedEvent(false, column); + if (column) { + menuUtils.restoreFocusOnClose( + { column, headerPosition, columnIndex, eventSource }, + eComp, + event, + true + ); + } + }, + postProcessPopupParams: { + type: "columnChooser", + column, + eventSource + } + }) + ); + this.activeColumnChooser = columnSelectPanel; + } + hideActiveColumnChooser() { + this.destroyBean(this.activeColumnChooserDialog); + } + dispatchVisibleChangedEvent(visible, column) { + this.eventSvc.dispatchEvent({ + type: "columnMenuVisibleChanged", + visible, + switchingTab: false, + key: "columnChooser", + column: column ?? null + }); + } +}; + +// packages/ag-grid-enterprise/src/menu/columnMenuFactory.ts +import { + BeanStub as BeanStub14, + _addGridCommonParams as _addGridCommonParams9, + _getDisplaySortForColumn, + _getGrandTotalRow, + _isClientSideRowModel as _isClientSideRowModel2, + _isLegacyMenuEnabled +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/menu/menuItemMapper.ts +import { + BeanStub as BeanStub13, + _createIconNoSpan as _createIconNoSpan16, + _exists as _exists13, + _getRowNode, + _normalizeSortType, + _resetColumnState, + _warn as _warn14 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/menu/menuItemValidations.ts +var MENU_ITEM_MODULES = { + pinSubMenu: "PinnedColumn", + pinLeft: "PinnedColumn", + pinRight: "PinnedColumn", + clearPinned: "PinnedColumn", + pinRowSubMenu: "PinnedRow", + pinBottom: "PinnedRow", + pinTop: "PinnedRow", + unpinRow: "PinnedRow", + valueAggSubMenu: "SharedAggregation", + autoSizeThis: "ColumnAutoSize", + autoSizeAll: "ColumnAutoSize", + rowGroup: "SharedRowGrouping", + rowUnGroup: "SharedRowGrouping", + resetColumns: "CommunityCore", + expandAll: ["ClientSideRowModelHierarchy", "ServerSideRowModel"], + contractAll: ["ClientSideRowModelHierarchy", "ServerSideRowModel"], + copy: "Clipboard", + copyWithHeaders: "Clipboard", + copyWithGroupHeaders: "Clipboard", + cut: "Clipboard", + paste: "Clipboard", + export: ["CsvExport", "ExcelExport"], + csvExport: "CsvExport", + excelExport: "ExcelExport", + separator: "CommunityCore", + pivotChart: "IntegratedCharts", + chartRange: "IntegratedCharts", + columnFilter: "ColumnFilter", + columnChooser: "ColumnMenu", + sortAscending: "Sort", + sortDescending: "Sort", + sortAbsoluteAscending: "Sort", + sortAbsoluteDescending: "Sort", + sortUnSort: "Sort" +}; +function validateMenuItem(gos, key) { + const moduleName4 = MENU_ITEM_MODULES[key]; + if (moduleName4) { + gos.assertModuleRegistered(moduleName4, `menu item '${key}'`); + } +} + +// packages/ag-grid-enterprise/src/menu/menuItemMapper.ts +var MENU_ITEM_SEPARATOR = "separator"; +function _removeRepeatsFromArray(array, object) { + if (!array) { + return; + } + for (let index = array.length - 2; index >= 0; index--) { + const thisOneMatches = array[index] === object; + const nextOneMatches = array[index + 1] === object; + if (thisOneMatches && nextOneMatches) { + array.splice(index + 1, 1); + } + } +} +var SORT_MENU_ITEM_TO_MENU_ACTION_PARAMS = { + sortAscending: { fallback: "Sort Ascending", getSortDef: () => ({ type: "default", direction: "asc" }) }, + sortDescending: { + fallback: "Sort Descending", + getSortDef: () => ({ type: "default", direction: "desc" }) + }, + sortAbsoluteAscending: { + fallback: "Sort Absolute Ascending", + getSortDef: () => ({ type: "absolute", direction: "asc" }) + }, + sortAbsoluteDescending: { + fallback: "Sort Absolute Descending", + getSortDef: () => ({ type: "absolute", direction: "desc" }) + }, + sortUnSort: { + fallback: "Clear Sort", + getSortDef: (column) => ({ type: _normalizeSortType(column.getSortDef()?.type), direction: null }) + } +}; +var MenuItemMapper = class extends BeanStub13 { + constructor() { + super(...arguments); + this.beanName = "menuItemMapper"; + } + mapWithStockItems(originalList, column, node, sourceElement, source) { + if (!originalList) { + return []; + } + const resultList = []; + const localeTextFunc = this.getLocaleTextFunc(); + const { beans, gos } = this; + const { + pinnedCols, + colAutosize, + aggFuncSvc, + rowGroupColsSvc, + colNames, + colModel, + clipboardSvc, + expansionSvc, + focusSvc, + csvCreator, + excelCreator, + menuSvc, + colChooserFactory, + sortSvc, + chartMenuItemMapper, + valueColsSvc, + pinnedRowModel + } = beans; + const getStockMenuItem = (key, column2, sourceElement2, source2) => { + validateMenuItem(gos, key); + switch (key) { + case "pinSubMenu": + return pinnedCols && column2 ? { + name: localeTextFunc("pinColumn", "Pin Column"), + icon: _createIconNoSpan16("menuPin", beans, null), + subMenu: ["clearPinned", "pinLeft", "pinRight"] + } : null; + case "pinLeft": + return pinnedCols && column2 ? { + name: localeTextFunc("pinLeft", "Pin Left"), + action: () => pinnedCols.setColsPinned([column2], "left", source2), + checked: !!column2 && column2.isPinnedLeft() + } : null; + case "pinRight": + return pinnedCols && column2 ? { + name: localeTextFunc("pinRight", "Pin Right"), + action: () => pinnedCols.setColsPinned([column2], "right", source2), + checked: !!column2 && column2.isPinnedRight() + } : null; + case "clearPinned": + return pinnedCols && column2 ? { + name: localeTextFunc("noPin", "No Pin"), + action: () => pinnedCols.setColsPinned([column2], null, source2), + checked: !!column2 && !column2.isPinned() + } : null; + case "pinRowSubMenu": { + const enableRowPinning = gos.get("enableRowPinning"); + const subMenu = []; + const pinned = node?.rowPinned ?? node?.pinnedSibling?.rowPinned; + if (pinned) { + subMenu.push("unpinRow"); + } + if (enableRowPinning && enableRowPinning !== "bottom" && pinned != "top") { + subMenu.push("pinTop"); + } + if (enableRowPinning && enableRowPinning !== "top" && pinned != "bottom") { + subMenu.push("pinBottom"); + } + return pinnedRowModel?.isManual() ? { + name: localeTextFunc("pinRow", "Pin Row"), + icon: _createIconNoSpan16("rowPin", beans, column2), + subMenu + } : null; + } + case "pinTop": + return pinnedRowModel?.isManual() ? { + name: localeTextFunc("pinTop", "Pin to Top"), + icon: _createIconNoSpan16("rowPinTop", beans, column2), + action: ({ node: node2, column: column3 }) => node2 && pinnedRowModel.pinRow(node2, "top", column3) + } : null; + case "pinBottom": + return pinnedRowModel?.isManual() ? { + name: localeTextFunc("pinBottom", "Pin to Bottom"), + icon: _createIconNoSpan16("rowPinBottom", beans, column2), + action: ({ node: node2, column: column3 }) => node2 && pinnedRowModel.pinRow(node2, "bottom", column3) + } : null; + case "unpinRow": + return pinnedRowModel?.isManual() ? { + name: localeTextFunc("unpinRow", "Unpin Row"), + icon: _createIconNoSpan16("rowUnpin", beans, column2), + action: ({ node: node2, column: column3 }) => node2 && pinnedRowModel.pinRow(node2, null, column3) + } : null; + case "valueAggSubMenu": + if (aggFuncSvc && valueColsSvc && (column2?.isPrimary() || column2?.getColDef().pivotValueColumn)) { + return { + name: localeTextFunc("valueAggregation", "Value Aggregation"), + icon: _createIconNoSpan16("menuValue", beans, null), + subMenu: createAggregationSubMenu(column2, aggFuncSvc, valueColsSvc, localeTextFunc), + disabled: gos.get("functionsReadOnly") + }; + } else { + return null; + } + case "autoSizeThis": + return colAutosize ? { + name: localeTextFunc("autosizeThisColumn", "Autosize This Column"), + action: () => column2 && colAutosize.autoSizeColumn(column2, source2, gos.get("skipHeaderOnAutoSize")) + } : null; + case "autoSizeAll": + return colAutosize ? { + name: localeTextFunc("autosizeAllColumns", "Autosize All Columns"), + action: () => colAutosize.autoSizeAllColumns({ + source: source2, + skipHeader: gos.get("skipHeaderOnAutoSize") + }) + } : null; + case "rowGroup": + return rowGroupColsSvc ? { + name: getGroupingLocaleText( + localeTextFunc, + "groupBy", + colNames.getDisplayNameForColumn(column2, "header") + ), + disabled: gos.get("functionsReadOnly") || column2?.isRowGroupActive() || !column2?.getColDef().enableRowGroup, + action: () => rowGroupColsSvc.addColumns([column2], source2), + icon: _createIconNoSpan16("menuAddRowGroup", beans, null) + } : null; + case "rowUnGroup": { + if (rowGroupColsSvc && gos.isModuleRegistered("SharedRowGrouping")) { + const showRowGroup = column2?.getColDef().showRowGroup; + const lockedGroups = gos.get("groupLockGroupColumns"); + let name; + let disabled; + let action; + if (showRowGroup === true) { + name = localeTextFunc("ungroupAll", "Un-Group All"); + disabled = gos.get("functionsReadOnly") || lockedGroups === -1 || lockedGroups >= (rowGroupColsSvc.columns.length ?? 0); + action = () => rowGroupColsSvc.setColumns(rowGroupColsSvc.columns.slice(0, lockedGroups), source2); + } else if (typeof showRowGroup === "string") { + const underlyingColumn = colModel.getColDefCol(showRowGroup); + const ungroupByName = underlyingColumn != null ? colNames.getDisplayNameForColumn(underlyingColumn, "header") : showRowGroup; + name = getGroupingLocaleText(localeTextFunc, "ungroupBy", ungroupByName); + disabled = gos.get("functionsReadOnly") || isRowGroupColLocked(underlyingColumn, beans); + action = () => { + rowGroupColsSvc.removeColumns([showRowGroup], source2); + }; + } else { + name = getGroupingLocaleText( + localeTextFunc, + "ungroupBy", + colNames.getDisplayNameForColumn(column2, "header") + ); + disabled = gos.get("functionsReadOnly") || !column2?.isRowGroupActive() || !column2?.getColDef().enableRowGroup || isRowGroupColLocked(column2, beans); + action = () => rowGroupColsSvc.removeColumns([column2], source2); + } + return { + name, + disabled, + action, + icon: _createIconNoSpan16("menuRemoveRowGroup", beans, null) + }; + } else { + return null; + } + } + case "resetColumns": + return { + name: localeTextFunc("resetColumns", "Reset Columns"), + action: () => _resetColumnState(beans, source2) + }; + case "expandAll": + return expansionSvc ? { + name: localeTextFunc("expandAll", "Expand All Row Groups"), + action: () => expansionSvc.expandAll(true) + } : null; + case "contractAll": + return expansionSvc ? { + name: localeTextFunc("collapseAll", "Collapse All Row Groups"), + action: () => expansionSvc.expandAll(false) + } : null; + case "copy": + return clipboardSvc ? { + name: localeTextFunc("copy", "Copy"), + shortcut: localeTextFunc("ctrlC", "Ctrl+C"), + icon: _createIconNoSpan16("clipboardCopy", beans, null), + action: () => clipboardSvc.copyToClipboard() + } : null; + case "copyWithHeaders": + return clipboardSvc ? { + name: localeTextFunc("copyWithHeaders", "Copy with Headers"), + // shortcut: localeTextFunc('ctrlC','Ctrl+C'), + icon: _createIconNoSpan16("clipboardCopy", beans, null), + action: () => clipboardSvc.copyToClipboard({ includeHeaders: true }) + } : null; + case "copyWithGroupHeaders": + return clipboardSvc ? { + name: localeTextFunc("copyWithGroupHeaders", "Copy with Group Headers"), + // shortcut: localeTextFunc('ctrlC','Ctrl+C'), + icon: _createIconNoSpan16("clipboardCopy", beans, null), + action: () => clipboardSvc.copyToClipboard({ includeHeaders: true, includeGroupHeaders: true }) + } : null; + case "cut": + if (clipboardSvc) { + const focusedCell = focusSvc.getFocusedCell(); + const rowNode = focusedCell ? _getRowNode(beans, focusedCell) : null; + const isEditable = rowNode ? focusedCell?.column.isCellEditable(rowNode) : false; + return { + name: localeTextFunc("cut", "Cut"), + shortcut: localeTextFunc("ctrlX", "Ctrl+X"), + icon: _createIconNoSpan16("clipboardCut", beans, null), + disabled: !isEditable || gos.get("suppressCutToClipboard"), + action: () => clipboardSvc.cutToClipboard(void 0, "contextMenu") + }; + } else { + return null; + } + case "paste": + if (clipboardSvc) { + const isPasteBlocked = gos.get("suppressClipboardApi") || gos.get("suppressClipboardPaste") || !column2 || !node || !column2.isCellEditable(node) || column2.isSuppressPaste(node); + return { + name: localeTextFunc("paste", "Paste"), + shortcut: localeTextFunc("ctrlV", "Ctrl+V"), + icon: _createIconNoSpan16("clipboardPaste", beans, null), + disabled: isPasteBlocked, + action: () => clipboardSvc.pasteFromClipboard() + }; + } else { + return null; + } + case "export": { + const exportSubMenuItems = []; + if (!gos.get("suppressCsvExport") && csvCreator) { + exportSubMenuItems.push("csvExport"); + } + if (!gos.get("suppressExcelExport") && excelCreator) { + exportSubMenuItems.push("excelExport"); + } + return exportSubMenuItems.length ? { + name: localeTextFunc("export", "Export"), + subMenu: exportSubMenuItems, + icon: _createIconNoSpan16("save", beans, null) + } : null; + } + case "csvExport": + return csvCreator ? { + name: localeTextFunc("csvExport", "CSV Export"), + icon: _createIconNoSpan16("csvExport", beans, null), + action: () => csvCreator.exportDataAsCsv() + } : null; + case "excelExport": + return excelCreator ? { + name: localeTextFunc("excelExport", "Excel Export"), + icon: _createIconNoSpan16("excelExport", beans, null), + action: () => excelCreator.exportDataAsExcel() + } : null; + case "separator": + return key; + case "pivotChart": + case "chartRange": + return chartMenuItemMapper.getChartItems(key); + case "columnFilter": + return menuSvc && column2 ? { + name: localeTextFunc("columnFilter", "Column Filter"), + icon: _createIconNoSpan16("filter", beans, null), + action: () => menuSvc.showFilterMenu({ + column: column2, + buttonElement: sourceElement2(), + containerType: "columnFilter", + positionBy: "button" + }) + } : null; + case "columnChooser": { + const headerPosition = focusSvc.focusedHeader; + return colChooserFactory ? { + name: localeTextFunc("columnChooser", "Choose Columns"), + icon: _createIconNoSpan16("columns", beans, null), + action: () => colChooserFactory.showColumnChooser({ + column: column2, + eventSource: sourceElement2(), + headerPosition + }) + } : null; + } + case "sortUnSort": + case "sortAscending": + case "sortDescending": + case "sortAbsoluteAscending": + case "sortAbsoluteDescending": { + if (!sortSvc || !column2) { + return null; + } + const { fallback, getSortDef } = SORT_MENU_ITEM_TO_MENU_ACTION_PARAMS[key]; + return { + name: localeTextFunc(key, fallback), + icon: _createIconNoSpan16(key, beans, null), + action: () => sortSvc.setSortForColumn(column2, getSortDef(column2), false, source2) + }; + } + default: { + _warn14(176, { key }); + return null; + } + } + }; + for (const menuItemOrString of originalList) { + let result; + if (typeof menuItemOrString === "string") { + result = getStockMenuItem(menuItemOrString, column, sourceElement, source); + } else { + result = { ...menuItemOrString }; + } + if (!result) { + continue; + } + const resultDef = result; + const { subMenu } = resultDef; + if (subMenu && subMenu instanceof Array) { + resultDef.subMenu = this.mapWithStockItems( + subMenu, + column, + node, + sourceElement, + source + ); + } + if (result != null) { + resultList.push(result); + } + } + _removeRepeatsFromArray(resultList, MENU_ITEM_SEPARATOR); + return resultList; + } +}; +function createAggregationSubMenu(column, aggFuncSvc, valueColsSvc, localeTextFunc) { + let columnToUse; + if (column.isPrimary()) { + columnToUse = column; + } else { + const pivotValueColumn = column.getColDef().pivotValueColumn; + columnToUse = _exists13(pivotValueColumn) ? pivotValueColumn : void 0; + } + const result = []; + if (columnToUse) { + const columnIsAlreadyAggValue = columnToUse.isValueActive(); + const funcNames = aggFuncSvc.getFuncNames(columnToUse); + result.push({ + name: localeTextFunc("noAggregation", "None"), + action: () => { + valueColsSvc.removeColumns([columnToUse], "contextMenu"); + valueColsSvc.setColumnAggFunc(columnToUse, void 0, "contextMenu"); + }, + checked: !columnIsAlreadyAggValue + }); + for (const funcName of funcNames) { + result.push({ + name: localeTextFunc(funcName, aggFuncSvc.getDefaultFuncLabel(funcName)), + action: () => { + valueColsSvc.setColumnAggFunc(columnToUse, funcName, "contextMenu"); + valueColsSvc.addColumns([columnToUse], "contextMenu"); + }, + checked: columnIsAlreadyAggValue && columnToUse.getAggFunc() === funcName + }); + } + } + return result; +} + +// packages/ag-grid-enterprise/src/menu/columnMenuFactory.ts +var ColumnMenuFactory = class extends BeanStub14 { + constructor() { + super(...arguments); + this.beanName = "colMenuFactory"; + } + createMenu(parent, menuItems, column, sourceElement) { + const menuList = parent.createManagedBean( + new MenuList(0, { + column: column ?? null, + node: null, + value: null + }) + ); + const menuItemsMapped = this.beans.menuItemMapper.mapWithStockItems( + menuItems, + column ?? null, + null, + sourceElement, + "columnMenu" + ); + menuList.addMenuItems(menuItemsMapped); + return menuList; + } + getMenuItems(column = null, columnGroup = null) { + const defaultItems = this.getDefaultMenuOptions(column); + let result; + const columnMainMenuItems = (column?.getColDef() ?? columnGroup?.getColGroupDef())?.mainMenuItems; + if (Array.isArray(columnMainMenuItems)) { + result = columnMainMenuItems; + } else if (typeof columnMainMenuItems === "function") { + result = columnMainMenuItems( + _addGridCommonParams9(this.gos, { + column, + columnGroup, + defaultItems + }) + ); + } else { + const userFunc = this.gos.getCallback("getMainMenuItems"); + if (userFunc) { + result = userFunc({ + column, + columnGroup, + defaultItems + }); + } else { + result = defaultItems; + } + } + _removeRepeatsFromArray(result, MENU_ITEM_SEPARATOR); + return result; + } + getDefaultMenuOptions(column) { + const result = []; + const { beans, gos } = this; + const { + colChooserFactory, + rowGroupColsSvc, + colModel, + expansionSvc, + sortSvc, + menuSvc, + pinnedCols, + aggFuncSvc, + colAutosize + } = beans; + const isLegacyMenuEnabled = _isLegacyMenuEnabled(gos); + const addColumnItems = () => { + if (!isLegacyMenuEnabled && colChooserFactory) { + result.push("columnChooser"); + } + result.push("resetColumns"); + }; + if (!column) { + addColumnItems(); + return result; + } + const { colDef } = column; + const allowPinning = pinnedCols && !colDef.lockPinned; + const rowGroupCount = rowGroupColsSvc?.columns.length ?? 0; + const doingGrouping = rowGroupCount > 0; + const grandTotalRow = _getGrandTotalRow(gos); + const treeData = gos.get("treeData"); + const isPrimary = column.isPrimary(); + const allowValueAgg = !isPrimary || aggFuncSvc && column.isAllowValue() && (doingGrouping || grandTotalRow || treeData); + if (sortSvc && !isLegacyMenuEnabled && column.isSortable()) { + const { + isDefaultSortAllowed, + isAbsoluteSortAllowed, + isAbsoluteSort, + isDefaultSort, + isAscending, + isDescending, + direction + } = _getDisplaySortForColumn(column, beans); + if (isDefaultSortAllowed && !(isAscending && isDefaultSort)) { + result.push("sortAscending"); + } + if (isDefaultSortAllowed && !(isDescending && isDefaultSort)) { + result.push("sortDescending"); + } + if (isAbsoluteSortAllowed && !(isAscending && isAbsoluteSort)) { + result.push("sortAbsoluteAscending"); + } + if (isAbsoluteSortAllowed && !(isDescending && isAbsoluteSort)) { + result.push("sortAbsoluteDescending"); + } + if (direction) { + result.push("sortUnSort"); + } + result.push(MENU_ITEM_SEPARATOR); + } + if (menuSvc?.isFilterMenuItemEnabled(column)) { + result.push("columnFilter"); + result.push(MENU_ITEM_SEPARATOR); + } + if (allowPinning) { + result.push("pinSubMenu"); + } + if (allowValueAgg) { + result.push("valueAggSubMenu"); + } + if (allowPinning || allowValueAgg) { + result.push(MENU_ITEM_SEPARATOR); + } + if (colAutosize) { + if (!colDef.suppressAutoSize) { + result.push("autoSizeThis"); + } + result.push("autoSizeAll"); + result.push(MENU_ITEM_SEPARATOR); + } + if (rowGroupColsSvc && gos.isModuleRegistered("SharedRowGrouping")) { + const numItems = result.length; + const showRowGroup = colDef.showRowGroup; + if (showRowGroup) { + result.push("rowUnGroup"); + } else if (column.isAllowRowGroup() && isPrimary) { + if (column.isRowGroupActive()) { + const groupLocked = isRowGroupColLocked(column, beans); + if (!groupLocked) { + result.push("rowUnGroup"); + } + } else { + result.push("rowGroup"); + } + } + if (result.length > numItems) { + result.push(MENU_ITEM_SEPARATOR); + } + } + addColumnItems(); + if (expansionSvc && (_isClientSideRowModel2(gos) || gos.get("ssrmExpandAllAffectsAllRows")) && (treeData || rowGroupCount > (colModel.isPivotMode() ? 1 : 0))) { + result.push("expandAll"); + result.push("contractAll"); + } + return result; + } +}; + +// packages/ag-grid-enterprise/src/menu/contextMenu.ts +import { + BeanStub as BeanStub15, + _addGridCommonParams as _addGridCommonParams10, + _attemptToRestoreCellFocus, + _exists as _exists14, + _getGrandTotalRow as _getGrandTotalRow2, + _isIOSUserAgent +} from "ag-grid-community"; +var CSS_CONTEXT_MENU_OPEN = "ag-context-menu-open"; +var ContextMenuService = class extends BeanStub15 { + constructor() { + super(...arguments); + this.beanName = "contextMenuSvc"; + this.focusedCell = null; + } + postConstruct() { + this.menu = this.createManagedBean( + new AgContextMenuService({ + menuItemCallbacks: MENU_ITEM_CALLBACKS, + getMenuItems: this.getMenuItems.bind(this), + mapMenuItems: this.mapWithStockItems.bind(this), + beforeMenuOpen: this.beforeMenuOpen.bind(this), + onMenuOpen: this.onMenuOpen.bind(this), + onMenuClose: this.onMenuClose.bind(this), + afterMenuDestroyed: this.afterMenuDestroyed.bind(this), + onVisibleChanged: this.dispatchVisibleChangedEvent.bind(this), + // overlay was displayed + shouldBlockMenuOpen: () => !!this.beans.overlays?.exclusive + }) + ); + } + hideActiveMenu() { + this.menu.hideActiveMenu(); + } + getMenuItems(menuActionParams, mouseEvent) { + const { column, node, value } = menuActionParams; + const defaultMenuOptions = []; + const { clipboardSvc, chartSvc, csvCreator, excelCreator, colModel, rangeSvc, gos } = this.beans; + if (_exists14(node) && clipboardSvc) { + if (column) { + if (!gos.get("suppressCutToClipboard")) { + defaultMenuOptions.push("cut"); + } + defaultMenuOptions.push("copy", "copyWithHeaders", "copyWithGroupHeaders", "paste", "separator"); + } + } + if (gos.get("enableCharts") && chartSvc) { + if (colModel.isPivotMode()) { + defaultMenuOptions.push("pivotChart"); + } + if (rangeSvc && !rangeSvc.isEmpty()) { + defaultMenuOptions.push("chartRange"); + } + } + if (_exists14(node)) { + const enableRowPinning = gos.get("enableRowPinning"); + const isRowPinnable = gos.get("isRowPinnable"); + if (enableRowPinning) { + const isGroupTotalRow = node.level > -1 && node.footer; + const isGrandTotalRow = node.level === -1 && node.footer; + const grandTotalRow = _getGrandTotalRow2(gos); + const isGrandTotalRowFixed = grandTotalRow === "pinnedBottom" || grandTotalRow === "pinnedTop"; + if (isGrandTotalRow && !isGrandTotalRowFixed || !isGrandTotalRow && !isGroupTotalRow) { + const pinnable = isRowPinnable?.(node) ?? true; + if (pinnable) { + defaultMenuOptions.push("pinRowSubMenu"); + } + } + } + const suppressExcel = gos.get("suppressExcelExport") || !excelCreator; + const suppressCsv = gos.get("suppressCsvExport") || !csvCreator; + const onIPad = _isIOSUserAgent(); + const anyExport = !onIPad && (!suppressExcel || !suppressCsv); + if (anyExport) { + defaultMenuOptions.push("export"); + } + } + const defaultItems = defaultMenuOptions.length ? defaultMenuOptions : void 0; + const columnContextMenuItems = column?.getColDef().contextMenuItems; + if (Array.isArray(columnContextMenuItems)) { + return columnContextMenuItems; + } + if (typeof columnContextMenuItems === "function") { + return columnContextMenuItems( + _addGridCommonParams10(gos, { + column, + node, + value, + defaultItems, + event: mouseEvent + }) + ); + } + const userFunc = gos.getCallback("getContextMenuItems"); + return userFunc?.({ column, node, value, defaultItems, event: mouseEvent }) ?? defaultMenuOptions; + } + getContextMenuPosition(rowNode, column) { + const rowCtrl = this.getRowCtrl(rowNode); + const eGui = this.getCellGui(rowCtrl, column); + if (!eGui) { + return { x: 0, y: rowCtrl?.getRowYPosition() ?? 0 }; + } + const rect = eGui.getBoundingClientRect(); + return { + x: rect.x + rect.width / 2, + y: rect.y + rect.height / 2 + }; + } + showContextMenu(params) { + const rowNode = params.rowNode ?? null; + const column = params.column ?? null; + let { anchorToElement, value, source } = params; + if (rowNode && column && value == null) { + value = this.beans.valueSvc.getValueForDisplay({ column, node: rowNode, from: "edit" }).value; + } + if (anchorToElement == null) { + anchorToElement = this.getContextMenuAnchorElement(rowNode, column); + } + this.beans.menuUtils.onContextMenu({ + mouseEvent: params.mouseEvent ?? null, + touchEvent: params.touchEvent ?? null, + showMenuCallback: (eventOrTouch) => this.menu.showMenu({ node: rowNode, column, value }, eventOrTouch, anchorToElement), + source + }); + } + handleContextMenuMouseEvent(mouseEvent, touchEvent, rowCtrl, cellCtrl) { + const rowNode = cellCtrl?.rowNode ?? rowCtrl?.rowNode ?? null; + const column = cellCtrl?.column ?? rowCtrl?.findFullWidthInfoForEvent(mouseEvent || touchEvent)?.column ?? null; + const { valueSvc, ctrlsSvc } = this.beans; + const value = column ? valueSvc.getValue(column, rowNode, "edit") : null; + const gridBodyCon = ctrlsSvc.getGridBodyCtrl(); + const anchorToElement = cellCtrl ? cellCtrl.eGui : gridBodyCon.eGridBody; + this.showContextMenu({ + mouseEvent, + touchEvent, + rowNode, + column, + value, + anchorToElement, + source: "ui" + }); + } + beforeMenuOpen(menuActionParams) { + if (!menuActionParams.column) { + this.beans.focusSvc.clearFocusedCell(); + } + } + onMenuOpen() { + const { ctrlsSvc, focusSvc } = this.beans; + ctrlsSvc.getGridBodyCtrl().eGridBody.classList.add(CSS_CONTEXT_MENU_OPEN); + this.focusedCell = focusSvc.getFocusedCell(); + } + onMenuClose() { + this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.classList.remove(CSS_CONTEXT_MENU_OPEN); + } + afterMenuDestroyed() { + const { beans, focusedCell } = this; + _attemptToRestoreCellFocus(beans, focusedCell); + } + dispatchVisibleChangedEvent(visible, source) { + this.eventSvc.dispatchEvent({ + type: "contextMenuVisibleChanged", + visible, + source + }); + } + getRowCtrl(rowNode) { + const { rowIndex, rowPinned } = rowNode || {}; + if (rowIndex == null) { + return; + } + return this.beans.rowRenderer.getRowByPosition({ rowIndex, rowPinned }) || void 0; + } + getCellGui(rowCtrl, column) { + if (!rowCtrl || !column) { + return; + } + const cellCtrl = rowCtrl.getCellCtrl(column); + return cellCtrl?.eGui || void 0; + } + getContextMenuAnchorElement(rowNode, column) { + const gridBodyEl = this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody; + const rowCtrl = this.getRowCtrl(rowNode); + if (!rowCtrl) { + return gridBodyEl; + } + const cellGui = this.getCellGui(rowCtrl, column); + if (cellGui) { + return cellGui; + } + if (rowCtrl.isFullWidth()) { + return rowCtrl.getFullWidthElement(); + } + return gridBodyEl; + } + mapWithStockItems(menuItems, menuActionParams, getGui) { + const { column, node } = menuActionParams; + return this.beans.menuItemMapper.mapWithStockItems( + menuItems, + column, + node, + getGui, + "contextMenu" + ); + } +}; + +// packages/ag-grid-enterprise/src/menu/enterpriseMenu.ts +import { + AgPromise as AgPromise3, + BeanStub as BeanStub16, + Component as Component30, + FilterComp, + RefPlaceholder as RefPlaceholder28, + _createElement as _createElement9, + _createIconNoSpan as _createIconNoSpan17, + _error, + _focusInto as _focusInto6, + _isColumnMenuAnchoringEnabled, + _isLegacyMenuEnabled as _isLegacyMenuEnabled2, + _setColMenuVisible, + _warn as _warn15, + isColumn as isColumn2 +} from "ag-grid-community"; +var TAB_FILTER = "filterMenuTab"; +var TAB_GENERAL = "generalMenuTab"; +var TAB_COLUMNS = "columnsMenuTab"; +var TABS_DEFAULT = [TAB_GENERAL, TAB_FILTER, TAB_COLUMNS]; +var EnterpriseMenuFactory = class extends BeanStub16 { + constructor() { + super(...arguments); + this.beanName = "enterpriseMenuFactory"; + } + hideActiveMenu() { + this.destroyBean(this.activeMenu); + } + showMenuAfterMouseEvent(columnOrGroup, mouseEvent, containerType, onClosedCallback, filtersOnly) { + const { column, columnGroup } = this.splitColumnOrGroup(columnOrGroup); + const defaultTab = filtersOnly ? "filterMenuTab" : void 0; + this.showMenu( + column, + columnGroup, + (menu) => { + const ePopup = menu.getGui(); + this.beans.popupSvc.positionPopupUnderMouseEvent({ + type: containerType, + additionalParams: { + column + }, + mouseEvent, + ePopup + }); + if (defaultTab) { + menu.showTab?.(defaultTab); + } + this.dispatchVisibleChangedEvent(true, false, column, columnGroup, defaultTab); + }, + containerType, + defaultTab, + void 0, + mouseEvent.target, + onClosedCallback + ); + } + splitColumnOrGroup(columnOrGroup) { + const colIsColumn = columnOrGroup && isColumn2(columnOrGroup); + const column = colIsColumn ? columnOrGroup : void 0; + const columnGroup = colIsColumn ? void 0 : columnOrGroup; + return { column, columnGroup }; + } + showMenuAfterButtonClick(columnOrGroup, eventSource, containerType, onClosedCallback, filtersOnly) { + let multiplier = -1; + let alignSide = "left"; + if (this.gos.get("enableRtl")) { + multiplier = 1; + alignSide = "right"; + } + const defaultTab = filtersOnly ? "filterMenuTab" : void 0; + const restrictToTabs = defaultTab ? [defaultTab] : void 0; + const isLegacyMenuEnabled = _isLegacyMenuEnabled2(this.gos); + const nudgeX = (isLegacyMenuEnabled ? 9 : 4) * multiplier; + const nudgeY = isLegacyMenuEnabled ? -23 : 4; + const { column, columnGroup } = this.splitColumnOrGroup(columnOrGroup); + this.showMenu( + column, + columnGroup, + (menu) => { + const ePopup = menu.getGui(); + this.beans.popupSvc.positionPopupByComponent({ + type: containerType, + additionalParams: { + column + }, + eventSource, + ePopup, + alignSide, + nudgeX, + nudgeY, + position: "under", + keepWithinBounds: true + }); + if (defaultTab) { + menu.showTab?.(defaultTab); + } + this.dispatchVisibleChangedEvent(true, false, column, columnGroup, defaultTab); + }, + containerType, + defaultTab, + restrictToTabs, + eventSource, + onClosedCallback + ); + } + showMenu(column, columnGroup, positionCallback, containerType, defaultTab, restrictToTabs, eventSource, onClosedCallback) { + const menuParams = this.getMenuParams(column, columnGroup, restrictToTabs, eventSource); + if (!menuParams) { + return; + } + const { menu, eMenuGui, anchorToElement, restoreFocusParams } = menuParams; + const closedFuncs = []; + const { menuUtils, popupSvc } = this.beans; + closedFuncs.push((e) => { + const eComp = menu.getGui(); + this.destroyBean(menu); + if (column) { + _setColMenuVisible(column, false, "contextMenu"); + menuUtils.restoreFocusOnClose(restoreFocusParams, eComp, e); + } + onClosedCallback?.(); + }); + const translate = this.getLocaleTextFunc(); + popupSvc.addPopup({ + modal: true, + eChild: eMenuGui, + closeOnEsc: true, + closedCallback: (e) => { + for (const f of closedFuncs) { + f(e); + } + this.dispatchVisibleChangedEvent(false, false, column, columnGroup, defaultTab); + }, + afterGuiAttached: (params) => menu.afterGuiAttached(Object.assign({}, { container: containerType }, params)), + // if defaultTab is not present, positionCallback will be called + // after `showTabBasedOnPreviousSelection` is called. + positionCallback: defaultTab ? () => positionCallback(menu) : void 0, + ariaLabel: translate("ariaLabelColumnMenu", "Column Menu") + }); + if (!defaultTab) { + menu.showTabBasedOnPreviousSelection?.(); + positionCallback(menu); + } + if (_isColumnMenuAnchoringEnabled(this.gos)) { + const stopAnchoringPromise = popupSvc.setPopupPositionRelatedToElement(eMenuGui, anchorToElement); + if (stopAnchoringPromise && column) { + this.addStopAnchoring(stopAnchoringPromise, column, closedFuncs); + } + } + menu.addEventListener("tabSelected", (event) => { + this.dispatchVisibleChangedEvent(false, true, column); + this.lastSelectedTab = event.key; + this.dispatchVisibleChangedEvent(true, true, column); + }); + if (column) { + _setColMenuVisible(column, true, "contextMenu"); + } + this.activeMenu = menu; + menu.addEventListener("destroyed", () => { + if (this.activeMenu === menu) { + this.activeMenu = null; + } + }); + } + addStopAnchoring(stopAnchoringPromise, column, closedFuncsArr) { + stopAnchoringPromise.then((stopAnchoringFunc) => { + column.__addEventListener("leftChanged", stopAnchoringFunc); + column.__addEventListener("visibleChanged", stopAnchoringFunc); + closedFuncsArr.push(() => { + column.__removeEventListener("leftChanged", stopAnchoringFunc); + column.__removeEventListener("visibleChanged", stopAnchoringFunc); + }); + }); + } + getMenuParams(column, columnGroup, restrictToTabs, eventSource) { + const { focusSvc, visibleCols, ctrlsSvc } = this.beans; + const restoreFocusParams = { + column, + headerPosition: focusSvc.focusedHeader, + columnIndex: visibleCols.allCols.indexOf(column), + eventSource + }; + const menu = this.createMenu(column, columnGroup, restoreFocusParams, restrictToTabs, eventSource); + return menu ? { + menu, + eMenuGui: menu.getGui(), + anchorToElement: eventSource || ctrlsSvc.getGridBodyCtrl().eGridBody, + restoreFocusParams + } : void 0; + } + createMenu(column, columnGroup, restoreFocusParams, restrictToTabs, eventSource) { + if (_isLegacyMenuEnabled2(this.gos)) { + return this.createBean( + new TabbedColumnMenu(column, restoreFocusParams, this.lastSelectedTab, restrictToTabs, eventSource) + ); + } else { + const menuItems = this.beans.colMenuFactory.getMenuItems(column, columnGroup); + return menuItems.length ? this.createBean(new ColumnContextMenu(menuItems, column, restoreFocusParams, eventSource)) : void 0; + } + } + dispatchVisibleChangedEvent(visible, switchingTab, column, columnGroup, defaultTab) { + this.eventSvc.dispatchEvent({ + type: "columnMenuVisibleChanged", + visible, + switchingTab, + key: this.lastSelectedTab ?? defaultTab ?? (_isLegacyMenuEnabled2(this.gos) ? TAB_GENERAL : "columnMenu"), + column: column ?? null, + columnGroup: columnGroup ?? null + }); + } + isMenuEnabled(column) { + if (!_isLegacyMenuEnabled2(this.gos)) { + return true; + } + const isFilterDisabled = !this.beans.filterManager?.isFilterAllowed(column); + const tabs = column.getColDef().menuTabs ?? TABS_DEFAULT; + const numActiveTabs = isFilterDisabled && tabs.includes(TAB_FILTER) ? tabs.length - 1 : tabs.length; + return numActiveTabs > 0; + } + showMenuAfterContextMenuEvent(column, mouseEvent, touchEvent) { + this.beans.menuUtils.onContextMenu({ + mouseEvent, + touchEvent, + source: "ui", + showMenuCallback: (eventOrTouch) => { + this.showMenuAfterMouseEvent(column, eventOrTouch, "columnMenu"); + return true; + } + }); + } +}; +var TabbedColumnMenu = class extends BeanStub16 { + constructor(column, restoreFocusParams, initialSelection, restrictTo, sourceElement) { + super(); + this.column = column; + this.restoreFocusParams = restoreFocusParams; + this.initialSelection = initialSelection; + this.restrictTo = restrictTo; + this.sourceElement = sourceElement; + this.tabFactories = {}; + this.includeChecks = {}; + const { tabFactories, includeChecks } = this; + tabFactories[TAB_GENERAL] = this.createMainPanel.bind(this); + tabFactories[TAB_FILTER] = this.createFilterPanel.bind(this); + tabFactories[TAB_COLUMNS] = this.createColumnsPanel.bind(this); + includeChecks[TAB_GENERAL] = () => true; + includeChecks[TAB_FILTER] = () => column ? !!this.beans.filterManager?.isFilterAllowed(column) : false; + includeChecks[TAB_COLUMNS] = () => true; + } + postConstruct() { + const tabs = this.getTabsToCreate().map((name) => this.createTab(name)); + const tabbedLayout = new AgTabbedLayout({ + items: tabs, + cssClass: "ag-menu", + onActiveItemClicked: this.onHidePopup.bind(this), + onItemClicked: this.onTabItemClicked.bind(this) + }); + this.tabbedLayout = this.createBean(tabbedLayout); + this.mainMenuList?.setParentComponent(tabbedLayout); + this.addDestroyFunc(() => this.destroyBean(tabbedLayout)); + } + getTabsToCreate() { + if (this.restrictTo) { + return this.restrictTo; + } + return (this.column?.getColDef().menuTabs ?? TABS_DEFAULT).filter( + (tabName) => this.isValidMenuTabItem(tabName) && this.isNotSuppressed(tabName) + ); + } + isValidMenuTabItem(menuTabName) { + let isValid = true; + let itemsToConsider = TABS_DEFAULT; + if (this.restrictTo != null) { + isValid = this.restrictTo.indexOf(menuTabName) > -1; + itemsToConsider = this.restrictTo; + } + isValid = isValid && TABS_DEFAULT.indexOf(menuTabName) > -1; + if (!isValid) { + _warn15(175, { menuTabName, itemsToConsider }); + } + return isValid; + } + isNotSuppressed(menuTabName) { + return this.includeChecks[menuTabName](); + } + createTab(name) { + return this.tabFactories[name](); + } + showTabBasedOnPreviousSelection() { + this.showTab(this.initialSelection); + } + showTab(toShow) { + const { tabItemColumns, tabbedLayout, tabItemFilter, tabItemGeneral } = this; + if (tabItemColumns && toShow === TAB_COLUMNS) { + tabbedLayout.showItem(tabItemColumns); + } else if (tabItemFilter && toShow === TAB_FILTER) { + tabbedLayout.showItem(tabItemFilter); + } else if (tabItemGeneral && toShow === TAB_GENERAL) { + tabbedLayout.showItem(tabItemGeneral); + } else { + tabbedLayout.showFirstItem(); + } + } + onTabItemClicked(event) { + let key = null; + switch (event.item) { + case this.tabItemColumns: + key = TAB_COLUMNS; + break; + case this.tabItemFilter: + key = TAB_FILTER; + break; + case this.tabItemGeneral: + key = TAB_GENERAL; + break; + } + if (key) { + this.activateTab(key); + } + } + activateTab(tab) { + const ev = { + type: "tabSelected", + key: tab + }; + this.dispatchLocalEvent(ev); + } + createMainPanel() { + const { beans, column } = this; + const colMenuFactory = beans.colMenuFactory; + const mainMenuList = colMenuFactory.createMenu( + this, + colMenuFactory.getMenuItems(column), + this.column, + () => this.sourceElement ?? this.getGui() + ); + this.mainMenuList = mainMenuList; + mainMenuList.addEventListener("closeMenu", this.onHidePopup.bind(this)); + const tabItemGeneral = { + title: _createIconNoSpan17("legacyMenu", beans, column), + titleLabel: TAB_GENERAL.replace("MenuTab", ""), + bodyPromise: AgPromise3.resolve(mainMenuList.getGui()), + name: TAB_GENERAL + }; + this.tabItemGeneral = tabItemGeneral; + return tabItemGeneral; + } + onHidePopup(event) { + this.beans.menuUtils.closePopupAndRestoreFocusOnSelect( + this.hidePopupFunc, + this.restoreFocusParams, + event + ); + } + createFilterPanel() { + const comp = this.column ? this.createBean(new FilterComp(this.column, "COLUMN_MENU")) : null; + this.filterComp = comp; + if (!comp?.hasFilter()) { + _error(119); + } + const afterAttachedCallback = (params) => comp?.afterGuiAttached(params); + const afterDetachedCallback = () => comp?.afterGuiDetached(); + this.tabItemFilter = { + title: _createIconNoSpan17("filterTab", this.beans, this.column), + titleLabel: TAB_FILTER.replace("MenuTab", ""), + bodyPromise: AgPromise3.resolve(comp?.getGui()), + afterAttachedCallback, + afterDetachedCallback, + name: TAB_FILTER + }; + return this.tabItemFilter; + } + createColumnsPanel() { + const eWrapperDiv = _createElement9({ tag: "div", cls: "ag-menu-column-select-wrapper" }); + const { beans, column } = this; + const columnSelectPanel = beans.colChooserFactory.createColumnSelectPanel( + this, + column + ); + const columnSelectPanelGui = columnSelectPanel.getGui(); + columnSelectPanelGui.classList.add("ag-menu-column-select"); + eWrapperDiv.appendChild(columnSelectPanelGui); + const tabItemColumns = { + title: _createIconNoSpan17("columns", beans, column), + //createColumnsIcon(), + titleLabel: TAB_COLUMNS.replace("MenuTab", ""), + bodyPromise: AgPromise3.resolve(eWrapperDiv), + name: TAB_COLUMNS + }; + this.tabItemColumns = tabItemColumns; + return tabItemColumns; + } + afterGuiAttached(params) { + const { container, hidePopup } = params; + this.tabbedLayout.setAfterAttachedParams({ container, hidePopup }); + if (hidePopup) { + this.hidePopupFunc = hidePopup; + this.addDestroyFunc(hidePopup); + } + } + getGui() { + return this.tabbedLayout.getGui(); + } + destroy() { + super.destroy(); + this.destroyBean(this.filterComp); + } +}; +var ColumnContextMenu = class extends Component30 { + constructor(menuItems, column, restoreFocusParams, sourceElement) { + super({ tag: "div", ref: "eColumnMenu", cls: "ag-menu ag-column-menu", role: "presentation" }); + this.menuItems = menuItems; + this.column = column; + this.restoreFocusParams = restoreFocusParams; + this.sourceElement = sourceElement; + this.eColumnMenu = RefPlaceholder28; + } + postConstruct() { + const mainMenuList = this.beans.colMenuFactory.createMenu( + this, + this.menuItems, + this.column, + () => this.sourceElement ?? this.getGui() + ); + this.mainMenuList = mainMenuList; + mainMenuList.addEventListener("closeMenu", this.onHidePopup.bind(this)); + this.eColumnMenu.appendChild(mainMenuList.getGui()); + } + // eslint-disable-next-line sonarjs/no-identical-functions + onHidePopup(event) { + this.beans.menuUtils.closePopupAndRestoreFocusOnSelect( + this.hidePopupFunc, + this.restoreFocusParams, + event + ); + } + afterGuiAttached({ hidePopup }) { + if (hidePopup) { + this.hidePopupFunc = hidePopup; + this.addDestroyFunc(hidePopup); + } + _focusInto6(this.mainMenuList.getGui()); + } +}; + +// packages/ag-grid-enterprise/src/menu/menuApi.ts +function showContextMenu(beans, params) { + const { contextMenuSvc } = beans; + if (!contextMenuSvc) { + return; + } + const { rowNode, column, value, x, y } = params || {}; + let { x: clientX, y: clientY } = contextMenuSvc.getContextMenuPosition(rowNode, column); + if (x != null) { + clientX = x; + } + if (y != null) { + clientY = y; + } + contextMenuSvc.showContextMenu({ + mouseEvent: new MouseEvent("mousedown", { clientX, clientY }), + rowNode, + column, + value, + source: "api" + }); +} +function showColumnChooser(beans, params) { + beans.colChooserFactory?.showColumnChooser({ chooserParams: params }); +} +function hideColumnChooser(beans) { + beans.colChooserFactory?.hideActiveColumnChooser(); +} + +// packages/ag-grid-enterprise/src/menu/menuUtils.ts +import { + BeanStub as BeanStub17, + _findTabbableParent, + _getActiveDomElement as _getActiveDomElement9, + _isNothingFocused as _isNothingFocused2, + _isVisible as _isVisible6, + _last as _last6 +} from "ag-grid-community"; +var MenuUtils = class extends BeanStub17 { + constructor() { + super(...arguments); + this.beanName = "menuUtils"; + } + restoreFocusOnClose(restoreFocusParams, eComp, e, restoreIfMouseEvent) { + const { eventSource } = restoreFocusParams; + const isKeyboardEvent = e instanceof KeyboardEvent; + if (!restoreIfMouseEvent && !isKeyboardEvent || !eventSource) { + return; + } + const activeEl = _getActiveDomElement9(this.beans); + if ( + // focus is outside of comp + !eComp.contains(activeEl) && // something else has focus + !_isNothingFocused2(this.beans) + ) { + return; + } + this.focusHeaderCell(restoreFocusParams); + } + closePopupAndRestoreFocusOnSelect(hidePopupFunc, restoreFocusParams, event) { + let keyboardEvent; + if (event?.keyboardEvent) { + keyboardEvent = event.keyboardEvent; + } + hidePopupFunc(keyboardEvent && { keyboardEvent }); + const beans = this.beans; + const focusSvc = beans.focusSvc; + const focusedCell = focusSvc.getFocusedCell(); + if (_isNothingFocused2(beans)) { + if (focusedCell) { + const { rowIndex, rowPinned, column } = focusedCell; + focusSvc.setFocusedCell({ + rowIndex, + column, + rowPinned, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true + }); + } else { + this.focusHeaderCell(restoreFocusParams); + } + } + } + onContextMenu(params) { + const { mouseEvent, touchEvent, showMenuCallback, source } = params; + if (!this.gos.get("allowContextMenuWithControlKey")) { + if (mouseEvent && (mouseEvent.ctrlKey || mouseEvent.metaKey)) { + return; + } + } + if (mouseEvent) { + this.blockMiddleClickScrollsIfNeeded(mouseEvent); + } + if (source === "ui" && this.gos.get("suppressContextMenu")) { + return; + } + const eventOrTouch = mouseEvent ?? touchEvent.touches[0]; + if (showMenuCallback(eventOrTouch)) { + const event = mouseEvent ?? touchEvent; + if (event?.cancelable) { + event.preventDefault(); + } + } + } + // make this async for react + async focusHeaderCell(restoreFocusParams) { + const { column, columnIndex, headerPosition, eventSource } = restoreFocusParams; + const { visibleCols, headerNavigation, focusSvc } = this.beans; + const isColumnStillVisible = await visibleCols.allCols.some((col) => col === column); + if (!this.isAlive()) { + return; + } + if (column?.isAlive() && isColumnStillVisible && eventSource && _isVisible6(eventSource)) { + const focusableEl = _findTabbableParent(eventSource); + if (focusableEl) { + headerNavigation?.scrollToColumn(column); + focusableEl.focus(); + } + } else if (headerPosition && columnIndex !== -1) { + const allColumns = visibleCols.allCols; + const columnToFocus = allColumns[columnIndex] || _last6(allColumns); + if (columnToFocus) { + focusSvc.focusHeaderPosition({ + headerPosition: { + headerRowIndex: headerPosition.headerRowIndex, + column: columnToFocus + } + }); + } + } + } + blockMiddleClickScrollsIfNeeded(mouseEvent) { + if (this.gos.get("suppressMiddleClickScrolls") && mouseEvent.which === 2) { + mouseEvent.preventDefault(); + } + } +}; + +// packages/ag-grid-enterprise/src/menu/menuModule.ts +var MenuCoreModule = { + moduleName: "MenuCore", + version: VERSION, + beans: [MenuItemMapper, ChartMenuItemMapper, MenuUtils], + icons: { + // context menu chart item + chart: "chart", + // columns in menu (column chooser / columns tab) + columns: "columns", + // loading async menu items + loadingMenuItems: "loading", + // "Pin column" item in column header menu + menuPin: "pin", + // "Value aggregation" column menu item (shown on numeric columns when grouping is active)" + menuValue: "aggregation", + // "Group by {column-name}" item in column header menu + menuAddRowGroup: "group", + // "Un-Group by {column-name}" item in column header menu + menuRemoveRowGroup: "group", + // context menu copy item + clipboardCopy: "copy", + // context menu cut item + clipboardCut: "cut", + // context menu paste item + clipboardPaste: "paste", + // context menu export item + save: "save", + // csv export + csvExport: "csv", + // excel export, + excelExport: "excel", + // show on column header when column is sorted ascending + sortAscending: "asc", + // show on column header when column is sorted descending + sortDescending: "desc", + // show on column header when column is sorted absolute ascending + sortAbsoluteAscending: "aasc", + // show on column header when column is sorted absolute descending + sortAbsoluteDescending: "adesc", + // show on column header when column has no sort, only when enabled with colDef.unSortIcon=true + sortUnSort: "none" + }, + dependsOn: [EnterpriseCoreModule, _PopupModule3, _SharedMenuModule, MenuItemModule] +}; +var ColumnMenuModule = { + moduleName: "ColumnMenu", + version: VERSION, + beans: [EnterpriseMenuFactory, ColumnMenuFactory, ColumnChooserFactory], + icons: { + ensureColumnVisible: "column-arrow", + // menu tab icon in legacy tabbed enterprise column menu + legacyMenu: "menu", + // filter tab icon in legacy tabbed enterprise column menu + filterTab: "filter", + // column tool panel column group contracted (click to expand) + columnSelectClosed: "tree-closed", + // column tool panel column group expanded (click to contract) + columnSelectOpen: "tree-open", + // column tool panel header expand/collapse all button, shown when some children are expanded and + // others are collapsed + columnSelectIndeterminate: "tree-indeterminate" + }, + apiFunctions: { + showColumnChooser, + hideColumnChooser + }, + dependsOn: [MenuCoreModule, _SharedDragAndDropModule3, _ColumnMoveModule2] +}; +var ContextMenuModule = { + moduleName: "ContextMenu", + version: VERSION, + beans: [ContextMenuService], + apiFunctions: { + showContextMenu + }, + dependsOn: [MenuCoreModule] +}; +var MenuModule = { + moduleName: "Menu", + version: VERSION, + dependsOn: [ColumnMenuModule, ContextMenuModule] +}; + +// packages/ag-grid-enterprise/src/richSelect/richSelectModule.ts +import { _EditCoreModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/richSelect/richSelectCellEditor.ts +import { AgAbstractCellEditor, KeyCode as KeyCode25, _addGridCommonParams as _addGridCommonParams11, _consoleError as _consoleError2, _missing, _warn as _warn16 } from "ag-grid-community"; +var DEFAULT_VALUES_PAGE_LOAD_THRESHOLD = 10; +var RichSelectCellEditor = class extends AgAbstractCellEditor { + constructor() { + super({ tag: "div", cls: "ag-cell-edit-wrapper" }); + this.pendingInitialEventKey = null; + this.initialEventKeyProcessed = false; + } + initialiseEditor(_params) { + const { cellStartedEdit, values, valuesPage, eventKey } = this.params; + this.pendingInitialEventKey = null; + this.initialEventKeyProcessed = false; + if (_missing(values) && _missing(valuesPage)) { + _warn16(180); + } + const asyncMode = this.resolveAsyncMode(); + const { params: richSelectParams, valueList } = this.buildRichSelectParams(asyncMode); + const richSelect = this.createManagedBean(new AgRichSelect(richSelectParams)); + this.eEditor = richSelect; + richSelect.addCss("ag-cell-editor"); + this.appendChild(richSelect); + const asyncValuesSource = this.getAsyncValuesSource(asyncMode); + if (asyncValuesSource) { + richSelect.setAsyncValuesSource({ + source: asyncValuesSource, + thresholdRows: this.params.valuesPageLoadThreshold ?? DEFAULT_VALUES_PAGE_LOAD_THRESHOLD, + useAsyncSearch: asyncMode.isFullAsync, + onMisconfiguredSearchSource: asyncMode.isFullAsync ? () => _warn16(294) : void 0, + onFirstValuesPageLoaded: () => { + if (this.pendingInitialEventKey != null) { + this.consumeInitialEventKey(this.pendingInitialEventKey); + this.pendingInitialEventKey = null; + } + } + }); + } + this.eEditor.setValueList({ valueList, refresh: true, isInitial: true }); + if (asyncMode.isValuesPaged) { + this.eEditor.resetAsyncValues(""); + if (asyncMode.isFullAsync) { + this.consumeInitialEventKey(eventKey); + } else { + this.pendingInitialEventKey = eventKey; + } + } else if (valueList && !Array.isArray(valueList)) { + valueList.then((values2) => { + const searchStringCallback = this.getSearchStringCallback(values2); + if (searchStringCallback) { + richSelect.setSearchStringCreator(searchStringCallback); + } + this.consumeInitialEventKey(eventKey); + }).catch((error) => { + _consoleError2("Rich Select", error); + this.consumeInitialEventKey(eventKey); + }); + } + this.addManagedListeners(richSelect, { + fieldPickerValueSelected: this.onEditorPickerValueSelected.bind(this) + }); + this.focusAfterAttached = cellStartedEdit; + } + onEditorPickerValueSelected(e) { + if (this.gos.get("editType") !== "fullRow") { + setTimeout(() => this.params.stopEditing(!e.fromEnterKey)); + } + } + getPlaceholderText(isFullAsync = this.isFullAsync()) { + const { valuePlaceholder } = this.params; + if (valuePlaceholder !== void 0) { + return valuePlaceholder; + } + const translate = this.getLocaleTextFunc(); + return isFullAsync ? translate("typeToSearchOoo", "Type to search...") : translate("advancedFilterBuilderSelectOption", "Select an option..."); + } + isFullAsync() { + const { allowTyping, filterListAsync, values, valuesPage } = this.params; + const hasAsyncValueSource = typeof values === "function" || typeof valuesPage === "function"; + if (filterListAsync && !allowTyping) { + _warn16(294); + return false; + } + if (!hasAsyncValueSource && filterListAsync) { + _warn16(294); + return false; + } + return !!(allowTyping && filterListAsync && hasAsyncValueSource); + } + isValuesPaged() { + return typeof this.params.valuesPage === "function"; + } + resolveAsyncMode() { + return { + isValuesPaged: this.isValuesPaged(), + isFullAsync: this.isFullAsync() + }; + } + getInitialValueList(asyncMode = this.resolveAsyncMode()) { + const params = this.params; + const { values } = params; + if (asyncMode.isValuesPaged) { + return; + } + if (!values) { + return []; + } + if (Array.isArray(values)) { + return values; + } + if (typeof values !== "function") { + return []; + } + if (asyncMode.isFullAsync) { + return; + } + return values({ ...params }); + } + buildRichSelectParams(asyncMode = this.resolveAsyncMode()) { + const params = this.params; + const { + cellRenderer, + cellRendererParams, + cellHeight, + value, + values, + formatValue, + searchDebounceDelay, + valueListGap, + valueListMaxHeight, + valueListMaxWidth, + allowTyping, + filterList, + searchType, + highlightMatch, + eventKey, + multiSelect, + suppressDeselectAll, + suppressMultiSelectPillRenderer + } = params; + const { isValuesPaged, isFullAsync } = asyncMode; + const formatValueFn = formatValue ?? ((value2) => String(value2 ?? "")); + const valueFormatter = (value2) => { + if (Array.isArray(value2)) { + return value2.map((currentValue) => formatValueFn(currentValue)).join(", "); + } + return formatValueFn(value2); + }; + const ret = { + value, + cellRenderer, + cellRendererParams, + cellRowHeight: cellHeight, + searchDebounceDelay, + valueFormatter, + pickerAriaLabelKey: "ariaLabelRichSelectField", + pickerAriaLabelValue: "Rich Select Field", + pickerType: "virtual-list", + pickerGap: valueListGap, + allowTyping, + filterList, + searchType, + highlightMatch, + maxPickerHeight: valueListMaxHeight, + maxPickerWidth: valueListMaxWidth, + placeholder: this.getPlaceholderText(isFullAsync), + initialInputValue: eventKey?.length === 1 ? eventKey : eventKey === KeyCode25.BACKSPACE ? "" : void 0, + multiSelect, + suppressDeselectAll, + suppressMultiSelectPillRenderer + }; + const valueList = this.getInitialValueList(asyncMode); + const isSync = Array.isArray(values); + const isValuesCallback = typeof values === "function"; + if (isValuesPaged) { + if (valueList) { + ret.valueList = valueList; + } + if (isFullAsync) { + ret.allowNoResultsCopy = true; + ret.filterList = true; + } + } else if (isSync) { + ret.valueList = valueList; + ret.searchStringCreator = this.getSearchStringCallback(valueList); + } else if (isValuesCallback && isFullAsync) { + ret.allowNoResultsCopy = true; + ret.filterList = true; + } + return { params: ret, valueList }; + } + getAsyncValuesSource(asyncMode = this.resolveAsyncMode()) { + const { isFullAsync, isValuesPaged } = asyncMode; + if (!isFullAsync && !isValuesPaged) { + return; + } + return { + searchValues: isFullAsync ? (searchString) => this.getAsyncSearchValues(searchString) : void 0, + loadValuesPage: isValuesPaged ? (request) => this.getAsyncValuesPage(request) : void 0, + valuesPageInitialStartRow: isValuesPaged ? (searchString) => this.resolveValuesPageInitialStartRow(searchString) : void 0, + valuesPageSize: isValuesPaged ? this.params.valuesPageSize : void 0 + }; + } + getAsyncSearchValues(searchString) { + const { values } = this.params; + if (typeof values !== "function") { + return []; + } + return values({ + ...this.params, + search: searchString + }); + } + getAsyncValuesPage(request) { + const { valuesPage } = this.params; + if (typeof valuesPage !== "function") { + return { values: [] }; + } + return valuesPage({ + ...this.params, + search: request.search, + startRow: request.startRow, + endRow: request.endRow, + cursor: request.cursor + }); + } + resolveValuesPageInitialStartRow(searchString) { + if (searchString) { + return 0; + } + const { valuesPageInitialStartRow, value } = this.params; + const startRow = typeof valuesPageInitialStartRow === "function" ? valuesPageInitialStartRow(value) : valuesPageInitialStartRow; + return Math.max(Math.floor(startRow ?? 0), 0); + } + getSearchStringCallback(values) { + if (typeof values[0] !== "object") { + return; + } + const params = this.params; + const { colDef, formatValue } = params; + const formatValueFn = formatValue ?? ((value) => String(value ?? "")); + if (colDef.cellEditorParams?.formatValue) { + return (values2) => values2.map(formatValueFn); + } + const { keyCreator } = colDef; + if (keyCreator) { + _warn16(266); + const { column, node, data } = params; + return (values2) => values2.map((value) => { + const keyParams = _addGridCommonParams11(this.gos, { + value, + colDef, + column, + node, + data + }); + return keyCreator(keyParams); + }); + } + return (values2) => values2.map(formatValueFn); + } + // we need to have the gui attached before we can draw the virtual rows, as the + // virtual row logic needs info about the gui state. + afterGuiAttached() { + const { focusAfterAttached, params } = this; + setTimeout(() => { + if (!this.isAlive()) { + return; + } + const richSelect = this.eEditor; + const { allowTyping, eventKey, cellStartedEdit } = params; + if (focusAfterAttached) { + const focusableEl = richSelect.getFocusableElement(); + focusableEl.focus(); + if (allowTyping && (!eventKey || eventKey.length !== 1)) { + focusableEl.select(); + } + } + if (cellStartedEdit) { + richSelect.showPicker(); + } + if (this.pendingInitialEventKey == null) { + this.consumeInitialEventKey(eventKey); + } + }); + } + consumeInitialEventKey(eventKey) { + if (!eventKey || this.initialEventKeyProcessed) { + return; + } + this.initialEventKeyProcessed = true; + this.processEventKey(eventKey); + } + processEventKey(eventKey) { + if (!eventKey) { + return; + } + if (eventKey === KeyCode25.BACKSPACE) { + this.eEditor.searchTextFromString(null); + } else if (eventKey?.length === 1) { + this.eEditor.searchTextFromString(eventKey); + } + } + focusIn() { + this.eEditor.getFocusableElement().focus(); + } + agSetEditValue(value) { + this.params.value = value; + this.eEditor.setValue(value ?? null, true); + } + getValue() { + const { params } = this; + const value = this.eEditor.getValue(); + return params.parseValue?.(value) ?? value; + } + isPopup() { + return false; + } + getValidationElement() { + return this.eEditor.getAriaElement(); + } + getValidationErrors() { + const { params } = this; + const { getValidationErrors } = params; + if (!getValidationErrors) { + return null; + } + return getValidationErrors({ + value: this.getValue(), + internalErrors: null, + cellEditorParams: params + }); + } +}; + +// packages/ag-grid-enterprise/src/richSelect/richSelectModule.ts +var RichSelectModule = { + moduleName: "RichSelect", + version: VERSION, + beans: [], + userComponents: { agRichSelect: RichSelectCellEditor, agRichSelectCellEditor: RichSelectCellEditor }, + icons: { + // open icon for rich select editor + richSelectOpen: "small-down", + // remove for rich select editor pills + richSelectRemove: "cancel", + // loading async values + richSelectLoading: "loading" + }, + dependsOn: [EnterpriseCoreModule, _EditCoreModule] +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterModule.ts +import { _ColumnFilterModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/setFilter/setFilter.ts +import { + AgInputTextFieldSelector as AgInputTextFieldSelector6, + KeyCode as KeyCode26, + ProvidedFilter, + RefPlaceholder as RefPlaceholder30, + _areEqual as _areEqual4, + _createIconNoSpan as _createIconNoSpan18, + _exists as _exists15, + _getActiveDomElement as _getActiveDomElement10, + _makeNull as _makeNull4, + _setDisplayed as _setDisplayed16, + _warn as _warn20 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/setFilter/iSetDisplayValueModel.ts +var SET_FILTER_SELECT_ALL = "__AG_SELECT_ALL__"; +var SET_FILTER_ADD_SELECTION_TO_FILTER = "__AG_ADD_SELECTION_TO_FILTER__"; + +// packages/ag-grid-enterprise/src/setFilter/flatSetDisplayValueModel.ts +var FlatSetDisplayValueModel = class { + constructor(valueSvc, getValueFormatter, formatter, column) { + this.valueSvc = valueSvc; + this.getValueFormatter = getValueFormatter; + this.formatter = formatter; + this.column = column; + /** All keys that are currently displayed, after the mini-filter has been applied. */ + this.displayedKeys = []; + } + updateDisplayedValuesToAllAvailable(_getValue, _allKeys, availableKeys) { + this.displayedKeys = Array.from(availableKeys); + } + updateDisplayedValuesToMatchMiniFilter(getValue, _allKeys, availableKeys, matchesFilter, nullMatchesFilter) { + this.displayedKeys = []; + const valueFormatter = this.getValueFormatter(); + for (const key of availableKeys) { + if (key == null) { + if (nullMatchesFilter) { + this.displayedKeys.push(key); + } + } else { + const value = getValue(key); + const valueFormatterValue = this.valueSvc.formatValue(this.column, null, value, valueFormatter, false); + const textFormatterValue = this.formatter(valueFormatterValue); + if (matchesFilter(textFormatterValue)) { + this.displayedKeys.push(key); + } + } + } + } + getDisplayedValueCount() { + return this.displayedKeys.length; + } + getDisplayedItem(index) { + return this.displayedKeys[index]; + } + getSelectAllItem() { + return SET_FILTER_SELECT_ALL; + } + getAddSelectionToFilterItem() { + return SET_FILTER_ADD_SELECTION_TO_FILTER; + } + getDisplayedKeys() { + return this.displayedKeys; + } + forEachDisplayedKey(func) { + this.displayedKeys.forEach(func); + } + someDisplayedKey(func) { + return this.displayedKeys.some(func); + } + hasGroups() { + return false; + } + refresh() { + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterListItem.ts +import { + AgCheckboxSelector as AgCheckboxSelector5, + Component as Component31, + RefPlaceholder as RefPlaceholder29, + _addGridCommonParams as _addGridCommonParams12, + _createIcon as _createIcon2, + _getCellRendererDetails, + _getShouldDisplayTooltip as _getShouldDisplayTooltip3, + _isShowTooltipWhenTruncated, + _setAriaChecked as _setAriaChecked2, + _setAriaDescribedBy as _setAriaDescribedBy4, + _setAriaExpanded as _setAriaExpanded7, + _setAriaLabel as _setAriaLabel14, + _setAriaLabelledBy as _setAriaLabelledBy3, + _setAriaLevel as _setAriaLevel4, + _setDisplayed as _setDisplayed15, + _toStringOrNull as _toStringOrNull3, + _warn as _warn17 +} from "ag-grid-community"; +var SetFilterGroupElement = { + tag: "div", + cls: "ag-set-filter-item", + attrs: { "aria-hidden": "true" }, + children: [ + { + tag: "span", + cls: "ag-set-filter-group-icons", + children: [ + { tag: "span", ref: "eGroupClosedIcon", cls: "ag-set-filter-group-closed-icon" }, + { tag: "span", ref: "eGroupOpenedIcon", cls: "ag-set-filter-group-opened-icon" }, + { tag: "span", ref: "eGroupIndeterminateIcon", cls: "ag-set-filter-group-indeterminate-icon" } + ] + }, + { tag: "ag-checkbox", ref: "eCheckbox", cls: "ag-set-filter-item-checkbox" } + ] +}; +var SetFilterElement = { + tag: "div", + cls: "ag-set-filter-item", + children: [{ tag: "ag-checkbox", ref: "eCheckbox", cls: "ag-set-filter-item-checkbox" }] +}; +var SetFilterListItem = class extends Component31 { + constructor(params) { + super(params.isGroup ? SetFilterGroupElement : SetFilterElement, [AgCheckboxSelector5]); + this.eCheckbox = RefPlaceholder29; + this.eGroupOpenedIcon = RefPlaceholder29; + this.eGroupClosedIcon = RefPlaceholder29; + this.eGroupIndeterminateIcon = RefPlaceholder29; + this.formattedValue = null; + this.focusWrapper = params.focusWrapper; + this.value = params.value; + this.params = params.params; + this.translate = params.translate; + this.valueFormatter = params.valueFormatter; + this.item = params.item; + this.isSelected = params.isSelected; + this.isTree = params.isTree; + this.depth = params.depth ?? 0; + this.isGroup = params.isGroup; + this.groupsExist = params.groupsExist; + this.isExpanded = params.isExpanded; + this.hasIndeterminateExpandState = params.hasIndeterminateExpandState; + } + postConstruct() { + this.tooltipFeature = this.createOptionalManagedBean( + this.beans.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.focusWrapper, + getLocation: () => "setFilterValue", + shouldDisplayTooltip: () => this.shouldDisplayTooltip?.() ?? true, + getAdditionalParams: () => { + const { colDef, column } = this.params; + const additionalParams = { + colDef, + column, + valueFormatted: this.formattedValue ?? void 0 + }; + if (this.isTree) { + additionalParams.level = this.depth; + } + return additionalParams; + } + }) + ); + this.addDestroyFunc(() => this.destroyCellRendererComponent?.()); + this.render(); + this.eCheckbox.setLabelEllipsis(true).setValue(this.isSelected, true).setDisabled(!!this.params.readOnly).getInputElement().setAttribute("tabindex", "-1"); + this.refreshVariableAriaLabels(); + if (this.isTree) { + if (this.depth > 0) { + this.addCss("ag-set-filter-indent-" + this.depth); + this.getGui().style.setProperty("--ag-indentation-level", String(this.depth)); + } + if (this.isGroup) { + this.setupExpansion(); + } else if (this.groupsExist) { + this.addCss("ag-set-filter-add-group-indent"); + } + _setAriaLevel4(this.getAriaElement(), this.depth + 1); + } + this.refreshAriaChecked(); + if (this.params.readOnly) { + return; + } + this.eCheckbox.onValueChange((value) => this.onCheckboxChanged(!!value)); + } + getFocusableElement() { + return this.focusWrapper; + } + setupExpansion() { + const { eGroupClosedIcon, eGroupOpenedIcon, eGroupIndeterminateIcon, hasIndeterminateExpandState, beans } = this; + eGroupClosedIcon.appendChild(_createIcon2("setFilterGroupClosed", beans, null)); + eGroupOpenedIcon.appendChild(_createIcon2("setFilterGroupOpen", beans, null)); + const listener = this.onExpandOrContractClicked.bind(this); + this.addManagedElementListeners(eGroupClosedIcon, { click: listener }); + this.addManagedElementListeners(eGroupOpenedIcon, { click: listener }); + if (hasIndeterminateExpandState) { + eGroupIndeterminateIcon.appendChild(_createIcon2("setFilterGroupIndeterminate", beans, null)); + this.addManagedElementListeners(eGroupIndeterminateIcon, { + click: listener + }); + } + this.setExpandedIcons(); + this.refreshAriaExpanded(); + } + onExpandOrContractClicked() { + this.setExpanded(!this.isExpanded); + } + setExpanded(isExpanded, silent) { + if (this.isGroup && isExpanded !== this.isExpanded) { + this.isExpanded = isExpanded; + const event = { + type: "expandedChanged", + isExpanded: !!isExpanded, + item: this.item + }; + if (!silent) { + this.dispatchLocalEvent(event); + } + this.setExpandedIcons(); + this.refreshAriaExpanded(); + } + } + setExpandedIcons() { + const { isExpanded, hasIndeterminateExpandState, eGroupClosedIcon, eGroupOpenedIcon, eGroupIndeterminateIcon } = this; + _setDisplayed15(eGroupClosedIcon, hasIndeterminateExpandState ? isExpanded === false : !isExpanded); + _setDisplayed15(eGroupOpenedIcon, isExpanded === true); + if (hasIndeterminateExpandState) { + _setDisplayed15(eGroupIndeterminateIcon, isExpanded === void 0); + } + } + onCheckboxChanged(isSelected) { + this.isSelected = isSelected; + const event = { + type: "selectionChanged", + isSelected, + item: this.item + }; + this.dispatchLocalEvent(event); + this.refreshVariableAriaLabels(); + this.refreshAriaChecked(); + } + toggleSelected() { + if (this.params.readOnly) { + return; + } + this.setSelected(!this.isSelected); + } + setSelected(isSelected, silent) { + this.isSelected = isSelected; + this.eCheckbox.setValue(isSelected, silent); + this.refreshAriaChecked(); + } + refreshVariableAriaLabels() { + if (!this.isTree) { + return; + } + const translate = this.getLocaleTextFunc(); + const checkboxValue = this.eCheckbox.getValue(); + const state = checkboxValue === void 0 ? translate("ariaIndeterminate", "indeterminate") : checkboxValue ? translate("ariaVisible", "visible") : translate("ariaHidden", "hidden"); + const visibilityLabel = translate("ariaToggleVisibility", "Press SPACE to toggle visibility"); + _setAriaLabelledBy3(this.eCheckbox.getInputElement(), void 0); + this.eCheckbox.setInputAriaLabel(`${visibilityLabel} (${state})`); + } + setupFixedAriaLabels(value) { + if (!this.isTree) { + return; + } + const translate = this.getLocaleTextFunc(); + const itemLabel = translate("ariaFilterValue", "Filter Value"); + const ariaEl = this.getAriaElement(); + _setAriaLabel14(ariaEl, `${value} ${itemLabel}`); + _setAriaDescribedBy4(ariaEl, this.eCheckbox.getInputElement().id); + } + refreshAriaChecked() { + const ariaEl = this.getAriaElement(); + _setAriaChecked2(ariaEl, this.eCheckbox.getValue()); + } + refreshAriaExpanded() { + _setAriaExpanded7(this.getAriaElement(), !!this.isExpanded); + } + refresh(item, isSelected, isExpanded) { + this.item = item; + if (isSelected !== this.isSelected) { + this.setSelected(isSelected, true); + } + this.setExpanded(isExpanded, true); + const { cellRendererComponent, cellRendererParams, beans, params } = this; + if (this.valueFunction) { + const value = this.valueFunction(); + this.setTooltipAndCellRendererParams(value, value); + if (!cellRendererComponent) { + this.renderCellWithoutCellRenderer(); + } + } + if (cellRendererComponent) { + const compDetails = _getCellRendererDetails(beans.userCompFactory, params, cellRendererParams); + const success = cellRendererComponent.refresh?.(compDetails?.params ?? cellRendererParams); + if (!success) { + const oldComponent = cellRendererComponent; + this.renderCell(); + this.destroyBean(oldComponent); + } + } + } + render() { + const { + params: { column } + } = this; + let { value } = this; + let formattedValue = null; + if (typeof value === "function") { + this.valueFunction = value; + formattedValue = this.valueFunction(); + value = formattedValue; + } else if (this.isTree) { + formattedValue = _toStringOrNull3(value); + } else { + formattedValue = this.getFormattedValue(column, value); + } + this.formattedValue = formattedValue; + this.setTooltipAndCellRendererParams(value, formattedValue); + this.renderCell(); + } + setTooltipAndCellRendererParams(value, formattedValue) { + const gos = this.gos; + if (this.params.showTooltips && (!_isShowTooltipWhenTruncated(gos) || !this.params.cellRenderer)) { + const newTooltipText = formattedValue != null ? formattedValue : _toStringOrNull3(value); + this.shouldDisplayTooltip = _getShouldDisplayTooltip3( + gos, + () => this.eCheckbox.getGui().querySelector(".ag-label") + ); + this.tooltipFeature?.setTooltipAndRefresh(newTooltipText); + } + this.cellRendererParams = _addGridCommonParams12(gos, { + value, + valueFormatted: formattedValue, + colDef: this.params.colDef, + column: this.params.column, + setTooltip: (value2, shouldDisplayTooltip) => { + gos.assertModuleRegistered("Tooltip", 3); + this.shouldDisplayTooltip = shouldDisplayTooltip; + this.tooltipFeature?.setTooltipAndRefresh(value2); + } + }); + } + getFormattedValue(column, value) { + return this.beans.valueSvc.formatValue(column, null, value, this.valueFormatter, false); + } + renderCell() { + const compDetails = _getCellRendererDetails(this.beans.userCompFactory, this.params, this.cellRendererParams); + const cellRendererPromise = compDetails?.newAgStackInstance(); + if (cellRendererPromise == null) { + this.renderCellWithoutCellRenderer(); + return; + } + cellRendererPromise.then((component) => { + if (component) { + this.cellRendererComponent = component; + this.eCheckbox.setLabel(component.getGui()); + this.destroyCellRendererComponent = () => this.destroyBean(component); + } + }); + } + renderCellWithoutCellRenderer() { + const { valueFormatted, value } = this.cellRendererParams; + let valueToRender = (valueFormatted == null ? value : valueFormatted) ?? this.translate("blanks"); + if (typeof valueToRender !== "string") { + _warn17(208); + valueToRender = ""; + } + this.eCheckbox.setLabel(valueToRender); + this.setupFixedAriaLabels(valueToRender); + } + getComponentHolder() { + return this.params.column.getColDef(); + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterUtils.ts +import { _defaultComparator, _last as _last7, _makeNull as _makeNull3, _toStringOrNull as _toStringOrNull4, _translate, _warn as _warn18 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/setFilter/localeText.ts +var DEFAULT_LOCALE_TEXT = { + loadingOoo: "Loading...", + blanks: "(Blanks)", + searchOoo: "Search...", + selectAll: "(Select All)", + selectAllSearchResults: "(Select All Search Results)", + addCurrentSelectionToFilter: "Add current selection to filter", + noMatches: "No matches.", + ariaSearchFilterValues: "Search filter values", + ariaFilterList: "Filter List", + filterSummaryListInactive: "is (All)", + filterSummaryListSeparator: ", ", + filterSummaryListShort: (variableValues) => `is (${variableValues[0]})`, + filterSummaryListLong: (variableValues) => `is (${variableValues[0]}) and ${variableValues[1]} more` +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterUtils.ts +function processDataPath(dataPath, treeData, groupAllowUnbalanced) { + let processedDataPath = dataPath; + if (!processedDataPath) { + return null; + } + processedDataPath = processedDataPath.map((treeKey) => _toStringOrNull4(_makeNull3(treeKey))); + if (!treeData && groupAllowUnbalanced && processedDataPath.some((treeKey) => treeKey == null)) { + if (_last7(processedDataPath) == null) { + return null; + } + return processedDataPath.filter((treeKey) => treeKey != null); + } + return processedDataPath; +} +function translateForSetFilter(bean, key, variableValues) { + return _translate(bean, DEFAULT_LOCALE_TEXT, key, variableValues); +} +function applyExcelModeOptions(params) { + if (params.excelMode === "windows") { + if (!params.buttons) { + params.buttons = ["apply", "cancel"]; + } + if (params.closeOnApply == null) { + params.closeOnApply = true; + } + } else if (params.excelMode === "mac") { + if (!params.buttons) { + params.buttons = ["reset"]; + } + if (params.applyMiniFilterWhileTyping == null) { + params.applyMiniFilterWhileTyping = true; + } + if (params.debounceMs == null) { + params.debounceMs = 500; + } + } + if (params.excelMode && params.defaultToNothingSelected) { + params.defaultToNothingSelected = false; + _warn18(207); + } +} +function createTreeDataOrGroupingComparator() { + return ([_aKey, aValue], [_bKey, bValue]) => { + if (aValue == null) { + return bValue == null ? 0 : -1; + } else if (bValue == null) { + return 1; + } + for (let i = 0; i < aValue.length; i++) { + if (i >= bValue.length) { + return 1; + } + const diff = _defaultComparator(aValue[i], bValue[i]); + if (diff !== 0) { + return diff; + } + } + return 0; + }; +} + +// packages/ag-grid-enterprise/src/setFilter/treeSetDisplayValueModel.ts +import { _getDateParts, _warn as _warn19 } from "ag-grid-community"; +var TreeSetDisplayValueModel = class { + constructor(formatter, treeListPathGetter, treeListFormatter, treeDataOrGrouping) { + this.formatter = formatter; + this.treeListPathGetter = treeListPathGetter; + this.treeListFormatter = treeListFormatter; + this.treeDataOrGrouping = treeDataOrGrouping; + /** all displayed items in a tree structure */ + this.allDisplayedItemsTree = /* @__PURE__ */ new Map(); + /** all displayed items flattened and filtered */ + this.activeDisplayedItemsFlat = []; + this.selectAllItem = { + depth: 0, + filterPasses: true, + available: true, + treeKey: SET_FILTER_SELECT_ALL, + children: this.allDisplayedItemsTree, + expanded: true, + key: SET_FILTER_SELECT_ALL, + parentTreeKeys: [] + }; + this.addSelectionToFilterItem = { + depth: 0, + filterPasses: true, + available: true, + treeKey: SET_FILTER_ADD_SELECTION_TO_FILTER, + expanded: true, + key: SET_FILTER_ADD_SELECTION_TO_FILTER, + parentTreeKeys: [] + }; + } + updateParams(treeListPathGetter, treeListFormatter) { + this.treeListPathGetter = treeListPathGetter; + this.treeListFormatter = treeListFormatter; + } + updateDisplayedValuesToAllAvailable(getValue, allKeys, availableKeys, source) { + if (source === "reload") { + this.generateItemTree(getValue, allKeys, availableKeys); + } else if (source === "otherFilter") { + this.updateAvailable(availableKeys); + this.updateExpandAll(); + } else if (source === "miniFilter") { + this.resetFilter(); + this.updateExpandAll(); + } + this.flattenItems(); + } + updateDisplayedValuesToMatchMiniFilter(getValue, allKeys, availableKeys, matchesFilter, nullMatchesFilter, source) { + if (source === "reload") { + this.generateItemTree(getValue, allKeys, availableKeys); + } else if (source === "otherFilter") { + this.updateAvailable(availableKeys); + } + this.updateFilter(matchesFilter, nullMatchesFilter); + this.updateExpandAll(); + this.flattenItems(); + } + generateItemTree(getValue, allKeys, availableKeys) { + const allDisplayedItemsTree = /* @__PURE__ */ new Map(); + this.allDisplayedItemsTree = allDisplayedItemsTree; + let groupsExist = false; + const treeListPathGetter = this.getTreeListPathGetter(getValue, availableKeys); + for (const key of allKeys) { + const value = getValue(key); + const dataPath = treeListPathGetter(value) ?? [null]; + const dataPathLength = dataPath.length; + if (dataPathLength > 1) { + groupsExist = true; + } + const available = availableKeys.has(key); + let children = allDisplayedItemsTree; + let item; + let parentTreeKeys = []; + for (let depth = 0; depth < dataPathLength; depth++) { + const treeKey = dataPath[depth]; + if (!children) { + children = /* @__PURE__ */ new Map(); + item.children = children; + } + const treeKeyUpper = treeKey?.toUpperCase() ?? null; + item = children.get(treeKeyUpper); + if (!item) { + item = { + treeKey, + depth, + filterPasses: true, + expanded: false, + available, + parentTreeKeys + }; + if (depth === dataPath.length - 1) { + item.key = key; + } + children.set(treeKeyUpper, item); + } + children = item.children; + parentTreeKeys = [...parentTreeKeys, treeKey]; + } + } + this.groupsExist = groupsExist; + this.updateAvailable(availableKeys); + this.selectAllItem.children = allDisplayedItemsTree; + this.selectAllItem.expanded = false; + } + getTreeListPathGetter(getValue, availableKeys) { + if (this.treeListPathGetter) { + return this.treeListPathGetter; + } + if (this.treeDataOrGrouping) { + return (value) => value; + } + let isDate = false; + for (const availableKey of availableKeys) { + const value = getValue(availableKey); + if (value instanceof Date) { + isDate = true; + break; + } else if (value != null) { + break; + } + } + if (isDate) { + return (value) => _getDateParts(value, false); + } + _warn19(211); + return (value) => [String(value)]; + } + flattenItems() { + this.activeDisplayedItemsFlat = []; + const recursivelyFlattenDisplayedItems = (items) => { + for (const item of items.values()) { + if (!item.filterPasses || !item.available) { + continue; + } + this.activeDisplayedItemsFlat.push(item); + if (item.children && item.expanded) { + recursivelyFlattenDisplayedItems(item.children); + } + } + }; + recursivelyFlattenDisplayedItems(this.allDisplayedItemsTree); + } + resetFilter() { + const recursiveFilterReset = (item) => { + const children = item.children; + if (children) { + for (const child of children.values()) { + recursiveFilterReset(child); + } + } + item.filterPasses = true; + }; + for (const item of this.allDisplayedItemsTree.values()) { + recursiveFilterReset(item); + } + } + updateFilter(matchesFilter, nullMatchesFilter) { + const passesFilter = (item) => { + if (!item.available) { + return false; + } + if (item.treeKey == null) { + return nullMatchesFilter; + } + return matchesFilter( + this.formatter( + this.treeListFormatter ? this.treeListFormatter(item.treeKey, item.depth, item.parentTreeKeys) : item.treeKey + ) + ); + }; + for (const item of this.allDisplayedItemsTree.values()) { + this.recursiveItemCheck(item, false, passesFilter, "filterPasses"); + } + } + getDisplayedValueCount() { + return this.activeDisplayedItemsFlat.length; + } + getDisplayedItem(index) { + return this.activeDisplayedItemsFlat[index]; + } + getSelectAllItem() { + return this.selectAllItem; + } + getAddSelectionToFilterItem() { + return this.addSelectionToFilterItem; + } + getDisplayedKeys() { + const displayedKeys = []; + this.forEachDisplayedKey((key) => displayedKeys.push(key)); + return displayedKeys; + } + forEachDisplayedKey(func) { + const recursiveForEachItem = (item, topParentExpanded) => { + const children = item.children; + if (children) { + if (!item.expanded || !topParentExpanded) { + for (const child of children.values()) { + if (child.filterPasses) { + recursiveForEachItem(child, false); + } + } + } + } else { + func(item.key); + } + }; + for (const item of this.activeDisplayedItemsFlat) { + recursiveForEachItem(item, true); + } + } + someDisplayedKey(func) { + const recursiveSomeItem = (item, topParentExpanded) => { + const children = item.children; + if (children) { + if (!item.expanded || !topParentExpanded) { + for (const child of children.values()) { + if (child.filterPasses && recursiveSomeItem(child, false)) { + return true; + } + } + return false; + } + } else { + return func(item.key); + } + return false; + }; + return this.activeDisplayedItemsFlat.some((item) => recursiveSomeItem(item, true)); + } + hasGroups() { + return this.groupsExist; + } + refresh() { + this.updateExpandAll(); + this.flattenItems(); + } + updateExpandAll() { + const recursiveExpansionCheck = (items, someTrue, someFalse) => { + for (const item2 of items.values()) { + if (!item2.filterPasses || !item2.available || !item2.children) { + continue; + } + someTrue = someTrue || !!item2.expanded; + someFalse = someFalse || !item2.expanded; + if (someTrue && someFalse) { + return void 0; + } + const childExpanded = recursiveExpansionCheck(item2.children, someTrue, someFalse); + if (childExpanded === void 0) { + return void 0; + } else if (childExpanded) { + someTrue = true; + } else { + someFalse = true; + } + } + return someTrue && someFalse ? void 0 : someTrue; + }; + const item = this.getSelectAllItem(); + item.expanded = recursiveExpansionCheck(item.children, false, false); + } + recursiveItemCheck(item, parentPasses, checkFunction, itemProp) { + let atLeastOneChildPassed = false; + const children = item.children; + if (children) { + for (const child of children.values()) { + const childPasses = this.recursiveItemCheck( + child, + parentPasses || checkFunction(item), + checkFunction, + itemProp + ); + atLeastOneChildPassed = atLeastOneChildPassed || childPasses; + } + } + const itemPasses = parentPasses || atLeastOneChildPassed || checkFunction(item); + item[itemProp] = itemPasses; + return itemPasses; + } + updateAvailable(availableKeys) { + const isAvailable = (item) => availableKeys.has(item.key); + for (const item of this.allDisplayedItemsTree.values()) { + this.recursiveItemCheck(item, false, isAvailable, "available"); + } + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilter.ts +var SetFilter = class extends ProvidedFilter { + constructor() { + super("setFilter", "set-filter"); + this.filterType = "set"; + this.eMiniFilter = RefPlaceholder30; + this.eFilterLoading = RefPlaceholder30; + this.eFilterLoadingIcon = RefPlaceholder30; + this.eSetFilterList = RefPlaceholder30; + this.eFilterNoMatches = RefPlaceholder30; + this.hardRefreshVirtualList = false; + this.miniFilterText = null; + /** When true, in excelMode = 'windows', it adds previously selected filter items to newly checked filter selection */ + this.addCurrentSelectionToFilter = false; + /** Keys that have been selected for this filter. */ + this.selectedKeys = /* @__PURE__ */ new Set(); + } + setParams(params) { + super.setParams(params); + const handler = this.updateHandler(params.getHandler()); + const { column, textFormatter, treeList, treeListPathGetter, treeListFormatter } = params; + this.formatter = textFormatter ?? ((value) => value ?? null); + this.displayValueModel = treeList ? new TreeSetDisplayValueModel( + this.formatter, + treeListPathGetter, + treeListFormatter, + handler.isTreeDataOrGrouping() + ) : new FlatSetDisplayValueModel( + this.beans.valueSvc, + () => this.handler.valueFormatter, + this.formatter, + column + ); + handler.valueModel.allKeys.then((values) => { + if (!this.isAlive()) { + return; + } + this.updateDisplayedValues("reload", values ?? []); + this.resetSelectionState(values ?? []); + }); + if (handler.valueModel.isLoading()) { + this.setIsLoading(true); + } + this.initialiseFilterBodyUi(); + } + refresh(legacyNewParams) { + if (this.params.treeList !== legacyNewParams.treeList) { + return false; + } + this.updateHandler( + legacyNewParams.getHandler() + ); + return super.refresh(legacyNewParams); + } + updateParams(newParams, oldParams) { + super.updateParams(newParams, oldParams); + this.updateMiniFilter(); + if (newParams.suppressSelectAll !== oldParams.suppressSelectAll) { + this.createVirtualListModel(newParams); + } + const { textFormatter, treeListPathGetter, treeListFormatter } = newParams; + this.formatter = textFormatter ?? ((value) => value ?? null); + if (this.displayValueModel instanceof TreeSetDisplayValueModel) { + this.displayValueModel.updateParams(treeListPathGetter, treeListFormatter); + } + this.handler.refreshFilterValues(true); + } + updateHandler(handler) { + const oldHandler = this.handler; + if (oldHandler !== handler) { + for (const func of this.handlerDestroyFuncs ?? []) { + func(); + } + this.handlerDestroyFuncs = [ + ...this.addManagedListeners(handler, { + anyFilterChanged: (event) => { + handler.valueModel.allKeys.then((values) => { + if (this.isAlive()) { + this.updateDisplayedValues("otherFilter", values ?? []); + if (event.updated) { + this.checkAndRefreshVirtualList(); + this.showOrHideResults(); + } + } + }); + }, + dataChanged: ({ hardRefresh }) => { + handler.valueModel.allKeys.then((values) => { + if (this.isAlive()) { + this.updateDisplayedValues("reload", values ?? []); + this.setSelectedModel(this.state.model?.values ?? null); + if (hardRefresh) { + this.hardRefreshVirtualList = true; + } + this.checkAndRefreshVirtualList(); + } + }); + } + }), + ...this.addManagedListeners(handler.valueModel, { + loadingStart: () => this.setIsLoading(true), + loadingEnd: () => this.setIsLoading(false) + }) + ]; + this.handler = handler; + } + return handler; + } + updateUiVisibility() { + } + createBodyTemplate() { + return { + tag: "div", + cls: "ag-set-filter", + children: [ + { + tag: "div", + ref: "eFilterLoading", + cls: "ag-filter-loading ag-loading ag-hidden", + children: [ + { tag: "span", ref: "eFilterLoadingIcon", cls: "ag-loading-icon" }, + { tag: "span", cls: "ag-loading-text", children: translateForSetFilter(this, "loadingOoo") } + ] + }, + { tag: "ag-input-text-field", ref: "eMiniFilter", cls: "ag-mini-filter" }, + { + tag: "div", + ref: "eFilterNoMatches", + cls: "ag-filter-no-matches ag-hidden", + children: translateForSetFilter(this, "noMatches") + }, + { tag: "div", ref: "eSetFilterList", cls: "ag-set-filter-list", role: "presentation" } + ] + }; + } + getAgComponents() { + return [AgInputTextFieldSelector6]; + } + handleKeyDown(e) { + super.handleKeyDown(e); + if (e.defaultPrevented) { + return; + } + const getComponentForKeyEvent = () => { + if (!this.eSetFilterList.contains(_getActiveDomElement10(this.beans))) { + return; + } + const currentItem = this.virtualList.getLastFocusedRow(); + if (currentItem == null) { + return; + } + const component = this.virtualList.getComponentAt(currentItem); + if (component == null) { + return; + } + e.preventDefault(); + const { readOnly } = this.params; + if (readOnly) { + return; + } + return component; + }; + switch (e.key) { + case KeyCode26.SPACE: + getComponentForKeyEvent()?.toggleSelected(); + break; + case KeyCode26.ENTER: + this.handleKeyEnter(e); + break; + case KeyCode26.LEFT: + getComponentForKeyEvent()?.setExpanded(false); + break; + case KeyCode26.RIGHT: + getComponentForKeyEvent()?.setExpanded(true); + break; + } + } + handleKeyEnter(e) { + e.preventDefault(); + const { excelMode, readOnly } = this.params; + if (!excelMode || !!readOnly) { + return; + } + this.params.onAction("apply", void 0, e); + if (this.params.excelMode === "mac") { + this.eMiniFilter.getInputElement().select(); + } + } + setModelAndRefresh(values) { + return this.setSelectedModel(values).then(() => { + if (this.isAlive()) { + this.checkAndRefreshVirtualList(); + } + }); + } + setModelIntoUi(model) { + this.setMiniFilter(this.params.state.state?.miniFilterValue ?? null, true); + const values = model == null ? null : model.values; + return this.setModelAndRefresh(values); + } + getModelFromUi() { + const values = this.getSelectedModel(); + if (!values) { + return null; + } + return { values, filterType: this.filterType }; + } + areNonNullModelsEqual(a, b) { + return _areEqual4(a.values, b.values); + } + setIsLoading(isLoading) { + _setDisplayed16(this.eFilterLoading, isLoading); + if (!isLoading) { + this.hardRefreshVirtualList = true; + } + } + initialiseFilterBodyUi() { + this.initVirtualList(); + this.initMiniFilter(); + this.initLoading(); + } + initLoading() { + const loadingIcon = _createIconNoSpan18("setFilterLoading", this.beans, this.params.column); + if (loadingIcon) { + this.eFilterLoadingIcon.appendChild(loadingIcon); + } + } + initVirtualList() { + const filterListName = translateForSetFilter(this, "ariaFilterList"); + const isTree = !!this.params.treeList; + const virtualList = this.virtualList = this.createBean( + new VirtualList({ + cssIdentifier: "filter", + ariaRole: isTree ? "tree" : "listbox", + listName: filterListName + }) + ); + const eSetFilterList = this.eSetFilterList; + if (isTree) { + eSetFilterList.classList.add("ag-set-filter-tree-list"); + } + eSetFilterList.appendChild(virtualList.getGui()); + const { cellHeight } = this.params; + if (cellHeight != null) { + virtualList.setRowHeight(cellHeight); + } + const componentCreator = (item, listItemElement) => this.createSetListItem(item, isTree, listItemElement); + virtualList.setComponentCreator(componentCreator); + const componentUpdater = (item, component) => this.updateSetListItem(item, component); + virtualList.setComponentUpdater(componentUpdater); + this.createVirtualListModel(this.params); + } + createVirtualListModel(params) { + let model; + if (params.suppressSelectAll) { + model = new ModelWrapper(this.displayValueModel); + } else { + model = new ModelWrapperWithSelectAll( + this.displayValueModel, + this.showAddCurrentSelectionToFilter.bind(this) + ); + } + if (params.treeList) { + model = new TreeModelWrapper(model); + } + this.virtualList.setModel(model); + } + getSelectAllLabel() { + const key = this.miniFilterText == null || !this.params.excelMode ? "selectAll" : "selectAllSearchResults"; + return translateForSetFilter(this, key); + } + getAddSelectionToFilterLabel() { + return translateForSetFilter(this, "addCurrentSelectionToFilter"); + } + createSetListItem(item, isTree, focusWrapper) { + const groupsExist = this.displayValueModel.hasGroups(); + const { isSelected, isExpanded } = this.isSelectedExpanded(item); + const { value, depth, isGroup, hasIndeterminateExpandState, selectedListener, expandedListener } = this.newSetListItemAttributes(item); + const itemParams = { + focusWrapper, + value, + params: this.params, + translate: (translateKey) => translateForSetFilter(this, translateKey), + valueFormatter: this.handler.valueFormatter, + item, + isSelected, + isTree, + depth, + groupsExist, + isGroup, + isExpanded, + hasIndeterminateExpandState + }; + const listItem = this.createBean(new SetFilterListItem(itemParams)); + listItem.addEventListener("selectionChanged", selectedListener); + if (expandedListener) { + listItem.addEventListener("expandedChanged", expandedListener); + } + return listItem; + } + newSetTreeItemAttributes(item) { + const groupsExist = this.displayValueModel.hasGroups(); + if (item.key === SET_FILTER_SELECT_ALL) { + return { + value: () => this.getSelectAllLabel(), + isGroup: groupsExist, + depth: item.depth, + hasIndeterminateExpandState: true, + selectedListener: (e) => this.onSelectAll(e.isSelected), + expandedListener: (e) => this.onExpandAll(e.item, e.isExpanded) + }; + } + if (item.key === SET_FILTER_ADD_SELECTION_TO_FILTER) { + return { + value: () => this.getAddSelectionToFilterLabel(), + depth: item.depth, + isGroup: false, + hasIndeterminateExpandState: false, + selectedListener: (e) => { + this.addCurrentSelectionToFilter = e.isSelected; + this.refreshAfterSelection(); + } + }; + } + if (item.children) { + return { + value: this.params.treeListFormatter?.(item.treeKey, item.depth, item.parentTreeKeys) ?? item.treeKey, + depth: item.depth, + isGroup: true, + selectedListener: (e) => this.onGroupItemSelected(e.item, e.isSelected), + expandedListener: (e) => this.onExpandedChanged(e.item, e.isExpanded) + }; + } + return { + value: this.params.treeListFormatter?.(item.treeKey, item.depth, item.parentTreeKeys) ?? item.treeKey, + depth: item.depth, + selectedListener: (e) => this.onItemSelected(e.item.key, e.isSelected) + }; + } + newSetListItemAttributes(item) { + if (this.isSetFilterModelTreeItem(item)) { + return this.newSetTreeItemAttributes(item); + } + if (item === SET_FILTER_SELECT_ALL) { + return { + value: () => this.getSelectAllLabel(), + selectedListener: (e) => this.onSelectAll(e.isSelected) + }; + } + if (item === SET_FILTER_ADD_SELECTION_TO_FILTER) { + return { + value: () => this.getAddSelectionToFilterLabel(), + selectedListener: (e) => { + this.addCurrentSelectionToFilter = e.isSelected; + this.refreshAfterSelection(); + } + }; + } + return { + value: this.handler.valueModel.allValues.get(item) ?? null, + selectedListener: (e) => this.onItemSelected(e.item, e.isSelected) + }; + } + updateSetListItem(item, component) { + const { isSelected, isExpanded } = this.isSelectedExpanded(item); + component.refresh(item, isSelected, isExpanded); + } + isSelectedExpanded(item) { + let isSelected; + let isExpanded; + if (this.isSetFilterModelTreeItem(item)) { + isExpanded = item.expanded; + if (item.key === SET_FILTER_SELECT_ALL) { + isSelected = this.isSelectAllSelected(); + } else if (item.key === SET_FILTER_ADD_SELECTION_TO_FILTER) { + isSelected = this.isAddCurrentSelectionToFilterChecked(); + } else if (item.children) { + isSelected = this.areAllChildrenSelected(item); + } else { + isSelected = this.selectedKeys.has(item.key); + } + } else if (item === SET_FILTER_SELECT_ALL) { + isSelected = this.isSelectAllSelected(); + } else if (item === SET_FILTER_ADD_SELECTION_TO_FILTER) { + isSelected = this.isAddCurrentSelectionToFilterChecked(); + } else { + isSelected = this.selectedKeys.has(item); + } + return { isSelected, isExpanded }; + } + isSetFilterModelTreeItem(item) { + return item?.treeKey !== void 0; + } + initMiniFilter() { + const { eMiniFilter } = this; + this.updateMiniFilter(); + eMiniFilter.onValueChange(() => this.onMiniFilterInput()); + eMiniFilter.setInputAriaLabel(translateForSetFilter(this, "ariaSearchFilterValues")); + this.addManagedElementListeners(eMiniFilter.getInputElement(), { + keydown: (e) => this.onMiniFilterKeyDown(e) + }); + } + updateMiniFilter() { + const { eMiniFilter, miniFilterText, params } = this; + eMiniFilter.setDisplayed(!params.suppressMiniFilter); + eMiniFilter.setValue(miniFilterText); + } + // we need to have the GUI attached before we can draw the virtual rows, as the + // virtual row logic needs info about the GUI state + afterGuiAttached(params) { + super.afterGuiAttached(params); + this.resetExpansion(); + this.refreshVirtualList(); + const { eMiniFilter } = this; + eMiniFilter.setInputPlaceholder(translateForSetFilter(this, "searchOoo")); + if (!params?.suppressFocus) { + if (eMiniFilter.isDisplayed()) { + eMiniFilter.getFocusableElement().focus(); + } else { + this.virtualList.awaitStable(() => this.virtualList.focusRow(0)); + } + } + } + afterGuiDetached() { + super.afterGuiDetached(); + const { column, excelMode, model, onStateChange } = this.params; + if (this.beans.colFilter?.shouldKeepStateOnDetach(column)) { + return; + } + if (excelMode) { + this.resetMiniFilter(); + } + if (excelMode || model !== this.state.model) { + onStateChange({ + model, + state: this.getState() + }); + this.showOrHideResults(); + } + } + canApply(model) { + return this.params.excelMode ? model == null || model.values.length > 0 : true; + } + /** + * @deprecated v34 Internal method - should only be called by the grid. + */ + onNewRowsLoaded() { + } + /** + * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead. + */ + setFilterValues(values) { + _warn20(283); + this.handler.setFilterValues(values); + } + /** + * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead. + */ + resetFilterValues() { + _warn20(283); + this.handler.resetFilterValues(); + } + /** + * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead. + */ + refreshFilterValues() { + _warn20(283); + this.doRefreshFilterValues(); + } + doRefreshFilterValues() { + this.handler.refreshFilterValues(); + } + /** + * @deprecated v34 Internal method - should only be called by the grid. + */ + onAnyFilterChanged() { + } + onMiniFilterInput(silent) { + if (!this.doSetMiniFilter(this.eMiniFilter.getValue())) { + return; + } + if (silent) { + this.showOrHideResults(); + return; + } + const { applyMiniFilterWhileTyping, readOnly, excelMode } = this.params; + const updateSelections = !readOnly && (applyMiniFilterWhileTyping || !!excelMode); + const apply = applyMiniFilterWhileTyping && !readOnly ? "debounce" : void 0; + this.updateUiAfterMiniFilterChange(updateSelections, apply); + } + updateUiAfterMiniFilterChange(updateSelections, apply) { + if (updateSelections) { + const { excelMode, readOnly, model } = this.params; + if (excelMode && !readOnly && this.miniFilterText == null) { + this.setModelAndRefresh(model?.values ?? null); + } else { + this.selectAllMatchingMiniFilter(true); + } + } + this.checkAndRefreshVirtualList(); + this.onUiChanged(updateSelections ? apply : "prevent"); + this.showOrHideResults(); + } + showOrHideResults() { + const hideResults = this.miniFilterText != null && this.displayValueModel.getDisplayedValueCount() < 1; + _setDisplayed16(this.eFilterNoMatches, hideResults); + _setDisplayed16(this.eSetFilterList, !hideResults); + } + resetMiniFilter() { + this.eMiniFilter.setValue(null, true); + this.doSetMiniFilter(null); + } + onMiniFilterKeyDown(e) { + const { excelMode, readOnly } = this.params; + if (e.key === KeyCode26.ENTER && !excelMode && !readOnly) { + this.updateUiAfterMiniFilterChange(true, "immediately"); + } + } + focusRowIfAlive(rowIndex) { + if (rowIndex == null) { + return Promise.resolve(); + } + return new Promise((res) => { + window.setTimeout(() => { + if (this.isAlive()) { + this.virtualList.focusRow(rowIndex); + } + res(); + }, 0); + }); + } + onSelectAll(isSelected) { + if (isSelected) { + this.selectAllMatchingMiniFilter(); + } else { + this.deselectAllMatchingMiniFilter(); + } + this.refreshAfterSelection(); + } + onGroupItemSelected(item, isSelected) { + const recursiveGroupSelection = (i) => { + if (!i.filterPasses) { + return; + } + const children = i.children; + if (children) { + for (const childItem of children.values()) { + recursiveGroupSelection(childItem); + } + } else { + this.setKeySelected(i.key, isSelected); + } + }; + recursiveGroupSelection(item); + this.refreshAfterSelection(); + } + onItemSelected(key, isSelected) { + this.setKeySelected(key, isSelected); + this.refreshAfterSelection(); + } + onExpandAll(item, isExpanded) { + const recursiveExpansion = (i) => { + if (i.filterPasses && i.available && i.children) { + for (const childItem of i.children.values()) { + recursiveExpansion(childItem); + } + i.expanded = isExpanded; + } + }; + recursiveExpansion(item); + this.refreshAfterExpansion(); + } + onExpandedChanged(item, isExpanded) { + item.expanded = isExpanded; + this.refreshAfterExpansion(); + } + refreshAfterExpansion() { + const focusedRow = this.virtualList.getLastFocusedRow(); + this.updateDisplayedValues("expansion"); + this.checkAndRefreshVirtualList(); + this.focusRowIfAlive(focusedRow); + } + refreshAfterSelection() { + const focusedRow = this.virtualList.getLastFocusedRow(); + this.checkAndRefreshVirtualList(); + this.onUiChanged(); + this.focusRowIfAlive(focusedRow); + } + setMiniFilter(newMiniFilter, silent) { + this.eMiniFilter.setValue(newMiniFilter, silent); + this.onMiniFilterInput(silent); + } + /** Sets mini filter value. Returns true if it changed from last value, otherwise false. */ + doSetMiniFilter(value) { + value = _makeNull4(value); + if (this.miniFilterText === value) { + return false; + } + if (value === null) { + this.addCurrentSelectionToFilter = false; + } + this.miniFilterText = value; + this.updateDisplayedValues("miniFilter"); + return true; + } + getMiniFilter() { + return this.miniFilterText; + } + getUiChangeEventParams() { + return { + miniFilterValue: this.miniFilterText + }; + } + getState() { + const miniFilterValue = this.miniFilterText; + return miniFilterValue ? { miniFilterValue } : void 0; + } + checkAndRefreshVirtualList() { + this.virtualList.refresh(!this.hardRefreshVirtualList); + if (this.hardRefreshVirtualList) { + this.hardRefreshVirtualList = false; + } + } + /** + * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead. + */ + getFilterKeys() { + _warn20(283); + return this.handler.getFilterKeys(); + } + /** + * @deprecated v34 Use the same method on the filter handler (`api.getColumnFilterHandler()`) instead. + */ + getFilterValues() { + _warn20(283); + return this.handler.getFilterValues(); + } + refreshVirtualList() { + if (this.params.refreshValuesOnOpen) { + this.doRefreshFilterValues(); + } else { + this.checkAndRefreshVirtualList(); + } + } + isSelectAllSelected() { + if (!this.params.defaultToNothingSelected) { + if (this.hasSelections() && this.isNothingVisibleSelected()) { + return false; + } + if (this.isEverythingVisibleSelected()) { + return true; + } + } else { + if (this.hasSelections() && this.isEverythingVisibleSelected()) { + return true; + } + if (this.isNothingVisibleSelected()) { + return false; + } + } + return void 0; + } + areAllChildrenSelected(item) { + const recursiveChildSelectionCheck = (i) => { + if (i.children) { + let someTrue = false; + let someFalse = false; + for (const child of i.children.values()) { + if (!child.filterPasses || !child.available) { + continue; + } + const childSelected = recursiveChildSelectionCheck(child); + if (childSelected === void 0) { + return void 0; + } + if (childSelected) { + someTrue = true; + } else { + someFalse = true; + } + if (someTrue && someFalse) { + return void 0; + } + } + return someTrue; + } else { + return this.selectedKeys.has(i.key); + } + }; + if (!this.params.defaultToNothingSelected) { + return recursiveChildSelectionCheck(item); + } else { + return this.hasSelections() && recursiveChildSelectionCheck(item); + } + } + resetExpansion() { + if (!this.params.treeList) { + return; + } + const selectAllItem = this.displayValueModel.getSelectAllItem(); + if (this.isSetFilterModelTreeItem(selectAllItem)) { + const recursiveCollapse = (i) => { + const children = i.children; + if (children) { + for (const childItem of children.values()) { + recursiveCollapse(childItem); + } + i.expanded = false; + } + }; + recursiveCollapse(selectAllItem); + this.updateDisplayedValues("expansion"); + } + } + getModelAsString(model) { + return this.handler.getModelAsString(model); + } + getPositionableElement() { + return this.eSetFilterList; + } + updateDisplayedValues(source, allKeys) { + if (source === "expansion") { + this.displayValueModel.refresh(); + return; + } + const handler = this.handler; + const valueModel = handler.valueModel; + if (this.miniFilterText == null) { + this.displayValueModel.updateDisplayedValuesToAllAvailable( + (key) => valueModel.allValues.get(key) ?? null, + allKeys, + valueModel.availableKeys, + source + ); + return; + } + const formattedFilterText = handler.caseFormat(this.formatter(this.miniFilterText) || ""); + const matchesFilter = (valueToCheck) => valueToCheck != null && handler.caseFormat(valueToCheck).includes(formattedFilterText); + const nullMatchesFilter = !!this.params.excelMode && matchesFilter(translateForSetFilter(this, "blanks")); + this.displayValueModel.updateDisplayedValuesToMatchMiniFilter( + (key) => valueModel.allValues.get(key) ?? null, + allKeys, + valueModel.availableKeys, + matchesFilter, + nullMatchesFilter, + source + ); + } + hasSelections() { + return this.params.defaultToNothingSelected ? this.selectedKeys.size > 0 : this.handler.valueModel.allValues.size !== this.selectedKeys.size; + } + isInWindowsExcelMode() { + return this.params.excelMode === "windows"; + } + isAddCurrentSelectionToFilterChecked() { + return this.isInWindowsExcelMode() && this.addCurrentSelectionToFilter; + } + showAddCurrentSelectionToFilter() { + return this.isInWindowsExcelMode() && _exists15(this.miniFilterText) && this.miniFilterText.length > 0; + } + selectAllMatchingMiniFilter(clearExistingSelection = false) { + if (this.miniFilterText == null) { + this.selectedKeys = new Set(this.handler.valueModel.allValues.keys()); + } else { + if (clearExistingSelection) { + this.selectedKeys.clear(); + } + this.displayValueModel.forEachDisplayedKey((key) => this.selectedKeys.add(key)); + } + } + deselectAllMatchingMiniFilter() { + if (this.miniFilterText == null) { + this.selectedKeys.clear(); + } else { + this.displayValueModel.forEachDisplayedKey((key) => this.selectedKeys.delete(key)); + } + } + setKeySelected(key, selected) { + if (selected) { + this.selectedKeys.add(key); + } else { + if (this.params.excelMode && this.isEverythingVisibleSelected()) { + this.resetSelectionState(this.displayValueModel.getDisplayedKeys()); + } + this.selectedKeys.delete(key); + } + } + isEverythingVisibleSelected() { + return !this.displayValueModel.someDisplayedKey((it) => !this.selectedKeys.has(it)); + } + isNothingVisibleSelected() { + return !this.displayValueModel.someDisplayedKey((it) => this.selectedKeys.has(it)); + } + getSelectedModel() { + if (!this.hasSelections()) { + return null; + } + const filteringKeys = this.isAddCurrentSelectionToFilterChecked() ? this.params.model?.values : void 0; + if (filteringKeys?.length) { + if (this.selectedKeys) { + const modelKeys = /* @__PURE__ */ new Set([...filteringKeys, ...this.selectedKeys]); + return Array.from(modelKeys); + } + return Array.from(filteringKeys); + } + return Array.from(this.selectedKeys); + } + setSelectedModel(model) { + const handler = this.handler; + const valueModel = handler.valueModel; + return valueModel.allKeys.then((keys) => { + if (model == null) { + this.resetSelectionState(keys ?? []); + } else { + this.selectedKeys.clear(); + const existingFormattedKeys = /* @__PURE__ */ new Map(); + valueModel.allValues.forEach((_value, key) => { + existingFormattedKeys.set(handler.caseFormat(key), key); + }); + model.forEach((unformattedKey) => { + const formattedKey = handler.caseFormat(_makeNull4(unformattedKey)); + const existingUnformattedKey = existingFormattedKeys.get(formattedKey); + if (existingUnformattedKey !== void 0) { + this.selectedKeys.add(existingUnformattedKey); + } + }); + } + }); + } + resetSelectionState(keys) { + if (this.params.defaultToNothingSelected) { + this.selectedKeys.clear(); + } else { + this.selectedKeys = new Set(keys); + } + } + getFilterHandler() { + return this.handler; + } + destroy() { + this.virtualList = this.destroyBean(this.virtualList); + for (const func of this.handlerDestroyFuncs ?? []) { + func(); + } + this.handler = void 0; + this.displayValueModel = void 0; + this.selectedKeys.clear(); + super.destroy(); + } +}; +var ModelWrapper = class { + constructor(model) { + this.model = model; + } + getRowCount() { + return this.model.getDisplayedValueCount(); + } + getRow(index) { + return this.model.getDisplayedItem(index); + } + areRowsEqual(oldRow, newRow) { + return oldRow === newRow; + } +}; +var ModelWrapperWithSelectAll = class { + constructor(model, showAddCurrentSelectionToFilter) { + this.model = model; + this.showAddCurrentSelectionToFilter = showAddCurrentSelectionToFilter; + } + getRowCount() { + const showAddCurrentSelectionToFilter = this.showAddCurrentSelectionToFilter(); + const outboundItems = showAddCurrentSelectionToFilter ? 2 : 1; + return this.model.getDisplayedValueCount() + outboundItems; + } + getRow(index) { + if (index === 0) { + return this.model.getSelectAllItem(); + } + const showAddCurrentSelectionToFilter = this.showAddCurrentSelectionToFilter(); + const outboundItems = showAddCurrentSelectionToFilter ? 2 : 1; + if (index === 1 && showAddCurrentSelectionToFilter) { + return this.model.getAddSelectionToFilterItem(); + } + return this.model.getDisplayedItem(index - outboundItems); + } + areRowsEqual(oldRow, newRow) { + return oldRow === newRow; + } +}; +var TreeModelWrapper = class { + constructor(model) { + this.model = model; + } + getRowCount() { + return this.model.getRowCount(); + } + getRow(index) { + return this.model.getRow(index); + } + areRowsEqual(oldRow, newRow) { + if (oldRow == null && newRow == null) { + return true; + } + return oldRow != null && newRow != null && oldRow.treeKey === newRow.treeKey && oldRow.depth === newRow.depth; + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterHandler.ts +import { + BeanStub as BeanStub20, + _addGridCommonParams as _addGridCommonParams14, + _debounce as _debounce3, + _error as _error3, + _isClientSideRowModel as _isClientSideRowModel3, + _last as _last8, + _makeNull as _makeNull7, + _toStringOrNull as _toStringOrNull5 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/setFilter/clientSideValueExtractor.ts +import { AgPromise as AgPromise4, BeanStub as BeanStub18, _makeNull as _makeNull5 } from "ag-grid-community"; +var ClientSideValuesExtractor = class extends BeanStub18 { + constructor(createKey, caseFormat, getValue, isTreeDataOrGrouping, isTreeData) { + super(); + this.createKey = createKey; + this.caseFormat = caseFormat; + this.getValue = getValue; + this.isTreeDataOrGrouping = isTreeDataOrGrouping; + this.isTreeData = isTreeData; + } + extractUniqueValuesAsync(predicate, existingValues) { + return new AgPromise4((resolve) => { + if (this.beans.rowModel.rowCountReady) { + resolve(this.extractUniqueValues(predicate, existingValues)); + } else { + const [destroyFunc] = this.addManagedEventListeners({ + rowCountReady: () => { + destroyFunc?.(); + resolve(this.extractUniqueValues(predicate, existingValues)); + } + }); + } + }); + } + extractUniqueValues(predicate, existingValues) { + const values = /* @__PURE__ */ new Map(); + const existingFormattedKeys = this.extractExistingFormattedKeys(existingValues); + const formattedKeys = /* @__PURE__ */ new Set(); + const treeData = this.isTreeData(); + const treeDataOrGrouping = this.isTreeDataOrGrouping(); + const groupedCols = this.beans.rowGroupColsSvc?.columns; + const groupAllowUnbalanced = this.gos.get("groupAllowUnbalanced"); + const addValue = (unformattedKey, value) => { + const formattedKey = this.caseFormat(unformattedKey); + if (!formattedKeys.has(formattedKey)) { + formattedKeys.add(formattedKey); + let keyToAdd = unformattedKey; + let valueToAdd = _makeNull5(value); + const existingUnformattedKey = existingFormattedKeys?.get(formattedKey); + if (existingUnformattedKey != null) { + keyToAdd = existingUnformattedKey; + valueToAdd = existingValues.get(existingUnformattedKey); + } + values.set(keyToAdd, valueToAdd); + } + }; + this.beans.rowModel.forEachLeafNode((node) => { + if (!node.data || !predicate(node)) { + return; + } + if (treeDataOrGrouping) { + this.addValueForTreeDataOrGrouping(node, treeData, groupedCols, addValue, groupAllowUnbalanced); + return; + } + const value = this.getValue(node); + if (value != null && Array.isArray(value)) { + for (const x of value) { + addValue(this.createKey(x, node), x); + } + if (value.length === 0) { + addValue(null, null); + } + } else { + addValue(this.createKey(value, node), value); + } + }); + return values; + } + addValueForTreeDataOrGrouping(node, treeData, groupedCols = [], addValue, groupAllowUnbalanced) { + let dataPath; + if (treeData) { + if (node.childrenAfterGroup?.length) { + return; + } + dataPath = node.getRoute() ?? [node.key ?? node.id]; + } else { + dataPath = groupedCols.map((groupCol) => this.beans.valueSvc.getKeyForNode(groupCol, node)); + dataPath.push(this.getValue(node)); + } + const processedDataPath = processDataPath(dataPath, treeData, groupAllowUnbalanced); + addValue(this.createKey(processedDataPath), processedDataPath); + } + extractExistingFormattedKeys(existingValues) { + if (!existingValues) { + return null; + } + const existingFormattedKeys = /* @__PURE__ */ new Map(); + existingValues.forEach((_value, key) => { + existingFormattedKeys.set(this.caseFormat(key), key); + }); + return existingFormattedKeys; + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterAppliedModel.ts +var SetFilterAppliedModel = class { + constructor(caseFormat) { + this.caseFormat = caseFormat; + // This attribute contains keys that are actually used for filtering. + // These keys take into account case sensitivity: + // - When filtering is case-insensitive, all filtering keys are converted to upper case and stored here. + this.keys = null; + } + /** No model applied */ + isNull() { + return this.keys == null; + } + /** Nothing selected */ + isEmpty() { + return !this.keys?.size; + } + update(appliedModel) { + const keys = /* @__PURE__ */ new Set(); + this.keys = keys; + const values = appliedModel?.values; + if (values) { + const caseFormat = this.caseFormat; + for (let i = 0, len = values.length; i < len; i++) { + keys.add(caseFormat(values[i])); + } + } + } + has(key) { + return !!this.keys?.has(this.caseFormat(key)); + } + destroy() { + this.keys = null; + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setValueModel.ts +import { + AgPromise as AgPromise5, + BeanStub as BeanStub19, + _addGridCommonParams as _addGridCommonParams13, + _defaultComparator as _defaultComparator2, + _error as _error2, + _makeNull as _makeNull6, + _warn as _warn21 +} from "ag-grid-community"; +var SetFilterModelValuesType = /* @__PURE__ */ ((SetFilterModelValuesType2) => { + SetFilterModelValuesType2[SetFilterModelValuesType2["PROVIDED_LIST"] = 0] = "PROVIDED_LIST"; + SetFilterModelValuesType2[SetFilterModelValuesType2["PROVIDED_CALLBACK"] = 1] = "PROVIDED_CALLBACK"; + SetFilterModelValuesType2[SetFilterModelValuesType2["TAKEN_FROM_GRID_VALUES"] = 2] = "TAKEN_FROM_GRID_VALUES"; + return SetFilterModelValuesType2; +})(SetFilterModelValuesType || {}); +var setValueModel_default = SetFilterModelValuesType; +var SetValueModel = class extends BeanStub19 { + constructor(clientSideValuesExtractor, caseFormat, createKey, isTreeDataOrGrouping, params) { + super(); + this.clientSideValuesExtractor = clientSideValuesExtractor; + this.caseFormat = caseFormat; + this.createKey = createKey; + this.isTreeDataOrGrouping = isTreeDataOrGrouping; + this.params = params; + /** All possible values for the filter, sorted if required. */ + this.allValues = /* @__PURE__ */ new Map(); + /** Remaining keys when filters from other columns have been applied. */ + this.availableKeys = /* @__PURE__ */ new Set(); + this.providedValues = null; + this.initialised = false; + } + postConstruct() { + const params = this.params; + const values = params.handlerParams.filterParams.values; + this.updateParams(params); + if (values == null) { + this.valuesType = 2 /* TAKEN_FROM_GRID_VALUES */; + } else { + this.valuesType = Array.isArray(values) ? 0 /* PROVIDED_LIST */ : 1 /* PROVIDED_CALLBACK */; + this.providedValues = values; + } + this.updateAllValues(); + } + refresh(params) { + const handlerParams = params.handlerParams; + if (handlerParams.source !== "colDef") { + return; + } + const { values, suppressSorting } = handlerParams.filterParams; + const currentProvidedValues = this.providedValues; + const currentSuppressSorting = this.params.handlerParams.filterParams.suppressSorting; + this.params = params; + this.updateParams(params); + this.providedValues = values ?? null; + if (this.providedValues !== currentProvidedValues || suppressSorting !== currentSuppressSorting) { + if (!values || values.length === 0) { + this.valuesType = 2 /* TAKEN_FROM_GRID_VALUES */; + this.providedValues = null; + } else { + this.valuesType = Array.isArray(values) ? 0 /* PROVIDED_LIST */ : 1 /* PROVIDED_CALLBACK */; + } + this.updateAllValues(); + } + } + updateParams(params) { + const { + handlerParams: { + colDef, + filterParams: { comparator, treeList, treeListPathGetter } + }, + usingComplexObjects + } = params; + const keyComparator = comparator ?? colDef.comparator; + const treeDataOrGrouping = this.isTreeDataOrGrouping(); + let entryComparator; + if (treeDataOrGrouping && !keyComparator) { + entryComparator = createTreeDataOrGroupingComparator(); + } else if (treeList && !treeListPathGetter && !keyComparator) { + entryComparator = ([_aKey, aValue], [_bKey, bValue]) => _defaultComparator2(aValue, bValue); + } else { + entryComparator = ([_aKey, aValue], [_bKey, bValue]) => keyComparator(aValue, bValue); + } + this.entryComparator = entryComparator; + this.keyComparator = keyComparator ?? _defaultComparator2; + this.compareByValue = !!(usingComplexObjects && keyComparator || treeDataOrGrouping || treeList && !treeListPathGetter); + } + updateAllValues() { + this.allKeys = new AgPromise5((resolve) => { + switch (this.valuesType) { + case 2 /* TAKEN_FROM_GRID_VALUES */: + this.getValuesFromRowsAsync().then((values) => resolve(this.processAllValues(values))); + break; + case 0 /* PROVIDED_LIST */: { + resolve( + this.processAllValues( + this.uniqueValues(this.validateProvidedValues(this.providedValues)) + ) + ); + break; + } + case 1 /* PROVIDED_CALLBACK */: { + this.dispatchLocalEvent({ type: "loadingStart" }); + const callback = this.providedValues; + const { column, colDef } = this.params.handlerParams; + const params = _addGridCommonParams13(this.gos, { + success: (values) => { + this.dispatchLocalEvent({ type: "loadingEnd" }); + resolve(this.processAllValues(this.uniqueValues(this.validateProvidedValues(values)))); + }, + colDef, + column + }); + window.setTimeout(() => callback(params), 0); + break; + } + } + }); + this.allKeys.then((values) => { + this.updateAvailableKeys(values ?? []); + this.initialised = true; + }); + return this.allKeys; + } + getAvailableValues(predicate) { + return this.sortKeys(this.getValuesFromRows(predicate)); + } + overrideValues(valuesToUse) { + return this.allKeys.then(() => { + this.valuesType = 0 /* PROVIDED_LIST */; + this.providedValues = valuesToUse; + }); + } + refreshAvailable() { + return new AgPromise5((resolve) => { + if (this.showAvailableOnly()) { + this.allKeys.then((keys) => { + const updatedKeys = keys ?? []; + this.updateAvailableKeys(updatedKeys); + resolve(true); + }); + return; + } + resolve(false); + }); + } + refreshAll() { + return new AgPromise5((resolve) => { + this.allKeys.then(() => { + this.updateAllValues().then(() => { + resolve(); + }); + }); + }); + } + isLoading() { + return !this.initialised && this.valuesType === 1 /* PROVIDED_CALLBACK */; + } + isInitialised() { + return this.initialised; + } + getValueForFormatter(key) { + return this.initialised ? this.allValues.get(key) : key; + } + getAvailableKeys(values) { + return this.initialised ? values.filter((v) => this.availableKeys.has(v)) : values; + } + getParamsForValuesFromRows(removeUnavailableValues) { + if (!this.clientSideValuesExtractor) { + _error2(113); + return void 0; + } + const existingValues = removeUnavailableValues && !this.params.handlerParams.filterParams.caseSensitive ? this.allValues : void 0; + return existingValues; + } + getValuesFromRows(predicate) { + const existingValues = this.getParamsForValuesFromRows(true); + return this.clientSideValuesExtractor?.extractUniqueValues(predicate, existingValues) ?? null; + } + getValuesFromRowsAsync() { + const existingValues = this.getParamsForValuesFromRows(false); + return this.clientSideValuesExtractor?.extractUniqueValuesAsync(() => true, existingValues) ?? AgPromise5.resolve(null); + } + processAllValues(values) { + const sortedKeys = this.sortKeys(values); + this.allValues = values ?? /* @__PURE__ */ new Map(); + return sortedKeys; + } + uniqueValues(values) { + const uniqueValues = /* @__PURE__ */ new Map(); + const formattedKeys = /* @__PURE__ */ new Set(); + const { caseFormat, createKey } = this; + for (const value of values ?? []) { + const valueToUse = _makeNull6(value); + const unformattedKey = createKey(valueToUse); + const formattedKey = caseFormat(unformattedKey); + if (!formattedKeys.has(formattedKey)) { + formattedKeys.add(formattedKey); + uniqueValues.set(unformattedKey, valueToUse); + } + } + return uniqueValues; + } + validateProvidedValues(values) { + if (this.params.usingComplexObjects && values?.length) { + const firstValue = values[0]; + if (firstValue && typeof firstValue !== "object" && typeof firstValue !== "function") { + const firstKey = this.createKey(firstValue); + if (firstKey == null) { + _warn21(209); + } else { + _warn21(210); + } + } + } + return values; + } + sortKeys(nullableValues) { + const values = nullableValues ?? /* @__PURE__ */ new Map(); + const filterParams = this.params.handlerParams.filterParams; + if (filterParams.suppressSorting) { + return Array.from(values.keys()); + } + let sortedKeys; + if (this.compareByValue) { + sortedKeys = Array.from(values.entries()).sort(this.entryComparator).map(([key]) => key); + } else { + sortedKeys = Array.from(values.keys()).sort(this.keyComparator); + } + if (filterParams.excelMode && values.has(null)) { + sortedKeys = sortedKeys.filter((v) => v != null); + sortedKeys.push(null); + } + return sortedKeys; + } + showAvailableOnly() { + return this.valuesType === 2 /* TAKEN_FROM_GRID_VALUES */; + } + updateAvailableKeys(allKeys) { + const availableKeys = this.showAvailableOnly() ? this.getAvailableValues((node) => this.params.handlerParams.doesRowPassOtherFilter(node)) : allKeys; + this.availableKeys = new Set(availableKeys); + window.setTimeout(() => { + if (this.isAlive()) { + this.dispatchLocalEvent({ type: "availableValuesChanged" }); + } + }); + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterHandler.ts +var SetFilterHandler = class extends BeanStub20 { + constructor() { + super(...arguments); + /** Used to get the filter type for filter models. */ + this.filterType = "set"; + this.treeDataTreeList = false; + this.groupingTreeList = false; + this.caseSensitive = false; + this.noValueFormatterSupplied = false; + } + init(params) { + this.updateParams(params); + const isTreeDataOrGrouping = this.isTreeDataOrGrouping.bind(this); + const isTreeData = () => this.treeDataTreeList; + const createKey = this.createKey; + const caseFormat = this.caseFormat.bind(this); + const { gos, beans } = this; + const clientSideValuesExtractor = _isClientSideRowModel3(gos, beans.rowModel) ? this.createManagedBean( + new ClientSideValuesExtractor( + createKey, + caseFormat, + params.getValue, + isTreeDataOrGrouping, + isTreeData + ) + ) : void 0; + const valueModel = this.createManagedBean( + new SetValueModel(clientSideValuesExtractor, caseFormat, createKey, isTreeDataOrGrouping, { + handlerParams: params, + usingComplexObjects: !!(params.filterParams.keyCreator ?? params.colDef.keyCreator) + }) + ); + this.addManagedListeners(valueModel, { + availableValuesChanged: params.onModelAsStringChange + }); + this.valueModel = valueModel; + this.appliedModel = new SetFilterAppliedModel(this.caseFormat.bind(this)); + this.appliedModel.update(params.model); + this.validateModel(params); + this.addEventListenersForDataChanges(); + } + refresh(params) { + this.updateParams(params); + this.valueModel.refresh({ + handlerParams: params, + usingComplexObjects: !!(params.filterParams.keyCreator ?? params.colDef.keyCreator) + }); + this.appliedModel.update(params.model); + this.validateModel(params); + } + updateParams(params) { + this.params = params; + const { + colDef, + filterParams: { caseSensitive, treeList, keyCreator, valueFormatter } + } = params; + this.caseSensitive = !!caseSensitive; + const isGroupCol = !!colDef.showRowGroup; + this.treeDataTreeList = this.gos.get("treeData") && !!treeList && isGroupCol; + this.groupingTreeList = !!this.beans.rowGroupColsSvc?.columns.length && !!treeList && isGroupCol; + const resolvedKeyCreator = keyCreator ?? colDef.keyCreator; + this.createKey = this.generateCreateKey(resolvedKeyCreator, this.isTreeDataOrGrouping()); + this.setValueFormatter(valueFormatter, resolvedKeyCreator, !!treeList, !!colDef.refData); + } + doesFilterPass(params) { + const { appliedModel, treeDataTreeList, groupingTreeList } = this; + if (appliedModel.isNull()) { + return true; + } + if (appliedModel.isEmpty()) { + return false; + } + const { node } = params; + if (treeDataTreeList) { + return this.doesFilterPassForTreeData(node); + } + if (groupingTreeList) { + return this.doesFilterPassForGrouping(node); + } + const value = this.params.getValue(node); + if (value != null && Array.isArray(value)) { + if (value.length === 0) { + return appliedModel.has(null); + } + return value.some((v) => appliedModel.has(this.createKey(v, node))); + } + return appliedModel.has(this.createKey(value, node)); + } + getFormattedValue(key) { + let value = this.valueModel.getValueForFormatter(key); + if (this.noValueFormatterSupplied && this.isTreeDataOrGrouping() && Array.isArray(value)) { + value = _last8(value); + } + const formattedValue = this.beans.valueSvc.formatValue( + this.params.column, + null, + value, + this.valueFormatter, + false + ); + return (formattedValue == null ? _toStringOrNull5(value) : formattedValue) ?? translateForSetFilter(this, "blanks"); + } + getModelAsString(model, source) { + const { values } = model ?? {}; + const forToolPanel = source === "filterToolPanel"; + if (values == null) { + return forToolPanel ? translateForSetFilter(this, "filterSummaryListInactive") : ""; + } + const availableKeys = this.valueModel.getAvailableKeys(values); + const numValues = availableKeys.length; + const numToDisplay = forToolPanel ? 3 : 10; + const formattedValues = availableKeys.slice(0, numToDisplay).map((key) => this.getFormattedValue(key)); + if (forToolPanel) { + const valueList = formattedValues.join(translateForSetFilter(this, "filterSummaryListSeparator")); + if (numValues > 3) { + return translateForSetFilter(this, "filterSummaryListLong", [valueList, String(numValues - 3)]); + } else { + return translateForSetFilter(this, "filterSummaryListShort", [valueList]); + } + } + return `(${numValues}) ${formattedValues.join(",")}${numValues > 10 ? ",..." : ""}`; + } + onAnyFilterChanged() { + window.setTimeout(() => { + if (!this.isAlive()) { + return; + } + this.valueModel.refreshAvailable().then((updated) => { + this.dispatchLocalEvent({ type: "anyFilterChanged", updated: !!updated }); + }); + }); + } + onNewRowsLoaded() { + this.syncAfterDataChange(); + } + setFilterValues(values) { + this.valueModel.overrideValues(values).then(() => { + this.refreshFilterValues(); + }); + } + resetFilterValues() { + this.valueModel.valuesType = setValueModel_default.TAKEN_FROM_GRID_VALUES; + this.syncAfterDataChange(); + } + /** + * @param suppressAvailableValuesCheck when refreshing values via the API, the model will be reset if all available values are selected. + * When refreshing due to internal changes, set this to `true` to do the reset check based on all values instead. + */ + refreshFilterValues(suppressAvailableValuesCheck) { + if (!this.valueModel.isInitialised()) { + return; + } + this.valueModel.refreshAll().then(() => { + this.dispatchLocalEvent({ type: "dataChanged", hardRefresh: true }); + this.validateModel(this.params, void 0, !suppressAvailableValuesCheck); + }); + } + getFilterKeys() { + return Array.from(this.valueModel.allValues.keys()); + } + getFilterValues() { + return Array.from(this.valueModel.allValues.values()); + } + isTreeDataOrGrouping() { + return this.treeDataTreeList || this.groupingTreeList; + } + caseFormat(valueToFormat) { + if (valueToFormat == null || typeof valueToFormat !== "string") { + return valueToFormat; + } + return this.caseSensitive ? valueToFormat : valueToFormat.toUpperCase(); + } + addEventListenersForDataChanges() { + this.addManagedPropertyListeners(["groupAllowUnbalanced"], () => this.syncAfterDataChange()); + const syncAfterDataChangeDebounced = _debounce3(this, this.syncAfterDataChange.bind(this), 0); + this.addManagedEventListeners({ + cellValueChanged: (event) => { + if (event.column === this.params.column) { + syncAfterDataChangeDebounced(); + } + } + }); + } + syncAfterDataChange() { + if (!this.isValuesTakenFromGrid()) { + return; + } + this.valueModel.refreshAll().then(() => { + this.dispatchLocalEvent({ type: "dataChanged" }); + this.validateModel(this.params, { afterDataChange: true }); + }); + } + validateModel(params, additionalEventAttributes, restrictToAvailableValues) { + const valueModel = this.valueModel; + valueModel.allKeys.then(() => { + const model = params.model; + if (model == null) { + return; + } + const existingFormattedKeys = /* @__PURE__ */ new Map(); + const addKey = (key) => existingFormattedKeys.set(this.caseFormat(key), key); + if (restrictToAvailableValues) { + for (const key of valueModel.availableKeys) { + addKey(key); + } + } else { + valueModel.allValues.forEach((_value, key) => addKey(key)); + } + const newValues = []; + let updated = false; + for (const unformattedKey of model.values) { + const formattedKey = this.caseFormat(_makeNull7(unformattedKey)); + const existingUnformattedKey = existingFormattedKeys.get(formattedKey); + if (existingUnformattedKey !== void 0) { + newValues.push(existingUnformattedKey); + if (existingUnformattedKey !== unformattedKey) { + updated = true; + } + } else { + updated = true; + } + } + const numNewValues = newValues.length; + const filterParams = params.filterParams; + if (numNewValues === 0 && filterParams.excelMode) { + params.onModelChange(null, additionalEventAttributes); + return; + } + const clearOnAllSelected = !filterParams.defaultToNothingSelected && (this.valueModel.valuesType === setValueModel_default.TAKEN_FROM_GRID_VALUES || !filterParams.suppressClearModelOnRefreshValues); + const allSelected = clearOnAllSelected && numNewValues === existingFormattedKeys.size; + if (updated || !model.filterType || allSelected) { + const newModel = allSelected ? null : { filterType: this.filterType, values: newValues }; + params.onModelChange(newModel, additionalEventAttributes); + } + }); + } + isValuesTakenFromGrid() { + return this.valueModel.valuesType === setValueModel_default.TAKEN_FROM_GRID_VALUES; + } + doesFilterPassForTreeData(node) { + if (node.childrenAfterGroup?.length) { + return false; + } + const { gos, appliedModel } = this; + return appliedModel.has( + this.createKey( + processDataPath( + node.getRoute() ?? [node.key ?? node.id], + true, + gos.get("groupAllowUnbalanced") + ) + ) + ); + } + doesFilterPassForGrouping(node) { + const { + appliedModel, + params, + gos, + beans: { rowGroupColsSvc, valueSvc } + } = this; + const dataPath = (rowGroupColsSvc?.columns ?? []).map((groupCol) => valueSvc.getKeyForNode(groupCol, node)); + dataPath.push(params.getValue(node)); + return appliedModel.has( + this.createKey(processDataPath(dataPath, false, gos.get("groupAllowUnbalanced"))) + ); + } + generateCreateKey(keyCreator, treeDataOrGrouping) { + if (treeDataOrGrouping && !keyCreator) { + _error3(250); + return () => null; + } + if (keyCreator) { + return (value, node = null) => { + const params = this.getKeyCreatorParams(value, node); + return _makeNull7(keyCreator(params)); + }; + } + return (value) => _makeNull7(_toStringOrNull5(value)); + } + getKeyCreatorParams(value, node = null) { + const { colDef, column } = this.params; + return _addGridCommonParams14(this.gos, { + value, + colDef, + column, + node, + data: node?.data + }); + } + setValueFormatter(providedValueFormatter, keyCreator, treeList, isRefData) { + let valueFormatter = providedValueFormatter; + if (!valueFormatter) { + if (keyCreator && !treeList) { + _error3(249); + return; + } + this.noValueFormatterSupplied = true; + if (!isRefData) { + valueFormatter = (params) => _toStringOrNull5(params.value); + } + } + this.valueFormatter = valueFormatter; + } + getCrossFilterModel(callback) { + const { createKey, valueModel, params } = this; + return callback(createKey, valueModel.availableKeys, params.model?.values); + } + destroy() { + this.appliedModel.destroy(); + super.destroy(); + this.valueModel = void 0; + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFloatingFilter.ts +import { AgInputTextFieldSelector as AgInputTextFieldSelector7, Component as Component32, RefPlaceholder as RefPlaceholder31, _error as _error4 } from "ag-grid-community"; +var SetFloatingFilterElement = { + tag: "div", + cls: "ag-floating-filter-input ag-set-floating-filter-input", + role: "presentation", + children: [ + { + tag: "ag-input-text-field", + ref: "eFloatingFilterText" + } + ] +}; +var SetFloatingFilterComp = class extends Component32 { + constructor() { + super(SetFloatingFilterElement, [AgInputTextFieldSelector7]); + this.eFloatingFilterText = RefPlaceholder31; + } + init(params) { + this.params = params; + this.eFloatingFilterText.setDisabled(true).addGuiEventListener("click", () => this.params.showParentFilter()); + this.setParams(params); + } + setParams(params) { + const displayName = this.beans.colNames.getDisplayNameForColumn(params.column, "header", true); + const translate = this.getLocaleTextFunc(); + this.eFloatingFilterText.setInputAriaLabel(`${displayName} ${translate("ariaFilterInput", "Filter Input")}`); + if (this.gos.get("enableFilterHandlers")) { + const reactiveParams = params; + this.updateFloatingFilterText(reactiveParams.model); + } + } + refresh(params) { + this.params = params; + this.setParams(params); + } + onParentModelChanged(parentModel) { + this.updateFloatingFilterText(parentModel); + } + parentSetFilterInstance(cb) { + this.params.parentFilterInstance((filter) => { + if (!(filter instanceof SetFilter)) { + _error4(248); + return; + } + cb(filter); + }); + } + updateFloatingFilterText(parentModel) { + if (parentModel == null) { + this.eFloatingFilterText.setValue(""); + } else if (this.gos.get("enableFilterHandlers")) { + this.eFloatingFilterText.setValue( + this.params.getHandler().getModelAsString?.(parentModel) ?? "" + ); + } else { + this.parentSetFilterInstance((setFilter) => { + this.eFloatingFilterText.setValue(setFilter.getModelAsString(parentModel)); + }); + } + } +}; + +// packages/ag-grid-enterprise/src/setFilter/setFilterModule.ts +var SetFilterModule = { + moduleName: "SetFilter", + version: VERSION, + userComponents: { + agSetColumnFilter: { + classImp: SetFilter, + params: { + useForm: true + }, + processParams: (params) => { + applyExcelModeOptions(params); + return params; + } + }, + agSetColumnFloatingFilter: SetFloatingFilterComp + }, + dynamicBeans: { + agSetColumnFilterHandler: SetFilterHandler + }, + icons: { + // set filter tree list group contracted (click to expand) + setFilterGroupClosed: "tree-closed", + // set filter tree list group expanded (click to contract) + setFilterGroupOpen: "tree-open", + // set filter tree list expand/collapse all button, shown when some children are expanded and + // others are collapsed + setFilterGroupIndeterminate: "tree-indeterminate", + // set filter async values loading + setFilterLoading: "loading" + }, + dependsOn: [EnterpriseCoreModule, _ColumnFilterModule] +}; + +// packages/ag-grid-enterprise/src/statusBar/statusBarModule.ts +import { _KeyboardNavigationModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/statusBar/agStatusBar.ts +import { + AgPromise as AgPromise6, + Component as Component33, + RefPlaceholder as RefPlaceholder32, + _addFocusableContainerListener as _addFocusableContainerListener4, + _addGridCommonParams as _addGridCommonParams15, + _clearElement as _clearElement10, + _removeFromParent as _removeFromParent6, + _warn as _warn22 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/statusBar/agStatusBar.css +var agStatusBar_default = ".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4)}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}"; + +// packages/ag-grid-enterprise/src/statusBar/agStatusBar.ts +function getStatusPanelCompDetails(userCompFactory, def, params) { + return userCompFactory.getCompDetails(def, StatusPanelComponent, void 0, params, true); +} +var StatusPanelComponent = { + name: "statusPanel", + optionalMethods: ["refresh"] +}; +var AgStatusBarValidationMap = { + agAggregationComponent: { rowModels: ["clientSide", "serverSide"], warnArgs: [221] }, + agFilteredRowCountComponent: { rowModels: ["clientSide"], warnArgs: [222] }, + agSelectedRowCountComponent: { rowModels: ["clientSide", "serverSide"], warnArgs: [223] }, + agTotalAndFilteredRowCountComponent: { rowModels: ["clientSide"], warnArgs: [224] }, + agTotalRowCountComponent: { rowModels: ["clientSide"], warnArgs: [225] } +}; +var AgStatusBarElement = { + tag: "div", + cls: "ag-status-bar", + children: [ + { + tag: "div", + ref: "eStatusBarLeft", + cls: "ag-status-bar-left", + role: "status" + }, + { + tag: "div", + ref: "eStatusBarCenter", + cls: "ag-status-bar-center", + role: "status" + }, + { + tag: "div", + ref: "eStatusBarRight", + cls: "ag-status-bar-right", + role: "status" + } + ] +}; +var AgStatusBar = class extends Component33 { + constructor() { + super(AgStatusBarElement); + this.updateQueued = false; + this.panelsPromise = AgPromise6.resolve(); + this.eStatusBarLeft = RefPlaceholder32; + this.eStatusBarCenter = RefPlaceholder32; + this.eStatusBarRight = RefPlaceholder32; + this.compDestroyFunctions = {}; + this.registerCSS(agStatusBar_default); + } + wireBeans(beans) { + this.userCompFactory = beans.userCompFactory; + this.statusBarSvc = beans.statusBarSvc; + } + postConstruct() { + this.processStatusPanels(/* @__PURE__ */ new Map()); + this.addManagedPropertyListeners(["statusBar"], this.handleStatusBarChanged.bind(this)); + _addFocusableContainerListener4(this.beans, this, this.getGui()); + } + getFocusableContainerName() { + return "statusBar"; + } + getValidPanels() { + const gos = this.gos; + const statusPanels = gos.get("statusBar")?.statusPanels; + if (!statusPanels) { + return statusPanels; + } + return statusPanels.filter((panel) => { + const { rowModels, warnArgs } = AgStatusBarValidationMap[panel.statusPanel] ?? {}; + if (!rowModels) { + return true; + } + if (rowModels.includes(gos.get("rowModelType"))) { + return true; + } + _warn22(...warnArgs); + return false; + }); + } + processStatusPanels(existingStatusPanelsToReuse) { + const statusPanels = this.getValidPanels(); + if (statusPanels) { + const leftStatusPanelComponents = statusPanels.filter( + (componentConfig) => componentConfig.align === "left" + ); + const centerStatusPanelComponents = statusPanels.filter( + (componentConfig) => componentConfig.align === "center" + ); + const rightStatusPanelComponents = statusPanels.filter( + (componentConfig) => !componentConfig.align || componentConfig.align === "right" + ); + this.panelsPromise = AgPromise6.all([ + this.createAndRenderComponents( + leftStatusPanelComponents, + this.eStatusBarLeft, + existingStatusPanelsToReuse + ), + this.createAndRenderComponents( + centerStatusPanelComponents, + this.eStatusBarCenter, + existingStatusPanelsToReuse + ), + this.createAndRenderComponents( + rightStatusPanelComponents, + this.eStatusBarRight, + existingStatusPanelsToReuse + ) + ]); + } else { + this.setDisplayed(false); + } + } + handleStatusBarChanged() { + if (this.updateQueued) { + return; + } + this.updateQueued = true; + this.panelsPromise.then(() => { + this.updateStatusBar(); + this.updateQueued = false; + }); + } + updateStatusBar() { + const statusPanels = this.getValidPanels(); + const validStatusBarPanelsProvided = Array.isArray(statusPanels) && statusPanels.length > 0; + this.setDisplayed(validStatusBarPanelsProvided); + const existingStatusPanelsToReuse = /* @__PURE__ */ new Map(); + if (validStatusBarPanelsProvided) { + for (const statusPanelConfig of statusPanels) { + const key = statusPanelConfig.key ?? statusPanelConfig.statusPanel; + const existingStatusPanel = this.statusBarSvc.getStatusPanel(key); + if (existingStatusPanel?.refresh) { + const newParams = _addGridCommonParams15(this.gos, { + ...statusPanelConfig.statusPanelParams ?? {}, + key + }); + const hasRefreshed = existingStatusPanel.refresh(newParams); + if (hasRefreshed) { + existingStatusPanelsToReuse.set(key, existingStatusPanel); + delete this.compDestroyFunctions[key]; + _removeFromParent6(existingStatusPanel.getGui()); + } + } + } + } + this.resetStatusBar(); + if (validStatusBarPanelsProvided) { + this.processStatusPanels(existingStatusPanelsToReuse); + } + } + resetStatusBar() { + _clearElement10(this.eStatusBarLeft); + _clearElement10(this.eStatusBarCenter); + _clearElement10(this.eStatusBarRight); + this.destroyComponents(); + this.statusBarSvc.unregisterAllComponents(); + } + destroy() { + this.destroyComponents(); + super.destroy(); + } + destroyComponents() { + for (const func of Object.values(this.compDestroyFunctions)) { + func(); + } + this.compDestroyFunctions = {}; + } + createAndRenderComponents(statusBarComponents, ePanelComponent, existingStatusPanelsToReuse) { + const componentDetails = []; + for (const componentConfig of statusBarComponents) { + const key = componentConfig.key || componentConfig.statusPanel; + const existingStatusPanel = existingStatusPanelsToReuse.get(key); + let promise; + if (existingStatusPanel) { + promise = AgPromise6.resolve(existingStatusPanel); + } else { + const compDetails = getStatusPanelCompDetails( + this.userCompFactory, + componentConfig, + _addGridCommonParams15(this.gos, { key }) + ); + if (compDetails == null) { + continue; + } + promise = compDetails.newAgStackInstance(); + } + componentDetails.push({ + key, + promise + }); + } + return AgPromise6.all(componentDetails.map((details) => details.promise)).then(() => { + for (const componentDetail of componentDetails) { + componentDetail.promise.then((component) => { + const destroyFunc = () => { + this.destroyBean(component); + }; + if (this.isAlive()) { + this.statusBarSvc.registerStatusPanel(componentDetail.key, component); + ePanelComponent.appendChild(component.getGui()); + this.compDestroyFunctions[componentDetail.key] = destroyFunc; + } else { + destroyFunc(); + } + }); + } + }); + } +}; +var AgStatusBarSelector = { + selector: "AG-STATUS-BAR", + component: AgStatusBar +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/aggregationComp.ts +import { + Component as Component35, + RefPlaceholder as RefPlaceholder34, + _createCellId, + _exists as _exists16, + _formatNumberCommas, + _getRowBelow, + _getRowNode as _getRowNode2, + _isRowBefore, + _missing as _missing2, + _parseBigIntOrNull as _parseBigIntOrNull2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/agNameValue.ts +import { Component as Component34, RefPlaceholder as RefPlaceholder33, _addGridCommonParams as _addGridCommonParams16 } from "ag-grid-community"; +var AgNameValueElement = { + tag: "div", + cls: "ag-status-name-value", + children: [ + { tag: "span", ref: "eLabel" }, + ":\xA0", + { tag: "span", ref: "eValue", cls: "ag-status-name-value-value" } + ] +}; +var MIN_SAFE_BIGINT = BigInt(Number.MIN_SAFE_INTEGER); +var MAX_SAFE_BIGINT = BigInt(Number.MAX_SAFE_INTEGER); +var AgNameValue = class extends Component34 { + constructor() { + super(AgNameValueElement); + this.eLabel = RefPlaceholder33; + this.eValue = RefPlaceholder33; + } + setLabel(key, defaultValue) { + this.setDisplayed(false); + this.eLabel.textContent = this.getLocaleTextFunc()(key, defaultValue); + } + setValue(value, totalRows) { + let numericValue = null; + let bigintValue; + if (typeof value === "bigint") { + bigintValue = value; + if (value >= MIN_SAFE_BIGINT && value <= MAX_SAFE_BIGINT) { + numericValue = Number(value); + } + } else { + numericValue = value; + } + this.eValue.textContent = this.valueFormatter( + _addGridCommonParams16(this.gos, { + value: numericValue, + bigintValue, + totalRows, + key: this.key + }) + ); + } +}; +var AgNameValueSelector = { + selector: "AG-NAME-VALUE", + component: AgNameValue +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/utils.ts +var _getFilteredRowCount = (rowModel) => { + let filteredRowCount = 0; + rowModel.forEachNodeAfterFilter((node) => { + if (node.data) { + filteredRowCount++; + } + }); + return filteredRowCount; +}; +var _getTotalRowCount = (rowModel) => { + let totalRowCount = 0; + rowModel.forEachNode((node) => { + if (node.data) { + totalRowCount++; + } + }); + return totalRowCount; +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/aggregationComp.ts +function _formatNumberTwoDecimalPlacesAndCommas(value, getLocaleTextFunc) { + if (typeof value !== "number") { + return ""; + } + return _formatNumberCommas(Math.round(value * 100) / 100, getLocaleTextFunc); +} +var AggregationCompElement = { + tag: "div", + cls: "ag-status-panel ag-status-panel-aggregations", + children: [ + { + tag: "ag-name-value", + ref: "avgAggregationComp" + }, + { + tag: "ag-name-value", + ref: "countAggregationComp" + }, + { + tag: "ag-name-value", + ref: "minAggregationComp" + }, + { + tag: "ag-name-value", + ref: "maxAggregationComp" + }, + { + tag: "ag-name-value", + ref: "sumAggregationComp" + } + ] +}; +var AggregationComp = class extends Component35 { + constructor() { + super(AggregationCompElement, [AgNameValueSelector]); + this.sumAggregationComp = RefPlaceholder34; + this.countAggregationComp = RefPlaceholder34; + this.minAggregationComp = RefPlaceholder34; + this.maxAggregationComp = RefPlaceholder34; + this.avgAggregationComp = RefPlaceholder34; + } + postConstruct() { + this.avgAggregationComp.setLabel("avg", "Average"); + this.countAggregationComp.setLabel("count", "Count"); + this.minAggregationComp.setLabel("min", "Min"); + this.maxAggregationComp.setLabel("max", "Max"); + this.sumAggregationComp.setLabel("sum", "Sum"); + this.addManagedEventListeners({ + cellSelectionChanged: this.onCellSelectionChanged.bind(this), + modelUpdated: this.onCellSelectionChanged.bind(this) + }); + } + init(params) { + this.refresh(params); + } + refresh(params) { + this.params = params; + const valueFormatter = params.valueFormatter ?? ((params2) => { + const { value, bigintValue } = params2; + if (bigintValue != null) { + return bigintValue.toString(); + } + return _formatNumberTwoDecimalPlacesAndCommas(value, this.getLocaleTextFunc.bind(this)); + }); + const aggFuncNames = ["avg", "count", "min", "max", "sum"]; + for (const key of aggFuncNames) { + const comp = this.getAllowedAggregationValueComponent(key); + if (comp) { + comp.key = key; + comp.valueFormatter = valueFormatter.bind(this); + } + } + this.onCellSelectionChanged(); + return true; + } + setAggregationComponentValue(aggFuncName, value, visible) { + const statusBarValueComponent = this.getAllowedAggregationValueComponent(aggFuncName); + const totalRow = _getTotalRowCount(this.beans.rowModel); + if (_exists16(statusBarValueComponent) && statusBarValueComponent) { + statusBarValueComponent.setValue(value, totalRow); + statusBarValueComponent.setDisplayed(visible); + } else { + this.getAggregationValueComponent(aggFuncName)?.setDisplayed(false); + } + } + getAllowedAggregationValueComponent(aggFuncName) { + const { aggFuncs } = this.params; + if (!aggFuncs || aggFuncs.includes(aggFuncName)) { + return this.getAggregationValueComponent(aggFuncName); + } + return null; + } + getAggregationValueComponent(aggFuncName) { + const refComponentName = `${aggFuncName}AggregationComp`; + return this[refComponentName]; + } + /** + * Aggregation notes: + * - Uses bigint aggregation when bigint values are present and all numeric values are safe integers. + * - Non-integer or unsafe integer numbers fall back to number aggregation to avoid precision loss. + * - Avg uses integer division when bigint aggregation is active, discarding the fractional part. + * - String values are trimmed; finite numeric strings are aggregated as numbers, while integer strings beyond the + * safe integer range are parsed as bigint. + */ + onCellSelectionChanged() { + const beans = this.beans; + const { rangeSvc, valueSvc } = beans; + const cellRanges = rangeSvc?.getCellRanges(); + let sum = 0; + let sumBigint = 0n; + let hasBigInt = false; + let seenNonInteger = false; + let count = 0; + let numericCount = 0; + let min = null; + let max = null; + let minBigint = null; + let maxBigint = null; + const addValue = (value) => { + if (typeof value === "number") { + sum += value; + if (min === null || value < min) { + min = value; + } + if (max === null || value > max) { + max = value; + } + if (!Number.isInteger(value) || !Number.isSafeInteger(value)) { + seenNonInteger = true; + } else { + const bigintValue = BigInt(value); + sumBigint += bigintValue; + if (minBigint === null || bigintValue < minBigint) { + minBigint = bigintValue; + } + if (maxBigint === null || bigintValue > maxBigint) { + maxBigint = bigintValue; + } + } + } else { + hasBigInt = true; + sumBigint += value; + if (minBigint === null || value < minBigint) { + minBigint = value; + } + if (maxBigint === null || value > maxBigint) { + maxBigint = value; + } + const numberValue = Number(value); + sum += numberValue; + if (min === null || numberValue < min) { + min = numberValue; + } + if (max === null || numberValue > max) { + max = numberValue; + } + } + numericCount++; + }; + const cellsSoFar = {}; + if (cellRanges?.length && rangeSvc) { + for (let i = 0; i < cellRanges.length; i++) { + const cellRange = cellRanges[i]; + let currentRow = rangeSvc.getRangeStartRow(cellRange); + const lastRow = rangeSvc.getRangeEndRow(cellRange); + while (true) { + const finishedAllRows = _missing2(currentRow) || !currentRow || _isRowBefore(lastRow, currentRow); + if (finishedAllRows || !currentRow || !cellRange.columns) { + break; + } + cellRange.columns.forEach((col) => { + if (currentRow === null) { + return; + } + const cellId = _createCellId({ + rowPinned: currentRow.rowPinned, + column: col, + rowIndex: currentRow.rowIndex + }); + if (cellsSoFar[cellId]) { + return; + } + cellsSoFar[cellId] = true; + const rowNode = _getRowNode2(beans, currentRow); + if (_missing2(rowNode)) { + return; + } + let value = valueSvc.getValue(col, rowNode, "data"); + if (_missing2(value) || value === "") { + return; + } + count++; + if (typeof value === "object" && "value" in value) { + value = value.value; + if (value === "") { + return; + } + } + if (typeof value === "string") { + const trimmedValue = value.trim(); + if (trimmedValue === "") { + return; + } + const asNumber = Number(trimmedValue); + if (!Number.isFinite(asNumber)) { + return; + } + if (sum + asNumber >= Number.MAX_SAFE_INTEGER || sum + asNumber <= Number.MIN_SAFE_INTEGER || asNumber >= Number.MAX_SAFE_INTEGER || asNumber <= Number.MIN_SAFE_INTEGER) { + value = _parseBigIntOrNull2(trimmedValue); + if (value === null) { + value = asNumber; + } + } else { + value = asNumber; + } + } + if (typeof value === "number" && !isNaN(value) || typeof value === "bigint") { + addValue(value); + } + }); + currentRow = _getRowBelow(beans, currentRow); + } + } + } + const moreThanOneValue = count > 1; + const moreThanOneNum = numericCount > 1; + const useBigintAggregation = hasBigInt && !seenNonInteger; + let avg; + if (useBigintAggregation) { + avg = sumBigint / BigInt(numericCount); + } else { + avg = sum / numericCount; + } + const sumValue = moreThanOneNum ? useBigintAggregation ? sumBigint : sum : null; + const minValue = moreThanOneNum ? useBigintAggregation ? minBigint : min : null; + const maxValue = moreThanOneNum ? useBigintAggregation ? maxBigint : max : null; + const avgValue = moreThanOneNum ? avg : null; + const showAvg = moreThanOneNum; + this.setAggregationComponentValue("count", count, moreThanOneValue); + this.setAggregationComponentValue("sum", sumValue, moreThanOneNum); + this.setAggregationComponentValue("min", minValue, moreThanOneNum); + this.setAggregationComponentValue("max", maxValue, moreThanOneNum); + this.setAggregationComponentValue("avg", avgValue, showAvg); + } +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/filteredRowsComp.ts +import { _formatNumberCommas as _formatNumberCommas2 } from "ag-grid-community"; +var FilteredRowsComp = class extends AgNameValue { + postConstruct() { + this.setLabel("filteredRows", "Filtered"); + this.addCss("ag-status-panel"); + this.addCss("ag-status-panel-filtered-row-count"); + this.setDisplayed(true); + const listener = this.onDataChanged.bind(this); + this.addManagedEventListeners({ modelUpdated: listener }); + } + onDataChanged() { + const { rowModel } = this.beans; + const totalRowCountValue = _getTotalRowCount(rowModel); + const filteredRowCountValue = _getFilteredRowCount(rowModel); + this.setValue(filteredRowCountValue, totalRowCountValue); + this.setDisplayed(totalRowCountValue !== filteredRowCountValue); + } + init(params) { + this.refresh(params); + this.onDataChanged(); + } + updateValueFormatter(valueFormatter) { + this.valueFormatter = valueFormatter ?? (({ value }) => _formatNumberCommas2(value, this.getLocaleTextFunc.bind(this))); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/selectedRowsComp.ts +import { _formatNumberCommas as _formatNumberCommas3 } from "ag-grid-community"; +var SelectedRowsComp = class extends AgNameValue { + postConstruct() { + this.setLabel("selectedRows", "Selected"); + this.addCss("ag-status-panel"); + this.addCss("ag-status-panel-selected-row-count"); + const eventListener = this.onRowSelectionChanged.bind(this); + this.addManagedEventListeners({ modelUpdated: eventListener, selectionChanged: eventListener }); + } + onRowSelectionChanged() { + const { selectionSvc, rowModel } = this.beans; + const selectedRowCount = selectionSvc?.getSelectionCount() ?? 0; + const totalRowCount = _getTotalRowCount(rowModel); + this.setValue(selectedRowCount, totalRowCount); + if (selectedRowCount < 0) { + this.setDisplayed(true); + return; + } + this.setDisplayed(selectedRowCount > 0); + } + init(params) { + this.refresh(params); + this.onRowSelectionChanged(); + } + updateValueFormatter(valueFormatter) { + this.valueFormatter = valueFormatter ?? (({ value }) => { + if (value == null || value >= 0) { + return _formatNumberCommas3(value, this.getLocaleTextFunc.bind(this)); + } + return this.getLocaleTextFunc()("statusBarLastRowUnknown", "?"); + }); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/totalAndFilteredRowsComp.ts +import { _formatNumberCommas as _formatNumberCommas4 } from "ag-grid-community"; +var TotalAndFilteredRowsComp = class extends AgNameValue { + postConstruct() { + this.setLabel("totalAndFilteredRows", "Rows"); + this.addCss("ag-status-panel"); + this.addCss("ag-status-panel-total-and-filtered-row-count"); + this.setDisplayed(true); + this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) }); + } + onDataChanged() { + const { rowModel } = this.beans; + const rowCount = _getFilteredRowCount(rowModel); + const totalRowCount = _getTotalRowCount(rowModel); + this.setValue(rowCount, totalRowCount); + } + init(params) { + this.refresh(params); + this.onDataChanged(); + } + updateValueFormatter(valueFormatter) { + this.valueFormatter = valueFormatter ?? (({ value, totalRows }) => { + const getLocaleTextFunc = this.getLocaleTextFunc.bind(this); + const rowCount = _formatNumberCommas4(value, getLocaleTextFunc); + const totalRowCount = _formatNumberCommas4(totalRows ?? value, getLocaleTextFunc); + if (value === totalRows) { + return rowCount; + } + const localeTextFunc = getLocaleTextFunc(); + return `${rowCount} ${localeTextFunc("of", "of")} ${totalRowCount}`; + }); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; + +// packages/ag-grid-enterprise/src/statusBar/providedPanels/totalRowsComp.ts +import { _formatNumberCommas as _formatNumberCommas5 } from "ag-grid-community"; +var TotalRowsComp = class extends AgNameValue { + postConstruct() { + this.setLabel("totalRows", "Total Rows"); + this.addCss("ag-status-panel"); + this.addCss("ag-status-panel-total-row-count"); + this.setDisplayed(true); + this.addManagedEventListeners({ modelUpdated: this.onDataChanged.bind(this) }); + } + onDataChanged() { + const totalRow = _getTotalRowCount(this.beans.rowModel); + this.setValue(totalRow, totalRow); + } + init(params) { + this.refresh(params); + this.onDataChanged(); + } + updateValueFormatter(valueFormatter) { + this.valueFormatter = valueFormatter ?? (({ value }) => _formatNumberCommas5(value, this.getLocaleTextFunc.bind(this))); + } + refresh(params) { + const { key, valueFormatter } = params; + this.key = key; + this.updateValueFormatter(valueFormatter); + return true; + } +}; + +// packages/ag-grid-enterprise/src/statusBar/statusBarApi.ts +import { _unwrapUserComp as _unwrapUserComp2 } from "ag-grid-community"; +function getStatusPanel(beans, key) { + const comp = beans.statusBarSvc?.getStatusPanel(key); + return _unwrapUserComp2(comp); +} + +// packages/ag-grid-enterprise/src/statusBar/statusBarService.ts +import { BeanStub as BeanStub21 } from "ag-grid-community"; +var StatusBarService = class extends BeanStub21 { + // tslint:disable-next-line + constructor() { + super(); + this.beanName = "statusBarSvc"; + this.comps = /* @__PURE__ */ new Map(); + } + registerStatusPanel(key, component) { + this.comps.set(key, component); + } + unregisterStatusPanel(key) { + this.comps.delete(key); + } + unregisterAllComponents() { + this.comps.clear(); + } + getStatusPanel(key) { + return this.comps.get(key); + } + destroy() { + this.unregisterAllComponents(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/statusBar/statusBarModule.ts +var StatusBarModule = { + moduleName: "StatusBar", + version: VERSION, + beans: [StatusBarService], + userComponents: { + agAggregationComponent: AggregationComp, + agTotalRowCountComponent: TotalRowsComp, + agFilteredRowCountComponent: FilteredRowsComp, + agTotalAndFilteredRowCountComponent: TotalAndFilteredRowsComp, + agSelectedRowCountComponent: SelectedRowsComp + }, + selectors: [AgStatusBarSelector], + apiFunctions: { + getStatusPanel + }, + dependsOn: [EnterpriseCoreModule, _KeyboardNavigationModule] +}; + +// packages/ag-grid-enterprise/src/excelExport/excelExportModule.ts +import { _SharedExportModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/excelExport/excelExportApi.ts +import { _warn as _warn23 } from "ag-grid-community"; +function assertNotExcelMultiSheet(beans) { + if (beans.excelCreator?.getFactoryMode() === "MULTI_SHEET") { + _warn23(161); + return false; + } + return true; +} +function getDataAsExcel(beans, params) { + if (assertNotExcelMultiSheet(beans)) { + return beans.excelCreator?.getDataAsExcel(params); + } + return void 0; +} +function exportDataAsExcel(beans, params) { + if (assertNotExcelMultiSheet(beans)) { + beans.excelCreator?.exportDataAsExcel(params); + } +} +function getSheetDataForExcel(beans, params) { + beans.excelCreator?.setFactoryMode("MULTI_SHEET"); + return beans.excelCreator?.getSheetDataForExcel(params); +} +function getMultipleSheetsAsExcel2(beans, params) { + return beans.excelCreator?.getMultipleSheetsAsExcel(params); +} +function exportMultipleSheetsAsExcel2(beans, params) { + beans.excelCreator?.exportMultipleSheetsAsExcel(params); +} + +// packages/ag-grid-enterprise/src/excelExport/excelExportModule.ts +var ExcelExportModule = { + moduleName: "ExcelExport", + version: VERSION, + beans: [ExcelCreator], + apiFunctions: { + getDataAsExcel, + exportDataAsExcel, + getSheetDataForExcel, + getMultipleSheetsAsExcel: getMultipleSheetsAsExcel2, + exportMultipleSheetsAsExcel: exportMultipleSheetsAsExcel2 + }, + dependsOn: [_SharedExportModule, EnterpriseCoreModule] +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterModule.ts +import { _ColumnFilterModule as _ColumnFilterModule2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilter.ts +import { + AgPromise as AgPromise8, + FilterWrapperComp, + LocalEventService as LocalEventService2, + ProvidedFilter as ProvidedFilter3, + _getFilterModel, + _refreshFilterUi, + _refreshHandlerAndUi, + _removeFromArray, + _updateFilterModel +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/multiFilter/baseMultiFilter.ts +import { + AgPromise as AgPromise7, + KeyCode as KeyCode27, + TabGuardComp as TabGuardComp2, + _createElement as _createElement10, + _focusInto as _focusInto7, + _getActiveDomElement as _getActiveDomElement11, + _isNothingFocused as _isNothingFocused3, + _setAriaRole as _setAriaRole8 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterUtil.ts +import { ProvidedFilter as ProvidedFilter2 } from "ag-grid-community"; +function getMultiFilterDefs(params) { + const { filters } = params; + return filters && filters.length > 0 ? filters : [{ filter: "agTextColumnFilter" }, { filter: "agSetColumnFilter" }]; +} +function forEachReverse(list, action) { + if (list == null) { + return; + } + for (let i = list.length - 1; i >= 0; i--) { + action(list[i], i); + } +} +function getFilterTitle(filter, filterDef) { + if (filterDef.title != null) { + return filterDef.title; + } + return filter instanceof ProvidedFilter2 ? filter.getFilterTitle() : "Filter"; +} +function getUpdatedMultiFilterModel(existingModel, numFilters, newModel, index) { + const filterModels = []; + const existingFilterModels = existingModel?.filterModels; + for (let i = 0; i < numFilters; i++) { + filterModels[i] = (i === index ? newModel : existingFilterModels?.[i]) ?? null; + } + return filterModels.every((childModel) => childModel == null) ? null : { + filterType: "multi", + filterModels + }; +} +function getFilterModelForIndex(model, index) { + return model?.filterModels?.[index] ?? null; +} +function updateGetValue(beans, column, filterDef, existingGetValue) { + const filterValueGetter = filterDef.filterValueGetter; + return filterValueGetter ? beans.colFilter.createGetValue(column, filterValueGetter) : existingGetValue; +} + +// packages/ag-grid-enterprise/src/multiFilter/baseMultiFilter.ts +var BaseMultiFilter = class extends TabGuardComp2 { + constructor() { + super({ tag: "div", cls: "ag-multi-filter ag-menu-list-compact" }); + this.filterDefs = []; + this.guiDestroyFuncs = []; + // this could be the accordion/sub menu element depending on the display type + this.filterGuis = []; + this.lastActivatedMenuItem = null; + } + postConstruct() { + this.initialiseTabGuard({ + onFocusIn: (e) => this.onFocusIn(e) + }); + } + refreshGui(container) { + if (container === this.lastOpenedInContainer) { + return AgPromise7.resolve(); + } + this.tabGuardFeature.removeAllChildrenExceptTabGuards(); + this.destroyChildren(); + return AgPromise7.all( + this.getFilterWrappers().map((wrapper, index) => { + if (!wrapper) { + return AgPromise7.resolve(null); + } + const filter = this.getFilterFromWrapper(wrapper); + const comp = this.getCompFromWrapper(wrapper); + const filterDef = this.filterDefs[index]; + const filterTitle = getFilterTitle(filter, filterDef); + let filterGuiPromise; + if (filterDef.display === "subMenu" && container !== "toolPanel") { + filterGuiPromise = this.insertFilterMenu(comp, filter, filterTitle).then( + (menuItem) => menuItem.getGui() + ); + } else if (filterDef.display === "subMenu" || filterDef.display === "accordion") { + const group = this.insertFilterGroup(filter, comp, filterTitle); + filterGuiPromise = AgPromise7.resolve(group.getGui()); + } else { + filterGuiPromise = AgPromise7.resolve(comp.getGui()); + } + return filterGuiPromise; + }) + ).then((filterGuis) => { + filterGuis.forEach((filterGui, index) => { + if (!filterGui) { + return; + } + if (index > 0) { + this.appendChild(_createElement10({ tag: "div", cls: "ag-filter-separator" })); + } + this.appendChild(filterGui); + }); + this.filterGuis = filterGuis; + this.lastOpenedInContainer = container; + }); + } + destroyChildren() { + for (const func of this.guiDestroyFuncs) { + func(); + } + this.guiDestroyFuncs.length = 0; + this.filterGuis.length = 0; + } + insertFilterMenu(comp, filter, name) { + const eGui = comp.getGui(); + _setAriaRole8(eGui, "dialog"); + const menuItem = this.createBean(new MenuItemComponent()); + const childComponent = { + getGui: () => comp.getGui(), + afterGuiAttached: (params) => { + comp.afterGuiAttached?.(params); + if (comp !== filter) { + filter.afterGuiAttached?.(params); + } + } + }; + return menuItem.init({ + menuItemDef: { + name, + subMenu: [], + subMenuRole: "dialog", + cssClasses: ["ag-multi-filter-menu-item"], + menuItem: MenuItemRenderer, + menuItemParams: { + cssClassPrefix: "ag-compact-menu-option", + isCompact: true + } + }, + level: 0, + isAnotherSubMenuOpen: () => false, + childComponent, + contextParams: { + column: null, + node: null, + value: null + } + }).then(() => { + menuItem.setParentComponent(this); + this.guiDestroyFuncs.push(() => this.destroyBean(menuItem)); + this.addManagedListeners(menuItem, { + menuItemActivated: (event) => { + if (this.lastActivatedMenuItem && this.lastActivatedMenuItem !== event.menuItem) { + this.lastActivatedMenuItem.deactivate(); + } + this.lastActivatedMenuItem = event.menuItem; + } + }); + const menuItemGui = menuItem.getGui(); + menuItem.addManagedElementListeners(menuItemGui, { + // `AgMenuList` normally handles keyboard navigation, so need to do here + keydown: (e) => { + const { key } = e; + switch (key) { + case KeyCode27.UP: + case KeyCode27.RIGHT: + case KeyCode27.DOWN: + case KeyCode27.LEFT: + e.preventDefault(); + if (key === KeyCode27.RIGHT) { + menuItem.openSubMenu(true); + } + break; + } + }, + focusin: () => menuItem.activate(), + focusout: () => { + if (!menuItem.isSubMenuOpen() && !menuItem.isSubMenuOpening()) { + menuItem.deactivate(); + } + } + }); + return menuItem; + }); + } + insertFilterGroup(filter, comp, title) { + const group = this.createBean( + new AgGroupComponent({ + title, + cssIdentifier: "multi-filter" + }) + ); + this.guiDestroyFuncs.push(() => this.destroyBean(group)); + group.addItem(comp.getGui()); + group.toggleGroupExpand(false); + if (filter.afterGuiAttached) { + group.addManagedListeners(group, { + expanded: () => filter.afterGuiAttached({ + container: this.lastOpenedInContainer, + suppressFocus: true, + hidePopup: this.hidePopup + }) + }); + } + return group; + } + afterGuiAttached(params) { + let refreshPromise; + if (params) { + this.hidePopup = params.hidePopup; + refreshPromise = this.refreshGui(params.container); + } else { + this.hidePopup = void 0; + refreshPromise = AgPromise7.resolve(); + } + const suppressFocus = params?.suppressFocus; + refreshPromise.then(() => { + const { filterDefs, filterGuis, beans } = this; + const wrappers = this.getFilterWrappers(); + let hasFocused = !!suppressFocus; + if (filterDefs) { + forEachReverse(filterDefs, (filterDef, index) => { + const isFirst = index === 0; + const notInlineDisplayType = filterDef.display && filterDef.display !== "inline"; + const suppressFocusForFilter = suppressFocus || !isFirst || notInlineDisplayType; + const afterGuiAttachedParams = { ...params ?? {}, suppressFocus: suppressFocusForFilter }; + const wrapper = wrappers[index]; + const filter = wrapper ? this.getFilterFromWrapper(wrapper) : void 0; + if (wrapper) { + const comp = this.getCompFromWrapper(wrapper); + if (comp !== filter) { + comp.afterGuiAttached(afterGuiAttachedParams); + } + } + if (filter) { + this.executeFunctionIfExistsOnFilter(filter, "afterGuiAttached", afterGuiAttachedParams); + if (isFirst && !suppressFocusForFilter) { + hasFocused = true; + } + } + if (!suppressFocus && isFirst && notInlineDisplayType) { + const filterGui = filterGuis[index]; + if (filterGui) { + if (!_focusInto7(filterGui)) { + filterGui.focus({ preventScroll: true }); + } + hasFocused = true; + } + } + }); + } + const activeEl = _getActiveDomElement11(beans); + if (!hasFocused && (_isNothingFocused3(beans) || this.getGui().contains(activeEl))) { + this.forceFocusOutOfContainer(true); + } + }); + } + afterGuiDetached() { + this.executeFunctionIfExists("afterGuiDetached"); + } + onAnyFilterChanged() { + this.executeFunctionIfExists( + "onAnyFilterChanged", + (wrapper) => this.executeOnWrapper(wrapper, "onAnyFilterChanged") + ); + } + onNewRowsLoaded() { + this.executeFunctionIfExists("onNewRowsLoaded", (wrapper) => this.executeOnWrapper(wrapper, "onNewRowsLoaded")); + } + destroy() { + this.destroyChildren(); + this.hidePopup = void 0; + super.destroy(); + } + executeOnWrapper(_wrapper, _name) { + } + executeFunctionIfExists(name, executeOnHandler) { + forEachReverse(this.getFilterWrappers(), (wrapper) => { + if (wrapper) { + executeOnHandler?.(wrapper); + this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(wrapper), name); + } + }); + } + executeFunctionIfExistsOnFilter(filter, name, ...params) { + const func = filter[name]; + if (typeof func === "function") { + func.apply(filter, params); + } + } + onFocusIn(e) { + const lastActivatedMenuItem = this.lastActivatedMenuItem; + if (lastActivatedMenuItem != null && !lastActivatedMenuItem.getGui().contains(e.target)) { + lastActivatedMenuItem.deactivate(); + this.lastActivatedMenuItem = null; + } + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilter.ts +var MultiFilter = class extends BaseMultiFilter { + constructor() { + super(...arguments); + this.filterType = "multi"; + this.wrappers = []; + this.activeFilterIndices = []; + this.afterFiltersReadyFuncs = []; + } + init(params) { + this.params = params; + this.filterDefs = getMultiFilterDefs(params); + const initialModel = _getFilterModel(this.beans.colFilter.model, params.column.getColId()); + const { filterChangedCallback } = params; + this.filterChangedCallback = filterChangedCallback; + const filterPromises = this.filterDefs.map( + (filterDef, index) => this.createFilter(filterDef, index, initialModel) + ); + return new AgPromise8((resolve) => { + AgPromise8.all(filterPromises).then((wrappers) => { + this.wrappers = wrappers; + this.refreshGui("columnMenu").then(() => { + resolve(); + }); + }); + }).then(() => { + for (const f of this.afterFiltersReadyFuncs) { + f(); + } + this.afterFiltersReadyFuncs.length = 0; + }); + } + refresh(params) { + this.params = params; + return true; + } + isFilterActive() { + return this.wrappers.some((wrapper) => { + if (!wrapper) { + return false; + } + const { filter, handler, model } = wrapper; + if (handler) { + return model != null; + } + return filter.isFilterActive(); + }); + } + getLastActiveFilterIndex() { + const activeFilterIndices = this.activeFilterIndices; + return activeFilterIndices.length > 0 ? activeFilterIndices[activeFilterIndices.length - 1] : null; + } + doesFilterPass(params, indexToSkip) { + return this.wrappers.every((wrapper, index) => { + if (!wrapper || indexToSkip != null && index === indexToSkip) { + return true; + } + const { handler, filter, model } = wrapper; + if (handler) { + return model == null || handler.doesFilterPass({ + ...params, + model, + handlerParams: wrapper.handlerParams + }); + } + return !filter.isFilterActive() || filter.doesFilterPass(params); + }); + } + getModelFromUi() { + const model = { + filterType: this.filterType, + filterModels: this.wrappers.map((wrapper) => { + if (!wrapper) { + return null; + } + const providedFilter = wrapper.filter; + if (typeof providedFilter.getModelFromUi === "function") { + return providedFilter.getModelFromUi(); + } + return null; + }) + }; + return model; + } + getModel() { + if (!this.isFilterActive()) { + return null; + } + const model = { + filterType: this.filterType, + filterModels: this.wrappers.map((wrapper) => { + if (!wrapper) { + return null; + } + const { filter, handler, model: model2 } = wrapper; + if (handler) { + return model2; + } + return filter.isFilterActive() ? filter.getModel() : null; + }) + }; + return model; + } + setModel(model) { + const setFilterModel = (filter, filterModel) => { + return new AgPromise8((resolve) => { + const promise = filter.setModel(filterModel); + if (promise) { + promise.then(resolve); + } else { + resolve(); + } + }); + }; + const promises = []; + this.wrappers.forEach((wrapper, index) => { + if (!wrapper) { + return; + } + const modelForFilter = getFilterModelForIndex(model, index); + const { filter, filterParams, handler, handlerParams, state } = wrapper; + if (handler) { + const newState = { + model: modelForFilter, + state: state?.state + }; + wrapper.state = newState; + wrapper.model = modelForFilter; + promises.push( + _refreshHandlerAndUi( + () => AgPromise8.resolve({ filter, filterParams }), + handler, + handlerParams, + modelForFilter, + newState, + "api" + ).then(() => { + this.updateActiveListForHandler(index, wrapper.model); + }) + ); + } else { + promises.push( + setFilterModel(filter, modelForFilter).then(() => { + this.updateActiveListForFilter(index, filter); + }) + ); + } + }); + return AgPromise8.all(promises).then(() => { + }); + } + applyModel(source = "api") { + let result = false; + for (const wrapper of this.wrappers) { + if (wrapper) { + const filter = wrapper.filter; + if (filter instanceof ProvidedFilter3) { + result = filter.applyModel(source) || result; + } + } + } + return result; + } + getChildFilterInstance(index) { + return this.wrappers[index]?.filter; + } + getNumChildFilters() { + return this.wrappers.length; + } + destroy() { + for (const wrapper of this.wrappers) { + this.destroyBean(wrapper?.filter); + this.destroyBean(wrapper?.handler); + } + this.wrappers.length = 0; + super.destroy(); + } + getFilterWrappers() { + return this.wrappers; + } + getFilterFromWrapper(wrapper) { + return wrapper.filter; + } + getCompFromWrapper(wrapper) { + return wrapper.comp; + } + executeOnWrapper(wrapper, name) { + wrapper.handler?.[name]?.(); + } + createFilter(filterDef, index, initialModel) { + const column = this.params.column; + let initialModelForFilter = null; + let createWrapperComp; + const beans = this.beans; + const onModelChange = (model, additionalEventAttributes) => { + const wrapper = this.wrappers[index]; + if (!wrapper) { + return; + } + const newState = { + model, + state: wrapper.state?.state + }; + wrapper.state = newState; + wrapper.model = model; + _refreshHandlerAndUi( + () => AgPromise8.resolve({ + filter: wrapper.filter, + filterParams: wrapper.filterParams + }), + wrapper.handler, + wrapper.handlerParams, + model, + newState, + "ui" + ).then(() => { + this.onHandlerModelChanged(index, wrapper.model, additionalEventAttributes); + }); + }; + const { + compDetails, + handler, + handlerParams: originalHandlerParams, + createFilterUi + } = beans.colFilter.createFilterInstance( + column, + filterDef, + "agTextColumnFilter", + (defaultParams, isHandler) => { + const updatedParams = { + ...defaultParams, + filterChangedCallback: isHandler ? () => { + } : (additionalEventAttributes) => { + this.executeWhenAllFiltersReady( + () => this.onFilterModelChanged(index, additionalEventAttributes) + ); + }, + doesRowPassOtherFilter: (node) => defaultParams.doesRowPassOtherFilter(node) && this.doesFilterPass({ node, data: node.data }, index), + getValue: updateGetValue(beans, column, filterDef, defaultParams.getValue) + }; + if (isHandler) { + initialModelForFilter = getFilterModelForIndex(initialModel, index); + createWrapperComp = this.updateDisplayParams( + updatedParams, + index, + initialModelForFilter, + () => compDetails, + () => handler, + onModelChange + ); + } + return updatedParams; + } + ); + if (!createFilterUi) { + return AgPromise8.resolve(null); + } + let handlerParams; + if (handler) { + const { doesRowPassOtherFilter, getValue } = originalHandlerParams; + handlerParams = { + ...originalHandlerParams, + onModelChange, + doesRowPassOtherFilter: (node) => doesRowPassOtherFilter(node) && this.doesFilterPass({ node, data: node.data }, index), + getValue: updateGetValue(beans, column, filterDef, getValue) + }; + handler.init?.({ ...handlerParams, model: initialModelForFilter, source: "init" }); + } + return createFilterUi().then((filter) => { + if (!handler) { + return { filter, comp: filter }; + } + const filterParams = compDetails?.params; + const comp = createWrapperComp(filter); + return { + filter, + comp, + filterParams, + handler, + handlerParams, + model: initialModelForFilter + }; + }); + } + updateDisplayParams(displayParams, index, initialModelForFilter, getCompDetails, getHandler, onModelChange) { + const column = this.params.column; + const eventSvc = new LocalEventService2(); + displayParams.model = initialModelForFilter; + displayParams.state = { model: initialModelForFilter }; + displayParams.onModelChange = onModelChange; + displayParams.getHandler = getHandler; + const updateState = (wrapper, state) => { + wrapper.state = state; + eventSvc.dispatchEvent({ + type: "filterStateChanged", + column, + state + }); + }; + displayParams.onStateChange = (state) => { + const wrapper = this.wrappers[index]; + if (!wrapper) { + return; + } + updateState(wrapper, state); + _refreshFilterUi(wrapper.filter, wrapper.filterParams, wrapper.model ?? null, state, "ui"); + }; + const updateModel = (_column, action, additionalEventAttributes) => { + const wrapper = this.wrappers[index]; + if (!wrapper) { + return; + } + const getModel = () => wrapper?.model ?? null; + _updateFilterModel({ + action, + filterParams: wrapper.filterParams, + getFilterUi: () => { + const promise = AgPromise8.resolve(wrapper.filter); + return { + created: true, + filterParams: wrapper.filterParams, + compDetails: getCompDetails(), + create: () => promise, + promise + }; + }, + getModel, + getState: () => wrapper?.state ?? { model: getModel() }, + updateState: (state) => updateState(wrapper, state), + updateModel: (newModel) => wrapper.filterParams?.onModelChange(newModel, additionalEventAttributes), + processModelToApply: wrapper.handler?.processModelToApply?.bind(wrapper.handler) + }); + }; + displayParams.onAction = (action, additionalEventAttributes, event) => { + updateModel(column, action, additionalEventAttributes); + eventSvc.dispatchEvent({ + type: "filterAction", + column, + action, + event + }); + }; + return (filter) => { + const filterParams = getCompDetails()?.params; + return this.createManagedBean( + new FilterWrapperComp( + column, + { + comp: filter, + params: filterParams, + isHandler: true + }, + eventSvc, + updateModel, + false + ) + ); + }; + } + executeWhenAllFiltersReady(action) { + if ((this.wrappers?.length ?? 0) > 0) { + action(); + } else { + this.afterFiltersReadyFuncs.push(action); + } + } + updateActiveListForFilter(index, filter) { + this.updateActiveList(index, () => filter?.isFilterActive()); + } + updateActiveListForHandler(index, model) { + this.updateActiveList(index, () => model != null); + } + updateActiveList(index, isActive) { + const activeFilterIndices = this.activeFilterIndices; + _removeFromArray(this.activeFilterIndices, index); + if (isActive()) { + activeFilterIndices.push(index); + } + } + /** Only called for non-handlers */ + onFilterModelChanged(index, additionalEventAttributes) { + this.updateActiveListForFilter(index, this.wrappers[index]?.filter); + this.filterChanged(index, additionalEventAttributes); + } + onHandlerModelChanged(index, model, additionalEventAttributes) { + this.updateActiveListForHandler(index, model); + this.filterChanged(index, additionalEventAttributes); + } + filterChanged(index, additionalEventAttributes) { + this.filterChangedCallback(additionalEventAttributes); + this.wrappers.forEach((wrapper, childIndex) => { + if (index === childIndex || !wrapper) { + return; + } + const { filter, handler } = wrapper; + handler?.onAnyFilterChanged?.(); + if (typeof filter.onAnyFilterChanged === "function") { + filter.onAnyFilterChanged(); + } + }); + } + getModelAsString(model) { + if (!model?.filterModels?.length) { + return ""; + } + const lastActiveIndex = this.getLastActiveFilterIndex() ?? 0; + const activeFilter = this.wrappers[lastActiveIndex]?.filter; + return activeFilter?.getModelAsString?.(model.filterModels[lastActiveIndex]) ?? ""; + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterHandler.ts +import { BeanStub as BeanStub22, _removeFromArray as _removeFromArray2, _warn as _warn24 } from "ag-grid-community"; +var MultiFilterHandler = class extends BeanStub22 { + constructor() { + super(...arguments); + /** Used to get the filter type for filter models. */ + this.filterType = "multi"; + this.handlerWrappers = []; + /** ui active. could still have null model */ + this.activeFilterIndices = []; + this.filterDefs = []; + } + init(params) { + this.params = params; + const filterDefs = getMultiFilterDefs(params.filterParams); + this.filterDefs = filterDefs; + filterDefs.forEach((def, index) => { + const wrapper = this.beans.colFilter.createHandler(params.column, def, "agTextColumnFilter"); + this.handlerWrappers.push(wrapper); + if (!wrapper) { + _warn24(278, { colId: params.column.getColId() }); + return; + } + const { handler, handlerParams } = wrapper; + handler.init?.({ + ...this.updateHandlerParams(handlerParams, index, true), + model: getFilterModelForIndex(params.model, index), + source: "init" + }); + }); + this.resetActiveList(params.model); + } + refresh(params) { + this.params = params; + const { model, source, filterParams } = params; + const filters = filterParams?.filters; + this.handlerWrappers.forEach((wrapper, index) => { + if (wrapper) { + const updatedParams = this.updateHandlerParams(params, index, false, filters?.[index].filterParams); + wrapper.handlerParams = updatedParams; + wrapper.handler.refresh?.({ + ...updatedParams, + model: getFilterModelForIndex(model, index), + source + }); + } + }); + if (params.source !== "floating" && params.source !== "ui") { + this.resetActiveList(params.model); + } + if (params.additionalEventAttributes?.fromButtons) { + this.onAnyFilterChanged(); + } + } + updateHandlerParams(params, index, isInit, providedFilterParams) { + const { onModelChange, doesRowPassOtherFilter, getValue } = params; + const handlerParams = { + ...params, + onModelChange: (newModel, additionalEventAttributes) => onModelChange( + getUpdatedMultiFilterModel(this.params.model, this.handlerWrappers.length, newModel, index), + additionalEventAttributes + ), + doesRowPassOtherFilter: (node) => doesRowPassOtherFilter(node) && this.doesFilterPass({ node, data: node.data, model: this.params.model, handlerParams }, index), + getValue: updateGetValue(this.beans, params.column, this.filterDefs[index], getValue), + filterParams: this.updateFilterParams(params, isInit, providedFilterParams) + }; + return handlerParams; + } + updateFilterParams(params, isInit, providedFilterParams) { + const originalFilterParams = params.filterParams; + if (providedFilterParams?.buttons && isInit) { + _warn24(292, { colId: params.column.getColId() }); + } + const filterParamsForFilter = providedFilterParams ? { ...originalFilterParams, ...providedFilterParams } : originalFilterParams; + if (!filterParamsForFilter.buttons) { + return filterParamsForFilter; + } + if (providedFilterParams) { + delete filterParamsForFilter.buttons; + return filterParamsForFilter; + } + const { buttons: _, ...filterParamsForFilterWithoutButtons } = filterParamsForFilter; + return filterParamsForFilterWithoutButtons; + } + doesFilterPass(params, indexToSkip) { + const filterModels = params.model?.filterModels; + if (filterModels == null) { + return true; + } + return this.handlerWrappers.every((wrapper, index) => { + const model = filterModels[index]; + if (model == null || indexToSkip != null && index === indexToSkip) { + return true; + } + const handler = wrapper?.handler; + return !handler || handler.doesFilterPass({ ...params, model, handlerParams: wrapper.handlerParams }); + }); + } + resetActiveList(model) { + this.activeFilterIndices = []; + const filterModels = model?.filterModels; + if (filterModels == null) { + return; + } + for (let i = 0; i < this.handlerWrappers.length; i++) { + const isActive = filterModels[i] != null; + if (isActive) { + this.activeFilterIndices.push(i); + } + } + } + updateActiveList(index, childModel) { + const activeFilterIndices = this.activeFilterIndices; + _removeFromArray2(activeFilterIndices, index); + if (childModel != null) { + activeFilterIndices.push(index); + } + } + getLastActiveFilterIndex() { + const activeFilterIndices = this.activeFilterIndices; + return activeFilterIndices.length > 0 ? activeFilterIndices[activeFilterIndices.length - 1] : null; + } + getModelAsString(model, source) { + const isForToolPanel = source === "filterToolPanel"; + const defaultOption = () => isForToolPanel ? this.getLocaleTextFunc()("filterSummaryInactive", "is (All)") : ""; + if (!model?.filterModels?.length) { + return defaultOption(); + } + const lastActiveIndex = this.getLastActiveFilterIndex() ?? 0; + const activeWrapper = this.handlerWrappers[lastActiveIndex]; + return activeWrapper?.handler.getModelAsString?.(model.filterModels[lastActiveIndex], source) ?? defaultOption(); + } + getHandler(index) { + return this.handlerWrappers[index]?.handler; + } + onAnyFilterChanged() { + forEachReverse(this.handlerWrappers, (wrapper) => wrapper?.handler?.onAnyFilterChanged?.()); + } + onNewRowsLoaded() { + forEachReverse(this.handlerWrappers, (wrapper) => wrapper?.handler?.onNewRowsLoaded?.()); + } + destroy() { + for (const wrapper of this.handlerWrappers) { + this.destroyBean(wrapper?.handler); + } + this.handlerWrappers.length = 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterService.ts +import { BeanStub as BeanStub23, _getDefaultSimpleFilter, _getFilterParamsForDataType } from "ag-grid-community"; +var MultiFilterService = class extends BeanStub23 { + constructor() { + super(...arguments); + this.beanName = "multiFilter"; + } + getParamsForDataType(existingFilterParams, existingFilterValueGetter, dataTypeDefinition, formatValue) { + let filters = existingFilterParams?.filters; + const beans = this.beans; + if (!filters) { + const simpleFilter = _getDefaultSimpleFilter(dataTypeDefinition.baseDataType); + filters = [{ filter: simpleFilter }, { filter: "agSetColumnFilter" }]; + } + const translate = this.getLocaleTextFunc(); + filters = filters.map((filterDef) => { + const { + filter, + filterParams: existingChildFilterParams, + filterValueGetter: existingChildFilterValueGetter + } = filterDef; + if (typeof filter !== "string") { + return filterDef; + } + const { filterParams, filterValueGetter } = _getFilterParamsForDataType( + filter, + existingChildFilterParams, + existingChildFilterValueGetter ?? existingFilterValueGetter, + dataTypeDefinition, + formatValue, + beans, + translate + ); + return { + ...filterDef, + filterParams, + filterValueGetter + }; + }); + return { + filterParams: { + ...existingFilterParams, + filters + } + }; + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterUi.ts +import { AgPromise as AgPromise9, _getFilterDetails, _isUseApplyButton, _refreshFilterUi as _refreshFilterUi2, _warn as _warn25 } from "ag-grid-community"; +var MultiFilterUi = class extends BaseMultiFilter { + constructor() { + super(...arguments); + this.filterType = "multi"; + this.filters = []; + this.filterParams = []; + this.validity = []; + } + init(params) { + this.params = params; + const filterDefs = getMultiFilterDefs(params).map((filterDef) => { + if (filterDef.filterParams?.buttons) { + _warn25(292, { colId: params.column.getColId() }); + const newParams = { ...filterDef.filterParams }; + delete newParams.buttons; + return { + ...filterDef, + filterParams: newParams + }; + } + return filterDef; + }); + this.filterDefs = filterDefs; + this.allState = params.state; + const filterPromises = this.filterDefs.map( + (filterDef, index) => this.createFilter(filterDef, index) + ); + return new AgPromise9((resolve) => { + AgPromise9.all(filterPromises).then((filters) => { + this.filters = filters; + this.refreshGui("columnMenu").then(() => { + resolve(); + }); + }); + }); + } + refresh(params) { + const { model, state, source } = params; + if (source === "colDef") { + return false; + } + this.params = params; + const filterParams = this.filterParams; + if (state === this.allState) { + return true; + } + this.allState = state; + const newAllStateState = state.state; + this.filters.forEach((filter, index) => { + const modelForFilter = getFilterModelForIndex(model, index); + const stateForFilter = { + state: newAllStateState?.[index], + model: getFilterModelForIndex(state.model, index) + }; + _refreshFilterUi2(filter, filterParams[index], modelForFilter, stateForFilter, source); + }); + return true; + } + getLastActiveFilterIndex() { + return this.getHandler().getLastActiveFilterIndex?.() ?? null; + } + getChildFilterInstance(index) { + return this.filters[index] ?? void 0; + } + getNumChildFilters() { + return this.filters.length; + } + destroy() { + for (const filter of this.filters) { + this.destroyBean(filter); + } + this.filters.length = 0; + super.destroy(); + } + getFilterWrappers() { + return this.filters; + } + getFilterFromWrapper(wrapper) { + return wrapper; + } + getCompFromWrapper(wrapper) { + return wrapper; + } + createFilter(filterDef, index) { + const userCompFactory = this.beans.userCompFactory; + const filterParams = this.updateParams(filterDef, this.params, index); + const compDetails = _getFilterDetails( + userCompFactory, + filterDef, + filterParams, + "agTextColumnFilter" + ); + if (!compDetails) { + return AgPromise9.resolve(null); + } + this.filterParams[index] = compDetails.params; + return compDetails.newAgStackInstance(); + } + updateParams(filterDef, params, index) { + const { + doesRowPassOtherFilter, + model, + onModelChange, + state, + onStateChange, + column, + source, + onAction, + onUiChange, + getValue + } = params; + const filterModel = getFilterModelForIndex(model, index); + const filterState = state ? { + model: getFilterModelForIndex(state.model, index), + state: state.state?.[index] + } : { model: filterModel }; + const onAnyFilterChanged = () => { + const handler = this.getHandler(); + this.filters.forEach((filter, otherIndex) => { + if (index !== otherIndex) { + handler.getHandler(otherIndex)?.onAnyFilterChanged?.(); + filter?.onAnyFilterChanged?.(); + } + }); + }; + const colFilter = this.beans.colFilter; + return { + ...colFilter.createBaseFilterParams(column), + ...filterDef, + doesRowPassOtherFilter: (node) => doesRowPassOtherFilter(node) && this.getHandler().doesFilterPass( + { + node, + data: node.data, + model: this.params.model, + handlerParams: colFilter.getHandlerParams(column) + }, + index + ), + model: filterModel, + state: filterState, + onModelChange: (childModel, additionalEventAttributes) => { + const { filters, params: params2 } = this; + const newModel = getUpdatedMultiFilterModel(params2.model, filters.length, childModel, index); + this.updateActiveList(index, childModel); + onModelChange(newModel, additionalEventAttributes); + onAnyFilterChanged(); + }, + onStateChange: (newState) => this.onStateChange(onStateChange, index, newState), + getHandler: () => this.getHandler().getHandler(index), + onAction: (action, additionalEventAttributes, event) => { + if (_isUseApplyButton(params)) { + return; + } + const isChange = action === "apply" || action === "reset"; + if (isChange) { + this.updateActiveList(index, getFilterModelForIndex(this.params.state.model, index)); + } + onAction(action, additionalEventAttributes, event); + if (isChange) { + onAnyFilterChanged(); + } + }, + onUiChange, + source, + getValue: updateGetValue(this.beans, column, filterDef, getValue) + }; + } + updateActiveList(index, childModel) { + this.getHandler().updateActiveList?.(index, childModel); + } + getHandler() { + return this.params.getHandler(); + } + onStateChange(onStateChange, index, newState) { + const { model, state, valid } = newState; + const validity = this.validity; + validity[index] = valid; + const allState = this.allState; + const newModel = getUpdatedMultiFilterModel(allState.model, this.filters.length, model, index); + const allValid = validity.every((filterValid) => filterValid !== false); + const allStateState = [...allState.state ?? []]; + allStateState[index] = state; + const newAllState = { + state: allStateState, + model: newModel, + valid: allValid + }; + this.allState = newAllState; + onStateChange(newAllState); + } + getModelAsString(model) { + return this.getHandler().getModelAsString?.(model) ?? ""; + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFloatingFilter.ts +import { + AgPromise as AgPromise10, + Component as Component36, + _clearElement as _clearElement11, + _error as _error5, + _getDefaultFloatingFilterType, + _getFloatingFilterCompDetails, + _mergeDeep as _mergeDeep2, + _setDisplayed as _setDisplayed17 +} from "ag-grid-community"; +var MultiFloatingFilterElement = { + tag: "div", + cls: "ag-multi-floating-filter ag-floating-filter-input" +}; +var MultiFloatingFilterComp = class extends Component36 { + constructor() { + super(MultiFloatingFilterElement); + this.floatingFilters = []; + this.compDetailsList = []; + } + init(params) { + this.params = params; + const { compDetailsList } = this.getCompDetailsList(params); + return this.setParams(compDetailsList); + } + setParams(compDetailsList) { + const floatingFilterPromises = []; + compDetailsList.forEach((compDetails) => { + const floatingFilterPromise = compDetails?.newAgStackInstance(); + if (floatingFilterPromise != null) { + this.compDetailsList.push(compDetails); + floatingFilterPromises.push(floatingFilterPromise); + } + }); + return AgPromise10.all(floatingFilterPromises).then((floatingFilters) => { + floatingFilters.forEach((floatingFilter, index) => { + this.floatingFilters.push(floatingFilter); + const gui = floatingFilter.getGui(); + this.appendChild(gui); + if (index > 0) { + _setDisplayed17(gui, false); + } + }); + }); + } + refresh(params) { + this.params = params; + const { compDetailsList: newCompDetailsList, floatingFilterParamsList } = this.getCompDetailsList(params); + const allFloatingFilterCompsUnchanged = newCompDetailsList.length === this.compDetailsList.length && newCompDetailsList.every( + (newCompDetails, index) => !this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[index], newCompDetails) + ); + if (allFloatingFilterCompsUnchanged) { + floatingFilterParamsList.forEach((floatingFilterParams, index) => { + const floatingFilter = this.floatingFilters[index]; + floatingFilter.refresh?.(floatingFilterParams); + }); + if (this.gos.get("enableFilterHandlers")) { + const reactiveParams = params; + if (reactiveParams.model == null) { + this.floatingFilters.forEach((filter, i) => { + _setDisplayed17(filter.getGui(), i === 0); + }); + } else { + const lastActiveFloatingFilterIndex = reactiveParams.getHandler()?.getLastActiveFilterIndex?.(); + this.floatingFilters.forEach((filter, i) => { + const shouldShow = lastActiveFloatingFilterIndex == null ? i === 0 : i === lastActiveFloatingFilterIndex; + _setDisplayed17(filter.getGui(), shouldShow); + }); + } + } + } else { + _clearElement11(this.getGui()); + this.destroyBeans(this.floatingFilters); + this.floatingFilters = []; + this.compDetailsList = []; + this.setParams(newCompDetailsList); + } + } + getCompDetailsList(params) { + const compDetailsList = []; + const floatingFilterParamsList = []; + const filterParams = params.filterParams; + const currentParentModel = params.currentParentModel; + const filterDefs = getMultiFilterDefs(filterParams); + filterDefs.forEach((filterDef, index) => { + const floatingFilterParams = { + ...params, + // set the parent filter instance for each floating filter to the relevant child filter instance + parentFilterInstance: (callback) => { + this.parentMultiFilterInstance((parent) => { + const child = parent.getChildFilterInstance(index); + if (child == null) { + return; + } + callback(child); + }); + }, + // return the parent model for the specific filter + currentParentModel: () => currentParentModel()?.filterModels?.[index] ?? null + }; + if (this.gos.get("enableFilterHandlers")) { + const reactiveParams = floatingFilterParams; + reactiveParams.model = reactiveParams.model?.filterModels?.[index] ?? null; + const { onModelChange, getHandler } = reactiveParams; + reactiveParams.onModelChange = (newModel, additionalEventAttributes) => onModelChange( + getUpdatedMultiFilterModel( + this.params.model, + filterDefs.length, + newModel, + index + ), + additionalEventAttributes + ); + reactiveParams.getHandler = () => { + const multiFilterHandler = getHandler(); + return multiFilterHandler.getHandler(index); + }; + } + _mergeDeep2(floatingFilterParams.filterParams, filterDef.filterParams); + const compDetails = this.getCompDetails(filterDef, floatingFilterParams); + if (compDetails) { + compDetailsList.push(compDetails); + floatingFilterParamsList.push(floatingFilterParams); + } + }); + return { compDetailsList, floatingFilterParamsList }; + } + onParentModelChanged(model, event) { + if (event?.afterFloatingFilter) { + return; + } + this.parentMultiFilterInstance((parent) => { + if (model == null) { + this.floatingFilters.forEach((filter, i) => { + filter.onParentModelChanged(null, event); + _setDisplayed17(filter.getGui(), i === 0); + }); + } else { + const lastActiveFloatingFilterIndex = parent.getLastActiveFilterIndex(); + this.floatingFilters.forEach((filter, i) => { + const filterModel = model.filterModels.length > i ? model.filterModels[i] : null; + filter.onParentModelChanged(filterModel, event); + const shouldShow = lastActiveFloatingFilterIndex == null ? i === 0 : i === lastActiveFloatingFilterIndex; + _setDisplayed17(filter.getGui(), shouldShow); + }); + } + }); + } + destroy() { + this.destroyBeans(this.floatingFilters); + this.floatingFilters.length = 0; + super.destroy(); + } + getCompDetails(filterDef, params) { + const { colFilter, frameworkOverrides, userCompFactory } = this.beans; + const defaultComponentName = _getDefaultFloatingFilterType( + frameworkOverrides, + filterDef, + () => colFilter.getDefaultFloatingFilter(this.params.column) + ) ?? "agReadOnlyFloatingFilter"; + return _getFloatingFilterCompDetails(userCompFactory, filterDef, params, defaultComponentName); + } + parentMultiFilterInstance(cb) { + this.params.parentFilterInstance((parent) => { + if (!(parent instanceof MultiFilter || parent instanceof MultiFilterUi)) { + _error5(120); + } + cb(parent); + }); + } +}; + +// packages/ag-grid-enterprise/src/multiFilter/multiFilterModule.ts +var MultiFilterModule = { + moduleName: "MultiFilter", + version: VERSION, + userComponents: { + agMultiColumnFilter: { + getComp: (beans) => beans.gos.get("enableFilterHandlers") ? { + classImp: MultiFilterUi, + params: { + useForm: true + } + } : MultiFilter + }, + agMultiColumnFloatingFilter: MultiFloatingFilterComp + }, + beans: [MultiFilterService], + dynamicBeans: { + agMultiColumnFilterHandler: MultiFilterHandler + }, + dependsOn: [EnterpriseCoreModule, _ColumnFilterModule2, MenuItemModule] +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingModule.ts +import { _ColumnFilterModule as _ColumnFilterModule3, _PopupModule as _PopupModule4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/aggregation/aggColumnNameService.ts +import { BeanStub as BeanStub24, _exists as _exists17 } from "ag-grid-community"; +var AggColumnNameService = class extends BeanStub24 { + constructor() { + super(...arguments); + this.beanName = "aggColNameSvc"; + } + getHeaderName(column, headerName) { + if (this.gos.get("suppressAggFuncInHeader")) { + return headerName; + } + const { valueColsSvc, colModel, rowGroupColsSvc } = this.beans; + const pivotValueColumn = column.getColDef().pivotValueColumn; + const pivotActiveOnThisColumn = _exists17(pivotValueColumn); + let aggFunc = null; + let aggFuncFound; + if (pivotActiveOnThisColumn) { + const valueColumns = valueColsSvc?.columns ?? []; + const isCollapsedHeaderEnabled = this.gos.get("removePivotHeaderRowWhenSingleValueColumn") && valueColumns.length === 1; + const isTotalColumn = column.getColDef().pivotTotalColumnIds !== void 0; + if (isCollapsedHeaderEnabled && !isTotalColumn) { + return headerName; + } + aggFunc = pivotValueColumn ? pivotValueColumn.getAggFunc() : null; + aggFuncFound = true; + } else { + const measureActive = column.isValueActive(); + const isGrouping = rowGroupColsSvc?.columns.length !== 0; + const aggregationPresent = colModel.isPivotMode() || isGrouping || this.gos.get("treeData"); + if (measureActive && aggregationPresent) { + aggFunc = column.getAggFunc(); + aggFuncFound = true; + } else { + aggFuncFound = false; + } + } + if (aggFuncFound) { + const aggFuncString = typeof aggFunc === "string" ? aggFunc : "func"; + const localeTextFunc = this.getLocaleTextFunc(); + const aggFuncStringTranslated = localeTextFunc(aggFuncString, aggFuncString); + return `${aggFuncStringTranslated}(${headerName})`; + } + return headerName; + } +}; + +// packages/ag-grid-enterprise/src/aggregation/aggFuncService.ts +import { BeanStub as BeanStub25, _exists as _exists18, _last as _last9 } from "ag-grid-community"; +var defaultAggFuncNames = { + sum: "Sum", + first: "First", + last: "Last", + min: "Min", + max: "Max", + count: "Count", + avg: "Average" +}; +var AggFuncService = class extends BeanStub25 { + constructor() { + super(...arguments); + this.beanName = "aggFuncSvc"; + this.aggFuncsMap = {}; + this.initialised = false; + } + postConstruct() { + this.init(); + } + init() { + if (this.initialised) { + return; + } + this.initialiseWithDefaultAggregations(); + this.addAggFuncs(this.gos.get("aggFuncs")); + } + initialiseWithDefaultAggregations() { + const aggMap = this.aggFuncsMap; + aggMap["sum"] = aggSum; + aggMap["first"] = aggFirst; + aggMap["last"] = aggLast; + aggMap["min"] = aggMin; + aggMap["max"] = aggMax; + aggMap["count"] = aggCount; + aggMap["avg"] = aggAvg; + this.initialised = true; + } + isAggFuncPossible(column, func) { + const allKeys = this.getFuncNames(column); + const allowed = allKeys.includes(func); + const funcExists = _exists18(this.aggFuncsMap[func]); + return allowed && funcExists; + } + getDefaultFuncLabel(fctName) { + return defaultAggFuncNames[fctName] ?? fctName; + } + getDefaultAggFunc(column) { + const defaultAgg = column.getColDef().defaultAggFunc; + if (_exists18(defaultAgg) && this.isAggFuncPossible(column, defaultAgg)) { + return defaultAgg; + } + if (this.isAggFuncPossible(column, "sum")) { + return "sum"; + } + const allKeys = this.getFuncNames(column); + return allKeys?.length ? allKeys[0] : null; + } + addAggFuncs(aggFuncs) { + this.init(); + if (!aggFuncs) { + return; + } + for (const key of Object.keys(aggFuncs)) { + if (aggFuncs[key]) { + this.aggFuncsMap[key] = aggFuncs[key]; + } + } + } + getAggFunc(name) { + this.init(); + return this.aggFuncsMap[name]; + } + getFuncNames(column) { + const userAllowedFuncs = column.getColDef().allowedAggFuncs; + return userAllowedFuncs == null ? Object.keys(this.aggFuncsMap).sort() : userAllowedFuncs; + } + clear() { + this.aggFuncsMap = {}; + } +}; +function aggSum(params) { + const { values } = params; + let result = null; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if (typeof value === "number") { + if (result === null) { + result = value; + } else { + result += typeof result === "number" ? value : BigInt(value); + } + } else if (typeof value === "bigint") { + if (result === null) { + result = value; + } else { + result = (typeof result === "bigint" ? result : BigInt(result)) + value; + } + } + } + return result; +} +function aggFirst(params) { + return params.values.length > 0 ? params.values[0] : null; +} +function aggLast(params) { + return params.values.length > 0 ? _last9(params.values) : null; +} +function aggMin(params) { + const { values } = params; + let result = null; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if ((typeof value === "number" || typeof value === "bigint") && (result === null || result > value)) { + result = value; + } + } + return result; +} +function aggMax(params) { + const { values } = params; + let result = null; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + if ((typeof value === "number" || typeof value === "bigint") && (result === null || result < value)) { + result = value; + } + } + return result; +} +var COUNT_PROTO = Object.freeze({ + // the grid by default uses toString to render values for an object, so this + // is a trick to get the default cellRenderer to display the avg value + toString: function() { + return this.value.toString(); + }, + // used for sorting + toNumber: function() { + return this.value; + } +}); +function aggCount(params) { + const { values } = params; + let count = 0; + for (let i = 0; i < values.length; i++) { + const value = values[i]; + count += value != null && typeof value.value === "number" ? value.value : 1; + } + const existingAggData = params.rowNode?.aggData?.[params.column.getColId()]; + if (existingAggData && existingAggData.value === count) { + return existingAggData; + } + const result = Object.create(COUNT_PROTO); + result.value = count; + return result; +} +var AVERAGE_PROTO = Object.freeze({ + // the grid by default uses toString to render values for an object, so this + // is a trick to get the default cellRenderer to display the avg value + toString: function() { + return typeof this.value === "number" || typeof this.value === "bigint" ? this.value.toString() : ""; + }, + // used for sorting + toNumber: function() { + return this.value; + } +}); +function aggAvg(params) { + const { values } = params; + let sum = 0; + let count = 0; + for (let i = 0; i < values.length; i++) { + const currentValue = values[i]; + let valueToAdd = null; + if (typeof currentValue === "number" || typeof currentValue === "bigint") { + valueToAdd = currentValue; + count++; + } else if (currentValue != null && (typeof currentValue.value === "number" || typeof currentValue.value === "bigint") && typeof currentValue.count === "number") { + valueToAdd = currentValue.value * (typeof currentValue.value === "number" ? currentValue.count : BigInt(currentValue.count)); + count += currentValue.count; + } + if (typeof valueToAdd === "number") { + sum += typeof sum === "number" ? valueToAdd : BigInt(valueToAdd); + } else if (typeof valueToAdd === "bigint") { + sum = (typeof sum === "bigint" ? sum : BigInt(sum)) + valueToAdd; + } + } + let value = null; + if (count > 0) { + value = sum / (typeof sum === "number" ? count : BigInt(count)); + } + const existingAggData = params.rowNode?.aggData?.[params.column?.getColId()]; + if (existingAggData && existingAggData.count === count && existingAggData.value === value) { + return existingAggData; + } + const result = Object.create(AVERAGE_PROTO); + result.count = count; + result.value = value; + return result; +} + +// packages/ag-grid-enterprise/src/aggregation/aggregatedChildrenSvc.ts +import { BeanStub as BeanStub26, _getGroupAggFiltering } from "ag-grid-community"; +var AggregatedChildrenSvc = class extends BeanStub26 { + constructor() { + super(...arguments); + this.beanName = "aggChildrenSvc"; + } + getAggregatedChildren(rowNode, col, recursive) { + if (!rowNode?.group) { + return []; + } + if (rowNode.rowPinned) { + rowNode = rowNode.pinnedSibling; + if (!rowNode) { + return []; + } + } + const gos = this.gos; + const children = getImmediateAggChildren(rowNode, col, gos); + if (!recursive) { + return children; + } + const result = []; + collectLeafDescendants(children, col, gos, result); + return result; + } +}; +var getImmediateAggChildren = (rowNode, col, gos) => { + const colDef = col?.colDef; + const pivotKeys = colDef?.pivotKeys; + if (pivotKeys) { + if (rowNode.leafGroup && pivotKeys.length && !colDef.pivotTotalColumnIds) { + return getNodesFromMappedSet(rowNode.childrenMapped, pivotKeys); + } + return rowNode.childrenAfterFilter ?? rowNode.childrenAfterGroup ?? []; + } + if (_getGroupAggFiltering(gos) || gos.get("suppressAggFilteredOnly")) { + return rowNode.childrenAfterGroup ?? []; + } + return rowNode.childrenAfterFilter ?? rowNode.childrenAfterGroup ?? []; +}; +var collectLeafDescendants = (children, col, gos, result) => { + for (let i = 0, len = children.length; i < len; ++i) { + const child = children[i]; + if (child.group) { + collectLeafDescendants(getImmediateAggChildren(child, col, gos), col, gos, result); + } else { + result.push(child); + } + } +}; + +// packages/ag-grid-enterprise/src/aggregation/aggregationApi.ts +function addAggFuncs(beans, aggFuncs) { + if (beans.aggFuncSvc) { + beans.aggFuncSvc.addAggFuncs(aggFuncs); + } +} +function clearAggFuncs(beans) { + if (beans.aggFuncSvc) { + beans.aggFuncSvc.clear(); + } +} +function setColumnAggFunc(beans, key, aggFunc) { + beans.valueColsSvc?.setColumnAggFunc?.(key, aggFunc, "api"); +} + +// packages/ag-grid-enterprise/src/aggregation/aggregationStage.ts +import { + BeanStub as BeanStub27, + _forEachChangedGroupDepthFirst, + _getGrandTotalRow as _getGrandTotalRow3, + _getGroupAggFiltering as _getGroupAggFiltering2, + _warn as _warn26 +} from "ag-grid-community"; +var AggregationStage = class extends BeanStub27 { + constructor() { + super(...arguments); + this.beanName = "aggStage"; + this.step = "aggregate"; + this.refreshProps = [ + "getGroupRowAgg", + "alwaysAggregateAtRootLevel", + "suppressAggFilteredOnly", + "grandTotalRow" + ]; + /** Tracks whether the previous execute() call produced aggData, so we only clear once on transition. */ + this.hadAgg = false; + } + // Stale aggData on demoted nodes is cleared by the group stage (setRowNodeGroup), not here. + execute(changedPath) { + const { gos, beans } = this; + const userAggFunc = gos.getCallback("getGroupRowAgg"); + const valueColumns = beans.valueColsSvc?.columns; + if (!valueColumns?.length && !userAggFunc) { + if (this.hadAgg && !changedPath) { + this.hadAgg = false; + const colModel2 = beans.colModel; + const rowModel2 = beans.rowModel; + _forEachChangedGroupDepthFirst(rowModel2.rootNode, rowModel2.hierarchical, void 0, (rowNode) => { + setAggDataWithSiblings(rowNode, null, colModel2); + }); + } + return; + } + this.hadAgg = true; + const colModel = beans.colModel; + const aggFuncSvc = beans.aggFuncSvc; + const aggregateRoot = gos.get("alwaysAggregateAtRootLevel") || !!_getGrandTotalRow3(gos) || colModel.isPivotMode(); + const filteredOnly = !_getGroupAggFiltering2(gos) && !gos.get("suppressAggFilteredOnly"); + const valueSvc = beans.valueSvc; + const api = beans.gridApi; + const context = beans.gridOptions.context; + const resolvedValueColumns = valueColumns ?? []; + const colCount = resolvedValueColumns.length; + const narrowedCellsPath = changedPath?.kind === "cells" ? changedPath : void 0; + let cellsChangedPath; + const valueCols = new Array(colCount); + for (let i = 0; i < colCount; ++i) { + const col = resolvedValueColumns[i]; + const colSlot = narrowedCellsPath ? narrowedCellsPath.getSlot(col.colId) : -1; + if (colSlot >= 0) { + cellsChangedPath = narrowedCellsPath; + } + valueCols[i] = { + column: col, + colId: col.colId, + colDef: col.colDef, + aggFunc: resolveAggFunc(col.getAggFunc(), aggFuncSvc, col), + colSlot + }; + } + const pivotData = resolvePivotColumns(colModel, beans.pivotResultCols, aggFuncSvc); + const values2d = colCount > 0 ? new Array(colCount) : null; + const rowModel = beans.rowModel; + _forEachChangedGroupDepthFirst(rowModel.rootNode, rowModel.hierarchical, changedPath, (rowNode) => { + if (rowNode.level === -1 && !aggregateRoot) { + setAggData(rowNode, null, colModel); + return; + } + let aggResult; + if (userAggFunc) { + aggResult = userAggFunc({ nodes: rowNode.childrenAfterFilter }); + } else if (!values2d) { + aggResult = null; + } else if (pivotData) { + aggResult = aggregateValuesAndPivot(rowNode, pivotData, valueSvc, api, context); + } else { + aggResult = aggregateValuesOnly( + rowNode, + valueCols, + colCount, + values2d, + cellsChangedPath, + filteredOnly, + valueSvc, + api, + context + ); + } + setAggDataWithSiblings(rowNode, aggResult, colModel); + }); + } +}; +var aggregateValuesOnly = (rowNode, valueCols, colCount, values2d, cellsChangedPath, filteredOnly, valueSvc, api, context) => { + const aggregatedChildren = (filteredOnly ? rowNode.childrenAfterFilter : rowNode.childrenAfterGroup) ?? []; + const childCount = aggregatedChildren.length; + const data = rowNode.data; + const result = /* @__PURE__ */ Object.create(null); + const rowSlot = cellsChangedPath ? cellsChangedPath.getSlot(rowNode) : -1; + const oldAggData = rowSlot >= 0 ? rowNode.aggData : void 0; + let changedCount = 0; + for (let j = 0; j < colCount; ++j) { + const vc = valueCols[j]; + if (rowSlot >= 0 && !cellsChangedPath.hasCellBySlot(rowSlot, vc.colSlot)) { + values2d[j] = null; + if (oldAggData) { + result[vc.colId] = oldAggData[vc.colId]; + } + } else { + values2d[j] = new Array(childCount); + ++changedCount; + } + } + if (changedCount === 0) { + return result; + } + for (let c = 0; c < childCount; ++c) { + const child = aggregatedChildren[c]; + const childAggData = child.aggData; + if (childAggData) { + for (let j = 0; j < colCount; ++j) { + const colValues = values2d[j]; + if (colValues !== null) { + const vc = valueCols[j]; + const v = childAggData[vc.colId]; + colValues[c] = v !== void 0 ? v : valueSvc.getValue(vc.column, child, "data"); + } + } + } else { + for (let j = 0; j < colCount; ++j) { + const colValues = values2d[j]; + if (colValues !== null) { + colValues[c] = valueSvc.getValue(valueCols[j].column, child, "data"); + } + } + } + } + for (let j = 0; j < colCount; ++j) { + const colValues = values2d[j]; + if (colValues === null) { + continue; + } + const rc = valueCols[j]; + const aggFunc = rc.aggFunc; + result[rc.colId] = aggFunc ? aggFunc({ + values: colValues, + column: rc.column, + colDef: rc.colDef, + rowNode, + data, + aggregatedChildren, + api, + context + }) : null; + } + return result; +}; +var aggregateValuesAndPivot = (rowNode, pivotData, valueSvc, api, context) => { + const pivotColCount = pivotData.length; + const isLeafGroup = rowNode.leafGroup; + const data = rowNode.data; + const childrenMapped = rowNode.childrenMapped; + const childrenAfterFilter = rowNode.childrenAfterFilter ?? []; + const result = /* @__PURE__ */ Object.create(null); + let prevPivotKeys; + let prevPivotChildren; + for (let i = 0; i < pivotColCount; ++i) { + const rc = pivotData[i]; + const column = rc.column; + const colId = rc.colId; + const totalColIds = rc.totalColIds; + let values; + let aggregatedChildren; + if (totalColIds != null) { + const tLen = totalColIds.length; + values = new Array(tLen); + for (let t = 0; t < tLen; ++t) { + values[t] = result[totalColIds[t]]; + } + aggregatedChildren = childrenAfterFilter; + } else if (isLeafGroup) { + const pivotKeys = rc.pivotKeys; + if (!prevPivotChildren || pivotKeys !== prevPivotKeys) { + prevPivotKeys = pivotKeys; + prevPivotChildren = getNodesFromMappedSet(childrenMapped, pivotKeys); + } + aggregatedChildren = prevPivotChildren; + const nodeCount = aggregatedChildren.length; + values = new Array(nodeCount); + for (let n = 0; n < nodeCount; ++n) { + values[n] = valueSvc.getValue(column, aggregatedChildren[n], "data"); + } + } else { + aggregatedChildren = childrenAfterFilter; + const nodeCount = aggregatedChildren.length; + values = new Array(nodeCount); + for (let n = 0; n < nodeCount; ++n) { + const childNode = aggregatedChildren[n]; + const childAggData = childNode.aggData; + const v = childAggData ? childAggData[colId] : void 0; + values[n] = v !== void 0 ? v : valueSvc.getValue(column, childNode, "data"); + } + } + const aggFunc = rc.aggFunc; + result[colId] = aggFunc ? aggFunc({ + values, + column, + colDef: column.colDef, + pivotResultColumn: rc.pivotResultCol, + rowNode, + data, + aggregatedChildren, + api, + context + }) : null; + } + return result; +}; +var resolveAggFunc = (aggFuncOrString, aggFuncSvc, column) => { + if (typeof aggFuncOrString === "function") { + return aggFuncOrString; + } + if (aggFuncOrString == null) { + return null; + } + const aggFunc = aggFuncSvc.getAggFunc(aggFuncOrString); + if (typeof aggFunc !== "function") { + _warn26(109, { inputValue: aggFuncOrString.toString(), allSuggestions: aggFuncSvc.getFuncNames(column) }); + return null; + } + return aggFunc; +}; +var resolvePivotColumns = (colModel, pivotResultCols, aggFuncSvc) => { + if (!colModel.isPivotActive()) { + return null; + } + const orderedList = pivotResultCols?.getAggregationOrderedList(); + if (!orderedList || orderedList.length === 0) { + return null; + } + const len = orderedList.length; + const resolved = new Array(len); + let count = 0; + for (let i = 0; i < len; ++i) { + const pivotResultCol = orderedList[i]; + const resultColDef = pivotResultCol.colDef; + const valueCol = resultColDef.pivotValueColumn; + if (!valueCol) { + continue; + } + resolved[count++] = { + column: valueCol, + colId: resultColDef.colId, + aggFunc: resolveAggFunc(valueCol.getAggFunc(), aggFuncSvc, valueCol), + pivotResultCol, + pivotKeys: resultColDef.pivotKeys, + totalColIds: resultColDef.pivotTotalColumnIds + }; + } + if (count === 0) { + return null; + } + resolved.length = count; + return resolved; +}; + +// packages/ag-grid-enterprise/src/aggregation/filterAggregatesStage.ts +import { BeanStub as BeanStub28, _forEachChangedGroupDepthFirst as _forEachChangedGroupDepthFirst2, _getGroupAggFiltering as _getGroupAggFiltering3 } from "ag-grid-community"; +var FilterAggregatesStage = class extends BeanStub28 { + constructor() { + super(...arguments); + this.beanName = "filterAggStage"; + this.step = "filter_aggregates"; + this.refreshProps = []; + /** for tree data, we include all children, groups and leafs */ + this.setAllChildrenCountTreeData = (rowNode) => { + const childrenAfterAggFilter = rowNode.childrenAfterAggFilter; + let allChildrenCount = 0; + if (childrenAfterAggFilter) { + const length = childrenAfterAggFilter.length; + allChildrenCount = length; + for (let i = 0; i < length; ++i) { + allChildrenCount += childrenAfterAggFilter[i].allChildrenCount ?? 0; + } + } + const count = ( + // Maintain the historical behaviour: + // - allChildrenCount is 0 in the root if there are no children + // - allChildrenCount is null in any non-root row if there are no children + allChildrenCount === 0 && rowNode.level >= 0 ? null : allChildrenCount + ); + rowNode.setAllChildrenCount(count); + rowNode.pinnedSibling?.setAllChildrenCount(count); + }; + /* for grid data, we only count the leafs */ + this.setAllChildrenCountGridGrouping = (rowNode) => { + const children = rowNode.childrenAfterAggFilter; + let allChildrenCount = 0; + for (let i = 0, len = children.length; i < len; ++i) { + const child = children[i]; + if (child.group) { + allChildrenCount += child.allChildrenCount; + } else { + allChildrenCount++; + } + } + rowNode.setAllChildrenCount(allChildrenCount); + rowNode.pinnedSibling?.setAllChildrenCount(allChildrenCount); + }; + } + wireBeans(beans) { + this.filterManager = beans.filterManager; + } + execute(changedPath) { + const { rowModel, colModel, groupStage } = this.beans; + const { filterManager } = this; + const isPivotMode2 = colModel.isPivotMode(); + const isAggFilterActive = filterManager?.isAggregateFilterPresent() || filterManager?.isAggregateQuickFilterPresent(); + const isTreeData = !!groupStage?.treeData; + const defaultPrimaryColumnPredicate = (params) => !params.node.group; + const defaultSecondaryColumnPredicate = (params) => params.node.leafGroup; + const applyFilterToNode = _getGroupAggFiltering3(this.gos) || (isPivotMode2 ? defaultSecondaryColumnPredicate : defaultPrimaryColumnPredicate); + const setAllChildrenCount = isTreeData ? this.setAllChildrenCountTreeData : this.setAllChildrenCountGridGrouping; + const preserveChildren = (node, recursive = false) => { + if (node.childrenAfterFilter) { + node.childrenAfterAggFilter = node.childrenAfterFilter; + if (recursive) { + const children = node.childrenAfterAggFilter; + for (let i = 0, len = children.length; i < len; ++i) { + preserveChildren(children[i], recursive); + } + } + if (node.hasChildren()) { + setAllChildrenCount(node); + } else { + node.setAllChildrenCount(null); + node.pinnedSibling?.setAllChildrenCount(null); + } + } + if (node.sibling) { + node.sibling.childrenAfterAggFilter = node.childrenAfterAggFilter; + } + }; + const filterChildren = (node) => { + node.childrenAfterAggFilter = node.childrenAfterFilter?.filter((child) => { + const shouldFilterRow = applyFilterToNode({ node: child }); + if (shouldFilterRow) { + const doesNodePassFilter = filterManager.doesRowPassAggregateFilters({ rowNode: child }); + if (doesNodePassFilter) { + preserveChildren(child, true); + return true; + } + } + const hasChildPassed = child.childrenAfterAggFilter?.length; + return hasChildPassed; + }) || null; + if (node.hasChildren()) { + setAllChildrenCount(node); + } else { + node.setAllChildrenCount(null); + node.pinnedSibling?.setAllChildrenCount(null); + } + if (node.sibling) { + node.sibling.childrenAfterAggFilter = node.childrenAfterAggFilter; + } + }; + _forEachChangedGroupDepthFirst2( + rowModel.rootNode, + rowModel.hierarchical, + changedPath, + isAggFilterActive ? filterChildren : preserveChildren + ); + } +}; + +// packages/ag-grid-enterprise/src/aggregation/footerService.ts +import { BeanStub as BeanStub29, _addGridCommonParams as _addGridCommonParams17, _getGrandTotalRow as _getGrandTotalRow4, _getGroupTotalRowCallback, _warn as _warn27 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/aggregation/footerUtils.ts +import { _createRowNodeSibling } from "ag-grid-community"; +function _createRowNodeFooter(rowNode, beans) { + if (rowNode.sibling) { + return; + } + const footerNode = _createRowNodeSibling(rowNode, beans); + footerNode.footer = true; + footerNode.setRowTop(null); + footerNode.setRowIndex(null); + footerNode.oldRowTop = null; + footerNode.id = "rowGroupFooter_" + rowNode.id; + footerNode.sibling = rowNode; + rowNode.sibling = footerNode; +} +function _destroyRowNodeFooter(rowNode) { + const sibling = rowNode.sibling; + if (!sibling) { + return; + } + sibling._destroy(false); + rowNode.sibling = void 0; + sibling.sibling = void 0; +} + +// packages/ag-grid-enterprise/src/aggregation/footerService.ts +var FooterService = class extends BeanStub29 { + constructor() { + super(...arguments); + this.beanName = "footerSvc"; + } + addTotalRows(startIndex, node, callback, includeFooterNodes, isRootNode, position) { + let index = startIndex; + if (isRootNode) { + const grandTotal = includeFooterNodes && _getGrandTotalRow4(this.gos); + if (_positionMatchesGrandTotalRow(position, grandTotal)) { + _createRowNodeFooter(node, this.beans); + callback(node.sibling, index++); + } + return index; + } + const isGroupIncludeFooter = _getGroupTotalRowCallback(this.gos); + const groupTotal = includeFooterNodes && isGroupIncludeFooter({ node }); + if (groupTotal === position) { + _createRowNodeFooter(node, this.beans); + callback(node.sibling, index++); + } + return index; + } + getTopDisplayIndex(rowsToDisplay, topLevelIndex, childrenAfterSort, getDefaultIndex) { + let adjustedIndex = topLevelIndex; + if (rowsToDisplay[0].footer) { + if (topLevelIndex === 0) { + return 0; + } + adjustedIndex -= 1; + } + const lastRow = rowsToDisplay[rowsToDisplay.length - 1]; + const indexOutsideGroupBounds = adjustedIndex >= childrenAfterSort.length; + if (lastRow.footer && indexOutsideGroupBounds) { + return lastRow.rowIndex; + } + return getDefaultIndex(adjustedIndex); + } + doesCellShowTotalPrefix(node, col) { + if (!node.footer || !col?.getColDef().showRowGroup) { + return false; + } + if (this.gos.get("treeData")) { + return true; + } + if (node.level === -1) { + return this.beans.showRowGroupCols?.columns[0] === col; + } + return !!node.rowGroupColumn && col?.isRowGroupDisplayed(node.rowGroupColumn.getId()); + } + applyTotalPrefix(value, formattedValue, node, column) { + const totalValueGetter = column.getColDef().cellRendererParams?.totalValueGetter; + if (totalValueGetter) { + const valueGetterParams = _addGridCommonParams17(this.gos, { column, node, value, formattedValue }); + const getterType = typeof totalValueGetter; + if (getterType === "function") { + return totalValueGetter(valueGetterParams); + } + if (typeof totalValueGetter === "string") { + return this.beans.expressionSvc?.evaluate(totalValueGetter, valueGetterParams); + } + _warn27(179); + } + if (node.level === -1) { + return this.getLocaleTextFunc()("footerTotal", "Total") + " "; + } + return this.getTotalValue(formattedValue ?? value) ?? ""; + } + getTotalValue(value) { + return this.getLocaleTextFunc()("footerTotal", "Total") + " " + (value ?? ""); + } +}; +function _positionMatchesGrandTotalRow(position, grandTotaRow) { + switch (grandTotaRow) { + case "top": + case "pinnedTop": + return position === "top"; + case "bottom": + case "pinnedBottom": + return position === "bottom"; + default: + return false; + } +} + +// packages/ag-grid-enterprise/src/aggregation/valueColsSvc.ts +import { BaseColsService, _exists as _exists19, _removeFromArray as _removeFromArray3, _warn as _warn28 } from "ag-grid-community"; +var ValueColsSvc = class extends BaseColsService { + constructor() { + super(...arguments); + this.beanName = "valueColsSvc"; + this.eventName = "columnValueChanged"; + this.columnProcessors = { + set: (column, added, source) => this.setValueActive(added, column, source), + add: (column, added, source) => this.setValueActive(true, column, source), + remove: (column, added, source) => this.setValueActive(false, column, source) + }; + this.columnExtractors = { + setFlagFunc: (col, flag, source) => this.setColValueActive(col, flag, source), + getIndexFunc: () => void 0, + getInitialIndexFunc: () => void 0, + getValueFunc: (colDef) => { + const aggFunc = colDef.aggFunc; + if (aggFunc === null || aggFunc === "") { + return null; + } + if (aggFunc === void 0) { + return; + } + return !!aggFunc; + }, + getInitialValueFunc: (colDef) => { + return colDef.initialAggFunc != null && colDef.initialAggFunc != ""; + } + }; + this.modifyColumnsNoEventsCallbacks = { + addCol: (column) => this.columns.push(column), + removeCol: (column) => _removeFromArray3(this.columns, column) + }; + } + extractCols(source, oldProvidedCols) { + this.columns = super.extractCols(source, oldProvidedCols); + for (const col of this.columns) { + const colDef = col.getColDef(); + if (colDef.aggFunc != null && colDef.aggFunc != "") { + this.setColAggFunc(col, colDef.aggFunc); + } else if (!col.getAggFunc()) { + this.setColAggFunc(col, colDef.initialAggFunc); + } + } + return this.columns; + } + setColumnAggFunc(key, aggFunc, source) { + if (!key) { + return; + } + const column = this.colModel.getColDefCol(key); + if (!column) { + return; + } + this.setColAggFunc(column, aggFunc); + this.dispatchColumnChangedEvent(this.eventSvc, this.eventName, [column], source); + } + syncColumnWithState(column, source, getValue) { + const aggFunc = getValue("aggFunc").value1; + if (aggFunc !== void 0) { + if (typeof aggFunc === "string") { + this.setColAggFunc(column, aggFunc); + if (!column.isValueActive()) { + this.setColValueActive(column, true, source); + this.modifyColumnsNoEventsCallbacks.addCol(column); + } + } else { + if (_exists19(aggFunc)) { + _warn28(33); + } + if (column.isValueActive()) { + this.setColValueActive(column, false, source); + this.modifyColumnsNoEventsCallbacks.removeCol(column); + } + } + } + } + setValueActive(active, column, source) { + if (active === column.isValueActive()) { + return; + } + this.setColValueActive(column, active, source); + if (active && !column.getAggFunc() && this.aggFuncSvc) { + const initialAggFunc = this.aggFuncSvc.getDefaultAggFunc(column); + this.setColAggFunc(column, initialAggFunc); + } + } + setColAggFunc(column, aggFunc) { + column.aggFunc = aggFunc; + column.dispatchStateUpdatedEvent("aggFunc"); + } + setColValueActive(column, value, source) { + if (column.aggregationActive !== value) { + column.aggregationActive = value; + column.dispatchColEvent("columnValueChanged", source); + } + } +}; + +// packages/ag-grid-enterprise/src/aggregation/aggregationModule.ts +var SharedAggregationModule = { + moduleName: "SharedAggregation", + version: VERSION, + beans: [AggFuncService, AggColumnNameService, FooterService, ValueColsSvc], + apiFunctions: { + addAggFuncs, + clearAggFuncs, + setColumnAggFunc + }, + dependsOn: [EnterpriseCoreModule] +}; +var AggregationModule = { + moduleName: "Aggregation", + version: VERSION, + beans: [AggregationStage, FilterAggregatesStage, AggregatedChildrenSvc], + rowModels: ["clientSide"], + dependsOn: [SharedAggregationModule] +}; + +// packages/ag-grid-enterprise/src/pivot/pivotColsSvc.ts +import { BaseColsService as BaseColsService2, _removeFromArray as _removeFromArray4 } from "ag-grid-community"; +var PivotColsSvc = class extends BaseColsService2 { + constructor() { + super(...arguments); + this.beanName = "pivotColsSvc"; + this.eventName = "columnPivotChanged"; + this.columnProcessors = { + set: (column, added, source) => this.setColPivotActive(column, added, source), + add: (column, added, source) => this.setColPivotActive(column, true, source), + remove: (column, added, source) => this.setColPivotActive(column, false, source) + }; + this.columnOrdering = { + enableProp: "pivot", + initialEnableProp: "initialPivot", + indexProp: "pivotIndex", + initialIndexProp: "initialPivotIndex" + }; + this.columnExtractors = { + setFlagFunc: (col, flag, source) => this.setColPivotActive(col, flag, source), + getIndexFunc: (colDef) => colDef.pivotIndex, + getInitialIndexFunc: (colDef) => colDef.initialPivotIndex, + getValueFunc: (colDef) => colDef.pivot, + getInitialValueFunc: (colDef) => colDef.initialPivot + }; + this.modifyColumnsNoEventsCallbacks = { + addCol: (column) => { + if (!this.columns.includes(column)) { + this.columns.push(column); + } + }, + removeCol: (column) => _removeFromArray4(this.columns, column) + }; + } + syncColumnWithState(column, source, getValue, rowIndex) { + const { value1: pivot, value2: pivotIndex } = getValue("pivot", "pivotIndex"); + if (pivot !== void 0 || pivotIndex !== void 0) { + if (typeof pivotIndex === "number" || pivot) { + if (!column.isPivotActive()) { + this.setColPivotActive(column, true, source); + this.modifyColumnsNoEventsCallbacks.addCol(column); + } + if (rowIndex && typeof pivotIndex === "number") { + rowIndex[column.getId()] = pivotIndex; + } + } else if (column.isPivotActive()) { + this.setColPivotActive(column, false, source); + this.modifyColumnsNoEventsCallbacks.removeCol(column); + } + } + } + setColPivotActive(column, pivot, source) { + if (column.pivotActive !== pivot) { + column.pivotActive = pivot; + if (pivot) { + const addedCols = this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns, column); + addedCols?.forEach((c) => this.setColPivotActive(c, pivot, source)); + } + column.dispatchColEvent("columnPivotChanged", source); + } + column.dispatchStateUpdatedEvent("pivot"); + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupColsSvc.ts +import { BaseColsService as BaseColsService3, _removeFromArray as _removeFromArray5, _shouldUpdateColVisibilityAfterGroup as _shouldUpdateColVisibilityAfterGroup2 } from "ag-grid-community"; +var RowGroupColsSvc = class extends BaseColsService3 { + constructor() { + super(...arguments); + this.beanName = "rowGroupColsSvc"; + this.eventName = "columnRowGroupChanged"; + this.columnProcessors = { + set: (column, added, source) => this.setActive(added, column, source), + add: (column, added, source) => this.setActive(true, column, source), + remove: (column, added, source) => this.setActive(false, column, source) + }; + this.columnOrdering = { + enableProp: "rowGroup", + initialEnableProp: "initialRowGroup", + indexProp: "rowGroupIndex", + initialIndexProp: "initialRowGroupIndex" + }; + this.columnExtractors = { + setFlagFunc: (col, flag, source) => this.setColRowGroupActive(col, flag, source), + getIndexFunc: (colDef) => colDef.rowGroupIndex, + getInitialIndexFunc: (colDef) => colDef.initialRowGroupIndex, + getValueFunc: (colDef) => colDef.rowGroup, + getInitialValueFunc: (colDef) => colDef.initialRowGroup + }; + this.modifyColumnsNoEventsCallbacks = { + addCol: (column) => { + if (!this.columns.includes(column)) { + this.columns.push(column); + } + }, + removeCol: (column) => _removeFromArray5(this.columns, column) + }; + } + moveColumn(fromIndex, toIndex, source) { + if (this.columns.length === 0) { + return; + } + const column = this.columns[fromIndex]; + const impactedColumns = this.columns.slice(fromIndex, toIndex); + this.columns.splice(fromIndex, 1); + this.columns.splice(toIndex, 0, column); + this.updateIndexMap(); + this.eventSvc.dispatchEvent({ + type: this.eventName, + columns: impactedColumns, + column: impactedColumns.length === 1 ? impactedColumns[0] : null, + source + }); + } + syncColumnWithState(column, source, getValue, rowIndex) { + const { value1: rowGroup, value2: rowGroupIndex } = getValue("rowGroup", "rowGroupIndex"); + if (rowGroup !== void 0 || rowGroupIndex !== void 0) { + if (typeof rowGroupIndex === "number" || rowGroup) { + if (!column.isRowGroupActive()) { + this.setColRowGroupActive(column, true, source); + this.modifyColumnsNoEventsCallbacks.addCol(column); + } + if (rowIndex && typeof rowGroupIndex === "number") { + rowIndex[column.getId()] = rowGroupIndex; + } + } else if (column.isRowGroupActive()) { + this.setColRowGroupActive(column, false, source); + this.modifyColumnsNoEventsCallbacks.removeCol(column); + } + } + } + setActive(active, column, source) { + if (active === column.isRowGroupActive()) { + return; + } + this.setColRowGroupActive(column, active, source); + const isGroupHierarchyCol = this.beans.groupHierarchyColSvc?.getColumn(column); + if (_shouldUpdateColVisibilityAfterGroup2(this.gos, active) && !isGroupHierarchyCol) { + this.colModel.setColsVisible([column], !active, source); + } + } + setColRowGroupActive(column, rowGroup, source) { + if (column.rowGroupActive !== rowGroup) { + column.rowGroupActive = rowGroup; + if (rowGroup) { + const addedCols = this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns, column); + addedCols?.forEach((c) => this.setColRowGroupActive(c, rowGroup, source)); + } + column.dispatchColEvent("columnRowGroupChanged", source); + } + column.dispatchStateUpdatedEvent("rowGroup"); + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/autoColService.ts +import { + AgColumn, + BeanStub as BeanStub30, + GROUP_AUTO_COLUMN_ID, + _addColumnDefaultAndTypes, + _applyColumnState as _applyColumnState2, + _areColIdsEqual, + _columnsMatch, + _convertColumnEventSourceType, + _destroyColumnTree, + _getColumnStateFromColDef, + _isColumnsSortingCoupledToGroup, + _isGroupHideColumnsUntilExpanded, + _isGroupMultiAutoColumn, + _isGroupUseEntireRow, + _mergeDeep as _mergeDeep3, + _missing as _missing3, + _updateColsMap, + _warn as _warn29, + isColumnGroupAutoCol as isColumnGroupAutoCol2 +} from "ag-grid-community"; +var AutoColService = class extends BeanStub30 { + constructor() { + super(...arguments); + this.beanName = "autoColSvc"; + } + postConstruct() { + this.addManagedPropertyListener("autoGroupColumnDef", this.updateColumns.bind(this)); + this.setupGroupHideColumnsUntilExpanded(); + } + setupGroupHideColumnsUntilExpanded() { + const updateGroupColumnVisibility = () => this.updateGroupColumnVisibility(); + this.addManagedEventListeners({ + // modelUpdated is fired when rowGroup events are fired so we do not duplicate work by also listening to "rowGroupOpened" and "expandOrCollapseAll" + modelUpdated: updateGroupColumnVisibility + }); + this.addManagedPropertyListeners( + ["groupHideColumnsUntilExpanded", "groupDisplayType", "groupHideOpenParents"], + updateGroupColumnVisibility + ); + } + addColumns(cols) { + const { columns } = this; + if (columns == null) { + return; + } + cols.list = columns.list.concat(cols.list); + cols.tree = columns.tree.concat(cols.tree); + _updateColsMap(cols); + } + createColumns(cols, updateOrders, source) { + const beans = this.beans; + const { colModel, gos, rowGroupColsSvc, colGroupSvc } = beans; + const isPivotMode2 = colModel.isPivotMode(); + const groupFullWidthRow = _isGroupUseEntireRow(gos, isPivotMode2); + const suppressAutoColumn = isPivotMode2 ? gos.get("pivotSuppressAutoColumn") : this.isSuppressAutoCol(); + const rowGroupCols = rowGroupColsSvc?.columns; + const groupingActive = rowGroupCols && rowGroupCols.length > 0 || gos.get("treeData"); + const noAutoCols = !groupingActive || suppressAutoColumn || groupFullWidthRow; + const destroyPrevious = () => { + if (this.columns) { + _destroyColumnTree(beans, this.columns.tree); + this.columns = null; + } + }; + if (noAutoCols) { + destroyPrevious(); + return; + } + const list = this.generateAutoCols(rowGroupCols); + const autoColsSame = _areColIdsEqual(list, this.columns?.list || null); + const newTreeDepth = cols.treeDepth; + const oldTreeDepth = this.columns ? this.columns.treeDepth : -1; + const treeDepthSame = oldTreeDepth == newTreeDepth; + if (autoColsSame && treeDepthSame) { + const colsMap = new Map(list.map((col) => [col.getId(), col])); + for (const col of this.columns?.list ?? []) { + const newDef = colsMap.get(col.getId()); + if (newDef) { + col.setColDef(newDef.getColDef(), null, source); + } + } + return; + } + destroyPrevious(); + const treeDepth = colGroupSvc?.findDepth(cols.tree) ?? 0; + const tree = colGroupSvc?.balanceTreeForAutoCols(list, treeDepth) ?? []; + this.columns = { + list, + tree, + treeDepth, + map: {} + }; + const putAutoColsFirstInList = (cols2) => { + if (!cols2) { + return null; + } + const colsFiltered = cols2.filter((col) => !isColumnGroupAutoCol2(col)); + return [...list, ...colsFiltered]; + }; + updateOrders(putAutoColsFirstInList); + } + updateColumns(event) { + const source = _convertColumnEventSourceType(event.source); + this.columns?.list.forEach((col, index) => this.updateOneAutoCol(col, index, source)); + } + getColumn(key) { + return this.columns?.list.find((groupCol) => _columnsMatch(groupCol, key)) ?? null; + } + getColumns() { + return this.columns?.list ?? null; + } + generateAutoCols(rowGroupCols = []) { + const autoCols = []; + const { gos } = this; + const doingTreeData = gos.get("treeData"); + let doingMultiAutoColumn = _isGroupMultiAutoColumn(gos); + if (doingTreeData && doingMultiAutoColumn) { + _warn29(182); + doingMultiAutoColumn = false; + } + if (doingMultiAutoColumn) { + rowGroupCols.forEach((rowGroupCol, index) => { + autoCols.push(this.createOneAutoCol(rowGroupCol, index)); + }); + } else { + autoCols.push(this.createOneAutoCol()); + } + return autoCols; + } + isSuppressAutoCol() { + const gos = this.gos; + const groupDisplayType = gos.get("groupDisplayType"); + const isCustomRowGroups = groupDisplayType === "custom"; + if (isCustomRowGroups) { + return true; + } + const treeDataDisplayType = gos.get("treeDataDisplayType"); + return treeDataDisplayType === "custom"; + } + // rowGroupCol and index are missing if groupDisplayType != "multipleColumns" + createOneAutoCol(rowGroupCol, index) { + let colId; + if (rowGroupCol) { + colId = `${GROUP_AUTO_COLUMN_ID}-${rowGroupCol.getId()}`; + } else { + colId = GROUP_AUTO_COLUMN_ID; + } + const colDef = this.createAutoColDef(colId, rowGroupCol, index); + colDef.colId = colId; + const newCol = new AgColumn(colDef, null, colId, true); + this.createBean(newCol); + return newCol; + } + /** + * Refreshes an auto group col to load changes from defaultColDef or autoGroupColDef + */ + updateOneAutoCol(colToUpdate, index, source) { + const oldColDef = colToUpdate.getColDef(); + const underlyingColId = typeof oldColDef.showRowGroup == "string" ? oldColDef.showRowGroup : void 0; + const beans = this.beans; + const underlyingColumn = underlyingColId != null ? beans.colModel.getColDefCol(underlyingColId) : void 0; + const colId = colToUpdate.getId(); + const colDef = this.createAutoColDef(colId, underlyingColumn ?? void 0, index); + colToUpdate.setColDef(colDef, null, source); + _applyColumnState2(beans, { state: [_getColumnStateFromColDef(colDef, colId)] }, source); + } + createAutoColDef(colId, underlyingColumn, index) { + let res = this.createBaseColDef(underlyingColumn); + const autoGroupColumnDef = this.gos.get("autoGroupColumnDef"); + _mergeDeep3(res, autoGroupColumnDef); + res = _addColumnDefaultAndTypes(this.beans, res, colId, true); + if (autoGroupColumnDef?.groupRowEditable == null) { + res.groupRowEditable = void 0; + } + if (autoGroupColumnDef?.groupRowValueSetter == null) { + res.groupRowValueSetter = void 0; + } + if (!this.gos.get("treeData")) { + const noFieldOrValueGetter = _missing3(res.field) && _missing3(res.valueGetter) && _missing3(res.filterValueGetter) && res.filter !== "agGroupColumnFilter"; + if (noFieldOrValueGetter) { + res.filter = false; + } + } + if (index && index > 0) { + res.headerCheckboxSelection = false; + } + const isSortingCoupled = _isColumnsSortingCoupledToGroup(this.gos); + const hasOwnData = res.valueGetter || res.field != null; + if (isSortingCoupled && !hasOwnData) { + res.sortIndex = void 0; + res.initialSort = void 0; + } + return res; + } + createBaseColDef(rowGroupCol) { + const userDef = this.gos.get("autoGroupColumnDef"); + const localeTextFunc = this.getLocaleTextFunc(); + const res = { + headerName: localeTextFunc("group", "Group"), + showRowGroup: rowGroupCol?.getColId() ?? true + }; + const userHasProvidedGroupCellRenderer = userDef && (userDef.cellRenderer || userDef.cellRendererSelector); + if (!userHasProvidedGroupCellRenderer) { + res.cellRenderer = "agGroupCellRenderer"; + } + if (rowGroupCol) { + res.headerName = this.beans.colNames.getDisplayNameForColumn(rowGroupCol, "header") ?? void 0; + res.headerValueGetter = rowGroupCol.colDef.headerValueGetter; + } + return res; + } + getDeepestExpandedLevel(nodes, maxLevel) { + let deepest = -1; + if (!nodes) { + return deepest; + } + for (const node of nodes) { + if (!node.group || !node.expanded) { + continue; + } + if (node.level > deepest) { + deepest = node.level; + } + if (deepest >= maxLevel) { + return deepest; + } + const childDeepest = this.getDeepestExpandedLevel(node.childrenAfterGroup, maxLevel); + if (childDeepest > deepest) { + deepest = childDeepest; + } + if (deepest >= maxLevel) { + return deepest; + } + } + return deepest; + } + updateGroupColumnVisibility() { + const columns = this.columns?.list; + if (!columns || columns.length === 0) { + return; + } + const { gos, visibleCols, rowModel } = this.beans; + const isFeatureEnabled = _isGroupHideColumnsUntilExpanded(gos); + let changed = false; + const setColVisible = (col, visible) => { + if (visible !== col.isVisible()) { + col.setVisible(visible, "api"); + changed = true; + } + }; + const setAllColumnsVisible = () => { + for (const col of columns) { + setColVisible(col, true); + } + }; + if (!isFeatureEnabled) { + setAllColumnsVisible(); + } else if (columns.length > 1) { + const maxLevel = columns.length - 2; + const rootChildren = rowModel?.rootNode?.childrenAfterGroup; + const deepestExpandedLevel = this.getDeepestExpandedLevel(rootChildren, maxLevel); + if (deepestExpandedLevel >= maxLevel) { + setAllColumnsVisible(); + } else { + for (let level = 0; level < columns.length - 1; level++) { + setColVisible(columns[level + 1], deepestExpandedLevel >= level); + } + } + } + if (changed) { + visibleCols.refresh("api"); + } + } + destroy() { + _destroyColumnTree(this.beans, this.columns?.tree); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/changedPathImpl/changedPathFactory.ts +import { BeanStub as BeanStub31 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/sortNodesByDepthFirst.ts +var _sortBuckets = null; +var sortBucketsAlloc = (minBucket) => { + const old = _sortBuckets; + const newBuckets = new Uint32Array(1 << 32 - Math.clz32(minBucket | 63)); + if (old) { + newBuckets.set(old); + } + _sortBuckets = newBuckets; + return newBuckets; +}; +var sortTwoLevels = (nodes, nodeCount, deepest, deepCount) => { + const shallowCount = nodeCount - deepCount; + const deepLevel = deepest - 1; + if (shallowCount === 1) { + let si2 = 0; + while (nodes[si2].level === deepLevel) { + ++si2; + } + if (si2 < nodeCount - 1) { + const shallow2 = nodes[si2]; + nodes.copyWithin(si2, si2 + 1); + nodes[nodeCount - 1] = shallow2; + } + return nodes; + } + if (deepCount === 1) { + let di2 = 0; + while (nodes[di2].level !== deepLevel) { + ++di2; + } + if (di2 > 0) { + const deep = nodes[di2]; + nodes.copyWithin(1, 0, di2); + nodes[0] = deep; + } + return nodes; + } + const shallow = new Array(shallowCount); + let di = 0; + let si = 0; + for (let i = 0; i < nodeCount; ++i) { + const node = nodes[i]; + if (node.level === deepLevel) { + nodes[di++] = node; + } else { + shallow[si++] = node; + } + } + for (let i = 0; i < shallowCount; ++i) { + nodes[deepCount + i] = shallow[i]; + } + return nodes; +}; +var countingSort = (nodes, nodesLen) => { + let deepest = nodes[0].level + 1; + let shallowest = deepest; + let unsorted = 0; + let prevB = deepest; + let buckets = _sortBuckets; + if (!buckets || deepest >= buckets.length) { + buckets = sortBucketsAlloc(deepest); + } + ++buckets[deepest]; + for (let i = 1; i < nodesLen; ++i) { + const b = nodes[i].level + 1; + if (b > deepest) { + deepest = b; + if (deepest >= buckets.length) { + buckets = sortBucketsAlloc(deepest); + } + } else if (b < shallowest) { + shallowest = b; + } + ++buckets[b]; + unsorted |= prevB - b; + prevB = b; + } + if (unsorted >= 0) { + buckets.fill(0, shallowest, deepest + 1); + return nodes; + } + const sCount = buckets[shallowest]; + const dCount = buckets[deepest]; + if (sCount + dCount === nodesLen) { + buckets[shallowest] = 0; + buckets[deepest] = 0; + return sortTwoLevels(nodes, nodesLen, deepest, dCount); + } + let pos = 0; + for (let b = deepest; b >= shallowest; --b) { + const count = buckets[b]; + buckets[b] = pos; + pos += count; + } + const output = new Array(nodesLen); + for (let i = 0; i < nodesLen; ++i) { + const node = nodes[i]; + output[buckets[node.level + 1]++] = node; + } + buckets.fill(0, shallowest, deepest + 1); + return output; +}; +var _sortNodesByDepthFirst = (nodes, nodesLen = nodes.length) => { + if (nodesLen === 2) { + if (nodes[0].level < nodes[1].level) { + const tmp = nodes[0]; + nodes[0] = nodes[1]; + nodes[1] = tmp; + } + return nodes; + } + if (nodesLen > 16) { + return countingSort(nodes, nodesLen); + } + for (let i = 1; i < nodesLen; i++) { + const value = nodes[i]; + const valueLevel = value.level; + let j = i - 1; + if (nodes[j].level < valueLevel) { + let k = i; + do { + nodes[k] = nodes[j]; + k = j--; + } while (j >= 0 && nodes[j].level < valueLevel); + nodes[k] = value; + } + } + return nodes; +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/changedPathImpl/changedCellsPath.ts +var ChangedCellsPathImpl = class { + constructor() { + this.kind = "cells"; + /** + * All tracked rows, lazily sorted by depth-first when `getSortedRows` is called. + * Space: O(R) where R = number of tracked rows (including ancestors). + */ + this.rows = []; + /** + * True when `rows` needs resorting, set after new tracked rows are added. + * Space: O(1). + */ + this.unsorted = false; + /** + * Maps RowNode to row slot (or -1 for all-columns) and colId string to column slot. + * Used also to check if a row is tracked (has a slot) in O(1). + * RowNode keys never collide with string keys in a Map. + * Space: O(R + C) where R = number of tracked rows (including ancestors), C = number of tracked columns. + */ + this.slots = /* @__PURE__ */ new Map(); + /** + * Bitmask array for the first 32 columns. Always present. + * Space: O(R) where R = number of tracked rows (including ancestors). + */ + this.bits = []; + /** + * Extra bitmask arrays for columns 32+. `null` when C ≤ 32; `extraBits[0]` covers columns 32–63, etc. + * Space: O(R × max(0, ⌈C/32⌉ − 1)) where R = number of tracked rows (including ancestors), C = number of tracked columns. + */ + this.extraBits = null; + /** + * Number of distinct column IDs added via `addCell`, used to assign column slots. + * Does not include columns tracked via `addRow` (all-columns). Time: O(1). + * Space: O(1). + */ + this.colCount = 0; + } + /** {@inheritDoc ChangedCellsPath.addRow} Time: O(D), D = depth. */ + addRow(rowNode) { + let node = rowNode; + if (node == null) { + return; + } + const slots = this.slots; + if (slots.get(node) !== void 0) { + while (node != null && slots.get(node) >= 0) { + slots.set(node, -1); + node = node.parent; + } + return; + } + const rows = this.rows; + do { + slots.set(node, -1); + rows.push(node); + node = node.parent; + } while (node != null && !slots.has(node)); + this.unsorted = true; + } + /** {@inheritDoc ChangedCellsPath.addCell} Time: O(D × ⌈C/32⌉), D = depth, C = tracked columns. */ + addCell(rowNode, colId) { + if (colId == null) { + this.addRow(rowNode); + return; + } + if (rowNode == null) { + return; + } + const slots = this.slots; + const bits = this.bits; + const colSlot = slots.get(colId) ?? this.ensureCol(colId); + let rowSlot = slots.get(rowNode); + if (rowSlot === void 0) { + rowSlot = this.ensureRow(rowNode); + } else if (rowSlot < 0) { + return; + } + const word = colSlot < 32 ? bits : this.extraBits[(colSlot >>> 5) - 1]; + const bit = 1 << (colSlot & 31); + const rowBits = word[rowSlot]; + if ((rowBits & bit) !== 0) { + return; + } + word[rowSlot] = rowBits | bit; + let parent = rowNode.parent; + while (parent != null) { + const pSlot = slots.get(parent); + if (pSlot < 0) { + break; + } + const pBits = word[pSlot]; + if ((pBits & bit) !== 0) { + break; + } + word[pSlot] = pBits | bit; + parent = parent.parent; + } + } + /** {@inheritDoc ChangedCellsPath.hasRow} Time: O(1). */ + hasRow(rowNode) { + return this.slots.has(rowNode); + } + /** {@inheritDoc ChangedCellsPath.getSortedRows} Time: O(1) cached, O(R) if sort was invalidated. */ + getSortedRows() { + if (!this.unsorted) { + return this.rows; + } + this.unsorted = false; + const rows = _sortNodesByDepthFirst(this.rows); + this.rows = rows; + return rows; + } + /** {@inheritDoc ChangedCellsPath.getSlot} Read-only — does not allocate slots. Time: O(1). */ + getSlot(key) { + return this.slots.get(key) ?? -1; + } + /** {@inheritDoc ChangedCellsPath.hasCellBySlot} Time: O(1). */ + hasCellBySlot(rowSlot, colSlot) { + if (rowSlot < 0) { + return true; + } + if (colSlot < 32) { + return colSlot >= 0 && (this.bits[rowSlot] & 1 << colSlot) !== 0; + } + return (this.extraBits[(colSlot >>> 5) - 1][rowSlot] & 1 << (colSlot & 31)) !== 0; + } + /** Registers a new row and all its unregistered ancestors. Returns the row's bitmask index. + * Time: O(D × ⌈C/32⌉) where D = depth, C = number of tracked columns. In practice O(D) because + * C < 32 is the common case (single bitmask word per row, no extraBits loop). + * Space: O(D × ⌈C/32⌉). + */ + ensureRow(rowNode) { + const slots = this.slots; + const rows = this.rows; + const bits = this.bits; + const extraBits = this.extraBits; + let nextSlot = bits.push(0); + const originSlot = nextSlot - 1; + if (extraBits !== null) { + for (let w = 0, len = extraBits.length; w < len; ++w) { + extraBits[w].push(0); + } + } + slots.set(rowNode, originSlot); + rows.push(rowNode); + this.unsorted = true; + let p = rowNode.parent; + while (p != null && !slots.has(p)) { + slots.set(p, nextSlot); + rows.push(p); + nextSlot = bits.push(0); + if (extraBits !== null) { + for (let w = 0, len = extraBits.length; w < len; ++w) { + extraBits[w].push(0); + } + } + p = p.parent; + } + return originSlot; + } + /** + * Assigns a new column slot. Appends a bitmask array when crossing a 32-column boundary. + * Time: O(1) amortised, O(R) when crossing a 32-column boundary, where R = number of tracked rows (including ancestors) due to array extension and copying. + * Space: O(R) when crossing a 32-column boundary. + */ + ensureCol(colId) { + const colSlot = this.colCount++; + this.slots.set(colId, colSlot); + if (colSlot >= 32) { + const extraBitsIndex = (colSlot >>> 5) - 1; + let extraBits = this.extraBits; + if (extraBits === null) { + extraBits = []; + this.extraBits = extraBits; + } + if (extraBitsIndex >= extraBits.length) { + extraBits.push(new Array(this.bits.length).fill(0)); + } + } + return colSlot; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/changedPathImpl/changedRowsPath.ts +var ChangedRowsPathImpl = class { + constructor() { + this.kind = "rows"; + /** + * All tracked rows, lazily sorted by depth-first when `getSortedRows` is called. + * Space: O(R) where R = number of tracked rows (including ancestors). + */ + this.rows = []; + /** + * True when `rows` needs resorting, set after new tracked rows are added. + * Space: O(1). + */ + this.unsorted = false; + /** + * Hash set that keeps track of which rows are in `rows` for O(1) lookup. + * Space: O(R) where R = number of tracked rows (including ancestors). + */ + this.rowSet = /* @__PURE__ */ new Set(); + } + /** {@inheritDoc ChangedRowsPath.addRow} Time: O(D), D = depth. */ + addRow(rowNode) { + let node = rowNode; + if (node == null) { + return; + } + const rowSet = this.rowSet; + if (rowSet.has(node)) { + return; + } + const rows = this.rows; + do { + rowSet.add(node); + rows.push(node); + node = node.parent; + } while (node != null && !rowSet.has(node)); + this.unsorted = true; + } + /** {@inheritDoc ChangedRowsPath.addCell} */ + addCell(rowNode, _colId) { + this.addRow(rowNode); + } + /** {@inheritDoc ChangedRowsPath.hasRow} Time: O(1). */ + hasRow(rowNode) { + return this.rowSet.has(rowNode); + } + /** {@inheritDoc ChangedRowsPath.getSortedRows} Time: O(1) cached, O(R) if sort was invalidated. */ + getSortedRows() { + if (!this.unsorted) { + return this.rows; + } + this.unsorted = false; + const rows = _sortNodesByDepthFirst(this.rows); + this.rows = rows; + return rows; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/changedPathImpl/changedPathFactory.ts +var ChangedPathFactory = class extends BeanStub31 { + constructor() { + super(...arguments); + this.beanName = "changedPathFactory"; + } + /** {@inheritDoc IChangedPathFactory.newPath} */ + newPath(trackCells) { + return trackCells ? new ChangedCellsPathImpl() : new ChangedRowsPathImpl(); + } + /** {@inheritDoc IChangedPathFactory.ensureRowsPath} */ + ensureRowsPath(params) { + let changedPath = params.changedPath; + if (!changedPath && params.changedRowNodes && !params.newData) { + const rowModel = this.beans.rowModel; + if (rowModel.hierarchical) { + changedPath = new ChangedRowsPathImpl(); + params.changedPath = changedPath; + changedPath.addRow(rowModel.rootNode); + } + } + return changedPath; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/clientSideExpansionService.ts +import { _exists as _exists20 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/baseExpansionService.ts +import { BeanStub as BeanStub32, _addGridCommonParams as _addGridCommonParams18, _createGlobalRowEvent, _setAriaExpanded as _setAriaExpanded8 } from "ag-grid-community"; +var BaseExpansionService = class extends BeanStub32 { + addExpandedCss(classes, rowNode) { + if (rowNode.isExpandable()) { + classes.push("ag-row-group"); + classes.push(rowNode.expanded ? "ag-row-group-expanded" : "ag-row-group-contracted"); + } + } + getRowExpandedListeners(rowCtrl) { + const { rowNode } = rowCtrl; + const updateExpandedCss = this.updateExpandedCss.bind(this, rowCtrl, rowNode); + return { + expandedChanged: updateExpandedCss, + hasChildrenChanged: updateExpandedCss + }; + } + setExpanded(rowNode, expanded, e, forceSync) { + if (rowNode.expanded === expanded) { + return; + } + rowNode._expanded = expanded; + rowNode.dispatchRowEvent("expandedChanged"); + const event = { ..._createGlobalRowEvent(rowNode, this.gos, "rowGroupOpened"), expanded, event: e || null }; + this.dispatchExpandedEvent(event, forceSync); + } + defaultExpanded(rowNode) { + const beans = this.beans; + const gos = beans.gos; + const level = rowNode.level ?? 0; + const isGroupOpenByDefault = rowNode.group && gos.get("isGroupOpenByDefault"); + if (!isGroupOpenByDefault) { + const groupDefaultExpanded = gos.get("groupDefaultExpanded"); + return groupDefaultExpanded === -1 || level < groupDefaultExpanded; + } + const params = _addGridCommonParams18(gos, { + rowNode, + field: rowNode.field, + key: rowNode.key, + level, + rowGroupColumn: rowNode.rowGroupColumn + }); + return !!isGroupOpenByDefault(params); + } + isExpandable(rowNode) { + if (rowNode.footer) { + return false; + } + if (this.beans.colModel.isPivotMode()) { + return rowNode.hasChildren() && !rowNode.leafGroup; + } + return rowNode.hasChildren() || rowNode.master; + } + updateExpandedCss(rowCtrl, rowNode) { + const expandable = rowNode.isExpandable(); + const expanded = rowNode.expanded == true; + rowCtrl.forEachGui(void 0, (gui) => { + const rowComp = gui.rowComp; + rowComp.toggleCss("ag-row-group", expandable); + rowComp.toggleCss("ag-row-group-expanded", expandable && expanded); + rowComp.toggleCss("ag-row-group-contracted", expandable && !expanded); + _setAriaExpanded8(gui.element, expandable && expanded); + }); + } + dispatchStateUpdatedEvent() { + this.eventSvc.dispatchEvent({ type: "rowExpansionStateChanged" }); + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/clientSideExpansionService.ts +var ClientSideExpansionService = class extends BaseExpansionService { + constructor() { + super(...arguments); + this.beanName = "expansionSvc"; + this.events = null; + this.dispatchExpandedDebounced = null; + } + destroy() { + super.destroy(); + this.events = null; + this.dispatchExpandedDebounced = null; + } + setExpansionState(state) { + const rowIdsToExpandSet = new Set(state.expandedRowGroupIds); + this.beans.rowModel.forEachNode((node) => { + const id = node.id; + if (!id) { + return; + } + node._expanded = rowIdsToExpandSet.has(id); + }); + this.onGroupExpandedOrCollapsed(); + } + getInternalExpansionState(allowCollapsed = false) { + const expandedRowGroupIds = []; + const collapsedRowGroupIds = []; + this.beans.rowModel.forEachNode((node) => { + const id = node.id; + if (!id) { + return; + } + if (node.expanded) { + expandedRowGroupIds.push(id); + } else if (allowCollapsed && node.isExpandable()) { + collapsedRowGroupIds.push(id); + } + }); + return { expandedRowGroupIds, collapsedRowGroupIds }; + } + getExpansionState() { + return this.getInternalExpansionState(); + } + isExpanded(rowNode) { + if (rowNode.footer) { + return !!rowNode._expanded; + } + if (!(rowNode.group || rowNode.master) || rowNode.leafGroup && this.beans.colModel.isPivotMode()) { + return false; + } + let value = rowNode._expanded; + if (value === null) { + value = this.defaultExpanded(rowNode) ?? false; + rowNode._expanded = value; + } + return !!value; + } + resetExpansion() { + const { rowModel } = this.beans; + rowModel.forEachNode((node) => { + if (!node.group && !node.master) { + return; + } + node._expanded = null; + }); + this.onGroupExpandedOrCollapsed(); + } + expandAll(expand) { + const { gos, rowModel, colModel, eventSvc } = this.beans; + const usingTreeData = gos.get("treeData"); + const usingPivotMode = colModel.isPivotActive(); + const recursiveExpandOrCollapse = (rowNodes) => { + if (!rowNodes) { + return; + } + for (const rowNode of rowNodes) { + const actionRow = () => { + rowNode._expanded = expand; + recursiveExpandOrCollapse(rowNode.childrenAfterGroup); + }; + if (rowNode.master) { + actionRow(); + continue; + } + if (usingTreeData) { + const hasChildren = _exists20(rowNode.childrenAfterGroup); + if (hasChildren) { + actionRow(); + } + continue; + } + if (usingPivotMode) { + const notLeafGroup = !rowNode.leafGroup; + if (notLeafGroup) { + actionRow(); + } + continue; + } + const isRowGroup = rowNode.group; + if (isRowGroup) { + actionRow(); + } + } + }; + const rootNode = rowModel.rootNode; + if (rootNode) { + recursiveExpandOrCollapse(rootNode.childrenAfterGroup); + } + this.onGroupExpandedOrCollapsed(); + eventSvc.dispatchEvent({ + type: "expandOrCollapseAll", + source: expand ? "expandAll" : "collapseAll" + }); + } + onGroupExpandedOrCollapsed() { + this.dispatchStateUpdatedEvent(); + this.beans.rowModel.reMapRows(); + } + setDetailsExpansionState(detailGridApi) { + const expansionState = this.getInternalExpansionState(true); + const allExpanded = expansionState.collapsedRowGroupIds.length === 0; + const allCollapsed = expansionState.expandedRowGroupIds.length === 0; + if (allCollapsed === allExpanded) { + return; + } + return allExpanded ? detailGridApi.expandAll() : detailGridApi.collapseAll(); + } + /** + * because the user can call rowNode.setExpanded() many times in one VM turn, + * we throttle the calls to ClientSideRowModel using animationFrameSvc. this means for 100 + * row nodes getting expanded, we only update the CSRM once, and then we fire all events after + * CSRM has updated. + * + * if we did not do this, then the user could call setExpanded on 100+ rows, causing the grid + * to re-render 100+ times, which would be a performance lag. + * + * we use animationFrameService + * rather than debounce() so this will get done if anyone flushes the animationFrameService + * (eg user calls api.ensureRowVisible(), which in turn flushes ). + */ + dispatchExpandedEvent(event, forceSync) { + (this.events ?? (this.events = [])).push(event); + if (forceSync) { + this.dispatchExpandedEvents(); + return; + } + let dispatch = this.dispatchExpandedDebounced; + if (!dispatch) { + if (!this.isAlive()) { + return; + } + dispatch = this.debounce(() => this.dispatchExpandedEvents()); + this.dispatchExpandedDebounced = dispatch; + } + dispatch(); + } + dispatchExpandedEvents() { + const { eventSvc, rowRenderer } = this.beans; + const eventsToDispatch = this.events; + const eventsLen = eventsToDispatch?.length; + if (!eventsLen) { + return; + } + this.events = null; + const rowNodes = new Array(eventsLen); + for (let i = 0; i < eventsLen; ++i) { + rowNodes[i] = eventsToDispatch[i].node; + eventSvc.dispatchEvent(eventsToDispatch[i]); + } + this.dispatchStateUpdatedEvent(); + rowRenderer.refreshCells({ rowNodes }); + } + // the advantage over normal debounce is the client can call flushAllFrames() + // to make sure all rendering is complete. we don't wait any milliseconds, + // as this is intended to batch calls in one VM turn. + debounce(func) { + const animationFrameSvc = this.beans.animationFrameSvc; + if (!animationFrameSvc) { + return () => window.setTimeout(func, 0); + } + let pending = false; + return () => { + if (!animationFrameSvc.active) { + window.setTimeout(func, 0); + return; + } + if (pending) { + return; + } + pending = true; + animationFrameSvc.addDestroyTask(() => { + pending = false; + func(); + }); + }; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/flattenStage.ts +import { BeanStub as BeanStub33 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/flattenUtils.ts +import { _getGrandTotalRow as _getGrandTotalRow5, _getGroupTotalRowCallback as _getGroupTotalRowCallback2, _isGroupMultiAutoColumn as _isGroupMultiAutoColumn2 } from "ag-grid-community"; +function _getFlattenDetails(gos) { + let groupHideParentOfSingleChild = gos.get("groupHideParentOfSingleChild"); + if (!groupHideParentOfSingleChild) { + groupHideParentOfSingleChild = gos.get("groupRemoveSingleChildren"); + if (!groupHideParentOfSingleChild && gos.get("groupRemoveLowestSingleChildren")) { + groupHideParentOfSingleChild = "leafGroupsOnly"; + } + } + return { + groupHideParentOfSingleChild, + isGroupMultiAutoColumn: _isGroupMultiAutoColumn2(gos), + hideOpenParents: gos.get("groupHideOpenParents"), + grandTotalRow: _getGrandTotalRow5(gos), + groupTotalRow: _getGroupTotalRowCallback2(gos) + }; +} +function _isRemovedSingleChildrenGroup(details, rowNode, isParent) { + return details.groupHideParentOfSingleChild === true && isParent && rowNode.childrenAfterGroup.length === 1; +} +function _isRemovedLowestSingleChildrenGroup(details, rowNode, isParent) { + return details.groupHideParentOfSingleChild === "leafGroupsOnly" && isParent && rowNode.leafGroup && rowNode.childrenAfterGroup.length === 1; +} +function _shouldRowBeRendered(details, rowNode, isParent, skipLeafNodes, isRemovedSingleChildrenGroup, isRemovedLowestSingleChildrenGroup) { + if (skipLeafNodes && !isParent) { + return false; + } + if (isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup) { + return false; + } + if (!details.hideOpenParents) { + return true; + } + if (rowNode.master || rowNode.level === -1) { + return true; + } + const neverAllowToExpand = skipLeafNodes && rowNode.leafGroup; + if (!neverAllowToExpand && rowNode.expanded) { + return false; + } + return true; +} + +// packages/ag-grid-enterprise/src/rowHierarchy/flattenStage.ts +var FlattenStage = class extends BeanStub33 { + constructor() { + super(...arguments); + this.beanName = "flattenStage"; + this.step = "map"; + this.refreshProps = [ + "groupHideParentOfSingleChild", + "groupRemoveSingleChildren", + "groupRemoveLowestSingleChildren", + "groupTotalRow", + "masterDetail" + ]; + } + execute() { + const { beans, gos } = this; + const result = []; + const rootNode = beans.rowModel.rootNode; + if (!rootNode) { + return result; + } + const skipLeafNodes = beans.colModel.isPivotMode(); + const showRootNode = skipLeafNodes && rootNode.leafGroup && rootNode.aggData; + const topList = showRootNode ? [rootNode] : rootNode.childrenAfterSort; + const details = _getFlattenDetails(gos); + this.recursivelyAddToRowsToDisplay(details, topList, result, skipLeafNodes, 0); + const atLeastOneRowPresent = result.length > 0; + const grandTotalRow = details.grandTotalRow; + const includeGrandTotalRow = !showRootNode && // don't show total footer when showRootNode is true (i.e. in pivot mode and no groups) + atLeastOneRowPresent && grandTotalRow; + if (includeGrandTotalRow) { + _createRowNodeFooter(rootNode, beans); + if (grandTotalRow === "pinnedBottom" || grandTotalRow === "pinnedTop") { + this.beans.pinnedRowModel?.setGrandTotalPinned(grandTotalRow === "pinnedBottom" ? "bottom" : "top"); + } else { + const addToTop = grandTotalRow === "top"; + this.addRowNodeToRowsToDisplay(details, rootNode.sibling, result, 0, addToTop); + } + } + return result; + } + recursivelyAddToRowsToDisplay(details, rowsToFlatten, result, skipLeafNodes, uiLevel) { + if (!rowsToFlatten?.length) { + return; + } + const masterDetailSvc = this.beans.masterDetailSvc; + for (let i = 0; i < rowsToFlatten.length; i++) { + const rowNode = rowsToFlatten[i]; + const isParent = rowNode.hasChildren(); + const isRemovedSingleChildrenGroup = _isRemovedSingleChildrenGroup(details, rowNode, isParent); + const isRemovedLowestSingleChildrenGroup = _isRemovedLowestSingleChildrenGroup(details, rowNode, isParent); + const thisRowShouldBeRendered = _shouldRowBeRendered( + details, + rowNode, + isParent, + skipLeafNodes, + isRemovedSingleChildrenGroup, + isRemovedLowestSingleChildrenGroup + ); + if (thisRowShouldBeRendered) { + this.addRowNodeToRowsToDisplay(details, rowNode, result, uiLevel); + } + if (skipLeafNodes && rowNode.leafGroup) { + continue; + } + if (isParent) { + const excludedParent = isRemovedSingleChildrenGroup || isRemovedLowestSingleChildrenGroup; + if (rowNode.expanded || excludedParent) { + const doesRowShowFooter = details.groupTotalRow({ node: rowNode }); + if (!doesRowShowFooter) { + _destroyRowNodeFooter(rowNode); + } + const uiLevelForChildren = excludedParent ? uiLevel : uiLevel + 1; + if (doesRowShowFooter === "top") { + _createRowNodeFooter(rowNode, this.beans); + this.addRowNodeToRowsToDisplay(details, rowNode.sibling, result, uiLevelForChildren); + } + const detailNode = masterDetailSvc?.getDetail(rowNode); + if (detailNode) { + this.addRowNodeToRowsToDisplay(details, detailNode, result, uiLevel); + } + this.recursivelyAddToRowsToDisplay( + details, + rowNode.childrenAfterSort, + result, + skipLeafNodes, + uiLevelForChildren + ); + if (doesRowShowFooter === "bottom") { + _createRowNodeFooter(rowNode, this.beans); + this.addRowNodeToRowsToDisplay(details, rowNode.sibling, result, uiLevelForChildren); + } + } + } else { + const detailNode = masterDetailSvc?.getDetail(rowNode); + if (detailNode) { + this.addRowNodeToRowsToDisplay(details, detailNode, result, uiLevel); + } + } + } + } + // duplicated method, it's also in floatingRowModel + addRowNodeToRowsToDisplay(details, rowNode, result, uiLevel, addToTop) { + if (addToTop) { + result.unshift(rowNode); + } else { + result.push(rowNode); + } + rowNode.setUiLevel(details.isGroupMultiAutoColumn ? 0 : uiLevel); + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/groupEditService.ts +import { + BeanStub as BeanStub34, + _ChangedRowNodes, + _csrmFirstLeaf, + _csrmReorderAllLeafs, + _getCellByPosition, + _isClientSideRowModel as _isClientSideRowModel4, + _prevOrNextDisplayedRow +} from "ag-grid-community"; +var GroupEditService = class extends BeanStub34 { + constructor() { + super(...arguments); + this.beanName = "groupEditSvc"; + this.pendingEditRefresh = null; + this.dropGroupTarget = null; + this.dropGroupTimer = null; + this.dropGroupThrottled = false; + this.draggingGroups = null; + } + postConstruct() { + if (_isClientSideRowModel4(this.gos)) { + this.addManagedListeners(this.eventSvc, { + cellValueChanged: (event) => this.onCsrmCellChange(event), + batchEditingStopped: () => this.flushGroupEdits() + }); + } + } + destroy() { + this.stopDragging(true); + super.destroy(); + } + /** Checks if the drop operation described by `rowsDrop` is a grouping edit */ + isGroupingDrop(rowsDrop) { + if (!rowsDrop.rowDragManaged || !rowsDrop.sameGrid) { + return false; + } + if (!this.gos.get("refreshAfterGroupEdit")) { + return false; + } + return !!this.beans.rowGroupColsSvc?.columns?.length && !this.beans.colModel.isPivotMode(); + } + initDraggingGroups(rowsDrop) { + const structure = /* @__PURE__ */ new Map(); + const recurse = (row) => { + const childrenAfterGroup = row.childrenAfterGroup; + if (childrenAfterGroup) { + if (structure.has(row)) { + return; + } + const children = childrenAfterGroup.slice(); + structure.set(row, children); + for (const child of children) { + recurse(child); + } + } + }; + for (const row of rowsDrop.rows) { + if (row.group) { + recurse(row); + } + } + this.draggingGroups = structure; + } + /** Checks if the drop operation described by `rowsDrop` can set a new parent */ + canSetParent(rowsDrop) { + if (!rowsDrop.sameGrid) { + return false; + } + if (this.beans.groupStage?.treeData) { + return true; + } + if (rowsDrop.rowDragManaged && !this.gos.get("refreshAfterGroupEdit")) { + return false; + } + return !!this.beans.rowGroupColsSvc?.columns?.length; + } + canDropRow(rowNode, rowsDrop) { + if (this.beans.groupStage?.treeData) { + return !wouldCycle(rowNode, rowsDrop.newParent); + } + const { position, target, newParent, rootNode } = rowsDrop; + const currentParent = rowNode.parent; + if (rowNode.group && (isAncestorOrSelf(rowNode, target) || isAncestorOrSelf(rowNode, newParent))) { + return false; + } + if (position === "inside") { + return true; + } + if (newParent && newParent !== currentParent) { + return newParent !== rootNode || currentParent === rootNode; + } + const comparisonParent = newParent ?? target?.parent ?? rootNode; + if (comparisonParent !== currentParent) { + return false; + } + const sourceLevel = rowNode.group ? rowNode.level : currentParent.level ?? -1; + let targetLevel = -1; + if (target) { + targetLevel = target.group ? target.level : target.parent?.level ?? -1; + } else if (comparisonParent) { + targetLevel = comparisonParent.level; + } + if (sourceLevel >= 0 && targetLevel >= 0 && targetLevel !== sourceLevel) { + return false; + } + return true; + } + fixRowsDrop(rowsDrop, canSetParent, fromNudge, yDelta) { + const treeData = !!this.beans.groupStage?.treeData; + rowsDrop.treeData = treeData; + const isRowGrouping = !!this.beans.rowGroupColsSvc?.columns?.length || this.gos.get("pivotMode"); + if (!isRowGrouping && !treeData) { + return; + } + if (!this.draggingGroups && this.isGroupingDrop(rowsDrop) && !rowsDrop.suppressMoveWhenRowDragging) { + this.initDraggingGroups(rowsDrop); + } + let target = rowsDrop.target; + let newParent = null; + let inside = false; + const rootNode = rowsDrop.rootNode; + const rowModel = this.beans.rowModel; + const canStartGroup = this.canStartGroup(target, treeData); + this.updateDropTarget(rowsDrop, fromNudge, canStartGroup); + const lastRowIndex = this.beans.pageBounds?.getLastRow?.() ?? rowModel.getRowCount() - 1; + if (canSetParent) { + if (!target || yDelta >= 0.5 && target.rowIndex === lastRowIndex) { + newParent = rootNode; + } else if (rowsDrop.moved && target && this.dropGroupThrottled && this.shouldDropTargetBeParent(rowsDrop)) { + newParent = target; + } + if (!newParent) { + newParent = target?.parent ?? rootNode; + } + } + if (!fromNudge && target && canStartGroup && !(target.group && target.expanded)) { + this.startDropGroupDelay(target); + } + if (newParent) { + if (target && newParent === target && newParent !== rootNode) { + const firstRow = newParent.expanded ? _prevOrNextDisplayedRow(rowModel, 1, target) : null; + if (firstRow?.parent === newParent) { + target = firstRow; + yDelta = -0.5; + } else { + inside = true; + } + } + if (target && !inside) { + let current = target; + while (current && current !== rootNode && current !== newParent) { + target = current; + current = current.parent; + } + } + } + rowsDrop.target = target; + rowsDrop.newParent = newParent; + rowsDrop.yDelta = yDelta; + rowsDrop.inside = inside; + } + clearNewSameParent(rowsDrop, canSetParent) { + const newParent = rowsDrop.newParent; + if (newParent && (!canSetParent || rowsHaveSameParent(rowsDrop.rows, newParent))) { + rowsDrop.newParent = null; + } + } + updateDropTarget(rowsDrop, fromNudge, canStartGroup) { + const target = canStartGroup ? rowsDrop.target : null; + if (this.dropGroupTarget && this.dropGroupTarget !== target) { + this.resetDragGroup(); + } + if (!target?.childrenAfterSort?.length) { + return; + } + if (fromNudge && this.dropGroupThrottled && !target.expanded && target.isExpandable?.()) { + target.setExpanded(true, void 0, true); + } + if (this.canDropInTarget(target, rowsDrop)) { + this.dropGroupThrottled = true; + this.dropGroupTarget = target; + } + } + canDropInTarget(target, rowsDrop) { + if (target.expanded) { + return true; + } + if (!target.group) { + return false; + } + if (rowsDrop.pointerPos === "inside") { + return true; + } + if (rowsDrop.treeData) { + return false; + } + const rows = rowsDrop.rows; + const targetLevel = target.level; + for (let i = 0, len = rows.length; i < len; ++i) { + const row = rows[i]; + if (row !== target && row.group && row.level !== targetLevel) { + return false; + } + } + return true; + } + startDropGroupDelay(target) { + if (this.dropGroupTarget && this.dropGroupTarget !== target) { + this.resetDragGroup(); + } + this.dropGroupTarget = target; + if (this.dropGroupTimer !== null) { + return; + } + const delay = this.gos.get("rowDragInsertDelay"); + this.dropGroupTimer = window.setTimeout(() => { + this.dropGroupTimer = null; + this.dropGroupThrottled = true; + this.beans.dragAndDrop?.nudge(); + }, delay); + } + resetDragGroup() { + if (this.dropGroupTimer !== null) { + window.clearTimeout(this.dropGroupTimer); + this.dropGroupTimer = null; + } + this.dropGroupTarget = null; + this.dropGroupThrottled = false; + } + stopDragging(final) { + if (final) { + this.draggingGroups = null; + } + this.resetDragGroup(); + } + shouldDropTargetBeParent({ target, rows, pointerPos, treeData }) { + if (!target || pointerPos === "none") { + return false; + } + if (pointerPos === "inside") { + return true; + } + if (!treeData && target.group && !target.expanded) { + return true; + } + if (pointerPos === "above") { + return false; + } + const rowModel = this.beans.rowModel; + const targetRowIndex = target.rowIndex; + let nextRowIndex = targetRowIndex + 1; + let nextRow; + do { + nextRow = rowModel.getRow(nextRowIndex++); + } while (nextRow?.footer); + const childrenAfterGroup = this.draggingGroups?.get(target) ?? target.childrenAfterGroup; + if (nextRow && nextRow.parent === target && childrenAfterGroup?.length) { + const rowsSet = new Set(rows); + for (let i = 0, len = childrenAfterGroup.length; i < len; ++i) { + const child = childrenAfterGroup[i]; + if (child.rowIndex !== null && !rowsSet.has(child)) { + return true; + } + } + } + return false; + } + /** Performs the grouping edit described by `rowsDrop` */ + dropGroupEdit(rowsDrop) { + const { beans } = this; + const position = rowsDrop.position; + const target = rowsDrop.target ?? null; + const rootNode = rowsDrop.rootNode; + const parentForValues = rowsDrop.newParent ?? target?.parent ?? rootNode; + const focusSvc = beans.focusSvc; + const cellPosition = focusSvc.getFocusedCell(); + const cellCtrl = cellPosition && _getCellByPosition(beans, cellPosition); + const leafs = /* @__PURE__ */ new Set(); + const changedRowNodes = new _ChangedRowNodes(); + const updates = changedRowNodes.updates; + let newGroupValues; + const processLeaf = (leafRow) => { + if (leafs.has(leafRow)) { + return; + } + leafs.add(leafRow); + newGroupValues ?? (newGroupValues = this.newGroupValues(parentForValues)); + if (this.setRowGroup(leafRow, newGroupValues)) { + updates.add(leafRow); + } + }; + const visitGroupedChildren = (groupNode) => { + const children = this.draggingGroups?.get(groupNode) ?? groupNode.childrenAfterGroup; + const childrenLen = children?.length; + if (childrenLen) { + for (let i = 0; i < childrenLen; ++i) { + const child = children[i]; + if (child.sourceRowIndex >= 0) { + processLeaf(child); + } else { + visitGroupedChildren(child); + } + } + } + }; + for (const row of rowsDrop.rows) { + if (row.group) { + visitGroupedChildren(row); + } else { + const firstLeaf = row.sourceRowIndex >= 0 && !row.destroyed ? row : this.csrmFirstLeaf(row); + if (firstLeaf) { + processLeaf(firstLeaf); + } + } + } + const reorderPosition = position === "inside" ? "above" : position; + const reorderTarget = position === "inside" ? this.findFirstLeafForParent(parentForValues, leafs) ?? target : target; + let orderChanged = false; + if (leafs.size && reorderPosition !== "none") { + orderChanged = _csrmReorderAllLeafs(rootNode._leafs, leafs, reorderTarget, reorderPosition === "above"); + } + if (!updates.size && !orderChanged) { + return false; + } + changedRowNodes.reordered = orderChanged; + for (const leaf of leafs) { + changedRowNodes.updates.add(leaf); + } + this.csrmRefresh(changedRowNodes); + if (cellCtrl) { + cellCtrl.focusCell(); + } else { + focusSvc.clearFocusedCell(); + } + return true; + } + canStartGroup(target, treeData) { + if (!target || target.level < 0 || target.footer || target.detail) { + return false; + } + if (target.group) { + return true; + } + return treeData; + } + /** Flushes any pending group edits for batch processing */ + flushGroupEdits() { + const pending = this.pendingEditRefresh; + if (pending) { + this.pendingEditRefresh = null; + this.csrmRefresh(pending); + } + } + /** Refreshes the grouping for the provided rows */ + csrmRefresh(changedRowNodes) { + const clientSideRowModel = this.beans.rowModel; + const rootNode = clientSideRowModel.rootNode; + if (!rootNode) { + return; + } + clientSideRowModel.refreshModel({ + step: "group", + keepRenderedRows: true, + animate: !this.gos.get("suppressAnimationFrame"), + changedRowNodes + }); + } + newGroupValues(parent) { + const columns = this.beans.rowGroupColsSvc?.columns ?? []; + const values = new Array(columns.length); + let maxLevel = -1; + let current = parent; + while (current && current.level >= 0) { + const column = columns[current.level]; + if (column) { + const colId = column.getColId(); + const level = current.level; + values[level] = current.groupData?.[colId] ?? current.key ?? void 0; + if (level > maxLevel) { + maxLevel = level; + } + } + current = current.parent; + } + return { values, columns, maxLevel }; + } + setRowGroup(row, { values, columns, maxLevel }) { + if (maxLevel < 0) { + return false; + } + const { valueSvc, changeDetectionSvc } = this.beans; + let changed = false; + changeDetectionSvc?.beginDeferred(); + try { + for (let level = 0; level < columns.length; ++level) { + const column = columns[level]; + if (!column || level > maxLevel) { + continue; + } + const newValue = values[level]; + const currentValue = valueSvc.getValue(column, row, "data"); + if (currentValue === newValue || currentValue == null && newValue == null) { + continue; + } + let valueToSet = newValue; + const parsedValue = valueSvc.parseValue(column, row, newValue, currentValue); + if (parsedValue !== void 0) { + valueToSet = parsedValue; + } + const updated = row.setDataValue(column, valueToSet, "rowDrag"); + if (updated) { + changed = true; + } + } + } finally { + changeDetectionSvc?.endDeferred(); + } + return changed; + } + onCsrmCellChange(event) { + const { column, node, source } = event; + if (!this.gos.get("refreshAfterGroupEdit")) { + return; + } + if (source === "rowDrag") { + return; + } + if (!column?.isRowGroupActive()) { + return; + } + if (node.group || !node.data) { + return; + } + const editSvc = this.beans.editSvc; + if (editSvc?.isBatchEditing()) { + let pending = this.pendingEditRefresh; + if (!pending) { + pending = newEditChangedRowNodes(); + this.pendingEditRefresh = pending; + } + pending.updates.add(node); + } else { + const changedRowNodes = newEditChangedRowNodes(); + changedRowNodes.updates.add(node); + this.csrmRefresh(changedRowNodes); + } + } + csrmFirstLeaf(parent) { + if (!parent) { + return null; + } + const draggingGroups = this.draggingGroups; + let children = draggingGroups?.get(parent) ?? parent.childrenAfterGroup; + while (children?.length) { + const child = children[0]; + if (child.sourceRowIndex >= 0) { + if (!child.destroyed) { + return child; + } + return this.firstAliveChildLeaf(child); + } + children = draggingGroups?.get(child) ?? child.childrenAfterGroup; + } + return _csrmFirstLeaf(parent); + } + firstAliveChildLeaf(parent) { + const children = this.draggingGroups?.get(parent) ?? parent.childrenAfterGroup; + if (children) { + for (const grandChild of children) { + if (grandChild.sourceRowIndex >= 0 && !grandChild.destroyed) { + return grandChild; + } + } + } + return null; + } + findFirstLeafForParent(parent, exclude) { + if (!parent) { + return null; + } + const children = this.draggingGroups?.get(parent) ?? parent?.childrenAfterGroup; + if (!children) { + return null; + } + for (let i = 0, len = children.length; i < len; ++i) { + const child = children[i]; + if (child.sourceRowIndex >= 0 && !exclude.has(child)) { + return child; + } + const found = this.findFirstLeafForParent(child, exclude); + if (found !== null) { + return found; + } + } + return null; + } +}; +var newEditChangedRowNodes = () => { + const result = new _ChangedRowNodes(); + result.reordered = true; + return result; +}; +var isAncestorOrSelf = (candidate, node) => { + if (!candidate || !node) { + return false; + } + let current = node; + while (current) { + if (current === candidate) { + return true; + } + current = current.parent; + } + return false; +}; +var wouldCycle = (row, newParent) => { + if (!newParent || row.parent === newParent) { + return false; + } + let current = newParent; + const rowId = row.id; + while (current) { + if (current === row) { + return true; + } + if (rowId != null && current.id === rowId) { + return true; + } + current = current.parent; + } + return false; +}; +var rowsHaveSameParent = (rows, newParent) => { + for (let i = 0, len = rows.length; i < len; ++i) { + if (rows[i].parent !== newParent) { + return false; + } + } + return true; +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/groupStage.ts +import { BeanStub as BeanStub35 } from "ag-grid-community"; +var GroupStage = class extends BeanStub35 { + constructor() { + super(...arguments); + this.beanName = "groupStage"; + this.step = "group"; + this.refreshProps = [ + "groupAllowUnbalanced", + "groupDefaultExpanded", + "groupDisplayType", + "groupHideOpenParents", + "initialGroupOrderComparator", + "treeData", + "treeDataChildrenField", + "treeDataParentIdField" + ]; + this.treeData = false; + this.grouping = false; + this.gosTreeData = false; + this.pivotMode = false; + this.hasTreeData = false; + this.hasRowGrouping = false; + this.needReset = false; + this.nested = false; + this.strategy = void 0; + this.strategyType = void 0; + this.columnsInvalidated = false; + } + postConstruct() { + const gos = this.gos; + this.hasRowGrouping = gos.isModuleRegistered("RowGrouping"); + if (gos.isModuleRegistered("TreeData")) { + this.hasTreeData = true; + this.gosTreeData = gos.get("treeData"); + } + this.addManagedEventListeners({ + showRowGroupColsSetChanged: () => this.strategy?.onShowRowGroupColsSetChanged() + }); + } + invalidateGroupCols() { + this.columnsInvalidated = true; + this.strategy?.invalidateGroupCols?.(); + } + destroy() { + this.strategy = this.destroyBean(this.strategy); + super.destroy(); + } + getNonLeaf(id) { + return this.strategy?.nonLeafsById?.get(id); + } + getNestedDataGetter() { + return this.getStrategy()?.nestedDataGetter; + } + onPropChange(changedProps) { + const gos = this.gos; + const oldNestedDataGetter = this.strategy?.nestedDataGetter; + if (changedProps.has("treeData")) { + this.gosTreeData = gos.get("treeData") && this.hasTreeData; + this.columnsInvalidated = true; + } + this.strategy?.onPropChange?.(changedProps); + return this.getNestedDataGetter() !== oldNestedDataGetter; + } + extractData() { + const rootNode = this.beans.rowModel.rootNode; + const nodes = this.nested ? rootNode?.childrenAfterGroup : rootNode?._leafs; + if (!nodes) { + return this.gos.get("rowData") ?? []; + } + const len = nodes.length; + const result = new Array(len); + let writeIdx = 0; + for (let i = 0; i < len; ++i) { + const data = nodes[i].data; + if (data != null) { + result[writeIdx++] = data; + } + } + result.length = writeIdx; + return result; + } + execute(params) { + const beans = this.beans; + const rowModel = beans.rowModel; + const rootNode = rowModel.rootNode; + if (!rootNode) { + return false; + } + const strategy = this.getStrategy(); + const nested = !!strategy?.nestedDataGetter; + const needReset = this.needReset; + this.nested = nested; + if (needReset) { + this.needReset = false; + beans.rowDragSvc?.cancelRowDrag(); + params.animate = false; + resetGrouping(rootNode, !nested, beans); + } + if (!strategy) { + rowModel.hierarchical = false; + return void 0; + } + rowModel.hierarchical = true; + beans.changedPathFactory?.ensureRowsPath(params, rootNode); + const executeResult = strategy.execute(rootNode, params); + return executeResult || needReset; + } + loadLeafs(node) { + return node.footer ? loadFooterLeafs(node) : loadRealLeafs(node); + } + loadGroupData(node) { + const strategy = this.getStrategy(); + if (strategy) { + return strategy.loadGroupData(node); + } + node._groupData = null; + return null; + } + clearNonLeafs() { + this.strategy?.clearNonLeafs(); + } + getWantedStrategyType() { + if (this.isAlive()) { + if (this.gosTreeData) { + return "tree"; + } + if (this.hasRowGrouping && (this.beans.rowGroupColsSvc?.columns?.length || this.pivotMode)) { + return "group"; + } + } + return "none"; + } + getStrategy() { + let strategy = this.strategy; + const pivotMode = this.beans.colModel.isPivotMode(); + if (pivotMode !== this.pivotMode) { + this.pivotMode = pivotMode; + this.columnsInvalidated = true; + } + if (strategy !== void 0 && !this.columnsInvalidated && this.isAlive()) { + return strategy; + } + this.columnsInvalidated = false; + const wantedType = this.getWantedStrategyType(); + if (wantedType === this.strategyType) { + if (strategy !== void 0) { + return strategy; + } + this.strategy = null; + return null; + } + if (strategy) { + this.strategy = this.destroyBean(strategy); + this.needReset = true; + } + this.strategyType = wantedType; + this.treeData = wantedType === "tree"; + this.grouping = wantedType === "group"; + if (wantedType === "none") { + this.strategy = null; + return null; + } + const beanName = wantedType === "tree" ? "treeGroupStrategy" : "groupStrategy"; + strategy = this.beans.registry.createDynamicBean(beanName, false) ?? null; + this.strategy = strategy && this.createBean(strategy); + return strategy; + } +}; +var loadFooterLeafs = (node) => { + const sibling = node.sibling; + if (!sibling) { + return null; + } + const siblingLeafs = sibling._leafs; + if (siblingLeafs !== void 0) { + return siblingLeafs; + } + return loadRealLeafs(sibling); +}; +var loadRealLeafs = (node) => { + const childrenAfterGroup = node.childrenAfterGroup; + const childrenAfterGroupLen = childrenAfterGroup?.length; + node._leafs = null; + if (!childrenAfterGroupLen) { + return null; + } + let leafs; + const onlyChild = childrenAfterGroupLen === 1 ? childrenAfterGroup[0] : null; + if (onlyChild?.group && onlyChild.sourceRowIndex < 0) { + leafs = onlyChild._leafs; + if (leafs === void 0) { + leafs = loadRealLeafs(onlyChild); + } + } else if (node.leafGroup) { + leafs = childrenAfterGroup; + } else { + leafs = []; + for (let i = 0; i < childrenAfterGroupLen; ++i) { + const child = childrenAfterGroup[i]; + if (child.sourceRowIndex >= 0) { + leafs.push(child); + } + if (!child.group) { + continue; + } + let childLeafs = child._leafs; + if (childLeafs === void 0) { + childLeafs = loadRealLeafs(child); + } + if (childLeafs) { + for (let j = 0, len = childLeafs.length; j < len; ++j) { + leafs.push(childLeafs[j]); + } + } + } + } + node._leafs = leafs; + return leafs; +}; +var resetGrouping = (rootNode, canResetTreeNode, beans) => { + const allLeafs = rootNode._leafs; + const rootSibling = rootNode.sibling; + rootNode.treeNodeFlags = 0; + rootNode.childrenAfterGroup = allLeafs; + rootNode.childrenMapped = null; + rootNode._groupData = void 0; + rootNode.aggData = null; + if (rootSibling) { + rootSibling.childrenAfterGroup = rootNode.childrenAfterGroup; + rootSibling.childrenAfterAggFilter = rootNode.childrenAfterAggFilter; + rootSibling.childrenAfterFilter = rootNode.childrenAfterFilter; + rootSibling.childrenAfterSort = rootNode.childrenAfterSort; + rootSibling.childrenMapped = null; + rootSibling._groupData = void 0; + rootSibling.aggData = null; + } + for (let i = 0, allLeafsLen = allLeafs.length ?? 0; i < allLeafsLen; ++i) { + const row = allLeafs[i]; + const sibling = row.sibling; + row._leafs = void 0; + resetChildRowGrouping(row); + if (sibling) { + resetChildRowGrouping(sibling); + } + row.parent = rootNode; + if (canResetTreeNode) { + row.treeParent = null; + } + setRowNodeGroup(row, beans, false); + } + rootNode.updateHasChildren(); +}; +var resetChildRowGrouping = (row) => { + row.key = null; + row.treeNodeFlags = 0; + row.allChildrenCount = null; + row.childrenAfterGroup = null; + row.childrenAfterAggFilter = null; + row.childrenAfterFilter = null; + row.childrenAfterSort = null; + row.childrenMapped = null; + row.level = 0; + row._groupData = void 0; +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/rendering/groupCellRenderer.ts +import { Component as Component37, RefPlaceholder as RefPlaceholder35, _setAriaRole as _setAriaRole9, _setDisplayed as _setDisplayed18 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/rendering/groupCellRendererCtrl.ts +import { + BeanStub as BeanStub36, + KeyCode as KeyCode28, + _createIconNoSpan as _createIconNoSpan19, + _getCellRendererDetails as _getCellRendererDetails2, + _getCheckboxLocation, + _getCheckboxes, + _getInnerCellRendererDetails, + _isElementInEventPath, + _isRowSelection, + _isStopPropagationForAgGrid as _isStopPropagationForAgGrid2, + _removeAriaExpanded as _removeAriaExpanded2, + _setAriaExpanded as _setAriaExpanded9, + _stopPropagationForAgGrid as _stopPropagationForAgGrid8 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/rowHierarchyUtils.ts +function _isHiddenParent(node, ancestor, gos) { + let currentNode = node; + const levelDiff = currentNode.level - ancestor.level; + if (levelDiff <= 0) { + return false; + } + const isHideOpenParents = gos.get("groupHideOpenParents"); + if (!isHideOpenParents) { + return false; + } + for (let i = 0; i < levelDiff; i++) { + const isFirstChild = currentNode.parent?.getFirstChild() === currentNode; + if (!isFirstChild) { + return false; + } + currentNode = currentNode.parent; + } + return currentNode === ancestor; +} + +// packages/ag-grid-enterprise/src/rowHierarchy/rendering/groupCellRendererCtrl.ts +var GroupCellRendererCtrl = class extends BeanStub36 { + constructor() { + super(...arguments); + // keep reference to this, so we can remove again when indent changes + this.indentClass = null; + } + init(comp, eGui, eCheckbox, eExpanded, eContracted, compClass, params) { + this.params = params; + this.eGui = eGui; + this.eCheckbox = eCheckbox; + this.eExpanded = eExpanded; + this.eContracted = eContracted; + this.comp = comp; + this.compClass = compClass; + const { node, column } = params; + this.node = node; + this.displayedNode = node; + const embeddedRowMismatch = this.isEmbeddedRowMismatch(); + if (embeddedRowMismatch) { + return; + } + if (node.footer) { + this.initFooterCell(); + return; + } + if (!column) { + this.initFullWidthCell(); + return; + } + this.displayedNode = this.beans.showRowGroupColValueSvc?.getDisplayedNode(node, column) ?? this.node; + this.setupExpand(); + this.setupCheckbox(); + this.addGroupValue(); + this.setupIndent(); + } + initFooterCell() { + const { node } = this.params; + this.addGroupValue(); + this.setupIndent(); + const isGrandTotal = node.level === -1; + if (!isGrandTotal) { + this.comp.toggleCss("ag-row-group-leaf-indent", true); + } + } + initFullWidthCell() { + const setupDragger = () => { + const { rowDragSvc } = this.beans; + if (!this.params.rowDrag || !rowDragSvc) { + return; + } + const rowDragComp = rowDragSvc.createRowDragComp(() => this.params.value, this.params.node); + this.createManagedBean(rowDragComp); + this.eGui.insertAdjacentElement("afterbegin", rowDragComp.getGui()); + }; + this.setupExpand(); + setupDragger(); + this.setupCheckbox(); + this.addGroupValue(); + this.setupIndent(); + } + /** + * Returns an aria "role" to place on full width group cells, or the parent wrapper. + * @returns the aria role to place on the parent wrapper + */ + getCellAriaRole() { + const colDefAriaRole = this.params.colDef?.cellAriaRole; + const columnColDefAriaRole = this.params.column?.getColDef().cellAriaRole; + return colDefAriaRole || columnColDefAriaRole || "gridcell"; + } + /** + * Determines if this cell should be rendered, as when using embeddedFullWidthRows + * only one group cell should be rendered. + * + * if [enableRTL] all but pinned right cells should be skipped if available + * otherwise prioritise pinned left cell if available + * otherwise center viewport. + * + * @returns whether the cell should be skipped due to embedded full width rows + */ + isEmbeddedRowMismatch() { + if (!this.params.fullWidth || !this.gos.get("embedFullWidthRows")) { + return false; + } + const { visibleCols } = this.beans; + const pinnedLeftCell = this.params.pinned === "left"; + const pinnedRightCell = this.params.pinned === "right"; + const bodyCell = !pinnedLeftCell && !pinnedRightCell; + if (this.gos.get("enableRtl")) { + if (visibleCols.isPinningLeft()) { + return !pinnedRightCell; + } + return !bodyCell; + } + if (visibleCols.isPinningLeft()) { + return !pinnedLeftCell; + } + return !bodyCell; + } + /** + * Displays the group value for the displayed node + */ + addGroupValue() { + const { + params: { value, valueFormatted } + } = this; + const innerCompDetails = this.getInnerCompDetails(); + this.comp.setInnerRenderer(innerCompDetails, valueFormatted ?? value ?? null); + } + /** + * Sets up expand/collapse: + * Chevron + * Aria-expanded + * Child count + */ + setupExpand() { + const { colModel } = this.beans; + const { eGridCell, suppressDoubleClickExpand } = this.params; + const addIconToDom = (iconName, element) => { + const icon = _createIconNoSpan19(iconName, this.beans, null); + if (icon) { + element.appendChild(icon); + this.addDestroyFunc(() => icon.remove()); + } + }; + addIconToDom("groupExpanded", this.eExpanded); + addIconToDom("groupContracted", this.eContracted); + const comp = this.comp; + const onExpandedChanged = () => { + const expandable = this.isExpandable(); + if (!expandable) { + return; + } + const expanded = !!this.displayedNode.expanded; + comp.setExpandedDisplayed(expanded); + comp.setContractedDisplayed(!expanded); + _setAriaExpanded9(eGridCell, expanded); + }; + const onExpandableChanged = () => { + const expandable = this.isExpandable(); + comp.toggleCss("ag-cell-expandable", expandable); + comp.toggleCss("ag-row-group", expandable); + const pivotModeAndLeaf = !expandable && colModel.isPivotMode(); + comp.toggleCss("ag-pivot-leaf-group", pivotModeAndLeaf); + const normalModeNotTotalFooter = !colModel.isPivotMode() && (!this.displayedNode.footer || this.displayedNode.level !== -1); + comp.toggleCss("ag-row-group-leaf-indent", !expandable && normalModeNotTotalFooter); + const count = this.getChildCount(); + const countString = count > 0 ? `(${count})` : ``; + comp.setChildCount(countString); + if (!expandable) { + comp.setExpandedDisplayed(false); + comp.setContractedDisplayed(false); + _removeAriaExpanded2(eGridCell); + } else { + onExpandedChanged(); + } + }; + const setupListeners = () => { + if (!suppressDoubleClickExpand && !this.isGroupCellEditable(this.displayedNode)) { + this.addManagedListeners(eGridCell, { dblclick: this.onCellDblClicked.bind(this) }); + } + this.addManagedListeners(this.eExpanded, { click: this.onExpandClicked.bind(this) }); + this.addManagedListeners(this.eContracted, { click: this.onExpandClicked.bind(this) }); + this.addManagedListeners(eGridCell, { keydown: this.onKeyDown.bind(this) }); + this.addManagedListeners(this.displayedNode, { + // Expandable state has changed + allChildrenCountChanged: onExpandableChanged, + masterChanged: onExpandableChanged, + groupChanged: onExpandableChanged, + hasChildrenChanged: onExpandableChanged, + // Node expanded changed + expandedChanged: onExpandedChanged + }); + }; + setupListeners(); + onExpandableChanged(); + } + /** + * Return the inner renderer details for the cell + * + * Prioritises: + * 1. Group row renderer for group rows + * 2. agFindCellRenderer for find results in group rows + * 3. Provided innerRenderer (i.e, cellRendererParams.innerRenderer) + * 4. Cell renderer of the grouped column + * 5. Inner renderer of the grouped column + * 6. agFindCellRenderer for find results + */ + getInnerCompDetails() { + const { userCompFactory, findSvc } = this.beans; + const params = this.params; + if (params.fullWidth) { + const groupRowRendererParams = this.gos.get("groupRowRendererParams"); + const groupRowInnerCompDetails = _getInnerCellRendererDetails( + userCompFactory, + groupRowRendererParams, + params + ); + if (groupRowInnerCompDetails) { + return groupRowInnerCompDetails; + } + if (findSvc?.isMatch(params.node, null)) { + return _getInnerCellRendererDetails( + userCompFactory, + { ...groupRowRendererParams, innerRenderer: "agFindCellRenderer" }, + params + ); + } + return void 0; + } + const isGroupRowRenderer = (details) => details && details.componentClass == this.compClass; + const innerCompDetails = _getInnerCellRendererDetails(userCompFactory, params, params); + if (innerCompDetails && !isGroupRowRenderer(innerCompDetails)) { + return innerCompDetails; + } + const { + displayedNode: { rowGroupColumn } + } = this; + const relatedColDef = rowGroupColumn?.colDef; + const isShowingThisCol = rowGroupColumn && params.column?.isRowGroupDisplayed(rowGroupColumn.getId()); + if (relatedColDef && isShowingThisCol) { + const relatedCompDetails = _getCellRendererDetails2(userCompFactory, relatedColDef, params); + if (relatedCompDetails) { + if (isGroupRowRenderer(relatedCompDetails)) { + if (relatedColDef?.cellRendererParams?.innerRenderer) { + return _getInnerCellRendererDetails( + userCompFactory, + relatedColDef.cellRendererParams, + params + ); + } + } else { + return relatedCompDetails; + } + } + } + if (findSvc?.isMatch(params.node, params.column)) { + return _getCellRendererDetails2( + userCompFactory, + { ...relatedColDef ?? params.colDef, cellRenderer: "agFindCellRenderer" }, + params + ); + } + } + /** + * Get the allChildCount of a given node + * @param node the node to return the count for + * @returns 0 if the count should not be displayed, otherwise the count + */ + getChildCount() { + const { column, suppressCount } = this.params; + if (suppressCount) { + return 0; + } + const { allChildrenCount, rowGroupColumn } = this.displayedNode; + const isDisplayingRowGroupCell = (allChildrenCount ?? 0) > 0 && (!rowGroupColumn || !column || column?.isRowGroupDisplayed(rowGroupColumn.getId())); + if (!isDisplayingRowGroupCell) { + return 0; + } + const isRepresentingOtherNode = this.gos.get("showOpenedGroup") && this.displayedNode !== this.node; + if (isRepresentingOtherNode && !_isHiddenParent(this.node, this.displayedNode, this.gos)) { + return 0; + } + return allChildrenCount ?? 0; + } + /** + * Checks whether the current cell is expandable, either due to [groupHideOpenParent] control or otherwise. + * @returns whether this cell is expandable + */ + isExpandable() { + const { node, column, colDef } = this.params; + if (!this.displayedNode.isExpandable()) { + return false; + } + if (node.rowPinned) { + return false; + } + const isFullWidth = !column; + if (isFullWidth) { + return true; + } + const hasChildren = node.hasChildren(); + if (hasChildren && colDef) { + const { showRowGroup } = colDef; + if (!showRowGroup) { + return false; + } + if (showRowGroup === true) { + return true; + } + } + if (node === this.displayedNode) { + if (node.rowGroupColumn) { + const showingThisRowGroup = column?.isRowGroupDisplayed(node.rowGroupColumn.getId()); + if (showingThisRowGroup) { + return true; + } + } + if (node.master) { + return colDef?.showRowGroup === true || colDef?.showRowGroup == null; + } + return false; + } + return _isHiddenParent(this.node, this.displayedNode, this.gos); + } + /** + * For full width group cells & single group column, indents child groups based on uiLevel + */ + setupIndent() { + const { suppressPadding, node, colDef } = this.params; + if (suppressPadding) { + return; + } + const setIndent = () => { + let level = node.uiLevel; + if (colDef && colDef.showRowGroup !== true) { + level = 0; + } + const newIndentClass = "ag-row-group-indent-" + level; + if (newIndentClass === this.indentClass) { + return; + } + if (this.indentClass) { + this.comp.toggleCss(this.indentClass, false); + } + this.indentClass = newIndentClass; + this.comp.toggleCss(newIndentClass, true); + this.eGui.style.setProperty("--ag-indentation-level", String(level)); + }; + this.addManagedListeners(node, { uiLevelChanged: setIndent.bind(this) }); + setIndent(); + } + /** + * Selection checkboxes + */ + setupCheckbox() { + const { node } = this.params; + const isRowSelectable = !node.footer && !node.rowPinned && !node.detail; + if (!isRowSelectable) { + return; + } + this.addManagedPropertyListener("rowSelection", ({ currentValue, previousValue }) => { + const curr = typeof currentValue === "object" ? currentValue : void 0; + const prev = typeof previousValue === "object" ? previousValue : void 0; + if (curr?.checkboxLocation !== prev?.checkboxLocation) { + this.destroyCheckbox(); + this.addCheckbox(); + } + }); + this.addCheckbox(); + } + addCheckbox() { + const { selectionSvc } = this.beans; + if (!selectionSvc || !_isRowSelection(this.gos)) { + return; + } + const { node, column } = this.params; + const rowSelection = this.gos.get("rowSelection"); + const checkboxLocation = _getCheckboxLocation(rowSelection); + if (checkboxLocation === "selectionColumn") { + return; + } + if (checkboxLocation === "autoGroupColumn") { + const isGroupColumn = column?.getColDef().showRowGroup != null; + const isFullWidthGroupRow = !column && node.group; + const isApplicableCell = isGroupColumn || isFullWidthGroupRow; + if (!isApplicableCell) { + return; + } + } + const checkboxes = typeof rowSelection === "object" ? _getCheckboxes(rowSelection) : this.params.checkbox; + const userWantsCheckboxes = typeof checkboxes === "function" || checkboxes === true; + if (!userWantsCheckboxes) { + return; + } + const isMultiAutoCol = typeof column?.getColDef().showRowGroup === "string"; + if (isMultiAutoCol && !this.isExpandable()) { + this.comp.setCheckboxSpacing(true); + return; + } + const cbSelectionComponent = selectionSvc.createCheckboxSelectionComponent(); + this.cbComp = cbSelectionComponent; + this.createBean(cbSelectionComponent); + cbSelectionComponent.init({ + rowNode: node, + // when groupHideOpenParents = true and group expanded, we want the checkbox to refer to leaf node state (not group node state) + column, + overrides: { + isVisible: checkboxes, + callbackParams: this.params, + removeHidden: true + } + }); + this.eCheckbox.appendChild(cbSelectionComponent.getGui()); + this.comp.setCheckboxVisible(true); + } + destroyCheckbox() { + this.comp.setCheckboxSpacing(false); + this.comp.setCheckboxVisible(false); + this.cbComp?.getGui().remove(); + this.cbComp = this.destroyBean(this.cbComp); + } + /** Whether the group cell is editable via groupRowEditable or enableGroupEdit. */ + isGroupCellEditable(node) { + const column = this.params.column; + return !!column && (!!column.getColDef().groupRowEditable || this.gos.get("enableGroupEdit")) && column.isCellEditable(node); + } + /** + * Called when the expand / contract icon is clicked. + */ + onExpandClicked(mouseEvent) { + if (_isStopPropagationForAgGrid2(mouseEvent)) { + return; + } + _stopPropagationForAgGrid8(mouseEvent); + this.onExpandOrContract(mouseEvent); + } + /** + * Called on cell key press - only handles 'Enter' key for expand/collapse + */ + onKeyDown(event) { + const isEnterKey = event.key === KeyCode28.ENTER; + if (!isEnterKey || this.params.suppressEnterExpand) { + return; + } + if (this.isGroupCellEditable(this.params.node)) { + return; + } + this.onExpandOrContract(event); + } + /** + * Called on cell double click - only expands/collapses if the event is not on the expand / contract icon + */ + onCellDblClicked(mouseEvent) { + if (_isStopPropagationForAgGrid2(mouseEvent)) { + return; + } + const targetIsExpandIcon = _isElementInEventPath(this.eExpanded, mouseEvent) || _isElementInEventPath(this.eContracted, mouseEvent); + if (!targetIsExpandIcon) { + this.onExpandOrContract(mouseEvent); + } + } + /** + * Called when expand or contract is attempted, to scroll the row and update the node state + * @param e originating event + */ + onExpandOrContract(e) { + if (!this.isExpandable()) { + return; + } + const rowNode = this.displayedNode; + const nextExpandState = !rowNode.expanded; + if (!nextExpandState && rowNode.sticky) { + this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(rowNode.rowTop - rowNode.stickyRowTop); + } + rowNode.setExpanded(nextExpandState, e); + } + destroy() { + super.destroy(); + this.destroyCheckbox(); + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/rendering/groupCellRenderer.ts +var GroupCellRendererElement = { + tag: "span", + cls: "ag-cell-wrapper", + children: [ + { tag: "span", ref: "eExpanded", cls: "ag-group-expanded ag-hidden" }, + { tag: "span", ref: "eContracted", cls: "ag-group-contracted ag-hidden" }, + { tag: "span", ref: "eCheckbox", cls: "ag-group-checkbox ag-invisible" }, + { tag: "span", ref: "eValue", cls: "ag-group-value" }, + { tag: "span", ref: "eChildCount", cls: "ag-group-child-count" } + ] +}; +var GroupCellRenderer = class extends Component37 { + constructor() { + super(GroupCellRendererElement); + this.eExpanded = RefPlaceholder35; + this.eContracted = RefPlaceholder35; + this.eCheckbox = RefPlaceholder35; + this.eValue = RefPlaceholder35; + this.eChildCount = RefPlaceholder35; + } + init(params) { + const compProxy = { + setInnerRenderer: (compDetails, valueToDisplay) => this.setRenderDetails(compDetails, valueToDisplay), + setChildCount: (count) => this.eChildCount.textContent = count, + toggleCss: (cssClass, value) => this.toggleCss(cssClass, value), + setContractedDisplayed: (expanded) => _setDisplayed18(this.eContracted, expanded), + setExpandedDisplayed: (expanded) => _setDisplayed18(this.eExpanded, expanded), + setCheckboxVisible: (visible) => this.eCheckbox.classList.toggle("ag-invisible", !visible), + setCheckboxSpacing: (add) => this.eCheckbox.classList.toggle("ag-group-checkbox-spacing", add) + }; + const ctrl = this.createManagedBean(new GroupCellRendererCtrl()); + const fullWidth = !params.colDef; + const eGui = this.getGui(); + ctrl.init(compProxy, eGui, this.eCheckbox, this.eExpanded, this.eContracted, this.constructor, params); + if (fullWidth) { + _setAriaRole9(eGui, ctrl.getCellAriaRole()); + } + } + setRenderDetails(compDetails, valueToDisplay) { + if (compDetails) { + compDetails.newAgStackInstance().then((comp) => { + if (!comp) { + return; + } + const destroyComp = () => this.destroyBean(comp); + if (this.isAlive()) { + this.eValue.appendChild(comp.getGui()); + this.addDestroyFunc(destroyComp); + } else { + destroyComp(); + } + }); + } else { + this.eValue.innerText = valueToDisplay; + } + } + destroy() { + this.destroyBean(this.innerCellRenderer); + super.destroy(); + } + refresh() { + return false; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/rendering/groupCellStyles.css +var groupCellStyles_default = ".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}"; + +// packages/ag-grid-enterprise/src/rowHierarchy/showRowGroupColValueService.ts +import { BeanStub as BeanStub37 } from "ag-grid-community"; +var ShowRowGroupColValueService = class extends BeanStub37 { + constructor() { + super(...arguments); + this.beanName = "showRowGroupColValueSvc"; + } + /** + * Get the value for display in the group column. Also returns the displayedNode from which the value was + * taken in cases of groupHideOpenParents and showOpenedGroup. + * + * Always uses 'data' mode because group column values represent structural position in the row hierarchy. + * The actual grouping (via getKeyForNode) uses committed data, so the display should match - showing + * a different group value while the row is still in its original group would be misleading. + */ + getGroupValue(node, column, ignoreAggData) { + if (!column) { + if (!node.group) { + return null; + } + return { displayedNode: node, value: node.groupValue }; + } + const valueSvc = this.beans.valueSvc; + const rowGroupColId = column.colDef.showRowGroup; + if (!rowGroupColId) { + return null; + } + if (node.level === -1 && node.footer) { + return { displayedNode: node, value: null }; + } + if (typeof rowGroupColId === "string") { + const colRowGroupIndex = this.beans.rowGroupColsSvc?.getColumnIndex(rowGroupColId) ?? -1; + if (colRowGroupIndex > node.level) { + return null; + } + const hideOpenParentsNode = this.getDisplayedNode(node, column, true); + if (hideOpenParentsNode) { + return { + displayedNode: hideOpenParentsNode, + value: valueSvc.getValue(column, hideOpenParentsNode, "data", ignoreAggData) + }; + } + } + const value = valueSvc.getValue(column, node, "data", ignoreAggData); + if (value == null) { + const displayedNode = this.getDisplayedNode(node, column); + if (displayedNode) { + return { + displayedNode, + value: valueSvc.getValue(column, displayedNode, "data", ignoreAggData) + }; + } + } + return { displayedNode: node, value }; + } + /** + * Formats a group col value, and prefixes it with the "Total" prefix if applicable + */ + formatAndPrefixGroupColValue(groupValue, column, exporting = false) { + const formattedValue = this.formatGroupColValue(groupValue, column, exporting); + const { value, displayedNode } = groupValue; + const footerSvc = this.beans.footerSvc; + if (footerSvc?.doesCellShowTotalPrefix(displayedNode, column)) { + const footerValue = footerSvc.applyTotalPrefix(value, formattedValue, displayedNode, column); + return footerValue; + } + if (displayedNode.footer && displayedNode.level === -1) { + return null; + } + return formattedValue; + } + /** + * Formats the group col value using the underlying column's value formatter + */ + formatGroupColValue(groupValue, column, exporting = false) { + const valueSvc = this.beans.valueSvc; + const { displayedNode, value } = groupValue; + const groupedCol = displayedNode.rowGroupColumn; + const isFullWidthGroup = displayedNode.group && !column; + const isShowingGroupCell = groupedCol && (isFullWidthGroup || column?.isRowGroupDisplayed(groupedCol.colId)); + if (isShowingGroupCell) { + if (exporting && groupedCol.colDef.useValueFormatterForExport === false) { + return null; + } + const formattedValue = valueSvc.formatValue(groupedCol, displayedNode, value); + if (formattedValue == null && displayedNode.key === "") { + const localeTextFunc = this.getLocaleTextFunc(); + return localeTextFunc("blanks", "(Blanks)"); + } + return formattedValue; + } + if (!column || displayedNode.group) { + return null; + } + if (exporting && column.colDef.useValueFormatterForExport === false) { + return null; + } + return valueSvc.formatValue(column, displayedNode, value); + } + /** + * Checks if the node has a value to inherit from the parent node for display in the given column + * + * This is used when [groupHideOpenParents] or [showOpenedGroup] are enabled + * + * @param node node to check for preferential nodes to display + * @param column column to get the displayed node for + * @returns a parent node of node to display the value from, or undefined if no value will be inherited + */ + getDisplayedNode(node, column, onlyHideOpenParents = false) { + const gos = this.gos; + const isGroupHideOpenParents = gos.get("groupHideOpenParents"); + const isShowOpenedGroupValue = gos.get("showOpenedGroup") && !onlyHideOpenParents; + if (!isGroupHideOpenParents && !isShowOpenedGroupValue) { + return void 0; + } + const showRowGroup = column.colDef.showRowGroup; + if (showRowGroup === true) { + if (node.group) { + return void 0; + } + return node.parent ?? void 0; + } + let pointer = node; + while (pointer && pointer.rowGroupColumn?.getId() != showRowGroup) { + const isFirstChild = pointer === pointer.parent?.getFirstChild(); + if (!isShowOpenedGroupValue && !isFirstChild) { + return void 0; + } + pointer = pointer.parent; + } + if (pointer === node) { + return void 0; + } + return pointer ?? void 0; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/showRowGroupColsService.ts +import { BeanStub as BeanStub38 } from "ag-grid-community"; +var ShowRowGroupColsService = class extends BeanStub38 { + constructor() { + super(...arguments); + this.beanName = "showRowGroupCols"; + this.columns = []; + this.colsSet = /* @__PURE__ */ new Set(); + this.colsMap = /* @__PURE__ */ new Map(); + } + destroy() { + super.destroy(); + this.columns.length = 0; + this.colsSet.clear(); + this.colsMap.clear(); + } + refresh() { + const { colModel, rowGroupColsSvc } = this.beans; + const showRowGroupCols = this.columns; + const showRowGroupColsSet = this.colsSet; + const showRowGroupColsMap = this.colsMap; + showRowGroupColsMap.clear(); + const oldShowRowGroupColsLLen = showRowGroupCols.length; + let showRowGroupColsCount = 0; + let showRowGroupColsSetChanged = false; + const cols = colModel.getCols(); + for (let colIdx = 0, colsLen = cols.length; colIdx < colsLen; ++colIdx) { + const col = cols[colIdx]; + const colDef = col.getColDef(); + const showRowGroup = colDef.showRowGroup; + if (typeof showRowGroup === "string") { + showRowGroupColsMap.set(showRowGroup, col); + } else if (showRowGroup === true) { + const groupColumns = rowGroupColsSvc?.columns; + if (groupColumns) { + for (let grpColIdx = 0, grpColsLen = groupColumns.length; grpColIdx < grpColsLen; ++grpColIdx) { + showRowGroupColsMap.set(groupColumns[grpColIdx].getId(), col); + } + } + } else { + continue; + } + showRowGroupColsSetChanged || (showRowGroupColsSetChanged = showRowGroupColsCount >= oldShowRowGroupColsLLen || !showRowGroupColsSet.has(col)); + showRowGroupCols[showRowGroupColsCount++] = col; + } + showRowGroupColsSetChanged || (showRowGroupColsSetChanged = showRowGroupColsCount !== oldShowRowGroupColsLLen); + if (showRowGroupColsSetChanged) { + showRowGroupCols.length = showRowGroupColsCount; + showRowGroupColsSet.clear(); + for (let j = 0; j < showRowGroupColsCount; ++j) { + showRowGroupColsSet.add(showRowGroupCols[j]); + } + this.eventSvc.dispatchEvent({ type: "showRowGroupColsSetChanged" }); + } + } + getShowRowGroupCol(id) { + return this.colsMap.get(id); + } + getSourceColumnsForGroupColumn(groupCol) { + const sourceColumnId = groupCol.getColDef().showRowGroup; + if (!sourceColumnId) { + return null; + } + const { rowGroupColsSvc, colModel } = this.beans; + if (sourceColumnId === true && rowGroupColsSvc) { + return rowGroupColsSvc.columns; + } + const column = colModel.getColDefCol(sourceColumnId); + return column ? [column] : null; + } + isRowGroupDisplayed(column, colId) { + const showRowGroup = column.getColDef()?.showRowGroup; + return showRowGroup === true || showRowGroup != null && showRowGroup === colId; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/stickyRowService.ts +import { BeanStub as BeanStub40, _isClientSideRowModel as _isClientSideRowModel6, _isGroupRowsSticky as _isGroupRowsSticky2, _isServerSideRowModel as _isServerSideRowModel2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowHierarchy/stickyRowFeature.ts +import { BeanStub as BeanStub39, _getRowHeightForNode, _isClientSideRowModel as _isClientSideRowModel5, _isGroupRowsSticky, _last as _last10 } from "ag-grid-community"; +var StickyRowFeature = class extends BeanStub39 { + constructor(createRowCon, destroyRowCtrls) { + super(); + this.createRowCon = createRowCon; + this.destroyRowCtrls = destroyRowCtrls; + this.stickyTopRowCtrls = []; + this.stickyBottomRowCtrls = []; + // sticky rows pulls in extra rows from other pages which impacts row position + this.extraTopHeight = 0; + this.extraBottomHeight = 0; + } + postConstruct() { + this.isClientSide = _isClientSideRowModel5(this.gos); + this.beans.ctrlsSvc.whenReady(this, (params) => { + this.gridBodyCtrl = params.gridBodyCtrl; + }); + this.resetStickyContainers(); + } + setOffsetTop(offset) { + if (this.extraTopHeight === offset) { + return; + } + this.extraTopHeight = offset; + this.eventSvc.dispatchEvent({ + type: "stickyTopOffsetChanged", + offset + }); + } + setOffsetBottom(offset) { + if (this.extraBottomHeight === offset) { + return; + } + this.extraBottomHeight = offset; + } + resetOffsets() { + this.setOffsetBottom(0); + this.setOffsetTop(0); + } + /** + * Get the last pixel of the group, this pixel is used to push the sticky node up out of the viewport. + */ + getLastPixelOfGroup(row) { + return this.isClientSide ? getClientSideLastPixelOfGroup(row) : getServerSideLastPixelOfGroup(row); + } + /** + * Get the first pixel of the group, this pixel is used to push the sticky node down out of the viewport + */ + getFirstPixelOfGroup(row) { + if (row.footer) { + return row.sibling.rowTop + row.sibling.rowHeight - 1; + } + if (row.hasChildren()) { + return row.rowTop - 1; + } + return 0; + } + updateStickyRows(container) { + const isTop = container === "top"; + let newStickyContainerHeight = 0; + if (!this.canRowsBeSticky()) { + return this.refreshNodesAndContainerHeight(container, /* @__PURE__ */ new Set(), newStickyContainerHeight); + } + const newStickyRows = /* @__PURE__ */ new Set(); + const { rowModel, rowRenderer, pinnedRowModel, pageBounds, rowContainerHeight } = this.beans; + const { pageFirstPixel, pageLastPixel } = pageBounds.getCurrentPagePixelRange(); + const pixelAtContainerBoundary = isTop ? rowRenderer.firstVisibleVPixel - this.extraTopHeight : rowRenderer.lastVisibleVPixel - this.extraTopHeight; + const divStretchOffset = rowContainerHeight.divStretchOffset ?? 0; + const pageFirstPixelWithOffset = pageFirstPixel + divStretchOffset; + const pageLastPixelWithOffset = pageLastPixel + divStretchOffset; + const addStickyRow = (stickyRow) => { + newStickyRows.add(stickyRow); + if (isTop) { + const lastChildBottom = this.getLastPixelOfGroup(stickyRow); + const stickRowBottom = pixelAtContainerBoundary + newStickyContainerHeight + stickyRow.rowHeight; + if (lastChildBottom < stickRowBottom) { + stickyRow.stickyRowTop = newStickyContainerHeight + (lastChildBottom - stickRowBottom); + } else { + stickyRow.stickyRowTop = newStickyContainerHeight; + } + } else { + const lastChildBottom = this.getFirstPixelOfGroup(stickyRow); + const stickRowTop = pixelAtContainerBoundary - (newStickyContainerHeight + stickyRow.rowHeight); + if (lastChildBottom > stickRowTop) { + stickyRow.stickyRowTop = newStickyContainerHeight - (lastChildBottom - stickRowTop); + } else { + stickyRow.stickyRowTop = newStickyContainerHeight; + } + } + newStickyContainerHeight = 0; + newStickyRows.forEach((rowNode) => { + const thisRowLastPx = rowNode.stickyRowTop + rowNode.rowHeight; + if (newStickyContainerHeight < thisRowLastPx) { + newStickyContainerHeight = thisRowLastPx; + } + }); + }; + const suppressFootersSticky = this.areFooterRowsStickySuppressed(); + const suppressGroupsSticky = this.gos.get("suppressGroupRowsSticky"); + const isRowSticky = (row) => { + if (!row.displayed) { + return false; + } + if (row.footer) { + if (suppressFootersSticky === true) { + return false; + } + if (suppressFootersSticky === "grand" && row.level === -1) { + return false; + } + if (suppressFootersSticky === "group" && row.level > -1) { + return false; + } + const isFooterFirstRowInGroup = row.sibling.rowIndex ? row.sibling.rowIndex + 1 === row.rowIndex : false; + if (container === "bottom" && isFooterFirstRowInGroup) { + return false; + } + if (row.level === -1 && pinnedRowModel?.getGrandTotalPinned()) { + return false; + } + const alreadySticking = newStickyRows.has(row); + return !alreadySticking; + } + if (row.isExpandable()) { + if (suppressGroupsSticky === true) { + return false; + } + if (container === "bottom") { + return false; + } + const alreadySticking = newStickyRows.has(row); + return !alreadySticking && !!row.expanded; + } + return false; + }; + for (let i = 0; i < 100; i++) { + let firstPixelAfterStickyRows = pixelAtContainerBoundary + newStickyContainerHeight; + if (!isTop) { + firstPixelAfterStickyRows = pixelAtContainerBoundary - newStickyContainerHeight; + } + if (isTop && firstPixelAfterStickyRows < pageFirstPixelWithOffset) { + firstPixelAfterStickyRows = pageFirstPixelWithOffset; + } else if (!isTop && firstPixelAfterStickyRows > pageLastPixelWithOffset) { + firstPixelAfterStickyRows = pageLastPixelWithOffset; + } + const firstIndex = rowModel.getRowIndexAtPixel(firstPixelAfterStickyRows); + const firstRow = rowModel.getRow(firstIndex); + if (firstRow == null) { + break; + } + const ancestors = this.getStickyAncestors(firstRow); + const firstMissingParent = ancestors.find( + (parent) => (isTop ? parent.rowIndex < firstIndex : parent.rowIndex > firstIndex) && isRowSticky(parent) + ); + if (firstMissingParent) { + addStickyRow(firstMissingParent); + continue; + } + const isFirstRowOutsideViewport = isTop ? firstRow.rowTop < firstPixelAfterStickyRows : firstRow.rowTop + firstRow.rowHeight > firstPixelAfterStickyRows; + if (isFirstRowOutsideViewport && isRowSticky(firstRow)) { + addStickyRow(firstRow); + continue; + } + break; + } + if (!isTop) { + newStickyRows.forEach((rowNode) => { + rowNode.stickyRowTop = newStickyContainerHeight - (rowNode.stickyRowTop + rowNode.rowHeight); + }); + } + return this.refreshNodesAndContainerHeight(container, newStickyRows, newStickyContainerHeight); + } + areFooterRowsStickySuppressed() { + const suppressFootersSticky = this.gos.get("suppressStickyTotalRow"); + if (suppressFootersSticky === true) { + return true; + } + const suppressGroupRows = suppressFootersSticky === "group"; + const suppressGrandRows = suppressFootersSticky === "grand"; + if (suppressGroupRows && suppressGrandRows) { + return true; + } + if (suppressGrandRows) { + return "grand"; + } + if (suppressGroupRows) { + return "group"; + } + return false; + } + canRowsBeSticky() { + const isStickyEnabled = _isGroupRowsSticky(this.gos); + const suppressFootersSticky = this.areFooterRowsStickySuppressed(); + const suppressGroupsSticky = this.gos.get("suppressGroupRowsSticky"); + return isStickyEnabled && (!suppressFootersSticky || !suppressGroupsSticky); + } + getStickyAncestors(rowNode) { + const ancestors = []; + let p = rowNode.footer ? rowNode.sibling : rowNode.parent; + while (p) { + if (p.sibling) { + ancestors.push(p.sibling); + } + ancestors.push(p); + p = p.parent; + } + return ancestors.reverse(); + } + checkStickyRows() { + const hasTopUpdated = this.updateStickyRows("top"); + const hasBottomUpdated = this.updateStickyRows("bottom"); + return hasTopUpdated || hasBottomUpdated; + } + destroyStickyCtrls() { + this.resetStickyContainers(); + } + resetStickyContainers() { + this.refreshNodesAndContainerHeight("top", /* @__PURE__ */ new Set(), 0); + this.refreshNodesAndContainerHeight("bottom", /* @__PURE__ */ new Set(), 0); + } + refreshStickyNode(stickRowNode) { + const allStickyNodes = /* @__PURE__ */ new Set(); + if (this.stickyTopRowCtrls.some((ctrl) => ctrl.rowNode === stickRowNode)) { + for (let i = 0; i < this.stickyTopRowCtrls.length; i++) { + const currentNode = this.stickyTopRowCtrls[i].rowNode; + if (currentNode !== stickRowNode) { + allStickyNodes.add(currentNode); + } + } + if (this.refreshNodesAndContainerHeight("top", allStickyNodes, this.topContainerHeight)) { + this.checkStickyRows(); + } + return; + } + for (let i = 0; i < this.stickyBottomRowCtrls.length; i++) { + const currentNode = this.stickyBottomRowCtrls[i].rowNode; + if (currentNode !== stickRowNode) { + allStickyNodes.add(currentNode); + } + } + if (this.refreshNodesAndContainerHeight("bottom", allStickyNodes, this.bottomContainerHeight)) { + this.checkStickyRows(); + } + } + /** + * Destroy old ctrls and create new ctrls where necessary. + */ + refreshNodesAndContainerHeight(container, newStickyNodes, height) { + const isTop = container === "top"; + const previousCtrls = isTop ? this.stickyTopRowCtrls : this.stickyBottomRowCtrls; + const removedCtrlsMap = {}; + const remainingCtrls = []; + for (let i = 0; i < previousCtrls.length; i++) { + const node = previousCtrls[i].rowNode; + const hasBeenRemoved = !newStickyNodes.has(node); + if (hasBeenRemoved) { + removedCtrlsMap[node.id] = previousCtrls[i]; + node.sticky = false; + continue; + } + remainingCtrls.push(previousCtrls[i]); + } + const existingNodes = /* @__PURE__ */ new Set(); + for (let i = 0; i < remainingCtrls.length; i++) { + existingNodes.add(remainingCtrls[i].rowNode); + } + const newCtrls = []; + newStickyNodes.forEach((node) => { + if (existingNodes.has(node)) { + return; + } + node.sticky = true; + newCtrls.push(this.createRowCon(node, false, false)); + }); + let hasSomethingChanged = !!newCtrls.length || remainingCtrls.length !== previousCtrls.length; + if (isTop) { + if (this.topContainerHeight !== height) { + this.topContainerHeight = height; + this.gridBodyCtrl.setStickyTopHeight(height); + hasSomethingChanged = true; + } + } else if (this.bottomContainerHeight !== height) { + this.bottomContainerHeight = height; + this.gridBodyCtrl.setStickyBottomHeight(height); + hasSomethingChanged = true; + } + this.destroyRowCtrls(removedCtrlsMap, false); + const newCtrlsList = [...remainingCtrls, ...newCtrls]; + newCtrlsList.sort((a, b) => b.rowNode.rowIndex - a.rowNode.rowIndex); + if (!isTop) { + newCtrlsList.reverse(); + } + for (const ctrl of newCtrlsList) { + ctrl.setRowTop(ctrl.rowNode.stickyRowTop); + } + const pageBounds = this.beans.pageBounds; + let extraHeight = 0; + if (isTop) { + for (const node of newStickyNodes) { + if (node.rowIndex < pageBounds.getFirstRow()) { + extraHeight += node.rowHeight; + } + } + if (extraHeight > this.topContainerHeight) { + extraHeight = this.topContainerHeight; + } + this.setOffsetTop(extraHeight); + } else { + for (const node of newStickyNodes) { + if (node.rowIndex > pageBounds.getLastRow()) { + extraHeight += node.rowHeight; + } + } + if (extraHeight > this.bottomContainerHeight) { + extraHeight = this.bottomContainerHeight; + } + this.setOffsetBottom(extraHeight); + } + if (!hasSomethingChanged) { + return false; + } + if (isTop) { + this.stickyTopRowCtrls = newCtrlsList; + } else { + this.stickyBottomRowCtrls = newCtrlsList; + } + return true; + } + ensureRowHeightsValid() { + let anyChange = false; + const updateRowHeight = (ctrl) => { + const rowNode = ctrl.rowNode; + if (rowNode.rowHeightEstimated) { + const rowHeight = _getRowHeightForNode(this.beans, rowNode); + rowNode.setRowHeight(rowHeight.height); + anyChange = true; + } + }; + this.stickyTopRowCtrls.forEach(updateRowHeight); + this.stickyBottomRowCtrls.forEach(updateRowHeight); + return anyChange; + } +}; +function getServerSideLastPixelOfGroup(row) { + if (row.isExpandable() || row.footer) { + if (row.master && row.detailNode) { + return row.detailNode.rowTop + row.detailNode.rowHeight; + } + const noOrContiguousSiblings = !row.sibling || Math.abs(row.sibling.rowIndex - row.rowIndex) === 1; + if (noOrContiguousSiblings) { + let storeBounds = row.childStore?.getStoreBounds(); + if (row.footer) { + storeBounds = row.sibling.childStore?.getStoreBounds(); + } + return (storeBounds?.heightPx ?? 0) + (storeBounds?.topPx ?? 0); + } + if (row.footer) { + return row.rowTop + row.rowHeight; + } + return row.sibling.rowTop + row.sibling.rowHeight; + } + return Number.MAX_SAFE_INTEGER; +} +function getClientSideLastPixelOfGroup(row) { + if (row.isExpandable() || row.footer) { + const grandTotalAtTop = row.footer && row.rowIndex === 0; + if (grandTotalAtTop) { + return Number.MAX_SAFE_INTEGER; + } + const noOrContiguousSiblings = !row.sibling || Math.abs(row.sibling.rowIndex - row.rowIndex) === 1; + if (noOrContiguousSiblings) { + let lastAncestor = row.footer ? row.sibling : row; + while (lastAncestor.isExpandable() && lastAncestor.expanded) { + if (lastAncestor.master && lastAncestor.detailNode) { + lastAncestor = lastAncestor.detailNode; + } else if (lastAncestor.childrenAfterSort) { + if (lastAncestor.childrenAfterSort.length === 0) { + break; + } + lastAncestor = _last10(lastAncestor.childrenAfterSort); + } + } + return lastAncestor.rowTop + lastAncestor.rowHeight; + } + if (row.footer) { + return row.rowTop + row.rowHeight; + } + return row.sibling.rowTop + row.sibling.rowHeight; + } + return Number.MAX_SAFE_INTEGER; +} + +// packages/ag-grid-enterprise/src/rowHierarchy/stickyRowService.ts +var StickyRowService = class extends BeanStub40 { + constructor() { + super(...arguments); + this.beanName = "stickyRowSvc"; + } + createStickyRowFeature(ctrl, createRowCon, destroyRowCtrls) { + const gos = this.gos; + if (_isGroupRowsSticky2(gos) && _isClientSideRowModel6(gos) || _isServerSideRowModel2(gos)) { + return ctrl.createManagedBean(new StickyRowFeature(createRowCon, destroyRowCtrls)); + } + return void 0; + } +}; + +// packages/ag-grid-enterprise/src/rowHierarchy/rowHierarchyModule.ts +var GroupCellRendererModule = { + moduleName: "GroupCellRenderer", + version: VERSION, + userComponents: { + agGroupRowRenderer: GroupCellRenderer, + agGroupCellRenderer: GroupCellRenderer + }, + dynamicBeans: { groupCellRendererCtrl: GroupCellRendererCtrl }, + icons: { + // shown on row group when contracted (click to expand) + groupContracted: "tree-closed", + // shown on row group when expanded (click to contract) + groupExpanded: "tree-open" + }, + css: [groupCellStyles_default], + dependsOn: [EnterpriseCoreModule] +}; +var GroupColumnModule = { + moduleName: "GroupColumn", + version: VERSION, + beans: [ + AutoColService, + ShowRowGroupColsService, + ShowRowGroupColValueService, + RowGroupColsSvc, + PivotColsSvc, + ValueColsSvc + ], + dependsOn: [EnterpriseCoreModule, GroupCellRendererModule] +}; +var ChangedPathModule = { + moduleName: "ChangedPath", + version: VERSION, + beans: [ChangedPathFactory], + dependsOn: [EnterpriseCoreModule] +}; +var ClientSideRowModelHierarchyModule = { + moduleName: "ClientSideRowModelHierarchy", + version: VERSION, + rowModels: ["clientSide"], + beans: [GroupStage, FlattenStage, ClientSideExpansionService], + dependsOn: [EnterpriseCoreModule, ChangedPathModule] +}; +var StickyRowModule = { + moduleName: "StickyRow", + version: VERSION, + beans: [StickyRowService] +}; +var GroupEditModule = { + moduleName: "GroupEdit", + version: VERSION, + beans: [GroupEditService], + dependsOn: [EnterpriseCoreModule, ClientSideRowModelHierarchyModule] +}; + +// packages/ag-grid-enterprise/src/groupHierarchy/groupHierarchyColService.ts +import { + AgColumn as AgColumn2, + BeanStub as BeanStub41, + GROUP_HIERARCHY_COLUMN_ID_PREFIX, + _addColumnDefaultAndTypes as _addColumnDefaultAndTypes2, + _areColIdsEqual as _areColIdsEqual2, + _columnsMatch as _columnsMatch2, + _destroyColumnTree as _destroyColumnTree2, + _removeAllFromArray, + _updateColsMap as _updateColsMap2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/groupHierarchy/groupHierarchyUtils.ts +import { _MONTHS, _getDateParts as _getDateParts2, _parseDateTimeFromString as _parseDateTimeFromString2 } from "ag-grid-community"; +var getDate = ({ valueSvc, dataTypeSvc }, sourceCol, node) => { + const innerValue = valueSvc.getValue(sourceCol, node, "data"); + let date = null; + if (innerValue instanceof Date) { + date = innerValue; + } else if (typeof innerValue === "string") { + const parseDate = dataTypeSvc?.getDateParserFunction(sourceCol) ?? _parseDateTimeFromString2; + date = parseDate(innerValue) ?? null; + } + return date; +}; +var getDatePartValueGetter = (beans, col, index, map) => (params) => { + const date = getDate(beans, col, params.node); + const parts = _getDateParts2(date); + if (!parts) { + return null; + } + return map?.(parts[index]) ?? parts[index]; +}; +var getHeaderValueGetter = ({ colNames }, col, part) => (params) => { + const sourceName = colNames.getDisplayNameForColumn(col, params.location); + if (sourceName) { + return `${sourceName} (${part})`; + } + return ""; +}; +var MONTH_TO_LOCALE_KEY = Object.fromEntries(_MONTHS.map((m) => [m, m.toLowerCase()])); +var numericalMonthToNamedMonth = (monthStr) => { + const month = _MONTHS[Number.parseInt(monthStr, 10) - 1] ?? monthStr; + const localeKey = MONTH_TO_LOCALE_KEY[month] ?? monthStr; + return { month, localeKey }; +}; +function _getGroupHierarchy(colDef) { + return colDef.groupHierarchy ?? colDef.rowGroupingHierarchy; +} + +// packages/ag-grid-enterprise/src/groupHierarchy/groupHierarchyColService.ts +var GroupHierarchyColService = class extends BeanStub41 { + constructor() { + super(...arguments); + this.beanName = "groupHierarchyColSvc"; + this.columns = null; + /** Map from primary column to virtual (i.e. generated) columns */ + this.sourceColumnMap = /* @__PURE__ */ new WeakMap(); + /** Map from virtual column to associated primary column. Inverse of `sourceColumnMap` */ + this.inverseColumnMap = /* @__PURE__ */ new WeakMap(); + } + addColumns(cols) { + const groupHierarchyCols = this.columns; + if (groupHierarchyCols == null) { + return; + } + cols.list = groupHierarchyCols.list.filter((col) => !cols.list.some((c) => c.getColId() === col.getColId())).concat(cols.list); + cols.tree = groupHierarchyCols.tree.filter((col) => !cols.tree.some((c) => c.getId() === col.getId())).concat(cols.tree); + _updateColsMap2(cols); + } + createColumns(cols) { + const newSourceColumnMap = /* @__PURE__ */ new WeakMap(); + const newInverseColumnMap = /* @__PURE__ */ new WeakMap(); + const list = this.createGroupHierarchyColumns(cols, newSourceColumnMap, newInverseColumnMap); + const areSame = _areColIdsEqual2(list, this.columns?.list ?? []); + if (areSame) { + return; + } + _destroyColumnTree2(this.beans, this.columns?.tree); + this.columns = null; + const { colGroupSvc } = this.beans; + const treeDepth = colGroupSvc?.findDepth(cols.tree) ?? 0; + const tree = colGroupSvc?.balanceTreeForAutoCols(list, treeDepth) ?? []; + this.columns = { + list, + tree, + treeDepth, + map: {} + }; + this.sourceColumnMap = newSourceColumnMap; + this.inverseColumnMap = newInverseColumnMap; + } + updateColumns(_event) { + } + getColumn(key) { + return this.columns?.list.find((col) => _columnsMatch2(col, key)) ?? null; + } + getColumns() { + return this.columns?.list ?? null; + } + expandColumnInto(target, col) { + const expanded = this.getVirtualColumnsForColumn(col).concat(col); + for (const expandedCol of expanded) { + if (!target.some((_c) => _columnsMatch2(_c, expandedCol) || _c.getColId() === expandedCol.getColId())) { + target.push(expandedCol); + } + } + } + compareVirtualColumns(colA, colB) { + const sourceA = this.inverseColumnMap.get(colA); + const sourceB = this.inverseColumnMap.get(colB); + if (sourceA && sourceA === sourceB) { + const hierarchyCols = this.sourceColumnMap.get(sourceA) ?? []; + return hierarchyCols?.indexOf(colA) - hierarchyCols?.indexOf(colB); + } + if (this.sourceColumnMap.get(colA)?.includes(colB)) { + return 1; + } + if (this.sourceColumnMap.get(colB)?.includes(colA)) { + return -1; + } + return null; + } + insertVirtualColumnsForCol(columns, col) { + const hierarchyCols = this.getVirtualColumnsForColumn(col); + if (!hierarchyCols) { + return []; + } + let idxCol = columns.indexOf(col); + if (idxCol < 0) { + idxCol = columns.length - 1; + } + _removeAllFromArray(columns, hierarchyCols); + columns.splice(idxCol, 0, ...hierarchyCols); + return hierarchyCols; + } + getVirtualColumnsForColumn(col) { + if (this.isGroupHierarchyColsEnabledForCol(col)) { + return this.sourceColumnMap.get(col) ?? []; + } + return []; + } + isGroupHierarchyColsEnabled(cols) { + return cols.list.some((col) => this.isGroupHierarchyColsEnabledForCol(col)); + } + isGroupHierarchyColsEnabledForCol(col) { + const def = col.getColDef(); + const groupHierarchy = _getGroupHierarchy(def); + return !!(groupHierarchy && (def.rowGroup || def.enableRowGroup || def.rowGroupIndex != null || def.pivot || def.enablePivot || def.pivotIndex != null)); + } + createGroupHierarchyColDefs(sourceCol) { + const colDefs = []; + const sourceColDef = sourceCol.getColDef(); + const groupHierarchy = _getGroupHierarchy(sourceColDef); + if (!groupHierarchy) { + return colDefs; + } + if (!this.isGroupHierarchyColsEnabledForCol(sourceCol)) { + return colDefs; + } + for (const part of groupHierarchy) { + let colDef = null; + if (typeof part === "string") { + colDef = this.createColDefForPart(part, sourceCol, sourceColDef); + } else { + colDef = part; + } + if (colDef) { + colDefs.push(colDef); + } + } + return colDefs; + } + createGroupHierarchyColumns(cols, sourceColMap, inverseColMap) { + if (!this.isGroupHierarchyColsEnabled(cols)) { + return []; + } + const newCols = []; + for (const col of cols.list) { + for (const colDef of this.createGroupHierarchyColDefs(col)) { + const colId = colDef.colId; + this.gos.validateColDef(colDef, colId, true); + const newCol = new AgColumn2(colDef, null, colId, true); + this.createBean(newCol); + newCols.push(newCol); + updateMap(sourceColMap, col, newCol); + inverseColMap.set(newCol, col); + } + } + return newCols; + } + createColDefForPart(part, sourceCol, sourceColDef) { + const { beans, gos } = this; + const colId = `${GROUP_HIERARCHY_COLUMN_ID_PREFIX}-${sourceCol.getColId()}-${part}`; + const defaults = { + enableRowGroup: sourceColDef.enableRowGroup, + rowGroup: sourceColDef.rowGroup, + enablePivot: sourceColDef.enablePivot, + hide: true, + editable: false + }; + const groupHierarchyConfig = gos.get("groupHierarchyConfig") ?? {}; + if (part in groupHierarchyConfig) { + const colDef = { ...defaults, ...groupHierarchyConfig[part] }; + colDef.colId ?? (colDef.colId = colId); + return _addColumnDefaultAndTypes2(beans, colDef, colDef.colId, true); + } + const base = _addColumnDefaultAndTypes2(beans, { colId, ...defaults }, colId, true); + const translate = this.getLocaleTextFunc(); + const translatePart = (part2, fallback) => translate?.(part2, fallback) ?? fallback; + switch (part) { + case "year": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Year")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 0) + }; + case "quarter": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Quarter")), + valueGetter: getDatePartValueGetter( + beans, + sourceCol, + 1, + (month) => (Math.floor(Number(month) / 4) + 1).toString() + ) + }; + case "month": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Month")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 1) + }; + case "formattedMonth": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart("month", "Month")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 1, (month) => { + const nm = numericalMonthToNamedMonth(month); + return translatePart(nm.localeKey, nm.month); + }) + }; + case "day": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Day")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 2) + }; + case "hour": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Hour")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 3) + }; + case "minute": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Minute")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 4) + }; + case "second": + return { + ...base, + headerValueGetter: getHeaderValueGetter(beans, sourceCol, translatePart(part, "Second")), + valueGetter: getDatePartValueGetter(beans, sourceCol, 5) + }; + default: + return null; + } + } +}; +function updateMap(wm, key, value) { + const existing = wm.get(key); + wm.set(key, (existing ?? []).concat(value)); +} + +// packages/ag-grid-enterprise/src/groupHierarchy/groupHierarchyModule.ts +var GroupHierarchyModule = { + moduleName: "GroupHierarchy", + version: VERSION, + beans: [GroupHierarchyColService], + dependsOn: [ChangedPathModule] +}; + +// packages/ag-grid-enterprise/src/rowGrouping/columnDropZones/agGridHeaderDropZones.ts +import { Component as Component38, _createElement as _createElement11 } from "ag-grid-community"; +var AgGridHeaderDropZones = class extends Component38 { + constructor() { + super(); + } + postConstruct() { + this.setGui(this.createNorthPanel()); + const onRowGroupChanged = this.onRowGroupChanged.bind(this); + this.addManagedEventListeners({ + columnRowGroupChanged: onRowGroupChanged, + newColumnsLoaded: onRowGroupChanged + }); + this.addManagedPropertyListener("rowGroupPanelShow", onRowGroupChanged); + this.addManagedPropertyListener("pivotPanelShow", () => this.onPivotPanelShow()); + this.onRowGroupChanged(); + } + createNorthPanel() { + const topPanelGui = _createElement11({ tag: "div", cls: "ag-column-drop-wrapper", role: "presentation" }); + const rowGroupComp = new RowGroupDropZonePanel(true); + this.rowGroupComp = this.createManagedBean(rowGroupComp); + const pivotComp = new PivotDropZonePanel(true); + this.pivotComp = this.createManagedBean(pivotComp); + topPanelGui.appendChild(rowGroupComp.getGui()); + topPanelGui.appendChild(pivotComp.getGui()); + const listener = this.onDropPanelVisible.bind(this); + this.addManagedListeners(rowGroupComp, { + displayChanged: listener + }); + this.addManagedListeners(pivotComp, { + displayChanged: listener + }); + this.onDropPanelVisible(); + return topPanelGui; + } + onDropPanelVisible() { + const { rowGroupComp, pivotComp } = this; + const bothDisplayed = rowGroupComp.isDisplayed() && pivotComp.isDisplayed(); + const classStr = "ag-column-drop-horizontal-half-width"; + rowGroupComp.toggleCss(classStr, bothDisplayed); + pivotComp.toggleCss(classStr, bothDisplayed); + } + onRowGroupChanged() { + const rowGroupComp = this.rowGroupComp; + if (!rowGroupComp) { + return; + } + const rowGroupPanelShow = this.gos.get("rowGroupPanelShow"); + if (rowGroupPanelShow === "always") { + rowGroupComp.setDisplayed(true); + } else if (rowGroupPanelShow === "onlyWhenGrouping") { + const grouping = this.beans.rowGroupColsSvc?.columns?.length !== 0; + rowGroupComp.setDisplayed(grouping); + } else { + rowGroupComp.setDisplayed(false); + } + } + onPivotPanelShow() { + const pivotComp = this.pivotComp; + if (!pivotComp) { + return; + } + const pivotPanelShow = this.gos.get("pivotPanelShow"); + if (pivotPanelShow === "always") { + pivotComp.setDisplayed(true); + } else if (pivotPanelShow === "onlyWhenPivoting") { + const pivoting = this.beans.colModel.isPivotActive(); + pivotComp.setDisplayed(pivoting); + } else { + pivotComp.setDisplayed(false); + } + } + getFocusableContainers() { + return [this.rowGroupComp, this.pivotComp].filter((comp) => !!comp); + } +}; +var AgGridHeaderDropZonesSelector = { + selector: "AG-GRID-HEADER-DROP-ZONES", + component: AgGridHeaderDropZones +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupFilter/groupFilter.ts +import { + AgPromise as AgPromise11, + AgSelect, + FilterComp as FilterComp2, + RefPlaceholder as RefPlaceholder36, + TabGuardComp as TabGuardComp3, + _clearElement as _clearElement12, + _createElement as _createElement12, + _setDisplayed as _setDisplayed19, + _warn as _warn30 +} from "ag-grid-community"; +function processGroupFilterParams(params) { + if (params.buttons) { + params.buttons = []; + } + return params; +} +var GroupFilterElement = { + tag: "div", + cls: "ag-group-filter", + children: [ + { tag: "div", ref: "eGroupField" }, + { tag: "div", ref: "eUnderlyingFilter" } + ] +}; +var GroupFilter = class extends TabGuardComp3 { + constructor() { + super(GroupFilterElement); + this.filterType = "group"; + this.eGroupField = RefPlaceholder36; + this.eUnderlyingFilter = RefPlaceholder36; + } + wireBeans(beans) { + this.groupFilterSvc = beans.groupFilter; + } + postConstruct() { + this.initialiseTabGuard({}); + } + init(legacyParams) { + this.params = legacyParams; + return this.updateParams().then(() => { + this.addHandlerListeners(this.updateGroups.bind(this)); + }); + } + refresh(legacyParams) { + const params = legacyParams; + this.params = params; + if (params.source === "colDef") { + this.updateParams(); + } + return true; + } + updateParams() { + this.validateParams(); + return this.updateGroups(); + } + validateParams() { + const { colDef } = this.params; + if (colDef.field) { + _warn30(234); + } + if (colDef.filterValueGetter) { + _warn30(235); + } + if (colDef.filterParams) { + _warn30(236); + } + } + addHandlerListeners(listener) { + const destroyFunctions = this.addManagedListeners(this.getHandler(), { + sourceColumnsChanged: () => { + this.updateGroups(); + }, + destroyed: () => { + for (const func of destroyFunctions) { + func(); + } + this.addHandlerListeners(listener); + } + }); + } + updateGroups() { + const { sourceColumns, selectedColumn } = this.updateGroupField(); + this.dispatchLocalEvent({ + type: "columnsChanged" + }); + return this.getUnderlyingFilters(sourceColumns, selectedColumn); + } + updateGroupField() { + this.groupColumn = this.params.column; + const handler = this.getHandler(); + if (!handler) { + return { sourceColumns: null }; + } + const { sourceColumns, hasMultipleColumns, selectedColumn } = handler; + const eGroupField = this.eGroupField; + _clearElement12(eGroupField); + if (this.eGroupFieldSelect) { + this.destroyBean(this.eGroupFieldSelect); + } + if (hasMultipleColumns && sourceColumns) { + this.createGroupFieldSelectElement(sourceColumns, selectedColumn); + eGroupField.appendChild(this.eGroupFieldSelect.getGui()); + eGroupField.appendChild(_createElement12({ tag: "div", cls: "ag-filter-separator" })); + } + _setDisplayed19(eGroupField, hasMultipleColumns); + return { sourceColumns, selectedColumn }; + } + createGroupFieldSelectElement(sourceColumns, selectedColumn) { + const eGroupFieldSelect = this.createManagedBean(new AgSelect()); + this.eGroupFieldSelect = eGroupFieldSelect; + const localeTextFunc = this.getLocaleTextFunc(); + eGroupFieldSelect.setLabel(localeTextFunc("groupFilterSelect", "Select field:")); + eGroupFieldSelect.setLabelAlignment("top"); + eGroupFieldSelect.addOptions( + sourceColumns.map((sourceColumn) => ({ + value: sourceColumn.getColId(), + text: this.beans.colNames.getDisplayNameForColumn(sourceColumn, "groupFilter", false) ?? void 0 + })) + ); + eGroupFieldSelect.setValue(selectedColumn.getColId()); + eGroupFieldSelect.onValueChange((newValue) => this.updateSelectedColumn(newValue)); + eGroupFieldSelect.addCss("ag-group-filter-field-select-wrapper"); + if (sourceColumns.length === 1) { + eGroupFieldSelect.setDisabled(true); + } + } + getUnderlyingFilters(sourceColumns, selectedColumn) { + if (!sourceColumns) { + this.filterColumnPairs = void 0; + this.selectedFilter = void 0; + return AgPromise11.resolve(); + } + const filterPromises = []; + const filterColumnPairs = []; + const colFilter = this.beans.colFilter; + for (const column of sourceColumns) { + const filterPromise = colFilter.getOrCreateFilterUi(column); + if (filterPromise) { + filterPromises.push( + filterPromise.then((filter) => { + if (filter) { + filterColumnPairs.push({ + filter, + column + }); + } + if (column.getColId() === selectedColumn.getColId()) { + this.selectedFilter = filter ?? void 0; + } + }) + ); + } + } + return AgPromise11.all(filterPromises).then(() => { + this.filterColumnPairs = filterColumnPairs; + }); + } + addUnderlyingFilterElement(selectedColumn) { + _clearElement12(this.eUnderlyingFilter); + if (!selectedColumn) { + return AgPromise11.resolve(); + } + const comp = this.createManagedBean(new FilterComp2(selectedColumn, "COLUMN_MENU")); + this.filterComp = comp; + if (!comp.hasFilter()) { + return AgPromise11.resolve(); + } + this.eUnderlyingFilter.appendChild(comp.getGui()); + return comp.getFilter()?.then(() => { + comp.afterGuiAttached?.(this.afterGuiAttachedParams); + if (!this.afterGuiAttachedParams?.suppressFocus && this.eGroupFieldSelect && !this.eGroupFieldSelect.isDisabled()) { + this.eGroupFieldSelect.getFocusableElement().focus(); + } + }) ?? AgPromise11.resolve(); + } + updateSelectedColumn(columnId) { + if (!columnId) { + return; + } + this.filterComp?.afterGuiDetached(); + this.destroyBean(this.filterComp); + const selectedFilterColumnPair = this.getFilterColumnPair(columnId); + const selectedColumn = selectedFilterColumnPair?.column; + this.selectedFilter = selectedFilterColumnPair?.filter; + this.getHandler().setSelectedColumn(selectedColumn); + this.dispatchLocalEvent({ + type: "columnsChanged" + }); + this.addUnderlyingFilterElement(selectedColumn); + } + isFilterActive() { + return this.groupFilterSvc.isFilterActive(this.groupColumn); + } + doesFilterPass() { + return true; + } + getModel() { + return null; + } + setModel() { + } + afterGuiAttached(params) { + this.afterGuiAttachedParams = params; + this.addUnderlyingFilterElement(this.getHandler().selectedColumn); + } + afterGuiDetached() { + _clearElement12(this.eUnderlyingFilter); + this.selectedFilter?.afterGuiDetached?.(); + } + getSelectedColumn() { + return this.getHandler().selectedColumn; + } + getHandler() { + return this.params.getHandler(); + } + getFilterColumnPair(columnId) { + if (!columnId) { + return void 0; + } + return this.filterColumnPairs?.find(({ column }) => column.getColId() === columnId); + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupFilter/groupFilterHandler.ts +import { BeanStub as BeanStub42, _warn as _warn31 } from "ag-grid-community"; +var GroupFilterHandler = class extends BeanStub42 { + init(params) { + this.params = params; + this.validateModel(params); + this.updateColumns(); + this.addManagedEventListeners({ + columnRowGroupChanged: this.updateColumns.bind(this), + filterDestroyed: (event) => this.onFilterDestroyed(event) + }); + } + refresh(params) { + this.params = params; + this.validateModel(params); + if (params.source === "colDef") { + this.updateColumns(); + } + } + doesFilterPass() { + return true; + } + setSelectedColumn(selectedColumn) { + this.selectedColumn = selectedColumn; + this.dispatchLocalEvent({ type: "selectedColumnChanged" }); + } + validateModel(params) { + if (params.model != null) { + params.onModelChange(null); + } + } + getSourceColumns() { + const groupColumn = this.params.column; + if (this.gos.get("treeData")) { + _warn31(237); + return []; + } + const sourceColumns = this.beans.groupFilter.getSourceColumns(groupColumn); + if (!sourceColumns) { + _warn31(183); + return []; + } + return sourceColumns; + } + updateColumns() { + const allSourceColumns = this.getSourceColumns(); + const sourceColumns = allSourceColumns.filter((sourceColumn) => sourceColumn.isFilterAllowed()); + this.sourceColumns = sourceColumns; + let selectedColumn; + let hasMultipleColumns; + if (!sourceColumns.length) { + selectedColumn = void 0; + hasMultipleColumns = false; + } else if (allSourceColumns.length === 1) { + selectedColumn = sourceColumns[0]; + hasMultipleColumns = false; + } else { + selectedColumn = this.selectedColumn; + if (!selectedColumn || !sourceColumns.some((column) => column.getId() === selectedColumn.getId())) { + selectedColumn = sourceColumns[0]; + } + hasMultipleColumns = true; + } + this.selectedColumn = selectedColumn; + this.hasMultipleColumns = hasMultipleColumns; + this.dispatchLocalEvent({ type: "sourceColumnsChanged" }); + } + onFilterDestroyed({ column: eventColumn, source }) { + if (source === "gridDestroyed") { + return; + } + const colId = eventColumn.getColId(); + if (this.sourceColumns?.some((column) => column.getColId() === colId)) { + setTimeout(() => { + if (this.isAlive()) { + this.updateColumns(); + } + }); + } + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupFilter/groupFilterService.ts +import { BeanStub as BeanStub43 } from "ag-grid-community"; +var GroupFilterService = class extends BeanStub43 { + constructor() { + super(...arguments); + this.beanName = "groupFilter"; + } + postConstruct() { + this.addManagedEventListeners({ + columnRowGroupChanged: () => this.updateFilterFlags("columnRowGroupChanged") + }); + } + isGroupFilter(column) { + return column.getColDef().filter === "agGroupColumnFilter"; + } + isFilterAllowed(column) { + const colFilter = this.beans.colFilter; + return !!this.getSourceColumns(column)?.some((column2) => colFilter?.isFilterAllowed(column2)); + } + isFilterActive(column) { + const colFilter = this.beans.colFilter; + return !!this.getSourceColumns(column)?.some((column2) => colFilter?.isFilterActive(column2)); + } + getSourceColumns(column) { + return this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(column); + } + updateFilterFlags(source, additionalEventAttributes) { + const { autoColSvc, colFilter } = this.beans; + autoColSvc?.getColumns()?.forEach((groupColumn) => { + if (this.isGroupFilter(groupColumn)) { + colFilter?.setColFilterActive( + groupColumn, + this.isFilterActive(groupColumn), + source, + additionalEventAttributes + ); + } + }); + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupFilter/groupFloatingFilter.ts +import { + AgInputTextField as AgInputTextField3, + AgPromise as AgPromise12, + Component as Component39, + RefPlaceholder as RefPlaceholder37, + _clearElement as _clearElement13, + _isGroupMultiAutoColumn as _isGroupMultiAutoColumn3 +} from "ag-grid-community"; +var GroupFloatingFilterElement = { + tag: "div", + ref: "eFloatingFilter", + cls: "ag-group-floating-filter ag-floating-filter-input", + role: "presentation" +}; +var GroupFloatingFilterComp = class extends Component39 { + constructor() { + super(GroupFloatingFilterElement); + this.eFloatingFilter = RefPlaceholder37; + this.haveAddedColumnListeners = false; + } + init(params) { + this.params = params; + const canShowUnderlyingFloatingFilter = _isGroupMultiAutoColumn3(this.gos); + const onColChange = this.onColChange.bind(this); + const setupFilterElement = (resolve) => { + if (canShowUnderlyingFloatingFilter) { + this.setupUnderlyingFloatingFilterElement().then(() => resolve()); + } else { + this.setupReadOnlyFloatingFilterElement(); + resolve(); + } + }; + if (this.gos.get("enableFilterHandlers")) { + return new AgPromise12((resolve) => setupFilterElement(resolve)).then(() => { + this.addHandlerListeners(params, onColChange); + }); + } else { + return new AgPromise12((resolve) => { + this.params.parentFilterInstance((parentFilterInstance) => { + this.parentFilterInstance = parentFilterInstance; + setupFilterElement(resolve); + }); + }).then(() => { + this.addManagedListeners(this.parentFilterInstance, { + columnsChanged: onColChange + }); + }); + } + } + refresh(params) { + this.params = params; + this.setParams(); + if (this.gos.get("enableFilterHandlers")) { + if (this.showingUnderlyingFloatingFilter) { + const column = this.getSelectedColumn(); + const compDetails = this.beans.colFilter.getFloatingFilterCompDetails( + column, + this.params.showParentFilter + ); + this.underlyingFloatingFilter?.refresh?.(compDetails?.params); + } else { + this.updateDisplayedValue(); + } + } + } + setParams() { + const displayName = this.beans.colNames.getDisplayNameForColumn(this.params.column, "header", true); + const translate = this.getLocaleTextFunc(); + this.eFloatingFilterText?.setInputAriaLabel(`${displayName} ${translate("ariaFilterInput", "Filter Input")}`); + } + addHandlerListeners(params, listener) { + const destroyFunctions = this.addManagedListeners(params.getHandler(), { + selectedColumnChanged: listener, + sourceColumnsChanged: listener, + destroyed: () => { + for (const func of destroyFunctions) { + func(); + } + this.addHandlerListeners(this.params, listener); + } + }); + } + setupReadOnlyFloatingFilterElement() { + if (!this.eFloatingFilterText) { + this.eFloatingFilterText = this.createManagedBean(new AgInputTextField3()); + this.eFloatingFilterText.setDisabled(true).addGuiEventListener("click", () => this.params.showParentFilter()); + this.setParams(); + } + this.updateDisplayedValue(); + this.eFloatingFilter.appendChild(this.eFloatingFilterText.getGui()); + } + setupUnderlyingFloatingFilterElement() { + this.showingUnderlyingFloatingFilter = false; + this.underlyingFloatingFilter = void 0; + _clearElement13(this.eFloatingFilter); + const column = this.getSelectedColumn(); + if (column && !column.isVisible()) { + const colFilter = this.beans.colFilter; + const compDetails = colFilter.getFloatingFilterCompDetails(column, this.params.showParentFilter); + if (compDetails) { + if (!this.haveAddedColumnListeners) { + this.haveAddedColumnListeners = true; + this.addManagedListeners(column, { + visibleChanged: this.onColumnVisibleChanged.bind(this), + colDefChanged: this.onColDefChanged.bind(this) + }); + } + return compDetails.newAgStackInstance().then((floatingFilter) => { + this.underlyingFloatingFilter = floatingFilter; + this.underlyingFloatingFilter?.onParentModelChanged(colFilter.getModelForColumn(column)); + this.appendChild(floatingFilter.getGui()); + this.showingUnderlyingFloatingFilter = true; + }); + } + } + this.setupReadOnlyFloatingFilterElement(); + return AgPromise12.resolve(); + } + getSelectedColumn() { + if (this.gos.get("enableFilterHandlers")) { + const reactiveParams = this.params; + return reactiveParams.getHandler().selectedColumn; + } else { + return this.parentFilterInstance.getSelectedColumn(); + } + } + onColumnVisibleChanged() { + this.setupUnderlyingFloatingFilterElement(); + } + onColDefChanged(event) { + if (!event.column) { + return; + } + const compDetails = this.beans.colFilter.getFloatingFilterCompDetails( + event.column, + this.params.showParentFilter + ); + if (compDetails) { + this.underlyingFloatingFilter?.refresh?.(compDetails.params); + } + } + onParentModelChanged(_model, event) { + if (this.showingUnderlyingFloatingFilter) { + this.underlyingFloatingFilter?.onParentModelChanged( + this.beans.colFilter.getModelForColumn(this.getSelectedColumn()), + event + ); + } else { + this.updateDisplayedValue(); + } + } + updateDisplayedValue() { + const eFloatingFilterText = this.eFloatingFilterText; + if (!eFloatingFilterText) { + return; + } + const colFilter = this.beans.colFilter; + const column = this.getSelectedColumn(); + const updateText = (filterOrHandler) => { + if (!filterOrHandler) { + eFloatingFilterText.setValue(""); + eFloatingFilterText.setDisplayed(false); + } else { + const model = column ? colFilter.getModelForColumn(column) : null; + eFloatingFilterText.setValue(model == null ? "" : filterOrHandler.getModelAsString?.(model) ?? ""); + eFloatingFilterText.setDisplayed(true); + } + }; + if (!column) { + updateText(); + } else if (this.gos.get("enableFilterHandlers")) { + updateText(colFilter.getHandler(column)); + } else { + colFilter.getOrCreateFilterUi(column)?.then((filter) => { + updateText(filter); + }); + } + } + onColChange() { + if (!this.showingUnderlyingFloatingFilter) { + this.updateDisplayedValue(); + } + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupStrategy/groupStrategy.ts +import { BeanStub as BeanStub44, RowNode, _csrmFirstLeaf as _csrmFirstLeaf2, _forEachChangedGroupDepthFirst as _forEachChangedGroupDepthFirst3, _warn as _warn32 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowGrouping/groupStrategy/groupColumns.ts +var makeGroupColumns = (columns, result) => { + if (!columns) { + result.length = 0; + return; + } + const len = columns.length; + result.length = len; + for (let i = 0; i < len; i++) { + const col = columns[i]; + const colDef = col.getColDef(); + result[i] = { + col, + field: colDef.field, + type: colDef.type, + keyCreator: colDef.keyCreator, + valueGetter: colDef.valueGetter + }; + } +}; +var groupColumnsChanged = (groupColumns, columns) => { + const len = groupColumns.length; + if (len !== columns?.length) { + return true; + } + for (let i = 0; i < len; i++) { + const a = groupColumns[i]; + const b = columns[i]; + if (a.col !== b) { + return true; + } + const bColDef = b.getColDef(); + if (a.field !== bColDef.field || a.type !== bColDef.type || a.valueGetter !== bColDef.valueGetter || a.keyCreator !== bColDef.keyCreator) { + return true; + } + } + return false; +}; + +// packages/ag-grid-enterprise/src/rowGrouping/groupStrategy/sortGroupChildren.ts +function sortGroupChildren(rowNodes) { + if (!rowNodes) { + return false; + } + const length = rowNodes.length; + if (length < 2) { + return false; + } + let atLeastOneOutOfOrder = false; + for (let i = 1; i < length; i++) { + if (compareGroupChildren(rowNodes[i - 1], rowNodes[i]) > 0) { + atLeastOneOutOfOrder = true; + break; + } + } + if (!atLeastOneOutOfOrder) { + return false; + } + rowNodes.sort(compareGroupChildren); + return true; +} +function compareGroupChildren(nodeA, nodeB) { + const positionA = nodeA.sourceRowIndex; + const positionB = nodeB.sourceRowIndex; + const aHasIndex = positionA >= 0; + const bHasIndex = positionB >= 0; + const bothNodesAreUserNodes = aHasIndex && bHasIndex; + const bothNodesAreFillerNodes = !aHasIndex && !bHasIndex; + if (bothNodesAreUserNodes) { + return positionA - positionB; + } + if (bothNodesAreFillerNodes) { + return nodeA.__objectId - nodeB.__objectId; + } + if (aHasIndex) { + return 1; + } + return -1; +} + +// packages/ag-grid-enterprise/src/rowGrouping/groupStrategy/groupStrategy.ts +var GroupStrategy = class extends BeanStub44 { + constructor() { + super(...arguments); + // when grouping, these items are of note: + // rowNode.parent: RowNode: set to the parent + // rowNode.childrenAfterGroup: RowNode[] = the direct children of this group + // rowNode.childrenMapped: string=>RowNode = children mapped by group key (when groups) or an empty map if leaf group (this is then used by pivot) + // for leaf groups, rowNode.childrenAfterGroup = rowNode.allLeafChildren; + this.groupCols = []; + this.nonLeafsById = /* @__PURE__ */ new Map(); + this.checkGroupCols = true; + this.pivotMode = false; + this.groupEmpty = false; + } + invalidateGroupCols() { + this.checkGroupCols = true; + } + destroy() { + super.destroy(); + this.groupCols.length = 0; + this.nonLeafsById.clear(); + } + clearNonLeafs() { + const nonLeafsById = this.nonLeafsById; + for (const node of nonLeafsById.values()) { + node._destroy(false); + } + nonLeafsById.clear(); + } + loadGroupData(node) { + if (!node.group) { + node._groupData = null; + return null; + } + const rowGroupCol = node.rowGroupColumn; + const { valueSvc, showRowGroupCols } = this.beans; + const groupData = {}; + node._groupData = groupData; + if (!rowGroupCol) { + return groupData; + } + const leafNode = _csrmFirstLeaf2(node); + const rowGroupColId = rowGroupCol.getId(); + if (!showRowGroupCols) { + return groupData; + } + const groupDisplayCols = showRowGroupCols.columns; + for (let i = 0, len = groupDisplayCols.length; i < len; ++i) { + const col = groupDisplayCols[i]; + if (col.isRowGroupDisplayed(rowGroupColId)) { + groupData[col.getColId()] = valueSvc.getValue(rowGroupCol, leafNode, "data"); + } + } + return groupData; + } + execute(rootNode, params) { + const changedPath = params.changedPath; + const refreshResult = this.initRefresh(params); + if (refreshResult !== "skip") { + const changedRowNodes = params.changedRowNodes; + if (changedRowNodes) { + this.handleDeltaUpdate(rootNode, changedPath, changedRowNodes, !!params.animate); + } else { + this.shotgunResetEverything(rootNode); + } + } + this.positionLeafsAndGroups(rootNode, changedPath); + this.orderGroups(rootNode); + this.beans.selectionSvc?.updateSelectableAfterGrouping(changedPath); + } + positionLeafsAndGroups(rootNode, changedPath) { + _forEachChangedGroupDepthFirst3(rootNode, true, changedPath, (group) => { + const children = group.childrenAfterGroup; + const childrenLen = children?.length; + if (!childrenLen) { + return; + } + const newChildren = new Array(childrenLen); + let writeIdx = 0; + let changed = false; + let unbalancedNode; + for (let readIdx = 0; readIdx < childrenLen; ++readIdx) { + const node = children[readIdx]; + if (!node.childrenAfterGroup?.length) { + changed || (changed = writeIdx !== readIdx); + newChildren[writeIdx++] = node; + } else if (!unbalancedNode && node.key === "") { + unbalancedNode = node; + const last = childrenLen - 1; + changed || (changed = readIdx !== last); + newChildren[last] = node; + } + } + if (changed) { + for (let readIdx = 0; readIdx < childrenLen; ++readIdx) { + const node = children[readIdx]; + if (node.childrenAfterGroup?.length && node !== unbalancedNode) { + newChildren[writeIdx++] = node; + } + } + group.childrenAfterGroup = newChildren; + const sibling = group.sibling; + if (sibling) { + sibling.childrenAfterGroup = newChildren; + } + } + }); + } + initRefresh(params) { + const { rowGroupColsSvc, colModel, gos } = this.beans; + this.pivotMode = colModel.isPivotMode(); + this.groupEmpty = this.pivotMode || !gos.get("groupAllowUnbalanced"); + const cols = rowGroupColsSvc?.columns; + const groupCols = this.groupCols; + const afterColumnsChanged = params.afterColumnsChanged; + if (afterColumnsChanged || !groupCols || this.checkGroupCols) { + this.checkGroupCols = false; + if (groupCols && !groupColumnsChanged(groupCols, cols)) { + if (afterColumnsChanged) { + return "skip"; + } + } else { + params.animate = false; + const topLevelChanged = groupCols[0]?.col.getId() !== cols?.[0]?.getId(); + makeGroupColumns(cols, groupCols); + return topLevelChanged ? "refresh" : "groupColsChanged"; + } + } + return "refresh"; + } + handleDeltaUpdate(rootNode, changedPath, { removals, updates, adds, reordered }, animate) { + const parentsWithRemovals = /* @__PURE__ */ new Set(); + for (let i = 0, len = removals.length; i < len; ++i) { + const rowNode = removals[i]; + const oldParent = this.removeFromParent(rowNode); + if (!parentsWithRemovals.has(oldParent)) { + parentsWithRemovals.add(oldParent); + changedPath?.addRow(oldParent); + } + } + for (const rowNode of updates) { + const oldParent = rowNode.parent; + changedPath?.addRow(oldParent); + if (this.moveNodeInWrongPath(rootNode, rowNode)) { + parentsWithRemovals.add(oldParent); + const newParent = rowNode.parent; + changedPath?.addRow(newParent); + reordered || (reordered = (newParent?.childrenAfterGroup?.length ?? 0) > 1); + } + } + if (adds.size) { + for (const rowNode of adds) { + this.insertOneNode(rootNode, rowNode); + const newParent = rowNode.parent; + changedPath?.addRow(newParent); + reordered || (reordered = (newParent?.childrenAfterGroup?.length ?? 0) > 1); + } + } + if (parentsWithRemovals.size) { + batchedRemove(parentsWithRemovals); + this.removeEmptyGroups(parentsWithRemovals, animate); + } + if (reordered) { + this.sortChildren(rootNode, changedPath); + } + } + // this is used when doing delta updates, eg Redux, keeps nodes in right order + sortChildren(rootNode, changedPath) { + _forEachChangedGroupDepthFirst3(rootNode, true, void 0, (node) => { + const didSort = sortGroupChildren(node.childrenAfterGroup); + if (didSort) { + changedPath?.addRow(node); + } + }); + } + orderGroups(rootNode) { + const initialGroupOrderComparator = this.gos.getCallback("initialGroupOrderComparator"); + if (!initialGroupOrderComparator) { + return; + } + const beans = this.beans; + const api = beans.gridApi; + const context = beans.gridOptions.context; + const comparer = (nodeA, nodeB) => initialGroupOrderComparator({ api, context, nodeA, nodeB }); + const recursiveSort = (rowNode) => { + const childrenAfterGroup = rowNode.childrenAfterGroup; + const childrenAfterGroupLen = childrenAfterGroup?.length; + if (!childrenAfterGroupLen || rowNode.leafGroup) { + return; + } + if (childrenAfterGroupLen > 1) { + childrenAfterGroup.sort(comparer); + } + for (let i = 0, len = childrenAfterGroupLen; i < len; ++i) { + recursiveSort(childrenAfterGroup[i]); + } + }; + recursiveSort(rootNode); + } + moveNodeInWrongPath(rootNode, childNode) { + const { valueSvc } = this.beans; + const createGroupForEmpty = this.groupEmpty; + let ancestor = childNode.parent; + let changed = false; + const groupCols = this.groupCols; + if (!groupCols) { + return false; + } + for (let idx = groupCols.length - 1; idx >= 0; --idx) { + const { col } = groupCols[idx]; + let key = valueSvc.getKeyForNode(col, childNode); + if (key == null || key === "") { + if (!createGroupForEmpty) { + continue; + } + key = ""; + } + if (!ancestor?.parent || ancestor.key !== key) { + changed = true; + break; + } + ancestor = ancestor.parent; + } + changed || (changed = !!ancestor?.parent); + if (!changed) { + return false; + } + this.removeFromParent(childNode); + this.insertOneNode(rootNode, childNode); + childNode.setData(childNode.data); + return true; + } + groupShouldBeRemoved(rowNode) { + const mapKey = this.getChildrenMappedKey(rowNode.key, rowNode.rowGroupColumn); + const parentChildrenMapped = rowNode.parent?.childrenMapped; + const groupAlreadyRemoved = parentChildrenMapped ? !parentChildrenMapped[mapKey] : true; + if (groupAlreadyRemoved) { + return false; + } + return !!rowNode.group && (rowNode.childrenAfterGroup?.length ?? 0) === 0; + } + removeEmptyGroups(parents, animate) { + const selectionSvc = this.beans.selectionSvc; + let nodesToUnselect; + const possibleEmptyGroups = Array.from(parents); + const groupsById = this.nonLeafsById; + do { + parents.clear(); + for (let idx = 0; idx < possibleEmptyGroups.length; ++idx) { + let pointer = possibleEmptyGroups[idx]; + while (pointer) { + const parent = pointer.parent; + if (pointer.destroyed) { + possibleEmptyGroups[idx] = parent; + pointer = parent; + continue; + } + if (!parent) { + break; + } + if (!this.groupShouldBeRemoved(pointer)) { + pointer = parent; + continue; + } + parents.add(parent); + this.removeFromParent(pointer); + if (selectionSvc && pointer.isSelected()) { + nodesToUnselect ?? (nodesToUnselect = []); + nodesToUnselect.push(pointer); + } + possibleEmptyGroups[idx] = parent; + groupsById.delete(pointer.id); + pointer._destroy(animate); + pointer = parent; + } + } + batchedRemove(parents); + } while (parents.size); + if (nodesToUnselect) { + selectionSvc.setNodesSelected({ + nodes: nodesToUnselect, + newValue: false, + source: "rowGroupChanged" + }); + } + } + // removes the node from the parent by: + // a) removing from childrenAfterGroup (using batchRemover if present, otherwise immediately) + // b) removing from childrenMapped (immediately) + // c) setRowTop(null) - as the rowRenderer uses this to know the RowNode is no longer needed + // d) setRowIndex(null) - as the rowNode will no longer be displayed. + removeFromParent(child) { + const oldParent = child.parent; + if (oldParent) { + const mapKey = this.getChildrenMappedKey(child.key, child.rowGroupColumn); + const childParentChildrenMapped = oldParent.childrenMapped; + if (childParentChildrenMapped) { + delete childParentChildrenMapped[mapKey]; + } + } + child.setRowTop(null); + child.setRowIndex(null); + return oldParent; + } + /** + * This is idempotent, but relies on the `key` field being the same throughout a RowNode's lifetime + */ + addToParent(child, parent) { + const childrenMapped = parent.childrenMapped ?? (parent.childrenMapped = {}); + const mapKey = this.getChildrenMappedKey(child.key, child.rowGroupColumn); + if (childrenMapped[mapKey] !== child) { + childrenMapped[mapKey] = child; + let childrenAfterGroup = parent.childrenAfterGroup; + if (!childrenAfterGroup) { + parent.childrenAfterGroup = childrenAfterGroup = []; + const sibling = parent.sibling; + if (sibling) { + sibling.childrenAfterGroup = parent.childrenAfterGroup; + } + } + childrenAfterGroup.push(child); + setRowNodeGroup(parent, this.beans, true); + invalidateAllLeafChildren(parent); + } + } + shotgunResetEverything(rootNode) { + const groupsById = this.nonLeafsById; + for (const node of groupsById.values()) { + node.childrenAfterGroup = null; + node.childrenMapped = null; + } + rootNode.leafGroup = !this.groupCols?.length; + rootNode.childrenAfterGroup = []; + rootNode.childrenMapped = {}; + rootNode.updateHasChildren(); + const sibling = rootNode.sibling; + if (sibling) { + sibling.childrenAfterGroup = rootNode.childrenAfterGroup; + sibling.childrenMapped = rootNode.childrenMapped; + } + const allLeafs = rootNode._leafs; + for (let i = 0, len = allLeafs.length; i < len; ++i) { + this.insertOneNode(rootNode, allLeafs[i]); + } + this.destroyStaleGroups(groupsById); + } + /** Remove and destroy group nodes that were not reused (still have childrenAfterGroup === null) */ + destroyStaleGroups(groupsById) { + const selectionSvc = this.beans.selectionSvc; + let nodesToDeselect; + for (const [id, node] of groupsById) { + if (node.childrenAfterGroup !== null) { + continue; + } + if (selectionSvc && node.isSelected()) { + (nodesToDeselect ?? (nodesToDeselect = [])).push(node); + } + groupsById.delete(id); + node._destroy(false); + } + if (nodesToDeselect) { + selectionSvc.setNodesSelected({ + nodes: nodesToDeselect, + newValue: false, + source: "rowGroupChanged" + }); + } + } + insertOneNode(rootNode, childNode) { + let parentGroup = rootNode; + const { beans, groupCols, groupEmpty } = this; + const valueSvc = beans.valueSvc; + if (!groupCols) { + return; + } + const len = groupCols.length; + for (let i = 0; i < len; ++i) { + const groupCol = groupCols[i]; + const col = groupCol.col; + let key = valueSvc.getKeyForNode(col, childNode); + if (key == null || key === "") { + if (!groupEmpty) { + continue; + } + key = ""; + } + const existingGroup = parentGroup.childrenMapped?.[this.getChildrenMappedKey(key, col)]; + if (existingGroup) { + parentGroup = existingGroup; + continue; + } + const nextLevel = parentGroup.level + 1; + const isLeafLevel = nextLevel >= len - 1; + const newGroup = this.createGroup(parentGroup, groupCol, key, nextLevel, isLeafLevel, childNode); + this.addToParent(newGroup, parentGroup); + parentGroup = newGroup; + } + if (!parentGroup.group) { + _warn32(184, { parentGroupData: parentGroup.data, childNodeData: childNode.data }); + } + childNode.parent = parentGroup; + childNode.level = parentGroup.level + 1; + parentGroup.childrenAfterGroup.push(childNode); + parentGroup.updateHasChildren(); + invalidateAllLeafChildren(parentGroup); + } + createGroup(parent, groupCol, key, level, isLeafLevel, leafNode) { + const col = groupCol.col; + const id = (parent.level >= 0 ? parent.id + "-" : "row-group-") + (col.getColId() + "-" + key); + const groupsById = this.nonLeafsById; + let node = groupsById.get(id); + let singleUse = true; + if (node) { + if (node.childrenAfterGroup !== null) { + node._expanded ?? (node._expanded = null); + return node; + } + singleUse = false; + invalidateAllLeafChildren(node); + } else { + node = new RowNode(this.beans); + node.group = true; + node.key = key; + node.id = id; + node.aggData = null; + groupsById.set(id, node); + } + const applyValuesToNode = (n) => { + n.childrenAfterGroup = children; + n.childrenMapped = mapped; + n.parent = parent; + n.level = level; + n.rowGroupIndex = level; + n.leafGroup = isLeafLevel; + }; + const children = []; + const mapped = {}; + applyValuesToNode(node); + node.field = groupCol.field ?? null; + node.rowGroupColumn = col; + node.groupValue = this.beans.valueSvc.getValue(col, leafNode, "data"); + node._expanded ?? (node._expanded = null); + if (singleUse) { + node.setAllChildrenCount(0); + node.updateHasChildren(); + return node; + } + const sibling = node.sibling; + if (sibling) { + applyValuesToNode(sibling); + } + node.dispatchRowEvent("hasChildrenChanged"); + return node; + } + getChildrenMappedKey(key, rowGroupColumn) { + return rowGroupColumn ? rowGroupColumn.getId() + "-" + key : key; + } + onShowRowGroupColsSetChanged() { + const { rowModel, valueSvc } = this.beans; + for (const groupNode of this.nonLeafsById.values()) { + groupNode._groupData = void 0; + const rowGroupColumn = groupNode.rowGroupColumn; + const leafNode = rowGroupColumn && _csrmFirstLeaf2(groupNode); + groupNode.groupValue = leafNode && valueSvc.getValue(rowGroupColumn, leafNode, "data"); + } + const allLeafs = rowModel.rootNode?._leafs; + if (allLeafs) { + for (let i = 0, len = allLeafs.length; i < len; ++i) { + const leafNode = allLeafs[i]; + leafNode.parent._groupData = void 0; + } + } + } +}; +var batchedRemove = (parents) => { + for (const parent of parents) { + const childrenAfterGroup = parent?.childrenAfterGroup; + if (!childrenAfterGroup) { + continue; + } + const childrenAfterGroupLen = childrenAfterGroup.length; + let writeIdx = 0; + for (let readIdx = 0; readIdx < childrenAfterGroupLen; ++readIdx) { + const item = childrenAfterGroup[readIdx]; + if (item.parent === parent && !item.destroyed) { + if (writeIdx !== readIdx) { + childrenAfterGroup[writeIdx] = item; + } + ++writeIdx; + } + } + if (childrenAfterGroupLen !== writeIdx) { + childrenAfterGroup.length = writeIdx; + parent.updateHasChildren(); + invalidateAllLeafChildren(parent); + } + } +}; +var invalidateAllLeafChildren = (node) => { + while (node._leafs !== void 0) { + const parent = node.parent; + if (!parent) { + break; + } + node._leafs = void 0; + node = parent; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingApi.ts +function setRowGroupColumns(beans, colKeys) { + beans.rowGroupColsSvc?.setColumns(colKeys, "api"); +} +function removeRowGroupColumns(beans, colKeys) { + beans.rowGroupColsSvc?.removeColumns(colKeys, "api"); +} +function addRowGroupColumns(beans, colKeys) { + beans.rowGroupColsSvc?.addColumns(colKeys, "api"); +} +function moveRowGroupColumn(beans, fromIndex, toIndex) { + beans.rowGroupColsSvc?.moveColumn?.(fromIndex, toIndex, "api"); +} +function getRowGroupColumns(beans) { + return beans.rowGroupColsSvc?.columns ?? []; +} + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingModule.ts +var SharedRowGroupingModule = { + moduleName: "SharedRowGrouping", + version: VERSION, + apiFunctions: { + setRowGroupColumns, + removeRowGroupColumns, + addRowGroupColumns, + getRowGroupColumns, + moveRowGroupColumn + }, + dependsOn: [ + EnterpriseCoreModule, + SharedAggregationModule, + GroupColumnModule, + StickyRowModule, + GroupHierarchyModule + ] +}; +var RowGroupingModule = { + moduleName: "RowGrouping", + version: VERSION, + dynamicBeans: { groupStrategy: GroupStrategy }, + rowModels: ["clientSide"], + dependsOn: [SharedRowGroupingModule, AggregationModule, ClientSideRowModelHierarchyModule, GroupEditModule] +}; +var RowGroupingPanelModule = { + moduleName: "RowGroupingPanel", + version: VERSION, + selectors: [AgGridHeaderDropZonesSelector], + icons: { + // identifies the pivot drop zone + pivotPanel: "pivot", + // "Row groups" drop zone in column tool panel + rowGroupPanel: "group", + // separator between column 'pills' when you add multiple columns to the header drop zone + panelDelimiter: "small-right", + // version of panelDelimiter used in RTL mode + panelDelimiterRtl: "small-left" + }, + dependsOn: [SharedColumnStateUpdateStrategyModule, _PopupModule4] +}; +var GroupFilterModule = { + moduleName: "GroupFilter", + version: VERSION, + userComponents: { + agGroupColumnFilter: { + classImp: GroupFilter, + processParams: processGroupFilterParams + }, + agGroupColumnFloatingFilter: GroupFloatingFilterComp + }, + beans: [GroupFilterService], + dynamicBeans: { + agGroupColumnFilterHandler: GroupFilterHandler + }, + dependsOn: [EnterpriseCoreModule, _ColumnFilterModule3] +}; + +// packages/ag-grid-enterprise/src/viewportRowModel/viewportRowModel.ts +import { + BeanStub as BeanStub45, + RowNode as RowNode2, + _addGridCommonParams as _addGridCommonParams19, + _getRowHeightAsNumber, + _getRowIdCallback, + _warn as _warn33 +} from "ag-grid-community"; +var ViewportRowModel = class extends BeanStub45 { + constructor() { + super(...arguments); + this.beanName = "rowModel"; + this.hierarchical = false; + // rowRenderer tells us these + this.firstRow = -1; + this.lastRow = -1; + // datasource tells us this + this.rowCount = -1; + this.rowNodesByIndex = {}; + /** Dummy root node */ + this.rootNode = null; + /** + * Used to see if setRowData has been called inside of the viewportChanged event context, + * if so the new rows are already being calculated, and the model does not need updated + * otherwise, a new model event needs to fire as rows have changed externally. + */ + this.viewportChangedContext = false; + } + // we don't implement as lazy row heights is not supported in this row model + ensureRowHeightsValid(_startPixel, _endPixel, _startLimitIndex, _endLimitIndex) { + return false; + } + postConstruct() { + const beans = this.beans; + const rootNode = new RowNode2(beans); + this.rootNode = rootNode; + rootNode.level = -1; + this.rowHeight = _getRowHeightAsNumber(beans); + this.addManagedEventListeners({ viewportChanged: this.onViewportChanged.bind(this) }); + this.addManagedPropertyListener("viewportDatasource", () => this.updateDatasource()); + this.addManagedPropertyListener("rowHeight", () => { + this.rowHeight = _getRowHeightAsNumber(beans); + this.updateRowHeights(); + }); + } + start() { + this.updateDatasource(); + } + isLastRowIndexKnown() { + return true; + } + destroy() { + this.destroyDatasource(); + super.destroy(); + this.rootNode = null; + } + destroyDatasource() { + const datasource = this.datasource; + if (!datasource) { + return; + } + datasource.destroy?.(); + this.beans.rowRenderer.datasourceChanged(); + this.firstRow = -1; + this.lastRow = -1; + } + updateDatasource() { + const datasource = this.gos.get("viewportDatasource"); + if (datasource) { + this.setViewportDatasource(datasource); + } + } + getPageSize() { + return this.gos.get("viewportRowModelPageSize"); + } + getBufferSize() { + return this.gos.get("viewportRowModelBufferSize"); + } + calculateFirstRow(firstRenderedRow) { + const bufferSize = this.getBufferSize(); + const pageSize = this.getPageSize(); + const afterBuffer = firstRenderedRow - bufferSize; + if (afterBuffer < 0) { + return 0; + } + return Math.floor(afterBuffer / pageSize) * pageSize; + } + calculateLastRow(lastRenderedRow) { + if (lastRenderedRow === -1) { + return lastRenderedRow; + } + const bufferSize = this.getBufferSize(); + const pageSize = this.getPageSize(); + const afterBuffer = lastRenderedRow + bufferSize; + const result = Math.ceil(afterBuffer / pageSize) * pageSize; + const lastRowIndex = this.rowCount - 1; + return Math.min(result, lastRowIndex); + } + onViewportChanged(event) { + const newFirst = this.calculateFirstRow(event.firstRow); + const newLast = this.calculateLastRow(event.lastRow); + if (this.firstRow !== newFirst || this.lastRow !== newLast) { + this.firstRow = newFirst; + this.lastRow = newLast; + this.purgeRowsNotInViewport(); + this.viewportChangedContext = true; + this.datasource?.setViewportRange(this.firstRow, this.lastRow); + this.viewportChangedContext = false; + } + } + purgeRowsNotInViewport() { + const rowNodesByIndex = this.rowNodesByIndex; + for (const indexStr of Object.keys(rowNodesByIndex)) { + const index = parseInt(indexStr, 10); + if (index < this.firstRow || index > this.lastRow) { + if (this.isRowFocused(index) || this.beans.editSvc?.isRowEditing(rowNodesByIndex[index])) { + continue; + } + delete rowNodesByIndex[index]; + } + } + } + isRowFocused(rowIndex) { + const focusedCell = this.beans.focusSvc.getFocusCellToUseAfterRefresh(); + if (!focusedCell) { + return false; + } + if (focusedCell.rowPinned != null) { + return false; + } + const hasFocus = focusedCell.rowIndex === rowIndex; + return hasFocus; + } + setViewportDatasource(viewportDatasource) { + this.destroyDatasource(); + this.datasource = viewportDatasource; + this.rowCount = -1; + if (!viewportDatasource.init) { + _warn33(226); + } else { + viewportDatasource.init( + _addGridCommonParams19(this.gos, { + setRowCount: this.setRowCount.bind(this), + setRowData: this.setRowData.bind(this), + getRow: this.getRow.bind(this) + }) + ); + } + } + getType() { + return "viewport"; + } + getRow(rowIndex) { + if (!this.rowNodesByIndex[rowIndex]) { + this.rowNodesByIndex[rowIndex] = this.createBlankRowNode(rowIndex); + } + return this.rowNodesByIndex[rowIndex]; + } + getRowNode(id) { + let result; + this.forEachNode((rowNode) => { + if (rowNode.id === id) { + result = rowNode; + } + }); + return result; + } + getRowCount() { + return this.rowCount === -1 ? 0 : this.rowCount; + } + getRowIndexAtPixel(pixel) { + if (this.rowHeight !== 0) { + return Math.floor(pixel / this.rowHeight); + } + return 0; + } + /** Viewport row model does not support dynamic row heights by design and while it is possible to implement this feature, it leads to view-model desync due to data being not isotropic in time */ + resetRowHeights() { + } + /** Viewport row model does not support dynamic row heights by design and while it is possible to implement this feature, it leads to view-model desync due to data being not isotropic in time */ + onRowHeightChanged() { + } + getRowBounds(index) { + const rowHeight = this.rowHeight; + return { + rowHeight, + rowTop: rowHeight * index + }; + } + updateRowHeights() { + const rowHeight = this.rowHeight; + this.forEachNode((node) => { + node.setRowHeight(rowHeight); + node.setRowTop(rowHeight * node.rowIndex); + }); + this.eventSvc.dispatchEvent({ + type: "modelUpdated", + newData: false, + newPage: false, + keepRenderedRows: true, + animate: false + }); + } + getTopLevelRowCount() { + return this.getRowCount(); + } + getTopLevelRowDisplayedIndex(topLevelIndex) { + return topLevelIndex; + } + isEmpty() { + return this.rowCount > 0; + } + getOverlayType() { + return null; + } + isRowsToRender() { + return this.rowCount > 0; + } + getNodesInRangeForSelection(firstInRange, lastInRange) { + const firstIndex = firstInRange.rowIndex; + const lastIndex = lastInRange.rowIndex; + const firstNodeOutOfRange = firstIndex < this.firstRow || firstIndex > this.lastRow; + const lastNodeOutOfRange = lastIndex < this.firstRow || lastIndex > this.lastRow; + if (firstNodeOutOfRange || lastNodeOutOfRange) { + return []; + } + const result = []; + const startIndex = firstIndex <= lastIndex ? firstIndex : lastIndex; + const endIndex = firstIndex <= lastIndex ? lastIndex : firstIndex; + for (let i = startIndex; i <= endIndex; i++) { + result.push(this.rowNodesByIndex[i]); + } + return result; + } + forEachNode(callback) { + let callbackCount = 0; + for (const indexStr of Object.keys(this.rowNodesByIndex)) { + const index = parseInt(indexStr, 10); + const rowNode = this.rowNodesByIndex[index]; + callback(rowNode, callbackCount); + callbackCount++; + } + } + setRowData(rowData) { + const getRowIdFunc = _getRowIdCallback(this.beans.gos); + const existingNodesById = /* @__PURE__ */ new Map(); + if (getRowIdFunc) { + for (const row of Object.values(this.rowNodesByIndex)) { + existingNodesById.set(row.id, row); + } + } + for (let i = this.firstRow; i <= this.lastRow; i++) { + const data = rowData[i]; + if (!data) { + continue; + } + let rowId; + let row; + if (getRowIdFunc) { + rowId = getRowIdFunc({ data, rowPinned: void 0, level: 0, parentKeys: void 0 }); + row = existingNodesById.get(rowId); + } else { + row = this.rowNodesByIndex[i]; + } + if (row) { + row.updateData(data); + row.setRowIndex(i); + row.setRowTop(this.rowHeight * i); + } else { + row = this.createBlankRowNode(i); + row.setDataAndId(data, rowId ?? i.toString()); + } + this.rowNodesByIndex[i] = row; + } + if (!this.viewportChangedContext) { + this.eventSvc.dispatchEvent({ + type: "modelUpdated", + newData: false, + newPage: false, + keepRenderedRows: true, + animate: false + }); + } + } + createBlankRowNode(rowIndex) { + const rowNode = new RowNode2(this.beans); + const rowHeight = this.rowHeight; + rowNode.setRowHeight(rowHeight); + rowNode.setRowTop(rowHeight * rowIndex); + rowNode.setRowIndex(rowIndex); + return rowNode; + } + setRowCount(rowCount, keepRenderedRows = false) { + if (rowCount === this.rowCount) { + return; + } + this.rowCount = rowCount; + const eventSvc = this.eventSvc; + eventSvc.dispatchEventOnce({ + type: "rowCountReady" + }); + eventSvc.dispatchEvent({ + type: "modelUpdated", + newData: false, + newPage: false, + keepRenderedRows, + animate: false + }); + } + isRowPresent(rowNode) { + const foundRowNode = this.getRowNode(rowNode.id); + return !!foundRowNode; + } +}; + +// packages/ag-grid-enterprise/src/viewportRowModel/viewportRowModelModule.ts +var ViewportRowModelModule = { + moduleName: "ViewportRowModel", + version: VERSION, + rowModels: ["viewport"], + beans: [ViewportRowModel], + dependsOn: [EnterpriseCoreModule] +}; + +// packages/ag-grid-enterprise/src/clipboard/clipboardModule.ts +import { CsvExportModule, HighlightChangesModule, _KeyboardNavigationModule as _KeyboardNavigationModule2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/clipboard/clipboardApi.ts +function copyToClipboard(beans, params) { + beans.clipboardSvc?.copyToClipboard(params); +} +function cutToClipboard(beans, params) { + beans.clipboardSvc?.cutToClipboard(params); +} +function copySelectedRowsToClipboard(beans, params) { + beans.clipboardSvc?.copySelectedRowsToClipboard(params); +} +function copySelectedRangeToClipboard(beans, params) { + beans.clipboardSvc?.copySelectedRangeToClipboard(params); +} +function copySelectedRangeDown(beans) { + beans.clipboardSvc?.copyRangeDown(); +} +function pasteFromClipboard(beans) { + beans.clipboardSvc?.pasteFromClipboard(); +} + +// packages/ag-grid-enterprise/src/clipboard/clipboardService.ts +import { + BeanStub as BeanStub46, + _createCellId as _createCellId2, + _exists as _exists21, + _forEachChangedGroupDepthFirst as _forEachChangedGroupDepthFirst4, + _getActiveDomElement as _getActiveDomElement12, + _getDocument as _getDocument4, + _getRowBelow as _getRowBelow2, + _getRowNode as _getRowNode3, + _isClientSideRowModel as _isClientSideRowModel7, + _isSameRow, + _last as _last11, + _removeFromArray as _removeFromArray6, + _warn as _warn34, + isColumnSelectionCol, + isSpecialCol as isSpecialCol2 +} from "ag-grid-community"; +var SOURCE_PASTE = "paste"; +var EXPORT_TYPE_DRAG_COPY = "dragCopy"; +var EXPORT_TYPE_CLIPBOARD = "clipboard"; +function stringToArray(strData, delimiter = ",") { + const data = []; + const isNewline = (char) => char === "\r" || char === "\n"; + let insideQuotedField = false; + if (strData === "") { + return [[""]]; + } + for (let row = 0, column = 0, position = 0; position < strData.length; position++) { + const previousChar = strData[position - 1]; + const currentChar = strData[position]; + const nextChar = strData[position + 1]; + const ensureDataExists = () => { + if (!data[row]) { + data[row] = []; + } + if (!data[row][column]) { + data[row][column] = ""; + } + }; + ensureDataExists(); + if (currentChar === '"') { + if (insideQuotedField) { + if (nextChar === '"') { + data[row][column] += '"'; + position++; + } else { + insideQuotedField = false; + } + } else if (previousChar === void 0 || previousChar === delimiter || isNewline(previousChar)) { + insideQuotedField = true; + } + } + if (!insideQuotedField && currentChar !== '"') { + if (currentChar === delimiter) { + column++; + ensureDataExists(); + continue; + } else if (isNewline(currentChar)) { + column = 0; + row++; + ensureDataExists(); + if (currentChar === "\r" && nextChar === "\n") { + position++; + } + continue; + } + } + data[row][column] += currentChar; + } + return data; +} +var ClipboardService = class extends BeanStub46 { + constructor() { + super(...arguments); + this.beanName = "clipboardSvc"; + this.clientSideRowModel = null; + this.gridCtrl = null; + this.lastPasteOperationTime = 0; + this.navigatorApiFailed = false; + } + postConstruct() { + const { gos, rowModel, ctrlsSvc } = this.beans; + if (_isClientSideRowModel7(gos, rowModel)) { + this.clientSideRowModel = rowModel; + } + ctrlsSvc.whenReady(this, (p) => { + this.gridCtrl = p.gridCtrl; + }); + } + destroy() { + super.destroy(); + this.clientSideRowModel = null; + this.gridCtrl = null; + } + pasteFromClipboard() { + const allowNavigator = !this.gos.get("suppressClipboardApi"); + if (allowNavigator && !this.navigatorApiFailed && navigator.clipboard?.readText) { + navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((e) => { + _warn34(40, { e, method: "readText" }); + this.navigatorApiFailed = true; + this.pasteFromClipboardLegacy(); + }); + } else { + this.pasteFromClipboardLegacy(); + } + } + pasteFromClipboardLegacy() { + let defaultPrevented = false; + const handlePasteEvent = (e) => { + const currentPastOperationTime = Date.now(); + if (currentPastOperationTime - this.lastPasteOperationTime < 50) { + defaultPrevented = true; + e.preventDefault(); + } + this.lastPasteOperationTime = currentPastOperationTime; + }; + this.executeOnTempElement( + (textArea) => { + textArea.addEventListener("paste", handlePasteEvent); + textArea.focus({ preventScroll: true }); + }, + (element) => { + const data = element.value; + if (!defaultPrevented) { + this.processClipboardData(data); + } else { + this.refocusLastFocusedCell(); + } + element.removeEventListener("paste", handlePasteEvent); + } + ); + } + refocusLastFocusedCell() { + const { focusSvc } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + if (focusedCell) { + focusSvc.setFocusedCell({ + rowIndex: focusedCell.rowIndex, + column: focusedCell.column, + rowPinned: focusedCell.rowPinned, + forceBrowserFocus: true + }); + } + } + getClipboardDelimiter() { + const delimiter = this.gos.get("clipboardDelimiter"); + return _exists21(delimiter) ? delimiter : " "; + } + processClipboardData(data) { + if (data == null) { + return; + } + let parsedData = stringToArray(data, this.getClipboardDelimiter()); + const userFunc = this.gos.getCallback("processDataFromClipboard"); + if (userFunc) { + parsedData = userFunc({ data: parsedData }); + } + if (parsedData == null) { + return; + } + if (this.gos.get("suppressLastEmptyLineOnPaste")) { + this.removeLastLineIfBlank(parsedData); + } + const { rangeSvc, editSvc } = this.beans; + const pasteOperation = (cellsToFlash, updatedRowNodes, focusedCell, changedPath) => { + const rangeActive = rangeSvc?.isMoreThanOneCell(); + const pasteIntoRange = rangeActive && !this.hasOnlyOneValueToPaste(parsedData); + if (pasteIntoRange) { + this.pasteIntoActiveRange(parsedData, cellsToFlash, updatedRowNodes, changedPath); + } else { + this.pasteStartingFromFocusedCell(parsedData, cellsToFlash, updatedRowNodes, focusedCell, changedPath); + } + editSvc?.stopEditing(void 0, { source: SOURCE_PASTE }); + }; + this.doPasteOperation(pasteOperation); + } + // common code to paste operations, e.g. paste to cell, paste to range, and copy range down + doPasteOperation(pasteOperationFunc) { + const source = "clipboard"; + const { eventSvc, focusSvc, rowRenderer, gos } = this.beans; + eventSvc.dispatchEvent({ + type: "pasteStart", + source + }); + const { clientSideRowModel } = this; + const rootNode = clientSideRowModel?.rootNode; + const changedPath = rootNode && this.beans.changedPathFactory?.newPath(gos.get("aggregateOnlyChangedColumns")); + const cellsToFlash = {}; + const updatedRowNodes = []; + const focusedCell = focusSvc.getFocusedCell(); + pasteOperationFunc(cellsToFlash, updatedRowNodes, focusedCell, changedPath); + const nodesToRefresh = updatedRowNodes.slice(); + if (changedPath) { + clientSideRowModel.doAggregate(changedPath); + _forEachChangedGroupDepthFirst4(rootNode, clientSideRowModel.hierarchical, changedPath, (rowNode) => { + nodesToRefresh.push(rowNode); + }); + } + rowRenderer.refreshCells({ rowNodes: nodesToRefresh }); + this.dispatchFlashCells(cellsToFlash); + this.fireRowChanged(updatedRowNodes); + this.refocusLastFocusedCell(); + eventSvc.dispatchEvent({ + type: "pasteEnd", + source + }); + } + getPreProcessRangeCallback(clipboardData) { + return (cellRange) => { + const { rangeSvc } = this.beans; + if (!rangeSvc) { + return; + } + const { rowDiff, colDiff } = this.getAdjustedRangeDimensionForPaste(cellRange, clipboardData); + if (rowDiff !== 0) { + rangeSvc.extendRangeRowCountBy(cellRange, rowDiff); + } + if (colDiff !== 0) { + rangeSvc.extendRangeColumnCountBy(cellRange, colDiff); + } + }; + } + getAdjustedRangeDimensionForPaste(cellRange, clipboardData) { + const rangeSvc = this.beans.rangeSvc; + const clipboardRowCount = clipboardData.length; + const rangeRowCount = rangeSvc.getRangeRowCount(cellRange); + const isRowMultiple = rangeRowCount >= clipboardRowCount && rangeRowCount % clipboardRowCount === 0; + const clipboardColCount = clipboardData[0].length; + const rangeColCount = cellRange.columns.length; + const isColMultiple = rangeColCount >= clipboardColCount && rangeColCount % clipboardColCount === 0; + return { + rowDiff: isRowMultiple ? 0 : clipboardRowCount - rangeRowCount, + colDiff: isColMultiple ? 0 : clipboardColCount - rangeColCount + }; + } + pasteIntoActiveRange(clipboardData, cellsToFlash, updatedRowNodes, changedPath) { + let indexOffset = 0; + let dataRowIndex = 0; + const rowCallback = (currentRow, rowNode, range, rangeIndex) => { + const atEndOfClipboardData = rangeIndex - indexOffset >= clipboardData.length; + if (atEndOfClipboardData) { + if (rangeIndex % clipboardData.length !== 0) { + return; + } + indexOffset += dataRowIndex; + dataRowIndex = 0; + } + const currentRowData = clipboardData[rangeIndex - indexOffset]; + updatedRowNodes.push(rowNode); + const processCellFromClipboardFunc = this.gos.getCallback("processCellFromClipboard"); + const columns = range.columns; + const selectionColIdx = columns.findIndex(isColumnSelectionCol); + if (selectionColIdx !== -1) { + columns.splice(selectionColIdx, 1); + } + for (let idx = 0; idx < columns.length; idx++) { + const column = columns[idx]; + if (!column.isCellEditable(rowNode) || column.isSuppressPaste(rowNode)) { + continue; + } + let calculatedIdx = idx; + if (idx >= currentRowData.length) { + calculatedIdx = idx % currentRowData.length; + } + const newValue = this.processCell( + rowNode, + column, + currentRowData[calculatedIdx], + EXPORT_TYPE_DRAG_COPY, + processCellFromClipboardFunc, + true + ); + rowNode.setDataValue(column, newValue, SOURCE_PASTE); + changedPath?.addCell(rowNode.parent, column.getId()); + const { rowIndex, rowPinned } = currentRow; + const cellId = _createCellId2({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + } + dataRowIndex++; + }; + this.iterateActiveRanges(rowCallback, false, this.getPreProcessRangeCallback(clipboardData)); + } + getDisplayedColumnsStartingAt(column) { + let currentColumn = column; + const columns = []; + const { visibleCols } = this.beans; + while (currentColumn && isSpecialCol2(currentColumn)) { + currentColumn = visibleCols.getColAfter(currentColumn); + } + while (currentColumn != null) { + columns.push(currentColumn); + currentColumn = visibleCols.getColAfter(currentColumn); + } + return columns; + } + pasteStartingFromFocusedCell(parsedData, cellsToFlash, updatedRowNodes, focusedCell, changedPath) { + if (!focusedCell) { + return; + } + const currentRow = { rowIndex: focusedCell.rowIndex, rowPinned: focusedCell.rowPinned }; + const columnsToPasteInto = this.getDisplayedColumnsStartingAt(focusedCell.column); + if (this.isPasteSingleValueIntoRange(parsedData)) { + this.pasteSingleValueIntoRange(parsedData, updatedRowNodes, cellsToFlash, changedPath); + } else { + this.pasteMultipleValues( + parsedData, + currentRow, + updatedRowNodes, + columnsToPasteInto, + cellsToFlash, + EXPORT_TYPE_CLIPBOARD, + changedPath + ); + } + } + // if range is active, and only one cell, then we paste this cell into all cells in the active range. + isPasteSingleValueIntoRange(parsedData) { + const rangeSvc = this.beans.rangeSvc; + return this.hasOnlyOneValueToPaste(parsedData) && !!rangeSvc && !rangeSvc.isEmpty(); + } + pasteSingleValueIntoRange(parsedData, updatedRowNodes, cellsToFlash, changedPath) { + const value = parsedData[0][0]; + const rowCallback = (currentRow, rowNode, range) => { + updatedRowNodes.push(rowNode); + range.columns.forEach( + (column) => this.updateCellValue(rowNode, column, value, cellsToFlash, EXPORT_TYPE_CLIPBOARD, changedPath) + ); + }; + this.iterateActiveRanges(rowCallback); + } + hasOnlyOneValueToPaste(parsedData) { + return parsedData.length === 1 && parsedData[0].length === 1; + } + copyRangeDown() { + const { rangeSvc, gos, formula, valueSvc } = this.beans; + if (!rangeSvc || rangeSvc.isEmpty()) { + return; + } + const firstRowValues = []; + const pasteOperation = (cellsToFlash, updatedRowNodes, focusedCell, changedPath) => { + const processCellForClipboardFunc = gos.getCallback("processCellForClipboard"); + const processCellFromClipboardFunc = gos.getCallback("processCellFromClipboard"); + const rowCallback = (currentRow, rowNode, range) => { + const { columns } = range; + if (!firstRowValues.length) { + columns.forEach((column) => { + const value = this.processCell( + rowNode, + column, + valueSvc.getValue(column, rowNode, "batch"), + EXPORT_TYPE_DRAG_COPY, + processCellForClipboardFunc, + false, + true + ); + firstRowValues.push(value); + }); + } else { + updatedRowNodes.push(rowNode); + columns.forEach((column, index) => { + if (!column.isCellEditable(rowNode) || column.isSuppressPaste(rowNode)) { + return; + } + const isFormula = column.isAllowFormula() && formula?.isFormula(firstRowValues[index]); + if (isFormula) { + firstRowValues[index] = formula?.updateFormulaByOffset({ + value: firstRowValues[index], + rowDelta: 1 + }); + } + const firstRowValue = this.processCell( + rowNode, + column, + firstRowValues[index], + EXPORT_TYPE_DRAG_COPY, + processCellFromClipboardFunc, + true + ); + rowNode.setDataValue(column, firstRowValue, SOURCE_PASTE); + changedPath?.addCell(rowNode.parent, column.getId()); + const { rowIndex, rowPinned } = currentRow; + const cellId = _createCellId2({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + }); + } + }; + this.iterateActiveRanges(rowCallback, true); + }; + this.doPasteOperation(pasteOperation); + } + removeLastLineIfBlank(parsedData) { + const lastLine = _last11(parsedData); + const lastLineIsBlank = lastLine && lastLine.length === 1 && lastLine[0] === ""; + if (lastLineIsBlank) { + if (parsedData.length === 1) { + return; + } + _removeFromArray6(parsedData, lastLine); + } + } + fireRowChanged(rowNodes) { + if (this.gos.get("editType") !== "fullRow") { + return; + } + for (const rowNode of rowNodes) { + this.eventSvc.dispatchEvent({ + type: "rowValueChanged", + node: rowNode, + data: rowNode.data, + rowIndex: rowNode.rowIndex, + rowPinned: rowNode.rowPinned + }); + } + } + /** Returns true when a row should be skipped during paste. */ + shouldSkipPasteRow(row, columns, skipGroupRows) { + if (row.detail || row.footer) { + return true; + } + if (skipGroupRows && row.group) { + for (const col of columns) { + if (col.isCellEditable(row)) { + return false; + } + } + return true; + } + return false; + } + pasteMultipleValues(clipboardGridData, currentRow, updatedRowNodes, columnsToPasteInto, cellsToFlash, type, changedPath) { + let rowPointer = currentRow; + const beans = this.beans; + const { gos } = beans; + const skipGroupRows = this.clientSideRowModel != null && !gos.get("enableGroupEdit") && !gos.get("treeData"); + const getNextGoodRowNode = () => { + while (rowPointer) { + const res = _getRowNode3(beans, rowPointer); + rowPointer = _getRowBelow2(beans, { + rowPinned: rowPointer.rowPinned, + rowIndex: rowPointer.rowIndex + }); + if (res != null && !this.shouldSkipPasteRow(res, columnsToPasteInto, skipGroupRows)) { + return res; + } + } + return null; + }; + for (const clipboardRowData of clipboardGridData) { + const rowNode = getNextGoodRowNode(); + if (!rowNode) { + continue; + } + clipboardRowData.forEach( + (value, index) => this.updateCellValue(rowNode, columnsToPasteInto[index], value, cellsToFlash, type, changedPath) + ); + updatedRowNodes.push(rowNode); + } + } + updateCellValue(rowNode, column, value, cellsToFlash, type, changedPath) { + if (!rowNode || !column?.isCellEditable(rowNode) || column?.isSuppressPaste(rowNode)) { + return; + } + const processedValue = this.processCell( + rowNode, + column, + value, + type, + this.gos.getCallback("processCellFromClipboard"), + true + ); + rowNode.setDataValue(column, processedValue, SOURCE_PASTE); + const { rowIndex, rowPinned } = rowNode; + const cellId = _createCellId2({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + changedPath?.addCell(rowNode.parent, column.getId()); + } + copyToClipboard(params = {}) { + this.copyOrCutToClipboard(params); + } + cutToClipboard(params = {}, source = "api") { + if (this.gos.get("suppressCutToClipboard")) { + return; + } + this.eventSvc.dispatchEvent({ + type: "cutStart", + source + }); + this.copyOrCutToClipboard(params, true); + this.eventSvc.dispatchEvent({ + type: "cutEnd", + source + }); + } + copyOrCutToClipboard(params, cut) { + let { includeHeaders, includeGroupHeaders } = params; + const { gos, focusSvc } = this.beans; + if (includeHeaders == null) { + includeHeaders = gos.get("copyHeadersToClipboard"); + } + if (includeGroupHeaders == null) { + includeGroupHeaders = gos.get("copyGroupHeadersToClipboard"); + } + const copyParams = { includeHeaders, includeGroupHeaders }; + const rowSelection = gos.get("rowSelection"); + const cellSelection = gos.get("cellSelection"); + let cellClearType = null; + if (this.shouldCopyCells(cellSelection, rowSelection)) { + this.copySelectedRangeToClipboard(copyParams); + cellClearType = 0 /* CellRange */; + } else if (this.shouldCopyRows(rowSelection)) { + this.copySelectedRowsToClipboard(copyParams); + cellClearType = 1 /* SelectedRows */; + } else if (focusSvc.isAnyCellFocused()) { + this.copyFocusedCellToClipboard(copyParams); + cellClearType = 2 /* FocusedCell */; + } + if (cut && cellClearType !== null) { + this.clearCellsAfterCopy(cellClearType); + } + } + shouldCopyCells(cellSelection, rowSelection) { + const { rangeSvc, selectionSvc, gos } = this.beans; + if (!rangeSvc || rangeSvc.isEmpty()) { + return false; + } + if (cellSelection) { + const shouldCopyRowsInstead = typeof rowSelection === "object" && rowSelection.copySelectedRows && !selectionSvc?.isEmpty(); + return !shouldCopyRowsInstead; + } else { + const suppressCopySingleCellRanges = gos.get("suppressCopySingleCellRanges"); + const shouldSkip = !rangeSvc.isMoreThanOneCell() && suppressCopySingleCellRanges; + return !shouldSkip; + } + } + shouldCopyRows(rowSelection) { + const { selectionSvc, gos } = this.beans; + if (selectionSvc?.isEmpty() ?? true) { + return false; + } + if (rowSelection && typeof rowSelection !== "string") { + return rowSelection.copySelectedRows ?? false; + } else { + return !gos.get("suppressCopyRowsToClipboard"); + } + } + clearCellsAfterCopy(type) { + const beans = this.beans; + const { rangeSvc, focusSvc, eventSvc } = beans; + eventSvc.dispatchEvent({ type: "keyShortcutChangedCellStart" }); + if (type === 0 /* CellRange */) { + rangeSvc.clearCellRangeCellValues({ cellEventSource: "clipboardSvc" }); + } else if (type === 1 /* SelectedRows */) { + this.clearSelectedRows(); + } else { + const focusedCell = focusSvc.getFocusedCell(); + if (focusedCell == null) { + return; + } + const rowNode = _getRowNode3(beans, focusedCell); + if (rowNode) { + this.clearCellValue(rowNode, focusedCell.column); + } + } + eventSvc.dispatchEvent({ type: "keyShortcutChangedCellEnd" }); + } + clearSelectedRows() { + const { selectionSvc, visibleCols } = this.beans; + const selected = selectionSvc?.getSelectedNodes() ?? []; + const columns = visibleCols.allCols; + for (const row of selected) { + for (const col of columns) { + this.clearCellValue(row, col); + } + } + } + clearCellValue(rowNode, column) { + if (!column.isCellEditable(rowNode)) { + return; + } + const deleteValue = this.beans.valueSvc.getDeleteValue(column, rowNode); + rowNode.setDataValue(column, deleteValue, "clipboardSvc"); + } + iterateActiveRanges(rowCallback, onlyFirst, preProcessRange) { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc || rangeSvc.isEmpty()) { + return; + } + const currentCellRanges = rangeSvc.getCellRanges(); + const cellRanges = onlyFirst ? [currentCellRanges[0]] : currentCellRanges; + for (const cellRange of cellRanges) { + this.iterateActiveRange({ cellRange, rowCallback, preProcessRange }); + } + } + iterateActiveRange(params) { + const { cellRange, preProcessRange, rowCallback } = params; + const { beans } = this; + const { rangeSvc } = beans; + if (!rangeSvc) { + return; + } + if (preProcessRange) { + preProcessRange(cellRange); + } + let currentRow = rangeSvc.getRangeStartRow(cellRange); + const lastRow = rangeSvc.getRangeEndRow(cellRange); + let rangeIndex = 0; + let isLastRow = false; + while (!isLastRow && currentRow != null) { + const rowNode = _getRowNode3(beans, currentRow); + isLastRow = _isSameRow(currentRow, lastRow); + rowCallback(currentRow, rowNode, cellRange, rangeIndex++); + currentRow = _getRowBelow2(beans, currentRow); + } + } + copySelectedRangeToClipboard(params = {}) { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc || rangeSvc.isEmpty()) { + return; + } + const allRangesMerge = rangeSvc.areAllRangesAbleToMerge(); + const { data, cellsToFlash } = allRangesMerge ? this.buildDataFromMergedRanges(rangeSvc, params) : this.buildDataFromRanges(rangeSvc, params); + this.copyDataToClipboard(data); + this.dispatchFlashCells(cellsToFlash); + } + buildDataFromMergedRanges(rangeSvc, params) { + const columnsSet = /* @__PURE__ */ new Set(); + const ranges = rangeSvc.getCellRanges(); + const rowPositionsMap = /* @__PURE__ */ new Map(); + const allRowPositions = []; + const allCellsToFlash = {}; + const isClientSideRowModel = _isClientSideRowModel7(this.gos, this.beans.rowModel); + const flatCache = /* @__PURE__ */ new Set(); + if (!isClientSideRowModel) { + this.beans.rowModel.forEachNode((node) => { + flatCache.add(node.rowIndex); + }); + } + for (const range of ranges) { + range.columns.forEach((col) => columnsSet.add(col)); + const { rowPositions, cellsToFlash } = this.getRangeRowPositionsAndCellsToFlash(rangeSvc, range); + for (const rowPosition of rowPositions) { + const isInCache = flatCache.has(rowPosition.rowIndex); + if (!isClientSideRowModel && !isInCache) { + continue; + } + const rowPositionAsString = `${rowPosition.rowIndex}-${rowPosition.rowPinned || "null"}`; + if (!rowPositionsMap.get(rowPositionAsString)) { + rowPositionsMap.set(rowPositionAsString, true); + allRowPositions.push(rowPosition); + } + } + Object.assign(allCellsToFlash, cellsToFlash); + } + const allColumns = this.beans.visibleCols.allCols; + const exportedColumns = Array.from(columnsSet); + exportedColumns.sort((a, b) => { + const posA = allColumns.indexOf(a); + const posB = allColumns.indexOf(b); + return posA - posB; + }); + const data = this.buildExportParams({ + columns: exportedColumns, + rowPositions: allRowPositions, + includeHeaders: params.includeHeaders, + includeGroupHeaders: params.includeGroupHeaders + }); + return { data, cellsToFlash: allCellsToFlash }; + } + buildDataFromRanges(rangeSvc, params) { + const ranges = rangeSvc.getCellRanges(); + const data = []; + const allCellsToFlash = {}; + for (const range of ranges) { + const { rowPositions, cellsToFlash } = this.getRangeRowPositionsAndCellsToFlash(rangeSvc, range); + Object.assign(allCellsToFlash, cellsToFlash); + data.push( + this.buildExportParams({ + columns: range.columns, + rowPositions, + includeHeaders: params.includeHeaders, + includeGroupHeaders: params.includeGroupHeaders + }) + ); + } + return { data: data.join("\n"), cellsToFlash: allCellsToFlash }; + } + getRangeRowPositionsAndCellsToFlash(rangeSvc, range) { + const rowPositions = []; + const cellsToFlash = {}; + const startRow = rangeSvc.getRangeStartRow(range); + const lastRow = rangeSvc.getRangeEndRow(range); + let node = startRow; + while (node) { + rowPositions.push(node); + for (const column of range.columns) { + const { rowIndex, rowPinned } = node; + const cellId = _createCellId2({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + } + if (_isSameRow(node, lastRow)) { + break; + } + node = _getRowBelow2(this.beans, node); + } + return { rowPositions, cellsToFlash }; + } + getCellsToFlashFromRowNodes(rowNodes) { + const allDisplayedColumns = this.beans.visibleCols.allCols; + const cellsToFlash = {}; + for (let i = 0; i < rowNodes.length; i++) { + const { level, rowIndex: index, rowPinned, sibling } = rowNodes[i]; + const rowIndex = level === -1 ? sibling.rowIndex : index; + if (rowIndex == null) { + continue; + } + for (let j = 0; j < allDisplayedColumns.length; j++) { + const column = allDisplayedColumns[j]; + const cellId = _createCellId2({ rowIndex, column, rowPinned }); + cellsToFlash[cellId] = true; + } + } + return cellsToFlash; + } + copyFocusedCellToClipboard(params = {}) { + let focusedCell = this.beans.focusSvc.getFocusedCell(); + if (focusedCell == null) { + return; + } + focusedCell = this.beans.rowSpanSvc?.getCellStart(focusedCell) ?? focusedCell; + const cellId = _createCellId2(focusedCell); + const currentRow = { rowPinned: focusedCell.rowPinned, rowIndex: focusedCell.rowIndex }; + const column = focusedCell.column; + const data = this.buildExportParams({ + columns: [column], + rowPositions: [currentRow], + includeHeaders: params.includeHeaders, + includeGroupHeaders: params.includeGroupHeaders + }); + this.copyDataToClipboard(data); + this.dispatchFlashCells({ [cellId]: true }); + } + copySelectedRowsToClipboard(params = {}) { + const { columnKeys, includeHeaders, includeGroupHeaders } = params; + const data = this.buildExportParams({ + columns: columnKeys, + includeHeaders, + includeGroupHeaders + }); + this.copyDataToClipboard(data); + const rowNodes = this.beans.selectionSvc?.getSelectedNodes() || []; + this.dispatchFlashCells(this.getCellsToFlashFromRowNodes(rowNodes)); + } + buildExportParams(params) { + const { columns, rowPositions, includeHeaders = false, includeGroupHeaders = false } = params; + const { gos, csvCreator } = this.beans; + const processRowGroupCallback = ({ node, column }) => { + const { value, valueFormatted } = this.beans.valueSvc.getValueForDisplay({ + column, + node, + includeValueFormatted: true, + from: "batch" + }); + const val = valueFormatted ?? value ?? ""; + const cb = gos.getCallback("processCellForClipboard"); + if (!cb) { + return val; + } + return cb({ + column, + node, + value: val, + type: EXPORT_TYPE_CLIPBOARD, + formatValue: (valueToFormat) => this.beans.valueSvc.formatValue(column, node, valueToFormat) ?? valueToFormat, + parseValue: (valueToParse) => this.beans.valueSvc.parseValue(column, node, valueToParse, value) ?? valueToParse + }); + }; + const exportParams = { + columnKeys: columns, + rowPositions, + skipColumnHeaders: !includeHeaders, + skipColumnGroupHeaders: !includeGroupHeaders, + suppressQuotes: true, + columnSeparator: this.getClipboardDelimiter(), + onlySelected: !rowPositions, + valueFrom: "batch", + processCellCallback: gos.getCallback("processCellForClipboard"), + processRowGroupCallback, + processHeaderCallback: gos.getCallback("processHeaderForClipboard"), + processGroupHeaderCallback: gos.getCallback("processGroupHeaderForClipboard") + }; + return csvCreator.getDataAsCsv(exportParams, true); + } + // eslint-disable-next-line @typescript-eslint/ban-types + dispatchFlashCells(cellsToFlash) { + window.setTimeout(() => { + this.eventSvc.dispatchEvent({ + type: "flashCells", + cells: cellsToFlash + }); + }, 0); + } + processCell(rowNode, column, value, type, func, canParse, canFormat) { + const { valueSvc, formula } = this.beans; + if (func) { + const params = { + column, + node: rowNode, + value, + type, + formatValue: (valueToFormat) => valueSvc.formatValue(column, rowNode ?? null, valueToFormat) ?? valueToFormat, + parseValue: (valueToParse) => valueSvc.parseValue( + column, + rowNode ?? null, + valueToParse, + valueSvc.getValue(column, rowNode, "edit") + ) + }; + return func(params); + } + if (canParse && column.getColDef().useValueParserForImport !== false) { + return valueSvc.parseValue(column, rowNode ?? null, value, valueSvc.getValue(column, rowNode, "edit")); + } + if (canFormat && column.getColDef().useValueFormatterForExport !== false) { + if (formula?.isFormula(value)) { + return value; + } + return valueSvc.formatValue(column, rowNode ?? null, value) ?? value; + } + return value; + } + copyDataToClipboard(data) { + const userProvidedFunc = this.gos.getCallback("sendToClipboard"); + if (userProvidedFunc) { + userProvidedFunc({ data }); + return; + } + const allowNavigator = !this.gos.get("suppressClipboardApi"); + if (allowNavigator && navigator.clipboard) { + navigator.clipboard.writeText(data).catch((e) => { + _warn34(40, { e, method: "writeText" }); + this.copyDataToClipboardLegacy(data); + }); + return; + } + this.copyDataToClipboardLegacy(data); + } + copyDataToClipboardLegacy(data) { + this.executeOnTempElement((element) => { + const eDocument = _getDocument4(this.beans); + const focusedElementBefore = _getActiveDomElement12(this.beans); + element.value = data || " "; + element.select(); + element.focus({ preventScroll: true }); + const result = eDocument.execCommand("copy"); + if (!result) { + _warn34(41); + } + if (focusedElementBefore?.focus != null) { + focusedElementBefore.focus({ preventScroll: true }); + } + }); + } + executeOnTempElement(callbackNow, callbackAfter) { + if (!this.gridCtrl) { + return; + } + const eDoc = _getDocument4(this.beans); + const eTempInput = eDoc.createElement("textarea"); + const style = eTempInput.style; + style.width = "1px"; + style.height = "1px"; + const documentElement = eDoc.documentElement; + style.top = documentElement.scrollTop + "px"; + style.left = documentElement.scrollLeft + "px"; + style.position = "absolute"; + style.opacity = "0"; + const guiRoot = this.gridCtrl.getGui(); + guiRoot.appendChild(eTempInput); + try { + callbackNow(eTempInput); + } catch (err) { + _warn34(42); + } + if (callbackAfter) { + window.setTimeout(() => { + callbackAfter(eTempInput); + eTempInput.remove(); + }, 100); + } else { + eTempInput.remove(); + } + } +}; + +// packages/ag-grid-enterprise/src/clipboard/clipboardModule.ts +var ClipboardModule = { + moduleName: "Clipboard", + version: VERSION, + beans: [ClipboardService], + apiFunctions: { + copyToClipboard, + cutToClipboard, + copySelectedRowsToClipboard, + copySelectedRangeToClipboard, + copySelectedRangeDown, + pasteFromClipboard + }, + dependsOn: [EnterpriseCoreModule, CsvExportModule, _KeyboardNavigationModule2, HighlightChangesModule] +}; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersModule.ts +import { CellStyleModule, _SharedDragAndDropModule as _SharedDragAndDropModule4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbers.css +var rowNumbers_default = '.ag-row-number-cell{background-color:var(--ag-header-background-color);border:none;color:var(--ag-header-text-color);font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;white-space:nowrap;width:100%}:where(.ag-ltr) .ag-row-number-cell{text-align:right}:where(.ag-rtl) .ag-row-number-cell{text-align:left}.ag-row-numbers-resizer{bottom:-2px;cursor:ns-resize;height:4px;position:absolute;width:100%}:where(.ag-ltr) .ag-row-numbers-resizer{left:0}:where(.ag-rtl) .ag-row-numbers-resizer{right:0}.ag-floating-bottom .ag-row-numbers-resizer{bottom:unset;top:-2px}:where(.ag-row-number-header.ag-row-number-selection-enabled){cursor:cell}.ag-row-number-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-row-number-range-selected{background-color:var(--ag-row-numbers-selected-color)}:where(.ag-ltr){.ag-row-number-header,:where(.ag-cell.ag-row-number-cell):not(.ag-cell-last-left-pinned){border-right:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik0zLjQ0NSA4LjkxMVY3LjQwOUg5Ljc1VjYuMDE0bDIuNTM1IDIuMTQ2LTIuNTM1IDIuMTQ2VjguOTExeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}:where(.ag-rtl){.ag-row-number-header,:where(.ag-cell.ag-row-number-cell):not(.ag-cell-first-right-pinned){border-left:var(--ag-pinned-column-border)}:where(.ag-cell.ag-row-number-cell.ag-row-number-selection-enabled){cursor:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHhtbDpzcGFjZT0icHJlc2VydmUiIHdpZHRoPSIxNiIgaGVpZ2h0PSIxNiIgc3R5bGU9ImZpbGwtcnVsZTpldmVub2RkO2NsaXAtcnVsZTpldmVub2RkO3N0cm9rZS1saW5lY2FwOnJvdW5kO3N0cm9rZS1saW5lam9pbjpyb3VuZDtzdHJva2UtbWl0ZXJsaW1pdDoxLjUiPjxwYXRoIGQ9Ik01Ljk3OSA4LjkxMXYxLjM5NUwzLjQ0NSA4LjE2bDIuNTM0LTIuMTQ2djEuMzk1aDYuMzA2djEuNTAyeiIgc3R5bGU9InN0cm9rZTojZmZmO3N0cm9rZS13aWR0aDouNDFweCIgdHJhbnNmb3JtPSJtYXRyaXgoMS41Nzg0IDAgMCAxLjg2NDI5IC00LjQxMyAtNy4yMTIpIi8+PC9zdmc+"),auto}}'; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersRowResizer.ts +import { Component as Component40, Direction, _getRowNode as _getRowNode4 } from "ag-grid-community"; +var RowNumbersRowResizerElement = { + tag: "div", + cls: "ag-row-numbers-resizer" +}; +var AgRowNumbersRowResizer = class extends Component40 { + constructor(cellCtrl) { + super(RowNumbersRowResizerElement); + this.cellCtrl = cellCtrl; + this.initialYPosition = -1; + this.dragging = false; + } + postConstruct() { + const { beans, cellCtrl } = this; + const { dragSvc, environment } = beans; + this.defaultRowHeight = environment.getDefaultRowHeight(); + dragSvc.addDragSource({ + dragStartPixels: 0, + eElement: this.getGui(), + onDragStart: this.onDragStart.bind(this), + onDragging: this.onDragging.bind(this), + onDragStop: this.onDragStop.bind(this), + onDragCancel: this.onDragCancel.bind(this), + includeTouch: true, + stopPropagationForTouch: true + }); + const rowPosition = cellCtrl.getRowPosition(); + this.node = _getRowNode4(this.beans, rowPosition); + } + onDragStart(mouseEvent) { + if (!this.node) { + return; + } + const { + beans: { ctrlsSvc, eventSvc } + } = this; + const ctrl = ctrlsSvc.get("gridCtrl"); + ctrl.setResizeCursor(Direction.Vertical); + this.dragging = true; + this.initialHeight = this.node.rowHeight; + eventSvc.dispatchEvent({ + type: "rowResizeStarted", + node: this.node, + event: mouseEvent, + rowHeight: this.initialHeight + }); + } + onDragging(mouseEvent) { + let { clientY } = mouseEvent; + if (this.cellCtrl.rowNode.rowPinned === "bottom") { + clientY *= -1; + } + if (this.initialYPosition === -1 || !this.dragging) { + this.initialYPosition = clientY; + return; + } + const { beans, initialHeight, initialYPosition, defaultRowHeight, node } = this; + if (initialHeight == null) { + return; + } + const currentSize = node?.rowHeight; + const newSize = Math.max(initialHeight - (initialYPosition - clientY), defaultRowHeight); + if (currentSize === newSize) { + return; + } + node?.setRowHeight(newSize); + const { rowRenderer, rowModel, pinnedRowModel } = beans; + const pinned = !!node?.rowPinned; + if (pinned) { + rowRenderer.redraw({ afterScroll: true }); + } + if (!pinned || pinnedRowModel?.isManual()) { + rowModel.onRowHeightChanged({ animate: false }); + } + } + onDragStop(mouseEvent) { + this.beans.eventSvc.dispatchEvent({ + type: "rowResizeEnded", + node: this.node, + event: mouseEvent, + rowHeight: this.node?.rowHeight + }); + this.clearDragDetails(true); + } + onDragCancel() { + this.clearDragDetails(true); + } + clearDragDetails(fromDragEvent) { + this.initialYPosition = -1; + this.initialHeight = null; + this.dragging = false; + if (fromDragEvent) { + const ctrl = this.beans.ctrlsSvc.get("gridCtrl"); + ctrl.setResizeCursor(false); + } + } + destroy() { + this.clearDragDetails(false); + this.node = void 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersService.ts +import { + AgColumn as AgColumn3, + BeanStub as BeanStub47, + KeyCode as KeyCode29, + ROW_NUMBERS_COLUMN_ID, + _addGridCommonParams as _addGridCommonParams20, + _applyColumnState as _applyColumnState3, + _areColIdsEqual as _areColIdsEqual3, + _convertColumnEventSourceType as _convertColumnEventSourceType2, + _createElement as _createElement13, + _debounce as _debounce4, + _destroyColumnTree as _destroyColumnTree3, + _getColumnStateFromColDef as _getColumnStateFromColDef2, + _getFirstRow, + _getRowNode as _getRowNode5, + _interpretAsRightClick, + _isRowNumbers as _isRowNumbers2, + _selectAllCells, + _setAriaLabel as _setAriaLabel15, + _updateColsMap as _updateColsMap3, + isRowNumberCol +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersRowResizeFeature.ts +import { _isRowNumbers, _warn as _warn35 } from "ag-grid-community"; +function _isRowNumbersResizerEnabled(beans) { + const rowNumbers = _isRowNumbers(beans); + return !(!rowNumbers || typeof rowNumbers !== "object" || !rowNumbers.enableRowResizer); +} +var RowNumbersRowResizeFeature = class { + constructor(beans, cellCtrl) { + this.beans = beans; + this.cellCtrl = cellCtrl; + } + refreshRowResizer() { + if (!_isRowNumbersResizerEnabled(this.beans) || !this.isRowResizeSupported(this.cellCtrl.rowNode)) { + this.removeRowResizerFromCellComp(); + } else { + this.addResizerToCellComp(); + } + } + isRowResizeSupported(node) { + const { pinnedRowModel, rowModel, visibleCols } = this.beans; + const rowModelModelHasOnRowHeightChanged = !!rowModel.onRowHeightChanged; + if (visibleCols.autoHeightCols.length) { + _warn35(276); + return false; + } + if (node.rowPinned != null) { + return pinnedRowModel?.isManual() ? rowModelModelHasOnRowHeightChanged : true; + } + return rowModelModelHasOnRowHeightChanged; + } + addResizerToCellComp() { + const { beans, cellCtrl } = this; + let { rowResizer } = this; + if (!rowResizer) { + rowResizer = beans.registry.createDynamicBean( + "rowNumberRowResizer", + false, + cellCtrl + ); + if (!rowResizer) { + return; + } + this.rowResizer = beans.context.createBean(rowResizer); + } + cellCtrl.comp.setRowResizerElement(rowResizer.getGui()); + } + removeRowResizerFromCellComp() { + const { + rowResizer, + beans: { context }, + cellCtrl + } = this; + if (!rowResizer) { + return; + } + cellCtrl.comp?.setRowResizerElement(null); + this.rowResizer = context.destroyBean(rowResizer); + } + destroy() { + this.removeRowResizerFromCellComp(); + } +}; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersService.ts +var RowNumbersService = class extends BeanStub47 { + constructor() { + super(...arguments); + this.beanName = "rowNumbersSvc"; + this.isIntegratedWithSelection = false; + this.lastColumnResized = 0; + } + postConstruct() { + const refreshCells_debounced = _debounce4(this, this.refreshCells.bind(this), 10); + this.addManagedEventListeners({ + columnResized: () => { + this.lastColumnResized = Date.now(); + }, + cellFocused: this.onGridCellFocused.bind(this), + modelUpdated: (params) => { + refreshCells_debounced(false, !params.keepRenderedRows); + }, + rangeSelectionChanged: () => this.refreshCells(true), + pinnedRowsChanged: () => refreshCells_debounced(false, true) + }); + this.addManagedPropertyListeners(["rowNumbers", "cellSelection"], (e) => { + this.updateColumns(e); + }); + this.refreshSelectionIntegration(); + this.registerRangeSelectionExtension(); + } + shouldSkipColumn(column) { + return _isRowNumbers2(this.beans) && isRowNumberCol(column); + } + isAllColumnsSelectionCell(cellPosition) { + return _isRowNumbers2(this.beans) && isRowNumberCol(cellPosition.column); + } + isAllColumnsRange(range, allColumns) { + if (!_isRowNumbers2(this.beans) || allColumns.length === 0) { + return false; + } + return range.columns.length === allColumns.length && allColumns.every((column) => range.columns.includes(column)); + } + registerRangeSelectionExtension() { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc) { + return; + } + rangeSvc.registerRangeSelectionExtension(this); + this.addDestroyFunc(() => rangeSvc.unregisterRangeSelectionExtension?.(this)); + } + addColumns(cols) { + if (this.columns == null) { + return; + } + cols.list = this.columns.list.concat(cols.list); + cols.tree = this.columns.tree.concat(cols.tree); + _updateColsMap3(cols); + } + createColumns(cols, updateOrders) { + const destroyCollection = () => { + _destroyColumnTree3(this.beans, this.columns?.tree); + this.columns = null; + }; + const { beans } = this; + if (!_isRowNumbers2(beans)) { + destroyCollection(); + return; + } + const newTreeDepth = cols.treeDepth; + const oldTreeDepth = this.columns?.treeDepth ?? -1; + const treeDepthSame = oldTreeDepth == newTreeDepth; + const list = this.generateRowNumberCols(); + const areSame = _areColIdsEqual3(list, this.columns?.list ?? []); + if (areSame && treeDepthSame) { + return; + } + destroyCollection(); + const { colGroupSvc } = this.beans; + const treeDepth = colGroupSvc?.findDepth(cols.tree) ?? 0; + const tree = colGroupSvc?.balanceTreeForAutoCols(list, treeDepth) ?? []; + this.columns = { + list, + tree, + treeDepth, + map: {} + }; + const putRowNumbersColsFirstInList = (cols2) => { + if (!cols2) { + return null; + } + const colsFiltered = cols2.filter((col) => !isRowNumberCol(col)); + return [...list, ...colsFiltered]; + }; + updateOrders(putRowNumbersColsFirstInList); + } + handleMouseDownOnCell(cellPosition, mouseEvent) { + if (!this.isIntegratedWithSelection || mouseEvent.target.classList.contains("ag-row-numbers-resizer")) { + if (this.beans.rangeSvc) { + mouseEvent.preventDefault(); + } + mouseEvent.stopImmediatePropagation(); + return false; + } + if (!mouseEvent.shiftKey && !_interpretAsRightClick(this.beans, mouseEvent)) { + this.focusFirstRenderedCellAtRowPosition(cellPosition); + } + return true; + } + handleKeyDownOnCell(cellPosition, event) { + if (!this.isIntegratedWithSelection) { + return false; + } + if (event.key === KeyCode29.ENTER) { + this.selectRowCells(cellPosition, event); + event.preventDefault(); + return true; + } + return false; + } + selectRowCells(cellPosition, keyboardEvent) { + const { rangeSvc } = this.beans; + if (!rangeSvc) { + return; + } + rangeSvc.handleCellKeyboardSelect(keyboardEvent, cellPosition); + } + updateColumns(event) { + const source = _convertColumnEventSourceType2(event.source); + this.refreshSelectionIntegration(); + for (const col of this.columns?.list ?? []) { + const colDef = this.createRowNumbersColDef(); + col.setColDef(colDef, null, source); + _applyColumnState3(this.beans, { state: [_getColumnStateFromColDef2(colDef, col.getColId())] }, source); + } + } + getColumn() { + return this.columns?.list.find(isRowNumberCol) ?? null; + } + getColumns() { + return this.columns?.list ?? null; + } + setupForHeader(comp) { + const { column, eGridHeader } = comp.params; + if (!isRowNumberCol(column)) { + return; + } + _setAriaLabel15(eGridHeader, "Row Number"); + this.addManagedElementListeners(eGridHeader, { + click: this.onHeaderClick.bind(this), + keydown: this.onHeaderKeyDown.bind(this), + focus: this.onHeaderFocus.bind(this) + }); + } + onGridCellFocused(event) { + if (!this.isIntegratedWithSelection || event.rowIndex == null || !event.column || !isRowNumberCol(event.column)) { + return; + } + const translate = this.getLocaleTextFunc(); + const message = translate("ariaSelectAllRowCells", "Press Enter to select all cells on this row"); + this.beans.ariaAnnounce?.announceValue(message, "ariaSelectAllRowCells"); + } + createRowNumbersRowResizerFeature(ctrl) { + if (!_isRowNumbersResizerEnabled(this.beans)) { + return void 0; + } + return new RowNumbersRowResizeFeature(this.beans, ctrl); + } + refreshSelectionIntegration() { + const { beans } = this; + const { gos, rangeSvc } = beans; + const cellSelection = gos.get("cellSelection"); + this.refreshRowNumberOverrides(); + this.isIntegratedWithSelection = !!rangeSvc && !!cellSelection && !this.isSuppressCellSelectionIntegration; + } + refreshRowNumberOverrides() { + const rowNumbers = _isRowNumbers2(this.beans); + this.rowNumberOverrides = {}; + this.isSuppressCellSelectionIntegration = false; + if (!rowNumbers || typeof rowNumbers !== "object") { + return; + } + if (rowNumbers.suppressCellSelectionIntegration) { + this.isSuppressCellSelectionIntegration = true; + } + const colDefValidProps = [ + "contextMenuItems", + "context", + "onCellClicked", + "onCellContextMenu", + "onCellDoubleClicked", + "headerTooltip", + "headerStyle", + "headerComponent", + "headerComponentParams", + "suppressHeaderKeyboardEvent", + "suppressNavigable", + "tooltipField", + "tooltipValueGetter", + "tooltipComponent", + "tooltipComponentParams", + "tooltipComponentSelector", + "valueGetter", + "valueFormatter", + "width", + "maxWidth", + "minWidth", + "resizable", + "cellRenderer", + "cellRendererSelector", + "cellRendererParams" + ]; + for (const prop of colDefValidProps) { + if (rowNumbers[prop] != null) { + this.rowNumberOverrides[prop] = rowNumbers[prop]; + } + } + } + onHeaderFocus() { + if (!this.isIntegratedWithSelection) { + return; + } + const translate = this.getLocaleTextFunc(); + const message = translate("ariaSelectAllCells", "Press Space or Enter to select all cells"); + this.beans.ariaAnnounce?.announceValue(message, "ariaSelectAllCells"); + } + onHeaderKeyDown(e) { + if (!this.isIntegratedWithSelection || e.key !== KeyCode29.SPACE && e.key !== KeyCode29.ENTER) { + return; + } + e.preventDefault(); + this.selectAllCellsFromHeader(); + } + onHeaderClick(_e) { + if (Date.now() - this.lastColumnResized < 100 || !this.isIntegratedWithSelection || this.getColumn()?.resizing) { + return; + } + this.focusAllCellsFromHeaderClick(); + } + selectAllCellsFromHeader() { + _selectAllCells(this.beans); + } + focusAllCellsFromHeaderClick() { + this.selectAllCellsFromHeader(); + this.focusFirstRenderedCellAtRowPosition(); + } + refreshCells(force, runAutoSize) { + const column = this.getColumn(); + if (!column) { + return; + } + if (runAutoSize) { + const width = this.beans.autoWidthCalc?.getPreferredWidthForElements([this.createDummyElement(column)], 2); + if (width != null) { + this.beans.colResize?.setColumnWidths( + [{ key: column, newWidth: width }], + false, + true, + "rowNumbersService" + ); + } + } + this.beans.rowRenderer.refreshCells({ + columns: [column], + force + }); + } + createDummyElement(column) { + const div = _createElement13({ tag: "div", cls: "ag-cell-value ag-cell" }); + let value = String(this.beans.rowModel.getRowCount() + 1); + if (typeof this.rowNumberOverrides.valueFormatter === "function") { + const valueFormatterParams = _addGridCommonParams20(this.beans.gos, { + data: void 0, + value, + node: null, + column, + colDef: column.colDef + }); + value = this.rowNumberOverrides.valueFormatter(valueFormatterParams); + } + div.textContent = value; + return div; + } + createRowNumbersColDef() { + const { gos, contextMenuSvc } = this.beans; + const enableRTL = gos.get("enableRtl"); + return { + // overridable properties + minWidth: 60, + width: 60, + resizable: false, + valueGetter: this.valueGetter.bind(this), + contextMenuItems: this.isIntegratedWithSelection || !contextMenuSvc ? void 0 : () => [], + // overrides + ...this.rowNumberOverrides, + // non-overridable properties + colId: ROW_NUMBERS_COLUMN_ID, + chartDataType: "excluded", + suppressHeaderMenuButton: true, + sortable: false, + suppressMovable: true, + lockPinned: true, + pinned: enableRTL ? "right" : "left", + lockPosition: enableRTL ? "right" : "left", + editable: false, + suppressFillHandle: true, + suppressAutoSize: true, + suppressSizeToFit: true, + suppressHeaderContextMenu: true, + headerClass: this.getHeaderClass(), + cellClass: this.getCellClass.bind(this), + cellAriaRole: "rowheader" + }; + } + valueGetter(params) { + const node = params.node; + const isFormulasActive = this.beans.formula?.active; + const pinnedSibling = node?.pinnedSibling; + if (node?.rowPinned && pinnedSibling) { + const rowIndex = isFormulasActive ? pinnedSibling.formulaRowIndex : pinnedSibling.rowIndex; + return `${rowIndex == null ? "-" : rowIndex + 1}`; + } + return String(((isFormulasActive ? node?.formulaRowIndex : node?.rowIndex) || 0) + 1); + } + getHeaderClass() { + const cssClass = ["ag-row-number-header"]; + if (this.isIntegratedWithSelection) { + cssClass.push("ag-row-number-selection-enabled"); + } + return cssClass; + } + getCellClass(params) { + const { beans } = this; + const { rangeSvc, gos } = beans; + const { node } = params; + const cssClasses = ["ag-row-number-cell"]; + const cellSelection = gos.get("cellSelection"); + if (!rangeSvc || !cellSelection) { + return cssClasses; + } + if (this.isIntegratedWithSelection) { + cssClasses.push("ag-row-number-selection-enabled"); + } + const ranges = rangeSvc.getCellRanges(); + if (!ranges.length) { + return cssClasses; + } + const allColsLen = this.beans.visibleCols.allCols.length - 1; + const shouldHighlight = typeof cellSelection === "object" && cellSelection.enableHeaderHighlight; + for (const range of ranges) { + if (rangeSvc.isRowInRange({ rowIndex: node.rowIndex, rowPinned: node.rowPinned }, range)) { + if (shouldHighlight) { + cssClasses.push("ag-row-number-range-highlight"); + } + if (range.columns.length === allColsLen) { + cssClasses.push("ag-row-number-range-selected"); + } + } + } + return cssClasses; + } + generateRowNumberCols() { + const { gos, beans } = this; + if (!_isRowNumbers2(beans)) { + return []; + } + const colDef = this.createRowNumbersColDef(); + const colId = colDef.colId; + gos.validateColDef(colDef, colId, true); + const col = new AgColumn3(colDef, null, colId, false); + this.createBean(col); + return [col]; + } + focusFirstRenderedCellAtRowPosition(rowPosition) { + const editSvc = this.beans.editSvc; + if (editSvc?.isEditing() && editSvc.isRangeSelectionEnabledWhileEditing?.()) { + return; + } + if (!rowPosition) { + rowPosition = _getFirstRow(this.beans); + if (!rowPosition) { + return; + } + } + const { beans, gos } = this; + const { visibleCols, colViewport } = beans; + const pinnedCols = gos.get("enableRtl") ? visibleCols.rightCols : visibleCols.leftCols; + let columns; + if (pinnedCols.length == 1) { + const rowNode = _getRowNode5(beans, rowPosition); + if (!rowNode) { + return; + } + columns = colViewport.getColsWithinViewport(rowNode); + } else { + columns = pinnedCols; + } + const column = columns.find((col) => !isRowNumberCol(col)); + if (!column) { + return; + } + const { rowPinned, rowIndex } = rowPosition; + setTimeout(() => { + beans.focusSvc.setFocusedCell({ + rowIndex, + rowPinned, + column, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true + }); + }); + } + destroy() { + _destroyColumnTree3(this.beans, this.columns?.tree); + this.rowNumberOverrides = null; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/rowNumbers/rowNumbersModule.ts +var RowNumbersModule = { + moduleName: "RowNumbers", + version: VERSION, + beans: [RowNumbersService], + dynamicBeans: { rowNumberRowResizer: AgRowNumbersRowResizer }, + dependsOn: [EnterpriseCoreModule, CellStyleModule, _SharedDragAndDropModule4], + css: [rowNumbers_default] +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/filtersToolPanelModule.ts +import { _ColumnFilterModule as _ColumnFilterModule4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/filtersToolPanel.ts +import { Component as Component45, RefPlaceholder as RefPlaceholder41 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/agFiltersToolPanelHeader.ts +import { + AgInputTextFieldSelector as AgInputTextFieldSelector8, + Component as Component41, + RefPlaceholder as RefPlaceholder38, + _createIconNoSpan as _createIconNoSpan20, + _debounce as _debounce5, + _setDisplayed as _setDisplayed20 +} from "ag-grid-community"; +var AgFiltersToolPanelHeaderElement = { + tag: "div", + cls: "ag-filter-toolpanel-search", + role: "presentation", + children: [ + { + tag: "div", + ref: "eExpand", + cls: "ag-filter-toolpanel-expand" + }, + { + tag: "ag-input-text-field", + ref: "eFilterTextField", + cls: "ag-filter-toolpanel-search-input" + } + ] +}; +var AgFiltersToolPanelHeader = class extends Component41 { + constructor() { + super(...arguments); + this.eExpand = RefPlaceholder38; + this.eFilterTextField = RefPlaceholder38; + } + postConstruct() { + this.setTemplate(AgFiltersToolPanelHeaderElement, [AgInputTextFieldSelector8]); + const translate = this.getLocaleTextFunc(); + this.eFilterTextField.setAutoComplete(false).setInputAriaLabel(translate("ariaFilterColumnsInput", "Filter Columns Input")).onValueChange(this.onSearchTextChanged.bind(this)); + this.createExpandIcons(); + this.setExpandState(0 /* EXPANDED */); + this.addManagedElementListeners(this.eExpand, { click: this.onExpandClicked.bind(this) }); + this.addManagedEventListeners({ newColumnsLoaded: this.showOrHideOptions.bind(this) }); + } + init(params) { + this.params = params; + if (this.beans.colModel.ready) { + this.showOrHideOptions(); + } + } + createExpandIcons() { + const { eExpand, beans } = this; + eExpand.appendChild(this.eExpandChecked = _createIconNoSpan20("accordionOpen", beans)); + eExpand.appendChild(this.eExpandUnchecked = _createIconNoSpan20("accordionClosed", beans)); + eExpand.appendChild(this.eExpandIndeterminate = _createIconNoSpan20("accordionIndeterminate", beans)); + } + // we only show expand / collapse if we are showing filters + showOrHideOptions() { + const { params, eFilterTextField } = this; + const showFilterSearch = !params.suppressFilterSearch; + const showExpand = !params.suppressExpandAll; + const translate = this.getLocaleTextFunc(); + eFilterTextField.setInputPlaceholder(translate("searchOoo", "Search...")); + const isFilterGroupPresent = (col) => col.getOriginalParent() && col.isFilterAllowed(); + const filterGroupsPresent = this.beans.colModel.getCols().some(isFilterGroupPresent); + _setDisplayed20(eFilterTextField.getGui(), showFilterSearch); + _setDisplayed20(this.eExpand, showExpand && filterGroupsPresent); + } + onSearchTextChanged() { + if (!this.onSearchTextChangedDebounced) { + this.onSearchTextChangedDebounced = _debounce5( + this, + () => this.dispatchLocalEvent({ type: "searchChanged", searchText: this.eFilterTextField.getValue() }), + 300 + ); + } + this.onSearchTextChangedDebounced(); + } + onExpandClicked() { + const event = this.currentExpandState === 0 /* EXPANDED */ ? { type: "collapseAll" } : { type: "expandAll" }; + this.dispatchLocalEvent(event); + } + setExpandState(state) { + this.currentExpandState = state; + _setDisplayed20(this.eExpandChecked, state === 0 /* EXPANDED */); + _setDisplayed20(this.eExpandUnchecked, state === 1 /* COLLAPSED */); + _setDisplayed20(this.eExpandIndeterminate, state === 2 /* INDETERMINATE */); + } +}; +var AgFiltersToolPanelHeaderSelector = { + selector: "AG-FILTERS-TOOL-PANEL-HEADER", + component: AgFiltersToolPanelHeader +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/agFiltersToolPanelList.ts +import { + Component as Component44, + _addGridCommonParams as _addGridCommonParams21, + _clearElement as _clearElement16, + _exists as _exists22, + _getActiveDomElement as _getActiveDomElement13, + _mergeDeep as _mergeDeep4, + _setAriaLabel as _setAriaLabel18, + _warn as _warn36, + isProvidedColumnGroup as isProvidedColumnGroup6 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/toolPanelFilterComp.ts +import { + Component as Component42, + FilterComp as FilterComp3, + KeyCode as KeyCode30, + RefPlaceholder as RefPlaceholder39, + _clearElement as _clearElement14, + _createElement as _createElement14, + _createIconNoSpan as _createIconNoSpan21, + _setAriaExpanded as _setAriaExpanded10, + _setAriaLabel as _setAriaLabel16, + _setAriaRole as _setAriaRole10, + _setDisplayed as _setDisplayed21 +} from "ag-grid-community"; +var ToolPanelFilterElement = { + tag: "div", + cls: "ag-filter-toolpanel-instance", + children: [ + { + tag: "div", + ref: "eFilterToolPanelHeader", + cls: "ag-filter-toolpanel-header ag-filter-toolpanel-instance-header", + role: "button", + attrs: { "aria-expanded": "false" }, + children: [ + { tag: "div", ref: "eExpand", cls: "ag-filter-toolpanel-expand" }, + { tag: "span", ref: "eFilterName", cls: "ag-header-cell-text" }, + { + tag: "span", + ref: "eFilterIcon", + cls: "ag-header-icon ag-filter-icon ag-filter-toolpanel-instance-header-icon" + } + ] + }, + { tag: "div", ref: "agFilterToolPanelBody", cls: "ag-filter-toolpanel-instance-body ag-filter" } + ] +}; +var ToolPanelFilterComp = class extends Component42 { + constructor(hideHeader, expandedCallback) { + super(ToolPanelFilterElement); + this.hideHeader = hideHeader; + this.expandedCallback = expandedCallback; + this.eFilterToolPanelHeader = RefPlaceholder39; + this.eFilterName = RefPlaceholder39; + this.agFilterToolPanelBody = RefPlaceholder39; + this.eFilterIcon = RefPlaceholder39; + this.eExpand = RefPlaceholder39; + this.expanded = false; + } + postConstruct() { + const { beans, eExpand, eFilterIcon } = this; + const eExpandChecked = _createIconNoSpan21("accordionOpen", beans); + this.eExpandChecked = eExpandChecked; + const eExpandUnchecked = _createIconNoSpan21("accordionClosed", beans); + this.eExpandUnchecked = eExpandUnchecked; + eExpand.appendChild(eExpandChecked); + eExpand.appendChild(eExpandUnchecked); + const translate = this.getLocaleTextFunc(); + _setAriaLabel16(eFilterIcon, translate("ariaFilterActive", "Filter Active")); + _setAriaRole10(eFilterIcon, "img"); + } + setColumn(column) { + this.column = column; + const { beans, eFilterToolPanelHeader, eFilterIcon, eExpandChecked, hideHeader } = this; + this.eFilterName.innerText = beans.colNames.getDisplayNameForColumn(column, "filterToolPanel", false) || ""; + this.addManagedListeners(eFilterToolPanelHeader, { + click: this.toggleExpanded.bind(this), + keydown: this.onKeyDown.bind(this) + }); + this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) }); + this.addInIcon("filterActive", eFilterIcon, column); + _setDisplayed21(eFilterIcon, this.isFilterActive()); + _setDisplayed21(eExpandChecked, false); + if (hideHeader) { + _setDisplayed21(eFilterToolPanelHeader, false); + eFilterToolPanelHeader.removeAttribute("tabindex"); + } else { + eFilterToolPanelHeader.setAttribute("tabindex", "0"); + } + this.addManagedListeners(column, { filterChanged: this.onFilterChanged.bind(this) }); + } + onKeyDown(e) { + const { key } = e; + const { ENTER, SPACE, LEFT, RIGHT } = KeyCode30; + if (key !== ENTER && key !== SPACE && key !== LEFT && key !== RIGHT) { + return; + } + e.preventDefault(); + if (key === ENTER || key === SPACE) { + this.toggleExpanded(); + } else if (key === KeyCode30.LEFT) { + this.collapse(); + } else { + this.expand(); + } + } + getColumn() { + return this.column; + } + getColumnFilterName() { + return this.beans.colNames.getDisplayNameForColumn(this.column, "filterToolPanel", false); + } + addCssClassToTitleBar(cssClass) { + this.eFilterToolPanelHeader.classList.add(cssClass); + } + addInIcon(iconName, eParent, column) { + if (eParent == null) { + return; + } + const eIcon = _createIconNoSpan21(iconName, this.beans, column); + eParent.appendChild(eIcon); + } + isFilterActive() { + return !!this.beans.colFilter?.isFilterActive(this.column); + } + onFilterChanged() { + _setDisplayed21(this.eFilterIcon, this.isFilterActive()); + this.dispatchLocalEvent({ type: "filterChanged" }); + } + toggleExpanded() { + if (this.expanded) { + this.collapse(); + } else { + this.expand(); + } + } + expand() { + if (this.expanded) { + return; + } + this.expanded = true; + _setAriaExpanded10(this.eFilterToolPanelHeader, true); + _setDisplayed21(this.eExpandChecked, true); + _setDisplayed21(this.eExpandUnchecked, false); + this.addFilterElement(); + this.expandedCallback(); + } + addFilterElement(suppressFocus) { + const filterPanelWrapper = _createElement14({ tag: "div", cls: "ag-filter-toolpanel-instance-filter" }); + const comp = this.createManagedBean(new FilterComp3(this.column, "TOOLBAR")); + this.filterComp = comp; + if (!comp.hasFilter()) { + return; + } + comp.getFilter()?.then((filter) => { + this.underlyingFilter = filter; + if (!filter) { + return; + } + filterPanelWrapper.appendChild(comp.getGui()); + this.agFilterToolPanelBody.appendChild(filterPanelWrapper); + comp.afterGuiAttached({ container: "toolPanel", suppressFocus }); + }); + } + collapse() { + if (!this.expanded) { + return; + } + this.expanded = false; + _setAriaExpanded10(this.eFilterToolPanelHeader, false); + this.removeFilterElement(); + _setDisplayed21(this.eExpandChecked, false); + _setDisplayed21(this.eExpandUnchecked, true); + const filterComp = this.filterComp; + filterComp?.afterGuiDetached(); + this.destroyBean(filterComp); + this.expandedCallback(); + } + removeFilterElement() { + _clearElement14(this.agFilterToolPanelBody); + } + isExpanded() { + return this.expanded; + } + onPanelHidden() { + if (!this.expanded) { + return; + } + const filter = this.underlyingFilter; + if (!filter) { + return; + } + filter.afterGuiDetached?.(); + } + onFilterOpened(event) { + if (event.source !== "COLUMN_MENU") { + return; + } + if (event.column !== this.column) { + return; + } + if (!this.expanded) { + return; + } + this.collapse(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/toolPanelFilterGroupComp.ts +import { + Component as Component43, + RefPlaceholder as RefPlaceholder40, + _clearElement as _clearElement15, + _createIconNoSpan as _createIconNoSpan22, + _getShouldDisplayTooltip as _getShouldDisplayTooltip4, + _setAriaLabel as _setAriaLabel17, + _setAriaRole as _setAriaRole11, + isProvidedColumnGroup as isProvidedColumnGroup5 +} from "ag-grid-community"; +var ToolPanelFilterGroupComp = class extends Component43 { + constructor(columnGroup, childFilterComps, expandedCallback, depth, showingColumn) { + super(); + this.columnGroup = columnGroup; + this.childFilterComps = childFilterComps; + this.expandedCallback = expandedCallback; + this.depth = depth; + this.showingColumn = showingColumn; + this.filterGroupComp = RefPlaceholder40; + } + postConstruct() { + const groupParams = { + cssIdentifier: "filter-toolpanel", + direction: "vertical" + }; + this.setTemplate( + { + tag: "div", + cls: "ag-filter-toolpanel-group-wrapper", + children: [{ tag: "ag-group-component", ref: "filterGroupComp" }] + }, + [AgGroupComponentSelector], + { filterGroupComp: groupParams } + ); + this.setGroupTitle(); + const { filterGroupComp, depth, childFilterComps, gos } = this; + filterGroupComp.setAlignItems("stretch"); + filterGroupComp.addCss(`ag-filter-toolpanel-group-level-${depth}`); + filterGroupComp.getGui().style.setProperty("--ag-indentation-level", String(depth)); + filterGroupComp.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${depth}-header`); + for (const filterComp of childFilterComps) { + filterGroupComp.addItem(filterComp); + filterComp.addCssClassToTitleBar(`ag-filter-toolpanel-group-level-${depth + 1}-header`); + filterComp.getGui().style.setProperty("--ag-indentation-level", String(depth + 1)); + } + const column = this.showingColumn ? this.columnGroup : void 0; + this.tooltipFeature = this.createOptionalManagedBean( + this.beans.registry.createDynamicBean("tooltipFeature", false, { + getGui: () => this.getGui(), + getLocation: () => "filterToolPanelColumnGroup", + shouldDisplayTooltip: _getShouldDisplayTooltip4( + gos, + () => filterGroupComp.getGui().querySelector(".ag-group-title") + ), + getAdditionalParams: () => ({ + colDef: column?.getColDef(), + column + }) + }) + ); + this.refreshFilterClass(); + this.addExpandCollapseListeners(); + this.addFilterChangedListeners(); + this.setupTooltip(); + this.addInIcon("filterActive"); + } + setupTooltip() { + if (!this.showingColumn) { + return; + } + const refresh = () => { + this.tooltipFeature?.setTooltipAndRefresh(this.columnGroup.getColDef().headerTooltip); + }; + refresh(); + this.addManagedEventListeners({ newColumnsLoaded: refresh }); + } + addCssClassToTitleBar(cssClass) { + this.filterGroupComp.addCssClassToTitleBar(cssClass); + } + onPanelHidden() { + for (const filterComp of this.childFilterComps) { + filterComp.onPanelHidden(); + } + } + isColumnGroup() { + return isProvidedColumnGroup5(this.columnGroup); + } + isExpanded() { + return this.filterGroupComp.isExpanded(); + } + getChildren() { + return this.childFilterComps; + } + getFilterGroupName() { + return this.filterGroupName ?? ""; + } + getFilterGroupId() { + return this.columnGroup.getId(); + } + hideGroupItem(hide, index) { + this.filterGroupComp.hideItem(hide, index); + } + hideGroup(hide) { + this.setDisplayed(!hide); + } + addInIcon(iconName) { + const eIcon = _createIconNoSpan22(iconName, this.beans); + if (eIcon) { + eIcon.classList.add("ag-filter-toolpanel-group-instance-header-icon"); + const translate = this.getLocaleTextFunc(); + _setAriaLabel17(eIcon, translate("ariaFilterActive", "Filter Active")); + _setAriaRole11(eIcon, "img"); + } + this.filterGroupComp.addTitleBarWidget(eIcon); + } + forEachToolPanelFilterChild(action) { + for (const filterComp of this.childFilterComps) { + if (filterComp instanceof ToolPanelFilterComp) { + action(filterComp); + } + } + } + addExpandCollapseListeners() { + const expandListener = this.isColumnGroup() ? () => this.expandedCallback() : () => this.forEachToolPanelFilterChild((filterComp) => filterComp.expand()); + const collapseListener = this.isColumnGroup() ? () => this.expandedCallback() : () => this.forEachToolPanelFilterChild((filterComp) => filterComp.collapse()); + this.addManagedListeners(this.filterGroupComp, { + expanded: expandListener, + collapsed: collapseListener + }); + } + getColumns() { + if (isProvidedColumnGroup5(this.columnGroup)) { + return this.columnGroup.getLeafColumns(); + } + return [this.columnGroup]; + } + addFilterChangedListeners() { + for (const column of this.getColumns()) { + this.addManagedListeners(column, { filterChanged: () => this.refreshFilterClass() }); + } + if (!isProvidedColumnGroup5(this.columnGroup)) { + this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) }); + } + } + refreshFilterClass() { + const columns = this.getColumns(); + const anyChildFiltersActive = () => columns.some((col) => col.isFilterActive()); + this.filterGroupComp.toggleCss("ag-has-filter", anyChildFiltersActive()); + } + onFilterOpened(event) { + if (event.source !== "COLUMN_MENU") { + return; + } + if (event.column !== this.columnGroup) { + return; + } + if (!this.isExpanded()) { + return; + } + this.collapse(); + } + expand() { + this.filterGroupComp.toggleGroupExpand(true); + } + collapse() { + this.filterGroupComp.toggleGroupExpand(false); + } + setGroupTitle() { + const columnGroup = this.columnGroup; + const filterGroupName = isProvidedColumnGroup5(columnGroup) ? this.getColumnGroupName(columnGroup) : this.getColumnName(columnGroup); + this.filterGroupName = filterGroupName; + this.filterGroupComp.setTitle(filterGroupName || ""); + } + getColumnGroupName(columnGroup) { + return this.beans.colNames.getDisplayNameForProvidedColumnGroup(null, columnGroup, "filterToolPanel"); + } + getColumnName(column) { + return this.beans.colNames.getDisplayNameForColumn(column, "filterToolPanel", false); + } + destroyFilters() { + this.childFilterComps = this.destroyBeans(this.childFilterComps); + _clearElement15(this.getGui()); + } + destroy() { + this.destroyFilters(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/agFiltersToolPanelList.ts +var AgFiltersToolPanelList = class extends Component44 { + constructor() { + super({ tag: "div", cls: "ag-filter-list-panel" }); + this.initialised = false; + this.hasLoadedInitialState = false; + this.isInitialState = false; + this.filterGroupComps = []; + // If a column drag is happening, we suppress handling the event until it has completed + this.suppressOnColumnsChanged = false; + this.onColumnsChangedPending = false; + } + wireBeans(beans) { + this.colModel = beans.colModel; + } + init(params) { + this.initialised = true; + const defaultParams = _addGridCommonParams21(this.gos, { + suppressExpandAll: false, + suppressFilterSearch: false, + suppressSyncLayoutWithGrid: false + }); + _mergeDeep4(defaultParams, params); + this.params = defaultParams; + if (!defaultParams.suppressSyncLayoutWithGrid) { + this.addManagedEventListeners({ columnMoved: () => this.onColumnsChanged() }); + } + this.addManagedEventListeners({ + newColumnsLoaded: () => this.onColumnsChanged(), + toolPanelVisibleChanged: (event) => { + if (event.key === "filters" && !event.visible) { + this.onPanelHidden(); + } + }, + dragStarted: () => { + this.suppressOnColumnsChanged = true; + }, + dragStopped: () => { + this.suppressOnColumnsChanged = false; + if (this.onColumnsChangedPending) { + this.onColumnsChangedPending = false; + this.onColumnsChanged(); + } + } + }); + if (this.colModel.ready) { + this.onColumnsChanged(); + } + } + onColumnsChanged() { + if (this.suppressOnColumnsChanged) { + this.onColumnsChangedPending = true; + return; + } + const pivotModeActive = this.colModel.isPivotMode(); + const shouldSyncColumnLayoutWithGrid = !this.params.suppressSyncLayoutWithGrid && !pivotModeActive; + if (shouldSyncColumnLayoutWithGrid) { + this.syncFilterLayout(); + } else { + this.buildTreeFromProvidedColumnDefs(); + } + this.refreshAriaLabel(); + } + syncFilterLayout() { + syncLayoutWithGrid(this.colModel, this.setFiltersLayout.bind(this)); + this.refreshAriaLabel(); + } + buildTreeFromProvidedColumnDefs() { + const columnTree = this.colModel.getColDefColTree(); + this.recreateFilters(columnTree); + } + setFiltersLayout(colDefs) { + const columnTree = toolPanelCreateColumnTree(this.colModel, colDefs); + this.recreateFilters(columnTree); + } + recreateFilters(columnTree) { + const activeElement = _getActiveDomElement13(this.beans); + if (!this.hasLoadedInitialState) { + this.hasLoadedInitialState = true; + this.isInitialState = !!this.params.initialState; + } + const expansionState = this.getExpansionState(); + this.destroyFilters(); + const filterGroupComps = this.recursivelyAddComps(columnTree, 0, expansionState); + this.filterGroupComps = filterGroupComps; + const len = filterGroupComps.length; + if (len) { + for (const comp of filterGroupComps) { + this.appendChild(comp); + } + this.setFirstAndLastVisible(0, len - 1); + } + const searchFilterText = this.searchFilterText; + if (_exists22(searchFilterText)) { + this.searchFilters(searchFilterText); + } + this.fireExpandedEvent(); + if (this.getGui().contains(activeElement)) { + activeElement.focus(); + } + this.isInitialState = false; + this.refreshAriaLabel(); + } + recursivelyAddComps(tree, depth, expansionState) { + return tree.map((child) => { + if (isProvidedColumnGroup6(child)) { + return this.recursivelyAddFilterGroupComps(child, depth, expansionState)?.flatMap((a) => a) ?? []; + } + const column = child; + if (!this.shouldDisplayFilter(column)) { + return []; + } + const hideFilterCompHeader = depth === 0; + const filterComp = new ToolPanelFilterComp(hideFilterCompHeader, () => this.onFilterExpanded()); + this.createBean(filterComp); + filterComp.setColumn(column); + if (expansionState.get(column.getId())) { + filterComp.expand(); + } + if (depth > 0) { + return filterComp; + } + const filterGroupComp = this.createBean( + new ToolPanelFilterGroupComp(column, [filterComp], this.onGroupExpanded.bind(this), depth, true) + ); + filterGroupComp.addCssClassToTitleBar("ag-filter-toolpanel-header"); + if (!expansionState.get(filterGroupComp.getFilterGroupId())) { + filterGroupComp.collapse(); + } + return filterGroupComp; + }).flatMap((a) => a); + } + refreshAriaLabel() { + const translate = this.getLocaleTextFunc(); + const filterListName = translate("ariaFilterPanelList", "Filter List"); + const localeFilters = translate("filters", "Filters"); + const eGui = this.getGui(); + const groupSelector = ".ag-filter-toolpanel-group-wrapper"; + const itemSelector = ".ag-filter-toolpanel-group-item"; + const hiddenSelector = ".ag-hidden"; + const visibleItems = eGui.querySelectorAll(`${itemSelector}:not(${groupSelector}, ${hiddenSelector})`); + const totalVisibleItems = visibleItems.length; + _setAriaLabel18(this.getAriaElement(), `${filterListName} ${totalVisibleItems} ${localeFilters}`); + } + recursivelyAddFilterGroupComps(columnGroup, depth, expansionState) { + if (!this.filtersExistInChildren(columnGroup.getChildren())) { + return; + } + const colGroupDef = columnGroup.getColGroupDef(); + if (colGroupDef?.suppressFiltersToolPanel) { + return []; + } + const newDepth = columnGroup.isPadding() ? depth : depth + 1; + const childFilterComps = this.recursivelyAddComps(columnGroup.getChildren(), newDepth, expansionState).flatMap( + (a) => a + ); + if (columnGroup.isPadding()) { + return childFilterComps; + } + const filterGroupComp = new ToolPanelFilterGroupComp( + columnGroup, + childFilterComps, + this.onGroupExpanded.bind(this), + depth, + false + ); + this.createBean(filterGroupComp); + filterGroupComp.addCssClassToTitleBar("ag-filter-toolpanel-header"); + const expansionStateValue = expansionState.get(filterGroupComp.getFilterGroupId()); + if (this.isInitialState && !expansionStateValue || expansionStateValue === false) { + filterGroupComp.collapse(); + } + return [filterGroupComp]; + } + filtersExistInChildren(tree) { + return tree.some((child) => { + if (isProvidedColumnGroup6(child)) { + return this.filtersExistInChildren(child.getChildren()); + } + return this.shouldDisplayFilter(child); + }); + } + shouldDisplayFilter(column) { + const suppressFiltersToolPanel = column.getColDef()?.suppressFiltersToolPanel; + return column.isFilterAllowed() && !suppressFiltersToolPanel; + } + getExpansionState() { + const expansionState = /* @__PURE__ */ new Map(); + if (this.isInitialState) { + const { expandedColIds, expandedGroupIds } = this.params.initialState; + for (const id of expandedColIds) { + expansionState.set(id, true); + } + for (const id of expandedGroupIds) { + expansionState.set(id, true); + } + return expansionState; + } + const recursiveGetExpansionState = (filterGroupComp) => { + expansionState.set(filterGroupComp.getFilterGroupId(), filterGroupComp.isExpanded()); + for (const child of filterGroupComp.getChildren()) { + if (child instanceof ToolPanelFilterGroupComp) { + recursiveGetExpansionState(child); + } else { + expansionState.set(child.getColumn().getId(), child.isExpanded()); + } + } + }; + this.filterGroupComps.forEach(recursiveGetExpansionState); + return expansionState; + } + refresh() { + } + // lazy initialise the panel + setVisible(visible) { + super.setDisplayed(visible); + if (visible && !this.initialised) { + this.init(this.params); + } + } + expandFilterGroups(expand, groupIds) { + const updatedGroupIds = []; + const updateGroupExpandState = (filterGroup) => { + const groupId = filterGroup.getFilterGroupId(); + const shouldExpandOrCollapse = !groupIds || groupIds.includes(groupId); + if (shouldExpandOrCollapse) { + if (expand && filterGroup.isColumnGroup()) { + filterGroup.expand(); + } else { + filterGroup.collapse(); + } + updatedGroupIds.push(groupId); + } + for (const child of filterGroup.getChildren()) { + if (child instanceof ToolPanelFilterGroupComp) { + updateGroupExpandState(child); + } + } + }; + this.filterGroupComps.forEach(updateGroupExpandState); + this.onGroupExpanded(); + if (groupIds) { + const unrecognisedGroupIds = groupIds.filter((groupId) => updatedGroupIds.indexOf(groupId) < 0); + if (unrecognisedGroupIds.length > 0) { + _warn36(166, { unrecognisedGroupIds }); + } + } + } + expandFilters(expand, colIds) { + const updatedColIds = []; + const updateGroupExpandState = (filterComp) => { + if (filterComp instanceof ToolPanelFilterGroupComp) { + let anyChildrenChanged = false; + for (const child of filterComp.getChildren()) { + const childUpdated = updateGroupExpandState(child); + if (childUpdated) { + if (expand) { + filterComp.expand(); + anyChildrenChanged = true; + } else if (!filterComp.isColumnGroup()) { + filterComp.collapse(); + } + } + } + return anyChildrenChanged; + } + const colId = filterComp.getColumn().getColId(); + const updateFilterExpandState = !colIds || colIds.includes(colId); + if (updateFilterExpandState) { + if (expand) { + filterComp.expand(); + } else { + filterComp.collapse(); + } + updatedColIds.push(colId); + } + return updateFilterExpandState; + }; + this.filterGroupComps.forEach(updateGroupExpandState); + this.onGroupExpanded(); + if (colIds) { + const unrecognisedColIds = colIds.filter((colId) => updatedColIds.indexOf(colId) < 0); + if (unrecognisedColIds.length > 0) { + _warn36(167, { unrecognisedColIds }); + } + } + } + onGroupExpanded() { + this.fireExpandedEvent(); + } + onFilterExpanded() { + this.dispatchLocalEvent({ type: "filterExpanded" }); + } + fireExpandedEvent() { + let expandedCount = 0; + let notExpandedCount = 0; + const updateExpandCounts = (filterGroup) => { + if (!filterGroup.isColumnGroup()) { + return; + } + if (filterGroup.isExpanded()) { + expandedCount++; + } else { + notExpandedCount++; + } + for (const child of filterGroup.getChildren()) { + if (child instanceof ToolPanelFilterGroupComp) { + updateExpandCounts(child); + } + } + }; + this.filterGroupComps.forEach(updateExpandCounts); + let state; + if (expandedCount > 0 && notExpandedCount > 0) { + state = 2 /* INDETERMINATE */; + } else if (notExpandedCount > 0) { + state = 1 /* COLLAPSED */; + } else { + state = 0 /* EXPANDED */; + } + this.dispatchLocalEvent({ type: "groupExpanded", state }); + } + performFilterSearch(searchText) { + this.searchFilterText = _exists22(searchText) ? searchText.toLowerCase() : null; + this.searchFilters(this.searchFilterText); + } + searchFilters(searchFilter) { + const passesFilter = (groupName) => { + return !_exists22(searchFilter) || groupName.toLowerCase().indexOf(searchFilter) !== -1; + }; + const recursivelySearch = (filterItem, parentPasses) => { + if (!(filterItem instanceof ToolPanelFilterGroupComp)) { + return passesFilter(filterItem.getColumnFilterName() || ""); + } + const children = filterItem.getChildren(); + const groupNamePasses = passesFilter(filterItem.getFilterGroupName()); + const alreadyPassed = parentPasses || groupNamePasses; + if (alreadyPassed) { + filterItem.hideGroup(false); + for (let i = 0; i < children.length; i++) { + recursivelySearch(children[i], alreadyPassed); + filterItem.hideGroupItem(false, i); + } + return true; + } + let anyChildPasses = false; + children.forEach((child, index) => { + const childPasses = recursivelySearch(child, parentPasses); + filterItem.hideGroupItem(!childPasses, index); + if (childPasses) { + anyChildPasses = true; + } + }); + filterItem.hideGroup(!anyChildPasses); + return anyChildPasses; + }; + let firstVisible; + let lastVisible; + this.filterGroupComps.forEach((filterGroup, idx) => { + recursivelySearch(filterGroup, false); + const isHidden = filterGroup.getGui()?.classList.contains("ag-hidden"); + if (firstVisible === void 0) { + if (!isHidden) { + firstVisible = idx; + lastVisible = idx; + } + } else if (!isHidden && lastVisible !== idx) { + lastVisible = idx; + } + }); + this.setFirstAndLastVisible(firstVisible, lastVisible); + this.refreshAriaLabel(); + } + setFirstAndLastVisible(firstIdx, lastIdx) { + this.filterGroupComps.forEach((filterGroup, idx) => { + filterGroup.removeCss("ag-first-group-visible"); + filterGroup.removeCss("ag-last-group-visible"); + if (idx === firstIdx) { + filterGroup.addCss("ag-first-group-visible"); + } + if (idx === lastIdx) { + filterGroup.addCss("ag-last-group-visible"); + } + }); + } + onPanelHidden() { + for (const filterGroupComp of this.filterGroupComps) { + filterGroupComp.onPanelHidden(); + } + } + getExpandedFiltersAndGroups() { + const expandedGroupIds = []; + const expandedColIds = /* @__PURE__ */ new Set(); + const getExpandedFiltersAndGroups = (filterComp) => { + if (filterComp instanceof ToolPanelFilterGroupComp) { + for (const child of filterComp.getChildren()) { + getExpandedFiltersAndGroups(child); + } + const groupId = filterComp.getFilterGroupId(); + if (filterComp.isExpanded() && !expandedColIds.has(groupId)) { + expandedGroupIds.push(groupId); + } + } else if (filterComp.isExpanded()) { + expandedColIds.add(filterComp.getColumn().getColId()); + } + }; + this.filterGroupComps.forEach(getExpandedFiltersAndGroups); + return { expandedGroupIds, expandedColIds: Array.from(expandedColIds) }; + } + destroyFilters() { + this.filterGroupComps = this.destroyBeans(this.filterGroupComps); + _clearElement16(this.getGui()); + } + destroy() { + this.destroyFilters(); + super.destroy(); + } +}; +var AgFiltersToolPanelListSelector = { + selector: "AG-FILTERS-TOOL-PANEL-LIST", + component: AgFiltersToolPanelList +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/filtersToolPanel.css +var filtersToolPanel_default = ".ag-filter-toolpanel{flex:1 1 0px;min-width:0}.ag-filter-toolpanel-header,.ag-filter-toolpanel-search{align-items:center;color:var(--ag-header-text-color);display:flex;font-weight:var(--ag-header-font-weight);padding:0 var(--ag-spacing);>:where(.ag-filter-icon),>:where(.ag-filter-toolpanel-expand),>:where(.ag-filter-toolpanel-search-input),>:where(.ag-header-cell-text){align-items:center;display:flex}}.ag-filter-toolpanel-header{padding-bottom:var(--ag-spacing);padding-top:var(--ag-spacing);position:relative;&:focus-visible{border-radius:var(--ag-border-radius);box-shadow:inset var(--ag-focus-shadow)}}:where(.ag-ltr) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-ltr) .ag-filter-toolpanel-instance-header-icon{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-instance-header-icon,:where(.ag-rtl) .ag-filter-toolpanel-instance-header-icon{margin-right:var(--ag-spacing)}.ag-filter-toolpanel-search{min-height:var(--ag-header-height);padding-bottom:var(--ag-spacing);padding-top:var(--ag-widget-container-vertical-padding)}:where(.ag-filter-toolpanel-group:not(.ag-has-filter)>.ag-group-title-bar) .ag-filter-toolpanel-group-instance-header-icon{display:none}.ag-filter-toolpanel-search-input{flex-grow:1;height:calc(var(--ag-spacing)*4)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar-icon{margin-left:var(--ag-spacing)}.ag-filter-toolpanel-expand{cursor:pointer}:where(.ag-ltr) .ag-filter-toolpanel-expand{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-toolpanel-expand{margin-left:var(--ag-spacing)}:where(.ag-ltr) .ag-filter-toolpanel-group-title-bar,:where(.ag-ltr) .ag-filter-toolpanel-instance-header{padding-left:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-filter-toolpanel-group-title-bar,:where(.ag-rtl) .ag-filter-toolpanel-instance-header{padding-right:calc(var(--ag-spacing) + var(--ag-filter-tool-panel-group-indent)*var(--ag-indentation-level))}:where(.ag-ltr) .ag-filter-toolpanel-instance-body{margin-left:var(--ag-filter-tool-panel-group-indent)}:where(.ag-rtl) .ag-filter-toolpanel-instance-body{margin-right:var(--ag-filter-tool-panel-group-indent)}.ag-filter-toolpanel-instance-filter{background-color:var(--ag-chrome-background-color)}.ag-filter-toolpanel-group-level-0{border-top:none}"; + +// packages/ag-grid-enterprise/src/filterToolPanel/filtersToolPanel.ts +var FiltersToolPanelElement = { + tag: "div", + cls: "ag-filter-toolpanel", + children: [ + { tag: "ag-filters-tool-panel-header", ref: "filtersToolPanelHeaderPanel" }, + { tag: "ag-filters-tool-panel-list", ref: "filtersToolPanelListPanel" } + ] +}; +var FiltersToolPanel = class extends Component45 { + constructor() { + super(FiltersToolPanelElement, [AgFiltersToolPanelHeaderSelector, AgFiltersToolPanelListSelector]); + this.filtersToolPanelHeaderPanel = RefPlaceholder41; + this.filtersToolPanelListPanel = RefPlaceholder41; + this.initialised = false; + this.listenerDestroyFuncs = []; + this.registerCSS(filtersToolPanel_default); + } + init(params) { + if (this.initialised) { + for (const func of this.listenerDestroyFuncs) { + func(); + } + this.listenerDestroyFuncs = []; + } + this.initialised = true; + const defaultParams = { + suppressExpandAll: false, + suppressFilterSearch: false, + suppressSyncLayoutWithGrid: false + }; + const newParams = { + ...defaultParams, + ...params + }; + this.params = newParams; + const { filtersToolPanelHeaderPanel, filtersToolPanelListPanel } = this; + filtersToolPanelHeaderPanel.init(newParams); + filtersToolPanelListPanel.init(newParams); + const { suppressExpandAll: hideExpand, suppressFilterSearch: hideSearch } = newParams; + if (hideExpand && hideSearch) { + filtersToolPanelHeaderPanel.setDisplayed(false); + } + this.listenerDestroyFuncs.push( + ...this.addManagedListeners(filtersToolPanelHeaderPanel, { + expandAll: () => filtersToolPanelListPanel.expandFilterGroups(true), + collapseAll: () => filtersToolPanelListPanel.expandFilterGroups(false), + searchChanged: (event) => filtersToolPanelListPanel.performFilterSearch(event.searchText) + }), + ...this.addManagedListeners(filtersToolPanelListPanel, { + filterExpanded: newParams.onStateUpdated, + groupExpanded: (event) => { + filtersToolPanelHeaderPanel.setExpandState(event.state); + newParams.onStateUpdated(); + } + }) + ); + } + // lazy initialise the panel + setVisible(visible) { + super.setDisplayed(visible); + if (visible && !this.initialised) { + this.init(this.params); + } + } + setFilterLayout(colDefs) { + this.filtersToolPanelListPanel.setFiltersLayout(colDefs); + } + expandFilterGroups(groupIds) { + this.filtersToolPanelListPanel.expandFilterGroups(true, groupIds); + } + collapseFilterGroups(groupIds) { + this.filtersToolPanelListPanel.expandFilterGroups(false, groupIds); + } + expandFilters(colIds) { + this.filtersToolPanelListPanel.expandFilters(true, colIds); + } + collapseFilters(colIds) { + this.filtersToolPanelListPanel.expandFilters(false, colIds); + } + syncLayoutWithGrid() { + this.filtersToolPanelListPanel.syncFilterLayout(); + } + refresh(params) { + this.init(params); + return true; + } + getState() { + return this.filtersToolPanelListPanel.getExpandedFiltersAndGroups(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterPanelService.ts +import { BeanStub as BeanStub48, FilterComp as FilterComp4 } from "ag-grid-community"; +var FilterPanelService = class extends BeanStub48 { + constructor() { + super(...arguments); + this.beanName = "filterPanelSvc"; + this.states = /* @__PURE__ */ new Map(); + this.orderedStates = []; + this.initialStateApplied = false; + this.columnsLoaded = false; + this.isActive = false; + } + postConstruct() { + if (!this.gos.get("enableFilterHandlers")) { + return; + } + const updateFilterStates = this.updateFilterStates.bind(this); + const updateApplyButton = () => this.dispatchStatesUpdates(void 0, true); + const onFilterDestroyed = this.onFilterDestroyed.bind(this); + this.addManagedEventListeners({ + newColumnsLoaded: () => { + this.columnsLoaded = true; + if (!this.initialStateApplied) { + this.applyState(); + } + updateFilterStates(); + }, + dataTypesInferred: updateFilterStates, + filterChanged: updateFilterStates, + filterDestroyed: onFilterDestroyed, + filterHandlerDestroyed: onFilterDestroyed, + filterOpened: updateApplyButton, + filterClosed: updateApplyButton + }); + const refreshForColumn = ({ column }) => { + this.states.get(column.getColId())?.refresh?.(); + updateApplyButton(); + }; + this.addManagedListeners(this.beans.colFilter, { + filterStateChanged: refreshForColumn, + filterModelAsStringChanged: refreshForColumn + }); + } + updateParams(params, state) { + this.params = params; + let dispatchedStateUpdates = false; + if (state) { + this.currState = state; + if (this.columnsLoaded) { + const newIds = new Set(state.filters?.map((f) => f.colId)); + for (const id of this.getIds()) { + if (!newIds.has(id)) { + this.remove(id); + } + } + this.clear(); + this.applyState(); + this.updateFilterStates(); + dispatchedStateUpdates = true; + } + } + if (!dispatchedStateUpdates) { + this.dispatchStatesUpdates(); + } + this.beans.colFilter?.setGlobalButtons(!!params.buttons?.length); + } + getIds() { + return Array.from(this.states.keys()); + } + getAvailable() { + const beans = this.beans; + const availableFilters = []; + for (const column of beans.colModel.getColDefCols() ?? []) { + const id = column.getColId(); + if (column.isFilterAllowed() && !column.colDef.suppressFiltersToolPanel && !this.states.get(id)) { + availableFilters.push({ + id, + name: getDisplayName(beans, column) + }); + } + } + return availableFilters; + } + add(id) { + this.createFilter(id, true); + this.dispatchStatesUpdates(id); + } + remove(id) { + const { + states, + orderedStates, + beans: { colFilter, selectableFilter } + } = this; + const state = states.get(id); + if (!state) { + return; + } + state.destroy?.(); + const column = state.state.column; + states.delete(id); + selectableFilter?.clearActive(id); + colFilter?.destroyFilter(column); + this.eventSvc.dispatchEvent({ + type: "filterSwitched", + column + }); + const index = orderedStates.indexOf(id); + orderedStates.splice(index, 1); + const newActiveId = orderedStates[index]; + this.dispatchStatesUpdates(newActiveId); + } + getState(id) { + return this.states.get(id)?.state; + } + updateFilterState(id, key, value, suppressEvents) { + const filterState = this.getState(id); + if (!filterState) { + return; + } + filterState[key] = value; + if (!suppressEvents) { + this.dispatchLocalEvent({ + type: "filterPanelStateChanged", + id, + state: filterState + }); + } + } + expand(id, expanded) { + const existingFilterState = this.states.get(id); + if (!existingFilterState) { + return; + } + existingFilterState.destroy?.(); + const { + handler, + state: { column } + } = existingFilterState; + const newFilterState = this.createFilterState(column, handler, expanded); + this.states.set(id, newFilterState); + this.dispatchLocalEvent({ + type: "filterPanelStateChanged", + id, + state: newFilterState.state + }); + } + updateType(id, filterDef) { + const stateWrapper = this.states.get(id); + if (!stateWrapper) { + return; + } + const state = stateWrapper.state; + if (state.expanded === false) { + return; + } + const filterDefs = state.filterDefs; + if (!filterDefs) { + return; + } + const { colFilter, selectableFilter } = this.beans; + selectableFilter?.setActive(id, filterDefs, filterDef); + colFilter.filterParamsChanged(id, "columnFilter"); + const column = state.column; + this.eventSvc.dispatchEvent({ + type: "filterSwitched", + column + }); + const newStateWrapper = this.states.get(id); + if (!newStateWrapper) { + return; + } + const newState = newStateWrapper.state; + this.dispatchLocalEvent({ + type: "filterPanelStateChanged", + id, + state: newState + }); + } + getActions() { + const actions = this.params?.buttons; + if (!actions?.length) { + return void 0; + } + const canApply = !!this.beans.colFilter?.canApplyAll(); + return { actions, canApply }; + } + doAction(action) { + this.beans.colFilter?.updateAllModels(action); + } + getGridState() { + const filters = []; + this.states.forEach((stateWrapper, colId) => { + filters.push({ + colId, + expanded: stateWrapper.state.expanded + }); + }); + return { + filters + }; + } + createFilter(id, expanded) { + const stateWrapper = this.createFilterStateWrapper(id, expanded); + if (stateWrapper) { + this.states.set(id, stateWrapper); + this.orderedStates.push(id); + } + } + createFilterStateWrapper(id, expanded) { + const { colModel, colFilter } = this.beans; + const column = colModel.getColDefCol(id); + if (column && !column.colDef.suppressFiltersToolPanel) { + const handler = colFilter.getHandler(column, true); + if (handler) { + return this.createFilterState(column, handler, expanded); + } + } + return void 0; + } + updateFilterStates() { + if (!this.params) { + return; + } + const filterModel = this.beans.colFilter.getModel(); + const processedIds = /* @__PURE__ */ new Set(); + for (const id of Object.keys(filterModel)) { + const existingState = this.states.get(id); + if (!existingState) { + this.createFilter(id); + } else { + existingState.refresh?.(); + } + processedIds.add(id); + } + this.states.forEach((state, id) => { + if (!processedIds.has(id)) { + state.refresh?.(); + } + }); + this.dispatchStatesUpdates(); + } + createFilterState(column, handler, expanded) { + const beans = this.beans; + const { colFilter, selectableFilter } = beans; + const name = getDisplayName(beans, column); + const colId = column.getColId(); + const getIsEditing = () => !!this.params?.buttons && colFilter.hasUnappliedModel(colId); + const isEditing = getIsEditing(); + if (expanded) { + const colDef = column.colDef; + const { filterDefs, activeFilterDef } = selectableFilter?.getDefs(column, colDef) ?? {}; + const filterComp = this.createBean(new FilterComp4(column, "TOOLBAR", true)); + return { + state: { + column, + name, + isEditing, + expanded, + detail: filterComp.getGui(), + activeFilterDef, + filterDefs, + afterGuiAttached: filterComp.afterGuiAttached.bind(filterComp), + afterGuiDetached: filterComp.afterGuiDetached.bind(filterComp) + }, + handler, + refresh: () => { + this.updateFilterState(colId, "isEditing", getIsEditing()); + }, + destroy: () => this.destroyBean(filterComp) + }; + } else { + const colId2 = column.getColId(); + const getSummary = () => handler.getModelAsString?.(colFilter.getStateForColumn(colId2).model, "filterToolPanel") ?? ""; + return { + state: { + column, + name, + isEditing, + expanded: false, + summary: getSummary() + }, + handler, + refresh: () => { + this.updateFilterState(colId2, "isEditing", getIsEditing(), true); + this.updateFilterState(colId2, "summary", getSummary()); + } + }; + } + } + onFilterDestroyed({ column, source }) { + const { colFilter, filterManager } = this.beans; + if (!colFilter?.isAlive() || !filterManager?.isFilterAllowed(column)) { + return; + } + const states = this.states; + const id = column.getColId(); + const existingState = states.get(id); + if (existingState) { + const stateWrapper = this.createFilterStateWrapper(id, existingState.state.expanded); + if (stateWrapper) { + existingState.destroy?.(); + states.set(id, stateWrapper); + } else { + this.remove(id); + } + if (source === "api") { + this.dispatchStatesUpdates(); + } + } + } + dispatchStatesUpdates(activeId, action) { + this.dispatchLocalEvent({ + type: "filterPanelStatesChanged", + activeId, + action + }); + } + applyState() { + if (this.params && this.columnsLoaded) { + this.initialStateApplied = true; + for (const { colId, expanded } of this.currState?.filters ?? []) { + this.createFilter(colId, expanded); + } + } + } + destroy() { + this.clear(); + this.params = void 0; + this.currState = void 0; + super.destroy(); + } + clear() { + const { states, orderedStates } = this; + states.forEach((state) => state.destroy?.()); + states.clear(); + orderedStates.length = 0; + } +}; +function getDisplayName(beans, column) { + return beans.colNames.getDisplayNameForColumn(column, "filterToolPanel") ?? column.getColId(); +} + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/selectableFilterService.ts +import { + BeanStub as BeanStub49, + _addGridCommonParams as _addGridCommonParams22, + _getDefaultSimpleFilter as _getDefaultSimpleFilter2, + _getFilterParamsForDataType as _getFilterParamsForDataType2, + _isSetFilterByDefault, + _warn as _warn37 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterPanelUtils.ts +import { _removeFromParent as _removeFromParent7, _translate as _translate2 } from "ag-grid-community"; +var DEFAULT_LOCALE_TEXT2 = { + addFilterCard: "Add Filter", + ariaLabelAddFilterField: "Add Filter Field", + ariaLabelFilterCardDelete: "Delete Filter", + ariaLabelFilterCardHasEdits: "Has Edits", + agTextColumnFilterDisplayName: "Simple Filter", + agNumberColumnFilterDisplayName: "Simple Filter", + agDateColumnFilterDisplayName: "Simple Filter", + agSetColumnFilterDisplayName: "Selection Filter", + agMultiColumnFilterDisplayName: "Combo Filter", + addFilterPlaceholder: "Search columns..." +}; +function translateForFilterPanel(bean, key) { + return _translate2(bean, DEFAULT_LOCALE_TEXT2, key); +} +function compareAndUpdateListsInDom(eContainer, eNewItems, ePrevItems) { + let newIndex = 0; + for (let prevIndex = 0; prevIndex < ePrevItems.length; prevIndex++) { + const ePrevItem = ePrevItems[prevIndex]; + if (ePrevItem === eNewItems[newIndex]) { + newIndex++; + } else { + _removeFromParent7(ePrevItem); + } + } + while (newIndex < eNewItems.length) { + eContainer.appendChild(eNewItems[newIndex++]); + } +} + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/selectableFilterService.ts +var SelectableFilterService = class extends BeanStub49 { + constructor() { + super(...arguments); + this.beanName = "selectableFilter"; + this.selectedFilters = /* @__PURE__ */ new Map(); + this.valueGetters = /* @__PURE__ */ new Map(); + } + postConstruct() { + const { gos, selectedFilters } = this; + const initialState = gos.get("initialState")?.filter?.selectableFilters ?? {}; + for (const colId of Object.keys(initialState)) { + selectedFilters.set(colId, initialState[colId]); + } + } + getFilterValueGetter(colId) { + return this.valueGetters.get(colId); + } + isSelectable(filterDef) { + return filterDef.filter === "agSelectableColumnFilter"; + } + getFilterDef(column, filterDef) { + return this.getDefs(column, filterDef).activeFilterDef; + } + getDefs(column, filterDef, overrideIndex) { + if (!this.isSelectable(filterDef)) { + return void 0; + } + const beans = this.beans; + const { gos, dataTypeSvc, colFilter } = beans; + let filterParams = filterDef.filterParams; + const colDef = column.colDef; + if (typeof filterParams === "function") { + filterParams = filterParams( + _addGridCommonParams22(gos, { + column, + colDef + }) + ); + } + const cellDataType = dataTypeSvc?.getBaseDataType(column); + const dataTypeDefinition = dataTypeSvc?.getDataTypeDefinition(column); + const formatValue = dataTypeSvc?.getFormatValue(cellDataType); + const { filters, defaultFilterParams, defaultFilterIndex } = filterParams ?? {}; + const updateDef = (def) => { + const { filter, filterParams: defFilterParams, name, filterValueGetter = colDef.filterValueGetter } = def; + const userParams = defaultFilterParams ? { ...defaultFilterParams, ...defFilterParams } : defFilterParams; + let updatedParams; + if (dataTypeDefinition && formatValue) { + if (filter === "agMultiColumnFilter") { + updatedParams = beans.multiFilter?.getParamsForDataType( + userParams, + filterValueGetter, + dataTypeDefinition, + formatValue + ); + } else { + updatedParams = _getFilterParamsForDataType2( + filter, + userParams, + filterValueGetter, + dataTypeDefinition, + formatValue, + beans, + this.getLocaleTextFunc() + ); + } + } + let updatedName; + if (!name) { + let filterString = filter; + if (typeof filter === "boolean") { + filterString = colFilter?.getDefaultFilterFromDataType(() => cellDataType); + } + if (typeof filterString === "string") { + updatedName = translateForFilterPanel(this, `${filterString}DisplayName`); + } else { + _warn37(280, { colId: column.getColId() }); + updatedName = ""; + } + } + if (defaultFilterParams || updatedParams || updatedName) { + return { + ...def, + filterParams: userParams, + name: updatedName ?? name, + ...updatedParams + }; + } + return def; + }; + const filterDefs = (filters ?? this.getDefaultFilters(column)).map(updateDef); + let index = overrideIndex ?? // provided override + this.selectedFilters.get(column.getColId()) ?? // UI selected value + defaultFilterIndex ?? // col def value + (!filters && _isSetFilterByDefault(gos) ? 1 : 0); + if (index >= filterDefs.length) { + index = 0; + } + const activeFilterDef = filterDefs[index]; + return { filterDefs, activeFilterDef }; + } + setActive(colId, filterDefs, activeFilterDef, silent) { + const index = filterDefs.indexOf(activeFilterDef); + if (index < 0) { + return; + } + const { selectedFilters, valueGetters } = this; + selectedFilters.set(colId, index); + const filterValueGetter = activeFilterDef.filterValueGetter; + if (filterValueGetter) { + valueGetters.set(colId, filterValueGetter); + } else { + valueGetters.delete(colId); + } + if (!silent) { + this.onChange(); + } + } + clearActive(colId) { + const { selectedFilters, valueGetters } = this; + selectedFilters.delete(colId); + valueGetters.delete(colId); + this.onChange(); + } + getState() { + return Object.fromEntries(this.selectedFilters); + } + setState(state) { + this.clearAll(); + const colModel = this.beans.colModel; + for (const colId of Object.keys(state)) { + const column = colModel.getColDefCol(colId); + if (column) { + const defs = this.getDefs(column, column.colDef, state[colId]); + if (defs) { + this.setActive(colId, defs.filterDefs, defs.activeFilterDef, true); + } + } + } + } + destroy() { + this.clearAll(); + super.destroy(); + } + clearAll() { + const { selectedFilters, valueGetters } = this; + selectedFilters.clear(); + valueGetters.clear(); + } + onChange() { + this.dispatchLocalEvent({ + type: "selectedFilterChanged" + }); + } + getDefaultFilters(column) { + const beans = this.beans; + const { gos, dataTypeSvc } = beans; + const isMultiFilterEnabled = gos.isModuleRegistered("MultiFilter"); + const cellDataType = dataTypeSvc?.getBaseDataType(column); + const simpleFilter = _getDefaultSimpleFilter2(cellDataType, false); + return [ + { filter: simpleFilter }, + { filter: "agSetColumnFilter" }, + ...isMultiFilterEnabled ? [ + { + filter: "agMultiColumnFilter" + } + ] : [] + ]; + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/wrapperToolPanel.ts +import { Component as Component51, _warn as _warn38 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterPanel.ts +import { + Component as Component50, + FilterButtonComp as FilterButtonComp3, + RefPlaceholder as RefPlaceholder44, + _focusInto as _focusInto8, + _getActiveDomElement as _getActiveDomElement14, + _isNothingFocused as _isNothingFocused4, + _removeFromParent as _removeFromParent10, + _translateForFilter +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/addFilterComp.ts +import { Component as Component46, _clearElement as _clearElement17, _createElement as _createElement15, _createIconNoSpan as _createIconNoSpan23 } from "ag-grid-community"; +var AddFilterElement = { + tag: "div", + cls: "ag-filter-card ag-filter-card-add" +}; +var AddFilterComp = class extends Component46 { + constructor(options) { + super(AddFilterElement); + this.options = /* @__PURE__ */ new Map(); + this.setOptions(options); + } + postConstruct() { + this.showButton(); + } + refresh(newOptions) { + this.setOptions(newOptions); + const { eSelect, options } = this; + if (eSelect) { + eSelect.setValueList({ valueList: Array.from(options.keys()), refresh: true }); + } + } + showButton() { + _clearElement17(this.getGui()); + this.destroySelect(); + const eButton = _createElement15({ + tag: "button", + cls: "ag-button ag-standard-button ag-filter-add-button", + children: [ + { tag: "span", children: [() => _createIconNoSpan23("filterAdd", this.beans)] }, + { + tag: "span", + cls: "ag-filter-add-button-label", + children: translateForFilterPanel(this, "addFilterCard") + } + ] + }); + this.activateTabIndex([eButton]); + const clickListener = this.showSelect.bind(this); + eButton.addEventListener("click", clickListener); + this.removeButton = () => { + eButton.removeEventListener("click", clickListener); + }; + this.appendChild(eButton); + eButton.focus(); + } + showSelect() { + _clearElement17(this.getGui()); + this.destroyButton(); + const pickerAriaLabelKey = "ariaLabelAddFilterField"; + const selectParams = { + className: "ag-filter-add-select", + pickerType: "virtual-list", + pickerAriaLabelKey, + pickerAriaLabelValue: translateForFilterPanel(this, pickerAriaLabelKey), + placeholder: translateForFilterPanel(this, "addFilterPlaceholder"), + value: "", + valueList: Array.from(this.options.keys()), + searchType: "matchAny", + allowTyping: true, + filterList: true, + highlightMatch: true, + valueFormatter: (value) => this.options.get(value) + }; + const eSelect = this.createManagedBean(new AgRichSelect(selectParams)); + this.eSelect = eSelect; + this.appendChild(eSelect.getGui()); + eSelect.showPicker(); + eSelect.getFocusableElement().focus(); + eSelect.addManagedListeners(eSelect, { + fieldPickerValueSelected: ({ value: id }) => this.dispatchLocalEvent({ + type: "filterSelected", + id + }), + pickerHidden: () => { + this.showButton(); + } + }); + } + setOptions(newOptions) { + const options = this.options; + options.clear(); + for (const { id, name } of newOptions) { + options.set(id, name); + } + } + destroySelect() { + this.eSelect = this.destroyBean(this.eSelect); + } + destroyButton() { + this.removeButton = this.removeButton?.(); + } + destroy() { + this.destroySelect(); + this.destroyButton(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterCardComp.ts +import { + Component as Component49, + RefPlaceholder as RefPlaceholder43, + _clearElement as _clearElement18, + _createIcon as _createIcon3, + _removeFromParent as _removeFromParent9, + _setAriaControls, + _setAriaExpanded as _setAriaExpanded11, + _setAriaLabel as _setAriaLabel19, + _setDisplayed as _setDisplayed22 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterDetailComp.ts +import { AgSelectSelector, Component as Component47, RefPlaceholder as RefPlaceholder42, _removeFromParent as _removeFromParent8 } from "ag-grid-community"; +var FilterDetailElement = { + tag: "div", + cls: "ag-filter-card-body", + children: [{ tag: "ag-select", cls: "ag-filter-type-select", ref: "eFilterType" }] +}; +var FilterDetailComp = class extends Component47 { + constructor() { + super(...arguments); + this.eFilterType = RefPlaceholder42; + } + postConstruct() { + const eFilterTypeParams = { + onValueChange: (filterDef) => this.dispatchLocalEvent({ type: "filterTypeChanged", filterDef }) + }; + this.setTemplate(FilterDetailElement, [AgSelectSelector], { eFilterType: eFilterTypeParams }); + this.eFilterType.setDisplayed(false); + } + refresh(newState) { + const oldState = this.state; + this.state = newState; + const { + activeFilterDef: newActiveFilterDef, + filterDefs: newFilterDefs, + detail: newDetail, + afterGuiAttached, + afterGuiDetached + } = newState; + const { activeFilterDef: oldActiveFilterDef, filterDefs: oldFilterDefs, detail: oldDetail } = oldState ?? {}; + const eFilterType = this.eFilterType; + if (newFilterDefs !== oldFilterDefs) { + eFilterType.clearOptions(); + const options = newFilterDefs?.map((filterDef) => ({ value: filterDef, text: filterDef.name })); + if (options) { + eFilterType.clearOptions().addOptions(options).setValue(newActiveFilterDef, true); + } + eFilterType.setDisplayed(!!options); + } else if (newActiveFilterDef !== oldActiveFilterDef) { + eFilterType.setValue(newActiveFilterDef, true); + } + if (newDetail !== oldDetail) { + if (oldDetail) { + _removeFromParent8(oldDetail); + afterGuiDetached(); + } + this.appendChild(newDetail); + afterGuiAttached({ + container: "newFiltersToolPanel", + suppressFocus: true + }); + } + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterSummaryComp.ts +import { Component as Component48 } from "ag-grid-community"; +var FilterSummaryElement = { + tag: "div", + cls: "ag-filter-card-summary", + attrs: { + "aria-hidden": "true" + } +}; +var FilterSummaryComp = class extends Component48 { + constructor() { + super(FilterSummaryElement); + } + refresh(state) { + this.getGui().textContent = state.summary; + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterCardComp.ts +var FilterCardElement = { + tag: "div", + cls: "ag-filter-card", + children: [ + { + tag: "div", + cls: "ag-filter-card-header", + role: "presentation", + children: [ + { + tag: "div", + cls: "ag-filter-card-heading", + role: "heading", + attrs: { + "aria-level": "2" + }, + children: [ + { + tag: "button", + ref: "eExpand", + cls: "ag-button ag-filter-card-expand", + children: [ + { tag: "span", ref: "eTitle", cls: "ag-filter-card-title" }, + { tag: "span", ref: "eEditing", cls: "ag-filter-card-editing-icon" }, + { tag: "span", ref: "eExpandIcon", cls: "ag-filter-card-expand-icon" } + ] + } + ] + }, + { + tag: "button", + ref: "eDelete", + cls: "ag-button ag-filter-card-delete", + children: [{ tag: "span", ref: "eDeleteIcon", cls: "ag-filter-card-delete-icon" }] + } + ] + } + ] +}; +var FilterCardComp = class extends Component49 { + constructor(id) { + super(FilterCardElement); + this.id = id; + this.eTitle = RefPlaceholder43; + this.eExpand = RefPlaceholder43; + this.eDelete = RefPlaceholder43; + this.eExpandIcon = RefPlaceholder43; + this.eDeleteIcon = RefPlaceholder43; + this.eEditing = RefPlaceholder43; + } + postConstruct() { + const { beans, eDelete, eExpand, eDeleteIcon, eEditing, id } = this; + const filterPanelService = beans.filterPanelSvc; + _setAriaLabel19(eDelete, translateForFilterPanel(this, "ariaLabelFilterCardDelete")); + eDeleteIcon.appendChild(_createIcon3("close", beans, null)); + this.activateTabIndex([eExpand, eDelete]); + this.addManagedElementListeners(eExpand, { + click: () => filterPanelService.expand(id, !this.state?.expanded) + }); + this.addManagedElementListeners(eDelete, { + click: () => filterPanelService.remove(id) + }); + this.addManagedEventListeners({ filterOpened: this.onFilterOpened.bind(this) }); + eEditing.appendChild(_createIcon3("filterCardEditing", beans, null)); + } + refresh(newState) { + const { eExpand, eEditing, state: oldState, beans } = this; + this.state = newState; + const { name, expanded, isEditing } = newState; + this.eTitle.textContent = name; + _setDisplayed22(eEditing, isEditing); + if (!oldState || expanded !== oldState.expanded) { + this.toggleExpand(newState); + } + let ariaLabel = expanded ? null : `${name} ${newState.summary}`; + if (isEditing) { + ariaLabel = `${ariaLabel ?? name}. ${translateForFilterPanel(this, "ariaLabelFilterCardHasEdits")}`; + } + _setAriaLabel19(eExpand, ariaLabel); + const removeComp = (comp) => { + if (!comp) { + return; + } + _removeFromParent9(comp.getGui()); + return this.destroyBean(comp); + }; + const createOrRefreshComp = (comp, FilterComp5, postCreateFunc) => { + if (!comp) { + comp = this.createBean(new FilterComp5()); + postCreateFunc?.(comp); + this.appendChild(comp.getGui()); + } + comp.refresh(newState); + return comp; + }; + if (newState.expanded) { + this.summaryComp = removeComp(this.summaryComp); + const detailComp = createOrRefreshComp( + this.detailComp, + FilterDetailComp, + (comp) => comp.addManagedListeners(comp, { + filterTypeChanged: ({ filterDef }) => beans.filterPanelSvc.updateType(this.id, filterDef) + }) + ); + this.detailComp = detailComp; + const detailId = `ag-${this.getCompId()}-filter`; + detailComp.getGui().id = detailId; + _setAriaControls(eExpand, detailId); + } else { + this.detailComp = removeComp(this.detailComp); + this.summaryComp = createOrRefreshComp(this.summaryComp, FilterSummaryComp); + _setAriaControls(eExpand, null); + } + } + toggleExpand(state) { + const expanded = !!state.expanded; + const { eExpandIcon, eExpand, beans } = this; + _clearElement18(eExpandIcon); + eExpandIcon.appendChild(_createIcon3(expanded ? "filterCardCollapse" : "filterCardExpand", beans, null)); + _setAriaExpanded11(eExpand, expanded); + } + onFilterOpened(event) { + const { state, beans, id } = this; + if (event.source === "COLUMN_MENU" && event.column === state?.column && state?.expanded) { + beans.filterPanelSvc.expand(id, false); + } + } + destroy() { + this.detailComp = this.destroyBean(this.detailComp); + this.summaryComp = this.destroyBean(this.summaryComp); + this.state = void 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/filterPanel.ts +function isSingleRefresh(params) { + return !!params?.id; +} +function isActionRefresh(params) { + return !!params?.action; +} +var FilterPanelElement = { + tag: "div", + cls: "ag-filter-panel", + children: [{ tag: "div", cls: "ag-filter-panel-container", ref: "eContainer" }] +}; +var FilterPanel = class extends Component50 { + constructor() { + super(FilterPanelElement); + this.eContainer = RefPlaceholder44; + this.filters = /* @__PURE__ */ new Map(); + } + refresh(params) { + if (isActionRefresh(params)) { + this.refreshActions(); + return; + } + if (isSingleRefresh(params)) { + this.filters.get(params.id)?.refresh(params.state); + return; + } + const { eContainer, filters: existingFilters, beans } = this; + const filterPanelSvc = beans.filterPanelSvc; + const filterIds = filterPanelSvc.getIds(); + const newFilters = /* @__PURE__ */ new Map(); + const somethingIsFocused = !_isNothingFocused4(beans); + const activeElement = somethingIsFocused ? _getActiveDomElement14(beans) : void 0; + const containerHasFocus = somethingIsFocused && eContainer.contains(activeElement); + const ePrevItems = []; + const eNewItems = []; + for (const id of filterIds) { + const newFilter = existingFilters.get(id) ?? this.createBean(new FilterCardComp(id)); + newFilter.refresh(filterPanelSvc.getState(id)); + newFilters.set(id, newFilter); + eNewItems.push(newFilter.getGui()); + } + this.filters = newFilters; + const compsToDestroy = []; + existingFilters.forEach((existingFilter, id) => { + ePrevItems.push(existingFilter.getGui()); + if (!newFilters.has(id)) { + compsToDestroy.push(existingFilter); + } + }); + let addFilterComp = this.addFilterComp; + if (addFilterComp) { + ePrevItems.push(addFilterComp.getGui()); + } + const addFilterOptions = filterPanelSvc.getAvailable(); + if (addFilterOptions.length) { + if (!addFilterComp) { + addFilterComp = this.createBean(new AddFilterComp(addFilterOptions)); + addFilterComp.addManagedListeners(addFilterComp, { + filterSelected: ({ id }) => filterPanelSvc.add(id) + }); + } + addFilterComp.refresh(addFilterOptions); + eNewItems.push(addFilterComp.getGui()); + } else { + addFilterComp = this.destroyBean(addFilterComp); + } + this.addFilterComp = addFilterComp; + compareAndUpdateListsInDom(eContainer, eNewItems, ePrevItems); + for (const comp of compsToDestroy) { + this.destroyBean(comp); + } + const activeId = params?.activeId; + const activeItemToFocus = activeId && newFilters.get(activeId)?.getGui(); + if (activeItemToFocus) { + _focusInto8(activeItemToFocus); + } else if (containerHasFocus && _isNothingFocused4(beans)) { + _focusInto8(eNewItems[eNewItems.length - 1] ?? eContainer); + } + this.refreshActions(); + } + refreshActions() { + const filterPanelSvc = this.beans.filterPanelSvc; + const { actions, canApply } = filterPanelSvc.getActions() ?? {}; + let buttonComp = this.buttonComp; + if (actions?.length) { + const buttons = actions.map((type) => ({ + type, + label: _translateForFilter(this, `${type}Filter`) + })); + if (!buttonComp) { + buttonComp = this.createBean(new FilterButtonComp3({ className: "ag-filter-panel-buttons" })); + this.getGui().appendChild(buttonComp.getGui()); + const listeners = {}; + for (const action of ["apply", "clear", "reset", "cancel"]) { + listeners[action] = () => filterPanelSvc.doAction(action); + } + buttonComp.addManagedListeners(buttonComp, listeners); + } + buttonComp.updateButtons(buttons); + buttonComp.updateValidity(canApply !== false); + } else if (buttonComp) { + _removeFromParent10(buttonComp.getGui()); + buttonComp = this.destroyBean(buttonComp); + } + this.buttonComp = buttonComp; + } + destroy() { + this.beans.filterPanelSvc?.clear?.(); + this.addFilterComp = this.destroyBean(this.addFilterComp); + this.buttonComp = this.destroyBean(this.buttonComp); + const filters = this.filters; + filters.forEach((filter) => this.destroyBean(filter)); + filters.clear(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/newFiltersToolPanel.css +var newFiltersToolPanel_default = ".ag-filter-panel{display:flex;flex-direction:column;width:100%;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-filter-panel .ag-simple-filter-body-wrapper{padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel .ag-mini-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-vertical-spacing)}.ag-filter-panel-container{display:flex;flex:1;flex-direction:column;gap:var(--ag-widget-container-vertical-padding);overflow:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-card{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius)}.ag-filter-card-header{align-items:center;display:flex;flex-direction:row;gap:var(--ag-spacing);padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-heading{flex:1;overflow:hidden;padding-bottom:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing));padding-top:calc(var(--ag-widget-container-vertical-padding) - var(--ag-widget-vertical-spacing))}:where(.ag-ltr) .ag-filter-card-heading{padding-left:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-heading{padding-right:var(--ag-widget-horizontal-spacing)}.ag-filter-card-expand{align-items:center;display:flex;flex-direction:row;width:100%}.ag-filter-card-title{font-weight:var(--ag-header-font-weight);overflow:hidden;text-overflow:ellipsis}.ag-filter-card-expand-icon{display:flex;flex:1;justify-content:end}.ag-filter-card-editing-icon{margin:0 var(--ag-spacing)}.ag-filter-card-delete-icon,.ag-filter-card-editing-icon,.ag-filter-card-expand-icon,.ag-filter-card-summary{color:var(--ag-filter-panel-card-subtle-color)}.ag-filter-card-delete-icon,.ag-filter-card-expand-icon{transition:color .25s ease-in-out}.ag-filter-card-delete-icon:hover,.ag-filter-card-expand-icon:hover,.ag-filter-card-heading:hover .ag-filter-card-expand-icon{color:var(--ag-filter-panel-card-subtle-hover-color)}.ag-filter-add-button,.ag-filter-card-delete,.ag-filter-card-expand{border-radius:var(--ag-button-border-radius)}.ag-filter-card-summary,.ag-filter-type-select{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-filter-card-delete{margin-right:var(--ag-widget-horizontal-spacing)}:where(.ag-rtl) .ag-filter-card-delete{margin-left:var(--ag-widget-horizontal-spacing)}.ag-filter-card-summary{margin-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-type-select{padding-top:var(--ag-widget-vertical-spacing)}.ag-filter-card-add{border:0;padding:0}.ag-filter-add-button{align-items:center;display:flex;flex-direction:row;line-height:1.5;width:100%}:where(.ag-ltr) .ag-filter-add-button-label{margin-left:var(--ag-spacing)}:where(.ag-rtl) .ag-filter-add-button-label{margin-right:var(--ag-spacing)}.ag-filter-add-select{border:0;.ag-rich-select-value{border:0;padding:calc(((1.5*var(--ag-font-size) + 2*var(--ag-button-vertical-padding)) - var(--ag-input-height))/2) var(--ag-spacing)}}:where(.ag-ltr) .ag-filter-add-select{.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)!important}}:where(.ag-rtl) .ag-filter-add-select{.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)!important}}.ag-filter-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0}.ag-filter-panel-buttons-button{line-height:1.5}.ag-filter-panel .ag-filter-panel-buttons-apply-button{background-color:var(--ag-filter-panel-apply-button-background-color);color:var(--ag-filter-panel-apply-button-color)}.ag-filter-panel-buttons:where(:last-child),.ag-filter-panel-container:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-filter-panel .ag-set-filter-body-wrapper,.ag-filter-panel .ag-simple-filter-body-wrapper{padding-bottom:var(--ag-widget-container-vertical-padding)}"; + +// packages/ag-grid-enterprise/src/filterToolPanel/newFilterToolPanel/wrapperToolPanel.ts +var WrapperToolPanel = class extends Component51 { + constructor() { + super(); + this.registerCSS(newFiltersToolPanel_default); + } + init(params) { + if (!this.gos.get("enableFilterHandlers")) { + _warn38(282); + return; + } + const filterPanelSvc = this.beans.filterPanelSvc; + filterPanelSvc.isActive = true; + this.addDestroyFunc(() => { + filterPanelSvc.isActive = false; + }); + this.updateParams(params, params.initialState); + const filterPanel = this.createManagedBean(new FilterPanel()); + this.filterPanel = filterPanel; + const refresh = (event) => { + filterPanel.refresh(event); + params.onStateUpdated(); + }; + refresh(); + this.addManagedListeners(filterPanelSvc, { + filterPanelStatesChanged: refresh, + filterPanelStateChanged: refresh + }); + } + getGui() { + return this.filterPanel?.getGui(); + } + refresh(params) { + this.updateParams(params, params.initialState); + return true; + } + updateParams(params, initialState) { + this.beans.filterPanelSvc?.updateParams(params, initialState); + } + getState() { + return this.beans.filterPanelSvc?.getGridState() ?? {}; + } +}; + +// packages/ag-grid-enterprise/src/filterToolPanel/filtersToolPanelModule.ts +var FiltersToolPanelModule = { + moduleName: "FiltersToolPanel", + version: VERSION, + userComponents: { agFiltersToolPanel: FiltersToolPanel }, + icons: { + // filter tool panel tab + filtersToolPanel: "filter" + }, + dependsOn: [SideBarModule, EnterpriseCoreModule, _ColumnFilterModule4] +}; +var NewFiltersToolPanelModule = { + moduleName: "NewFiltersToolPanel", + version: VERSION, + userComponents: { agNewFiltersToolPanel: WrapperToolPanel }, + beans: [FilterPanelService, SelectableFilterService], + icons: { + // filter add button in new filter tool panel + filterAdd: "filter-add", + // filter tool panel tab + filtersToolPanel: "filter", + // open icon for rich select + richSelectOpen: "small-down", + // remove for rich select editor pills + richSelectRemove: "cancel", + // loading async values + richSelectLoading: "loading", + // button to expand filter card in new filter tool panel + filterCardExpand: "chevron-down", + // button to collapse filter card in new filter tool panel + filterCardCollapse: "chevron-up", + // indicates filter card in new filter tool panel has edits + filterCardEditing: "edit" + }, + dependsOn: [SideBarModule, EnterpriseCoreModule, _ColumnFilterModule4] +}; + +// packages/ag-grid-enterprise/src/masterDetail/masterDetailModule.ts +import { EventApiModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/masterDetail/detailCellRenderer.ts +import { Component as Component52, RefPlaceholder as RefPlaceholder45, _getGridRegisteredModules, _missing as _missing5, _warn as _warn40, createGrid } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/masterDetail/detailCellRendererCtrl.ts +import { BeanStub as BeanStub50, _addGridCommonParams as _addGridCommonParams23, _focusInto as _focusInto9, _isSameRow as _isSameRow2, _missing as _missing4, _warn as _warn39 } from "ag-grid-community"; +var DetailCellRendererCtrl = class extends BeanStub50 { + constructor() { + super(...arguments); + this.loadRowDataVersion = 0; + } + wireBeans(beans) { + this.environment = beans.environment; + } + init(comp, params) { + this.params = params; + this.comp = comp; + const doNothingBecauseInsidePinnedSection = params.pinned != null; + if (doNothingBecauseInsidePinnedSection) { + return; + } + this.setAutoHeightClasses(); + this.setupRefreshStrategy(); + this.createDetailGrid(); + this.loadRowData(); + this.addManagedEventListeners({ fullWidthRowFocused: this.onFullWidthRowFocused.bind(this) }); + } + onFullWidthRowFocused(e) { + const params = this.params; + const row = { rowIndex: params.node.rowIndex, rowPinned: params.node.rowPinned }; + const eventRow = { rowIndex: e.rowIndex, rowPinned: e.rowPinned }; + const isSameRow = _isSameRow2(row, eventRow); + if (!isSameRow) { + return; + } + _focusInto9(this.comp.getGui(), e.fromBelow); + } + setAutoHeightClasses() { + const autoHeight = this.gos.get("detailRowAutoHeight"); + const parentClass = autoHeight ? "ag-details-row-auto-height" : "ag-details-row-fixed-height"; + const detailClass = autoHeight ? "ag-details-grid-auto-height" : "ag-details-grid-fixed-height"; + const comp = this.comp; + comp.toggleCss(parentClass, true); + comp.toggleDetailGridCss(detailClass, true); + } + setupRefreshStrategy() { + const providedStrategy = this.params.refreshStrategy; + const validSelection = providedStrategy == "everything" || providedStrategy == "nothing" || providedStrategy == "rows"; + if (validSelection) { + this.refreshStrategy = providedStrategy; + return; + } + if (providedStrategy != null) { + _warn39(170, { providedStrategy }); + } + this.refreshStrategy = "rows"; + } + createDetailGrid() { + const { params, gos } = this; + if (_missing4(params.detailGridOptions)) { + _warn39(171); + return; + } + const masterTheme = gos.get("theme"); + const detailTheme = params.detailGridOptions.theme; + if (detailTheme && detailTheme !== masterTheme) { + _warn39(267); + } + const gridOptions = { + themeStyleContainer: this.environment.eStyleContainer, + ...params.detailGridOptions, + theme: masterTheme + }; + const autoHeight = gos.get("detailRowAutoHeight"); + if (autoHeight) { + gridOptions.domLayout = "autoHeight"; + } + this.comp.setDetailGrid(gridOptions); + } + registerDetailWithMaster(api) { + const { + params, + beans: { selectionSvc, findSvc, expansionSvc } + } = this; + const rowId = params.node.id; + const masterGridApi = params.api; + const gridInfo = { + id: rowId, + api + }; + const rowNode = params.node; + if (masterGridApi.isDestroyed()) { + return; + } + masterGridApi.addDetailGridInfo(rowId, gridInfo); + rowNode.detailGridInfo = gridInfo; + const masterNode = rowNode.parent; + findSvc?.registerDetailGrid(rowNode, api); + function onDetailSelectionChanged() { + if (masterNode) { + selectionSvc?.refreshMasterNodeState(masterNode); + } + } + function adjustDetailsOnExpandOrCollapseAll({ source }) { + if (source === "expandAll") { + return api.expandAll(); + } + if (source === "collapseAll") { + return api.collapseAll(); + } + } + function onMasterRowSelected({ node, source }) { + if (node !== masterNode || source === "masterDetail" || api.isDestroyed()) { + return; + } + selectionSvc?.setDetailSelectionState(masterNode, params.detailGridOptions, api); + } + api.addEventListener("firstDataRendered", () => { + if (api.isDestroyed() || masterGridApi.isDestroyed()) { + return; + } + selectionSvc?.setDetailSelectionState(masterNode, params.detailGridOptions, api); + api.addEventListener("selectionChanged", onDetailSelectionChanged); + masterGridApi.addEventListener("rowSelected", onMasterRowSelected); + const sharedApiModuleName = "CsrmSsrmSharedApi"; + const asAgModuleName = `${sharedApiModuleName}Module`; + if (api.isModuleRegistered(asAgModuleName)) { + masterGridApi.addEventListener("expandOrCollapseAll", adjustDetailsOnExpandOrCollapseAll); + expansionSvc?.setDetailsExpansionState(api); + } + }); + this.addManagedListeners(masterNode, { + masterChanged: (event) => { + if (!event.node.master) { + this.onDestroy(gridInfo); + } + } + }); + this.addDestroyFunc(() => this.onDestroy(gridInfo)); + } + onDestroy(gridInfo) { + const { params } = this; + const rowNode = params.node; + const masterGridApi = params.api; + if (rowNode.detailGridInfo !== gridInfo) { + return; + } + if (!masterGridApi.isDestroyed()) { + masterGridApi.removeDetailGridInfo(rowNode.id); + } + rowNode.detailGridInfo = null; + } + loadRowData() { + this.loadRowDataVersion++; + const versionThisCall = this.loadRowDataVersion; + const params = this.params; + if (params.detailGridOptions?.rowModelType === "serverSide") { + const node = params.node; + node.detailGridInfo?.api?.refreshServerSide({ purge: true }); + return; + } + const userFunc = params.getDetailRowData; + if (!userFunc) { + _warn39(172); + return; + } + const successCallback = (rowData) => { + const mostRecentCall = this.loadRowDataVersion === versionThisCall; + if (mostRecentCall) { + this.comp.setRowData(rowData); + } + }; + const funcParams = { + node: params.node, + // we take data from node, rather than params.data + // as the data could have been updated with new instance + data: params.node.data, + successCallback, + context: _addGridCommonParams23(this.gos, {}).context + }; + userFunc(funcParams); + } + refresh() { + const GET_GRID_TO_REFRESH = false; + const GET_GRID_TO_DO_NOTHING = true; + switch (this.refreshStrategy) { + case "nothing": + return GET_GRID_TO_DO_NOTHING; + case "everything": + return GET_GRID_TO_REFRESH; + } + this.loadRowData(); + return GET_GRID_TO_DO_NOTHING; + } +}; + +// packages/ag-grid-enterprise/src/masterDetail/detailFrameworkComponentWrapper.ts +var DetailFrameworkComponentWrapper = class { + constructor(parentWrapper) { + this.parentWrapper = parentWrapper; + } + wrap(frameworkComponent, mandatoryMethods, optionalMethods, componentType) { + return this.parentWrapper.wrap(frameworkComponent, mandatoryMethods, optionalMethods, componentType); + } +}; + +// packages/ag-grid-enterprise/src/masterDetail/detailCellRenderer.ts +var PinnedDetailCellRendererElement = { tag: "div", cls: "ag-details-row" }; +var DetailCellRendererElement = { + tag: "div", + cls: "ag-details-row", + role: "gridcell", + children: [{ tag: "div", ref: "eDetailGrid", cls: "ag-details-grid", role: "presentation" }] +}; +var DetailCellRenderer = class extends Component52 { + constructor() { + super(...arguments); + this.eDetailGrid = RefPlaceholder45; + } + wireBeans(beans) { + this.context = beans.context; + } + init(params) { + this.params = params; + this.selectAndSetTemplate(); + const compProxy = { + toggleCss: (cssClassName, on) => this.toggleCss(cssClassName, on), + toggleDetailGridCss: (cssClassName, on) => this.eDetailGrid.classList.toggle(cssClassName, on), + setDetailGrid: (gridOptions) => this.setDetailGrid(gridOptions), + setRowData: (rowData) => this.setRowData(rowData), + getGui: () => this.eDetailGrid + }; + this.ctrl = this.createManagedBean(new DetailCellRendererCtrl()); + this.ctrl.init(compProxy, params); + } + refresh() { + return this.ctrl?.refresh() ?? false; + } + selectAndSetTemplate() { + const params = this.params; + if (params.pinned) { + this.setTemplate(PinnedDetailCellRendererElement); + return; + } + const setDefaultTemplate = () => { + this.setTemplate(DetailCellRendererElement); + }; + if (_missing5(params.template)) { + setDefaultTemplate(); + } else if (typeof params.template === "string") { + this.setTemplate(params.template, []); + } else if (typeof params.template === "function") { + const templateFunc = params.template; + const template = templateFunc(params); + this.setTemplate(template, []); + } else { + _warn40(168); + setDefaultTemplate(); + } + if (this.eDetailGrid == null) { + _warn40(169); + } + } + setDetailGrid(gridOptions) { + if (!this.eDetailGrid) { + return; + } + const parentFrameworkComponentWrapper = this.context.getBean("frameworkCompWrapper"); + const frameworkCompWrapper = new DetailFrameworkComponentWrapper(parentFrameworkComponentWrapper); + const { frameworkOverrides } = this.beans; + const api = createGrid(this.eDetailGrid, gridOptions, { + frameworkOverrides, + providedBeanInstances: { frameworkCompWrapper }, + modules: _getGridRegisteredModules(this.params.api.getGridId(), gridOptions.rowModelType ?? "clientSide") + }); + this.detailApi = api; + this.ctrl?.registerDetailWithMaster(api); + this.addDestroyFunc(() => { + api.destroy(); + }); + } + setRowData(rowData) { + this.detailApi?.setGridOption("rowData", rowData); + } +}; + +// packages/ag-grid-enterprise/src/masterDetail/masterDetailApi.ts +function operateOnStore(beans, callback) { + const store = beans.masterDetailSvc?.store; + return store ? callback(store) : void 0; +} +function addDetailGridInfo(beans, id, gridInfo) { + operateOnStore(beans, (store) => { + store[id] = gridInfo; + }); +} +function removeDetailGridInfo(beans, id) { + operateOnStore(beans, (store) => { + delete store[id]; + }); +} +function getDetailGridInfo(beans, id) { + return operateOnStore(beans, (store) => store[id]); +} +function forEachDetailGridInfo(beans, callback) { + operateOnStore(beans, (store) => { + let index = 0; + Object.values(store).forEach((gridInfo) => { + if (gridInfo) { + callback(gridInfo, index++); + } + }); + }); +} + +// packages/ag-grid-enterprise/src/masterDetail/masterDetailModule.css +var masterDetailModule_default = ".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}"; + +// packages/ag-grid-enterprise/src/masterDetail/masterDetailService.ts +import { + BeanStub as BeanStub51, + RowNode as RowNode3, + _exists as _exists23, + _getClientSideRowModel, + _isClientSideRowModel as _isClientSideRowModel8, + _isServerSideRowModel as _isServerSideRowModel3, + _observeResize as _observeResize2 +} from "ag-grid-community"; +var MasterDetailService = class extends BeanStub51 { + constructor() { + super(...arguments); + this.beanName = "masterDetailSvc"; + this.store = {}; + } + isEnabled() { + return this.gos.get("masterDetail"); + } + postConstruct() { + const gos = this.gos; + if (_isClientSideRowModel8(gos)) { + this.enabled = this.isEnabled(); + } + if (_isServerSideRowModel3(gos)) { + this.addEventListeners(); + } + } + addEventListeners() { + const rowNodeDataChanged = (event) => { + this.setMaster(event.node, false, true); + }; + let removeListeners; + const addOrRemoveListeners = () => { + if (removeListeners) { + for (const removeListener of removeListeners) { + removeListener(); + } + removeListeners = void 0; + } + if (this.isEnabled()) { + removeListeners = this.addManagedListeners(this.beans.eventSvc, { rowNodeDataChanged }); + } + }; + addOrRemoveListeners(); + this.gos.addPropertyEventListener("masterDetail", addOrRemoveListeners); + } + refreshModel(params) { + if (params.changedProps) { + const enabled = this.isEnabled(); + if (this.enabled !== enabled) { + this.setMasters(null); + return; + } + } + if (params.rowDataUpdated) { + this.setMasters(params.changedRowNodes); + } + } + setMaster(row, created, updated) { + const oldMaster = row.master; + const enabled = this.isEnabled(); + let newMaster = enabled; + const gos = this.gos; + const isRowMaster = gos.get("isRowMaster"); + const treeData = gos.get("treeData"); + if (enabled) { + if (created || updated) { + if (isRowMaster) { + const data = row.data; + newMaster = !!data && !!isRowMaster(data); + } + } else { + newMaster = oldMaster; + } + } + if (!treeData) { + if (newMaster && created || // if changing AWAY from master, forget current state + !newMaster && oldMaster) { + row._expanded ?? (row._expanded = null); + } + } + if (newMaster !== oldMaster) { + row.master = newMaster; + row.dispatchRowEvent("masterChanged"); + } + } + setMasters(changedRowNodes) { + this.enabled = this.isEnabled(); + if (changedRowNodes) { + for (const node of changedRowNodes.updates) { + this.setMaster(node, false, true); + } + for (const node of changedRowNodes.adds) { + this.setMaster(node, true, false); + } + } else { + const allLeafChildren = _getClientSideRowModel(this.beans)?.rootNode?._leafs; + if (allLeafChildren) { + for (let i = 0, len = allLeafChildren.length; i < len; ++i) { + this.setMaster(allLeafChildren[i], true, false); + } + } + } + } + /** Used by flatten stage to get or create a detail node from a master node */ + getDetail(masterNode) { + if (!masterNode.master || !masterNode.expanded) { + return null; + } + let detailNode = masterNode.detailNode; + if (detailNode) { + return detailNode; + } + detailNode = new RowNode3(this.beans); + detailNode.detail = true; + detailNode.selectable = false; + detailNode.parent = masterNode; + if (_exists23(masterNode.id)) { + detailNode.id = "detail_" + masterNode.id; + } + detailNode.data = masterNode.data; + detailNode.level = masterNode.level + 1; + masterNode.detailNode = detailNode; + return detailNode; + } + setupDetailRowAutoHeight(rowCtrl, eDetailGui) { + const { gos, beans } = this; + if (!gos.get("detailRowAutoHeight")) { + return; + } + const checkRowSizeFunc = () => { + const clientHeight = eDetailGui.clientHeight; + if (clientHeight != null && clientHeight > 0) { + const updateRowHeightFunc = () => { + const { rowModel } = this.beans; + const { rowNode } = rowCtrl; + rowNode.setRowHeight(clientHeight); + if (_isClientSideRowModel8(gos, rowModel) || _isServerSideRowModel3(gos, rowModel)) { + rowModel.onRowHeightChanged(); + } + }; + window.setTimeout(updateRowHeightFunc, 0); + } + }; + const resizeObserverDestroyFunc = _observeResize2(beans, eDetailGui, checkRowSizeFunc); + rowCtrl.addDestroyFunc(resizeObserverDestroyFunc); + checkRowSizeFunc(); + } + destroy() { + this.store = {}; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/masterDetail/masterDetailModule.ts +var SharedMasterDetailModule = { + moduleName: "SharedMasterDetail", + version: VERSION, + beans: [MasterDetailService], + userComponents: { agDetailCellRenderer: DetailCellRenderer }, + dynamicBeans: { detailCellRendererCtrl: DetailCellRendererCtrl }, + apiFunctions: { + addDetailGridInfo, + removeDetailGridInfo, + getDetailGridInfo, + forEachDetailGridInfo + }, + dependsOn: [EnterpriseCoreModule, GroupCellRendererModule, StickyRowModule], + css: [masterDetailModule_default] +}; +var MasterDetailModule = { + moduleName: "MasterDetail", + version: VERSION, + dependsOn: [SharedMasterDetailModule, ClientSideRowModelHierarchyModule, EventApiModule] +}; + +// packages/ag-grid-enterprise/src/rangeSelection/rangeSelectionModule.ts +import { _DragModule, _KeyboardNavigationModule as _KeyboardNavigationModule3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rangeSelection/agFillHandle.ts +import { + _addGridCommonParams as _addGridCommonParams24, + _getCellByPosition as _getCellByPosition2, + _getFillHandle, + _getLastRow, + _getNormalisedMousePosition, + _getRowAbove, + _getRowBelow as _getRowBelow3, + _getRowNode as _getRowNode6, + _isRowBefore as _isRowBefore3, + _isSameRow as _isSameRow3, + _last as _last13, + _stopPropagationForAgGrid as _stopPropagationForAgGrid9, + _toStringOrNull as _toStringOrNull6, + _warn as _warn41, + isRowNumberCol as isRowNumberCol2 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rangeSelection/abstractSelectionHandle.ts +import { + Component as Component53, + _areCellsEqual, + _getCellPositionForEvent, + _getPageBody as _getPageBody2, + _isRowBefore as _isRowBefore2, + _isVisible as _isVisible7, + _last as _last12, + _setDisplayed as _setDisplayed23 +} from "ag-grid-community"; +var AbstractSelectionHandle = class extends Component53 { + constructor() { + super(...arguments); + this.changedCalculatedValues = false; + this.dragging = false; + this.shouldDestroyOnEndDragging = false; + } + postConstruct() { + this.beans.dragSvc.addDragSource({ + dragStartPixels: 0, + eElement: this.getGui(), + onDragging: (e) => { + let startingMove = false; + if (!this.dragging) { + startingMove = true; + this.dragging = true; + const pageBody = _getPageBody2(this.beans); + pageBody.classList?.add(this.getDraggingCssClass()); + } + this.updateValuesOnMove(e); + if (startingMove) { + this.changedCalculatedValues = false; + return; + } + this.beans.rangeSvc.autoScrollService.check(e); + if (this.changedCalculatedValues) { + this.onDrag(e); + this.changedCalculatedValues = false; + } + }, + onDragStop: (e) => { + this.dragging = false; + this.onDragEnd(e); + this.clearDragProperties(); + }, + onDragCancel: () => { + this.dragging = false; + this.onDragCancel(); + this.clearDragProperties(); + } + }); + this.addManagedEventListeners({ + cellSelectionChanged: this.updateLocalRangeIfNeeded.bind(this) + }); + this.addManagedElementListeners(this.getGui(), { + pointerdown: stopEventPropagation, + mousedown: stopEventPropagation + }); + } + getLastCellHovered() { + return this.lastCellHovered; + } + getDraggingCssClass() { + return `ag-dragging-${this.type === 0 /* FILL */ ? "fill" : "range"}-handle`; + } + updateValuesOnMove(e) { + const cell = _getCellPositionForEvent(this.gos, e); + if (!cell || this.shouldSkipCell(cell) || this.lastCellHovered && _areCellsEqual(cell, this.lastCellHovered)) { + return; + } + this.lastCellHovered = cell; + this.changedCalculatedValues = true; + } + clearDragProperties() { + this.clearValues(); + this.beans.rangeSvc.autoScrollService.ensureCleared(); + const pageBody = _getPageBody2(this.beans); + pageBody.classList?.remove(this.getDraggingCssClass()); + if (this.shouldDestroyOnEndDragging) { + this.destroy(); + } + } + getType() { + return this.type; + } + refresh(cellCtrl, cellRange) { + const oldCellComp = this.cellCtrl; + const eGui = this.getGui(); + const cellRangeToUse = cellRange ?? _last12(this.beans.rangeSvc.getCellRanges()); + const start = cellRangeToUse.startRow; + const end = cellRangeToUse.endRow; + if (start && end) { + const isBefore = _isRowBefore2(end, start); + if (isBefore) { + this.rangeStartRow = end; + this.rangeEndRow = start; + } else { + this.rangeStartRow = start; + this.rangeEndRow = end; + } + } + if (oldCellComp !== cellCtrl || !_isVisible7(eGui)) { + this.cellCtrl = cellCtrl; + const eParentOfValue = cellCtrl.comp.getParentOfValue(); + if (eParentOfValue) { + eParentOfValue.appendChild(eGui); + } + } + this.cellRange = cellRangeToUse; + } + clearValues() { + this.lastCellHovered = void 0; + } + destroy() { + if (!this.shouldDestroyOnEndDragging && this.dragging) { + _setDisplayed23(this.getGui(), false); + this.shouldDestroyOnEndDragging = true; + return; + } + this.shouldDestroyOnEndDragging = false; + super.destroy(); + this.getGui()?.remove(); + } + updateLocalRangeIfNeeded(event) { + if (!this.cellRange) { + return; + } + const { id, type } = this.cellRange; + if (!id || id !== event.id) { + return; + } + const newRange = this.beans.rangeSvc?.getCellRanges().find((range) => range.id === id && range.type === type); + if (newRange && newRange !== this.cellRange) { + this.cellRange = newRange; + } + } +}; +var stopEventPropagation = (e) => { + e.stopPropagation(); +}; + +// packages/ag-grid-enterprise/src/rangeSelection/utils.ts +function findLineByLeastSquares(values) { + const len = values.length; + let maxDecimals = 0; + if (len <= 1) { + return values; + } + for (let i = 0; i < values.length; i++) { + const value = values[i]; + const splitExponent = value.toString().split("e-"); + if (splitExponent.length > 1) { + maxDecimals = Math.max(maxDecimals, parseInt(splitExponent[1], 10)); + continue; + } + if (Math.floor(value) === value) { + continue; + } + maxDecimals = Math.max(maxDecimals, value.toString().split(".")[1].length); + } + let sum_x = 0; + let sum_y = 0; + let sum_xy = 0; + let sum_xx = 0; + let y = 0; + for (let x = 0; x < len; x++) { + y = values[x]; + sum_x += x; + sum_y += y; + sum_xx += x * x; + sum_xy += x * y; + } + const m = (len * sum_xy - sum_x * sum_y) / (len * sum_xx - sum_x * sum_x); + const b = sum_y / len - m * sum_x / len; + const result = []; + for (let x = 0; x <= len; x++) { + result.push(parseFloat((x * m + b).toFixed(maxDecimals))); + } + return result; +} + +// packages/ag-grid-enterprise/src/rangeSelection/agFillHandle.ts +var FillHandleElement = { + tag: "div", + cls: "ag-fill-handle" +}; +var AgFillHandle = class extends AbstractSelectionHandle { + constructor() { + super(FillHandleElement); + this.markedCells = []; + this.cellValues = []; + this.isUp = false; + this.isLeft = false; + this.isReduce = false; + this.type = 0 /* FILL */; + } + postConstruct() { + super.postConstruct(); + this.addManagedElementListeners(this.getGui(), { + dblclick: this.onDblClick.bind(this) + }); + } + onDblClick(e) { + _stopPropagationForAgGrid9(e); + const { cellRange: initialRange, rangeStartRow, beans } = this; + const { rangeSvc, visibleCols } = beans; + const lastRow = _getLastRow(beans); + if (!lastRow) { + return; + } + const fillHandleDirection = this.getFillHandleDirection(); + this.dragAxis = fillHandleDirection === "xy" ? "y" : fillHandleDirection; + const finalRange = rangeSvc?.createCellRangeFromCellRangeParams({ + rowStartIndex: rangeStartRow.rowIndex, + rowStartPinned: rangeStartRow.rowPinned, + columnStart: initialRange.columns[0], + rowEndIndex: this.dragAxis === "x" ? initialRange.endRow?.rowIndex ?? null : lastRow.rowIndex, + rowEndPinned: this.dragAxis === "x" ? initialRange.endRow?.rowPinned : lastRow.rowPinned, + columnEnd: this.dragAxis === "x" ? _last13(visibleCols.allCols) : _last13(initialRange.columns) + }); + this.isUp = false; + this.isLeft = false; + if (finalRange) { + this.performFill({ + event: e, + initialRange, + finalRange + }); + } + this.dragAxis = void 0; + } + updateValuesOnMove(e) { + super.updateValuesOnMove(e); + if (!this.initialXY) { + this.initialXY = _getNormalisedMousePosition(this.beans, e); + } + const { x, y } = this.initialXY; + const { x: newX, y: newY } = _getNormalisedMousePosition(this.beans, e); + const diffX = Math.abs(x - newX); + const diffY = Math.abs(y - newY); + const allowedDirection = this.getFillHandleDirection(); + let direction; + if (allowedDirection === "xy") { + direction = diffX > diffY ? "x" : "y"; + } else { + direction = allowedDirection; + } + if (direction !== this.dragAxis) { + this.dragAxis = direction; + this.changedCalculatedValues = true; + } + } + shouldSkipCell(cell) { + return isRowNumberCol2(cell.column); + } + onDrag(_) { + if (!this.initialPosition) { + const cellCtrl = this.cellCtrl; + if (!cellCtrl) { + return; + } + this.initialPosition = cellCtrl.cellPosition; + } + const lastCellHovered = this.getLastCellHovered(); + if (lastCellHovered) { + this.markPathFrom(this.initialPosition, lastCellHovered); + } + } + onDragEnd(e) { + this.initialXY = null; + if (!this.markedCells.length) { + return; + } + const isX = this.dragAxis === "x"; + const { + cellRange: initialRange, + rangeStartRow, + rangeEndRow, + beans: { rangeSvc } + } = this; + const colLen = initialRange.columns.length; + let finalRange; + if (!this.isUp && !this.isLeft) { + finalRange = rangeSvc.createCellRangeFromCellRangeParams({ + rowStartIndex: rangeStartRow.rowIndex, + rowStartPinned: rangeStartRow.rowPinned, + columnStart: initialRange.columns[0], + rowEndIndex: isX ? rangeEndRow.rowIndex : this.lastCellMarked.rowIndex, + rowEndPinned: isX ? rangeEndRow.rowPinned : this.lastCellMarked.rowPinned, + columnEnd: isX ? this.lastCellMarked.column : initialRange.columns[colLen - 1] + }); + } else { + const startRow = isX ? rangeStartRow : this.lastCellMarked; + finalRange = rangeSvc.createCellRangeFromCellRangeParams({ + rowStartIndex: startRow.rowIndex, + rowStartPinned: startRow.rowPinned, + columnStart: isX ? this.lastCellMarked.column : initialRange.columns[0], + rowEndIndex: rangeEndRow.rowIndex, + rowEndPinned: rangeEndRow.rowPinned, + columnEnd: initialRange.columns[colLen - 1] + }); + } + if (finalRange) { + this.performFill({ + event: e, + initialRange, + finalRange, + shouldUpdateRange: true + }); + } + } + onDragCancel() { + this.initialXY = null; + if (!this.markedCells.length) { + return; + } + this.clearMarkedPath(); + } + performFill({ + event, + initialRange, + finalRange, + shouldUpdateRange + }) { + const { eventSvc, rangeSvc } = this.beans; + eventSvc.dispatchEvent({ type: "fillStart" }); + this.handleValueChanged(initialRange, finalRange, event); + if (shouldUpdateRange) { + rangeSvc.setCellRanges([finalRange]); + } + eventSvc.dispatchEvent({ + type: "fillEnd", + initialRange, + finalRange + }); + } + getFillHandleDirection() { + const direction = _getFillHandle(this.gos)?.direction; + if (!direction) { + return "xy"; + } + if (direction !== "x" && direction !== "y" && direction !== "xy") { + _warn41(177); + return "xy"; + } + return direction; + } + handleValueChanged(initialRange, finalRange, e) { + const { beans } = this; + const { rangeSvc, gos, valueSvc } = beans; + const initialRangeEndRow = rangeSvc.getRangeEndRow(initialRange); + const initialRangeStartRow = rangeSvc.getRangeStartRow(initialRange); + const finalRangeEndRow = rangeSvc.getRangeEndRow(finalRange); + const finalRangeStartRow = rangeSvc.getRangeStartRow(finalRange); + const isVertical = this.dragAxis === "y"; + if (this.isReduce && !_getFillHandle(gos)?.suppressClearOnFillReduction) { + const columns = isVertical ? initialRange.columns : initialRange.columns.filter((col) => finalRange.columns.indexOf(col) < 0); + const startRow = isVertical ? _getRowBelow3(beans, finalRangeEndRow) : finalRangeStartRow; + if (startRow) { + this.clearCellsInRange(startRow, initialRangeEndRow, columns); + } + return; + } + const values = []; + const initialValues = []; + const initialNonAggregatedValues = []; + const initialFormattedValues = []; + let withinInitialRange = true; + let idx = 0; + const resetValues = () => { + values.length = 0; + initialValues.length = 0; + initialNonAggregatedValues.length = 0; + initialFormattedValues.length = 0; + idx = 0; + }; + const iterateAcrossCells = (column, columns) => { + let currentRow = this.isUp ? initialRangeEndRow : initialRangeStartRow; + let finished = false; + if (isVertical) { + withinInitialRange = true; + resetValues(); + } + while (!finished && currentRow) { + const rowNode = _getRowNode6(beans, currentRow); + if (!rowNode) { + break; + } + if (isVertical && column) { + fillValues( + values, + column, + rowNode, + () => !_isSameRow3(currentRow, this.isUp ? initialRangeStartRow : initialRangeEndRow) + ); + } else if (columns) { + withinInitialRange = true; + resetValues(); + for (const col of columns) { + fillValues( + values, + col, + rowNode, + () => col !== (this.isLeft ? initialRange.columns[0] : _last13(initialRange.columns)) + ); + } + } + finished = _isSameRow3(currentRow, this.isUp ? finalRangeStartRow : finalRangeEndRow); + currentRow = this.isUp ? _getRowAbove(this.beans, currentRow) : _getRowBelow3(beans, currentRow); + } + }; + const fillValues = (currentValues, col, rowNode, updateInitialSet) => { + let currentValue; + let skipValue = false; + if (withinInitialRange) { + currentValue = valueSvc.getValue(col, rowNode, "edit"); + initialValues.push(currentValue); + initialNonAggregatedValues.push(valueSvc.getValue(col, rowNode, "edit", true)); + initialFormattedValues.push( + valueSvc.getValueForDisplay({ column: col, node: rowNode, from: "edit" }).valueFormatted + ); + withinInitialRange = updateInitialSet(); + } else { + const { value, fromUserFunction, sourceCol, sourceRowNode } = this.processValues({ + event: e, + values: currentValues, + initialValues, + initialNonAggregatedValues, + initialFormattedValues, + col, + rowNode, + idx: idx++ + }); + currentValue = value; + if (col.isCellEditable(rowNode)) { + const cellValue = valueSvc.getValue(col, rowNode, "edit"); + if (!fromUserFunction) { + if (sourceCol) { + const sourceColDef = sourceCol.getColDef(); + if (sourceColDef.useValueFormatterForExport !== false && sourceColDef.valueFormatter) { + const formattedValue = valueSvc.getValueForDisplay({ + column: sourceCol, + node: sourceRowNode, + includeValueFormatted: true, + from: "edit" + }).valueFormatted; + if (formattedValue != null) { + currentValue = formattedValue; + } + } + } + if (col.getColDef().useValueParserForImport !== false) { + currentValue = valueSvc.parseValue( + col, + rowNode, + // if no sourceCol, then currentValue is a number + sourceCol ? currentValue : _toStringOrNull6(currentValue), + cellValue + ); + } + } + if (!fromUserFunction || cellValue !== currentValue) { + rowNode.setDataValue(col, currentValue, "rangeSvc"); + } else { + skipValue = true; + } + } + } + if (!skipValue) { + currentValues.push({ + value: currentValue, + column: col, + rowNode + }); + } + }; + const { changeDetectionSvc } = this.beans; + changeDetectionSvc?.beginDeferred(); + try { + if (isVertical) { + initialRange.columns.forEach((col) => { + iterateAcrossCells(col); + }); + } else { + const columns = this.isLeft ? [...finalRange.columns].reverse() : finalRange.columns; + iterateAcrossCells(void 0, columns); + } + this.beans.editSvc?.stopEditing(void 0, { source: "fillHandle" }); + } finally { + changeDetectionSvc?.endDeferred(); + } + } + clearCellsInRange(startRow, endRow, columns) { + const cellRange = { + startRow, + endRow, + columns, + startColumn: columns[0] + }; + this.beans.rangeSvc.clearCellRangeCellValues({ cellRanges: [cellRange], restoreSourceInBatch: true }); + } + processValues(params) { + const { formula, valueSvc } = this.beans; + const { event, values, initialValues, initialNonAggregatedValues, initialFormattedValues, col, rowNode, idx } = params; + const userFillOperation = _getFillHandle(this.gos)?.setFillValue; + const isVertical = this.dragAxis === "y"; + let direction; + if (isVertical) { + direction = this.isUp ? "up" : "down"; + } else { + direction = this.isLeft ? "left" : "right"; + } + if (userFillOperation) { + const params2 = _addGridCommonParams24(this.gos, { + event, + values: values.map(({ value }) => value), + initialValues, + initialNonAggregatedValues, + initialFormattedValues, + currentIndex: idx, + currentCellValue: valueSvc.getValue(col, rowNode, "edit"), + direction, + column: col, + rowNode + }); + const userResult = userFillOperation(params2); + if (userResult !== false) { + return { value: userResult, fromUserFunction: true }; + } + } + const isNumeric = (v) => typeof v === "number" && Number.isFinite(v) || typeof v === "string" && /^[+-]?\d+(?:\.\d+)?$/.test(v.trim()); + const allNumbers = values.every(({ value }) => isNumeric(value)); + if (event.altKey || !allNumbers) { + const valueForFunctions = String(_last13(values)?.value ?? ""); + if (allNumbers && initialValues.length === 1) { + const multiplier = this.isUp || this.isLeft ? -1 : 1; + return { + value: parseFloat(valueForFunctions) + 1 * multiplier, + fromUserFunction: false + }; + } + const { value: cyclicValue, column: sourceCol, rowNode: sourceRowNode } = values[idx % values.length]; + let processedValue; + const fromFormula = sourceCol.isAllowFormula() && formula?.isFormula(valueForFunctions); + if (fromFormula) { + const rowDelta = direction === "up" ? -1 : direction === "down" ? 1 : 0; + const columnDelta = direction === "left" ? -1 : direction === "right" ? 1 : 0; + processedValue = formula.updateFormulaByOffset({ value: valueForFunctions, rowDelta, columnDelta }); + } else { + processedValue = cyclicValue; + } + return { + value: processedValue, + fromUserFunction: false, + sourceCol: fromFormula ? void 0 : sourceCol, + sourceRowNode + }; + } + return { + value: _last13(findLineByLeastSquares(values.map(({ value }) => Number(value)))), + fromUserFunction: false + }; + } + clearValues() { + this.clearMarkedPath(); + this.clearCellValues(); + this.lastCellMarked = void 0; + super.clearValues(); + } + clearMarkedPath() { + for (const cell of this.markedCells) { + if (!cell.isAlive()) { + continue; + } + const { comp } = cell; + comp.toggleCss("ag-selection-fill-top", false); + comp.toggleCss("ag-selection-fill-right", false); + comp.toggleCss("ag-selection-fill-bottom", false); + comp.toggleCss("ag-selection-fill-left", false); + } + this.markedCells.length = 0; + this.isUp = false; + this.isLeft = false; + this.isReduce = false; + } + clearCellValues() { + this.cellValues.length = 0; + } + markPathFrom(initialPosition, currentPosition) { + this.clearMarkedPath(); + this.clearCellValues(); + if (this.dragAxis === "y") { + if (_isSameRow3(currentPosition, initialPosition)) { + return; + } + const isBefore = _isRowBefore3(currentPosition, initialPosition); + const { rangeStartRow, rangeEndRow } = this; + if (isBefore && (currentPosition.rowPinned == rangeStartRow.rowPinned && currentPosition.rowIndex >= rangeStartRow.rowIndex || rangeStartRow.rowPinned != rangeEndRow.rowPinned && currentPosition.rowPinned == rangeEndRow.rowPinned && currentPosition.rowIndex <= rangeEndRow.rowIndex)) { + this.reduceVertical(initialPosition, currentPosition); + this.isReduce = true; + } else { + this.extendVertical(initialPosition, currentPosition, isBefore); + this.isReduce = false; + } + } else { + const initialColumn = initialPosition.column; + const currentColumn = currentPosition.column; + if (initialColumn === currentColumn) { + return; + } + const displayedColumns = this.beans.visibleCols.allCols; + const initialIndex = displayedColumns.indexOf(initialColumn); + const currentIndex = displayedColumns.indexOf(currentColumn); + if (currentIndex <= initialIndex && currentIndex >= displayedColumns.indexOf(this.cellRange.columns[0])) { + this.reduceHorizontal(initialPosition, currentPosition); + this.isReduce = true; + } else { + this.extendHorizontal(initialPosition, currentPosition, currentIndex < initialIndex); + this.isReduce = false; + } + } + this.lastCellMarked = currentPosition; + } + extendVertical(initialPosition, endPosition, isMovingUp) { + const beans = this.beans; + const { rangeSvc } = beans; + let row = initialPosition; + do { + const cellRange = this.cellRange; + const colLen = cellRange.columns.length; + for (let i = 0; i < colLen; i++) { + const column = cellRange.columns[i]; + const rowPos = { rowIndex: row.rowIndex, rowPinned: row.rowPinned }; + const cellPos = { ...rowPos, column }; + const cellInRange = rangeSvc.isCellInSpecificRange(cellPos, cellRange); + const isInitialRow = _isSameRow3(row, initialPosition); + if (isMovingUp) { + this.isUp = true; + } + if (!isInitialRow) { + const cell = _getCellByPosition2(beans, cellPos); + if (cell) { + this.markedCells.push(cell); + const cellComp = cell.comp; + if (!cellInRange) { + cellComp.toggleCss("ag-selection-fill-left", i === 0); + cellComp.toggleCss("ag-selection-fill-right", i === colLen - 1); + } + cellComp.toggleCss( + isMovingUp ? "ag-selection-fill-top" : "ag-selection-fill-bottom", + _isSameRow3(row, endPosition) + ); + } + } + } + if (_isSameRow3(row, endPosition)) { + break; + } + } while ( + // tslint:disable-next-line + row = isMovingUp ? _getRowAbove(this.beans, row) : _getRowBelow3(beans, row) + ); + } + reduceVertical(initialPosition, endPosition) { + let row = initialPosition; + const beans = this.beans; + do { + const cellRange = this.cellRange; + const colLen = cellRange.columns.length; + const isLastRow = _isSameRow3(row, endPosition); + for (let i = 0; i < colLen; i++) { + const rowPos = { rowIndex: row.rowIndex, rowPinned: row.rowPinned }; + const celPos = { ...rowPos, column: cellRange.columns[i] }; + const cell = _getCellByPosition2(beans, celPos); + if (cell) { + this.markedCells.push(cell); + cell.comp.toggleCss("ag-selection-fill-bottom", _isSameRow3(row, endPosition)); + } + } + if (isLastRow) { + break; + } + } while (row = _getRowAbove(beans, row)); + } + extendHorizontal(initialPosition, endPosition, isMovingLeft) { + const beans = this.beans; + const { visibleCols } = beans; + const allCols = visibleCols.allCols; + const startCol = allCols.indexOf(isMovingLeft ? endPosition.column : initialPosition.column); + const endCol = allCols.indexOf(isMovingLeft ? this.cellRange.columns[0] : endPosition.column); + const offset = isMovingLeft ? 0 : 1; + const colsToMark = allCols.slice(startCol + offset, endCol + offset); + const { rangeStartRow, rangeEndRow } = this; + for (const column of colsToMark) { + let row = rangeStartRow; + let isLastRow = false; + do { + isLastRow = _isSameRow3(row, rangeEndRow); + const cell = _getCellByPosition2(beans, { + rowIndex: row.rowIndex, + rowPinned: row.rowPinned, + column + }); + if (cell) { + this.markedCells.push(cell); + const cellComp = cell.comp; + cellComp.toggleCss("ag-selection-fill-top", _isSameRow3(row, rangeStartRow)); + cellComp.toggleCss("ag-selection-fill-bottom", _isSameRow3(row, rangeEndRow)); + if (isMovingLeft) { + this.isLeft = true; + cellComp.toggleCss("ag-selection-fill-left", column === colsToMark[0]); + } else { + cellComp.toggleCss("ag-selection-fill-right", column === _last13(colsToMark)); + } + } + row = _getRowBelow3(beans, row); + } while (!isLastRow); + } + } + reduceHorizontal(initialPosition, endPosition) { + const beans = this.beans; + const { visibleCols } = beans; + const allCols = visibleCols.allCols; + const startCol = allCols.indexOf(endPosition.column); + const endCol = allCols.indexOf(initialPosition.column); + const colsToMark = allCols.slice(startCol, endCol); + const { rangeStartRow, rangeEndRow } = this; + for (const column of colsToMark) { + let row = rangeStartRow; + let isLastRow = false; + do { + isLastRow = _isSameRow3(row, rangeEndRow); + const cell = _getCellByPosition2(this.beans, { + rowIndex: row.rowIndex, + rowPinned: row.rowPinned, + column + }); + if (cell) { + this.markedCells.push(cell); + cell.comp.toggleCss("ag-selection-fill-right", column === colsToMark[0]); + } + row = _getRowBelow3(beans, row); + } while (!isLastRow); + } + } + refresh(cellCtrl, cellRange) { + const cellRangeToUse = cellRange ?? this.beans.rangeSvc.getCellRanges()[0]; + const isColumnRange = !cellRangeToUse.startRow || !cellRangeToUse.endRow; + if (isColumnRange) { + this.destroy(); + return; + } + super.refresh(cellCtrl, cellRangeToUse); + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/agRangeHandle.ts +import { CellRangeType, _isSameRow as _isSameRow4, _last as _last14 } from "ag-grid-community"; +var AgRangeHandle = class extends AbstractSelectionHandle { + constructor() { + super({ tag: "div", cls: "ag-range-handle" }); + this.type = 1 /* RANGE */; + this.rangeFixed = false; + } + onDrag(_) { + const lastCellHovered = this.getLastCellHovered(); + if (!lastCellHovered) { + return; + } + const rangeSvc = this.beans.rangeSvc; + const targetRange = this.cellRange ?? _last14(rangeSvc.getCellRanges()); + if (!targetRange) { + return; + } + if (!this.rangeFixed) { + this.fixRangeStartEnd(targetRange); + this.rangeFixed = true; + } + this.endPosition = { + rowIndex: lastCellHovered.rowIndex, + rowPinned: lastCellHovered.rowPinned, + column: lastCellHovered.column + }; + if (rangeSvc.getCellRanges().length === 2 && rangeSvc.getCellRanges()[0].type === CellRangeType.DIMENSION && targetRange.type === CellRangeType.VALUE) { + const rowChanged = !_isSameRow4(this.endPosition, rangeSvc.getRangeEndRow(targetRange)); + if (rowChanged) { + rangeSvc.updateRangeRowBoundary({ + cellRange: rangeSvc.getCellRanges()[0], + boundary: "end", + cellPosition: { + ...this.endPosition, + column: rangeSvc.getCellRanges()[0].columns[0] + }, + silent: true + }); + } + } + rangeSvc.extendRangeToCell(targetRange, this.endPosition); + } + shouldSkipCell(_) { + return false; + } + onDragEnd(_) { + const cellRange = this.cellRange ?? _last14(this.beans.rangeSvc.getCellRanges()); + if (!cellRange) { + return; + } + this.fixRangeStartEnd(cellRange); + this.rangeFixed = false; + } + onDragCancel() { + this.rangeFixed = false; + } + fixRangeStartEnd(cellRange) { + const rangeSvc = this.beans.rangeSvc; + const startRow = rangeSvc.getRangeStartRow(cellRange); + const endRow = rangeSvc.getRangeEndRow(cellRange); + const column = cellRange.columns[0]; + cellRange.startRow = startRow; + cellRange.endRow = endRow; + cellRange.startColumn = column; + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/rangeSelection.css +var rangeSelection_default = ".ag-body-viewport:not(.ag-has-focus) .ag-cell-range-single-cell:not(.ag-cell-inline-editing),.ag-cell-range-selected.ag-cell-range-chart,.ag-cell-range-selected:not(.ag-cell-focus){background-color:var(--ag-range-selection-background-color);&.ag-cell-range-chart{background-color:var(--ag-range-selection-chart-background-color)!important;&.ag-cell-range-chart-category{background-color:var(--ag-range-selection-chart-category-background-color)!important}}}.ag-cell-range-selected-1.ag-cell-range-chart,.ag-cell-range-selected-1.ag-formula-range,.ag-cell-range-selected-1:not(.ag-cell-focus),.ag-root:not(.ag-context-menu-open) .ag-body-viewport:not(.ag-has-focus) .ag-cell-range-selected-1:not(.ag-cell-inline-editing){background-color:var(--ag-range-selection-background-color)}.ag-cell-range-selected-2.ag-cell-range-chart,.ag-cell-range-selected-2.ag-formula-range,.ag-cell-range-selected-2:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-3.ag-cell-range-chart,.ag-cell-range-selected-3.ag-formula-range,.ag-cell-range-selected-3:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell-range-selected-4.ag-cell-range-chart,.ag-cell-range-selected-4.ag-formula-range,.ag-cell-range-selected-4:not(.ag-cell-focus){background-image:linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color)),linear-gradient(var(--ag-range-selection-background-color),var(--ag-range-selection-background-color))}.ag-cell.ag-cell-range-selected:not(.ag-cell-range-single-cell){&.ag-cell-range-top{border-top-color:var(--ag-range-selection-border-color);border-top-style:var(--ag-range-selection-border-style)}&.ag-cell-range-right{border-right-color:var(--ag-range-selection-border-color);border-right-style:var(--ag-range-selection-border-style)}&.ag-cell-range-bottom{border-bottom-color:var(--ag-range-selection-border-color);border-bottom-style:var(--ag-range-selection-border-style)}&.ag-cell-range-left{border-left-color:var(--ag-range-selection-border-color);border-left-style:var(--ag-range-selection-border-style)}}.ag-cell.ag-selection-fill-top,.ag-cell.ag-selection-fill-top.ag-cell-range-selected{border-top:1px dashed;border-top-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-right,:where(.ag-ltr) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-right,:where(.ag-rtl) .ag-cell.ag-selection-fill-right.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}.ag-cell.ag-selection-fill-bottom,.ag-cell.ag-selection-fill-bottom.ag-cell-range-selected{border-bottom:1px dashed;border-bottom-color:var(--ag-range-selection-border-color)}:where(.ag-ltr) .ag-cell.ag-selection-fill-left,:where(.ag-ltr) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-left:1px dashed var(--ag-range-selection-border-color)!important}:where(.ag-rtl) .ag-cell.ag-selection-fill-left,:where(.ag-rtl) .ag-cell.ag-selection-fill-left.ag-cell-range-selected{border-right:1px dashed var(--ag-range-selection-border-color)!important}.ag-fill-handle,.ag-range-handle{background-color:var(--ag-range-selection-border-color);bottom:-1px;height:6px;position:absolute;width:6px}:where(.ag-ltr) .ag-fill-handle,:where(.ag-ltr) .ag-range-handle{right:-1px}:where(.ag-rtl) .ag-fill-handle,:where(.ag-rtl) .ag-range-handle{left:-1px}.ag-fill-handle{cursor:crosshair}:where(.ag-ltr) .ag-range-handle{cursor:nwse-resize}:where(.ag-rtl) .ag-range-handle{cursor:nesw-resize}"; + +// packages/ag-grid-enterprise/src/rangeSelection/rangeSelectionApi.ts +function getCellRanges(beans) { + return beans.rangeSvc?.getCellRanges() ?? null; +} +function addCellRange(beans, params) { + beans.rangeSvc?.addCellRange(params); +} +function clearRangeSelection(beans) { + beans.rangeSvc?.removeAllCellRanges(); +} + +// packages/ag-grid-enterprise/src/rangeSelection/rangeService.ts +import { + AutoScrollService as AutoScrollService2, + BeanStub as BeanStub55, + KeyCode as KeyCode31, + _areCellsEqual as _areCellsEqual2, + _areEqual as _areEqual5, + _exists as _exists24, + _getAbsoluteRowIndex, + _getCellCtrlForEventTarget, + _getEnableColumnSelection, + _getFirstRow as _getFirstRow2, + _getLastRow as _getLastRow2, + _getRowAbove as _getRowAbove2, + _getRowBelow as _getRowBelow4, + _getRowCtrlForEventTarget, + _getRowNode as _getRowNode7, + _getSuppressMultiRanges, + _interpretAsRightClick as _interpretAsRightClick2, + _isCellSelectionEnabled as _isCellSelectionEnabled2, + _isDomLayout, + _isRowBefore as _isRowBefore4, + _isSameRow as _isSameRow6, + _isUsingNewCellSelectionAPI, + _last as _last16, + _makeNull as _makeNull8, + _missing as _missing7, + _removeAllFromArray as _removeAllFromArray2, + _removeFromArray as _removeFromArray7, + _warn as _warn42 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rangeSelection/cellRangeFeature.ts +import { CellRangeType as CellRangeType2, _isSameRow as _isSameRow5, _last as _last15, _missing as _missing6, _setAriaSelected as _setAriaSelected2 } from "ag-grid-community"; +var CSS_CELL_RANGE_SELECTED = "ag-cell-range-selected"; +var CSS_CELL_RANGE_CHART = "ag-cell-range-chart"; +var CSS_CELL_RANGE_SINGLE_CELL = "ag-cell-range-single-cell"; +var CSS_CELL_RANGE_CHART_CATEGORY = "ag-cell-range-chart-category"; +var CSS_CELL_RANGE_HANDLE = "ag-cell-range-handle"; +var CSS_CELL_RANGE_TOP = "ag-cell-range-top"; +var CSS_CELL_RANGE_RIGHT = "ag-cell-range-right"; +var CSS_CELL_RANGE_BOTTOM = "ag-cell-range-bottom"; +var CSS_CELL_RANGE_LEFT = "ag-cell-range-left"; +function _isRangeHandleEnabled(gos) { + const selection = gos.get("cellSelection"); + const useNewAPI = selection !== void 0; + if (!useNewAPI) { + return gos.get("enableRangeHandle"); + } + return typeof selection !== "boolean" ? selection.handle?.mode === "range" : false; +} +function _isFillHandleEnabled(gos) { + const selection = gos.get("cellSelection"); + const useNewAPI = selection !== void 0; + if (!useNewAPI) { + return gos.get("enableFillHandle"); + } + return typeof selection !== "boolean" ? selection.handle?.mode === "fill" : false; +} +var CellRangeFeature = class { + constructor(beans, cellCtrl) { + this.beans = beans; + this.cellCtrl = cellCtrl; + this.rangeColorClass = null; + this.handleColorClass = null; + this.rangeSvc = beans.rangeSvc; + } + setComp(cellComp) { + this.cellComp = cellComp; + this.eGui = this.cellCtrl.eGui; + this.onCellSelectionChanged(); + } + unsetComp() { + this.beans.context.destroyBean(this.selectionHandle); + } + onCellSelectionChanged() { + const cellComp = this.cellComp; + if (!cellComp) { + return; + } + const { rangeSvc, cellCtrl, eGui } = this; + const rangeCount = rangeSvc.getCellRangeCount(cellCtrl.cellPosition); + this.rangeCount = rangeCount; + const hasChartRange = this.getHasChartRange(); + this.hasChartRange = hasChartRange; + cellComp.toggleCss(CSS_CELL_RANGE_SELECTED, rangeCount !== 0); + cellComp.toggleCss(`${CSS_CELL_RANGE_SELECTED}-1`, rangeCount === 1); + cellComp.toggleCss(`${CSS_CELL_RANGE_SELECTED}-2`, rangeCount === 2); + cellComp.toggleCss(`${CSS_CELL_RANGE_SELECTED}-3`, rangeCount === 3); + cellComp.toggleCss(`${CSS_CELL_RANGE_SELECTED}-4`, rangeCount >= 4); + cellComp.toggleCss(CSS_CELL_RANGE_CHART, hasChartRange); + _setAriaSelected2(eGui, rangeCount > 0 ? true : void 0); + cellComp.toggleCss(CSS_CELL_RANGE_SINGLE_CELL, this.isSingleCell()); + this.updateRangeBorders(); + this.refreshRangeStyleAndHandle(); + } + updateRangeBorders() { + const rangeBorders = this.getRangeBorders(); + const isSingleCell = this.isSingleCell(); + const isTop = !isSingleCell && rangeBorders.top; + const isRight = !isSingleCell && rangeBorders.right; + const isBottom = !isSingleCell && rangeBorders.bottom; + const isLeft = !isSingleCell && rangeBorders.left; + const cellComp = this.cellComp; + cellComp.toggleCss(CSS_CELL_RANGE_TOP, isTop); + cellComp.toggleCss(CSS_CELL_RANGE_RIGHT, isRight); + cellComp.toggleCss(CSS_CELL_RANGE_BOTTOM, isBottom); + cellComp.toggleCss(CSS_CELL_RANGE_LEFT, isLeft); + } + isSingleCell() { + const { rangeSvc } = this; + return this.rangeCount === 1 && !!rangeSvc && !rangeSvc.isMoreThanOneCell(); + } + getHasChartRange() { + const { rangeSvc } = this; + if (!this.rangeCount || !rangeSvc) { + return false; + } + const cellRanges = rangeSvc.getCellRanges(); + return cellRanges.length > 0 && cellRanges.every((range) => [CellRangeType2.DIMENSION, CellRangeType2.VALUE].includes(range.type)); + } + updateRangeBordersIfRangeCount() { + if (this.rangeCount > 0) { + this.updateRangeBorders(); + this.refreshRangeStyleAndHandle(); + } + } + getRangeBorders() { + const isRtl = this.beans.gos.get("enableRtl"); + let top = false; + let right = false; + let bottom = false; + let left = false; + const { + rangeSvc, + beans: { visibleCols }, + cellCtrl: { cellPosition } + } = this; + const thisCol = cellPosition.column; + const ranges = rangeSvc.getCellRanges().filter((range) => rangeSvc.isCellInSpecificRange(cellPosition, range)); + if (!ranges.length) { + return { top, right, bottom, left }; + } + let leftCol; + let rightCol; + if (isRtl) { + leftCol = visibleCols.getColAfter(thisCol); + rightCol = visibleCols.getColBefore(thisCol); + } else { + leftCol = visibleCols.getColBefore(thisCol); + rightCol = visibleCols.getColAfter(thisCol); + } + if (!leftCol) { + left = true; + } + if (!rightCol) { + right = true; + } + for (let i = 0; i < ranges.length; i++) { + if (top && right && bottom && left) { + break; + } + const range = ranges[i]; + const startRow = rangeSvc.getRangeStartRow(range); + const endRow = rangeSvc.getRangeEndRow(range); + if (!top && _isSameRow5(startRow, cellPosition)) { + top = true; + } + if (!bottom && _isSameRow5(endRow, cellPosition)) { + bottom = true; + } + if (!left && leftCol && range.columns.indexOf(leftCol) < 0) { + left = true; + } + if (!right && rightCol && range.columns.indexOf(rightCol) < 0) { + right = true; + } + } + return { top, right, bottom, left }; + } + refreshRangeStyleAndHandle() { + const { context } = this.beans; + if (context.isDestroyed()) { + return; + } + this.styleCellForRangeType(); + const rangeForHandle = this.getRangeForHandle(); + if (this.selectionHandle && !rangeForHandle) { + this.selectionHandle = context.destroyBean(this.selectionHandle); + } + if (rangeForHandle) { + this.addSelectionHandle(rangeForHandle); + } + this.refreshHandleColor(rangeForHandle); + this.cellComp.toggleCss(CSS_CELL_RANGE_HANDLE, !!this.selectionHandle); + } + styleCellForRangeType() { + if (this.hasChartRange) { + const { rangeSvc } = this; + const dimensionRange = rangeSvc.getCellRanges()[0]; + const hasCategoryRange = dimensionRange.type === CellRangeType2.DIMENSION; + const isCategoryCell = hasCategoryRange && rangeSvc.isCellInSpecificRange(this.cellCtrl.cellPosition, dimensionRange); + this.cellComp.toggleCss(CSS_CELL_RANGE_CHART_CATEGORY, isCategoryCell); + } else { + this.cellComp.toggleCss(CSS_CELL_RANGE_CHART_CATEGORY, false); + this.applyRangeColor(this.getRangeColorClass()); + } + } + applyRangeColor(nextClass) { + if (this.rangeColorClass && this.rangeColorClass !== nextClass) { + this.cellComp.toggleCss(this.rangeColorClass, false); + this.cellComp.toggleCss("ag-formula-range", false); + } + if (nextClass) { + this.cellComp.toggleCss(nextClass, true); + this.cellComp.toggleCss("ag-formula-range", nextClass.startsWith("ag-formula-range")); + } + this.rangeColorClass = nextClass ?? null; + } + getRangeColorClass() { + const { rangeSvc, rangeCount } = this; + if (!rangeSvc || !rangeCount) { + return null; + } + const ranges = rangeSvc.getCellRanges(); + for (let i = ranges.length - 1; i >= 0; i--) { + const range = ranges[i]; + const colorClass = range.colorClass; + if (!colorClass) { + continue; + } + if (rangeSvc.isCellInSpecificRange(this.cellCtrl.cellPosition, range)) { + return colorClass; + } + } + return null; + } + refreshHandleColor(rangeForHandle) { + const handleGui = this.selectionHandle?.getGui?.(); + const nextClass = rangeForHandle?.colorClass ?? null; + if (!handleGui) { + this.handleColorClass = null; + return; + } + if (this.handleColorClass && this.handleColorClass !== nextClass) { + handleGui.classList.remove(this.handleColorClass); + } + if (nextClass) { + handleGui.classList.add(nextClass); + } else if (this.handleColorClass) { + handleGui.classList.remove(this.handleColorClass); + } + this.handleColorClass = nextClass ?? null; + } + getRangeForHandle() { + const { gos, editSvc } = this.beans; + const rangeSvc = this.rangeSvc; + const allRanges = rangeSvc.getCellRanges(); + const rangesLen = allRanges.length; + if (this.rangeCount < 1 || rangesLen < 1) { + return null; + } + const isRangeSelectionEnabledWhileEditing = editSvc?.isRangeSelectionEnabledWhileEditing(); + const rangesToRefreshHandle = isRangeSelectionEnabledWhileEditing ? allRanges : [_last15(allRanges)]; + for (const cellRange of rangesToRefreshHandle) { + const { cellPosition, column } = this.cellCtrl; + const isFillHandleAvailable = _isFillHandleEnabled(gos) && !column.isSuppressFillHandle(); + const isRangeHandleAvailable = _isRangeHandleEnabled(gos); + const isCellEditing = editSvc?.isEditing(this.cellCtrl, { withOpenEditor: true }); + let handleIsAvailable = !isCellEditing && (isRangeSelectionEnabledWhileEditing || rangesLen === 1 && (isFillHandleAvailable || isRangeHandleAvailable)); + if (this.hasChartRange) { + handleIsAvailable = cellRange.type === CellRangeType2.VALUE; + } + if (handleIsAvailable && cellRange.endRow != null && rangeSvc.isContiguousRange(cellRange) && rangeSvc.isBottomRightCell(cellRange, cellPosition)) { + return cellRange; + } + } + return null; + } + addSelectionHandle(cellRange) { + const { beans } = this; + const isRangeSelectionEnabledWhileEditing = beans.editSvc?.isRangeSelectionEnabledWhileEditing(); + const cellRangeType = cellRange.type; + const selectionHandleFill = !isRangeSelectionEnabledWhileEditing && _isFillHandleEnabled(beans.gos) && _missing6(cellRangeType); + const type = selectionHandleFill ? 0 /* FILL */ : 1 /* RANGE */; + if (this.selectionHandle && this.selectionHandle.getType() !== type) { + this.selectionHandle = beans.context.destroyBean(this.selectionHandle); + } + if (!this.selectionHandle) { + const selectionHandle = beans.registry.createDynamicBean( + type === 0 /* FILL */ ? "fillHandle" : "rangeHandle", + false + ); + if (selectionHandle) { + this.selectionHandle = beans.context.createBean(selectionHandle); + } + } + this.selectionHandle?.refresh(this.cellCtrl, cellRange); + } + destroy() { + this.unsetComp(); + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/dragListenerFeature.ts +import { BeanStub as BeanStub52, _isCellSelectionEnabled } from "ag-grid-community"; +var DragListenerFeature = class extends BeanStub52 { + constructor(eContainer) { + super(); + this.eContainer = eContainer; + } + postConstruct() { + const { beans, gos, eContainer } = this; + const rangeSvc = beans.rangeSvc; + const params = { + eElement: eContainer, + onDragStart: rangeSvc.onDragStart.bind(rangeSvc), + onDragStop: rangeSvc.onDragStop.bind(rangeSvc), + onDragging: rangeSvc.onDragging.bind(rangeSvc) + }; + const dragSvc = beans.dragSvc; + const enableFeature = dragSvc.addDragSource.bind(dragSvc, params); + const disableFeature = dragSvc.removeDragSource.bind(dragSvc, params); + this.addManagedPropertyListeners(["enableRangeSelection", "cellSelection"], () => { + if (_isCellSelectionEnabled(gos)) { + enableFeature(); + } else { + disableFeature(); + } + }); + this.addDestroyFunc(disableFeature); + if (_isCellSelectionEnabled(gos)) { + enableFeature(); + } + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/headerGroupCellMouseListenerFeature.ts +import { BeanStub as BeanStub53 } from "ag-grid-community"; +var HeaderGroupCellMouseListenerFeature = class extends BeanStub53 { + constructor(column, eGui) { + super(); + this.column = column; + this.eGui = eGui; + } + postConstruct() { + this.addManagedElementListeners(this.eGui, { + click: (e) => e && this.onClick(e) + }); + } + onClick(event) { + this.beans.rangeSvc?.handleColumnSelection(this.column, event); + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/rangeHeaderHighlightFeature.ts +import { BeanStub as BeanStub54 } from "ag-grid-community"; +var RangeHeaderHighlightFeature = class extends BeanStub54 { + constructor(column, comp) { + super(); + this.column = column; + this.comp = comp; + this.columnMap = /* @__PURE__ */ new Map(); + this.isActive = false; + this.resetColumnMap(); + } + postConstruct() { + this.addManagedPropertyListener("cellSelection", () => { + this.refreshActive(); + }); + this.refreshActive(); + this.setupRangeHeaderHighlight(); + } + resetColumnMap() { + this.columnMap.clear(); + let columns; + if (this.column.isColumn) { + columns = [this.column]; + } else { + columns = this.column.getDisplayedLeafColumns(); + } + for (const column of columns) { + this.columnMap.set(column, false); + } + } + refreshActive() { + const { gos, rangeSvc } = this.beans; + const selection = gos.get("cellSelection"); + this.isActive = !!(selection && rangeSvc && typeof selection === "object" && selection.enableHeaderHighlight); + } + setupRangeHeaderHighlight() { + const listener = this.onRangeSelectionChanged.bind(this); + this.addManagedEventListeners({ + rangeSelectionChanged: listener, + columnPinned: listener, + columnMoved: listener, + columnGroupOpened: listener + }); + listener(); + } + onRangeSelectionChanged() { + if (!this.isActive) { + return; + } + this.resetColumnMap(); + const ranges = this.beans.rangeSvc.getCellRanges(); + let hasRange = false; + let isAllColumnRange = true; + for (const range of ranges) { + if (hasRange) { + break; + } + for (const column of range.columns) { + if (this.columnMap.has(column)) { + this.columnMap.set(column, true); + hasRange || (hasRange = true); + } + } + } + for (const value of Array.from(this.columnMap.values())) { + if (value === false) { + isAllColumnRange = false; + break; + } + } + this.comp.toggleCss("ag-header-range-highlight", hasRange && isAllColumnRange); + } + destroy() { + super.destroy(); + this.comp = null; + this.column = null; + } +}; + +// packages/ag-grid-enterprise/src/rangeSelection/rangeService.ts +var RangeService = class extends BeanStub55 { + constructor() { + super(...arguments); + this.beanName = "rangeSvc"; + this.rangeSelectionExtensions = []; + this.cellRanges = []; + this.bodyScrollListener = this.onBodyScroll.bind(this); + this.dragging = false; + /** When dragging ends, the current range will be used to intersect all other ranges */ + this.intersectionRange = false; + this.columnRangeSelectionCtx = {}; + } + wireBeans(beans) { + this.rowModel = beans.rowModel; + this.dragSvc = beans.dragSvc; + this.colModel = beans.colModel; + this.visibleCols = beans.visibleCols; + this.cellNavigation = beans.cellNavigation; + this.ctrlsSvc = beans.ctrlsSvc; + } + postConstruct() { + const onColumnsChanged = this.onColumnsChanged.bind(this); + const removeAllCellRanges = () => this.removeAllCellRanges(); + const refreshLastRangeStart = this.refreshLastRangeStart.bind(this); + this.addManagedEventListeners({ + newColumnsLoaded: onColumnsChanged, + columnVisible: onColumnsChanged, + columnValueChanged: onColumnsChanged, + columnPivotModeChanged: removeAllCellRanges, + columnRowGroupChanged: removeAllCellRanges, + columnPivotChanged: removeAllCellRanges, + columnGroupOpened: refreshLastRangeStart, + columnMoved: refreshLastRangeStart, + columnPinned: refreshLastRangeStart + }); + this.ctrlsSvc.whenReady(this, (p) => { + const gridBodyCtrl = p.gridBodyCtrl; + this.autoScrollService = new AutoScrollService2({ + scrollContainer: gridBodyCtrl.eBodyViewport, + scrollAxis: "xy", + getVerticalPosition: () => gridBodyCtrl.scrollFeature.getVScrollPosition().top, + setVerticalPosition: (position) => gridBodyCtrl.scrollFeature.setVerticalScrollPosition(position), + getHorizontalPosition: () => gridBodyCtrl.scrollFeature.getHScrollPosition().left, + setHorizontalPosition: (position) => gridBodyCtrl.scrollFeature.setHorizontalScrollPosition(position), + shouldSkipVerticalScroll: () => !_isDomLayout(this.gos, "normal"), + shouldSkipHorizontalScroll: () => !gridBodyCtrl.scrollFeature.isHorizontalScrollShowing() + }); + }); + } + registerRangeSelectionExtension(extension) { + if (this.rangeSelectionExtensions.includes(extension)) { + return; + } + this.rangeSelectionExtensions.push(extension); + } + unregisterRangeSelectionExtension(extension) { + _removeFromArray7(this.rangeSelectionExtensions, extension); + } + shouldSuppressRangeSelection(eventTarget) { + return this.rangeSelectionExtensions.some((extension) => extension.shouldSuppressRangeSelection?.(eventTarget)); + } + shouldSkipColumn(column) { + return this.rangeSelectionExtensions.some((extension) => extension.shouldSkipColumn?.(column)); + } + isAllColumnsSelectionCell(cellPosition) { + return this.rangeSelectionExtensions.some((extension) => extension.isAllColumnsSelectionCell?.(cellPosition)); + } + isAllColumnsRange(range, allColumns) { + return this.rangeSelectionExtensions.some((extension) => extension.isAllColumnsRange?.(range, allColumns)); + } + updateSelectionModeForCell(cellPosition) { + this.setSelectionMode(this.isAllColumnsSelectionCell(cellPosition)); + } + // Drag And Drop Target Methods + onDragStart(mouseEvent) { + const gos = this.gos; + const target = mouseEvent.target; + if (!_isCellSelectionEnabled2(gos) || _getRowCtrlForEventTarget(gos, target)?.isSuppressMouseEvent(mouseEvent)) { + return; + } + if (this.shouldSuppressRangeSelection(target)) { + return; + } + const { shiftKey } = mouseEvent; + const isMultiRange = this.isMultiRange(mouseEvent); + const extendRange = shiftKey && !!this.cellRanges?.length; + if (!isMultiRange && (!extendRange || _exists24(_last16(this.cellRanges).type))) { + this.removeAllCellRanges(true); + } + const startTarget = this.dragSvc.startTarget; + if (startTarget) { + this.updateValuesOnMove(startTarget); + } + if (!this.lastCellHovered) { + return; + } + this.dragging = true; + this.lastMouseEvent = mouseEvent; + this.intersectionRange = isMultiRange && this.getCellRangeCount(this.lastCellHovered) > 1; + if (!extendRange) { + this.setNewestRangeStartCell(this.lastCellHovered); + } + if (this.cellRanges.length > 0) { + this.draggingRange = _last16(this.cellRanges); + } else { + const mouseRowPosition = { + rowIndex: this.lastCellHovered.rowIndex, + rowPinned: this.lastCellHovered.rowPinned + }; + const columns = this.getColumnsFromModel([this.lastCellHovered.column]); + if (!columns?.length) { + return; + } + this.draggingRange = { + startRow: mouseRowPosition, + endRow: mouseRowPosition, + columns, + startColumn: this.newestRangeStartCell.column + }; + this.cellRanges.push(this.draggingRange); + } + this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.addEventListener("scroll", this.bodyScrollListener, { passive: true }); + this.dispatchChangedEvent(true, false, this.draggingRange.id); + } + onDragging(mouseEvent) { + const { dragging, lastCellHovered, newestRangeStartCell, autoScrollService, cellHasChanged } = this; + if (!dragging || !mouseEvent) { + return; + } + this.updateValuesOnMove(mouseEvent.target); + this.lastMouseEvent = mouseEvent; + const isMouseAndStartInPinned = (position) => lastCellHovered && lastCellHovered.rowPinned === position && newestRangeStartCell.rowPinned === position; + const skipVerticalScroll = isMouseAndStartInPinned("top") || isMouseAndStartInPinned("bottom"); + autoScrollService.check(mouseEvent, skipVerticalScroll); + if (!cellHasChanged || !lastCellHovered) { + return; + } + const startColumn = newestRangeStartCell?.column; + const currentColumn = lastCellHovered?.column; + const columns = this.calculateColumnsBetween(startColumn, currentColumn); + if (!columns) { + return; + } + const { rowIndex, rowPinned } = lastCellHovered; + this.draggingRange.endRow = { + rowIndex, + rowPinned + }; + this.draggingRange.columns = columns; + this.dispatchChangedEvent(false, false, this.draggingRange.id); + } + onDragStop() { + if (!this.dragging) { + return; + } + const { id } = this.draggingRange; + this.autoScrollService.ensureCleared(); + this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.removeEventListener("scroll", this.bodyScrollListener); + this.lastMouseEvent = null; + this.dragging = false; + this.draggingRange = void 0; + this.lastCellHovered = void 0; + if (this.intersectionRange) { + this.intersectionRange = false; + this.intersectLastRange(); + } + this.dispatchChangedEvent(false, true, id); + } + // Called for both columns loaded and column visibility events + onColumnsChanged() { + this.refreshLastRangeStart(); + const allColumns = this.visibleCols.allCols; + for (const cellRange of this.cellRanges) { + const beforeCols = cellRange.columns; + cellRange.columns = cellRange.columns.filter( + (col) => col.isVisible() && allColumns.indexOf(col) !== -1 + ); + const colsInRangeChanged = !_areEqual5(beforeCols, cellRange.columns); + if (colsInRangeChanged) { + this.dispatchChangedEvent(false, true, cellRange.id); + } + } + const countBefore = this.cellRanges.length; + this.cellRanges = this.cellRanges.filter((range) => range.columns.length > 0); + if (countBefore > this.cellRanges.length) { + this.dispatchChangedEvent(false, true); + } + } + refreshLastRangeStart() { + const lastRange = _last16(this.cellRanges); + if (!lastRange) { + return; + } + this.refreshRangeStart(lastRange); + } + isContiguousRange(cellRange) { + const rangeColumns = cellRange.columns; + if (!rangeColumns.length) { + return false; + } + const allColumns = this.visibleCols.allCols; + const allPositions = rangeColumns.map((c) => allColumns.indexOf(c)).sort((a, b) => a - b); + return _last16(allPositions) - allPositions[0] + 1 === rangeColumns.length; + } + getRangeStartRow(cellRange) { + if (cellRange.startRow && cellRange.endRow) { + return _isRowBefore4(cellRange.startRow, cellRange.endRow) ? cellRange.startRow : cellRange.endRow; + } + const pinnedTopRowCount = this.beans.pinnedRowModel?.getPinnedTopRowCount() ?? 0; + const rowPinned = pinnedTopRowCount > 0 ? "top" : null; + return { rowIndex: 0, rowPinned }; + } + getRangeEndRow(cellRange) { + if (cellRange.startRow && cellRange.endRow) { + return _isRowBefore4(cellRange.startRow, cellRange.endRow) ? cellRange.endRow : cellRange.startRow; + } + const pinnedBottomRowCount = this.beans.pinnedRowModel?.getPinnedBottomRowCount() ?? 0; + const pinnedBottom = pinnedBottomRowCount > 0; + if (pinnedBottom) { + return { + rowIndex: pinnedBottomRowCount - 1, + rowPinned: "bottom" + }; + } + return { + rowIndex: this.rowModel.getRowCount() - 1, + rowPinned: null + }; + } + getRangeRowCount(cellRange) { + const beans = this.beans; + const start = this.getRangeStartRow(cellRange); + const end = this.getRangeEndRow(cellRange); + const startIndex = _getAbsoluteRowIndex(beans, start); + const endIndex = _getAbsoluteRowIndex(beans, end); + return endIndex - startIndex + 1; + } + handleCellMouseDown(event, cell) { + const isMultiKey = event.ctrlKey || event.metaKey; + this.handleCellSelectionInput(cell, { + target: event.target, + shiftKey: event.shiftKey, + isRightClick: _interpretAsRightClick2(this.beans, event), + isMultiRange: this.isMultiRange(event), + isMultiKey, + preventDefault: () => event.preventDefault() + }); + } + handleCellKeyboardSelect(event, cell) { + const isMultiKey = event.ctrlKey || event.metaKey; + this.handleCellSelectionInput(cell, { + target: event.target, + shiftKey: event.shiftKey, + // keyboard selection should never be interpreted as a right click. + isRightClick: false, + isMultiRange: this.isMultiRangeForKeyState(isMultiKey), + isMultiKey, + preventDefault: () => event.preventDefault() + }); + } + handleCellSelectionInput(cell, params) { + const { target, shiftKey, isRightClick, isMultiRange, isMultiKey, preventDefault } = params; + if (this.shouldSuppressRangeSelection(target)) { + return; + } + const isAllColumnsCell = this.isAllColumnsSelectionCell(cell); + if (isAllColumnsCell) { + preventDefault(); + } + if (shiftKey) { + return this.extendLatestRangeToCell(cell); + } + if (isAllColumnsCell && isRightClick) { + return; + } + this.updateSelectionModeForCell(cell); + const columns = this.calculateColumnsBetween(cell.column, cell.column); + if (!columns) { + return; + } + const containingRange = isAllColumnsCell ? this.findContainingRange({ + columns, + startRow: cell, + endRow: cell + }) : void 0; + const isMultiRangeRemoval = isAllColumnsCell && !!containingRange && isMultiRange && isMultiKey; + if (isMultiRangeRemoval && containingRange) { + this.removeRowFromAllColumnsRange(cell, containingRange); + } else { + this.setRangeToCell(cell, isMultiRange); + } + } + isMultiRange(event) { + return this.isMultiRangeForKeyState(event.ctrlKey || event.metaKey); + } + isMultiRangeForKeyState(isMultiKey) { + const { editingWithRanges, allowMulti } = this.getMultiRangeContext(); + return editingWithRanges || (allowMulti ? isMultiKey : false); + } + getMultiRangeContext() { + const { gos, editSvc } = this.beans; + const editingWithRanges = !!editSvc?.isEditing() && !!editSvc?.isRangeSelectionEnabledWhileEditing(); + const suppressMultiRanges = _getSuppressMultiRanges(gos) && !editingWithRanges; + return { + editingWithRanges, + suppressMultiRanges, + allowMulti: !suppressMultiRanges + }; + } + removeRowFromAllColumnsRange(cell, containingRange) { + const { beans, cellRanges } = this; + const firstRow = _getFirstRow2(beans); + const lastRow = _getLastRow2(beans); + const startRow = this.getRangeStartRow(containingRange); + const endRow = this.getRangeEndRow(containingRange); + if (!startRow && _isSameRow6(firstRow, cell)) { + replaceEdgeRow(containingRange, _getRowBelow4(beans, firstRow), "top"); + } else if (!endRow && _isSameRow6(lastRow, cell)) { + replaceEdgeRow(containingRange, _getRowAbove2(beans, lastRow), "bottom"); + } else if (_isSameRow6(startRow, endRow)) { + _removeFromArray7(cellRanges, containingRange); + } else if (_isSameRow6(startRow, cell)) { + replaceEdgeRow(containingRange, _getRowBelow4(beans, cell), "top"); + } else if (_isSameRow6(endRow, cell)) { + replaceEdgeRow(containingRange, _getRowAbove2(beans, cell), "bottom"); + } else { + const rowAbove = _getRowAbove2(beans, cell); + const rowBelow = _getRowBelow4(beans, cell); + containingRange.startRow = startRow; + containingRange.endRow = rowAbove ?? void 0; + cellRanges.push({ + ...containingRange, + startRow: rowBelow ?? void 0, + endRow + }); + } + this.dispatchChangedEvent(true, true); + } + setRangeToCell(cell, appendRange = false) { + const { gos } = this; + if (!_isCellSelectionEnabled2(gos)) { + return; + } + this.updateSelectionModeForCell(cell); + const columns = this.calculateColumnsBetween(cell.column, cell.column); + if (!columns) { + return; + } + const { suppressMultiRanges } = this.getMultiRangeContext(); + if (suppressMultiRanges || !appendRange || _missing7(this.cellRanges)) { + this.removeAllCellRanges(true); + } + const rowForCell = { + rowIndex: cell.rowIndex, + rowPinned: cell.rowPinned + }; + const cellRange = { + startRow: rowForCell, + endRow: rowForCell, + columns, + startColumn: cell.column + }; + const startColumn = this.ensureRangeStartColumn(cellRange); + if (!startColumn) { + return; + } + this.cellRanges.push(cellRange); + this.setNewestRangeStartCell({ ...cell, column: startColumn }); + this.onDragStop(); + this.dispatchChangedEvent(true, true); + } + getRangeLastColumn(cellRange) { + const firstCol = cellRange.columns[0]; + const lastCol = _last16(cellRange.columns); + return this.newestRangeStartCell?.column === firstCol ? lastCol : firstCol; + } + extendRangeRowCountBy(cellRange, targetCount) { + const { beans } = this; + const { startRow, endRow } = cellRange; + if (!startRow || !endRow) { + return; + } + let stepsMoved = 0; + let currentRow; + const isBottomUp = _isRowBefore4(endRow, startRow); + if (isBottomUp) { + currentRow = startRow; + } else { + currentRow = endRow; + } + const stepFn = targetCount > 0 ? _getRowBelow4 : _getRowAbove2; + const stepCount = Math.abs(targetCount); + while (stepsMoved < stepCount) { + const nextRow = stepFn(beans, currentRow); + if (!nextRow) { + break; + } + currentRow = nextRow; + stepsMoved++; + } + if (stepsMoved !== stepCount) { + return; + } + const cellPosition = { + ...currentRow, + column: this.getRangeLastColumn(cellRange) + }; + this.updateRangeRowBoundary({ cellRange, boundary: isBottomUp ? "start" : "end", cellPosition }); + } + extendRangeColumnCountBy(cellRange, delta) { + const { columns } = cellRange; + if (delta === 0) { + return; + } + const allColumns = this.getColumnsFromModel(); + if (!allColumns) { + return; + } + const rangeStartColumn = this.ensureRangeStartColumn(cellRange); + if (!rangeStartColumn) { + return; + } + const lastColumn = _last16(columns); + const endColumn = rangeStartColumn === columns[0] ? lastColumn : columns[0]; + if (!lastColumn || !endColumn) { + return; + } + let startIdx = allColumns.indexOf(rangeStartColumn); + const endIdx = allColumns.indexOf(endColumn); + const isRtlRange = endIdx < startIdx; + if (isRtlRange) { + startIdx = endIdx; + } + const currentLength = columns.length; + const targetLength = currentLength + delta; + if (targetLength <= 0) { + return; + } + const newColumns = []; + for (let i = startIdx; i < startIdx + targetLength; i++) { + const col = allColumns[i]; + if (!col) { + break; + } + newColumns.push(col); + } + if (newColumns.length === targetLength) { + if (isRtlRange) { + const newColumnToFocus = _last16(newColumns); + cellRange.startColumn = newColumnToFocus; + this.focusCellOnNewColumn(cellRange, newColumnToFocus); + } + cellRange.columns = newColumns; + this.dispatchChangedEvent(true, true, cellRange.id); + } + } + extendLatestRangeToCell(cellPosition) { + if (this.isEmpty() || !this.newestRangeStartCell) { + return; + } + const cellRange = _last16(this.cellRanges); + this.updateSelectionModeForCell(cellPosition); + this.updateRangeRowBoundary({ cellRange, boundary: "end", cellPosition }); + } + extendRangeToCell(cellRange, cellPosition) { + if (!cellRange) { + return; + } + this.updateSelectionModeForCell(cellPosition); + this.updateRangeRowBoundary({ cellRange, boundary: "end", cellPosition }); + } + updateRangeRowBoundary(params) { + const { cellRange, boundary, cellPosition, silent = false } = params; + const endColumn = cellPosition.column; + const startColumn = this.ensureRangeStartColumn(cellRange); + if (!startColumn) { + return; + } + const colsToAdd = this.calculateColumnsBetween(startColumn, endColumn); + if (!colsToAdd || isLastCellOfRange(cellRange, cellPosition)) { + return; + } + if (boundary === "start") { + this.focusCellOnNewRow(cellRange, cellPosition); + } + cellRange.columns = colsToAdd; + cellRange[boundary === "start" ? "startRow" : "endRow"] = { + rowIndex: cellPosition.rowIndex, + rowPinned: cellPosition.rowPinned + }; + if (!silent) { + this.dispatchChangedEvent(true, true, cellRange.id); + } + } + getRangeEdgeColumns(cellRange) { + const allColumns = this.visibleCols.allCols; + const allIndices = cellRange.columns.map((c) => allColumns.indexOf(c)).filter((i) => i > -1).sort((a, b) => a - b); + return { + left: allColumns[allIndices[0]], + right: allColumns[_last16(allIndices)] + }; + } + // returns true if successful, false if not successful + extendLatestRangeInDirection(event) { + if (this.isEmpty() || !this.newestRangeStartCell) { + return; + } + const key = event.key; + const ctrlKey = event.ctrlKey || event.metaKey; + const lastRange = _last16(this.cellRanges); + const startCell = this.newestRangeStartCell; + const endCellIndex = lastRange.endRow.rowIndex; + const endCellFloating = lastRange.endRow.rowPinned; + const endCellColumn = this.getRangeLastColumn(lastRange); + const endCell = { column: endCellColumn, rowIndex: endCellIndex, rowPinned: endCellFloating }; + const newEndCell = this.cellNavigation.getNextCellToFocus(key, endCell, ctrlKey); + if (!newEndCell) { + return; + } + if (this.shouldSkipColumn(newEndCell.column)) { + return; + } + this.setCellRange({ + rowStartIndex: startCell.rowIndex, + rowStartPinned: startCell.rowPinned, + rowEndIndex: newEndCell.rowIndex, + rowEndPinned: newEndCell.rowPinned, + columnStart: startCell.column, + columnEnd: newEndCell.column + }); + return newEndCell; + } + setCellRange(params) { + if (!_isCellSelectionEnabled2(this.gos)) { + return; + } + this.removeAllCellRanges(true); + this.addCellRange(params); + } + setCellRanges(cellRanges) { + if (_areEqual5(this.cellRanges, cellRanges)) { + return; + } + if (!this.verifyCellRanges(this.gos)) { + return; + } + this.setSelectionMode(false); + this.removeAllCellRanges(true); + const allDataColumns = this.getColumnsFromModel(this.visibleCols.allCols) ?? []; + let hasAllColumnsRange = false; + for (const cellRange of cellRanges) { + if (cellRange.columns && cellRange.startRow) { + const columns = this.getColumnsFromModel(cellRange.columns); + if (!columns || columns.length === 0) { + continue; + } + cellRange.columns = columns; + const { startRow } = cellRange; + this.setNewestRangeStartCell({ + rowIndex: startRow.rowIndex, + rowPinned: startRow.rowPinned, + column: cellRange.columns[0] + }); + } + if (!hasAllColumnsRange && allDataColumns.length > 0 && this.isAllColumnsRange(cellRange, allDataColumns)) { + hasAllColumnsRange = true; + } + this.cellRanges.push(cellRange); + } + this.setSelectionMode(hasAllColumnsRange); + this.dispatchChangedEvent(false, true); + } + clearCellRangeCellValues(params) { + const { beans, eventSvc } = this; + const { + cellEventSource = "rangeSvc", + dispatchWrapperEvents, + wrapperEventSource = "deleteKey", + restoreSourceInBatch + } = params; + let { cellRanges } = params; + if (dispatchWrapperEvents) { + eventSvc.dispatchEvent({ + type: "cellSelectionDeleteStart", + source: wrapperEventSource + }); + eventSvc.dispatchEvent({ + type: "rangeDeleteStart", + source: wrapperEventSource + }); + } + if (!cellRanges) { + cellRanges = this.cellRanges; + } + const { valueSvc, editSvc } = beans; + const batch = !!editSvc?.isBatchEditing(); + const { changeDetectionSvc } = beans; + changeDetectionSvc?.beginDeferred(); + try { + this.forEachEditableCellInRanges(cellRanges, (rowNode, column) => { + if (restoreSourceInBatch && batch) { + editSvc?.batchResetToSourceValue({ rowNode, column }); + return; + } + const deleteValue = valueSvc.getDeleteValue(column, rowNode); + rowNode.setDataValue(column, deleteValue, cellEventSource); + }); + } finally { + changeDetectionSvc?.endDeferred(); + } + if (dispatchWrapperEvents) { + eventSvc.dispatchEvent({ + type: "cellSelectionDeleteEnd", + source: wrapperEventSource + }); + eventSvc.dispatchEvent({ + type: "rangeDeleteEnd", + source: wrapperEventSource + }); + } + } + createCellRangeFromCellRangeParams(params) { + return this.createPartialCellRangeFromRangeParams(params, false); + } + // range service can't normally support a range without columns, but charts can + createPartialCellRangeFromRangeParams(params, allowEmptyColumns) { + const { + columns: paramColumns, + columnStart, + columnEnd, + rowStartIndex, + rowStartPinned, + rowEndIndex, + rowEndPinned + } = params; + const columnInfo = this.getColumnsFromParams( + paramColumns, + columnStart, + columnEnd + ); + if (!columnInfo || !allowEmptyColumns && columnInfo.columns.length === 0) { + return; + } + const { columns, startsOnTheRight } = columnInfo; + const startRow = createRowPosition(rowStartIndex, rowStartPinned); + const endRow = createRowPosition(rowEndIndex, rowEndPinned); + return { + startRow, + endRow, + columns, + startColumn: this.getColumnFromModel(columnStart) ?? (startsOnTheRight ? _last16(columns) : columns[0]) + }; + } + addCellRange(params) { + const gos = this.gos; + if (!_isCellSelectionEnabled2(gos) || !this.verifyCellRanges(gos)) { + return; + } + this.setSelectionMode(false); + const newRange = this.createCellRangeFromCellRangeParams(params); + if (newRange) { + if (newRange.startRow) { + this.setNewestRangeStartCell({ + rowIndex: newRange.startRow.rowIndex, + rowPinned: newRange.startRow.rowPinned, + column: newRange.startColumn + }); + } + this.cellRanges.push(newRange); + this.dispatchChangedEvent(false, true, newRange.id); + return newRange; + } + } + getCellRanges() { + return this.cellRanges; + } + isEmpty() { + return this.cellRanges.length === 0; + } + isMoreThanOneCell() { + const len = this.cellRanges.length; + if (len === 0) { + return false; + } + if (len > 1) { + return true; + } + const range = this.cellRanges[0]; + const startRow = this.getRangeStartRow(range); + const endRow = this.getRangeEndRow(range); + return startRow.rowPinned !== endRow.rowPinned || startRow.rowIndex !== endRow.rowIndex || range.columns.length !== 1; + } + areAllRangesAbleToMerge() { + const rowToColumnMap = /* @__PURE__ */ new Map(); + const len = this.cellRanges.length; + if (len <= 1) { + return true; + } + for (const range of this.cellRanges) { + this.forEachRowInRange(range, (row) => { + const rowName = `${row.rowPinned || "normal"}_${row.rowIndex}`; + const columns = rowToColumnMap.get(rowName); + const currentRangeColIds = range.columns.map((col) => col.getId()); + if (columns) { + const filteredColumns = currentRangeColIds.filter((col) => columns.indexOf(col) === -1); + columns.push(...filteredColumns); + } else { + rowToColumnMap.set(rowName, currentRangeColIds); + } + }); + } + let columnsString; + for (const val of rowToColumnMap.values()) { + const currentValString = val.sort().join(); + if (columnsString === void 0) { + columnsString = currentValString; + continue; + } + if (columnsString !== currentValString) { + return false; + } + } + return true; + } + removeAllCellRanges(silent) { + if (this.isEmpty()) { + return; + } + this.onDragStop(); + this.cellRanges.length = 0; + if (!silent) { + this.dispatchChangedEvent(false, true); + } + } + isCellInAnyRange(cell) { + return this.getCellRangeCount(cell) > 0; + } + isCellInSpecificRange(cell, range) { + const columnInRange = range.columns?.includes(cell.column); + const rowInRange = this.isRowInRange(cell, range); + return columnInRange && rowInRange; + } + isColumnInAnyRange(column) { + const { beans } = this; + const firstRow = _getFirstRow2(beans); + const lastRow = _getLastRow2(beans); + if (!firstRow || !lastRow) { + return false; + } + const columns = column.isColumn ? [column] : column.getDisplayedLeafColumns(); + return this.findContainingRange({ columns, startRow: firstRow, endRow: lastRow }, true) != null; + } + findContainingRange({ columns, startRow, endRow }, matchOnly = false) { + const ranges = this.cellRanges; + for (let i = ranges.length - 1; i >= 0; i--) { + const range = ranges[i]; + const hasCols = columns.every((c) => range.columns.includes(c)); + let condition = false; + if (matchOnly) { + condition = _isSameRow6(range.startRow, startRow) && _isSameRow6(range.endRow, endRow); + } else { + const isStartBeforeOrEqual = startRow && this.isRowInRange(startRow, range); + const isEndAfterOrEqual = endRow && this.isRowInRange(endRow, range); + condition = !!isStartBeforeOrEqual && !!isEndAfterOrEqual; + } + if (hasCols && condition) { + return range; + } + } + } + isBottomRightCell(cellRange, cell) { + const allColumns = this.visibleCols.allCols; + const allPositions = cellRange.columns.map((c) => allColumns.indexOf(c)).sort((a, b) => a - b); + const { startRow, endRow } = cellRange; + const lastRow = _isRowBefore4(startRow, endRow) ? endRow : startRow; + const isRightColumn = allColumns.indexOf(cell.column) === _last16(allPositions); + const isLastRow = cell.rowIndex === lastRow.rowIndex && _makeNull8(cell.rowPinned) === _makeNull8(lastRow.rowPinned); + return isRightColumn && isLastRow; + } + // returns the number of ranges this cell is in + getCellRangeCount(cell) { + return this.cellRanges.filter((cellRange) => this.isCellInSpecificRange(cell, cellRange)).length; + } + isRowInRange(thisRow, cellRange) { + const firstRow = this.getRangeStartRow(cellRange); + const lastRow = this.getRangeEndRow(cellRange); + const equalsFirstRow = _isSameRow6(thisRow, firstRow); + const equalsLastRow = _isSameRow6(thisRow, lastRow); + if (equalsFirstRow || equalsLastRow) { + return true; + } + const afterFirstRow = !_isRowBefore4(thisRow, firstRow); + const beforeLastRow = _isRowBefore4(thisRow, lastRow); + return afterFirstRow && beforeLastRow; + } + intersectLastRange(fromMouseClick) { + const { editingWithRanges, suppressMultiRanges } = this.getMultiRangeContext(); + if (editingWithRanges || suppressMultiRanges || fromMouseClick && this.dragging || this.isEmpty()) { + return; + } + const lastRange = _last16(this.cellRanges); + const intersectionStartRow = this.getRangeStartRow(lastRange); + const intersectionEndRow = this.getRangeEndRow(lastRange); + const newRanges = []; + for (const range of this.cellRanges.slice(0, -1)) { + const startRow = this.getRangeStartRow(range); + const endRow = this.getRangeEndRow(range); + const cols = range.columns; + const intersectCols = cols.filter((col) => lastRange.columns.indexOf(col) === -1); + if (intersectCols.length === cols.length) { + newRanges.push(range); + continue; + } + if (_isRowBefore4(intersectionEndRow, startRow) || _isRowBefore4(endRow, intersectionStartRow)) { + newRanges.push(range); + continue; + } + const rangeCountBefore = newRanges.length; + if (_isRowBefore4(startRow, intersectionStartRow)) { + const top = { + columns: [...cols], + startColumn: lastRange.startColumn, + startRow: { ...startRow }, + endRow: _getRowAbove2(this.beans, intersectionStartRow) + }; + newRanges.push(top); + } + if (intersectCols.length > 0) { + const middle = { + columns: intersectCols, + startColumn: intersectCols.includes(lastRange.startColumn) ? lastRange.startColumn : intersectCols[0], + startRow: rowMax([{ ...intersectionStartRow }, { ...startRow }]), + endRow: rowMin([{ ...intersectionEndRow }, { ...endRow }]) + }; + newRanges.push(middle); + } + if (_isRowBefore4(intersectionEndRow, endRow)) { + newRanges.push({ + columns: [...cols], + startColumn: lastRange.startColumn, + startRow: _getRowBelow4(this.beans, intersectionEndRow), + endRow: { ...endRow } + }); + } + if (newRanges.length - rangeCountBefore === 1) { + newRanges[newRanges.length - 1].id = range.id; + } + } + this.cellRanges = newRanges; + if (fromMouseClick) { + this.dispatchChangedEvent(false, true); + } + } + createRangeHighlightFeature(compBean, column, headerComp) { + compBean.createManagedBean(new RangeHeaderHighlightFeature(column, headerComp)); + } + setSelectionMode(allColumns) { + this.selectionMode = allColumns ? 1 /* ALL_COLUMNS */ : 0 /* NORMAL */; + } + refreshRangeStart(cellRange) { + const { columns } = cellRange; + const startColumn = this.ensureRangeStartColumn(cellRange); + if (!startColumn) { + return; + } + const moveColInCellRange = (colToMove, moveToFront) => { + const otherCols = cellRange.columns.filter((col) => col !== colToMove); + if (colToMove) { + cellRange.startColumn = colToMove; + cellRange.columns = moveToFront ? [colToMove, ...otherCols] : [...otherCols, colToMove]; + } else { + cellRange.columns = otherCols; + } + }; + const { left, right } = this.getRangeEdgeColumns(cellRange); + const shouldMoveLeftCol = startColumn === columns[0] && startColumn !== left; + if (shouldMoveLeftCol) { + moveColInCellRange(left, true); + return; + } + const shouldMoveRightCol = startColumn === _last16(columns) && startColumn === right; + if (shouldMoveRightCol) { + moveColInCellRange(right, false); + } + } + setNewestRangeStartCell(position) { + this.newestRangeStartCell = position; + } + getColumnsFromParams(columns, columnA, columnB) { + const noColsInfo = !columns && !columnA && !columnB; + let processedColumns; + let startsOnTheRight = false; + if (noColsInfo || columns) { + processedColumns = this.getColumnsFromModel(noColsInfo ? void 0 : columns); + } else if (columnA && columnB) { + processedColumns = this.calculateColumnsBetween(columnA, columnB); + if (processedColumns?.length) { + startsOnTheRight = processedColumns[0] !== this.getColumnFromModel(columnA); + } + } + return processedColumns ? { + columns: processedColumns, + startsOnTheRight + } : void 0; + } + verifyCellRanges(gos) { + const { suppressMultiRanges } = this.getMultiRangeContext(); + const invalid = _isUsingNewCellSelectionAPI(gos) && suppressMultiRanges && this.cellRanges.length > 1; + if (invalid) { + _warn42(93); + } + return !invalid; + } + forEachRowInRange(cellRange, callback) { + const topRow = this.getRangeStartRow(cellRange); + const bottomRow = this.getRangeEndRow(cellRange); + let currentRow = topRow; + while (currentRow) { + callback(currentRow); + if (_isSameRow6(currentRow, bottomRow)) { + break; + } + currentRow = _getRowBelow4(this.beans, currentRow); + } + } + forEachEditableCellInRanges(cellRanges, callback) { + const { beans } = this; + for (const cellRange of cellRanges) { + this.forEachRowInRange(cellRange, (rowPosition) => { + const rowNode = _getRowNode7(beans, rowPosition); + if (!rowNode) { + return; + } + for (let i = 0; i < cellRange.columns.length; i++) { + const column = this.getColumnFromModel(cellRange.columns[i]); + if (!column?.isCellEditable(rowNode)) { + continue; + } + callback(rowNode, column); + } + }); + } + } + // as the user is dragging outside of the panel, the div starts to scroll, which in turn + // means we are selecting more (or less) cells, but the mouse isn't moving, so we recalculate + // the selection by mimicking a new mouse event + onBodyScroll() { + if (this.dragging && this.lastMouseEvent) { + this.onDragging(this.lastMouseEvent); + } + } + updateValuesOnMove(eventTarget) { + const cellCtrl = _getCellCtrlForEventTarget(this.gos, eventTarget); + const cell = cellCtrl?.cellPosition; + this.cellHasChanged = false; + if (!cell || this.lastCellHovered && _areCellsEqual2(cell, this.lastCellHovered)) { + return; + } + const editSvc = this.beans.editSvc; + const editing = editSvc?.isEditing(cellCtrl, { + withOpenEditor: true + }); + if (editing && !editSvc?.isRangeSelectionEnabledWhileEditing()) { + this.dragSvc.cancelDrag(eventTarget); + return; + } + if (this.lastCellHovered) { + this.cellHasChanged = true; + } + this.lastCellHovered = cell; + } + dispatchChangedEvent(started, finished, id) { + this.eventSvc.dispatchEvent({ + type: "cellSelectionChanged", + started, + finished, + id + }); + this.eventSvc.dispatchEvent({ + type: "rangeSelectionChanged", + started, + finished, + id + }); + } + getColumnFromModel(col) { + return typeof col === "string" ? this.colModel.getCol(col) : col; + } + getColumnsFromModel(cols) { + const { visibleCols, selectionMode } = this; + if (!cols || selectionMode === 1 /* ALL_COLUMNS */) { + cols = visibleCols.allCols; + } + const columns = []; + for (const col of cols) { + const column = this.getColumnFromModel(col); + if (!column || this.shouldSkipColumn(column)) { + continue; + } + columns.push(column); + } + return columns.length ? columns : void 0; + } + ensureRangeStartColumn(cellRange) { + const startColumn = this.getRangeStartColumn( + cellRange.columns, + cellRange.startColumn + ); + if (!startColumn) { + return; + } + cellRange.startColumn = startColumn; + return startColumn; + } + getRangeStartColumn(columns, preferredStartColumn) { + const firstColumn = columns[0]; + const lastColumn = _last16(columns); + if (!firstColumn || !lastColumn) { + return; + } + if (!preferredStartColumn || columns.includes(preferredStartColumn)) { + return preferredStartColumn ?? firstColumn; + } + const allColumns = this.visibleCols.allCols; + const preferredStartIndex = allColumns.indexOf(preferredStartColumn); + const firstIndex = allColumns.indexOf(firstColumn); + const lastIndex = allColumns.indexOf(lastColumn); + if (preferredStartIndex < 0 || firstIndex < 0 || lastIndex < 0) { + return firstColumn; + } + return preferredStartIndex - firstIndex <= lastIndex - preferredStartIndex ? firstColumn : lastColumn; + } + calculateColumnsBetween(columnA, columnB) { + const allColumns = this.visibleCols.allCols; + const fromColumn = this.getColumnFromModel(columnA); + const toColumn = this.getColumnFromModel(columnB); + const isSameColumn = fromColumn === toColumn; + const fromIndex = allColumns.indexOf(fromColumn); + if (fromIndex < 0) { + _warn42(178, { colId: fromColumn.getId() }); + return; + } + const toIndex = isSameColumn ? fromIndex : allColumns.indexOf(toColumn); + if (toIndex < 0) { + _warn42(178, { colId: toColumn.getId() }); + return; + } + if (isSameColumn || this.selectionMode === 1 /* ALL_COLUMNS */) { + return this.getColumnsFromModel([fromColumn]); + } + const firstIndex = Math.min(fromIndex, toIndex); + const lastIndex = firstIndex === fromIndex ? toIndex : fromIndex; + return this.getColumnsFromModel(allColumns.slice(firstIndex, lastIndex + 1)); + } + focusCellOnNewColumn(currentRange, column) { + const { focusSvc } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + if (!focusedCell) { + return; + } + if (this.isCellInSpecificRange(focusedCell, currentRange)) { + focusSvc.setFocusedCell({ + ...focusedCell, + column, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true + }); + } + } + focusCellOnNewRow(currentRange, row) { + const { focusSvc } = this.beans; + const focusedCell = focusSvc.getFocusedCell(); + if (!focusedCell) { + return; + } + if (this.isCellInSpecificRange(focusedCell, currentRange)) { + focusSvc.setFocusedCell({ + ...row, + column: focusedCell.column, + forceBrowserFocus: true, + preventScrollOnBrowserFocus: true + }); + } + } + createDragListenerFeature(eContainer) { + return new DragListenerFeature(eContainer); + } + createCellRangeFeature(ctrl) { + return new CellRangeFeature(this.beans, ctrl); + } + createHeaderGroupCellMouseListenerFeature(column, eGui) { + return new HeaderGroupCellMouseListenerFeature(column, eGui); + } + /** + * Handle a user clicking column header to (de)select one or more column of cells + * CTRL-clicking for toggling column selection + CTRL-SHIFT-clicking supported for selecting ranges of columns + */ + handleColumnSelection(clickedColumn, event) { + const { gos, beans, columnRangeSelectionCtx: ctx, cellRanges } = this; + if (!_getEnableColumnSelection(gos)) { + return; + } + const { suppressMultiRanges, editingWithRanges } = this.getMultiRangeContext(); + const hasRanges = cellRanges.length > 0; + const isMeta = event.ctrlKey || event.metaKey; + const allowToggle = !editingWithRanges || isMeta; + const firstRow = _getFirstRow2(beans); + const lastRow = _getLastRow2(beans); + if (!firstRow || !lastRow) { + return; + } + if (event.key === KeyCode31.ENTER) { + event.preventDefault(); + } + if (event.shiftKey) { + const root = ctx.root; + if (!root) { + return; + } + const column = clickedColumn.isColumn ? clickedColumn : _last16(clickedColumn.getLeafColumns()); + const range = this.findContainingRange({ columns: [root], startRow: firstRow, endRow: lastRow }, true); + if (!range) { + _removeFromArray7(cellRanges, ctx.lastCellRange); + this.selectColumns(this.calculateColumnsBetween(root, column), firstRow, lastRow); + return; + } + this.updateRangeRowBoundary({ cellRange: range, boundary: "end", cellPosition: { column, ...lastRow } }); + return; + } + if (hasRanges && (suppressMultiRanges || !isMeta && !editingWithRanges)) { + this.removeAllCellRanges(true); + } + const toggleColumns = (columns, root) => { + const foundRange = this.findContainingRange({ columns, startRow: firstRow, endRow: lastRow }, true); + if (foundRange && allowToggle) { + this.deselectColumnsFromRange(foundRange, columns); + } else { + const addedRange = this.selectColumns(columns, firstRow, lastRow); + if (addedRange) { + ctx.lastCellRange = addedRange; + } + } + ctx.root = root; + }; + if (clickedColumn.isColumn) { + toggleColumns([clickedColumn], clickedColumn); + } else { + const leafCols = clickedColumn.getDisplayedLeafColumns(); + toggleColumns(leafCols, leafCols[0]); + } + } + deselectColumnsFromRange(range, columns) { + _removeAllFromArray2(range.columns, columns); + if (columns.includes(range.startColumn)) { + range.startColumn = range.columns[0]; + } + if (range.columns.length === 0) { + _removeFromArray7(this.cellRanges, range); + } + this.dispatchChangedEvent(true, true); + } + selectColumns(columns, startRow, endRow) { + return this.addCellRange({ + columns, + columnStart: columns[0], + columnEnd: _last16(columns), + rowStartIndex: startRow.rowIndex, + rowStartPinned: startRow.rowPinned, + rowEndIndex: endRow.rowIndex, + rowEndPinned: endRow.rowPinned + }); + } +}; +function createRowPosition(rowIndex, rowPinned) { + return rowIndex != null ? { rowIndex, rowPinned } : void 0; +} +function rowMax(rows) { + let max; + for (const row of rows) { + if (max === void 0 || _isRowBefore4(max, row)) { + max = row; + } + } + return max; +} +function rowMin(rows) { + let min; + for (const row of rows) { + if (min === void 0 || _isRowBefore4(row, min)) { + min = row; + } + } + return min; +} +function isLastCellOfRange(cellRange, cell) { + const { startRow, endRow } = cellRange; + const lastRow = _isRowBefore4(startRow, endRow) ? endRow : startRow; + const isLastRow = cell.rowIndex === lastRow.rowIndex && cell.rowPinned === lastRow.rowPinned; + const rangeFirstIndexColumn = cellRange.columns[0]; + const rangeLastIndexColumn = _last16(cellRange.columns); + const lastRangeColumn = cellRange.startColumn === rangeFirstIndexColumn ? rangeLastIndexColumn : rangeFirstIndexColumn; + const isLastColumn = cell.column === lastRangeColumn; + return isLastColumn && isLastRow; +} +function replaceEdgeRow(range, row, topOrBottom) { + let key; + if (topOrBottom === "top") { + key = !range.startRow || !range.endRow || _isRowBefore4(range.startRow, range.endRow) ? "startRow" : "endRow"; + } else { + key = !range.startRow || !range.endRow || _isRowBefore4(range.startRow, range.endRow) ? "endRow" : "startRow"; + } + range[key] = row ?? void 0; +} + +// packages/ag-grid-enterprise/src/rangeSelection/rangeSelectionModule.ts +var CellSelectionModule = { + moduleName: "CellSelection", + version: VERSION, + beans: [RangeService], + dynamicBeans: { fillHandle: AgFillHandle, rangeHandle: AgRangeHandle }, + apiFunctions: { + getCellRanges, + addCellRange, + clearRangeSelection, + clearCellSelection: clearRangeSelection + }, + dependsOn: [EnterpriseCoreModule, _KeyboardNavigationModule3, _DragModule], + css: [rangeSelection_default] +}; +var RangeSelectionModule = { + moduleName: "RangeSelection", + version: VERSION, + dependsOn: [CellSelectionModule] +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/serverSideRowModelModule.ts +import { + _CsrmSsrmSharedApiModule, + _RowModelSharedApiModule, + _SharedRowSelectionModule, + _SortModule, + _SsrmInfiniteSharedApiModule, + onRowHeightChanged, + resetRowHeights +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/cellRenderers/loadingCellRenderer.ts +import { Component as Component54, RefPlaceholder as RefPlaceholder46, _createIconNoSpan as _createIconNoSpan24 } from "ag-grid-community"; +var LoadingCellRendererElement = { + tag: "div", + cls: "ag-loading", + children: [ + { tag: "span", ref: "eLoadingIcon", cls: "ag-loading-icon" }, + { tag: "span", ref: "eLoadingText", cls: "ag-loading-text" } + ] +}; +var LoadingCellRenderer = class extends Component54 { + constructor() { + super(LoadingCellRendererElement); + this.eLoadingIcon = RefPlaceholder46; + this.eLoadingText = RefPlaceholder46; + } + init(params) { + if (params.node.failedLoad) { + this.setupFailed(); + } else { + this.setupLoading(); + } + } + setupFailed() { + this.eLoadingText.textContent = this.getLocaleTextFunc()("loadingError", "ERR"); + } + setupLoading() { + const eLoadingIcon = _createIconNoSpan24("groupLoading", this.beans, null); + if (eLoadingIcon) { + this.eLoadingIcon.appendChild(eLoadingIcon); + } + this.eLoadingText.textContent = this.getLocaleTextFunc()("loadingOoo", "Loading..."); + } + refresh(_params) { + return false; + } +}; + +// packages/ag-grid-enterprise/src/cellRenderers/enterpriseCellRendererModule.ts +var LoadingCellRendererModule = { + moduleName: "LoadingCellRenderer", + version: VERSION, + userComponents: { + agLoadingCellRenderer: LoadingCellRenderer + }, + icons: { + // rotating spinner shown by the loading cell renderer + groupLoading: "loading" + }, + dependsOn: [EnterpriseCoreModule] +}; + +// packages/ag-grid-enterprise/src/pivot/pivotModule.ts +import { _ColumnGroupModule } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/pivot/pivotApi.ts +function isPivotMode(beans) { + return beans.colModel.isPivotMode(); +} +function getPivotResultColumn(beans, pivotKeys, valueColKey) { + return beans.pivotResultCols?.lookupPivotResultCol(pivotKeys, valueColKey) ?? null; +} +function setValueColumns(beans, colKeys) { + beans.valueColsSvc?.setColumns(colKeys, "api"); +} +function getValueColumns(beans) { + return beans.valueColsSvc?.columns ?? []; +} +function removeValueColumns(beans, colKeys) { + beans.valueColsSvc?.removeColumns(colKeys, "api"); +} +function addValueColumns(beans, colKeys) { + beans.valueColsSvc?.addColumns(colKeys, "api"); +} +function setPivotColumns(beans, colKeys) { + beans.pivotColsSvc?.setColumns(colKeys, "api"); +} +function removePivotColumns(beans, colKeys) { + beans.pivotColsSvc?.removeColumns(colKeys, "api"); +} +function addPivotColumns(beans, colKeys) { + beans.pivotColsSvc?.addColumns(colKeys, "api"); +} +function getPivotColumns(beans) { + return beans.pivotColsSvc?.columns ?? []; +} +function setPivotResultColumns(beans, colDefs) { + beans.pivotResultCols?.setPivotResultCols(colDefs, "api"); +} +function getPivotResultColumns(beans) { + const pivotResultCols = beans.pivotResultCols?.getPivotResultCols(); + return pivotResultCols ? pivotResultCols.list : null; +} + +// packages/ag-grid-enterprise/src/pivot/pivotColDefService.ts +import { BeanStub as BeanStub56 } from "ag-grid-community"; +var PIVOT_ROW_TOTAL_PREFIX = "PivotRowTotal_"; +var headerNameComparator = ({ headerName: a }, { headerName: b }) => { + if (a && !b) { + return 1; + } else if (!a && b) { + return -1; + } else if (!a && !b) { + return 0; + } + if (a < b) { + return -1; + } else if (a > b) { + return 1; + } else { + return 0; + } +}; +var convertToHeaderNameComparator = (comparator) => (a, b) => comparator(a.headerName, b.headerName); +var PivotColDefService = class extends BeanStub56 { + constructor() { + super(...arguments); + this.beanName = "pivotColDefSvc"; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.pivotColsSvc = beans.pivotColsSvc; + this.valueColsSvc = beans.valueColsSvc; + this.colNames = beans.colNames; + } + postConstruct() { + const getFieldSeparator = () => this.gos.get("serverSidePivotResultFieldSeparator") ?? "_"; + this.fieldSeparator = getFieldSeparator(); + this.addManagedPropertyListener("serverSidePivotResultFieldSeparator", () => { + this.fieldSeparator = getFieldSeparator(); + }); + const getPivotDefaultExpanded = () => this.gos.get("pivotDefaultExpanded"); + this.pivotDefaultExpanded = getPivotDefaultExpanded(); + this.addManagedPropertyListener("pivotDefaultExpanded", () => { + this.pivotDefaultExpanded = getPivotDefaultExpanded(); + }); + } + createPivotColumnDefs(uniqueValues) { + const pivotColumnGroupDefs = this.createPivotColumnsFromUniqueValues(uniqueValues); + function extractColDefs(input, arr = []) { + input.forEach((def) => { + if (def.children !== void 0) { + extractColDefs(def.children, arr); + } else { + arr.push(def); + } + }); + return arr; + } + const pivotColumnDefs = extractColDefs(pivotColumnGroupDefs); + this.addRowGroupTotals(pivotColumnGroupDefs, pivotColumnDefs); + this.addExpandablePivotGroups(pivotColumnGroupDefs, pivotColumnDefs); + this.addPivotTotalsToGroups(pivotColumnGroupDefs, pivotColumnDefs); + return pivotColumnGroupDefs; + } + createPivotColumnsFromUniqueValues(uniqueValues) { + const pivotColumns = this.pivotColsSvc?.columns ?? []; + const maxDepth = pivotColumns.length; + const pivotColumnGroupDefs = this.recursivelyBuildGroup( + 0, + uniqueValues, + [], + maxDepth, + pivotColumns + ); + return pivotColumnGroupDefs; + } + recursivelyBuildGroup(index, uniqueValue, pivotKeys, maxDepth, primaryPivotColumns) { + if (index >= maxDepth) { + return this.buildMeasureCols(pivotKeys); + } + const { pivotComparator } = primaryPivotColumns[index].getColDef(); + const comparator = pivotComparator ? convertToHeaderNameComparator(pivotComparator) : headerNameComparator; + const measureColumns = this.valueColsSvc?.columns; + if (measureColumns?.length === 1 && this.gos.get("removePivotHeaderRowWhenSingleValueColumn") && index === maxDepth - 1) { + const leafCols = []; + for (const key of uniqueValue.keys()) { + const newPivotKeys = [...pivotKeys, key]; + const colDef = this.createColDef(measureColumns[0], key, newPivotKeys); + colDef.columnGroupShow = "open"; + leafCols.push(colDef); + } + leafCols.sort(comparator); + return leafCols; + } + const groups = []; + for (const key of uniqueValue.keys()) { + const openByDefault = this.pivotDefaultExpanded === -1 || index < this.pivotDefaultExpanded; + const newPivotKeys = [...pivotKeys, key]; + groups.push({ + children: this.recursivelyBuildGroup( + index + 1, + uniqueValue.get(key), + newPivotKeys, + maxDepth, + primaryPivotColumns + ), + headerName: key, + pivotKeys: newPivotKeys, + columnGroupShow: "open", + openByDefault, + groupId: this.generateColumnGroupId(newPivotKeys) + }); + } + groups.sort(comparator); + return groups; + } + buildMeasureCols(pivotKeys) { + const measureColumns = this.valueColsSvc?.columns ?? []; + if (measureColumns.length === 0) { + return [this.createColDef(null, "-", pivotKeys)]; + } + return measureColumns.map((measureCol) => { + const columnName = this.colNames.getDisplayNameForColumn(measureCol, "header"); + const colDef = this.createColDef(measureCol, columnName, pivotKeys); + colDef.columnGroupShow = "open"; + return colDef; + }); + } + addExpandablePivotGroups(pivotColumnGroupDefs, pivotColumnDefs) { + const isSuppressExpand = this.gos.get("suppressExpandablePivotGroups"); + if (isSuppressExpand || this.gos.get("pivotColumnGroupTotals")) { + return; + } + const recursivelyAddSubTotals = (def, currentPivotColumnDefs, acc) => { + if ("children" in def) { + const { valueColsSvc } = this; + const { columns: valueCols = [] } = valueColsSvc ?? {}; + const childAcc = /* @__PURE__ */ new Map(); + def.children.forEach((grp) => { + recursivelyAddSubTotals(grp, currentPivotColumnDefs, childAcc); + }); + const leafGroup = !def.children.some((child) => child.children); + const hasCollapsedLeafGroup = leafGroup && valueCols.length === 1 && this.gos.get("removePivotHeaderRowWhenSingleValueColumn"); + for (const valueColumn of valueCols) { + const columnName = this.colNames.getDisplayNameForColumn(valueColumn, "header"); + const totalColDef = this.createColDef(valueColumn, columnName, def.pivotKeys); + totalColDef.pivotTotalColumnIds = childAcc.get(valueColumn.getColId()); + totalColDef.columnGroupShow = !isSuppressExpand ? "closed" : "open"; + totalColDef.aggFunc = valueColumn.getAggFunc(); + if (!leafGroup || hasCollapsedLeafGroup) { + const children = def.children; + children.push(totalColDef); + currentPivotColumnDefs.push(totalColDef); + } + } + this.merge(acc, childAcc); + return; + } + if (!def.pivotValueColumn) { + return; + } + const pivotValueColId = def.pivotValueColumn.getColId(); + const exists = acc.has(pivotValueColId); + if (exists) { + const arr = acc.get(pivotValueColId); + arr.push(def.colId); + } else { + acc.set(pivotValueColId, [def.colId]); + } + }; + pivotColumnGroupDefs.forEach((groupDef) => { + recursivelyAddSubTotals(groupDef, pivotColumnDefs, /* @__PURE__ */ new Map()); + }); + } + addPivotTotalsToGroups(pivotColumnGroupDefs, pivotColumnDefs) { + if (!this.gos.get("pivotColumnGroupTotals")) { + return; + } + const insertAfter = this.gos.get("pivotColumnGroupTotals") === "after"; + const valueCols = this.valueColsSvc?.columns; + const aggFuncs = valueCols?.map((valueCol) => valueCol.getAggFunc()); + if (!aggFuncs || aggFuncs.length < 1 || !this.sameAggFuncs(aggFuncs)) { + return; + } + if (valueCols) { + const valueColumn = valueCols[0]; + pivotColumnGroupDefs.forEach((groupDef) => { + this.recursivelyAddPivotTotal(groupDef, pivotColumnDefs, valueColumn, insertAfter); + }); + } + } + recursivelyAddPivotTotal(groupDef, pivotColumnDefs, valueColumn, insertAfter) { + const group = groupDef; + if (!group.children) { + const def = groupDef; + return def.colId ? [def.colId] : null; + } + let colIds = []; + group.children.forEach((grp) => { + const childColIds = this.recursivelyAddPivotTotal(grp, pivotColumnDefs, valueColumn, insertAfter); + if (childColIds) { + colIds = colIds.concat(childColIds); + } + }); + if (group.children.length > 1) { + const localeTextFunc = this.getLocaleTextFunc(); + const headerName = localeTextFunc("pivotColumnGroupTotals", "Total"); + const totalColDef = this.createColDef(valueColumn, headerName, groupDef.pivotKeys, true); + totalColDef.pivotTotalColumnIds = colIds; + totalColDef.aggFunc = valueColumn.getAggFunc(); + totalColDef.columnGroupShow = this.gos.get("suppressExpandablePivotGroups") ? "open" : void 0; + const children = groupDef.children; + if (insertAfter) { + children.push(totalColDef); + } else { + children.unshift(totalColDef); + } + pivotColumnDefs.push(totalColDef); + } + return colIds; + } + addRowGroupTotals(pivotColumnGroupDefs, pivotColumnDefs) { + if (!this.gos.get("pivotRowTotals")) { + return; + } + const insertAtEnd = this.gos.get("pivotRowTotals") === "after"; + const valueColumns = this.valueColsSvc?.columns ?? []; + const valueCols = valueColumns.slice(); + if (!insertAtEnd) { + valueCols.reverse(); + } + const isCreateTotalGroups = valueCols.length > 1 || !this.gos.get("removePivotHeaderRowWhenSingleValueColumn"); + for (let i = 0; i < valueCols.length; i++) { + const valueCol = valueCols[i]; + const columnName = this.colNames.getDisplayNameForColumn(valueCol, "header"); + const colDef = this.createColDef(valueCol, columnName, []); + const colIds = []; + for (let i2 = 0; i2 < pivotColumnDefs.length; i2++) { + const colDef2 = pivotColumnDefs[i2]; + if (colDef2.pivotValueColumn === valueCol) { + colIds.push(colDef2.colId); + } + } + colDef.pivotTotalColumnIds = colIds; + colDef.colId = PIVOT_ROW_TOTAL_PREFIX + colDef.colId; + const valueGroup = isCreateTotalGroups ? { + children: [colDef], + pivotKeys: [], + groupId: `${PIVOT_ROW_TOTAL_PREFIX}_pivotGroup_${valueCol.getColId()}` + } : colDef; + pivotColumnDefs.push(colDef); + if (insertAtEnd) { + pivotColumnGroupDefs.push(valueGroup); + } else { + pivotColumnGroupDefs.unshift(valueGroup); + } + } + } + /** + * Recreate a pivot colDef to update from a changed valueColumn colDef + */ + recreateColDef(colDef) { + const { + pivotValueColumn, + headerName, + pivotKeys, + pivotTotalColumnIds, + columnGroupShow, + colId, + valueGetter, + aggFunc + } = colDef; + if (!pivotValueColumn) { + return colDef; + } + const newColDef = this.createColDef(pivotValueColumn, headerName, pivotKeys, !!pivotTotalColumnIds); + newColDef.columnGroupShow = columnGroupShow; + newColDef.colId = colId; + newColDef.valueGetter = valueGetter; + newColDef.aggFunc = aggFunc; + newColDef.pivotTotalColumnIds = pivotTotalColumnIds; + this.gos.get("processPivotResultColDef")?.(newColDef); + return newColDef; + } + createColDef(valueColumn, headerName, pivotKeys, totalColumn = false) { + const colDef = {}; + if (valueColumn) { + const colDefToCopy = valueColumn.getColDef(); + Object.assign(colDef, colDefToCopy); + colDef.hide = false; + } + colDef.headerName = headerName; + colDef.colId = this.generateColumnId( + pivotKeys || [], + valueColumn && !totalColumn ? valueColumn.getColId() : "" + ); + colDef.field = colDef.colId; + colDef.valueGetter = (params) => params.data?.[params.colDef.field]; + colDef.pivotKeys = pivotKeys; + colDef.pivotValueColumn = valueColumn; + if (colDef.filter === true) { + colDef.filter = "agNumberColumnFilter"; + } + return colDef; + } + sameAggFuncs(aggFuncs) { + if (aggFuncs.length == 1) { + return true; + } + for (let i = 1; i < aggFuncs.length; i++) { + if (aggFuncs[i] !== aggFuncs[0]) { + return false; + } + } + return true; + } + merge(m1, m2) { + m2.forEach((value, key) => { + const existingList = m1.has(key) ? m1.get(key) : []; + const updatedList = [...existingList, ...value]; + m1.set(key, updatedList); + }); + } + generateColumnGroupId(pivotKeys) { + const pivotCols = (this.pivotColsSvc?.columns ?? []).map((col) => col.getColId()); + return `pivotGroup_${pivotCols.join("-")}_${pivotKeys.join("-")}`; + } + generateColumnId(pivotKeys, measureColumnId) { + const pivotCols = (this.pivotColsSvc?.columns ?? []).map((col) => col.getColId()); + return `pivot_${pivotCols.join("-")}_${pivotKeys.join("-")}_${measureColumnId}`; + } + /** + * Used by the SSRM to create secondary columns from provided fields + * @param fields + */ + createColDefsFromFields(fields) { + const uniqueValues = /* @__PURE__ */ new Map(); + for (let i = 0; i < fields.length; i++) { + const field = fields[i]; + const parts = field.split(this.fieldSeparator); + let level = uniqueValues; + for (let p = 0; p < parts.length; p++) { + const part = parts[p]; + let map = level.get(part); + if (!map) { + map = /* @__PURE__ */ new Map(); + level.set(part, map); + } + level = map; + } + } + const uniqueValuesToGroups = (id, key, uniqueValues2, depth) => { + const children = []; + for (const [key2, item] of uniqueValues2) { + const child = uniqueValuesToGroups(`${id}${this.fieldSeparator}${key2}`, key2, item, depth + 1); + children.push(child); + } + if (children.length === 0) { + const potentialAggCol = this.colModel.getColDefCol(key); + if (potentialAggCol) { + const headerName = this.colNames.getDisplayNameForColumn(potentialAggCol, "header") ?? key; + const colDef = this.createColDef(potentialAggCol, headerName, void 0, false); + colDef.colId = id; + colDef.aggFunc = potentialAggCol.getAggFunc(); + colDef.valueGetter = (params) => params.data?.[id]; + return colDef; + } + const col = { + colId: id, + headerName: key, + // this is to support using pinned rows, normally the data will be extracted from the aggData object using the colId + // however pinned rows still access the data object by field, this prevents values with dots from being treated as complex objects + valueGetter: (params) => params.data?.[id] + }; + return col; + } + const collapseSingleChildren = this.gos.get("removePivotHeaderRowWhenSingleValueColumn"); + if (collapseSingleChildren && children.length === 1 && "colId" in children[0]) { + children[0].headerName = key; + return children[0]; + } + const group = { + openByDefault: this.pivotDefaultExpanded === -1 || depth < this.pivotDefaultExpanded, + groupId: id, + headerName: key, + children + }; + return group; + }; + const res = []; + for (const [key, item] of uniqueValues) { + const col = uniqueValuesToGroups(key, key, item, 0); + res.push(col); + } + return res; + } +}; + +// packages/ag-grid-enterprise/src/pivot/pivotResultColsService.ts +import { + BeanStub as BeanStub57, + _areEqual as _areEqual6, + _createColumnTree, + _createColumnTreeWithIds, + _destroyColumnTree as _destroyColumnTree4, + _exists as _exists25, + _getColumnsFromTree +} from "ag-grid-community"; +var PivotResultColsService = class extends BeanStub57 { + constructor() { + super(...arguments); + this.beanName = "pivotResultCols"; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.visibleCols = beans.visibleCols; + } + destroy() { + _destroyColumnTree4(this.beans, this.pivotResultCols?.tree); + super.destroy(); + } + isPivotResultColsPresent() { + return this.pivotResultCols != null; + } + lookupPivotResultCol(pivotKeys, valueColKey) { + if (this.pivotResultCols == null) { + return null; + } + const valueColumnToFind = this.colModel.getColDefCol(valueColKey); + let foundColumn = null; + for (const column of this.pivotResultCols.list) { + const thisPivotKeys = column.getColDef().pivotKeys; + const pivotValueColumn = column.getColDef().pivotValueColumn; + const pivotKeyMatches = _areEqual6(thisPivotKeys, pivotKeys); + const pivotValueMatches = pivotValueColumn === valueColumnToFind; + if (pivotKeyMatches && pivotValueMatches) { + foundColumn = column; + } + } + return foundColumn; + } + getPivotResultCols() { + return this.pivotResultCols; + } + getPivotResultCol(key) { + if (!this.pivotResultCols) { + return null; + } + return this.colModel.getColFromCollection(key, this.pivotResultCols); + } + getAggregationOrderedList() { + let result = this.aggOrderedList; + if (result !== void 0) { + return result; + } + const list = this.pivotResultCols?.list; + if (!list || list.length === 0) { + this.aggOrderedList = null; + return null; + } + let hasAnyTotals = false; + for (let i = 0; i < list.length; ++i) { + if (list[i].getColDef().pivotTotalColumnIds != null) { + hasAnyTotals = true; + break; + } + } + if (!hasAnyTotals) { + result = list; + } else { + const regular = []; + const totals = []; + for (let i = 0; i < list.length; ++i) { + const col = list[i]; + if (col.getColDef().pivotTotalColumnIds != null) { + totals.push(col); + } else { + regular.push(col); + } + } + result = regular.concat(totals); + } + this.aggOrderedList = result; + return result; + } + setPivotResultCols(colDefs, source) { + this.aggOrderedList = void 0; + if (!this.colModel.ready) { + return; + } + if (colDefs == null && this.pivotResultCols == null) { + return; + } + if (colDefs) { + this.processPivotResultColDef(colDefs); + const createColTreeFunc = source === "api" ? _createColumnTree : _createColumnTreeWithIds; + const balancedTreeResult = createColTreeFunc( + this.beans, + colDefs, + false, + this.pivotResultCols?.tree || this.previousPivotResultCols || void 0, + source + ); + _destroyColumnTree4(this.beans, this.pivotResultCols?.tree, balancedTreeResult.columnTree); + const tree = balancedTreeResult.columnTree; + const treeDepth = balancedTreeResult.treeDepth; + const list = _getColumnsFromTree(tree); + const map = {}; + this.pivotResultCols = { tree, treeDepth, list, map }; + for (const col of this.pivotResultCols.list) { + this.pivotResultCols.map[col.getId()] = col; + } + const hasPreviousCols = !!this.previousPivotResultCols; + this.previousPivotResultCols = null; + this.colModel.refreshCols(!hasPreviousCols, source); + } else { + this.previousPivotResultCols = this.pivotResultCols ? this.pivotResultCols.tree : null; + this.pivotResultCols = null; + this.colModel.refreshCols(false, source); + } + this.visibleCols.refresh(source); + } + processPivotResultColDef(colDefs) { + const columnCallback = this.gos.get("processPivotResultColDef"); + const groupCallback = this.gos.get("processPivotResultColGroupDef"); + if (!columnCallback && !groupCallback) { + return void 0; + } + const searchForColDefs = (colDefs2) => { + colDefs2.forEach((abstractColDef) => { + const isGroup = _exists25(abstractColDef.children); + if (isGroup) { + const colGroupDef = abstractColDef; + if (groupCallback) { + groupCallback(colGroupDef); + } + searchForColDefs(colGroupDef.children); + } else { + const colDef = abstractColDef; + if (columnCallback) { + columnCallback(colDef); + } + } + }); + }; + if (colDefs) { + searchForColDefs(colDefs); + } + } +}; + +// packages/ag-grid-enterprise/src/pivot/pivotStage.ts +import { BeanStub as BeanStub58, _forEachChangedGroupDepthFirst as _forEachChangedGroupDepthFirst5, _jsonEquals, _missing as _missing8 } from "ag-grid-community"; +var EXCEEDED_MAX_UNIQUE_VALUES = "Exceeded maximum allowed pivot column count."; +var mapToObject = (map) => { + const obj = {}; + map.forEach((value, key) => obj[key] = value instanceof Map ? mapToObject(value) : value); + return obj; +}; +var PivotStage = class extends BeanStub58 { + constructor() { + super(...arguments); + this.beanName = "pivotStage"; + this.step = "pivot"; + this.refreshProps = [ + "removePivotHeaderRowWhenSingleValueColumn", + "pivotRowTotals", + "pivotColumnGroupTotals", + "suppressExpandablePivotGroups" + ]; + this.uniqueValues = /* @__PURE__ */ new Map(); + this.lastTimeFailed = false; + this.maxUniqueValues = -1; + this.currentUniqueCount = 0; + } + wireBeans(beans) { + this.valueSvc = beans.valueSvc; + this.colModel = beans.colModel; + this.pivotResultCols = beans.pivotResultCols; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + this.valueColsSvc = beans.valueColsSvc; + this.pivotColsSvc = beans.pivotColsSvc; + this.pivotColDefSvc = beans.pivotColDefSvc; + } + /** Returns `true` if the changedPath should be deactivated (e.g. pivot columns changed). */ + execute(changedPath) { + if (this.colModel.isPivotActive()) { + return this.executePivotOn(changedPath); + } else { + return this.executePivotOff(); + } + } + executePivotOff() { + this.aggregationColumnsHashLastTime = null; + this.uniqueValues = /* @__PURE__ */ new Map(); + if (this.pivotResultCols.isPivotResultColsPresent()) { + this.pivotResultCols.setPivotResultCols(null, "rowModelUpdated"); + return true; + } + return false; + } + executePivotOn(changedPath) { + const numberOfAggregationColumns = this.valueColsSvc?.columns.length ?? 1; + const configuredMaxCols = this.gos.get("pivotMaxGeneratedColumns"); + this.maxUniqueValues = configuredMaxCols === -1 ? -1 : configuredMaxCols / numberOfAggregationColumns; + let uniqueValues; + try { + uniqueValues = this.bucketUpRowNodes(changedPath); + } catch (e) { + if (e.message === EXCEEDED_MAX_UNIQUE_VALUES) { + this.pivotResultCols.setPivotResultCols([], "rowModelUpdated"); + this.eventSvc.dispatchEvent({ + type: "pivotMaxColumnsExceeded", + message: e.message + }); + this.lastTimeFailed = true; + return false; + } + throw e; + } + const uniqueValuesChanged = this.setUniqueValues(uniqueValues); + const aggregationColumns = this.valueColsSvc?.columns ?? []; + const aggregationColumnsHash = aggregationColumns.map((column) => `${column.getId()}-${column.getColDef().headerName}`).join("#"); + const aggregationFuncsHash = aggregationColumns.map((column) => column.getAggFunc().toString()).join("#"); + const aggregationColumnsChanged = this.aggregationColumnsHashLastTime !== aggregationColumnsHash; + const aggregationFuncsChanged = this.aggregationFuncsHashLastTime !== aggregationFuncsHash; + this.aggregationColumnsHashLastTime = aggregationColumnsHash; + this.aggregationFuncsHashLastTime = aggregationFuncsHash; + const groupColumnsHash = (this.rowGroupColsSvc?.columns ?? []).map((column) => column.getId()).join("#"); + const groupColumnsChanged2 = groupColumnsHash !== this.groupColumnsHashLastTime; + this.groupColumnsHashLastTime = groupColumnsHash; + const pivotRowTotals = this.gos.get("pivotRowTotals"); + const pivotColumnGroupTotals = this.gos.get("pivotColumnGroupTotals"); + const suppressExpandablePivotGroups = this.gos.get("suppressExpandablePivotGroups"); + const removePivotHeaderRowWhenSingleValueColumn = this.gos.get("removePivotHeaderRowWhenSingleValueColumn"); + const anyGridOptionsChanged = pivotRowTotals !== this.pivotRowTotalsLastTime || pivotColumnGroupTotals !== this.pivotColumnGroupTotalsLastTime || suppressExpandablePivotGroups !== this.suppressExpandablePivotGroupsLastTime || removePivotHeaderRowWhenSingleValueColumn !== this.removePivotHeaderRowWhenSingleValueColumnLastTime; + this.pivotRowTotalsLastTime = pivotRowTotals; + this.pivotColumnGroupTotalsLastTime = pivotColumnGroupTotals; + this.suppressExpandablePivotGroupsLastTime = suppressExpandablePivotGroups; + this.removePivotHeaderRowWhenSingleValueColumnLastTime = removePivotHeaderRowWhenSingleValueColumn; + if (this.lastTimeFailed || uniqueValuesChanged || aggregationColumnsChanged || groupColumnsChanged2 || aggregationFuncsChanged || anyGridOptionsChanged) { + const pivotColumnGroupDefs = this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues); + this.pivotResultCols.setPivotResultCols(pivotColumnGroupDefs, "rowModelUpdated"); + this.lastTimeFailed = false; + return true; + } + this.lastTimeFailed = false; + return false; + } + setUniqueValues(newValues) { + const uniqueValuesChanged = !_jsonEquals(mapToObject(this.uniqueValues), mapToObject(newValues)); + if (uniqueValuesChanged) { + this.uniqueValues = newValues; + return true; + } + return false; + } + bucketUpRowNodes(changedPath) { + this.currentUniqueCount = 0; + const uniqueValues = /* @__PURE__ */ new Map(); + _forEachChangedGroupDepthFirst5( + this.beans.rowModel.rootNode, + this.beans.rowModel.hierarchical, + changedPath, + (node) => { + if (node.leafGroup) { + node.childrenMapped = null; + } + } + ); + const recursivelyBucketFilteredChildren = (node) => { + if (node.leafGroup) { + this.bucketRowNode(node, uniqueValues); + } else { + const children = node.childrenAfterFilter; + if (children) { + for (let i = 0, len = children.length; i < len; ++i) { + recursivelyBucketFilteredChildren(children[i]); + } + } + } + }; + recursivelyBucketFilteredChildren(this.beans.rowModel.rootNode); + return uniqueValues; + } + bucketRowNode(rowNode, uniqueValues) { + const pivotColumns = this.pivotColsSvc?.columns; + if (pivotColumns?.length === 0) { + rowNode.childrenMapped = null; + } else { + rowNode.childrenMapped = mapToObject( + this.bucketChildren(rowNode.childrenAfterFilter, pivotColumns, 0, uniqueValues) + ); + } + if (rowNode.sibling) { + rowNode.sibling.childrenMapped = rowNode.childrenMapped; + } + } + bucketChildren(children, pivotColumns = [], pivotIndex, uniqueValues) { + const mappedChildren = /* @__PURE__ */ new Map(); + const pivotColumn = pivotColumns[pivotIndex]; + const doesGeneratedColMaxExist = this.maxUniqueValues !== -1; + for (let i = 0, len = children.length; i < len; ++i) { + const child = children[i]; + let key = this.valueSvc.getKeyForNode(pivotColumn, child); + if (_missing8(key)) { + key = ""; + } + if (!uniqueValues.get(key)) { + this.currentUniqueCount += 1; + uniqueValues.set(key, /* @__PURE__ */ new Map()); + const hasExceededColMax = this.currentUniqueCount > this.maxUniqueValues; + if (doesGeneratedColMaxExist && hasExceededColMax) { + throw new Error(EXCEEDED_MAX_UNIQUE_VALUES); + } + } + if (!mappedChildren.has(key)) { + mappedChildren.set(key, []); + } + mappedChildren.get(key).push(child); + } + if (pivotIndex === pivotColumns.length - 1) { + return mappedChildren; + } + const result = /* @__PURE__ */ new Map(); + for (const key of mappedChildren.keys()) { + result.set( + key, + this.bucketChildren(mappedChildren.get(key), pivotColumns, pivotIndex + 1, uniqueValues.get(key)) + ); + } + return result; + } +}; + +// packages/ag-grid-enterprise/src/pivot/pivotModule.ts +var SharedPivotModule = { + moduleName: "SharedPivot", + version: VERSION, + beans: [PivotResultColsService, PivotColDefService, PivotColsSvc], + apiFunctions: { + isPivotMode, + getPivotResultColumn, + setValueColumns, + getValueColumns, + removeValueColumns, + addValueColumns, + setPivotColumns, + removePivotColumns, + addPivotColumns, + getPivotColumns, + setPivotResultColumns, + getPivotResultColumns + }, + dependsOn: [SharedRowGroupingModule, _ColumnGroupModule] +}; +var PivotModule = { + moduleName: "Pivot", + version: VERSION, + rowModels: ["clientSide"], + beans: [PivotStage], + dependsOn: [SharedPivotModule, RowGroupingModule, ClientSideRowModelHierarchyModule] +}; + +// packages/ag-grid-enterprise/src/treeData/treeGroupStrategy.ts +import { BeanStub as BeanStub59, RowNode as RowNode4, _removeFromArray as _removeFromArray8, _warn as _warn43 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/treeData/fieldAccess.ts +var fieldGetter = (path) => { + const segments = path.split("."); + if (segments.includes("__proto__")) { + return () => { + }; + } + const len = segments.length; + if (len < 2) { + return (data) => data?.[path]; + } + return (data) => { + let i = 0; + do { + data = data?.[segments[i++]]; + if (i === len) { + return data; + } + } while (typeof data === "object"); + }; +}; + +// packages/ag-grid-enterprise/src/treeData/treeGroupStrategy.ts +var FLAG_CHILDREN_CHANGED = 2147483648; +var FLAG_CHANGED = 1073741824; +var FLAG_MARKED_FILLER = 536870912; +var MASK_CHILDREN_LEN = 268435455; +var PATH_KEY_SEPARATOR = String.fromCodePoint(31, 41150, 8291); +var PATH_KEY_SEPARATOR_LEN = 3; +var TreeGroupStrategy = class extends BeanStub59 { + constructor() { + super(...arguments); + this.nestedDataGetter = null; + this.parentIdGetter = null; + this.nonLeafsById = null; + this.nodesToUnselect = null; + this.fullReload = false; + } + postConstruct() { + this.onPropChange(null); + } + onPropChange(changedProps) { + const gos = this.gos; + if (!changedProps || changedProps.has("treeDataParentIdField")) { + const parentIdField = gos.get("treeDataParentIdField"); + const getter = parentIdField ? fieldGetter(parentIdField) : null; + this.fullReload || (this.fullReload = this.parentIdGetter !== getter); + this.parentIdGetter = getter; + if (getter) { + this.nestedDataGetter = null; + } + } + if (!changedProps || changedProps.has("treeDataChildrenField")) { + const childrenField = this.parentIdGetter ? "" : gos.get("treeDataChildrenField"); + const getter = childrenField ? fieldGetter(childrenField) : null; + this.fullReload || (this.fullReload = this.nestedDataGetter !== getter); + this.nestedDataGetter = getter; + } + } + destroy() { + this.nodesToUnselect = null; + this.reset(); + super.destroy(); + } + reset() { + this.clearNonLeafs(); + this.deselectHiddenNodes(false); + this.fullReload = true; + } + clearNonLeafs() { + const fillers = this.nonLeafsById; + if (fillers) { + for (const node of fillers.values()) { + node._destroy(false); + } + fillers.clear(); + this.nonLeafsById = null; + } + } + getNonLeaf(id) { + return this.nonLeafsById?.get(id); + } + loadGroupData(node) { + const key = node.key; + if (key == null) { + node._groupData = null; + return null; + } + const groupData = {}; + node._groupData = groupData; + const groupDisplayCols = this.beans.showRowGroupCols?.columns; + if (groupDisplayCols) { + for (let i = 0, len = groupDisplayCols.length; i < len; ++i) { + groupData[groupDisplayCols[i].getColId()] = key; + } + } + return groupData; + } + execute(rootNode, params) { + if (this.fullReload) { + this.reset(); + } + const { changedRowNodes, changedPath } = params; + const fullReload = this.fullReload || !changedRowNodes && !changedPath; + const hasUpdates = !!changedRowNodes && this.flagUpdatedNodes(changedRowNodes); + if (fullReload || hasUpdates) { + this.fullReload = false; + if (this.parentIdGetter) { + this.loadSelfRef(rootNode, fullReload); + } else if (this.nestedDataGetter) { + this.loadNested(rootNode, changedRowNodes, fullReload); + } else { + this.loadDataPath(rootNode, fullReload); + } + } + const parentsChanged = this.initRowsParents(rootNode); + this.destroyFillerRows(!!params.animate); + this.initRowsChildrenSize(rootNode); + let preprocessedCount = this.preprocessRows(rootNode); + const treeChanged = parentsChanged || (preprocessedCount & FLAG_CHILDREN_CHANGED) !== 0; + preprocessedCount &= ~FLAG_CHILDREN_CHANGED; + const traverseCount = this.traverseRoot(rootNode, changedPath); + if (preprocessedCount > 0 && preprocessedCount !== traverseCount) { + this.handleCycles(rootNode); + this.traverseRoot(rootNode, changedPath); + } + rootNode.treeNodeFlags = 0; + this.deselectHiddenNodes(parentsChanged || fullReload); + return treeChanged; + } + flagUpdatedNodes(changedRowNodes) { + const { adds, updates, removals } = changedRowNodes; + let hasUpdates = removals.length > 0; + if (adds.size > 0) { + hasUpdates = true; + for (const node of adds) { + node.treeNodeFlags |= FLAG_CHANGED; + } + } + if (updates.size > 0) { + hasUpdates = true; + for (const node of updates) { + node.treeNodeFlags |= FLAG_CHANGED; + } + } + return hasUpdates; + } + initRowsParents(rootNode) { + const allLeafs = rootNode._leafs; + const allLeafsLen = allLeafs.length; + let parentsChanged = false; + for (let i = 0; i < allLeafsLen; ++i) { + if (this.initRowParent(allLeafs[i])) { + parentsChanged = true; + } + } + return parentsChanged; + } + initRowParent(current) { + let parentsChanged = false; + while (true) { + const oldParent = current.parent; + const parent = current.treeParent; + if (parent === null) { + if (oldParent) { + parentsChanged = true; + this.hideRow(current); + } + break; + } + let parentFlags = parent.treeNodeFlags + 1; + const parentChanged = oldParent !== parent; + if (parentChanged) { + parentsChanged = true; + parentFlags |= FLAG_CHANGED; + current.parent = parent; + } + if (parentChanged && oldParent) { + if (oldParent.destroyed) { + maybeExpandFromRemovedParent(parent, oldParent); + } + oldParent.treeNodeFlags |= FLAG_CHANGED; + } + if (parent.sourceRowIndex >= 0 || parent.treeNodeFlags & FLAG_MARKED_FILLER || parent.treeParent === null) { + parent.treeNodeFlags = parentFlags; + break; + } + parent.treeNodeFlags = parentFlags | FLAG_MARKED_FILLER | current.treeNodeFlags & FLAG_CHANGED; + current = parent; + } + return parentsChanged; + } + destroyFillerRows(animate) { + const nonLeafsById = this.nonLeafsById; + if (nonLeafsById) { + for (const node of nonLeafsById.values()) { + if (node.treeParent === null || (node.treeNodeFlags & MASK_CHILDREN_LEN) === 0) { + nonLeafsById.delete(node.id); + node._destroy(animate); + this.hideRow(node); + } + } + if (nonLeafsById.size === 0) { + this.nonLeafsById = null; + } + } + } + initRowsChildrenSize(rootNode) { + this.initRowChildrenSize(rootNode); + const allLeafs = rootNode._leafs; + const allLeafsLen = allLeafs.length; + for (let i = 0; i < allLeafsLen; ++i) { + this.initRowChildrenSize(allLeafs[i]); + } + const nonLeafsById = this.nonLeafsById; + if (nonLeafsById !== null) { + for (const filler of nonLeafsById.values()) { + this.initRowChildrenSize(filler); + } + } + } + initRowChildrenSize(row) { + let { childrenAfterGroup, _leafs: rowLeafs, treeNodeFlags } = row; + const oldLen = childrenAfterGroup?.length; + const len = treeNodeFlags & MASK_CHILDREN_LEN; + row.treeNodeFlags = treeNodeFlags & ~MASK_CHILDREN_LEN | ((oldLen || 0) === len ? 0 : FLAG_CHILDREN_CHANGED); + if (len === 0 && row.level >= 0) { + if (childrenAfterGroup !== null) { + row.childrenAfterGroup = null; + row.childrenAfterFilter = null; + row.childrenAfterAggFilter = null; + row.childrenAfterSort = null; + const sibling = row.sibling; + if (sibling) { + sibling.childrenAfterGroup = null; + sibling.childrenAfterFilter = null; + sibling.childrenAfterAggFilter = null; + sibling.childrenAfterSort = null; + } + } + } else if (oldLen !== len || childrenAfterGroup === rowLeafs) { + if (!childrenAfterGroup || childrenAfterGroup === rowLeafs) { + row.childrenAfterGroup = childrenAfterGroup = new Array(len); + const sibling = row.sibling; + if (sibling) { + sibling.childrenAfterGroup = childrenAfterGroup; + } + } else { + childrenAfterGroup.length = len; + } + } + } + preprocessRows(rootNode) { + const allLeafs = rootNode._leafs; + const allLeafsLen = allLeafs.length; + let preprocessedCount = 0; + let treeChanged = false; + for (let i = 0; i < allLeafsLen; ++i) { + let current = allLeafs[i]; + while (true) { + const parent = current.treeParent; + if (parent === null) { + break; + } + ++preprocessedCount; + let parentFlags = parent.treeNodeFlags; + const parentChildren = parent.childrenAfterGroup; + const indexInParent = parentFlags & MASK_CHILDREN_LEN; + parentFlags = parentFlags & ~MASK_CHILDREN_LEN | indexInParent + 1; + if (parentFlags & FLAG_CHILDREN_CHANGED || parentChildren[indexInParent] !== current) { + parentFlags |= FLAG_CHILDREN_CHANGED; + parentChildren[indexInParent] = current; + treeChanged = true; + } + parent.treeNodeFlags = parentFlags; + if (parent.data || (parent.treeNodeFlags & FLAG_MARKED_FILLER) === 0 || parent.treeParent === null) { + break; + } + parent.treeNodeFlags = parentFlags & ~FLAG_MARKED_FILLER | current.treeNodeFlags & FLAG_CHANGED; + current = parent; + } + } + return preprocessedCount | (treeChanged ? FLAG_CHILDREN_CHANGED : 0); + } + traverseRoot(rootNode, activeChangedPath) { + let traverseCount = 0; + const rootChildrenAfterGroup = rootNode.childrenAfterGroup; + for (let i = 0, len = rootChildrenAfterGroup.length; i < len; ++i) { + traverseCount += this.traverse(rootChildrenAfterGroup[i], 0, false, activeChangedPath); + } + return traverseCount & ~FLAG_CHILDREN_CHANGED; + } + /** + * After all the rows are initialized and treeParent is set and childrenAfterGroup is filled, + * we traverse the tree to finalize it + * @returns the number of leaf nodes processed, which is used to detect cycles in the tree, and a flag set if leaf children were changed. + */ + traverse(row, level, collapsed, activeChangedPath) { + const children = row.childrenAfterGroup; + const len = children?.length ?? 0; + let flags = row.treeNodeFlags; + row.treeNodeFlags = 0; + row.level = level; + if (row.group !== !!len) { + setRowNodeGroup(row, this.beans, !!len); + flags |= FLAG_CHANGED; + } else if (row.hasChildren() !== !!len) { + row.updateHasChildren(); + flags |= FLAG_CHANGED; + } + const selfChanged = (flags & (FLAG_CHANGED | FLAG_CHILDREN_CHANGED)) !== 0; + const canBeExpanded = len !== 0 || row.master; + if (!canBeExpanded) { + row._expanded = void 0; + } else { + row._expanded ?? (row._expanded = null); + } + if (collapsed && row.rowIndex !== null) { + row.clearRowTopAndRowIndex(); + } + collapsed || (collapsed = !row.expanded); + ++level; + flags &= FLAG_CHILDREN_CHANGED; + for (let i = 0; i < len; ++i) { + const child = children[i]; + const childFlags = this.traverse(child, level, collapsed, activeChangedPath); + flags = flags + (childFlags & ~FLAG_CHILDREN_CHANGED) | childFlags & FLAG_CHILDREN_CHANGED; + } + if (selfChanged) { + flags |= FLAG_CHILDREN_CHANGED; + } + if (flags & FLAG_CHILDREN_CHANGED) { + if (len > 0) { + activeChangedPath?.addRow(row); + } + row._leafs = void 0; + } + return flags + 1; + } + /** Handle cycles in a tree. Is not optimal for performance but this is an edge case that shouldn't happen as is a warning. */ + handleCycles(rootNode) { + const marked = /* @__PURE__ */ new Set(); + const mark = (row) => { + if (marked.has(row)) { + return false; + } + marked.add(row); + for (const child of row.childrenAfterGroup ?? []) { + mark(child); + } + return true; + }; + mark(rootNode); + const rootChildrenAfterGroup = rootNode.childrenAfterGroup; + rootChildrenAfterGroup.length = 0; + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const row = allLeafs[i]; + const parent = row.treeParent; + if (parent && mark(row)) { + parent.treeNodeFlags |= FLAG_CHILDREN_CHANGED | FLAG_CHANGED; + row.parent = rootNode; + const parentChildren = parent.childrenAfterGroup; + _removeFromArray8(parentChildren, row); + if (parentChildren.length === 0) { + parent.childrenAfterGroup = null; + } + rootChildrenAfterGroup.push(row); + _warn43(270, { id: row.id, parentId: parent?.id ?? "" }); + } else if (parent === rootNode) { + rootChildrenAfterGroup.push(row); + } + } + } + /** Load the tree structure for nested groups, aka children property */ + loadNested(rootNode, changedRowNodes, fullReload) { + if (!fullReload && changedRowNodes) { + for (const row of changedRowNodes.adds) { + row.key = row.id; + } + return; + } + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const row = allLeafs[i]; + const id = row.id; + if (row.key !== id) { + updateNodeKey(row, id); + } + } + } + /** Load the tree structure for self-referencing data, aka parentId field */ + loadSelfRef(rootNode, reload) { + const allLeafs = rootNode._leafs; + const allLeafsLen = allLeafs.length; + const gos = this.gos; + if (!gos.get("getRowId")) { + for (let i = 0; i < allLeafsLen; i++) { + allLeafs[i].treeParent = null; + } + return; + } + const rowModel = this.beans.rowModel; + const parentIdGetter = this.parentIdGetter; + for (let i = 0; i < allLeafsLen; i++) { + const row = allLeafs[i]; + if (reload || row.treeNodeFlags & FLAG_CHANGED || row.treeParent?.destroyed) { + let newParent; + const parentId = parentIdGetter?.(row.data); + if (parentId !== null && parentId !== void 0) { + newParent = rowModel.getRowNode(parentId); + if (!newParent) { + _warn43(271, { id: row.id, parentId }); + } + } + row.treeParent = newParent ?? rootNode; + const id = row.id; + if (row.key !== id) { + updateNodeKey(row, id); + } + } else { + row.treeParent ?? (row.treeParent = rootNode); + } + } + } + loadFlattened(rootNode) { + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const row = allLeafs[i]; + row.treeParent = rootNode; + const id = row.id; + if (row.key !== id) { + updateNodeKey(row, id); + } + } + } + /** Load the tree structure for data paths, aka getDataPath callback */ + loadDataPath(rootNode, fullReload) { + const getDataPath = this.gos.get("getDataPath"); + if (!getDataPath) { + this.loadFlattened(rootNode); + return; + } + const nodesByPath = /* @__PURE__ */ new Map(); + const paths = /* @__PURE__ */ new Map(); + let dupPaths; + if (!fullReload) { + dupPaths = this.loadExistingDataPath(rootNode, nodesByPath, paths); + } + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const node = allLeafs[i]; + if (!fullReload && node.treeParent !== null && (node.treeNodeFlags & FLAG_CHANGED) === 0) { + continue; + } + const path = getDataPath(node.data); + const pathLen = path?.length; + if (!pathLen) { + _warn43(185, { data: node.data }); + continue; + } + const key = path[pathLen - 1]; + if (node.key !== key) { + updateNodeKey(node, key); + } + const pathKey = path.join(PATH_KEY_SEPARATOR); + paths.set(node, pathKey); + const existing = nodesByPath.get(pathKey); + if (existing === void 0) { + nodesByPath.set(pathKey, node); + } else if (existing !== node) { + dupPaths = this.duplicatedPath(nodesByPath, dupPaths, existing, node, pathKey); + } + } + if (dupPaths) { + this.processDuplicatePaths(dupPaths, paths); + } + this.buildFromPaths(rootNode, nodesByPath, paths); + } + loadExistingDataPath(rootNode, nodesByPath, paths) { + let dupPaths; + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const node = allLeafs[i]; + const treeParent = node.treeParent; + if (treeParent === null || (node.treeNodeFlags & FLAG_CHANGED) !== 0) { + continue; + } + let pathKey = node.key; + let current = treeParent; + while (current && current !== rootNode && current !== node) { + pathKey = PATH_KEY_SEPARATOR + pathKey; + const existingPathKey = paths.get(current); + if (existingPathKey !== void 0) { + pathKey = existingPathKey + pathKey; + break; + } + pathKey = current.key + pathKey; + current = current.treeParent; + } + if (current !== node) { + paths.set(node, pathKey); + const existing = nodesByPath.get(pathKey); + if (existing === void 0) { + nodesByPath.set(pathKey, node); + } else if (existing !== node) { + dupPaths = this.duplicatedPath(nodesByPath, dupPaths, existing, node, pathKey); + } + } + } + return dupPaths; + } + duplicatedPath(nodesByPath, dupPaths, existing, node, pathKey) { + if (node.sourceRowIndex < existing.sourceRowIndex) { + nodesByPath.set(pathKey, node); + } + const duplicates = (dupPaths ?? (dupPaths = /* @__PURE__ */ new Map())).get(pathKey); + if (duplicates === void 0) { + dupPaths.set(pathKey, [existing, node]); + } else { + duplicates.push(node); + } + return dupPaths; + } + buildFromPaths(rootNode, nodesByPath, paths) { + const segments = new Array(48); + const allLeafs = rootNode._leafs; + for (let i = 0, allLeafsLen = allLeafs.length; i < allLeafsLen; ++i) { + const node = allLeafs[i]; + const pathKey = paths.get(node); + if (pathKey === void 0) { + continue; + } + const segmentsLen = this.splitPathKey(segments, pathKey); + let startLevel = 0; + let treeParent = rootNode; + for (let level = segmentsLen - 1; level >= 0; --level) { + const existing = nodesByPath.get(pathKey.slice(0, segments[level])); + if (existing) { + treeParent = existing; + startLevel = level + 1; + break; + } + } + if (startLevel < segmentsLen) { + treeParent = this.buildMissingFillers( + nodesByPath, + pathKey, + segments, + segmentsLen, + startLevel, + treeParent + ); + } + node.treeParent = treeParent; + } + } + /** Collect separators positions, fast string split without allocations */ + splitPathKey(segments, pathKey) { + let segmentsLen = 0; + let scanPos = 0; + const pathKeyLen = pathKey.length; + while (scanPos < pathKeyLen) { + const sepPos = pathKey.indexOf(PATH_KEY_SEPARATOR, scanPos); + if (sepPos === -1) { + break; + } + segments[segmentsLen++] = sepPos; + scanPos = sepPos + PATH_KEY_SEPARATOR_LEN; + } + return segmentsLen; + } + /** Walk forward from startLevel to segmentsLen creating missing filler nodes and return the final parent. */ + buildMissingFillers(nodesByPath, pathKey, segments, segmentsLen, level, treeParent) { + let fillerLevel = 0; + let fillerId = "row-group"; + if (treeParent.sourceRowIndex < 0 && treeParent.treeParent) { + fillerLevel = level; + fillerId = treeParent.id; + } + do { + const start = level === 0 ? 0 : segments[level - 1] + PATH_KEY_SEPARATOR_LEN; + const end = segments[level]; + const subPath = pathKey.slice(0, end); + let current = nodesByPath.get(subPath); + if (current === void 0) { + const fillerKey = start === 0 ? subPath : pathKey.slice(start, end); + fillerId = this.makeFillerIdBase(pathKey, segments, level, fillerId, fillerLevel) + fillerKey; + current = this.getOrCreateFiller(fillerKey, fillerId); + nodesByPath.set(subPath, current); + fillerLevel = level + 1; + } else if (current.sourceRowIndex < 0) { + fillerId = current.id; + fillerLevel = level + 1; + } + current.treeParent = treeParent; + treeParent = current; + ++level; + } while (level < segmentsLen); + return treeParent; + } + processDuplicatePaths(duplicatePaths, paths) { + for (const duplicates of duplicatePaths.values()) { + duplicates.sort(compareSourceRowIndex); + const len = duplicates.length; + const duplicateRowsData = new Array(len - 1); + for (let i = 1; i < len; ++i) { + const node = duplicates[i]; + paths.delete(node); + node.treeParent = null; + duplicateRowsData[i - 1] = node.data; + } + const first = duplicates[0]; + _warn43(186, { rowId: first.id, rowData: first.data, duplicateRowsData }); + } + } + getOrCreateFiller(key, id) { + const nonLeafsById = this.nonLeafsById ?? (this.nonLeafsById = /* @__PURE__ */ new Map()); + let node = nonLeafsById.get(id); + if (node === void 0) { + node = new RowNode4(this.beans); + node.id = id; + node.key = key; + node.group = true; + node.leafGroup = false; + node.rowGroupIndex = null; + nonLeafsById.set(id, node); + } + return node; + } + /** + * Build the base filler ID up to the given 'level' and include the final level separator prefix. + * Caller should append only the 'fillerKey' after this base. + * Result format: + * - With no prefix and level === 0: _ROW_ID_PREFIX_ROW_GROUP + '0-' + * - With no prefix and level > 0: _ROW_ID_PREFIX_ROW_GROUP + '0-key0-1-key1-...-(level-1)-key(level-1)-level-' + * - With prefix present: prefixId + '-level-' + */ + makeFillerIdBase(pathKey, segments, level, prefix, prefixLevel) { + while (prefixLevel < level) { + const start = prefixLevel > 0 ? segments[prefixLevel - 1] + PATH_KEY_SEPARATOR_LEN : 0; + const end = segments[prefixLevel]; + prefix += "-" + prefixLevel + "-" + pathKey.slice(start, end); + ++prefixLevel; + } + return prefix + "-" + level + "-"; + } + deselectHiddenNodes(updated) { + const selectionSvc = this.beans.selectionSvc; + const nodes = this.nodesToUnselect; + const source = "rowDataChanged"; + if (nodes) { + this.nodesToUnselect = null; + selectionSvc?.setNodesSelected({ newValue: false, nodes, suppressFinishActions: true, source }); + } + if (nodes || updated) { + selectionSvc?.updateGroupsFromChildrenSelections?.(source); + } + if (nodes) { + const selectedNodes = selectionSvc?.getSelectedNodes() ?? null; + this.eventSvc.dispatchEvent({ type: "selectionChanged", source, selectedNodes, serverSideState: null }); + } + } + hideRow(row) { + if (row.isSelected()) { + (this.nodesToUnselect ?? (this.nodesToUnselect = [])).push(row); + } + row.parent = null; + row.group = false; + row.treeParent = null; + row.treeNodeFlags = 0; + row.childrenAfterGroup = null; + row.childrenAfterFilter = null; + row.childrenAfterAggFilter = null; + row.childrenAfterSort = null; + row._leafs = void 0; + row._groupData = null; + row.aggData = null; + const sibling = row.sibling; + if (sibling) { + sibling.childrenAfterGroup = null; + sibling.childrenAfterFilter = null; + sibling.childrenAfterAggFilter = null; + sibling.childrenAfterSort = null; + } + row.updateHasChildren(); + if (row.rowIndex !== null) { + row.clearRowTopAndRowIndex(); + } + } + onShowRowGroupColsSetChanged() { + const allLeafs = this.beans.rowModel.rootNode._leafs; + if (!allLeafs) { + return; + } + for (let i = 0, len = allLeafs.length; i < len; ++i) { + allLeafs[i]._groupData = void 0; + } + const fillers = this.nonLeafsById; + if (fillers) { + for (const rowNode of fillers.values()) { + rowNode._groupData = void 0; + } + } + } +}; +var compareSourceRowIndex = (a, b) => a.sourceRowIndex - b.sourceRowIndex; +var maybeExpandFromRemovedParent = (parent, oldParent) => { + if (oldParent._expanded !== void 0 && parent._expanded === void 0 && parent.treeParent !== null && parent.sourceRowIndex < 0) { + parent._expanded = oldParent._expanded; + } +}; +var updateNodeKey = (node, key) => { + const hadData = node._groupData !== void 0; + node.key = key; + node.groupValue = key; + const sibling = node.sibling; + if (sibling) { + sibling.key = key; + } + if (hadData) { + node._groupData = void 0; + node.setData(node.data); + } +}; + +// packages/ag-grid-enterprise/src/treeData/treeDataModule.ts +var SharedTreeDataModule = { + moduleName: "SharedTreeData", + version: VERSION, + dependsOn: [EnterpriseCoreModule, SharedAggregationModule, GroupColumnModule, ChangedPathModule, StickyRowModule] +}; +var TreeDataModule = { + moduleName: "TreeData", + version: VERSION, + dynamicBeans: { treeGroupStrategy: TreeGroupStrategy }, + rowModels: ["clientSide"], + dependsOn: [SharedTreeDataModule, AggregationModule, ClientSideRowModelHierarchyModule, GroupEditModule] +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/blocks/blockUtils.ts +import { + BeanStub as BeanStub60, + RowNode as RowNode5, + _doOnce, + _exists as _exists26, + _getGroupTotalRowCallback as _getGroupTotalRowCallback3, + _getRowHeightAsNumber as _getRowHeightAsNumber2, + _getRowHeightForNode as _getRowHeightForNode2, + _warn as _warn44 +} from "ag-grid-community"; +var GROUP_MISSING_KEY_ID = "ag-Grid-MissingKey"; +var BlockUtils = class extends BeanStub60 { + constructor() { + super(...arguments); + this.beanName = "ssrmBlockUtils"; + } + wireBeans(beans) { + this.valueSvc = beans.valueSvc; + this.showRowGroupCols = beans.showRowGroupCols; + this.nodeManager = beans.ssrmNodeManager; + this.expansionSvc = beans.expansionSvc; + this.serverSideRowModel = beans.rowModel; + this.storeFactory = beans.ssrmStoreFactory; + } + createRowNode(params) { + const rowNode = new RowNode5(this.beans); + const rowHeight = params.rowHeight != null ? params.rowHeight : _getRowHeightAsNumber2(this.beans); + rowNode.setRowHeight(rowHeight); + rowNode.group = params.group; + rowNode.leafGroup = params.leafGroup; + rowNode.level = params.level; + rowNode.uiLevel = params.level; + rowNode.parent = params.parent; + rowNode.stub = true; + rowNode.__needsRefreshWhenVisible = false; + if (rowNode.group) { + rowNode.expanded = false; + rowNode.field = params.field; + rowNode.rowGroupColumn = params.rowGroupColumn; + rowNode.rowGroupIndex = params.level; + } + return rowNode; + } + destroyRowNode(rowNode, preserveStore = false) { + if (rowNode.childStore && !preserveStore) { + this.destroyBean(rowNode.childStore); + rowNode.childStore = null; + } + const sibling = rowNode.sibling; + if (sibling && !rowNode.footer) { + this.destroyRowNode(sibling, false); + } + rowNode._destroy(true); + if (rowNode.id != null) { + this.nodeManager.removeNode(rowNode); + } + } + setTreeGroupInfo(rowNode) { + rowNode.updateHasChildren(); + const getKeyFunc = this.gos.get("getServerSideGroupKey"); + const hasChildren = rowNode.hasChildren(); + if (hasChildren && getKeyFunc != null) { + rowNode.key = getKeyFunc(rowNode.data); + } + if (!hasChildren && rowNode.childStore != null) { + this.destroyBean(rowNode.childStore); + rowNode.childStore = null; + if (!rowNode.master) { + rowNode.expanded = false; + } + } + } + setRowGroupInfo(rowNode) { + rowNode.key = this.valueSvc.getValue(rowNode.rowGroupColumn, rowNode, "data"); + if (rowNode.key === null || rowNode.key === void 0) { + _doOnce(() => { + _warn44(190, { rowGroupId: rowNode.rowGroupColumn?.getId(), data: rowNode.data }); + }, "SSBlock-BadKey"); + } + const isUnbalancedGroup = this.gos.get("groupAllowUnbalanced") && rowNode.key === ""; + if (isUnbalancedGroup) { + const storeParams = this.serverSideRowModel.getParams(); + rowNode.childStore = this.createBean(this.storeFactory.createStore(storeParams, rowNode)); + } + const getGroupIncludeFooter = _getGroupTotalRowCallback3(this.beans.gos); + const doesRowShowFooter = getGroupIncludeFooter({ node: rowNode }); + if (doesRowShowFooter) { + _createRowNodeFooter(rowNode, this.beans); + if (rowNode.sibling) { + rowNode.sibling.uiLevel = rowNode.uiLevel + 1; + } + } + } + setMasterDetailInfo(rowNode) { + const isMasterFunc = this.gos.get("isRowMaster"); + if (isMasterFunc != null) { + rowNode.master = isMasterFunc(rowNode.data); + } else { + rowNode.master = true; + } + } + updateDataIntoRowNode(rowNode, data) { + rowNode.updateData(data); + if (this.gos.get("treeData")) { + this.setTreeGroupInfo(rowNode); + this.setChildCountIntoRowNode(rowNode); + this.updateRowFooter(rowNode); + } else if (rowNode.group) { + this.setChildCountIntoRowNode(rowNode); + this.updateRowFooter(rowNode); + } else if (this.gos.get("masterDetail")) { + } + } + updateRowFooter(rowNode) { + if (rowNode.footer) { + return; + } + if (rowNode.group) { + const getGroupIncludeFooter = _getGroupTotalRowCallback3(this.beans.gos); + const shouldRowShowFooter = getGroupIncludeFooter({ node: rowNode }); + if (shouldRowShowFooter && !rowNode.sibling) { + _createRowNodeFooter(rowNode, this.beans); + return; + } + } + if (rowNode.sibling) { + _destroyRowNodeFooter(rowNode); + } + } + setDataIntoRowNode(rowNode, data, defaultId, cachedRowHeight) { + rowNode.stub = false; + const treeData = this.gos.get("treeData"); + rowNode.setDataAndId(data, defaultId); + const group = rowNode.group; + if ((treeData || !group) && this.gos.get("masterDetail")) { + this.setMasterDetailInfo(rowNode); + } + if (treeData) { + this.setTreeGroupInfo(rowNode); + } else if (group) { + this.setRowGroupInfo(rowNode); + } + if (treeData || group) { + this.setGroupDataIntoRowNode(rowNode); + this.setChildCountIntoRowNode(rowNode); + } + if (_exists26(data)) { + rowNode.setRowHeight(_getRowHeightForNode2(this.beans, rowNode, false, cachedRowHeight).height); + rowNode.sibling?.setRowHeight( + _getRowHeightForNode2(this.beans, rowNode.sibling, false, cachedRowHeight).height + ); + } + } + setChildCountIntoRowNode(rowNode) { + const getChildCount = this.gos.get("getChildCount"); + if (getChildCount) { + rowNode.setAllChildrenCount(getChildCount(rowNode.data)); + } + } + setGroupDataIntoRowNode(rowNode) { + const key = rowNode.key; + rowNode.groupValue = key; + if (rowNode.sibling) { + rowNode.sibling.groupValue = key; + } + const groupDisplayCols = this.showRowGroupCols?.columns; + if (!groupDisplayCols) { + return; + } + const usingTreeData = this.gos.get("treeData"); + for (const col of groupDisplayCols) { + let groupData = rowNode._groupData; + if (!groupData) { + groupData = {}; + rowNode._groupData = groupData; + } + if (usingTreeData) { + groupData[col.getColId()] = key; + } else if (col.isRowGroupDisplayed(rowNode.rowGroupColumn.getId())) { + const groupValue = this.valueSvc.getValue(rowNode.rowGroupColumn, rowNode, "data"); + groupData[col.getColId()] = groupValue; + } + } + } + clearDisplayIndex(rowNode) { + rowNode.clearRowTopAndRowIndex(); + const hasChildStore = rowNode.hasChildren() && !!rowNode.childStore; + if (hasChildStore) { + rowNode.childStore?.clearDisplayIndexes(); + } + const hasDetailNode = rowNode.master && rowNode.detailNode; + if (hasDetailNode) { + rowNode.detailNode?.clearRowTopAndRowIndex(); + } + } + setDisplayIndex(rowNode, displayIndexSeq, nextRowTop, uiLevel) { + const isUnbalancedGroup = this.gos.get("groupAllowUnbalanced") && rowNode.group && rowNode.key === ""; + const isHiddenOpenGroup = this.gos.get("groupHideOpenParents") && rowNode.group && rowNode.expanded; + if (isHiddenOpenGroup || isUnbalancedGroup) { + rowNode.setRowIndex(null); + rowNode.setRowTop(null); + } else { + rowNode.setRowIndex(displayIndexSeq.value++); + rowNode.setRowTop(nextRowTop.value); + nextRowTop.value += rowNode.rowHeight; + } + rowNode.setUiLevel(uiLevel); + if (rowNode.footer) { + return; + } + const hasDetailRow = rowNode.master; + if (hasDetailRow) { + if (rowNode.expanded && rowNode.detailNode) { + rowNode.detailNode.setRowIndex(displayIndexSeq.value++); + rowNode.detailNode.setRowTop(nextRowTop.value); + nextRowTop.value += rowNode.detailNode.rowHeight; + } else if (rowNode.detailNode) { + rowNode.detailNode.clearRowTopAndRowIndex(); + } + } + const hasChildStore = rowNode.hasChildren() && !!rowNode.childStore; + if (hasChildStore) { + const childStore = rowNode.childStore; + if (rowNode.expanded || isUnbalancedGroup) { + childStore.setDisplayIndexes(displayIndexSeq, nextRowTop, isUnbalancedGroup ? uiLevel : uiLevel + 1); + } else { + childStore.clearDisplayIndexes(); + } + } + } + extractRowBounds(rowNode, index) { + const extractRowBounds = (currentRowNode) => ({ + rowHeight: currentRowNode.rowHeight, + rowTop: currentRowNode.rowTop + }); + if (rowNode.rowIndex === index) { + return extractRowBounds(rowNode); + } + if (rowNode.hasChildren() && rowNode.expanded && !!rowNode.childStore) { + const childStore = rowNode.childStore; + if (childStore.isDisplayIndexInStore(index)) { + return childStore.getRowBounds(index); + } + } else if (rowNode.master && rowNode.expanded && rowNode.detailNode) { + if (rowNode.detailNode.rowIndex === index) { + return extractRowBounds(rowNode.detailNode); + } + } + } + isPixelInNodeRange(node, pixel) { + if (!_exists26(node.rowTop) || !_exists26(node.rowHeight)) { + return false; + } + return pixel >= node.rowTop && pixel < node.rowTop + node.rowHeight; + } + getIndexAtPixel(rowNode, pixel) { + if (this.isPixelInNodeRange(rowNode, pixel)) { + return rowNode.rowIndex; + } + const expandedMasterRow = rowNode.master && rowNode.expanded; + const detailNode = rowNode.detailNode; + if (expandedMasterRow && detailNode && this.isPixelInNodeRange(detailNode, pixel)) { + return detailNode.rowIndex; + } + if (rowNode.hasChildren() && rowNode.expanded && !!rowNode.childStore) { + const childStore = rowNode.childStore; + if (childStore.isPixelInRange(pixel)) { + return childStore.getRowIndexAtPixel(pixel); + } + } + return null; + } + createNodeIdPrefix(parentRowNode) { + const parts = []; + let rowNode = parentRowNode; + while (rowNode && rowNode.level >= 0) { + if (rowNode.key === "") { + parts.push(GROUP_MISSING_KEY_ID); + } else { + parts.push(rowNode.key); + } + rowNode = rowNode.parent; + } + if (parts.length > 0) { + return parts.reverse().join("-"); + } + return void 0; + } + checkOpenByDefault(rowNode) { + const expanded = !!this.expansionSvc?.isNodeExpanded(rowNode); + const oldExpanded = rowNode._expanded; + if (!!oldExpanded !== expanded) { + rowNode.setExpanded(expanded); + } else if (oldExpanded === void 0) { + rowNode._expanded = expanded; + } + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/listeners/expandListener.ts +import { BeanStub as BeanStub61, _isServerSideRowModel as _isServerSideRowModel4 } from "ag-grid-community"; +var ExpandListener = class extends BeanStub61 { + constructor() { + super(...arguments); + this.beanName = "ssrmExpandListener"; + } + postConstruct() { + if (!_isServerSideRowModel4(this.gos)) { + return; + } + this.addManagedEventListeners({ rowExpansionStateChanged: this.onRowExpandStateChanged.bind(this) }); + } + onRowExpandStateChanged() { + const beans = this.beans; + const expansionSvx = beans.expansionSvc; + beans.rowModel.forEachNode((rowNode) => { + expansionSvx.updateExpandedState(rowNode); + }); + this.eventSvc.dispatchEvent({ type: "storeUpdated" }); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/listeners/filterListener.ts +import { BeanStub as BeanStub62, _isServerSideRowModel as _isServerSideRowModel5, _jsonEquals as _jsonEquals2 } from "ag-grid-community"; +var FilterListener = class extends BeanStub62 { + constructor() { + super(...arguments); + this.beanName = "ssrmFilterListener"; + } + wireBeans(beans) { + this.serverSideRowModel = beans.rowModel; + this.filterManager = beans.filterManager; + this.listenerUtils = beans.ssrmListenerUtils; + } + postConstruct() { + if (!_isServerSideRowModel5(this.gos)) { + return; + } + this.addManagedEventListeners({ + advancedFilterEnabledChanged: () => this.onFilterChanged(true), + filterChanged: () => this.onFilterChanged() + }); + } + onFilterChanged(advancedFilterEnabledChanged) { + const storeParams = this.serverSideRowModel.getParams(); + if (!storeParams) { + return; + } + const oldModel = storeParams.filterModel; + let newModel; + let changedColumns; + if (this.filterManager?.isAdvFilterEnabled()) { + newModel = this.filterManager.getAdvFilterModel(); + const oldColumns = advancedFilterEnabledChanged ? Object.keys(oldModel ?? {}) : this.getAdvancedFilterColumns(oldModel); + const newColumns = this.getAdvancedFilterColumns(newModel); + for (const column of oldColumns) { + newColumns.add(column); + } + changedColumns = Array.from(newColumns); + } else { + newModel = this.filterManager?.getFilterModel() ?? {}; + if (advancedFilterEnabledChanged) { + const oldColumns = this.getAdvancedFilterColumns(oldModel); + for (const column of Object.keys(newModel)) { + oldColumns.add(column); + } + changedColumns = Array.from(oldColumns); + } else { + changedColumns = this.findChangedColumns(oldModel, newModel); + } + } + const valueColChanged = this.listenerUtils.isSortingWithValueColumn(changedColumns); + const secondaryColChanged = this.listenerUtils.isSortingWithSecondaryColumn(changedColumns); + const params = { + valueColChanged, + secondaryColChanged, + changedColumns + }; + this.serverSideRowModel.refreshAfterFilter(newModel, params); + } + findChangedColumns(oldModel, newModel) { + const allColKeysMap = {}; + for (const key of Object.keys(oldModel)) { + allColKeysMap[key] = true; + } + for (const key of Object.keys(newModel)) { + allColKeysMap[key] = true; + } + const res = []; + for (const key of Object.keys(allColKeysMap)) { + const filterChanged = !_jsonEquals2(oldModel[key], newModel[key]); + if (filterChanged) { + res.push(key); + } + } + return res; + } + getAdvancedFilterColumns(model) { + const columns = /* @__PURE__ */ new Set(); + if (!model) { + return columns; + } + const processAdvancedFilterModel = (filterModel) => { + if (filterModel.filterType === "join") { + for (const condition of filterModel.conditions) { + processAdvancedFilterModel(condition); + } + } else { + columns.add(filterModel.colId); + } + }; + processAdvancedFilterModel(model); + return columns; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/listeners/listenerUtils.ts +import { BeanStub as BeanStub63 } from "ag-grid-community"; +var ListenerUtils = class extends BeanStub63 { + constructor() { + super(...arguments); + this.beanName = "ssrmListenerUtils"; + } + wireBeans(beans) { + this.pivotResultCols = beans.pivotResultCols; + this.valueColsSvc = beans.valueColsSvc; + } + isSortingWithValueColumn(changedColumnsInSort) { + const valueColIds = (this.valueColsSvc?.columns ?? []).map((col) => col.getColId()); + for (let i = 0; i < changedColumnsInSort.length; i++) { + if (valueColIds.indexOf(changedColumnsInSort[i]) > -1) { + return true; + } + } + return false; + } + isSortingWithSecondaryColumn(changedColumnsInSort) { + const pivotResultCols = this.pivotResultCols?.getPivotResultCols(); + if (!pivotResultCols) { + return false; + } + const secondaryColIds = pivotResultCols.list.map((col) => col.getColId()); + for (let i = 0; i < changedColumnsInSort.length; i++) { + if (secondaryColIds.indexOf(changedColumnsInSort[i]) > -1) { + return true; + } + } + return false; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/listeners/sortListener.ts +import { BeanStub as BeanStub64, _isServerSideRowModel as _isServerSideRowModel6 } from "ag-grid-community"; +var SortListener = class extends BeanStub64 { + constructor() { + super(...arguments); + this.beanName = "ssrmSortSvc"; + } + wireBeans(beans) { + this.sortSvc = beans.sortSvc; + this.serverSideRowModel = beans.rowModel; + this.listenerUtils = beans.ssrmListenerUtils; + } + postConstruct() { + if (!_isServerSideRowModel6(this.gos)) { + return; + } + this.addManagedEventListeners({ sortChanged: this.onSortChanged.bind(this) }); + } + onSortChanged() { + const storeParams = this.serverSideRowModel.getParams(); + if (!storeParams) { + return; + } + const newSortModel = this.sortSvc.getSortModel(); + const oldSortModel = storeParams.sortModel; + const changedColumns = this.findChangedColumnsInSort(newSortModel, oldSortModel); + const valueColChanged = this.listenerUtils.isSortingWithValueColumn(changedColumns); + const secondaryColChanged = this.listenerUtils.isSortingWithSecondaryColumn(changedColumns); + const params = { + valueColChanged, + secondaryColChanged, + changedColumns + }; + this.serverSideRowModel.refreshAfterSort(newSortModel, params); + } + // returns back all the cols that were effected by the sorting. eg if we were sorting by col A, + // and now we are sorting by col B, the list of impacted cols should be A and B. so if a cache + // is impacted by sorting on A or B then it needs to be refreshed. this includes where the cache + // was previously sorted by A and then the A sort now needs to be cleared. + findChangedColumnsInSort(newSortModel, oldSortModel) { + let allColsInBothSorts = []; + for (const sortModel of [newSortModel, oldSortModel]) { + if (sortModel) { + const ids = sortModel.map((sm) => sm.colId); + allColsInBothSorts = allColsInBothSorts.concat(ids); + } + } + const differentSorts = (oldSortItem, newSortItem) => { + const oldSort = oldSortItem ? oldSortItem.sort : null; + const newSort = newSortItem ? newSortItem.sort : null; + return oldSort !== newSort; + }; + const differentIndexes = (oldSortItem, newSortItem) => { + const oldIndex = oldSortItem ? oldSortModel.indexOf(oldSortItem) : -1; + const newIndex = newSortItem ? newSortModel.indexOf(newSortItem) : -1; + return oldIndex !== newIndex; + }; + return allColsInBothSorts.filter((colId) => { + const oldSortItem = oldSortModel.find((sm) => sm.colId === colId); + const newSortItem = newSortModel.find((sm) => sm.colId === colId); + return differentSorts(oldSortItem, newSortItem) || differentIndexes(oldSortItem, newSortItem); + }); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/nodeManager.ts +import { BeanStub as BeanStub65, _warn as _warn45 } from "ag-grid-community"; +var NodeManager = class extends BeanStub65 { + constructor() { + super(...arguments); + this.beanName = "ssrmNodeManager"; + this.rowNodes = /* @__PURE__ */ new Map(); + } + addRowNode(rowNode) { + const id = rowNode.id; + if (this.rowNodes.has(id)) { + _warn45(187, { + rowId: id, + firstData: this.rowNodes.get(id).data, + secondData: rowNode.data + }); + } + this.rowNodes.set(id, rowNode); + } + removeNode(rowNode) { + const id = rowNode.id; + this.rowNodes.delete(id); + } + destroy() { + this.clear(); + super.destroy(); + } + clear() { + this.rowNodes.clear(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/serverSideRowModel.ts +import { + BeanStub as BeanStub66, + RowNode as RowNode6, + _debounce as _debounce6, + _getRowHeightAsNumber as _getRowHeightAsNumber3, + _getRowHeightForNode as _getRowHeightForNode3, + _isGetRowHeightFunction, + _isRowSelection as _isRowSelection2, + _jsonEquals as _jsonEquals3, + _warn as _warn46 +} from "ag-grid-community"; +var ServerSideRowModel = class extends BeanStub66 { + constructor() { + super(...arguments); + this.beanName = "rowModel"; + this.hierarchical = true; + this.started = false; + this.managingPivotResultColumns = false; + this.onRowHeightChanged_debounced = _debounce6(this, this.onRowHeightChanged.bind(this), 100); + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.colNames = beans.colNames; + this.pivotResultCols = beans.pivotResultCols; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + this.pivotColsSvc = beans.pivotColsSvc; + this.valueColsSvc = beans.valueColsSvc; + this.filterManager = beans.filterManager; + this.sortSvc = beans.sortSvc; + this.rowRenderer = beans.rowRenderer; + this.nodeManager = beans.ssrmNodeManager; + this.storeFactory = beans.ssrmStoreFactory; + this.pivotColDefSvc = beans.pivotColDefSvc; + } + // we don't implement as lazy row heights is not supported in this row model + ensureRowHeightsValid() { + return false; + } + start() { + this.started = true; + this.updateDatasource(); + } + destroyDatasource() { + if (!this.datasource) { + return; + } + if (this.datasource.destroy) { + this.datasource.destroy(); + } + this.rowRenderer.datasourceChanged(); + this.datasource = void 0; + } + postConstruct() { + const resetListener = this.resetRootStore.bind(this); + this.addManagedEventListeners({ + newColumnsLoaded: this.onColumnEverything.bind(this), + storeUpdated: this.onStoreUpdated.bind(this), + columnValueChanged: resetListener, + columnPivotChanged: resetListener, + columnRowGroupChanged: resetListener, + columnPivotModeChanged: resetListener + }); + this.addManagedPropertyListeners( + [ + /** + * Following properties omitted as they are likely to come with undesired side effects. + * 'getRowId', 'isRowMaster', 'getRowHeight', 'isServerSideGroup', 'getServerSideGroupKey', + * */ + "masterDetail", + "treeData", + "removePivotHeaderRowWhenSingleValueColumn", + "cacheBlockSize" + ], + resetListener + ); + this.addManagedPropertyListeners(["groupAllowUnbalanced", "groupTotalRow"], () => this.onStoreUpdated()); + this.addManagedPropertyListener("rowHeight", () => this.resetRowHeights()); + this.verifyProps(); + this.addManagedPropertyListener("serverSideDatasource", () => this.updateDatasource()); + } + updateDatasource() { + const datasource = this.gos.get("serverSideDatasource"); + if (datasource) { + this.setDatasource(datasource); + } + } + verifyProps() { + if (_isRowSelection2(this.gos) && !this.gos.exists("getRowId")) { + _warn46(188, { feature: "selection" }); + } + } + setDatasource(datasource) { + if (!this.started) { + return; + } + this.destroyDatasource(); + this.datasource = datasource; + this.resetRootStore(); + } + applyRowData(rowDataParams, startRow, route) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + const storeToExecuteOn = rootStore.getChildStore(route); + if (!storeToExecuteOn) { + return; + } + storeToExecuteOn.applyRowData(rowDataParams, startRow, rowDataParams.rowData.length); + } + isLastRowIndexKnown() { + const cache = this.getRootStore(); + if (!cache) { + return false; + } + return cache.isLastRowIndexKnown(); + } + onColumnEverything() { + if (!this.storeParams) { + this.resetRootStore(); + return; + } + const rowGroupColumnVos = this.columnsToValueObjects(this.rowGroupColsSvc?.columns); + const valueColumnVos = this.columnsToValueObjects(this.valueColsSvc?.columns); + const pivotColumnVos = this.columnsToValueObjects(this.pivotColsSvc?.columns); + const areColsSame = (params) => { + const oldColsMap = {}; + for (const col of params.oldCols) { + oldColsMap[col.id] = col; + } + const allColsUnchanged = params.newCols.every((col) => { + const equivalentCol = oldColsMap[col.id]; + if (equivalentCol) { + delete oldColsMap[col.id]; + } + return equivalentCol && equivalentCol.field === col.field && equivalentCol.aggFunc === col.aggFunc; + }); + const missingCols = !params.allowRemovedColumns && !!Object.values(oldColsMap).length; + return allColsUnchanged && !missingCols; + }; + const sortModelDifferent = !_jsonEquals3(this.storeParams.sortModel, this.sortSvc?.getSortModel() ?? []); + const rowGroupDifferent = !areColsSame({ + oldCols: this.storeParams.rowGroupCols, + newCols: rowGroupColumnVos + }); + const pivotDifferent = !areColsSame({ + oldCols: this.storeParams.pivotCols, + newCols: pivotColumnVos + }); + const valuesDifferent = !!rowGroupColumnVos?.length && !areColsSame({ + oldCols: this.storeParams.valueCols, + newCols: valueColumnVos, + allowRemovedColumns: true + }); + const resetRequired = sortModelDifferent || rowGroupDifferent || pivotDifferent || valuesDifferent; + if (resetRequired) { + this.resetRootStore(); + } else { + const newParams = this.createStoreParams(); + this.storeParams.rowGroupCols = newParams.rowGroupCols; + this.storeParams.pivotCols = newParams.pivotCols; + this.storeParams.valueCols = newParams.valueCols; + } + } + destroyRootStore() { + if (!this.rootNode?.childStore) { + return; + } + this.rootNode.childStore = this.destroyBean(this.rootNode.childStore); + this.nodeManager.clear(); + } + refreshAfterSort(newSortModel, params) { + if (this.storeParams) { + this.storeParams.sortModel = newSortModel; + } + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.refreshAfterSort(params); + this.onStoreUpdated(); + } + generateSecondaryColumns(pivotFields) { + if (!this.pivotColDefSvc) { + this.gos.assertModuleRegistered("SharedPivot", 2); + return; + } + const pivotColumnGroupDefs = this.pivotColDefSvc.createColDefsFromFields(pivotFields); + this.managingPivotResultColumns = true; + this.pivotResultCols?.setPivotResultCols(pivotColumnGroupDefs, "rowModelUpdated"); + } + resetRowHeights() { + const atLeastOne = this.resetRowHeightsForAllRowNodes(); + const rootNodeHeight = _getRowHeightForNode3(this.beans, this.rootNode); + this.rootNode.setRowHeight(rootNodeHeight.height, rootNodeHeight.estimated); + if (this.rootNode.sibling) { + const rootNodeSibling = _getRowHeightForNode3(this.beans, this.rootNode.sibling); + this.rootNode.sibling.setRowHeight(rootNodeSibling.height, rootNodeSibling.estimated); + } + if (atLeastOne) { + this.onRowHeightChanged(); + } + } + resetRowHeightsForAllRowNodes() { + let atLeastOne = false; + this.forEachNode((rowNode) => { + const rowHeightForNode = _getRowHeightForNode3(this.beans, rowNode); + rowNode.setRowHeight(rowHeightForNode.height, rowHeightForNode.estimated); + const detailNode = rowNode.detailNode; + if (detailNode) { + const detailRowHeight = _getRowHeightForNode3(this.beans, detailNode); + detailNode.setRowHeight(detailRowHeight.height, detailRowHeight.estimated); + } + if (rowNode.sibling) { + const siblingRowHeight = _getRowHeightForNode3(this.beans, rowNode.sibling); + detailNode?.setRowHeight(siblingRowHeight.height, siblingRowHeight.estimated); + } + atLeastOne = true; + }); + return atLeastOne; + } + resetRootStore() { + this.destroyRootStore(); + this.rootNode = new RowNode6(this.beans); + this.rootNode.group = true; + this.rootNode.level = -1; + if (this.datasource) { + this.storeParams = this.createStoreParams(); + this.rootNode.childStore = this.createBean(this.storeFactory.createStore(this.storeParams, this.rootNode)); + this.updateRowIndexesAndBounds(); + } + if (this.managingPivotResultColumns) { + this.pivotResultCols?.setPivotResultCols(null, "api"); + this.managingPivotResultColumns = false; + } + this.dispatchModelUpdated(true); + } + columnsToValueObjects(columns = []) { + return columns.map( + (col) => ({ + id: col.getId(), + aggFunc: col.getAggFunc(), + displayName: this.colNames.getDisplayNameForColumn(col, "model"), + field: col.getColDef().field + }) + ); + } + createStoreParams() { + const rowGroupColumnVos = this.columnsToValueObjects(this.rowGroupColsSvc?.columns); + const valueColumnVos = this.columnsToValueObjects(this.valueColsSvc?.columns); + const pivotColumnVos = this.columnsToValueObjects(this.pivotColsSvc?.columns); + const dynamicRowHeight = _isGetRowHeightFunction(this.gos); + const params = { + // the columns the user has grouped and aggregated by + valueCols: valueColumnVos, + rowGroupCols: rowGroupColumnVos, + pivotCols: pivotColumnVos, + pivotMode: this.colModel.isPivotMode(), + // sort and filter model + filterModel: this.filterManager?.isAdvFilterEnabled() ? this.filterManager?.getAdvFilterModel() : this.filterManager?.getFilterModel() ?? {}, + sortModel: this.sortSvc?.getSortModel() ?? [], + datasource: this.datasource, + lastAccessedSequence: { value: 0 }, + // blockSize: blockSize == null ? 100 : blockSize, + dynamicRowHeight + }; + return params; + } + getParams() { + return this.storeParams; + } + dispatchModelUpdated(reset = false) { + this.eventSvc.dispatchEvent({ + type: "modelUpdated", + animate: !reset, + keepRenderedRows: !reset, + newPage: false, + newData: false + }); + } + onStoreUpdated() { + this.updateRowIndexesAndBounds(); + this.dispatchModelUpdated(); + } + onRowHeightChanged() { + this.updateRowIndexesAndBounds(); + this.dispatchModelUpdated(); + } + updateRowIndexesAndBounds() { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.setDisplayIndexes({ value: 0 }, { value: 0 }, 0); + } + retryLoads() { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.retryLoads(); + this.onStoreUpdated(); + } + getRow(index) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return void 0; + } + return rootStore.getRowUsingDisplayIndex(index); + } + refreshAfterFilter(newFilterModel, params) { + if (this.storeParams) { + this.storeParams.filterModel = newFilterModel; + } + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.refreshAfterFilter(params); + this.onStoreUpdated(); + } + getRootStore() { + return this.rootNode?.childStore; + } + getRowCount() { + const rootStore = this.getRootStore(); + if (!rootStore) { + return 0; + } + return rootStore.getDisplayIndexEnd(); + } + getTopLevelRowCount() { + const rootStore = this.getRootStore(); + if (!rootStore) { + return 1; + } + return rootStore.getRowCount(); + } + getTopLevelRowDisplayedIndex(topLevelIndex) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return topLevelIndex; + } + return rootStore.getTopLevelRowDisplayedIndex(topLevelIndex); + } + getRowBounds(index) { + const rootStore = this.getRootStore(); + if (!rootStore) { + const rowHeight = _getRowHeightAsNumber3(this.beans); + return { + rowTop: 0, + rowHeight + }; + } + return rootStore.getRowBounds(index); + } + getBlockStates() { + const root = this.getRootStore(); + if (!root) { + return void 0; + } + const states = {}; + root.forEachStoreDeep((store) => { + const blockStates = store.getBlockStates(); + for (const block of Object.keys(blockStates)) { + states[block] = blockStates[block]; + } + }); + return states; + } + getRowIndexAtPixel(pixel) { + const rootStore = this.getRootStore(); + if (pixel <= 0 || !rootStore) { + return 0; + } + return rootStore.getRowIndexAtPixel(pixel); + } + isEmpty() { + return false; + } + getOverlayType() { + const rootStore = this.getRootStore(); + if (rootStore?.getDisplayIndexEnd() === 0) { + return this.filterManager?.isAnyFilterPresent() ? "noMatchingRows" : "noRows"; + } + return null; + } + isRowsToRender() { + return this.getRootStore() != null && this.getRowCount() > 0; + } + getType() { + return "serverSide"; + } + forEachNode(callback) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.forEachNodeDeep(callback); + } + forEachDisplayedNode(callback) { + const wrappedCallback = (node, index) => { + if (node.stub || !node.displayed) { + return; + } + callback(node, index); + }; + this.forEachNode(wrappedCallback); + } + forEachNodeAfterFilterAndSort(callback, includeFooterNodes = false) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.forEachNodeDeepAfterFilterAndSort(callback, void 0, includeFooterNodes); + } + /** @returns false if store hasn't started */ + executeOnStore(route, callback) { + if (!this.started) { + return false; + } + const rootStore = this.getRootStore(); + if (!rootStore) { + return true; + } + const storeToExecuteOn = rootStore.getChildStore(route); + if (storeToExecuteOn) { + callback(storeToExecuteOn); + } + return true; + } + refreshStore(params = {}) { + const route = params.route ? params.route : []; + this.executeOnStore(route, (store) => store.refreshStore(params.purge == true)); + } + getStoreState() { + const res = []; + const rootStore = this.getRootStore(); + if (rootStore) { + rootStore.addStoreStates(res); + } + return res; + } + getNodesInRangeForSelection(firstInRange, lastInRange) { + const startIndex = firstInRange.rowIndex; + const endIndex = lastInRange.rowIndex; + if (startIndex === null && endIndex === null) { + return []; + } + if (endIndex === null) { + return firstInRange ? [firstInRange] : []; + } + if (startIndex === null) { + return [lastInRange]; + } + const nodeRange = []; + const [firstIndex, lastIndex] = [startIndex, endIndex].sort((a, b) => a - b); + this.forEachNode((node) => { + const thisRowIndex = node.rowIndex; + if (thisRowIndex == null || node.stub) { + return; + } + if (thisRowIndex >= firstIndex && thisRowIndex <= lastIndex) { + nodeRange.push(node); + } + }); + if (nodeRange.length !== lastIndex - firstIndex + 1) { + return null; + } + return nodeRange; + } + getRowNode(id) { + let result; + this.forEachNode((rowNode) => { + if (rowNode.id === id) { + result = rowNode; + } + if (rowNode.detailNode && rowNode.detailNode.id === id) { + result = rowNode.detailNode; + } + }); + return result; + } + isRowPresent(rowNode) { + const foundRowNode = this.getRowNode(rowNode.id); + return !!foundRowNode; + } + setRowCount(rowCount, lastRowIndexKnown) { + const rootStore = this.getRootStore(); + if (!rootStore) { + return; + } + rootStore.setRowCount(rowCount, lastRowIndexKnown); + } + destroy() { + this.destroyDatasource(); + this.destroyRootStore(); + super.destroy(); + } + /** + * @deprecated v33.1 + */ + onRowHeightChangedDebounced() { + this.onRowHeightChanged_debounced(); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/serverSideRowModelApi.ts +import { _getServerSideRowModel, _warn as _warn47 } from "ag-grid-community"; +function getServerSideSelectionState(beans) { + return beans.selectionSvc?.getSelectionState() ?? null; +} +function setServerSideSelectionState(beans, state) { + beans.selectionSvc?.setSelectionState(state, "api"); +} +function applyServerSideTransaction(beans, transaction) { + return beans.ssrmTxnManager?.applyTransaction(transaction); +} +function applyServerSideRowData(beans, params) { + const startRow = params.startRow ?? 0; + const route = params.route ?? []; + if (startRow < 0) { + _warn47(189, { startRow }); + return; + } + _getServerSideRowModel(beans)?.applyRowData(params.successParams, startRow, route); +} +function applyServerSideTransactionAsync(beans, transaction, callback) { + return beans.ssrmTxnManager?.applyTransactionAsync(transaction, callback); +} +function retryServerSideLoads(beans) { + _getServerSideRowModel(beans)?.retryLoads(); +} +function flushServerSideAsyncTransactions(beans) { + return beans.ssrmTxnManager?.flushAsyncTransactions(); +} +function refreshServerSide(beans, params) { + _getServerSideRowModel(beans)?.refreshStore(params); +} +function getServerSideGroupLevelState(beans) { + return _getServerSideRowModel(beans)?.getStoreState() ?? []; +} + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/serverSideExpansionService.ts +import { RowNode as RowNode7, _exists as _exists27, _getRowHeightForNode as _getRowHeightForNode4 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/expansion/strategies/defaultStrategy.ts +import { BeanStub as BeanStub67 } from "ag-grid-community"; +var ExpandStrategy = class extends BeanStub67 { + constructor() { + super(...arguments); + this.name = "expand"; + this.expanded = /* @__PURE__ */ new Set(); + this.collapsed = /* @__PURE__ */ new Set(); + this.initialState = /* @__PURE__ */ new Map(); + } + /** + * Set the expanded and collapsed rows. + * @param expandedRows the rows to expand + * @param touchedRows the rows that have been touched + */ + setExpandedState({ expandedRowGroupIds, collapsedRowGroupIds }) { + this.expanded = new Set(expandedRowGroupIds); + this.collapsed = new Set(collapsedRowGroupIds); + for (const node of this.expanded) { + this.initialState.set(node, false); + } + for (const node of this.collapsed) { + this.initialState.set(node, true); + } + } + /** + * Get the serializable expanded state + * @returns an object containing the expanded and collapsed rows + */ + getExpandedState() { + return { + expandedRowGroupIds: Array.from(this.expanded), + collapsedRowGroupIds: Array.from(this.collapsed) + }; + } + /** + * Set the expanded state for a row. + * @param row the row to expand/collapse + * @param expanded true to expand the row, false to collapse it + */ + setRowExpanded(row, expanded) { + const id = row.id; + const stateIsDefault = this.initialState.get(id) === expanded; + if (expanded) { + this.collapsed.delete(id); + if (!stateIsDefault) { + this.expanded.add(id); + } + return; + } + this.expanded.delete(id); + if (!stateIsDefault) { + this.collapsed.add(id); + } + } + /** + * Check if a row is expanded. + * @param rowId the row id to check + * @returns true if the row is expanded + */ + isRowExpanded(node) { + const rowId = node.id; + if (this.expanded.has(rowId)) { + return true; + } + if (this.collapsed.has(rowId)) { + return false; + } + const initialVal = this.initialState.get(rowId); + if (initialVal != null) { + return initialVal; + } + const initial = this.getInitialRowState(node); + this.initialState.set(rowId, initial); + return initial; + } + /** + * This is different from just checking expandedState.isExpanded(rowNode.id), + * as this correctly prioritizes user interaction over the user-defined initial state. + * Plus sanity checks that the rowNode is actually expandable. + */ + getInitialRowState(rowNode) { + if (!rowNode.isExpandable()) { + return false; + } + const userFunc = this.gos.getCallback("isServerSideGroupOpenByDefault"); + if (!userFunc) { + return false; + } + const params = { + data: rowNode.data, + rowNode + }; + return userFunc(params); + } + /** + * if the row is expanded or has been collapsed intentionally, do not apply initial state. + * @param rowId the row id to check + * @returns true if the row has been toggled + */ + isRowInitialised(rowId) { + return this.initialState.has(rowId); + } + /** + * Expand or collapse all loaded rows. + * @param expanded true to expand all rows, false to collapse all rows + */ + expandAll(expanded) { + this.beans.rowModel.forEachNode((node) => { + this.setRowExpanded(node, expanded); + }); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/expansion/strategies/expandAllStrategy.ts +import { BeanStub as BeanStub68 } from "ag-grid-community"; +var ExpandAllStrategy = class extends BeanStub68 { + constructor() { + super(...arguments); + this.name = "expandAll"; + this.allExpanded = void 0; + this.flipped = /* @__PURE__ */ new Set(); + } + setExpandedState(state) { + this.allExpanded = state.expandAll; + this.flipped = new Set(state.invertedRowGroupIds); + } + getExpandedState() { + return { + expandAll: this.allExpanded, + invertedRowGroupIds: Array.from(this.flipped) + }; + } + setRowExpanded(row, expanded) { + const id = row.id; + if (expanded === this.allExpanded) { + this.flipped.delete(id); + return; + } + this.flipped.add(id); + } + isRowExpanded(node) { + const rowId = node.id; + return this.allExpanded !== this.flipped.has(rowId); + } + isRowInitialised() { + return true; + } + expandAll(expanded) { + this.allExpanded = expanded; + this.flipped.clear(); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/serverSideExpansionService.ts +var ServerSideExpansionService = class extends BaseExpansionService { + constructor() { + super(...arguments); + this.beanName = "expansionSvc"; + } + wireBeans(beans) { + this.serverSideRowModel = beans.rowModel; + this.storeFactory = beans.ssrmStoreFactory; + } + setStrategy(strategy) { + this.destroyBean(this.strategy); + this.strategy = this.createManagedBean(strategy); + } + postConstruct() { + const setDefaultExpand = () => { + this.setStrategy(new ExpandStrategy()); + }; + this.addManagedEventListeners({ + // when row grouping / pivot changes, the old expand all state is no longer valid as rows changed + columnRowGroupChanged: setDefaultExpand, + columnPivotChanged: setDefaultExpand, + columnPivotModeChanged: setDefaultExpand + }); + this.addManagedPropertyListener("ssrmExpandAllAffectsAllRows", (p) => { + if (!p.currentValue) { + this.setStrategy(new ExpandStrategy()); + this.updateAllNodes(); + this.dispatchStateUpdatedEvent(); + } + }); + setDefaultExpand(); + } + setExpansionState(state) { + const isExpandAllState = "expandAll" in state; + const isExpandAllStrategy = this.isExpandAllStrategy(this.strategy); + if (isExpandAllState !== isExpandAllStrategy) { + this.setStrategy(isExpandAllState ? new ExpandAllStrategy() : new ExpandStrategy()); + } + this.strategy.setExpandedState(state); + this.dispatchStateUpdatedEvent(); + this.updateAllNodes(); + } + getExpansionState() { + return this.strategy.getExpandedState(); + } + /** + * Updates all nodes to the correct expanded/collapsed state. + */ + updateAllNodes() { + this.serverSideRowModel.forEachNode((node) => { + super.setExpanded(node, this.isNodeExpanded(node)); + }); + } + isExpanded(rowNode) { + let value = rowNode._expanded; + if (value === null) { + value = this.defaultExpanded(rowNode); + rowNode._expanded = value; + } + return value; + } + isNodeExpanded(node) { + return this.strategy.isRowExpanded(node); + } + setExpanded(node, expanded, e, _) { + this.strategy.setRowExpanded(node, expanded); + super.setExpanded(node, expanded, e); + this.dispatchStateUpdatedEvent(); + this.updateExpandedState(node); + } + resetExpansion() { + this.setStrategy(new ExpandStrategy()); + this.updateAllNodes(); + this.dispatchStateUpdatedEvent(); + } + expandAll(expanded) { + const ssrmExpandAllAffectsAllRows = this.beans.gos.get("ssrmExpandAllAffectsAllRows"); + const shouldUseExpandAllStrategy = !this.isExpandAllStrategy(this.strategy) && ssrmExpandAllAffectsAllRows; + if (shouldUseExpandAllStrategy) { + this.setStrategy(new ExpandAllStrategy()); + } + this.strategy.expandAll(expanded); + this.updateAllNodes(); + this.dispatchStateUpdatedEvent(); + this.beans.eventSvc.dispatchEvent({ + type: "expandOrCollapseAll", + source: expanded ? "expandAll" : "collapseAll" + }); + } + isExpandAllStrategy(strategy) { + return strategy.name === "expandAll"; + } + onGroupExpandedOrCollapsed() { + } + setDetailsExpansionState(detailGridApi) { + const { gos: masterGos } = this.beans; + if (!masterGos.get("ssrmExpandAllAffectsAllRows")) { + return; + } + const masterExpansionState = this.getExpansionState(); + const isInitial = masterExpansionState.expandAll === void 0; + if (isInitial) { + return; + } + const allExpanded = masterExpansionState.expandAll && masterExpansionState.invertedRowGroupIds.length === 0; + const allCollapsed = !masterExpansionState.expandAll && masterExpansionState.invertedRowGroupIds.length === 0; + if (allCollapsed === allExpanded) { + return; + } + return allExpanded ? detailGridApi.expandAll() : detailGridApi.collapseAll(); + } + dispatchExpandedEvent(event) { + this.eventSvc.dispatchEvent(event); + this.beans.rowRenderer.refreshRowByNode(event.node); + } + updateExpandedState(rowNode) { + const oldChildStore = rowNode.childStore; + if (rowNode.expanded) { + if (rowNode.master && !rowNode.detailNode) { + rowNode.detailNode = this.createDetailNode(rowNode); + } + if (!oldChildStore && rowNode.hasChildren()) { + const storeParams = this.serverSideRowModel.getParams(); + rowNode.childStore = this.createBean(this.storeFactory.createStore(storeParams, rowNode)); + } + } else if (oldChildStore && this.gos.get("purgeClosedRowNodes")) { + rowNode.childStore = this.destroyBean(oldChildStore); + } + } + createDetailNode(masterNode) { + const detailNode = new RowNode7(this.beans); + detailNode.detail = true; + detailNode.selectable = false; + detailNode.parent = masterNode; + if (_exists27(masterNode.id)) { + detailNode.id = "detail_" + masterNode.id; + } + detailNode.data = masterNode.data; + detailNode.level = masterNode.level + 1; + const defaultDetailRowHeight = 200; + const rowHeight = _getRowHeightForNode4(this.beans, detailNode).height; + detailNode.rowHeight = rowHeight ? rowHeight : defaultDetailRowHeight; + return detailNode; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/serverSideSelectionService.ts +import { + BaseSelectionService, + _error as _error8, + _getGroupSelectsDescendants, + _getRowSelectionMode, + _isMultiRowSelection as _isMultiRowSelection3, + _isRowSelection as _isRowSelection3, + _isUsingNewRowSelectionAPI as _isUsingNewRowSelectionAPI2, + _warn as _warn50 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/selection/strategies/defaultStrategy.ts +import { BeanStub as BeanStub69, _error as _error6, _isMultiRowSelection, _isUsingNewRowSelectionAPI, _warn as _warn48 } from "ag-grid-community"; +var DefaultStrategy = class extends BeanStub69 { + constructor(selectionCtx) { + super(); + this.selectionCtx = selectionCtx; + this.selectedState = { selectAll: false, toggledNodes: /* @__PURE__ */ new Set() }; + /** + * Whether select-all functionality has ever been used. Used only to print warnings in `getSelectedNodes` for users. + * We print a warning even if not currently selecting all because we want users to be aware of the potential + * for unexpected behaviour when these two features are used together. + */ + this.selectAllUsed = false; + /** This is to prevent regressions, default selectionSvc retains reference of selected nodes. */ + this.selectedNodes = {}; + } + getSelectedState() { + return { + selectAll: this.selectedState.selectAll, + toggledNodes: [...this.selectedState.toggledNodes] + }; + } + setSelectedState(state) { + if (typeof state !== "object") { + _error6(116); + return; + } + if (!("selectAll" in state)) { + _error6(116); + return; + } + if (typeof state.selectAll !== "boolean") { + _error6(117); + return; + } + if (!("toggledNodes" in state) || !Array.isArray(state.toggledNodes)) { + return _warn48(197); + } + const newState = { + selectAll: state.selectAll, + toggledNodes: /* @__PURE__ */ new Set() + }; + state.toggledNodes.forEach((key) => { + if (typeof key === "string") { + newState.toggledNodes.add(key); + } else { + _warn48(196, { key }); + } + }); + const isSelectingMultipleRows = newState.selectAll || newState.toggledNodes.size > 1; + if (_isUsingNewRowSelectionAPI(this.gos) && !_isMultiRowSelection(this.gos) && isSelectingMultipleRows) { + _warn48(130); + return; + } + this.selectedState = newState; + } + deleteSelectionStateFromParent(parentPath, removedNodeIds) { + if (this.selectedState.toggledNodes.size === 0) { + return false; + } + let anyNodesToggled = false; + for (const id of removedNodeIds) { + if (this.selectedState.toggledNodes.delete(id)) { + anyNodesToggled = true; + } + } + return anyNodesToggled; + } + setNodesSelected(params) { + const { nodes, clearSelection, newValue, source } = params; + if (nodes.length === 0) { + return 0; + } + const onlyThisNode = clearSelection && newValue; + if (!_isMultiRowSelection(this.gos) || onlyThisNode) { + if (nodes.length > 1) { + _error6(130); + return 0; + } + const rowNode = nodes[0]; + const node = rowNode.footer ? rowNode.sibling : rowNode; + if (newValue && node.selectable) { + this.selectedNodes = { [node.id]: node }; + this.selectedState = { + selectAll: false, + toggledNodes: /* @__PURE__ */ new Set([node.id]) + }; + } else { + this.selectedNodes = {}; + this.selectedState = { + selectAll: false, + toggledNodes: /* @__PURE__ */ new Set() + }; + } + return 1; + } + const updateNodeState = (rowNode, value = newValue) => { + const node = rowNode.footer ? rowNode.sibling : rowNode; + if (value && node.selectable) { + this.selectedNodes[node.id] = node; + } else { + delete this.selectedNodes[node.id]; + } + const doesNodeConform = value === this.selectedState.selectAll; + if (doesNodeConform || !node.selectable) { + this.selectedState.toggledNodes.delete(node.id); + } else { + this.selectedState.toggledNodes.add(node.id); + } + }; + for (const node of nodes) { + updateNodeState(node); + } + if (nodes.length === 1 && source === "api") { + this.selectionCtx.setRoot(nodes[0].footer ? nodes[0].sibling : nodes[0]); + } + return 1; + } + processNewRow(node) { + if (this.selectedNodes[node.id]) { + this.selectedNodes[node.id] = node; + } + } + isNodeSelected(node) { + const isToggled = this.selectedState.toggledNodes.has(node.id); + return this.selectedState.selectAll ? !isToggled : isToggled; + } + getSelectedNodes(nullWhenSelectAll = false, warnWhenSelectAll = true) { + const { + selectedState: { selectAll }, + selectedNodes, + selectAllUsed + } = this; + if (warnWhenSelectAll && selectAllUsed) { + _warn48(199); + } + return nullWhenSelectAll && selectAll ? null : Object.values(selectedNodes); + } + getSelectedRows() { + return (this.getSelectedNodes() ?? []).map((node) => node.data); + } + getSelectionCount() { + if (this.selectedState.selectAll) { + return -1; + } + return this.selectedState.toggledNodes.size; + } + isEmpty() { + return !this.selectedState.selectAll && !this.selectedState.toggledNodes?.size; + } + selectAllRowNodes() { + this.reset(true); + } + deselectAllRowNodes() { + this.reset(false); + } + reset(selectAll) { + this.selectedState = { selectAll, toggledNodes: /* @__PURE__ */ new Set() }; + this.selectedNodes = {}; + this.selectAllUsed || (this.selectAllUsed = selectAll); + } + getSelectAllState() { + if (this.selectedState.selectAll) { + if (this.selectedState.toggledNodes.size > 0) { + return null; + } + return true; + } + if (this.selectedState.toggledNodes.size > 0) { + return null; + } + return false; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/selection/strategies/groupSelectsChildrenStrategy.ts +import { BeanStub as BeanStub70, _error as _error7, _isMultiRowSelection as _isMultiRowSelection2, _warn as _warn49 } from "ag-grid-community"; +var GroupSelectsChildrenStrategy = class extends BeanStub70 { + constructor(selectionCtx) { + super(); + this.selectionCtx = selectionCtx; + this.selectedState = { selectAllChildren: false, toggledNodes: /* @__PURE__ */ new Map() }; + } + wireBeans(beans) { + this.rowModel = beans.rowModel; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + this.filterManager = beans.filterManager; + this.selectionSvc = beans.selectionSvc; + } + postConstruct() { + this.addManagedEventListeners({ + // if model has updated, a store may now be fully loaded to clean up indeterminate states + modelUpdated: () => this.removeRedundantState(), + // when the grouping changes, the state no longer makes sense, so reset the state. + columnRowGroupChanged: () => this.selectionSvc.reset("rowGroupChanged") + }); + } + getSelectedState() { + const { gos, rowGroupColsSvc, selectedState } = this; + const treeData = gos.get("treeData"); + const recursivelySerializeState = (state, level, nodeId) => { + const normalisedState = { + nodeId + }; + if (treeData || rowGroupColsSvc && level <= rowGroupColsSvc.columns.length) { + normalisedState.selectAllChildren = state.selectAllChildren; + } + if (state.toggledNodes.size) { + const toggledNodes = []; + state.toggledNodes.forEach((value, key) => { + const newState = recursivelySerializeState(value, level + 1, key); + toggledNodes.push(newState); + }); + normalisedState.toggledNodes = toggledNodes; + } + return normalisedState; + }; + return recursivelySerializeState(selectedState, 0); + } + setSelectedState(state) { + if ("selectAll" in state) { + _error7(111); + return; + } + const recursivelyDeserializeState = (normalisedState, parentSelected) => { + if (typeof normalisedState !== "object") { + _error7(243); + throw new Error(); + } + if ("selectAllChildren" in normalisedState && typeof normalisedState.selectAllChildren !== "boolean") { + _error7(244); + throw new Error(); + } + if ("toggledNodes" in normalisedState) { + if (!Array.isArray(normalisedState.toggledNodes)) { + _error7(245); + throw new Error(); + } + const allHaveIds = normalisedState.toggledNodes.every( + (innerState) => typeof innerState === "object" && "nodeId" in innerState && typeof innerState.nodeId === "string" + ); + if (!allHaveIds) { + _error7(246); + throw new Error(); + } + } + const isThisNodeSelected = normalisedState.selectAllChildren ?? !parentSelected; + const convertedChildren = normalisedState.toggledNodes?.map((innerState) => [ + innerState.nodeId, + recursivelyDeserializeState(innerState, isThisNodeSelected) + ]); + const doesRedundantStateExist = convertedChildren?.some( + ([, innerState]) => isThisNodeSelected === innerState.selectAllChildren && innerState.toggledNodes.size === 0 + ); + if (doesRedundantStateExist) { + _error7(247); + throw new Error(); + } + return { + selectAllChildren: isThisNodeSelected, + toggledNodes: new Map(convertedChildren) + }; + }; + try { + this.selectedState = recursivelyDeserializeState(state, !!state.selectAllChildren); + } catch (e) { + } + } + deleteSelectionStateFromParent(parentRoute, removedNodeIds) { + let parentState = this.selectedState; + const remainingRoute = [...parentRoute]; + while (parentState && remainingRoute.length) { + parentState = parentState.toggledNodes.get(remainingRoute.pop()); + } + if (!parentState) { + return false; + } + let anyStateChanged = false; + for (const id of removedNodeIds) { + if (parentState?.toggledNodes.delete(id)) { + anyStateChanged = true; + } + } + if (anyStateChanged) { + this.removeRedundantState(); + } + return anyStateChanged; + } + setNodesSelected({ nodes, newValue, clearSelection, source }) { + if (nodes.length === 0) { + return 0; + } + const onlyThisNode = clearSelection && newValue; + if (!_isMultiRowSelection2(this.gos) || onlyThisNode) { + if (nodes.length > 1) { + _error7(130); + return 0; + } + this.deselectAllRowNodes(); + } + for (const rowNode of nodes) { + const node = rowNode.footer ? rowNode.sibling : rowNode; + const idPathToNode = this.getRouteToNode(node); + this.recursivelySelectNode(idPathToNode, this.selectedState, newValue); + } + this.removeRedundantState(); + if (nodes.length === 1 && source === "api") { + this.selectionCtx.setRoot(nodes[0].footer ? nodes[0].sibling : nodes[0]); + } + return 1; + } + isNodeSelected(node) { + const path = this.getRouteToNode(node); + return this.isNodePathSelected(path, this.selectedState); + } + isNodePathSelected([nextNode, ...nodes], state) { + if (nodes.length === 0) { + const isToggled = state.toggledNodes.has(nextNode.id); + if (nextNode.hasChildren()) { + const groupState = state.toggledNodes.get(nextNode.id); + if (groupState?.toggledNodes.size) { + return void 0; + } + } + return state.selectAllChildren ? !isToggled : isToggled; + } + if (state.toggledNodes.has(nextNode.id)) { + const nextState = state.toggledNodes.get(nextNode.id); + if (nextState) { + return this.isNodePathSelected(nodes, nextState); + } + } + return state.selectAllChildren; + } + getRouteToNode(node) { + const pathToNode = []; + let tempNode = node; + while (tempNode.parent) { + pathToNode.push(tempNode); + tempNode = tempNode.parent; + } + return pathToNode.reverse(); + } + removeRedundantState() { + if (this.filterManager?.isAnyFilterPresent()) { + return; + } + const forEachNodeStateDepthFirst = (state = this.selectedState, thisKey, parentState) => { + state.toggledNodes.forEach((value, key) => { + forEachNodeStateDepthFirst(value, key, state); + }); + if (thisKey) { + const thisRow = this.rowModel.getRowNode(thisKey); + const thisRowStore = thisRow?.childStore; + const isStoreSizeKnown = thisRowStore?.isLastRowIndexKnown(); + if (isStoreSizeKnown) { + const possibleAllNodesToggled = state.toggledNodes.size >= thisRowStore.getRowCount(); + if (possibleAllNodesToggled) { + for (const childState of state.toggledNodes.entries()) { + const [key, value] = childState; + if (value.toggledNodes.size > 0) { + return; + } + const rowDoesNotExist = !this.rowModel.getRowNode(key); + if (rowDoesNotExist) { + return; + } + } + state.selectAllChildren = !state.selectAllChildren; + state.toggledNodes.clear(); + } + } + } + const hasNoToggledRows = state.toggledNodes.size === 0; + const isIdenticalToParent = parentState?.selectAllChildren === state.selectAllChildren; + if (hasNoToggledRows && isIdenticalToParent) { + parentState?.toggledNodes.delete(thisKey); + } + }; + forEachNodeStateDepthFirst(); + } + recursivelySelectNode([nextNode, ...nodes], selectedState, newValue) { + if (!nextNode) { + return; + } + const isLastNode = !nodes.length; + if (isLastNode) { + const isNodeSelectable = nextNode.selectable; + const doesNodeConform = selectedState.selectAllChildren === newValue; + if (doesNodeConform || !isNodeSelectable) { + selectedState.toggledNodes.delete(nextNode.id); + return; + } + const newState = { + selectAllChildren: newValue, + toggledNodes: /* @__PURE__ */ new Map() + }; + selectedState.toggledNodes.set(nextNode.id, newState); + return; + } + const doesStateAlreadyExist = selectedState.toggledNodes.has(nextNode.id); + const childState = selectedState.toggledNodes.get(nextNode.id) ?? { + selectAllChildren: selectedState.selectAllChildren, + toggledNodes: /* @__PURE__ */ new Map() + }; + if (!doesStateAlreadyExist) { + selectedState.toggledNodes.set(nextNode.id, childState); + } + this.recursivelySelectNode(nodes, childState, newValue); + if (selectedState.selectAllChildren === childState.selectAllChildren && childState.toggledNodes.size === 0) { + selectedState.toggledNodes.delete(nextNode.id); + } + } + getSelectedNodes(nullWhenSelectAll = false) { + _warn49(202); + if (this.selectedState.selectAllChildren && nullWhenSelectAll) { + return null; + } + const selectedNodes = []; + this.rowModel.forEachNode((node) => { + if (node.isSelected()) { + selectedNodes.push(node); + } + }); + return selectedNodes; + } + processNewRow() { + } + getSelectedRows() { + return this.getSelectedNodes()?.map((node) => node.data) ?? []; + } + getSelectionCount() { + return -1; + } + isEmpty() { + return !this.selectedState.selectAllChildren && !this.selectedState.toggledNodes?.size; + } + selectAllRowNodes() { + this.reset(true); + } + deselectAllRowNodes() { + this.reset(false); + } + reset(selectAllChildren2) { + this.selectedState = { selectAllChildren: selectAllChildren2, toggledNodes: /* @__PURE__ */ new Map() }; + } + getSelectAllState() { + if (this.selectedState.selectAllChildren) { + if (this.selectedState.toggledNodes.size > 0) { + return null; + } + return true; + } + if (this.selectedState.toggledNodes.size > 0) { + return null; + } + return false; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/serverSideSelectionService.ts +var ServerSideSelectionService = class extends BaseSelectionService { + constructor() { + super(...arguments); + this.beanName = "selectionSvc"; + } + postConstruct() { + super.postConstruct(); + this.addManagedPropertyListeners(["groupSelectsChildren", "rowSelection"], () => { + const groupSelectsChildren2 = _getGroupSelectsDescendants(this.gos); + const Strategy2 = groupSelectsChildren2 && this.selectionStrategy instanceof DefaultStrategy ? GroupSelectsChildrenStrategy : !groupSelectsChildren2 && this.selectionStrategy instanceof GroupSelectsChildrenStrategy ? DefaultStrategy : void 0; + if (Strategy2) { + this.destroyBean(this.selectionStrategy); + this.selectionStrategy = this.createManagedBean(new Strategy2(this.selectionCtx)); + this.shotgunResetNodeSelectionState(); + this.dispatchSelectionChanged("api"); + } + }); + this.addManagedPropertyListeners(["rowSelection"], () => { + const rowSelection = _getRowSelectionMode(this.gos); + if (rowSelection !== this.selectionMode) { + this.selectionMode = rowSelection; + this.deselectAllRowNodes({ source: "api" }); + } + }); + this.selectionMode = _getRowSelectionMode(this.gos); + const groupSelectsChildren = _getGroupSelectsDescendants(this.gos); + const Strategy = !groupSelectsChildren ? DefaultStrategy : GroupSelectsChildrenStrategy; + this.selectionStrategy = this.createManagedBean(new Strategy(this.selectionCtx)); + } + handleSelectionEvent(event, rowNode, source) { + if (this.isRowSelectionBlocked(rowNode)) { + return 0; + } + let updatedRows = 0; + const selection = this.inferNodeSelections(rowNode, event.shiftKey, event.metaKey || event.ctrlKey, source); + if (selection == null) { + return 0; + } + this.selectionCtx.selectAll = false; + if ("select" in selection) { + if (selection.reset) { + this.selectionStrategy.deselectAllRowNodes({ source: "api" }); + } else { + this.selectionStrategy.setNodesSelected({ nodes: selection.deselect, newValue: false, source }); + } + updatedRows = this.selectionStrategy.setNodesSelected({ nodes: selection.select, newValue: true, source }); + } else { + updatedRows = this.selectionStrategy.setNodesSelected({ + nodes: [selection.node], + newValue: selection.newValue, + clearSelection: selection.clearSelection, + event, + source + }); + } + this.shotgunResetNodeSelectionState(source); + this.dispatchSelectionChanged(source); + return updatedRows; + } + getSelectionState() { + return this.selectionStrategy.getSelectedState(); + } + setSelectionState(state, source) { + if (!_isRowSelection3(this.gos)) { + if (state) { + _warn50(132); + } + return; + } + if (Array.isArray(state)) { + return; + } + if (state) { + this.selectionStrategy.setSelectedState(state); + this.shotgunResetNodeSelectionState(); + this.dispatchSelectionChanged(source); + } else { + this.deselectAllRowNodes({ source }); + } + } + setNodesSelected(params) { + if (!_isRowSelection3(this.gos) && params.newValue) { + _warn50(132); + return 0; + } + const { nodes, ...otherParams } = params; + if (nodes.length > 1 && this.selectionMode !== "multiRow") { + _warn50(130); + return 0; + } + const adjustedParams = { + nodes: nodes.filter((node) => node.selectable), + ...otherParams + }; + if (!adjustedParams.nodes.length) { + return 0; + } + const changedNodes = this.selectionStrategy.setNodesSelected(adjustedParams); + this.shotgunResetNodeSelectionState(adjustedParams.source); + this.dispatchSelectionChanged(adjustedParams.source); + return changedNodes; + } + /** + * Deletes the selection state for a set of nodes, for use after deleting nodes via + * transaction. As this is designed for transactions, all nodes should belong to the same group. + */ + deleteSelectionStateFromParent(storeRoute, removedNodeIds) { + const stateChanged = this.selectionStrategy.deleteSelectionStateFromParent(storeRoute, removedNodeIds); + if (!stateChanged) { + return; + } + this.shotgunResetNodeSelectionState(); + this.dispatchSelectionChanged("api"); + } + shotgunResetNodeSelectionState(source) { + this.beans.rowModel.forEachNode((node) => { + if (node.stub) { + return; + } + const isNodeSelected = this.selectionStrategy.isNodeSelected(node); + if (isNodeSelected !== node.isSelected()) { + this.selectRowNode(node, isNodeSelected, void 0, source); + } + }); + } + getSelectedNodes() { + return this.selectionStrategy.getSelectedNodes() ?? []; + } + getSelectedRows() { + return this.selectionStrategy.getSelectedRows(); + } + getSelectionCount() { + return this.selectionStrategy.getSelectionCount(); + } + syncInRowNode(rowNode) { + this.selectionStrategy.processNewRow(rowNode); + const isNodeSelected = this.selectionStrategy.isNodeSelected(rowNode); + if (isNodeSelected != false && !rowNode.selectable) { + this.selectionStrategy.setNodesSelected({ + nodes: [rowNode], + newValue: false, + source: "api" + }); + this.shotgunResetNodeSelectionState(); + this.dispatchSelectionChanged("api"); + return; + } + rowNode.__selected = isNodeSelected; + } + reset() { + this.selectionStrategy.deselectAllRowNodes({ source: "api" }); + this.selectionCtx.reset(); + } + isEmpty() { + return this.selectionStrategy.isEmpty(); + } + hasNodesToSelect() { + return true; + } + selectAllRowNodes(params) { + if (!_isRowSelection3(this.gos)) { + _warn50(132); + return; + } + validateSelectionParameters(params); + if (_isUsingNewRowSelectionAPI2(this.gos) && !_isMultiRowSelection3(this.gos)) { + return _warn50(130); + } + this.selectionStrategy.selectAllRowNodes(params); + this.selectionCtx.selectAll = true; + this.beans.rowModel.forEachNode((node) => { + if (node.stub) { + return; + } + this.selectRowNode(node, true, void 0, params.source); + }); + this.dispatchSelectionChanged(params.source); + } + deselectAllRowNodes(params) { + validateSelectionParameters(params); + this.selectionStrategy.deselectAllRowNodes(params); + this.selectionCtx.selectAll = false; + this.beans.rowModel.forEachNode((node) => { + if (node.stub) { + return; + } + this.selectRowNode(node, false, void 0, params.source); + }); + this.dispatchSelectionChanged(params.source); + } + getSelectAllState(selectAll) { + return this.selectionStrategy.getSelectAllState(selectAll); + } + // used by CSRM + getBestCostNodeSelection() { + return _warn50(194, { method: "getBestCostNodeSelection" }); + } + /** + * Updates the selectable state for a node by invoking isRowSelectable callback. + * If the node is not selectable, it will be deselected. + * + * Callers: + * - property isRowSelectable changed + * - after grouping / treeData + */ + updateSelectable() { + if (!_isRowSelection3(this.gos)) { + return; + } + const nodesToDeselect = []; + this.beans.rowModel.forEachNode((node) => { + const rowSelectable = this.updateRowSelectable(node, true); + if (!rowSelectable && node.isSelected()) { + nodesToDeselect.push(node); + } + }); + if (nodesToDeselect.length) { + this.setNodesSelected({ + nodes: nodesToDeselect, + newValue: false, + source: "selectableChanged" + }); + } + } + dispatchSelectionChanged(source) { + this.eventSvc.dispatchEvent({ + type: "selectionChanged", + source, + selectedNodes: this.selectionStrategy instanceof GroupSelectsChildrenStrategy ? null : this.selectionStrategy.getSelectedNodes(true, false), + serverSideState: this.getSelectionState() + }); + } + updateSelectableAfterGrouping() { + return _error8(194, { method: "updateSelectableAfterGrouping" }); + } + refreshMasterNodeState() { + } + setDetailSelectionState() { + return; + } +}; +function validateSelectionParameters({ selectAll }) { + if (selectAll === "filtered" || selectAll === "currentPage") { + _warn50(195, { justCurrentPage: selectAll === "currentPage" }); + } +} + +// packages/ag-grid-enterprise/src/serverSideRowModel/services/ssrmRowChildrenService.ts +import { BeanStub as BeanStub71 } from "ag-grid-community"; +var SsrmRowChildrenService = class extends BeanStub71 { + constructor() { + super(...arguments); + this.beanName = "rowChildrenSvc"; + } + getHasChildrenValue(rowNode) { + const isTreeData = this.gos.get("treeData"); + const isGroupFunc = this.gos.get("isServerSideGroup"); + return !rowNode.stub && !rowNode.footer && (isTreeData ? !!isGroupFunc && isGroupFunc(rowNode.data) : !!rowNode.group); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/lazyBlockLoadingService.ts +import { BeanStub as BeanStub72, _addGridCommonParams as _addGridCommonParams25, _getMaxConcurrentDatasourceRequests } from "ag-grid-community"; +var LazyBlockLoadingService = class extends BeanStub72 { + constructor() { + super(...arguments); + this.beanName = "lazyBlockLoadingSvc"; + this.outboundRequests = 0; + // a map of caches to loading nodes + this.cacheLoadingNodesMap = /* @__PURE__ */ new Map(); + // if a check is queued to happen this cycle + this.isCheckQueued = false; + // this is cached for blockLoadDebounce + this.nextBlockToLoad = void 0; + } + wireBeans(beans) { + this.rowRenderer = beans.rowRenderer; + this.rowModel = beans.rowModel; + } + postConstruct() { + this.maxOutboundRequests = _getMaxConcurrentDatasourceRequests(this.gos); + } + subscribe(cache) { + this.cacheLoadingNodesMap.set(cache, /* @__PURE__ */ new Set()); + } + unsubscribe(cache) { + this.cacheLoadingNodesMap.delete(cache); + } + /** + * Queues a microtask to check if any blocks need to be loaded. + */ + queueLoadCheck() { + if (this.isCheckQueued) { + return; + } + this.isCheckQueued = true; + setTimeout(() => { + this.queueLoadAction(); + this.isCheckQueued = false; + }); + } + onLoadComplete() { + this.outboundRequests -= 1; + this.queueLoadCheck(); + } + hasAvailableLoadBandwidth() { + if (this.maxOutboundRequests === void 0) { + return true; + } + return this.outboundRequests < this.maxOutboundRequests; + } + queueLoadAction() { + const nextBlockToLoad = this.getBlockToLoad(); + if (!nextBlockToLoad) { + return; + } + const isSameBlock = this.nextBlockToLoad && this.nextBlockToLoad.cache === nextBlockToLoad.cache && this.nextBlockToLoad.index === nextBlockToLoad.index; + if (isSameBlock) { + return; + } + if (!this.nextBlockToLoad || !isSameBlock) { + this.nextBlockToLoad = nextBlockToLoad; + window.clearTimeout(this.loaderTimeout); + const startRow = Number(this.nextBlockToLoad.index); + const cache = this.nextBlockToLoad.cache; + const endRow = nextBlockToLoad.index + nextBlockToLoad.cache.getBlockSize(); + this.loaderTimeout = window.setTimeout(() => { + if (!cache.isAlive()) { + return; + } + this.loaderTimeout = void 0; + this.attemptLoad(cache, startRow, endRow); + this.nextBlockToLoad = void 0; + }, this.gos.get("blockLoadDebounceMillis")); + } + } + attemptLoad(cache, start, end) { + const hasBandwidth = this.hasAvailableLoadBandwidth(); + if (!hasBandwidth) { + return; + } + this.executeLoad(cache, start, end); + this.queueLoadCheck(); + } + executeLoad(cache, startRow, endRow) { + const ssrmParams = cache.getSsrmParams(); + const request = { + startRow, + endRow, + rowGroupCols: ssrmParams.rowGroupCols, + valueCols: ssrmParams.valueCols, + pivotCols: ssrmParams.pivotCols, + pivotMode: ssrmParams.pivotMode, + groupKeys: cache.store.getParentNode().getRoute() ?? [], + filterModel: ssrmParams.filterModel, + sortModel: ssrmParams.sortModel + }; + const loadingNodes = this.cacheLoadingNodesMap.get(cache); + const removeNodesFromLoadingMap = () => { + for (let i = 0; i < endRow - startRow; i++) { + loadingNodes.delete(startRow + i); + } + }; + const addNodesToLoadingMap = () => { + for (let i = 0; i < endRow - startRow; i++) { + loadingNodes.add(startRow + i); + } + }; + const success = (params2) => { + this.onLoadComplete(); + cache.onLoadSuccess(startRow, endRow - startRow, params2); + removeNodesFromLoadingMap(); + }; + const fail = () => { + this.onLoadComplete(); + cache.onLoadFailed(startRow, endRow - startRow); + removeNodesFromLoadingMap(); + }; + const params = _addGridCommonParams25(this.gos, { + request, + success, + fail, + parentNode: cache.store.getParentNode() + }); + addNodesToLoadingMap(); + this.outboundRequests += 1; + cache.getSsrmParams().datasource?.getRows(params); + } + getBlockToLoad() { + const firstRowInViewport = this.rowRenderer.firstRenderedRow; + const lastRowInViewport = this.rowRenderer.lastRenderedRow; + for (let i = firstRowInViewport; i <= lastRowInViewport; i++) { + const row = this.rowModel.getRow(i); + if (!row) { + continue; + } + const store = row.parent?.childStore; + if (!store) { + continue; + } + const cache = store.getCache(); + const lazyNode = cache.getNodes().getBy("node", row); + if (!lazyNode) { + continue; + } + const loadingNodes = this.cacheLoadingNodesMap.get(cache); + if (loadingNodes?.has(lazyNode.index)) { + continue; + } + if (row.__needsRefreshWhenVisible || row.stub && !row.failedLoad) { + return { + cache, + index: cache.getBlockStartIndex(lazyNode.index) + }; + } + } + let cacheToRefresh = null; + let nodeToRefresh = null; + let nodeToRefreshDist = Number.MAX_SAFE_INTEGER; + for (const cache of this.cacheLoadingNodesMap.keys()) { + const nodesToRefresh = cache.getNodesToRefresh(); + nodesToRefresh.forEach((node) => { + if (node.rowIndex == null) { + nodeToRefresh = node; + cacheToRefresh = cache; + return; + } + const lazyNode = cache.getNodes().getBy("node", node); + if (!lazyNode) { + return; + } + const loadingNodes = this.cacheLoadingNodesMap.get(cache); + if (loadingNodes?.has(lazyNode.index)) { + return; + } + const distToViewportTop = Math.abs(firstRowInViewport - node.rowIndex); + const distToViewportBottom = Math.abs(node.rowIndex - lastRowInViewport); + if (distToViewportTop < nodeToRefreshDist) { + nodeToRefresh = node; + nodeToRefreshDist = distToViewportTop; + cacheToRefresh = cache; + } + if (distToViewportBottom < nodeToRefreshDist) { + nodeToRefresh = node; + nodeToRefreshDist = distToViewportBottom; + cacheToRefresh = cache; + } + }); + } + if (!cacheToRefresh) { + return void 0; + } + const lazyCache = cacheToRefresh; + const lazyIndex = lazyCache.getNodes().getBy("node", nodeToRefresh)?.index; + return lazyIndex == null ? void 0 : { + cache: lazyCache, + index: lazyCache.getBlockStartIndex(lazyIndex) + }; + } + isRowLoading(cache, index) { + return this.cacheLoadingNodesMap.get(cache)?.has(index) ?? false; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/storeFactory.ts +import { BeanStub as BeanStub75, _warn as _warn53 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/lazyStore.ts +import { + BeanStub as BeanStub74, + ServerSideTransactionResultStatus, + _getGroupTotalRowCallback as _getGroupTotalRowCallback4, + _getRowHeightAsNumber as _getRowHeightAsNumber5, + _getRowIdCallback as _getRowIdCallback3, + _warn as _warn52 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/lazyCache.ts +import { BeanStub as BeanStub73, _getRowHeightAsNumber as _getRowHeightAsNumber4, _getRowIdCallback as _getRowIdCallback2, _warn as _warn51 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/multiIndexMap.ts +var MultiIndexMap = class { + constructor(...indexes) { + this.indexes = indexes; + this.maps = new Map(this.indexes.map((index) => [index, /* @__PURE__ */ new Map()])); + } + getSize() { + return this.maps.get(this.indexes[0]).size; + } + getBy(index, key) { + const map = this.maps.get(index); + return map.get(key); + } + set(item) { + for (const index of this.indexes) { + const map = this.maps.get(index); + map.set(item[index], item); + } + } + delete(item) { + for (const index of this.indexes) { + const map = this.maps.get(index); + map.delete(item[index]); + } + } + clear() { + this.maps.forEach((map) => map.clear()); + } + getIterator(index) { + const map = this.maps.get(index); + return map.values(); + } + forEach(callback) { + const iterator = this.getIterator(this.indexes[0]); + let pointer; + while (pointer = iterator.next()) { + if (pointer.done) { + break; + } + callback(pointer.value); + } + } + find(callback) { + const iterator = this.getIterator(this.indexes[0]); + let pointer; + while (pointer = iterator.next()) { + if (pointer.done) { + break; + } + if (callback(pointer.value)) { + return pointer.value; + } + } + } + filter(predicate) { + const iterator = this.getIterator(this.indexes[0]); + let pointer; + const result = []; + while (pointer = iterator.next()) { + if (pointer.done) { + break; + } + if (predicate(pointer.value)) { + result.push(pointer.value); + } + } + return result; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/lazyCache.ts +var DEFAULT_BLOCK_SIZE = 100; +var LazyCache = class extends BeanStub73 { + constructor(store, numberOfRows, isLastRowKnown, storeParams) { + super(); + /** + * Indicates whether this is still the live dataset for this store (used for ignoring old requests after purge) + */ + this.live = true; + /** + * A cache of removed group nodes, this is retained for preserving group + * state when the node moves in and out of the cache. Generally caused by + * rows moving blocks. + */ + this.removedNodeCache = /* @__PURE__ */ new Map(); + this.store = store; + this.numberOfRows = numberOfRows; + this.isLastRowKnown = isLastRowKnown; + this.storeParams = storeParams; + } + wireBeans(beans) { + this.rowRenderer = beans.rowRenderer; + this.blockUtils = beans.ssrmBlockUtils; + this.focusSvc = beans.focusSvc; + this.nodeManager = beans.ssrmNodeManager; + this.serverSideRowModel = beans.rowModel; + this.rowNodeSorter = beans.rowNodeSorter; + this.sortSvc = beans.sortSvc; + this.lazyBlockLoadingSvc = beans.lazyBlockLoadingSvc; + this.colModel = beans.colModel; + } + postConstruct() { + this.lazyBlockLoadingSvc.subscribe(this); + this.nodeMap = new MultiIndexMap("index", "id", "node"); + this.nodeDisplayIndexMap = /* @__PURE__ */ new Map(); + this.nodesToRefresh = /* @__PURE__ */ new Set(); + const { blockUtils, gos, store } = this; + this.defaultNodeIdPrefix = blockUtils.createNodeIdPrefix(store.getParentNode()); + this.getRowIdFunc = _getRowIdCallback2(gos); + this.isMasterDetail = gos.get("masterDetail"); + } + destroy() { + this.lazyBlockLoadingSvc.unsubscribe(this); + this.numberOfRows = 0; + this.nodeMap.forEach((node) => this.blockUtils.destroyRowNode(node.node)); + this.nodeMap.clear(); + this.nodeDisplayIndexMap.clear(); + this.nodesToRefresh.clear(); + this.live = false; + super.destroy(); + } + /** + * Get the row node for a specific display index from this store + * @param displayIndex the display index of the node to find + * @returns undefined if the node is not in the store bounds, otherwise will always return a node + */ + getRowByDisplayIndex(displayIndex) { + if (!this.store.isDisplayIndexInStore(displayIndex)) { + return void 0; + } + const node = this.nodeDisplayIndexMap.get(displayIndex); + if (node) { + if (node.stub || node.__needsRefreshWhenVisible) { + this.lazyBlockLoadingSvc.queueLoadCheck(); + } + return node; + } + const hideOpenGroups = this.gos.get("groupHideOpenParents") || this.gos.get("groupAllowUnbalanced"); + if (hideOpenGroups) { + const nextParent = this.nodeMap.find( + (lazyNode) => !!lazyNode.node.childStore?.isDisplayIndexInStore(displayIndex) + ); + if (nextParent) { + return nextParent.node.childStore?.getRowUsingDisplayIndex(displayIndex); + } + } + if (displayIndex === this.store.getDisplayIndexStart()) { + return this.createStubNode(0, displayIndex); + } + const contiguouslyPreviousNode = this.nodeDisplayIndexMap.get(displayIndex - 1); + if (contiguouslyPreviousNode) { + if (this.isMasterDetail && contiguouslyPreviousNode.master && contiguouslyPreviousNode.expanded) { + return contiguouslyPreviousNode.detailNode; + } + if (contiguouslyPreviousNode.expanded && contiguouslyPreviousNode.childStore?.isDisplayIndexInStore(displayIndex)) { + return contiguouslyPreviousNode.childStore?.getRowUsingDisplayIndex( + displayIndex + ); + } + const lazyCacheNode = this.nodeMap.getBy("node", contiguouslyPreviousNode); + return this.createStubNode(lazyCacheNode.index + 1, displayIndex); + } + const adjacentNodes = this.getSurroundingNodesByDisplayIndex(displayIndex); + if (adjacentNodes == null) { + const storeIndexFromEndIndex2 = this.store.getRowCount() - (this.store.getDisplayIndexEnd() - displayIndex); + return this.createStubNode(storeIndexFromEndIndex2, displayIndex); + } + const { previousNode, nextNode } = adjacentNodes; + if (previousNode?.node.expanded && previousNode.node.childStore?.isDisplayIndexInStore(displayIndex)) { + return previousNode.node.childStore?.getRowUsingDisplayIndex(displayIndex); + } + if (nextNode) { + const displayIndexDiff = nextNode.node.rowIndex - displayIndex; + const newStoreIndex = nextNode.index - displayIndexDiff; + return this.createStubNode(newStoreIndex, displayIndex); + } + const storeIndexFromEndIndex = this.store.getRowCount() - (this.store.getDisplayIndexEnd() - displayIndex); + return this.createStubNode(storeIndexFromEndIndex, displayIndex); + } + /** + * Used for creating and positioning a stub node without firing a store updated event + */ + createStubNode(storeIndex, displayIndex) { + const rowBounds = this.store.getRowBounds(displayIndex); + const newNode = this.createRowAtIndex(storeIndex, null, (node) => { + node.setRowIndex(displayIndex); + node.setRowTop(rowBounds.rowTop); + this.nodeDisplayIndexMap.set(displayIndex, node); + }); + if (storeIndex === 0 && this.gos.get("groupHideOpenParents")) { + const parentGroupData = this.store.getParentNode().groupData; + if (parentGroupData) { + for (const key of Object.keys(parentGroupData)) { + setRowNodeGroupValue(newNode, this.colModel, key, parentGroupData[key]); + } + } + } + this.lazyBlockLoadingSvc.queueLoadCheck(); + return newNode; + } + /** + * @param index The row index relative to this store + * @returns A rowNode at the given store index + */ + getRowByStoreIndex(index) { + return this.nodeMap.getBy("index", index)?.node; + } + /** + * Given a number of rows, skips through the given sequence & row top reference (using default row height) + * @param numberOfRowsToSkip number of rows to skip over in the given sequence + * @param displayIndexSeq the sequence in which to skip + * @param nextRowTop the row top reference in which to skip + */ + skipDisplayIndexes(numberOfRowsToSkip, displayIndexSeq, nextRowTop) { + if (numberOfRowsToSkip === 0) { + return; + } + const defaultRowHeight = _getRowHeightAsNumber4(this.beans); + displayIndexSeq.value += numberOfRowsToSkip; + nextRowTop.value += numberOfRowsToSkip * defaultRowHeight; + } + /** + * @param displayIndexSeq the number sequence for generating the display index of each row + * @param nextRowTop an object containing the next row top value intended to be modified by ref per row + */ + setDisplayIndexes(displayIndexSeq, nextRowTop, uiLevel) { + this.nodeDisplayIndexMap.clear(); + const orderedMap = {}; + this.nodeMap.forEach((lazyNode) => { + orderedMap[lazyNode.index] = lazyNode.node; + }); + let lastIndex = -1; + for (const stringIndex of Object.keys(orderedMap)) { + const node = orderedMap[stringIndex]; + const numericIndex = Number(stringIndex); + const numberOfRowsToSkip2 = numericIndex - 1 - lastIndex; + this.skipDisplayIndexes(numberOfRowsToSkip2, displayIndexSeq, nextRowTop); + const isFirstChild = numericIndex === 0; + if (node.firstChild !== isFirstChild) { + node.firstChild = isFirstChild; + node.dispatchRowEvent("firstChildChanged"); + } + if (isFirstChild && this.gos.get("groupHideOpenParents")) { + const parentGroupData = this.store.getParentNode().groupData; + if (parentGroupData) { + for (const key of Object.keys(parentGroupData)) { + setRowNodeGroupValue(node, this.colModel, key, isFirstChild ? parentGroupData[key] : void 0); + } + } + } + this.blockUtils.setDisplayIndex(node, displayIndexSeq, nextRowTop, uiLevel); + if (node.rowIndex != null) { + this.nodeDisplayIndexMap.set(node.rowIndex, node); + } + lastIndex = numericIndex; + } + const numberOfRowsToSkip = this.numberOfRows - 1 - lastIndex; + this.skipDisplayIndexes(numberOfRowsToSkip, displayIndexSeq, nextRowTop); + this.purgeExcessRows(); + } + getRowCount() { + return this.numberOfRows; + } + setRowCount(rowCount, isLastRowIndexKnown) { + this.numberOfRows = rowCount; + if (isLastRowIndexKnown != null) { + this.isLastRowKnown = isLastRowIndexKnown; + if (isLastRowIndexKnown === false) { + this.numberOfRows += 1; + } + } + this.fireStoreUpdatedEvent(); + } + getNodes() { + return this.nodeMap; + } + getNodeCachedByDisplayIndex(displayIndex) { + return this.nodeDisplayIndexMap.get(displayIndex) ?? null; + } + getNodesToRefresh() { + return this.nodesToRefresh; + } + /** + * @returns the previous and next loaded row nodes surrounding the given display index + */ + getSurroundingNodesByDisplayIndex(displayIndex) { + let nextNode; + let previousNode; + this.nodeMap.forEach((lazyNode) => { + if (displayIndex > lazyNode.node.rowIndex) { + if (previousNode == null || previousNode.node.rowIndex < lazyNode.node.rowIndex) { + previousNode = lazyNode; + } + return; + } + if (nextNode == null || nextNode.node.rowIndex > lazyNode.node.rowIndex) { + nextNode = lazyNode; + } + }); + if (!previousNode && !nextNode) { + return null; + } + return { previousNode, nextNode }; + } + /** + * Get or calculate the display index for a given store index + * @param storeIndex the rows index within this store + * @returns the rows visible display index relative to the grid + */ + getDisplayIndexFromStoreIndex(storeIndex) { + const nodeAtIndex = this.nodeMap.getBy("index", storeIndex); + if (nodeAtIndex) { + return nodeAtIndex.node.rowIndex; + } + let nextNode; + let previousNode; + this.nodeMap.forEach((lazyNode) => { + if (storeIndex > lazyNode.index) { + if (previousNode == null || previousNode.index < lazyNode.index) { + previousNode = lazyNode; + } + return; + } + if (nextNode == null || nextNode.index > lazyNode.index) { + nextNode = lazyNode; + } + }); + if (!nextNode) { + return this.store.getDisplayIndexEnd() - (this.numberOfRows - storeIndex); + } + if (!previousNode) { + return this.store.getDisplayIndexStart() + storeIndex; + } + const storeIndexDiff = storeIndex - previousNode.index; + const previousDisplayIndex = previousNode.node.childStore?.getDisplayIndexEnd() ?? previousNode.node.rowIndex; + return previousDisplayIndex + storeIndexDiff; + } + /** + * Creates a new row and inserts it at the given index + * @param atStoreIndex the node index relative to this store + * @param data the data object to populate the node with + * @returns the new row node + */ + createRowAtIndex(atStoreIndex, data, createNodeCallback) { + const lazyNode = this.nodeMap.getBy("index", atStoreIndex); + if (lazyNode) { + const { node } = lazyNode; + node.__needsRefreshWhenVisible = false; + if (this.doesNodeMatch(data, node)) { + this.blockUtils.updateDataIntoRowNode(node, data); + this.nodesToRefresh.delete(node); + return node; + } + if (this.getRowIdFunc == null && node.hasChildren() && node.expanded) { + this.nodesToRefresh.delete(node); + return node; + } + this.destroyRowAtIndex(atStoreIndex); + } + if (data && this.getRowIdFunc != null) { + const id = this.getRowId(data); + const deletedNode = id && this.removedNodeCache?.get(id); + if (deletedNode) { + this.removedNodeCache?.delete(id); + this.blockUtils.updateDataIntoRowNode(deletedNode, data); + this.nodeMap.set({ + id: deletedNode.id, + node: deletedNode, + index: atStoreIndex + }); + this.nodesToRefresh.delete(deletedNode); + deletedNode.__needsRefreshWhenVisible = false; + return deletedNode; + } + const lazyNode2 = this.nodeMap.getBy("id", id); + if (lazyNode2) { + this.nodeMap.delete(lazyNode2); + const { node, index } = lazyNode2; + this.blockUtils.updateDataIntoRowNode(node, data); + this.nodeMap.set({ + id: node.id, + node, + index: atStoreIndex + }); + this.nodesToRefresh.delete(node); + node.__needsRefreshWhenVisible = false; + if (this.getBlockStartIndex(index) === this.getBlockStartIndex(atStoreIndex)) { + return node; + } + this.markBlockForVerify(index); + return node; + } + } + const newNode = this.blockUtils.createRowNode(this.store.getRowDetails()); + if (data != null) { + const defaultId = this.getPrefixedId(this.store.getIdSequence().value++); + this.blockUtils.setDataIntoRowNode(newNode, data, defaultId, void 0); + this.blockUtils.checkOpenByDefault(newNode); + this.nodeManager.addRowNode(newNode); + } + this.nodeMap.set({ + id: newNode.id, + node: newNode, + index: atStoreIndex + }); + if (createNodeCallback) { + createNodeCallback(newNode); + } + return newNode; + } + getBlockStates() { + const blockCounts = {}; + const blockStates = {}; + this.nodeMap.forEach(({ node, index }) => { + const blockStart = this.getBlockStartIndex(index); + if (!node.stub && !node.failedLoad) { + blockCounts[blockStart] = (blockCounts[blockStart] ?? 0) + 1; + } + let rowState = "loaded"; + if (node.failedLoad) { + rowState = "failed"; + } else if (this.lazyBlockLoadingSvc.isRowLoading(this, blockStart)) { + rowState = "loading"; + } else if (this.nodesToRefresh.has(node) || node.stub) { + rowState = "needsLoading"; + } + if (!blockStates[blockStart]) { + blockStates[blockStart] = /* @__PURE__ */ new Set(); + } + blockStates[blockStart].add(rowState); + }); + const statePriorityMap = { + loading: 4, + failed: 3, + needsLoading: 2, + loaded: 1 + }; + const blockPrefix = this.blockUtils.createNodeIdPrefix(this.store.getParentNode()); + const results = {}; + for (const blockStart of Object.keys(blockStates)) { + const sortedStates = [...blockStates[blockStart]].sort( + (a, b) => (statePriorityMap[a] ?? 0) - (statePriorityMap[b] ?? 0) + ); + const priorityState = sortedStates[0]; + const blockNumber = Number(blockStart) / this.getBlockSize(); + const blockId = blockPrefix ? `${blockPrefix}-${blockNumber}` : String(blockNumber); + results[blockId] = { + blockNumber, + startRow: Number(blockStart), + endRow: Number(blockStart) + this.getBlockSize(), + pageStatus: priorityState, + loadedRowCount: blockCounts[blockStart] ?? 0 + }; + } + return results; + } + destroyRowAtIndex(atStoreIndex) { + const lazyNode = this.nodeMap.getBy("index", atStoreIndex); + if (!lazyNode) { + return; + } + this.nodeMap.delete(lazyNode); + this.nodeDisplayIndexMap.delete(lazyNode.node.rowIndex); + if (this.nodesToRefresh.size > 0) { + this.removedNodeCache.set(lazyNode.node.id, lazyNode.node); + } else { + this.blockUtils.destroyRowNode(lazyNode.node); + } + this.nodesToRefresh.delete(lazyNode.node); + } + getSsrmParams() { + return this.store.getSsrmParams(); + } + /** + * @param id the base id to be prefixed + * @returns a node id with prefix if required + */ + getPrefixedId(id) { + if (this.defaultNodeIdPrefix) { + return this.defaultNodeIdPrefix + "-" + id; + } else { + return id.toString(); + } + } + markBlockForVerify(rowIndex) { + const [start, end] = this.getBlockBounds(rowIndex); + const lazyNodesInRange = this.nodeMap.filter((lazyNode) => lazyNode.index >= start && lazyNode.index < end); + lazyNodesInRange.forEach(({ node }) => { + node.__needsRefreshWhenVisible = true; + }); + } + doesNodeMatch(data, node) { + if (node.stub) { + return false; + } + const id = this.getRowId(data); + return id === null ? node.data === data : node.id === id; + } + /** + * Deletes any stub nodes not within the given range + */ + purgeStubsOutsideOfViewport() { + const { firstRenderedRow, lastRenderedRow } = this.rowRenderer; + const firstRowBlockStart = this.getBlockStartIndex(firstRenderedRow); + const [, lastRowBlockEnd] = this.getBlockBounds(lastRenderedRow); + this.nodeMap.forEach((lazyNode) => { + if (this.lazyBlockLoadingSvc.isRowLoading(this, lazyNode.index) || lazyNode.node.failedLoad) { + return; + } + if (lazyNode.node.stub && (lazyNode.index < firstRowBlockStart || lazyNode.index > lastRowBlockEnd)) { + this.destroyRowAtIndex(lazyNode.index); + } + }); + } + getBlocksDistanceFromRow(nodes, otherDisplayIndex) { + const blockDistanceToMiddle = {}; + nodes.forEach(({ node, index }) => { + const [blockStart, blockEnd] = this.getBlockBounds(index); + if (blockStart in blockDistanceToMiddle) { + return; + } + const distStart = Math.abs(node.rowIndex - otherDisplayIndex); + let distEnd; + const lastLazyNode = this.nodeMap.getBy("index", [blockEnd - 1]); + if (lastLazyNode) { + distEnd = Math.abs(lastLazyNode.node.rowIndex - otherDisplayIndex); + } + const farthest = distEnd == null || distStart < distEnd ? distStart : distEnd; + blockDistanceToMiddle[blockStart] = farthest; + }); + return Object.entries(blockDistanceToMiddle); + } + purgeExcessRows() { + this.purgeStubsOutsideOfViewport(); + if (this.store.getDisplayIndexEnd() == null || this.storeParams.maxBlocksInCache == null) { + return; + } + const { firstRenderedRow, lastRenderedRow } = this.rowRenderer; + const allLoadedBlocks = /* @__PURE__ */ new Set(); + const blocksInViewport = /* @__PURE__ */ new Set(); + this.nodeMap.forEach(({ index, node }) => { + const blockStart = this.getBlockStartIndex(index); + allLoadedBlocks.add(blockStart); + const isInViewport = node.rowIndex >= firstRenderedRow && node.rowIndex <= lastRenderedRow; + if (isInViewport) { + blocksInViewport.add(blockStart); + } + }); + const numberOfBlocksToRetain = Math.max(blocksInViewport.size, this.storeParams.maxBlocksInCache ?? 0); + const loadedBlockCount = allLoadedBlocks.size; + const blocksToRemove = loadedBlockCount - numberOfBlocksToRetain; + if (blocksToRemove <= 0) { + return; + } + let firstRowBlockStart = Number.MAX_SAFE_INTEGER; + let lastRowBlockStart = Number.MIN_SAFE_INTEGER; + blocksInViewport.forEach((blockStart) => { + if (firstRowBlockStart > blockStart) { + firstRowBlockStart = blockStart; + } + if (lastRowBlockStart < blockStart) { + lastRowBlockStart = blockStart; + } + }); + const disposableNodes = this.nodeMap.filter(({ node, index }) => { + const rowBlockStart = this.getBlockStartIndex(index); + const rowBlockInViewport = rowBlockStart >= firstRowBlockStart && rowBlockStart <= lastRowBlockStart; + return !rowBlockInViewport && !this.isNodeCached(node); + }); + if (disposableNodes.length === 0) { + return; + } + const midViewportRow = firstRenderedRow + (lastRenderedRow - firstRenderedRow) / 2; + const blockDistanceArray = this.getBlocksDistanceFromRow(disposableNodes, midViewportRow); + const blockSize = this.getBlockSize(); + blockDistanceArray.sort((a, b) => Math.sign(b[1] - a[1])); + for (let i = 0; i < Math.min(blocksToRemove, blockDistanceArray.length); i++) { + const blockStart = Number(blockDistanceArray[i][0]); + for (let x = blockStart; x < blockStart + blockSize; x++) { + const lazyNode = this.nodeMap.getBy("index", x); + if (!lazyNode || this.isNodeCached(lazyNode.node)) { + continue; + } + this.destroyRowAtIndex(x); + } + } + } + isNodeFocused(node) { + const focusedCell = this.focusSvc.getFocusCellToUseAfterRefresh(); + if (!focusedCell) { + return false; + } + if (focusedCell.rowPinned != null) { + return false; + } + const hasFocus = focusedCell.rowIndex === node.rowIndex; + return hasFocus; + } + isNodeCached(node) { + const isExpandedGroup = node.isExpandable() && node.expanded; + const isUnbalancedNode = this.gos.get("groupAllowUnbalanced") && node.key === ""; + const isEditing = !!this.beans.editSvc?.isRowEditing(node); + return isExpandedGroup || this.isNodeFocused(node) || isUnbalancedNode || isEditing; + } + extractDuplicateIds(rows) { + if (this.getRowIdFunc == null) { + return []; + } + const newIds = /* @__PURE__ */ new Set(); + const duplicates = /* @__PURE__ */ new Set(); + rows.forEach((data) => { + const id = this.getRowId(data); + if (newIds.has(id)) { + duplicates.add(id); + return; + } + newIds.add(id); + }); + return [...duplicates]; + } + onLoadSuccess(firstRowIndex, numberOfRowsExpected, response) { + if (!this.live) { + return; + } + const info = response.groupLevelInfo; + this.store.setStoreInfo(info); + if (this.getRowIdFunc != null) { + const duplicates = this.extractDuplicateIds(response.rowData); + if (duplicates.length > 0) { + const duplicateIdText = duplicates.join(", "); + _warn51(205, { duplicateIdText }); + this.onLoadFailed(firstRowIndex, numberOfRowsExpected); + return; + } + } + if (response.pivotResultFields) { + this.serverSideRowModel.generateSecondaryColumns(response.pivotResultFields); + } + const wasRefreshing = this.nodesToRefresh.size > 0; + response.rowData.forEach((data, responseRowIndex) => { + const rowIndex = firstRowIndex + responseRowIndex; + const nodeFromCache = this.nodeMap.getBy("index", rowIndex); + if (nodeFromCache?.node?.stub) { + this.createRowAtIndex(rowIndex, data); + return; + } + if (nodeFromCache && this.doesNodeMatch(data, nodeFromCache.node)) { + this.blockUtils.updateDataIntoRowNode(nodeFromCache.node, data); + this.nodesToRefresh.delete(nodeFromCache.node); + nodeFromCache.node.__needsRefreshWhenVisible = false; + return; + } + this.createRowAtIndex(rowIndex, data); + }); + if (response.rowCount != void 0 && response.rowCount !== -1) { + this.numberOfRows = response.rowCount; + this.isLastRowKnown = true; + } else if (numberOfRowsExpected > response.rowData.length) { + this.numberOfRows = firstRowIndex + response.rowData.length; + this.isLastRowKnown = true; + } else if (!this.isLastRowKnown) { + const lastInferredRow = firstRowIndex + response.rowData.length + 1; + if (lastInferredRow > this.numberOfRows) { + this.numberOfRows = lastInferredRow; + } + } + if (this.isLastRowKnown) { + const lazyNodesAfterStoreEnd = this.nodeMap.filter((lazyNode) => lazyNode.index >= this.numberOfRows); + lazyNodesAfterStoreEnd.forEach((lazyNode) => this.destroyRowAtIndex(lazyNode.index)); + } + this.fireStoreUpdatedEvent(); + const finishedRefreshing = this.nodesToRefresh.size === 0; + if (wasRefreshing && finishedRefreshing) { + this.fireRefreshFinishedEvent(); + } + } + fireRefreshFinishedEvent() { + const finishedRefreshing = this.nodesToRefresh.size === 0; + if (!finishedRefreshing) { + return; + } + this.removedNodeCache.forEach((node) => { + this.blockUtils.destroyRowNode(node); + }); + this.removedNodeCache = /* @__PURE__ */ new Map(); + this.store.fireRefreshFinishedEvent(); + } + /** + * @returns true if all rows are loaded + */ + isStoreFullyLoaded() { + const knowsSize = this.isLastRowKnown; + const hasCorrectRowCount = this.nodeMap.getSize() === this.numberOfRows; + if (!knowsSize || !hasCorrectRowCount) { + return; + } + if (this.nodesToRefresh.size > 0) { + return; + } + let index = -1; + const firstOutOfPlaceNode = this.nodeMap.find((lazyNode) => { + index += 1; + if (lazyNode.index !== index) { + return true; + } + if (lazyNode.node.__needsRefreshWhenVisible) { + return true; + } + if (lazyNode.node.stub) { + return true; + } + return false; + }); + return firstOutOfPlaceNode == null; + } + isLastRowIndexKnown() { + return this.isLastRowKnown; + } + onLoadFailed(firstRowIndex, numberOfRowsExpected) { + if (!this.live) { + return; + } + const wasRefreshing = this.nodesToRefresh.size > 0; + for (let i = firstRowIndex; i < firstRowIndex + numberOfRowsExpected && i < this.getRowCount(); i++) { + let { node } = this.nodeMap.getBy("index", i) ?? {}; + if (node) { + this.nodesToRefresh.delete(node); + } + if (!node?.stub) { + if (node && !node.stub) { + this.destroyRowAtIndex(i); + } + node = this.createRowAtIndex(i); + } + node.__needsRefreshWhenVisible = false; + node.failedLoad = true; + } + const finishedRefreshing = this.nodesToRefresh.size === 0; + if (wasRefreshing && finishedRefreshing) { + this.fireRefreshFinishedEvent(); + } + this.fireStoreUpdatedEvent(); + } + markNodesForRefresh() { + this.nodeMap.forEach((lazyNode) => { + if (lazyNode.node.stub && !lazyNode.node.failedLoad) { + return; + } + this.nodesToRefresh.add(lazyNode.node); + }); + this.lazyBlockLoadingSvc.queueLoadCheck(); + if (this.isLastRowKnown && this.numberOfRows === 0) { + this.numberOfRows = 1; + this.isLastRowKnown = false; + this.fireStoreUpdatedEvent(); + } + } + isNodeInCache(id) { + return !!this.nodeMap.getBy("id", id); + } + // gets called 1) row count changed 2) cache purged 3) items inserted + fireStoreUpdatedEvent() { + if (!this.live) { + return; + } + this.store.fireStoreUpdatedEvent(); + } + getRowId(data) { + if (this.getRowIdFunc == null) { + return null; + } + const { level } = this.store.getRowDetails(); + const parentKeys = this.store.getParentNode().getRoute() ?? []; + return this.getRowIdFunc({ + data, + parentKeys: parentKeys.length > 0 ? parentKeys : void 0, + level + }); + } + getOrderedNodeMap() { + const obj = {}; + this.nodeMap.forEach((node) => obj[node.index] = node); + return obj; + } + clearDisplayIndexes() { + this.nodeDisplayIndexMap.clear(); + } + /** + * Client side sorting + */ + clientSideSortRows() { + const sortOptions = this.sortSvc?.getSortOptions() ?? []; + const isAnySort = sortOptions.some((opt) => opt.sort != null); + const rowNodeSorter = this.rowNodeSorter; + if (!isAnySort || !rowNodeSorter) { + return; + } + const allNodes = new Array(this.nodeMap.getSize()); + const nodesMap = this.nodeMap; + nodesMap.forEach((lazyNode) => allNodes[lazyNode.index] = lazyNode.node); + nodesMap.clear(); + const sortedNodes = rowNodeSorter.doFullSortInPlace(allNodes, sortOptions); + for (let i = 0, len = sortedNodes.length; i < len; ++i) { + const node = sortedNodes[i]; + nodesMap.set({ id: node.id, node, index: i }); + } + } + /** + * Transaction Support here + */ + updateRowNodes(updates) { + const updatedNodes = []; + updates.forEach((data) => { + const id = this.getRowId(data); + const lazyNode = this.nodeMap.getBy("id", id); + if (lazyNode) { + this.blockUtils.updateDataIntoRowNode(lazyNode.node, data); + updatedNodes.push(lazyNode.node); + } + }); + return updatedNodes; + } + insertRowNodes(inserts, indexToAdd) { + const realRowCount = this.store.getRowCount() - (this.store.getParentNode().sibling ? 1 : 0); + const addIndex = indexToAdd == null && this.isLastRowKnown ? realRowCount : indexToAdd; + if (addIndex == null || realRowCount < addIndex) { + return []; + } + const uniqueInsertsMap = {}; + inserts.forEach((data) => { + const dataId = this.getRowId(data); + if (dataId && this.isNodeInCache(dataId)) { + return; + } + uniqueInsertsMap[dataId] = data; + }); + const uniqueInserts = Object.values(uniqueInsertsMap); + const numberOfInserts = uniqueInserts.length; + if (numberOfInserts === 0) { + return []; + } + const nodesToMove = this.nodeMap.filter((node) => node.index >= addIndex); + nodesToMove.forEach((lazyNode) => this.nodeMap.delete(lazyNode)); + nodesToMove.forEach((lazyNode) => { + this.nodeMap.set({ + node: lazyNode.node, + index: lazyNode.index + numberOfInserts, + id: lazyNode.id + }); + }); + this.numberOfRows += numberOfInserts; + return uniqueInserts.map( + (data, uniqueInsertOffset) => this.createRowAtIndex(addIndex + uniqueInsertOffset, data) + ); + } + removeRowNodes(idsToRemove, newRowCount) { + const removedNodes = []; + const nodesToVerify = []; + let deletedNodeCount = 0; + const remainingIdsToRemove = [...idsToRemove]; + const allNodes = this.getOrderedNodeMap(); + let contiguousIndex = -1; + for (const stringIndex of Object.keys(allNodes)) { + contiguousIndex += 1; + const node = allNodes[stringIndex]; + const matchIndex = remainingIdsToRemove.findIndex((idToRemove) => idToRemove === node.id); + if (matchIndex !== -1) { + remainingIdsToRemove.splice(matchIndex, 1); + this.destroyRowAtIndex(Number(stringIndex)); + removedNodes.push(node.node); + deletedNodeCount += 1; + continue; + } + if (deletedNodeCount === 0) { + continue; + } + const numericStoreIndex = Number(stringIndex); + if (contiguousIndex !== numericStoreIndex) { + nodesToVerify.push(node.node); + } + this.nodeMap.delete(node); + this.nodeMap.set({ + id: node.id, + node: node.node, + index: numericStoreIndex - deletedNodeCount + }); + } + const isNewRowCountValid = newRowCount != null && newRowCount >= 0; + if (isNewRowCountValid) { + this.numberOfRows = newRowCount; + this.isLastRowKnown = true; + } else { + this.numberOfRows -= deletedNodeCount; + } + if (remainingIdsToRemove.length > 0 && nodesToVerify.length > 0) { + nodesToVerify.forEach((node) => node.__needsRefreshWhenVisible = true); + this.lazyBlockLoadingSvc.queueLoadCheck(); + } + return removedNodes; + } + /** + * Return the block size configured for this cache + */ + getBlockSize() { + return this.storeParams.cacheBlockSize || DEFAULT_BLOCK_SIZE; + } + /** + * Get the start index of the loading block for a given index + */ + getBlockStartIndex(storeIndex) { + const blockSize = this.getBlockSize(); + return storeIndex - storeIndex % blockSize; + } + /** + * Get the start and end index of a block, given a row store index + */ + getBlockBounds(storeIndex) { + const startOfBlock = this.getBlockStartIndex(storeIndex); + const blockSize = this.getBlockSize(); + return [startOfBlock, startOfBlock + blockSize]; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/lazy/lazyStore.ts +var LazyStore = class extends BeanStub74 { + constructor(ssrmParams, storeParams, parentRowNode) { + super(); + this.idSequence = { value: 0 }; + this.ssrmParams = ssrmParams; + this.parentRowNode = parentRowNode; + this.storeParams = storeParams; + this.level = parentRowNode.level + 1; + this.group = ssrmParams.rowGroupCols ? this.level < ssrmParams.rowGroupCols.length : false; + this.leafGroup = ssrmParams.rowGroupCols ? this.level === ssrmParams.rowGroupCols.length - 1 : false; + this.info = {}; + } + wireBeans(beans) { + this.blockUtils = beans.ssrmBlockUtils; + this.storeUtils = beans.ssrmStoreUtils; + this.selectionSvc = beans.selectionSvc; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + } + postConstruct() { + let numberOfRows = 1; + if (this.level === 0) { + numberOfRows = this.storeUtils.getServerSideInitialRowCount() ?? 1; + this.eventSvc.dispatchEventOnce({ + type: "rowCountReady" + }); + } + this.cache = this.createManagedBean(new LazyCache(this, numberOfRows, false, this.storeParams)); + const usingTreeData = this.gos.get("treeData"); + if (!usingTreeData && this.group && this.rowGroupColsSvc) { + const groupColVo = this.ssrmParams.rowGroupCols[this.level]; + this.groupField = groupColVo.field; + this.rowGroupColumn = this.rowGroupColsSvc.columns[this.level]; + } + } + destroy() { + this.displayIndexStart = void 0; + this.displayIndexEnd = void 0; + this.destroyBean(this.cache); + super.destroy(); + } + /** + * Given a server response, ingest the rows outside of the data source lifecycle. + * + * @param rowDataParams the server response containing the rows to ingest + * @param startRow the index to start ingesting rows + * @param expectedRows the expected number of rows in the response (used to determine if the last row index is known) + */ + applyRowData(rowDataParams, startRow, expectedRows) { + this.cache.onLoadSuccess(startRow, expectedRows, rowDataParams); + } + /** + * Applies a given transaction to the data set within this store + * + * @param transaction an object containing delta instructions determining the changes to apply to this store + * @returns an object determining the status of this transaction and effected nodes + */ + applyTransaction(transaction) { + const idFunc = _getRowIdCallback3(this.gos); + if (!idFunc) { + _warn52(206); + return { + status: ServerSideTransactionResultStatus.Cancelled + }; + } + const applyCallback = this.gos.getCallback("isApplyServerSideTransaction"); + if (applyCallback) { + const params = { + transaction, + parentNode: this.parentRowNode, + groupLevelInfo: this.info + }; + const apply = applyCallback(params); + if (!apply) { + return { status: ServerSideTransactionResultStatus.Cancelled }; + } + } + const allRowsLoaded = this.cache.isStoreFullyLoaded(); + let updatedNodes = void 0; + if (transaction.update?.length) { + updatedNodes = this.cache.updateRowNodes(transaction.update); + } + let insertedNodes = void 0; + if (transaction.add?.length) { + let addIndex = transaction.addIndex; + if (addIndex != null && addIndex < 0) { + addIndex = void 0; + } + insertedNodes = this.cache.insertRowNodes(transaction.add, addIndex); + } + let removedNodes = void 0; + if (transaction.remove?.length) { + const allIdsToRemove = transaction.remove.map( + (data) => idFunc({ level: this.level, parentKeys: this.parentRowNode.getRoute() ?? [], data }) + ); + const allUniqueIdsToRemove = [...new Set(allIdsToRemove)]; + removedNodes = this.cache.removeRowNodes(allUniqueIdsToRemove, transaction.rowCount); + } + const isClientSideSortingEnabled = this.gos.get("serverSideEnableClientSideSort"); + const isUpdateOrAdd = updatedNodes?.length || insertedNodes?.length; + const isClientSideSort = allRowsLoaded && isClientSideSortingEnabled; + if (isClientSideSort && isUpdateOrAdd) { + this.cache.clientSideSortRows(); + } + this.updateSelectionAfterTransaction(updatedNodes, removedNodes); + return { + status: ServerSideTransactionResultStatus.Applied, + update: updatedNodes, + add: insertedNodes, + remove: removedNodes + }; + } + updateSelectionAfterTransaction(updatedNodes, removedNodes) { + if (!this.selectionSvc) { + return; + } + const nodesToDeselect = []; + for (const node of updatedNodes ?? []) { + if (node.isSelected() && !node.selectable) { + nodesToDeselect.push(node); + } + } + for (const node of removedNodes ?? []) { + if (node.isSelected()) { + nodesToDeselect.push(node); + } + } + if (nodesToDeselect.length) { + this.selectionSvc.setNodesSelected({ + newValue: false, + clearSelection: false, + nodes: nodesToDeselect, + source: "rowDataChanged" + }); + } + } + /** + * Clear the display indexes, used for fading rows out when stores are not being destroyed + */ + clearDisplayIndexes() { + this.displayIndexStart = void 0; + this.displayIndexEnd = void 0; + this.cache.getNodes().forEach((lazyNode) => this.blockUtils.clearDisplayIndex(lazyNode.node)); + if (this.parentRowNode.sibling) { + this.blockUtils.clearDisplayIndex(this.parentRowNode.sibling); + } + this.cache.clearDisplayIndexes(); + } + /** + * @returns an index representing the last sequentially displayed row in the grid for this store + */ + getDisplayIndexStart() { + return this.displayIndexStart; + } + /** + * @returns the index representing one after the last sequentially displayed row in the grid for this store + */ + getDisplayIndexEnd() { + return this.displayIndexEnd; + } + /** + * @returns the virtual size of this store + */ + getRowCount() { + if (this.parentRowNode.sibling) { + return this.cache.getRowCount() + 1; + } + return this.cache.getRowCount(); + } + /** + * Sets the current row count of the store, and whether the last row index is known + */ + setRowCount(rowCount, isLastRowIndexKnown) { + this.cache.setRowCount(rowCount, isLastRowIndexKnown); + } + /** + * Given a display index, returns whether that row is within this store or a child store of this store + * + * @param displayIndex the visible index of a row + * @returns whether or not the row exists within this store + */ + isDisplayIndexInStore(displayIndex) { + if (this.cache.getRowCount() === 0) { + return false; + } + return this.displayIndexStart <= displayIndex && displayIndex < this.getDisplayIndexEnd(); + } + /** + * Recursively sets up the display indexes and top position of every node belonging to this store. + * + * Called after a row height changes, or a store updated event. + * + * @param displayIndexSeq the number sequence for generating the display index of each row + * @param nextRowTop an object containing the next row top value intended to be modified by ref per row + */ + setDisplayIndexes(displayIndexSeq, nextRowTop, uiLevel) { + this.displayIndexStart = displayIndexSeq.value; + this.topPx = nextRowTop.value; + const footerNode = this.parentRowNode.level > -1 && _getGroupTotalRowCallback4(this.gos)({ node: this.parentRowNode }); + if (!footerNode) { + _destroyRowNodeFooter(this.parentRowNode); + } + if (footerNode === "top") { + _createRowNodeFooter(this.parentRowNode, this.beans); + this.blockUtils.setDisplayIndex(this.parentRowNode.sibling, displayIndexSeq, nextRowTop, uiLevel); + } + this.cache.setDisplayIndexes(displayIndexSeq, nextRowTop, uiLevel); + if (footerNode === "bottom") { + _createRowNodeFooter(this.parentRowNode, this.beans); + this.blockUtils.setDisplayIndex(this.parentRowNode.sibling, displayIndexSeq, nextRowTop, uiLevel); + } + this.displayIndexEnd = displayIndexSeq.value; + this.heightPx = nextRowTop.value - this.topPx; + } + /** + * Recursively applies a provided function to every node + * + * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeepAfterFilterAndSort + */ + forEachStoreDeep(callback, sequence = { value: 0 }) { + callback(this, sequence.value++); + this.cache.getNodes().forEach((lazyNode) => { + const childCache = lazyNode.node.childStore; + if (childCache) { + childCache.forEachStoreDeep(callback, sequence); + } + }); + } + /** + * Recursively applies a provided function to every node + * + * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeepAfterFilterAndSort + */ + forEachNodeDeep(callback, sequence = { value: 0 }) { + this.cache.getNodes().forEach((lazyNode) => { + callback(lazyNode.node, sequence.value++); + const childCache = lazyNode.node.childStore; + if (childCache) { + childCache.forEachNodeDeep(callback, sequence); + } + }); + } + /** + * Recursively applies a provided function to every node + * + * For the purpose of exclusively server side filtered stores, this is the same as getNodes().forEachDeep + */ + forEachNodeDeepAfterFilterAndSort(callback, sequence = { value: 0 }, includeFooterNodes = false) { + const footerNode = this.parentRowNode.level > -1 && _getGroupTotalRowCallback4(this.gos)({ node: this.parentRowNode }); + if (footerNode === "top") { + callback(this.parentRowNode.sibling, sequence.value++); + } + const orderedNodes = this.cache.getOrderedNodeMap(); + for (const lazyNode of Object.values(orderedNodes)) { + callback(lazyNode.node, sequence.value++); + const childCache = lazyNode.node.childStore; + if (childCache) { + childCache.forEachNodeDeepAfterFilterAndSort(callback, sequence, includeFooterNodes); + } + } + if (footerNode === "bottom") { + callback(this.parentRowNode.sibling, sequence.value++); + } + } + /** + * Removes the failed status from all nodes, and marks them as stub to encourage reloading + */ + retryLoads() { + this.cache.getNodes().forEach(({ node }) => { + if (node.failedLoad) { + node.failedLoad = false; + node.__needsRefreshWhenVisible = true; + node.stub = true; + } + }); + this.forEachChildStoreShallow((store) => store.retryLoads()); + this.fireStoreUpdatedEvent(); + } + /** + * Given a display index, returns the row at that location. + * + * @param displayRowIndex the displayed index within the grid to search for + * @returns the row node if the display index falls within the store, if it didn't exist this will create a new stub to return + */ + getRowUsingDisplayIndex(displayRowIndex) { + if (this.parentRowNode.sibling && displayRowIndex === this.parentRowNode.sibling.rowIndex) { + return this.parentRowNode.sibling; + } + return this.cache.getRowByDisplayIndex(displayRowIndex); + } + /** + * Given a display index, returns the row top and height for the row at that index. + * + * @param displayIndex the display index of the node + * @returns an object containing the rowTop and rowHeight of the node at the given displayIndex + */ + getRowBounds(displayIndex) { + if (!this.isDisplayIndexInStore(displayIndex)) { + return null; + } + const thisNode = this.cache.getNodeCachedByDisplayIndex(displayIndex); + if (thisNode) { + const boundsFromRow = this.blockUtils.extractRowBounds(thisNode, displayIndex); + if (boundsFromRow) { + return boundsFromRow; + } + } + const { previousNode, nextNode } = this.cache.getSurroundingNodesByDisplayIndex(displayIndex) ?? {}; + if (previousNode) { + const boundsFromRow = this.blockUtils.extractRowBounds(previousNode.node, displayIndex); + if (boundsFromRow != null) { + return boundsFromRow; + } + } + const defaultRowHeight = _getRowHeightAsNumber5(this.beans); + if (nextNode) { + const numberOfRowDiff2 = (nextNode.node.rowIndex - displayIndex) * defaultRowHeight; + return { + rowTop: nextNode.node.rowTop - numberOfRowDiff2, + rowHeight: defaultRowHeight + }; + } + const lastTop = this.topPx + this.heightPx; + const numberOfRowDiff = (this.getDisplayIndexEnd() - displayIndex) * defaultRowHeight; + return { + rowTop: lastTop - numberOfRowDiff, + rowHeight: defaultRowHeight + }; + } + /** + * Given a vertical pixel, determines whether this store contains a row at that pixel + * + * @param pixel a vertical pixel position from the grid + * @returns whether that pixel points to a virtual space belonging to this store + */ + isPixelInRange(pixel) { + return pixel >= this.topPx && pixel < this.topPx + this.heightPx; + } + /** + * Given a vertical pixel, returns the row existing at that pixel location + * + * @param pixel a vertical pixel position from the grid + * @returns the display index at the given pixel location + */ + getRowIndexAtPixel(pixel) { + if (pixel < this.topPx) { + return this.getDisplayIndexStart(); + } + if (pixel >= this.topPx + this.heightPx) { + return this.getDisplayIndexEnd() - 1; + } + if (this.parentRowNode.sibling && pixel > this.parentRowNode.sibling.rowTop && pixel < this.parentRowNode.sibling.rowTop + this.parentRowNode.sibling.rowHeight) { + return this.parentRowNode.sibling.rowIndex; + } + let distToPreviousNodeTop = Number.MAX_SAFE_INTEGER; + let previousNode = null; + let distToNextNodeTop = Number.MAX_SAFE_INTEGER; + let nextNode = null; + this.cache.getNodes().forEach(({ node }) => { + const distBetween = Math.abs(pixel - node.rowTop); + if (node.rowTop < pixel) { + if (distBetween < distToPreviousNodeTop) { + distToPreviousNodeTop = distBetween; + previousNode = node; + } + return; + } + if (distBetween < distToNextNodeTop) { + distToNextNodeTop = distBetween; + nextNode = node; + } + }); + previousNode = previousNode; + nextNode = nextNode; + if (previousNode) { + const indexOfRow = this.blockUtils.getIndexAtPixel(previousNode, pixel); + if (indexOfRow != null) { + return indexOfRow; + } + } + const defaultRowHeight = _getRowHeightAsNumber5(this.beans); + if (nextNode) { + const nextTop2 = nextNode.rowTop; + const numberOfRowDiff2 = Math.ceil((nextTop2 - pixel) / defaultRowHeight); + return nextNode.rowIndex - numberOfRowDiff2; + } + const nextTop = this.topPx + this.heightPx; + const numberOfRowDiff = Math.floor((nextTop - pixel) / defaultRowHeight); + return this.getDisplayIndexEnd() - numberOfRowDiff; + } + /** + * Given a path of group keys, returns the child store for that group. + * + * @param keys the grouping path to the desired store + * @returns the child store for the given keys, or null if not found + */ + getChildStore(keys) { + return this.storeUtils.getChildStore(keys, this, (key) => { + const lazyNode = this.cache.getNodes().find((lazyNode2) => lazyNode2.node.key == key); + if (!lazyNode) { + return null; + } + return lazyNode.node; + }); + } + /** + * Executes a provided callback on each child store belonging to this store + * + * @param cb the callback to execute + */ + forEachChildStoreShallow(cb) { + this.cache.getNodes().forEach(({ node }) => { + if (node.childStore) { + cb(node.childStore); + } + }); + } + /** + * Executes after a change to sorting, determines recursively whether this store or a child requires refreshed. + * + * If a purge refresh occurs, the row count is preserved. + * + * @param params a set of properties pertaining to the sort changes + */ + refreshAfterSort(params) { + const serverSortsAllLevels = this.storeUtils.isServerSideSortAllLevels(); + if (serverSortsAllLevels || this.storeUtils.isServerRefreshNeeded(this.parentRowNode, this.ssrmParams.rowGroupCols, params)) { + const allRowsLoaded = this.cache.isStoreFullyLoaded(); + const isClientSideSortingEnabled = this.gos.get("serverSideEnableClientSideSort"); + const isClientSideSort = allRowsLoaded && isClientSideSortingEnabled; + if (!isClientSideSort) { + const oldCount = this.cache.getRowCount(); + const lastKnown = this.cache.isLastRowIndexKnown(); + this.destroyBean(this.cache); + this.cache = this.createManagedBean(new LazyCache(this, oldCount, lastKnown, this.storeParams)); + return; + } + this.cache.clientSideSortRows(); + } + this.forEachChildStoreShallow((store) => store.refreshAfterSort(params)); + } + /** + * Executes after a change to filtering, determines recursively whether this store or a child requires refreshed. + * + * If a refresh occurs, the row count is reset. + * + * @param params a set of properties pertaining to the filter changes + */ + refreshAfterFilter(params) { + const serverFiltersAllLevels = !this.storeUtils.isServerSideOnlyRefreshFilteredGroups(); + if (serverFiltersAllLevels || this.storeUtils.isServerRefreshNeeded(this.parentRowNode, this.ssrmParams.rowGroupCols, params)) { + this.refreshStore(true); + return; + } + this.forEachChildStoreShallow((store) => store.refreshAfterFilter(params)); + } + /** + * Marks all existing nodes as requiring reloaded, and triggers a load check + * + * @param purge whether to remove all nodes and data in favour of stub nodes + */ + refreshStore(purge) { + if (purge) { + this.destroyBean(this.cache); + this.cache = this.createManagedBean(new LazyCache(this, 1, false, this.storeParams)); + this.fireStoreUpdatedEvent(); + return; + } + this.cache.markNodesForRefresh(); + } + /** + * Used for pagination, given a local/store index, returns the display index of that row + * + * @param topLevelIndex the store index of a row + * @returns the display index for the given store index + */ + getTopLevelRowDisplayedIndex(topLevelIndex) { + const displayIndex = this.cache.getDisplayIndexFromStoreIndex(topLevelIndex); + return displayIndex ?? topLevelIndex; + } + /** + * Used for pagination to determine if the last page is known, and for aria to determine if the last grid row is known + * + * @returns whether the last index of this store is known, or if lazy loading still required + */ + isLastRowIndexKnown() { + return this.cache.isLastRowIndexKnown(); + } + /** + * Used by the selection service to select a range of nodes + * + * @param firstInRange the first node in the range to find + * @param lastInRange the last node in the range to find + * @returns a range of nodes between firstInRange and lastInRange inclusive + */ + getRowNodesInRange(firstInRange, lastInRange) { + return this.cache.getNodes().filter(({ node }) => { + return node.rowIndex >= firstInRange.rowIndex && node.rowIndex <= lastInRange.rowIndex; + }).map(({ node }) => node); + } + /** + * Mutates a given array to add this stores state, and recursively add all the children store states. + * + * @param result a mutable results array + */ + addStoreStates(result) { + result.push({ + route: this.parentRowNode.getRoute() ?? [], + rowCount: this.getRowCount(), + lastRowIndexKnown: this.isLastRowIndexKnown(), + info: this.info, + maxBlocksInCache: this.storeParams.maxBlocksInCache, + cacheBlockSize: this.storeParams.cacheBlockSize + }); + this.forEachChildStoreShallow((childStore) => childStore.addStoreStates(result)); + } + 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(info) { + if (info) { + Object.assign(this.info, info); + } + } + // gets called 1) row count changed 2) cache purged + fireStoreUpdatedEvent() { + this.eventSvc.dispatchEvent({ + type: "storeUpdated" + }); + } + // gets called when row data updated, and no more refreshing needed + fireRefreshFinishedEvent() { + this.eventSvc.dispatchEvent({ + type: "storeRefreshed", + route: this.parentRowNode.getRoute() + }); + } + getBlockStates() { + return this.cache.getBlockStates(); + } + getStoreBounds() { + return { + topPx: this.topPx, + heightPx: this.heightPx + }; + } + getCache() { + return this.cache; + } + getFirstNode() { + const firstNode = this.cache.getNodes().getBy("index", 0); + return firstNode?.node ?? null; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/storeFactory.ts +var StoreFactory = class extends BeanStub75 { + constructor() { + super(...arguments); + this.beanName = "ssrmStoreFactory"; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.rowGroupColsSvc = beans.rowGroupColsSvc; + this.pivotColsSvc = beans.pivotColsSvc; + this.rowAutoHeight = beans.rowAutoHeight; + } + createStore(ssrmParams, parentNode) { + const storeParams = this.getStoreParams(ssrmParams, parentNode); + return new LazyStore(ssrmParams, storeParams, parentNode); + } + getStoreParams(ssrmParams, parentNode) { + const userStoreParams = this.getLevelSpecificParams(parentNode); + const cacheBlockSize = this.getBlockSize(userStoreParams); + const maxBlocksInCache = this.getMaxBlocksInCache(ssrmParams, userStoreParams); + const storeParams = { + cacheBlockSize, + maxBlocksInCache + }; + return storeParams; + } + getMaxBlocksInCache(ssrmParams, userStoreParams) { + const maxBlocksInCache = userStoreParams?.maxBlocksInCache != null ? userStoreParams.maxBlocksInCache : this.gos.get("maxBlocksInCache"); + const maxBlocksActive = maxBlocksInCache != null && maxBlocksInCache >= 0; + if (!maxBlocksActive) { + return; + } + if (ssrmParams.dynamicRowHeight) { + _warn53(203); + return; + } + if (this.rowAutoHeight?.active) { + _warn53(204); + return void 0; + } + return maxBlocksInCache; + } + getBlockSize(userStoreParams) { + const blockSize = userStoreParams?.cacheBlockSize != null ? userStoreParams.cacheBlockSize : this.gos.get("cacheBlockSize"); + if (blockSize != null && blockSize > 0) { + return blockSize; + } else { + return 100; + } + } + getLevelSpecificParams(parentNode) { + const callback = this.gos.getCallback("getServerSideGroupLevelParams"); + if (!callback) { + return void 0; + } + const params = { + level: parentNode.level + 1, + parentRowNode: parentNode.level >= 0 ? parentNode : void 0, + rowGroupColumns: this.rowGroupColsSvc?.columns ?? [], + pivotColumns: this.pivotColsSvc?.columns ?? [], + pivotMode: this.colModel.isPivotMode() + }; + const res = callback(params); + return res; + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/stores/storeUtils.ts +import { BeanStub as BeanStub76, _isServerSideRowModel as _isServerSideRowModel7 } from "ag-grid-community"; +var StoreUtils = class extends BeanStub76 { + constructor() { + super(...arguments); + this.beanName = "ssrmStoreUtils"; + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.serverSideRowModel = beans.rowModel; + this.storeFactory = beans.ssrmStoreFactory; + } + getChildStore(keys, currentCache, findNodeFunc) { + if (!keys?.length) { + return currentCache; + } + const nextKey = keys[0]; + const nextNode = findNodeFunc(nextKey); + if (nextNode) { + if (keys.length === 1 && !nextNode.childStore) { + const storeParams = this.serverSideRowModel.getParams(); + nextNode.childStore = this.createBean(this.storeFactory.createStore(storeParams, nextNode)); + } + const keyListForNextLevel = keys.slice(1, keys.length); + const nextStore = nextNode.childStore; + return nextStore ? nextStore.getChildStore(keyListForNextLevel) : null; + } + return null; + } + isServerRefreshNeeded(parentRowNode, rowGroupCols, params) { + if (params.valueColChanged || params.secondaryColChanged) { + return true; + } + const level = parentRowNode.level + 1; + const grouping = level < rowGroupCols.length; + const leafNodes = !grouping; + if (leafNodes) { + return true; + } + const colIdThisGroup = rowGroupCols[level].id; + const actionOnThisGroup = params.changedColumns.indexOf(colIdThisGroup) > -1; + if (actionOnThisGroup) { + return true; + } + const allCols = this.colModel.getCols(); + const affectedGroupCols = allCols.filter((col) => col.getColDef().showRowGroup && params.changedColumns.includes(col.getId())).map((col) => col.getColDef().showRowGroup).some((group) => group === true || group === colIdThisGroup); + return affectedGroupCols; + } + getServerSideInitialRowCount() { + return this.gos.get("serverSideInitialRowCount"); + } + isServerSideSortAllLevels() { + return this.gos.get("serverSideSortAllLevels") && _isServerSideRowModel7(this.gos); + } + isServerSideOnlyRefreshFilteredGroups() { + return this.gos.get("serverSideOnlyRefreshFilteredGroups") && _isServerSideRowModel7(this.gos); + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/transactionManager.ts +import { BeanStub as BeanStub77, ServerSideTransactionResultStatus as ServerSideTransactionResultStatus2 } from "ag-grid-community"; +var TransactionManager = class extends BeanStub77 { + constructor() { + super(...arguments); + this.beanName = "ssrmTxnManager"; + this.asyncTransactions = []; + } + wireBeans(beans) { + this.valueCache = beans.valueCache; + this.serverSideRowModel = beans.rowModel; + this.selectionSvc = beans.selectionSvc; + } + applyTransactionAsync(transaction, callback) { + if (this.asyncTransactionsTimeout == null) { + this.scheduleExecuteAsync(); + } + this.asyncTransactions.push({ transaction, callback }); + } + scheduleExecuteAsync() { + const waitMillis = this.gos.get("asyncTransactionWaitMillis"); + this.asyncTransactionsTimeout = window.setTimeout(() => { + this.executeAsyncTransactions(); + }, waitMillis); + } + executeAsyncTransactions() { + if (!this.asyncTransactions) { + return; + } + const resultFuncs = []; + const resultsForEvent = []; + const transactionsToRetry = []; + let atLeastOneTransactionApplied = false; + for (const txWrapper of this.asyncTransactions) { + let result; + const hasStarted = this.serverSideRowModel.executeOnStore(txWrapper.transaction.route, (cache) => { + result = cache.applyTransaction(txWrapper.transaction); + }); + if (!hasStarted) { + result = { status: ServerSideTransactionResultStatus2.StoreNotStarted }; + } else if (result == void 0) { + result = { status: ServerSideTransactionResultStatus2.StoreNotFound }; + } + resultsForEvent.push(result); + const retryTransaction = result.status == ServerSideTransactionResultStatus2.StoreLoading; + if (retryTransaction) { + transactionsToRetry.push(txWrapper); + continue; + } + if (txWrapper.callback) { + resultFuncs.push(() => txWrapper.callback(result)); + } + if (result.status === ServerSideTransactionResultStatus2.Applied) { + atLeastOneTransactionApplied = true; + } + } + if (resultFuncs.length > 0) { + window.setTimeout(() => { + for (const func of resultFuncs) { + func(); + } + }, 0); + } + this.asyncTransactionsTimeout = void 0; + this.asyncTransactions = transactionsToRetry; + if (atLeastOneTransactionApplied) { + this.valueCache?.onDataChanged(); + this.eventSvc.dispatchEvent({ type: "storeUpdated" }); + } + if (resultsForEvent.length > 0) { + this.eventSvc.dispatchEvent({ + type: "asyncTransactionsFlushed", + results: resultsForEvent + }); + } + } + flushAsyncTransactions() { + if (this.asyncTransactionsTimeout != null) { + clearTimeout(this.asyncTransactionsTimeout); + } + this.executeAsyncTransactions(); + } + applyTransaction(transaction) { + let res; + const hasStarted = this.serverSideRowModel.executeOnStore(transaction.route, (store) => { + res = store.applyTransaction(transaction); + }); + if (!hasStarted) { + return { status: ServerSideTransactionResultStatus2.StoreNotStarted }; + } else if (res) { + this.valueCache?.onDataChanged(); + if (res.remove && this.selectionSvc) { + const removedRowIds = res.remove.map((row) => row.id); + this.selectionSvc.deleteSelectionStateFromParent(transaction.route || [], removedRowIds); + } + this.eventSvc.dispatchEvent({ type: "storeUpdated" }); + return res; + } else { + return { status: ServerSideTransactionResultStatus2.StoreNotFound }; + } + } +}; + +// packages/ag-grid-enterprise/src/serverSideRowModel/serverSideRowModelModule.ts +var ServerSideRowModelModule = { + moduleName: "ServerSideRowModel", + version: VERSION, + rowModels: ["serverSide"], + beans: [ + ServerSideRowModel, + ExpandListener, + StoreUtils, + BlockUtils, + NodeManager, + TransactionManager, + FilterListener, + StoreFactory, + ListenerUtils, + ServerSideSelectionService, + LazyBlockLoadingService, + SsrmRowChildrenService, + ServerSideExpansionService, + SortListener + ], + dependsOn: [ + EnterpriseCoreModule, + _SortModule, + _SharedRowSelectionModule, + SharedPivotModule, + SharedTreeDataModule, + LoadingCellRendererModule + ] +}; +var ServerSideRowModelApiModule = { + moduleName: "ServerSideRowModelApi", + version: VERSION, + apiFunctions: { + getServerSideSelectionState, + setServerSideSelectionState, + applyServerSideTransaction, + applyServerSideTransactionAsync, + applyServerSideRowData, + retryServerSideLoads, + flushServerSideAsyncTransactions, + refreshServerSide, + getServerSideGroupLevelState, + resetRowHeights, + onRowHeightChanged + }, + dependsOn: [EnterpriseCoreModule, _RowModelSharedApiModule, _CsrmSsrmSharedApiModule, _SsrmInfiniteSharedApiModule] +}; + +// packages/ag-grid-enterprise/src/formula/editor/formulaCellEditor.ts +import { AgAbstractCellEditor as AgAbstractCellEditor2, KeyCode as KeyCode33, RefPlaceholder as RefPlaceholder47, _isBrowserSafari as _isBrowserSafari2, _placeCaretAtEnd as _placeCaretAtEnd2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/agFormulaInputField.ts +import { AgContentEditableField, _createElement as _createElement16, _getDocument as _getDocument6, _getWindow, _placeCaretAtEnd } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/formula/refUtils.ts +var CELL_OR_RANGE_REGEX = /\$?[A-Za-z]+\$?[0-9]+(?::\$?[A-Za-z]+\$?[0-9]+)?/g; +var FULL_CELL_OR_RANGE_REGEX = /^(\$?)([A-Za-z]+)(\$?)([0-9]+)(?::(\$?)([A-Za-z]+)(\$?)([0-9]+))?$/; +var WORD_CHAR_REGEX = /[A-Za-z0-9]/; +var isFormulaIdentChar = (char) => { + return !!char && WORD_CHAR_REGEX.test(char); +}; +var isFormulaIdentStart = (char) => { + return !!char && /[A-Za-z]/.test(char); +}; +var isWordChar = (char) => { + return isFormulaIdentChar(char ?? void 0); +}; +var isStandaloneRefToken = (text, matchIndex, ref) => { + const prevChar = matchIndex > 0 ? text[matchIndex - 1] : null; + if (isWordChar(prevChar)) { + return false; + } + if (ref.endsWith(":")) { + return true; + } + const nextIndex = matchIndex + ref.length; + const nextChar = nextIndex < text.length ? text[nextIndex] : null; + return !isWordChar(nextChar); +}; +var parseA1Ref = (ref, options = {}) => { + const allowTrailingColon = options.allowTrailingColon ?? false; + const normalizedRef = allowTrailingColon && ref.endsWith(":") ? ref.slice(0, -1) : ref; + const match = FULL_CELL_OR_RANGE_REGEX.exec(normalizedRef); + if (!match) { + return null; + } + const [, absCol1, col1, absRow1, row1, absCol2, col2, absRow2, row2] = match; + const hasEnd = !!(col2 && row2); + return { + startCol: col1, + startRow: row1, + startColAbsolute: absCol1 === "$", + startRowAbsolute: absRow1 === "$", + ...hasEnd ? { + endCol: col2, + endRow: row2, + endColAbsolute: absCol2 === "$", + endRowAbsolute: absRow2 === "$" + } : null + }; +}; +var getRefTokenMatches = (text) => { + const matches = []; + let match; + let index = 0; + CELL_OR_RANGE_REGEX.lastIndex = 0; + while ((match = CELL_OR_RANGE_REGEX.exec(text)) != null) { + let ref = match[0]; + const start = match.index ?? 0; + const endIndex = start + ref.length; + if (endIndex < text.length && text[endIndex] === ":") { + ref += ":"; + } + if (!isStandaloneRefToken(text, start, ref)) { + continue; + } + matches.push({ ref, start, end: start + ref.length, index }); + index += 1; + } + return matches; +}; + +// packages/ag-grid-enterprise/src/widgets/agFormulaInputField.css +var agFormulaInputField_default = ".ag-formula-token{line-height:var(--ag-line-height,1.6)}.ag-formula-token-color-1{color:var(--ag-formula-token-1-color)}.ag-formula-token-color-2{color:var(--ag-formula-token-2-color)}.ag-formula-token-color-3{color:var(--ag-formula-token-3-color)}.ag-formula-token-color-4{color:var(--ag-formula-token-4-color)}.ag-formula-token-color-5{color:var(--ag-formula-token-5-color)}.ag-formula-token-color-6{color:var(--ag-formula-token-6-color)}.ag-formula-token-color-7{color:var(--ag-formula-token-7-color)}.ag-formula-range-color-1{--ag-range-selection-border-color:var(--ag-formula-token-1-color);--ag-range-selection-background-color:var(--ag-formula-token-1-background-color)}.ag-formula-range-color-2{--ag-range-selection-border-color:var(--ag-formula-token-2-color);--ag-range-selection-background-color:var(--ag-formula-token-2-background-color)}.ag-formula-range-color-3{--ag-range-selection-border-color:var(--ag-formula-token-3-color);--ag-range-selection-background-color:var(--ag-formula-token-3-background-color)}.ag-formula-range-color-4{--ag-range-selection-border-color:var(--ag-formula-token-4-color);--ag-range-selection-background-color:var(--ag-formula-token-4-background-color)}.ag-formula-range-color-5{--ag-range-selection-border-color:var(--ag-formula-token-5-color);--ag-range-selection-background-color:var(--ag-formula-token-5-background-color)}.ag-formula-range-color-6{--ag-range-selection-border-color:var(--ag-formula-token-6-color);--ag-range-selection-background-color:var(--ag-formula-token-6-background-color)}.ag-formula-range-color-7{--ag-range-selection-border-color:var(--ag-formula-token-7-color);--ag-range-selection-background-color:var(--ag-formula-token-7-background-color)}.ag-fill-handle.ag-formula-range-color-1,.ag-range-handle.ag-formula-range-color-1{background-color:var(--ag-formula-token-1-color)}.ag-fill-handle.ag-formula-range-color-2,.ag-range-handle.ag-formula-range-color-2{background-color:var(--ag-formula-token-2-color)}.ag-fill-handle.ag-formula-range-color-3,.ag-range-handle.ag-formula-range-color-3{background-color:var(--ag-formula-token-3-color)}.ag-fill-handle.ag-formula-range-color-4,.ag-range-handle.ag-formula-range-color-4{background-color:var(--ag-formula-token-4-color)}.ag-fill-handle.ag-formula-range-color-5,.ag-range-handle.ag-formula-range-color-5{background-color:var(--ag-formula-token-5-color)}.ag-fill-handle.ag-formula-range-color-6,.ag-range-handle.ag-formula-range-color-6{background-color:var(--ag-formula-token-6-color)}"; + +// packages/ag-grid-enterprise/src/widgets/formulaInputAutocompleteFeature.ts +import { BeanStub as BeanStub78, KeyCode as KeyCode32, _getDocument as _getDocument5 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/widgets/formulaInputTokenUtils.ts +var TOKEN_INSERT_AFTER_CHARS = /* @__PURE__ */ new Set(["=", "+", "-", "*", "/", "^", ",", "(", ";", "<", ">", "&"]); +var getPreviousNonSpaceChar = (value, offset) => { + for (let i = offset - 1; i >= 0; i--) { + const char = value[i]; + if (char != null && char.trim() !== "") { + return char; + } + } + return null; +}; + +// packages/ag-grid-enterprise/src/widgets/formulaRangeUtils.ts +import { isSpecialCol as isSpecialCol3 } from "ag-grid-community"; +var FORMULA_TOKEN_COLOR_CLASS = "ag-formula-token-color"; +var FORMULA_RANGE_COLOR_CLASS = "ag-formula-range-color"; +var getColorClassesForRef = (_ref, colorIndexOverride) => { + const index = colorIndexOverride ?? 0; + return { + tokenClass: `${FORMULA_TOKEN_COLOR_CLASS}-${index + 1}`, + rangeClass: `${FORMULA_RANGE_COLOR_CLASS}-${index + 1}`, + colorIndex: index + }; +}; +var getRangeColorIndexFromClass = (colorClass) => { + if (!colorClass) { + return null; + } + const match = /ag-formula-range-color-(\d+)/.exec(colorClass); + if (!match) { + return null; + } + const parsed = parseInt(match[1], 10); + return Number.isFinite(parsed) ? parsed - 1 : null; +}; +var tagRangeWithFormulaColor = (range, ref, colorIndex) => { + if (!range) { + return; + } + const { rangeClass } = getColorClassesForRef(ref, colorIndex); + range.colorClass = rangeClass; +}; +var getCellRangeParams = (beans, ref) => { + const parsed = parseA1Ref(ref, { allowTrailingColon: true }); + if (!parsed) { + return null; + } + const { formula } = beans; + const { startCol, startRow, endCol, endRow } = parsed; + const startColRef = startCol; + const endColRef = endCol ?? startCol; + const startColMatch = formula?.getColByRef(startColRef); + const endColMatch = formula?.getColByRef(endColRef); + if (!startColMatch || !endColMatch) { + return null; + } + const rowStartIndex = parseInt(startRow, 10) - 1; + const rowEndIndex = endRow ? parseInt(endRow, 10) - 1 : rowStartIndex; + if (rowStartIndex < 0 || rowEndIndex < 0) { + return null; + } + const rowModel = beans.rowModel; + if (!rowModel?.getFormulaRow(rowStartIndex) || !rowModel.getFormulaRow(rowEndIndex)) { + return null; + } + return { + rowStartIndex, + rowEndIndex, + columnStart: startColMatch, + columnEnd: endColMatch + }; +}; +var getLatestRangeRef = (beans) => { + const ranges = beans.rangeSvc?.getCellRanges(); + const latest = ranges?.length ? ranges[ranges.length - 1] : null; + if (!latest) { + return null; + } + return rangeToRef(beans, latest); +}; +var rangeToRef = (beans, range) => { + const { rangeSvc, formula } = beans; + if (!rangeSvc || !formula) { + return null; + } + const startRow = rangeSvc.getRangeStartRow(range); + const endRow = rangeSvc.getRangeEndRow(range); + if (!startRow || !endRow || startRow.rowPinned || endRow.rowPinned) { + return null; + } + const rowStartIndex = Math.min(startRow.rowIndex, endRow.rowIndex) + 1; + const rowEndIndex = Math.max(startRow.rowIndex, endRow.rowIndex) + 1; + const columns = range.columns?.filter((col) => !isSpecialCol3(col) && !!formula.getColRef(col)); + if (!columns?.length) { + return null; + } + const sorted = [...columns]; + const startCol = sorted[0]; + const endCol = sorted[sorted.length - 1]; + const colStartRef = formula.getColRef(startCol); + const colEndRef = formula.getColRef(endCol); + if (!colStartRef || !colEndRef) { + return null; + } + const sameCol = colStartRef === colEndRef; + const sameRow = rowStartIndex === rowEndIndex; + if (sameCol && sameRow) { + return `${colStartRef}${rowStartIndex}`; + } + return `${colStartRef}${rowStartIndex}:${colEndRef}${rowEndIndex}`; +}; +var getRefTokenMatchesForFormula = (beans, text) => { + const matches = getRefTokenMatches(text); + const { formula } = beans; + if (!formula) { + return matches; + } + const valid = []; + let index = 0; + for (const match of matches) { + if (!getCellRangeParams(beans, match.ref)) { + continue; + } + valid.push({ ...match, index }); + index += 1; + } + return valid; +}; +var getRefTokensFromText = (beans, text) => { + const matches = getRefTokenMatchesForFormula(beans, text); + return matches.map(({ ref, index }) => ({ ref, index })); +}; + +// packages/ag-grid-enterprise/src/widgets/formulaInputAutocompleteFeature.ts +var FormulaInputAutocompleteFeature = class extends BeanStub78 { + constructor(field) { + super(); + this.field = field; + this.functionAutocompleteList = null; + this.functionAutocompleteToken = null; + this.functionAutocompleteEntries = null; + this.functionAutocompleteSearch = null; + } + postConstruct() { + this.addManagedElementListeners(this.field.getContentElement(), { + keydown: this.onContentKeyDown.bind(this), + mouseup: this.updateFunctionAutocomplete.bind(this), + focusin: this.updateFunctionAutocomplete.bind(this), + focusout: this.closeFunctionAutocomplete.bind(this) + }); + this.addDestroyFunc(() => this.closeFunctionAutocomplete()); + } + onPlainValueUpdated() { + this.closeFunctionAutocomplete(); + } + onFormulaValueUpdated() { + this.updateFunctionAutocomplete(); + } + onContentKeyDown(event) { + if (this.functionAutocompleteList) { + switch (event.key) { + case KeyCode32.ENTER: + case KeyCode32.TAB: + event.preventDefault(); + event.stopPropagation(); + this.confirmFunctionAutocomplete(); + return; + case KeyCode32.ESCAPE: + event.preventDefault(); + event.stopPropagation(); + this.closeFunctionAutocomplete(); + return; + case KeyCode32.UP: + case KeyCode32.DOWN: + this.functionAutocompleteList.onNavigationKeyDown(event, event.key); + return; + } + } + switch (event.key) { + case KeyCode32.LEFT: + case KeyCode32.RIGHT: + case KeyCode32.PAGE_HOME: + case KeyCode32.PAGE_END: + this.scheduleFunctionAutocompleteUpdate(); + break; + } + } + scheduleFunctionAutocompleteUpdate() { + setTimeout(() => { + if (!this.isAlive()) { + return; + } + this.updateFunctionAutocomplete(); + }); + } + updateFunctionAutocomplete() { + if (!this.isContentFocused()) { + this.closeFunctionAutocomplete(); + return; + } + const { field, beans } = this; + const value = field.getCurrentValue(); + const hasFormulaPrefix = value.trimStart().startsWith("="); + if (!hasFormulaPrefix) { + this.closeFunctionAutocomplete(); + return; + } + const caretOffsets = field.getCaretOffsetsForAutocomplete(value); + if (!caretOffsets) { + this.closeFunctionAutocomplete(); + return; + } + if (isCaretInsideRefToken(beans, value, caretOffsets.valueOffset)) { + this.closeFunctionAutocomplete(); + return; + } + const token = getFunctionTokenAtOffset(value, caretOffsets.valueOffset, beans.formula ?? null); + if (!token) { + this.closeFunctionAutocomplete(); + return; + } + const { prefix } = token; + if (!prefix.length) { + this.closeFunctionAutocomplete(); + return; + } + const entries = this.getFunctionAutocompleteEntries(); + if (!entries.length) { + this.closeFunctionAutocomplete(); + return; + } + const searchLower = prefix.toLocaleLowerCase(); + const hasMatch = entries.some(({ key }) => key.toLocaleLowerCase().startsWith(searchLower)); + if (!hasMatch) { + this.closeFunctionAutocomplete(); + return; + } + this.functionAutocompleteToken = token; + this.openFunctionAutocomplete(entries); + if (this.functionAutocompleteList && this.functionAutocompleteSearch !== prefix) { + this.functionAutocompleteList.setSearch(prefix); + this.functionAutocompleteSearch = prefix; + } + } + getFunctionAutocompleteEntries() { + const formula = this.beans.formula; + const names = formula?.active ? formula.getFunctionNames?.() ?? [] : []; + if (!this.functionAutocompleteEntries || this.functionAutocompleteEntries.length !== names.length) { + this.functionAutocompleteEntries = names.map((name) => ({ key: name })); + } + return this.functionAutocompleteEntries; + } + openFunctionAutocomplete(entries) { + if (this.functionAutocompleteList || !entries.length) { + return; + } + const popupSvc = this.beans.popupSvc; + if (!popupSvc) { + return; + } + let positionParams = null; + const repositionList = () => { + if (this.functionAutocompleteList && positionParams) { + popupSvc.positionPopupByComponent(positionParams); + } + }; + this.functionAutocompleteList = this.createManagedBean( + new AgAutocompleteList({ + autocompleteEntries: entries, + onConfirmed: () => this.confirmFunctionAutocomplete(), + useStartsWithSearch: true, + autoSizeList: true, + maxVisibleItems: 10, + onListHeightChanged: repositionList + }) + ); + const ePopupGui = this.functionAutocompleteList.getGui(); + positionParams = { + ePopup: ePopupGui, + type: "autocomplete", + eventSource: this.field.getGui(), + position: "under", + alignSide: this.gos.get("enableRtl") ? "right" : "left", + keepWithinBounds: true + }; + const addPopupRes = popupSvc.addPopup({ + eChild: ePopupGui, + anchorToElement: this.field.getGui(), + positionCallback: repositionList, + ariaLabel: "Formula functions" + }); + this.functionAutocompleteHidePopup = addPopupRes.hideFunc; + this.functionAutocompleteList.afterGuiAttached(); + } + closeFunctionAutocomplete() { + this.functionAutocompleteToken = null; + this.functionAutocompleteSearch = null; + if (!this.functionAutocompleteList) { + return; + } + this.functionAutocompleteHidePopup?.(); + this.functionAutocompleteHidePopup = void 0; + this.destroyBean(this.functionAutocompleteList); + this.functionAutocompleteList = null; + } + confirmFunctionAutocomplete() { + const token = this.functionAutocompleteToken; + const selected = this.functionAutocompleteList?.getSelectedValue(); + if (!token || !selected) { + this.closeFunctionAutocomplete(); + return; + } + const { field } = this; + const value = field.getCurrentValue(); + const functionName = selected.key; + const baseValue = value.slice(0, token.start) + functionName + value.slice(token.end); + const insertPos = token.start + functionName.length; + const nextValue = baseValue[insertPos] === "(" ? baseValue : baseValue.slice(0, insertPos) + "(" + baseValue.slice(insertPos); + field.getContentElement().focus({ preventScroll: true }); + field.applyFormulaValueChange({ + currentValue: value, + nextValue, + caret: insertPos + 1 + }); + this.closeFunctionAutocomplete(); + } + isContentFocused() { + return _getDocument5(this.beans).activeElement === this.field.getContentElement(); + } +}; +var getFunctionTokenAtOffset = (value, caretOffset, formula) => { + if (caretOffset < 0 || caretOffset > value.length || isInsideStringLiteral(value, caretOffset)) { + return null; + } + let start = caretOffset; + while (start > 0 && isFormulaIdentChar(value[start - 1])) { + start--; + } + let end = caretOffset; + while (end < value.length && isFormulaIdentChar(value[end])) { + end++; + } + if (start === end) { + return null; + } + let tokenEnd = end; + if (caretOffset !== end) { + const suffix = value.slice(caretOffset, end); + const parsed = parseA1Ref(suffix); + const isRefSuffix = !!parsed && (!formula || !!formula.getColByRef(parsed.startCol)); + if (isRefSuffix) { + tokenEnd = caretOffset; + } + } + const token = value.slice(start, tokenEnd); + if (!token || !isFormulaIdentStart(token[0])) { + return null; + } + if (value[start - 1] === "$") { + return null; + } + const previousChar = getPreviousNonSpaceChar(value, start); + if (previousChar != null && !TOKEN_INSERT_AFTER_CHARS.has(previousChar)) { + return null; + } + return { + start, + end: tokenEnd, + prefix: value.slice(start, caretOffset) + }; +}; +var isCaretInsideRefToken = (beans, value, caretOffset) => { + for (const match of getRefTokenMatchesForFormula(beans, value)) { + if (caretOffset >= match.start && caretOffset <= match.end) { + return true; + } + } + return false; +}; +var isInsideStringLiteral = (value, offset) => { + let inString = false; + for (let i = 0; i < offset && i < value.length; i++) { + if (value[i] !== '"') { + continue; + } + if (value[i + 1] === '"') { + i++; + continue; + } + inString = !inString; + } + return inString; +}; + +// packages/ag-grid-enterprise/src/widgets/formulaInputRangeSyncFeature.ts +import { BeanStub as BeanStub79, _last as _last17, isSpecialCol as isSpecialCol4 } from "ag-grid-community"; +var FormulaInputRangeSyncFeature = class extends BeanStub79 { + constructor(field) { + super(); + this.field = field; + // local mirror of editSvc range selection state while formula editing is active. + this.rangeSelectionEnabled = false; + // refs found in the formula that should have matching grid ranges (counts handle duplicates). + this.trackedRangeRefs = /* @__PURE__ */ new Map(); + // ranges we are actively tracking and their current ref string. + this.trackedRanges = /* @__PURE__ */ new Map(); + // prevents our own range changes from re-entering the selection handler. + this.suppressRangeEvents = false; + // skips the synthetic refresh event we dispatch after re-tagging ranges. + this.ignoreNextRangeEvent = false; + // avoids a value update loop when we re-render on enabling range selection. + this.skipNextValueUpdate = false; + // suppress selection handling while keyboard navigation updates the focus range. + this.suppressSelectionChangeHandling = false; + // keep a stable callback so the input manager can deactivate the previous editor. + this.handleEditorDeactivated = () => { + this.rangeSelectionEnabled = false; + this.suppressRangeEvents = false; + this.ignoreNextRangeEvent = false; + this.skipNextValueUpdate = false; + this.clearTrackedRanges(true); + }; + } + postConstruct() { + this.addManagedEventListeners({ + cellSelectionChanged: this.onCellSelectionChanged.bind(this) + }); + this.addDestroyFunc(() => this.disableRangeSelectionWhileEditing()); + this.addDestroyFunc(() => this.unregisterActiveEditor()); + } + onValueUpdated(value, hasFormulaPrefix) { + if (this.skipNextValueUpdate) { + this.skipNextValueUpdate = false; + return; + } + if (!this.isActiveEditor()) { + return; + } + if (hasFormulaPrefix) { + const newlyEnabled = this.enableRangeSelectionWhileEditing(); + if (newlyEnabled) { + this.skipNextValueUpdate = true; + this.field.setValue(value, true); + } + this.syncRangesFromFormula(value); + return; + } + this.disableRangeSelectionWhileEditing(); + } + setEditingCellRef(column, rowIndex, editingCellRef) { + this.editingColumn = column; + this.editingRowIndex = rowIndex ?? void 0; + this.editingCellRef = editingCellRef; + } + setEditorActive(active) { + if (active) { + this.registerActiveEditor(); + return; + } + this.unregisterActiveEditor(); + } + withSelectionChangeHandlingSuppressed(action) { + const previous = this.suppressSelectionChangeHandling; + this.suppressSelectionChangeHandling = true; + try { + action(); + } finally { + this.suppressSelectionChangeHandling = previous; + } + } + deactivateForFocusLoss() { + if (!this.isActiveEditor()) { + return; + } + this.handleEditorDeactivated(); + this.beans.editSvc?.disableRangeSelectionWhileEditing?.(); + this.unregisterActiveEditor(); + } + registerActiveEditor() { + const fieldId = this.field.getCompId(); + const { formulaInputManager } = this.beans; + if (!formulaInputManager) { + return; + } + const becameActive = formulaInputManager.registerActiveEditor(fieldId, this.handleEditorDeactivated); + if (!becameActive) { + return; + } + this.rangeSelectionEnabled = false; + this.suppressRangeEvents = false; + this.ignoreNextRangeEvent = false; + this.skipNextValueUpdate = false; + this.clearTrackedRanges(false); + const value = this.field.getCurrentValue(); + const hasFormulaPrefix = value.trimStart().startsWith("="); + this.onValueUpdated(value, hasFormulaPrefix); + } + unregisterActiveEditor() { + const fieldId = this.field.getCompId(); + const { formulaInputManager } = this.beans; + if (!formulaInputManager) { + return; + } + formulaInputManager.unregisterActiveEditor(fieldId, this.handleEditorDeactivated); + } + isActiveEditor() { + const fieldId = this.field.getCompId(); + const { formulaInputManager } = this.beans; + return !!formulaInputManager && formulaInputManager.isActiveEditor(fieldId); + } + getTrackedRefCount(ref) { + return this.trackedRangeRefs.get(ref) ?? 0; + } + hasTrackedRef(ref) { + return this.getTrackedRefCount(ref) > 0; + } + addTrackedRef(ref) { + this.trackedRangeRefs.set(ref, this.getTrackedRefCount(ref) + 1); + } + removeTrackedRef(ref) { + const next = this.getTrackedRefCount(ref) - 1; + if (next <= 0) { + this.trackedRangeRefs.delete(ref); + return; + } + this.trackedRangeRefs.set(ref, next); + } + enableRangeSelectionWhileEditing() { + if (this.rangeSelectionEnabled) { + return false; + } + this.rangeSelectionEnabled = true; + this.beans.editSvc?.enableRangeSelectionWhileEditing?.(); + return true; + } + disableRangeSelectionWhileEditing() { + if (!this.rangeSelectionEnabled && !this.trackedRangeRefs.size) { + return; + } + this.rangeSelectionEnabled = false; + this.beans.editSvc?.disableRangeSelectionWhileEditing?.(); + this.clearTrackedRanges(this.isActiveEditor()); + } + clearTrackedRanges(clearGridRanges = true) { + if (clearGridRanges) { + const refs = Array.from(this.trackedRangeRefs.keys()); + refs.forEach((ref) => this.removeRangeForRef(ref)); + } + this.trackedRangeRefs.clear(); + this.trackedRanges.clear(); + } + getLiveRanges() { + return this.beans.rangeSvc?.getCellRanges() ?? []; + } + withSuppressedRangeEvents(action) { + this.suppressRangeEvents = true; + action(); + this.suppressRangeEvents = false; + } + setCellRangesSilently(ranges) { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc) { + return; + } + this.withSuppressedRangeEvents(() => rangeSvc.setCellRanges(ranges)); + } + getColorIndexForTokenOrRef(ref, tokenIndex) { + return this.field.getColorIndexForToken(tokenIndex ?? null) ?? this.field.getColorIndexForRef(ref); + } + normaliseRefForComparison(ref) { + if (!ref) { + return null; + } + const trimmed = ref.endsWith(":") ? ref.slice(0, -1) : ref; + return trimmed.replace(/\$/g, "").toUpperCase(); + } + tagRangeColor(range, ref, colorIndex) { + const { rangeClass } = getColorClassesForRef(ref, colorIndex); + if (range.colorClass === rangeClass) { + return false; + } + tagRangeWithFormulaColor(range, ref, colorIndex); + return true; + } + trackRange(range, ref, tokenIndex) { + const existing = this.trackedRanges.get(range); + const nextTokenIndex = tokenIndex !== void 0 ? tokenIndex : existing?.tokenIndex ?? null; + if (!existing) { + this.addTrackedRef(ref); + } else if (existing.ref !== ref) { + this.removeTrackedRef(existing.ref); + this.addTrackedRef(ref); + } + this.trackedRanges.set(range, { ref, tokenIndex: nextTokenIndex }); + } + getUntrackedFormulaRangesByRef() { + const rangesByRef = /* @__PURE__ */ new Map(); + const ranges = this.getLiveRanges(); + for (const range of ranges) { + if (this.trackedRanges.has(range)) { + continue; + } + if (getRangeColorIndexFromClass(range.colorClass) == null) { + continue; + } + const ref = rangeToRef(this.beans, range); + if (!ref || ref === this.editingCellRef) { + continue; + } + const existing = rangesByRef.get(ref); + if (existing) { + existing.push(range); + } else { + rangesByRef.set(ref, [range]); + } + } + return rangesByRef; + } + syncRangesFromFormula(value) { + const text = value ?? this.field.getCurrentValue() ?? ""; + if (!this.rangeSelectionEnabled) { + this.clearTrackedRanges(); + return; + } + const refTokens = getRefTokensFromText(this.beans, text); + const desiredByRef = /* @__PURE__ */ new Map(); + for (const token of refTokens) { + const { ref, index } = token; + if (ref === this.editingCellRef) { + continue; + } + const list = desiredByRef.get(ref) ?? []; + list.push(index); + desiredByRef.set(ref, list); + } + for (const ref of Array.from(this.trackedRangeRefs.keys())) { + if (!desiredByRef.has(ref)) { + this.removeRangeForRef(ref); + } + } + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc) { + return; + } + const liveRanges = new Set(this.getLiveRanges()); + for (const [range, tracked] of this.trackedRanges.entries()) { + if (!liveRanges.has(range)) { + this.trackedRanges.delete(range); + this.removeTrackedRef(tracked.ref); + } + } + const untrackedFormulaRanges = this.getUntrackedFormulaRangesByRef(); + let reTagged = false; + for (const [ref, tokenIndices] of desiredByRef.entries()) { + const rangesForRef = []; + for (const [range, tracked] of this.trackedRanges.entries()) { + if (tracked.ref === ref) { + rangesForRef.push(range); + } + } + const reuseCandidates = untrackedFormulaRanges.get(ref); + while (rangesForRef.length < tokenIndices.length && reuseCandidates?.length) { + const candidate = reuseCandidates.shift(); + if (candidate) { + rangesForRef.push(candidate); + } + } + while (rangesForRef.length > tokenIndices.length) { + const range = rangesForRef.pop(); + if (range) { + this.removeTrackedRange(range); + } + } + while (rangesForRef.length < tokenIndices.length) { + const tokenIndex = tokenIndices[rangesForRef.length]; + const added = this.addRangeForRef(ref, false, tokenIndex); + if (!added) { + break; + } + rangesForRef.push(added); + } + for (let i = 0; i < rangesForRef.length && i < tokenIndices.length; i++) { + const range = rangesForRef[i]; + const tokenIndex = tokenIndices[i]; + this.trackRange(range, ref, tokenIndex); + const colorIndex = this.getColorIndexForTokenOrRef(ref, tokenIndex); + if (this.tagRangeColor(range, ref, colorIndex)) { + reTagged = true; + } + } + } + const unusedFormulaRanges = []; + for (const ranges of untrackedFormulaRanges.values()) { + if (ranges.length) { + unusedFormulaRanges.push(...ranges); + } + } + if (unusedFormulaRanges.length) { + const currentRanges = this.getLiveRanges(); + const remaining = currentRanges.filter((range) => !unusedFormulaRanges.includes(range)); + if (remaining.length !== currentRanges.length) { + this.setCellRangesSilently(remaining); + reTagged = true; + } + } + if (reTagged) { + this.refreshRangeStyling(); + } + } + onCellSelectionChanged(event) { + if (!this.isActiveEditor() || !this.rangeSelectionEnabled || !this.beans.editSvc?.isRangeSelectionEnabledWhileEditing?.()) { + return; + } + if (this.ignoreNextRangeEvent) { + this.ignoreNextRangeEvent = false; + return; + } + if (this.suppressSelectionChangeHandling) { + return; + } + const { finished, started } = event; + const liveRanges = this.getLiveRanges(); + const nonSpecialRanges = liveRanges.filter((range) => !this.isSpecialOnlyRange(range)); + if (nonSpecialRanges.length !== liveRanges.length) { + this.setCellRangesSilently(nonSpecialRanges); + this.refocusEditingCell(); + return; + } + const latestRange = liveRanges.length ? _last17(liveRanges) : null; + const latestRef = latestRange ? rangeToRef(this.beans, latestRange) : null; + const hasInsertCandidate = !!latestRange && !this.trackedRanges.has(latestRange) && !!latestRef && latestRef !== this.editingCellRef; + const shouldInsert = finished && (started || hasInsertCandidate); + const reTagged = this.ensureTrackedRangeColors(); + if (this.suppressRangeEvents) { + if (reTagged) { + this.refreshRangeStyling(); + } + return; + } + if (started || hasInsertCandidate) { + this.field.rememberCaret(); + } + if (!hasInsertCandidate && this.handleRemovedRangeTokens()) { + this.field.restoreCaretAfterToken(); + this.refocusEditingCell(); + return; + } + if (this.updateTrackedRangeTokens()) { + return; + } + const ref = getLatestRangeRef(this.beans); + if (!ref || ref === this.editingCellRef) { + this.refocusEditingCell(); + return; + } + if (shouldInsert) { + const { action, previousRef, tokenIndex } = this.field.applyRangeInsert(ref); + if (action === "none") { + this.keepLatestSelectionOnly(latestRange); + this.beans.editSvc?.stopEditing(void 0, { source: "edit" }); + return; + } + if (action === "replace" && previousRef === ref) { + this.discardLatestRangeForRef(ref); + this.field.restoreCaretAfterToken(); + this.refocusEditingCell(); + return; + } + this.tagLatestRangeForRef(ref, tokenIndex); + this.handleRangeTokenUpdate(previousRef, ref, true, action === "insert", tokenIndex); + this.syncRangesFromFormula(this.field.getCurrentValue()); + this.field.restoreCaretAfterToken(); + this.refocusEditingCell(); + return; + } + if (!started && !finished) { + const { previousRef, tokenIndex } = this.field.insertOrReplaceToken(ref, false); + this.tagLatestRangeForRef(ref, tokenIndex); + this.handleRangeTokenUpdate(previousRef, ref, false, false); + this.refocusEditingCell(); + return; + } + this.tagLatestRangeForRef(ref); + if (finished) { + this.field.restoreCaretAfterToken(); + this.refocusEditingCell(); + } + } + keepLatestSelectionOnly(latestRange) { + if (!latestRange || this.getLiveRanges().length <= 1) { + return; + } + this.setCellRangesSilently([latestRange]); + } + isSpecialOnlyRange(range) { + const columns = range.columns; + return !!columns?.length && columns.every((col) => isSpecialCol4(col)); + } + handleRangeTokenUpdate(previousRef, ref, manageRanges, isNew, tokenIndex) { + if (manageRanges) { + if (!isNew && previousRef && previousRef !== ref) { + this.removeRangeForRef(previousRef, tokenIndex); + } + this.addRangeForRef(ref, true, tokenIndex); + return; + } + if (isNew || !previousRef) { + this.addTrackedRef(ref); + return; + } + if (previousRef !== ref) { + this.removeTrackedRef(previousRef); + this.addTrackedRef(ref); + } + } + addRangeForRef(ref, skipAddCellRange, tokenIndex) { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc) { + return void 0; + } + let created; + if (!skipAddCellRange) { + const params = getCellRangeParams(this.beans, ref); + if (!params) { + return void 0; + } + this.withSuppressedRangeEvents(() => { + created = rangeSvc.addCellRange(params); + }); + } else { + created = this.findLatestRangeForRef(ref, true) ?? this.findLatestRangeForRef(ref, false); + } + if (created) { + const colorIndex = this.getColorIndexForTokenOrRef(ref, tokenIndex); + this.tagRangeColor(created, ref, colorIndex); + this.trackRange(created, ref, tokenIndex); + this.refreshRangeStyling(); + } + return created; + } + findLatestRangeForRef(ref, skipTracked) { + const ranges = this.getLiveRanges(); + for (let i = ranges.length - 1; i >= 0; i--) { + const range = ranges[i]; + if (rangeToRef(this.beans, range) !== ref) { + continue; + } + if (skipTracked && this.trackedRanges.has(range)) { + continue; + } + return range; + } + return void 0; + } + tagLatestRangeForRef(ref, tokenIndex) { + const { trackedRanges } = this; + const ranges = this.getLiveRanges(); + const latest = ranges.length ? _last17(ranges) : null; + if (!latest) { + return; + } + const trackedIndex = trackedRanges.get(latest)?.tokenIndex ?? null; + const colorIndex = this.getColorIndexForTokenOrRef(ref, tokenIndex ?? trackedIndex); + this.tagRangeColor(latest, ref, colorIndex); + this.refreshRangeStyling(); + } + discardLatestRangeForRef(ref) { + const ranges = this.getLiveRanges(); + if (!ranges.length) { + return; + } + const latest = _last17(ranges); + if (rangeToRef(this.beans, latest) !== ref) { + return; + } + if (this.trackedRanges.has(latest)) { + this.removeTrackedRange(latest); + return; + } + this.setCellRangesSilently(ranges.slice(0, -1)); + } + ensureTrackedRangeColors() { + const ranges = this.getLiveRanges(); + if (!ranges.length) { + return false; + } + let reTagged = false; + for (const range of ranges) { + const tracked = this.trackedRanges.get(range); + const ref = tracked?.ref ?? rangeToRef(this.beans, range); + if (!ref || !this.hasTrackedRef(ref)) { + continue; + } + const tokenIndex = tracked?.tokenIndex ?? null; + const tokenColorIndex = this.field.getColorIndexForToken(tokenIndex); + const inferredColorIndex = getRangeColorIndexFromClass(range.colorClass); + const colorIndex = tokenColorIndex ?? (this.field.hasColorForRef(ref) ? this.field.getColorIndexForRef(ref) : this.field.moveColorToRef(void 0, ref, inferredColorIndex ?? void 0)); + if (colorIndex == null) { + continue; + } + if (this.tagRangeColor(range, ref, colorIndex)) { + reTagged = true; + } + if (!this.trackedRanges.has(range)) { + this.trackRange(range, ref, tokenIndex); + } + } + return reTagged; + } + handleRemovedRangeTokens() { + if (!this.beans.rangeSvc || this.trackedRanges.size === 0) { + return false; + } + const value = this.field.getCurrentValue(); + const tokens = getRefTokensFromText(this.beans, value).filter(({ ref }) => ref !== this.editingCellRef); + if (!tokens.length) { + return false; + } + const liveRanges = this.getLiveRanges(); + const liveSet = new Set(liveRanges); + const liveCounts = /* @__PURE__ */ new Map(); + for (const range of liveRanges) { + const ref = rangeToRef(this.beans, range); + if (!ref || ref === this.editingCellRef) { + continue; + } + liveCounts.set(ref, (liveCounts.get(ref) ?? 0) + 1); + } + const pendingRemovals = /* @__PURE__ */ new Map(); + for (const token of tokens) { + const { ref } = token; + pendingRemovals.set(ref, (pendingRemovals.get(ref) ?? 0) + 1); + } + for (const [ref, tokenCount] of Array.from(pendingRemovals.entries())) { + const liveCount = liveCounts.get(ref) ?? 0; + const remaining = tokenCount - liveCount; + if (remaining > 0) { + pendingRemovals.set(ref, remaining); + } else { + pendingRemovals.delete(ref); + } + } + if (!pendingRemovals.size) { + return false; + } + const removals = []; + for (const [range, tracked] of Array.from(this.trackedRanges.entries())) { + if (liveSet.has(range)) { + continue; + } + const { ref } = tracked; + const remaining = pendingRemovals.get(ref) ?? 0; + if (remaining <= 0) { + continue; + } + pendingRemovals.set(ref, remaining - 1); + removals.push({ range, tracked }); + } + if (!removals.length) { + return false; + } + removals.sort((a, b) => (b.tracked.tokenIndex ?? -1) - (a.tracked.tokenIndex ?? -1)); + let removed = false; + for (const { range, tracked } of removals) { + const { ref, tokenIndex } = tracked; + removed = this.field.removeTokenRef(ref, tokenIndex ?? null) || removed; + this.trackedRanges.delete(range); + this.removeTrackedRef(ref); + } + if (removed) { + this.syncRangesFromFormula(this.field.getCurrentValue()); + } + return removed; + } + refreshRangeStyling() { + const { eventSvc } = this.beans; + if (!eventSvc) { + return; + } + this.ensureTrackedRangeColors(); + this.ignoreNextRangeEvent = true; + eventSvc.dispatchEvent({ + type: "cellSelectionChanged", + started: false, + finished: false + }); + } + refocusEditingCell() { + const { focusSvc } = this.beans; + const { editingColumn, editingRowIndex } = this; + if (!focusSvc || editingColumn == null || editingRowIndex == null) { + return; + } + focusSvc.setFocusedCell({ + column: editingColumn, + rowIndex: editingRowIndex, + rowPinned: null, + preventScrollOnBrowserFocus: true + }); + } + removeTrackedRange(range) { + const tracked = this.trackedRanges.get(range); + if (!tracked) { + return; + } + const ranges = this.getLiveRanges(); + const remaining = ranges.filter((candidate) => candidate !== range); + if (remaining.length !== ranges.length) { + this.setCellRangesSilently(remaining); + } + this.trackedRanges.delete(range); + this.removeTrackedRef(tracked.ref); + } + removeRangeForRef(ref, tokenIndex) { + if (!ref || !this.hasTrackedRef(ref)) { + return; + } + if (tokenIndex != null) { + let removed = false; + for (const [range, tracked] of Array.from(this.trackedRanges.entries())) { + const { ref: trackedRef, tokenIndex: trackedTokenIndex } = tracked; + if (trackedRef !== ref || trackedTokenIndex !== tokenIndex) { + continue; + } + this.removeTrackedRange(range); + removed = true; + break; + } + if (!removed) { + for (const [range, tracked] of Array.from(this.trackedRanges.entries())) { + if (tracked.ref === ref) { + this.removeTrackedRange(range); + break; + } + } + } + return; + } + for (const [range, tracked] of Array.from(this.trackedRanges.entries())) { + if (tracked.ref === ref) { + this.removeTrackedRange(range); + } + } + } + updateTrackedRangeTokens() { + if (!this.beans.rangeSvc) { + return false; + } + const ranges = this.getLiveRanges(); + const editingRef = this.normaliseRefForComparison(this.editingCellRef); + let updated = false; + for (const range of ranges) { + const tracked = this.trackedRanges.get(range); + if (!tracked) { + continue; + } + const { ref: previousRef, tokenIndex } = tracked; + const nextRef = rangeToRef(this.beans, range); + const normalisedPrevious = this.normaliseRefForComparison(previousRef); + const normalisedNext = this.normaliseRefForComparison(nextRef); + if (!nextRef || !normalisedNext || normalisedNext === normalisedPrevious || normalisedNext === editingRef) { + continue; + } + const { colorClass } = range; + const tokenColorIndex = this.field.getColorIndexForToken(tokenIndex ?? null); + const colorIndex = tokenColorIndex ?? this.field.moveColorToRef(previousRef, nextRef, getRangeColorIndexFromClass(colorClass) ?? void 0); + const replacedIndex = this.field.replaceTokenRef(previousRef, nextRef, colorIndex, tokenIndex); + if (replacedIndex == null) { + continue; + } + this.tagRangeColor(range, nextRef, colorIndex); + this.trackRange(range, nextRef, replacedIndex ?? tokenIndex ?? null); + updated = true; + } + if (updated) { + this.refreshRangeStyling(); + } + return updated; + } +}; + +// packages/ag-grid-enterprise/src/widgets/agFormulaInputField.ts +var FORMULA_TOKEN_COLOR_COUNT = 7; +var DISPLAY_OPERATOR_LOOKUP = { + "/": "\xF7", + "*": "\xD7" +}; +var VALUE_OPERATOR_LOOKUP = { + "\xF7": "/", + "\xD7": "*" +}; +var AgFormulaInputField = class extends AgContentEditableField { + constructor() { + super({ renderValueToElement: false, className: "ag-formula-input-field" }); + this.currentValue = ""; + // caret / token bookkeeping so range updates can re-render without losing position. + this.selectionCaretOffset = null; + this.lastTokenValueOffset = null; + this.lastTokenValueLength = null; + this.lastTokenCaretOffset = null; + // record mouse focus so we don't jump the caret to the end after a click. + this.focusFromMouseTime = null; + // skip auto-caret placement when we are restoring a caret programmatically. + this.suppressNextFocusCaretPlacement = false; + // fallback color assignment per ref when a token index is unavailable. + this.formulaColorByRef = /* @__PURE__ */ new Map(); + this.registerCSS(agFormulaInputField_default); + this.registerCSS(agAutocomplete_default); + } + postConstruct() { + super.postConstruct(); + this.rangeSyncFeature = this.createManagedBean(new FormulaInputRangeSyncFeature(this)); + this.autocompleteFeature = this.createManagedBean(new FormulaInputAutocompleteFeature(this)); + this.addManagedElementListeners(this.getContentElement(), { + input: this.onContentInput.bind(this), + focus: this.onContentFocus.bind(this), + blur: this.onContentBlur.bind(this), + mousedown: this.onContentMouseDown.bind(this) + }); + } + setValue(value, silent) { + const text = value == null ? "" : String(value); + const { isFormula, hasFormulaPrefix } = this.getFormulaState(text); + if (!isFormula) { + this.applyPlainValue(text, { silent, dispatch: true }); + this.rangeSyncFeature?.onValueUpdated(text, hasFormulaPrefix); + return this; + } + this.applyFormulaValue(text, { currentValue: this.getCurrentValue(), silent }); + this.rangeSyncFeature?.onValueUpdated(text, hasFormulaPrefix); + return this; + } + getCurrentValue() { + const liveValue = serializeContent(this.getContentElement()); + if (liveValue !== this.currentValue) { + this.setEditorValue(liveValue, true); + } + return this.currentValue; + } + setEditingCellRef(column, rowIndex) { + const colRef = column ? this.beans.formula?.getColRef(column) : void 0; + const editingCellRef = colRef && rowIndex != null && rowIndex !== void 0 ? `${colRef}${rowIndex + 1}` : void 0; + if (!editingCellRef) { + this.rangeSyncFeature?.setEditingCellRef(void 0, void 0, void 0); + return; + } + this.rangeSyncFeature?.setEditingCellRef(column, rowIndex, editingCellRef); + } + rememberCaret() { + const caretOffset = getCaretOffset(this.beans, this.getContentElement(), this.getCurrentValue()); + this.selectionCaretOffset = caretOffset ?? this.currentValue.length; + } + setEditorValue(value, silent = false) { + this.currentValue = value; + super.setValue(value, silent); + return this; + } + renderFormula(params) { + renderFormula({ + beans: this.beans, + contentElement: this.getContentElement(), + getColorIndexForToken: this.getColorIndexForToken.bind(this), + ...params + }); + } + renderPlainValue(value, caret) { + const contentElement = this.getContentElement(); + const caretOffset = caret ?? getCaretOffset(this.beans, contentElement, this.currentValue); + contentElement.textContent = value ?? ""; + const targetCaret = caretOffset != null ? Math.min(caretOffset, value.length) : null; + restoreCaret(this.beans, contentElement, targetCaret); + } + withSelectionChangeHandlingSuppressed(action) { + if (!this.rangeSyncFeature) { + action(); + return; + } + this.rangeSyncFeature.withSelectionChangeHandlingSuppressed(action); + } + getColorIndexForRef(ref) { + if (!shouldUseTokenColors(this.beans)) { + return null; + } + const existing = this.formulaColorByRef.get(ref); + if (existing != null) { + return existing; + } + const next = this.formulaColorByRef.size % FORMULA_TOKEN_COLOR_COUNT; + this.formulaColorByRef.set(ref, next); + return next; + } + getColorIndexForToken(tokenIndex) { + if (!shouldUseTokenColors(this.beans) || tokenIndex == null) { + return null; + } + return tokenIndex % FORMULA_TOKEN_COLOR_COUNT; + } + hasColorForRef(ref) { + return this.formulaColorByRef.has(ref); + } + moveColorToRef(fromRef, toRef, fallback) { + const colorIndex = fromRef && this.formulaColorByRef.has(fromRef) ? this.getColorIndexForRef(fromRef) : fallback ?? this.formulaColorByRef.get(toRef) ?? this.getColorIndexForRef(toRef); + if (fromRef && fromRef !== toRef) { + this.formulaColorByRef.delete(fromRef); + } + if (colorIndex == null) { + return null; + } + this.formulaColorByRef.set(toRef, colorIndex); + return colorIndex; + } + updateFormulaColorsFromValue(value) { + value = value == null ? "" : String(value); + if (!shouldUseTokenColors(this.beans)) { + this.formulaColorByRef.clear(); + return; + } + const refsInOrder = getOrderedRefs(this.beans, value); + let changed = refsInOrder.length !== this.formulaColorByRef.size; + const nextColors = /* @__PURE__ */ new Map(); + refsInOrder.forEach((ref, index) => { + const colorIndex = index % FORMULA_TOKEN_COLOR_COUNT; + nextColors.set(ref, colorIndex); + if (this.formulaColorByRef.get(ref) !== colorIndex) { + changed = true; + } + }); + if (!changed) { + return; + } + this.formulaColorByRef.clear(); + nextColors.forEach((colorIndex, ref) => this.formulaColorByRef.set(ref, colorIndex)); + } + onContentInput() { + const contentElement = this.getContentElement(); + const currentValue = this.getCurrentValue(); + const caret = getCaretOffset(this.beans, contentElement, currentValue); + const serialized = serializeContent(contentElement); + const { isFormula, hasFormulaPrefix } = this.getFormulaState(serialized); + if (!isFormula) { + this.applyPlainValue(serialized, { caret, dispatch: true }); + this.rangeSyncFeature?.onValueUpdated(serialized, hasFormulaPrefix); + return; + } + this.applyFormulaValue(serialized, { currentValue, caret: caret ?? void 0, dispatch: true }); + this.rangeSyncFeature?.onValueUpdated(serialized, hasFormulaPrefix); + } + onContentFocus() { + this.rangeSyncFeature?.setEditorActive(true); + if (this.suppressNextFocusCaretPlacement) { + this.suppressNextFocusCaretPlacement = false; + return; + } + const { focusFromMouseTime } = this; + const focusFromMouse = focusFromMouseTime != null; + this.focusFromMouseTime = null; + if (focusFromMouse) { + return; + } + _placeCaretAtEnd(this.beans, this.getContentElement()); + } + onContentBlur(event) { + this.focusFromMouseTime = null; + const nextTarget = event.relatedTarget; + const editorTarget = nextTarget?.closest(".ag-cell-editor"); + const cellTarget = nextTarget?.closest(".ag-cell"); + if (!nextTarget || this.getGui().contains(nextTarget) || !editorTarget || !cellTarget) { + return; + } + this.rangeSyncFeature?.deactivateForFocusLoss(); + } + onContentMouseDown() { + this.focusFromMouseTime = Date.now(); + } + insertOrReplaceToken(ref, isNew) { + const offsets = this.getTokenInsertOffsets(isNew); + if (!offsets) { + return {}; + } + const { caretOffset, valueOffset } = offsets; + const replaceLen = isNew || this.lastTokenValueLength == null ? 0 : this.lastTokenValueLength; + const value = this.getCurrentValue(); + const updatedValue = value.slice(0, valueOffset) + ref + value.slice(valueOffset + replaceLen); + const tokenIndex = getTokenMatchAtOffset(this.beans, updatedValue, valueOffset)?.index ?? null; + let previousRef; + this.applyFormulaValueChange({ + currentValue: value, + nextValue: updatedValue, + caret: caretOffset + ref.length, + updateTracking: () => { + previousRef = this.updateLastTokenTracking(ref, caretOffset, valueOffset); + } + }); + return { previousRef, tokenIndex }; + } + removeTokenRef(ref, tokenIndex) { + const value = this.getCurrentValue(); + const matches = getRefTokenMatchesForFormula(this.beans, value); + let token; + if (tokenIndex != null) { + token = matches.find((match) => match.index === tokenIndex); + if (token && token.ref !== ref) { + token = void 0; + } + } + if (!token) { + token = matches.find((match) => match.ref === ref); + } + if (!token) { + return false; + } + const updated = value.slice(0, token.start) + value.slice(token.end); + const caretBase = this.selectionCaretOffset ?? token.start; + const caret = Math.min(caretBase, updated.length); + this.applyFormulaValueChange({ + currentValue: value, + nextValue: updated, + caret, + updateTracking: () => { + this.lastTokenValueOffset = null; + this.lastTokenValueLength = null; + this.lastTokenCaretOffset = caret; + this.lastTokenRef = void 0; + } + }); + return true; + } + applyRangeInsert(ref) { + const value = this.getCurrentValue(); + const caretOffsets = this.getCaretOffsets(value); + if (!caretOffsets) { + const { previousRef: previousRef2, tokenIndex: tokenIndex2 } = this.insertOrReplaceToken(ref, true); + return { action: "insert", previousRef: previousRef2, tokenIndex: tokenIndex2 }; + } + const { valueOffset } = caretOffsets; + const tokenMatch = getTokenMatchAtOffset(this.beans, value, valueOffset); + if (tokenMatch) { + const { end: tokenEnd, ref: tokenRef } = tokenMatch; + if (tokenRef.endsWith(":") && valueOffset === tokenEnd) { + const { previousRef: previousRef3, tokenIndex: tokenIndex3 } = this.insertOrReplaceToken(ref, true); + return { action: "insert", previousRef: previousRef3, tokenIndex: tokenIndex3 }; + } + const { previousRef: previousRef2, tokenIndex: tokenIndex2 } = this.replaceTokenAtMatch(tokenMatch, ref); + return { action: "replace", previousRef: previousRef2, tokenIndex: tokenIndex2 }; + } + const rawTokenMatch = getRawTokenMatchAtOffset(value, valueOffset); + if (rawTokenMatch) { + const updated = value.slice(0, rawTokenMatch.start) + ref + value.slice(rawTokenMatch.end); + const tokenIndex2 = getTokenMatchAtOffset(this.beans, updated, rawTokenMatch.start)?.index ?? null; + const { previousRef: previousRef2 } = this.replaceTokenAtMatch(rawTokenMatch, ref, tokenIndex2); + return { action: "replace", previousRef: previousRef2, tokenIndex: tokenIndex2 }; + } + if (!shouldInsertTokenAtOffset(value, valueOffset)) { + return { action: "none" }; + } + const { previousRef, tokenIndex } = this.insertOrReplaceToken(ref, true); + return { action: "insert", previousRef, tokenIndex }; + } + restoreCaretAfterToken() { + const caretBase = this.lastTokenCaretOffset ?? getCaretOffset(this.beans, this.getContentElement(), this.getCurrentValue()) ?? this.currentValue.length; + const caret = caretBase + (this.lastTokenValueLength ?? 0); + this.selectionCaretOffset = null; + this.suppressNextFocusCaretPlacement = true; + setTimeout(() => { + if (!this.isAlive()) { + return; + } + this.getContentElement().focus({ preventScroll: true }); + if (_getDocument6(this.beans).activeElement === this.getContentElement()) { + this.suppressNextFocusCaretPlacement = false; + } + restoreCaret(this.beans, this.getContentElement(), caret); + }); + } + replaceTokenAtMatch(token, nextRef, tokenIndexOverride) { + const value = this.getCurrentValue(); + const updated = value.slice(0, token.start) + nextRef + value.slice(token.end); + this.applyFormulaValueChange({ + currentValue: value, + nextValue: updated, + caret: token.start + nextRef.length, + updateTracking: () => { + this.updateLastTokenTracking(nextRef, token.start, token.start); + } + }); + return { previousRef: token.ref, tokenIndex: tokenIndexOverride ?? token.index }; + } + getValueOffsetFromCaret(caretOffset) { + const container = this.getContentElement(); + let caretRemaining = caretOffset; + let valueOffset = 0; + for (const child of Array.from(container.childNodes)) { + const caretLen = _getNodeTextLength(child); + const valueLen = getNodeText(child).length; + if (caretRemaining <= caretLen) { + return valueOffset + (caretLen === valueLen ? caretRemaining : 0); + } + caretRemaining -= caretLen; + valueOffset += valueLen; + } + return this.currentValue.length; + } + getTokenInsertOffsets(isNew) { + return this.getCaretOffsets(this.getCurrentValue(), { + useCachedCaret: true, + useCachedValueOffset: !isNew + }); + } + getCaretOffsetsForAutocomplete(value) { + return this.getCaretOffsets(value); + } + getCaretOffsets(value, options = { + useCachedCaret: false, + useCachedValueOffset: false + }) { + const { beans } = this; + const { useCachedCaret, useCachedValueOffset } = options; + const contentElement = this.getContentElement(); + const caretOffset = useCachedCaret ? this.selectionCaretOffset ?? getCaretOffset(beans, contentElement, value) ?? this.currentValue.length : getCaretOffset(beans, contentElement, value); + if (caretOffset == null) { + return null; + } + const valueOffset = useCachedValueOffset && this.lastTokenValueOffset != null ? this.lastTokenValueOffset : this.getValueOffsetFromCaret(caretOffset); + if (valueOffset == null) { + return null; + } + return { caretOffset, valueOffset }; + } + updateLastTokenTracking(ref, caretOffset, valueOffset) { + const previousRef = this.lastTokenRef; + this.lastTokenValueOffset = valueOffset; + this.lastTokenValueLength = ref.length; + this.lastTokenCaretOffset = caretOffset; + this.lastTokenRef = ref; + return previousRef; + } + getFormulaState(text) { + const hasFormulaPrefix = text.trimStart().startsWith("="); + const isFormula = this.beans.formula?.isFormula(text) ?? hasFormulaPrefix; + return { isFormula, hasFormulaPrefix }; + } + dispatchValueChanged() { + this.dispatchLocalEvent({ type: "fieldValueChanged" }); + } + applyPlainValue(value, params) { + this.formulaColorByRef.clear(); + this.renderPlainValue(value, params.caret); + this.setEditorValue(value, params.silent); + if (params.dispatch) { + this.dispatchValueChanged(); + } + this.autocompleteFeature?.onPlainValueUpdated(); + } + applyFormulaValue(value, params) { + this.updateFormulaColorsFromValue(value); + this.renderFormula({ + value, + currentValue: params.currentValue ?? this.getCurrentValue(), + caret: params.caret ?? void 0 + }); + this.setEditorValue(value, params.silent); + if (params.dispatch) { + this.dispatchValueChanged(); + } + this.autocompleteFeature?.onFormulaValueUpdated(); + } + applyFormulaValueChange(params) { + const { currentValue, nextValue, caret } = params; + this.updateFormulaColorsFromValue(nextValue); + params.updateTracking?.(); + this.setEditorValue(nextValue); + this.renderFormula({ + currentValue, + value: nextValue, + caret + }); + this.dispatchValueChanged(); + this.autocompleteFeature?.onFormulaValueUpdated(); + } + replaceTokenRef(previousRef, nextRef, colorIndex, tokenIndex) { + const contentElement = this.getContentElement(); + let token; + if (tokenIndex != null) { + token = contentElement.querySelector( + `.ag-formula-token[data-formula-token-index="${tokenIndex}"]` + ) ?? void 0; + if (token && getTokenRef(token) !== previousRef) { + token = void 0; + } + } + if (!token) { + token = Array.from(contentElement.querySelectorAll(".ag-formula-token")).find( + (node) => getTokenRef(node) === previousRef + ); + } + if (!token) { + return null; + } + const caretOffset = getOffsetBeforeNode(contentElement, token); + const valueOffset = getOffsetBeforeNode(contentElement, token, true); + if (caretOffset == null || valueOffset == null) { + return null; + } + const value = this.getCurrentValue(); + if (colorIndex != null) { + this.formulaColorByRef.set(nextRef, colorIndex); + } + const updated = value.slice(0, valueOffset) + nextRef + value.slice(valueOffset + previousRef.length); + const resolvedIndex = getTokenIndex(token); + this.applyFormulaValueChange({ + currentValue: value, + nextValue: updated, + caret: caretOffset + nextRef.length, + updateTracking: () => { + this.updateLastTokenTracking(nextRef, caretOffset, valueOffset); + } + }); + return resolvedIndex ?? tokenIndex ?? null; + } +}; +var shouldUseTokenColors = (beans) => { + const { gos, rangeSvc } = beans; + const canCreateRanges = !!rangeSvc && !!gos.get("cellSelection"); + return canCreateRanges; +}; +var getOrderedRefs = (beans, value) => { + const refsInOrder = []; + const seen = /* @__PURE__ */ new Set(); + for (const match of getRefTokenMatchesForFormula(beans, value)) { + const ref = match.ref; + if (seen.has(ref)) { + continue; + } + seen.add(ref); + refsInOrder.push(ref); + } + return refsInOrder; +}; +var getTokenMatchAtOffset = (beans, value, offset) => { + for (const match of getRefTokenMatchesForFormula(beans, value)) { + if (offset >= match.start && offset <= match.end) { + return { ref: match.ref, start: match.start, end: match.end, index: match.index }; + } + } + return null; +}; +var getRawTokenMatchAtOffset = (value, offset) => { + for (const match of getRefTokenMatches(value)) { + if (offset >= match.start && offset <= match.end) { + return { ref: match.ref, start: match.start, end: match.end, index: match.index }; + } + } + return null; +}; +var shouldInsertTokenAtOffset = (value, offset) => { + const previousChar = getPreviousNonSpaceChar(value, offset); + return previousChar == null || TOKEN_INSERT_AFTER_CHARS.has(previousChar); +}; +var tokenize = (beans, value, getColorIndexForToken) => { + const nodes = []; + let lastIndex = 0; + const matches = getRefTokenMatchesForFormula(beans, value); + const doc = _getDocument6(beans); + for (const match of matches) { + if (match.start > lastIndex) { + nodes.push(doc.createTextNode(formatForDisplay(value.slice(lastIndex, match.start)))); + } + const colorIndex = getColorIndexForToken(match.index); + nodes.push(createReferenceNode(match.ref, colorIndex, colorIndex != null, match.index)); + lastIndex = match.end; + } + if (lastIndex < value.length) { + nodes.push(doc.createTextNode(formatForDisplay(value.slice(lastIndex)))); + } + if (!nodes.length) { + nodes.push(doc.createTextNode("")); + } + return nodes; +}; +var createReferenceNode = (ref, colorIndex, useTokenColors, tokenIndex) => { + const attrs = { + "aria-label": ref, + "data-formula-ref": ref, + "data-formula-token-index": tokenIndex.toString() + }; + let tokenClass; + if (useTokenColors && colorIndex != null) { + const classes = getColorClassesForRef(ref, colorIndex); + tokenClass = classes.tokenClass; + attrs["data-formula-range-class"] = classes.rangeClass; + } + const node = _createElement16({ + tag: "span", + cls: "ag-formula-token", + attrs, + children: ref + }); + if (tokenClass) { + node.classList.add(tokenClass); + } + return node; +}; +var renderFormula = (params) => { + const { beans, contentElement, currentValue, value, getColorIndexForToken, caret } = params; + const caretOffset = caret ?? getCaretOffset(beans, contentElement, currentValue); + const maxCaret = value.length; + contentElement.textContent = ""; + for (const node of tokenize(beans, value, getColorIndexForToken)) { + contentElement.append(node); + } + const targetCaret = caretOffset != null ? Math.min(caretOffset, maxCaret) : null; + restoreCaret(beans, contentElement, targetCaret); +}; +var getOffsetBeforeNode = (container, node, useValueLength = false) => { + if (!container.contains(node)) { + return null; + } + let offset = 0; + for (const child of Array.from(container.childNodes)) { + if (child === node) { + return offset; + } + offset += useValueLength ? getNodeText(child).length : _getNodeTextLength(child); + } + return null; +}; +var serializeContent = (contentElement) => { + let output = ""; + contentElement.childNodes.forEach((child) => { + output += getNodeText(child); + }); + return output; +}; +var getNodeText = (node) => { + if (node.nodeType === Node.TEXT_NODE) { + return formatForValue(node.textContent ?? ""); + } + if (node.nodeType === Node.ELEMENT_NODE) { + return Array.from(node.childNodes).map((child) => getNodeText(child)).join(""); + } + return ""; +}; +var _getNodeTextLength = (node) => { + if (node.nodeType === Node.TEXT_NODE) { + return node.textContent?.length ?? 0; + } + if (node.nodeType === Node.ELEMENT_NODE) { + return Array.from(node.childNodes).reduce((sum, child) => sum + _getNodeTextLength(child), 0); + } + return 0; +}; +var findNodeAtOffset = (root, offset) => { + let remaining = offset; + for (let i = 0; i < root.childNodes.length; i++) { + const child = root.childNodes[i]; + const length = _getNodeTextLength(child); + if (remaining > length) { + remaining -= length; + continue; + } + if (child.nodeType === Node.TEXT_NODE) { + return { node: child, localOffset: remaining }; + } + return findNodeAtOffset(child, remaining); + } + return { node: root, localOffset: root.childNodes.length }; +}; +var restoreCaret = (beans, contentElement, offset) => { + if (offset == null) { + return; + } + const win = _getWindow(beans); + const doc = _getDocument6(beans); + const selection = win.getSelection(); + const range = doc.createRange(); + const { node, localOffset } = findNodeAtOffset(contentElement, offset); + if (!node || !selection || !contentElement.isConnected || !node.isConnected) { + return; + } + range.setStart(node, localOffset); + range.collapse(true); + selection.removeAllRanges(); + try { + selection.addRange(range); + } catch { + } +}; +var getCaretOffset = (beans, contentElement, currentValue) => { + const win = _getWindow(beans); + const selection = win.getSelection(); + if (!selection || selection.rangeCount === 0) { + return currentValue?.length ?? null; + } + const range = selection.getRangeAt(0); + if (!contentElement.contains(range.startContainer)) { + return currentValue?.length ?? null; + } + if (range.startContainer === contentElement) { + let offset2 = 0; + for (let i = 0; i < range.startOffset; i++) { + offset2 += _getNodeTextLength(contentElement.childNodes[i]); + } + return offset2; + } + let offset = range.startOffset; + let node = range.startContainer; + while (node && node !== contentElement) { + let sibling = node.previousSibling; + while (sibling) { + offset += _getNodeTextLength(sibling); + sibling = sibling.previousSibling; + } + node = node.parentNode; + } + return offset; +}; +var getTokenRef = (tokenEl) => formatForValue(tokenEl.textContent ?? tokenEl.dataset.formulaRef ?? ""); +var getTokenIndex = (tokenEl) => { + const raw = tokenEl.dataset.formulaTokenIndex; + if (!raw) { + return null; + } + const parsed = parseInt(raw, 10); + return Number.isFinite(parsed) ? parsed : null; +}; +var formatForDisplay = (text) => text.replace(/[/*]/g, (match) => DISPLAY_OPERATOR_LOOKUP[match] ?? match); +var formatForValue = (text) => text.replace(/[÷×]/g, (match) => VALUE_OPERATOR_LOOKUP[match] ?? match); + +// packages/ag-grid-enterprise/src/formula/i18n.ts +var FORMULA_ERRORS = { + 1: ["invalidFormulaValidation", "Invalid formula."], + 2: ["formulaParseInvalidCellReference", "Invalid cell reference: ${variable}."], + 3: ["formulaParseInvalidRangeEndReference", "Invalid range end reference."], + 4: ["formulaParseUnterminatedString", "Unterminated string."], + 5: ["formulaParseUnexpectedCharacter", "Unexpected character: ${variable}."], + 6: ["formulaParseOperatorStackUnderflow", "Operator stack underflow."], + 7: ["formulaParseMissingOperand", "Missing operand for '${variable}'."], + 8: ["formulaParseInternalUnexpectedFrameDuringReduction", "Internal error: unexpected frame during reduction."], + 9: ["formulaParseInternalUnexpectedFrameBeforeOpenParen", "Internal error: unexpected frame before '('."], + 10: ["formulaParseMisplacedComma", "Misplaced comma."], + 11: ["formulaParseCommaOutsideFunctionCall", "Comma outside of a function call."], + 12: ["formulaParseInternalUnexpectedFrameBeforeCloseParen", "Internal error: unexpected frame before ')'."], + 13: ["formulaParseMismatchedParentheses", "Mismatched parentheses."], + 14: ["formulaParseUnsupportedOperand", "Unsupported operand: ${variable}."], + 15: [ + "formulaParseMismatchedParenthesesOrUnfinishedFunctionCall", + "Mismatched parentheses or unfinished function call." + ], + 16: ["formulaParseInvalidExpression", "Invalid expression."], + 17: ["formulaParseFormulasMustBeginWithEquals", "Formulas must begin with =."], + 18: [ + "formulaSerializeStringContainsQuote", + 'String contains a quote (") which the tokenizer does not support.', + "#PARSE!" + ], + 19: [ + "formulaSerializeCannotProduceAbsoluteColumnLabelFromId", + "Cannot produce absolute COLUMN label from id '${variable}'." + ], + 20: [ + "formulaSerializeCannotProduceAbsoluteRowIndexFromId", + "Cannot produce absolute ROW index from id '${variable}'." + ], + 21: ["formulaSerializeCannotProduceRowIndexFromId", "Cannot produce ROW index from id '${variable}'."], + 22: ["formulaSerializeCannotMapColumnIdToA1Label", "Cannot map column id '${variable}' to A1 label."], + 23: ["formulaSerializeCannotParseAbsoluteRowIndex", "Cannot parse absolute row index '${variable}'."], + 24: ["formulaSerializeCannotMapRowIdToA1Index", "Cannot map row id '${variable}' to A1 index."], + 25: ["formulaEvalRangeNotAllowedInScalarContext", "Range is not allowed in scalar context."], + 26: ["formulaEvalUnknownReferenceToCell", "Unknown reference to cell.", "#REF!"], + 27: ["formulaEvalUnsupportedOperation", "Unsupported operation ${variable}.", "#NAME?"], + 28: ["formulaEvalInvalidAbsoluteRow", "Invalid absolute row.", "#REF!"], + 29: ["formulaEvalUnrecognisedRowId", "Unrecognised row id.", "#REF!"], + 30: ["formulaEvalInvalidAbsoluteColumn", "Invalid absolute column.", "#REF!"], + 31: ["formulaEvalUnrecognisedColumnId", "Unrecognised column id.", "#REF!"], + 32: ["formulaEvalUnrecognisedRowInRange", "Unrecognised row in range.", "#REF!"], + 33: ["formulaEvalUnrecognisedReferenceToCell", "Unrecognised reference to cell.", "#REF!"], + 34: ["formulaEvalIncompleteRangeReference", "Incomplete range reference.", "#REF!"], + 35: ["formulaFunctionExpectedExactlyArguments", "${variable}: expected exactly ${variable} arguments."], + 36: ["formulaFunctionExpectedAtMostArguments", "${variable}: expected at most ${variable} arguments."], + 37: ["formulaFunctionExpectedAtLeastArguments", "${variable}: expected at least ${variable} arguments."], + 38: [ + "formulaFunctionInvalidCriteriaWildcardsWithComparator", + "Invalid criteria: wildcards with comparator.", + "#VALUE!" + ], + 39: ["formulaFunctionNonNumericArgument", "${variable}: non-numeric argument.", "#VALUE!"], + 40: ["formulaFunctionDivisionByZero", "${variable}: division by zero.", "#DIV/0!"], + 41: ["formulaFunctionCannotCombineDatesWithBigInt", "${variable}: cannot combine dates with BigInt.", "#VALUE!"], + 42: [ + "formulaFunctionRequiresAtLeastOneNumericValue", + "${variable}: requires at least one numeric value.", + "#PARSE!" + ], + 43: ["formulaFunctionRequiresAtLeastOneValue", "${variable}: requires at least one value."], + 44: ["formulaFunctionAllValuesMustBeNumbers", "${variable}: all values must be numbers.", "#VALUE!"], + 45: ["formulaFunctionArgumentMustBeRange", "${variable}: ${variable} argument must be a range.", "#VALUE!"], + 46: ["formulaFunctionArgumentMustBeValue", "${variable}: ${variable} argument must be a value.", "#VALUE!"], + 47: ["formulaFunctionRangesHaveDifferentSizes", "${variable}: ranges have different sizes.", "#VALUE!"], + 48: ["formulaFunctionValuesMustBeNumeric", "${variable}: values must be numeric.", "#VALUE!"], + 49: ["formulaFunctionValuesMustBeIntegers", "${variable}: values must be integers.", "#VALUE!"], + 50: ["formulaFunctionUnsupportedValueType", "${variable}: unsupported value type.", "#VALUE!"], + 51: ["formulaServiceCircularReference", "Circular reference.", "#CIRCREF!"], + 52: ["formulaServiceExpectedParsableFormula", "Expected parsable formula.", "#PARSE!"], + 53: ["formulaServiceInternalSchedulingError", "Internal scheduling error."], + 54: ["formulaFunctionDivNonNumericArgument", "DIV: non-numeric argument.", "#VALUE!"], + 55: ["formulaFunctionDivDivisionByZero", "DIV: division by zero.", "#DIV/0!"], + 56: ["formulaFunctionSumCannotCombineDatesWithBigInt", "SUM: cannot combine dates with BigInt.", "#VALUE!"], + 57: ["formulaFunctionSumRequiresAtLeastOneNumericValue", "SUM: requires at least one numeric value.", "#PARSE!"], + 58: ["formulaFunctionAvgRequiresAtLeastOneValue", "AVG: requires at least one value."], + 59: ["formulaFunctionMedianAllValuesMustBeNumbers", "MEDIAN: all values must be numbers.", "#VALUE!"], + 60: ["formulaFunctionMedianRequiresAtLeastOneValue", "MEDIAN: requires at least one value."], + 61: ["formulaFunctionSumifFirstArgumentMustBeRange", "SUMIF: first argument must be a range.", "#VALUE!"], + 62: [ + "formulaFunctionSumifSecondArgumentMustBeValue", + "SUMIF: second argument must be a value (criteria).", + "#VALUE!" + ], + 63: [ + "formulaFunctionSumifThirdArgumentMustBeRange", + "SUMIF: third argument must be a range (sum_range).", + "#VALUE!" + ], + 64: ["formulaFunctionSumifRangesHaveDifferentSizes", "SUMIF: ranges have different sizes.", "#VALUE!"], + 65: ["formulaFunctionCountifFirstArgumentMustBeRange", "COUNTIF: first argument must be a range.", "#VALUE!"], + 66: [ + "formulaFunctionCountifSecondArgumentMustBeValue", + "COUNTIF: second argument must be a value (criteria).", + "#VALUE!" + ], + 67: ["formulaFunctionConcatUnsupportedValueType", "CONCAT: unsupported value type.", "#VALUE!"], + 68: ["formulaFunctionMinRequiresAtLeastOneValue", "MIN: requires at least one value."], + 69: ["formulaFunctionMaxRequiresAtLeastOneValue", "MAX: requires at least one value."], + 70: ["formulaFunctionPercentNonNumericArgument", "PERCENT: non-numeric argument.", "#VALUE!"], + 71: ["formulaFunctionPowerNonNumericArgument", "POWER: non-numeric argument.", "#VALUE!"] +}; +var interpolateVariables = (template, variableValues) => { + if (!variableValues?.length) { + return template; + } + let localisedText = template; + let found = 0; + while (found < variableValues.length) { + const idx = localisedText.indexOf("${variable}"); + if (idx === -1) { + break; + } + localisedText = localisedText.replace("${variable}", variableValues[found++]); + } + return localisedText; +}; +var normaliseVariableValues = (values) => { + if (!values?.length) { + return void 0; + } + return values.map((value) => String(value)); +}; +var getFormulaErrorDefinition = (errorId) => { + return FORMULA_ERRORS[errorId]; +}; +var getFormulaErrorDefaultMessage = (errorId, variableValues) => { + const [, defaultMessage] = getFormulaErrorDefinition(errorId); + return interpolateVariables(defaultMessage, normaliseVariableValues(variableValues)); +}; +var translateFormulaError = (translate, errorId, variableValues) => { + const [localeKey, defaultMessage] = getFormulaErrorDefinition(errorId); + const normalizedVariableValues = normaliseVariableValues(variableValues); + return translate(localeKey, defaultMessage, normalizedVariableValues); +}; + +// packages/ag-grid-enterprise/src/formula/editor/formulaCellEditor.ts +var FormulaCellEditor = class extends AgAbstractCellEditor2 { + constructor() { + super({ tag: "div", cls: "ag-cell-edit-wrapper" }); + this.eEditor = RefPlaceholder47; + this.focusAfterAttached = false; + } + initialiseEditor(params) { + const formulaInputField = this.createManagedBean(new AgFormulaInputField()); + this.eEditor = formulaInputField; + formulaInputField.addCss("ag-cell-editor"); + this.appendChild(formulaInputField); + this.addManagedElementListeners(formulaInputField.getContentElement(), { + keydown: (event) => this.onFormulaInputKeyDown(event, params.onKeyDown) + }); + const { eventKey, cellStartedEdit } = params; + let startValue; + if (cellStartedEdit) { + this.focusAfterAttached = true; + if (eventKey === KeyCode33.BACKSPACE || eventKey === KeyCode33.DELETE) { + startValue = ""; + } else if (eventKey && eventKey.length === 1) { + startValue = eventKey; + } else { + startValue = this.getStartValue(params); + } + } else { + startValue = this.getStartValue(params); + } + const initialValue = startValue == null ? "" : String(startValue); + this.eEditor.setEditingCellRef(params.column, params.rowIndex); + this.eEditor.setValue(initialValue, true); + } + onFormulaInputKeyDown(event, onKeyDown) { + const { key } = event; + if (key !== KeyCode33.TAB || event.defaultPrevented) { + return; + } + const { focusSvc } = this.beans; + const prevFocus = focusSvc?.getFocusedCell(); + this.eEditor.withSelectionChangeHandlingSuppressed(() => { + onKeyDown?.(event); + }); + const nextFocus = focusSvc?.getFocusedCell(); + let focusChanged = false; + if (prevFocus && nextFocus) { + const { rowIndex: prevRowIndex, rowPinned: prevRowPinned, column: prevColumn } = prevFocus; + const { rowIndex: nextRowIndex, rowPinned: nextRowPinned, column: nextColumn } = nextFocus; + focusChanged = prevRowIndex !== nextRowIndex || prevRowPinned !== nextRowPinned || prevColumn !== nextColumn; + } + const { defaultPrevented } = event; + if (defaultPrevented || focusChanged) { + event.preventDefault(); + } + event.stopPropagation(); + } + getStartValue(params) { + const { value } = params; + return value?.toString() ?? value; + } + agSetEditValue(value) { + this.params.value = value; + const startValue = this.getStartValue(this.params); + this.eEditor.setValue(startValue ?? "", true); + } + isPopup() { + return false; + } + afterGuiAttached() { + if (!this.focusAfterAttached) { + return; + } + const { beans, eEditor } = this; + if (!_isBrowserSafari2()) { + this.focusIn(); + } + _placeCaretAtEnd2(beans, eEditor.getContentElement()); + } + focusIn() { + this.eEditor.getContentElement().focus({ preventScroll: true }); + } + getValue() { + const rawValue = this.eEditor.getCurrentValue(); + const { value, parseValue } = this.params; + if (typeof rawValue === "string" && this.isFormulaText(rawValue)) { + return rawValue; + } + if (rawValue == null && value == null) { + return value; + } + return parseValue(String(rawValue)); + } + getValidationElement() { + return this.eEditor.getContentElement(); + } + getValidationErrors() { + const { params } = this; + const rawValue = this.eEditor.getCurrentValue(); + const translate = this.getLocaleTextFunc(); + const { getValidationErrors, validateFormulas } = params; + let internalErrors = null; + const shouldValidate = validateFormulas === true || !!getValidationErrors; + if (shouldValidate && typeof rawValue === "string" && this.isFormulaText(rawValue)) { + const normalised = this.beans.formula?.normaliseFormula(rawValue, true); + if (!normalised) { + internalErrors = [translateFormulaError(translate, 1)]; + } + } + if (getValidationErrors) { + return getValidationErrors({ value: this.getValue(), internalErrors, cellEditorParams: params }); + } + return internalErrors; + } + isFormulaText(value) { + const text = value == null ? "" : String(value); + return this.beans.formula?.isFormula(text) ?? text.trimStart().startsWith("="); + } +}; + +// packages/ag-grid-enterprise/src/formula/formula.css +var formula_default = '.formula-error:after{background-color:var(--ag-invalid-color);content:"";height:12px;position:absolute;top:-6px;width:12px}:where(.ag-ltr) .formula-error:after{right:-6px;transform:rotate(45deg)}:where(.ag-rtl) .formula-error:after{left:-6px;transform:rotate(-45deg)}'; + +// packages/ag-grid-enterprise/src/formula/formulaDataService.ts +import { BeanStub as BeanStub80, _addGridCommonParams as _addGridCommonParams26, _isExpressionString as _isExpressionString2 } from "ag-grid-community"; +var FormulaDataService = class extends BeanStub80 { + constructor() { + super(...arguments); + this.beanName = "formulaDataSvc"; + this.hasSource = false; + } + postConstruct() { + const dataSource = this.gos.get("formulaDataSource"); + if (dataSource) { + this.setDataSource(dataSource); + } + } + hasDataSource() { + return this.hasSource; + } + getFormula(params) { + const formula = this.dataSource?.getFormula(params); + return _isExpressionString2(formula) ? formula : void 0; + } + setFormula(params) { + this.dataSource?.setFormula(params); + } + setDataSource(dataSource) { + this.dataSource = dataSource; + this.hasSource = true; + dataSource.init?.(this.createInitParams()); + } + createInitParams() { + return _addGridCommonParams26(this.gos, {}); + } + destroy() { + this.dataSource?.destroy?.(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/formula/formulaInputManagerService.ts +import { BeanStub as BeanStub81 } from "ag-grid-community"; +var FormulaInputManagerService = class extends BeanStub81 { + constructor() { + super(...arguments); + this.beanName = "formulaInputManager"; + this.activeEditor = null; + this.activeEditorDeactivate = null; + } + postConstruct() { + this.registerRangeSelectionExtension(); + } + registerActiveEditor(editorId, onDeactivate) { + if (this.activeEditor === editorId && this.activeEditorDeactivate === onDeactivate) { + return false; + } + const previousDeactivate = this.activeEditorDeactivate; + if (previousDeactivate && previousDeactivate !== onDeactivate) { + previousDeactivate(); + } + this.activeEditor = editorId; + this.activeEditorDeactivate = onDeactivate; + return true; + } + unregisterActiveEditor(editorId, onDeactivate) { + if (this.activeEditor === editorId && this.activeEditorDeactivate === onDeactivate) { + this.activeEditor = null; + this.activeEditorDeactivate = null; + } + } + isActiveEditor(editorId) { + return this.activeEditor === editorId; + } + shouldSuppressRangeSelection(eventTarget) { + const target = eventTarget; + if (!target?.closest) { + return false; + } + if (this.activeEditor != null) { + return !!target.closest(".ag-cell-editor"); + } + return !!target.closest(".ag-formula-input-field"); + } + registerRangeSelectionExtension() { + const rangeSvc = this.beans.rangeSvc; + if (!rangeSvc) { + return; + } + rangeSvc.registerRangeSelectionExtension(this); + this.addDestroyFunc(() => rangeSvc.unregisterRangeSelectionExtension?.(this)); + } +}; + +// packages/ag-grid-enterprise/src/formula/formulaService.ts +import { BeanStub as BeanStub82, _convertColumnEventSourceType as _convertColumnEventSourceType3, _isExpressionString as _isExpressionString4, _warn as _warn54 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/formula/ast/parsers.ts +import { _getClientSideRowModel as _getClientSideRowModel2, _isExpressionString as _isExpressionString3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/formula/ast/operators.ts +var OP_DEFS = [ + { symbol: "%", fixity: "postfix", precedence: 100 }, + { symbol: "-", fixity: "prefix", precedence: 90 }, + { symbol: "+", fixity: "prefix", precedence: 90 }, + { symbol: "^", fixity: "infix", precedence: 80, associativity: "right" }, + { symbol: "*", fixity: "infix", precedence: 70, associativity: "left", isAssociative: true }, + { symbol: "/", fixity: "infix", precedence: 70, associativity: "left" }, + { symbol: "+", fixity: "infix", precedence: 60, associativity: "left", isAssociative: true }, + { symbol: "-", fixity: "infix", precedence: 60, associativity: "left" }, + { symbol: "&", fixity: "infix", precedence: 55, associativity: "left", isAssociative: true }, + { symbol: "=", fixity: "infix", precedence: 50, associativity: "left" }, + { symbol: "<>", fixity: "infix", precedence: 50, associativity: "left" }, + { symbol: ">=", fixity: "infix", precedence: 50, associativity: "left" }, + { symbol: "<=", fixity: "infix", precedence: 50, associativity: "left" }, + { symbol: ">", fixity: "infix", precedence: 50, associativity: "left" }, + { symbol: "<", fixity: "infix", precedence: 50, associativity: "left" } +]; +var symbolOperatorMap = /* @__PURE__ */ new Map(); +for (const d of OP_DEFS) { + const s2 = symbolOperatorMap.get(d.symbol) ?? []; + s2.push(d); + symbolOperatorMap.set(d.symbol, s2); +} +function getDefBySymbol(symbol, fixity) { + const arr = symbolOperatorMap.get(symbol) ?? []; + return fixity ? arr.find((d) => d.fixity === fixity) : arr[0]; +} +var OP_SYMBOLS_DESC = [...new Set(OP_DEFS.map((d) => d.symbol))].sort((a, b) => b.length - a.length); +var OP_BY_SYMBOL = symbolOperatorMap; + +// packages/ag-grid-enterprise/src/formula/ast/utils.ts +var normaliseVariableValues2 = (values) => { + if (!values?.length) { + return void 0; + } + return values.map((value) => String(value)); +}; +var FormulaError = class extends Error { + constructor(messageOrErrorId, typeOrVariableValues, typeOverride) { + const isMessage = typeof messageOrErrorId === "string"; + const variableValues = !isMessage && Array.isArray(typeOrVariableValues) ? normaliseVariableValues2(typeOrVariableValues) : void 0; + const resolvedMessage = isMessage ? messageOrErrorId : getFormulaErrorDefaultMessage(messageOrErrorId, variableValues); + super(resolvedMessage); + this.name = "FormulaError"; + if (isMessage) { + this.type = typeof typeOrVariableValues === "string" ? typeOrVariableValues : "#ERROR!"; + this.errorId = null; + this.localeKey = null; + this.defaultMessage = messageOrErrorId; + this.variableValues = void 0; + } else { + const [localeKey, defaultMessage, defaultType] = getFormulaErrorDefinition(messageOrErrorId); + this.type = typeOverride ?? defaultType ?? "#ERROR!"; + this.errorId = messageOrErrorId; + this.localeKey = localeKey; + this.defaultMessage = defaultMessage; + this.variableValues = variableValues; + } + } + getTranslatedMessage(translate) { + if (!this.localeKey) { + return this.message; + } + return translate(this.localeKey, this.defaultMessage, this.variableValues); + } +}; +var FormulaParseError = class extends FormulaError { + constructor(errorId, errorStart, errorEnd, variableValues) { + super(errorId, variableValues, "#PARSE!"); + this.errorStart = errorStart; + this.errorEnd = errorEnd; + } +}; + +// packages/ag-grid-enterprise/src/formula/ast/parsers.ts +var parseOperand = (beans, operand, unsafe) => { + const trimmed = operand.trim(); + if (trimmed.startsWith('"') && trimmed.endsWith('"') && trimmed.length > 2) { + return trimmed.slice(1, -1); + } + if (trimmed.toLowerCase() === "true") { + return true; + } + if (trimmed.toLowerCase() === "false") { + return false; + } + const num = Number(trimmed); + if (!isNaN(num)) { + return num; + } + const parsed = parseA1Ref(trimmed); + if (parsed) { + const { + startCol, + startRow, + startColAbsolute, + startRowAbsolute, + endCol, + endRow, + endColAbsolute, + endRowAbsolute + } = parsed; + const toCell = (colAbs, colStr, rowAbs, rowStr, unsafe2) => { + const col = colAbs || unsafe2 ? colStr.toUpperCase() : beans.formula?.getColByRef(colStr)?.colId; + const row = rowAbs || unsafe2 ? rowStr : _getClientSideRowModel2(beans)?.getFormulaRow(Number(rowStr) - 1)?.id; + if (col == null || row == null) { + throw new FormulaParseError(2, 0, 0, [trimmed]); + } + return { + column: { id: col, absolute: colAbs }, + row: { id: row, absolute: rowAbs } + }; + }; + const start = toCell(startColAbsolute, startCol, startRowAbsolute, startRow, unsafe); + if (endCol && endRow) { + const end = toCell(endColAbsolute ?? false, endCol, endRowAbsolute ?? false, endRow, unsafe); + start.endColumn = end.column; + start.endRow = end.row; + } + return start; + } + return null; +}; +function tokenize2(expr) { + const tokens = []; + let i = 0; + const lexCellRange = (s2, start) => { + let j = start; + const dollar = () => s2[j] === "$" ? (j++, true) : false; + const letters = () => { + const k = j; + while (j < s2.length && /[A-Za-z]/.test(s2[j])) { + j++; + } + return j > k; + }; + const digits = () => { + const k = j; + while (j < s2.length && /[0-9]/.test(s2[j])) { + j++; + } + return j > k; + }; + const parseCell = () => { + const j0 = j; + dollar(); + if (!letters()) { + j = j0; + return false; + } + dollar(); + if (!digits()) { + j = j0; + return false; + } + return true; + }; + if (!parseCell()) { + return 0; + } + if (s2[j] === ":") { + const colonPos = j; + j++; + if (!parseCell()) { + throw new FormulaParseError(3, colonPos, j); + } + } + const ref = s2.slice(start, j); + if (!isStandaloneRefToken(s2, start, ref)) { + return 0; + } + return j - start; + }; + while (i < expr.length) { + const ch = expr[i]; + if (/\s/.test(ch)) { + i++; + continue; + } + if (ch === '"') { + let j = i + 1; + while (j < expr.length && expr[j] !== '"') { + j++; + } + if (j >= expr.length) { + throw new FormulaParseError(4, i, expr.length); + } + tokens.push(expr.slice(i, j + 1)); + i = j + 1; + continue; + } + if (/[0-9]/.test(ch) || ch === "." && /[0-9]/.test(expr[i + 1])) { + let j = i + 1; + while (j < expr.length && /[0-9.]/.test(expr[j])) { + j++; + } + tokens.push(expr.slice(i, j)); + i = j; + continue; + } + if (ch === "$" || isFormulaIdentStart(ch)) { + const len = lexCellRange(expr, i); + if (len > 0) { + tokens.push(expr.slice(i, i + len)); + i += len; + continue; + } + let j = i + 1; + while (j < expr.length && isFormulaIdentChar(expr[j])) { + j++; + } + tokens.push(expr.slice(i, j)); + i = j; + continue; + } + if (ch === "(" || ch === ")" || ch === ",") { + tokens.push(ch); + i++; + continue; + } + const firstMatch = OP_SYMBOLS_DESC.find((sym) => expr.startsWith(sym, i)); + if (!firstMatch) { + throw new FormulaParseError(5, i, i + 1, [ch]); + } + tokens.push(firstMatch); + i += firstMatch.length; + } + return tokens; +} +function shouldReduce(top, incoming) { + if (top.fixity !== "infix" || incoming.fixity !== "infix") { + return true; + } + if (top.associativity === "right" && top.precedence === incoming.precedence) { + return false; + } + return top.precedence >= incoming.precedence; +} +function pickOpDefForContext(symbol, prevToken) { + const defs = OP_BY_SYMBOL.get(symbol); + if (!defs) { + return null; + } + const prevIsOperator = prevToken !== void 0 && OP_BY_SYMBOL.has(prevToken); + const prevIsOpenOrComma = prevToken === "(" || prevToken === ","; + const prevIsValueLike = prevToken !== void 0 && !prevIsOperator && !prevIsOpenOrComma && prevToken !== "("; + if (prevIsValueLike || prevToken === ")") { + return defs.find((d) => d.fixity === "postfix") ?? defs.find((d) => d.fixity === "infix") ?? null; + } + return defs.find((d) => d.fixity === "prefix") ?? defs.find((d) => d.fixity === "infix") ?? null; +} +function parseExpression(beans, expr, unsafe) { + const tokens = tokenize2(expr); + const output = []; + const ops = []; + const applyTop = () => { + const frame = ops.pop(); + if (!frame) { + throw new FormulaParseError(6, 0, 0); + } + if (frame.kind === "op") { + const def = frame.def; + if (def.fixity !== "infix") { + const right2 = output.pop(); + if (!right2) { + throw new FormulaParseError(7, 0, 0, [def.symbol]); + } + if (def.symbol === "+" && def.fixity === "prefix") { + output.push(right2); + return; + } + if (def.fixity === "postfix" && def.symbol === "%") { + output.push({ type: "operation", operation: def.symbol, operands: [right2] }); + return; + } + if (def.symbol === "-" && def.fixity === "prefix") { + output.push({ + type: "operation", + operation: "-", + operands: [{ type: "operand", value: 0 }, right2] + }); + } else { + output.push({ type: "operation", operation: def.symbol, operands: [right2] }); + } + return; + } + const right = output.pop(); + const left = output.pop(); + if (!left || !right) { + throw new FormulaParseError(7, 0, 0, [def.symbol]); + } + output.push({ type: "operation", operation: def.symbol, operands: [left, right] }); + return; + } + throw new FormulaParseError(8, 0, 0); + }; + let i = 0; + while (i < tokens.length) { + const token = tokens[i]; + if (isFormulaIdentStart(token[0]) && tokens[i + 1] === "(") { + const name = token; + ops.push({ kind: "function", name, args: [] }); + ops.push({ kind: "parenthesis", outLen: output.length }); + i += 2; + continue; + } + if (token === "(") { + ops.push({ kind: "parenthesis", outLen: output.length }); + i++; + continue; + } + if (token === ",") { + while (true) { + const top = ops[ops.length - 1]; + if (!top || top.kind === "parenthesis") { + break; + } + if (top.kind === "op") { + applyTop(); + } else { + throw new FormulaParseError(9, i, i + 1); + } + } + const paren = ops[ops.length - 1]; + if (!paren || paren.kind !== "parenthesis") { + throw new FormulaParseError(10, i, i + 1); + } + const maybeFunction = ops[ops.length - 2]; + if (!maybeFunction || maybeFunction.kind !== "function") { + throw new FormulaParseError(11, i, i + 1); + } + if (output.length > paren.outLen) { + maybeFunction.args.push(output.pop()); + } + i++; + continue; + } + if (token === ")") { + while (true) { + const top = ops[ops.length - 1]; + if (!top || top.kind === "parenthesis") { + break; + } + if (top.kind === "op") { + applyTop(); + } else { + throw new FormulaParseError(12, i, i + 1); + } + } + const paren = ops[ops.length - 1]; + if (!paren || paren.kind !== "parenthesis") { + throw new FormulaParseError(13, i, i + 1); + } + const parenOutLen = paren.outLen; + ops.pop(); + if (ops[ops.length - 1]?.kind === "function") { + const fn = ops.pop(); + if (output.length > parenOutLen) { + fn.args.push(output.pop()); + } + output.push({ type: "operation", operation: fn.name, operands: fn.args }); + } + i++; + continue; + } + const incoming = OP_BY_SYMBOL.has(token) ? pickOpDefForContext(token, tokens[i - 1]) : null; + if (incoming) { + while (true) { + const top = ops[ops.length - 1]; + if (!top || top.kind !== "op") { + break; + } + if (shouldReduce(top.def, incoming)) { + applyTop(); + } else { + break; + } + } + ops.push({ kind: "op", def: incoming }); + i++; + continue; + } + const parsed = parseOperand(beans, token, unsafe); + if (parsed == null) { + throw new FormulaParseError(14, 0, token.length, [token]); + } + output.push({ type: "operand", value: parsed }); + i++; + } + while (ops.length) { + const top = ops[ops.length - 1]; + if (top.kind === "op") { + applyTop(); + } else { + throw new FormulaParseError(15, 0, 0); + } + } + if (output.length !== 1) { + throw new FormulaParseError(16, 0, 0); + } + return output[0]; +} +var parseFormula = (beans, formula, unsafe = false) => { + if (!_isExpressionString3(formula)) { + throw new FormulaParseError(17, 0, 1); + } + const body = formula.slice(1).trim(); + return normalizeRefCells(parseExpression(beans, body, unsafe)); +}; +function isOperation(node, name) { + return node.type === "operation" && node.operation.toUpperCase() === name.toUpperCase(); +} +function asBool(node, def = false) { + if (!node) { + return def; + } + if (node.type !== "operand") { + return def; + } + return !!node.value; +} +function asStringish(node) { + if (!node || node.type !== "operand") { + return null; + } + const v = node.value; + if (typeof v === "string") { + return v; + } + if (typeof v === "number" || typeof v === "boolean") { + return String(v); + } + return null; +} +function extractColumnRef(node) { + if (!isOperation(node, "COLUMN")) { + return null; + } + const id = asStringish(node.operands[0]); + if (id == null) { + return null; + } + const absolute = asBool(node.operands[1], false); + return { id, absolute }; +} +function extractRowRef(node) { + if (!isOperation(node, "ROW")) { + return null; + } + const id = asStringish(node.operands[0]); + if (id == null) { + return null; + } + const absolute = asBool(node.operands[1], false); + return { id, absolute }; +} +function tryFoldRefToCell(node) { + if (!isOperation(node, "REF")) { + return null; + } + const ops = node.operands; + if (ops.length !== 2 && ops.length !== 4) { + return null; + } + const col1 = extractColumnRef(ops[0]); + const row1 = extractRowRef(ops[1]); + if (!col1 || !row1) { + return null; + } + const cell = { column: col1, row: row1 }; + if (ops.length === 4) { + const col2 = extractColumnRef(ops[2]); + const row2 = extractRowRef(ops[3]); + if (!col2 || !row2) { + return null; + } + cell.endColumn = col2; + cell.endRow = row2; + } + return { type: "operand", value: cell }; +} +function normalizeRefCells(node) { + if (node.type === "operation") { + const normalizedOperands = node.operands.map(normalizeRefCells); + const rebuilt = { + type: "operation", + operation: node.operation, + operands: normalizedOperands + }; + const folded = tryFoldRefToCell(rebuilt); + return folded ?? rebuilt; + } + return node; +} + +// packages/ag-grid-enterprise/src/formula/ast/serializer.ts +import { _getClientSideRowModel as _getClientSideRowModel3 } from "ag-grid-community"; +var isOperationNode = (n) => n.type === "operation"; +function colLabelFromId(beans, colId) { + const col = beans.colModel.getColById(colId); + if (col) { + return beans.formula?.getColRef(col) ?? null; + } + return null; +} +function colIdFromLabel(beans, label) { + return beans.formula?.getColByRef?.(label)?.colId ?? null; +} +function colIndexFromId(colModel, cols, colId) { + const col = colModel.getColById(colId); + if (!col) { + return null; + } + const i = cols.indexOf(col); + return i >= 0 ? i : null; +} +function colIdFromIndex(cols, idx) { + const col = cols[idx]; + return col ? col.getId() ?? null : null; +} +function rowIndexFromId(beans, rowId) { + const row = beans.rowModel?.getRowNode?.(rowId); + if (row?.formulaRowIndex != null) { + return row.formulaRowIndex + 1; + } + return null; +} +function rowIdFromIndex(beans, idx) { + return _getClientSideRowModel3(beans)?.getFormulaRow?.(idx - 1)?.id ?? null; +} +function quoteString(s2) { + if (s2.includes('"')) { + throw new FormulaError(18); + } + return `"${s2}"`; +} +function columnValueForREF(beans, ref) { + const looksLetters = /^[A-Za-z]+$/.test(ref.id); + if (ref.absolute) { + if (looksLetters) { + return ref.id.toUpperCase(); + } + const label = colLabelFromId(beans, ref.id); + if (label) { + return label.toUpperCase(); + } + throw new FormulaError(19, [ref.id]); + } else { + if (looksLetters) { + const id = colIdFromLabel(beans, ref.id); + if (id) { + return id; + } + } + return ref.id; + } +} +function rowValueForREF(beans, ref) { + const { id, absolute } = ref; + if (absolute) { + const rowId = rowIdFromIndex(beans, Number(id)); + if (rowId == null) { + throw new FormulaError(20, [id]); + } + } else { + const idx = rowIndexFromId(beans, id); + if (idx == null) { + throw new FormulaError(21, [id]); + } + } + return id; +} +function columnLabelForA1(beans, ref) { + if (ref.absolute) { + return ref.id; + } + const label = colLabelFromId(beans, ref.id); + if (label) { + return label.toUpperCase(); + } + throw new FormulaError(22, [ref.id]); +} +function rowIndexForA1(beans, ref) { + if (ref.absolute) { + const idx2 = Number(ref.id); + if (Number.isFinite(idx2) && idx2 >= 1) { + return idx2; + } + throw new FormulaError(23, [ref.id]); + } + const idx = rowIndexFromId(beans, ref.id); + if (idx != null) { + return idx; + } + throw new FormulaError(24, [ref.id]); +} +function serializeCellA1(beans, cell, unsafe) { + const a = (abs, x) => (abs ? "$" : "") + String(x); + const col1 = unsafe ? cell.column.id : columnLabelForA1(beans, cell.column); + const row1 = unsafe ? cell.row.id : rowIndexForA1(beans, cell.row); + const startRef = a(cell.column.absolute, col1) + a(cell.row.absolute, row1); + if (cell.endColumn && cell.endRow) { + const col2 = unsafe ? cell.endColumn.id : columnLabelForA1(beans, cell.endColumn); + const row2 = unsafe ? cell.endRow.id : rowIndexForA1(beans, cell.endRow); + return `${startRef}:${a(cell.endColumn.absolute, col2)}${a(cell.endRow.absolute, row2)}`; + } + return startRef; +} +function serializeCellREF(beans, cell) { + const colPart = (r) => `COLUMN(${quoteString(columnValueForREF(beans, r))}${r.absolute ? ",true" : ""})`; + const rowPart = (r) => `ROW(${quoteString(rowValueForREF(beans, r))}${r.absolute ? ",true" : ""})`; + const start = `REF(${colPart(cell.column)},${rowPart(cell.row)}`; + if (cell.endColumn && cell.endRow) { + return `${start},${colPart(cell.endColumn)},${rowPart(cell.endRow)})`; + } + return `${start})`; +} +function isUnaryMinusNode(node) { + if (!isOperationNode(node) || node.operation !== "-" || node.operands.length !== 2) { + return null; + } + const [left, right] = node.operands; + if (left.type === "operand" && left.value === 0) { + return right; + } + return null; +} +function isInfixOpNode(node) { + if (!isOperationNode(node)) { + return false; + } + return !!getDefBySymbol(node.operation, "infix"); +} +function needsParensInBinary(parentDef, child, side) { + if (!isOperationNode(child)) { + return false; + } + if (isUnaryMinusNode(child)) { + return false; + } + const childDef = getDefBySymbol(child.operation, "infix"); + if (!childDef || childDef.fixity !== "infix") { + return false; + } + const pParent = parentDef.precedence; + const pChild = childDef.precedence; + if (pChild < pParent) { + return true; + } + if (pChild > pParent) { + return false; + } + if (parentDef.associativity === "right") { + const sameOp = childDef.symbol === parentDef.symbol; + return side === "left" && sameOp; + } + const parentAssociative = parentDef.isAssociative === true; + if (!parentAssociative) { + return side === "right"; + } + return false; +} +function needsParensForUnaryMinus(rhs) { + if (!isOperationNode(rhs)) { + return false; + } + const innerInfix = getDefBySymbol(rhs.operation, "infix"); + if (!innerInfix) { + return false; + } + const isPow = innerInfix.symbol === "^"; + return !isPow; +} +function serializeFormula(beans, root, useRefFormat, unsafe) { + const emitCell = (cell) => useRefFormat ? serializeCellREF(beans, cell) : serializeCellA1(beans, cell, unsafe); + function emit(node) { + if (node.type === "operand") { + const v = node.value; + if (typeof v === "string") { + return quoteString(v); + } + if (typeof v === "number") { + return String(v); + } + if (typeof v === "boolean") { + return v ? "TRUE" : "FALSE"; + } + return emitCell(v); + } + const unaryMinusInner = isUnaryMinusNode(node); + if (unaryMinusInner) { + const s2 = emit(unaryMinusInner); + return needsParensForUnaryMinus(unaryMinusInner) ? `-(${s2})` : `-${s2}`; + } + const op = node.operation.toUpperCase(); + if (node.operands.length === 1) { + const rhs = node.operands[0]; + const post = getDefBySymbol(op, "postfix"); + if (post) { + return `${emit(rhs)}${post.symbol}`; + } + const pre = getDefBySymbol(op, "prefix"); + if (pre) { + const inner = emit(rhs); + const need = isInfixOpNode(rhs); + return need ? `${pre.symbol}(${inner})` : `${pre.symbol}${inner}`; + } + return `${op}(${emit(rhs)})`; + } + if (node.operands.length === 2) { + const def = getDefBySymbol(op, "infix"); + if (def) { + const [l, r] = node.operands; + const Ls = needsParensInBinary(def, l, "left") ? `(${emit(l)})` : emit(l); + const Rs = needsParensInBinary(def, r, "right") ? `(${emit(r)})` : emit(r); + return `${Ls}${def.symbol}${Rs}`; + } + } + return `${op}(${node.operands.map(emit).join(",")})`; + } + return "=" + emit(root); +} + +// packages/ag-grid-enterprise/src/formula/functions/resolver.ts +import { _getClientSideRowModel as _getClientSideRowModel4 } from "ag-grid-community"; +function isRangeCell(cell) { + return !!(cell.endColumn && cell.endRow); +} +function resolveRefToAddress(beans, cell) { + const { row, column } = cell; + const rowNode = row.absolute ? _getClientSideRowModel4(beans)?.getFormulaRow(Number(row.id) - 1) : beans.rowModel.getRowNode(row.id); + const agCol = column.absolute ? beans.formula.getColByRef(column.id) : beans.colModel.getColById(column.id); + if (!rowNode || !agCol) { + return null; + } + return { row: rowNode, column: agCol }; +} +function evalAst(beans, node, getCellValue, caller) { + if (node.type === "operand") { + const v = node.value; + if (typeof v !== "object") { + return v; + } + if (isRangeCell(v)) { + throw new FormulaError(25); + } + const addr = resolveRefToAddress(beans, v); + if (!addr) { + throw new FormulaError(26); + } + return getCellValue(addr); + } + const fn = beans.formula?.getFunction(node.operation); + if (!fn) { + throw new FormulaError(27, [node.operation]); + } + const { args, values } = makeArgIterables(beans, node.operands, getCellValue, caller); + return fn({ row: caller.row, column: caller.column, args, values }); +} +function operandToArg(beans, node, getCellValue, caller) { + if (node.type === "operand") { + const v = node.value; + if (typeof v !== "object") { + return { kind: "value", value: v }; + } + if (isRangeCell(v)) { + return buildRangeArgLazy(beans, v, getCellValue); + } + const addr = resolveRefToAddress(beans, v); + if (!addr) { + throw new FormulaError(26); + } + return { kind: "value", value: getCellValue(addr) }; + } + const val = evalAst(beans, node, getCellValue, caller); + return { kind: "value", value: val }; +} +var ParamsIterator = class { + constructor(beans, operandNodes, getCellValue, caller) { + this.beans = beans; + this.operandNodes = operandNodes; + this.getCellValue = getCellValue; + this.caller = caller; + this.i = 0; + this.res = { done: false, value: void 0 }; + } + next() { + if (this.i >= this.operandNodes.length) { + this.res.done = true; + this.res.value = void 0; + return this.res; + } + this.res.done = false; + this.res.value = operandToArg(this.beans, this.operandNodes[this.i++], this.getCellValue, this.caller); + return this.res; + } + [Symbol.iterator]() { + return this; + } +}; +var ValuesIterator = class { + constructor(beans, operandNodes, getCellValue, caller) { + this.beans = beans; + this.operandNodes = operandNodes; + this.getCellValue = getCellValue; + this.caller = caller; + this.i = 0; + this.inner = null; + this.res = { done: false, value: void 0 }; + } + next() { + while (true) { + if (this.inner) { + const step = this.inner.next(); + if (!step.done) { + this.res.done = false; + this.res.value = step.value; + return this.res; + } + this.inner = null; + continue; + } + if (this.i >= this.operandNodes.length) { + this.res.done = true; + this.res.value = void 0; + return this.res; + } + const arg = operandToArg(this.beans, this.operandNodes[this.i++], this.getCellValue, this.caller); + if (arg.kind === "value") { + this.res.done = false; + this.res.value = arg.value; + return this.res; + } + this.inner = arg[Symbol.iterator](); + } + } + [Symbol.iterator]() { + return this; + } +}; +function makeArgIterables(beans, operandNodes, getCellValue, caller) { + const args = { + [Symbol.iterator]() { + return new ParamsIterator(beans, operandNodes, getCellValue, caller); + } + }; + const values = { + [Symbol.iterator]() { + return new ValuesIterator(beans, operandNodes, getCellValue, caller); + } + }; + return { args, values }; +} +function resolveRowIndex(beans, ref) { + if (ref.absolute) { + const n = Number(ref.id) - 1; + if (!Number.isFinite(n) || n < 0) { + throw new FormulaError(28); + } + return n; + } + const node = beans.rowModel?.getRowNode?.(ref.id); + if (node?.formulaRowIndex == null) { + throw new FormulaError(29); + } + return node.formulaRowIndex; +} +function resolveCol(beans, ref) { + if (ref.absolute) { + const col2 = beans.formula?.getColByRef(ref.id); + if (!col2) { + throw new FormulaError(30); + } + return col2; + } + const col = beans.colModel.getColById(ref.id); + if (!col) { + throw new FormulaError(31); + } + return col; +} +var RangeValuesIterator = class { + constructor(beans, rowStartIndex, rowEndIndex, colStart, colEnd, getCellValue) { + this.beans = beans; + this.rowStartIndex = rowStartIndex; + this.rowEndIndex = rowEndIndex; + this.colStart = colStart; + this.colEnd = colEnd; + this.getCellValue = getCellValue; + this.cols = null; + this.currentRowIndex = this.rowStartIndex; + this.currentColIdx = -1; + this.colStartIdx = -1; + this.colEndIdx = -1; + this.res = { done: false, value: void 0 }; + } + initColsOnce() { + if (this.cols) { + return; + } + this.cols = this.beans.colModel.getCols() ?? []; + const range = getColRangeIndices(this.beans, this.colStart, this.colEnd); + if (!range) { + this.colStartIdx = -1; + this.colEndIdx = -1; + return; + } + [this.colStartIdx, this.colEndIdx] = range; + this.currentColIdx = this.colStartIdx; + } + next() { + if (!this.cols) { + this.initColsOnce(); + if (this.colStartIdx < 0) { + this.res.done = true; + return this.res; + } + } + if (this.currentRowIndex <= this.rowEndIndex) { + const row = _getClientSideRowModel4(this.beans)?.getFormulaRow(this.currentRowIndex); + if (!row) { + throw new FormulaError(32); + } + const col = this.cols[this.currentColIdx]; + if (this.currentColIdx < this.colEndIdx) { + this.currentColIdx++; + } else { + this.currentColIdx = this.colStartIdx; + this.currentRowIndex++; + } + this.res.value = this.getCellValue({ row, column: col }); + return this.res; + } + this.res.done = true; + this.res.value = void 0; + return this.res; + } +}; +function buildRangeArgLazy(beans, cell, getCellValue) { + const r1 = resolveRowIndex(beans, cell.row); + const r2 = cell.endRow ? resolveRowIndex(beans, cell.endRow) : r1; + const rowStart = Math.min(r1, r2); + const rowEnd = Math.max(r1, r2); + const c1 = resolveCol(beans, cell.column); + const c2 = cell.endColumn ? resolveCol(beans, cell.endColumn) : c1; + return { + kind: "range", + rowStart, + rowEnd, + colStart: c1, + colEnd: c2, + [Symbol.iterator]() { + return new RangeValuesIterator(beans, rowStart, rowEnd, c1, c2, getCellValue); + } + }; +} +function getColRangeIndices(beans, c1, c2) { + const allColumns = beans.colModel.getCols() ?? []; + let startColIndex = null; + let endColIndex = null; + for (let i = 0; i < allColumns.length && (startColIndex === null || endColIndex === null); i++) { + const column = allColumns[i]; + if (column === c2) { + endColIndex = i; + } + if (column === c1) { + startColIndex = i; + } + if (endColIndex !== null && startColIndex !== null) { + break; + } + } + if (startColIndex === null || endColIndex === null) { + return null; + } + const colIndexMin = Math.min(startColIndex, endColIndex); + const colIndexMax = Math.max(startColIndex, endColIndex); + return [colIndexMin, colIndexMax]; +} +function* rangeAddrs(beans, rowStartIndex, rowEndIndex, startColumn, endColumn) { + const allColumns = beans.colModel.getCols() ?? []; + const colRange = getColRangeIndices(beans, startColumn, endColumn); + if (colRange == null) { + return; + } + const [colIndexMin, colIndexMax] = colRange; + for (let rowIndex = rowStartIndex; rowIndex <= rowEndIndex; rowIndex++) { + const rowNode = _getClientSideRowModel4(beans)?.getFormulaRow(rowIndex); + if (!rowNode) { + continue; + } + for (let colIndex = colIndexMin; colIndex <= colIndexMax; colIndex++) { + yield { row: rowNode, column: allColumns[colIndex] }; + } + } +} +function* unresolvedDeps(beans, root, ensureFormulaCache) { + const astStack = [root]; + while (astStack.length) { + const currentNode = astStack.pop(); + if (currentNode.type === "operand") { + const operandValue = currentNode.value; + if (typeof operandValue !== "object" || operandValue == null) { + continue; + } + if (!operandValue.endColumn && !operandValue.endRow) { + const cellAddress = resolveRefToAddress(beans, operandValue); + if (!cellAddress) { + throw new FormulaError(33); + } + const cachedCellFormula = ensureFormulaCache(cellAddress.row, cellAddress.column); + if (!cachedCellFormula || cachedCellFormula.isValueReady()) { + continue; + } + yield cellAddress; + continue; + } + if (!operandValue.endColumn || !operandValue.endRow) { + throw new FormulaError(34); + } + const firstRowIndex = resolveRowIndex(beans, operandValue.row); + const secondRowIndex = resolveRowIndex(beans, operandValue.endRow); + const rowStartIndex = Math.min(firstRowIndex, secondRowIndex); + const rowEndIndex = Math.max(firstRowIndex, secondRowIndex); + const startCol = resolveCol(beans, operandValue.column); + const endCol = resolveCol(beans, operandValue.endColumn); + for (const cellAddress of rangeAddrs(beans, rowStartIndex, rowEndIndex, startCol, endCol)) { + const cachedCellFormula = ensureFormulaCache(cellAddress.row, cellAddress.column); + if (!cachedCellFormula || cachedCellFormula.isValueReady()) { + continue; + } + yield cellAddress; + } + continue; + } + for (let i = 0; i < currentNode.operands.length; i++) { + astStack.push(currentNode.operands[i]); + } + } +} + +// packages/ag-grid-enterprise/src/formula/functions/utils.ts +function take(values, name, n) { + const it = values[Symbol.iterator](); + const out = new Array(n); + for (let i = 0; i < n; i++) { + const step = it.next(); + if (step.done) { + throw new FormulaError(35, [name, n]); + } + out[i] = step.value; + } + if (!it.next().done) { + throw new FormulaError(35, [name, n]); + } + return out; +} +function iterableWithoutBlanks(values) { + return { + *[Symbol.iterator]() { + for (const v of values) { + if (v != null && v !== "") { + yield v; + } + } + } + }; +} +function takeBetween(values, name, min, max) { + const out = []; + for (const v of values) { + out.push(v); + if (out.length > max) { + throw new FormulaError(36, [name, max]); + } + } + if (out.length < min) { + throw new FormulaError(37, [name, min]); + } + return out; +} +var isRangeParam = (p) => { + return p.kind === "range"; +}; +var isValueParam = (p) => { + return p.kind === "value"; +}; +var OPERATOR_TOKENS = ["<=", ">=", "<>", "<", ">", "="]; +function findOperatorSymbol(s2) { + for (const tok of OPERATOR_TOKENS) { + if (s2.startsWith(tok)) { + return tok; + } + } + return null; +} +function toNumberLike(x) { + if (typeof x === "number" && Number.isFinite(x)) { + return x; + } + if (x instanceof Date) { + return +x; + } + if (typeof x === "string") { + const num = Number(x); + if (!Number.isNaN(num)) { + return num; + } + } + return null; +} +function toText(x) { + if (x == null) { + return ""; + } + switch (typeof x) { + case "string": + return x; + case "number": + return String(x); + case "boolean": + return x ? "TRUE" : "FALSE"; + } + if (x instanceof Date) { + return String(+x); + } + return String(x); +} +function wildcardToRegExp(pattern) { + let out = "^"; + for (let i = 0; i < pattern.length; i++) { + const ch = pattern[i]; + if (ch === "~" && i + 1 < pattern.length && (pattern[i + 1] === "*" || pattern[i + 1] === "?")) { + out += "\\" + pattern[++i]; + continue; + } + if (ch === "*") { + out += ".*"; + continue; + } + if (ch === "?") { + out += "."; + continue; + } + if (/[-/\\^$*+?.()|[\]{}]/.test(ch)) { + out += "\\" + ch; + } else { + out += ch; + } + } + out += "$"; + return new RegExp(out, "i"); +} +var COMPARE_VALUES = (op, query, cell) => { + let queryVal = toNumberLike(query); + let cellVal = toNumberLike(cell); + if (queryVal == null || cellVal == null) { + queryVal = query; + cellVal = toText(cell).toUpperCase(); + } + switch (op) { + case "<": + return cellVal < queryVal; + case ">": + return cellVal > queryVal; + case "<=": + return cellVal <= queryVal; + case ">=": + return cellVal >= queryVal; + case "=": + return cellVal === queryVal; + case "<>": + return cellVal !== queryVal; + } + return false; +}; +var REGEX_COMPARE_VALUES = (op, rx, cell) => { + const text = toText(cell); + const match = rx.test(text); + return op === "=" ? match : !match; +}; +var EMPTY_PREDICATE = (cell) => cell == null || cell === ""; +function criteriaToPredicate(criteria) { + if (typeof criteria === "number") { + return (cell) => toNumberLike(cell) === criteria; + } + if (typeof criteria !== "string") { + return (cell) => criteria === cell; + } + const trimmed = criteria.trim(); + if (trimmed === "") { + return EMPTY_PREDICATE; + } + const symbol = findOperatorSymbol(trimmed); + const query = symbol ? trimmed.substring(symbol.length) : trimmed; + const wildcard = /[*?]/.test(query); + if (!wildcard) { + return COMPARE_VALUES.bind(null, symbol ?? "=", query.toUpperCase()); + } + if (symbol && symbol !== "=" && symbol !== "<>") { + throw new FormulaError(38); + } + const regexp = wildcardToRegExp(query); + return REGEX_COMPARE_VALUES.bind(null, symbol ?? "=", regexp); +} +var shiftColRef = (beans, delta, ref) => { + if (!ref || delta === 0 || ref.absolute) { + return; + } + const { visibleCols, colModel } = beans; + const cols = visibleCols.allCols; + const i0 = colIndexFromId(colModel, cols, ref.id); + if (i0 == null) { + return; + } + const j0 = i0 + delta; + if (j0 < 0) { + return; + } + const nextId = colIdFromIndex(cols, j0); + if (nextId) { + ref.id = nextId; + } +}; +var shiftRowRef = (beans, rowDelta, ref, unsafe) => { + if (!ref || rowDelta === 0 || ref.absolute) { + return; + } + if (unsafe) { + const numericId = Number(ref.id); + if (!Number.isFinite(numericId)) { + return; + } + ref.id = String(numericId + rowDelta); + return; + } + const idx1 = rowIndexFromId(beans, ref.id); + if (idx1 == null) { + return; + } + const next1 = idx1 + rowDelta; + if (next1 < 1) { + return; + } + const nextId = rowIdFromIndex(beans, next1); + if (nextId) { + ref.id = nextId; + } +}; +var isCellOperand = (value) => { + return !!value && typeof value === "object" && value !== null && "row" in value && "column" in value; +}; +var shiftNode = (beans, node, rowDelta, columnDelta, unsafe) => { + if (node.type === "operand") { + const { value } = node; + if (!isCellOperand(value)) { + return; + } + const { row, column, endRow, endColumn } = value; + shiftRowRef(beans, rowDelta, row, unsafe); + shiftColRef(beans, columnDelta, column); + shiftRowRef(beans, rowDelta, endRow, unsafe); + shiftColRef(beans, columnDelta, endColumn); + return; + } + if (node.type === "operation") { + for (const child of node.operands) { + shiftNode(beans, child, rowDelta, columnDelta, unsafe); + } + } +}; + +// packages/ag-grid-enterprise/src/formula/functions/counting/functions.ts +var COUNT = ({ values }) => { + let count = 0; + for (const v of values) { + if (v != null && v !== "" && !isNaN(v)) { + count++; + } + } + return count; +}; +var COUNTA = ({ values }) => { + let count = 0; + for (const v of values) { + if (v != null && v !== "") { + count++; + } + } + return count; +}; +var COUNTBLANK = ({ values }) => { + let count = 0; + for (const v of values) { + if (v == null || v === "") { + count++; + } + } + return count; +}; +var COUNTIF = ({ args }) => { + const [range, criteria] = take(args, "COUNTIF", 2); + if (!isRangeParam(range)) { + throw new FormulaError(65); + } + if (!isValueParam(criteria)) { + throw new FormulaError(66); + } + const pred = criteriaToPredicate(criteria.value); + let count = 0; + for (const v of range) { + if (pred(v)) { + count++; + } + } + return count; +}; + +// packages/ag-grid-enterprise/src/formula/functions/dates/functions.ts +var NOW = () => /* @__PURE__ */ new Date(); +var TODAY = () => { + const now = /* @__PURE__ */ new Date(); + return new Date(now.getFullYear(), now.getMonth(), now.getDate()); +}; + +// packages/ag-grid-enterprise/src/formula/functions/logic/functions.ts +var EQUALS = ({ values }) => { + const [a, b] = take(values, "EQUALS", 2); + return a === b; +}; +var NOT_EQUALS = ({ values }) => { + const [a, b] = take(values, "NOT_EQUALS", 2); + return a !== b; +}; +var GT = ({ values }) => { + const [a, b] = take(values, "GT", 2); + return a > b; +}; +var GTE = ({ values }) => { + const [a, b] = take(values, "GTE", 2); + return a >= b; +}; +var LT = ({ values }) => { + const [a, b] = take(values, "LT", 2); + return a < b; +}; +var LTE = ({ values }) => { + const [a, b] = take(values, "LTE", 2); + return a <= b; +}; +var IF = ({ values }) => { + const [cond, valTrue, valFalse] = take(values, "IF", 3); + return cond ? valTrue : valFalse; +}; +var MIN = ({ values }) => { + let best = null; + for (const v of values) { + if (v == null) { + continue; + } + if (best === null || v < best) { + best = v; + } + } + if (best === null) { + throw new FormulaError(68); + } + return best; +}; +var MAX = ({ values }) => { + let best = null; + for (const v of values) { + if (v == null) { + continue; + } + if (best === null || v > best) { + best = v; + } + } + if (best === null) { + throw new FormulaError(69); + } + return best; +}; + +// packages/ag-grid-enterprise/src/formula/functions/numbers/utils.ts +var isFiniteNumber = (v) => typeof v === "number" && Number.isFinite(v); +var MS_PER_DAY = 24 * 60 * 60 * 1e3; +function daysFromDate(d) { + return d.getTime() / MS_PER_DAY; +} +function dateFromDays(n) { + return new Date(n * MS_PER_DAY); +} +function isDateValue(v) { + return v instanceof Date; +} +function coerceFiniteNumber(fname, v) { + if (typeof v === "bigint") { + const asNumber = Number(v); + if (Number.isFinite(asNumber)) { + return asNumber; + } + throw new FormulaError(48, [fname]); + } + if (isFiniteNumber(v)) { + return v; + } + if (isDateValue(v)) { + return daysFromDate(v); + } + if (typeof v === "boolean") { + return v ? 1 : 0; + } + if (typeof v === "string") { + const n = Number(v.trim()); + if (Number.isFinite(n)) { + return n; + } + } + throw new FormulaError(48, [fname]); +} +function coerceFiniteNumberOrBigInt(fname, v) { + if (typeof v === "bigint") { + return v; + } + return coerceFiniteNumber(fname, v); +} +function coerceBigInt(fname, v) { + if (typeof v === "bigint") { + return v; + } + if (!Number.isFinite(v) || !Number.isInteger(v)) { + throw new FormulaError(49, [fname]); + } + return BigInt(v); +} + +// packages/ag-grid-enterprise/src/formula/functions/numbers/functions.ts +var PRODUCT = ({ values }) => { + let acc = 1; + let accBigInt = null; + for (const v of iterableWithoutBlanks(values)) { + const n = coerceFiniteNumberOrBigInt("PRODUCT", v); + if (typeof n === "bigint") { + accBigInt ?? (accBigInt = coerceBigInt("PRODUCT", acc)); + if (n === 0n) { + return 0n; + } + accBigInt *= n; + continue; + } + if (accBigInt != null) { + accBigInt *= coerceBigInt("PRODUCT", n); + continue; + } + if (n === 0) { + return 0; + } + acc *= n; + } + return accBigInt ?? acc; +}; +var DIVIDE = ({ values }) => { + const [a, b] = take(iterableWithoutBlanks(values), "DIVIDE", 2); + const na = coerceFiniteNumber("DIV", a); + const nb = coerceFiniteNumber("DIV", b); + if (na == null || nb == null) { + throw new FormulaError(54); + } + if (nb === 0) { + throw new FormulaError(55); + } + return na / nb; +}; +var SUM = ({ values }) => { + let hasDates = false; + let acc = 0; + let accBigInt = null; + let hasValue = false; + for (const v of iterableWithoutBlanks(values)) { + hasDates || (hasDates = isDateValue(v)); + const n = coerceFiniteNumberOrBigInt("SUM", v); + if (typeof n === "bigint") { + if (hasDates) { + throw new FormulaError(56); + } + accBigInt ?? (accBigInt = coerceBigInt("SUM", acc)); + accBigInt += n; + hasValue = true; + continue; + } + if (typeof accBigInt === "bigint") { + if (hasDates) { + throw new FormulaError(56); + } + accBigInt += coerceBigInt("SUM", n); + hasValue = true; + continue; + } + acc += n; + hasValue = true; + } + if (!hasValue) { + throw new FormulaError(57); + } + if (typeof accBigInt === "bigint") { + return accBigInt; + } + return hasDates ? dateFromDays(acc) : acc; +}; +var MINUS = ({ values }) => { + const [a, b] = take(iterableWithoutBlanks(values), "MINUS", 2); + const aDate = isDateValue(a); + const bDate = isDateValue(b); + if (aDate || bDate) { + const na2 = coerceFiniteNumber("MINUS", a); + const nb2 = coerceFiniteNumber("MINUS", b); + if (aDate && !bDate) { + return dateFromDays(na2 - nb2); + } + if (aDate && bDate) { + return na2 - nb2; + } + return na2 - nb2; + } + const na = coerceFiniteNumberOrBigInt("MINUS", a); + const nb = coerceFiniteNumberOrBigInt("MINUS", b); + if (typeof na === "bigint" || typeof nb === "bigint") { + return coerceBigInt("MINUS", na) - coerceBigInt("MINUS", nb); + } + return na - nb; +}; +var PERCENT = ({ values }) => { + const [a] = take(values, "PERCENT", 1); + const n = coerceFiniteNumber("PERCENT", a); + if (n == null) { + throw new FormulaError(70); + } + return n / 100; +}; +var POWER = ({ values }) => { + const [a, b] = take(values, "POWER", 2); + const na = coerceFiniteNumber("POWER", a); + const nb = coerceFiniteNumber("POWER", b); + if (na == null || nb == null) { + throw new FormulaError(71); + } + return Math.pow(na, nb); +}; +var AVERAGE = ({ values }) => { + let sum = 0; + let count = 0; + let allDate = true; + for (const v of iterableWithoutBlanks(values)) { + const n = coerceFiniteNumber("AVG", v); + if (n == null) { + continue; + } + sum += n; + count++; + allDate && (allDate = isDateValue(v)); + } + if (count === 0) { + throw new FormulaError(58); + } + const avg = sum / count; + return allDate ? dateFromDays(avg) : avg; +}; +var MEDIAN = ({ values }) => { + let allDates = true; + const arr = []; + for (const v of iterableWithoutBlanks(values)) { + const n = coerceFiniteNumber("MEDIAN", v); + if (n == null) { + throw new FormulaError(59); + } + arr.push(n); + allDates && (allDates = isDateValue(v)); + } + if (arr.length === 0) { + throw new FormulaError(60); + } + arr.sort((a, b) => a - b); + const mid = Math.floor(arr.length / 2); + const med = arr.length % 2 === 1 ? arr[mid] : (arr[mid - 1] + arr[mid]) / 2; + return allDates ? dateFromDays(med) : med; +}; +var RAND = () => Math.random(); +var SUMIF = ({ args }) => { + const [critRange, criteria, sumRange] = takeBetween(args, "SUMIF", 2, 3); + if (!isRangeParam(critRange)) { + throw new FormulaError(61); + } + if (!isValueParam(criteria)) { + throw new FormulaError(62); + } + if (sumRange && !isRangeParam(sumRange)) { + throw new FormulaError(63); + } + const pred = criteriaToPredicate(criteria.value); + if (!sumRange) { + let acc = 0; + let accBigInt = null; + for (const v of critRange) { + if (pred(v)) { + const n = coerceFiniteNumberOrBigInt("SUMIF", v); + if (typeof n === "bigint") { + accBigInt ?? (accBigInt = coerceBigInt("SUMIF", acc)); + accBigInt += n; + } else if (accBigInt != null) { + accBigInt += coerceBigInt("SUMIF", n); + } else { + acc += n; + } + } + } + return accBigInt ?? acc; + } + const critRangeHeight = critRange.rowEnd - critRange.rowStart; + const sumRangeHeight = sumRange.rowEnd - sumRange.rowStart; + if (critRangeHeight !== sumRangeHeight) { + throw new FormulaError(64); + } + const critRangeIterator = critRange[Symbol.iterator](); + const sumRangeIterator = sumRange[Symbol.iterator](); + let total = 0; + let totalBigInt = null; + while (true) { + const a = critRangeIterator.next(); + const b = sumRangeIterator.next(); + if (a.done || b.done) { + if (a.done !== b.done) { + throw new FormulaError(64); + } + break; + } + if (pred(a.value)) { + const n = coerceFiniteNumberOrBigInt("SUMIF", b.value); + if (typeof n === "bigint") { + totalBigInt ?? (totalBigInt = coerceBigInt("SUMIF", total)); + totalBigInt += n; + } else if (totalBigInt != null) { + totalBigInt += coerceBigInt("SUMIF", n); + } else { + total += n; + } + } + } + return totalBigInt ?? total; +}; + +// packages/ag-grid-enterprise/src/formula/functions/strings/functions.ts +var CONCAT = ({ values }) => { + let out = ""; + for (const v of values) { + if (v == null) { + continue; + } + switch (typeof v) { + case "string": { + out += v; + break; + } + case "number": { + out += String(v); + break; + } + case "boolean": { + out += v ? "TRUE" : "FALSE"; + break; + } + case "object": { + out += v.toString(); + break; + } + default: { + throw new FormulaError(67); + } + } + } + return out; +}; + +// packages/ag-grid-enterprise/src/formula/functions/supportedFuncs.ts +var supportedFuncs_default = { + // logic/date + IF, + NOW, + TODAY, + // arithmetic + PRODUCT, + // DIVIDE, + // DIV: DIVIDE, + SUM, + ADD: SUM, + SUMIF, + // MINUS, + // PERCENT, + POWER, + MIN, + MAX, + AVERAGE, + MEDIAN, + // counting + COUNT, + COUNTA, + COUNTBLANK, + COUNTIF, + // random + RAND, + // text + CONCAT, + CONCATENATE: CONCAT, + // comparisons + // EQ: EQUALS, + // NE: NOT_EQUALS, + // GT, + // GTE, + // LT, + // LTE, + // operator aliases + "+": SUM, + "-": MINUS, + "*": PRODUCT, + "/": DIVIDE, + "^": POWER, + "%": PERCENT, + "=": EQUALS, + "&": CONCAT, + "<>": NOT_EQUALS, + ">": GT, + ">=": GTE, + "<": LT, + "<=": LTE +}; + +// packages/ag-grid-enterprise/src/formula/formulaService.ts +var CellFormula = class { + constructor(rowNode, column, formulaString, beans) { + this.rowNode = rowNode; + this.column = column; + this.formulaString = formulaString; + this.beans = beans; + this.error = null; + this.ast = null; + this.astStale = true; + this._value = void 0; + this._valueStale = true; + } + setFormulaString(next) { + if (this.formulaString === next) { + return; + } + this.formulaString = next; + this.astStale = true; + this._valueStale = true; + } + /** Cache write: store a fresh computed value (and clear previous error). */ + setComputedValue(v) { + this._value = v; + this._valueStale = false; + this.error = null; + } + /** Cache write: store an error (value considered stale). */ + setError(e) { + this.error = e; + this._valueStale = false; + } + isValueReady() { + return !this._valueStale; + } + /** + * Return the error type or the value + */ + getValue() { + return this.error?.type ?? this._value; + } + getError() { + return this.error; + } + /** Returns the AST for the formula and recomputes if stale */ + getAst() { + if (!this.astStale) { + return this.ast; + } + const ast = parseFormula(this.beans, this.formulaString); + this.ast = ast ?? null; + this.astStale = false; + return this.ast; + } +}; +var FormulaService = class extends BeanStub82 { + constructor() { + super(...arguments); + this.beanName = "formula"; + /** Cache: row -> (column -> CellFormula) */ + this.cachedResult = /* @__PURE__ */ new WeakMap(); + /** Map "A", "B", ..., "AA" -> actual AgColumn */ + this.colRefMap = /* @__PURE__ */ new Map(); + this.functionNames = null; + this.active = false; + } + setFormulasActive(cols) { + const formulaColumnsPresent = cols.list.some((col) => col.isAllowFormula()); + const active = formulaColumnsPresent && this.checkForIncompatibleServices(cols); + if (active !== this.active) { + this.active = active; + this.refreshFormulas(true); + } + } + checkForIncompatibleServices(cols) { + if (this.gos.get("masterDetail")) { + _warn54(295, { blockedService: "Master Detail" }); + return false; + } + if (this.gos.get("treeData")) { + _warn54(295, { blockedService: "Tree Data" }); + return false; + } + if (this.gos.get("enableCellExpressions")) { + _warn54(295, { blockedService: "Cell Expressions" }); + return false; + } + return cols.list.every((col) => { + if (col.isAllowPivot() || col.isPivotActive()) { + _warn54(295, { blockedService: "Column Pivoting" }); + return false; + } + if (col.isAllowRowGroup() || col.isRowGroupActive()) { + _warn54(295, { blockedService: "Row Groups" }); + return false; + } + if (col.isAllowValue() || col.isValueActive() || col.getAggFunc()) { + _warn54(295, { blockedService: "Value Aggregation" }); + return false; + } + return true; + }); + } + postConstruct() { + this.setupFunctions(); + const refreshFormulas = () => { + if (this.active) { + this.refreshFormulas(true); + } + }; + const resetColMap = () => { + if (this.active) { + this.setupColRefMap(); + } + }; + this.addManagedPropertyListeners(["masterDetail", "enableCellExpressions"], (e) => { + const { colModel } = this.beans; + const formulaColumnsPresent = colModel.cols?.list.some((col) => col.isAllowFormula()); + if (formulaColumnsPresent) { + colModel.refreshAll(_convertColumnEventSourceType3(e.source)); + } + }); + this.addManagedListeners(this.beans.eventSvc, { + modelUpdated: refreshFormulas, + cellValueChanged: refreshFormulas, + rowDataUpdated: refreshFormulas, + newColumnsLoaded: resetColMap, + columnMoved: resetColMap + }); + } + updateFormulaByOffset(params) { + const { value, rowDelta = 0, columnDelta = 0, useRefFormat = true } = params; + const { beans } = this; + try { + const unsafe = !useRefFormat; + const ast = parseFormula(beans, value, unsafe); + shiftNode(beans, ast, rowDelta, columnDelta, unsafe); + return serializeFormula( + beans, + ast, + /*useRefFormat*/ + useRefFormat, + unsafe + ); + } catch { + return value; + } + } + setupFunctions() { + this.supportedOperations = /* @__PURE__ */ new Map(); + Object.keys(supportedFuncs_default).forEach((name) => { + this.supportedOperations.set(name, supportedFuncs_default[name]); + }); + this.functionNames = null; + const customFuncs = this.gos.get("formulaFuncs"); + if (customFuncs) { + Object.keys(customFuncs).forEach((name) => { + this.supportedOperations.set(name.toUpperCase(), customFuncs[name].func); + }); + } + } + getFunctionNames() { + if (this.functionNames) { + return this.functionNames; + } + const names = []; + for (const name of this.supportedOperations.keys()) { + if (!isFormulaIdentStart(name[0])) { + continue; + } + if (![...name].every((char) => isFormulaIdentChar(char))) { + continue; + } + names.push(name); + } + names.sort((a, b) => a.localeCompare(b)); + this.functionNames = names; + return names; + } + setupColRefMap() { + if (!this.active) { + this.colRefMap = /* @__PURE__ */ new Map(); + return; + } + const alphabet = "abcdefghijklmnopqrstuvwxyz"; + const base = alphabet.length; + const list = this.beans.colModel.getCols(); + const map = /* @__PURE__ */ new Map(); + let idx = 0; + list?.forEach((col) => { + if (!col.isPrimary()) { + return; + } + let label = ""; + let n = idx++; + while (true) { + label = alphabet[n % base] + label; + if (n < base) { + break; + } + n = Math.floor(n / base) - 1; + } + if (col.formulaRef !== label.toUpperCase()) { + col.formulaRef = label.toUpperCase(); + col.dispatchColEvent("formulaRefChanged", "api"); + } + map.set(label.toUpperCase(), col); + }); + this.colRefMap = map; + this.refreshFormulas(true); + } + /** Lookup a column by A1-style reference label, e.g. "A", "AB". */ + getColByRef(ref) { + return this.colRefMap.get(ref.toUpperCase()) ?? null; + } + /** Find the A1-style label for a given column (reverse lookup). */ + getColRef(col) { + for (const [label, value] of this.colRefMap.entries()) { + if (value === col) { + return label; + } + } + return null; + } + /** Clear all cached results and re-render cells. */ + refreshFormulas(refreshCells) { + this.cachedResult = /* @__PURE__ */ new WeakMap(); + if (refreshCells) { + this.beans.rowRenderer.refreshCells({ suppressFlash: true, force: true }); + } + } + /** + * Is a value a formula string (starts with '=') + **/ + isFormula(value) { + return this.active && _isExpressionString4(value); + } + /** + * Normalise a formula by parsing and serializing it (REF(COLUMN(), ROW()) format). + * @returns null if the formula is invalid. + */ + normaliseFormula(value, shorthand = false) { + const { beans } = this; + try { + const parsedAST = parseFormula(beans, value); + const serialized = serializeFormula(beans, parsedAST, !shorthand, false); + return serialized; + } catch { + return null; + } + } + /** If the cell has been evaluated and errored, return its last error (else null). */ + getFormulaError(column, node) { + const rowMap = this.cachedResult.get(node); + const cell = rowMap?.get(column); + return cell?.error ?? null; + } + /** Get a registered function by name (used by the evaluator). */ + getFunction(name) { + return this.supportedOperations.get(name.toUpperCase()); + } + /** Ensure a CellFormula exists for (row,col) if it's a formula cell; returns null for non-formula. */ + ensureCellFormula(row, col) { + let rowMap = this.cachedResult.get(row); + let cf = rowMap?.get(col); + if (cf) { + return cf; + } + const str = this.getFormulaFromDataSource(row, col) ?? this.fetchRawValue(col, row); + if (typeof str !== "string" || str[0] !== "=") { + return null; + } + cf = new CellFormula(row, col, str, this.beans); + if (!rowMap) { + rowMap = /* @__PURE__ */ new Map(); + this.cachedResult.set(row, rowMap); + } + rowMap.set(col, cf); + return cf; + } + getFormulaFromDataSource(row, col) { + const dataSource = this.beans.formulaDataSvc; + if (!dataSource?.hasDataSource()) { + return void 0; + } + return dataSource.getFormula({ column: col, rowNode: row }); + } + coerceFormulaValue(column, value) { + const baseDataType = this.beans.dataTypeSvc?.getBaseDataType(column); + if (baseDataType === "bigint") { + const bigintValue = this.toBigIntValue(value); + return bigintValue ?? value; + } + if (baseDataType === "number" && typeof value === "bigint") { + const asNumber = Number(value); + return Number.isFinite(asNumber) ? asNumber : value; + } + return value; + } + toBigIntValue(value) { + if (typeof value === "bigint") { + return value; + } + if (typeof value === "number") { + if (!Number.isFinite(value) || !Number.isInteger(value)) { + return null; + } + return BigInt(value); + } + return null; + } + /** Fetch a non-formula value from the grid without triggering nested formula calc. */ + fetchRawValue(col, row) { + return this.beans.valueSvc.getValue(col, row, "data"); + } + getVisitorContext() { + if (this.activeCtx) { + return this.activeCtx; + } + const stateByCell = /* @__PURE__ */ new Map(); + const setVisiting = (r, c) => { + let colSet = stateByCell.get(r); + const isVisiting = colSet?.has(c); + if (isVisiting) { + throw new FormulaError(51); + } + if (!colSet) { + colSet = /* @__PURE__ */ new Set(); + stateByCell.set(r, colSet); + } + colSet.add(c); + }; + const setVisited = (r, c) => { + const colSet = stateByCell.get(r); + if (colSet) { + colSet.delete(c); + if (colSet.size === 0) { + stateByCell.delete(r); + } + } + }; + const errorAllVisitors = (error) => { + for (const [row, cells] of stateByCell) { + for (const col of cells) { + const cache = this.ensureCellFormula(row, col); + cache?.setError(error); + } + } + }; + return this.activeCtx = { setVisited, setVisiting, errorAllVisitors }; + } + makeFormulaFrame(address) { + const cachedItem = this.ensureCellFormula(address.row, address.column); + const ast = cachedItem.getAst(); + if (!ast) { + throw new FormulaError(52); + } + const unresolvedDepIterator = unresolvedDeps(this.beans, ast, this.ensureCellFormula.bind(this)); + return { address, ast, unresolvedDepIterator }; + } + /** + * Evaluate a single cell's formula **iteratively** (no recursion to avoid large stack traces), + * caching dependency results into their own CellFormula entries. + * + * Returns the computed value, or a '#...' string on error. + */ + resolveValue(column, node) { + const rootCachedCellFormula = this.ensureCellFormula(node, column); + if (!rootCachedCellFormula) { + return this.fetchRawValue(column, node); + } + if (rootCachedCellFormula.isValueReady()) { + return rootCachedCellFormula.getValue(); + } + const hadCtx = !!this.activeCtx; + const { setVisited, setVisiting, errorAllVisitors } = this.getVisitorContext(); + const evalStack = []; + try { + setVisiting(node, column); + evalStack.push(this.makeFormulaFrame({ row: node, column })); + while (evalStack.length) { + const { address, ast, unresolvedDepIterator } = evalStack[evalStack.length - 1]; + const { row, column: col } = address; + const cachedCellFormula = this.ensureCellFormula(row, col); + if (cachedCellFormula.isValueReady()) { + evalStack.pop(); + setVisited(row, col); + if (cachedCellFormula.error) { + throw cachedCellFormula.error; + } + continue; + } + const depStep = unresolvedDepIterator.next(); + if (!depStep.done) { + const depAddr = depStep.value; + const depCachedCellFormula = this.ensureCellFormula(depAddr.row, depAddr.column); + if (!depCachedCellFormula || depCachedCellFormula.isValueReady()) { + continue; + } + setVisiting(depAddr.row, depAddr.column); + evalStack.push(this.makeFormulaFrame(depAddr)); + continue; + } + const computed = evalAst( + this.beans, + ast, + (addr) => { + const cachedRefFormula = this.ensureCellFormula(addr.row, addr.column); + if (cachedRefFormula) { + if (!cachedRefFormula.isValueReady()) { + throw new FormulaError(53); + } + const error = cachedRefFormula.getError(); + if (error) { + throw error; + } + return cachedRefFormula.getValue(); + } + return this.fetchRawValue(addr.column, addr.row); + }, + { row, column: col } + ); + const coerced = this.coerceFormulaValue(col, computed); + const existing = cachedCellFormula.getError(); + if (existing) { + setVisited(row, col); + throw existing; + } + cachedCellFormula.setComputedValue(coerced); + setVisited(row, col); + evalStack.pop(); + } + if (!rootCachedCellFormula.isValueReady()) { + throw new FormulaError(53); + } + return rootCachedCellFormula.getValue(); + } catch (e) { + const normalized = e instanceof FormulaError ? e : new FormulaError(String(e?.message ?? e)); + errorAllVisitors(normalized); + return normalized.type; + } finally { + if (!hadCtx) { + this.activeCtx = null; + } + } + } +}; + +// packages/ag-grid-enterprise/src/formula/formulaModule.ts +var FormulaModule = { + moduleName: "Formula", + version: VERSION, + userComponents: { agFormulaCellEditor: FormulaCellEditor }, + beans: [FormulaService, FormulaDataService, FormulaInputManagerService], + dependsOn: [RowNumbersModule], + css: [formula_default] +}; + +// packages/ag-grid-enterprise/src/sparkline/sparklinesModule.ts +import { _preInitErrMsg } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sparkline/sparkline.css +var sparkline_default = ".ag-sparkline-wrapper{height:100%;line-height:normal;position:absolute;top:0;width:100%}"; + +// packages/ag-grid-enterprise/src/sparkline/sparklineCellRenderer.ts +import { + Component as Component55, + RefPlaceholder as RefPlaceholder48, + _batchCall, + _formatNumberCommas as _formatNumberCommas6, + _setAriaLabel as _setAriaLabel20, + _setAriaLabelledBy as _setAriaLabelledBy4 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/sparkline/sparklinesUtils.ts +var WrappedFunctionMarker = Symbol("WrappedFunctionMarker"); +var wrapFn = (fn, wrapperFn) => { + if (fn[WrappedFunctionMarker]) { + return fn; + } + const wrapped = (...args) => wrapperFn(fn, ...args); + wrapped[WrappedFunctionMarker] = WrappedFunctionMarker; + return wrapped; +}; +var defaultSparklineAriaDescription = "Sparkline - ${chartType} displaying ${count} values between ${min} and ${max}. Starts at ${start} and ends at ${end}."; +var defaultSingleValueSparklineAriaDescription = "Sparkline - ${chartType} displaying 1 value, ${value}."; +var defaultEmptySparklineAriaDescription = "Sparkline - ${chartType} displaying no values."; +var getChartTypeLabel = (translate, sparklineOptions) => { + const type = sparklineOptions?.type ?? "line"; + switch (type) { + case "line": + return translate("lineChart", "Line"); + case "area": + return translate("areaChart", "Area"); + case "bar": + return translate("barChart", "Bar"); + default: + return type; + } +}; +var getSparklineSummary = (data, yKey) => { + let count = 0; + let min = Number.POSITIVE_INFINITY; + let max = Number.NEGATIVE_INFINITY; + let start; + let end; + for (const datum of data) { + const yValue = getYValue(datum, yKey); + if (yValue == null) { + continue; + } + if (start == null) { + start = yValue; + } + end = yValue; + count++; + min = Math.min(min, yValue); + max = Math.max(max, yValue); + } + return count === 0 ? { count } : { count, min, max, start, end }; +}; +function getSparklineAriaTemplate(params) { + const { translate, chartType, summary, formatNumber } = params; + let key; + let defaultTemplate; + let variableValues; + let values; + if (!hasCompleteSparklineSummary(summary)) { + key = "ariaSparklineChartDescriptionEmpty"; + defaultTemplate = defaultEmptySparklineAriaDescription; + variableValues = [chartType]; + values = { chartType }; + } else if (summary.count === 1) { + const value = formatNumber(summary.start); + key = "ariaSparklineChartDescriptionSingleValue"; + defaultTemplate = defaultSingleValueSparklineAriaDescription; + variableValues = [chartType, value]; + values = { chartType, value }; + } else { + const [count, min, max, start, end] = [summary.count, summary.min, summary.max, summary.start, summary.end].map( + formatNumber + ); + key = "ariaSparklineChartDescription"; + defaultTemplate = defaultSparklineAriaDescription; + variableValues = [chartType, count, min, max, start, end]; + values = { chartType, count, min, max, start, end }; + } + return { template: translate(key, defaultTemplate, variableValues), values }; +} +var hasCompleteSparklineSummary = (summary) => summary.count > 0 && summary.min != null && summary.max != null && summary.start != null && summary.end != null; +var interpolateTemplate = (template, values) => template.replace(/\$\{([^}]+)\}/g, (match, token) => values[token] ?? match); +var getYValue = (datum, yKey) => { + if (typeof datum === "number") { + return Number.isFinite(datum) ? datum : null; + } + if (datum && typeof datum === "object") { + const yValue = Array.isArray(datum) ? datum[1] : datum[yKey]; + return typeof yValue === "number" && Number.isFinite(yValue) ? yValue : null; + } + return null; +}; + +// packages/ag-grid-enterprise/src/sparkline/sparklineCellRenderer.ts +function tooltipRendererWithXValue(params) { + return { content: `${params.xValue} ${params.yValue}` }; +} +function tooltipRenderer(params) { + return { content: `${params.yValue}` }; +} +var COMPONENT_PREFIX = "ag-sparkline"; +var SparklineCellRenderer = class extends Component55 { + constructor() { + super({ + tag: "div", + cls: `${COMPONENT_PREFIX}-wrapper`, + children: [{ tag: "span", ref: "eSparkline" }] + }); + this.eSparkline = RefPlaceholder48; + this.cachedWidth = 0; + this.cachedHeight = 0; + this.dataRef = []; + this.processedData = []; + } + postConstruct() { + this.env = this.beans.environment; + this.addManagedPropertyListeners( + ["chartThemeOverrides", "chartThemes", "styleNonce"], + () => this.refresh(this.params) + ); + } + createListener(batch = true) { + return () => this.updateSize(this.params?.column?.getActualWidth() ?? 0, (this.params?.node.rowHeight ?? 0) - 2, batch); + } + initGridObserver() { + const batchListener = this.createListener(); + const listener = this.createListener(false); + const column = this.params?.column; + const rowNode = this.params?.node; + column.__addEventListener("columnStateUpdated", batchListener); + rowNode.__addEventListener("heightChanged", batchListener); + this.addDestroyFunc(() => { + column.__removeEventListener("columnStateUpdated", batchListener); + rowNode.__removeEventListener("heightChanged", batchListener); + }); + listener(); + } + updateSize(newWidth, newHeight, batch = true) { + newWidth -= this.env.getCellPadding(); + if (newWidth !== this.cachedWidth || newHeight !== this.cachedHeight) { + this.cachedWidth = newWidth; + this.cachedHeight = newHeight; + const refresh = this.refresh.bind(this); + if (batch) { + _batchCall(() => this.isAlive() && refresh()); + } else { + refresh(); + } + } + } + init(params) { + this.params = params; + const { eParentOfValue } = params; + const id = `${COMPONENT_PREFIX}-cell-renderer-${this.getCompId()}`; + this.getGui().setAttribute("id", id); + _setAriaLabelledBy4(eParentOfValue, id); + this.addDestroyFunc(() => _setAriaLabelledBy4(eParentOfValue)); + this.initGridObserver(); + } + refresh(params = this.params) { + var _a; + this.params = params; + const data = this.processData(params?.value); + this.refreshAriaLabel(data); + const width = this.cachedWidth; + const height = this.cachedHeight; + const styleNonce = this.gos.get("styleNonce"); + if (!this.sparklineInstance && params && width > 0 && height > 0) { + this.sparklineOptions = { + container: this.eSparkline, + width, + height, + ...params.sparklineOptions, + ...styleNonce ? { styleNonce } : {}, + data + }; + (_a = this.sparklineOptions).type ?? (_a.type = "line"); + if (this.sparklineOptions.tooltip?.renderer) { + this.wrapTooltipRenderer(); + } else { + const renderer = this.getDefaultTooltipRenderer(); + this.sparklineOptions.tooltip = { + ...this.sparklineOptions.tooltip, + renderer + }; + } + const theme = this.sparklineOptions?.theme; + if (this.sparklineOptions.type === "bar" && this.sparklineOptions.itemStyler) { + this.wrapItemStyler(this.sparklineOptions); + } else if (theme?.overrides?.bar?.series?.itemStyler) { + this.wrapItemStyler(theme.overrides.bar.series); + } + this.sparklineInstance = params.createSparkline(this.sparklineOptions); + return true; + } else if (this.sparklineInstance) { + this.sparklineInstance.update({ + ...this.sparklineOptions, + data, + width, + height, + ...styleNonce ? { styleNonce } : {} + }); + return true; + } + return false; + } + refreshAriaLabel(data) { + const translate = this.getLocaleTextFunc(); + const getLocaleText = this.getLocaleTextFunc.bind(this); + const yKey = this.params?.sparklineOptions?.yKey ?? this.sparklineOptions?.yKey ?? "y"; + const summary = getSparklineSummary(data, yKey); + const sparklineOptions = this.params?.sparklineOptions ?? this.sparklineOptions; + const { template, values } = getSparklineAriaTemplate({ + translate, + chartType: getChartTypeLabel(translate, sparklineOptions), + summary, + formatNumber: (value) => _formatNumberCommas6(value, getLocaleText) + }); + _setAriaLabel20(this.getGui(), interpolateTemplate(template, values)); + } + processData(data) { + if (!data?.length) { + return data ?? []; + } + if (this.dataRef !== data) { + this.dataRef = data; + this.processedData = Array.isArray(data[0]) ? data.filter((item) => item != null) : data; + } + return this.processedData; + } + createContext() { + return { + data: this.params?.data, + cellData: this.params?.value + }; + } + getDefaultTooltipRenderer(userRendererResult) { + const userTitle = userRendererResult?.title; + const xKeyProvided = this.sparklineOptions.xKey; + const tupleData = Array.isArray(this.sparklineOptions.data?.[0]); + const showXValue = !userTitle && (xKeyProvided || tupleData); + return showXValue ? tooltipRendererWithXValue : tooltipRenderer; + } + wrapItemStyler(container) { + container.itemStyler = wrapFn(container.itemStyler, (fn, stylerParams) => { + return fn({ + ...stylerParams, + context: this.createContext() + }); + }); + } + wrapTooltipRenderer() { + this.sparklineOptions.tooltip = { + ...this.sparklineOptions.tooltip, + renderer: wrapFn(this.sparklineOptions.tooltip.renderer, (fn, tooltipParams) => { + const userRendererResult = fn({ + ...tooltipParams, + context: this.createContext() + }); + if (typeof userRendererResult === "string") { + return userRendererResult; + } + return { + ...this.getDefaultTooltipRenderer(userRendererResult)(tooltipParams), + ...userRendererResult + }; + }) + }; + } + destroy() { + super.destroy(); + this.sparklineInstance?.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/sparkline/sparklinesModule.ts +var moduleName = "Sparklines"; +var SparklinesModule = { + moduleName, + version: VERSION, + dependsOn: [EnterpriseCoreModule], + validate: () => { + return { + isValid: false, + message: _preInitErrMsg(258) + }; + }, + with: (params) => { + params.setup(); + return { + moduleName, + version: VERSION, + dependsOn: [EnterpriseCoreModule], + css: [sparkline_default], + userComponents: { + agSparklineCellRenderer: { + classImp: SparklineCellRenderer, + /** Default params for provided components */ + params: { createSparkline: params.createSparkline } + } + }, + validate: () => { + return { isValid: true }; + } + }; + } +}; + +// packages/ag-grid-enterprise/src/find/find.css +var find_default = ".ag-find-cell{display:block;overflow:hidden;text-overflow:ellipsis}.ag-find-match{background-color:var(--ag-find-match-background-color);color:var(--ag-find-match-color)}.ag-find-active-match{background-color:var(--ag-find-active-match-background-color);color:var(--ag-find-active-match-color)}"; + +// packages/ag-grid-enterprise/src/find/findApi.ts +function findNext(beans) { + beans.findSvc?.next(); +} +function findPrevious(beans) { + beans.findSvc?.previous(); +} +function findGetTotalMatches(beans) { + return beans.findSvc?.totalMatches ?? 0; +} +function findGoTo(beans, match, force) { + beans.findSvc?.goTo(match, force); +} +function findClearActive(beans) { + beans.findSvc?.clearActive(); +} +function findGetActiveMatch(beans) { + return beans.findSvc?.activeMatch; +} +function findGetNumMatches(beans, params) { + const { node, column } = params; + return beans.findSvc?.getNumMatches(node, column) ?? 0; +} +function findGetParts(beans, params) { + return beans.findSvc?.getParts(params) ?? []; +} +function findRefresh(beans) { + return beans.findSvc?.refresh(true); +} + +// packages/ag-grid-enterprise/src/find/findCellRenderer.ts +import { Component as Component56, _clearElement as _clearElement19, _createElement as _createElement17, _toString as _toString2 } from "ag-grid-community"; +var FindCellRendererElement = { tag: "span", cls: "ag-find-cell" }; +var FindCellRenderer = class extends Component56 { + constructor() { + super(FindCellRendererElement); + } + init(params) { + this.refresh(params); + } + refresh(params) { + const { node, column } = params; + const { findSvc, valueSvc } = this.beans; + const { value, valueFormatted } = valueSvc.getValueForDisplay({ + column, + node, + includeValueFormatted: true, + from: "edit" + }); + const displayValue = valueFormatted ?? value ?? ""; + const eGui = this.getGui(); + _clearElement19(eGui); + const parts = findSvc?.getParts({ value: displayValue, node, column: column ?? null }); + if (!parts) { + eGui.textContent = _toString2(displayValue) ?? ""; + eGui.classList.remove("ag-find-cell-active-match"); + } else { + let hasActiveMatch = false; + for (const { value: value2, match, activeMatch } of parts) { + const content = _toString2(value2) ?? ""; + if (match) { + const element = _createElement17({ tag: "mark", cls: "ag-find-match" }); + element.textContent = content; + if (activeMatch) { + element.classList.add("ag-find-active-match"); + hasActiveMatch = true; + } + eGui.appendChild(element); + } else { + eGui.appendChild(document.createTextNode(content)); + } + } + eGui.classList.toggle("ag-find-cell-active-match", hasActiveMatch); + } + return true; + } +}; + +// packages/ag-grid-enterprise/src/find/findService.ts +import { + BeanStub as BeanStub83, + _addGridCommonParams as _addGridCommonParams27, + _debounce as _debounce7, + _isClientSideRowModel as _isClientSideRowModel9, + _isFullWidthGroupRow, + _jsonEquals as _jsonEquals4, + _missing as _missing9, + _toString as _toString3, + isSpecialCol as isSpecialCol5 +} from "ag-grid-community"; +function defaultCaseFormat(value) { + return value?.toLocaleLowerCase(); +} +function getMatchesForValue(findSearchValue, caseFormat, valueToFind) { + const finalValue = caseFormat(_toString3(valueToFind)); + let numMatches = 0; + if (finalValue?.length) { + let index = -1; + while (true) { + index = finalValue.indexOf(findSearchValue, index + 1); + if (index != -1) { + numMatches++; + } else { + break; + } + } + } + return numMatches; +} +var FindService = class extends BeanStub83 { + constructor() { + super(...arguments); + this.beanName = "findSvc"; + /** + * Is find currently active (e.g. non-empty search value). + * Used for performance when checking matches (part of cell rendering) + */ + this.active = false; + /** pinned top matches */ + this.topMatches = /* @__PURE__ */ new Map(); + /** same nodes as keys in `topMatches`, but kept separate for performance when moving backwards and forwards through the matches */ + this.topNodes = []; + /** total number of matches in pinned top */ + this.topNumMatches = 0; + this.centerMatches = /* @__PURE__ */ new Map(); + this.centerNodes = []; + this.centerNumMatches = 0; + this.bottomMatches = /* @__PURE__ */ new Map(); + this.bottomNodes = []; + /** switches based on grid options */ + this.caseFormat = defaultCaseFormat; + /** whether to scroll to active match after a refresh */ + this.scrollOnRefresh = false; + this.totalMatches = 0; + } + postConstruct() { + if (!_isClientSideRowModel9(this.gos)) { + return; + } + const refreshAndWipeActive = this.refresh.bind(this, false); + const refreshAndKeepActive = this.refresh.bind(this, true); + const refreshAndKeepActiveDebounced = _debounce7( + this, + () => { + if (this.isAlive()) { + refreshAndKeepActive(); + } + }, + 0 + ); + this.refreshDebounced = refreshAndKeepActiveDebounced; + this.addManagedPropertyListener("findSearchValue", refreshAndWipeActive); + this.addManagedPropertyListener("findOptions", ({ currentValue, previousValue }) => { + if (!_jsonEquals4(currentValue, previousValue)) { + refreshAndWipeActive(); + } + }); + this.addManagedPropertyListeners(["groupSuppressBlankHeader", "showOpenedGroup"], refreshAndKeepActive); + this.addManagedEventListeners({ + modelUpdated: refreshAndKeepActive, + displayedColumnsChanged: refreshAndKeepActive, + pinnedRowDataChanged: refreshAndKeepActive, + cellValueChanged: refreshAndKeepActiveDebounced, + rowNodeDataChanged: refreshAndKeepActiveDebounced, + cellEditingStopped: refreshAndKeepActiveDebounced, + cellEditValuesChanged: refreshAndKeepActiveDebounced, + batchEditingStopped: refreshAndKeepActiveDebounced + }); + const rowSpanSvc = this.beans.rowSpanSvc; + if (rowSpanSvc) { + this.addManagedListeners(rowSpanSvc, { spannedCellsUpdated: refreshAndKeepActiveDebounced }); + } + refreshAndWipeActive(); + } + next() { + this.findAcrossContainers(false, ["top", null, "bottom"], 1, 1); + } + previous() { + this.findAcrossContainers(true, ["bottom", null, "top"], this.totalMatches, -1); + } + goTo(match, force) { + if (!force && match === this.activeMatch?.numOverall) { + return; + } + const { topMatches, topNumMatches, centerMatches, centerNumMatches, bottomMatches } = this; + if (match <= topNumMatches) { + this.goToInContainer(topMatches, match, 0); + return; + } + if (match <= centerNumMatches) { + this.goToInContainer(centerMatches, match, topNumMatches); + return; + } + this.goToInContainer(bottomMatches, match, topNumMatches + centerNumMatches); + } + clearActive() { + if (this.activeMatch) { + this.setActive(void 0); + } + } + // called by cell ctrl, so needs to be performant + isMatch(node, column) { + return this.active && !!this.getMatches(node.rowPinned).get(node)?.some(([colToCheck]) => colToCheck === column); + } + getNumMatches(node, column) { + return this.getMatches(node.rowPinned).get(node)?.find(([colToCheck]) => colToCheck === column)?.[1] ?? 0; + } + /** + * Get detail for cell renderer. Splits up the cell value into strings depending on + * whether they don't match, match, or are the active match + */ + getParts(params) { + const { value, node, column, precedingNumMatches } = params; + const findSearchValue = this.findSearchValue; + const stringValue = _toString3(value) ?? ""; + if (_missing9(findSearchValue)) { + return [{ value: stringValue }]; + } + const valueToFind = this.caseFormat(stringValue) ?? ""; + const activeMatchNum = this.getActiveMatchNum(node, column) - (precedingNumMatches ?? 0); + let lastIndex = 0; + let currentMatchNum = 0; + const findTextLength = findSearchValue.length; + const parts = []; + while (true) { + const index = valueToFind.indexOf(findSearchValue, lastIndex); + if (index != -1) { + currentMatchNum++; + if (index > lastIndex) { + parts.push({ value: stringValue.slice(lastIndex, index) }); + } + const endIndex = index + findTextLength; + parts.push({ + value: stringValue.slice(index, endIndex), + match: true, + activeMatch: currentMatchNum === activeMatchNum + }); + lastIndex = endIndex; + } else { + if (lastIndex < stringValue.length) { + parts.push({ + value: stringValue.slice(lastIndex) + }); + } + return parts; + } + } + } + // when a detail grid is created, we need to sync the matches + registerDetailGrid(node, api) { + const gos = this.gos; + if (!_isClientSideRowModel9(gos)) { + return; + } + const isSearchDetail = () => gos.get("findOptions")?.searchDetail; + const compareMatchesAndRefresh = (newNumMatches) => { + const nodeMatch = this.centerMatches.get(node)?.[0]; + const oldNumMatches = nodeMatch?.[1] ?? 0; + if (newNumMatches !== oldNumMatches) { + this.refreshDebounced(); + } + }; + api.addEventListener("findChanged", (event) => { + if (api.isDestroyed() || !this.isAlive() || !this.active || !isSearchDetail()) { + return; + } + compareMatchesAndRefresh(event.totalMatches); + }); + api.addEventListener("gridPreDestroyed", () => { + if (!this.isAlive() || !this.active || !isSearchDetail()) { + return; + } + const masterNode = node.parent; + const findSearchValue = this.findSearchValue; + if (!masterNode || !findSearchValue) { + return; + } + const numMatches = gos.get("detailCellRendererParams")?.getFindMatches?.({ + node: masterNode, + data: masterNode.data, + findSearchValue: gos.get("findSearchValue"), + updateMatches: this.refreshDebounced, + getMatchesForValue: (value) => getMatchesForValue(findSearchValue, this.caseFormat, value) + }) ?? 0; + compareMatchesAndRefresh(numMatches); + }); + if (isSearchDetail()) { + api.setGridOption("findSearchValue", gos.get("findSearchValue")); + } + } + // updates all the matches + refresh(maintainActive) { + const rowNodesToRefresh = /* @__PURE__ */ new Set([...this.topNodes, ...this.centerNodes, ...this.bottomNodes]); + this.topNodes = []; + this.centerNodes = []; + this.bottomNodes = []; + const { + topNodes, + topMatches, + centerMatches, + centerNodes, + bottomNodes, + bottomMatches, + beans: { + gos, + visibleCols, + rowModel, + valueSvc, + pinnedRowModel, + pagination, + rowSpanSvc, + masterDetailSvc, + colModel + }, + findSearchValue: oldFindSearchValue + } = this; + const findOptions = gos.get("findOptions"); + const caseFormat = findOptions?.caseSensitive ? (value) => value ?? void 0 : defaultCaseFormat; + this.caseFormat = caseFormat; + const providedFindSearchValue = gos.get("findSearchValue"); + const findSearchValue = caseFormat(providedFindSearchValue?.trim()); + this.findSearchValue = findSearchValue; + topMatches.clear(); + centerMatches.clear(); + bottomMatches.clear(); + const oldActiveMatch = maintainActive ? this.activeMatch : void 0; + this.activeMatch = void 0; + const checkMasterDetail = gos.get("masterDetail") && findOptions?.searchDetail && masterDetailSvc; + if (_missing9(findSearchValue)) { + this.active = false; + this.topNumMatches = 0; + this.centerNumMatches = 0; + this.totalMatches = 0; + this.refreshRows(rowNodesToRefresh); + if (checkMasterDetail) { + const store = masterDetailSvc.store; + for (const detailId of Object.keys(store)) { + store[detailId]?.api?.findClearActive(); + } + } + if (!_missing9(oldFindSearchValue)) { + this.dispatchFindChanged(); + } + return; + } + const allCols = visibleCols.allCols; + const isFullWidthCellFunc = gos.getCallback("isFullWidthRow"); + const detailCellRendererParams = gos.get("detailCellRendererParams"); + const fullWidthCellRendererParams = gos.get("fullWidthCellRendererParams"); + const groupRowRendererParams = gos.get("groupRowRendererParams"); + const flattenDetails = _getFlattenDetails(gos); + const pivotMode = colModel.isPivotMode(); + let containerNumMatches = 0; + let matches; + let rowNodes; + let checkCurrentPage = false; + const addMatches = (node, column, numMatches, skipRefresh) => { + if (!numMatches) { + return; + } + let rowMatches = matches.get(node); + if (!rowMatches) { + rowMatches = []; + matches.set(node, rowMatches); + rowNodes.push(node); + if (!skipRefresh) { + rowNodesToRefresh.add(node); + } + } + rowMatches.push([column, numMatches]); + containerNumMatches += numMatches; + }; + const findMatchesForRow = (node) => { + if (checkCurrentPage) { + let rowIndex = node.rowIndex; + let nodeToCheck = node.parent; + while (rowIndex == null && nodeToCheck) { + rowIndex = nodeToCheck.rowIndex; + nodeToCheck = nodeToCheck.parent; + } + if (rowIndex == null || !pagination.isRowInPage(rowIndex)) { + return; + } + } + const isParent = node.hasChildren(); + if (!_shouldRowBeRendered( + flattenDetails, + node, + isParent, + pivotMode, + _isRemovedSingleChildrenGroup(flattenDetails, node, isParent), + _isRemovedLowestSingleChildrenGroup(flattenDetails, node, isParent) + )) { + return; + } + const data = node.data; + if (isFullWidthCellFunc?.({ rowNode: node })) { + if (fullWidthCellRendererParams) { + const numMatches = fullWidthCellRendererParams.getFindMatches?.({ + node, + data, + findSearchValue: providedFindSearchValue, + updateMatches: this.refreshDebounced, + getMatchesForValue: (value) => getMatchesForValue(findSearchValue, caseFormat, value) + }) ?? 0; + addMatches(node, null, numMatches); + } + return; + } + if (_isFullWidthGroupRow(gos, node, pivotMode)) { + let valueToFind; + const getFindText = groupRowRendererParams?.getFindText; + if (getFindText) { + const value = valueSvc.getValueForDisplay({ node, from: "batch" }).value; + valueToFind = getFindText( + _addGridCommonParams27(gos, { + value, + node, + data, + column: null, + colDef: null, + getValueFormatted: () => { + const { valueFormatted } = valueSvc.getValueForDisplay({ + node, + includeValueFormatted: true, + from: "batch" + }); + return valueFormatted; + } + }) + ); + } else { + const { value, valueFormatted } = valueSvc.getValueForDisplay({ + node, + includeValueFormatted: true, + from: "batch" + }); + valueToFind = valueFormatted ?? value; + } + const numMatches = getMatchesForValue(findSearchValue, caseFormat, valueToFind); + addMatches(node, null, numMatches); + return; + } + const nodeWillBeHiddenByOpenParent = node.level > 0 && gos.get("groupHideOpenParents") && node.parent?.getFirstChild() === node && !node.parent?.expanded; + for (const column of allCols) { + if (isSpecialCol5(column)) { + continue; + } + const cellSpan = rowSpanSvc?.getCellSpan(column, node); + if (cellSpan && cellSpan.firstNode !== node) { + continue; + } + if (column.colDef.showRowGroup && nodeWillBeHiddenByOpenParent) { + continue; + } + let valueToFind; + const colDef = column.colDef; + const getFindText = colDef.getFindText; + if (getFindText) { + const value = valueSvc.getValueForDisplay({ column, node, from: "batch" }).value; + valueToFind = getFindText( + _addGridCommonParams27(gos, { + value, + node, + data, + column, + colDef, + getValueFormatted: () => { + const { valueFormatted } = valueSvc.getValueForDisplay({ + column, + node, + includeValueFormatted: true, + from: "batch" + }); + return valueFormatted; + } + }) + ); + } else { + const { value, valueFormatted } = valueSvc.getValueForDisplay({ + column, + node, + includeValueFormatted: true, + from: "batch" + }); + valueToFind = valueFormatted ?? value; + } + const numMatches = getMatchesForValue(findSearchValue, caseFormat, valueToFind); + addMatches(node, column, numMatches); + } + if (node.master && checkMasterDetail) { + const detailNode = node.detailNode; + if (detailNode) { + const detailApi = detailNode.detailGridInfo?.api; + if (detailApi) { + detailApi.setGridOption("findSearchValue", providedFindSearchValue); + const numMatches = detailApi.findGetTotalMatches(); + addMatches(detailNode, null, numMatches); + return; + } + } + if (detailCellRendererParams) { + const numMatches = detailCellRendererParams.getFindMatches?.({ + node, + data, + findSearchValue: providedFindSearchValue, + updateMatches: this.refreshDebounced, + getMatchesForValue: (value) => getMatchesForValue(findSearchValue, caseFormat, value) + }) ?? 0; + addMatches( + detailNode ?? { parent: node, dummy: true }, + null, + numMatches, + !detailNode + // if dummy detail node, don't refresh + ); + } + } + }; + matches = topMatches; + rowNodes = topNodes; + pinnedRowModel?.forEachPinnedRow("top", findMatchesForRow); + this.topNumMatches = containerNumMatches; + let totalMatches = containerNumMatches; + matches = centerMatches; + rowNodes = centerNodes; + containerNumMatches = 0; + checkCurrentPage = !!pagination && !!findOptions?.currentPageOnly; + rowModel.forEachNodeAfterFilterAndSort(findMatchesForRow, true); + this.centerNumMatches = containerNumMatches; + totalMatches += containerNumMatches; + matches = bottomMatches; + rowNodes = bottomNodes; + containerNumMatches = 0; + checkCurrentPage = false; + pinnedRowModel?.forEachPinnedRow("bottom", findMatchesForRow); + totalMatches += containerNumMatches; + this.totalMatches = totalMatches; + this.active = true; + this.refreshRows(rowNodesToRefresh); + if (oldActiveMatch) { + this.resetActiveMatch(oldActiveMatch); + } + this.dispatchFindChanged(); + } + // update the active match back to what it was previously if possible. e.g. row index might have changed + resetActiveMatch(oldActiveMatch) { + const { column, numInMatch } = oldActiveMatch; + let node = oldActiveMatch.node; + if (node.dummy) { + const detailNode = node.parent?.detailNode; + if (!detailNode) { + return; + } + node = detailNode; + } + const rowPinned = node.rowPinned ?? null; + const stillValid = this.getMatches(rowPinned)?.get(node)?.some(([columnToCheck, numMatches]) => columnToCheck === column && numMatches >= numInMatch); + if (!stillValid) { + return; + } + let numOverall = 0; + if (rowPinned == null) { + numOverall = this.topNumMatches; + } else if (rowPinned === "bottom") { + numOverall = this.topNumMatches + this.centerNumMatches; + } + const updateNumInMatches = () => { + const matches = this.getMatches(rowPinned); + for (const nodeToCheck of matches.keys()) { + const matchingNode = nodeToCheck === node; + const cols = matches.get(nodeToCheck); + for (const [columnToCheck, numMatches] of cols) { + if (matchingNode && columnToCheck === column) { + numOverall += numInMatch; + return; + } + numOverall += numMatches; + } + } + }; + updateNumInMatches(); + const activeMatch = { + ...oldActiveMatch, + node, + numOverall + }; + this.activeMatch = activeMatch; + this.refreshRows(/* @__PURE__ */ new Set([node]), column == null ? void 0 : /* @__PURE__ */ new Set([column])); + if (this.scrollOnRefresh) { + this.scrollOnRefresh = false; + this.scrollToActive(activeMatch); + } + this.setDetailActive(activeMatch); + } + refreshRows(rowNodes, columns) { + if (!rowNodes.size) { + return; + } + this.beans.rowRenderer.refreshCells({ + rowNodes: [...rowNodes], + columns: columns ? [...columns] : void 0, + force: true, + suppressFlash: true + }); + } + // go to the next/previous match across all containers + findAcrossContainers(backwards, containers, startNum, increment) { + if (!this.totalMatches) { + this.setActive(); + return; + } + const activeMatch = this.activeMatch; + let containersToFind = containers; + if (activeMatch) { + const { column, node, numInMatch, numOverall } = activeMatch; + const rowPinned = node.rowPinned ?? null; + const nextOverallNum = numOverall + increment; + const matchInContainer = this.findInContainer( + rowPinned, + backwards, + nextOverallNum, + node, + column, + numInMatch + ); + if (matchInContainer) { + return; + } + const activeContainerIndex = containers.indexOf(rowPinned); + const containerLength = containers.length; + const containersAfter = containers.slice(activeContainerIndex + 1, containerLength); + if (containersAfter.some( + (containerRowPinned) => this.findInContainer(containerRowPinned, backwards, nextOverallNum) + )) { + return; + } + containersToFind = containers.slice(0, activeContainerIndex + 1); + } + containersToFind.some((containerRowPinned) => this.findInContainer(containerRowPinned, backwards, startNum)); + } + // go to the next/previous match within a container + findInContainer(rowPinned, backwards, nextOverallNum, currentNode, currentColumn, currentNumInMatch) { + const matches = this.getMatches(rowPinned); + const rowNodes = this.getRowNodes(rowPinned); + const direction = backwards ? -1 : 1; + if (currentNode != null) { + const currentIndexRowMatches = matches.get(currentNode); + const colArrayIndex = currentIndexRowMatches?.findIndex(([column]) => column === currentColumn); + if (colArrayIndex != null && colArrayIndex != -1) { + const [column, numMatches] = currentIndexRowMatches[colArrayIndex]; + if (backwards ? currentNumInMatch > 1 : currentNumInMatch < numMatches) { + this.setActive({ + column, + node: currentNode, + numInMatch: currentNumInMatch + direction, + numOverall: nextOverallNum + }); + return true; + } + } + const nextMatch2 = colArrayIndex != null && colArrayIndex != -1 ? currentIndexRowMatches?.[colArrayIndex + direction] : void 0; + if (nextMatch2) { + const [column, numMatches] = nextMatch2; + this.setActive({ + column, + node: currentNode, + numInMatch: backwards ? numMatches : 1, + numOverall: nextOverallNum + }); + return true; + } + } + let nextNode; + if (currentNode == null) { + nextNode = rowNodes[backwards ? rowNodes.length - 1 : 0]; + } else { + const rowArrayIndex = rowNodes.findIndex((node) => node === currentNode); + nextNode = rowNodes[rowArrayIndex + direction]; + } + if (nextNode == null) { + return false; + } + const nextIndexRowMatches = matches.get(nextNode); + const nextMatch = nextIndexRowMatches?.[backwards ? nextIndexRowMatches.length - 1 : 0]; + if (nextMatch) { + const [column, numMatches] = nextMatch; + this.setActive({ + column, + node: nextNode, + numInMatch: backwards ? numMatches : 1, + numOverall: nextOverallNum + }); + return true; + } + return false; + } + dispatchFindChanged() { + const { eventSvc, activeMatch, totalMatches, findSearchValue } = this; + eventSvc.dispatchEvent({ + type: "findChanged", + activeMatch, + totalMatches, + findSearchValue + }); + } + setActive(activeMatch) { + if (activeMatch && activeMatch.node.rowIndex == null) { + const node = activeMatch.node; + let parent = node.footer ? node.sibling : node.parent; + while (parent && parent.level !== -1) { + parent.expanded = true; + parent = parent.parent; + } + this.activeMatch = activeMatch; + this.scrollOnRefresh = true; + this.beans.expansionSvc?.onGroupExpandedOrCollapsed(); + return; + } + const oldActiveMatch = this.activeMatch; + this.activeMatch = activeMatch; + this.refreshAndScrollToActive(activeMatch, oldActiveMatch); + if (activeMatch) { + this.setDetailActive(activeMatch); + } + this.dispatchFindChanged(); + } + setDetailActive({ node, numInMatch }) { + if (node.detail) { + node.detailGridInfo?.api?.findGoTo(numInMatch); + } + } + refreshAndScrollToActive(activeMatch, oldActiveMatch) { + if (activeMatch || oldActiveMatch) { + const nodes = /* @__PURE__ */ new Set(); + const columns = /* @__PURE__ */ new Set(); + let skipColumns = false; + const addMatch = (match) => { + if (!match) { + return; + } + const { node, column } = match; + nodes.add(node); + if (column == null) { + skipColumns = true; + } else { + columns.add(column); + } + }; + addMatch(activeMatch); + addMatch(oldActiveMatch); + this.refreshRows(nodes, skipColumns ? void 0 : columns); + } + if (activeMatch) { + this.scrollToActive(activeMatch); + } + } + scrollToActive({ node: { rowPinned, rowIndex }, column }) { + const { ctrlsSvc, pagination, gos } = this.beans; + const scrollFeature = ctrlsSvc.getScrollFeature(); + if (rowPinned == null && rowIndex != null) { + if (pagination && !gos.get("findOptions")?.currentPageOnly && !pagination.isRowInPage(rowIndex)) { + pagination.goToPageWithIndex(rowIndex); + } + scrollFeature.ensureIndexVisible(rowIndex); + } + scrollFeature.ensureColumnVisible(column); + } + // search for the specified overall `match` number with the provided container, and set it to be active + goToInContainer(matches, match, startNum) { + let currentMatch = startNum; + for (const node of matches.keys()) { + const cols = matches.get(node); + for (const [column, numMatches] of cols) { + if (match <= currentMatch + numMatches) { + this.setActive({ + column, + node, + numInMatch: match - currentMatch, + numOverall: match + }); + return; + } + currentMatch += numMatches; + } + } + } + getMatches(rowPinned) { + if (rowPinned === "top") { + return this.topMatches; + } else if (rowPinned === "bottom") { + return this.bottomMatches; + } else { + return this.centerMatches; + } + } + getRowNodes(rowPinned) { + if (rowPinned === "top") { + return this.topNodes; + } else if (rowPinned === "bottom") { + return this.bottomNodes; + } else { + return this.centerNodes; + } + } + getActiveMatchNum(node, column) { + const activeMatch = this.activeMatch; + return activeMatch != null && activeMatch.node === node && activeMatch.column === column ? activeMatch.numInMatch : 0; + } + destroy() { + this.topMatches.clear(); + this.topNodes.length = 0; + this.centerMatches.clear(); + this.centerNodes.length = 0; + this.bottomMatches.clear(); + this.bottomNodes.length = 0; + this.activeMatch = void 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/find/findModule.ts +var FindCoreModule = { + moduleName: "FindCore", + version: VERSION, + rowModels: ["clientSide"], + beans: [FindService], + userComponents: { + agFindCellRenderer: FindCellRenderer + }, + css: [find_default] +}; +var FindModule = { + moduleName: "Find", + version: VERSION, + apiFunctions: { + findGetTotalMatches, + findGoTo, + findNext, + findPrevious, + findGetActiveMatch, + findGetNumMatches, + findGetParts, + findClearActive, + findRefresh + }, + dependsOn: [EnterpriseCoreModule, FindCoreModule] +}; + +// packages/ag-grid-enterprise/src/batch-edit/batchEditModule.ts +import { _EditCoreModule as _EditCoreModule2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/batch-edit/batchEditApi.ts +import { _isClientSideRowModel as _isClientSideRowModel10, _warn as _warn55 } from "ag-grid-community"; +function startBatchEdit({ editSvc, gos, rowModel }) { + if (!_isClientSideRowModel10(gos, rowModel)) { + _warn55(289, { rowModelType: gos.get("rowModelType") }); + return; + } + editSvc?.startBatchEditing(); +} +function cancelBatchEdit({ editSvc }) { + editSvc?.stopBatchEditing({ cancel: true, source: "api", forceCancel: true }); +} +function commitBatchEdit({ editSvc }) { + editSvc?.stopBatchEditing({ source: "api", forceStop: true, commit: true }); +} +function isBatchEditing(beans) { + return beans.editSvc?.isBatchEditing() ?? false; +} + +// packages/ag-grid-enterprise/src/batch-edit/batchEditModule.ts +var BatchEditModule = { + moduleName: "BatchEdit", + version: VERSION, + beans: [], + apiFunctions: { + isBatchEditing, + startBatchEdit, + cancelBatchEdit, + commitBatchEdit + }, + dependsOn: [_EditCoreModule2, EnterpriseCoreModule], + css: [] +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingEditValueSvc.ts +import { BeanStub as BeanStub84 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/rowGrouping/distributeGroupValue/valueConversion.ts +var resolveStrategy = (aggFunc, distribution) => { + if (distribution === false || distribution === null) { + return false; + } + if (isNonDistributable(aggFunc)) { + return distribution === "overwrite" ? "overwrite" : false; + } + if (typeof distribution === "string") { + return distribution; + } + if (aggFunc === "sum") { + return "uniform"; + } + if (aggFunc === "avg" || aggFunc == null) { + return "overwrite"; + } + return distribution === true ? "overwrite" : false; +}; +var isNonDistributable = (aggFunc) => aggFunc === "count" || aggFunc === "min" || aggFunc === "max" || aggFunc === "first" || aggFunc === "last"; +var isDistributableBuiltin = (aggFunc) => aggFunc === "sum" || aggFunc === "avg"; +var toNumber = (raw) => { + if (typeof raw === "number") { + return raw; + } + if (typeof raw === "bigint" || typeof raw === "string") { + const r = Number(raw); + return Number.isFinite(r) ? r : 0; + } + if (typeof raw === "boolean") { + return raw ? 1 : 0; + } + if (raw != null && typeof raw === "object") { + if (typeof raw.toNumber === "function") { + return toNumber(raw.toNumber()); + } + if ("value" in raw) { + return toNumber(raw.value); + } + } + return 0; +}; +var numberToBigInt = (value) => Number.isFinite(value) ? BigInt(Math.round(value)) : 0n; +var toBigInt = (raw) => { + if (typeof raw === "bigint") { + return raw; + } + if (typeof raw === "number") { + return numberToBigInt(raw); + } + if (typeof raw === "boolean") { + return raw ? 1n : 0n; + } + if (typeof raw === "string") { + try { + return BigInt(raw); + } catch { + return numberToBigInt(Number(raw)); + } + } + if (raw != null && typeof raw === "object") { + if (typeof raw.toNumber === "function") { + return toBigInt(raw.toNumber()); + } + if ("value" in raw) { + return toBigInt(raw.value); + } + } + return 0n; +}; +var isNumericLike = (value) => { + const t = typeof value; + if (t === "number" || t === "bigint" || t === "boolean") { + return true; + } + if (t === "string") { + return Number.isFinite(Number(value)); + } + if (value != null && t === "object") { + if (typeof value.toNumber === "function") { + return true; + } + if ("value" in value) { + return isNumericLike(value.value); + } + } + return false; +}; +var detectPrecision = (colDef) => { + if (colDef.cellDataType === "bigint") { + return 0; + } + const ep = colDef.cellEditorParams; + if (ep == null || typeof ep !== "object") { + return void 0; + } + const precision = ep.precision; + if (typeof precision === "number" && Number.isInteger(precision) && precision >= 0) { + return precision; + } + const step = ep.step; + if (typeof step === "number" && Number.isInteger(step)) { + return 0; + } + return void 0; +}; + +// packages/ag-grid-enterprise/src/rowGrouping/distributeGroupValue/distributorBigInt.ts +var DistributorBigInt = class { + constructor(params, opts, aggFunc) { + this.params = params; + const { aggregatedChildren: children, column, newValue } = params; + const newBigInt = toBigInt(newValue); + const oldBigInt = toBigInt(params.oldValue); + const count = children.length; + const bigCount = BigInt(count); + this.children = children; + this.column = column; + this.count = count; + this.bigCount = bigCount; + this.newValue = newValue; + this.strategy = resolveStrategy(aggFunc, opts?.distribution); + if (aggFunc === "avg") { + this.target = newBigInt * bigCount; + this.oldTarget = oldBigInt * bigCount; + } else { + this.target = newBigInt; + this.oldTarget = oldBigInt; + } + this.getVal = opts?.getValue; + this.setVal = opts?.setValue; + } + run() { + const { strategy, newValue } = this; + if (strategy === false) { + return false; + } + if (strategy === "overwrite") { + return this.writeAll(newValue); + } + const { target, oldTarget } = this; + if (target === 0n && !isNumericLike(newValue)) { + return this.writeAll(newValue); + } + if (strategy === "increment" && target === oldTarget) { + return false; + } + if (strategy === "uniform") { + return this.writeUniformDirect(target); + } + if (strategy === "increment") { + return this.writeIncrementDirect(target - oldTarget); + } + return this.writePercentage(); + } + /** Reads a child's current value as a bigint. */ + readOne(index) { + const { children, column, getVal } = this; + const node = children[index]; + if (getVal) { + const { colDef, api, context } = this.params; + return toBigInt(getVal({ node, data: node.data, column, colDef, api, context, groupParams: this.params })); + } + return toBigInt(node.getDataValue(column, "value")); + } + /** Writes a value to a single child. */ + writeOne(index, value) { + const { children, column, setVal } = this; + const node = children[index]; + if (setVal) { + const { colDef, api, context } = this.params; + return setVal({ node, data: node.data, column, colDef, api, context, groupParams: this.params, value }); + } + return node.setDataValue(column, value, "data"); + } + /** Writes the same value to every child. */ + writeAll(value) { + const { count } = this; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(i, value)) { + changed = true; + } + } + return changed; + } + /** Writes uniform values directly without array allocation. */ + writeUniformDirect(total) { + const { count, bigCount } = this; + const base = total / bigCount; + const rem = total - base * bigCount; + const absRem = Number(rem < 0n ? -rem : rem); + const step = rem >= 0n ? 1n : -1n; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(i, i < absRem ? base + step : base)) { + changed = true; + } + } + return changed; + } + /** Writes increment values directly without array allocation. */ + writeIncrementDirect(totalDelta) { + const { count, bigCount } = this; + const base = totalDelta / bigCount; + const rem = totalDelta - base * bigCount; + const absRem = Number(rem < 0n ? -rem : rem); + const step = rem >= 0n ? 1n : -1n; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(i, this.readOne(i) + base + (i < absRem ? step : 0n))) { + changed = true; + } + } + return changed; + } + /** Computes percentage distribution and writes values. */ + writePercentage() { + const { count, target } = this; + let total = 0n; + const values = new Array(count); + for (let i = 0; i < count; ++i) { + const v = this.readOne(i); + values[i] = v; + total += v; + } + if (total === 0n) { + return this.writeUniformDirect(target); + } + let scaledSum = 0n; + for (let i = 0; i < count; ++i) { + const v = values[i] * target / total; + values[i] = v; + scaledSum += v; + } + let diff = target - scaledSum; + for (let i = 0; diff > 0n && i < count; ++i, --diff) { + ++values[i]; + } + for (let i = 0; diff < 0n && i < count; ++i, ++diff) { + --values[i]; + } + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(i, values[i])) { + changed = true; + } + } + return changed; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/distributeGroupValue/distributorNumber.ts +var DistributorNumber = class { + constructor(params, opts, aggFunc) { + this.params = params; + const { aggregatedChildren: children, column, colDef, newValue } = params; + const newNumber = toNumber(newValue); + const count = children.length; + const isAvg = aggFunc === "avg"; + this.children = children; + this.column = column; + this.count = count; + this.newValue = newValue; + this.strategy = resolveStrategy(aggFunc, opts?.distribution); + this.isAvg = isAvg; + if (isAvg) { + this.target = newNumber * count; + this.oldTarget = toNumber(params.oldValue) * count; + } else { + this.target = newNumber; + this.oldTarget = toNumber(params.oldValue); + } + const explicitPrecision = opts?.precision; + if (explicitPrecision === false) { + this.precision = void 0; + } else if (typeof explicitPrecision === "number") { + this.precision = Number.isInteger(explicitPrecision) && explicitPrecision >= 0 ? explicitPrecision : void 0; + } else { + this.precision = detectPrecision(colDef); + } + this.getVal = opts?.getValue; + this.setVal = opts?.setValue; + } + run() { + const { strategy, newValue } = this; + if (strategy === false) { + return false; + } + if (strategy === "overwrite") { + return this.writeAll(newValue); + } + if (this.target === 0 && !isNumericLike(newValue)) { + return this.writeAll(newValue); + } + if (strategy === "increment" && this.target === this.oldTarget) { + return false; + } + switch (strategy) { + case "uniform": + return this.distributeUniform(); + case "increment": + return this.distributeIncrement(); + default: + return this.isAvg ? this.distributePercentageAvg() : this.distributePercentage(); + } + } + readOne(node) { + const { column, getVal } = this; + if (getVal) { + const { colDef, api, context } = this.params; + return toNumber(getVal({ node, data: node.data, column, colDef, api, context, groupParams: this.params })); + } + return toNumber(node.getDataValue(column, "value")); + } + /** + * Reads a child's value and leaf count in a single call. + * For group children, reads the raw avg agg object { value, count } if available, + * falling back to allLeafChildren.length. For leaf children, count is always 1. + */ + readValueAndCount(node) { + const { column, getVal } = this; + let raw; + if (getVal) { + const { colDef, api, context } = this.params; + raw = getVal({ node, data: node.data, column, colDef, api, context, groupParams: this.params }); + } else { + raw = node.getDataValue(column); + } + if (node.group) { + if (raw != null && typeof raw === "object") { + const { value, count } = raw; + if (value != null && typeof count === "number" && count > 0) { + return typeof value === "number" ? raw : { value: toNumber(value), count }; + } + } + return { value: toNumber(raw), count: node.allLeafChildren?.length || 1 }; + } + return { value: toNumber(raw), count: 1 }; + } + writeOne(node, value) { + const { column, setVal } = this; + if (setVal) { + const { colDef, api, context } = this.params; + return setVal({ node, data: node.data, column, colDef, api, context, groupParams: this.params, value }); + } + return node.setDataValue(column, value, "data"); + } + writeAll(value) { + const { children, count } = this; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], value)) { + changed = true; + } + } + return changed; + } + distributeUniform() { + const { children, count, target, precision } = this; + if (precision === void 0) { + return this.writeAll(target / count); + } + const scale = 10 ** precision; + const intTarget = Math.round(target * scale); + const base = Math.trunc(intTarget / count); + const rem = intTarget - base * count; + const absRem = Math.abs(rem); + const step = rem >= 0 ? 1 : -1; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], (i < absRem ? base + step : base) / scale)) { + changed = true; + } + } + return changed; + } + distributeIncrement() { + const { children, count, target, oldTarget, precision } = this; + if (precision === void 0) { + const add = (target - oldTarget) / count; + let changed2 = false; + for (let i = 0; i < count; ++i) { + const child = children[i]; + if (this.writeOne(child, this.readOne(child) + add)) { + changed2 = true; + } + } + return changed2; + } + const scale = 10 ** precision; + const intDelta = Math.round(target * scale) - Math.round(oldTarget * scale); + const base = Math.trunc(intDelta / count); + const rem = intDelta - base * count; + const absRem = Math.abs(rem); + const step = rem >= 0 ? 1 : -1; + let changed = false; + for (let i = 0; i < count; ++i) { + const child = children[i]; + const cur = Math.round(this.readOne(child) * scale); + if (this.writeOne(child, (cur + base + (i < absRem ? step : 0)) / scale)) { + changed = true; + } + } + return changed; + } + /** + * Scales each child's value proportionally so they sum to the target. + * Each child keeps its relative share: newValue[i] = oldValue[i] × (target / oldTotal). + * With precision rounding, uses scaled integers and spreads the remainder across the first N children. + */ + distributePercentage() { + const { children, count, target, precision } = this; + const values = new Array(count); + let total = 0; + for (let i = 0; i < count; ++i) { + const v = this.readOne(children[i]); + values[i] = v; + total += v; + } + if (total === 0) { + return this.distributeUniform(); + } + if (precision === void 0) { + const ratio = target / total; + let changed2 = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], values[i] * ratio)) { + changed2 = true; + } + } + return changed2; + } + const scale = 10 ** precision; + const intTarget = Math.round(target * scale); + let roundedSum = 0; + for (let i = 0; i < count; ++i) { + const r = Math.round(values[i] / total * intTarget); + values[i] = r; + roundedSum += r; + } + const rem = intTarget - roundedSum; + const absRem = Math.abs(rem); + const step = rem >= 0 ? 1 : -1; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], (values[i] + (i < absRem ? step : 0)) / scale)) { + changed = true; + } + } + return changed; + } + /** + * Percentage distribution for avg aggregation. + * + * Avg group children may themselves be groups with different leaf counts, + * so we can't scale avg values directly — a group averaging 2 leaves contributes + * twice as much to the parent avg as a group averaging 1 leaf. + * + * Instead, we convert each child's avg to its sum contribution (avg × leafCount), + * scale those sums proportionally, then convert back to avg for writing. + * + * The target is also converted: constructor stores target = newAvg × childGroupCount, + * but we need effectiveTarget = newAvg × totalLeafCount for sum-space scaling. + */ + distributePercentageAvg() { + const { children, count, target, precision } = this; + const values = new Array(count); + const leafCounts = new Array(count); + let total = 0; + let totalLeafCount = 0; + for (let i = 0; i < count; ++i) { + const vc = this.readValueAndCount(children[i]); + const lc = vc.count; + leafCounts[i] = lc; + totalLeafCount += lc; + const v = vc.value * lc; + values[i] = v; + total += v; + } + if (total === 0) { + return this.distributeUniform(); + } + const effectiveTarget = target / count * totalLeafCount; + if (precision === void 0) { + const ratio = effectiveTarget / total; + let changed2 = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], values[i] * ratio / leafCounts[i])) { + changed2 = true; + } + } + return changed2; + } + const scale = 10 ** precision; + const intTarget = Math.round(effectiveTarget * scale); + let roundedSum = 0; + for (let i = 0; i < count; ++i) { + const r = Math.round(values[i] / total * intTarget); + values[i] = r; + roundedSum += r; + } + const rem = intTarget - roundedSum; + const absRem = Math.abs(rem); + const step = rem >= 0 ? 1 : -1; + let changed = false; + for (let i = 0; i < count; ++i) { + if (this.writeOne(children[i], (values[i] + (i < absRem ? step : 0)) / (scale * leafCounts[i]))) { + changed = true; + } + } + return changed; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/distributeGroupValue/distributeGroupValue.ts +var distributeGroupValue = (params, options) => { + const { aggregatedChildren: children, colDef } = params; + if (children.length === 0) { + return false; + } + const aggFunc = colDef.aggFunc ?? null; + const entry = resolveDistributionEntry(options, aggFunc); + if (entry === false) { + return false; + } + if (typeof entry === "function") { + return entry(params) ?? true; + } + if (colDef.cellDataType === "bigint") { + return new DistributorBigInt(params, entry, aggFunc).run(); + } + return new DistributorNumber(params, entry, aggFunc).run(); +}; +function resolveDistributionEntry(options, aggFunc) { + if (!options) { + return void 0; + } + const dist = options.distribution; + if (dist === false || dist === null) { + return false; + } + const nonDist = isNonDistributable(aggFunc); + const defaultHandler = options.default; + if (typeof dist === "object") { + const aggEntry = typeof aggFunc === "string" ? dist[aggFunc] : void 0; + if (aggEntry !== void 0) { + return resolveEntry(aggEntry, nonDist, options); + } + if (nonDist) { + return false; + } + return resolveEntry(defaultHandler, false, options) ?? inheritOptions(options); + } + if (nonDist) { + return dist === "overwrite" ? inheritOptions(options, "overwrite") : false; + } + if (dist === void 0 && !isDistributableBuiltin(aggFunc)) { + const resolved = resolveEntry(defaultHandler, false, options); + if (resolved !== void 0) { + return resolved; + } + } + return options; +} +function resolveEntry(entry, nonDist, parent) { + if (entry === false || entry === null) { + return false; + } + if (entry === void 0) { + return void 0; + } + if (typeof entry === "function") { + return entry; + } + if (typeof entry === "object") { + const dist = entry.distribution; + if (nonDist && dist !== "overwrite" && dist !== true) { + return false; + } + const { precision: pp, getValue: pgv, setValue: psv } = parent; + return { + distribution: nonDist ? "overwrite" : dist, + precision: entry.precision ?? pp, + getValue: entry.getValue ?? pgv, + setValue: entry.setValue ?? psv + }; + } + if (nonDist && entry !== "overwrite" && entry !== true) { + return false; + } + return inheritOptions(parent, nonDist ? "overwrite" : entry); +} +function inheritOptions(parent, distribution) { + return { distribution, precision: parent.precision, getValue: parent.getValue, setValue: parent.setValue }; +} + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingEditValueSvc.ts +var RowGroupingEditValueSvc = class extends BeanStub84 { + constructor() { + super(...arguments); + this.beanName = "rowGroupingEditValueSvc"; + } + isGroupCellEditable(rowNode, column) { + const colDef = column.getColDef(); + if (!column.isColumnFunc(rowNode, colDef.groupRowEditable)) { + return false; + } + const setter = colDef.groupRowValueSetter; + if (typeof setter === "function") { + return true; + } + const aggFunc = colDef.aggFunc ?? null; + if (typeof setter === "object") { + const entry = resolveDistributionEntry(setter, aggFunc); + return typeof entry === "function" || entry !== false && resolveStrategy(aggFunc, entry?.distribution) !== false; + } + return resolveStrategy(aggFunc, setter ?? void 0) !== false; + } + setGroupDataValue(rowNode, column, newValue, oldValue, eventSource, valueChanged) { + const colDef = column.getColDef(); + let setter = colDef.groupRowValueSetter; + if (setter == null) { + const gre = colDef.groupRowEditable; + setter = gre && column.isColumnFunc(rowNode, gre) ? true : void 0; + } + if (!setter) { + return void 0; + } + const params = this.gos.addCommon({ + node: rowNode, + data: rowNode.data, + oldValue, + newValue, + colDef, + column, + eventSource, + valueChanged, + aggregatedChildren: this.beans.aggChildrenSvc?.getAggregatedChildren(rowNode, column) ?? [] + }); + const result = typeof setter === "function" ? setter(params) : ( + // true or options object — delegate to the built-in distributor. + distributeGroupValue(params, setter === true ? void 0 : setter) + ); + return result ?? true; + } +}; + +// packages/ag-grid-enterprise/src/rowGrouping/rowGroupingEditModule.ts +var RowGroupingEditModule = { + moduleName: "RowGroupingEdit", + version: VERSION, + beans: [RowGroupingEditValueSvc], + dependsOn: [EnterpriseCoreModule, SharedRowGroupingModule] +}; + +// packages/ag-grid-enterprise/src/charts/integratedChartsModule.ts +import { _PopupModule as _PopupModule5, _SharedDragAndDropModule as _SharedDragAndDropModule5, _preInitErrMsg as _preInitErrMsg2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/agChartsExports.ts +import { BeanStub as BeanStub85 } from "ag-grid-community"; +var AgChartsExports = class extends BeanStub85 { + constructor(params) { + super(); + this.beanName = "agChartsExports"; + this.isEnterprise = false; + this.create = params.create; + this._Theme = params._Theme; + this._Scene = params._Scene; + this.isEnterprise = params.isEnterprise; + this._Util = params._Util; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/enterpriseChartProxyFactory.ts +import { BeanStub as BeanStub90 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/cartesianChartProxy.ts +import { _parseDateTimeFromString as _parseDateTimeFromString3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/utils/integration.ts +function deproxy(chartOrProxy) { + if (chartOrProxy.chart != null) { + return chartOrProxy.chart; + } + return chartOrProxy; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/utils/object.ts +var SKIP_JS_BUILTINS = /* @__PURE__ */ new Set(["__proto__", "constructor", "prototype"]); +function get(source, expression, defaultValue) { + if (source == null) { + return defaultValue; + } + const keys = expression.split("."); + let objectToRead = source; + while (keys.length > 1) { + objectToRead = objectToRead[keys.shift()]; + if (objectToRead == null) { + return defaultValue; + } + } + const value = objectToRead[keys[0]]; + return value != null ? value : defaultValue; +} +function set(target, expression, value) { + if (target == null) { + return; + } + const keys = expression.split("."); + let objectToUpdate = target; + keys.filter((key) => !SKIP_JS_BUILTINS.has(key)).forEach((key, i) => { + if (!objectToUpdate[key]) { + objectToUpdate[key] = {}; + } + if (i < keys.length - 1) { + objectToUpdate = objectToUpdate[key]; + } + }); + objectToUpdate[keys[keys.length - 1]] = value; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/utils/seriesTypeMapper.ts +var CHART_TYPE_TO_SERIES_TYPE = { + column: "bar", + groupedColumn: "bar", + stackedColumn: "bar", + normalizedColumn: "bar", + bar: "bar", + groupedBar: "bar", + stackedBar: "bar", + normalizedBar: "bar", + line: "line", + stackedLine: "line", + normalizedLine: "line", + scatter: "scatter", + bubble: "bubble", + pie: "pie", + donut: "donut", + doughnut: "donut", + area: "area", + stackedArea: "area", + normalizedArea: "area", + histogram: "histogram", + radarLine: "radar-line", + radarArea: "radar-area", + nightingale: "nightingale", + radialColumn: "radial-column", + radialBar: "radial-bar", + sunburst: "sunburst", + rangeBar: "range-bar", + rangeArea: "range-area", + boxPlot: "box-plot", + treemap: "treemap", + heatmap: "heatmap", + waterfall: "waterfall", + funnel: "funnel", + coneFunnel: "cone-funnel", + pyramid: "pyramid" +}; +var COMBO_CHART_TYPES = /* @__PURE__ */ new Set(["columnLineCombo", "areaColumnCombo", "customCombo"]); +var SERIES_GROUP_TYPES = ["grouped", "stacked", "normalized"]; +var SERIES_TYPES = { + area: { + isCartesian: true, + canInvert: true + }, + bar: { + isCartesian: true, + canInvert: true + }, + histogram: { + isCartesian: true + }, + line: { + isCartesian: true, + canInvert: true + }, + pie: { + isPie: true + }, + donut: { + isPie: true, + canInvert: true + }, + scatter: { + isCartesian: true + }, + bubble: { + isCartesian: true + }, + "radial-column": { + isPolar: true, + isEnterprise: true, + isRadial: true, + canInvert: true + }, + "radial-bar": { + isPolar: true, + isEnterprise: true, + isRadial: true, + canInvert: true + }, + "radar-line": { + isPolar: true, + isEnterprise: true, + canInvert: true + }, + "radar-area": { + isPolar: true, + isEnterprise: true, + canInvert: true + }, + nightingale: { + isPolar: true, + isEnterprise: true, + canInvert: true + }, + "range-bar": { + isCartesian: true, + isStatistical: true, + isEnterprise: true, + canSwitchDirection: true + }, + "range-area": { + isCartesian: true, + isStatistical: true, + isEnterprise: true + }, + "box-plot": { + isCartesian: true, + isStatistical: true, + isEnterprise: true, + canSwitchDirection: true + }, + treemap: { + isEnterprise: true, + isHierarchical: true + }, + sunburst: { + isEnterprise: true, + isHierarchical: true + }, + heatmap: { + isCartesian: true, + isEnterprise: true + }, + waterfall: { + isCartesian: true, + isEnterprise: true, + canSwitchDirection: true + }, + funnel: { + isCartesian: true, + isEnterprise: true, + canSwitchDirection: true + }, + "cone-funnel": { + isCartesian: true, + isEnterprise: true, + canSwitchDirection: true + }, + pyramid: { + isCartesian: true, + isEnterprise: true, + canSwitchDirection: true + } +}; +function isSeriesType(seriesType) { + return !!SERIES_TYPES[seriesType]; +} +function isComboChart(chartType) { + return COMBO_CHART_TYPES.has(chartType); +} +function doesSeriesHaveProperty(seriesType, prop) { + return !!SERIES_TYPES[seriesType]?.[prop]; +} +function isEnterpriseChartType(chartType) { + return doesSeriesHaveProperty(getSeriesType(chartType), "isEnterprise"); +} +var stackedChartTypes = /* @__PURE__ */ new Set(["stackedColumn", "normalizedColumn", "stackedBar", "normalizedBar"]); +function isStacked(chartType) { + return stackedChartTypes.has(chartType); +} +function isCartesian(seriesType) { + return doesSeriesHaveProperty(seriesType, "isCartesian"); +} +function isFunnel(seriesType) { + return seriesType === "funnel" || seriesType === "cone-funnel" || seriesType === "pyramid"; +} +function isPolar(seriesType) { + return doesSeriesHaveProperty(seriesType, "isPolar"); +} +function isRadial(seriesType) { + return doesSeriesHaveProperty(seriesType, "isRadial"); +} +function isHierarchical(seriesType) { + return doesSeriesHaveProperty(seriesType, "isHierarchical"); +} +function isStatistical(seriesType) { + return doesSeriesHaveProperty(seriesType, "isStatistical"); +} +function getCanonicalChartType(chartType) { + return chartType === "doughnut" ? "donut" : chartType; +} +function getSeriesTypeIfExists(chartType) { + return CHART_TYPE_TO_SERIES_TYPE[chartType]; +} +function getSeriesType(chartType) { + return getSeriesTypeIfExists(chartType) ?? "line"; +} +function isPieChartSeries(seriesType) { + return doesSeriesHaveProperty(seriesType, "isPie"); +} +function canOnlyHaveSingleSeries(chartType) { + return chartType === "pie" || chartType === "waterfall" || chartType === "histogram" || chartType === "funnel" || chartType === "coneFunnel" || chartType === "pyramid"; +} +function getMaxNumCategories(chartType) { + return isHierarchical(getSeriesType(chartType)) ? void 0 : 1; +} +function getMaxNumSeries(chartType) { + if (isHierarchical(getSeriesType(chartType))) { + return 2; + } else if (canOnlyHaveSingleSeries(chartType)) { + return 1; + } else { + return void 0; + } +} +function supportsInvertedCategorySeries(chartType) { + return !isComboChart(chartType) && doesSeriesHaveProperty(getSeriesType(chartType), "canInvert"); +} +function canSwitchDirection(chartType) { + return doesSeriesHaveProperty(getSeriesType(chartType), "canSwitchDirection"); +} +function getFullChartNameTranslationKey(chartType) { + switch (chartType) { + case "groupedColumn": + case "stackedColumn": + case "normalizedColumn": + case "groupedBar": + case "stackedBar": + case "normalizedBar": + case "stackedLine": + case "normalizedLine": + case "stackedArea": + case "normalizedArea": + return `${chartType}Full`; + case "doughnut": + return "donut"; + case "areaColumnCombo": + return "AreaColumnCombo"; + default: + return chartType; + } +} + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/chartTheme.ts +import { _warn as _warn56 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/utils/axisTypeMapper.ts +var ALL_AXIS_TYPES = ["number", "category", "grouped-category", "log", "time"]; +function getLegacyAxisType(chartType) { + switch (chartType) { + case "bar": + case "stackedBar": + case "normalizedBar": + return ["number", "category"]; + case "groupedBar": + return ["number", "grouped-category"]; + case "column": + case "stackedColumn": + case "normalizedColumn": + case "line": + case "stackedLine": + case "normalizedLine": + case "area": + case "stackedArea": + case "normalizedArea": + case "histogram": + return ["category", "number"]; + case "groupedColumn": + return ["grouped-category", "number"]; + case "scatter": + case "bubble": + return ["number", "number"]; + default: + return void 0; + } +} + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/chartTheme.ts +function createAgChartTheme(chartProxyParams, proxy, isEnterprise, chartThemeDefaults, updatedOverrides) { + const { chartOptionsToRestore, chartPaletteToRestore, chartThemeToRestore, agChartsExports } = chartProxyParams; + const themeName = getSelectedTheme(chartProxyParams); + const stockTheme = isStockTheme(themeName, agChartsExports._Theme); + const rootTheme = stockTheme ? { baseTheme: themeName } : lookupCustomChartTheme(chartProxyParams, themeName) ?? {}; + const gridOptionsThemeOverrides = chartProxyParams.getGridOptionsChartThemeOverrides(); + const apiThemeOverrides = chartProxyParams.apiChartThemeOverrides; + const standaloneChartType = getSeriesType(chartProxyParams.chartType); + const crossFilteringOverrides = chartProxyParams.crossFiltering ? createCrossFilterThemeOverrides(proxy, chartProxyParams, standaloneChartType) : void 0; + const isTitleEnabled = () => { + const isTitleEnabled2 = (obj) => { + if (!obj) { + return false; + } + return Object.keys(obj).some((key) => get(obj[key], "title.enabled", false)); + }; + return isTitleEnabled2(gridOptionsThemeOverrides) || isTitleEnabled2(apiThemeOverrides); + }; + const overrides = [ + stockTheme ? inbuiltStockThemeOverrides(chartProxyParams, isEnterprise, isTitleEnabled()) : void 0, + pieAndDonutOverrides(), + chartThemeDefaults, + crossFilteringOverrides, + gridOptionsThemeOverrides, + apiThemeOverrides, + { ...chartOptionsToRestore ?? {} }, + updatedOverrides + ]; + const theme = overrides.filter((v) => !!v).reduce( + (r, n) => ({ + baseTheme: r, + overrides: n + }), + rootTheme + ); + if (chartPaletteToRestore && themeName === chartThemeToRestore) { + const rootThemePalette = chartProxyParams.agChartsExports._Theme.getChartTheme(rootTheme).palette; + if (!isIdenticalPalette(chartPaletteToRestore, rootThemePalette)) { + theme.palette = chartPaletteToRestore; + } + } + return theme; +} +function isIdenticalPalette(paletteA, paletteB) { + const arrayCompare = (arrA, arrB) => { + if (arrA === arrB) { + return true; + } + if (arrA?.length !== arrB?.length) { + return false; + } + return arrA?.every((v, i) => v === arrB?.[i]) ?? false; + }; + return arrayCompare(paletteA.fills, paletteB.fills) && arrayCompare(paletteA.strokes, paletteB.strokes); +} +function isStockTheme(themeName, theme) { + return Object.keys(theme.themes).includes(themeName); +} +function createCrossFilterThemeOverrides(proxy, chartProxyParams, seriesType) { + const legend = { + listeners: { + legendItemClick: (e) => { + const chart = proxy.getChart(); + const eligibleSeriesIds = [e.seriesId, `${e.seriesId}-filtered-out`]; + for (const s2 of chart.series.filter((s3) => eligibleSeriesIds.includes(s3.id))) { + s2.toggleSeriesItem(void 0, "category", e.itemId, void 0); + } + } + } + }; + const common = { + tooltip: { + delay: 500 + }, + legend, + listeners: { + click: (e) => chartProxyParams.crossFilterCallback(e, true) + } + }; + if (seriesType === "pie" || seriesType === "donut") { + return { + [seriesType]: { + series: { + fills: { + $applyCycle: [ + { $cacheMax: { $size: { $path: ["./data", { $path: "/data" }] } } }, + { $palette: "fills" }, + { + $if: [ + { $eq: [{ $value: "$parentIndex" }, 0] }, + { $mix: [{ $value: "$1" }, { $ref: "backgroundColor" }, 0.7] }, + { $value: "$1" } + ] + } + ] + }, + strokes: { + $applyCycle: [ + { $cacheMax: { $size: { $path: ["./data", { $path: "/data" }] } } }, + { $palette: "strokes" }, + { + $if: [ + { $eq: [{ $value: "$parentIndex" }, 0] }, + { $mix: [{ $value: "$1" }, { $ref: "backgroundColor" }, 0.7] }, + { $value: "$1" } + ] + } + ] + } + }, + ...common + } + }; + } + const fill = {}; + if (seriesType !== "line") { + fill.fill = { + $if: [ + { $isEven: [{ $value: "$index" }] }, + { $palette: "fill" }, + { + $mix: [ + { + $path: ["../$prevIndex/fill", { $palette: "fill" }] + }, + { $ref: "backgroundColor" }, + 0.7 + ] + } + ] + }; + } + return { + [seriesType]: { + series: { + stroke: { + $if: [ + { $isEven: [{ $value: "$index" }] }, + { $palette: "stroke" }, + { + $mix: [ + { + $path: ["../$prevIndex/fill", { $palette: "stroke" }] + }, + { $ref: "backgroundColor" }, + 0.7 + ] + } + ] + }, + ...fill + }, + ...common + } + }; +} +var STATIC_INBUILT_STOCK_THEME_AXES_OVERRIDES = ALL_AXIS_TYPES.reduce( + (r, n) => ({ ...r, [n]: { title: { _enabledFromTheme: true } } }), + {} +); +function inbuiltStockThemeOverrides(params, isEnterprise, titleEnabled) { + const extraPadding = params.getExtraPaddingDirections(); + return { + common: { + ...isEnterprise ? { animation: { duration: 500 } } : void 0, + axes: STATIC_INBUILT_STOCK_THEME_AXES_OVERRIDES, + padding: { + // don't add extra padding when a title is present! + top: !titleEnabled && extraPadding.includes("top") ? 40 : 20, + right: extraPadding.includes("right") ? 30 : 20, + bottom: extraPadding.includes("bottom") ? 40 : 20, + left: extraPadding.includes("left") ? 30 : 20 + } + } + }; +} +function pieAndDonutOverrides() { + return { + pie: { + series: { + title: { _enabledFromTheme: true }, + calloutLabel: { _enabledFromTheme: true }, + sectorLabel: { + enabled: false, + _enabledFromTheme: true + } + } + }, + donut: { + series: { + title: { _enabledFromTheme: true }, + calloutLabel: { _enabledFromTheme: true }, + sectorLabel: { + enabled: false, + _enabledFromTheme: true + } + } + } + }; +} +function getSelectedTheme(chartProxyParams) { + let chartThemeName = chartProxyParams.getChartThemeName(); + const availableThemes = chartProxyParams.getChartThemes(); + if (!availableThemes.includes(chartThemeName)) { + chartThemeName = availableThemes[0]; + } + return chartThemeName; +} +function lookupCustomChartTheme(chartProxyParams, name) { + const { customChartThemes } = chartProxyParams; + const customChartTheme = customChartThemes?.[name]; + if (!customChartTheme) { + _warn56(140, { name }); + } + return customChartTheme; +} +function getSeriesHighlight(crossFiltering, isSingleSeries) { + const highlight = { + highlightedItem: { + strokeWidth: 2 + } + }; + if (!isSingleSeries) { + highlight.unhighlightedSeries = { + opacity: 1 + }; + } + if (!crossFiltering) { + highlight.unhighlightedItem = { + opacity: 1 + }; + } + return highlight; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/chartProxy.ts +var ChartProxy = class { + constructor(chartProxyParams) { + this.chartProxyParams = chartProxyParams; + this.clearThemeOverrides = false; + this.agChartsExports = chartProxyParams.agChartsExports; + this.chart = chartProxyParams.chartInstance; + this.chartType = chartProxyParams.chartType; + this.crossFiltering = chartProxyParams.crossFiltering; + this.crossFilterCallback = chartProxyParams.crossFilterCallback; + this.standaloneChartType = getSeriesType(this.chartType); + if (this.chart == null) { + this.chart = chartProxyParams.agChartsExports.create(this.getCommonChartOptions()); + } else { + this.clearThemeOverrides = true; + } + } + crossFilteringReset() { + } + update(params) { + this.getChartRef().update(this.getUpdateOptions(params, this.getCommonChartOptions(params.updatedOverrides))); + } + updateThemeOverrides(themeOverrides) { + this.getChartRef().updateDelta({ theme: { overrides: themeOverrides } }); + } + getChart() { + return deproxy(this.chart); + } + getChartRef() { + return this.chart; + } + downloadChart(dimensions, fileName, fileFormat) { + const { chart } = this; + const rawChart = deproxy(chart); + const imageFileName = fileName || rawChart.title.node.getPlainText(); + const { width, height } = dimensions || {}; + chart.download({ width, height, fileName: imageFileName, fileFormat }); + } + getChartImageDataURL(type) { + return this.getChart().getCanvasDataURL(type); + } + getChartOptions() { + return this.chart.getOptions(); + } + getChartThemeOverrides() { + const chartOptionsTheme = this.getChartOptions().theme; + return chartOptionsTheme.overrides ?? {}; + } + getChartPalette() { + return this.agChartsExports._Theme.getChartTheme(this.getChartOptions().theme).palette; + } + setPaired(paired) { + const seriesType = getSeriesType(this.chartProxyParams.chartType); + this.chart.updateDelta({ theme: { overrides: { [seriesType]: { paired } } } }); + } + isPaired() { + const seriesType = getSeriesType(this.chartProxyParams.chartType); + return get(this.getChartThemeOverrides(), `${seriesType}.paired`, true); + } + lookupCustomChartTheme(themeName) { + return lookupCustomChartTheme(this.chartProxyParams, themeName); + } + getSeriesGroupType() { + return void 0; + } + transformCategoryData(data, categoryKey) { + return data.map((d, index) => { + const value = d[categoryKey]; + const valueString = value?.toString ? value.toString() : ""; + const datum = { ...d }; + datum[categoryKey] = { id: index, value, toString: () => valueString }; + return datum; + }); + } + getCommonChartOptions(updatedOverrides) { + const existingOptions = this.clearThemeOverrides ? {} : this.chart?.getOptions() ?? {}; + const formattingPanelOverrides = this.chart != null ? this.getActiveFormattingPanelOverrides() : void 0; + this.clearThemeOverrides = false; + const styleNonce = this.chartProxyParams.styleNonce; + const theme = createAgChartTheme( + this.chartProxyParams, + this, + this.agChartsExports.isEnterprise, + this.getChartThemeDefaults(), + updatedOverrides ?? formattingPanelOverrides + ); + const newOptions = { + ...existingOptions, + mode: "integrated", + ...styleNonce ? { styleNonce } : {}, + suppressFieldDotNotation: true, + theme, + container: this.chartProxyParams.parentElement + }; + return newOptions; + } + getChartThemeDefaults() { + const crosshair = { + enabled: true, + snap: true, + label: { + enabled: false + } + }; + const common = this.agChartsExports.isEnterprise ? { + zoom: { + enabled: true + }, + animation: { + enabled: true, + duration: 500 + }, + axes: { + number: { crosshair }, + category: { crosshair }, + log: { crosshair }, + time: { crosshair } + } + } : {}; + common.minHeight = 0; + common.minWidth = 0; + common.navigator = { + enabled: false, + height: 18 + }; + common.context = this.chartProxyParams.context; + const overrides = { + common + }; + this.setSeriesChartThemeDefaults(overrides); + return overrides; + } + setSeriesChartThemeDefaults(overrides) { + const seriesOverrides = this.getSeriesChartThemeDefaults(); + if (!seriesOverrides) { + return; + } + overrides[this.standaloneChartType] = seriesOverrides; + } + getSeriesChartThemeDefaults() { + return void 0; + } + getActiveFormattingPanelOverrides() { + if (this.clearThemeOverrides) { + return {}; + } + const inUseTheme = this.chart?.getOptions().theme; + return inUseTheme?.overrides ?? {}; + } + destroy({ keepChartInstance = false } = {}) { + if (keepChartInstance) { + this.chart.resetAnimations(); + return this.chart; + } + this.destroyChart(); + } + destroyChart() { + if (this.chart) { + this.chart.destroy(); + this.chart = void 0; + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/cartesianChartProxy.ts +var CartesianChartProxy = class extends ChartProxy { + constructor() { + super(...arguments); + this.crossFilteringAllPoints = /* @__PURE__ */ new Set(); + this.crossFilteringSelectedPoints = []; + this.isSingleSeries = false; + } + getUpdateOptions(params, commonChartOptions) { + const axes = this.getAxes(params, commonChartOptions); + return { + ...commonChartOptions, + data: this.getData(params, axes), + axes, + series: this.getSeries(params) + }; + } + getData(params, axes) { + const supportsCrossFiltering = ["area", "line"].includes(this.standaloneChartType); + return this.crossFiltering && supportsCrossFiltering ? this.getCrossFilterData(params) : this.getDataTransformedData(params, axes); + } + getDataTransformedData(params, axes) { + const xAxisType = axes.x.type; + const { categories, data } = params; + const [category] = categories; + switch (xAxisType) { + case "category": + return this.transformCategoryData(data, category.id); + case "time": + return this.transformTimeData(data, category.id, category.convertTime); + default: + return data; + } + } + getXAxisType(params) { + if (params.grouping) { + return "grouped-category"; + } else if (this.isXAxisOfType(params, "time", (value) => value instanceof Date)) { + return "time"; + } else if (this.isXAxisOfType(params, "number")) { + return "number"; + } + return "category"; + } + isXAxisOfType(params, type, isInstance) { + const [category] = params.categories; + if (category?.chartDataType) { + return category.chartDataType === type; + } + if (!isInstance) { + return false; + } + const testDatum = params.data[0]; + if (!testDatum) { + return false; + } + return isInstance(testDatum[category.id]); + } + transformTimeData(data, categoryKey, convertTime2) { + const firstValue = data[0]?.[categoryKey]; + if (firstValue instanceof Date) { + return data; + } + return data.map((datum) => { + const value = datum[categoryKey]; + return typeof value === "string" ? { + ...datum, + [categoryKey]: convertTime2 ? convertTime2(value) : _parseDateTimeFromString3(value) + } : datum; + }); + } + crossFilteringReset() { + this.crossFilteringSelectedPoints = []; + this.crossFilteringAllPoints.clear(); + } + crossFilteringPointSelected(point) { + return this.crossFilteringSelectedPoints.length == 0 || this.crossFilteringSelectedPoints.includes(point); + } + crossFilteringDeselectedPoints() { + return this.crossFilteringSelectedPoints.length > 0 && this.crossFilteringAllPoints.size !== this.crossFilteringSelectedPoints.length; + } + extractLineAreaCrossFilterSeries(series, params) { + const [category] = params.categories; + const getYKey = (yKey) => { + if (this.standaloneChartType === "area") { + const lastSelectedChartId = params.getCrossFilteringContext().lastSelectedChartId; + return lastSelectedChartId === params.chartId ? yKey + "-total" : yKey; + } + return yKey + "-total"; + }; + return series.map((s2) => { + s2.yKey = getYKey(s2.yKey); + s2.listeners = { + seriesNodeClick: (e) => { + const value = e.datum[s2.xKey]; + const multiSelection = e.event.metaKey || e.event.ctrlKey; + this.crossFilteringAddSelectedPoint(multiSelection, value); + this.crossFilterCallback(e); + } + }; + s2.marker = { + itemStyler: (p) => { + const value = p.datum[category.id]; + const highlighted = p.highlightState === "highlighted-item"; + return { + fill: highlighted ? "yellow" : p.fill, + size: highlighted ? 14 : this.crossFilteringPointSelected(value) ? 8 : 0 + }; + } + }; + if (this.standaloneChartType === "area") { + s2.fillOpacity = this.crossFilteringDeselectedPoints() ? 0.3 : 1; + } + if (this.standaloneChartType === "line") { + s2.strokeOpacity = this.crossFilteringDeselectedPoints() ? 0.3 : 1; + } + return s2; + }); + } + getCrossFilterData(params) { + this.crossFilteringAllPoints.clear(); + const [category] = params.categories; + const colId = params.fields[0].colId; + const filteredOutColId = `${colId}-filtered-out`; + const lastSelectedChartId = params.getCrossFilteringContext().lastSelectedChartId; + return params.data.map((d) => { + const value = d[category.id]; + this.crossFilteringAllPoints.add(value); + const pointSelected = this.crossFilteringPointSelected(value); + if (this.standaloneChartType === "area" && lastSelectedChartId === params.chartId) { + d[`${colId}-total`] = pointSelected ? d[colId] : d[colId] + d[filteredOutColId]; + } + if (this.standaloneChartType === "line") { + d[`${colId}-total`] = pointSelected ? d[colId] : d[colId] + d[filteredOutColId]; + } + return d; + }); + } + crossFilteringAddSelectedPoint(multiSelection, value) { + if (multiSelection) { + this.crossFilteringSelectedPoints.push(value); + } else { + this.crossFilteringSelectedPoints = [value]; + } + } + isHorizontal(commonChartOptions) { + const seriesType = this.standaloneChartType; + if (seriesType !== "waterfall" && seriesType !== "box-plot" && seriesType !== "range-bar") { + return false; + } + const theme = commonChartOptions.theme; + const isHorizontal = (theme2) => { + const direction = theme2?.overrides?.[seriesType]?.series?.direction; + if (direction != null) { + return direction === "horizontal"; + } + if (typeof theme2?.baseTheme === "object") { + return isHorizontal(theme2.baseTheme); + } + return false; + }; + return isHorizontal(theme); + } + getSeriesChartThemeDefaults() { + return { + series: { + highlight: getSeriesHighlight(this.crossFiltering, this.isSingleSeries) + } + }; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/histogramChartProxy.ts +var HistogramChartProxy = class extends CartesianChartProxy { + getSeries(params) { + const firstField = params.fields[0]; + return [ + { + type: this.standaloneChartType, + xKey: firstField.colId, + xName: firstField.displayName, + yName: this.chartProxyParams.translate("histogramFrequency"), + areaPlot: false + // only constant width is supported via integrated charts + } + ]; + } + getAxes(_params) { + return { + x: { + type: "number", + position: "bottom" + }, + y: { + type: "number", + position: "left" + } + }; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/waterfallChartProxy.ts +var WaterfallChartProxy = class extends CartesianChartProxy { + constructor() { + super(...arguments); + this.isSingleSeries = true; + } + getAxes(params, commonChartOptions) { + const isHorizontal = this.isHorizontal(commonChartOptions); + const crossAxis = isHorizontal ? "y" : "x"; + const valueAxis = isHorizontal ? "x" : "y"; + return { + [crossAxis]: { type: this.getXAxisType(params), position: isHorizontal ? "left" : "bottom" }, + [valueAxis]: { type: "number", position: isHorizontal ? "bottom" : "left" } + }; + } + getSeries(params) { + const [category] = params.categories; + const [firstField] = params.fields; + const firstSeries = { + type: this.standaloneChartType, + xKey: category.id, + xName: category.name, + yKey: firstField.colId, + yName: firstField.displayName ?? void 0 + }; + return [firstSeries]; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/funnel/funnelChartProxy.ts +var FunnelChartProxy = class extends ChartProxy { + getUpdateOptions(params, commonChartOptions) { + return { + ...commonChartOptions, + data: this.transformFunnelCategories(params), + series: this.getSeries(params) + }; + } + transformFunnelCategories(params) { + const { data } = params; + const [{ id }] = params.categories; + return data.map((d, index) => ({ + ...d, + [id]: { + name: d[id], + id: index, + toString: () => String(d[id]) + } + })); + } + getSeriesChartThemeDefaults() { + const config = { + crosshair: { + enabled: false + } + }; + return { + zoom: { + enabled: false + }, + ...this.chartType !== "pyramid" && { + axes: { + category: config, + number: config + } + } + }; + } + getSeries(params) { + const [{ id }] = params.categories; + const [{ colId }] = params.fields; + const series = { + type: this.standaloneChartType, + stageKey: id, + valueKey: colId + }; + return [series]; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/hierarchical/hierarchicalChartProxy.ts +import { GROUP_AUTO_COLUMN_ID as GROUP_AUTO_COLUMN_ID2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/hierarchical/hierarchicalChartUtils.ts +var CATEGORY_LABEL_KEY = "AG-GRID-DEFAULT-LABEL-KEY"; +function createCategoryHierarchy(data, categoryKeys) { + const hierarchy = buildNestedHierarchy(data, getItemDepth, getItemCategoryLabel); + return formatCategoryHierarchy(hierarchy); + function getItemDepth(_item) { + return categoryKeys.length; + } + function getItemCategoryLabel(item, categoryIndex) { + const categoryKey = categoryKeys[categoryIndex]; + const categoryValue = item[categoryKey]; + return getCategoryLabel(categoryValue); + } + function getCategoryLabel(value) { + if (value == null) { + return null; + } + return String(value); + } +} +function createAutoGroupHierarchy(data, getItemLabels) { + const hierarchy = buildNestedHierarchy(data, getItemDepth, getItemGroupLabel); + return formatCategoryHierarchy(hierarchy); + function getItemDepth(item) { + return getItemLabels(item)?.length ?? 0; + } + function getItemGroupLabel(item, groupIndex) { + const labels2 = getItemLabels(item); + return labels2 ? labels2[groupIndex] : labels2; + } +} +function formatCategoryHierarchy(hierarchy, key = null, isChild) { + const { depth, rootValues, value, children: inputChildren } = hierarchy; + if (rootValues) { + return rootValues.map((item) => ({ [CATEGORY_LABEL_KEY]: key, ...item })); + } else if (depth === 0) { + return [{ [CATEGORY_LABEL_KEY]: key, ...value }]; + } + const children = []; + for (const [childKey, childHierarchy] of inputChildren.entries()) { + children.push(...formatCategoryHierarchy(childHierarchy, childKey, true)); + } + return isChild ? [ + { + [CATEGORY_LABEL_KEY]: key, + children, + ...value ?? {} + } + ] : children; +} +function buildNestedHierarchy(data, getItemDepth, getItemGroupKey) { + const hierarchy = { depth: 0, children: /* @__PURE__ */ new Map() }; + for (const item of data) { + const itemDepth = getItemDepth(item); + createNestedItemHierarchy(item, itemDepth, getItemGroupKey, 0, hierarchy); + } + return hierarchy; + function createNestedItemHierarchy(item, itemDepth, getItemGroupKey2, currentDepth, hierarchy2) { + if (currentDepth === itemDepth) { + if (currentDepth === 0) { + if (!hierarchy2.rootValues) { + hierarchy2.rootValues = []; + } + hierarchy2.rootValues.push(item); + } else { + hierarchy2.value = item; + } + return hierarchy2; + } else { + const key = getItemGroupKey2(item, currentDepth); + const existingChildHierarchy = hierarchy2.children.get(key); + const childHierarchy = createNestedItemHierarchy( + item, + itemDepth, + getItemGroupKey2, + currentDepth + 1, + existingChildHierarchy || { depth: 0, children: /* @__PURE__ */ new Map() } + ); + hierarchy2.children.set(key, childHierarchy); + hierarchy2.depth = Math.max(1 + childHierarchy.depth, hierarchy2.depth); + return hierarchy2; + } + } +} + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/hierarchical/hierarchicalChartProxy.ts +var HierarchicalChartProxy = class extends ChartProxy { + getUpdateOptions(params, commonChartOptions) { + const { fields } = params; + const [sizeField, colorField] = fields; + return { + ...commonChartOptions, + series: this.getSeries(sizeField, colorField), + data: this.getData(params, sizeField, colorField) + }; + } + getSeriesChartThemeDefaults() { + return { + gradientLegend: { + gradient: { + preferredLength: 200 + }, + position: "right" + } + }; + } + getSeries(sizeField, colorField) { + return [ + { + type: this.standaloneChartType, + labelKey: CATEGORY_LABEL_KEY, + // Size and color fields are inferred from the range data + sizeKey: sizeField?.colId, + sizeName: sizeField?.displayName ?? void 0, + colorKey: colorField?.colId, + colorName: colorField?.displayName ?? void 0 + } + ]; + } + getData(params, sizeField, colorField) { + const { categories, data, groupData, grouping: isGrouped } = params; + if (isGrouped) { + const processedData = colorField ? data.concat( + groupData?.map((groupDatum) => { + const newDatum = { ...groupDatum }; + delete newDatum[sizeField.colId]; + return newDatum; + }) ?? [] + ) : data; + return createAutoGroupHierarchy( + processedData, + (item) => item[GROUP_AUTO_COLUMN_ID2]?.value ?? null + ); + } else { + const categoryKeys = categories.map(({ id }) => id); + return createCategoryHierarchy(data, categoryKeys); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/polar/polarChartProxy.ts +var PolarChartProxy = class extends ChartProxy { + getAxes(_) { + const radialBar = this.standaloneChartType === "radial-bar"; + return { + angle: { type: radialBar ? "angle-number" : "angle-category" }, + radius: { type: radialBar ? "radius-category" : "radius-number" } + }; + } + getSeries(params) { + const { fields, categories, seriesGroupType } = params; + const [category] = categories; + const radialBar = this.standaloneChartType === "radial-bar"; + const seriesGroupTypeOptions = this.getSeriesGroupTypeOptions(seriesGroupType); + return fields.map((f) => { + return { + type: this.standaloneChartType, + angleKey: radialBar ? f.colId : category.id, + angleName: radialBar ? f.displayName ?? void 0 : category.name, + radiusKey: radialBar ? category.id : f.colId, + radiusName: radialBar ? category.name : f.displayName ?? void 0, + ...seriesGroupTypeOptions + }; + }); + } + getSeriesGroupType() { + const standaloneChartType = this.standaloneChartType; + if (!["nightingale", "radial-bar", "radial-column"].includes(standaloneChartType)) { + return void 0; + } + const firstSeriesProperties = this.getChart().series?.[0]?.properties.toJson(); + const getStackedValue = () => firstSeriesProperties.normalizedTo ? "normalized" : "stacked"; + if (standaloneChartType === "nightingale") { + return firstSeriesProperties.grouped ? "grouped" : getStackedValue(); + } else { + return firstSeriesProperties.stacked ? getStackedValue() : "grouped"; + } + } + getUpdateOptions(params, commonChartOptions) { + const axes = this.getAxes(params); + return { + ...commonChartOptions, + data: this.getData(params, axes), + axes, + series: this.getSeries(params) + }; + } + getData(params, axes) { + const isCategoryAxis = axes.angle.type === "angle-category" || axes.radius.type === "radius-category"; + if (isCategoryAxis) { + const [category] = params.categories; + return this.transformCategoryData(params.data, category.id); + } else { + return params.data; + } + } + getSeriesGroupTypeOptions(seriesGroupType) { + if (!seriesGroupType) { + return {}; + } + return { + grouped: seriesGroupType === "grouped" || void 0, + stacked: seriesGroupType !== "grouped" || void 0, + normalizedTo: seriesGroupType === "normalized" ? 100 : void 0 + }; + } + getSeriesChartThemeDefaults() { + return { + series: { + highlight: getSeriesHighlight(this.crossFiltering) + } + }; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/specialized/heatmapChartProxy.ts +var HEATMAP_CATEGORY_KEY = "AG-GRID-DEFAULT-HEATMAP-CATEGORY-KEY"; +var HEATMAP_SERIES_KEY = "AG-GRID-DEFAULT-HEATMAP-SERIES-KEY"; +var HEATMAP_VALUE_KEY = "AG-GRID-DEFAULT-HEATMAP-VALUE-KEY"; +function flatMap(items, iteratee) { + return items.reduce((acc, item, index, array) => acc.concat(iteratee(item, index, array)), new Array()); +} +var HeatmapChartProxy = class extends ChartProxy { + getUpdateOptions(params, commonChartOptions) { + const xSeriesKey = HEATMAP_SERIES_KEY; + const xValueKey = HEATMAP_VALUE_KEY; + const yKey = HEATMAP_CATEGORY_KEY; + return { + ...commonChartOptions, + series: this.getSeries(params, xSeriesKey, xValueKey, yKey), + data: this.getData(params, xSeriesKey, xValueKey, yKey) + }; + } + getSeries(params, xSeriesKey, xValueKey, yKey) { + const [category] = params.categories; + return [ + { + type: this.standaloneChartType, + // The axis keys reference synthetic fields based on the category values and series column names + yKey, + xKey: xSeriesKey, + // The color key references a synthetic field based on the series column value for a specific cell + colorKey: xValueKey, + yName: category.name, + // We don't know how to label the 'x' series, as it is a synthetic series created from the set of all input columns + // In future releases we may want to consider inferring the series label from column groupings etc + xName: void 0, + colorName: void 0 + } + ]; + } + getData(params, xSeriesKey, xValueKey, yKey) { + const [category] = params.categories; + return flatMap(params.data, (datum, index) => { + const value = datum[category.id]; + const valueString = value == null ? "" : String(value); + const yValue = { id: index, value, toString: () => valueString }; + return params.fields.map(({ colId, displayName }) => ({ + ...datum, + [xSeriesKey]: displayName, + [xValueKey]: datum[colId], + [yKey]: yValue + })); + }); + } + getSeriesChartThemeDefaults() { + return { + gradientLegend: { + gradient: { + preferredLength: 200 + }, + position: "right" + }, + series: { + tooltip: { + renderer: renderHeatmapTooltip + } + } + }; + } +}; +function renderHeatmapTooltip(params) { + const { xKey, yKey, colorKey, yName, datum } = params; + const table = [ + { label: yName, value: datum[yKey] }, + { label: datum[xKey], value: colorKey && datum[colorKey] } + ]; + return { + title: "", + data: table.map(({ label, value }) => ({ label: String(label), value: String(value) })) + }; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/model/chartDataModel.ts +import { BeanStub as BeanStub89, CellRangeType as CellRangeType3, _normalizeSortType as _normalizeSortType2, isColumnGroupAutoCol as isColumnGroupAutoCol3 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/datasource/chartDatasource.ts +import { + BeanStub as BeanStub86, + GROUP_AUTO_COLUMN_ID as GROUP_AUTO_COLUMN_ID3, + _isClientSideRowModel as _isClientSideRowModel11, + _isServerSideRowModel as _isServerSideRowModel8, + _last as _last18, + _warn as _warn57 +} from "ag-grid-community"; +var ChartDatasource = class extends BeanStub86 { + wireBeans(beans) { + this.sortSvc = beans.sortSvc; + this.gridRowModel = beans.rowModel; + this.colModel = beans.colModel; + this.valueSvc = beans.valueSvc; + this.pivotResultCols = beans.pivotResultCols; + this.rowNodeSorter = beans.rowNodeSorter; + } + getData(params) { + if (params.crossFiltering) { + if (params.grouping) { + _warn57(141); + return { chartData: [], colNames: {} }; + } + if (!_isClientSideRowModel11(this.gos)) { + _warn57(142); + return { chartData: [], colNames: {} }; + } + } + const isServerSide = _isServerSideRowModel8(this.gos); + if (isServerSide && params.pivoting) { + this.updatePivotKeysForSSRM(); + } + const result = this.extractRowsFromGridRowModel(params); + result.chartData = this.aggregateRowsByDimension(params, result.chartData); + return result; + } + extractRowsFromGridRowModel(params) { + const { + crossFiltering, + startRow, + endRow, + valueCols, + dimensionCols, + grouping, + crossFilteringSort, + combineGroupValues + } = params; + let extractedRowData = []; + const colNames = {}; + const groupNodeIndexes = {}; + const groupsToRemove = {}; + let filteredNodes = {}; + let allRowNodes = []; + let numRows; + if (crossFiltering) { + filteredNodes = this.getFilteredRowNodes(); + allRowNodes = this.getAllRowNodes(crossFilteringSort); + numRows = allRowNodes.length; + } else { + const modelLastRow = this.gridRowModel.getRowCount() - 1; + const hasNoRange = startRow === endRow && startRow === 0 && dimensionCols.length === 0 && valueCols.length === 0; + if (hasNoRange) { + numRows = 0; + } else { + const rangeLastRow = endRow >= 0 ? Math.min(endRow, modelLastRow) : modelLastRow; + numRows = rangeLastRow - startRow + 1; + } + } + if (numRows > 0) { + for (const col of valueCols) { + let colNamesArr = []; + const pivotKeys = col.getColDef().pivotKeys; + if (pivotKeys) { + colNamesArr = pivotKeys.slice(); + } + const headerName = col.getColDef().headerName; + if (headerName) { + colNamesArr.push(headerName); + } + if (colNamesArr.length > 0) { + colNames[col.getId()] = colNamesArr; + } + } + } + let numRemovedNodes = 0; + let id = 0; + const groupingCache = {}; + for (let i = 0; i < numRows; i++) { + const rowNode = crossFiltering ? allRowNodes[i] : this.gridRowModel.getRow(i + startRow); + if (rowNode.footer || rowNode.detail) { + numRemovedNodes++; + continue; + } + const data = { node: rowNode }; + for (const col of dimensionCols) { + const colId = col.colId; + const column = this.colModel.getCol(colId); + if (column) { + const valueObject = this.valueSvc.getValue(column, rowNode, "data"); + if (grouping) { + const valueString = valueObject?.toString ? String(valueObject.toString()) : " "; + const labels2 = this.getGroupLabels(rowNode, valueString); + const value = labels2.slice().reverse(); + let groupingValue = { + value, + // this is needed so that standalone can handle animations properly when data updates + id: id++, + toString: () => value.filter(Boolean).join(" - ") + }; + if (combineGroupValues) { + const groupingKey = groupingValue.toString(); + const cachedGroupingValue = groupingCache[groupingKey]; + if (cachedGroupingValue) { + groupingValue = cachedGroupingValue; + } else { + groupingCache[groupingKey] = groupingValue; + } + } + data[colId] = groupingValue; + if (rowNode.group) { + groupNodeIndexes[labels2.toString()] = i - numRemovedNodes; + } + const groupKey = labels2.slice(1, labels2.length).toString(); + if (groupKey) { + groupsToRemove[groupKey] = groupNodeIndexes[groupKey]; + } + } else { + data[colId] = valueObject; + } + } else { + data[DEFAULT_CHART_CATEGORY] = i + 1; + } + } + for (const col of valueCols) { + const colId = col.getColId(); + if (crossFiltering) { + const filteredOutColId = colId + "-filtered-out"; + const value = this.valueSvc.getValue(col, rowNode, "data"); + let actualValue = value; + if (value != null) { + if (typeof value.toNumber === "function") { + actualValue = value.toNumber(); + } else if (typeof value.value === "number") { + actualValue = value.value; + } + } + if (filteredNodes[rowNode.id]) { + data[colId] = actualValue; + data[filteredOutColId] = params.aggFunc || params.isScatter ? void 0 : 0; + } else { + data[colId] = params.aggFunc || params.isScatter ? void 0 : 0; + data[filteredOutColId] = actualValue; + } + } else { + let value = this.valueSvc.getValue(col, rowNode, "data"); + if (value && typeof value.value === "number") { + value = value.value; + } + if (value && Object.prototype.hasOwnProperty.call(value, "toString")) { + value = parseFloat(value.toString()); + } + data[colId] = value != null && typeof value.toNumber === "function" ? value.toNumber() : value; + } + } + extractedRowData.push(data); + } + let groupChartData; + if (grouping) { + const groupIndexesToRemove = Object.values(groupsToRemove); + const allData = extractedRowData; + extractedRowData = []; + groupChartData = []; + for (let i = 0; i < allData.length; i++) { + (groupIndexesToRemove.includes(i) ? groupChartData : extractedRowData).push(allData[i]); + } + } + return { chartData: extractedRowData, colNames, groupChartData }; + } + aggregateRowsByDimension(params, dataFromGrid) { + const dimensionCols = params.dimensionCols; + if (!params.aggFunc || dimensionCols.length === 0) { + return dataFromGrid; + } + const lastCol = _last18(dimensionCols); + const lastColId = lastCol?.colId; + const map = {}; + const dataAggregated = []; + for (const data of dataFromGrid) { + let currentMap = map; + for (const col of dimensionCols) { + const colId = col.colId; + const key = data[colId]; + if (colId === lastColId) { + let groupItem = currentMap[key]; + if (!groupItem) { + groupItem = { __children: [] }; + for (const dimCol of dimensionCols) { + const dimColId = dimCol.colId; + groupItem[dimColId] = data[dimColId]; + } + currentMap[key] = groupItem; + dataAggregated.push(groupItem); + } + groupItem.__children.push(data); + } else { + if (!currentMap[key]) { + currentMap[key] = {}; + } + currentMap = currentMap[key]; + } + } + } + if (this.gos.assertModuleRegistered("SharedAggregation", 1)) { + const aggFuncOrString = params.aggFunc; + const aggFunc = typeof aggFuncOrString === "function" ? aggFuncOrString : typeof aggFuncOrString === "string" ? this.beans.aggFuncSvc.getAggFunc(aggFuncOrString) : null; + if (typeof aggFunc !== "function") { + _warn57(109, { inputValue: String(aggFuncOrString), allSuggestions: [] }); + return dataAggregated; + } + const api = this.beans.gridApi; + const context = this.gos.get("context"); + for (const groupItem of dataAggregated) { + for (const col of params.valueCols) { + const colId = col.getColId(); + if (params.crossFiltering) { + const dataToAgg = groupItem.__children.filter((child) => typeof child[colId] !== "undefined").map((child) => child[colId]); + const aggResult = aggFunc({ + values: dataToAgg, + column: col, + colDef: col.colDef, + pivotResultColumn: void 0, + rowNode: void 0, + data: void 0, + aggregatedChildren: [], + api, + context + }); + groupItem[colId] = aggResult && typeof aggResult.value !== "undefined" ? aggResult.value : aggResult; + const filteredOutColId = `${colId}-filtered-out`; + const dataToAggFiltered = groupItem.__children.filter((child) => typeof child[filteredOutColId] !== "undefined").map((child) => child[filteredOutColId]); + const aggResultFiltered = aggFunc({ + values: dataToAggFiltered, + column: col, + colDef: col.colDef, + pivotResultColumn: void 0, + rowNode: void 0, + data: void 0, + aggregatedChildren: [], + api, + context + }); + groupItem[filteredOutColId] = aggResultFiltered && typeof aggResultFiltered.value !== "undefined" ? aggResultFiltered.value : aggResultFiltered; + } else { + const dataToAgg = groupItem.__children.map((child) => child[colId]); + const aggResult = aggFunc({ + values: dataToAgg, + column: col, + colDef: col.colDef, + pivotResultColumn: void 0, + rowNode: void 0, + data: void 0, + aggregatedChildren: [], + api, + context + }); + groupItem[colId] = aggResult && typeof aggResult.value !== "undefined" ? aggResult.value : aggResult; + } + } + } + } + return dataAggregated; + } + updatePivotKeysForSSRM() { + const secondaryColumns = this.pivotResultCols?.getPivotResultCols()?.list; + if (!secondaryColumns) { + return; + } + const pivotKeySeparator = this.extractPivotKeySeparator(secondaryColumns); + for (const col of secondaryColumns) { + if (pivotKeySeparator === "") { + col.getColDef().pivotKeys = []; + } else { + const keys = col.getColId().split(pivotKeySeparator); + col.getColDef().pivotKeys = keys.slice(0, keys.length - 1); + } + } + } + extractPivotKeySeparator(secondaryColumns) { + if (secondaryColumns.length === 0) { + return ""; + } + const extractSeparator = (columnGroup, childId) => { + const groupId = columnGroup.getGroupId(); + if (!columnGroup.getParent()) { + return childId.split(groupId)[1][0]; + } + return extractSeparator(columnGroup.getParent(), groupId); + }; + const firstSecondaryCol = secondaryColumns[0]; + if (firstSecondaryCol.getParent() == null) { + return ""; + } + return extractSeparator(firstSecondaryCol.getParent(), firstSecondaryCol.getColId()); + } + getGroupLabels(rowNode, initialLabel) { + const labels2 = [initialLabel]; + while (rowNode && rowNode.level !== 0) { + rowNode = rowNode.parent; + if (rowNode) { + if (rowNode.group) { + const groupColumn = this.colModel.getCol(GROUP_AUTO_COLUMN_ID3); + if (groupColumn) { + const valueObject = this.valueSvc.getValue(groupColumn, rowNode, "data"); + const valueString = valueObject?.toString ? String(valueObject.toString()) : " "; + labels2.push(valueString); + } + } else { + labels2.push(rowNode.key); + } + } + } + return labels2; + } + /** cross filtering only */ + getFilteredRowNodes() { + const filteredNodes = {}; + this.gridRowModel.forEachNodeAfterFilterAndSort((rowNode) => { + filteredNodes[rowNode.id] = rowNode; + }); + return filteredNodes; + } + /** cross filtering only */ + getAllRowNodes(sortModel) { + const allRowNodes = []; + this.gridRowModel.forEachNode((rowNode) => { + allRowNodes.push(rowNode); + }); + const rowNodeSorter = this.rowNodeSorter; + if (!rowNodeSorter) { + return allRowNodes; + } + const sortOptions = sortModel === true ? this.sortSvc?.getSortOptions() : sortModel; + if (!sortOptions || sortOptions.length == 0) { + return allRowNodes; + } + return rowNodeSorter.doFullSortInPlace(allRowNodes, sortOptions); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/services/chartColumnService.ts +import { BeanStub as BeanStub87, _getRowNode as _getRowNode8, _warn as _warn58 } from "ag-grid-community"; +var ChartColumnService = class extends BeanStub87 { + constructor() { + super(...arguments); + this.valueColsWithoutSeriesType = /* @__PURE__ */ new Set(); + } + wireBeans(beans) { + this.colModel = beans.colModel; + this.colNames = beans.colNames; + this.valueSvc = beans.valueSvc; + } + postConstruct() { + const clearValueCols = () => this.valueColsWithoutSeriesType.clear(); + this.addManagedEventListeners({ + newColumnsLoaded: clearValueCols, + rowDataUpdated: clearValueCols + }); + } + getColumn(colId) { + return this.colModel.getColDefCol(colId); + } + getAllDisplayedColumns() { + return this.beans.visibleCols.allCols; + } + getColDisplayName(col) { + return this.colNames.getDisplayNameForColumn(col, "chart"); + } + getColGroupDisplayName(colGroup) { + return this.colNames.getDisplayNameForColumnGroup(colGroup, "chart"); + } + getRowGroupColumns() { + return this.beans.rowGroupColsSvc?.columns ?? []; + } + getGroupDisplayColumns() { + return this.beans.showRowGroupCols?.columns ?? []; + } + isPivotMode() { + return this.colModel.isPivotMode(); + } + isPivotActive() { + return this.colModel.isPivotActive(); + } + getChartColumns() { + const gridCols = this.colModel.getCols(); + const dimensionCols = /* @__PURE__ */ new Set(); + const valueCols = /* @__PURE__ */ new Set(); + for (const col of gridCols) { + const colDef = col.getColDef(); + const chartDataType = colDef.chartDataType; + if (chartDataType) { + switch (chartDataType) { + case "category": + case "time": + dimensionCols.add(col); + continue; + case "series": + valueCols.add(col); + continue; + case "excluded": + continue; + default: + _warn58(153, { chartDataType }); + break; + } + } + if (colDef.colId === "ag-Grid-AutoColumn") { + dimensionCols.add(col); + continue; + } + if (!col.isPrimary()) { + valueCols.add(col); + continue; + } + (this.isInferredValueCol(col) ? valueCols : dimensionCols).add(col); + } + return { dimensionCols, valueCols }; + } + isInferredValueCol(col) { + const colId = col.getColId(); + if (colId === "ag-Grid-AutoColumn") { + return false; + } + const row = _getRowNode8(this.beans, { rowIndex: 0, rowPinned: null }); + if (!row) { + return this.valueColsWithoutSeriesType.has(colId); + } + let cellValue = this.valueSvc.getValue(col, row, "data"); + if (cellValue == null) { + cellValue = this.extractLeafData(row, col); + } + if (cellValue != null) { + if (typeof cellValue.toNumber === "function") { + cellValue = cellValue.toNumber(); + } else if (typeof cellValue.value === "number") { + cellValue = cellValue.value; + } + } + const isNumber = typeof cellValue === "number" || col.colDef.cellDataType === "number" || ["series", "time"].includes(col.colDef.chartDataType); + if (isNumber) { + this.valueColsWithoutSeriesType.add(colId); + } else if (cellValue == null && col.colDef.cellDataType !== "number") { + _warn58(265, { colId }); + } + return isNumber; + } + extractLeafData(row, col) { + const value = row.data && this.valueSvc.getValue(col, row, "data"); + if (value != null) { + return value; + } + const childrenAfterGroup = row.childrenAfterGroup; + if (childrenAfterGroup) { + for (let i = 0, len = childrenAfterGroup.length; i < len; ++i) { + const child = childrenAfterGroup[i]; + const result = this.extractLeafData(child, col); + if (result != null) { + return result; + } + } + } + return null; + } + destroy() { + this.valueColsWithoutSeriesType.clear(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/model/comboChartModel.ts +import { BeanStub as BeanStub88, _warn as _warn59 } from "ag-grid-community"; +var SUPPORTED_COMBO_CHART_TYPES = /* @__PURE__ */ new Set(["line", "groupedColumn", "stackedColumn", "area", "stackedArea"]); +var ComboChartModel = class extends BeanStub88 { + constructor(chartDataModel) { + super(); + // this control flag is used to only log warning for the initial user config + this.suppressComboChartWarnings = false; + this.chartDataModel = chartDataModel; + this.seriesChartTypes = chartDataModel.params.seriesChartTypes ?? []; + } + postConstruct() { + this.initComboCharts(); + } + update(seriesChartTypes) { + this.seriesChartTypes = seriesChartTypes ?? this.seriesChartTypes; + this.initComboCharts(); + this.updateSeriesChartTypes(); + } + initComboCharts() { + const seriesChartTypesExist = this.seriesChartTypes && this.seriesChartTypes.length > 0; + const customCombo = this.chartDataModel.chartType === "customCombo" || seriesChartTypesExist; + if (customCombo) { + this.chartDataModel.chartType = "customCombo"; + this.savedCustomSeriesChartTypes = this.seriesChartTypes || []; + } + } + updateSeriesChartTypes() { + if (!this.chartDataModel.isComboChart()) { + return; + } + this.seriesChartTypes = this.seriesChartTypes.map((seriesChartType) => { + const primaryOnly = ["groupedColumn", "stackedColumn", "stackedArea"].includes(seriesChartType.chartType); + seriesChartType.secondaryAxis = primaryOnly ? false : seriesChartType.secondaryAxis; + return seriesChartType; + }); + if (this.chartDataModel.chartType === "customCombo") { + this.updateSeriesChartTypesForCustomCombo(); + return; + } + this.updateChartSeriesTypesForBuiltInCombos(); + } + updateSeriesChartTypesForCustomCombo() { + const seriesChartTypesSupplied = this.seriesChartTypes && this.seriesChartTypes.length > 0; + if (!seriesChartTypesSupplied && !this.suppressComboChartWarnings) { + _warn59(150); + } + this.seriesChartTypes = this.seriesChartTypes.map((s2) => { + if (!SUPPORTED_COMBO_CHART_TYPES.has(s2.chartType)) { + _warn59(151, { chartType: s2.chartType }); + s2.chartType = "line"; + } + return s2; + }); + const getSeriesChartType = (valueCol) => { + if (!this.savedCustomSeriesChartTypes || this.savedCustomSeriesChartTypes.length === 0) { + this.savedCustomSeriesChartTypes = this.seriesChartTypes; + } + const providedSeriesChartType = this.savedCustomSeriesChartTypes.find((s2) => s2.colId === valueCol.colId); + if (!providedSeriesChartType) { + if (valueCol.selected && !this.suppressComboChartWarnings) { + _warn59(152, { colId: valueCol.colId }); + } + return { + colId: valueCol.colId, + chartType: "line", + secondaryAxis: false + }; + } + return providedSeriesChartType; + }; + const updatedSeriesChartTypes = this.chartDataModel.valueColState.map(getSeriesChartType); + this.seriesChartTypes = updatedSeriesChartTypes; + this.savedCustomSeriesChartTypes = updatedSeriesChartTypes; + this.suppressComboChartWarnings = true; + } + updateChartSeriesTypesForBuiltInCombos() { + const { chartType, valueColState } = this.chartDataModel; + const primaryChartType = chartType === "columnLineCombo" ? "groupedColumn" : "stackedArea"; + const secondaryChartType = chartType === "columnLineCombo" ? "line" : "groupedColumn"; + const selectedCols = valueColState.filter((cs) => cs.selected); + const lineIndex = Math.ceil(selectedCols.length / 2); + this.seriesChartTypes = selectedCols.map((valueCol, i) => { + const seriesType = i >= lineIndex ? secondaryChartType : primaryChartType; + return { colId: valueCol.colId, chartType: seriesType, secondaryAxis: false }; + }); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/model/chartDataModel.ts +var DEFAULT_CHART_CATEGORY = "AG-GRID-DEFAULT-CATEGORY"; +var ChartDataModel = class extends BeanStub89 { + constructor(params) { + super(); + this.unlinked = false; + this.chartData = []; + this.valueColState = []; + this.dimensionColState = []; + this.colNames = {}; + this.crossFiltering = false; + this.crossFilteringSort = true; + this.grouping = false; + this.useGroupColumnAsCategory = false; + this.params = params; + this.chartId = params.chartId; + this.setParams(params); + } + wireBeans(beans) { + this.rangeSvc = beans.rangeSvc; + this.chartTranslation = beans.chartTranslation; + } + setParams(params) { + const { + chartType, + pivotChart, + chartThemeName, + switchCategorySeries, + aggFunc, + cellRange, + suppressChartRanges, + unlinkChart, + crossFiltering, + crossFilteringSort, + seriesGroupType, + useGroupColumnAsCategory + } = params; + this.chartType = chartType; + this.pivotChart = pivotChart ?? false; + this.chartThemeName = chartThemeName; + this.switchCategorySeries = !!switchCategorySeries; + this.aggFunc = aggFunc; + this.referenceCellRange = cellRange; + this.suppliedCellRange = cellRange; + this.suppressChartRanges = suppressChartRanges ?? false; + this.unlinked = !!unlinkChart; + this.crossFiltering = !!crossFiltering; + this.crossFilteringSort = crossFilteringSort ?? true; + this.seriesGroupType = seriesGroupType; + this.useGroupColumnAsCategory = !!useGroupColumnAsCategory; + } + postConstruct() { + this.datasource = this.createManagedBean(new ChartDatasource()); + this.chartColSvc = this.createManagedBean(new ChartColumnService()); + this.comboChartModel = this.createManagedBean(new ComboChartModel(this)); + this.updateCellRanges({ setColsFromRange: true }); + this.updateData(); + } + updateModel(params) { + const { cellRange, seriesChartTypes } = params; + if (cellRange !== this.suppliedCellRange) { + this.dimensionCellRange = void 0; + this.valueCellRange = void 0; + } + this.setParams(params); + this.updateSelectedDimensions(cellRange?.columns); + this.updateCellRanges({ setColsFromRange: true }); + const shouldUpdateComboModel = this.isComboChart() || seriesChartTypes; + if (shouldUpdateComboModel) { + this.comboChartModel.update(seriesChartTypes); + } + if (!this.unlinked) { + this.updateData(); + } + } + updateCellRanges(params) { + const { updatedColState, resetOrder, maintainColState, setColsFromRange } = params ?? {}; + if (this.valueCellRange) { + this.referenceCellRange = this.valueCellRange; + } + const { dimensionCols, valueCols } = this.chartColSvc.getChartColumns(); + const allColsFromRanges = this.getAllColumnsFromRanges(); + if (updatedColState) { + this.updateColumnState(updatedColState, resetOrder); + } + this.setDimensionCellRange(dimensionCols, allColsFromRanges, updatedColState); + this.setValueCellRange(valueCols, allColsFromRanges, setColsFromRange); + if (!updatedColState && !maintainColState) { + this.resetColumnState(); + this.syncDimensionCellRange(); + } + this.comboChartModel.updateSeriesChartTypes(); + } + updateData() { + const { startRow, endRow } = this.getRowIndexes(); + if (this.pivotChart) { + this.resetColumnState(); + } + this.grouping = this.isGrouping(); + const params = { + aggFunc: this.aggFunc, + dimensionCols: this.getSelectedDimensions(), + grouping: this.grouping, + pivoting: this.isPivotActive(), + crossFiltering: this.crossFiltering, + crossFilteringSort: this.getCrossFilteringSort(), + valueCols: this.getSelectedValueCols(), + startRow, + endRow, + isScatter: ["scatter", "bubble"].includes(this.chartType), + combineGroupValues: isStatistical(getSeriesType(this.chartType)) + }; + const { chartData, colNames, groupChartData } = this.datasource.getData(params); + this.chartData = chartData; + this.groupChartData = groupChartData; + this.colNames = colNames; + this.categoryAxisType = void 0; + } + isGrouping() { + const usingTreeData = this.gos.get("treeData"); + const groupedCols = usingTreeData ? null : this.chartColSvc.getRowGroupColumns(); + const isGroupActive = usingTreeData || groupedCols && groupedCols.length > 0; + const colIds = this.getSelectedDimensions().map(({ colId }) => colId); + const displayedGroupCols = this.chartColSvc.getGroupDisplayColumns(); + const groupDimensionSelected = displayedGroupCols.map((col) => col.getColId()).some((id) => colIds.includes(id)); + return !!isGroupActive && groupDimensionSelected; + } + getSelectedValueCols() { + return this.valueColState.filter((cs) => cs.selected).map((cs) => cs.column); + } + getSelectedDimensions() { + return this.dimensionColState.filter((cs) => cs.selected); + } + getValueColState() { + return this.valueColState.map(this.displayNameMapper.bind(this)); + } + displayNameMapper(col) { + const { column } = col; + if (column) { + const columnDisplayName = this.getColDisplayName(column); + col.displayName = this.isPivotMode() ? this.getPivotDisplayName(column, columnDisplayName) : columnDisplayName; + } else { + const colNames = this.colNames[col.colId]; + col.displayName = colNames ? colNames.join(" - ") : this.getColDisplayName(column); + } + return col; + } + getPivotDisplayName(column, columnDisplayName) { + let attemptFallbackToColNames = false; + let displayNames = [columnDisplayName]; + const getDisplayName2 = (colGroup) => { + if (!colGroup) { + return; + } + const colGroupName = this.chartColSvc.getColGroupDisplayName(colGroup); + if (colGroupName?.length) { + displayNames.unshift(colGroupName); + getDisplayName2(colGroup.getParent()); + } else { + attemptFallbackToColNames = true; + } + }; + getDisplayName2(column.getParent()); + if (attemptFallbackToColNames) { + const colNames = this.colNames[column.getColId()]; + if (colNames) { + displayNames = colNames; + } + } + return displayNames.join(" - "); + } + getColDisplayName(col) { + return this.chartColSvc.getColDisplayName(col); + } + isPivotMode() { + return this.chartColSvc.isPivotMode(); + } + getChartDataType(colId) { + const column = this.chartColSvc.getColumn(colId); + return column ? column.getColDef().chartDataType : void 0; + } + getConvertTime(colId) { + const column = this.chartColSvc.getColumn(colId); + if (column?.colDef.cellDataType === "dateString") { + return this.beans.dataTypeSvc?.getDateParserFunction(column); + } + return void 0; + } + isPivotActive() { + return this.chartColSvc.isPivotActive(); + } + createCellRange(type, ...columns) { + return { + id: this.chartId, + // set range ID to match chart ID so we can identify changes to the ranges for this chart + startRow: this.referenceCellRange.startRow, + endRow: this.referenceCellRange.endRow, + columns, + startColumn: type === CellRangeType3.DIMENSION || this.referenceCellRange.startColumn == null ? columns[0] : this.referenceCellRange.startColumn, + type + }; + } + getAllColumnsFromRanges() { + if (this.pivotChart) { + return new Set(this.chartColSvc.getAllDisplayedColumns()); + } + const columns = this.dimensionCellRange || this.valueCellRange ? [] : this.referenceCellRange.columns; + if (this.dimensionCellRange) { + columns.push(...this.dimensionCellRange.columns); + } + if (this.valueCellRange) { + columns.push(...this.valueCellRange.columns); + } + return new Set(columns); + } + getRowIndexes() { + let startRow = 0, endRow = 0; + const { rangeSvc, valueCellRange, dimensionCellRange } = this; + const cellRange = valueCellRange || dimensionCellRange; + if (rangeSvc && cellRange) { + startRow = rangeSvc.getRangeStartRow(cellRange).rowIndex; + const endRowPosition = rangeSvc.getRangeEndRow(cellRange); + endRow = endRowPosition.rowPinned === "bottom" ? -1 : endRowPosition.rowIndex; + } + return { startRow, endRow }; + } + resetColumnState() { + const { dimensionCols, valueCols } = this.chartColSvc.getChartColumns(); + const allCols = this.getAllColumnsFromRanges(); + const isInitialising = this.valueColState.length < 1; + this.dimensionColState = []; + this.valueColState = []; + const supportsMultipleDimensions = isHierarchical(getSeriesType(this.chartType)); + let hasSelectedDimension = false; + let order = 1; + const aggFuncDimension = this.suppliedCellRange.columns[0]; + const usingTreeData = this.gos.get("treeData"); + const rowGroupCols = usingTreeData ? null : this.chartColSvc.getRowGroupColumns(); + const groupingActive = usingTreeData || rowGroupCols && rowGroupCols.length > 0; + dimensionCols.forEach((column) => { + const autoGroup = isColumnGroupAutoCol3(column); + const selected = this.crossFiltering && this.aggFunc ? aggFuncDimension.getColId() === column.getColId() : this.useGroupColumnAsCategory && groupingActive && autoGroup || (!hasSelectedDimension || supportsMultipleDimensions) && allCols.has(column); + this.dimensionColState.push({ + column, + colId: column.getColId(), + displayName: this.getColDisplayName(column), + selected, + order: order++ + }); + if (selected) { + hasSelectedDimension = true; + } + }); + const defaultCategory = { + colId: DEFAULT_CHART_CATEGORY, + displayName: this.chartTranslation.translate("defaultCategory"), + selected: !hasSelectedDimension, + // if no dimensions in range select the default + order: 0 + }; + this.dimensionColState.unshift(defaultCategory); + const valueColumnsFromReferenceRange = this.referenceCellRange.columns.filter( + (c) => valueCols.has(c) + ); + valueCols.forEach((column) => { + if (isInitialising && this.referenceCellRange.columns.includes(column)) { + column = valueColumnsFromReferenceRange.shift(); + } + this.valueColState.push({ + column, + colId: column.getColId(), + displayName: this.getColDisplayName(column), + selected: allCols.has(column), + order: order++ + }); + }); + } + updateColumnState(updatedCol, resetOrder) { + const idsMatch = (cs) => cs.colId === updatedCol.colId; + const { dimensionColState, valueColState } = this; + const matchedDimensionColState = dimensionColState.find(idsMatch); + const matchedValueColState = valueColState.find(idsMatch); + if (matchedDimensionColState) { + const supportsMultipleDimensions = isHierarchical(getSeriesType(this.chartType)); + if (!supportsMultipleDimensions) { + const selectedColumnState = updatedCol.selected ? matchedDimensionColState : dimensionColState.filter((cs) => cs !== matchedDimensionColState).find(({ selected }) => selected); + dimensionColState.forEach((cs) => cs.selected = cs === selectedColumnState); + } else { + matchedDimensionColState.selected = updatedCol.selected; + } + } else if (matchedValueColState) { + matchedValueColState.selected = updatedCol.selected; + } + const allColumns = [...dimensionColState, ...valueColState]; + const orderedColIds = []; + if (!resetOrder) { + allColumns.forEach((col, i) => { + if (i === updatedCol.order) { + orderedColIds.push(updatedCol.colId); + } + if (col.colId !== updatedCol.colId) { + orderedColIds.push(col.colId); + } + }); + allColumns.forEach((col) => { + const order = orderedColIds.indexOf(col.colId); + col.order = order >= 0 ? orderedColIds.indexOf(col.colId) : allColumns.length - 1; + }); + } + this.reorderColState(); + } + reorderColState() { + const ascColStateOrder = (a, b) => a.order - b.order; + this.dimensionColState.sort(ascColStateOrder); + this.valueColState.sort(ascColStateOrder); + } + setDimensionCellRange(dimensionCols, colsInRange, updatedColState) { + this.dimensionCellRange = void 0; + const supportsMultipleDimensions = isHierarchical(getSeriesType(this.chartType)); + if (!updatedColState && !this.dimensionColState.length) { + const selectedCols = new Array(); + dimensionCols.forEach((col) => { + if (selectedCols.length > 0 && !supportsMultipleDimensions || !colsInRange.has(col)) { + return; + } + selectedCols.push(col); + }); + if (selectedCols.length > 0) { + this.dimensionCellRange = this.createCellRange(CellRangeType3.DIMENSION, ...selectedCols); + } + return; + } + let selectedDimensionColStates = updatedColState ? [updatedColState] : []; + if (this.crossFiltering && this.aggFunc) { + const aggFuncDimension = this.suppliedCellRange.columns[0]; + selectedDimensionColStates = this.dimensionColState.filter( + (cs) => cs.colId === aggFuncDimension.getColId() + ); + } else if (supportsMultipleDimensions || selectedDimensionColStates.length === 0 || selectedDimensionColStates.some(({ column }) => !column || !dimensionCols.has(column))) { + selectedDimensionColStates = this.dimensionColState.filter((cs) => cs.selected); + } + const isDefaultCategory = selectedDimensionColStates.length === 1 ? selectedDimensionColStates[0].colId === DEFAULT_CHART_CATEGORY : false; + const selectedColumns = selectedDimensionColStates.map(({ column }) => column).filter((value) => value != null); + if (selectedColumns.length > 0 && !isDefaultCategory) { + this.dimensionCellRange = this.createCellRange(CellRangeType3.DIMENSION, ...selectedColumns); + } + } + setValueCellRange(valueCols, colsInRange, setColsFromRange) { + this.valueCellRange = void 0; + const selectedValueCols = []; + const maxSelection = getMaxNumSeries(this.chartType); + let numSelected = 0; + valueCols.forEach((col) => { + if (setColsFromRange) { + if ((maxSelection == null || numSelected < maxSelection) && colsInRange.has(col)) { + selectedValueCols.push(col); + numSelected++; + } + } else if (this.valueColState.some((colState) => colState.selected && colState.colId === col.getColId())) { + selectedValueCols.push(col); + } + }); + if (selectedValueCols.length > 0) { + let orderedColIds = []; + if (this.valueColState.length > 0) { + orderedColIds = this.valueColState.map((c) => c.colId); + } else { + colsInRange.forEach((c) => orderedColIds.push(c.getColId())); + } + selectedValueCols.sort((a, b) => orderedColIds.indexOf(a.getColId()) - orderedColIds.indexOf(b.getColId())); + this.valueCellRange = this.createCellRange(CellRangeType3.VALUE, ...selectedValueCols); + } + } + resetCellRanges(dimension, value) { + if (!dimension && !value) { + return; + } + const { dimensionCols, valueCols } = this.chartColSvc.getChartColumns(); + const allColsFromRanges = this.getAllColumnsFromRanges(); + if (dimension) { + this.setDimensionCellRange(dimensionCols, allColsFromRanges); + } + if (value) { + this.setValueCellRange(valueCols, allColsFromRanges); + } + } + updateSelectedDimensions(columns) { + const colIdSet = new Set(columns.map((column) => column.getColId())); + const supportsMultipleDimensions = isHierarchical(getSeriesType(this.chartType)); + if (!supportsMultipleDimensions) { + const foundColState = this.dimensionColState.find((colState) => colIdSet.has(colState.colId)) || this.dimensionColState[0]; + const selectedColumnId = foundColState.colId; + this.dimensionColState = this.dimensionColState.map((colState) => ({ + ...colState, + selected: colState.colId === selectedColumnId + })); + } else { + const foundColStates = this.dimensionColState.filter((colState) => colIdSet.has(colState.colId)); + const selectedColumnIds = new Set(foundColStates.map((colState) => colState.colId)); + this.dimensionColState = this.dimensionColState.map((colState) => ({ + ...colState, + selected: selectedColumnIds.has(colState.colId) + })); + } + } + syncDimensionCellRange() { + const selectedDimensions = this.getSelectedDimensions(); + if (selectedDimensions.length === 0) { + return; + } + const selectedCols = selectedDimensions.map(({ column }) => column).filter((value) => value != null); + if (selectedCols.length > 0) { + this.dimensionCellRange = this.createCellRange(CellRangeType3.DIMENSION, ...selectedCols); + } + } + isComboChart(chartType) { + return isComboChart(chartType ?? this.chartType); + } + getCrossFilteringSort() { + const sort = this.crossFilteringSort; + if (typeof sort === "boolean") { + return sort; + } + const sortOptions = []; + sort.forEach(({ sort: sort2, colId }) => { + const column = this.chartColSvc.getColumn(colId); + if (column) { + sortOptions.push({ + sort: sort2, + column, + type: _normalizeSortType2(column.getSortDef()?.type) + }); + } + }); + return sortOptions; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/statistical/statisticalChartProxy.ts +var StatisticalChartProxy = class extends CartesianChartProxy { + getAxes(params, commonChartOptions) { + return { + x: { + type: this.getXAxisType(params), + position: this.isHorizontal(commonChartOptions) ? "left" : "bottom" + }, + y: { + type: "number", + position: this.isHorizontal(commonChartOptions) ? "bottom" : "left" + } + }; + } + computeSeriesStatistics(params, computeStatsFn) { + const { data, fields } = params; + const [category] = params.categories; + const categoryKey = category.id || DEFAULT_CHART_CATEGORY; + const groupedData = this.groupDataByCategory(categoryKey, data); + return Array.from(groupedData).map(([categoryValue, categoryData]) => { + const categoryResult = { [category.id]: categoryValue }; + fields.forEach((field, seriesIndex) => { + const seriesValues = categoryData.map((datum) => datum[field.colId]).filter((value) => typeof value === "number" && !isNaN(value)); + const computed = computeStatsFn(seriesValues); + for (const statKey of Object.keys(computed)) { + const propertyKey = `${statKey}:${seriesIndex}`; + categoryResult[propertyKey] = seriesValues.length > 0 ? computed[statKey] : null; + } + }); + return categoryResult; + }); + } + groupDataByCategory(categoryKey, data) { + const getCategory = (datum) => { + if (categoryKey === DEFAULT_CHART_CATEGORY) { + return 1; + } + const categoryValue = datum[categoryKey]; + if (categoryValue === null || categoryValue === void 0) { + return ""; + } + return categoryValue instanceof Date ? categoryValue.getTime() : categoryValue; + }; + return data.reduce((acc, datum) => { + const category = getCategory(datum); + const existingCategoryData = acc.get(category); + if (existingCategoryData) { + existingCategoryData.push(datum); + } else { + acc.set(category, [datum]); + } + return acc; + }, /* @__PURE__ */ new Map()); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/statistical/boxPlotChartProxy.ts +var BoxPlotChartProxy = class extends StatisticalChartProxy { + getSeries(params) { + const [category] = params.categories; + return params.fields.map((field, seriesIndex) => ({ + type: this.standaloneChartType, + // xKey/xName refer to category buckets + xKey: category.id, + xName: category.name, + // yName is used to label the series + yName: field.displayName ?? void 0, + // custom field labels shown in the tooltip + minName: "Min", + q1Name: "Q1", + medianName: "Median", + q3Name: "Q3", + maxName: "Max", + // generated 'synthetic fields' from getData() + minKey: `min:${seriesIndex}`, + q1Key: `q1:${seriesIndex}`, + medianKey: `median:${seriesIndex}`, + q3Key: `q3:${seriesIndex}`, + maxKey: `max:${seriesIndex}` + })); + } + getData(params) { + return this.computeSeriesStatistics(params, (seriesValues) => { + const sortedValues = seriesValues.sort((a, b) => a - b); + return { + min: sortedValues[0], + q1: this.quantile(sortedValues, 0.25), + median: this.quantile(sortedValues, 0.5), + q3: this.quantile(sortedValues, 0.75), + max: sortedValues[sortedValues.length - 1] + }; + }); + } + quantile(sortedValues, q) { + const position = (sortedValues.length - 1) * q; + const indexBelow = Math.floor(position); + const aboveValue = position - indexBelow; + if (sortedValues[indexBelow + 1] !== void 0) { + return sortedValues[indexBelow] + aboveValue * (sortedValues[indexBelow + 1] - sortedValues[indexBelow]); + } + return sortedValues[indexBelow]; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/statistical/rangeChartProxy.ts +var RangeChartProxy = class extends StatisticalChartProxy { + getSeries(params) { + const [category] = params.categories; + return params.fields.map((field, seriesIndex) => ({ + type: this.standaloneChartType, + // xKey/xName refer to category buckets + xKey: category.id, + xName: category.name, + // yName is used to label the series + yName: field.displayName ?? void 0, + // custom field labels shown in the tooltip + yLowName: "Min", + yHighName: "Max", + // generated 'synthetic fields' from getData() + yLowKey: `min:${seriesIndex}`, + yHighKey: `max:${seriesIndex}` + })); + } + getData(params) { + return this.computeSeriesStatistics(params, (seriesValues) => { + return { + min: Math.min(...seriesValues), + max: Math.max(...seriesValues) + }; + }); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/enterpriseChartProxyFactory.ts +var EnterpriseChartProxyFactory = class extends BeanStub90 { + constructor() { + super(...arguments); + this.beanName = "enterpriseChartProxyFactory"; + } + createChartProxy(chartProxyParams) { + switch (chartProxyParams.chartType) { + case "histogram": + return new HistogramChartProxy(chartProxyParams); + case "radarLine": + case "radarArea": + case "nightingale": + case "radialColumn": + case "radialBar": + return new PolarChartProxy(chartProxyParams); + case "rangeBar": + case "rangeArea": + return new RangeChartProxy(chartProxyParams); + case "boxPlot": + return new BoxPlotChartProxy(chartProxyParams); + case "treemap": + case "sunburst": + return new HierarchicalChartProxy(chartProxyParams); + case "heatmap": + return new HeatmapChartProxy(chartProxyParams); + case "waterfall": + return new WaterfallChartProxy(chartProxyParams); + case "funnel": + case "coneFunnel": + case "pyramid": + return new FunnelChartProxy(chartProxyParams); + } + return void 0; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/advancedSettingsMenuFactory.ts +import { BeanStub as BeanStub92, TabGuardComp as TabGuardComp4, _findFocusableElements as _findFocusableElements4, _findNextFocusableElement as _findNextFocusableElement8 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/advancedSettingsPanel.ts +import { Component as Component61 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartPanelFeature.ts +import { BeanStub as BeanStub91, _removeFromParent as _removeFromParent11 } from "ag-grid-community"; +var ChartPanelFeature = class extends BeanStub91 { + constructor(chartController, eGui, cssClass, createPanels) { + super(); + this.chartController = chartController; + this.eGui = eGui; + this.cssClass = cssClass; + this.createPanels = createPanels; + this.panels = []; + } + postConstruct() { + this.addManagedListeners(this.chartController, { + chartUpdated: () => this.refreshPanels(true), + chartApiUpdate: () => this.refreshPanels(false) + }); + } + addComponent(component) { + this.createBean(component); + this.panels.push(component); + component.addCss(this.cssClass); + this.eGui.appendChild(component.getGui()); + } + refreshPanels(reuse) { + const chartType = this.chartController.getChartType(); + const isGrouping = this.chartController.isGrouping(); + const seriesType = getSeriesType(chartType); + if (reuse && chartType === this.chartType && isGrouping === this.isGrouping) { + return; + } + this.destroyPanels(); + this.createPanels(chartType, seriesType); + this.chartType = chartType; + this.isGrouping = isGrouping; + } + destroyPanels() { + for (const panel of this.panels) { + _removeFromParent11(panel.getGui()); + this.destroyBean(panel); + } + this.panels = []; + } + destroy() { + this.destroyPanels(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/interactivity/animationPanel.ts +import { AgInputNumberFieldSelector as AgInputNumberFieldSelector2, Component as Component57 } from "ag-grid-community"; +var AnimationPanel = class extends Component57 { + constructor(chartMenuParamsFactory) { + super(); + this.chartMenuParamsFactory = chartMenuParamsFactory; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const animationGroupParams = this.chartMenuParamsFactory.addEnableParams( + "animation.enabled", + { + cssIdentifier: "charts-advanced-settings-top-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("animation"), + suppressEnabledCheckbox: true, + useToggle: true + } + ); + const animationHeightInputParams = this.chartMenuParamsFactory.getDefaultNumberInputParams( + "animation.duration", + "durationMillis", + { + min: 0 + } + ); + this.setTemplate( + /* html */ + `
+ + + +
`, + [AgGroupComponentSelector, AgInputNumberFieldSelector2], + { + animationGroup: animationGroupParams, + animationHeightInput: animationHeightInputParams + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/interactivity/crosshairPanel.ts +import { AgCheckboxSelector as AgCheckboxSelector6, Component as Component58 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/widgets/colorPicker.ts +var ColorPicker = class extends AgColorPicker { + constructor(config) { + super({ + ...config, + dialogCallbacks: DIALOG_CALLBACKS + }); + } +}; +var ColorPickerSelector = { + selector: "AG-COLOR-PICKER", + component: ColorPicker +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/interactivity/crosshairPanel.ts +var CrosshairPanel = class extends Component58 { + constructor(chartMenuParamsFactory) { + super(); + this.chartMenuParamsFactory = chartMenuParamsFactory; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const crosshairGroupParams = this.chartMenuParamsFactory.addEnableParams( + "crosshair.enabled", + { + cssIdentifier: "charts-advanced-settings-top-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("crosshair"), + suppressEnabledCheckbox: true, + useToggle: true + } + ); + const crosshairLabelCheckboxParams = this.chartMenuParamsFactory.getDefaultCheckboxParams( + "crosshair.label.enabled", + "crosshairLabel" + ); + const crosshairSnapCheckboxParams = this.chartMenuParamsFactory.getDefaultCheckboxParams( + "crosshair.snap", + "crosshairSnap" + ); + const crosshairStrokeColorPickerParams = this.chartMenuParamsFactory.getDefaultColorPickerParams( + "crosshair.stroke", + "color" + ); + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, AgCheckboxSelector6, ColorPickerSelector], + { + crosshairGroup: crosshairGroupParams, + crosshairLabelCheckbox: crosshairLabelCheckboxParams, + crosshairSnapCheckbox: crosshairSnapCheckboxParams, + crosshairStrokeColorPicker: crosshairStrokeColorPickerParams + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/interactivity/navigatorPanel.ts +import { AgCheckboxSelector as AgCheckboxSelector7, Component as Component59 } from "ag-grid-community"; +var NavigatorPanel = class extends Component59 { + constructor(chartMenuParamsFactory) { + super(); + this.chartMenuParamsFactory = chartMenuParamsFactory; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const navigatorGroupParams = this.chartMenuParamsFactory.addEnableParams( + "navigator.enabled", + { + cssIdentifier: "charts-advanced-settings-top-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("navigator"), + suppressEnabledCheckbox: true, + useToggle: true + } + ); + const navigatorHeightSliderParams = this.chartMenuParamsFactory.getDefaultSliderParams( + "navigator.height", + "height", + 60 + ); + navigatorHeightSliderParams.minValue = 10; + const navigatorMiniChartCheckboxParams = this.chartMenuParamsFactory.getDefaultCheckboxParams( + "navigator.miniChart.enabled", + "miniChart" + ); + this.setTemplate( + /* html */ + `
+ + + + +
`, + [AgGroupComponentSelector, AgSliderSelector, AgCheckboxSelector7], + { + navigatorGroup: navigatorGroupParams, + navigatorHeightSlider: navigatorHeightSliderParams, + navigatorMiniChartCheckbox: navigatorMiniChartCheckboxParams + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/interactivity/zoomPanel.ts +import { AgCheckboxSelector as AgCheckboxSelector8, Component as Component60, RefPlaceholder as RefPlaceholder49 } from "ag-grid-community"; +var ZoomPanel = class extends Component60 { + constructor(chartMenuParamsFactory) { + super(); + this.chartMenuParamsFactory = chartMenuParamsFactory; + this.zoomScrollingStepInput = RefPlaceholder49; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const zoomGroupParams = this.chartMenuParamsFactory.addEnableParams("zoom.enabled", { + cssIdentifier: "charts-advanced-settings-top-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("zoom"), + suppressEnabledCheckbox: true, + useToggle: true + }); + const zoomScrollingCheckboxParams = this.chartMenuParamsFactory.getDefaultCheckboxParams( + "zoom.enableScrolling", + "scrollingZoom" + ); + const zoomScrollingStepSliderParams = this.chartMenuParamsFactory.getDefaultSliderParams( + "zoom.scrollingStep", + "scrollingStep", + 1 + ); + zoomScrollingStepSliderParams.step = 0.01; + zoomScrollingStepSliderParams.minValue = zoomScrollingStepSliderParams.step; + const zoomSelectingCheckboxParams = this.chartMenuParamsFactory.getDefaultCheckboxParams( + "zoom.enableSelecting", + "selectingZoom" + ); + zoomScrollingCheckboxParams.onValueChange = /* @__PURE__ */ ((onValueChange) => (value) => { + if (!onValueChange) { + return; + } + onValueChange(value); + this.zoomScrollingStepInput.setDisabled(!value); + })(zoomScrollingCheckboxParams.onValueChange); + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, AgCheckboxSelector8, AgSliderSelector], + { + zoomGroup: zoomGroupParams, + zoomScrollingCheckbox: zoomScrollingCheckboxParams, + zoomScrollingStepInput: zoomScrollingStepSliderParams, + zoomSelectingCheckbox: zoomSelectingCheckboxParams + } + ); + this.zoomScrollingStepInput.setDisabled(!zoomScrollingCheckboxParams.value); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/advancedSettingsPanel.ts +var INTERACTIVITY_GROUPS = ["navigator", "zoom", "animation", "crosshair"]; +var AdvancedSettingsPanel = class extends Component61 { + constructor(chartMenuContext) { + super( + /* html */ + `
` + ); + this.chartMenuContext = chartMenuContext; + } + postConstruct() { + this.chartPanelFeature = this.createManagedBean( + new ChartPanelFeature( + this.chartMenuContext.chartController, + this.getGui(), + "ag-chart-advanced-settings-section", + (chartType, seriesType) => this.createPanels(chartType, seriesType) + ) + ); + this.chartPanelFeature.refreshPanels(); + } + createPanels(chartType, seriesType) { + for (const group of INTERACTIVITY_GROUPS) { + if (!this.isGroupPanelShownForSeries(group, seriesType)) { + continue; + } + const comp = this.createPanel(group); + this.chartPanelFeature.addComponent(comp); + } + } + isGroupPanelShownForSeries(group, seriesType) { + return group === "animation" || isCartesian(seriesType) && !isFunnel(seriesType); + } + createPanel(group) { + const { chartMenuParamsFactory, chartAxisMenuParamsFactory } = this.chartMenuContext; + switch (group) { + case "navigator": + return new NavigatorPanel(chartMenuParamsFactory); + case "zoom": + return new ZoomPanel(chartMenuParamsFactory); + case "animation": + return new AnimationPanel(chartMenuParamsFactory); + case "crosshair": + return new CrosshairPanel(chartAxisMenuParamsFactory); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/advancedSettings/advancedSettingsMenuFactory.ts +var AdvancedSettingsMenuFactory = class extends BeanStub92 { + constructor() { + super(...arguments); + this.beanName = "advSettingsMenuFactory"; + } + showMenu(chartMenuContext, eventSource) { + this.hideMenu(); + const menu = this.createBean(new AdvancedSettingsMenu(chartMenuContext)); + this.activeDialog = this.createBean( + new Dialog({ + title: this.beans.chartTranslation.translate("advancedSettings"), + component: menu, + width: 300, + height: 400, + resizable: true, + movable: true, + centered: true, + closable: true, + afterGuiAttached: () => { + _findFocusableElements4(menu.getGui())[0]?.focus(); + }, + closedCallback: () => { + this.activeMenu = this.destroyBean(this.activeMenu); + this.activeDialog = void 0; + eventSource?.focus({ preventScroll: true }); + } + }) + ); + this.activeMenu = menu; + } + hideMenu() { + if (this.activeDialog) { + this.destroyBean(this.activeDialog); + } + } + destroy() { + this.activeMenu = this.destroyBean(this.activeMenu); + this.activeDialog = this.destroyBean(this.activeDialog); + super.destroy(); + } +}; +var AdvancedSettingsMenu = class extends TabGuardComp4 { + constructor(chartMenuContext) { + super( + /* html */ + `
` + ); + this.chartMenuContext = chartMenuContext; + } + postConstruct() { + this.advancedSettingsPanel = this.createManagedBean(new AdvancedSettingsPanel(this.chartMenuContext)); + this.getGui().appendChild(this.advancedSettingsPanel.getGui()); + this.initialiseTabGuard({ + onTabKeyDown: this.onTabKeyDown.bind(this), + focusTrapActive: true + }); + } + onTabKeyDown(e) { + if (e.defaultPrevented) { + return; + } + e.preventDefault(); + const backwards = e.shiftKey; + const panelGui = this.advancedSettingsPanel.getGui(); + const nextEl = _findNextFocusableElement8(this.beans, panelGui, false, backwards); + if (nextEl) { + nextEl.focus(); + } else { + const focusableElements = _findFocusableElements4(panelGui); + if (focusableElements.length) { + focusableElements[backwards ? focusableElements.length - 1 : 0].focus(); + } + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartMenuList.ts +import { + BeanStub as BeanStub93, + Component as Component62, + RefPlaceholder as RefPlaceholder50, + _addGridCommonParams as _addGridCommonParams28, + _createIconNoSpan as _createIconNoSpan25, + _focusInto as _focusInto10, + _isNothingFocused as _isNothingFocused5 +} from "ag-grid-community"; +var ChartMenuListFactory = class extends BeanStub93 { + constructor() { + super(...arguments); + this.beanName = "chartMenuListFactory"; + } + wireBeans(beans) { + this.popupSvc = beans.popupSvc; + this.chartMenuSvc = beans.chartMenuSvc; + this.chartTranslation = beans.chartTranslation; + } + showMenuList(params) { + const { eventSource, showMenu, chartMenuContext, closeOnElementClick } = params; + const areChartToolPanelsEnabled = this.chartMenuSvc.doChartToolPanelsExist(chartMenuContext.chartController); + const menuItems = this.mapWithStockItems( + this.getMenuItems(chartMenuContext.chartController, areChartToolPanelsEnabled), + chartMenuContext, + showMenu, + eventSource, + areChartToolPanelsEnabled + ); + if (!menuItems.length) { + return; + } + const chartMenuList = this.createBean(new ChartMenuList(menuItems)); + this.activeChartMenuList = chartMenuList; + let multiplier = -1; + let alignSide = "left"; + if (this.gos.get("enableRtl")) { + multiplier = 1; + alignSide = "right"; + } + const eGui = chartMenuList.getGui(); + this.popupSvc.addPopup({ + modal: true, + eChild: eGui, + closeOnEsc: true, + alwaysOnTop: true, + closedCallback: () => { + this.destroyBean(chartMenuList); + this.activeChartMenuList = void 0; + if (_isNothingFocused5(this.beans)) { + eventSource.focus({ preventScroll: true }); + } + }, + afterGuiAttached: (params2) => { + chartMenuList.afterGuiAttached(params2, closeOnElementClick); + }, + positionCallback: () => { + { + this.popupSvc.positionPopupByComponent({ + type: "chartMenu", + eventSource, + ePopup: eGui, + alignSide, + nudgeX: 4 * multiplier, + nudgeY: 4, + position: "under", + keepWithinBounds: true + }); + } + }, + ariaLabel: "Chart Menu" + }); + } + getMenuItems(chartController, areChartToolPanelsEnabled) { + const defaultItems = [ + ...areChartToolPanelsEnabled ? ["chartEdit"] : [], + ...chartController.isEnterprise() ? ["chartAdvancedSettings"] : [], + chartController.isChartLinked() ? "chartUnlink" : "chartLink", + "chartDownload" + ]; + const chartMenuItems = this.gos.get("chartMenuItems"); + if (!chartMenuItems) { + return defaultItems; + } else if (Array.isArray(chartMenuItems)) { + return chartMenuItems; + } else { + return chartMenuItems( + _addGridCommonParams28(this.gos, { + defaultItems, + chartId: chartController.getChartId() + }) + ); + } + } + mapWithStockItems(originalList, chartMenuContext, showMenu, eventSource, areChartToolPanelsEnabled) { + if (!originalList) { + return []; + } + const resultList = []; + for (const menuItemOrString of originalList) { + let result; + if (typeof menuItemOrString === "string") { + result = this.getStockMenuItem( + menuItemOrString, + chartMenuContext, + showMenu, + eventSource, + areChartToolPanelsEnabled + ); + } else { + result = { ...menuItemOrString }; + } + if (!result) { + continue; + } + const { subMenu } = result; + if (Array.isArray(subMenu)) { + result.subMenu = this.mapWithStockItems( + subMenu, + chartMenuContext, + showMenu, + eventSource, + areChartToolPanelsEnabled + ); + } + resultList.push(result); + } + return resultList; + } + getStockMenuItem(key, chartMenuContext, showMenu, eventSource, areChartToolPanelsEnabled) { + switch (key) { + case "chartEdit": + return areChartToolPanelsEnabled ? this.createMenuItem(this.chartTranslation.translate("chartEdit"), "chartsMenuEdit", showMenu) : null; + case "chartAdvancedSettings": + return this.createMenuItem( + this.chartTranslation.translate("chartAdvancedSettings"), + "chartsMenuAdvancedSettings", + () => this.chartMenuSvc.openAdvancedSettings(chartMenuContext, eventSource) + ); + case "chartUnlink": + return chartMenuContext.chartController.isChartLinked() ? this.createMenuItem( + this.chartTranslation.translate("chartUnlink"), + "unlinked", + () => this.chartMenuSvc.toggleLinked(chartMenuContext) + ) : null; + case "chartLink": + return !chartMenuContext.chartController.isChartLinked() ? this.createMenuItem( + this.chartTranslation.translate("chartLink"), + "linked", + () => this.chartMenuSvc.toggleLinked(chartMenuContext) + ) : null; + case "chartDownload": + return this.createMenuItem( + this.chartTranslation.translate("chartDownload"), + "chartsDownload", + () => this.chartMenuSvc.downloadChart(chartMenuContext) + ); + } + return null; + } + createMenuItem(name, iconName, action) { + return { + name, + icon: _createIconNoSpan25(iconName, this.beans, null), + action + }; + } + destroy() { + this.destroyBean(this.activeChartMenuList); + super.destroy(); + } +}; +var ChartMenuList = class extends Component62 { + constructor(menuItems) { + super( + /* html */ + ` + + ` + ); + this.menuItems = menuItems; + this.eChartsMenu = RefPlaceholder50; + } + postConstruct() { + this.mainMenuList = this.createManagedBean(new MenuList(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 }, closeOnElementClick) { + const time = Date.now(); + if (hidePopup) { + this.hidePopupFunc = hidePopup; + this.addDestroyFunc(hidePopup); + if (closeOnElementClick) { + const clickListener = () => { + if (Date.now() - time < 500) { + return; + } + this.hidePopupFunc(); + }; + closeOnElementClick.addEventListener("click", clickListener); + this.addDestroyFunc(() => { + closeOnElementClick?.removeEventListener("click", clickListener); + }); + } + } + _focusInto10(this.mainMenuList.getGui()); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/services/chartCrossFilterService.ts +import { BeanStub as BeanStub94, _warn as _warn60 } from "ag-grid-community"; +var ChartCrossFilterService = class extends BeanStub94 { + constructor() { + super(...arguments); + this.beanName = "chartCrossFilterSvc"; + } + filter(event, reset = false) { + const filterManager = this.beans.filterManager; + const filterModel = filterManager?.getFilterModel() ?? {}; + if (reset) { + if (Object.keys(filterModel).length > 0) { + filterManager?.setFilterModel(null); + } + return; + } + let colId = extractFilterColId(event); + if (colId.indexOf("-filtered-out")) { + colId = colId.replace("-filtered-out", ""); + } + this.updateFilters(filterModel, event, colId); + } + updateFilters(filterModel, event, colId) { + const dataKey = extractFilterColId(event); + const rawValue = this.convertRawValue(colId, event.datum[dataKey]); + if (rawValue === void 0) { + return; + } + const filterManager = this.beans.filterManager; + filterManager?.getColumnFilterInstance(colId).then((filter) => { + const filterType = filter?.filterType; + let setFilter; + let processModel = (model) => model; + if (filterType === "multi") { + const result = extractFromMultiFilter(filter); + setFilter = result.setFilter; + processModel = result.processModel ?? processModel; + } else if (filterType === "set") { + setFilter = filter; + } + if (!setFilter) { + _warn60(154, { colId }); + return; + } + const update = event.event.metaKey || event.event.ctrlKey; + const setFilterModel = setFilter.getFilterHandler().getCrossFilterModel( + (createKey, availableKeys, existingValues) => getSetFilterModel(update, createKey(rawValue), availableKeys, existingValues) + ); + const colFilterModel = processModel(setFilterModel); + const newFilterModel = update ? { ...filterModel } : {}; + newFilterModel[colId] = colFilterModel; + filterManager?.setFilterModel(newFilterModel); + }); + } + convertRawValue(colId, rawValue) { + const { colModel, dataTypeSvc } = this.beans; + const column = colModel.getColById(colId); + const colDef = column?.colDef; + if (colDef && dataTypeSvc && colDef.chartDataType === "time" && colDef.cellDataType === "dateString") { + return dataTypeSvc.getDateFormatterFunction(column)(rawValue); + } + return rawValue; + } +}; +function processMultiFilterModel(setFilterModel, index, numFilters) { + const filterModels = new Array(numFilters); + for (let i = 0; i < numFilters; i++) { + filterModels[i] = i === index ? setFilterModel : null; + } + return { filterType: "multi", filterModels }; +} +function extractFromMultiFilter(multiFilter) { + const numFilters = multiFilter.getNumChildFilters(); + for (let i = 0; i < numFilters; i++) { + const childFilter = multiFilter.getChildFilterInstance(i); + if (childFilter?.filterType === "set") { + return { + setFilter: childFilter, + processModel: (model) => processMultiFilterModel(model, i, numFilters) + }; + } + } + return {}; +} +function extractFilterColId(event) { + return event.xKey || event.calloutLabelKey; +} +function getSetFilterModel(update, key, availableKeySet, existingValues) { + let values; + if (update) { + if (availableKeySet.has(key) && (existingValues == null || existingValues.includes(key))) { + values = []; + if (existingValues == null) { + for (const availableKey of availableKeySet) { + if (availableKey !== key) { + values.push(availableKey); + } + } + } else { + for (const existingValue of existingValues) { + if (existingValue !== key && availableKeySet.has(existingValue)) { + values.push(existingValue); + } + } + } + } else { + if (existingValues == null) { + values = Array.from(availableKeySet); + } else { + values = []; + for (const existingValue of existingValues) { + if (availableKeySet.has(existingValue)) { + values.push(existingValue); + } + } + } + values.push(key); + } + } else { + values = [key]; + } + return { + filterType: "set", + values + }; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/services/chartMenuService.ts +import { BeanStub as BeanStub95, _warn as _warn61 } from "ag-grid-community"; +var CHART_TOOLBAR_ALLOW_LIST = [ + "chartUnlink", + "chartLink", + "chartDownload", + "chartMenu" +]; +var CHART_TOOL_PANEL_MENU_OPTIONS = { + settings: "chartSettings", + data: "chartData", + format: "chartFormat" +}; +var ChartMenuService = class extends BeanStub95 { + constructor() { + super(...arguments); + this.beanName = "chartMenuSvc"; + } + wireBeans(beans) { + this.advSettingsMenuFactory = beans.advSettingsMenuFactory; + } + downloadChart(chartMenuContext, dimensions, fileName, fileFormat) { + chartMenuContext.chartController.getChartProxy().downloadChart(dimensions, fileName, fileFormat); + } + toggleLinked(chartMenuContext) { + chartMenuContext.chartController.detachChartRange(); + } + openAdvancedSettings(chartMenuContext, eventSource) { + this.advSettingsMenuFactory?.showMenu(chartMenuContext, eventSource); + } + hideAdvancedSettings() { + this.advSettingsMenuFactory?.hideMenu(); + } + getChartToolbarOptions() { + const defaultChartToolbarOptions = ["chartMenu"]; + const toolbarItemsFunc = this.gos.getCallback("getChartToolbarItems"); + const params = { + defaultItems: defaultChartToolbarOptions + }; + return toolbarItemsFunc ? toolbarItemsFunc(params).filter((option) => { + if (!CHART_TOOLBAR_ALLOW_LIST.includes(option)) { + _warn61(155, { option }); + return false; + } + return true; + }) : defaultChartToolbarOptions; + } + getChartToolPanels(chartController) { + const chartToolPanelsDef = this.gos.get("chartToolPanelsDef"); + const panelsOverride = chartToolPanelsDef?.panels?.map((panel) => { + const menuOption = CHART_TOOL_PANEL_MENU_OPTIONS[panel]; + if (!menuOption) { + _warn61(156, { panel }); + } + return menuOption; + }).filter((panel) => Boolean(panel)); + let panels = panelsOverride ?? Object.values(CHART_TOOL_PANEL_MENU_OPTIONS); + if (chartController.isPivotChart()) { + panels = panels.filter((panel) => panel !== "chartData"); + } + const defaultToolPanel = chartToolPanelsDef?.defaultToolPanel; + const defaultPanel = defaultToolPanel && CHART_TOOL_PANEL_MENU_OPTIONS[defaultToolPanel] || panels[0]; + return { + panels, + defaultPanel + }; + } + doesChartToolbarExist() { + const chartToolbarOptions = this.getChartToolbarOptions(); + return chartToolbarOptions.length > 0; + } + doChartToolPanelsExist(chartController) { + const { panels } = this.getChartToolPanels(chartController); + return panels.length > 0; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/services/chartTranslationService.ts +import { BeanStub as BeanStub96 } from "ag-grid-community"; +var DEFAULT_CHART_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", + stackedLineTooltip: "Stacked", + normalizedLineTooltip: "100% Stacked", + groupedAreaTooltip: "Area", + stackedAreaTooltip: "Stacked", + normalizedAreaTooltip: "100% Stacked", + scatterTooltip: "Scatter", + bubbleTooltip: "Bubble", + histogramTooltip: "Histogram", + radialColumnTooltip: "Radial Column", + radialBarTooltip: "Radial Bar", + radarLineTooltip: "Radar Line", + radarAreaTooltip: "Radar Area", + nightingaleTooltip: "Nightingale", + rangeBarTooltip: "Range Bar", + rangeAreaTooltip: "Range Area", + boxPlotTooltip: "Box Plot", + treemapTooltip: "Treemap", + sunburstTooltip: "Sunburst", + waterfallTooltip: "Waterfall", + heatmapTooltip: "Heatmap", + columnLineComboTooltip: "Column & Line", + areaColumnComboTooltip: "Area & Column", + customComboTooltip: "Custom Combination", + innerRadius: "Inner Radius", + startAngle: "Start Angle", + endAngle: "End Angle", + reverseDirection: "Reverse Direction", + groupPadding: "Group Padding", + seriesPadding: "Series Padding", + tile: "Tile", + whisker: "Whisker", + cap: "Cap", + capLengthRatio: "Length Ratio", + labelPlacement: "Placement", + inside: "Inside", + outside: "Outside", + noDataToChart: "No data available to be charted.", + pivotChartRequiresPivotMode: "Pivot Chart requires Pivot Mode enabled.", + chartSettingsToolbarTooltip: "Menu", + chartLinkToolbarTooltip: "Linked to Grid", + chartUnlinkToolbarTooltip: "Unlinked from Grid", + chartDownloadToolbarTooltip: "Download Chart", + chartMenuToolbarTooltip: "Menu", + chartEdit: "Edit Chart", + chartAdvancedSettings: "Advanced Settings", + chartLink: "Link to Grid", + chartUnlink: "Unlink from Grid", + chartDownload: "Download Chart", + histogramFrequency: "Frequency", + seriesChartType: "Series Chart Type", + seriesType: "Series Type", + secondaryAxis: "Secondary Axis", + seriesAdd: "Add a series", + categoryAdd: "Add a category", + bar: "Bar", + column: "Column", + histogram: "Histogram", + advancedSettings: "Advanced Settings", + direction: "Direction", + horizontal: "Horizontal", + vertical: "Vertical", + seriesGroupType: "Group Type", + groupedSeriesGroupType: "Grouped", + stackedSeriesGroupType: "Stacked", + normalizedSeriesGroupType: "100% Stacked", + legendEnabled: "Enabled", + groupedColumnFull: "Grouped Column", + stackedColumnFull: "Stacked Column", + normalizedColumnFull: "100% Stacked Column", + groupedBarFull: "Grouped Bar", + stackedBarFull: "Stacked Bar", + normalizedBarFull: "100% Stacked Bar", + stackedAreaFull: "Stacked Area", + normalizedAreaFull: "100% Stacked Area", + stackedLineFull: "Stacked Line", + normalizedLineFull: "100% Stacked Line", + customCombo: "Custom Combination", + funnel: "Funnel", + coneFunnel: "Cone Funnel", + pyramid: "Pyramid", + funnelGroup: "Funnel", + funnelTooltip: "Funnel", + coneFunnelTooltip: "Cone Funnel", + pyramidTooltip: "Pyramid", + dropOff: "Drop-Off", + stageLabels: "Stage Labels", + reverse: "Reverse", + tooltipMode: "Tooltip Mode", + tooltipModeSingle: "Single", + tooltipModeShared: "Multiple", + tooltipModeCompact: "Compact", + // menu items + 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", + // aria + ariaChartMenuClose: "Close Chart Edit Menu", + ariaChartSelected: "Selected", + // group + group: "Group", + // time formats + 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", + // agg funcs + sum: "Sum", + first: "First", + last: "Last", + min: "Min", + max: "Max", + count: "Count", + avg: "Average" +}; +var ChartTranslationService = class extends BeanStub96 { + constructor() { + super(...arguments); + this.beanName = "chartTranslation"; + } + translate(toTranslate) { + const translate = this.getLocaleTextFunc(); + const defaultTranslation = DEFAULT_CHART_TRANSLATIONS[toTranslate]; + return translate(toTranslate, defaultTranslation); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartService.ts +import { BeanStub as BeanStub101, _focusInto as _focusInto12, _warn as _warn68 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/gridChartComp.ts +import { + Component as Component97, + RefPlaceholder as RefPlaceholder67, + _addGridCommonParams as _addGridCommonParams29, + _clearElement as _clearElement23, + _errMsg as _errMsg2, + _focusGridInnerElement, + _focusInto as _focusInto11, + _getAbsoluteHeight as _getAbsoluteHeight2, + _getAbsoluteWidth as _getAbsoluteWidth3, + _mergeDeep as _mergeDeep5, + _removeFromParent as _removeFromParent18, + _setDisplayed as _setDisplayed27, + _warn as _warn67 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartController.ts +import { BeanStub as BeanStub97, _warn as _warn62 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/utils/chartParamsValidator.ts +import { _warnOnce } from "ag-grid-community"; +var validateIfDefined = (validationFn) => { + return (value) => { + if (value == void 0) { + return true; + } + return validationFn(value); + }; +}; +var isString = (value) => typeof value === "string"; +var isBoolean = (value) => typeof value === "boolean"; +var isValidSeriesChartType = (value) => typeof value === "object"; +var createWarnMessage = (property, expectedType) => (value) => `AG Grid - unable to update chart as invalid params supplied: \`${property}: ${value}\`, expected ${expectedType}.`; +var createEnterpriseMessage = (feature) => { + const url = "https://www.ag-grid.com/javascript-data-grid/integrated-charts-installation/"; + return `${feature} is not supported in AG Charts Community ('ag-charts-enterprise' hasn't been loaded). See ${url} for more details.`; +}; +var legacyChartTypes = ["doughnut"]; +var baseUpdateChartParams = [ + "type", + "chartId", + "chartType", + "chartThemeName", + "chartThemeOverrides", + "unlinkChart" +]; +function isValidChartType(value) { + return !!getSeriesTypeIfExists(value) || isComboChart(value); +} +function isLegacyChartType(value) { + return legacyChartTypes.includes(value); +} +var validateChartType = validateIfDefined( + (chartType) => { + if (isValidChartType(chartType)) { + return true; + } + if (isLegacyChartType(chartType)) { + const renamedChartType = getCanonicalChartType(chartType); + _warnOnce(`The chart type '${chartType}' has been deprecated. Please use '${renamedChartType}' instead.`); + return renamedChartType; + } + return false; + } +); +var validateAgChartThemeOverrides = validateIfDefined((themeOverrides) => { + return typeof themeOverrides === "object"; +}); +var validateChartParamsCellRange = validateIfDefined((cellRange) => { + return typeof cellRange === "object"; +}); +var validateAggFunc = validateIfDefined((aggFunc) => { + return typeof aggFunc === "string" || typeof aggFunc === "function"; +}); +var enterpriseChartTypeValidation = (isEnterprise) => ({ + property: "chartType", + validationFn: validateIfDefined( + (chartType) => isEnterprise || !chartType || !isEnterpriseChartType(chartType) + ), + warnMessage: (chartType) => createEnterpriseMessage(`The '${chartType}' chart type`) +}); +var switchCategorySeriesValidation = (isEnterprise) => ({ + property: "switchCategorySeries", + validationFn: validateIfDefined((switchCategorySeries) => { + if (!switchCategorySeries || isEnterprise) { + return true; + } + return void 0; + }), + warnMessage: () => createEnterpriseMessage(`'switchCategorySeries' has been ignored as it`), + warnIfFixed: true +}); +var commonUpdateValidations = () => [ + { property: "chartId", validationFn: isString, warnMessage: createWarnMessage("chartId", "string") }, + { + property: "chartType", + validationFn: validateChartType, + warnMessage: createWarnMessage("chartType", "ChartType") + }, + { + property: "chartThemeName", + validationFn: isString, + warnMessage: createWarnMessage("chartThemeName", "string") + }, + { + property: "chartThemeOverrides", + validationFn: validateAgChartThemeOverrides, + warnMessage: createWarnMessage("chartThemeOverrides", "AgChartThemeOverrides") + }, + { property: "unlinkChart", validationFn: isBoolean, warnMessage: createWarnMessage("unlinkChart", "boolean") } +]; +var cellRangeValidations = (isEnterprise) => [ + { + property: "cellRange", + validationFn: validateChartParamsCellRange, + warnMessage: createWarnMessage("cellRange", "ChartParamsCellRange") + }, + { + property: "suppressChartRanges", + validationFn: isBoolean, + warnMessage: createWarnMessage("suppressChartRanges", "boolean") + }, + { + property: "aggFunc", + validationFn: validateAggFunc, + warnMessage: createWarnMessage("aggFunc", "string or IAggFunc") + }, + switchCategorySeriesValidation(isEnterprise) +]; +function validateUpdateParams(params, isEnterprise) { + const paramsToValidate = params; + switch (paramsToValidate.type) { + case "rangeChartUpdate": + return validateUpdateRangeChartParams(params, isEnterprise); + case "pivotChartUpdate": + return validateUpdatePivotChartParams(params); + case "crossFilterChartUpdate": + return validateUpdateCrossFilterChartParams(params, isEnterprise); + default: + _warnOnce( + `Invalid value supplied for 'type': ${params.type}. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.` + ); + return false; + } +} +function validateCreateParams(params, isEnterprise) { + return validateProperties(params, [ + enterpriseChartTypeValidation(isEnterprise), + switchCategorySeriesValidation(isEnterprise) + ]); +} +function validateUpdateRangeChartParams(params, isEnterprise) { + const validations = [ + ...commonUpdateValidations(), + enterpriseChartTypeValidation(isEnterprise), + ...cellRangeValidations(isEnterprise), + { + property: "seriesChartTypes", + validationFn: (value) => value === void 0 || Array.isArray(value) && value.every(isValidSeriesChartType), + warnMessage: createWarnMessage("seriesChartTypes", "Array of SeriesChartType") + }, + { + property: "useGroupColumnAsCategory", + validationFn: isBoolean, + warnMessage: createWarnMessage("useGroupColumnAsCategory", "boolean") + } + ]; + return validateProperties( + params, + validations, + [ + ...baseUpdateChartParams, + "cellRange", + "suppressChartRanges", + "switchCategorySeries", + "aggFunc", + "seriesChartTypes", + "seriesGroupType", + "useGroupColumnAsCategory" + ], + "UpdateRangeChartParams" + ); +} +function validateUpdatePivotChartParams(params) { + const validations = [...commonUpdateValidations()]; + return validateProperties(params, validations, [...baseUpdateChartParams], "UpdatePivotChartParams"); +} +function validateUpdateCrossFilterChartParams(params, isEnterprise) { + const validations = [ + ...commonUpdateValidations(), + ...cellRangeValidations(isEnterprise) + ]; + return validateProperties( + params, + validations, + [...baseUpdateChartParams, "cellRange", "suppressChartRanges", "aggFunc"], + "UpdateCrossFilterChartParams" + ); +} +function validateProperties(params, validations, validPropertyNames, paramsType) { + let validatedProperties = void 0; + for (const validation of validations) { + const { property, validationFn, warnMessage, warnIfFixed } = validation; + if (property in params) { + const value = params[property]; + const validationResult = validationFn(value); + if (validationResult === true) { + continue; + } + if (validationResult === false) { + _warnOnce(warnMessage(value)); + return false; + } + validatedProperties = validatedProperties || { ...params }; + validatedProperties[property] = validationResult; + if (warnIfFixed) { + _warnOnce(warnMessage(value)); + } + } + } + if (validPropertyNames) { + for (const property of Object.keys(params)) { + if (!validPropertyNames.includes(property)) { + _warnOnce(`Unexpected property supplied. ${paramsType} does not contain: \`${property}\`.`); + return false; + } + } + } + if (validatedProperties) { + return validatedProperties; + } + return true; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/chartController.ts +var DEFAULT_THEMES = ["ag-default", "ag-material", "ag-sheets", "ag-polychroma", "ag-vivid"]; +var ChartController = class extends BeanStub97 { + constructor(model) { + super(); + this.model = model; + this.isEnterprise = () => this.agChartsExports.isEnterprise; + } + wireBeans(beans) { + this.rangeSvc = beans.rangeSvc; + this.agChartsExports = beans.agChartsExports; + } + postConstruct() { + this.setChartRange(); + if (this.model.unlinked) { + if (this.rangeSvc) { + this.rangeSvc.setCellRanges([]); + } + } + const listener = this.updateForGridChange.bind(this, {}); + this.addManagedEventListeners({ + cellSelectionChanged: (event) => { + if (event.id && event.id === this.model.chartId) { + this.updateForRangeChange(); + } + }, + columnMoved: listener, + columnPinned: listener, + columnVisible: listener, + columnRowGroupChanged: listener, + modelUpdated: listener, + cellValueChanged: this.updateForDataChange.bind(this), + cellEditValuesChanged: this.updateForDataChange.bind(this) + }); + } + update(params) { + if (!this.validUpdateType(params)) { + return false; + } + const validationResult = validateUpdateParams(params, this.agChartsExports.isEnterprise); + if (!validationResult) { + return false; + } + const validParams = validationResult === true ? params : validationResult; + this.applyValidatedChartParams(validParams); + return true; + } + applyValidatedChartParams(params) { + const { chartId, chartType, chartThemeName, unlinkChart } = params; + const common = { + chartId, + pivotChart: this.model.pivotChart, + chartType: chartType ?? this.model.chartType, + chartThemeName: chartThemeName ?? this.model.chartThemeName, + unlinkChart: unlinkChart ?? this.model.unlinked, + cellRange: this.model.suppliedCellRange, + switchCategorySeries: this.model.switchCategorySeries, + aggFunc: this.model.aggFunc, + seriesChartTypes: void 0, + suppressChartRanges: false, + crossFiltering: false + }; + const chartModelParams = { ...common }; + switch (params.type) { + case "rangeChartUpdate": + chartModelParams.cellRange = this.createCellRange(params) ?? this.model.suppliedCellRange; + chartModelParams.switchCategorySeries = params.switchCategorySeries ?? this.model.switchCategorySeries; + chartModelParams.aggFunc = params.aggFunc ?? this.model.aggFunc; + chartModelParams.seriesChartTypes = params.seriesChartTypes; + chartModelParams.suppressChartRanges = params.suppressChartRanges ?? this.model.suppressChartRanges; + chartModelParams.seriesGroupType = params.seriesGroupType ?? this.model.seriesGroupType; + chartModelParams.useGroupColumnAsCategory = params.useGroupColumnAsCategory ?? this.model.useGroupColumnAsCategory; + break; + case "crossFilterChartUpdate": + chartModelParams.cellRange = this.createCellRange(params) ?? this.model.suppliedCellRange; + chartModelParams.switchCategorySeries = false; + chartModelParams.aggFunc = params.aggFunc ?? this.model.aggFunc; + chartModelParams.crossFiltering = true; + chartModelParams.crossFilteringSort = this.model.crossFilteringSort; + chartModelParams.suppressChartRanges = params.suppressChartRanges ?? this.model.suppressChartRanges; + break; + case "pivotChartUpdate": + chartModelParams.switchCategorySeries = false; + break; + } + this.model.updateModel(chartModelParams); + const removeChartCellRanges = chartModelParams.unlinkChart || chartModelParams.suppressChartRanges; + if (removeChartCellRanges) { + this.rangeSvc?.setCellRanges([]); + } else { + this.setChartRange(); + } + } + updateForGridChange(params) { + if (this.model.unlinked) { + return; + } + const { maintainColState, setColsFromRange } = params ?? {}; + this.model.updateCellRanges({ maintainColState, setColsFromRange }); + this.model.updateData(); + this.setChartRange(); + } + updateForDataChange() { + if (this.model.unlinked) { + return; + } + this.model.updateData(); + this.raiseChartModelUpdateEvent(); + } + updateForRangeChange() { + this.updateForGridChange({ setColsFromRange: true }); + this.raiseChartRangeSelectionChangedEvent(); + } + updateForPanelChange(params) { + this.model.updateCellRanges(params); + this.model.updateData(); + if (params.skipAnimation) { + this.getChartProxy().getChartRef().skipAnimations(); + } + this.setChartRange(); + this.raiseChartRangeSelectionChangedEvent(); + } + updateThemeOverrides(updatedOverrides) { + this.chartProxy.updateThemeOverrides(updatedOverrides); + } + getChartUpdateParams(updatedOverrides) { + const selectedCols = this.getSelectedValueColState(); + const fields = selectedCols.map((c) => ({ colId: c.colId, displayName: c.displayName })); + const data = this.getChartData(); + const selectedDimensions = this.getSelectedDimensions(); + const model = this.model; + const params = { + data, + groupData: model.groupChartData, + grouping: this.isGrouping(), + categories: selectedDimensions.map(({ colId, displayName }) => { + const chartDataType = model.categoryAxisType ?? model.getChartDataType(colId); + return { + id: colId, + name: displayName, + chartDataType, + convertTime: chartDataType === "time" ? model.getConvertTime(colId) : void 0 + }; + }), + fields, + chartId: this.getChartId(), + getCrossFilteringContext: () => ({ lastSelectedChartId: "xxx" }), + //this.params.crossFilteringContext, //TODO + seriesChartTypes: this.getSeriesChartTypes(), + updatedOverrides, + seriesGroupType: model.seriesGroupType + }; + return this.isCategorySeriesSwitched() ? this.invertCategorySeriesParams(params) : params; + } + invertCategorySeriesParams(params) { + const [category] = params.categories; + const categories = [{ id: DEFAULT_CHART_CATEGORY, name: "" }]; + const fields = params.data.map((value, index) => { + const categoryKey = `${category.id}:${index}`; + const categoryValue = value[category.id]; + const seriesLabel = categoryValue == null ? "" : String(categoryValue); + return { colId: categoryKey, displayName: seriesLabel }; + }); + const data = params.fields.map((field) => { + const row = { + [DEFAULT_CHART_CATEGORY]: field.displayName + }; + for (const [index, value] of params.data.entries()) { + const categoryKey = `${category.id}:${index}`; + const seriesLabelValue = value[field.colId]; + row[categoryKey] = seriesLabelValue; + } + return row; + }); + return { + ...params, + categories, + fields, + data + }; + } + getChartModel() { + const modelType = this.model.pivotChart ? "pivot" : "range"; + const seriesChartTypes = this.isComboChart() ? this.model.comboChartModel.seriesChartTypes : void 0; + return { + modelType, + 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, + seriesGroupType: this.model.seriesGroupType, + useGroupColumnAsCategory: this.model.useGroupColumnAsCategory + }; + } + getChartId() { + return this.model.chartId; + } + getChartData() { + return this.model.chartData; + } + getChartType() { + return this.model.chartType; + } + setChartType(chartType) { + this.updateMultiSeriesAndCategory(this.model.chartType, chartType); + this.model.chartType = chartType; + this.model.comboChartModel.updateSeriesChartTypes(); + this.model.switchCategorySeries = false; + this.model.categoryAxisType = void 0; + this.model.seriesGroupType = void 0; + this.raiseChartModelUpdateEvent(); + } + isCategorySeriesSwitched() { + return this.model.switchCategorySeries && !this.model.isGrouping(); + } + switchCategorySeries(inverted) { + if (!supportsInvertedCategorySeries(this.getChartType())) { + return; + } + this.model.switchCategorySeries = inverted; + this.raiseChartModelUpdateEvent(); + } + getAggFunc() { + return this.model.aggFunc; + } + setAggFunc(value, silent) { + if (this.model.aggFunc === value) { + return; + } + this.model.aggFunc = value; + if (silent) { + return; + } + this.model.updateData(); + this.raiseChartModelUpdateEvent(); + } + updateMultiSeriesAndCategory(previousChartType, chartType) { + const updateForMax = (columns, maxNum) => { + let numSelected = 0; + for (const colState of columns) { + if (!colState.selected) { + continue; + } + if (numSelected >= maxNum) { + colState.selected = false; + } else { + numSelected++; + } + } + if (numSelected === 0) { + columns[0].selected = true; + } + }; + const maxNumDimensions = getMaxNumCategories(chartType); + const maxNumSeries = getMaxNumSeries(chartType); + const updateDimensionColState = maxNumDimensions != null && (getMaxNumCategories(previousChartType) ?? 100) > (maxNumDimensions ?? 100); + const updateValueColState = maxNumSeries != null && (getMaxNumSeries(previousChartType) ?? 100) > (maxNumSeries ?? 100); + if (updateDimensionColState) { + updateForMax(this.model.dimensionColState, maxNumDimensions); + } + if (updateValueColState) { + updateForMax(this.model.valueColState, maxNumSeries); + } + if (updateDimensionColState || updateValueColState) { + this.model.resetCellRanges(updateDimensionColState, updateValueColState); + this.setChartRange(true); + } + } + setChartThemeName(chartThemeName, silent) { + this.model.chartThemeName = chartThemeName; + if (!silent) { + this.raiseChartModelUpdateEvent(); + } + } + getChartThemeName() { + return this.model.chartThemeName; + } + isPivotChart() { + return this.model.pivotChart; + } + isPivotMode() { + return this.model.isPivotMode(); + } + isGrouping() { + return this.model.isGrouping(); + } + isCrossFilterChart() { + return this.model.crossFiltering; + } + getThemeNames() { + return this.gos.get("chartThemes") || DEFAULT_THEMES; + } + getThemes() { + const themeNames = this.getThemeNames(); + return themeNames.map((themeName) => { + const stockTheme = isStockTheme(themeName, this.agChartsExports._Theme); + const theme = stockTheme ? themeName : this.chartProxy.lookupCustomChartTheme(themeName); + return this.agChartsExports._Theme.getChartTheme(theme); + }); + } + getPalettes() { + const themes = this.getThemes(); + return themes.map((theme) => { + return theme.palette; + }); + } + getSelectedValueColState() { + return this.model.getValueColState().filter((cs) => cs.selected); + } + getSelectedDimensions() { + return this.model.getSelectedDimensions(); + } + getColStateForMenu() { + return { dimensionCols: this.model.dimensionColState, valueCols: this.model.getValueColState() }; + } + setChartRange(silent = false) { + if (this.rangeSvc && !this.model.suppressChartRanges && !this.model.unlinked) { + this.rangeSvc.setCellRanges(this.getCellRanges()); + } + if (!silent) { + this.raiseChartModelUpdateEvent(); + } + } + detachChartRange() { + this.model.unlinked = !this.model.unlinked; + if (this.model.unlinked) { + if (this.rangeSvc) { + this.rangeSvc.setCellRanges([]); + } + } else { + this.updateForGridChange(); + } + this.dispatchLocalEvent({ type: "chartLinkedChanged" }); + } + setChartProxy(chartProxy) { + this.chartProxy = chartProxy; + } + getChartProxy() { + return this.chartProxy; + } + isActiveXYChart() { + return ["scatter", "bubble"].includes(this.getChartType()); + } + isChartLinked() { + return !this.model.unlinked; + } + customComboExists() { + const savedCustomSeriesChartTypes = this.model.comboChartModel.savedCustomSeriesChartTypes; + return savedCustomSeriesChartTypes && savedCustomSeriesChartTypes.length > 0; + } + getSeriesChartTypes() { + return this.model.comboChartModel.seriesChartTypes; + } + isComboChart(chartType) { + return this.model.isComboChart(chartType); + } + updateSeriesChartType(colId, chartType, secondaryAxis) { + const seriesChartType = this.model.comboChartModel.seriesChartTypes.find((s2) => s2.colId === colId); + if (seriesChartType) { + const updateChartType = this.model.chartType !== "customCombo"; + if (updateChartType) { + this.model.chartType = "customCombo"; + } + const prevSeriesChartType = seriesChartType.chartType; + if (chartType != null) { + seriesChartType.chartType = chartType; + } + if (secondaryAxis != null) { + seriesChartType.secondaryAxis = secondaryAxis; + } + this.model.comboChartModel.savedCustomSeriesChartTypes = this.model.comboChartModel.seriesChartTypes; + this.model.comboChartModel.updateSeriesChartTypes(); + this.updateForDataChange(); + if (updateChartType) { + this.dispatchLocalEvent({ + type: "chartTypeChanged" + }); + } + if (prevSeriesChartType !== chartType) { + this.dispatchLocalEvent({ + type: "chartSeriesChartTypeChanged" + }); + } + this.raiseChartOptionsChangedEvent(); + } + } + getActiveSeriesChartTypes() { + const selectedColIds = this.getSelectedValueColState().map((c) => c.colId); + return this.getSeriesChartTypes().filter((s2) => selectedColIds.includes(s2.colId)); + } + getChartSeriesTypes(chartType) { + const targetChartType = chartType ?? this.getChartType(); + return this.isComboChart(targetChartType) ? ["line", "bar", "area"] : [getSeriesType(targetChartType)]; + } + getChartSeriesType() { + const seriesChartTypes = this.getSeriesChartTypes(); + if (seriesChartTypes.length === 0) { + return "bar"; + } + const ct = seriesChartTypes[0].chartType; + if (ct === "columnLineCombo") { + return "bar"; + } + if (ct === "areaColumnCombo") { + return "area"; + } + return getSeriesType(ct); + } + getCellRanges() { + return [this.model.dimensionCellRange, this.model.valueCellRange].filter((r) => r); + } + createCellRange(params) { + return params.cellRange && this.rangeSvc?.createPartialCellRangeFromRangeParams(params.cellRange, true); + } + validUpdateType(params) { + if (!params.type) { + _warn62(136); + return false; + } + const chartTypeMap = { + "Range Chart": () => !this.isPivotChart() && !this.isCrossFilterChart(), + "Pivot Chart": () => this.isPivotChart(), + "Cross Filter Chart": () => this.isCrossFilterChart() + }; + const currentChartType = Object.keys(chartTypeMap).find((type) => chartTypeMap[type]()) ?? "Range Chart"; + const valid = params.type === `${currentChartType[0].toLowerCase()}${currentChartType.slice(1).replace(/ /g, "")}Update`; + if (!valid) { + _warn62(137, { currentChartType, type: params.type }); + } + return valid; + } + getCellRangeParams() { + const cellRanges = this.getCellRanges(); + const firstCellRange = cellRanges[0]; + const startRow = firstCellRange?.startRow || null; + const endRow = firstCellRange?.endRow || null; + return { + rowStartIndex: startRow?.rowIndex ?? null, + rowStartPinned: startRow?.rowPinned, + rowEndIndex: endRow?.rowIndex ?? null, + rowEndPinned: endRow?.rowPinned, + columns: cellRanges.reduce( + (columns, value) => columns.concat(value.columns.map((c) => c.getId())), + [] + ) + }; + } + setCategoryAxisType(categoryAxisType) { + this.model.categoryAxisType = categoryAxisType; + this.raiseChartModelUpdateEvent(); + } + getSeriesGroupType() { + return this.model.seriesGroupType ?? this.chartProxy.getSeriesGroupType(); + } + setSeriesGroupType(seriesGroupType) { + this.model.seriesGroupType = seriesGroupType; + this.raiseChartModelUpdateEvent(); + } + raiseChartModelUpdateEvent() { + this.dispatchLocalEvent({ type: "chartModelUpdate" }); + this.raiseChartOptionsChangedEvent(); + } + raiseChartUpdatedEvent() { + this.dispatchLocalEvent({ type: "chartUpdated" }); + } + raiseChartApiUpdateEvent() { + this.dispatchLocalEvent({ type: "chartApiUpdate" }); + } + raiseChartOptionsChangedEvent() { + const { chartId, chartType } = this.getChartModel(); + this.eventSvc.dispatchEvent({ + type: "chartOptionsChanged", + chartId, + chartType, + chartThemeName: this.getChartThemeName(), + chartOptions: this.chartProxy?.getChartThemeOverrides() + }); + } + raiseChartRangeSelectionChangedEvent() { + this.eventSvc.dispatchEvent({ + type: "chartRangeSelectionChanged", + id: this.model.chartId, + chartId: this.model.chartId, + cellRange: this.getCellRangeParams() + }); + } + destroy() { + super.destroy(); + if (this.rangeSvc) { + this.rangeSvc.setCellRanges([]); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/areaChartProxy.ts +var AreaChartProxy = class extends CartesianChartProxy { + getAxes(params) { + const axes = { + x: { + type: this.getXAxisType(params), + position: "bottom" + }, + y: { + type: "number", + position: "left" + } + }; + if (this.isNormalised()) { + axes.y.label = { ...axes.y.label, formatter: (params2) => Math.round(params2.value) + "%" }; + } + return axes; + } + getSeries(params) { + const [category] = params.categories; + const series = params.fields.map( + (f) => ({ + type: this.standaloneChartType, + xKey: category.id, + xName: category.name, + yKey: f.colId, + yName: f.displayName, + normalizedTo: this.chartType === "normalizedArea" ? 100 : void 0, + stacked: ["normalizedArea", "stackedArea"].includes(this.chartType) + }) + ); + return this.crossFiltering ? this.extractLineAreaCrossFilterSeries(series, params) : series; + } + isNormalised() { + return !this.crossFiltering && this.chartType === "normalizedArea"; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/barChartProxy.ts +var HORIZONTAL_CHART_TYPES = /* @__PURE__ */ new Set(["bar", "groupedBar", "stackedBar", "normalizedBar"]); +var BarChartProxy = class extends CartesianChartProxy { + getAxes(params) { + const axes = { + x: { + type: this.getXAxisType(params), + position: this.isHorizontal() ? "left" : "bottom" + }, + y: { + type: "number", + position: this.isHorizontal() ? "bottom" : "left" + } + }; + if (this.isNormalised()) { + axes.y.label = { ...axes.y.label, formatter: (params2) => Math.round(params2.value) + "%" }; + } + return axes; + } + getSeries(params) { + const [category] = params.categories; + const series = params.fields.map( + (f) => ({ + type: this.standaloneChartType, + direction: this.isHorizontal() ? "horizontal" : "vertical", + stacked: this.crossFiltering || isStacked(this.chartType), + normalizedTo: this.isNormalised() ? 100 : void 0, + xKey: category.id, + xName: category.name, + yKey: f.colId, + yName: f.displayName + }) + ); + return this.crossFiltering ? this.extractCrossFilterSeries(series) : series; + } + extractCrossFilterSeries(series) { + const allSeries = []; + for (let i = 0; i < series.length; i++) { + const commonSeries = series[i]; + const primarySeries = { + ...commonSeries, + listeners: { + seriesNodeClick: this.crossFilterCallback + } + }; + const filteredOutSeries = { + ...primarySeries, + yKey: `${primarySeries.yKey}-filtered-out`, + showInLegend: false + }; + allSeries.push(primarySeries); + allSeries.push(filteredOutSeries); + } + return allSeries; + } + isNormalised() { + const normalisedCharts = ["normalizedColumn", "normalizedBar"]; + return !this.crossFiltering && normalisedCharts.includes(this.chartType); + } + isHorizontal() { + return HORIZONTAL_CHART_TYPES.has(this.chartType); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/lineChartProxy.ts +var LineChartProxy = class extends CartesianChartProxy { + getAxes(params) { + const axes = { + x: { + type: this.getXAxisType(params), + position: "bottom" + }, + y: { + type: "number", + position: "left" + } + }; + if (this.isNormalised()) { + axes.y.label = { ...axes.y.label, formatter: (params2) => Math.round(params2.value) + "%" }; + } + return axes; + } + getSeries(params) { + const [category] = params.categories; + const stacked = ["normalizedLine", "stackedLine"].includes(this.chartType); + const series = params.fields.map( + (f) => ({ + type: this.standaloneChartType, + xKey: category.id, + xName: category.name, + yKey: f.colId, + yName: f.displayName, + normalizedTo: stacked && this.isNormalised() ? 100 : void 0, + stacked + }) + ); + return this.crossFiltering ? this.extractLineAreaCrossFilterSeries(series, params) : series; + } + isNormalised() { + const normalisedCharts = ["normalizedLine"]; + return !this.crossFiltering && normalisedCharts.includes(this.chartType); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/cartesian/scatterChartProxy.ts +var ScatterChartProxy = class extends CartesianChartProxy { + getAxes(_params) { + return { + x: { + type: "number", + position: "bottom" + }, + y: { + type: "number", + position: "left" + } + }; + } + getSeries(params) { + const [category] = params.categories; + const paired = this.isPaired(); + const seriesDefinitions = this.getSeriesDefinitions(params.fields, paired); + const labelFieldDefinition = category.id === DEFAULT_CHART_CATEGORY ? void 0 : category; + const series = seriesDefinitions.map((seriesDefinition) => { + if (seriesDefinition?.sizeField) { + const opts2 = { + type: "bubble", + xKey: seriesDefinition.xField.colId, + xName: seriesDefinition.xField.displayName ?? void 0, + yKey: seriesDefinition.yField.colId, + yName: seriesDefinition.yField.displayName ?? void 0, + title: `${seriesDefinition.yField.displayName} vs ${seriesDefinition.xField.displayName}`, + sizeKey: seriesDefinition.sizeField.colId, + sizeName: seriesDefinition.sizeField.displayName ?? "", + labelKey: labelFieldDefinition ? labelFieldDefinition.id : seriesDefinition.yField.colId, + labelName: labelFieldDefinition ? labelFieldDefinition.name : void 0 + }; + return opts2; + } + const opts = { + type: "scatter", + xKey: seriesDefinition.xField.colId, + xName: seriesDefinition.xField.displayName ?? void 0, + yKey: seriesDefinition.yField.colId, + yName: seriesDefinition.yField.displayName ?? void 0, + title: `${seriesDefinition.yField.displayName} vs ${seriesDefinition.xField.displayName}`, + labelKey: labelFieldDefinition ? labelFieldDefinition.id : seriesDefinition.yField.colId, + labelName: labelFieldDefinition ? labelFieldDefinition.name : void 0 + }; + return opts; + }); + return this.crossFiltering ? this.extractCrossFilterSeries(series, params) : series; + } + extractCrossFilterSeries(series, params) { + const { data } = params; + const filteredOutKey = (key) => `${key}-filtered-out`; + const calcMarkerDomain = (data2, sizeKey) => { + const markerDomain = [Infinity, -Infinity]; + if (sizeKey != null) { + for (const datum of data2) { + const value = datum[sizeKey] ?? datum[filteredOutKey(sizeKey)]; + if (value < markerDomain[0]) { + markerDomain[0] = value; + } + if (value > markerDomain[1]) { + markerDomain[1] = value; + } + } + } + if (markerDomain[0] <= markerDomain[1]) { + return markerDomain; + } + return void 0; + }; + const updatePrimarySeries = (series2) => { + let markerDomain = void 0; + if (series2.type === "bubble") { + const { sizeKey } = series2; + markerDomain = calcMarkerDomain(data, sizeKey); + } + return { + ...series2, + domain: markerDomain, + highlight: { highlightedItem: { fill: "yellow" } }, + listeners: { + ...series2.listeners, + seriesNodeClick: this.crossFilterCallback + } + }; + }; + const updateFilteredOutSeries = (series2) => { + const { yKey, xKey } = series2; + let alteredSizeKey = {}; + if (series2.type === "bubble") { + alteredSizeKey = { sizeKey: filteredOutKey(series2.sizeKey) }; + } + return { + ...series2, + ...alteredSizeKey, + yKey: filteredOutKey(yKey), + xKey: filteredOutKey(xKey), + showInLegend: false, + listeners: { + ...series2.listeners, + seriesNodeClick: (e) => { + const value = e.datum[filteredOutKey(xKey)]; + const filterableEvent = { + ...e, + xKey, + datum: { ...e.datum, [xKey]: value } + }; + this.crossFilterCallback(filterableEvent); + } + } + }; + }; + const updatedSeries = series.map(updatePrimarySeries); + return [...updatedSeries, ...updatedSeries.map(updateFilteredOutSeries)]; + } + getSeriesDefinitions(fields, paired) { + if (fields.length < 2) { + return []; + } + const isBubbleChart = this.chartType === "bubble"; + if (paired) { + if (isBubbleChart) { + return fields.map( + (currentXField, i) => i % 3 === 0 ? { + xField: currentXField, + yField: fields[i + 1], + sizeField: fields[i + 2] + } : null + ).filter((x) => x?.yField && x.sizeField); + } + return fields.map( + (currentXField, i) => i % 2 === 0 ? { + xField: currentXField, + yField: fields[i + 1] + } : null + ).filter((x) => x?.yField); + } + const xField = fields[0]; + if (isBubbleChart) { + return fields.map( + (yField, i) => i % 2 === 1 ? { + xField, + yField, + sizeField: fields[i + 1] + } : null + ).filter((x) => x?.sizeField); + } + return fields.filter((value, i) => i > 0).map((yField) => ({ xField, yField })); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/combo/comboChartProxy.ts +var ComboChartProxy = class extends CartesianChartProxy { + getAxes(params) { + const fields = params ? params.fields : []; + const fieldsMap = new Map(fields.map((f) => [f.colId, f])); + const { primaryYKeys, secondaryYKeys } = this.getYKeys(fields, params.seriesChartTypes); + const axes = { + x: { + type: this.getXAxisType(params), + position: "bottom" + } + }; + if (primaryYKeys.length > 0) { + axes.y = { + type: "number", + position: "left" + }; + } + if (secondaryYKeys.length > 0) { + secondaryYKeys.forEach((secondaryYKey) => { + const field = fieldsMap.get(secondaryYKey); + const secondaryAxisIsVisible = field && field.colId === secondaryYKey; + if (!secondaryAxisIsVisible) { + return; + } + const secondaryAxisOptions = { + type: "number", + position: "right" + }; + axes[`y_${secondaryYKey}`] = secondaryAxisOptions; + }); + } + return axes; + } + getSeries(params) { + const { fields, seriesChartTypes } = params; + const [category] = params.categories; + return fields.map((field) => { + const seriesChartType = seriesChartTypes.find((s2) => s2.colId === field.colId); + if (seriesChartType) { + const chartType = seriesChartType.chartType; + const grouped = ["groupedColumn", "groupedBar"].includes(chartType); + const groupedOpts = grouped ? { grouped: true } : {}; + const yKeyAxis = seriesChartType.secondaryAxis ? `y_${field.colId}` : "y"; + return { + type: getSeriesType(chartType), + xKey: category.id, + yKey: field.colId, + yName: field.displayName, + yKeyAxis, + stacked: ["stackedArea", "stackedColumn"].includes(chartType), + ...groupedOpts + }; + } + }); + } + getYKeys(fields, seriesChartTypes) { + const primaryYKeys = []; + const secondaryYKeys = []; + for (const field of fields) { + const colId = field.colId; + const seriesChartType = seriesChartTypes.find((s2) => s2.colId === colId); + if (seriesChartType) { + if (seriesChartType.secondaryAxis) { + secondaryYKeys.push(colId); + } else { + primaryYKeys.push(colId); + } + } + } + return { primaryYKeys, secondaryYKeys }; + } + setSeriesChartThemeDefaults(overrides) { + const seriesOverrides = this.getSeriesChartThemeDefaults(); + if (!seriesOverrides) { + return; + } + const chartTypes = /* @__PURE__ */ new Set(); + for (const seriesChartType of this.chartProxyParams.seriesChartTypes) { + chartTypes.add(seriesChartType.chartType); + } + for (const chartType of chartTypes) { + overrides[getSeriesType(chartType)] = seriesOverrides; + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/chartProxies/pie/pieChartProxy.ts +function calculateOffsets(offset) { + const outerRadiusOffset = offset.currentOffset; + offset.currentOffset -= offset.offsetAmount; + const innerRadiusOffset = offset.currentOffset; + offset.currentOffset -= offset.offsetAmount; + return { outerRadiusOffset, innerRadiusOffset }; +} +var PieChartProxy = class extends ChartProxy { + getUpdateOptions(params, commonChartOptions) { + return { + ...commonChartOptions, + data: this.crossFiltering ? this.getCrossFilterData(params) : params.data, + series: this.getSeries(params) + }; + } + getSeries(params) { + const [category] = params.categories; + const numFields = params.fields.length; + const offset = { + currentOffset: 0, + offsetAmount: numFields > 1 ? 20 : 40 + }; + const series = this.getFields(params).map( + (f) => { + const options = { + type: this.standaloneChartType, + angleKey: f.colId, + angleName: f.displayName, + sectorLabelKey: f.colId, + calloutLabelName: category.name, + calloutLabelKey: category.id + }; + if (this.chartType === "donut" || this.chartType === "doughnut") { + const { outerRadiusOffset, innerRadiusOffset } = calculateOffsets(offset); + const title = f.displayName ? { + title: { text: f.displayName, showInLegend: numFields > 1 } + } : void 0; + return { + ...options, + type: "donut", + outerRadiusOffset, + innerRadiusOffset, + ...title + }; + } + return options; + } + ); + return this.crossFiltering ? this.extractCrossFilterSeries(series) : series; + } + getCrossFilterData(params) { + const colId = params.fields[0].colId; + const filteredOutColId = `${colId}-filtered-out`; + return params.data.map((d) => { + const total = d[colId] + d[filteredOutColId]; + d[`${colId}-total`] = total; + d[filteredOutColId] = 1; + d[colId] = d[colId] / total; + return d; + }); + } + extractCrossFilterSeries(series) { + const primarySeries = series[0]; + const angleKey = primarySeries.angleKey; + const commonOptions = { + ...primarySeries, + radiusMin: 0, + radiusMax: 1, + listeners: { + seriesNodeClick: this.crossFilterCallback + }, + legendItemKey: primarySeries.calloutLabelKey, + angleKey: `${angleKey}-total` + }; + const primaryOptions = { + ...commonOptions, + radiusKey: angleKey, + sectorLabelKey: `${angleKey}-total` + }; + const filteredOutOptions = { + ...commonOptions, + radiusKey: `${angleKey}-filtered-out`, + showInLegend: false + }; + return [filteredOutOptions, primaryOptions]; + } + getFields(params) { + return this.chartType === "pie" ? params.fields.slice(0, 1) : params.fields; + } + getSeriesChartThemeDefaults() { + return { + series: { + highlight: getSeriesHighlight(this.crossFiltering) + } + }; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartMenu.ts +import { AgPromise as AgPromise14, Component as Component96, _warn as _warn66 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartToolbar.ts +import { Component as Component63, RefPlaceholder as RefPlaceholder51, _clearElement as _clearElement20, _createElement as _createElement18, _createIconNoSpan as _createIconNoSpan26 } from "ag-grid-community"; +var ChartToolbar = class extends Component63 { + constructor() { + super( + /* html */ + `
` + ); + this.eMenu = RefPlaceholder51; + this.buttonListenersDestroyFuncs = []; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + updateParams(params) { + const { buttons } = params; + this.createButtons(buttons); + } + createButtons(buttons) { + for (const func of this.buttonListenersDestroyFuncs) { + func?.(); + } + this.buttonListenersDestroyFuncs = []; + const menuEl = this.eMenu; + _clearElement20(menuEl); + for (const buttonConfig of buttons) { + const { buttonName, iconName, callback } = buttonConfig; + const buttonEl = this.createButton(iconName); + const tooltipTitle = this.chartTranslation.translate( + buttonName + "ToolbarTooltip" + ); + if (tooltipTitle && buttonEl instanceof HTMLElement) { + buttonEl.title = tooltipTitle; + } + this.buttonListenersDestroyFuncs.push( + ...this.addManagedElementListeners(buttonEl, { + click: (event) => callback(event.currentTarget) + }) + ); + menuEl.appendChild(buttonEl); + } + } + createButton(iconName) { + const buttonEl = _createIconNoSpan26(iconName, this.beans); + buttonEl.classList.add("ag-chart-menu-icon"); + const wrapperEl = _createElement18({ + tag: "button", + attrs: { type: "button" }, + cls: "ag-chart-menu-toolbar-button" + }); + wrapperEl.appendChild(buttonEl); + return wrapperEl; + } + destroy() { + this.buttonListenersDestroyFuncs = []; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/tabbedChartMenu.ts +import { AgPromise as AgPromise13, Component as Component95, _createElement as _createElement19 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/chartDataPanel.ts +import { AgToggleButton as AgToggleButton5, Component as Component68, _getDocument as _getDocument7, _setDisplayed as _setDisplayed24, _warn as _warn63 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/categoriesDataPanel.ts +import { AgSelect as AgSelect4, AgToggleButton as AgToggleButton2 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/dragDataPanel.ts +import { AgSelect as AgSelect3, Component as Component65 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/widgets/agPillSelect.ts +import { + AgSelect as AgSelect2, + Component as Component64, + DragSourceType as DragSourceType8, + _escapeString as _escapeString8, + _getActiveDomElement as _getActiveDomElement15, + _removeFromParent as _removeFromParent12 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/widgets/agPillSelect.css +var agPillSelect_default = ".ag-pill-select{display:flex;flex-direction:column}.ag-pill-select .ag-column-drop-list{padding:0}:where(.ag-pill-select){.ag-select{padding-top:var(--ag-spacing)}.ag-picker-field-wrapper{background-color:transparent;border:0}.ag-picker-field-display{cursor:pointer;font-weight:500}.ag-picker-field-display,.ag-picker-field-icon{color:var(--ag-chart-menu-label-color)}}"; + +// packages/ag-grid-enterprise/src/charts/widgets/agPillSelect.ts +var AgPillSelect = class extends Component64 { + constructor(config) { + super( + /* html */ + `` + ); + this.config = config ?? {}; + const { selectedValueList, valueFormatter, valueList } = this.config; + this.selectedValues = selectedValueList ?? []; + this.valueList = valueList ?? []; + this.valueFormatter = valueFormatter ?? ((value) => _escapeString8(value)); + this.registerCSS(agPillSelect_default); + } + postConstruct() { + const { ariaLabel, onValuesChange, dragSourceId } = this.config; + this.dropZonePanel = this.createManagedBean( + new PillSelectDropZonePanel( + { + getValues: () => this.selectedValues, + setValues: (values) => this.updateValues(values), + isDraggable: () => this.selectedValues.length > 1 + }, + (value) => this.valueFormatter(value), + ariaLabel, + dragSourceId + ) + ); + const eGui = this.getGui(); + eGui.appendChild(this.dropZonePanel.getGui()); + this.initSelect(); + if (onValuesChange != null) { + this.onValuesChange = onValuesChange; + } + } + setValues(valueList, selectedValues) { + const { added, removed, updated } = this.getChanges(this.valueList, valueList); + let refreshSelect = false; + if (added.length || removed.length || updated.length) { + refreshSelect = true; + } + this.valueList = valueList; + this.updateValues(selectedValues, refreshSelect, true); + return this; + } + setValueFormatter(valueFormatter) { + this.valueFormatter = valueFormatter; + return this; + } + initSelect() { + const options = this.createSelectOptions(); + if (!options.length) { + return false; + } + const { selectPlaceholder: placeholder } = this.config; + this.eSelect = this.createBean( + new AgSelect2({ + options, + placeholder, + onValueChange: (value) => this.addValue(value), + pickerIcon: "chartsMenuAdd" + }) + ); + this.getGui().appendChild(this.eSelect.getGui()); + return true; + } + createSelectOptions() { + const options = []; + const { maxSelection } = this.config; + if (maxSelection && this.selectedValues.length >= maxSelection) { + return options; + } + for (const value of this.valueList) { + if (!this.selectedValues.includes(value)) { + options.push({ value, text: this.valueFormatter(value) }); + } + } + return options; + } + addValue(value) { + this.dropZonePanel.addItem(value); + } + updateValues(values, forceRefreshSelect, silent) { + const previousSelectedValues = this.selectedValues; + this.selectedValues = values; + const changes = this.getChanges(previousSelectedValues, values); + const refreshSelect = forceRefreshSelect || changes.added.length || changes.removed.length; + const activeElement = _getActiveDomElement15(this.beans); + const selectHasFocus = this.eSelect?.getGui().contains(activeElement); + const dropZoneHasFocus = this.dropZonePanel?.getGui().contains(activeElement); + if (!silent) { + this.onValuesChange?.(changes); + } + const emptyRefreshedSelect = refreshSelect ? !this.refreshSelect() : false; + this.dropZonePanel.refreshGui(); + if (refreshSelect && selectHasFocus) { + if (emptyRefreshedSelect) { + this.dropZonePanel.focusList(true); + } else { + this.eSelect?.getFocusableElement().focus(); + } + } + if (dropZoneHasFocus && !values.length) { + this.eSelect?.getFocusableElement().focus(); + } + } + getChanges(previousSelectedValues, newSelectedValues) { + const added = newSelectedValues.filter((value) => !previousSelectedValues.includes(value)); + const removed = previousSelectedValues.filter((value) => !newSelectedValues.includes(value)); + const updated = newSelectedValues.filter((value, index) => previousSelectedValues[index] !== value); + return { added, removed, updated, selected: newSelectedValues }; + } + refreshSelect() { + if (!this.eSelect) { + return this.initSelect(); + } + const options = this.createSelectOptions(); + if (!options.length) { + _removeFromParent12(this.eSelect.getGui()); + this.eSelect = this.destroyBean(this.eSelect); + return false; + } + this.eSelect.clearOptions().addOptions(options).setValue(void 0, true); + return true; + } + destroy() { + this.destroyBean(this.eSelect); + super.destroy(); + } +}; +var PillSelectDragComp = class extends PillDragComp { + constructor(value, dragSourceDropTarget, ghost, valueFormatter, draggable, sourceId) { + super(dragSourceDropTarget, ghost, false); + this.value = value; + this.valueFormatter = valueFormatter; + this.draggable = draggable; + this.sourceId = sourceId; + } + getItem() { + return this.value; + } + getDisplayName() { + return this.valueFormatter(this.value); + } + getAriaDisplayName() { + return this.getDisplayName(); + } + getTooltip() { + return void 0; + } + createGetDragItem() { + return () => ({ + value: this.value + }); + } + getDragSourceType() { + return DragSourceType8.ChartPanel; + } + getDragSourceId() { + return this.sourceId; + } + isMovable() { + return this.isDraggable(); + } + isDraggable() { + return this.draggable; + } +}; +var PillSelectDropZonePanel = class extends PillDropZonePanel { + constructor(model, valueFormatter, ariaLabel, sourceId) { + super(false); + this.model = model; + this.valueFormatter = valueFormatter; + this.ariaLabel = ariaLabel; + this.sourceId = sourceId; + } + postConstruct() { + super.init(); + } + isItemDroppable(item, draggingEvent) { + return this.isSourceEventFromTarget(draggingEvent) || this.sourceId != null && this.sourceId === draggingEvent.dragSource.sourceId; + } + updateItems(items) { + this.model.setValues(items); + } + getExistingItems() { + return this.model.getValues(); + } + getIconName() { + return this.isPotentialDndItems() ? "move" : "notAllowed"; + } + getAriaLabel() { + return this.ariaLabel; + } + createPillComponent(item, dropTarget, ghost) { + return new PillSelectDragComp( + item, + dropTarget, + ghost, + this.valueFormatter, + this.model.isDraggable(), + this.sourceId + ); + } + getItems(dragItem) { + return [dragItem.value]; + } + isInterestedIn(type) { + return type === DragSourceType8.ChartPanel; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/dragDataPanel.ts +var DragDataPanel = class extends Component65 { + constructor(chartController, allowMultipleSelection, maxSelection, template) { + super(template); + this.chartController = chartController; + this.allowMultipleSelection = allowMultipleSelection; + this.maxSelection = maxSelection; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + addItem(eItem) { + this.groupComp.addItem(eItem); + } + createGroup(columns, valueFormatter, selectLabelKey, dragSourceId, skipAnimation) { + if (this.allowMultipleSelection) { + const selectedValueList = columns.filter((col) => col.selected); + this.valuePillSelect = this.groupComp.createManagedBean( + new AgPillSelect({ + valueList: columns, + selectedValueList, + valueFormatter, + selectPlaceholder: this.chartTranslation.translate(selectLabelKey), + dragSourceId, + onValuesChange: (params) => this.onValueChange(params), + maxSelection: this.maxSelection + }) + ); + this.groupComp.addItem(this.valuePillSelect); + } else { + const params = this.createValueSelectParams(columns); + params.onValueChange = (updatedColState) => { + for (const col of columns) { + col.selected = false; + } + updatedColState.selected = true; + if (updatedColState.colId === DEFAULT_CHART_CATEGORY) { + this.chartController.setAggFunc(void 0, true); + } + this.chartController.updateForPanelChange({ updatedColState, skipAnimation: skipAnimation?.() }); + }; + this.valueSelect = this.groupComp.createManagedBean(new AgSelect3(params)); + this.groupComp.addItem(this.valueSelect); + } + } + refreshValueSelect(columns) { + if (!this.valueSelect) { + return; + } + const { options, value } = this.createValueSelectParams(columns); + this.valueSelect.clearOptions().addOptions(options).setValue(value, true); + } + createValueSelectParams(columns) { + let selectedValue; + const options = columns.map((value) => { + const text = value.displayName ?? ""; + if (value.selected) { + selectedValue = value; + } + return { + value, + text + }; + }); + return { + options, + value: selectedValue + }; + } + onValueChange({ added, updated, removed, selected }) { + let updatedColState; + let resetOrder; + const updateOrder = () => { + selected.forEach((col, index) => { + col.order = index; + }); + resetOrder = true; + }; + if (added.length) { + updatedColState = added[0]; + updatedColState.selected = true; + updateOrder(); + } else if (removed.length) { + updatedColState = removed[0]; + updatedColState.selected = false; + } else if (updated.length) { + updateOrder(); + updatedColState = updated[0]; + } + if (updatedColState) { + this.chartController.updateForPanelChange({ updatedColState, resetOrder }); + } + } + destroy() { + this.valuePillSelect = void 0; + this.valueSelect = void 0; + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/categoriesDataPanel.ts +var DEFAULT_AGG_FUNC = "sum"; +var CategoriesDataPanel = class extends DragDataPanel { + constructor(chartController, title, allowMultipleSelection, dimensionCols, isOpen) { + const maxSelection = void 0; + super( + chartController, + allowMultipleSelection, + maxSelection, + /* html */ + `
` + ); + this.title = title; + this.dimensionCols = dimensionCols; + this.isOpen = isOpen; + } + postConstruct() { + this.groupComp = this.createBean( + new AgGroupComponent({ + title: this.title, + enabled: true, + suppressEnabledCheckbox: true, + suppressOpenCloseIcons: false, + cssIdentifier: "charts-data", + expanded: this.isOpen + }) + ); + this.createGroup( + this.dimensionCols, + (col) => col.displayName ?? "", + "categoryAdd", + "categorySelect", + () => !this.chartController.getAggFunc() + ); + this.createAggFuncControls(this.dimensionCols); + this.getGui().appendChild(this.groupComp.getGui()); + } + refresh(dimensionCols) { + this.valuePillSelect?.setValues( + dimensionCols, + dimensionCols.filter((col) => col.selected) + ); + this.refreshValueSelect(dimensionCols); + this.refreshAggFuncControls(dimensionCols, this.chartController.getAggFunc()); + } + createAggFuncControls(dimensionCols) { + const aggFunc = this.chartController.getAggFunc(); + this.groupComp.addItem( + this.aggFuncToggle = this.createBean( + new AgToggleButton2({ + label: this.chartTranslation.translate("aggregate"), + labelAlignment: "left", + labelWidth: "flex", + inputWidth: "flex", + value: aggFunc != void 0, + onValueChange: (value) => { + const aggFunc2 = value ? DEFAULT_AGG_FUNC : void 0; + this.chartController.setAggFunc(aggFunc2); + this.aggFuncSelect?.setValue(aggFunc2, true); + this.aggFuncSelect?.setDisplayed(aggFunc2 != void 0); + } + }) + ) + ); + this.groupComp.addItem( + this.aggFuncSelect = this.createBean( + new AgSelect4({ + options: [ + { value: "sum", text: this.chartTranslation.translate("sum") }, + { value: "first", text: this.chartTranslation.translate("first") }, + { value: "last", text: this.chartTranslation.translate("last") }, + { value: "min", text: this.chartTranslation.translate("min") }, + { value: "max", text: this.chartTranslation.translate("max") }, + { value: "count", text: this.chartTranslation.translate("count") }, + { value: "avg", text: this.chartTranslation.translate("avg") } + ], + value: typeof aggFunc === "string" ? aggFunc : void 0, + onValueChange: (value) => { + this.chartController.setAggFunc(value); + } + }) + ) + ); + this.refreshAggFuncControls(dimensionCols, aggFunc); + } + refreshAggFuncControls(dimensionCols, aggFunc) { + const selectedDimensions = dimensionCols.filter((col) => col.selected); + const supportsAggregation = selectedDimensions.some((col) => col.colId !== DEFAULT_CHART_CATEGORY); + this.aggFuncToggle?.setValue(aggFunc != void 0); + this.aggFuncSelect?.setValue(typeof aggFunc === "string" ? aggFunc : void 0, true); + this.aggFuncToggle?.setDisplayed(supportsAggregation); + this.aggFuncSelect?.setDisplayed(supportsAggregation && aggFunc != void 0); + } + clearAggFuncControls() { + this.aggFuncToggle = this.destroyBean(this.aggFuncToggle); + this.aggFuncSelect = this.destroyBean(this.aggFuncSelect); + } + destroy() { + this.clearAggFuncControls(); + this.groupComp = this.destroyBean(this.groupComp); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/chartSpecificDataPanel.ts +import { AgSelect as AgSelect5, AgToggleButton as AgToggleButton3, Component as Component66, RefPlaceholder as RefPlaceholder52 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartMenuParamsFactory.ts +import { BeanStub as BeanStub98 } from "ag-grid-community"; +var ChartMenuParamsFactory = class extends BeanStub98 { + constructor(chartOptionsProxy) { + super(); + this.chartOptionsProxy = chartOptionsProxy; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + getDefaultColorPickerParams(expression, labelKey, options) { + return this.addValueParams( + expression, + { + label: this.chartTranslation.translate(labelKey ?? "color"), + labelWidth: "flex", + inputWidth: "flex", + labelAlignment: "top", + pickerGap: 6 + }, + options + ); + } + getDefaultNumberInputParams(expression, labelKey, options) { + return this.addValueParams( + expression, + { + label: this.chartTranslation.translate(labelKey), + labelAlignment: "top", + labelWidth: "flex", + inputWidth: "flex", + precision: options?.precision, + step: options?.step, + min: options?.min, + max: options?.max + }, + { + parseInputValue: (value) => { + const numberValue = Number(value); + return isNaN(numberValue) ? void 0 : numberValue; + }, + formatInputValue: (value) => { + return value == null ? "" : `${value}`; + } + } + ); + } + getDefaultSliderParams(expression, labelKey, defaultMaxValue, isArray) { + let value = this.chartOptionsProxy.getValue(expression) ?? 0; + if (isArray && Array.isArray(value)) { + value = value[0]; + } + const params = this.getDefaultSliderParamsWithoutValueParams(value, labelKey, defaultMaxValue); + params.onValueChange = (value2) => this.chartOptionsProxy.setValue(expression, isArray ? [value2] : value2); + return params; + } + getDefaultSliderParamsWithoutValueParams(value, labelKey, defaultMaxValue) { + return { + label: this.chartTranslation.translate(labelKey), + minValue: 0, + maxValue: Math.max(value, defaultMaxValue), + textFieldWidth: 45, + value: `${value}` + }; + } + getDefaultCheckboxParams(expression, labelKey, options) { + const value = this.chartOptionsProxy.getValue(expression); + const params = { + label: this.chartTranslation.translate(labelKey), + value, + readOnly: options?.readOnly, + passive: options?.passive + }; + params.onValueChange = (value2) => { + this.chartOptionsProxy.setValue(expression, typeof value2 === "boolean" ? value2 : void 0); + }; + return params; + } + getDefaultToggleParams(expression, labelKey, options) { + const value = this.chartOptionsProxy.getValue(expression); + const params = { + label: this.chartTranslation.translate(labelKey), + labelAlignment: "left", + labelWidth: "flex", + inputWidth: "flex", + value, + readOnly: options?.readOnly, + passive: options?.passive + }; + params.onValueChange = (value2) => { + this.chartOptionsProxy.setValue(expression, typeof value2 === "boolean" ? value2 : void 0); + }; + return params; + } + getDefaultSelectParams(expression, labelKey, dropdownOptions) { + return this.getDefaultSelectParamsWithoutValueParams( + labelKey, + dropdownOptions, + this.chartOptionsProxy.getValue(expression), + (value) => { + this.chartOptionsProxy.setValue(expression, value); + } + ); + } + getDefaultSelectParamsWithoutValueParams(labelKey, options, value, onValueChange) { + return { + label: this.chartTranslation.translate(labelKey), + labelAlignment: "top", + options, + pickerGap: 6, + value, + onValueChange + }; + } + getDefaultFontPanelParams(expression, labelKey) { + const keyMapper = (key) => `${expression}.${key}`; + return this.addEnableParams(keyMapper("enabled"), { + name: this.chartTranslation.translate(labelKey), + suppressEnabledCheckbox: false, + chartMenuParamsFactory: this, + keyMapper + }); + } + addValueParams(expression, params, options) { + const optionsValue = this.chartOptionsProxy.getValue(expression); + params.value = options?.formatInputValue ? options.formatInputValue(optionsValue) : optionsValue; + params.onValueChange = (value) => { + const optionsValue2 = options?.parseInputValue ? options.parseInputValue(value) : value; + this.chartOptionsProxy.setValue(expression, optionsValue2); + }; + return params; + } + addEnableParams(expression, params) { + params.enabled = this.chartOptionsProxy.getValue(expression) ?? false; + params.onEnableChange = (value) => this.chartOptionsProxy.setValue(expression, value); + return params; + } + getChartOptions() { + return this.chartOptionsProxy; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/chartSpecificDataPanel.ts +var ChartSpecificDataPanel = class extends Component66 { + constructor(chartMenuContext, isOpen) { + super(); + this.chartMenuContext = chartMenuContext; + this.isOpen = isOpen; + this.chartSpecificGroup = RefPlaceholder52; + this.hasContent = false; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + this.chartSvc = beans.chartSvc; + } + postConstruct() { + const title = this.getTitle(); + const chartSpecificGroupParams = { + title, + enabled: true, + suppressEnabledCheckbox: true, + suppressOpenCloseIcons: false, + cssIdentifier: "charts-data", + expanded: this.isOpen, + items: [...this.createDirectionSelect(), this.createReverseSelect(), this.createGroupTypeSelect()] + }; + this.setTemplate( + /* html */ + ` +
+ +
`, + [AgGroupComponentSelector], + { + chartSpecificGroup: chartSpecificGroupParams + } + ); + this.setDisplayed(this.hasContent); + } + refresh() { + this.hasContent = false; + this.chartSpecificGroup.setTitle(this.getTitle()); + this.updateDirectionSelect(); + this.updateReverseSelect(); + this.updateGroupTypeSelect(); + this.setDisplayed(this.hasContent); + } + getTitle() { + const chartType = this.chartMenuContext.chartController.getChartType(); + return this.chartTranslation.translate(getFullChartNameTranslationKey(chartType)); + } + createDirectionSelect() { + if (!this.chartSvc.isEnterprise()) { + return []; + } + const { chartOptionsService, chartController } = this.chartMenuContext; + const chartOptionsSeriesProxy = chartOptionsService.getSeriesOptionsProxy( + () => getSeriesType(chartController.getChartType()) + ); + const chartSeriesMenuParamsFactory = this.createManagedBean( + new ChartMenuParamsFactory(chartOptionsSeriesProxy) + ); + const options = ["horizontal", "vertical"].map((value) => ({ + value, + text: this.chartTranslation.translate(value) + })); + const params = chartSeriesMenuParamsFactory.getDefaultSelectParams("direction", "direction", options); + const onValueChange = params.onValueChange; + params.onValueChange = (value) => { + onValueChange(value); + chartController.raiseChartModelUpdateEvent(); + }; + this.directionSelect = this.createManagedBean(new AgSelect5(params)); + this.updateDirectionSelect(); + return [this.directionSelect]; + } + createReverseSelect() { + const { chartMenuParamsFactory } = this.chartMenuContext; + const params = chartMenuParamsFactory.getDefaultToggleParams("series.reverse", "reverse"); + this.reverseToggle = this.createManagedBean(new AgToggleButton3(params)); + this.updateReverseSelect(); + return this.reverseToggle; + } + updateReverseSelect() { + const isDisplayed = this.chartMenuContext.chartController.getChartType() === "pyramid"; + this.updateDisplayed(this.reverseToggle, isDisplayed); + } + updateDirectionSelect() { + const isDisplayed = canSwitchDirection(this.chartMenuContext.chartController.getChartType()); + this.updateDisplayed(this.directionSelect, isDisplayed); + } + createGroupTypeSelect() { + const { chartController, chartMenuParamsFactory } = this.chartMenuContext; + this.groupTypeSelect = this.createManagedBean( + new AgSelect5( + chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams( + "seriesGroupType", + SERIES_GROUP_TYPES.map((value) => ({ + value, + text: this.chartTranslation.translate(`${value}SeriesGroupType`) + })), + chartController.getSeriesGroupType(), + (value) => chartController.setSeriesGroupType(value) + ) + ) + ); + this.updateGroupTypeSelect(); + return this.groupTypeSelect; + } + updateGroupTypeSelect() { + const isDisplayed = ["radialColumn", "radialBar", "nightingale"].includes( + this.chartMenuContext.chartController.getChartType() + ); + this.updateDisplayed(this.groupTypeSelect, isDisplayed); + } + updateDisplayed(select, isDisplayed) { + select?.setDisplayed(isDisplayed); + if (select) { + this.hasContent = this.hasContent || isDisplayed; + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/seriesChartTypePanel.ts +import { AgCheckbox, AgSelect as AgSelect6, Component as Component67, _areEqual as _areEqual7, _clearElement as _clearElement21 } from "ag-grid-community"; +var SeriesChartTypePanel = class extends Component67 { + constructor(chartController, columns, isOpen) { + super( + /* html */ + `
` + ); + this.chartController = chartController; + this.columns = columns; + this.isOpen = isOpen; + this.selectedColIds = []; + this.chartTypeComps = /* @__PURE__ */ new Map(); + this.secondaryAxisComps = /* @__PURE__ */ new Map(); + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + this.createSeriesChartTypeGroup(this.columns); + } + refresh(columns) { + if (!_areEqual7(this.getValidColIds(columns), this.selectedColIds)) { + this.recreate(columns); + } else { + this.refreshComps(); + } + } + recreate(columns) { + this.isOpen = this.seriesChartTypeGroupComp.isExpanded(); + _clearElement21(this.getGui()); + this.destroyBean(this.seriesChartTypeGroupComp); + this.columns = columns; + this.selectedColIds = []; + this.clearComps(); + this.postConstruct(); + } + getValidColIds(columns) { + const seriesChartTypes = this.chartController.getSeriesChartTypes(); + return columns.filter((col) => col.selected && !!seriesChartTypes.filter((s2) => s2.colId === col.colId)[0]).map(({ colId }) => colId); + } + createSeriesChartTypeGroup(columns) { + this.seriesChartTypeGroupComp = this.createBean( + new AgGroupComponent({ + title: this.chartTranslation.translate("seriesChartType"), + enabled: true, + suppressEnabledCheckbox: true, + suppressOpenCloseIcons: false, + cssIdentifier: "charts-data", + expanded: this.isOpen + }) + ); + const seriesChartTypes = this.chartController.getSeriesChartTypes(); + for (const col of columns) { + if (!col.selected) { + continue; + } + const seriesChartType = seriesChartTypes.filter((s2) => s2.colId === col.colId)[0]; + if (!seriesChartType) { + continue; + } + this.selectedColIds.push(col.colId); + const seriesItemGroup = this.seriesChartTypeGroupComp.createManagedBean( + new AgGroupComponent({ + title: col.displayName, + enabled: true, + suppressEnabledCheckbox: true, + suppressOpenCloseIcons: true, + cssIdentifier: "charts-format-sub-level" + }) + ); + const isSecondaryAxisDisabled = (chartType) => ["groupedColumn", "stackedColumn", "stackedArea"].includes(chartType); + const secondaryAxisComp = this.seriesChartTypeGroupComp.createManagedBean( + new AgCheckbox({ + label: this.chartTranslation.translate("secondaryAxis"), + labelWidth: "flex", + disabled: isSecondaryAxisDisabled(seriesChartType.chartType), + value: !!seriesChartType.secondaryAxis, + onValueChange: (enabled) => this.chartController.updateSeriesChartType(col.colId, void 0, enabled) + }) + ); + seriesItemGroup.addItem(secondaryAxisComp); + const options = ["line", "area", "stackedArea", "groupedColumn", "stackedColumn"].map( + (value) => ({ + value, + text: this.chartTranslation.translate(getFullChartNameTranslationKey(value)) + }) + ); + const chartTypeComp = seriesItemGroup.createManagedBean( + new AgSelect6({ + options, + value: seriesChartType.chartType, + onValueChange: (chartType) => this.chartController.updateSeriesChartType(col.colId, chartType) + }) + ); + seriesItemGroup.addItem(chartTypeComp); + this.seriesChartTypeGroupComp.addItem(seriesItemGroup); + this.chartTypeComps.set(col.colId, chartTypeComp); + this.secondaryAxisComps.set(col.colId, secondaryAxisComp); + } + this.getGui().appendChild(this.seriesChartTypeGroupComp.getGui()); + } + refreshComps() { + const seriesChartTypes = this.chartController.getSeriesChartTypes(); + for (const colId of this.selectedColIds) { + const seriesChartType = seriesChartTypes.find((chartType) => chartType.colId === colId); + if (!seriesChartType) { + continue; + } + const chartTypeComp = this.chartTypeComps.get(colId); + const secondaryAxisComp = this.secondaryAxisComps.get(colId); + chartTypeComp?.setValue(seriesChartType.chartType); + secondaryAxisComp?.setValue(!!seriesChartType.secondaryAxis); + secondaryAxisComp?.setDisabled(this.isSecondaryAxisDisabled(seriesChartType.chartType)); + } + } + clearComps() { + this.chartTypeComps.clear(); + this.secondaryAxisComps.clear(); + } + isSecondaryAxisDisabled(chartType) { + return ["groupedColumn", "stackedColumn", "stackedArea"].includes(chartType); + } + destroy() { + this.clearComps(); + this.seriesChartTypeGroupComp = this.destroyBean(this.seriesChartTypeGroupComp); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/seriesDataPanel.ts +import { AgToggleButton as AgToggleButton4 } from "ag-grid-community"; +var SeriesDataPanel = class extends DragDataPanel { + constructor(chartController, chartOptionsService, title, allowMultipleSelect, maxSelection, valueCols, isOpen) { + super( + chartController, + allowMultipleSelect, + maxSelection, + /* html */ + `
` + ); + this.chartOptionsService = chartOptionsService; + this.title = title; + this.valueCols = valueCols; + this.isOpen = isOpen; + } + postConstruct() { + this.groupComp = this.createBean( + new AgGroupComponent({ + title: this.title, + enabled: true, + suppressEnabledCheckbox: true, + suppressOpenCloseIcons: false, + cssIdentifier: "charts-data", + expanded: this.isOpen + }) + ); + if (this.chartController.isActiveXYChart()) { + const pairedModeToggle = this.groupComp.createManagedBean( + new AgToggleButton4({ + label: this.chartTranslation.translate("paired"), + labelAlignment: "left", + labelWidth: "flex", + inputWidth: "flex", + value: this.chartOptionsService.getPairedMode(), + onValueChange: (newValue) => { + this.chartOptionsService.setPairedMode(!!newValue); + this.chartController.updateForGridChange({ maintainColState: true }); + } + }) + ); + this.groupComp.addItem(pairedModeToggle); + } + this.createGroup(this.valueCols, this.generateGetSeriesLabel(this.valueCols), "seriesAdd", "seriesSelect"); + this.getGui().appendChild(this.groupComp.getGui()); + } + refresh(valueCols) { + this.valuePillSelect?.setValueFormatter(this.generateGetSeriesLabel(valueCols)); + this.valuePillSelect?.setValues( + valueCols, + valueCols.filter((col) => col.selected) + ); + this.refreshValueSelect(valueCols); + } + generateGetSeriesLabel(valueCols) { + if (!this.chartController.isActiveXYChart()) { + return (col) => col.displayName ?? ""; + } + const selectedCols = valueCols.filter((col) => col.selected); + const isBubble = this.chartController.getChartType() === "bubble"; + const isInPairedMode = this.chartOptionsService.getPairedMode(); + const indexToAxisLabel = /* @__PURE__ */ new Map(); + indexToAxisLabel.set(0, "X"); + indexToAxisLabel.set(1, "Y"); + indexToAxisLabel.set(2, "size"); + return (col) => { + const escapedLabel = col.displayName ?? ""; + if (!col.selected) { + return escapedLabel; + } + const index = selectedCols.indexOf(col); + if (index === -1) { + return escapedLabel; + } + let axisLabel; + if (isInPairedMode) { + axisLabel = indexToAxisLabel.get(index % (isBubble ? 3 : 2)); + } else if (index === 0) { + axisLabel = "X"; + } else { + axisLabel = isBubble && index % 2 === 0 ? "size" : "Y"; + } + return `${escapedLabel} (${axisLabel})`; + }; + } + destroy() { + this.groupComp = this.destroyBean(this.groupComp); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/data/chartDataPanel.ts +var DefaultDataPanelDef = { + groups: [ + { type: "categories", isOpen: true }, + { type: "series", isOpen: true }, + { type: "seriesChartType", isOpen: true }, + { type: "chartSpecific", isOpen: true } + ] +}; +var ChartDataPanel = class extends Component68 { + constructor(chartMenuContext) { + super( + /* html */ + `
` + ); + this.chartMenuContext = chartMenuContext; + this.isSwitchCategorySeriesToggled = false; + this.restoreSwitchCategorySeriesToggleFocus = false; + this.panels = []; + this.chartController = chartMenuContext.chartController; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + this.chartSvc = beans.chartSvc; + } + postConstruct() { + this.createSwitchCategorySeriesToggle(); + this.isSwitchCategorySeriesToggled = this.chartController.isCategorySeriesSwitched(); + this.updatePanels(); + const listener = this.updatePanels.bind(this); + this.addManagedListeners(this.chartController, { + chartModelUpdate: listener, + chartApiUpdate: listener + }); + } + destroy() { + this.clearPanelComponents(); + super.destroy(); + } + updatePanels() { + const currentChartType = this.chartType; + const isSwitchCategorySeriesToggledCurrent = this.isSwitchCategorySeriesToggled; + const { dimensionCols, valueCols } = this.chartController.getColStateForMenu(); + this.chartType = this.chartController.getChartType(); + this.isSwitchCategorySeriesToggled = this.chartController.isCategorySeriesSwitched(); + const hasChangedSwitchCategorySeries = this.isSwitchCategorySeriesToggled !== isSwitchCategorySeriesToggledCurrent; + if (this.canRefresh(currentChartType, this.chartType) && !hasChangedSwitchCategorySeries) { + this.categoriesDataPanel?.refresh(dimensionCols); + this.seriesDataPanel?.refresh(valueCols); + this.seriesChartTypePanel?.refresh(valueCols); + this.chartSpecificPanel?.refresh(); + } else { + this.recreatePanels(dimensionCols, valueCols); + } + const isSwitchCategorySeriesDisplayed = supportsInvertedCategorySeries(this.chartType) && this.chartSvc.isEnterprise() && !this.chartController.isGrouping(); + _setDisplayed24(this.switchCategorySeriesToggle.getGui(), isSwitchCategorySeriesDisplayed); + if (hasChangedSwitchCategorySeries) { + this.switchCategorySeriesToggle?.setValue(this.chartController.isCategorySeriesSwitched()); + } + if (this.restoreSwitchCategorySeriesToggleFocus) { + this.restoreSwitchCategorySeriesToggleFocus = false; + if (isSwitchCategorySeriesDisplayed) { + this.switchCategorySeriesToggle.getFocusableElement().focus(); + } + } + } + canRefresh(oldChartType, newChartType) { + if (oldChartType === void 0) { + return false; + } + if (oldChartType === newChartType) { + return true; + } + const isCombo = (chartType) => ["columnLineCombo", "areaColumnCombo", "customCombo"].includes(chartType); + if (isCombo(oldChartType) && isCombo(newChartType)) { + return true; + } + return false; + } + recreatePanels(dimensionCols, valueCols) { + this.clearPanelComponents(); + const { chartType } = this; + if (!chartType) { + return; + } + const isCategorySeriesSwitched = this.chartController.isCategorySeriesSwitched(); + this.getDataPanelDef().groups?.forEach(({ type, isOpen }) => { + if (type === (isCategorySeriesSwitched ? "series" : "categories")) { + this.categoriesDataPanel = this.createBean( + new CategoriesDataPanel( + this.chartController, + this.getCategoryGroupTitle(isCategorySeriesSwitched), + this.getCategoryGroupMultipleSelect(chartType, isCategorySeriesSwitched), + dimensionCols, + isOpen + ) + ); + this.panels.push(this.categoriesDataPanel); + } else if (type === (isCategorySeriesSwitched ? "categories" : "series")) { + this.seriesDataPanel = this.createBean( + new SeriesDataPanel( + this.chartController, + this.chartMenuContext.chartOptionsService, + this.getSeriesGroupTitle(isCategorySeriesSwitched), + this.getSeriesGroupMultipleSelect(chartType, isCategorySeriesSwitched), + this.getSeriesGroupMaxSelection(chartType, isCategorySeriesSwitched), + valueCols, + isOpen + ) + ); + this.panels.push(this.seriesDataPanel); + } else if (type === "seriesChartType") { + if (this.chartController.isComboChart()) { + this.seriesChartTypePanel = this.createBean( + new SeriesChartTypePanel(this.chartController, valueCols, isOpen) + ); + this.panels.push(this.seriesChartTypePanel); + } + } else if (type === "chartSpecific") { + this.chartSpecificPanel = this.createBean(new ChartSpecificDataPanel(this.chartMenuContext, isOpen)); + this.panels.push(this.chartSpecificPanel); + } else { + _warn63(144, { type }); + } + }); + (isCategorySeriesSwitched ? this.categoriesDataPanel : this.seriesDataPanel)?.addItem( + this.switchCategorySeriesToggle.getGui() + ); + this.addPanelComponents(); + } + addPanelComponents() { + if (!this.panels.length) { + return; + } + const eDocument = _getDocument7(this.beans); + const fragment = eDocument.createDocumentFragment(); + for (const panel of this.panels) { + panel.addCss("ag-chart-data-section"); + fragment.appendChild(panel.getGui()); + } + this.getGui().appendChild(fragment); + } + clearPanelComponents() { + for (const panel of this.panels) { + panel.getGui().remove(); + this.destroyBean(panel); + } + this.panels = []; + } + getDataPanelDef() { + return this.gos.get("chartToolPanelsDef")?.dataPanel ?? DefaultDataPanelDef; + } + getCategoryGroupTitle(isCategorySeriesSwitched) { + if (isCategorySeriesSwitched) { + return this.chartTranslation.translate("seriesLabels"); + } + return this.chartTranslation.translate(this.chartController.isActiveXYChart() ? "labels" : "categories"); + } + getCategoryGroupMultipleSelect(chartType, isCategorySeriesSwitched) { + if (isCategorySeriesSwitched) { + return false; + } + return getMaxNumCategories(chartType) !== 1; + } + getSeriesGroupTitle(isCategorySeriesSwitched) { + if (isCategorySeriesSwitched) { + return this.chartTranslation.translate("categoryValues"); + } + return this.chartTranslation.translate(this.chartController.isActiveXYChart() ? "xyValues" : "series"); + } + getSeriesGroupMultipleSelect(chartType, isCategorySeriesSwitched) { + return this.getSeriesGroupMaxSelection(chartType, isCategorySeriesSwitched) !== 1; + } + getSeriesGroupMaxSelection(chartType, isCategorySeriesSwitched) { + if (isCategorySeriesSwitched) { + return void 0; + } + return getMaxNumSeries(chartType); + } + createSwitchCategorySeriesToggle() { + this.switchCategorySeriesToggle = this.createManagedBean( + new AgToggleButton5({ + label: this.chartTranslation.translate("switchCategorySeries"), + labelAlignment: "left", + labelWidth: "flex", + inputWidth: "flex", + value: this.chartController.isCategorySeriesSwitched(), + onValueChange: (value) => { + this.restoreSwitchCategorySeriesToggleFocus = true; + this.chartController.switchCategorySeries(value); + } + }) + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/formatPanel.ts +import { Component as Component91, _warn as _warn64 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/axis/cartesianAxisPanel.ts +import { + AgCheckbox as AgCheckbox2, + AgSelectSelector as AgSelectSelector3, + Component as Component72, + RefPlaceholder as RefPlaceholder56, + _removeFromParent as _removeFromParent14, + _setDisplayed as _setDisplayed25 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/widgets/agAngleSelect.ts +import { + AgAbstractLabel as AgAbstractLabel2, + AgInputNumberFieldSelector as AgInputNumberFieldSelector3, + RefPlaceholder as RefPlaceholder53, + _exists as _exists28, + _getActiveDomElement as _getActiveDomElement16, + _setFixedWidth +} from "ag-grid-community"; +var AgAngleSelect = class extends AgAbstractLabel2 { + constructor(config) { + super( + config, + /* html */ + `
+
+
+
+
+
+
+
+ +
+
`, + [AgInputNumberFieldSelector3] + ); + this.eLabel = RefPlaceholder53; + this.eParentCircle = RefPlaceholder53; + this.eChildCircle = RefPlaceholder53; + this.eAngleValue = RefPlaceholder53; + this.radius = 0; + this.offsetX = 0; + this.offsetY = 0; + } + wireBeans(beans) { + this.dragSvc = beans.dragSvc; + } + postConstruct() { + super.postConstruct(); + const { value, onValueChange } = this.config; + if (value != null) { + this.setValue(value, void 0, true); + } + if (onValueChange != null) { + this.onValueChange(onValueChange); + } + this.dragListener = { + eElement: this.eParentCircle, + dragStartPixels: 0, + onDragStart: () => { + this.parentCircleRect = this.eParentCircle.getBoundingClientRect(); + }, + onDragging: (e) => this.calculateAngleDrag(e), + onDragStop: () => { + } + }; + this.dragSvc?.addDragSource(this.dragListener); + this.eAngleValue.setLabel("").setLabelWidth(5).setInputWidth(45).setMin(0).setMax(360).setValue(`${this.degrees}`).onValueChange((value2) => { + if (value2 == null || value2 === "") { + value2 = "0"; + } + value2 = this.eAngleValue.normalizeValue(value2); + let floatValue = parseFloat(value2); + if (floatValue > 180) { + floatValue = floatValue - 360; + } + this.setValue(floatValue); + }); + this.updateNumberInput(); + if (_exists28(this.getValue())) { + this.eAngleValue.setValue(this.normalizeNegativeValue(this.getValue()).toString()); + } + this.addManagedListeners(this, { + fieldValueChanged: () => { + if (this.eAngleValue.getInputElement().contains(_getActiveDomElement16(this.beans))) { + return; + } + this.updateNumberInput(); + } + }); + } + updateNumberInput() { + const normalizedValue = this.normalizeNegativeValue(this.getValue()); + this.eAngleValue.setValue(normalizedValue.toString()); + } + positionChildCircle(radians) { + const rect = this.parentCircleRect || { width: 24, height: 24 }; + const eChildCircle = this.eChildCircle; + const centerX = rect.width / 2; + const centerY = rect.height / 2; + eChildCircle.style.left = `${centerX + Math.cos(radians) * 8}px`; + eChildCircle.style.top = `${centerY + Math.sin(radians) * 8}px`; + } + calculatePolar() { + const x = this.offsetX; + const y = this.offsetY; + const radians = Math.atan2(y, x); + this.degrees = this.toDegrees(radians); + this.radius = Math.sqrt(x * x + y * y); + this.positionChildCircle(radians); + } + calculateCartesian() { + const radians = this.toRadians(this.getValue()); + const radius = this.getRadius(); + this.setOffsetX(Math.cos(radians) * radius).setOffsetY(Math.sin(radians) * radius); + } + setOffsetX(offset) { + if (this.offsetX !== offset) { + this.offsetX = offset; + this.calculatePolar(); + } + return this; + } + setOffsetY(offset) { + if (this.offsetY !== offset) { + this.offsetY = offset; + this.calculatePolar(); + } + return this; + } + calculateAngleDrag(e) { + const rect = this.parentCircleRect; + const centerX = rect.width / 2; + const centerY = rect.height / 2; + const x = e.clientX - rect.left; + const y = e.clientY - rect.top; + const dx = x - centerX; + const dy = y - centerY; + const radians = Math.atan2(dy, dx); + this.setValue(radians, true); + } + toDegrees(radians) { + return radians / Math.PI * 180; + } + toRadians(degrees) { + return degrees / 180 * Math.PI; + } + normalizeNegativeValue(degrees) { + return degrees < 0 ? 360 + degrees : degrees; + } + normalizeAngle180(radians) { + radians %= Math.PI * 2; + if (radians < -Math.PI) { + radians += Math.PI * 2; + } else if (radians >= Math.PI) { + radians -= Math.PI * 2; + } + return radians; + } + getRadius() { + return this.radius; + } + setRadius(r) { + if (this.radius === r) { + return this; + } + this.radius = r; + this.calculateCartesian(); + return this; + } + onValueChange(callbackFn) { + this.addManagedListeners(this, { + fieldValueChanged: () => { + callbackFn(this.degrees); + } + }); + return this; + } + getValue(radians) { + return radians ? this.toRadians(this.degrees) : this.degrees; + } + setValue(degrees, radians, silent) { + let radiansValue; + if (!radians) { + radiansValue = this.normalizeAngle180(this.toRadians(degrees)); + } else { + radiansValue = degrees; + } + degrees = this.toDegrees(radiansValue); + if (this.degrees !== degrees) { + this.degrees = Math.floor(degrees); + this.calculateCartesian(); + this.positionChildCircle(radiansValue); + if (!silent) { + this.dispatchLocalEvent({ type: "fieldValueChanged" }); + } + } + return this; + } + setWidth(width) { + _setFixedWidth(this.getGui(), width); + return this; + } + setDisabled(disabled) { + super.setDisabled(disabled); + this.eAngleValue.setDisabled(disabled); + return this; + } + destroy() { + this.dragSvc?.removeDragSource(this.dragListener); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/fontPanel.ts +import { AgSelectSelector as AgSelectSelector2, Component as Component69, RefPlaceholder as RefPlaceholder54, _removeFromParent as _removeFromParent13 } from "ag-grid-community"; +function _capitalise(str) { + return str[0].toUpperCase() + str.substring(1).toLowerCase(); +} +var FontPanel = class extends Component69 { + constructor(params) { + super(); + this.params = params; + this.fontGroup = RefPlaceholder54; + this.activeComps = []; + this.chartOptions = params.chartMenuParamsFactory.getChartOptions(); + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { + cssIdentifier = "charts-format-sub-level", + name: title, + enabled, + onEnableChange, + suppressEnabledCheckbox, + chartMenuParamsFactory, + keyMapper + } = this.params; + const fontGroupParams = { + cssIdentifier, + direction: "vertical", + suppressOpenCloseIcons: true, + title, + enabled, + suppressEnabledCheckbox: true, + onEnableChange: (enabled2) => { + if (onEnableChange) { + onEnableChange(enabled2); + } + }, + useToggle: !suppressEnabledCheckbox + }; + this.setTemplate( + /* html */ + `
+ + + +
+ + +
+
+
`, + [AgGroupComponentSelector, AgSelectSelector2, ColorPickerSelector], + { + fontGroup: fontGroupParams, + familySelect: this.getFamilySelectParams(), + weightStyleSelect: this.getWeightStyleSelectParams(), + sizeSelect: this.getSizeSelectParams(), + colorPicker: chartMenuParamsFactory.getDefaultColorPickerParams(keyMapper("color")) + } + ); + this.toggleCss("ag-font-panel-no-header", !title); + } + addItem(comp, prepend) { + if (prepend) { + this.fontGroup.prependItem(comp); + } else { + this.fontGroup.addItem(comp); + } + this.activeComps.push(comp); + } + setEnabled(enabled) { + this.fontGroup.setEnabled(enabled); + } + getFamilySelectParams() { + const families = [ + "Arial, sans-serif", + "Aria Black, sans-serif", + "Book Antiqua, serif", + "Charcoal, sans-serif", + "Comic Sans MS, cursive", + "Courier, monospace", + "Courier New, monospace", + "Gadget, sans-serif", + "Geneva, sans-serif", + "Helvetica, sans-serif", + "Impact, sans-serif", + "Lucida Console, monospace", + "Lucida Grande, sans-serif", + "Lucida Sans Unicode, sans-serif", + "Monaco, monospace", + "Palatino Linotype, serif", + "Palatino, serif", + "Times New Roman, serif", + "Times, serif", + "Verdana, sans-serif" + ]; + const family = this.getInitialFontValue("fontFamily"); + let initialValue = families[0]; + if (family) { + const lowerCaseValues = families.map((f) => f.toLowerCase()); + const valueIndex = lowerCaseValues.indexOf(family.toLowerCase()); + if (valueIndex >= 0) { + initialValue = families[valueIndex]; + } else { + const capitalisedFontValue = _capitalise(family); + families.push(capitalisedFontValue); + initialValue = capitalisedFontValue; + } + } + const options = families.sort().map((value) => ({ value, text: value })); + return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams( + "font", + options, + `${initialValue}`, + (newValue) => this.setFont({ fontFamily: newValue }) + ); + } + getSizeSelectParams() { + const sizes = [8, 10, 12, 14, 16, 18, 20, 22, 24, 26, 28, 30, 32, 34, 36]; + const size = this.getInitialFontValue("fontSize"); + if (!sizes.includes(size)) { + sizes.push(size); + } + const options = sizes.sort((a, b) => a - b).map((value) => ({ value: `${value}`, text: `${value}` })); + return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams( + "size", + options, + `${size}`, + (newValue) => this.setFont({ fontSize: parseInt(newValue, 10) }) + ); + } + getWeightStyleSelectParams() { + const weight = this.getInitialFontValue("fontWeight") ?? "normal"; + const style = this.getInitialFontValue("fontStyle") ?? "normal"; + const weightStyles = [ + { name: "normal", weight: "normal", style: "normal" }, + { name: "bold", weight: "bold", style: "normal" }, + { name: "italic", weight: "normal", style: "italic" }, + { name: "boldItalic", weight: "bold", style: "italic" } + ]; + let selectedOption = weightStyles.find((x) => x.weight === weight && x.style === style); + if (!selectedOption) { + selectedOption = { name: "predefined", weight, style }; + weightStyles.unshift(selectedOption); + } + const options = weightStyles.map((ws) => ({ + value: ws.name, + text: this.chartTranslation.translate(ws.name) + })); + return this.params.chartMenuParamsFactory.getDefaultSelectParamsWithoutValueParams( + "weight", + options, + selectedOption.name, + (newValue) => { + const selectedWeightStyle = weightStyles.find((x) => x.name === newValue); + this.setFont({ fontWeight: selectedWeightStyle.weight, fontStyle: selectedWeightStyle.style }); + } + ); + } + destroyActiveComps() { + for (const comp of this.activeComps) { + _removeFromParent13(comp.getGui()); + this.destroyBean(comp); + } + } + destroy() { + this.destroyActiveComps(); + super.destroy(); + } + setFont(font) { + const { keyMapper } = this.params; + for (const fontKey of Object.keys(font)) { + const value = font[fontKey]; + if (value) { + this.chartOptions.setValue(keyMapper(fontKey), value); + } + } + } + getInitialFontValue(fontKey) { + const { keyMapper } = this.params; + return this.chartOptions.getValue(keyMapper(fontKey)); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/axis/axisTicksPanel.ts +import { Component as Component70, RefPlaceholder as RefPlaceholder55 } from "ag-grid-community"; +var AxisTicksPanel = class extends Component70 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + this.axisTicksSizeSlider = RefPlaceholder55; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { chartMenuUtils } = this; + const axisTicksGroupParams = chartMenuUtils.addEnableParams("tick.enabled", { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("ticks"), + suppressEnabledCheckbox: true, + useToggle: true + }); + const axisTicksColorPickerParams = chartMenuUtils.getDefaultColorPickerParams("tick.stroke"); + const axisTicksWidthSliderParams = chartMenuUtils.getDefaultSliderParams("tick.width", "width", 10); + const axisTicksSizeSliderParams = chartMenuUtils.getDefaultSliderParams("tick.size", "length", 30); + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + axisTicksGroup: axisTicksGroupParams, + axisTicksColorPicker: axisTicksColorPickerParams, + axisTicksWidthSlider: axisTicksWidthSliderParams, + axisTicksSizeSlider: axisTicksSizeSliderParams + } + ); + } + setTickSizeSliderDisplayed(displayed) { + this.axisTicksSizeSlider.setDisplayed(displayed); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/axis/gridLinePanel.ts +import { Component as Component71 } from "ag-grid-community"; +var GridLinePanel = class extends Component71 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + this.chartOptions = chartMenuUtils.getChartOptions(); + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const gridLineGroupParams = this.chartMenuUtils.addEnableParams("gridLine.enabled", { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("gridLines"), + suppressEnabledCheckbox: true, + useToggle: true + }); + const gridLineColorPickerParams = this.getGridLineColorPickerParams("color"); + const gridLineWidthSliderParams = this.getGridLineWidthSliderParams("thickness"); + const gridLineLineDashSliderParams = this.getGridLineDashSliderParams("lineDash"); + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + gridLineGroup: gridLineGroupParams, + gridLineColorPicker: gridLineColorPickerParams, + gridLineWidthSlider: gridLineWidthSliderParams, + gridLineLineDashSlider: gridLineLineDashSliderParams + } + ); + } + getGridLineColorPickerParams(labelKey) { + return this.chartMenuUtils.getDefaultColorPickerParams("gridLine.style", labelKey, { + formatInputValue: (value) => { + return value?.[0]?.stroke; + }, + parseInputValue: (value) => { + const styles = this.chartOptions.getValue("gridLine.style") ?? []; + if (styles.length === 0) { + return [{ stroke: value, lineDash: [] }]; + } + return [{ ...styles[0], stroke: value }]; + } + }); + } + getGridLineWidthSliderParams(labelKey) { + return this.chartMenuUtils.getDefaultSliderParams("gridLine.width", labelKey, 10); + } + getGridLineDashSliderParams(labelKey) { + const initialStyles = this.chartOptions.getValue("gridLine.style"); + const initialValue = initialStyles?.[0]?.lineDash?.[0]; + const params = this.chartMenuUtils.getDefaultSliderParamsWithoutValueParams(initialValue ?? 0, labelKey, 30); + params.onValueChange = (value) => { + const stroke = this.chartOptions.getValue("gridLine.style.0.stroke"); + this.chartOptions.setValue("gridLine.style", [ + { lineDash: [value], stroke } + ]); + }; + return params; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/axis/cartesianAxisPanel.ts +var DEFAULT_TIME_AXIS_FORMAT = "%d %B %Y"; +var CartesianAxisPanel = class extends Component72 { + constructor(axisType, options) { + super(); + this.axisType = axisType; + this.options = options; + this.axisGroup = RefPlaceholder56; + this.axisTypeSelect = RefPlaceholder56; + this.axisPositionSelect = RefPlaceholder56; + this.axisTimeFormatSelect = RefPlaceholder56; + this.activePanels = []; + this.updateFuncs = []; + const { chartOptionsService, seriesType, chartController } = options; + this.chartOptionsService = chartOptionsService; + this.chartController = chartController; + this.chartOptionsSeriesProxy = chartOptionsService.getSeriesOptionsProxy(() => seriesType); + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { isExpandedOnInit: expanded, chartOptionsService, registerGroupComponent } = this.options; + const labelKey = this.axisType; + const axisGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.translate(labelKey), + expanded, + suppressEnabledCheckbox: true + }; + const chartAxisOptionsProxy = chartOptionsService.getCartesianAxisOptionsProxy(this.axisType); + const chartAxisOptions = this.createManagedBean(new ChartMenuParamsFactory(chartAxisOptionsProxy)); + const chartAxisThemeOverrides = this.createManagedBean( + new ChartMenuParamsFactory(chartOptionsService.getCartesianAxisThemeOverridesProxy(this.axisType)) + ); + const axisTypeSelectParams = this.getAxisTypeSelectParams( + chartAxisOptions, + chartOptionsService.getCartesianAxisAppliedThemeOverridesProxy(this.axisType) + ); + const axisPositionSelectParams = this.getAxisPositionSelectParams(chartAxisOptions); + const axisTimeFormatSelectParams = this.getAxisTimeFormatSelectParams(chartAxisOptions); + const axisColorInputParams = this.getAxisColorInputParams(chartAxisThemeOverrides); + const axisLineWidthSliderParams = this.getAxisLineWidthSliderParams(chartAxisThemeOverrides); + this.setTemplate( + /* html */ + `
+ + + + + + + +
`, + [AgGroupComponentSelector, AgSelectSelector3, ColorPickerSelector, AgSliderSelector], + { + axisGroup: axisGroupParams, + axisTypeSelect: axisTypeSelectParams ?? void 0, + axisPositionSelect: axisPositionSelectParams ?? void 0, + axisTimeFormatSelect: axisTimeFormatSelectParams ?? void 0, + axisColorInput: axisColorInputParams, + axisLineWidthSlider: axisLineWidthSliderParams + } + ); + registerGroupComponent(this.axisGroup); + this.axisTypeSelect.setDisplayed(!!axisTypeSelectParams.options?.length); + if (!axisPositionSelectParams) { + this.removeTemplateComponent(this.axisPositionSelect); + } + const updateTimeFormatVisibility = () => { + const isTimeAxis = chartAxisOptionsProxy.getValue("type") === "time"; + _setDisplayed25(this.axisTimeFormatSelect.getGui(), isTimeAxis); + }; + if (!axisTimeFormatSelectParams) { + this.removeTemplateComponent(this.axisTimeFormatSelect); + } else { + updateTimeFormatVisibility(); + this.addManagedEventListeners({ + chartOptionsChanged: () => { + updateTimeFormatVisibility(); + } + }); + } + this.initGridLines(chartAxisThemeOverrides); + this.initAxisTicks(chartAxisThemeOverrides); + this.initAxisLabels(chartAxisThemeOverrides); + const updateFns = () => { + for (const func of this.updateFuncs) { + func(); + } + }; + this.addManagedListeners(this.chartController, { + chartUpdated: updateFns, + chartModelUpdate: () => setTimeout(() => { + if (!this.isAlive()) { + return; + } + this.refreshAxisTypeSelect(chartAxisOptions); + updateTimeFormatVisibility(); + }) + }); + } + getAxisTypeSelectParams(chartAxisOptions, chartAxisAppliedThemeOverrides) { + const chartOptions = chartAxisOptions.getChartOptions(); + const axisTypeSelectOptions = this.getAxisTypeSelectOptions(); + const params = chartAxisOptions.getDefaultSelectParams("type", "axisType", axisTypeSelectOptions); + params.onValueChange = (value) => { + const previousAxisType = chartOptions.getValue("type"); + if (value === previousAxisType) { + return; + } + const previousAxisThemeOverrides = chartAxisAppliedThemeOverrides.getValue("*"); + const previousAxisIsTimeAxis = previousAxisType === "time"; + const updatedAxisIsTimeAxis = value === "time"; + const updatedLabelFormat = previousAxisIsTimeAxis !== updatedAxisIsTimeAxis ? updatedAxisIsTimeAxis ? DEFAULT_TIME_AXIS_FORMAT : void 0 : null; + if (updatedLabelFormat === void 0) { + chartOptions.clearValue?.("label", "format"); + } + this.chartOptionsService.setCartesianCategoryAxisType(this.axisType, value); + if (updatedLabelFormat != null) { + chartOptions.setValue("label.format", updatedLabelFormat); + } + chartAxisAppliedThemeOverrides.setValue("*", previousAxisThemeOverrides); + }; + return params; + } + refreshAxisTypeSelect(chartAxisOptions) { + const options = this.getAxisTypeSelectOptions(); + const hasOptions = !!options.length; + this.axisTypeSelect.setDisplayed(hasOptions); + if (!hasOptions) { + return; + } + this.axisTypeSelect.clearOptions().addOptions(options).setValue(chartAxisOptions.getChartOptions().getValue("type")); + } + getAxisTypeSelectOptions() { + const controller = this.chartController; + const chartType = controller.getChartType(); + const supportsNumericalAxis = () => { + const testDatum = controller.getChartData()[0]; + if (!testDatum) { + return false; + } + return controller.getSelectedDimensions().every((col) => !isNaN(parseFloat(testDatum[col.colId]))); + }; + if (["heatmap", "histogram", "boxPlot", "rangeBar", "scatter", "bubble"].includes(chartType) || controller.isGrouping() || !this.isCategoryAxis() || controller.isCategorySeriesSwitched() || !supportsNumericalAxis()) { + return []; + } + return ["category", "number", "time"].map((value) => ({ + value, + text: this.translate(value) + })); + } + isCategoryAxis() { + const isHorizontal = this.chartOptionsSeriesProxy.getValue("direction") === "horizontal"; + return isHorizontal && this.axisType === "yAxis" || !isHorizontal && this.axisType === "xAxis"; + } + getAxisPositionSelectParams(chartAxisOptions) { + const axisPositionSelectOptions = ((chartType, axisType) => { + if (chartType === "heatmap") { + return null; + } + if (axisType === "xAxis") { + return [ + { value: "top", text: this.translate("top") }, + { value: "bottom", text: this.translate("bottom") } + ]; + } + if (axisType === "yAxis") { + return [ + { value: "left", text: this.translate("left") }, + { value: "right", text: this.translate("right") } + ]; + } + })(this.chartController.getChartType(), this.axisType); + if (!axisPositionSelectOptions) { + return null; + } + return chartAxisOptions.getDefaultSelectParams("position", "position", axisPositionSelectOptions); + } + getAxisTimeFormatSelectParams(chartAxisOptions) { + if (!this.isCategoryAxis()) { + return null; + } + const axisTimeFormatSelectOptions = [ + { value: "%d/%m/%Y", text: this.translate("timeFormatSlashesDDMMYYYY") }, + { value: "%m/%d/%Y", text: this.translate("timeFormatSlashesMMDDYYYY") }, + { value: "%d/%m/%y", text: this.translate("timeFormatSlashesDDMMYY") }, + { value: "%m/%d/%y", text: this.translate("timeFormatSlashesMMDDYY") }, + { value: "%d.%e.%y", text: this.translate("timeFormatDotsDDMYY") }, + { value: "%e.%d.%y", text: this.translate("timeFormatDotsMDDYY") }, + { value: "%Y-%m-%d", text: this.translate("timeFormatDashesYYYYMMDD") }, + { value: "%d %B %Y", text: this.translate("timeFormatSpacesDDMMMMYYYY") }, + { value: "%H:%M:%S", text: this.translate("timeFormatHHMMSS") }, + { value: "%I:%M:%S %p", text: this.translate("timeFormatHHMMSSAmPm") } + ]; + return chartAxisOptions.getDefaultSelectParams("label.format", "timeFormat", axisTimeFormatSelectOptions); + } + getAxisColorInputParams(chartAxisThemeOverrides) { + return chartAxisThemeOverrides.getDefaultColorPickerParams("line.stroke"); + } + getAxisLineWidthSliderParams(chartAxisThemeOverrides) { + const chartOptions = chartAxisThemeOverrides.getChartOptions(); + const getAxisLineWidth = () => { + const isAxisLineEnabled = chartOptions.getValue("line.enabled"); + if (!isAxisLineEnabled) { + return null; + } + return chartOptions.getValue("line.width"); + }; + const setAxisLineWidth = (value) => { + chartOptions.setValues([ + { expression: "line.enabled", value: value != null }, + { expression: "line.width", value: value ?? 0 } + ]); + }; + const axisLineWidthSliderParams = chartAxisThemeOverrides.getDefaultSliderParamsWithoutValueParams( + getAxisLineWidth() ?? 0, + "thickness", + 10 + ); + axisLineWidthSliderParams.onValueChange = (newValue) => { + setAxisLineWidth(newValue === 0 ? null : newValue); + }; + return axisLineWidthSliderParams; + } + initGridLines(chartAxisThemeOverrides) { + const chartType = this.chartController.getChartType(); + if (chartType === "heatmap") { + return; + } + const gridLineComp = this.createBean(new GridLinePanel(chartAxisThemeOverrides)); + this.axisGroup.addItem(gridLineComp); + this.activePanels.push(gridLineComp); + } + initAxisTicks(chartAxisThemeOverrides) { + if (!this.hasConfigurableAxisTicks()) { + return; + } + const axisTicksComp = this.createBean(new AxisTicksPanel(chartAxisThemeOverrides)); + this.axisGroup.addItem(axisTicksComp); + this.activePanels.push(axisTicksComp); + const updateTickFn = () => axisTicksComp.setTickSizeSliderDisplayed(this.isGroupedCategoryAxis()); + this.updateFuncs.push(updateTickFn); + updateTickFn(); + } + hasConfigurableAxisTicks() { + const chartType = this.chartController.getChartType(); + switch (chartType) { + case "radarLine": + case "radarArea": + case "rangeBar": + case "boxPlot": + case "waterfall": + return false; + default: + return true; + } + } + initAxisLabels(chartAxisThemeOverrides) { + const params = { + name: this.translate("labels"), + enabled: true, + suppressEnabledCheckbox: true, + chartMenuParamsFactory: chartAxisThemeOverrides, + keyMapper: (key) => `label.${key}` + }; + const labelPanelComp = this.createBean(new FontPanel(params)); + this.axisGroup.addItem(labelPanelComp); + this.activePanels.push(labelPanelComp); + this.addAdditionalLabelComps(labelPanelComp, chartAxisThemeOverrides); + } + addAdditionalLabelComps(labelPanelComp, chartAxisThemeOverrides) { + this.addLabelPadding(labelPanelComp, chartAxisThemeOverrides); + const rotationComp = this.createRotationWidget("labelRotation", chartAxisThemeOverrides); + const autoRotateCb = this.initLabelRotation(rotationComp, chartAxisThemeOverrides); + labelPanelComp.addItem(autoRotateCb); + labelPanelComp.addItem(rotationComp); + } + initLabelRotation(rotationComp, chartAxisThemeOverrides) { + const chartOptions = chartAxisThemeOverrides.getChartOptions(); + const getLabelRotationValue = () => { + return chartOptions.getValue("label.rotation"); + }; + const getLabelAutoRotateValue = () => { + return chartOptions.getValue("label.autoRotate"); + }; + const updateAutoRotate = (autoRotate2) => { + if (autoRotate2) { + this.prevRotation = getLabelRotationValue(); + } + chartOptions.setValues([ + { expression: "label.autoRotate", value: autoRotate2 }, + // Clear the rotation option when activating auto-rotate, reinstate the previous value when deactivating + { expression: "label.rotation", value: autoRotate2 ? void 0 : this.prevRotation } + ]); + rotationComp.setDisplayed(!autoRotate2); + }; + const rotation = getLabelRotationValue(); + const autoRotate = typeof rotation === "number" ? false : getLabelAutoRotateValue(); + const autoRotateCheckbox = this.createBean( + new AgCheckbox2({ + label: this.translate("autoRotate"), + value: autoRotate, + onValueChange: updateAutoRotate + }) + ); + rotationComp.setDisplayed(!autoRotate); + const autoRotateUpdateFn = () => autoRotateCheckbox.setDisplayed(this.isGroupedCategoryAxis()); + this.updateFuncs.push(autoRotateUpdateFn); + autoRotateUpdateFn(); + return autoRotateCheckbox; + } + createRotationWidget(labelKey, chartAxisThemeOverrides) { + const chartOptions = chartAxisThemeOverrides.getChartOptions(); + const getLabelRotationValue = () => { + return chartOptions.getValue("label.rotation"); + }; + const setLabelRotationValue = (value) => { + return chartOptions.setValue("label.rotation", value); + }; + const degreesSymbol = String.fromCharCode(176); + const label = `${this.chartTranslation.translate(labelKey)} ${degreesSymbol}`; + const angleSelect = new AgAngleSelect({ + label, + labelWidth: "flex", + value: getLabelRotationValue() ?? 0, + onValueChange: setLabelRotationValue + }); + this.updateFuncs.push(() => { + angleSelect.setValue(getLabelRotationValue() ?? 0); + }); + return this.createBean(angleSelect); + } + isGroupedCategoryAxis() { + const axisOptionsType = this.chartOptionsService.getCartesianAxisOptionsProxy(this.axisType).getValue("type"); + if (axisOptionsType === "grouped-category") { + return !this.isCategoryAxis(); + } + return true; + } + addLabelPadding(labelPanelComp, chartAxisThemeOverrides) { + const labelPaddingSlider = this.createBean( + new AgSlider(chartAxisThemeOverrides.getDefaultSliderParams("label.spacing", "padding", 30)) + ); + labelPanelComp.addItem(labelPaddingSlider); + } + translate(key) { + return this.chartTranslation.translate(key); + } + removeTemplateComponent(component) { + _removeFromParent14(component.getGui()); + this.destroyBean(component); + } + destroyActivePanels() { + for (const panel of this.activePanels) { + _removeFromParent14(panel.getGui()); + this.destroyBean(panel); + } + } + destroy() { + this.destroyActivePanels(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/axis/polarAxisPanel.ts +import { AgSelect as AgSelect7, Component as Component73, RefPlaceholder as RefPlaceholder57 } from "ag-grid-community"; +var PolarAxisPanel = class extends Component73 { + constructor(options) { + super(); + this.options = options; + this.axisGroup = RefPlaceholder57; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { isExpandedOnInit: expanded, chartAxisMenuParamsFactory, registerGroupComponent } = this.options; + const axisGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.translate("polarAxis"), + expanded, + suppressEnabledCheckbox: true + }; + const axisColorInputParams = chartAxisMenuParamsFactory.getDefaultColorPickerParams("line.stroke"); + const axisLineWidthSliderParams = chartAxisMenuParamsFactory.getDefaultSliderParams( + "line.width", + "thickness", + 10 + ); + this.setTemplate( + /* html */ + `
+ + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + axisGroup: axisGroupParams, + axisColorInput: axisColorInputParams, + axisLineWidthSlider: axisLineWidthSliderParams + } + ); + registerGroupComponent(this.axisGroup); + this.initAxis(); + this.initAxisLabels(); + this.initRadiusAxis(); + } + initAxis() { + const chartType = this.options.chartController.getChartType(); + const hasConfigurableAxisShape = ["radarLine", "radarArea"].includes(chartType); + if (hasConfigurableAxisShape) { + const options = [ + { value: "circle", text: this.translate("circle") }, + { value: "polygon", text: this.translate("polygon") } + ]; + this.axisGroup.addItem( + this.createSelect({ + labelKey: "shape", + options, + property: "shape" + }) + ); + } + if (chartType !== "pie") { + this.axisGroup.addItem( + this.createSlider({ + labelKey: "innerRadius", + defaultMaxValue: 1, + property: "innerRadiusRatio" + }) + ); + } + } + initAxisLabels() { + const params = { + name: this.translate("labels"), + enabled: true, + suppressEnabledCheckbox: true, + chartMenuParamsFactory: this.options.chartAxisMenuParamsFactory, + keyMapper: (key) => `label.${key}` + }; + const labelPanelComp = this.createManagedBean(new FontPanel(params)); + const labelOrientationComp = this.createOrientationWidget(); + labelPanelComp.addItem(labelOrientationComp); + this.axisGroup.addItem(labelPanelComp); + } + createOrientationWidget() { + const options = [ + { value: "fixed", text: this.translate("fixed") }, + { value: "parallel", text: this.translate("parallel") }, + { value: "perpendicular", text: this.translate("perpendicular") } + ]; + return this.createSelect({ + labelKey: "orientation", + options, + property: "label.orientation" + }); + } + initRadiusAxis() { + const chartSeriesType = getSeriesType(this.options.chartController.getChartType()); + if (!isRadial(chartSeriesType)) { + return; + } + const items = [ + this.createSlider({ + labelKey: "groupPadding", + defaultMaxValue: 1, + property: "paddingInner" + }), + this.createSlider({ + labelKey: "seriesPadding", + defaultMaxValue: 1, + property: "groupPaddingInner" + }) + ]; + const paddingPanelComp = this.createManagedBean( + new AgGroupComponent({ + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + enabled: true, + suppressEnabledCheckbox: true, + title: this.translate("padding"), + items + }) + ).hideEnabledCheckbox(true).hideOpenCloseIcons(true); + this.axisGroup.addItem(paddingPanelComp); + } + createSlider(config) { + const { labelKey, defaultMaxValue, step = 0.05, property } = config; + const params = this.options.chartAxisMenuParamsFactory.getDefaultSliderParams( + property, + labelKey, + defaultMaxValue + ); + params.step = step; + return this.createManagedBean(new AgSlider(params)); + } + createSelect(config) { + const { labelKey, options, property } = config; + return this.createManagedBean( + new AgSelect7(this.options.chartAxisMenuParamsFactory.getDefaultSelectParams(property, labelKey, options)) + ); + } + translate(key) { + return this.chartTranslation.translate(key); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/chart/chartPanel.ts +import { Component as Component76, RefPlaceholder as RefPlaceholder59 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/chart/backgroundPanel.ts +import { Component as Component74 } from "ag-grid-community"; +var BackgroundPanel = class extends Component74 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const chartBackgroundGroupParams = this.chartMenuUtils.addEnableParams( + "background.visible", + { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("background"), + suppressEnabledCheckbox: true, + useToggle: true + } + ); + const colorPickerParams = this.chartMenuUtils.getDefaultColorPickerParams("background.fill"); + this.setTemplate( + /* html */ + `
+ + + +
`, + [AgGroupComponentSelector, ColorPickerSelector], + { + chartBackgroundGroup: chartBackgroundGroupParams, + colorPicker: colorPickerParams + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/chart/paddingPanel.ts +import { Component as Component75, RefPlaceholder as RefPlaceholder58 } from "ag-grid-community"; +var PaddingPanel = class extends Component75 { + constructor(chartMenuUtils, chartController) { + super(); + this.chartMenuUtils = chartMenuUtils; + this.chartController = chartController; + this.paddingTopSlider = RefPlaceholder58; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const chartPaddingGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("padding"), + suppressEnabledCheckbox: true + }; + const getSliderParams = (property) => this.chartMenuUtils.getDefaultSliderParams("padding." + property, property, 200); + this.setTemplate( + /* html */ + `
+ + + + + + +
`, + [AgGroupComponentSelector, AgSliderSelector], + { + chartPaddingGroup: chartPaddingGroupParams, + paddingTopSlider: getSliderParams("top"), + paddingRightSlider: getSliderParams("right"), + paddingBottomSlider: getSliderParams("bottom"), + paddingLeftSlider: getSliderParams("left") + } + ); + this.addManagedEventListeners({ + chartOptionsChanged: (e) => { + this.updateTopPadding(e.chartOptions); + } + }); + } + updateTopPadding(chartOptions) { + const topPadding = [...this.chartController.getChartSeriesTypes(), "common"].map((seriesType) => chartOptions?.[seriesType]?.padding?.top).find((value) => value != null); + if (topPadding != null) { + this.paddingTopSlider.setValue(`${topPadding}`); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/chart/chartPanel.ts +var ChartPanel = class extends Component76 { + constructor(options) { + super(); + this.options = options; + this.chartGroup = RefPlaceholder59; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { + chartController, + chartMenuParamsFactory, + isExpandedOnInit: expanded, + registerGroupComponent + } = this.options; + const chartGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.chartTranslation.translate("chartStyle"), + expanded, + suppressEnabledCheckbox: true, + items: [ + this.createManagedBean(new PaddingPanel(chartMenuParamsFactory, chartController)), + this.createManagedBean(new BackgroundPanel(chartMenuParamsFactory)) + ] + }; + this.setTemplate( + /* html */ + `
+ +
`, + [AgGroupComponentSelector], + { chartGroup: chartGroupParams } + ); + registerGroupComponent(this.chartGroup); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/groupExpansionFeature.ts +import { BeanStub as BeanStub99 } from "ag-grid-community"; +var GroupExpansionFeature = class extends BeanStub99 { + constructor(groupContainer) { + super(); + this.groupContainer = groupContainer; + this.id = 0; + this.groupComponents = /* @__PURE__ */ new Map(); + } + addGroupComponent(groupComponent) { + const id = this.id++; + this.groupComponents.set(id, groupComponent); + if (groupComponent.isExpanded()) { + this.expandedGroupComponent = id; + } + groupComponent.onExpandedChange((expanded) => { + if (expanded) { + const previouslyExpandedGroupComponent = this.expandedGroupComponent; + this.expandedGroupComponent = id; + if (previouslyExpandedGroupComponent != null) { + const groupComponentGui = groupComponent.getGui(); + const groupPositionInViewport = groupComponentGui.offsetTop - this.groupContainer.parentElement.scrollTop; + this.groupComponents.get(previouslyExpandedGroupComponent)?.toggleGroupExpand(false, true); + let newScrollTop = groupComponentGui.offsetTop - groupPositionInViewport; + if (newScrollTop < 0) { + newScrollTop = 0; + } + if (newScrollTop !== this.groupContainer.parentElement.scrollTop) { + this.groupContainer.parentElement.scrollTop = newScrollTop; + } + } + } else { + this.expandedGroupComponent = void 0; + } + }); + } + destroy() { + this.groupComponents.clear(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/legend/legendPanel.ts +import { AgCheckbox as AgCheckbox3, AgSelect as AgSelect8, Component as Component77, RefPlaceholder as RefPlaceholder60 } from "ag-grid-community"; +var LegendPanel = class extends Component77 { + constructor(options, chartMenuContext) { + super(); + this.options = options; + this.legendGroup = RefPlaceholder60; + this.enabledGroup = RefPlaceholder60; + this.isGradient = ["treemap", "sunburst", "heatmap"].includes(options.seriesType); + this.key = this.isGradient ? "gradientLegend" : "legend"; + this.chartController = chartMenuContext.chartController; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { chartMenuParamsFactory, isExpandedOnInit: expanded, registerGroupComponent } = this.options; + const positionSelect = this.createManagedBean( + new AgSelect8( + chartMenuParamsFactory.getDefaultSelectParams( + `${this.key}.position`, + "position", + ["top", "right", "bottom", "left"].map((position) => ({ + value: position, + text: this.chartTranslation.translate(position) + })) + ) + ) + ); + this.enabledGroup = this.createManagedBean( + new AgGroupComponent( + chartMenuParamsFactory.addEnableParams(`${this.key}.enabled`, { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("legendEnabled"), + suppressEnabledCheckbox: true, + useToggle: true, + items: [ + this.createLabelPanel(chartMenuParamsFactory), + positionSelect, + ...this.getItems(chartMenuParamsFactory) + ] + }) + ) + ); + const legendGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.chartTranslation.translate("legend"), + suppressEnabledCheckbox: true, + expanded, + items: [this.enabledGroup] + }; + this.setTemplate( + /* html */ + `
+ + +
`, + [AgGroupComponentSelector], + { + legendGroup: legendGroupParams + } + ); + registerGroupComponent(this.legendGroup); + const listener = this.updateLegendEnabledState.bind(this); + this.addManagedListeners(this.chartController, { + chartModelUpdate: listener, + chartApiUpdate: listener + }); + } + updateLegendEnabledState() { + const { valueCols } = this.chartController.getColStateForMenu(); + this.enabledGroup.setEnabled(valueCols.filter((vc) => vc.selected).length > 1); + } + getItems(chartMenuParamsFactory) { + const createSlider = (expression, labelKey, defaultMaxValue) => this.createManagedBean( + new AgSlider( + chartMenuParamsFactory.getDefaultSliderParams( + `${this.key}.${expression}`, + labelKey, + defaultMaxValue + ) + ) + ); + if (this.isGradient) { + return [ + this.createManagedBean( + new AgCheckbox3( + chartMenuParamsFactory.addValueParams("gradientLegend.reverseOrder", { + label: this.chartTranslation.translate("reverseDirection"), + labelWidth: "flex" + }) + ) + ), + createSlider("gradient.thickness", "thickness", 40), + createSlider("gradient.preferredLength", "preferredLength", 300), + createSlider("spacing", "spacing", 200) + ]; + } + return [ + createSlider("spacing", "spacing", 200), + createSlider("item.marker.size", "markerSize", 40), + createSlider("item.marker.strokeWidth", "markerStroke", 10), + createSlider("item.marker.padding", "itemSpacing", 20), + createSlider("item.paddingX", "layoutHorizontalSpacing", 50), + createSlider("item.paddingY", "layoutVerticalSpacing", 50) + ]; + } + createLabelPanel(chartMenuParamsFactory) { + const rootKey = this.isGradient ? "gradientLegend.scale.label" : "legend.item.label"; + const params = { + enabled: true, + suppressEnabledCheckbox: true, + chartMenuParamsFactory, + keyMapper: (key) => `${rootKey}.${key}`, + cssIdentifier: "charts-format-sub-level-no-header" + }; + return this.createManagedBean(new FontPanel(params)); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/seriesPanel.ts +import { AgSelect as AgSelect9, Component as Component88, RefPlaceholder as RefPlaceholder64, _error as _error9, _removeFromParent as _removeFromParent17 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/toggleablePanel.ts +import { Component as Component78, RefPlaceholder as RefPlaceholder61, _removeFromParent as _removeFromParent15 } from "ag-grid-community"; +var ToggleablePanel = class extends Component78 { + constructor(params) { + super(); + this.params = params; + this.toggleableGroup = RefPlaceholder61; + this.activeComps = []; + this.chartOptions = params.chartMenuParamsFactory.getChartOptions(); + } + postConstruct() { + const { tag, cssIdentifier = "charts-format-sub-level", title, suppressEnabledCheckbox } = this.params; + const groupParams = this.params.chartMenuParamsFactory.addEnableParams(`${tag}.enabled`, { + cssIdentifier, + direction: "vertical", + suppressOpenCloseIcons: true, + title, + suppressEnabledCheckbox: true, + useToggle: !suppressEnabledCheckbox + }); + this.setTemplate( + /* html */ + `
+ + +
`, + [AgGroupComponentSelector], + { + toggleableGroup: groupParams + } + ); + this.toggleCss(`ag-toggleable-group-panel-no-header`, !title); + } + addItem(comp, prepend) { + if (prepend) { + this.toggleableGroup.prependItem(comp); + } else { + this.toggleableGroup.addItem(comp); + } + this.activeComps.push(comp); + } + setEnabled(enabled) { + this.toggleableGroup.setEnabled(enabled); + } + destroyActiveComps() { + for (const comp of this.activeComps) { + _removeFromParent15(comp.getGui()); + this.destroyBean(comp); + } + } + destroy() { + this.destroyActiveComps(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/calloutPanel.ts +import { Component as Component79 } from "ag-grid-community"; +var CalloutPanel = class extends Component79 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const calloutGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("callout"), + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, AgSliderSelector], + { + calloutGroup: calloutGroupParams, + calloutLengthSlider: this.chartMenuUtils.getDefaultSliderParams("calloutLine.length", "length", 40), + calloutStrokeWidthSlider: this.chartMenuUtils.getDefaultSliderParams( + "calloutLine.strokeWidth", + "strokeWidth", + 10 + ), + labelOffsetSlider: this.chartMenuUtils.getDefaultSliderParams("calloutLabel.offset", "offset", 30) + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/capsPanel.ts +import { Component as Component80 } from "ag-grid-community"; +var CapsPanel = class extends Component80 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const capsGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("cap"), + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + const capLengthRatioSliderParams = this.chartMenuUtils.getDefaultSliderParams( + "cap.lengthRatio", + "capLengthRatio", + 1 + ); + capLengthRatioSliderParams.step = 0.05; + this.setTemplate( + /* html */ + `
+ + + +
`, + [AgGroupComponentSelector, AgSliderSelector], + { + capsGroup: capsGroupParams, + capLengthRatioSlider: capLengthRatioSliderParams + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/connectorLinePanel.ts +import { Component as Component81 } from "ag-grid-community"; +var ConnectorLinePanel = class extends Component81 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const lineGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("connectorLine"), + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + + + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + lineGroup: lineGroupParams, + lineColorPicker: this.chartMenuUtils.getDefaultColorPickerParams("line.stroke"), + lineStrokeWidthSlider: this.getSliderParams("strokeWidth", 10, "line.strokeWidth"), + lineDashSlider: this.getSliderParams("lineDash", 30, "line.lineDash", 1, true), + lineOpacitySlider: this.getSliderParams("strokeOpacity", 1, "line.strokeOpacity", 0.05) + } + ); + } + getSliderParams(labelKey, maxValue, seriesOptionKey, step = 1, isArray = false) { + const params = this.chartMenuUtils.getDefaultSliderParams(seriesOptionKey, labelKey, maxValue, isArray); + params.step = step; + return params; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/markersPanel.ts +import { AgSelectSelector as AgSelectSelector4, Component as Component82 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/seriesUtils.ts +function getShapeSelectOptions(chartTranslation) { + return ["square", "circle", "cross", "diamond", "plus", "triangle", "heart"].map((value) => ({ + value, + text: chartTranslation.translate(value) + })); +} + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/markersPanel.ts +var MarkersPanel = class extends Component82 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const seriesMarkersGroupParams = this.chartMenuUtils.addEnableParams("marker.enabled", { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("markers"), + suppressEnabledCheckbox: true, + useToggle: true, + suppressOpenCloseIcons: true + }); + this.setTemplate( + /* html */ + `
+ + + + + +
`, + [AgGroupComponentSelector, AgSelectSelector4, AgSliderSelector], + { + seriesMarkersGroup: seriesMarkersGroupParams, + seriesMarkerShapeSelect: this.chartMenuUtils.getDefaultSelectParams( + "marker.shape", + "shape", + getShapeSelectOptions(this.chartTranslation) + ), + seriesMarkerSizeSlider: this.chartMenuUtils.getDefaultSliderParams("marker.size", "size", 60), + seriesMarkerStrokeWidthSlider: this.chartMenuUtils.getDefaultSliderParams( + "marker.strokeWidth", + "strokeWidth", + 10 + ) + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/seriesItemsPanel.ts +import { AgSelectSelector as AgSelectSelector5, Component as Component83, RefPlaceholder as RefPlaceholder62, _removeFromParent as _removeFromParent16 } from "ag-grid-community"; +var SeriesItemsPanel = class extends Component83 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + this.seriesItemsGroup = RefPlaceholder62; + this.activePanels = []; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const seriesItemsGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("seriesItems"), + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + + +
`, + [AgGroupComponentSelector, AgSelectSelector5], + { + seriesItemsGroup: seriesItemsGroupParams, + seriesItemSelect: this.getSeriesItemsParams() + } + ); + this.initSeriesControls(); + } + getSeriesItemsParams() { + const options = [ + { value: "positive", text: this.chartTranslation.translate("seriesItemPositive") }, + { value: "negative", text: this.chartTranslation.translate("seriesItemNegative") } + ]; + const seriesItemChangedCallback = (newValue) => { + this.destroyActivePanels(); + this.initSeriesControls(newValue); + }; + return this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams( + "seriesItemType", + options, + "positive", + seriesItemChangedCallback + ); + } + initSeriesControls(itemType = "positive") { + this.initSlider("strokeWidth", 10, `item.${itemType}.strokeWidth`); + this.initSlider("lineDash", 30, `item.${itemType}.lineDash`, 1, true); + this.initSlider("strokeOpacity", 1, `item.${itemType}.strokeOpacity`, 0.05, false); + this.initSlider("fillOpacity", 1, `item.${itemType}.fillOpacity`, 0.05, false); + this.initItemLabels(itemType); + } + initSlider(labelKey, maxValue, seriesOptionKey, step = 1, isArray = false) { + const params = this.chartMenuUtils.getDefaultSliderParams(seriesOptionKey, labelKey, maxValue, isArray); + params.step = step; + const itemSlider = this.seriesItemsGroup.createManagedBean(new AgSlider(params)); + this.seriesItemsGroup.addItem(itemSlider); + this.activePanels.push(itemSlider); + } + initItemLabels(itemType) { + const sectorParams = this.chartMenuUtils.getDefaultFontPanelParams( + `item.${itemType}.label`, + "seriesItemLabels" + ); + const labelPanelComp = this.createBean(new FontPanel(sectorParams)); + this.seriesItemsGroup.addItem(labelPanelComp); + this.activePanels.push(labelPanelComp); + } + destroyActivePanels() { + for (const panel of this.activePanels) { + _removeFromParent16(panel.getGui()); + this.destroyBean(panel); + } + } + destroy() { + this.destroyActivePanels(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/shadowPanel.ts +import { Component as Component84 } from "ag-grid-community"; +var ShadowPanel = class extends Component84 { + constructor(chartMenuUtils, propertyKey = "shadow") { + super(); + this.chartMenuUtils = chartMenuUtils; + this.propertyKey = propertyKey; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const propertyNamespace = this.propertyKey; + const shadowGroupParams = this.chartMenuUtils.addEnableParams( + `${propertyNamespace}.enabled`, + { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: this.chartTranslation.translate("shadow"), + suppressEnabledCheckbox: true, + useToggle: true + } + ); + const shadowColorPickerParams = this.chartMenuUtils.getDefaultColorPickerParams(`${propertyNamespace}.color`); + this.setTemplate( + /* html */ + `
+ + + + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + shadowGroup: shadowGroupParams, + shadowColorPicker: shadowColorPickerParams, + shadowBlurSlider: this.getSliderParams("blur", 0, 20), + shadowXOffsetSlider: this.getSliderParams("xOffset", -10, 10), + shadowYOffsetSlider: this.getSliderParams("yOffset", -10, 10) + } + ); + } + getSliderParams(property, minValue, defaultMaxValue) { + const expression = `${this.propertyKey}.${property}`; + const params = this.chartMenuUtils.getDefaultSliderParams(expression, property, defaultMaxValue); + params.minValue = minValue; + return params; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/tileSpacingPanel.ts +import { Component as Component85 } from "ag-grid-community"; +var TileSpacingPanel = class extends Component85 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const groupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + + + + + + + +
`, + [AgGroupComponentSelector, AgSliderSelector], + { + groupSpacing: { ...groupParams, title: this.chartTranslation.translate("group") }, + tileSpacing: { ...groupParams, title: this.chartTranslation.translate("tile") }, + groupPaddingSlider: this.getSliderParams("padding", "group.padding"), + groupSpacingSlider: this.getSliderParams("spacing", "group.gap"), + tilePaddingSlider: this.getSliderParams("padding", "tile.padding"), + tileSpacingSlider: this.getSliderParams("spacing", "tile.gap") + } + ); + } + getSliderParams(labelKey, key) { + return this.chartMenuUtils.getDefaultSliderParams(key, labelKey, 10); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/tooltipPanel.ts +import { AgSelectSelector as AgSelectSelector6, Component as Component86, RefPlaceholder as RefPlaceholder63 } from "ag-grid-community"; +function _capitalise2(str) { + return str[0].toUpperCase() + str.substring(1); +} +var TooltipPanel = class extends Component86 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + this.tooltipMode = RefPlaceholder63; + } + postConstruct() { + const { chartMenuUtils, beans } = this; + const propertyKey = "tooltip"; + const chartTranslation = beans.chartTranslation; + const tooltipGroupParams = chartMenuUtils.addEnableParams(`${propertyKey}.enabled`, { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + suppressOpenCloseIcons: true, + title: chartTranslation.translate("tooltips"), + suppressEnabledCheckbox: true, + useToggle: true + }); + const tooltipModeLocaleKey = "tooltipMode"; + const tooltipModeSelectionOptions = ["single", "shared", "compact"].map((value) => ({ + value, + text: chartTranslation.translate(`${tooltipModeLocaleKey}${_capitalise2(value)}`) + })); + const tooltipModeExpression = `${propertyKey}.mode`; + const tooltipModeSelectParams = chartMenuUtils.getDefaultSelectParams( + tooltipModeExpression, + tooltipModeLocaleKey, + tooltipModeSelectionOptions + ); + this.setTemplate( + /* html */ + `
+ + + +
`, + [AgGroupComponentSelector, AgSelectSelector6], + { + tooltipGroup: tooltipGroupParams, + tooltipMode: tooltipModeSelectParams + } + ); + this.addManagedEventListeners({ + chartOptionsChanged: () => { + const tooltipModeValue = chartMenuUtils.getChartOptions().getValue(tooltipModeExpression); + this.tooltipMode.setValue(tooltipModeValue, true); + } + }); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/whiskersPanel.ts +import { Component as Component87 } from "ag-grid-community"; +var WhiskersPanel = class extends Component87 { + constructor(chartMenuUtils) { + super(); + this.chartMenuUtils = chartMenuUtils; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const whiskersGroupParams = { + cssIdentifier: "charts-format-sub-level", + direction: "vertical", + title: this.chartTranslation.translate("whisker"), + enabled: true, + suppressOpenCloseIcons: true, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + + + + + + +
`, + [AgGroupComponentSelector, ColorPickerSelector, AgSliderSelector], + { + whiskersGroup: whiskersGroupParams, + whiskerColorPicker: this.chartMenuUtils.getDefaultColorPickerParams("whisker.stroke"), + whiskerThicknessSlider: this.chartMenuUtils.getDefaultSliderParams( + "whisker.strokeWidth", + "strokeWidth", + 10 + ), + whiskerOpacitySlider: this.chartMenuUtils.getDefaultSliderParams( + "whisker.strokeOpacity", + "strokeOpacity", + 1 + ), + whiskerLineDashSlider: this.chartMenuUtils.getDefaultSliderParams( + "whisker.lineDash", + "lineDash", + 30, + true + ), + whiskerLineDashOffsetSlider: this.chartMenuUtils.getDefaultSliderParams( + "whisker.lineDashOffset", + "lineDashOffset", + 30 + ) + } + ); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/series/seriesPanel.ts +var tooltips = "tooltips"; +var strokeWidth = "strokeWidth"; +var lineWidth = "lineWidth"; +var lineDash = "lineDash"; +var lineOpacity = "lineOpacity"; +var fillOpacity = "fillOpacity"; +var labels = "labels"; +var shadow = "shadow"; +var stageLabels = "stageLabels"; +var markers = "markers"; +var SeriesPanel = class extends Component88 { + constructor(options) { + super(); + this.options = options; + this.seriesGroup = RefPlaceholder64; + this.activePanels = []; + this.widgetFuncs = { + lineWidth: () => this.initStrokeWidth(lineWidth), + [strokeWidth]: () => this.initStrokeWidth("strokeWidth"), + lineColor: () => this.initLineColor(), + [lineDash]: () => this.initLineDash(), + [lineOpacity]: () => this.initOpacity("strokeOpacity"), + [fillOpacity]: () => this.initOpacity("fillOpacity"), + markers: () => new MarkersPanel(this.chartMenuUtils), + [labels]: () => this.initLabels(), + sectorLabels: () => this.initSectorLabels(), + [shadow]: () => new ShadowPanel(this.chartMenuUtils), + [tooltips]: () => new TooltipPanel(this.options.chartMenuParamsFactory), + bins: () => this.initBins(), + whiskers: () => new WhiskersPanel(this.chartMenuUtils), + caps: () => new CapsPanel(this.chartMenuUtils), + connectorLine: () => new ConnectorLinePanel(this.chartMenuUtils), + seriesItems: () => new SeriesItemsPanel(this.chartMenuUtils), + tileSpacing: () => new TileSpacingPanel(this.chartMenuUtils), + shape: () => this.initShape(), + size: () => this.initSize("size", "size"), + minSize: () => this.initSize("size", "minSize"), + maxSize: () => this.initSize("maxSize", "maxSize"), + dropoff: () => this.initDropOff(), + stageLabels: () => this.initStageLabels() + }; + this.seriesWidgetMappings = { + bar: [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels, shadow], + pie: [tooltips, strokeWidth, lineOpacity, fillOpacity, labels, "sectorLabels", shadow], + donut: [tooltips, strokeWidth, lineOpacity, fillOpacity, labels, "sectorLabels", shadow], + line: [tooltips, lineWidth, lineDash, lineOpacity, markers, labels], + scatter: [tooltips, "shape", "size", strokeWidth, labels], + bubble: [tooltips, "shape", "minSize", "maxSize", strokeWidth, labels], + area: [tooltips, lineWidth, lineDash, lineOpacity, fillOpacity, markers, labels, shadow], + histogram: [tooltips, "bins", strokeWidth, lineDash, lineOpacity, fillOpacity, labels, shadow], + "radial-column": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels], + "radial-bar": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels], + "radar-line": [tooltips, strokeWidth, lineDash, lineOpacity, markers, labels], + "radar-area": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, markers, labels], + nightingale: [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels], + "box-plot": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, "whiskers", "caps"], + "range-bar": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels], + "range-area": [tooltips, lineWidth, lineDash, lineOpacity, fillOpacity, markers, labels, shadow], + treemap: [tooltips, "tileSpacing"], + sunburst: [tooltips], + heatmap: [tooltips, labels, "lineColor", lineWidth, lineOpacity], + waterfall: [tooltips, "connectorLine", "seriesItems"], + funnel: [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels, "dropoff", stageLabels, shadow], + "cone-funnel": [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels, stageLabels], + pyramid: [tooltips, strokeWidth, lineDash, lineOpacity, fillOpacity, labels, stageLabels, shadow] + }; + this.seriesType = options.seriesType; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { + isExpandedOnInit: expanded, + chartOptionsService, + chartController, + registerGroupComponent + } = this.options; + const seriesGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.translate("series"), + expanded, + suppressEnabledCheckbox: true + }; + this.setTemplate( + /* html */ + `
+ + +
`, + [AgGroupComponentSelector], + { seriesGroup: seriesGroupParams } + ); + registerGroupComponent(this.seriesGroup); + this.chartMenuUtils = this.createManagedBean( + new ChartMenuParamsFactory(chartOptionsService.getSeriesOptionsProxy(() => this.seriesType)) + ); + this.addManagedListeners(chartController, { chartSeriesChartTypeChanged: this.refreshWidgets.bind(this) }); + this.refreshWidgets(); + } + refreshWidgets() { + const { chartController } = this.options; + this.destroyActivePanels(); + const chart = chartController.getChartProxy().getChart(); + chart.waitForUpdate().then(() => { + const componentWasRemoved = !this.isAlive(); + if (componentWasRemoved) { + return; + } + if (chartController.isComboChart()) { + this.updateSeriesType(); + this.initSeriesSelect(); + } + for (const w of this.seriesWidgetMappings[this.seriesType] ?? []) { + const widgetFuncResult = this.widgetFuncs[w](); + let widget; + if (Array.isArray(widgetFuncResult)) { + const comp = this.createBean(widgetFuncResult[0]); + widget = comp; + widgetFuncResult[1](comp); + } else { + widget = this.createBean(widgetFuncResult); + } + this.seriesGroup.addItem(widget); + this.activePanels.push(widget); + } + }).catch((e) => _error9(105, { e })); + } + initSeriesSelect() { + const seriesSelect = this.createBean( + new AgSelect9( + this.chartMenuUtils.getDefaultSelectParamsWithoutValueParams( + "seriesType", + this.getSeriesSelectOptions(), + `${this.seriesType}`, + (newValue) => { + this.seriesType = newValue; + this.refreshWidgets(); + } + ) + ) + ); + this.seriesGroup.addItem(seriesSelect); + this.activePanels.push(seriesSelect); + } + initLineColor() { + return new ColorPicker(this.chartMenuUtils.getDefaultColorPickerParams("stroke", "strokeColor")); + } + initStrokeWidth(labelKey, expression) { + return new AgSlider( + this.chartMenuUtils.getDefaultSliderParams( + expression ? `${expression}.${labelKey}` : "strokeWidth", + labelKey, + 10 + ) + ); + } + initLineDash(expression) { + return new AgSlider( + this.chartMenuUtils.getDefaultSliderParams( + expression ? `${expression}.lineDash` : "lineDash", + "lineDash", + 30, + true + ) + ); + } + initOpacity(type, expression) { + const params = this.chartMenuUtils.getDefaultSliderParams(expression ? `${expression}.${type}` : type, type, 1); + params.step = 0.05; + return new AgSlider(params); + } + initDropOff() { + const dropOffGroup = new ToggleablePanel({ + tag: "dropOff", + cssIdentifier: "charts-format-sub-level", + title: this.translate("dropOff"), + suppressEnabledCheckbox: false, + chartMenuParamsFactory: this.chartMenuUtils + }); + const addItems = (groupComponent) => { + for (const comp of [ + this.initStrokeWidth("strokeWidth", "dropOff"), + this.initLineDash("dropOff"), + this.initOpacity("strokeOpacity", "dropOff"), + this.initOpacity("fillOpacity", "dropOff") + ]) { + const managed = groupComponent.createManagedBean(comp); + groupComponent.addItem(managed); + this.activePanels.push(managed); + } + }; + return [dropOffGroup, addItems]; + } + initLabels() { + const isPieChart = isPieChartSeries(this.seriesType); + const seriesOptionLabelProperty = isPieChart ? "calloutLabel" : "label"; + const labelKey = isPieChart ? "calloutLabels" : "labels"; + const labelParams = this.chartMenuUtils.getDefaultFontPanelParams(seriesOptionLabelProperty, labelKey); + const fontPanel = new FontPanel(labelParams); + const addItems = (labelPanelComp) => { + if (isPieChart) { + const calloutPanelComp = labelPanelComp.createManagedBean(new CalloutPanel(this.chartMenuUtils)); + labelPanelComp.addItem(calloutPanelComp); + this.activePanels.push(calloutPanelComp); + } + if (this.seriesType === "range-bar") { + const options = [ + { value: "inside", text: this.translate("inside") }, + { value: "outside", text: this.translate("outside") } + ]; + const placementSelect = labelPanelComp.createManagedBean( + new AgSelect9( + this.chartMenuUtils.getDefaultSelectParams("label.placement", "labelPlacement", options) + ) + ); + labelPanelComp.addItem(placementSelect); + this.activePanels.push(placementSelect); + const paddingSlider = labelPanelComp.createManagedBean( + new AgSlider(this.chartMenuUtils.getDefaultSliderParams("label.padding", "padding", 200)) + ); + labelPanelComp.addItem(paddingSlider); + this.activePanels.push(paddingSlider); + } + }; + return [fontPanel, addItems]; + } + initSectorLabels() { + const sectorParams = this.chartMenuUtils.getDefaultFontPanelParams("sectorLabel", "sectorLabels"); + const fontPanel = new FontPanel(sectorParams); + const addItems = (sectorPanelComp) => { + const positionRatioParams = this.chartMenuUtils.getDefaultSliderParams( + "sectorLabel.positionRatio", + "positionRatio", + 1 + ); + positionRatioParams.step = 0.05; + const positionRatioComp = sectorPanelComp.createManagedBean(new AgSlider(positionRatioParams)); + sectorPanelComp.addItem(positionRatioComp); + }; + return [fontPanel, addItems]; + } + initStageLabels() { + return new FontPanel(this.chartMenuUtils.getDefaultFontPanelParams("stageLabel", stageLabels)); + } + initBins() { + const params = this.chartMenuUtils.getDefaultSliderParams("binCount", "histogramBinCount", 20); + const chartOptions = this.chartMenuUtils.getChartOptions(); + const value = (chartOptions.getValue("bins") ?? chartOptions.getValue("calculatedBins", true)).length; + params.value = `${value}`; + params.maxValue = Math.max(value, 20); + return new AgSlider(params); + } + initShape() { + return new AgSelect9( + this.chartMenuUtils.getDefaultSelectParams("shape", "shape", getShapeSelectOptions(this.chartTranslation)) + ); + } + initSize(expression, labelKey) { + return new AgSlider(this.chartMenuUtils.getDefaultSliderParams(expression, labelKey, 60)); + } + getSeriesSelectOptions() { + const activeSeriesTypes = this.getActiveSeriesTypes(); + return ["area", "bar", "line"].filter((seriesType) => activeSeriesTypes.includes(seriesType)).map((value) => ({ value, text: this.translate(value) })); + } + updateSeriesType() { + const activeSeriesTypes = this.getActiveSeriesTypes(); + const invalidSeriesType = !activeSeriesTypes.includes(this.seriesType); + if (invalidSeriesType && activeSeriesTypes.length > 0) { + this.seriesType = activeSeriesTypes[0]; + } + } + getActiveSeriesTypes() { + return this.options.chartController.getActiveSeriesChartTypes().map((s2) => getSeriesType(s2.chartType)); + } + translate(key) { + return this.chartTranslation.translate(key); + } + destroyActivePanels() { + for (const panel of this.activePanels) { + _removeFromParent17(panel.getGui()); + this.destroyBean(panel); + } + } + destroy() { + this.destroyActivePanels(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/titles/titlesPanel.ts +import { Component as Component90, RefPlaceholder as RefPlaceholder65 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/titles/titlePanel.ts +import { AgInputTextField as AgInputTextField4, Component as Component89 } from "ag-grid-community"; +var TitlePanel = class extends Component89 { + constructor(chartMenuUtils, name, key) { + super( + /* html */ + `
` + ); + this.chartMenuUtils = chartMenuUtils; + this.name = name; + this.key = key; + this.chartOptions = chartMenuUtils.getChartOptions(); + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + this.initFontPanel(); + } + hasTitle() { + const title = this.chartOptions.getValue(this.key); + return title?.enabled && title.text && title.text.length > 0; + } + initFontPanel() { + const hasTitle = this.hasTitle(); + const fontPanelParams = { + name: this.chartTranslation.translate(this.name), + enabled: hasTitle, + suppressEnabledCheckbox: false, + chartMenuParamsFactory: this.chartMenuUtils, + keyMapper: (key) => `${this.key}.${key}`, + onEnableChange: (enabled) => this.onEnableChange(enabled) + }; + this.fontPanel = this.createManagedBean(new FontPanel(fontPanelParams)); + this.fontPanel.addItem(this.createBean(new AgInputTextField4(this.getTextInputParams())), true); + this.fontPanel.addItem(this.createBean(new AgSlider(this.getSpacingSliderParams()))); + this.getGui().appendChild(this.fontPanel.getGui()); + } + getTextInputParams() { + return this.chartMenuUtils.addValueParams(`${this.key}.text`, { + label: this.chartTranslation.translate("title"), + labelAlignment: "top" + }); + } + getSpacingSliderParams() { + return this.chartMenuUtils.getDefaultSliderParams(`${this.key}.spacing`, "spacing", 100); + } + onEnableChange(enabled) { + this.chartOptions.setValue(`${this.key}.enabled`, enabled); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/titles/chartTitlePanel.ts +var ChartTitlePanel = class extends TitlePanel { + wireBeans(beans) { + super.wireBeans(beans); + this.chartMenuSvc = beans.chartMenuSvc; + } + postConstruct() { + this.titlePlaceholder = this.chartTranslation.translate("titlePlaceholder"); + super.postConstruct(); + this.addManagedEventListeners({ + chartTitleEdit: () => { + this.fontPanel.setEnabled(this.hasTitle()); + } + }); + } + getTextInputParams() { + const params = super.getTextInputParams(); + if (this.shouldOverrideTextWithPlaceholder(params.value)) { + params.value = this.titlePlaceholder; + } + return params; + } + getSpacingSliderParams() { + const params = super.getSpacingSliderParams(); + params.value = "10"; + return params; + } + onEnableChange(enabled) { + if (this.chartMenuSvc.doesChartToolbarExist()) { + const topPadding = this.chartOptions.getValue("padding.top"); + this.chartOptions.setValue("padding.top", enabled ? topPadding - 20 : topPadding + 20); + } + this.chartOptions.setValue(`${this.key}.enabled`, enabled); + const currentTitleText = this.chartOptions.getValue(`${this.key}.text`); + if (enabled && this.shouldOverrideTextWithPlaceholder(currentTitleText)) { + this.chartOptions.setValue(`${this.key}.text`, this.titlePlaceholder); + } + } + shouldOverrideTextWithPlaceholder(currentTitleText) { + return currentTitleText === "Title" || currentTitleText?.trim().length === 0; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/titles/titlesPanel.ts +var TitlesPanel = class extends Component90 { + constructor(options) { + super(); + this.options = options; + this.titleGroup = RefPlaceholder65; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + const { + chartMenuParamsFactory, + chartAxisMenuParamsFactory, + chartOptionsService, + seriesType, + isExpandedOnInit: expanded = false, + registerGroupComponent + } = this.options; + const axisTitlePanels = []; + if (isCartesian(seriesType) && seriesType !== "pyramid") { + const createAxisParamsFactory = (axisType) => this.createManagedBean( + new ChartMenuParamsFactory(chartOptionsService.getCartesianAxisThemeOverridesProxy(axisType)) + ); + axisTitlePanels.push( + this.createManagedBean(new TitlePanel(createAxisParamsFactory("xAxis"), "horizontalAxisTitle", "title")) + ); + axisTitlePanels.push( + this.createManagedBean(new TitlePanel(createAxisParamsFactory("yAxis"), "verticalAxisTitle", "title")) + ); + } else if (isPolar(seriesType)) { + axisTitlePanels.push( + this.createManagedBean(new TitlePanel(chartAxisMenuParamsFactory, "polarAxisTitle", "title")) + ); + } + const titleGroupParams = { + cssIdentifier: "charts-format-top-level", + direction: "vertical", + title: this.chartTranslation.translate("chartTitles"), + expanded, + suppressEnabledCheckbox: true, + items: [ + this.createManagedBean(new ChartTitlePanel(chartMenuParamsFactory, "chartTitle", "title")), + this.createManagedBean(new TitlePanel(chartMenuParamsFactory, "chartSubtitle", "subtitle")), + ...axisTitlePanels + ] + }; + this.setTemplate( + /* html */ + `
+ +
`, + [AgGroupComponentSelector], + { titleGroup: titleGroupParams } + ); + registerGroupComponent(this.titleGroup); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/format/formatPanel.ts +var DefaultFormatPanelDef = { + groups: [{ type: "chart" }, { type: "titles" }, { type: "legend" }, { type: "series" }, { type: "axis" }] +}; +var AXIS_KEYS = ["axis", "horizontalAxis", "verticalAxis"]; +var FormatPanel = class extends Component91 { + constructor(chartMenuContext) { + super( + /* html */ + `
` + ); + this.chartMenuContext = chartMenuContext; + } + postConstruct() { + this.groupExpansionFeature = this.createManagedBean(new GroupExpansionFeature(this.getGui())); + this.chartPanelFeature = this.createManagedBean( + new ChartPanelFeature( + this.chartMenuContext.chartController, + this.getGui(), + "ag-chart-format-section", + (_chartType, seriesType) => this.createPanels(seriesType) + ) + ); + this.chartPanelFeature.refreshPanels(); + } + createPanels(seriesType) { + let panelExpandedOnInit = false; + this.getFormatPanelDef().groups?.forEach(({ type: group, isOpen: isExpandedOnInit = false }) => { + if (!this.isGroupPanelShownInSeries(group, seriesType)) { + return; + } + if (isExpandedOnInit) { + if (panelExpandedOnInit) { + _warn64(145, { group }); + } + panelExpandedOnInit = true; + } + const registerGroupComponent = (groupComponent) => this.groupExpansionFeature.addGroupComponent(groupComponent); + const opts = { + ...this.chartMenuContext, + isExpandedOnInit, + seriesType, + registerGroupComponent + }; + switch (group) { + case "chart": + this.chartPanelFeature.addComponent(new ChartPanel(opts)); + break; + case "titles": + this.chartPanelFeature.addComponent(new TitlesPanel(opts)); + break; + case "legend": + this.chartPanelFeature.addComponent(new LegendPanel(opts, this.chartMenuContext)); + break; + case "axis": + if (isPolar(seriesType)) { + this.chartPanelFeature.addComponent(new PolarAxisPanel(opts)); + } else if (isCartesian(seriesType)) { + this.chartPanelFeature.addComponent(new CartesianAxisPanel("xAxis", opts)); + this.chartPanelFeature.addComponent(new CartesianAxisPanel("yAxis", opts)); + } + break; + case "horizontalAxis": + this.chartPanelFeature.addComponent(new CartesianAxisPanel("xAxis", opts)); + break; + case "verticalAxis": + this.chartPanelFeature.addComponent(new CartesianAxisPanel("yAxis", opts)); + break; + case "series": + this.chartPanelFeature.addComponent(new SeriesPanel(opts)); + break; + default: + _warn64(147, { group }); + } + }); + } + getFormatPanelDef() { + const userProvidedFormatPanelDef = this.gos.get("chartToolPanelsDef")?.formatPanel; + return userProvidedFormatPanelDef ? userProvidedFormatPanelDef : DefaultFormatPanelDef; + } + isGroupPanelShownInSeries(group, seriesType) { + const enable = ["chart", "titles", "legend", "series"].includes(group) || isCartesian(seriesType) && AXIS_KEYS.includes(group) || isPolar(seriesType) && group === "axis"; + const disable = isFunnel(seriesType) && group === "legend" || isFunnel(seriesType) && AXIS_KEYS.includes(group); + return enable && !disable; + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/chartSettingsPanel.ts +import { + Component as Component94, + RefPlaceholder as RefPlaceholder66, + _areEqual as _areEqual8, + _clearElement as _clearElement22, + _createIconNoSpan as _createIconNoSpan27, + _getAbsoluteWidth as _getAbsoluteWidth2, + _radioCssClass as _radioCssClass2, + _setDisplayed as _setDisplayed26 +} from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniChartsContainer.ts +import { Component as Component93, KeyCode as KeyCode34, _setAriaLabel as _setAriaLabel21, _warn as _warn65 } from "ag-grid-community"; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/miniChart.ts +import { Component as Component92, _error as _error10 } from "ag-grid-community"; +var CANVAS_CLASS = "ag-chart-mini-thumbnail-canvas"; +var MiniChart = class extends Component92 { + constructor(container, agChartsExports, tooltipName) { + super(); + this.agChartsExports = agChartsExports; + this.tooltipName = tooltipName; + this.size = 58; + this.padding = 5; + const { _Scene } = agChartsExports; + this.root = new _Scene.Group(); + const canvasElement = container.ownerDocument.createElement("canvas"); + const scene = new _Scene.Scene({ + canvasElement, + pixelRatio: container.ownerDocument.defaultView?.devicePixelRatio ?? 1, + width: this.size, + height: this.size, + willReadFrequently: false + }); + scene.canvas.element.classList.add(CANVAS_CLASS); + scene.setRoot(this.root); + scene.setContainer(container); + this.scene = scene; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + this.scene.canvas.element.title = this.chartTranslation.translate(this.tooltipName); + try { + this.scene.render(); + } catch (e) { + _error10(108, { e }); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/miniChartHelpers.ts +import { _last as _last19 } from "ag-grid-community"; +function createColumnRects(params) { + const { + stacked, + size, + padding, + xScalePadding, + xScaleDomain, + yScaleDomain, + agChartsExports: { _Scene } + } = params; + const xScale = new _Scene.CategoryScale(); + xScale.domain = xScaleDomain; + xScale.range = [padding, size - padding]; + xScale.paddingInner = xScalePadding; + xScale.paddingOuter = xScalePadding; + const yScale = new _Scene.LinearScale(); + yScale.domain = yScaleDomain; + yScale.range = [size - padding, padding]; + const createBars = (series, xScale2, yScale2) => { + return series.map((datum, i) => { + const top = yScale2.convert(datum); + const rect = new _Scene.Rect(); + rect.x = xScale2.convert(i); + rect.y = top; + rect.width = xScale2.bandwidth; + rect.height = yScale2.convert(0) - top; + rect.strokeWidth = 0; + rect.crisp = true; + return rect; + }); + }; + if (stacked) { + return params.data.map((d) => createBars(d, xScale, yScale)); + } + return createBars(params.data, xScale, yScale); +} +function prepareXYScales(_Scene, data, size, padding) { + const xDomain = []; + const yDomain = []; + for (const item of data) { + for (const [x, y] of item) { + xDomain.push(x); + yDomain.push(y); + } + } + const xScale = new _Scene.LinearScale(); + xScale.domain = [Math.min(...xDomain), Math.max(...xDomain)]; + xScale.range = [padding, size - padding]; + const yScale = new _Scene.LinearScale(); + yScale.domain = [Math.min(...yDomain), Math.max(...yDomain)]; + yScale.range = [size - padding, padding]; + return { xScale, yScale }; +} +function prepareLinearScene(_Scene, data, size, padding) { + const xDomain = [0, data[0].length - 1]; + const yDomain = data.reduce( + (acc, curr) => { + for (const datum of curr) { + if (datum < acc[0]) { + acc[0] = datum; + } + if (datum > acc[1]) { + acc[1] = datum; + } + } + return acc; + }, + [Infinity, -Infinity] + ); + yDomain[0]--; + yDomain[yDomain.length - 1]++; + const xScale = new _Scene.LinearScale(); + xScale.domain = xDomain; + xScale.range = [padding, size - padding]; + const yScale = new _Scene.LinearScale(); + yScale.domain = yDomain; + yScale.range = [size - padding, padding]; + return { xScale, yScale }; +} +function createXPathCommands(data, xScale, yScale) { + return data.map( + (series) => series.map((datum, i) => [ + i > 0 ? "lineTo" : "moveTo", + xScale.convert(i), + yScale.convert(datum) + ]) + ); +} +function createXYPathCommands(shape, xScale, yScale) { + return shape.map(([x, y], i) => [i > 0 ? "lineTo" : "moveTo", xScale.convert(x), yScale.convert(y)]); +} +function closePath(commandSegments) { + const closingCommand = commandSegments[0]; + const first = commandSegments[1]; + const last = _last19(commandSegments); + if (first[1] !== last[1] || first[2] !== last[2]) { + commandSegments.push([closingCommand[0], first[1], first[2]]); + } + return commandSegments; +} +function createPath(_Scene, commands) { + const path = new _Scene.Path(); + commands.forEach(([command, x, y]) => path.path[command](x, y)); + return path; +} +function createAreaPathCommands(commands, yScale, stacked) { + return commands.map((pathCommands, index, all) => { + const closingPath = stacked ? closePathViaPreviousSeries(all, index, yScale) : closePathViaOrigin(pathCommands, yScale); + const closingPathCommands = [...closingPath].reverse().map(([_, x, y]) => ["lineTo", x, y]); + const first = pathCommands[0]; + const last = _last19(closingPathCommands); + if (first[1] !== last[1] || first[2] !== last[2]) { + closingPathCommands.push(["lineTo", first[1], first[2]]); + } + return [...pathCommands, ...closingPathCommands]; + }); +} +function closePathViaPreviousSeries(all, index, yScale) { + if (index === 0) { + return closePathViaOrigin(all[index], yScale); + } + return [...all[index - 1]]; +} +function closePathViaOrigin(pathCommands, yScale) { + return pathCommands.map(([c, x]) => [c, x, yScale.convert(0)]); +} +function commandsToPath(_Scene, commands) { + const path = createPath(_Scene, commands); + path.fill = void 0; + path.lineCap = "round"; + path.strokeWidth = 3; + return path; +} +function createShapePaths({ _Scene }, root, shapes, size, padding) { + const { xScale, yScale } = prepareXYScales(_Scene, shapes, size, padding); + const openPathsCommands = shapes.map((shape) => createXYPathCommands(shape, xScale, yScale)); + const shapesCommands = openPathsCommands.map((path) => closePath(path)); + const shapePaths = shapesCommands.map((shapeCommands) => commandsToPath(_Scene, shapeCommands)); + const paths = shapePaths.reduce((acc, curr) => acc.concat(curr), []); + const pathsGroup = new _Scene.Group(); + pathsGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + pathsGroup.append(paths); + root.append(pathsGroup); + return paths; +} +function createLinePaths({ _Scene }, root, data, size, padding) { + const { xScale, yScale } = prepareLinearScene(_Scene, data, size, padding); + const pathCommands = createXPathCommands(data, xScale, yScale); + const paths = pathCommands.map((commands) => commandsToPath(_Scene, commands)); + const pathsGroup = new _Scene.Group(); + pathsGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + pathsGroup.append(paths); + root.append(pathsGroup); + return paths; +} +function createAreaPaths(_Scene, root, data, size, padding, stacked = false) { + const { xScale, yScale } = prepareLinearScene(_Scene, data, size, padding); + const pathCommands = createAreaPathCommands(createXPathCommands(data, xScale, yScale), yScale, stacked); + const areasGroup = new _Scene.Group(); + areasGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + const paths = pathCommands.map((commands) => createPath(_Scene, commands)); + areasGroup.append(paths); + root.append(areasGroup); + return paths; +} +function stackData(data) { + return data.map( + (stack, sindex, array) => stack.map((_y, i) => array.slice(0, sindex + 1).reduce((p, c) => p + c[i], 0)) + ); +} +function normalizeStackData(data) { + const colSum = data.map((_, index) => data.reduce((acc, cur) => Math.max(acc, cur[index]), 0)); + return data.map((stack) => stack.map((y, index) => y / colSum[index] * 19)); +} +function createPolarPaths(agChartsExports, root, data, size, radius, innerRadius, markerSize = 0) { + const { _Scene } = agChartsExports; + const angleScale = new _Scene.LinearScale(); + angleScale.domain = [0, 7]; + angleScale.range = [-Math.PI, Math.PI].map((angle) => angle + Math.PI / 2); + const radiusScale = new _Scene.LinearScale(); + radiusScale.domain = [0, 10]; + radiusScale.range = [radius, innerRadius]; + const markers2 = []; + const center = size / 2; + const paths = data.map((series) => { + const path = new _Scene.Path(); + path.strokeWidth = 1; + path.strokeOpacity = 0.5; + path.lineCap = "round"; + path.fill = void 0; + path.fillOpacity = 0.8; + series.forEach((datum, i) => { + const angle = angleScale.convert(i); + const r = radius + innerRadius - radiusScale.convert(datum); + const x = r * Math.cos(angle) + center; + const y = r * Math.sin(angle) + center; + path.path[i > 0 ? "lineTo" : "moveTo"](x, y); + if (markerSize > 0) { + const marker = new _Scene.Marker({ shape: "circle" }); + marker.x = x; + marker.y = y; + marker.size = markerSize; + markers2.push(marker); + } + }); + path.path.closePath(); + return path; + }); + const group = new _Scene.Group(); + group.append([...paths, ...markers2]); + root.append(group); + return { paths, markers: markers2 }; +} +function accumulateData(data) { + let [min, max] = [Infinity, -Infinity]; + const processedData = data.reduce((acc, curr, currIndex) => { + const previous = currIndex > 0 ? acc[currIndex - 1] : void 0; + acc[currIndex] ?? (acc[currIndex] = []); + const current = acc[currIndex]; + curr.forEach((datum, datumIndex) => { + if (previous) { + datum += previous[datumIndex]; + } + current[datumIndex] = datum; + if (current[datumIndex] < min) { + min = current[datumIndex]; + } + if (current[datumIndex] > max) { + max = current[datumIndex]; + } + }); + return acc; + }, []); + return { processedData, min, max }; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/funnel/miniFunnel.ts +var FUNNEL_SHAPES = [ + [ + [13, 16], + [13, 12], + [3, 12], + [3, 16] + ], + [ + [12, 11], + [12, 7], + [4, 7], + [4, 11] + ], + [ + [10.125, 6], + [10.125, 1.5], + [5.875, 1.5], + [5.875, 6] + ] +]; +var MiniFunnelClass = class extends MiniChart { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, tooltipName = "funnelTooltip", data = FUNNEL_SHAPES) { + super(container, agChartsExports, tooltipName); + this.shapes = createShapePaths(agChartsExports, this.root, data, this.size, this.padding); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + for (const bar of this.shapes) { + bar.fill = fills[0]; + bar.stroke = strokes[0]; + bar.strokeWidth = 0; + } + } +}; +var MiniFunnel = { + chartType: "funnel", + miniChart: MiniFunnelClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/funnel/miniConeFunnel.ts +var CONE_FUNNEL_SHAPES = [ + [ + [13, 16], + [10.75, 11.5], + [5.25, 11.5], + [3, 16] + ], + [ + [10.75, 11.5], + [8.875, 6], + [7.125, 6], + [5.25, 11.5] + ], + [ + [8.875, 6], + [8.875, 1.5], + [7.125, 1.5], + [7.125, 6] + ] +]; +var MiniConeFunnelClass = class extends MiniFunnelClass { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, tooltipName = "coneFunnelTooltip") { + super(container, agChartsExports, fills, strokes, _isCustomTheme, tooltipName, CONE_FUNNEL_SHAPES); + } + updateColors(fills, strokes) { + this.shapes.forEach((bar, i) => { + bar.fill = fills[0]; + bar.fillOpacity = 1 - i * 0.2; + bar.stroke = strokes[0]; + bar.strokeWidth = 0; + }); + } +}; +var MiniConeFunnel = { + chartType: "coneFunnel", + miniChart: MiniConeFunnelClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/funnel/miniPyramid.ts +var PYRAMID_SHAPES = [ + [ + [8, 16], + [10, 12], + [6, 12] + ], + [ + [10.5, 11], + [12.5, 7], + [3.5, 7], + [5.5, 11] + ], + [ + [13, 6], + [15.5, 1.5], + [0.5, 1.5], + [3, 6] + ] +]; +var MiniPyramidClass = class extends MiniFunnelClass { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, tooltipName = "pyramidTooltip") { + super(container, agChartsExports, fills, strokes, _isCustomTheme, tooltipName, PYRAMID_SHAPES); + } + updateColors(fills, strokes) { + this.shapes.forEach((bar, i) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + bar.strokeWidth = 0; + }); + } +}; +var MiniPyramid = { + chartType: "pyramid", + miniChart: MiniPyramidClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/miniChartWithAxes.ts +var MiniChartWithAxes = class extends MiniChart { + constructor(container, agChartsExports, tooltipName) { + super(container, agChartsExports, tooltipName); + this.stroke = "gray"; + this.axisOvershoot = 3; + } + postConstruct() { + const { _Scene } = this.agChartsExports; + const size = this.size; + const padding = this.padding; + const leftAxis = new _Scene.Line(); + leftAxis.x1 = padding; + leftAxis.y1 = padding; + leftAxis.x2 = padding; + leftAxis.y2 = size - padding + this.axisOvershoot; + leftAxis.stroke = this.stroke; + const bottomAxis = new _Scene.Line(); + bottomAxis.x1 = padding - this.axisOvershoot + 1; + bottomAxis.y1 = size - padding; + bottomAxis.x2 = size - padding + 1; + bottomAxis.y2 = size - padding; + bottomAxis.stroke = this.stroke; + const root = this.root; + root.append(leftAxis); + root.append(bottomAxis); + super.postConstruct(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/column/miniColumn.ts +var MiniColumnClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "groupedColumnTooltip"); + this.columnData = [2, 3, 4]; + const { root, columnData, size, padding } = this; + this.columns = createColumnRects({ + stacked: false, + root, + data: columnData, + size, + padding, + xScaleDomain: [0, 1, 2], + yScaleDomain: [0, 4], + xScalePadding: 0.3, + agChartsExports + }); + root.append(this.columns); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.columns.forEach((column, i) => { + column.fill = fills[i]; + column.stroke = strokes[i]; + }); + } +}; +var MiniColumn = { + chartType: "groupedColumn", + miniChart: MiniColumnClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/column/miniStackedColumn.ts +import { _flatten } from "ag-grid-community"; +var miniStackedColumnData = [ + [8, 12, 16], + [6, 9, 12], + [2, 3, 4] +]; +var MiniStackedColumnClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniStackedColumnData, yScaleDomain = [0, 16], tooltipName = "stackedColumnTooltip") { + super(container, agChartsExports, tooltipName); + const { root, size, padding } = this; + this.stackedColumns = createColumnRects({ + stacked: true, + root, + data, + size, + padding, + xScaleDomain: [0, 1, 2], + yScaleDomain, + xScalePadding: 0.3, + agChartsExports + }); + root.append(_flatten(this.stackedColumns)); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.stackedColumns.forEach((series, i) => { + for (const column of series) { + column.fill = fills[i]; + column.stroke = strokes[i]; + } + }); + } +}; +var MiniStackedColumn = { + chartType: "stackedColumn", + miniChart: MiniStackedColumnClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/column/miniNormalizedColumn.ts +var miniNormalizedColumnData = [ + [10, 10, 10], + [6, 7, 8], + [2, 4, 6] +]; +var MiniNormalizedColumnClass = class extends MiniStackedColumnClass { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super( + container, + agChartsExports, + fills, + strokes, + isCustomTheme, + miniNormalizedColumnData, + [0, 10], + "normalizedColumnTooltip" + ); + } +}; +var MiniNormalizedColumn = { + chartType: "normalizedColumn", + miniChart: MiniNormalizedColumnClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/bar/miniBar.ts +var MiniBarClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "groupedBarTooltip"); + const { _Scene } = agChartsExports; + const padding = this.padding; + const size = this.size; + const data = [2, 3, 4]; + const yScale = new _Scene.CategoryScale(); + yScale.domain = [0, 1, 2]; + yScale.range = [padding, size - padding]; + yScale.paddingInner = 0.3; + yScale.paddingOuter = 0.3; + const xScale = new _Scene.LinearScale(); + xScale.domain = [0, 4]; + xScale.range = [size - padding, padding]; + const bottom = xScale.convert(0); + const height = yScale.bandwidth; + this.bars = data.map((datum, i) => { + const rect = new _Scene.Rect(); + rect.x = padding; + rect.y = yScale.convert(i); + rect.width = bottom - xScale.convert(datum); + rect.height = height; + rect.strokeWidth = 0; + rect.crisp = true; + return rect; + }); + this.updateColors(fills, strokes); + this.root.append(this.bars); + } + updateColors(fills, strokes) { + this.bars.forEach((bar, i) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + }); + } +}; +var MiniBar = { + chartType: "groupedBar", + miniChart: MiniBarClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/bar/miniStackedBar.ts +import { _flatten as _flatten2 } from "ag-grid-community"; +var miniStackedBarData = [ + [8, 12, 16], + [6, 9, 12], + [2, 3, 4] +]; +var MiniStackedBarClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniStackedBarData, xScaleDomain = [0, 16], tooltipName = "stackedBarTooltip") { + super(container, agChartsExports, tooltipName); + const { _Scene } = agChartsExports; + const size = this.size; + const padding = this.padding; + const yScale = new _Scene.CategoryScale(); + yScale.domain = [0, 1, 2]; + yScale.range = [padding, size - padding]; + yScale.paddingInner = 0.3; + yScale.paddingOuter = 0.3; + const xScale = new _Scene.LinearScale(); + xScale.domain = xScaleDomain; + xScale.range = [size - padding, padding]; + const bottom = xScale.convert(0); + const height = yScale.bandwidth; + this.bars = data.map( + (series) => series.map((datum, i) => { + const rect = new _Scene.Rect(); + rect.x = padding; + rect.y = yScale.convert(i); + rect.width = bottom - xScale.convert(datum); + rect.height = height; + rect.strokeWidth = 0; + rect.crisp = true; + return rect; + }) + ); + this.updateColors(fills, strokes); + this.root.append(_flatten2(this.bars)); + } + updateColors(fills, strokes) { + this.bars.forEach( + (series, i) => series.forEach((bar) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + }) + ); + } +}; +var MiniStackedBar = { + chartType: "stackedBar", + miniChart: MiniStackedBarClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/bar/miniNormalizedBar.ts +var miniNormalizedBarData = [ + [10, 10, 10], + [6, 7, 8], + [2, 4, 6] +]; +var MiniNormalizedBarClass = class extends MiniStackedBarClass { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super( + container, + agChartsExports, + fills, + strokes, + isCustomTheme, + miniNormalizedBarData, + [0, 10], + "normalizedBarTooltip" + ); + } +}; +var MiniNormalizedBar = { + chartType: "normalizedBar", + miniChart: MiniNormalizedBarClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/pie/miniDonut.ts +var MiniDonutClass = class extends MiniChart { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, centerRadiusScaler = 0.6, tooltipName = "donutTooltip") { + super(container, agChartsExports, tooltipName); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const radius = (size - padding * 2) / 2; + const center = radius + padding; + const toRadians = _Scene.toRadians; + const angles = [ + [toRadians(-90), toRadians(30)], + [toRadians(30), toRadians(120)], + [toRadians(120), toRadians(180)], + [toRadians(180), toRadians(210)], + [toRadians(210), toRadians(240)], + [toRadians(240), toRadians(270)] + ]; + this.sectors = angles.map(([startAngle, endAngle]) => { + const sector = new _Scene.Sector(); + sector.centerX = center; + sector.centerY = center; + sector.innerRadius = radius * centerRadiusScaler; + sector.outerRadius = radius; + sector.startAngle = startAngle; + sector.endAngle = endAngle; + sector.stroke = void 0; + sector.strokeWidth = 0; + sector.inset = 0.75; + return sector; + }); + this.updateColors(fills, strokes); + this.root.append(this.sectors); + } + updateColors(fills, strokes) { + this.sectors.forEach((sector, i) => { + sector.fill = fills[i % fills.length]; + sector.stroke = strokes[i % strokes.length]; + }); + } +}; +var MiniDonut = { + chartType: "donut", + miniChart: MiniDonutClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/pie/miniPie.ts +var MiniPieClass = class extends MiniDonutClass { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super(container, agChartsExports, fills, strokes, isCustomTheme, 0, "pieTooltip"); + } +}; +var MiniPie = { + chartType: "pie", + miniChart: MiniPieClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/line/miniLine.ts +var miniLineData = [ + [1, 3, 5], + [2, 6, 4], + [5, 3, 1] +]; +var MiniLineClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniLineData, tooltipName = "lineTooltip") { + super(container, agChartsExports, tooltipName); + const { size, padding, root } = this; + this.lines = createLinePaths(agChartsExports, root, data, size, padding); + this.updateColors(fills, strokes); + } + updateColors(fills, _strokes) { + this.lines.forEach((line, i) => { + line.stroke = fills[i]; + }); + } +}; +var MiniLine = { + chartType: "line", + miniChart: MiniLineClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/line/miniStackedLine.ts +var miniStackedLineData = stackData(miniLineData); +var MiniStackedLineClass = class extends MiniLineClass { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniStackedLineData, tooltipName = "stackedLineTooltip") { + super(container, agChartsExports, fills, strokes, _isCustomTheme, data, tooltipName); + } +}; +var MiniStackedLine = { + chartType: "stackedLine", + miniChart: MiniStackedLineClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/line/miniNormalizedLine.ts +var miniNormalizedLineData = normalizeStackData(miniStackedLineData); +var MiniNormalizedLineClass = class extends MiniLineClass { + constructor(container, agChartsExports, fills, strokes, isCustomTheme, data = miniNormalizedLineData, tooltipName = "normalizedLineTooltip") { + super(container, agChartsExports, fills, strokes, isCustomTheme, data, tooltipName); + } +}; +var MiniNormalizedLine = { + chartType: "normalizedLine", + miniChart: MiniNormalizedLineClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/scatter/miniScatter.ts +var MiniScatterClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "scatterTooltip"); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const data = [ + [ + [0.3, 3], + [1.1, 0.9], + [2, 0.4], + [3.4, 2.4] + ], + [ + [0, 0.3], + [1, 2], + [2.4, 1.4], + [3, 0] + ] + ]; + const xScale = new _Scene.LinearScale(); + xScale.domain = [-0.5, 4]; + xScale.range = [padding * 2, size - padding]; + const yScale = new _Scene.LinearScale(); + yScale.domain = [-0.5, 3.5]; + yScale.range = [size - padding, padding]; + const points = []; + data.forEach((series) => { + series.forEach(([x, y]) => { + const arc = new _Scene.Arc(); + arc.strokeWidth = 0; + arc.centerX = xScale.convert(x); + arc.centerY = yScale.convert(y); + arc.radius = 2.5; + points.push(arc); + }); + }); + this.points = points; + this.updateColors(fills, strokes); + const pointsGroup = new _Scene.Group(); + pointsGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + pointsGroup.append(this.points); + this.root.append(pointsGroup); + } + updateColors(fills, strokes) { + this.points.forEach((line, i) => { + line.stroke = strokes[i % strokes.length]; + line.fill = fills[i % fills.length]; + }); + } +}; +var MiniScatter = { + chartType: "scatter", + miniChart: MiniScatterClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/scatter/miniBubble.ts +var MiniBubbleClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "bubbleTooltip"); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const data = [ + [ + [0.1, 0.3, 5], + [0.5, 0.4, 7], + [0.2, 0.8, 7] + ], + [ + [0.8, 0.7, 5], + [0.7, 0.3, 9] + ] + ]; + const xScale = new _Scene.LinearScale(); + xScale.domain = [0, 1]; + xScale.range = [padding * 2, size - padding]; + const yScale = new _Scene.LinearScale(); + yScale.domain = [0, 1]; + yScale.range = [size - padding, padding]; + const points = []; + data.forEach((series) => { + series.forEach(([x, y, radius]) => { + const arc = new _Scene.Arc(); + arc.strokeWidth = 0; + arc.centerX = xScale.convert(x); + arc.centerY = yScale.convert(y); + arc.radius = radius; + arc.fillOpacity = 0.7; + points.push(arc); + }); + }); + this.points = points; + this.updateColors(fills, strokes); + const pointsGroup = new _Scene.Group(); + pointsGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + pointsGroup.append(this.points); + this.root.append(pointsGroup); + } + updateColors(fills, strokes) { + this.points.forEach((line, i) => { + line.stroke = strokes[i % strokes.length]; + line.fill = fills[i % fills.length]; + }); + } +}; +var MiniBubble = { + chartType: "bubble", + miniChart: MiniBubbleClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/area/miniArea.ts +var miniAreaData = miniLineData; +var MiniAreaClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniAreaData, tooltipName = "groupedAreaTooltip", stacked = false) { + super(container, agChartsExports, tooltipName); + this.areas = createAreaPaths(agChartsExports._Scene, this.root, data, this.size, this.padding, stacked); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.areas.forEach((area, i) => { + area.fill = fills[i]; + area.stroke = strokes[i]; + area.strokeWidth = 1; + area.strokeOpacity = 0.75; + area.fillOpacity = 0.7; + }); + } +}; +var MiniArea = { + chartType: "area", + miniChart: MiniAreaClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/area/miniStackedArea.ts +var miniStackedAreaData = stackData(miniAreaData); +var MiniStackedAreaClass = class extends MiniAreaClass { + constructor(container, agChartsExports, fills, strokes, _isCustomTheme, data = miniStackedAreaData, tooltipName = "stackedAreaTooltip") { + super(container, agChartsExports, fills, strokes, _isCustomTheme, data, tooltipName, true); + } + updateColors(fills, strokes) { + this.areas.forEach((area, i) => { + area.fill = fills[i]; + area.stroke = strokes[i]; + }); + } +}; +var MiniStackedArea = { + chartType: "stackedArea", + miniChart: MiniStackedAreaClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/area/miniNormalizedArea.ts +var miniNormalizedAreaData = normalizeStackData(miniStackedAreaData); +var MiniNormalizedAreaClass = class extends MiniStackedAreaClass { + constructor(container, agChartsExports, fills, strokes, isCustomTheme, data = miniNormalizedAreaData, tooltipName = "normalizedAreaTooltip") { + super(container, agChartsExports, fills, strokes, isCustomTheme, data, tooltipName); + } +}; +var MiniNormalizedArea = { + chartType: "normalizedArea", + miniChart: MiniNormalizedAreaClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/histogram/miniHistogram.ts +var MiniHistogramClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "histogramTooltip"); + const { + padding, + size, + agChartsExports: { _Scene } + } = this; + const data = [2, 5, 11, 13, 10, 6, 1]; + const xScale = new _Scene.LinearScale(); + xScale.domain = [0, data.length]; + xScale.range = [padding, size - padding]; + const yScale = new _Scene.LinearScale(); + yScale.domain = [0, data.reduce((a, b) => Math.max(a, b), 0)]; + yScale.range = [size - padding, padding]; + const bottom = yScale.convert(0); + this.bars = data.map((datum, i) => { + const top = yScale.convert(datum); + const left = xScale.convert(i); + const right = xScale.convert(i + 1); + const rect = new _Scene.Rect(); + rect.x = left; + rect.y = top; + rect.width = right - left; + rect.height = bottom - top; + rect.strokeWidth = 1; + rect.strokeOpacity = 0.75; + rect.crisp = true; + return rect; + }); + this.updateColors(fills, strokes); + this.root.append(this.bars); + } + updateColors([fill], [stroke]) { + for (const bar of this.bars) { + bar.fill = fill; + bar.stroke = stroke; + } + } +}; +var MiniHistogram = { + chartType: "histogram", + miniChart: MiniHistogramClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/miniChartWithPolarAxes.ts +var MiniChartWithPolarAxes = class extends MiniChart { + constructor(container, agChartsExports, tooltipName) { + super(container, agChartsExports, tooltipName); + this.stroke = "gray"; + this.showRadiusAxisLine = true; + this.showAngleAxisLines = true; + } + postConstruct() { + const { _Scene } = this.agChartsExports; + const size = this.size; + const padding = this.padding; + const combinedPadding = padding * 2; + const axisLineRadius = (size - combinedPadding) / 2; + const gridRadii = this.showAngleAxisLines ? [axisLineRadius, axisLineRadius * 0.8, axisLineRadius * 0.6, axisLineRadius * 0.4] : []; + const radiusAxisLine = new _Scene.Line(); + radiusAxisLine.x1 = size / 2; + radiusAxisLine.y1 = padding; + radiusAxisLine.x2 = size / 2; + radiusAxisLine.y2 = size - padding - axisLineRadius - gridRadii[gridRadii.length - 1]; + radiusAxisLine.stroke = this.stroke; + radiusAxisLine.strokeOpacity = 0.5; + radiusAxisLine.fill = void 0; + radiusAxisLine.visible = this.showRadiusAxisLine; + const x = padding + axisLineRadius; + this.gridLines = gridRadii.map((radius, index) => { + const gridLine = new _Scene.Path(); + gridLine.path.arc(x, x, radius, 0, 2 * Math.PI); + gridLine.strokeWidth = 1; + gridLine.stroke = this.stroke; + gridLine.strokeOpacity = index === 0 ? 0.5 : 0.2; + gridLine.fill = void 0; + return gridLine; + }); + const root = this.root; + root.append(radiusAxisLine); + if (this.gridLines.length > 0) { + root.append(this.gridLines); + } + super.postConstruct(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/polar/miniRadialColumn.ts +var MiniRadialColumnClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "radialColumnTooltip"); + this.data = [ + [6, 8, 10, 2, 6, 5], + [4, 4, 3, 6, 4, 4], + [5, 4, 2, 9, 8, 9] + ]; + this.showRadiusAxisLine = false; + const { + padding, + size, + data, + agChartsExports: { _Scene } + } = this; + const radius = (size - padding * 2) / 2; + const innerRadiusRatio = 0.4; + const axisInnerRadius = radius * innerRadiusRatio; + const angleScale = new _Scene.CategoryScale(); + angleScale.domain = data[0].map((_, index) => index); + angleScale.range = [0, 2 * Math.PI]; + angleScale.paddingInner = 0; + angleScale.paddingOuter = 0; + const bandwidth = angleScale.bandwidth * 0.7; + const { processedData, max } = accumulateData(data); + const radiusScale = new _Scene.LinearScale(); + radiusScale.domain = [0, max]; + radiusScale.range = [axisInnerRadius, radius]; + const center = this.size / 2; + this.series = processedData.map((series, seriesIndex) => { + const firstSeries = seriesIndex === 0; + const previousSeries = firstSeries ? void 0 : processedData[seriesIndex - 1]; + const seriesGroup = new _Scene.TranslatableGroup({ zIndex: 1e6 }); + const seriesColumns = series.map((datum, i) => { + const previousDatum = previousSeries?.[i]; + const outerRadius = radiusScale.convert(datum); + const innerRadius = radiusScale.convert(previousDatum ?? 0); + const startAngle = angleScale.convert(i); + const endAngle = startAngle + bandwidth; + const columnWidth = _Scene.getRadialColumnWidth(startAngle, endAngle, radius, 0.5, 0.5); + const column = new _Scene.RadialColumnShape(); + column.columnWidth = columnWidth; + column.innerRadius = innerRadius; + column.outerRadius = outerRadius; + column.startAngle = startAngle; + column.endAngle = endAngle; + column.isBeveled = true; + column.axisInnerRadius = axisInnerRadius; + column.axisOuterRadius = radius; + column.stroke = void 0; + column.strokeWidth = 0; + return column; + }); + seriesGroup.append(seriesColumns); + seriesGroup.translationX = center; + seriesGroup.translationY = center; + return seriesGroup; + }); + this.root.append(this.series); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.series.forEach((group, i) => { + for (const sector of group.children()) { + sector.fill = fills[i % fills.length]; + sector.stroke = strokes[i % strokes.length]; + } + }); + } +}; +var MiniRadialColumn = { + chartType: "radialColumn", + miniChart: MiniRadialColumnClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/polar/miniRadialBar.ts +var MiniRadialBarClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "radialBarTooltip"); + this.data = [ + [6, 8, 10], + [4, 4, 3], + [5, 4, 2] + ]; + this.showRadiusAxisLine = false; + const { + size, + padding, + data, + agChartsExports: { _Scene } + } = this; + const radius = (size - padding) / 2; + const innerRadiusRatio = 0.4; + const innerRadius = radius * innerRadiusRatio; + const radiusScale = new _Scene.CategoryScale(); + radiusScale.domain = data[0].map((_, index) => index); + radiusScale.range = [innerRadius, radius]; + radiusScale.paddingInner = 0.5; + radiusScale.paddingOuter = 0; + const bandwidth = radiusScale.bandwidth; + const { processedData, max } = accumulateData(data); + const angleScale = new _Scene.LinearScale(); + angleScale.domain = [0, Math.ceil(max * 1.5)]; + const start = 3 / 2 * Math.PI; + const end = start + 2 * Math.PI; + angleScale.range = [start, end]; + const center = size / 2; + this.series = processedData.map((series, index) => { + const previousSeries = index < 0 ? void 0 : processedData[index - 1]; + const seriesGroup = new _Scene.Group({ zIndex: 1e6 }); + const seriesSectors = series.map((datum, i) => { + const previousDatum = previousSeries?.[i] ?? 0; + const outerRadius = radiusScale.convert(i); + const innerRadius2 = outerRadius - bandwidth; + const startAngle = angleScale.convert(previousDatum); + const endAngle = angleScale.convert(datum); + const sector = new _Scene.Sector(); + sector.centerX = center; + sector.centerY = center; + sector.innerRadius = innerRadius2; + sector.outerRadius = outerRadius; + sector.startAngle = startAngle; + sector.endAngle = endAngle; + sector.stroke = void 0; + sector.strokeWidth = 0; + return sector; + }); + seriesGroup.append(seriesSectors); + return seriesGroup; + }); + this.root.append(this.series); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.series.forEach((group, i) => { + for (const sector of group.children()) { + sector.fill = fills[i % fills.length]; + sector.stroke = strokes[i % strokes.length]; + } + }); + } +}; +var MiniRadialBar = { + chartType: "radialBar", + miniChart: MiniRadialBarClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/polar/miniRadarLine.ts +var MiniRadarLineClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "radarLineTooltip"); + this.markerSize = 4; + this.data = [ + [8, 7, 8, 7, 8, 8, 7, 8], + [6, 8, 5, 10, 6, 7, 4, 6], + [0, 3, 3, 5, 4, 4, 2, 0] + ]; + this.showRadiusAxisLine = false; + const { size, padding, root, data } = this; + const radius = (size - padding * 2) / 2; + const innerRadius = 0; + const { paths, markers: markers2 } = createPolarPaths( + agChartsExports, + root, + data, + size, + radius, + innerRadius, + this.markerSize + ); + this.lines = paths; + this.markers = markers2; + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.lines.forEach((line, i) => { + const n = this.data[i].length; + line.stroke = fills[i]; + const startIdx = i * n; + const endIdx = startIdx + n; + const markers2 = this.markers.slice(startIdx, endIdx); + for (const marker of markers2) { + marker.stroke = strokes[i]; + marker.fill = fills[i]; + } + }); + } +}; +var MiniRadarLine = { + chartType: "radarLine", + miniChart: MiniRadarLineClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/polar/miniRadarArea.ts +var MiniRadarAreaClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "radarAreaTooltip"); + this.data = [ + [8, 10, 5, 7, 4, 1, 5, 8], + [1, 1, 2, 7, 7, 8, 10, 1], + [4, 5, 9, 9, 4, 2, 3, 4] + ]; + const { size, padding, root, data } = this; + this.showRadiusAxisLine = false; + const radius = (size - padding * 2) / 2; + const innerRadius = radius - size * 0.3; + this.areas = createPolarPaths(agChartsExports, root, data, size, radius, innerRadius).paths; + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.areas.forEach((area, i) => { + area.fill = fills[i]; + area.stroke = strokes[i]; + }); + } +}; +var MiniRadarArea = { + chartType: "radarArea", + miniChart: MiniRadarAreaClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/polar/miniNightingale.ts +var MiniNightingaleClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "nightingaleTooltip"); + this.data = [ + [6, 10, 9, 8, 7, 8], + [4, 6, 5, 4, 5, 5], + [3, 5, 4, 3, 4, 7] + ]; + this.showRadiusAxisLine = false; + const { + size, + padding, + data, + agChartsExports: { _Scene } + } = this; + const radius = (size - padding * 2) / 2; + const angleScale = new _Scene.CategoryScale(); + angleScale.domain = data[0].map((_, index) => index); + angleScale.range = [-Math.PI, Math.PI]; + angleScale.paddingInner = 0; + angleScale.paddingOuter = 0; + const bandwidth = angleScale.bandwidth * 0.7; + const { processedData, max } = accumulateData(data); + const radiusScale = new _Scene.LinearScale(); + radiusScale.domain = [0, max]; + radiusScale.range = [0, radius]; + const center = size / 2; + this.series = processedData.map((series, index) => { + const previousSeries = index < 0 ? void 0 : processedData[index - 1]; + const seriesGroup = new _Scene.Group({ zIndex: 1e6 }); + const seriesSectors = series.map((datum, i) => { + const previousDatum = previousSeries?.[i]; + const outerRadius = radiusScale.convert(datum); + const innerRadius = radiusScale.convert(previousDatum ?? 0); + const startAngle = angleScale.convert(i); + const endAngle = startAngle + bandwidth; + const sector = new _Scene.Sector(); + sector.centerX = center; + sector.centerY = center; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.startAngle = startAngle; + sector.endAngle = endAngle; + sector.stroke = void 0; + sector.strokeWidth = 0; + return sector; + }); + seriesGroup.append(seriesSectors); + return seriesGroup; + }); + this.root.append(this.series); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.series.forEach((group, i) => { + for (const sector of group.children()) { + sector.fill = fills[i % fills.length]; + sector.stroke = strokes[i % strokes.length]; + } + }); + } +}; +var MiniNightingale = { + chartType: "nightingale", + miniChart: MiniNightingaleClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/statistical/miniRangeBar.ts +var MiniRangeBarClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "rangeBarTooltip"); + const data = [3, 3.5, 3]; + this.bars = this.createRangeBar(this.root, data, this.size, this.padding, "vertical"); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.bars.forEach((bar, i) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + }); + } + createRangeBar(root, data, size, padding, direction) { + const barAlongX = direction === "horizontal"; + const scalePadding = 2 * padding; + const { _Scene } = this.agChartsExports; + const xScale = new _Scene.CategoryScale(); + xScale.domain = data.map((_, index) => index); + xScale.range = [padding, size - padding]; + xScale.paddingInner = 0.3; + xScale.paddingOuter = 0.3; + const lowRatio = 0.7; + const highRatio = 1.3; + const yScale = new _Scene.LinearScale(); + yScale.domain = [ + data.reduce((a, b) => Math.min(a, b), Infinity) * lowRatio, + data.reduce((a, b) => Math.max(a, b), 0) * highRatio + ]; + yScale.range = [scalePadding, size - scalePadding]; + const width = xScale.bandwidth; + const bars = data.map((datum, i) => { + const [low, high] = [datum * lowRatio, datum * highRatio]; + const x = xScale.convert(i); + const y = yScale.convert(low); + const height = yScale.convert(high) - y; + const rect = new _Scene.Rect(); + rect.x = barAlongX ? y : x; + rect.y = barAlongX ? x : y; + rect.width = barAlongX ? height : width; + rect.height = barAlongX ? width : height; + rect.strokeWidth = 0; + rect.crisp = true; + return rect; + }); + root.append(bars); + return bars; + } +}; +var MiniRangeBar = { + chartType: "rangeBar", + miniChart: MiniRangeBarClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/statistical/miniRangeArea.ts +var MiniRangeAreaClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "rangeAreaTooltip"); + const period = 4; + const dataSeriesMidpoints = [ + zigzag({ offset: 0.375 * period, length: period, pattern: { low: 3, high: 5, period } }), + zigzag({ offset: 0.375 * period, length: period, pattern: { low: 2.25, high: 4.25, period } }), + zigzag({ offset: 0.75 * period, length: period, pattern: { low: 2.5, high: 4.5, period } }) + ]; + const dataSeriesWidth = 1.75; + const data = dataSeriesMidpoints.map( + (series) => series.map(([x, y]) => ({ + x, + low: y - 0.5 * dataSeriesWidth, + high: y + 0.5 * dataSeriesWidth + })) + ); + const { lines, areas } = this.createRangeArea(this.root, data, this.size, this.padding); + this.lines = lines; + this.areas = areas; + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + fills = swapArrayItems(fills, 1, 2); + strokes = swapArrayItems(strokes, 1, 2); + this.lines.forEach(([highLine, lowLine], i) => { + highLine.fill = void 0; + highLine.stroke = strokes[i]; + lowLine.fill = void 0; + lowLine.stroke = strokes[i]; + }); + this.areas.forEach((area, i) => { + area.fill = fills[i]; + }); + } + createRangeArea(root, data, size, padding) { + const xMin = data.reduce((acc, series) => series.reduce((acc2, { x }) => Math.min(acc2, x), acc), Infinity); + const xMax = data.reduce((acc, series) => series.reduce((acc2, { x }) => Math.max(acc2, x), acc), -Infinity); + const yMin = data.reduce((acc, series) => series.reduce((acc2, { low }) => Math.min(acc2, low), acc), Infinity); + const yMax = data.reduce( + (acc, series) => series.reduce((acc2, { high }) => Math.max(acc2, high), acc), + -Infinity + ); + const { _Scene } = this.agChartsExports; + const xScale = new _Scene.LinearScale(); + xScale.domain = [xMin, xMax]; + xScale.range = [padding, size - padding]; + const scalePadding = 2 * padding; + const yScale = new _Scene.LinearScale(); + yScale.domain = [yMin, yMax]; + yScale.range = [size - scalePadding, scalePadding]; + const lines = []; + const areas = []; + const lowPoints = data.map((series) => { + const highLine = new _Scene.Path(); + const lowLine = new _Scene.Path(); + const area = new _Scene.Path(); + lines.push([highLine, lowLine]); + areas.push(area); + highLine.strokeWidth = 0; + lowLine.strokeWidth = 0; + area.strokeWidth = 0; + area.fillOpacity = 0.8; + highLine.path.clear(); + lowLine.path.clear(); + area.path.clear(); + return series.map((datum, datumIndex) => { + const { x, low, high } = datum; + const scaledX = xScale.convert(x); + const yLow = yScale.convert(low); + const yHigh = yScale.convert(high); + const command = datumIndex > 0 ? "lineTo" : "moveTo"; + highLine.path[command](scaledX, yHigh); + lowLine.path[command](scaledX, yLow); + area.path[command](scaledX, yHigh); + return [scaledX, yLow]; + }); + }); + lowPoints.forEach((seriesLowPoints, seriesIndex) => { + const n = seriesLowPoints.length - 1; + const area = areas[seriesIndex]; + for (let datumIndex = n; datumIndex >= 0; datumIndex--) { + const [x, y] = seriesLowPoints[datumIndex]; + area.path["lineTo"](x, y); + } + }); + root.append(areas.concat(...lines)); + return { lines, areas }; + } +}; +function zigzag(options) { + const { offset, length, pattern } = options; + const points = getZigzagInflectionPoints(offset, length, pattern); + const xMin = 0; + const xMax = length; + if (points.length === 0 || points[0][0] !== xMin) { + points.unshift(getZigzagPoint(xMin, offset, pattern)); + } + if (points[points.length - 1][0] !== xMax) { + points.push(getZigzagPoint(xMax, offset, pattern)); + } + return points; + function getZigzagInflectionPoints(offset2, length2, pattern2) { + const { period } = pattern2; + const scaledOffset = offset2 / period; + const patternInflectionPoints = [0, 0.5]; + const inflectionPoints = patternInflectionPoints.map((x) => x - scaledOffset).map(getRemainderAbs).sort((a, b) => a - b); + const repeatedPoints = Array.from( + { length: Math.floor(inflectionPoints.length * (period / length2)) }, + (_, i) => inflectionPoints[i % inflectionPoints.length] + Math.floor(i / inflectionPoints.length) + ); + return repeatedPoints.map((x) => x * period).map((x) => getZigzagPoint(x, offset2, pattern2)); + } + function getZigzagPoint(x, offset2, pattern2) { + return [x, getZigzagValue(offset2 + x, pattern2)]; + } + function getZigzagValue(x, pattern2) { + const { low, high, period } = pattern2; + const scaledX = getRemainderAbs(x / period); + const y = scaledX > 0.5 ? 1 - 2 * (scaledX - 0.5) : 2 * scaledX; + return low + (high - low) * y; + } +} +function getRemainderAbs(value) { + const remainder = value % 1; + return remainder < 0 ? remainder + 1 : remainder; +} +function swapArrayItems(items, leftIndex, rightIndex) { + const results = [...items]; + const temp = results[leftIndex]; + results[leftIndex] = results[rightIndex]; + results[rightIndex] = temp; + return results; +} +var MiniRangeArea = { + chartType: "rangeArea", + miniChart: MiniRangeAreaClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/statistical/miniBoxPlot.ts +var MiniBoxPlotClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super(container, agChartsExports, "boxPlotTooltip"); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const data = [11, 11.5, 10.5]; + const maxRatio = 1.2; + const q3Ratio = 1.1; + const q1Ratio = 0.9; + const minRatio = 0.8; + const yScale = new _Scene.LinearScale(); + yScale.domain = [ + data.reduce((a, b) => Math.min(a, b), Infinity) * minRatio, + data.reduce((a, b) => Math.max(a, b), 0) * maxRatio + ]; + yScale.range = [size - 1.5 * padding, padding]; + const xScale = new _Scene.CategoryScale(); + xScale.domain = data.map((_, index) => index); + xScale.range = [padding, size - padding]; + xScale.paddingInner = 0.4; + xScale.paddingOuter = 0.2; + const bandwidth = Math.round(xScale.bandwidth); + const halfBandWidth = Math.round(xScale.bandwidth / 2); + this.boxPlotGroups = data.map((datum, i) => { + const [minValue, q1Value, q3Value, maxValue] = [ + datum * minRatio, + datum * q1Ratio, + datum * q3Ratio, + datum * maxRatio + ]; + const top = Math.round(yScale.convert(q3Value)); + const left = Math.round(xScale.convert(i)); + const right = Math.round(left + bandwidth); + const bottom = Math.round(yScale.convert(q1Value)); + const min = Math.round(yScale.convert(minValue)); + const mid = Math.round(yScale.convert(datum)); + const max = Math.round(yScale.convert(maxValue)); + const whiskerX = left + halfBandWidth; + const boxPlotGroup = new _Scene.Group(); + const box = new _Scene.Rect(); + const median = new _Scene.Line(); + const topWhisker = new _Scene.Line(); + const bottomWhisker = new _Scene.Line(); + const topCap = new _Scene.Line(); + const bottomCap = new _Scene.Line(); + box.x = left; + box.y = top; + box.width = bandwidth; + box.height = bottom - top; + box.strokeWidth = 1; + box.strokeOpacity = 0.75; + box.crisp = true; + this.setLineProperties(median, left, right, mid, mid); + this.setLineProperties(topWhisker, whiskerX, whiskerX, max, top); + this.setLineProperties(bottomWhisker, whiskerX, whiskerX, min, bottom); + this.setLineProperties(topCap, left, right, max, max); + this.setLineProperties(bottomCap, left, right, min, min); + boxPlotGroup.append([box, median, topWhisker, bottomWhisker, topCap, bottomCap]); + return boxPlotGroup; + }); + this.updateColors(fills, strokes, isCustomTheme); + this.root.append(this.boxPlotGroups); + } + updateColors(fills, strokes, isCustomTheme) { + const { _Theme } = this.agChartsExports; + this.boxPlotGroups.forEach((group, i) => { + for (const node of group.children()) { + const fill = fills[i % fills.length]; + node.fill = isCustomTheme ? fill : _Theme.resolveOperation({ $mix: [fill, { $ref: "backgroundColor" }, 0.7] }); + node.stroke = strokes[i % strokes.length]; + } + }); + } + setLineProperties(line, x1, x2, y1, y2) { + line.x1 = x1; + line.x2 = x2; + line.y1 = y1; + line.y2 = y2; + line.strokeOpacity = 0.75; + } +}; +var MiniBoxPlot = { + chartType: "boxPlot", + miniChart: MiniBoxPlotClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/hierarchical/miniTreemap.ts +var MiniTreemapClass = class extends MiniChart { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super(container, agChartsExports, "treemapTooltip"); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const data = [ + [1, 1], + [3, 2, 1] + ]; + const treeSize = data.length; + const treePadding = treeSize % 2 === 0 ? 0.3 : 0.2; + const range = [padding, size - padding]; + const columns = data.length; + const columnParts = columns * (columns + 1) / 2; + const columnPadding = treePadding / (columns - 1); + const availableRange = range[1] - range[0]; + const availableWidth = availableRange - treePadding; + let previousX = range[0]; + this.rects = data.reduce((rects, d, columnIndex) => { + rects ?? (rects = []); + const widthRatio = (columns - columnIndex) / columnParts; + const width = availableWidth * widthRatio; + const rows = d.length; + const rowParts = d.reduce((parts, ratio) => parts + ratio, 0); + const rowPadding = treePadding / (rows - 1 || 1); + const availableHeight = rows > 1 ? availableRange - treePadding : availableRange; + let previousY = range[0]; + const xRects = d.map((ratio) => { + const rect = new _Scene.Rect(); + const height = availableHeight * ratio / rowParts; + rect.x = previousX; + rect.y = previousY; + rect.width = width; + rect.height = height; + rect.strokeWidth = 0.75; + rect.crisp = true; + previousY += height + rowPadding; + return rect; + }); + previousX += width + columnPadding; + rects.push(...xRects); + return rects; + }, []); + this.updateColors(fills, strokes, isCustomTheme); + const rectGroup = new _Scene.Group(); + rectGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding, size - padding)); + rectGroup.append(this.rects); + this.root.append(rectGroup); + } + updateColors(fills, strokes, isCustomTheme) { + const { _Theme } = this.agChartsExports; + this.rects.forEach((rect, i) => { + rect.fill = fills[i % strokes.length]; + rect.stroke = isCustomTheme ? strokes[i % strokes.length] : _Theme.resolveOperation({ $ref: "backgroundColor" }); + }); + } +}; +var MiniTreemap = { + chartType: "treemap", + miniChart: MiniTreemapClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/hierarchical/miniSunburst.ts +var MiniSunburstClass = class extends MiniChartWithPolarAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "sunburstTooltip"); + // Hierarchical data using multidimensional array + this.data = [ + [[], []], + [[], []], + [[], []] + ]; + // Rotate the chart by the given angle (-90 degrees) + this.angleOffset = -Math.PI / 2; + this.innerRadiusRatio = 0; + this.showRadiusAxisLine = false; + this.showAngleAxisLines = false; + const { + data, + size, + padding, + angleOffset, + innerRadiusRatio, + agChartsExports: { _Scene } + } = this; + const radius = (size - padding * 2) / 2; + const angleRange = [angleOffset + 0, angleOffset + 2 * Math.PI]; + const angleExtent = Math.abs(angleRange[1] - angleRange[0]); + const radiusRange = [radius * innerRadiusRatio, radius]; + const radiusExtent = Math.abs(radiusRange[1] - radiusRange[0]); + let maxDepth = 0; + const findMaxDepth = (data2, parentDepth) => { + for (const child of data2) { + const depth = parentDepth + 1; + maxDepth = Math.max(maxDepth, depth); + findMaxDepth(child, depth); + } + }; + findMaxDepth(data, 0); + const radiusRatio = radiusExtent / maxDepth; + const center = this.size / 2; + const startAngle = angleRange[0]; + this.series = []; + const createSectors = (data2, depth, startAngle2, availableAngle, group) => { + const isArray = Array.isArray(data2); + if (!isArray) { + return; + } + const childDepth = depth + 1; + let previousAngle = startAngle2; + data2.forEach((child, childIndex, children) => { + let childGroup = group; + if (!childGroup) { + childGroup = new _Scene.Group(); + this.series.push(childGroup); + } + const innerRadius = radiusRange[0] + depth * radiusRatio; + const outerRadius = radiusRange[0] + childDepth * radiusRatio; + const angleRatio = 1 / children.length; + const start = previousAngle; + const end = start + availableAngle * angleRatio; + const sector = new _Scene.Sector(); + sector.centerX = center; + sector.centerY = center; + sector.innerRadius = innerRadius; + sector.outerRadius = outerRadius; + sector.startAngle = start; + sector.endAngle = end; + sector.stroke = void 0; + sector.strokeWidth = 0; + sector.inset = 0.75; + previousAngle = end; + childGroup.append(sector); + createSectors(child, childDepth, start, Math.abs(end - start), childGroup); + }); + }; + createSectors(data, 0, startAngle, angleExtent); + this.root.append(this.series); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.series.forEach((group, i) => { + for (const sector of group.children()) { + sector.fill = fills[i % fills.length]; + sector.stroke = strokes[i % strokes.length]; + } + }); + } +}; +var MiniSunburst = { + chartType: "sunburst", + miniChart: MiniSunburstClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/specialized/miniHeatmap.ts +var MiniHeatmapClass = class extends MiniChart { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super(container, agChartsExports, "heatmapTooltip"); + const { + size, + padding, + agChartsExports: { _Scene } + } = this; + const heatmapSize = 3; + const data = Array.from( + { length: heatmapSize }, + (_, __) => Array.from({ length: heatmapSize }, (_2, yIndex) => yIndex) + ); + const domain = data.map((_, index) => index); + const xScale = new _Scene.CategoryScale(); + xScale.domain = domain; + xScale.range = [padding, size - padding]; + xScale.paddingInner = 0.01; + xScale.paddingOuter = 0.1; + const yScale = new _Scene.CategoryScale(); + yScale.domain = domain; + yScale.range = [padding, size - padding]; + yScale.paddingInner = 0.01; + yScale.paddingOuter = 0.1; + const width = xScale.bandwidth ?? 0; + const height = yScale.bandwidth ?? 0; + this.rects = data.reduce((rects, d, index) => { + rects ?? (rects = []); + const xRects = d.map((_, yIndex) => { + const rect = new _Scene.Rect(); + rect.x = xScale.convert(index); + rect.y = yScale.convert(yIndex); + rect.width = width; + rect.height = height; + rect.strokeWidth = 0; + rect.crisp = true; + return rect; + }); + rects.push(...xRects); + return rects; + }, []); + this.updateColors(fills, strokes, isCustomTheme); + const rectGroup = new _Scene.Group(); + rectGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding, size - padding)); + rectGroup.append(this.rects); + this.root.append(rectGroup); + } + updateColors(fills, strokes, isCustomTheme) { + const { _Theme, _Util } = this.agChartsExports; + const colorRange = isCustomTheme ? [fills[0], fills[1]] : _Theme.resolveOperation({ $palette: "divergingColors" }); + const stroke = isCustomTheme ? strokes[0] : _Theme.resolveOperation({ $ref: "backgroundColor" }); + const fillFn = _Util.interpolateColor(colorRange[0], colorRange[1]); + this.rects.forEach((rect, i) => { + rect.fill = fillFn(i * 0.2); + rect.stroke = stroke; + }); + } +}; +var MiniHeatmap = { + chartType: "heatmap", + miniChart: MiniHeatmapClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/specialized/miniWaterfall.ts +var MiniWaterfallClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes, isCustomTheme) { + super(container, agChartsExports, "waterfallTooltip"); + this.data = [4, 3, -3, 6, -3]; + this.bars = this.createWaterfall(this.root, this.data, this.size, this.padding, "vertical").bars; + this.updateColors(fills, strokes, isCustomTheme); + } + updateColors(fills, strokes, isCustomTheme) { + const { + data, + agChartsExports: { _Theme } + } = this; + const positive = { + fill: isCustomTheme ? fills[0] : _Theme.resolveOperation({ $palette: "altUp.fill" }), + stroke: isCustomTheme ? strokes[0] : _Theme.resolveOperation({ $palette: "altUp.stroke" }) + }; + const negative = { + fill: isCustomTheme ? fills[1] : _Theme.resolveOperation({ $palette: "altDown.fill" }), + stroke: isCustomTheme ? strokes[1] : _Theme.resolveOperation({ $palette: "altDown.stroke" }) + }; + this.bars.forEach((bar, i) => { + const isPositive = data[i] >= 0; + bar.fill = isPositive ? positive.fill : negative.fill; + bar.stroke = isPositive ? positive.stroke : negative.stroke; + }); + } + createWaterfall(root, data, size, padding, direction) { + const scalePadding = 2 * padding; + const { processedData, min, max } = accumulateData(data.map((d) => [d])); + const flatData = processedData.reduce((flat, d) => flat.concat(d), []); + const { _Scene } = this.agChartsExports; + const yScale = new _Scene.LinearScale(); + yScale.domain = [Math.min(min, 0), max]; + yScale.range = [size - scalePadding, scalePadding]; + const xScale = new _Scene.CategoryScale(); + xScale.domain = data.map((_, index) => index); + xScale.range = [padding, size - padding]; + xScale.paddingInner = 0.2; + xScale.paddingOuter = 0.3; + const width = xScale.bandwidth; + const connectorLine = new _Scene.Path(); + connectorLine.stroke = "#575757"; + connectorLine.strokeWidth = 0; + const pixelAlignmentOffset = Math.floor(connectorLine.strokeWidth) % 2 / 2; + const connectorPath = connectorLine.path; + connectorPath.clear(); + const barAlongX = direction === "horizontal"; + const bars = flatData.map((datum, i) => { + const previousDatum = i > 0 ? flatData[i - 1] : 0; + const rawValue = data[i]; + const isPositive = rawValue > 0; + const currY = Math.round(yScale.convert(datum)); + const trailY = Math.round(yScale.convert(previousDatum)); + const y = (isPositive ? currY : trailY) - pixelAlignmentOffset; + const bottomY = (isPositive ? trailY : currY) + pixelAlignmentOffset; + const height = Math.abs(bottomY - y); + const x = xScale.convert(i); + const rect = new _Scene.Rect(); + rect.x = barAlongX ? y : x; + rect.y = barAlongX ? x : y; + rect.width = barAlongX ? height : width; + rect.height = barAlongX ? width : height; + rect.strokeWidth = 0; + rect.crisp = true; + const moveTo = currY + pixelAlignmentOffset; + const lineTo = trailY + pixelAlignmentOffset; + if (i > 0) { + const lineToX = barAlongX ? lineTo : rect.x; + const lineToY = barAlongX ? rect.y : lineTo; + connectorPath.lineTo(lineToX, lineToY); + } + const moveToX = barAlongX ? moveTo : rect.x; + const moveToY = barAlongX ? rect.y : moveTo; + connectorPath.moveTo(moveToX, moveToY); + return rect; + }); + root.append([connectorLine, ...bars]); + return { bars }; + } +}; +var MiniWaterfall = { + chartType: "waterfall", + miniChart: MiniWaterfallClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/combo/miniColumnLineCombo.ts +var MiniColumnLineComboClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "columnLineComboTooltip"); + this.columnData = [3, 4]; + this.lineData = [[5, 4, 6, 5, 4]]; + const { root, columnData, lineData, size, padding } = this; + this.columns = createColumnRects({ + stacked: false, + root, + data: columnData, + size, + padding, + xScaleDomain: [0, 1], + yScaleDomain: [0, 4], + xScalePadding: 0.5, + agChartsExports + }); + root.append(this.columns); + this.lines = createLinePaths(agChartsExports, root, lineData, size, padding); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.columns.forEach((bar, i) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + }); + this.lines.forEach((line, i) => { + line.stroke = fills[i + 2]; + }); + } +}; +var MiniColumnLineCombo = { + chartType: "columnLineCombo", + miniChart: MiniColumnLineComboClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/combo/miniAreaColumnCombo.ts +var MiniAreaColumnComboClass = class extends MiniChartWithAxes { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "areaColumnComboTooltip"); + this.columnData = [3, 4.5]; + this.areaData = [[5, 4, 6, 5, 4]]; + const { + root, + columnData, + areaData, + size, + padding, + agChartsExports: { _Scene } + } = this; + this.columns = createColumnRects({ + stacked: false, + root, + data: columnData, + size, + padding, + xScaleDomain: [0, 1], + yScaleDomain: [0, 6], + xScalePadding: 0.5, + agChartsExports + }); + const xScale = new _Scene.CategoryScale(); + xScale.range = [padding, size - padding]; + xScale.domain = [0, 1, 2, 3, 4]; + xScale.paddingInner = 1; + xScale.paddingOuter = 0; + const yScale = new _Scene.LinearScale(); + yScale.range = [size - padding, padding]; + yScale.domain = [0, 6]; + const pathData = []; + const yZero = yScale.convert(0); + const firstX = xScale.convert(0); + areaData.forEach((series, i) => { + const points = pathData[i] || (pathData[i] = []); + series.forEach((data, j) => { + const yDatum = data; + const xDatum = j; + const x = xScale.convert(xDatum); + const y = yScale.convert(yDatum); + points[j] = { x, y }; + }); + const lastX = xScale.convert(series.length - 1); + pathData[i].push( + { + x: lastX, + y: yZero + }, + { + x: firstX, + y: yZero + } + ); + }); + this.areas = pathData.map((points) => { + const area = new _Scene.Path(); + area.strokeWidth = 0; + area.fillOpacity = 0.8; + const path = area.path; + points.forEach((point, i) => path[i > 0 ? "lineTo" : "moveTo"](point.x, point.y)); + return area; + }); + const areaGroup = new _Scene.Group(); + areaGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + const columnGroup = new _Scene.Group(); + columnGroup.setClipRect(new _Scene.BBox(padding, padding, size - padding * 2, size - padding * 2)); + areaGroup.append(this.areas); + columnGroup.append(this.columns); + root.append(areaGroup); + root.append(columnGroup); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.areas.forEach((area, i) => { + area.fill = fills[i]; + area.stroke = strokes[i]; + }); + this.columns.forEach((bar, i) => { + bar.fill = fills[i + 1]; + bar.stroke = strokes[i + 1]; + }); + } +}; +var MiniAreaColumnCombo = { + chartType: "areaColumnCombo", + miniChart: MiniAreaColumnComboClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniCharts/combo/miniCustomCombo.ts +var MiniCustomComboClass = class extends MiniChart { + constructor(container, agChartsExports, fills, strokes) { + super(container, agChartsExports, "customComboTooltip"); + this.columnData = [3, 4]; + this.lineData = [[5, 4, 6, 5, 4]]; + const { + root, + columnData, + lineData, + size, + padding, + agChartsExports: { _Scene } + } = this; + this.columns = createColumnRects({ + stacked: false, + root, + data: columnData, + size, + padding, + xScaleDomain: [0, 1], + yScaleDomain: [0, 4], + xScalePadding: 0.5, + agChartsExports + }); + root.append(this.columns); + this.lines = createLinePaths(this.agChartsExports, root, lineData, size, padding); + const axisStroke = "grey"; + const axisOvershoot = 3; + const leftAxis = new _Scene.Line(); + leftAxis.x1 = padding; + leftAxis.y1 = padding; + leftAxis.x2 = padding; + leftAxis.y2 = size - padding + axisOvershoot; + leftAxis.stroke = axisStroke; + const bottomAxis = new _Scene.Line(); + bottomAxis.x1 = padding - axisOvershoot + 1; + bottomAxis.y1 = size - padding; + bottomAxis.x2 = size - padding + 1; + bottomAxis.y2 = size - padding; + bottomAxis.stroke = axisStroke; + const penIcon = new _Scene.Path(); + this.buildPenIconPath(penIcon); + penIcon.fill = "whitesmoke"; + penIcon.stroke = "darkslategrey"; + penIcon.strokeWidth = 1; + root.append([bottomAxis, leftAxis, penIcon]); + this.updateColors(fills, strokes); + } + updateColors(fills, strokes) { + this.columns.forEach((bar, i) => { + bar.fill = fills[i]; + bar.stroke = strokes[i]; + }); + this.lines.forEach((line, i) => { + line.stroke = fills[i + 2]; + }); + } + buildPenIconPath(penIcon) { + const { path } = penIcon; + path.moveTo(25.76, 43.46); + path.lineTo(31.27, 48.53); + path.moveTo(49.86, 22); + path.lineTo(49.86, 22); + path.cubicCurveTo(49.01994659053345, 21.317514933510974, 47.89593834348529, 21.09645997825817, 46.86, 21.41); + path.lineTo(46.86, 21.41); + path.cubicCurveTo(45.55460035985361, 21.77260167850787, 44.38777081121966, 22.517979360321792, 43.51, 23.55); + path.lineTo(25.51, 43.8); + path.lineTo(25.43, 43.89); + path.lineTo(23.01, 51.89); + path.lineTo(22.83, 52.46); + path.lineTo(31.02, 48.86); + path.lineTo(49.02, 28.52); + path.lineTo(49.02, 28.52); + path.cubicCurveTo(49.940716461596224, 27.521914221246085, 50.54302631059587, 26.2720342455763, 50.75, 24.93); + path.lineTo(50.75, 24.93); + path.cubicCurveTo(50.95363374988308, 23.866379846512814, 50.62080640232334, 22.77066734274871, 49.86, 22); + path.closePath(); + path.moveTo(41.76, 25.5); + path.lineTo(47.34, 30.5); + path.moveTo(40.74, 26.65); + path.lineTo(46.25, 31.71); + } +}; +var MiniCustomCombo = { + chartType: "customCombo", + miniChart: MiniCustomComboClass +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/miniChartsContainer.ts +var miniChartMapping = { + columnGroup: { + column: { range: true, pivot: true, enterprise: false, icon: MiniColumn }, + stackedColumn: { range: true, pivot: true, enterprise: false, icon: MiniStackedColumn }, + normalizedColumn: { range: true, pivot: true, enterprise: false, icon: MiniNormalizedColumn } + }, + barGroup: { + bar: { range: true, pivot: true, enterprise: false, icon: MiniBar }, + stackedBar: { range: true, pivot: true, enterprise: false, icon: MiniStackedBar }, + normalizedBar: { range: true, pivot: true, enterprise: false, icon: MiniNormalizedBar } + }, + pieGroup: { + pie: { range: true, pivot: true, enterprise: false, icon: MiniPie }, + donut: { range: true, pivot: true, enterprise: false, icon: MiniDonut }, + doughnut: { range: true, pivot: true, enterprise: false, icon: MiniDonut } + }, + lineGroup: { + line: { range: true, pivot: true, enterprise: false, icon: MiniLine }, + stackedLine: { range: true, pivot: true, enterprise: false, icon: MiniStackedLine }, + normalizedLine: { range: true, pivot: true, enterprise: false, icon: MiniNormalizedLine } + }, + scatterGroup: { + scatter: { range: true, pivot: true, enterprise: false, icon: MiniScatter }, + bubble: { range: true, pivot: true, enterprise: false, icon: MiniBubble } + }, + areaGroup: { + area: { range: true, pivot: true, enterprise: false, icon: MiniArea }, + stackedArea: { range: true, pivot: true, enterprise: false, icon: MiniStackedArea }, + normalizedArea: { range: true, pivot: true, enterprise: false, icon: MiniNormalizedArea } + }, + polarGroup: { + radarLine: { range: true, pivot: false, enterprise: true, icon: MiniRadarLine }, + radarArea: { range: true, pivot: false, enterprise: true, icon: MiniRadarArea }, + nightingale: { range: true, pivot: false, enterprise: true, icon: MiniNightingale }, + radialColumn: { range: true, pivot: false, enterprise: true, icon: MiniRadialColumn }, + radialBar: { range: true, pivot: false, enterprise: true, icon: MiniRadialBar } + }, + statisticalGroup: { + boxPlot: { range: true, pivot: false, enterprise: true, icon: MiniBoxPlot }, + histogram: { range: true, pivot: false, enterprise: false, icon: MiniHistogram }, + rangeBar: { range: true, pivot: false, enterprise: true, icon: MiniRangeBar }, + rangeArea: { range: true, pivot: false, enterprise: true, icon: MiniRangeArea } + }, + hierarchicalGroup: { + treemap: { range: true, pivot: true, enterprise: true, icon: MiniTreemap }, + sunburst: { range: true, pivot: true, enterprise: true, icon: MiniSunburst } + }, + specializedGroup: { + heatmap: { range: true, pivot: false, enterprise: true, icon: MiniHeatmap }, + waterfall: { range: true, pivot: false, enterprise: true, icon: MiniWaterfall } + }, + combinationGroup: { + columnLineCombo: { range: true, pivot: true, enterprise: false, icon: MiniColumnLineCombo }, + areaColumnCombo: { range: true, pivot: true, enterprise: false, icon: MiniAreaColumnCombo }, + customCombo: { range: true, pivot: true, enterprise: false, icon: MiniCustomCombo } + }, + funnelGroup: { + funnel: { range: true, pivot: false, enterprise: true, icon: MiniFunnel }, + coneFunnel: { range: true, pivot: false, enterprise: true, icon: MiniConeFunnel }, + pyramid: { range: true, pivot: false, enterprise: true, icon: MiniPyramid } + } +}; +var DEFAULT_CHART_GROUPS = { + columnGroup: ["column", "stackedColumn", "normalizedColumn"], + barGroup: ["bar", "stackedBar", "normalizedBar"], + pieGroup: ["pie", "donut"], + lineGroup: ["line", "stackedLine", "normalizedLine"], + areaGroup: ["area", "stackedArea", "normalizedArea"], + scatterGroup: ["scatter", "bubble"], + polarGroup: ["radarLine", "radarArea", "nightingale", "radialColumn", "radialBar"], + statisticalGroup: ["boxPlot", "histogram", "rangeBar", "rangeArea"], + hierarchicalGroup: ["treemap", "sunburst"], + specializedGroup: ["heatmap", "waterfall"], + funnelGroup: ["funnel", "coneFunnel", "pyramid"], + combinationGroup: ["columnLineCombo", "areaColumnCombo", "customCombo"] +}; +var MiniChartsContainer = class extends Component93 { + constructor(chartController, fills, strokes, isCustomTheme, chartGroups = DEFAULT_CHART_GROUPS) { + super( + /* html */ + `
` + ); + this.wrappers = /* @__PURE__ */ new Map(); + this.chartController = chartController; + this.fills = fills; + this.strokes = strokes; + this.isCustomTheme = isCustomTheme; + this.chartGroups = { ...chartGroups }; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + if (!this.chartController.customComboExists() && this.chartGroups.combinationGroup) { + this.chartGroups.combinationGroup = this.chartGroups.combinationGroup.filter( + (chartType) => chartType !== "customCombo" + ); + } + const eGui = this.getGui(); + const isEnterprise = this.chartController.isEnterprise(); + const isPivotChart = this.chartController.isPivotChart(); + const isRangeChart = !isPivotChart; + const displayedMenuGroups = Object.keys(this.chartGroups).map((group) => { + const menuGroup = group in miniChartMapping ? miniChartMapping[group] : void 0; + if (!menuGroup) { + _warn65(148, { group }); + return null; + } + const chartGroupValues = this.chartGroups[group] ?? []; + const menuItems = chartGroupValues.map((chartType) => { + const menuItem = chartType in menuGroup ? menuGroup[chartType] : void 0; + if (!menuItem) { + _warn65(149, { group, chartType }); + return null; + } + if (!isEnterprise && menuItem.enterprise) { + return null; + } + if (isRangeChart && menuItem.range) { + return menuItem; + } + if (isPivotChart && menuItem.pivot) { + return menuItem; + } + return null; + }).filter((menuItem) => menuItem != null); + if (menuItems.length === 0) { + return null; + } + return { + label: this.chartTranslation.translate(group), + items: menuItems + }; + }).filter((menuGroup) => menuGroup != null); + for (const { label, items } of displayedMenuGroups) { + const groupComponent = this.createBean( + new AgGroupComponent({ + title: label, + suppressEnabledCheckbox: true, + enabled: true, + suppressOpenCloseIcons: true, + cssIdentifier: "charts-settings", + direction: "horizontal", + suppressKeyboardNavigation: true + }) + ); + for (const menuItem of items) { + const { miniChart: MiniClass, chartType } = menuItem.icon; + const miniWrapper = document.createElement("div"); + miniWrapper.classList.add("ag-chart-mini-thumbnail"); + miniWrapper.setAttribute("tabindex", "0"); + miniWrapper.setAttribute("role", "button"); + const miniClassChartType = chartType; + const listener = () => { + this.chartController.setChartType(miniClassChartType); + this.updateSelectedMiniChart(); + }; + this.addManagedListeners(miniWrapper, { + click: listener, + keydown: (event) => { + if (event.key == KeyCode34.ENTER || event.key === KeyCode34.SPACE) { + event.preventDefault(); + listener(); + } + } + }); + this.wrappers.set(miniClassChartType, miniWrapper); + this.createBean( + new MiniClass(miniWrapper, this.beans.agChartsExports, this.fills, this.strokes, this.isCustomTheme) + ); + groupComponent.addItem(miniWrapper); + } + eGui.appendChild(groupComponent.getGui()); + } + this.updateSelectedMiniChart(); + } + updateSelectedMiniChart() { + const selectedChartType = this.chartController.getChartType(); + this.wrappers.forEach((miniChart, miniChartType) => { + const selected = miniChartType === selectedChartType; + miniChart.classList.toggle("ag-selected", selected); + const chartName = this.chartTranslation.translate(getFullChartNameTranslationKey(miniChartType)); + const ariaLabel = selected ? `${chartName}. ${this.chartTranslation.translate("ariaChartSelected")}` : chartName; + _setAriaLabel21(miniChart, ariaLabel); + }); + } + destroy() { + this.wrappers.clear(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/settings/chartSettingsPanel.ts +var ChartSettingsPanel = class extends Component94 { + constructor(chartController) { + super( + /* html */ + `
+
+
+
+ +
+
+
+ +
+
+
` + ); + this.chartController = chartController; + this.eMiniChartsContainer = RefPlaceholder66; + this.eNavBar = RefPlaceholder66; + this.eCardSelector = RefPlaceholder66; + this.ePrevBtn = RefPlaceholder66; + this.eNextBtn = RefPlaceholder66; + this.miniChartsContainers = []; + this.cardItems = []; + this.activePaletteIndex = 0; + this.palettes = []; + this.themes = []; + } + postConstruct() { + this.resetPalettes(); + const isRtl = this.gos.get("enableRtl"); + this.ePrevBtn.insertAdjacentElement( + "afterbegin", + _createIconNoSpan27(isRtl ? "chartsThemeNext" : "chartsThemePrevious", this.beans) + ); + this.eNextBtn.insertAdjacentElement( + "afterbegin", + _createIconNoSpan27(isRtl ? "chartsThemePrevious" : "chartsThemeNext", this.beans) + ); + this.addManagedElementListeners(this.ePrevBtn, { click: () => this.setActivePalette(this.getPrev(), "left") }); + this.addManagedElementListeners(this.eNextBtn, { click: () => this.setActivePalette(this.getNext(), "right") }); + const reset = () => this.resetPalettes(true); + this.addManagedListeners(this.chartController, { + chartTypeChanged: reset, + chartApiUpdate: reset + }); + this.scrollSelectedIntoView(); + } + scrollSelectedIntoView() { + setTimeout(() => { + const isMiniChartsContainerVisible = (miniChartsContainers) => { + return !miniChartsContainers.getGui().classList.contains("ag-hidden"); + }; + const currentMiniChartContainer = this.miniChartsContainers.find(isMiniChartsContainerVisible); + const currentChart = currentMiniChartContainer.getGui().querySelector(".ag-selected"); + if (currentChart) { + const parent = currentChart.offsetParent; + if (parent) { + this.eMiniChartsContainer.scrollTo(0, parent.offsetTop); + } + } + }, 250); + } + resetPalettes(forceReset) { + const palettes = this.chartController.getPalettes(); + const chartGroups = this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef; + if (_areEqual8(palettes, this.palettes) && !forceReset || this.isAnimating) { + return; + } + this.palettes = palettes; + this.themes = this.chartController.getThemeNames(); + this.activePaletteIndex = this.themes.findIndex((name) => name === this.chartController.getChartThemeName()); + this.cardItems = []; + _clearElement22(this.eCardSelector); + this.destroyMiniCharts(); + const { themes } = this; + this.palettes.forEach((palette, index) => { + const isActivePalette = this.activePaletteIndex === index; + const { fills = [], strokes = [] } = palette; + const themeName = themes[index]; + const isCustomTheme = !isStockTheme(themeName, this.beans.agChartsExports._Theme); + const miniChartsContainer = this.createBean( + new MiniChartsContainer(this.chartController, fills, strokes, isCustomTheme, chartGroups) + ); + this.miniChartsContainers.push(miniChartsContainer); + this.eMiniChartsContainer.appendChild(miniChartsContainer.getGui()); + this.addCardLink(index); + if (isActivePalette) { + miniChartsContainer.updateSelectedMiniChart(); + } else { + miniChartsContainer.setDisplayed(false); + } + }); + _setDisplayed26(this.eNavBar, this.palettes.length > 1); + _radioCssClass2(this.cardItems[this.activePaletteIndex], "ag-selected", "ag-not-selected"); + } + addCardLink(index) { + const link = document.createElement("div"); + link.classList.add("ag-chart-settings-card-item"); + this.addManagedElementListeners(link, { + click: () => { + this.setActivePalette(index, index < this.activePaletteIndex ? "left" : "right"); + } + }); + this.eCardSelector.appendChild(link); + this.cardItems.push(link); + } + getPrev() { + let prev = this.activePaletteIndex - 1; + if (prev < 0) { + prev = this.palettes.length - 1; + } + return prev; + } + getNext() { + let next = this.activePaletteIndex + 1; + if (next >= this.palettes.length) { + next = 0; + } + return next; + } + setActivePalette(index, animationDirection) { + if (this.isAnimating || this.activePaletteIndex === index) { + return; + } + _radioCssClass2(this.cardItems[index], "ag-selected", "ag-not-selected"); + const currentPalette = this.miniChartsContainers[this.activePaletteIndex]; + const currentGui = currentPalette.getGui(); + const futurePalette = this.miniChartsContainers[index]; + const nextGui = futurePalette.getGui(); + currentPalette.updateSelectedMiniChart(); + futurePalette.updateSelectedMiniChart(); + const multiplier = animationDirection === "left" ? -1 : 1; + const final = nextGui.style.left = `${_getAbsoluteWidth2(this.getGui()) * multiplier}px`; + this.activePaletteIndex = index; + this.isAnimating = true; + const animatingClass = "ag-animating"; + futurePalette.setDisplayed(true); + currentPalette.addCss(animatingClass); + futurePalette.addCss(animatingClass); + this.chartController.setChartThemeName(this.themes[index]); + window.setTimeout(() => { + currentGui.style.left = `${-parseFloat(final)}px`; + nextGui.style.left = "0px"; + }, 0); + window.setTimeout(() => { + this.isAnimating = false; + currentPalette.removeCss(animatingClass); + futurePalette.removeCss(animatingClass); + currentPalette.setDisplayed(false); + }, 300); + } + destroyMiniCharts() { + _clearElement22(this.eMiniChartsContainer); + this.miniChartsContainers = this.destroyBeans(this.miniChartsContainers); + } + destroy() { + this.destroyMiniCharts(); + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/tabbedChartMenu.ts +var TAB_DATA = "data"; +var TAB_FORMAT = "format"; +var TabbedChartMenu = class extends Component95 { + constructor(panels, chartMenuContext) { + super(); + this.panels = panels; + this.chartMenuContext = chartMenuContext; + this.tabs = []; + } + wireBeans(beans) { + this.chartTranslation = beans.chartTranslation; + } + postConstruct() { + for (const panel of this.panels) { + const panelType = panel.replace("chart", "").toLowerCase(); + const panelComp = this.createPanel(panelType); + const tabItem = this.createTab(panel, panelType, panelComp); + this.tabs.push(tabItem); + this.addDestroyFunc(() => this.destroyBean(panelComp)); + } + this.tabbedLayout = new AgTabbedLayout({ + items: this.tabs, + cssClass: "ag-chart-tabbed-menu", + keepScrollPosition: true, + suppressFocusBodyOnOpen: true, + suppressTrapFocus: true, + enableCloseButton: true, + closeButtonAriaLabel: this.chartTranslation.translate("ariaChartMenuClose"), + onCloseClicked: () => { + this.eventSource?.focus({ preventScroll: true }); + this.dispatchLocalEvent({ type: "closed" }); + } + }); + this.createBean(this.tabbedLayout); + } + createTab(name, title, panelComp) { + const eWrapperDiv = _createElement19({ tag: "div", cls: `ag-chart-tab ag-chart-${title}` }); + this.createBean(panelComp); + eWrapperDiv.appendChild(panelComp.getGui()); + const translatedTitle = this.chartTranslation.translate(title); + const titleEl = _createElement19({ tag: "div", children: translatedTitle }); + return { + title: titleEl, + titleLabel: translatedTitle, + bodyPromise: AgPromise13.resolve(eWrapperDiv), + getScrollableContainer: () => { + const scrollableContainer = eWrapperDiv.querySelector(".ag-scrollable-container"); + return scrollableContainer || eWrapperDiv; + }, + name + }; + } + showTab(tab) { + const tabItem = this.tabs[tab]; + this.tabbedLayout.showItem(tabItem); + } + getGui() { + return this.tabbedLayout?.getGui(); + } + showMenu(eventSource, suppressFocus) { + this.eventSource = eventSource; + if (!suppressFocus) { + this.tabbedLayout?.focusHeader(true); + } + } + destroy() { + if (this.parentComponent?.isAlive()) { + this.destroyBean(this.parentComponent); + } + super.destroy(); + } + createPanel(panelType) { + switch (panelType) { + case TAB_DATA: + return new ChartDataPanel(this.chartMenuContext); + case TAB_FORMAT: + return new FormatPanel(this.chartMenuContext); + default: + return new ChartSettingsPanel(this.chartMenuContext.chartController); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/menu/chartMenu.ts +var ChartMenu = class extends Component96 { + constructor(eChartContainer, eMenuPanelContainer, chartMenuContext) { + super( + /* html */ + `
` + ); + this.eChartContainer = eChartContainer; + this.eMenuPanelContainer = eMenuPanelContainer; + this.chartMenuContext = chartMenuContext; + this.buttons = { + chartLink: { iconName: "linked", callback: () => this.chartMenuSvc.toggleLinked(this.chartMenuContext) }, + chartUnlink: { + iconName: "unlinked", + callback: () => this.chartMenuSvc.toggleLinked(this.chartMenuContext) + }, + chartDownload: { + iconName: "chartsDownload", + callback: () => this.chartMenuSvc.downloadChart(this.chartMenuContext) + }, + chartMenu: { iconName: "chartsMenu", callback: (eventSource) => this.showMenuList(eventSource) } + }; + this.panels = []; + this.menuVisible = false; + this.chartController = chartMenuContext.chartController; + } + wireBeans(beans) { + this.chartMenuSvc = beans.chartMenuSvc; + this.chartMenuListFactory = beans.chartMenuListFactory; + } + postConstruct() { + this.chartToolbar = this.createManagedBean(new ChartToolbar()); + this.getGui().appendChild(this.chartToolbar.getGui()); + this.refreshToolbarAndPanels(); + this.addManagedEventListeners({ + chartCreated: (e) => { + if (e.chartId === this.chartController.getChartId()) { + const showDefaultToolPanel = Boolean(this.gos.get("chartToolPanelsDef")?.defaultToolPanel); + if (showDefaultToolPanel) { + this.showMenu({ panel: this.defaultPanel, suppressFocus: true }); + } + } + } + }); + this.addManagedListeners(this.chartController, { + chartLinkedChanged: this.refreshToolbarAndPanels.bind(this) + }); + this.refreshMenuClasses(); + this.addManagedListeners(this.chartController, { chartApiUpdate: this.refreshToolbarAndPanels.bind(this) }); + } + isVisible() { + return this.menuVisible; + } + getExtraPaddingDirections() { + return ["chartMenu", "chartLink", "chartUnlink", "chartDownload"].some( + (v) => this.chartToolbarOptions.includes(v) + ) ? ["top"] : []; + } + refreshToolbarAndPanels() { + this.initToolbarOptionsAndPanels(); + this.updateToolbar(); + } + initToolbarOptionsAndPanels() { + const { panels, defaultPanel } = this.chartMenuSvc.getChartToolPanels(this.chartController); + this.panels = panels; + this.defaultPanel = defaultPanel; + this.chartToolbarOptions = this.chartMenuSvc.getChartToolbarOptions(); + } + updateToolbar() { + const buttons = this.chartToolbarOptions.map((buttonName) => { + const { iconName, callback } = this.buttons[buttonName]; + return { + buttonName, + iconName, + callback + }; + }); + this.chartToolbar.updateParams({ buttons }); + } + createMenuPanel(defaultTab) { + const menuPanel = this.menuPanel = this.createBean( + new AgPanel({ + height: "100%", + closable: true, + hideTitleBar: true, + cssIdentifier: "chart-menu" + }) + ); + menuPanel.setParentComponent(this); + this.eMenuPanelContainer.appendChild(menuPanel.getGui()); + this.tabbedMenu = this.createBean(new TabbedChartMenu(this.panels, this.chartMenuContext)); + this.addManagedListeners(this.tabbedMenu, { + closed: () => { + this.hideMenu(); + } + }); + this.addManagedListeners(menuPanel, { destroyed: () => this.destroyBean(this.tabbedMenu) }); + return new AgPromise14((res) => { + window.setTimeout(() => { + menuPanel.setBodyComponent(this.tabbedMenu); + this.tabbedMenu.showTab(defaultTab); + res(menuPanel); + }, 100); + }); + } + showContainer(eventSource, suppressFocus) { + if (!this.menuPanel) { + return; + } + this.menuVisible = true; + this.refreshMenuClasses(); + this.tabbedMenu.showMenu(eventSource, suppressFocus); + } + showMenu(params) { + const { panel, eventSource, suppressFocus } = params ?? {}; + if (this.menuPanel && !panel) { + this.showContainer(eventSource, suppressFocus); + } else { + const menuPanel = panel || this.defaultPanel; + let tab = this.panels.indexOf(menuPanel); + if (tab < 0) { + _warn66(143, { panel }); + tab = this.panels.indexOf(this.defaultPanel); + } + if (this.menuPanel) { + this.tabbedMenu.showTab(tab); + this.showContainer(eventSource, suppressFocus); + } else { + this.createMenuPanel(tab).then(() => this.showContainer(eventSource, suppressFocus)); + } + } + } + hideMenu() { + this.menuVisible = false; + this.refreshMenuClasses(); + } + refreshMenuClasses() { + this.eChartContainer.classList.toggle("ag-chart-menu-visible", this.menuVisible); + this.eChartContainer.classList.toggle("ag-chart-menu-hidden", !this.menuVisible); + } + showMenuList(eventSource) { + this.chartMenuListFactory.showMenuList({ + eventSource, + showMenu: () => this.showMenu({ eventSource }), + chartMenuContext: this.chartMenuContext, + closeOnElementClick: this.eChartContainer + }); + } + destroy() { + super.destroy(); + if (this.menuPanel?.isAlive()) { + this.destroyBean(this.menuPanel); + } + if (this.tabbedMenu?.isAlive()) { + this.destroyBean(this.tabbedMenu); + } + } +}; + +// packages/ag-grid-enterprise/src/charts/chartComp/services/chartOptionsService.ts +import { BeanStub as BeanStub100, _error as _error11 } from "ag-grid-community"; +var CARTESIAN_AXIS_TYPES = ["number", "category", "time", "grouped-category"]; +var POLAR_AXIS_TYPES = ["angle-category", "angle-number", "radius-category", "radius-number"]; +var VALID_AXIS_TYPES = [...CARTESIAN_AXIS_TYPES, ...POLAR_AXIS_TYPES]; +var ChartOptionsService = class extends BeanStub100 { + constructor(chartController) { + super(); + this.chartController = chartController; + } + getChartThemeOverridesProxy() { + return { + getValue: (expression) => this.getChartOption(expression), + setValue: (expression, value) => this.setChartThemeOverrides([{ expression, value }]), + setValues: (properties) => this.setChartThemeOverrides(properties) + }; + } + getAxisThemeOverridesProxy() { + return { + getValue: (expression) => this.getAxisProperty(expression), + setValue: (expression, value) => this.setAxisThemeOverrides([{ expression, value }]), + setValues: (properties) => this.setAxisThemeOverrides(properties) + }; + } + getCartesianAxisOptionsProxy(axisType) { + return { + getValue: (expression) => this.getCartesianAxisProperty(axisType, expression), + setValue: (expression, value) => this.setCartesianAxisOptions(axisType, [{ expression, value }]), + setValues: (properties) => this.setCartesianAxisOptions(axisType, properties), + clearValue: (parentExpression, key) => this.clearCartesianAxisOptions(axisType, parentExpression, key) + }; + } + getCartesianAxisThemeOverridesProxy(axisType) { + return { + getValue: (expression) => this.getCartesianAxisProperty(axisType, expression), + setValue: (expression, value) => this.setCartesianAxisThemeOverrides(axisType, [{ expression, value }]), + setValues: (properties) => this.setCartesianAxisThemeOverrides(axisType, properties) + }; + } + getCartesianAxisAppliedThemeOverridesProxy(axisType) { + return { + getValue: (expression) => this.getCartesianAxisThemeOverride( + axisType, + // Allow the caller to specify a wildcard expression to retrieve the whole set of overrides + expression === "*" ? null : expression + ), + setValue: (expression, value) => this.setCartesianAxisThemeOverrides( + axisType, + // Allow the caller to specify a wildcard expression to set the whole set of overrides + [{ expression: expression === "*" ? null : expression, value }] + ), + setValues: (properties) => this.setCartesianAxisThemeOverrides(axisType, properties) + }; + } + getSeriesOptionsProxy(getSelectedSeries) { + return { + getValue: (expression, calculated) => this.getSeriesOption(getSelectedSeries(), expression, calculated), + setValue: (expression, value) => this.setSeriesOptions(getSelectedSeries(), [{ expression, value }]), + setValues: (properties) => this.setSeriesOptions(getSelectedSeries(), properties) + }; + } + /** + * Determine the set of theme overrides that should be retained when transitioning from one chart type to another. + */ + getPersistedChartThemeOverrides(existingChartOptions, existingAxes, existingChartType, targetChartType) { + const retainedThemeOverrideKeys = this.getRetainedChartThemeOverrideKeys(existingChartType, targetChartType); + const retainedChartAxisThemeOverrideKeys = this.getRetainedChartAxisThemeOverrideKeys( + null, + existingChartType, + targetChartType + ); + const targetChartOptions = this.createChartOptions(); + for (const expression of retainedThemeOverrideKeys) { + const value = this.retrieveChartOptionsThemeOverride(existingChartOptions, existingChartType, expression); + if (value !== void 0) { + this.assignChartOptionsThemeOverride(targetChartOptions, targetChartType, expression, value); + } + } + if (existingAxes) { + this.assignPersistedAxisOverrides({ + existingAxes, + retainedChartAxisThemeOverrideKeys, + existingChartOptions, + targetChartOptions, + existingChartType, + targetChartType + }); + } + return targetChartOptions.theme.overrides; + } + assignPersistedAxisOverrides(params) { + const { + existingAxes, + retainedChartAxisThemeOverrideKeys, + existingChartOptions, + targetChartOptions, + existingChartType, + targetChartType + } = params; + for (const { expression, targetAxisTypes } of retainedChartAxisThemeOverrideKeys) { + for (const existingAxisType of existingAxes.map((axis) => axis.type)) { + const value = this.retrieveChartOptionsThemeOverride( + existingChartOptions, + existingChartType, + ["axes", existingAxisType, expression].join(".") + ); + if (value !== void 0) { + for (const targetAxisType of targetAxisTypes) { + this.assignChartOptionsThemeOverride( + targetChartOptions, + targetChartType, + ["axes", targetAxisType, expression].join("."), + value + ); + } + } + } + } + } + getRetainedChartThemeOverrideKeys(existingChartType, targetChartType) { + const UNIVERSAL_PERSISTED_THEME_OVERRIDES = ["animation"]; + const PERSISTED_CARTESIAN_CHART_THEME_OVERRIDES = ["zoom", "navigator"]; + const chartSpecificThemeOverrideKeys = ((previousChartType, updatedChartType) => { + const expressions = new Array(); + if (isCartesian(getSeriesType(previousChartType)) && isCartesian(getSeriesType(updatedChartType))) { + expressions.push(...PERSISTED_CARTESIAN_CHART_THEME_OVERRIDES); + } + return expressions; + })(existingChartType, targetChartType); + return [...UNIVERSAL_PERSISTED_THEME_OVERRIDES, ...chartSpecificThemeOverrideKeys]; + } + getRetainedChartAxisThemeOverrideKeys(axisType, existingChartType, targetChartType) { + if (isCartesian(getSeriesType(existingChartType)) && isCartesian(getSeriesType(targetChartType))) { + const retainedKeys = this.getRetainedCartesianAxisThemeOverrideKeys(axisType); + return retainedKeys.map((expression) => ({ expression, targetAxisTypes: CARTESIAN_AXIS_TYPES })); + } + return []; + } + getRetainedCartesianAxisThemeOverrideKeys(axisType) { + const axisPositionSuffixes = axisType === "xAxis" ? ["", ".top", ".bottom"] : axisType === "yAxis" ? ["", ".left", ".right"] : ["", ".left", ".right", ".top", ".bottom"]; + const PERSISTED_CARTESIAN_AXIS_THEME_OVERRIDES = ["crosshair"]; + const expressions = new Array(); + for (const expression of PERSISTED_CARTESIAN_AXIS_THEME_OVERRIDES) { + for (const axisPositionSuffix of axisPositionSuffixes) { + expressions.push(`${expression}${axisPositionSuffix}`); + } + } + return expressions; + } + getChartOption(expression) { + return get(this.getChart(), expression, void 0); + } + setChartThemeOverrides(properties) { + const chartType = this.getChartType(); + const chartOptions = this.createChartOptions(); + for (const { expression, value } of properties) { + this.assignChartOptionsThemeOverride(chartOptions, chartType, expression, value); + } + this.applyChartOptions(chartOptions); + } + applyChartOptions(chartOptions, options) { + if (Object.keys(chartOptions).length === 0) { + return; + } + this.updateChart(chartOptions); + const shouldRaiseEvent = !options?.silent; + if (shouldRaiseEvent) { + this.raiseChartOptionsChangedEvent(); + } + } + awaitChartOptionUpdate(func) { + const chart = this.chartController.getChartProxy().getChart(); + chart.waitForUpdate().then(() => func()).catch((e) => _error11(108, { e })); + } + getAxisProperty(expression) { + return get(this.getChart().axes?.x, expression, void 0); + } + setAxisThemeOverrides(properties) { + const chart = this.getChart(); + const chartType = this.getChartType(); + const chartOptions = this.createChartOptions(); + for (const { expression, value } of properties) { + const relevantAxes = Object.values(chart.axes ?? {}).filter((axis) => { + const parts = expression.split("."); + let current = axis; + for (const part of parts) { + if (!(part in current)) { + return false; + } + current = current[part]; + } + return true; + }); + if (!relevantAxes) { + continue; + } + for (const axis of relevantAxes) { + if (!this.isValidAxisType(axis)) { + continue; + } + this.assignChartAxisThemeOverride(chartOptions, chartType, axis.type, null, expression, value); + } + } + this.applyChartOptions(chartOptions); + } + getCartesianAxisProperty(axisType, expression) { + const axes = this.getChartAxes(); + const axis = this.getCartesianAxis(axes, axisType); + return get(axis, expression, void 0); + } + getCartesianAxisThemeOverride(axisType, expression) { + const axes = this.getChartAxes(); + const chartAxis = this.getCartesianAxis(axes, axisType); + if (!chartAxis || !this.isValidAxisType(chartAxis)) { + return void 0; + } + const chartType = this.getChartType(); + const chartOptions = this.getChart().getOptions(); + return this.retrieveChartAxisThemeOverride( + chartOptions, + chartType, + chartAxis.type, + axisType === "yAxis" ? ["left", "right"] : ["bottom", "top"], + expression + ); + } + setCartesianAxisThemeOverrides(axisType, properties) { + const axes = this.getChartAxes(); + const chartAxis = this.getCartesianAxis(axes, axisType); + if (!chartAxis || !this.isValidAxisType(chartAxis)) { + return; + } + const chartType = this.getChartType(); + const chartOptions = this.createChartOptions(); + for (const { expression, value } of properties) { + this.assignChartAxisThemeOverride( + chartOptions, + chartType, + chartAxis.type, + axisType === "yAxis" ? ["left", "right"] : ["bottom", "top"], + expression, + value + ); + } + this.applyChartOptions(chartOptions); + } + setCartesianAxisOptions(axisType, properties) { + this.updateCartesianAxisOptions(axisType, (chartOptions) => { + const axisId = axisType === "yAxis" ? "y" : "x"; + for (const { expression, value } of properties) { + this.assignChartOption(chartOptions, `axes.${axisId}.${expression}`, value); + } + }); + } + clearCartesianAxisOptions(axisType, parentExpression, key) { + this.updateCartesianAxisOptions(axisType, (chartOptions) => { + const axisId = axisType === "yAxis" ? "y" : "x"; + this.clearChartOption(chartOptions, `axes.${axisId}.${parentExpression}`, key); + }); + } + updateCartesianAxisOptions(axisType, updateFunc) { + const existingChartOptions = this.getChart().getOptions(); + const axisOptions = "axes" in existingChartOptions ? existingChartOptions.axes : void 0; + if (!existingChartOptions || !axisOptions) { + return; + } + const axes = this.getChartAxes(); + const chartAxis = this.getCartesianAxis(axes, axisType); + if (!chartAxis) { + return; + } + const chartOptions = this.createChartOptions(); + chartOptions.axes = axisOptions; + updateFunc(chartOptions, chartAxis, existingChartOptions); + this.applyChartOptions(chartOptions); + } + setCartesianCategoryAxisType(axisType, value) { + this.updateCartesianAxisOptions(axisType, (chartOptions, chartAxis, existingChartOptions) => { + const chartType = this.getChartType(); + this.assignPersistedAxisOverrides({ + existingAxes: [chartAxis], + retainedChartAxisThemeOverrideKeys: this.getRetainedChartAxisThemeOverrideKeys( + axisType, + chartType, + chartType + ), + existingChartOptions, + targetChartOptions: chartOptions, + existingChartType: chartType, + targetChartType: chartType + }); + this.assignChartOption(chartOptions, `axes.x.type`, value); + this.chartController.setCategoryAxisType(value); + }); + } + getCartesianAxis(axes, axisType) { + if (axes.length < 2) { + return void 0; + } + switch (axisType) { + case "xAxis": + return axes[0].direction === "x" ? axes[0] : axes[1]; + case "yAxis": + return axes[1].direction === "y" ? axes[1] : axes[0]; + } + } + getSeriesOption(seriesType, expression, calculated) { + const series = this.getChart().series.find((s2) => isMatchingSeries(seriesType, s2)); + return get(calculated ? series : series?.properties.toJson(), expression, void 0); + } + setSeriesOptions(seriesType, properties) { + const chartOptions = this.createChartOptions(); + for (const { expression, value } of properties) { + this.assignChartOptionsSeriesThemeOverride(chartOptions, seriesType, `series.${expression}`, value); + } + this.applyChartOptions(chartOptions); + } + getPairedMode() { + return this.chartController.getChartProxy().isPaired(); + } + setPairedMode(paired) { + this.chartController.getChartProxy().setPaired(paired); + } + getChartAxes() { + const chart = this.getChart(); + return Object.values(chart.axes ?? {}); + } + retrieveChartAxisThemeOverride(chartOptions, chartType, axisType, axisPositions, expression) { + if (axisPositions) { + for (const axisPosition of axisPositions) { + const value = this.retrieveChartOptionsThemeOverride( + chartOptions, + chartType, + ["axes", axisType, axisPosition, ...expression ? [expression] : []].join(".") + ); + if (value === void 0) { + continue; + } + return value; + } + } else { + return this.retrieveChartOptionsThemeOverride( + chartOptions, + chartType, + ["axes", axisType, ...expression ? [expression] : []].join(".") + ); + } + } + assignChartAxisThemeOverride(chartOptions, chartType, axisType, axisPositions, expression, value) { + if (axisPositions) { + for (const axisPosition of axisPositions) { + this.assignChartOptionsThemeOverride( + chartOptions, + chartType, + ["axes", axisType, axisPosition, ...expression ? [expression] : []].join("."), + value + ); + } + } else { + this.assignChartOptionsThemeOverride( + chartOptions, + chartType, + ["axes", axisType, ...expression ? [expression] : []].join("."), + value + ); + } + } + isValidAxisType(chartAxis) { + return VALID_AXIS_TYPES.includes(chartAxis.type); + } + getChartType() { + return this.chartController.getChartType(); + } + getChart() { + return this.chartController.getChartProxy().getChart(); + } + updateChart(chartOptions) { + const chartRef = this.chartController.getChartProxy().getChartRef(); + chartRef.skipAnimations(); + chartRef.updateDelta(chartOptions); + } + createChartOptions() { + const chartOptions = { + theme: { + overrides: {} + } + }; + return chartOptions; + } + retrieveChartOptionsThemeOverride(chartOptions, chartType, expression) { + const chartSeriesTypes = this.getChartThemeOverridesSeriesTypeKeys(chartType); + for (const seriesType of chartSeriesTypes) { + const value = this.retrieveChartOptionsSeriesThemeOverride(chartOptions, seriesType, expression); + if (value === void 0) { + continue; + } + return value; + } + return void 0; + } + assignChartOptionsThemeOverride(chartOptions, chartType, expression, value) { + const chartSeriesTypes = this.getChartThemeOverridesSeriesTypeKeys(chartType); + for (const seriesType of chartSeriesTypes) { + this.assignChartOptionsSeriesThemeOverride(chartOptions, seriesType, expression, value); + } + } + retrieveChartOptionsSeriesThemeOverride(chartOptions, seriesType, expression) { + return this.retrieveChartOption( + chartOptions, + ["theme", "overrides", seriesType, ...expression ? [expression] : []].join(".") + ); + } + assignChartOptionsSeriesThemeOverride(chartOptions, seriesType, expression, value) { + this.assignChartOption( + chartOptions, + ["theme", "overrides", seriesType, ...expression ? [expression] : []].join("."), + value + ); + } + getChartThemeOverridesSeriesTypeKeys(chartType) { + const chartSeriesTypes = this.chartController.getChartSeriesTypes(chartType); + if (this.chartController.isComboChart()) { + chartSeriesTypes.push("common"); + } + return chartSeriesTypes; + } + retrieveChartOption(chartOptions, expression) { + return get(chartOptions, expression, void 0); + } + assignChartOption(chartOptions, expression, value) { + set(chartOptions, expression, value); + } + clearChartOption(chartOptions, parentExpression, key) { + const parentObject = get(chartOptions, parentExpression, void 0); + if (parentObject) { + delete parentObject[key]; + } + } + raiseChartOptionsChangedEvent() { + const chartModel = this.chartController.getChartModel(); + this.eventSvc.dispatchEvent({ + type: "chartOptionsChanged", + chartId: chartModel.chartId, + chartType: chartModel.chartType, + chartThemeName: this.chartController.getChartThemeName(), + chartOptions: chartModel.chartOptions + }); + } +}; +function isMatchingSeries(seriesType, series) { + return isSeriesType(seriesType) && series.type === seriesType; +} + +// packages/ag-grid-enterprise/src/charts/chartComp/gridChartComp.ts +var GridChartComp = class extends Component97 { + constructor(params) { + super( + /* html */ + ` +
+
+
+
+
+
+
+
+
+ ` + ); + this.eChart = RefPlaceholder67; + this.eWrapper = RefPlaceholder67; + this.eChartContainer = RefPlaceholder67; + this.eMenuContainer = RefPlaceholder67; + this.eEmpty = RefPlaceholder67; + this.params = params; + } + wireBeans(beans) { + this.crossFilterService = beans.chartCrossFilterSvc; + this.chartTranslation = beans.chartTranslation; + this.chartMenuSvc = beans.chartMenuSvc; + this.focusSvc = beans.focusSvc; + this.popupSvc = beans.popupSvc; + this.enterpriseChartProxyFactory = beans.enterpriseChartProxyFactory; + this.environment = beans.environment; + } + postConstruct() { + const modelParams = { + ...this.params, + chartType: getCanonicalChartType(this.params.chartType), + chartThemeName: this.getThemeName() + }; + const isRtl = this.gos.get("enableRtl"); + this.eWrapper.classList.add(isRtl ? "ag-rtl" : "ag-ltr"); + const model = this.createBean(new ChartDataModel(modelParams)); + this.chartController = this.createManagedBean(new ChartController(model)); + this.chartOptionsService = this.createManagedBean(new ChartOptionsService(this.chartController)); + this.validateCustomThemes(); + this.createChart(); + if (this.params.insideDialog) { + this.addDialog(); + } else { + this.addManagedEventListeners({ + stylesChanged: this.updateTheme.bind(this) + }); + this.updateTheme(); + } + this.addMenu(); + this.addManagedElementListeners(this.getGui(), { focusin: this.setActiveChartCellRange.bind(this) }); + this.addManagedListeners(this.chartController, { chartModelUpdate: this.update.bind(this) }); + this.addManagedPropertyListeners( + ["chartThemeOverrides", "chartThemes"], + this.reactivePropertyUpdate.bind(this) + ); + this.update(); + this.raiseChartCreatedEvent(); + } + updateTheme() { + this.environment.applyThemeClasses(this.getGui()); + } + createChart() { + let chartInstance = void 0; + if (this.chartProxy) { + chartInstance = this.chartProxy.destroy({ keepChartInstance: true }); + } + const crossFilterCallback = (event, reset) => { + const ctx = this.params.crossFilteringContext; + ctx.lastSelectedChartId = reset ? "" : this.chartController.getChartId(); + if (reset) { + this.params.crossFilteringResetCallback(); + } + this.crossFilterService.filter(event, reset); + }; + const chartType = this.chartController.getChartType(); + const chartProxyParams = { + agChartsExports: this.beans.agChartsExports, + chartType, + chartInstance, + getChartThemeName: this.getChartThemeName.bind(this), + getChartThemes: this.getChartThemes.bind(this), + customChartThemes: this.gos.get("customChartThemes"), + styleNonce: this.gos.get("styleNonce"), + getGridOptionsChartThemeOverrides: () => this.getGridOptionsChartThemeOverrides(), + getExtraPaddingDirections: () => this.chartMenu?.getExtraPaddingDirections() ?? [], + apiChartThemeOverrides: this.params.chartThemeOverrides, + crossFiltering: this.params.crossFiltering ?? false, + crossFilterCallback, + parentElement: this.eChart, + grouping: this.chartController.isGrouping(), + chartThemeToRestore: this.params.chartThemeName, + chartOptionsToRestore: this.params.chartOptionsToRestore, + chartPaletteToRestore: this.params.chartPaletteToRestore, + seriesChartTypes: this.chartController.getSeriesChartTypes(), + translate: (toTranslate) => this.chartTranslation.translate(toTranslate), + context: _addGridCommonParams29(this.gos, {}) + }; + this.params.chartOptionsToRestore = void 0; + this.chartType = chartType; + this.chartProxy = this.createChartProxy(chartProxyParams); + if (!this.chartProxy) { + _warn67(138, { chartType: chartProxyParams.chartType }); + return; + } + this.chartController.setChartProxy(this.chartProxy); + this.createMenuContext(); + } + createMenuContext() { + if (this.chartMenuContext) { + return; + } + const chartMenuParamsFactory = this.createManagedBean( + new ChartMenuParamsFactory(this.chartOptionsService.getChartThemeOverridesProxy()) + ); + const chartAxisMenuParamsFactory = this.createManagedBean( + new ChartMenuParamsFactory(this.chartOptionsService.getAxisThemeOverridesProxy()) + ); + this.chartMenuContext = { + chartController: this.chartController, + chartOptionsService: this.chartOptionsService, + chartMenuParamsFactory, + chartAxisMenuParamsFactory + }; + } + getChartThemeName() { + return this.chartController.getChartThemeName(); + } + getChartThemes() { + return this.chartController.getThemeNames(); + } + getGridOptionsChartThemeOverrides() { + return this.gos.get("chartThemeOverrides"); + } + createChartProxy(chartProxyParams) { + const { chartType } = chartProxyParams; + switch (chartType) { + case "column": + case "bar": + case "groupedColumn": + case "stackedColumn": + case "normalizedColumn": + case "groupedBar": + case "stackedBar": + case "normalizedBar": + return new BarChartProxy(chartProxyParams); + case "pie": + case "donut": + case "doughnut": + return new PieChartProxy(chartProxyParams); + case "area": + case "stackedArea": + case "normalizedArea": + return new AreaChartProxy(chartProxyParams); + case "line": + case "stackedLine": + case "normalizedLine": + return new LineChartProxy(chartProxyParams); + case "scatter": + case "bubble": + return new ScatterChartProxy(chartProxyParams); + case "columnLineCombo": + case "areaColumnCombo": + case "customCombo": + return new ComboChartProxy(chartProxyParams); + } + const enterpriseChartProxy = this.enterpriseChartProxyFactory?.createChartProxy(chartProxyParams); + if (!enterpriseChartProxy) { + throw _errMsg2(251, { chartType }); + } + return enterpriseChartProxy; + } + addDialog() { + const title = this.chartTranslation.translate(this.params.pivotChart ? "pivotChartTitle" : "rangeChartTitle"); + const { width, height } = this.getBestDialogSize(); + const afterGuiAttached = this.params.focusDialogOnOpen ? () => setTimeout(() => _focusInto11(this.getGui())) : void 0; + this.chartDialog = new Dialog({ + resizable: true, + movable: true, + maximizable: true, + title, + width, + height, + component: this, + centered: true, + closable: true, + afterGuiAttached, + postProcessPopupParams: { + type: "chart" + } + }); + this.createBean(this.chartDialog); + this.chartDialog.addEventListener("destroyed", () => { + this.destroy(); + this.chartMenuSvc.hideAdvancedSettings(); + const lastFocusedCell = this.focusSvc.getFocusedCell(); + setTimeout(() => { + if (this.focusSvc.isAlive()) { + if (lastFocusedCell) { + this.focusSvc.setFocusedCell({ ...lastFocusedCell, forceBrowserFocus: true }); + } else { + _focusGridInnerElement(this.beans); + } + } + }); + }); + } + getBestDialogSize() { + const popupParent = this.popupSvc.getPopupParent(); + const maxWidth = _getAbsoluteWidth3(popupParent) * 0.75; + const maxHeight = _getAbsoluteHeight2(popupParent) * 0.75; + const ratio = 0.553; + const chart = this.chartProxy.getChart(); + let width = this.params.insideDialog ? 850 : chart.width; + let height = this.params.insideDialog ? 470 : chart.height; + if (width > maxWidth || height > maxHeight) { + width = Math.min(width, maxWidth); + height = Math.round(width * ratio); + if (height > maxHeight) { + height = maxHeight; + width = Math.min(width, Math.round(height / ratio)); + } + } + return { width, height }; + } + addMenu() { + if (!this.params.crossFiltering) { + this.chartMenu = this.createBean( + new ChartMenu(this.eChartContainer, this.eMenuContainer, this.chartMenuContext) + ); + this.eChartContainer.appendChild(this.chartMenu.getGui()); + } + } + update(params) { + if (params?.chartId) { + const validUpdate = this.chartController.update(params); + if (!validUpdate) { + return; + } + } + const updatedChartType = this.chartTypeChanged(params); + const persistedThemeOverrides = updatedChartType || this.chartEmpty ? ((updatedChartType2) => { + const currentChartType = this.chartType; + const targetChartType = updatedChartType2; + const existingChartInstance = this.chartProxy.getChart(); + const existingChartOptions = existingChartInstance?.getOptions(); + const existingAxes = Object.values(existingChartInstance?.axes ?? {}); + return this.chartOptionsService.getPersistedChartThemeOverrides( + existingChartOptions, + existingAxes, + currentChartType, + targetChartType ?? currentChartType + ); + })(updatedChartType) : void 0; + if (updatedChartType) { + this.createChart(); + } + if (persistedThemeOverrides && params?.chartThemeOverrides) { + _mergeDeep5(persistedThemeOverrides, params.chartThemeOverrides); + } + const updatedThemeOverrides = persistedThemeOverrides ?? params?.chartThemeOverrides; + this.updateChart(updatedThemeOverrides); + if (params?.chartId) { + this.chartProxy.getChart().waitForUpdate().then(() => { + this.chartController.raiseChartApiUpdateEvent(); + }); + } + } + updateChart(updatedOverrides) { + const { chartProxy } = this; + const selectedCols = this.chartController.getSelectedValueColState(); + const data = this.chartController.getChartData(); + const chartEmpty = this.handleEmptyChart(data, selectedCols.length); + this.chartEmpty = chartEmpty; + if (chartEmpty) { + if (updatedOverrides) { + this.chartController.updateThemeOverrides(updatedOverrides); + } + return; + } + const chartUpdateParams = this.chartController.getChartUpdateParams(updatedOverrides); + chartProxy.update(chartUpdateParams); + this.chartProxy.getChart().waitForUpdate().then(() => { + this.chartController.raiseChartUpdatedEvent(); + }); + } + chartTypeChanged(updateParams) { + const [currentType, updatedChartType] = [this.chartController.getChartType(), updateParams?.chartType]; + const targetChartType = updatedChartType ? getCanonicalChartType(updatedChartType) : void 0; + if (this.chartType !== currentType) { + return targetChartType ?? currentType; + } + if (targetChartType && currentType !== targetChartType) { + return targetChartType; + } + return null; + } + getChartModel() { + return this.chartController.getChartModel(); + } + getChartImageDataURL(fileFormat) { + return this.chartProxy.getChartImageDataURL(fileFormat); + } + handleEmptyChart(data, numFields) { + const pivotModeDisabled = this.chartController.isPivotChart() && !this.chartController.isPivotMode(); + const chartType = this.chartController.getChartType(); + let minFieldsRequired = 1; + if (this.chartController.isActiveXYChart()) { + minFieldsRequired = chartType === "bubble" ? 3 : 2; + } else if (isHierarchical(getSeriesType(chartType))) { + minFieldsRequired = 0; + } + const isEmptyChart = numFields < minFieldsRequired || data.length === 0; + if (this.eChart) { + const isEmpty = pivotModeDisabled || isEmptyChart; + _setDisplayed27(this.eChart, !isEmpty); + _setDisplayed27(this.eEmpty, isEmpty); + } + if (pivotModeDisabled) { + this.eEmpty.textContent = this.chartTranslation.translate("pivotChartRequiresPivotMode"); + return true; + } + if (isEmptyChart) { + this.eEmpty.textContent = this.chartTranslation.translate("noDataToChart"); + return true; + } + return false; + } + downloadChart(dimensions, fileName, fileFormat) { + this.chartProxy.downloadChart(dimensions, fileName, fileFormat); + } + openChartToolPanel(panel) { + const menuPanel = panel ? CHART_TOOL_PANEL_MENU_OPTIONS[panel] : panel; + this.chartMenu.showMenu({ panel: menuPanel }); + } + closeChartToolPanel() { + this.chartMenu.hideMenu(); + } + getChartId() { + return this.chartController.getChartId(); + } + getUnderlyingChart() { + return this.chartProxy.getChartRef(); + } + crossFilteringReset() { + this.chartProxy.crossFilteringReset(); + } + setMaximized(maximized) { + this.chartDialog?.setMaximized(maximized); + } + setActiveChartCellRange(focusEvent) { + if (this.getGui().contains(focusEvent.relatedTarget)) { + return; + } + this.chartController.setChartRange(true); + } + getThemeName() { + const availableChartThemes = this.gos.get("chartThemes") || DEFAULT_THEMES; + if (availableChartThemes.length === 0) { + throw new Error(_errMsg2(254)); + } + const { chartThemeName } = this.params; + return availableChartThemes.includes(chartThemeName) ? chartThemeName : availableChartThemes[0]; + } + getAllKeysInObjects(objects) { + const allValues = {}; + for (const obj of objects.filter((obj2) => obj2 != null)) { + for (const key of Object.keys(obj)) { + allValues[key] = null; + } + } + return Object.keys(allValues); + } + validateCustomThemes() { + const suppliedThemes = this.getChartThemes(); + const customChartThemes = this.gos.get("customChartThemes"); + if (customChartThemes) { + for (const customThemeName of this.getAllKeysInObjects([customChartThemes])) { + if (!suppliedThemes.includes(customThemeName)) { + _warn67(139, { customThemeName }); + } + } + } + } + reactivePropertyUpdate() { + this.chartController.setChartThemeName(this.getThemeName(), true); + const chartId = this.getChartId(); + const modelType = this.chartController.isCrossFilterChart() ? "crossFilter" : this.getChartModel().modelType; + const chartThemeOverrides = this.gos.get("chartThemeOverrides") || {}; + this.update({ + type: `${modelType}ChartUpdate`, + chartId, + chartThemeOverrides + }); + } + raiseChartCreatedEvent() { + this.chartProxy.getChart().waitForUpdate().then(() => { + this.eventSvc.dispatchEvent({ + type: "chartCreated", + chartId: this.chartController.getChartId() + }); + }); + } + raiseChartDestroyedEvent() { + this.eventSvc.dispatchEvent({ + type: "chartDestroyed", + chartId: this.chartController.getChartId() + }); + } + destroy() { + super.destroy(); + if (this.chartProxy) { + this.chartProxy.destroy(); + } + this.destroyBean(this.chartMenu); + if (this.chartDialog?.isAlive()) { + this.destroyBean(this.chartDialog); + } + this.onDestroyColorSchemeChangeListener?.(); + const eGui = this.getGui(); + _clearElement23(eGui); + _removeFromParent18(eGui); + this.raiseChartDestroyedEvent(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartModelMigration.ts +import { _errMsg as _errMsg3 } from "ag-grid-community"; +var DEBUG = false; +function upgradeChartModel(model) { + const originalVersion = model.version; + if (model.version == null) { + model.version = heuristicVersionDetection(model); + } + model = migrateIfBefore("23.0.0", model, migrateV23); + model = migrateIfBefore("24.0.0", model, migrateV24); + model = migrateIfBefore("25.1.0", model, migrateV25_1); + model = migrateIfBefore("26.0.0", model, migrateV26); + model = migrateIfBefore("26.1.0", model, migrateV26_1); + model = migrateIfBefore("26.2.0", model, migrateV26_2); + model = migrateIfBefore("28.0.0", model, migrateV28); + model = migrateIfBefore("28.2.0", model, migrateV28_2); + model = migrateIfBefore("29.0.0", model, migrateV29); + model = migrateIfBefore("29.1.0", model, migrateV29_1); + model = migrateIfBefore("29.2.0", model, migrateV29_2); + model = migrateIfBefore("30.0.0", model, migrateV30); + model = migrateIfBefore("31.0.0", model, migrateV31); + model = migrateIfBefore("32.0.0", model, migrateV32); + model = migrateIfBefore("33.0.0", model, migrateV33); + model = migrateIfBefore("34.0.0", model, migrateV34); + model = cleanup(model); + model = migrateIfBefore(VERSION, model, (m) => m); + if (DEBUG && originalVersion !== model.version) { + console.log("AG Grid: ChartModel migration complete", { model }); + } + return model; +} +function migrateV23(model) { + model = jsonRename("chartOptions.legend.item.marker.type", "shape", model); + model = jsonRename("chartOptions.seriesDefaults.marker.type", "shape", model); + model = jsonRename("chartOptions.legend.padding", "spacing", model); + return model; +} +function migrateV24(model) { + model = jsonDelete("chartOptions.seriesDefaults.marker.minSize", model); + const { + chartType, + chartPalette, + // Migrate. + chartOptions: { xAxis, yAxis, ...chartOptions }, + ...chartModel + } = model; + const axesTypes = getLegacyAxisType(chartType); + const axes = axesTypes?.map((type, i) => ({ + type, + ...i === 0 ? xAxis : yAxis + })); + const LEGACY_PALETTES = { + borneo: "ag-default", + material: "ag-material", + bright: "ag-vivid" + }; + return { + chartType, + chartThemeName: LEGACY_PALETTES[chartPalette] ?? "ag-default", + chartOptions: { + ...chartOptions, + axes, + xAxis, + yAxis + }, + ...chartModel + }; +} +function migrateV25_1(model) { + model = jsonRename("chartOptions.seriesDefaults.label.minRequiredAngle", "minAngle", model); + return model; +} +function migrateV26(model) { + const highlightOptUpdate = ({ dimOpacity, ...opts }) => ({ + ...opts, + ...dimOpacity != null ? { series: { dimOpacity } } : {} + }); + model = jsonMutate("chartOptions.seriesDefaults.highlightStyle", model, highlightOptUpdate); + model = jsonDelete("chart", model); + model = jsonDelete("chartOptions.seriesDefaults.tooltipClass", model); + model = jsonDelete("chartOptions.seriesDefaults.tooltipTracking", model); + model = jsonDeleteDefault("chartOptions.axes[].label.rotation", 0, model); + model = jsonDeleteDefault("chartOptions.axes[].label.rotation", 335, model); + return model; +} +function migrateV26_1(model) { + const highlightOptUpdate = ({ item, series, ...opts }) => ({ + item: { ...opts, ...item }, + ...series ? { series } : {} + }); + model = jsonMutate("chartOptions.seriesDefaults.highlightStyle", model, highlightOptUpdate); + model = jsonMutate("chartOptions.series[].highlightStyle", model, highlightOptUpdate); + return model; +} +function migrateV26_2(model) { + model = jsonMove("chartOptions.seriesDefaults.fill.opacity", "chartOptions.seriesDefaults.fillOpacity", model); + model = jsonMove("chartOptions.seriesDefaults.stroke.opacity", "chartOptions.seriesDefaults.strokeOpacity", model); + model = jsonMove("chartOptions.seriesDefaults.stroke.width", "chartOptions.seriesDefaults.strokeWidth", model); + model = jsonDelete("chartOptions.seriesDefaults.fill", model); + model = jsonDelete("chartOptions.seriesDefaults.stroke", model); + model = jsonDelete("chartOptions.seriesDefaults.callout.colors", model); + model = jsonDelete("chartOptions.xAxis", model); + model = jsonDelete("chartOptions.yAxis", model); + const { + chartType: providedChartType, + // disable no-unused-vars because `series` is required here, even though + // unused, because it serves to take the `series` key out of otherChartOptions + // eslint-disable-next-line @typescript-eslint/no-unused-vars + chartOptions: { axes, series, seriesDefaults, ...otherChartOptions }, + ...otherModelProps + } = model; + const chartType = getCanonicalChartType(providedChartType); + const seriesType = getSeriesType(chartType); + const seriesTypes = [seriesType]; + const chartTypeMixin = {}; + if (!isPieChartSeries(seriesType)) { + const minimalAxis = { top: {}, bottom: {}, left: {}, right: {} }; + const updatedAxes = axes.map(({ type, ...axisProps }) => ({ + [type]: { ...minimalAxis, ...axisProps } + })).reduce(merge, {}); + for (const v of ALL_AXIS_TYPES.filter((v2) => updatedAxes[v2] == null)) { + updatedAxes[v] = { ...minimalAxis }; + } + chartTypeMixin.axes = updatedAxes; + } + const updatedChartOptions = seriesTypes.map((t) => ({ + [t]: { + ...chartTypeMixin, + series: seriesDefaults, + ...otherChartOptions + } + })).reduce(merge, {}); + model = { + ...otherModelProps, + chartType, + chartOptions: updatedChartOptions + }; + return model; +} +function migrateV28(model) { + model = jsonDelete("chartOptions.*.title.padding", model); + model = jsonDelete("chartOptions.*.subtitle.padding", model); + model = jsonDelete("chartOptions.*.axes.*.title.padding", model); + model = jsonBackfill("chartOptions.*.axes.*.title.enabled", false, model); + return model; +} +function migrateV28_2(model) { + model = jsonRename("chartOptions.pie.series.callout", "calloutLine", model); + model = jsonRename("chartOptions.pie.series.label", "calloutLabel", model); + model = jsonRename("chartOptions.pie.series.labelKey", "sectorLabelKey", model); + model = jsonRename("chartOptions.pie.series.labelName", "sectorLabelName", model); + model = jsonRename("chartOptions.donut.series.callout", "calloutLine", model); + model = jsonRename("chartOptions.donut.series.label", "calloutLabel", model); + model = jsonRename("chartOptions.donut.series.labelKey", "sectorLabelKey", model); + model = jsonRename("chartOptions.donut.series.labelName", "sectorLabelName", model); + return model; +} +function migrateV29(model) { + model = jsonMoveIfMissing("chartOptions.scatter.series.fill", "chartOptions.scatter.series.marker.fill", model); + model = jsonMoveIfMissing( + "chartOptions.scatter.series.fillOpacity", + "chartOptions.scatter.series.marker.fillOpacity", + model + ); + model = jsonMoveIfMissing("chartOptions.scatter.series.stroke", "chartOptions.scatter.series.marker.stroke", model); + model = jsonMoveIfMissing( + "chartOptions.scatter.series.strokeOpacity", + "chartOptions.scatter.series.marker.strokeOpacity", + model + ); + model = jsonMoveIfMissing( + "chartOptions.scatter.series.strokeWidth", + "chartOptions.scatter.series.marker.strokeWidth", + model + ); + model = jsonMove("chartOptions.scatter.series.paired", "chartOptions.scatter.paired", model); + return model; +} +function migrateV29_1(model) { + model = jsonDelete("chartOptions.axes[].tick.count", model); + return model; +} +function migrateV29_2(model) { + const tooltipOptUpdate = ({ tracking, ...opts }) => { + const output = { ...opts }; + if (tracking === false) { + output.position ?? (output.position = { type: "pointer" }); + output.range ?? (output.range = "nearest"); + } else if (tracking === true) { + output.position ?? (output.position = { type: "node" }); + output.range ?? (output.range = "nearest"); + } + return output; + }; + model = jsonMutate("chartOptions.*.tooltip", model, tooltipOptUpdate); + return model; +} +function migrateV30(model) { + model = jsonRename("chartOptions.pie.series.labelKey", "sectorLabelKey", model); + model = jsonRename("chartOptions.pie.series.labelName", "sectorLabelName", model); + model = migrateV29_1(model); + model = migrateV29_2(model); + model = jsonDelete("chartOptions.*.series.flipXY", model); + model = jsonAdd("chartOptions.common.legend.enabled", true, model); + model = jsonBackfill("chartOptions.common.legend.position", "right", model); + return model; +} +function migrateV31(model) { + const V30_LEGACY_PALETTES = { + "ag-pastel": "ag-sheets", + "ag-solar": "ag-polychroma" + }; + const updatedModel = jsonRename("chartOptions.column", "bar", model); + const chartThemeName = V30_LEGACY_PALETTES[updatedModel.chartThemeName] || updatedModel.chartThemeName; + return { + ...updatedModel, + chartThemeName + }; +} +function migrateV32(model) { + model = jsonMutateProperty("chartOptions.*.autoSize", true, model, (parent, targetProp) => { + if (parent[targetProp] === true) { + } else if (parent[targetProp] === false) { + parent["minHeight"] = 600; + parent["minWidth"] = 300; + } + delete parent[targetProp]; + }); + return model; +} +function migrateV33(model) { + model = jsonDelete("chartOptions.*.axes.category.label.format", model); + model = jsonDelete("chartOptions.*.axes.category.crosshair.label.format", model); + model = jsonDelete("chartOptions.*.axes.angle-category.label.format", model); + model = jsonDelete("chartOptions.*.axes.radius-category.label.format", model); + model = jsonRename("chartOptions.*.axes.*.label.padding", "spacing", model); + model = jsonRename("chartOptions.*.navigator.miniChart.label.padding", "spacing", model); + model = jsonDelete("chartOptions.*.axes.*.crossLines.label.className", model); + model = jsonMutateProperty("chartOptions.*.axes.*.crossLines.label.position", true, model, (parent, targetProp) => { + if (typeof parent[targetProp] === "string") { + parent[targetProp] = parent[targetProp].replace(/([A-Z])/, "-$1").toLowerCase(); + } + }); + model = jsonDelete("chartOptions.bullet", model); + model = jsonRenameEnumValues("chartOptions.bar.series.label.placement", model, { + inside: "inside-center", + outside: "inside-end" + }); + model = jsonRenameEnumValues("chartOptions.waterfall.series.item.*.label.placement", model, { + inside: "inside-center", + start: "outside-start", + end: "outside-end" + }); + model = jsonDelete("chartOptions.*.navigator.min", model); + model = jsonDelete("chartOptions.*.navigator.max", model); + model = jsonDelete("chartOptions.*.zoom.ratioX", model); + model = jsonDelete("chartOptions.*.zoom.ratioY", model); + model = jsonDelete("chartOptions.*.zoom.rangeX", model); + model = jsonDelete("chartOptions.*.zoom.rangeY", model); + return model; +} +function migrateV34(model) { + const highlightUpdate = (parent, targetProp) => { + const highlightStyle = parent[targetProp]; + if (highlightStyle == null) { + return; + } + const highlight = {}; + if (highlightStyle.item) { + highlight.highlightedItem = highlightStyle.item; + } + if (highlightStyle.series) { + const { dimOpacity, ...seriesOpts } = highlightStyle.series; + if (dimOpacity != null) { + highlight.unhighlightedSeries = { opacity: dimOpacity }; + } + if (Object.keys(seriesOpts).length > 0) { + highlight.highlightedSeries = seriesOpts; + } + } + delete parent[targetProp]; + parent.highlight = highlight; + }; + jsonMutateProperty("chartOptions.series[].highlightStyle", true, model, highlightUpdate); + return model; +} +function cleanup(model) { + model = jsonDelete("chartOptions.*.width", model); + model = jsonDelete("chartOptions.*.height", model); + model = jsonBackfill("chartOptions.*.axes.category.label.autoRotate", true, model); + return model; +} +function heuristicVersionDetection(model) { + const modelAny = model; + if (model.version != null) { + return model.version; + } + const hasKey = (obj, ...keys) => { + return Object.keys(obj || {}).some((k) => keys.includes(k)); + }; + const chartOptions = modelAny.chartOptions; + const seriesOptions = hasKey(chartOptions, "seriesDefaults") ? chartOptions?.seriesDefaults : chartOptions?.[Object.keys(chartOptions)[0]]; + const hints = { + "27.0.0": hasKey(modelAny, "seriesChartTypes"), + "26.2.0": !hasKey(chartOptions, "seriesDefaults"), + "26.1.0": hasKey(seriesOptions?.highlightStyle, "item"), + "26.0.0": hasKey(seriesOptions?.highlightStyle, "series"), + // '26.0.0': modelAny.chart === undefined, + "25.1.0": hasKey(seriesOptions?.label, "minAngle"), + "25.0.0": hasKey(modelAny, "modelType", "aggFunc", "unlinkChart", "suppressChartRanges") || hasKey(seriesOptions, "lineDash", "lineDashOffset"), + "24.0.0": hasKey(modelAny, "chartThemeName", "chart") || hasKey(chartOptions, "series"), + "23.2.0": hasKey(chartOptions, "navigator"), + "23.0.0": hasKey(chartOptions?.legend?.item?.marker, "shape"), + "22.1.0": hasKey(modelAny, "chartPalette", "chartType") + }; + const defaultVersion = "27.1.0"; + const matchingHints = Object.entries(hints).filter(([_, match]) => match); + if (DEBUG) { + console.log("AG Grid: ChartModel migration", { heuristicVersionCandidates: matchingHints }); + } + const [heuristicVersion = defaultVersion] = matchingHints[0]; + if (DEBUG) { + console.log("AG Grid: ChartModel migration", { heuristicVersion }); + } + return heuristicVersion; +} +function migrateIfBefore(maxVersion, model, migration) { + if (versionNumber(maxVersion) > versionNumber(model.version)) { + if (DEBUG) { + console.log("AG Grid: ChartModel migration", { migratingTo: maxVersion }); + } + const result = migration(model); + result.version = maxVersion; + if (DEBUG) { + console.log("AG Grid: ChartModel migration", { migratedTo: maxVersion, result }); + } + return result; + } + return model; +} +function versionParts(versionRaw) { + const version = versionRaw.includes("-beta") ? versionRaw.replace(/-beta.*/, "") : versionRaw; + const split = typeof version === "string" ? version.split(".").map((v) => Number(v)) : []; + if (split.length !== 3 || split.some((v) => isNaN(v))) { + throw new Error(_errMsg3(253, { version })); + } + return { + major: split[0], + minor: split[1], + patch: split[2] + }; +} +function versionNumber(version) { + const { major, minor, patch } = versionParts(version); + return major * 1e4 + minor * 100 + patch; +} +function jsonDeleteDefault(path, defaultValue, json) { + return jsonMutateProperty(path, true, json, (parent, prop) => { + if (parent[prop] === defaultValue) { + delete parent[prop]; + } + }); +} +function jsonBackfill(path, defaultValue, json) { + return jsonMutateProperty(path, false, json, (parent, prop) => { + if (parent[prop] == null) { + parent[prop] = defaultValue; + } + }); +} +function jsonAdd(path, value, json) { + if (typeof path === "string") { + path = path.split("."); + } + const nextPath = path[0]; + if (path.length > 1) { + json[nextPath] = jsonAdd(path.slice(1), value, json[nextPath] ?? {}); + } + const hasProperty = Object.keys(json).includes(nextPath); + if (!hasProperty) { + json[nextPath] = value; + } + return json; +} +function jsonMove(from, to, json) { + let valueToMove = void 0; + let valueFound = false; + json = jsonMutateProperty(from, true, json, (parent, prop) => { + valueFound = true; + valueToMove = parent[prop]; + delete parent[prop]; + }); + if (!valueFound) { + return json; + } + return jsonMutateProperty(to, false, json, (parent, prop) => { + parent[prop] = valueToMove; + }); +} +function jsonMoveIfMissing(from, to, json) { + let valueToMove = void 0; + let valueFound = false; + json = jsonMutateProperty(from, true, json, (parent, prop) => { + valueFound = true; + valueToMove = parent[prop]; + delete parent[prop]; + }); + if (!valueFound) { + return json; + } + return jsonMutateProperty(to, false, json, (parent, prop) => { + if (parent[prop] === void 0) { + parent[prop] = valueToMove; + } + }); +} +function jsonRename(path, renameTo, json) { + return jsonMutateProperty(path, true, json, (parent, prop) => { + parent[renameTo] = parent[prop]; + delete parent[prop]; + }); +} +function jsonDelete(path, json) { + return jsonMutateProperty(path, true, json, (parent, prop) => delete parent[prop]); +} +function jsonMutateProperty(path, skipMissing, json, mutator) { + const pathElements = path instanceof Array ? path : path.split("."); + const parentPathElements = pathElements.slice(0, pathElements.length - 1); + const targetName = pathElements[pathElements.length - 1]; + return jsonMutate(parentPathElements, json, (parent) => { + const hasProperty = Object.keys(parent).includes(targetName); + if (skipMissing && !hasProperty) { + return parent; + } + const result = { ...parent }; + mutator(result, targetName); + return result; + }); +} +function jsonMutate(path, json, mutator) { + const pathElements = path instanceof Array ? path : path.split("."); + json = { ...json }; + if (pathElements.length === 0) { + return mutator(json); + } else if (pathElements[0].startsWith("{")) { + const pathOptions = pathElements[0].substring(1, pathElements[0].lastIndexOf("}")).split(","); + for (const pathOption of pathOptions) { + if (json[pathOption] != null) { + json[pathOption] = jsonMutate(pathElements.slice(1), json[pathOption], mutator); + } + } + } else if (pathElements[0].endsWith("[]")) { + const arrayName = pathElements[0].substring(0, path[0].indexOf("[")); + if (json[arrayName] instanceof Array) { + json[arrayName] = json[arrayName].map((v) => jsonMutate(pathElements.slice(1), v, mutator)); + } + } else if (pathElements[0] === "*") { + for (const jsonProp of Object.keys(json)) { + json[jsonProp] = jsonMutate(pathElements.slice(1), json[jsonProp], mutator); + } + } else if (json[pathElements[0]] != null) { + json[pathElements[0]] = jsonMutate(pathElements.slice(1), json[pathElements[0]], mutator); + } + return json; +} +function jsonRenameEnumValues(path, json, values) { + return jsonMutateProperty(path, true, json, (parent, targetProp) => { + if (typeof parent[targetProp] === "string") { + parent[targetProp] = values[targetProp] ?? targetProp; + } + }); +} +var merge = (r, n) => ({ ...r, ...n }); + +// packages/ag-grid-enterprise/src/charts/chartService.ts +var ChartService = class extends BeanStub101 { + constructor() { + super(...arguments); + this.beanName = "chartSvc"; + // we destroy all charts bound to this grid when grid is destroyed. activeCharts contains all charts, including + // those in developer provided containers. + this.activeCharts = /* @__PURE__ */ new Set(); + this.activeChartComps = /* @__PURE__ */ new Set(); + // this shared (singleton) context is used by cross filtering in line and area charts + this.crossFilteringContext = { + lastSelectedChartId: "" + }; + this.isEnterprise = () => this.agChartsExports.isEnterprise; + } + wireBeans(beans) { + this.visibleCols = beans.visibleCols; + this.rangeSvc = beans.rangeSvc; + this.agChartsExports = beans.agChartsExports; + } + updateChart(params) { + if (this.activeChartComps.size === 0) { + _warn68(124); + return; + } + const chartComp = [...this.activeChartComps].find((chartComp2) => chartComp2.getChartId() === params.chartId); + if (!chartComp) { + _warn68(125, { chartId: params.chartId }); + return; + } + chartComp.update(params); + } + getChartModels() { + const models = []; + const versionedModel = (c) => { + return { ...c, version: VERSION }; + }; + for (const c of this.activeChartComps) { + models.push(versionedModel(c.getChartModel())); + } + return models; + } + getChartRef(chartId) { + let chartRef; + for (const cr of this.activeCharts) { + if (cr.chartId === chartId) { + chartRef = cr; + } + } + return chartRef; + } + getChartComp(chartId) { + let chartComp; + for (const comp of this.activeChartComps) { + if (comp.getChartId() === chartId) { + chartComp = comp; + } + } + return chartComp; + } + getChartImageDataURL(params) { + let url; + for (const c of this.activeChartComps) { + if (c.getChartId() === params.chartId) { + url = c.getChartImageDataURL(params.fileFormat); + } + } + return url; + } + downloadChart(params) { + const chartComp = Array.from(this.activeChartComps).find((c) => c.getChartId() === params.chartId); + chartComp?.downloadChart(params.dimensions, params.fileName, params.fileFormat); + } + openChartToolPanel(params) { + const chartComp = Array.from(this.activeChartComps).find((c) => c.getChartId() === params.chartId); + chartComp?.openChartToolPanel(params.panel); + } + closeChartToolPanel(chartId) { + const chartComp = Array.from(this.activeChartComps).find((c) => c.getChartId() === chartId); + chartComp?.closeChartToolPanel(); + } + createChartFromCurrentRange(chartType = "groupedColumn", fromApi) { + const cellRange = this.getSelectedRange(); + return this.createChart({ cellRange, chartType, focusDialogOnOpen: !fromApi }); + } + restoreChart(model, chartContainer) { + if (!model) { + _warn68(126); + return; + } + if (model.version !== VERSION) { + model = upgradeChartModel(model); + } + let cellRange; + let pivotChart; + let suppressChartRanges; + let chartPaletteToRestore; + if (model.modelType === "pivot") { + this.gos.updateGridOptions({ options: { pivotMode: true }, source: "pivotChart" }); + cellRange = this.createCellRange(void 0, true); + pivotChart = true; + suppressChartRanges = true; + } else { + cellRange = this.createCellRange(model.cellRange); + chartPaletteToRestore = model.chartPalette; + suppressChartRanges = model.suppressChartRanges; + } + if (!cellRange) { + return; + } + return this.createChart({ + ...model, + cellRange, + pivotChart, + suppressChartRanges, + chartContainer, + chartOptionsToRestore: model.chartOptions, + chartPaletteToRestore + }); + } + createRangeChart(params, fromApi) { + const cellRange = this.createCellRange(params.cellRange); + if (!cellRange) { + return; + } + return this.createChart({ + ...params, + cellRange, + focusDialogOnOpen: !fromApi + }); + } + createPivotChart(params, fromApi) { + this.gos.updateGridOptions({ options: { pivotMode: true }, source: "pivotChart" }); + const cellRange = this.createCellRange(void 0, true); + if (!cellRange) { + return; + } + return this.createChart({ + ...params, + cellRange, + pivotChart: true, + suppressChartRanges: true, + focusDialogOnOpen: !fromApi + }); + } + createCrossFilterChart(params, fromApi) { + const cellRange = this.createCellRange(params.cellRange); + if (!cellRange) { + return; + } + const suppressChartRangesSupplied = typeof params.suppressChartRanges !== "undefined" && params.suppressChartRanges !== null; + const suppressChartRanges = suppressChartRangesSupplied ? params.suppressChartRanges : true; + return this.createChart({ + ...params, + cellRange, + suppressChartRanges, + crossFiltering: true, + crossFilteringSort: params.sort, + focusDialogOnOpen: !fromApi + }); + } + createChart(params) { + const validationResult = validateCreateParams(params, this.agChartsExports.isEnterprise); + if (!validationResult) { + return void 0; + } + params = validationResult === true ? params : validationResult; + const { chartType, chartContainer } = params; + const createChartContainerFunc = this.gos.getCallback("createChartContainer"); + const gridChartParams = { + ...params, + chartId: this.generateId(), + chartType: getCanonicalChartType(chartType), + insideDialog: !(chartContainer || createChartContainerFunc), + crossFilteringContext: this.crossFilteringContext, + crossFilteringResetCallback: () => { + for (const c of this.activeChartComps) { + c.crossFilteringReset(); + } + } + }; + const chartComp = new GridChartComp(gridChartParams); + this.createBean(chartComp); + const chartRef = this.createChartRef(chartComp); + if (chartContainer) { + chartContainer.appendChild(chartRef.chartElement); + } else if (createChartContainerFunc) { + createChartContainerFunc(chartRef); + } else { + chartComp.addEventListener("destroyed", () => { + this.activeChartComps.delete(chartComp); + this.activeCharts.delete(chartRef); + }); + } + return chartRef; + } + createChartRef(chartComp) { + const chartRef = { + destroyChart: () => { + if (this.activeCharts.has(chartRef)) { + this.destroyBean(chartComp); + this.activeChartComps.delete(chartComp); + this.activeCharts.delete(chartRef); + } + }, + focusChart: () => { + _focusInto12(chartComp.getGui()); + }, + chartElement: chartComp.getGui(), + chart: chartComp.getUnderlyingChart(), + chartId: chartComp.getChartModel().chartId, + setMaximized: chartComp.setMaximized.bind(chartComp) + }; + this.activeCharts.add(chartRef); + this.activeChartComps.add(chartComp); + return chartRef; + } + getSelectedRange() { + const ranges = this.rangeSvc?.getCellRanges(); + if (!ranges || ranges.length === 0) { + return { columns: [] }; + } + const uCols = /* @__PURE__ */ new Set(); + let startRowIndex = Number.MAX_VALUE; + let endRowIndex = -Number.MAX_VALUE; + for (const { startRow: sr, endRow: er, columns: cols } of ranges) { + if (!(sr && er)) { + continue; + } + for (const col of cols) { + uCols.add(col); + } + let { rowIndex: sRowIndex, rowPinned: startRowPinned } = sr; + let { rowIndex: eRowIndex, rowPinned: endRowPinned } = er; + if (startRowPinned === "top") { + if (endRowPinned === "top") { + continue; + } + sRowIndex = 0; + } + if (endRowPinned === "bottom") { + if (startRowPinned === "bottom") { + continue; + } + eRowIndex = this.beans.pageBounds.getLastRow(); + } + if (sRowIndex !== void 0) { + startRowIndex = Math.min(startRowIndex, sRowIndex); + } + if (eRowIndex !== void 0) { + endRowIndex = Math.max(endRowIndex, eRowIndex); + } + } + if (startRowIndex === Number.MAX_VALUE || endRowIndex === -Number.MAX_VALUE) { + return { columns: [] }; + } + const columns = Array.from(uCols); + return { + // Don't specify id here, as it should be chart-specific + // but we don't have that context yet + columns, + startColumn: columns[0], + startRow: { + rowIndex: startRowIndex, + rowPinned: void 0 + }, + endRow: { + rowIndex: endRowIndex, + rowPinned: void 0 + } + }; + } + generateId() { + return `id-${Math.random().toString(36).substring(2, 18)}`; + } + createCellRange(cellRangeParams, allRange) { + const rangeParams = allRange ? { + rowStartIndex: null, + rowStartPinned: void 0, + rowEndIndex: null, + rowEndPinned: void 0, + columns: this.visibleCols.allCols.map((col) => col.getColId()) + } : cellRangeParams; + const cellRange = rangeParams && this.rangeSvc?.createPartialCellRangeFromRangeParams(rangeParams, true); + if (!cellRange) { + _warn68(127, { allRange }); + } + return cellRange; + } + destroy() { + for (const chart of this.activeCharts) { + chart.destroyChart(); + } + super.destroy(); + } +}; + +// packages/ag-grid-enterprise/src/charts/chartsApi.ts +function getChartModels(beans) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.getChartModels()); +} +function getChartRef(beans, chartId) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.getChartRef(chartId)); +} +function getChartImageDataURL(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.getChartImageDataURL(params)); +} +function downloadChart(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.downloadChart(params)); +} +function openChartToolPanel(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.openChartToolPanel(params)); +} +function closeChartToolPanel(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.closeChartToolPanel(params.chartId)); +} +function createRangeChart(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.createRangeChart(params, true)); +} +function createPivotChart(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.createPivotChart(params, true)); +} +function createCrossFilterChart(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.createCrossFilterChart(params, true)); +} +function updateChart(beans, params) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.updateChart(params)); +} +function restoreChart(beans, chartModel, chartContainer) { + return beans.frameworkOverrides.wrapIncoming(() => beans.chartSvc?.restoreChart(chartModel, chartContainer)); +} + +// packages/ag-grid-enterprise/src/charts/integratedChartsModule.css +var integratedChartsModule_default = `.ag-chart{display:flex;height:100%;position:relative;width:100%}.ag-chart-components-wrapper{display:flex}.ag-chart-canvas-wrapper,.ag-chart-components-wrapper{flex:1 1 auto;position:relative}.ag-chart-menu{background:var(--ag-background-color);background-color:color-mix(in srgb,transparent,var(--ag-background-color) 30%);border-radius:var(--ag-border-radius);display:flex;flex-direction:row;gap:20px;padding:4px 2px;position:absolute;top:8px;width:auto;--ag-icon-size:20px}:where(.ag-ltr) .ag-chart-menu{justify-content:right;right:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}:where(.ag-rtl) .ag-chart-menu{justify-content:left;left:calc(var(--ag-cell-horizontal-padding) + var(--ag-spacing) - 4px)}.ag-chart-docked-container{min-width:var(--ag-chart-menu-panel-width);position:relative}:where(.ag-chart-menu-hidden)~.ag-chart-docked-container{display:none}.ag-chart-tabbed-menu{display:flex;flex-direction:column;height:100%;overflow:hidden;width:100%}.ag-chart-tabbed-menu-header{cursor:default;flex:none;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-tabbed-menu-body{align-items:stretch;display:flex;flex:1 1 auto;overflow:hidden;position:relative}.ag-chart-tabbed-menu-body:after{background:linear-gradient(var(--ag-background-color),transparent);content:"";display:block;height:16px;left:0;position:absolute;right:0;top:0}.ag-chart-tab{overflow:hidden;overflow-y:auto;width:100%}.ag-chart-settings{overflow-x:hidden}.ag-chart-settings-wrapper{display:flex;flex-direction:column;height:100%;overflow:hidden;position:relative;width:100%}.ag-chart-settings-nav-bar{align-items:center;border-top:solid var(--ag-border-width) var(--ag-border-color);display:flex;height:30px;padding:0 10px;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:100%}.ag-chart-settings-card-selector{align-items:center;display:flex;flex:1 1 auto;height:100%;justify-content:space-around;padding:0 10px}.ag-chart-settings-card-item{background-color:var(--ag-foreground-color);border-radius:4px;cursor:pointer;height:8px;position:relative;width:8px;&.ag-not-selected{opacity:.2}&.ag-selected{background-color:var(--ag-accent-color)}}.ag-chart-settings-card-item:before{background-color:transparent;content:" ";display:block;height:20px;left:50%;margin-left:-10px;margin-top:-10px;position:absolute;top:50%;width:20px}.ag-chart-settings-next,.ag-chart-settings-prev{flex:none;position:relative}.ag-chart-settings-next:focus-within,.ag-chart-settings-prev:focus-within{border-radius:1px;box-shadow:var(--ag-focus-shadow)}.ag-chart-settings-next-button,.ag-chart-settings-prev-button{cursor:pointer;height:100%;left:0;opacity:0;position:absolute;top:0;width:100%}.ag-chart-settings-mini-charts-container{flex:1 1 auto;overflow:hidden auto;position:relative}.ag-chart-settings-mini-wrapper{display:flex;flex-direction:column;left:0;min-height:100%;overflow:hidden;padding-bottom:var(--ag-widget-container-vertical-padding);position:absolute;top:0;width:100%;&.ag-animating{transition:left .3s;transition-timing-function:ease-in-out}}.ag-chart-mini-thumbnail{border:solid var(--ag-border-width) var(--ag-border-color);border-radius:5px;cursor:pointer;padding:1px;&.ag-selected{border-color:var(--ag-accent-color);border-width:calc(var(--ag-border-width) + 1px);padding:unset}&:focus-visible{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}}.ag-chart-mini-thumbnail-canvas{display:block}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper,.ag-chart-format-wrapper{display:flex;flex-direction:column;padding-bottom:16px;position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-chart-advanced-settings-wrapper,.ag-chart-data-wrapper{height:100%;overflow-y:auto}.ag-chart-advanced-settings{background-color:var(--ag-chrome-background-color)}.ag-chart-advanced-settings,.ag-chart-advanced-settings-wrapper{width:100%}.ag-chart-advanced-settings-wrapper{padding-bottom:0}.ag-chart-advanced-settings-section{border-bottom:solid var(--ag-border-width) var(--ag-border-color);display:flex;margin:0;padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding)}.ag-chart-empty-text{align-items:center;background-color:var(--ag-background-color);display:flex;height:100%;justify-content:center;top:0;width:100%}.ag-charts-font-size-color{align-self:stretch;display:flex;justify-content:space-between}.ag-chart-menu-icon{border-radius:var(--ag-border-radius);cursor:pointer;margin:2px 0;opacity:.8}.ag-chart-menu-icon:hover{opacity:1}.ag-chart-menu-toolbar-button{background-color:unset;border:0;border-radius:1px;padding:0 2px}.ag-chart-data-column-drag-handle{margin-left:var(--ag-spacing)}.ag-chart-data-section,.ag-chart-format-section{display:flex;margin:0;:where(.ag-label:not(.ag-group-title-bar)){color:var(--ag-chart-menu-label-color)}:where(.ag-label-align-top .ag-label){margin-bottom:var(--ag-widget-vertical-spacing);margin-top:calc(var(--ag-widget-vertical-spacing)*.5)}:where(.ag-slider.ag-label-align-top .ag-label){margin-bottom:0}.ag-label{display:inline-block}}.ag-chart-menu-panel{--ag-panel-background-color:var(--ag-chrome-background-color)}:where(.ag-ltr) .ag-chart-menu-panel{border-left:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-chart-menu-panel{border-right:solid var(--ag-border-width) var(--ag-border-color)}.ag-chart-data-wrapper,.ag-chart-format-wrapper{margin:0;padding:0}.ag-group{.ag-charts-data-group-item{padding-bottom:var(--ag-widget-container-vertical-padding);position:relative}.ag-charts-data-group-item:where(:not(:last-child)){margin-bottom:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-title-bar{background-color:unset;position:relative}.ag-charts-data-group-item:where(:not(.ag-charts-format-sub-level-group,.ag-pill-select,.ag-select)){height:var(--ag-list-item-height)}.ag-charts-data-group-item:where(.ag-picker-field){margin-top:var(--ag-spacing)}.ag-charts-advanced-settings-top-level-group-item,.ag-charts-format-top-level-group-item{margin:var(--ag-spacing) 0}.ag-charts-format-sub-level-group-container{display:flex;flex-direction:column;padding:var(--ag-widget-vertical-spacing) 0}.ag-charts-settings-group-container{border-top:none;display:grid;font-weight:500;grid-template-columns:60px 1fr 60px 1fr 60px;row-gap:8px;:where(.ag-chart-mini-thumbnail:nth-child(3n+1)){grid-column:1}:where(.ag-chart-mini-thumbnail:nth-child(3n+2)){grid-column:3}:where(.ag-chart-mini-thumbnail:nth-child(3n+3)){grid-column:5}}.ag-charts-data-group-title-bar,.ag-charts-format-top-level-group-title-bar,.ag-charts-settings-group-title-bar{border-top:none;font-weight:500;margin:0;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:relative}.ag-charts-format-sub-level-group-title-bar{background:none;font-weight:500;padding:var(--ag-widget-vertical-spacing) 0}&.ag-charts-data-group,&.ag-charts-format-top-level-group{border-top:solid var(--ag-border-width) var(--ag-border-color)}.ag-charts-data-group-container,.ag-charts-format-top-level-group-container,.ag-charts-settings-group-container{margin:0;padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-format-sub-level-group-item,.ag-charts-format-sub-level-no-header-group-item,.ag-charts-format-top-level-group-item{margin-bottom:var(--ag-widget-vertical-spacing)}&.ag-charts-format-sub-level-group,&.ag-charts-format-top-level-group,.ag-charts-format-sub-level-group-item:last-child,.ag-charts-format-top-level-group-item{margin:0;padding:0}.ag-charts-advanced-settings-top-level-group-container{margin:0}.ag-charts-advanced-settings-top-level-group-container,.ag-charts-advanced-settings-top-level-group-title-bar{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-charts-advanced-settings-top-level-group-item{margin-bottom:0;margin-top:calc(var(--ag-widget-vertical-spacing)*2)}}.ag-chart-settings-card-item.ag-not-selected:hover{opacity:.35}.ag-angle-select{align-items:center;display:flex}.ag-angle-select-wrapper{display:flex}.ag-angle-select-parent-circle{background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:12px;display:block;height:24px;position:relative;width:24px}.ag-angle-select-child-circle{background-color:var(--ag-foreground-color);border-radius:3px;height:6px;left:12px;margin-left:-3px;margin-top:-4px;position:absolute;top:4px;width:6px}.ag-slider-wrapper{display:flex;:where(.ag-input-field){flex:1 1 auto}}.ag-color-panel{display:flex;flex-direction:column;padding:var(--ag-spacing);text-align:center;width:100%}.ag-spectrum-color{cursor:default;flex:1 1 auto;overflow:visible;position:relative}.ag-spectrum-color,.ag-spectrum-fill{border-radius:var(--ag-border-radius)}.ag-spectrum-fill{inset:0;position:absolute}.ag-spectrum-val{background-image:linear-gradient(0deg,#000,hsla(20,42%,65%,0));cursor:pointer}.ag-spectrum-dragger{background:#000;border:var(--ag-color-picker-thumb-border-width) solid #fff;border-radius:var(--ag-color-picker-thumb-size);box-shadow:0 0 2px 0 rgba(0,0,0,.24);cursor:pointer;height:var(--ag-color-picker-thumb-size);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}.ag-spectrum-alpha,.ag-spectrum-hue{cursor:default}.ag-spectrum-hue-background{background:linear-gradient(270deg,red 3%,#ff0 17%,#0f0 33%,#0ff 50%,#00f 67%,#f0f 83%,red);height:100%;width:100%}.ag-spectrum-alpha-background{background:linear-gradient(to right,var(--ag-internal-spectrum-alpha-color-from),var(--ag-internal-spectrum-alpha-color-to)),url('data:image/svg+xml;utf8,') 0 0 /4px 4px;height:100%;width:100%}.ag-spectrum-tool{cursor:pointer;height:var(--ag-color-picker-track-size);margin-bottom:10px;position:relative}.ag-spectrum-slider,.ag-spectrum-tool{border-radius:var(--ag-color-picker-thumb-size)}.ag-spectrum-slider{border:var(--ag-color-picker-thumb-border-width) solid #fff;box-shadow:0 1px 4px 0 rgba(0,0,0,.37);height:var(--ag-color-picker-thumb-size);margin-top:calc(var(--ag-color-picker-track-size)/2*-1 + var(--ag-color-picker-thumb-size)/2*-1);pointer-events:none;position:absolute;width:var(--ag-color-picker-thumb-size)}:where(.ag-spectrum-alpha) .ag-spectrum-slider{background:linear-gradient(to bottom,var(--ag-internal-spectrum-alpha-color),var(--ag-internal-spectrum-alpha-color)) var(--ag-background-color)}.ag-recent-colors{display:flex;gap:6px;margin:10px var(--ag-spacing) 2px}.ag-recent-color{border:solid var(--ag-border-width) var(--ag-border-color);cursor:pointer}.ag-angle-select[disabled]{opacity:.5;pointer-events:none}:where(.ag-ltr) .ag-angle-select-field,:where(.ag-ltr) .ag-slider-field{margin-right:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-angle-select-field,:where(.ag-rtl) .ag-slider-field{margin-left:calc(var(--ag-spacing)*2)}.ag-color-dialog{border-radius:5px}:where(.ag-color-picker){.ag-picker-field-wrapper{padding-left:var(--ag-spacing);padding-right:var(--ag-spacing)}.ag-picker-field-display{align-items:center;display:flex;flex-direction:row;min-height:var(--ag-list-item-height)}}:where(.ag-ltr) .ag-color-picker-color,:where(.ag-ltr) .ag-color-picker-value{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-color-picker-color,:where(.ag-rtl) .ag-color-picker-value{margin-left:var(--ag-spacing)}.ag-spectrum-tools{padding:10px 0 0}.ag-spectrum-alpha-background,.ag-spectrum-hue-background{border-radius:var(--ag-color-picker-track-border-radius)}.ag-color-input-color,.ag-color-picker-color,.ag-recent-color{border-radius:var(--ag-color-picker-color-border-radius)}.ag-spectrum-sat{background-image:linear-gradient(90deg,#fff,hsla(20,42%,65%,0))}.ag-recent-color,.ag-spectrum-color,.ag-spectrum-slider{&:where(:not(:disabled,[readonly])):focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-color-input-color,.ag-color-picker-color{border:solid var(--ag-border-width) var(--ag-border-color);height:var(--ag-icon-size);width:var(--ag-icon-size)}:where(.ag-ltr) .ag-color-input .ag-input-field-input{padding-left:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-rtl) .ag-color-input .ag-input-field-input{padding-right:calc(var(--ag-icon-size) + var(--ag-spacing)*2)}:where(.ag-color-input) .ag-color-input-color{position:absolute}:where(.ag-ltr) :where(.ag-color-input) .ag-color-input-color{margin-left:var(--ag-spacing)}:where(.ag-rtl) :where(.ag-color-input) .ag-color-input-color{margin-right:var(--ag-spacing)}.ag-range-field{align-items:center;display:flex;:where(.ag-input-wrapper){height:100%}}.ag-range-field-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;background:none;height:100%;overflow:visible;padding:0;width:100%;&:disabled{opacity:.5}}.ag-range-field-input{&::-webkit-slider-runnable-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-webkit-slider-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-webkit-slider-runnable-track{background-color:var(--ag-accent-color)}}.ag-range-field-input{&::-moz-range-track{background-color:var(--ag-border-color);border-radius:1.5px;height:3px;margin:0;padding:0;width:100%}&::-moz-ag-range-thumb{-moz-appearance:none;appearance:none;background-color:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:100%;height:var(--ag-icon-size);margin:0;padding:0;transform:translateY(calc(var(--ag-icon-size)*-.5 + 1.5px));width:var(--ag-icon-size)}&:focus::-moz-ag-range-thumb{border-color:var(--ag-accent-color);box-shadow:var(--ag-focus-shadow)}&:active::-moz-ag-range-track{background-color:var(--ag-accent-color)}}`; + +// packages/ag-grid-enterprise/src/charts/utils/validGridChartsVersion.ts +var VERSION_CHECKING_FIRST_GRID_MAJOR_VERSION = 28; +var VERSION_CHECKING_FIRST_CHARTS_MAJOR_VERSION = 6; +function isValidVersion(version) { + return version?.match(/\d+\.\d+\.\d+/); +} +function isValidMajorVersion({ + gridMajorVersion, + chartsMajorVersion +}) { + const gridMajor = parseInt(gridMajorVersion, 10); + const chartsMajor = parseInt(chartsMajorVersion, 10); + const gridMajorDifference = gridMajor - VERSION_CHECKING_FIRST_GRID_MAJOR_VERSION; + const chartsMajorDifference = chartsMajor - VERSION_CHECKING_FIRST_CHARTS_MAJOR_VERSION; + const isFirstOrAfterVersion = gridMajorDifference >= 0; + return gridMajorDifference === chartsMajorDifference && isFirstOrAfterVersion; +} +function gridChartVersion(gridVersion) { + if (!gridVersion || !isValidVersion(gridVersion)) { + return void 0; + } + const [gridMajor, gridMinor] = gridVersion.split(".") || []; + const gridMajorMinor = `${gridMajor}.${gridMinor}.x`; + const gridMajorNumber = parseInt(gridMajor, 10); + const chartsMajor = gridMajorNumber - VERSION_CHECKING_FIRST_GRID_MAJOR_VERSION + VERSION_CHECKING_FIRST_CHARTS_MAJOR_VERSION; + if (chartsMajor < 0) { + return void 0; + } + const chartsMinor = gridMinor; + const chartsMajorMinor = `${chartsMajor}.${chartsMinor}.x`; + return { + gridMajorMinor, + chartsMajorMinor + }; +} +function validGridChartsVersionErrorMessage({ + type, + gridVersion, + chartsVersion +}) { + const invalidMessage = "AG Grid: AG Grid version is incompatible. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information."; + if (!gridVersion) { + return invalidMessage; + } + const version = gridChartVersion(gridVersion); + if (!version) { + return invalidMessage; + } + const { gridMajorMinor, chartsMajorMinor } = version; + if (type === "incompatible") { + return `AG Grid version ${gridVersion} and AG Charts version ${chartsVersion} is not supported. AG Grid version ${gridMajorMinor} should be used with AG Chart ${chartsMajorMinor}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`; + } else if (type === "invalidCharts") { + return `AG Grid version ${gridMajorMinor} should be used with AG Chart ${chartsMajorMinor} not ${chartsVersion}. Please see https://www.ag-grid.com/javascript-data-grid/modules/ for more information.`; + } + return invalidMessage; +} +function validGridChartsVersion({ + gridVersion, + chartsVersion +}) { + if (!isValidVersion(chartsVersion)) { + return { + isValid: false, + message: validGridChartsVersionErrorMessage({ type: "invalidCharts", gridVersion, chartsVersion }) + }; + } + if (!isValidVersion(gridVersion)) { + return { + isValid: false, + message: validGridChartsVersionErrorMessage({ type: "invalidGrid", gridVersion, chartsVersion }) + }; + } + const [gridMajor, gridMinor] = gridVersion.split(".") || []; + const [chartsMajor, chartsMinor, chartsPatch] = chartsVersion.split(".") || []; + const isValidMajor = isValidMajorVersion({ + gridMajorVersion: gridMajor, + chartsMajorVersion: chartsMajor + }); + if (isValidMajor && gridMinor === chartsMinor || chartsPatch.includes("beta")) { + return { + isValid: true + }; + } else if (!isValidMajor || gridMinor !== chartsMinor) { + return { + isValid: false, + message: validGridChartsVersionErrorMessage({ type: "incompatible", gridVersion, chartsVersion }) + }; + } + return { + isValid: false, + message: validGridChartsVersionErrorMessage({ type: "invalid", gridVersion, chartsVersion }) + }; +} + +// packages/ag-grid-enterprise/src/charts/integratedChartsModule.ts +var icons = { + // shown on top right of chart when chart is linked to range data (click to unlink) + linked: "linked", + // shown on top right of chart when chart is not linked to range data (click to link) + unlinked: "unlinked", + // icon to open charts menu + chartsMenu: "menu-alt", + // download chart + chartsDownload: "save", + // Edit Chart menu item shown in Integrated Charts menu + chartsMenuEdit: "chart", + // Advanced Settings menu item shown in Integrated Charts menu + chartsMenuAdvancedSettings: "settings", + // shown in Integrated Charts menu add fields + chartsMenuAdd: "plus", + // shown in Integrated Charts tool panel color picker + chartsColorPicker: "small-down", + // previous in Integrated Charts settings tool panel theme switcher + chartsThemePrevious: "previous", + // next in Integrated Charts settings tool panel theme switcher + chartsThemeNext: "next" +}; +var apiFunctions = { + getChartModels, + getChartRef, + getChartImageDataURL, + downloadChart, + openChartToolPanel, + closeChartToolPanel, + createRangeChart, + createPivotChart, + createCrossFilterChart, + updateChart, + restoreChart +}; +var dependsOn = [ + CellSelectionModule, + EnterpriseCoreModule, + _SharedDragAndDropModule5, + _PopupModule5, + MenuItemModule +]; +var moduleName2 = "IntegratedCharts"; +var GridChartsModule = { + moduleName: "GridCharts", + version: VERSION, + dependsOn, + // included to avoid other false positive warnings about missing modules + validate: () => { + return { + isValid: false, + message: `AG Grid: As of v33, the "GridChartsModule" has been deprecated. Please use "IntegratedChartsModule.with(...)" instead. + ${_preInitErrMsg2(257)}` + }; + } +}; +var IntegratedChartsModule = { + moduleName: moduleName2, + version: VERSION, + dependsOn, + // included to avoid other false positive warnings about missing modules + validate: () => { + return { + isValid: false, + message: _preInitErrMsg2(257) + }; + }, + with: (params) => { + params.setup(); + params.setGridContext?.(true); + if (params.isEnterprise && params.setLicenseKey) { + const chartsManager = { + setLicenseKey: params.setLicenseKey + }; + LicenseManager.setChartsLicenseManager(chartsManager); + } + return { + moduleName: moduleName2, + version: VERSION, + icons, + apiFunctions, + dependsOn, + css: [integratedChartsModule_default], + validate: () => { + return validGridChartsVersion({ + gridVersion: VERSION, + chartsVersion: params.VERSION + }); + }, + beans: [ + // bind the params to the constructor to avoid the need for static properties + AgChartsExports.bind(null, params), + ChartService, + ChartTranslationService, + ChartCrossFilterService, + ChartMenuListFactory, + ChartMenuService, + // Include enterprise beans for now for all users as tiny compared to charts bundle size + EnterpriseChartProxyFactory, + AdvancedSettingsMenuFactory + ] + }; + } +}; + +// packages/ag-grid-enterprise/src/allEnterpriseModule.ts +import { AllCommunityModule } from "ag-grid-community"; +var dependsOn2 = [ + AllCommunityModule, + ClipboardModule, + ColumnsToolPanelModule, + ExcelExportModule, + FiltersToolPanelModule, + NewFiltersToolPanelModule, + MasterDetailModule, + ColumnMenuModule, + ContextMenuModule, + CellSelectionModule, + RichSelectModule, + RowNumbersModule, + RowGroupingModule, + RowGroupingPanelModule, + GroupFilterModule, + ServerSideRowModelModule, + ServerSideRowModelApiModule, + FormulaModule, + SetFilterModule, + MultiFilterModule, + AdvancedFilterModule, + SideBarModule, + StatusBarModule, + ViewportRowModelModule, + PivotModule, + TreeDataModule, + FindModule, + BatchEditModule, + RowGroupingEditModule, + AiToolkitModule +]; +var moduleName3 = "AllEnterprise"; +var AllEnterpriseModule = { + with: (params) => ({ + moduleName: moduleName3, + version: VERSION, + dependsOn: [...dependsOn2, IntegratedChartsModule.with(params), SparklinesModule.with(params)] + }), + moduleName: moduleName3, + version: VERSION, + dependsOn: dependsOn2 +}; + +// packages/ag-grid-enterprise/src/main.ts +export * from "ag-grid-community"; +export { + AdvancedFilterModule, + AggregationModule, + AiToolkitModule, + AllEnterpriseModule, + BatchEditModule, + CellSelectionModule, + ClipboardModule, + ColumnMenuModule, + ColumnsToolPanelModule, + ContextMenuModule, + ExcelExportModule, + FiltersToolPanelModule, + FindModule, + FormulaModule, + GridChartsModule, + GroupFilterModule, + IntegratedChartsModule, + GridLicenseManager as LicenseManager, + MasterDetailModule, + MenuModule, + MultiFilterModule, + NewFiltersToolPanelModule, + PivotModule, + RangeSelectionModule, + RichSelectModule, + RowGroupingEditModule, + RowGroupingModule, + RowGroupingPanelModule, + RowNumbersModule, + ServerSideRowModelApiModule, + ServerSideRowModelModule, + SetFilterModule, + SideBarModule, + SparklinesModule, + StatusBarModule, + TreeDataModule, + ViewportRowModelModule, + AgColorPicker as _AgColorPicker, + AgColorPickerSelector as _AgColorPickerSelector, + AgContextMenuService as _AgContextMenuService, + AgDialog as _AgDialog, + AgGroupComponent as _AgGroupComponent, + AgGroupComponentSelector as _AgGroupComponentSelector, + AgInputRange as _AgInputRange, + AgInputRangeSelector as _AgInputRangeSelector, + AgMenuItemComponent as _AgMenuItemComponent, + AgMenuItemRenderer as _AgMenuItemRenderer, + AgMenuList as _AgMenuList, + AgPanel as _AgPanel, + AgSlider as _AgSlider, + AgSliderSelector as _AgSliderSelector, + AgTabbedLayout as _AgTabbedLayout, + AgVirtualList as _AgVirtualList, + AgVirtualListDragFeature as _AgVirtualListDragFeature, + distributeGroupValue, + exportMultipleSheetsAsExcel, + getMultipleSheetsAsExcel +}; diff --git a/ag-grid/dist/package/package.json b/ag-grid/dist/package/package.json new file mode 100644 index 0000000..9e6dcff --- /dev/null +++ b/ag-grid/dist/package/package.json @@ -0,0 +1,131 @@ +{ + "name": "ag-grid-enterprise", + "version": "35.2.0", + "description": "Advanced Data Grid / Data Table supporting Javascript / Typescript / React / Angular / Vue", + "main": "./dist/package/main.cjs.js", + "types": "./dist/types/src/main.d.ts", + "module": "./dist/package/main.esm.mjs", + "exports": { + ".": { + "import": "./dist/package/main.esm.mjs", + "types": "./dist/types/src/main.d.ts", + "require": "./dist/package/main.cjs.js", + "default": "./dist/package/main.cjs.js" + }, + "./styles/ag-grid-no-native-widgets.css": "./styles/ag-grid-no-native-widgets.css", + "./styles/ag-grid-no-native-widgets.min.css": "./styles/ag-grid-no-native-widgets.min.css", + "./styles/ag-grid.css": "./styles/ag-grid.css", + "./styles/ag-grid.min.css": "./styles/ag-grid.min.css", + "./styles/ag-theme-alpine-no-font.css": "./styles/ag-theme-alpine-no-font.css", + "./styles/ag-theme-alpine-no-font.min.css": "./styles/ag-theme-alpine-no-font.min.css", + "./styles/ag-theme-alpine.css": "./styles/ag-theme-alpine.css", + "./styles/ag-theme-alpine.min.css": "./styles/ag-theme-alpine.min.css", + "./styles/ag-theme-balham-no-font.css": "./styles/ag-theme-balham-no-font.css", + "./styles/ag-theme-balham-no-font.min.css": "./styles/ag-theme-balham-no-font.min.css", + "./styles/ag-theme-balham.css": "./styles/ag-theme-balham.css", + "./styles/ag-theme-balham.min.css": "./styles/ag-theme-balham.min.css", + "./styles/ag-theme-material-no-font.css": "./styles/ag-theme-material-no-font.css", + "./styles/ag-theme-material-no-font.min.css": "./styles/ag-theme-material-no-font.min.css", + "./styles/ag-theme-material.css": "./styles/ag-theme-material.css", + "./styles/ag-theme-material.min.css": "./styles/ag-theme-material.min.css", + "./styles/ag-theme-quartz-no-font.css": "./styles/ag-theme-quartz-no-font.css", + "./styles/ag-theme-quartz-no-font.min.css": "./styles/ag-theme-quartz-no-font.min.css", + "./styles/ag-theme-quartz.css": "./styles/ag-theme-quartz.css", + "./styles/ag-theme-quartz.min.css": "./styles/ag-theme-quartz.min.css", + "./styles/agGridAlpineFont.css": "./styles/agGridAlpineFont.css", + "./styles/agGridAlpineFont.min.css": "./styles/agGridAlpineFont.min.css", + "./styles/agGridBalhamFont.css": "./styles/agGridBalhamFont.css", + "./styles/agGridBalhamFont.min.css": "./styles/agGridBalhamFont.min.css", + "./styles/agGridClassicFont.css": "./styles/agGridClassicFont.css", + "./styles/agGridClassicFont.min.css": "./styles/agGridClassicFont.min.css", + "./styles/agGridMaterialFont.css": "./styles/agGridMaterialFont.css", + "./styles/agGridMaterialFont.min.css": "./styles/agGridMaterialFont.min.css", + "./styles/agGridQuartzFont.css": "./styles/agGridQuartzFont.css", + "./styles/agGridQuartzFont.min.css": "./styles/agGridQuartzFont.min.css", + "./styles": "./styles/_index.scss" + }, + "sideEffects": [ + "./styles/ag-grid-no-native-widgets.css", + "./styles/ag-grid-no-native-widgets.min.css", + "./styles/ag-grid.css", + "./styles/ag-grid.min.css", + "./styles/ag-theme-alpine-no-font.css", + "./styles/ag-theme-alpine-no-font.min.css", + "./styles/ag-theme-alpine.css", + "./styles/ag-theme-alpine.min.css", + "./styles/ag-theme-balham-no-font.css", + "./styles/ag-theme-balham-no-font.min.css", + "./styles/ag-theme-balham.css", + "./styles/ag-theme-balham.min.css", + "./styles/ag-theme-material-no-font.css", + "./styles/ag-theme-material-no-font.min.css", + "./styles/ag-theme-material.css", + "./styles/ag-theme-material.min.css", + "./styles/ag-theme-quartz-no-font.css", + "./styles/ag-theme-quartz-no-font.min.css", + "./styles/ag-theme-quartz.css", + "./styles/ag-theme-quartz.min.css", + "./styles/agGridAlpineFont.css", + "./styles/agGridAlpineFont.min.css", + "./styles/agGridBalhamFont.css", + "./styles/agGridBalhamFont.min.css", + "./styles/agGridClassicFont.css", + "./styles/agGridClassicFont.min.css", + "./styles/agGridMaterialFont.css", + "./styles/agGridMaterialFont.min.css", + "./styles/agGridQuartzFont.css", + "./styles/agGridQuartzFont.min.css" + ], + "repository": { + "type": "git", + "url": "https://github.com/ag-grid/ag-grid.git" + }, + "keywords": [ + "ag", + "ag-grid", + "datagrid", + "data-grid", + "datatable", + "data-table", + "grid", + "table", + "react", + "table", + "angular", + "angular-component", + "react", + "react-component", + "reactjs", + "vue", + "vuejs" + ], + "author": "Sean Landsman ", + "license": "Commercial", + "bugs": { + "url": "https://github.com/ag-grid/ag-grid/issues" + }, + "browserslist": [ + "> 1%", + "last 2 versions", + "not ie >= 0", + "not ie_mob >= 0", + "not blackberry > 0" + ], + "homepage": "https://www.ag-grid.com/", + "dependencies": { + "ag-grid-community": "35.2.0" + }, + "optionalDependencies": { + "ag-charts-community": "13.2.0", + "ag-charts-enterprise": "13.2.0" + }, + "devDependencies": { + "ag-charts-community": "13.2.0", + "ag-charts-enterprise": "13.2.0", + "@types/jest": "^29.5.0", + "jest": "^29.5.0", + "jest-environment-jsdom": "^29.7.0", + "jest-canvas-mock": "2.5.2", + "canvas": "^3.2.1" + } +} diff --git a/dist/sigpro-grid.esm.min.js b/dist/sigpro-grid.esm.min.js new file mode 100644 index 0000000..2e8451d --- /dev/null +++ b/dist/sigpro-grid.esm.min.js @@ -0,0 +1,70 @@ +function b($){if(!$?.length)return;return $[$.length-1]}function X0($,z,Q){if($===z)return!0;if(!$||!z)return $==null&&z==null;let J=$.length;if(J!==z.length)return!1;for(let Z=0;Z=0)$.splice(Q,1)}function Q1($,z){let Q=0,J=0;for(;Q<$.length;Q++)if(!z.includes($[Q]))$[J]=$[Q],J++;while(J<$.length)$.pop()}function Y5($,z,Q){for(let J=0;J=0;J--)$.splice(Q,0,z[J])}var j$=($)=>{if($==null||$==="")return null;return $};function T($){return $!=null&&$!==""}function n($){return!T($)}var cQ=($)=>{return $!=null&&typeof $.toString==="function"?$.toString():null},DJ=($,z)=>{let Q=$?JSON.stringify($):null,J=z?JSON.stringify(z):null;return Q===J},VY=($,z,Q=!1)=>{if($==null)return z==null?0:-1;if(z==null)return 1;if(typeof $==="object"&&$.toNumber)$=$.toNumber();if(typeof z==="object"&&z.toNumber)z=z.toNumber();if(!Q||typeof $!=="string"){if($>z)return 1;if(${let G=J?()=>J.wrapIncoming(q):q;if(z)this.dispatchAsync(G);else G()},X=this.getListeners(Q,z,!1);if((X?.size??0)>0){let q=new Set(X);for(let G of q){if(!X?.has(G))continue;Z(()=>G($))}}let Y=this.getGlobalListeners(z);if(Y.size>0){let q=new Set(Y);for(let G of q)Z(()=>G(Q,$))}}getGlobalListeners($){return $?this.globalAsyncListeners:this.globalSyncListeners}dispatchAsync($){if(this.asyncFunctionsQueue.push($),!this.scheduled){let z=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)},Q=this.frameworkOverrides;if(Q)Q.wrapIncoming(z);else z();this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;let $=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[];for(let z of $)z()}},AY=/[&<>"']/g,SY={"&":"&","<":"<",">":">",'"':""","'":"'"};function J1($){return $?.toString().toString()??null}function W0($){return J1($)?.replace(AY,(z)=>SY[z])??null}function a1($){return typeof $==="string"&&$.startsWith("=")&&$.length>1}function RY($){if(!$||$==null)return null;let z=/([a-z])([A-Z])/g,Q=/([A-Z]+)([A-Z])([a-z])/g;return $.replace(z,"$1 $2").replace(Q,"$1 $2$3").replace(/\./g," ").split(" ").map((Z)=>Z.substring(0,1).toUpperCase()+(Z.length>1?Z.substring(1,Z.length):"")).join(" ")}function r0($){return $.eRootDiv.getRootNode()}function d($){return r0($).activeElement}function Y0($){let{gos:z,eRootDiv:Q}=$,J=null,Z=z.get("getDocument");if(Z&&T(Z))J=Z();else if(Q)J=Q.ownerDocument;if(J&&T(J))return J;return document}function hz($){let z=d($);return z===null||z===Y0($).body}function S2($){return Y0($).defaultView||window}function FQ($){let z=null,Q=null;try{z=Y0($).fullscreenElement}catch(J){}finally{if(!z)z=r0($);let J=z.querySelector("body");if(J)Q=J;else if(z instanceof ShadowRoot)Q=z;else if(z instanceof Document)Q=z?.documentElement;else Q=z}return Q}function jY($){return FQ($)?.clientWidth??(window.innerWidth||-1)}function fY($){return FQ($)?.clientHeight??(window.innerHeight||-1)}function c0($,z,Q){if(Q==null||typeof Q==="string"&&Q=="")R2($,z);else X$($,z,Q)}function X$($,z,Q){$.setAttribute(F6(z),Q.toString())}function R2($,z){$.removeAttribute(F6(z))}function F6($){return`aria-${$}`}function _0($,z){if(z)$.setAttribute("role",z);else $.removeAttribute("role")}function OY($){let z=$?.direction;if(z==="asc")return"ascending";else if(z==="desc")return"descending";else if(z==="mixed")return"other";return"none"}function M6($){return Number.parseInt($.getAttribute("aria-posinset"),10)}function PY($){return $.getAttribute("aria-label")}function E0($,z){c0($,"label",z)}function pQ($,z){c0($,"labelledby",z)}function FJ($,z){c0($,"describedby",z)}function k6($,z){c0($,"live",z)}function TY($,z){c0($,"atomic",z)}function vY($,z){c0($,"relevant",z)}function V6($,z){c0($,"invalid",z)}function A6($,z){c0($,"level",z)}function S6($,z){c0($,"disabled",z)}function MJ($,z){c0($,"hidden",z)}function w0($,z){X$($,"expanded",z)}function R6($){R2($,"expanded")}function kJ($,z){X$($,"setsize",z)}function VJ($,z){X$($,"posinset",z)}function IY($,z){X$($,"multiselectable",z)}function CY($,z){X$($,"rowcount",z)}function o1($,z){X$($,"rowindex",z)}function bY($,z){X$($,"colcount",z)}function j6($,z){X$($,"colindex",z)}function yY($,z){X$($,"colspan",z)}function xY($,z){X$($,"sort",z)}function wY($){R2($,"sort")}function j2($,z){c0($,"selected",z)}function f6($,z){X$($,"checked",z===void 0?"mixed":z)}function NY($,z){c0($,"controls",z)}function O6($,z){NY($,z.id),pQ(z,$.id)}function q5($,z){c0($,"owns",z)}function P6($,z){c0($,"haspopup",z===!1?null:z)}function f2($,z){return z===void 0?$("ariaIndeterminate","indeterminate"):z===!0?$("ariaChecked","checked"):$("ariaUnchecked","unchecked")}function O2($,z,Q){let J=$.parentElement,Z=J&&J.firstChild;while(Z){if(z)Z.classList.toggle(z,Z===$);if(Q)Z.classList.toggle(Q,Z!==$);Z=Z.nextSibling}}var gY="[tabindex], input, select, button, textarea, [href]",T6="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function wQ($){if(!$)return!1;if(!$.matches("input, select, button, textarea"))return!1;if(!$.matches(T6))return!1;return A0($)}function N($,z,Q={}){let{skipAriaHidden:J}=Q;if($.classList.toggle("ag-hidden",!z),!J)MJ($,!z)}function hY($,z,Q={}){let{skipAriaHidden:J}=Q;if($.classList.toggle("ag-invisible",!z),!J)MJ($,!z)}function P2($,z){let J=z?(X)=>X.setAttribute("disabled",""):(X)=>X.removeAttribute("disabled");J($);let Z=$.querySelectorAll("input")??[];for(let X of Z)J(X)}function vz($,z,Q){let J=0;while($){if($.classList.contains(z))return!0;if($=$.parentElement,typeof Q=="number"){if(++J>Q)break}else if($===Q)break}return!1}function MQ($){let{height:z,width:Q,borderTopWidth:J,borderRightWidth:Z,borderBottomWidth:X,borderLeftWidth:Y,paddingTop:q,paddingRight:G,paddingBottom:_,paddingLeft:H,marginTop:U,marginRight:W,marginBottom:B,marginLeft:E,boxSizing:K}=window.getComputedStyle($),L=Number.parseFloat;return{height:L(z||"0"),width:L(Q||"0"),borderTopWidth:L(J||"0"),borderRightWidth:L(Z||"0"),borderBottomWidth:L(X||"0"),borderLeftWidth:L(Y||"0"),paddingTop:L(q||"0"),paddingRight:L(G||"0"),paddingBottom:L(_||"0"),paddingLeft:L(H||"0"),marginTop:L(U||"0"),marginRight:L(W||"0"),marginBottom:L(B||"0"),marginLeft:L(E||"0"),boxSizing:K}}function AJ($){let z=MQ($);if(z.boxSizing==="border-box")return z.height-z.paddingTop-z.paddingBottom-z.borderTopWidth-z.borderBottomWidth;return z.height}function xz($){let z=MQ($);if(z.boxSizing==="border-box")return z.width-z.paddingLeft-z.paddingRight-z.borderLeftWidth-z.borderRightWidth;return z.width}function v6($){let{height:z,marginBottom:Q,marginTop:J}=MQ($);return Math.floor(z+Q+J)}function I6($){let{width:z,marginLeft:Q,marginRight:J}=MQ($);return Math.floor(z+Q+J)}function C6($){let z=$.getBoundingClientRect(),{borderTopWidth:Q,borderLeftWidth:J,borderRightWidth:Z,borderBottomWidth:X}=MQ($);return{top:z.top+(Q||0),left:z.left+(J||0),right:z.right+(Z||0),bottom:z.bottom+(X||0)}}function e1($,z){let Q=$.scrollLeft;if(z)Q=Math.abs(Q);return Q}function $J($,z,Q){if(Q)z*=-1;$.scrollLeft=z}function z0($){while($?.firstChild)$.firstChild.remove()}function T0($){if($?.parentNode)$.remove()}function b6($){return!!$.offsetParent}function A0($){if($.checkVisibility)return $.checkVisibility({checkVisibilityCSS:!0});return!(!b6($)||window.getComputedStyle($).visibility!=="visible")}function T2($){let z=document.createElement("div");return z.innerHTML=($||"").trim(),z.firstChild}function y6($,z,Q){if(Q&&Q.nextSibling===z)return;if(!$.firstChild)$.appendChild(z);else if(Q)if(Q.nextSibling)$.insertBefore(z,Q.nextSibling);else $.appendChild(z);else if($.firstChild&&$.firstChild!==z)$.prepend(z)}function x6($,z){for(let Q=0;Q`-${z.toLocaleLowerCase()}`)}function Z1($,z){if(!z)return;for(let Q of Object.keys(z)){let J=z[Q];if(!Q?.length||J==null)continue;let Z=uY(Q),X=J.toString(),Y=X.replace(/\s*!important/g,""),q=Y.length!=X.length?"important":void 0;$.style.setProperty(Z,Y,q)}}function iQ($){return()=>{let z=$();if(!z)return!0;return mY(z)||cY(z)}}function mY($){return $.clientWidth<$.scrollWidth}function cY($){return $.clientHeight<$.scrollHeight}function w6($,z){if(z==="flex")$.style.removeProperty("width"),$.style.removeProperty("minWidth"),$.style.removeProperty("maxWidth"),$.style.flex="1 1 auto";else f$($,z)}function f$($,z){z=N6(z),$.style.width=z,$.style.maxWidth=z,$.style.minWidth=z}function NQ($,z){z=N6(z),$.style.height=z,$.style.maxHeight=z,$.style.minHeight=z}function N6($){return typeof $==="number"?`${$}px`:$}function X1($){return $ instanceof Node||$ instanceof HTMLElement}function Pz($,z,Q){if(Q==null||Q==="")$.removeAttribute(z);else $.setAttribute(z,Q.toString())}function pY($,z){if(!z.isContentEditable)return;let Q=S2($).getSelection();if(!Q)return;let J=Y0($).createRange();J.selectNodeContents(z),J.collapse(!1),Q.removeAllRanges(),Q.addRange(J)}function F$($,z,Q){let Z=S2($).ResizeObserver,X=Z?new Z(Q):null;return X?.observe(z),()=>X?.disconnect()}function Y$($,z){let Q=S2($);if(Q.requestAnimationFrame)Q.requestAnimationFrame(z);else if(Q.webkitRequestAnimationFrame)Q.webkitRequestAnimationFrame(z);else Q.setTimeout(z,0)}var g6="data-ref",VZ;function G5(){return VZ??(VZ=document.createTextNode(" ")),VZ.cloneNode()}function K0($){let{attrs:z,children:Q,cls:J,ref:Z,role:X,tag:Y}=$,q=document.createElement(Y);if(J)q.className=J;if(Z)q.setAttribute(g6,Z);if(X)q.setAttribute("role",X);if(z)for(let G of Object.keys(z))q.setAttribute(G,z[G]);if(Q)if(typeof Q==="string")q.textContent=Q;else{let G=!0;for(let _ of Q)if(_)if(typeof _==="string")q.appendChild(document.createTextNode(_)),G=!1;else if(typeof _==="function")q.appendChild(_());else{if(G)q.appendChild(G5()),G=!1;q.append(K0(_)),q.appendChild(G5())}}return q}var iY=["touchstart","touchend","touchmove","touchcancel","scroll"],nY=["wheel"],AZ={},lZ=(()=>{let $={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return(Q)=>{if(typeof AZ[Q]==="boolean")return AZ[Q];let J=document.createElement($[Q]||"div");return Q="on"+Q,AZ[Q]=Q in J}})();function SJ($,z){if(!z||!$)return!1;return tY(z).indexOf($)>=0}function dY($){let z=[],Q=$.target;while(Q)z.push(Q),Q=Q.parentElement;return z}function tY($){let z=$;if(z.path)return z.path;if(z.composedPath)return z.composedPath();return dY(z)}function sY($,z,Q){let J=rY(z),Z;if(J!=null)Z={passive:J};$.addEventListener(z,Q,Z)}var rY=($)=>{let z=iY.includes($),Q=nY.includes($);if(z)return!0;if(Q)return!1};function h6($,z,Q){if(Q===0)return!1;let J=Math.abs($.clientX-z.clientX),Z=Math.abs($.clientY-z.clientY);return Math.max(J,Z)<=Q}var qQ=($,z)=>{let Q=$.identifier;for(let J=0,Z=z.length;J0&&W+$.clientWidth>X+L)W=X+L-$.clientWidth;if(W<0)W=0;if(Y>0&&U+$.clientHeight>Y+K)U=Y+K-$.clientHeight;if(U<0)U=0;$.style.left=`${W}px`,$.style.top=`${U}px`}var c1=($,...z)=>{for(let Q of z){let[J,Z,X,Y]=Q;J.addEventListener(Z,X,Y),$.push(Q)}},v2=($)=>{if($){for(let[z,Q,J,Z]of $)z.removeEventListener(Q,J,Z);$.length=0}},QQ=($)=>{if($.cancelable)$.preventDefault()};function aY($,z){return z}function u6($){return $?.getLocaleTextFunc()??aY}function oY($,z,Q,J){let Z=z[Q];return $.getLocaleTextFunc()(Q,typeof Z==="function"?Z(J):Z,J)}var R0=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans($){this.beans=$,this.stubContext=$.context,this.eventSvc=$.eventSvc,this.gos=$.gos}destroy(){let{destroyFunctions:$}=this;for(let z=0;z<$.length;z++)$[z]();$.length=0,this.destroyed=!0,this.dispatchLocalEvent({type:"destroyed"})}addEventListener($,z,Q){if(!this.localEventService)this.localEventService=new K$;this.localEventService.addEventListener($,z,Q)}removeEventListener($,z,Q){this.localEventService?.removeEventListener($,z,Q)}dispatchLocalEvent($){this.localEventService?.dispatchEvent($)}addManagedElementListeners($,z){return this._setupListeners($,z)}addManagedEventListeners($){return this._setupListeners(this.eventSvc,$)}addManagedListeners($,z){return this._setupListeners($,z)}_setupListeners($,z){let Q=[];for(let J of Object.keys(z)){let Z=z[J];if(Z)Q.push(this._setupListener($,J,Z))}return Q}_setupListener($,z,Q){if(this.destroyed)return()=>null;let J;if(eY($))$.__addEventListener(z,Q),J=()=>{return $.__removeEventListener(z,Q),null};else{let Z=$q($);if($ instanceof HTMLElement)sY($,z,Q);else if(Z)$.addListener(z,Q);else $.addEventListener(z,Q);J=Z?()=>{return $.removeListener(z,Q),null}:()=>{return $.removeEventListener(z,Q),null}}return this.destroyFunctions.push(J),()=>{return J(),this.destroyFunctions=this.destroyFunctions.filter((Z)=>Z!==J),null}}setupPropertyListener($,z){let{gos:Q}=this;Q.addPropertyEventListener($,z);let J=()=>{return Q.removePropertyEventListener($,z),null};return this.destroyFunctions.push(J),()=>{return J(),this.destroyFunctions=this.destroyFunctions.filter((Z)=>Z!==J),null}}addManagedPropertyListener($,z){if(this.destroyed)return()=>null;return this.setupPropertyListener($,z)}addManagedPropertyListeners($,z){if(this.destroyed)return;let Q=$.join("-")+this.propertyListenerId++,J=(Z)=>{if(Z.changeSet){if(Z.changeSet&&Z.changeSet.id===this.lastChangeSetIdLookup[Q])return;this.lastChangeSetIdLookup[Q]=Z.changeSet.id}let X={type:"propertyChanged",changeSet:Z.changeSet,source:Z.source};z(X)};for(let Z of $)this.setupPropertyListener(Z,J)}getLocaleTextFunc(){return u6(this.beans.localeSvc)}addDestroyFunc($){if(this.isAlive())this.destroyFunctions.push($);else $()}createOptionalManagedBean($,z){return $?this.createManagedBean($,z):void 0}createManagedBean($,z){let Q=this.createBean($,z);return this.addDestroyFunc(this.destroyBean.bind(this,$,z)),Q}createBean($,z,Q){return(z||this.stubContext).createBean($,Q)}destroyBean($,z){return(z||this.stubContext).destroyBean($)}destroyBeans($,z){return(z||this.stubContext).destroyBeans($)}};function eY($){return $.__addEventListener!==void 0}function $q($){return $.eventServiceType==="global"}var S=class extends R0{},aZ=new Set,RJ=($,z)=>{if(!aZ.has(z))aZ.add(z),$()};RJ._set=aZ;var zq={pending:!1,funcs:[]},Qq={pending:!1,funcs:[]};function oZ($,z="setTimeout",Q){let J=z==="raf"?Qq:zq;if(J.funcs.push($),J.pending)return;J.pending=!0;let Z=()=>{let X=J.funcs.slice();J.funcs.length=0,J.pending=!1;for(let Y of X)Y()};if(z==="raf")Y$(Q,Z);else window.setTimeout(Z,0)}function g$($,z,Q){let J;return function(...Z){let X=this;return window.clearTimeout(J),J=window.setTimeout(function(){if($.isAlive())z.apply(X,Z)},Q),J}}function _5($,z){let Q=0;return function(...J){let Z=this,X=Date.now();if(X-Q{if(X!=null)window.clearInterval(X),X=null};$.addDestroyFunc(q);let G=()=>{let _=Date.now()-Z>J;if(z()||_)Q(),Y=!0,q()};if(G(),!Y)X=window.setInterval(G,10)}var Jq=new Set(["__proto__","constructor","prototype"]);function Zq($,z){if($==null)return;if(Array.isArray($)){for(let Q=0;Q<$.length;Q++)z(Q.toString(),$[Q]);return}for(let Q of Object.keys($).filter((J)=>!Jq.has(J)))z(Q,$[Q])}function B0($,z,Q=!0,J=!1){if(!T(z))return;Zq(z,(Z,X)=>{let Y=$[Z];if(Y===X)return;if(J){if(Y==null&&X!=null){if(typeof X==="object"&&X.constructor===Object)Y={},$[Z]=Y}}if(H5(X)&&H5(Y)&&!Array.isArray(Y))B0(Y,X,Q,J);else if(Q||X!==void 0)$[Z]=X})}function H5($){return typeof $==="object"&&$!==null}var C2=class ${static applyGlobalGridOptions(z){if(!$.gridOptions)return{...z};let Q={};if(B0(Q,$.gridOptions,!0,!0),$.mergeStrategy==="deep")B0(Q,z,!0,!0);else Q={...Q,...z};if($.gridOptions.context)Q.context=$.gridOptions.context;if(z.context){if($.mergeStrategy==="deep"&&Q.context)B0(z.context,Q.context,!0,!0);Q.context=z.context}return Q}static applyGlobalGridOption(z,Q){if($.mergeStrategy==="deep"){let J=Xq(z);if(J&&typeof J==="object"&&typeof Q==="object")return $.applyGlobalGridOptions({[z]:Q})[z]}return Q}};C2.gridOptions=void 0;C2.mergeStrategy="shallow";var b2=C2;function Xq($){return b2.gridOptions?.[$]}var Yq={suppressContextMenu:!1,preventDefaultOnContextMenu:!1,allowContextMenuWithControlKey:!1,suppressMenuHide:!0,enableBrowserTooltips:!1,tooltipTrigger:"hover",tooltipShowDelay:2000,tooltipSwitchShowDelay:200,tooltipHideDelay:1e4,tooltipMouseTrack:!1,tooltipShowMode:"standard",tooltipInteraction:!1,copyHeadersToClipboard:!1,copyGroupHeadersToClipboard:!1,clipboardDelimiter:"\t",suppressCopyRowsToClipboard:!1,suppressCopySingleCellRanges:!1,suppressLastEmptyLineOnPaste:!1,suppressClipboardPaste:!1,suppressClipboardApi:!1,suppressCutToClipboard:!1,maintainColumnOrder:!1,enableStrictPivotColumnOrder:!1,suppressFieldDotNotation:!1,allowDragFromColumnsToolPanel:!1,suppressMovableColumns:!1,suppressColumnMoveAnimation:!1,suppressMoveWhenColumnDragging:!1,suppressDragLeaveHidesColumns:!1,suppressRowGroupHidesColumns:!1,suppressAutoSize:!1,autoSizePadding:20,skipHeaderOnAutoSize:!1,singleClickEdit:!1,suppressClickEdit:!1,readOnlyEdit:!1,stopEditingWhenCellsLoseFocus:!1,enterNavigatesVertically:!1,enterNavigatesVerticallyAfterEdit:!1,enableCellEditingOnBackspace:!1,undoRedoCellEditing:!1,undoRedoCellEditingLimit:10,suppressCsvExport:!1,suppressExcelExport:!1,cacheQuickFilter:!1,includeHiddenColumnsInQuickFilter:!1,excludeChildrenWhenTreeDataFiltering:!1,enableAdvancedFilter:!1,includeHiddenColumnsInAdvancedFilter:!1,enableCharts:!1,masterDetail:!1,keepDetailRows:!1,keepDetailRowsCount:10,detailRowAutoHeight:!1,tabIndex:0,rowBuffer:10,valueCache:!1,valueCacheNeverExpires:!1,enableCellExpressions:!1,suppressTouch:!1,suppressFocusAfterRefresh:!1,suppressBrowserResizeObserver:!1,suppressPropertyNamesCheck:!1,suppressChangeDetection:!1,debug:!1,suppressLoadingOverlay:!1,suppressNoRowsOverlay:!1,pagination:!1,paginationPageSize:100,paginationPageSizeSelector:!0,paginationAutoPageSize:!1,paginateChildRows:!1,suppressPaginationPanel:!1,pivotMode:!1,pivotPanelShow:"never",pivotDefaultExpanded:0,pivotSuppressAutoColumn:!1,suppressExpandablePivotGroups:!1,functionsReadOnly:!1,suppressAggFuncInHeader:!1,alwaysAggregateAtRootLevel:!1,aggregateOnlyChangedColumns:!1,suppressAggFilteredOnly:!1,removePivotHeaderRowWhenSingleValueColumn:!1,animateRows:!0,cellFlashDuration:500,cellFadeDuration:1000,allowShowChangeAfterFilter:!1,domLayout:"normal",ensureDomOrder:!1,enableRtl:!1,suppressColumnVirtualisation:!1,suppressMaxRenderedRowRestriction:!1,suppressRowVirtualisation:!1,rowDragManaged:!1,refreshAfterGroupEdit:!1,rowDragInsertDelay:500,suppressRowDrag:!1,suppressMoveWhenRowDragging:!1,rowDragEntireRow:!1,rowDragMultiRow:!1,embedFullWidthRows:!1,groupDisplayType:"singleColumn",groupDefaultExpanded:0,groupMaintainOrder:!1,groupSelectsChildren:!1,groupSuppressBlankHeader:!1,groupSelectsFiltered:!1,showOpenedGroup:!1,groupRemoveSingleChildren:!1,groupRemoveLowestSingleChildren:!1,groupHideOpenParents:!1,groupHideColumnsUntilExpanded:!1,groupAllowUnbalanced:!1,rowGroupPanelShow:"never",suppressMakeColumnVisibleAfterUnGroup:!1,treeData:!1,rowGroupPanelSuppressSort:!1,suppressGroupRowsSticky:!1,rowModelType:"clientSide",asyncTransactionWaitMillis:50,suppressModelUpdateAfterUpdateTransaction:!1,cacheOverflowSize:1,infiniteInitialRowCount:1,serverSideInitialRowCount:1,cacheBlockSize:100,maxBlocksInCache:-1,maxConcurrentDatasourceRequests:2,blockLoadDebounceMillis:0,purgeClosedRowNodes:!1,serverSideSortAllLevels:!1,serverSideOnlyRefreshFilteredGroups:!1,serverSidePivotResultFieldSeparator:"_",viewportRowModelPageSize:5,viewportRowModelBufferSize:5,alwaysShowHorizontalScroll:!1,alwaysShowVerticalScroll:!1,debounceVerticalScrollbar:!1,suppressHorizontalScroll:!1,suppressScrollOnNewData:!1,suppressScrollWhenPopupsAreOpen:!1,suppressAnimationFrame:!1,suppressMiddleClickScrolls:!1,suppressPreventDefaultOnMouseWheel:!1,rowMultiSelectWithClick:!1,suppressRowDeselection:!1,suppressRowClickSelection:!1,suppressCellFocus:!1,suppressHeaderFocus:!1,suppressMultiRangeSelection:!1,enableCellTextSelection:!1,enableRangeSelection:!1,enableRangeHandle:!1,enableFillHandle:!1,fillHandleDirection:"xy",suppressClearOnFillReduction:!1,accentedSort:!1,unSortIcon:!1,suppressMultiSort:!1,alwaysMultiSort:!1,suppressMaintainUnsortedOrder:!1,suppressRowHoverHighlight:!1,suppressRowTransform:!1,columnHoverHighlight:!1,deltaSort:!1,enableGroupEdit:!1,groupLockGroupColumns:0,serverSideEnableClientSideSort:!1,suppressServerSideFullWidthLoadingRow:!1,pivotMaxGeneratedColumns:-1,columnMenu:"new",reactiveCustomComponents:!0,suppressSetFilterByDefault:!1,enableFilterHandlers:!1},m6="https://www.ag-grid.com";function dQ($,z,...Q){if($.get("debug"))console.log("AG Grid: "+z,...Q)}function zz($,...z){RJ(()=>c6($,...z),$+z?.join(""))}function GQ($,...z){RJ(()=>qq($,...z),$+z?.join(""))}function qq($,...z){console.error("AG Grid: "+$,...z)}function c6($,...z){console.warn("AG Grid: "+$,...z)}var p6=new Set,zJ={},Iz={},p1,i6=!1,n6=!1,Gq=!1;function _q($){let[z,Q]=$.version.split(".")||[],[J,Z]=p1.split(".")||[];return z===J&&Q===Z}function Hq($){if(!p1)p1=$.version;let z=(J)=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${J} Please update all modules to the same version.`;if(!$.version)GQ(z(`'${$.moduleName}' is incompatible.`));else if(!_q($))GQ(z(`'${$.moduleName}' is version ${$.version} but the other modules are version ${p1}.`));let Q=$.validate?.();if(Q&&!Q.isValid)GQ(`${Q.message}`)}function tQ($,z,Q=!1){if(!Q)i6=!0;Hq($);let J=$.rowModels??["all"];p6.add($);let Z;if(z!==void 0){if(n6=!0,Iz[z]===void 0)Iz[z]={};Z=Iz[z]}else Z=zJ;for(let X of J){if(Z[X]===void 0)Z[X]={};Z[X][$.moduleName]=$}if($.dependsOn)for(let X of $.dependsOn)tQ(X,z,Q)}function Uq($){delete Iz[$]}function eZ($,z,Q){let J=(Z)=>!!zJ[Z]?.[$]||!!Iz[z]?.[Z]?.[$];return J(Q)||J("all")}function y2(){return n6}function Wq($,z){let Q=Iz[$]??{};return[...Object.values(zJ.all??{}),...Object.values(Q.all??{}),...Object.values(zJ[z]??{}),...Object.values(Q[z]??{})]}function Bq(){return new Set(p6)}function d6($,z){let Q=Iz[$]??{};return[...Object.values(Q.all??{}),...Object.values(Q[z]??{})]}function Eq(){return i6}function x2(){return Gq}var t6=class{static register($){tQ($,void 0)}static registerModules($){for(let z of $)tQ(z,void 0)}};var p="35.2.0",U5=2000,W5=100,s6="_version_",r6=null,_Q=`${m6}/javascript-data-grid`;function Kq($){r6=$}function Lq($){_Q=$}function l6($,z,Q){return r6?.($,z)??[kq($,z,Q)]}function jJ($,z,Q,J,Z){$(`${J?"warning":"error"} #${z}`,...l6(z,Q,Z))}function Dq($){if(!$)return String($);let z={};for(let Q of Object.keys($))if(typeof $[Q]!=="object"&&typeof $[Q]!=="function")z[Q]=$[Q];return JSON.stringify(z)}function Fq($){let z=$;if($ instanceof Error)z=$.toString();else if(typeof $==="object")z=Dq($);return z}function i1($){return $===void 0?"undefined":$===null?"null":$}function $2($,z){return`${$}?${z.toString()}`}function Mq($,z,Q){let J=Array.from(z.entries()).sort((X,Y)=>Y[1].length-X[1].length),Z=$2($,z);for(let[X,Y]of J){if(X===s6)continue;let q=Z.length-Q;if(q<=0)break;let G="...",_=q+G.length,H=Y.length-_>W5?Y.slice(0,Y.length-_)+G:Y.slice(0,W5)+G;z.set(X,H),Z=$2($,z)}return Z}function a6($,z){let Q=new URLSearchParams;if(Q.append(s6,p),z)for(let X of Object.keys(z))Q.append(X,Fq(z[X]));let J=`${_Q}/errors/${$}`,Z=$2(J,Q);return Z.length<=U5?Z:Mq(J,Q,U5)}var kq=($,z,Q)=>{let J=a6($,z),Z=`${Q?Q+` +`:""}Visit ${J}`;if(x2())return Z;return`${Z}${Q?"":` + Alternatively register the ValidationModule to see the full message in the console.`}`};function j(...$){jJ(zz,$[0],$[1],!0)}function e(...$){jJ(GQ,$[0],$[1],!1)}function yQ($,z,Q){jJ(GQ,$,z,!1,Q)}function o6($,z,Q){jJ(zz,$,z,!0,Q)}function Vq($,z){let Q=z[0];return`error #${Q} `+l6(Q,z[1],$).join(" ")}function $$(...$){return Vq(void 0,$)}function e6($,z){return $.get("rowModelType")===z}function o($,z){return e6($,"clientSide")}function _z($,z){return e6($,"serverSide")}function V0($,z){return $.get("domLayout")===z}function h$($){return QJ($)!==void 0}function $7($){return typeof $.get("getRowHeight")==="function"}function Aq($,z){if(z)return!$.get("enableStrictPivotColumnOrder");return $.get("maintainColumnOrder")}function Sq({gos:$,formula:z}){let Q=$.get("rowNumbers");return Q||!!z?.active&&Q!==!1}function sQ($,z,Q=!1,J){let{gos:Z,environment:X}=$;if(J==null)J=X.getDefaultRowHeight();if($7(Z)){if(Q)return{height:J,estimated:!0};let G={node:z,data:z.data},_=Z.getCallback("getRowHeight")(G);if(z2(_)){if(_===0)j(23);return{height:Math.max(1,_),estimated:!1}}}if(z.detail&&Z.get("masterDetail"))return Rq(Z);let Y=Z.get("rowHeight");return{height:Y&&z2(Y)?Y:J,estimated:!1}}function Rq($){if($.get("detailRowAutoHeight"))return{height:1,estimated:!1};let z=$.get("detailRowHeight");if(z2(z))return{height:z,estimated:!1};return{height:300,estimated:!1}}function z7($){let{environment:z,gos:Q}=$,J=Q.get("rowHeight");if(!J||n(J))return z.getDefaultRowHeight();let Z=z.refreshRowHeightVariable();if(Z!==-1)return Z;return j(24),z.getDefaultRowHeight()}function z2($){return!isNaN($)&&typeof $==="number"&&isFinite($)}function Q7($,z,Q){let J=z[$.getDomDataKey()];return J?J[Q]:void 0}function wz($,z,Q,J){let Z=$.getDomDataKey(),X=z[Z];if(n(X))X={},z[Z]=X;X[Q]=J}function HQ($){if($.get("ensureDomOrder"))return!1;return $.get("animateRows")}function kQ($){return!($.get("paginateChildRows")||$.get("groupHideOpenParents")||V0($,"print"))}function W$($){return!$.get("autoGroupColumnDef")?.comparator&&!$.get("treeData")}function T$($){let z=$.get("groupAggFiltering");if(typeof z==="function")return $.getCallback("groupAggFiltering");if(z===!0)return()=>!0;return}function Hz($){return $.get("grandTotalRow")}function fJ($){let z=$.get("groupTotalRow");if(typeof z==="function")return $.getCallback("groupTotalRow");return()=>z??void 0}function Y1($){if(!!$.get("groupHideOpenParents"))return!0;return $.get("groupDisplayType")==="multipleColumns"}function w2($){return Y1($)&&$.get("groupHideColumnsUntilExpanded")&&o($)}function OJ($,z){if(z)return!1;return $.get("groupDisplayType")==="groupRows"}function J7($,z,Q){return!!z.group&&!z.footer&&OJ($,Q)}function Q2($){let z=$.getCallback("getRowId");if(z===void 0)return z;return(Q)=>{let J=z(Q);if(typeof J!=="string")RJ(()=>j(25,{id:J}),"getRowIdString"),J=String(J);return J}}function jq($,z){let Q=$.get("groupHideParentOfSingleChild");if(Q===!0)return!0;if(Q==="leafGroupsOnly"&&z.leafGroup)return!0;if($.get("groupRemoveSingleChildren"))return!0;if($.get("groupRemoveLowestSingleChildren")&&z.leafGroup)return!0;return!1}function PJ($,z){let Q=$.get("suppressGroupChangesColumnVisibility");if(Q===!0)return!1;if(z&&Q==="suppressHideOnGroup")return!1;if(!z&&Q==="suppressShowOnUngroup")return!1;let J=$.get("suppressRowGroupHidesColumns");if(z&&J===!0)return!1;let Z=$.get("suppressMakeColumnVisibleAfterUnGroup");if(!z&&Z===!0)return!1;return!0}function Qz($){return $?.checkboxes??!0}function n1($){return $?.mode==="multiRow"&&($.headerCheckbox??!0)}function EQ($){if(typeof $!=="object")return;return $.checkboxLocation??"selectionColumn"}function SZ($){return $?.hideDisabledCheckboxes??!1}function fq($){return typeof $.get("rowSelection")!=="string"}function Z7($){return $.get("cellSelection")!==void 0}function X7($){let z=$.get("cellSelection");if(z===void 0)return $.get("suppressMultiRangeSelection");return typeof z!=="boolean"?z?.suppressMultiRanges??!1:!1}function u0($){let z=$.get("cellSelection");return z!==void 0?!!z:$.get("enableRangeSelection")}function TJ($){let z=$.get("cellSelection");if(z===void 0)return{mode:"fill",setFillValue:$.get("fillOperation"),direction:$.get("fillHandleDirection"),suppressClearOnFillReduction:$.get("suppressClearOnFillReduction")};return typeof z!=="boolean"&&z.handle?.mode==="fill"?z.handle:void 0}function Jz($){let z=$.get("cellSelection")??!1;return(typeof z==="object"&&z.enableColumnSelection)??!1}function Y7($){let z=$.get("rowSelection")??"single";if(typeof z==="string"){let Q=$.get("suppressRowClickSelection"),J=$.get("suppressRowDeselection");if(Q&&J)return!1;else if(Q)return"enableDeselection";else if(J)return"enableSelection";else return!0}return z.mode==="singleRow"||z.mode==="multiRow"?z.enableClickSelection??!1:!1}function Oq($){let z=Y7($);return z===!0||z==="enableSelection"}function Pq($){let z=Y7($);return z===!0||z==="enableDeselection"}function J2($){let z=$.get("rowSelection");if(typeof z==="string")return $.get("isRowSelectable");return z?.isRowSelectable}function QJ($){let z="beanName"in $&&$.beanName==="gos"?$.get("rowSelection"):$.rowSelection;if(typeof z==="string")switch(z){case"multiple":return"multiRow";case"single":return"singleRow";default:return}switch(z?.mode){case"multiRow":case"singleRow":return z.mode;default:return}}function rQ($){return QJ($)==="multiRow"}function Tq($){let z=$.get("rowSelection");if(typeof z==="string")return $.get("rowMultiSelectWithClick");return z?.enableSelectionWithoutKeys??!1}function JJ($){let z=$.get("rowSelection");if(typeof z==="string"){let Q=$.get("groupSelectsChildren"),J=$.get("groupSelectsFiltered");if(Q&&J)return"filteredDescendants";else if(Q)return"descendants";else return"self"}return z?.mode==="multiRow"?z.groupSelects:void 0}function q7($,z=!0){let Q=$.get("rowSelection");if(typeof Q!=="object")return z?"all":void 0;return Q.mode==="multiRow"?Q.selectAll:"all"}function vq($){let z=$.get("rowSelection");if(typeof z==="string")return!1;return z?.mode==="multiRow"?z.ctrlASelectsRows??!1:!1}function lQ($){let z=JJ($);return z==="descendants"||z==="filteredDescendants"}function B5($){let z=$.get("rowSelection");return typeof z==="object"&&z.masterSelects||"self"}function Iq($){return $.isModuleRegistered("SetFilter")&&!$.get("suppressSetFilterByDefault")}function U0($){return $.get("columnMenu")==="legacy"}function N2($){return!U0($)}function Cq($){if(!$||$.length<2)return $;return"on"+$[0].toUpperCase()+$.substring(1)}function y($,z){return $.addCommon(z)}function g2({gos:$},z){return z.button===2||z.ctrlKey&&$.get("allowContextMenuWithControlKey")}var bq={resizable:!0,sortable:!0},yq=0;function G7(){return yq++}function Q$($){return $ instanceof q$}var xq=["asc","desc",null],wq=[{type:"absolute",direction:"asc"},{type:"absolute",direction:"desc"},null],q$=class extends S{constructor($,z,Q,J){super();this.colDef=$,this.userProvidedColDef=z,this.colId=Q,this.primary=J,this.isColumn=!0,this.instanceId=G7(),this.autoHeaderHeight=null,this.sortDef=a0(),this._wasSortExplicitlyRemoved=!1,this.moving=!1,this.resizing=!1,this.menuVisible=!1,this.formulaRef=null,this.lastLeftPinned=!1,this.firstRightPinned=!1,this.filterActive=!1,this.colEventSvc=new K$,this.tooltipEnabled=!1,this.rowGroupActive=!1,this.pivotActive=!1,this.aggregationActive=!1,this.flex=null,this.colIdSanitised=W0(Q)}destroy(){super.destroy(),this.beans.rowSpanSvc?.deregister(this)}getInstanceId(){return this.instanceId}initState(){let{colDef:$,beans:{sortSvc:z,pinnedCols:Q,colFlex:J}}=this;z?.initCol(this);let Z=$.hide;if(Z!==void 0)this.visible=!Z;else this.visible=!$.initialHide;Q?.initCol(this),J?.initCol(this)}setColDef($,z,Q){let J=$.spanRows!==this.colDef.spanRows;if(this.colDef=$,this.userProvidedColDef=z,this.initMinAndMaxWidths(),this.initDotNotation(),this.initTooltip(),J)this.beans.rowSpanSvc?.deregister(this),this.initRowSpan();this.dispatchColEvent("colDefChanged",Q)}getUserProvidedColDef(){return this.userProvidedColDef}getParent(){return this.parent}getOriginalParent(){return this.originalParent}postConstruct(){this.initState(),this.initMinAndMaxWidths(),this.resetActualWidth("gridInitializing"),this.initDotNotation(),this.initTooltip(),this.initRowSpan(),this.addPivotListener()}initDotNotation(){let{gos:$,colDef:{field:z,tooltipField:Q}}=this,J=$.get("suppressFieldDotNotation");this.fieldContainsDots=T(z)&&z.includes(".")&&!J,this.tooltipFieldContainsDots=T(Q)&&Q.includes(".")&&!J}initMinAndMaxWidths(){let $=this.colDef;this.minWidth=$.minWidth??this.beans.environment.getDefaultColumnMinWidth(),this.maxWidth=$.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.beans.tooltipSvc?.initCol(this)}initRowSpan(){if(this.colDef.spanRows)this.beans.rowSpanSvc?.register(this)}addPivotListener(){let $=this.beans.pivotColDefSvc,z=this.colDef.pivotValueColumn;if(!$||!z)return;this.addManagedListeners(z,{colDefChanged:(Q)=>{let J=$.recreateColDef(this.colDef);this.setColDef(J,J,Q.source)}})}resetActualWidth($){let z=this.calculateColInitialWidth(this.colDef);this.setActualWidth(z,$,!0)}calculateColInitialWidth($){let z=$.width??$.initialWidth??200;return Math.max(Math.min(z,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed($){return this.beans.showRowGroupCols?.isRowGroupDisplayed(this,$)??!1}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}__addEventListener($,z){this.colEventSvc.addEventListener($,z)}__removeEventListener($,z){this.colEventSvc.removeEventListener($,z)}addEventListener($,z){this.frameworkEventListenerService=this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService,this.colEventSvc);let Q=this.frameworkEventListenerService?.wrap($,z)??z;this.colEventSvc.addEventListener($,Q)}removeEventListener($,z){let Q=this.frameworkEventListenerService?.unwrap($,z)??z;this.colEventSvc.removeEventListener($,Q)}createColumnFunctionCallbackParams($){return y(this.gos,{node:$,data:$.data,column:this,colDef:this.colDef})}isSuppressNavigable($){return this.beans.cellNavigation?.isSuppressNavigable(this,$)??!1}isCellEditable($){return this.beans.editSvc?.isCellEditable({rowNode:$,column:this})??!1}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag($){return this.isColumnFunc($,this.colDef.rowDrag)}isDndSource($){return this.isColumnFunc($,this.colDef.dndSource)}isCellCheckboxSelection($){return this.beans.selectionSvc?.isCellCheckboxSelection(this,$)??!1}isSuppressPaste($){return this.isColumnFunc($,this.colDef?.suppressPaste??null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue($){return this.colDef[$]??bq[$]}isColumnFunc($,z){if(typeof z==="boolean")return z;if(typeof z==="function"){let Q=this.createColumnFunctionCallbackParams($);return z(Q)}return!1}createColumnEvent($,z){return y(this.gos,{type:$,column:this,columns:[this],source:z})}isMoving(){return this.moving}getSort(){return this.sortDef.direction}getSortDef(){if(!this.sortDef.direction)return null;return this.sortDef}getColDefAllowedSortTypes(){let $=[],{sort:z,initialSort:Q}=this.colDef,J=z===null?z:L$(z?.type),Z=Q===null?Q:L$(Q?.type);if(J)$.push(J);if(Z)$.push(Z);return $}getSortingOrder(){let $=this.getColDefAllowedSortTypes().includes("absolute")?wq:xq;return(this.colDef.sortingOrder??this.gos.get("sortingOrder")??$).map((z)=>a0(z))}getAvailableSortTypes(){let $=this.getSortingOrder().reduce((z,Q)=>{if(Q.direction)z.push(Q.type);return z},this.getColDefAllowedSortTypes());return new Set($)}get wasSortExplicitlyRemoved(){return this._wasSortExplicitlyRemoved}setSortDef($,z=!1){if(!z)this._wasSortExplicitlyRemoved=!$.direction;this.sortDef=$}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return this.getSort()==="asc"}isSortDescending(){return this.getSort()==="desc"}isSortNone(){return n(this.getSort())}isSorting(){return T(this.getSort())}getSortIndex(){return this.sortIndex}isMenuVisible(){return this.menuVisible}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft($,z){if(this.oldLeft=this.left,this.left!==$)this.left=$,this.dispatchColEvent("leftChanged",z)}isFilterActive(){return this.filterActive}isHovered(){return j(261),!!this.beans.colHover?.isHovered(this)}setFirstRightPinned($,z){if(this.firstRightPinned!==$)this.firstRightPinned=$,this.dispatchColEvent("firstRightPinnedChanged",z)}setLastLeftPinned($,z){if(this.lastLeftPinned!==$)this.lastLeftPinned=$,this.dispatchColEvent("lastLeftPinnedChanged",z)}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return this.pinned==="left"||this.pinned==="right"}isPinnedLeft(){return this.pinned==="left"}isPinnedRight(){return this.pinned==="right"}getPinned(){return this.pinned}setVisible($,z){let Q=$===!0;if(this.visible!==Q)this.visible=Q,this.dispatchColEvent("visibleChanged",z);this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getFirstRealParent(){let $=this.getOriginalParent();while($?.isPadding())$=$.getOriginalParent();return $}getColumnGroupPaddingInfo(){let $=this.getParent();if(!$?.isPadding())return{numberOfParents:0,isSpanningTotal:!1};let z=$.getPaddingLevel()+1,Q=!0;while($){if(!$.isPadding()){Q=!1;break}$=$.getParent()}return{numberOfParents:z,isSpanningTotal:Q}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight($){let z=$!==this.autoHeaderHeight;return this.autoHeaderHeight=$,z}createBaseColDefParams($){return y(this.gos,{node:$,data:$.data,colDef:this.colDef,column:this})}getColSpan($){if(n(this.colDef.colSpan))return 1;let z=this.createBaseColDefParams($),Q=this.colDef.colSpan(z);return Math.max(Q,1)}getRowSpan($){if(n(this.colDef.rowSpan))return 1;let z=this.createBaseColDefParams($),Q=this.colDef.rowSpan(z);return Math.max(Q,1)}setActualWidth($,z,Q=!1){if($=Math.max($,this.minWidth),$=Math.min($,this.maxWidth),this.actualWidth!==$){if(this.actualWidth=$,this.flex!=null&&z!=="flex"&&z!=="gridInitializing")this.flex=null;if(!Q)this.fireColumnWidthChangedEvent(z)}this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent($){this.dispatchColEvent("widthChanged",$)}isGreaterThanMax($){return $>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex}isRowGroupActive(){return this.rowGroupActive}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}isValueActive(){return this.aggregationActive}isAllowPivot(){return this.colDef.enablePivot===!0}isAllowValue(){return this.colDef.enableValue===!0}isAllowRowGroup(){return this.colDef.enableRowGroup===!0}isAllowFormula(){return this.colDef.allowFormula===!0}dispatchColEvent($,z,Q){let J=this.createColumnEvent($,z);if(Q)B0(J,Q);this.colEventSvc.dispatchEvent(J)}dispatchStateUpdatedEvent($){this.colEventSvc.dispatchEvent({type:"columnStateUpdated",key:$})}};function a0($){if(UQ($))return{direction:$.direction,type:$.type};return{direction:vJ($),type:L$($)}}function Zz($){return $==="asc"||$==="desc"||$===null}function h2($){return $==="default"||$==="absolute"}function UQ($){if(!$||typeof $!=="object")return!1;let z=$;return h2(z.type)&&Zz(z.direction)}function d1($,z){if(!$)return z?z.direction===null:!0;if(!z)return $?$.direction===null:!0;return $.type===z.type&&$.direction===z.direction}function vJ($){return Zz($)?$:null}function L$($){return h2($)?$:"default"}function u2($,z,Q){let Z=Q?.()??z.sortSvc.getDisplaySortForColumn($),X=L$(Z?.type),Y=vJ(Z?.direction),q=$.getAvailableSortTypes(),G=q.has("default"),_=q.has("absolute");return{isDefaultSortAllowed:G,isAbsoluteSortAllowed:_,isAbsoluteSort:X==="absolute",isDefaultSort:X==="default",isAscending:Y==="asc",isDescending:Y==="desc",direction:Y}}function q0($){return $ instanceof Cz}var Cz=class extends S{constructor($,z,Q,J){super();this.colGroupDef=$,this.groupId=z,this.padding=Q,this.level=J,this.isColumn=!1,this.expandable=!1,this.instanceId=G7(),this.expandableListenerRemoveCallback=null,this.expanded=!!$?.openByDefault}destroy(){if(this.expandableListenerRemoveCallback)this.reset(null,void 0);super.destroy()}reset($,z){if(this.colGroupDef=$,this.level=z,this.originalParent=null,this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){if(this.children)return this.children.some(($)=>$.isVisible());return!1}isPadding(){return this.padding}setExpanded($){this.expanded=$===void 0?!1:$,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren($){this.children=$}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){let $=[];return this.addLeafColumns($),$}forEachLeafColumn($){if(!this.children)return;for(let z of this.children)if(Q$(z))$(z);else if(q0(z))z.forEachLeafColumn($)}addLeafColumns($){if(!this.children)return;for(let z of this.children)if(Q$(z))$.push(z);else if(q0(z))z.addLeafColumns($)}getColumnGroupShow(){let $=this.colGroupDef;if(!$)return;return $.columnGroupShow}setupExpandable(){if(this.setExpandable(),this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();let $=this.onColumnVisibilityChanged.bind(this);for(let z of this.getLeafColumns())z.__addEventListener("visibleChanged",$);this.expandableListenerRemoveCallback=()=>{for(let z of this.getLeafColumns())z.__removeEventListener("visibleChanged",$);this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let $=!1,z=!1,Q=!1,J=this.findChildrenRemovingPadding();for(let X=0,Y=J.length;X{for(let J of Q)if(q0(J)&&J.isPadding())z(J.children);else $.push(J)};return z(this.children),$}onColumnVisibilityChanged(){this.setExpandable()}},Nq={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}};function Z2($,z,Q){let J={},Z=$.gos;return Object.assign(J,Z.get("defaultColGroupDef")),Object.assign(J,z),Z.validateColDef(J,Q),J}var gq=class{constructor(){this.existingKeys={}}addExistingKeys($){for(let z=0;z<$.length;z++)this.existingKeys[$[z]]=!0}getUniqueKey($,z){$=cQ($);let Q=0;while(!0){let J=$??z;if(J){if(Q!==0)J+="_"+Q}else J=Q;if(!this.existingKeys[J]){let Z=String(J);if($&&Q>0)j(273,{providedId:$,usedId:Z});return this.existingKeys[Z]=!0,Z}Q++}}},_7=($,z)=>{if(q0($))$.setupExpandable();$.originalParent=z};function H7($,z=null,Q,J,Z){let{existingCols:X,existingGroups:Y}=U7(J),q=new Map(X.map((K)=>[K.getId(),K])),G=new Map(Y.map((K)=>[K.getId(),K])),_=0,H=(K,L)=>{if(_=Math.max(_,L),K7(K)){if(!$.colGroupSvc)return null;let k=K.groupId,V=G.get(k),R=Z2($,K,k),O=new Cz(R,k,!1,L);if($.context.createBean(O),V)O.setExpanded(V.isExpanded());return O.setChildren(K.children.map((I)=>H(I,L+1))),O}let D=K.colId,F=q.get(D),M=u$($,K,F?.getColId()??D);if(!F)F=new q$(M,K,D,Q),$.context.createBean(F);else F.setColDef(M,K,Z),E7($,F,M,Z);return $.dataTypeSvc?.addColumnListeners(F),F},U=z?.map((K)=>H(K,0))??[],W=0,B={getUniqueKey:(K,L)=>String(++W)},E=$.colGroupSvc?$.colGroupSvc.balanceColumnTree(U,0,_,B):U;return O$(null,E,_7),{columnTree:E,treeDepth:_}}function m2($,z=null,Q,J,Z){let X=new gq,{existingCols:Y,existingGroups:q,existingColKeys:G}=U7(J);X.addExistingKeys(G);let _=W7($,z,0,Q,Y,X,q,Z),{colGroupSvc:H}=$,U=H?.findMaxDepth(_,0)??0,W=H?H.balanceColumnTree(_,0,U,X):_;return O$(null,W,_7),{columnTree:W,treeDepth:U}}function U7($){let z=[],Q=[],J=[];if($)O$(null,$,(Z)=>{if(q0(Z)){let X=Z;Q.push(X)}else{let X=Z;J.push(X.getId()),z.push(X)}});return{existingCols:z,existingGroups:Q,existingColKeys:J}}function W7($,z,Q,J,Z,X,Y,q){if(!z)return[];let{colGroupSvc:G}=$,_=Array(z.length);for(let H=0;H<_.length;H++){let U=z[H];if(G&&K7(U))_[H]=G.createProvidedColumnGroup(J,U,Q,Z,X,Y,q);else _[H]=hq($,J,U,Z,X,q)}return _}function hq($,z,Q,J,Z,X){let Y=uq(Q,J);if(Y)J?.splice(Y.idx,1);let q=Y?.column;if(!q){let G=Z.getUniqueKey(Q.colId,Q.field),_=u$($,Q,G);q=new q$(_,Q,G,z),$.context.createBean(q)}else{let G=u$($,Q,q.getColId());q.setColDef(G,Q,X),E7($,q,G,X)}return $.dataTypeSvc?.addColumnListeners(q),q}function B7($,z,Q,J,Z,X,Y,q){let{sortSvc:G,pinnedCols:_,colFlex:H}=$;if(Q!==void 0)z.setVisible(!Q,q);if(G){if(G.updateColSort(z,J,q),Z!==void 0)G.setColSortIndex(z,Z)}if(X!==void 0)_?.setColPinned(z,X);if(Y!==void 0)H?.setColFlex(z,Y)}function E7($,z,Q,J){B7($,z,Q.hide,Q.sort,Q.sortIndex,Q.pinned,Q.flex,J);let Z=z.getFlex();if(Z!=null&&Z>0)return;if(Q.width!=null)z.setActualWidth(Q.width,J);else{let X=z.getActualWidth();z.setActualWidth(X,J)}}function uq($,z){if(!z)return;for(let Q=0;Q{for(let Z=0;Zz+Q.getActualWidth(),0)}function J$($,z,Q){let J={};if(!z)return;if(O$(null,z,(X)=>{J[X.getInstanceId()]=X}),Q)O$(null,Q,(X)=>{J[X.getInstanceId()]=null});let Z=Object.values(J).filter((X)=>X!=null);$.context.destroyBeans(Z)}function mz($){return $.getId().startsWith(uz)}function I$($){return(typeof $==="string"?$:("getColId"in $)?$.getColId():$.colId)?.startsWith(L7)??!1}function v0($){return(typeof $==="string"?$:("getColId"in $)?$.getColId():$.colId)?.startsWith(D7)??!1}function q1($){return I$($)||v0($)}function ZJ($){let z=[];if($ instanceof Array)z=$;else if(typeof $==="string")z=$.split(",");return z}function G1($,z){return X0($,z,(Q,J)=>Q.getColId()===J.getColId())}function _1($){$.map={};for(let z of $.list)$.map[z.getId()]=z}function Xz($){return $==="optionsUpdated"?"gridOptionsChanged":$}function P$($,z){return $===z||$.colId==z||$.getColDef()===z}var pq=($,z)=>(Q,J)=>{let Z={value1:void 0,value2:void 0},X=!1;if($){if($[Q]!==void 0)Z.value1=$[Q],X=!0;if(T(J)&&$[J]!==void 0)Z.value2=$[J],X=!0}if(!X&&z){if(z[Q]!==void 0)Z.value1=z[Q];if(T(J)&&z[J]!==void 0)Z.value2=z[J]}return Z};function c2($,z){let Q={...$,sort:void 0,colId:z},J=M7($);if(J)Q.sort=J.direction,Q.sortType=J.type;return Q}function M7($){let{sort:z,initialSort:Q}=$,J=UQ(z)||Zz(z),Z=UQ(Q)||Zz(Q);if(J)return a0(z);if(Z)return a0(Q);return null}function k7($,z){return $+"_"+z}function H0($){return $ instanceof aQ}var aQ=class extends S{constructor($,z,Q,J){super();this.providedColumnGroup=$,this.groupId=z,this.partId=Q,this.pinned=J,this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.colIdSanitised=W0(this.getUniqueId())}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}getUniqueId(){return k7(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){let $=this.getProvidedColumnGroup().getLeafColumns();if(!$||$.length===0)return!1;return $.every((z)=>z.isMoving())}checkLeft(){for(let $ of this.displayedChildren)if(H0($))$.checkLeft();if(this.displayedChildren.length>0)if(this.gos.get("enableRtl")){let z=b(this.displayedChildren).getLeft();this.setLeft(z)}else{let $=this.displayedChildren[0].getLeft();this.setLeft($)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft($){if(this.oldLeft=this.left,this.left!==$)this.left=$,this.dispatchLocalEvent({type:"leftChanged"})}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let $=0;for(let z of this.displayedChildren??[])$+=z.getActualWidth();return $}isResizable(){if(!this.displayedChildren)return!1;let $=!1;for(let z of this.displayedChildren)if(z.isResizable())$=!0;return $}getMinWidth(){let $=0;for(let z of this.displayedChildren)$+=z.getMinWidth();return $}addChild($){if(!this.children)this.children=[];this.children.push($)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){let $=[];return this.addLeafColumns($),$}getDisplayedLeafColumns(){let $=[];return this.addDisplayedLeafColumns($),$}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded($){this.providedColumnGroup.setExpanded($)}isAutoHeaderHeight(){return!!this.getColGroupDef()?.autoHeaderHeight}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight($){let z=$!==this.autoHeaderHeight;return this.autoHeaderHeight=$,z}addDisplayedLeafColumns($){for(let z of this.displayedChildren??[])if(Q$(z))$.push(z);else if(H0(z))z.addDisplayedLeafColumns($)}addLeafColumns($){for(let z of this.children??[])if(Q$(z))$.push(z);else if(H0(z))z.addLeafColumns($)}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){let $=this.getParent();if(!this.isPadding()||!$?.isPadding())return 0;return 1+$.getPaddingLevel()}calculateDisplayedColumns(){this.displayedChildren=[];let $=this;while($?.isPadding())$=$.getParent();if(!($?$.getProvidedColumnGroup().isExpandable():!1)){this.displayedChildren=this.children,this.dispatchLocalEvent({type:"displayedChildrenChanged"});return}for(let Q of this.children??[]){if(H0(Q)&&!Q.displayedChildren?.length)continue;switch(Q.getColumnGroupShow()){case"open":if($.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;case"closed":if(!$.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;default:this.displayedChildren.push(Q);break}}this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},A={BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",DELETE:"Delete",F2:"F2",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",PAGE_HOME:"Home",PAGE_END:"End",A:"KeyA",C:"KeyC",D:"KeyD",V:"KeyV",X:"KeyX",Y:"KeyY",Z:"KeyZ"},iq=65,nq=67,dq=86,tq=68,sq=90,rq=89;function V7($){let{keyCode:z}=$,Q;switch(z){case iq:Q=A.A;break;case nq:Q=A.C;break;case dq:Q=A.V;break;case tq:Q=A.D;break;case sq:Q=A.Z;break;case rq:Q=A.Y;break;default:Q=$.code}return Q}function lq($,z){return new g((Q)=>{Q(window.setInterval($,z))})}var g=class ${constructor(z){this.status=0,this.resolution=null,this.waiters=[],z((Q)=>this.onDone(Q),(Q)=>this.onReject(Q))}static all(z){return z.length?new $((Q)=>{let J=z.length,Z=Array(J);z.forEach((X,Y)=>{X.then((q)=>{if(Z[Y]=q,J--,J===0)Q(Z)})})}):$.resolve()}static resolve(z=null){return new $((Q)=>Q(z))}then(z){return new $((Q)=>{if(this.status===1)Q(z(this.resolution));else this.waiters.push((J)=>Q(z(J)))})}onDone(z){this.status=1,this.resolution=z;for(let Q of this.waiters)Q(z)}onReject(z){}},aq=class extends R0{constructor(){super(...arguments);this.beanName="dragAndDrop",this.dragSourceAndParamsList=[],this.dragItem=null,this.dragInitialSourcePointerOffsetX=0,this.dragInitialSourcePointerOffsetY=0,this.lastMouseEvent=null,this.lastDraggingEvent=null,this.dragSource=null,this.dragImageCompPromise=null,this.dragImageComp=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0,this.dropTargets=[],this.externalDropZoneCount=0,this.lastDropTarget=null}addDragSource($,z=!1){let Q={capturePointer:!0,dragSource:$,eElement:$.eElement,dragStartPixels:$.dragStartPixels,onDragStart:(J)=>this.onDragStart($,J),onDragStop:this.onDragStop.bind(this),onDragging:this.onDragging.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:z};this.dragSourceAndParamsList.push(Q),this.beans.dragSvc.addDragSource(Q)}setDragImageCompIcon($,z=!1){let Q=this.dragImageComp;if(Q&&(z||this.dragImageLastIcon!==$))this.dragImageLastIcon=$,Q.setIcon($,z)}removeDragSource($){let{dragSourceAndParamsList:z,beans:Q}=this;for(let J=0,Z=z.length;J{for(let _ of G){let{width:H,height:U,left:W,right:B,top:E,bottom:K}=_.getBoundingClientRect();if(H===0||U===0)return!1;let L=q.clientX>=W&&q.clientX=E&&q.clientY0}findExternalZone($){let z=this.dropTargets;for(let Q=0,J=z.length;Q0?"down":E<0?"up":null,hDirection:B<0?"left":B>0?"right":null,initialSourcePointerOffsetX:q,initialSourcePointerOffsetY:G,dragSource:J,fromNudge:Q,dragItem:Z,dropZoneTarget:_,dropTarget:X?.dropTarget??null,changed:!!X?.changed});return this.lastDraggingEvent=K,K}positionDragImageComp($){let z=this.dragImageComp?.getGui();if(z)lY(z,$,this.beans)}removeDragImageComp($){if(this.dragImageComp===$)this.dragImageComp=null;if($)$.getGui()?.remove(),this.destroyBean($)}createAndUpdateDragImageComp($){let z=this.createDragImageComp($)??null;this.dragImageCompPromise=z,z?.then((Q)=>{let J=this.lastMouseEvent;if(z!==this.dragImageCompPromise||!J||!this.isAlive()){this.destroyBean(Q);return}this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0;let Z=this.dragImageComp;if(Z!==Q)this.dragImageComp=Q,this.removeDragImageComp(Z);if(Q)this.appendDragImageComp(Q),this.updateDragImageComp(),this.positionDragImageComp(J)})}appendDragImageComp($){let z=$.getGui(),Q=z.style;if(Q.position="absolute",Q.zIndex="9999",this.beans.dragSvc?.hasPointerCapture())Q.pointerEvents="none";this.gos.setInstanceDomData(z),this.beans.environment.applyThemeClasses(z),Q.top="20px",Q.left="20px";let J=FQ(this.beans);if(!J)this.warnNoBody();else J.appendChild(z)}updateDragImageComp(){let{dragImageComp:$,dragSource:z,lastDropTarget:Q,lastDraggingEvent:J,dragImageLastLabel:Z}=this;if(!$)return;this.setDragImageCompIcon(Q?.getIconName?.(J)??null);let X=z?.dragItemName;if(typeof X==="function")X=X(J);if(X||(X=""),Z!==X)this.dragImageLastLabel=X,$.setLabel(X)}};function A7($){return typeof $==="object"&&!!$.component}function oq($){if(!$)return!1;return $.prototype&&"getGui"in $.prototype}function S7($,z,Q,J){let{name:Z}=Q,X,Y,q,G,_,H;if(z){let U=z,W=U[Z+"Selector"],B=W?W(J):null,E=(K)=>{if(typeof K==="string")X=K;else if(K!=null&&K!==!0)if($.isFrameworkComponent(K))q=K;else Y=K};if(B)E(B.component),G=B.params,_=B.popup,H=B.popupPosition;else E(U[Z])}return{compName:X,jsComp:Y,fwComp:q,paramsFromSelector:G,popupFromSelector:_,popupPositionFromSelector:H}}var eq=class extends S{constructor(){super(...arguments);this.beanName="userCompFactory"}wireBeans($){this.agCompUtils=$.agCompUtils,this.registry=$.registry,this.frameworkCompWrapper=$.frameworkCompWrapper,this.gridOptions=$.gridOptions}getCompDetailsFromGridOptions($,z,Q,J=!1){return this.getCompDetails(this.gridOptions,$,z,Q,J)}getCompDetails($,z,Q,J,Z=!1){let{name:X,cellRenderer:Y}=z,{compName:q,jsComp:G,fwComp:_,paramsFromSelector:H,popupFromSelector:U,popupPositionFromSelector:W}=S7(this.beans.frameworkOverrides,$,z,J),B,E,K=(M)=>{let k=this.registry.getUserComponent(X,M);if(k)G=!k.componentFromFramework?k.component:void 0,_=k.componentFromFramework?k.component:void 0,B=k.params,E=k.processParams};if(q!=null)K(q);if(G==null&&_==null&&Q!=null)K(Q);if(G&&Y&&!oq(G))G=this.agCompUtils?.adaptFunction(z,G);if(!G&&!_){let{validation:M}=this.beans;if(Z&&(q!==Q||!Q))if(q){if(!M?.isProvidedUserComp(q))e(50,{compName:q})}else if(Q){if(!M)e(260,{...this.gos.getModuleErrorParams(),propName:X,compName:Q})}else e(216,{name:X});else if(Q&&!M)e(146,{comp:Q});return}let L=this.mergeParams($,z,J,H,B,E),D=G==null,F=G??_;return{componentFromFramework:D,componentClass:F,params:L,type:z,popupFromSelector:U,popupPositionFromSelector:W,newAgStackInstance:()=>this.newAgStackInstance(F,D,L,z)}}newAgStackInstance($,z,Q,J){let Z=!z,X;if(Z)X=new $;else X=this.frameworkCompWrapper.wrap($,J.mandatoryMethods,J.optionalMethods,J);this.createBean(X);let Y=X.init?.(Q);if(Y==null)return g.resolve(X);return Y.then(()=>X)}mergeParams($,z,Q,J=null,Z,X){let Y={...Q,...Z},G=$?.[z.name+"Params"];if(typeof G==="function"){let _=G(Q);B0(Y,_)}else if(typeof G==="object")B0(Y,G);return B0(Y,J),X?X(Y):Y}};var $G={name:"dragAndDropImageComponent",mandatoryMethods:["setIcon","setLabel"]},zG={name:"headerComponent",optionalMethods:["refresh"]},QG={name:"innerHeaderComponent"},JG={name:"innerHeaderGroupComponent"},ZG={name:"headerGroupComponent"},XG={name:"innerRenderer",cellRenderer:!0,optionalMethods:["afterGuiAttached"]},YG={name:"cellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0};var qG={name:"loadingCellRenderer",cellRenderer:!0},GG={name:"cellEditor",mandatoryMethods:["getValue"],optionalMethods:["isPopup","isCancelBeforeStart","isCancelAfterEnd","getPopupPosition","focusIn","focusOut","afterGuiAttached","refresh"]},_G={name:"tooltipComponent"},p2={name:"filter",mandatoryMethods:["isFilterActive","doesFilterPass","getModel","setModel"],optionalMethods:["afterGuiAttached","afterGuiDetached","onNewRowsLoaded","getModelAsString","onFloatingFilterChanged","onAnyFilterChanged","refresh"]},HG={name:"floatingFilterComponent",mandatoryMethods:["onParentModelChanged"],optionalMethods:["afterGuiAttached","refresh"]},UG={name:"fullWidthCellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0},WG={name:"loadingCellRenderer",cellRenderer:!0},BG={name:"groupRowRenderer",optionalMethods:["afterGuiAttached"],cellRenderer:!0},EG={name:"detailCellRenderer",optionalMethods:["refresh"],cellRenderer:!0};function KG($,z){return $.getCompDetailsFromGridOptions($G,"agDragAndDropImage",z,!0)}function H1($,z,Q){return $.getCompDetails(z,XG,void 0,Q)}function LG($,z,Q){return $.getCompDetails(z,zG,"agColumnHeader",Q)}function DG($,z,Q){return $.getCompDetails(z,QG,void 0,Q)}function FG($,z){let Q=z.columnGroup.getColGroupDef();return $.getCompDetails(Q,ZG,"agColumnGroupHeader",z)}function MG($,z,Q){return $.getCompDetails(z,JG,void 0,Q)}function kG($,z){return $.getCompDetailsFromGridOptions(UG,void 0,z,!0)}function VG($,z){return $.getCompDetailsFromGridOptions(WG,"agLoadingCellRenderer",z,!0)}function AG($,z){return $.getCompDetailsFromGridOptions(BG,"agGroupRowRenderer",z,!0)}function SG($,z){return $.getCompDetailsFromGridOptions(EG,"agDetailCellRenderer",z,!0)}function oQ($,z,Q){return $.getCompDetails(z,YG,void 0,Q)}function E5($,z,Q){return $.getCompDetails(z,qG,"agSkeletonCellRenderer",Q,!0)}function R7($,z,Q){return $.getCompDetails(z,GG,"agCellEditor",Q,!0)}function i2($,z,Q,J){let Z=z.filter;if(A7(Z))z={filter:Z.component,filterParams:z.filterParams};return $.getCompDetails(z,p2,J,Q,!0)}function RG($,z){return $.getCompDetails(z.colDef,_G,"agTooltipComponent",z,!0)}function n2($,z,Q,J){return $.getCompDetails(z,HG,J,Q)}function j7($,z){return S7($,z,p2)}function RZ($,z,Q){return $.mergeParams(z,p2,Q)}var G$=(($)=>{return $[$.ToolPanel=0]="ToolPanel",$[$.HeaderCell=1]="HeaderCell",$[$.RowDrag=2]="RowDrag",$[$.ChartPanel=3]="ChartPanel",$[$.AdvancedFilterBuilder=4]="AdvancedFilterBuilder",$})(G$||{}),jG=class extends aq{createEvent($){return y(this.gos,$)}createDragImageComp($){let{gos:z,beans:Q}=this;return KG(Q.userCompFactory,y(z,{dragSource:$}))?.newAgStackInstance()}handleEnter($,z){$?.onGridEnter?.(z)}handleExit($,z){$?.onGridExit?.(z)}warnNoBody(){j(54)}isDropZoneWithinThisGrid($){return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains($.dropZoneTarget)}registerGridDropTarget($,z){let Q={getContainer:$,isInterestedIn:(J)=>J===1||J===0,getIconName:()=>"notAllowed"};this.addDropTarget(Q),z.addDestroyFunc(()=>this.removeDropTarget(Q))}};var f7="ag-resizer-wrapper",t$=($,z)=>({tag:"div",ref:`${$}Resizer`,cls:`ag-resizer ag-resizer-${z}`}),fG={tag:"div",cls:f7,children:[t$("eTopLeft","topLeft"),t$("eTop","top"),t$("eTopRight","topRight"),t$("eRight","right"),t$("eBottomRight","bottomRight"),t$("eBottom","bottom"),t$("eBottomLeft","bottomLeft"),t$("eLeft","left")]},d2=class extends R0{constructor($,z){super();this.element=$,this.dragStartPosition={x:0,y:0},this.position={x:0,y:0},this.lastSize={width:-1,height:-1},this.positioned=!1,this.resizersAdded=!1,this.resizeListeners=[],this.boundaryEl=null,this.isResizing=!1,this.isMoving=!1,this.resizable={},this.movable=!1,this.currentResizer=null,this.config={popup:!1,...z}}wireBeans($){this.popupSvc=$.popupSvc,this.dragSvc=$.dragSvc}center($){let{clientHeight:z,clientWidth:Q}=this.offsetParent,J=Q/2-this.getWidth()/2,Z=z/2-this.getHeight()/2;this.offsetElement(J,Z,$)}initialisePosition($){if(this.positioned)return;let{centered:z,forcePopupParentAsOffsetParent:Q,minWidth:J,width:Z,minHeight:X,height:Y,x:q,y:G}=this.config;if(!this.offsetParent)this.setOffsetParent();let _=0,H=0,U=A0(this.element);if(U){let W=this.findBoundaryElement(),B=window.getComputedStyle(W);if(B.minWidth!=null){let E=W.offsetWidth-this.element.offsetWidth;H=Number.parseInt(B.minWidth,10)-E}if(B.minHeight!=null){let E=W.offsetHeight-this.element.offsetHeight;_=Number.parseInt(B.minHeight,10)-E}}if(this.minHeight=X||_,this.minWidth=J||H,Z)this.setWidth(Z);if(Y)this.setHeight(Y);if(!Z||!Y)this.refreshSize();if(z)this.center($);else if(q||G)this.offsetElement(q,G,$);else if(U&&Q){let W=this.boundaryEl,B=!0;if(!W)W=this.findBoundaryElement(),B=!1;if(W){let E=Number.parseFloat(W.style.top),K=Number.parseFloat(W.style.left);if(B)this.offsetElement(Number.isNaN(K)?0:K,Number.isNaN(E)?0:E,$);else this.setPosition(K,E)}}this.positioned=!!this.offsetParent}isPositioned(){return this.positioned}getPosition(){return this.position}setMovable($,z){if(!this.config.popup||$===this.movable)return;this.movable=$;let Q=this.moveElementDragListener||{eElement:z,onDragStart:this.onMoveStart.bind(this),onDragging:this.onMove.bind(this),onDragStop:this.onMoveEnd.bind(this)};if($)this.dragSvc?.addDragSource(Q),this.moveElementDragListener=Q;else this.dragSvc?.removeDragSource(Q),this.moveElementDragListener=void 0}setResizable($){if(this.clearResizeListeners(),$)this.addResizers();else this.removeResizers();if(typeof $==="boolean"){if($===!1)return;$={topLeft:$,top:$,topRight:$,right:$,bottomRight:$,bottom:$,bottomLeft:$,left:$}}for(let z of Object.keys($)){let Q=!!$[z],J=this.getResizerElement(z),Z={dragStartPixels:0,eElement:J,onDragStart:(X)=>this.onResizeStart(X,z),onDragging:this.onResize.bind(this),onDragStop:(X)=>this.onResizeEnd(X,z)};if(Q||!this.isAlive()&&!Q){if(Q)this.dragSvc?.addDragSource(Z),this.resizeListeners.push(Z),J.style.pointerEvents="all";else J.style.pointerEvents="none";this.resizable[z]=Q}}}removeSizeFromEl(){this.element.style.removeProperty("height"),this.element.style.removeProperty("width"),this.element.style.removeProperty("flex")}restoreLastSize(){this.element.style.flex="0 0 auto";let{height:$,width:z}=this.lastSize;if(z!==-1)this.element.style.width=`${z}px`;if($!==-1)this.element.style.height=`${$}px`}getHeight(){return this.element.offsetHeight}setHeight($){let{popup:z}=this.config,Q=this.element,J=!1;if(typeof $==="string"&&$.includes("%"))NQ(Q,$),$=v6(Q),J=!0;else if($=Math.max(this.minHeight,$),this.positioned){let Z=this.getAvailableHeight();if(Z&&$>Z)$=Z}if(this.getHeight()===$)return;if(J)Q.style.maxHeight="unset",Q.style.minHeight="unset";else if(z)NQ(Q,$);else Q.style.height=`${$}px`,Q.style.flex="0 0 auto",this.lastSize.height=typeof $==="number"?$:Number.parseFloat($)}getAvailableHeight(){let{popup:$,forcePopupParentAsOffsetParent:z}=this.config;if(!this.positioned)this.initialisePosition();let{clientHeight:Q}=this.offsetParent;if(!Q)return null;let J=this.element.getBoundingClientRect(),Z=this.offsetParent.getBoundingClientRect(),X=$?this.position.y:J.top,Y=$?0:Z.top,q=0;if(z){let _=this.element.parentElement;if(_){let{bottom:H}=_.getBoundingClientRect();q=H-J.bottom}}return Q+Y-X-q}getWidth(){return this.element.offsetWidth}setWidth($){let z=this.element,{popup:Q}=this.config,J=!1;if(typeof $==="string"&&$.includes("%"))f$(z,$),$=I6(z),J=!0;else if(this.positioned){$=Math.max(this.minWidth,$);let{clientWidth:Z}=this.offsetParent,X=Q?this.position.x:this.element.getBoundingClientRect().left;if(Z&&$+X>Z)$=Z-X}if(this.getWidth()===$)return;if(J)z.style.maxWidth="unset",z.style.minWidth="unset";else if(this.config.popup)f$(z,$);else z.style.width=`${$}px`,z.style.flex=" unset",this.lastSize.width=typeof $==="number"?$:Number.parseFloat($)}offsetElement($=0,z=0,Q){let{forcePopupParentAsOffsetParent:J}=this.config,Z=J?this.boundaryEl:this.element;if(!Z)return;this.popupSvc?.positionPopup({ePopup:Z,keepWithinBounds:!0,skipObserver:this.movable||this.isResizable(),updatePosition:()=>({x:$,y:z}),postProcessCallback:Q}),this.setPosition(Number.parseFloat(Z.style.left),Number.parseFloat(Z.style.top))}constrainSizeToAvailableHeight($){if(!this.config.forcePopupParentAsOffsetParent)return;let z=()=>{let Q=this.getAvailableHeight();this.element.style.setProperty("max-height",`${Q}px`)};if($&&this.popupSvc)this.resizeObserverSubscriber?.(),this.resizeObserverSubscriber=F$(this.beans,this.popupSvc?.getPopupParent(),z);else if(this.element.style.removeProperty("max-height"),this.resizeObserverSubscriber)this.resizeObserverSubscriber(),this.resizeObserverSubscriber=void 0}setPosition($,z){this.position.x=$,this.position.y=z}updateDragStartPosition($,z){this.dragStartPosition={x:$,y:z}}calculateMouseMovement($){let{e:z,isLeft:Q,isTop:J,anywhereWithin:Z,topBuffer:X}=$,Y=z.clientX-this.dragStartPosition.x,q=z.clientY-this.dragStartPosition.y,G=this.shouldSkipX(z,!!Q,!!Z,Y)?0:Y,_=this.shouldSkipY(z,!!J,X,q)?0:q;return{movementX:G,movementY:_}}shouldSkipX($,z,Q,J){let Z=this.element.getBoundingClientRect(),X=this.offsetParent.getBoundingClientRect(),Y=this.boundaryEl.getBoundingClientRect(),q=this.config.popup?this.position.x:Z.left,G=q<=0&&X.left>=$.clientX||X.right<=$.clientX&&X.right<=Y.right;if(G)return!0;if(z)G=J<0&&$.clientX>q+X.left||J>0&&$.clientXY.right||J>0&&$.clientXY.right||J>0&&$.clientX=$.clientY||X.bottom<=$.clientY&&X.bottom<=Y.bottom;if(G)return!0;if(z)G=J<0&&$.clientY>q+X.top+Q||J>0&&$.clientYY.bottom||J>0&&$.clientY({element:this.element.querySelector(`[data-ref=${z}Resizer]`)});this.resizerMap={topLeft:$("eTopLeft"),top:$("eTop"),topRight:$("eTopRight"),right:$("eRight"),bottomRight:$("eBottomRight"),bottom:$("eBottom"),bottomLeft:$("eBottomLeft"),left:$("eLeft")}}addResizers(){if(this.resizersAdded)return;let $=this.element;if(!$)return;$.appendChild(K0(fG)),this.createResizeMap(),this.resizersAdded=!0}removeResizers(){this.resizerMap=void 0,this.element.querySelector(`.${f7}`)?.remove(),this.resizersAdded=!1}getResizerElement($){return this.resizerMap[$].element}onResizeStart($,z){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.currentResizer={isTop:!!z.match(/top/i),isRight:!!z.match(/right/i),isBottom:!!z.match(/bottom/i),isLeft:!!z.match(/left/i)},this.element.classList.add("ag-resizing"),this.resizerMap[z].element.classList.add("ag-active");let{popup:Q,forcePopupParentAsOffsetParent:J}=this.config;if(!Q&&!J)this.applySizeToSiblings(this.currentResizer.isBottom||this.currentResizer.isTop);this.isResizing=!0,this.updateDragStartPosition($.clientX,$.clientY)}getSiblings(){let z=this.element.parentElement;if(!z)return null;return Array.prototype.slice.call(z.children).filter((Q)=>!Q.classList.contains("ag-hidden"))}getMinSizeOfSiblings(){let $=this.getSiblings()||[],z=0,Q=0;for(let J of $){let Z=!!J.style.flex&&J.style.flex!=="0 0 auto";if(J===this.element)continue;let X=this.minHeight||0,Y=this.minWidth||0;if(Z){let q=window.getComputedStyle(J);if(q.minHeight)X=Number.parseInt(q.minHeight,10);if(q.minWidth)Y=Number.parseInt(q.minWidth,10)}else X=J.offsetHeight,Y=J.offsetWidth;z+=X,Q+=Y}return{height:z,width:Q}}applySizeToSiblings($){let z=null,Q=this.getSiblings();if(!Q)return;for(let J=0;J$)}onResize($){if(!this.isResizing||!this.currentResizer)return;let{popup:z,forcePopupParentAsOffsetParent:Q}=this.config,{isTop:J,isRight:Z,isBottom:X,isLeft:Y}=this.currentResizer,q=Z||Y,G=X||J,{movementX:_,movementY:H}=this.calculateMouseMovement({e:$,isLeft:Y,isTop:J}),U=this.position.x,W=this.position.y,B=0,E=0;if(q&&_){let K=Y?-1:1,L=this.getWidth(),D=L+_*K,F=!1;if(Y){if(B=L-D,U+B<=0||D<=this.minWidth)F=!0,B=0}if(!F)this.setWidth(D)}if(G&&H){let K=J?-1:1,L=this.getHeight(),D=L+H*K,F=!1;if(J){if(E=L-D,W+E<=0||D<=this.minHeight)F=!0,E=0}else if(!this.config.popup&&!this.config.forcePopupParentAsOffsetParent&&Lthis.element.parentElement.offsetHeight)F=!0;if(!F)this.setHeight(D)}if(this.updateDragStartPosition($.clientX,$.clientY),(z||Q)&&B||E)this.offsetElement(U+B,W+E)}onResizeEnd($,z){this.isResizing=!1,this.currentResizer=null,this.boundaryEl=null,this.element.classList.remove("ag-resizing"),this.resizerMap[z].element.classList.remove("ag-active"),this.dispatchLocalEvent({type:"resize"})}refreshSize(){let $=this.element;if(this.config.popup){if(!this.config.width)this.setWidth($.offsetWidth);if(!this.config.height)this.setHeight($.offsetHeight)}}onMoveStart($){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.isMoving=!0,this.element.classList.add("ag-moving"),this.updateDragStartPosition($.clientX,$.clientY)}onMove($){if(!this.isMoving)return;let{x:z,y:Q}=this.position,J;if(this.config.calculateTopBuffer)J=this.config.calculateTopBuffer();let{movementX:Z,movementY:X}=this.calculateMouseMovement({e:$,isTop:!0,anywhereWithin:!0,topBuffer:J});this.offsetElement(z+Z,Q+X),this.updateDragStartPosition($.clientX,$.clientY)}onMoveEnd(){this.isMoving=!1,this.boundaryEl=null,this.element.classList.remove("ag-moving")}setOffsetParent(){if(this.config.forcePopupParentAsOffsetParent&&this.popupSvc)this.offsetParent=this.popupSvc.getPopupParent();else this.offsetParent=this.element.offsetParent}findBoundaryElement(){let $=this.element;while($){if(window.getComputedStyle($).position!=="static")return $;$=$.parentElement}return this.element}clearResizeListeners(){while(this.resizeListeners.length){let $=this.resizeListeners.pop();this.dragSvc?.removeDragSource($)}}destroy(){if(super.destroy(),this.moveElementDragListener)this.dragSvc?.removeDragSource(this.moveElementDragListener);this.constrainSizeToAvailableHeight(!1),this.clearResizeListeners(),this.removeResizers()}},U1=class extends d2{},f=null;function CJ($){return typeof $?.getGui==="function"}var O7=class{constructor($){this.cssClassStates={},this.getGui=$}toggleCss($,z){if(!$)return;if($.includes(" ")){let J=($||"").split(" ");if(J.length>1){for(let Z of J)this.toggleCss(Z,z);return}}if(this.cssClassStates[$]!==z&&$.length)this.getGui()?.classList.toggle($,z),this.cssClassStates[$]=z}},OG=0,p0=class extends R0{constructor($,z){super();if(this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=OG++,this.cssManager=new O7(()=>this.eGui),this.componentSelectors=new Map((z??[]).map((Q)=>[Q.selector,Q])),$)this.setTemplate($)}preConstruct(){this.wireTemplate(this.getGui()),this.addGlobalCss()}wireTemplate($,z){if($&&this.gos)this.applyElementsToComponent($),this.createChildComponentsFromTags($,z)}getCompId(){return this.compId}getDataRefAttribute($){if($.getAttribute)return $.getAttribute(g6);return null}applyElementsToComponent($,z,Q,J=null){if(z===void 0)z=this.getDataRefAttribute($);if(z){let Z=this[z];if(Z===f)this[z]=J??$;else{let X=Q?.[z];if(!this.suppressDataRefValidation&&!X)throw Error(`data-ref: ${z} on ${this.constructor.name} with ${Z}`)}}}createChildComponentsFromTags($,z){let Q=[];for(let J of $.childNodes??[])Q.push(J);for(let J of Q){if(!(J instanceof HTMLElement))continue;let Z=this.createComponentFromElement(J,(X)=>{let Y=X.getGui();if(Y)for(let q of J.attributes??[])Y.setAttribute(q.name,q.value)},z);if(Z){if(Z.addItems&&J.children.length){this.createChildComponentsFromTags(J,z);let X=Array.prototype.slice.call(J.children);Z.addItems(X)}this.swapComponentForNode(Z,$,J)}else if(J.childNodes)this.createChildComponentsFromTags(J,z)}}createComponentFromElement($,z,Q){let J=$.nodeName,Z=this.getDataRefAttribute($),X=J.indexOf("AG-")===0,Y=X?this.componentSelectors.get(J):null,q=null;if(Y){let G=Q&&Z?Q[Z]:void 0;q=new Y.component(G),q.setParentComponent(this),this.createBean(q,null,z)}else if(X)throw Error(`selector: ${J}`);return this.applyElementsToComponent($,Z,Q,q),q}swapComponentForNode($,z,Q){let J=$.getGui();z.replaceChild(J,Q),z.insertBefore(document.createComment(Q.nodeName),J),this.addDestroyFunc(this.destroyBean.bind(this,$))}activateTabIndex($,z){let Q=z??this.gos.get("tabIndex");if(!$)$=[];if(!$.length)$.push(this.getGui());for(let J of $)J.setAttribute("tabindex",Q.toString())}setTemplate($,z,Q){let J;if(typeof $==="string"||$==null)J=T2($);else J=K0($);this.setTemplateFromElement(J,z,Q)}setTemplateFromElement($,z,Q,J=!1){if(this.eGui=$,this.suppressDataRefValidation=J,z)for(let Z=0;Zthis.eGui.removeEventListener($,z))}addCss($){this.cssManager.toggleCss($,!0)}removeCss($){this.cssManager.toggleCss($,!1)}toggleCss($,z){this.cssManager.toggleCss($,z)}registerCSS($){if(this.css===K5)this.css=[$],this.addGlobalCss();else this.css||(this.css=[]),this.css.push($)}addGlobalCss(){if(Array.isArray(this.css)){let $="component-"+Object.getPrototypeOf(this)?.constructor?.name;for(let z of this.css??[])this.beans.environment.addGlobalCSS(z,$)}this.css=K5}},K5=Symbol(),x=class extends p0{},jZ,fZ,OZ,PZ,X2,Y2,TZ;function cz(){if(jZ===void 0)jZ=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return jZ}function bJ(){if(fZ===void 0)fZ=/(firefox)/i.test(navigator.userAgent);return fZ}function P7(){if(OZ===void 0)OZ=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);return OZ}function bz(){if(PZ===void 0)PZ=/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return PZ}function q2($){if(!$)return null;let z=$.tabIndex,Q=$.getAttribute("tabIndex");if(z===-1&&(Q===null||Q===""&&!bJ()))return null;return z.toString()}function PG(){if(TZ!==void 0)return TZ;if(!document.body)return-1;let $=1e6,z=bJ()?6000000:1e9,Q=document.createElement("div");document.body.appendChild(Q);while(!0){let J=$*2;if(Q.style.height=J+"px",J>z||Q.clientHeight!==J)break;else $=J}return Q.remove(),TZ=$,$}function t2(){if(Y2==null)T7();return Y2}function T7(){let $=document.body,z=document.createElement("div");z.style.width=z.style.height="100px",z.style.opacity="0",z.style.overflow="scroll",z.style.msOverflowStyle="scrollbar",z.style.position="absolute",$.appendChild(z);let Q=z.offsetWidth-z.clientWidth;if(Q===0&&z.clientWidth===0)Q=null;if(z.parentNode)z.remove();if(Q!=null)Y2=Q,X2=Q===0}function v7(){if(X2==null)T7();return X2}var G2=!1,XJ=0;function TG($){if(XJ>0)return;$.addEventListener("keydown",YJ),$.addEventListener("mousedown",YJ)}function vG($){if(XJ>0)return;$.removeEventListener("keydown",YJ),$.removeEventListener("mousedown",YJ)}function YJ($){let z=G2,Q=$.type==="keydown";if(Q){if($.ctrlKey||$.metaKey||$.altKey)return}if(z===Q)return;G2=Q}function IG($){let z=Y0($);return TG(z),XJ++,()=>{XJ--,vG(z)}}function VQ(){return G2}function E$($,z,Q=!1){let J=gY,Z=T6;if(z)Z+=", "+z;if(Q)Z+=', [tabindex="-1"]';let X=Array.prototype.slice.apply($.querySelectorAll(J)).filter((G)=>{return A0(G)}),Y=Array.prototype.slice.apply($.querySelectorAll(Z));if(!Y.length)return X;return((G,_)=>G.filter((H)=>_.indexOf(H)===-1))(X,Y)}function F0($,z=!1,Q=!1,J=!1){let Z=E$($,J?".ag-tab-guard":null,Q),X=z?b(Z):Z[0];if(X)return X.focus({preventScroll:!0}),!0;return!1}function j0($,z,Q,J){let Z=E$(z,Q?':not([tabindex="-1"])':null),X=d($),Y;if(Q)Y=Z.findIndex((G)=>G.contains(X));else Y=Z.indexOf(X);let q=Y+(J?-1:1);if(q<0||q>=Z.length)return null;return Z[q]}function yJ($,z=5){let Q=0;while($&&q2($)===null&&++Q<=z)$=$.parentElement;if(q2($)===null)return null;return $}var s2="ag-focus-managed",I7=class extends R0{constructor($,z={isStopPropagation:()=>!1,stopPropagation:()=>{}},Q={}){super();this.eFocusable=$,this.stopPropagationCallbacks=z,this.callbacks=Q,this.callbacks={shouldStopEventPropagation:()=>!1,onTabKeyDown:(J)=>{if(J.defaultPrevented)return;let Z=j0(this.beans,this.eFocusable,!1,J.shiftKey);if(!Z)return;Z.focus(),J.preventDefault()},...Q}}postConstruct(){let{eFocusable:$,callbacks:{onFocusIn:z,onFocusOut:Q}}=this;if($.classList.add(s2),this.addKeyDownListeners($),z)this.addManagedElementListeners($,{focusin:z});if(Q)this.addManagedElementListeners($,{focusout:Q})}addKeyDownListeners($){this.addManagedElementListeners($,{keydown:(z)=>{if(z.defaultPrevented||this.stopPropagationCallbacks.isStopPropagation(z))return;let{callbacks:Q}=this;if(Q.shouldStopEventPropagation(z)){this.stopPropagationCallbacks.stopPropagation(z);return}if(z.key===A.TAB)Q.onTabKeyDown(z);else if(Q.handleKeyDown)Q.handleKeyDown(z)}})}},C7="__ag_Grid_Stop_Propagation";function i0($){$[C7]=!0}function z$($){return $[C7]===!0}var Uz={isStopPropagation:z$,stopPropagation:i0},c$=class extends I7{constructor($,z){super($,Uz,z)}},CG={applyFilter:"Apply",clearFilter:"Clear",resetFilter:"Reset",cancelFilter:"Cancel",textFilter:"Text Filter",numberFilter:"Number Filter",bigintFilter:"BigInt Filter",dateFilter:"Date Filter",setFilter:"Set Filter",filterOoo:"Filter...",empty:"Choose one",equals:"Equals",notEqual:"Does not equal",lessThan:"Less than",greaterThan:"Greater than",inRange:"Between",inRangeStart:"From",inRangeEnd:"To",lessThanOrEqual:"Less than or equal to",greaterThanOrEqual:"Greater than or equal to",contains:"Contains",notContains:"Does not contain",startsWith:"Begins with",endsWith:"Ends with",blank:"Blank",notBlank:"Not blank",before:"Before",after:"After",andCondition:"AND",orCondition:"OR",dateFormatOoo:"yyyy-mm-dd",filterSummaryInactive:"is (All)",filterSummaryContains:"contains",filterSummaryNotContains:"does not contain",filterSummaryTextEquals:"equals",filterSummaryTextNotEqual:"does not equal",filterSummaryStartsWith:"begins with",filterSummaryEndsWith:"ends with",filterSummaryBlank:"is blank",filterSummaryNotBlank:"is not blank",filterSummaryEquals:"=",filterSummaryNotEqual:"!=",filterSummaryGreaterThan:">",filterSummaryGreaterThanOrEqual:">=",filterSummaryLessThan:"<",filterSummaryLessThanOrEqual:"<=",filterSummaryInRange:"between",yesterday:"Yesterday",today:"Today",tomorrow:"Tomorrow",last7Days:"Last 7 Days",lastWeek:"Last Week",thisWeek:"This Week",nextWeek:"Next Week",last30Days:"Last 30 Days",lastMonth:"Last Month",thisMonth:"This Month",nextMonth:"Next Month",last90Days:"Last 90 Days",lastQuarter:"Last Quarter",thisQuarter:"This Quarter",nextQuarter:"Next Quarter",lastYear:"Last Year",thisYear:"This Year",yearToDate:"Year To Date",nextYear:"Next Year",last6Months:"Last 6 Months",last12Months:"Last 12 Months",last24Months:"Last 24 Months",filterSummaryInRangeValues:($)=>`(${$[0]}, ${$[1]})`,filterSummaryTextQuote:($)=>`"${$[0]}"`,minDateValidation:($)=>`Date must be after ${$[0]}`,maxDateValidation:($)=>`Date must be before ${$[0]}`,strictMinValueValidation:($)=>`Must be greater than ${$[0]}`,strictMaxValueValidation:($)=>`Must be less than ${$[0]}`};function b7($,z,Q){return oY($,CG,z,Q)}function bG($,z){let{debounceMs:Q}=$;if(W1($)){if(Q!=null)j(71);return 0}return Q??z}function W1($){return($.buttons?.indexOf("apply")??-1)>=0}var xJ=class extends x{constructor($,z){super();this.filterNameKey=$,this.cssIdentifier=z,this.applyActive=!1,this.debouncePending=!1,this.defaultDebounceMs=0}postConstruct(){let $={tag:"div",cls:`ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`,children:[this.createBodyTemplate()]};this.setTemplate($,this.getAgComponents()),this.createManagedBean(new c$(this.getFocusableElement(),{handleKeyDown:this.handleKeyDown.bind(this)})),this.positionableFeature=this.createBean(new U1(this.getPositionableElement(),{forcePopupParentAsOffsetParent:!0}))}handleKeyDown($){}init($){let z=$;this.setParams(z),this.setModelIntoUi(z.state.model,!0).then(()=>this.updateUiVisibility())}areStatesEqual($,z){return $===z}refresh($){let z=$,Q=this.params;this.params=z;let{source:J,state:Z,additionalEventAttributes:X}=z;if(J==="colDef")this.updateParams(z,Q);let Y=this.state;this.state=Z;let q=X?.fromAction;if(q&&q!=="apply"||Z.model!==Y.model||!this.areStatesEqual(Z.state,Y.state))this.setModelIntoUi(Z.model);return!0}setParams($){this.params=$,this.state=$.state,this.commonUpdateParams($)}updateParams($,z){this.commonUpdateParams($,z)}commonUpdateParams($,z){this.applyActive=W1($),this.setupApplyDebounced()}doesFilterPass($){j(283);let{getHandler:z,model:Q,column:J}=this.params;return z().doesFilterPass({...$,model:Q,handlerParams:this.beans.colFilter.getHandlerParams(J)})}getFilterTitle(){return this.translate(this.filterNameKey)}isFilterActive(){return j(284),this.params.model!=null}setupApplyDebounced(){let $=bG(this.params,this.defaultDebounceMs),z=g$(this,this.checkApplyDebounce.bind(this),$);this.applyDebounced=()=>{this.debouncePending=!0,z()}}checkApplyDebounce(){if(this.debouncePending)this.debouncePending=!1,this.doApplyModel()}getModel(){return j(285),this.params.model}setModel($){j(286);let{beans:z,params:Q}=this;return z.colFilter.setModelForColumnLegacy(Q.column,$)}applyModel($="api"){return this.doApplyModel()}canApply($){return!0}doApplyModel($){let{params:z,state:{valid:Q=!0,model:J}}=this;if(!Q)return!1;let Z=!this.areModelsEqual(z.model,J);if(Z)z.onAction("apply",$);return Z}onNewRowsLoaded(){}onUiChanged($,z=!1){this.updateUiVisibility();let Q=this.getModelFromUi(),J={model:Q,state:this.getState(),valid:this.canApply(Q)};this.state=J;let{params:Z,gos:X,eventSvc:Y,applyActive:q}=this;if(Z.onStateChange(J),Z.onUiChange(this.getUiChangeEventParams()),!X.get("enableFilterHandlers"))Y.dispatchEvent({type:"filterModified",column:Z.column,filterInstance:this});if(!J.valid)return;if($??($=q?void 0:"debounce"),$==="immediately")this.doApplyModel({afterFloatingFilter:z,afterDataChange:!1});else if($==="debounce")this.applyDebounced()}getState(){return}getUiChangeEventParams(){return}afterGuiAttached($){this.lastContainerType=$?.container,this.refreshFilterResizer($?.container)}refreshFilterResizer($){let{positionableFeature:z,gos:Q}=this;if(!z)return;let J=$==="floatingFilter"||$==="columnFilter";if(J)z.restoreLastSize(),z.setResizable(Q.get("enableRtl")?{bottom:!0,bottomLeft:!0,left:!0}:{bottom:!0,bottomRight:!0,right:!0});else z.removeSizeFromEl(),z.setResizable(!1);z.constrainSizeToAvailableHeight(J)}afterGuiDetached(){this.checkApplyDebounce(),this.positionableFeature?.constrainSizeToAvailableHeight(!1)}destroy(){this.positionableFeature=this.destroyBean(this.positionableFeature),super.destroy()}translate($,z){return b7(this,$,z)}getPositionableElement(){return this.getGui()}areModelsEqual($,z){if($===z||$==null&&z==null)return!0;if($==null||z==null)return!1;return this.areNonNullModelsEqual($,z)}};var r2=class extends p0{isPopup(){return!0}setParentComponent($){$.addCss("ag-has-popup"),super.setParentComponent($)}destroy(){let $=this.parentComponent;if($?.isAlive())$.getGui().classList.remove("ag-has-popup");super.destroy()}},yG=class extends r2{constructor(){super(...arguments);this.errorMessages=null}init($){this.params=$,this.initialiseEditor($),this.eEditor.onValueChange(()=>$.validate())}destroy(){this.eEditor.destroy(),this.errorMessages=null,super.destroy()}};function l2($){let z=$.rowModel;return z.getType()==="clientSide"?z:void 0}var L5="row-group-",xG="t-",wG="b-",NG=0,Wz=class{constructor($){this.id=void 0,this.destroyed=!1,this._groupData=void 0,this.master=!1,this.detail=void 0,this.rowIndex=null,this.field=null,this.rowGroupColumn=null,this.key=null,this.sourceRowIndex=-1,this._leafs=void 0,this.childrenAfterGroup=null,this.childrenAfterFilter=null,this.childrenAfterAggFilter=null,this.childrenAfterSort=null,this.allChildrenCount=null,this.childrenMapped=null,this.treeParent=null,this.treeNodeFlags=0,this._expanded=void 0,this.displayed=!1,this.rowTop=null,this.oldRowTop=null,this.selectable=!0,this.__objectId=NG++,this.alreadyRendered=!1,this.formulaRowIndex=null,this.hovered=!1,this.__selected=!1,this.beans=$}get groupData(){let $=this._groupData;if($!==void 0)return $;if(this.footer)return this.sibling?.groupData;return this.beans.groupStage?.loadGroupData(this)??null}set groupData($){this._groupData=$}get primaryRow(){let $=this.footer&&this.sibling?this.sibling:this,{pinnedSibling:z}=$;if(z&&$.rowPinned){if($=z,$.footer&&$.sibling)$=$.sibling}return $}get allLeafChildren(){let $=this._leafs;return $===void 0?this.beans.groupStage?.loadLeafs?.(this)??null:$}set allLeafChildren($){this._leafs=$}get expanded(){let $=this.beans.expansionSvc;return $?$.isExpanded(this):this.level===-1?!0:!!this._expanded}set expanded($){this._expanded=$}setData($){this.setDataCommon($,!1)}updateData($){this.setDataCommon($,!0)}setDataCommon($,z){let{valueCache:Q,eventSvc:J}=this.beans,Z=this.data;this.data=$,Q?.onDataChanged(),this.updateDataOnDetailNode(),this.resetQuickFilterAggregateText();let X=this.createDataChangedEvent($,Z,z);if(this.__localEventService?.dispatchEvent(X),this.sibling){this.sibling.data=$;let q=this.sibling.createDataChangedEvent($,Z,z);this.sibling.__localEventService?.dispatchEvent(q)}J.dispatchEvent({type:"rowNodeDataChanged",node:this});let Y=this.pinnedSibling;if(Y)Y.data=$,Y.__localEventService?.dispatchEvent(Y.createDataChangedEvent($,Z,z)),J.dispatchEvent({type:"rowNodeDataChanged",node:Y})}updateDataOnDetailNode(){let $=this.detailNode;if($)$.data=this.data}createDataChangedEvent($,z,Q){return{type:"dataChanged",node:this,oldData:z,newData:$,update:Q}}getRowIndexString(){if(this.rowIndex==null)return e(13),null;if(this.rowPinned==="top")return xG+this.rowIndex;if(this.rowPinned==="bottom")return wG+this.rowIndex;return this.rowIndex.toString()}setDataAndId($,z){let{selectionSvc:Q}=this.beans,J=Q?.createDaemonNode?.(this),Z=this.data;if(this.data=$,this.updateDataOnDetailNode(),this.setId(z),Q)Q.updateRowSelectable(this),Q.syncInRowNode(this,J);let X=this.createDataChangedEvent($,Z,!1);this.__localEventService?.dispatchEvent(X)}setId($){let z=Q2(this.beans.gos);if(z)if(this.data){let Q=this.parent?.getRoute()??[];if(this.id=z({data:this.data,parentKeys:Q.length>0?Q:void 0,level:this.level,rowPinned:this.rowPinned}),this.id.startsWith(L5))e(14,{groupPrefix:L5})}else this.id=void 0;else this.id=$}setRowTop($){if(this.oldRowTop=this.rowTop,this.rowTop===$)return;this.rowTop=$,this.dispatchRowEvent("topChanged");let z=$!==null;if(this.displayed!==z)this.displayed=z,this.dispatchRowEvent("displayedChanged")}clearRowTopAndRowIndex(){this.oldRowTop=null,this.setRowTop(null),this.setRowIndex(null)}setHovered($){this.hovered=$}isHovered(){return this.hovered}setRowHeight($,z=!1){this.rowHeight=$,this.rowHeightEstimated=z,this.dispatchRowEvent("heightChanged")}setExpanded($,z,Q){this.beans.expansionSvc?.setExpanded(this,$,z,Q)}setDataValue($,z,Q){let{colModel:J,valueSvc:Z,gos:X,editSvc:Y}=this.beans;if($==null)return!1;let q=J.getCol($)??J.getColDefCol($);if(!q)return!1;if(!this.group){let H=q.getColDef();if(H.pivotValueColumn)q=H.pivotValueColumn}let G=Z.getValueForDisplay({column:q,node:this,from:"data"}).value;if(X.get("readOnlyEdit")){let{beans:{eventSvc:H},data:U,rowIndex:W,rowPinned:B}=this;return H.dispatchEvent({type:"cellEditRequest",event:null,rowIndex:W,rowPinned:B,column:q,colDef:q.colDef,data:U,node:this,oldValue:G,newValue:z,value:z,source:Q}),!1}if(Q!=="data"&&Y&&!Y.committing){let H=Y.setDataValue({rowNode:this,column:q},z,Q);if(H!=null)return H}let _=Z.setValue(this,q,z,Q);if(this.dispatchCellChangedEvent(q,z,G),_)this.pinnedSibling?.dispatchCellChangedEvent(q,z,G);return _}getDataValue($,z="data"){let{colModel:Q,valueSvc:J,formula:Z}=this.beans;if($==null)return;let X=Q.getCol($)??Q.getColDefCol($);if(!X)return;let Y=z==="data-raw",q=Y||z==="value"?"data":z,G=J.getValue(X,this,q,Y);if(!Y){if(Z&&X.isAllowFormula()&&Z.isFormula(G))G=Z.resolveValue(X,this);if(z!=="data"&&X.getAggFunc()&&typeof G==="object"&&G!=null){if(typeof G.toNumber==="function")return G.toNumber();if("value"in G)return G.value}}return G}updateHasChildren(){let $=this.group&&!this.footer||!!this.childrenAfterGroup?.length,{rowChildrenSvc:z}=this.beans;if(z)$=z.getHasChildrenValue(this);if($!==this.__hasChildren)this.__hasChildren=!!$,this.dispatchRowEvent("hasChildrenChanged")}hasChildren(){if(this.__hasChildren==null)this.updateHasChildren();return this.__hasChildren}dispatchCellChangedEvent($,z,Q){let J={type:"cellChanged",node:this,column:$,newValue:z,oldValue:Q};this.__localEventService?.dispatchEvent(J)}resetQuickFilterAggregateText(){this.quickFilterAggregateText=null}isExpandable(){return this.beans.expansionSvc?.isExpandable(this)??!1}isSelected(){if(this.footer)return this.sibling.isSelected();let $=this.rowPinned&&this.pinnedSibling;if($)return $.isSelected();return this.__selected}depthFirstSearch($){let z=this.childrenAfterGroup;if(z)for(let Q=0,J=z.length;Q{let Q=new Wz(z);for(let J of Object.keys($)){if(gG.has(J))continue;Q[J]=$[J]}return Q.oldRowTop=null,Q},x7=($,z,Q)=>{if(!Q)return;let J=Q.rowIndex;if(J==null)return;J+=z;let Z=$.getRowCount();while(J>=0&&J{if(!b1)b1=new WeakSet;else if(b1.has($))return!1;return b1.add($),!0},h0=class{constructor($,z=!1){this.eElement=$,this.preventClick=z,this.startListener=null,this.handlers=[],this.eventSvc=void 0,this.touchStart=null,this.lastTapTime=null,this.longPressTimer=0,this.moved=!1}addEventListener($,z){let Q=this.eventSvc;if(!Q){if(Q===null)return;this.eventSvc=Q=new K$;let J=this.onTouchStart.bind(this);this.startListener=J,this.eElement.addEventListener("touchstart",J,{passive:!0})}Q.addEventListener($,z)}removeEventListener($,z){this.eventSvc?.removeEventListener($,z)}onTouchStart($){if(this.touchStart||!mG($))return;let z=$.touches[0];this.touchStart=z;let Q=this.handlers;if(!Q.length){let J=this.eElement,Z=J.ownerDocument,X=this.onTouchMove.bind(this),Y=this.onTouchEnd.bind(this),q=this.onTouchCancel.bind(this),G={passive:!0},_={passive:!1};c1(Q,[J,"touchmove",X,G],[Z,"touchcancel",q,G],[Z,"touchend",Y,_],[Z,"contextmenu",QQ,_])}this.clearLongPress(),this.longPressTimer=window.setTimeout(()=>{if(this.longPressTimer=0,this.touchStart===z&&!this.moved)this.moved=!0,this.eventSvc?.dispatchEvent({type:"longTap",touchStart:z,touchEvent:$})},uG)}onTouchMove($){let{moved:z,touchStart:Q}=this;if(!z&&Q){let J=qQ(Q,$.touches);if(J&&!h6(J,Q,4))this.clearLongPress(),this.moved=!0}}onTouchEnd($){let z=this.touchStart;if(!z||!qQ(z,$.changedTouches))return;if(!this.moved)this.eventSvc?.dispatchEvent({type:"tap",touchStart:z}),this.checkDoubleTap(z);if(this.preventClick)QQ($);this.cancel()}onTouchCancel($){let z=this.touchStart;if(!z||!qQ(z,$.changedTouches))return;this.lastTapTime=null,this.cancel()}checkDoubleTap($){let z=Date.now(),Q=this.lastTapTime;if(Q){if(z-Q>hG)this.eventSvc?.dispatchEvent({type:"doubleTap",touchStart:$}),z=null}this.lastTapTime=z}cancel(){this.clearLongPress(),v2(this.handlers),this.touchStart=null}clearLongPress(){window.clearTimeout(this.longPressTimer),this.longPressTimer=0,this.moved=!1}destroy(){let $=this.startListener;if($)this.startListener=null,this.eElement.removeEventListener("touchstart",$);this.cancel(),this.eElement=null,this.eventSvc=null}},C$=(($)=>{return $[$.VALUE=0]="VALUE",$[$.DIMENSION=1]="DIMENSION",$})(C$||{}),cG=1,pG=class{constructor($){if(this.beans={},this.createdBeans=[],this.destroyed=!1,this.instanceId=cG++,!$?.beanClasses)return;this.beanDestroyComparator=$.beanDestroyComparator,this.init($)}init($){this.id=$.id,this.beans.context=this,this.destroyCallback=$.destroyCallback;for(let z of Object.keys($.providedBeanInstances))this.beans[z]=$.providedBeanInstances[z];for(let z of $.beanClasses){let Q=new z;if(Q.beanName)this.beans[Q.beanName]=Q;else console.error(`Bean ${z.name} is missing beanName`);this.createdBeans.push(Q)}for(let z of $.derivedBeans??[]){let{beanName:Q,bean:J}=z(this);this.beans[Q]=J,this.createdBeans.push(J)}if($.beanInitComparator)this.createdBeans.sort($.beanInitComparator);this.initBeans(this.createdBeans)}getBeanInstances(){return Object.values(this.beans)}createBean($,z){return this.initBeans([$],z),$}initBeans($,z){let Q=this.beans;for(let J of $)J.preWireBeans?.(Q),J.wireBeans?.(Q);for(let J of $)J.preConstruct?.();if(z)$.forEach(z);for(let J of $)J.postConstruct?.()}getBeans(){return this.beans}getBean($){return this.beans[$]}getId(){return this.id}destroy(){if(this.destroyed)return;this.destroyed=!0;let $=this.getBeanInstances();if(this.beanDestroyComparator)$.sort(this.beanDestroyComparator);this.destroyBeans($),this.beans={},this.createdBeans=[],this.destroyCallback?.()}destroyBean($){$?.destroy?.()}destroyBeans($){if($)for(let z=0;z<$.length;z++)this.destroyBean($[z]);return[]}isDestroyed(){return this.destroyed}};function iG($){return{beanName:"gridApi",bean:$.getBean("apiFunctionSvc").api}}var nG=["licenseManager","environment","eventSvc","gos","paginationAutoPageSizeSvc","apiFunctionSvc","gridApi","registry","agCompUtils","userCompFactory","rowContainerHeight","horizontalResizeSvc","localeSvc","pinnedRowModel","dragSvc","colGroupSvc","visibleCols","popupSvc","selectionSvc","colFilter","quickFilter","filterManager","colModel","headerNavigation","pageBounds","pagination","pageBoundsListener","rowSpanSvc","stickyRowSvc","rowRenderer","expressionSvc","alignedGridsSvc","navigation","valueCache","valueSvc","autoWidthCalc","filterMenuFactory","dragAndDrop","focusSvc","cellNavigation","cellStyles","scrollVisibleSvc","sortSvc","colHover","colAnimation","autoColSvc","selectionColSvc","changeDetectionSvc","animationFrameSvc","undoRedo","colDefFactory","rowStyleSvc","rowNodeBlockLoader","rowNodeSorter","ctrlsSvc","pinnedCols","dataTypeSvc","syncSvc","overlays","stateSvc","expansionSvc","apiEventSvc","ariaAnnounce","menuSvc","colMoves","colAutosize","colFlex","colResize","pivotColsSvc","valueColsSvc","rowGroupColsSvc","colNames","colViewport","pivotResultCols","showRowGroupCols","validation"],D5=Object.fromEntries(nG.map(($,z)=>[$,z]));function dG($,z){let Q=($.beanName?D5[$.beanName]:void 0)??Number.MAX_SAFE_INTEGER,J=(z.beanName?D5[z.beanName]:void 0)??Number.MAX_SAFE_INTEGER;return Q-J}function tG($,z){if($?.beanName==="gridDestroySvc")return-1;if(z?.beanName==="gridDestroySvc")return 1;return 0}function b$($){let{rowIndex:z,rowPinned:Q,column:J}=$;return`${z}.${Q==null?"null":Q}.${J.getId()}`}function AQ($,z){let Q=$.column===z.column,J=$.rowPinned===z.rowPinned,Z=$.rowIndex===z.rowIndex;return Q&&J&&Z}function G0($,z){switch($.rowPinned){case"top":if(z.rowPinned!=="top")return!0;break;case"bottom":if(z.rowPinned!=="bottom")return!1;break;default:if(T(z.rowPinned))return z.rowPinned!=="top";break}return $.rowIndexU.rowNode.rowIndex===z.rowIndex),G=q?X:Y,_=(Q?-1:1)*(q?-1:1),H;for(let U=0;U{if(!J.defaultPrevented&&!oG(J)&&J.key===A.TAB){let Z=J.shiftKey;if(!j0($,Q,!1,Z)){if(Z$($,Z))J.preventDefault()}}}})}function H$($){return $.gos.get("suppressHeaderFocus")||!!$.overlays?.exclusive}function qJ($){return $.gos.get("suppressCellFocus")||!!$.overlays?.exclusive}function Z$($,z,Q=!1){let J=$.ctrlsSvc.get("gridCtrl"),Z=J.focusNextInnerContainer(z);if(Z===!0)return!0;if(Z===!1)return Z;if(Q||!z&&!J.isDetailGrid()&&J.isFocusInsideGridBody())J.forceFocusOutOfContainer(z);return!1}function lG($,z){let Q=$.focusSvc,J=Q.getFocusedCell();if(J&&z&&AQ(J,z)){let{rowIndex:Z,rowPinned:X,column:Y}=z;if(hz($))Q.setFocusedCell({rowIndex:Z,column:Y,rowPinned:X,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!VQ()})}}function aG($,z){let Q=$.getFocusableContainerName();if(Q==="gridBody")return z();return N7($,()=>E$($.getGui(),".ag-tab-guard").length>0)?Q:null}function N7($,z){$.setAllowFocus?.(!0);try{return z()}finally{$.setAllowFocus?.(!1)}}var g7="__ag_Grid_Skip_Focusable_Container";function h7($){$[g7]=!0}function oG($){return $[g7]===!0}function u7($){if(!$.cols)return-1;return $.cols.treeDepth+1}function l0($){return $.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0}function e2($){let z=[],Q=$.ctrlsSvc.getHeaderRowContainerCtrls();for(let J of Q){if(!J)continue;let Z=J.getGroupRowCount()||0;for(let X=0;Xq)z[X]=G}}}return z}function eG($,z){let J=$.colModel.isPivotMode()?z_($):c7($),Z=z.getHeaderCellCtrls();for(let X of Z){let{column:Y}=X,q=Y.getAutoHeaderHeight();if(q!=null&&q>J&&Y.isAutoHeaderHeight())J=q}return J}function $4($){let Q=$.colModel.isPivotMode()?$_($):wJ($);return $.colModel.forAllCols((J)=>{let Z=J.getAutoHeaderHeight();if(Z!=null&&Z>Q&&J.isAutoHeaderHeight())Q=Z}),Q}function wJ($){return $.gos.get("headerHeight")??$.environment.getDefaultHeaderHeight()}function m7($){return $.gos.get("floatingFiltersHeight")??wJ($)}function c7($){return $.gos.get("groupHeaderHeight")??wJ($)}function $_($){return $.gos.get("pivotHeaderHeight")??wJ($)}function z_($){return $.gos.get("pivotGroupHeaderHeight")??c7($)}function Q_($,z){return $.headerRowIndex===z.headerRowIndex&&$.column===z.column}function J_($){return $?.headerRowIndex!=null}var Z_=class extends S{setComp($,z,Q){this.comp=$,this.eGui=z;let{beans:J}=this,{headerNavigation:Z,touchSvc:X,ctrlsSvc:Y}=J;if(Z)this.createManagedBean(new c$(Q,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusOut:this.onFocusOut.bind(this)}));this.addManagedEventListeners({columnPivotModeChanged:this.onPivotModeChanged.bind(this,J),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this,J)}),this.onPivotModeChanged(J),this.setupHeaderHeight();let q=this.onHeaderContextMenu.bind(this);this.addManagedElementListeners(this.eGui,{contextmenu:q}),X?.mockHeaderContextMenu(this,q),Y.register("gridHeaderCtrl",this)}setupHeaderHeight(){let $=this.setHeaderHeight.bind(this);$(),this.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],$),this.addManagedEventListeners({headerRowsChanged:$,columnHeaderHeightChanged:$,columnGroupHeaderHeightChanged:()=>Y$(this.beans,()=>$()),stylesChanged:$,advancedFilterEnabledChanged:$})}setHeaderHeight(){let{beans:$}=this,z=0,Q=e2($).reduce((Y,q)=>Y+q,0),J=$4($);if($.filterManager?.hasFloatingFilters())z+=m7($);z+=Q,z+=J;let Z=$.environment.getHeaderRowBorderWidth(),X=z+Z;if(this.headerHeightWithBorder!==X){this.headerHeightWithBorder=X;let Y=`${X}px`;this.comp.setHeightAndMinHeight(Y)}if(this.headerHeight!==z)this.headerHeight=z,this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}onPivotModeChanged($){let z=$.colModel.isPivotMode();this.comp.toggleCss("ag-pivot-on",z),this.comp.toggleCss("ag-pivot-off",!z)}onDisplayedColumnsChanged($){let Q=$.visibleCols.allCols.some((J)=>J.isSpanHeaderHeight());this.comp.toggleCss("ag-header-allow-overflow",Q)}onTabKeyDown($){let z=this.gos.get("enableRtl"),Q=$.shiftKey,J=Q!==z?"LEFT":"RIGHT",{beans:Z}=this,{headerNavigation:X,focusSvc:Y}=Z;if(X.navigateHorizontally(J,!0,$)||!Q&&Y.focusOverlay(!1)||Z$(Z,Q,!0))$.preventDefault()}handleKeyDown($){let z=null,{headerNavigation:Q}=this.beans;switch($.key){case A.LEFT:z="LEFT";case A.RIGHT:{if(!T(z))z="RIGHT";if(Q.navigateHorizontally(z,!1,$))$.preventDefault();break}case A.UP:z="UP";case A.DOWN:{if(!T(z))z="DOWN";if(Q.navigateVertically(z,$))$.preventDefault();break}default:return}}onFocusOut($){let{relatedTarget:z}=$,{eGui:Q,beans:J}=this;if(!z&&Q.contains(d(J)))return;if(!Q.contains(z))J.focusSvc.focusedHeader=null}onHeaderContextMenu($,z,Q){let{menuSvc:J,ctrlsSvc:Z}=this.beans;if(!$&&!Q||!J?.isHeaderContextMenuEnabled())return;let{target:X}=$??z;if(X===this.eGui||X===Z.getHeaderRowContainerCtrl()?.eViewport)J.showHeaderContextMenu(void 0,$,Q)}},z4=class extends x{constructor($,z){super($);this.ctrl=z}getCtrl(){return this.ctrl}},X_={tag:"div",cls:"ag-header-cell",role:"columnheader",children:[{tag:"div",ref:"eResize",cls:"ag-header-cell-resize",role:"presentation"},{tag:"div",ref:"eHeaderCompWrapper",cls:"ag-header-cell-comp-wrapper",role:"presentation"}]},Y_=class extends z4{constructor($){super(X_,$);this.eResize=f,this.eHeaderCompWrapper=f,this.headerCompVersion=0}postConstruct(){let $=this.getGui(),z=()=>{let J=this.ctrl.getSelectAllGui();if(J)this.eResize.insertAdjacentElement("afterend",J),this.addDestroyFunc(()=>J.remove())},Q={setWidth:(J)=>$.style.width=J,toggleCss:(J,Z)=>this.toggleCss(J,Z),setUserStyles:(J)=>Z1($,J),setAriaSort:(J)=>J?xY($,J):wY($),setUserCompDetails:(J)=>this.setUserCompDetails(J),getUserCompInstance:()=>this.headerComp,refreshSelectAllGui:z,removeSelectAllGui:()=>this.ctrl.getSelectAllGui()?.remove()};this.ctrl.setComp(Q,this.getGui(),this.eResize,this.eHeaderCompWrapper,void 0),z()}destroy(){this.destroyHeaderComp(),super.destroy()}destroyHeaderComp(){if(this.headerComp)this.headerCompGui?.remove(),this.headerComp=this.destroyBean(this.headerComp),this.headerCompGui=void 0}setUserCompDetails($){this.headerCompVersion++;let z=this.headerCompVersion;$.newAgStackInstance().then((Q)=>this.afterCompCreated(z,Q))}afterCompCreated($,z){if($!=this.headerCompVersion||!this.isAlive()){this.destroyBean(z);return}this.destroyHeaderComp(),this.headerComp=z,this.headerCompGui=z.getGui(),this.eHeaderCompWrapper.appendChild(this.headerCompGui),this.ctrl.setDragSource(this.getGui())}},q_={tag:"div",cls:"ag-header-group-cell",role:"columnheader",children:[{tag:"div",ref:"eHeaderCompWrapper",cls:"ag-header-cell-comp-wrapper",role:"presentation"},{tag:"div",ref:"eResize",cls:"ag-header-cell-resize",role:"presentation"}]},G_=class extends z4{constructor($){super(q_,$);this.eResize=f,this.eHeaderCompWrapper=f}postConstruct(){let $=this.getGui(),z=(J,Z)=>Z!=null?$.setAttribute(J,Z):$.removeAttribute(J),Q={toggleCss:(J,Z)=>this.toggleCss(J,Z),setUserStyles:(J)=>Z1($,J),setHeaderWrapperHidden:(J)=>{if(J)this.eHeaderCompWrapper.style.setProperty("display","none");else this.eHeaderCompWrapper.style.removeProperty("display")},setHeaderWrapperMaxHeight:(J)=>{if(J!=null)this.eHeaderCompWrapper.style.setProperty("max-height",`${J}px`);else this.eHeaderCompWrapper.style.removeProperty("max-height");this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height",J!=null)},setResizableDisplayed:(J)=>N(this.eResize,J),setWidth:(J)=>$.style.width=J,setAriaExpanded:(J)=>z("aria-expanded",J),setUserCompDetails:(J)=>this.setUserCompDetails(J),getUserCompInstance:()=>this.headerGroupComp};this.ctrl.setComp(Q,$,this.eResize,this.eHeaderCompWrapper,void 0)}setUserCompDetails($){$.newAgStackInstance().then((z)=>this.afterHeaderCompCreated(z))}afterHeaderCompCreated($){let z=()=>this.destroyBean($);if(!this.isAlive()){z();return}let Q=this.getGui(),J=$.getGui();this.eHeaderCompWrapper.appendChild(J),this.addDestroyFunc(z),this.headerGroupComp=$,this.ctrl.setDragSource(Q)}},__={tag:"div",cls:"ag-header-cell ag-floating-filter",role:"gridcell",children:[{tag:"div",ref:"eFloatingFilterBody",role:"presentation"},{tag:"div",ref:"eButtonWrapper",cls:"ag-floating-filter-button ag-hidden",role:"presentation",children:[{tag:"button",ref:"eButtonShowMainFilter",cls:"ag-button ag-floating-filter-button-button",attrs:{type:"button",tabindex:"-1"}}]}]},H_=class extends z4{constructor($){super(__,$);this.eFloatingFilterBody=f,this.eButtonWrapper=f,this.eButtonShowMainFilter=f}postConstruct(){let $=this.getGui(),z={toggleCss:(Q,J)=>this.toggleCss(Q,J),setUserStyles:(Q)=>Z1($,Q),addOrRemoveBodyCssClass:(Q,J)=>this.eFloatingFilterBody.classList.toggle(Q,J),setButtonWrapperDisplayed:(Q)=>N(this.eButtonWrapper,Q),setCompDetails:(Q)=>this.setCompDetails(Q),getFloatingFilterComp:()=>this.compPromise,setWidth:(Q)=>$.style.width=Q,setMenuIcon:(Q)=>this.eButtonShowMainFilter.appendChild(Q)};this.ctrl.setComp(z,$,this.eButtonShowMainFilter,this.eFloatingFilterBody,void 0)}setCompDetails($){if(!$){this.destroyFloatingFilterComp(),this.compPromise=null;return}this.compPromise=$.newAgStackInstance(),this.compPromise.then((z)=>this.afterCompCreated(z))}destroy(){this.destroyFloatingFilterComp(),super.destroy()}destroyFloatingFilterComp(){this.floatingFilterComp?.getGui().remove(),this.floatingFilterComp=this.destroyBean(this.floatingFilterComp)}afterCompCreated($){if(!$)return;if(!this.isAlive()){this.destroyBean($);return}this.destroyFloatingFilterComp(),this.floatingFilterComp=$,this.eFloatingFilterBody.appendChild($.getGui()),$.afterGuiAttached?.()}},U_=class extends x{constructor($){super({tag:"div",cls:$.headerRowClass,role:"row"});this.ctrl=$,this.headerComps={}}postConstruct(){this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),o1(this.getGui(),this.ctrl.getAriaRowIndex());let z={setHeight:(Q)=>this.getGui().style.height=Q,setTop:(Q)=>this.getGui().style.top=Q,setHeaderCtrls:(Q,J)=>this.setHeaderCtrls(Q,J),setWidth:(Q)=>this.getGui().style.width=Q,setRowIndex:(Q)=>o1(this.getGui(),Q)};this.ctrl.setComp(z,void 0)}destroy(){this.setHeaderCtrls([],!1),super.destroy()}setHeaderCtrls($,z){if(!this.isAlive())return;let Q=this.headerComps;this.headerComps={};for(let J of $){let Z=J.instanceId,X=Q[Z];if(delete Q[Z],X==null)X=this.createHeaderComp(J),this.getGui().appendChild(X.getGui());this.headerComps[Z]=X}if(Object.values(Q).forEach((J)=>{J.getGui().remove(),this.destroyBean(J)}),z){let J=Object.values(this.headerComps);J.sort((X,Y)=>{let q=X.getCtrl().column.getLeft(),G=Y.getCtrl().column.getLeft();return q-G});let Z=J.map((X)=>X.getGui());x6(this.getGui(),Z)}}createHeaderComp($){let z;switch(this.ctrl.type){case"group":z=new G_($);break;case"filter":z=new H_($);break;default:z=new Y_($);break}return this.createBean(z),z.setParentComponent(this),z}},Q4=class extends S{constructor($,z=!1){super();this.callback=$,this.addSpacer=z}postConstruct(){let $=this.setWidth.bind(this);if(this.addManagedPropertyListener("domLayout",$),this.addManagedEventListeners({columnContainerWidthChanged:$,displayedColumnsChanged:$,leftPinnedWidthChanged:$}),this.addSpacer)this.addManagedEventListeners({rightPinnedWidthChanged:$,scrollVisibilityChanged:$,scrollbarWidthChanged:$});this.setWidth()}setWidth(){let $=V0(this.gos,"print"),{visibleCols:z,scrollVisibleSvc:Q}=this.beans,J=z.bodyWidth,Z=z.getColsLeftWidth(),X=z.getDisplayedColumnsRightWidth(),Y;if($)Y=J+Z+X;else if(Y=J,this.addSpacer){if((this.gos.get("enableRtl")?Z:X)===0&&Q.verticalScrollShowing)Y+=Q.getScrollbarWidth()}this.callback(Y)}};function B1($,z,Q){if(Q)$.addDestroyFunc(()=>z.destroyBean(Q));return Q??$}var J4=class extends S{constructor($,z,Q,J){super();this.columnOrGroup=$,this.eCell=z,this.colsSpanning=J,this.columnOrGroup=$,this.ariaEl=z.querySelector("[role=columnheader]")||z,this.beans=Q}setColsSpanning($){this.colsSpanning=$,this.onLeftChanged()}getColumnOrGroup(){let{beans:$,colsSpanning:z}=this;if($.gos.get("enableRtl")&&z)return b(z);return this.columnOrGroup}postConstruct(){let $=this.onLeftChanged.bind(this);this.addManagedListeners(this.columnOrGroup,{leftChanged:$}),this.setLeftFirstTime(),this.addManagedEventListeners({displayedColumnsWidthChanged:$}),this.addManagedPropertyListener("domLayout",$)}setLeftFirstTime(){let{gos:$,colAnimation:z}=this.beans,Q=$.get("suppressColumnMoveAnimation"),J=T(this.columnOrGroup.getOldLeft());if(z?.isActive()&&J&&!Q)this.animateInLeft();else this.onLeftChanged()}animateInLeft(){let $=this.getColumnOrGroup(),z=this.modifyLeftForPrintLayout($,$.getOldLeft()),Q=this.modifyLeftForPrintLayout($,$.getLeft());this.setLeft(z),this.actualLeft=Q,this.beans.colAnimation.executeNextVMTurn(()=>{if(this.actualLeft===Q)this.setLeft(Q)})}onLeftChanged(){let $=this.getColumnOrGroup(),z=$.getLeft();this.actualLeft=this.modifyLeftForPrintLayout($,z),this.setLeft(this.actualLeft)}modifyLeftForPrintLayout($,z){let{gos:Q,visibleCols:J}=this.beans;if(!V0(Q,"print"))return z;if($.getPinned()==="left")return z;let X=J.getColsLeftWidth();if($.getPinned()==="right"){let Y=J.bodyWidth;return X+Y+z}return X+z}setLeft($){if(T($))this.eCell.style.left=`${$}px`;if(H0(this.columnOrGroup)){let z=this.columnOrGroup.getLeafColumns();if(!z.length)return;if(z.length>1)yY(this.ariaEl,z.length)}}},W_="ag-column-first",B_="ag-column-last";function NJ($,z,Q,J){if(n($))return[];return i7($.headerClass,$,z,Q,J)}function gJ($,z,Q,J){if(n($))return[];return i7($.toolPanelClass,$,z,Q,J)}function p7($,z,Q){$.toggleCss(W_,Q.isColAtEdge(z,"first")),$.toggleCss(B_,Q.isColAtEdge(z,"last"))}function E_($,z,Q,J){return y(z,{colDef:$,column:Q,columnGroup:J})}function i7($,z,Q,J,Z){if(n($))return[];let X;if(typeof $==="function"){let Y=E_(z,Q,J,Z);X=$(Y)}else X=$;if(typeof X==="string")return[X];if(Array.isArray(X))return[...X];return[]}var K_=0,n7="headerCtrl",Z4=class extends S{constructor($,z){super();this.column=$,this.rowCtrl=z,this.resizeToggleTimeout=0,this.resizeMultiplier=1,this.resizeFeature=null,this.lastFocusEvent=null,this.dragSource=null,this.reAttemptToFocus=!1,this.instanceId=$.getUniqueId()+"-"+K_++}postConstruct(){let $=this.refreshTabIndex.bind(this);this.addManagedPropertyListeners(["suppressHeaderFocus"],$),this.addManagedEventListeners({overlayExclusiveChanged:$})}setComp($,z,Q,J,Z){if(z.setAttribute("col-id",this.column.colIdSanitised),this.wireComp($,z,Q,J,Z),this.reAttemptToFocus)this.reAttemptToFocus=!1,this.focus(this.lastFocusEvent??void 0)}shouldStopEventPropagation($){let{headerRowIndex:z,column:Q}=this.beans.focusSvc.focusedHeader,J=Q.getDefinition(),Z=J?.suppressHeaderKeyboardEvent;if(!T(Z))return!1;let X=y(this.gos,{colDef:J,column:Q,headerRowIndex:z,event:$});return!!Z(X)}getWrapperHasFocus(){return d(this.beans)===this.eGui}setGui($,z){this.eGui=$,this.addDomData(z),z.addManagedListeners(this.beans.eventSvc,{displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this)}),z.addManagedElementListeners(this.eGui,{focus:this.onGuiFocus.bind(this)}),this.onDisplayedColumnsChanged(),this.refreshTabIndex()}refreshHeaderStyles(){let $=this.column.getDefinition();if(!$)return;let{headerStyle:z}=$,Q;if(typeof z==="function"){let J=this.getHeaderClassParams();Q=z(J)}else Q=z;if(Q)this.comp.setUserStyles(Q)}onGuiFocus(){this.eventSvc.dispatchEvent({type:"headerFocused",column:this.column})}setupAutoHeight($){let{wrapperElement:z,checkMeasuringCallback:Q,compBean:J}=$,{beans:Z}=this,X=(U)=>{if(!this.isAlive()||!J.isAlive())return;let{paddingTop:W,paddingBottom:B,borderBottomWidth:E,borderTopWidth:K}=MQ(this.eGui),L=W+B+E+K,F=z.offsetHeight+L;if(U<5){let k=!Y0(Z)?.contains(z),V=F==0;if(k||V){oZ(()=>X(U+1),"raf",Z);return}}this.setColHeaderHeight(this.column,F)},Y=!1,q,G=()=>{let U=this.column.isAutoHeaderHeight();if(U&&!Y)_();if(!U&&Y)H()},_=()=>{Y=!0,this.comp.toggleCss("ag-header-cell-auto-height",!0),X(0),q=F$(this.beans,z,()=>X(0))},H=()=>{if(Y=!1,q)q();this.comp.toggleCss("ag-header-cell-auto-height",!1),q=void 0};if(G(),J.addDestroyFunc(()=>H()),J.addManagedListeners(this.column,{widthChanged:()=>Y&&X(0)}),J.addManagedEventListeners({sortChanged:()=>{if(Y)window.setTimeout(()=>X(0))}}),Q)Q(G)}onDisplayedColumnsChanged(){let{comp:$,column:z,beans:Q,eGui:J}=this;if(!$||!z||!J)return;p7($,z,Q.visibleCols),j6(J,Q.visibleCols.getAriaColIndex(z))}addResizeAndMoveKeyboardListeners($){$.addManagedListeners(this.eGui,{keydown:this.onGuiKeyDown.bind(this),keyup:this.onGuiKeyUp.bind(this)})}refreshTabIndex(){let $=H$(this.beans);if(this.eGui)Pz(this.eGui,"tabindex",$?null:"-1")}onGuiKeyDown($){let z=d(this.beans),Q=$.key===A.LEFT||$.key===A.RIGHT;if(this.isResizing)$.preventDefault(),$.stopImmediatePropagation();if(z!==this.eGui||!$.shiftKey&&!$.altKey&&!$.ctrlKey&&!$.metaKey)return;if(this.isResizing||Q)$.preventDefault(),$.stopImmediatePropagation();if(($.ctrlKey||$.metaKey)&&V7($)===A.C)return this.beans.clipboardSvc?.copyToClipboard();if(!Q)return;let X=$.key===A.LEFT!==this.gos.get("enableRtl")?"left":"right";if($.altKey){this.isResizing=!0,this.resizeMultiplier+=1;let Y=this.getViewportAdjustedResizeDiff($);this.resizeHeader(Y,$.shiftKey),this.resizeFeature?.toggleColumnResizing(!0)}else this.moveHeader(X)}moveHeader($){this.beans.colMoves?.moveHeader($,this.eGui,this.column,this.rowCtrl.pinned,this)}getViewportAdjustedResizeDiff($){let z=this.getResizeDiff($),{pinnedCols:Q}=this.beans;return Q?Q.getHeaderResizeDiff(z,this.column):z}getResizeDiff($){let{gos:z,column:Q}=this,J=$.key===A.LEFT!==z.get("enableRtl"),Z=Q.getPinned(),X=z.get("enableRtl");if(Z){if(X!==(Z==="right"))J=!J}return(J?-1:1)*this.resizeMultiplier}onGuiKeyUp(){if(!this.isResizing)return;if(this.resizeToggleTimeout)window.clearTimeout(this.resizeToggleTimeout),this.resizeToggleTimeout=0;this.isResizing=!1,this.resizeMultiplier=1,this.resizeToggleTimeout=window.setTimeout(()=>{this.resizeFeature?.toggleColumnResizing(!1)},150)}handleKeyDown($){let z=this.getWrapperHasFocus();switch($.key){case A.PAGE_DOWN:case A.PAGE_UP:case A.PAGE_HOME:case A.PAGE_END:if(z)$.preventDefault()}}addDomData($){let z=n7,{eGui:Q,gos:J}=this;wz(J,Q,z,this),$.addDestroyFunc(()=>wz(J,Q,z,null))}focus($){if(!this.isAlive())return!1;let{eGui:z}=this;if(!z)this.reAttemptToFocus=!0;else this.lastFocusEvent=$||null,z.focus();return!0}focusThis(){this.beans.focusSvc.focusedHeader={headerRowIndex:this.rowCtrl.rowIndex,column:this.column}}removeDragSource(){if(this.dragSource)this.beans.dragAndDrop?.removeDragSource(this.dragSource),this.dragSource=null}handleContextMenuMouseEvent($,z,Q){let J=$??z,{menuSvc:Z,gos:X}=this.beans;if(X.get("preventDefaultOnContextMenu"))J.preventDefault();if(Z?.isHeaderContextMenuEnabled(Q))Z.showHeaderContextMenu(Q,$,z);this.dispatchColumnMouseEvent("columnHeaderContextMenu",Q)}dispatchColumnMouseEvent($,z){this.eventSvc.dispatchEvent({type:$,column:z})}setColHeaderHeight($,z){if(!$.setAutoHeaderHeight(z))return;let{eventSvc:Q}=this;if($.isColumn)Q.dispatchEvent({type:"columnHeaderHeightChanged",column:$,columns:[$],source:"autosizeColumnHeaderHeight"});else Q.dispatchEvent({type:"columnGroupHeaderHeightChanged",columnGroup:$,source:"autosizeColumnGroupHeaderHeight"})}clearComponent(){this.removeDragSource(),this.resizeFeature=null,this.comp=null,this.eGui=null}destroy(){super.destroy(),this.column=null,this.lastFocusEvent=null,this.rowCtrl=null}},L_=class extends Z4{constructor(){super(...arguments);this.refreshFunctions={},this.userHeaderClasses=new Set,this.ariaDescriptionProperties=new Map}wireComp($,z,Q,J,Z){this.comp=$;let{rowCtrl:X,column:Y,beans:q}=this,{colResize:G,context:_,colHover:H,rangeSvc:U}=q,W=B1(this,_,Z);if(this.setGui(z,W),this.updateState(),this.setupWidth(W),this.setupMovingCss(W),this.setupMenuClass(W),this.setupSortableClass(W),this.setupWrapTextClass(),this.refreshSpanHeaderHeight(),this.setupAutoHeight({wrapperElement:J,checkMeasuringCallback:(E)=>this.setRefreshFunction("measuring",E),compBean:W}),this.addColumnHoverListener(W),this.setupFilterClass(W),this.setupStylesFromColDef(),this.setupClassesFromColDef(),this.setupTooltip(),this.addActiveHeaderMouseListeners(W),this.setupSelectAll(W),this.setupUserComp(),this.refreshAria(),G)this.resizeFeature=W.createManagedBean(G.createResizeFeature(X.pinned,Y,Q,$,this));else N(Q,!1);H?.createHoverFeature(W,[Y],z),U?.createRangeHighlightFeature(W,Y,$),W.createManagedBean(new J4(Y,z,q)),W.createManagedBean(new c$(z,{shouldStopEventPropagation:(E)=>this.shouldStopEventPropagation(E),onTabKeyDown:()=>null,handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this),onFocusOut:this.onFocusOut.bind(this)})),this.addResizeAndMoveKeyboardListeners(W),W.addManagedPropertyListeners(["suppressMovableColumns","suppressMenuHide","suppressAggFuncInHeader","enableAdvancedFilter"],()=>this.refresh()),W.addManagedListeners(Y,{colDefChanged:()=>this.refresh(),formulaRefChanged:()=>this.refresh(),headerHighlightChanged:this.onHeaderHighlightChanged.bind(this)});let B=()=>this.checkDisplayName();W.addManagedEventListeners({columnValueChanged:B,columnRowGroupChanged:B,columnPivotChanged:B,headerHeightChanged:this.onHeaderHeightChanged.bind(this)}),W.addDestroyFunc(()=>{this.refreshFunctions={},this.selectAllFeature=null,this.dragSourceElement=void 0,this.userCompDetails=null,this.userHeaderClasses.clear(),this.ariaDescriptionProperties.clear(),this.clearComponent()})}resizeHeader($,z){this.beans.colResize?.resizeHeader(this.column,$,z)}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.colDef;return y(z.gos,{colDef:Q,column:$,floatingFilter:!1})}setupUserComp(){let $=this.lookupUserCompDetails();if($)this.setCompDetails($)}setCompDetails($){this.userCompDetails=$,this.comp.setUserCompDetails($)}lookupUserCompDetails(){let $=this.createParams(),z=this.column.getColDef();return LG(this.beans.userCompFactory,z,$)}createParams(){let{menuSvc:$,sortSvc:z,colFilter:Q,gos:J}=this.beans;return y(J,{column:this.column,displayName:this.displayName,enableSorting:this.column.isSortable(),enableMenu:this.menuEnabled,enableFilterButton:this.openFilterEnabled&&!!$?.isHeaderFilterButtonEnabled(this.column),enableFilterIcon:!!Q&&(!this.openFilterEnabled||U0(this.gos)),showColumnMenu:(X,Y)=>{$?.showColumnMenu({column:this.column,buttonElement:X,positionBy:"button",onClosedCallback:Y})},showColumnMenuAfterMouseClick:(X,Y)=>{$?.showColumnMenu({column:this.column,mouseEvent:X,positionBy:"mouse",onClosedCallback:Y})},showFilter:(X)=>{$?.showFilterMenu({column:this.column,buttonElement:X,containerType:"columnFilter",positionBy:"button"})},progressSort:(X)=>{z?.progressSort(this.column,!!X,"uiColumnSorted")},setSort:(X,Y)=>{z?.setSortForColumn(this.column,a0(X),!!Y,"uiColumnSorted")},eGridHeader:this.eGui,setTooltip:(X,Y)=>{J.assertModuleRegistered("Tooltip",3),this.setupTooltip(X,Y)}})}setupSelectAll($){let{selectionSvc:z}=this.beans;if(!z)return;this.selectAllFeature=$.createOptionalManagedBean(z.createSelectAllFeature(this.column)),this.selectAllFeature?.setComp(this),$.addManagedPropertyListener("rowSelection",()=>{let Q=z.createSelectAllFeature(this.column);if(Q&&!this.selectAllFeature)this.selectAllFeature=$.createManagedBean(Q),this.selectAllFeature?.setComp(this),this.comp.refreshSelectAllGui();else if(this.selectAllFeature&&!Q)this.comp.removeSelectAllGui(),this.selectAllFeature=this.destroyBean(this.selectAllFeature)})}getSelectAllGui(){return this.selectAllFeature?.getCheckboxGui()}handleKeyDown($){if(super.handleKeyDown($),$.key===A.SPACE)this.selectAllFeature?.onSpaceKeyDown($);else if($.key===A.ENTER)this.onEnterKeyDown($);else if($.key===A.DOWN&&$.altKey)this.showMenuOnKeyPress($,!1)}onEnterKeyDown($){let{column:z,gos:Q,sortable:J,beans:Z}=this,X=!1;if($.ctrlKey||$.metaKey)X=this.showMenuOnKeyPress($,!0);if(!X){if(!$.altKey&&Jz(Q))Z.rangeSvc?.handleColumnSelection(z,$);else if(J)Z.sortSvc?.progressSort(z,$.shiftKey,"uiColumnSorted")}}showMenuOnKeyPress($,z){let Q=this.comp.getUserCompInstance();if(!F5(Q))return!1;if(Q.onMenuKeyboardShortcut(z))return $.preventDefault(),!0;return!1}onFocusIn($){if(!this.eGui.contains($.relatedTarget))this.focusThis(),this.announceAriaDescription();if(VQ())this.setActiveHeader(!0)}onFocusOut($){if(this.eGui.contains($.relatedTarget))return;this.setActiveHeader(!1)}setupTooltip($,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderTooltip(this.tooltipFeature,this,$,z)}setupStylesFromColDef(){this.setRefreshFunction("headerStyles",this.refreshHeaderStyles.bind(this)),this.refreshHeaderStyles()}setupClassesFromColDef(){let $=()=>{let z=this.column.getColDef(),Q=NJ(z,this.gos,this.column,null),J=this.userHeaderClasses;this.userHeaderClasses=new Set(Q);for(let Z of Q)if(J.has(Z))J.delete(Z);else this.comp.toggleCss(Z,!0);for(let Z of J)this.comp.toggleCss(Z,!1)};this.setRefreshFunction("headerClasses",$),$()}setDragSource($){if(this.dragSourceElement=$,this.removeDragSource(),!$||!this.draggable)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader($,this.column,this.displayName)??null}updateState(){let{menuSvc:$}=this.beans;this.menuEnabled=!!$?.isColumnMenuInHeaderEnabled(this.column),this.openFilterEnabled=!!$?.isFilterMenuInHeaderEnabled(this.column),this.sortable=this.column.isSortable(),this.displayName=this.calculateDisplayName(),this.draggable=this.workOutDraggable()}setRefreshFunction($,z){this.refreshFunctions[$]=z}refresh(){this.updateState(),this.refreshHeaderComp(),this.refreshAria();for(let $ of Object.values(this.refreshFunctions))$()}refreshHeaderComp(){let $=this.lookupUserCompDetails();if(!$)return;if(this.comp.getUserCompInstance()!=null&&this.userCompDetails.componentClass==$.componentClass?this.attemptHeaderCompRefresh($.params):!1)this.setDragSource(this.dragSourceElement);else this.setCompDetails($)}attemptHeaderCompRefresh($){let z=this.comp.getUserCompInstance();if(!z)return!1;if(!z.refresh)return!1;return z.refresh($)}calculateDisplayName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"header",!0)}checkDisplayName(){if(this.displayName!==this.calculateDisplayName())this.refresh()}workOutDraggable(){let $=this.column.getColDef();return!this.gos.get("suppressMovableColumns")&&!$.suppressMovable&&!$.lockPosition||!!$.enableRowGroup||!!$.enablePivot}setupWidth($){let z=()=>{let Q=this.column.getActualWidth();this.comp.setWidth(`${Q}px`)};$.addManagedListeners(this.column,{widthChanged:z}),z()}setupMovingCss($){let z=()=>{this.comp.toggleCss("ag-header-cell-moving",this.column.isMoving())};$.addManagedListeners(this.column,{movingChanged:z}),z()}setupMenuClass($){let z=()=>{this.comp?.toggleCss("ag-column-menu-visible",this.column.isMenuVisible())};$.addManagedListeners(this.column,{menuVisibleChanged:z}),z()}setupSortableClass($){let z=()=>{this.comp.toggleCss("ag-header-cell-sortable",!!this.sortable)};z(),this.setRefreshFunction("updateSortable",z),$.addManagedEventListeners({sortChanged:this.refreshAriaSort.bind(this)})}setupFilterClass($){let z=()=>{let Q=this.column.isFilterActive();this.comp.toggleCss("ag-header-cell-filtered",Q),this.refreshAria()};$.addManagedListeners(this.column,{filterActiveChanged:z}),z()}setupWrapTextClass(){let $=()=>{let z=!!this.column.getColDef().wrapHeaderText;this.comp.toggleCss("ag-header-cell-wrap-text",z)};$(),this.setRefreshFunction("wrapText",$)}onHeaderHighlightChanged(){let $=this.column.getHighlighted(),z=$===0,Q=$===1;this.comp.toggleCss("ag-header-highlight-before",z),this.comp.toggleCss("ag-header-highlight-after",Q)}onDisplayedColumnsChanged(){if(super.onDisplayedColumnsChanged(),!this.isAlive())return;this.onHeaderHeightChanged()}onHeaderHeightChanged(){this.refreshSpanHeaderHeight()}refreshSpanHeaderHeight(){let{eGui:$,column:z,comp:Q,beans:J}=this,Z=e2(this.beans),X=Z.reduce((W,B)=>W+B,0)===0;if(Q.toggleCss("ag-header-parent-hidden",X),!z.isSpanHeaderHeight()){$.style.removeProperty("top"),$.style.removeProperty("height"),Q.toggleCss("ag-header-span-height",!1),Q.toggleCss("ag-header-span-total",!1);return}let{numberOfParents:Y,isSpanningTotal:q}=this.column.getColumnGroupPaddingInfo();Q.toggleCss("ag-header-span-height",Y>0);let G=$4(J);if(Y===0){Q.toggleCss("ag-header-span-total",!1),$.style.setProperty("top","0px"),$.style.setProperty("height",`${G}px`);return}Q.toggleCss("ag-header-span-total",q);let _=(this.column.getFirstRealParent()?.getLevel()??-1)+1,H=Z.length-_,U=0;for(let W=0;WZ==="filter"?-1:X.charCodeAt(0)-Z.charCodeAt(0)).map((Z)=>Q.get(Z)).join(". ");$.ariaAnnounce?.announceValue(J,"columnHeader")}refreshAria(){this.refreshAriaSort(),this.refreshAriaMenu(),this.refreshAriaFilterButton(),this.refreshAriaFiltered(),this.refreshAriaCellSelection()}addColumnHoverListener($){this.beans.colHover?.addHeaderColumnHoverListener($,this.comp,this.column)}addActiveHeaderMouseListeners($){let z=(Z)=>this.handleMouseOverChange(Z.type==="mouseenter"),Q=()=>{this.setActiveHeader(!0),this.dispatchColumnMouseEvent("columnHeaderClicked",this.column)},J=(Z)=>this.handleContextMenuMouseEvent(Z,void 0,this.column);$.addManagedListeners(this.eGui,{mouseenter:z,mouseleave:z,click:Q,contextmenu:J})}handleMouseOverChange($){this.setActiveHeader($),this.eventSvc.dispatchEvent({type:$?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column})}setActiveHeader($){this.comp.toggleCss("ag-header-active",$)}getAnchorElementForMenu($){let z=this.comp.getUserCompInstance();if(F5(z))return z.getAnchorElementForMenu($);return this.eGui}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function F5($){return typeof $?.getAnchorElementForMenu==="function"&&typeof $.onMenuKeyboardShortcut==="function"}var D_=0,vZ=class extends S{constructor($,z,Q){super();this.rowIndex=$,this.pinned=z,this.type=Q,this.instanceId=D_++,this.comp=null,this.allCtrls=[];let J="ag-header-row-column";if(Q==="group")J="ag-header-row-group";else if(Q==="filter")J="ag-header-row-filter";this.headerRowClass=`ag-header-row ${J}`}setRowIndex($){this.rowIndex=$,this.comp?.setRowIndex(this.getAriaRowIndex()),this.onRowHeightChanged()}postConstruct(){this.isPrintLayout=V0(this.gos,"print"),this.isEnsureDomOrder=this.gos.get("ensureDomOrder")}areCellsRendered(){if(!this.comp)return!1;return this.allCtrls.every(($)=>$.eGui!=null)}setComp($,z,Q=!0){if(this.comp=$,z=B1(this,this.beans.context,z),Q)this.setRowIndex(this.rowIndex),this.onVirtualColumnsChanged();this.setWidth(),this.addEventListeners(z)}getAriaRowIndex(){return this.rowIndex+1}addEventListeners($){let z=this.onRowHeightChanged.bind(this),Q=this.onDisplayedColumnsChanged.bind(this);$.addManagedEventListeners({columnResized:this.setWidth.bind(this),displayedColumnsChanged:Q,virtualColumnsChanged:(J)=>this.onVirtualColumnsChanged(J.afterScroll),columnGroupHeaderHeightChanged:z,columnHeaderHeightChanged:z,stylesChanged:z,advancedFilterEnabledChanged:z}),$.addManagedPropertyListener("domLayout",Q),$.addManagedPropertyListener("ensureDomOrder",(J)=>this.isEnsureDomOrder=J.currentValue),$.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],z)}onDisplayedColumnsChanged(){this.isPrintLayout=V0(this.gos,"print"),this.onVirtualColumnsChanged(),this.setWidth(),this.onRowHeightChanged()}setWidth(){if(!this.comp)return;let $=this.getWidthForRow();this.comp.setWidth(`${$}px`)}getWidthForRow(){let{visibleCols:$}=this.beans;if(this.isPrintLayout){if(this.pinned!=null)return 0;return $.getContainerWidth("right")+$.getContainerWidth("left")+$.getContainerWidth(null)}return $.getContainerWidth(this.pinned)}onRowHeightChanged(){if(!this.comp)return;let{topOffset:$,rowHeight:z}=this.getTopAndHeight();this.comp.setTop($+"px"),this.comp.setHeight(z+"px")}getTopAndHeight(){let $=0,z=e2(this.beans);for(let Z=0;Z{let{focusSvc:Z,visibleCols:X}=this.beans;if(!Z.isHeaderWrapperFocused(J))return!1;return X.isVisible(J.column)};if($)for(let[J,Z]of $)if(Q(Z))this.ctrlsById.set(J,Z);else this.destroyBean(Z);return this.allCtrls=Array.from(this.ctrlsById.values()),this.allCtrls}getHeaderCellCtrls(){return this.allCtrls}recycleAndCreateHeaderCtrls($,z,Q){if($.isEmptyGroup())return;let J=$.getUniqueId(),Z;if(Q)Z=Q.get(J),Q.delete(J);if(Z&&Z.column!=$)this.destroyBean(Z),Z=void 0;if(Z==null)switch(this.type){case"filter":{Z=this.createBean(this.beans.registry.createDynamicBean("headerFilterCellCtrl",!0,$,this));break}case"group":Z=this.createBean(this.beans.registry.createDynamicBean("headerGroupCellCtrl",!0,$,this));break;default:Z=this.createBean(new L_($,this));break}z.set(J,Z)}getColumnsInViewport(){if(!this.isPrintLayout)return this.getComponentsToRender();if(this.pinned)return[];let $=[];for(let z of["left",null,"right"])$.push(...this.getComponentsToRender(z));return $}getComponentsToRender($=this.pinned){if(this.type==="group")return this.beans.colViewport.getHeadersToRender($,this.rowIndex);return this.beans.colViewport.getColumnHeadersToRender($)}focusHeader($,z){let Q=this.allCtrls.find((Z)=>Z.column==$);if(!Q)return!1;return Q.focus(z)}destroy(){this.allCtrls=this.destroyBeans(this.allCtrls),this.ctrlsById=void 0,this.comp=null,super.destroy()}},F_=class extends S{constructor($){super();this.pinned=$,this.hidden=!1,this.includeFloatingFilter=!1,this.groupsRowCtrls=[]}setComp($,z){this.comp=$,this.eViewport=z;let{pinnedCols:Q,ctrlsSvc:J,colModel:Z,colMoves:X}=this.beans;this.setupCenterWidth(),Q?.setupHeaderPinnedWidth(this),this.setupDragAndDrop(X,this.eViewport);let Y=this.refresh.bind(this,!0);this.addManagedEventListeners({displayedColumnsChanged:Y,advancedFilterEnabledChanged:Y});let q=`${typeof this.pinned==="string"?this.pinned:"center"}Header`;if(J.register(q,this),Z.ready)this.refresh()}getAllCtrls(){let $=[...this.groupsRowCtrls];if(this.columnsRowCtrl)$.push(this.columnsRowCtrl);if(this.filtersRowCtrl)$.push(this.filtersRowCtrl);return $}refresh($=!1){let{focusSvc:z,filterManager:Q,visibleCols:J}=this.beans,Z=0,X=z.getFocusHeaderToUseAfterRefresh(),Y=()=>{let U=J.headerGroupRowCount;if(Z=U,!$)this.groupsRowCtrls=this.destroyBeans(this.groupsRowCtrls);let W=this.groupsRowCtrls.length;if(W===U)return;if(W>U){for(let B=U;B{let U=Z++;if(this.hidden){this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl);return}if(this.columnsRowCtrl==null||!$)this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl),this.columnsRowCtrl=this.createBean(new vZ(U,this.pinned,"column"));else if(this.columnsRowCtrl.rowIndex!==U)this.columnsRowCtrl.setRowIndex(U)},G=()=>{this.includeFloatingFilter=!!Q?.hasFloatingFilters()&&!this.hidden;let U=()=>{this.filtersRowCtrl=this.destroyBean(this.filtersRowCtrl)};if(!this.includeFloatingFilter){U();return}if(!$)U();let W=Z++;if(this.filtersRowCtrl){if(this.filtersRowCtrl.rowIndex!==W)this.filtersRowCtrl.setRowIndex(W)}else this.filtersRowCtrl=this.createBean(new vZ(W,this.pinned,"filter"))},_=this.getAllCtrls();Y(),q(),G();let H=this.getAllCtrls();if(this.comp.setCtrls(H),this.restoreFocusOnHeader(z,X),_.length!==H.length)this.beans.eventSvc.dispatchEvent({type:"headerRowsChanged"})}getHeaderCtrlForColumn($){let z=(Q)=>Q?.getHeaderCellCtrls().find((J)=>J.column===$);if(Q$($))return z(this.columnsRowCtrl);if(this.groupsRowCtrls.length===0)return;for(let Q=0;Qthis.comp.setCenterWidth(`${$}px`),!0))}},M_={tag:"div",cls:"ag-pinned-left-header",role:"rowgroup"},k_={tag:"div",cls:"ag-pinned-right-header",role:"rowgroup"},V_={tag:"div",cls:"ag-header-viewport",role:"rowgroup",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eCenterContainer",cls:"ag-header-container",role:"presentation"}]},IZ=class extends x{constructor($){super();this.eCenterContainer=f,this.headerRowComps={},this.rowCompsList=[],this.pinned=$}postConstruct(){this.selectAndSetTemplate();let $={setDisplayed:(Q)=>this.setDisplayed(Q),setCtrls:(Q)=>this.setCtrls(Q),setCenterWidth:(Q)=>this.eCenterContainer.style.width=Q,setViewportScrollLeft:(Q)=>this.getGui().scrollLeft=Q,setPinnedContainerWidth:(Q)=>{let J=this.getGui();J.style.width=Q,J.style.maxWidth=Q,J.style.minWidth=Q}};this.createManagedBean(new F_(this.pinned)).setComp($,this.getGui())}selectAndSetTemplate(){let $=this.pinned=="left",z=this.pinned=="right",Q=$?M_:z?k_:V_;this.setTemplate(Q),this.eRowContainer=this.eCenterContainer!==f?this.eCenterContainer:this.getGui()}destroy(){this.setCtrls([]),super.destroy()}destroyRowComp($){this.destroyBean($),$.getGui().remove()}setCtrls($){let z=this.headerRowComps;this.headerRowComps={},this.rowCompsList=[];let Q,J=(Z)=>{let X=Z.getGui();if(X.parentElement!=this.eRowContainer)this.eRowContainer.appendChild(X);if(Q)y6(this.eRowContainer,X,Q);Q=X};for(let Z of $){let X=Z.instanceId,Y=z[X];delete z[X];let q=Y?Y:this.createBean(new U_(Z));this.headerRowComps[X]=q,this.rowCompsList.push(q),J(q)}for(let Z of Object.values(z))this.destroyRowComp(Z)}},A_={tag:"div",cls:"ag-header",role:"presentation"},S_=class extends x{constructor(){super(A_)}postConstruct(){let $={toggleCss:(J,Z)=>this.toggleCss(J,Z),setHeightAndMinHeight:(J)=>{this.getGui().style.height=J,this.getGui().style.minHeight=J}};this.createManagedBean(new Z_).setComp($,this.getGui(),this.getFocusableElement());let Q=(J)=>{this.createManagedBean(J),this.appendChild(J)};Q(new IZ("left")),Q(new IZ(null)),Q(new IZ("right"))}},R_={selector:"AG-HEADER-ROOT",component:S_},U$={AUTO_HEIGHT:"ag-layout-auto-height",NORMAL:"ag-layout-normal",PRINT:"ag-layout-print"},X4=class extends S{constructor($){super();this.view=$}postConstruct(){this.addManagedPropertyListener("domLayout",this.updateLayoutClasses.bind(this)),this.updateLayoutClasses()}updateLayoutClasses(){let $=this.gos.get("domLayout"),z={autoHeight:$==="autoHeight",normal:$==="normal",print:$==="print"},Q=z.autoHeight?U$.AUTO_HEIGHT:z.print?U$.PRINT:U$.NORMAL;this.view.updateLayoutClasses(Q,z)}},d7=class extends x{constructor($,z){super();this.direction=z,this.eViewport=f,this.eContainer=f,this.hideTimeout=0,this.setTemplate($)}postConstruct(){this.addManagedEventListeners({scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this)}),this.onScrollVisibilityChanged(),this.toggleCss("ag-apple-scrollbar",P7()||bz())}destroy(){super.destroy(),window.clearTimeout(this.hideTimeout)}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.invisibleScrollbar=v7(),this.invisibleScrollbar)this.hideAndShowInvisibleScrollAsNeeded(),this.addActiveListenerToggles()}addActiveListenerToggles(){let $=this.getGui(),z=()=>this.toggleCss("ag-scrollbar-active",!0),Q=()=>this.toggleCss("ag-scrollbar-active",!1);this.addManagedListeners($,{mouseenter:z,mousedown:z,touchstart:z,mouseleave:Q,touchend:Q})}onScrollVisibilityChanged(){if(this.invisibleScrollbar===void 0)this.initialiseInvisibleScrollbar();Y$(this.beans,()=>this.setScrollVisible())}hideAndShowInvisibleScrollAsNeeded(){this.addManagedEventListeners({bodyScroll:($)=>{if($.direction===this.direction){if(this.hideTimeout)window.clearTimeout(this.hideTimeout),this.hideTimeout=0;this.toggleCss("ag-scrollbar-scrolling",!0)}},bodyScrollEnd:()=>{this.hideTimeout=window.setTimeout(()=>{this.toggleCss("ag-scrollbar-scrolling",!1),this.hideTimeout=0},400)}})}attemptSettingScrollPosition($){let z=this.eViewport;I2(this,()=>A0(z),()=>this.setScrollPosition($),100)}onScrollCallback($){this.addManagedElementListeners(this.eViewport,{scroll:$})}},j_={tag:"div",cls:"ag-body-horizontal-scroll",attrs:{"aria-hidden":"true"},children:[{tag:"div",ref:"eLeftSpacer",cls:"ag-horizontal-left-spacer"},{tag:"div",ref:"eViewport",cls:"ag-body-horizontal-scroll-viewport",children:[{tag:"div",ref:"eContainer",cls:"ag-body-horizontal-scroll-container"}]},{tag:"div",ref:"eRightSpacer",cls:"ag-horizontal-right-spacer"}]},f_=class extends d7{constructor(){super(j_,"horizontal");this.eLeftSpacer=f,this.eRightSpacer=f,this.setScrollVisibleDebounce=0}wireBeans($){this.visibleCols=$.visibleCols,this.scrollVisibleSvc=$.scrollVisibleSvc}postConstruct(){super.postConstruct();let $=this.setFakeHScrollSpacerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:$,displayedColumnsWidthChanged:$,pinnedRowDataChanged:this.refreshCompBottom.bind(this)}),this.addManagedPropertyListener("domLayout",$),this.beans.ctrlsSvc.register("fakeHScrollComp",this),this.createManagedBean(new Q4((z)=>this.eContainer.style.width=`${z}px`)),this.addManagedPropertyListeners(["suppressHorizontalScroll"],this.onScrollVisibilityChanged.bind(this))}destroy(){window.clearTimeout(this.setScrollVisibleDebounce),super.destroy()}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.enableRtl=this.gos.get("enableRtl"),super.initialiseInvisibleScrollbar(),this.invisibleScrollbar)this.refreshCompBottom()}refreshCompBottom(){if(!this.invisibleScrollbar)return;let $=this.beans.pinnedRowModel?.getPinnedBottomTotalHeight()??0;this.getGui().style.bottom=`${$}px`}onScrollVisibilityChanged(){super.onScrollVisibilityChanged(),this.setFakeHScrollSpacerWidths()}setFakeHScrollSpacerWidths(){let $=this.scrollVisibleSvc.verticalScrollShowing,z=this.visibleCols.getDisplayedColumnsRightWidth(),Q=!this.enableRtl&&$,J=this.scrollVisibleSvc.getScrollbarWidth();if(Q)z+=J;f$(this.eRightSpacer,z),this.eRightSpacer.classList.toggle("ag-scroller-corner",z<=J);let Z=this.visibleCols.getColsLeftWidth();if(this.enableRtl&&$)Z+=J;f$(this.eLeftSpacer,Z),this.eLeftSpacer.classList.toggle("ag-scroller-corner",Z<=J)}setScrollVisible(){let $=this.scrollVisibleSvc.horizontalScrollShowing,z=this.invisibleScrollbar,Q=this.gos.get("suppressHorizontalScroll"),J=$?this.scrollVisibleSvc.getScrollbarWidth()||0:0,X=!Q?J===0&&z?16:J:0,Y=()=>{if(this.setScrollVisibleDebounce=0,this.toggleCss("ag-scrollbar-invisible",z),NQ(this.getGui(),X),NQ(this.eViewport,X),NQ(this.eContainer,X),!X)this.eContainer.style.setProperty("min-height","1px");this.setVisible($,{skipAriaHidden:!0})};if(window.clearTimeout(this.setScrollVisibleDebounce),!$)Y();else this.setScrollVisibleDebounce=window.setTimeout(Y,100)}getScrollPosition(){return e1(this.eViewport,this.enableRtl)}setScrollPosition($){if(!A0(this.eViewport))this.attemptSettingScrollPosition($);$J(this.eViewport,$,this.enableRtl)}},O_={selector:"AG-FAKE-HORIZONTAL-SCROLL",component:f_},t7=class extends S{constructor($,z){super();this.eContainer=$,this.eViewport=z}postConstruct(){this.addManagedEventListeners({rowContainerHeightChanged:this.onHeightChanged.bind(this,this.beans.rowContainerHeight)})}onHeightChanged($){let z=$.uiContainerHeight,Q=z!=null?`${z}px`:"";if(this.eContainer.style.height=Q,this.eViewport)this.eViewport.style.height=Q}},P_={tag:"div",cls:"ag-body-vertical-scroll",attrs:{"aria-hidden":"true"},children:[{tag:"div",ref:"eViewport",cls:"ag-body-vertical-scroll-viewport",children:[{tag:"div",ref:"eContainer",cls:"ag-body-vertical-scroll-container"}]}]},T_=class extends d7{constructor(){super(P_,"vertical")}postConstruct(){super.postConstruct(),this.createManagedBean(new t7(this.eContainer));let{ctrlsSvc:$}=this.beans;$.register("fakeVScrollComp",this),this.addManagedEventListeners({rowContainerHeightChanged:this.onRowContainerHeightChanged.bind(this,$)})}setScrollVisible(){let{scrollVisibleSvc:$}=this.beans,z=$.verticalScrollShowing,Q=this.invisibleScrollbar,J=z?$.getScrollbarWidth()||0:0,Z=J===0&&Q?16:J;this.toggleCss("ag-scrollbar-invisible",Q),f$(this.getGui(),Z),f$(this.eViewport,Z),f$(this.eContainer,Z),this.setDisplayed(z,{skipAriaHidden:!0})}onRowContainerHeightChanged($){let Q=$.getGridBodyCtrl().eBodyViewport,J=this.getScrollPosition(),Z=Q.scrollTop;if(J!=Z)this.setScrollPosition(Z,!0)}getScrollPosition(){return this.eViewport.scrollTop}setScrollPosition($,z){if(!z&&!A0(this.eViewport))this.attemptSettingScrollPosition($);this.eViewport.scrollTop=$}},v_={selector:"AG-FAKE-VERTICAL-SCROLL",component:T_};var s$="Viewport",M5="fakeVScrollComp",CZ=["fakeHScrollComp","centerHeader","topCenter","bottomCenter","stickyTopCenter","stickyBottomCenter"],k5=100,bZ=150,I_=class extends S{constructor($){super();this.clearRetryListenerFncs=[],this.lastScrollSource=[null,null],this.scrollLeft=-1,this.nextScrollTop=-1,this.scrollTop=-1,this.lastOffsetHeight=-1,this.lastScrollTop=-1,this.lastIsHorizontalScrollShowing=!1,this.scrollTimer=0,this.isScrollActive=!1,this.isVerticalPositionInvalidated=!0,this.isHorizontalPositionInvalidated=!0,this.eBodyViewport=$,this.resetLastHScrollDebounced=g$(this,()=>this.lastScrollSource[1]=null,bZ),this.resetLastVScrollDebounced=g$(this,()=>this.lastScrollSource[0]=null,bZ)}wireBeans($){this.ctrlsSvc=$.ctrlsSvc,this.animationFrameSvc=$.animationFrameSvc,this.visibleCols=$.visibleCols}destroy(){super.destroy(),this.clearRetryListenerFncs=[],window.clearTimeout(this.scrollTimer)}postConstruct(){this.enableRtl=this.gos.get("enableRtl");let $=this.invalidateVerticalScroll.bind(this),z=this.invalidateHorizontalScroll.bind(this);this.addManagedEventListeners({displayedColumnsWidthChanged:this.onDisplayedColumnsWidthChanged.bind(this),bodyHeightChanged:$,scrollGapChanged:z}),this.addManagedElementListeners(this.eBodyViewport,{scroll:$}),this.ctrlsSvc.whenReady(this,(Q)=>{this.centerRowsCtrl=Q.center,this.fakeVScrollComp=Q.fakeVScrollComp,this.fakeHScrollComp=Q.fakeHScrollComp,this.onDisplayedColumnsWidthChanged(),this.addScrollListener()})}invalidateHorizontalScroll(){this.isHorizontalPositionInvalidated=!0}invalidateVerticalScroll(){this.isVerticalPositionInvalidated=!0}addScrollListener(){this.addHorizontalScrollListeners(),this.addVerticalScrollListeners()}addHorizontalScrollListeners(){this.addManagedElementListeners(this.centerRowsCtrl.eViewport,{scroll:this.onHScroll.bind(this,s$)});for(let $ of CZ){let z=this.ctrlsSvc.get($);this.registerScrollPartner(z,this.onHScroll.bind(this,$))}}addVerticalScrollListeners(){let $=this.gos.get("debounceVerticalScrollbar"),z=$?g$(this,this.onVScroll.bind(this,s$),k5):this.onVScroll.bind(this,s$),Q=$?g$(this,this.onVScroll.bind(this,M5),k5):this.onVScroll.bind(this,M5);this.addManagedElementListeners(this.eBodyViewport,{scroll:z}),this.registerScrollPartner(this.fakeVScrollComp,Q)}registerScrollPartner($,z){$.onScrollCallback(z)}onDisplayedColumnsWidthChanged(){if(this.enableRtl)this.horizontallyScrollHeaderCenterAndFloatingCenter()}horizontallyScrollHeaderCenterAndFloatingCenter($){if(this.centerRowsCtrl==null)return;if($===void 0)$=this.centerRowsCtrl.getCenterViewportScrollLeft();this.setScrollLeftForAllContainersExceptCurrent(Math.abs($))}setScrollLeftForAllContainersExceptCurrent($){for(let z of[...CZ,s$]){if(this.lastScrollSource[1]===z)continue;let Q=this.getViewportForSource(z);$J(Q,$,this.enableRtl)}}getViewportForSource($){if($===s$)return this.centerRowsCtrl.eViewport;return this.ctrlsSvc.get($).eViewport}isControllingScroll($,z){if(this.lastScrollSource[z]==null){if(z===0)this.lastScrollSource[0]=$;else this.lastScrollSource[1]=$;return!0}return this.lastScrollSource[z]===$}onHScroll($){if(!this.isControllingScroll($,1))return;let z=this.centerRowsCtrl.eViewport,{scrollLeft:Q}=z;if(this.shouldBlockScrollUpdate(1,Q,!0))return;let J=e1(this.getViewportForSource($),this.enableRtl);this.doHorizontalScroll(J),this.resetLastHScrollDebounced()}onVScroll($){if(!this.isControllingScroll($,0))return;let z=$===s$?this.eBodyViewport.scrollTop:this.fakeVScrollComp.getScrollPosition(),Q=z;if(this.shouldBlockScrollUpdate(0,Q,!0))return;if($===s$)this.fakeVScrollComp.setScrollPosition(Q);else if(this.eBodyViewport.scrollTop=z,Q=this.eBodyViewport.scrollTop,this.invalidateVerticalScroll(),Q!==z)this.fakeVScrollComp.setScrollPosition(Q,!0);let{animationFrameSvc:J}=this;if(J?.setScrollTop(Q),this.nextScrollTop=Q,J?.active)J.schedule();else this.scrollGridIfNeeded(!0);this.resetLastVScrollDebounced()}doHorizontalScroll($){let z=this.fakeHScrollComp.getScrollPosition();if(this.scrollLeft===$&&$===z)return;this.scrollLeft=$,this.fireScrollEvent(1),this.horizontallyScrollHeaderCenterAndFloatingCenter($),this.centerRowsCtrl.onHorizontalViewportChanged(!0)}isScrolling(){return this.isScrollActive}fireScrollEvent($){let z={type:"bodyScroll",direction:$===1?"horizontal":"vertical",left:this.scrollLeft,top:this.scrollTop};this.isScrollActive=!0,this.eventSvc.dispatchEvent(z),window.clearTimeout(this.scrollTimer),this.scrollTimer=window.setTimeout(()=>{this.scrollTimer=0,this.isScrollActive=!1,this.eventSvc.dispatchEvent({...z,type:"bodyScrollEnd"})},bZ)}shouldBlockScrollUpdate($,z,Q=!1){if(Q&&!bz())return!1;if($===0)return this.shouldBlockVerticalScroll(z);return this.shouldBlockHorizontalScroll(z)}shouldBlockVerticalScroll($){let z=AJ(this.eBodyViewport),{scrollHeight:Q}=this.eBodyViewport;return $<0||$+z>Q}shouldBlockHorizontalScroll($){let z=this.centerRowsCtrl.getCenterWidth(),{scrollWidth:Q}=this.centerRowsCtrl.eViewport;if(this.enableRtl){if($>0)return!0}else if($<0)return!0;return Math.abs($)+z>Q}redrawRowsAfterScroll(){this.fireScrollEvent(0)}checkScrollLeft(){let $=this.scrollLeft,z=!1;for(let Q of CZ)if(this.getViewportForSource(Q).scrollLeft!==$){z=!0;break}if(z)this.onHScroll(s$)}scrollGridIfNeeded($=!1){let z=this.scrollTop!=this.nextScrollTop;if(z){if(this.scrollTop=this.nextScrollTop,$)this.invalidateVerticalScroll();this.redrawRowsAfterScroll()}return z}setHorizontalScrollPosition($,z=!1){let J=this.centerRowsCtrl.eViewport.scrollWidth-this.centerRowsCtrl.getCenterWidth();if(!z&&this.shouldBlockScrollUpdate(1,$))if(this.enableRtl)$=$>0?0:J;else $=Math.min(Math.max($,0),J);$J(this.centerRowsCtrl.eViewport,Math.abs($),this.enableRtl),this.doHorizontalScroll($)}setVerticalScrollPosition($){this.invalidateVerticalScroll(),this.eBodyViewport.scrollTop=$}getVScrollPosition(){if(!this.isVerticalPositionInvalidated){let{lastOffsetHeight:Q,lastScrollTop:J}=this;return{top:J,bottom:J+Q}}this.isVerticalPositionInvalidated=!1;let{scrollTop:$,offsetHeight:z}=this.eBodyViewport;return this.lastScrollTop=$,this.lastOffsetHeight=z,{top:$,bottom:$+z}}getApproximateVScollPosition(){if(this.lastScrollTop>=0&&this.lastOffsetHeight>=0)return{top:this.scrollTop,bottom:this.scrollTop+this.lastOffsetHeight};return this.getVScrollPosition()}getHScrollPosition(){return this.centerRowsCtrl.getHScrollPosition()}isHorizontalScrollShowing(){if(this.isHorizontalPositionInvalidated)this.lastIsHorizontalScrollShowing=this.centerRowsCtrl.isHorizontalScrollShowing(),this.isHorizontalPositionInvalidated=!1;return this.lastIsHorizontalScrollShowing}scrollHorizontally($){let z=this.centerRowsCtrl.eViewport.scrollLeft;return this.setHorizontalScrollPosition(z+$),this.centerRowsCtrl.eViewport.scrollLeft-z}scrollToTop(){this.setVerticalScrollPosition(0)}ensureNodeVisible($,z=null){let{rowModel:Q}=this.beans,J=Q.getRowCount(),Z=-1;for(let X=0;X=0)this.ensureIndexVisible(Z,z)}ensureIndexVisible($,z,Q=0){if(V0(this.gos,"print"))return;let{rowModel:J}=this.beans,Z=J.getRowCount();if(typeof $!=="number"||$<0||$>=Z){j(88,{index:$});return}this.clearRetryListeners();let{frameworkOverrides:X,pageBounds:Y,rowContainerHeight:q,rowRenderer:G}=this.beans;X.wrapIncoming(()=>{let _=this.ctrlsSvc.getGridBodyCtrl(),H=J.getRow($),U,W,B=0;this.invalidateVerticalScroll();do{let{stickyTopHeight:E,stickyBottomHeight:K}=_,L=H.rowTop,D=H.rowHeight,F=Y.getPixelOffset(),M=H.rowTop-F,k=M+H.rowHeight,V=this.getVScrollPosition(),R=q.divStretchOffset,O=V.top+R,I=V.bottom+R,v=I-O,C=q.getScrollPositionForPixel(M),m=q.getScrollPositionForPixel(k-v),w=Math.min((C+m)/2,M),a=O+E>M,t=I-Kv)u=C-E;else u=m+K;if(u!==null)this.setVerticalScrollPosition(u),G.redraw({afterScroll:!0});U=L!==H.rowTop||D!==H.rowHeight,W=E!==_.stickyTopHeight||K!==_.stickyBottomHeight,B++}while((U||W)&&B<10);if(this.animationFrameSvc?.flushAllFrames(),Q<10&&(H?.stub||!this.beans.rowAutoHeight?.areRowsMeasured())){let E=this.getVScrollPosition().top;this.clearRetryListenerFncs=this.addManagedEventListeners({bodyScroll:()=>{let K=this.getVScrollPosition().top;if(E===K)return;this.clearRetryListeners()},modelUpdated:()=>{if(this.clearRetryListeners(),$>=J.getRowCount())return;this.ensureIndexVisible($,z,Q+1)}})}})}clearRetryListeners(){for(let $ of this.clearRetryListenerFncs)$();this.clearRetryListenerFncs=[]}ensureColumnVisible($,z="auto"){let{colModel:Q,frameworkOverrides:J}=this.beans,Z=Q.getCol($);if(!Z)return;if(Z.isPinned())return;if(!this.visibleCols.isColDisplayed(Z))return;let X=this.getPositionedHorizontalScroll(Z,z);J.wrapIncoming(()=>{if(X!==null)this.centerRowsCtrl.setCenterViewportScrollLeft(X);this.centerRowsCtrl.onHorizontalViewportChanged(),this.animationFrameSvc?.flushAllFrames()})}getPositionedHorizontalScroll($,z){let{columnBeforeStart:Q,columnAfterEnd:J}=this.isColumnOutsideViewport($),Z=this.centerRowsCtrl.getCenterWidth()<$.getActualWidth(),X=this.centerRowsCtrl.getCenterWidth(),Y=this.enableRtl,q=(Y?Q:J)||Z,G=Y?J:Q;if(z!=="auto")q=z==="start",G=z==="end";let _=z==="middle";if(q||G||_){let{colLeft:H,colMiddle:U,colRight:W}=this.getColumnBounds($);if(_)return U-X/2;if(q)return Y?W:H;return Y?H-X:W-X}return null}isColumnOutsideViewport($){let{start:z,end:Q}=this.getViewportBounds(),{colLeft:J,colRight:Z}=this.getColumnBounds($),X=this.enableRtl,Y=X?z>Z:QJ;return{columnBeforeStart:Y,columnAfterEnd:q}}getColumnBounds($){let z=this.enableRtl,Q=this.visibleCols.bodyWidth,J=$.getActualWidth(),Z=$.getLeft(),X=z?-1:1,Y=z?Q-Z:Z,q=Y+J*X,G=Y+J/2*X;return{colLeft:Y,colMiddle:G,colRight:q}}getViewportBounds(){let $=this.centerRowsCtrl.getCenterWidth(),z=this.centerRowsCtrl.getCenterViewportScrollLeft(),Q=z,J=$+z;return{start:Q,end:J,width:$}}},V5={horizontal:{overflow:($)=>$.scrollWidth-$.clientWidth,scrollSize:($)=>$.scrollWidth,clientSize:($)=>$.clientWidth,opposite:"vertical"},vertical:{overflow:($)=>$.scrollHeight-$.clientHeight,scrollSize:($)=>$.scrollHeight,clientSize:($)=>$.clientHeight,opposite:"horizontal"}};function C_($,z,Q=t2()||0,J,Z){return s7($,z,"horizontal",Q,J,Z)}function b_($,z,Q=t2()||0,J,Z){return s7($,z,"vertical",Q,J,Z)}function s7($,z,Q,J,Z,X){let Y=V5[Q],q=V5[Y.opposite],G=Z?A0(Z):!0,_=X?A0(X):!0,H=Y.overflow($);if(H<=0)return!1;if(!z||J===0)return!0;let U=q.overflow(z);if(U<=0)return!0;if(H<=J){if(G&&_&&y_({candidateOverflow:U,candidateScrollSize:q.scrollSize(z),candidateClientSize:q.clientSize(z),scrollbarWidth:J}))return!1;let W=Y.clientSize($)+J;return Y.scrollSize($)<=W}return!0}function y_({candidateOverflow:$,candidateScrollSize:z,candidateClientSize:Q,scrollbarWidth:J}){if($<=0||$>J)return!1;let Z=Q+J;return z>Q&&z<=Z}var x_=class extends S{constructor($){super();this.centerContainerCtrl=$}wireBeans($){this.scrollVisibleSvc=$.scrollVisibleSvc}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCtrl=$.gridBodyCtrl,this.listenForResize()}),this.addManagedEventListeners({scrollbarWidthChanged:this.onScrollbarWidthChanged.bind(this)}),this.addManagedPropertyListeners(["alwaysShowHorizontalScroll","alwaysShowVerticalScroll"],()=>{this.checkViewportAndScrolls()})}listenForResize(){let{beans:$,centerContainerCtrl:z,gridBodyCtrl:Q}=this,J=()=>{Y$($,()=>{this.onCenterViewportResized()})};z.registerViewportResizeListener(J),Q.registerBodyViewportResizeListener(J)}onScrollbarWidthChanged(){this.checkViewportAndScrolls()}onCenterViewportResized(){if(this.scrollVisibleSvc.updateScrollGap(),this.centerContainerCtrl.isViewportInTheDOMTree()){let{pinnedCols:$,colFlex:z}=this.beans;$?.keepPinnedColumnsNarrowerThanViewport(),this.checkViewportAndScrolls();let Q=this.centerContainerCtrl.getCenterWidth();if(Q!==this.centerWidth)this.centerWidth=Q,z?.refreshFlexedColumns({viewportWidth:this.centerWidth,updateBodyWidths:!0,fireResizedEvent:!0})}else this.bodyHeight=0}checkViewportAndScrolls(){this.updateScrollVisibleService(),this.checkBodyHeight(),this.onHorizontalViewportChanged(),this.gridBodyCtrl.scrollFeature.checkScrollLeft()}getBodyHeight(){return this.bodyHeight}checkBodyHeight(){let $=this.gridBodyCtrl.eBodyViewport,z=AJ($);if(this.bodyHeight!==z)this.bodyHeight=z,this.eventSvc.dispatchEvent({type:"bodyHeightChanged"})}updateScrollVisibleService(){this.updateScrollVisibleServiceImpl(),setTimeout(this.updateScrollVisibleServiceImpl.bind(this),500)}updateScrollVisibleServiceImpl(){if(!this.isAlive())return;let $={horizontalScrollShowing:this.centerContainerCtrl.isHorizontalScrollShowing(),verticalScrollShowing:this.gridBodyCtrl.isVerticalScrollShowing()};this.scrollVisibleSvc.setScrollsVisible($)}onHorizontalViewportChanged(){let{centerContainerCtrl:$,beans:z}=this,Q=$.getCenterWidth(),J=$.getViewportScrollLeft();z.colViewport.setScrollPosition(Q,J)}};function r7($){if($.altKey||$.ctrlKey||$.metaKey)return!1;return $.key?.length===1}function t1($,z,Q,J){let Z=z.getColDef().cellRendererParams?.suppressMouseEventHandling;return l7($,z,Q,J,Z)}function w_($,z,Q,J){let Z=z?.suppressMouseEventHandling;return l7($,void 0,Q,J,Z)}function l7($,z,Q,J,Z){if(!Z)return!1;return Z(y($,{column:z,node:Q,event:J}))}function a7($,z,Q){let J=z;while(J){let Z=Q7($,J,Q);if(Z)return Z;J=J.parentElement}return null}var GJ="cellCtrl";function E1($,z){return a7($,z,GJ)}var _J="renderedRow";function Y4($,z){return a7($,z,_J)}function _2($,z,Q,J,Z){let X=J?J.getColDef().suppressKeyboardEvent:void 0;if(!X)return!1;let Y=y($,{event:z,editing:Z,column:J,node:Q,data:Q.data,colDef:J.getColDef()});if(X){if(X(Y))return!0}return!1}function N_($){let{pinnedRowModel:z,rowModel:Q,rangeSvc:J,visibleCols:Z}=$;if(!J||Z.allCols.length===0)return;let X=z?.isEmpty("top")??!0,Y=z?.isEmpty("bottom")??!0,q=X?null:"top",G,_;if(Y)G=null,_=Q.getRowCount()-1;else G="bottom",_=z?.getPinnedBottomRowCount()??-1;J.setCellRange({rowStartIndex:0,rowStartPinned:q,rowEndIndex:_,rowEndPinned:G})}var g_=class extends S{constructor($){super();this.element=$}postConstruct(){this.addKeyboardListeners(),this.addMouseListeners(),this.beans.touchSvc?.mockRowContextMenu(this),this.editSvc=this.beans.editSvc}addKeyboardListeners(){let z=this.processKeyboardEvent.bind(this,"keydown");this.addManagedElementListeners(this.element,{["keydown"]:z})}addMouseListeners(){let $="mousedown";if(lZ("pointerdown"))$="pointerdown";else if(lZ("touchstart"))$="touchstart";let z=["dblclick","contextmenu","mouseover","mouseout","click",$];for(let Q of z){let J=this.processMouseEvent.bind(this,Q);this.addManagedElementListeners(this.element,{[Q]:J})}}processMouseEvent($,z){if(!nQ(this.beans,z)||z$(z))return;let{cellCtrl:Q,rowCtrl:J}=this.getControlsForEventTarget(z.target);if($==="contextmenu"){if(Q?.column)Q.dispatchCellContextMenuEvent(z);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(z,void 0,J,Q)}else{if(Q)Q.onMouseEvent($,z);if(J)J.onMouseEvent($,z)}}getControlsForEventTarget($){let{gos:z}=this;return{cellCtrl:E1(z,$),rowCtrl:Y4(z,$)}}processKeyboardEvent($,z){let{cellCtrl:Q,rowCtrl:J}=this.getControlsForEventTarget(z.target);if(z.defaultPrevented)return;if(Q)this.processCellKeyboardEvent(Q,$,z);else if(J?.isFullWidth())this.processFullWidthRowKeyboardEvent(J,$,z)}processCellKeyboardEvent($,z,Q){let J=this.editSvc?.isEditing($,{withOpenEditor:!0})??!1;if(!_2(this.gos,Q,$.rowNode,$.column,J)){if(z==="keydown"){if(!(!J&&this.beans.navigation?.handlePageScrollingKey(Q)))$.onKeyDown(Q);if(this.doGridOperations(Q,J),r7(Q))$.processCharacter(Q)}}if(z==="keydown")this.eventSvc.dispatchEvent($.createEvent(Q,"cellKeyDown"))}processFullWidthRowKeyboardEvent($,z,Q){let{rowNode:J}=$,{focusSvc:Z,navigation:X}=this.beans,q=Z.getFocusedCell()?.column;if(!_2(this.gos,Q,J,q,!1)){let _=Q.key;if(z==="keydown")switch(_){case A.PAGE_HOME:case A.PAGE_END:case A.PAGE_UP:case A.PAGE_DOWN:X?.handlePageScrollingKey(Q,!0);break;case A.LEFT:case A.RIGHT:if(!this.gos.get("embedFullWidthRows"))break;case A.UP:case A.DOWN:$.onKeyboardNavigate(Q);break;case A.TAB:$.onTabKeyDown(Q);break;default:}}if(z==="keydown")this.eventSvc.dispatchEvent($.createRowEvent("cellKeyDown",Q))}doGridOperations($,z){if(!$.ctrlKey&&!$.metaKey)return;if(z)return;if(!nQ(this.beans,$))return;let Q=V7($),{clipboardSvc:J,undoRedo:Z}=this.beans;if(Q===A.A)return this.onCtrlAndA($);if(Q===A.C)return this.onCtrlAndC(J,$);if(Q===A.D)return this.onCtrlAndD(J,$);if(Q===A.V)return this.onCtrlAndV(J,$);if(Q===A.X)return this.onCtrlAndX(J,$);if(Q===A.Y)return this.onCtrlAndY(Z);if(Q===A.Z)return this.onCtrlAndZ(Z,$)}onCtrlAndA($){let{beans:{rowModel:z,rangeSvc:Q,selectionSvc:J},gos:Z}=this;if(Q&&u0(Z)&&!vq(Z)&&z.isRowsToRender())N_(this.beans);else if(J)J.selectAllRowNodes({source:"keyboardSelectAll",selectAll:q7(Z)});$.preventDefault()}onCtrlAndC($,z){if(!$||this.gos.get("enableCellTextSelection"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;z.preventDefault(),$.copyToClipboard()}onCtrlAndX($,z){if(!$||this.gos.get("enableCellTextSelection")||this.gos.get("suppressCutToClipboard"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;z.preventDefault(),$.cutToClipboard(void 0,"ui")}onCtrlAndV($,z){let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if($&&!this.gos.get("suppressClipboardPaste"))$.pasteFromClipboard()}onCtrlAndD($,z){if($&&!this.gos.get("suppressClipboardPaste"))$.copyRangeDown();z.preventDefault()}onCtrlAndZ($,z){if(!this.gos.get("undoRedoCellEditing")||!$)return;if(z.preventDefault(),z.shiftKey)$.redo("ui");else $.undo("ui")}onCtrlAndY($){$?.redo("ui")}},y1=($)=>$.topRowCtrls,x1=($)=>$.getStickyTopRowCtrls(),w1=($)=>$.getStickyBottomRowCtrls(),N1=($)=>$.bottomRowCtrls,g1=($)=>$.allRowCtrls,yZ=($)=>$.getCtrls("top"),xZ=($)=>$.getCtrls("center"),wZ=($)=>$.getCtrls("bottom"),h_={center:{type:"center",name:"center-cols",getRowCtrls:g1,getSpannedRowCtrls:xZ},left:{type:"left",name:"pinned-left-cols",pinnedType:"left",getRowCtrls:g1,getSpannedRowCtrls:xZ},right:{type:"right",name:"pinned-right-cols",pinnedType:"right",getRowCtrls:g1,getSpannedRowCtrls:xZ},fullWidth:{type:"fullWidth",name:"full-width",fullWidth:!0,getRowCtrls:g1},topCenter:{type:"center",name:"floating-top",getRowCtrls:y1,getSpannedRowCtrls:yZ},topLeft:{type:"left",name:"pinned-left-floating",container:"ag-pinned-left-floating-top",pinnedType:"left",getRowCtrls:y1,getSpannedRowCtrls:yZ},topRight:{type:"right",name:"pinned-right-floating",container:"ag-pinned-right-floating-top",pinnedType:"right",getRowCtrls:y1,getSpannedRowCtrls:yZ},topFullWidth:{type:"fullWidth",name:"floating-top-full-width",fullWidth:!0,getRowCtrls:y1},stickyTopCenter:{type:"center",name:"sticky-top",getRowCtrls:x1},stickyTopLeft:{type:"left",name:"pinned-left-sticky-top",container:"ag-pinned-left-sticky-top",pinnedType:"left",getRowCtrls:x1},stickyTopRight:{type:"right",name:"pinned-right-sticky-top",container:"ag-pinned-right-sticky-top",pinnedType:"right",getRowCtrls:x1},stickyTopFullWidth:{type:"fullWidth",name:"sticky-top-full-width",fullWidth:!0,getRowCtrls:x1},stickyBottomCenter:{type:"center",name:"sticky-bottom",getRowCtrls:w1},stickyBottomLeft:{type:"left",name:"pinned-left-sticky-bottom",container:"ag-pinned-left-sticky-bottom",pinnedType:"left",getRowCtrls:w1},stickyBottomRight:{type:"right",name:"pinned-right-sticky-bottom",container:"ag-pinned-right-sticky-bottom",pinnedType:"right",getRowCtrls:w1},stickyBottomFullWidth:{type:"fullWidth",name:"sticky-bottom-full-width",fullWidth:!0,getRowCtrls:w1},bottomCenter:{type:"center",name:"floating-bottom",getRowCtrls:N1,getSpannedRowCtrls:wZ},bottomLeft:{type:"left",name:"pinned-left-floating-bottom",container:"ag-pinned-left-floating-bottom",pinnedType:"left",getRowCtrls:N1,getSpannedRowCtrls:wZ},bottomRight:{type:"right",name:"pinned-right-floating-bottom",container:"ag-pinned-right-floating-bottom",pinnedType:"right",getRowCtrls:N1,getSpannedRowCtrls:wZ},bottomFullWidth:{type:"fullWidth",name:"floating-bottom-full-width",fullWidth:!0,getRowCtrls:N1}};function o7($){return`ag-${K1($).name}-viewport`}function e7($){let z=K1($);return z.container??`ag-${z.name}-container`}function u_($){return`ag-${K1($).name}-spanned-cells-container`}function K1($){return h_[$]}var m_=["topCenter","topLeft","topRight"],c_=["bottomCenter","bottomLeft","bottomRight"],p_=["center","left","right"],i_=["center","left","right","fullWidth"],n_=["stickyTopCenter","stickyBottomCenter","center","topCenter","bottomCenter"],d_=["left","bottomLeft","topLeft","stickyTopLeft","stickyBottomLeft"],t_=["right","bottomRight","topRight","stickyTopRight","stickyBottomRight"],$8=["stickyTopCenter","stickyTopLeft","stickyTopRight"],z8=["stickyBottomCenter","stickyBottomLeft","stickyBottomRight"],s_=[...$8,"stickyTopFullWidth",...z8,"stickyBottomFullWidth"],r_=[...m_,...c_,...p_,...$8,...z8],l_=class extends S{constructor($){super();this.name=$,this.visible=!0,this.EMPTY_CTRLS=[],this.options=K1($)}postConstruct(){this.enableRtl=this.gos.get("enableRtl"),this.forContainers(["center"],()=>{this.viewportSizeFeature=this.createManagedBean(new x_(this)),this.addManagedEventListeners({stickyTopOffsetChanged:this.onStickyTopOffsetChanged.bind(this)})})}onStickyTopOffsetChanged($){this.comp.setOffsetTop(`${$.offset}px`)}registerWithCtrlsService(){if(this.options.fullWidth)return;this.beans.ctrlsSvc.register(this.name,this)}forContainers($,z){if($.indexOf(this.name)>=0)z()}setComp($,z,Q,J){this.comp=$,this.eContainer=z,this.eSpannedContainer=Q,this.eViewport=J,this.createManagedBean(new g_(this.eViewport??this.eContainer)),this.addPreventScrollWhileDragging(),this.listenOnDomOrder();let{pinnedCols:Z,rangeSvc:X}=this.beans,Y=()=>this.onPinnedWidthChanged();if(this.forContainers(d_,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean(Z?.createPinnedWidthFeature(!0,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({leftPinnedWidthChanged:Y})}),this.forContainers(t_,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean(Z?.createPinnedWidthFeature(!1,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({rightPinnedWidthChanged:Y})}),this.forContainers(i_,()=>this.createManagedBean(new t7(this.eContainer,this.name==="center"?J:void 0))),X)this.forContainers(r_,()=>this.createManagedBean(X.createDragListenerFeature(this.eContainer)));this.forContainers(n_,()=>this.createManagedBean(new Q4((q)=>this.comp.setContainerWidth(`${q}px`)))),this.visible=this.isContainerVisible(),this.addListeners(),this.registerWithCtrlsService()}onScrollCallback($){this.addManagedElementListeners(this.eViewport,{scroll:$})}addListeners(){let{spannedRowRenderer:$,gos:z}=this.beans,Q=this.onDisplayedColumnsChanged.bind(this);if(this.addManagedEventListeners({displayedColumnsChanged:Q,displayedColumnsWidthChanged:Q,displayedRowsChanged:(J)=>this.onDisplayedRowsChanged(J.afterScroll)}),Q(),this.onDisplayedRowsChanged(),$&&this.options.getSpannedRowCtrls&&z.get("enableCellSpan"))this.addManagedListeners($,{spannedRowsUpdated:()=>{let J=this.options.getSpannedRowCtrls($);if(!J)return;this.comp.setSpannedRowCtrls(J,!1)}})}listenOnDomOrder(){if(s_.indexOf(this.name)>=0){this.comp.setDomOrder(!0);return}let z=()=>{let Q=this.gos.get("ensureDomOrder"),J=V0(this.gos,"print");this.comp.setDomOrder(Q||J)};this.addManagedPropertyListener("domLayout",z),z()}onDisplayedColumnsChanged(){this.forContainers(["center"],()=>this.onHorizontalViewportChanged())}addPreventScrollWhileDragging(){let{dragSvc:$}=this.beans;if(!$)return;let z=(Q)=>{if($.dragging){if(Q.cancelable)Q.preventDefault()}};this.eContainer.addEventListener("touchmove",z,{passive:!1}),this.addDestroyFunc(()=>this.eContainer.removeEventListener("touchmove",z))}onHorizontalViewportChanged($=!1){let z=this.getCenterWidth(),Q=this.getCenterViewportScrollLeft();this.beans.colViewport.setScrollPosition(z,Q,$)}hasHorizontalScrollGap(){return this.eContainer.clientWidth-this.eViewport.clientWidth<0}hasVerticalScrollGap(){return this.eContainer.clientHeight-this.eViewport.clientHeight<0}getCenterWidth(){return xz(this.eViewport)}getCenterViewportScrollLeft(){return e1(this.eViewport,this.enableRtl)}registerViewportResizeListener($){let z=F$(this.beans,this.eViewport,$);this.addDestroyFunc(()=>z())}isViewportInTheDOMTree(){return b6(this.eViewport)}getViewportScrollLeft(){return e1(this.eViewport,this.enableRtl)}isHorizontalScrollShowing(){let{beans:$,gos:z,eViewport:Q}=this,J=z.get("alwaysShowHorizontalScroll"),{ctrlsSvc:Z}=$,X=Z.getGridBodyCtrl()?.eBodyViewport,Y=Z.get("fakeHScrollComp")?.getGui(),q=Z.get("fakeVScrollComp")?.getGui();return J||C_(Q,X,void 0,Y,q)}setHorizontalScroll($){this.comp.setHorizontalScroll($)}getHScrollPosition(){return{left:this.eViewport.scrollLeft,right:this.eViewport.scrollLeft+this.eViewport.offsetWidth}}setCenterViewportScrollLeft($){$J(this.eViewport,$,this.enableRtl)}isContainerVisible(){return this.options.pinnedType==null||!!this.pinnedWidthFeature&&this.pinnedWidthFeature.getWidth()>0}onPinnedWidthChanged(){let $=this.isContainerVisible();if(this.visible!=$)this.visible=$,this.onDisplayedRowsChanged()}onDisplayedRowsChanged($=!1){let z=this.options.getRowCtrls(this.beans.rowRenderer);if(!this.visible||z.length===0){this.comp.setRowCtrls({rowCtrls:this.EMPTY_CTRLS});return}let Q=V0(this.gos,"print"),Z=this.gos.get("embedFullWidthRows")||Q,X=z.filter((Y)=>{let q=Y.isFullWidth();return this.options.fullWidth?!Z&&q:Z||!q});this.comp.setRowCtrls({rowCtrls:X,useFlushSync:$})}},Q8="ag-force-vertical-scroll",a_="ag-selectable",o_="ag-column-moving",e_=class extends S{constructor(){super(...arguments);this.stickyTopHeight=0,this.stickyBottomHeight=0}wireBeans($){this.ctrlsSvc=$.ctrlsSvc,this.colModel=$.colModel,this.scrollVisibleSvc=$.scrollVisibleSvc,this.pinnedRowModel=$.pinnedRowModel,this.filterManager=$.filterManager,this.rowGroupColsSvc=$.rowGroupColsSvc}setComp($,z,Q,J,Z,X,Y){this.comp=$,this.eGridBody=z,this.eBodyViewport=Q,this.eTop=J,this.eBottom=Z,this.eStickyTop=X,this.eStickyBottom=Y,this.eCenterColsViewport=Q.querySelector(`.${o7("center")}`),this.eFullWidthContainer=Q.querySelector(`.${e7("fullWidth")}`),this.setCellTextSelection(this.gos.get("enableCellTextSelection")),this.addManagedPropertyListener("enableCellTextSelection",(q)=>this.setCellTextSelection(q.currentValue)),this.createManagedBean(new X4(this.comp)),this.scrollFeature=this.createManagedBean(new I_(Q)),this.beans.rowDragSvc?.setupRowDrag(Q,this),this.setupRowAnimationCssClass(),this.addEventListeners(),this.addFocusListeners([J,Q,Z,X,Y]),this.setGridRootRole(),this.onGridColumnsChanged(),this.addBodyViewportListener(),this.setFloatingHeights(),this.disableBrowserDragging(),this.addStopEditingWhenGridLosesFocus(),this.updateScrollingClasses(),this.filterManager?.setupAdvFilterHeaderComp(J),this.ctrlsSvc.register("gridBodyCtrl",this)}addEventListeners(){let $=this.setFloatingHeights.bind(this),z=this.setGridRootRole.bind(this),Q=this.toggleRowResizeStyles.bind(this);this.addManagedEventListeners({gridColumnsChanged:this.onGridColumnsChanged.bind(this),scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this),scrollGapChanged:this.updateScrollingClasses.bind(this),pinnedRowDataChanged:$,pinnedHeightChanged:$,pinnedRowsChanged:$,headerHeightChanged:this.setStickyTopOffsetTop.bind(this),columnRowGroupChanged:z,columnPivotChanged:z,rowResizeStarted:Q,rowResizeEnded:Q}),this.addManagedPropertyListener("treeData",z)}toggleRowResizeStyles($){let z=$.type==="rowResizeStarted";this.eBodyViewport.classList.toggle("ag-prevent-animation",z)}onGridColumnsChanged(){let $=this.beans.colModel.getCols();this.comp.setColumnCount($.length)}onScrollVisibilityChanged(){let{scrollVisibleSvc:$}=this,z=$.verticalScrollShowing;this.setVerticalScrollPaddingVisible(z),this.setStickyWidth(z),this.setStickyBottomOffsetBottom();let Q=z?$.getScrollbarWidth()||0:0,J=v7()?16:0,Z=`calc(100% + ${Q+J}px)`;Y$(this.beans,()=>this.comp.setBodyViewportWidth(Z)),this.updateScrollingClasses()}setGridRootRole(){let{rowGroupColsSvc:$,colModel:z,gos:Q}=this,J=Q.get("treeData");if(!J){let Z=z.isPivotMode();J=(!$?0:$.columns.length)>=(Z?2:1)}this.comp.setGridRootRole(J?"treegrid":"grid")}addFocusListeners($){for(let z of $)this.addManagedElementListeners(z,{focusin:(Q)=>{let{target:J}=Q,Z=vz(J,"ag-root",z);z.classList.toggle("ag-has-focus",!Z)},focusout:(Q)=>{let{target:J,relatedTarget:Z}=Q,X=z.contains(Z),Y=vz(Z,"ag-root",z);if(vz(J,"ag-root",z))return;if(!X||Y)z.classList.remove("ag-has-focus")}})}setColumnMovingCss($){this.comp.setColumnMovingCss(o_,$)}setCellTextSelection($=!1){this.comp.setCellSelectableCss(a_,$)}updateScrollingClasses(){let{eGridBody:{classList:$},scrollVisibleSvc:z}=this;$.toggle("ag-body-vertical-content-no-gap",!z.verticalScrollGap),$.toggle("ag-body-horizontal-content-no-gap",!z.horizontalScrollGap)}disableBrowserDragging(){this.addManagedElementListeners(this.eGridBody,{dragstart:($)=>{if($.target instanceof HTMLImageElement)return $.preventDefault(),!1}})}addStopEditingWhenGridLosesFocus(){this.beans.editSvc?.addStopEditingWhenGridLosesFocus([this.eBodyViewport,this.eBottom,this.eTop,this.eStickyTop,this.eStickyBottom])}updateRowCount(){let $=(this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.filterManager?.getHeaderRowCount()??0),{rowModel:z}=this.beans,Q=z.isLastRowIndexKnown()?z.getRowCount():-1,J=Q===-1?-1:$+Q;this.comp.setRowCount(J)}registerBodyViewportResizeListener($){this.comp.registerBodyViewportResizeListener($)}setVerticalScrollPaddingVisible($){let z=$?"scroll":"hidden";this.comp.setPinnedTopBottomOverflowY(z)}isVerticalScrollShowing(){let{gos:$,comp:z,ctrlsSvc:Q}=this,J=$.get("alwaysShowVerticalScroll"),Z=J?Q8:null,X=V0($,"normal");z.setAlwaysVerticalScrollClass(Z,J);let Y=Q.get("center")?.eViewport,q=Q.get("fakeHScrollComp")?.getGui(),G=Q.get("fakeVScrollComp")?.getGui();return J||X&&b_(this.eBodyViewport,Y,void 0,G,q)}setupRowAnimationCssClass(){let{rowContainerHeight:$,environment:z}=this.beans,Q=z.sizesMeasured,J=()=>{let Z=Q&&HQ(this.gos)&&!$.stretching,X=Z?"ag-row-animation":"ag-row-no-animation";this.comp.setRowAnimationCssOnBodyViewport(X,Z)};J(),this.addManagedEventListeners({heightScaleChanged:J}),this.addManagedPropertyListener("animateRows",J),this.addManagedEventListeners({stylesChanged:()=>{if(!Q&&z.sizesMeasured)Q=!0,J()}})}addBodyViewportListener(){let{eBodyViewport:$,eStickyTop:z,eStickyBottom:Q,eTop:J,eBottom:Z,beans:{popupSvc:X,touchSvc:Y}}=this,q=this.onBodyViewportContextMenu.bind(this);this.addManagedElementListeners($,{contextmenu:q}),Y?.mockBodyContextMenu(this,q),this.addManagedElementListeners($,{wheel:this.onBodyViewportWheel.bind(this,X)});let G=this.onStickyWheel.bind(this);for(let H of[z,Q,J,Z])this.addManagedElementListeners(H,{wheel:G});let _=this.onHorizontalWheel.bind(this);for(let H of["left","right","topLeft","topRight","bottomLeft","bottomRight"])this.addManagedElementListeners(this.ctrlsSvc.get(H).eContainer,{wheel:_});this.addFullWidthContainerWheelListener()}addFullWidthContainerWheelListener(){this.addManagedElementListeners(this.eFullWidthContainer,{wheel:($)=>this.onFullWidthContainerWheel($)})}onFullWidthContainerWheel($){let{deltaX:z,deltaY:Q,shiftKey:J}=$;if((J||Math.abs(z)>Math.abs(Q))&&nQ(this.beans,$))this.scrollGridBodyToMatchEvent($)}onStickyWheel($){let{deltaY:z}=$;if(this.scrollVertically(z)>0)$.preventDefault()}onHorizontalWheel($){let{deltaX:z,deltaY:Q,shiftKey:J}=$;if(!(J||Math.abs(z)>Math.abs(Q)))return;this.scrollGridBodyToMatchEvent($)}scrollGridBodyToMatchEvent($){let{deltaX:z,deltaY:Q}=$;$.preventDefault(),this.eCenterColsViewport.scrollBy({left:z||Q})}onBodyViewportContextMenu($,z,Q){if(!$&&!Q)return;if(this.gos.get("preventDefaultOnContextMenu"))($||Q).preventDefault();let{target:J}=$||z;if(J===this.eBodyViewport||J===this.ctrlsSvc.get("center").eViewport)this.beans.contextMenuSvc?.showContextMenu({mouseEvent:$,touchEvent:Q,value:null,anchorToElement:this.eGridBody,source:"ui"})}onBodyViewportWheel($,z){if(!this.gos.get("suppressScrollWhenPopupsAreOpen"))return;if($?.hasAnchoredPopup())z.preventDefault()}scrollVertically($){let z=this.eBodyViewport.scrollTop;return this.scrollFeature.setVerticalScrollPosition(z+$),this.eBodyViewport.scrollTop-z}setFloatingHeights(){let{pinnedRowModel:$,beans:{environment:z}}=this,Q=$?.getPinnedTopTotalHeight(),J=$?.getPinnedBottomTotalHeight(),Z=z.getPinnedRowBorderWidth(),X=z.getRowBorderWidth(),Y=Z-X,q=!Q?0:Y+Q,G=!J?0:Y+J;this.comp.setTopHeight(q),this.comp.setBottomHeight(G),this.comp.setTopInvisible(q<=0),this.comp.setBottomInvisible(G<=0),this.setStickyTopOffsetTop(),this.setStickyBottomOffsetBottom()}setStickyTopHeight($=0){this.comp.setStickyTopHeight(`${$}px`),this.stickyTopHeight=$}setStickyBottomHeight($=0){this.comp.setStickyBottomHeight(`${$}px`),this.stickyBottomHeight=$}setStickyWidth($){if(!$)this.comp.setStickyTopWidth("100%"),this.comp.setStickyBottomWidth("100%");else{let z=this.scrollVisibleSvc.getScrollbarWidth();this.comp.setStickyTopWidth(`calc(100% - ${z}px)`),this.comp.setStickyBottomWidth(`calc(100% - ${z}px)`)}}setStickyTopOffsetTop(){let z=this.ctrlsSvc.get("gridHeaderCtrl").headerHeight+(this.filterManager?.getHeaderHeight()??0),Q=this.pinnedRowModel?.getPinnedTopTotalHeight()??0,J=0;if(z>0)J+=z;if(Q>0)J+=Q;if(J>0)J+=1;this.comp.setStickyTopTop(`${J}px`)}setStickyBottomOffsetBottom(){let{pinnedRowModel:$,scrollVisibleSvc:z,comp:Q}=this,J=$?.getPinnedBottomTotalHeight()??0,X=z.horizontalScrollShowing?z.getScrollbarWidth()||0:0,Y=J+X;Q.setStickyBottomBottom(`${Y}px`)}};function J0($){return K0($)}var $H=class extends x{constructor($,z,Q,J,Z){super();this.cellCtrl=z,this.rowResizerElement=null,this.rendererVersion=0,this.editorVersion=0,this.beans=$,this.gos=$.gos,this.column=z.column,this.rowNode=z.rowNode,this.eRow=J;let X=J0({tag:"div",role:z.getCellAriaRole(),attrs:{"comp-id":`${this.getCompId()}`,"col-id":z.column.colIdSanitised}});this.eCell=X;let Y;if(z.isCellSpanning())Y=J0({tag:"div",cls:"ag-spanned-cell-wrapper",role:"presentation"}),Y.appendChild(X),this.setTemplateFromElement(Y);else this.setTemplateFromElement(X);this.cellCssManager=new O7(()=>X),this.forceWrapper=z.isForceWrapper(),this.refreshWrapper(!1);let q={toggleCss:(G,_)=>this.cellCssManager.toggleCss(G,_),setUserStyles:(G)=>Z1(X,G),getFocusableElement:()=>X,setIncludeSelection:(G)=>this.includeSelection=G,setIncludeRowDrag:(G)=>this.includeRowDrag=G,setIncludeDndSource:(G)=>this.includeDndSource=G,setRowResizerElement:(G)=>this.setRowResizerElement(G),setRenderDetails:(G,_,H)=>this.setRenderDetails(G,_,H),setEditDetails:(G,_,H)=>this.setEditDetails(G,_,H),getCellEditor:()=>this.cellEditor||null,getCellRenderer:()=>this.cellRenderer||null,getParentOfValue:()=>this.getParentOfValue(),refreshEditStyles:(G,_)=>this.refreshEditStyles(G,_)};z.setComp(q,X,Y,this.eCellWrapper,Q,Z,void 0)}getParentOfValue(){return this.eCellValue??this.eCellWrapper??this.eCell}setRowResizerElement($){if(this.rowResizerElement)T0(this.rowResizerElement);if(this.rowResizerElement=$,$)this.eCell.appendChild($)}setRenderDetails($,z,Q){if(this.cellEditor&&!this.cellEditorPopupWrapper)return;this.firstRender=this.firstRender==null;let Z=this.refreshWrapper(!1);if(this.refreshEditStyles(!1),$){if(!(Q||Z?!1:this.refreshCellRenderer($)))this.destroyRenderer(),this.createCellRendererInstance($)}else this.destroyRenderer(),this.insertValueWithoutCellRenderer(z);if(this.rowDraggingComp?.refreshVisibility(),this.rowResizerElement&&!this.rowResizerElement.parentElement)this.eCell.appendChild(this.rowResizerElement)}setEditDetails($,z,Q){if($)this.createCellEditorInstance($,z,Q);else this.destroyEditor()}removeControls(){let $=this.beans.context;this.checkboxSelectionComp=$.destroyBean(this.checkboxSelectionComp),this.dndSourceComp=$.destroyBean(this.dndSourceComp),this.rowDraggingComp=$.destroyBean(this.rowDraggingComp)}refreshWrapper($){let z=this.includeRowDrag||this.includeDndSource||this.includeSelection,Q=z||this.forceWrapper,J=Q&&this.eCellWrapper==null;if(J)this.eCellWrapper=J0({tag:"div",cls:"ag-cell-wrapper",role:"presentation"}),this.eCell.appendChild(this.eCellWrapper);let Z=!Q&&this.eCellWrapper!=null;if(Z)T0(this.eCellWrapper),this.eCellWrapper=void 0;this.cellCssManager.toggleCss("ag-cell-value",!Q);let X=!$&&Q,Y=X&&this.eCellValue==null;if(Y){let _=this.cellCtrl.getCellValueClass();this.eCellValue=J0({tag:"span",cls:_,role:"presentation"}),this.eCellWrapper.appendChild(this.eCellValue)}let q=!X&&this.eCellValue!=null;if(q)T0(this.eCellValue),this.eCellValue=void 0;let G=J||Z||Y||q;if(G)this.removeControls();if(!$&&z)this.addControls();return G}addControls(){let{cellCtrl:$,eCellWrapper:z,eCellValue:Q,includeRowDrag:J,includeDndSource:Z,includeSelection:X}=this,Y=(q)=>{if(q)z.insertBefore(q.getGui(),Q)};if(J&&this.rowDraggingComp==null)this.rowDraggingComp=$.createRowDragComp(),Y(this.rowDraggingComp);if(Z&&this.dndSourceComp==null)this.dndSourceComp=$.createDndSource(),Y(this.dndSourceComp);if(X&&this.checkboxSelectionComp==null)this.checkboxSelectionComp=$.createSelectionCheckbox(),Y(this.checkboxSelectionComp)}createCellEditorInstance($,z,Q){let J=this.editorVersion,Z=$.newAgStackInstance(),{params:X}=$;if(Z.then((q)=>this.afterCellEditorCreated(J,q,X,z,Q)),n(this.cellEditor)&&X.cellStartedEdit)this.cellCtrl.focusCell(!0)}insertValueWithoutCellRenderer($){let z=this.getParentOfValue();z0(z);let Q=J1($);if(Q!=null)z.textContent=Q}destroyRenderer(){let{context:$}=this.beans;this.cellRenderer=$.destroyBean(this.cellRenderer),T0(this.cellRendererGui),this.cellRendererGui=null,this.rendererVersion++}destroyEditor(){let{context:$}=this.beans;if(this.cellEditorPopupWrapper?.getGui().contains(d(this.beans))||this.cellCtrl.hasBrowserFocus())this.eCell.focus({preventScroll:!0});this.hideEditorPopup?.(),this.hideEditorPopup=void 0,this.cellEditor=$.destroyBean(this.cellEditor),this.cellEditorPopupWrapper=$.destroyBean(this.cellEditorPopupWrapper),T0(this.cellEditorGui),this.cellCtrl.disableEditorTooltipFeature(),this.cellEditorGui=null,this.editorVersion++}refreshCellRenderer($){if(this.cellRenderer?.refresh==null)return!1;if(this.cellRendererClass!==$.componentClass)return!1;let z=this.cellRenderer.refresh($.params);return z===!0||z===void 0}createCellRendererInstance($){let z=this.rendererVersion,Q=(X)=>(Y)=>{if(this.rendererVersion!==z||!this.isAlive())return;let G=X.newAgStackInstance(),_=this.afterCellRendererCreated.bind(this,z,X.componentClass);G?.then(_)},{animationFrameSvc:J}=this.beans,Z;if(J?.active&&this.firstRender)Z=(X,Y=!1)=>{J.createTask(Q(X),this.rowNode.rowIndex,"p2",X.componentFromFramework,Y)};else Z=(X)=>Q(X)();if($.params?.deferRender&&!this.cellCtrl.rowNode.group){let{loadingComp:X,onReady:Y}=this.cellCtrl.getDeferLoadingCellRenderer();if(X)Z(X),Y.then(()=>Z($,!0))}else Z($)}afterCellRendererCreated($,z,Q){if(!this.isAlive()||$!==this.rendererVersion){this.beans.context.destroyBean(Q);return}this.cellRenderer=Q,this.cellRendererClass=z;let Z=Q.getGui();if(this.cellRendererGui=Z,Z!=null){let X=this.getParentOfValue();z0(X),X.appendChild(Z)}}afterCellEditorCreated($,z,Q,J,Z){let X=$!==this.editorVersion,{context:Y}=this.beans;if(X){Y.destroyBean(z);return}if(z.isCancelBeforeStart?.()){Y.destroyBean(z),this.cellCtrl.stopEditing(!0);return}if(!z.getGui){j(97,{colId:this.column.getId()}),Y.destroyBean(z);return}this.cellEditor=z,this.cellEditorGui=z.getGui();let G=J||z.isPopup?.();if(G)this.addPopupCellEditor(Q,Z);else this.addInCellEditor();this.refreshEditStyles(!0,G),z.afterGuiAttached?.(),this.cellCtrl.enableEditorTooltipFeature(z),this.cellCtrl.cellEditorAttached()}refreshEditStyles($,z){let{cellCssManager:Q}=this;Q.toggleCss("ag-cell-inline-editing",$&&!z),Q.toggleCss("ag-cell-popup-editing",$&&!!z),Q.toggleCss("ag-cell-not-inline-editing",!$||!!z)}addInCellEditor(){let{eCell:$}=this;if($.contains(d(this.beans)))$.focus();if(this.destroyRenderer(),this.refreshWrapper(!0),z0(this.getParentOfValue()),this.cellEditorGui)this.getParentOfValue().appendChild(this.cellEditorGui)}addPopupCellEditor($,z){let{gos:Q,context:J,popupSvc:Z,editSvc:X}=this.beans;if(Q.get("editType")==="fullRow")j(98);let Y=this.cellEditorPopupWrapper=J.createBean(X.createPopupEditorWrapper($)),{cellEditor:q,cellEditorGui:G,eCell:_,rowNode:H,column:U,cellCtrl:W}=this,B=Y.getGui();if(G)B.appendChild(G);let E=Q.get("stopEditingWhenCellsLoseFocus"),K=z!=null?z:q.getPopupPosition?.()??"over",L=Q.get("enableRtl"),D={ePopup:B,additionalParams:{column:U,rowNode:H},type:"popupCellEditor",eventSource:_,position:K,alignSide:L?"right":"left",keepWithinBounds:!0},F=Z.positionPopupByComponent.bind(Z,D),M=Z.addPopup({modal:E,eChild:B,closeOnEsc:!0,closedCallback:(k)=>{W.onPopupEditorClosed(k)},anchorToElement:_,positionCallback:F,ariaOwns:_});if(M)this.hideEditorPopup=M.hideFunc}detach(){this.getGui().remove()}destroy(){this.destroyRenderer(),this.destroyEditor(),this.removeControls(),super.destroy()}},zH=class extends x{constructor($,z,Q){super();this.cellComps=new Map,this.beans=z,this.rowCtrl=$;let J=J0({tag:"div",role:"row",attrs:{"comp-id":`${this.getCompId()}`}});this.setInitialStyle(J,Q),this.setTemplateFromElement(J);let Z=J.style;this.domOrder=this.rowCtrl.getDomOrder();let X={setDomOrder:(Y)=>this.domOrder=Y,setCellCtrls:(Y)=>this.setCellCtrls(Y),showFullWidth:(Y)=>this.showFullWidth(Y),getFullWidthCellRenderer:()=>this.fullWidthCellRenderer,getFullWidthCellRendererParams:()=>this.fullWidthCellRendererParams,toggleCss:(Y,q)=>this.toggleCss(Y,q),setUserStyles:(Y)=>Z1(J,Y),setTop:(Y)=>Z.top=Y,setTransform:(Y)=>Z.transform=Y,setRowIndex:(Y)=>J.setAttribute("row-index",Y),setRowId:(Y)=>J.setAttribute("row-id",Y),setRowBusinessKey:(Y)=>J.setAttribute("row-business-key",Y),refreshFullWidth:(Y)=>{let q=Y();return this.fullWidthCellRendererParams=q,this.fullWidthCellRenderer?.refresh?.(q)??!1}};$.setComp(X,this.getGui(),Q,void 0),this.addDestroyFunc(()=>{$.unsetComp(Q)})}setInitialStyle($,z){let Q=this.rowCtrl.getInitialTransform(z);if(Q)$.style.setProperty("transform",Q);else{let J=this.rowCtrl.getInitialRowTop(z);if(J)$.style.setProperty("top",J)}}showFullWidth($){let z=(J)=>{if(this.isAlive()){let Z=J.getGui();this.getGui().appendChild(Z),this.rowCtrl.setupDetailRowAutoHeight(Z),this.setFullWidthRowComp(J,$.params)}else this.beans.context.destroyBean(J)};$.newAgStackInstance().then(z)}setCellCtrls($){let z=new Map(this.cellComps);for(let Q of $){let J=Q.instanceId;if(!this.cellComps.has(J))this.newCellComp(Q);else z.delete(J)}this.destroyCells(z),this.ensureDomOrder($)}ensureDomOrder($){if(!this.domOrder)return;let z=[];for(let Q of $){let J=this.cellComps.get(Q.instanceId);if(J)z.push(J.getGui())}x6(this.getGui(),z)}newCellComp($){let z=this.beans.editSvc?.isEditing($,{withOpenEditor:!0})??!1,Q=new $H(this.beans,$,this.rowCtrl.printLayout,this.getGui(),z);this.cellComps.set($.instanceId,Q),this.getGui().appendChild(Q.getGui())}destroy(){super.destroy(),this.destroyCells(this.cellComps)}setFullWidthRowComp($,z){this.fullWidthCellRenderer=$,this.fullWidthCellRendererParams=z,this.addDestroyFunc(()=>{this.fullWidthCellRenderer=this.beans.context.destroyBean(this.fullWidthCellRenderer),this.fullWidthCellRendererParams=void 0})}destroyCells($){for(let z of $.values()){if(!z)continue;let Q=z.cellCtrl.instanceId;if(this.cellComps.get(Q)!==z)continue;z.detach(),z.destroy(),this.cellComps.delete(Q)}}};function QH($,z,Q){let J=!!Q.gos.get("enableCellSpan")&&!!z.getSpannedRowCtrls,Z={tag:"div",ref:"eContainer",cls:e7($),role:"rowgroup"};if(z.type==="center"||J){let X={tag:"div",ref:"eSpannedContainer",cls:`ag-spanning-container ${u_($)}`,role:"presentation"};return Z.role="presentation",{tag:"div",ref:"eViewport",cls:`ag-viewport ${o7($)}`,role:"rowgroup",children:[Z,J?X:null]}}return Z}var JH=class extends x{constructor($){super();this.eViewport=f,this.eContainer=f,this.eSpannedContainer=f,this.rowCompsNoSpan={},this.rowCompsWithSpan={},this.name=$?.name,this.options=K1(this.name)}postConstruct(){this.setTemplate(QH(this.name,this.options,this.beans));let $={setHorizontalScroll:(Q)=>this.eViewport.scrollLeft=Q,setViewportHeight:(Q)=>this.eViewport.style.height=Q,setRowCtrls:({rowCtrls:Q})=>this.setRowCtrls(Q),setSpannedRowCtrls:(Q)=>this.setRowCtrls(Q,!0),setDomOrder:(Q)=>{this.domOrder=Q},setContainerWidth:(Q)=>{if(this.eContainer.style.width=Q,this.eSpannedContainer)this.eSpannedContainer.style.width=Q},setOffsetTop:(Q)=>{let J=`translateY(${Q})`;if(this.eContainer.style.transform=J,this.eSpannedContainer)this.eSpannedContainer.style.transform=J}};this.createManagedBean(new l_(this.name)).setComp($,this.eContainer,this.eSpannedContainer,this.eViewport)}destroy(){this.setRowCtrls([]),this.setRowCtrls([],!0),super.destroy(),this.lastPlacedElement=null}setRowCtrls($,z){let{beans:Q,options:J}=this,Z=z?this.eSpannedContainer:this.eContainer,X=z?{...this.rowCompsWithSpan}:{...this.rowCompsNoSpan},Y={};if(z)this.rowCompsWithSpan=Y;else this.rowCompsNoSpan=Y;this.lastPlacedElement=null;let q=[];for(let G of $){let _=G.instanceId,H=X[_],U;if(H)U=H,delete X[_];else{if(!G.rowNode.displayed)continue;U=new zH(G,Q,J.type)}Y[_]=U,q.push([U,!H])}this.removeOldRows(Object.values(X)),this.addRowNodes(q,Z)}addRowNodes($,z){let{domOrder:Q}=this;for(let[J,Z]of $){let X=J.getGui();if(!Q){if(Z)z.appendChild(X)}else this.ensureDomOrder(X,z)}}removeOldRows($){for(let z of $)z.getGui().remove(),z.destroy()}ensureDomOrder($,z){y6(z,$,this.lastPlacedElement),this.lastPlacedElement=$}},ZH={selector:"AG-ROW-CONTAINER",component:JH};function CQ($,z){return z.map((Q)=>{let J=`e${Q[0].toUpperCase()+Q.substring(1)}RowContainer`;return $[J]={name:Q},{tag:"ag-row-container",ref:J,attrs:{name:Q}}})}function XH($){let z={},Q={tag:"div",ref:"eGridRoot",cls:"ag-root ag-unselectable",children:[{tag:"ag-header-root"},{tag:"div",ref:"eTop",cls:"ag-floating-top",role:"presentation",children:CQ(z,["topLeft","topCenter","topRight","topFullWidth"])},{tag:"div",ref:"eBody",cls:"ag-body",role:"presentation",children:[{tag:"div",ref:"eBodyViewport",cls:"ag-body-viewport",role:"presentation",children:CQ(z,["left","center","right","fullWidth"])},{tag:"ag-fake-vertical-scroll"}]},{tag:"div",ref:"eStickyTop",cls:"ag-sticky-top",role:"presentation",children:CQ(z,["stickyTopLeft","stickyTopCenter","stickyTopRight","stickyTopFullWidth"])},{tag:"div",ref:"eStickyBottom",cls:"ag-sticky-bottom",role:"presentation",children:CQ(z,["stickyBottomLeft","stickyBottomCenter","stickyBottomRight","stickyBottomFullWidth"])},{tag:"div",ref:"eBottom",cls:"ag-floating-bottom",role:"presentation",children:CQ(z,["bottomLeft","bottomCenter","bottomRight","bottomFullWidth"])},{tag:"ag-fake-horizontal-scroll"},$?{tag:"ag-overlay-wrapper"}:null]};return{paramsMap:z,elementParams:Q}}var YH=class extends x{constructor(){super(...arguments);this.eGridRoot=f,this.eBodyViewport=f,this.eStickyTop=f,this.eStickyBottom=f,this.eTop=f,this.eBottom=f,this.eBody=f}postConstruct(){let{overlays:$,rangeSvc:z}=this.beans,Q=$?.getOverlayWrapperSelector(),{paramsMap:J,elementParams:Z}=XH(!!Q);this.setTemplate(Z,[...Q?[Q]:[],O_,v_,R_,ZH],J);let X=(q,G)=>{let _=`${q}px`;G.style.minHeight=_,G.style.height=_},Y={setRowAnimationCssOnBodyViewport:(q,G)=>this.setRowAnimationCssOnBodyViewport(q,G),setColumnCount:(q)=>bY(this.getGui(),q),setRowCount:(q)=>CY(this.getGui(),q),setTopHeight:(q)=>X(q,this.eTop),setBottomHeight:(q)=>X(q,this.eBottom),setTopInvisible:(q)=>this.eTop.classList.toggle("ag-invisible",q),setBottomInvisible:(q)=>this.eBottom.classList.toggle("ag-invisible",q),setStickyTopHeight:(q)=>this.eStickyTop.style.height=q,setStickyTopTop:(q)=>this.eStickyTop.style.top=q,setStickyTopWidth:(q)=>this.eStickyTop.style.width=q,setStickyBottomHeight:(q)=>{this.eStickyBottom.style.height=q,this.eStickyBottom.classList.toggle("ag-invisible",q==="0px")},setStickyBottomBottom:(q)=>this.eStickyBottom.style.bottom=q,setStickyBottomWidth:(q)=>this.eStickyBottom.style.width=q,setColumnMovingCss:(q,G)=>this.toggleCss(q,G),updateLayoutClasses:(q,G)=>{let _=[this.eBodyViewport.classList,this.eBody.classList];for(let H of _)H.toggle(U$.AUTO_HEIGHT,G.autoHeight),H.toggle(U$.NORMAL,G.normal),H.toggle(U$.PRINT,G.print);this.toggleCss(U$.AUTO_HEIGHT,G.autoHeight),this.toggleCss(U$.NORMAL,G.normal),this.toggleCss(U$.PRINT,G.print)},setAlwaysVerticalScrollClass:(q,G)=>this.eBodyViewport.classList.toggle(Q8,G),registerBodyViewportResizeListener:(q)=>{let G=F$(this.beans,this.eBodyViewport,q);this.addDestroyFunc(()=>G())},setPinnedTopBottomOverflowY:(q)=>this.eTop.style.overflowY=this.eBottom.style.overflowY=q,setCellSelectableCss:(q,G)=>{for(let _ of[this.eTop,this.eBodyViewport,this.eBottom])_.classList.toggle(q,G)},setBodyViewportWidth:(q)=>this.eBodyViewport.style.width=q,setGridRootRole:(q)=>_0(this.eGridRoot,q)};if(this.ctrl=this.createManagedBean(new e_),this.ctrl.setComp(Y,this.getGui(),this.eBodyViewport,this.eTop,this.eBottom,this.eStickyTop,this.eStickyBottom),z&&u0(this.gos)||rQ(this.gos))IY(this.getGui(),!0)}setRowAnimationCssOnBodyViewport($,z){let Q=this.eBodyViewport.classList;Q.toggle("ag-row-animation",z),Q.toggle("ag-row-no-animation",!z)}getFocusableContainerName(){return"gridBody"}},qH={selector:"AG-GRID-BODY",component:YH},gQ={TAB_GUARD:"ag-tab-guard",TAB_GUARD_TOP:"ag-tab-guard-top",TAB_GUARD_BOTTOM:"ag-tab-guard-bottom"},GH=class extends R0{constructor($,z){super();this.stopPropagationCallbacks=z,this.skipTabGuardFocus=!1,this.forcingFocusOut=!1,this.allowFocus=!1;let{comp:Q,eTopGuard:J,eBottomGuard:Z,focusTrapActive:X,forceFocusOutWhenTabGuardsAreEmpty:Y,isFocusableContainer:q,focusInnerElement:G,onFocusIn:_,onFocusOut:H,shouldStopEventPropagation:U,onTabKeyDown:W,handleKeyDown:B,isEmpty:E,eFocusableElement:K}=$;this.comp=Q,this.eTopGuard=J,this.eBottomGuard=Z,this.providedFocusInnerElement=G,this.eFocusableElement=K,this.focusTrapActive=!!X,this.forceFocusOutWhenTabGuardsAreEmpty=!!Y,this.isFocusableContainer=!!q,this.providedFocusIn=_,this.providedFocusOut=H,this.providedShouldStopEventPropagation=U,this.providedOnTabKeyDown=W,this.providedHandleKeyDown=B,this.providedIsEmpty=E}postConstruct(){this.createManagedBean(new I7(this.eFocusableElement,this.stopPropagationCallbacks,{shouldStopEventPropagation:()=>this.shouldStopEventPropagation(),onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($),onFocusIn:($)=>this.onFocusIn($),onFocusOut:($)=>this.onFocusOut($)})),this.activateTabGuards();for(let $ of[this.eTopGuard,this.eBottomGuard])this.addManagedElementListeners($,{focus:this.onFocus.bind(this)})}handleKeyDown($){if(this.providedHandleKeyDown)this.providedHandleKeyDown($)}tabGuardsAreActive(){return!!this.eTopGuard&&this.eTopGuard.hasAttribute("tabIndex")}shouldStopEventPropagation(){if(this.providedShouldStopEventPropagation)return this.providedShouldStopEventPropagation();return!1}activateTabGuards(){if(this.forcingFocusOut)return;let $=this.gos.get("tabIndex");this.comp.setTabIndex($.toString())}deactivateTabGuards(){this.comp.setTabIndex()}onFocus($){if(this.isFocusableContainer&&!this.eFocusableElement.contains($.relatedTarget)){if(!this.allowFocus){this.findNextElementOutsideAndFocus($.target===this.eBottomGuard);return}}if(this.skipTabGuardFocus){this.skipTabGuardFocus=!1;return}if(this.forceFocusOutWhenTabGuardsAreEmpty){if(this.providedIsEmpty?this.providedIsEmpty():E$(this.eFocusableElement,".ag-tab-guard").length===0){this.findNextElementOutsideAndFocus($.target===this.eBottomGuard);return}}if(this.isFocusableContainer&&this.eFocusableElement.contains($.relatedTarget))return;let z=$.target===this.eBottomGuard;if(!(this.providedFocusInnerElement?this.providedFocusInnerElement(z):this.focusInnerElement(z))&&this.forceFocusOutWhenTabGuardsAreEmpty)this.findNextElementOutsideAndFocus($.target===this.eBottomGuard)}findNextElementOutsideAndFocus($){let z=Y0(this.beans),Q=E$(z.body,null,!0),J=Q.indexOf($?this.eTopGuard:this.eBottomGuard);if(J===-1)return;let Z,X;if($)Z=0,X=J;else Z=J+1,X=Q.length;let Y=Q.slice(Z,X),q=this.gos.get("tabIndex");Y.sort((G,_)=>{let H=Number.parseInt(G.getAttribute("tabindex")||"0"),U=Number.parseInt(_.getAttribute("tabindex")||"0");if(U===q)return 1;if(H===q)return-1;if(H===0)return 1;if(U===0)return-1;return H-U}),Y[$?Y.length-1:0]?.focus()}onFocusIn($){if(this.focusTrapActive||this.forcingFocusOut)return;if(this.providedFocusIn)this.providedFocusIn($);if(!this.isFocusableContainer)this.deactivateTabGuards()}onFocusOut($){if(this.focusTrapActive)return;if(this.providedFocusOut)this.providedFocusOut($);if(!this.eFocusableElement.contains($.relatedTarget))this.activateTabGuards()}onTabKeyDown($){if(this.providedOnTabKeyDown){this.providedOnTabKeyDown($);return}if(this.focusTrapActive)return;if($.defaultPrevented)return;let z=this.tabGuardsAreActive();if(z)this.deactivateTabGuards();let Q=this.getNextFocusableElement($.shiftKey);if(z)setTimeout(()=>this.activateTabGuards(),0);if(!Q)return;Q.focus(),$.preventDefault()}focusInnerElement($=!1){let z=E$(this.eFocusableElement);if(this.tabGuardsAreActive())z.splice(0,1),z.splice(-1,1);if(!z.length)return!1;return z[$?z.length-1:0].focus({preventScroll:!0}),!0}getNextFocusableElement($){return j0(this.beans,this.eFocusableElement,!1,$)}forceFocusOutOfContainer($=!1){if(this.forcingFocusOut)return;let z=$?this.eTopGuard:this.eBottomGuard;this.activateTabGuards(),this.skipTabGuardFocus=!0,this.forcingFocusOut=!0,z.focus(),window.setTimeout(()=>{this.forcingFocusOut=!1,this.activateTabGuards()})}isTabGuard($,z){return $===this.eTopGuard&&!z||$===this.eBottomGuard&&(z??!0)}setAllowFocus($){this.allowFocus=$}},q4=class extends R0{constructor($,z){super();this.comp=$,this.stopPropagationCallbacks=z}initialiseTabGuard($){this.eTopGuard=this.createTabGuard("top"),this.eBottomGuard=this.createTabGuard("bottom"),this.eFocusableElement=this.comp.getFocusableElement();let{eTopGuard:z,eBottomGuard:Q,eFocusableElement:J,stopPropagationCallbacks:Z}=this,X=[z,Q],Y={setTabIndex:(D)=>{for(let F of X)if(D==null)F.removeAttribute("tabindex");else F.setAttribute("tabindex",D)}};this.addTabGuards(z,Q);let{focusTrapActive:q=!1,onFocusIn:G,onFocusOut:_,focusInnerElement:H,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L}=$;this.tabGuardCtrl=this.createManagedBean(new GH({comp:Y,focusTrapActive:q,eTopGuard:z,eBottomGuard:Q,eFocusableElement:J,onFocusIn:G,onFocusOut:_,focusInnerElement:H,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L},Z))}getTabGuardCtrl(){return this.tabGuardCtrl}createTabGuard($){let z=Y0(this.beans).createElement("div"),Q=$==="top"?gQ.TAB_GUARD_TOP:gQ.TAB_GUARD_BOTTOM;return z.classList.add(gQ.TAB_GUARD,Q),_0(z,"presentation"),z}addTabGuards($,z){let Q=this.eFocusableElement;Q.prepend($),Q.append(z)}removeAllChildrenExceptTabGuards(){let $=[this.eTopGuard,this.eBottomGuard];z0(this.comp.getFocusableElement()),this.addTabGuards(...$)}forceFocusOutOfContainer($=!1){this.tabGuardCtrl.forceFocusOutOfContainer($)}appendChild($,z,Q){if(!X1(z))z=z.getGui();let{eBottomGuard:J}=this;if(J)J.before(z);else $(z,Q)}destroy(){let{eTopGuard:$,eBottomGuard:z}=this;T0($),T0(z),super.destroy()}},p$=class extends p0{initialiseTabGuard($,z){this.tabGuardFeature=this.createManagedBean(new q4(this,z)),this.tabGuardFeature.initialiseTabGuard($)}forceFocusOutOfContainer($=!1){this.tabGuardFeature.forceFocusOutOfContainer($)}appendChild($,z){this.tabGuardFeature.appendChild(super.appendChild.bind(this),$,z)}},G4=class extends p${initialiseTabGuard($){super.initialiseTabGuard($,Uz)}},A5=($,z)=>{return N7($,()=>F0($.getGui(),z,!1,!0))},S5=($)=>{return $?.getFocusableContainerName()??"external"},_H=($)=>{if($==null)return"external";return typeof $==="string"?$:"gridBody"},HH=class extends S{constructor(){super(...arguments);this.additionalFocusableContainers=new Set}setComp($,z,Q){this.view=$,this.eGridHostDiv=z,this.eGui=Q,this.eGui.setAttribute("grid-id",this.beans.context.getId());let{dragAndDrop:J,ctrlsSvc:Z}=this.beans;J?.registerGridDropTarget(()=>this.eGui,this),this.createManagedBean(new X4(this.view)),this.view.setRtlClass(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let X=F$(this.beans,this.eGridHostDiv,this.onGridSizeChanged.bind(this));this.addDestroyFunc(()=>X()),Z.register("gridCtrl",this)}isDetailGrid(){return yJ(this.getGui())?.getAttribute("row-id")?.startsWith("detail")||!1}getOptionalSelectors(){let $=this.beans;return{paginationSelector:$.pagination?.getPaginationSelector(),gridHeaderDropZonesSelector:$.registry?.getSelector("AG-GRID-HEADER-DROP-ZONES"),sideBarSelector:$.sideBar?.getSelector(),statusBarSelector:$.registry?.getSelector("AG-STATUS-BAR"),watermarkSelector:$.licenseManager?.getWatermarkSelector()}}onGridSizeChanged(){this.eventSvc.dispatchEvent({type:"gridSizeChanged",clientWidth:this.eGridHostDiv.clientWidth,clientHeight:this.eGridHostDiv.clientHeight})}destroyGridUi(){this.view.destroyGridUi()}getGui(){return this.eGui}setResizeCursor($){let{view:z}=this;if($===!1)z.setCursor(null);else z.setCursor($===1?"ew-resize":"ns-resize")}disableUserSelect($){this.view.setUserSelect($?"none":null)}focusNextInnerContainer($){let z=this.getFocusableContainers(),{indexWithFocus:Q,nextIndex:J}=this.getNextFocusableIndex(z,$),Z=Q===-1?$?z.length-1:0:J,{gos:X,beans:{focusSvc:Y,navigation:q}}=this,G=X.getCallback("tabToNextGridContainer");if(G){let _=Y.getDefaultTabToNextGridContainerTarget({backwards:$,focusableContainers:z,nextIndex:Z}),H=S5(z[Z]),U=_==null&&H==="gridBody"?"gridBody":_H(_),W=G({backwards:$,previousContainer:S5(z[Q]),nextContainer:U,defaultTarget:_});if(W!==void 0){if(typeof W==="boolean")return W;if(typeof W==="string"){if(W==="gridBody")return this.focusGridBodyDefault($)||void 0;let B=z.find((E)=>E.getFocusableContainerName()===W);if(!B){c6(`tabToNextGridContainer - ${W} container not found`);return}return A5(B,$)?!0:void 0}if(J_(W))return Y.focusHeaderPosition({headerPosition:W})||void 0;return q?.ensureCellVisible(W),Y.setFocusedCell({...W,forceBrowserFocus:!0}),Y.isCellFocused(W)||void 0}}return this.focusNextInnerContainerDefault({backwards:$,focusableContainers:z,indexWithFocus:Q,nextIndex:Z})||void 0}focusInnerElement($){let{gos:z,beans:Q,beans:{focusSvc:J,visibleCols:Z}}=this;if(z.getCallback("focusGridInnerElement")?.({fromBottom:!!$}))return!0;let Y=this.getFocusableContainers();if($){if(this.focusNextInnerContainerDefault({backwards:!0,focusableContainers:Y,indexWithFocus:Y.length,nextIndex:Y.length-1}))return!0;return J.focusGridView({column:b(Z.allCols),backwards:!0})}let q=Z.allCols;if(z.get("headerHeight")===0||H$(Q)){if(J.focusGridView({column:q[0],backwards:$}))return!0;for(let G=1;GZ.getGui().contains(Q));return{indexWithFocus:J,nextIndex:J+(z?-1:1)}}focusGridBodyDefault($){let{gos:z,beans:Q,beans:{focusSvc:J,visibleCols:{allCols:Z}}}=this;if($)return J.focusGridView({column:b(Z),backwards:!0});if(z.get("headerHeight")===0||H$(Q))return J.focusGridView({column:Z[0]});return J.focusFirstHeader()}focusNextInnerContainerDefault($){let{backwards:z,focusableContainers:Q,indexWithFocus:J}=$,Z=z?-1:1;for(let X=$.nextIndex;X>=0&&XX:Jthis.destroyBean(this),setRtlClass:(X)=>this.addCss(X),forceFocusOutOfContainer:this.forceFocusOutOfContainer.bind(this),updateLayoutClasses:this.updateLayoutClasses.bind(this),getFocusableContainers:this.getFocusableContainers.bind(this),setUserSelect:(X)=>{this.getGui().style.userSelect=X!=null?X:"",this.getGui().style.webkitUserSelect=X!=null?X:""},setCursor:(X)=>{this.getGui().style.cursor=X!=null?X:""}},z=this.createManagedBean(new HH),Q=z.getOptionalSelectors(),J=this.createTemplate(Q),Z=[qH,...Object.values(Q).filter((X)=>!!X)];this.setTemplate(J,Z),z.setComp($,this.eGridDiv,this.getGui()),this.insertGridIntoDom(),this.initialiseTabGuard({onTabKeyDown:()=>{return},focusInnerElement:(X)=>z.focusInnerElement(X),forceFocusOutWhenTabGuardsAreEmpty:!0,isEmpty:()=>!z.isFocusable()})}insertGridIntoDom(){let $=this.getGui();this.eGridDiv.appendChild($),this.addDestroyFunc(()=>{$.remove(),dQ(this.gos,"Grid removed from DOM")})}updateLayoutClasses($,z){let Q=this.rootWrapperBody.classList,{AUTO_HEIGHT:J,NORMAL:Z,PRINT:X}=U$,{autoHeight:Y,normal:q,print:G}=z;Q.toggle(J,Y),Q.toggle(Z,q),Q.toggle(X,G),this.toggleCss(J,Y),this.toggleCss(Z,q),this.toggleCss(X,G)}createTemplate($){let z=$.gridHeaderDropZonesSelector?{tag:"ag-grid-header-drop-zones",ref:"gridHeaderDropZones"}:null,Q=$.sideBarSelector?{tag:"ag-side-bar",ref:"sideBar"}:null,J=$.statusBarSelector?{tag:"ag-status-bar",ref:"statusBar"}:null,Z=$.watermarkSelector?{tag:"ag-watermark"}:null,X=$.paginationSelector?{tag:"ag-pagination",ref:"pagination"}:null;return{tag:"div",cls:"ag-root-wrapper",role:"presentation",children:[z,{tag:"div",ref:"rootWrapperBody",cls:"ag-root-wrapper-body",role:"presentation",children:[{tag:"ag-grid-body",ref:"gridBody"},Q]},J,X,Z]}}getFocusableElement(){return this.rootWrapperBody}forceFocusOutOfContainer($=!1){if(!$&&this.pagination?.isDisplayed()){this.pagination.forceFocusOutOfContainer($);return}super.forceFocusOutOfContainer($)}getFocusableContainers(){let $=[...this.gridHeaderDropZones?.getFocusableContainers?.()??[],this.gridBody];for(let z of[this.sideBar,this.statusBar,this.pagination])if(z)$.push(z);return $.filter((z)=>A0(z.getGui()))}},c=($,z)=>{for(let Q of Object.keys(z))z[Q]=$;return z},R5={dispatchEvent:"CommunityCore",...c("CommunityCore",{destroy:0,getGridId:0,getGridOption:0,isDestroyed:0,setGridOption:0,updateGridOptions:0,isModuleRegistered:0}),...c("GridState",{getState:0,setState:0}),...c("SharedRowSelection",{setNodesSelected:0,selectAll:0,deselectAll:0,selectAllFiltered:0,deselectAllFiltered:0,selectAllOnCurrentPage:0,deselectAllOnCurrentPage:0,getSelectedNodes:0,getSelectedRows:0}),...c("RowApi",{redrawRows:0,setRowNodeExpanded:0,getRowNode:0,addRenderedRowListener:0,getRenderedNodes:0,forEachNode:0,getFirstDisplayedRowIndex:0,getLastDisplayedRowIndex:0,getDisplayedRowAtIndex:0,getDisplayedRowCount:0}),...c("ScrollApi",{getVerticalPixelRange:0,getHorizontalPixelRange:0,ensureColumnVisible:0,ensureIndexVisible:0,ensureNodeVisible:0}),...c("KeyboardNavigation",{getFocusedCell:0,clearFocusedCell:0,setFocusedCell:0,tabToNextCell:0,tabToPreviousCell:0,setFocusedHeader:0}),...c("EventApi",{addEventListener:0,addGlobalListener:0,removeEventListener:0,removeGlobalListener:0}),...c("ValueCache",{expireValueCache:0}),...c("CellApi",{getCellValue:0}),...c("SharedMenu",{showColumnMenu:0,hidePopupMenu:0}),...c("Sort",{onSortChanged:0}),...c("PinnedRow",{getPinnedTopRowCount:0,getPinnedBottomRowCount:0,getPinnedTopRow:0,getPinnedBottomRow:0,forEachPinnedRow:0}),...c("Overlay",{showLoadingOverlay:0,showNoRowsOverlay:0,hideOverlay:0}),...c("RenderApi",{setGridAriaProperty:0,refreshCells:0,refreshHeader:0,isAnimationFrameQueueEmpty:0,flushAllAnimationFrames:0,getSizesForCurrentTheme:0,getCellRendererInstances:0}),...c("HighlightChanges",{flashCells:0}),...c("RowDrag",{addRowDropZone:0,removeRowDropZone:0,getRowDropZoneParams:0,getRowDropPositionIndicator:0,setRowDropPositionIndicator:0}),...c("ColumnApi",{getColumnDefs:0,getColumnDef:0,getDisplayNameForColumn:0,getColumn:0,getColumns:0,applyColumnState:0,getColumnState:0,resetColumnState:0,isPinning:0,isPinningLeft:0,isPinningRight:0,getDisplayedColAfter:0,getDisplayedColBefore:0,setColumnsVisible:0,setColumnsPinned:0,getAllGridColumns:0,getDisplayedLeftColumns:0,getDisplayedCenterColumns:0,getDisplayedRightColumns:0,getAllDisplayedColumns:0,getAllDisplayedVirtualColumns:0}),...c("ColumnAutoSize",{sizeColumnsToFit:0,autoSizeColumns:0,autoSizeAllColumns:0}),...c("ColumnGroup",{setColumnGroupOpened:0,getColumnGroup:0,getProvidedColumnGroup:0,getDisplayNameForColumnGroup:0,getColumnGroupState:0,setColumnGroupState:0,resetColumnGroupState:0,getLeftDisplayedColumnGroups:0,getCenterDisplayedColumnGroups:0,getRightDisplayedColumnGroups:0,getAllDisplayedColumnGroups:0}),...c("ColumnMove",{moveColumnByIndex:0,moveColumns:0}),...c("ColumnResize",{setColumnWidths:0}),...c("ColumnHover",{isColumnHovered:0}),...c("EditCore",{getCellEditorInstances:0,getEditingCells:0,getEditRowValues:0,stopEditing:0,startEditingCell:0,isEditing:0,validateEdit:0}),...c("BatchEdit",{startBatchEdit:0,cancelBatchEdit:0,commitBatchEdit:0,isBatchEditing:0}),...c("UndoRedoEdit",{undoCellEditing:0,redoCellEditing:0,getCurrentUndoSize:0,getCurrentRedoSize:0}),...c("FilterCore",{isAnyFilterPresent:0,onFilterChanged:0}),...c("ColumnFilter",{isColumnFilterPresent:0,getColumnFilterInstance:0,destroyFilter:0,setFilterModel:0,getFilterModel:0,getColumnFilterModel:0,setColumnFilterModel:0,showColumnFilter:0,hideColumnFilter:0,getColumnFilterHandler:0,doFilterAction:0}),...c("QuickFilter",{isQuickFilterPresent:0,getQuickFilter:0,resetQuickFilter:0}),...c("Find",{findGetActiveMatch:0,findGetTotalMatches:0,findGoTo:0,findNext:0,findPrevious:0,findGetNumMatches:0,findGetParts:0,findClearActive:0,findRefresh:0}),...c("Pagination",{paginationIsLastPageFound:0,paginationGetPageSize:0,paginationGetCurrentPage:0,paginationGetTotalPages:0,paginationGetRowCount:0,paginationGoToNextPage:0,paginationGoToPreviousPage:0,paginationGoToFirstPage:0,paginationGoToLastPage:0,paginationGoToPage:0}),...c("CsrmSsrmSharedApi",{expandAll:0,collapseAll:0,resetRowGroupExpansion:0}),...c("SsrmInfiniteSharedApi",{setRowCount:0,getCacheBlockState:0,isLastRowIndexKnown:0}),...c("ClientSideRowModelApi",{onGroupExpandedOrCollapsed:0,refreshClientSideRowModel:0,isRowDataEmpty:0,forEachLeafNode:0,forEachNodeAfterFilter:0,forEachNodeAfterFilterAndSort:0,applyTransaction:0,applyTransactionAsync:0,flushAsyncTransactions:0,getBestCostNodeSelection:0,onRowHeightChanged:0,resetRowHeights:0}),...c("CsvExport",{getDataAsCsv:0,exportDataAsCsv:0}),...c("InfiniteRowModel",{refreshInfiniteCache:0,purgeInfiniteCache:0,getInfiniteRowCount:0}),...c("AdvancedFilter",{getAdvancedFilterModel:0,setAdvancedFilterModel:0,showAdvancedFilterBuilder:0,hideAdvancedFilterBuilder:0}),...c("IntegratedCharts",{getChartModels:0,getChartRef:0,getChartImageDataURL:0,downloadChart:0,openChartToolPanel:0,closeChartToolPanel:0,createRangeChart:0,createPivotChart:0,createCrossFilterChart:0,updateChart:0,restoreChart:0}),...c("Clipboard",{copyToClipboard:0,cutToClipboard:0,copySelectedRowsToClipboard:0,copySelectedRangeToClipboard:0,copySelectedRangeDown:0,pasteFromClipboard:0}),...c("ExcelExport",{getDataAsExcel:0,exportDataAsExcel:0,getSheetDataForExcel:0,getMultipleSheetsAsExcel:0,exportMultipleSheetsAsExcel:0}),...c("SharedMasterDetail",{addDetailGridInfo:0,removeDetailGridInfo:0,getDetailGridInfo:0,forEachDetailGridInfo:0}),...c("ContextMenu",{showContextMenu:0}),...c("ColumnMenu",{showColumnChooser:0,hideColumnChooser:0}),...c("CellSelection",{getCellRanges:0,addCellRange:0,clearRangeSelection:0,clearCellSelection:0}),...c("SharedRowGrouping",{setRowGroupColumns:0,removeRowGroupColumns:0,addRowGroupColumns:0,getRowGroupColumns:0,moveRowGroupColumn:0}),...c("SharedAggregation",{addAggFuncs:0,clearAggFuncs:0,setColumnAggFunc:0}),...c("SharedPivot",{isPivotMode:0,getPivotResultColumn:0,setValueColumns:0,getValueColumns:0,removeValueColumns:0,addValueColumns:0,setPivotColumns:0,removePivotColumns:0,addPivotColumns:0,getPivotColumns:0,setPivotResultColumns:0,getPivotResultColumns:0}),...c("ServerSideRowModelApi",{getServerSideSelectionState:0,setServerSideSelectionState:0,applyServerSideTransaction:0,applyServerSideTransactionAsync:0,applyServerSideRowData:0,retryServerSideLoads:0,flushServerSideAsyncTransactions:0,refreshServerSide:0,getServerSideGroupLevelState:0,onRowHeightChanged:0,resetRowHeights:0}),...c("SideBar",{isSideBarVisible:0,setSideBarVisible:0,setSideBarPosition:0,openToolPanel:0,closeToolPanel:0,getOpenedToolPanel:0,refreshToolPanel:0,isToolPanelShowing:0,getToolPanelInstance:0,getSideBar:0}),...c("StatusBar",{getStatusPanel:0}),...c("AiToolkit",{getStructuredSchema:0})},NZ={isDestroyed:()=>!0,destroy(){},preConstruct(){},postConstruct(){},preWireBeans(){},wireBeans(){}},WH=($,z)=>$.eventSvc.dispatchEvent(z),J8=class{};Reflect.defineProperty(J8,"name",{value:"GridApi"});var BH=class extends S{constructor(){super();this.beanName="apiFunctionSvc",this.api=new J8,this.fns={...NZ,dispatchEvent:WH},this.preDestroyLink="";let{api:$}=this;for(let z of Object.keys(R5))$[z]=this.makeApi(z)[z]}postConstruct(){this.preDestroyLink=this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed")}addFunction($,z){let{fns:Q,beans:J}=this;if(Q!==NZ)Q[$]=J?.validation?.validateApiFunction($,z)??z}makeApi($){return{[$]:(...z)=>{let{beans:Q,fns:{[$]:J}}=this;return J?J(Q,...z):this.apiNotFound($)}}}apiNotFound($){let{beans:z,gos:Q,preDestroyLink:J}=this;if(!z)j(26,{fnName:$,preDestroyLink:J});else{let Z=R5[$];if(Q.assertModuleRegistered(Z,`api.${$}`))j(27,{fnName:$,module:Z})}}destroy(){super.destroy(),this.fns=NZ,this.beans=null}};function EH($){return $.context.getId()}function KH($){$.gridDestroySvc.destroy()}function LH($){return $.gridDestroySvc.destroyCalled}function DH($,z){return $.gos.get(z)}function FH($,z,Q){Z8($,{[z]:Q})}function Z8($,z){$.gos.updateGridOptions({options:z})}function MH($,z){let Q=z.replace(/Module$/,"");return $.gos.isModuleRegistered(Q)}function hJ($,z,Q){let J=h($,z,Q);if(J){let{className:X}=J;if(typeof X==="string"&&X.includes("ag-icon")||typeof X==="object"&&X["ag-icon"])return J}let Z=J0({tag:"span"});return Z.appendChild(J),Z}function h($,z,Q){let J=null;if($==="smallDown")j(262);else if($==="smallLeft")j(263);else if($==="smallRight")j(264);let Z=Q?.getColDef().icons;if(Z)J=Z[$];if(z.gos&&!J){let X=z.gos.get("icons");if(X)J=X[$]}if(J){let X;if(typeof J==="function")X=J();else if(typeof J==="string")X=J;else{j(38,{iconName:$});return}if(typeof X==="string")return T2(X);if(X1(X))return X;j(133,{iconName:$});return}else{let X=z.registry.getIcon($);if(!X)z.validation?.validateIcon($);return J0({tag:"span",cls:`ag-icon ag-icon-${X??$}`,role:"presentation",attrs:{unselectable:"on"}})}}var kH=".ag-dnd-ghost{align-items:center;background-color:var(--ag-drag-and-drop-image-background-color);border:var(--ag-drag-and-drop-image-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-drag-and-drop-image-shadow);color:var(--ag-text-color);cursor:move;display:flex;font-weight:500;gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:hidden;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding);text-overflow:ellipsis;transform:translateY(calc(var(--ag-spacing)*2));white-space:nowrap}.ag-dnd-ghost-not-allowed{border:var(--ag-drag-and-drop-image-not-allowed-border)}",VH={tag:"div",children:[{tag:"div",ref:"eGhost",cls:"ag-dnd-ghost ag-unselectable",children:[{tag:"span",ref:"eIcon",cls:"ag-dnd-ghost-icon ag-shake-left-to-right"},{tag:"div",ref:"eLabel",cls:"ag-dnd-ghost-label"}]}]},AH=class extends x{constructor(){super();this.dragSource=null,this.eIcon=f,this.eLabel=f,this.eGhost=f,this.registerCSS(kH)}postConstruct(){let $=(z)=>hJ(z,this.beans,null);this.dropIconMap={pinned:$("columnMovePin"),hide:$("columnMoveHide"),move:$("columnMoveMove"),left:$("columnMoveLeft"),right:$("columnMoveRight"),group:$("columnMoveGroup"),aggregate:$("columnMoveValue"),pivot:$("columnMovePivot"),notAllowed:$("dropNotAllowed")}}init($){this.dragSource=$.dragSource,this.setTemplate(VH),this.beans.environment.applyThemeClasses(this.eGhost)}destroy(){this.dragSource=null,super.destroy()}setIcon($,z){let{eGhost:Q,eIcon:J,dragSource:Z,dropIconMap:X,gos:Y}=this;z0(J);let q=null;if(!$)$=Z?.getDefaultIconName?Z.getDefaultIconName():"notAllowed";if(q=X[$],Q.classList.toggle("ag-dnd-ghost-not-allowed",$==="notAllowed"),J.classList.toggle("ag-shake-left-to-right",z),q===X.hide&&Y.get("suppressDragLeaveHidesColumns"))return;if(q)J.appendChild(q)}setLabel($){this.eLabel.textContent=$}};var X8=($,z)=>{if(z!=null&&$?.setPointerCapture)try{return $.setPointerCapture(z),$.hasPointerCapture(z)}catch{}return!1},SH=($,z)=>{if(typeof PointerEvent>"u"||!(z instanceof PointerEvent))return null;let Q=z.pointerId;if(!X8($,Q))return null;let J={eElement:$,pointerId:Q,onLost(Z){jH(J,Z)}};return $.addEventListener("lostpointercapture",J.onLost),J},RH=($)=>{if(!$)return;Y8($);let{eElement:z,pointerId:Q}=$;if(!z)return;try{z.releasePointerCapture(Q)}catch{}$.eElement=null},Y8=($)=>{let{eElement:z,onLost:Q}=$;if(z&&Q)z.removeEventListener("lostpointercapture",Q),$.onLost=null},jH=($,z)=>{Y8($);let{eElement:Q,pointerId:J}=$;if(Q&&z.pointerId===J)X8(Q,J)},ez,JQ,gZ={passive:!0},r$={passive:!1},k$=($)=>{if(!JQ)JQ=new WeakSet;else if(JQ.has($))return!1;return JQ.add($),!0},fH=class extends R0{constructor(){super(...arguments);this.beanName="dragSvc",this.dragging=!1,this.drag=null,this.dragSources=[]}get startTarget(){return this.drag?.start.target??null}isPointer(){return!!ez?.has(r0(this.beans))}hasPointerCapture(){let $=this.drag?.pointerCapture;return!!($&&this.beans.eRootDiv.hasPointerCapture?.($.pointerId))}destroy(){if(this.drag)this.cancelDrag();let $=this.dragSources;for(let z of $)j5(z);$.length=0,super.destroy()}removeDragSource($){let z=this.dragSources;for(let Q=0,J=z.length;Qthis.onPointerDown($,_),r$],[z,"mousedown",(_)=>this.onMouseDown($,_)]);let G=this.gos.get("suppressTouch");if(Q&&!G)c1(J,[z,"touchstart",(H)=>this.onTouchStart($,H),r$])}cancelDrag($){let z=this.drag;if($??($=z?.eElement),$)this.eventSvc.dispatchEvent({type:"dragCancelled",target:$});z?.params.onDragCancel?.(),this.destroyDrag()}shouldPreventMouseEvent($){let z=$.type;return(z==="mousemove"||z==="pointermove")&&$.cancelable&&nQ(this.beans,$)&&!wQ(uZ($))}initDrag($,...z){this.drag=$;let Q=this.beans,J=(q)=>this.onScroll(q),Z=(q)=>this.onKeyDown(q),X=r0(Q),Y=Y0(Q);c1($.handlers,[X,"contextmenu",QQ],[X,"keydown",Z],[Y,"scroll",J,{capture:!0}],[Y.defaultView||window,"scroll",J],...z)}destroyDrag(){this.dragging=!1;let $=this.drag;if($){let z=$.rootEl;if(ez?.get(z)===$)ez.delete(z);this.drag=null,RH($.pointerCapture),v2($.handlers)}}onPointerDown($,z){if(this.isPointer())return;let Q=this.beans;if(JQ?.has(z))return;let J=z.pointerType;if(J==="touch"){if(Q.gos.get("suppressTouch")||!$.includeTouch)return;if($.stopPropagationForTouch)z.stopPropagation();if(wQ(uZ(z)))return}if(!z.isPrimary)return;if(J==="mouse"&&z.button!==0)return;this.destroyDrag();let Z=r0(Q),X=$.eElement,Y=z.pointerId,q=new hZ(Z,$,z,Y);ez??(ez=new WeakMap),ez.set(Z,q);let G=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerMove(W)},_=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerUp(W)},H=(W)=>{if(W.pointerId===Y&&k$(W))this.cancelDrag()},U=(W)=>this.draggingPreventDefault(W);if(this.initDrag(q,[Z,"pointerup",_],[Z,"pointercancel",H],[Z,"pointermove",G,r$],[Z,"touchmove",U,r$],[X,"mousemove",U,r$]),$.dragStartPixels===0)this.onMouseOrPointerMove(z);else k$(z)}onTouchStart($,z){if(this.gos.get("suppressTouch")||!$.includeTouch)return;if(!k$(z))return;if(wQ(uZ(z)))return;if($.stopPropagationForTouch)z.stopPropagation();if(this.isPointer()){if(this.dragging)QQ(z);return}this.destroyDrag();let J=this.beans,Z=r0(J),X=new hZ(Z,$,z.touches[0]),Y=(W)=>this.onTouchMove(W),q=(W)=>this.onTouchUp(W),G=(W)=>this.onTouchCancel(W),_=(W)=>this.draggingPreventDefault(W),H=r0(J),U=z.target??$.eElement;if(this.initDrag(X,[U,"touchmove",Y,gZ],[U,"touchend",q,gZ],[U,"touchcancel",G,gZ],[H,"touchmove",_,r$],[H,"touchend",q,r$],[H,"touchcancel",G,r$]),$.dragStartPixels===0)this.onMove(X.start)}draggingPreventDefault($){if(this.dragging)QQ($)}onMouseDown($,z){if(z.button!==0)return;if(JQ?.has(z))return;if(this.isPointer())return;let Q=this.beans;this.destroyDrag();let J=new hZ(r0(Q),$,z),Z=(q)=>this.onMouseOrPointerMove(q),X=(q)=>this.onMouseOrPointerUp(q),Y=r0(Q);if(this.initDrag(J,[Y,"mousemove",Z],[Y,"mouseup",X]),$.dragStartPixels===0)this.onMouseOrPointerMove(z);else k$(z)}onScroll($){if(!k$($))return;let z=this.drag,Q=z?.lastDrag;if(Q&&this.dragging)z.params?.onDragging?.(Q)}onMouseOrPointerMove($){if(!k$($))return;if(cz())Y0(this.beans).getSelection()?.removeAllRanges();if(this.shouldPreventMouseEvent($))QQ($);this.onMove($)}onTouchCancel($){let z=this.drag;if(!z||!k$($))return;if(!qQ(z.start,$.changedTouches))return;this.cancelDrag()}onTouchMove($){let z=this.drag;if(!z||!k$($))return;let Q=qQ(z.start,$.touches);if(Q)this.onMove(Q),this.draggingPreventDefault($)}onMove($){let z=this.drag;if(!z)return;z.lastDrag=$;let Q=z.params;if(!this.dragging){let J=z.start,X=Q.dragStartPixels??4;if(h6($,J,X))return;if(this.dragging=!0,Q.capturePointer)z.pointerCapture=SH(this.beans.eRootDiv,$);if(this.eventSvc.dispatchEvent({type:"dragStarted",target:Q.eElement}),Q.onDragStart?.(J),this.drag!==z)return;if(Q.onDragging?.(J),this.drag!==z)return}Q.onDragging?.($)}onTouchUp($){let z=this.drag;if(z&&k$($))this.onUp(qQ(z.start,$.changedTouches))}onMouseOrPointerUp($){if(k$($))this.onUp($)}onUp($){let z=this.drag;if(!z)return;if(!$)$=z.lastDrag;if($&&this.dragging)this.dragging=!1,z.params.onDragStop?.($),this.eventSvc.dispatchEvent({type:"dragStopped",target:z.params.eElement});this.destroyDrag()}onKeyDown($){if($.key===A.ESCAPE)this.cancelDrag()}},j5=($)=>{v2($.handlers);let z=$.oldTouchAction;if(z!=null){let Q=$.params.eElement.style;if(Q)Q.touchAction=z}},hZ=class{constructor($,z,Q,J=null){this.rootEl=$,this.params=z,this.start=Q,this.pointerId=J,this.handlers=[],this.lastDrag=null,this.pointerCapture=null,this.eElement=z.eElement}},uZ=($)=>{let z=$.target;return z instanceof Element?z:null},OH=class extends fH{shouldPreventMouseEvent($){return this.gos.get("enableCellTextSelection")&&super.shouldPreventMouseEvent($)}},PH=class extends S{constructor(){super(...arguments);this.beanName="horizontalResizeSvc"}addResizeBar($){let z={dragStartPixels:$.dragStartPixels||0,eElement:$.eResizeBar,onDragStart:this.onDragStart.bind(this,$),onDragStop:this.onDragStop.bind(this,$),onDragging:this.onDragging.bind(this,$),onDragCancel:this.onDragStop.bind(this,$),includeTouch:!0,stopPropagationForTouch:!0},{dragSvc:Q}=this.beans;return Q.addDragSource(z),()=>Q.removeDragSource(z)}onDragStart($,z){this.dragStartX=z.clientX,this.setResizeIcons();let Q=z instanceof MouseEvent&&z.shiftKey===!0;$.onResizeStart(Q)}setResizeIcons(){let $=this.beans.ctrlsSvc.get("gridCtrl");$.setResizeCursor(1),$.disableUserSelect(!0)}onDragStop($){$.onResizeEnd(this.resizeAmount),this.resetIcons()}resetIcons(){let $=this.beans.ctrlsSvc.get("gridCtrl");$.setResizeCursor(!1),$.disableUserSelect(!1)}onDragging($,z){this.resizeAmount=z.clientX-this.dragStartX,$.onResizing(this.resizeAmount)}};var uJ=class{constructor($){if(this.tickingInterval=null,this.onScrollCallback=null,this.scrollContainer=$.scrollContainer,this.scrollHorizontally=$.scrollAxis.includes("x"),this.scrollVertically=$.scrollAxis.includes("y"),this.scrollByTick=$.scrollByTick??20,$.onScrollCallback)this.onScrollCallback=$.onScrollCallback;if(this.scrollVertically)this.getVerticalPosition=$.getVerticalPosition,this.setVerticalPosition=$.setVerticalPosition;if(this.scrollHorizontally)this.getHorizontalPosition=$.getHorizontalPosition,this.setHorizontalPosition=$.setHorizontalPosition;this.shouldSkipVerticalScroll=$.shouldSkipVerticalScroll||(()=>!1),this.shouldSkipHorizontalScroll=$.shouldSkipHorizontalScroll||(()=>!1)}get scrolling(){return this.tickingInterval!==null}check($,z=!1){let Q=!this.scrollVertically||z||this.shouldSkipVerticalScroll(),J=!this.scrollHorizontally||this.shouldSkipHorizontalScroll();if(Q&&J)return;let Z=this.scrollContainer.getBoundingClientRect(),X=this.scrollByTick;if(this.tickLeft=!J&&$.clientXZ.right-X,this.tickUp=!Q&&$.clientYZ.bottom-X,this.tickLeft||this.tickRight||this.tickUp||this.tickDown)this.ensureTickingStarted();else this.ensureCleared()}ensureTickingStarted(){if(this.tickingInterval===null)this.tickingInterval=window.setInterval(this.doTick.bind(this),100),this.tickCount=0}doTick(){this.tickCount++;let $=this.tickCount>20?200:this.tickCount>10?80:40;if(this.scrollVertically){let z=this.getVerticalPosition();if(this.tickUp)this.setVerticalPosition(z-$);if(this.tickDown)this.setVerticalPosition(z+$)}if(this.scrollHorizontally){let z=this.getHorizontalPosition();if(this.tickLeft)this.setHorizontalPosition(z-$);if(this.tickRight)this.setHorizontalPosition(z+$)}if(this.onScrollCallback)this.onScrollCallback()}ensureCleared(){if(this.tickingInterval)window.clearInterval(this.tickingInterval),this.tickingInterval=null}},WQ=class{constructor(){this.reordered=!1,this.removals=[],this.updates=new Set,this.adds=new Set}},pz=($)=>{let z=$.childrenAfterGroup;while(z?.length){let Q=z[0];if(Q.sourceRowIndex>=0)return Q;z=Q.childrenAfterGroup}},q8=($,z,Q,J)=>{if(!z.size||!$)return!1;let Z=!1,X=$.length??0,Y=-1;if(Q){if(Y=Q.sourceRowIndex,Q=Y<0?pz(Q):null,Q)Y=Q.sourceRowIndex}if(Y<0||Y>=X)Y=X;else if(!J)++Y;let q=Y,G=Math.min(Y,X-1);for(let U of z){let W=U.sourceRowIndex;if(WG)G=W}let _=q;for(let U=q;U=Y;--U){let W=$[U];if(z.has(W))continue;if(W.sourceRowIndex!==H)W.sourceRowIndex=H,$[H]=W,Z=!0;--H}for(let U of z){if(U.sourceRowIndex!==_)U.sourceRowIndex=_,$[_]=U,Z=!0;++_}return Z};function _4($,z){return E1($,z.target)?.getFocusedCellPosition()??null}function H4($,z){let Q=V0($.gos,"normal"),J=z,Z,X;if(J.clientX!=null||J.clientY!=null)Z=J.clientX,X=J.clientY;else Z=J.x,X=J.y;let{pageFirstPixel:Y}=$.pageBounds.getCurrentPagePixelRange();if(X+=Y,Q){let q=$.ctrlsSvc.getScrollFeature(),G=q.getVScrollPosition(),_=q.getHScrollPosition();Z+=_.left,X+=G.top}return{x:Z,y:X}}var mJ={moduleName:"Drag",version:p,beans:[OH]};var L1={moduleName:"SharedDragAndDrop",version:p,beans:[jG],dependsOn:[mJ],userComponents:{agDragAndDropImage:AH},icons:{columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",rowDrag:"grip"}};var U4={moduleName:"HorizontalResize",version:p,beans:[PH],dependsOn:[mJ]},TH=":where(.ag-ltr) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:left .2s}.ag-header-group-cell{transition:left .2s,width .2s}}:where(.ag-rtl) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:right .2s}.ag-header-group-cell{transition:right .2s,width .2s}}",vH=class extends S{constructor(){super(...arguments);this.beanName="colAnimation",this.executeNextFuncs=[],this.executeLaterFuncs=[],this.active=!1,this.activeNext=!1,this.suppressAnimation=!1,this.animationThreadCount=0}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>this.gridBodyCtrl=$.gridBodyCtrl)}isActive(){return this.active&&!this.suppressAnimation}setSuppressAnimation($){this.suppressAnimation=$}start(){if(this.active)return;let{gos:$}=this;if($.get("suppressColumnMoveAnimation"))return;if($.get("enableRtl"))return;this.ensureAnimationCssClassPresent(),this.active=!0,this.activeNext=!0}finish(){if(!this.active)return;this.flush(()=>this.activeNext=!1,()=>this.active=!1)}executeNextVMTurn($){if(this.activeNext)this.executeNextFuncs.push($);else $()}executeLaterVMTurn($){if(this.active)this.executeLaterFuncs.push($);else $()}ensureAnimationCssClassPresent(){this.animationThreadCount++;let $=this.animationThreadCount,{gridBodyCtrl:z}=this;z.setColumnMovingCss(!0),this.executeLaterFuncs.push(()=>{if(this.animationThreadCount===$)z.setColumnMovingCss(!1)})}flush($,z){let{executeNextFuncs:Q,executeLaterFuncs:J}=this;if(Q.length===0&&J.length===0){$(),z();return}let Z=(X)=>{while(X.length){let Y=X.pop();if(Y)Y()}};this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{$(),Z(Q)},0),window.setTimeout(()=>{z(),Z(J)},200)})}};function IH($,z,Q){$.colMoves?.moveColumnByIndex(z,Q,"api")}function CH($,z,Q){$.colMoves?.moveColumns(z,Q,"api")}var bH=class extends S{constructor($){super();this.pinned=$,this.columnsToAggregate=[],this.columnsToGroup=[],this.columnsToPivot=[]}onDragEnter($){if(this.clearColumnsList(),this.gos.get("functionsReadOnly"))return;let z=$.dragItem.columns;if(!z)return;for(let Q of z){if(!Q.isPrimary())continue;if(Q.isAnyFunctionActive())continue;if(Q.isAllowValue())this.columnsToAggregate.push(Q);else if(Q.isAllowRowGroup())this.columnsToGroup.push(Q);else if(Q.isAllowPivot())this.columnsToPivot.push(Q)}}getIconName(){if(this.columnsToAggregate.length+this.columnsToGroup.length+this.columnsToPivot.length>0)return this.pinned?"pinned":"move";return null}onDragLeave($){this.clearColumnsList()}clearColumnsList(){this.columnsToAggregate.length=0,this.columnsToGroup.length=0,this.columnsToPivot.length=0}onDragging($){}onDragStop($){let{valueColsSvc:z,rowGroupColsSvc:Q,pivotColsSvc:J}=this.beans;if(this.columnsToAggregate.length>0)z?.addColumns(this.columnsToAggregate,"toolPanelDragAndDrop");if(this.columnsToGroup.length>0)Q?.addColumns(this.columnsToGroup,"toolPanelDragAndDrop");if(this.columnsToPivot.length>0)J?.addColumns(this.columnsToPivot,"toolPanelDragAndDrop")}onDragCancel(){this.clearColumnsList()}};function yH($,z){if(!z||z.length<=1)return;if(z.filter((J)=>$.indexOf(J)<0).length>0)return;z.sort((J,Z)=>{let X=$.indexOf(J),Y=$.indexOf(Z);return X-Y})}function xH($){let z=[...$];for(let Q of $){let J=null,Z=Q.getParent();while(Z!=null&&Z.getDisplayedLeafColumns().length===1)J=Z,Z=Z.getParent();if(J!=null){let Y=J.getColGroupDef()?.marryChildren?J.getProvidedColumnGroup().getLeafColumns():J.getLeafColumns();for(let q of Y)if(!z.includes(q))z.push(q)}}return z}function wH($,z,Q,J){let Z=J.allCols,X=null,Y=null;for(let q=0;q<$.length;q++){let G=$[q],_=Q.getProposedColumnOrder(z,G);if(!Q.doesOrderPassRules(_))continue;let H=_.filter((W)=>Z.includes(W));if(Y===null)Y=H;else if(!X0(H,Y))break;let U=gH(_);if(X===null||U=E)return;if(Q&&K<=E)return}let D=wH(B,W,_,H);if(!D)return;let F=D.move;if(F>G.getCols().length-W.length)return;return{columns:W,toIndex:F}}function _8($){let{columns:z,toIndex:Q}=G8($)||{},{finished:J,colMoves:Z}=$;if(!z||Q==null)return null;return Z.moveColumns(z,Q,"uiColumnMoved",J),J?null:{columns:z,toIndex:Q}}function NH($,z){let Q=z.getCols(),J=$.map((G)=>Q.indexOf(G)).sort((G,_)=>G-_),Z=J[0];return b(J)-Z!==J.length-1?null:Z}function gH($){function z(J){let Z=[],X=J.getOriginalParent();while(X!=null)Z.push(X),X=X.getOriginalParent();return Z}let Q=0;for(let J=0;J<$.length-1;J++){let Z=z($[J]),X=z($[J+1]);[Z,X]=Z.length>X.length?[Z,X]:[X,Z];for(let Y of Z)if(X.indexOf(Y)===-1)Q++}return Q}function hH($,z){switch(z){case"left":return $.leftCols;case"right":return $.rightCols;default:return $.centerCols}}function uH($){let{movingCols:z,draggingRight:Q,xPosition:J,pinned:Z,gos:X,colModel:Y,visibleCols:q}=$;if(X.get("suppressMovableColumns")||z.some((M)=>M.getColDef().suppressMovable))return[];let _=hH(q,Z),H=Y.getCols(),U=_.filter((M)=>z.includes(M)),W=_.filter((M)=>!z.includes(M)),B=H.filter((M)=>!z.includes(M)),E=0,K=J;if(Q){let M=0;for(let k of U)M+=k.getActualWidth();K-=M}if(K>0){for(let M=0;M0){let M=W[E-1];L=B.indexOf(M)+1}else if(L=B.indexOf(W[0]),L===-1)L=0;let D=[L],F=(M,k)=>M-k;if(Q){let M=L+1,k=H.length-1;while(M<=k)D.push(M),M++;D.sort(F)}else{let M=L,k=H.length-1,V=H[M];while(M<=k&&_.indexOf(V)<0)M++,D.push(M),V=H[M];M=L-1;let R=0;while(M>=R)D.push(M),M--;D.sort(F).reverse()}return D}function H2($){let{pinned:z,fromKeyboard:Q,gos:J,ctrlsSvc:Z,useHeaderRow:X,skipScrollPadding:Y}=$,q=Z.getHeaderRowContainerCtrl(z)?.eViewport,{x:G}=$;if(!q)return 0;if(Q)G-=q.getBoundingClientRect().left;if(J.get("enableRtl")){if(X)q=q.querySelector(".ag-header-row");G=q.clientWidth-G}if(z==null&&!Y)G+=Z.get("center").getCenterViewportScrollLeft();return G}function mZ($,z){for(let Q of $)Q.moving=z,Q.dispatchColEvent("movingChanged","uiColumnMoved")}var f5=7,U2=100,h1=U2/2,mH=5,cH=100,pH=class extends S{constructor($){super();this.pinned=$,this.needToMoveLeft=!1,this.needToMoveRight=!1,this.lastMovedInfo=null,this.isCenterContainer=!T($)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCon=$.gridBodyCtrl})}getIconName(){let{pinned:$,lastDraggingEvent:z}=this,{dragItem:Q}=z||{},J=Q?.columns??[];for(let Z of J){let X=Z.getPinned();if(Z.getColDef().lockPinned){if(X==$)return"move";continue}let Y=Q?.containerType;if(Y===$||!$)return"move";if($&&(!X||Y!==$))return"pinned"}return"notAllowed"}onDragEnter($){let z=$.dragItem,Q=z.columns;if($.dragSource.type===0)this.setColumnsVisible(Q,!0,"uiColumnDragged");else{let Z=z.visibleState,X=(Q||[]).filter((Y)=>Z[Y.getId()]&&!Y.isVisible());this.setColumnsVisible(X,!0,"uiColumnDragged")}if(!this.gos.get("suppressMoveWhenColumnDragging"))this.attemptToPinColumns(Q,this.pinned);this.onDragging($,!0,!0)}onDragging($=this.lastDraggingEvent,z=!1,Q=!1,J=!1){let{gos:Z,ctrlsSvc:X}=this.beans,Y=Z.get("suppressMoveWhenColumnDragging");if(J&&!Y){this.finishColumnMoving();return}if(this.lastDraggingEvent=$,!$||!J&&n($.hDirection))return;let q=H2({x:$.x,pinned:this.pinned,gos:Z,ctrlsSvc:X});if(!z)this.checkCenterForScrolling(q);if(Y)this.handleColumnDragWhileSuppressingMovement($,z,Q,q,J);else this.handleColumnDragWhileAllowingMovement($,z,Q,q,J)}onDragLeave(){this.ensureIntervalCleared(),this.clearHighlighted(),this.updateDragItemContainerType(),this.lastMovedInfo=null}onDragStop(){this.onDragging(this.lastDraggingEvent,!1,!0,!0),this.ensureIntervalCleared(),this.lastMovedInfo=null}onDragCancel(){this.clearHighlighted(),this.ensureIntervalCleared(),this.lastMovedInfo=null}setColumnsVisible($,z,Q){if(!$?.length)return;let J=$.filter((Z)=>!Z.getColDef().lockVisible);if(!J.length)return;this.beans.colModel.setColsVisible(J,z,Q)}finishColumnMoving(){this.clearHighlighted();let $=this.lastMovedInfo;if(!$)return;let{columns:z,toIndex:Q}=$;this.beans.colMoves.moveColumns(z,Q,"uiColumnMoved",!0)}updateDragItemContainerType(){let{lastDraggingEvent:$}=this;if(this.gos.get("suppressMoveWhenColumnDragging")||!$)return;let z=$.dragItem;if(!z)return;z.containerType=this.pinned}handleColumnDragWhileSuppressingMovement($,z,Q,J,Z){let X=this.getAllMovingColumns($,!0);if(Z){let Y=this.isAttemptingToPin(X);if(Y)this.attemptToPinColumns(X,void 0,!0);let{fromLeft:q,xPosition:G}=this.getNormalisedXPositionInfo(X,Y)||{};if(q==null||G==null){this.finishColumnMoving();return}this.moveColumnsAfterHighlight({allMovingColumns:X,xPosition:G,fromEnter:z,fakeEvent:Q,fromLeft:q})}else{if(!this.beans.dragAndDrop.isDropZoneWithinThisGrid($))return;this.highlightHoveredColumn(X,J)}}handleColumnDragWhileAllowingMovement($,z,Q,J,Z){let X=this.getAllMovingColumns($),Y=this.normaliseDirection($.hDirection)==="right",q=$.dragSource.type===1,G=this.getMoveColumnParams({allMovingColumns:X,isFromHeader:q,xPosition:J,fromLeft:Y,fromEnter:z,fakeEvent:Q}),_=_8({...G,finished:Z});if(_)this.lastMovedInfo=_}getAllMovingColumns($,z=!1){let Q=$.dragSource.getDragItem(),J=null;if(z){if(J=Q.columnsInSplit,!J)J=Q.columns}else J=Q.columns;let Z=(X)=>X.getColDef().lockPinned?X.getPinned()==this.pinned:!0;if(!J)return[];return J.filter(Z)}getMoveColumnParams($){let{allMovingColumns:z,isFromHeader:Q,xPosition:J,fromLeft:Z,fromEnter:X,fakeEvent:Y}=$,{gos:q,colModel:G,colMoves:_,visibleCols:H}=this.beans;return{allMovingColumns:z,isFromHeader:Q,fromLeft:Z,xPosition:J,pinned:this.pinned,fromEnter:X,fakeEvent:Y,gos:q,colModel:G,colMoves:_,visibleCols:H}}highlightHoveredColumn($,z){let{gos:Q,colModel:J}=this.beans,Z=Q.get("enableRtl"),X=J.getCols().filter((H)=>H.isVisible()&&H.getPinned()===this.pinned),Y=null,q=null,G=null;for(let H of X){if(q=H.getActualWidth(),Y=this.getNormalisedColumnLeft(H,0,Z),Y!=null){let U=Y+q;if(Y<=z&&U>=z){G=H;break}}Y=null,q=null}if(!G){for(let H=X.length-1;H>=0;H--){let U=X[H],W=X[H].getParent();if(!W){G=U;break}let B=W?.getDisplayedLeafColumns();if(B.length){G=b(B);break}}if(!G)return;Y=this.getNormalisedColumnLeft(G,0,Z),q=G.getActualWidth()}else if($.indexOf(G)!==-1)G=null;if(G==null||Y==null||q==null){if(this.lastHighlightedColumn?.column!==G)this.clearHighlighted();return}let _;if(z-Yf5;return z&&Q||$.some((J)=>J.getPinned()!==this.pinned)}moveColumnsAfterHighlight($){let{allMovingColumns:z,xPosition:Q,fromEnter:J,fakeEvent:Z,fromLeft:X}=$,Y=this.getMoveColumnParams({allMovingColumns:z,isFromHeader:!0,xPosition:Q,fromLeft:X,fromEnter:J,fakeEvent:Z}),{columns:q,toIndex:G}=G8(Y)||{};if(q&&G!=null)this.lastMovedInfo={columns:q,toIndex:G};this.finishColumnMoving()}clearHighlighted(){let{lastHighlightedColumn:$}=this;if(!$)return;O5($.column,null),this.lastHighlightedColumn=null}checkCenterForScrolling($){if(!this.isCenterContainer)return;let z=this.beans.ctrlsSvc.get("center"),Q=z.getCenterViewportScrollLeft(),J=Q+z.getCenterWidth(),Z,X;if(this.gos.get("enableRtl"))Z=$J-h1;else X=$J-h1;if(this.needToMoveRight=Z,this.needToMoveLeft=X,X||Z)this.ensureIntervalStarted();else this.ensureIntervalCleared()}ensureIntervalStarted(){if(this.movingIntervalId)return;this.intervalCount=0,this.failedMoveAttempts=0,this.movingIntervalId=window.setInterval(this.moveInterval.bind(this),cH),this.beans.dragAndDrop.setDragImageCompIcon(this.needToMoveLeft?"left":"right",!0)}ensureIntervalCleared(){if(!this.movingIntervalId)return;window.clearInterval(this.movingIntervalId),this.movingIntervalId=null,this.failedMoveAttempts=0,this.beans.dragAndDrop.setDragImageCompIcon(this.getIconName())}moveInterval(){let $;if(this.intervalCount++,$=10+this.intervalCount*mH,$>U2)$=U2;let z=null,Q=this.gridBodyCon.scrollFeature;if(this.needToMoveLeft)z=Q.scrollHorizontally(-$);else if(this.needToMoveRight)z=Q.scrollHorizontally($);if(z!==0)this.onDragging(this.lastDraggingEvent),this.failedMoveAttempts=0;else{this.failedMoveAttempts++;let{pinnedCols:J,dragAndDrop:Z,gos:X}=this.beans;if(this.failedMoveAttempts<=f5+1||!J)return;if(Z.setDragImageCompIcon("pinned"),!X.get("suppressMoveWhenColumnDragging")){let Y=this.lastDraggingEvent?.dragItem.columns;this.attemptToPinColumns(Y,void 0,!0)}}}getPinDirection(){if(this.needToMoveLeft||this.pinned==="left")return"left";if(this.needToMoveRight||this.pinned==="right")return"right"}attemptToPinColumns($,z,Q=!1){let J=($||[]).filter((Y)=>!Y.getColDef().lockPinned);if(!J.length)return 0;if(Q)z=this.getPinDirection();let{pinnedCols:Z,dragAndDrop:X}=this.beans;if(Z?.setColsPinned(J,z,"uiColumnDragged"),Q)X.nudge();return J.length}destroy(){super.destroy(),this.lastDraggingEvent=null,this.clearHighlighted(),this.lastMovedInfo=null}};function O5($,z){if($.highlighted===z)return;$.highlighted=z,$.dispatchColEvent("headerHighlightChanged","uiColumnMoved")}function iH($){let z=$.length,Q,J;for(let Z=0;Z{let Z,X=J.gridBodyCtrl.eBodyViewport;switch(Q){case"left":Z=[[X,J.left.eContainer],[J.bottomLeft.eContainer],[J.topLeft.eContainer]];break;case"right":Z=[[X,J.right.eContainer],[J.bottomRight.eContainer],[J.topRight.eContainer]];break;default:Z=[[X,J.center.eViewport],[J.bottomCenter.eViewport],[J.topCenter.eViewport]];break}this.eSecondaryContainers=Z}),this.moveColumnFeature=this.createManagedBean(new pH(Q)),this.bodyDropPivotTarget=this.createManagedBean(new bH(Q)),z.addDropTarget(this),this.addDestroyFunc(()=>z.removeDropTarget(this))}isInterestedIn($){return $===1||$===0&&this.gos.get("allowDragFromColumnsToolPanel")}getSecondaryContainers(){return this.eSecondaryContainers}getContainer(){return this.eContainer}getIconName(){return this.currentDropListener.getIconName()}isDropColumnInPivotMode($){return this.beans.colModel.isPivotMode()&&$.dragSource.type===0}onDragEnter($){this.currentDropListener=this.isDropColumnInPivotMode($)?this.bodyDropPivotTarget:this.moveColumnFeature,this.currentDropListener.onDragEnter($)}onDragLeave($){this.currentDropListener.onDragLeave($)}onDragging($){this.currentDropListener.onDragging($)}onDragStop($){this.currentDropListener.onDragStop($)}onDragCancel(){this.currentDropListener.onDragCancel()}};function H8($,z){let Q=[],J=[],Z=[];if($.forEach((Y)=>{let q=Y.getColDef().lockPosition;if(q==="right")Z.push(Y);else if(q==="left"||q===!0)Q.push(Y);else J.push(Y)}),z.get("enableRtl"))return[...Z,...J,...Q];return[...Q,...J,...Z]}function U8($,z){let Q=!0;return O$(null,z,(J)=>{if(!q0(J))return;let Z=J;if(!Z.getColGroupDef()?.marryChildren)return;let q=[];for(let W of Z.getLeafColumns()){let B=$.indexOf(W);q.push(B)}let G=Math.max.apply(Math,q),_=Math.min.apply(Math,q),H=G-_,U=Z.getLeafColumns().length-1;if(H>U)Q=!1}),Q}var dH=class extends S{constructor(){super(...arguments);this.beanName="colMoves"}moveColumnByIndex($,z,Q){let J=this.beans.colModel.getCols();if(!J)return;let Z=J[$];this.moveColumns([Z],z,Q)}moveColumns($,z,Q,J=!0){let{colModel:Z,colAnimation:X,visibleCols:Y,eventSvc:q}=this.beans,G=Z.getCols();if(!G)return;if(z>G.length-$.length){j(30,{toIndex:z});return}X?.start();let _=Z.getColsForKeys($);if(this.doesMovePassRules(_,z))Y5(Z.getCols(),_,z),Y.refresh(Q),q.dispatchEvent({type:"columnMoved",columns:_,column:_.length===1?_[0]:null,toIndex:z,finished:J,source:Q});X?.finish()}doesMovePassRules($,z){let Q=this.getProposedColumnOrder($,z);return this.doesOrderPassRules(Q)}doesOrderPassRules($){let{colModel:z,gos:Q}=this.beans;if(!U8($,z.getColTree()))return!1;if(!((Z)=>{let X=(_)=>{if(!_)return 0;return _==="left"||_===!0?-1:1},Y=Q.get("enableRtl"),q=Y?1:-1,G=!0;for(let _ of Z){let H=X(_.getColDef().lockPosition);if(Y){if(H>q)G=!1}else if(Hq?"hide":"notAllowed",getDragItem:G?()=>rH(z,Y.allCols):()=>sH(z),dragItemName:Q,onDragStarted:()=>{q=!J.get("suppressDragLeaveHidesColumns"),mZ(_,!0)},onDragStopped:()=>mZ(_,!1),onDragCancelled:()=>mZ(_,!1),onGridEnter:(W)=>{if(q){let{columns:B=[],visibleState:E}=W??{},K=G?(D)=>!E||E[D.getColId()]:()=>!0,L=B.filter((D)=>!D.getColDef().lockVisible&&K(D));Z.setColsVisible(L,!0,"uiColumnMoved")}},onGridExit:(W)=>{if(q){let B=W?.columns?.filter((E)=>!E.getColDef().lockVisible)||[];Z.setColsVisible(B,!1,"uiColumnMoved")}}};return X.addDragSource(U,!0),U}};function tH($,z){while($){if($.getGroupId()===z)return $;$=$.getParent()}return}function sH($){let z={};return z[$.getId()]=$.isVisible(),{columns:[$],visibleState:z,containerType:$.pinned}}function rH($,z){let Q=$.getProvidedColumnGroup().getLeafColumns(),J={};for(let q of Q)J[q.getId()]=q.isVisible();let Z=[];for(let q of z)if(Q.indexOf(q)>=0)Z.push(q),Z0(Q,q);for(let q of Q)Z.push(q);let X=[],Y=$.getLeafColumns();for(let q of Z)if(Y.indexOf(q)!==-1)X.push(q);return{columns:Z,columnsInSplit:X,visibleState:J,containerType:X[0]?.pinned}}var D1={moduleName:"ColumnMove",version:p,beans:[dH,vH],apiFunctions:{moveColumnByIndex:IH,moveColumns:CH},dependsOn:[L1],css:[TH]},lH=class extends S{constructor(){super(...arguments);this.beanName="autoWidthCalc"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.centerRowContainerCtrl=$.center})}getPreferredWidthForColumn($,z){let Q=this.getHeaderCellForColumn($);if(!Q)return-1;let J=this.beans.rowRenderer.getAllCellsNotSpanningForColumn($);if(!z)J.push(Q);return this.getPreferredWidthForElements(J)}getPreferredWidthForColumnGroup($){let z=this.getHeaderCellForColumn($);if(!z)return-1;return this.getPreferredWidthForElements([z])}getPreferredWidthForElements($,z){let Q=document.createElement("form");Q.style.position="fixed";let J=this.centerRowContainerCtrl.eContainer;for(let X of $)this.cloneItemIntoDummy(X,Q);J.appendChild(Q);let Z=Math.ceil(Q.getBoundingClientRect().width);return Q.remove(),z=z??this.gos.get("autoSizePadding"),Z+z}getHeaderCellForColumn($){let z=null;for(let Q of this.beans.ctrlsSvc.getHeaderRowContainerCtrls()){let J=Q.getHtmlElementForColumnHeader($);if(J!=null)z=J}return z}cloneItemIntoDummy($,z){let Q=$.cloneNode(!0);Q.style.width="",Q.style.position="static",Q.style.left="";let J=document.createElement("div"),Z=J.classList;if(["ag-header-cell","ag-header-group-cell"].some((q)=>Q.classList.contains(q)))Z.add("ag-header","ag-header-row"),J.style.position="static";else Z.add("ag-row");let Y=$.parentElement;while(Y){if(["ag-header-row","ag-row"].some((G)=>Y.classList.contains(G))){for(let G=0;GX.getPinned());$.dispatchEvent({type:"columnPinned",pinned:Z!=null?Z:null,columns:z,column:J,source:Q})}function oH($,z,Q){if(!z.length)return;let J=z.length===1?z[0]:null,Z=B8(z,(X)=>X.isVisible());$.dispatchEvent({type:"columnVisible",visible:Z,columns:z,column:J,source:Q})}function K8($,z,Q,J){$.dispatchEvent({type:z,columns:Q,column:Q&&Q.length==1?Q[0]:null,source:J})}function LQ($,z,Q,J,Z=null){if(z?.length)$.dispatchEvent({type:"columnResized",columns:z,column:z.length===1?z[0]:null,flexColumns:Z,finished:Q,source:J})}var eH=class extends S{constructor($,z,Q,J){super();this.comp=$,this.eResize=z,this.pinned=Q,this.columnGroup=J}postConstruct(){if(!this.columnGroup.isResizable()){this.comp.setResizableDisplayed(!1);return}let{horizontalResizeSvc:$,gos:z,colAutosize:Q}=this.beans,J=$.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if(this.addDestroyFunc(J),!z.get("suppressAutoSize")&&Q)this.addDestroyFunc(Q.addColumnGroupResize(this.eResize,this.columnGroup,()=>this.resizeLeafColumnsToFit("uiColumnResized")))}onResizeStart($){let{columnsToResize:z,resizeStartWidth:Q,resizeRatios:J,groupAfterColumns:Z,groupAfterStartWidth:X,groupAfterRatios:Y}=this.getInitialValues($);this.resizeCols=z,this.resizeStartWidth=Q,this.resizeRatios=J,this.resizeTakeFromCols=Z,this.resizeTakeFromStartWidth=X,this.resizeTakeFromRatios=Y,this.toggleColumnResizing(!0)}onResizing($,z,Q="uiColumnResized"){let J=this.normaliseDragChange(z),Z=this.resizeStartWidth+J;this.resizeColumnsFromLocalValues(Z,Q,$)}getInitialValues($){let z=(G)=>G.reduce((_,H)=>_+H.getActualWidth(),0),Q=(G,_)=>G.map((H)=>H.getActualWidth()/_),J=this.getColumnsToResize(),Z=z(J),X=Q(J,Z),Y={columnsToResize:J,resizeStartWidth:Z,resizeRatios:X},q=null;if($)q=this.beans.colGroupSvc?.getGroupAtDirection(this.columnGroup,"After")??null;if(q){let G=q.getDisplayedLeafColumns(),_=Y.groupAfterColumns=G.filter((U)=>U.isResizable()),H=Y.groupAfterStartWidth=z(_);Y.groupAfterRatios=Q(_,H)}else Y.groupAfterColumns=void 0,Y.groupAfterStartWidth=void 0,Y.groupAfterRatios=void 0;return Y}resizeLeafColumnsToFit($){let z=this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup),Q=this.getInitialValues();if(z>Q.resizeStartWidth)this.resizeColumns(Q,z,$,!0)}resizeColumnsFromLocalValues($,z,Q=!0){if(!this.resizeCols||!this.resizeRatios)return;let J={columnsToResize:this.resizeCols,resizeStartWidth:this.resizeStartWidth,resizeRatios:this.resizeRatios,groupAfterColumns:this.resizeTakeFromCols,groupAfterStartWidth:this.resizeTakeFromStartWidth,groupAfterRatios:this.resizeTakeFromRatios};this.resizeColumns(J,$,z,Q)}resizeColumns($,z,Q,J=!0){let{columnsToResize:Z,resizeStartWidth:X,resizeRatios:Y,groupAfterColumns:q,groupAfterStartWidth:G,groupAfterRatios:_}=$,H=[];if(H.push({columns:Z,ratios:Y,width:z}),q){let U=z-X;H.push({columns:q,ratios:_,width:G-U})}if(this.beans.colResize?.resizeColumnSets({resizeSets:H,finished:J,source:Q}),J)this.toggleColumnResizing(!1)}toggleColumnResizing($){this.comp.toggleCss("ag-column-resizing",$)}getColumnsToResize(){return this.columnGroup.getDisplayedLeafColumns().filter((z)=>z.isResizable())}normaliseDragChange($){let z=$;if(this.gos.get("enableRtl")){if(this.pinned!=="left")z*=-1}else if(this.pinned==="right")z*=-1;return z}destroy(){super.destroy(),this.resizeCols=void 0,this.resizeRatios=void 0,this.resizeTakeFromCols=void 0,this.resizeTakeFromRatios=void 0}},$U=class extends S{constructor($,z,Q,J,Z){super();this.pinned=$,this.column=z,this.eResize=Q,this.comp=J,this.ctrl=Z}postConstruct(){let $=[],z,Q,J=()=>{if(N(this.eResize,z),!z)return;let{horizontalResizeSvc:Y,colAutosize:q}=this.beans,G=Y.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if($.push(G),Q&&q)$.push(q.addColumnAutosizeListeners(this.eResize,this.column))},Z=()=>{for(let Y of $)Y();$.length=0},X=()=>{let Y=this.column.isResizable(),q=!this.gos.get("suppressAutoSize")&&!this.column.getColDef().suppressAutoSize;if(Y!==z||q!==Q)z=Y,Q=q,Z(),J()};X(),this.addDestroyFunc(Z),this.ctrl.setRefreshFunction("resize",X)}onResizing($,z){let{column:Q,lastResizeAmount:J,resizeStartWidth:Z,beans:X}=this,Y=this.normaliseResizeAmount(z),q=Z+Y,G=[{key:Q,newWidth:q}],{pinnedCols:_,ctrlsSvc:H,colResize:U}=X;if(this.column.getPinned()){let W=_?.leftWidth??0,B=_?.rightWidth??0,E=xz(H.getGridBodyCtrl().eBodyViewport)-50;if(W+B+(Y-J)>E)return}if(this.lastResizeAmount=Y,U?.setColumnWidths(G,this.resizeWithShiftKey,$,"uiColumnResized"),$)this.toggleColumnResizing(!1)}onResizeStart($){this.resizeStartWidth=this.column.getActualWidth(),this.lastResizeAmount=0,this.resizeWithShiftKey=$,this.toggleColumnResizing(!0)}toggleColumnResizing($){this.column.resizing=$,this.comp.toggleCss("ag-column-resizing",$)}normaliseResizeAmount($){let z=$,Q=this.pinned!=="left",J=this.pinned==="right";if(this.gos.get("enableRtl")){if(Q)z*=-1}else if(J)z*=-1;return z}},zU=class extends S{constructor(){super(...arguments);this.beanName="colResize"}setColumnWidths($,z,Q,J){let Z=[],{colModel:X,gos:Y,visibleCols:q}=this.beans;for(let G of $){let _=X.getColDefCol(G.key)||X.getCol(G.key);if(!_)continue;if(Z.push({width:G.newWidth,ratios:[1],columns:[_]}),Y.get("colResizeDefault")==="shift")z=!z;if(z){let U=q.getColAfter(_);if(!U)continue;let W=_.getActualWidth()-G.newWidth,B=U.getActualWidth()+W;Z.push({width:B,ratios:[1],columns:[U]})}}if(Z.length===0)return;this.resizeColumnSets({resizeSets:Z,finished:Q,source:J})}resizeColumnSets($){let{resizeSets:z,finished:Q,source:J}=$;if(!(!z||z.every((H)=>QU(H)))){if(Q){let H=z&&z.length>0?z[0].columns:null;LQ(this.eventSvc,H,Q,J)}return}let X=[],Y=[];for(let H of z){let{width:U,columns:W,ratios:B}=H,E={},K={};for(let F of W)Y.push(F);let L=!0,D=0;while(L){if(D++,D>1000){e(31);break}L=!1;let F=[],M=0,k=U;W.forEach((R,O)=>{if(K[R.getId()])k-=E[R.getId()];else{F.push(R);let v=B[O];M+=v}});let V=1/M;F.forEach((R,O)=>{let I=O===F.length-1,v;if(I)v=k;else v=Math.round(B[O]*U*V),k-=v;let C=R.getMinWidth(),m=R.getMaxWidth();if(v0&&v>m)v=m,K[R.getId()]=!0,L=!0;E[R.getId()]=v})}for(let F of W){let M=E[F.getId()];if(F.getActualWidth()!==M)F.setActualWidth(M,J),X.push(F)}}let q=X.length>0,G=[];if(q){let{colFlex:H,visibleCols:U,colViewport:W}=this.beans;G=H?.refreshFlexedColumns({resizingCols:Y,skipSetLeft:!0})??[],U.setLeftValues(J),U.updateBodyWidths(),W.checkViewportColumns()}let _=Y.concat(G);if(q||Q)LQ(this.eventSvc,_,Q,J,G)}resizeHeader($,z,Q){if(!$.isResizable())return;let J=$.getActualWidth(),Z=$.getMinWidth(),X=$.getMaxWidth(),Y=Math.min(Math.max(J+z,Z),X);this.setColumnWidths([{key:$,newWidth:Y}],Q,!0,"uiColumnResized")}createResizeFeature($,z,Q,J,Z){return new $U($,z,Q,J,Z)}createGroupResizeFeature($,z,Q,J){return new eH($,z,Q,J)}};function QU($){let{columns:z,width:Q}=$,J=0,Z=0,X=!0;for(let G of z){let _=G.getMinWidth();J+=_||0;let H=G.getMaxWidth();if(H>0)Z+=H;else X=!1}let Y=Q>=J,q=!X||Q<=Z;return Y&&q}var JU={moduleName:"ColumnResize",version:p,beans:[zU],apiFunctions:{setColumnWidths:aH},dependsOn:[U4,W8]},ZU=class extends S{constructor($,z){super();this.removeChildListenersFuncs=[],this.columnGroup=z,this.comp=$}postConstruct(){this.addListenersToChildrenColumns(),this.addManagedListeners(this.columnGroup,{displayedChildrenChanged:this.onDisplayedChildrenChanged.bind(this)}),this.onWidthChanged(),this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this))}addListenersToChildrenColumns(){this.removeListenersOnChildrenColumns();let $=this.onWidthChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())z.__addEventListener("widthChanged",$),z.__addEventListener("visibleChanged",$),this.removeChildListenersFuncs.push(()=>{z.__removeEventListener("widthChanged",$),z.__removeEventListener("visibleChanged",$)})}removeListenersOnChildrenColumns(){for(let $ of this.removeChildListenersFuncs)$();this.removeChildListenersFuncs=[]}onDisplayedChildrenChanged(){this.addListenersToChildrenColumns(),this.onWidthChanged()}onWidthChanged(){let $=this.columnGroup.getActualWidth();this.comp.setWidth(`${$}px`),this.comp.toggleCss("ag-hidden",$===0)}},XU=class extends Z4{constructor(){super(...arguments);this.onSuppressColMoveChange=()=>{if(!this.isAlive()||this.isSuppressMoving())this.removeDragSource();else if(!this.dragSource)this.setDragSource(this.eGui)}}wireComp($,z,Q,J,Z){let{column:X,beans:Y}=this,{context:q,colNames:G,colHover:_,rangeSvc:H,colResize:U}=Y;this.comp=$,Z=B1(this,q,Z),this.setGui(z,Z),this.displayName=G.getDisplayNameForColumnGroup(X,"header"),this.refreshHeaderStyles(),this.addClasses(),this.setupMovingCss(Z),this.setupExpandable(Z),this.setupTooltip(),this.refreshAnnouncement(),this.setupAutoHeight({wrapperElement:J,compBean:Z}),this.setupUserComp(),this.addHeaderMouseListeners(Z,J),this.addManagedPropertyListener("groupHeaderHeight",this.refreshMaxHeaderHeight.bind(this)),this.refreshMaxHeaderHeight();let W=this.rowCtrl.pinned,B=X.getProvidedColumnGroup().getLeafColumns();if(_?.createHoverFeature(Z,B,z),H?.createRangeHighlightFeature(Z,X,$),Z.createManagedBean(new J4(X,z,Y)),Z.createManagedBean(new ZU($,X)),U)this.resizeFeature=Z.createManagedBean(U.createGroupResizeFeature($,Q,W,X));else $.setResizableDisplayed(!1);Z.createManagedBean(new c$(z,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:()=>{return},handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)})),this.addHighlightListeners(Z,B),this.addManagedEventListeners({cellSelectionChanged:()=>this.refreshAnnouncement()}),Z.addManagedPropertyListener("suppressMovableColumns",this.onSuppressColMoveChange),this.addResizeAndMoveKeyboardListeners(Z),Z.addDestroyFunc(()=>this.clearComponent())}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.getDefinition();return y(z.gos,{colDef:Q,columnGroup:$,floatingFilter:!1})}refreshMaxHeaderHeight(){let{gos:$,comp:z}=this,Q=$.get("groupHeaderHeight");if(Q!=null)if(Q===0)z.setHeaderWrapperHidden(!0);else z.setHeaderWrapperMaxHeight(Q);else z.setHeaderWrapperHidden(!1),z.setHeaderWrapperMaxHeight(null)}addHighlightListeners($,z){if(!this.beans.gos.get("suppressMoveWhenColumnDragging"))return;for(let Q of z)$.addManagedListeners(Q,{headerHighlightChanged:this.onLeafColumnHighlightChanged.bind(this,Q)})}onLeafColumnHighlightChanged($){let z=this.column.getDisplayedLeafColumns(),Q=z[0]===$,J=b(z)===$;if(!Q&&!J)return;let Z=$.getHighlighted(),X=!!this.rowCtrl.getHeaderCellCtrls().find((G)=>{return G.column.isMoving()}),Y=!1,q=!1;if(X){let G=this.beans.gos.get("enableRtl"),_=Z===1,H=Z===0;if(Q)if(G)q=_;else Y=H;if(J)if(G)Y=H;else q=_}this.comp.toggleCss("ag-header-highlight-before",Y),this.comp.toggleCss("ag-header-highlight-after",q)}resizeHeader($,z){let{resizeFeature:Q}=this;if(!Q)return;let J=Q.getInitialValues(z);Q.resizeColumns(J,J.resizeStartWidth+$,"uiColumnResized",!0)}resizeLeafColumnsToFit($){this.resizeFeature?.resizeLeafColumnsToFit($)}setupUserComp(){let{colGroupSvc:$,userCompFactory:z,gos:Q,enterpriseMenuFactory:J}=this.beans,Z=this.column,X=Z.getProvidedColumnGroup(),Y=y(Q,{displayName:this.displayName,columnGroup:Z,setExpanded:(G)=>{$.setColumnGroupOpened(X,G,"gridInitializing")},setTooltip:(G,_)=>{Q.assertModuleRegistered("Tooltip",3),this.setupTooltip(G,_)},showColumnMenu:(G,_)=>J?.showMenuAfterButtonClick(X,G,"columnMenu",_),showColumnMenuAfterMouseClick:(G,_)=>J?.showMenuAfterMouseEvent(X,G,"columnMenu",_),eGridHeader:this.eGui}),q=FG(z,Y);if(q)this.comp.setUserCompDetails(q)}addHeaderMouseListeners($,z){let{column:Q,comp:J,beans:{rangeSvc:Z},gos:X}=this,Y=(H)=>this.handleMouseOverChange(H.type==="mouseenter"),q=()=>this.dispatchColumnMouseEvent("columnHeaderClicked",Q.getProvidedColumnGroup()),G=(H)=>this.handleContextMenuMouseEvent(H,void 0,Q.getProvidedColumnGroup());$.addManagedListeners(this.eGui,{mouseenter:Y,mouseleave:Y,click:q,contextmenu:G}),J.toggleCss("ag-header-group-cell-selectable",Jz(X));let _=Z?.createHeaderGroupCellMouseListenerFeature(this.column,z);if(_)this.createManagedBean(_)}handleMouseOverChange($){this.eventSvc.dispatchEvent({type:$?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column.getProvidedColumnGroup()})}setupTooltip($,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderGroupTooltip(this.tooltipFeature,this,$,z)}setupExpandable($){let z=this.column.getProvidedColumnGroup();this.refreshExpanded();let Q=this.refreshExpanded.bind(this);$.addManagedListeners(z,{expandedChanged:Q,expandableChanged:Q})}refreshExpanded(){let{column:$}=this;this.expandable=$.isExpandable();let z=$.isExpanded();if(this.expandable)this.comp.setAriaExpanded(z?"true":"false");else this.comp.setAriaExpanded(void 0);this.refreshHeaderStyles()}addClasses(){let{column:$}=this,z=$.getColGroupDef(),Q=NJ(z,this.gos,null,$);if($.isPadding()){if(Q.push("ag-header-group-cell-no-group"),$.getLeafColumns().every((Z)=>Z.isSpanHeaderHeight()))Q.push("ag-header-span-height")}else if(Q.push("ag-header-group-cell-with-group"),z?.wrapHeaderText)Q.push("ag-header-cell-wrap-text");for(let J of Q)this.comp.toggleCss(J,!0)}setupMovingCss($){let{column:z}=this,J=z.getProvidedColumnGroup().getLeafColumns(),Z=()=>this.comp.toggleCss("ag-header-cell-moving",z.isMoving());for(let X of J)$.addManagedListeners(X,{movingChanged:Z});Z()}onFocusIn($){if(!this.eGui.contains($.relatedTarget))this.focusThis(),this.announceAriaDescription()}handleKeyDown($){if(super.handleKeyDown($),!this.getWrapperHasFocus())return;let{column:Q,expandable:J,gos:Z,beans:X}=this,Y=Jz(Z);if($.key!=A.ENTER)return;if(Y&&!$.altKey)X.rangeSvc?.handleColumnSelection(Q,$);else if(J){let q=!Q.isExpanded();X.colGroupSvc.setColumnGroupOpened(Q.getProvidedColumnGroup(),q,"uiColumnExpanded")}}refreshAnnouncement(){let $,{gos:z}=this;if(Jz(z))$=this.getLocaleTextFunc()("ariaColumnGroupCellSelection","Press Enter to toggle selection for all visible cells in this column group");this.ariaAnnouncement=$}announceAriaDescription(){let{beans:$,eGui:z,ariaAnnouncement:Q}=this;if(!Q||!z.contains(d($)))return;$.ariaAnnounce?.announceValue(Q,"columnHeader")}setDragSource($){if(!this.isAlive()||this.isSuppressMoving())return;if(this.removeDragSource(),!$)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader($,this.column,this.displayName)??null}isSuppressMoving(){return this.gos.get("suppressMovableColumns")||this.column.getLeafColumns().some(($)=>$.getColDef().suppressMovable||$.getColDef().lockPosition)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function YU($,z,Q){$.colGroupSvc?.setColumnGroupOpened(z,Q,"api")}function qU($,z,Q){return $.colGroupSvc?.getColumnGroup(z,Q)??null}function GU($,z){return $.colGroupSvc?.getProvidedColGroup(z)??null}function _U($,z,Q){return $.colNames.getDisplayNameForColumnGroup(z,Q)||""}function HU($){return $.colGroupSvc?.getColumnGroupState()??[]}function UU($,z){$.colGroupSvc?.setColumnGroupState(z,"api")}function WU($){$.colGroupSvc?.resetColumnGroupState("api")}function BU($){return $.visibleCols.treeLeft}function EU($){return $.visibleCols.treeCenter}function KU($){return $.visibleCols.treeRight}function LU($){return $.visibleCols.getAllTrees()}var L8=class{constructor(){this.existingIds={}}getInstanceIdForKey($){let z=this.existingIds[$],Q;if(typeof z!=="number")Q=0;else Q=z+1;return this.existingIds[$]=Q,Q}};function DU($,z){for(let Q=0;Q=0)$[J]=$[$.length-1],$.pop()}}var FU=class extends S{constructor(){super(...arguments);this.beanName="visibleCols",this.colsAndGroupsMap={},this.leftCols=[],this.rightCols=[],this.centerCols=[],this.allCols=[],this.headerGroupRowCount=0,this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.isBodyWidthDirty=!0}refresh($,z=!1){let{colFlex:Q,colModel:J,colGroupSvc:Z,colViewport:X,selectionColSvc:Y}=this.beans;if(!z)this.buildTrees(J,Z);Z?.updateOpenClosedVisibility(),this.leftCols=cZ(this.treeLeft),this.centerCols=cZ(this.treeCenter),this.rightCols=cZ(this.treeRight),Y?.refreshVisibility(this.leftCols,this.centerCols,this.rightCols),this.joinColsAriaOrder(J),this.joinCols(),this.headerGroupRowCount=this.getHeaderRowCount(),this.setLeftValues($),this.autoHeightCols=this.allCols.filter((q)=>q.isAutoHeight()),Q?.refreshFlexedColumns(),this.updateBodyWidths(),this.setFirstRightAndLastLeftPinned(J,this.leftCols,this.rightCols,$),X.checkViewportColumns(!1),this.eventSvc.dispatchEvent({type:"displayedColumnsChanged",source:$})}getHeaderRowCount(){if(!this.gos.get("hidePaddedHeaderRows"))return this.beans.colModel.cols.treeDepth;let $=0;for(let z of this.allCols){let Q=z.getParent();while(Q){if(!Q.isPadding()){let J=Q.getProvidedColumnGroup().getLevel()+1;if(J>$)$=J;break}Q=Q.getParent()}}return $}updateBodyWidths(){let $=N$(this.centerCols),z=N$(this.leftCols),Q=N$(this.rightCols);if(this.isBodyWidthDirty=this.bodyWidth!==$,this.bodyWidth!==$||this.leftWidth!==z||this.rightWidth!==Q)this.bodyWidth=$,this.leftWidth=z,this.rightWidth=Q,this.eventSvc.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventSvc.dispatchEvent({type:"displayedColumnsWidthChanged"})}setLeftValues($){this.setLeftValuesOfCols($),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned($,z,Q,J){let Z,X;if(this.gos.get("enableRtl"))Z=z?z[0]:null,X=Q?b(Q):null;else Z=z?b(z):null,X=Q?Q[0]:null;for(let Y of $.getCols())Y.setLastLeftPinned(Y===Z,J),Y.setFirstRightPinned(Y===X,J)}buildTrees($,z){let Q=$.getColsToShow(),J=Q.filter((G)=>G.getPinned()=="left"),Z=Q.filter((G)=>G.getPinned()=="right"),X=Q.filter((G)=>G.getPinned()!="left"&&G.getPinned()!="right"),Y=new L8,q=(G)=>{return z?z.createColumnGroups(G):G.columns};this.treeLeft=q({columns:J,idCreator:Y,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=q({columns:Z,idCreator:Y,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=q({columns:X,idCreator:Y,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.leftCols=[],this.rightCols=[],this.centerCols=[],this.allCols=[],this.ariaOrderColumns=[]}joinColsAriaOrder($){let z=$.getCols(),Q=[],J=[],Z=[];for(let X of z){let Y=X.getPinned();if(!Y)J.push(X);else if(Y===!0||Y==="left")Q.push(X);else Z.push(X)}this.ariaOrderColumns=Q.concat(J).concat(Z)}getAriaColIndex($){let z;if(H0($))z=$.getLeafColumns()[0];else z=$;return this.ariaOrderColumns.indexOf(z)+1}setLeftValuesOfGroups(){for(let $ of[this.treeLeft,this.treeRight,this.treeCenter])for(let z of $)if(H0(z))z.checkLeft()}setLeftValuesOfCols($){let{colModel:z}=this.beans;if(!z.getColDefCols())return;let J=z.getCols().slice(0),Z=this.gos.get("enableRtl");for(let X of[this.leftCols,this.rightCols,this.centerCols]){if(Z){let Y=N$(X);for(let q of X)Y-=q.getActualWidth(),q.setLeft(Y,$)}else{let Y=0;for(let q of X)q.setLeft(Y,$),Y+=q.getActualWidth()}DU(J,X)}for(let X of J)X.setLeft(null,$)}joinCols(){if(this.gos.get("enableRtl"))this.allCols=this.rightCols.concat(this.centerCols).concat(this.leftCols);else this.allCols=this.leftCols.concat(this.centerCols).concat(this.rightCols)}getAllTrees(){if(this.treeLeft&&this.treeRight&&this.treeCenter)return this.treeLeft.concat(this.treeCenter).concat(this.treeRight);return null}isColDisplayed($){return this.allCols.indexOf($)>=0}getLeftColsForRow($){let{leftCols:z,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return z;return this.getColsForRow($,z)}getRightColsForRow($){let{rightCols:z,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return z;return this.getColsForRow($,z)}getColsForRow($,z,Q,J){let Z=[],X=null;for(let Y=0;Y1){let W=_-1;for(let B=1;B<=W;B++)H.push(z[Y+B]);Y+=W}let U;if(Q){U=!1;for(let W of H)if(Q(W))U=!0}else U=!0;if(U){if(Z.length===0&&X){if(J?J(q):!1)Z.push(X)}Z.push(q)}X=q}return Z}getContainerWidth($){switch($){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getColBefore($){let z=this.allCols,Q=z.indexOf($);if(Q>0)return z[Q-1];return null}isPinningLeft(){return this.leftCols.length>0}isPinningRight(){return this.rightCols.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};let $=(z)=>{this.colsAndGroupsMap[z.getUniqueId()]=z};yz(this.treeCenter,!1,$),yz(this.treeLeft,!1,$),yz(this.treeRight,!1,$)}isVisible($){return this.colsAndGroupsMap[$.getUniqueId()]===$}getFirstColumn(){let $=this.gos.get("enableRtl"),z=["leftCols","centerCols","rightCols"];if($)z.reverse();for(let Q=0;Q{if(Q$(Q))z.push(Q)}),z}var MU=class extends S{constructor(){super(...arguments);this.beanName="colGroupSvc"}getColumnGroupState(){let $=[],z=this.beans.colModel.getColTree();return O$(null,z,(Q)=>{if(q0(Q))$.push({groupId:Q.getGroupId(),open:Q.isExpanded()})}),$}resetColumnGroupState($){let z=this.beans.colModel.getColDefColTree();if(!z)return;let Q=[];O$(null,z,(J)=>{if(q0(J)){let Z=J.getColGroupDef(),X={groupId:J.getGroupId(),open:!Z?void 0:Z.openByDefault};Q.push(X)}}),this.setColumnGroupState(Q,$)}setColumnGroupState($,z){let{colModel:Q,colAnimation:J,visibleCols:Z,eventSvc:X}=this.beans;if(!Q.getColTree().length)return;J?.start();let q=[];for(let G of $){let{groupId:_,open:H}=G,U=this.getProvidedColGroup(_);if(!U)continue;if(U.isExpanded()===H)continue;U.setExpanded(H),q.push(U)}if(Z.refresh(z,!0),q.length)X.dispatchEvent({type:"columnGroupOpened",columnGroup:q.length===1?q[0]:void 0,columnGroups:q});J?.finish()}setColumnGroupOpened($,z,Q){let J;if(q0($))J=$.getId();else J=$||"";this.setColumnGroupState([{groupId:J,open:z}],Q)}getProvidedColGroup($){let z=null;return O$(null,this.beans.colModel.getColTree(),(Q)=>{if(q0(Q)){if(Q.getId()===$)z=Q}}),z}getGroupAtDirection($,z){let Q=$.getProvidedColumnGroup().getLevel()+$.getPaddingLevel(),J=$.getDisplayedLeafColumns(),Z=z==="After"?b(J):J[0],X=`getCol${z}`;while(!0){let Y=this.beans.visibleCols[X](Z);if(!Y)return null;let q=this.getColGroupAtLevel(Y,Q);if(q!==$)return q}}getColGroupAtLevel($,z){let Q=$.getParent(),J,Z;while(!0){if(J=Q.getProvidedColumnGroup().getLevel(),Z=Q.getPaddingLevel(),J+Z<=z)break;Q=Q.getParent()}return Q}updateOpenClosedVisibility(){let $=this.beans.visibleCols.getAllTrees();yz($,!1,(z)=>{if(H0(z))z.calculateDisplayedColumns()})}getColumnGroup($,z){if(!$)return null;if(H0($))return $;let Q=this.beans.visibleCols.getAllTrees(),J=typeof z==="number",Z=null;return yz(Q,!1,(X)=>{if(H0(X)){let Y=X,q;if(J)q=$===Y.getGroupId()&&z===Y.getPartId();else q=$===Y.getGroupId();if(q)Z=Y}}),Z}createColumnGroups($){let{columns:z,idCreator:Q,pinned:J,oldDisplayedGroups:Z,isStandaloneStructure:X}=$,Y=this.mapOldGroupsById(Z),q=[],G=z;while(G.length){let _=G;G=[];let H=0,U=(W)=>{let B=H;H=W;let E=_[B],L=(H0(E)?E.getProvidedColumnGroup():E).getOriginalParent();if(L==null){for(let F=B;Fq0(H))){G.setChildren([Y]);continue}else{G.setChildren($);break}Z.push(Y)}}return Z}findDepth($){let z=0,Q=$;while(Q?.[0]&&q0(Q[0]))z++,Q=Q[0].getChildren();return z}findMaxDepth($,z){let Q=z;for(let J=0;J<$.length;J++){let Z=$[J];if(q0(Z)){let X=Z,Y=this.findMaxDepth(X.getChildren(),z+1);if(Q=0;X--){let Y=new Cz(null,`FAKE_PATH_${J.getId()}_${X}`,!0,X);this.createBean(Y),Y.setChildren([Z]),Z.originalParent=Y,Z=Y}if(z===0)J.originalParent=null;Q.push(Z)}return Q}findExistingGroup($,z){if($.groupId==null)return;for(let J=0;J{for(let Z of J)if(H0(Z)){let X=Z;z[Z.getUniqueId()]=X,Q(X.getChildren())}};if($)Q($);return z}setupParentsIntoCols($,z){for(let Q of $??[]){if(Q.parent!==z)this.beans.colViewport.colsWithinViewportHash="";if(Q.parent=z,H0(Q)){let J=Q;this.setupParentsIntoCols(J.getChildren(),J)}}}},W4={moduleName:"ColumnGroup",version:p,dynamicBeans:{headerGroupCellCtrl:XU},beans:[MU],apiFunctions:{getAllDisplayedColumnGroups:LU,getCenterDisplayedColumnGroups:EU,getColumnGroup:qU,getColumnGroupState:HU,getDisplayNameForColumnGroup:_U,getLeftDisplayedColumnGroups:BU,getProvidedColumnGroup:GU,getRightDisplayedColumnGroups:KU,resetColumnGroupState:WU,setColumnGroupOpened:YU,setColumnGroupState:UU}};function n0($,z,Q){let{colModel:J,rowGroupColsSvc:Z,pivotColsSvc:X,autoColSvc:Y,selectionColSvc:q,colAnimation:G,visibleCols:_,pivotResultCols:H,environment:U,valueColsSvc:W,eventSvc:B,gos:E}=$,K=J.getColDefCols()??[],L=q?.getColumns();if(!K.length&&!L?.length)return!1;if(z?.state&&!z.state.forEach)return j(32),!1;let D=(V,R,O,I,v)=>{if(!V)return;let C=pq(R,z.defaultState),m=C("flex").value1,w=C("sort").value1,a=C("sortType").value1,t=Zz(w)||h2(a),u=L$(a),$0=vJ(w),s=t?{type:u,direction:$0}:void 0;if(B7($,V,C("hide").value1,s,C("sortIndex").value1,C("pinned").value1,m,Q),m==null){let f0=C("width").value1;if(f0!=null){let O0=V.getColDef().minWidth??U.getDefaultColumnMinWidth();if(O0!=null&&f0>=O0)V.setActualWidth(f0,Q)}}if(v||!V.isPrimary())return;W?.syncColumnWithState(V,Q,C),Z?.syncColumnWithState(V,Q,C,O),X?.syncColumnWithState(V,Q,C,I)},F=(V,R,O)=>{let I=F8($,Q),v=R.slice(),C={},m={},w=[],a=[],t=[],u=0,$0=Z?.columns.slice()??[],s=X?.columns.slice()??[];for(let k0 of V){let Sz=k0.colId;if(Sz.startsWith(uz)){w.push(k0),t.push(k0);continue}if(I$(Sz)){a.push(k0),t.push(k0);continue}let oz=O(Sz);if(!oz)t.push(k0),u+=1;else D(oz,k0,C,m,!1),Z0(v,oz)}let f0=(k0)=>D(k0,null,C,m,!1);v.forEach(f0),Z?.sortColumns(T5.bind(Z,C,$0)),X?.sortColumns(T5.bind(X,m,s)),J.refreshCols(!1,Q);let O0=(k0,Sz,kZ=[])=>{for(let oz of Sz){let X5=k0(oz.colId);Z0(kZ,X5),D(X5,oz,null,null,!0)}kZ.forEach(f0)};return O0((k0)=>Y?.getColumn(k0)??null,w,Y?.getColumns()?.slice()),O0((k0)=>q?.getColumn(k0)??null,a,q?.getColumns()?.slice()),kU(z,J,E),_.refresh(Q),B.dispatchEvent({type:"columnEverythingChanged",source:Q}),I(),{unmatchedAndAutoStates:t,unmatchedCount:u}};G?.start();let{unmatchedAndAutoStates:M,unmatchedCount:k}=F(z.state||[],K,(V)=>J.getColDefCol(V));if(M.length>0||T(z.defaultState)){let V=H?.getPivotResultCols()?.list??[];k=F(M,V,(R)=>H?.getPivotResultCol(R)??null).unmatchedCount}return G?.finish(),k===0}function D8($,z){let{colModel:Q,autoColSvc:J,selectionColSvc:Z,eventSvc:X,gos:Y}=$,q=Q.getColDefCols();if(!q?.length)return;let G=Q.getColDefColTree(),_=IJ(G),H=[],U=1000,W=1000,B=(F)=>{let M=M8(F);if(n(M.rowGroupIndex)&&M.rowGroup)M.rowGroupIndex=U++;if(n(M.pivotIndex)&&M.pivot)M.pivotIndex=W++;H.push(M)};J?.getColumns()?.forEach(B),Z?.getColumns()?.forEach(B),_?.forEach(B),n0($,{state:H},z);let E=J?.getColumns()??[],D=[...Z?.getColumns()??[],...E,...q].map((F)=>({colId:F.colId}));n0($,{state:D,applyOrder:!0},z),X.dispatchEvent(y(Y,{type:"columnsReset",source:z}))}function F8($,z){let{rowGroupColsSvc:Q,pivotColsSvc:J,valueColsSvc:Z,colModel:X,sortSvc:Y,eventSvc:q}=$,G={rowGroupColumns:Q?.columns.slice()??[],pivotColumns:J?.columns.slice()??[],valueColumns:Z?.columns.slice()??[]},_=P5($),H={};for(let U of _)H[U.colId]=U;return()=>{let U=(R,O,I,v)=>{let C=O.map(v),m=I.map(v);if(X0(C,m))return;let a=new Set(O);for(let u of I)if(!a.delete(u))a.add(u);let t=[...a];q.dispatchEvent({type:R,columns:t,column:t.length===1?t[0]:null,source:z})},W=(R)=>{let O=[];return X.forAllCols((I)=>{let v=H[I.getColId()];if(v&&R(v,I))O.push(I)}),O},B=(R)=>R.getColId();U("columnRowGroupChanged",G.rowGroupColumns,Q?.columns??[],B),U("columnPivotChanged",G.pivotColumns,J?.columns??[],B);let K=W((R,O)=>{let I=R.aggFunc!=null,v=I!=O.isValueActive(),C=I&&R.aggFunc!=O.getAggFunc();return v||C});if(K.length>0)K8(q,"columnValueChanged",K,z);LQ(q,W((R,O)=>R.width!=O.getActualWidth()),!0,z),E8(q,W((R,O)=>R.pinned!=O.getPinned()),z),oH(q,W((R,O)=>R.hide==O.isVisible()),z);let k=W((R,O)=>!d1(O.getSortDef(),{type:L$(R.sortType),direction:vJ(R.sort)})||R.sortIndex!=O.getSortIndex());if(k.length>0)Y?.dispatchSortChangedEvents(z,k);let V=P5($);AU(_,V,z,X,q)}}function P5($){let{colModel:z,rowGroupColsSvc:Q,pivotColsSvc:J}=$,Z=z.getColDefCols();if(n(Z)||!z.isAlive())return[];let X=Q?.columns,Y=J?.columns,q=[],G=(H)=>{let U=H.isRowGroupActive()&&X?X.indexOf(H):null,W=H.isPivotActive()&&Y?Y.indexOf(H):null,B=H.isValueActive()?H.getAggFunc():null,E=H.getSortIndex()!=null?H.getSortIndex():null;q.push({colId:H.getColId(),width:H.getActualWidth(),hide:!H.isVisible(),pinned:H.getPinned(),sort:H.getSort(),sortType:H.getSortDef()?.type,sortIndex:E,aggFunc:B,rowGroup:H.isRowGroupActive(),rowGroupIndex:U,pivot:H.isPivotActive(),pivotIndex:W,flex:H.getFlex()??null})};z.forAllCols((H)=>G(H));let _=new Map(z.getCols().map((H,U)=>[H.getColId(),U]));return q.sort((H,U)=>{let W=_.has(H.colId)?_.get(H.colId):-1,B=_.has(U.colId)?_.get(U.colId):-1;return W-B}),q}function M8($){let z=(L,D)=>L!=null?L:D!=null?D:null,Q=$.getColDef(),J=a0(z(Q.sort,Q.initialSort)),Z=J.direction,X=J.type,Y=z(Q.sortIndex,Q.initialSortIndex),q=z(Q.hide,Q.initialHide),G=z(Q.pinned,Q.initialPinned),_=z(Q.width,Q.initialWidth),H=z(Q.flex,Q.initialFlex),U=z(Q.rowGroupIndex,Q.initialRowGroupIndex),W=z(Q.rowGroup,Q.initialRowGroup);if(U==null&&!W)U=null,W=null;let B=z(Q.pivotIndex,Q.initialPivotIndex),E=z(Q.pivot,Q.initialPivot);if(B==null&&!E)B=null,E=null;let K=z(Q.aggFunc,Q.initialAggFunc);return{colId:$.getColId(),sort:Z,sortType:X,sortIndex:Y,hide:q,pinned:G,width:_,flex:H,rowGroup:W,rowGroupIndex:U,pivot:E,pivotIndex:B,aggFunc:K}}function kU($,z,Q){if(!$.applyOrder||!$.state)return;let J=[];for(let Z of $.state)if(Z.colId!=null)J.push(Z.colId);VU(z.cols,J,z,Q)}function VU($,z,Q,J){if($==null)return;let Z=[],X={};for(let q of z){if(X[q])continue;let G=$.map[q];if(G)Z.push(G),X[q]=!0}let Y=0;for(let q of $.list){let G=q.getColId();if(X[G]!=null)continue;if(G.startsWith(uz))Z.splice(Y++,0,q);else Z.push(q)}if(Z=H8(Z,J),!U8(Z,Q.getColTree())){j(39);return}$.list=Z}function AU($,z,Q,J,Z){let X={};for(let H of z)X[H.colId]=H;let Y={};for(let H of $)if(X[H.colId])Y[H.colId]=!0;let q=$.filter((H)=>Y[H.colId]),G=z.filter((H)=>Y[H.colId]),_=[];if(G.forEach((H,U)=>{let W=q?.[U];if(W&&W.colId!==H.colId){let B=J.getCol(W.colId);if(B)_.push(B)}}),!_.length)return;Z.dispatchEvent({type:"columnMoved",columns:_,column:_.length===1?_[0]:null,finished:!0,source:Q})}var T5=($,z,Q,J)=>{let Z=$[Q.getId()],X=$[J.getId()],Y=Z!=null,q=X!=null;if(Y&&q)return Z-X;if(Y)return-1;if(q)return 1;let G=z.indexOf(Q),_=z.indexOf(J),H=G>=0,U=_>=0;if(H&&U)return G-_;if(H)return-1;return 1},SU=class extends S{constructor(){super(...arguments);this.beanName="colModel",this.pivotMode=!1,this.ready=!1,this.changeEventsDispatching=!1}postConstruct(){this.pivotMode=this.gos.get("pivotMode"),this.addManagedPropertyListeners(["groupDisplayType","treeData","treeDataDisplayType","groupHideOpenParents","groupHideColumnsUntilExpanded","rowNumbers","hidePaddedHeaderRows"],($)=>this.refreshAll(Xz($.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],this.recreateColumnDefs.bind(this)),this.addManagedPropertyListener("pivotMode",($)=>this.setPivotMode(this.gos.get("pivotMode"),Xz($.source)))}createColsFromColDefs($){let{beans:z}=this,{valueCache:Q,colAutosize:J,rowGroupColsSvc:Z,pivotColsSvc:X,valueColsSvc:Y,visibleCols:q,eventSvc:G,groupHierarchyColSvc:_}=z,H=this.colDefs?F8(z,$):void 0;Q?.expire();let U=this.colDefCols?.list,W=this.colDefCols?.tree,B=m2(z,this.colDefs,!0,W,$);J$(z,this.colDefCols?.tree,B.columnTree);let{columnTree:E,treeDepth:K}=B,L=IJ(E),D={};for(let F of L)D[F.getId()]=F;if(this.colDefCols={tree:E,treeDepth:K,list:L,map:D},this.createColumnsForService([_],this.colDefCols,$),Z?.extractCols($,U),X?.extractCols($,U),Y?.extractCols($,U),this.ready=!0,this.changeEventsDispatching=!0,this.refreshCols(!0,$),this.changeEventsDispatching=!1,q.refresh($),G.dispatchEvent({type:"columnEverythingChanged",source:$}),H)this.changeEventsDispatching=!0,H(),this.changeEventsDispatching=!1;if(G.dispatchEvent({type:"newColumnsLoaded",source:$}),$==="gridInitializing")J?.applyAutosizeStrategy()}refreshCols($,z){if(!this.colDefCols)return;let Q=this.cols?.tree;this.saveColOrder();let{autoColSvc:J,selectionColSvc:Z,rowNumbersSvc:X,quickFilter:Y,pivotResultCols:q,showRowGroupCols:G,rowAutoHeight:_,visibleCols:H,colViewport:U,eventSvc:W,formula:B}=this.beans,E=this.selectCols(q,this.colDefCols);B?.setFormulasActive(E),this.createColumnsForService([J,Z,X],E,z);let K=Aq(this.gos,this.showingPivotResult);if(!$||K)this.restoreColOrder(E);if(this.positionLockedCols(E),G?.refresh(),Y?.refreshCols(),this.setColSpanActive(),_?.setAutoHeightActive(E),H.clear(),U.clear(),!X0(Q,this.cols.tree))W.dispatchEvent({type:"gridColumnsChanged"})}createColumnsForService($,z,Q){for(let J of $){if(!J)continue;J.createColumns(z,(Z)=>{this.lastOrder=Z(this.lastOrder),this.lastPivotOrder=Z(this.lastPivotOrder)},Q),J.addColumns(z)}}selectCols($,z){let Q=$?.getPivotResultCols()??null;this.showingPivotResult=Q!=null;let{map:J,list:Z,tree:X,treeDepth:Y}=Q??z;if(this.cols={list:Z.slice(),map:{...J},tree:X.slice(),treeDepth:Y},Q){if(!Q.list.some((G)=>this.cols?.map[G.getColId()]!==void 0))this.lastPivotOrder=null}return this.cols}getColsToShow(){if(!this.cols)return[];let{beans:$,showingPivotResult:z,cols:Q}=this,{valueColsSvc:J,selectionColSvc:Z,gos:X}=$,Y=this.isPivotMode()&&!z,q=Z?.isSelectionColumnEnabled(),G=Sq($),_=J?.columns,H=w2(X);return Q.list.filter((W)=>{let B=mz(W);if(Y)return _?.includes(W)||B&&(!H||W.isVisible())||q&&I$(W)||G&&v0(W);else return B&&!H||W.isVisible()})}refreshAll($){if(!this.ready)return;this.refreshCols(!1,$),this.beans.visibleCols.refresh($)}setColsVisible($,z=!1,Q){n0(this.beans,{state:$.map((J)=>({colId:typeof J==="string"?J:J.getColId(),hide:!z}))},Q)}restoreColOrder($){let z=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!z)return;let Q=z.filter((U)=>$.map[U.getId()]!=null);if(Q.length===0)return;if(Q.length===$.list.length){$.list=Q;return}let J=(U)=>{let W=U.getOriginalParent();if(!W)return!1;if(W.getChildren().length>1)return!0;return J(W)};if(!Q.some((U)=>J(U))){let U=new Set(Q);for(let W of $.list)if(!U.has(W))Q.push(W);$.list=Q;return}let Z=new Map;for(let U=0;U!Z.has(U));if(X.length===0){$.list=Q;return}let Y=(U,W)=>{let B=W?W.getOriginalParent():U.getOriginalParent();if(!B)return null;let E=null,K=null;for(let L of B.getChildren()){if(L===W||L===U)continue;if(L instanceof q$){let D=Z.get(L);if(D==null)continue;if(E==null||E{let F=Z.get(D);if(F==null)return;if(E==null||E=0;U--)_[H--]=q[U];for(let U=Q.length-1;U>=0;U--){let W=Q[U],B=G.get(W);if(B)if(Array.isArray(B))for(let E=B.length-1;E>=0;E--){let K=B[E];_[H--]=K}else _[H--]=B;_[H--]=W}$.list=_}positionLockedCols($){$.list=H8($.list,this.gos)}saveColOrder(){if(this.showingPivotResult)this.lastPivotOrder=this.cols?.list??null;else this.lastOrder=this.cols?.list??null}getColumnDefs($){return this.colDefCols&&this.beans.colDefFactory?.getColumnDefs(this.colDefCols.list,this.showingPivotResult,this.lastOrder,this.cols?.list??[],$)}setColSpanActive(){this.colSpanActive=!!this.cols?.list.some(($)=>$.getColDef().colSpan!=null)}isPivotMode(){return this.pivotMode}setPivotMode($,z){if($===this.pivotMode)return;if(this.pivotMode=$,!this.ready)return;this.refreshCols(!1,z);let{visibleCols:Q,eventSvc:J}=this.beans;Q.refresh(z),J.dispatchEvent({type:"columnPivotModeChanged"})}isPivotActive(){let $=this.beans.pivotColsSvc?.columns;return this.pivotMode&&!!$?.length}recreateColumnDefs($){if(!this.cols)return;this.beans.autoColSvc?.updateColumns($);let z=Xz($.source);this.createColsFromColDefs(z)}setColumnDefs($,z){this.colDefs=$,this.createColsFromColDefs(z)}destroy(){J$(this.beans,this.colDefCols?.tree),super.destroy()}getColTree(){return this.cols?.tree??[]}getColDefColTree(){return this.colDefCols?.tree??[]}getColDefCols(){return this.colDefCols?.list??null}getCols(){return this.cols?.list??[]}forAllCols($){let{pivotResultCols:z,autoColSvc:Q,selectionColSvc:J,groupHierarchyColSvc:Z}=this.beans;if(IQ(this.colDefCols?.list,$))return;if(IQ(Q?.columns?.list,$))return;if(IQ(J?.columns?.list,$))return;if(IQ(Z?.columns?.list,$))return;if(IQ(z?.getPivotResultCols()?.list,$))return}getColsForKeys($){if(!$)return[];return $.map((z)=>this.getCol(z)).filter((z)=>z!=null)}getColDefCol($){if(!this.colDefCols?.list)return null;return this.getColFromCollection($,this.colDefCols)}getCol($){if($==null)return null;return this.getColFromCollection($,this.cols)}getColById($){return this.cols?.map[$]??null}getColFromCollection($,z){if(z==null)return null;let{map:Q,list:J}=z;if(typeof $=="string"&&Q[$])return Q[$];for(let q=0;q$(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth($){return f$(this.getGui(),$),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue($,z){if(this.value===$)return this;if(this.previousValue=this.value,this.value=$,!z)this.dispatchLocalEvent({type:"fieldValueChanged"});return this}};function OU($){return{tag:"div",role:"presentation",children:[{tag:"div",ref:"eLabel",cls:"ag-input-field-label"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-input-wrapper",role:"presentation",children:[{tag:$,ref:"eInput",cls:"ag-input-field-input"}]}]}}var k8=class extends fU{constructor($,z,Q="text",J="input"){super($,$?.template??OU(J),[],z);this.inputType=Q,this.displayFieldTag=J,this.eLabel=f,this.eWrapper=f,this.eInput=f}postConstruct(){super.postConstruct(),this.setInputType(this.inputType);let{eLabel:$,eWrapper:z,eInput:Q,className:J}=this;$.classList.add(`${J}-label`),z.classList.add(`${J}-input-wrapper`),Q.classList.add(`${J}-input`),this.addCss("ag-input-field"),Q.id=Q.id||`ag-${this.getCompId()}-input`;let{inputName:Z,inputWidth:X,inputPlaceholder:Y,autoComplete:q,tabIndex:G}=this.config;if(Z!=null)this.setInputName(Z);if(X!=null)this.setInputWidth(X);if(Y!=null)this.setInputPlaceholder(Y);if(q!=null)this.setAutoComplete(q);this.addInputListeners(),this.activateTabIndex([Q],G)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:($)=>this.setValue($.target.value)})}setInputType($){if(this.displayFieldTag==="input")this.inputType=$,Pz(this.eInput,"type",$)}getInputElement(){return this.eInput}getWrapperElement(){return this.eWrapper}setInputWidth($){return w6(this.eWrapper,$),this}setInputName($){return this.getInputElement().setAttribute("name",$),this}getFocusableElement(){return this.eInput}setMaxLength($){let z=this.eInput;return z.maxLength=$,this}setInputPlaceholder($){return Pz(this.eInput,"placeholder",$),this}setInputAriaLabel($){return E0(this.eInput,$),this.refreshAriaLabelledBy(),this}setDisabled($){return P2(this.eInput,$),super.setDisabled($)}setAutoComplete($){if($===!0)Pz(this.eInput,"autocomplete",null);else{let z=typeof $==="string"?$:"off";Pz(this.eInput,"autocomplete",z)}return this}},B4=class extends k8{constructor($,z="ag-checkbox",Q="checkbox"){super($,z,Q);this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();let{readOnly:$,passive:z,name:Q}=this.config;if(typeof $==="boolean")this.setReadOnly($);if(typeof z==="boolean")this.setPassive(z);if(Q!=null)this.setName(Q)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return this.selected===void 0?!0:!this.selected}setPassive($){this.passive=$}isReadOnly(){return this.readOnly}setReadOnly($){this.eWrapper.classList.toggle("ag-disabled",$),this.eInput.disabled=$,this.readOnly=$}setDisabled($){return this.eWrapper.classList.toggle("ag-disabled",$),super.setDisabled($)}toggle(){if(this.eInput.disabled)return;let $=this.isSelected(),z=this.getNextValue();if(this.passive)this.dispatchChange(z,$);else this.setValue(z)}getValue(){return this.isSelected()}setValue($,z){return this.refreshSelectedClass($),this.setSelected($,z),this}setName($){let z=this.getInputElement();return z.name=$,this}isSelected(){return this.selected}setSelected($,z){if(this.isSelected()===$)return;this.previousValue=this.isSelected(),$=this.selected=typeof $==="boolean"?$:void 0;let Q=this.eInput;if(Q.checked=$,Q.indeterminate=$===void 0,!z)this.dispatchChange(this.selected,this.previousValue)}dispatchChange($,z,Q){this.dispatchLocalEvent({type:"fieldValueChanged",selected:$,previousValue:z,event:Q});let J=this.getInputElement();this.eventSvc.dispatchEvent({type:"checkboxChanged",id:J.id,name:J.name,selected:$,previousValue:z})}onCheckboxClick($){if(this.passive||this.eInput.disabled)return;let z=this.isSelected(),Q=this.selected=$.target.checked;this.refreshSelectedClass(Q),this.dispatchChange(Q,z,$)}refreshSelectedClass($){let z=this.eWrapper.classList;z.toggle("ag-checked",$===!0),z.toggle("ag-indeterminate",$==null)}},y$={selector:"AG-CHECKBOX",component:B4},PU=".ag-checkbox-cell{height:100%}",TU={tag:"div",cls:"ag-cell-wrapper ag-checkbox-cell",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},vU=class extends x{constructor(){super(TU,[y$]);this.eCheckbox=f,this.registerCSS(PU)}init($){this.refresh($);let{eCheckbox:z,beans:Q}=this,J=z.getInputElement();J.setAttribute("tabindex","-1"),k6(J,"polite"),this.addManagedListeners(J,{click:(Z)=>{if(i0(Z),z.isDisabled())return;let X=z.getValue();this.onCheckboxChanged(X)},dblclick:(Z)=>{i0(Z)}}),this.addManagedElementListeners($.eGridCell,{keydown:(Z)=>{if(Z.key===A.SPACE&&!z.isDisabled()){if($.eGridCell===d(Q))z.toggle();let X=z.getValue();this.onCheckboxChanged(X),Z.preventDefault()}}})}refresh($){return this.params=$,this.updateCheckbox($),!0}updateCheckbox($){let z,Q=!0,{value:J,column:Z,node:X}=$;if(X.group&&Z)if(typeof J==="boolean")z=J;else{let U=Z.getColId();if(U.startsWith(uz))z=J==null||J===""?void 0:J==="true";else if(X.aggData&&X.aggData[U]!==void 0)z=J??void 0;else if(X.sourceRowIndex>=0)z=J??void 0;else Q=!1}else z=J??void 0;let{eCheckbox:Y}=this;if(!Q){Y.setDisplayed(!1);return}Y.setValue(z);let q=$.disabled??!Z?.isCellEditable(X);Y.setDisabled(q);let G=this.getLocaleTextFunc(),_=f2(G,z),H=q?_:`${G("ariaToggleCellValue","Press SPACE to toggle cell value")} (${_})`;Y.setInputAriaLabel(H)}onCheckboxChanged($){let{params:z}=this,{column:Q,node:J,value:Z}=z,{editSvc:X}=this.beans;if(!Q)return;let Y={rowNode:J,column:Q};X?.dispatchCellEvent(Y,null,"cellEditingStarted",{value:Z});let q=J.setDataValue(Q,$,"ui");if(X?.dispatchCellEvent(Y,null,"cellEditingStopped",{oldValue:Z,newValue:$,valueChanged:q}),!q)this.updateCheckbox(z)}},IU={tag:"div",cls:"ag-skeleton-container"},CU=class extends x{constructor(){super(IU)}init($){let z=`ag-cell-skeleton-renderer-${this.getCompId()}`;if(this.getGui().setAttribute("id",z),this.addDestroyFunc(()=>pQ($.eParentOfValue)),pQ($.eParentOfValue,z),$.deferRender)this.setupLoading($);else if($.node.failedLoad)this.setupFailed();else this.setupLoading($)}setupFailed(){let $=this.getLocaleTextFunc();this.getGui().textContent=$("loadingError","ERR");let z=$("ariaSkeletonCellLoadingFailed","Row failed to load");E0(this.getGui(),z)}setupLoading($){let z=J0({tag:"div",cls:"ag-skeleton-effect"}),Q=$.node.rowIndex;if(Q!=null){let X=75+25*(Q%2===0?Math.sin(Q):Math.cos(Q));z.style.width=`${X}%`}this.getGui().appendChild(z);let J=this.getLocaleTextFunc(),Z=$.deferRender?J("ariaDeferSkeletonCellLoading","Cell is loading"):J("ariaSkeletonCellLoading","Row data is loading");E0(this.getGui(),Z)}refresh($){return!1}},bU={moduleName:"CheckboxCellRenderer",version:p,userComponents:{agCheckboxCellRenderer:vU}},yU={moduleName:"SkeletonCellRenderer",version:p,userComponents:{agSkeletonCellRenderer:CU}};var xU=class extends S{constructor(){super(...arguments);this.beanName="colFlex",this.columnsHidden=!1}refreshFlexedColumns($={}){let z=$.source??"flex";if($.viewportWidth!=null)this.flexViewportWidth=$.viewportWidth;let Q=this.flexViewportWidth,{visibleCols:J,colDelayRenderSvc:Z}=this.beans,X=J.centerCols,Y=-1;if($.resizingCols){let K=new Set($.resizingCols);for(let L=X.length-1;L>=0;L--)if(K.has(X[L])){Y=L;break}}let q=!1,G=X.map((K,L)=>{let D=K.getFlex(),F=D!=null&&D>0&&L>Y;return q||(q=F),{col:K,isFlex:F,flex:Math.max(0,D??0),initialSize:K.getActualWidth(),min:K.getMinWidth(),max:K.getMaxWidth(),targetSize:0}});if(q)Z?.hideColumns("colFlex"),this.columnsHidden=!0;else if(this.columnsHidden)this.revealColumns(Z);if(!Q||!q)return[];let _=G.length,H=G.reduce((K,L)=>K+L.flex,0),U=Q,W=(K,L)=>{K.frozenSize=L,K.col.setActualWidth(L,z),U-=L,H-=K.flex,_-=1},B=(K)=>K.frozenSize!=null;for(let K of G)if(!K.isFlex)W(K,K.initialSize);while(_>0){let K=Math.round(H<1?U*H:U),L,D=0,F=0;for(let V of G){if(B(V))continue;L=V,F+=K*(V.flex/H);let R=F-D,O=Math.round(R);V.targetSize=O,D+=O}if(L)L.targetSize+=K-D;let M=0;for(let V of G){if(B(V))continue;let R=V.targetSize,O=Math.min(Math.max(R,V.min),V.max);M+=O-R,V.violationType=O===R?void 0:O0?"min":"max";for(let V of G){if(B(V))continue;if(k==="all"||V.violationType===k)W(V,V.targetSize)}}if(!$.skipSetLeft)J.setLeftValues(z);if($.updateBodyWidths)J.updateBodyWidths();let E=G.filter((K)=>K.isFlex&&!K.violationType).map((K)=>K.col);if($.fireResizedEvent){let K=G.filter((D)=>D.initialSize!==D.frozenSize).map((D)=>D.col),L=G.filter((D)=>D.flex).map((D)=>D.col);LQ(this.eventSvc,K,!0,z,L)}return this.revealColumns(Z),E}revealColumns($){if(this.columnsHidden)$?.revealColumns("colFlex"),this.columnsHidden=!1}initCol($){let{flex:z,initialFlex:Q}=$.colDef;if(z!==void 0)$.flex=z;else if(Q!==void 0)$.flex=Q}setColFlex($,z){$.flex=z??null,$.dispatchStateUpdatedEvent("flex")}},Gz=($)=>{if(typeof $==="bigint")return $;let z;if(typeof $==="number")z=$;else if(typeof $==="string"){if(z=$.trim(),z==="")return null;if(z.endsWith("n"))z=z.slice(0,-1);if(!/^[+-]?\d+$/.test(z))return null}if(z==null)return null;try{return BigInt(z)}catch{return null}},E4="T",wU=new RegExp(`[${E4} ]`),NU=new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${E4}\\d{2}:\\d{2}:\\d{2}\\D?)?`);function fz($,z){return $.toString().padStart(z,"0")}function v5($,z=!0,Q=E4){if(!$)return null;let J=[$.getFullYear(),$.getMonth()+1,$.getDate()].map((Z)=>fz(Z,2)).join("-");if(z)J+=Q+[$.getHours(),$.getMinutes(),$.getSeconds()].map((Z)=>fz(Z,2)).join(":");return J}function ZQ($,z=!0){if(!$)return null;if(z)return[String($.getFullYear()),String($.getMonth()+1),fz($.getDate(),2),fz($.getHours(),2),`:${fz($.getMinutes(),2)}`,`:${fz($.getSeconds(),2)}`];return[$.getFullYear(),$.getMonth()+1,fz($.getDate(),2)].map(String)}var K4=["January","February","March","April","May","June","July","August","September","October","November","December"];function s1($,z=!1){return!!eQ($,z)}function gU($){return s1($,!0)}function eQ($,z=!1,Q){if(!$)return null;if(!Q&&!NU.test($))return null;let[J,Z]=$.split(wU);if(!J)return null;let X=J.split("-").map((B)=>Number.parseInt(B,10));if(X.filter((B)=>!isNaN(B)).length!==3)return null;let[Y,q,G]=X,_=new Date(Y,q-1,G);if(_.getFullYear()!==Y||_.getMonth()!==q-1||_.getDate()!==G)return null;if(!Z&&z)return null;if(!Z||Z==="00:00:00")return _;let[H,U,W]=Z.split(":").map((B)=>Number.parseInt(B,10));if(H>=0&&H<24)_.setHours(H);else if(z)return null;if(U>=0&&U<60)_.setMinutes(U);else if(z)return null;if(W>=0&&W<60)_.setSeconds(W);else if(z)return null;return _}function hQ($,z,Q){if(!z||!$)return;if(!Q)return $[z];let J=z.split("."),Z=$;for(let X=0;Xnull,suppressKeyboardEvent:({node:$,event:z,column:Q})=>z.key===A.SPACE&&Q.isCellEditable($)}},date({formatValue:$}){return{cellEditor:"agDateCellEditor",keyCreator:$}},dateString({formatValue:$}){return{cellEditor:"agDateStringCellEditor",keyCreator:$}},dateTime($){return this.date($)},dateTimeString($){return this.dateString($)},object({formatValue:$,colModel:z,colId:Q}){return{cellEditorParams:{useFormatter:!0},comparator:(J,Z)=>{let X=z.getColDefCol(Q),Y=X?.getColDef();if(!X||!Y)return 0;let q=J==null?"":$({column:X,node:null,value:J}),G=Z==null?"":$({column:X,node:null,value:Z});if(q===G)return 0;return q>G?1:-1},keyCreator:$}},text(){return{}}}}wireBeans($){this.colModel=$.colModel}postConstruct(){this.processDataTypeDefinitions(),this.addManagedPropertyListener("dataTypeDefinitions",($)=>{this.processDataTypeDefinitions(),this.colModel.recreateColumnDefs($)})}processDataTypeDefinitions(){let $=this.getDefaultDataTypes(),z={},Q={},J=(H)=>{return(U)=>{let{column:W,node:B,value:E}=U,K=W.getColDef().valueFormatter;if(K===H.groupSafeValueFormatter)K=H.valueFormatter;return this.beans.valueSvc.formatValue(W,B,E,K)}};for(let H of Object.keys($)){let U=$[H],W={...U,groupSafeValueFormatter:b5(U,this.gos)};z[H]=W,Q[H]=J(W)}let Z=this.gos.get("dataTypeDefinitions")??{},X={};for(let H of Object.keys(Z)){let U=Z[H],W=this.processDataTypeDefinition(U,Z,[H],$);if(W){if(z[H]=W,U.dataTypeMatcher)X[H]=U.dataTypeMatcher;Q[H]=J(W)}}let{valueParser:Y,valueFormatter:q}=$.object,{valueParser:G,valueFormatter:_}=z.object;this.hasObjectValueParser=G!==Y,this.hasObjectValueFormatter=_!==q,this.formatValueFuncs=Q,this.dataTypeDefinitions=z,this.dataTypeMatchers=this.sortKeysInMatchers(X,$)}sortKeysInMatchers($,z){let Q={...$};for(let J of hU)delete Q[J],Q[J]=$[J]??z[J].dataTypeMatcher;return Q}processDataTypeDefinition($,z,Q,J){let Z,X=$.extendsDataType;if($.columnTypes)this.isColumnTypeOverrideInDataTypeDefinitions=!0;if($.extendsDataType===$.baseDataType){let Y=J[X],q=z[X];if(Y&&q)Y=q;if(!C5($,Y,X))return;Z=I5(Y,$)}else{if(Q.includes(X)){j(44);return}let Y=z[X];if(!C5($,Y,X))return;let q=this.processDataTypeDefinition(Y,z,[...Q,X],J);if(!q)return;Z=I5(q,$)}return{...Z,groupSafeValueFormatter:b5(Z,this.gos)}}updateColDefAndGetColumnType($,z,Q){let{cellDataType:J}=z;if(J===void 0)J=$.cellDataType;let{field:Z}=z;if(J==null||J===!0)J=this.canInferCellDataType($,z)?this.inferCellDataType(Z,Q):!1;if(this.addFormulaCellEditorToColDef($,z),!J){$.cellDataType=!1;return}let X=this.dataTypeDefinitions[J];if(!X){j(47,{cellDataType:J});return}if($.cellDataType=J,X.groupSafeValueFormatter)$.valueFormatter=X.groupSafeValueFormatter;if(X.valueParser)$.valueParser=X.valueParser;if(!X.suppressDefaultProperties)this.setColDefPropertiesForBaseDataType($,J,X,Q);return X.columnTypes}addFormulaCellEditorToColDef($,z){if(!(z.allowFormula??$.allowFormula)||z.cellEditor)return;$.cellEditor="agFormulaCellEditor"}addColumnListeners($){if(!this.isPendingInference)return;let z=this.columnStateUpdatesPendingInference[$.getColId()];if(!z)return;let Q=(J)=>{z.add(J.key)};$.__addEventListener("columnStateUpdated",Q),this.columnStateUpdateListenerDestroyFuncs.push(()=>$.__removeEventListener("columnStateUpdated",Q))}canInferCellDataType($,z){let{gos:Q}=this;if(!o(Q))return!1;let J={cellRenderer:!0,valueGetter:!0,valueParser:!0,refData:!0};if(pZ(z,J))return!1;let Z=z.type===null?$.type:z.type;if(Z){let X=Q.get("columnTypes")??{};if(ZJ(Z).some((q)=>{let G=X[q.trim()];return G&&pZ(G,J)}))return!1}return!pZ($,J)}inferCellDataType($,z){if(!$)return;let Q,J=this.getInitialData();if(J){let X=$.includes(".")&&!this.gos.get("suppressFieldDotNotation");Q=hQ(J,$,X)}else this.initWaitForRowData(z);if(Q==null)return;return Object.keys(this.dataTypeMatchers).find((X)=>this.dataTypeMatchers[X](Q))??"object"}getInitialData(){let $=this.gos.get("rowData");if($?.length)return $[0];else if(this.initialData)return this.initialData;else{let z=this.beans.rowModel.rootNode?._leafs;if(z?.length)return z[0].data}return null}initWaitForRowData($){if(this.columnStateUpdatesPendingInference[$]=new Set,this.isPendingInference)return;this.isPendingInference=!0;let z=this.isColumnTypeOverrideInDataTypeDefinitions,{colAutosize:Q,eventSvc:J}=this.beans;if(z&&Q)Q.shouldQueueResizeOperations=!0;let[Z]=this.addManagedEventListeners({rowDataUpdateStarted:(X)=>{let{firstRowData:Y}=X;if(!Y)return;if(Z?.(),this.isPendingInference=!1,this.processColumnsPendingInference(Y,z),this.columnStateUpdatesPendingInference={},z)Q?.processResizeOperations();J.dispatchEvent({type:"dataTypesInferred"})}})}processColumnsPendingInference($,z){this.initialData=$;let Q=[];this.destroyColumnStateUpdateListeners();let J={},Z={};for(let X of Object.keys(this.columnStateUpdatesPendingInference)){let Y=this.columnStateUpdatesPendingInference[X],q=this.colModel.getCol(X);if(!q)continue;let G=q.getColDef();if(!this.resetColDefIntoCol(q,"cellDataTypeInferred"))continue;let _=q.getColDef();if(z&&_.type&&_.type!==G.type){let H=dU(q,Y);if(H.rowGroup&&H.rowGroupIndex==null)J[X]=H;if(H.pivot&&H.pivotIndex==null)Z[X]=H;Q.push(H)}}if(z)Q.push(...this.generateColumnStateForRowGroupAndPivotIndexes(J,Z));if(Q.length)n0(this.beans,{state:Q},"cellDataTypeInferred");this.initialData=null}generateColumnStateForRowGroupAndPivotIndexes($,z){let Q={},{rowGroupColsSvc:J,pivotColsSvc:Z}=this.beans;return J?.restoreColumnOrder(Q,$),Z?.restoreColumnOrder(Q,z),Object.values(Q)}resetColDefIntoCol($,z){let Q=$.getUserProvidedColDef();if(!Q)return!1;let J=u$(this.beans,Q,$.getColId());return $.setColDef(J,Q,z),!0}getDateStringTypeDefinition($){let{dateString:z}=this.dataTypeDefinitions;if(!$)return z;return this.getDataTypeDefinition($)??z}getDateParserFunction($){return this.getDateStringTypeDefinition($).dateParser}getDateFormatterFunction($){return this.getDateStringTypeDefinition($).dateFormatter}getDateIncludesTimeFlag($){return $==="dateTime"||$==="dateTimeString"}getDataTypeDefinition($){let z=$.getColDef();if(!z.cellDataType)return;return this.dataTypeDefinitions[z.cellDataType]}getBaseDataType($){return this.getDataTypeDefinition($)?.baseDataType}checkType($,z){if(z==null)return!0;let Q=this.getDataTypeDefinition($)?.dataTypeMatcher;if(!Q)return!0;if($.getColDef().allowFormula&&this.beans.formula?.isFormula(z))return!0;return Q(z)}validateColDef($,z,Q,J){if($.cellDataType==="object"){let Z=(G)=>{return G?.cellDataType==null||G?.cellDataType===!0},X=Z(z)&&Z(Q),Y=(G)=>j(48,{property:G,inferred:X,colId:J}),{object:q}=this.dataTypeDefinitions;if($.valueFormatter===q.groupSafeValueFormatter&&!this.hasObjectValueFormatter)Y("Formatter");if($.editable&&$.valueParser===q.valueParser&&!this.hasObjectValueParser)Y("Parser")}}postProcess($){let z=$.cellDataType;if(!z||typeof z!=="string")return;let{dataTypeDefinitions:Q,beans:J,formatValueFuncs:Z}=this,X=Q[z];if(!X)return;J.colFilter?.setColDefPropsForDataType($,X,Z[z])}getFormatValue($){return this.formatValueFuncs[$]}isColPendingInference($){return this.isPendingInference&&!!this.columnStateUpdatesPendingInference[$]}setColDefPropertiesForBaseDataType($,z,Q,J){let Z=this.formatValueFuncs[z],X=this.columnDefinitionPropsPerDataType[Q.baseDataType]({colDef:$,cellDataType:z,colModel:this.colModel,dataTypeDefinition:Q,colId:J,formatValue:Z,filterModuleBean:this.beans.filterManager});if($.cellEditor==="agFormulaCellEditor"&&X.cellEditor!==$.cellEditor)X.cellEditor=$.cellEditor;Object.assign($,X)}getDateObjectTypeDef($){let z=this.getLocaleTextFunc(),Q=this.getDateIncludesTimeFlag($);return{baseDataType:$,valueParser:(J)=>eQ(J.newValue&&String(J.newValue)),valueFormatter:(J)=>{if(J.value==null)return"";if(!(J.value instanceof Date)||isNaN(J.value.getTime()))return z("invalidDate","Invalid Date");return v5(J.value,Q)??""},dataTypeMatcher:(J)=>J instanceof Date}}getDateStringTypeDef($){let z=this.getDateIncludesTimeFlag($);return{baseDataType:$,dateParser:(Q)=>eQ(Q)??void 0,dateFormatter:(Q)=>v5(Q??null,z)??void 0,valueParser:(Q)=>s1(String(Q.newValue))?Q.newValue:null,valueFormatter:(Q)=>s1(String(Q.value))?String(Q.value):"",dataTypeMatcher:(Q)=>typeof Q==="string"&&s1(Q)}}getDefaultDataTypes(){let $=this.getLocaleTextFunc();return{number:{baseDataType:"number",valueParser:(z)=>z.newValue?.trim?.()===""?null:Number(z.newValue),valueFormatter:(z)=>{if(z.value==null)return"";if(typeof z.value!=="number"||isNaN(z.value))return $("invalidNumber","Invalid Number");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="number"},bigint:{baseDataType:"bigint",valueParser:(z)=>{let{newValue:Q}=z;if(Q==null)return null;if(typeof Q==="string"&&Q.trim()==="")return null;return Gz(Q)},valueFormatter:(z)=>{if(z.value==null)return"";if(typeof z.value!=="bigint")return $("invalidBigInt","Invalid BigInt");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="bigint"},text:{baseDataType:"text",valueParser:(z)=>z.newValue===""?null:cQ(z.newValue),dataTypeMatcher:(z)=>typeof z==="string"},boolean:{baseDataType:"boolean",valueParser:(z)=>{if(z.newValue==null)return z.newValue;return z.newValue?.trim?.()===""?null:String(z.newValue).toLowerCase()==="true"},valueFormatter:(z)=>z.value==null?"":String(z.value),dataTypeMatcher:(z)=>typeof z==="boolean"},date:this.getDateObjectTypeDef("date"),dateString:this.getDateStringTypeDef("dateString"),dateTime:this.getDateObjectTypeDef("dateTime"),dateTimeString:{...this.getDateStringTypeDef("dateTimeString"),dataTypeMatcher:(z)=>typeof z==="string"&&gU(z)},object:{baseDataType:"object",valueParser:()=>null,valueFormatter:(z)=>cQ(z.value)??""}}}destroyColumnStateUpdateListeners(){for(let $ of this.columnStateUpdateListenerDestroyFuncs)$();this.columnStateUpdateListenerDestroyFuncs=[]}destroy(){this.dataTypeDefinitions={},this.dataTypeMatchers={},this.formatValueFuncs={},this.columnStateUpdatesPendingInference={},this.destroyColumnStateUpdateListeners(),super.destroy()}};function I5($,z){let Q={...$,...z};if($.columnTypes&&z.columnTypes&&z.appendColumnTypes)Q.columnTypes=[...ZJ($.columnTypes),...ZJ(z.columnTypes)];return Q}function C5($,z,Q){if(!z)return j(45,{parentCellDataType:Q}),!1;if(z.baseDataType!==$.baseDataType)return j(46),!1;return!0}var mU=($)=>typeof $==="bigint"||typeof $==="number",cU=($)=>$==="number"||$==="bigint";function b5($,z){if(!$.valueFormatter)return;return(Q)=>{let{node:J,colDef:Z,column:X,value:Y}=Q;if(J?.group){let q=(Z.pivotValueColumn??X).getAggFunc();if(q){if(q==="first"||q==="last")return $.valueFormatter(Q);let{baseDataType:G}=$;if(cU(G)&&q!=="count"){if(mU(Y))return $.valueFormatter(Q);if(Y==null)return;if(typeof Y==="object"){if(typeof Y.toNumber==="function")return $.valueFormatter({...Q,value:Y.toNumber()});if("value"in Y)return $.valueFormatter({...Q,value:Y.value})}}return}}else if(z.get("groupHideOpenParents")&&Q.column.isRowGroupActive()){if(typeof Q.value==="string"&&!$.dataTypeMatcher?.(Q.value))return}return $.valueFormatter(Q)}}function pU($,z,Q,J){if(!z[Q])return!1;let Z=$[Q];if(Z===null)return z[Q]=!1,!1;else return J===void 0?!!Z:Z===J}function iU($,z){if($==null)return z==null?0:-1;if(z==null)return 1;let Q=Gz($),J=Gz(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return 0}function nU($,z){if($==null)return z==null?0:-1;if(z==null)return 1;let Q=y5($),J=y5(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return 0}function y5($){let z=Gz($);if(z==null)return null;return z<0n?-z:z}function pZ($,z){return[["cellRenderer","agSparklineCellRenderer"],["valueGetter",void 0],["valueParser",void 0],["refData",void 0]].some(([Q,J])=>pU($,z,Q,J))}function dU($,z){let Q=M8($);for(let J of z)if(delete Q[J],J==="rowGroup")delete Q.rowGroupIndex;else if(J==="pivot")delete Q.pivotIndex;return Q}var tU={moduleName:"DataType",version:p,beans:[uU],dependsOn:[bU]},sU={moduleName:"ColumnFlex",version:p,beans:[xU]};var rU=class extends S{constructor(){super(...arguments);this.beanName="colNames"}getDisplayNameForColumn($,z,Q=!1){if(!$)return null;let J=this.getHeaderName($.getColDef(),$,null,null,z),{aggColNameSvc:Z}=this.beans;if(Q&&Z)return Z.getHeaderName($,J);return J}getDisplayNameForProvidedColumnGroup($,z,Q){let J=z?.getColGroupDef();if(J)return this.getHeaderName(J,null,$,z,Q);return null}getDisplayNameForColumnGroup($,z){return this.getDisplayNameForProvidedColumnGroup($,$.getProvidedColumnGroup(),z)}getHeaderName($,z,Q,J,Z){let X=$.headerValueGetter;if(X){let Y=y(this.gos,{colDef:$,column:z,columnGroup:Q,providedColumnGroup:J,location:Z});if(typeof X==="function")return X(Y);else if(typeof X==="string")return this.beans.expressionSvc?.evaluate(X,Y)??null;return""}else if($.headerName!=null)return $.headerName;else if($.field)return RY($.field);return""}},lU=class extends S{constructor(){super(...arguments);this.beanName="colViewport",this.colsWithinViewport=[],this.headerColsWithinViewport=[],this.colsWithinViewportHash="",this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.columnsToRenderLeft=[],this.columnsToRenderRight=[],this.columnsToRenderCenter=[]}wireBeans($){this.visibleCols=$.visibleCols,this.colModel=$.colModel}postConstruct(){this.suppressColumnVirtualisation=this.gos.get("suppressColumnVirtualisation")}getScrollPosition(){return this.scrollPosition}setScrollPosition($,z,Q=!1){let{visibleCols:J}=this,Z=J.isBodyWidthDirty;if($===this.scrollWidth&&z===this.scrollPosition&&!Z)return;if(this.scrollWidth=$,this.scrollPosition=z,J.isBodyWidthDirty=!0,this.gos.get("enableRtl")){let Y=J.bodyWidth;this.viewportLeft=Y-z-$,this.viewportRight=Y-z}else this.viewportLeft=z,this.viewportRight=$+z;if(this.colModel.ready)this.checkViewportColumns(Q)}getColumnHeadersToRender($){switch($){case"left":return this.columnsToRenderLeft;case"right":return this.columnsToRenderRight;default:return this.columnsToRenderCenter}}getHeadersToRender($,z){let Q;switch($){case"left":Q=this.rowsOfHeadersToRenderLeft[z];break;case"right":Q=this.rowsOfHeadersToRenderRight[z];break;default:Q=this.rowsOfHeadersToRenderCenter[z];break}return Q??[]}extractViewportColumns(){let $=this.visibleCols.centerCols;if(this.isColumnVirtualisationSuppressed())this.colsWithinViewport=$,this.headerColsWithinViewport=$;else this.colsWithinViewport=$.filter(this.isColumnInRowViewport.bind(this)),this.headerColsWithinViewport=$.filter(this.isColumnInHeaderViewport.bind(this))}isColumnVirtualisationSuppressed(){return this.suppressColumnVirtualisation||this.viewportRight===0}clear(){this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.colsWithinViewportHash=""}isColumnInHeaderViewport($){if($.isAutoHeaderHeight()||aU($))return!0;return this.isColumnInRowViewport($)}isColumnInRowViewport($){if($.isAutoHeight())return!0;let z=$.getLeft()||0,Q=z+$.getActualWidth(),J=this.viewportLeft-200,Z=this.viewportRight+200,X=zZ&&Q>Z;return!X&&!Y}getViewportColumns(){let{leftCols:$,rightCols:z}=this.visibleCols;return this.colsWithinViewport.concat($).concat(z)}getColsWithinViewport($){if(!this.colModel.colSpanActive)return this.colsWithinViewport;let z=(X)=>{let Y=X.getLeft();return T(Y)&&Y>this.viewportLeft},Q=this.isColumnVirtualisationSuppressed()?void 0:this.isColumnInRowViewport.bind(this),{visibleCols:J}=this,Z=J.centerCols;return J.getColsForRow($,Z,Q,z)}checkViewportColumns($=!1){if(this.extractViewport())this.eventSvc.dispatchEvent({type:"virtualColumnsChanged",afterScroll:$})}calculateHeaderRows(){let{leftCols:$,rightCols:z}=this.visibleCols;this.columnsToRenderLeft=$,this.columnsToRenderRight=z,this.columnsToRenderCenter=this.colsWithinViewport;let Q=(J)=>{let Z=new Set,X={};for(let Y of J){let q=Y.getParent(),G=Y.isSpanHeaderHeight();while(q){if(Z.has(q))break;if(G&&q.isPadding()){q=q.getParent();continue}let H=q.getProvidedColumnGroup().getLevel();X[H]??(X[H]=[]),X[H].push(q),Z.add(q),q=q.getParent()}}return X};this.rowsOfHeadersToRenderLeft=Q($),this.rowsOfHeadersToRenderRight=Q(z),this.rowsOfHeadersToRenderCenter=Q(this.headerColsWithinViewport)}extractViewport(){let $=(J)=>`${J.getId()}-${J.getPinned()||"normal"}`;this.extractViewportColumns();let z=this.getViewportColumns().map($).join("#"),Q=this.colsWithinViewportHash!==z;if(Q)this.colsWithinViewportHash=z,this.calculateHeaderRows();return Q}};function aU($){while($){if($.isAutoHeaderHeight())return!0;$=$.getParent()}return!1}var oU=class extends S{constructor(){super(...arguments);this.beanName="agCompUtils"}adaptFunction($,z){if(!$.cellRenderer)return null;class Q{refresh(){return!1}getGui(){return this.eGui}init(J){let Z=z(J),X=typeof Z;if(X==="string"||X==="number"||X==="boolean"){this.eGui=T2(""+Z+"");return}if(Z==null){this.eGui=J0({tag:"span"});return}this.eGui=Z}}return Q}},eU={moduleName:"CellRendererFunction",version:p,beans:[oU]},$W=class extends R0{constructor(){super(...arguments);this.beanName="registry"}registerDynamicBeans($){if($){this.dynamicBeans??(this.dynamicBeans={});for(let z of Object.keys($))this.dynamicBeans[z]=$[z]}}createDynamicBean($,z,...Q){if(!this.dynamicBeans)throw Error(this.getDynamicError($,!0));let J=this.dynamicBeans[$];if(J==null){if(z)throw Error(this.getDynamicError($,!1));return}return new J(...Q)}};function zW($){return typeof $==="object"&&!!$.getComp}var QW=class extends $W{constructor(){super(...arguments);this.agGridDefaults={},this.agGridDefaultOverrides={},this.jsComps={},this.selectors={},this.icons={}}postConstruct(){let $=this.gos.get("components");if($!=null)for(let z of Object.keys($))this.jsComps[z]=$[z]}registerModule($){let{icons:z,userComponents:Q,dynamicBeans:J,selectors:Z}=$;if(Q){let X=(Y,q,G,_)=>{if(this.agGridDefaults[Y]=q,G||_)this.agGridDefaultOverrides[Y]={params:G,processParams:_}};for(let Y of Object.keys(Q)){let q=Q[Y];if(zW(q))q=q.getComp(this.beans);if(typeof q==="object"){let{classImp:G,params:_,processParams:H}=q;X(Y,G,_,H)}else X(Y,q)}}this.registerDynamicBeans(J);for(let X of Z??[])this.selectors[X.selector]=X;if(z)for(let X of Object.keys(z))this.icons[X]=z[X]}getUserComponent($,z){let Q=(q,G,_,H)=>({componentFromFramework:G,component:q,params:_,processParams:H}),{frameworkOverrides:J}=this.beans,Z=J.frameworkComponent(z,this.gos.get("components"));if(Z!=null)return Q(Z,!0);let X=this.jsComps[z];if(X){let q=J.isFrameworkComponent(X);return Q(X,q)}let Y=this.agGridDefaults[z];if(Y){let q=this.agGridDefaultOverrides[z];return Q(Y,!1,q?.params,q?.processParams)}return this.beans.validation?.missingUserComponent($,z,this.agGridDefaults,this.jsComps),null}getSelector($){return this.selectors[$]}getIcon($){return this.icons[$]}getDynamicError($,z){if(z)return $$(279,{name:$});return this.beans.validation?.missingDynamicBean($)??$$(256)}},JW=23,ZW=class extends S{constructor(){super(...arguments);this.beanName="ctrlsSvc",this.params={},this.ready=!1,this.readyCallbacks=[]}postConstruct(){this.addEventListener("ready",()=>{if(this.updateReady(),this.ready){for(let $ of this.readyCallbacks)$(this.params);this.readyCallbacks.length=0}},this.beans.frameworkOverrides.runWhenReadyAsync?.()??!1)}updateReady(){let $=Object.values(this.params);this.ready=$.length===JW&&$.every((z)=>{return z?.isAlive()??!1})}whenReady($,z){if(this.ready)z(this.params);else this.readyCallbacks.push(z);$.addDestroyFunc(()=>{let Q=this.readyCallbacks.indexOf(z);if(Q>=0)this.readyCallbacks.splice(Q,1)})}register($,z){if(this.params[$]=z,this.updateReady(),this.ready)this.dispatchLocalEvent({type:"ready"});z.addDestroyFunc(()=>{this.updateReady()})}get($){return this.params[$]}getGridBodyCtrl(){return this.params.gridBodyCtrl}getHeaderRowContainerCtrls(){let{leftHeader:$,centerHeader:z,rightHeader:Q}=this.params;return[$,Q,z]}getHeaderRowContainerCtrl($){let z=this.params;switch($){case"left":return z.leftHeader;case"right":return z.rightHeader;default:return z.centerHeader}}getScrollFeature(){return this.getGridBodyCtrl().scrollFeature}},XW=':where([class^=ag-]),:where([class^=ag-]):after,:where([class^=ag-]):before{box-sizing:border-box}:where([class^=ag-]):where(button){color:inherit}:where([class^=ag-]):where(div,span,label):focus-visible{box-shadow:inset var(--ag-focus-shadow);outline:none;&:where(.invalid){box-shadow:inset var(--ag-focus-error-shadow)}}:where([class^=ag-]) ::-ms-clear{display:none}.ag-hidden{display:none!important}.ag-invisible{visibility:hidden!important}.ag-tab-guard{display:block;height:0;position:absolute;width:0}.ag-tab-guard-top{top:1px}.ag-tab-guard-bottom{bottom:1px}.ag-measurement-container{height:0;overflow:hidden;visibility:hidden;width:0}.ag-measurement-element-border{display:inline-block}.ag-measurement-element-border:before{border-left:var(--ag-internal-measurement-border);content:"";display:block}.ag-popup-child{top:0;z-index:5}.ag-popup-child:where(:not(.ag-tooltip-custom)){box-shadow:var(--ag-popup-shadow)}.ag-input-wrapper,.ag-picker-field-wrapper{align-items:center;display:flex;flex:1 1 auto;line-height:normal;position:relative}.ag-input-field{align-items:center;display:flex;flex-direction:row}.ag-input-field-input:where(:not([type=checkbox],[type=radio])){flex:1 1 auto;min-width:0;width:100%}.ag-chart,.ag-dnd-ghost,.ag-external,.ag-popup,.ag-root-wrapper{cursor:default;line-height:normal;white-space:normal;-webkit-font-smoothing:antialiased;background-color:var(--ag-background-color);color:var(--ag-text-color);color-scheme:var(--ag-browser-color-scheme);font-family:var(--ag-font-family);font-size:var(--ag-font-size);font-weight:var(--ag-font-weight);--ag-indentation-level:0}:where(.ag-icon):before{align-items:center;background-color:currentcolor;color:inherit;content:"";display:flex;font-family:inherit;font-size:var(--ag-icon-size);font-style:normal;font-variant:normal;height:var(--ag-icon-size);justify-content:center;line-height:var(--ag-icon-size);-webkit-mask-size:contain;mask-size:contain;text-transform:none;width:var(--ag-icon-size)}.ag-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;color:var(--ag-icon-color);display:block;height:var(--ag-icon-size);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-icon-size)}.ag-disabled .ag-icon,[disabled] .ag-icon{opacity:.5}.ag-icon-grip.ag-disabled,.ag-icon-grip[disabled]{opacity:.35}.ag-icon-loading{animation-duration:1s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ag-resizer{pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}:where(.ag-resizer){&.ag-resizer-topLeft{cursor:nwse-resize;height:5px;left:0;top:0;width:5px}&.ag-resizer-top{cursor:ns-resize;height:5px;left:5px;right:5px;top:0}&.ag-resizer-topRight{cursor:nesw-resize;height:5px;right:0;top:0;width:5px}&.ag-resizer-right{bottom:5px;cursor:ew-resize;right:0;top:5px;width:5px}&.ag-resizer-bottomRight{bottom:0;cursor:nwse-resize;height:5px;right:0;width:5px}&.ag-resizer-bottom{bottom:0;cursor:ns-resize;height:5px;left:5px;right:5px}&.ag-resizer-bottomLeft{bottom:0;cursor:nesw-resize;height:5px;left:0;width:5px}&.ag-resizer-left{bottom:5px;cursor:ew-resize;left:0;top:5px;width:5px}}.ag-menu{background-color:var(--ag-menu-background-color);border:var(--ag-menu-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-menu-shadow);color:var(--ag-menu-text-color);max-height:100%;overflow-y:auto;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}',L4=typeof window!=="object"||!window?.document?.fonts?.forEach,HJ=!1,Nz=($,z,Q,J,Z,X,Y=!1)=>{if(L4||HJ)return;if(J)$=`@layer ${CSS.escape(J).replaceAll("\\.",".")} { ${$} }`;let q=R$.map.get(z);if(!q)q=[],R$.map.set(z,q);if(q.some((U)=>U.css===$))return;let G=document.createElement("style");if(X)G.setAttribute("nonce",X);G.dataset.agCss=Q,G.dataset.agCssVersion=p,G.textContent=$;let _={css:$,el:G,priority:Z,isParams:Y},H;for(let U of q){if(U.priority>Z)break;H=U}if(H){H.el.after(G);let U=q.indexOf(H);q.splice(U+1,0,_)}else{if(z.nodeName==="STYLE")z.after(G);else z.insertBefore(G,z.querySelector(":not(title, meta)"));q.push(_)}},V8=($,z,Q,J)=>{Nz(XW,$,"shared",z,0,Q),J?.forEach((Z,X)=>Z.forEach((Y)=>Nz(Y,$,X,z,0,Q)))},YW=($,z,Q,J,Z,X)=>{if(L4||HJ)return;let Y=R$.grids.get($);if(!Y)R$.grids.set($,{styleContainer:J,paramsCss:z});else Y.paramsCss=z;if(W2(J),z&&Q)Nz(z,J,Q,Z,2,X,!0)},qW=($)=>{let z=R$.grids.get($)?.styleContainer;if(!z)return;if(R$.grids.delete($),Array.from(R$.grids.values()).some((J)=>J.styleContainer===z))W2(z);else W2(z,!0),R$.map.delete(z)},W2=($,z=!1)=>{let Q=new Set;for(let Z of R$.grids.values())if(Z.styleContainer===$)Q.add(Z.paramsCss);let J=R$.map.get($)??[];for(let Z=J.length-1;Z>=0;Z--)if(z||J[Z].isParams&&!Q.has(J[Z].css))J[Z].el.remove(),J.splice(Z,1)},A8=()=>{let $=globalThis.agStyleInjectionVersions??(globalThis.agStyleInjectionVersions=new Map),z=$.get(p);if(!z)z={map:new WeakMap,grids:new Map,paramsId:0},$.set(p,z);return z},R$=A8(),D$=($)=>{return new S8($)},o$="$default",GW=0,S8=class{constructor({feature:$,params:z,modeParams:Q={},css:J,cssImports:Z}){this.feature=$,this.css=J,this.cssImports=Z,this.modeParams={[o$]:{...Q[o$]??{},...z??{}},...Q}}use($,z,Q){let J=this._inject;if(J==null){let{css:Z}=this;if(Z){let X=`ag-theme-${this.feature??"part"}-${++GW}`;if(typeof Z==="function")Z=Z();Z=`:where(.${X}) { +${Z} +} +`;for(let Y of this.cssImports??[])Z=`@import url(${JSON.stringify(Y)}); +${Z}`;J={css:Z,class:X}}else J=!1;this._inject=J}if(J&&$)Nz(J.css,$,J.class,z,1,Q);return J?J.class:!1}},_W=($)=>$.replace(/[A-Z]|\d+/g,(z)=>`-${z}`).toLowerCase(),D4=($)=>`--ag-${_W($)}`,v$=($)=>`var(${D4($)})`,HW=($,z,Q)=>Math.max(z,Math.min(Q,$)),UW=($)=>{let z=new Map;return(Q)=>{let J=Q;if(!z.has(J))z.set(J,$(Q));return z.get(J)}},A$=($)=>({ref:"accentColor",mix:$}),s0=($)=>({ref:"foregroundColor",mix:$}),o0=($)=>({ref:"foregroundColor",mix:$,onto:"backgroundColor"}),WW=($)=>({ref:"foregroundColor",mix:$,onto:"headerBackgroundColor"}),x0={ref:"backgroundColor"},Tz={ref:"foregroundColor"},S$={ref:"accentColor"},UJ={backgroundColor:"#fff",foregroundColor:"#181d1f",borderColor:s0(0.15),chromeBackgroundColor:o0(0.02),browserColorScheme:"light"},BW={...UJ,textColor:Tz,accentColor:"#2196f3",invalidColor:"#e02525",fontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue","sans-serif"],subtleTextColor:{ref:"textColor",mix:0.5},borderWidth:1,borderRadius:4,spacing:8,fontSize:14,fontWeight:"inherit",focusShadow:{spread:3,color:A$(0.5)},focusErrorShadow:{spread:3,color:{ref:"invalidColor",onto:"backgroundColor",mix:0.5}},popupShadow:"0 0 16px #00000026",cardShadow:"0 1px 4px 1px #00000018",dropdownShadow:{ref:"cardShadow"},listItemHeight:{calc:"max(iconSize, dataFontSize) + widgetVerticalSpacing"},dragAndDropImageBackgroundColor:x0,dragAndDropImageBorder:!0,dragAndDropImageNotAllowedBorder:{color:{ref:"invalidColor",onto:"dragAndDropImageBackgroundColor",mix:0.5}},dragAndDropImageShadow:{ref:"popupShadow"},iconSize:16,iconColor:"inherit",toggleButtonWidth:28,toggleButtonHeight:18,toggleButtonOnBackgroundColor:S$,toggleButtonOffBackgroundColor:o0(0.3),toggleButtonSwitchBackgroundColor:x0,toggleButtonSwitchInset:2,tooltipBackgroundColor:{ref:"chromeBackgroundColor"},tooltipErrorBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.1},tooltipTextColor:{ref:"textColor"},tooltipErrorTextColor:{ref:"invalidColor"},tooltipBorder:!0,tooltipErrorBorder:{color:{ref:"invalidColor",onto:"backgroundColor",mix:0.25}},panelBackgroundColor:x0,panelTitleBarHeight:{ref:"headerHeight"},panelTitleBarBackgroundColor:{ref:"headerBackgroundColor"},panelTitleBarIconColor:{ref:"headerTextColor"},panelTitleBarTextColor:{ref:"headerTextColor"},panelTitleBarFontFamily:{ref:"headerFontFamily"},panelTitleBarFontSize:{ref:"headerFontSize"},panelTitleBarFontWeight:{ref:"headerFontWeight"},panelTitleBarBorder:!0,dialogShadow:{ref:"popupShadow"},dialogBorder:{color:s0(0.2)},widgetContainerHorizontalPadding:{calc:"spacing * 1.5"},widgetContainerVerticalPadding:{calc:"spacing * 1.5"},widgetHorizontalSpacing:{calc:"spacing * 1.5"},widgetVerticalSpacing:{ref:"spacing"},dataFontSize:{ref:"fontSize"},headerBackgroundColor:{ref:"chromeBackgroundColor"},headerFontFamily:{ref:"fontFamily"},headerFontSize:{ref:"fontSize"},headerFontWeight:500,headerTextColor:{ref:"textColor"},headerHeight:{calc:"max(iconSize, dataFontSize) + spacing * 4 * headerVerticalPaddingScale"},headerVerticalPaddingScale:1,menuBorder:{color:s0(0.2)},menuBackgroundColor:o0(0.03),menuTextColor:o0(0.95),menuShadow:{ref:"popupShadow"},menuSeparatorColor:{ref:"borderColor"}},EW=["colorScheme","color","length","scale","borderStyle","border","shadow","image","fontFamily","fontWeight","duration"],KW=UW(($)=>{return $=$.toLowerCase(),EW.find((z)=>$.endsWith(z.toLowerCase()))??"length"}),cJ=($)=>{if(typeof $==="object"&&$?.ref)return v$($.ref);if(typeof $==="string")return $;if(typeof $==="number")return String($);return!1},F4=($)=>{if(typeof $==="string")return $;if(typeof $==="object"&&$&&"ref"in $){let z=v$($.ref);if($.mix==null)return z;return`color-mix(in srgb, ${$.onto?v$($.onto):"transparent"}, ${z} ${HW($.mix*100,0,100)}%)`}return!1},LW=cJ,XQ=($)=>{if(typeof $==="string")return $;if(typeof $==="number")return`${$}px`;if(typeof $==="object"&&$&&"calc"in $)return`calc(${$.calc.replace(/ ?[*/+] ?/g," $& ").replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi,(Q)=>Q[0]==="-"?Q:" "+v$(Q)+" ")})`;if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},DW=cJ,B2=($,z)=>{if(typeof $==="string")return $;if($===!0)return B2({},z);if($===!1)return z==="columnBorder"?B2({color:"transparent"},z):"none";if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return R8($.style??"solid")+" "+XQ($.width??{ref:"borderWidth"})+" "+F4($.color??{ref:"borderColor"})},x5=($)=>{return[XQ($.offsetX??0),XQ($.offsetY??0),XQ($.radius??0),XQ($.spread??0),F4($.color??{ref:"foregroundColor"}),...$.inset?["inset"]:[]].join(" ")},FW=($)=>{if(typeof $==="string")return $;if($===!1)return"none";if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);if(Array.isArray($))return $.map(x5).join(", ");return x5($)},R8=cJ,j8=($)=>{if(typeof $==="string")return $.includes(",")?$:w5($);if(typeof $==="object"&&$&&"googleFont"in $)return j8($.googleFont);if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);if(Array.isArray($))return $.map((z)=>{if(typeof z==="object"&&"googleFont"in z)z=z.googleFont;return w5(z)}).join(", ");return!1},w5=($)=>/^[\w-]+$|\w\(/.test($)?$:JSON.stringify($),MW=cJ,f8=($)=>{if(typeof $==="string")return $;if(typeof $==="object"&&$&&"url"in $)return`url(${JSON.stringify($.url)})`;if(typeof $==="object"&&$&&"svg"in $)return f8({url:`data:image/svg+xml,${encodeURIComponent($.svg)}`});if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},kW=($,z,Q)=>{if(typeof $==="string")return $;if(typeof $==="number"){if($>=10)Q?.warn(104,{value:$,param:z});return`${$}s`}if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},VW={color:F4,colorScheme:LW,length:XQ,scale:DW,border:B2,borderStyle:R8,shadow:FW,image:f8,fontFamily:j8,fontWeight:MW,duration:kW},AW=($,z,Q)=>{let J=KW($);return VW[J](z,$,Q)};var SW=($,z)=>new O8({themeLogger:$,overridePrefix:z}),O8=class ${constructor(z,Q=[]){this.params=z,this.parts=Q}withPart(z){if(typeof z==="function")z=z();if(!(z instanceof S8))return this.params.themeLogger.preInitErr(259,"Invalid part",{part:z}),this;return new $(this.params,[...this.parts,z])}withoutPart(z){return this.withPart(D$({feature:z}))}withParams(z,Q=o$){return this.withPart(D$({modeParams:{[Q]:z}}))}_startUse({styleContainer:z,cssLayer:Q,nonce:J,loadThemeGoogleFonts:Z,moduleCss:X}){if(L4)return;if(HJ)return;jW(),V8(z,Q,J,X);let Y=RW(this);if(Y.length>0){for(let q of Y)if(Z)fW(q,J)}for(let q of this.parts)q.use(z,Q,J)}_getCssClass(){if(HJ)return"ag-theme-quartz";return this._cssClassCache??(this._cssClassCache=N5(this.parts).map((z)=>z.use(void 0,void 0,void 0)).filter(Boolean).concat(this._getParamsClassName()).join(" "))}_getParamsClassName(){return this._paramsClassName??(this._paramsClassName=`ag-theme-params-${++A8().paramsId}`)}_getModeParams(){let z=this._paramsCache;if(!z){let Q={[o$]:{...BW}};for(let J of N5(this.parts))for(let Z of Object.keys(J.modeParams)){let X=J.modeParams[Z];if(X){let Y=Q[Z]??(Q[Z]={}),q=new Set;for(let G of Object.keys(X)){let _=X[G];if(_!==void 0)Y[G]=_,q.add(G)}if(Z===o$)for(let G of Object.keys(Q)){let _=Q[G];if(G!==o$)for(let H of q)delete _[H]}}}this._paramsCache=z=Q}return z}_getParamsCss(){if(!this._paramsCssCache){let z="",Q="",J=this._getModeParams(),{overridePrefix:Z,themeLogger:X}=this.params,Y=Z?`--ag-${Z}-`:void 0;for(let _ of Object.keys(J)){let H=J[_];if(_!==o$){let W=`:where([data-ag-theme-mode="${typeof CSS==="object"?CSS.escape(_):_}"]) & { +`;z+=W,Q+=W}for(let U of Object.keys(H).sort()){let W=H[U],B=AW(U,W,X);if(B===!1)X.error(107,{key:U,value:W});else{let E=D4(U),K=Y?E.replace("--ag-",Y):E,L=E.replace("--ag-","--ag-inherited-");z+=` ${E}: var(${L}, ${B}); +`,Q+=` ${L}: var(${K}); +`}}if(_!==o$)z+=`} +`,Q+=`} +`}let q=`:where(.${this._getParamsClassName()})`,G=`${q} { +${z}} +`;G+=`:has(> ${q}):not(${q}) { +${Q}} +`,this._paramsCssCache=G}return this._paramsCssCache}},N5=($)=>{let z=new Map;for(let J of $)z.set(J.feature,J);let Q=[];for(let J of $)if(!J.feature||z.get(J.feature)===J)Q.push(J);return Q},RW=($)=>{let z=new Set,Q=(X)=>{if(Array.isArray(X))X.forEach(Q);else{let Y=X?.googleFont;if(typeof Y==="string")z.add(Y)}};return Object.values($._getModeParams()).flatMap((X)=>Object.values(X)).forEach(Q),Array.from(z).sort()},g5=!1,jW=()=>{if(g5)return;g5=!0;for(let $ of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]')))$.remove()},fW=async($,z)=>{let Q=`@import url('https://${OW}/css2?family=${encodeURIComponent($)}:wght@100;200;300;400;500;600;700;800;900&display=swap'); +`;Nz(Q,document.head,`googleFont:${$}`,void 0,0,z)},OW="fonts.googleapis.com",h5={changeKey:"listItemHeight",type:"length",defaultValue:24},PW=class extends R0{constructor(){super(...arguments);this.beanName="environment",this.sizeEls=new Map,this.lastKnownValues=new Map,this.sizesMeasured=!1,this.globalCSS=[]}wireBeans($){this.eRootDiv=$.eRootDiv}postConstruct(){let{gos:$,eRootDiv:z}=this;$.setInstanceDomData(z);let Q=$.get("themeStyleContainer"),J=typeof ShadowRoot<"u",Z=J&&z.getRootNode()instanceof ShadowRoot;if(this.eStyleContainer=(typeof Q==="function"?Q():Q)??(Z?z:document.head),!Q&&!Z&&J)TW(z,this.shadowRootError.bind(this),this.addDestroyFunc.bind(this));this.cssLayer=$.get("themeCssLayer"),this.styleNonce=$.get("styleNonce"),this.addManagedPropertyListener("theme",()=>this.handleThemeChange()),this.handleThemeChange(),this.getSizeEl(h5),this.initVariables(),this.addDestroyFunc(()=>qW(this)),this.mutationObserver=new MutationObserver(()=>{this.fireStylesChangedEvent("theme")}),this.addDestroyFunc(()=>this.mutationObserver.disconnect())}applyThemeClasses($,z=[]){let{theme:Q}=this,J=Q?Q._getCssClass():this.applyLegacyThemeClasses();for(let Z of Array.from($.classList))if(Z.startsWith("ag-theme-"))$.classList.remove(Z);if(J){let Z=$.className;$.className=`${Z}${Z?" ":""}${J}${z?.length?" "+z.join(" "):""}`}}applyLegacyThemeClasses(){let $="";this.mutationObserver.disconnect();let z=this.eRootDiv;while(z){let Q=!1;for(let J of Array.from(z.classList))if(J.startsWith("ag-theme-"))Q=!0,$=$?`${$} ${J}`:J;if(Q)this.mutationObserver.observe(z,{attributes:!0,attributeFilter:["class"]});z=z.parentElement}return $}addGlobalCSS($,z){if(this.theme)Nz($,this.eStyleContainer,z,this.cssLayer,0,this.styleNonce);else this.globalCSS.push([$,z])}getDefaultListItemHeight(){return this.getCSSVariablePixelValue(h5)}getCSSVariablePixelValue($){let z=this.lastKnownValues.get($);if(z!=null)return z;let Q=this.measureSizeEl($);if(Q==="detached"||Q==="no-styles"){if($.cacheDefault)this.lastKnownValues.set($,$.defaultValue);return $.defaultValue}return this.lastKnownValues.set($,Q),Q}measureSizeEl($){let z=this.getSizeEl($);if(z.offsetParent==null)return"detached";let Q=z.offsetWidth;if(Q===iZ)return"no-styles";return this.sizesMeasured=!0,Q}getMeasurementContainer(){let $=this.eMeasurementContainer;if(!$)$=this.eMeasurementContainer=K0({tag:"div",cls:"ag-measurement-container"}),this.eRootDiv.appendChild($);return $}getSizeEl($){let z=this.sizeEls.get($);if(z)return z;let Q=this.getMeasurementContainer();z=K0({tag:"div"});let J=this.setSizeElStyles(z,$);Q.appendChild(z),this.sizeEls.set($,z);let{type:Z,noWarn:X}=$;if(Z!=="length"&&Z!=="border")return z;let Y=this.measureSizeEl($);if(Y==="no-styles"&&!X)this.varError(J,$.defaultValue);let q=F$(this.beans,z,()=>{let G=this.measureSizeEl($);if(G==="detached"||G==="no-styles")return;if(this.lastKnownValues.set($,G),G!==Y)Y=G,this.fireStylesChangedEvent($.changeKey)});return this.addDestroyFunc(()=>q()),z}setSizeElStyles($,z){let{changeKey:Q,type:J}=z,Z=D4(Q);if(J==="border"){if(Z.endsWith("-width"))Z=Z.slice(0,-6);$.className="ag-measurement-element-border",$.style.setProperty("--ag-internal-measurement-border",`var(${Z}, solid ${iZ}px)`)}else $.style.width=`var(${Z}, ${iZ}px)`;return Z}handleThemeChange(){let{gos:$,theme:z}=this,Q=$.get("theme"),J;if(Q==="legacy")J=void 0;else{let Z=Q??this.getDefaultTheme();if(Z instanceof O8)J=Z;else this.themeError(Z)}if(J!==z)this.handleNewTheme(J);this.postProcessThemeChange(J,Q)}handleNewTheme($){let{gos:z,eRootDiv:Q,globalCSS:J}=this,Z=this.getAdditionalCss();if($){V8(this.eStyleContainer,this.cssLayer,this.styleNonce,Z);for(let[X,Y]of J)Nz(X,this.eStyleContainer,Y,this.cssLayer,0,this.styleNonce);J.length=0}this.theme=$,$?._startUse({loadThemeGoogleFonts:z.get("loadThemeGoogleFonts"),styleContainer:this.eStyleContainer,cssLayer:this.cssLayer,nonce:this.styleNonce,moduleCss:Z}),YW(this,$?._getParamsCss()??null,$?._getParamsClassName()??null,this.eStyleContainer,this.cssLayer,this.styleNonce),this.applyThemeClasses(Q),this.fireStylesChangedEvent("theme")}fireStylesChangedEvent($){this.eventSvc.dispatchEvent({type:"stylesChanged",[`${$}Changed`]:!0})}},iZ=15538,TW=($,z,Q)=>{let J=60,Z=setInterval(()=>{if(typeof ShadowRoot<"u"&&$.getRootNode()instanceof ShadowRoot)z(),clearInterval(Z);if($.isConnected||--J<0)clearInterval(Z)},1000);Q(()=>clearInterval(Z))},vW=".ag-aria-description-container{border:0;z-index:9999;clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.ag-unselectable{-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-selectable{-webkit-user-select:text;-moz-user-select:text;user-select:text}.ag-shake-left-to-right{animation-direction:alternate;animation-duration:.2s;animation-iteration-count:infinite;animation-name:ag-shake-left-to-right}@keyframes ag-shake-left-to-right{0%{padding-left:6px;padding-right:2px}to{padding-left:2px;padding-right:6px}}.ag-body-horizontal-scroll-viewport,.ag-body-vertical-scroll-viewport,.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:hidden;position:relative}.ag-viewport{position:relative}.ag-spanning-container{position:absolute;top:0;z-index:1}.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport{overflow-x:auto;-ms-overflow-style:none!important;scrollbar-width:none!important}.ag-body-viewport::-webkit-scrollbar,.ag-center-cols-viewport::-webkit-scrollbar,.ag-floating-bottom-viewport::-webkit-scrollbar,.ag-floating-top-viewport::-webkit-scrollbar,.ag-header-viewport::-webkit-scrollbar,.ag-sticky-bottom-viewport::-webkit-scrollbar,.ag-sticky-top-viewport::-webkit-scrollbar{display:none!important}.ag-body-viewport{display:flex;overflow-x:hidden;&:where(.ag-layout-normal){overflow-y:auto;-webkit-overflow-scrolling:touch}}.ag-floating-bottom-container,.ag-floating-top-container,.ag-sticky-bottom-container,.ag-sticky-top-container{min-height:1px}.ag-center-cols-viewport{min-height:100%;width:100%}.ag-body-horizontal-scroll-viewport{overflow-x:scroll}.ag-body-vertical-scroll-viewport{overflow-y:scroll}.ag-body-container,.ag-body-horizontal-scroll-container,.ag-body-vertical-scroll-container,.ag-center-cols-container,.ag-floating-bottom-container,.ag-floating-bottom-full-width-container,.ag-floating-top-container,.ag-full-width-container,.ag-header-container,.ag-pinned-left-cols-container,.ag-pinned-left-sticky-bottom,.ag-pinned-right-cols-container,.ag-pinned-right-sticky-bottom,.ag-sticky-bottom-container,.ag-sticky-top-container{position:relative}.ag-floating-bottom-container,.ag-floating-top-container,.ag-header-container,.ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top,.ag-sticky-bottom-container,.ag-sticky-top-container{height:100%;white-space:nowrap}.ag-center-cols-container,.ag-pinned-right-cols-container{display:block}.ag-body-horizontal-scroll-container{height:100%}.ag-body-vertical-scroll-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container,.ag-full-width-container,.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{pointer-events:none;position:absolute;top:0}:where(.ag-ltr) .ag-floating-bottom-full-width-container,:where(.ag-ltr) .ag-floating-top-full-width-container,:where(.ag-ltr) .ag-full-width-container,:where(.ag-ltr) .ag-sticky-bottom-full-width-container,:where(.ag-ltr) .ag-sticky-top-full-width-container{left:0}:where(.ag-rtl) .ag-floating-bottom-full-width-container,:where(.ag-rtl) .ag-floating-top-full-width-container,:where(.ag-rtl) .ag-full-width-container,:where(.ag-rtl) .ag-sticky-bottom-full-width-container,:where(.ag-rtl) .ag-sticky-top-full-width-container{right:0}.ag-full-width-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container{display:inline-block;height:100%;overflow:hidden;width:100%}.ag-body{display:flex;flex:1 1 auto;flex-direction:row!important;min-height:0;position:relative}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:flex;min-height:0;min-width:0;position:relative;&:where(.ag-scrollbar-invisible){bottom:0;position:absolute;&:where(.ag-apple-scrollbar){opacity:0;transition:opacity .4s;visibility:hidden;&:where(.ag-scrollbar-active),&:where(.ag-scrollbar-scrolling){opacity:1;visibility:visible}}}}.ag-body-horizontal-scroll{width:100%;&:where(.ag-scrollbar-invisible){left:0;right:0}}.ag-body-vertical-scroll{height:100%;&:where(.ag-scrollbar-invisible){top:0;z-index:10}}:where(.ag-ltr) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){right:0}}:where(.ag-rtl) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){left:0}}.ag-force-vertical-scroll{overflow-y:scroll!important}.ag-horizontal-left-spacer,.ag-horizontal-right-spacer{height:100%;min-width:0;overflow-x:scroll;&:where(.ag-scroller-corner){overflow-x:hidden}}:where(.ag-row-animation) .ag-row{transition:transform .4s,top .4s,opacity .2s;&:where(.ag-after-created){transition:transform .4s,top .4s,height .4s,opacity .2s}}:where(.ag-row-animation.ag-prevent-animation) .ag-row{transition:none!important;&:where(.ag-row.ag-after-created){transition:none!important}}:where(.ag-row-no-animation) .ag-row{transition:none}.ag-row-loading{align-items:center;display:flex}.ag-row-position-absolute{position:absolute}.ag-row-position-relative{position:relative}.ag-full-width-row{overflow:hidden;pointer-events:all}.ag-row-inline-editing{z-index:1}.ag-row-dragging{z-index:2}.ag-stub-cell{align-items:center;display:flex}.ag-cell{display:inline-block;height:100%;position:absolute;white-space:nowrap;&:focus-visible{box-shadow:none}}.ag-cell-value{flex:1 1 auto}.ag-cell-value:not(.ag-allow-overflow),.ag-group-value{overflow:hidden;text-overflow:ellipsis}.ag-cell-wrap-text{white-space:normal;word-break:break-word}:where(.ag-cell) .ag-icon{display:inline-block;vertical-align:middle}.ag-floating-top{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-top:not(.ag-invisible)){border-bottom:var(--ag-pinned-row-border)}.ag-floating-bottom{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-bottom:not(.ag-invisible)){border-top:var(--ag-pinned-row-border)}.ag-sticky-bottom,.ag-sticky-top{background-color:var(--ag-data-background-color);display:flex;height:0;overflow:hidden;position:absolute;width:100%;z-index:1}.ag-sticky-bottom{box-sizing:content-box!important;:where(.ag-pinned-left-sticky-bottom),:where(.ag-pinned-right-sticky-bottom),:where(.ag-sticky-bottom-container){border-top:var(--ag-row-border);box-sizing:border-box}}.ag-opacity-zero{opacity:0!important}.ag-cell-label-container{align-items:center;display:flex;flex-direction:row-reverse;height:100%;justify-content:space-between;width:100%}:where(.ag-right-aligned-header){.ag-cell-label-container{flex-direction:row}.ag-header-cell-text{text-align:end}}.ag-column-group-icons{display:block;:where(.ag-column-group-closed-icon),:where(.ag-column-group-opened-icon){cursor:pointer}}:where(.ag-ltr){direction:ltr;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row}}:where(.ag-rtl){direction:rtl;text-align:right;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row-reverse}.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{display:block}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(180deg)}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(-180deg)}}:where(.ag-ltr) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-left:var(--ag-row-group-indent-size)}:where(.ag-rtl) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-right:var(--ag-row-group-indent-size)}:where(.ag-ltr) .ag-row-group-leaf-indent{margin-left:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}:where(.ag-rtl) .ag-row-group-leaf-indent{margin-right:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}.ag-value-change-delta{padding:0 2px}.ag-value-change-delta-up{color:var(--ag-value-change-delta-up-color)}.ag-value-change-delta-down{color:var(--ag-value-change-delta-down-color)}.ag-value-change-value{background-color:transparent;border-radius:1px;padding-left:1px;padding-right:1px;transition:background-color 1s}.ag-value-change-value-highlight{background-color:var(--ag-value-change-value-highlight-background-color);transition:background-color .1s}.ag-cell-data-changed{background-color:var(--ag-value-change-value-highlight-background-color)!important}.ag-cell-data-changed-animation{background-color:transparent}.ag-cell-highlight{background-color:var(--ag-range-selection-highlight-color)!important}.ag-row,.ag-spanned-row{color:var(--ag-cell-text-color);font-family:var(--ag-cell-font-family);font-size:var(--ag-cell-font-size);font-weight:var(--ag-cell-font-weight);white-space:nowrap;--ag-internal-content-line-height:calc(min(var(--ag-row-height), var(--ag-line-height, 1000px)) - var(--ag-internal-row-border-width, 1px) - 2px)}.ag-row{background-color:var(--ag-data-background-color);border-bottom:var(--ag-row-border);height:var(--ag-row-height);width:100%;&.ag-row-editing-invalid{background-color:var(--ag-full-row-edit-invalid-background-color)}}:where(.ag-body-vertical-content-no-gap>div>div>div,.ag-body-vertical-content-no-gap>div>div>div>div)>.ag-row-last{border-bottom-color:transparent}.ag-group-contracted,.ag-group-expanded{cursor:pointer}.ag-cell,.ag-full-width-row .ag-cell-wrapper.ag-row-group{border:1px solid transparent;line-height:var(--ag-internal-content-line-height);-webkit-font-smoothing:subpixel-antialiased}:where(.ag-ltr) .ag-cell{border-right:var(--ag-column-border)}:where(.ag-rtl) .ag-cell{border-left:var(--ag-column-border)}.ag-spanned-cell-wrapper{background-color:var(--ag-data-background-color);position:absolute}.ag-spanned-cell-wrapper>.ag-spanned-cell{display:block;position:relative}:where(.ag-ltr) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-right-color:transparent}:where(.ag-rtl) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-left-color:transparent}.ag-cell-wrapper{align-items:center;display:flex;>:where(:not(.ag-cell-value,.ag-group-value)){align-items:center;display:flex;height:var(--ag-internal-content-line-height)}&:where(.ag-row-group){align-items:flex-start}:where(.ag-full-width-row) &:where(.ag-row-group){align-items:center;height:100%}}:where(.ag-ltr) .ag-cell-wrapper{padding-left:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-rtl) .ag-cell-wrapper{padding-right:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-cell-wrap-text:not(.ag-cell-auto-height)) .ag-cell-wrapper{align-items:normal;height:100%;:where(.ag-cell-value){height:100%}}:where(.ag-ltr) .ag-row>.ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-row>.ag-cell-wrapper.ag-row-group{padding-right:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-cell-focus:not(.ag-cell-range-selected):focus-within,.ag-cell-range-single-cell,.ag-cell-range-single-cell.ag-cell-range-handle,.ag-context-menu-open .ag-cell-focus:not(.ag-cell-range-selected),.ag-context-menu-open .ag-full-width-row.ag-row-focus .ag-cell-wrapper.ag-row-group,.ag-full-width-row.ag-row-focus:focus .ag-cell-wrapper.ag-row-group{border:1px solid;border-color:var(--ag-range-selection-border-color);border-style:var(--ag-range-selection-border-style);outline:initial}.ag-full-width-row.ag-row-focus:focus{box-shadow:none}:where(.ag-ltr) .ag-group-contracted,:where(.ag-ltr) .ag-group-expanded,:where(.ag-ltr) .ag-row-drag,:where(.ag-ltr) .ag-selection-checkbox{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-contracted,:where(.ag-rtl) .ag-group-expanded,:where(.ag-rtl) .ag-row-drag,:where(.ag-rtl) .ag-selection-checkbox{margin-left:var(--ag-cell-widget-spacing)}.ag-drag-handle-disabled{opacity:.35;pointer-events:none}:where(.ag-ltr) .ag-group-child-count{margin-left:3px}:where(.ag-rtl) .ag-group-child-count{margin-right:3px}.ag-row-highlight-above:after,.ag-row-highlight-below:after,.ag-row-highlight-inside:after{background-color:var(--ag-row-drag-indicator-color);border-radius:calc(var(--ag-row-drag-indicator-width)/2);content:\"\";height:var(--ag-row-drag-indicator-width);pointer-events:none;position:absolute;width:calc(100% - 1px)}:where(.ag-ltr) .ag-row-highlight-above:after,:where(.ag-ltr) .ag-row-highlight-below:after,:where(.ag-ltr) .ag-row-highlight-inside:after{left:1px}:where(.ag-rtl) .ag-row-highlight-above:after,:where(.ag-rtl) .ag-row-highlight-below:after,:where(.ag-rtl) .ag-row-highlight-inside:after{right:1px}.ag-row-highlight-above:after{top:0}.ag-row-highlight-below:after{bottom:0}.ag-row-highlight-indent:after{display:block;width:auto}:where(.ag-ltr) .ag-row-highlight-indent:after{left:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size));right:1px}:where(.ag-rtl) .ag-row-highlight-indent:after{left:1px;right:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size))}.ag-row-highlight-inside:after{background-color:var(--ag-selected-row-background-color);border:1px solid var(--ag-range-selection-border-color);display:block;height:auto;inset:0;width:auto}.ag-body,.ag-floating-bottom,.ag-floating-top{background-color:var(--ag-data-background-color)}.ag-row-odd{background-color:var(--ag-odd-row-background-color)}.ag-row-selected:before{background-color:var(--ag-selected-row-background-color);content:\"\";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-full-width-row.ag-row-group:before,.ag-row-hover:not(.ag-full-width-row):before{background-color:var(--ag-row-hover-color);content:\"\";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-row-selected:before{background-color:var(--ag-row-hover-color);background-image:linear-gradient(var(--ag-selected-row-background-color),var(--ag-selected-row-background-color))}.ag-row.ag-full-width-row.ag-row-group>*{position:relative}.ag-column-hover{background-color:var(--ag-column-hover-color)}.ag-header-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-right-aligned-cell{font-variant-numeric:tabular-nums}:where(.ag-ltr) .ag-right-aligned-cell{text-align:right}:where(.ag-rtl) .ag-right-aligned-cell{text-align:left}.ag-right-aligned-cell .ag-cell-value,.ag-right-aligned-cell .ag-group-value{margin-left:auto}:where(.ag-ltr) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-ltr) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level));padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}:where(.ag-rtl) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-rtl) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-row>.ag-cell-wrapper{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}.ag-row-dragging{cursor:move;opacity:.5}.ag-details-row{background-color:var(--ag-data-background-color);padding:calc(var(--ag-spacing)*3.75)}.ag-layout-auto-height,.ag-layout-print{.ag-center-cols-container,.ag-center-cols-viewport{min-height:150px}}.ag-overlay-exporting-wrapper,.ag-overlay-loading-wrapper,.ag-overlay-modal-wrapper{background-color:var(--ag-modal-overlay-background-color)}.ag-skeleton-container{align-content:center;height:100%;width:100%}.ag-skeleton-effect{animation:ag-skeleton-loading 1.5s ease-in-out .5s infinite;background-color:var(--ag-row-loading-skeleton-effect-color);border-radius:.25rem;height:1em;width:100%}:where(.ag-ltr) .ag-right-aligned-cell .ag-skeleton-effect{margin-left:auto}:where(.ag-rtl) .ag-right-aligned-cell .ag-skeleton-effect{margin-right:auto}@keyframes ag-skeleton-loading{0%{background-color:var(--ag-row-loading-skeleton-effect-color)}50%{background-color:color-mix(in srgb,transparent,var(--ag-row-loading-skeleton-effect-color) 40%)}to{background-color:var(--ag-row-loading-skeleton-effect-color)}}.ag-loading{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-loading{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-loading{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-ltr) .ag-loading-icon{padding-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-loading-icon{padding-left:var(--ag-cell-widget-spacing)}.ag-header{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);color:var(--ag-header-text-color);display:flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;white-space:nowrap;width:100%}.ag-header-row{height:var(--ag-header-height);position:absolute}.ag-floating-filter-button-button,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,:where(.ag-header-cell-sortable) .ag-header-cell-label,:where(.ag-header-group-cell-selectable) .ag-header-cell-comp-wrapper{cursor:pointer}:where(.ag-ltr) .ag-header-expand-icon{margin-left:4px}:where(.ag-rtl) .ag-header-expand-icon{margin-right:4px}.ag-header-row:where(:not(:first-child)){:where(.ag-header-cell:not(.ag-header-span-height.ag-header-span-total,.ag-header-parent-hidden)),:where(.ag-header-group-cell.ag-header-group-cell-with-group){border-top:var(--ag-header-row-border)}}.ag-header-row:where(:not(.ag-header-row-column-group)){overflow:hidden}:where(.ag-header.ag-header-allow-overflow) .ag-header-row{overflow:visible}.ag-header-cell{display:inline-flex;overflow:hidden}.ag-header-group-cell{contain:paint;display:flex}.ag-header-cell,.ag-header-group-cell{align-items:center;gap:var(--ag-cell-widget-spacing);height:100%;padding:0 var(--ag-cell-horizontal-padding);position:absolute}@property --ag-internal-moving-color{syntax:\"\";inherits:false;initial-value:transparent}@property --ag-internal-hover-color{syntax:\"\";inherits:false;initial-value:transparent}.ag-header-cell:where(:not(.ag-floating-filter)):before,.ag-header-group-cell:before{background-image:linear-gradient(var(--ag-internal-hover-color),var(--ag-internal-hover-color)),linear-gradient(var(--ag-internal-moving-color),var(--ag-internal-moving-color));content:\"\";inset:0;position:absolute;--ag-internal-moving-color:transparent;--ag-internal-hover-color:transparent;transition:--ag-internal-moving-color var(--ag-header-cell-background-transition-duration),--ag-internal-hover-color var(--ag-header-cell-background-transition-duration)}.ag-header-cell:where(:not(.ag-floating-filter)):where(:hover):before,.ag-header-group-cell:where(:hover):before{--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}.ag-header-cell:where(:not(.ag-floating-filter)):where(.ag-header-cell-moving):before,.ag-header-group-cell:where(.ag-header-cell-moving):before{--ag-internal-moving-color:var(--ag-header-cell-moving-background-color);--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}:where(.ag-header-cell:not(.ag-floating-filter)>*,.ag-header-group-cell>*){position:relative;z-index:1}.ag-header-cell-menu-button:where(:not(.ag-header-menu-always-show)){opacity:0;transition:opacity .2s}.ag-header-cell-filter-button,:where(.ag-header-cell.ag-header-active) .ag-header-cell-menu-button{opacity:1}.ag-header-cell-label,.ag-header-group-cell-label{align-items:center;align-self:stretch;display:flex;flex:1 1 auto;overflow:hidden;padding:5px 0}:where(.ag-ltr) .ag-sort-indicator-icon{padding-left:var(--ag-spacing)}:where(.ag-rtl) .ag-sort-indicator-icon{padding-right:var(--ag-spacing)}.ag-header-cell-label{text-overflow:ellipsis}.ag-header-group-cell-label.ag-sticky-label{flex:none;max-width:100%;overflow:visible;position:sticky}:where(.ag-ltr) .ag-header-group-cell-label.ag-sticky-label{left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-header-group-cell-label.ag-sticky-label{right:var(--ag-cell-horizontal-padding)}.ag-header-cell-text,.ag-header-group-text{overflow:hidden;text-overflow:ellipsis}.ag-header-cell-text{word-break:break-word}.ag-header-cell-comp-wrapper{width:100%}:where(.ag-header-group-cell) .ag-header-cell-comp-wrapper{display:flex}:where(.ag-header-cell:not(.ag-header-cell-auto-height)) .ag-header-cell-comp-wrapper{align-items:center;display:flex;height:100%}.ag-header-cell-wrap-text .ag-header-cell-comp-wrapper{white-space:normal}.ag-header-cell-comp-wrapper-limited-height>*{overflow:hidden}:where(.ag-right-aligned-header) .ag-header-cell-label{flex-direction:row-reverse}:where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{margin-right:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{margin-left:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{margin-left:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{margin-right:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}.ag-header-cell:after,.ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{content:\"\";height:var(--ag-header-column-border-height);position:absolute;top:calc(50% - var(--ag-header-column-border-height)*.5);z-index:1}:where(.ag-ltr) .ag-header-cell:after,:where(.ag-ltr) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-right:var(--ag-header-column-border);right:0}:where(.ag-rtl) .ag-header-cell:after,:where(.ag-rtl) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-left:var(--ag-header-column-border);left:0}.ag-header-highlight-after:after,.ag-header-highlight-before:after{background-color:var(--ag-column-drag-indicator-color);border-radius:calc(var(--ag-column-drag-indicator-width)/2);content:\"\";height:100%;position:absolute;top:0;width:var(--ag-column-drag-indicator-width)}:where(.ag-ltr) .ag-header-highlight-before:after{left:0}:where(.ag-rtl) .ag-header-highlight-before:after{right:0}:where(.ag-ltr) .ag-header-highlight-after:after{right:0;:where(.ag-pinned-left-header) &{right:1px}}:where(.ag-rtl) .ag-header-highlight-after:after{left:0;:where(.ag-pinned-left-header) &{left:1px}}.ag-header-cell-resize{align-items:center;cursor:ew-resize;display:flex;height:100%;position:absolute;top:0;width:8px;z-index:2}:where(.ag-ltr) .ag-header-cell-resize{right:-3px}:where(.ag-rtl) .ag-header-cell-resize{left:-3px}.ag-header-cell-resize:after{background-color:var(--ag-header-column-resize-handle-color);content:\"\";height:var(--ag-header-column-resize-handle-height);position:absolute;top:calc(50% - var(--ag-header-column-resize-handle-height)*.5);width:var(--ag-header-column-resize-handle-width);z-index:1}:where(.ag-ltr) .ag-header-cell-resize:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}:where(.ag-rtl) .ag-header-cell-resize:after{right:calc(50% - var(--ag-header-column-resize-handle-width))}:where(.ag-header-cell.ag-header-span-height) .ag-header-cell-resize:after{height:calc(100% - var(--ag-spacing)*4);top:calc(var(--ag-spacing)*2)}.ag-header-group-cell-no-group:where(.ag-header-span-height){display:none}.ag-sort-indicator-container{display:flex;gap:var(--ag-spacing)}.ag-layout-print{&.ag-body{display:block;height:unset}&.ag-root-wrapper{container-type:normal;display:inline-block}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:none}&.ag-force-vertical-scroll{overflow-y:visible!important}}@media print{.ag-root-wrapper.ag-layout-print{container-type:normal;display:table;.ag-body-horizontal-scroll-viewport,.ag-body-viewport,.ag-center-cols-container,.ag-center-cols-viewport,.ag-root,.ag-root-wrapper-body,.ag-virtual-list-viewport{display:block!important;height:auto!important;overflow:hidden!important}.ag-cell,.ag-row{-moz-column-break-inside:avoid;break-inside:avoid}}}ag-grid,ag-grid-angular{display:block}.ag-root-wrapper{border:var(--ag-wrapper-border);border-radius:var(--ag-wrapper-border-radius);container-type:inline-size;display:flex;flex-direction:column;overflow:hidden;position:relative;&.ag-layout-normal{height:100%}}.ag-root-wrapper-body{display:flex;flex-direction:row;&.ag-layout-normal{flex:1 1 auto;height:0;min-height:0}}.ag-root{display:flex;flex-direction:column;position:relative;&.ag-layout-auto-height,&.ag-layout-normal{flex:1 1 auto;overflow:hidden;width:0}&.ag-layout-normal{height:100%}}.ag-drag-handle{color:var(--ag-drag-handle-color);cursor:grab;:where(.ag-icon){color:var(--ag-drag-handle-color)}}.ag-chart-menu-icon,.ag-chart-settings-next,.ag-chart-settings-prev,.ag-column-group-icons,.ag-column-select-header-icon,.ag-filter-toolpanel-expand,.ag-floating-filter-button-button,.ag-group-title-bar-icon,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,.ag-panel-title-bar-button-icon,.ag-set-filter-group-icons,:where(.ag-group-contracted) .ag-icon,:where(.ag-group-expanded) .ag-icon{background-color:var(--ag-icon-button-background-color);border-radius:var(--ag-icon-button-border-radius);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-background-color);color:var(--ag-icon-button-color)}.ag-chart-menu-icon:hover,.ag-chart-settings-next:hover,.ag-chart-settings-prev:hover,.ag-column-group-icons:hover,.ag-column-select-header-icon:hover,.ag-filter-toolpanel-expand:hover,.ag-floating-filter-button-button:hover,.ag-group-title-bar-icon:hover,.ag-header-cell-filter-button:hover,.ag-header-cell-menu-button:hover,.ag-header-expand-icon:hover,.ag-panel-title-bar-button-icon:hover,.ag-panel-title-bar-button:hover,.ag-set-filter-group-icons:hover,:where(.ag-group-contracted) .ag-icon:hover,:where(.ag-group-expanded) .ag-icon:hover{background-color:var(--ag-icon-button-hover-background-color);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-hover-background-color);color:var(--ag-icon-button-hover-color)}:where(.ag-filter-active),:where(.ag-filter-toolpanel-group-instance-header-icon),:where(.ag-filter-toolpanel-instance-header-icon){position:relative}:where(.ag-filter-active):after,:where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-filter-toolpanel-instance-header-icon):after{background-color:var(--ag-icon-button-active-indicator-color);border-radius:50%;content:\"\";height:6px;position:absolute;top:-1px;width:6px}:where(.ag-ltr) :where(.ag-filter-active):after,:where(.ag-ltr) :where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-ltr) :where(.ag-filter-toolpanel-instance-header-icon):after{right:-1px}:where(.ag-rtl) :where(.ag-filter-active):after,:where(.ag-rtl) :where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-rtl) :where(.ag-filter-toolpanel-instance-header-icon):after{left:-1px}.ag-filter-active{background-image:linear-gradient(var(--ag-icon-button-active-background-color),var(--ag-icon-button-active-background-color));border-radius:1px;outline:solid var(--ag-icon-button-background-spread) var(--ag-icon-button-active-background-color);:where(.ag-icon-filter){clip-path:path(\"M8,0C8,4.415 11.585,8 16,8L16,16L0,16L0,0L8,0Z\");color:var(--ag-icon-button-active-color)}}",IW={wrapperBorder:!0,rowBorder:!0,headerRowBorder:!0,footerRowBorder:{ref:"rowBorder"},columnBorder:{style:"solid",width:1,color:"transparent"},headerColumnBorder:!1,headerColumnBorderHeight:"100%",pinnedColumnBorder:!0,pinnedRowBorder:!0,sidePanelBorder:!0,sideBarPanelWidth:250,sideBarPanelAnimationDuration:0,sideBarBackgroundColor:{ref:"chromeBackgroundColor"},sideButtonBarBackgroundColor:{ref:"sideBarBackgroundColor"},sideButtonBarTopPadding:0,sideButtonSelectedUnderlineWidth:2,sideButtonSelectedUnderlineColor:"transparent",sideButtonSelectedUnderlineTransitionDuration:0,sideButtonBackgroundColor:"transparent",sideButtonTextColor:{ref:"textColor"},sideButtonHoverBackgroundColor:{ref:"sideButtonBackgroundColor"},sideButtonHoverTextColor:{ref:"sideButtonTextColor"},sideButtonSelectedBackgroundColor:x0,sideButtonSelectedTextColor:{ref:"sideButtonTextColor"},sideButtonBorder:"solid 1px transparent",sideButtonSelectedBorder:!0,sideButtonLeftPadding:{ref:"spacing"},sideButtonRightPadding:{ref:"spacing"},sideButtonVerticalPadding:{calc:"spacing * 3"},cellFontFamily:{ref:"fontFamily"},cellFontSize:{ref:"dataFontSize"},cellFontWeight:{ref:"fontWeight"},headerCellHoverBackgroundColor:"transparent",headerCellMovingBackgroundColor:{ref:"headerCellHoverBackgroundColor"},headerCellBackgroundTransitionDuration:"0.2s",cellTextColor:{ref:"textColor"},rangeSelectionBorderStyle:"solid",rangeSelectionBorderColor:S$,rangeSelectionBackgroundColor:A$(0.2),rangeSelectionChartBackgroundColor:"#0058FF1A",rangeSelectionChartCategoryBackgroundColor:"#00FF841A",rangeSelectionHighlightColor:A$(0.5),rangeHeaderHighlightColor:WW(0.08),rowNumbersSelectedColor:A$(0.5),rowHoverColor:A$(0.08),columnHoverColor:A$(0.05),selectedRowBackgroundColor:A$(0.12),modalOverlayBackgroundColor:{ref:"backgroundColor",mix:0.66},dataBackgroundColor:x0,oddRowBackgroundColor:{ref:"dataBackgroundColor"},wrapperBorderRadius:8,cellHorizontalPadding:{calc:"spacing * 2 * cellHorizontalPaddingScale"},cellWidgetSpacing:{calc:"spacing * 1.5"},cellHorizontalPaddingScale:1,rowGroupIndentSize:{calc:"cellWidgetSpacing + iconSize"},valueChangeDeltaUpColor:"#43a047",valueChangeDeltaDownColor:"#e53935",valueChangeValueHighlightBackgroundColor:"#16a08580",rowHeight:{calc:"max(iconSize, cellFontSize) + spacing * 3.25 * rowVerticalPaddingScale"},rowVerticalPaddingScale:1,paginationPanelHeight:{ref:"rowHeight",calc:"max(rowHeight, 22px)"},dragHandleColor:s0(0.7),headerColumnResizeHandleHeight:"30%",headerColumnResizeHandleWidth:2,headerColumnResizeHandleColor:{ref:"borderColor"},iconButtonColor:{ref:"iconColor"},iconButtonBackgroundColor:"transparent",iconButtonBackgroundSpread:4,iconButtonBorderRadius:1,iconButtonHoverColor:{ref:"iconButtonColor"},iconButtonHoverBackgroundColor:s0(0.1),iconButtonActiveColor:S$,iconButtonActiveBackgroundColor:A$(0.28),iconButtonActiveIndicatorColor:S$,setFilterIndentSize:{ref:"iconSize"},chartMenuPanelWidth:260,chartMenuLabelColor:s0(0.8),cellEditingBorder:{color:S$},cellEditingShadow:{ref:"cardShadow"},fullRowEditInvalidBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.25},columnSelectIndentSize:{ref:"iconSize"},toolPanelSeparatorBorder:!0,columnDropCellBackgroundColor:s0(0.07),columnDropCellTextColor:{ref:"textColor"},columnDropCellDragHandleColor:{ref:"textColor"},columnDropCellBorder:{color:s0(0.13)},selectCellBackgroundColor:s0(0.07),selectCellBorder:{color:s0(0.13)},advancedFilterBuilderButtonBarBorder:!0,advancedFilterBuilderIndentSize:{calc:"spacing * 2 + iconSize"},advancedFilterBuilderJoinPillColor:"#f08e8d",advancedFilterBuilderColumnPillColor:"#a6e194",advancedFilterBuilderOptionPillColor:"#f3c08b",advancedFilterBuilderValuePillColor:"#85c0e4",filterPanelApplyButtonColor:x0,filterPanelApplyButtonBackgroundColor:S$,columnPanelApplyButtonColor:x0,columnPanelApplyButtonBackgroundColor:S$,filterPanelCardSubtleColor:{ref:"textColor",mix:0.7},filterPanelCardSubtleHoverColor:{ref:"textColor"},findMatchColor:Tz,findMatchBackgroundColor:"#ffff00",findActiveMatchColor:Tz,findActiveMatchBackgroundColor:"#ffa500",filterToolPanelGroupIndent:{ref:"spacing"},rowLoadingSkeletonEffectColor:s0(0.15),statusBarLabelColor:Tz,statusBarLabelFontWeight:500,statusBarValueColor:Tz,statusBarValueFontWeight:500,pinnedSourceRowTextColor:{ref:"textColor"},pinnedSourceRowBackgroundColor:{ref:"dataBackgroundColor"},pinnedSourceRowFontWeight:600,pinnedRowFontWeight:600,pinnedRowBackgroundColor:{ref:"dataBackgroundColor"},pinnedRowTextColor:{ref:"textColor"},rowDragIndicatorColor:{ref:"rangeSelectionBorderColor"},rowDragIndicatorWidth:2,columnDragIndicatorColor:{ref:"accentColor"},columnDragIndicatorWidth:2},CW=".ag-cell-batch-edit{background-color:var(--ag-cell-batch-edit-background-color);color:var(--ag-cell-batch-edit-text-color);display:inherit}.ag-row-batch-edit{background-color:var(--ag-row-batch-edit-background-color);color:var(--ag-row-batch-edit-text-color)}",P8={cellBatchEditBackgroundColor:"rgba(220 181 139 / 16%)",cellBatchEditTextColor:"#422f00",rowBatchEditBackgroundColor:{ref:"cellBatchEditBackgroundColor"},rowBatchEditTextColor:{ref:"cellBatchEditTextColor"}},bW={...P8,cellBatchEditTextColor:"#f3d0b3"},yW=()=>D$({feature:"batchEditStyle",params:P8,css:CW}),xW=yW(),wW=":where(.ag-button){background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0;text-indent:inherit;text-shadow:inherit;text-transform:inherit;word-spacing:inherit;&:disabled{cursor:default}&:focus-visible{box-shadow:var(--ag-focus-shadow);outline:none}}.ag-standard-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--ag-button-background-color);border:var(--ag-button-border);border-radius:var(--ag-button-border-radius);color:var(--ag-button-text-color);cursor:pointer;font-weight:var(--ag-button-font-weight);padding:var(--ag-button-vertical-padding) var(--ag-button-horizontal-padding);&:active{background-color:var(--ag-button-active-background-color);border:var(--ag-button-active-border);color:var(--ag-button-active-text-color)}&:disabled{background-color:var(--ag-button-disabled-background-color);border:var(--ag-button-disabled-border);color:var(--ag-button-disabled-text-color)}}.ag-standard-button:hover{background-color:var(--ag-button-hover-background-color);border:var(--ag-button-hover-border);color:var(--ag-button-hover-text-color)}",NW={buttonTextColor:"inherit",buttonFontWeight:"normal",buttonBackgroundColor:"transparent",buttonBorder:!1,buttonBorderRadius:{ref:"borderRadius"},buttonHorizontalPadding:{calc:"spacing * 2"},buttonVerticalPadding:{ref:"spacing"},buttonHoverTextColor:{ref:"buttonTextColor"},buttonHoverBackgroundColor:{ref:"buttonBackgroundColor"},buttonHoverBorder:{ref:"buttonBorder"},buttonActiveTextColor:{ref:"buttonHoverTextColor"},buttonActiveBackgroundColor:{ref:"buttonHoverBackgroundColor"},buttonActiveBorder:{ref:"buttonHoverBorder"},buttonDisabledTextColor:{ref:"inputDisabledTextColor"},buttonDisabledBackgroundColor:{ref:"inputDisabledBackgroundColor"},buttonDisabledBorder:{ref:"inputDisabledBorder"}};var gW=()=>D$({feature:"buttonStyle",params:{...NW,buttonBackgroundColor:x0,buttonBorder:!0,buttonHoverBackgroundColor:{ref:"rowHoverColor"},buttonActiveBorder:{color:S$}},css:wW}),hW=gW();var uW=".ag-column-drop-vertical-empty-message{align-items:center;border:dashed var(--ag-border-width);border-color:var(--ag-border-color);display:flex;inset:0;justify-content:center;margin:calc(var(--ag-spacing)*1.5) calc(var(--ag-spacing)*2);overflow:hidden;padding:calc(var(--ag-spacing)*2);position:absolute}";var mW=()=>{return D$({feature:"columnDropStyle",css:uW})},T8=mW();var cW={formulaToken1Color:"#3269c6",formulaToken1BackgroundColor:{ref:"formulaToken1Color",mix:0.08},formulaToken1Border:{color:{ref:"formulaToken1Color"}},formulaToken2Color:"#c0343f",formulaToken2BackgroundColor:{ref:"formulaToken2Color",mix:0.06},formulaToken2Border:{color:{ref:"formulaToken2Color"}},formulaToken3Color:"#8156b8",formulaToken3BackgroundColor:{ref:"formulaToken3Color",mix:0.08},formulaToken3Border:{color:{ref:"formulaToken3Color"}},formulaToken4Color:"#007c1f",formulaToken4BackgroundColor:{ref:"formulaToken4Color",mix:0.06},formulaToken4Border:{color:{ref:"formulaToken4Color"}},formulaToken5Color:"#b03e85",formulaToken5BackgroundColor:{ref:"formulaToken5Color",mix:0.08},formulaToken5Border:{color:{ref:"formulaToken5Color"}},formulaToken6Color:"#b74900",formulaToken6BackgroundColor:{ref:"formulaToken6Color",mix:0.06},formulaToken6Border:{color:{ref:"formulaToken6Color"}},formulaToken7Color:"#247492",formulaToken7BackgroundColor:{ref:"formulaToken7Color",mix:0.08},formulaToken7Border:{color:{ref:"formulaToken7Color"}}},pW=()=>D$({feature:"formulaStyle",params:cW}),iW=pW(),nW={warn:(...$)=>{j($[0],$[1])},error:(...$)=>{e($[0],$[1])},preInitErr:(...$)=>{yQ($[0],$[2],$[1])}},dW=()=>SW(nW).withParams(IW).withPart(hW).withPart(T8).withPart(xW).withPart(iW),tW='.ag-checkbox-input-wrapper,.ag-radio-button-input-wrapper{background-color:var(--ag-checkbox-unchecked-background-color);border:solid var(--ag-checkbox-border-width) var(--ag-checkbox-unchecked-border-color);flex:none;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:where(.ag-checked){background-color:var(--ag-checkbox-checked-background-color);border-color:var(--ag-checkbox-checked-border-color)}&:where(.ag-checked):after{background-color:var(--ag-checkbox-checked-shape-color)}&:where(.ag-disabled){filter:grayscale();opacity:.5}}.ag-checkbox-input,.ag-radio-button-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:block;height:var(--ag-icon-size);margin:0;opacity:0;width:var(--ag-icon-size)}.ag-checkbox-input-wrapper:after,.ag-radio-button-input-wrapper:after{content:"";display:block;inset:0;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;pointer-events:none;position:absolute}.ag-checkbox-input-wrapper:where(:focus-within,:active),.ag-radio-button-input-wrapper:where(:focus-within,:active){box-shadow:var(--ag-focus-shadow)}.ag-checkbox-input-wrapper{border-radius:var(--ag-checkbox-border-radius);&:where(.ag-checked):after{-webkit-mask-image:var(--ag-checkbox-checked-shape-image);mask-image:var(--ag-checkbox-checked-shape-image)}&:where(.ag-indeterminate){background-color:var(--ag-checkbox-indeterminate-background-color);border-color:var(--ag-checkbox-indeterminate-border-color)}&:where(.ag-indeterminate):after{background-color:var(--ag-checkbox-indeterminate-shape-color);-webkit-mask-image:var(--ag-checkbox-indeterminate-shape-image);mask-image:var(--ag-checkbox-indeterminate-shape-image)}}.ag-cell-editing-error .ag-checkbox-input-wrapper:focus-within{box-shadow:var(--ag-focus-error-shadow)}.ag-radio-button-input-wrapper{border-radius:100%;&:where(.ag-checked):after{-webkit-mask-image:var(--ag-radio-checked-shape-image);mask-image:var(--ag-radio-checked-shape-image)}}',sW=()=>D$({feature:"checkboxStyle",params:{checkboxBorderWidth:1,checkboxBorderRadius:{ref:"borderRadius"},checkboxUncheckedBackgroundColor:x0,checkboxUncheckedBorderColor:o0(0.3),checkboxCheckedBackgroundColor:S$,checkboxCheckedBorderColor:{ref:"checkboxCheckedBackgroundColor"},checkboxCheckedShapeImage:{svg:''},checkboxCheckedShapeColor:x0,checkboxIndeterminateBackgroundColor:o0(0.3),checkboxIndeterminateBorderColor:{ref:"checkboxIndeterminateBackgroundColor"},checkboxIndeterminateShapeImage:{svg:''},checkboxIndeterminateShapeColor:x0,radioCheckedShapeImage:{svg:''}},css:tW}),rW=sW();var v8=()=>({...UJ,...bW,backgroundColor:"hsl(217, 0%, 17%)",foregroundColor:"#FFF",chromeBackgroundColor:o0(0.05),rowHoverColor:A$(0.15),selectedRowBackgroundColor:A$(0.2),menuBackgroundColor:o0(0.1),browserColorScheme:"dark",popupShadow:"0 0px 20px #000A",cardShadow:"0 1px 4px 1px #000A",advancedFilterBuilderJoinPillColor:"#7a3a37",advancedFilterBuilderColumnPillColor:"#355f2d",advancedFilterBuilderOptionPillColor:"#5a3168",advancedFilterBuilderValuePillColor:"#374c86",filterPanelApplyButtonColor:Tz,columnPanelApplyButtonColor:Tz,findMatchColor:x0,findActiveMatchColor:x0,checkboxUncheckedBorderColor:o0(0.4),toggleButtonOffBackgroundColor:o0(0.4),rowBatchEditBackgroundColor:o0(0.1),formulaToken1Color:"#4da3e5",formulaToken2Color:"#f55864",formulaToken3Color:"#b688f2",formulaToken4Color:"#24bb4a",formulaToken5Color:"#e772ba",formulaToken6Color:"#f69b5f",formulaToken7Color:"#a3e6ff"});var lW=()=>({...v8(),backgroundColor:"#1f2836"});var aW=()=>D$({feature:"colorScheme",params:UJ,modeParams:{light:UJ,dark:v8(),"dark-blue":lW()}}),oW=aW();var I8={aggregation:'',arrows:'',asc:'',cancel:'',chart:'',"color-picker":'',columns:'',contracted:'',copy:'',cross:'',csv:'',cut:'',desc:'',down:'',excel:'',expanded:'',eye:'',"eye-slash":'',filter:'',first:'',grip:'',group:'',last:'',left:'',linked:'',loading:'',maximize:'',menu:'',"menu-alt":'',minimize:'',minus:'',next:'',none:'',"not-allowed":'',paste:'',pin:'',pivot:'',plus:'',previous:'',right:'',save:'',settings:'',"small-left":'',"small-right":'',tick:'',"tree-closed":'',"tree-indeterminate":'',"tree-open":'',unlinked:'',up:''},C8={aasc:'',adesc:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"column-arrow":'',edit:'',"filter-add":'',"pinned-bottom":'',"pinned-top":'',"small-down":'',"small-up":'',"un-pin":''},eW=($={})=>{let z="";for(let Q of[...Object.keys(I8),...Object.keys(C8)]){let J=$B(Q,$.strokeWidth);z+=`.ag-icon-${Q}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(J)}'); } +`}return z},$B=($,z=1.5)=>{let Q=C8[$];if(Q)return Q;let J=I8[$];if(!J)throw Error(`Missing icon data for ${$}`);return``+J+""},b8=($={})=>{return D$({feature:"iconSet",css:()=>eW($)})},zB=b8({strokeWidth:1}),QB=b8();var JB=":where(.ag-input-field-input[type=number]:not(.ag-number-field-input-stepper)){-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}}.ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-input-text-color);font-family:inherit;font-size:inherit;line-height:inherit;margin:0;min-height:var(--ag-input-height);padding:0;&:where(:disabled){background-color:var(--ag-input-disabled-background-color);border:var(--ag-input-disabled-border);color:var(--ag-input-disabled-text-color)}&:where(:focus){background-color:var(--ag-input-focus-background-color);border:var(--ag-input-focus-border);box-shadow:var(--ag-input-focus-shadow);color:var(--ag-input-focus-text-color);outline:none}&:where(:invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&::-moz-placeholder{color:var(--ag-input-placeholder-text-color)}&::placeholder{color:var(--ag-input-placeholder-text-color)}}:where(.ag-ltr) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-left:var(--ag-input-padding-start)}:where(.ag-rtl) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-right:var(--ag-input-padding-start)}&:where(.ag-ltr,.ag-rtl) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding:0 var(--ag-input-padding-start)}:where(.ag-column-select-header-filter-wrapper),:where(.ag-filter-add-select),:where(.ag-filter-filter),:where(.ag-filter-toolpanel-search),:where(.ag-floating-filter-search-icon),:where(.ag-mini-filter){.ag-input-wrapper:before{background-color:currentcolor;color:var(--ag-input-icon-color);content:\"\";display:block;height:12px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==\");mask-image:url(\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==\");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;opacity:.5;position:absolute;width:12px}}:where(.ag-ltr) :where(.ag-column-select-header-filter-wrapper),:where(.ag-ltr) :where(.ag-filter-add-select),:where(.ag-ltr) :where(.ag-filter-filter),:where(.ag-ltr) :where(.ag-filter-toolpanel-search),:where(.ag-ltr) :where(.ag-floating-filter-search-icon),:where(.ag-ltr) :where(.ag-mini-filter){.ag-input-wrapper:before{margin-left:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)}}:where(.ag-rtl) :where(.ag-column-select-header-filter-wrapper),:where(.ag-rtl) :where(.ag-filter-add-select),:where(.ag-rtl) :where(.ag-filter-filter),:where(.ag-rtl) :where(.ag-filter-toolpanel-search),:where(.ag-rtl) :where(.ag-floating-filter-search-icon),:where(.ag-rtl) :where(.ag-mini-filter){.ag-input-wrapper:before{margin-right:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)}}",ZB=".ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){&:focus{box-shadow:var(--ag-focus-shadow);&:where(.invalid),&:where(:invalid){box-shadow:var(--ag-focus-error-shadow)}}}";var XB={inputBackgroundColor:"transparent",inputBorder:!1,inputBorderRadius:0,inputTextColor:{ref:"textColor"},inputPlaceholderTextColor:{ref:"inputTextColor",mix:0.5},inputPaddingStart:0,inputHeight:{calc:"max(iconSize, fontSize) + spacing * 2"},inputFocusBackgroundColor:{ref:"inputBackgroundColor"},inputFocusBorder:{ref:"inputBorder"},inputFocusShadow:"none",inputFocusTextColor:{ref:"inputTextColor"},inputDisabledBackgroundColor:{ref:"inputBackgroundColor"},inputDisabledBorder:{ref:"inputBorder"},inputDisabledTextColor:{ref:"inputTextColor"},inputInvalidBackgroundColor:{ref:"inputBackgroundColor"},inputInvalidBorder:{ref:"inputBorder"},inputInvalidTextColor:{ref:"inputTextColor"},inputIconColor:{ref:"inputTextColor"},pickerButtonBorder:!1,pickerButtonFocusBorder:{ref:"inputFocusBorder"},pickerButtonBackgroundColor:{ref:"backgroundColor"},pickerButtonFocusBackgroundColor:{ref:"backgroundColor"},pickerListBorder:!1,pickerListBackgroundColor:{ref:"backgroundColor"},colorPickerThumbSize:18,colorPickerTrackSize:12,colorPickerThumbBorderWidth:3,colorPickerTrackBorderRadius:12,colorPickerColorBorderRadius:4};var YB=()=>D$({feature:"inputStyle",params:{...XB,inputBackgroundColor:x0,inputBorder:!0,inputBorderRadius:{ref:"borderRadius"},inputPaddingStart:{ref:"spacing"},inputFocusBorder:{color:S$},inputFocusShadow:{ref:"focusShadow"},inputDisabledBackgroundColor:o0(0.06),inputDisabledTextColor:{ref:"textColor",mix:0.5},inputInvalidBorder:{color:{ref:"invalidColor"}},pickerButtonBorder:!0,pickerListBorder:!0},css:()=>JB+ZB}),qB=YB();var GB=".ag-tabs-header{background-color:var(--ag-tab-bar-background-color);border-bottom:var(--ag-tab-bar-border);display:flex;flex:1;gap:var(--ag-tab-spacing);padding:var(--ag-tab-bar-top-padding) var(--ag-tab-bar-horizontal-padding) 0}.ag-tabs-header-wrapper{display:flex}.ag-tabs-close-button-wrapper{align-items:center;border:0;display:flex;padding:var(--ag-spacing)}:where(.ag-ltr) .ag-tabs-close-button-wrapper{border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-tabs-close-button-wrapper{border-left:solid var(--ag-border-width) var(--ag-border-color)}.ag-tabs-close-button{background-color:unset;border:0;cursor:pointer;padding:0}.ag-tab{align-items:center;background-color:var(--ag-tab-background-color);border-left:var(--ag-tab-selected-border-width) solid transparent;border-right:var(--ag-tab-selected-border-width) solid transparent;color:var(--ag-tab-text-color);cursor:pointer;display:flex;flex:1;justify-content:center;padding:var(--ag-tab-top-padding) var(--ag-tab-horizontal-padding) var(--ag-tab-bottom-padding);position:relative}.ag-tab:hover{background-color:var(--ag-tab-hover-background-color);color:var(--ag-tab-hover-text-color)}.ag-tab.ag-tab-selected{background-color:var(--ag-tab-selected-background-color);color:var(--ag-tab-selected-text-color)}:where(.ag-ltr) .ag-tab.ag-tab-selected:where(:not(:first-of-type)){border-left-color:var(--ag-tab-selected-border-color)}:where(.ag-rtl) .ag-tab.ag-tab-selected:where(:not(:first-of-type)){border-right-color:var(--ag-tab-selected-border-color)}:where(.ag-ltr) .ag-tab.ag-tab-selected:where(:not(:last-of-type)){border-right-color:var(--ag-tab-selected-border-color)}:where(.ag-rtl) .ag-tab.ag-tab-selected:where(:not(:last-of-type)){border-left-color:var(--ag-tab-selected-border-color)}.ag-tab:after{background-color:var(--ag-tab-selected-underline-color);bottom:0;content:\"\";display:block;height:var(--ag-tab-selected-underline-width);left:0;opacity:0;position:absolute;right:0;transition:opacity var(--ag-tab-selected-underline-transition-duration)}.ag-tab.ag-tab-selected:after{opacity:1}";var _B={tabBarBackgroundColor:"transparent",tabBarHorizontalPadding:0,tabBarTopPadding:0,tabBackgroundColor:"transparent",tabTextColor:{ref:"textColor"},tabHorizontalPadding:{ref:"spacing"},tabTopPadding:{ref:"spacing"},tabBottomPadding:{ref:"spacing"},tabSpacing:"0",tabHoverBackgroundColor:{ref:"tabBackgroundColor"},tabHoverTextColor:{ref:"tabTextColor"},tabSelectedBackgroundColor:{ref:"tabBackgroundColor"},tabSelectedTextColor:{ref:"tabTextColor"},tabSelectedBorderWidth:{ref:"borderWidth"},tabSelectedBorderColor:"transparent",tabSelectedUnderlineColor:"transparent",tabSelectedUnderlineWidth:0,tabSelectedUnderlineTransitionDuration:0,tabBarBorder:!1};var HB=()=>D$({feature:"tabStyle",params:{..._B,tabBarBorder:!0,tabBarBackgroundColor:s0(0.05),tabTextColor:{ref:"textColor",mix:0.7},tabSelectedTextColor:{ref:"textColor"},tabHoverTextColor:{ref:"textColor"},tabSelectedBorderColor:{ref:"borderColor"},tabSelectedBackgroundColor:x0},css:GB}),UB=HB();var WB=()=>({fontFamily:[{googleFont:"IBM Plex Sans"},"-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu"]}),BB=()=>dW().withPart(rW).withPart(oW).withPart(QB).withPart(UB).withPart(qB).withPart(T8).withParams(WB()),y8=BB();var Ez=($,z,Q,J,Z)=>({changeKey:$,type:z,defaultValue:Q,noWarn:J,cacheDefault:Z}),EB=Ez("cellHorizontalPadding","length",16),KB=Ez("indentationLevel","length",0,!0,!0),LB=Ez("rowGroupIndentSize","length",0),u5=Ez("rowHeight","length",42),m5=Ez("headerHeight","length",48),nZ=Ez("rowBorderWidth","border",1),c5=Ez("pinnedRowBorderWidth","border",1),DB=Ez("headerRowBorderWidth","border",1);function FB($,z){for(let Q of z.sort((J,Z)=>J.moduleName.localeCompare(Z.moduleName))){let J=Q.css;if(J)$.set(`module-${Q.moduleName}`,J)}}var MB=class extends PW{initVariables(){this.addManagedPropertyListener("rowHeight",()=>this.refreshRowHeightVariable()),this.getSizeEl(u5),this.getSizeEl(m5),this.getSizeEl(nZ),this.getSizeEl(c5),this.refreshRowBorderWidthVariable()}getPinnedRowBorderWidth(){return this.getCSSVariablePixelValue(c5)}getRowBorderWidth(){return this.getCSSVariablePixelValue(nZ)}getHeaderRowBorderWidth(){return this.getCSSVariablePixelValue(DB)}getDefaultRowHeight(){return this.getCSSVariablePixelValue(u5)}getDefaultHeaderHeight(){return this.getCSSVariablePixelValue(m5)}getDefaultCellHorizontalPadding(){return this.getCSSVariablePixelValue(EB)}getCellPaddingLeft(){let $=this.getDefaultCellHorizontalPadding(),z=this.getCSSVariablePixelValue(KB),Q=this.getCSSVariablePixelValue(LB);return $-1+Q*z}getCellPadding(){let $=this.getDefaultCellHorizontalPadding()-1;return this.getCellPaddingLeft()+$}getDefaultColumnMinWidth(){return Math.min(36,this.getDefaultRowHeight())}refreshRowHeightVariable(){let{eRootDiv:$}=this,z=$.style.getPropertyValue("--ag-line-height").trim(),Q=this.gos.get("rowHeight");if(Q==null||isNaN(Q)||!isFinite(Q)){if(z!==null)$.style.setProperty("--ag-line-height",null);return-1}let J=`${Q}px`;if(z!=J)return $.style.setProperty("--ag-line-height",J),Q;return z!=""?Number.parseFloat(z):-1}fireStylesChangedEvent($){if($==="rowBorderWidth")this.refreshRowBorderWidthVariable();super.fireStylesChangedEvent($)}refreshRowBorderWidthVariable(){let $=this.getCSSVariablePixelValue(nZ);this.eRootDiv.style.setProperty("--ag-internal-row-border-width",`${$}px`)}postProcessThemeChange($,z){if($&&getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded"))if(z)e(106);else e(239)}getAdditionalCss(){let $=new Map;return $.set("core",[vW]),FB($,Array.from(Bq())),$}getDefaultTheme(){return y8}varError($,z){j(9,{variable:{cssName:$,defaultValue:z}})}themeError($){e(240,{theme:$})}shadowRootError(){e(293)}},kB=class extends R0{constructor(){super(...arguments);this.beanName="eventSvc",this.eventServiceType="global",this.globalSvc=new K$}addListener($,z,Q){this.globalSvc.addEventListener($,z,Q)}removeListener($,z,Q){this.globalSvc.removeEventListener($,z,Q)}addGlobalListener($,z=!1){this.globalSvc.addGlobalListener($,z)}removeGlobalListener($,z=!1){this.globalSvc.removeGlobalListener($,z)}dispatchEvent($){this.globalSvc.dispatchEvent(this.gos.addCommon($))}dispatchEventOnce($){this.globalSvc.dispatchEventOnce(this.gos.addCommon($))}},VB=class extends kB{postConstruct(){let{globalListener:$,globalSyncListener:z}=this.beans;if($)this.addGlobalListener($,!0);if(z)this.addGlobalListener(z,!1)}};function E2($,z,Q){let J=$.visibleCols.headerGroupRowCount;if(Q>=J)return{column:z,headerRowIndex:Q};let Z=z.getParent();while(Z&&Z.getProvidedColumnGroup().getLevel()>Q)Z=Z.getParent();let X=z.isSpanHeaderHeight();if(!Z||X&&Z.isPadding())return{column:z,headerRowIndex:J};return{column:Z,headerRowIndex:Z.getProvidedColumnGroup().getLevel()}}var AB=class extends S{constructor(){super(...arguments);this.beanName="headerNavigation",this.currentHeaderRowWithoutSpan=-1}postConstruct(){let $=this.beans;$.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCon=Q.gridBodyCtrl});let z=Y0($);this.addManagedElementListeners(z,{mousedown:()=>{this.currentHeaderRowWithoutSpan=-1}})}getHeaderPositionForColumn($,z){let Q,{colModel:J,colGroupSvc:Z,ctrlsSvc:X}=this.beans;if(typeof $==="string"){if(Q=J.getCol($),!Q)Q=Z?.getColumnGroup($)??null}else Q=$;if(!Q)return null;let q=X.getHeaderRowContainerCtrl()?.getAllCtrls(),G=b(q||[]).type==="filter",_=l0(this.beans)-1,H=-1,U=Q;while(U)H++,U=U.getParent();let W=H;if(z&&G&&W===_-1)W++;return W===-1?null:{headerRowIndex:W,column:Q}}navigateVertically($,z){let{focusSvc:Q,visibleCols:J}=this.beans,{focusedHeader:Z}=Q;if(!Z)return!1;let{headerRowIndex:X}=Z,Y=Z.column,q=l0(this.beans),G=this.getHeaderRowType(X),_=J.headerGroupRowCount,{headerRowIndex:H,column:U,headerRowIndexWithoutSpan:W}=$==="UP"?SB(G,Y,X):RB(Y,X,_),B=!1;if(H<0)H=0,U=Y,B=!0;if(H>=q)H=-1,this.currentHeaderRowWithoutSpan=-1;else if(W!==void 0)this.currentHeaderRowWithoutSpan=W;if(!B&&!U)return!1;return Q.focusHeaderPosition({headerPosition:{headerRowIndex:H,column:U},allowUserOverride:!0,event:z})}navigateHorizontally($,z=!1,Q){let{focusSvc:J,gos:Z}=this.beans,X={...J.focusedHeader},Y,q;if(this.currentHeaderRowWithoutSpan!==-1)X.headerRowIndex=this.currentHeaderRowWithoutSpan;else this.currentHeaderRowWithoutSpan=X.headerRowIndex;if($==="LEFT"!==Z.get("enableRtl"))q="Before",Y=this.findHeader(X,q);else q="After",Y=this.findHeader(X,q);let G=Z.getCallback("tabToNextHeader");if(z&&G){let _=J.focusHeaderPositionFromUserFunc({userFunc:G,headerPosition:Y,direction:q});if(_){let{headerRowIndex:H}=J.focusedHeader||{};if(H!=null&&H!=X.headerRowIndex)this.currentHeaderRowWithoutSpan=H}return _}if(Y||!z)return J.focusHeaderPosition({headerPosition:Y,direction:q,fromTab:z,allowUserOverride:!0,event:Q});return this.focusNextHeaderRow(X,q,Q)}focusNextHeaderRow($,z,Q){let J=this.beans,Z=$.headerRowIndex,X=null,Y,q=l0(J),G=this.beans.visibleCols.allCols;if(z==="Before"){if(Z<=0)return!1;X=b(G),Y=Z-1,this.currentHeaderRowWithoutSpan-=1}else if(X=G[0],Y=Z+1,this.currentHeaderRowWithoutSpan=q)H=-1;return J.focusSvc.focusHeaderPosition({headerPosition:{column:_,headerRowIndex:H},direction:z,fromTab:!0,allowUserOverride:!0,event:Q})}scrollToColumn($,z="After"){if($.getPinned())return;let Q;if(H0($)){let J=$.getDisplayedLeafColumns();Q=z==="Before"?b(J):J[0]}else Q=$;this.gridBodyCon.scrollFeature.ensureColumnVisible(Q)}findHeader($,z){let{colGroupSvc:Q,visibleCols:J}=this.beans,Z=$.column;if(Z instanceof aQ){let G=Z.getDisplayedLeafColumns();Z=z==="Before"?G[0]:G[G.length-1]}let X=z==="Before"?J.getColBefore(Z):J.getColAfter(Z);if(!X)return;let Y=J.headerGroupRowCount;if($.headerRowIndex>=Y)return{headerRowIndex:$.headerRowIndex,column:X};let q=Q?.getColGroupAtLevel(X,$.headerRowIndex);if(!q)return{headerRowIndex:X instanceof q$&&X.isSpanHeaderHeight()?J.headerGroupRowCount:$.headerRowIndex,column:X};if(q.isPadding()&&X.isSpanHeaderHeight())return{headerRowIndex:J.headerGroupRowCount,column:X};return{headerRowIndex:$.headerRowIndex,column:q??X}}getHeaderRowType($){let z=this.beans.ctrlsSvc.getHeaderRowContainerCtrl();if(z)return z.getRowType($)}};function SB($,z,Q){let J=Q-1;if($!=="filter"){let Z=z instanceof q$&&z.isSpanHeaderHeight(),X=z.getParent();while(X&&(X.getProvidedColumnGroup().getLevel()>J||Z&&X.isPadding()))X=X.getParent();if(X)if(Z)return{column:X,headerRowIndex:X.getProvidedColumnGroup().getLevel(),headerRowIndexWithoutSpan:J};else return{column:X,headerRowIndex:J,headerRowIndexWithoutSpan:J}}return{column:z,headerRowIndex:J,headerRowIndexWithoutSpan:J}}function RB($,z,Q){let J=z+1,Z={column:$,headerRowIndex:J,headerRowIndexWithoutSpan:J};if($ instanceof aQ){if(J>=Q)return{column:$.getDisplayedLeafColumns()[0],headerRowIndex:Q,headerRowIndexWithoutSpan:J};let Y=$.getDisplayedChildren()[0];if(Y instanceof aQ&&Y.isPadding()){let G=Y.getDisplayedLeafColumns()[0];if(G.isSpanHeaderHeight())Y=G}if(Z.column=Y,Y instanceof q$&&Y.isSpanHeaderHeight())Z.headerRowIndex=Q,Z.headerRowIndexWithoutSpan=J}return Z}var jB=class extends S{constructor(){super(...arguments);this.beanName="focusSvc",this.focusFallbackTimeout=null,this.needsFocusRestored=!1}wireBeans($){this.colModel=$.colModel,this.visibleCols=$.visibleCols,this.rowRenderer=$.rowRenderer,this.navigation=$.navigation,this.filterManager=$.filterManager,this.overlays=$.overlays}postConstruct(){let $=this.clearFocusedCell.bind(this);this.addManagedEventListeners({columnPivotModeChanged:$,newColumnsLoaded:this.onColumnEverythingChanged.bind(this),columnGroupOpened:$,columnRowGroupChanged:$}),this.addDestroyFunc(IG(this.beans))}attemptToRecoverFocus(){if(this.needsFocusRestored=!0,this.focusFallbackTimeout!=null)clearTimeout(this.focusFallbackTimeout);this.focusFallbackTimeout=window.setTimeout(this.setFocusRecovered.bind(this),100)}setFocusRecovered(){if(this.needsFocusRestored=!1,this.focusFallbackTimeout!=null)clearTimeout(this.focusFallbackTimeout),this.focusFallbackTimeout=null}shouldTakeFocus(){if(this.gos.get("suppressFocusAfterRefresh"))return this.setFocusRecovered(),!1;if(this.needsFocusRestored)return this.setFocusRecovered(),!0;return this.doesRowOrCellHaveBrowserFocus()}onColumnEverythingChanged(){if(!this.focusedCell)return;let $=this.focusedCell.column,z=this.colModel.getCol($.getId());if($!==z)this.clearFocusedCell()}getFocusCellToUseAfterRefresh(){let{gos:$,focusedCell:z}=this;if($.get("suppressFocusAfterRefresh")||$.get("suppressCellFocus")||!z)return null;if(!this.doesRowOrCellHaveBrowserFocus())return null;return z}getFocusHeaderToUseAfterRefresh(){if(this.gos.get("suppressFocusAfterRefresh")||!this.focusedHeader)return null;if(!this.isDomDataPresentInHierarchy(d(this.beans),n7))return null;return this.focusedHeader}doesRowOrCellHaveBrowserFocus(){let $=d(this.beans);if(this.isDomDataPresentInHierarchy($,GJ,!0))return!0;return this.isDomDataPresentInHierarchy($,_J,!0)}isDomDataPresentInHierarchy($,z,Q){let J=$;while(J){let Z=Q7(this.gos,J,z);if(Z){if(Z.destroyed&&Q)return this.attemptToRecoverFocus(),!1;return!0}J=J.parentNode}return!1}getFocusedCell(){return this.focusedCell}getFocusEventParams($){let{rowIndex:z,rowPinned:Q,column:J}=$,Z={rowIndex:z,rowPinned:Q,column:J,isFullWidthCell:!1},X=this.rowRenderer.getRowByPosition({rowIndex:z,rowPinned:Q});if(X)Z.isFullWidthCell=X.isFullWidth();return Z}clearFocusedCell(){if(this.focusedCell==null)return;let $=this.getFocusEventParams(this.focusedCell);this.focusedCell=null,this.eventSvc.dispatchEvent({type:"cellFocusCleared",...$})}setFocusedCell($){this.setFocusRecovered();let{column:z,rowIndex:Q,rowPinned:J,forceBrowserFocus:Z=!1,preventScrollOnBrowserFocus:X=!1,sourceEvent:Y}=$,q=this.colModel.getCol(z);if(!q){this.focusedCell=null;return}this.focusedCell={rowIndex:Q,rowPinned:j$(J),column:q};let G=this.getFocusEventParams(this.focusedCell);this.eventSvc.dispatchEvent({type:"cellFocused",...G,...this.previousCellFocusParams&&{previousParams:this.previousCellFocusParams},forceBrowserFocus:Z,preventScrollOnBrowserFocus:X,sourceEvent:Y}),this.previousCellFocusParams=G}isCellFocused($){if(this.focusedCell==null)return!1;return AQ($,this.focusedCell)}isHeaderWrapperFocused($){if(this.focusedHeader==null)return!1;let{column:z,rowCtrl:{rowIndex:Q,pinned:J}}=$,{column:Z,headerRowIndex:X}=this.focusedHeader;return z===Z&&Q===X&&J==Z.getPinned()}focusHeaderPosition($){if(this.setFocusRecovered(),H$(this.beans))return!1;let{direction:z,fromTab:Q,allowUserOverride:J,event:Z,fromCell:X,rowWithoutSpanValue:Y,scroll:q=!0}=$,{headerPosition:G}=$;if(X&&this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(G);if(J){let _=this.focusedHeader,H=l0(this.beans);if(Q){let U=this.gos.getCallback("tabToNextHeader");if(U)G=this.getHeaderPositionFromUserFunc({userFunc:U,direction:z,currentPosition:_,headerPosition:G,headerRowCount:H})}else{let U=this.gos.getCallback("navigateToNextHeader");if(U&&Z){let W={key:Z.key,previousHeaderPosition:_,nextHeaderPosition:G,headerRowCount:H,event:Z},B=U(W);G=B===null?_:B}}}if(!G)return!1;return this.focusProvidedHeaderPosition({headerPosition:G,direction:z,event:Z,fromCell:X,rowWithoutSpanValue:Y,scroll:q})}focusHeaderPositionFromUserFunc($){if(H$(this.beans))return!1;let{userFunc:z,headerPosition:Q,direction:J,event:Z}=$,X=this.focusedHeader,Y=l0(this.beans),q=this.getHeaderPositionFromUserFunc({userFunc:z,direction:J,currentPosition:X,headerPosition:Q,headerRowCount:Y});return!!q&&this.focusProvidedHeaderPosition({headerPosition:q,direction:J,event:Z})}getHeaderPositionFromUserFunc($){let{userFunc:z,direction:Q,currentPosition:J,headerPosition:Z,headerRowCount:X}=$,q=z({backwards:Q==="Before",previousHeaderPosition:J,nextHeaderPosition:Z,headerRowCount:X});if(q===!0)return J;if(q===!1)return null;return q}focusProvidedHeaderPosition($){let{headerPosition:z,direction:Q,fromCell:J,rowWithoutSpanValue:Z,event:X,scroll:Y=!0}=$,{column:q,headerRowIndex:G}=z,{filterManager:_,ctrlsSvc:H,headerNavigation:U}=this.beans;if(this.focusedHeader&&Q_($.headerPosition,this.focusedHeader))return!1;if(G===-1){if(_?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(z);return this.focusGridView({column:q,event:X})}if(Y)U?.scrollToColumn(q,Q);let B=H.getHeaderRowContainerCtrl(q.getPinned())?.focusHeader(z.headerRowIndex,q,X)||!1;if(U&&B&&(Z!=null||J))U.currentHeaderRowWithoutSpan=Z??-1;return B}focusFirstHeader(){if(this.overlays?.exclusive&&this.focusOverlay())return!0;let $=this.visibleCols.allCols[0];if(!$)return!1;let z=E2(this.beans,$,0);return this.focusHeaderPosition({headerPosition:z,rowWithoutSpanValue:0})}focusLastHeader($){if(this.overlays?.exclusive&&this.focusOverlay(!0))return!0;let z=l0(this.beans)-1,Q=b(this.visibleCols.allCols);return this.focusHeaderPosition({headerPosition:{headerRowIndex:z,column:Q},rowWithoutSpanValue:-1,event:$})}focusPreviousFromFirstCell($){if(this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(null);return this.focusLastHeader($)}isAnyCellFocused(){return!!this.focusedCell}isRowFocused($,z){if(this.focusedCell==null)return!1;return this.focusedCell.rowIndex===$&&this.focusedCell.rowPinned===j$(z)}focusOverlay($){let z=this.overlays?.isVisible()&&this.overlays.eWrapper?.getGui();return!!z&&F0(z,$)}getDefaultTabToNextGridContainerTarget($){let{backwards:z,focusableContainers:Q}=$,J=z?-1:1,Z,X=()=>{if(Z===void 0)Z=this.getGridBodyTabTarget(z);return Z};for(let Y=$.nextIndex;Y>=0&&Y{$.executeLaterVMTurn(()=>this.updateScrollVisibleImpl())});else this.updateScrollVisibleImpl()}updateScrollVisibleImpl(){let $=this.ctrlsSvc.get("center");if(!$||this.colAnimation?.isActive())return;let z={horizontalScrollShowing:$.isHorizontalScrollShowing(),verticalScrollShowing:this.verticalScrollShowing};this.setScrollsVisible(z),this.updateScrollGap()}updateScrollGap(){let $=this.ctrlsSvc.get("center"),z=$.hasHorizontalScrollGap(),Q=$.hasVerticalScrollGap();if(this.horizontalScrollGap!==z||this.verticalScrollGap!==Q)this.horizontalScrollGap=z,this.verticalScrollGap=Q,this.eventSvc.dispatchEvent({type:"scrollGapChanged"})}setScrollsVisible($){if(this.horizontalScrollShowing!==$.horizontalScrollShowing||this.verticalScrollShowing!==$.verticalScrollShowing)this.horizontalScrollShowing=$.horizontalScrollShowing,this.verticalScrollShowing=$.verticalScrollShowing,this.eventSvc.dispatchEvent({type:"scrollVisibilityChanged"})}getScrollbarWidth(){if(this.scrollbarWidth==null){let $=this.gos.get("scrollbarWidth"),Q=typeof $==="number"&&$>=0?$:t2();if(Q!=null)this.scrollbarWidth=Q,this.eventSvc.dispatchEvent({type:"scrollbarWidthChanged"})}return this.scrollbarWidth}},OB=class extends S{constructor(){super(...arguments);this.beanName="gridDestroySvc",this.destroyCalled=!1}destroy(){if(this.destroyCalled)return;let{stateSvc:$,ctrlsSvc:z,context:Q}=this.beans;this.eventSvc.dispatchEvent({type:"gridPreDestroyed",state:$?.getState()??{}}),this.destroyCalled=!0,z.get("gridCtrl")?.destroyGridUi(),Q.destroy(),super.destroy()}},PB=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","pinnedRowsChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterUiChanged","filterOpened","floatingFilterUiChanged","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel","findChanged","rowResizeStarted","rowResizeEnded","columnsReset","bulkEditingStarted","bulkEditingStopped","batchEditingStarted","batchEditingStopped"];var r1=new Set(["gridPreDestroyed","fillStart","pasteStart"]),M4=PB.reduce(($,z)=>{return $[z]=Cq(z),$},{}),BQ={agSetColumnFilter:"SetFilter",agSetColumnFloatingFilter:"SetFilter",agMultiColumnFilter:"MultiFilter",agMultiColumnFloatingFilter:"MultiFilter",agGroupColumnFilter:"GroupFilter",agGroupColumnFloatingFilter:"GroupFilter",agGroupCellRenderer:"GroupCellRenderer",agGroupRowRenderer:"GroupCellRenderer",agRichSelect:"RichSelect",agRichSelectCellEditor:"RichSelect",agDetailCellRenderer:"SharedMasterDetail",agSparklineCellRenderer:"Sparklines",agDragAndDropImage:"SharedDragAndDrop",agColumnHeader:"ColumnHeaderComp",agColumnGroupHeader:"ColumnGroupHeaderComp",agSortIndicator:"Sort",agAnimateShowChangeCellRenderer:"HighlightChanges",agAnimateSlideCellRenderer:"HighlightChanges",agLoadingCellRenderer:"LoadingCellRenderer",agSkeletonCellRenderer:"SkeletonCellRenderer",agCheckboxCellRenderer:"CheckboxCellRenderer",agLoadingOverlay:"Overlay",agExportingOverlay:"Overlay",agNoRowsOverlay:"Overlay",agNoMatchingRowsOverlay:"Overlay",agTooltipComponent:"Tooltip",agReadOnlyFloatingFilter:"CustomFilter",agTextColumnFilter:"TextFilter",agNumberColumnFilter:"NumberFilter",agBigIntColumnFilter:"BigIntFilter",agDateColumnFilter:"DateFilter",agDateInput:"DateFilter",agTextColumnFloatingFilter:"TextFilter",agNumberColumnFloatingFilter:"NumberFilter",agBigIntColumnFloatingFilter:"BigIntFilter",agDateColumnFloatingFilter:"DateFilter",agFormulaCellEditor:"Formula",agCellEditor:"TextEditor",agSelectCellEditor:"SelectEditor",agTextCellEditor:"TextEditor",agNumberCellEditor:"NumberEditor",agDateCellEditor:"DateEditor",agDateStringCellEditor:"DateEditor",agCheckboxCellEditor:"CheckboxEditor",agLargeTextCellEditor:"LargeTextEditor",agMenuItem:"MenuItem",agColumnsToolPanel:"ColumnsToolPanel",agFiltersToolPanel:"FiltersToolPanel",agNewFiltersToolPanel:"NewFiltersToolPanel",agAggregationComponent:"StatusBar",agSelectedRowCountComponent:"StatusBar",agTotalRowCountComponent:"StatusBar",agFilteredRowCountComponent:"StatusBar",agTotalAndFilteredRowCountComponent:"StatusBar",agFindCellRenderer:"Find"};function p5($){return`"${$}"`}var TB=()=>({checkboxSelection:{version:"32.2",message:"Use `rowSelection.checkboxes` in `GridOptions` instead."},headerCheckboxSelection:{version:"32.2",message:"Use `rowSelection.headerCheckbox = true` in `GridOptions` instead."},headerCheckboxSelectionFilteredOnly:{version:"32.2",message:'Use `rowSelection.selectAll = "filtered"` in `GridOptions` instead.'},headerCheckboxSelectionCurrentPageOnly:{version:"32.2",message:'Use `rowSelection.selectAll = "currentPage"` in `GridOptions` instead.'},showDisabledCheckboxes:{version:"32.2",message:"Use `rowSelection.hideDisabledCheckboxes = true` in `GridOptions` instead."},rowGroupingHierarchy:{version:"34.3",message:"Use `colDef.groupHierarchy` instead."}}),vB={allowFormula:"Formula",aggFunc:"SharedAggregation",autoHeight:"RowAutoHeight",cellClass:"CellStyle",cellClassRules:"CellStyle",cellEditor:({cellEditor:$,editable:z,groupRowEditable:Q})=>{if(!(!!z||!!Q))return null;if(typeof $==="string")return BQ[$]??"CustomEditor";return"CustomEditor"},cellRenderer:({cellRenderer:$})=>{if(typeof $!=="string")return null;return BQ[$]},cellStyle:"CellStyle",columnChooserParams:"ColumnMenu",contextMenuItems:"ContextMenu",dndSource:"DragAndDrop",dndSourceOnRowDrag:"DragAndDrop",editable:({editable:$,cellEditor:z})=>{if($&&!z)return"TextEditor";return null},groupRowEditable:({groupRowEditable:$,cellEditor:z})=>{if(!$)return null;return z?"RowGroupingEdit":["RowGroupingEdit","TextEditor"]},groupRowValueSetter:({groupRowValueSetter:$})=>$?"RowGroupingEdit":null,enableCellChangeFlash:"HighlightChanges",enablePivot:"SharedPivot",enableRowGroup:"SharedRowGrouping",enableValue:"SharedAggregation",filter:({filter:$})=>{if($&&typeof $!=="string"&&typeof $!=="boolean")return"CustomFilter";if(typeof $==="string")return BQ[$]??"ColumnFilter";return"ColumnFilter"},floatingFilter:"ColumnFilter",getQuickFilterText:"QuickFilter",headerTooltip:"Tooltip",headerTooltipValueGetter:"Tooltip",mainMenuItems:"ColumnMenu",menuTabs:($)=>{let z=["columnsMenuTab","generalMenuTab"];if($.menuTabs?.some((Q)=>z.includes(Q)))return"ColumnMenu";return null},pivot:"SharedPivot",pivotIndex:"SharedPivot",rowDrag:"RowDrag",rowGroup:"SharedRowGrouping",rowGroupIndex:"SharedRowGrouping",tooltipField:"Tooltip",tooltipValueGetter:"Tooltip",tooltipComponentSelector:"Tooltip",spanRows:"CellSpan",groupHierarchy:"SharedRowGrouping"},IB=()=>{return{autoHeight:{supportedRowModels:["clientSide","serverSide"],validate:(z,{paginationAutoPageSize:Q})=>{if(Q)return"colDef.autoHeight is not supported with paginationAutoPageSize.";return null}},allowFormula:{supportedRowModels:["clientSide"]},cellRendererParams:{validate:(z)=>{if((z.rowGroup!=null||z.rowGroupIndex!=null||z.cellRenderer==="agGroupCellRenderer")&&"checkbox"in z.cellRendererParams)return'Since v33.0, `cellRendererParams.checkbox` has been deprecated. Use `rowSelection.checkboxLocation = "autoGroupColumn"` instead.';return null}},flex:{validate:(z,Q)=>{if(Q.autoSizeStrategy)return"colDef.flex is not supported with gridOptions.autoSizeStrategy";return null}},headerCheckboxSelection:{supportedRowModels:["clientSide","serverSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelection is only supported with rowSelection=multiple"},headerCheckboxSelectionCurrentPageOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple"},headerCheckboxSelectionFilteredOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple"},headerValueGetter:{validate:(z)=>{let Q=z.headerValueGetter;if(typeof Q==="function"||typeof Q==="string")return null;return"headerValueGetter must be a function or a valid string expression"}},icons:{validate:({icons:z})=>{if(z){if(z.smallDown)return $$(262);if(z.smallLeft)return $$(263);if(z.smallRight)return $$(264)}return null}},sort:{validate:(z)=>{if(UQ(z.sort)||Zz(z.sort))return null;return`sort must be of type (SortDirection | SortDef), currently it is ${typeof z.sort==="object"?JSON.stringify(z.sort):i1(z.sort)}`}},initialSort:{validate:(z)=>{if(UQ(z.initialSort)||Zz(z.initialSort))return null;return`initialSort must be of non-null type (SortDirection | SortDef), currently it is ${typeof z.initialSort==="object"?JSON.stringify(z.initialSort):i1(z.initialSort)}`}},sortingOrder:{validate:(z)=>{let Q=z.sortingOrder;if(Array.isArray(Q)&&Q.length>0){let J=Q.filter((Z)=>{return!(UQ(Z)||Zz(Z))});if(J.length>0)return`sortingOrder must be an array of type non-null (SortDirection | SortDef)[], incorrect items are: [${J.map((Z)=>typeof Z==="string"||Z==null?i1(Z):JSON.stringify(Z)).join(", ")}]`}else if(!Array.isArray(Q)||!Q.length)return`sortingOrder must be an array with at least one element, currently it is [${Q}]`;return null}},type:{validate:(z)=>{let Q=z.type;if(Q instanceof Array){if(Q.some((Z)=>typeof Z!=="string"))return"if colDef.type is supplied an array it should be of type 'string[]'";return null}if(typeof Q==="string")return null;return"colDef.type should be of type 'string' | 'string[]'"}},rowSpan:{validate:(z,{suppressRowTransform:Q})=>{if(!Q)return"colDef.rowSpan requires suppressRowTransform to be enabled.";return null}},spanRows:{dependencies:{editable:{required:[!1,void 0]},groupRowEditable:{required:[!1,void 0]},rowDrag:{required:[!1,void 0]},colSpan:{required:[void 0]},rowSpan:{required:[void 0]}},validate:(z,{rowSelection:Q,cellSelection:J,suppressRowTransform:Z,enableCellSpan:X,rowDragEntireRow:Y,enableCellTextSelection:q})=>{if(typeof Q==="object"){if(Q?.mode==="singleRow"&&Q?.enableClickSelection)return"colDef.spanRows is not supported with rowSelection.clickSelection"}if(J)return"colDef.spanRows is not supported with cellSelection.";if(Z)return"colDef.spanRows is not supported with suppressRowTransform.";if(!X)return"colDef.spanRows requires enableCellSpan to be enabled.";if(Y)return"colDef.spanRows is not supported with rowDragEntireRow.";if(q)return"colDef.spanRows is not supported with enableCellTextSelection.";return null}},groupHierarchy:{validate(z,{groupHierarchyConfig:Q={}},J){let Z=new Set(["year","quarter","month","formattedMonth","day","hour","minute","second"]),X=[];for(let Y of z.groupHierarchy??[]){if(typeof Y==="object"){J.validation?.validateColDef(Y);continue}if(!Z.has(Y)&&!(Y in Q))X.push(p5(Y))}if(X.length>0){let Y=`The following parts of colDef.groupHierarchy are not recognised: ${X.join(", ")}.`,q=`Choose one of ${[...Z].map(p5).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`;return`${Y} +${q}`}return null}}}},CB={headerName:void 0,columnGroupShow:void 0,headerStyle:void 0,headerClass:void 0,toolPanelClass:void 0,headerValueGetter:void 0,pivotKeys:void 0,groupId:void 0,colId:void 0,sort:void 0,initialSort:void 0,field:void 0,type:void 0,cellDataType:void 0,tooltipComponent:void 0,tooltipField:void 0,headerTooltip:void 0,headerTooltipValueGetter:void 0,cellClass:void 0,showRowGroup:void 0,filter:void 0,initialAggFunc:void 0,defaultAggFunc:void 0,aggFunc:void 0,groupRowEditable:void 0,groupRowValueSetter:void 0,pinned:void 0,initialPinned:void 0,chartDataType:void 0,cellAriaRole:void 0,cellEditorPopupPosition:void 0,headerGroupComponent:void 0,headerGroupComponentParams:void 0,cellStyle:void 0,cellRenderer:void 0,cellRendererParams:void 0,cellEditor:void 0,cellEditorParams:void 0,filterParams:void 0,pivotValueColumn:void 0,headerComponent:void 0,headerComponentParams:void 0,floatingFilterComponent:void 0,floatingFilterComponentParams:void 0,tooltipComponentParams:void 0,refData:void 0,columnChooserParams:void 0,children:void 0,sortingOrder:void 0,allowedAggFuncs:void 0,menuTabs:void 0,pivotTotalColumnIds:void 0,cellClassRules:void 0,icons:void 0,sortIndex:void 0,initialSortIndex:void 0,flex:void 0,initialFlex:void 0,width:void 0,initialWidth:void 0,minWidth:void 0,maxWidth:void 0,rowGroupIndex:void 0,initialRowGroupIndex:void 0,pivotIndex:void 0,initialPivotIndex:void 0,suppressColumnsToolPanel:void 0,suppressFiltersToolPanel:void 0,openByDefault:void 0,marryChildren:void 0,suppressStickyLabel:void 0,hide:void 0,initialHide:void 0,rowGroup:void 0,initialRowGroup:void 0,pivot:void 0,initialPivot:void 0,checkboxSelection:void 0,showDisabledCheckboxes:void 0,headerCheckboxSelection:void 0,headerCheckboxSelectionFilteredOnly:void 0,headerCheckboxSelectionCurrentPageOnly:void 0,suppressHeaderMenuButton:void 0,suppressMovable:void 0,lockPosition:void 0,lockVisible:void 0,lockPinned:void 0,unSortIcon:void 0,suppressSizeToFit:void 0,suppressAutoSize:void 0,enableRowGroup:void 0,enablePivot:void 0,enableValue:void 0,editable:void 0,suppressPaste:void 0,suppressNavigable:void 0,enableCellChangeFlash:void 0,rowDrag:void 0,dndSource:void 0,autoHeight:void 0,wrapText:void 0,sortable:void 0,resizable:void 0,singleClickEdit:void 0,floatingFilter:void 0,cellEditorPopup:void 0,suppressFillHandle:void 0,wrapHeaderText:void 0,autoHeaderHeight:void 0,dndSourceOnRowDrag:void 0,valueGetter:void 0,valueSetter:void 0,filterValueGetter:void 0,keyCreator:void 0,valueFormatter:void 0,valueParser:void 0,comparator:void 0,equals:void 0,pivotComparator:void 0,suppressKeyboardEvent:void 0,suppressHeaderKeyboardEvent:void 0,colSpan:void 0,rowSpan:void 0,spanRows:void 0,getQuickFilterText:void 0,onCellValueChanged:void 0,onCellClicked:void 0,onCellDoubleClicked:void 0,onCellContextMenu:void 0,rowDragText:void 0,tooltipValueGetter:void 0,tooltipComponentSelector:void 0,cellRendererSelector:void 0,cellEditorSelector:void 0,suppressSpanHeaderHeight:void 0,useValueFormatterForExport:void 0,useValueParserForImport:void 0,mainMenuItems:void 0,contextMenuItems:void 0,suppressFloatingFilterButton:void 0,suppressHeaderFilterButton:void 0,suppressHeaderContextMenu:void 0,loadingCellRenderer:void 0,loadingCellRendererParams:void 0,loadingCellRendererSelector:void 0,context:void 0,dateComponent:void 0,dateComponentParams:void 0,getFindText:void 0,rowGroupingHierarchy:void 0,groupHierarchy:void 0,allowFormula:void 0},bB=()=>Object.keys(CB),yB=()=>({objectName:"colDef",allProperties:bB(),docsUrl:"column-properties/",deprecations:TB(),validations:IB()}),xB=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","treeDataChildrenField","treeDataParentIdField","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","invalidEditValueMode","grandTotalRow","themeCssLayer","findSearchValue","styleNonce","renderingMode"],wB=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","overlayComponentParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","activeOverlayParams","popupParent","themeStyleContainer","statusBar","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterParent","advancedFilterBuilderParams","advancedFilterParams","formulaDataSource","formulaFuncs","initialState","autoSizeStrategy","selectionColumnDef","findOptions","filterHandlers","groupHierarchyConfig"],NB=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector","suppressOverlays"],x8=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipSwitchShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns","rowDragInsertDelay"],gB=["theme","rowSelection"],hB=["cellSelection","sideBar","rowNumbers","suppressGroupChangesColumnVisibility","groupAggFiltering","suppressStickyTotalRow","groupHideParentOfSingleChild","enableRowPinning"],w8=["loadThemeGoogleFonts","suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","allowContextMenuWithControlKey","suppressContextMenu","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","enableCellSpan","suppressClickEdit","rowDragEntireRow","rowDragManaged","refreshAfterGroupEdit","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupHideColumnsUntilExpanded","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault","enableFilterHandlers","suppressStartEditOnTab","hidePaddedHeaderRows","ssrmExpandAllAffectsAllRows","animateColumnResizing"],uB=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","overlayComponent","loadingOverlayComponent","noRowsOverlayComponent","overlayComponentSelector","activeOverlay","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getFullRowEditValidationErrors","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","tabToNextGridContainer","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","loadingCellRendererSelector","getRowId","chartMenuItems","groupTotalRow","alwaysPassFilter","isRowPinnable","isRowPinned","isRowValidDropPosition"],mB=()=>[...NB,...wB,...xB,...x8,...uB,...w8,...hB,...gB];var cB=()=>({suppressLoadingOverlay:{version:"32",message:"Use `loading`=false instead."},enableFillHandle:{version:"32.2",message:"Use `cellSelection.handle` instead."},enableRangeHandle:{version:"32.2",message:"Use `cellSelection.handle` instead."},enableRangeSelection:{version:"32.2",message:"Use `cellSelection = true` instead."},suppressMultiRangeSelection:{version:"32.2",message:"Use `cellSelection.suppressMultiRanges` instead."},suppressClearOnFillReduction:{version:"32.2",message:"Use `cellSelection.handle.suppressClearOnFillReduction` instead."},fillHandleDirection:{version:"32.2",message:"Use `cellSelection.handle.direction` instead."},fillOperation:{version:"32.2",message:"Use `cellSelection.handle.setFillValue` instead."},suppressRowClickSelection:{version:"32.2",message:"Use `rowSelection.enableClickSelection` instead."},suppressRowDeselection:{version:"32.2",message:"Use `rowSelection.enableClickSelection` instead."},rowMultiSelectWithClick:{version:"32.2",message:"Use `rowSelection.enableSelectionWithoutKeys` instead."},groupSelectsChildren:{version:"32.2",message:'Use `rowSelection.groupSelects = "descendants"` instead.'},groupSelectsFiltered:{version:"32.2",message:'Use `rowSelection.groupSelects = "filteredDescendants"` instead.'},isRowSelectable:{version:"32.2",message:"Use `selectionOptions.isRowSelectable` instead."},suppressCopySingleCellRanges:{version:"32.2",message:"Use `rowSelection.copySelectedRows` instead."},suppressCopyRowsToClipboard:{version:"32.2",message:"Use `rowSelection.copySelectedRows` instead."},onRangeSelectionChanged:{version:"32.2",message:"Use `onCellSelectionChanged` instead."},onRangeDeleteStart:{version:"32.2",message:"Use `onCellSelectionDeleteStart` instead."},onRangeDeleteEnd:{version:"32.2",message:"Use `onCellSelectionDeleteEnd` instead."},suppressBrowserResizeObserver:{version:"32.2",message:"The grid always uses the browser's ResizeObserver, this grid option has no effect."},onColumnEverythingChanged:{version:"32.2",message:"Either use `onDisplayedColumnsChanged` which is fired at the same time, or use one of the more specific column events."},groupRemoveSingleChildren:{version:"33",message:"Use `groupHideParentOfSingleChild` instead."},groupRemoveLowestSingleChildren:{version:"33",message:'Use `groupHideParentOfSingleChild: "leafGroupsOnly"` instead.'},suppressRowGroupHidesColumns:{version:"33",message:'Use `suppressGroupChangesColumnVisibility: "suppressHideOnGroup"` instead.'},suppressMakeColumnVisibleAfterUnGroup:{version:"33",message:'Use `suppressGroupChangesColumnVisibility: "suppressShowOnUngroup"` instead.'},unSortIcon:{version:"33",message:"Use `defaultColDef.unSortIcon` instead."},sortingOrder:{version:"33",message:"Use `defaultColDef.sortingOrder` instead."},suppressPropertyNamesCheck:{version:"33",message:"`gridOptions` and `columnDefs` both have a `context` property that should be used for arbitrary user data. This means that column definitions and gridOptions should only contain valid properties making this property redundant."},suppressAdvancedFilterEval:{version:"34",message:"Advanced filter no longer uses function evaluation, so this option has no effect."}});function V$($,z,Q){if(typeof z==="number"||z==null){if(z==null)return null;return z>=Q?null:`${$}: value should be greater than or equal to ${Q}`}return`${$}: value should be a number`}var pB={alignedGrids:"AlignedGrids",allowContextMenuWithControlKey:"ContextMenu",autoSizeStrategy:"ColumnAutoSize",cellSelection:"CellSelection",columnHoverHighlight:"ColumnHover",datasource:"InfiniteRowModel",doesExternalFilterPass:"ExternalFilter",editType:"EditCore",invalidEditValueMode:"EditCore",enableAdvancedFilter:"AdvancedFilter",enableCellSpan:"CellSpan",enableCharts:"IntegratedCharts",enableRangeSelection:"CellSelection",enableRowPinning:"PinnedRow",findSearchValue:"Find",getFullRowEditValidationErrors:"EditCore",getContextMenuItems:"ContextMenu",getLocaleText:"Locale",getMainMenuItems:"ColumnMenu",getRowClass:"RowStyle",getRowStyle:"RowStyle",groupTotalRow:"SharedRowGrouping",grandTotalRow:"ClientSideRowModelHierarchy",initialState:"GridState",isExternalFilterPresent:"ExternalFilter",isRowPinnable:"PinnedRow",isRowPinned:"PinnedRow",localeText:"Locale",masterDetail:"SharedMasterDetail",pagination:"Pagination",pinnedBottomRowData:"PinnedRow",pinnedTopRowData:"PinnedRow",pivotMode:"SharedPivot",pivotPanelShow:"RowGroupingPanel",quickFilterText:"QuickFilter",rowClass:"RowStyle",rowClassRules:"RowStyle",rowData:"ClientSideRowModel",rowDragManaged:"RowDrag",refreshAfterGroupEdit:["RowGrouping","TreeData"],rowGroupPanelShow:"RowGroupingPanel",rowNumbers:"RowNumbers",rowSelection:"SharedRowSelection",rowStyle:"RowStyle",serverSideDatasource:"ServerSideRowModel",sideBar:"SideBar",statusBar:"StatusBar",treeData:"SharedTreeData",undoRedoCellEditing:"UndoRedoEdit",valueCache:"ValueCache",viewportDatasource:"ViewportRowModel"},iB=()=>{let $={autoSizePadding:{validate({autoSizePadding:Q}){return V$("autoSizePadding",Q,0)}},cacheBlockSize:{supportedRowModels:["serverSide","infinite"],validate({cacheBlockSize:Q}){return V$("cacheBlockSize",Q,1)}},cacheOverflowSize:{validate({cacheOverflowSize:Q}){return V$("cacheOverflowSize",Q,1)}},datasource:{supportedRowModels:["infinite"]},domLayout:{validate:(Q)=>{let J=Q.domLayout,Z=["autoHeight","normal","print"];if(J&&!Z.includes(J))return`domLayout must be one of [${Z.join()}], currently it's ${J}`;return null}},enableFillHandle:{dependencies:{enableRangeSelection:{required:[!0]}}},enableRangeHandle:{dependencies:{enableRangeSelection:{required:[!0]}}},enableCellSpan:{supportedRowModels:["clientSide","serverSide"]},enableRangeSelection:{dependencies:{rowDragEntireRow:{required:[!1,void 0]}}},enableRowPinning:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,pinnedTopRowData:J,pinnedBottomRowData:Z}){if(Q&&(J||Z))return"Manual row pinning cannot be used together with pinned row data. Either set `enableRowPinning` to `false`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";return null}},isRowPinnable:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,isRowPinnable:J,pinnedTopRowData:Z,pinnedBottomRowData:X}){if(J&&(Z||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&J)return"`isRowPinnable` requires `enableRowPinning` to be set.";return null}},isRowPinned:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,isRowPinned:J,pinnedTopRowData:Z,pinnedBottomRowData:X}){if(J&&(Z||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&J)return"`isRowPinned` requires `enableRowPinning` to be set.";return null}},groupDefaultExpanded:{supportedRowModels:["clientSide"]},groupHideColumnsUntilExpanded:{supportedRowModels:["clientSide"],validate({groupHideColumnsUntilExpanded:Q,groupHideOpenParents:J,groupDisplayType:Z}){if(Q&&!J&&Z!=="multipleColumns")return"`groupHideColumnsUntilExpanded = true` requires either `groupDisplayType = 'multipleColumns'` or `groupHideOpenParents = true`";return null}},groupHideOpenParents:{supportedRowModels:["clientSide","serverSide"],dependencies:{groupTotalRow:{required:[void 0,"bottom"]},treeData:{required:[void 0,!1],reason:"Tree Data has values at the group level so it doesn't make sense to hide them."}}},groupHideParentOfSingleChild:{dependencies:{groupHideOpenParents:{required:[void 0,!1]}}},groupRemoveLowestSingleChildren:{dependencies:{groupHideOpenParents:{required:[void 0,!1]},groupRemoveSingleChildren:{required:[void 0,!1]}}},groupRemoveSingleChildren:{dependencies:{groupHideOpenParents:{required:[void 0,!1]},groupRemoveLowestSingleChildren:{required:[void 0,!1]}}},groupSelectsChildren:{dependencies:{rowSelection:{required:["multiple"]}}},groupHierarchyConfig:{validate({groupHierarchyConfig:Q={}},J,Z){for(let X of Object.keys(Q))Z.validation?.validateColDef(Q[X]);return null}},icons:{validate:({icons:Q})=>{if(Q){if(Q.smallDown)return $$(262);if(Q.smallLeft)return $$(263);if(Q.smallRight)return $$(264)}return null}},infiniteInitialRowCount:{validate({infiniteInitialRowCount:Q}){return V$("infiniteInitialRowCount",Q,1)}},initialGroupOrderComparator:{supportedRowModels:["clientSide"]},ssrmExpandAllAffectsAllRows:{validate:(Q)=>{if(typeof Q.ssrmExpandAllAffectsAllRows==="boolean"){if(Q.rowModelType!=="serverSide")return"'ssrmExpandAllAffectsAllRows' is only supported with the Server Side Row Model.";if(Q.ssrmExpandAllAffectsAllRows&&typeof Q.getRowId!=="function")return"'getRowId' callback must be provided for Server Side Row Model grouping to work correctly."}return null}},keepDetailRowsCount:{validate({keepDetailRowsCount:Q}){return V$("keepDetailRowsCount",Q,1)}},paginationPageSize:{validate({paginationPageSize:Q}){return V$("paginationPageSize",Q,1)}},paginationPageSizeSelector:{validate:(Q)=>{let J=Q.paginationPageSizeSelector;if(typeof J==="boolean"||J==null)return null;if(!J.length)return`'paginationPageSizeSelector' cannot be an empty array. + If you want to hide the page size selector, set paginationPageSizeSelector to false.`;return null}},pivotMode:{dependencies:{treeData:{required:[!1,void 0],reason:"Pivot Mode is not supported with Tree Data."}}},quickFilterText:{supportedRowModels:["clientSide"]},rowBuffer:{validate({rowBuffer:Q}){return V$("rowBuffer",Q,0)}},rowClass:{validate:(Q)=>{if(typeof Q.rowClass==="function")return"rowClass should not be a function, please use getRowClass instead";return null}},rowData:{supportedRowModels:["clientSide"]},rowDragManaged:{supportedRowModels:["clientSide"],dependencies:{pagination:{required:[!1,void 0]}}},rowSelection:{validate({rowSelection:Q}){if(Q&&typeof Q==="string")return'As of version 32.2.1, using `rowSelection` with the values "single" or "multiple" has been deprecated. Use the object value instead.';if(Q&&typeof Q!=="object")return"Expected `RowSelectionOptions` object for the `rowSelection` property.";if(Q&&Q.mode!=="multiRow"&&Q.mode!=="singleRow")return`Selection mode "${Q.mode}" is invalid. Use one of 'singleRow' or 'multiRow'.`;return null}},rowStyle:{validate:(Q)=>{let J=Q.rowStyle;if(J&&typeof J==="function")return"rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead";return null}},serverSideDatasource:{supportedRowModels:["serverSide"]},serverSideInitialRowCount:{supportedRowModels:["serverSide"],validate({serverSideInitialRowCount:Q}){return V$("serverSideInitialRowCount",Q,1)}},serverSideOnlyRefreshFilteredGroups:{supportedRowModels:["serverSide"]},serverSideSortAllLevels:{supportedRowModels:["serverSide"]},sortingOrder:{validate:(Q)=>{let J=Q.sortingOrder;if(Array.isArray(J)&&J.length>0){let Z=J.filter((X)=>!a0(X));if(Z.length>0)return`sortingOrder must be an array of type (SortDirection | SortDef)[], incorrect items are: ${Z.map((X)=>typeof X==="string"||X==null?i1(X):JSON.stringify(X))}]`}else if(!Array.isArray(J)||!J.length)return`sortingOrder must be an array with at least one element, currently it's ${J}`;return null}},tooltipHideDelay:{validate:(Q)=>{if(Q.tooltipHideDelay&&Q.tooltipHideDelay<0)return"tooltipHideDelay should not be lower than 0";return null}},tooltipShowDelay:{validate:(Q)=>{if(Q.tooltipShowDelay&&Q.tooltipShowDelay<0)return"tooltipShowDelay should not be lower than 0";return null}},tooltipSwitchShowDelay:{validate:(Q)=>{if(Q.tooltipSwitchShowDelay&&Q.tooltipSwitchShowDelay<0)return"tooltipSwitchShowDelay should not be lower than 0";return null}},treeData:{supportedRowModels:["clientSide","serverSide"],validate:(Q)=>{let J=Q.rowModelType??"clientSide";switch(J){case"clientSide":{let{treeDataChildrenField:Z,treeDataParentIdField:X,getDataPath:Y,getRowId:q}=Q;if(!Z&&!X&&!Y)return"treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model.";if(Z){if(Y)return"Cannot use both 'treeDataChildrenField' and 'getDataPath' at the same time.";if(X)return"Cannot use both 'treeDataChildrenField' and 'treeDataParentIdField' at the same time."}if(X){if(!q)return"getRowId callback not provided, tree data with parent id cannot be built.";if(Y)return"Cannot use both 'treeDataParentIdField' and 'getDataPath' at the same time."}return null}case"serverSide":{let Z=`treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${J} row model.`;return Q.isServerSideGroup&&Q.getServerSideGroupKey?null:Z}}return null}},viewportDatasource:{supportedRowModels:["viewport"]},viewportRowModelBufferSize:{validate({viewportRowModelBufferSize:Q}){return V$("viewportRowModelBufferSize",Q,0)}},viewportRowModelPageSize:{validate({viewportRowModelPageSize:Q}){return V$("viewportRowModelPageSize",Q,1)}},rowDragEntireRow:{dependencies:{cellSelection:{required:[void 0]}}},autoGroupColumnDef:{validate({autoGroupColumnDef:Q,showOpenedGroup:J}){if(Q?.field&&J)return"autoGroupColumnDef.field and showOpenedGroup are not supported when used together.";if(Q?.valueGetter&&J)return"autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together.";return null}},renderingMode:{validate:(Q)=>{let J=Q.renderingMode,Z=["default","legacy"];if(J&&!Z.includes(J))return`renderingMode must be one of [${Z.join()}], currently it's ${J}`;return null}},autoSizeStrategy:{validate:({autoSizeStrategy:Q})=>{if(!Q)return null;let J=["fitCellContents","fitGridWidth","fitProvidedWidth"],Z=Q.type;if(Z!=="fitCellContents"&&Z!=="fitGridWidth"&&Z!=="fitProvidedWidth")return`Invalid Auto-size strategy. \`autoSizeStrategy\` must be one of ${J.map((X)=>'"'+X+'"').join(", ")}, currently it's ${Z}`;if(Z==="fitProvidedWidth"&&typeof Q.width!="number")return`When using the 'fitProvidedWidth' auto-size strategy, must provide a numeric \`width\`. You provided ${Q.width}`;return null}}},z={};for(let Q of w8)z[Q]={expectedType:"boolean"};for(let Q of x8)z[Q]={expectedType:"number"};return B0(z,$),z},nB=()=>({objectName:"gridOptions",allProperties:[...mB(),...Object.values(M4)],propertyExceptions:["api"],docsUrl:"grid-options/",deprecations:cB(),validations:iB()}),dB=0,tB=0,i5="__ag_grid_instance",sB=class extends S{constructor(){super(...arguments);this.beanName="gos",this.domDataKey="__AG_"+Math.random().toString(),this.instanceId=tB++,this.gridReadyFired=!1,this.queueEvents=[],this.propEventSvc=new K$,this.globalEventHandlerFactory=($)=>{return(z,Q)=>{if(!this.isAlive())return;let J=r1.has(z);if(J&&!$||!J&&$)return;if(!rB(z))return;let Z=(X,Y)=>{let q=M4[X],G=this.gridOptions[q];if(typeof G==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>G(Y))};if(this.gridReadyFired)Z(z,Q);else if(z==="gridReady"){Z(z,Q),this.gridReadyFired=!0;for(let X of this.queueEvents)Z(X.eventName,X.event);this.queueEvents=[]}else this.queueEvents.push({eventName:z,event:Q})}}}wireBeans($){this.gridOptions=$.gridOptions,this.validation=$.validation,this.api=$.gridApi,this.gridId=$.context.getId()}get gridOptionsContext(){return this.gridOptions.context}postConstruct(){this.validateGridOptions(this.gridOptions),this.eventSvc.addGlobalListener(this.globalEventHandlerFactory().bind(this),!0),this.eventSvc.addGlobalListener(this.globalEventHandlerFactory(!0).bind(this),!1),this.propEventSvc.setFrameworkOverrides(this.beans.frameworkOverrides),this.addManagedEventListeners({gridOptionsChanged:({options:$})=>{this.updateGridOptions({options:$,force:!0,source:"optionsUpdated"})}})}destroy(){super.destroy(),this.queueEvents=[]}get($){return this.gridOptions[$]??Yq[$]}getCallback($){return this.mergeGridCommonParams(this.gridOptions[$])}exists($){return T(this.gridOptions[$])}mergeGridCommonParams($){if($)return(Q)=>{return $(this.addCommon(Q))};return $}updateGridOptions({options:$,force:z,source:Q="api"}){let J={id:dB++,properties:[]},Z=[],{gridOptions:X,validation:Y}=this;for(let q of Object.keys($)){let G=b2.applyGlobalGridOption(q,$[q]);Y?.warnOnInitialPropertyUpdate(Q,q);let _=z||typeof G==="object"&&Q==="api",H=X[q];if(_||H!==G){X[q]=G;let U={type:q,currentValue:G,previousValue:H,changeSet:J,source:Q};Z.push(U)}}this.validateGridOptions(this.gridOptions),J.properties=Z.map((q)=>q.type);for(let q of Z)dQ(this,`Updated property ${q.type} from`,q.previousValue," to ",q.currentValue),this.propEventSvc.dispatchEvent(q)}addPropertyEventListener($,z){this.propEventSvc.addEventListener($,z)}removePropertyEventListener($,z){this.propEventSvc.removeEventListener($,z)}getDomDataKey(){return this.domDataKey}addCommon($){return $.api=this.api,$.context=this.gridOptionsContext,$}validateOptions($,z){for(let Q of Object.keys($)){let J=$[Q];if(J==null||J===!1)continue;let Z=z[Q];if(typeof Z==="function")Z=Z($,this.gridOptions,this.beans);if(Z)this.assertModuleRegistered(Z,Q)}}validateGridOptions($){this.validateOptions($,pB),this.validation?.processGridOptions($)}validateColDef($,z,Q){if(Q||!this.beans.dataTypeSvc?.isColPendingInference(z))this.validateOptions($,vB),this.validation?.validateColDef($)}assertModuleRegistered($,z){let Q=Array.isArray($)?$.some((J)=>this.isModuleRegistered(J)):this.isModuleRegistered($);if(!Q)e(200,{...this.getModuleErrorParams(),moduleName:$,reasonOrId:z});return Q}getModuleErrorParams(){return{gridId:this.gridId,gridScoped:y2(),rowModelType:this.get("rowModelType"),isUmd:x2()}}isModuleRegistered($){return eZ($,this.gridId,this.get("rowModelType"))}setInstanceDomData($){$[i5]=this.instanceId}isElementInThisInstance($){let z=$;while(z){let Q=z[i5];if(T(Q))return Q===this.instanceId;z=z.parentElement}return!1}};function rB($){return!!M4[$]}var lB=class extends S{constructor($,z){super();this.column=$,this.eGui=z,this.lastMovingChanged=0}postConstruct(){this.addManagedElementListeners(this.eGui,{click:($)=>$&&this.onClick($)}),this.addManagedListeners(this.column,{movingChanged:()=>{this.lastMovingChanged=Date.now()}})}onClick($){let{sortSvc:z,rangeSvc:Q,gos:J}=this.beans;if(!(Jz(J)?$.altKey:!0))Q?.handleColumnSelection(this.column,$);else if(this.column.isSortable()){let X=this.column.isMoving(),q=Date.now()-this.lastMovingChanged<50;if(!(X||q))z?.progressSortFromEvent(this.column,$)}}};function aB($,z){let Q={"aria-hidden":"true"};return{tag:"div",cls:"ag-cell-label-container",role:"presentation",children:[{tag:"span",ref:"eMenu",cls:"ag-header-icon ag-header-cell-menu-button",attrs:Q},{tag:"span",ref:"eFilterButton",cls:"ag-header-icon ag-header-cell-filter-button",attrs:Q},{tag:"div",ref:"eLabel",cls:"ag-header-cell-label",role:"presentation",children:[$?{tag:"span",ref:"eColRef",cls:"ag-header-col-ref"}:null,{tag:"span",ref:"eText",cls:"ag-header-cell-text"},{tag:"span",ref:"eFilter",cls:"ag-header-icon ag-header-label-icon ag-filter-icon",attrs:Q},z?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:null]}]}}var oB=class extends x{constructor(){super(...arguments);this.eFilter=f,this.eFilterButton=f,this.eSortIndicator=f,this.eMenu=f,this.eLabel=f,this.eText=f,this.eColRef=f,this.eSortOrder=f,this.eSortAsc=f,this.eSortDesc=f,this.eSortMixed=f,this.eSortNone=f,this.eSortAbsoluteAsc=f,this.eSortAbsoluteDesc=f,this.isLoadingInnerComponent=!1}refresh($){let z=this.params;if(this.params=$,this.workOutTemplate($,!!this.beans?.sortSvc)!=this.currentTemplate||this.workOutShowMenu()!=this.currentShowMenu||$.enableSorting!=this.currentSort||$.column.formulaRef!=this.currentRef||this.currentSuppressMenuHide!=null&&this.shouldSuppressMenuHide()!=this.currentSuppressMenuHide||z.enableFilterButton!=$.enableFilterButton||z.enableFilterIcon!=$.enableFilterIcon)return!1;if(this.innerHeaderComponent){let Q={...$};B0(Q,$.innerHeaderComponentParams),this.innerHeaderComponent.refresh?.(Q)}else this.setDisplayName($);return!0}workOutTemplate($,z){let{formula:Q}=this.beans,J=$.template;if(J)return J?.trim?J.trim():J;return aB(!!Q?.active,z)}init($){this.params=$;let{sortSvc:z,touchSvc:Q,rowNumbersSvc:J,userCompFactory:Z}=this.beans,X=z?.getSortIndicatorSelector();if(this.currentTemplate=this.workOutTemplate($,!!X),this.setTemplate(this.currentTemplate,X?[X]:void 0),this.eLabel)this.mouseListener??(this.mouseListener=this.createManagedBean(new lB($.column,this.eLabel)));Q?.setupForHeader(this),this.setMenu(),this.setupSort(),this.setupColumnRefIndicator(),J?.setupForHeader(this),this.setupFilterIcon(),this.setupFilterButton(),this.workOutInnerHeaderComponent(Z,$),this.setDisplayName($)}workOutInnerHeaderComponent($,z){let Q=DG($,z,z);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((J)=>{if(this.isLoadingInnerComponent=!1,!J)return;if(this.isAlive()){if(this.innerHeaderComponent=J,this.eText)this.eText.appendChild(J.getGui())}else this.destroyBean(J)})}setDisplayName($){let{displayName:z}=$,Q=this.currentDisplayName;if(this.currentDisplayName=z,!this.eText||Q===z||this.innerHeaderComponent||this.isLoadingInnerComponent)return;this.eText.textContent=J1(z)}addInIcon($,z,Q){let J=h($,this.beans,Q);if(J)z.appendChild(J)}workOutShowMenu(){return this.params.enableMenu&&!!this.beans.menuSvc?.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return!!this.beans.menuSvc?.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu){T0(this.eMenu),this.eMenu=void 0;return}let{gos:$,eMenu:z,params:Q}=this,J=U0($);this.addInIcon(J?"menu":"menuAlt",z,Q.column),z.classList.toggle("ag-header-menu-icon",!J);let Z=this.shouldSuppressMenuHide();this.currentSuppressMenuHide=Z,this.addManagedElementListeners(z,{click:()=>this.showColumnMenu(this.eMenu)}),this.toggleMenuAlwaysShow(Z)}toggleMenuAlwaysShow($){this.eMenu?.classList.toggle("ag-header-menu-always-show",$)}showColumnMenu($){let{currentSuppressMenuHide:z,params:Q}=this;if(!z)this.toggleMenuAlwaysShow(!0);Q.showColumnMenu($,()=>{if(!z)this.toggleMenuAlwaysShow(!1)})}onMenuKeyboardShortcut($){let{params:z,gos:Q,beans:J,eMenu:Z,eFilterButton:X}=this,Y=z.column,q=U0(Q);if($&&!q){if(J.menuSvc?.isFilterMenuInHeaderEnabled(Y))return z.showFilter(X??Z??this.getGui()),!0}else if(z.enableMenu)return this.showColumnMenu(Z??X??this.getGui()),!0;return!1}setupSort(){let{sortSvc:$}=this.beans;if(!$)return;let{enableSorting:z,column:Q}=this.params;if(this.currentSort=z,!this.eSortIndicator){this.eSortIndicator=this.createBean($.createSortIndicator(!0));let{eSortIndicator:J,eSortOrder:Z,eSortAsc:X,eSortDesc:Y,eSortMixed:q,eSortNone:G,eSortAbsoluteAsc:_,eSortAbsoluteDesc:H}=this;J.attachCustomElements(Z,X,Y,q,G,_,H)}if(this.eSortIndicator.setupSort(Q),!this.currentSort)return;$.setupHeader(this,Q)}setupColumnRefIndicator(){let{eColRef:$,beans:{editModelSvc:z},params:Q}=this;if(!$)return;this.currentRef=Q.column.formulaRef,$.textContent=this.currentRef,N($,!1),this.addManagedEventListeners({cellEditingStarted:()=>{let J=z?.getEditPositions(),Z=!!this.currentRef&&!!J?.some((X)=>X.column.isAllowFormula());N($,Z)},cellEditingStopped:()=>{N($,!1)}})}setupFilterIcon(){let{eFilter:$,params:z}=this;if(!$)return;let Q=()=>{let J=z.column.isFilterActive();N($,J,{skipAriaHidden:!0})};this.configureFilter(z.enableFilterIcon,$,Q,"filterActive")}setupFilterButton(){let{eFilterButton:$,params:z}=this;if(!$)return;if(this.configureFilter(z.enableFilterButton,$,this.onFilterChangedButton.bind(this),"filter"))this.addManagedElementListeners($,{click:()=>z.showFilter($)});else this.eFilterButton=void 0}configureFilter($,z,Q,J){if(!$)return T0(z),!1;let Z=this.params.column;return this.addInIcon(J,z,Z),this.addManagedListeners(Z,{filterChanged:Q}),Q(),!0}onFilterChangedButton(){let $=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",$)}getAnchorElementForMenu($){let{eFilterButton:z,eMenu:Q}=this;if($)return z??Q??this.getGui();return Q??z??this.getGui()}destroy(){super.destroy(),this.innerHeaderComponent=this.destroyBean(this.innerHeaderComponent),this.mouseListener=this.destroyBean(this.mouseListener)}},eB=class extends S{constructor($,z){super();this.eLabel=$,this.columnGroup=z,this.isSticky=!1,this.left=null,this.right=null}postConstruct(){let{columnGroup:$,beans:z}=this,{ctrlsSvc:Q}=z;Q.whenReady(this,()=>{let J=this.refreshPosition.bind(this);if($.getPinned()==null)this.addManagedEventListeners({bodyScroll:(Z)=>{if(Z.direction==="horizontal")this.updateSticky(Z.left)}});this.addManagedListeners($,{leftChanged:J,displayedChildrenChanged:J}),this.addManagedEventListeners({columnResized:J}),this.refreshPosition()})}refreshPosition(){let{columnGroup:$,beans:z}=this,Q=$.getLeft(),J=$.getActualWidth();if(Q==null||J===0){this.left=null,this.right=null,this.setSticky(!1);return}this.left=Q,this.right=Q+J;let Z=z.colViewport.getScrollPosition();if(Z!=null)this.updateSticky(Z)}updateSticky($){let{beans:z,left:Q,right:J}=this;if(Q==null||J==null){this.setSticky(!1);return}let{gos:Z,visibleCols:X}=z,q=Z.get("enableRtl")?X.bodyWidth-$:$;this.setSticky(Qq)}setSticky($){let{isSticky:z,eLabel:Q}=this;if(z===$)return;this.isSticky=$,Q.classList.toggle("ag-sticky-label",$)}},$E={tag:"div",cls:"ag-header-group-cell-label",role:"presentation",children:[{tag:"span",ref:"agLabel",cls:"ag-header-group-text",role:"presentation"},{tag:"span",ref:"agOpened",cls:"ag-header-icon ag-header-expand-icon ag-header-expand-icon-expanded"},{tag:"span",ref:"agClosed",cls:"ag-header-icon ag-header-expand-icon ag-header-expand-icon-collapsed"}]},zE=class extends x{constructor(){super($E);this.agOpened=f,this.agClosed=f,this.agLabel=f,this.isLoadingInnerComponent=!1}init($){let{userCompFactory:z,touchSvc:Q}=this.beans;this.params=$,this.checkWarnings(),this.workOutInnerHeaderGroupComponent(z,$),this.setupLabel($),this.addGroupExpandIcon($),this.setupExpandIcons(),Q?.setupForHeaderGroup(this)}checkWarnings(){if(this.params.template)j(89)}workOutInnerHeaderGroupComponent($,z){let Q=MG($,z,z);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((J)=>{if(this.isLoadingInnerComponent=!1,!J)return;if(this.isAlive())this.innerHeaderGroupComponent=J,this.agLabel.appendChild(J.getGui());else this.destroyBean(J)})}setupExpandIcons(){let{agOpened:$,agClosed:z,params:{columnGroup:Q},beans:{colGroupSvc:J}}=this;this.addInIcon("columnGroupOpened",$),this.addInIcon("columnGroupClosed",z);let Z=(G)=>{if(z$(G))return;let _=!Q.isExpanded();J.setColumnGroupOpened(Q.getProvidedColumnGroup(),_,"uiColumnExpanded")};this.addTouchAndClickListeners(z,Z),this.addTouchAndClickListeners($,Z);let X=(G)=>{i0(G)};this.addManagedElementListeners(z,{dblclick:X}),this.addManagedElementListeners($,{dblclick:X}),this.addManagedElementListeners(this.getGui(),{dblclick:Z}),this.updateIconVisibility();let Y=Q.getProvidedColumnGroup(),q=this.updateIconVisibility.bind(this);this.addManagedListeners(Y,{expandedChanged:q,expandableChanged:q})}addTouchAndClickListeners($,z){this.beans.touchSvc?.setupForHeaderGroupElement(this,$,z),this.addManagedElementListeners($,{click:z})}updateIconVisibility(){let{agOpened:$,agClosed:z,params:{columnGroup:Q}}=this;if(Q.isExpandable()){let J=Q.isExpanded();N($,J),N(z,!J)}else N($,!1),N(z,!1)}addInIcon($,z){let Q=h($,this.beans,null);if(Q)z.appendChild(Q)}addGroupExpandIcon($){if(!$.columnGroup.isExpandable()){let{agOpened:z,agClosed:Q}=this;N(z,!1),N(Q,!1)}}setupLabel($){let{displayName:z,columnGroup:Q}=$,{innerHeaderGroupComponent:J,isLoadingInnerComponent:Z}=this,X=J||Z;if(T(z)&&!X)this.agLabel.textContent=J1(z);if(!Q.getColGroupDef()?.suppressStickyLabel)this.createManagedBean(new eB(this.getGui(),Q))}destroy(){if(super.destroy(),this.innerHeaderGroupComponent)this.destroyBean(this.innerHeaderGroupComponent),this.innerHeaderGroupComponent=void 0}},QE={moduleName:"ColumnHeaderComp",version:p,userComponents:{agColumnHeader:oB},icons:{menu:"menu",menuAlt:"menu-alt"}},JE={moduleName:"ColumnGroupHeaderComp",version:p,userComponents:{agColumnGroupHeader:zE},icons:{columnGroupOpened:"expanded",columnGroupClosed:"contracted"}},ZE=class extends S{constructor(){super(...arguments);this.beanName="animationFrameSvc",this.p1={list:[],sorted:!1},this.p2={list:[],sorted:!1},this.f1={list:[],sorted:!1},this.destroyTasks=[],this.ticking=!1,this.scrollGoingDown=!0,this.lastScrollTop=0,this.taskCount=0}setScrollTop($){if(this.scrollGoingDown=$>=this.lastScrollTop,$===0)this.scrollGoingDown=!0;this.lastScrollTop=$}postConstruct(){this.active=!this.gos.get("suppressAnimationFrame"),this.batchFrameworkComps=this.beans.frameworkOverrides.batchFrameworkComps}verify(){if(this.active===!1)j(92)}createTask($,z,Q,J,Z=!1){this.verify();let X=Q;if(J&&this.batchFrameworkComps)X="f1";let Y={task:$,index:z,createOrder:++this.taskCount,deferred:Z};this.addTaskToList(this[X],Y),this.schedule()}addTaskToList($,z){$.list.push(z),$.sorted=!1}sortTaskList($){if($.sorted)return;let z=this.scrollGoingDown?1:-1;$.list.sort((Q,J)=>{if(Q.deferred!==J.deferred)return Q.deferred?-1:1;if(Q.index!==J.index)return z*(J.index-Q.index);return J.createOrder-Q.createOrder}),$.sorted=!0}addDestroyTask($){this.verify(),this.destroyTasks.push($),this.schedule()}executeFrame($){let{p1:z,p2:Q,f1:J,destroyTasks:Z,beans:X}=this,{ctrlsSvc:Y,frameworkOverrides:q}=X,G=z.list,_=Q.list,H=J.list,U=Date.now(),W=0,B=$<=0,E=Y.getScrollFeature();while(B||W<$){if(!E.scrollGridIfNeeded()){let L;if(G.length)this.sortTaskList(z),L=G.pop().task;else if(_.length)this.sortTaskList(Q),L=_.pop().task;else if(H.length)q.wrapOutgoing(()=>{while(B||W<$){if(!E.scrollGridIfNeeded())if(H.length)this.sortTaskList(J),L=H.pop().task,L();else break;else break;W=Date.now()-U}}),L=()=>{};else if(Z.length)L=Z.pop();else break;L()}W=Date.now()-U}if(G.length||_.length||H.length||Z.length)this.requestFrame();else this.ticking=!1}flushAllFrames(){if(!this.active)return;this.executeFrame(-1)}schedule(){if(!this.active)return;if(!this.ticking)this.ticking=!0,this.requestFrame()}requestFrame(){let $=this.executeFrame.bind(this,60);Y$(this.beans,$)}isQueueEmpty(){return!this.ticking}},XE={moduleName:"AnimationFrame",version:p,beans:[ZE]},YE=class extends S{constructor(){super(...arguments);this.beanName="iconSvc"}createIconNoSpan($,z){return h($,this.beans,z?.column)}},qE=($,z,Q)=>z||$&&Q,GE=class extends S{constructor(){super(...arguments);this.beanName="touchSvc"}mockBodyContextMenu($,z){this.mockContextMenu($,$.eBodyViewport,z)}mockHeaderContextMenu($,z){this.mockContextMenu($,$.eGui,z)}mockRowContextMenu($){if(!bz())return;let z=(Q,J,Z)=>{let{rowCtrl:X,cellCtrl:Y}=$.getControlsForEventTarget(Z?.target??null);if(Y?.column)Y.dispatchCellContextMenuEvent(Z??null);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(void 0,Z,X,Y)};this.mockContextMenu($,$.element,z)}handleCellDoubleClick($,z){if((()=>{if(!bz()||lZ("dblclick"))return!1;let J=Date.now(),Z=J-$.lastIPadMouseClickEvent<200;return $.lastIPadMouseClickEvent=J,Z})())return $.onCellDoubleClicked(z),z.preventDefault(),!0;return!1}setupForHeader($){let{gos:z,sortSvc:Q,menuSvc:J}=this.beans;if(z.get("suppressTouch"))return;let{params:Z,eMenu:X,eFilterButton:Y}=$,q=new h0($.getGui(),!0);$.addDestroyFunc(()=>q.destroy());let G=$.shouldSuppressMenuHide(),_=G&&T(X)&&Z.enableMenu,H=!!J?.isHeaderContextMenuEnabled(Z.column),U=qE(Z.enableMenu,H,U0(z)),W=q;if(_)W=new h0(X,!0),$.addDestroyFunc(()=>W.destroy());let B=(E)=>Z.showColumnMenuAfterMouseClick(E.touchStart);if(_&&Z.enableMenu)$.addManagedListeners(W,{tap:B});if(U)$.addManagedListeners(q,{longTap:B});if(Z.enableSorting){let E=(K)=>{let L=K.touchStart.target;if(G&&(X?.contains(L)||Y?.contains(L)))return;Q?.progressSort(Z.column,!1,"uiColumnSorted")};$.addManagedListeners(q,{tap:E})}if(Z.enableFilterButton&&Y){let E=new h0(Y,!0);$.addManagedListeners(E,{tap:()=>Z.showFilter(Y)}),$.addDestroyFunc(()=>E.destroy())}}setupForHeaderGroup($){let z=$.params;if(this.beans.menuSvc?.isHeaderContextMenuEnabled(z.columnGroup.getProvidedColumnGroup())){let Q=new h0(z.eGridHeader,!0),J=(Z)=>z.showColumnMenuAfterMouseClick(Z.touchStart);$.addManagedListeners(Q,{longTap:J}),$.addDestroyFunc(()=>Q.destroy())}}setupForHeaderGroupElement($,z,Q){let J=new h0(z,!0);$.addManagedListeners(J,{tap:Q}),$.addDestroyFunc(()=>J.destroy())}mockContextMenu($,z,Q){if(!bz())return;let J=new h0(z),Z=(X)=>{if(!nQ(this.beans,X.touchEvent))return;Q(void 0,X.touchStart,X.touchEvent)};$.addManagedListeners(J,{longTap:Z}),$.addDestroyFunc(()=>J.destroy())}},_E={moduleName:"Touch",version:p,beans:[GE]},HE=class extends S{constructor(){super(...arguments);this.beanName="cellNavigation"}wireBeans($){this.rowSpanSvc=$.rowSpanSvc}getNextCellToFocus($,z,Q=!1){if(Q)return this.getNextCellToFocusWithCtrlPressed($,z);return this.getNextCellToFocusWithoutCtrlPressed($,z)}getNextCellToFocusWithCtrlPressed($,z){let Q=$===A.UP,J=$===A.DOWN,Z=$===A.LEFT,X,Y,{pageBounds:q,gos:G,visibleCols:_,pinnedRowModel:H}=this.beans,{rowPinned:U}=z;if(Q||J){if(U&&H)if(Q)Y=0;else Y=U==="top"?H.getPinnedTopRowCount()-1:H.getPinnedBottomRowCount()-1;else Y=Q?q.getFirstRow():q.getLastRow();X=z.column}else{let W=G.get("enableRtl");Y=z.rowIndex,X=(Z!==W?_.allCols:[..._.allCols].reverse()).find((E)=>!v0(E)&&this.isCellGoodToFocusOn({rowIndex:Y,rowPinned:null,column:E}))}return X?{rowIndex:Y,rowPinned:U,column:X}:null}getNextCellToFocusWithoutCtrlPressed($,z){let Q=z,J=!1;while(!J){switch($){case A.UP:Q=this.getCellAbove(Q);break;case A.DOWN:Q=this.getCellBelow(Q);break;case A.RIGHT:Q=this.gos.get("enableRtl")?this.getCellToLeft(Q):this.getCellToRight(Q);break;case A.LEFT:Q=this.gos.get("enableRtl")?this.getCellToRight(Q):this.getCellToLeft(Q);break;default:Q=null,j(8,{key:$});break}if(Q)J=this.isCellGoodToFocusOn(Q);else J=!0}return Q}isCellGoodToFocusOn($){let z=$.column,Q,{pinnedRowModel:J,rowModel:Z}=this.beans;switch($.rowPinned){case"top":Q=J?.getPinnedTopRow($.rowIndex);break;case"bottom":Q=J?.getPinnedBottomRow($.rowIndex);break;default:Q=Z.getRow($.rowIndex);break}if(!Q)return!1;return!this.isSuppressNavigable(z,Q)}getCellToLeft($){if(!$)return null;let z=this.beans.visibleCols.getColBefore($.column);if(!z)return null;return{rowIndex:$.rowIndex,column:z,rowPinned:$.rowPinned}}getCellToRight($){if(!$)return null;let z=this.beans.visibleCols.getColAfter($.column);if(!z)return null;return{rowIndex:$.rowIndex,column:z,rowPinned:$.rowPinned}}getCellBelow($){if(!$)return null;let z=this.rowSpanSvc?.getCellEnd($)??$,Q=L0(this.beans,z,!0);if(Q)return{rowIndex:Q.rowIndex,column:$.column,rowPinned:Q.rowPinned};return null}getCellAbove($){if(!$)return null;let z=this.rowSpanSvc?.getCellStart($)??$,Q=m0(this.beans,{rowIndex:z.rowIndex,rowPinned:z.rowPinned},!0);if(Q)return{rowIndex:Q.rowIndex,column:$.column,rowPinned:Q.rowPinned};return null}getNextTabbedCell($,z){if(z)return this.getNextTabbedCellBackwards($);return this.getNextTabbedCellForwards($)}getNextTabbedCellForwards($){let{visibleCols:z,pagination:Q}=this.beans,J=z.allCols,Z=$.rowIndex,X=$.rowPinned,Y=z.getColAfter($.column);if(!Y){Y=J[0];let q=L0(this.beans,$,!0);if(n(q))return null;if(!q.rowPinned&&!(Q?.isRowInPage(q.rowIndex)??!0))return null;Z=q?q.rowIndex:null,X=q?q.rowPinned:null}return{rowIndex:Z,column:Y,rowPinned:X}}getNextTabbedCellBackwards($){let{beans:z}=this,{visibleCols:Q,pagination:J}=z,Z=Q.allCols,X=$.rowIndex,Y=$.rowPinned,q=Q.getColBefore($.column);if(!q){q=b(Z);let G=m0(z,{rowIndex:$.rowIndex,rowPinned:$.rowPinned},!0);if(n(G))return null;if(!G.rowPinned&&!(J?.isRowInPage(G.rowIndex)??!0))return null;X=G?G.rowIndex:null,Y=G?G.rowPinned:null}return{rowIndex:X,column:q,rowPinned:Y}}isSuppressNavigable($,z){let{suppressNavigable:Q}=$.colDef;if(typeof Q==="boolean")return Q;if(typeof Q==="function"){let J=$.createColumnFunctionCallbackParams(z);return Q(J)}return!1}};function UE($){return $.focusSvc.getFocusedCell()}function WE($){return $.focusSvc.clearFocusedCell()}function BE($,z,Q,J){$.focusSvc.setFocusedCell({rowIndex:z,column:Q,rowPinned:J,forceBrowserFocus:!0})}function EE($,z){return $.navigation?.tabToNextCell(!1,z)??!1}function KE($,z){return $.navigation?.tabToNextCell(!0,z)??!1}function LE($,z,Q=!1){let J=$.headerNavigation?.getHeaderPositionForColumn(z,Q);if(!J)return;$.focusSvc.focusHeaderPosition({headerPosition:J})}function m$($){let z=$;return z?.getFrameworkComponentInstance!=null?z.getFrameworkComponentInstance():$}var DE=class extends S{constructor(){super(...arguments);this.beanName="editModelSvc",this.edits=new Map,this.cellValidations=new N8,this.rowValidations=new g8,this.suspendEdits=!1}suspend($){this.suspendEdits=$}removeEdits({rowNode:$,column:z}){if(!this.hasEdits({rowNode:$})||!$)return;let Q=this.getEditRow($);if(z)Q.delete(z);else Q.clear();if(Q.size===0)this.edits.delete($)}getEditRow($,z={}){if(this.suspendEdits)return;if(this.edits.size===0)return;let Q=$&&this.edits.get($);if(Q)return Q;if(z.checkSiblings){let J=$.pinnedSibling;if(J)return this.getEditRow(J)}return}getEditRowDataValue($,{checkSiblings:z}={}){if(!$||this.edits.size===0)return;let Q=this.getEditRow($),J=$.pinnedSibling,Z=z&&J&&this.getEditRow(J);if(!Q&&!Z)return;let X={...$.data},Y=(q,G)=>q.forEach(({editorValue:_,pendingValue:H},U)=>{let W=_===void 0?H:_;if(W!==P0)G[U.getColId()]=W});if(Q)Y(Q,X);if(Z)Y(Z,X);return X}getEdit($={},z){let{rowNode:Q,column:J}=$,Z=this.edits;if(this.suspendEdits||Z.size===0||!Q||!J)return;let X=Z.get(Q)?.get(J);if(X)return X;if(z?.checkSiblings){let Y=Q.pinnedSibling;if(Y)return Z.get(Y)?.get(J)}return}getEditMap($=!0){if(this.suspendEdits||this.edits.size===0)return new Map;if(!$)return this.edits;let z=new Map;return this.edits.forEach((Q,J)=>{let Z=new Map;Q.forEach(({editorState:X,...Y},q)=>Z.set(q,{...Y})),z.set(J,Z)}),z}setEditMap($){this.edits.clear(),$.forEach((z,Q)=>{let J=new Map;z.forEach((Z,X)=>J.set(X,{...Z})),this.edits.set(Q,J)})}setEdit($,z){let Q=this.edits;if(Q.size===0||!Q.has($.rowNode))Q.set($.rowNode,new Map);let J=this.getEdit($),Z={editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0},...J,...z};return this.getEditRow($.rowNode).set($.column,Z),Z}clearEditValue($){let{rowNode:z,column:Q}=$;if(!z)return;let J=(X)=>{X.editorValue=void 0,X.pendingValue=X.sourceValue,X.state="changed"};if(!Q){this.getEditRow(z)?.forEach(J);return}let Z=this.getEdit($);if(Z)J(Z)}getState($){if(this.suspendEdits)return;return this.getEdit($)?.state}getEditPositions($){if(this.suspendEdits||($??this.edits).size===0)return[];let z=[];return($??this.edits).forEach((Q,J)=>{for(let Z of Q.keys()){let{editorState:X,...Y}=Q.get(Z);z.push({rowNode:J,column:Z,...Y})}}),z}hasRowEdits($,z){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;return!!this.getEditRow($,z)}hasEdits($={},z={}){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;let{rowNode:Q,column:J}=$,{withOpenEditor:Z}=z;if(Q){let X=this.getEditRow(Q,z);if(!X)return!1;if(J){if(Z)return this.getEdit($)?.state==="editing";return X.has(J)}if(X.size!==0){if(Z)return Array.from(X.values()).some(({state:Y})=>Y==="editing");return!0}return!1}if(Z)return this.getEditPositions().some(({state:X})=>X==="editing");return this.edits.size>0}start($){let z=this.getEditRow($.rowNode)??new Map,{rowNode:Q,column:J}=$;if(J&&!z.has(J))z.set(J,{editorValue:void 0,pendingValue:P0,sourceValue:this.beans.valueSvc.getValue(J,Q,"data"),state:"editing",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}});this.edits.set(Q,z)}stop($,z,Q){if(!this.hasEdits($))return;if(z){let J=this.getEditRow($.rowNode)?.get($.column);if(J&&(J.pendingValue===P0||J.pendingValue===J.sourceValue))this.removeEdits($);else if(J&&Q)J.editorValue=void 0}else this.removeEdits($)}clear(){for(let $ of this.edits.values())$.clear();this.edits.clear()}getCellValidationModel(){return this.cellValidations}getRowValidationModel(){return this.rowValidations}setCellValidationModel($){this.cellValidations=$}setRowValidationModel($){this.rowValidations=$}destroy(){super.destroy(),this.clear()}},N8=class{constructor(){this.cellValidations=new Map}getCellValidation($){let{rowNode:z,column:Q}=$||{};return this.cellValidations?.get(z)?.get(Q)}hasCellValidation($){if(!$?.rowNode||!$.column)return this.cellValidations.size>0;return!!this.getCellValidation($)}setCellValidation($,z){let{rowNode:Q,column:J}=$;if(!this.cellValidations.has(Q))this.cellValidations.set(Q,new Map);this.cellValidations.get(Q).set(J,z)}clearCellValidation($){let{rowNode:z,column:Q}=$;this.cellValidations.get(z)?.delete(Q)}setCellValidationMap($){this.cellValidations=$}getCellValidationMap(){return this.cellValidations}clearCellValidationMap(){this.cellValidations.clear()}},g8=class{constructor(){this.rowValidations=new Map}getRowValidation($){let{rowNode:z}=$||{};return this.rowValidations.get(z)}hasRowValidation($){if(!$?.rowNode)return this.rowValidations.size>0;return!!this.getRowValidation($)}setRowValidation({rowNode:$},z){this.rowValidations.set($,z)}clearRowValidation({rowNode:$}){this.rowValidations.delete($)}setRowValidationMap($){this.rowValidations=$}getRowValidationMap(){return this.rowValidations}clearRowValidationMap(){this.rowValidations.clear()}};function WJ($,z={}){let{rowIndex:Q,rowId:J,rowCtrl:Z,rowPinned:X}=z;if(Z)return Z;let{rowModel:Y,rowRenderer:q}=$,{rowNode:G}=z;if(!G){if(J)G=sG($,J,X);else if(Q!=null)G=Y.getRow(Q)}return G?q.getRowCtrlByNode(G):void 0}function r($,z={}){let{cellCtrl:Q,colId:J,columnId:Z,column:X}=z;if(Q)return Q;let Y=$.colModel.getCol(J??Z??K2(X)),q=z.rowCtrl??WJ($,z),G=q?.getCellCtrl(Y)??void 0;if(G)return G;let _=z.rowNode??q?.rowNode;if(_)return $.rowRenderer.getCellCtrls([_],[Y])?.[0];return}function n5($){let{editSvc:z}=$;if(z?.isBatchEditing())$z($,{persist:!0}),e$($);else z?.stopEditing(void 0,{source:"api"})}function FE($,z,Q){let{gos:J,popupSvc:Z}=z;if(!J.get("stopEditingWhenCellsLoseFocus"))return;let X=(Y)=>{let q=Y.relatedTarget;if(q2(q)===null){n5(z);return}let G=Q.some((_)=>_.contains(q))&&J.isElementInThisInstance(q);if(!G)G=!!Z&&(Z.getActivePopups().some((_)=>_.contains(q))||Z.isElementWithinCustomPopup(q));if(!G)n5(z)};for(let Y of Q)$.addManagedElementListeners(Y,{focusout:X})}function K2($){if(!$)return;if(typeof $==="string")return $;return $.getColId()}var P0=Symbol("unedited"),ME=($,z={})=>{let Q=$.rowRenderer.getCellCtrls(z.rowNodes,z.columns),J=Array(Q.length),Z=0;for(let X=0,Y=Q.length;X0)z.set(Q,Z)}return z}function gz($,z,Q){let{key:J,event:Z,cellStartedEdit:X,silent:Y}=Q??{},{editModelSvc:q,gos:G,userCompFactory:_}=$,H=r($,z),U=H?.comp?.getCellEditor(),W=u8($,z,J,X&&!Y),B=q?.getEdit(z),E=W.value??B?.sourceValue;if(U){q?.setEdit(z,{editorValue:DQ($,E,!0,z.column),state:"editing"}),U.refresh?.(W);return}let K=z.column.getColDef(),L=R7(_,K,W);if(!L)return;let{popupFromSelector:D,popupPositionFromSelector:F}=L,M=D??!!K.cellEditorPopup,k=F??K.cellEditorPopupPosition;if(m8(L.params,Z),!H)return;let{rangeFeature:V,rowCtrl:R,comp:O,onEditorAttachedFuncs:I}=H;q?.setEdit(z,{editorValue:DQ($,E,!0,z.column),state:"editing",editorState:{cellStartedEditing:void 0,cellStoppedEditing:void 0}}),H.editCompDetails=L,I.push(()=>V?.unsetComp()),O?.setEditDetails(L,M,k,G.get("reactiveCustomComponents")),R?.refreshRow({suppressFlash:!0}),AE($,z,Z,E,Y)}function AE($,z,Q,J,Z){let{editSvc:X,editModelSvc:Y}=$,q=Y?.getEdit(z);if(!Z&&q?.state==="editing"&&!q?.editorState?.cellStartedEditing)X?.dispatchCellEvent(z,Q,"cellEditingStarted",{value:J}),Y?.setEdit(z,{editorState:{cellStartedEditing:!0}})}function h8($,z,Q){let J={editorValueExists:!1};if(k4($)){if((z.getValidationErrors?.()?.length??0)>0)return J}if(Q?.isCancelling)return J;if(Q?.isStopping){let X=z?.isCancelAfterEnd?.();if(X)return{...J,isCancelAfterEnd:X}}return{editorValue:z.getValue(),editorValueExists:!0}}function u8($,z,Q,J){let{valueSvc:Z,gos:X,editSvc:Y}=$,q=$.gos.get("enableGroupEdit"),G=r($,z),_=z.rowNode?.rowIndex??void 0,H=Y?.isBatchEditing(),U=$.colModel.getCol(z.column.getId()),{rowNode:W,column:B}=z,E=G.comp?.getCellEditor(),K=Y?.getCellDataValue(z),L=K===void 0?E?h8($,E)?.editorValue:void 0:K,D=L===P0?Z.getValueForDisplay({column:U,node:W,from:"edit"})?.value:L,F=q?L:D;if(B.isAllowFormula()&&$.formula?.isFormula(F))F=$.formula?.normaliseFormula(F,!0)??F;return y(X,{value:F,eventKey:Q??null,column:B,colDef:B.getColDef(),rowIndex:_,node:W,data:W.data,cellStartedEdit:!!J,onKeyDown:G?.onKeyDown.bind(G),stopEditing:(M)=>{Y.stopEditing(z,{source:H?"ui":"api",suppressNavigateAfterEdit:M}),$1($,z,{})},eGridCell:G?.eGui,parseValue:(M)=>Z.parseValue(U,W,M,G?.value),formatValue:G?.formatValue.bind(G),validate:()=>{Y?.validateEdit()}})}function xQ($,z){let{editModelSvc:Q}=$;Q?.getEditMap().forEach((J,Z)=>{J.forEach((X,Y)=>{if(!z&&(X.state==="editing"||X.pendingValue===P0))return;if(!B$(X)&&(X.state!=="editing"||z))Q?.removeEdits({rowNode:Z,column:Y})})})}function SE($,z){let Q=z.comp?.getCellEditor();if(!Q?.refresh)return;let{eventKey:J,cellStartedEdit:Z}=z.editCompDetails.params,{column:X}=z,Y=u8($,z,J,Z),q=X.getColDef(),G=R7($.userCompFactory,q,Y);Q.refresh(m8(G.params,J))}function m8($,z){if(z instanceof KeyboardEvent&&$.column.getColDef().cellEditor==="agNumberCellEditor")$.suppressPreventDefault=["-","+",".","e"].includes(z?.key??"")||$.suppressPreventDefault;else z?.preventDefault?.();return $}function $z($,z){for(let Q of $.editModelSvc?.getEditPositions()??[]){let J=r($,Q);if(!J)continue;let Z=J.comp?.getCellEditor();if(!Z)continue;let{editorValue:X,editorValueExists:Y,isCancelAfterEnd:q}=h8($,Z,z);if(q){let{cellStartedEditing:G,cellStoppedEditing:_}=$.editModelSvc?.getEdit(Q)?.editorState||{};$.editModelSvc?.setEdit(Q,{editorState:{isCancelAfterEnd:q,cellStartedEditing:G,cellStoppedEditing:_}})}zQ($,Q,X,void 0,!Y,z)}}function zQ($,z,Q,J,Z,X){let{editModelSvc:Y,valueSvc:q}=$;if(!Y)return;let{rowNode:G,column:_}=z;if(!(G&&_))return;let H=Y.getEdit(z);if(H?.sourceValue===void 0){let U=H?DQ($,H.editorValue,!1,_):P0,W={sourceValue:q.getValue(_,G,"data"),pendingValue:U};if(X?.persist)W.state="changed";H=Y.setEdit(z,W)}if(Y.setEdit(z,{editorValue:Z?DQ($,H.sourceValue,!0,_):Q}),X?.persist)RE($,z)}function DQ($,z,Q,J){let{formula:Z}=$;if(J.isAllowFormula()&&Z?.isFormula(z))return Z?.normaliseFormula(z,Q)??z;return z}function RE($,z){let{editModelSvc:Q}=$,J=Q?.getEdit(z),X={pendingValue:DQ($,J?.editorValue,!1,z.column)};if(!J?.editorState?.cellStoppedEditing&&J?.state!=="editing")X.state="changed";Q?.setEdit(z,X)}function e$($,z,Q={}){if(!z)z=$.editModelSvc?.getEditPositions();if(z)for(let J of z)$1($,J,Q)}function $1($,z,Q,J=r($,z)){let Z=$.editModelSvc,X=Z?.getEdit(z),Y;if(X&&X.state!=="editing"&&X.editorState?.cellStoppedEditing)Y=X.state;else Y="changed";if(!J){if(X)Z?.setEdit(z,{state:Y});return}let q=J.comp,G=q?.getCellEditor();if(q&&!G){if(J?.refreshCell(),X){Z?.setEdit(z,{state:Y});let H=$.gos.get("enableGroupEdit")?d5(X,Q?.cancel):{valueChanged:!1,newValue:void 0,oldValue:X.sourceValue};t5($,z,H,Q)}return}if(k4($)){let H=X&&G?.getValidationErrors?.(),U=Z?.getCellValidationModel();if(H?.length)U?.setCellValidation(z,{errorMessages:H});else U?.clearCellValidation(z)}if(X)Z?.setEdit(z,{state:Y});q?.setEditDetails(),q?.refreshEditStyles(!1,!1),J?.refreshCell({force:!0,suppressFlash:!0});let _=Z?.getEdit(z);if(_&&_.state!=="editing"){let H=Q?.cancel,U=$.gos.get("enableGroupEdit")?d5(_,H):jE(_,X,H);t5($,z,U,Q)}}function d5($,z){let{sourceValue:Q,pendingValue:J}=$,Z;if(!z&&J!==P0)Z=J;return{valueChanged:!z&&B$($),newValue:Z,oldValue:Q,value:Q}}function jE($,z,Q){if(Q||$.editorState.isCancelAfterEnd)return{valueChanged:!1,newValue:void 0,oldValue:$.sourceValue};let J=$.editorValue;if(J==null||J===P0)J=z?.pendingValue;if(J===P0)J=void 0;return{valueChanged:B$($),newValue:J,oldValue:$.sourceValue}}function t5($,z,Q,{silent:J,event:Z}={}){let{editSvc:X,editModelSvc:Y}=$,q=Y?.getEdit(z),{editorState:G}=q||{},{isCancelBeforeStart:_,cellStartedEditing:H,cellStoppedEditing:U}=G||{};if(!J&&!_&&H&&!U)X?.dispatchCellEvent(z,Z,"cellEditingStopped",Q),Y?.setEdit(z,{editorState:{cellStoppedEditing:!0}})}function fE($){if(!$)return!1;for(let z=0,Q=$.length;z0,M=F?L.join(". "):"";if(V6(D,F),F)J.announceValue(`${_} ${L}`,"editorValidation");if(D instanceof HTMLInputElement)D.setCustomValidity(M);else D.classList.toggle("invalid",F)}if(L?.length>0)Q.setCellValidation({rowNode:E,column:K},{errorMessages:L});H.add(U.rowCtrl)}if($z($,{persist:!1}),X?.setCellValidationModel(Q),q){let U=PE($);X?.setRowValidationModel(U)}for(let U of H.values()){U.rowEditStyleFeature?.applyRowStyles();for(let W of U.getAllCellCtrls())W.tooltipFeature?.refreshTooltip(!0),W.editorTooltipFeature?.refreshTooltip(!0),W.editStyleFeature?.applyCellStyles?.()}}var PE=($)=>{let z=new g8,Q=$.gos.get("getFullRowEditValidationErrors"),J=$.editModelSvc?.getEditMap();if(!J)return z;for(let Z of J.keys()){let X=J.get(Z);if(!X)continue;let Y=[],{rowIndex:q,rowPinned:G}=Z;for(let H of X.keys()){let U=X.get(H);if(!U)continue;let{editorValue:W,pendingValue:B,sourceValue:E}=U,K=W??(B===P0?void 0:B)??E;Y.push({column:H,colId:H.getColId(),rowIndex:q,rowPinned:G,oldValue:E,newValue:K})}let _=Q?.({editorsState:Y})??[];if(_.length>0)z.setRowValidation({rowNode:Z},{errorMessages:_})}return z};function TE($){Yz($,!0);let z=$.editModelSvc?.getCellValidationModel().getCellValidationMap();if(!z)return null;let Q=[];return z.forEach((J,Z)=>{J.forEach(({errorMessages:X},Y)=>{Q.push({column:Y,rowIndex:Z.rowIndex,rowPinned:Z.rowPinned,messages:X??null})})}),Q}function pJ($){return!!($.rowPinned&&$.pinnedSibling)}function t0($,z,Q,J){let Z=z==="top";if(!Q)return t0($,z,Z?$.getPinnedTopRow(0):$.getPinnedBottomRow(0),J);if(!J){let G=Z?$.getPinnedTopRowCount():$.getPinnedBottomRowCount();return t0($,z,Q,Z?$.getPinnedTopRow(G-1):$.getPinnedBottomRow(G-1))}let X=!1,Y=!1,q=[];return $.forEachPinnedRow(z,(G)=>{if(G===Q&&!X){X=!0,q.push(G);return}if(X&&G===J){Y=!0,q.push(G);return}if(X&&!Y)q.push(G)}),q}function vE($,z,Q,{rowNode:J,column:Z},X){return y($.gos,{type:Q,node:J,data:J.data,value:X,column:Z,colDef:Z.getColDef(),rowPinned:J.rowPinned,event:z,rowIndex:J.rowIndex})}function IE($,z=!1){if($===A.DELETE)return!0;if(!z&&$===A.BACKSPACE)return P7();return!1}var CE=class extends S{constructor($,z,Q,J){super();this.cellCtrl=$,this.rowNode=Q,this.rowCtrl=J,this.beans=z}init(){this.eGui=this.cellCtrl.eGui}onKeyDown($){let z=$.key;if(z===A.ENTER&&v0(this.cellCtrl.column)&&this.beans.rowNumbersSvc?.handleKeyDownOnCell(this.cellCtrl.cellPosition,$))return;switch(z){case A.ENTER:this.onEnterKeyDown($);break;case A.F2:this.onF2KeyDown($);break;case A.ESCAPE:this.onEscapeKeyDown($);break;case A.TAB:this.onTabKeyDown($);break;case A.BACKSPACE:case A.DELETE:this.onBackspaceOrDeleteKeyDown(z,$);break;case A.DOWN:case A.UP:case A.RIGHT:case A.LEFT:this.onNavigationKeyDown($,z);break}}onNavigationKeyDown($,z){let{cellCtrl:Q,beans:J}=this;if(J.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if($.shiftKey&&Q.isRangeSelectionEnabled())this.onShiftRangeSelect($);else{let Z=Q.getFocusedCellPosition();J.navigation?.navigateToNextCell($,z,Z,!0)}$.preventDefault()}onShiftRangeSelect($){let{rangeSvc:z,navigation:Q}=this.beans;if(!z)return;let J=z.extendLatestRangeInDirection($);if(!J)return;if($.key===A.LEFT||$.key===A.RIGHT)Q?.ensureColumnVisible(J.column);else Q?.ensureRowVisible(J.rowIndex)}onTabKeyDown($){this.beans.navigation?.onTabKeyDown(this.cellCtrl,$)}onBackspaceOrDeleteKeyDown($,z){let{cellCtrl:Q,beans:J,rowNode:Z}=this,{gos:X,rangeSvc:Y,eventSvc:q,editSvc:G}=J;if(q.dispatchEvent({type:"keyShortcutChangedCellStart"}),IE($,X.get("enableCellEditingOnBackspace"))&&!G?.isEditing(Q,{withOpenEditor:!0})){if(Y&&u0(X))Y.clearCellRangeCellValues({dispatchWrapperEvents:!0,wrapperEventSource:"deleteKey"});else if(Q.isCellEditable()){let _=J.valueSvc.getDeleteValue(Q.column,Z);Z.setDataValue(Q.column,_,"cellClear")}}else if(!G?.isEditing(Q,{withOpenEditor:!0}))J.editSvc?.startEditing(Q,{startedEdit:!0,event:z});q.dispatchEvent({type:"keyShortcutChangedCellEnd"})}onEnterKeyDown($){let{cellCtrl:z,beans:Q}=this,{editSvc:J,navigation:Z}=Q,X=J?.isEditing(z,{withOpenEditor:!0}),Y=z.rowNode,q=J?.isRowEditing(Y,{withOpenEditor:!0}),G=(_)=>{if(J?.startEditing(_,{startedEdit:!0,event:$,source:"edit"}))$.preventDefault()};if(X||q){if(this.isCtrlEnter($)){J?.applyBulkEdit(z,Q?.rangeSvc?.getCellRanges()||[]);return}if(Yz(Q),J?.checkNavWithValidation(void 0,$)==="block-stop")return;if(J?.isEditing(z,{withOpenEditor:!0}))J?.stopEditing(z,{event:$,source:"edit"});else if(q&&!z.isCellEditable())J?.stopEditing({rowNode:Y},{event:$,source:"edit"});else G(z)}else if(Q.gos.get("enterNavigatesVertically")){let _=$.shiftKey?A.UP:A.DOWN;Z?.navigateToNextCell(null,_,z.cellPosition,!1)}else{if(J?.hasValidationErrors())return;if(J?.hasValidationErrors(z))J.revertSingleCellEdit(z,!0);G(z)}}isCtrlEnter($){return($.ctrlKey||$.metaKey)&&$.key===A.ENTER}onF2KeyDown($){let{cellCtrl:z,beans:{editSvc:Q}}=this;if(Q?.isEditing()){if(Yz(this.beans),Q?.checkNavWithValidation(void 0,$)==="block-stop")return}Q?.startEditing(z,{startedEdit:!0,event:$})}onEscapeKeyDown($){let{cellCtrl:z,beans:{editSvc:Q}}=this;if(Q?.checkNavWithValidation(z,$)==="block-stop")Q.revertSingleCellEdit(z);setTimeout(()=>{Q?.stopEditing(z,{event:$,cancel:!0})})}processCharacter($){let Q=$.target!==this.eGui,{beans:{editSvc:J},cellCtrl:Z}=this;if(Q)return;if(J?.isEditing(Z,{withOpenEditor:!0}))return;if($.key===A.SPACE)this.onSpaceKeyDown($);else if(J?.isCellEditable(Z,"ui")){if(J?.hasValidationErrors()&&!J?.hasValidationErrors(Z))return;if(J?.startEditing(Z,{startedEdit:!0,event:$,source:"api",editable:!0}),!Z.editCompDetails?.params?.suppressPreventDefault)$.preventDefault()}}onSpaceKeyDown($){let{gos:z,editSvc:Q}=this.beans,{rowNode:J}=this.cellCtrl;if(!Q?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&h$(z))this.beans.selectionSvc?.handleSelectionEvent($,J,"spaceKey");$.preventDefault()}},bE=class extends S{constructor($,z,Q){super();this.cellCtrl=$,this.column=Q,this.beans=z}onMouseEvent($,z){if(z$(z))return;switch($){case"click":this.onCellClicked(z);break;case"pointerdown":case"mousedown":case"touchstart":this.onMouseDown(z);break;case"dblclick":this.onCellDoubleClicked(z);break;case"mouseout":this.onMouseOut(z);break;case"mouseover":this.onMouseOver(z);break}}onCellClicked($){if(this.beans.touchSvc?.handleCellDoubleClick(this,$))return;let{eventSvc:z,rangeSvc:Q,editSvc:J,editModelSvc:Z,frameworkOverrides:X,gos:Y}=this.beans,q=$.ctrlKey||$.metaKey,{cellCtrl:G}=this,{column:_,cellPosition:H,rowNode:U}=G,W=t1(Y,_,U,$);if(Q&&q&&!W){if(Q.getCellRangeCount(H)>1)Q.intersectLastRange(!0)}let B=G.createEvent($,"cellClicked");B.isEventHandlingSuppressed=W,z.dispatchEvent(B);let E=_.getColDef();if(E.onCellClicked)window.setTimeout(()=>{X.wrapOutgoing(()=>{E.onCellClicked(B)})},0);if(W)return;if(Z?.getState(G)!=="editing"){let K=J?.isEditing(),L=J?.isRangeSelectionEnabledWhileEditing(),D=Z?.getCellValidationModel().getCellValidationMap().size??0,F=Z?.getRowValidationModel().getRowValidationMap().size??0;if(K&&(L||D>0||F>0))return;if(J?.shouldStartEditing(G,$))J?.startEditing(G,{event:$});else if(J?.shouldStopEditing(G,$))if(this.beans.gos.get("editType")==="fullRow")J?.stopEditing(G,{event:$,source:"edit"});else J?.stopEditing(void 0,{event:$,source:"edit"})}}onCellDoubleClicked($){let{column:z,beans:Q,cellCtrl:J}=this,{eventSvc:Z,frameworkOverrides:X,editSvc:Y,editModelSvc:q,gos:G}=Q,_=t1(G,J.column,J.rowNode,$),H=z.getColDef(),U=J.createEvent($,"cellDoubleClicked");if(U.isEventHandlingSuppressed=_,Z.dispatchEvent(U),typeof H.onCellDoubleClicked==="function")window.setTimeout(()=>{X.wrapOutgoing(()=>{H.onCellDoubleClicked(U)})},0);if(_)return;if(Y?.shouldStartEditing(J,$)&&q?.getState(J)!=="editing"){let W=Y?.isEditing(),B=Y?.isRangeSelectionEnabledWhileEditing(),E=q?.getCellValidationModel().getCellValidationMap().size??0,K=q?.getRowValidationModel().getRowValidationMap().size??0;if(W&&(B||E>0||K>0))return;Y?.startEditing(J,{event:$})}}onMouseDown($){let{shiftKey:z}=$,Q=$.target,{cellCtrl:J,beans:Z}=this,{eventSvc:X,rangeSvc:Y,rowNumbersSvc:q,focusSvc:G,gos:_,editSvc:H}=Z,{column:U,rowNode:W,cellPosition:B}=J,E=t1(_,U,W,$),K=()=>{let M=J.createEvent($,"cellMouseDown");M.isEventHandlingSuppressed=E,X.dispatchEvent(M)};if(E){K();return}if(this.isRightClickInExistingRange($))return;let L=Y&&!Y.isEmpty(),D=this.containsWidget(Q),F=v0(U);if(q&&F&&!q.handleMouseDownOnCell(B,$))return;if(!z||!L){let M=H?.isEditing(J),V=_.get("enableCellTextSelection")&&$.defaultPrevented,R=(cz()||V)&&!M&&!wQ(Q)&&!D;J.focusCell(R,$)}if(z&&L&&!G.isCellFocused(B)){$.preventDefault();let M=G.getFocusedCell();if(M){let{column:k,rowIndex:V,rowPinned:R}=M,O=!!H?.isRangeSelectionEnabledWhileEditing?.();if(H?.isEditing(M)&&!O)H?.stopEditing(M);if(!O)G.setFocusedCell({column:k,rowIndex:V,rowPinned:R,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:$})}}if(D)return;Y?.handleCellMouseDown($,B),K()}isRightClickInExistingRange($){let{rangeSvc:z}=this.beans;if(z){let Q=z.isCellInAnyRange(this.cellCtrl.cellPosition),J=g2(this.beans,$);if(Q&&J)return!0}return!1}containsWidget($){return vz($,"ag-selection-checkbox",3)||vz($,"ag-drag-handle",3)}onMouseOut($){if(this.mouseStayingInsideCell($))return;let{eventSvc:z,colHover:Q}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent($,"cellMouseOut")),Q?.clearMouseOver()}onMouseOver($){if(this.mouseStayingInsideCell($))return;let{eventSvc:z,colHover:Q}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent($,"cellMouseOver")),Q?.setMouseOver([this.column])}mouseStayingInsideCell($){if(!$.target||!$.relatedTarget)return!1;let z=this.cellCtrl.eGui,Q=z.contains($.target),J=z.contains($.relatedTarget);return Q&&J}},yE=class extends S{constructor($,z){super();this.cellCtrl=$,this.beans=z,this.column=$.column,this.rowNode=$.rowNode}setupRowSpan(){this.rowSpan=this.column.getRowSpan(this.rowNode),this.addManagedListeners(this.beans.eventSvc,{newColumnsLoaded:()=>this.onNewColumnsLoaded()})}init(){this.eSetLeft=this.cellCtrl.getRootElement(),this.eContent=this.cellCtrl.eGui;let $=this.cellCtrl.getCellSpan();if(!$)this.setupColSpan(),this.setupRowSpan();if(this.onLeftChanged(),this.onWidthChanged(),!$)this._legacyApplyRowSpan();if($){let z=this.refreshSpanHeight.bind(this,$);z(),this.addManagedListeners(this.beans.eventSvc,{paginationChanged:z,recalculateRowBounds:z,pinnedHeightChanged:z})}}refreshSpanHeight($){let z=$.getCellHeight();if(z!=null)this.eContent.style.height=`${z}px`}onNewColumnsLoaded(){let $=this.column.getRowSpan(this.rowNode);if(this.rowSpan===$)return;this.rowSpan=$,this._legacyApplyRowSpan(!0)}onDisplayColumnsChanged(){let $=this.getColSpanningList();if(!X0(this.colsSpanning,$))this.colsSpanning=$,this.onWidthChanged(),this.onLeftChanged()}setupColSpan(){if(this.column.getColDef().colSpan==null)return;this.colsSpanning=this.getColSpanningList(),this.addManagedListeners(this.beans.eventSvc,{displayedColumnsChanged:this.onDisplayColumnsChanged.bind(this),displayedColumnsWidthChanged:this.onWidthChanged.bind(this)})}onWidthChanged(){if(!this.eContent)return;let $=this.getCellWidth();this.eContent.style.width=`${$}px`}getCellWidth(){if(!this.colsSpanning)return this.column.getActualWidth();return this.colsSpanning.reduce(($,z)=>$+z.getActualWidth(),0)}getColSpanningList(){let{column:$,rowNode:z}=this,Q=$.getColSpan(z),J=[];if(Q===1)J.push($);else{let Z=$,X=$.getPinned();for(let Y=0;Z&&Ythis.removeFeatures()),this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.setupFocus(),this.applyStaticCssClasses(),this.setWrapText(),this.onFirstRightPinnedChanged(),this.onLastLeftPinnedChanged(),this.onColumnHover(),this.setupControlComps(),this.setupAutoHeight(J,Y),this.refreshFirstAndLastStyles(),this.checkFormulaError(),this.refreshAriaRowIndex(),this.refreshAriaColIndex(),this.positionFeature?.init(),this.customStyleFeature?.setComp($),this.editStyleFeature?.setComp($),this.tooltipFeature?.refreshTooltip(),this.keyboardListener?.init(),this.rangeFeature?.setComp($),this.rowResizeFeature?.refreshRowResizer();let q=X?this.isCellEditable():void 0,G=!q&&this.hasEdit&&this.editSvc?.isEditing(this,{withOpenEditor:!0});if(q||G)this.editSvc?.startEditing(this,{startedEdit:!1,source:"api",silent:!0,continueEditing:!0,editable:q});else this.showValue(!1,!0);if(this.onCompAttachedFuncs.length){for(let _ of this.onCompAttachedFuncs)_();this.onCompAttachedFuncs=[]}}checkFormulaError(){let $=!!this.beans.formula?.getFormulaError(this.column,this.rowNode);this.eGui.classList.toggle("formula-error",$)}setupAutoHeight($,z){this.isAutoHeight=this.beans.rowAutoHeight?.setupCellAutoHeight(this,$,z)??!1}getCellAriaRole(){return this.column.getColDef().cellAriaRole??"gridcell"}isCellRenderer(){let $=this.column.getColDef();return $.cellRenderer!=null||$.cellRendererSelector!=null}getValueToDisplay(){return this.valueFormatted??this.value}getDeferLoadingCellRenderer(){let{beans:$,column:z}=this,{userCompFactory:Q,ctrlsSvc:J,eventSvc:Z}=$,X=z.getColDef(),Y=this.createCellRendererParams();Y.deferRender=!0;let q=E5(Q,X,Y);if(J.getGridBodyCtrl()?.scrollFeature?.isScrolling()){let G,_=new g((U)=>{G=U}),[H]=this.addManagedListeners(Z,{bodyScrollEnd:()=>{G(),H()}});return{loadingComp:q,onReady:_}}return{loadingComp:q,onReady:g.resolve()}}showValue($,z){let{beans:Q,column:J,rowNode:Z,rangeFeature:X}=this,{userCompFactory:Y}=Q,q=this.getValueToDisplay(),G,_=Z.stub&&Z.groupData?.[J.getId()]==null,H=J.getColDef();if(_||this.isCellRenderer()){let U=this.createCellRendererParams();if(!_||v0(J))G=oQ(Y,H,U);else G=E5(Y,H,U)}if(!G&&!_&&Q.findSvc?.isMatch(Z,J)){let U=this.createCellRendererParams();G=oQ(Y,{...J.getColDef(),cellRenderer:"agFindCellRenderer"},U)}if(this.hasEdit&&this.editSvc.isBatchEditing()&&this.editSvc.isRowEditing(Z,{checkSiblings:!0})){let U=this.editSvc.prepDetailsDuringBatch(this,{compDetails:G,valueToDisplay:q});if(U){if(U.compDetails)G=U.compDetails;else if(U.valueToDisplay)q=U.valueToDisplay}}if(this.comp.setRenderDetails(G,q,$),this.customRowDragComp?.refreshVisibility(),!z&&X)Y$(Q,()=>X?.refreshRangeStyleAndHandle());this.rowResizeFeature?.refreshRowResizer()}setupControlComps(){let $=this.column.getColDef();this.includeSelection=this.isIncludeControl(this.isCheckboxSelection($),!0),this.includeRowDrag=this.isIncludeControl($.rowDrag),this.includeDndSource=this.isIncludeControl($.dndSource),this.comp.setIncludeSelection(this.includeSelection),this.comp.setIncludeDndSource(this.includeDndSource),this.comp.setIncludeRowDrag(this.includeRowDrag)}isForceWrapper(){return this.beans.gos.get("enableCellTextSelection")||this.column.isAutoHeight()}getCellValueClass(){let z=this.column.getColDef().cellRenderer==="agCheckboxCellRenderer",Q="";if(z)Q=" ag-allow-overflow";return`ag-cell-value${Q}`}isIncludeControl($,z=!1){return(this.rowNode.rowPinned==null||z&&pJ(this.rowNode))&&!!$}isCheckboxSelection($){let{rowSelection:z,groupDisplayType:Q}=this.beans.gridOptions,J=EQ(z),Z=I$(this.column);if(Q==="custom"&&J!=="selectionColumn"&&Z)return!1;return $.checkboxSelection||Z&&typeof z==="object"&&Qz(z)}refreshShouldDestroy(){let $=this.column.getColDef(),z=this.includeSelection!=this.isIncludeControl(this.isCheckboxSelection($),!0),Q=this.includeRowDrag!=this.isIncludeControl($.rowDrag),J=this.includeDndSource!=this.isIncludeControl($.dndSource),Z=this.isAutoHeight!=this.column.isAutoHeight();return z||Q||J||Z}onPopupEditorClosed($){let{editSvc:z}=this.beans;if(!z?.isEditing(this,{withOpenEditor:!0}))return;let Q=$ instanceof KeyboardEvent,J=$ instanceof MouseEvent,Z=Q&&$.key===A.ESCAPE;if(z.stopEditing(this,{source:z.isBatchEditing()?"ui":"api",cancel:Z,event:Q||J?$:void 0}),Z)this.focusCell(!0,$)}stopEditing($=!1){let{editSvc:z}=this.beans;return z?.stopEditing(this,{cancel:$,source:z?.isBatchEditing()?"ui":"api"})??!1}createCellRendererParams(){let{value:$,valueFormatted:z,column:Q,rowNode:J,comp:Z,eGui:X,beans:{valueSvc:Y,gos:q,editSvc:G}}=this;return y(q,{value:$,valueFormatted:z,getValue:()=>Y.getValueForDisplay({column:Q,node:J,from:"edit"}).value,setValue:(H)=>G?.setDataValue({rowNode:J,column:Q},H)||J.setDataValue(Q,H),formatValue:this.formatValue.bind(this),data:J.data,node:J,pinned:Q.getPinned(),colDef:Q.getColDef(),column:Q,refreshCell:this.refreshCell.bind(this),eGridCell:X,eParentOfValue:Z.getParentOfValue(),registerRowDragger:(H,U,W,B)=>this.registerRowDragger(H,U,B),setTooltip:(H,U)=>{if(q.assertModuleRegistered("Tooltip",3),this.tooltipFeature)this.disableTooltipFeature();this.enableTooltipFeature(H,U),this.tooltipFeature?.refreshTooltip()}})}onCellChanged($){if($.column===this.column)this.refreshCell()}refreshOrDestroyCell($){if(this.refreshShouldDestroy())this.rowCtrl?.recreateCell(this);else this.refreshCell($);if(this.hasEdit&&this.editCompDetails){let{editSvc:z,comp:Q}=this;if(!Q?.getCellEditor()&&z.isEditing(this,{withOpenEditor:!0}))z.startEditing(this,{startedEdit:!1,source:"api",silent:!0})}}refreshCell($){let{editStyleFeature:z,customStyleFeature:Q,rowCtrl:{rowEditStyleFeature:J},beans:{cellFlashSvc:Z,filterManager:X},column:Y,comp:q,suppressRefreshCell:G,tooltipFeature:_}=this;if(G)return;let{field:H,valueGetter:U,showRowGroup:W,enableCellChangeFlash:B}=Y.getColDef(),E=H==null&&U==null&&W==null,K=$?.newData??!1,L=E||$&&($.force||K),D=!!q,F=this.updateAndFormatValue(D),M=L||F;if(!D)return;if(M){this.showValue(!!K,!1);let k=X?.isSuppressFlashingCellsBecauseFiltering();if(!$?.suppressFlash&&!k&&B)Z?.flashCell(this);z?.applyCellStyles?.(),Q?.applyUserStyles(),Q?.applyClassesFromColDef(),J?.applyRowStyles(),this.checkFormulaError()}_?.refreshTooltip(),Q?.applyCellClassRules()}isCellEditable(){return this.column.isCellEditable(this.rowNode)}formatValue($){return this.callValueFormatter($)??$}callValueFormatter($){return this.beans.valueSvc.formatValue(this.column,this.rowNode,$)}updateAndFormatValue($){let z=this.value,Q=this.valueFormatted,{value:J,valueFormatted:Z}=this.beans.valueSvc.getValueForDisplay({column:this.column,node:this.rowNode,includeValueFormatted:!0,from:"edit"});if(this.value=J,this.valueFormatted=Z,$)return!this.valuesAreEqual(z,this.value)||this.valueFormatted!=Q;return!0}valuesAreEqual($,z){let Q=this.column.getColDef();return Q.equals?Q.equals($,z):$===z}addDomData($){let z=this.eGui;wz(this.beans.gos,z,GJ,this),$.addDestroyFunc(()=>wz(this.beans.gos,z,GJ,null))}createEvent($,z){let{rowNode:Q,column:J,value:Z,beans:X}=this;return vE(X,$,z,{rowNode:Q,column:J},Z)}processCharacter($){this.keyboardListener?.processCharacter($)}onKeyDown($){this.keyboardListener?.onKeyDown($)}onMouseEvent($,z){this.mouseListener?.onMouseEvent($,z)}getColSpanningList(){return this.positionFeature?.getColSpanningList()??[]}onLeftChanged(){if(!this.comp)return;this.positionFeature?.onLeftChanged()}onDisplayedColumnsChanged(){if(!this.eGui)return;this.refreshAriaColIndex(),this.refreshFirstAndLastStyles()}refreshFirstAndLastStyles(){let{comp:$,column:z,beans:Q}=this;p7($,z,Q.visibleCols)}refreshAriaColIndex(){let $=this.beans.visibleCols.getAriaColIndex(this.column);j6(this.eGui,$)}onWidthChanged(){return this.positionFeature?.onWidthChanged()}getRowPosition(){let{rowIndex:$,rowPinned:z}=this.cellPosition;return{rowIndex:$,rowPinned:z}}updateRangeBordersIfRangeCount(){if(!this.comp)return;this.rangeFeature?.updateRangeBordersIfRangeCount()}onCellSelectionChanged(){if(!this.comp)return;this.rangeFeature?.onCellSelectionChanged()}isRangeSelectionEnabled(){return this.rangeFeature!=null}focusCell($=!1,z){let Q=this.editSvc?.allowedFocusTargetOnValidation(this);if(Q&&Q!==this)return;this.beans.focusSvc.setFocusedCell({...this.getFocusedCellPosition(),forceBrowserFocus:$,sourceEvent:z})}restoreFocus($=!1){let{beans:{editSvc:z,focusSvc:Q},comp:J}=this;if(!J||z?.isEditing(this)||!this.isCellFocused()||!Q.shouldTakeFocus())return;let Z=()=>{if(!this.isAlive())return;let X=J.getFocusableElement();if(this.isCellFocused())X.focus({preventScroll:!0})};if($){setTimeout(Z,0);return}Z()}onRowIndexChanged(){this.createCellPosition(),this.refreshAriaRowIndex(),this.onCellFocused(),this.restoreFocus(),this.rangeFeature?.onCellSelectionChanged(),this.rowResizeFeature?.refreshRowResizer()}onSuppressCellFocusChanged($){let z=this.eGui;if(!z)return;Pz(z,"tabindex",$?void 0:-1)}onFirstRightPinnedChanged(){if(!this.comp)return;let $=this.column.isFirstRightPinned();this.comp.toggleCss(hE,$)}onLastLeftPinnedChanged(){if(!this.comp)return;let $=this.column.isLastLeftPinned();this.comp.toggleCss(uE,$)}checkCellFocused(){return this.beans.focusSvc.isCellFocused(this.cellPosition)}isCellFocused(){let $=this.checkCellFocused();return this.hasBeenFocused||(this.hasBeenFocused=$),$}setupFocus(){this.restoreFocus(!0),this.onCellFocused(this.focusEventWhileNotReady??void 0)}onCellFocused($){let{beans:z}=this;if(qJ(z))return;if(!this.comp){if($)this.focusEventWhileNotReady=$;return}let Q=this.isCellFocused(),J=z.editSvc?.isEditing(this)??!1;if(this.comp.toggleCss(gE,Q),Q&&($?.forceBrowserFocus||!this.hasBrowserFocus()&&this.beans.focusSvc.shouldTakeFocus())){let Z=this.comp.getFocusableElement();if(J){let Y=E$(Z,null,!0);if(Y.length)Z=Y[0]}let X=$?$.preventScrollOnBrowserFocus:!0;Z.focus({preventScroll:X}),pY(z,Z)}if(Q&&this.focusEventWhileNotReady)this.focusEventWhileNotReady=null;if(Q&&$)this.rowCtrl.announceDescription()}createCellPosition(){let{rowIndex:$,rowPinned:z}=this.rowNode;this.cellPosition={rowIndex:$,rowPinned:j$(z),column:this.column}}applyStaticCssClasses(){let{comp:$}=this;$.toggleCss(xE,!0),$.toggleCss(mE,!0);let z=this.column.isAutoHeight()==!0;$.toggleCss(wE,z),$.toggleCss(NE,!z)}onColumnHover(){this.beans.colHover?.onCellColumnHover(this.column,this.comp)}onColDefChanged(){if(!this.comp)return;if(this.column.isTooltipEnabled())this.disableTooltipFeature(),this.enableTooltipFeature();else this.disableTooltipFeature();if(this.setWrapText(),this.editSvc?.isEditing(this))this.editSvc?.handleColDefChanged(this);else this.refreshOrDestroyCell({force:!0,suppressFlash:!0})}setWrapText(){let $=this.column.getColDef().wrapText==!0;this.comp.toggleCss(cE,$)}dispatchCellContextMenuEvent($){let z=this.column.getColDef(),Q=this.createEvent($,"cellContextMenu"),{beans:J}=this;if(J.eventSvc.dispatchEvent(Q),z.onCellContextMenu)window.setTimeout(()=>{J.frameworkOverrides.wrapOutgoing(()=>{z.onCellContextMenu(Q)})},0)}getCellRenderer(){return this.comp?.getCellRenderer()??null}destroy(){if(this.onCompAttachedFuncs=[],this.onEditorAttachedFuncs=[],this.isCellFocused()&&this.hasBrowserFocus())this.beans.focusSvc.attemptToRecoverFocus();super.destroy()}hasBrowserFocus(){return this.eGui?.contains(d(this.beans))??!1}createSelectionCheckbox(){let $=this.beans.selectionSvc?.createCheckboxSelectionComponent();if(!$)return;return this.beans.context.createBean($),$.init({rowNode:this.rowNode,column:this.column}),$}createDndSource(){let $=this.beans.registry.createDynamicBean("dndSourceComp",!1,this.rowNode,this.column,this.eGui);if($)this.beans.context.createBean($);return $}registerRowDragger($,z,Q){if(this.customRowDragComp){this.customRowDragComp.setDragElement($,z);return}let J=this.createRowDragComp($,z,Q);if(J)this.customRowDragComp=J,this.addDestroyFunc(()=>{this.beans.context.destroyBean(J),this.customRowDragComp=null}),J.refreshVisibility()}createRowDragComp($,z,Q){let J=this.beans.rowDragSvc?.createRowDragCompForCell(this.rowNode,this.column,()=>this.value,$,z,Q);if(!J)return;return this.beans.context.createBean(J),J}cellEditorAttached(){for(let $ of this.onEditorAttachedFuncs)$();this.onEditorAttachedFuncs=[]}setFocusedCellPosition($){}getFocusedCellPosition(){return this.cellPosition}refreshAriaRowIndex(){if(!v0(this.column)||!this.eGui)return;let{ariaRowIndex:$}=this.rowCtrl;if($!=null)o1(this.eGui,$)}getRootElement(){return this.eGui}};function c8($,z,Q,J,Z,X){if(Q==null&&z==null)return;let Y={},q={},G=(_,H)=>{for(let U of _.split(" ")){if(U.trim()=="")continue;H(U)}};if(Q){let _=Object.keys(Q);for(let H=0;H<_.length;H++){let U=_[H],W=Q[U],B;if(typeof W==="string")B=$?$.evaluate(W,J):!0;else if(typeof W==="function")B=W(J);G(U,(E)=>{if(B)Y[E]=!0;else q[E]=!0})}}if(z&&X)for(let _ of Object.keys(z))G(_,(H)=>{if(!Y[H])q[H]=!0});if(X)Object.keys(q).forEach(X);Object.keys(Y).forEach(Z)}function s5($){if($.group)return $.level;let z=$.parent;return z?z.level+1:0}var iE=0,L2=class extends S{constructor($,z,Q,J,Z){super();this.rowNode=$,this.useAnimationFrameForCreate=J,this.printLayout=Z,this.focusEventWhileNotReady=null,this.allRowGuis=[],this.active=!0,this.centerCellCtrls={list:[],map:{}},this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}},this.slideInAnimation={left:!1,center:!1,right:!1,fullWidth:!1},this.fadeInAnimation={left:!1,center:!1,right:!1,fullWidth:!1},this.rowDragComps=[],this.lastMouseDownOnDragger=!1,this.emptyStyle={},this.updateColumnListsPending=!1,this.rowId=null,this.ariaRowIndex=null,this.businessKey=null,this.beans=z,this.gos=z.gos,this.paginationPage=z.pagination?.getCurrentPage()??0,this.suppressRowTransform=this.gos.get("suppressRowTransform"),this.instanceId=$.id+"-"+iE++,this.rowId=W0($.id),this.initRowBusinessKey(),this.rowFocused=z.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=s5(this.rowNode),this.setRowType(),this.setAnimateFlags(Q),this.rowStyles=this.processStylesFromGridOptions(),this.rowEditStyleFeature=z.editSvc?.createRowStyleFeature(this),this.addListeners()}initRowBusinessKey(){this.businessKeyForNodeFunc=this.gos.get("getBusinessKeyForNode"),this.updateRowBusinessKey()}updateRowBusinessKey(){if(typeof this.businessKeyForNodeFunc!=="function")return;let $=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=W0($)}updateGui($,z){if($==="left")this.leftGui=z;else if($==="right")this.rightGui=z;else if($==="fullWidth")this.fullWidthGui=z;else this.centerGui=z}setComp($,z,Q,J){let{context:Z,rowRenderer:X}=this.beans;J=B1(this,Z,J);let Y={rowComp:$,element:z,containerType:Q,compBean:J};this.allRowGuis.push(Y),this.updateGui(Q,Y),this.initialiseRowComp(Y);let q=this.rowNode,G=this.rowType==="FullWidthLoading"||q.stub,_=!q.data&&this.beans.rowModel.getType()==="infinite";if(!G&&!_&&!q.rowPinned)X.dispatchFirstDataRenderedEvent();this.setupFocus()}unsetComp($){this.allRowGuis=this.allRowGuis.filter((z)=>z.containerType!==$),this.updateGui($,void 0)}isCacheable(){return this.rowType==="FullWidthDetail"&&this.gos.get("keepDetailRows")}setCached($){let z=$?"none":"";for(let Q of this.allRowGuis)Q.element.style.display=z}initialiseRowComp($){let z=this.gos;if(this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.listenOnDomOrder($),this.onRowHeightChanged($),this.updateRowIndexes($),this.setFocusedClasses($),this.setStylesFromGridOptions(!1,$),h$(z)&&this.rowNode.selectable)this.onRowSelected($);this.updateColumnLists(!this.useAnimationFrameForCreate);let Q=$.rowComp,J=this.getInitialRowClasses($.containerType);for(let Z of J)Q.toggleCss(Z,!0);if(this.executeSlideAndFadeAnimations($),this.rowNode.group)w0($.element,!!this.rowNode.expanded);if(this.setRowCompRowId(Q),this.setRowCompRowBusinessKey(Q),wz(z,$.element,_J,this),$.compBean.addDestroyFunc(()=>wz(z,$.element,_J,null)),this.useAnimationFrameForCreate)this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,$),this.rowNode.rowIndex,"p2",!1);else this.addHoverFunctionality($);if(this.isFullWidth())this.setupFullWidth($);if(z.get("rowDragEntireRow"))this.addRowDraggerToRow($);if(this.useAnimationFrameForCreate)this.beans.animationFrameSvc.addDestroyTask(()=>{if(!this.isAlive())return;$.rowComp.toggleCss("ag-after-created",!0)});this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey($){if(this.businessKey==null)return;$.setRowBusinessKey(this.businessKey)}setRowCompRowId($){let z=W0(this.rowNode.id);if(this.rowId=z,z==null)return;$.setRowId(z)}executeSlideAndFadeAnimations($){let{containerType:z}=$;if(this.slideInAnimation[z])oZ(()=>{this.onTopChanged()}),this.slideInAnimation[z]=!1;if(this.fadeInAnimation[z])oZ(()=>{$.rowComp.toggleCss("ag-opacity-zero",!1)}),this.fadeInAnimation[z]=!1}addRowDraggerToRow($){let z=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,$.element);if(!z)return;let Q=this.createBean(z,this.beans.context);this.rowDragComps.push(Q),$.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter((J)=>J!==Q),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(Q,this.beans.context)})}setupFullWidth($){let z=this.getPinnedForContainer($.containerType),Q=this.createFullWidthCompDetails($.element,z);$.rowComp.showFullWidth(Q)}getFullWidthCellRenderers(){if(this.gos.get("embedFullWidthRows"))return this.allRowGuis.map(($)=>$?.rowComp?.getFullWidthCellRenderer());return[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let $=this.gos.getCallback("processRowPostCreate");if(!$||!this.areAllContainersReady())return;let z={eRow:this.centerGui.element,ePinnedLeftRow:this.leftGui?this.leftGui.element:void 0,ePinnedRightRow:this.rightGui?this.rightGui.element:void 0,node:this.rowNode,rowIndex:this.rowNode.rowIndex,addRenderedRowListener:this.addEventListener.bind(this)};$(z)}areAllContainersReady(){let{leftGui:$,centerGui:z,rightGui:Q,beans:{visibleCols:J}}=this,Z=!!$||!J.isPinningLeft(),X=!!z,Y=!!Q||!J.isPinningRight();return Z&&X&&Y}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let $=this.beans.gos.getCallback("isFullWidthRow");return $?$({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:$,gos:z,beans:{colModel:Q}}=this,J=$.stub&&!z.get("suppressServerSideFullWidthLoadingRow")&&!z.get("groupHideOpenParents"),Z=this.isNodeFullWidthCell(),X=z.get("masterDetail")&&$.detail,Y=Q.isPivotMode(),q=J7(z,$,Y);if(J)this.rowType="FullWidthLoading";else if(X)this.rowType="FullWidthDetail";else if(Z)this.rowType="FullWidth";else if(q)this.rowType="FullWidthGroup";else this.rowType="Normal"}updateColumnLists($=!1,z=!1){if(this.isFullWidth())return;let{animationFrameSvc:Q}=this.beans;if(!Q?.active||$||this.printLayout){this.updateColumnListsImpl(z);return}if(this.updateColumnListsPending)return;Q.createTask(()=>{if(!this.active)return;this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,"p1",!1),this.updateColumnListsPending=!0}getNewCellCtrl($){if(this.beans.rowSpanSvc?.isCellSpanning($,this.rowNode))return;return new uQ($,this.rowNode,this.beans,this)}isCorrectCtrlForSpan($){return!this.beans.rowSpanSvc?.isCellSpanning($.column,this.rowNode)}createCellCtrls($,z,Q=null){let J={list:[],map:{}},Z=(_,H,U)=>{if(U!=null)J.list.splice(U,0,H);else J.list.push(H);J.map[_]=H},X=[];for(let _ of z){let H=_.getInstanceId(),U=$.map[H];if(U&&!this.isCorrectCtrlForSpan(U))U.destroy(),U=void 0;if(!U)U=this.getNewCellCtrl(_);if(!U)continue;Z(H,U)}for(let _ of $.list){let H=_.column.getInstanceId();if(J.map[H]!=null)continue;if(!this.isCellEligibleToBeRemoved(_,Q))X.push([H,_]);else _.destroy()}if(X.length)for(let[_,H]of X){let U=J.list.findIndex((B)=>B.column.getLeft()>H.column.getLeft()),W=U===-1?void 0:Math.max(U-1,0);Z(_,H,W)}let{focusSvc:Y,visibleCols:q}=this.beans,G=Y.getFocusedCell();if(G&&G.column.getPinned()==Q){let _=G.column.getInstanceId();if(!J.map[_]&&q.allCols.includes(G.column)){let U=this.createFocusedCellCtrl();if(U){let W=J.list.findIndex((E)=>E.column.getLeft()>U.column.getLeft()),B=W===-1?void 0:Math.max(W-1,0);Z(_,U,B)}}}return J}createFocusedCellCtrl(){let{focusSvc:$,rowSpanSvc:z}=this.beans,Q=$.getFocusedCell();if(!Q)return;let J=z?.getCellSpan(Q.column,this.rowNode);if(J){if(J.firstNode!==this.rowNode||!J.doesSpanContain(Q))return}else if(!$.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(Q.column)}updateColumnListsImpl($){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls($)}setCellCtrls($){for(let z of this.allRowGuis){let Q=this.getCellCtrlsForContainer(z.containerType);z.rowComp.setCellCtrls(Q,$)}}getCellCtrlsForContainer($){switch($){case"left":return this.leftCellCtrls.list;case"right":return this.rightCellCtrls.list;case"fullWidth":return[];case"center":return this.centerCellCtrls.list}}createAllCellCtrls(){let $=this.beans.colViewport,z=this.beans.visibleCols;if(this.printLayout)this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,z.allCols),this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}};else{let Q=$.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,Q);let J=z.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,J,"left");let Z=z.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,Z,"right")}}isCellEligibleToBeRemoved($,z){let{column:Z}=$;if(Z.getPinned()!=z)return!0;if(!this.isCorrectCtrlForSpan($))return!0;let{visibleCols:X,editSvc:Y}=this.beans,q=Y?.isEditing($),G=$.isCellFocused();if(q||G)return X.allCols.indexOf(Z)>=0?!1:!0;return!0}getDomOrder(){return this.gos.get("ensureDomOrder")||V0(this.gos,"print")}listenOnDomOrder($){let z=()=>{$.rowComp.setDomOrder(this.getDomOrder())};$.compBean.addManagedPropertyListeners(["domLayout","ensureDomOrder"],z)}setAnimateFlags($){if(this.rowNode.sticky||!$)return;let z=T(this.rowNode.oldRowTop),{visibleCols:Q}=this.beans,J=Q.isPinningLeft(),Z=Q.isPinningRight();if(z){let{slideInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=J,X.right=Z}else{let{fadeInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=J,X.right=Z}}isFullWidth(){return this.rowType!=="Normal"}refreshFullWidth(){let $=(Y,q)=>{if(!Y)return!0;return Y.rowComp.refreshFullWidth(()=>{return this.createFullWidthCompDetails(Y.element,q).params})},z=$(this.fullWidthGui,null),Q=$(this.centerGui,null),J=$(this.leftGui,"left"),Z=$(this.rightGui,"right");return z&&Q&&J&&Z}addListeners(){let{beans:$,gos:z,rowNode:Q}=this,{expansionSvc:J,eventSvc:Z,context:X,rowSpanSvc:Y}=$;if(this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...J?.getRowExpandedListeners(this)??{}}),Q.detail)this.addManagedListeners(Q.parent,{dataChanged:this.onRowNodeDataChanged.bind(this)});if(this.addManagedListeners(Q,{dataChanged:this.onRowNodeDataChanged.bind(this),cellChanged:this.postProcessCss.bind(this),rowHighlightChanged:this.onRowNodeHighlightChanged.bind(this),draggingChanged:this.postProcessRowDragging.bind(this),uiLevelChanged:this.onUiLevelChanged.bind(this),rowPinned:this.onRowPinned.bind(this)}),this.addManagedListeners(Z,{paginationPixelOffsetChanged:this.onPaginationPixelOffsetChanged.bind(this),heightScaleChanged:this.onTopChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),virtualColumnsChanged:this.onVirtualColumnsChanged.bind(this),cellFocused:this.onCellFocusChanged.bind(this),cellFocusCleared:this.onCellFocusChanged.bind(this),paginationChanged:this.onPaginationChanged.bind(this),modelUpdated:this.refreshFirstAndLastRowStyles.bind(this),columnMoved:()=>this.updateColumnLists()}),Y)this.addManagedListeners(Y,{spannedCellsUpdated:({pinned:q})=>{if(q&&!Q.rowPinned)return;this.updateColumnLists()}});this.addDestroyFunc(()=>{this.rowDragComps=this.destroyBeans(this.rowDragComps,X),this.tooltipFeature=this.destroyBean(this.tooltipFeature,X),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,X)}),this.addManagedPropertyListeners(["rowStyle","getRowStyle","rowClass","getRowClass","rowClassRules"],this.postProcessCss.bind(this)),this.addManagedPropertyListener("rowDragEntireRow",()=>{if(z.get("rowDragEntireRow")){for(let G of this.allRowGuis)this.addRowDraggerToRow(G);return}this.rowDragComps=this.destroyBeans(this.rowDragComps,X)}),this.addListenersForCellComps()}addListenersForCellComps(){this.addManagedListeners(this.rowNode,{rowIndexChanged:()=>{for(let $ of this.getAllCellCtrls())$.onRowIndexChanged()},cellChanged:($)=>{for(let z of this.getAllCellCtrls())z.onCellChanged($)}})}onRowPinned(){for(let $ of this.allRowGuis)$.rowComp.toggleCss("ag-row-pinned-source",!!this.rowNode.pinnedSibling)}onRowNodeDataChanged($){this.refreshRow({suppressFlash:!$.update,newData:!$.update})}refreshRow($){if(this.isFullWidth()!==!!this.isNodeFullWidthCell()){this.beans.rowRenderer.redrawRow(this.rowNode);return}if(this.isFullWidth()){if(!this.refreshFullWidth())this.beans.rowRenderer.redrawRow(this.rowNode);return}for(let Q of this.getAllCellCtrls())Q.refreshCell($);for(let Q of this.allRowGuis)this.setRowCompRowId(Q.rowComp),this.updateRowBusinessKey(),this.setRowCompRowBusinessKey(Q.rowComp);this.onRowSelected(),this.postProcessCss()}postProcessCss(){this.setStylesFromGridOptions(!0),this.postProcessClassesFromGridOptions(),this.postProcessRowClassRules(),this.rowEditStyleFeature?.applyRowStyles(),this.postProcessRowDragging()}onRowNodeHighlightChanged(){let $=this.beans.rowDropHighlightSvc,z=$?.row===this.rowNode?$.position:"none",Q=z==="above",J=z==="inside",Z=z==="below",X=z!=="none",Y=Q||Z,q=this.rowNode.uiLevel,G=Y&&q>0,_=G?q.toString():"0";for(let H of this.allRowGuis){let U=H.rowComp;if(U.toggleCss("ag-row-highlight-above",Q),U.toggleCss("ag-row-highlight-inside",J),U.toggleCss("ag-row-highlight-below",Z),U.toggleCss("ag-row-highlight-indent",G),X)H.element.style.setProperty("--ag-row-highlight-level",_);else H.element.style.removeProperty("--ag-row-highlight-level")}}postProcessRowDragging(){let $=this.rowNode.dragging;for(let z of this.allRowGuis)z.rowComp.toggleCss("ag-row-dragging",$)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:j$(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate($){let z=this.findFullWidthInfoForEvent($);if(!z)return;let{rowGui:Q,column:J}=z;if(Q.element!==$.target)return;let Y=this.rowNode,{focusSvc:q,navigation:G}=this.beans,_=q.getFocusedCell(),H={rowIndex:Y.rowIndex,rowPinned:Y.rowPinned,column:_?.column??J};G?.navigateToNextCell($,$.key,H,!0),$.preventDefault()}onTabKeyDown($){if($.defaultPrevented||z$($))return;let z=this.allRowGuis.find((q)=>q.element.contains($.target)),Q=z?z.element:null,J=Q===$.target,Z=d(this.beans),X=!1;if(Q&&Z)X=Q.contains(Z)&&Z.classList.contains("ag-cell");let Y=null;if(!J&&!X)Y=j0(this.beans,Q,!1,$.shiftKey);if(this.isFullWidth()&&J||!Y)this.beans.navigation?.onTabKeyDown(this,$)}getFullWidthElement(){if(this.fullWidthGui)return this.fullWidthGui.element;return null}getRowYPosition(){let $=this.allRowGuis.find((z)=>A0(z.element))?.element;if($)return $.getBoundingClientRect().top;return 0}onSuppressCellFocusChanged($){let z=this.isFullWidth()&&$?void 0:this.gos.get("tabIndex");for(let Q of this.allRowGuis)Pz(Q.element,"tabindex",z)}setupFocus(){if(!this.isFullWidth())return;this.restoreFullWidthFocus(!0),this.onFullWidthRowFocused(this.focusEventWhileNotReady??void 0)}restoreFullWidthFocus($=!1){let{focusSvc:z,editSvc:Q}=this.beans;if(Q?.isEditing(this))return;if(!z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned)||!z.shouldTakeFocus())return;let J=this.getFullWidthRowGuiForFocus();if(!J)return;let Z=()=>{if(!this.isAlive())return;if(z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))J.element.focus({preventScroll:!0})};if($){setTimeout(Z,0);return}Z()}getFullWidthRowGuiForFocus($){if(this.fullWidthGui)return this.fullWidthGui;let z=this.beans.focusSvc.getFocusedCell(),Q=this.beans.colModel.getCol($?.column??z?.column);if(!Q)return;let J=Q?.pinned;if(J==="right")return this.rightGui;if(J==="left")return this.leftGui;return this.centerGui}setFullWidthRowFocusedClass($,z){this.forEachGui(void 0,(Q)=>{Q.element.classList.toggle("ag-full-width-focus",z&&Q===$)})}onFullWidthRowFocused($){let{focusSvc:z}=this.beans;if(!(this.isFullWidth()&&z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))){this.setFullWidthRowFocusedClass(void 0,!1);return}let J=this.getFullWidthRowGuiForFocus($);if(!J){if($)this.focusEventWhileNotReady=$;this.setFullWidthRowFocusedClass(void 0,!1);return}if(this.setFullWidthRowFocusedClass(J,!0),this.focusEventWhileNotReady=null,$?.forceBrowserFocus)J.element.focus({preventScroll:!0})}recreateCell($){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,$),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,$),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,$),$.destroy(),this.updateColumnLists()}removeCellCtrl($,z){let Q={list:[],map:{}};for(let J of $.list){if(J===z)continue;Q.list.push(J),Q.map[J.column.getInstanceId()]=J}return Q}onMouseEvent($,z){switch($){case"dblclick":this.onRowDblClick(z);break;case"click":this.onRowClick(z);break;case"pointerdown":case"touchstart":case"mousedown":this.onRowMouseDown(z);break}}createRowEvent($,z){let{rowNode:Q}=this;return y(this.gos,{type:$,node:Q,data:Q.data,rowIndex:Q.rowIndex,rowPinned:Q.rowPinned,event:z})}createRowEventWithSource($,z){let Q=this.createRowEvent($,z);return Q.source=this,Q}onRowDblClick($){if(z$($))return;let z=this.createRowEventWithSource("rowDoubleClicked",$);z.isEventHandlingSuppressed=this.isSuppressMouseEvent($),this.beans.eventSvc.dispatchEvent(z)}findFullWidthInfoForEvent($){if(!$)return;let z=this.findFullWidthRowGui($.target),Q=this.getColumnForFullWidth(z);if(!z||!Q)return;return{rowGui:z,column:Q}}findFullWidthRowGui($){return this.allRowGuis.find((z)=>z.element.contains($))}getColumnForFullWidth($){let{visibleCols:z}=this.beans;switch($?.containerType){case"center":return z.centerCols[0];case"left":return z.leftCols[0];case"right":return z.rightCols[0];default:return z.allCols[0]}}onRowMouseDown($){if(this.lastMouseDownOnDragger=vz($.target,"ag-row-drag",3),!this.isFullWidth()||this.isSuppressMouseEvent($))return;let{rangeSvc:z,focusSvc:Q}=this.beans;z?.removeAllCellRanges();let J=this.findFullWidthInfoForEvent($);if(!J)return;let{rowGui:Z,column:X}=J,Y=Z.element,q=$.target,G=this.rowNode,_=$.defaultPrevented||cz();if(Y&&Y.contains(q)&&wQ(q))_=!1;Q.setFocusedCell({rowIndex:G.rowIndex,column:X,rowPinned:G.rowPinned,forceBrowserFocus:_})}isSuppressMouseEvent($){let{gos:z,rowNode:Q}=this;if(this.isFullWidth()){let Z=this.findFullWidthRowGui($.target);return w_(z,Z?.rowComp.getFullWidthCellRendererParams(),Q,$)}let J=E1(z,$.target);return J!=null&&t1(z,J.column,Q,$)}onRowClick($){if(z$($)||this.lastMouseDownOnDragger)return;let Q=this.isSuppressMouseEvent($),{eventSvc:J,selectionSvc:Z}=this.beans,X=this.createRowEventWithSource("rowClicked",$);if(X.isEventHandlingSuppressed=Q,J.dispatchEvent(X),Q)return;Z?.handleSelectionEvent($,this.rowNode,"rowClicked")}setupDetailRowAutoHeight($){if(this.rowType!=="FullWidthDetail")return;this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,$)}createFullWidthCompDetails($,z){let{gos:Q,rowNode:J}=this,Z=y(Q,{fullWidth:!0,data:J.data,node:J,value:J.key,valueFormatted:J.key,eGridCell:$,eParentOfValue:$,pinned:z,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(Y,q,G,_)=>this.addFullWidthRowDragging(Y,q,G,_),setTooltip:(Y,q)=>{Q.assertModuleRegistered("Tooltip",3),this.setupFullWidthRowTooltip(Y,q)}}),X=this.beans.userCompFactory;switch(this.rowType){case"FullWidthDetail":return SG(X,Z);case"FullWidthGroup":{let{value:Y,valueFormatted:q}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0,from:"edit"});return Z.value=Y,Z.valueFormatted=q,AG(X,Z)}case"FullWidthLoading":return VG(X,Z);default:return kG(X,Z)}}setupFullWidthRowTooltip($,z){if(!this.fullWidthGui)return;this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,$,z)}addFullWidthRowDragging($,z,Q="",J){let{rowDragSvc:Z,context:X}=this.beans;if(!Z||!this.isFullWidth())return;let Y=Z.createRowDragComp(()=>Q,this.rowNode,void 0,$,z,J);this.createBean(Y,X),this.addDestroyFunc(()=>{this.destroyBean(Y,X)})}onUiLevelChanged(){let $=s5(this.rowNode);if(this.rowLevel!=$){let z="ag-row-level-"+$,Q="ag-row-level-"+this.rowLevel;for(let J of this.allRowGuis)J.rowComp.toggleCss(z,!0),J.rowComp.toggleCss(Q,!1)}this.rowLevel=$}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let $=this.isFirstRowOnPage(),z=this.isLastRowOnPage();if(this.firstRowOnPage!==$){this.firstRowOnPage=$;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-first",$)}if(this.lastRowOnPage!==z){this.lastRowOnPage=z;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-last",z)}}getAllCellCtrls(){if(this.leftCellCtrls.list.length===0&&this.rightCellCtrls.list.length===0)return this.centerCellCtrls.list;return[...this.centerCellCtrls.list,...this.leftCellCtrls.list,...this.rightCellCtrls.list]}postProcessClassesFromGridOptions(){let $=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions($,this.rowNode),!$.length)return;for(let z of $)for(let Q of this.allRowGuis)Q.rowComp.toggleCss(z,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,($)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss($,!0)},($)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss($,!1)})}setStylesFromGridOptions($,z){if($)this.rowStyles=this.processStylesFromGridOptions();this.forEachGui(z,(Q)=>Q.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer($){if($==="left"||$==="right")return $;return null}getInitialRowClasses($){let z=this.getPinnedForContainer($),Q=this.isFullWidth(),{rowNode:J,beans:Z}=this,X=[];if(X.push("ag-row"),X.push(this.rowFocused?"ag-row-focus":"ag-row-no-focus"),this.fadeInAnimation[$])X.push("ag-opacity-zero");if(X.push(J.rowIndex%2===0?"ag-row-even":"ag-row-odd"),J.isRowPinned()){if(X.push("ag-row-pinned"),Z.pinnedRowModel?.isManual())X.push("ag-row-pinned-manual")}if(!J.isRowPinned()&&J.pinnedSibling)X.push("ag-row-pinned-source");if(J.isSelected())X.push("ag-row-selected");if(J.footer)X.push("ag-row-footer");if(X.push("ag-row-level-"+this.rowLevel),J.stub)X.push("ag-row-loading");if(Q)X.push("ag-full-width-row");if(Z.expansionSvc?.addExpandedCss(X,J),J.dragging)X.push("ag-row-dragging");let{rowStyleSvc:Y}=Z;if(Y)Y.processClassesFromGridOptions(X,J),Y.preProcessRowClassRules(X,J);if(X.push(this.printLayout?"ag-row-position-relative":"ag-row-position-absolute"),this.isFirstRowOnPage())X.push("ag-row-first");if(this.isLastRowOnPage())X.push("ag-row-last");if(Q){if(z==="left")X.push("ag-cell-last-left-pinned");if(z==="right")X.push("ag-cell-first-right-pinned")}return X}processStylesFromGridOptions(){return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode)??this.emptyStyle}onRowSelected($){this.beans.selectionSvc?.onRowCtrlSelected(this,(z)=>{if(z===this.centerGui||z===this.fullWidthGui)this.announceDescription()},$)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality($){if(!this.active)return;let{element:z,compBean:Q}=$,{rowNode:J,beans:Z,gos:X}=this;Q.addManagedListeners(z,{pointerenter:(Y)=>{if(Y.pointerType==="mouse")J.dispatchRowEvent("mouseEnter")},pointerleave:(Y)=>{if(Y.pointerType==="mouse")J.dispatchRowEvent("mouseLeave")}}),Q.addManagedListeners(J,{mouseEnter:()=>{if(!Z.dragSvc?.dragging&&!X.get("suppressRowHoverHighlight"))z.classList.add("ag-row-hover"),J.setHovered(!0)},mouseLeave:()=>{this.resetHoveredStatus(z)}})}resetHoveredStatus($){let z=$?[$]:this.allRowGuis.map((Q)=>Q.element);for(let Q of z)Q.classList.remove("ag-row-hover");this.rowNode.setHovered(!1)}roundRowTopToBounds($){let z=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),Q=this.applyPaginationOffset(z.top,!0)-100,J=this.applyPaginationOffset(z.bottom,!0)+100;return Math.min(Math.max(Q,$),J)}forEachGui($,z){if($)z($);else for(let Q of this.allRowGuis)z(Q)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged($){if(this.rowNode.rowHeight==null)return;let z=this.rowNode.rowHeight,Q=this.beans.environment.getDefaultRowHeight(),Z=$7(this.gos)?sQ(this.beans,this.rowNode).height:void 0,X=Z?`${Math.min(Q,Z)-2}px`:void 0;this.forEachGui($,(Y)=>{if(Y.element.style.height=`${z}px`,X)Y.element.style.setProperty("--ag-line-height",X)})}destroyFirstPass($=!1){this.active=!1;let{rowNode:z}=this;if(!$&&HQ(this.gos)&&!z.sticky)if(z.rowTop!=null){let Z=this.roundRowTopToBounds(z.rowTop);this.setRowTop(Z)}else for(let Z of this.allRowGuis)Z.rowComp.toggleCss("ag-opacity-zero",!0);if(this.fullWidthGui?.element.contains(d(this.beans)))this.beans.focusSvc.attemptToRecoverFocus();z.setHovered(!1);let Q=this.createRowEvent("virtualRowRemoved");this.dispatchLocalEvent(Q),this.beans.eventSvc.dispatchEvent(Q),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let $=(z)=>{for(let Q of z.list)Q.destroy();return{list:[],map:{}}};this.centerCellCtrls=$(this.centerCellCtrls),this.leftCellCtrls=$(this.leftCellCtrls),this.rightCellCtrls=$(this.rightCellCtrls)}setFocusedClasses($){this.forEachGui($,(z)=>{z.rowComp.toggleCss("ag-row-focus",this.rowFocused),z.rowComp.toggleCss("ag-row-no-focus",!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:$}=this.beans,z=$.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);if(z!==this.rowFocused)this.rowFocused=z,this.setFocusedClasses()}onPaginationChanged(){let $=this.beans.pagination?.getCurrentPage()??0;if(this.paginationPage!==$)this.paginationPage=$,this.onTopChanged();this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset($,z=!1){if(this.rowNode.isRowPinned()||this.rowNode.sticky)return $;let Q=this.beans.pageBounds.getPixelOffset();return $+Q*(z?1:-1)}setRowTop($){if(this.printLayout)return;if(T($)){let z=this.applyPaginationOffset($),Z=`${this.rowNode.isRowPinned()||this.rowNode.sticky?z:this.beans.rowContainerHeight.getRealPixelPosition(z)}px`;this.setRowTopStyle(Z)}}getInitialRowTop($){return this.suppressRowTransform?this.getInitialRowTopShared($):void 0}getInitialTransform($){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared($)})`}getInitialRowTopShared($){if(this.printLayout)return"";let z=this.rowNode,Q;if(z.sticky)Q=z.stickyRowTop;else{let J=this.slideInAnimation[$]?this.roundRowTopToBounds(z.oldRowTop):z.rowTop,Z=this.applyPaginationOffset(J);Q=z.isRowPinned()?Z:this.beans.rowContainerHeight.getRealPixelPosition(Z)}return Q+"px"}setRowTopStyle($){for(let z of this.allRowGuis)if(this.suppressRowTransform)z.rowComp.setTop($);else z.rowComp.setTransform(`translateY(${$})`)}getCellCtrl($,z=!1){let Q=null;for(let J of this.getAllCellCtrls())if(J.column==$)Q=J;if(Q!=null||z)return Q;for(let J of this.getAllCellCtrls())if(J?.getColSpanningList().indexOf($)>=0)Q=J;return Q}onRowIndexChanged(){if(this.rowNode.rowIndex!=null)this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss()}updateRowIndexes($){let z=this.rowNode.getRowIndexString();if(z===null)return;let Q=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),J=this.rowNode.rowIndex%2===0,Z=this.ariaRowIndex=Q+this.rowNode.rowIndex+1;this.forEachGui($,(X)=>{X.rowComp.setRowIndex(z),X.rowComp.toggleCss("ag-row-even",J),X.rowComp.toggleCss("ag-row-odd",!J),o1(X.element,Z)})}},nE=class extends S{constructor(){super();this.beanName="navigation",this.onPageDown=_5(this.onPageDown,100),this.onPageUp=_5(this.onPageUp,100)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCon=$.gridBodyCtrl})}handlePageScrollingKey($,z=!1){let{key:Q,altKey:J}=$,Z=$.ctrlKey||$.metaKey,X=!!this.beans.rangeSvc&&$.shiftKey,Y=_4(this.gos,$),q=!1;switch(Q){case A.PAGE_HOME:case A.PAGE_END:if(!Z&&!J)this.onHomeOrEndKey(Q),q=!0;break;case A.LEFT:case A.RIGHT:case A.UP:case A.DOWN:if(!Y)return!1;if(Z&&!J&&!X)this.onCtrlUpDownLeftRight(Q,Y),q=!0;break;case A.PAGE_DOWN:case A.PAGE_UP:if(!Z&&!J)q=this.handlePageUpDown(Q,Y,z);break}if(q)$.preventDefault();return q}handlePageUpDown($,z,Q){if(Q)z=this.beans.focusSvc.getFocusedCell();if(!z)return!1;if($===A.PAGE_UP)this.onPageUp(z);else this.onPageDown(z);return!0}navigateTo({scrollIndex:$,scrollType:z,scrollColumn:Q,focusIndex:J,focusColumn:Z,isAsync:X,rowPinned:Y}){let{scrollFeature:q}=this.gridBodyCon;if(T(Q)&&!Q.isPinned())q.ensureColumnVisible(Q);if(T($))q.ensureIndexVisible($,z);if(!X)q.ensureIndexVisible(J);let{focusSvc:G}=this.beans;G.setFocusedCell({rowIndex:J,column:Z,rowPinned:Y,forceBrowserFocus:!0}),this.setRangeToCellIfSupported({rowIndex:J,rowPinned:Y,column:Z})}onPageDown($){let z=this.beans,Q=dZ(z),J=this.getViewportHeight(),{pageBounds:Z,rowModel:X,rowAutoHeight:Y}=z,q=Z.getPixelOffset(),G=Q.top+J,_=X.getRowIndexAtPixel(G+q);if(Y?.active)this.navigateToNextPageWithAutoHeight($,_);else this.navigateToNextPage($,_)}onPageUp($){let z=this.beans,Q=dZ(z),{pageBounds:J,rowModel:Z,rowAutoHeight:X}=z,Y=J.getPixelOffset(),q=Q.top,G=Z.getRowIndexAtPixel(q+Y);if(X?.active)this.navigateToNextPageWithAutoHeight($,G,!0);else this.navigateToNextPage($,G,!0)}navigateToNextPage($,z,Q=!1){let{pageBounds:J,rowModel:Z}=this.beans,X=this.getViewportHeight(),Y=J.getFirstRow(),q=J.getLastRow(),G=J.getPixelOffset(),_=Z.getRow($.rowIndex),H=Q?_?.rowHeight-X-G:X-G,U=_?.rowTop+H,W=Z.getRowIndexAtPixel(U+G);if(W===$.rowIndex){let E=Q?-1:1;z=W=$.rowIndex+E}let B;if(Q){if(B="bottom",Wq)W=q;if(z>q)z=q}if(this.isRowTallerThanView(Z.getRow(W)))z=W,B="top";this.navigateTo({scrollIndex:z,scrollType:B,scrollColumn:null,focusIndex:W,focusColumn:$.column})}navigateToNextPageWithAutoHeight($,z,Q=!1){this.navigateTo({scrollIndex:z,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:z,focusColumn:$.column}),setTimeout(()=>{let J=this.getNextFocusIndexForAutoHeight($,Q);this.navigateTo({scrollIndex:z,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:J,focusColumn:$.column,isAsync:!0})},50)}getNextFocusIndexForAutoHeight($,z=!1){let Q=z?-1:1,J=this.getViewportHeight(),{pageBounds:Z,rowModel:X}=this.beans,Y=Z.getLastRow(),q=0,G=$.rowIndex;while(G>=0&&G<=Y){let _=X.getRow(G);if(_){let H=_.rowHeight??0;if(q+H>J)break;q+=H}G+=Q}return Math.max(0,Math.min(G,Y))}getViewportHeight(){let $=this.beans,z=dZ($),Q=this.beans.scrollVisibleSvc.getScrollbarWidth(),J=z.bottom-z.top;if($.ctrlsSvc.get("center").isHorizontalScrollShowing())J-=Q;return J}isRowTallerThanView($){if(!$)return!1;let z=$.rowHeight;if(typeof z!=="number")return!1;return z>this.getViewportHeight()}onCtrlUpDownLeftRight($,z){let Q=this.beans.cellNavigation.getNextCellToFocus($,z,!0);if(!Q)return;let J=this.getNormalisedPosition(Q),{rowIndex:Z,rowPinned:X,column:Y}=J??Q,q=Y;this.navigateTo({scrollIndex:Z,scrollType:null,scrollColumn:q,focusIndex:Z,focusColumn:q,rowPinned:X})}onHomeOrEndKey($){let z=$===A.PAGE_HOME,{visibleCols:Q,pageBounds:J,rowModel:Z}=this.beans,X=Q.allCols,Y=z?J.getFirstRow():J.getLastRow(),q=Z.getRow(Y);if(!q)return;let G=(z?X:[...X].reverse()).find((_)=>!_.isSuppressNavigable(q)&&!v0(_));if(!G)return;this.navigateTo({scrollIndex:Y,scrollType:null,scrollColumn:G,focusIndex:Y,focusColumn:G})}onTabKeyDown($,z){let Q=z.shiftKey,J=this.tabToNextCellCommon($,Q,z),Z=this.beans,{ctrlsSvc:X,pageBounds:Y,focusSvc:q,gos:G}=Z;if(J!==!1){if(J)z.preventDefault();else if(J===null)X.get("gridCtrl").allowFocusForNextCoreContainer(Q);return}if(Q){let{rowIndex:_,rowPinned:H}=$.getRowPosition();if(H?_===0:_===Y.getFirstRow())if(G.get("headerHeight")===0||H$(Z))Z$(Z,!0,!0);else z.preventDefault(),q.focusPreviousFromFirstCell(z)}else{if($ instanceof uQ)$.focusCell(!0);if(q.focusOverlay(!1)||Z$(Z,Q))z.preventDefault()}}tabToNextCell($,z){let Q=this.beans,{focusSvc:J,rowRenderer:Z}=Q,X=J.getFocusedCell();if(!X)return!1;let Y=e0(Q,X);if(!Y){if(Y=Z.getRowByPosition(X),!Y?.isFullWidth())return!1}return!!this.tabToNextCellCommon(Y,$,z,"api")}tabToNextCellCommon($,z,Q,J="ui"){let{editSvc:Z,focusSvc:X}=this.beans,Y=void 0,q=$ instanceof uQ?$:$.getAllCellCtrls()?.[0];if(Z?.isEditing())Y=Z?.moveToNextCell(q,z,Q,J);else Y=this.moveToNextCellNotEditing($,z,Q);if(Y===null)return Y;return Y||!!X.focusedHeader}moveToNextCellNotEditing($,z,Q){let J=this.beans.visibleCols.allCols,Z;if($ instanceof L2){if(Z={...$.getRowPosition(),column:z?J[0]:b(J)},this.gos.get("embedFullWidthRows")&&Q){let Y=$.findFullWidthInfoForEvent(Q);if(Y)Z.column=Y.column}}else Z=$.getFocusedCellPosition();let X=this.findNextCellToFocusOn(Z,{backwards:z,startEditing:!1});if(X===!1)return null;if(X instanceof uQ)X.focusCell(!0);else if(X)return this.tryToFocusFullWidthRow(X,z);return T(X)}findNextCellToFocusOn($,{backwards:z,startEditing:Q,skipToNextEditableCell:J}){let Z=$,X=this.beans,{cellNavigation:Y,gos:q,focusSvc:G,rowRenderer:_}=X;while(!0){if($!==Z)$=Z;if(!z)Z=this.getLastCellOfColSpan(Z);Z=Y.getNextTabbedCell(Z,z);let H=q.getCallback("tabToNextCell");if(T(H)){let E=H({backwards:z,editing:Q,previousCellPosition:$,nextCellPosition:Z?Z:null});if(E===!0)Z=$;else if(E===!1)return!1;else Z={rowIndex:E.rowIndex,column:E.column,rowPinned:E.rowPinned}}if(!Z)return null;if(Z.rowIndex<0){let B=l0(X);return G.focusHeaderPosition({headerPosition:{headerRowIndex:B+Z.rowIndex,column:Z.column},fromCell:!0}),null}let U=q.get("editType")==="fullRow";if(Q&&(!U||J)){if(!this.isCellEditable(Z))continue}this.ensureCellVisible(Z);let W=e0(X,Z);if(!W){let B=_.getRowByPosition(Z);if(!B||!B.isFullWidth()||Q)continue;return{...B.getRowPosition(),column:Z?.column}}if(Y.isSuppressNavigable(W.column,W.rowNode))continue;return W.setFocusedCellPosition(Z),this.setRangeToCellIfSupported(Z),W}}isCellEditable($){let z=this.lookupRowNodeForCell($);if(z)return $.column.isCellEditable(z);return!1}lookupRowNodeForCell({rowIndex:$,rowPinned:z}){let{pinnedRowModel:Q,rowModel:J}=this.beans;if(z==="top")return Q?.getPinnedTopRow($);if(z==="bottom")return Q?.getPinnedBottomRow($);return J.getRow($)}navigateToNextCell($,z,Q,J){let Z=Q,X=!1,Y=this.beans,{cellNavigation:q,focusSvc:G,gos:_}=Y;while(Z&&(Z===Q||!this.isValidNavigateCell(Z))){if(_.get("enableRtl")){if(z===A.LEFT)Z=this.getLastCellOfColSpan(Z)}else if(z===A.RIGHT)Z=this.getLastCellOfColSpan(Z);Z=q.getNextCellToFocus(z,Z),X=n(Z)}if(X&&$&&$.key===A.UP)Z={rowIndex:-1,rowPinned:null,column:Q.column};if(J){let U=_.getCallback("navigateToNextCell");if(T(U)){let B=U({key:z,previousCellPosition:Q,nextCellPosition:Z?Z:null,event:$});if(T(B))Z={rowPinned:B.rowPinned,rowIndex:B.rowIndex,column:B.column};else Z=null}}if(!Z)return;if(Z.rowIndex<0){let U=l0(Y);G.focusHeaderPosition({headerPosition:{headerRowIndex:U+Z.rowIndex,column:Z.column??Q.column},event:$||void 0,fromCell:!0});return}let H=this.getNormalisedPosition(Z);if(H)this.focusPosition(H);else this.tryToFocusFullWidthRow(Z)}getNormalisedPosition($){if(!!this.beans.spannedRowRenderer?.getCellByPosition($))return $;this.ensureCellVisible($);let Q=e0(this.beans,$);if(!Q)return null;return $=Q.getFocusedCellPosition(),this.ensureCellVisible($),$}tryToFocusFullWidthRow($,z){let{visibleCols:Q,rowRenderer:J,focusSvc:Z,eventSvc:X}=this.beans,Y=Q.allCols;if(!J.getRowByPosition($)?.isFullWidth())return!1;let G=Z.getFocusedCell(),_={rowIndex:$.rowIndex,rowPinned:$.rowPinned,column:$.column||(z?b(Y):Y[0])};this.focusPosition(_);let H=z==null?G!=null&&G0(_,G):z;return X.dispatchEvent({type:"fullWidthRowFocused",rowIndex:_.rowIndex,rowPinned:_.rowPinned,column:_.column,isFullWidthCell:!0,fromBelow:H}),!0}focusPosition($){let{focusSvc:z}=this.beans;z.setFocusedCell({rowIndex:$.rowIndex,column:$.column,rowPinned:$.rowPinned,forceBrowserFocus:!0}),this.setRangeToCellIfSupported($)}setRangeToCellIfSupported($){if(v0($.column))return;this.beans.rangeSvc?.setRangeToCell($)}isValidNavigateCell($){return!!M0(this.beans,$)}getLastCellOfColSpan($){let z=e0(this.beans,$);if(!z)return $;let Q=z.getColSpanningList();if(Q.length===1)return $;return{rowIndex:$.rowIndex,column:b(Q),rowPinned:$.rowPinned}}ensureCellVisible($){let z=kQ(this.gos),Q=this.beans.rowModel.getRow($.rowIndex),J=z&&Q?.sticky,{scrollFeature:Z}=this.gridBodyCon;if(!J&&n($.rowPinned))Z.ensureIndexVisible($.rowIndex);if(!$.column.isPinned())Z.ensureColumnVisible($.column)}ensureColumnVisible($){let z=this.gridBodyCon.scrollFeature;if(!$.isPinned())z.ensureColumnVisible($)}ensureRowVisible($){this.gridBodyCon.scrollFeature.ensureIndexVisible($)}};function dZ($){return $.ctrlsSvc.getScrollFeature().getVScrollPosition()}var iz={moduleName:"KeyboardNavigation",version:p,beans:[nE,HE,AB],apiFunctions:{getFocusedCell:UE,clearFocusedCell:WE,setFocusedCell:BE,setFocusedHeader:LE,tabToNextCell:EE,tabToPreviousCell:KE}},dE=class extends S{constructor(){super(...arguments);this.beanName="pageBoundsListener"}postConstruct(){this.addManagedEventListeners({modelUpdated:this.onModelUpdated.bind(this),recalculateRowBounds:this.calculatePages.bind(this)}),this.onModelUpdated()}onModelUpdated($){this.calculatePages(),this.eventSvc.dispatchEvent({type:"paginationChanged",animate:$?.animate??!1,newData:$?.newData??!1,newPage:$?.newPage??!1,newPageSize:$?.newPageSize??!1,keepRenderedRows:$?.keepRenderedRows??!1})}calculatePages(){let{pageBounds:$,pagination:z,rowModel:Q}=this.beans;if(z)z.calculatePages();else $.calculateBounds(0,Q.getRowCount()-1)}},tE=class extends S{constructor(){super(...arguments);this.beanName="pageBounds",this.pixelOffset=0}getFirstRow(){return this.topRowBounds?.rowIndex??-1}getLastRow(){return this.bottomRowBounds?.rowIndex??-1}getCurrentPageHeight(){let{topRowBounds:$,bottomRowBounds:z}=this;if(!$||!z)return 0;return Math.max(z.rowTop+z.rowHeight-$.rowTop,0)}getCurrentPagePixelRange(){let{topRowBounds:$,bottomRowBounds:z}=this,Q=$?.rowTop??0,J=z?z.rowTop+z.rowHeight:0;return{pageFirstPixel:Q,pageLastPixel:J}}calculateBounds($,z){let{rowModel:Q}=this.beans,J=Q.getRowBounds($);if(J)J.rowIndex=$;this.topRowBounds=J;let Z=Q.getRowBounds(z);if(Z)Z.rowIndex=z;this.bottomRowBounds=Z,this.calculatePixelOffset()}getPixelOffset(){return this.pixelOffset}calculatePixelOffset(){let $=this.topRowBounds?.rowTop??0;if(this.pixelOffset===$)return;this.pixelOffset=$,this.eventSvc.dispatchEvent({type:"paginationPixelOffsetChanged"})}},sE=".ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top{min-width:0;overflow:hidden;position:relative}.ag-pinned-left-sticky-top,.ag-pinned-right-sticky-top{height:100%;overflow:hidden;position:relative}.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{height:100%;overflow:hidden;width:100%}.ag-pinned-left-header,.ag-pinned-right-header{display:inline-block;height:100%;overflow:hidden;position:relative}.ag-body-horizontal-scroll:not(.ag-scrollbar-invisible){.ag-horizontal-left-spacer:not(.ag-scroller-corner){border-right:var(--ag-pinned-column-border)}.ag-horizontal-right-spacer:not(.ag-scroller-corner){border-left:var(--ag-pinned-column-border)}}.ag-pinned-right-header{border-left:var(--ag-pinned-column-border)}.ag-pinned-left-header{border-right:var(--ag-pinned-column-border)}.ag-cell.ag-cell-first-right-pinned:not(.ag-cell-range-left,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-left:var(--ag-pinned-column-border)}.ag-cell.ag-cell-last-left-pinned:not(.ag-cell-range-right,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-right:var(--ag-pinned-column-border)}.ag-pinned-left-header .ag-header-cell-resize:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}.ag-pinned-right-header .ag-header-cell-resize:after{left:50%}.ag-pinned-left-header .ag-header-cell-resize{right:-3px}.ag-pinned-right-header .ag-header-cell-resize{left:-3px}",rE=class extends S{constructor($,z){super();this.isLeft=$,this.elements=z,this.getWidth=$?()=>this.beans.pinnedCols.leftWidth:()=>this.beans.pinnedCols.rightWidth}postConstruct(){this.addManagedEventListeners({[`${this.isLeft?"left":"right"}PinnedWidthChanged`]:this.onPinnedWidthChanged.bind(this)})}onPinnedWidthChanged(){let $=this.getWidth(),z=$>0;for(let Q of this.elements)if(Q)N(Q,z),f$(Q,$)}},lE=class extends S{constructor(){super(...arguments);this.beanName="pinnedCols"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCtrl=z.gridBodyCtrl});let $=this.checkContainerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:$,displayedColumnsWidthChanged:$}),this.addManagedPropertyListener("domLayout",$)}checkContainerWidths(){let{gos:$,visibleCols:z,eventSvc:Q}=this.beans,J=V0($,"print"),Z=J?0:z.getColsLeftWidth(),X=J?0:z.getDisplayedColumnsRightWidth();if(Z!=this.leftWidth)this.leftWidth=Z,Q.dispatchEvent({type:"leftPinnedWidthChanged"});if(X!=this.rightWidth)this.rightWidth=X,Q.dispatchEvent({type:"rightPinnedWidthChanged"})}keepPinnedColumnsNarrowerThanViewport(){let $=this.gridBodyCtrl.eBodyViewport,z=xz($);if(z<=50)return;let Q=this.getPinnedColumnsOverflowingViewport(z-50),J=this.gos.getCallback("processUnpinnedColumns"),{columns:Z,hasLockedPinned:X}=Q,Y=Z;if(!Y.length&&!X)return;if(J)Y=J({columns:Y,viewportWidth:z});if(!Y?.length)return;Y=Y.filter((q)=>!v0(q)),this.setColsPinned(Y,null,"viewportSizeFeature")}createPinnedWidthFeature($,...z){return new rE($,z)}setColsPinned($,z,Q){let{colModel:J,colAnimation:Z,visibleCols:X,gos:Y}=this.beans;if(!J.cols)return;if(!$?.length)return;if(V0(Y,"print")){j(37);return}Z?.start();let q;if(z===!0||z==="left")q="left";else if(z==="right")q="right";else q=null;let G=[];for(let _ of $){if(!_)continue;let H=J.getCol(_);if(!H)continue;if(H.getPinned()!==q)this.setColPinned(H,q),G.push(H)}if(G.length)X.refresh(Q),E8(this.eventSvc,G,Q);Z?.finish()}initCol($){let{pinned:z,initialPinned:Q}=$.colDef;if(z!==void 0)this.setColPinned($,z);else this.setColPinned($,Q)}setColPinned($,z){if(z===!0||z==="left")$.pinned="left";else if(z==="right")$.pinned="right";else $.pinned=null;$.dispatchStateUpdatedEvent("pinned")}setupHeaderPinnedWidth($){let{scrollVisibleSvc:z}=this.beans;if($.pinned==null)return;let Q=$.pinned==="left",J=$.pinned==="right";$.hidden=!0;let Z=()=>{let X=Q?this.leftWidth:this.rightWidth;if(X==null)return;let Y=X==0,q=$.hidden!==Y,G=this.gos.get("enableRtl"),_=z.getScrollbarWidth(),U=z.verticalScrollShowing&&(G&&Q||!G&&J)?X+_:X;if($.comp.setPinnedContainerWidth(`${U}px`),$.comp.setDisplayed(!Y),q)$.hidden=Y,$.refresh()};$.addManagedEventListeners({leftPinnedWidthChanged:Z,rightPinnedWidthChanged:Z,scrollVisibilityChanged:Z,scrollbarWidthChanged:Z})}getHeaderResizeDiff($,z){if(z.getPinned()){let{leftWidth:J,rightWidth:Z}=this,X=xz(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport)-50;if(J+Z+$>X)if(X>J+Z)$=X-J-Z;else return 0}return $}getPinnedColumnsOverflowingViewport($){let z=this.rightWidth??0,Q=this.leftWidth??0,J=z+Q,Z=!1;if(J<$)return{columns:[],hasLockedPinned:Z};let{visibleCols:X}=this.beans,Y=[...X.leftCols],q=[...X.rightCols],G=0,_=0,H=0,U=[],W=J-H-$;while((_0){if(G0){let B=Y[_++];if(B.colDef.lockPinned){Z=!0;continue}W-=B.getActualWidth(),U.push(B)}}return{columns:U,hasLockedPinned:Z}}},aE={moduleName:"PinnedColumn",version:p,beans:[lE],css:[sE]},oE=class extends R0{constructor(){super();this.beanName="ariaAnnounce",this.descriptionContainer=null,this.pendingAnnouncements=new Map,this.lastAnnouncement="",this.updateAnnouncement=g$(this,this.updateAnnouncement.bind(this),200)}postConstruct(){let $=this.beans,z=Y0($),Q=this.descriptionContainer=z.createElement("div");Q.classList.add("ag-aria-description-container"),k6(Q,"polite"),vY(Q,"additions text"),TY(Q,!0),$.eRootDiv.appendChild(Q)}announceValue($,z){this.pendingAnnouncements.set(z,$),this.updateAnnouncement()}updateAnnouncement(){if(!this.descriptionContainer)return;let $=Array.from(this.pendingAnnouncements.values()).join(". ");this.pendingAnnouncements.clear(),this.descriptionContainer.textContent="",setTimeout(()=>{this.handleAnnouncementUpdate($)},50)}handleAnnouncementUpdate($){if(!this.isAlive()||!this.descriptionContainer)return;let z=$;if(z==null||z.replace(/[ .]/g,"")==""){this.lastAnnouncement="";return}if(this.lastAnnouncement===z)z=`${z}​`;this.lastAnnouncement=z,this.descriptionContainer.textContent=z}destroy(){super.destroy();let{descriptionContainer:$}=this;if($)z0($),$.remove();this.descriptionContainer=null,this.pendingAnnouncements.clear()}},eE=class extends oE{},$3={moduleName:"Aria",version:p,beans:[eE]},z3=":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}",r5="ag-delay-render",Q3=class extends S{constructor(){super(...arguments);this.beanName="colDelayRenderSvc",this.hideRequested=!1,this.alreadyRevealed=!1,this.timesRetried=0,this.requesters=new Set}hideColumns($){if(this.alreadyRevealed||this.requesters.has($))return;if(this.requesters.add($),!this.hideRequested)this.beans.ctrlsSvc.whenReady(this,(z)=>{z.gridBodyCtrl.eGridBody.classList.add(r5)}),this.hideRequested=!0}revealColumns($){if(this.alreadyRevealed||!this.isAlive())return;if(this.requesters.delete($),this.requesters.size>0)return;let{renderStatus:z,ctrlsSvc:Q}=this.beans;if(z){if(!z.areHeaderCellsRendered()&&this.timesRetried<5){this.timesRetried++,setTimeout(()=>this.revealColumns($));return}this.timesRetried=0}Q.getGridBodyCtrl().eGridBody.classList.remove(r5),this.alreadyRevealed=!0}},J3={moduleName:"ColumnDelayRender",version:p,beans:[Q3],css:[z3]},iJ=class extends x{constructor(){super()}},Z3={tag:"div",cls:"ag-overlay-exporting-center",children:[{tag:"span",ref:"eExportingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eExportingText",cls:"ag-exporting-text"}]},X3=class extends iJ{constructor(){super(...arguments);this.eExportingIcon=f,this.eExportingText=f}init($){let{beans:z}=this;this.setTemplate(Z3);let Q=h("overlayExporting",z,null);if(Q)this.eExportingIcon.appendChild(Q);let J=$.exporting?.overlayText??this.getLocaleTextFunc()("exportingOoo","Exporting...");this.eExportingText.textContent=J,z.ariaAnnounce.announceValue(J,"overlay")}},Y3={tag:"div",cls:"ag-overlay-loading-center",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},q3=class extends iJ{constructor(){super(...arguments);this.eLoadingIcon=f,this.eLoadingText=f}init($){let{beans:z,gos:Q}=this,J=j$(Q.get("overlayLoadingTemplate")?.trim());if(this.setTemplate(J??Y3),!J){let Z=h("overlayLoading",z,null);if(Z)this.eLoadingIcon.appendChild(Z);let X=$.loading?.overlayText??this.getLocaleTextFunc()("loadingOoo","Loading...");this.eLoadingText.textContent=X,z.ariaAnnounce.announceValue(X,"overlay")}}},G3={tag:"span",cls:"ag-overlay-no-matching-rows-center"},_3=class extends iJ{init($){let{beans:z}=this;this.setTemplate(G3);let Q=$.noMatchingRows?.overlayText??this.getLocaleTextFunc()("noMatchingRows","No Matching Rows");this.getGui().textContent=Q,z.ariaAnnounce.announceValue(Q,"overlay")}},H3={tag:"span",cls:"ag-overlay-no-rows-center"},U3=class extends iJ{init($){let{beans:z,gos:Q}=this,J=j$(Q.get("overlayNoRowsTemplate")?.trim());if(this.setTemplate(J??H3),!J){let Z=$.noRows?.overlayText??this.getLocaleTextFunc()("noRowsToShow","No Rows To Show");this.getGui().textContent=Z,z.ariaAnnounce.announceValue(Z,"overlay")}}};function W3($){$.overlays?.showLoadingOverlay()}function B3($){$.overlays?.showNoRowsOverlay()}function E3($){$.overlays?.hideOverlay()}var K3=".ag-overlay{inset:0;pointer-events:none;position:absolute;z-index:2}.ag-overlay-panel,.ag-overlay-wrapper{display:flex;height:100%;width:100%}.ag-overlay-wrapper{align-items:center;flex:none;justify-content:center;text-align:center}.ag-overlay-exporting-wrapper,.ag-overlay-loading-wrapper,.ag-overlay-modal-wrapper{pointer-events:all}.ag-overlay-exporting-center,.ag-overlay-loading-center{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-popup-shadow);display:flex;padding:var(--ag-spacing)}",L3={tag:"div",cls:"ag-overlay",role:"presentation",children:[{tag:"div",cls:"ag-overlay-panel",role:"presentation",children:[{tag:"div",ref:"eOverlayWrapper",cls:"ag-overlay-wrapper",role:"presentation"}]}]},p8=class extends x{constructor(){super(L3);this.eOverlayWrapper=f,this.activeOverlay=null,this.activePromise=null,this.activeCssClass=null,this.elToFocusAfter=null,this.overlayExclusive=!1,this.oldWrapperPadding=null,this.registerCSS(K3)}handleKeyDown($){if($.key!==A.TAB||$.defaultPrevented||z$($))return;let{beans:z,eOverlayWrapper:Q}=this;if(Q&&j0(z,Q,!1,$.shiftKey))return;let Z=!1;if($.shiftKey)Z=z.focusSvc.focusGridView({column:b(z.visibleCols.allCols),backwards:!0,canFocusOverlay:!1});else Z=Z$(z,!1);if(Z)$.preventDefault()}updateLayoutClasses($,z){let Q=this.eOverlayWrapper;if(!Q)return;let J=Q.classList,{AUTO_HEIGHT:Z,NORMAL:X,PRINT:Y}=U$;J.toggle(Z,z.autoHeight),J.toggle(X,z.normal),J.toggle(Y,z.print)}postConstruct(){this.createManagedBean(new X4(this)),this.setDisplayed(!1,{skipAriaHidden:!0}),this.beans.overlays.setWrapperComp(this,!1),this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)}),this.addManagedEventListeners({gridSizeChanged:this.refreshWrapperPadding.bind(this)})}setWrapperTypeClass($){let z=this.eOverlayWrapper?.classList;if(!z){this.activeCssClass=null;return}if(this.activeCssClass)z.toggle(this.activeCssClass,!1);this.activeCssClass=$,z.toggle($,!0)}showOverlay($,z,Q){if(this.destroyActiveOverlay(),this.elToFocusAfter=null,this.activePromise=$,this.overlayExclusive=Q,!$)return this.refreshWrapperPadding(),g.resolve();if(this.setWrapperTypeClass(z),this.setDisplayed(!0,{skipAriaHidden:!0}),this.refreshWrapperPadding(),Q&&this.isGridFocused()){let J=d(this.beans);if(J&&!hz(this.beans))this.elToFocusAfter=J}return $.then((J)=>{let Z=this.eOverlayWrapper;if(!Z){this.destroyBean(J);return}if(this.activePromise!==$){if(this.activeOverlay!==J)this.destroyBean(J),J=null;return}if(this.activePromise=null,!J)return;if(this.activeOverlay!==J)Z.appendChild(J.getGui()),this.activeOverlay=J;if(Q&&this.isGridFocused())F0(Z)}),$}refreshWrapperPadding(){if(!this.eOverlayWrapper){this.oldWrapperPadding=null;return}let $=!!this.activeOverlay||!!this.activePromise,z=0;if($&&!this.overlayExclusive)z=this.beans.ctrlsSvc.get("gridHeaderCtrl")?.headerHeight||0;if(z!==this.oldWrapperPadding)this.oldWrapperPadding=z,this.eOverlayWrapper.style.setProperty("padding-top",`${z}px`)}destroyActiveOverlay(){this.activePromise=null;let $=this.activeOverlay;if(!$){this.overlayExclusive=!1,this.elToFocusAfter=null,this.refreshWrapperPadding();return}let z=this.elToFocusAfter;if(this.elToFocusAfter=null,this.activeOverlay=null,this.overlayExclusive=!1,z&&!this.isGridFocused())z=null;this.destroyBean($);let Q=this.eOverlayWrapper;if(Q)z0(Q);z?.focus?.({preventScroll:!0}),this.refreshWrapperPadding()}hideOverlay(){this.destroyActiveOverlay(),this.setDisplayed(!1,{skipAriaHidden:!0})}isGridFocused(){let $=d(this.beans);return!!$&&this.beans.eGridDiv.contains($)}destroy(){this.elToFocusAfter=null,this.destroyActiveOverlay(),this.beans.overlays.setWrapperComp(this,!0),super.destroy(),this.eOverlayWrapper=null}},D3={selector:"AG-OVERLAY-WRAPPER",component:p8},F3=["refresh"],F1=($)=>({name:$,optionalMethods:F3}),Oz={id:"agLoadingOverlay",overlayType:"loading",comp:F1("loadingOverlayComponent"),wrapperCls:"ag-overlay-loading-wrapper",exclusive:!0,compKey:"loadingOverlayComponent",paramsKey:"loadingOverlayComponentParams",isSuppressed:($)=>{let z=$.get("loading");return z===!1||$.get("suppressLoadingOverlay")===!0&&z!==!0}},YQ={id:"agNoRowsOverlay",overlayType:"noRows",comp:F1("noRowsOverlayComponent"),wrapperCls:"ag-overlay-no-rows-wrapper",compKey:"noRowsOverlayComponent",paramsKey:"noRowsOverlayComponentParams",isSuppressed:($)=>$.get("suppressNoRowsOverlay")},V4={id:"agNoMatchingRowsOverlay",overlayType:"noMatchingRows",comp:F1("noMatchingRowsOverlayComponent"),wrapperCls:"ag-overlay-no-matching-rows-wrapper"},BJ={id:"agExportingOverlay",overlayType:"exporting",comp:F1("exportingOverlayComponent"),wrapperCls:"ag-overlay-exporting-wrapper",exclusive:!0},l1={id:"activeOverlay",comp:F1("activeOverlay"),wrapperCls:"ag-overlay-modal-wrapper",exclusive:!0},M3=($)=>{if(!$)return null;return{agLoadingOverlay:Oz,agNoRowsOverlay:YQ,agNoMatchingRowsOverlay:V4,agExportingOverlay:BJ}[$]??l1},k3=($)=>{if(!$)return null;return{loading:Oz,noRows:YQ,noMatchingRows:V4,exporting:BJ}[$]},V3=class extends S{constructor(){super(...arguments);this.beanName="overlays",this.eWrapper=void 0,this.exclusive=!1,this.oldExclusive=!1,this.currentDef=null,this.showInitialOverlay=!0,this.userForcedNoRows=!1,this.exportsInProgress=0,this.newColumnsLoadedCleanup=null}postConstruct(){let $=this.gos;this.showInitialOverlay=o($);let z=()=>{if(this.userForcedNoRows)return;this.updateOverlay(!1)},[Q,J,Z,X]=this.addManagedEventListeners({newColumnsLoaded:z,rowCountReady:()=>{this.disableInitialOverlay(),z(),J()},rowDataUpdated:z,modelUpdated:z});this.newColumnsLoadedCleanup=Q,this.addManagedPropertyListeners(["loading","activeOverlay","activeOverlayParams","overlayComponentParams","loadingOverlayComponentParams","noRowsOverlayComponentParams"],(Y)=>this.onPropChange(new Set(Y.changeSet?.properties)))}destroy(){this.doHideOverlay(),super.destroy(),this.eWrapper=void 0}setWrapperComp($,z){if(!this.isAlive())return;if(!z)this.eWrapper=$;else if(this.eWrapper===$)this.eWrapper=void 0;this.updateOverlay(!1)}isVisible(){return!!this.currentDef}showLoadingOverlay(){this.showInitialOverlay=!1;let $=this.gos;if(!this.eWrapper||$.get("activeOverlay"))return;if(this.isDisabled(Oz))return;let z=$.get("loading");if(!z&&z!==void 0)return;this.doShowOverlay(Oz)}showNoRowsOverlay(){this.showInitialOverlay=!1;let $=this.gos;if(!this.eWrapper||$.get("activeOverlay")||$.get("loading")||this.isDisabled(YQ))return;this.userForcedNoRows=!0,this.doShowOverlay(YQ)}async showExportOverlay($){let{gos:z,beans:Q}=this;if(!this.eWrapper||z.get("activeOverlay")||z.get("loading")||this.isDisabled(BJ)||this.userForcedNoRows&&this.currentDef===YQ){$();return}let J=this.getDesiredDefWithOverride(BJ);if(!J){$();return}this.exportsInProgress++,this.focusedCell=Q.focusSvc.getFocusedCell(),await this.doShowOverlay(J),await new Promise((X)=>setTimeout(()=>X()));let Z=Date.now();try{$()}finally{let X=Date.now()-Z,Y=Math.max(0,300-X),q=()=>{if(this.exportsInProgress--,this.exportsInProgress===0)this.updateOverlay(!1),lG(Q,this.focusedCell),this.focusedCell=null};if(Y>0)setTimeout(()=>q(),Y);else q()}}hideOverlay(){let $=this.gos;this.showInitialOverlay=!1;let z=this.userForcedNoRows;if(this.userForcedNoRows=!1,$.get("loading")){j(99);return}if($.get("activeOverlay")){j(296);return}if(this.currentDef===V4){j(297);return}if(this.doHideOverlay(),z){if(this.getOverlayDef()!==YQ)this.updateOverlay(!1)}}getOverlayWrapperSelector(){return D3}getOverlayWrapperCompClass(){return p8}onPropChange($){let z=$.has("activeOverlay");if(z||$.has("loading")){if(this.updateOverlay(z))return}let Q=this.currentDef,J=this.eWrapper?.activeOverlay;if(J&&Q){let Z=$.has("activeOverlayParams");if(Q===l1){if(Z)J.refresh?.(this.makeCompParams(!0))}else{let X=Q.paramsKey;if($.has("overlayComponentParams")||X&&$.has(X))J.refresh?.(this.makeCompParams(!1,X,Q.overlayType))}}}updateOverlay($){let z=this.eWrapper;if(!z)return this.currentDef=null,!1;let Q=this.getDesiredDefWithOverride(),J=this.currentDef,Z=Q===l1&&$;if(Q!==J){if(!Q)return this.disableInitialOverlay(),this.doHideOverlay();return this.doShowOverlay(Q),!0}if(Z&&Q)return z.hideOverlay(),this.doShowOverlay(Q),!0;if(!Q)this.disableInitialOverlay();return!1}getDesiredDefWithOverride($){let{gos:z}=this,Q=M3(z.get("activeOverlay"));if(!Q){if(Q=$??this.getOverlayDef(),Q&&this.isDisabled(Q))Q=null}return Q}getOverlayDef(){let{gos:$,beans:z}=this,{rowModel:Q}=z,J=$.get("loading");if(J!==void 0){if(this.disableInitialOverlay(),J)return Oz}else if(this.showInitialOverlay){if(!this.isDisabled(Oz)&&(!$.get("columnDefs")||!$.get("rowData")))return Oz;this.disableInitialOverlay()}else this.disableInitialOverlay();let X=Q.getOverlayType();return k3(X)}disableInitialOverlay(){this.showInitialOverlay=!1,this.newColumnsLoadedCleanup?.(),this.newColumnsLoadedCleanup=null}doShowOverlay($){let{gos:z,beans:Q}=this,{userCompFactory:J}=Q;this.currentDef=$;let Z=$!==l1,X=!!$.exclusive;this.exclusive=X;let Y;if($.paramsKey&&z.get($.paramsKey)||$.compKey&&z.get($.compKey))Y=$.paramsKey;let q=void 0;if(Z){if(z.get("overlayComponent")||z.get("overlayComponentSelector"))q=J.getCompDetailsFromGridOptions({name:"overlayComponent",optionalMethods:["refresh"]},void 0,this.makeCompParams(!1,$.paramsKey,$.overlayType))}q??(q=J.getCompDetailsFromGridOptions($.comp,Z?$.id:void 0,this.makeCompParams(!Z,Y,$.overlayType),!1));let G=q?.newAgStackInstance()??null,_=this.eWrapper?this.eWrapper.showOverlay(G,$.wrapperCls,X):g.resolve();return this.eWrapper?.refreshWrapperPadding(),this.setExclusive(X),_}makeCompParams($,z,Q){let{gos:J}=this,Z=$?J.get("activeOverlayParams"):{...J.get("overlayComponentParams"),...z&&J.get(z)||null,overlayType:Q};return y(J,Z??{})}doHideOverlay(){let $=!1;if(this.currentDef)this.currentDef=null,$=!0;this.exclusive=!1;let z=this.eWrapper;if(z)z.hideOverlay(),z.refreshWrapperPadding(),this.setExclusive(!1);return $}setExclusive($){if(this.oldExclusive!==$)this.oldExclusive=$,this.eventSvc.dispatchEvent({type:"overlayExclusiveChanged"})}isDisabled($){let{gos:z}=this;return $.overlayType&&z.get("suppressOverlays")?.includes($.overlayType)||$.isSuppressed?.(z)===!0}},A3={moduleName:"Overlay",version:p,userComponents:{agLoadingOverlay:q3,agNoRowsOverlay:U3,agNoMatchingRowsOverlay:_3,agExportingOverlay:X3},apiFunctions:{showLoadingOverlay:W3,showNoRowsOverlay:B3,hideOverlay:E3},icons:{overlayLoading:"loading",overlayExporting:"loading"},beans:[V3]},S3=class extends S{constructor(){super(...arguments);this.beanName="rowContainerHeight",this.scrollY=0,this.uiBodyHeight=0}postConstruct(){this.addManagedEventListeners({bodyHeightChanged:this.updateOffset.bind(this)}),this.maxDivHeight=PG(),dQ(this.gos,"RowContainerHeightService - maxDivHeight = "+this.maxDivHeight)}updateOffset(){if(!this.stretching)return;let $=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top,z=this.getUiBodyHeight();if($!==this.scrollY||z!==this.uiBodyHeight)this.scrollY=$,this.uiBodyHeight=z,this.calculateOffset()}calculateOffset(){this.setUiContainerHeight(this.maxDivHeight),this.pixelsToShave=this.modelHeight-this.uiContainerHeight,this.maxScrollY=this.uiContainerHeight-this.uiBodyHeight;let $=this.scrollY/this.maxScrollY,z=$*this.pixelsToShave;dQ(this.gos,`RowContainerHeightService - Div Stretch Offset = ${z} (${this.pixelsToShave} * ${$})`),this.setDivStretchOffset(z)}setUiContainerHeight($){if($!==this.uiContainerHeight)this.uiContainerHeight=$,this.eventSvc.dispatchEvent({type:"rowContainerHeightChanged"})}clearOffset(){this.setUiContainerHeight(this.modelHeight),this.pixelsToShave=0,this.setDivStretchOffset(0)}setDivStretchOffset($){let z=typeof $==="number"?Math.floor($):null;if(this.divStretchOffset===z)return;this.divStretchOffset=z,this.eventSvc.dispatchEvent({type:"heightScaleChanged"})}setModelHeight($){if(this.modelHeight=$,this.stretching=$!=null&&this.maxDivHeight>0&&$>this.maxDivHeight,this.stretching)this.calculateOffset();else this.clearOffset()}getRealPixelPosition($){return $-this.divStretchOffset}getUiBodyHeight(){let $=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition();return $.bottom-$.top}getScrollPositionForPixel($){if(this.pixelsToShave<=0)return $;let z=this.modelHeight-this.getUiBodyHeight(),Q=$/z;return this.maxScrollY*Q}},R3=400,j3=class extends S{constructor(){super(...arguments);this.beanName="rowRenderer",this.destroyFuncsForColumnListeners=[],this.rowCtrlsByRowIndex={},this.zombieRowCtrls={},this.allRowCtrls=[],this.topRowCtrls=[],this.bottomRowCtrls=[],this.refreshInProgress=!1,this.dataFirstRenderedFired=!1,this.setupRangeSelectionListeners=()=>{let $=()=>{for(let X of this.getAllCellCtrls())X.onCellSelectionChanged()},z=()=>{for(let X of this.getAllCellCtrls())X.updateRangeBordersIfRangeCount()},Q=()=>{this.eventSvc.addListener("cellSelectionChanged",$),this.eventSvc.addListener("columnMoved",z),this.eventSvc.addListener("columnPinned",z),this.eventSvc.addListener("columnVisible",z)},J=()=>{this.eventSvc.removeListener("cellSelectionChanged",$),this.eventSvc.removeListener("columnMoved",z),this.eventSvc.removeListener("columnPinned",z),this.eventSvc.removeListener("columnVisible",z)};if(this.addDestroyFunc(()=>J()),this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(this.gos))Q();else J()}),u0(this.gos))Q()}}wireBeans($){this.pageBounds=$.pageBounds,this.colModel=$.colModel,this.pinnedRowModel=$.pinnedRowModel,this.rowModel=$.rowModel,this.focusSvc=$.focusSvc,this.rowContainerHeight=$.rowContainerHeight,this.ctrlsSvc=$.ctrlsSvc,this.editSvc=$.editSvc}postConstruct(){this.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCtrl=$.gridBodyCtrl,this.initialise()})}initialise(){this.addManagedEventListeners({paginationChanged:this.onPageLoaded.bind(this),pinnedRowDataChanged:this.onPinnedRowDataChanged.bind(this),pinnedRowsChanged:this.onPinnedRowsChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),bodyScroll:this.onBodyScroll.bind(this),bodyHeightChanged:this.redraw.bind(this,{})}),this.addManagedPropertyListeners(["domLayout","embedFullWidthRows"],()=>this.onDomLayoutChanged()),this.addManagedPropertyListeners(["suppressMaxRenderedRowRestriction","rowBuffer"],()=>this.redraw()),this.addManagedPropertyListener("suppressCellFocus",(J)=>this.onSuppressCellFocusChanged(J.currentValue)),this.addManagedPropertyListeners(["groupSuppressBlankHeader","getBusinessKeyForNode","fullWidthCellRenderer","fullWidthCellRendererParams","suppressStickyTotalRow","groupRowRenderer","groupRowRendererParams","loadingCellRenderer","loadingCellRendererParams","detailCellRenderer","detailCellRendererParams","enableRangeSelection","enableCellTextSelection"],()=>this.redrawRows()),this.addManagedPropertyListener("cellSelection",({currentValue:J,previousValue:Z})=>{if(!Z&&J||Z&&!J)this.redrawRows()});let{stickyRowSvc:$,gos:z,showRowGroupCols:Q}=this.beans;if(Q)this.addManagedPropertyListener("showOpenedGroup",()=>{let J=Q.columns;if(J.length)this.refreshCells({columns:J,force:!0})});if($)this.stickyRowFeature=$.createStickyRowFeature(this,this.createRowCon.bind(this),this.destroyRowCtrls.bind(this));else{let J=this.gridBodyCtrl;J.setStickyTopHeight(0),J.setStickyBottomHeight(0)}this.registerCellEventListeners(),this.initialiseCache(),this.printLayout=V0(z,"print"),this.embedFullWidthRows=this.printLayout||z.get("embedFullWidthRows"),this.redrawAfterModelUpdate()}initialiseCache(){if(this.gos.get("keepDetailRows")){let $=this.getKeepDetailRowsCount(),z=$!=null?$:3;this.cachedRowCtrls=new f3(z)}}getKeepDetailRowsCount(){return this.gos.get("keepDetailRowsCount")}getStickyTopRowCtrls(){return this.stickyRowFeature?.stickyTopRowCtrls??[]}getStickyBottomRowCtrls(){return this.stickyRowFeature?.stickyBottomRowCtrls??[]}updateAllRowCtrls(){let $=Object.values(this.rowCtrlsByRowIndex),z=Object.values(this.zombieRowCtrls),Q=this.cachedRowCtrls?.getEntries()??[];if(z.length>0||Q.length>0)this.allRowCtrls=[...$,...z,...Q];else this.allRowCtrls=$}isCellBeingRendered($,z){let Q=this.rowCtrlsByRowIndex[$];if(!z||!Q)return!!Q;if(Q.isFullWidth())return!0;return!!this.beans.spannedRowRenderer?.getCellByPosition({rowIndex:$,column:z,rowPinned:null})||!!Q.getCellCtrl(z)||!Q.isRowRendered()}updateCellFocus($){for(let z of this.getAllCellCtrls())z.onCellFocused($);for(let z of this.getFullWidthRowCtrls())z.onFullWidthRowFocused($)}onCellFocusChanged($){if($?.rowIndex!=null&&!$.rowPinned){let z=this.beans.colModel.getCol($.column)??void 0;if(!this.isCellBeingRendered($.rowIndex,z))this.redraw()}this.updateCellFocus($)}onSuppressCellFocusChanged($){for(let z of this.getAllCellCtrls())z.onSuppressCellFocusChanged($);for(let z of this.getFullWidthRowCtrls())z.onSuppressCellFocusChanged($)}registerCellEventListeners(){this.addManagedEventListeners({cellFocused:($)=>this.onCellFocusChanged($),cellFocusCleared:()=>this.updateCellFocus(),flashCells:($)=>{let{cellFlashSvc:z}=this.beans;if(z)for(let Q of this.getAllCellCtrls())z.onFlashCells(Q,$)},columnHoverChanged:()=>{for(let $ of this.getAllCellCtrls())$.onColumnHover()},displayedColumnsChanged:()=>{for(let $ of this.getAllCellCtrls())$.onDisplayedColumnsChanged()},displayedColumnsWidthChanged:()=>{if(this.printLayout)for(let $ of this.getAllCellCtrls())$.onLeftChanged()}}),this.setupRangeSelectionListeners(),this.refreshListenersToColumnsForCellComps(),this.addManagedEventListeners({gridColumnsChanged:this.refreshListenersToColumnsForCellComps.bind(this)}),this.addDestroyFunc(this.removeGridColumnListeners.bind(this))}removeGridColumnListeners(){for(let $ of this.destroyFuncsForColumnListeners)$();this.destroyFuncsForColumnListeners.length=0}refreshListenersToColumnsForCellComps(){this.removeGridColumnListeners();let $=this.colModel.getCols();for(let z of $){let Q=(G)=>{for(let _ of this.getAllCellCtrls())if(_.column===z)G(_)},J=()=>{Q((G)=>G.onLeftChanged())},Z=()=>{Q((G)=>G.onWidthChanged())},X=()=>{Q((G)=>G.onFirstRightPinnedChanged())},Y=()=>{Q((G)=>G.onLastLeftPinnedChanged())},q=()=>{Q((G)=>G.onColDefChanged())};z.__addEventListener("leftChanged",J),z.__addEventListener("widthChanged",Z),z.__addEventListener("firstRightPinnedChanged",X),z.__addEventListener("lastLeftPinnedChanged",Y),z.__addEventListener("colDefChanged",q),this.destroyFuncsForColumnListeners.push(()=>{z.__removeEventListener("leftChanged",J),z.__removeEventListener("widthChanged",Z),z.__removeEventListener("firstRightPinnedChanged",X),z.__removeEventListener("lastLeftPinnedChanged",Y),z.__removeEventListener("colDefChanged",q)})}}onDomLayoutChanged(){let $=V0(this.gos,"print"),z=$||this.gos.get("embedFullWidthRows"),Q=z!==this.embedFullWidthRows||this.printLayout!==$;if(this.printLayout=$,this.embedFullWidthRows=z,Q)this.redrawAfterModelUpdate({domLayoutChanged:!0})}datasourceChanged(){this.firstRenderedRow=0,this.lastRenderedRow=-1;let $=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls($)}onPageLoaded($){let z={recycleRows:$.keepRenderedRows,animate:$.animate,newData:$.newData,newPage:$.newPage,onlyBody:!0};this.redrawAfterModelUpdate(z)}getAllCellsNotSpanningForColumn($){let z=[];for(let Q of this.getAllRowCtrls()){let J=Q.getCellCtrl($,!0)?.eGui;if(J)z.push(J)}return z}refreshFloatingRowComps($=!0){this.refreshFloatingRows(this.topRowCtrls,"top",$),this.refreshFloatingRows(this.bottomRowCtrls,"bottom",$)}refreshFloatingRows($,z,Q){let{pinnedRowModel:J,beans:Z,printLayout:X}=this,Y=Object.fromEntries($.map((G)=>[G.rowNode.id,G]));J?.forEachPinnedRow(z,(G,_)=>{let H=$[_];if(H&&J.getPinnedRowById(H.rowNode.id,z)===void 0)H.destroyFirstPass(),H.destroySecondPass();if(G.id in Y&&Q)$[_]=Y[G.id],delete Y[G.id];else $[_]=new L2(G,Z,!1,!1,X)});let q=(z==="top"?J?.getPinnedTopRowCount():J?.getPinnedBottomRowCount())??0;$.length=q}onPinnedRowDataChanged(){let $={recycleRows:!0};this.redrawAfterModelUpdate($)}onPinnedRowsChanged(){this.redrawAfterModelUpdate({recycleRows:!0})}redrawRow($,z=!1){if($.sticky)this.stickyRowFeature?.refreshStickyNode($);else if(this.cachedRowCtrls?.has($)){this.cachedRowCtrls.removeRow($);return}else{let Q=(J)=>{let Z=J[$.rowIndex];if(!Z)return;if(Z.rowNode!==$)return;Z.destroyFirstPass(),Z.destroySecondPass(),J[$.rowIndex]=this.createRowCon($,!1,!1)};switch($.rowPinned){case"top":Q(this.topRowCtrls);break;case"bottom":Q(this.bottomRowCtrls);break;default:Q(this.rowCtrlsByRowIndex),this.updateAllRowCtrls()}}if(!z)this.dispatchDisplayedRowsChanged(!1)}redrawRows($){let{editSvc:z}=this.beans;if(z?.isEditing())if(z.isBatchEditing())z.cleanupEditors();else z.stopEditing(void 0,{source:"api"});if($!=null){for(let J of $??[])this.redrawRow(J,!0);this.dispatchDisplayedRowsChanged(!1);return}this.redrawAfterModelUpdate()}redrawAfterModelUpdate($={}){this.getLockOnRefresh();let z=this.beans.focusSvc?.getFocusCellToUseAfterRefresh();this.updateContainerHeights(),this.scrollToTopIfNewData($);let Q=!$.domLayoutChanged&&!!$.recycleRows,J=$.animate&&HQ(this.gos),Z=Q?this.getRowsToRecycle():null;if(!Q)this.removeAllRowComps();this.workOutFirstAndLastRowsToRender();let{stickyRowFeature:X,gos:Y}=this;if(X){X.checkStickyRows();let q=X.extraTopHeight+X.extraBottomHeight;if(q)this.updateContainerHeights(q)}if(this.recycleRows(Z,J),this.gridBodyCtrl.updateRowCount(),!$.onlyBody)this.refreshFloatingRowComps(Y.get("enableRowPinning")?Q:void 0);if(this.dispatchDisplayedRowsChanged(),z!=null)this.restoreFocusedCell(z);this.releaseLockOnRefresh()}scrollToTopIfNewData($){let z=$.newData||$.newPage,Q=this.gos.get("suppressScrollOnNewData");if(z&&!Q)this.gridBodyCtrl.scrollFeature.scrollToTop(),this.stickyRowFeature?.resetOffsets()}updateContainerHeights($=0){let{rowContainerHeight:z}=this;if(this.printLayout){z.setModelHeight(null);return}let Q=this.pageBounds.getCurrentPageHeight();if(Q===0)Q=1;z.setModelHeight(Q+$)}getLockOnRefresh(){if(this.refreshInProgress)throw Error($$(252));this.refreshInProgress=!0,this.beans.frameworkOverrides.getLockOnRefresh?.()}releaseLockOnRefresh(){this.refreshInProgress=!1,this.beans.frameworkOverrides.releaseLockOnRefresh?.()}isRefreshInProgress(){return this.refreshInProgress}restoreFocusedCell($){if(!$)return;let z=this.beans.focusSvc,Q=this.findPositionToFocus($);if(!Q){z.focusHeaderPosition({headerPosition:{headerRowIndex:l0(this.beans)-1,column:$.column}});return}if($.rowIndex!==Q.rowIndex||$.rowPinned!=Q.rowPinned){z.setFocusedCell({...Q,preventScrollOnBrowserFocus:!0,forceBrowserFocus:!0});return}if(!z.doesRowOrCellHaveBrowserFocus())this.updateCellFocus(y(this.gos,{...Q,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,type:"cellFocused"}))}findPositionToFocus($){let{pagination:z,pageBounds:Q}=this.beans,J=$;if(J.rowPinned==null&&z&&Q&&!z.isRowInPage(J.rowIndex))J={rowPinned:null,rowIndex:Q.getFirstRow()};while(J){if(J.rowPinned==null&&Q){if(J.rowIndexQ.getLastRow())J={rowPinned:null,rowIndex:Q.getLastRow()}}let Z=this.getRowByPosition(J);if(Z?.isAlive())return{...Z.getRowPosition(),column:$.column};J=m0(this.beans,J)}return null}getAllCellCtrls(){let $=[],z=this.getAllRowCtrls(),Q=z.length;for(let J=0;J{let Z=J.rowNode;return a5(Z,z)})}getCellCtrls($,z){let Q;if(T(z))Q={},z.forEach((Z)=>{let X=this.colModel.getCol(Z);if(T(X))Q[X.getId()]=!0});let J=[];for(let Z of this.getRowCtrls($))for(let X of Z.getAllCellCtrls()){let Y=X.column.getId();if(Q&&!Q[Y])continue;J.push(X)}return J}destroy(){this.removeAllRowComps(!0),super.destroy()}removeAllRowComps($=!1){let z=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(z,$),this.stickyRowFeature?.destroyStickyCtrls()}getRowsToRecycle(){let $=[];for(let Q of Object.keys(this.rowCtrlsByRowIndex))if(this.rowCtrlsByRowIndex[Q].rowNode.id==null)$.push(Q);this.removeRowCtrls($);let z={};for(let Q of Object.values(this.rowCtrlsByRowIndex)){let J=Q.rowNode;z[J.id]=Q}return this.rowCtrlsByRowIndex={},z}removeRowCtrls($,z=!1){for(let Q of $){let J=this.rowCtrlsByRowIndex[Q];if(J)J.destroyFirstPass(z),J.destroySecondPass();delete this.rowCtrlsByRowIndex[Q]}}onBodyScroll($){if($.direction!=="vertical")return;this.redraw({afterScroll:!0})}redraw($={}){let{focusSvc:z,animationFrameSvc:Q}=this.beans,{afterScroll:J}=$,Z,X=this.stickyRowFeature;if(X)Z=z?.getFocusCellToUseAfterRefresh()||void 0;let Y=this.firstRenderedRow,q=this.lastRenderedRow;this.workOutFirstAndLastRowsToRender();let G=!1;if(X){G=X.checkStickyRows();let H=X.extraTopHeight+X.extraBottomHeight;if(H)this.updateContainerHeights(H)}let _=this.firstRenderedRow!==Y||this.lastRenderedRow!==q;if(J&&!G&&!_)return;if(this.getLockOnRefresh(),this.recycleRows(null,!1,J),this.releaseLockOnRefresh(),this.dispatchDisplayedRowsChanged(J&&!G),Z!=null){let H=z?.getFocusCellToUseAfterRefresh();if(Z!=null&&H==null)Q?.flushAllFrames(),this.restoreFocusedCell(Z)}}removeRowCompsNotToDraw($,z){let Q={};for(let X of $)Q[X]=!0;let Z=Object.keys(this.rowCtrlsByRowIndex).filter((X)=>!Q[X]);this.removeRowCtrls(Z,z)}calculateIndexesToDraw($){let z=[];for(let Y=this.firstRenderedRow;Y<=this.lastRenderedRow;Y++)z.push(Y);let Q=this.beans.pagination,J=this.beans.focusSvc?.getFocusedCell()?.rowIndex;if(J!=null&&(Jthis.lastRenderedRow)&&(!Q||Q.isRowInPage(J))&&J{let q=Y.rowNode.rowIndex;if(q==null||q===J)return;if(qthis.lastRenderedRow){if(this.doNotUnVirtualiseRow(Y))z.push(q)}};for(let Y of Object.values(this.rowCtrlsByRowIndex))Z(Y);if($)for(let Y of Object.values($))Z(Y);z.sort((Y,q)=>Y-q);let X=[];for(let Y=0;Y{this.destroyRowCtrls($,z),this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()});else this.destroyRowCtrls($,z)}this.updateAllRowCtrls()}dispatchDisplayedRowsChanged($=!1){this.eventSvc.dispatchEvent({type:"displayedRowsChanged",afterScroll:$})}onDisplayedColumnsChanged(){let{visibleCols:$}=this.beans,z=$.isPinningLeft(),Q=$.isPinningRight();if(this.pinningLeft!==z||Q!==this.pinningRight){if(this.pinningLeft=z,this.pinningRight=Q,this.embedFullWidthRows)this.redrawFullWidthEmbeddedRows()}}redrawFullWidthEmbeddedRows(){let $=[];for(let z of this.getFullWidthRowCtrls()){let Q=z.rowNode.rowIndex;$.push(Q.toString())}this.refreshFloatingRowComps(),this.removeRowCtrls($),this.redraw({afterScroll:!0})}getFullWidthRowCtrls($){let z=l5($);return this.getAllRowCtrls().filter((Q)=>{if(!Q.isFullWidth())return!1;let J=Q.rowNode;if(z!=null&&!a5(J,z))return!1;return!0})}createOrUpdateRowCtrl($,z,Q,J){let Z,X=this.rowCtrlsByRowIndex[$];if(!X){if(Z=this.rowModel.getRow($),T(Z)&&T(z)&&z[Z.id]&&Z.alreadyRendered)X=z[Z.id],z[Z.id]=null}if(!X){if(!Z)Z=this.rowModel.getRow($);if(T(Z))X=this.createRowCon(Z,Q,J);else return}if(Z)Z.alreadyRendered=!0;this.rowCtrlsByRowIndex[$]=X}destroyRowCtrls($,z){let Q=[];if($)for(let J of Object.values($)){if(!J)continue;if(this.cachedRowCtrls&&J.isCacheable()){this.cachedRowCtrls.addRow(J);continue}if(J.destroyFirstPass(!z),z){let Z=J.instanceId;this.zombieRowCtrls[Z]=J,Q.push(()=>{J.destroySecondPass(),delete this.zombieRowCtrls[Z]})}else J.destroySecondPass()}if(z)Q.push(()=>{if(this.isAlive())this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()}),window.setTimeout(()=>{for(let J of Q)J()},R3)}getRowBuffer(){return this.gos.get("rowBuffer")}getRowBufferInPixels(){let $=this.getRowBuffer(),z=z7(this.beans);return $*z}workOutFirstAndLastRowsToRender(){let{rowContainerHeight:$,pageBounds:z,rowModel:Q}=this;$.updateOffset();let J,Z;if(!Q.isRowsToRender())J=0,Z=-1;else if(this.printLayout)this.beans.environment.refreshRowHeightVariable(),J=z.getFirstRow(),Z=z.getLastRow();else{let H=this.getRowBufferInPixels(),U=this.ctrlsSvc.getScrollFeature(),W=this.gos.get("suppressRowVirtualisation"),B=!1,E,K;do{let k=z.getPixelOffset(),{pageFirstPixel:V,pageLastPixel:R}=z.getCurrentPagePixelRange(),O=$.divStretchOffset,I=U.getVScrollPosition(),v=I.top,C=I.bottom;if(W)E=V+O,K=R+O;else E=Math.max(v+k-H,V)+O,K=Math.min(C+k+H,R)+O;this.firstVisibleVPixel=Math.max(v+k,V)+O,this.lastVisibleVPixel=Math.min(C+k,R)+O,B=this.ensureAllRowsInRangeHaveHeightsCalculated(E,K)}while(B);let L=Q.getRowIndexAtPixel(E),D=Q.getRowIndexAtPixel(K),F=z.getFirstRow(),M=z.getLastRow();if(LM)D=M;J=L,Z=D}let X=V0(this.gos,"normal"),Y=this.gos.get("suppressMaxRenderedRowRestriction"),q=Math.max(this.getRowBuffer(),500);if(X&&!Y){if(Z-J>q)Z=J+q}let G=J!==this.firstRenderedRow,_=Z!==this.lastRenderedRow;if(G||_)this.firstRenderedRow=J,this.lastRenderedRow=Z,this.eventSvc.dispatchEvent({type:"viewportChanged",firstRow:J,lastRow:Z})}dispatchFirstDataRenderedEvent(){if(this.dataFirstRenderedFired)return;this.dataFirstRenderedFired=!0,Y$(this.beans,()=>{this.beans.eventSvc.dispatchEvent({type:"firstDataRendered",firstRow:this.firstRenderedRow,lastRow:this.lastRenderedRow})})}ensureAllRowsInRangeHaveHeightsCalculated($,z){let Q=this.pinnedRowModel?.ensureRowHeightsValid(),J=this.stickyRowFeature?.ensureRowHeightsValid(),{pageBounds:Z,rowModel:X}=this,Y=X.ensureRowHeightsValid($,z,Z.getFirstRow(),Z.getLastRow());if(Y||J)this.eventSvc.dispatchEvent({type:"recalculateRowBounds"});if(J||Y||Q)return this.updateContainerHeights(),!0;return!1}doNotUnVirtualiseRow($){let J=$.rowNode,Z=this.focusSvc.isRowFocused(J.rowIndex,J.rowPinned),X=this.editSvc?.isEditing($),Y=J.detail;if(!(Z||X||Y))return!1;return this.isRowPresent(J)?!0:!1}isRowPresent($){if(!this.rowModel.isRowPresent($))return!1;return this.beans.pagination?.isRowInPage($.rowIndex)??!0}createRowCon($,z,Q){let J=this.cachedRowCtrls?.getRow($)??null;if(J)return J;let Z=Q&&!this.printLayout&&!!this.beans.animationFrameSvc?.active;return new L2($,this.beans,z,Z,this.printLayout)}getRenderedNodes(){let $=Object.values(this.rowCtrlsByRowIndex).map((J)=>J.rowNode),z=this.getStickyTopRowCtrls().map((J)=>J.rowNode),Q=this.getStickyBottomRowCtrls().map((J)=>J.rowNode);return[...z,...$,...Q]}getRowByPosition($){let z,{rowIndex:Q}=$;switch($.rowPinned){case"top":z=this.topRowCtrls[Q];break;case"bottom":z=this.bottomRowCtrls[Q];break;default:if(z=this.rowCtrlsByRowIndex[Q],!z){if(z=this.getStickyTopRowCtrls().find((J)=>J.rowNode.rowIndex===Q)||null,!z)z=this.getStickyBottomRowCtrls().find((J)=>J.rowNode.rowIndex===Q)||null}break}return z}isRangeInRenderedViewport($,z){if($==null||z==null)return!1;let J=$>this.lastRenderedRow;return!(zthis.maxCount){let z=this.entriesList[0];z.destroyFirstPass(),z.destroySecondPass(),this.removeFromCache(z)}}getRow($){if($?.id==null)return null;let z=this.entriesMap[$.id];if(!z)return null;return this.removeFromCache(z),z.setCached(!1),z.rowNode!=$?null:z}has($){return this.entriesMap[$.id]!=null}removeRow($){let z=$.id,Q=this.entriesMap[z];delete this.entriesMap[z],Z0(this.entriesList,Q)}removeFromCache($){let z=$.rowNode.id;delete this.entriesMap[z],Z0(this.entriesList,$)}getEntries(){return this.entriesList}};function l5($){if(!$)return;let z={top:{},bottom:{},normal:{}};for(let Q of $){let J=Q.id;switch(Q.rowPinned){case"top":z.top[J]=Q;break;case"bottom":z.bottom[J]=Q;break;default:z.normal[J]=Q;break}}return z}function a5($,z){let Q=$.id;switch($.rowPinned){case"top":return z.top[Q]!=null;case"bottom":return z.bottom[Q]!=null;default:return z.normal[Q]!=null}}var O3=class extends S{constructor(){super(...arguments);this.beanName="rowNodeSorter",this.accentedSort=!1,this.primaryColumnsSortGroups=!1,this.pivotActive=!1}postConstruct(){this.firstLeaf=o(this.gos)?pz:P3,this.addManagedPropertyListeners(["accentedSort","autoGroupColumnDef","treeData"],this.updateOptions.bind(this));let $=this.updatePivotModeState.bind(this);this.addManagedEventListeners({columnPivotModeChanged:$,columnPivotChanged:$}),this.updateOptions(),$()}updateOptions(){this.accentedSort=!!this.gos.get("accentedSort"),this.primaryColumnsSortGroups=W$(this.gos)}updatePivotModeState(){this.pivotActive=this.beans.colModel.isPivotActive()}doFullSortInPlace($,z){return $.sort((Q,J)=>this.compareRowNodes(z,Q,J))}compareRowNodes($,z,Q){if(z===Q)return 0;let J=this.accentedSort;for(let Z=0,X=$.length;Z{if($.data)return $;let z=$.childrenAfterGroup;while(z?.length){let Q=z[0];if(Q.data)return Q;z=Q.childrenAfterGroup}},o5=($)=>{if(!$)return $;if(typeof $==="bigint")return $<0n?-$:$;let z=Number($);return isNaN(z)?$:Math.abs(z)};function T3($){$.sortSvc?.onSortChanged("api")}var Rz=($,z)=>({tag:"span",ref:`eSort${$}`,cls:`ag-sort-indicator-icon ag-sort-${z} ag-hidden`,attrs:{"aria-hidden":"true"}}),v3={tag:"span",cls:"ag-sort-indicator-container",children:[Rz("Order","order"),Rz("Asc","ascending-icon"),Rz("Desc","descending-icon"),Rz("Mixed","mixed-icon"),Rz("AbsoluteAsc","absolute-ascending-icon"),Rz("AbsoluteDesc","absolute-descending-icon"),Rz("None","none-icon")]},A4=class extends x{constructor($){super();if(this.eSortOrder=f,this.eSortAsc=f,this.eSortDesc=f,this.eSortMixed=f,this.eSortNone=f,this.eSortAbsoluteAsc=f,this.eSortAbsoluteDesc=f,!$)this.setTemplate(v3)}attachCustomElements($,z,Q,J,Z,X,Y){this.eSortOrder=$,this.eSortAsc=z,this.eSortDesc=Q,this.eSortMixed=J,this.eSortNone=Z,this.eSortAbsoluteAsc=X,this.eSortAbsoluteDesc=Y}setupSort($,z=!1,Q){if(this.column=$,this.suppressOrder=z,this.getSortDefOverride=Q,this.setupMultiSortIndicator(),!$.isSortable()&&!$.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,$),this.addInIcon("sortDescending",this.eSortDesc,$),this.addInIcon("sortUnSort",this.eSortNone,$),this.addInIcon("sortAbsoluteAscending",this.eSortAbsoluteAsc,$),this.addInIcon("sortAbsoluteDescending",this.eSortAbsoluteDesc,$);let J=this.updateIcons.bind(this),Z=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",J),this.addManagedEventListeners({newColumnsLoaded:J,sortChanged:Z,columnRowGroupChanged:Z}),this.onSortChanged()}addInIcon($,z,Q){if(z==null)return;let J=h($,this.beans,Q);if(J)z.appendChild(J)}onSortChanged(){if(this.updateIcons(),!this.suppressOrder)this.updateSortOrder()}updateIcons(){let{eSortAsc:$,eSortDesc:z,eSortAbsoluteAsc:Q,eSortAbsoluteDesc:J,eSortNone:Z,column:X,gos:Y,beans:q}=this,G=u2(X,q,this.getSortDefOverride),_=G.isDefaultSortAllowed,H=G.isAbsoluteSortAllowed,{isAbsoluteSort:U,isDefaultSort:W,isAscending:B,isDescending:E,direction:K}=G;if($)N($,B&&W&&_,{skipAriaHidden:!0});if(z)N(z,E&&W&&_,{skipAriaHidden:!0});if(Z){let L=!X.getColDef().unSortIcon&&!Y.get("unSortIcon");N(Z,!L&&!K,{skipAriaHidden:!0})}if(Q)N(Q,B&&U&&H,{skipAriaHidden:!0});if(J)N(J,E&&U&&H,{skipAriaHidden:!0})}setupMultiSortIndicator(){let{eSortMixed:$,column:z,gos:Q}=this;this.addInIcon("sortUnSort",$,z);let J=z.getColDef().showRowGroup;if(W$(Q)&&J)this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator()}updateMultiSortIndicator(){let{eSortMixed:$,beans:z,column:Q}=this;if($){let J=z.sortSvc.getDisplaySortForColumn(Q)?.direction==="mixed";N($,J,{skipAriaHidden:!0})}}updateSortOrder(){let{eSortOrder:$,column:z,beans:{sortSvc:Q}}=this;if(!$)return;let J=Q.getColumnsWithSortingOrdered(),Z=Q.getDisplaySortIndexForColumn(z)??-1,X=J.some((q)=>Q.getDisplaySortIndexForColumn(q)??!1),Y=Z>=0&&X;if(N($,Y,{skipAriaHidden:!0}),Z>=0)$.textContent=(Z+1).toString();else z0($)}refresh(){this.onSortChanged()}},I3={selector:"AG-SORT-INDICATOR",component:A4},C3=class extends S{constructor(){super(...arguments);this.beanName="sortSvc"}progressSort($,z,Q){let J=this.getNextSortDirection($);this.setSortForColumn($,J,z,Q)}progressSortFromEvent($,z){let J=this.gos.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey;this.progressSort($,J,"uiColumnSorted")}setSortForColumn($,z,Q,J){let{gos:Z,showRowGroupCols:X}=this.beans,Y=W$(Z),q=[$];if(Y){if($.getColDef().showRowGroup){let U=X?.getSourceColumnsForGroupColumn?.($)?.filter((W)=>W.isSortable());if(U)q=[$,...U]}}for(let H of q)this.setColSort(H,z,J);let G=(Q||Z.get("alwaysMultiSort"))&&!Z.get("suppressMultiSort"),_=[];if(!G){let H=this.clearSortBarTheseColumns(q,J);_.push(...H)}this.updateSortIndex($),_.push(...q),this.dispatchSortChangedEvents(J,_)}updateSortIndex($){let{gos:z,colModel:Q,showRowGroupCols:J}=this.beans,Z=W$(z),X=J?.getShowRowGroupCol($.getId()),Y=Z?X||$:$,q=this.getColumnsWithSortingOrdered();Q.forAllCols((H)=>this.setColSortIndex(H,null));let G=q.filter((H)=>{if(Z&&H.getColDef().showRowGroup)return!1;return H!==Y});(Y.getSortDef()?[...G,Y]:G).forEach((H,U)=>this.setColSortIndex(H,U))}onSortChanged($,z){this.dispatchSortChangedEvents($,z)}isSortActive(){let $=!1;return this.beans.colModel.forAllCols((z)=>{if(z.getSortDef())return $=!0,!0}),$}dispatchSortChangedEvents($,z){let Q={type:"sortChanged",source:$};if(z)Q.columns=z;this.eventSvc.dispatchEvent(Q)}clearSortBarTheseColumns($,z){let Q=[];return this.beans.colModel.forAllCols((J)=>{if(!$.includes(J)){if(J.getSortDef())Q.push(J);this.setColSort(J,void 0,z)}}),Q}getNextSortDirection($,z){let Q=$.getSortingOrder(),J=z===void 0?$.getSortDef():a0(z),X=Q.findIndex((Y)=>d1(Y,J))+1;if(X>=Q.length)X=0;return a0(Q[X])}getIndexedSortMap(){let{gos:$,colModel:z,showRowGroupCols:Q,rowGroupColsSvc:J}=this.beans,Z=[];if(z.forAllCols((_)=>{if(_.getSortDef())Z.push(_)}),z.isPivotMode()){let _=W$($);Z=Z.filter((H)=>{let U=!!H.getAggFunc(),W=!H.isPrimary(),B=_?Q?.getShowRowGroupCol(H.getId()):H.getColDef().showRowGroup;return U||W||B})}let X=J?.columns.filter((_)=>!!_.getSortDef())??[],Y={};Z.forEach((_,H)=>Y[_.getId()]=H),Z.sort((_,H)=>{let U=_.getSortIndex(),W=H.getSortIndex();if(U!=null&&W!=null)return U-W;else if(U==null&&W==null){let B=Y[_.getId()],E=Y[H.getId()];return B>E?1:-1}else if(W==null)return-1;else return 1});let q=W$($)&&!!X.length;if(q)Z=[...new Set(Z.map((_)=>Q?.getShowRowGroupCol(_.getId())??_))];let G=new Map;if(Z.forEach((_,H)=>G.set(_,H)),q)for(let _ of X){let H=Q.getShowRowGroupCol(_.getId());G.set(_,G.get(H))}return G}getColumnsWithSortingOrdered(){return[...this.getIndexedSortMap().entries()].sort(([,$],[,z])=>$-z).map(([$])=>$)}collectSortItems($=!1){let z=[],Q=this.getColumnsWithSortingOrdered();for(let J of Q){let Z=J.getSortDef()?.direction;if(!Z)continue;let X=L$(J.getSortDef()?.type),Y={sort:Z,type:X};if($)Y.colId=J.getId();else Y.column=J;z.push(Y)}return z}getSortModel(){return this.collectSortItems(!0)}getSortOptions(){return this.collectSortItems()}canColumnDisplayMixedSort($){let z=W$(this.gos),Q=!!$.getColDef().showRowGroup;return z&&Q}getDisplaySortForColumn($){let z=this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn($);if(!this.canColumnDisplayMixedSort($)||!z?.length)return $.getSortDef();let J=$.getColDef().field!=null||!!$.getColDef().valueGetter?[$,...z]:z,Z=J[0].getSortDef();if(!J.every((Y)=>d1(Y.getSortDef(),Z)))return{type:L$($.getSortDef()?.type),direction:"mixed"};return Z}getDisplaySortIndexForColumn($){return this.getIndexedSortMap().get($)}setupHeader($,z){let Q=()=>{let{type:J,direction:Z}=a0(z.getSortDef());if($.toggleCss("ag-header-cell-sorted-asc",Z==="asc"),$.toggleCss("ag-header-cell-sorted-desc",Z==="desc"),$.toggleCss("ag-header-cell-sorted-abs-asc",J==="absolute"&&Z==="asc"),$.toggleCss("ag-header-cell-sorted-abs-desc",J==="absolute"&&Z==="desc"),$.toggleCss("ag-header-cell-sorted-none",!Z),z.getColDef().showRowGroup){let q=!this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(z)?.every((G)=>Z==G.getSortDef()?.direction);$.toggleCss("ag-header-cell-sorted-mixed",q)}};$.addManagedEventListeners({sortChanged:Q,columnPinned:Q,columnRowGroupChanged:Q,displayedColumnsChanged:Q})}initCol($){let{sortIndex:z,initialSortIndex:Q}=$.colDef,J=M7($.colDef);if(J)$.setSortDef(J,!0);if(z!==void 0){if(z!==null)$.sortIndex=z}else if(Q!==null)$.sortIndex=Q}updateColSort($,z,Q){if(z===void 0)return;this.setColSort($,a0(z),Q)}setColSort($,z,Q){if(!d1($.getSortDef(),z))$.setSortDef(a0(z),z===void 0),$.dispatchColEvent("sortChanged",Q);$.dispatchStateUpdatedEvent("sort")}setColSortIndex($,z){$.sortIndex=z,$.dispatchStateUpdatedEvent("sortIndex")}createSortIndicator($){return new A4($)}getSortIndicatorSelector(){return I3}},i8={moduleName:"Sort",version:p,beans:[C3,O3],apiFunctions:{onSortChanged:T3},userComponents:{agSortIndicator:A4},icons:{sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc"}},b3=class extends S{constructor(){super(...arguments);this.beanName="syncSvc",this.waitingForColumns=!1}postConstruct(){this.addManagedPropertyListener("columnDefs",($)=>this.setColumnDefs($))}start(){this.beans.ctrlsSvc.whenReady(this,()=>{let $=this.gos.get("columnDefs");if($)this.setColumnsAndData($);else this.waitingForColumns=!0;this.gridReady()})}setColumnsAndData($){let{colModel:z,rowModel:Q}=this.beans;z.setColumnDefs($??[],"gridInitializing"),Q.start()}gridReady(){let{eventSvc:$,gos:z}=this;$.dispatchEvent({type:"gridReady"}),dQ(z,`initialised successfully, enterprise = ${z.isModuleRegistered("EnterpriseCore")}`)}setColumnDefs($){let z=this.gos.get("columnDefs");if(!z)return;if(this.waitingForColumns){this.waitingForColumns=!1,this.setColumnsAndData(z);return}this.beans.colModel.setColumnDefs(z,Xz($.source))}};var y3="paste",x3=class extends S{constructor(){super(...arguments);this.beanName="changeDetectionSvc",this.deferredDepth=0,this.batchedPath=null,this.batchedNodes=null}destroy(){super.destroy(),this.batchedPath=null,this.batchedNodes=null}postConstruct(){this.csrm=l2(this.beans),this.addManagedEventListeners({cellValueChanged:this.onCellValueChanged.bind(this)})}beginDeferred(){this.deferredDepth++}endDeferred(){if(this.deferredDepth===0)return;if(--this.deferredDepth>0)return;let $=this.batchedPath,z=this.batchedNodes;if(this.batchedPath=null,this.batchedNodes=null,$)this.csrm?.doAggregate($);let{rowRenderer:Q}=this.beans;if(z)for(let J of z)e5(Q,J);if($){let J=$.getSortedRows();for(let Z=0,X=J.length;Z{let{sibling:Q,pinnedSibling:J}=z;$.refreshRowByNode(z),$.refreshRowByNode(Q),$.refreshRowByNode(J),$.refreshRowByNode(Q?.pinnedSibling),$.refreshRowByNode(J?.sibling)},w3=class extends S{constructor(){super(...arguments);this.beanName="expressionSvc",this.cache={}}evaluate($,z){if(typeof $==="string")return this.evaluateExpression($,z);else e(15,{expression:$})}evaluateExpression($,z){try{return this.createExpressionFunction($)(z.value,z.context,z.oldValue,z.newValue,z.value,z.node,z.data,z.colDef,z.rowIndex,z.api,z.getValue,z.column,z.columnGroup)}catch(Q){return e(16,{expression:$,params:z,e:Q}),null}}createExpressionFunction($){let z=this.cache;if(z[$])return z[$];let Q=this.createFunctionBody($),J=Function("x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup",Q);return z[$]=J,J}createFunctionBody($){if($.includes("return"))return $;else return"return "+$+";"}};var N3={moduleName:"Expression",version:p,beans:[w3]},g3={moduleName:"ChangeDetection",version:p,beans:[x3]};var h3=class extends S{constructor(){super(...arguments);this.beanName="valueSvc",this.initialised=!1,this.isSsrm=!1}wireBeans($){this.expressionSvc=$.expressionSvc,this.colModel=$.colModel,this.valueCache=$.valueCache,this.dataTypeSvc=$.dataTypeSvc,this.editSvc=$.editSvc,this.formulaDataSvc=$.formulaDataSvc,this.rowGroupColsSvc=$.rowGroupColsSvc}postConstruct(){if(!this.initialised)this.init()}init(){let{gos:$,valueCache:z}=this;this.executeValueGetter=z?this.executeValueGetterWithValueCache.bind(this):this.executeValueGetterWithoutValueCache.bind(this),this.isSsrm=_z($),this.cellExpressions=$.get("enableCellExpressions"),this.isTreeData=$.get("treeData"),this.initialised=!0;let Q=(J)=>this.callColumnCellValueChangedHandler(J);this.eventSvc.addListener("cellValueChanged",Q,!0),this.addDestroyFunc(()=>this.eventSvc.removeListener("cellValueChanged",Q,!0)),this.addManagedPropertyListener("treeData",(J)=>this.isTreeData=J.currentValue)}getValueForDisplay($){let z=this.beans,Q=$.column,J=$.node,Z=z.showRowGroupColValueSvc,X=!Q&&J.group,Y=Q?.colDef.showRowGroup,q=!this.isTreeData||J.footer;if(Z&&q&&(X||Y)){let W=Z.getGroupValue(J,Q,this.displayIgnoresAggData(J));if(W==null)return{value:null,valueFormatted:null};return{value:W.value,valueFormatted:$.includeValueFormatted?Z.formatAndPrefixGroupColValue(W,Q,$.exporting):null}}if(!Q)return{value:J.key,valueFormatted:null};let G=this.getValue(Q,J,$.from,this.displayIgnoresAggData(J)),_=G,H=z.formula;if(Q.isAllowFormula()&&H?.isFormula(G))if($.useRawFormula)G=H.normaliseFormula(G,!0),_=H.resolveValue(Q,J);else G=H.resolveValue(Q,J),_=G;let U=$.includeValueFormatted&&!($.exporting&&Q.colDef.useValueFormatterForExport===!1);return{value:G,valueFormatted:U?this.formatValue(Q,J,_):null}}getValue($,z,Q,J=!1){if(!this.initialised)this.init();if(!z)return;let Z=$.colDef,X=z.group;if(!X){let G=Z.pivotValueColumn;if(G)$=G}let Y=this.editSvc?.getPendingEditValue(z,$,Q);if(Y!==void 0)return Y;let q=this.resolveValue($,z,J,X);if(q===void 0){if(X){let G=Z.showRowGroup;if(typeof G==="string"){let _=this.rowGroupColsSvc?.getColumnIndex(G);if(_!=null&&_>z.level)return null}}return}if(this.cellExpressions&&a1(q)){let G=q.substring(1);q=this.executeValueGetter(G,z.data,$,z)}return q}displayIgnoresAggData($){if(!$.group||$.footer||$.level===-1)return!1;if(!$.sibling||this.gos.get("groupSuppressBlankHeader"))return!1;if($.leafGroup&&this.colModel.isPivotMode())return!1;return!!$.expanded}resolveValue($,z,Q,J){let{colDef:Z,colId:X}=$,Y=!J&&this.formulaDataSvc;if(Y&&Y.hasDataSource()&&Z.allowFormula===!0){let F=Y.getFormula({column:$,rowNode:z});if(a1(F))return F}let q=J&&!Q?z.aggData:void 0,G=this.isTreeData;if(G&&q?.[X]!==void 0)return q[X];let _=z.data,H=Z.field,U=Z.valueGetter;if(G){if(U)return this.executeValueGetter(U,_,$,z);if(H&&_)return hQ(_,H,$.isFieldContainsDots())}let W=z.groupData;if(W&&X in W)return W[X];if(q?.[X]!==void 0)return q[X];let B=Z.showRowGroup,E=typeof B!=="string"||!J,K=this.isSsrm,L=K&&Q&&!!Z.aggFunc;if(U&&!L)return E?this.executeValueGetter(U,_,$,z):void 0;if(K&&z.footer&&z.field&&(B===!0||B===z.field))return hQ(_,z.field,$.isFieldContainsDots());if(H&&_&&!L)return E?hQ(_,H,$.isFieldContainsDots()):void 0;return}parseValue($,z,Q,J){let Z=$.getColDef();if(Z.allowFormula&&this.beans.formula?.isFormula(Q))return Q;let X=Z.valueParser;if(T(X)){let Y=y(this.gos,{node:z,data:z?.data,oldValue:J,newValue:Q,colDef:Z,column:$});if(typeof X==="function")return X(Y);return this.expressionSvc?.evaluate(X,Y)}return Q}getDeleteValue($,z){if(T($.getColDef().valueParser))return this.parseValue($,z,"",this.getValueForDisplay({column:$,node:z,from:"edit"}).value)??null;return null}formatValue($,z,Q,J,Z=!0){let{expressionSvc:X}=this.beans,Y=null,q,G=$.getColDef();if(J)q=J;else if(Z)q=G.valueFormatter;if(q){let _=z?z.data:null,H=y(this.gos,{value:Q,node:z,data:_,colDef:G,column:$});if(typeof q==="function")Y=q(H);else Y=X?X.evaluate(q,H):null}else if(G.refData)return G.refData[Q]||"";if(Y==null&&Array.isArray(Q))Y=Q.join(", ");return Y}setValue($,z,Q,J){let Z=z.getColDef();if(!$.data&&this.canCreateRowNodeData($,Z))$.data={};if(!this.isSetValueSupported(z,$,Q,Z))return!1;let X=this.getValue(z,$,"data"),Y=y(this.gos,{node:$,data:$.data,oldValue:X,newValue:Q,colDef:Z,column:z}),q=!1;if($.data){let _=this.handleExternalFormulaChange({column:z,eventSource:J,newValue:Q,setterParams:Y,rowNode:$});if(_!==null)return _;q=this.computeValueChange({column:z,rowNode:$,newValue:Q,params:Y,rowData:$.data,valueSetter:Z.valueSetter,field:Z.field})??!0}let G=this.beans.changeDetectionSvc;G?.beginDeferred();try{if($.group){let _=this.beans.rowGroupingEditValueSvc?.setGroupDataValue($,z,Q,X,J,q||Q!==X);if(_!==void 0){if(!q&&!_)return!1;return this.finishValueChange($,z,Y,J,Q)}}if(!q)return!1;return this.finishValueChange($,z,Y,J)}finally{G?.endDeferred()}}canCreateRowNodeData($,z){if(!$.group)return!0;if(z.groupRowValueSetter!=null||z.groupRowEditable!=null)return!1;if(z.pivotValueColumn)return!1;return!0}finishValueChange($,z,Q,J,Z){$.resetQuickFilterAggregateText(),this.valueCache?.onDataChanged();let X=Z===void 0?this.getValue(z,$,"data"):Z;if(this.dispatchCellValueChangedEvent($,Q,X,J),$.pinnedSibling)this.dispatchCellValueChangedEvent($.pinnedSibling,Q,X,J);return!0}isSetValueSupported($,z,Q,J){let{field:Z,valueSetter:X}=J,Y=this.beans.formula,q=$.isAllowFormula()&&Y?.isFormula(Q),G=!!this.formulaDataSvc?.hasDataSource();if(n(Z)&&n(X)&&!(G&&q)){if(z.group&&(J.groupRowValueSetter||J.groupRowEditable))return!0;return j(17),!1}if(this.dataTypeSvc&&!this.dataTypeSvc.checkType($,Q))return j(135),!1;return!0}handleExternalFormulaChange($){let{column:z,rowNode:Q,newValue:J,eventSource:Z,setterParams:X}=$,Y=this.beans.formula,q=this.formulaDataSvc;if(!q?.hasDataSource()||!z.isAllowFormula())return null;let G=Y?.isFormula(J),_=q.getFormula({column:z,rowNode:Q});if(G){if(_===J)return!1;q.setFormula({column:z,rowNode:Q,formula:J});let U=Y?.resolveValue(z,Q),W=z.getColDef();if(T(W.valueSetter)||!n(W.field)){let B={...X,newValue:U};this.computeValueChange({column:z,rowNode:Q,newValue:U,params:B,rowData:Q.data,valueSetter:W.valueSetter,field:W.field})}return this.finishValueChange(Q,z,X,Z)}if(_!==void 0)q.setFormula({column:z,rowNode:Q,formula:void 0});return null}computeValueChange($){let{valueSetter:z,params:Q,rowData:J,field:Z,column:X,newValue:Y}=$;if(T(z)){if(typeof z==="function")return z(Q);return this.expressionSvc?.evaluate(z,Q)}return!!J&&this.setValueUsingField(J,Z,Y,X.isFieldContainsDots())}dispatchCellValueChangedEvent($,z,Q,J){this.eventSvc.dispatchEvent({type:"cellValueChanged",event:null,rowIndex:$.rowIndex,rowPinned:$.rowPinned,column:z.column,colDef:z.colDef,data:$.data,node:$,oldValue:z.oldValue,newValue:Q,newRawValue:z.newValue,value:Q,source:J})}callColumnCellValueChangedHandler($){let z=$.colDef.onCellValueChanged;if(typeof z==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>{z($)})}setValueUsingField($,z,Q,J){if(!z)return!1;let Z=!1;if(!J){if(Z=$[z]===Q,!Z)$[z]=Q}else{let X=z.split("."),Y=$;while(X.length>0&&Y){let q=X.shift();if(X.length===0){if(Z=Y[q]===Q,!Z)Y[q]=Q}else Y=Y[q]}}return!Z}executeValueGetterWithValueCache($,z,Q,J){let Z=Q.getColId(),X=this.valueCache.getValue(J,Z);if(X!==void 0)return X;let Y=this.executeValueGetterWithoutValueCache($,z,Q,J);return this.valueCache.setValue(J,Z,Y),Y}executeValueGetterWithoutValueCache($,z,Q,J){let Z=y(this.gos,{data:z,node:J,column:Q,colDef:Q.getColDef(),getValue:(Y)=>this.getValueCallback(J,Y)}),X;if(typeof $==="function")X=$(Z);else X=this.expressionSvc?.evaluate($,Z);return X}getValueCallback($,z){let Q=this.colModel.getColDefCol(z);if(Q)return this.getValue(Q,$,"data");return null}getKeyForNode($,z){let Q=this.getValue($,z,"data"),J=$.getColDef().keyCreator,Z=Q;if(J){let X=y(this.gos,{value:Q,colDef:$.getColDef(),column:$,node:z,data:z.data});Z=J(X)}if(typeof Z==="string"||Z==null)return Z;if(Z=String(Z),Z==="[object Object]")j(121);return Z}},u3={moduleName:"CommunityCore",version:p,beans:[OB,BH,QW,eq,S3,FU,VB,sB,SU,tE,dE,j3,h3,jB,MB,fB,ZW,b3,rU,lU,YE],icons:{selectOpen:"small-down",smallDown:"small-down",colorPicker:"color-picker",smallUp:"small-up",checkboxChecked:"small-up",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off",smallLeft:"small-left",smallRight:"small-right"},apiFunctions:{getGridId:EH,destroy:KH,isDestroyed:LH,getGridOption:DH,setGridOption:FH,updateGridOptions:Z8,isModuleRegistered:MH},dependsOn:[tU,D1,JU,i8,QE,W4,JE,A3,g3,XE,iz,aE,$3,_E,eU,sU,N3,yU,J3]};function D2($){let{inputValue:z,allSuggestions:Q,hideIrrelevant:J,filterByPercentageOfBestMatch:Z}=$,X=(Q??[]).map((G,_)=>({value:G,relevance:m3(z,G),idx:_}));if(X.sort((G,_)=>G.relevance-_.relevance),J)X=X.filter((G)=>G.relevance0&&Z&&Z>0){let _=X[0].relevance*Z;X=X.filter((H)=>_-H.relevance<0)}let Y=[],q=[];for(let G of X)Y.push(G.value),q.push(G.idx);return{values:Y,indices:q}}function m3($,z){let Q=$.length,J=z.length;if(J===0)return Q?Q:0;let Z=$.toLocaleLowerCase(),X=z.toLocaleLowerCase(),Y;if($.length1&&E>1){let D=$[U-2],F=Z[U-2],M=z[E-2],k=X[E-2];if(F===k){if(_++,D===M)_++}}if(U`No AG Grid modules are registered! It is recommended to start with all Community features via the AllCommunityModule: + + import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community'; + + ModuleRegistry.registerModules([ AllCommunityModule ]); + `,n3=($)=>{let z=$.map((J)=>`import { ${mQ(J)} } from '${n8[J]?"ag-grid-enterprise":"ag-grid-community"}';`);if($.some((J)=>J==="IntegratedCharts"||J==="Sparklines"))z.push("import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';");return`import { ModuleRegistry } from 'ag-grid-community'; +${z.join(` +`)} + +ModuleRegistry.registerModules([ ${$.map((J)=>mQ(J,!0)).join(", ")} ]); + +For more info see: ${_Q}/modules/`};function mQ($,z=!1){if(z&&($==="IntegratedCharts"||$==="Sparklines"))return`${$}Module.with(AgChartsEnterpriseModule)`;return`${$}Module`}function d3($,z){let Q=z.filter((X)=>X==="IntegratedCharts"||X==="Sparklines"),J="";if(!globalThis?.agCharts&&Q.length>0)J=`Unable to use ${$} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise. +`;else if(z.some((X)=>n8[X]))J=J+`Unable to use ${$} as that requires the ag-grid-enterprise script to be included. +`;return J}function t8({moduleName:$,rowModelType:z}){return`To use the ${$}Module you must set the gridOption "rowModelType='${z}'"`}var $6=({reasonOrId:$,moduleName:z,gridScoped:Q,gridId:J,rowModelType:Z,additionalText:X,isUmd:Y})=>{let q=i3(z,Z),G=typeof $==="string"?$:l3[$];if(Y)return d3(G,q);let _=q.filter((W)=>W==="IntegratedCharts"||W==="Sparklines"),H=_.length>0?`${_.map((W)=>mQ(W)).join()} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.`:"";return`${`Unable to use ${G} as ${q.length>1?"one of "+q.map((W)=>mQ(W)).join(", "):mQ(q[0])} is not registered${Q?" for gridId: "+J:""}. ${H} Check if you have registered the module: +`} +${n3(q)}`+(X?` + +${X}`:"")},z6=($)=>{return`${$} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'. + +import { AgChartsEnterpriseModule } from 'ag-charts-enterprise'; +import { ModuleRegistry } from 'ag-grid-community'; +import { ${$} } from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([${$}.with(AgChartsEnterpriseModule)]); + `},t3=($)=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${$}()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API.`,s3={1:()=>"`rowData` must be an array",2:({nodeId:$})=>`Duplicate node id '${$}' detected from getRowId callback, this could cause issues in your grid.`,3:()=>"Calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.",4:({id:$})=>`Could not find row id=${$}, data item was not found for this id`,5:({data:$})=>["Could not find data item as object was not found.",$," Consider using getRowId to help the Grid find matching row data"],6:()=>"'groupHideOpenParents' only works when specifying specific columns for 'colDef.showRowGroup'",7:()=>"Pivoting is not supported with aligned grids as it may produce different columns in each grid.",8:({key:$})=>`Unknown key for navigation ${$}`,9:({variable:$})=>`No value for ${$?.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${$?.defaultValue} will be used and updated when styles load.`,10:({eventType:$})=>`As of v33, the '${$}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`,11:()=>"No gridOptions provided to createGrid",12:({colKey:$})=>["column ",$," not found"],13:()=>"Could not find rowIndex, this means tasks are being executed on a rowNode that has been removed from the grid.",14:({groupPrefix:$})=>`Row IDs cannot start with ${$}, this is a reserved prefix for AG Grid's row grouping feature.`,15:({expression:$})=>["value should be either a string or a function",$],16:({expression:$,params:z,e:Q})=>["Processing of the expression failed","Expression = ",$,"Params = ",z,"Exception = ",Q],17:()=>"you need either field or valueSetter set on colDef for editing to work",18:()=>"alignedGrids contains an undefined option.",19:()=>"alignedGrids - No api found on the linked grid.",20:()=>`You may want to configure via a callback to avoid setup race conditions: + "alignedGrids: () => [linkedGrid]"`,21:()=>"pivoting is not supported with aligned grids. You can only use one of these features at a time in a grid.",22:({key:$})=>`${$} is an initial property and cannot be updated.`,23:()=>"The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead.",24:()=>"row height must be a number if not using standard row model",25:({id:$})=>["The getRowId callback must return a string. The ID ",$," is being cast to a string."],26:({fnName:$,preDestroyLink:z})=>{return`Grid API function ${$}() cannot be called as the grid has been destroyed. + Either clear local references to the grid api, when it is destroyed, or check gridApi.isDestroyed() to avoid calling methods against a destroyed grid. + To run logic when the grid is about to be destroyed use the gridPreDestroy event. See: ${z}`},27:({fnName:$,module:z})=>`API function '${$}' not registered to module '${z}'`,28:()=>"setRowCount cannot be used while using row grouping.",29:()=>"tried to call sizeColumnsToFit() but the grid is coming back with zero width, maybe the grid is not visible yet on the screen?",30:({toIndex:$})=>["tried to insert columns in invalid location, toIndex = ",$,"remember that you should not count the moving columns when calculating the new index"],31:()=>"infinite loop in resizeColumnSets",32:()=>"applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state.",33:()=>"stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON.",34:({key:$})=>`the column type '${$}' is a default column type and cannot be overridden.`,35:()=>"Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type.",36:({t:$})=>"colDef.type '"+$+"' does not correspond to defined gridOptions.columnTypes",37:()=>"Changing the column pinning status is not allowed with domLayout='print'",38:({iconName:$})=>`provided icon '${$}' needs to be a string or a function`,39:()=>"Applying column order broke a group where columns should be married together. Applying new order has been discarded.",40:({e:$,method:z})=>`${$} +${t3(z)}`,41:()=>"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.",42:()=>"Browser does not support document.execCommand('copy') for clipboard operations",43:({iconName:$})=>`As of v33, icon '${$}' is deprecated. Use the icon CSS name instead.`,44:()=>'Data type definition hierarchies (via the "extendsDataType" property) cannot contain circular references.',45:({parentCellDataType:$})=>`The data type definition ${$} does not exist.`,46:()=>'The "baseDataType" property of a data type definition must match that of its parent.',47:({cellDataType:$})=>`Missing data type definition - "${$}"`,48:({property:$,inferred:z,colId:Q})=>{let J=z?" (inferred)":"",Z=Q?` for column "${Q}"`:"";return`Cell data type is "object"${J} but no Value ${$} has been provided${Z}. Please either provide an object data type definition with a Value ${$}, or set: + - "colDef.value${$}"${z&&$==="Parser"?` + - "colDef.cellDataType = 'object'"`:""}`},49:({methodName:$})=>`Framework component is missing the method ${$}()`,50:({compName:$})=>`Could not find component ${$}, did you forget to configure this component?`,51:()=>"Export cancelled. Export is not allowed as per your configuration.",52:()=>"There is no `window` associated with the current `document`",53:()=>"unknown value type during csv conversion",54:()=>"Could not find document body, it is needed for drag and drop and context menu.",55:()=>"addRowDropZone - A container target needs to be provided",56:()=>"addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.",57:()=>"unable to show popup filter, filter instantiation failed",58:()=>"no values found for select cellEditor",59:()=>"cannot select pinned rows",60:()=>"cannot select node until it has finished loading",61:()=>"since version v32.2.0, rowNode.isFullWidthCell() has been deprecated. Instead check `rowNode.detail` followed by the user provided `isFullWidthRow` grid option.",62:({colId:$})=>`setFilterModel() - no column found for colId: ${$}`,63:({colId:$})=>`setFilterModel() - unable to fully apply model, filtering disabled for colId: ${$}`,64:({colId:$})=>`setFilterModel() - unable to fully apply model, unable to create filter for colId: ${$}`,65:()=>"filter missing setModel method, which is needed for setFilterModel",66:()=>"filter API missing getModel method, which is needed for getFilterModel",67:()=>"Filter is missing isFilterActive() method",68:()=>"Column Filter API methods have been disabled as Advanced Filters are enabled.",69:({guiFromFilter:$})=>`getGui method from filter returned ${$}; it should be a DOM element.`,70:({newFilter:$})=>`Grid option quickFilterText only supports string inputs, received: ${typeof $}`,71:()=>"debounceMs is ignored when apply button is present",72:({keys:$})=>["ignoring FilterOptionDef as it doesn't contain one of ",$],73:()=>"invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'",74:()=>"no filter options for filter",75:()=>"Unknown button type specified",76:({filterModelType:$})=>['Unexpected type of filter "',$,'", it looks like the filter was configured with incorrect Filter Options'],77:()=>"Filter model is missing 'conditions'",78:()=>'Filter Model contains more conditions than "filterParams.maxNumConditions". Additional conditions have been ignored.',79:()=>'"filterParams.maxNumConditions" must be greater than or equal to zero.',80:()=>'"filterParams.numAlwaysVisibleConditions" must be greater than or equal to zero.',81:()=>'"filterParams.numAlwaysVisibleConditions" cannot be greater than "filterParams.maxNumConditions".',82:({param:$})=>`DateFilter ${$} is not a number`,83:()=>"DateFilter minValidYear should be <= maxValidYear",84:()=>"DateFilter minValidDate should be <= maxValidDate",85:()=>"DateFilter should not have both minValidDate and minValidYear parameters set at the same time! minValidYear will be ignored.",86:()=>"DateFilter should not have both maxValidDate and maxValidYear parameters set at the same time! maxValidYear will be ignored.",87:()=>"DateFilter parameter minValidDate should always be lower than or equal to parameter maxValidDate.",88:({index:$})=>`Invalid row index for ensureIndexVisible: ${$}`,89:()=>"A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)",90:()=>"datasource is missing getRows method",91:()=>"Filter is missing method doesFilterPass",92:()=>"AnimationFrameService called but animation frames are off",93:()=>"cannot add multiple ranges when `cellSelection.suppressMultiRanges = true`",94:({paginationPageSizeOption:$,pageSizeSet:z,pageSizesSet:Q,pageSizeOptions:J})=>`'paginationPageSize=${$}'${z?"":" (default value)"}, but ${$} is not included in${Q?"":" the default"} paginationPageSizeSelector=[${J?.join(", ")}].`,95:({paginationPageSizeOption:$,paginationPageSizeSelector:z})=>`Either set '${z}' to an array that includes ${$} or to 'false' to disable the page size selector.`,96:({id:$,data:z})=>["Duplicate ID",$,"found for pinned row with data",z,"When `getRowId` is defined, it must return unique IDs for all pinned rows. Use the `rowPinned` parameter."],97:({colId:$})=>`cellEditor for column ${$} is missing getGui() method`,98:()=>"popup cellEditor does not work with fullRowEdit - you cannot use them both - either turn off fullRowEdit, or stop using popup editors.",99:()=>"Since v32, `api.hideOverlay()` does not hide the loading overlay when `loading=true`. Set `loading=false` instead.",101:({propertyName:$,componentName:z,agGridDefaults:Q,jsComps:J})=>{let Z=[],X=[...Object.keys(Q??[]).filter((q)=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(q)),...Object.keys(J??[]).filter((q)=>!!J[q])],Y=D2({inputValue:z,allSuggestions:X,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;if(Z.push(`Could not find '${z}' component. It was configured as "${$}: '${z}'" but it wasn't found in the list of registered components. +`),Y.length>0)Z.push(` Did you mean: [${Y.slice(0,3)}]? +`);return Z.push("If using a custom component check it has been registered correctly."),Z},102:()=>"selectAll: 'filtered' only works when gridOptions.rowModelType='clientSide'",103:()=>"Invalid selection state. When using client-side row model, the state must conform to `string[]`.",104:({value:$,param:z})=>`Numeric value ${$} passed to ${z} param will be interpreted as ${$} seconds. If this is intentional use "${$}s" to silence this warning.`,105:({e:$})=>["chart rendering failed",$],106:()=>`Theming API and Legacy Themes are both used in the same page. A Theming API theme has been provided to the 'theme' grid option, but the file (ag-grid.css) is also included and will cause styling issues. Remove ag-grid.css from the page. See the migration guide: ${_Q}/theming-migration/`,107:({key:$,value:z})=>`Invalid value for theme param ${$} - ${z}`,108:({e:$})=>["chart update failed",$],109:({inputValue:$,allSuggestions:z})=>{let Q=D2({inputValue:$,allSuggestions:z,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;return[`Could not find '${$}' aggregate function. It was configured as "aggFunc: '${$}'" but it wasn't found in the list of registered aggregations.`,Q.length>0?` Did you mean: [${Q.slice(0,3)}]?`:"","If using a custom aggregation function check it has been registered correctly."].join(` +`)},110:()=>"groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup",111:()=>"Invalid selection state. When `groupSelects` is enabled, the state must conform to `IServerSideGroupSelectionState`.",113:()=>"Set Filter cannot initialise because you are using a row model that does not contain all rows in the browser. Either use a different filter type, or configure Set Filter such that you provide it with values",114:({component:$})=>`Could not find component with name of ${$}. Is it in Vue.components?`,116:()=>"Invalid selection state. The state must conform to `IServerSideSelectionState`.",117:()=>"selectAll must be of boolean type.",118:()=>"Infinite scrolling must be enabled in order to set the row count.",119:()=>"Unable to instantiate filter",120:()=>"MultiFloatingFilterComp expects MultiFilter as its parent",121:()=>"a column you are grouping or pivoting by has objects as values. If you want to group by complex objects then either a) use a colDef.keyCreator (see AG Grid docs) or b) to toString() on the object to return a key",122:()=>"could not find the document, document is empty",123:()=>"Advanced Filter is only supported with the Client-Side Row Model or Server-Side Row Model.",124:()=>"No active charts to update.",125:({chartId:$})=>`Unable to update chart. No active chart found with ID: ${$}.`,126:()=>"unable to restore chart as no chart model is provided",127:({allRange:$})=>`unable to create chart as ${$?"there are no columns in the grid":"no range is selected"}.`,128:({feature:$})=>`${$} is only available if using 'multiRow' selection mode.`,129:({feature:$,rowModel:z})=>`${$} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${z}.`,130:()=>'cannot multi select unless selection mode is "multiRow"',132:()=>"Row selection features are not available unless `rowSelection` is enabled.",133:({iconName:$})=>`icon '${$}' function should return back a string or a dom object`,134:({iconName:$})=>`Did not find icon '${$}'`,135:()=>"Data type of the new value does not match the cell data type of the column",136:()=>"Unable to update chart as the 'type' is missing. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.",137:({type:$,currentChartType:z})=>`Unable to update chart as a '${$}' update type is not permitted on a ${z}.`,138:({chartType:$})=>`invalid chart type supplied: ${$}`,139:({customThemeName:$})=>`a custom chart theme with the name ${$} has been supplied but not added to the 'chartThemes' list`,140:({name:$})=>`no stock theme exists with the name '${$}' and no custom chart theme with that name was supplied to 'customChartThemes'`,141:()=>"cross filtering with row grouping is not supported.",142:()=>"cross filtering is only supported in the client side row model.",143:({panel:$})=>`'${$}' is not a valid Chart Tool Panel name`,144:({type:$})=>`Invalid charts data panel group name supplied: '${$}'`,145:({group:$})=>`As of v32, only one charts customize panel group can be expanded at a time. '${$}' will not be expanded.`,146:({comp:$})=>`Unable to instantiate component '${$}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`,147:({group:$})=>`Invalid charts customize panel group name supplied: '${$}'`,148:({group:$})=>`invalid chartGroupsDef config '${$}'`,149:({group:$,chartType:z})=>`invalid chartGroupsDef config '${$}.${z}'`,150:()=>"'seriesChartTypes' are required when the 'customCombo' chart type is specified.",151:({chartType:$})=>`invalid chartType '${$}' supplied in 'seriesChartTypes', converting to 'line' instead.`,152:({colId:$})=>`no 'seriesChartType' found for colId = '${$}', defaulting to 'line'.`,153:({chartDataType:$})=>`unexpected chartDataType value '${$}' supplied, instead use 'category', 'series' or 'excluded'`,154:({colId:$})=>`cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${$}`,155:({option:$})=>`'${$}' is not a valid Chart Toolbar Option`,156:({panel:$})=>`Invalid panel in chartToolPanelsDef.panels: '${$}'`,157:({unrecognisedGroupIds:$})=>["unable to find group(s) for supplied groupIds:",$],158:()=>"can not expand a column item that does not represent a column group header",159:()=>"Invalid params supplied to createExcelFileForExcel() - `ExcelExportParams.data` is empty.",160:()=>"Export cancelled. Export is not allowed as per your configuration.",161:()=>"The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'",162:({id:$,dataType:z})=>`Unrecognized data type for excel export [${$}.dataType=${z}]`,163:({featureName:$})=>`Excel table export does not work with ${$}. The exported Excel file will not contain any Excel tables. + Please turn off ${$} to enable Excel table exports.`,164:()=>"Unable to add data table to Excel sheet: A table already exists.",165:()=>"Unable to add data table to Excel sheet: Missing required parameters.",166:({unrecognisedGroupIds:$})=>["unable to find groups for these supplied groupIds:",$],167:({unrecognisedColIds:$})=>["unable to find columns for these supplied colIds:",$],168:()=>"detailCellRendererParams.template should be function or string",169:()=>'Reference to eDetailGrid was missing from the details template. Please add data-ref="eDetailGrid" to the template.',170:({providedStrategy:$})=>`invalid cellRendererParams.refreshStrategy = ${$} supplied, defaulting to refreshStrategy = 'rows'.`,171:()=>"could not find detail grid options for master detail, please set gridOptions.detailCellRendererParams.detailGridOptions",172:()=>"could not find getDetailRowData for master / detail, please set gridOptions.detailCellRendererParams.getDetailRowData",173:({group:$})=>`invalid chartGroupsDef config '${$}'`,174:({group:$,chartType:z})=>`invalid chartGroupsDef config '${$}.${z}'`,175:({menuTabName:$,itemsToConsider:z})=>[`Trying to render an invalid menu item '${$}'. Check that your 'menuTabs' contains one of `,z],176:({key:$})=>`unknown menu item type ${$}`,177:()=>"valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.",178:({colId:$})=>`column ${$} is not visible`,179:()=>"totalValueGetter should be either a function or a string (expression)",180:()=>"agRichSelectCellEditor requires cellEditorParams.values to be set",181:()=>"agRichSelectCellEditor cannot have `multiSelect` and `allowTyping` set to `true`. AllowTyping has been turned off.",182:()=>'you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data',183:()=>"Group Column Filter only works on group columns. Please use a different filter.",184:({parentGroupData:$,childNodeData:z})=>["duplicate group keys for row data, keys should be unique",[$,z]],185:({data:$})=>["getDataPath() should not return an empty path",[$]],186:({rowId:$,rowData:z,duplicateRowsData:Q})=>["duplicate group keys for row data, keys should be unique",$,z,...Q??[]],187:({rowId:$,firstData:z,secondData:Q})=>[`Duplicate node id ${$}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`,"first instance",z,"second instance",Q],188:($)=>`getRowId callback must be provided for Server Side Row Model ${$?.feature||"selection"} to work correctly.`,189:({startRow:$})=>`invalid value ${$} for startRow, the value should be >= 0`,190:({rowGroupId:$,data:z})=>["null and undefined values are not allowed for server side row model keys",$?`column = ${$}`:"","data is ",z],194:({method:$})=>`calling gridApi.${$}() is only possible when using rowModelType=\`clientSide\`.`,195:({justCurrentPage:$})=>`selecting just ${$?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`,196:({key:$})=>`Provided ids must be of string type. Invalid id provided: ${$}`,197:()=>"`toggledNodes` must be an array of string ids.",199:()=>"getSelectedNodes and getSelectedRows functions cannot be used with select all functionality with the server-side row model. Use `api.getServerSideSelectionState()` instead.",200:$6,201:({rowModelType:$})=>`Could not find row model for rowModelType = ${$}`,202:()=>"`getSelectedNodes` and `getSelectedRows` functions cannot be used with `groupSelectsChildren` and the server-side row model. Use `api.getServerSideSelectionState()` instead.",203:()=>"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.",204:()=>"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.",205:({duplicateIdText:$})=>`Unable to display rows as duplicate row ids (${$}) were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.`,206:()=>"getRowId callback must be implemented for transactions to work. Transaction was ignored.",207:()=>'The Set Filter Parameter "defaultToNothingSelected" value was ignored because it does not work when "excelMode" is used.',208:()=>"Set Filter Value Formatter must return string values. Please ensure the Set Filter Value Formatter returns string values for complex objects.",209:()=>`Set Filter Key Creator is returning null for provided values and provided values are primitives. Please provide complex objects. See ${_Q}/filter-set-filter-list/#filter-value-types`,210:()=>"Set Filter has a Key Creator, but provided values are primitives. Did you mean to provide complex objects?",211:()=>"property treeList=true for Set Filter params, but you did not provide a treeListPathGetter or values of type Date.",212:()=>"please review all your toolPanel components, it seems like at least one of them doesn't have an id",213:()=>"Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled.",214:({key:$})=>`unable to lookup Tool Panel as invalid key supplied: ${$}`,215:({key:$,defaultByKey:z})=>`the key ${$} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(z??{}).join(",")}`,216:({name:$})=>`Missing component for '${$}'`,217:({invalidColIds:$})=>["unable to find grid columns for the supplied colDef(s):",$],218:({property:$,defaultOffset:z})=>`${$} must be a number, the value you provided is not a valid number. Using the default of ${z}px.`,219:({property:$})=>`Property ${$} does not exist on the target object.`,220:({lineDash:$})=>`'${$}' is not a valid 'lineDash' option.`,221:()=>"agAggregationComponent should only be used with the client and server side row model.",222:()=>"agFilteredRowCountComponent should only be used with the client side row model.",223:()=>"agSelectedRowCountComponent should only be used with the client and server side row model.",224:()=>"agTotalAndFilteredRowCountComponent should only be used with the client side row model.",225:()=>"agTotalRowCountComponent should only be used with the client side row model.",226:()=>"viewport is missing init method.",227:()=>"menu item icon must be DOM node or string",228:({menuItemOrString:$})=>`unrecognised menu item ${$}`,230:()=>"detailCellRendererParams.template is not supported by AG Grid React. To change the template, provide a Custom Detail Cell Renderer. See https://www.ag-grid.com/react-data-grid/master-detail-custom-detail/",231:()=>"As of v32, using custom components with `reactiveCustomComponents = false` is deprecated.",232:()=>"Using both rowData and v-model. rowData will be ignored.",233:({methodName:$})=>`Framework component is missing the method ${$}()`,234:()=>'Group Column Filter does not work with the colDef property "field". This property will be ignored.',235:()=>'Group Column Filter does not work with the colDef property "filterValueGetter". This property will be ignored.',236:()=>'Group Column Filter does not work with the colDef property "filterParams". This property will be ignored.',237:()=>"Group Column Filter does not work with Tree Data enabled. Please disable Tree Data, or use a different filter.",238:()=>"setRowCount can only accept a positive row count.",239:()=>'Theming API and CSS File Themes are both used in the same page. In v33 we released the Theming API as the new default method of styling the grid. See the migration docs https://www.ag-grid.com/react-data-grid/theming-migration/. Because no value was provided to the `theme` grid option it defaulted to themeQuartz. But the file (ag-grid.css) is also included and will cause styling issues. Either pass the string "legacy" to the theme grid option to use v32 style themes, or remove ag-grid.css from the page to use Theming API.',240:({theme:$})=>`theme grid option must be a Theming API theme object or the string "legacy", received: ${$}`,243:()=>"Failed to deserialize state - each provided state object must be an object.",244:()=>"Failed to deserialize state - `selectAllChildren` must be a boolean value or undefined.",245:()=>"Failed to deserialize state - `toggledNodes` must be an array.",246:()=>"Failed to deserialize state - Every `toggledNode` requires an associated string id.",247:()=>`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. +Please rebuild the selection state and reapply it.`,248:()=>"SetFloatingFilter expects SetFilter as its parent",249:()=>"Must supply a Value Formatter in Set Filter params when using a Key Creator",250:()=>"Must supply a Key Creator in Set Filter params when `treeList = true` on a group column, and Tree Data or Row Grouping is enabled.",251:({chartType:$})=>`AG Grid: Unable to create chart as an invalid chartType = '${$}' was supplied.`,252:()=>`cannot get grid to draw rows when it is in the middle of drawing rows. +Your code probably called a grid API method while the grid was in the render stage. +To overcome this, put the API call into a timeout, e.g. instead of api.redrawRows(), call setTimeout(function() { api.redrawRows(); }, 0). +To see what part of your code that caused the refresh check this stacktrace.`,253:({version:$})=>["Illegal version string: ",$],254:()=>"Cannot create chart: no chart themes available.",255:({point:$})=>`Lone surrogate U+${$?.toString(16).toUpperCase()} is not a scalar value`,256:()=>"Unable to initialise. See validation error, or load ValidationModule if missing.",257:()=>z6("IntegratedChartsModule"),258:()=>z6("SparklinesModule"),259:({part:$})=>`the argument to theme.withPart must be a Theming API part object, received: ${$}`,260:({propName:$,compName:z,gridScoped:Q,gridId:J,rowModelType:Z})=>$6({reasonOrId:`AG Grid '${$}' component: ${z}`,moduleName:BQ[z],gridId:J,gridScoped:Q,rowModelType:Z}),261:()=>"As of v33, `column.isHovered()` is deprecated. Use `api.isColumnHovered(column)` instead.",262:()=>'As of v33, icon key "smallDown" is deprecated. Use "advancedFilterBuilderSelect" for Advanced Filter Builder dropdown, "selectOpen" for Select cell editor and dropdowns (e.g. Integrated Charts menu), "richSelectOpen" for Rich Select cell editor.',263:()=>'As of v33, icon key "smallLeft" is deprecated. Use "panelDelimiterRtl" for Row Group Panel / Pivot Panel, "subMenuOpenRtl" for sub-menus.',264:()=>'As of v33, icon key "smallRight" is deprecated. Use "panelDelimiter" for Row Group Panel / Pivot Panel, "subMenuOpen" for sub-menus.',265:({colId:$})=>`Unable to infer chart data type for column '${$}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${_Q}/integrated-charts-range-chart#coldefchartdatatype .`,266:()=>'As of v33.1, using "keyCreator" with the Rich Select Editor has been deprecated. It now requires the "formatValue" callback to convert complex data to strings.',267:()=>"Detail grids can not use a different theme to the master grid, the `theme` detail grid option will be ignored.",268:()=>"Transactions aren't supported with tree data when using treeDataChildrenField",269:()=>"When `masterSelects: 'detail'`, detail grids must be configured with multi-row selection",270:({id:$,parentId:z})=>`Cycle detected for row with id='${$}' and parent id='${z}'. Resetting the parent for row with id='${$}' and showing it as a root-level node.`,271:({id:$,parentId:z})=>`Parent row not found for row with id='${$}' and parent id='${z}'. Showing row with id='${$}' as a root-level node.`,272:()=>d8(),273:({providedId:$,usedId:z})=>`Provided column id '${$}' was already in use, ensure all column and group ids are unique. Using '${z}' instead.`,274:({prop:$})=>{let z=`Since v33, ${$} has been deprecated.`;switch($){case"maxComponentCreationTimeMs":z+=" This property is no longer required and so will be removed in a future version.";break;case"setGridApi":z+=" This method is not called by AG Grid. To access the GridApi see: https://ag-grid.com/react-data-grid/grid-interface/#grid-api ";break;case"children":z+=" For multiple versions AgGridReact does not support children.";break}return z},275:t8,276:()=>"Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.",277:({colId:$})=>`'enableFilterHandlers' is set to true, but column '${$}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`,278:({colId:$})=>`Unable to create filter handler for column '${$}'`,279:($)=>{},280:({colId:$})=>`'name' must be provided for custom filter components for column '${$}`,281:({colId:$})=>`Filter for column '${$}' does not have 'filterParams.buttons', but the new Filters Tool Panel has buttons configured. Either configure buttons for the filter, or disable buttons on the Filters Tool Panel.`,282:()=>"New filter tool panel requires `enableFilterHandlers: true`.",283:()=>"As of v34, use the same method on the filter handler (`api.getColumnFilterHandler(colKey)`) instead.",284:()=>"As of v34, filters are active when they have a model. Use `api.getColumnFilterModel()` instead.",285:()=>"As of v34, use (`api.getColumnFilterModel()`) instead.",286:()=>"As of v34, use (`api.setColumnFilterModel()`) instead.",287:()=>"`api.doFilterAction()` requires `enableFilterHandlers = true",288:()=>"`api.getColumnFilterModel(key, true)` requires `enableFilterHandlers = true",289:({rowModelType:$})=>`Row Model '${$}' is not supported with Batch Editing`,290:({rowIndex:$,rowPinned:z})=>`Row with index '${$}' and pinned state '${z}' not found`,291:()=>"License Key being set multiple times with different values. This can result in an incorrect license key being used,",292:({colId:$})=>`The Multi Filter for column '${$}' has buttons configured against the child filters. When 'enableFilterHandlers=true', buttons must instead be provided against the parent Multi Filter params. The child filter buttons will be ignored.`,293:()=>"The grid was initialised detached from the DOM and was then inserted into a Shadow Root. Theme styles are probably broken. Pass the themeStyleContainer grid option to let the grid know where in the document to insert theme CSS.",294:()=>"When using the `agRichSelectCellEditor` setting `filterListAsync = true` requires `allowTyping = true` and the `values()` callback must return a Promise of filtered values.",295:({blockedService:$})=>`colDef.allowFormula is not supported with ${$}. Formulas has been turned off.`,296:()=>"Since v35, `api.hideOverlay()` does not hide the overlay when `activeOverlay` is set. Set `activeOverlay=null` instead.",297:()=>'`api.hideOverlay()` does not hide the no matching rows overlay as it is only controlled by grid state. Set `suppressOverlays=["noMatchingRows"] to not show it.',298:()=>"Columns Tool Panel 'buttons' requires 'apply' to enable Deferred Updates."};function r3($,z){let Q=s3[$];if(!Q)return[`Missing error text for error id ${$}!`];let J=Q(z),X=` +See ${a6($,z)}`;return Array.isArray(J)?J.concat(X):[J,X]}var l3={1:"Charting Aggregation",2:"pivotResultFields",3:"setTooltip"},a3=class{constructor($="javascript"){this.frameworkName=$,this.renderingEngine="vanilla",this.batchFrameworkComps=!1,this.wrapIncoming=(z)=>z(),this.wrapOutgoing=(z)=>z(),this.baseDocLink=`${m6}/${this.frameworkName}-data-grid`,Lq(this.baseDocLink)}frameworkComponent($){return null}isFrameworkComponent($){return!1}getDocLink($){return this.baseDocLink+($?"/"+$:"")}},Q6=new WeakMap,J6=new WeakMap;function nJ($,z,Q){if(!z)return e(11),{};let J=Q,Z;if(!J?.setThemeOnGridDiv){let Y=J0({tag:"div"});Y.style.height="100%",$.appendChild(Y),$=Y,Z=()=>$.remove()}return new e3().create($,z,(Y)=>{let q=new UH($);Y.createBean(q)},void 0,Q,Z)}var o3=1,e3=class{create($,z,Q,J,Z,X){let Y=b2.applyGlobalGridOptions(z),q=Y.gridId??String(o3++),G=this.getRegisteredModules(Z,q,Y.rowModelType),_=this.createBeansList(Y.rowModelType,G,q),H=this.createProvidedBeans($,Y,Z);if(!_)return;let B=new pG({providedBeanInstances:H,beanClasses:_,id:q,beanInitComparator:dG,beanDestroyComparator:tG,derivedBeans:[iG],destroyCallback:()=>{J6.delete(E),Q6.delete($),Uq(q),X?.()}});this.registerModuleFeatures(B,G),Q(B),B.getBean("syncSvc").start(),J?.(B);let E=B.getBean("gridApi");return Q6.set($,E),J6.set(E,$),E}getRegisteredModules($,z,Q){return tQ(u3,void 0,!0),$?.modules?.forEach((J)=>tQ(J,z)),Wq(z,Z6(Q))}registerModuleFeatures($,z){let Q=$.getBean("registry"),J=$.getBean("apiFunctionSvc");for(let Z of z){Q.registerModule(Z);let X=Z.apiFunctions;if(X){let Y=Object.keys(X);for(let q of Y)J?.addFunction(q,X[q])}}}createProvidedBeans($,z,Q){let J=Q?Q.frameworkOverrides:null;if(n(J))J=new a3;let Z={gridOptions:z,eGridDiv:$,eRootDiv:$,globalListener:Q?Q.globalListener:null,globalSyncListener:Q?Q.globalSyncListener:null,frameworkOverrides:J,withinStudio:Q?.withinStudio};if(Q?.providedBeanInstances)Object.assign(Z,Q.providedBeanInstances);return Z}createBeansList($,z,Q){let J={clientSide:"ClientSideRowModel",infinite:"InfiniteRowModel",serverSide:"ServerSideRowModel",viewport:"ViewportRowModel"},Z=Z6($),X=J[Z];if(!X){yQ(201,{rowModelType:Z},`Unknown rowModelType ${Z}.`);return}if(!Eq()){yQ(272,void 0,d8());return}if(!$){let q=Object.entries(J).filter(([G,_])=>eZ(_,Q,G));if(q.length==1){let[G,_]=q[0];if(G!==Z){let H={moduleName:_,rowModelType:G};yQ(275,H,t8(H));return}}}if(!eZ(X,Q,Z)){let q=x2(),G=`rowModelType = '${Z}'`,_=q?`Unable to use ${G} as that requires the ag-grid-enterprise script to be included. +`:`Missing module ${X}Module for rowModelType ${Z}.`;yQ(200,{reasonOrId:G,moduleName:X,gridScoped:y2(),gridId:Q,rowModelType:Z,isUmd:q},_);return}let Y=new Set;for(let q of z)for(let G of q.beans??[])Y.add(G);return Array.from(Y)}};function Z6($){return $??"clientSide"}function $K($,z,Q="auto"){$.frameworkOverrides.wrapIncoming(()=>$.ctrlsSvc.getScrollFeature().ensureColumnVisible(z,Q),"ensureVisible")}function zK($,z,Q){$.frameworkOverrides.wrapIncoming(()=>$.ctrlsSvc.getScrollFeature().ensureIndexVisible(z,Q),"ensureVisible")}var s8=($,z)=>{for(let Q=0,J=$.length;Q{if(Q!=null){let X=Q.getSortedRows();for(let Y=0,q=X.length;Y{let _=q.level+1;for(let H=0,U=G.length;H{if(!U&&U!==void 0){let M=D.sourceRowIndex;U=M<=W,W=M}if(D.data!==F){if(D.updateData(F),!Y.has(D))q.add(D);if(!D.selectable&&D.isSelected())_.push(D)}},K=(D,F,M)=>{for(let k=0,V=F.length;k0;if(L){let D=Q._leafs??(Q._leafs=[]);if(U===void 0)qK(D,G,X);else if(YK(D,G))X.reordered=!0}if(L||B||q.size)$.rowDataUpdated=!0,this.deselect(_)}deleteUnusedNodes($,{removals:z},Q,J){let Z=this.rootNode._leafs;for(let X=0,Y=Z.length;X0}updateRowData($,z,Q){if(this.dispatchRowDataUpdateStarted($.add),this.beans.groupStage?.getNestedDataGetter())return j(268),{remove:[],update:[],add:[]};let J=[],Z=Q2(this.gos),X=this.executeRemove(Z,$,z,J,Q),Y=this.executeUpdate(Z,$,z,J),q=this.executeAdd($,z);return this.deselect(J),{remove:X,update:Y,add:q}}executeRemove($,{remove:z},{adds:Q,updates:J,removals:Z},X,Y){let q=this.rootNode._leafs,G=q?.length,_=z?.length;if(!_||!G)return[];let H=0,U=G,W=0,B=Array(_);for(let E=0;E<_;++E){let K=this.lookupNode($,z[E]);if(!K)continue;let L=K.sourceRowIndex;if(LW)W=L;if(B[H++]=K,!this.destroyNode(K,Y))continue;if(K.isSelected())X.push(K);if(!Q.delete(K))J.delete(K),Z.push(K)}if(B.length=H,H)XK(q,U,W);return B}executeUpdate($,{update:z},{adds:Q,updates:J},Z){let X=z?.length;if(!X)return[];let Y=Array(X),q=0;for(let G=0;G=G;--U){let B=J[U];B.sourceRowIndex=W,J[W--]=B}z.reordered=!0}J.length=q;let _=Array(Y),H=z.adds;for(let U=0;U=Q||Number.isNaN(z))return Q;z=Math.ceil(z);let J=this.gos;if(z>0&&J.get("treeData")&&J.get("getDataPath"))z=JK($,z);return z}},JK=($,z)=>{for(let Q=0,J=$.length;Q{if($.group=!0,$.level=-1,$._expanded=!0,$.id="ROOT_NODE_ID",$._leafs?.length!==0)$._leafs=[];let z=[],Q=[],J=[],Z=[];$.childrenAfterGroup=z,$.childrenAfterSort=Q,$.childrenAfterAggFilter=J,$.childrenAfterFilter=Z;let X=$.sibling;if(X)X.childrenAfterGroup=z,X.childrenAfterSort=Q,X.childrenAfterAggFilter=J,X.childrenAfterFilter=Z,X.childrenMapped=$.childrenMapped;return $.updateHasChildren(),$},ZK=($,z)=>{if($)for(let Q=0,J=$.length;Q{z=Math.max(0,z);for(let J=z,Z=$.length;J{let Q=z.size;$.length=Q;let J=0,Z=!1,X=!1;for(let Y of z){let q=Y.sourceRowIndex;if(q===J)X||(X=Z);else{if(q>=0)X=!0;else Z=!0;Y.sourceRowIndex=J,$[J]=Y}++J}return X},qK=($,z,{adds:Q})=>{let J=$.length,Z=z.size;if(Z>J)$.length=Z;let X=0;for(let Y=0;Y{if(J.hasChildren())if($&&!Z)J.childrenAfterFilter=J.childrenAfterGroup.filter((X)=>{let Y=X.childrenAfterFilter&&X.childrenAfterFilter.length>0,q=X.data&&this.filterManager.doesRowPassFilter({rowNode:X});return Y||q});else J.childrenAfterFilter=J.childrenAfterGroup;else J.childrenAfterFilter=J.childrenAfterGroup;F2(J)};if(this.doingTreeDataFiltering()){let J=(Z,X)=>{if(Z.childrenAfterGroup)for(let Y=0;YQ(Z,!1);S0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,z,J)}}softFilter($,z){let Q=(Z)=>{if(Z.childrenAfterFilter=Z.childrenAfterGroup,Z.hasChildren())for(let X of Z.childrenAfterGroup)X.softFiltered=$&&!(X.data&&this.filterManager.doesRowPassFilter({rowNode:X}));F2(Z)},J=this.beans.rowModel;S0(J.rootNode,J.hierarchical,z,Q)}doingTreeDataFiltering(){let{gos:$}=this;return!!this.beans.groupStage?.treeData&&!$.get("excludeChildrenWhenTreeDataFiltering")}},_K=4,HK=($,z,Q,J,Z)=>{let{childrenAfterSort:X,childrenAfterAggFilter:Y}=z;if(!Y)return X&&X.length>0?X:[];let q=Y.length;if(q<=1){if(X?.length===q&&(q===0||X[0]===Y[0]))return X;return Y.slice()}if(!X||q<=_K)return $.doFullSortInPlace(Y.slice(),Z);let G=new Map,{updates:_,adds:H}=Q,U=[];for(let B=0;B$.compareRowNodes(Z,B,E)||~G.get(B)-~G.get(E)),W===q)return U;return UK($,Z,U,X,G,q)},UK=($,z,Q,J,Z,X)=>{let Y=Array(X),q=0,G=Q[q],_,H=-1,U=0,W=0,B=Q.length,E=J.length;while(!0){if(H<0){if(U>=E)break;if(_=J[U++],H=Z.get(_)??-1,H<0)continue}if(($.compareRowNodes(z,G,_)||~Z.get(G)-H)<0){if(Y[W++]=G,++q>=B)break;G=Q[q]}else Y[W++]=_,H=-1}while(q=0)Y[W++]=K}return Y},WK=($,z,Q)=>{let J=0;Q.length=z.size;for(let Z=0,X=$.length;Z{let{childrenAfterSort:z,sibling:Q}=$;if(Q)Q.childrenAfterSort=z;if(!z)return;for(let J=0,Z=z.length-1;J<=Z;J++){let X=z[J],Y=J===0,q=J===Z;if(X.firstChild!==Y)X.firstChild=Y,X.dispatchRowEvent("firstChildChanged");if(X.lastChild!==q)X.lastChild=q,X.dispatchRowEvent("lastChildChanged");if(X.childIndex!==J)X.childIndex=J,X.dispatchRowEvent("childIndexChanged")}},BK=class extends S{constructor(){super(...arguments);this.beanName="sortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort"]}execute($,z){let Q=this.beans.sortSvc.getSortOptions(),J=Q.length>0&&!!z&&this.gos.get("deltaSort"),{gos:Z,colModel:X,rowGroupColsSvc:Y,rowNodeSorter:q,rowRenderer:G,showRowGroupCols:_}=this.beans,H=Z.get("groupMaintainOrder"),U=X.getCols().some((F)=>F.isRowGroupActive()),W=Y?.columns,B=X.isPivotMode(),E=Z.getCallback("postSortRows"),K=!1,L,D=(F)=>{let M=B&&F.leafGroup,k=H&&U&&!F.leafGroup;if(k)L??(L=this.shouldSortContainsGroupCols(Q)),k&&(k=!L);let V=null;if(k){let R=!1;if(W){let O=F.level+1;if(O{let{childrenAfterSort:z,childrenAfterAggFilter:Q}=$,J=z?.length,Z=Q?.length;if(!J||!Z)return null;let X=Array(Z),Y=new Set;for(let G=0;G{this.beans.groupStage?.invalidateGroupCols(),this.refreshModel({step:"group",afterColumnsChanged:!0,keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame")})};this.addManagedEventListeners({newColumnsLoaded:Q,columnRowGroupChanged:Q,columnValueChanged:this.onValueChanged.bind(this),columnPivotChanged:()=>this.refreshModel({step:"pivot"}),columnPivotModeChanged:()=>this.refreshModel({step:"group"}),filterChanged:this.onFilterChanged.bind(this),sortChanged:this.onSortChanged.bind(this),stylesChanged:this.onGridStylesChanges.bind(this),gridReady:this.onGridReady.bind(this),rowExpansionStateChanged:this.onRowGroupOpened.bind(this)}),this.addPropertyListeners()}addPropertyListeners(){let{beans:$,stagesRefreshProps:z}=this,Q=[$.groupStage,$.filterStage,$.pivotStage,$.aggStage,$.sortStage,$.filterAggStage,$.flattenStage].filter((J)=>!!J);this.stages=Q;for(let J=Q.length-1;J>=0;--J){let Z=Q[J];for(let X of Z.refreshProps)z.set(X,J)}this.addManagedPropertyListeners([...z.keys(),"rowData"],(J)=>{let Z=J.changeSet?.properties;if(Z)this.onPropChange(Z)}),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights())}start(){if(this.started=!0,this.rowNodesCountReady)this.refreshModel({step:"group",rowDataUpdated:!0,newData:!0});else this.setInitialData()}setInitialData(){if(this.gos.get("rowData"))this.onPropChange(["rowData"])}ensureRowHeightsValid($,z,Q,J){let Z,X=!1;do{Z=!1;let Y=this.getRowIndexAtPixel($),q=this.getRowIndexAtPixel(z),G=Math.max(Y,Q),_=Math.min(q,J);for(let H=G;H<=_;H++){let U=this.getRow(H);if(U.rowHeightEstimated){let W=sQ(this.beans,U);U.setRowHeight(W.height),Z=!0,X=!0}}if(Z)this.setRowTopAndRowIndex()}while(Z);return X}onPropChange($){let{nodeManager:z,gos:Q,beans:J}=this,Z=J.groupStage;if(!z)return;let X=new Set($),Y=Z?.onPropChange(X),q;if(X.has("rowData"))q=Q.get("rowData");else if(Y)q=Z?.extractData();if(q&&!Array.isArray(q))q=null,j(1);let G={step:"nothing",changedProps:X};if(q){let H=!Y&&!this.isEmpty()&&q.length>0&&Q.exists("getRowId")&&!Q.get("resetRowDataOnUpdate");if(this.refreshingData=!0,H)G.keepRenderedRows=!0,G.animate=!Q.get("suppressAnimationFrame"),G.changedRowNodes=new WQ,z.setImmutableRowData(G,q);else G.rowDataUpdated=!0,G.newData=!0,z.setNewRowData(q),this.rowNodesCountReady=!0}let _=G.rowDataUpdated?"group":this.getRefreshedStage($);if(_)G.step=_,this.refreshModel(G)}getRefreshedStage($){let{stages:z,stagesRefreshProps:Q}=this;if(!z)return null;let J=z.length,Z=J;for(let X=0,Y=$.length;X{if(X?.id!=null&&!z.has(X.id))X.clearRowTopAndRowIndex()},J=(X)=>{Q(X),Q(X.detailNode),Q(X.sibling);let Y=X.childrenAfterGroup;if(!X.hasChildren()||!Y)return;if($&&X.level!==-1&&!X.expanded)return;for(let q=0,G=Y.length;q{let _=X[G];if(this.gos.get("groupHideOpenParents"))while(_.expanded&&_.childrenAfterSort&&_.childrenAfterSort.length>0)_=_.childrenAfterSort[0];return _.rowIndex},q=z.footerSvc;if(q)return q?.getTopDisplayIndex(J,$,X,Y);return Y($)}getTopLevelIndexFromDisplayedIndex($){let{rootNode:z,rowsToDisplay:Q}=this;if(!z||!Q.length||Q[0]===z)return $;let Z=this.getRow($);if(Z.footer)Z=Z.sibling;let X=Z.parent;while(X&&X!==z)Z=X,X=Z.parent;let Y=z.childrenAfterSort?.indexOf(Z)??-1;return Y>=0?Y:$}getRowBounds($){let z=this.rowsToDisplay[$];return z?{rowTop:z.rowTop,rowHeight:z.rowHeight}:null}onRowGroupOpened(){this.refreshModel({step:"map",keepRenderedRows:!0,animate:HQ(this.gos)})}onFilterChanged({afterDataChange:$,columns:z}){if(!$){let J=z.length===0||z.some((Z)=>Z.isPrimary())?"filter":"filter_aggregates";this.refreshModel({step:J,keepRenderedRows:!0,animate:HQ(this.gos)})}}onSortChanged(){this.refreshModel({step:"sort",keepRenderedRows:!0,animate:HQ(this.gos)})}getType(){return"clientSide"}onValueChanged(){this.refreshModel({step:this.beans.colModel.isPivotActive()?"pivot":"aggregate"})}isSuppressModelUpdateAfterUpdateTransaction($){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))return!1;let{changedRowNodes:z,newData:Q,rowDataUpdated:J}=$;if(!z||Q||!J)return!1;if(z.removals.length||z.adds.size)return!1;return!0}reMapRows(){if(this.refreshingModel||this.refreshingData){this.noKeepRenderedRows=!0,this.noKeepUndoRedoStack=!0,this.noAnimate=!0;return}this.refreshModel({step:"map",keepRenderedRows:!1,keepUndoRedoStack:!1,animate:!1})}refreshModel($){let{nodeManager:z,eventSvc:Q,started:J}=this;if(!z)return;let Z=!!$.rowDataUpdated;if(J&&Z)Q.dispatchEvent({type:"rowDataUpdated"});if(this.deferRefresh($)){this.setPendingRefreshFlags($),this.rowDataUpdatedPending||(this.rowDataUpdatedPending=Z);return}if(this.rowDataUpdatedPending)this.rowDataUpdatedPending=!1,$.step="group";this.updateRefreshParams($);let X=!1;this.refreshingModel=!0;try{this.executeRefresh($,Z),X=!0}finally{if(this.refreshingData=!1,this.refreshingModel=!1,!X)this.setPendingRefreshFlags($)}this.clearPendingRefreshFlags(),Q.dispatchEvent({type:"modelUpdated",animate:$.animate,keepRenderedRows:$.keepRenderedRows,newData:$.newData,newPage:!1,keepUndoRedoStack:$.keepUndoRedoStack})}executeRefresh($,z){let{beans:Q,rootNode:J}=this;if(Q.masterDetailSvc?.refreshModel($),z&&$.step!=="group")Q.colFilter?.refreshModel();let Z=$.changedPath;if(Z?.addRow(J),$.step==="group")this.doGrouping(J,$),Z??(Z=$.changedPath);switch(Z??(Z=Q.changedPathFactory?.ensureRowsPath($,J)),$.step){case"group":case"filter":this.doFilter(Z);case"pivot":if(this.doPivot(Z))Z=void 0,$.changedPath=void 0;case"aggregate":this.doAggregate(Z);case"filter_aggregates":this.doFilterAggregates(Z);case"sort":this.doSort(Z,$.changedRowNodes);case"map":this.doRowsToDisplay()}let X=new Set;this.setRowTopAndRowIndex(X),this.clearRowTopAndRowIndex(Z,X),this.updateRefreshParams($)}deferRefresh($){if(this.refreshingModel)return!0;if(this.beans.colModel.changeEventsDispatching)return!0;if(this.isSuppressModelUpdateAfterUpdateTransaction($)){if(this.started)this.refreshingData=!1;return!0}if(!this.started)return!0;return!1}setPendingRefreshFlags($){this.pendingNewData||(this.pendingNewData=!!$.newData),this.noKeepRenderedRows||(this.noKeepRenderedRows=!$.keepRenderedRows),this.noKeepUndoRedoStack||(this.noKeepUndoRedoStack=!$.keepUndoRedoStack),this.noAnimate||(this.noAnimate=!$.animate)}clearPendingRefreshFlags(){this.pendingNewData=!1,this.noKeepRenderedRows=!1,this.noKeepUndoRedoStack=!1,this.noAnimate=!1}updateRefreshParams($){$.newData=this.pendingNewData||!!$.newData,$.keepRenderedRows=!this.noKeepRenderedRows&&!!$.keepRenderedRows,$.keepUndoRedoStack=!this.noKeepUndoRedoStack&&!!$.keepUndoRedoStack,$.animate=!this.noAnimate&&!!$.animate}isEmpty(){return!this.rootNode?._leafs?.length||!this.beans.colModel?.ready}isRowsToRender(){return this.rowsToDisplay.length>0}getOverlayType(){let{beans:$,gos:z}=this;if(this.rootNode?._leafs?.length){if($.filterManager?.isAnyFilterPresent()&&this.getRowCount()===0)return"noMatchingRows"}else if(this.rowCountReady||(z.get("rowData")?.length??0)==0)return"noRows";return null}getNodesInRangeForSelection($,z){let Q=!1,J=!1,Z=[],X=lQ(this.gos);return this.forEachNodeAfterFilterAndSort((Y)=>{if(J)return;if(Q){if(Y===z||Y===$){if(J=!0,X&&Y.group){l8(Z,Y);return}}}if(!Q){if(Y!==z&&Y!==$)return;if(Q=!0,z===$)J=!0}if(!Y.group||!X)Z.push(Y)}),Z}getTopLevelNodes(){return this.rootNode?.childrenAfterGroup??null}getRow($){return this.rowsToDisplay[$]}getFormulaRow($){return this.formulaRows[$]}isRowPresent($){return this.rowsToDisplay.indexOf($)>=0}getRowIndexAtPixel($){let z=this.rowsToDisplay,Q=z.length;if(this.isEmpty()||Q===0)return-1;let J=0,Z=Q-1;if($<=0)return 0;if(z[Z].rowTop<=$)return Z;let Y=-1,q=-1;while(!0){let G=Math.floor((J+Z)/2),_=z[G];if(this.isRowInPixel(_,$))return G;if(_.rowTop<$)J=G+1;else if(_.rowTop>$)Z=G-1;if(Y===J&&q===Z)return G;Y=J,q=Z}}isRowInPixel($,z){let Q=$.rowTop,J=Q+$.rowHeight;return Q<=z&&J>z}forEachLeafNode($){let z=this.rootNode?._leafs;if(z)for(let Q=0,J=z.length;QQ.childrenAfterAggFilter)}forEachNodeAfterFilterAndSort($,z=!1){this.depthFirstSearchRowNodes($,z,(Q)=>Q.childrenAfterSort)}forEachPivotNode($,z,Q){let{colModel:J,rowGroupColsSvc:Z}=this.beans;if(!J.isPivotMode())return;if(!Z?.columns.length){$(this.rootNode,0);return}let X=Q?"childrenAfterSort":"childrenAfterGroup";this.depthFirstSearchRowNodes($,z,(Y)=>!Y.leafGroup?Y[X]:null)}depthFirstSearchRowNodes($,z=!1,Q=(X)=>X.childrenAfterGroup,J=this.rootNode,Z=0){let X=Z;if(!J)return X;let Y=J===this.rootNode;if(!Y)$(J,X++);if(J.hasChildren()&&!J.footer){let q=Y||this.hierarchical?Q(J):null;if(q){let G=this.beans.footerSvc;X=G?.addTotalRows(X,J,$,z,Y,"top")??X;for(let _ of q)X=this.depthFirstSearchRowNodes($,z,Q,_,X);return G?.addTotalRows(X,J,$,z,Y,"bottom")??X}}return X}doAggregate($){if(this.rootNode)this.beans.aggStage?.execute($)}doFilterAggregates($){let z=this.rootNode,Q=this.beans.filterAggStage;if(Q&&this.hierarchical){Q.execute($);return}z.childrenAfterAggFilter=z.childrenAfterFilter;let J=z.sibling;if(J)J.childrenAfterAggFilter=z.childrenAfterFilter}doSort($,z){let Q=this.beans.sortStage;if(Q){Q.execute($,z);return}S0(this.rootNode,this.hierarchical,$,(J)=>{J.childrenAfterSort=J.childrenAfterAggFilter.slice(0),r8(J)})}doGrouping($,z){let J=this.beans.groupStage?.execute(z);if(J===void 0){let Z=$._leafs;$.childrenAfterGroup=Z,$.updateHasChildren();let X=$.sibling;if(X)X.childrenAfterGroup=Z}if(J||z.rowDataUpdated)this.beans.colFilter?.refreshModel();if(!this.rowCountReady&&this.rowNodesCountReady)this.rowCountReady=!0,this.eventSvc.dispatchEventOnce({type:"rowCountReady"})}doFilter($){let z=this.beans.filterStage;if(z){z.execute($);return}S0(this.rootNode,this.hierarchical,$,(Q)=>{Q.childrenAfterFilter=Q.childrenAfterGroup,F2(Q)})}doPivot($){return this.beans.pivotStage?.execute($)??!1}getRowNode($){let z=this.nodeManager?.getRowNode($);if(typeof z==="object")return z;return this.beans.groupStage?.getNonLeaf($)}batchUpdateRowData($,z){if(!this.asyncTransactionsTimer){this.asyncTransactions=[];let Q=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimer=setTimeout(()=>this.executeBatchUpdateRowData(),Q)}this.asyncTransactions.push({rowDataTransaction:$,callback:z})}flushAsyncTransactions(){let $=this.asyncTransactionsTimer;if($)clearTimeout($),this.executeBatchUpdateRowData()}executeBatchUpdateRowData(){let{nodeManager:$,beans:z,eventSvc:Q,asyncTransactions:J}=this;if(!$)return;z.valueCache?.onDataChanged();let Z=[],X=[],Y=new WQ,q=!this.gos.get("suppressAnimationFrame");for(let{rowDataTransaction:G,callback:_}of J??[]){this.rowNodesCountReady=!0,this.refreshingData=!0;let H=$.updateRowData(G,Y,q);if(Z.push(H),_)X.push(_.bind(null,H))}if(this.commitTransactions(Y,q),X.length>0)setTimeout(()=>{for(let G=0,_=X.length;G<_;G++)X[G]()},0);if(Z.length>0)Q.dispatchEvent({type:"asyncTransactionsFlushed",results:Z});this.asyncTransactionsTimer=0,this.asyncTransactions=null}updateRowData($){let z=this.nodeManager;if(!z)return null;this.beans.valueCache?.onDataChanged(),this.rowNodesCountReady=!0;let Q=new WQ,J=!this.gos.get("suppressAnimationFrame");this.refreshingData=!0;let Z=z.updateRowData($,Q,J);return this.commitTransactions(Q,J),Z}commitTransactions($,z){this.refreshModel({step:"group",rowDataUpdated:!0,keepRenderedRows:!0,animate:z,changedRowNodes:$})}doRowsToDisplay(){let{rootNode:$,beans:z}=this;if(z.formula?.active){let Z=$?.childrenAfterSort??[];this.formulaRows=Z,this.rowsToDisplay=Z.filter((X)=>!X.softFiltered);for(let X of this.rowsToDisplay)X.setUiLevel(0);return}let Q=z.flattenStage;if(Q){this.rowsToDisplay=Q.execute();return}let J=this.rootNode.childrenAfterSort??[];for(let Z of J)Z.setUiLevel(0);this.rowsToDisplay=J}onRowHeightChanged(){this.refreshModel({step:"map",keepRenderedRows:!0,keepUndoRedoStack:!0})}resetRowHeights(){let $=this.rootNode;if(!$)return;let z=this.resetRowHeightsForAllRowNodes();$.setRowHeight($.rowHeight,!0);let Q=$.sibling;if(Q?.setRowHeight(Q.rowHeight,!0),z)this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let $=!1;return this.forEachNode((z)=>{z.setRowHeight(z.rowHeight,!0);let Q=z.detailNode;Q?.setRowHeight(Q.rowHeight,!0);let J=z.sibling;J?.setRowHeight(J.rowHeight,!0),$=!0}),$}onGridStylesChanges($){if($.rowHeightChanged&&!this.beans.rowAutoHeight?.active)this.resetRowHeights()}onGridReady(){if(!this.started)this.setInitialData()}destroy(){super.destroy(),this.nodeManager=this.destroyBean(this.nodeManager),this.started=!1,this.rootNode=null,this.rowsToDisplay=[],this.asyncTransactions=null,this.stages=null,this.stagesRefreshProps.clear(),clearTimeout(this.asyncTransactionsTimer)}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}},l8=($,z)=>{let Q=z.childrenAfterGroup;if(Q)for(let J=0,Z=Q.length;Jthis.onFirstDataRendered(z)});let Z=$.get("rowData");Q=Z!=null&&Z.length>0&&o($)}if(Q)this.beans.colDelayRenderSvc?.hideColumns(J)}}autoSizeCols($){let{eventSvc:z,visibleCols:Q,colModel:J}=this.beans;bQ(this.beans,!0),this.innerAutoSizeCols($).then((Z)=>{let X=(H)=>LQ(z,Array.from(H),!0,"autosizeColumns");if(!$.scaleUpToFitGridWidth)return bQ(this.beans,!1),X(Z);let Y=Y6(this.beans),q=(H)=>Q.leftCols.some((U)=>P$(U,H)),G=(H)=>Q.rightCols.some((U)=>P$(U,H)),_=$.colKeys.filter((H)=>{return!J.getCol(H)?.getColDef().suppressAutoSize&&!v0(H)&&!q(H)&&!G(H)});this.sizeColumnsToFit(Y,$.source,!0,{defaultMaxWidth:$.defaultMaxWidth,defaultMinWidth:$.defaultMinWidth,columnLimits:$.columnLimits?.map((H)=>({...H,key:H.colId})),colKeys:_,onlyScaleUp:!0,animate:!1}),bQ(this.beans,!1),X(Z)})}innerAutoSizeCols($){return new Promise((z,Q)=>{if(this.shouldQueueResizeOperations)return this.pushResizeOperation(()=>this.innerAutoSizeCols($).then(z,Q));let{colKeys:J,skipHeader:Z,skipHeaderGroups:X,stopAtGroup:Y,defaultMaxWidth:q,defaultMinWidth:G,columnLimits:_=[],source:H="api"}=$,{animationFrameSvc:U,renderStatus:W,colModel:B,autoWidthCalc:E,visibleCols:K}=this.beans;if(U?.flushAllFrames(),this.timesDelayed<5&&W&&(!W.areHeaderCellsRendered()||!W.areCellsRendered())){this.timesDelayed++,setTimeout(()=>{if(this.isAlive())this.innerAutoSizeCols($).then(z,Q)});return}this.timesDelayed=0;let L=new Set,D=-1,F=Object.fromEntries(_.map(({colId:V,...R})=>[V,R])),M=Z??this.gos.get("skipHeaderOnAutoSize"),k=X??M;while(D!==0){D=0;let V=[];for(let R of J){if(!R||q1(R))continue;let O=B.getCol(R);if(!O||L.has(O)||O.getColDef().suppressAutoSize)continue;let I=E.getPreferredWidthForColumn(O,M);if(I>0){let v=F[O.colId]??{};v.minWidth??(v.minWidth=G),v.maxWidth??(v.maxWidth=q);let C=kK(O,I,v);O.setActualWidth(C,H),L.add(O),D++}V.push(O)}if(V.length)K.refresh(H)}if(!k)this.autoSizeColumnGroupsByColumns(J,H,Y);z(L)})}autoSizeColumn($,z,Q){this.autoSizeCols({colKeys:[$],skipHeader:Q,skipHeaderGroups:!0,source:z})}autoSizeColumnGroupsByColumns($,z,Q){let{colModel:J,ctrlsSvc:Z}=this.beans,X=new Set,Y=J.getColsForKeys($);for(let G of Y){let _=G.getParent();while(_&&_!=Q){if(!_.isPadding())X.add(_);_=_.getParent()}}let q;for(let G of X){for(let _ of Z.getHeaderRowContainerCtrls())if(q=_.getHeaderCtrlForColumn(G),q)break;q?.resizeLeafColumnsToFit(z)}}autoSizeAllColumns($){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.autoSizeAllColumns($));return}this.autoSizeCols({colKeys:this.beans.visibleCols.allCols,...$})}addColumnAutosizeListeners($,z){let Q=this.gos.get("skipHeaderOnAutoSize"),J=()=>{this.autoSizeColumn(z,"uiColumnResized",Q)};$.addEventListener("dblclick",J);let Z=new h0($);return Z.addEventListener("doubleTap",J),()=>{$.removeEventListener("dblclick",J),Z.destroy()}}addColumnGroupResize($,z,Q){let J=this.gos.get("skipHeaderOnAutoSize"),Z=()=>{let X=[],Y=z.getDisplayedLeafColumns();for(let q of Y)if(!q.getColDef().suppressAutoSize)X.push(q.getColId());if(X.length>0)this.autoSizeCols({colKeys:X,skipHeader:J,stopAtGroup:z,source:"uiColumnResized"});Q()};return $.addEventListener("dblclick",Z),()=>$.removeEventListener("dblclick",Z)}sizeColumnsToFitGridBody($,z){if(!this.isAlive())return;let Q=Y6(this.beans);if(Q>0){this.sizeColumnsToFit(Q,"sizeColumnsToFit",!1,$);return}if(z===void 0)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,100)},0);else if(z===100)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,500)},100);else if(z===500)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,-1)},500);else j(29)}sizeColumnsToFit($,z="sizeColumnsToFit",Q,J){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.sizeColumnsToFit($,z,Q,J));return}let{beans:Z}=this,X=J?.animate??!0;if(X)bQ(Z,!0);let Y={};for(let{key:D,...F}of J?.columnLimits??[])Y[typeof D==="string"?D:D.getColId()]=F;let q=Z.visibleCols.allCols;if($<=0||!q.length)return;let G=N$(q);if(J?.onlyScaleUp&&G>$)return;if($===G){if(q.every((F)=>{if(F.colDef.suppressSizeToFit)return!0;let M=Y?.[F.getId()],k=M?.minWidth??J?.defaultMinWidth,V=M?.maxWidth??J?.defaultMaxWidth,R=F.getActualWidth();return(k==null||R>=k)&&(V==null||R<=V)}))return}let H=[],U=[];for(let D of q){let F=J?.colKeys?.some((M)=>P$(D,M))??!0;if(D.getColDef().suppressSizeToFit||!F)U.push(D);else H.push(D)}let W=H.slice(0),B=!1,E=(D)=>{Z0(H,D),U.push(D)},K={};for(let D of H){if(J?.onlyScaleUp)K[D.getColId()]=D.getActualWidth();D.resetActualWidth(z);let F=Y?.[D.getId()],M=F?.minWidth??J?.defaultMinWidth??-1/0,k=F?.maxWidth??J?.defaultMaxWidth??1/0,V=D.getActualWidth(),R=Math.max(Math.min(V,k),M);if(R!=V)D.setActualWidth(R,z,!0)}while(!B){B=!0;let D=$-N$(U);if(D<=0)for(let F of H){let M=Y?.[F.getId()]?.minWidth??J?.defaultMinWidth??F.minWidth;F.setActualWidth(M,z,!0)}else{let F=D/N$(H),M=D;for(let k=H.length-1;k>=0;k--){let V=H[k],R=V.getColId(),O=K[R],I=Y?.[R],v=I?.minWidth??J?.defaultMinWidth??O,C=I?.maxWidth??J?.defaultMaxWidth,m=Math.max(v??-1/0,V.getMinWidth()),w=Math.min(C??1/0,V.getMaxWidth()),a=Math.round(V.getActualWidth()*F);if(aw)a=w,E(V),B=!1;else if(k===0)a=M;V.setActualWidth(a,z,!0),M-=a}}}for(let D of W)D.fireColumnWidthChangedEvent(z);let L=Z.visibleCols;if(L.setLeftValues(z),L.updateBodyWidths(),Q)return;if(LQ(this.eventSvc,W,!0,z),X)bQ(Z,!1)}applyAutosizeStrategy(){let{gos:$,colDelayRenderSvc:z}=this.beans,Q=$.get("autoSizeStrategy");if(Q?.type!=="fitGridWidth"&&Q?.type!=="fitProvidedWidth")return;setTimeout(()=>{if(!this.isAlive())return;let J=Q.type;if(J==="fitGridWidth"){let{columnLimits:Z,defaultMinWidth:X,defaultMaxWidth:Y}=Q,q=Z?.map(({colId:G,minWidth:_,maxWidth:H})=>({key:G,minWidth:_,maxWidth:H}));this.sizeColumnsToFitGridBody({defaultMinWidth:X,defaultMaxWidth:Y,columnLimits:q})}else if(J==="fitProvidedWidth")this.sizeColumnsToFit(Q.width,"sizeColumnsToFit");z?.revealColumns(J)})}onFirstDataRendered({colIds:$,...z}){setTimeout(()=>{if(!this.isAlive())return;let Q="autosizeColumns";if($)this.autoSizeCols({...z,source:Q,colKeys:$});else this.autoSizeAllColumns({...z,source:Q});this.beans.colDelayRenderSvc?.revealColumns(z.type)})}processResizeOperations(){this.shouldQueueResizeOperations=!1;for(let $ of this.resizeOperationQueue)$();this.resizeOperationQueue=[]}pushResizeOperation($){this.resizeOperationQueue.push($)}destroy(){this.resizeOperationQueue.length=0,super.destroy()}};function kK($,z,Q={}){let J=Q.minWidth??$.getMinWidth();if(zZ)z=Z;return z}function Y6({ctrlsSvc:$,scrollVisibleSvc:z}){let Q=$.getGridBodyCtrl(),Z=Q.isVerticalScrollShowing()?z.getScrollbarWidth():0;return xz(Q.eGridBody)-Z}var q6="ag-animate-autosize";function bQ({ctrlsSvc:$,gos:z},Q){if(!z.get("animateColumnResizing")||z.get("enableRtl")||!$.isAlive())return;let J=$.getGridBodyCtrl().eGridBody.classList;if(Q)J.add(q6);else J.remove(q6)}var e8={moduleName:"ColumnAutoSize",version:p,beans:[MK],apiFunctions:{sizeColumnsToFit:DK,autoSizeColumns:o8,autoSizeAllColumns:FK},dependsOn:[W8],css:[LK]};var VK=class extends S{constructor(){super(...arguments);this.beanName="gridSerializer"}wireBeans($){this.visibleCols=$.visibleCols,this.colModel=$.colModel,this.rowModel=$.rowModel,this.pinnedRowModel=$.pinnedRowModel}serialize($,z={}){let{allColumns:Q,columnKeys:J,skipRowGroups:Z,exportRowNumbers:X}=z,Y=this.getColumnsToExport({allColumns:Q,skipRowGroups:Z,columnKeys:J,exportRowNumbers:X});return[this.prepareSession(Y),this.prependContent(z),this.exportColumnGroups(z,Y),this.exportHeaders(z,Y),this.processPinnedTopRows(z,Y),this.processRows(z,Y),this.processPinnedBottomRows(z,Y),this.appendContent(z)].reduce((q,G)=>G(q),$).parse()}processRow($,z,Q,J){let Z=z.shouldRowBeSkipped||(()=>!1),Y=z.rowPositions!=null||!!z.onlySelected,q=this.gos.get("groupHideOpenParents")&&!Y,G=this.colModel.isPivotMode()?J.leafGroup:!J.group,_=!!J.footer,H=J.allChildrenCount===1&&J.childrenAfterGroup?.length===1&&jq(this.gos,J);if(!G&&!_&&(z.skipRowGroups||H||q)||z.onlySelected&&!J.isSelected()||z.skipPinnedTop&&J.rowPinned==="top"||z.skipPinnedBottom&&J.rowPinned==="bottom"||J.stub)return;if(J.level===-1&&!G&&!_)return;if(Z(y(this.gos,{node:J})))return;let B=$.onNewBodyRow(J);if(Q.forEach((E,K)=>{B.onColumn(E,K,J)}),z.getCustomContentBelowRow){let E=z.getCustomContentBelowRow(y(this.gos,{node:J}));if(E)$.addCustomContent(E)}}appendContent($){return(z)=>{let Q=$.appendContent;if(Q)z.addCustomContent(Q);return z}}prependContent($){return(z)=>{let Q=$.prependContent;if(Q)z.addCustomContent(Q);return z}}prepareSession($){return(z)=>{return z.prepare($),z}}exportColumnGroups($,z){return(Q)=>{if(!$.skipColumnGroupHeaders){let J=new L8,{colGroupSvc:Z}=this.beans,X=Z?Z.createColumnGroups({columns:z,idCreator:J,pinned:null,isStandaloneStructure:!0}):z;this.recursivelyAddHeaderGroups(X,Q,$.processGroupHeaderCallback)}return Q}}exportHeaders($,z){return(Q)=>{if(!$.skipColumnHeaders){let J=Q.onNewHeaderRow();z.forEach((Z,X)=>{J.onColumn(Z,X,void 0)})}return Q}}processPinnedTopRows($,z){return(Q)=>{let J=this.processRow.bind(this,Q,$,z);if($.rowPositions)$.rowPositions.filter((Z)=>Z.rowPinned==="top").sort((Z,X)=>Z.rowIndex-X.rowIndex).map((Z)=>this.pinnedRowModel?.getPinnedTopRow(Z.rowIndex)).forEach(J);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("top",J);return Q}}processRows($,z){return(Q)=>{let J=this.rowModel,Z=o(this.gos,J),X=_z(this.gos,J),Y=!Z&&$.onlySelected,q=this.processRow.bind(this,Q,$,z),{exportedRows:G="filteredAndSorted"}=$;if($.rowPositions)$.rowPositions.filter((_)=>_.rowPinned==null).sort((_,H)=>_.rowIndex-H.rowIndex).map((_)=>J.getRow(_.rowIndex)).forEach(q);else if(this.colModel.isPivotMode())if(Z)J.forEachPivotNode(q,!0,G==="filteredAndSorted");else if(X)J.forEachNodeAfterFilterAndSort(q,!0);else J.forEachNode(q);else if($.onlySelectedAllPages||Y){let _=this.beans.selectionSvc?.getSelectedNodes()??[];this.replicateSortedOrder(_),_.forEach(q)}else if(G==="all")J.forEachNode(q);else if(Z||X)J.forEachNodeAfterFilterAndSort(q,!0);else J.forEachNode(q);return Q}}replicateSortedOrder($){let{sortSvc:z,rowNodeSorter:Q}=this.beans;if(!z||!Q)return;let J=z.getSortOptions(),Z=(X,Y)=>{if(X.rowIndex!=null&&Y.rowIndex!=null)return X.rowIndex-Y.rowIndex;if(X.level===Y.level){if(X.parent?.id===Y.parent?.id)return Q.compareRowNodes(J,X,Y)||(X.rowIndex??-1)-(Y.rowIndex??-1);return Z(X.parent,Y.parent)}if(X.level>Y.level)return Z(X.parent,Y);return Z(X,Y.parent)};$.sort(Z)}processPinnedBottomRows($,z){return(Q)=>{let J=this.processRow.bind(this,Q,$,z);if($.rowPositions)$.rowPositions.filter((Z)=>Z.rowPinned==="bottom").sort((Z,X)=>Z.rowIndex-X.rowIndex).map((Z)=>this.pinnedRowModel?.getPinnedBottomRow(Z.rowIndex)).forEach(J);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("bottom",J);return Q}}getColumnsToExport($){let{allColumns:z=!1,skipRowGroups:Q=!1,exportRowNumbers:J=!1,columnKeys:Z}=$,{colModel:X,gos:Y,visibleCols:q}=this,G=X.isPivotMode(),_=(W)=>{if(I$(W))return!1;return!v0(W)||J};if(Z?.length)return X.getColsForKeys(Z).filter(_);let H=Y.get("treeData"),U=[];if(z&&!G)U=X.getCols();else U=q.allCols;return U=U.filter((W)=>_(W)&&(Q&&!H?!mz(W):!0)),U}recursivelyAddHeaderGroups($,z,Q){let J=[];for(let Z of $){let X=Z;if(!X.getChildren)continue;for(let Y of X.getChildren()??[])J.push(Y)}if($.length>0&&H0($[0]))this.doAddHeaderHeader(z,$,Q);if(J&&J.length>0)this.recursivelyAddHeaderGroups(J,z,Q)}doAddHeaderHeader($,z,Q){let J=$.onNewHeaderGroupingRow(),Z=0;for(let X of z){let Y=X,q;if(Q)q=Q(y(this.gos,{columnGroup:Y}));else q=this.beans.colNames.getDisplayNameForColumnGroup(Y,"header");let _=(Y.isExpandable()?Y.getLeafColumns():[]).reduce((H,U,W,B)=>{let E=b(H);if(U.getColumnGroupShow()!=="open"){if(E&&E[1]==null)E[1]=W-1}else if(!E||E[1]!=null)E=[W],H.push(E);if(W===B.length-1&&E&&E[1]==null)E[1]=W;return H},[]);J.onColumn(Y,q||"",Z++,Y.getLeafColumns().length-1,_)}}},S4={moduleName:"SharedExport",version:p,beans:[VK]},R4=class extends S{getFileName($){let z=this.getDefaultFileExtension();if(!$?.length)$=this.getDefaultFileName();return $.includes(".")?$:`${$}.${z}`}getData($){return this.beans.gridSerializer.serialize(this.createSerializingSession($),$)}getDefaultFileName(){return`export.${this.getDefaultFileExtension()}`}};function dJ($,z){let Q=document.defaultView||window;if(!Q){j(52);return}let J=document.createElement("a"),Z=Q.URL.createObjectURL(z);J.setAttribute("href",Z),J.setAttribute("download",$),J.style.display="none",document.body.appendChild(J),J.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,view:Q})),J.remove(),Q.setTimeout(()=>{Q.URL.revokeObjectURL(Z)},0)}var j4=class{constructor($){this.valueFrom="data";let{colModel:z,rowGroupColsSvc:Q,colNames:J,valueSvc:Z,gos:X,processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:_,valueFrom:H}=$;if(this.colModel=z,this.rowGroupColsSvc=Q,this.colNames=J,this.valueSvc=Z,this.gos=X,this.processCellCallback=Y,this.processHeaderCallback=q,this.processGroupHeaderCallback=G,this.processRowGroupCallback=_,H)this.valueFrom=H}prepare($){}extractHeaderValue($){return this.getHeaderName(this.processHeaderCallback,$)??""}extractRowCellValue($){let{column:z,node:Q,currentColumnIndex:J,accumulatedRowIndex:Z,type:X,useRawFormula:Y}=$,q=J===0&&J7(this.gos,Q,this.colModel.isPivotMode());if(this.processRowGroupCallback&&(this.gos.get("treeData")||Q.group)&&(z.isRowGroupDisplayed(Q.rowGroupColumn?.getColId()??"")||q))return{value:this.processRowGroupCallback(y(this.gos,{column:z,node:Q}))??""};if(this.processCellCallback)return{value:this.processCellCallback(y(this.gos,{accumulatedRowIndex:Z,column:z,node:Q,value:this.valueSvc.getValueForDisplay({column:z,node:Q,from:this.valueFrom}).value,type:X,parseValue:(E)=>this.valueSvc.parseValue(z,Q,E,this.valueSvc.getValue(z,Q,this.valueFrom)),formatValue:(E)=>this.valueSvc.formatValue(z,Q,E)??E}))??""};let G=this.gos.get("treeData"),_=this.valueSvc,H=Q.level===-1&&Q.footer,U=z.colDef.showRowGroup===!0&&(Q.group||G);if(!H&&(q||U)){let E="",K=Q;while(K&&K.level!==-1){let{value:L,valueFormatted:D}=_.getValueForDisplay({column:q?void 0:z,node:K,includeValueFormatted:!0,exporting:!0,from:this.valueFrom});E=` -> ${D??L??""}${E}`,K=K.parent}return{value:E,valueFormatted:E}}let{value:W,valueFormatted:B}=_.getValueForDisplay({column:z,node:Q,includeValueFormatted:!0,exporting:!0,useRawFormula:Y,from:this.valueFrom});return{value:W??"",valueFormatted:B}}getHeaderName($,z){if($)return $(y(this.gos,{column:z}));return this.colNames.getDisplayNameForColumn(z,"csv",!0)}},G6=`\r +`,AK=class extends j4{constructor($){super($);this.config=$,this.isFirstLine=!0,this.result="";let{suppressQuotes:z,columnSeparator:Q}=$;this.suppressQuotes=z,this.columnSeparator=Q}addCustomContent($){if(!$)return;if(typeof $==="string"){if(!/^\s*\n/.test($))this.beginNewLine();$=$.replace(/\r?\n/g,G6),this.result+=$}else $.forEach((z)=>{this.beginNewLine(),z.forEach((Q,J)=>{if(J!==0)this.result+=this.columnSeparator;if(this.result+=this.putInQuotes(Q.data.value||""),Q.mergeAcross)this.appendEmptyCells(Q.mergeAcross)})})}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn($,z,Q,J){if(Q!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(z),this.appendEmptyCells(J)}appendEmptyCells($){for(let z=1;z<=$;z++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn($,z){if(z!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(this.extractHeaderValue($))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn($,z,Q){if(z!=0)this.result+=this.columnSeparator;let J=this.extractRowCellValue({column:$,node:Q,currentColumnIndex:z,accumulatedRowIndex:z,type:"csv",useRawFormula:!1});this.result+=this.putInQuotes(J.valueFormatted??J.value)}putInQuotes($){if(this.suppressQuotes)return $;if($===null||$===void 0)return'""';let z;if(typeof $==="string")z=$;else if(typeof $.toString==="function")z=$.toString();else j(53),z="";return'"'+z.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){if(!this.isFirstLine)this.result+=G6;this.isFirstLine=!1}},SK=class extends R4{constructor(){super(...arguments);this.beanName="csvCreator"}getMergedParams($){let z=this.gos.get("defaultCsvExportParams");return Object.assign({},z,$)}export($){if(this.isExportSuppressed()){j(51);return}let z=()=>{let J=this.getMergedParams($),Z=this.getData(J),X=new Blob(["\uFEFF",Z],{type:"text/plain"}),Y=J.fileName,q=typeof Y==="function"?Y(y(this.gos,{})):Y;dJ(this.getFileName(q),X)},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(z);else z()}exportDataAsCsv($){this.export($)}getDataAsCsv($,z=!1){let Q=z?Object.assign({},$):this.getMergedParams($);return this.getData(Q)}getDefaultFileExtension(){return"csv"}createSerializingSession($){let{colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,gos:X}=this.beans,{processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:_,suppressQuotes:H,columnSeparator:U,valueFrom:W}=$;return new AK({colModel:z,colNames:Q,valueSvc:Z,gos:X,processCellCallback:Y||void 0,processHeaderCallback:q||void 0,processGroupHeaderCallback:G||void 0,processRowGroupCallback:_||void 0,suppressQuotes:H||!1,columnSeparator:U||",",rowGroupColsSvc:J,valueFrom:W})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}};function RK($,z){return $.csvCreator?.getDataAsCsv(z)}function jK($,z){$.csvCreator?.exportDataAsCsv(z)}var $9={moduleName:"CsvExport",version:p,beans:[SK],apiFunctions:{getDataAsCsv:RK,exportDataAsCsv:jK},dependsOn:[S4]},z9=class extends R0{constructor($,z){super();if(this.ctrl=$,z)this.beans=z}postConstruct(){this.refreshTooltip()}setBrowserTooltip($,z){let J=this.ctrl.getGui();if(!J)return;if($!=null&&($!=""||z))J.setAttribute("title",$);else J.removeAttribute("title")}updateTooltipText(){let{getTooltipValue:$}=this.ctrl;if($)this.tooltip=$()}createTooltipFeatureIfNeeded(){if(this.tooltipManager==null){let $=this.beans.registry.createDynamicBean("tooltipStateManager",!0,this.ctrl,()=>this.tooltip);if($)this.tooltipManager=this.createBean($,this.beans.context)}}attemptToShowTooltip(){this.tooltipManager?.prepareToShowTooltip()}attemptToHideTooltip(){this.tooltipManager?.hideTooltip()}setTooltipAndRefresh($){this.tooltip=$,this.refreshTooltip()}refreshTooltip($){if(this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips)this.setBrowserTooltip(this.tooltip),this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context);else this.setBrowserTooltip($?"":null,$),this.createTooltipFeatureIfNeeded()}destroy(){this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context),super.destroy()}},fK=1000,OK=1000,_6=100,H6,u1=!1,PK=class extends R0{constructor($,z){super();this.tooltipCtrl=$,this.getTooltipValue=z,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans($){this.popupSvc=$.popupSvc}postConstruct(){if(this.gos.get("tooltipInteraction"))this.interactionEnabled=!0;this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");let $=this.tooltipCtrl.getGui();if(this.tooltipTrigger===0)this.addManagedListeners($,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)});if(this.tooltipTrigger===1)this.addManagedListeners($,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)});if(this.addManagedListeners($,{mousemove:this.onMouseMove.bind(this)}),!this.interactionEnabled)this.addManagedListeners($,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay($){let z=this.gos.get($);return Math.max(200,z)}getTooltipDelay($){return this.tooltipCtrl[`getTooltip${$}DelayOverride`]?.()??this.getGridOptionsTooltipDelay(`tooltip${$}Delay`)}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){let $=this.gos.get("tooltipTrigger");if(!$||$==="hover")return 0;return 1}onMouseEnter($){if(this.interactionEnabled&&this.interactiveTooltipTimeoutId)this.unlockService(),this.startHideTimeout();if(bz())return;if(u1)this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip($)},_6);else this.prepareToShowTooltip($)}onMouseMove($){if(this.lastMouseEvent)this.lastMouseEvent=$;if(this.tooltipMouseTrack&&this.state===2&&this.tooltipComp)this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){if(this.interactionEnabled)this.lockService();else this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut($){let z=$.relatedTarget,Q=this.tooltipCtrl.getGui(),J=this.tooltipComp?.getGui();if(this.isInteractingWithTooltip||Q.contains(z)||this.interactionEnabled&&J?.contains(z))return;this.setToDoNothing()}onKeyDown(){if(this.isInteractingWithTooltip)this.isInteractingWithTooltip=!1;this.setToDoNothing()}prepareToShowTooltip($){if(this.state!=0||u1)return;let z=0;if($)z=this.isLastTooltipHiddenRecently()?this.getTooltipDelay("SwitchShow"):this.getTooltipDelay("Show");this.lastMouseEvent=$||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),z),this.state=1}isLastTooltipHiddenRecently(){return Date.now()-H6this.hideTooltip(!0),...z.getAdditionalParams?.()});this.state=2,this.tooltipInstanceCount++;let J=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.createTooltipComp(Q,J)}hideTooltip($){if(!$&&this.isInteractingWithTooltip)return;if(this.tooltipComp)this.destroyTooltipComp(),H6=Date.now();if(this.eventSvc.dispatchEvent({type:"tooltipHide",parentGui:this.tooltipCtrl.getGui()}),$)this.isInteractingWithTooltip=!1;this.setToDoNothing(!0)}newTooltipComponentCallback($,z){if(this.state!==2||this.tooltipInstanceCount!==$){this.destroyBean(z);return}let J=z.getGui();if(this.tooltipComp=z,!J.classList.contains("ag-tooltip"))J.classList.add("ag-tooltip-custom");if(this.tooltipTrigger===0)J.classList.add("ag-tooltip-animate");if(this.interactionEnabled)J.classList.add("ag-tooltip-interactive");let Z=this.getLocaleTextFunc(),X=this.popupSvc?.addPopup({eChild:J,ariaLabel:Z("ariaLabelTooltip","Tooltip")});if(X)this.tooltipPopupDestroyFunc=X.hideFunc;if(this.positionTooltip(),this.tooltipTrigger===1){let Y=()=>this.setToDoNothing();[this.onBodyScrollEventCallback]=this.addManagedEventListeners({bodyScroll:Y}),this.setEventHandlers(Y)}if(this.interactionEnabled){if([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(J,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(Y0(this.beans),{keydown:(Y)=>{if(!J.contains(Y?.target))this.onKeyDown()}}),this.tooltipTrigger===1)[this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(J,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)})}this.eventSvc.dispatchEvent({type:"tooltipShow",tooltipGui:J,parentGui:this.tooltipCtrl.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){if(this.isTooltipFocused())return;this.isInteractingWithTooltip=!1,this.lockService()}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){let $=this.tooltipComp?.getGui(),z=d(this.beans);return!!$&&$.contains(z)}onTooltipFocusOut($){let z=this.tooltipCtrl.getGui();if(this.isTooltipFocused())return;if(this.isInteractingWithTooltip=!1,z.contains($.relatedTarget))this.startHideTimeout();else this.hideTooltip()}positionTooltip(){let $={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};if(this.lastMouseEvent)this.popupSvc?.positionPopupUnderMouseEvent({...$,mouseEvent:this.lastMouseEvent});else this.popupSvc?.positionPopupByComponent({...$,eventSource:this.tooltipCtrl.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");let $=this.tooltipPopupDestroyFunc,z=this.tooltipComp,Q=this.tooltipTrigger===0?OK:0;window.setTimeout(()=>{$(),this.destroyBean(z)},Q),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){for(let $ of[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener])if($)$();this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){u1=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},_6)}unlockService(){u1=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("Hide"))}clearShowTimeout(){if(!this.showTooltipTimeoutId)return;window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0}clearHideTimeout(){if(!this.hideTooltipTimeoutId)return;window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0}clearInteractiveTimeout(){if(!this.interactiveTooltipTimeoutId)return;window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}},TK=class extends z9{constructor($,z,Q){super($,Q);this.highlightTracker=z,this.onHighlight=this.onHighlight.bind(this)}postConstruct(){super.postConstruct(),this.wireHighlightListeners()}wireHighlightListeners(){this.addManagedPropertyListener("tooltipTrigger",({currentValue:$})=>{this.setTooltipMode($)}),this.setTooltipMode(this.gos.get("tooltipTrigger")),this.highlightTracker.addEventListener("itemHighlighted",this.onHighlight)}onHighlight($){if(this.tooltipMode!==1)return;if($.highlighted)this.attemptToShowTooltip();else this.attemptToHideTooltip()}setTooltipMode($="focus"){this.tooltipMode=$==="focus"?1:0}destroy(){this.highlightTracker.removeEventListener("itemHighlighted",this.onHighlight),super.destroy()}},vK=class extends r2{constructor(){super({tag:"div",cls:"ag-tooltip"})}init($){let{value:z}=$,Q=this.getGui();Q.textContent=J1(z);let J=$.location.replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase();Q.classList.add(`ag-${J}-tooltip`)}},IK=".ag-tooltip{background-color:var(--ag-tooltip-background-color);border:var(--ag-tooltip-border);border-radius:var(--ag-border-radius);color:var(--ag-tooltip-text-color);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;white-space:normal;z-index:99999;&:where(.ag-cell-editor-tooltip),&:where(.ag-cell-formula-tooltip){background-color:var(--ag-tooltip-error-background-color);border:var(--ag-tooltip-error-border);color:var(--ag-tooltip-error-text-color);font-weight:500}}.ag-tooltip-custom{position:absolute;z-index:99999}.ag-tooltip-custom:where(:not(.ag-tooltip-interactive)),.ag-tooltip:where(:not(.ag-tooltip-interactive)){pointer-events:none}.ag-tooltip-animate{transition:opacity 1s;&:where(.ag-tooltip-hiding){opacity:0}}",m1=0,CK=200,bK=class extends R0{constructor(){super(...arguments);this.beanName="popupSvc",this.popupList=[]}postConstruct(){this.addManagedEventListeners({stylesChanged:this.handleThemeChange.bind(this)})}getPopupParent(){let $=this.gos.get("popupParent");if($)return $;return this.getDefaultPopupParent()}positionPopupUnderMouseEvent($){let{ePopup:z,nudgeX:Q,nudgeY:J,skipObserver:Z}=$;this.positionPopup({ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:!0,skipObserver:Z,updatePosition:()=>this.calculatePointerAlign($.mouseEvent),postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,$.type,$.ePopup,null,$.mouseEvent)})}calculatePointerAlign($){let z=this.getParentRect();return{x:$.clientX-z.left,y:$.clientY-z.top}}positionPopupByComponent($){let{ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:Z,eventSource:X,alignSide:Y="left",position:q="over",type:G}=$,_=X.getBoundingClientRect(),H=this.getParentRect();this.setAlignedTo(X,z);let U=()=>{let W=_.left-H.left;if(Y==="right")W-=z.offsetWidth-_.width;let B;if(q==="over")B=_.top-H.top,this.setAlignedStyles(z,"over");else if(this.setAlignedStyles(z,"under"),this.shouldRenderUnderOrAbove(z,_,H,$.nudgeY||0)==="under")B=_.top-H.top+_.height;else B=_.top-z.offsetHeight-(J||0)*2-H.top;return{x:W,y:B}};this.positionPopup({ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:Z,updatePosition:U,postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,G,z,X,null)})}positionPopupForMenu($){let{eventSource:z,ePopup:Q,event:J}=$,Z=z.getBoundingClientRect(),X=this.getParentRect();this.setAlignedTo(z,Q);let Y=!1,q=()=>{let G=this.keepXYWithinBounds(Q,Z.top-X.top,0),_=Q.clientWidth>0?Q.clientWidth:200;if(!Y)Q.style.minWidth=`${_}px`,Y=!0;let U=X.right-X.left-_,W;if(this.gos.get("enableRtl")){if(W=E(),W<0)W=B(),this.setAlignedStyles(Q,"left");if(W>U)W=0,this.setAlignedStyles(Q,"right")}else{if(W=B(),W>U)W=E(),this.setAlignedStyles(Q,"right");if(W<0)W=0,this.setAlignedStyles(Q,"left")}return{x:W,y:G};function B(){return Z.right-X.left-2}function E(){return Z.left-X.left-_}};this.positionPopup({ePopup:Q,keepWithinBounds:!0,updatePosition:q,postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,"subMenu",Q,z,J instanceof MouseEvent?J:void 0)})}shouldRenderUnderOrAbove($,z,Q,J){let Z=Q.bottom-z.bottom,X=z.top-Q.top,Y=$.offsetHeight+J;if(Z>Y)return"under";if(X>Y||X>Z)return"above";return"under"}setAlignedStyles($,z){let Q=this.getPopupIndex($);if(Q===-1)return;let J=this.popupList[Q],{alignedToElement:Z}=J;if(!Z)return;let X=["right","left","over","above","under"];for(let Y of X)Z.classList.remove(`ag-has-popup-positioned-${Y}`),$.classList.remove(`ag-popup-positioned-${Y}`);if(!z)return;Z.classList.add(`ag-has-popup-positioned-${z}`),$.classList.add(`ag-popup-positioned-${z}`)}setAlignedTo($,z){let Q=this.getPopupIndex(z);if(Q!==-1){let J=this.popupList[Q];J.alignedToElement=$}}positionPopup($){let{ePopup:z,keepWithinBounds:Q,nudgeX:J,nudgeY:Z,skipObserver:X,updatePosition:Y}=$,q={width:0,height:0},G=(_=!1)=>{let{x:H,y:U}=Y();if(_&&z.clientWidth===q.width&&z.clientHeight===q.height)return;if(q.width=z.clientWidth,q.height=z.clientHeight,J)H+=J;if(Z)U+=Z;if(Q)H=this.keepXYWithinBounds(z,H,1),U=this.keepXYWithinBounds(z,U,0);if(z.style.left=`${H}px`,z.style.top=`${U}px`,$.postProcessCallback)$.postProcessCallback()};if(G(),!X){let _=F$(this.beans,z,()=>G(!0));setTimeout(()=>_(),CK)}}getParentRect(){let $=Y0(this.beans),z=this.getPopupParent();if(z===$.body)z=$.documentElement;else if(getComputedStyle(z).position==="static")z=z.offsetParent;return C6(z)}keepXYWithinBounds($,z,Q){let J=Q===0,Z=J?"clientHeight":"clientWidth",X=J?"top":"left",Y=J?"height":"width",q=J?"scrollTop":"scrollLeft",G=Y0(this.beans),_=G.documentElement,H=this.getPopupParent(),U=$.getBoundingClientRect(),W=H.getBoundingClientRect(),B=G.documentElement.getBoundingClientRect(),E=H===G.body,K=Math.ceil(U[Y]),D=E?(J?v6:I6)(_)+_[q]:H[Z];if(E)D-=Math.abs(B[X]-W[X]);let F=D-K;return Math.min(Math.max(z,0),Math.max(F,0))}addPopup($){let{eChild:z,ariaLabel:Q,ariaOwns:J,alwaysOnTop:Z,positionCallback:X,anchorToElement:Y}=$,q=this.getPopupIndex(z);if(q!==-1)return{hideFunc:this.popupList[q].hideFunc};this.initialisePopupPosition(z);let G=this.createPopupWrapper(z,!!Z,Q,J),_=this.addEventListenersToPopup({...$,wrapperEl:G});if(X)X();return this.addPopupToPopupList(z,G,_,Y),{hideFunc:_}}initialisePopupPosition($){let Q=this.getPopupParent().getBoundingClientRect();if(!T($.style.top))$.style.top=`${Q.top*-1}px`;if(!T($.style.left))$.style.left=`${Q.left*-1}px`}createPopupWrapper($,z,Q,J){let Z=this.getPopupParent(),{environment:X,gos:Y}=this.beans,q=K0({tag:"div"});if(X.applyThemeClasses(q),q.classList.add("ag-popup"),$.classList.add(Y.get("enableRtl")?"ag-rtl":"ag-ltr","ag-popup-child"),!$.hasAttribute("role"))_0($,"dialog");if(Q)E0($,Q);else if(J)$.id||($.id=`popup-component-${m1}`),q5(J,$.id);if(q.appendChild($),Z.appendChild(q),z)this.setAlwaysOnTop($,!0);else this.bringPopupToFront($);return q}addEventListenersToPopup($){let z=this.beans,Q=Y0(z),{wrapperEl:J,eChild:Z,closedCallback:X,afterGuiAttached:Y,closeOnEsc:q,modal:G,ariaOwns:_}=$,H=!1,U=(K)=>{if(!J.contains(d(z)))return;if(K.key===A.ESCAPE&&!this.isStopPropagation(K))E({keyboardEvent:K})},W=(K)=>E({mouseEvent:K}),B=(K)=>E({touchEvent:K}),E=(K={})=>{let{mouseEvent:L,touchEvent:D,keyboardEvent:F,forceHide:M}=K;if(!M&&(this.isEventFromCurrentPopup({mouseEvent:L,touchEvent:D},Z)||H))return;if(H=!0,J.remove(),Q.removeEventListener("keydown",U),Q.removeEventListener("mousedown",W),Q.removeEventListener("touchstart",B),Q.removeEventListener("contextmenu",W),this.eventSvc.removeListener("dragStarted",W),X)X(L||D||F);this.removePopupFromPopupList(Z,_)};if(Y)Y({hidePopup:E});return window.setTimeout(()=>{if(q)Q.addEventListener("keydown",U);if(G)Q.addEventListener("mousedown",W),this.eventSvc.addListener("dragStarted",W),Q.addEventListener("touchstart",B),Q.addEventListener("contextmenu",W)},0),E}addPopupToPopupList($,z,Q,J){if(this.popupList.push({element:$,wrapper:z,hideFunc:Q,instanceId:m1,isAnchored:!!J}),J)this.setPopupPositionRelatedToElement($,J);m1=m1+1}getPopupIndex($){return this.popupList.findIndex((z)=>z.element===$)}setPopupPositionRelatedToElement($,z){let Q=this.getPopupIndex($);if(Q===-1)return;let J=this.popupList[Q];if(J.stopAnchoringPromise)J.stopAnchoringPromise.then((X)=>X&&X());if(J.stopAnchoringPromise=void 0,J.isAnchored=!1,!z)return;let Z=this.keepPopupPositionedRelativeTo({element:z,ePopup:$,hidePopup:J.hideFunc});return J.stopAnchoringPromise=Z,J.isAnchored=!0,Z}removePopupFromPopupList($,z){if(this.setAlignedStyles($,null),this.setPopupPositionRelatedToElement($,null),z)q5(z,null);this.popupList=this.popupList.filter((Q)=>Q.element!==$)}keepPopupPositionedRelativeTo($){let z=this.getPopupParent(),Q=z.getBoundingClientRect(),{element:J,ePopup:Z}=$,X=J.getBoundingClientRect(),Y=(U)=>Number.parseInt(U.substring(0,U.length-1),10),q=(U,W)=>{let B=Q[U]-X[U],E=Y(Z.style[U]);return{initialDiff:B,lastDiff:B,initial:E,last:E,direction:W}},G=q("top",0),_=q("left",1),H=this.beans.frameworkOverrides;return new g((U)=>{H.wrapIncoming(()=>{lq(()=>{let W=z.getBoundingClientRect(),B=J.getBoundingClientRect();if(B.top==0&&B.left==0&&B.height==0&&B.width==0){$.hidePopup();return}let K=(L,D)=>{let F=Y(Z.style[D]);if(L.last!==F)L.initial=F,L.last=F;let M=W[D]-B[D];if(M!=L.lastDiff){let k=this.keepXYWithinBounds(Z,L.initial+L.initialDiff-M,L.direction);Z.style[D]=`${k}px`,L.last=k}L.lastDiff=M};K(G,"top"),K(_,"left")},200).then((W)=>{U(()=>{if(W!=null)window.clearInterval(W)})})},"popupPositioning")})}isEventFromCurrentPopup($,z){let{mouseEvent:Q,touchEvent:J}=$,Z=Q?Q:J;if(!Z)return!1;let X=this.getPopupIndex(z);if(X===-1)return!1;for(let Y=X;Y$.element)}hasAnchoredPopup(){return this.popupList.some(($)=>$.isAnchored)}isStopPropagation($){return z$($)}},nz={moduleName:"Popup",version:p,beans:[yK]};function EJ($){return $.get("tooltipShowMode")==="whenTruncated"}function tJ($,z){return EJ($)?iQ(z):void 0}var xK=($,z)=>{let Q=$;if(typeof Q.getTranslatedMessage==="function")return Q.getTranslatedMessage(z);return $.message},M2=($,z,Q)=>{let{editModelSvc:J}=$,Z=J?.getCellValidationModel()?.getCellValidation(z)?.errorMessages,X=J?.getRowValidationModel().getRowValidation(z)?.errorMessages,Y=Z||X;return Y?.length?Y.join(Q("tooltipValidationErrorSeparator",". ")):void 0},wK=($,z)=>{if(!EJ($.gos))return;if(z.isCellRenderer()){let J=z.column.getColDef();if(!(!!J.showRowGroup||J.cellRenderer==="agGroupCellRenderer"))return;return iQ(()=>{let X=z.eGui;return X.querySelector(".ag-group-value")||X.querySelector(".ag-cell-value")||X})}return iQ(()=>{let J=z.eGui;return J.children.length===0?J:J.querySelector(".ag-cell-value")})},NK=($,z,Q)=>{let{editSvc:J}=$,{column:Z}=z,X=wK($,z),Y=()=>{if(J?.isEditing(z))return!1;if(!X)return!0;if(!Z.isTooltipEnabled())return!1;return X()};return{shouldDisplayDefault:Y,shouldDisplayColumnTooltip:Y,shouldDisplayCustomTooltip:Q??Y}},gK=({beans:$,ctrl:z,value:Q,displayFunctions:J,translate:Z})=>{let{editSvc:X,formula:Y,gos:q}=$,{column:G,rowNode:_}=z;if(Y?.active&&G.isAllowFormula()){let L=Y.getFormulaError(G,_);if(L)return{value:xK(L,Z),location:"cellFormula",shouldDisplay:()=>!!Y?.getFormulaError(G,_)}}if(!X?.isEditing(z)){let L=M2($,z,Z);if(L)return{value:L,location:"cellEditor",shouldDisplay:()=>!X?.isEditing(z)&&!!M2($,z,Z)}}let{shouldDisplayCustomTooltip:U,shouldDisplayColumnTooltip:W}=J;if(Q!=null)return{value:Q,location:"cell",shouldDisplay:U};let B=G.getColDef(),E=_.data;if(B.tooltipField&&T(E))return{value:hQ(E,B.tooltipField,G.isTooltipFieldContainsDots()),location:"cell",shouldDisplay:W};let K=B.tooltipValueGetter;if(K)return{value:K(y(q,{location:"cell",colDef:G.getColDef(),column:G,rowIndex:z.cellPosition.rowIndex,node:_,data:_.data,value:z.value,valueFormatted:z.valueFormatted})),location:"cell",shouldDisplay:W};return null},hK=class extends S{constructor(){super(...arguments);this.beanName="tooltipSvc"}setupHeaderTooltip($,z,Q,J){if($)z.destroyBean($);let Z=this.gos,X=EJ(Z),{column:Y,eGui:q}=z,G=Y.getColDef();if(!J&&X&&!G.headerComponent)J=iQ(()=>q.querySelector(".ag-header-cell-text"));let _="header",H="header",U=this.beans.colNames.getDisplayNameForColumn(Y,H,!0),W=Q??U,B={getGui:()=>q,getLocation:()=>_,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(y(Z,{location:_,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:J,getAdditionalParams:()=>({column:Y,colDef:Y.getColDef()})},E=this.createTooltipFeature(B);if(E)E=z.createBean(E),z.setRefreshFunction("tooltip",()=>E.refreshTooltip());return E}setupHeaderGroupTooltip($,z,Q,J){if($)z.destroyBean($);let Z=this.gos,X=EJ(Z),{column:Y,eGui:q}=z,G=Y.getColGroupDef();if(!J&&X&&!G?.headerGroupComponent)J=iQ(()=>q.querySelector(".ag-header-group-text"));let _="headerGroup",H="header",U=this.beans.colNames.getDisplayNameForColumnGroup(Y,H),W=Q??U,B={getGui:()=>q,getLocation:()=>_,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(y(Z,{location:_,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:J,getAdditionalParams:()=>{let K={column:Y};if(G)K.colDef=G;return K}},E=this.createTooltipFeature(B);return E?z.createBean(E):E}enableCellTooltipFeature($,z,Q){let{beans:J}=this,{column:Z,rowNode:X}=$,Y=NK(J,$,Q),q=this.getLocaleTextFunc(),G=null,_=()=>{return G=gK({beans:J,ctrl:$,value:z,displayFunctions:Y,translate:q}),G},U={getGui:()=>$.eGui,getLocation:()=>G?.location??"cell",getTooltipValue:()=>_()?.value,shouldDisplayTooltip:()=>{let W=G??_();if(!W)return!1;return W.shouldDisplay?W.shouldDisplay():!0},getAdditionalParams:()=>({column:Z,colDef:Z.getColDef(),rowIndex:$.cellPosition.rowIndex,node:X,data:X.data,valueFormatted:$.valueFormatted})};return this.createTooltipFeature(U,J)}setupFullWidthRowTooltip($,z,Q,J){let Z={getGui:()=>z.getFullWidthElement(),getTooltipValue:()=>Q,getLocation:()=>"fullWidthRow",shouldDisplayTooltip:J},X=this.beans,Y=X.context;if($)z.destroyBean($,Y);let q=this.createTooltipFeature(Z,X);if(!q)return;return z.createBean(q,Y)}setupCellEditorTooltip($,z){let{beans:Q}=this,{context:J}=Q,Z=z.getValidationElement?.(!0)||!z.isPopup?.()&&$.eGui;if(!Z)return;let X={getGui:()=>Z,getTooltipValue:()=>M2(Q,$,this.getLocaleTextFunc()),getLocation:()=>"cellEditor",shouldDisplayTooltip:()=>{let{editModelSvc:q}=Q,G=q?.getRowValidationModel()?.getRowValidationMap(),_=q?.getCellValidationModel()?.getCellValidationMap(),H=!!G&&G.size>0,U=!!_&&_.size>0;return H||U}},Y=this.createTooltipFeature(X,Q);if(!Y)return;return $.createBean(Y,J)}initCol($){let{colDef:z}=$;$.tooltipEnabled=T(z.tooltipField)||T(z.tooltipValueGetter)||T(z.tooltipComponent)}createTooltipFeature($,z){return this.beans.registry.createDynamicBean("tooltipFeature",!1,$,z)}},uK=class extends PK{createTooltipComp($,z){RG(this.beans.userCompFactory,$)?.newAgStackInstance().then(z)}setEventHandlers($){[this.onColumnMovedEventCallback]=this.addManagedEventListeners({columnMoved:$})}clearEventHandlers(){this.onColumnMovedEventCallback?.(),this.onColumnMovedEventCallback=void 0}},mK={moduleName:"Tooltip",version:p,beans:[hK],dynamicBeans:{tooltipFeature:z9,highlightTooltipFeature:TK,tooltipStateManager:uK},userComponents:{agTooltipComponent:vK},dependsOn:[nz],css:[IK]};var cK=".ag-cell-inline-editing{border:var(--ag-cell-editing-border)!important;border-radius:var(--ag-border-radius);box-shadow:var(--ag-cell-editing-shadow);padding:0;z-index:1;.ag-cell-edit-wrapper,.ag-cell-editor,.ag-cell-wrapper,:where(.ag-cell-editor) .ag-input-field-input,:where(.ag-cell-editor) .ag-wrapper{height:100%;line-height:normal;min-height:100%;width:100%}&.ag-cell-editing-error{border-color:var(--ag-invalid-color)!important}}:where(.ag-popup-editor) .ag-large-text{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0}.ag-large-text-input{display:block;height:auto;padding:var(--ag-cell-horizontal-padding)}:where(.ag-rtl .ag-large-text-input) .ag-text-area-input{resize:none}:where(.ag-ltr) .ag-checkbox-edit{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-checkbox-edit{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-row.ag-row-editing-invalid .ag-cell-inline-editing){opacity:.8}.ag-popup-editor{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}";var pK=class extends k8{constructor($,z="ag-text-field",Q="text"){super($,z,Q)}postConstruct(){if(super.postConstruct(),this.config.allowedCharPattern)this.preventDisallowedCharacters()}setValue($,z){let Q=this.eInput;if(Q.value!==$)Q.value=T($)?$:"";return super.setValue($,z)}setStartValue($){this.setValue($,!0)}setCustomValidity($){let z=this.eInput,Q=$.length>0;if(z.setCustomValidity($),Q)z.reportValidity();V6(z,Q)}preventDisallowedCharacters(){let $=new RegExp(`[${this.config.allowedCharPattern}]`),z=(Q)=>{if(!r7(Q))return;if(Q.key&&!$.test(Q.key))Q.preventDefault()};this.addManagedListeners(this.eInput,{keydown:z,paste:(Q)=>{if(Q.clipboardData?.getData("text")?.split("").some((Z)=>!$.test(Z)))Q.preventDefault()}})}},f4={selector:"AG-INPUT-TEXT-FIELD",component:pK};var iK=class extends yG{constructor($){super();this.cellEditorInput=$,this.eEditor=f}initialiseEditor($){let{cellEditorInput:z}=this;this.setTemplate({tag:"div",cls:"ag-cell-edit-wrapper",children:[z.getTemplate()]},z.getAgComponents());let{eEditor:Q}=this,{cellStartedEdit:J,eventKey:Z,suppressPreventDefault:X}=$;Q.getInputElement().setAttribute("title",""),z.init(Q,$);let Y,q=!0;if(J){if(this.focusAfterAttached=!0,Z===A.BACKSPACE||Z===A.DELETE)Y="";else if(Z&&Z.length===1)if(X)q=!1;else Y=Z;else if(Y=z.getStartValue(),Z!==A.F2)this.highlightAllOnFocus=!0}else this.focusAfterAttached=!1,Y=z.getStartValue();if(q&&Y!=null)Q.setStartValue(Y);this.addGuiEventListener("keydown",(G)=>{let{key:_}=G;if(_===A.PAGE_UP||_===A.PAGE_DOWN)G.preventDefault()})}afterGuiAttached(){let $=this.getLocaleTextFunc(),z=this.eEditor;if(z.setInputAriaLabel($("ariaInputEditor","Input Editor")),!this.focusAfterAttached)return;if(!cz())z.getFocusableElement().focus();let Q=z.getInputElement();if(this.highlightAllOnFocus)Q.select();else this.cellEditorInput.setCaret?.()}focusIn(){let{eEditor:$}=this,z=$.getFocusableElement(),Q=$.getInputElement();z.focus(),Q.select()}getValue(){return this.cellEditorInput.getValue()}agSetEditValue($){this.params.value=$;let z=this.cellEditorInput.getStartValue();this.eEditor.setStartValue(z??null)}isPopup(){return!1}getValidationElement(){return this.eEditor.getInputElement()}getValidationErrors(){return this.cellEditorInput.getValidationErrors()}};var nK={tag:"ag-input-text-field",ref:"eEditor",cls:"ag-cell-editor"},dK=class{constructor($){this.getLocaleTextFunc=$}getTemplate(){return nK}getAgComponents(){return[f4]}init($,z){this.eEditor=$,this.params=z;let Q=z.maxLength;if(Q!=null)$.setMaxLength(Q)}getValidationErrors(){let{params:$}=this,{maxLength:z,getValidationErrors:Q}=$,J=this.getValue(),Z=this.getLocaleTextFunc(),X=[];if(z!=null&&typeof J==="string"&&J.length>z)X.push(Z("maxLengthValidation",`Must be ${z} characters or fewer.`,[String(z)]));if(!X.length)X=null;if(Q)return Q({value:J,cellEditorParams:$,internalErrors:X});return X}getValue(){let{eEditor:$,params:z}=this,Q=$.getValue();if(!T(Q)&&!T(z.value))return z.value;return z.parseValue(Q)}getStartValue(){let $=this.params;return $.useFormatter||$.column.getColDef().refData?$.formatValue($.value):$.value}setCaret(){if(cz())this.eEditor.getInputElement().focus({preventScroll:!0});let $=this.eEditor,z=$.getValue(),Q=T(z)&&z.length||0;if(Q)$.getInputElement().setSelectionRange(Q,Q)}},U6=class extends iK{constructor(){super(new dK(()=>this.getLocaleTextFunc()))}};function tK($,z){return $.editModelSvc?.getEditRowDataValue(z,{checkSiblings:!0})}function sK($){let z=$.editModelSvc?.getEditMap(),Q=[];return z?.forEach((J,Z)=>{let{rowIndex:X,rowPinned:Y}=Z;J.forEach((q,G)=>{let{editorValue:_,pendingValue:H,sourceValue:U,state:W}=q,B=B$(q),E=_??H;if(E===P0)E=void 0;let K={newValue:E,oldValue:U,state:W,column:G,colId:G.getColId(),colKey:G.getColId(),rowIndex:X,rowPinned:Y},L=W==="editing";if(L||!L&&B)Q.push(K)})}),Q}function rK($,z=!1){let{editSvc:Q}=$;if(Q?.isBatchEditing()){if(z){for(let J of $.editModelSvc?.getEditPositions()??[])if(J.state==="editing")Q.revertSingleCellEdit(J)}else $z($,{persist:!0});e$($,void 0,{cancel:z})}else Q?.stopEditing(void 0,{cancel:z,source:"edit",forceStop:!z,forceCancel:z})}function lK($,z){let Q=r($,z);return!!$.editSvc?.isEditing(Q)}function aK($,z){let{key:Q,colKey:J,rowIndex:Z,rowPinned:X}=z,{editSvc:Y,colModel:q}=$,G=q.getCol(J);if(!G){j(12,{colKey:J});return}let H=M0($,{rowIndex:Z,rowPinned:X||null,column:G});if(!H){j(290,{rowIndex:Z,rowPinned:X});return}if(!Y?.isCellEditable({rowNode:H,column:G},"api"))return;if(X==null)zK($,Z);$K($,J),Y?.startEditing({rowNode:H,column:G},{event:Q?new KeyboardEvent("keydown",{key:Q}):void 0,source:"api",editable:!0})}function oK($){return $.editSvc?.validateEdit()||null}var eK={tag:"div",cls:"ag-popup-editor",attrs:{tabindex:"-1"}},$L=class extends r2{constructor($){super(eK);this.params=$}postConstruct(){wz(this.gos,this.getGui(),"popupEditorWrapper",!0),this.addKeyDownListener()}addKeyDownListener(){let $=this.getGui(),z=this.params,Q=(J)=>{if(!_2(this.gos,J,z.node,z.column,!0))z.onKeyDown(J)};this.addManagedElementListeners($,{keydown:Q})}};function zL($,{column:z},Q,J,Z="ui"){if(Q instanceof KeyboardEvent&&(Q.key===A.TAB||Q.key===A.ENTER||Q.key===A.F2||Q.key===A.BACKSPACE&&J))return!0;if(Q?.shiftKey&&$.rangeSvc?.getCellRanges().length!=0)return!1;let Y=z?.getColDef(),q=QL($.gos,Y),G=Q?.type;if(G==="click"&&Q?.detail===1&&q===1)return!0;if(G==="dblclick"&&Q?.detail===2&&q===2)return!0;if(Z==="api")return!!J;return!1}function QL($,z){if($.get("suppressClickEdit")===!0)return 0;if($.get("singleClickEdit")===!0)return 1;if(z?.singleClickEdit)return 1;return 2}function sZ($,z){return $.editModelSvc?.hasEdits(z,{withOpenEditor:!0})??!1}function k2($,z){let{column:Q,rowNode:J}=z,Z=Q.getColDef();if(!J)return sZ($,z);let X=Z.editable;if(J.group&&Z.groupRowEditable!=null){if($.rowGroupingEditValueSvc?.isGroupCellEditable(J,Q))return!0;return sZ($,z)}if(Q.isColumnFunc(J,X))return!0;return sZ($,z)}function JL($,z,Q="ui"){let J=k2($,z);if(J||Q==="ui")return J;let{rowNode:Z,column:X}=z;for(let Y of $.colModel.getCols())if(Y!==X&&k2($,{rowNode:Z,column:Y}))return!0;return!1}var KJ=($,z=!1)=>{if($!==void 0)return B$($)||z&&$.state==="editing"};function Q9($,z,Q=!1){return KJ($.editModelSvc?.getEdit(z),Q)}var J9=($,z,Q)=>{if(!$)return;for(let J=0,Z=$.length;J{let G={rowNode:J,column:q};return Q9(Q,G,!0)||Z9(Q,G)||X9(Q,G)});this.applyStyle(X,Y);return}this.applyStyle(X)}applyStyle($=!1,z=!1){let Q=!!this.editSvc?.isBatchEditing(),J=this.gos.get("editType")==="fullRow";this.rowCtrl?.forEachGui(void 0,({rowComp:Z})=>{Z.toggleCss("ag-row-editing",J&&z),Z.toggleCss("ag-row-batch-edit",J&&z&&Q),Z.toggleCss("ag-row-inline-editing",z),Z.toggleCss("ag-row-not-inline-editing",!z),Z.toggleCss("ag-row-editing-invalid",J&&z&&$)})}},YL=({rowModel:$,pinnedRowModel:z,editModelSvc:Q},J)=>{let Z=new Set;$.forEachNode((X)=>J.has(X)&&Z.add(X)),z?.forEachPinnedRow("top",(X)=>J.has(X)&&Z.add(X)),z?.forEachPinnedRow("bottom",(X)=>J.has(X)&&Z.add(X));for(let X of J)if(!Z.has(X))Q.removeEdits({rowNode:X});return Z},qL=({editModelSvc:$},z,Q)=>{for(let J of z)$?.getEditRow(J)?.forEach((Z,X)=>!Q.has(X)&&$.removeEdits({rowNode:J,column:X}))},GL=($)=>()=>{let z=new Set($.colModel.getCols()),Q=$.editModelSvc.getEditMap(!0),J=new Set(Q.keys());qL($,YL($,J),z)},_L=new Set(["undo","redo","paste","bulk","rangeSvc"]),HL=new Set(["ui","api"]),Y9={paste:"api",rangeSvc:"api",fillHandle:"api",cellClear:"api",bulk:"api"},UL=new Set(Object.keys(Y9)),WL=new Set(["paste","rangeSvc","cellClear","redo","undo"]),rZ={cancel:!0,source:"api"},BL={cancel:!1,source:"api"},jz={checkSiblings:!0},l$={force:!0,suppressFlash:!0},EL={force:!0},KL=class extends S{constructor(){super(...arguments);this.beanName="editSvc",this.committing=!1,this.batch=!1,this.batchStartDispatched=!1,this.stopping=!1,this.rangeSelectionWhileEditing=0}postConstruct(){let{beans:$}=this;this.model=$.editModelSvc,this.valueSvc=$.valueSvc,this.rangeSvc=$.rangeSvc,this.addManagedPropertyListener("editType",({currentValue:J})=>{this.stopEditing(void 0,rZ),this.createStrategy(J)});let z=GL($),Q=()=>{let J=this.model.getCellValidationModel().getCellValidationMap().size>0,Z=this.model.getRowValidationModel().getRowValidationMap().size>0;if(J||Z)this.stopEditing(void 0,rZ);else if(this.isEditing())if(this.batch)e$($,this.model.getEditPositions());else this.stopEditing(void 0,BL);return!1};this.addManagedEventListeners({columnPinned:z,columnVisible:z,columnRowGroupChanged:z,rowExpansionStateChanged:z,pinnedRowsChanged:z,displayedRowsChanged:z,sortChanged:Q,filterChanged:Q,cellFocused:this.onCellFocused.bind(this)})}isBatchEditing(){return this.batch}startBatchEditing(){if(this.batch)return;this.batch=!0,this.batchStartDispatched=!1,this.stopEditing(void 0,rZ)}stopBatchEditing($){if(!this.batch)return;if($)this.stopEditing(void 0,$);if(this.batchStartDispatched)this.dispatchBatchStopped(new Map,!1);this.batch=!1,this.batchStartDispatched=!1}ensureBatchStarted(){if(!this.batch||this.batchStartDispatched)return;this.batchStartDispatched=!0,this.dispatchBatchEvent("batchEditingStarted",new Map)}createStrategy($){let{beans:z,gos:Q,strategy:J}=this,Z=W6(Q,$);if(J){if(J.beanName===Z)return J;this.destroyStrategy()}return this.strategy=this.createOptionalManagedBean(z.registry.createDynamicBean(Z,!0))}destroyStrategy(){if(!this.strategy)return;this.strategy.destroy(),this.strategy=this.destroyBean(this.strategy)}shouldStartEditing($,z,Q,J="ui"){let Z=zL(this.beans,$,z,Q,J);if(Z)this.strategy??(this.strategy=this.createStrategy());return Z}shouldStopEditing($,z,Q="ui"){return this.strategy?.shouldStop($,z,Q)??null}shouldCancelEditing($,z,Q="ui"){return this.strategy?.shouldCancel($,z,Q)??null}validateEdit(){return TE(this.beans)}isEditing($,z){return this.model.hasEdits($??void 0,z??jz)}isRowEditing($,z){return!!$&&this.model.hasRowEdits($,z)}enableRangeSelectionWhileEditing(){if(this.beans.rangeSvc&&this.gos.get("cellSelection"))this.rangeSelectionWhileEditing++}disableRangeSelectionWhileEditing(){this.rangeSelectionWhileEditing=Math.max(0,this.rangeSelectionWhileEditing-1)}isRangeSelectionEnabledWhileEditing(){return this.rangeSelectionWhileEditing>0}startEditing($,z){let{startedEdit:Q=!0,event:J=null,source:Z="ui",ignoreEventKey:X=!1,silent:Y}=z;if(this.strategy??(this.strategy=this.createStrategy()),!(z.editable??this.isCellEditable($,"api")))return;let G=r(this.beans,$);if(G&&!G.comp){z.editable=void 0,G.onCompAttachedFuncs.push(()=>this.startEditing($,z));return}let _=this.shouldStartEditing($,J,Q,Z);if(_===!1&&Z!=="api"){if(this.isEditing($))this.stopEditing();return}if(!this.batch&&this.shouldStopEditing($,void 0,Z)&&!z.continueEditing)this.stopEditing(void 0,{source:Z});if(_)this.ensureBatchStarted();this.strategy.start({position:$,event:J,source:Z,ignoreEventKey:X,startedEdit:Q,silent:Y})}stopEditing($,z){let Q=this.prepareStopContext($,z);if(!Q)return!1;this.stopping=!0;let J=!1,{edits:Z}=Q;try{let X=this.processStopRequest(Q);return J||(J=X.res),Z=X.edits,this.finishStopEditing({...Q,edits:Z,params:z,position:$,res:J}),J}finally{this.rangeSelectionWhileEditing=0,this.stopping=!1}}prepareStopContext($,z){let{event:Q=null,cancel:J=!1,source:Z="ui",forceCancel:X=!1,forceStop:Y=!1,commit:q=!1}=z||{};if(UL.has(Z)&&this.batch){if($?.rowNode&&$?.column)this.bulkRefreshCell($);return null}let G=this.committing?Y9[Z]:Z;if(!(this.committing||this.isEditing($)||this.batch&&this.model.hasEdits($,jz))||!this.strategy||this.stopping)return null;let H=r(this.beans,$);if(H)H.onEditorAttachedFuncs=[];let U=!J&&(!!this.shouldStopEditing($,Q,G)||(this.committing||Z==="paste")&&!this.batch)||Y,W=J&&!!this.shouldCancelEditing($,Q,G)||X;return{cancel:J,cellCtrl:H,edits:this.model.getEditMap(!0),event:Q??null,forceCancel:X,forceStop:Y,commit:q,position:$,source:Z,treatAsSource:G,willCancel:W,willStop:U}}processStopRequest($){let{event:z,position:Q,willCancel:J,willStop:Z}=$;if(Z||J)return this.handleStopOrCancel($);if(this.shouldHandleMidBatchKey(z,Q))return{res:!1,edits:this.handleMidBatchKey(z,Q,$)};if($z(this.beans,{persist:!0}),this.batch)this.strategy?.cleanupEditors(Q);return{res:!1,edits:this.model.getEditMap()}}handleStopOrCancel($){let{beans:z,model:Q}=this,{cancel:J,commit:Z,edits:X,event:Y,source:q,willCancel:G,willStop:_}=$,H=!this.batch||!G;$z(z,{persist:H,isCancelling:G||J,isStopping:_});let U=Q.getEditMap(),B=!G&&(!this.batch||Z)?this.processEdits(U,q):[];if(J)this.strategy?.stopCancelled($.forceCancel);else this.strategy?.stopCommitted(Y,Z);this.clearValidationIfNoOpenEditors();for(let E of B)Q.clearEditValue(E);this.bulkRefreshMap(X);for(let E of Q.getEditPositions(U)){let K=r(z,E),L=B$(E);K?.refreshCell({force:!0,suppressFlash:!L})}return{res:_,edits:U}}shouldHandleMidBatchKey($,z){return $ instanceof KeyboardEvent&&this.batch&&!!this.strategy?.midBatchInputsAllowed(z)&&this.isEditing(z,{withOpenEditor:!0})}handleMidBatchKey($,z,Q){let{beans:J,model:Z}=this,{cellCtrl:X,edits:Y}=Q,{key:q}=$,G=q===A.ENTER,_=q===A.ESCAPE,H=q===A.TAB;if(G||H||_){if(G||H)$z(J,{persist:!0});else if(_&&X){let{rowNode:U,column:W}=X;if(this.batch&&U&&W){let B={rowNode:U,column:W};e$(J,[B],{silent:!0}),this.model.stop(B,!0,!0),r(J,B)?.refreshCell(l$)}else this.revertSingleCellEdit(X)}if(this.batch)this.strategy?.cleanupEditors();else e$(J,Z.getEditPositions(),{event:$,cancel:_});return $.preventDefault(),this.bulkRefreshMap(Y,{suppressFlash:!0}),Z.getEditMap()}return Y}finishStopEditing({cellCtrl:$,edits:z,params:Q,position:J,res:Z,commit:X,forceCancel:Y,willCancel:q,willStop:G}){let _=this.beans;if(Z&&J){if(!this.batch||X)this.model.removeEdits(J)}this.navigateAfterEdit(Q,$?.cellPosition),xQ(_),this.clearValidationIfNoOpenEditors();let{rowRenderer:H,formula:U}=_;if(q)H.refreshRows({rowNodes:Array.from(z.keys())});if(this.batch){if(U)U.refreshFormulas(!0);else H.refreshRows({suppressFlash:!0,force:!0});let W=G&&X;if(W||q&&Y)this.dispatchBatchStopped(z,W)}}dispatchBatchStopped($,z){let Q;if(z){if(Q=VE($),Q.size>0)this.ensureBatchStarted()}if(this.batchStartDispatched)this.batchStartDispatched=!1,this.dispatchBatchEvent("batchEditingStopped",Q??new Map)}clearValidationIfNoOpenEditors(){if(!this.model.hasEdits(void 0,{withOpenEditor:!0}))this.model.getCellValidationModel().clearCellValidationMap(),this.model.getRowValidationModel().clearRowValidationMap()}navigateAfterEdit($,z){if(!$||!z)return;let{event:Q,suppressNavigateAfterEdit:J}=$;if(!(Q instanceof KeyboardEvent)||J)return;let{key:X,shiftKey:Y}=Q,q=this.gos.get("enterNavigatesVerticallyAfterEdit");if(X!==A.ENTER||!q)return;let G=Y?A.UP:A.DOWN;this.beans.navigation?.navigateToNextCell(null,G,z,!1)}processEdits($,z){let Q=Array.from($.keys()),J=this.model.getCellValidationModel().getCellValidationMap().size>0||this.model.getRowValidationModel().getRowValidationMap().size>0,Z=[],{changeDetectionSvc:X}=this.beans;X?.beginDeferred();try{for(let Y of Q){let q=$.get(Y);for(let G of q.keys()){let _=q.get(G),H={rowNode:Y,column:G};if(B$(_)&&!J){let U=r(this.beans,H);if(!this.setNodeDataValue(Y,G,_.pendingValue,U,z))Z.push(H)}}}}finally{X?.endDeferred()}return Z}setNodeDataValue($,z,Q,J,Z="edit"){let X=HL.has(Z)?"edit":Z;if(J)J.suppressRefreshCell=!0;this.committing=!0;try{return $.setDataValue(z,Q,X)}finally{if(this.committing=!1,J)J.suppressRefreshCell=!1}}syncEditAfterCommit($,z){let Q=this.model.getEdit($);if(Q&&Q.state!=="editing")if(z)this.beans.editModelSvc?.setEdit($,{sourceValue:Q.pendingValue});else this.model.clearEditValue($)}setEditMap($,z){this.strategy??(this.strategy=this.createStrategy()),this.strategy?.setEditMap($,z),this.bulkRefreshMap($);let Q=l$;if(z?.forceRefreshOfEditCellsOnly)Q={...LL($),...l$};this.beans.rowRenderer.refreshCells(Q)}dispatchEditValuesChanged({rowNode:$,column:z},Q={}){if(!$||!z||!Q)return;let{pendingValue:J,sourceValue:Z}=Q,{rowIndex:X,rowPinned:Y,data:q}=$;this.beans.eventSvc.dispatchEvent({type:"cellEditValuesChanged",node:$,rowIndex:X,rowPinned:Y,column:z,source:"api",data:q,newValue:J,oldValue:Z,value:J,colDef:z.getColDef()})}bulkRefreshCell($,z){if(o(this.gos,this.beans.rowModel))this.refCell($,this.model.getEdit($),z)}bulkRefreshMap($,z){if(o(this.gos,this.beans.rowModel))$.forEach((Q,J)=>{for(let Z of Q.keys())this.refCell({rowNode:J,column:Z},Q.get(Z),z)})}refCell({rowNode:$,column:z},Q,J={}){let{beans:Z,gos:X}=this,Y=new Set([$]),q=new Set,G=$.pinnedSibling;if(G)Y.add(G);let _=$.sibling;if(_)q.add(_);let H=$.parent;while(H){if(H.sibling?.footer&&X.get("groupTotalRow"))q.add(H.sibling);else if(!H.parent&&H.sibling&&X.get("grandTotalRow"))q.add(H.sibling);else q.add(H);H=H.parent}for(let U of Y)this.dispatchEditValuesChanged({rowNode:U,column:z},Q);for(let U of Y)r(Z,{rowNode:U,column:z})?.refreshCell(J);for(let U of q){let W=r(Z,{rowNode:U,column:z});if(W){if(W.refreshCell(J),!J.force&&this.batch)W.editStyleFeature?.applyCellStyles?.()}}}stopAllEditing($=!1,z="ui"){if(this.isEditing())this.stopEditing(void 0,{cancel:$,source:z})}isCellEditable($,z="ui"){let{gos:Q,beans:J}=this,Z=$.rowNode;if(Z.group&&$.column.getColDef().groupRowEditable==null){if(Q.get("treeData")){if(!Z.data&&!Q.get("enableGroupEdit"))return!1}else if(!Q.get("enableGroupEdit"))return!1}let X=W6(Q)==="fullRow"?JL(J,$,z):k2(J,$);if(X)this.strategy??(this.strategy=this.createStrategy());return X}cellEditingInvalidCommitBlocks(){return this.gos.get("invalidEditValueMode")==="block"}checkNavWithValidation($,z,Q=!0){if(this.hasValidationErrors($)){let J=r(this.beans,$);if(this.cellEditingInvalidCommitBlocks()){if(z?.preventDefault?.(),Q){if(J&&!J.hasBrowserFocus())J.focusCell();J?.comp?.getCellEditor()?.focusIn?.()}return"block-stop"}if(J)this.revertSingleCellEdit(J);return"revert-continue"}return"continue"}revertSingleCellEdit($,z=!1){let Q=r(this.beans,$);if(!Q?.comp?.getCellEditor())return;if(e$(this.beans,[$],{silent:!0}),this.model.clearEditValue($),gz(this.beans,$,{silent:!0}),Yz(this.beans),Q?.refreshCell(l$),!z)return;Q?.focusCell(),Q?.comp?.getCellEditor()?.focusIn?.()}hasValidationErrors($){Yz(this.beans);let z=r(this.beans,$);if(z)z.refreshCell(l$),z.rowCtrl.rowEditStyleFeature?.applyRowStyles();let Q=!1;if($?.rowNode){if(Q||(Q=this.model.getRowValidationModel().hasRowValidation({rowNode:$.rowNode})),$.column)Q||(Q=this.model.getCellValidationModel().hasCellValidation({rowNode:$.rowNode,column:$.column}))}else Q||(Q=this.model.getCellValidationModel().getCellValidationMap().size>0),Q||(Q=this.model.getRowValidationModel().getRowValidationMap().size>0);return Q}moveToNextCell($,z,Q,J="ui"){let Z,X=this.isEditing(),Y=X&&this.checkNavWithValidation(void 0,Q)==="block-stop";if($ instanceof uQ&&X)Z=this.strategy?.moveToNextEditingCell($,z,Q,J,Y);if(Z===null)return Z;if(Z=Z||!!this.beans.focusSvc.focusedHeader,Z===!1&&!Y)this.stopEditing();return Z}getPendingEditValue($,z,Q){if(Q==="data")return;if(Q==="batch"&&!this.batch)return;let J=this.model.getEdit({rowNode:$,column:z},jz);if(!J)return;if(this.stopping&&!this.batch&&!J.editorState?.cellStartedEditing)return;if(Q==="edit"){let X=J.editorValue;if(X!=null&&X!==P0)return X}let Z=J.pendingValue;if(Z!==P0)return Z;return}getCellDataValue($){let z=this.model.getEdit($,jz);if(z){let Q=z.pendingValue;if(Q!==P0)return Q;let J=z.sourceValue;if(J!=null)return J}return this.valueSvc.getValue($.column,$.rowNode,"data")}addStopEditingWhenGridLosesFocus($){FE(this,this.beans,$)}createPopupEditorWrapper($){return new $L($)}batchResetToSourceValue($){if(!this.batch)return!1;let z=this.model.getEdit($);if(!z)return!1;let{pendingValue:Q,sourceValue:J,state:Z}=z;if(Q===J)return!1;if(Z==="editing")return!1;return this.dispatchEditValuesChanged($,{...z,pendingValue:J}),this.beans.editModelSvc?.removeEdits($),r(this.beans,$)?.refreshCell(l$),!0}setDataValue($,z,Q){try{let J=this.batch,Z=this.isEditing(J?void 0:$);if((!Z||this.committing)&&!J&&!WL.has(Q))return;if(!Z&&!J&&Q==="paste")return;if(Q==="batch"&&!J)return;if(Q==="edit"){if(Z&&this.applyEditorValue($,z))return!0;if(!J)return}if(this.strategy??(this.strategy=this.createStrategy()),Q==="batch"||Q==="edit")return this.applyDirectValue($,z,Q);let X=this.beans,Y;if(J)Y="ui";else if(this.committing)Y=Q??"api";else Y="api";if(!Q||_L.has(Q))return this.applyDirectValue($,z,Q);let q=this.applyExistingEdit($,z,Q,Y);if(q!==void 0)return q;return zQ(X,$,z,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing($,{source:Y,suppressNavigateAfterEdit:!0}),!0}finally{this.committing=!1}}applyExistingEdit($,z,Q,J){let Z=this.model.getEdit($);if(!Z)return;if(Z.pendingValue===z)return!1;if(Z.sourceValue!==z)return zQ(this.beans,$,z,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing($,{source:J,suppressNavigateAfterEdit:!0}),!0;return this.beans.editModelSvc?.removeEdits($),this.ensureBatchStarted(),this.dispatchEditValuesChanged($,{...Z,pendingValue:z}),!0}applyEditorValue($,z){let Q=this.beans,J=r(Q,$),Z=J?.comp?.getCellEditor();if(!J||!Z)return!1;if(zQ(Q,$,z,"edit",void 0,{persist:!0}),J.editStyleFeature?.applyCellStyles?.(),"agSetEditValue"in Z)return Z.agSetEditValue(z),!0;if(Z.refresh&&J.editCompDetails)return Z.refresh({...J.editCompDetails.params,value:z}),!0;if(J.hasBrowserFocus())J.onEditorAttachedFuncs.push(()=>{let Y=r(this.beans,$);Y?.focusCell(!0),Y?.comp?.getCellEditor()?.focusIn?.()});return e$(Q,[$],{silent:!0,cancel:!0}),gz(Q,$,{silent:!0}),Yz(Q),r(Q,$)?.refreshCell(l$),!0}applyDirectValue($,z,Q){let J=this.beans;if(this.batch){if(Q==="batch"&&r(J,$)?.comp?.getCellEditor()){let{editModelSvc:Y,valueSvc:q}=J,{rowNode:G,column:_}=$;if(Y?.getEdit($)?.sourceValue===void 0)Y?.setEdit($,{sourceValue:q.getValue(_,G,"data")});Y?.setEdit($,{pendingValue:z})}else if(zQ(J,$,z,Q,void 0,{persist:!0}),Q!=="batch")this.cleanupEditors();return xQ(J),this.ensureBatchStarted(),this.bulkRefreshCell($),!0}zQ(J,$,z,Q,void 0,{persist:!0});let Z=r(J,$),X=this.setNodeDataValue($.rowNode,$.column,z,Z,Q);return this.syncEditAfterCommit($,X),xQ(J),r(J,$)?.refreshCell(X?EL:l$),X}handleColDefChanged($){SE(this.beans,$)}destroy(){this.model.clear(),this.destroyStrategy(),super.destroy()}prepDetailsDuringBatch($,z){let{model:Q}=this;if(!this.batch)return;if(!Q.hasRowEdits($.rowNode,jz))return;let{rowNode:Z}=$,{compDetails:X,valueToDisplay:Y}=z;if(X){let{params:q}=X;return q.data=Q.getEditRowDataValue(Z,jz),{compDetails:X}}return{valueToDisplay:Y}}cleanupEditors(){this.strategy?.cleanupEditors()}dispatchCellEvent($,z,Q,J){this.strategy?.dispatchCellEvent($,z,Q,J)}dispatchBatchEvent($,z){this.eventSvc.dispatchEvent(this.createBatchEditEvent($,z))}createBatchEditEvent($,z){return y(this.gos,{type:$,...$==="batchEditingStopped"?{changes:this.toEventChangeList(z)}:{}})}toEventChangeList($){return this.model.getEditPositions($).map((z)=>({rowIndex:z.rowNode.rowIndex,rowPinned:z.rowNode.rowPinned,columnId:z.column.getColId(),newValue:z.pendingValue,oldValue:z.sourceValue}))}applyBulkEdit({rowNode:$,column:z},Q){if(!Q||Q.length===0)return;let{beans:J,rangeSvc:Z,valueSvc:X}=this,{formula:Y}=J;$z(J,{persist:!0});let q=this.model.getEditMap(!0),G=q.get($)?.get(z)?.pendingValue,_=!1;if(!this.batch)this.eventSvc.dispatchEvent({type:"bulkEditingStarted"}),_=!0;let H=Y?.isFormula(G)??!1;Q.forEach((W)=>{let B=W.columns.some((E)=>E?.isAllowFormula());if(Z?.forEachRowInRange(W,(E)=>{let K=M0(J,E);if(K===void 0)return;let L=q.get(K)??new Map,D=G;for(let F of W.columns){if(!F)continue;let M=!!H&&F.isAllowFormula();if(this.isCellEditable({rowNode:K,column:F},"api")){let k=X.getValue(F,K,"data",!0),V=X.parseValue(F,K??null,D,k);if(Number.isNaN(V))V=null;L.set(F,{editorValue:void 0,pendingValue:V,sourceValue:k,state:"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}if(M)D=Y?.updateFormulaByOffset({value:D,columnDelta:1})}if(L.size>0)q.set(K,L);if(H&&B)G=Y?.updateFormulaByOffset({value:G,rowDelta:1})}),this.setEditMap(q),this.batch){this.cleanupEditors(),xQ(J),this.ensureBatchStarted();return}this.committing=!0;try{this.stopEditing(void 0,{source:"bulk"})}finally{if(this.committing=!1,_)this.eventSvc.dispatchEvent({type:"bulkEditingStopped",changes:this.toEventChangeList(q)})}});let U=r(J,{rowNode:$,column:z});if(U)U.focusCell(!0)}createCellStyleFeature($){return new ZL($,this.beans)}createRowStyleFeature($){return new XL($,this.beans)}setEditingCells($,z){let{beans:Q}=this,{colModel:J,valueSvc:Z}=Q,X=new Map;for(let{colId:Y,column:q,colKey:G,rowIndex:_,rowPinned:H,newValue:U,state:W}of $){let B=Y?J.getCol(Y):G?J.getCol(G):q;if(!B)continue;let E=M0(Q,{rowIndex:_,rowPinned:H});if(!E)continue;let K=Z.getValue(B,E,"data",!0);if(!z?.forceRefreshOfEditCellsOnly&&!B$({pendingValue:U,sourceValue:K})&&W!=="editing")continue;let L=X.get(E);if(!L)L=new Map,X.set(E,L);if(U===void 0)U=P0;L.set(B,{editorValue:void 0,pendingValue:U,sourceValue:K,state:W??"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}this.setEditMap(X,z)}onCellFocused($){let z=r(this.beans,$);if(!z||!this.isEditing(z,jz))return;let Q=this.model.getEdit(z);if(!Q||!B$(Q))return;let Z=this.getLocaleTextFunc()("ariaPendingChange","Pending Change");this.beans.ariaAnnounce?.announceValue(Z,"pendingChange")}allowedFocusTargetOnValidation($){return r(this.beans,$)}};function LL($){return{rowNodes:$?Array.from($.keys()):void 0,columns:$?[...new Set(Array.from($.values()).flatMap((z)=>Array.from(z.keys())))]:void 0}}function W6($,z){return z??$.get("editType")??"singleCell"}var q9=class extends S{postConstruct(){this.model=this.beans.editModelSvc,this.editSvc=this.beans.editSvc,this.addManagedEventListeners({cellFocused:this.onCellFocusChanged?.bind(this),cellFocusCleared:this.onCellFocusChanged?.bind(this)})}clearEdits($){this.model.clearEditValue($)}onCellFocusChanged($){let z,Q=$.previousParams,{editSvc:J,beans:Z}=this,X=$.type==="cellFocused"?$.sourceEvent:null;if(Q)z=r(Z,Q);let{gos:Y,editModelSvc:q}=Z,G=$.type==="cellFocusCleared";if(J.isEditing(void 0,{withOpenEditor:!0})){let{column:_,rowIndex:H,rowPinned:U}=$,W={column:_,rowNode:M0(Z,{rowIndex:H,rowPinned:U})},B=Y.get("invalidEditValueMode")==="block";if(B)return;let E=!B,K=!!q?.getCellValidationModel().hasCellValidation(W),L=E&&K;if(!(Q||G?J.stopEditing(void 0,{cancel:L,source:G&&E?"api":void 0,event:X}):!0))if(J.isBatchEditing())J.cleanupEditors();else J.stopEditing(void 0,{source:"api"})}z?.refreshCell({suppressFlash:!0,force:!0})}stopCancelled($){let z=this.editSvc.isBatchEditing()&&!$;for(let Q of this.model.getEditPositions())$1(this.beans,Q,{cancel:!0},r(this.beans,Q)),this.model.stop(Q,z,!0);return!0}stopCommitted($,z){let Q=this.model.getEditPositions(),J={all:[],pass:[],fail:[]};for(let Y of Q)if(J.all.push(Y),(this.model.getCellValidationModel().getCellValidation(Y)?.errorMessages?.length??0)>0)J.fail.push(Y);else J.pass.push(Y);let Z=this.processValidationResults(J),X=this.editSvc.isBatchEditing()&&!z;for(let Y of Z.destroy)$1(this.beans,Y,{event:$},r(this.beans,Y)),this.model.stop(Y,X,!1);for(let Y of Z.keep){let q=r(this.beans,Y);if(!this.editSvc.cellEditingInvalidCommitBlocks()&&q)this.editSvc.revertSingleCellEdit(q)}return!0}cleanupEditors({rowNode:$}={},z){$z(this.beans,{persist:!1});let Q=this.model.getEditPositions(),J=[];if($){for(let Z of Q)if(Z.rowNode!==$)J.push(Z)}else for(let Z of Q)J.push(Z);e$(this.beans,J),xQ(this.beans,z)}setFocusOutOnEditor($){$.comp?.getCellEditor()?.focusOut?.()}setFocusInOnEditor($){let z=$.comp,Q=z?.getCellEditor();if(Q?.focusIn)Q.focusIn();else{let J=this.beans.gos.get("editType")==="fullRow";$.focusCell(J),$.onEditorAttachedFuncs.push(()=>z?.getCellEditor()?.focusIn?.())}}setupEditors($){let{event:z,ignoreEventKey:Q=!1,startedEdit:J,position:Z,cells:X=this.model.getEditPositions()}=$,Y=z instanceof KeyboardEvent&&!Q&&z.key||void 0;kE(this.beans,X,Z,Y,z,J)}dispatchCellEvent($,z,Q,J){let Z=r(this.beans,$);if(Z)this.eventSvc.dispatchEvent({...Z.createEvent(z??null,Q),...J})}dispatchRowEvent($,z,Q){if(Q)return;let J=WJ(this.beans,$);if(J)this.eventSvc.dispatchEvent(J.createRowEvent(z))}shouldStop($,z,Q="ui"){let J=this.editSvc.isBatchEditing();if(J&&Q==="api")return!0;if(J&&(Q==="ui"||Q==="edit"))return!1;if(Q==="api")return!0;if(z instanceof KeyboardEvent&&!J)return z.key===A.ENTER;return null}shouldCancel($,z,Q="ui"){let J=this.editSvc.isBatchEditing();if(z instanceof KeyboardEvent&&!J){if(z.key===A.ESCAPE)return!0}if(J&&Q==="api")return!0;if(Q==="api")return!0;return!1}setEditMap($,z){if(!z?.update)this.editSvc.stopEditing(void 0,{cancel:!0,source:"api"});let Q=[];if($.forEach((J,Z)=>{J.forEach((X,Y)=>{if(X.state==="editing")Q.push({...X,rowNode:Z,column:Y})})}),z?.update)$=new Map([...this.model.getEditMap(),...$]);if(this.model?.setEditMap($),Q.length>0){let J=Q.at(-1),Z=J.pendingValue===P0?void 0:J.pendingValue;this.start({position:J,event:new KeyboardEvent("keydown",{key:Z}),source:"api"});let X=r(this.beans,J);if(X)this.setFocusInOnEditor(X)}}destroy(){this.cleanupEditors(),super.destroy()}},DL=class extends q9{constructor(){super(...arguments);this.beanName="fullRow",this.startedRows=new Set}shouldStop($,z,Q="ui"){let{rowNode:J,beans:Z}=this,{rowNode:X}=$||{};if(!WJ(Z,{rowNode:J}))return!0;let q=super.shouldStop({rowNode:J},z,Q);if(q!==null)return q;if(!J)return!1;return X!==J}midBatchInputsAllowed({rowNode:$}){if(!$)return!1;return this.model.hasEdits({rowNode:$})}clearEdits($){this.model.clearEditValue($)}start($){let{position:z,silent:Q,startedEdit:J,event:Z,ignoreEventKey:X}=$,{rowNode:Y}=z,{beans:q,model:G,startedRows:_}=this;if(this.rowNode!==Y)super.cleanupEditors(z);let H=q.visibleCols.allCols,U=[],W=[];for(let B of H)if(B.isCellEditable(Y))W.push(B);if(W.length==0)return;if(!_.has(Y))this.dispatchRowEvent({rowNode:Y},"rowEditingStarted",Q),_.add(Y);for(let B of W){let E={rowNode:Y,column:B};U.push(E),G.start(E)}this.rowNode=Y,this.setupEditors({cells:U,position:z,startedEdit:J,event:Z,ignoreEventKey:X})}processValidationResults($){if($.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:$.all};return{destroy:$.all,keep:[]}}stopCancelled($){let{rowNode:z,model:Q}=this;if(z&&!Q.hasRowEdits(z))return!1;return super.stopCancelled($),this.cleanupEditors({rowNode:z},!0),this.rowNode=void 0,!0}stopCommitted($,z){let{rowNode:Q,beans:J,model:Z,editSvc:X}=this;if(Q&&!Z.hasRowEdits(Q))return!1;let Y=[];if(Z.getEditMap().forEach((q,G)=>{if(!q||q.size===0)return;for(let _ of q.values())if(B$(_)){Y.push(G);break}}),Yz(J),X.checkNavWithValidation({rowNode:Q})==="block-stop")return!1;if(super.stopCommitted($,z),z||!X.isBatchEditing())for(let q of Y)this.dispatchRowEvent({rowNode:q},"rowValueChanged");return this.cleanupEditors({rowNode:Q},!0),this.rowNode=void 0,!0}onCellFocusChanged($){let{rowIndex:z}=$,Q=$.previousParams;if(Q?.rowIndex===z||$.sourceEvent instanceof KeyboardEvent)return;let{beans:J,gos:Z,model:X}=this;if(J.editSvc?.isRangeSelectionEnabledWhileEditing())return;let Y=r(J,Q);if(Z.get("invalidEditValueMode")==="block"&&Y&&(X.getCellValidationModel().getCellValidation(Y)||X.getRowValidationModel().getRowValidation(Y)))return;super.onCellFocusChanged($)}cleanupEditors($={},z){super.cleanupEditors($,z);let{startedRows:Q}=this;for(let J of Q)this.dispatchRowEvent({rowNode:J},"rowEditingStopped"),this.destroyEditorsForRow(J);Q.clear()}destroyEditorsForRow($){let z=WJ(this.beans,{rowNode:$});if(!z)return;let Q={};for(let J of z.getAllCellCtrls())if(J.comp?.getCellEditor())$1(this.beans,J,Q,J)}moveToNextEditingCell($,z,Q,J="ui",Z=!1){let{beans:X,model:Y,gos:q,editSvc:G}=this,_=$.cellPosition,H;Y.suspend(!0);try{H=X.navigation?.findNextCellToFocusOn(_,{backwards:z,startEditing:!0,skipToNextEditableCell:!1})}finally{Y.suspend(!1)}if(H===!1)return null;if(H==null)return!1;let U=H.cellPosition,W=$.isCellEditable(),B=H.isCellEditable(),E=U&&_.rowIndex===U.rowIndex&&_.rowPinned===U.rowPinned;if(W)this.setFocusOutOnEditor($);this.restoreEditors();let K=q.get("suppressStartEditOnTab");if(B&&!Z)if(K)H.focusCell(!0,Q);else{if(!H.comp?.getCellEditor())gz(X,H,{event:Q,cellStartedEdit:!0});this.setFocusInOnEditor(H),H.focusCell(!1,Q)}else{if(B&&Z)this.setFocusInOnEditor(H);H.focusCell(!0,Q)}if(!E&&!Z){if(G?.stopEditing({rowNode:$.rowNode},{event:Q,forceStop:!0}),G?.isRowEditing($.rowNode,{withOpenEditor:!0}))this.cleanupEditors(H,!0);if(K)H.focusCell(!0,Q);else G.startEditing(H,{startedEdit:!0,event:Q,source:J,ignoreEventKey:!0,editable:B||void 0})}return $.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}restoreEditors(){let{beans:$,model:z}=this;z.getEditMap().forEach((Q,J)=>Q.forEach(({state:Z},X)=>{if(Z!=="editing")return;let Y=r($,{rowNode:J,column:X});if(Y&&!Y.comp?.getCellEditor())gz($,Y,{silent:!0})}))}destroy(){super.destroy(),this.rowNode=void 0,this.startedRows.clear()}},FL=class extends q9{constructor(){super(...arguments);this.beanName="singleCell"}shouldStop($,z,Q="ui"){let J=super.shouldStop($,z,Q);if(J!==null)return J;let Z=$?.rowNode,X=$?.column,Y=this.rowNode,q=this.column;if((!Y||!q)&&Z&&X)return null;if(Y!==Z||q!==X)return!0;if(!Y&&!q)return this.model.hasEdits(void 0,{withOpenEditor:!0});return!1}midBatchInputsAllowed($){return this.model.hasEdits($)}start($){let{position:z,startedEdit:Q,event:J,ignoreEventKey:Z}=$;if(this.rowNode!==z.rowNode||this.column!==z.column)super.cleanupEditors();this.rowNode=z.rowNode,this.column=z.column,this.model.start(z),this.setupEditors({cells:[z],position:z,startedEdit:Q,event:J,ignoreEventKey:Z})}dispatchRowEvent($,z,Q){}processValidationResults($){if($.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:$.all};return{destroy:$.all,keep:[]}}stopCancelled($){return super.stopCancelled($),this.clearPosition()}stopCommitted($,z){return super.stopCommitted($,z),this.clearPosition()}clearPosition(){return this.rowNode=void 0,this.column=void 0,!0}onCellFocusChanged($){let{colModel:z,editSvc:Q}=this.beans,{rowIndex:J,column:Z,rowPinned:X}=$,Y=M0(this.beans,{rowIndex:J,rowPinned:X}),q=K2(Z),G=z.getCol(q),_=$.previousParams;if(_){let H=K2(_.column);if(_?.rowIndex===J&&H===q&&_?.rowPinned===X)return}if($.type=="cellFocused"&&(Q?.isRangeSelectionEnabledWhileEditing()||Q?.isEditing({rowNode:Y,column:G},{withOpenEditor:!0})))return;super.onCellFocusChanged($)}moveToNextEditingCell($,z,Q,J="ui",Z=!1){let X=this.beans.focusSvc.getFocusedCell();if(X)$=e0(this.beans,X)??$;let Y=$.cellPosition,q,G=this.beans.gos.get("editType")==="fullRow";if(G)this.model.suspend(!0);if(!Z)$.eGui.focus(),this.editSvc?.stopEditing($,{source:this.editSvc?.isBatchEditing()?"ui":"api",event:Q});try{q=this.beans.navigation?.findNextCellToFocusOn(Y,{backwards:z,startEditing:!0})}finally{if(G)this.model.suspend(!1)}if(q===!1)return null;if(q==null)return!1;let _=q.cellPosition,H=$.isCellEditable(),U=q.isCellEditable(),W=_&&Y.rowIndex===_.rowIndex&&Y.rowPinned===_.rowPinned;if(H&&!Z)this.setFocusOutOnEditor($);let B=this.gos.get("suppressStartEditOnTab"),E=!1;if(!W&&!Z)if(super.cleanupEditors(q,!0),B)q.focusCell(!0,Q);else E=!0,this.editSvc.startEditing(q,{startedEdit:!0,event:Q,source:J,ignoreEventKey:!0,editable:U});if(U&&!Z){if(q.focusCell(!1,Q),B)q.focusCell(!0,Q);else if(!q.comp?.getCellEditor()){if(!E){let K=this.editSvc?.isEditing(q,{withOpenEditor:!0});gz(this.beans,q,{event:Q,cellStartedEdit:!0,silent:K})}this.setFocusInOnEditor(q),this.cleanupEditors(q)}}else{if(U&&Z)this.setFocusInOnEditor(q);q.focusCell(!0,Q)}return $.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}destroy(){super.destroy(),this.rowNode=void 0,this.column=void 0}},ML={moduleName:"EditCore",version:p,beans:[DE,KL],apiFunctions:{getEditingCells:sK,getEditRowValues:tK,getCellEditorInstances:ME,startEditingCell:aK,stopEditing:rK,isEditing:lK,validateEdit:oK},dynamicBeans:{singleCell:FL,fullRow:DL},dependsOn:[nz,mK],css:[cK]};var G9={moduleName:"TextEditor",version:p,userComponents:{agCellEditor:U6,agTextCellEditor:U6},dependsOn:[ML]};var _9={agSetColumnFilter:"agSetColumnFilterHandler",agMultiColumnFilter:"agMultiColumnFilterHandler",agGroupColumnFilter:"agGroupColumnFilterHandler",agNumberColumnFilter:"agNumberColumnFilterHandler",agBigIntColumnFilter:"agBigIntColumnFilterHandler",agDateColumnFilter:"agDateColumnFilterHandler",agTextColumnFilter:"agTextColumnFilterHandler"},kL=new Set(Object.values(_9));function a$($,z){let Q=$.filterUi;if(!Q)return null;if(Q.created)return Q.promise;if(z)return null;let J=Q.create(Q.refreshed),Z=Q;return Z.created=!0,Z.promise=J,J}function sJ($,z,Q,J,Z,X,Y){return z.refresh?.({...Q,model:J,source:X,additionalEventAttributes:Y}),$().then((q)=>{if(q){let{filter:G,filterParams:_}=q;SQ(G,_,J,Z,X,Y)}})}function SQ($,z,Q,J,Z,X){$?.refresh?.({...z,model:Q,state:J,source:Z,additionalEventAttributes:X})}function H9($,z,Q,J){let Z=$();if(Z?.created)Z.promise.then((X)=>{let Y=z();SQ(X,Z.filterParams,Y,Q()??{model:Y},"ui",J)})}function LJ($){let z,Q=!1,J,{action:Z,filterParams:X,getFilterUi:Y,getModel:q,getState:G,updateState:_,updateModel:H,processModelToApply:U}=$;switch(Z){case"apply":{let W=G();if(J=W?.model??null,U)J=U(J);z={state:W?.state,model:J},Q=!0;break}case"clear":{if(z={model:null},!X?.buttons?.includes("apply"))Q=!0,J=null;break}case"reset":{z={model:null},Q=!0,J=null;break}case"cancel":{z={model:q()};break}}if(_(z),Q)H(J);else H9(Y,q,G,{fromAction:Z})}function D0($,z){return $[z]??null}var VL=class extends Z4{constructor(){super(...arguments);this.iconCreated=!1}wireComp($,z,Q,J,Z){this.comp=$;let X=B1(this,this.beans.context,Z);this.eButtonShowMainFilter=Q,this.eFloatingFilterBody=J,this.setGui(z,X),this.setupActive(),this.refreshHeaderStyles(),this.setupWidth(X),this.setupLeft(X),this.setupHover(X),this.setupFocus(X),this.setupAria(),this.setupFilterButton(),this.setupUserComp(),this.setupSyncWithFilter(X),this.setupUi(),X.addManagedElementListeners(this.eButtonShowMainFilter,{click:this.showParentFilter.bind(this)}),this.setupFilterChangedListener(X);let Y=()=>this.onColDefChanged(X);X.addManagedListeners(this.column,{colDefChanged:Y}),X.addManagedEventListeners({filterSwitched:({column:q})=>{if(q===this.column)Y()}}),X.addDestroyFunc(()=>{this.eButtonShowMainFilter=null,this.eFloatingFilterBody=null,this.userCompDetails=null,this.clearComponent()})}resizeHeader(){}moveHeader(){}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.colDef;return y(z.gos,{colDef:Q,column:$,floatingFilter:!0})}setupActive(){let $=this.column.getColDef(),z=!!$.filter,Q=!!$.floatingFilter;this.active=z&&Q}setupUi(){if(this.comp.setButtonWrapperDisplayed(!this.suppressFilterButton&&this.active),this.comp.addOrRemoveBodyCssClass("ag-floating-filter-full-body",this.suppressFilterButton),this.comp.addOrRemoveBodyCssClass("ag-floating-filter-body",!this.suppressFilterButton),!this.active||this.iconCreated)return;let $=h("filter",this.beans,this.column);if($)this.iconCreated=!0,this.eButtonShowMainFilter.appendChild($)}setupFocus($){$.createManagedBean(new c$(this.eGui,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)}))}setupAria(){let $=this.getLocaleTextFunc();E0(this.eButtonShowMainFilter,$("ariaFilterMenuOpen","Open Filter Menu"))}onTabKeyDown($){let{beans:z}=this;if(d(z)===this.eGui)return;let Z=j0(z,this.eGui,null,$.shiftKey);if(Z){z.headerNavigation?.scrollToColumn(this.column),$.preventDefault(),Z.focus();return}let X=this.findNextColumnWithFloatingFilter($.shiftKey);if(!X)return;if(z.focusSvc.focusHeaderPosition({headerPosition:{headerRowIndex:this.rowCtrl.rowIndex,column:X},event:$}))$.preventDefault()}findNextColumnWithFloatingFilter($){let z=this.beans.visibleCols,Q=this.column;do if(Q=$?z.getColBefore(Q):z.getColAfter(Q),!Q)break;while(!Q.getColDef().filter||!Q.getColDef().floatingFilter);return Q}handleKeyDown($){super.handleKeyDown($);let z=this.getWrapperHasFocus();switch($.key){case A.UP:case A.DOWN:case A.LEFT:case A.RIGHT:if(z)return;i0($);case A.ENTER:if(z){if(F0(this.eGui))$.preventDefault()}break;case A.ESCAPE:if(!z)this.eGui.focus()}}onFocusIn($){if(this.eGui.contains($.relatedTarget))return;let Q=!!$.relatedTarget&&!$.relatedTarget.classList.contains("ag-floating-filter"),J=!!$.relatedTarget&&vz($.relatedTarget,"ag-floating-filter");if(Q&&J&&$.target===this.eGui){let Z=this.lastFocusEvent,X=!!(Z&&Z.key===A.TAB);if(Z&&X){let Y=Z.shiftKey;F0(this.eGui,Y)}}this.focusThis()}setupHover($){this.beans.colHover?.addHeaderFilterColumnHoverListener($,this.comp,this.column,this.eGui)}setupLeft($){let z=new J4(this.column,this.eGui,this.beans);$.createManagedBean(z)}setupFilterButton(){this.suppressFilterButton=!this.beans.menuSvc?.isFloatingFilterButtonEnabled(this.column),this.highlightFilterButtonWhenActive=!U0(this.gos)}setupUserComp(){if(!this.active)return;let $=this.beans.colFilter?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter());if($)this.setCompDetails($)}setCompDetails($){this.userCompDetails=$,this.comp.setCompDetails($)}showParentFilter(){let $=this.suppressFilterButton?this.eFloatingFilterBody:this.eButtonShowMainFilter;this.beans.menuSvc?.showFilterMenu({column:this.column,buttonElement:$,containerType:"floatingFilter",positionBy:"button"})}setupSyncWithFilter($){if(!this.active)return;let{beans:{colFilter:z},column:Q,gos:J}=this,Z=(X)=>{if(X?.source==="filterDestroyed"&&(!this.isAlive()||!z?.isAlive()))return;let Y=this.comp.getFloatingFilterComp();if(!Y)return;Y.then((q)=>{if(q){if(J.get("enableFilterHandlers")){let H=X,U="filter";if(H?.afterFloatingFilter)U="ui";else if(H?.afterDataChange)U="dataChanged";else if(X?.source==="api")U="api";this.updateFloatingFilterParams(this.userCompDetails,U);return}let G=z?.getCurrentFloatingFilterParentModel(Q),_=X?{...X,columns:X.columns??[],source:X.source==="api"?"api":"columnFilter"}:null;q.onParentModelChanged(G,_)}})};if([this.destroySyncListener]=$.addManagedListeners(Q,{filterChanged:Z}),z?.isFilterActive(Q))Z(null)}setupWidth($){let z=()=>{let Q=`${this.column.getActualWidth()}px`;this.comp.setWidth(Q)};$.addManagedListeners(this.column,{widthChanged:z}),z()}setupFilterChangedListener($){if(this.active)[this.destroyFilterChangedListener]=$.addManagedListeners(this.column,{filterChanged:this.updateFilterButton.bind(this)}),this.updateFilterButton()}updateFilterButton(){if(!this.suppressFilterButton&&this.comp){let $=!!this.beans.filterManager?.isFilterAllowed(this.column);if(this.comp.setButtonWrapperDisplayed($),this.highlightFilterButtonWhenActive&&$)this.eButtonShowMainFilter.classList.toggle("ag-filter-active",this.column.isFilterActive())}}onColDefChanged($){let z=this.active;this.setupActive();let Q=!z&&this.active;if(z&&!this.active)this.destroySyncListener(),this.destroyFilterChangedListener();let J=this.beans.colFilter,Z=this.active?J?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter()):null,X=this.comp.getFloatingFilterComp();if(!X||!Z)this.updateCompDetails($,Z,Q);else X.then((Y)=>{if(!Y||J?.areFilterCompsDifferent(this.userCompDetails??null,Z))this.updateCompDetails($,Z,Q);else this.updateFloatingFilterParams(Z,"colDef")})}updateCompDetails($,z,Q){if(!this.isAlive())return;if(this.setCompDetails(z),this.setupFilterButton(),this.setupUi(),Q)this.setupSyncWithFilter($),this.setupFilterChangedListener($)}updateFloatingFilterParams($,z){if(!$)return;let Q=$.params;this.comp.getFloatingFilterComp()?.then((J)=>{if(typeof J?.refresh==="function"){if(this.gos.get("enableFilterHandlers"))Q={...Q,model:D0(this.beans.colFilter?.model??{},this.column.getColId()),source:z};J.refresh(Q)}})}addResizeAndMoveKeyboardListeners(){}destroy(){super.destroy(),this.destroySyncListener=null,this.destroyFilterChangedListener=null}};function AL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}$.menuSvc?.showColumnMenu({column:Q,positionBy:"auto"})}function SL($){$.menuSvc?.hidePopupMenu()}var RL=class extends S{constructor(){super(...arguments);this.beanName="menuSvc"}postConstruct(){let{enterpriseMenuFactory:$,filterMenuFactory:z}=this.beans;this.activeMenuFactory=$??z}showColumnMenu($){this.showColumnMenuCommon(this.activeMenuFactory,$,"columnMenu")}showFilterMenu($){this.showColumnMenuCommon(B6(this.beans),$,$.containerType,!0)}showHeaderContextMenu($,z,Q){this.activeMenuFactory?.showMenuAfterContextMenuEvent($,z,Q)}hidePopupMenu(){this.beans.contextMenuSvc?.hideActiveMenu(),this.activeMenuFactory?.hideActiveMenu()}hideFilterMenu(){B6(this.beans)?.hideActiveMenu()}isColumnMenuInHeaderEnabled($){let{suppressHeaderMenuButton:z}=$.getColDef();return!z&&!!this.activeMenuFactory?.isMenuEnabled($)&&(U0(this.gos)||!!this.beans.enterpriseMenuFactory)}isFilterMenuInHeaderEnabled($){return!$.getColDef().suppressHeaderFilterButton&&!!this.beans.filterManager?.isFilterAllowed($)}isHeaderContextMenuEnabled($){return!($&&Q$($)?$.getColDef():$?.getColGroupDef())?.suppressHeaderContextMenu&&this.gos.get("columnMenu")==="new"}isHeaderMenuButtonAlwaysShowEnabled(){return this.isSuppressMenuHide()}isHeaderMenuButtonEnabled(){let $=!this.isSuppressMenuHide();return!(bz()&&$)}isHeaderFilterButtonEnabled($){return this.isFilterMenuInHeaderEnabled($)&&!U0(this.gos)&&!this.isFloatingFilterButtonDisplayed($)}isFilterMenuItemEnabled($){return!!this.beans.filterManager?.isFilterAllowed($)&&!U0(this.gos)&&!this.isFilterMenuInHeaderEnabled($)&&!this.isFloatingFilterButtonDisplayed($)}isFloatingFilterButtonEnabled($){return!$.getColDef().suppressFloatingFilterButton}isFloatingFilterButtonDisplayed($){return!!$.getColDef().floatingFilter&&this.isFloatingFilterButtonEnabled($)}isSuppressMenuHide(){let $=this.gos,z=$.get("suppressMenuHide");if(U0($))return $.exists("suppressMenuHide")?z:!1;return z}showColumnMenuCommon($,z,Q,J){let{positionBy:Z,onClosedCallback:X}=z,Y=z.column;if(Z==="button"){let{buttonElement:q}=z;$?.showMenuAfterButtonClick(Y,q,Q,X,J)}else if(Z==="mouse"){let{mouseEvent:q}=z;$?.showMenuAfterMouseEvent(Y,q,Q,X,J)}else if(Y){let q=this.beans,G=q.ctrlsSvc;G.getScrollFeature().ensureColumnVisible(Y,"auto"),Y$(q,()=>{let _=G.getHeaderRowContainerCtrl(Y.getPinned())?.getHeaderCtrlForColumn(Y);if(_)$?.showMenuAfterButtonClick(Y,_.getAnchorElementForMenu(J),Q,X,J)})}}};function z1($,z,Q){if($.menuVisible!==z)$.menuVisible=z,$.dispatchColEvent("menuVisibleChanged",Q)}function B6($){let{enterpriseMenuFactory:z,filterMenuFactory:Q,gos:J}=$;return z&&U0(J)?z:Q}var O4={moduleName:"SharedMenu",version:p,beans:[RL],apiFunctions:{showColumnMenu:AL,hidePopupMenu:SL}},jL=".ag-set-filter{--ag-indentation-level:0}.ag-set-filter-item{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-set-filter-item{padding-left:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}:where(.ag-rtl) .ag-set-filter-item{padding-right:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}.ag-set-filter-item-checkbox{display:flex;height:100%;width:100%}.ag-set-filter-group-icons{display:block;:where(.ag-set-filter-group-closed-icon),:where(.ag-set-filter-group-indeterminate-icon),:where(.ag-set-filter-group-opened-icon){cursor:pointer}}:where(.ag-ltr) .ag-set-filter-group-icons{margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-set-filter-group-icons{margin-left:var(--ag-widget-container-horizontal-padding)}.ag-filter-body-wrapper{display:flex;flex-direction:column}:where(.ag-menu:not(.ag-tabs) .ag-filter) .ag-filter-body-wrapper{min-width:180px}.ag-filter-filter{flex:1 1 0px}.ag-filter-condition{display:flex;justify-content:center}.ag-floating-filter-body{display:flex;flex:1 1 auto;height:100%;position:relative}.ag-floating-filter-full-body{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;width:100%}.ag-floating-filter-input{align-items:center;display:flex;width:100%;>:where(.ag-date-floating-filter-wrapper),>:where(.ag-floating-filter-input),>:where(.ag-input-field){flex:1 1 auto}:where(.ag-input-field-input[type=date]),:where(.ag-input-field-input[type=datetime-local]){width:1px}}.ag-floating-filter-button{display:flex;flex:none}.ag-date-floating-filter-wrapper{display:flex}.ag-set-floating-filter-input :where(.ag-input-field-input)[disabled]{pointer-events:none}.ag-floating-filter-button-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;height:var(--ag-icon-size);width:var(--ag-icon-size)}.ag-filter-loading{align-items:unset;background-color:var(--ag-chrome-background-color);height:100%;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;width:100%;z-index:1;:where(.ag-menu) &{background-color:var(--ag-menu-background-color)}}.ag-filter-separator{border-top:solid var(--ag-border-width) var(--menu-separator-color)}:where(.ag-filter-select) .ag-picker-field-wrapper{width:0}.ag-filter-condition-operator{height:17px}:where(.ag-ltr) .ag-filter-condition-operator-or{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-condition-operator-or{margin-right:calc(var(--ag-spacing)*2)}.ag-set-filter-select-all{padding-top:var(--ag-widget-container-vertical-padding)}.ag-filter-no-matches,.ag-set-filter-list{height:calc(var(--ag-list-item-height)*6)}.ag-filter-no-matches{padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}.ag-set-filter-tree-list{height:calc(var(--ag-list-item-height)*10)}.ag-set-filter-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-container-vertical-padding)}.ag-filter-to{margin-top:var(--ag-widget-vertical-spacing)}.ag-mini-filter{margin:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-set-filter-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-rtl) .ag-set-filter-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-filter-menu) .ag-set-filter-list{min-width:200px}.ag-filter-virtual-list-item:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-filter-apply-panel{display:flex;justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) var(--ag-widget-container-vertical-padding)}.ag-filter-apply-panel-button{line-height:1.5}:where(.ag-ltr) .ag-filter-apply-panel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-apply-panel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-simple-filter-body-wrapper{display:flex;flex-direction:column;gap:var(--ag-widget-vertical-spacing);min-height:calc(var(--ag-list-item-height) + var(--ag-widget-container-vertical-padding) + var(--ag-widget-vertical-spacing));overflow-y:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);padding-bottom:var(--ag-widget-container-vertical-padding);:where(.ag-resizer-wrapper){margin:0}}.ag-multi-filter-menu-item{margin:var(--ag-spacing) 0}.ag-multi-filter-group-title-bar{background-color:transparent;color:var(--ag-header-text-color);font-weight:500;padding:calc(var(--ag-spacing)*1.5) var(--ag-spacing)}.ag-group-filter-field-select-wrapper{display:flex;flex-direction:column;gap:var(--ag-widget-vertical-spacing);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}";function fL($){let z=$.filterManager;return!!z?.isColumnFilterPresent()||!!z?.isAggregateFilterPresent()}function OL($,z){return $.filterManager?.getColumnFilterInstance(z)??Promise.resolve(void 0)}function PL($,z){let Q=$.colModel.getColDefCol(z);if(Q)return $.colFilter?.destroyFilter(Q,"api")}function TL($,z){$.frameworkOverrides.wrapIncoming(()=>$.filterManager?.setFilterModel(z))}function vL($){return $.filterManager?.getFilterModel()??{}}function IL($,z,Q){let{gos:J,colModel:Z,colFilter:X}=$;if(Q&&!J.get("enableFilterHandlers"))j(288),Q=!1;let Y=Z.getColDefCol(z);return Y?X?.getModelForColumn(Y,Q)??null:null}function CL($,z,Q){return $.filterManager?.setColumnFilterModel(z,Q)??Promise.resolve()}function bL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}$.menuSvc?.showFilterMenu({column:Q,containerType:"columnFilter",positionBy:"auto"})}function yL($){$.menuSvc?.hideFilterMenu()}function xL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}return $.colFilter?.getHandler(Q,!0)}function wL($,z){let{colModel:Q,colFilter:J,gos:Z}=$;if(!Z.get("enableFilterHandlers")){j(287);return}let{colId:X,action:Y}=z;if(X){let q=Q.getColById(X);if(q)J?.updateModel(q,Y)}else J?.updateAllModels(Y)}var E6={january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},K6=["january","february","march","april","may","june","july","august","september","october","november","december"];function NL($,z){if($==null)return-1;if(z==null)return 1;return Number.parseFloat($)-Number.parseFloat(z)}function gL($,z){if($==null)return-1;if(z==null)return 1;let Q=Gz($),J=Gz(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return String($).localeCompare(String(z))}function L6($){return $ instanceof Date&&!isNaN($.getTime())}var V2={number:()=>{return},bigint:()=>{return},boolean:()=>({maxNumConditions:1,debounceMs:0,filterOptions:["empty",{displayKey:"true",displayName:"True",predicate:($,z)=>z,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:($,z)=>z===!1,numberOfInputs:0}]}),date:()=>({isValidDate:L6}),dateString:({dataTypeDefinition:$})=>({comparator:(z,Q)=>{let J=$.dateParser(Q);if(Q==null||Jz)return 1;return 0},isValidDate:(z)=>typeof z==="string"&&L6($.dateParser(z))}),dateTime:($)=>V2.date($),dateTimeString:($)=>V2.dateString($),object:()=>{return},text:()=>{return}},A2={number:()=>({comparator:NL}),bigint:()=>({comparator:gL}),boolean:({t:$})=>({valueFormatter:(z)=>T(z.value)?$(String(z.value),z.value?"True":"False"):$("blanks","(Blanks)")}),date:({formatValue:$,t:z})=>({valueFormatter:(Q)=>{let J=$(Q);return T(J)?J:z("blanks","(Blanks)")},treeList:!0,treeListFormatter:(Q,J)=>{if(Q==="NaN")return z("invalidDate","Invalid Date");if(J===1&&Q!=null){let Z=K6[Number(Q)-1];return z(Z,E6[Z])}return Q??z("blanks","(Blanks)")},treeListPathGetter:(Q)=>ZQ(Q,!1)}),dateString:({formatValue:$,dataTypeDefinition:z,t:Q})=>({valueFormatter:(J)=>{let Z=$(J);return T(Z)?Z:Q("blanks","(Blanks)")},treeList:!0,treeListPathGetter:(J)=>ZQ(z.dateParser(J??void 0),!1),treeListFormatter:(J,Z)=>{if(Z===1&&J!=null){let X=K6[Number(J)-1];return Q(X,E6[X])}return J??Q("blanks","(Blanks)")}}),dateTime:($)=>{let z=A2.date($);return z.treeListPathGetter=ZQ,z},dateTimeString($){let z=$.dataTypeDefinition.dateParser,Q=A2.dateString($);return Q.treeListPathGetter=(J)=>ZQ(z(J??void 0)),Q},object:({formatValue:$,t:z})=>({valueFormatter:(Q)=>{let J=$(Q);return T(J)?J:z("blanks","(Blanks)")}}),text:()=>{return}};function P4($,z,Q,J,Z,X,Y){let q=z,G=Q,_=$==="agSetColumnFilter";if(!G&&J.baseDataType==="object"&&!_)G=({column:B,node:E})=>Z({column:B,node:E,value:X.valueSvc.getValue(B,E,"data")});let U=(_?A2:V2)[J.baseDataType],W=U({dataTypeDefinition:J,formatValue:Z,t:Y});return q=typeof z==="object"?{...W,...z}:W,{filterParams:q,filterValueGetter:G}}var hL={boolean:"agTextColumnFilter",date:"agDateColumnFilter",dateString:"agDateColumnFilter",dateTime:"agDateColumnFilter",dateTimeString:"agDateColumnFilter",bigint:"agBigIntColumnFilter",number:"agNumberColumnFilter",object:"agTextColumnFilter",text:"agTextColumnFilter"},uL={boolean:"agTextColumnFloatingFilter",date:"agDateColumnFloatingFilter",dateString:"agDateColumnFloatingFilter",dateTime:"agDateColumnFloatingFilter",dateTimeString:"agDateColumnFloatingFilter",bigint:"agBigIntColumnFloatingFilter",number:"agNumberColumnFloatingFilter",object:"agTextColumnFloatingFilter",text:"agTextColumnFloatingFilter"};function T4($,z=!1){return(z?uL:hL)[$??"text"]}function v4($,z,Q){if(z==null)return null;let J=null,{compName:Z,jsComp:X,fwComp:Y}=j7($,z);if(Z)J={agSetColumnFilter:"agSetColumnFloatingFilter",agMultiColumnFilter:"agMultiColumnFloatingFilter",agGroupColumnFilter:"agGroupColumnFloatingFilter",agNumberColumnFilter:"agNumberColumnFloatingFilter",agBigIntColumnFilter:"agBigIntColumnFloatingFilter",agDateColumnFilter:"agDateColumnFloatingFilter",agTextColumnFilter:"agTextColumnFloatingFilter"}[Z];else if(X==null&&Y==null&&z.filter===!0)J=Q();return J}var mL={filterHandler:()=>({doesFilterPass:()=>!0})};function D6($,z,Q,J){if(!$.isPrimary())return!0;let X=!Q;if(!$.isValueActive()||!X)return!1;if(z)return!0;return J}var cL=class extends S{constructor(){super(...arguments);this.beanName="colFilter",this.allColumnFilters=new Map,this.allColumnListeners=new Map,this.activeAggregateFilters=[],this.activeColumnFilters=[],this.processingFilterChange=!1,this.modelUpdates=[],this.columnModelUpdates=[],this.state=new Map,this.handlerMap={..._9},this.isGlobalButtons=!1,this.activeFilterComps=new Set}postConstruct(){this.addManagedEventListeners({gridColumnsChanged:this.onColumnsChanged.bind(this),dataTypesInferred:this.processFilterModelUpdateQueue.bind(this)}),this.addManagedPropertyListener("pivotMode",this.onPivotModeChanged.bind(this));let $=this.gos,z={...$.get("initialState")?.filter?.filterModel??{}};if(this.initialModel=z,this.model={...z},!$.get("enableFilterHandlers"))delete this.handlerMap.agMultiColumnFilter}refreshModel(){this.onNewRowsLoaded("rowDataUpdated")}setModel($,z="api",Q){let{colModel:J,dataTypeSvc:Z,filterManager:X}=this.beans;if(Z?.isPendingInference){this.modelUpdates.push({model:$,source:z});return}let Y=[],q=this.getModel(!0);if($){let G=new Set(Object.keys($));this.allColumnFilters.forEach((_,H)=>{let U=$[H];Y.push(this.setModelOnFilterWrapper(_,U)),G.delete(H)}),G.forEach((_)=>{let H=J.getColDefCol(_)||J.getCol(_);if(!H){j(62,{colId:_});return}if(!H.isFilterAllowed()){j(63,{colId:_});return}let U=this.getOrCreateFilterWrapper(H,!0);if(!U){j(64,{colId:_});return}Y.push(this.setModelOnFilterWrapper(U,$[_],!0))})}else this.model={},this.allColumnFilters.forEach((G)=>{Y.push(this.setModelOnFilterWrapper(G,null))});g.all(Y).then(()=>{let G=this.getModel(!0),_=[];if(this.allColumnFilters.forEach((H,U)=>{let W=q?q[U]:null,B=G?G[U]:null;if(!DJ(W,B))_.push(H.column)}),_.length>0)X?.onFilterChanged({columns:_,source:z});else if(Q)this.updateActive("filterChanged")})}getModel($){let z={},{allColumnFilters:Q,initialModel:J,beans:{colModel:Z}}=this;if(Q.forEach((X,Y)=>{let q=this.getModelFromFilterWrapper(X);if(T(q))z[Y]=q}),!$)for(let X of Object.keys(J)){let Y=J[X];if(T(Y)&&!Q.has(X)&&Z.getCol(X)?.isFilterAllowed())z[X]=Y}return z}setState($,z,Q="api"){if(this.state.clear(),z)for(let J of Object.keys(z)){let Z=z[J];this.state.set(J,{model:D0(this.model,J),state:Z})}this.setModel($,Q,!0)}getState(){let $=this.state;if(!$.size)return;let z={},Q=!1;return $.forEach((J,Z)=>{let X=J.state;if(X!=null)Q=!0,z[Z]=X}),Q?z:void 0}getModelFromFilterWrapper($){let Q=$.column.getColId();if($.isHandler)return D0(this.model,Q);let J=$.filter;if(J){if(typeof J.getModel!=="function")return j(66),null;return J.getModel()}return D0(this.initialModel,Q)}isFilterPresent(){return this.activeColumnFilters.length>0}isAggFilterPresent(){return!!this.activeAggregateFilters.length}disableFilters(){this.initialModel={};let{allColumnFilters:$}=this;if($.size)return $.forEach((z)=>this.disposeFilterWrapper(z,"advancedFilterEnabled")),!0;return!1}updateActiveFilters(){let $=(G)=>{if(!G)return!1;if(!G.isFilterActive)return j(67),!1;return G.isFilterActive()},{colModel:z,gos:Q}=this.beans,J=!!T$(Q),Z=[],X=[],Y=(G,_,H)=>{if(_)if(D6(G,z.isPivotMode(),z.isPivotActive(),J))Z.push(H);else X.push(H)},q=[];return this.allColumnFilters.forEach((G)=>{let _=G.column,H=_.getColId();if(G.isHandler)q.push(g.resolve().then(()=>{Y(_,this.isHandlerActive(_),{colId:H,isHandler:!0,handler:G.handler,handlerParams:G.handlerParams})}));else{let U=a$(G);if(U)q.push(U.then((W)=>{Y(_,$(W),{colId:H,isHandler:!1,comp:W})}))}}),g.all(q).then(()=>{this.activeAggregateFilters=Z,this.activeColumnFilters=X})}updateFilterFlagInColumns($,z){let Q=[];return this.allColumnFilters.forEach((J)=>{let Z=J.column;if(J.isHandler)Q.push(g.resolve().then(()=>{this.setColFilterActive(Z,this.isHandlerActive(Z),$,z)}));else{let X=a$(J);if(X)Q.push(X.then((Y)=>{this.setColFilterActive(Z,Y.isFilterActive(),$,z)}))}}),this.beans.groupFilter?.updateFilterFlags($,z),g.all(Q)}doFiltersPass($,z,Q){let{data:J,aggData:Z}=$,X=Q?this.activeAggregateFilters:this.activeColumnFilters,Y=Q?Z:J,q=this.model;for(let G=0;G{if(this.isAlive())Q?.onFilterChanged($)};if(z.isRefreshInProgress())setTimeout(J,0);else J()}updateBeforeFilterChanged($={}){let{column:z,additionalEventAttributes:Q}=$,J=z?.getColId();return this.updateActiveFilters().then(()=>this.updateFilterFlagInColumns("filterChanged",Q).then(()=>{this.allColumnFilters.forEach((Z)=>{let{column:X,isHandler:Y}=Z;if(J===X.getColId())return;if(Y)Z.handler.onAnyFilterChanged?.();a$(Z,Y)?.then((q)=>{if(typeof q?.onAnyFilterChanged==="function")q.onAnyFilterChanged()})}),this.processingFilterChange=!0}))}updateAfterFilterChanged(){this.processingFilterChange=!1}isSuppressFlashingCellsBecauseFiltering(){return!(this.gos.get("allowShowChangeAfterFilter")??!1)&&this.processingFilterChange}onNewRowsLoaded($){let z=[];this.allColumnFilters.forEach((Q)=>{let J=Q.isHandler;if(J)Q.handler.onNewRowsLoaded?.();let Z=a$(Q,J);if(Z)z.push(Z.then((X)=>{X.onNewRowsLoaded?.()}))}),g.all(z).then(()=>this.updateActive($,{afterDataChange:!0}))}updateActive($,z){this.updateFilterFlagInColumns($,z).then(()=>this.updateActiveFilters())}createGetValue($,z){let{filterValueSvc:Q,colModel:J}=this.beans;return(Z,X)=>{let Y=X?J.getCol(X):$;return Y?Q.getValue(Y,Z,z):void 0}}isFilterActive($){let z=this.cachedFilter($);if(z?.isHandler)return this.isHandlerActive($);let Q=z?.filter;if(Q)return Q.isFilterActive();return D0(this.initialModel,$.getColId())!=null}isHandlerActive($){let z=T(D0(this.model,$.getColId()));if(z)return z;let Q=this.beans.groupFilter;return Q?.isGroupFilter($)?Q.isFilterActive($):!1}getOrCreateFilterUi($){let z=this.getOrCreateFilterWrapper($,!0);return z?a$(z):null}getFilterUiForDisplay($){let z=this.getOrCreateFilterWrapper($,!0);if(!z)return null;let Q=a$(z);if(!Q)return null;return Q.then((J)=>({comp:J,params:z.filterUi.filterParams,isHandler:z.isHandler}))}getHandler($,z){let Q=this.getOrCreateFilterWrapper($,z);return Q?.isHandler?Q.handler:void 0}getOrCreateFilterWrapper($,z){if(!$.isFilterAllowed())return;let Q=this.cachedFilter($);if(!Q&&z)Q=this.createFilterWrapper($),this.setColumnFilterWrapper($,Q);return Q}cachedFilter($){return this.allColumnFilters.get($.getColId())}getDefaultFilter($,z=!1){return this.getDefaultFilterFromDataType(()=>this.beans.dataTypeSvc?.getBaseDataType($),z)}getDefaultFilterFromDataType($,z=!1){if(Iq(this.gos))return z?"agSetColumnFloatingFilter":"agSetColumnFilter";return T4($(),z)}getDefaultFloatingFilter($){return this.getDefaultFilter($,!0)}createFilterComp($,z,Q,J,Z,X){let Y=()=>{let _=this.createFilterCompParams($,Z,X),H=J(_,Z);return i2(this.beans.userCompFactory,z,H,Q)},q=Y();if(!q)return null;return{compDetails:q,createFilterUi:(_)=>{return(_?Y():q).newAgStackInstance()}}}createFilterInstance($,z,Q,J){let Z=this.beans.selectableFilter;if(Z?.isSelectable(z))z=Z.getFilterDef($,z);let{handler:X,handlerParams:Y,handlerGenerator:q}=this.createHandler($,z,Q)??{},G=this.createFilterComp($,z,Q,J,!!X,"init");if(!G)return{compDetails:null,createFilterUi:null,handler:X,handlerGenerator:q,handlerParams:Y};let{compDetails:_,createFilterUi:H}=G;if(this.isGlobalButtons){if(!_.params?.buttons?.length)j(281,{colId:$.getColId()})}return{compDetails:_,handler:X,handlerGenerator:q,handlerParams:Y,createFilterUi:H}}createBaseFilterParams($,z){let{filterManager:Q,rowModel:J}=this.beans;return y(this.gos,{column:$,colDef:$.getColDef(),getValue:this.createGetValue($),doesRowPassOtherFilter:z?()=>!0:(Z)=>Q?.doesRowPassOtherFilters($.getColId(),Z)??!0,rowModel:J})}createFilterCompParams($,z,Q,J){let Z=this.filterChangedCallbackFactory($),X=this.createBaseFilterParams($,J);if(X.filterChangedCallback=Z,X.filterModifiedCallback=J?()=>{}:(Y)=>this.filterModified($,Y),z){let Y=X,q=$.getColId(),G=D0(this.model,q);Y.model=G,Y.state=this.state.get(q)??{model:G},Y.onModelChange=(_,H)=>{this.updateStoredModel(q,_),this.refreshHandlerAndUi($,_,"ui",!1,H).then(()=>{Z({...H,source:"columnFilter"})})},Y.onStateChange=(_)=>{this.updateState($,_),this.updateOrRefreshFilterUi($)},Y.onAction=(_,H,U)=>{this.updateModel($,_,H),this.dispatchLocalEvent({type:"filterAction",column:$,action:_,event:U})},Y.getHandler=()=>this.getHandler($,!0),Y.onUiChange=(_)=>this.filterUiChanged($,_),Y.source=Q}return X}createFilterUiForHandler($,z){return z?{created:!1,create:z,filterParams:$.params,compDetails:$}:null}createFilterUiLegacy($,z,Q){let J=z(),Z={created:!0,create:z,filterParams:$.params,compDetails:$,promise:J};return J.then(Q),Z}createFilterWrapper($){let{compDetails:z,handler:Q,handlerGenerator:J,handlerParams:Z,createFilterUi:X}=this.createFilterInstance($,$.getColDef(),this.getDefaultFilter($),(q)=>q),Y=$.getColId();if(Q)return delete this.initialModel[Y],Q.init?.({...Z,source:"init",model:D0(this.model,Y)}),{column:$,isHandler:!0,handler:Q,handlerGenerator:J,handlerParams:Z,filterUi:this.createFilterUiForHandler(z,X)};if(X){let q={column:$,filterUi:null,isHandler:!1};return q.filterUi=this.createFilterUiLegacy(z,X,(G)=>{q.filter=G??void 0}),q}return{column:$,filterUi:null,isHandler:!1}}createHandlerFunc($,z,Q){let{gos:J,frameworkOverrides:Z,registry:X}=this.beans,Y,q=(B)=>{let E=B.filter;if(A7(E)){let K=E.handler;if(K)return K;if(Y=E.doesFilterPass,Y)return()=>({doesFilterPass:Y});return}return typeof E==="string"?E:void 0},G=J.get("enableFilterHandlers"),_=G?q(z):void 0,H=(B)=>()=>this.createBean(X.createDynamicBean(B,!0)),U,W;if(typeof _==="string"){let B=J.get("filterHandlers")?.[_];if(B!=null)U=B;else if(kL.has(_))U=H(_),W=_}else U=_;if(!U){let B,{compName:E,jsComp:K,fwComp:L}=j7(Z,z);if(E)B=E;else if(K==null&&L==null&&z.filter===!0)B=Q;if(W=this.handlerMap[B],W)U=H(W)}if(!U){if(!G)return;if(o(J))j(277,{colId:$.getColId()});return mL}return{filterHandler:U,handlerNameOrCallback:Y??W}}createHandler($,z,Q){let J=this.createHandlerFunc($,z,Q);if(!J)return;let Z=RZ(this.beans.userCompFactory,z,this.createFilterCompParams($,!0,"init")),{handlerNameOrCallback:X,filterHandler:Y}=J,{handler:q,handlerParams:G}=this.createHandlerFromFunc($,Y,Z);return{handler:q,handlerParams:G,handlerGenerator:X??Y}}createHandlerFromFunc($,z,Q){let J=$.getColDef(),Z=z(y(this.gos,{column:$,colDef:J})),X=this.createHandlerParams($,Q);return{handler:Z,handlerParams:X}}createHandlerParams($,z){let Q=$.getColDef(),J=$.getColId(),Z=this.filterChangedCallbackFactory($);return y(this.gos,{colDef:Q,column:$,getValue:this.createGetValue($),doesRowPassOtherFilter:(X)=>this.beans.filterManager?.doesRowPassOtherFilters(J,X)??!0,onModelChange:(X,Y)=>{this.updateStoredModel(J,X),this.refreshHandlerAndUi($,X,"handler",!1,Y).then(()=>{Z({...Y,source:"columnFilter"})})},onModelAsStringChange:()=>{$.dispatchColEvent("filterChanged","filterChanged"),this.dispatchLocalEvent({type:"filterModelAsStringChanged",column:$})},filterParams:z})}onColumnsChanged(){let $=[],{colModel:z,filterManager:Q,groupFilter:J}=this.beans;this.allColumnFilters.forEach((X,Y)=>{let q;if(X.column.isPrimary())q=z.getColDefCol(Y);else q=z.getCol(Y);if(q&&q===X.column)return;$.push(X.column),this.disposeFilterWrapper(X,"columnChanged"),this.disposeColumnListener(Y)});let Z=J&&$.every((X)=>J.isGroupFilter(X));if($.length>0&&!Z)Q?.onFilterChanged({columns:$,source:"api"})}isFilterAllowed($){if(!$.isFilterAllowed())return!1;let Q=this.beans.groupFilter;if(Q?.isGroupFilter($))return Q.isFilterAllowed($);return!0}getFloatingFilterCompDetails($,z){let{userCompFactory:Q,frameworkOverrides:J,selectableFilter:Z,gos:X}=this.beans,Y=(B)=>{this.getOrCreateFilterUi($)?.then((K)=>{B(m$(K))})},q=$.getColDef(),G=Z?.isSelectable(q)?Z.getFilterDef($,q):q,_=v4(J,G,()=>this.getDefaultFloatingFilter($))??"agReadOnlyFloatingFilter",H=X.get("enableFilterHandlers"),U=RZ(Q,G,this.createFilterCompParams($,H,"init",!0)),W=y(X,{column:$,filterParams:U,currentParentModel:()=>this.getCurrentFloatingFilterParentModel($),parentFilterInstance:Y,showParentFilter:z});if(H){let B=W,E=$.getColId(),K=this.filterChangedCallbackFactory($);B.onUiChange=(L)=>this.floatingFilterUiChanged($,L),B.model=D0(this.model,E),B.onModelChange=(L,D)=>{this.updateStoredModel(E,L),this.refreshHandlerAndUi($,L,"floating",!0,D).then(()=>{K({...D,source:"columnFilter"})})},B.getHandler=()=>this.getHandler($,!0),B.source="init"}return n2(Q,q,W,_)}getCurrentFloatingFilterParentModel($){return this.getModelFromFilterWrapper(this.cachedFilter($)??{column:$})}destroyFilterUi($,z,Q,J){if($.isHandler){let X=z.getColId();delete this.initialModel[X],this.state.delete(X);let Y=$.filterUi,q=this.createFilterUiForHandler(Q,J);$.filterUi=q;let G=this.eventSvc;if(Y?.created)Y.promise.then((_)=>{this.destroyBean(_),G.dispatchEvent({type:"filterDestroyed",source:"paramsUpdated",column:z})});else G.dispatchEvent({type:"filterHandlerDestroyed",source:"paramsUpdated",column:z})}else this.destroyFilter(z,"paramsUpdated")}destroyFilter($,z="api"){let Q=$.getColId(),J=this.allColumnFilters.get(Q);if(this.disposeColumnListener(Q),delete this.initialModel[Q],J)this.disposeFilterWrapper(J,z).then((Z)=>{if(Z&&this.isAlive())this.beans.filterManager?.onFilterChanged({columns:[$],source:"api"})})}disposeColumnListener($){let z=this.allColumnListeners.get($);if(z)this.allColumnListeners.delete($),z()}disposeFilterWrapper($,z){let Q=!1,{column:J,isHandler:Z,filterUi:X}=$,Y=J.getColId();if(Z)Q=this.isHandlerActive(J),this.destroyBean($.handler),delete this.model[Y],this.state.delete(Y);let q=()=>{this.setColFilterActive(J,!1,"filterDestroyed"),this.allColumnFilters.delete(Y),this.eventSvc.dispatchEvent({type:"filterDestroyed",source:z,column:J})};if(X)if(X.created)return X.promise.then((G)=>{return Q=Z?Q:!!G?.isFilterActive(),this.destroyBean(G),q(),Q});else q();return g.resolve(Q)}filterChangedCallbackFactory($){return(z)=>{this.callOnFilterChangedOutsideRenderCycle({additionalEventAttributes:z,columns:[$],column:$,source:z?.source??"columnFilter"})}}filterParamsChanged($,z="api"){let Q=this.allColumnFilters.get($);if(!Q)return;let J=this.beans,Z=Q.column,X=Z.getColDef(),Y=Z.isFilterAllowed(),q=this.getDefaultFilter(Z),G=J.selectableFilter,_=G?.isSelectable(X)?G.getFilterDef(Z,X):X,H=Y?this.createHandlerFunc(Z,_,this.getDefaultFilter(Z)):void 0,U=!!H,W=Q.isHandler;if(W!=U){this.destroyFilter(Z,"paramsUpdated");return}let{compDetails:B,createFilterUi:E}=(Y?this.createFilterComp(Z,_,q,(L)=>L,U,"colDef"):null)??{compDetails:null,createFilterUi:null},K=B?.params??RZ(J.userCompFactory,_,this.createFilterCompParams(Z,U,"colDef"));if(W){let L=H?.handlerNameOrCallback??H?.filterHandler,D=D0(this.model,$);if(Q.handlerGenerator!=L){let F=Q.handler,{handler:M,handlerParams:k}=this.createHandlerFromFunc(Z,H.filterHandler,K);if(Q.handler=M,Q.handlerParams=k,Q.handlerGenerator=L,delete this.model[$],M.init?.({...k,source:"init",model:null}),this.destroyBean(F),D!=null)this.beans.filterManager?.onFilterChanged({columns:[Z],source:z})}else{let F=this.createHandlerParams(Z,B?.params);Q.handlerParams=F,Q.handler.refresh?.({...F,source:"colDef",model:D})}}if(this.areFilterCompsDifferent(Q.filterUi?.compDetails??null,B)||!Q.filterUi||!B){this.destroyFilterUi(Q,Z,B,E);return}Q.filterUi.filterParams=K,a$(Q,W)?.then((L)=>{if((L?.refresh?L.refresh(K):!0)===!1)this.destroyFilterUi(Q,Z,B,E);else this.dispatchLocalEvent({type:"filterParamsChanged",column:Z,params:K})})}refreshHandlerAndUi($,z,Q,J,Z){let X=this.cachedFilter($);if(!X){if(J)this.getOrCreateFilterWrapper($,!0);return g.resolve()}if(!X.isHandler)return g.resolve();let{filterUi:Y,handler:q,handlerParams:G}=X;return sJ(()=>{if(Y){let{created:_,filterParams:H}=Y;if(_)return Y.promise.then((U)=>{return U?{filter:U,filterParams:H}:void 0});else Y.refreshed=!0}return g.resolve(void 0)},q,G,z,this.state.get($.getColId())??{model:z},Q,Z)}setColumnFilterWrapper($,z){let Q=$.getColId();this.allColumnFilters.set(Q,z),this.allColumnListeners.set(Q,this.addManagedListeners($,{colDefChanged:()=>this.filterParamsChanged(Q)})[0])}areFilterCompsDifferent($,z){if(!z||!$)return!0;let{componentClass:Q}=$,{componentClass:J}=z;return!(Q===J||Q?.render&&J?.render&&Q.render===J.render)}hasFloatingFilters(){return this.beans.colModel.getCols().some((z)=>z.getColDef().floatingFilter)}getFilterInstance($){let z=this.beans.colModel.getColDefCol($);if(!z)return Promise.resolve(void 0);let Q=this.getOrCreateFilterUi(z);if(!Q)return Promise.resolve(null);return new Promise((J)=>{Q.then((Z)=>{J(m$(Z))})})}processFilterModelUpdateQueue(){this.modelUpdates.forEach(({model:$,source:z})=>this.setModel($,z)),this.modelUpdates=[],this.columnModelUpdates.forEach(({key:$,model:z,resolve:Q})=>{this.setModelForColumn($,z).then(()=>Q())}),this.columnModelUpdates=[]}getModelForColumn($,z){if(z){let{state:J,model:Z}=this,X=$.getColId(),Y=J.get(X);if(Y)return Y.model??null;return D0(Z,X)}let Q=this.cachedFilter($);return Q?this.getModelFromFilterWrapper(Q):null}setModelForColumn($,z){if(this.beans.dataTypeSvc?.isPendingInference){let Q=()=>{},J=new Promise((Z)=>{Q=Z});return this.columnModelUpdates.push({key:$,model:z,resolve:Q}),J}return new Promise((Q)=>{this.setModelForColumnLegacy($,z).then((J)=>Q(J))})}getStateForColumn($){return this.state.get($)??{model:D0(this.model,$)}}setModelForColumnLegacy($,z){let Q=this.beans.colModel.getColDefCol($),J=Q?this.getOrCreateFilterWrapper(Q,!0):null;return J?this.setModelOnFilterWrapper(J,z):g.resolve()}setColDefPropsForDataType($,z,Q){let J=$.filter,Z=J===!0?this.getDefaultFilterFromDataType(()=>z.baseDataType):J;if(typeof Z!=="string")return;let X,Y,q=this.beans,{filterParams:G,filterValueGetter:_}=$;if(Z==="agMultiColumnFilter")({filterParams:X,filterValueGetter:Y}=q.multiFilter?.getParamsForDataType(G,_,z,Q)??{});else({filterParams:X,filterValueGetter:Y}=P4(Z,G,_,z,Q,q,this.getLocaleTextFunc()));if($.filterParams=X,Y)$.filterValueGetter=Y}setColFilterActive($,z,Q,J){if($.filterActive!==z)$.filterActive=z,$.dispatchColEvent("filterActiveChanged",Q);$.dispatchColEvent("filterChanged",Q,J)}setModelOnFilterWrapper($,z,Q){return new g((J)=>{if($.isHandler){let X=$.column,Y=X.getColId(),q=this.model[Y];if(this.updateStoredModel(Y,z),Q&&z===q){J();return}this.refreshHandlerAndUi(X,z,"api").then(()=>J());return}let Z=a$($);if(Z){Z.then((X)=>{if(typeof X?.setModel!=="function"){j(65),J();return}(X.setModel(z)||g.resolve()).then(()=>J())});return}J()})}updateStoredModel($,z){if(T(z))this.model[$]=z;else delete this.model[$];let Q=this.state.get($),J={model:z,state:Q?.state};this.state.set($,J)}filterModified($,z){this.getOrCreateFilterUi($)?.then((Q)=>{this.eventSvc.dispatchEvent({type:"filterModified",column:$,filterInstance:Q,...z})})}filterUiChanged($,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"filterUiChanged",column:$,...z})}floatingFilterUiChanged($,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"floatingFilterUiChanged",column:$,...z})}updateModel($,z,Q){let J=$.getColId(),Z=this.cachedFilter($),X=()=>Z?.filterUi;LJ({action:z,filterParams:Z?.filterUi?.filterParams,getFilterUi:X,getModel:()=>D0(this.model,J),getState:()=>this.state.get(J),updateState:(Y)=>this.updateState($,Y),updateModel:(Y)=>X()?.filterParams?.onModelChange(Y,{...Q,fromAction:z}),processModelToApply:Z?.isHandler?Z.handler.processModelToApply?.bind(Z.handler):void 0})}updateAllModels($,z){let Q=[];if(this.allColumnFilters.forEach((J,Z)=>{let X=this.beans.colModel.getColDefCol(Z);if(X)LJ({action:$,filterParams:J.filterUi?.filterParams,getFilterUi:()=>J.filterUi,getModel:()=>D0(this.model,Z),getState:()=>this.state.get(Z),updateState:(Y)=>this.updateState(X,Y),updateModel:(Y)=>{this.updateStoredModel(Z,Y),this.dispatchLocalEvent({type:"filterAction",column:X,action:$}),Q.push(this.refreshHandlerAndUi(X,Y,"ui"))},processModelToApply:J?.isHandler?J.handler.processModelToApply?.bind(J.handler):void 0})}),Q.length)g.all(Q).then(()=>{this.callOnFilterChangedOutsideRenderCycle({source:"columnFilter",additionalEventAttributes:z,columns:[]})})}updateOrRefreshFilterUi($){let z=$.getColId();H9(()=>this.cachedFilter($)?.filterUi,()=>D0(this.model,z),()=>this.state.get(z))}updateState($,z){this.state.set($.getColId(),z),this.dispatchLocalEvent({type:"filterStateChanged",column:$,state:z})}canApplyAll(){let{state:$,model:z,activeFilterComps:Q}=this;for(let Z of Q)if(Z.source==="COLUMN_MENU")return!1;let J=!1;for(let Z of $.keys()){let X=$.get(Z);if(X.valid===!1)return!1;if((X.model??null)!==D0(z,Z))J=!0}return J}hasUnappliedModel($){let{model:z,state:Q}=this;return(Q.get($)?.model??null)!==D0(z,$)}setGlobalButtons($){this.isGlobalButtons=$,this.dispatchLocalEvent({type:"filterGlobalButtons",isGlobal:$})}shouldKeepStateOnDetach($,z){if(z==="newFiltersToolPanel")return!0;let Q=this.beans.filterPanelSvc;if(Q?.isActive)return!!Q.getState($.getColId());return!1}onPivotModeChanged($){let{colModel:z,pivotColsSvc:Q}=this.beans,J=!!T$(this.gos),Z=$.currentValue,X=Z?this.activeColumnFilters:this.activeAggregateFilters,Y=Z?this.activeAggregateFilters:this.activeColumnFilters,q=[];for(let G of X){let _=z.getColById(G.colId),H=Z&&!!Q?.columns.length;if(_&&Z===D6(_,Z,H,J))Y.push(G),q.push(G)}Q1(X,q)}destroy(){super.destroy(),this.allColumnFilters.forEach(($)=>this.disposeFilterWrapper($,"gridDestroyed")),this.allColumnListeners.clear(),this.state.clear(),this.activeFilterComps.clear()}};function pL($){return!!$.filterManager?.isAnyFilterPresent()}function iL($,z="api"){$.filterManager?.onFilterChanged({source:z})}var nL=class extends S{constructor(){super(...arguments);this.beanName="filterManager",this.advFilterModelUpdateQueue=[]}wireBeans($){this.quickFilter=$.quickFilter,this.advancedFilter=$.advancedFilter,this.colFilter=$.colFilter}postConstruct(){let $=this.refreshFiltersForAggregations.bind(this),z=this.updateAdvFilterColumns.bind(this);if(this.addManagedEventListeners({columnValueChanged:$,columnPivotChanged:$,columnPivotModeChanged:$,newColumnsLoaded:z,columnVisible:z,advancedFilterEnabledChanged:({enabled:J})=>this.onAdvFilterEnabledChanged(J),dataTypesInferred:this.processFilterModelUpdateQueue.bind(this)}),this.externalFilterPresent=this.isExternalFilterPresentCallback(),this.addManagedPropertyListeners(["isExternalFilterPresent","doesExternalFilterPass"],()=>{this.onFilterChanged({source:"api"})}),this.updateAggFiltering(),this.addManagedPropertyListener("groupAggFiltering",()=>{this.updateAggFiltering(),this.onFilterChanged()}),this.quickFilter)this.addManagedListeners(this.quickFilter,{quickFilterChanged:()=>this.onFilterChanged({source:"quickFilter"})});let{gos:Q}=this;this.alwaysPassFilter=Q.get("alwaysPassFilter"),this.addManagedPropertyListener("alwaysPassFilter",()=>{this.alwaysPassFilter=Q.get("alwaysPassFilter"),this.onFilterChanged({source:"api"})})}isExternalFilterPresentCallback(){let $=this.gos.getCallback("isExternalFilterPresent");return typeof $==="function"&&$({})}doesExternalFilterPass($){let z=this.gos.get("doesExternalFilterPass");return typeof z==="function"&&z($)}setFilterState($,z,Q="api"){if(this.isAdvFilterEnabled())return;this.colFilter?.setState($,z,Q)}setFilterModel($,z="api",Q){if(this.isAdvFilterEnabled()){if(!Q)this.warnAdvFilters();return}this.colFilter?.setModel($,z)}getFilterModel(){return this.colFilter?.getModel()??{}}getFilterState(){return this.colFilter?.getState()}isColumnFilterPresent(){return!!this.colFilter?.isFilterPresent()}isAggregateFilterPresent(){return!!this.colFilter?.isAggFilterPresent()}isChildFilterPresent(){return this.isColumnFilterPresent()||this.isQuickFilterPresent()||this.externalFilterPresent||this.isAdvFilterPresent()}isAnyFilterPresent(){return this.isChildFilterPresent()||this.isAggregateFilterPresent()}isAdvFilterPresent(){return this.isAdvFilterEnabled()&&this.advancedFilter.isFilterPresent()}onAdvFilterEnabledChanged($){if($){if(this.colFilter?.disableFilters())this.onFilterChanged({source:"advancedFilter"})}else if(this.advancedFilter?.isFilterPresent())this.advancedFilter.setModel(null),this.onFilterChanged({source:"advancedFilter"})}isAdvFilterEnabled(){return!!this.advancedFilter?.isEnabled()}isAdvFilterHeaderActive(){return this.isAdvFilterEnabled()&&this.advancedFilter.isHeaderActive()}refreshFiltersForAggregations(){if(T$(this.gos)&&this.isAnyFilterPresent())this.onFilterChanged()}onFilterChanged($={}){let{source:z,additionalEventAttributes:Q,columns:J=[]}=$;this.externalFilterPresent=this.isExternalFilterPresentCallback(),(this.colFilter?this.colFilter.updateBeforeFilterChanged($):g.resolve()).then(()=>{let Z={source:z,type:"filterChanged",columns:J};if(Q)B0(Z,Q);this.eventSvc.dispatchEvent(Z),this.colFilter?.updateAfterFilterChanged()})}isSuppressFlashingCellsBecauseFiltering(){return!!this.colFilter?.isSuppressFlashingCellsBecauseFiltering()}isQuickFilterPresent(){return!!this.quickFilter?.isFilterPresent()}updateAggFiltering(){this.aggFiltering=!!T$(this.gos)}isAggregateQuickFilterPresent(){return this.isQuickFilterPresent()&&this.shouldApplyQuickFilterAfterAgg()}isNonAggregateQuickFilterPresent(){return this.isQuickFilterPresent()&&!this.shouldApplyQuickFilterAfterAgg()}shouldApplyQuickFilterAfterAgg(){return(this.aggFiltering||this.beans.colModel.isPivotMode())&&!this.gos.get("applyQuickFilterBeforePivotOrAgg")}doesRowPassOtherFilters($,z){return this.doesRowPassFilter({rowNode:z,colIdToSkip:$})}doesRowPassAggregateFilters($){let{rowNode:z}=$;if(this.alwaysPassFilter?.(z))return!0;if(this.isAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(z))return!1;if(this.isAggregateFilterPresent()&&!this.colFilter.doFiltersPass(z,$.colIdToSkip,!0))return!1;return!0}doesRowPassFilter($){let{rowNode:z}=$;if(this.alwaysPassFilter?.(z))return!0;if(this.isNonAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(z))return!1;if(this.externalFilterPresent&&!this.doesExternalFilterPass(z))return!1;if(this.isColumnFilterPresent()&&!this.colFilter.doFiltersPass(z,$.colIdToSkip))return!1;if(this.isAdvFilterPresent()&&!this.advancedFilter.doesFilterPass(z))return!1;return!0}isFilterAllowed($){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.isFilterAllowed($)}getAdvFilterModel(){return this.isAdvFilterEnabled()?this.advancedFilter.getModel():null}setAdvFilterModel($,z="api"){if(!this.isAdvFilterEnabled())return;if(this.beans.dataTypeSvc?.isPendingInference){this.advFilterModelUpdateQueue.push($);return}this.advancedFilter.setModel($??null),this.onFilterChanged({source:z})}toggleAdvFilterBuilder($,z){if(!this.isAdvFilterEnabled())return;this.advancedFilter.getCtrl().toggleFilterBuilder({source:z,force:$})}updateAdvFilterColumns(){if(!this.isAdvFilterEnabled())return;if(this.advancedFilter.updateValidity())this.onFilterChanged({source:"advancedFilter"})}hasFloatingFilters(){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.hasFloatingFilters()}getColumnFilterInstance($){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve(void 0);return this.colFilter?.getFilterInstance($)??Promise.resolve(void 0)}warnAdvFilters(){j(68)}setupAdvFilterHeaderComp($){this.advancedFilter?.getCtrl().setupHeaderComp($)}getHeaderRowCount(){return this.isAdvFilterHeaderActive()?1:0}getHeaderHeight(){return this.isAdvFilterHeaderActive()?this.advancedFilter.getCtrl().getHeaderHeight():0}processFilterModelUpdateQueue(){for(let $ of this.advFilterModelUpdateQueue)this.setAdvFilterModel($);this.advFilterModelUpdateQueue=[]}setColumnFilterModel($,z){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve();return this.colFilter?.setModelForColumn($,z)??Promise.resolve()}};function dL($){return{tag:"div",cls:$}}var I4=class extends x{constructor($){let{className:z="ag-filter-apply-panel"}=$??{};super(dL(z));this.listeners=[],this.validationMessage=null,this.className=z}updateButtons($,z){let Q=this.buttons;if(this.buttons=$,Q===$)return;let J=this.getGui();z0(J);let Z;this.destroyListeners();let X=document.createDocumentFragment(),Y=this.className,q=({type:_,label:H})=>{let U=(D)=>{this.dispatchLocalEvent({type:_,event:D})};if(!["apply","clear","reset","cancel"].includes(_))j(75);let W=_==="apply",E=J0({tag:"button",attrs:{type:W&&z?"submit":"button"},ref:`${_}FilterButton`,cls:`ag-button ag-standard-button ${Y}-button${W?" "+Y+"-apply-button":""}`,children:H});if(this.activateTabIndex([E]),W)Z=E;let K=(D)=>{if(D.key===A.ENTER)D.preventDefault(),U(D)},L=this.listeners;E.addEventListener("click",U),L.push(()=>E.removeEventListener("click",U)),E.addEventListener("keydown",K),L.push(()=>E.removeEventListener("keydown",K)),X.append(E)};for(let _ of $)q(_);this.eApply=Z;let G=this.validationTooltipFeature;if(Z&&!G)this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eApply,getLocation:()=>"advancedFilter",getTooltipShowDelayOverride:()=>1000}));else if(!Z&&G)this.validationTooltipFeature=this.destroyBean(G);J.append(X)}getApplyButton(){return this.eApply}updateValidity($,z=null){let Q=this.eApply;if(!Q)return;P2(Q,!$),this.validationMessage=z,this.validationTooltipFeature?.setTooltipAndRefresh(this.validationMessage)}destroyListeners(){for(let $ of this.listeners)$();this.listeners=[]}destroy(){this.destroyListeners(),super.destroy()}};var C4=class extends x{constructor($,z,Q,J,Z,X){super();this.column=$,this.wrapper=z,this.eventParent=Q,this.updateModel=J,this.isGlobalButtons=Z,this.enableGlobalButtonCheck=X,this.hidePopup=null,this.applyActive=!1}postConstruct(){let{comp:$,params:z}=this.wrapper,Q=z,J=Q.useForm,Z=J?"form":"div";if(this.setTemplate({tag:Z,cls:"ag-filter-wrapper"}),J)this.addManagedElementListeners(this.getGui(),{submit:(X)=>{X?.preventDefault()},keydown:this.handleKeyDown.bind(this)});this.appendChild($.getGui()),this.params=Q,this.resetButtonsPanel(Q),this.addManagedListeners(this.eventParent,{filterParamsChanged:({column:X,params:Y})=>{if(X===this.column)this.resetButtonsPanel(Y,this.params)},filterStateChanged:({column:X,state:Y})=>{if(X===this.column)this.eButtons?.updateValidity(Y.valid!==!1)},filterAction:({column:X,action:Y,event:q})=>{if(X===this.column)this.afterAction(Y,q)},...this.enableGlobalButtonCheck?{filterGlobalButtons:({isGlobal:X})=>{if(X!==this.isGlobalButtons){this.isGlobalButtons=X;let Y=this.params;this.resetButtonsPanel(Y,Y,!0)}}}:void 0})}afterGuiAttached($){if($)this.hidePopup=$.hidePopup}resetButtonsPanel($,z,Q){let{buttons:J,readOnly:Z}=z??{},{buttons:X,readOnly:Y,useForm:q}=$;if(!Q&&Z===Y&&DJ(J,X))return;let G=X&&X.length>0&&!$.readOnly&&!this.isGlobalButtons,_=this.eButtons;if(G){let H=X.map((U)=>{let W=`${U}Filter`;return{type:U,label:b7(this,W)}});if(this.applyActive=W1(this.params),!_){_=this.createBean(new I4),this.appendChild(_.getGui());let U=this.column,W=(B)=>({event:E})=>{this.updateModel(U,B,{fromButtons:!0}),this.afterAction(B,E)};_?.addManagedListeners(_,{apply:W("apply"),clear:W("clear"),reset:W("reset"),cancel:W("cancel")}),this.eButtons=_}_.updateButtons(H,q)}else if(this.applyActive=!1,_)T0(_.getGui()),this.eButtons=this.destroyBean(_)}close($){let z=this.hidePopup;if(!z)return;let Q=$,J=Q?.key,Z;if(J===A.ENTER||J===A.SPACE)Z={keyboardEvent:Q};z(Z),this.hidePopup=null}afterAction($,z){let{params:Q,applyActive:J}=this,Z=Q?.closeOnApply;switch($){case"apply":{if(z?.preventDefault(),Z&&J)this.close(z);break}case"reset":{if(Z&&J)this.close();break}case"cancel":{if(Z)this.close(z);break}}}handleKeyDown($){if(!$.defaultPrevented&&$.key===A.ENTER&&this.applyActive)this.updateModel(this.column,"apply",{fromButtons:!0}),this.afterAction("apply",$)}destroy(){this.hidePopup=null,this.eButtons=this.destroyBean(this.eButtons)}},tL=":where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}",sL={tag:"div",cls:"ag-filter"},b4=class extends x{constructor($,z,Q){super(sL);this.column=$,this.source=z,this.enableGlobalButtonCheck=Q,this.wrapper=null}postConstruct(){this.beans.colFilter?.activeFilterComps.add(this),this.createFilter(!0),this.addManagedEventListeners({filterDestroyed:this.onFilterDestroyed.bind(this)})}hasFilter(){return this.wrapper!=null}getFilter(){return this.wrapper?.then(($)=>$.comp)??null}afterInit(){return this.wrapper?.then(()=>{})??g.resolve()}afterGuiAttached($){this.afterGuiAttachedParams=$,this.wrapper?.then((z)=>{this.comp?.afterGuiAttached($),z?.comp?.afterGuiAttached?.($)})}afterGuiDetached(){this.wrapper?.then(($)=>{$?.comp?.afterGuiDetached?.()})}createFilter($){let{column:z,source:Q,beans:{colFilter:J}}=this,Z=J.getFilterUiForDisplay(z)??null;this.wrapper=Z,Z?.then((X)=>{if(!X)return;let{isHandler:Y,comp:q}=X,G;if(Y){let _=!!this.enableGlobalButtonCheck,H=this.createBean(new C4(z,X,J,J.updateModel.bind(J),_&&J.isGlobalButtons,_));this.comp=H,G=H.getGui()}else if(this.registerCSS(tL),G=q.getGui(),!T(G))j(69,{guiFromFilter:G});if(this.appendChild(G),$)this.eventSvc.dispatchEvent({type:"filterOpened",column:z,source:Q,eGui:this.getGui()});else q.afterGuiAttached?.(this.afterGuiAttachedParams)})}onFilterDestroyed($){let{source:z,column:Q}=$;if((z==="api"||z==="paramsUpdated")&&Q.getId()===this.column.getId()&&this.beans.colModel.getColDefCol(this.column))z0(this.getGui()),this.comp=this.destroyBean(this.comp),this.createFilter()}destroy(){this.beans.colFilter?.activeFilterComps.delete(this),this.eventSvc.dispatchEvent({type:"filterClosed",column:this.column}),this.wrapper=null,this.comp=this.destroyBean(this.comp),this.afterGuiAttachedParams=void 0,super.destroy()}},rL=class extends S{constructor(){super(...arguments);this.beanName="filterMenuFactory"}wireBeans($){this.popupSvc=$.popupSvc}hideActiveMenu(){this.hidePopup?.()}showMenuAfterMouseEvent($,z,Q,J){if($&&!$.isColumn)return;this.showPopup($,(Z)=>{this.popupSvc?.positionPopupUnderMouseEvent({additionalParams:{column:$},type:Q,mouseEvent:z,ePopup:Z})},Q,z.target,U0(this.gos),J)}showMenuAfterButtonClick($,z,Q,J){if($&&!$.isColumn)return;let Z=-1,X="left",Y=U0(this.gos);if(!Y&&this.gos.get("enableRtl"))Z=1,X="right";let q=Y?void 0:4*Z,G=Y?void 0:4;this.showPopup($,(_)=>{this.popupSvc?.positionPopupByComponent({type:Q,eventSource:z,ePopup:_,nudgeX:q,nudgeY:G,alignSide:X,keepWithinBounds:!0,position:"under",additionalParams:{column:$}})},Q,z,Y,J)}showPopup($,z,Q,J,Z,X){let Y=$?this.createBean(new b4($,"COLUMN_MENU")):void 0;if(this.activeMenu=Y,!Y?.hasFilter()||!$){e(57);return}let q=J0({tag:"div",cls:`ag-menu${!Z?" ag-filter-menu":""}`,role:"presentation"});[this.tabListener]=this.addManagedElementListeners(q,{keydown:(K)=>this.trapFocusWithin(K,q)}),q.appendChild(Y?.getGui());let G,_=()=>Y?.afterGuiDetached(),H=N2(this.gos)?J??this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody:void 0,U=(K)=>{z1($,!1,"contextMenu");let L=K instanceof KeyboardEvent;if(this.tabListener)this.tabListener=this.tabListener();if(L&&J&&A0(J))yJ(J)?.focus({preventScroll:!0});_(),this.destroyBean(this.activeMenu),this.dispatchVisibleChangedEvent(!1,Q,$),X?.()},W=this.getLocaleTextFunc(),B=Z&&Q!=="columnFilter"?W("ariaLabelColumnMenu","Column Menu"):W("ariaLabelColumnFilter","Column Filter"),E=this.popupSvc?.addPopup({modal:!0,eChild:q,closeOnEsc:!0,closedCallback:U,positionCallback:()=>z(q),anchorToElement:H,ariaLabel:B});if(E)this.hidePopup=G=E.hideFunc;Y.afterInit().then(()=>{z(q),Y.afterGuiAttached({container:Q,hidePopup:G})}),z1($,!0,"contextMenu"),this.dispatchVisibleChangedEvent(!0,Q,$)}trapFocusWithin($,z){if($.key!==A.TAB||$.defaultPrevented||j0(this.beans,z,!1,$.shiftKey))return;$.preventDefault(),F0(z,$.shiftKey)}dispatchVisibleChangedEvent($,z,Q){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:!1,key:z,column:Q??null,columnGroup:null})}isMenuEnabled($){return $.isFilterAllowed()&&($.getColDef().menuTabs??["filterMenuTab"]).includes("filterMenuTab")}showMenuAfterContextMenuEvent(){}destroy(){this.destroyBean(this.activeMenu),super.destroy()}},lL=class extends S{constructor(){super(...arguments);this.beanName="filterValueSvc"}getValue($,z,Q){if(!z)return;let J=$.getColDef(),{selectableFilter:Z,valueSvc:X,formula:Y}=this.beans,q=Q??Z?.getFilterValueGetter($.getColId())??J.filterValueGetter;if(q)return this.executeFilterValueGetter(q,z.data,$,z,J);let G=X.getValue($,z,"data");if($.isAllowFormula()&&Y?.isFormula(G))return Y.resolveValue($,z);return G}executeFilterValueGetter($,z,Q,J,Z){let{expressionSvc:X,valueSvc:Y}=this.beans,q=y(this.gos,{data:z,node:J,column:Q,colDef:Z,getValue:Y.getValueCallback.bind(Y,J)});if(typeof $==="function")return $(q);return X?.evaluate($,q)}};function aL($){return!!$.quickFilter?.isFilterPresent()}function oL($){return $.quickFilter?.getText()}function eL($){$.quickFilter?.resetCache()}var $D=class extends S{constructor(){super(...arguments);this.beanName="quickFilter",this.quickFilter=null,this.quickFilterParts=null}postConstruct(){let $=this.resetCache.bind(this),z=this.gos;this.addManagedEventListeners({columnPivotModeChanged:$,newColumnsLoaded:$,columnRowGroupChanged:$,columnVisible:()=>{if(!z.get("includeHiddenColumnsInQuickFilter"))this.resetCache()}}),this.addManagedPropertyListener("quickFilterText",(Q)=>this.setFilter(Q.currentValue)),this.addManagedPropertyListeners(["includeHiddenColumnsInQuickFilter","applyQuickFilterBeforePivotOrAgg"],()=>this.onColumnConfigChanged()),this.quickFilter=this.parseFilter(z.get("quickFilterText")),this.parser=z.get("quickFilterParser"),this.matcher=z.get("quickFilterMatcher"),this.setFilterParts(),this.addManagedPropertyListeners(["quickFilterMatcher","quickFilterParser"],()=>this.setParserAndMatcher())}refreshCols(){let{autoColSvc:$,colModel:z,gos:Q,pivotResultCols:J}=this.beans,Z=z.isPivotMode(),X=$?.getColumns(),Y=z.getColDefCols(),q=(Z&&!Q.get("applyQuickFilterBeforePivotOrAgg")?J?.getPivotResultCols()?.list:Y)??[];if(X)q=q.concat(X);this.colsToUse=Q.get("includeHiddenColumnsInQuickFilter")?q:q.filter((G)=>G.isVisible()||G.isRowGroupActive())}isFilterPresent(){return this.quickFilter!==null}doesRowPass($){let z=this.gos.get("cacheQuickFilter");if(this.matcher)return this.doesRowPassMatcher(z,$);return this.quickFilterParts.every((Q)=>z?this.doesRowPassCache($,Q):this.doesRowPassNoCache($,Q))}resetCache(){this.beans.rowModel.forEachNode(($)=>$.quickFilterAggregateText=null)}getText(){return this.gos.get("quickFilterText")}setFilterParts(){let{quickFilter:$,parser:z}=this;if($)this.quickFilterParts=z?z($):$.split(" ");else this.quickFilterParts=null}parseFilter($){if(!T($))return null;return $.toUpperCase()}setFilter($){if($!=null&&typeof $!=="string"){j(70,{newFilter:$});return}let z=this.parseFilter($);if(this.quickFilter!==z)this.quickFilter=z,this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}setParserAndMatcher(){let $=this.gos.get("quickFilterParser"),z=this.gos.get("quickFilterMatcher"),Q=$!==this.parser||z!==this.matcher;if(this.parser=$,this.matcher=z,Q)this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}onColumnConfigChanged(){if(this.refreshCols(),this.resetCache(),this.isFilterPresent())this.dispatchLocalEvent({type:"quickFilterChanged"})}doesRowPassNoCache($,z){return this.colsToUse.some((Q)=>{let J=this.getTextForColumn(Q,$);return T(J)&&J.includes(z)})}doesRowPassCache($,z){return this.checkGenerateAggText($),$.quickFilterAggregateText.includes(z)}doesRowPassMatcher($,z){let Q;if($)this.checkGenerateAggText(z),Q=z.quickFilterAggregateText;else Q=this.getAggText(z);let{quickFilterParts:J,matcher:Z}=this;return Z(J,Q)}checkGenerateAggText($){if(!$.quickFilterAggregateText)$.quickFilterAggregateText=this.getAggText($)}getTextForColumn($,z){let Q=this.beans.filterValueSvc.getValue($,z),J=$.getColDef();if(J.getQuickFilterText){let Z=y(this.gos,{value:Q,node:z,data:z.data,column:$,colDef:J});Q=J.getQuickFilterText(Z)}return T(Q)?Q.toString().toUpperCase():null}getAggText($){let z=[];for(let Q of this.colsToUse){let J=this.getTextForColumn(Q,$);if(T(J))z.push(J)}return z.join(` +`)}},zD={moduleName:"ClientSideRowModelFilter",version:p,rowModels:["clientSide"],beans:[GK]},U9={moduleName:"FilterCore",version:p,beans:[nL],apiFunctions:{isAnyFilterPresent:pL,onFilterChanged:iL},css:[jL],dependsOn:[zD]},W9={moduleName:"FilterValue",version:p,beans:[lL]},B9={moduleName:"ColumnFilter",version:p,beans:[cL,rL],dynamicBeans:{headerFilterCellCtrl:VL},icons:{filter:"filter",filterActive:"filter"},apiFunctions:{isColumnFilterPresent:fL,getColumnFilterInstance:OL,destroyFilter:PL,setFilterModel:TL,getFilterModel:vL,getColumnFilterModel:IL,setColumnFilterModel:CL,showColumnFilter:bL,hideColumnFilter:yL,getColumnFilterHandler:xL,doFilterAction:wL},dependsOn:[U9,nz,W9,O4]};var QD={moduleName:"QuickFilterCore",version:p,rowModels:["clientSide"],beans:[$D],dependsOn:[U9,W9]},E9={moduleName:"QuickFilter",version:p,apiFunctions:{isQuickFilterPresent:aL,getQuickFilter:oL,resetQuickFilter:eL},dependsOn:[QD]};var JD=class extends S{constructor(){super(...arguments);this.beanName="apiEventSvc",this.syncListeners=new Map,this.asyncListeners=new Map,this.syncGlobalListeners=new Set,this.globalListenerPairs=new Map}postConstruct(){this.wrapSvc=this.beans.frameworkOverrides.createGlobalEventListenerWrapper?.()}addListener($,z){let Q=this.wrapSvc?.wrap($,z)??z,J=!r1.has($),Z=J?this.asyncListeners:this.syncListeners;if(!Z.has($))Z.set($,new Set);Z.get($).add(Q),this.eventSvc.addListener($,Q,J)}removeListener($,z){let Q=this.wrapSvc?.unwrap($,z)??z,Z=!!this.asyncListeners.get($)?.delete(Q);if(!Z)this.syncListeners.get($)?.delete(Q);this.eventSvc.removeListener($,Q,Z)}addGlobalListener($){let z=this.wrapSvc?.wrapGlobal($)??$,Q=(X,Y)=>{if(r1.has(X))z(X,Y)},J=(X,Y)=>{if(!r1.has(X))z(X,Y)};this.globalListenerPairs.set($,{syncListener:Q,asyncListener:J});let Z=this.eventSvc;Z.addGlobalListener(Q,!1),Z.addGlobalListener(J,!0)}removeGlobalListener($){let{eventSvc:z,wrapSvc:Q,globalListenerPairs:J}=this,Z=Q?.unwrapGlobal($)??$;if(J.has(Z)){let{syncListener:Y,asyncListener:q}=J.get(Z);z.removeGlobalListener(Y,!1),z.removeGlobalListener(q,!0),J.delete($)}else this.syncGlobalListeners.delete(Z),z.removeGlobalListener(Z,!1)}destroyEventListeners($,z){$.forEach((Q,J)=>{Q.forEach((Z)=>this.eventSvc.removeListener(J,Z,z)),Q.clear()}),$.clear()}destroyGlobalListeners($,z){for(let Q of $)this.eventSvc.removeGlobalListener(Q,z);$.clear()}destroy(){super.destroy(),this.destroyEventListeners(this.syncListeners,!1),this.destroyEventListeners(this.asyncListeners,!0),this.destroyGlobalListeners(this.syncGlobalListeners,!1);let{globalListenerPairs:$,eventSvc:z}=this;$.forEach(({syncListener:Q,asyncListener:J})=>{z.removeGlobalListener(Q,!1),z.removeGlobalListener(J,!0)}),$.clear()}};function ZD($,z,Q){$.apiEventSvc?.addListener(z,Q)}function XD($,z,Q){$.apiEventSvc?.removeListener(z,Q)}function YD($,z){$.apiEventSvc?.addGlobalListener(z)}function qD($,z){$.apiEventSvc?.removeGlobalListener(z)}var K9={moduleName:"EventApi",version:p,apiFunctions:{addEventListener:ZD,addGlobalListener:YD,removeEventListener:XD,removeGlobalListener:qD},beans:[JD]};function M$($,z){if(typeof $!=="number")return"";let Q=z(),J=Q("thousandSeparator",","),Z=Q("decimalSeparator",".");return $.toString().replace(".",Z).replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${J}`)}var GD="↑",_D="↓",HD={tag:"span",children:[{tag:"span",ref:"eDelta",cls:"ag-value-change-delta"},{tag:"span",ref:"eValue",cls:"ag-value-change-value"}]},UD=class extends x{constructor(){super(HD);this.eValue=f,this.eDelta=f,this.refreshCount=0}init($){this.refresh($,!0)}showDelta($,z){let Q=Math.abs(z),J=$.formatValue(Q),Z=T(J)?J:Q,X=z>=0,Y=this.eDelta;if(X)Y.textContent=GD+Z;else Y.textContent=_D+Z;Y.classList.toggle("ag-value-change-delta-up",X),Y.classList.toggle("ag-value-change-delta-down",!X)}setTimerToRemoveDelta(){this.refreshCount++;let $=this.refreshCount;this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if($===this.refreshCount)this.hideDeltaValue()},2000)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),z0(this.eDelta)}refresh($,z=!1){let{value:Q,valueFormatted:J}=$,{eValue:Z,lastValue:X,beans:Y}=this;if(Q===X)return!1;if(T(J))Z.textContent=J;else if(T(Q))Z.textContent=Q;else z0(Z);if(Y.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;let q=Q&&typeof Q==="object"&&"toNumber"in Q?Q.toNumber():Q,G=X&&typeof X==="object"&&"toNumber"in X?X.toNumber():X;if(q===G)return!1;if(typeof q==="number"&&typeof G==="number"){let _=q-G;this.showDelta($,_)}if(X)Z.classList.add("ag-value-change-value-highlight");if(!z)this.setTimerToRemoveDelta();return this.lastValue=Q,!0}},WD=".ag-value-slide-out{opacity:1}:where(.ag-ltr) .ag-value-slide-out{margin-right:5px;transition:opacity 3s,margin-right 3s}:where(.ag-rtl) .ag-value-slide-out{margin-left:5px;transition:opacity 3s,margin-left 3s}:where(.ag-ltr,.ag-rtl) .ag-value-slide-out{transition-timing-function:linear}.ag-value-slide-out-end{opacity:0}:where(.ag-ltr) .ag-value-slide-out-end{margin-right:10px}:where(.ag-rtl) .ag-value-slide-out-end{margin-left:10px}",BD={tag:"span",children:[{tag:"span",ref:"eCurrent",cls:"ag-value-slide-current"}]},ED=class extends x{constructor(){super(BD);this.eCurrent=f,this.refreshCount=0,this.registerCSS(WD)}init($){this.refresh($,!0)}addSlideAnimation(){this.refreshCount++;let $=this.refreshCount;this.ePrevious?.remove();let{beans:z,eCurrent:Q}=this,J=J0({tag:"span",cls:"ag-value-slide-previous ag-value-slide-out"});this.ePrevious=J,J.textContent=Q.textContent,this.getGui().insertBefore(J,Q),z.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if($!==this.refreshCount)return;this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{if($!==this.refreshCount)return;this.ePrevious?.remove(),this.ePrevious=null},3000)})}refresh($,z=!1){let Q=$.value;if(n(Q))Q="";if(Q===this.lastValue)return!1;if(this.beans.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;if(!z)this.addSlideAnimation();this.lastValue=Q;let J=this.eCurrent;if(T($.valueFormatted))J.textContent=$.valueFormatted;else if(T($.value))J.textContent=Q;else z0(J);return!0}},KD=class extends S{constructor(){super(...arguments);this.beanName="cellFlashSvc",this.nextAnimationTime=null,this.nextAnimationCycle=null,this.animations={highlight:new Map,"data-changed":new Map}}animateCell($,z,Q=this.beans.gos.get("cellFlashDuration"),J=this.beans.gos.get("cellFadeDuration")){let Z=this.animations[z];Z.delete($);let X=Date.now(),Y=X+Q,q=X+Q+J,G={phase:"flash",flashEndTime:Y,fadeEndTime:q};Z.set($,G);let _=`ag-cell-${z}`,H=`${_}-animation`,{comp:U,eGui:{style:W}}=$;if(U.toggleCss(_,!0),U.toggleCss(H,!1),W.removeProperty("transition"),W.removeProperty("transition-delay"),this.nextAnimationTime&&Y+15{this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),Q)}),this.nextAnimationTime=Y}advanceAnimations(){let $=Date.now(),z=null;for(let Q of Object.keys(this.animations)){let J=this.animations[Q],Z=`ag-cell-${Q}`,X=`${Z}-animation`;for(let[Y,q]of J){if(!Y.isAlive()||!Y.comp){J.delete(Y);continue}let{phase:G,flashEndTime:_,fadeEndTime:H}=q,U=G==="flash"?_:H;if(!($+15>=U)){z=Math.min(U,z??1/0);continue}let{comp:B,eGui:{style:E}}=Y;switch(G){case"flash":B.toggleCss(Z,!1),B.toggleCss(X,!0),E.transition=`background-color ${H-_}ms`,E.transitionDelay=`${_-$}ms`,z=Math.min(H,z??1/0),q.phase="fade";break;case"fade":B.toggleCss(Z,!1),B.toggleCss(X,!1),E.removeProperty("transition"),E.removeProperty("transition-delay"),J.delete(Y);break}}}if(z==null)this.nextAnimationTime=null,this.nextAnimationCycle=null;else if(z)this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),z-$),this.nextAnimationTime=z}onFlashCells($,z){if(!$.comp)return;let Q=b$($.cellPosition);if(z.cells[Q])this.animateCell($,"highlight")}flashCell($,z){this.animateCell($,"data-changed",z?.flashDuration,z?.fadeDuration)}destroy(){for(let $ of Object.keys(this.animations))this.animations[$].clear()}};function LD($,z={}){let{cellFlashSvc:Q}=$;if(!Q)return;$.frameworkOverrides.wrapIncoming(()=>{for(let J of $.rowRenderer.getCellCtrls(z.rowNodes,z.columns))Q.flashCell(J,z)})}var L9={moduleName:"HighlightChanges",version:p,beans:[KD],userComponents:{agAnimateShowChangeCellRenderer:UD,agAnimateSlideCellRenderer:ED},apiFunctions:{flashCells:LD}};var DD=class extends S{constructor(){super(...arguments);this.beanName="selectionColSvc"}postConstruct(){this.addManagedPropertyListener("rowSelection",($)=>{this.onSelectionOptionsChanged($.currentValue,$.previousValue,Xz($.source))}),this.addManagedPropertyListener("selectionColumnDef",this.updateColumns.bind(this))}addColumns($){let z=this.columns;if(z==null)return;$.list=z.list.concat($.list),$.tree=z.tree.concat($.tree),_1($)}createColumns($,z){let Q=()=>{J$(this.beans,this.columns?.tree),this.columns=null},J=$.treeDepth,X=(this.columns?.treeDepth??-1)==J,Y=this.generateSelectionCols();if(G1(Y,this.columns?.list??[])&&X)return;Q();let{colGroupSvc:G}=this.beans,_=G?.findDepth($.tree)??0,H=G?.balanceTreeForAutoCols(Y,_)??[];this.columns={list:Y,tree:H,treeDepth:_,map:{}},z((W)=>{if(!W)return null;let B=W.filter((E)=>!I$(E));return[...Y,...B]})}updateColumns($){let z=Xz($.source),{beans:Q}=this;for(let J of this.columns?.list??[]){let Z=this.createSelectionColDef($.currentValue);J.setColDef(Z,null,z),n0(Q,{state:[c2(Z,J.colId)]},z)}}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}isSelectionColumnEnabled(){let{gos:$,beans:z}=this,Q=$.get("rowSelection");if(typeof Q!=="object"||!h$($))return!1;let J=(z.autoColSvc?.getColumns()?.length??0)>0;if(Q.checkboxLocation==="autoGroupColumn"&&J)return!1;let Z=!!Qz(Q),X=n1(Q);return Z||X}createSelectionColDef($){let{gos:z}=this,Q=$??z.get("selectionColumnDef"),J=z.get("enableRtl"),{rowSpan:Z,spanRows:X,...Y}=Q??{};return{width:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:J?"right":"left",comparator(q,G,_,H){let U=_.isSelected(),W=H.isSelected();return U===W?0:U?1:-1},editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,pinned:null,...Y,colId:L7,chartDataType:"excluded"}}generateSelectionCols(){if(!this.isSelectionColumnEnabled())return[];let $=this.createSelectionColDef(),z=$.colId;this.gos.validateColDef($,z,!0);let Q=new q$($,null,z,!1);return this.createBean(Q),[Q]}onSelectionOptionsChanged($,z,Q){let J=z&&typeof z!=="string"?Qz(z):void 0,Z=$&&typeof $!=="string"?Qz($):void 0,X=J!==Z,Y=z&&typeof z!=="string"?n1(z):void 0,q=$&&typeof $!=="string"?n1($):void 0,G=Y!==q,_=EQ($),H=EQ(z);if(X||G||_!==H)this.beans.colModel.refreshAll(Q)}destroy(){J$(this.beans,this.columns?.tree),super.destroy()}refreshVisibility($,z,Q){if(!this.columns?.list.length)return;let J=$.length+z.length+Q.length;if(J===0)return;let Z=this.columns.list[0];if(!Z.isVisible())return;let X=()=>{let G;switch(Z.pinned){case"left":case!0:G=$;break;case"right":G=Q;break;default:G=z}if(G)Z0(G,Z)};if((this.beans.rowNumbersSvc?.getColumn(D7)?2:1)===J)X()}},FD=':where(.ag-selection-checkbox) .ag-checkbox-input-wrapper:before{content:"";cursor:pointer;inset:-8px;position:absolute}';function MD($,z){if(!z.nodes.every((Y)=>{if(Y.rowPinned&&!pJ(Y))return j(59),!1;if(Y.id===void 0)return j(60),!1;return!0}))return;let{nodes:J,source:Z,newValue:X}=z;$.selectionSvc?.setNodesSelected({nodes:J,source:Z??"api",newValue:X})}function kD($,z,Q="apiSelectAll"){$.selectionSvc?.selectAllRowNodes({source:Q,selectAll:z})}function VD($,z,Q="apiSelectAll"){$.selectionSvc?.deselectAllRowNodes({source:Q,selectAll:z})}function AD($,z="apiSelectAllFiltered"){$.selectionSvc?.selectAllRowNodes({source:z,selectAll:"filtered"})}function SD($,z="apiSelectAllFiltered"){$.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"filtered"})}function RD($,z="apiSelectAllCurrentPage"){$.selectionSvc?.selectAllRowNodes({source:z,selectAll:"currentPage"})}function jD($,z="apiSelectAllCurrentPage"){$.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"currentPage"})}function fD($){return $.selectionSvc?.getSelectedNodes()??[]}function OD($){return $.selectionSvc?.getSelectedRows()??[]}var PD={tag:"div",cls:"ag-selection-checkbox",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},TD=class extends x{constructor(){super(PD,[y$]);this.eCheckbox=f}postConstruct(){this.eCheckbox.setPassive(!0)}onDataChanged(){this.onSelectionChanged()}onSelectableChanged(){this.showOrHideSelect()}onSelectionChanged(){let $=this.getLocaleTextFunc(),{rowNode:z,eCheckbox:Q}=this,J=z.isSelected(),Z=f2($,J),[X,Y]=z.selectable?["ariaRowToggleSelection","Press Space to toggle row selection"]:["ariaRowSelectionDisabled","Row Selection is disabled for this row"],q=$(X,Y);Q.setValue(J,!0),Q.setInputAriaLabel(`${q} (${Z})`)}init($){if(this.rowNode=$.rowNode,this.column=$.column,this.overrides=$.overrides,this.onSelectionChanged(),this.addManagedListeners(this.eCheckbox.getWrapperElement(),{dblclick:i0,click:(J)=>{if(i0(J),this.eCheckbox.isDisabled())return;this.beans.selectionSvc?.handleSelectionEvent(J,this.rowNode,"checkboxSelected")}}),this.addManagedListeners(this.rowNode,{rowSelected:this.onSelectionChanged.bind(this),dataChanged:this.onDataChanged.bind(this),selectableChanged:this.onSelectableChanged.bind(this)}),this.addManagedPropertyListener("rowSelection",({currentValue:J,previousValue:Z})=>{let X=typeof J==="object"?SZ(J):void 0,Y=typeof Z==="object"?SZ(Z):void 0;if(X!==Y)this.onSelectableChanged()}),J2(this.gos)||typeof this.getIsVisible()==="function"){let J=this.showOrHideSelect.bind(this);this.addManagedEventListeners({displayedColumnsChanged:J}),this.addManagedListeners(this.rowNode,{dataChanged:J,cellChanged:J}),this.showOrHideSelect()}this.eCheckbox.getInputElement().setAttribute("tabindex","-1")}showOrHideSelect(){let{column:$,rowNode:z,overrides:Q,gos:J}=this,Z=z.selectable,X=this.getIsVisible(),Y=void 0;if(typeof X==="function"){let U=Q?.callbackParams;if(!$)Y=X({...U,node:z,data:z.data});else{let W=$.createColumnFunctionCallbackParams(z);Y=X({...U,...W})}}else Y=X??!1;let q=Z&&!Y||!Z&&Y,G=Z||Y,_=J.get("rowSelection"),H=_&&typeof _!=="string"?!SZ(_):!!$?.getColDef().showDisabledCheckboxes;if(this.setVisible(G&&(q?H:!0)),this.setDisplayed(G&&(q?H:!0)),G)this.eCheckbox.setDisabled(q);if(Q?.removeHidden)this.setDisplayed(G)}getIsVisible(){let $=this.overrides;if($)return $.isVisible;let z=this.gos.get("rowSelection");if(z&&typeof z!=="string")return Qz(z);return this.column?.getColDef()?.checkboxSelection}},vD=class{constructor($,z){this.rowModel=$,this.pinnedRowModel=z,this.selectAll=!1,this.rootId=null,this.endId=null,this.cachedRange=[]}reset(){this.rootId=null,this.endId=null,this.cachedRange.length=0}setRoot($){this.rootId=$.id,this.endId=null,this.cachedRange.length=0}setEndRange($){this.endId=$.id,this.cachedRange.length=0}getRange(){if(this.cachedRange.length===0){let $=this.getRoot(),z=this.getEnd();if($==null||z==null)return this.cachedRange;this.cachedRange=this.getNodesInRange($,z)??[]}return this.cachedRange}isInRange($){if(this.rootId===null)return!1;return this.getRange().some((z)=>z.id===$.id)}getRoot($){if(this.rootId)return this.getRowNode(this.rootId);if($)return this.setRoot($),$}getEnd(){if(this.endId)return this.getRowNode(this.endId)}getRowNode($){let z,{rowModel:Q,pinnedRowModel:J}=this;if(z??(z=Q.getRowNode($)),J?.isManual())z??(z=J.getPinnedRowById($,"top")),z??(z=J.getPinnedRowById($,"bottom"));return z}truncate($){let z=this.getRange();if(z.length===0)return{keep:[],discard:[]};let Q=z[0].id===this.rootId,J=z.findIndex((Z)=>Z.id===$.id);if(J>-1){let Z=z.slice(0,J),X=z.slice(J+1);return this.setEndRange($),Q?{keep:Z,discard:X}:{keep:X,discard:Z}}else return{keep:z,discard:[]}}extend($,z=!1){let Q=this.getRoot();if(Q==null){let Z=this.getRange().slice();if(z)$.depthFirstSearch((X)=>!X.group&&Z.push(X));return Z.push($),this.setRoot($),{keep:Z,discard:[]}}let J=this.getNodesInRange(Q,$);if(!J)return this.setRoot($),{keep:[$],discard:[]};if(J.find((Z)=>Z.id===this.endId))return this.setEndRange($),{keep:this.getRange(),discard:[]};else{let Z=this.getRange().slice();return this.setEndRange($),{keep:this.getRange(),discard:Z}}}getNodesInRange($,z){let{pinnedRowModel:Q,rowModel:J}=this;if(!Q?.isManual())return J.getNodesInRangeForSelection($,z);if($.rowPinned==="top"&&!z.rowPinned)return t0(Q,"top",$,void 0).concat(J.getNodesInRangeForSelection(J.getRow(0),z)??[]);if($.rowPinned==="bottom"&&!z.rowPinned){let Z=t0(Q,"bottom",void 0,$),X=J.getRowCount(),Y=J.getRow(X-1);return(J.getNodesInRangeForSelection(z,Y)??[]).concat(Z)}if(!$.rowPinned&&!z.rowPinned)return J.getNodesInRangeForSelection($,z);if($.rowPinned==="top"&&z.rowPinned==="top")return t0(Q,"top",$,z);if($.rowPinned==="bottom"&&z.rowPinned==="top"){let Z=t0(Q,"top",z,void 0),X=t0(Q,"bottom",void 0,$),Y=J.getRow(0),q=J.getRow(J.getRowCount()-1);return Z.concat(J.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if(!$.rowPinned&&z.rowPinned==="top")return t0(Q,"top",z,void 0).concat(J.getNodesInRangeForSelection(J.getRow(0),$)??[]);if($.rowPinned==="top"&&z.rowPinned==="bottom"){let Z=t0(Q,"top",$,void 0),X=t0(Q,"bottom",void 0,z),Y=J.getRow(0),q=J.getRow(J.getRowCount()-1);return Z.concat(J.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if($.rowPinned==="bottom"&&z.rowPinned==="bottom")return t0(Q,"bottom",$,z);if(!$.rowPinned&&z.rowPinned==="bottom"){let Z=t0(Q,"bottom",void 0,z),X=J.getRow(J.getRowCount());return(J.getNodesInRangeForSelection($,X)??[]).concat(Z)}return null}},ID=class extends S{constructor($){super();this.column=$,this.cbSelectAllVisible=!1,this.processingEventFromCheckbox=!1}onSpaceKeyDown($){let z=this.cbSelectAll;if(z.isDisplayed()&&!z.getGui().contains(d(this.beans)))$.preventDefault(),z.setValue(!z.getValue())}getCheckboxGui(){return this.cbSelectAll.getGui()}setComp($){this.headerCellCtrl=$;let z=this.createManagedBean(new B4);this.cbSelectAll=z,z.addCss("ag-header-select-all"),_0(z.getGui(),"presentation"),this.showOrHideSelectAll();let Q=this.updateStateOfCheckbox.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>this.showOrHideSelectAll(),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),selectionChanged:Q,paginationChanged:Q,modelUpdated:Q}),this.addManagedPropertyListener("rowSelection",({currentValue:J,previousValue:Z})=>{let X=(Y)=>typeof Y==="string"||!Y||Y.mode==="singleRow"?void 0:Y.selectAll;if(X(J)!==X(Z))this.showOrHideSelectAll();this.updateStateOfCheckbox()}),this.addManagedListeners(z,{fieldValueChanged:this.onCbSelectAll.bind(this)}),z.getInputElement().setAttribute("tabindex","-1"),this.refreshSelectAllLabel()}onDisplayedColumnsChanged($){if(!this.isAlive())return;this.showOrHideSelectAll($.source==="uiColumnMoved")}showOrHideSelectAll($=!1){let z=this.isCheckboxSelection();if(this.cbSelectAllVisible=z,this.cbSelectAll.setDisplayed(z),z)this.checkRightRowModelType("selectAllCheckbox"),this.checkSelectionType("selectAllCheckbox"),this.updateStateOfCheckbox();this.refreshSelectAllLabel($)}updateStateOfCheckbox(){if(!this.cbSelectAllVisible||this.processingEventFromCheckbox)return;this.processingEventFromCheckbox=!0;let $=this.getSelectAllMode(),z=this.beans.selectionSvc,Q=this.cbSelectAll,J=z.getSelectAllState($);Q.setValue(J);let Z=z.hasNodesToSelect($);Q.setDisabled(!Z),this.refreshSelectAllLabel(),this.processingEventFromCheckbox=!1}refreshSelectAllLabel($=!1){let z=this.getLocaleTextFunc(),{headerCellCtrl:Q,cbSelectAll:J,cbSelectAllVisible:Z}=this,X=J.getValue(),Y=f2(z,X),q=z("ariaRowSelectAll","Press Space to toggle all rows selection");if(Q.setAriaDescriptionProperty("selectAll",Z?`${q} (${Y})`:null),J.setInputAriaLabel(z("ariaHeaderSelection","Column with Header Selection")),!$)Q.announceAriaDescription()}checkSelectionType($){if(!rQ(this.gos))return j(128,{feature:$}),!1;return!0}checkRightRowModelType($){let{gos:z,rowModel:Q}=this.beans;if(!(o(z)||_z(z)))return j(129,{feature:$,rowModel:Q.getType()}),!1;return!0}onCbSelectAll(){if(this.processingEventFromCheckbox)return;if(!this.cbSelectAllVisible)return;let $=this.cbSelectAll.getValue(),z=this.getSelectAllMode(),Q="uiSelectAll";if(z==="currentPage")Q="uiSelectAllCurrentPage";else if(z==="filtered")Q="uiSelectAllFiltered";let J={source:Q,selectAll:z},Z=this.beans.selectionSvc;if($)Z.selectAllRowNodes(J);else Z.deselectAllRowNodes(J)}isCheckboxSelection(){let{column:$,gos:z,beans:Q}=this,X=typeof z.get("rowSelection")==="object"?"headerCheckbox":"headerCheckboxSelection";return D9(Q,$)&&this.checkRightRowModelType(X)&&this.checkSelectionType(X)}getSelectAllMode(){let $=q7(this.gos,!1);if($)return $;let{headerCheckboxSelectionCurrentPageOnly:z,headerCheckboxSelectionFilteredOnly:Q}=this.column.getColDef();if(z)return"currentPage";if(Q)return"filtered";return"all"}destroy(){super.destroy(),this.cbSelectAll=void 0,this.headerCellCtrl=void 0}};function D9({gos:$,selectionColSvc:z},Q){let J=$.get("rowSelection"),Z=Q.getColDef(),{headerCheckboxSelection:X}=Z,Y=!1;if(typeof J==="object"){let G=I$(Q),_=mz(Q);if(EQ(J)==="autoGroupColumn"&&_||G&&z?.isSelectionColumnEnabled())Y=n1(J)}else if(typeof X==="function")Y=X(y($,{column:Q,colDef:Z}));else Y=!!X;return Y}var CD=class extends S{postConstruct(){let{gos:$,beans:z}=this;this.selectionCtx=new vD(z.rowModel,z.pinnedRowModel),this.addManagedPropertyListeners(["isRowSelectable","rowSelection"],()=>{let Q=J2($);if(Q!==this.isRowSelectable)this.isRowSelectable=Q,this.updateSelectable()}),this.isRowSelectable=J2($),this.addManagedEventListeners({cellValueChanged:(Q)=>this.updateRowSelectable(Q.node),rowNodeDataChanged:(Q)=>this.updateRowSelectable(Q.node)})}destroy(){super.destroy(),this.selectionCtx.reset()}createCheckboxSelectionComponent(){return new TD}createSelectAllFeature($){if(D9(this.beans,$))return new ID($)}isMultiSelect(){return rQ(this.gos)}onRowCtrlSelected($,z,Q){let J=!!$.rowNode.isSelected();$.forEachGui(Q,(Z)=>{Z.rowComp.toggleCss("ag-row-selected",J);let X=Z.element;if(j2(X,J),X.contains(d(this.beans)))z(Z)})}announceAriaRowSelection($){if(this.isRowSelectionBlocked($))return;let z=$.isSelected(),Q=this.beans.editSvc?.isEditing({rowNode:$});if(!$.selectable||Q)return;let Z=this.getLocaleTextFunc()(z?"ariaRowDeselect":"ariaRowSelect",`Press SPACE to ${z?"deselect":"select"} this row`);this.beans.ariaAnnounce?.announceValue(Z,"rowSelection")}isRowSelectionBlocked($){return!$.selectable||$.rowPinned&&!pJ($)||!h$(this.gos)}updateRowSelectable($,z){let Q=$.rowPinned&&$.pinnedSibling?$.pinnedSibling.selectable:this.isRowSelectable?.($)??!0;return this.setRowSelectable($,Q,z),Q}setRowSelectable($,z,Q){if($.selectable!==z){if($.selectable=z,$.dispatchRowEvent("selectableChanged"),Q)return;if(lQ(this.gos)){let Z=this.calculateSelectedFromChildren($);this.setNodesSelected({nodes:[$],newValue:Z??!1,source:"selectableChanged"});return}if($.isSelected()&&!$.selectable)this.setNodesSelected({nodes:[$],newValue:!1,source:"selectableChanged"})}}calculateSelectedFromChildren($){let z=!1,Q=!1;if(!$.childrenAfterGroup?.length)return $.selectable?$.__selected:null;for(let J=0;J<$.childrenAfterGroup.length;J++){let Z=$.childrenAfterGroup[J],X=Z.isSelected();if(!Z.selectable){let Y=this.calculateSelectedFromChildren(Z);if(Y===null)continue;X=Y}switch(X){case!0:z=!0;break;case!1:Q=!0;break;default:return}}if(z&&Q)return;if(z)return!0;if(Q)return!1;if(!$.selectable)return null;return $.__selected}selectRowNode($,z,Q,J="api"){if(z&&$.destroyed)return!1;let Z=!$.selectable&&z,X=$.__selected===z;if(Z||X)return!1;$.__selected=z,$.dispatchRowEvent("rowSelected");let Y=$.sibling;if(Y&&Y.footer&&Y.__localEventService)Y.dispatchRowEvent("rowSelected");let q=$.pinnedSibling;if(q?.rowPinned&&q.__localEventService)q.dispatchRowEvent("rowSelected");return this.eventSvc.dispatchEvent({...a2($,this.gos,"rowSelected"),event:Q||null,source:J}),!0}isCellCheckboxSelection($,z){let Q=this.gos.get("rowSelection");if(Q&&typeof Q!=="string"){let J=I$($)&&Qz(Q);return $.isColumnFunc(z,J)}else return $.isColumnFunc(z,$.colDef.checkboxSelection)}inferNodeSelections($,z,Q,J){let{gos:Z,selectionCtx:X}=this,Y=$.isSelected(),q=lQ(Z),G=Oq(Z),_=Pq(Z),H=this.isMultiSelect(),U=J==="rowClicked";if(U&&!(G||_))return null;if(z&&Q&&H){let W=X.getRoot();if(!W)return null;else if(!W.isSelected()){let B=X.extend($,q);return{select:[],deselect:B.keep,reset:!1}}else{let B=X.isInRange($)?X.truncate($):X.extend($,q);return{deselect:B.discard,select:B.keep,reset:!1}}}else if(z&&H){let W=X.selectAll?this.beans.rowModel.getRow(0):void 0,B=X.getRoot(W),E=X.isInRange($)?X.truncate($):X.extend($,q);return{select:E.keep,deselect:E.discard,reset:X.selectAll||!!(B&&!B.isSelected())}}else if(Q){if(U){let W=!Y;if(W&&!G||!W&&!_)return null;return X.setRoot($),{node:$,newValue:W,clearSelection:!1}}return X.setRoot($),{node:$,newValue:!Y,clearSelection:!H}}else{X.setRoot($);let W=Tq(Z),B=JJ(Z)==="filteredDescendants",E=U&&(!W||!G);if(B&&Y===void 0&&o(Z))return{node:$,newValue:!1,checkFilteredNodes:!0,clearSelection:!H||E};if(U){let K=Y?!W:G;if(K===Y&&!E||K&&!G||!K&&!_)return null;return{node:$,newValue:K,clearSelection:!H||E,keepDescendants:$.group&&q}}return{node:$,newValue:!Y,clearSelection:!H||E}}}},bD=class extends CD{constructor(){super(...arguments);this.beanName="selectionSvc",this.selectedNodes=new Map,this.detailSelection=new Map,this.masterSelectsDetail=!1}postConstruct(){super.postConstruct();let{gos:$}=this;this.mode=QJ($),this.groupSelectsDescendants=lQ($),this.groupSelectsFiltered=JJ($)==="filteredDescendants",this.masterSelectsDetail=B5($)==="detail",this.addManagedPropertyListeners(["groupSelectsChildren","groupSelectsFiltered","rowSelection"],()=>{let z=lQ($),Q=QJ($),J=JJ($)==="filteredDescendants";if(this.masterSelectsDetail=B5($)==="detail",z!==this.groupSelectsDescendants||J!==this.groupSelectsFiltered||Q!==this.mode)this.deselectAllRowNodes({source:"api"}),this.groupSelectsDescendants=z,this.groupSelectsFiltered=J,this.mode=Q}),this.addManagedEventListeners({rowSelected:this.onRowSelected.bind(this)})}destroy(){super.destroy(),this.resetNodes()}handleSelectionEvent($,z,Q){if(this.isRowSelectionBlocked(z))return 0;let J=this.inferNodeSelections(z,$.shiftKey,$.metaKey||$.ctrlKey,Q);if(J==null)return 0;if(this.selectionCtx.selectAll=!1,"select"in J){if(J.reset)this.resetNodes();else this.selectRange(J.deselect,!1,Q);return this.selectRange(J.select,!0,Q)}else{let Z=J.checkFilteredNodes?M9(J.node):J.newValue;return this.setNodesSelected({nodes:[J.node],newValue:Z,clearSelection:J.clearSelection,keepDescendants:J.keepDescendants,event:$,source:Q})}}setNodesSelected({newValue:$,clearSelection:z,suppressFinishActions:Q,nodes:J,event:Z,source:X,keepDescendants:Y=!1}){if(J.length===0)return 0;let{gos:q}=this;if(!h$(q)&&$)return j(132),0;if(J.length>1&&!this.isMultiSelect())return j(130),0;let G=0;for(let _=0;_0)this.updateGroupsFromChildrenSelections(X),this.dispatchSelectionChanged(X)}return G}selectRange($,z,Q){let J=0;if($.forEach((Z)=>{let X=Z.primaryRow;if(X.group&&this.groupSelectsDescendants)return;if(this.selectRowNode(X,z,void 0,Q))J++}),J>0)this.updateGroupsFromChildrenSelections(Q),this.dispatchSelectionChanged(Q);return J}selectChildren($,z,Q){let J=this.groupSelectsFiltered?$.childrenAfterAggFilter:$.childrenAfterGroup;if(!J)return 0;return this.setNodesSelected({newValue:z,clearSelection:!1,suppressFinishActions:!0,source:Q,nodes:J})}getSelectedNodes(){return Array.from(this.selectedNodes.values())}getSelectedRows(){let $=[];return this.selectedNodes.forEach((z)=>z.data&&$.push(z.data)),$}getSelectionCount(){return this.selectedNodes.size}filterFromSelection($){let z=new Map;this.selectedNodes.forEach((Q,J)=>{if($(Q))z.set(J,Q)}),this.selectedNodes=z}updateGroupsFromChildrenSelections($,z){if(!this.groupSelectsDescendants)return!1;let{gos:Q,rowModel:J}=this.beans;if(!o(Q,J))return!1;let Z=J.rootNode;if(!Z)return!1;let X=!1,Y=(q)=>{if(q!==Z){let G=this.calculateSelectedFromChildren(q);X=this.selectRowNode(q,G===null?!1:G,void 0,$)||X}};return S0(Z,this.beans.rowModel.hierarchical,z,Y),X}clearOtherNodes($,z,Q){let J=new Map,Z=0;return this.selectedNodes.forEach((X)=>{let Y=X.id==$.id;if((z?!xD($,X):!0)&&!Y){let G=this.selectedNodes.get(X.id);if(Z+=this.setNodesSelected({nodes:[G],newValue:!1,clearSelection:!1,suppressFinishActions:!0,source:Q}),this.groupSelectsDescendants&&X.parent)J.set(X.parent.id,X.parent)}}),J.forEach((X)=>{let Y=this.calculateSelectedFromChildren(X);this.selectRowNode(X,Y===null?!1:Y,void 0,Q)}),Z}onRowSelected($){let z=$.node;if(this.groupSelectsDescendants&&z.group)return;if(z.isSelected())this.selectedNodes.set(z.id,z);else this.selectedNodes.delete(z.id)}syncInRowNode($,z){this.syncInOldRowNode($,z),this.syncInNewRowNode($)}createDaemonNode($){if(!$.id)return;let z=new Wz(this.beans);return z.id=$.id,z.data=$.data,z.__selected=$.__selected,z.level=$.level,z}syncInOldRowNode($,z){if(z&&$.id!==z.id){if(this.selectedNodes.get(z.id)==$)this.selectedNodes.set(z.id,z)}}syncInNewRowNode($){if(this.selectedNodes.has($.id))$.__selected=!0,this.selectedNodes.set($.id,$);else $.__selected=!1}reset($){let z=this.getSelectionCount();if(this.resetNodes(),z)this.dispatchSelectionChanged($)}resetNodes(){this.selectedNodes.forEach(($)=>{this.selectRowNode($,!1)}),this.selectedNodes.clear()}getBestCostNodeSelection(){let{gos:$,rowModel:z}=this.beans;if(!o($,z))return;let Q=z.getTopLevelNodes();if(Q===null)return;let J=[];function Z(X){for(let Y=0,q=X.length;Y{let Y=this.selectRowNode(X.primaryRow,!1,void 0,$);J||(J=Y)};if(z==="currentPage"||z==="filtered"){if(!Q){e(102);return}this.getNodesToSelect(z).forEach(Z)}else this.selectedNodes.forEach(Z),this.reset($);if(this.selectionCtx.selectAll=!1,Q&&this.groupSelectsDescendants){let X=this.updateGroupsFromChildrenSelections($);J||(J=X)}if(J)this.dispatchSelectionChanged($)}getSelectedCounts($){let z=0,Q=0;return this.getNodesToSelect($).forEach((J)=>{if(this.groupSelectsDescendants&&J.group)return;if(J.isSelected())z++;else if(J.selectable)Q++}),{selectedCount:z,notSelectedCount:Q}}getSelectAllState($){let{selectedCount:z,notSelectedCount:Q}=this.getSelectedCounts($);return F9(z,Q)??null}hasNodesToSelect($){return this.getNodesToSelect($).filter((z)=>z.selectable).length>0}getNodesToSelect($){if(!this.canSelectAll())return[];let z=[],Q=(Z)=>z.push(Z);if($==="currentPage")return this.forEachNodeOnPage((Z)=>{if(!Z.group){Q(Z);return}if(!Z.footer&&!Z.expanded){let X=(Y)=>{Q(Y);let q=Y.childrenAfterFilter;if(q)for(let G=0,_=q.length;G<_;++G)X(q[G])};X(Z);return}if(!this.groupSelectsDescendants)Q(Z)}),z;let J=this.beans.rowModel;if($==="filtered")return J.forEachNodeAfterFilter(Q),z;return J.forEachNode(Q),z}forEachNodeOnPage($){let{pageBounds:z,rowModel:Q}=this.beans,J=z.getFirstRow(),Z=z.getLastRow();for(let X=J;X<=Z;X++){let Y=Q.getRow(X);if(Y)$(Y)}}selectAllRowNodes($){let{gos:z,selectionCtx:Q}=this;if(!h$(z)){j(132);return}if(fq(z)&&!rQ(z)){j(130);return}if(!this.canSelectAll())return;let{source:J,selectAll:Z}=$,X=!1;if(this.getNodesToSelect(Z).forEach((Y)=>{let q=this.selectRowNode(Y.primaryRow,!0,void 0,J);X||(X=q)}),Q.selectAll=!0,o(z)&&this.groupSelectsDescendants){let Y=this.updateGroupsFromChildrenSelections(J);X||(X=Y)}if(X)this.dispatchSelectionChanged(J)}getSelectionState(){return this.isEmpty()?null:Array.from(this.selectedNodes.keys())}setSelectionState($,z,Q){if(!$)$=[];if(!Array.isArray($)){e(103);return}let J=new Set($),Z=[];if(this.beans.rowModel.forEachNode((X)=>{if(J.has(X.id))Z.push(X)}),Q)this.resetNodes();this.setNodesSelected({newValue:!0,nodes:Z,source:z})}canSelectAll(){return o(this.beans.gos)}updateSelectable($){let{gos:z,rowModel:Q}=this.beans;if(!h$(z))return;let J="selectableChanged",Z=o(z)&&this.groupSelectsDescendants,X=[];if(Z){let Y=Q.rootNode;if(Y)S0(Y,Q.hierarchical,$,(q)=>{let G=!1;for(let _ of q.childrenAfterGroup)if(G||(G=_.selectable),!_.group&&!this.updateRowSelectable(_,!0)&&_.isSelected())X.push(_);this.setRowSelectable(q,G,!0)})}else Q.forEachNode((Y)=>{if(!this.updateRowSelectable(Y,!0)&&Y.isSelected())X.push(Y)});if(X.length)this.setNodesSelected({nodes:X,newValue:!1,source:J});if(!$&&Z)this.updateGroupsFromChildrenSelections?.(J)}updateSelectableAfterGrouping($){if(this.updateSelectable($),this.groupSelectsDescendants){if(this.updateGroupsFromChildrenSelections?.("rowGroupChanged",$))this.dispatchSelectionChanged("rowGroupChanged")}}refreshMasterNodeState($,z){if(!this.masterSelectsDetail)return;let Q=$.detailNode?.detailGridInfo?.api;if(!Q)return;let J=yD(Q);if($.isSelected()!==J){if(this.selectRowNode($,J,z,"masterDetail"))this.dispatchSelectionChanged("masterDetail")}if(!J)this.detailSelection.set($.id,new Set(Q.getSelectedNodes().map((X)=>X.id)))}setDetailSelectionState($,z,Q){if(!this.masterSelectsDetail)return;if(!rQ(z)){j(269);return}switch($.isSelected()){case!0:{Q.selectAll();break}case!1:{Q.deselectAll();break}case void 0:{let J=this.detailSelection.get($.id);if(J){let Z=[];for(let X of J){let Y=Q.getRowNode(X);if(Y)Z.push(Y)}Q.setNodesSelected({nodes:Z,newValue:!0,source:"masterDetail"})}break}default:break}}dispatchSelectionChanged($){this.eventSvc.dispatchEvent({type:"selectionChanged",source:$,selectedNodes:this.getSelectedNodes(),serverSideState:null})}};function yD($){let z=0,Q=0;return $.forEachNode((J)=>{if(J.isSelected())z++;else if(J.selectable)Q++}),F9(z,Q)}function F9($,z){if($===0&&z===0)return!1;if($>0&&z>0)return;return $>0}function xD($,z){let Q=z.parent;while(Q){if(Q===$)return!0;Q=Q.parent}return!1}function M9($){let z=$.isSelected()===!1,Q=$.childrenAfterFilter?.some(M9)??!1;return z||Q}var wD={moduleName:"SharedRowSelection",version:p,beans:[DD],css:[FD],apiFunctions:{setNodesSelected:MD,selectAll:kD,deselectAll:VD,selectAllFiltered:AD,deselectAllFiltered:SD,selectAllOnCurrentPage:RD,deselectAllOnCurrentPage:jD,getSelectedNodes:fD,getSelectedRows:OD}},k9={moduleName:"RowSelection",version:p,rowModels:["clientSide","infinite","viewport"],beans:[bD],dependsOn:[wD]},ND=class extends S{constructor($,z){super();this.cellCtrl=$,this.staticClasses=[],this.beans=z,this.column=$.column}setComp($){this.cellComp=$,this.applyUserStyles(),this.applyCellClassRules(),this.applyClassesFromColDef()}applyCellClassRules(){let{column:$,cellComp:z}=this,Q=$.colDef,J=Q.cellClassRules,Z=this.getCellClassParams($,Q);c8(this.beans.expressionSvc,J===this.cellClassRules?void 0:this.cellClassRules,J,Z,(X)=>z.toggleCss(X,!0),(X)=>z.toggleCss(X,!1)),this.cellClassRules=J}applyUserStyles(){let $=this.column,z=$.colDef,Q=z.cellStyle;if(!Q)return;let J;if(typeof Q==="function"){let Z=this.getCellClassParams($,z);J=Q(Z)}else J=Q;if(J)this.cellComp.setUserStyles(J)}applyClassesFromColDef(){let{column:$,cellComp:z}=this,Q=$.colDef,J=this.getCellClassParams($,Q);for(let X of this.staticClasses)z.toggleCss(X,!1);let Z=this.beans.cellStyles.getStaticCellClasses(Q,J);this.staticClasses=Z;for(let X of Z)z.toggleCss(X,!0)}getCellClassParams($,z){let{value:Q,rowNode:J}=this.cellCtrl;return y(this.beans.gos,{value:Q,data:J.data,node:J,colDef:z,column:$,rowIndex:J.rowIndex})}},gD=class extends S{constructor(){super(...arguments);this.beanName="cellStyles"}processAllCellClasses($,z,Q,J){c8(this.beans.expressionSvc,void 0,$.cellClassRules,z,Q,J),this.processStaticCellClasses($,z,Q)}getStaticCellClasses($,z){let{cellClass:Q}=$;if(!Q)return[];let J;if(typeof Q==="function")J=Q(z);else J=Q;if(typeof J==="string")J=[J];return J||[]}createCellCustomStyleFeature($){return new ND($,this.beans)}processStaticCellClasses($,z,Q){this.getStaticCellClasses($,z).forEach((Z)=>{Q(Z)})}},V9={moduleName:"CellStyle",version:p,beans:[gD]};var hD={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,overlayComponent:!0,suppressOverlays:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,groupLockGroupColumns:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,renderingMode:!0,columnMenu:!0,suppressSetFilterByDefault:!0,getDataPath:!0,enableCellSpan:!0,enableFilterHandlers:!0,filterHandlers:!0},g0="clientSide",C0="serverSide",$Q="infinite",uD={onGroupExpandedOrCollapsed:[g0],refreshClientSideRowModel:[g0],isRowDataEmpty:[g0],forEachLeafNode:[g0],forEachNodeAfterFilter:[g0],forEachNodeAfterFilterAndSort:[g0],resetRowHeights:[g0,C0],applyTransaction:[g0],applyTransactionAsync:[g0],flushAsyncTransactions:[g0],getBestCostNodeSelection:[g0],getServerSideSelectionState:[C0],setServerSideSelectionState:[C0],applyServerSideTransaction:[C0],applyServerSideTransactionAsync:[C0],applyServerSideRowData:[C0],retryServerSideLoads:[C0],flushServerSideAsyncTransactions:[C0],refreshServerSide:[C0],getServerSideGroupLevelState:[C0],refreshInfiniteCache:[$Q],purgeInfiniteCache:[$Q],getInfiniteRowCount:[$Q],isLastRowIndexKnown:[$Q,C0],expandAll:[g0,C0],collapseAll:[g0,C0],onRowHeightChanged:[g0,C0],setRowCount:[$Q,C0],getCacheBlockState:[$Q,C0]},mD={showLoadingOverlay:{version:"v32",message:'`showLoadingOverlay` is deprecated. Use the grid option "loading"=true instead or setGridOption("loading", true).'},clearRangeSelection:{version:"v32.2",message:"Use `clearCellSelection` instead."},getInfiniteRowCount:{version:"v32.2",old:"getInfiniteRowCount()",new:"getDisplayedRowCount()"},selectAllFiltered:{version:"v33",old:"selectAllFiltered()",new:'selectAll("filtered")'},deselectAllFiltered:{version:"v33",old:"deselectAllFiltered()",new:'deselectAll("filtered")'},selectAllOnCurrentPage:{version:"v33",old:"selectAllOnCurrentPage()",new:'selectAll("currentPage")'},deselectAllOnCurrentPage:{version:"v33",old:"deselectAllOnCurrentPage()",new:'deselectAll("currentPage")'}};function cD($,z,Q){let J=mD[$];if(J){let{version:X,new:Y,old:q,message:G}=J,_=q??$;return(...H)=>{let U=Y?`Please use ${Y} instead. `:"";return zz(`Since ${X} api.${_} is deprecated. ${U}${G??""}`),z.apply(z,H)}}let Z=uD[$];if(Z)return(...X)=>{let Y=Q.rowModel.getType();if(!Z.includes(Y)){GQ(`api.${$} can only be called when gridOptions.rowModelType is ${Z.join(" or ")}`);return}return z.apply(z,X)};return z}var pD={detailCellRendererCtrl:"SharedMasterDetail",dndSourceComp:"DragAndDrop",fillHandle:"CellSelection",groupCellRendererCtrl:"GroupCellRenderer",headerFilterCellCtrl:"ColumnFilter",headerGroupCellCtrl:"ColumnGroup",rangeHandle:"CellSelection",tooltipFeature:"Tooltip",highlightTooltipFeature:"Tooltip",tooltipStateManager:"Tooltip",groupStrategy:"RowGrouping",treeGroupStrategy:"TreeData",rowNumberRowResizer:"RowNumbers",singleCell:"EditCore",fullRow:"EditCore",agSetColumnFilterHandler:"SetFilter",agMultiColumnFilterHandler:"MultiFilter",agGroupColumnFilterHandler:"GroupFilter",agNumberColumnFilterHandler:"NumberFilter",agBigIntColumnFilterHandler:"BigIntFilter",agDateColumnFilterHandler:"DateFilter",agTextColumnFilterHandler:"TextFilter"},iD={expanded:1,contracted:1,"tree-closed":1,"tree-open":1,"tree-indeterminate":1,pin:1,"eye-slash":1,arrows:1,left:1,right:1,group:1,aggregation:1,pivot:1,"not-allowed":1,chart:1,cross:1,cancel:1,tick:1,first:1,previous:1,next:1,last:1,linked:1,unlinked:1,"color-picker":1,loading:1,menu:1,"menu-alt":1,filter:1,"filter-add":1,columns:1,maximize:1,minimize:1,copy:1,cut:1,paste:1,grip:1,save:1,csv:1,excel:1,"small-down":1,"small-left":1,"small-right":1,"small-up":1,asc:1,desc:1,aasc:1,adesc:1,none:1,up:1,down:1,plus:1,minus:1,settings:1,"checkbox-checked":1,"checkbox-indeterminate":1,"checkbox-unchecked":1,"radio-button-on":1,"radio-button-off":1,eye:1,"column-arrow":1,"un-pin":1,"pinned-top":1,"pinned-bottom":1,"chevron-up":1,"chevron-down":1,"chevron-left":1,"chevron-right":1,edit:1},nD={chart:"MenuCore",cancel:"EnterpriseCore",first:"Pagination",previous:"Pagination",next:"Pagination",last:"Pagination",linked:"IntegratedCharts",loadingMenuItems:"MenuCore",unlinked:"IntegratedCharts",menu:"ColumnHeaderComp",legacyMenu:"ColumnMenu",filter:"ColumnFilter",filterActive:"ColumnFilter",filterAdd:"NewFiltersToolPanel",filterCardCollapse:"NewFiltersToolPanel",filterCardExpand:"NewFiltersToolPanel",filterCardEditing:"NewFiltersToolPanel",filterTab:"ColumnMenu",filtersToolPanel:"FiltersToolPanel",columns:["MenuCore"],columnsToolPanel:["ColumnsToolPanel"],maximize:"EnterpriseCore",minimize:"EnterpriseCore",save:"MenuCore",columnGroupOpened:"ColumnGroupHeaderComp",columnGroupClosed:"ColumnGroupHeaderComp",accordionOpen:"EnterpriseCore",accordionClosed:"EnterpriseCore",accordionIndeterminate:"EnterpriseCore",columnSelectClosed:["ColumnsToolPanel","ColumnMenu"],columnSelectOpen:["ColumnsToolPanel","ColumnMenu"],columnSelectIndeterminate:["ColumnsToolPanel","ColumnMenu"],columnMovePin:"SharedDragAndDrop",columnMoveHide:"SharedDragAndDrop",columnMoveMove:"SharedDragAndDrop",columnMoveLeft:"SharedDragAndDrop",columnMoveRight:"SharedDragAndDrop",columnMoveGroup:"SharedDragAndDrop",columnMoveValue:"SharedDragAndDrop",columnMovePivot:"SharedDragAndDrop",dropNotAllowed:"SharedDragAndDrop",ensureColumnVisible:["ColumnsToolPanel","ColumnMenu"],groupContracted:"GroupCellRenderer",groupExpanded:"GroupCellRenderer",setFilterGroupClosed:"SetFilter",setFilterGroupOpen:"SetFilter",setFilterGroupIndeterminate:"SetFilter",setFilterLoading:"SetFilter",close:"EnterpriseCore",check:"MenuItem",colorPicker:"CommunityCore",groupLoading:"LoadingCellRenderer",overlayLoading:"Overlay",overlayExporting:"Overlay",menuAlt:"ColumnHeaderComp",menuPin:"MenuCore",menuValue:"MenuCore",menuAddRowGroup:["MenuCore","ColumnsToolPanel"],menuRemoveRowGroup:["MenuCore","ColumnsToolPanel"],clipboardCopy:"MenuCore",clipboardCut:"MenuCore",clipboardPaste:"MenuCore",pivotPanel:["ColumnsToolPanel","RowGroupingPanel"],rowGroupPanel:["ColumnsToolPanel","RowGroupingPanel"],valuePanel:"ColumnsToolPanel",columnDrag:"EnterpriseCore",rowDrag:["RowDrag","DragAndDrop"],csvExport:"MenuCore",excelExport:"MenuCore",smallDown:"CommunityCore",selectOpen:"CommunityCore",richSelectOpen:"RichSelect",richSelectRemove:"RichSelect",richSelectLoading:"RichSelect",smallLeft:"CommunityCore",smallRight:"CommunityCore",subMenuOpen:"MenuItem",subMenuOpenRtl:"MenuItem",panelDelimiter:"RowGroupingPanel",panelDelimiterRtl:"RowGroupingPanel",smallUp:"CommunityCore",sortAscending:["MenuCore","Sort"],sortDescending:["MenuCore","Sort"],sortAbsoluteAscending:["MenuCore","Sort"],sortAbsoluteDescending:["MenuCore","Sort"],sortUnSort:["MenuCore","Sort"],advancedFilterBuilder:"AdvancedFilter",advancedFilterBuilderDrag:"AdvancedFilter",advancedFilterBuilderInvalid:"AdvancedFilter",advancedFilterBuilderMoveUp:"AdvancedFilter",advancedFilterBuilderMoveDown:"AdvancedFilter",advancedFilterBuilderAdd:"AdvancedFilter",advancedFilterBuilderRemove:"AdvancedFilter",advancedFilterBuilderSelectOpen:"AdvancedFilter",chartsMenu:"IntegratedCharts",chartsMenuEdit:"IntegratedCharts",chartsMenuAdvancedSettings:"IntegratedCharts",chartsMenuAdd:"IntegratedCharts",chartsColorPicker:"IntegratedCharts",chartsThemePrevious:"IntegratedCharts",chartsThemeNext:"IntegratedCharts",chartsDownload:"IntegratedCharts",checkboxChecked:"CommunityCore",checkboxIndeterminate:"CommunityCore",checkboxUnchecked:"CommunityCore",radioButtonOn:"CommunityCore",radioButtonOff:"CommunityCore",rowPin:"PinnedRow",rowUnpin:"PinnedRow",rowPinBottom:"PinnedRow",rowPinTop:"PinnedRow"},dD=new Set(["colorPicker","smallUp","checkboxChecked","checkboxIndeterminate","checkboxUnchecked","radioButtonOn","radioButtonOff","smallDown","smallLeft","smallRight"]),tD=class extends S{constructor(){super(...arguments);this.beanName="validation"}wireBeans($){this.gridOptions=$.gridOptions,Kq(r3)}warnOnInitialPropertyUpdate($,z){if($==="api"&&hD[z])j(22,{key:z})}processGridOptions($){this.processOptions($,nB())}validateApiFunction($,z){return cD($,z,this.beans)}missingUserComponent($,z,Q,J){let Z=BQ[z];if(Z)this.gos.assertModuleRegistered(Z,`AG Grid '${$}' component: ${z}`);else j(101,{propertyName:$,componentName:z,agGridDefaults:Q,jsComps:J})}missingDynamicBean($){let z=pD[$];return z?$$(200,{...this.gos.getModuleErrorParams(),moduleName:z,reasonOrId:$}):void 0}checkRowEvents($){if(rD.has($))j(10,{eventType:$})}validateIcon($){if(dD.has($))j(43,{iconName:$});if(iD[$])return;let z=nD[$];if(z){e(200,{reasonOrId:`icon '${$}'`,moduleName:z,gridScoped:y2(),gridId:this.beans.context.getId(),rowModelType:this.gos.get("rowModelType"),additionalText:"Alternatively, use the CSS icon name directly."});return}j(134,{iconName:$})}isProvidedUserComp($){return!!BQ[$]}validateColDef($){this.processOptions($,yB())}processOptions($,z){let{validations:Q,deprecations:J,allProperties:Z,propertyExceptions:X,objectName:Y,docsUrl:q}=z;if(Z&&this.gridOptions.suppressPropertyNamesCheck!==!0)this.checkProperties($,[...X??[],...Object.keys(J)],Z,Y,q);let G=new Set;if(Object.keys($).forEach((H)=>{let U=J[H];if(U){let{message:F,version:M}=U;G.add(`As of v${M}, ${String(H)} is deprecated. ${F??""}`)}let W=$[H];if(W==null||W===!1)return;let B=Q[H];if(!B)return;let{dependencies:E,validate:K,supportedRowModels:L,expectedType:D}=B;if(D){let F=typeof W;if(F!==D){G.add(`${String(H)} should be of type '${D}' but received '${F}' (${W}).`);return}}if(L){let F=this.gridOptions.rowModelType??"clientSide";if(!L.includes(F)){G.add(`${String(H)} is not supported with the '${F}' row model. It is only valid with: ${L.join(", ")}.`);return}}if(E){let F=this.checkForRequiredDependencies(H,E,$);if(F){G.add(F);return}}if(K){let F=K($,this.gridOptions,this.beans);if(F){G.add(F);return}}}),G.size>0)for(let H of G)zz(H)}checkForRequiredDependencies($,z,Q){let Z=Object.entries(z).filter(([X,Y])=>{let q=Q[X];return!Y.required.includes(q)});if(Z.length===0)return null;return Z.map(([X,Y])=>`'${String($)}' requires '${X}' to be one of [${Y.required.map((q)=>{if(q===null)return"null";else if(q===void 0)return"undefined";return q}).join(", ")}]. ${Y.reason??""}`).join(` + `)}checkProperties($,z,Q,J,Z){let X=["__ob__","__v_skip","__metadata__"],Y=sD(Object.getOwnPropertyNames($),[...X,...z,...Q],Q),q=Object.keys(Y);for(let G of q){let _=Y[G],H=`invalid ${J} property '${G}' did you mean any of these: ${_.slice(0,8).join(", ")}.`;if(Q.includes("context"))H+=` +If you are trying to annotate ${J} with application data, use the '${J}.context' property instead.`;zz(H)}if(q.length>0&&Z){let G=this.beans.frameworkOverrides.getDocLink(Z);zz(`to see all the valid ${J} properties please check: ${G}`)}}};function sD($,z,Q){let J={},Z=$.filter((X)=>!z.some((Y)=>Y===X));if(Z.length>0)for(let X of Z)J[X]=D2({inputValue:X,allSuggestions:Q}).values;return J}var rD=new Set(["firstChildChanged","lastChildChanged","childIndexChanged"]),A9={moduleName:"Validation",version:p,beans:[tD]};var RQ=class extends S{constructor(){super(...arguments);this.dispatchColumnChangedEvent=K8,this.columns=[],this.columnIndexMap={},this.updateIndexMap=()=>{this.columnIndexMap={},this.columns.forEach(($,z)=>this.columnIndexMap[$.getId()]=z)}}wireBeans($){this.colModel=$.colModel,this.aggFuncSvc=$.aggFuncSvc,this.visibleCols=$.visibleCols,this.groupHierarchCols=$.groupHierarchyColSvc}sortColumns($){let{groupHierarchCols:z}=this;this.columns.sort((Q,J)=>z?.compareVirtualColumns(Q,J)??$(Q,J)),this.updateIndexMap()}setColumns($,z){this.setColList($,this.columns,this.eventName,!0,!0,this.columnProcessors.set,z)}addColumns($,z){this.updateColList($,this.columns,!0,!0,this.columnProcessors.add,this.eventName,z)}removeColumns($,z){this.updateColList($,this.columns,!1,!0,this.columnProcessors.remove,this.eventName,z)}getColumnIndex($){return this.columnIndexMap[$]}setColList($=[],z,Q,J,Z,X,Y){let q=this.colModel.getCols();if(!q||q.length===0)return;let G=new Map;z.forEach((H,U)=>G.set(H,U)),z.length=0;for(let H of $){let U=this.colModel.getColDefCol(H);if(U)z.push(U)}z.forEach((H,U)=>{let W=G.get(H);if(W===void 0){G.set(H,0);return}if(J&&W!==U)return;G.delete(H)}),this.updateIndexMap();let _=this.colModel.getColDefCols();for(let H of _??[]){let U=z.indexOf(H)>=0;X(H,U,Y)}if(Z)this.colModel.refreshCols(!1,Y);this.visibleCols.refresh(Y),this.dispatchColumnChangedEvent(this.eventSvc,Q,[...G.keys()],Y)}updateColList($=[],z,Q,J,Z,X,Y){if(!$||$.length===0)return;let q=!1,G=new Set;for(let H of $){if(!H)continue;let U=this.colModel.getColDefCol(H);if(!U)continue;if(G.add(U),Q){if(z.indexOf(U)>=0)continue;z.push(U)}else{let W=z.indexOf(U);if(W<0)continue;for(let B=W+1;B=0;else if(L)if(v)R=M;else if(C)R=V!=null&&V>=0;else R=!1;else R=Q.indexOf(K)>=0;if(R)if(L?k!=null||V!=null:k!=null)J.push(K);else Z.push(K)}let U=(K)=>{let L=K.getColDef();return Y(L)??q(L)};J.sort((K,L)=>U(K)-U(L));let W=[],B=this.groupHierarchCols,E=(K)=>{if(B)B.expandColumnInto(W,K);else W.push(K)};J.forEach(E);for(let K of Q)if(Z.indexOf(K)>=0)E(K);for(let K of Z)if(W.indexOf(K)<0)E(K);for(let K of Q)if(W.indexOf(K)<0)X(K,!1,$);for(let K of W)if(Q.indexOf(K)<0)X(K,!0,$);return this.columns=W,this.updateIndexMap(),this.columns}restoreColumnOrder($,z){let Q=this.columns,J=this.colModel.getColDefCols();if(!Q.length||!J)return $;let Z=Object.keys(z),X=new Set(Z),Y=new Set(Z),q=new Set(Q.map((M)=>{let k=M.getColId();return Y.delete(k),k}).concat(Z)),G=[],_={},H=0;for(let M=0;M{let k=_[M];for(let V=B;V>>32-Z,Q)}ff($,z,Q,J,Z,X,Y){return this.cmn(z&Q|~z&J,$,z,Z,X,Y)}gg($,z,Q,J,Z,X,Y){return this.cmn(z&J|Q&~J,$,z,Z,X,Y)}hh($,z,Q,J,Z,X,Y){return this.cmn(z^Q^J,$,z,Z,X,Y)}ii($,z,Q,J,Z,X,Y){return this.cmn(Q^(z|~J),$,z,Z,X,Y)}md51($){let z=$.length,Q=[1732584193,-271733879,-1732584194,271733878],J;for(J=64;J<=$.length;J+=64)this.md5cycle(Q,this.md5blk($.substring(J-64,J)));$=$.substring(J-64);let Z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(J=0;J<$.length;J++)Z[J>>2]|=$.charCodeAt(J)<<(J%4<<3);if(Z[J>>2]|=128<<(J%4<<3),J>55){this.md5cycle(Q,Z);for(J=0;J<16;J++)Z[J]=0}return Z[14]=z*8,this.md5cycle(Q,Z),Q}md5blk($){let z=[];for(let Q=0;Q<64;Q+=4)z[Q>>2]=$.charCodeAt(Q)+($.charCodeAt(Q+1)<<8)+($.charCodeAt(Q+2)<<16)+($.charCodeAt(Q+3)<<24);return z}rhex($){let z="0123456789abcdef".split(""),Q="",J=0;for(;J<4;J++)Q+=z[$>>J*8+4&15]+z[$>>J*8&15];return Q}hex($){for(let z=0;z<$.length;z++)$[z]=this.rhex($[z]);return $.join("")}md5($){return this.hex(this.md51($))}add32($,z){return this.ieCompatibility?this.add32Compat($,z):this.add32Std($,z)}add32Std($,z){return $+z&4294967295}add32Compat($,z){let Q=($&65535)+(z&65535);return($>>16)+(z>>16)+(Q>>16)<<16|Q&65535}},rJ={"01":"GRID","02":"CHARTS","0102":"BOTH"};var qX=class ${constructor(z){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=z,this.md5=new aD,this.md5.init()}validateLicense(){let z=this.getLicenseDetails($.licenseKey),Q=`AG Grid ${z.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,J=z.suppliedLicenseType===void 0?"":`AG ${z.suppliedLicenseType==="BOTH"?"Grid and AG Charts":z.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(z.missing){if(!this.isWebsiteUrl()||this.isForceWatermark())this.outputMissingLicenseKey(Q)}else if(z.expired){let Z=$.getGridReleaseDate(),X=$.formatDate(Z);this.outputExpiredKey(z.expiry,X,Q,J)}else if(!z.valid)this.outputInvalidLicenseKey(!!z.incorrectLicenseType,Q,J);else if(z.isTrial&&z.trialExpired)this.outputExpiredTrialKey(z.expiry,Q,J)}static extractExpiry(z){let Q=z.substring(z.lastIndexOf("_")+1,z.length);return new Date(parseInt($.decode(Q),10))}static extractLicenseComponents(z){let Q=z.replace(/[\u200B-\u200D\uFEFF]/g,"");if(Q=Q.replace(/\r?\n|\r/g,""),z.length<=32)return{md5:null,license:z,version:null,isTrial:null};let J=Q.length-32,Z=Q.substring(J),X=Q.substring(0,J),[Y,q,G]=$.extractBracketedInformation(Q);return{md5:Z,license:X,version:Y,isTrial:q,type:G}}getLicenseDetails(z){let Q=$.chartsLicenseManager?"BOTH":"GRID";if(!z?.length)return{licenseKey:z,valid:!1,missing:!0,currentLicenseType:Q};let J=$.getGridReleaseDate(),{md5:Z,license:X,version:Y,isTrial:q,type:G}=$.extractLicenseComponents(z),_=Z===this.md5.md5(X)&&!z.includes("For_Trialing_ag-Grid_Only"),H=void 0,U=void 0,W=null,B=!1,E=void 0;function K(){H=WW,Y){case"legacy":case"2":{if(q)K();break}case"3":if(!G?.length)_=!1;else if(E=G,G!==rJ["01"]&&G!==rJ["0102"]||Q==="BOTH"&&E!=="BOTH")_=!1,B=!0;else if(q)K()}}if(!_)return{licenseKey:z,valid:_,incorrectLicenseType:B,currentLicenseType:Q,suppliedLicenseType:E};return{licenseKey:z,valid:_,expiry:$.formatDate(W),expired:U,version:Y,isTrial:q,trialExpired:H,incorrectLicenseType:B,currentLicenseType:Q,suppliedLicenseType:E}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){let Q=(this.document.defaultView||window).location,{hostname:J=""}=Q;return J}isForceWatermark(){let Q=(this.document.defaultView||window).location,{pathname:J}=Q;return J?J.includes("forceWatermark"):!1}isWebsiteUrl(){return this.getHostname().match(/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/)!==null}isLocalhost(){return this.getHostname().match(/^(?:127\.0\.0\.1|localhost)$/)!==null}static formatDate(z){let Q=["January","February","March","April","May","June","July","August","September","October","November","December"],J=z.getDate(),Z=z.getMonth(),X=z.getFullYear();return J+" "+Q[Z]+" "+X}static getGridReleaseDate(){return new Date(parseInt($.decode($.RELEASE_INFORMATION),10))}static decode(z){let J="",Z,X,Y,q,G,_,H,U=0,W=z.replace(/[^A-Za-z0-9+/=]/g,"");while(U>4,X=(G&15)<<4|_>>2,Y=(_&3)<<6|H,J=J+String.fromCharCode(Z),_!=64)J=J+String.fromCharCode(X);if(H!=64)J=J+String.fromCharCode(Y)}return J=$.utf8_decode(J),J}static utf8_decode(z){z=z.replace(/rn/g,"n");let Q="";for(let J=0;J127&&Z<2048)Q+=String.fromCharCode(Z>>6|192),Q+=String.fromCharCode(Z&63|128);else Q+=String.fromCharCode(Z>>12|224),Q+=String.fromCharCode(Z>>6&63|128),Q+=String.fromCharCode(Z&63|128)}return Q}static setChartsLicenseManager(z){this.chartsLicenseManager=z,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(z){if(T(this.licenseKey)&&this.licenseKey!==z)o6(291,void 0,"AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used.");this.licenseKey=z,this.chartsLicenseManager?.setLicenseKey(z,!0)}static extractBracketedInformation(z){if(!z.includes("["))return["legacy",!1,void 0];let Q=z.match(/\[(.*?)\]/g).map((q)=>q.replace("[","").replace("]",""));if(!Q||Q.length===0)return["legacy",!1,void 0];let J=Q.filter((q)=>q==="TRIAL").length===1,Z=Q.filter((q)=>q.indexOf("v")===0)[0],X=Z?Z.replace("v",""):"legacy",Y=rJ[Q.filter((q)=>rJ[q])[0]];return[X,J,Y]}centerPadAndOutput(z){let Q=this.totalMessageLength-z.length}padAndOutput(z,Q="*",J=""){}outputInvalidLicenseKey(z,Q,J){}outputExpiredTrialKey(z,Q,J){}outputMissingLicenseKey(z){}outputExpiredKey(z,Q,J,Z){}};qX.RELEASE_INFORMATION="MTc3NDQyNTc0Nzc3NQ==";var lJ=qX,oD='.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}',eD={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},$F=class extends x{constructor(){super(eD);this.eLicenseTextRef=f,this.registerCSS(oD)}wireBeans($){this.licenseManager=$.licenseManager}postConstruct(){let $=this.shouldDisplayWatermark();if(this.setDisplayed($),$)this.eLicenseTextRef.textContent=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCss("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5000)}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},zF={selector:"AG-WATERMARK",component:$F},R9=class extends S{constructor(){super(...arguments);this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){let $=this.beans;if($.withinStudio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{let z=new lJ(Y0($));this.licenseManager=z,z.validateLicense()}}static getLicenseDetails($){return new lJ(null).getLicenseDetails($)}getWatermarkSelector(){return zF}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey($){lJ.setLicenseKey($)}static setChartsLicenseManager($){lJ.setChartsLicenseManager($)}},QF=9525,j9={"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},aJ=`\r +`;function f9($,z,Q){if(!z&&z!==""&&z!==0)return"";let J=z;if(typeof z==="boolean"){if(Q)J=Q(z)}return` ${$}="${J}"`}function JF($={}){let J=["version"];if(!$.version)$.version="1.0";if($.encoding)J.push("encoding");if($.standalone)J.push("standalone");return``${X}="${$[X]}"`).join(" ")} ?>`}function GX($,z){let Q="";if($.properties){if($.properties.prefixedAttributes)$.properties.prefixedAttributes.forEach((Z)=>{for(let X of Object.keys(Z.map))Q+=f9(Z.prefix+X,Z.map[X],z)});if($.properties.rawMap)for(let Z of Object.keys($.properties.rawMap))Q+=f9(Z,$.properties.rawMap[Z],z)}let J="<"+$.name+Q;if(!$.children&&$.textNode==null)return J+"/>"+aJ;if($.textNode!=null)return J+">"+$.textNode+""+aJ;if(J+=">"+aJ,$.children)for(let Z of $.children)J+=GX(Z,z);return J+""+aJ}var ZF=($)=>{return Math.round($*96/72)},jQ=($)=>{return Math.ceil($*QF)},XF=($)=>{if($===void 0)return;let Q=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf($||"Automatic");return Math.max(Q,0)},QZ=($,z)=>{if(!z)return;let Q;if(typeof z==="number")Q=z;else Q=z({rowIndex:$});return Q},YF=($,z)=>{let{colSpan:Q,column:J}=$.position;if(!$.width)return;if(Q){let Z=z.slice(J-1,J+Q-1),X=0;for(let Y=0;Y{let{rowSpan:Q,row:J}=$.position;if(!$.height)return;if(Q){let Z=0,X=0;for(let Y=J;Y{let Q=JF({encoding:"UTF-8",standalone:"yes"}),J=GX($);if(z)return J;return`${Q}${J}`},az=($)=>{let J=String.fromCharCode,Z=Math.floor($/26),X=$%26;if(!Z||$===26)return J(65+$-1);if(!X)return az(Z-1)+"Z";if(Z<26)return J(65+Z-1)+J(65+X-1);return az(Z)+J(65+X-1)},GF=($)=>{return $.replaceAll(` +`,"_x000a_")},qZ=($)=>{if($==null)return null;let z="";for(let Q=0;Q<$.length;Q++){let J=$.charCodeAt(Q);if(J>=0&&J<=31&&J!==10){let Y=`_x${J.toString(16).toUpperCase().padStart(4,"0")}_`;z+=Y}else z+=$[Q]}return z},_F=($)=>{let z=[];for(let Q of $.keys()){let J=Q.toString(),Z={name:"t",textNode:W0(qZ(J))};if(J.trim().length!==J.length)Z.properties={rawMap:{"xml:space":"preserve"}};z.push({name:"si",children:[Z]})}return z},HF=class extends j4{constructor($){super($);this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=$.formulaSvc,this.config=Object.assign({},$),this.workbook=$.workbook,this.stylesByIds={};for(let Q of this.config.baseExcelStyles)this.stylesByIds[Q.id]=Q;let z={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[z.id]=z,this.excelStyles=[...this.config.baseExcelStyles,z]}addCustomContent($){for(let z of $){let Q=this.rows.length+1,J;if(!this.config.suppressRowOutline&&z.outlineLevel!=null)J=z.outlineLevel;let Z={height:QZ(Q,z.height||this.config.rowHeight),cells:(z.cells||[]).map((X,Y)=>{let q=this.addImage(Q,this.columnsToExport[Y],X.data?.value),G=null;if(X.styleId)G=typeof X.styleId==="string"?[X.styleId]:X.styleId;let _=this.getStyleId(G);if(q)return this.createCell(_,this.getDataTypeForValue(q.value),q.value==null?"":q.value);let H=X.data?.value??"",U=this.getDataTypeForValue(H);if(X.mergeAcross)return this.createMergedCell(_,U,H,X.mergeAcross);return this.createCell(_,U,H)}),outlineLevel:J};if(z.collapsed!=null)Z.collapsed=z.collapsed;if(z.hidden!=null)Z.hidden=z.hidden;this.rows.push(Z)}}onNewHeaderGroupingRow(){let $=[],{freezeRows:z,headerRowHeight:Q}=this.config;if(this.rows.push({cells:$,height:QZ(this.rows.length+1,Q)}),z)this.frozenRowCount++;return{onColumn:(J,Z,X,Y,q)=>{let G=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${Z}`,columnGroup:J});$.push({...this.createMergedCell(this.getStyleId(G),this.getDataTypeForValue("string"),Z,Y),collapsibleRanges:q})}}}onNewHeaderRow(){let{freezeRows:$,headerRowHeight:z}=this.config;if($)this.frozenRowCount++;return this.onNewRow(this.onNewHeaderColumn,z)}onNewBodyRow($){let{freezeRows:z,rowHeight:Q}=this.config;if(!this.skipFrozenRows)if(z==="headersAndPinnedRows"&&$?.rowPinned==="top")this.frozenRowCount++;else if(typeof z==="function")if(z(y(this.gos,{node:$})))this.frozenRowCount++;else this.skipFrozenRows=!0;else this.skipFrozenRows=!0;let J=this.onNewRow(this.onNewBodyColumn,Q);if($)this.addRowOutlineIfNecessary($);return J}prepare($){super.prepare($),this.columnsToExport=[...$],this.cols=$.map((z,Q)=>this.convertColumnToExcel(z,Q))}parse(){let $=this.rows.reduce((Q,J)=>Math.max(Q,J.cells.length),0);while(this.cols.length<$)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));let z=this.createWorksheet();return this.addWorksheetToWorkbook(z)}createWorksheet(){let{sheetName:$}=this.config,z;if($!=null){let Q=typeof $==="function"?$(y(this.gos,{})):$;z=String(Q).substring(0,31)}else z="ag-grid";return{name:z,table:{columns:this.cols,rows:this.rows}}}addRowOutlineIfNecessary($){let{gos:z,suppressRowOutline:Q,rowGroupExpandState:J="expanded"}=this.config;if(z.get("groupHideOpenParents")||Q||$.level==null)return;let X=$.footer?1:0,Y=b(this.rows);if($.uiLevel==null||$.level===$.uiLevel){let G=Math.min($.level+X,7);Y.outlineLevel=G}if(J==="expanded")return;let q=J==="collapsed";if($.isExpandable()){let G=!q&&$.expanded;Y.collapsed=!G}Y.hidden=!!$.parent&&$.parent.level!==-1&&(q||this.isAnyParentCollapsed($.parent))}isAnyParentCollapsed($){while($&&$.level!==-1){if(!$.expanded)return!0;$=$.parent}return!1}convertColumnToExcel($,z){let Q=this.config.columnWidth,Z=($?this.extractHeaderValue($):void 0)??"",X=$?$.isFilterAllowed():!1;if(Q){if(typeof Q==="number")return{width:Q,displayName:Z,filterAllowed:X};return{width:Q({column:$,index:z}),displayName:Z,filterAllowed:X}}if($)return{width:Math.max($.getActualWidth(),75),displayName:Z,filterAllowed:X};return{displayName:Z,filterAllowed:X}}onNewHeaderColumn($,z){return(Q)=>{let J=this.extractHeaderValue(Q),Z=this.config.styleLinker({rowType:"HEADER",rowIndex:$,value:J,column:Q});z.push(this.createCell(this.getStyleId(Z),this.getDataTypeForValue("string"),J))}}onNewBodyColumn($,z){let Q=0,{freezeColumns:J,rightToLeft:Z}=this.config;return(X,Y,q)=>{if(Q>0){Q-=1;return}if(!this.skipFrozenColumns){let L=X.getPinned();if(J==="pinned"&&L&&(L===!0||L==="left")!==Z)this.frozenColumnCount++;else if(typeof J==="function"&&J(y(this.gos,{column:X})))this.frozenColumnCount++;else this.skipFrozenColumns=!0}let{value:G,valueFormatted:_}=this.extractRowCellValue({column:X,node:q,currentColumnIndex:Y,accumulatedRowIndex:$,type:"excel",useRawFormula:!0}),H=G,U=typeof H==="bigint"?H.toString():H,W=this.config.styleLinker({rowType:"BODY",rowIndex:$,value:H,column:X,node:q}),B=this.getStyleId(W),E=X.getColSpan(q),K=this.addImage($,X,U);if(K)z.push(this.createCell(B,this.getDataTypeForValue(K.value),K.value==null?"":K.value));else if(E>1)Q=E-1,z.push(this.createMergedCell(B,this.getDataTypeForValue(H),U,E-1));else{let L=X.isAllowFormula()&&this.formulaSvc?.isFormula(U),D=this.createCell(B,L?"f":this.getDataTypeForValue(H),L?this.formulaSvc?.updateFormulaByOffset({value:U,rowDelta:$-(q.formulaRowIndex+1),useRefFormat:!1}):U,_);z.push(D)}}}onNewRow($,z){let Q=[];return this.rows.push({cells:Q,height:QZ(this.rows.length+1,z)}),{onColumn:$.bind(this,this.rows.length,Q)()}}addWorksheetToWorkbook($){let{excelStyles:z,config:Q}=this;if(this.mapSharedStrings($),this.frozenColumnCount)Q.frozenColumnCount=this.frozenColumnCount;if(this.frozenRowCount)Q.frozenRowCount=this.frozenRowCount;return this.workbook.addWorksheet(z,$,Q)}mapSharedStrings($){let z;for(let Q of $.table.rows)for(let J of Q.cells){let Z=J.data;if(!Z||Z.type!=="s")continue;let X=Z.value;if(X==null)continue;if(X===""){z??(z=this.workbook.getStringPosition("").toString()),Z.value=z;continue}Z.value=this.workbook.getStringPosition(String(X)).toString()}}getDataTypeForValue($){if($===void 0)return"empty";let z="s";try{if(this.isNumerical($))z="n"}catch(Q){}return z}getTypeFromStyle($,z){if(this.isFormula(z))return"f";if($?.dataType)switch($.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:j(162,{id:$.id,dataType:$.dataType})}return null}addImage($,z,Q){if(!this.config.addImageToCell)return;let J=this.config.addImageToCell($,z,Q);if(!J)return;return this.workbook.addBodyImageToMap(J.image,$,z,this.columnsToExport,this.config.rowHeight),J}createCell($,z,Q,J){let Z=this.getStyleById($);if(!Z?.dataType&&z==="s"&&J!=null)Q=J;let X=this.getTypeFromStyle(Z,Q)||z,{value:Y,escaped:q}=this.getCellValue(X,Q),G=[];if(Z)G.push($);if(q)G.push("_quotePrefix");return $=this.getStyleId(G)||void 0,{styleId:$,data:{type:X,value:Y}}}createMergedCell($,z,Q,J){let Z=Q==null?"":Q;return{styleId:this.getStyleById($)?$:void 0,data:{type:z,value:z==="s"?String(Z):Q},mergeAcross:J}}getCellValue($,z){let Q=!1;if(z==null||$==="s"&&z==="")return{value:"",escaped:!1};if($==="s"){if(z=String(z),z[0]==="'")Q=!0,z=z.slice(1)}else if($==="f")z=this.addXlfnPrefix(z).slice(1);else if($==="n"){let J=Number(z);if(isNaN(J))z="";else if(z!=="")z=J.toString()}return{value:z,escaped:Q}}addXlfnPrefix($){if(!$)return $;let z=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return $.replace(z,(Q,J,Z,X)=>`${J}_xlfn.${Z}${X}`)}getStyleId($){if(!$?.length)return null;let z=$.filter((J)=>this.stylesByIds[J]!=null);if(!z.length)return null;if(z.length===1)return z[0];let Q=z.join("-");if(!this.mixedStyles[Q])this.addNewMixedStyle(z);return this.mixedStyles[Q].excelID}addNewMixedStyle($){this.mixedStyleCounter+=1;let z=`mixedStyle${this.mixedStyleCounter}`,Q={};for(let Z of $){let X=this.stylesByIds[Z];if(X)B0(Q,X,!0,!0)}Q.id=z;let J=$.join("-");this.mixedStyles[J]={excelID:z,key:J,result:Q},this.excelStyles.push(Q),this.stylesByIds[z]=Q}isFormula($){if($==null)return!1;let z=String($);return this.config.autoConvertFormulas&&a1(z)}isNumerical($){if(typeof $==="bigint")return!1;return isFinite($)&&$!==""&&!isNaN(parseFloat($))}getStyleById($){if($==null)return null;return this.stylesByIds[$]||null}},UF={getTemplate($){let{name:z,ContentType:Q,Extension:J,PartName:Z}=$;return{name:z,properties:{rawMap:{Extension:J,PartName:Z,ContentType:Q}}}}},WF=UF,KZ=($)=>$==="jpg"?"jpeg":$,BF={getTemplate({sheetLen:$,hasCustomProperties:z}){let Q=Array($).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${W+1}.xml`})),J=Az.size,Z=d$.size,X={};TQ.forEach((U)=>{X[KZ(U.type)]=!0});let Y=Array(J).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${W+1}.xml`})),q=[];w$.forEach(({name:U})=>{q.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${U}.xml`})});let G=z?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],_=Object.keys(X).map((U)=>({name:"Default",ContentType:`image/${U}`,Extension:U}));if(Z)_.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});let H=[..._,{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"},...Q,{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"},...Y,...q,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...G].map((U)=>WF.getTemplate(U));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:H}}},EF=BF,KF={getTemplate($){let Q=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:$},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:Q},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:Q}]}}},LF=KF,DF="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",FF=($)=>{return Object.keys($).filter((Q)=>Q&&$[Q]!=null).map((Q,J)=>({name:"property",properties:{rawMap:{fmtid:DF,pid:(J+2).toString(),name:W0(Q)??""}},children:[{name:"vt:lpwstr",textNode:W0(qZ(String($[Q])))??""}]}))},MF={getTemplate($){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:FF($)}}},kF=MF,O9=($,z)=>({name:`xdr:${$}`,children:[{name:"xdr:col",textNode:z.col.toString()},{name:"xdr:colOff",textNode:z.offsetX.toString()},{name:"xdr:row",textNode:z.row.toString()},{name:"xdr:rowOff",textNode:z.offsetY.toString()}]}),VF=($)=>{let z=[{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($.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":z.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:z}},AF=($,z)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:z,name:$.id,descr:$.altText!=null?$.altText:void 0}},children:[VF($)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),P9=($)=>{if(!$.saturation&&!$.tint)return;let z=[];if($.saturation)z.push({name:"a:satMod",properties:{rawMap:{val:$.saturation*1000}}});if($.tint)z.push({name:"a:tint",properties:{rawMap:{val:$.tint*1000}}});return z},SF=($,z)=>{return{name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:$.color}},children:P9($)},{name:"a:srgbClr",properties:{rawMap:{val:z.color}},children:P9(z)}]}},RF=($,z)=>{let Q;if($.transparency){let J=Math.min(Math.max($.transparency,0),100);Q=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(J*1000)}}}]}if($.recolor){if(!Q)Q=[];switch($.recolor.toLocaleLowerCase()){case"grayscale":Q.push({name:"a:grayscl"});break;case"sepia":Q.push(SF({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":Q.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${z}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:Q},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},jF=($,z)=>{let Q={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:z.width,cy:z.height}}}]};if($.rotation){let X=$.rotation;Q.properties={rawMap:{rot:Math.min(Math.max(X,0),360)*60000}}}return{name:"xdr:spPr",children:[Q,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},fF=($)=>{$.fitCell=!!$.fitCell||!$.width||!$.height;let{position:z={},fitCell:Q,width:J=0,height:Z=0,totalHeight:X,totalWidth:Y}=$,{offsetX:q=0,offsetY:G=0,row:_=1,rowSpan:H=1,column:U=1,colSpan:W=1}=z;return{from:{row:_-1,col:U-1,offsetX:jQ(q),offsetY:jQ(G)},to:{row:_-1+(Q?1:H-1),col:U-1+(Q?1:W-1),offsetX:jQ(J+q),offsetY:jQ(Z+G)},height:jQ(X||Z),width:jQ(Y||J)}},OF=($,z,Q,J)=>{return{name:"xdr:pic",children:[AF($,z+1),RF($,Q+1),jF($,J)]}},PF={getTemplate($){let{sheetIndex:z}=$,Q=Az.get(z),J=vQ.get(z),Z=Q.map((X,Y)=>{let q=fF(X);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[O9("from",q.from),O9("to",q.to),OF(X,Y,J.get(X.id).index,q),{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:Z}}},TF=PF,vF={getTemplate($){let{Id:z,Type:Q,Target:J}=$;return{name:"Relationship",properties:{rawMap:{Id:z,Type:Q,Target:J}}}}},IF=vF,CF={getTemplate($){let z=$.map((Q)=>IF.getTemplate(Q));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:z}}},v1=CF,bF={getTemplate($){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:$.size,uniqueCount:$.size}},children:_F($)}}},yF=bF,xF=($)=>{switch($){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},wF={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},NF=["Dashed","DashDot","DashDotDot"],gF={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"},hF={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},uF={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},mF=($)=>{if(!$)return"none";return gF[$]||$},kz=($)=>{if($==null)return $;if($.charAt(0)==="#")$=$.substring(1);return $.length===6?"FF"+$:$},oJ=($,z)=>{if(!$)return"thin";let Q=xF(z);if($==="Continuous")return Q;let J=wF[$];if(Q==="medium"&&NF.some((Z)=>Z===J))return`medium${J}`;return`${J.charAt(0).toLowerCase()}${J.substring(1)}`},cF=($)=>{return hF[$]||"general"},pF=($)=>{return uF[$]||void 0},M1=($)=>{return{name:"color",properties:{rawMap:{rgb:kz($||"#000000")}}}},iF={getTemplate($){let{left:z,right:Q,top:J,bottom:Z,diagonal:X}=$,Y=z?[M1(z.color)]:void 0,q=Q?[M1(Q.color)]:void 0,G=J?[M1(J.color)]:void 0,_=Z?[M1(Z.color)]:void 0,H=X?[M1(X.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:z?.style}},children:Y},{name:"right",properties:{rawMap:{style:Q?.style}},children:q},{name:"top",properties:{rawMap:{style:J?.style}},children:G},{name:"bottom",properties:{rawMap:{style:Z?.style}},children:_},{name:"diagonal",properties:{rawMap:{style:X?.style}},children:H}]}}},nF=iF,dF={getTemplate($){return{name:"borders",properties:{rawMap:{count:$.length}},children:$.map((z)=>nF.getTemplate(z))}}},tF=dF,sF=($)=>{let Q=["Context","LeftToRight","RightToLeft"].indexOf($);return Math.max(Q,0)},rF={getTemplate($){let{horizontal:z,indent:Q,readingOrder:J,rotate:Z,shrinkToFit:X,vertical:Y,wrapText:q}=$;return{name:"alignment",properties:{rawMap:{horizontal:z&&cF(z),indent:Q,readingOrder:J&&sF(J),textRotation:Z,shrinkToFit:X,vertical:Y&&pF(Y),wrapText:q}}}}},lF=rF,aF={getTemplate($){let z=$.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:$.hideFormula===!0?1:0,locked:z}}}}},oF=aF,eF={getTemplate($){let{alignment:z,borderId:Q,fillId:J,fontId:Z,numFmtId:X,protection:Y,quotePrefix:q,xfId:G}=$,_=[];if(z)_.push(lF.getTemplate(z));if(Y)_.push(oF.getTemplate(Y));return{name:"xf",properties:{rawMap:{applyAlignment:z?1:void 0,applyProtection:Y?1:void 0,applyBorder:Q?1:void 0,applyFill:J?1:void 0,borderId:Q,fillId:J,applyFont:Z?1:void 0,fontId:Z,applyNumberFormat:X?1:void 0,numFmtId:X,quotePrefix:q?1:void 0,xfId:G}},children:_.length?_:void 0}}},_X=eF,$M={getTemplate($){return{name:"cellStyleXfs",properties:{rawMap:{count:$.length}},children:$.map((z)=>_X.getTemplate(z))}}},zM=$M,QM={getTemplate($){let{builtinId:z,name:Q,xfId:J}=$;return{name:"cellStyle",properties:{rawMap:{builtinId:z,name:Q,xfId:J}}}}},JM=QM,ZM={getTemplate($){return{name:"cellStyles",properties:{rawMap:{count:$.length}},children:$.map((z)=>JM.getTemplate(z))}}},XM=ZM,YM={getTemplate($){return{name:"cellXfs",properties:{rawMap:{count:$.length}},children:$.map((z)=>_X.getTemplate(z))}}},qM=YM,GM={getTemplate($){let{patternType:z,fgTheme:Q,fgTint:J,fgRgb:Z,bgRgb:X,bgIndexed:Y}=$,q={name:"patternFill",properties:{rawMap:{patternType:z}}};if(Q||J||Z)q.children=[{name:"fgColor",properties:{rawMap:{theme:Q,tint:J,rgb:Z}}}];if(Y||X){if(!q.children)q.children=[];q.children.push({name:"bgColor",properties:{rawMap:{indexed:Y,rgb:X}}})}return{name:"fill",children:[q]}}},_M=GM,HM={getTemplate($){return{name:"fills",properties:{rawMap:{count:$.length}},children:$.map((z)=>_M.getTemplate(z))}}},UM=HM,WM={getTemplate($){let{size:z,colorTheme:Q,color:J="FF000000",fontName:Z="Calibri",family:X,scheme:Y,italic:q,bold:G,strikeThrough:_,outline:H,shadow:U,underline:W,verticalAlign:B}=$,E=[{name:"sz",properties:{rawMap:{val:z}}},{name:"color",properties:{rawMap:{theme:Q,rgb:J}}},{name:"name",properties:{rawMap:{val:Z}}}];if(X)E.push({name:"family",properties:{rawMap:{val:X}}});if(Y)E.push({name:"scheme",properties:{rawMap:{val:Y}}});if(q)E.push({name:"i"});if(G)E.push({name:"b"});if(_)E.push({name:"strike"});if(H)E.push({name:"outline"});if(U)E.push({name:"shadow"});if(W)E.push({name:"u",properties:{rawMap:{val:W}}});if(B)E.push({name:"vertAlign",properties:{rawMap:{val:B}}});return{name:"font",children:E}}},BM=WM,EM={getTemplate($){return{name:"fonts",properties:{rawMap:{count:$.length}},children:$.map((z)=>BM.getTemplate(z))}}},KM=EM;function LM($){let z=$.split(/(\[[^\]]*\])/);for(let Q=0;QFM.getTemplate(z))}}},kM=MM,GZ,fQ,A1,S1,R1,HX,_Z,UX,t4,WX=($,z)=>{if($.includes("mixedStyle")&&z>1)$+=`_${z}`;return $},BX=()=>{GZ={base:0},fQ=[],A1=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],S1=[{patternType:"none"},{patternType:"gray125"}],R1=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],HX=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],_Z=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],UX=[{builtinId:0,name:"Normal",xfId:0}]},VM=($)=>{let z=mF($.pattern),Q=kz($.color),J=kz($.patternColor),Z=S1.findIndex((X)=>{let{patternType:Y,fgRgb:q,bgRgb:G}=X;return!(Y!=z||q!=Q||G!=J)});if(Z===-1)Z=S1.length,S1.push({patternType:z,fgRgb:Q,bgRgb:J});return Z},AM=($)=>{if(j9[$])return j9[$];let z=fQ.findIndex((Q)=>Q.formatCode===$);if(z===-1)z=fQ.length+164,fQ.push({formatCode:$,numFmtId:z});else z=fQ[z].numFmtId;return z},SM=($)=>{let{borderBottom:z,borderTop:Q,borderLeft:J,borderRight:Z}=$,X,Y,q,G,_,H,U,W;if(J)q=oJ(J.lineStyle,J.weight),U=kz(J.color);if(Z)G=oJ(Z.lineStyle,Z.weight),W=kz(Z.color);if(z)X=oJ(z.lineStyle,z.weight),_=kz(z.color);if(Q)Y=oJ(Q.lineStyle,Q.weight),H=kz(Q.color);let B=R1.findIndex((E)=>{let{left:K,right:L,top:D,bottom:F}=E;if(!K&&(q||U))return!1;if(!L&&(G||W))return!1;if(!D&&(Y||H))return!1;if(!F&&(X||_))return!1;let{style:M,color:k}=K||{},{style:V,color:R}=L||{},{style:O,color:I}=D||{},{style:v,color:C}=F||{};if(M!=q||k!=U)return!1;if(V!=G||R!=W)return!1;if(O!=Y||I!=H)return!1;if(v!=X||C!=_)return!1;return!0});if(B===-1)B=R1.length,R1.push({left:{style:q,color:U},right:{style:G,color:W},top:{style:Y,color:H},bottom:{style:X,color:_},diagonal:{style:void 0,color:void 0}});return B},RM=($)=>{let{fontName:z="Calibri",color:Q,size:J,bold:Z,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:_,family:H,verticalAlign:U}=$,W=kz(Q),B=XF(H),E=_?_.toLocaleLowerCase():void 0,K=U?U.toLocaleLowerCase():void 0,L=A1.findIndex((D)=>{return!(D.fontName!=z||D.color!=W||D.size!=J||D.bold!=Z||D.italic!=X||D.outline!=Y||D.shadow!=q||D.strikeThrough!=G||D.underline!=E||D.verticalAlign!=K||D.family!=B)});if(L===-1)L=A1.length,A1.push({fontName:z,color:W,size:J,bold:Z,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:E,verticalAlign:K,family:B!=null?B.toString():void 0});return L},jM=($)=>{let{alignment:z,borders:Q,font:J,interior:Z,numberFormat:X,protection:Y,quotePrefix:q}=$,{id:G}=$,_=0,H=0,U=0,W=0;if(!G)return;if(G=WX(G,t4),GZ[G]!=null)return;if(Z)_=VM(Z);if(Q)H=SM(Q);if(J)U=RM(J);if(X)W=AM(X.format);GZ[G]=_Z.length,_Z.push({alignment:z,borderId:H||0,fillId:_||0,fontId:U||0,numFmtId:W||0,protection:Y,quotePrefix:q,xfId:0})},fM={getTemplate($){let z=kM.getTemplate(fQ),Q=KM.getTemplate(A1.map((G)=>({...G,size:G.size!=null?G.size:$}))),J=UM.getTemplate(S1),Z=tF.getTemplate(R1),X=zM.getTemplate(HX),Y=qM.getTemplate(_Z),q=XM.getTemplate(UX);return BX(),{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:[z,Q,J,Z,X,Y,q,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},OM=($,z)=>{return GZ[WX($,z)]||0},PM=($,z)=>{if(t4=z,t4===1)BX();$.forEach(jM)},TM=fM,vM={getTemplate($,z){let{name:Q,columns:J,rowRange:Z,displayName:X,showRowStripes:Y,showColumnStripes:q,showFilterButtons:G,highlightFirstColumn:_,highlightLastColumn:H}=$||{},U=!Z||Z[0]-Z[1]===0;if(!$||!Q||!Array.isArray(J)||!J.length||U)return{name:"table"};let W=J.map((F,M)=>({name:"filterColumn",properties:{rawMap:{colId:M.toString(),hiddenButton:G[M]?0:1}}})),B=`A${Z[0]}`,E=`${az(J.length)}${Z[1]}`,K=`${B}:${E}`,L=`${z+1}`,D=z?`${X}_${L}`:X;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:D,displayName:D,ref:K,totalsRowShown:0,id:L}},children:[{name:"autoFilter",properties:{rawMap:{ref:K}},children:W},{name:"tableColumns",properties:{rawMap:{count:J.length}},children:J.map((F,M)=>({name:"tableColumn",properties:{rawMap:{id:(M+1).toString(),name:W0(GF(F)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:_?1:0,showLastColumn:H?1:0,showRowStripes:Y?1:0,showColumnStripes:q?1:0}}}]}}},IM=vM,_$=($)=>{let[z,Q,J,Z]=$;return{name:`a:${z}`,children:[{name:`a:${Q}`,properties:{rawMap:{val:J,lastClr:Z}}}]}},CM={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[_$(["dk1","sysClr","windowText","000000"]),_$(["lt1","sysClr","window","FFFFFF"]),_$(["dk2","srgbClr","44546A"]),_$(["lt2","srgbClr","E7E6E6"]),_$(["accent1","srgbClr","4472C4"]),_$(["accent2","srgbClr","ED7D31"]),_$(["accent3","srgbClr","A5A5A5"]),_$(["accent4","srgbClr","FFC000"]),_$(["accent5","srgbClr","5B9BD5"]),_$(["accent6","srgbClr","70AD47"]),_$(["hlink","srgbClr","0563C1"]),_$(["folHlink","srgbClr","954F72"])]}}},bM=CM,P=($)=>{let[z,Q,J,Z]=$;return{name:`a:${z}`,properties:{rawMap:{script:J,typeface:Q,panose:Z}}}},yM={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[P(["latin","Calibri Light",void 0,"020F0302020204030204"]),P(["ea",""]),P(["cs",""]),P(["font","游ゴシック Light","Jpan"]),P(["font","맑은 고딕","Hang"]),P(["font","等线 Light","Hans"]),P(["font","新細明體","Hant"]),P(["font","Times New Roman","Arab"]),P(["font","Times New Roman","Hebr"]),P(["font","Tahoma","Thai"]),P(["font","Nyala","Ethi"]),P(["font","Vrinda","Beng"]),P(["font","Shruti","Gujr"]),P(["font","MoolBoran","Khmr"]),P(["font","Tunga","Knda"]),P(["font","Raavi","Guru"]),P(["font","Euphemia","Cans"]),P(["font","Plantagenet Cherokee","Cher"]),P(["font","Microsoft Yi Baiti","Yiii"]),P(["font","Microsoft Himalaya","Tibt"]),P(["font","MV Boli","Thaa"]),P(["font","Mangal","Deva"]),P(["font","Gautami","Telu"]),P(["font","Latha","Taml"]),P(["font","Estrangelo Edessa","Syrc"]),P(["font","Kalinga","Orya"]),P(["font","Kartika","Mlym"]),P(["font","DokChampa","Laoo"]),P(["font","Iskoola Pota","Sinh"]),P(["font","Mongolian Baiti","Mong"]),P(["font","Times New Roman","Viet"]),P(["font","Microsoft Uighur","Uigh"]),P(["font","Sylfaen","Geor"]),P(["font","Arial","Armn"]),P(["font","Leelawadee UI","Bugi"]),P(["font","Microsoft JhengHei","Bopo"]),P(["font","Javanese Text","Java"]),P(["font","Segoe UI","Lisu"]),P(["font","Myanmar Text","Mymr"]),P(["font","Ebrima","Nkoo"]),P(["font","Nirmala UI","Olck"]),P(["font","Ebrima","Osma"]),P(["font","Phagspa","Phag"]),P(["font","Estrangelo Edessa","Syrn"]),P(["font","Estrangelo Edessa","Syrj"]),P(["font","Estrangelo Edessa","Syre"]),P(["font","Nirmala UI","Sora"]),P(["font","Microsoft Tai Le","Tale"]),P(["font","Microsoft New Tai Lue","Talu"]),P(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[P(["latin","Calibri",void 0,"020F0502020204030204"]),P(["ea",""]),P(["cs",""]),P(["font","游ゴシック","Jpan"]),P(["font","맑은 고딕","Hang"]),P(["font","等线","Hans"]),P(["font","新細明體","Hant"]),P(["font","Arial","Arab"]),P(["font","Arial","Hebr"]),P(["font","Tahoma","Thai"]),P(["font","Nyala","Ethi"]),P(["font","Vrinda","Beng"]),P(["font","Shruti","Gujr"]),P(["font","DaunPenh","Khmr"]),P(["font","Tunga","Knda"]),P(["font","Raavi","Guru"]),P(["font","Euphemia","Cans"]),P(["font","Plantagenet Cherokee","Cher"]),P(["font","Microsoft Yi Baiti","Yiii"]),P(["font","Microsoft Himalaya","Tibt"]),P(["font","MV Boli","Thaa"]),P(["font","Mangal","Deva"]),P(["font","Gautami","Telu"]),P(["font","Latha","Taml"]),P(["font","Estrangelo Edessa","Syrc"]),P(["font","Kalinga","Orya"]),P(["font","Kartika","Mlym"]),P(["font","DokChampa","Laoo"]),P(["font","Iskoola Pota","Sinh"]),P(["font","Mongolian Baiti","Mong"]),P(["font","Arial","Viet"]),P(["font","Microsoft Uighur","Uigh"]),P(["font","Sylfaen","Geor"]),P(["font","Arial","Armn"]),P(["font","Leelawadee UI","Bugi"]),P(["font","Microsoft JhengHei","Bopo"]),P(["font","Javanese Text","Java"]),P(["font","Segoe UI","Lisu"]),P(["font","Myanmar Text","Mymr"]),P(["font","Ebrima","Nkoo"]),P(["font","Nirmala UI","Olck"]),P(["font","Ebrima","Osma"]),P(["font","Phagspa","Phag"]),P(["font","Estrangelo Edessa","Syrn"]),P(["font","Estrangelo Edessa","Syrj"]),P(["font","Estrangelo Edessa","Syre"]),P(["font","Nirmala UI","Sora"]),P(["font","Microsoft Tai Le","Tale"]),P(["font","Microsoft New Tai Lue","Talu"]),P(["font","Ebrima","Tfng"])]}]}}},xM=yM,x$=($,z,Q)=>({name:`a:${$}`,properties:{rawMap:{val:z}},children:Q}),x4=($)=>{let[z,Q,J,Z,X,Y]=$,q=[];if(q.push(x$("satMod",J)),Z)q.push(x$("lumMod",Z));if(X)q.push(x$("tint",X));if(Y)q.push(x$("shade",Y));return{name:"a:gs",properties:{rawMap:{pos:z}},children:[{name:"a:schemeClr",properties:{rawMap:{val:Q}},children:q}]}},HZ=($,z)=>({name:"a:solidFill",children:[x$("schemeClr",$,z)]}),s4=($)=>{let[z,Q,J,Z,X]=$,[Y,q]=X;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:z}},children:[{name:"a:gsLst",children:[x4(Q),x4(J),x4(Z)]},{name:"a:lin",properties:{rawMap:{ang:Y,scaled:q}}}]}},w4=($)=>{let[z,Q,J,Z]=$;return{name:"a:ln",properties:{rawMap:{w:z,cap:Q,cmpd:J,algn:Z}},children:[HZ("phClr"),x$("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},N4=($)=>{let z=[];if($){let[Q,J,Z,X,Y]=$;z.push({name:"a:outerShdw",properties:{rawMap:{blurRad:Q,dist:J,dir:Z,algn:X,rotWithShape:Y}},children:[x$("srgbClr","000000",[x$("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},z.length?{children:z}:{})]}},wM=()=>({name:"a:fillStyleLst",children:[HZ("phClr"),s4(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),s4(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),NM=()=>({name:"a:lnStyleLst",children:[w4(["6350","flat","sng","ctr"]),w4(["12700","flat","sng","ctr"]),w4(["19050","flat","sng","ctr"])]}),gM=()=>({name:"a:effectStyleLst",children:[N4(),N4(),N4(["57150","19050","5400000","ctr","0"])]}),hM=()=>({name:"a:bgFillStyleLst",children:[HZ("phClr"),HZ("phClr",[x$("tint","95000"),x$("satMod","170000")]),s4(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),uM={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[wM(),NM(),gM(),hM()]}}},mM=uM,cM={getTemplate(){return{name:"a:themeElements",children:[bM.getTemplate(),xM.getTemplate(),mM.getTemplate()]}}},pM=cM,iM={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[pM.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},nM=iM,dM=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),tM=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),sM=($)=>({name:"v:formulas",children:$.map((z)=>({name:"v:f",properties:{rawMap:{eqn:z}}}))}),rM=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),EX=($)=>{let{aspectratio:z,rotation:Q}=$||{},J={};if(z)J.aspectratio="t";if(Q)J.rotation="t";return{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:J}}};function lM($,z,Q,J,Z){return($-z)/(Q-z)*(Z-J)+J}var aM=($,z)=>{let Q,{recolor:J,brightness:Z,contrast:X,id:Y}=$;if(J){if(Q={},J==="Washout"||J==="Grayscale")Q.gain="19661f",Q.blacklevel="22938f";if(J==="Black & White"||J==="Grayscale"){if(Q.grayscale="t",J==="Black & White")Q.bilevel="t"}}if(!J||J==="Grayscale"){if(!Q)Q={};if(X!=null&&X!==50){let q="1";if(X>=0){if(X<50)q=String(X/50);else if(X<100)q=String(50/(100-X));else if(X===100)q="2147483647f"}Q.gain=q}if(Z!=null&&Z!==50)Q.blacklevel=lM(Z,0,100,-0.5,0.5).toString()}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${z}`,title:Y}}],rawMap:Q}}},oM=()=>{let $=["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:[tM(),sM($),rM(),EX({aspectratio:!0})]}},T9=($)=>Math.floor(($??0)*0.74999943307122),eM=($,z)=>{let{width:Q=0,height:J=0,altText:Z}=$,X=T9(Q),Y=T9(J);return{name:"v:shape",properties:{rawMap:{id:$.headerFooterPosition,"o:spid":"_x0000_s1025",style:`position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${X}pt; height: ${Y}pt; z-index: ${z+1}`,type:"#_x0000_t75",alt:Z}},children:[aM($,z+1),EX({rotation:!0})]}},$k={getTemplate($){let z=d$.get($.sheetIndex)||[],Q=[dM(),oM(),...z.map((J,Z)=>eM(J,Z))];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:Q}}},zk=$k,Qk={getTemplate($,z){let Q=(z+1).toString();return{name:"sheet",properties:{rawMap:{name:$,sheetId:Q,"r:id":`rId${Q}`}}}}},Jk=Qk,Zk={getTemplate($){return{name:"sheets",children:$.map((z,Q)=>Jk.getTemplate(z,Q))}}},Xk=Zk,Yk={getTemplate($,z){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:z}}}]},Xk.getTemplate($)]}}},qk=Yk,Gk=($)=>Math.ceil(($-12)/7+1),_k={getTemplate($){let{min:z,max:Q,outlineLevel:J,s:Z,width:X,hidden:Y,bestFit:q}=$,G=1,_="0";if(X>1)G=Gk(X),_="1";return{name:"col",properties:{rawMap:{min:z,max:Q,outlineLevel:J!=null?J:void 0,width:G,style:Z,hidden:Y?"1":"0",bestFit:q?"1":"0",customWidth:_}}}}},Hk=_k,Uk={getTemplate($){return{name:"mergeCell",properties:{rawMap:{ref:$}}}}},Wk=Uk,Bk=($)=>{let z=$.charAt(0).toLowerCase();return z==="s"?"inlineStr":z},Ek={getTemplate($,z,Q){let{ref:J,data:Z,styleId:X}=$,{type:Y,value:q}=Z||{type:"empty",value:null},G=Y;if(Y==="f")G="str";else if(Y.charAt(0)===Y.charAt(0).toUpperCase())G=Bk(Y);let _={name:"c",properties:{rawMap:{r:J,t:G==="empty"?void 0:G,s:X?OM(X,Q):void 0}}};if(G==="empty")return _;let H;if(G==="str"&&Y==="f")H=[{name:"f",textNode:W0(qZ(q))}];else if(G==="inlineStr")H=[{name:"is",children:[{name:"t",textNode:W0(qZ(q))}]}];else H=[{name:"v",textNode:q}];return Object.assign({},_,{children:H})}},Kk=Ek,Lk=($,z)=>{let Q=[],J=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];if(X.mergeAcross)Q.push({pos:Z,excelPos:J}),J+=X.mergeAcross;J++}if(Q.length)for(let Z=Q.length-1;Z>=0;Z--){let X=[],Y=$[Q[Z].pos];for(let q=1;q<=Y.mergeAcross;q++)X.push({ref:`${az(Q[Z].excelPos+1+q)}${z+1}`,styleId:Y.styleId,data:{type:"empty",value:null}});if(X.length)$.splice(Q[Z].pos+1,0,...X)}},Dk=($)=>$.data?.value!==""||$.styleId!==void 0,Fk={getTemplate($,z,Q){let{collapsed:J,hidden:Z,height:X,outlineLevel:Y,cells:q=[]}=$;Lk(q,z);let G=q.filter(Dk).map((_,H)=>Kk.getTemplate(_,H,Q));return{name:"row",properties:{rawMap:{r:z+1,collapsed:J?"1":"0",hidden:Z?"1":"0",ht:X,customHeight:X!=null?"1":"0",spans:"1:1",outlineLevel:Y||void 0}},children:G}}},Mk=Fk,kk=($,z,Q)=>{let J=[],Z=[];$.forEach((q,G)=>{let _=q.cells,H=0,U;_.forEach((W,B)=>{let E=B+H+1,K=az(E),L=G+1;if(W.mergeAcross){H+=W.mergeAcross;let F=az(B+H+1);J.push(`${K}${L}:${F}${L}`)}if(!z[E-1])z[E-1]={};let{collapsibleRanges:D}=W;if(D)D.forEach((F)=>{Z.push([E+F[0],E+F[1]])});U=z[E-1],U.min=E,U.max=E,W.ref=`${K}${L}`})}),Z.sort((q,G)=>{if(q[0]!==G[0])return q[0]-G[0];return G[1]-q[1]});let X=new Map,Y=new Map;return Z.filter((q)=>{let G=q.toString();if(X.get(G))return!1;return X.set(G,!0),!0}).forEach((q)=>{let G=z.find((H)=>H.min==q[0]&&H.max==q[1]),_=Y.get(q[0]);z.push({min:q[0],max:q[1],outlineLevel:Q?void 0:_||1,width:(G||{width:100}).width}),Y.set(q[0],(_||0)+1)}),J},Vk=($)=>{if(!$||$!=="Portrait"&&$!=="Landscape")return"portrait";return $.toLocaleLowerCase()},Ak=($)=>{if($==null)return 1;let Q=["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($);return Q===-1?1:Q+1},Sk=($)=>{let z={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(let Q of Object.keys(z))$=$.replace(Q,z[Q]);return $},Rk=($)=>{if($==="Center")return"C";if($==="Right")return"R";return"L"},jk=($,z)=>{if(!z)return $;if($+="&"",$+=z.fontName||"Calibri",z.bold!==z.italic)$+=z.bold?",Bold":",Italic";else if(z.bold)$+=",Bold Italic";else $+=",Regular";if($+=""",z.size)$+=`&${z.size}`;if(z.strikeThrough)$+="&S";if(z.underline)$+=`&${z.underline==="Double"?"E":"U"}`;if(z.color)$+=`&K${z.color.replace("#","").toUpperCase()}`;return $},fk=($,z,Q)=>$.reduce((J,Z,X)=>{let Y=Rk(Z.position),q=jk(`${J}&${Y}`,Z.font),G=["Left","Center","Right"];if(!Z.position)Z.position=G[X];let{image:_}=Z;if(Z.value==="&[Picture]"&&_){let H=`${Y}${z}${Q}`;KX(_,H)}return`${q}${W0(Sk(Z.value))}`},""),Ok=($)=>{let z=["all","first","even"],Q=[];return z.forEach((J)=>{let Z=$[J],X=J==="all"?"odd":J;if(!Z)return;for(let Y of Object.keys(Z)){let q=Z[Y],G=`${Y.charAt(0).toUpperCase()}${Y.slice(1)}`,_=Y[0].toUpperCase();if(q){let H=J==="all"?"":J.toUpperCase();Q.push({name:`${X}${G}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:fk(q,_,H)})}}}),Q},Pk=($)=>{return(z)=>{if($.length)z.children.push({name:"cols",children:$.map((Q)=>Hk.getTemplate(Q))});return z}},Tk=($,z)=>{return(Q)=>{if($.length)Q.children.push({name:"sheetData",children:$.map((J,Z)=>Mk.getTemplate(J,Z,z))});return Q}},vk=($)=>{let z=$.length;if(!z)return"";let Q=Array(z+1);Q[0]=z;for(let Z=1;Z<=z;Z++)Q[Z]=$.charCodeAt(Z-1)&255;let J=0;for(let Z=Q.length-1;Z>=0;Z--){let X=Q[Z],Y=(J&16384)===0?0:1,q=J<<1&32767;J=(Y|q)^X}return(J^52811).toString(16).toUpperCase().padStart(4,"0")},Ik=($)=>{return(z)=>{if(!$)return z;let Q=typeof $==="boolean"?{}:$,J={sheet:1},Z=Q.password?vk(Q.password):"";if(Z)J.password=Z;let X={autoFilter:!1,deleteColumns:!1,deleteRows:!1,formatCells:!1,formatColumns:!1,formatRows:!1,insertColumns:!1,insertHyperlinks:!1,insertRows:!1,pivotTables:!1,selectLockedCells:!0,selectUnlockedCells:!0};return Object.keys(X).forEach((Y)=>{let q=Q[Y];if(q==null||q===X[Y])return;J[Y]=q?0:1}),z.children.push({name:"sheetProtection",properties:{rawMap:J}}),z}},Ck=($)=>{return(z)=>{if($.length)z.children.push({name:"mergeCells",properties:{rawMap:{count:$.length}},children:$.map((Q)=>Wk.getTemplate(Q))});return z}},bk=($)=>{return(z)=>{let{top:Q=0.75,right:J=0.7,bottom:Z=0.75,left:X=0.7,header:Y=0.3,footer:q=0.3}=$;return z.children.push({name:"pageMargins",properties:{rawMap:{bottom:Z,footer:q,header:Y,left:X,right:J,top:Q}}}),z}},yk=($)=>{return(z)=>{if($)z.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:Vk($.orientation),paperSize:Ak($.pageSize)}}});return z}},xk=($)=>{return(z)=>{if(!$)return z;let Q=$.first!=null?1:0,J=$.even!=null?1:0;return z.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:Q,differentOddEven:J}},children:Ok($)}),z}},wk=($)=>{return(z)=>{if($)z.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}}]});return z}},Nk=($)=>{return(z)=>{if(Az.get($)?.length)z.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},gk=($)=>{return(z)=>{if(d$.get($))z.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},hk=($=0,z=0)=>{let Q=$>0||z>0;return Q?[{name:"pane",properties:{rawMap:{state:Q?"frozen":void 0,topLeftCell:Q?`${az($+1)}${z+1}`:void 0,xSplit:$===0?void 0:$,ySplit:z===0?void 0:z}}}]:void 0},uk=($=!1,z,Q)=>{return(J)=>{return J.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:$===!0?"1":"0",workbookViewId:"0"}},children:hk(z,Q)}]}),J}},mk=()=>{return($)=>{return $.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),$}},ck=($)=>{return(z)=>{let Q=$.reduce((J,Z)=>{if(Z.outlineLevel&&Z.outlineLevel>J)return Z.outlineLevel;return J},0);return z.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:Q?Q:void 0}}}),z}},pk={getTemplate($){let{worksheet:z,currentSheet:Q,config:J}=$,{margins:Z={},pageSetup:X,headerFooterConfig:Y,suppressColumnOutline:q,rightToLeft:G,frozenRowCount:_,frozenColumnCount:H,protectSheet:U}=J,{table:W}=z,{rows:B,columns:E}=W,K=E?.length?kk(B,E,!!q):[],L=w$.get(Q),{children:D}=[mk(),uk(G,H,_),ck(B),Pk(E),Tk(B,Q+1),Ik(U),Ck(K),bk(Z),yk(X),xk(Y),Nk(Q),gk(Q),wk(L)].reduce((F,M)=>M(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:D}}},ik=pk,sz=new Map,d0=[],rz=[],lz=new Map,Vz=new Map,Az=new Map,d$=new Map,TQ=new Map,vQ=new Map,w$=new Map,nk="AG-GRID-TABLE",e4="SINGLE_SHEET";function dk(){return e4}function tk($){e4=$}function sk($,z,Q){ek(z),PM($,d0.length);let J=Object.assign({},Q);if(Q.exportAsExcelTable&&Q.pivotModeActive)j(163,{featureName:"pivot mode"}),J.exportAsExcelTable=!1;ak(z,J);let Z=DV(z,J);return FV(Z),Z}function rk($){return $.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function lk($,z){if(w$.has($)){j(164);return}w$.set($,z)}function ak($,z){let{exportAsExcelTable:Q,prependContent:J,appendContent:Z,headerRowCount:X=0}=z;if(!Q)return;let Y=typeof Q==="boolean"?{}:Q,{name:q,showColumnStripes:G,showRowStripes:_,showFilterButton:H,highlightFirstColumn:U,highlightLastColumn:W}=Y,B=rk(q||nk),E=d0.length-1,{table:K}=$,{rows:L,columns:D}=K,F=J?J.length:0,M=Z?Z.length:0,k=L.length,V=D.length,R=[],O=[];for(let I=0;IX.id===$.id))Z.push($)}function ok($,z,Q,J,Z){let X=d0.length,{row:Y,column:q}=$.position||{},G=$;if(J){if(z!=null&&Q!=null&&(!Y||!q)){if(!$.position)$.position={};$.position=Object.assign({},$.position,{row:z,column:J.indexOf(Q)+1})}YF(G,J),qF(G,Z)}LX({imageToAdd:G,idx:X});let _=vQ.get(X);if(!_)_=new Map,vQ.set(X,_);let H=Az.get(X);if(!H)Az.set(X,[G]);else H.push(G);if(!_.get($.id))_.set($.id,{index:_.size,type:$.imageType})}function LX($){let{imageToAdd:z,idx:Q}=$,J=Vz.get(z.id);if(J){let Z=J.find((X)=>X.sheetId===Q);if(Z)Z.image.push(z);else J.push({sheetId:Q,image:[z]})}else Vz.set(z.id,[{sheetId:Q,image:[z]}]),TQ.set(z.id,{type:z.imageType,index:TQ.size})}function ek($){let z=W0($.name)||"",Q="";while(d0.indexOf(`${z}${Q}`)!==-1)if(Q==="")Q="_1";else Q=`_${parseInt(Q.slice(1),10)+1}`;$.name=`${z}${Q}`,d0.push($.name)}function $V($){if(sz.has($))return sz.get($);return sz.set($,sz.size),sz.size-1}function zV(){sz.clear(),Vz.clear(),Az.clear(),d$.clear(),TQ.clear(),vQ.clear(),w$.clear(),d0=[],rz=[],lz=new Map,e4="SINGLE_SHEET"}function QV($){return y0(qk.getTemplate(d0,$))}function JV($){return y0(TM.getTemplate($))}function ZV(){return y0(yF.getTemplate(sz))}function XV($){return y0(LF.getTemplate($))}function YV($){return y0(kF.getTemplate($))}function qV($,z){return y0(EF.getTemplate({sheetLen:$,hasCustomProperties:z}))}function GV($){let z=[{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"}];if($)z.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});let Q=v1.getTemplate(z);return y0(Q)}function _V(){return y0(nM.getTemplate())}function HV($,z){return y0(IM.getTemplate($,z))}function UV($){let z=Array($).fill(void 0).map((J,Z)=>({Id:`rId${Z+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${Z+1}.xml`})),Q=v1.getTemplate([...z,{Id:`rId${$+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${$+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${$+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return y0(Q)}function WV($){return y0(TF.getTemplate({sheetIndex:$}))}function BV($){let z=vQ.get($)||[],Q=[];for(let[J,Z]of z){let{index:X,type:Y}=Z;Q.push({Id:`rId${X+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${TQ.get(J).index+1}.${KZ(Y)}`})}return y0(v1.getTemplate(Q))}function EV($){return y0(zk.getTemplate({sheetIndex:$}),!0)}function KV($){let z=d$.get($)||[],Q=[];for(let J=0;J{if(!$.size)return;let Q=new Map;z.forEach((J,Z)=>{if($.has(J))Q.set(Z,$.get(J))}),$.clear(),Q.forEach((J,Z)=>$.set(Z,J))},FV=($)=>{let z=lz.get($)??[];z.push(d0.length-1),lz.set($,z),rz.push($)},MV=($)=>{let z=new Map(lz),Q=[];for(let J of $){let Z=z.get(J);if(!Z?.length)return null;let X=Z.shift();Q.push(X),z.set(J,Z)}return Q},kV=($)=>{if(!$.length||rz.length===0)return null;let z=new Set,Q=[];for(let J of $){let Z=rz.findIndex((X,Y)=>!z.has(Y)&&X===J);if(Z===-1)return null;z.add(Z),Q.push(Z)}return Q},VV=($)=>{let z=new Map;$.forEach((Q,J)=>z.set(Q,J)),d0=$.map((Q)=>d0[Q]),rz=$.map((Q)=>rz[Q]),eJ(Az,$),eJ(d$,$),eJ(w$,$),eJ(vQ,$),Vz.forEach((Q)=>{Q.forEach((J)=>{let Z=z.get(J.sheetId);if(Z!=null)J.sheetId=Z})}),lz=new Map,rz.forEach((Q,J)=>{let Z=lz.get(Q)??[];Z.push(J),lz.set(Q,Z)})},AV=($)=>{if($.length<=1)return;let z=MV($)??kV($);if(!z)return;VV(z)},$5=class{getStringPosition($){return $V($)}addBodyImageToMap($,z,Q,J,Z){ok($,z,Q,J,Z)}addHeaderFooterImageToMap($,z){KX($,z)}addWorksheet($,z,Q){return sk($,z,Q)}syncOrderWithSheetData($){AV($)}reset(){zV()}setFactoryMode($){tk($)}getFactoryMode(){return dk()}getSheetNames(){return[...d0]}},SV=async($)=>{let z=0,Q=[],J=new WritableStream({write:(Y)=>{Q.push(Y),z+=Y.length}}),Z=new ReadableStream({start:(Y)=>{let q=new FileReader;q.onload=(G)=>{if(G.target?.result)Y.enqueue(G.target.result);Y.close()},q.readAsArrayBuffer($)}}),X=new window.CompressionStream("deflate-raw");return await Z.pipeThrough(X).pipeTo(J),{size:z,content:new Blob(Q)}},RV=async($)=>{let z=new Blob([$]),{size:Q,content:J}=await SV(z),Z=new Uint8Array(await J.arrayBuffer());return{size:Q,content:Z}},jV=($)=>{let z=$.getHours();return z<<=6,z=z|$.getMinutes(),z<<=5,z=z|$.getSeconds()/2,z},fV=($)=>{let z=$.getFullYear()-1980;return z<<=4,z=z|$.getMonth()+1,z<<=5,z=z|$.getDate(),z};function b0($,z){let Q="";for(let J=0;J>>=8;return Q}var v9=($)=>{if(!$.length)return 0;let z=-1,Q=0,J=0,Z=0;for(let X=0;X<$.length;X++)Q=$[X],J=(z^Q)&255,Z=OV[J],z=z>>>8^Z;return z^-1},I9=($)=>{if(!$.length)return 0;if(typeof $==="string")return v9(new TextEncoder().encode($));return v9($)},OV=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function PV($){let z=String.fromCharCode;function Q(U){let W=[];if(!U)return[];let B=U.length,E=0,K,L;while(E=55296&&K<=56319&&E=55296&&U<=57343)throw Error($$(255,{point:U}))}function Z(U,W){return z(U>>W&63|128)}function X(U){if((U&4294967168)==0)return z(U);let W="";if((U&4294965248)==0)W=z(U>>6&31|192);else if((U&4294901760)==0)J(U),W=z(U>>12&15|224),W+=Z(U,6);else if((U&4292870144)==0)W=z(U>>18&7|240),W+=Z(U,12),W+=Z(U,6);return W+=z(U&63|128),W}let Y=Q($),q=Y.length,G=-1,_,H="";while(++G{let{content:Y,path:q,created:G}=$,_=jV(G),H=fV(G),U=I9(Z),W=X!==void 0?X:J,B=PV(q),E=B!==q,K="";if(E){let M=b0(1,1)+b0(I9(B),4)+B;K="up"+b0(M.length,2)+M}let L="\x14\x00"+(E?"\x00\b":"\x00\x00")+b0(z?8:0,2)+b0(_,2)+b0(H,2)+b0(W?U:0,4)+b0(X??J,4)+b0(J,4)+b0(B.length,2)+b0(K.length,2),D="PK\x03\x04"+L+B+K,F="PK\x01\x02\x14\x00"+L+"\x00\x00\x00\x00\x00\x00"+(Y?"\x00\x00\x00\x00":"\x10\x00\x00\x00")+b0(Q,4)+B+K;return{localFileHeader:Uint8Array.from(D,(M)=>M.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(F,(M)=>M.charCodeAt(0))}},FX=($)=>{let z;if(typeof $==="string"){let Q=atob($.split(";base64,")[1]);z=Uint8Array.from(Q,(J)=>J.charCodeAt(0))}else z=$;return{size:z.length,content:z}},TV=async($)=>{let{content:z}=$,{size:Q,content:J}=!z?{size:0,content:Uint8Array.from([])}:FX(z),Z,X,Y=!1;if($.type==="file"&&J&&Q>0){let G=await RV(J);Z=G.content,X=G.size,Y=!0}return{rawContent:J,rawSize:Q,deflatedContent:Z,deflatedSize:X,isCompressed:Y}},vV=($,z)=>{let{content:Q}=$,{content:J}=!Q?{content:Uint8Array.from([])}:FX(Q);return{...DX($,!1,z,J.length,J,void 0),content:J,isCompressed:!1}},IV=($,z,Q)=>{let J="PK\x05\x06\x00\x00\x00\x00"+b0($,2)+b0($,2)+b0(z,4)+b0(Q,4)+"\x00\x00";return Uint8Array.from(J,(Z)=>Z.charCodeAt(0))},MX=class{constructor(){this.folders=[],this.files=[]}addFolders($){$.forEach(this.addFolder.bind(this))}addFolder($){this.folders.push({path:$,created:new Date,isBase64:!1,type:"folder"})}addFile($,z,Q=!1){this.files.push({path:$,created:new Date,content:Q?z:new TextEncoder().encode(z),isBase64:Q,type:"file"})}async getZipFile($="application/zip"){let z=await this.buildCompressedFileStream();return this.clearStream(),new Blob([z],{type:$})}getUncompressedZipFile($="application/zip"){let z=this.buildFileStream();return this.clearStream(),new Blob([z],{type:$})}clearStream(){this.folders=[],this.files=[]}packageFiles($){let z=0,Q=0;for(let _ of $){let{localFileHeader:H,centralDirectoryHeader:U,content:W}=_;z+=H.length+W.length,Q+=U.length}let J=new Uint8Array(z),Z=new Uint8Array(Q),X=0,Y=0;for(let _ of $){let{localFileHeader:H,centralDirectoryHeader:U,content:W}=_;J.set(H,X),X+=H.length,J.set(W,X),X+=W.length,Z.set(U,Y),Y+=U.length}let q=IV($.length,Q,z),G=new Uint8Array(J.length+Z.length+q.length);return G.set(J),G.set(Z,J.length),G.set(q,J.length+Z.length),G}async buildCompressedFileStream(){let $=[...this.folders,...this.files],z=await Promise.all($.map(TV)),Q=[],J=0;for(let Z=0;Z<$.length;Z++){let X=$[Z],{rawContent:Y,rawSize:q,deflatedContent:G,deflatedSize:_,isCompressed:H}=z[Z],U=DX(X,H,J,q,Y,_),W=G??Y;Q.push({...U,content:W,isCompressed:H}),J+=U.localFileHeader.length+W.length}return this.packageFiles(Q)}buildFileStream(){let $=[...this.folders,...this.files],z=[],Q=0;for(let J of $){let Z=vV(J,Q),{localFileHeader:X,content:Y}=Z;z.push(Z),Q+=X.length+Y.length}return this.packageFiles(z)}},CV=($)=>{if($.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),!Vz.size)return;$.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let z=0;Vz.forEach((Q)=>{let J=Q[0].image[0],{base64:Z,imageType:X}=J;$.addFile(`xl/media/image${++z}.${KZ(X)}`,Z,!0)})},bV=($,z)=>{let Q=0,J=0;for(let Z=0;Z0&&Az.has(Z),q=w$.size>0&&w$.get(Z),G=Vz.size&&d$.has(Z);if(!Y&&!q&&!G)continue;let _,H,U;if(Y)yV($,Z,Q),H=Q,Q++;if(G)xV($,Z,J),U=J,J++;if(q)_=q.name;let W=`xl/worksheets/_rels/sheet${Z+1}.xml.rels`;$.addFile(W,LV({tableName:_,drawingIndex:H,vmlDrawingIndex:U}))}},yV=($,z,Q)=>{let Z=`xl/drawings/drawing${Q+1}.xml`,X=`xl/drawings/_rels/drawing${Q+1}.xml.rels`;$.addFile(X,BV(z)),$.addFile(Z,WV(z))},xV=($,z,Q)=>{let Z=`xl/drawings/vmlDrawing${Q+1}.vml`,X=`xl/drawings/_rels/vmlDrawing${Q+1}.vml.rels`;$.addFile(Z,EV(z)),$.addFile(X,KV(z))},wV=($)=>{let z=w$,Q=Array.from(z.keys());for(let J=0;J{let Y=!!X&&Object.keys(X).some((q)=>X[q]!=null);if($.addFile("xl/workbook.xml",QV(Z)),$.addFile("xl/styles.xml",JV(z)),$.addFile("xl/sharedStrings.xml",ZV()),$.addFile("xl/theme/theme1.xml",_V()),$.addFile("xl/_rels/workbook.xml.rels",UV(J)),$.addFile("docProps/core.xml",XV(Q)),Y)$.addFile("docProps/custom.xml",YV(X));$.addFile("[Content_Types].xml",qV(J,Y)),$.addFile("_rels/.rels",GV(Y))},kX=($,z,Q={},J)=>{if(!z||z.length===0)return j(159),J.reset(),!1;J.syncOrderWithSheetData(z);let{fontSize:Z=11,author:X="AG Grid",activeTab:Y=0,customMetadata:q}=Q,G=z.length,_=Math.max(Math.min(Y,G-1),0);return CV($),wV($),bV($,z),NV($,Z,X,G,_,q),J.reset(),!0},C9=($,z=new $5)=>{let{data:Q,fontSize:J,author:Z,activeSheetIndex:X,customMetadata:Y}=$,q=$.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new MX;if(!kX(G,Q,{author:Z,fontSize:J,activeTab:X,customMetadata:Y},z))return Promise.resolve(void 0);return G.getZipFile(q)},b9=($,z=new $5)=>{let{data:Q,fontSize:J,author:Z,activeSheetIndex:X,customMetadata:Y}=$,q=$.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new MX;if(!kX(G,Q,{author:Z,fontSize:J,activeTab:X,customMetadata:Y},z))return;return G.getUncompressedZipFile(q)};var gV=class extends R4{constructor(){super(...arguments);this.beanName="excelCreator",this.workbook=new $5}getMergedParams($){let z=this.gos.get("defaultExcelExportParams");return Object.assign({},z,$)}export($){if(this.isExportSuppressed()){j(160);return}let z=()=>{let J=this.getMergedParams($),Z=this.getData(J),{fontSize:X,author:Y,mimeType:q,customMetadata:G}=J,_={data:[Z],fontSize:X,author:Y,mimeType:q,customMetadata:G};this.packageCompressedFile(_).then((H)=>{if(H){let{fileName:U}=J,W=typeof U==="function"?U(y(this.gos,{})):U;dJ(this.getFileName(W),H)}})},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(z);else z()}exportDataAsExcel($){this.export($)}getDataAsExcel($){let z=this.getMergedParams($),Q=this.getData(z),{fontSize:J,author:Z,mimeType:X,customMetadata:Y}=z,q={data:[Q],fontSize:J,author:Z,mimeType:X,customMetadata:Y};return this.packageFile(q)}setFactoryMode($){this.workbook.setFactoryMode($)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel($){let z=this.getMergedParams($);return this.getData(z)}getMultipleSheetsAsExcel($){return b9($,this.workbook)}exportMultipleSheetsAsExcel($){C9($,this.workbook).then((z)=>{let{fileName:Q="export.xlsx"}=$;if(z){let J=typeof Q==="function"?Q():Q;dJ(J,z)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession($){let{colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,formula:X,gos:Y}=this.beans,q=Y.get("excelStyles")||[],G=this.createStyleLinker(q),_={...$,colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,formulaSvc:X,gos:Y,suppressRowOutline:$.suppressRowOutline||$.skipRowGroups,headerRowHeight:$.headerRowHeight||$.rowHeight,baseExcelStyles:q,rightToLeft:$.rightToLeft??Y.get("enableRtl"),styleLinker:G,headerRowCount:u7(z),pivotModeActive:z.isPivotActive(),workbook:this.workbook};return new HF(_)}createStyleLinker($){let z=[],Q=new Set,J=new Map;$.forEach((Y,q)=>{z.push(Y.id),Q.add(Y.id),J.set(Y.id,q)});let{gos:Z,cellStyles:X}=this.beans;return(Y)=>{let{rowType:q,rowIndex:G,value:_,column:H,columnGroup:U,node:W}=Y,B=q==="HEADER",E=q==="HEADER_GROUPING",K=B?H:U,L=[];if(B||E){if(L.push("header"),E)L.push("headerGroup");if(K)L=L.concat(NJ(K.getDefinition(),Z,H||null,U||null));return L}let D=["cell"];if(!z.length)return D;let F=H.getDefinition();return X?.processAllCellClasses(F,y(Z,{value:_,data:W.data,node:W,colDef:F,column:H,rowIndex:G}),(M)=>{if(Q.has(M))D.push(M)}),D.sort((M,k)=>{let V=J.get(M)??-1,R=J.get(k)??-1;return V===R?0:Vthis.onFocusIn($),onFocusOut:($)=>this.onFocusOut($),focusInnerElement:($)=>this.focusInnerElement($),onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged($){if($.listItemHeightChanged)this.rowHeight=this.getItemHeight(),this.refresh()}refreshAriaProperties(){let z=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),Q=this.eContainer;_0(Q,this.model?.getRowCount()>0?this.ariaRole:"presentation"),E0(Q,z)}addResizeObserver(){let $=()=>Y$(this.beans,()=>this.drawVirtualRows()),z=F$(this.beans,this.getGui(),$);this.addDestroyFunc(z)}focusInnerElement($){return this.focusRow($?this.model.getRowCount()-1:0),!0}onFocusIn($){let z=$.target;if(z.classList.contains("ag-virtual-list-item"))this.lastFocusedRowIndex=M6(z)-1}onFocusOut($){if(!this.getFocusableElement().contains($.relatedTarget))this.lastFocusedRowIndex=null}handleKeyDown($){let{key:z,shiftKey:Q}=$;switch(z){case A.UP:case A.DOWN:{let J=z===A.UP;if($.preventDefault(),Q)this.moveItem(J);else this.navigate(J)}break;case A.PAGE_HOME:case A.PAGE_END:case A.PAGE_UP:case A.PAGE_DOWN:if(this.navigateToPage(z)!==null)$.preventDefault();break}}onTabKeyDown($){this.stopPropagationCallbacks?.stopPropagation($),this.forceFocusOutOfContainer($.shiftKey)}getNextRow($){if(this.lastFocusedRowIndex==null)return;let z=this.lastFocusedRowIndex+($?-1:1);if(z<0||z>=this.model.getRowCount())return;return z}moveItem($){if(!this.moveItemCallback)return;let z=this.getComponentAt(this.lastFocusedRowIndex);if(!z)return;this.moveItemCallback(z,$)}navigate($){let z=this.getNextRow($);if(z===void 0)return;this.focusRow(z)}navigateToPage($,z="focused"){let Q=!1;if(z==="focused")z=this.getLastFocusedRow(),Q=!0;let J=this.model.getRowCount()-1,Z=-1;if($===A.PAGE_HOME)Z=0;else if($===A.PAGE_END)Z=J;else if($===A.PAGE_DOWN)Z=Math.min(z+this.pageSize,J);else if($===A.PAGE_UP)Z=Math.max(z-this.pageSize,0);if(Z===-1)return null;if(Q)this.focusRow(Z);else this.ensureIndexVisible(Z);return Z}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow($){if(this.isScrolling)return;this.isScrolling=!0,this.ensureIndexVisible($),Y$(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;let z=this.renderedRows.get($);if(z)z.eDiv.focus()})}getComponentAt($){let z=this.renderedRows.get($);return z&&z.rowComponent}forEachRenderedRow($){this.renderedRows.forEach((z,Q)=>$(z.rowComponent,Q))}getItemHeight(){if(!this.isHeightFromTheme)return this.rowHeight;return this.beans.environment.getDefaultListItemHeight()}ensureIndexVisible($,z=!0){let Q=this.model.getRowCount();if(typeof $!=="number"||$<0||$>=Q)return!1;let J=$*this.rowHeight,Z=J+this.rowHeight,X=this.getGui(),Y=X.scrollTop,q=X.offsetHeight,G=Y+q,_=z?0:this.rowHeight,H=Y>J+_,U=G{if(!this.isAlive())return;if(this.canSoftRefresh($))this.drawVirtualRows(!0);else this.clearVirtualRows(),this.drawVirtualRows()})}awaitStable($){if(this.awaitStableCallbacks.push($),this.awaitStableCallbacks.length>1)return;let z=this.model.getRowCount();I2(this,()=>this.eContainer.clientHeight>=z*this.rowHeight,()=>{if(!this.isAlive())return;let Q=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let J of Q)J()})}canSoftRefresh($){return!!($&&this.renderedRows.size&&typeof this.model.areRowsEqual==="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach(($,z)=>this.removeRow(z))}drawVirtualRows($){if(!this.isAlive()||!this.model)return;let z=this.getGui(),Q=z.scrollTop,J=Q+z.offsetHeight;if(Q===J)this.clearVirtualRows();else{let Z=Math.floor(Q/this.rowHeight),X=Math.floor(J/this.rowHeight);this.pageSize=Math.floor((J-Q)/this.rowHeight),this.ensureRowsRendered(Z,X,$)}}ensureRowsRendered($,z,Q){if(this.renderedRows.forEach((J,Z)=>{if((Z<$||Z>z)&&Z!==this.lastFocusedRowIndex)this.removeRow(Z)}),Q)this.refreshRows();for(let J=$;J<=z;J++){if(this.renderedRows.has(J))continue;if(J=z.getRowCount())return;let{cssIdentifier:Q,ariaRole:J,renderedRows:Z,eContainer:X}=this,Y=z.getRow($),q=J==="tree"?"treeitem":"option",G=K0({tag:"div",cls:`ag-virtual-list-item ag-${Q}-virtual-list-item`,role:q,attrs:{tabindex:"-1"}});kJ(G,z.getRowCount()),VJ(G,$+1);let _=this.rowHeight;G.style.height=`${_}px`,G.style.top=`${_*$}px`;let H=this.componentCreator(Y,G);if(H.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=$),G.appendChild(H.getGui()),Z.has($-1))Z.get($-1).eDiv.insertAdjacentElement("afterend",G);else if(Z.has($+1))Z.get($+1).eDiv.insertAdjacentElement("beforebegin",G);else X.appendChild(G);Z.set($,{rowComponent:H,eDiv:G,value:Y})}removeRow($){let z=this.renderedRows.get($);z.eDiv.remove(),this.destroyBean(z.rowComponent),this.renderedRows.delete($)}refreshRows(){let $=this.model.getRowCount();this.renderedRows.forEach((z,Q)=>{if(Q>=$)this.removeRow(Q);else{let J=this.model.getRow(Q);if(this.model.areRowsEqual?.(z.value,J))this.componentUpdater(J,z.rowComponent);else this.removeRow(Q)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel($){this.model=$}getAriaElement(){return this.eContainer}destroy(){if(!this.isAlive())return;this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy()}},cV='.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}',g4="ag-list-item-hovered",pV=class extends R0{constructor($,z,Q){super();this.comp=$,this.virtualList=z,this.params=Q,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(cV,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart($){this.currentDragValue=this.params.getCurrentDragValue($),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){let $={isInterestedIn:(z)=>z===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:(z)=>this.onDragging(z),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget($)}createAutoScrollService(){let $=this.virtualList.getGui();this.autoScrollService=new uJ({scrollContainer:$,scrollAxis:"y",getVerticalPosition:()=>$.scrollTop,setVerticalPosition:(z)=>$.scrollTop=z})}onDragging($){if(!this.currentDragValue||this.moveBlocked)return;let z=this.getListDragItem($),Q=this.virtualList.getComponentAt(z.rowIndex);if(!Q)return;let J=Q.getGui().parentElement;if(this.lastHoveredListItem&&this.lastHoveredListItem.rowIndex===z.rowIndex&&this.lastHoveredListItem.position===z.position)return;this.autoScrollService.check($.event),this.clearHoveredItems(),this.lastHoveredListItem=z,O2(J,g4),O2(J,`ag-item-highlight-${z.position}`)}getListDragItem($){let z=this.virtualList.getGui(),Q=Number.parseFloat(window.getComputedStyle(z).paddingTop),J=this.virtualList.getRowHeight(),Z=this.virtualList.getScrollTop(),X=Math.max(0,($.y-Q+Z)/J),Y=this.params.getNumRows(this.comp)-1,q=Math.min(Y,X)|0;return{rowIndex:q,position:Math.round(X)>X||X>Y?"bottom":"top",component:this.virtualList.getComponentAt(q)}}onDragStop(){if(this.moveBlocked)return;this.params.moveItem(this.currentDragValue,this.lastHoveredListItem),this.clearDragProperties()}onDragCancel(){this.clearDragProperties()}onDragLeave(){this.clearDragProperties()}clearDragProperties(){this.clearHoveredItems(),this.autoScrollService.ensureCleared()}clearHoveredItems(){let $=this.virtualList.getGui();for(let z of $.querySelectorAll(`.${g4}`))for(let Q of[g4,"ag-item-highlight-top","ag-item-highlight-bottom"])z.classList.remove(Q);this.lastHoveredListItem=null}};var iV=".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-family:var(--ag-panel-title-bar-font-family);font-size:var(--ag-panel-title-bar-font-size);font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-panel-title-bar-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*2);margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-left:var(--ag-spacing);margin-right:calc(var(--ag-spacing)*2)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}";function nV($){return $??($=$||"default"),{tag:"div",cls:`ag-panel ag-${$}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${$}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${$}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${$}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${$}-panel-content-wrapper`}]}}var dV=class extends p0{constructor($){super(nV($.cssIdentifier));this.config=$,this.closable=!0,this.eContentWrapper=f,this.eTitleBar=f,this.eTitleBarButtons=f,this.eTitle=f,this.registerCSS(iV)}postConstruct(){let{component:$,closable:z,hideTitleBar:Q,title:J,minWidth:Z=250,width:X,minHeight:Y=250,height:q,centered:G,popup:_,x:H,y:U,postProcessPopupParams:W}=this.config,B=this.beans,E=this.createManagedBean(new d2(this.getGui(),{minWidth:Z,width:X,minHeight:Y,height:q,centered:G,x:H,y:U,popup:_,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=E;let K=this.getGui();if($)this.setBodyComponent($);if(!Q){if(J)this.setTitle(J);this.setClosable(z!=null?z:this.closable)}else N(this.eTitleBar,!1);if(this.addManagedElementListeners(this.eTitleBar,{mousedown:(D)=>{if(K.contains(D.relatedTarget)||K.contains(d(B))||this.eTitleBarButtons.contains(D.target)){D.preventDefault();return}let F=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");if(F)F.focus()}}),_&&E.isPositioned())return;if(this.renderComponent)this.renderComponent();let L;if(W){let{type:D,eventSource:F,mouseEvent:M}=W;L=()=>B.popupSvc?.callPostProcessPopup(W,D,K,F,M)}E.initialisePosition(L),this.eContentWrapper.style.height="0"}renderComponent(){let $=this.getGui();$.focus(),this.close=()=>{$.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight($){this.positionableFeature.setHeight($)}getWidth(){return this.positionableFeature.getWidth()}setWidth($){this.positionableFeature.setWidth($)}setClosable($){if($!==this.closable)this.closable=$;if($){let z=this.closeButtonComp=new p0({tag:"div",cls:"ag-button"});this.createBean(z);let Q=z.getGui(),J=this.beans.iconSvc.createIconNoSpan("close",this.beans);J.classList.add("ag-panel-title-bar-button-icon"),Q.appendChild(J),this.addTitleBarButton(z),z.addManagedElementListeners(Q,{click:this.onBtClose.bind(this)})}else if(this.closeButtonComp)this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp)}setBodyComponent($){$.setParentComponent(this),this.eContentWrapper.appendChild($.getGui())}addTitleBarButton($,z){let Q=this.eTitleBarButtons,J=Q.children,Z=J.length;if(z==null)z=Z;z=Math.max(0,Math.min(z,Z)),$.addCss("ag-panel-title-bar-button");let X=$.getGui();if(z===0)Q.prepend(X);else if(z===Z)Q.append(X);else J[z-1].after(X);$.setParentComponent(this)}getBodyHeight(){return AJ(this.eContentWrapper)}getBodyWidth(){return xz(this.eContentWrapper)}setTitle($){this.eTitle.innerText=$}onBtClose(){this.close()}destroy(){if(this.closeButtonComp)this.closeButtonComp=this.destroyBean(this.closeButtonComp);let $=this.getGui();if($&&A0($))this.close();super.destroy()}},tV=class extends dV{constructor($,z){super({...$,popup:!0});this.callbacks=z,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans($){this.popupSvc=$.popupSvc}postConstruct(){let $=this.getGui(),{movable:z,resizable:Q,maximizable:J,modal:Z}=this.config;if(this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new q4(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront($)},onTabKeyDown:(X)=>{if(Z)return;let Y=X.shiftKey,q=j0(this.beans,$,!1,Y);if(!q||this.tabGuardFeature.getTabGuardCtrl().isTabGuard(q)){if(this.callbacks?.focusNextContainer(this.beans,Y))X.preventDefault()}}}),z)this.setMovable(z);if(J)this.setMaximizable(J);if(Q)this.setResizable(Q);if(!this.config.modal)this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus($){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus($)}renderComponent(){let $=this.getGui(),{alwaysOnTop:z,modal:Q,title:J,afterGuiAttached:Z}=this.config,X=this.getLocaleTextFunc(),Y=this.popupSvc?.addPopup({modal:Q,eChild:$,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:z,ariaLabel:J||X("ariaLabelDialog","Dialog"),afterGuiAttached:Z});if(Y)this.close=Y.hideFunc}onClosed($){this.destroy(),this.config.closedCallback?.($)}setMaximized($){if(this.isMaximizable&&$!==this.isMaximized)this.toggleMaximize()}toggleMaximize(){let $=this.positionableFeature.getPosition();if(this.isMaximized){let{x:z,y:Q,width:J,height:Z}=this.lastPosition;this.setWidth(J),this.setHeight(Z),this.positionableFeature.offsetElement(z,Q)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=$.x,this.lastPosition.y=$.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){N(this.maximizeIcon,!this.isMaximized),N(this.minimizeIcon,this.isMaximized)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(let $ of this.maximizeListeners)$();this.maximizeListeners.length=0}if(this.resizeListenerDestroy)this.resizeListenerDestroy(),this.resizeListenerDestroy=null}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable($){this.positionableFeature.setResizable($)}setMovable($){this.positionableFeature.setMovable($,this.eTitleBar)}setMaximizable($){if(!$){if(this.clearMaximizebleListeners(),this.maximizeButtonComp)this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0;return}let z=this.eTitleBar;if(!z||$===this.isMaximizable)return;this.isMaximizable=$;let Q=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),Q.addManagedElementListeners(Q.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(Q,0),this.maximizeListeners.push(...this.addManagedElementListeners(z,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){let $=this.maximizeButtonComp=this.createBean(new p0({tag:"div",cls:"ag-dialog-button"})),z=$.getGui(),Q=this.beans.iconSvc;return this.maximizeIcon=Q.createIconNoSpan("maximize"),z.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=Q.createIconNoSpan("minimize"),z.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),$}};var sV=class extends p${constructor($){super();this.setTemplateFromElement($.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($)})}handleKeyDown($){if($.key===A.ESCAPE)this.closePanel()}onTabKeyDown($){if($.defaultPrevented)return;this.closePanel(),$.preventDefault()}closePanel(){let $=this.parentComponent;$.closeSubMenu(),setTimeout(()=>$.getGui().focus(),0)}},r4=class extends R0{constructor($){super();this.callbacks=$,this.ACTIVATION_DELAY=80,this.isActive=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init($){let{menuItemDef:z,isAnotherSubMenuOpen:Q,level:J,childComponent:Z,contextParams:X}=$;return this.params=$.menuItemDef,this.level=J,this.isAnotherSubMenuOpen=Q,this.childComponent=Z,this.contextParams=X,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...z,level:J,isAnotherSubMenuOpen:Q,openSubMenu:(Y)=>this.openSubMenu(Y),closeSubMenu:()=>this.closeSubMenu(),closeMenu:(Y)=>this.closeMenu(Y),updateTooltip:(Y,q)=>this.refreshTooltip(Y,q),onItemActivated:()=>this.onItemActivated()}).then((Y)=>{if(!Y)return;this.menuItemComp=Y;let q=Y.configureDefaults?.();if(q)this.configureDefaults(q===!0?void 0:q)})}addListeners($,z){if(!z?.suppressClick)this.addManagedElementListeners($,{click:(Q)=>this.onItemSelected(Q)});if(!z?.suppressKeyboardSelect)this.addManagedElementListeners($,{keydown:(Q)=>{if(Q.key===A.ENTER||Q.key===A.SPACE)Q.preventDefault(),this.onItemSelected(Q)}});if(!z?.suppressMouseDown)this.addManagedElementListeners($,{mousedown:(Q)=>{Q.stopPropagation(),Q.preventDefault()}});if(!z?.suppressMouseOver)this.addManagedElementListeners($,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu($=!1,z){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;let Q=J0({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=Q;let J,Z=()=>{this.subMenuIsOpening=!1};if(this.childComponent){let _=this.createBean(new sV(this.childComponent));_.setParentComponent(this);let H=_.getGui(),U="mouseenter",W=()=>this.cancelDeactivate();if(H.addEventListener(U,W),J=()=>{H.removeEventListener(U,W),this.destroyBean(_)},Q.appendChild(H),this.childComponent.afterGuiAttached)Z=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1}}else if(this.params.subMenu){let _=this.createBean(new VX(this.level+1,this.contextParams,this.callbacks));if(_.setParentComponent(this),_.addMenuItems(this.params.subMenu),Q.appendChild(_.getGui()),this.addManagedListeners(_,{closeMenu:(H)=>this.dispatchLocalEvent(H)}),_.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),J=()=>this.destroyBean(_),$)Z=()=>{_.activateFirstItem(),this.subMenuIsOpening=!1}}let X=this.beans.popupSvc,Y=()=>{let _=this.eGui;X?.positionPopupForMenu({eventSource:_,ePopup:Q,event:z instanceof MouseEvent?z:void 0,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},q=this.getLocaleTextFunc(),G=X?.addPopup({modal:!0,eChild:Q,positionCallback:Y,anchorToElement:this.eGui,ariaLabel:q("ariaLabelSubMenu","SubMenu"),afterGuiAttached:Z});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{if(G)G.hideFunc();this.subMenuIsOpen=!1,this.setAriaExpanded(!1),J(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded($){if(!this.suppressAria)w0(this.eGui,$)}closeSubMenu(){if(!this.hideSubMenu)return;this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1)}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate($,z){if(this.cancelActivate(),this.params.disabled&&!z)return;if(this.isActive=!0,!this.suppressRootStyles)this.eGui.classList.add(`${this.cssClassPrefix}-active`);if(this.menuItemComp.setActive?.(!0),!this.suppressFocus)this.callbacks.preserveRangesWhile(this.beans,()=>this.eGui.focus({preventScroll:!z}));if($&&this.params.subMenu)window.setTimeout(()=>{if(this.isAlive()&&this.isActive)this.openSubMenu()},300);this.onItemActivated()}deactivate(){if(this.cancelDeactivate(),!this.suppressRootStyles)this.eGui.classList.remove(`${this.cssClassPrefix}-active`);if(this.menuItemComp.setActive?.(!1),this.isActive=!1,this.subMenuIsOpen)this.closeSubMenu()}getGui(){return this.menuItemComp.getGui()}getParentComponent(){return this.parentComponent}setParentComponent($){this.parentComponent=$}getSubMenuGui(){return this.eSubMenuGui}onItemSelected($){if(this.menuItemComp.select?.(),this.params.action)this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams})));else this.openSubMenu($&&$.type==="keydown",$);if(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)return;this.closeMenu($)}closeMenu($){let z={type:"closeMenu"};if($)if($ instanceof MouseEvent)z.mouseEvent=$;else z.keyboardEvent=$;this.dispatchLocalEvent(z)}onItemActivated(){let $={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent($)}cancelActivate(){if(this.activateTimeoutId)window.clearTimeout(this.activateTimeoutId),this.activateTimeoutId=0}cancelDeactivate(){if(this.deactivateTimeoutId)window.clearTimeout(this.deactivateTimeoutId),this.deactivateTimeoutId=0}onMouseEnter(){if(this.cancelDeactivate(),this.isAnotherSubMenuOpen())this.activateTimeoutId=window.setTimeout(()=>this.activate(!0),this.ACTIVATION_DELAY);else this.activate(!0)}onMouseLeave(){if(this.cancelActivate(),this.isSubMenuOpen())this.deactivateTimeoutId=window.setTimeout(()=>this.deactivate(),this.ACTIVATION_DELAY);else this.deactivate()}refreshRootElementGui($){let z=this.menuItemComp.getGui(),{cssClassPrefix:Q,params:{cssClasses:J,disabled:Z}}=this,X=this.menuItemComp.getRootElement?.();if(X){if(!$)z.classList.add("ag-menu-option-custom");z=X}if(this.suppressRootStyles=!!$,!this.suppressRootStyles){z.classList.add(Q);for(let Y of J??[])z.classList.add(Y);if(Z)z.classList.add(`${Q}-disabled`)}return z}applyAriaProperties($){let{params:{checked:z,subMenu:Q,subMenuRole:J,disabled:Z}}=this,X=z!=null;if(_0($,X?"menuitemcheckbox":"menuitem"),Q)P6($,J??"menu");if(Z)S6($,!0)}configureDefaults($){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults($));return}let{suppressRootStyles:z,suppressTooltip:Q,suppressAria:J,suppressTabIndex:Z,suppressFocus:X}=$||{},{params:{tooltip:Y,disabled:q}}=this,G=this.eGui=this.refreshRootElementGui(!!z);if(this.suppressAria=!!J,!J)this.applyAriaProperties(G);if(!Z)G.setAttribute("tabindex","-1");if(!Q)this.refreshTooltip(Y);if(!q)this.addListeners(G,$);this.suppressFocus=!!X}refreshTooltip($,z){if(this.tooltip=$,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!$||!this.menuItemComp)return;let Q=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:z});if(Q)this.tooltipFeature=this.createBean(Q)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},VX=class extends p${constructor($=0,z,Q){super({tag:"div",cls:"ag-menu-list",role:"menu"});this.level=$,this.menuActionParams=z,this.callbacks=Q,this.menuItems=[]}postConstruct(){this.initialiseTabGuard({onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown($)),onFocusIn:($)=>this.handleFocusIn($),onFocusOut:($)=>this.handleFocusOut($)})}onTabKeyDown($){if(!this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed"))$.preventDefault();if($.shiftKey)this.closeIfIsChild($)}handleKeyDown($){switch($.key){case A.UP:case A.RIGHT:case A.DOWN:case A.LEFT:$.preventDefault(),this.handleNavKey($.key);break;case A.ESCAPE:if(this.closeIfIsChild())this.callbacks.stopPropagationCallbacks.stopPropagation($);break}}handleFocusIn($){let z=$.relatedTarget;if(!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(z)&&(this.getGui().contains(z)||this.activeMenuItem?.getSubMenuGui()?.contains(z)))return;if(this.activeMenuItem)this.activeMenuItem.activate();else this.activateFirstItem()}handleFocusOut($){let z=$.relatedTarget;if(!this.activeMenuItem||this.getGui().contains(z)||this.activeMenuItem.getSubMenuGui()?.contains(z))return;if(!this.activeMenuItem.isSubMenuOpening())this.activeMenuItem.deactivate()}clearActiveItem(){if(this.activeMenuItem)this.activeMenuItem.deactivate(),this.activeMenuItem=null}addMenuItems($){if($==null)return;g.all($.map((z)=>{if(z==="separator")return g.resolve({eGui:this.createSeparator()});else if(typeof z==="string")return this.callbacks.warnNoItem?.(z),g.resolve({eGui:null});else return this.addItem(z)})).then((z)=>{for(let Q of z??[])if(Q?.eGui){if(this.appendChild(Q.eGui),Q.comp)this.menuItems.push(Q.comp)}})}addItem($){let z=this.createManagedBean(new r4(this.callbacks));return z.init({menuItemDef:$,isAnotherSubMenuOpen:()=>this.menuItems.some((Q)=>Q.isSubMenuOpen()),level:this.level,contextParams:this.menuActionParams}).then(()=>{return z.setParentComponent(this),this.addManagedListeners(z,{closeMenu:(Q)=>{this.dispatchLocalEvent(Q)},menuItemActivated:(Q)=>{if(this.activeMenuItem&&this.activeMenuItem!==Q.menuItem)this.activeMenuItem.deactivate();this.activeMenuItem=Q.menuItem}}),{comp:z,eGui:z.getGui()}})}activateFirstItem(){let $=this.menuItems.filter((z)=>!z.isDisabled())[0];if(!$)return;$.activate()}createSeparator(){let $={tag:"div",cls:"ag-menu-separator-part"};return K0({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[$,$,$,$]})}handleNavKey($){switch($){case A.UP:case A.DOWN:{let Q=this.findNextItem($===A.UP);if(Q&&Q!==this.activeMenuItem)Q.activate(!1,!0);return}}let z=this.gos.get("enableRtl")?A.RIGHT:A.LEFT;if($===z)this.closeIfIsChild();else this.openChild()}closeIfIsChild($){let z=this.getParentComponent();if(z&&z instanceof r4){if($)$.preventDefault();return z.closeSubMenu(),z.getGui().focus(),!0}return!1}openChild(){if(this.activeMenuItem)this.activeMenuItem.openSubMenu(!0)}findNextItem($){let z=[...this.menuItems];if(!z.length)return;if(!this.activeMenuItem)return $?b(z):z[0];if($)z.reverse();let Q,J=!1;for(let Z of z){if(!J){if(Z===this.activeMenuItem)J=!0;continue}Q=Z;break}if(J&&!Q)return z[0];return Q||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};var rV=class extends p0{constructor($){super({tag:"div"});this.callbacks=$}init($){this.params=$,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){let{checked:$,subMenu:z}=this.params,Q=this.getGui();if($)f6(Q,$);if(z)w0(Q,!1)}addIcon(){if(this.params.isCompact)return;let $=K0({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:z,icon:Q}=this.params;if(z)$.appendChild(this.beans.iconSvc.createIconNoSpan("check"));else if(Q)if(X1(Q))$.appendChild(Q);else if(typeof Q==="string")$.innerHTML=Q;else this.callbacks?.warnNoIcon?.();this.getGui().appendChild($)}addName(){let $=K0({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild($)}addShortcut(){if(this.params.isCompact)return;let $=K0({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild($)}addSubMenu(){let $=K0({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),z=this.getGui();if(this.params.subMenu){let Q=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";$.appendChild(this.beans.iconSvc.createIconNoSpan(Q))}z.appendChild($)}getClassName($){return`${this.cssClassPrefix}-${$}`}};function l4($,z){if(!z)return null;let Q=E$($),J=Q.indexOf(z);if(J===-1)return null;let Z=-1;for(let X=J-1;X>=0;X--)if(Q[X].classList.contains(gQ.TAB_GUARD_TOP)){Z=X;break}if(Z<=0)return null;return Q[Z-1]}function AX($,z){if(!z)return!1;let Q=$.querySelectorAll(`.${s2}`);if(!Q.length)return!1;for(let J=0;Jthis.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){let{enableCloseButton:$,cssClass:z}=this.params,Q=(J,Z)=>{if(J.classList.add(`ag-tabs-${Z}`),z)J.classList.add(`${z}-${Z}`)};if($)this.setupCloseButton(Q),this.eTabHeader=K0({tag:"div",role:"presentation"}),Q(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader);else this.eTabHeader=this.eHeader;_0(this.eTabHeader,"tablist"),Q(this.eTabHeader,"header")}setupCloseButton($){let z=K0({tag:"button"});$(z,"close-button");let Q=this.beans.iconSvc.createIconNoSpan("close");E0(z,this.params.closeButtonAriaLabel),z.appendChild(Q),this.addManagedElementListeners(z,{click:()=>this.params.onCloseClicked?.()});let J=K0({tag:"div",role:"presentation"});$(J,"close-button-wrapper"),J.appendChild(z),this.eHeader.appendChild(J),this.eCloseButton=z}handleKeyDown($){switch($.key){case A.RIGHT:case A.LEFT:{if(!this.eTabHeader.contains(d(this.beans)))return;let z=$.key===A.RIGHT,Q=this.gos.get("enableRtl"),J=this.items.indexOf(this.activeItem),Z=z!==Q?Math.min(J+1,this.items.length-1):Math.max(J-1,0);if(J===Z)return;$.preventDefault();let X=this.items[Z];this.showItemWrapper(X),X.eHeaderButton.focus();break}case A.UP:case A.DOWN:$.stopPropagation();break}}onTabKeyDown($){if($.defaultPrevented)return;let{beans:z,eHeader:Q,eBody:J,activeItem:Z,params:X}=this,{suppressTrapFocus:Y,enableCloseButton:q}=X,G=d(z),_=$.target,H=$.shiftKey;if(Q.contains(G)){if($.preventDefault(),q&&H&&!this.eCloseButton?.contains(G))this.eCloseButton?.focus();else if(Y&&H)l4(Y0(z).body,_)?.focus();else this.focusBody($.shiftKey);return}let U=null;if(AX(J,_)){if(H)U=l4(J,_);if(!U&&!Y)U=Z.eHeaderButton}if(!U&&J.contains(G)){if(U=j0(z,J,!1,H),!U){if(Y&&!H)this.forceFocusOutOfContainer(H);else if(q&&!H)$.preventDefault(),this.eCloseButton?.focus();else $.preventDefault(),this.focusHeader();return}}if(U)$.preventDefault(),U.focus()}focusInnerElement($){if($)return this.focusBody(!0);else return this.focusHeader(),!0}focusHeader($){this.activeItem.eHeaderButton.focus({preventScroll:$})}focusBody($){return F0(this.eBody,$)}setAfterAttachedParams($){this.afterAttachedParams=$}showFirstItem(){if(this.items.length>0)this.showItemWrapper(this.items[0])}addItem($){let z=K0({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});z.appendChild($.title),this.eTabHeader.appendChild(z),E0(z,$.titleLabel);let Q={tabbedItem:$,eHeaderButton:z};this.items.push(Q),z.addEventListener("click",this.showItemWrapper.bind(this,Q))}showItem($){let z=this.items.find((Q)=>Q.tabbedItem===$);if(z)this.showItemWrapper(z)}showItemWrapper($){let{tabbedItem:z,eHeaderButton:Q}=$;if(this.params.onItemClicked?.({item:z}),this.activeItem===$){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener)this.lastScrollListener=this.lastScrollListener();if(z0(this.eBody),z.bodyPromise.then((J)=>{this.eBody.appendChild(J);let Z=!VQ();if(!this.params.suppressFocusBodyOnOpen)F0(this.eBody,!1,Z);if(z.afterAttachedCallback)z.afterAttachedCallback(this.afterAttachedParams);if(this.params.keepScrollPosition){let X=z.getScrollableContainer?.()||J;[this.lastScrollListener]=this.addManagedElementListeners(X,{scroll:()=>{this.tabbedItemScrollMap.set(z.name,X.scrollTop)}});let Y=this.tabbedItemScrollMap.get(z.name);if(Y!==void 0)setTimeout(()=>{X.scrollTop=Y},0)}}),this.activeItem)this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"),this.activeItem.tabbedItem.afterDetachedCallback?.();Q.classList.add("ag-tab-selected"),this.activeItem=$}},oV=".ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}";function eV($){let z=$.cssIdentifier||"default",Q=$.direction||"vertical";return{tag:"div",cls:`ag-group ag-${z}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${z}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${Q} ag-${z}-group-container`}]}}var $A=class extends p0{constructor($={}){super(eV($),[y$]);this.params=$,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=f,this.cbGroupEnabled=f,this.eContainer=f,this.registerCSS(oV);let{enabled:z,items:Q,suppressEnabledCheckbox:J,expanded:Z,suppressToggleExpandOnEnableChange:X,useToggle:Y}=$;if(this.cssIdentifier=$.cssIdentifier||"default",this.enabled=z!=null?z:!0,this.items=Q||[],this.useToggle=Y??!1,this.alignItems=$.alignItems||"center",this.expanded=Z==null?!0:Z,J!=null)this.suppressEnabledCheckbox=J;if(X!=null)this.suppressToggleExpandOnEnableChange=X}postConstruct(){if(this.setupTitleBar(),this.items.length){let Z=this.items;this.items=[],this.addItems(Z)}let $=this.getLocaleTextFunc();if(this.cbGroupEnabled.setLabel($("enabled","Enabled")),this.enabled)this.setEnabled(this.enabled,void 0,!0);this.setAlignItems(this.alignItems);let{onEnableChange:z,onExpandedChange:Q,suppressOpenCloseIcons:J}=this.params;if(this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(J??!1),this.refreshChildDisplay(),N(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange((Z)=>{this.setEnabled(Z,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(Z)}),z!=null)this.onEnableChange(z);if(Q!=null)this.onExpandedChange(Q)}refreshChildDisplay(){N(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems($){if(this.alignItems!==$)this.removeCss(`ag-group-item-alignment-${this.alignItems}`);this.alignItems=$;let z=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(z),this}toggleGroupExpand($,z){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)$=!0,z=!0;else if($=$!=null?$:!this.expanded,this.expanded===$)return this;if(this.expanded=$,this.refreshChildDisplay(),N(this.eContainer,$),!z)this.dispatchLocalEvent({type:$?"expanded":"collapsed"});return this}addItems($){for(let z of $)this.addItem(z)}prependItem($){this.insertItem($,!0)}addItem($){this.insertItem($,!1)}updateItems($){let z=this.items,Q=0;for(let J=0;J$(z.enabled)}),this}onExpandedChange($){return this.addManagedListeners(this,{expanded:()=>$(!0),collapsed:()=>$(!1)}),this}hideEnabledCheckbox($){return this.suppressEnabledCheckbox=$,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons($){return this.eTitleBar?.hideOpenCloseIcons($),this}refreshDisabledStyles(){let $=!this.enabled;this.eContainer.classList.toggle("ag-disabled",$),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&$),this.eContainer.classList.toggle("ag-disabled-group-container",$)}setupTitleBar(){let $=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",$.getGui())}createDefaultTitleBar(){let $=this.createManagedBean(new QA(this.params));return this.eTitleBar=$,$.refreshOnExpand(this.expanded),this.addManagedListeners($,{expandedChanged:(z)=>this.toggleGroupExpand(z.expanded)}),$}createToggleTitleBar(){let $=this.createManagedBean(new y4({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:(z)=>{this.setEnabled(z,!0),this.dispatchEnableChangeEvent(z)}}));return $.addCss("ag-group-title-bar"),$.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=$,this.toggleGroupExpand(this.enabled),$}},h4="ag-disabled-group-title-bar";function zA($){let z=$.cssIdentifier??"default";return{tag:"div",cls:`ag-group-title-bar ag-${z}-group-title-bar ag-unselectable`,role:$.suppressKeyboardNavigation?"presentation":"group",children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${z}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${z}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${z}-group-title`}]}}var QA=class extends p0{constructor($={}){super(zA($));this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=f,this.eGroupClosedIcon=f,this.eTitle=f;let{title:z,suppressOpenCloseIcons:Q,suppressKeyboardNavigation:J}=$;if(!!z&&z.length>0)this.title=z;if(Q!=null)this.suppressOpenCloseIcons=Q;this.suppressKeyboardNavigation=J??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){let $=this.beans.iconSvc;this.eGroupClosedIcon.appendChild($.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild($.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:(z)=>{switch(z.key){case A.ENTER:case A.SPACE:z.preventDefault(),this.dispatchExpandChanged();break;case A.RIGHT:case A.LEFT:z.preventDefault(),this.dispatchExpandChanged(z.key===A.RIGHT);break}}})}refreshOnExpand($){this.refreshAriaStatus($),this.refreshOpenCloseIcons($)}refreshAriaStatus($){if(!this.suppressOpenCloseIcons)w0(this.getGui(),$)}refreshOpenCloseIcons($){let z=!this.suppressOpenCloseIcons;N(this.eGroupOpenedIcon,z&&$),N(this.eGroupClosedIcon,z&&!$)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged($){let z={type:"expandedChanged",expanded:$};this.dispatchLocalEvent(z)}setTitle($){let z=this.getGui(),Q=!!$&&$.length>0;if($=Q?$:void 0,this.eTitle.textContent=$??"",N(z,Q),$!==this.title)this.title=$;let J=z.classList.contains(h4);return this.refreshDisabledStyles(J),this}addWidget($){return this.getGui().appendChild($),this}hideOpenCloseIcons($){if(this.suppressOpenCloseIcons=$,$)this.dispatchExpandChanged(!0);return this}refreshDisabledStyles($){let z=this.getGui();if($)z.classList.add(h4),z.removeAttribute("tabindex"),_0(z,"presentation");else if(z.classList.remove(h4),typeof this.title==="string"&&!this.suppressKeyboardNavigation)this.activateTabIndex([z]),_0(z,"group");else z.removeAttribute("tabindex"),_0(z,"presentation")}};var Q0="35.2.0",I0={moduleName:"EnterpriseCore",version:Q0,beans:[R9],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:R9.setLicenseKey};var JA={stopPropagationCallbacks:Uz,focusNextContainer:($,z)=>{return Z$($,z)},configureFocusableContainer:($,z)=>{let Q=$.ctrlsSvc.get("gridCtrl");Q.addFocusableContainer(z),z.addDestroyFunc(()=>Q.removeFocusableContainer(z))}},ZA=class extends tV{constructor($){super($,JA)}getFocusableContainerName(){return"dialog"}};var SX=class extends mV{constructor($){super(Uz,$)}};var XA=class extends pV{};function YA($){return $.sideBar?.comp.isDisplayed()??!1}function qA($,z){$.sideBar?.comp.setDisplayed(z)}function GA($,z){$.sideBar?.comp.setSideBarPosition(z)}function _A($,z,Q){$.sideBar?.comp.openToolPanel(z,"api",Q)}function HA($){$.sideBar?.comp.close("api")}function UA($){return $.sideBar?.comp.openedItem()??null}function WA($){$.sideBar?.comp.refresh()}function BA($){return $.sideBar?.comp.isToolPanelShowing()??!1}function EA($,z){let Q=$.sideBar?.comp.getToolPanelInstance(z);return m$(Q)}function KA($){return $.sideBar?.comp.getDef()}var LA=`.ag-tool-panel-wrapper{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-horizontal-size,var(--ag-side-bar-panel-width))}.ag-tool-panel-content{display:flex;height:100%;overflow:hidden auto}.ag-tool-panel-wrapper.ag-tool-panel-animating{ + /* !important required to override .ag-hidden to tool panel remains visible while animating */display:block!important;transition:width var(--ag-side-bar-panel-animation-duration) ease-in-out}@media (prefers-reduced-motion:reduce){.ag-tool-panel-wrapper.ag-tool-panel-animating{transition:none}}.ag-tool-panel-external{display:flex;flex-direction:row}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);padding-top:var(--ag-side-button-bar-top-padding);position:relative}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative}.ag-side-button:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}:where(.ag-ltr) .ag-side-button:before{left:0}:where(.ag-rtl) .ag-side-button:before{right:0}.ag-side-button:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}.ag-side-button.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color)}.ag-side-button.ag-selected:before{background-color:var(--ag-side-button-selected-underline-color)}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}`,DA={tag:"div",cls:"ag-side-button",role:"presentation",children:[{tag:"button",ref:"eToggleButton",cls:"ag-button ag-side-button-button",role:"tab",attrs:{type:"button",tabindex:"-1","aria-expanded":"false"},children:[{tag:"div",ref:"eIconWrapper",cls:"ag-side-button-icon-wrapper",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-side-button-label"}]}]},FA=class extends x{constructor($){super();this.toolPanelDef=$,this.eToggleButton=f,this.eIconWrapper=f,this.eLabel=f}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(DA,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){let $=this.toolPanelDef,z=this.getLocaleTextFunc()($.labelKey,$.labelDefault);this.eLabel.textContent=z}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",h(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected($){this.toggleCss("ag-selected",$),w0(this.eToggleButton,$)}},MA={tag:"div",cls:"ag-side-buttons",role:"tablist"},kA=class extends x{constructor(){super(MA);this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown($){if($.key!==A.TAB||!$.shiftKey)return;if(Z$(this.beans,!0)){$.preventDefault();return}i0($)}setActiveButton($){for(let z of this.buttonComps)z.setSelected($===z.getToolPanelId())}addButtonComp($){let z=this.createBean(new FA($));return this.buttonComps.push(z),this.appendChild(z),z.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:$.id})}),z}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),z0(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},VA={selector:"AG-SIDE-BAR-BUTTONS",component:kA},RX={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},jX={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},AA={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},j1={columns:RX,filters:jX,"filters-new":AA};function a4($){if(!$)return;if($===!0)return{toolPanels:[RX,jX],defaultToolPanel:"columns"};if(typeof $==="string")return a4([$]);if(Array.isArray($)){let z=[];for(let Q of $){let J=j1[Q];if(!J){j(215,{key:Q,defaultByKey:j1});continue}z.push(J)}if(z.length===0)return;return{toolPanels:z,defaultToolPanel:z[0].id}}return{toolPanels:SA($.toolPanels),defaultToolPanel:$.defaultToolPanel,hiddenByDefault:$.hiddenByDefault,position:$.position,hideButtons:$.hideButtons}}function SA($){let z=[];if(!$)return z;return $.forEach((Q)=>{let J=RA(Q);if(!J)return;z.push(J)}),z}function RA($){if(typeof $!=="string")return $;if(j1[$])return j1[$];return j(215,{key:$,defaultByKey:j1}),null}var jA=class extends x{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"});this.minWidth=100,this.maxWidth=null}postConstruct(){let $=this.beans.horizontalResizeSvc.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc($),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent($,z,Q){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:Q,started:$,ended:z})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd($){return this.onResizing($,!0)}onResizing($,z=!1){let Q=this.inverted?-1:1,J=Math.max(this.minWidth,Math.floor(this.startingWidth-$*Q));if(this.maxWidth!=null)J=Math.min(this.maxWidth,J);this.elementToResize.style.setProperty("--ag-horizontal-size",`${J}px`),this.dispatchResizeEvent(!1,z,J)}};function fA($,z,Q){return $.getCompDetails(z,OA,void 0,Q,!0)}var OA={name:"toolPanel",optionalMethods:["refresh","getState"]},PA={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},TA=class extends x{constructor(){super(PA);this.eContent=f,this.animationId=0,this.defParent=null}postConstruct(){let $=this.getGui(),z=this.resizeBar=this.createManagedBean(new jA);$.setAttribute("id",`ag-${this.getCompId()}`),z.elementToResize=$,this.appendChild(z)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent($){this.defParent=$}setToolPanelDef($,z){let{id:Q,minWidth:J,maxWidth:Z,width:X,parent:Y}=$;if(this.toolPanelId=Q,this.defParent=Y??null,X)this.getGui().style.setProperty("--ag-side-bar-panel-width",`${X}px`);let q=fA(this.beans.userCompFactory,$,z);if(q==null)return!1;let G=q.newAgStackInstance();this.params=q.params,G.then(this.setToolPanelComponent.bind(this));let _=this.resizeBar;if(J!=null)_.minWidth=J;if(Z!=null)_.maxWidth=Z;return!0}setToolPanelComponent($){this.toolPanelCompInstance=$;let{eContent:z}=this;z.appendChild($.getGui()),this.addDestroyFunc(()=>{this.destroyBean($)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide($){let z=this.gos.get("enableRtl"),Q=$==="left",J=z?Q:!Q;this.resizeBar.inverted=J}refresh(){this.toolPanelCompInstance?.refresh(this.params)}animateDisplayed($){if(this.isDisplayed()===$)return;let z=++this.animationId,{eContent:Q}=this,J=()=>{if(this.animationId===z)Z.classList.remove("ag-tool-panel-animating"),Q.style.width="",Z.style.width=""},Z=this.getGui(),X=Z.offsetWidth;this.setDisplayed($),Z.classList.add("ag-tool-panel-animating");let Y=getComputedStyle(Z).transitionDuration;if(!parseFloat(Y)){J();return}Z.style.transition="none",Z.style.width="",Q.style.width=`${Q.offsetWidth}px`,Z.style.width=`${X}px`;let q=Z.offsetWidth;Z.style.transition="",Z.style.width=$?"":"0";let G=setTimeout(J,100);Z.addEventListener("transitionstart",()=>clearTimeout(G),{once:!0}),Z.addEventListener("transitionend",J,{once:!0})}},vA={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},IA=class extends x{constructor(){super(vA,[VA]);this.sideBarButtons=f,this.toolPanelWrappers=[],this.registerCSS(LA)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));let{beans:$,gos:z}=this,{sideBar:Q}=z.get("initialState")??{};this.setSideBarDef({sideBarDef:a4(z.get("sideBar")),sideBarState:Q}),this.addManagedPropertyListener("sideBar",()=>this.setState()),$.sideBar.comp=this;let J=this.getFocusableElement();this.createManagedBean(new c$(J,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),Bz($,this,J),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown($){if($.defaultPrevented)return;let{beans:z,sideBarButtons:Q}=this,J=this.getGui(),Z=Q.getGui(),X=d(z),Y=J.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),q=$.target,G=$.shiftKey;if(!Y){if(Z$(z,G,!0))return $.preventDefault(),!0;return h7($),!1}if(Z.contains(X)){if(F0(Y,G))$.preventDefault();return}if(!G)return;let _=null;if(Y.contains(X))_=j0(z,Y,void 0,!0);else if(AX(Y,q))_=l4(Y,q);if(!_)_=Z.querySelector(".ag-selected button"),_=A0(_)?_:null;if(_&&_!==$.target)$.preventDefault(),_.focus()}handleKeyDown($){let z=d(this.beans),Q=this.sideBarButtons;if(!Q.getGui().contains(z))return;let J=Q.getGui(),Z=Array.prototype.slice.call(J.querySelectorAll(".ag-side-button")),X=Z.findIndex((G)=>G.contains(z)),Y=null;switch($.key){case A.LEFT:case A.UP:Y=Math.max(0,X-1);break;case A.RIGHT:case A.DOWN:Y=Math.min(X+1,Z.length-1);break}if(Y===null)return;let q=Z[Y].querySelector("button");if(q)q.focus(),$.preventDefault()}onToolPanelButtonClicked($){let z=$.toolPanelId;if(this.openedItem()===z)this.openToolPanel(void 0,"sideBarButtonClicked");else this.openToolPanel(z,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:$,sideBarState:z,existingToolPanelWrappers:Q}){if(this.setDisplayed(!1),this.sideBar=$,$)this.sideBarButtons.setDisplayed(!$.hideButtons);if($?.toolPanels){let J=$.toolPanels;if(this.createToolPanelsAndSideButtons(J,z,Q),!this.toolPanelWrappers.length)return;let Z=z?z.visible:!$.hiddenByDefault;if(this.setDisplayed(Z),this.setSideBarPosition(z?z.position:$.position),Z)if(z){let{openToolPanel:X}=z;if(X)this.openToolPanel(X,"sideBarInitializing")}else this.openToolPanel($.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition($){if(!$)$="right";this.position=$;let z=$==="left",Q=z?"right":"left";this.toggleCss("ag-side-bar-left",z),this.toggleCss("ag-side-bar-right",!z);for(let J of this.toolPanelWrappers)J.setResizerSizerSide(Q);return this.dispatchSideBarUpdated(),this}setDisplayed($,z){super.setDisplayed($,z),this.dispatchSideBarUpdated()}getState(){let $={};for(let z of this.toolPanelWrappers)$[z.getToolPanelId()]=z.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:$}}createToolPanelsAndSideButtons($,z,Q){for(let J of $)this.createToolPanelAndSideButton(J,z?.toolPanels?.[J.id],Q?.[J.id])}validateDef($){let{id:z,toolPanel:Q}=$;if(z==null)return j(212),!1;if(y9(Q)){if(this.beans.filterManager?.isAdvFilterEnabled())return j(213),!1}return!0}createToolPanelAndSideButton($,z,Q){if(!this.validateDef($)){this.destroyBean(Q);return}let J;if(Q)J=Q,J.setDefParent($.parent??null);else if(J=this.createBean(new TA),!J.setToolPanelDef($,y(this.gos,{initialState:z,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;J.setDisplayed(!1),this.renderToolPanelUnderParent(J,$.parent),this.toolPanelWrappers.push(J);let Z=this.sideBarButtons.addButtonComp($);O6(Z.eToggleButton,J.getGui())}refresh(){for(let $ of this.toolPanelWrappers)$.refresh()}renderToolPanelUnderParent($,z){let Q=$.getGui();if(z)this.beans.environment.applyThemeClasses(z,["ag-external","ag-tool-panel-external"]),Q.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let J=z??$.getDefParent()??this.getGui();if(Q.parentElement!==J)J.appendChild(Q)}getWrapper($){return this.toolPanelWrappers.find((z)=>z.getToolPanelId()===$)}openToolPanel($,z="api",Q){let J=this.openedItem(),X=!!$&&!!J||z==="sideBarInitializing";for(let G of this.toolPanelWrappers){let _=$===G.getToolPanelId();if(_)this.renderToolPanelUnderParent(G,Q??null);if(X)G.setDisplayed(_);else G.animateDisplayed(_)}let Y=this.openedItem();if(J!==Y)this.sideBarButtons.setActiveButton($),this.raiseToolPanelVisibleEvent($,J??void 0,z)}getToolPanelInstance($){let z=this.getWrapper($);if(!z){j(214,{key:$});return}return z.getToolPanelInstance()}raiseToolPanelVisibleEvent($,z,Q){let J=!!$&&!!z,Z=this.eventSvc;if(z)Z.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:z,visible:!1,switchingToolPanel:J});if($)Z.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:$,visible:!0,switchingToolPanel:J})}close($="api"){this.openToolPanel(void 0,$)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let $=null;for(let z of this.toolPanelWrappers)if(z.isDisplayed())$=z.getToolPanelId();return $}setState($){let z=a4(this.gos.get("sideBar")),Q={};if(z&&this.sideBar)z.toolPanels?.forEach((J)=>{let{id:Z}=J;if(!Z)return;let X=this.sideBar.toolPanels?.find((_)=>_.id===Z);if(!X||J.toolPanel!==X.toolPanel)return;let Y=this.getWrapper(Z);if(!Y)return;let q=y(this.gos,{...J.toolPanelParams??{},initialState:$?.toolPanels?.[Z],onStateUpdated:()=>this.dispatchSideBarUpdated()});if(Y.getToolPanelInstance()?.refresh(q)!==!0)return;this.toolPanelWrappers=this.toolPanelWrappers.filter((_)=>_!==Y),T0(Y.getGui()),Q[Z]=Y});this.clearDownUi(),this.setSideBarDef({sideBarDef:z,sideBarState:$,existingToolPanelWrappers:Q})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(let $ of this.toolPanelWrappers)T0($.getGui()),this.destroyBean($);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){if(this.sideBar?.toolPanels?.some((z)=>y9(typeof z==="string"?z:z.toolPanel)))this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function y9($){return $==="agFiltersToolPanel"||$==="agNewFiltersToolPanel"}var CA={selector:"AG-SIDE-BAR",component:IA},bA=class extends S{constructor(){super(...arguments);this.beanName="sideBar"}getSelector(){return CA}},z5={moduleName:"SideBar",version:Q0,beans:[bA],apiFunctions:{isSideBarVisible:YA,setSideBarVisible:qA,setSideBarPosition:GA,openToolPanel:_A,closeToolPanel:HA,getOpenedToolPanel:UA,refreshToolPanel:WA,isToolPanelShowing:BA,getToolPanelInstance:EA,getSideBar:KA},dependsOn:[I0,U4]},yA='.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}',fX=class extends rV{constructor(){super({warnNoIcon:()=>j(227)})}},Q5={moduleName:"MenuItem",version:Q0,userComponents:{agMenuItem:fX},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[yA]},xA=".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{flex:none;height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding)}.ag-column-select-column,.ag-column-select-column-group,.ag-column-select-header{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);position:relative}.ag-column-select-column,.ag-column-select-column-group{height:100%}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-column-group:where(:not(:last-child)),.ag-column-select-column:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}",wA=300,NA={tag:"div",cls:"ag-column-select-header",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-column-select-header-icon"},{tag:"ag-checkbox",ref:"eSelect",cls:"ag-column-select-header-checkbox"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-column-select-header-filter-wrapper"}]},gA=class extends x{constructor(){super(NA,[y$,f4]);this.eExpand=f,this.eSelect=f,this.eFilterTextField=f}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:(z)=>{if(z.key===A.SPACE)z.preventDefault(),this.onExpandClicked()}}),this.addManagedElementListeners(this.eSelect.getInputElement(),{click:this.onSelectClicked.bind(this)}),this.addManagedPropertyListener("functionsReadOnly",()=>this.onFunctionsReadOnlyPropChanged()),this.eFilterTextField.setAutoComplete(!1).onValueChange(()=>this.onFilterTextChanged()),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)});let $=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel($("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel($("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){let $=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly($),this.eSelect.toggleCss("ag-column-select-column-readonly",$)}init($){this.params=$;let z=this.gos.get("functionsReadOnly");if(this.eSelect.setReadOnly(z),this.eSelect.toggleCss("ag-column-select-column-readonly",z),this.beans.colModel.ready)this.showOrHideOptions()}createExpandIcons(){let $=this.beans;this.eExpand.appendChild(this.eExpandChecked=h("columnSelectOpen",$)),this.eExpand.appendChild(this.eExpandUnchecked=h("columnSelectClosed",$)),this.eExpand.appendChild(this.eExpandIndeterminate=h("columnSelectIndeterminate",$)),this.setExpandState(0)}showOrHideOptions(){let $=this.params,z=!$.suppressColumnFilter,Q=!$.suppressColumnSelectAll,J=!$.suppressColumnExpandAll,Z=!!this.beans.colModel.colDefCols?.treeDepth,X=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(X("searchOoo","Search...")),N(this.eFilterTextField.getGui(),z),N(this.eSelect.getGui(),Q),N(this.eExpand,J&&Z)}onFilterTextChanged(){if(!this.onFilterTextChangedDebounced)this.onFilterTextChangedDebounced=g$(this,()=>{let $=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:$})},wA);this.onFilterTextChangedDebounced()}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState($){this.expandState=$,N(this.eExpandChecked,$===0),N(this.eExpandUnchecked,$===1),N(this.eExpandIndeterminate,$===2)}setSelectionState($){this.selectState=$,this.eSelect.setValue(this.selectState)}},hA={selector:"AG-PRIMARY-COLS-HEADER",component:gA};function PQ($){return!!$&&typeof $.children<"u"}function Dz($){return PQ($)?$.groupId:$.colId}function OX($,z,Q){let J=(Y,q)=>{let _=Y.children.map(Dz).includes(Dz(q)),H=b(Y.children),U=H&&Dz(H)!==Dz(q);return _&&U};if(!PQ($))return!0;let Z=$,X=Q;if(J(Z,X))return Z.children.push(X),!0;if(Z.groupId===z){if(!Z.children.map(Dz).includes(Dz(X)))return Z.children.push(X),!0}for(let Y=Z.children.length-1;Y>=0;Y--)if(OX(Z.children[Y],z,Q))break;return!1}function PX($){let z=(Z,X)=>{return PQ(Z)&&PQ(X)&&Dz(Z)===Dz(X)},Q=(Z,X)=>{if(!PQ(X))return Z;let Y=Z,q=X;if(q.children&&q.groupId){if(OX(Y,q.groupId,q.children[0]))return Y}for(let G of q.children)Q(Y,G);return Y},J=[];for(let Z=1;Z<=$.length;Z++){let X=$[Z-1],Y=$[Z];if(z(X,Y))$[Z]=Q(X,Y);else J.push(X)}return J}function uA($,z){let Q=[],J=(X,Y)=>{if(PQ(X)){let q=X,G=typeof q.groupId<"u"?q.groupId:q.headerName,_=new Cz(q,G,!1,Y),H=[];for(let U of q.children){let W=J(U,Y+1);if(W)H.push(W)}return _.setChildren(H),_}else{let q=X,G=q.colId?q.colId:q.field,_=$.getColDefCol(G);if(!_)Q.push(q);return _}},Z=[];for(let X of z){let Y=J(X,0);if(Y)Z.push(Y)}if(Q.length>0)j(217,{invalidColIds:Q});return Z}function mA($,z){let Q=TX(pA($)),J=PX(Q);z(J)}function cA($,z){let Q=TX($),J=PX(Q);z(J)}function TX($){let z=(Q,J)=>{let Z;if(q0(Q))if(Q.isPadding())Z=J;else{let Y=Object.assign({},Q.getColGroupDef());Y.groupId=Q.getGroupId(),Y.children=[J],Z=Y}else{let Y=Object.assign({},Q.getColDef());Y.colId=Q.getColId(),Z=Y}let X=Q.getOriginalParent();if(X)return z(X,Z);else return Z};return $.map((Q)=>z(Q,Q.getColDef()))}function pA($){return $.getCols().filter((z)=>{let Q=z.getColDef();return z.isPrimary()&&!Q.showRowGroup})}var x9=class{constructor($,z,Q,J=!1,Z){if(this.displayName=$,this.depth=Q,this.group=J,this.localEventService=new K$,J)this.columnGroup=z,this._expanded=Z,this.children=[];else this.column=z}get expanded(){return!!this._expanded}set expanded($){if($===this._expanded)return;this._expanded=$,this.localEventService.dispatchEvent({type:"expandedChanged"})}addEventListener($,z){this.localEventService.addEventListener($,z)}removeEventListener($,z){this.localEventService.removeEventListener($,z)}};function i($){return!!$?.buttons?.includes("apply")}function N0($,z){if(!i(z))return;let Q=$.sideBar?.comp.openedItem();if(!Q)return;$.sideBar?.comp.getToolPanelInstance(Q)?.refreshDeferredUi()}function vX($,z,Q,J,Z){let X=iA(z);IX($,X,Q,J,Z)}function IX($,z,Q,J,Z){if($.columnStateUpdateStrategy.getPivotMode(i(Z)))dA($,z,Q,J,Z);else nA($,z,Q,J,Z)}function iA($){let z=[],Q=(J)=>{for(let Z of J){if(!Z.passesFilter)continue;if(Z.group)Q(Z.children);else z.push(Z.column)}};return Q($),z}function nA($,z,Q,J,Z){let X=$.columnStateUpdateStrategy,Y=[];for(let q of z){if(q.getColDef().lockVisible)continue;if(X.isColumnVisibleInToolPanel(i(Z),q)!==Q)Y.push({colId:q.getId(),hide:!Q})}X.applyColumnState(i(Z),Y,J),N0($,Z)}function dA($,z,Q,J,Z){tA($,z,Q,J,Z)}function tA($,z,Q,J,Z){let X=$.columnStateUpdateStrategy,Y=[],_=Q?(H)=>{if(X.isColumnSelectedInPivotModeToolPanel(i(Z),H))return;if(H.isAllowValue()){let U=typeof H.getAggFunc()==="string"?H.getAggFunc():$.aggFuncSvc?.getDefaultAggFunc(H);Y.push({colId:H.getId(),aggFunc:U})}else if(H.isAllowRowGroup())Y.push({colId:H.getId(),rowGroup:!0});else if(H.isAllowPivot())Y.push({colId:H.getId(),pivot:!0})}:(H)=>{if(X.isColumnSelectedInPivotModeToolPanel(i(Z),H))Y.push({colId:H.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};z.forEach(_),X.applyColumnState(i(Z),Y,J),N0($,Z)}function CX($,z){let{columns:Q,visibleState:J,pivotState:Z,eventType:X}=z,Y=$.columnStateUpdateStrategy,q=Y.getPivotMode(i(z)),G=Q.map((_)=>{let H=_.getColId();if(q){let U=Z?.[H];return{colId:H,pivot:U?.pivot,rowGroup:U?.rowGroup,aggFunc:U?.aggFunc}}else return{colId:H,hide:!J?.[H]}});Y.applyColumnState(i(z),G,X),N0($,z)}function sA($){return{pivot:$.isPivotActive(),rowGroup:$.isRowGroupActive(),aggFunc:$.isValueActive()?$.getAggFunc():void 0}}function bX($,z,Q){if(!Q)return sA($);let J=z.getRowGroupColumns(Q).includes($),Z=z.getPivotColumns(Q).includes($),X=z.getValueColumns(Q).includes($);return{pivot:Z,rowGroup:J,aggFunc:X?z.getColumnAggFunc(Q,$):void 0}}var yX=($,z)=>{if(!z)return[];let Q=$;for(let J=0,Z=z.length;J{let J=$.aggData;if(J===z)return;if($.aggData=z,$.__localEventService)rA($,J,z,Q)},w9=($,z,Q)=>{OQ($,z,Q);let J=$.pinnedSibling;if(J)OQ(J,z,Q);let Z=$.sibling;if(Z){OQ(Z,z,Q);let X=Z.pinnedSibling;if(X)OQ(X,z,Q)}},rA=($,z,Q,J)=>{if(!Q){if(!z)return;let Y=Object.keys(z);for(let q=0,G=Y.length;q{if(!$)return;let J=$.group;if(J===Q)return;if($.group=Q,$.updateHasChildren(),J&&!Q)OQ($,null,z.colModel),$.setAllChildrenCount(null);z.selectionSvc?.updateRowSelectable($),$.dispatchRowEvent("groupChanged")},xX=($,z,Q)=>{N9($,z,Q),N9($.pinnedSibling,z,Q)},P1=($,z)=>{let{gos:Q,rowGroupColsSvc:J}=z;if(!J||!$)return!1;let Z=Q.get("groupLockGroupColumns");if(!$.isRowGroupActive()||Z===0)return!1;if(Z===-1)return!0;let X=J.columns.findIndex((Y)=>Y.getColId()===$.getColId());return Z>X},f1=($,z,Q)=>{let Z=$(z,`${z==="groupBy"?"Group by":"Un-Group by"} ${Q}`,[Q]);if(Z.indexOf(Q)>=0)return Z;else return`${Z} ${Q}`};function lA($){let z=r0($),Q="getSelection"in z?z.getSelection():null,J=[];for(let Z=0;Z<(Q?.rangeCount??0);Z++){let X=Q?.getRangeAt(Z);if(X)J.push(X)}return{selection:Q,ranges:J}}function aA($,z){if(!$.gos.get("enableCellTextSelection"))return z();if(!bJ()&&!cz())return z();let{selection:J,ranges:Z}=lA($);z(),J?.removeAllRanges();for(let X of Z)J?.addRange(X)}var oA={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},wX={getMenuItemComp:($,z,Q)=>{return $.userCompFactory.getCompDetails(z,oA,"agMenuItem",y($.gos,Q),!0)?.newAgStackInstance()??g.resolve()},getPostProcessPopupParams:({column:$,node:z})=>({column:$,rowNode:z}),preserveRangesWhile:aA,stopPropagationCallbacks:Uz,warnNoItem:($)=>{j(228,{menuItemOrString:$})}},eA=class extends r4{constructor(){super(wX)}},NX=class extends VX{constructor($,z={column:null,node:null,value:null}){super($,z,wX)}},gX=class extends x{constructor($,z,Q,J={}){super({tag:"div",cls:"ag-menu"});this.column=$,this.mouseEventOrTouch=z,this.parentEl=Q,this.params=J,this.displayName=null}postConstruct(){let{column:$,beans:{colNames:z}}=this;this.initializeProperties($);let Q;if(Q$($))Q=z.getDisplayNameForColumn($,"columnToolPanel");else Q=z.getDisplayNameForProvidedColumnGroup(null,$,"columnToolPanel");if(this.displayName=Q,this.buildMenuItemMap(),this.isActive()){let J=this.mouseEventOrTouch;if("preventDefault"in J)J.preventDefault();let Z=this.getMappedMenuItems();if(Z.length===0)return;this.displayContextMenu(Z)}}initializeProperties($){let z=this.beans.columnStateUpdateStrategy,Q;if(q0($))Q=$.getLeafColumns();else Q=[$];this.columns=Q;let J=z.getPivotMode(i(this.params));this.allowScrollIntoView=!J&&Q.some(this.isColumnValidForScrollIntoView),this.allowGrouping=Q.some((Z)=>Z.isPrimary()&&Z.isAllowRowGroup()),this.allowValues=Q.some((Z)=>Z.isPrimary()&&Z.isAllowValue()),this.allowPivoting=J&&Q.some((Z)=>Z.isPrimary()&&Z.isAllowPivot())}buildMenuItemMap(){let $=this.getLocaleTextFunc(),{beans:z,displayName:Q}=this,J=this.beans.columnStateUpdateStrategy,Z=new Map;this.menuItemMap=Z;let X=i(this.params),Y=J.getPivotMode(X),q=new Set(J.getRowGroupColumns(X).map((B)=>B.getColId())),G=new Set(J.getValueColumns(X).map((B)=>B.getColId())),_=new Set(J.getPivotColumns(X).map((B)=>B.getColId()));Z.set("scrollIntoView",{allowedFunction:(B)=>!B.isPinned()&&!Y&&this.isColumnValidForScrollIntoView(B),activeFunction:()=>!1,activateLabel:()=>$("scrollColumnIntoView",`Scroll ${Q} into View`,[Q]),activateFunction:()=>{let B=this.columns.find(this.isColumnValidForScrollIntoView);if(B)this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(B)},deActivateFunction:()=>{},addIcon:"ensureColumnVisible"});let H=(B)=>B.isPrimary()&&B.isAllowRowGroup()&&!P1(B,z);Z.set("rowGroup",{allowedFunction:H,activeFunction:(B)=>q.has(B.getColId()),activateLabel:()=>f1($,"groupBy",Q),deactivateLabel:()=>f1($,"ungroupBy",Q),activateFunction:()=>{let B=this.addColumnsToList(J.getRowGroupColumns(X),H);J.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getRowGroupColumns(X),H);J.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup"});let U=(B)=>B.isPrimary()&&B.isAllowValue();Z.set("value",{allowedFunction:U,activeFunction:(B)=>G.has(B.getColId()),activateLabel:()=>$("addToValues",`Add ${Q} to values`,[Q]),deactivateLabel:()=>$("removeFromValues",`Remove ${Q} from values`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(J.getValueColumns(X),U);J.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getValueColumns(X),U);J.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"valuePanel",removeIcon:"valuePanel"});let W=(B)=>Y&&B.isPrimary()&&B.isAllowPivot();Z.set("pivot",{allowedFunction:W,activeFunction:(B)=>_.has(B.getColId()),activateLabel:()=>$("addToLabels",`Add ${Q} to labels`,[Q]),deactivateLabel:()=>$("removeFromLabels",`Remove ${Q} from labels`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(J.getPivotColumns(X),W);J.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getPivotColumns(X),W);J.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"pivotPanel",removeIcon:"pivotPanel"})}isColumnValidForScrollIntoView($){if(!$.isVisible())return!1;let Q=$.getParent();if(!Q)return!0;return Q.getDisplayedChildren()?.includes($)??!0}addColumnsToList($,z){return[...$].concat(this.columns.filter((Q)=>z(Q)&&!$.includes(Q)))}removeColumnsFromList($,z){return $.filter((Q)=>!z(Q)||!this.columns.includes(Q))}displayContextMenu($){let z=this.getGui(),Q=this.createBean(new NX),J=this.getLocaleTextFunc(),Z=()=>{};z.appendChild(Q.getGui()),Q.addMenuItems($),Q.addManagedListeners(Q,{closeMenu:()=>{this.parentEl.focus(),Z()}});let X=this.beans.popupSvc,Y=X.addPopup({modal:!0,eChild:z,closeOnEsc:!0,afterGuiAttached:()=>F0(Q.getGui()),ariaLabel:J("ariaLabelContextMenu","Context Menu"),closedCallback:(q)=>{if(q instanceof KeyboardEvent)this.parentEl.focus();this.destroyBean(Q)}});if(Y)Z=Y.hideFunc;X.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:z})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting}getMappedMenuItems(){let $=[],{menuItemMap:z,columns:Q,displayName:J,beans:Z}=this;for(let X of z.values()){let Y=Q.some((G)=>X.allowedFunction(G)&&!X.activeFunction(G)),q=Q.some((G)=>X.allowedFunction(G)&&X.activeFunction(G));if(Y)$.push({name:X.activateLabel(J),icon:h(X.addIcon,Z,null),action:()=>X.activateFunction()});if(q&&X.removeIcon&&X.deactivateLabel)$.push({name:X.deactivateLabel(J),icon:h(X.removeIcon,Z,null),action:()=>X.deActivateFunction?.()})}return $}},$S={tag:"div",cls:"ag-column-select-column-group",children:[{tag:"span",ref:"eColumnGroupIcons",cls:"ag-column-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-column-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-column-group-opened-icon"}]},{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},hX=class extends x{constructor($,z,Q,J,Z){super();this.modelItem=$,this.allowDragging=z,this.eventType=Q,this.focusWrapper=J,this.params=Z,this.cbSelect=f,this.eLabel=f,this.eGroupOpenedIcon=f,this.eGroupClosedIcon=f,this.eColumnGroupIcons=f,this.processingColumnStateChange=!1;let{columnGroup:X,depth:Y,displayName:q}=$;this.columnGroup=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate($S,[y$]);let{beans:$,cbSelect:z,eLabel:Q,displayName:J,columnDepth:Z,modelItem:X,focusWrapper:Y,columnGroup:q}=this,{registry:G,gos:_}=$,H=h("columnDrag",$);this.eDragHandle=H,H.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");let U=z.getGui(),W=z.getInputElement();U.after(H),W.setAttribute("tabindex","-1"),Q.textContent=J??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+Z),this.getGui().style.setProperty("--ag-indentation-level",String(Z)),this.tooltipFeature=this.createOptionalManagedBean(G.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumnGroup",shouldDisplayTooltip:tJ(_,()=>Q)})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(Q,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(z,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(X,{expandedChanged:this.onExpandChanged.bind(this)});let B=new h0(this.getGui(),!1);this.addManagedListeners(B,{longTap:(K)=>this.onContextMenu(K.touchStart)}),this.addDestroyFunc(B.destroy.bind(B)),this.addManagedListeners(Y,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)}),this.setOpenClosedIcons(),this.setupDragging(),this.onColumnStateChanged(),this.addVisibilityListenersToAllChildren(),this.refreshAriaExpanded(),this.refreshAriaLabel(),this.setupTooltip();let E=gJ(q.getColGroupDef(),_,null,q);for(let K of E)this.toggleCss(K,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){let $=this.columnGroup.getColGroupDef();if(!$)return;let z=()=>this.tooltipFeature?.setTooltipAndRefresh($.headerTooltip);z(),this.addManagedEventListeners({newColumnsLoaded:z})}handleKeyDown($){switch($.key){case A.LEFT:$.preventDefault(),this.modelItem.expanded=!1;break;case A.RIGHT:$.preventDefault(),this.modelItem.expanded=!0;break;case A.SPACE:if($.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected());break}}onContextMenu($){let{columnGroup:z,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let J=this.createBean(new gX(z,$,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(J.isAlive())this.destroyBean(J)})}addVisibilityListenersToAllChildren(){let $=this.onColumnStateChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())this.addManagedListeners(z,{visibleChanged:$,columnValueChanged:$,columnPivotChanged:$,columnRowGroupChanged:$})}setupDragging(){if(!this.allowDragging){N(this.eDragHandle,!1);return}let $=this.beans,{gos:z,eventSvc:Q,dragAndDrop:J}=$,Z=!z.get("suppressDragLeaveHidesColumns"),X={type:G$.ToolPanel,eElement:this.eDragHandle,dragItemName:this.displayName,getDefaultIconName:()=>Z?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{Z=!z.get("suppressDragLeaveHidesColumns"),Q.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{Q.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(Y)=>{if(Z)CX($,{columns:this.columnGroup.getLeafColumns(),visibleState:Y?.visibleState,pivotState:Y?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{if(Z)this.onChangeCommon(!1)}};J.addDragSource(X,!0),this.addDestroyFunc(()=>J.removeDragSource(X))}createDragItem(){let $=this.columnGroup.getLeafColumns(),z={},Q={},J=this.beans.columnStateUpdateStrategy,Z=i(this.params);for(let X of $){let Y=X.getId();z[Y]=X.isVisible(),Q[Y]=bX(X,J,Z)}return{columns:$,visibleState:z,pivotState:Q}}setupExpandContract(){let{beans:$,eGroupClosedIcon:z,eGroupOpenedIcon:Q,eColumnGroupIcons:J}=this;z.appendChild(hJ("columnSelectClosed",$,null)),Q.appendChild(hJ("columnSelectOpen",$,null));let Z=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(z,{click:Z}),this.addManagedElementListeners(Q,{click:Z});let X=new h0(J,!0);this.addManagedListeners(X,{tap:Z}),this.addDestroyFunc(X.destroy.bind(X))}onLabelClicked(){let $=!this.cbSelect.getValue();this.onChangeCommon($)}onCheckboxChanged($){this.onChangeCommon($.selected)}getVisibleLeafColumns(){let $=[],z=(Q)=>{for(let J of Q)if(J.passesFilter)if(J.group)z(J.children);else $.push(J.column)};return z(this.modelItem.children),$}onChangeCommon($){if(this.refreshAriaLabel(),this.processingColumnStateChange)return;vX(this.beans,this.modelItem.children,$,this.eventType,this.params)}refreshAriaLabel(){let{cbSelect:$,focusWrapper:z,displayName:Q}=this,J=this.getLocaleTextFunc(),Z=J("ariaColumnGroup","Column Group"),X=$.getValue(),Y=X===void 0?J("ariaIndeterminate","indeterminate"):X?J("ariaVisible","visible"):J("ariaHidden","hidden"),q=J("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${Q} ${Z}`),$.setInputAriaLabel(`${q} (${Y})`),FJ(z,$.getInputElement().id)}onColumnStateChanged(){let $=this.workOutSelectedValue(),z=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;let Q=this.cbSelect;Q.setValue($),Q.setReadOnly(z),this.toggleCss("ag-column-select-column-group-readonly",z),this.processingColumnStateChange=!1}workOutSelectedValue(){let z=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),Q=this.getVisibleLeafColumns(),J=0,Z=0;for(let X of Q)if(z||!X.getColDef().lockVisible)if(this.isColumnChecked(X))J++;else Z++;if(J>0&&Z>0)return;return J>0}workOutReadOnlyValue(){let $=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),z=0;for(let Q of this.columnGroup.getLeafColumns())if($){if(Q.isAnyFunctionAllowed())z++}else if(!Q.getColDef().lockVisible)z++;return z===0}isColumnChecked($){let z=this.beans.columnStateUpdateStrategy;if(z.getPivotMode(i(this.params)))return z.isColumnSelectedInPivotModeToolPanel(i(this.params),$);return z.isColumnVisibleInToolPanel(i(this.params),$)}onExpandOrContractClicked(){let $=this.modelItem,z=$.expanded;$.expanded=!z}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){let $=this.modelItem.expanded;N(this.eGroupClosedIcon,!$),N(this.eGroupOpenedIcon,$)}refreshAriaExpanded(){w0(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged($){let z=this.cbSelect,Q=z.getValue();if(!z.isReadOnly()&&($&&!Q||!$&&Q))z.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected($){this.cbSelect.setValue($,!0)}},u4=($)=>{if(q0($))return $.getLeafColumns();return $?[$]:[]},zS=($,z,Q,J)=>{if(!z||!$)return null;let Z=J.indexOf(z),X=Q?Z:Z+1,Y=QS(J,$,X);return X-Y},QS=($,z,Q)=>{if(!z)return 0;let J=z[0],Z=z.length;if($.indexOf(J){let Z=i(J);if($.get("suppressMovableColumns")||z.columnStateUpdateStrategy.getPivotMode(Z))return!0;return!!Q.find(({colDef:q})=>!!q.suppressMovable||!!q.lockPosition)},h9=($,z,Q,J)=>{if(!Q)return;let{component:Z}=Q,X=null,Y=Q.position==="top";if(Z instanceof hX)X=Z.getColumns()[0],Y=!0;else if(Z)X=Z.column;if(!X)return;let q=i(J),G=q?$.columnStateUpdateStrategy.getPrimaryColumns(q):$.colModel.getCols(),_=zS(z,X,Y,G);if(_!=null)$.columnStateUpdateStrategy.moveColumns(q,z,_,"toolPanelUi"),N0($,J)},JS=($)=>{return $.column},ZS={tag:"div",cls:"ag-column-select-column",children:[{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},XS=class extends x{constructor($,z,Q,J,Z){super();this.modelItem=$,this.allowDragging=z,this.groupsExist=Q,this.focusWrapper=J,this.params=Z,this.eLabel=f,this.cbSelect=f,this.processingColumnStateChange=!1;let{column:X,depth:Y,displayName:q}=$;this.column=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate(ZS,[y$]);let{beans:$,cbSelect:z,displayName:Q,eLabel:J,columnDepth:Z,groupsExist:X,column:Y,gos:q,focusWrapper:G}=this,_=h("columnDrag",$);this.eDragHandle=_,_.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");let H=z.getGui(),U=z.getInputElement();if(H.after(_),U.setAttribute("tabindex","-1"),J.textContent=Q,X)this.addCss("ag-column-select-add-group-indent");this.addCss(`ag-column-select-indent-${Z}`),this.getGui().style.setProperty("--ag-indentation-level",String(Z)),this.tooltipFeature=this.createOptionalManagedBean($.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumn",shouldDisplayTooltip:tJ(q,()=>J),getAdditionalParams:()=>({colDef:Y.getColDef()})})),this.setupDragging();let W=this.onColumnStateChanged.bind(this);this.addManagedEventListeners({columnPivotModeChanged:W}),this.addManagedListeners(Y,{columnValueChanged:W,columnPivotChanged:W,columnRowGroupChanged:W,visibleChanged:W}),this.addManagedListeners(G,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});let B=new h0(G);this.addManagedListeners(B,{longTap:(K)=>this.onContextMenu(K.touchStart)}),this.addDestroyFunc(B.destroy.bind(B)),this.addManagedPropertyListener("functionsReadOnly",this.onColumnStateChanged.bind(this)),this.addManagedListeners(z,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(J,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();let E=gJ(Y.getColDef(),q,Y,null);for(let K of E)this.toggleCss(K,!0)}getColumn(){return this.column}setupTooltip(){let $=()=>this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip);$(),this.addManagedEventListeners({newColumnsLoaded:$})}onContextMenu($){let{column:z,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let J=this.createBean(new gX(z,$,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(J.isAlive())this.destroyBean(J)})}handleKeyDown($){if($.key===A.SPACE){if($.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected())}}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;let $=!this.cbSelect.getValue();this.onChangeCommon($)}onCheckboxChanged($){this.onChangeCommon($.selected)}onChangeCommon($){if(this.cbSelect.isReadOnly())return;if(this.refreshAriaLabel(),this.processingColumnStateChange)return;IX(this.beans,[this.column],$,"toolPanelUi",this.params)}refreshAriaLabel(){let{cbSelect:$,focusWrapper:z,displayName:Q}=this,J=this.getLocaleTextFunc(),Z=J("ariaColumn","Column"),X=$.getValue()?J("ariaVisible","visible"):J("ariaHidden","hidden"),Y=J("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${Q} ${Z}`),this.cbSelect.setInputAriaLabel(`${Y} (${X})`),FJ(z,$.getInputElement().id)}setupDragging(){let $=this.eDragHandle;if(!this.allowDragging){N($,!1);return}let z=this.beans,{gos:Q,eventSvc:J,dragAndDrop:Z}=z;if(i(this.params))$.setAttribute("data-column-tool-panel-deferred","");let X=!Q.get("suppressDragLeaveHidesColumns"),Y={type:G$.ToolPanel,eElement:$,dragItemName:this.displayName,getDefaultIconName:()=>X&&!i(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{X=!Q.get("suppressDragLeaveHidesColumns"),J.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{J.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(q)=>{if(X&&!i(this.params))CX(z,{columns:[this.column],visibleState:q?.visibleState,pivotState:q?.pivotState,eventType:"toolPanelUi",buttons:this.params.buttons})},onGridExit:()=>{if(X&&!i(this.params))this.onChangeCommon(!1)}};Z.addDragSource(Y,!0),this.addDestroyFunc(()=>Z.removeDragSource(Y))}createDragItem(){let $=this.column.getColId(),z={[$]:this.column.isVisible()},Q=this.beans.columnStateUpdateStrategy,J={[$]:bX(this.column,Q,i(this.params))};return{columns:[this.column],visibleState:z,pivotState:J}}onColumnStateChanged(){this.processingColumnStateChange=!0;let $=this.beans.columnStateUpdateStrategy,z=$.getPivotMode(i(this.params));if(z){let Z=$.isColumnSelectedInPivotModeToolPanel(i(this.params),this.column);this.cbSelect.setValue(Z)}else this.cbSelect.setValue($.isColumnVisibleInToolPanel(i(this.params),this.column));let Q=!0,J=!0;if(z){let Z=this.gos.get("functionsReadOnly"),X=!this.column.isAnyFunctionAllowed();Q=!Z&&!X,J=Q}else{let{enableRowGroup:Z,enableValue:X,lockPosition:Y,suppressMovable:q,lockVisible:G}=this.column.getColDef(),_=!!Z||!!X,H=!!Y||!!q;Q=!G,J=_||!H}this.cbSelect.setReadOnly(!Q),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!J),this.toggleCss("ag-column-select-column-readonly",!J&&!Q),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged($){let z=this.cbSelect;if($!==z.getValue()){if(!z.isReadOnly())z.toggle()}}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded($){j(158)}},YS=class{constructor($){this.items=$}getRowCount(){return this.items.length}getRow($){return this.items[$]}},qS="ag-column-select-list",GS=class extends x{constructor(){super({tag:"div",cls:qS,role:"presentation"});this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1}wireBeans($){this.colModel=$.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(let $ of this.destroyColumnItemFuncs)$();this.destroyColumnItemFuncs=[]}init($,z,Q){this.params=$;let{suppressSyncLayoutWithGrid:J,contractColumnSelection:Z,suppressColumnMove:X}=$;if(this.allowDragging=z,this.eventType=Q,!J)this.addManagedEventListeners({columnMoved:this.onColumnsChanged.bind(this)});this.addManagedEventListeners({newColumnsLoaded:this.onColumnsChanged.bind(this)});let Y=this.fireSelectionChangedEvent.bind(this);this.addManagedEventListeners({columnPivotChanged:Y,columnPivotModeChanged:Y,columnRowGroupChanged:Y,columnValueChanged:Y,columnVisible:Y,newColumnsLoaded:Y}),this.expandGroupsByDefault=!Z;let q=X||J,G=this.createManagedBean(new SX({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(_,H)=>{if(q)return;this.moveItems(_,H)}}));if(this.virtualList=G,this.appendChild(G.getGui()),G.setComponentCreator((_,H)=>{return A6(H,_.depth+1),this.createComponentFromItem(_,H)}),this.colModel.ready)this.onColumnsChanged();if(q)return;this.createItemDragFeature()}createItemDragFeature(){let{gos:$,beans:z,virtualList:Q}=this;this.createManagedBean(new XA(this,Q,{dragSourceType:G$.ToolPanel,addListeners:(J,Z,X)=>{J.addManagedEventListeners({columnPanelItemDragStart:Z,columnPanelItemDragEnd:X})},getCurrentDragValue:(J)=>JS(J),isMoveBlocked:(J)=>g9($,z,u4(J),this.params),getNumRows:(J)=>J.getDisplayedColsList().length,moveItem:(J,Z)=>h9(z,u4(J),Z,this.params)}))}moveItems($,z){let{gos:Q,beans:J}=this,{modelItem:Z}=$,{group:X,columnGroup:Y,column:q,expanded:G}=Z,_=u4(X?Y:q);if(g9(Q,J,_,this.params))return;let H=this.displayedColsList.indexOf(Z),U=z?-1:1,W=0;if(z){let E=$.columnDepth>0?q.getParent()?.getChildren():null;if(E?.length&&q===E[0])W=-1}else if(X)W=G?Z.children.length:0;let B=Math.min(Math.max(H+W+U,0),this.displayedColsList.length-1);this.skipRefocus=!0,h9(J,_,{rowIndex:B,position:z?"top":"bottom",component:this.virtualList.getComponentAt(B)},this.params),this.focusRowIfAlive(B-W).then(()=>{this.skipRefocus=!1})}createComponentFromItem($,z){let Q=this.allowDragging;if($.group){let Z=new hX($,Q,this.eventType,z,this.params);return this.createBean(Z),Z}let J=new XS($,Q,this.groupsExist,z,this.params);return this.createBean(J),J}onColumnsChanged(){let $=this.params;if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!$.initialState;let z=this.getExpandedStates(),Q=this.colModel.isPivotMode(),J=i($),Z=J&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(J);if((!$.suppressSyncLayoutWithGrid||J)&&!Q||Z)this.buildTreeFromWhatGridIsDisplaying();else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(z),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){let $={};if(this.isInitialState){let{expandedGroupIds:z}=this.params.initialState;for(let Q of z)$[Q]=!0;return $}if(!this.allColsTree)return{};return this.forEachItem((z)=>{if(!z.group)return;let Q=z.columnGroup;if(Q)$[Q.getId()]=z.expanded}),$}setExpandedStates($){if(!this.allColsTree)return;let{isInitialState:z}=this;this.forEachItem((Q)=>{if(!Q.group)return;let J=Q.columnGroup;if(J){let Z=$[J.getId()];if(Z!=null||z)Q.expanded=!!Z}})}buildTreeFromWhatGridIsDisplaying(){let $=i(this.params);if($&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder($)){let z=this.beans.columnStateUpdateStrategy.getPrimaryColumns($);if(z.length>0){cA(z,this.setColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}mA(this.colModel,this.setColumnLayout.bind(this))}setColumnLayout($){let z=uA(this.colModel,$);this.buildListModel(z),this.groupsExist=$.some((Q)=>{return Q&&typeof Q.children<"u"}),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){let $=this.colModel;this.buildListModel($.getColDefColTree()),this.groupsExist=!!$.colDefCols?.treeDepth}buildListModel($){let z=this.onColumnExpanded.bind(this),Q=(q)=>{q.addEventListener("expandedChanged",z);let G=q.removeEventListener.bind(q,"expandedChanged",z);this.destroyColumnItemFuncs.push(G)},J=this.beans.colNames,Z=(q,G,_)=>{for(let H of q)if(q0(H))X(H,G,_);else Y(H,G,_)},X=(q,G,_)=>{if(q.getColGroupDef()?.suppressColumnsToolPanel)return;if(q.isPadding()){Z(q.getChildren(),G,_);return}let W=J.getDisplayNameForProvidedColumnGroup(null,q,"columnToolPanel"),B=new x9(W,q,G,!0,this.expandGroupsByDefault);_.push(B),Q(B),Z(q.getChildren(),G+1,B.children)},Y=(q,G,_)=>{if(q.getColDef()?.suppressColumnsToolPanel)return;let U=J.getDisplayNameForColumn(q,"columnToolPanel");_.push(new x9(U,q,G))};this.destroyColumnTree(),Z($,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];let $=(J)=>{if(!J.passesFilter)return;if(this.displayedColsList.push(J),J.group&&J.expanded)J.children.forEach($)},z=this.virtualList;this.allColsTree.forEach($),z.setModel(new YS(this.displayedColsList));let Q=null;if(!this.skipRefocus)Q=z.getLastFocusedRow();if(z.refresh(),Q!=null)this.focusRowIfAlive(Q);this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){let $=this.getLocaleTextFunc(),z=$("ariaColumnPanelList","Column List"),Q=$("columns","Columns"),J=this.displayedColsList.length;E0(this.virtualList.getAriaElement(),`${z} ${J} ${Q}`)}focusRowIfAlive($){if($===-1)return Promise.resolve();return new Promise((z)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow($);z()},0)})}forEachItem($){let z=(J)=>{for(let Z of J)if($(Z),Z.group)z(Z.children)},Q=this.allColsTree;if(!Q)return;z(Q)}doSetExpandedAll($){this.forEachItem((z)=>{if(z.group)z.expanded=$})}setGroupsExpanded($,z){if(!z){this.doSetExpandedAll($);return}let Q=[];this.forEachItem((Z)=>{if(!Z.group)return;let X=Z.columnGroup.getId();if(z.indexOf(X)>=0)Z.expanded=$,Q.push(X)});let J=z.filter((Z)=>!Q.includes(Z));if(J.length>0)j(157,{unrecognisedGroupIds:J})}getExpandState(){let $=0,z=0;if(this.forEachItem((Q)=>{if(!Q.group)return;if(Q.expanded)$++;else z++}),$>0&&z>0)return 2;if(z>0)return 1;return 0}doSetSelectedAll($){vX(this.beans,this.allColsTree,$,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let $=0;${if(Z.group)return;if(!Z.passesFilter)return;let X=Z.column,Y=X.getColDef(),q;if(J){if(!X.isAllowPivot()&&!X.isAllowRowGroup()&&!X.isAllowValue())return;q=Q.isColumnSelectedInPivotModeToolPanel(i(this.params),X)??!1}else{if(Y.lockVisible)return;q=Q.isColumnVisibleInToolPanel(i(this.params),X)??!1}if(q)$++;else z++}),$>0&&z>0)return;return!($===0||z>0)}setFilterText($){this.filterText=T($)?$.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){let $=(Q)=>{if(!T(this.filterText))return!0;let J=Q.displayName;return J==null||J.toLowerCase().indexOf(this.filterText)!==-1},z=(Q,J)=>{let Z=!1;if(Q.group){let Y=$(Q);for(let q of Q.children){let G=z(q,Y||J);if(G)Z=G}}let X=J||Z?!0:$(Q);return Q.passesFilter=X,X};for(let Q of this.allColsTree)z(Q,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){let $=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:$})}fireSelectionChangedEvent(){if(!this.allColsTree)return;let $=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:$})}getExpandedGroups(){let $=[];if(!this.allColsTree)return $;return this.forEachItem((z)=>{if(z.group&&z.expanded)$.push(z.columnGroup.getId())}),$}},_S={selector:"AG-PRIMARY-COLS-LIST",component:GS},HS={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},uX=class extends x{constructor(){super(HS,[hA,_S]);this.primaryColsHeaderPanel=f,this.primaryColsListPanel=f,this.registerCSS(xA)}init($,z,Q){let{primaryColsHeaderPanel:J,primaryColsListPanel:Z}=this;J.init(z);let{suppressColumnFilter:X,suppressColumnSelectAll:Y}=z;if(z.suppressColumnExpandAll&&X&&Y)J.setDisplayed(!1);this.addManagedListeners(Z,{groupExpanded:(G)=>{J.setExpandState(G.state),z.onStateUpdated()},selectionChanged:(G)=>J.setSelectionState(G.state)}),Z.init(z,$,Q),this.addManagedListeners(J,{expandAll:Z.doSetExpandedAll.bind(Z,!0),collapseAll:Z.doSetExpandedAll.bind(Z,!1),selectAll:Z.doSetSelectedAll.bind(Z,!0),unselectAll:Z.doSetSelectedAll.bind(Z,!1),filterChanged:(G)=>Z.setFilterText(G.filterText)}),this.positionableFeature=this.createManagedBean(new U1(this.getGui(),{minHeight:100}))}toggleResizable($){this.positionableFeature.setResizable($?{bottom:!0}:!1)}expandGroups($){this.primaryColsListPanel.setGroupsExpanded(!0,$)}collapseGroups($){this.primaryColsListPanel.setGroupsExpanded(!1,$)}setColumnLayout($){this.primaryColsListPanel.setColumnLayout($)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},US=".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select:where(:not(.ag-last-visible-child)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px}:where(.ag-column-panel) .ag-column-drop-vertical:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-column-panel-buttons:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-column-panel-buttons-button{line-height:1.5}:where(.ag-column-panel) .ag-column-panel-buttons-apply-button:not(:disabled){background-color:var(--ag-column-panel-apply-button-background-color);color:var(--ag-column-panel-apply-button-color)}",WS="ag-column-panel-deferred",BS=class extends x{constructor(){super({tag:"div",cls:"ag-column-panel"});this.initialised=!1,this.childDestroyFuncs=[],this.isDeferModeEnabled=!1,this.isCommitting=!1,this.onDeferredApply=()=>{this.isCommitting=!0;try{this.beans.columnStateUpdateStrategy.commit(this.isDeferModeEnabled)}finally{this.isCommitting=!1}this.deferredButtonsComp?.updateValidity(!1),this.lastKnownGridState=this.captureGridState()},this.onDeferredCancel=()=>{this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy(),this.lastKnownGridState=this.captureGridState()},this.onPivotModePanelValueChanged=()=>{this.refreshToolPanelLayouts(),this.setLastVisible(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))},this.onColumnEverythingChanged=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;let $=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=$;return}let z=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,$);if(this.lastKnownGridState=$,!z)return;this.resetDeferredState()},this.onExternalGridChange=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))return;this.resetDeferredState(),this.lastKnownGridState=this.captureGridState()},this.registerCSS(US)}wireBeans($){this.colToolPanelFactory=$.colToolPanelFactory}setVisible($){if(super.setDisplayed($),$&&!this.initialised)this.init(this.params)}init($){let Q={...y(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...$};this.params=Q;let{childDestroyFuncs:J,colToolPanelFactory:Z,gos:X}=this,Y=X.isModuleRegistered("SharedPivot"),q=Y||X.isModuleRegistered("SharedRowGrouping");if(this.isDeferModeEnabled=i(Q),this.toggleCss(WS,this.isDeferModeEnabled),!Q.suppressPivotMode&&Z&&Y)this.pivotModePanel=Z.createPivotModePanel(this,J,Q,this.onPivotModePanelValueChanged);let G=this.createBean(new uX);if(this.primaryColsPanel=G,J.push(()=>this.destroyBean(this.primaryColsPanel)),G.init(!0,Q,"toolPanelUi"),G.addCss("ag-column-panel-column-select"),this.appendChild(G),Z){if(!Q.suppressRowGroups&&q)this.rowGroupDropZonePanel=Z.createRowGroupPanel(this,J,Q);if(!Q.suppressValues&&q)this.valuesDropZonePanel=Z.createValuesPanel(this,J,Q);if(!Q.suppressPivots&&Y)this.pivotDropZonePanel=Z.createPivotPanel(this,J,Q);this.setLastVisible();let[_]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});J.push(()=>_())}if(this.isDeferModeEnabled){let _=this.onExternalGridChange;J.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:_,columnVisible:_,columnRowGroupChanged:_,columnValueChanged:_,columnPivotChanged:_,columnPivotModeChanged:_,newColumnsLoaded:_,...Q.suppressSyncLayoutWithGrid?{}:{columnMoved:_}}))}if(Q.buttons){if(!Q.buttons.includes("apply"))j(298);if(Q.buttons.length)this.initDeferredButtons(Q.buttons)}this.initialised=!0}initDeferredButtons($){let z=this.createBean(new I4({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=z,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});let Q=this.getLocaleTextFunc(),J=$.map((Z)=>({type:Z,label:Q(Z==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",Z==="apply"?"Apply":"Cancel")}));z.updateButtons(J),z.updateValidity(!1),z.addManagedListeners(z,{apply:this.onDeferredApply,cancel:this.onDeferredCancel}),this.appendChild(z)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){let{beans:$}=this,z=(Q)=>(Q??[]).map((J)=>J.getColId());return{rowGroupColIds:z($.rowGroupColsSvc?.columns),valueColIds:z($.valueColsSvc?.columns),pivotColIds:z($.pivotColsSvc?.columns),pivotMode:$.colModel.isPivotMode(),columnOrder:$.colModel.getCols().map((Q)=>Q.getColId()),visibleColIds:$.colModel.getCols().filter((Q)=>Q.isVisible()).map((Q)=>Q.getColId()),sortState:$.colModel.getCols().filter((Q)=>Q.getSort()).map((Q)=>`${Q.getColId()}:${Q.getSort()}:${Q.getSortIndex()}`),aggFuncState:($.valueColsSvc?.columns??[]).map((Q)=>Q.getAggFunc()),widthState:$.colModel.getCols().map((Q)=>`${Q.getColId()}:${Q.getActualWidth()}`)}}isGridStateEqual($,z){return X0($.rowGroupColIds,z.rowGroupColIds)&&X0($.valueColIds,z.valueColIds)&&X0($.pivotColIds,z.pivotColIds)&&$.pivotMode===z.pivotMode&&X0($.columnOrder,z.columnOrder)&&X0($.visibleColIds,z.visibleColIds)&&X0($.sortState,z.sortState)&&X0($.aggFuncState,z.aggFuncState)&&X0($.widthState,z.widthState)}refreshDeferredUi(){this.refreshToolPanelLayouts(),this.setLastVisible(),this.pivotModePanel?.refreshEditStrategy(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))}refreshToolPanelLayouts(){this.primaryColsPanel.syncLayoutWithGrid(),this.rowGroupDropZonePanel?.refreshGui(),this.valuesDropZonePanel?.refreshGui(),this.pivotDropZonePanel?.refresh()}setPivotModeSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.pivotModePanel=z.setPanelVisible(this.pivotModePanel,$,z.createPivotModePanel.bind(z,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible()}setRowGroupsSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.rowGroupDropZonePanel=z.setPanelVisible(this.rowGroupDropZonePanel,$,z.createRowGroupPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setValuesSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.valuesDropZonePanel=z.setPanelVisible(this.valuesDropZonePanel,$,z.createValuesPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setPivotSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.pivotDropZonePanel=z.setPanelVisible(this.pivotDropZonePanel,$,z.createPivotPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed($),this.setLastVisible()}setResizers(){for(let $ of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!$)continue;let z=$.getGui();$.toggleResizable(!z.classList.contains("ag-last-column-drop")&&!z.classList.contains("ag-hidden")&&!z.classList.contains("ag-last-visible-child"))}}setLastVisible(){let $=this.getGui(),z=Array.prototype.slice.call($.querySelectorAll(".ag-column-drop"));for(let Z of z)Z.classList.remove("ag-last-column-drop");let Q=$.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),J=b(Q);if(J)J.classList.add("ag-last-column-drop");this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!J),this.setResizers()}resetChildrenHeight(){let z=this.getGui().children;for(let Q=0;QX.getGui().getBoundingClientRect()),Z=J.findIndex((X)=>this.horizontal?X.right>Q&&X.leftQ);if(Z===-1){let X=this.gos.get("enableRtl");if(J.every((G)=>Q>(this.horizontal?G.right:G.bottom)))return X&&this.horizontal?0:this.childPillComponents.length;if(J.every((G)=>Q<(this.horizontal?G.left:G.top)))return X&&this.horizontal?this.childPillComponents.length:0;return this.insertIndex}if(this.insertIndex<=Z)return Z+1;return Z}checkDragStartedBySelf($){if(this.state!=="notDragging")return;this.state="rearrangeItems",this.potentialDndItems=this.getItems($.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex($),this.refreshGui()}onDragging($){if(this.checkDragStartedBySelf($),this.checkInsertIndex($))this.refreshGui()}handleDragEnterEnd($){}onDragEnter($){let z=this.getItems($.dragSource.getDragItem());this.state="newItemsIn";let Q=z.filter((Z)=>this.isItemDroppable(Z,$)),J=Q.every((Z)=>this.childPillComponents.map((X)=>X.getItem()).indexOf(Z)!==-1);if(Q.length===0)return;if(this.potentialDndItems=Q,J){this.state="notDragging";return}this.handleDragEnterEnd($),this.checkInsertIndex($),this.refreshGui()}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd($){}onDragLeave($){if(this.state==="rearrangeItems"){let z=this.getItems($.dragSource.getDragItem());this.removeItems(z)}if(this.isPotentialDndItems())this.handleDragLeaveEnd($),this.potentialDndItems=[],this.refreshGui();this.state="notDragging"}onDragCancel($){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.handleDragLeaveEnd($);this.potentialDndItems=[],this.refreshGui()}this.state="notDragging"}onDragStop(){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.addItems(this.potentialDndItems);else this.rearrangeItems(this.potentialDndItems);this.potentialDndItems=[],this.refreshGui()}this.state="notDragging"}removeItems($){let z=this.getExistingItems().filter((Q)=>!$.includes(Q));this.updateItems(z),this.refreshGui()}addItems($){if(!$)return;let z=this.getExistingItems().slice(),Q=$.filter((J)=>z.indexOf(J)<0);u9(z,Q,this.insertIndex),this.updateItems(z),this.refreshGui()}addItem($){this.insertIndex=this.getExistingItems().length,this.addItems([$])}rearrangeItems($,z){let Q;if(!z)Q=this.getNonGhostItems().slice();else Q=this.getExistingItems().filter((J)=>$.indexOf(J)===-1);if(u9(Q,$,this.insertIndex),X0(Q,this.getExistingItems()))return!1;return this.updateItems(Q),this.refreshGui(),!0}refreshGui(){let $=0;if(!this.horizontal)$=this.ePillDropList.scrollTop;let z=this.resizeEnabled,Q=this.getFocusedItem(),{eGridDiv:J}=this.beans,Z=VQ(),X=null;if(Z)X=j0(this.beans,J)??j0(this.beans,J,!1,!0);if(this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),$!==0)this.ePillDropList.scrollTop=$;if(z)this.toggleResizable(z);if(Z)this.restoreFocus(Q,X)}getFocusedItem(){let $=this.getGui(),z=d(this.beans);if(!$.contains(z))return-1;return Array.from($.querySelectorAll(".ag-column-drop-cell")).indexOf(z)}focusItemAtIndex($){let z=this.getGui(),J=Array.from(z.querySelectorAll(".ag-column-drop-cell"))[$];if(!J)return;J.focus({preventScroll:!0})}restoreFocus($,z){let Q=this.getGui(),J=Array.from(Q.querySelectorAll(".ag-column-drop-cell"));if($===-1)return;if(J.length===0)z.focus();let Z=Math.min(J.length-1,$),X=J[Z];if(X)X.focus()}focusList($){let z=$?this.childPillComponents.length-1:0;this.restoreFocus(z,this.getFocusableElement())}getNonGhostItems(){let $=this.getExistingItems();if(this.isPotentialDndItems())return $.filter((z)=>!this.potentialDndItems.includes(z));return $}addItemsToGui(){let z=this.getNonGhostItems().map((Q)=>this.createItemComponent(Q,!1));if(this.isPotentialDndItems()){let Q=this.potentialDndItems.map((J)=>this.createItemComponent(J,!0));if(this.insertIndex>=z.length)z.push(...Q);else z.splice(this.insertIndex,0,...Q)}this.appendChild(this.ePillDropList),z.forEach((Q,J)=>{if(J>0)this.addArrow(this.ePillDropList);this.ePillDropList.appendChild(Q.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){let{childPillComponents:$,ePillDropList:z}=this,Q=$.length;_0(z,Q===0?"presentation":"listbox");for(let J=0;Jthis.destroyBean(Q)),!z)this.childPillComponents.push(Q);return Q}addIconAndTitleToGui(){let{title:$,icon:z}=this.params;if(!$||!z)return;let Q=J0({tag:"div"});if(MJ(Q,!0),this.addElementClasses(Q,"title-bar"),this.addElementClasses(z,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),Q.appendChild(z),!this.horizontal){let J=J0({tag:"span"});this.addElementClasses(J,"title"),J.textContent=$,Q.appendChild(J)}this.appendChild(Q)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){let{emptyMessage:$}=this.params;if(!$||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;let z=J0({tag:"span"});z.textContent=$,this.addElementClasses(z,"empty-message"),this.ePillDropList.appendChild(z)}addArrow($){if(this.horizontal){let z=this.gos.get("enableRtl"),Q=h(z?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(Q,"cell-separator"),$.appendChild(Q)}}},DS={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},FS=class extends x{constructor($,z,Q,J,Z){super();this.dragSourceDropTarget=$,this.ghost=z,this.horizontal=Q,this.template=J,this.agComponents=Z,this.eText=f,this.eDragHandle=f,this.eButton=f}postConstruct(){this.setTemplate(this.template??DS,this.agComponents);let $=this.getGui(),{beans:z,eDragHandle:Q,eText:J,eButton:Z}=this;if(this.addElementClasses($),this.addElementClasses(Q,"drag-handle"),this.addElementClasses(J,"text"),this.addElementClasses(Z,"button"),Q.appendChild(h("columnDrag",z)),Z.appendChild(h("cancel",z)),this.tooltipFeature=this.createOptionalManagedBean(z.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui()})),this.setupComponents(),!this.ghost&&this.isDraggable())this.addDragSource();this.setupAria(),this.setupTooltip(),this.activateTabIndex(),this.refreshDraggable()}isDraggable(){return!0}refreshDraggable(){this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!this.isDraggable())}setupAria(){let $=this.getLocaleTextFunc(),z=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(z,$),E0(this.getGui(),z.join(". "))}addAdditionalAriaInstructions($,z){if(this.isRemovable()){let Q=z("ariaDropZoneColumnComponentDescription","Press DELETE to remove");$.push(Q)}}setupTooltip(){let $=()=>this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip());$(),this.addManagedEventListeners({newColumnsLoaded:$})}getDragSourceId(){return}getDefaultIconName(){return"notAllowed"}addDragSource(){let{beans:{dragAndDrop:$},eDragHandle:z}=this,Q=this.createGetDragItem(),J=this.getDefaultIconName(),Z={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:z,getDefaultIconName:()=>J,getDragItem:Q,dragItemName:this.getDisplayName()};$?.addDragSource(Z,!0),this.addDestroyFunc(()=>$?.removeDragSource(Z))}setupComponents(){if(this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost)this.addCss("ag-column-drop-cell-ghost")}isRemovable(){return!0}refreshRemove(){N(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();let $={type:"columnRemove"};this.addGuiEventListener("keydown",(Q)=>this.onKeyDown(Q)),this.addManagedElementListeners(this.eButton,{click:(Q)=>{this.dispatchLocalEvent($),Q.stopPropagation()}});let z=new h0(this.eButton);this.addManagedListeners(z,{tap:()=>this.dispatchLocalEvent($)}),this.addDestroyFunc(z.destroy.bind(z))}onKeyDown($){if($.key===A.DELETE){if(this.isRemovable())$.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"})}}getDisplayValue(){return this.getDisplayName()}addElementClasses($,z){z=z?`-${z}`:"";let Q=this.horizontal?"horizontal":"vertical";$.classList.add(`ag-column-drop-cell${z}`,`ag-column-drop-${Q}-cell${z}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},MS=class extends FS{constructor($,z,Q,J,Z,X){super(z,Q,Z);this.column=$,this.dropZonePurpose=J,this.updateParams=X,this.eSortIndicator=f,this.popupShowing=!1,this.deferApply=i(X)}postConstruct(){let{sortSvc:$,colNames:z}=this.beans;if(this.template={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},$?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},$)this.agComponents=[$.getSortIndicatorSelector()];if(this.displayName=z.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply)this.eDragHandle.setAttribute("data-column-tool-panel-deferred","");if($)this.setupSort(),this.addManagedEventListeners({sortChanged:()=>{this.setupAria()}});if(this.isGroupingZone())this.addManagedPropertyListener("groupLockGroupColumns",()=>{this.refreshRemove(),this.refreshDraggable(),this.setupAria()})}getItem(){return this.column}getDisplayName(){return this.displayName}getTooltip(){return this.column.getColDef().headerTooltip}addAdditionalAriaInstructions($,z){let Q=this.gos.get("rowGroupPanelSuppressSort"),J=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!J){let Z=z("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");$.push(Z)}if(this.isGroupingZone()&&this.column.isSortable()&&!Q){let Z=z("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");$.push(Z)}super.addAdditionalAriaInstructions($,z)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){let $=this.getLocaleTextFunc(),{name:z,aggFuncName:Q}=this.getColumnAndAggFuncName(),J=$("ariaDropZoneColumnComponentAggFuncSeparator"," of "),Z={asc:$("ariaDropZoneColumnComponentSortAscending","ascending"),desc:$("ariaDropZoneColumnComponentSortDescending","descending")},X=this.getCurrentSortDirection(this.column),Y=this.gos.get("rowGroupPanelSuppressSort");return[Q&&`${Q}${J}`,z,this.isGroupingZone()&&!Y&&X&&`, ${Z[X]}`].filter((q)=>!!q).join("")}getColumnAndAggFuncName(){let $=this.displayName,z="";if(this.isAggregationZone()){let Q=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),J=typeof Q==="string"?Q:"agg";z=this.getLocaleTextFunc()(J,J)}return{name:$,aggFuncName:z}}setupSort(){if(!this.column.isSortable()||!this.isGroupingZone())return;let{gos:$,column:z,eSortIndicator:Q}=this;if(!$.get("rowGroupPanelSuppressSort")){Q.setupSort(z,!0,this.getSortDefOverride.bind(this));let J=(Z)=>{Z.preventDefault(),this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,z,Z),Q.refresh(),this.setupAria(),N0(this.beans,this.updateParams)};this.addGuiEventListener("click",J),this.addGuiEventListener("keydown",(Z)=>{if(Z.key===A.ENTER&&this.isGroupingZone())J(Z)})}}getCurrentSortDirection($){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,$)?.direction??null}getSortDefOverride(){if(!this.deferApply)return;return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getDefaultIconName(){return"hide"}createGetDragItem(){let{column:$}=this;return()=>{let z={};return z[$.getId()]=$.isVisible(),{columns:[$],visibleState:z}}}setupComponents(){if(super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown($){if(super.onKeyDown($),$.key===A.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))$.preventDefault(),this.onShowAggFuncSelection()}getDisplayValue(){let{name:$,aggFuncName:z}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${z}(${$})`:$}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;let{aggFuncSvc:$,popupSvc:z}=this.beans,Q=new SX({cssIdentifier:"select-agg-func"}),J=$.getFuncNames(this.column),Z=this.getGui(),X=Q.getGui();Q.setModel({getRow:function(B){return J[B]},getRowCount:function(){return J.length}}),this.createBean(Q);let Y=J0({tag:"div",cls:"ag-select-agg-func-popup"});Y.style.top="0px",Y.style.left="0px",Y.appendChild(X),Y.style.width=`${Z.clientWidth}px`;let[q]=this.addManagedElementListeners(Y,{focusout:(B)=>{if(!Y.contains(B.relatedTarget)&&H)H.hideFunc()}}),G=(B)=>{if(this.destroyBean(Q),this.popupShowing=!1,B?.key==="Escape")Z.focus();if(q)q()},_=this.getLocaleTextFunc(),H=z.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,closedCallback:G,ariaLabel:_("ariaLabelAggregationFunction","Aggregation Function")});if(H)Q.setComponentCreator(this.createAggSelect.bind(this,H.hideFunc));Q.addGuiEventListener("keydown",(B)=>{if(B.key===A.ENTER||B.key===A.SPACE){let E=Q.getLastFocusedRow();if(E==null)return;let K=Q.getComponentAt(E);if(K)K.selectItem()}}),z.positionPopupByComponent({type:"aggFuncSelect",eventSource:Z,ePopup:Y,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),Q.refresh();let U=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),W=J.findIndex((B)=>B===U);if(W===-1)W=0;Q.focusRow(W)}createAggSelect($,z){let Q=()=>{if($(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,z,"toolPanelDragAndDrop"),this.column){let q=this.getGui().querySelector(".ag-column-drop-cell-text");if(q)q.textContent=this.getDisplayValue();this.setupAria()}N0(this.beans,this.updateParams)},J=this.getLocaleTextFunc(),Z=(z||"").toString(),X=J(Z,Z);return new kS(Q,X)}isGroupingAndLocked(){return this.isGroupingZone()&&P1(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return G$.ToolPanel}destroy(){super.destroy(),this.column=null}},kS=class extends x{constructor($,z){super({tag:"div",cls:"ag-select-agg-func-item",children:z});this.selectItem=$,this.addGuiEventListener("click",this.selectItem)}},J5=class extends LS{constructor($,z,Q){super($);this.dropZonePurpose=z,this.updateParams=Q,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init($){super.init($),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems($){return $.columns??[]}isInterestedIn($,z){if($===G$.HeaderCell)return!0;if($!==G$.ToolPanel)return!1;if(!this.horizontal)return!0;return!z.hasAttribute("data-column-tool-panel-deferred")}minimumAllowedNewInsertIndex(){let{gos:$,rowGroupColsSvc:z}=this.beans,Q=$.get("groupLockGroupColumns"),J=z?.columns.length??0;if(Q===-1)return J;return Math.min(Q,J)}showOrHideColumnOnExit($){return this.isRowGroupPanel()&&PJ(this.gos,!0)&&!$.fromNudge}handleDragEnterEnd($){if(this.showOrHideColumnOnExit($)){let J=$.dragSource.getDragItem().columns;this.setColumnsVisible(J,!1,"uiColumnDragged")}}handleDragLeaveEnd($){if(this.showOrHideColumnOnExit($)){let Q=$.dragSource.getDragItem();this.setColumnsVisible(Q.columns,!0,"uiColumnDragged")}}setColumnsVisible($,z,Q){if(!$)return;if(i(this.updateParams))return;let J=$.filter((Z)=>!Z.getColDef().lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,J,z,Q)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent($,z,Q,J){return new MS($,z,Q,this.dropZonePurpose,J,this.updateParams)}},VS=class extends J5{constructor($,z){super($,"pivot",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("pivotColumnsEmptyMessage","Drag here to set column labels"),Q=$("pivots","Column Labels");if(super.init({icon:h("pivotPanel",this.beans,null),emptyMessage:z,title:Q}),this.horizontal)Bz(this.beans,this,this.getGui());this.addManagedEventListeners({newColumnsLoaded:this.refresh.bind(this),columnPivotChanged:this.refresh.bind(this),columnPivotModeChanged:this.checkVisibility.bind(this)}),this.refresh()}getAriaLabel(){return this.getLocaleTextFunc()("ariaPivotDropZonePanelLabel","Column Labels")}refresh(){this.checkVisibility(),this.refreshGui()}checkVisibility(){let $=this.beans.colModel,z=$.isPivotMode();if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(z);break;case"onlyWhenPivoting":{let Q=$.isPivotActive();this.setDisplayed(z&&Q);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(i(this.updateParams)))}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams)).includes($);return $.isAllowPivot()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setPivotColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}},AS=class extends J5{constructor($,z){super($,"rowGroup",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("rowGroupColumnsEmptyMessage","Drag here to set row groups"),Q=$("groups","Row Groups");if(super.init({icon:h("rowGroupPanel",this.beans,null),emptyMessage:z,title:Q}),this.horizontal)Bz(this.beans,this,this.getGui());this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary()||$.colDef.showRowGroup)return!1;let Q=this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams)).includes($);return $.isAllowRowGroup()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setRowGroupColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}},SS=class extends J5{constructor($,z){super($,"aggregation",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("valueColumnsEmptyMessage","Drag here to aggregate"),Q=$("values","Values");super.init({icon:h("valuePanel",this.beans,null),emptyMessage:z,title:Q}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams)).includes($);return $.isAllowValue()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setValueColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams))}},RS={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},jS=class extends x{constructor($,z){super();this.params=$,this.onPivotModeValueChanged=z,this.cbPivotMode=f}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){this.setTemplate(RS,[S9]);let $=this.cbPivotMode;$.setValue(this.getCurrentPivotMode());let z=this.getLocaleTextFunc();$.setLabel(z("pivotMode","Pivot Mode"));let Q=()=>{let Z=!!$.getValue();this.beans.columnStateUpdateStrategy.setPivotMode(i(this.params),Z,"toolPanelUi"),this.onPivotModeValueChanged?.()},J=()=>{$.setValue(this.getCurrentPivotMode())};this.addManagedListeners($,{fieldValueChanged:Q}),this.addManagedEventListeners({newColumnsLoaded:J,columnPivotModeChanged:J})}},fS=class extends S{constructor(){super(...arguments);this.beanName="colToolPanelFactory"}setPanelVisible($,z,Q){if($)$.setDisplayed(z);else if(z)$=Q();return $}createRowGroupPanel($,z,Q){return this.createPanel($,z,new AS(!1,Q))}createValuesPanel($,z,Q){return this.createPanel($,z,new SS(!1,Q))}createPivotPanel($,z,Q){return this.createPanel($,z,new VS(!1,Q))}createPivotModePanel($,z,Q,J,Z){return this.createPanel($,z,new jS(Q,J),Z)}createPanel($,z,Q,J){if(Q=$.createBean(Q),z.push(()=>$.destroyBean(Q)),J)$.prependChild(Q);else $.appendChild(Q);return Q}},m9=()=>{},OS=class extends S{constructor(){super(...arguments);this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState($,z,Q){this.getUpdateStrategy($).applyColumnState(z,Q)}commit($){this.getUpdateStrategy($).commit()}hasPendingChanges($){return this.getUpdateStrategy($).hasPendingChanges()}moveColumns($,z,Q,J){this.getUpdateStrategy($).moveColumns(z,Q,J)}reset($){this.getUpdateStrategy($).reset()}setColumnsVisible($,z,Q,J){this.getUpdateStrategy($).setColumnsVisible(z,Q,J)}isColumnVisibleInToolPanel($,z){return this.getUpdateStrategy($).isColumnVisibleInToolPanel(z)}setRowGroupColumns($,z,Q){this.getUpdateStrategy($).setRowGroupColumns(z,Q)}getRowGroupColumns($){return this.getUpdateStrategy($).getRowGroupColumns()}getPrimaryColumns($){return this.getUpdateStrategy($).getPrimaryColumns()}hasDeferredColumnOrder($){return this.getUpdateStrategy($).hasDeferredColumnOrder()}setValueColumns($,z,Q){this.getUpdateStrategy($).setValueColumns(z,Q)}getValueColumns($){return this.getUpdateStrategy($).getValueColumns()}setColumnAggFunc($,z,Q,J){this.getUpdateStrategy($).setColumnAggFunc(z,Q,J)}getColumnAggFunc($,z){return this.getUpdateStrategy($).getColumnAggFunc(z)}setPivotColumns($,z,Q){this.getUpdateStrategy($).setPivotColumns(z,Q)}getPivotColumns($){return this.getUpdateStrategy($).getPivotColumns()}setPivotMode($,z,Q){this.getUpdateStrategy($).setPivotMode(z,Q)}getPivotMode($){return this.getUpdateStrategy($).getPivotMode()}isColumnSelectedInPivotModeToolPanel($,z){return this.getUpdateStrategy($).isColumnSelectedInPivotModeToolPanel(z)}progressSortFromEvent($,z,Q){this.getUpdateStrategy($).progressSortFromEvent(z,Q)}getSortDef($,z){return this.getUpdateStrategy($).getSortDef(z)}getUpdateStrategy($){return $?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new PS(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new TS(this.beans))}},PS=class{constructor($){this.beans=$,this.lastPivotColIds=[],this.reset=m9,this.commit=m9,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState($,z){if($.length===0)return;n0(this.beans,{state:$},z)}moveColumns($,z,Q){this.beans.colMoves?.moveColumns($,z,Q),vS(this.beans)}setColumnsVisible($,z,Q){let J=$.filter((Z)=>!Z.getColDef().lockVisible);this.beans.colModel.setColsVisible(J,z,Q)}setRowGroupColumns($,z){this.beans.rowGroupColsSvc?.setColumns($,z)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return Z5(this.beans)}setValueColumns($,z){this.beans.valueColsSvc?.setColumns($,z)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc($,z,Q){this.beans.valueColsSvc?.setColumnAggFunc?.($,z,Q)}getColumnAggFunc($){return $.getAggFunc()}setPivotColumns($,z){this.lastPivotColIds=$.map((Q)=>Q.getColId()),this.beans.pivotColsSvc?.setColumns($,z)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode($,z){let{colModel:Q,gos:J,ctrlsSvc:Z}=this.beans;if($===Q.isPivotMode())return;let X=this.beans.pivotColsSvc?.columns.map((Y)=>Y.getColId())??[];if(X.length>0)this.lastPivotColIds=X;if(!$){let Y=this.beans.colModel.getColDefCols()??[];n0(this.beans,{state:Y.map((q)=>({colId:q.getColId(),pivot:!1,pivotIndex:null}))},z)}if(J.updateGridOptions({options:{pivotMode:$},source:z}),$&&this.lastPivotColIds.length>0)this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,z);for(let Y of Z.getHeaderRowContainerCtrls())Y.refresh()}progressSortFromEvent($,z){this.beans.sortSvc?.progressSortFromEvent($,z)}isColumnVisibleInToolPanel($){return $.isVisible()}isColumnSelectedInPivotModeToolPanel($){return $.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.isPivotMode()}getSortDef($){return $.getSortDef()}},TS=class{constructor($){this.beans=$,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){let{state:$,beans:z}=this,{columnState:Q,columnOrder:J,rowGroup:Z,aggregation:X,pivot:Y,pivotMode:q,sort:G,aggFuncs:_}=$,H=(U)=>(U??[]).map((W)=>W.getColId());if(Q)for(let[U,W]of Q.patches){let B=z.colModel.getColDefCol(U);if(!B)continue;if(W.hide!==void 0&&W.hide!==!B.isVisible()||W.rowGroup!==void 0&&!!W.rowGroup!==B.isRowGroupActive()||W.pivot!==void 0&&!!W.pivot!==B.isPivotActive()||W.aggFunc!==void 0&&(W.aggFunc??null)!==(B.getAggFunc()??null))return!0}if(J&&!X0(J.colIds,c4(z)))return!0;if(Z&&!X0(Z.colIds,H(z.rowGroupColsSvc?.columns)))return!0;if(X&&!X0(X.colIds,H(z.valueColsSvc?.columns)))return!0;if(Y&&!X0(Y.colIds,H(z.pivotColsSvc?.columns)))return!0;if(q&&q.pivotMode!==z.colModel.isPivotMode())return!0;if(G){for(let[U,W]of G.sortDefsByColId){let B=z.colModel.getColDefCol(U);if(!B)continue;if((W?.direction??null)!==(B.getSortDef()?.direction??null))return!0}if(G.baselineCleared){let U=Z5(z);for(let W of U)if(!G.sortDefsByColId.has(W.getColId())&&W.getSortDef()!==null)return!0}}if(_)for(let[U,W]of _.values){let B=z.colModel.getColDefCol(U);if(!B)continue;if(W!==B.getAggFunc())return!0}return!1}commit(){let{beans:$,state:z}=this,Q=[];for(let Z of Object.keys(z)){let X=z[Z];if(X)Q.push({type:Z,...X})}let J=Q.sort((Z,X)=>Z.seq-X.seq);for(let Z of J)switch(Z.type){case"columnState":{n0($,{state:[...Z.patches.values()]},Z.eventType);break}case"columnOrder":{let X=Z.colIds.map((Y)=>$.colModel.getColDefCol(Y)).filter((Y)=>!!Y&&T1(Y));if(!$.colModel.isPivotMode())for(let Y=0;YT1(U)),H=(_>=0?_:0)+Y;if(G[H]!==q)$.colMoves?.moveColumns([q],H,Z.eventType,!0)}mX($,X);break}case"rowGroup":{$.rowGroupColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"aggregation":{$.valueColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"pivot":{this.lastPivotColIds=Z.colIds,$.pivotColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"pivotMode":{let{colModel:X,ctrlsSvc:Y,gos:q,stateSvc:G}=$;if(Z.pivotMode!==X.isPivotMode()){let _=$.pivotColsSvc?.columns.map((W)=>W.getColId())??[];if(_.length>0)this.lastPivotColIds=_;let H=G?.getState().pivot?.pivotColIds??_,U=Z.pivotMode?this.state.pivot?.colIds??this.lastPivotColIds:H;if(G?.setState({...G.getState(),pivot:{pivotMode:Z.pivotMode,pivotColIds:U}},["pivot"]),!Z.pivotMode){let W=$.colModel.getColDefCols()??[];n0($,{state:W.map((B)=>({colId:B.getColId(),pivot:!1,pivotIndex:null}))},Z.eventType)}if(q.updateGridOptions({options:{pivotMode:Z.pivotMode},source:Z.eventType}),Z.pivotMode&&U.length>0)$.pivotColsSvc?.setColumns(U,Z.eventType);for(let W of Y.getHeaderRowContainerCtrls())W.refresh()}break}case"sort":{let X=[],Y=0;for(let[q,G]of Z.sortDefsByColId)X.push({colId:q,sort:G?.direction??null,sortIndex:G?.direction?Y++:null,sortType:G?.type??void 0});n0($,{state:X,defaultState:Z.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},Z.eventType);break}case"aggFuncs":{for(let[X,Y]of Z.values){let q=$.colModel.getColDefCol(X);if(!q)continue;$.valueColsSvc?.setColumnAggFunc?.(q,Y,Z.eventType)}break}}this.reset()}applyColumnState($,z){for(let J of $)p4(this.state,J);let Q=JZ(this.state);Q.seq=i$(this.sequence),this.sequence=Q.seq,Q.eventType=z}moveColumns($,z,Q){let J=new Set($.map((G)=>G.getColId())),X=(this.state.columnOrder?.colIds??c4(this.beans)).filter((G)=>!J.has(G)),Y=$.map((G)=>G.getColId()),q=i$(this.sequence);this.sequence=q,this.state.columnOrder={colIds:[...X.slice(0,z),...Y,...X.slice(z)],eventType:Q,seq:q}}setColumnsVisible($,z,Q){for(let Z of $){if(Z.getColDef().lockVisible)continue;p4(this.state,{colId:Z.getColId(),hide:!z})}let J=JZ(this.state);J.seq=i$(this.sequence),this.sequence=J.seq,J.eventType=Q}setRowGroupColumns($,z){i4(this.state,"rowGroup");let Q=i$(this.sequence);this.sequence=Q,this.state.rowGroup={colIds:$.map((J)=>J.getColId()),eventType:z,seq:Q}}setValueColumns($,z){i4(this.state,"aggFunc");let Q=new Set((this.beans.valueColsSvc?.columns??[]).map((X)=>X.getColId())),J=c9(this.state);for(let X of $)if(!Q.has(X.getColId())&&!J.values.has(X.getColId())){let Y=X.getAggFunc(),q=Y!=null?Y:this.beans.aggFuncSvc?.getDefaultAggFunc(X);if(q!=null)J.values.set(X.getColId(),q)}let Z=i$(this.sequence);this.sequence=Z,J.seq=Z,J.eventType=z,this.state.aggregation={colIds:$.map((X)=>X.getColId()),eventType:z,seq:Z}}setColumnAggFunc($,z,Q){p4(this.state,{colId:$.getColId(),aggFunc:z});let J=JZ(this.state);J.seq=i$(this.sequence),this.sequence=J.seq,J.eventType=Q;let Z=c9(this.state);Z.seq=J.seq,Z.eventType=Q,Z.values.set($.getColId(),z)}getColumnAggFunc($){let z=$.getColId();if(this.state.aggFuncs?.values.has(z))return this.state.aggFuncs.values.get(z);return $.getAggFunc()}isColumnVisibleInToolPanel($){let z=this.state.columnState?.patches.get($.getColId());if(z?.hide!==void 0)return!z.hide;return $.isVisible()}isColumnSelectedInPivotModeToolPanel($){let z=$.getColId(),Q=this.state.columnState?.patches.get(z),J;if(Q?.rowGroup!==void 0)J=!!Q.rowGroup;else if(this.state.rowGroup)J=this.state.rowGroup.colIds.includes(z);else J=$.isRowGroupActive();let Z;if(Q?.pivot!==void 0)Z=!!Q.pivot;else if(this.state.pivot)Z=this.state.pivot.colIds.includes(z);else Z=$.isPivotActive();let X;if(Q?.aggFunc!==void 0)X=Q.aggFunc!=null;else if(this.state.aggregation)X=this.state.aggregation.colIds.includes(z);else X=$.isValueActive();return J||Z||X}setPivotColumns($,z){i4(this.state,"pivot");let Q=i$(this.sequence);this.sequence=Q,this.state.pivot={colIds:$.map((J)=>J.getColId()),eventType:z,seq:Q}}setPivotMode($,z){let Q=i$(this.sequence);this.sequence=Q,this.state.pivotMode={pivotMode:$,eventType:z,seq:Q}}getRowGroupColumns(){return k1(this.beans,m4(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,($)=>$.rowGroup==null?void 0:!!$.rowGroup))}getPrimaryColumns(){return k1(this.beans,this.state.columnOrder?.colIds??c4(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return k1(this.beans,m4(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,($)=>$.aggFunc===void 0?void 0:$.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];let $=this.beans.pivotColsSvc?.columns,z=$?.length?$:k1(this.beans,this.lastPivotColIds);return k1(this.beans,m4(this.state.pivot?.colIds,z,this.state.columnState?.patches,(Q)=>Q.pivot==null?void 0:!!Q.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.isPivotMode()}getSortDef($){let z=this.state.sort,Q=$.getColId(),J=z?.sortDefsByColId;if(J?.has(Q))return J.get(Q)??null;if(z?.baselineCleared)return null;return $.getSortDef()}progressSortFromEvent($,z){let Q=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:J}=this.beans,Z=$.getColId(),X;if(Q.sortDefsByColId.has(Z))X=Q.sortDefsByColId.get(Z);else if(Q.baselineCleared)X=null;else X=$.getSortDef();let Y=J?.getNextSortDirection($,X);if(!Y)return;let{gos:q}=this.beans;if(!(((q.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey)||q.get("alwaysMultiSort"))&&!q.get("suppressMultiSort")))Q.sortDefsByColId.clear(),Q.baselineCleared=!0;Q.sortDefsByColId.set(Z,Y.direction?Y:null),Q.seq=i$(this.sequence),this.sequence=Q.seq,this.state.sort=Q}};function k1($,z){if(!z)return[];return z.map((Q)=>$.colModel.getColDefCol(Q)).filter((Q)=>!!Q)}function m4($,z,Q,J){let Z=[...$??z?.map((Y)=>Y.getColId())??[]];if(!Q?.size)return Z;let X=new Set(Z);for(let[Y,q]of Q){let G=J(q);if(G===void 0)continue;if(G){if(!X.has(Y))Z.push(Y),X.add(Y);continue}if(!X.has(Y))continue;X.delete(Y);let _=Z.indexOf(Y);if(_>=0)Z.splice(_,1)}return Z}function vS($){let z=$.colModel.getCols().filter((Q)=>T1(Q)).map((Q)=>$.colModel.getColDefCol(Q.getColId())).filter((Q)=>!!Q);mX($,z)}function mX($,z){let Q=IS($);if(!Q)return;let J=new Set(z);Q.list=[...z,...Q.list.filter((Z)=>T1(Z)&&!J.has(Z))]}function c4($){return Z5($).map((z)=>z.getColId())}function Z5($){return($.colModel.getColDefCols()??$.colModel.getCols()).filter((z)=>T1(z))}function IS($){let z=$.colModel.colDefCols,Q=z?.list;if(!Array.isArray(Q))return;return z}function T1($){if(!$.isPrimary())return!1;return!mz($)&&!q1($)}function i$($){return $+1}function p4($,z){let Q=JZ($),J=Q.patches.get(z.colId);Q.patches.set(z.colId,J?{...J,...z}:z)}function i4($,z){let Q=$.columnState?.patches;if(!Q?.size)return;for(let[J,Z]of Q){if(!(z in Z))continue;let X={...Z};if(delete X[z],Object.keys(X).length===1){Q.delete(J);continue}Q.set(J,X)}}function JZ($){let{columnState:z}=$;if(!z)z={patches:new Map,seq:0,eventType:"toolPanelUi"},$.columnState=z;return z}function c9($){let{aggFuncs:z}=$;if(!z)z={values:new Map,seq:0,eventType:"toolPanelUi"},$.aggFuncs=z;return z}var CS=class extends S{constructor(){super(...arguments);this.beanName="columnStateUpdateStrategy"}applyColumnState($,z,Q){this.delegate("applyColumnState",$,z,Q)}commit($){this.delegate("commit",$)}hasPendingChanges($){return this.delegate("hasPendingChanges",$)}moveColumns($,z,Q,J){this.delegate("moveColumns",$,z,Q,J)}reset($){this.delegate("reset",$)}setColumnsVisible($,z,Q,J){this.delegate("setColumnsVisible",$,z,Q,J)}isColumnVisibleInToolPanel($,z){return this.delegate("isColumnVisibleInToolPanel",$,z)}setRowGroupColumns($,z,Q){this.delegate("setRowGroupColumns",$,z,Q)}getRowGroupColumns($){return this.delegate("getRowGroupColumns",$)}getPrimaryColumns($){return this.delegate("getPrimaryColumns",$)}hasDeferredColumnOrder($){return this.delegate("hasDeferredColumnOrder",$)}setValueColumns($,z,Q){this.delegate("setValueColumns",$,z,Q)}getValueColumns($){return this.delegate("getValueColumns",$)}setColumnAggFunc($,z,Q,J){this.delegate("setColumnAggFunc",$,z,Q,J)}getColumnAggFunc($,z){return this.delegate("getColumnAggFunc",$,z)}setPivotColumns($,z,Q){this.delegate("setPivotColumns",$,z,Q)}getPivotColumns($){return this.delegate("getPivotColumns",$)}setPivotMode($,z,Q){this.delegate("setPivotMode",$,z,Q)}getPivotMode($){return this.delegate("getPivotMode",$)}isColumnSelectedInPivotModeToolPanel($,z){return this.delegate("isColumnSelectedInPivotModeToolPanel",$,z)}progressSortFromEvent($,z,Q){this.delegate("progressSortFromEvent",$,z,Q)}getSortDef($,z){return this.delegate("getSortDef",$,z)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new OS))}delegate($,...z){let Q=this.getUpdateStrategy();return Q[$].bind(Q)(...z)}},bS={moduleName:"SharedColumnStateUpdateStrategy",version:Q0,beans:[CS],dependsOn:[I0]},cX={moduleName:"ColumnsToolPanel",version:Q0,beans:[fS],userComponents:{agColumnsToolPanel:BS},icons:{ensureColumnVisible:"column-arrow",columnsToolPanel:"columns",menuAddRowGroup:"group",menuRemoveRowGroup:"group",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},dependsOn:[I0,bS,z5,D1,L1,nz,Q5]},yS=class extends S{constructor(){super(...arguments);this.beanName="chartMenuItemMapper"}getChartItems($){let z=this.beans,Q=z.chartSvc,J=$==="pivotChart";if(!Q)return null;let Z=this.getLocaleTextFunc.bind(this),X=J?new xS(z,Q,Z):new wS(z,Q,Z),Y=Q.isEnterprise(),q=X.getMenuItem();if(q?.subMenu&&!Y){let _=(H)=>({...H,subMenu:H.subMenu?.filter((U)=>!U._enterprise).map((U)=>_(U))});q=_(q)}let G=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(G)q=this.filterAndOrderChartMenu(q,G,X.getConfigLookup());return this.cleanInternals(q)}cleanInternals($){if(!$)return $;let z=(Q)=>{delete Q?._key,delete Q?._enterprise;for(let J of Q?.subMenu??[])z(J);return Q};return z($)}buildLookup($){let z={},Q=(J)=>{if(z[J._key]=J,J.subMenu)for(let Z of J.subMenu)Q(Z)};return Q($),z}filterAndOrderChartMenu($,z,Q){let J=this.buildLookup($),Z={...$,subMenu:[]};for(let X of Object.keys(z)){let Y=z[X],q=Q[X];if(q===null)continue;if(q==null){j(173,{group:X});continue}let G=J[q._key];if(G)if(G.subMenu){let _=Y.map((H)=>{let U=q[H];if(U==null){j(174,{group:X,chartType:H});return}return J[U]}).filter((H)=>H!==void 0);if(_.length>0)G.subMenu=_,Z.subMenu?.push(G)}else Z.subMenu?.push(G)}if(Z.subMenu?.length==0)return null;return Z}},xS=class{constructor($,z,Q){this.beans=$,this.chartSvc=z,this.getLocaleTextFunc=Q}getMenuItem(){let $=this.getLocaleTextFunc(),z=(Q,J,Z,X,Y=!1)=>{return{name:$(Q,J+"‎"),action:()=>this.chartSvc.createPivotChart({chartType:Z}),_key:X,_enterprise:Y}};return{name:$("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:$("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:$("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","pivotGroupedBar"),z("stackedBar","Stacked","stackedBar","pivotStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:$("pieChart","Pie"),subMenu:[z("pie","Pie","pie","pivotPie"),z("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:$("lineChart","Line"),subMenu:[z("lineChart","Line","line","pivotLineChart"),z("stackedLine","Stacked","stackedLine","pivotStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:$("areaChart","Area"),subMenu:[z("areaChart","Area","area","pivotArea"),z("stackedArea","Stacked","stackedArea","pivotStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:$("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","pivotScatter"),z("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:$("statisticalChart","Statistical"),subMenu:[z("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:$("hierarchicalChart","Hierarchical"),subMenu:[z("treemapChart","Treemap","treemap","pivotTreemap",!0),z("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:$("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","pivotFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),z("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:$("combinationChart","Combination"),subMenu:[z("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),z("AreaColumnCombo","Area & Column","areaColumnCombo","pivotAreaColumnCombo")]}],icon:h("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"pivotColumnChart",column:"pivotGroupedColumn",stackedColumn:"pivotStackedColumn",normalizedColumn:"pivotNormalizedColumn"},barGroup:{_key:"pivotBarChart",bar:"pivotGroupedBar",stackedBar:"pivotStackedBar",normalizedBar:"pivotNormalizedBar"},pieGroup:{_key:"pivotPieChart",pie:"pivotPie",donut:"pivotDonut",doughnut:"pivotDonut"},lineGroup:{_key:"pivotLineChart",line:"pivotLineChart",stackedLine:"pivotStackedLine",normalizedLine:"pivotNormalizedLine"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},combinationGroup:{_key:"pivotCombinationChart",columnLineCombo:"pivotColumnLineCombo",areaColumnCombo:"pivotAreaColumnCombo",customCombo:null},hierarchicalGroup:{_key:"pivotHierarchicalChart",treemap:"pivotTreemap",sunburst:"pivotSunburst"},statisticalGroup:{_key:"pivotStatisticalChart",histogram:"pivotHistogram",rangeBar:null,rangeArea:null,boxPlot:null},funnelGroup:{_key:"pivotFunnel",funnel:"pivotFunnel",coneFunnel:"pivotConeFunnel",pyramid:"pivotPyramid"},polarGroup:null,specializedGroup:null}}},wS=class{constructor($,z,Q){this.beans=$,this.chartSvc=z,this.getLocaleTextFunc=Q}getMenuItem(){let $=this.getLocaleTextFunc(),z=(Q,J,Z,X,Y=!1)=>{return{name:$(Q,J),action:()=>this.chartSvc.createChartFromCurrentRange(Z),_key:X,_enterprise:Y}};return{name:$("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:$("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:$("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","rangeGroupedBar"),z("stackedBar","Stacked","stackedBar","rangeStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:$("pieChart","Pie"),subMenu:[z("pie","Pie","pie","rangePie"),z("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:$("lineChart","Line"),subMenu:[z("lineChart","Line","line","rangeLineChart"),z("stackedLine","Stacked","stackedLine","rangeStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:$("areaChart","Area"),subMenu:[z("areaChart","Area","area","rangeArea"),z("stackedArea","Stacked","stackedArea","rangeStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:$("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","rangeScatter"),z("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:$("polarChart","Polar"),subMenu:[z("radarLine","Radar Line","radarLine","rangeRadarLine"),z("radarArea","Radar Area","radarArea","rangeRadarArea"),z("nightingale","Nightingale","nightingale","rangeNightingale"),z("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),z("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:$("statisticalChart","Statistical"),subMenu:[z("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),z("histogramChart","Histogram","histogram","rangeHistogram",!1),z("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),z("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:$("hierarchicalChart","Hierarchical"),subMenu:[z("treemap","Treemap","treemap","rangeTreemap"),z("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:$("specializedChart","Specialized"),subMenu:[z("heatmap","Heatmap","heatmap","rangeHeatmap"),z("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:$("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","rangeFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),z("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:$("combinationChart","Combination"),subMenu:[z("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),z("AreaColumnCombo","Area & Column","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:h("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"rangeColumnChart",column:"rangeGroupedColumn",stackedColumn:"rangeStackedColumn",normalizedColumn:"rangeNormalizedColumn"},barGroup:{_key:"rangeBarChart",bar:"rangeGroupedBar",stackedBar:"rangeStackedBar",normalizedBar:"rangeNormalizedBar"},pieGroup:{_key:"rangePieChart",pie:"rangePie",donut:"rangeDonut",doughnut:"rangeDonut"},lineGroup:{_key:"rangeLineChart",line:"rangeLineChart",stackedLine:"rangeStackedLine",normalizedLine:"rangeNormalizedLine"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},polarGroup:{_key:"rangePolarChart",radarLine:"rangeRadarLine",radarArea:"rangeRadarArea",nightingale:"rangeNightingale",radialColumn:"rangeRadialColumn",radialBar:"rangeRadialBar"},statisticalGroup:{_key:"rangeStatisticalChart",boxPlot:"rangeBoxPlot",histogram:"rangeHistogram",rangeBar:"rangeRangeBar",rangeArea:"rangeRangeArea"},hierarchicalGroup:{_key:"rangeHierarchicalChart",treemap:"rangeTreemap",sunburst:"rangeSunburst"},specializedGroup:{_key:"rangeSpecializedChart",heatmap:"rangeHeatmap",waterfall:"rangeWaterfall"},funnelGroup:{_key:"rangeFunnel",funnel:"rangeFunnel",coneFunnel:"rangeConeFunnel",pyramid:"rangePyramid"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}},NS=class extends S{constructor(){super(...arguments);this.beanName="colChooserFactory"}createColumnSelectPanel($,z,Q,J){let Z=$.createManagedBean(new uX),X=J??z?.getColDef().columnChooserParams??{},{contractColumnSelection:Y,suppressColumnExpandAll:q,suppressColumnFilter:G,suppressColumnSelectAll:_,suppressSyncLayoutWithGrid:H,columnLayout:U}=X;if(Z.init(!!Q,y(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!Y,suppressColumnExpandAll:!!q,suppressColumnFilter:!!G,suppressColumnSelectAll:!!_,suppressSyncLayoutWithGrid:!!U||!!H,onStateUpdated:()=>{}}),"columnMenu"),U)Z.setColumnLayout(U);return Z}showColumnChooser({column:$,chooserParams:z,eventSource:Q,headerPosition:J}){this.hideActiveColumnChooser();let Z=this.createColumnSelectPanel(this,$,!0,z),X=this.getLocaleTextFunc(),Y=this.beans,{visibleCols:q,focusSvc:G,menuUtils:_}=Y,H=q.allCols.indexOf($),U=$?G.focusedHeader??J??null:null;this.activeColumnChooserDialog=this.createBean(new ZA({title:X("chooseColumns","Choose Columns"),component:Z,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{j0(Y,Z.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,$)},closedCallback:(W)=>{let B=this.activeColumnChooser.getGui();if(this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,$),$)_.restoreFocusOnClose({column:$,headerPosition:U,columnIndex:H,eventSource:Q},B,W,!0)},postProcessPopupParams:{type:"columnChooser",column:$,eventSource:Q}})),this.activeColumnChooser=Z}hideActiveColumnChooser(){this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent($,z){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:!1,key:"columnChooser",column:z??null})}},gS={pinSubMenu:"PinnedColumn",pinLeft:"PinnedColumn",pinRight:"PinnedColumn",clearPinned:"PinnedColumn",pinRowSubMenu:"PinnedRow",pinBottom:"PinnedRow",pinTop:"PinnedRow",unpinRow:"PinnedRow",valueAggSubMenu:"SharedAggregation",autoSizeThis:"ColumnAutoSize",autoSizeAll:"ColumnAutoSize",rowGroup:"SharedRowGrouping",rowUnGroup:"SharedRowGrouping",resetColumns:"CommunityCore",expandAll:["ClientSideRowModelHierarchy","ServerSideRowModel"],contractAll:["ClientSideRowModelHierarchy","ServerSideRowModel"],copy:"Clipboard",copyWithHeaders:"Clipboard",copyWithGroupHeaders:"Clipboard",cut:"Clipboard",paste:"Clipboard",export:["CsvExport","ExcelExport"],csvExport:"CsvExport",excelExport:"ExcelExport",separator:"CommunityCore",pivotChart:"IntegratedCharts",chartRange:"IntegratedCharts",columnFilter:"ColumnFilter",columnChooser:"ColumnMenu",sortAscending:"Sort",sortDescending:"Sort",sortAbsoluteAscending:"Sort",sortAbsoluteDescending:"Sort",sortUnSort:"Sort"};function hS($,z){let Q=gS[z];if(Q)$.assertModuleRegistered(Q,`menu item '${z}'`)}var dz="separator";function pX($,z){if(!$)return;for(let Q=$.length-2;Q>=0;Q--){let J=$[Q]===z,Z=$[Q+1]===z;if(J&&Z)$.splice(Q+1,1)}}var uS={sortAscending:{fallback:"Sort Ascending",getSortDef:()=>({type:"default",direction:"asc"})},sortDescending:{fallback:"Sort Descending",getSortDef:()=>({type:"default",direction:"desc"})},sortAbsoluteAscending:{fallback:"Sort Absolute Ascending",getSortDef:()=>({type:"absolute",direction:"asc"})},sortAbsoluteDescending:{fallback:"Sort Absolute Descending",getSortDef:()=>({type:"absolute",direction:"desc"})},sortUnSort:{fallback:"Clear Sort",getSortDef:($)=>({type:L$($.getSortDef()?.type),direction:null})}},mS=class extends S{constructor(){super(...arguments);this.beanName="menuItemMapper"}mapWithStockItems($,z,Q,J,Z){if(!$)return[];let X=[],Y=this.getLocaleTextFunc(),{beans:q,gos:G}=this,{pinnedCols:_,colAutosize:H,aggFuncSvc:U,rowGroupColsSvc:W,colNames:B,colModel:E,clipboardSvc:K,expansionSvc:L,focusSvc:D,csvCreator:F,excelCreator:M,menuSvc:k,colChooserFactory:V,sortSvc:R,chartMenuItemMapper:O,valueColsSvc:I,pinnedRowModel:v}=q,C=(m,w,a,t)=>{switch(hS(G,m),m){case"pinSubMenu":return _&&w?{name:Y("pinColumn","Pin Column"),icon:h("menuPin",q,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return _&&w?{name:Y("pinLeft","Pin Left"),action:()=>_.setColsPinned([w],"left",t),checked:!!w&&w.isPinnedLeft()}:null;case"pinRight":return _&&w?{name:Y("pinRight","Pin Right"),action:()=>_.setColsPinned([w],"right",t),checked:!!w&&w.isPinnedRight()}:null;case"clearPinned":return _&&w?{name:Y("noPin","No Pin"),action:()=>_.setColsPinned([w],null,t),checked:!!w&&!w.isPinned()}:null;case"pinRowSubMenu":{let u=G.get("enableRowPinning"),$0=[],s=Q?.rowPinned??Q?.pinnedSibling?.rowPinned;if(s)$0.push("unpinRow");if(u&&u!=="bottom"&&s!="top")$0.push("pinTop");if(u&&u!=="top"&&s!="bottom")$0.push("pinBottom");return v?.isManual()?{name:Y("pinRow","Pin Row"),icon:h("rowPin",q,w),subMenu:$0}:null}case"pinTop":return v?.isManual()?{name:Y("pinTop","Pin to Top"),icon:h("rowPinTop",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,"top",$0)}:null;case"pinBottom":return v?.isManual()?{name:Y("pinBottom","Pin to Bottom"),icon:h("rowPinBottom",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,"bottom",$0)}:null;case"unpinRow":return v?.isManual()?{name:Y("unpinRow","Unpin Row"),icon:h("rowUnpin",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,null,$0)}:null;case"valueAggSubMenu":if(U&&I&&(w?.isPrimary()||w?.getColDef().pivotValueColumn))return{name:Y("valueAggregation","Value Aggregation"),icon:h("menuValue",q,null),subMenu:cS(w,U,I,Y),disabled:G.get("functionsReadOnly")};else return null;case"autoSizeThis":return H?{name:Y("autosizeThisColumn","Autosize This Column"),action:()=>w&&H.autoSizeColumn(w,t,G.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return H?{name:Y("autosizeAllColumns","Autosize All Columns"),action:()=>H.autoSizeAllColumns({source:t,skipHeader:G.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return W?{name:f1(Y,"groupBy",B.getDisplayNameForColumn(w,"header")),disabled:G.get("functionsReadOnly")||w?.isRowGroupActive()||!w?.getColDef().enableRowGroup,action:()=>W.addColumns([w],t),icon:h("menuAddRowGroup",q,null)}:null;case"rowUnGroup":if(W&&G.isModuleRegistered("SharedRowGrouping")){let u=w?.getColDef().showRowGroup,$0=G.get("groupLockGroupColumns"),s,f0,O0;if(u===!0)s=Y("ungroupAll","Un-Group All"),f0=G.get("functionsReadOnly")||$0===-1||$0>=(W.columns.length??0),O0=()=>W.setColumns(W.columns.slice(0,$0),t);else if(typeof u==="string"){let k0=E.getColDefCol(u),Sz=k0!=null?B.getDisplayNameForColumn(k0,"header"):u;s=f1(Y,"ungroupBy",Sz),f0=G.get("functionsReadOnly")||P1(k0,q),O0=()=>{W.removeColumns([u],t)}}else s=f1(Y,"ungroupBy",B.getDisplayNameForColumn(w,"header")),f0=G.get("functionsReadOnly")||!w?.isRowGroupActive()||!w?.getColDef().enableRowGroup||P1(w,q),O0=()=>W.removeColumns([w],t);return{name:s,disabled:f0,action:O0,icon:h("menuRemoveRowGroup",q,null)}}else return null;case"resetColumns":return{name:Y("resetColumns","Reset Columns"),action:()=>D8(q,t)};case"expandAll":return L?{name:Y("expandAll","Expand All Row Groups"),action:()=>L.expandAll(!0)}:null;case"contractAll":return L?{name:Y("collapseAll","Collapse All Row Groups"),action:()=>L.expandAll(!1)}:null;case"copy":return K?{name:Y("copy","Copy"),shortcut:Y("ctrlC","Ctrl+C"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard()}:null;case"copyWithHeaders":return K?{name:Y("copyWithHeaders","Copy with Headers"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return K?{name:Y("copyWithGroupHeaders","Copy with Group Headers"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(K){let u=D.getFocusedCell(),$0=u?M0(q,u):null,s=$0?u?.column.isCellEditable($0):!1;return{name:Y("cut","Cut"),shortcut:Y("ctrlX","Ctrl+X"),icon:h("clipboardCut",q,null),disabled:!s||G.get("suppressCutToClipboard"),action:()=>K.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(K){let u=G.get("suppressClipboardApi")||G.get("suppressClipboardPaste")||!w||!Q||!w.isCellEditable(Q)||w.isSuppressPaste(Q);return{name:Y("paste","Paste"),shortcut:Y("ctrlV","Ctrl+V"),icon:h("clipboardPaste",q,null),disabled:u,action:()=>K.pasteFromClipboard()}}else return null;case"export":{let u=[];if(!G.get("suppressCsvExport")&&F)u.push("csvExport");if(!G.get("suppressExcelExport")&&M)u.push("excelExport");return u.length?{name:Y("export","Export"),subMenu:u,icon:h("save",q,null)}:null}case"csvExport":return F?{name:Y("csvExport","CSV Export"),icon:h("csvExport",q,null),action:()=>F.exportDataAsCsv()}:null;case"excelExport":return M?{name:Y("excelExport","Excel Export"),icon:h("excelExport",q,null),action:()=>M.exportDataAsExcel()}:null;case"separator":return m;case"pivotChart":case"chartRange":return O.getChartItems(m);case"columnFilter":return k&&w?{name:Y("columnFilter","Column Filter"),icon:h("filter",q,null),action:()=>k.showFilterMenu({column:w,buttonElement:a(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{let u=D.focusedHeader;return V?{name:Y("columnChooser","Choose Columns"),icon:h("columns",q,null),action:()=>V.showColumnChooser({column:w,eventSource:a(),headerPosition:u})}:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!R||!w)return null;let{fallback:u,getSortDef:$0}=uS[m];return{name:Y(m,u),icon:h(m,q,null),action:()=>R.setSortForColumn(w,$0(w),!1,t)}}default:return j(176,{key:m}),null}};for(let m of $){let w;if(typeof m==="string")w=C(m,z,J,Z);else w={...m};if(!w)continue;let a=w,{subMenu:t}=a;if(t&&t instanceof Array)a.subMenu=this.mapWithStockItems(t,z,Q,J,Z);if(w!=null)X.push(w)}return pX(X,dz),X}};function cS($,z,Q,J){let Z;if($.isPrimary())Z=$;else{let Y=$.getColDef().pivotValueColumn;Z=T(Y)?Y:void 0}let X=[];if(Z){let Y=Z.isValueActive(),q=z.getFuncNames(Z);X.push({name:J("noAggregation","None"),action:()=>{Q.removeColumns([Z],"contextMenu"),Q.setColumnAggFunc(Z,void 0,"contextMenu")},checked:!Y});for(let G of q)X.push({name:J(G,z.getDefaultFuncLabel(G)),action:()=>{Q.setColumnAggFunc(Z,G,"contextMenu"),Q.addColumns([Z],"contextMenu")},checked:Y&&Z.getAggFunc()===G})}return X}var pS=class extends S{constructor(){super(...arguments);this.beanName="colMenuFactory"}createMenu($,z,Q,J){let Z=$.createManagedBean(new NX(0,{column:Q??null,node:null,value:null})),X=this.beans.menuItemMapper.mapWithStockItems(z,Q??null,null,J,"columnMenu");return Z.addMenuItems(X),Z}getMenuItems($=null,z=null){let Q=this.getDefaultMenuOptions($),J,Z=($?.getColDef()??z?.getColGroupDef())?.mainMenuItems;if(Array.isArray(Z))J=Z;else if(typeof Z==="function")J=Z(y(this.gos,{column:$,columnGroup:z,defaultItems:Q}));else{let X=this.gos.getCallback("getMainMenuItems");if(X)J=X({column:$,columnGroup:z,defaultItems:Q});else J=Q}return pX(J,dz),J}getDefaultMenuOptions($){let z=[],{beans:Q,gos:J}=this,{colChooserFactory:Z,rowGroupColsSvc:X,colModel:Y,expansionSvc:q,sortSvc:G,menuSvc:_,pinnedCols:H,aggFuncSvc:U,colAutosize:W}=Q,B=U0(J),E=()=>{if(!B&&Z)z.push("columnChooser");z.push("resetColumns")};if(!$)return E(),z;let{colDef:K}=$,L=H&&!K.lockPinned,D=X?.columns.length??0,F=D>0,M=Hz(J),k=J.get("treeData"),V=$.isPrimary(),R=!V||U&&$.isAllowValue()&&(F||M||k);if(G&&!B&&$.isSortable()){let{isDefaultSortAllowed:O,isAbsoluteSortAllowed:I,isAbsoluteSort:v,isDefaultSort:C,isAscending:m,isDescending:w,direction:a}=u2($,Q);if(O&&!(m&&C))z.push("sortAscending");if(O&&!(w&&C))z.push("sortDescending");if(I&&!(m&&v))z.push("sortAbsoluteAscending");if(I&&!(w&&v))z.push("sortAbsoluteDescending");if(a)z.push("sortUnSort");z.push(dz)}if(_?.isFilterMenuItemEnabled($))z.push("columnFilter"),z.push(dz);if(L)z.push("pinSubMenu");if(R)z.push("valueAggSubMenu");if(L||R)z.push(dz);if(W){if(!K.suppressAutoSize)z.push("autoSizeThis");z.push("autoSizeAll"),z.push(dz)}if(X&&J.isModuleRegistered("SharedRowGrouping")){let O=z.length;if(K.showRowGroup)z.push("rowUnGroup");else if($.isAllowRowGroup()&&V)if($.isRowGroupActive()){if(!P1($,Q))z.push("rowUnGroup")}else z.push("rowGroup");if(z.length>O)z.push(dz)}if(E(),q&&(o(J)||J.get("ssrmExpandAllAffectsAllRows"))&&(k||D>(Y.isPivotMode()?1:0)))z.push("expandAll"),z.push("contractAll");return z}};var Fz="filterMenuTab",Mz="generalMenuTab",tz="columnsMenuTab",ZZ=[Mz,Fz,tz],iS=class extends S{constructor(){super(...arguments);this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent($,z,Q,J,Z){let{column:X,columnGroup:Y}=this.splitColumnOrGroup($),q=Z?"filterMenuTab":void 0;this.showMenu(X,Y,(G)=>{let _=G.getGui();if(this.beans.popupSvc.positionPopupUnderMouseEvent({type:Q,additionalParams:{column:X},mouseEvent:z,ePopup:_}),q)G.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,X,Y,q)},Q,q,void 0,z.target,J)}splitColumnOrGroup($){let z=$&&Q$($);return{column:z?$:void 0,columnGroup:z?void 0:$}}showMenuAfterButtonClick($,z,Q,J,Z){let X=-1,Y="left";if(this.gos.get("enableRtl"))X=1,Y="right";let q=Z?"filterMenuTab":void 0,G=q?[q]:void 0,_=U0(this.gos),H=(_?9:4)*X,U=_?-23:4,{column:W,columnGroup:B}=this.splitColumnOrGroup($);this.showMenu(W,B,(E)=>{let K=E.getGui();if(this.beans.popupSvc.positionPopupByComponent({type:Q,additionalParams:{column:W},eventSource:z,ePopup:K,alignSide:Y,nudgeX:H,nudgeY:U,position:"under",keepWithinBounds:!0}),q)E.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,W,B,q)},Q,q,G,z,J)}showMenu($,z,Q,J,Z,X,Y,q){let G=this.getMenuParams($,z,X,Y);if(!G)return;let{menu:_,eMenuGui:H,anchorToElement:U,restoreFocusParams:W}=G,B=[],{menuUtils:E,popupSvc:K}=this.beans;B.push((D)=>{let F=_.getGui();if(this.destroyBean(_),$)z1($,!1,"contextMenu"),E.restoreFocusOnClose(W,F,D);q?.()});let L=this.getLocaleTextFunc();if(K.addPopup({modal:!0,eChild:H,closeOnEsc:!0,closedCallback:(D)=>{for(let F of B)F(D);this.dispatchVisibleChangedEvent(!1,!1,$,z,Z)},afterGuiAttached:(D)=>_.afterGuiAttached(Object.assign({},{container:J},D)),positionCallback:Z?()=>Q(_):void 0,ariaLabel:L("ariaLabelColumnMenu","Column Menu")}),!Z)_.showTabBasedOnPreviousSelection?.(),Q(_);if(N2(this.gos)){let D=K.setPopupPositionRelatedToElement(H,U);if(D&&$)this.addStopAnchoring(D,$,B)}if(_.addEventListener("tabSelected",(D)=>{this.dispatchVisibleChangedEvent(!1,!0,$),this.lastSelectedTab=D.key,this.dispatchVisibleChangedEvent(!0,!0,$)}),$)z1($,!0,"contextMenu");this.activeMenu=_,_.addEventListener("destroyed",()=>{if(this.activeMenu===_)this.activeMenu=null})}addStopAnchoring($,z,Q){$.then((J)=>{z.__addEventListener("leftChanged",J),z.__addEventListener("visibleChanged",J),Q.push(()=>{z.__removeEventListener("leftChanged",J),z.__removeEventListener("visibleChanged",J)})})}getMenuParams($,z,Q,J){let{focusSvc:Z,visibleCols:X,ctrlsSvc:Y}=this.beans,q={column:$,headerPosition:Z.focusedHeader,columnIndex:X.allCols.indexOf($),eventSource:J},G=this.createMenu($,z,q,Q,J);return G?{menu:G,eMenuGui:G.getGui(),anchorToElement:J||Y.getGridBodyCtrl().eGridBody,restoreFocusParams:q}:void 0}createMenu($,z,Q,J,Z){if(U0(this.gos))return this.createBean(new nS($,Q,this.lastSelectedTab,J,Z));else{let X=this.beans.colMenuFactory.getMenuItems($,z);return X.length?this.createBean(new dS(X,$,Q,Z)):void 0}}dispatchVisibleChangedEvent($,z,Q,J,Z){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:z,key:this.lastSelectedTab??Z??(U0(this.gos)?Mz:"columnMenu"),column:Q??null,columnGroup:J??null})}isMenuEnabled($){if(!U0(this.gos))return!0;let z=!this.beans.filterManager?.isFilterAllowed($),Q=$.getColDef().menuTabs??ZZ;return(z&&Q.includes(Fz)?Q.length-1:Q.length)>0}showMenuAfterContextMenuEvent($,z,Q){this.beans.menuUtils.onContextMenu({mouseEvent:z,touchEvent:Q,source:"ui",showMenuCallback:(J)=>{return this.showMenuAfterMouseEvent($,J,"columnMenu"),!0}})}},nS=class extends S{constructor($,z,Q,J,Z){super();this.column=$,this.restoreFocusParams=z,this.initialSelection=Q,this.restrictTo=J,this.sourceElement=Z,this.tabFactories={},this.includeChecks={};let{tabFactories:X,includeChecks:Y}=this;X[Mz]=this.createMainPanel.bind(this),X[Fz]=this.createFilterPanel.bind(this),X[tz]=this.createColumnsPanel.bind(this),Y[Mz]=()=>!0,Y[Fz]=()=>$?!!this.beans.filterManager?.isFilterAllowed($):!1,Y[tz]=()=>!0}postConstruct(){let $=this.getTabsToCreate().map((Q)=>this.createTab(Q)),z=new aV({items:$,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(z),this.mainMenuList?.setParentComponent(z),this.addDestroyFunc(()=>this.destroyBean(z))}getTabsToCreate(){if(this.restrictTo)return this.restrictTo;return(this.column?.getColDef().menuTabs??ZZ).filter(($)=>this.isValidMenuTabItem($)&&this.isNotSuppressed($))}isValidMenuTabItem($){let z=!0,Q=ZZ;if(this.restrictTo!=null)z=this.restrictTo.indexOf($)>-1,Q=this.restrictTo;if(z=z&&ZZ.indexOf($)>-1,!z)j(175,{menuTabName:$,itemsToConsider:Q});return z}isNotSuppressed($){return this.includeChecks[$]()}createTab($){return this.tabFactories[$]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab($){let{tabItemColumns:z,tabbedLayout:Q,tabItemFilter:J,tabItemGeneral:Z}=this;if(z&&$===tz)Q.showItem(z);else if(J&&$===Fz)Q.showItem(J);else if(Z&&$===Mz)Q.showItem(Z);else Q.showFirstItem()}onTabItemClicked($){let z=null;switch($.item){case this.tabItemColumns:z=tz;break;case this.tabItemFilter:z=Fz;break;case this.tabItemGeneral:z=Mz;break}if(z)this.activateTab(z)}activateTab($){let z={type:"tabSelected",key:$};this.dispatchLocalEvent(z)}createMainPanel(){let{beans:$,column:z}=this,Q=$.colMenuFactory,J=Q.createMenu(this,Q.getMenuItems(z),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=J,J.addEventListener("closeMenu",this.onHidePopup.bind(this));let Z={title:h("legacyMenu",$,z),titleLabel:Mz.replace("MenuTab",""),bodyPromise:g.resolve(J.getGui()),name:Mz};return this.tabItemGeneral=Z,Z}onHidePopup($){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,$)}createFilterPanel(){let $=this.column?this.createBean(new b4(this.column,"COLUMN_MENU")):null;if(this.filterComp=$,!$?.hasFilter())e(119);let z=(J)=>$?.afterGuiAttached(J),Q=()=>$?.afterGuiDetached();return this.tabItemFilter={title:h("filterTab",this.beans,this.column),titleLabel:Fz.replace("MenuTab",""),bodyPromise:g.resolve($?.getGui()),afterAttachedCallback:z,afterDetachedCallback:Q,name:Fz},this.tabItemFilter}createColumnsPanel(){let $=J0({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:z,column:Q}=this,Z=z.colChooserFactory.createColumnSelectPanel(this,Q).getGui();Z.classList.add("ag-menu-column-select"),$.appendChild(Z);let X={title:h("columns",z,Q),titleLabel:tz.replace("MenuTab",""),bodyPromise:g.resolve($),name:tz};return this.tabItemColumns=X,X}afterGuiAttached($){let{container:z,hidePopup:Q}=$;if(this.tabbedLayout.setAfterAttachedParams({container:z,hidePopup:Q}),Q)this.hidePopupFunc=Q,this.addDestroyFunc(Q)}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},dS=class extends x{constructor($,z,Q,J){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"});this.menuItems=$,this.column=z,this.restoreFocusParams=Q,this.sourceElement=J,this.eColumnMenu=f}postConstruct(){let $=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=$,$.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild($.getGui())}onHidePopup($){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,$)}afterGuiAttached({hidePopup:$}){if($)this.hidePopupFunc=$,this.addDestroyFunc($);F0(this.mainMenuList.getGui())}};function tS($,z){$.colChooserFactory?.showColumnChooser({chooserParams:z})}function sS($){$.colChooserFactory?.hideActiveColumnChooser()}var rS=class extends S{constructor(){super(...arguments);this.beanName="menuUtils"}restoreFocusOnClose($,z,Q,J){let{eventSource:Z}=$,X=Q instanceof KeyboardEvent;if(!J&&!X||!Z)return;let Y=d(this.beans);if(!z.contains(Y)&&!hz(this.beans))return;this.focusHeaderCell($)}closePopupAndRestoreFocusOnSelect($,z,Q){let J;if(Q?.keyboardEvent)J=Q.keyboardEvent;$(J&&{keyboardEvent:J});let Z=this.beans,X=Z.focusSvc,Y=X.getFocusedCell();if(hz(Z))if(Y){let{rowIndex:q,rowPinned:G,column:_}=Y;X.setFocusedCell({rowIndex:q,column:_,rowPinned:G,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(z)}onContextMenu($){let{mouseEvent:z,touchEvent:Q,showMenuCallback:J,source:Z}=$;if(!this.gos.get("allowContextMenuWithControlKey")){if(z&&(z.ctrlKey||z.metaKey))return}if(z)this.blockMiddleClickScrollsIfNeeded(z);if(Z==="ui"&&this.gos.get("suppressContextMenu"))return;let X=z??Q.touches[0];if(J(X)){let Y=z??Q;if(Y?.cancelable)Y.preventDefault()}}async focusHeaderCell($){let{column:z,columnIndex:Q,headerPosition:J,eventSource:Z}=$,{visibleCols:X,headerNavigation:Y,focusSvc:q}=this.beans,G=await X.allCols.some((_)=>_===z);if(!this.isAlive())return;if(z?.isAlive()&&G&&Z&&A0(Z)){let _=yJ(Z);if(_)Y?.scrollToColumn(z),_.focus()}else if(J&&Q!==-1){let _=X.allCols,H=_[Q]||b(_);if(H)q.focusHeaderPosition({headerPosition:{headerRowIndex:J.headerRowIndex,column:H}})}}blockMiddleClickScrollsIfNeeded($){if(this.gos.get("suppressMiddleClickScrolls")&&$.which===2)$.preventDefault()}},lS={moduleName:"MenuCore",version:Q0,beans:[mS,yS,rS],icons:{chart:"chart",columns:"columns",loadingMenuItems:"loading",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",save:"save",csvExport:"csv",excelExport:"excel",sortAscending:"asc",sortDescending:"desc",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc",sortUnSort:"none"},dependsOn:[I0,nz,O4,Q5]},iX={moduleName:"ColumnMenu",version:Q0,beans:[iS,pS,NS],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:tS,hideColumnChooser:sS},dependsOn:[lS,L1,D1]};var aS=".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4)}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}";function oS($,z,Q){return $.getCompDetails(z,eS,void 0,Q,!0)}var eS={name:"statusPanel",optionalMethods:["refresh"]},$R={agAggregationComponent:{rowModels:["clientSide","serverSide"],warnArgs:[221]},agFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[222]},agSelectedRowCountComponent:{rowModels:["clientSide","serverSide"],warnArgs:[223]},agTotalAndFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[224]},agTotalRowCountComponent:{rowModels:["clientSide"],warnArgs:[225]}},zR={tag:"div",cls:"ag-status-bar",children:[{tag:"div",ref:"eStatusBarLeft",cls:"ag-status-bar-left",role:"status"},{tag:"div",ref:"eStatusBarCenter",cls:"ag-status-bar-center",role:"status"},{tag:"div",ref:"eStatusBarRight",cls:"ag-status-bar-right",role:"status"}]},QR=class extends x{constructor(){super(zR);this.updateQueued=!1,this.panelsPromise=g.resolve(),this.eStatusBarLeft=f,this.eStatusBarCenter=f,this.eStatusBarRight=f,this.compDestroyFunctions={},this.registerCSS(aS)}wireBeans($){this.userCompFactory=$.userCompFactory,this.statusBarSvc=$.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),Bz(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){let $=this.gos,z=$.get("statusBar")?.statusPanels;if(!z)return z;return z.filter((Q)=>{let{rowModels:J,warnArgs:Z}=$R[Q.statusPanel]??{};if(!J)return!0;if(J.includes($.get("rowModelType")))return!0;return j(...Z),!1})}processStatusPanels($){let z=this.getValidPanels();if(z){let Q=z.filter((X)=>X.align==="left"),J=z.filter((X)=>X.align==="center"),Z=z.filter((X)=>!X.align||X.align==="right");this.panelsPromise=g.all([this.createAndRenderComponents(Q,this.eStatusBarLeft,$),this.createAndRenderComponents(J,this.eStatusBarCenter,$),this.createAndRenderComponents(Z,this.eStatusBarRight,$)])}else this.setDisplayed(!1)}handleStatusBarChanged(){if(this.updateQueued)return;this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1})}updateStatusBar(){let $=this.getValidPanels(),z=Array.isArray($)&&$.length>0;this.setDisplayed(z);let Q=new Map;if(z)for(let J of $){let Z=J.key??J.statusPanel,X=this.statusBarSvc.getStatusPanel(Z);if(X?.refresh){let Y=y(this.gos,{...J.statusPanelParams??{},key:Z});if(X.refresh(Y))Q.set(Z,X),delete this.compDestroyFunctions[Z],T0(X.getGui())}}if(this.resetStatusBar(),z)this.processStatusPanels(Q)}resetStatusBar(){z0(this.eStatusBarLeft),z0(this.eStatusBarCenter),z0(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(let $ of Object.values(this.compDestroyFunctions))$();this.compDestroyFunctions={}}createAndRenderComponents($,z,Q){let J=[];for(let Z of $){let X=Z.key||Z.statusPanel,Y=Q.get(X),q;if(Y)q=g.resolve(Y);else{let G=oS(this.userCompFactory,Z,y(this.gos,{key:X}));if(G==null)continue;q=G.newAgStackInstance()}J.push({key:X,promise:q})}return g.all(J.map((Z)=>Z.promise)).then(()=>{for(let Z of J)Z.promise.then((X)=>{let Y=()=>{this.destroyBean(X)};if(this.isAlive())this.statusBarSvc.registerStatusPanel(Z.key,X),z.appendChild(X.getGui()),this.compDestroyFunctions[Z.key]=Y;else Y()})})}},JR={selector:"AG-STATUS-BAR",component:QR},ZR={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},": ",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},XR=BigInt(Number.MIN_SAFE_INTEGER),YR=BigInt(Number.MAX_SAFE_INTEGER),I1=class extends x{constructor(){super(ZR);this.eLabel=f,this.eValue=f}setLabel($,z){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()($,z)}setValue($,z){let Q=null,J;if(typeof $==="bigint"){if(J=$,$>=XR&&$<=YR)Q=Number($)}else Q=$;this.eValue.textContent=this.valueFormatter(y(this.gos,{value:Q,bigintValue:J,totalRows:z,key:this.key}))}},qR={selector:"AG-NAME-VALUE",component:I1},nX=($)=>{let z=0;return $.forEachNodeAfterFilter((Q)=>{if(Q.data)z++}),z},C1=($)=>{let z=0;return $.forEachNode((Q)=>{if(Q.data)z++}),z};function GR($,z){if(typeof $!=="number")return"";return M$(Math.round($*100)/100,z)}var _R={tag:"div",cls:"ag-status-panel ag-status-panel-aggregations",children:[{tag:"ag-name-value",ref:"avgAggregationComp"},{tag:"ag-name-value",ref:"countAggregationComp"},{tag:"ag-name-value",ref:"minAggregationComp"},{tag:"ag-name-value",ref:"maxAggregationComp"},{tag:"ag-name-value",ref:"sumAggregationComp"}]},HR=class extends x{constructor(){super(_R,[qR]);this.sumAggregationComp=f,this.countAggregationComp=f,this.minAggregationComp=f,this.maxAggregationComp=f,this.avgAggregationComp=f}postConstruct(){this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this),modelUpdated:this.onCellSelectionChanged.bind(this)})}init($){this.refresh($)}refresh($){this.params=$;let z=$.valueFormatter??((J)=>{let{value:Z,bigintValue:X}=J;if(X!=null)return X.toString();return GR(Z,this.getLocaleTextFunc.bind(this))}),Q=["avg","count","min","max","sum"];for(let J of Q){let Z=this.getAllowedAggregationValueComponent(J);if(Z)Z.key=J,Z.valueFormatter=z.bind(this)}return this.onCellSelectionChanged(),!0}setAggregationComponentValue($,z,Q){let J=this.getAllowedAggregationValueComponent($),Z=C1(this.beans.rowModel);if(T(J)&&J)J.setValue(z,Z),J.setDisplayed(Q);else this.getAggregationValueComponent($)?.setDisplayed(!1)}getAllowedAggregationValueComponent($){let{aggFuncs:z}=this.params;if(!z||z.includes($))return this.getAggregationValueComponent($);return null}getAggregationValueComponent($){let z=`${$}AggregationComp`;return this[z]}onCellSelectionChanged(){let $=this.beans,{rangeSvc:z,valueSvc:Q}=$,J=z?.getCellRanges(),Z=0,X=0n,Y=!1,q=!1,G=0,_=0,H=null,U=null,W=null,B=null,E=(v)=>{if(typeof v==="number"){if(Z+=v,H===null||vU)U=v;if(!Number.isInteger(v)||!Number.isSafeInteger(v))q=!0;else{let C=BigInt(v);if(X+=C,W===null||CB)B=C}}else{if(Y=!0,X+=v,W===null||vB)B=v;let C=Number(v);if(Z+=C,H===null||CU)U=C}_++},K={};if(J?.length&&z)for(let v=0;v{if(m===null)return;let u=b$({rowPinned:m.rowPinned,column:t,rowIndex:m.rowIndex});if(K[u])return;K[u]=!0;let $0=M0($,m);if(n($0))return;let s=Q.getValue(t,$0,"data");if(n(s)||s==="")return;if(G++,typeof s==="object"&&"value"in s){if(s=s.value,s==="")return}if(typeof s==="string"){let f0=s.trim();if(f0==="")return;let O0=Number(f0);if(!Number.isFinite(O0))return;if(Z+O0>=Number.MAX_SAFE_INTEGER||Z+O0<=Number.MIN_SAFE_INTEGER||O0>=Number.MAX_SAFE_INTEGER||O0<=Number.MIN_SAFE_INTEGER){if(s=Gz(f0),s===null)s=O0}else s=O0}if(typeof s==="number"&&!isNaN(s)||typeof s==="bigint")E(s)}),m=L0($,m)}}let L=G>1,D=_>1,F=Y&&!q,M;if(F)M=X/BigInt(_);else M=Z/_;let k=D?F?X:Z:null,V=D?F?W:H:null,R=D?F?B:U:null,O=D?M:null,I=D;this.setAggregationComponentValue("count",G,L),this.setAggregationComponentValue("sum",k,D),this.setAggregationComponentValue("min",V,D),this.setAggregationComponentValue("max",R,D),this.setAggregationComponentValue("avg",O,I)}},UR=class extends I1{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);let $=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:$})}onDataChanged(){let{rowModel:$}=this.beans,z=C1($),Q=nX($);this.setValue(Q,z),this.setDisplayed(z!==Q)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>M$(z,this.getLocaleTextFunc.bind(this)))}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},WR=class extends I1{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");let $=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:$,selectionChanged:$})}onRowSelectionChanged(){let{selectionSvc:$,rowModel:z}=this.beans,Q=$?.getSelectionCount()??0,J=C1(z);if(this.setValue(Q,J),Q<0){this.setDisplayed(!0);return}this.setDisplayed(Q>0)}init($){this.refresh($),this.onRowSelectionChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>{if(z==null||z>=0)return M$(z,this.getLocaleTextFunc.bind(this));return this.getLocaleTextFunc()("statusBarLastRowUnknown","?")})}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},BR=class extends I1{postConstruct(){this.setLabel("totalAndFilteredRows","Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){let{rowModel:$}=this.beans,z=nX($),Q=C1($);this.setValue(z,Q)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z,totalRows:Q})=>{let J=this.getLocaleTextFunc.bind(this),Z=M$(z,J),X=M$(Q??z,J);if(z===Q)return Z;let Y=J();return`${Z} ${Y("of","of")} ${X}`})}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},ER=class extends I1{postConstruct(){this.setLabel("totalRows","Total Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){let $=C1(this.beans.rowModel);this.setValue($,$)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>M$(z,this.getLocaleTextFunc.bind(this)))}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}};function KR($,z){let Q=$.statusBarSvc?.getStatusPanel(z);return m$(Q)}var LR=class extends S{constructor(){super();this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel($,z){this.comps.set($,z)}unregisterStatusPanel($){this.comps.delete($)}unregisterAllComponents(){this.comps.clear()}getStatusPanel($){return this.comps.get($)}destroy(){this.unregisterAllComponents(),super.destroy()}},dX={moduleName:"StatusBar",version:Q0,beans:[LR],userComponents:{agAggregationComponent:HR,agTotalRowCountComponent:ER,agFilteredRowCountComponent:UR,agTotalAndFilteredRowCountComponent:BR,agSelectedRowCountComponent:WR},selectors:[JR],apiFunctions:{getStatusPanel:KR},dependsOn:[I0,iz]};function tX($){if($.excelCreator?.getFactoryMode()==="MULTI_SHEET")return j(161),!1;return!0}function DR($,z){if(tX($))return $.excelCreator?.getDataAsExcel(z);return}function FR($,z){if(tX($))$.excelCreator?.exportDataAsExcel(z)}function MR($,z){return $.excelCreator?.setFactoryMode("MULTI_SHEET"),$.excelCreator?.getSheetDataForExcel(z)}function kR($,z){return $.excelCreator?.getMultipleSheetsAsExcel(z)}function VR($,z){$.excelCreator?.exportMultipleSheetsAsExcel(z)}var sX={moduleName:"ExcelExport",version:Q0,beans:[gV],apiFunctions:{getDataAsExcel:DR,exportDataAsExcel:FR,getSheetDataForExcel:MR,getMultipleSheetsAsExcel:kR,exportMultipleSheetsAsExcel:VR},dependsOn:[S4,I0]};function LZ($){let{filters:z}=$;return z&&z.length>0?z:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function UZ($,z){if($==null)return;for(let Q=$.length-1;Q>=0;Q--)z($[Q],Q)}function AR($,z){if(z.title!=null)return z.title;return $ instanceof xJ?$.getFilterTitle():"Filter"}function WZ($,z,Q,J){let Z=[],X=$?.filterModels;for(let Y=0;YY==null)?null:{filterType:"multi",filterModels:Z}}function n$($,z){return $?.filterModels?.[z]??null}function BZ($,z,Q,J){let Z=Q.filterValueGetter;return Z?$.colFilter.createGetValue(z,Z):J}var rX=class extends G4{constructor(){super({tag:"div",cls:"ag-multi-filter ag-menu-list-compact"});this.filterDefs=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.lastActivatedMenuItem=null}postConstruct(){this.initialiseTabGuard({onFocusIn:($)=>this.onFocusIn($)})}refreshGui($){if($===this.lastOpenedInContainer)return g.resolve();return this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),g.all(this.getFilterWrappers().map((z,Q)=>{if(!z)return g.resolve(null);let J=this.getFilterFromWrapper(z),Z=this.getCompFromWrapper(z),X=this.filterDefs[Q],Y=AR(J,X),q;if(X.display==="subMenu"&&$!=="toolPanel")q=this.insertFilterMenu(Z,J,Y).then((G)=>G.getGui());else if(X.display==="subMenu"||X.display==="accordion"){let G=this.insertFilterGroup(J,Z,Y);q=g.resolve(G.getGui())}else q=g.resolve(Z.getGui());return q})).then((z)=>{z.forEach((Q,J)=>{if(!Q)return;if(J>0)this.appendChild(J0({tag:"div",cls:"ag-filter-separator"}));this.appendChild(Q)}),this.filterGuis=z,this.lastOpenedInContainer=$})}destroyChildren(){for(let $ of this.guiDestroyFuncs)$();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu($,z,Q){let J=$.getGui();_0(J,"dialog");let Z=this.createBean(new eA),X={getGui:()=>$.getGui(),afterGuiAttached:(Y)=>{if($.afterGuiAttached?.(Y),$!==z)z.afterGuiAttached?.(Y)}};return Z.init({menuItemDef:{name:Q,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:fX,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:X,contextParams:{column:null,node:null,value:null}}).then(()=>{Z.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(Z)),this.addManagedListeners(Z,{menuItemActivated:(q)=>{if(this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==q.menuItem)this.lastActivatedMenuItem.deactivate();this.lastActivatedMenuItem=q.menuItem}});let Y=Z.getGui();return Z.addManagedElementListeners(Y,{keydown:(q)=>{let{key:G}=q;switch(G){case A.UP:case A.RIGHT:case A.DOWN:case A.LEFT:if(q.preventDefault(),G===A.RIGHT)Z.openSubMenu(!0);break}},focusin:()=>Z.activate(),focusout:()=>{if(!Z.isSubMenuOpen()&&!Z.isSubMenuOpening())Z.deactivate()}}),Z})}insertFilterGroup($,z,Q){let J=this.createBean(new $A({title:Q,cssIdentifier:"multi-filter"}));if(this.guiDestroyFuncs.push(()=>this.destroyBean(J)),J.addItem(z.getGui()),J.toggleGroupExpand(!1),$.afterGuiAttached)J.addManagedListeners(J,{expanded:()=>$.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})});return J}afterGuiAttached($){let z;if($)this.hidePopup=$.hidePopup,z=this.refreshGui($.container);else this.hidePopup=void 0,z=g.resolve();let Q=$?.suppressFocus;z.then(()=>{let{filterDefs:J,filterGuis:Z,beans:X}=this,Y=this.getFilterWrappers(),q=!!Q;if(J)UZ(J,(_,H)=>{let U=H===0,W=_.display&&_.display!=="inline",B=Q||!U||W,E={...$??{},suppressFocus:B},K=Y[H],L=K?this.getFilterFromWrapper(K):void 0;if(K){let D=this.getCompFromWrapper(K);if(D!==L)D.afterGuiAttached(E)}if(L){if(this.executeFunctionIfExistsOnFilter(L,"afterGuiAttached",E),U&&!B)q=!0}if(!Q&&U&&W){let D=Z[H];if(D){if(!F0(D))D.focus({preventScroll:!0});q=!0}}});let G=d(X);if(!q&&(hz(X)||this.getGui().contains(G)))this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",($)=>this.executeOnWrapper($,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",($)=>this.executeOnWrapper($,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper($,z){}executeFunctionIfExists($,z){UZ(this.getFilterWrappers(),(Q)=>{if(Q)z?.(Q),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(Q),$)})}executeFunctionIfExistsOnFilter($,z,...Q){let J=$[z];if(typeof J==="function")J.apply($,Q)}onFocusIn($){let z=this.lastActivatedMenuItem;if(z!=null&&!z.getGui().contains($.target))z.deactivate(),this.lastActivatedMenuItem=null}},lX=class extends rX{constructor(){super(...arguments);this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init($){this.params=$,this.filterDefs=LZ($);let z=D0(this.beans.colFilter.model,$.column.getColId()),{filterChangedCallback:Q}=$;this.filterChangedCallback=Q;let J=this.filterDefs.map((Z,X)=>this.createFilter(Z,X,z));return new g((Z)=>{g.all(J).then((X)=>{this.wrappers=X,this.refreshGui("columnMenu").then(()=>{Z()})})}).then(()=>{for(let Z of this.afterFiltersReadyFuncs)Z();this.afterFiltersReadyFuncs.length=0})}refresh($){return this.params=$,!0}isFilterActive(){return this.wrappers.some(($)=>{if(!$)return!1;let{filter:z,handler:Q,model:J}=$;if(Q)return J!=null;return z.isFilterActive()})}getLastActiveFilterIndex(){let $=this.activeFilterIndices;return $.length>0?$[$.length-1]:null}doesFilterPass($,z){return this.wrappers.every((Q,J)=>{if(!Q||z!=null&&J===z)return!0;let{handler:Z,filter:X,model:Y}=Q;if(Z)return Y==null||Z.doesFilterPass({...$,model:Y,handlerParams:Q.handlerParams});return!X.isFilterActive()||X.doesFilterPass($)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let Q=z.filter;if(typeof Q.getModelFromUi==="function")return Q.getModelFromUi();return null})}}getModel(){if(!this.isFilterActive())return null;return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let{filter:Q,handler:J,model:Z}=z;if(J)return Z;return Q.isFilterActive()?Q.getModel():null})}}setModel($){let z=(J,Z)=>{return new g((X)=>{let Y=J.setModel(Z);if(Y)Y.then(X);else X()})},Q=[];return this.wrappers.forEach((J,Z)=>{if(!J)return;let X=n$($,Z),{filter:Y,filterParams:q,handler:G,handlerParams:_,state:H}=J;if(G){let U={model:X,state:H?.state};J.state=U,J.model=X,Q.push(sJ(()=>g.resolve({filter:Y,filterParams:q}),G,_,X,U,"api").then(()=>{this.updateActiveListForHandler(Z,J.model)}))}else Q.push(z(Y,X).then(()=>{this.updateActiveListForFilter(Z,Y)}))}),g.all(Q).then(()=>{})}applyModel($="api"){let z=!1;for(let Q of this.wrappers)if(Q){let J=Q.filter;if(J instanceof xJ)z=J.applyModel($)||z}return z}getChildFilterInstance($){return this.wrappers[$]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(let $ of this.wrappers)this.destroyBean($?.filter),this.destroyBean($?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper($){return $.filter}getCompFromWrapper($){return $.comp}executeOnWrapper($,z){$.handler?.[z]?.()}createFilter($,z,Q){let J=this.params.column,Z=null,X,Y=this.beans,q=(B,E)=>{let K=this.wrappers[z];if(!K)return;let L={model:B,state:K.state?.state};K.state=L,K.model=B,sJ(()=>g.resolve({filter:K.filter,filterParams:K.filterParams}),K.handler,K.handlerParams,B,L,"ui").then(()=>{this.onHandlerModelChanged(z,K.model,E)})},{compDetails:G,handler:_,handlerParams:H,createFilterUi:U}=Y.colFilter.createFilterInstance(J,$,"agTextColumnFilter",(B,E)=>{let K={...B,filterChangedCallback:E?()=>{}:(L)=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(z,L))},doesRowPassOtherFilter:(L)=>B.doesRowPassOtherFilter(L)&&this.doesFilterPass({node:L,data:L.data},z),getValue:BZ(Y,J,$,B.getValue)};if(E)Z=n$(Q,z),X=this.updateDisplayParams(K,z,Z,()=>G,()=>_,q);return K});if(!U)return g.resolve(null);let W;if(_){let{doesRowPassOtherFilter:B,getValue:E}=H;W={...H,onModelChange:q,doesRowPassOtherFilter:(K)=>B(K)&&this.doesFilterPass({node:K,data:K.data},z),getValue:BZ(Y,J,$,E)},_.init?.({...W,model:Z,source:"init"})}return U().then((B)=>{if(!_)return{filter:B,comp:B};let E=G?.params,K=X(B);return{filter:B,comp:K,filterParams:E,handler:_,handlerParams:W,model:Z}})}updateDisplayParams($,z,Q,J,Z,X){let Y=this.params.column,q=new K$;$.model=Q,$.state={model:Q},$.onModelChange=X,$.getHandler=Z;let G=(H,U)=>{H.state=U,q.dispatchEvent({type:"filterStateChanged",column:Y,state:U})};$.onStateChange=(H)=>{let U=this.wrappers[z];if(!U)return;G(U,H),SQ(U.filter,U.filterParams,U.model??null,H,"ui")};let _=(H,U,W)=>{let B=this.wrappers[z];if(!B)return;let E=()=>B?.model??null;LJ({action:U,filterParams:B.filterParams,getFilterUi:()=>{let K=g.resolve(B.filter);return{created:!0,filterParams:B.filterParams,compDetails:J(),create:()=>K,promise:K}},getModel:E,getState:()=>B?.state??{model:E()},updateState:(K)=>G(B,K),updateModel:(K)=>B.filterParams?.onModelChange(K,W),processModelToApply:B.handler?.processModelToApply?.bind(B.handler)})};return $.onAction=(H,U,W)=>{_(Y,H,U),q.dispatchEvent({type:"filterAction",column:Y,action:H,event:W})},(H)=>{let U=J()?.params;return this.createManagedBean(new C4(Y,{comp:H,params:U,isHandler:!0},q,_,!1))}}executeWhenAllFiltersReady($){if((this.wrappers?.length??0)>0)$();else this.afterFiltersReadyFuncs.push($)}updateActiveListForFilter($,z){this.updateActiveList($,()=>z?.isFilterActive())}updateActiveListForHandler($,z){this.updateActiveList($,()=>z!=null)}updateActiveList($,z){let Q=this.activeFilterIndices;if(Z0(this.activeFilterIndices,$),z())Q.push($)}onFilterModelChanged($,z){this.updateActiveListForFilter($,this.wrappers[$]?.filter),this.filterChanged($,z)}onHandlerModelChanged($,z,Q){this.updateActiveListForHandler($,z),this.filterChanged($,Q)}filterChanged($,z){this.filterChangedCallback(z),this.wrappers.forEach((Q,J)=>{if($===J||!Q)return;let{filter:Z,handler:X}=Q;if(X?.onAnyFilterChanged?.(),typeof Z.onAnyFilterChanged==="function")Z.onAnyFilterChanged()})}getModelAsString($){if(!$?.filterModels?.length)return"";let z=this.getLastActiveFilterIndex()??0;return this.wrappers[z]?.filter?.getModelAsString?.($.filterModels[z])??""}},SR=class extends S{constructor(){super(...arguments);this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init($){this.params=$;let z=LZ($.filterParams);this.filterDefs=z,z.forEach((Q,J)=>{let Z=this.beans.colFilter.createHandler($.column,Q,"agTextColumnFilter");if(this.handlerWrappers.push(Z),!Z){j(278,{colId:$.column.getColId()});return}let{handler:X,handlerParams:Y}=Z;X.init?.({...this.updateHandlerParams(Y,J,!0),model:n$($.model,J),source:"init"})}),this.resetActiveList($.model)}refresh($){this.params=$;let{model:z,source:Q,filterParams:J}=$,Z=J?.filters;if(this.handlerWrappers.forEach((X,Y)=>{if(X){let q=this.updateHandlerParams($,Y,!1,Z?.[Y].filterParams);X.handlerParams=q,X.handler.refresh?.({...q,model:n$(z,Y),source:Q})}}),$.source!=="floating"&&$.source!=="ui")this.resetActiveList($.model);if($.additionalEventAttributes?.fromButtons)this.onAnyFilterChanged()}updateHandlerParams($,z,Q,J){let{onModelChange:Z,doesRowPassOtherFilter:X,getValue:Y}=$,q={...$,onModelChange:(G,_)=>Z(WZ(this.params.model,this.handlerWrappers.length,G,z),_),doesRowPassOtherFilter:(G)=>X(G)&&this.doesFilterPass({node:G,data:G.data,model:this.params.model,handlerParams:q},z),getValue:BZ(this.beans,$.column,this.filterDefs[z],Y),filterParams:this.updateFilterParams($,Q,J)};return q}updateFilterParams($,z,Q){let J=$.filterParams;if(Q?.buttons&&z)j(292,{colId:$.column.getColId()});let Z=Q?{...J,...Q}:J;if(!Z.buttons)return Z;if(Q)return delete Z.buttons,Z;let{buttons:X,...Y}=Z;return Y}doesFilterPass($,z){let Q=$.model?.filterModels;if(Q==null)return!0;return this.handlerWrappers.every((J,Z)=>{let X=Q[Z];if(X==null||z!=null&&Z===z)return!0;let Y=J?.handler;return!Y||Y.doesFilterPass({...$,model:X,handlerParams:J.handlerParams})})}resetActiveList($){this.activeFilterIndices=[];let z=$?.filterModels;if(z==null)return;for(let Q=0;Q0?$[$.length-1]:null}getModelAsString($,z){let Q=z==="filterToolPanel",J=()=>Q?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!$?.filterModels?.length)return J();let Z=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[Z]?.handler.getModelAsString?.($.filterModels[Z],z)??J()}getHandler($){return this.handlerWrappers[$]?.handler}onAnyFilterChanged(){UZ(this.handlerWrappers,($)=>$?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){UZ(this.handlerWrappers,($)=>$?.handler?.onNewRowsLoaded?.())}destroy(){for(let $ of this.handlerWrappers)this.destroyBean($?.handler);this.handlerWrappers.length=0,super.destroy()}},RR=class extends S{constructor(){super(...arguments);this.beanName="multiFilter"}getParamsForDataType($,z,Q,J){let Z=$?.filters,X=this.beans;if(!Z)Z=[{filter:T4(Q.baseDataType)},{filter:"agSetColumnFilter"}];let Y=this.getLocaleTextFunc();return Z=Z.map((q)=>{let{filter:G,filterParams:_,filterValueGetter:H}=q;if(typeof G!=="string")return q;let{filterParams:U,filterValueGetter:W}=P4(G,_,H??z,Q,J,X,Y);return{...q,filterParams:U,filterValueGetter:W}}),{filterParams:{...$,filters:Z}}}},aX=class extends rX{constructor(){super(...arguments);this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init($){this.params=$;let z=LZ($).map((J)=>{if(J.filterParams?.buttons){j(292,{colId:$.column.getColId()});let Z={...J.filterParams};return delete Z.buttons,{...J,filterParams:Z}}return J});this.filterDefs=z,this.allState=$.state;let Q=this.filterDefs.map((J,Z)=>this.createFilter(J,Z));return new g((J)=>{g.all(Q).then((Z)=>{this.filters=Z,this.refreshGui("columnMenu").then(()=>{J()})})})}refresh($){let{model:z,state:Q,source:J}=$;if(J==="colDef")return!1;this.params=$;let Z=this.filterParams;if(Q===this.allState)return!0;this.allState=Q;let X=Q.state;return this.filters.forEach((Y,q)=>{let G=n$(z,q),_={state:X?.[q],model:n$(Q.model,q)};SQ(Y,Z[q],G,_,J)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance($){return this.filters[$]??void 0}getNumChildFilters(){return this.filters.length}destroy(){for(let $ of this.filters)this.destroyBean($);this.filters.length=0,super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper($){return $}getCompFromWrapper($){return $}createFilter($,z){let Q=this.beans.userCompFactory,J=this.updateParams($,this.params,z),Z=i2(Q,$,J,"agTextColumnFilter");if(!Z)return g.resolve(null);return this.filterParams[z]=Z.params,Z.newAgStackInstance()}updateParams($,z,Q){let{doesRowPassOtherFilter:J,model:Z,onModelChange:X,state:Y,onStateChange:q,column:G,source:_,onAction:H,onUiChange:U,getValue:W}=z,B=n$(Z,Q),E=Y?{model:n$(Y.model,Q),state:Y.state?.[Q]}:{model:B},K=()=>{let D=this.getHandler();this.filters.forEach((F,M)=>{if(Q!==M)D.getHandler(M)?.onAnyFilterChanged?.(),F?.onAnyFilterChanged?.()})},L=this.beans.colFilter;return{...L.createBaseFilterParams(G),...$,doesRowPassOtherFilter:(D)=>J(D)&&this.getHandler().doesFilterPass({node:D,data:D.data,model:this.params.model,handlerParams:L.getHandlerParams(G)},Q),model:B,state:E,onModelChange:(D,F)=>{let{filters:M,params:k}=this,V=WZ(k.model,M.length,D,Q);this.updateActiveList(Q,D),X(V,F),K()},onStateChange:(D)=>this.onStateChange(q,Q,D),getHandler:()=>this.getHandler().getHandler(Q),onAction:(D,F,M)=>{if(W1(z))return;let k=D==="apply"||D==="reset";if(k)this.updateActiveList(Q,n$(this.params.state.model,Q));if(H(D,F,M),k)K()},onUiChange:U,source:_,getValue:BZ(this.beans,G,$,W)}}updateActiveList($,z){this.getHandler().updateActiveList?.($,z)}getHandler(){return this.params.getHandler()}onStateChange($,z,Q){let{model:J,state:Z,valid:X}=Q,Y=this.validity;Y[z]=X;let q=this.allState,G=WZ(q.model,this.filters.length,J,z),_=Y.every((W)=>W!==!1),H=[...q.state??[]];H[z]=Z;let U={state:H,model:G,valid:_};this.allState=U,$(U)}getModelAsString($){return this.getHandler().getModelAsString?.($)??""}},jR={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},fR=class extends x{constructor(){super(jR);this.floatingFilters=[],this.compDetailsList=[]}init($){this.params=$;let{compDetailsList:z}=this.getCompDetailsList($);return this.setParams(z)}setParams($){let z=[];return $.forEach((Q)=>{let J=Q?.newAgStackInstance();if(J!=null)this.compDetailsList.push(Q),z.push(J)}),g.all(z).then((Q)=>{Q.forEach((J,Z)=>{this.floatingFilters.push(J);let X=J.getGui();if(this.appendChild(X),Z>0)N(X,!1)})})}refresh($){this.params=$;let{compDetailsList:z,floatingFilterParamsList:Q}=this.getCompDetailsList($);if(z.length===this.compDetailsList.length&&z.every((Z,X)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[X],Z))){if(Q.forEach((Z,X)=>{this.floatingFilters[X].refresh?.(Z)}),this.gos.get("enableFilterHandlers")){let Z=$;if(Z.model==null)this.floatingFilters.forEach((X,Y)=>{N(X.getGui(),Y===0)});else{let X=Z.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((Y,q)=>{let G=X==null?q===0:q===X;N(Y.getGui(),G)})}}}else z0(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(z)}getCompDetailsList($){let z=[],Q=[],J=$.filterParams,Z=$.currentParentModel,X=LZ(J);return X.forEach((Y,q)=>{let G={...$,parentFilterInstance:(H)=>{this.parentMultiFilterInstance((U)=>{let W=U.getChildFilterInstance(q);if(W==null)return;H(W)})},currentParentModel:()=>Z()?.filterModels?.[q]??null};if(this.gos.get("enableFilterHandlers")){let H=G;H.model=H.model?.filterModels?.[q]??null;let{onModelChange:U,getHandler:W}=H;H.onModelChange=(B,E)=>U(WZ(this.params.model,X.length,B,q),E),H.getHandler=()=>{return W().getHandler(q)}}B0(G.filterParams,Y.filterParams);let _=this.getCompDetails(Y,G);if(_)z.push(_),Q.push(G)}),{compDetailsList:z,floatingFilterParamsList:Q}}onParentModelChanged($,z){if(z?.afterFloatingFilter)return;this.parentMultiFilterInstance((Q)=>{if($==null)this.floatingFilters.forEach((J,Z)=>{J.onParentModelChanged(null,z),N(J.getGui(),Z===0)});else{let J=Q.getLastActiveFilterIndex();this.floatingFilters.forEach((Z,X)=>{let Y=$.filterModels.length>X?$.filterModels[X]:null;Z.onParentModelChanged(Y,z);let q=J==null?X===0:X===J;N(Z.getGui(),q)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails($,z){let{colFilter:Q,frameworkOverrides:J,userCompFactory:Z}=this.beans,X=v4(J,$,()=>Q.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return n2(Z,$,z,X)}parentMultiFilterInstance($){this.params.parentFilterInstance((z)=>{if(!(z instanceof lX||z instanceof aX))e(120);$(z)})}},oX={moduleName:"MultiFilter",version:Q0,userComponents:{agMultiColumnFilter:{getComp:($)=>$.gos.get("enableFilterHandlers")?{classImp:aX,params:{useForm:!0}}:lX},agMultiColumnFloatingFilter:fR},beans:[RR],dynamicBeans:{agMultiColumnFilterHandler:SR},dependsOn:[I0,B9,Q5]},OR=class extends S{constructor(){super(...arguments);this.beanName="aggColNameSvc"}getHeaderName($,z){if(this.gos.get("suppressAggFuncInHeader"))return z;let{valueColsSvc:Q,colModel:J,rowGroupColsSvc:Z}=this.beans,X=$.getColDef().pivotValueColumn,Y=T(X),q=null,G;if(Y){let _=Q?.columns??[],H=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&_.length===1,U=$.getColDef().pivotTotalColumnIds!==void 0;if(H&&!U)return z;q=X?X.getAggFunc():null,G=!0}else{let _=$.isValueActive(),H=Z?.columns.length!==0,U=J.isPivotMode()||H||this.gos.get("treeData");if(_&&U)q=$.getAggFunc(),G=!0;else G=!1}if(G){let _=typeof q==="string"?q:"func";return`${this.getLocaleTextFunc()(_,_)}(${z})`}return z}},PR={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},TR=class extends S{constructor(){super(...arguments);this.beanName="aggFuncSvc",this.aggFuncsMap={},this.initialised=!1}postConstruct(){this.init()}init(){if(this.initialised)return;this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs"))}initialiseWithDefaultAggregations(){let $=this.aggFuncsMap;$.sum=vR,$.first=IR,$.last=CR,$.min=bR,$.max=yR,$.count=wR,$.avg=gR,this.initialised=!0}isAggFuncPossible($,z){let J=this.getFuncNames($).includes(z),Z=T(this.aggFuncsMap[z]);return J&&Z}getDefaultFuncLabel($){return PR[$]??$}getDefaultAggFunc($){let z=$.getColDef().defaultAggFunc;if(T(z)&&this.isAggFuncPossible($,z))return z;if(this.isAggFuncPossible($,"sum"))return"sum";let Q=this.getFuncNames($);return Q?.length?Q[0]:null}addAggFuncs($){if(this.init(),!$)return;for(let z of Object.keys($))if($[z])this.aggFuncsMap[z]=$[z]}getAggFunc($){return this.init(),this.aggFuncsMap[$]}getFuncNames($){let z=$.getColDef().allowedAggFuncs;return z==null?Object.keys(this.aggFuncsMap).sort():z}clear(){this.aggFuncsMap={}}};function vR($){let{values:z}=$,Q=null;for(let J=0;J0?$.values[0]:null}function CR($){return $.values.length>0?b($.values):null}function bR($){let{values:z}=$,Q=null;for(let J=0;JZ))Q=Z}return Q}function yR($){let{values:z}=$,Q=null;for(let J=0;J0)Z=Q/(typeof Q==="number"?J:BigInt(J));let X=$.rowNode?.aggData?.[$.column?.getColId()];if(X&&X.count===J&&X.value===Z)return X;let Y=Object.create(NR);return Y.count=J,Y.value=Z,Y}var hR=class extends S{constructor(){super(...arguments);this.beanName="aggChildrenSvc"}getAggregatedChildren($,z,Q){if(!$?.group)return[];if($.rowPinned){if($=$.pinnedSibling,!$)return[]}let J=this.gos,Z=eX($,z,J);if(!Q)return Z;let X=[];return $Y(Z,z,J,X),X}},eX=($,z,Q)=>{let J=z?.colDef,Z=J?.pivotKeys;if(Z){if($.leafGroup&&Z.length&&!J.pivotTotalColumnIds)return yX($.childrenMapped,Z);return $.childrenAfterFilter??$.childrenAfterGroup??[]}if(T$(Q)||Q.get("suppressAggFilteredOnly"))return $.childrenAfterGroup??[];return $.childrenAfterFilter??$.childrenAfterGroup??[]},$Y=($,z,Q,J)=>{for(let Z=0,X=$.length;Z{w9(R,null,k)})}return}this.hadAgg=!0;let{colModel:X,aggFuncSvc:Y}=Q,q=z.get("alwaysAggregateAtRootLevel")||!!Hz(z)||X.isPivotMode(),G=!T$(z)&&!z.get("suppressAggFilteredOnly"),_=Q.valueSvc,H=Q.gridApi,U=Q.gridOptions.context,W=Z??[],B=W.length,E=$?.kind==="cells"?$:void 0,K,L=Array(B);for(let k=0;k=0)K=E;L[k]={column:V,colId:V.colId,colDef:V.colDef,aggFunc:zY(V.getAggFunc(),Y,V),colSlot:R}}let D=dR(X,Q.pivotResultCols,Y),F=B>0?Array(B):null,M=Q.rowModel;S0(M.rootNode,M.hierarchical,$,(k)=>{if(k.level===-1&&!q){OQ(k,null,X);return}let V;if(J)V=J({nodes:k.childrenAfterFilter});else if(!F)V=null;else if(D)V=nR(k,D,_,H,U);else V=iR(k,L,B,F,K,G,_,H,U);w9(k,V,X)})}},iR=($,z,Q,J,Z,X,Y,q,G)=>{let _=(X?$.childrenAfterFilter:$.childrenAfterGroup)??[],H=_.length,U=$.data,W=Object.create(null),B=Z?Z.getSlot($):-1,E=B>=0?$.aggData:void 0,K=0;for(let L=0;L=0&&!Z.hasCellBySlot(B,D.colSlot)){if(J[L]=null,E)W[D.colId]=E[D.colId]}else J[L]=Array(H),++K}if(K===0)return W;for(let L=0;L{let X=z.length,Y=$.leafGroup,q=$.data,G=$.childrenMapped,_=$.childrenAfterFilter??[],H=Object.create(null),U,W;for(let B=0;B{if(typeof $==="function")return $;if($==null)return null;let J=z.getAggFunc($);if(typeof J!=="function")return j(109,{inputValue:$.toString(),allSuggestions:z.getFuncNames(Q)}),null;return J},dR=($,z,Q)=>{if(!$.isPivotActive())return null;let J=z?.getAggregationOrderedList();if(!J||J.length===0)return null;let Z=J.length,X=Array(Z),Y=0;for(let q=0;q{let z=$.childrenAfterAggFilter,Q=0;if(z){let Z=z.length;Q=Z;for(let X=0;X=0?null:Q;$.setAllChildrenCount(J),$.pinnedSibling?.setAllChildrenCount(J)},this.setAllChildrenCountGridGrouping=($)=>{let z=$.childrenAfterAggFilter,Q=0;for(let J=0,Z=z.length;J!E.node.group,_=(E)=>E.node.leafGroup,H=T$(this.gos)||(X?_:G),U=q?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,W=(E,K=!1)=>{if(E.childrenAfterFilter){if(E.childrenAfterAggFilter=E.childrenAfterFilter,K){let L=E.childrenAfterAggFilter;for(let D=0,F=L.length;D{if(E.childrenAfterAggFilter=E.childrenAfterFilter?.filter((K)=>{if(H({node:K})){if(Z.doesRowPassAggregateFilters({rowNode:K}))return W(K,!0),!0}return K.childrenAfterAggFilter?.length})||null,E.hasChildren())U(E);else E.setAllChildrenCount(null),E.pinnedSibling?.setAllChildrenCount(null);if(E.sibling)E.sibling.childrenAfterAggFilter=E.childrenAfterAggFilter};S0(z.rootNode,z.hierarchical,$,Y?B:W)}};function O1($,z){if($.sibling)return;let Q=y7($,z);Q.footer=!0,Q.setRowTop(null),Q.setRowIndex(null),Q.oldRowTop=null,Q.id="rowGroupFooter_"+$.id,Q.sibling=$,$.sibling=Q}function sR($){let z=$.sibling;if(!z)return;z._destroy(!1),$.sibling=void 0,z.sibling=void 0}var rR=class extends S{constructor(){super(...arguments);this.beanName="footerSvc"}addTotalRows($,z,Q,J,Z,X){let Y=$;if(Z){let _=J&&Hz(this.gos);if(lR(X,_))O1(z,this.beans),Q(z.sibling,Y++);return Y}let q=fJ(this.gos);if((J&&q({node:z}))===X)O1(z,this.beans),Q(z.sibling,Y++);return Y}getTopDisplayIndex($,z,Q,J){let Z=z;if($[0].footer){if(z===0)return 0;Z-=1}let X=$[$.length-1],Y=Z>=Q.length;if(X.footer&&Y)return X.rowIndex;return J(Z)}doesCellShowTotalPrefix($,z){if(!$.footer||!z?.getColDef().showRowGroup)return!1;if(this.gos.get("treeData"))return!0;if($.level===-1)return this.beans.showRowGroupCols?.columns[0]===z;return!!$.rowGroupColumn&&z?.isRowGroupDisplayed($.rowGroupColumn.getId())}applyTotalPrefix($,z,Q,J){let Z=J.getColDef().cellRendererParams?.totalValueGetter;if(Z){let X=y(this.gos,{column:J,node:Q,value:$,formattedValue:z});if(typeof Z==="function")return Z(X);if(typeof Z==="string")return this.beans.expressionSvc?.evaluate(Z,X);j(179)}if(Q.level===-1)return this.getLocaleTextFunc()("footerTotal","Total")+" ";return this.getTotalValue(z??$)??""}getTotalValue($){return this.getLocaleTextFunc()("footerTotal","Total")+" "+($??"")}};function lR($,z){switch(z){case"top":case"pinnedTop":return $==="top";case"bottom":case"pinnedBottom":return $==="bottom";default:return!1}}var QY=class extends RQ{constructor(){super(...arguments);this.beanName="valueColsSvc",this.eventName="columnValueChanged",this.columnProcessors={set:($,z,Q)=>this.setValueActive(z,$,Q),add:($,z,Q)=>this.setValueActive(!0,$,Q),remove:($,z,Q)=>this.setValueActive(!1,$,Q)},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColValueActive($,z,Q),getIndexFunc:()=>{return},getInitialIndexFunc:()=>{return},getValueFunc:($)=>{let z=$.aggFunc;if(z===null||z==="")return null;if(z===void 0)return;return!!z},getInitialValueFunc:($)=>{return $.initialAggFunc!=null&&$.initialAggFunc!=""}},this.modifyColumnsNoEventsCallbacks={addCol:($)=>this.columns.push($),removeCol:($)=>Z0(this.columns,$)}}extractCols($,z){this.columns=super.extractCols($,z);for(let Q of this.columns){let J=Q.getColDef();if(J.aggFunc!=null&&J.aggFunc!="")this.setColAggFunc(Q,J.aggFunc);else if(!Q.getAggFunc())this.setColAggFunc(Q,J.initialAggFunc)}return this.columns}setColumnAggFunc($,z,Q){if(!$)return;let J=this.colModel.getColDefCol($);if(!J)return;this.setColAggFunc(J,z),this.dispatchColumnChangedEvent(this.eventSvc,this.eventName,[J],Q)}syncColumnWithState($,z,Q){let J=Q("aggFunc").value1;if(J!==void 0)if(typeof J==="string"){if(this.setColAggFunc($,J),!$.isValueActive())this.setColValueActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($)}else{if(T(J))j(33);if($.isValueActive())this.setColValueActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setValueActive($,z,Q){if($===z.isValueActive())return;if(this.setColValueActive(z,$,Q),$&&!z.getAggFunc()&&this.aggFuncSvc){let J=this.aggFuncSvc.getDefaultAggFunc(z);this.setColAggFunc(z,J)}}setColAggFunc($,z){$.aggFunc=z,$.dispatchStateUpdatedEvent("aggFunc")}setColValueActive($,z,Q){if($.aggregationActive!==z)$.aggregationActive=z,$.dispatchColEvent("columnValueChanged",Q)}},JY={moduleName:"SharedAggregation",version:Q0,beans:[TR,OR,rR,QY],apiFunctions:{addAggFuncs:uR,clearAggFuncs:mR,setColumnAggFunc:cR},dependsOn:[I0]},aR={moduleName:"Aggregation",version:Q0,beans:[pR,tR,hR],rowModels:["clientSide"],dependsOn:[JY]},ZY=class extends RQ{constructor(){super(...arguments);this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.columnProcessors={set:($,z,Q)=>this.setColPivotActive($,z,Q),add:($,z,Q)=>this.setColPivotActive($,!0,Q),remove:($,z,Q)=>this.setColPivotActive($,!1,Q)},this.columnOrdering={enableProp:"pivot",initialEnableProp:"initialPivot",indexProp:"pivotIndex",initialIndexProp:"initialPivotIndex"},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColPivotActive($,z,Q),getIndexFunc:($)=>$.pivotIndex,getInitialIndexFunc:($)=>$.initialPivotIndex,getValueFunc:($)=>$.pivot,getInitialValueFunc:($)=>$.initialPivot},this.modifyColumnsNoEventsCallbacks={addCol:($)=>{if(!this.columns.includes($))this.columns.push($)},removeCol:($)=>Z0(this.columns,$)}}syncColumnWithState($,z,Q,J){let{value1:Z,value2:X}=Q("pivot","pivotIndex");if(Z!==void 0||X!==void 0){if(typeof X==="number"||Z){if(!$.isPivotActive())this.setColPivotActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($);if(J&&typeof X==="number")J[$.getId()]=X}else if($.isPivotActive())this.setColPivotActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setColPivotActive($,z,Q){if($.pivotActive!==z){if($.pivotActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,$)?.forEach((Z)=>this.setColPivotActive(Z,z,Q));$.dispatchColEvent("columnPivotChanged",Q)}$.dispatchStateUpdatedEvent("pivot")}},oR=class extends RQ{constructor(){super(...arguments);this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.columnProcessors={set:($,z,Q)=>this.setActive(z,$,Q),add:($,z,Q)=>this.setActive(!0,$,Q),remove:($,z,Q)=>this.setActive(!1,$,Q)},this.columnOrdering={enableProp:"rowGroup",initialEnableProp:"initialRowGroup",indexProp:"rowGroupIndex",initialIndexProp:"initialRowGroupIndex"},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColRowGroupActive($,z,Q),getIndexFunc:($)=>$.rowGroupIndex,getInitialIndexFunc:($)=>$.initialRowGroupIndex,getValueFunc:($)=>$.rowGroup,getInitialValueFunc:($)=>$.initialRowGroup},this.modifyColumnsNoEventsCallbacks={addCol:($)=>{if(!this.columns.includes($))this.columns.push($)},removeCol:($)=>Z0(this.columns,$)}}moveColumn($,z,Q){if(this.columns.length===0)return;let J=this.columns[$],Z=this.columns.slice($,z);this.columns.splice($,1),this.columns.splice(z,0,J),this.updateIndexMap(),this.eventSvc.dispatchEvent({type:this.eventName,columns:Z,column:Z.length===1?Z[0]:null,source:Q})}syncColumnWithState($,z,Q,J){let{value1:Z,value2:X}=Q("rowGroup","rowGroupIndex");if(Z!==void 0||X!==void 0){if(typeof X==="number"||Z){if(!$.isRowGroupActive())this.setColRowGroupActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($);if(J&&typeof X==="number")J[$.getId()]=X}else if($.isRowGroupActive())this.setColRowGroupActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setActive($,z,Q){if($===z.isRowGroupActive())return;this.setColRowGroupActive(z,$,Q);let J=this.beans.groupHierarchyColSvc?.getColumn(z);if(PJ(this.gos,$)&&!J)this.colModel.setColsVisible([z],!$,Q)}setColRowGroupActive($,z,Q){if($.rowGroupActive!==z){if($.rowGroupActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,$)?.forEach((Z)=>this.setColRowGroupActive(Z,z,Q));$.dispatchColEvent("columnRowGroupChanged",Q)}$.dispatchStateUpdatedEvent("rowGroup")}},eR=class extends S{constructor(){super(...arguments);this.beanName="autoColSvc"}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){let $=()=>this.updateGroupColumnVisibility();this.addManagedEventListeners({modelUpdated:$}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],$)}addColumns($){let{columns:z}=this;if(z==null)return;$.list=z.list.concat($.list),$.tree=z.tree.concat($.tree),_1($)}createColumns($,z,Q){let J=this.beans,{colModel:Z,gos:X,rowGroupColsSvc:Y,colGroupSvc:q}=J,G=Z.isPivotMode(),_=OJ(X,G),H=G?X.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),U=Y?.columns,B=!(U&&U.length>0||X.get("treeData"))||H||_,E=()=>{if(this.columns)J$(J,this.columns.tree),this.columns=null};if(B){E();return}let K=this.generateAutoCols(U),L=G1(K,this.columns?.list||null),D=$.treeDepth,M=(this.columns?this.columns.treeDepth:-1)==D;if(L&&M){let O=new Map(K.map((I)=>[I.getId(),I]));for(let I of this.columns?.list??[]){let v=O.get(I.getId());if(v)I.setColDef(v.getColDef(),null,Q)}return}E();let k=q?.findDepth($.tree)??0,V=q?.balanceTreeForAutoCols(K,k)??[];this.columns={list:K,tree:V,treeDepth:k,map:{}},z((O)=>{if(!O)return null;let I=O.filter((v)=>!mz(v));return[...K,...I]})}updateColumns($){let z=Xz($.source);this.columns?.list.forEach((Q,J)=>this.updateOneAutoCol(Q,J,z))}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}generateAutoCols($=[]){let z=[],{gos:Q}=this,J=Q.get("treeData"),Z=Y1(Q);if(J&&Z)j(182),Z=!1;if(Z)$.forEach((X,Y)=>{z.push(this.createOneAutoCol(X,Y))});else z.push(this.createOneAutoCol());return z}isSuppressAutoCol(){let $=this.gos;if($.get("groupDisplayType")==="custom")return!0;return $.get("treeDataDisplayType")==="custom"}createOneAutoCol($,z){let Q;if($)Q=`${uz}-${$.getId()}`;else Q=uz;let J=this.createAutoColDef(Q,$,z);J.colId=Q;let Z=new q$(J,null,Q,!0);return this.createBean(Z),Z}updateOneAutoCol($,z,Q){let J=$.getColDef(),Z=typeof J.showRowGroup=="string"?J.showRowGroup:void 0,X=this.beans,Y=Z!=null?X.colModel.getColDefCol(Z):void 0,q=$.getId(),G=this.createAutoColDef(q,Y??void 0,z);$.setColDef(G,null,Q),n0(X,{state:[c2(G,q)]},Q)}createAutoColDef($,z,Q){let J=this.createBaseColDef(z),Z=this.gos.get("autoGroupColumnDef");if(B0(J,Z),J=u$(this.beans,J,$,!0),Z?.groupRowEditable==null)J.groupRowEditable=void 0;if(Z?.groupRowValueSetter==null)J.groupRowValueSetter=void 0;if(!this.gos.get("treeData")){if(n(J.field)&&n(J.valueGetter)&&n(J.filterValueGetter)&&J.filter!=="agGroupColumnFilter")J.filter=!1}if(Q&&Q>0)J.headerCheckboxSelection=!1;let X=W$(this.gos),Y=J.valueGetter||J.field!=null;if(X&&!Y)J.sortIndex=void 0,J.initialSort=void 0;return J}createBaseColDef($){let z=this.gos.get("autoGroupColumnDef"),J={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:$?.getColId()??!0};if(!(z&&(z.cellRenderer||z.cellRendererSelector)))J.cellRenderer="agGroupCellRenderer";if($)J.headerName=this.beans.colNames.getDisplayNameForColumn($,"header")??void 0,J.headerValueGetter=$.colDef.headerValueGetter;return J}getDeepestExpandedLevel($,z){let Q=-1;if(!$)return Q;for(let J of $){if(!J.group||!J.expanded)continue;if(J.level>Q)Q=J.level;if(Q>=z)return Q;let Z=this.getDeepestExpandedLevel(J.childrenAfterGroup,z);if(Z>Q)Q=Z;if(Q>=z)return Q}return Q}updateGroupColumnVisibility(){let $=this.columns?.list;if(!$||$.length===0)return;let{gos:z,visibleCols:Q,rowModel:J}=this.beans,Z=w2(z),X=!1,Y=(G,_)=>{if(_!==G.isVisible())G.setVisible(_,"api"),X=!0},q=()=>{for(let G of $)Y(G,!0)};if(!Z)q();else if($.length>1){let G=$.length-2,_=J?.rootNode?.childrenAfterGroup,H=this.getDeepestExpandedLevel(_,G);if(H>=G)q();else for(let U=0;U<$.length-1;U++)Y($[U+1],H>=U)}if(X)Q.refresh("api")}destroy(){J$(this.beans,this.columns?.tree),super.destroy()}},o4=null,p9=($)=>{let z=o4,Q=new Uint32Array(1<<32-Math.clz32($|63));if(z)Q.set(z);return o4=Q,Q},$j=($,z,Q,J)=>{let Z=z-J,X=Q-1;if(Z===1){let _=0;while($[_].level===X)++_;if(_0){let H=$[_];$.copyWithin(1,0,_),$[0]=H}return $}let Y=Array(Z),q=0,G=0;for(let _=0;_{let Q=$[0].level+1,J=Q,Z=0,X=Q,Y=o4;if(!Y||Q>=Y.length)Y=p9(Q);++Y[Q];for(let U=1;UQ){if(Q=W,Q>=Y.length)Y=p9(Q)}else if(W=0)return Y.fill(0,J,Q+1),$;let q=Y[J],G=Y[Q];if(q+G===z)return Y[J]=0,Y[Q]=0,$j($,z,Q,G);let _=0;for(let U=Q;U>=J;--U){let W=Y[U];Y[U]=_,_+=W}let H=Array(z);for(let U=0;U{if(z===2){if($[0].level<$[1].level){let Q=$[0];$[0]=$[1],$[1]=Q}return $}if(z>16)return zj($,z);for(let Q=1;Q=0&&$[X].level=0)Q.set(z,-1),z=z.parent;return}let J=this.rows;do Q.set(z,-1),J.push(z),z=z.parent;while(z!=null&&!Q.has(z));this.unsorted=!0}addCell($,z){if(z==null){this.addRow($);return}if($==null)return;let Q=this.slots,J=this.bits,Z=Q.get(z)??this.ensureCol(z),X=Q.get($);if(X===void 0)X=this.ensureRow($);else if(X<0)return;let Y=Z<32?J:this.extraBits[(Z>>>5)-1],q=1<<(Z&31),G=Y[X];if((G&q)!==0)return;Y[X]=G|q;let _=$.parent;while(_!=null){let H=Q.get(_);if(H<0)break;let U=Y[H];if((U&q)!==0)break;Y[H]=U|q,_=_.parent}}hasRow($){return this.slots.has($)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let $=XY(this.rows);return this.rows=$,$}getSlot($){return this.slots.get($)??-1}hasCellBySlot($,z){if($<0)return!0;if(z<32)return z>=0&&(this.bits[$]&1<>>5)-1][$]&1<<(z&31))!==0}ensureRow($){let z=this.slots,Q=this.rows,J=this.bits,Z=this.extraBits,X=J.push(0),Y=X-1;if(Z!==null)for(let G=0,_=Z.length;G<_;++G)Z[G].push(0);z.set($,Y),Q.push($),this.unsorted=!0;let q=$.parent;while(q!=null&&!z.has(q)){if(z.set(q,X),Q.push(q),X=J.push(0),Z!==null)for(let G=0,_=Z.length;G<_;++G)Z[G].push(0);q=q.parent}return Y}ensureCol($){let z=this.colCount++;if(this.slots.set($,z),z>=32){let Q=(z>>>5)-1,J=this.extraBits;if(J===null)J=[],this.extraBits=J;if(Q>=J.length)J.push(Array(this.bits.length).fill(0))}return z}},i9=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow($){let z=$;if(z==null)return;let Q=this.rowSet;if(Q.has(z))return;let J=this.rows;do Q.add(z),J.push(z),z=z.parent;while(z!=null&&!Q.has(z));this.unsorted=!0}addCell($,z){this.addRow($)}hasRow($){return this.rowSet.has($)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let $=XY(this.rows);return this.rows=$,$}},Jj=class extends S{constructor(){super(...arguments);this.beanName="changedPathFactory"}newPath($){return $?new Qj:new i9}ensureRowsPath($){let z=$.changedPath;if(!z&&$.changedRowNodes&&!$.newData){let Q=this.beans.rowModel;if(Q.hierarchical)z=new i9,$.changedPath=z,z.addRow(Q.rootNode)}return z}},Zj=class extends S{addExpandedCss($,z){if(z.isExpandable())$.push("ag-row-group"),$.push(z.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners($){let{rowNode:z}=$,Q=this.updateExpandedCss.bind(this,$,z);return{expandedChanged:Q,hasChildrenChanged:Q}}setExpanded($,z,Q,J){if($.expanded===z)return;$._expanded=z,$.dispatchRowEvent("expandedChanged");let Z={...a2($,this.gos,"rowGroupOpened"),expanded:z,event:Q||null};this.dispatchExpandedEvent(Z,J)}defaultExpanded($){let Q=this.beans.gos,J=$.level??0,Z=$.group&&Q.get("isGroupOpenByDefault");if(!Z){let Y=Q.get("groupDefaultExpanded");return Y===-1||J{let X=Z.rowComp;X.toggleCss("ag-row-group",Q),X.toggleCss("ag-row-group-expanded",Q&&J),X.toggleCss("ag-row-group-contracted",Q&&!J),w0(Z.element,Q&&J)})}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},Xj=class extends Zj{constructor(){super(...arguments);this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState($){let z=new Set($.expandedRowGroupIds);this.beans.rowModel.forEachNode((Q)=>{let J=Q.id;if(!J)return;Q._expanded=z.has(J)}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState($=!1){let z=[],Q=[];return this.beans.rowModel.forEachNode((J)=>{let Z=J.id;if(!Z)return;if(J.expanded)z.push(Z);else if($&&J.isExpandable())Q.push(Z)}),{expandedRowGroupIds:z,collapsedRowGroupIds:Q}}getExpansionState(){return this.getInternalExpansionState()}isExpanded($){if($.footer)return!!$._expanded;if(!($.group||$.master)||$.leafGroup&&this.beans.colModel.isPivotMode())return!1;let z=$._expanded;if(z===null)z=this.defaultExpanded($)??!1,$._expanded=z;return!!z}resetExpansion(){let{rowModel:$}=this.beans;$.forEachNode((z)=>{if(!z.group&&!z.master)return;z._expanded=null}),this.onGroupExpandedOrCollapsed()}expandAll($){let{gos:z,rowModel:Q,colModel:J,eventSvc:Z}=this.beans,X=z.get("treeData"),Y=J.isPivotActive(),q=(_)=>{if(!_)return;for(let H of _){let U=()=>{H._expanded=$,q(H.childrenAfterGroup)};if(H.master){U();continue}if(X){if(T(H.childrenAfterGroup))U();continue}if(Y){if(!H.leafGroup)U();continue}if(H.group)U()}},G=Q.rootNode;if(G)q(G.childrenAfterGroup);this.onGroupExpandedOrCollapsed(),Z.dispatchEvent({type:"expandOrCollapseAll",source:$?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState($){let z=this.getInternalExpansionState(!0),Q=z.collapsedRowGroupIds.length===0;if(z.expandedRowGroupIds.length===0===Q)return;return Q?$.expandAll():$.collapseAll()}dispatchExpandedEvent($,z){if((this.events??(this.events=[])).push($),z){this.dispatchExpandedEvents();return}let Q=this.dispatchExpandedDebounced;if(!Q){if(!this.isAlive())return;Q=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=Q}Q()}dispatchExpandedEvents(){let{eventSvc:$,rowRenderer:z}=this.beans,Q=this.events,J=Q?.length;if(!J)return;this.events=null;let Z=Array(J);for(let X=0;Xwindow.setTimeout($,0);let Q=!1;return()=>{if(!z.active){window.setTimeout($,0);return}if(Q)return;Q=!0,z.addDestroyTask(()=>{Q=!1,$()})}}};function Yj($){let z=$.get("groupHideParentOfSingleChild");if(!z){if(z=$.get("groupRemoveSingleChildren"),!z&&$.get("groupRemoveLowestSingleChildren"))z="leafGroupsOnly"}return{groupHideParentOfSingleChild:z,isGroupMultiAutoColumn:Y1($),hideOpenParents:$.get("groupHideOpenParents"),grandTotalRow:Hz($),groupTotalRow:fJ($)}}function qj($,z,Q){return $.groupHideParentOfSingleChild===!0&&Q&&z.childrenAfterGroup.length===1}function Gj($,z,Q){return $.groupHideParentOfSingleChild==="leafGroupsOnly"&&Q&&z.leafGroup&&z.childrenAfterGroup.length===1}function _j($,z,Q,J,Z,X){if(J&&!Q)return!1;if(Z||X)return!1;if(!$.hideOpenParents)return!0;if(z.master||z.level===-1)return!0;if(!(J&&z.leafGroup)&&z.expanded)return!1;return!0}var Hj=class extends S{constructor(){super(...arguments);this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){let{beans:$,gos:z}=this,Q=[],J=$.rowModel.rootNode;if(!J)return Q;let Z=$.colModel.isPivotMode(),X=Z&&J.leafGroup&&J.aggData,Y=X?[J]:J.childrenAfterSort,q=Yj(z);this.recursivelyAddToRowsToDisplay(q,Y,Q,Z,0);let G=Q.length>0,_=q.grandTotalRow;if(!X&&G&&_)if(O1(J,$),_==="pinnedBottom"||_==="pinnedTop")this.beans.pinnedRowModel?.setGrandTotalPinned(_==="pinnedBottom"?"bottom":"top");else{let U=_==="top";this.addRowNodeToRowsToDisplay(q,J.sibling,Q,0,U)}return Q}recursivelyAddToRowsToDisplay($,z,Q,J,Z){if(!z?.length)return;let X=this.beans.masterDetailSvc;for(let Y=0;Ythis.onCsrmCellChange($),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop($){if(!$.rowDragManaged||!$.sameGrid)return!1;if(!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.isPivotMode()}initDraggingGroups($){let z=new Map,Q=(J)=>{let Z=J.childrenAfterGroup;if(Z){if(z.has(J))return;let X=Z.slice();z.set(J,X);for(let Y of X)Q(Y)}};for(let J of $.rows)if(J.group)Q(J);this.draggingGroups=z}canSetParent($){if(!$.sameGrid)return!1;if(this.beans.groupStage?.treeData)return!0;if($.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length}canDropRow($,z){if(this.beans.groupStage?.treeData)return!Wj($,z.newParent);let{position:Q,target:J,newParent:Z,rootNode:X}=z,Y=$.parent;if($.group&&(d9($,J)||d9($,Z)))return!1;if(Q==="inside")return!0;if(Z&&Z!==Y)return Z!==X||Y===X;let q=Z??J?.parent??X;if(q!==Y)return!1;let G=$.group?$.level:Y.level??-1,_=-1;if(J)_=J.group?J.level:J.parent?.level??-1;else if(q)_=q.level;if(G>=0&&_>=0&&_!==G)return!1;return!0}fixRowsDrop($,z,Q,J){let Z=!!this.beans.groupStage?.treeData;if($.treeData=Z,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!Z)return;if(!this.draggingGroups&&this.isGroupingDrop($)&&!$.suppressMoveWhenRowDragging)this.initDraggingGroups($);let Y=$.target,q=null,G=!1,_=$.rootNode,H=this.beans.rowModel,U=this.canStartGroup(Y,Z);this.updateDropTarget($,Q,U);let W=this.beans.pageBounds?.getLastRow?.()??H.getRowCount()-1;if(z){if(!Y||J>=0.5&&Y.rowIndex===W)q=_;else if($.moved&&Y&&this.dropGroupThrottled&&this.shouldDropTargetBeParent($))q=Y;if(!q)q=Y?.parent??_}if(!Q&&Y&&U&&!(Y.group&&Y.expanded))this.startDropGroupDelay(Y);if(q){if(Y&&q===Y&&q!==_){let B=q.expanded?x7(H,1,Y):null;if(B?.parent===q)Y=B,J=-0.5;else G=!0}if(Y&&!G){let B=Y;while(B&&B!==_&&B!==q)Y=B,B=B.parent}}$.target=Y,$.newParent=q,$.yDelta=J,$.inside=G}clearNewSameParent($,z){let Q=$.newParent;if(Q&&(!z||Bj($.rows,Q)))$.newParent=null}updateDropTarget($,z,Q){let J=Q?$.target:null;if(this.dropGroupTarget&&this.dropGroupTarget!==J)this.resetDragGroup();if(!J?.childrenAfterSort?.length)return;if(z&&this.dropGroupThrottled&&!J.expanded&&J.isExpandable?.())J.setExpanded(!0,void 0,!0);if(this.canDropInTarget(J,$))this.dropGroupThrottled=!0,this.dropGroupTarget=J}canDropInTarget($,z){if($.expanded)return!0;if(!$.group)return!1;if(z.pointerPos==="inside")return!0;if(z.treeData)return!1;let Q=z.rows,J=$.level;for(let Z=0,X=Q.length;Z{this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},z)}resetDragGroup(){if(this.dropGroupTimer!==null)window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null;this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging($){if($)this.draggingGroups=null;this.resetDragGroup()}shouldDropTargetBeParent({target:$,rows:z,pointerPos:Q,treeData:J}){if(!$||Q==="none")return!1;if(Q==="inside")return!0;if(!J&&$.group&&!$.expanded)return!0;if(Q==="above")return!1;let Z=this.beans.rowModel,Y=$.rowIndex+1,q;do q=Z.getRow(Y++);while(q?.footer);let G=this.draggingGroups?.get($)??$.childrenAfterGroup;if(q&&q.parent===$&&G?.length){let _=new Set(z);for(let H=0,U=G.length;H{if(_.has(F))return;if(_.add(F),W??(W=this.newGroupValues(X)),this.setRowGroup(F,W))U.add(F)},E=(F)=>{let M=this.draggingGroups?.get(F)??F.childrenAfterGroup,k=M?.length;if(k)for(let V=0;V=0)B(R);else E(R)}};for(let F of $.rows)if(F.group)E(F);else{let M=F.sourceRowIndex>=0&&!F.destroyed?F:this.csrmFirstLeaf(F);if(M)B(M)}let K=Q==="inside"?"above":Q,L=Q==="inside"?this.findFirstLeafForParent(X,_)??J:J,D=!1;if(_.size&&K!=="none")D=q8(Z._leafs,_,L,K==="above");if(!U.size&&!D)return!1;H.reordered=D;for(let F of _)H.updates.add(F);if(this.csrmRefresh(H),G)G.focusCell();else Y.clearFocusedCell();return!0}canStartGroup($,z){if(!$||$.level<0||$.footer||$.detail)return!1;if($.group)return!0;return z}flushGroupEdits(){let $=this.pendingEditRefresh;if($)this.pendingEditRefresh=null,this.csrmRefresh($)}csrmRefresh($){let z=this.beans.rowModel;if(!z.rootNode)return;z.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:$})}newGroupValues($){let z=this.beans.rowGroupColsSvc?.columns??[],Q=Array(z.length),J=-1,Z=$;while(Z&&Z.level>=0){let X=z[Z.level];if(X){let Y=X.getColId(),q=Z.level;if(Q[q]=Z.groupData?.[Y]??Z.key??void 0,q>J)J=q}Z=Z.parent}return{values:Q,columns:z,maxLevel:J}}setRowGroup($,{values:z,columns:Q,maxLevel:J}){if(J<0)return!1;let{valueSvc:Z,changeDetectionSvc:X}=this.beans,Y=!1;X?.beginDeferred();try{for(let q=0;qJ)continue;let _=z[q],H=Z.getValue(G,$,"data");if(H===_||H==null&&_==null)continue;let U=_,W=Z.parseValue(G,$,_,H);if(W!==void 0)U=W;if($.setDataValue(G,U,"rowDrag"))Y=!0}}finally{X?.endDeferred()}return Y}onCsrmCellChange($){let{column:z,node:Q,source:J}=$;if(!this.gos.get("refreshAfterGroupEdit"))return;if(J==="rowDrag")return;if(!z?.isRowGroupActive())return;if(Q.group||!Q.data)return;if(this.beans.editSvc?.isBatchEditing()){let X=this.pendingEditRefresh;if(!X)X=n9(),this.pendingEditRefresh=X;X.updates.add(Q)}else{let X=n9();X.updates.add(Q),this.csrmRefresh(X)}}csrmFirstLeaf($){if(!$)return null;let z=this.draggingGroups,Q=z?.get($)??$.childrenAfterGroup;while(Q?.length){let J=Q[0];if(J.sourceRowIndex>=0){if(!J.destroyed)return J;return this.firstAliveChildLeaf(J)}Q=z?.get(J)??J.childrenAfterGroup}return pz($)}firstAliveChildLeaf($){let z=this.draggingGroups?.get($)??$.childrenAfterGroup;if(z){for(let Q of z)if(Q.sourceRowIndex>=0&&!Q.destroyed)return Q}return null}findFirstLeafForParent($,z){if(!$)return null;let Q=this.draggingGroups?.get($)??$?.childrenAfterGroup;if(!Q)return null;for(let J=0,Z=Q.length;J=0&&!z.has(X))return X;let Y=this.findFirstLeafForParent(X,z);if(Y!==null)return Y}return null}},n9=()=>{let $=new WQ;return $.reordered=!0,$},d9=($,z)=>{if(!$||!z)return!1;let Q=z;while(Q){if(Q===$)return!0;Q=Q.parent}return!1},Wj=($,z)=>{if(!z||$.parent===z)return!1;let Q=z,J=$.id;while(Q){if(Q===$)return!0;if(J!=null&&Q.id===J)return!0;Q=Q.parent}return!1},Bj=($,z)=>{for(let Q=0,J=$.length;Qthis.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf($){return this.strategy?.nonLeafsById?.get($)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange($){let z=this.gos,Q=this.strategy?.nestedDataGetter;if($.has("treeData"))this.gosTreeData=z.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0;return this.strategy?.onPropChange?.($),this.getNestedDataGetter()!==Q}extractData(){let $=this.beans.rowModel.rootNode,z=this.nested?$?.childrenAfterGroup:$?._leafs;if(!z)return this.gos.get("rowData")??[];let Q=z.length,J=Array(Q),Z=0;for(let X=0;X{let z=$.sibling;if(!z)return null;let Q=z._leafs;if(Q!==void 0)return Q;return EZ(z)},EZ=($)=>{let z=$.childrenAfterGroup,Q=z?.length;if($._leafs=null,!Q)return null;let J,Z=Q===1?z[0]:null;if(Z?.group&&Z.sourceRowIndex<0){if(J=Z._leafs,J===void 0)J=EZ(Z)}else if($.leafGroup)J=z;else{J=[];for(let X=0;X=0)J.push(Y);if(!Y.group)continue;let q=Y._leafs;if(q===void 0)q=EZ(Y);if(q)for(let G=0,_=q.length;G<_;++G)J.push(q[G])}}return $._leafs=J,J},Lj=($,z,Q)=>{let{_leafs:J,sibling:Z}=$;if($.treeNodeFlags=0,$.childrenAfterGroup=J,$.childrenMapped=null,$._groupData=void 0,$.aggData=null,Z)Z.childrenAfterGroup=$.childrenAfterGroup,Z.childrenAfterAggFilter=$.childrenAfterAggFilter,Z.childrenAfterFilter=$.childrenAfterFilter,Z.childrenAfterSort=$.childrenAfterSort,Z.childrenMapped=null,Z._groupData=void 0,Z.aggData=null;for(let X=0,Y=J.length??0;X{$.key=null,$.treeNodeFlags=0,$.allChildrenCount=null,$.childrenAfterGroup=null,$.childrenAfterAggFilter=null,$.childrenAfterFilter=null,$.childrenAfterSort=null,$.childrenMapped=null,$.level=0,$._groupData=void 0};function s9($,z,Q){let J=$,Z=J.level-z.level;if(Z<=0)return!1;if(!Q.get("groupHideOpenParents"))return!1;for(let Y=0;Y{let{rowDragSvc:z}=this.beans;if(!this.params.rowDrag||!z)return;let Q=z.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(Q),this.eGui.insertAdjacentElement("afterbegin",Q.getGui())};this.setupExpand(),$(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){let $=this.params.colDef?.cellAriaRole,z=this.params.column?.getColDef().cellAriaRole;return $||z||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;let{visibleCols:$}=this.beans,z=this.params.pinned==="left",Q=this.params.pinned==="right",J=!z&&!Q;if(this.gos.get("enableRtl")){if($.isPinningLeft())return!Q;return!J}if($.isPinningLeft())return!z;return!J}addGroupValue(){let{params:{value:$,valueFormatted:z}}=this,Q=this.getInnerCompDetails();this.comp.setInnerRenderer(Q,z??$??null)}setupExpand(){let{colModel:$}=this.beans,{eGridCell:z,suppressDoubleClickExpand:Q}=this.params,J=(G,_)=>{let H=h(G,this.beans,null);if(H)_.appendChild(H),this.addDestroyFunc(()=>H.remove())};J("groupExpanded",this.eExpanded),J("groupContracted",this.eContracted);let Z=this.comp,X=()=>{if(!this.isExpandable())return;let _=!!this.displayedNode.expanded;Z.setExpandedDisplayed(_),Z.setContractedDisplayed(!_),w0(z,_)},Y=()=>{let G=this.isExpandable();Z.toggleCss("ag-cell-expandable",G),Z.toggleCss("ag-row-group",G);let _=!G&&$.isPivotMode();Z.toggleCss("ag-pivot-leaf-group",_);let H=!$.isPivotMode()&&(!this.displayedNode.footer||this.displayedNode.level!==-1);Z.toggleCss("ag-row-group-leaf-indent",!G&&H);let U=this.getChildCount(),W=U>0?`(${U})`:"";if(Z.setChildCount(W),!G)Z.setExpandedDisplayed(!1),Z.setContractedDisplayed(!1),R6(z);else X()};(()=>{if(!Q&&!this.isGroupCellEditable(this.displayedNode))this.addManagedListeners(z,{dblclick:this.onCellDblClicked.bind(this)});this.addManagedListeners(this.eExpanded,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(this.eContracted,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(z,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:Y,masterChanged:Y,groupChanged:Y,hasChildrenChanged:Y,expandedChanged:X})})(),Y()}getInnerCompDetails(){let{userCompFactory:$,findSvc:z}=this.beans,Q=this.params;if(Q.fullWidth){let G=this.gos.get("groupRowRendererParams"),_=H1($,G,Q);if(_)return _;if(z?.isMatch(Q.node,null))return H1($,{...G,innerRenderer:"agFindCellRenderer"},Q);return}let J=(G)=>G&&G.componentClass==this.compClass,Z=H1($,Q,Q);if(Z&&!J(Z))return Z;let{displayedNode:{rowGroupColumn:X}}=this,Y=X?.colDef,q=X&&Q.column?.isRowGroupDisplayed(X.getId());if(Y&&q){let G=oQ($,Y,Q);if(G)if(J(G)){if(Y?.cellRendererParams?.innerRenderer)return H1($,Y.cellRendererParams,Q)}else return G}if(z?.isMatch(Q.node,Q.column))return oQ($,{...Y??Q.colDef,cellRenderer:"agFindCellRenderer"},Q)}getChildCount(){let{column:$,suppressCount:z}=this.params;if(z)return 0;let{allChildrenCount:Q,rowGroupColumn:J}=this.displayedNode;if(!((Q??0)>0&&(!J||!$||$?.isRowGroupDisplayed(J.getId()))))return 0;if(this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!s9(this.node,this.displayedNode,this.gos))return 0;return Q??0}isExpandable(){let{node:$,column:z,colDef:Q}=this.params;if(!this.displayedNode.isExpandable())return!1;if($.rowPinned)return!1;if(!z)return!0;if($.hasChildren()&&Q){let{showRowGroup:X}=Q;if(!X)return!1;if(X===!0)return!0}if($===this.displayedNode){if($.rowGroupColumn){if(z?.isRowGroupDisplayed($.rowGroupColumn.getId()))return!0}if($.master)return Q?.showRowGroup===!0||Q?.showRowGroup==null;return!1}return s9(this.node,this.displayedNode,this.gos)}setupIndent(){let{suppressPadding:$,node:z,colDef:Q}=this.params;if($)return;let J=()=>{let Z=z.uiLevel;if(Q&&Q.showRowGroup!==!0)Z=0;let X="ag-row-group-indent-"+Z;if(X===this.indentClass)return;if(this.indentClass)this.comp.toggleCss(this.indentClass,!1);this.indentClass=X,this.comp.toggleCss(X,!0),this.eGui.style.setProperty("--ag-indentation-level",String(Z))};this.addManagedListeners(z,{uiLevelChanged:J.bind(this)}),J()}setupCheckbox(){let{node:$}=this.params;if(!(!$.footer&&!$.rowPinned&&!$.detail))return;this.addManagedPropertyListener("rowSelection",({currentValue:Q,previousValue:J})=>{let Z=typeof Q==="object"?Q:void 0,X=typeof J==="object"?J:void 0;if(Z?.checkboxLocation!==X?.checkboxLocation)this.destroyCheckbox(),this.addCheckbox()}),this.addCheckbox()}addCheckbox(){let{selectionSvc:$}=this.beans;if(!$||!h$(this.gos))return;let{node:z,column:Q}=this.params,J=this.gos.get("rowSelection"),Z=EQ(J);if(Z==="selectionColumn")return;if(Z==="autoGroupColumn"){let _=Q?.getColDef().showRowGroup!=null,H=!Q&&z.group;if(!(_||H))return}let X=typeof J==="object"?Qz(J):this.params.checkbox;if(!(typeof X==="function"||X===!0))return;if(typeof Q?.getColDef().showRowGroup==="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}let G=$.createCheckboxSelectionComponent();this.cbComp=G,this.createBean(G),G.init({rowNode:z,column:Q,overrides:{isVisible:X,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(G.getGui()),this.comp.setCheckboxVisible(!0)}destroyCheckbox(){this.comp.setCheckboxSpacing(!1),this.comp.setCheckboxVisible(!1),this.cbComp?.getGui().remove(),this.cbComp=this.destroyBean(this.cbComp)}isGroupCellEditable($){let z=this.params.column;return!!z&&(!!z.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&z.isCellEditable($)}onExpandClicked($){if(z$($))return;i0($),this.onExpandOrContract($)}onKeyDown($){if($.key!==A.ENTER||this.params.suppressEnterExpand)return;if(this.isGroupCellEditable(this.params.node))return;this.onExpandOrContract($)}onCellDblClicked($){if(z$($))return;if(!(SJ(this.eExpanded,$)||SJ(this.eContracted,$)))this.onExpandOrContract($)}onExpandOrContract($){if(!this.isExpandable())return;let z=this.displayedNode,Q=!z.expanded;if(!Q&&z.sticky)this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(z.rowTop-z.stickyRowTop);z.setExpanded(Q,$)}destroy(){super.destroy(),this.destroyCheckbox()}},Dj={tag:"span",cls:"ag-cell-wrapper",children:[{tag:"span",ref:"eExpanded",cls:"ag-group-expanded ag-hidden"},{tag:"span",ref:"eContracted",cls:"ag-group-contracted ag-hidden"},{tag:"span",ref:"eCheckbox",cls:"ag-group-checkbox ag-invisible"},{tag:"span",ref:"eValue",cls:"ag-group-value"},{tag:"span",ref:"eChildCount",cls:"ag-group-child-count"}]},r9=class extends x{constructor(){super(Dj);this.eExpanded=f,this.eContracted=f,this.eCheckbox=f,this.eValue=f,this.eChildCount=f}init($){let z={setInnerRenderer:(X,Y)=>this.setRenderDetails(X,Y),setChildCount:(X)=>this.eChildCount.textContent=X,toggleCss:(X,Y)=>this.toggleCss(X,Y),setContractedDisplayed:(X)=>N(this.eContracted,X),setExpandedDisplayed:(X)=>N(this.eExpanded,X),setCheckboxVisible:(X)=>this.eCheckbox.classList.toggle("ag-invisible",!X),setCheckboxSpacing:(X)=>this.eCheckbox.classList.toggle("ag-group-checkbox-spacing",X)},Q=this.createManagedBean(new YY),J=!$.colDef,Z=this.getGui();if(Q.init(z,Z,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,$),J)_0(Z,Q.getCellAriaRole())}setRenderDetails($,z){if($)$.newAgStackInstance().then((Q)=>{if(!Q)return;let J=()=>this.destroyBean(Q);if(this.isAlive())this.eValue.appendChild(Q.getGui()),this.addDestroyFunc(J);else J()});else this.eValue.innerText=z}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},Fj=".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}",Mj=class extends S{constructor(){super(...arguments);this.beanName="showRowGroupColValueSvc"}getGroupValue($,z,Q){if(!z){if(!$.group)return null;return{displayedNode:$,value:$.groupValue}}let J=this.beans.valueSvc,Z=z.colDef.showRowGroup;if(!Z)return null;if($.level===-1&&$.footer)return{displayedNode:$,value:null};if(typeof Z==="string"){if((this.beans.rowGroupColsSvc?.getColumnIndex(Z)??-1)>$.level)return null;let q=this.getDisplayedNode($,z,!0);if(q)return{displayedNode:q,value:J.getValue(z,q,"data",Q)}}let X=J.getValue(z,$,"data",Q);if(X==null){let Y=this.getDisplayedNode($,z);if(Y)return{displayedNode:Y,value:J.getValue(z,Y,"data",Q)}}return{displayedNode:$,value:X}}formatAndPrefixGroupColValue($,z,Q=!1){let J=this.formatGroupColValue($,z,Q),{value:Z,displayedNode:X}=$,Y=this.beans.footerSvc;if(Y?.doesCellShowTotalPrefix(X,z))return Y.applyTotalPrefix(Z,J,X,z);if(X.footer&&X.level===-1)return null;return J}formatGroupColValue($,z,Q=!1){let J=this.beans.valueSvc,{displayedNode:Z,value:X}=$,Y=Z.rowGroupColumn,q=Z.group&&!z;if(Y&&(q||z?.isRowGroupDisplayed(Y.colId))){if(Q&&Y.colDef.useValueFormatterForExport===!1)return null;let _=J.formatValue(Y,Z,X);if(_==null&&Z.key==="")return this.getLocaleTextFunc()("blanks","(Blanks)");return _}if(!z||Z.group)return null;if(Q&&z.colDef.useValueFormatterForExport===!1)return null;return J.formatValue(z,Z,X)}getDisplayedNode($,z,Q=!1){let J=this.gos,Z=J.get("groupHideOpenParents"),X=J.get("showOpenedGroup")&&!Q;if(!Z&&!X)return;let Y=z.colDef.showRowGroup;if(Y===!0){if($.group)return;return $.parent??void 0}let q=$;while(q&&q.rowGroupColumn?.getId()!=Y){let G=q===q.parent?.getFirstChild();if(!X&&!G)return;q=q.parent}if(q===$)return;return q??void 0}},kj=class extends S{constructor(){super(...arguments);this.beanName="showRowGroupCols",this.columns=[],this.colsSet=new Set,this.colsMap=new Map}destroy(){super.destroy(),this.columns.length=0,this.colsSet.clear(),this.colsMap.clear()}refresh(){let{colModel:$,rowGroupColsSvc:z}=this.beans,Q=this.columns,J=this.colsSet,Z=this.colsMap;Z.clear();let X=Q.length,Y=0,q=!1,G=$.getCols();for(let _=0,H=G.length;_=X||!J.has(U)),Q[Y++]=U}if(q||(q=Y!==X),q){Q.length=Y,J.clear();for(let _=0;_{this.gridBodyCtrl=$.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop($){if(this.extraTopHeight===$)return;this.extraTopHeight=$,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:$})}setOffsetBottom($){if(this.extraBottomHeight===$)return;this.extraBottomHeight=$}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup($){return this.isClientSide?Sj($):Aj($)}getFirstPixelOfGroup($){if($.footer)return $.sibling.rowTop+$.sibling.rowHeight-1;if($.hasChildren())return $.rowTop-1;return 0}updateStickyRows($){let z=$==="top",Q=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight($,new Set,Q);let J=new Set,{rowModel:Z,rowRenderer:X,pinnedRowModel:Y,pageBounds:q,rowContainerHeight:G}=this.beans,{pageFirstPixel:_,pageLastPixel:H}=q.getCurrentPagePixelRange(),U=z?X.firstVisibleVPixel-this.extraTopHeight:X.lastVisibleVPixel-this.extraTopHeight,W=G.divStretchOffset??0,B=_+W,E=H+W,K=(M)=>{if(J.add(M),z){let k=this.getLastPixelOfGroup(M),V=U+Q+M.rowHeight;if(kV)M.stickyRowTop=Q-(k-V);else M.stickyRowTop=Q}Q=0,J.forEach((k)=>{let V=k.stickyRowTop+k.rowHeight;if(Q{if(!M.displayed)return!1;if(M.footer){if(L===!0)return!1;if(L==="grand"&&M.level===-1)return!1;if(L==="group"&&M.level>-1)return!1;let k=M.sibling.rowIndex?M.sibling.rowIndex+1===M.rowIndex:!1;if($==="bottom"&&k)return!1;if(M.level===-1&&Y?.getGrandTotalPinned())return!1;return!J.has(M)}if(M.isExpandable()){if(D===!0)return!1;if($==="bottom")return!1;return!J.has(M)&&!!M.expanded}return!1};for(let M=0;M<100;M++){let k=U+Q;if(!z)k=U-Q;if(z&&kE)k=E;let V=Z.getRowIndexAtPixel(k),R=Z.getRow(V);if(R==null)break;let I=this.getStickyAncestors(R).find((C)=>(z?C.rowIndexV)&&F(C));if(I){K(I);continue}if((z?R.rowTopk)&&F(R)){K(R);continue}break}if(!z)J.forEach((M)=>{M.stickyRowTop=Q-(M.stickyRowTop+M.rowHeight)});return this.refreshNodesAndContainerHeight($,J,Q)}areFooterRowsStickySuppressed(){let $=this.gos.get("suppressStickyTotalRow");if($===!0)return!0;let z=$==="group",Q=$==="grand";if(z&&Q)return!0;if(Q)return"grand";if(z)return"group";return!1}canRowsBeSticky(){let $=kQ(this.gos),z=this.areFooterRowsStickySuppressed(),Q=this.gos.get("suppressGroupRowsSticky");return $&&(!z||!Q)}getStickyAncestors($){let z=[],Q=$.footer?$.sibling:$.parent;while(Q){if(Q.sibling)z.push(Q.sibling);z.push(Q),Q=Q.parent}return z.reverse()}checkStickyRows(){let $=this.updateStickyRows("top"),z=this.updateStickyRows("bottom");return $||z}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode($){let z=new Set;if(this.stickyTopRowCtrls.some((Q)=>Q.rowNode===$)){for(let Q=0;Q{if(q.has(B))return;B.sticky=!0,G.push(this.createRowCon(B,!1,!1))});let _=!!G.length||Y.length!==Z.length;if(J){if(this.topContainerHeight!==Q)this.topContainerHeight=Q,this.gridBodyCtrl.setStickyTopHeight(Q),_=!0}else if(this.bottomContainerHeight!==Q)this.bottomContainerHeight=Q,this.gridBodyCtrl.setStickyBottomHeight(Q),_=!0;this.destroyRowCtrls(X,!1);let H=[...Y,...G];if(H.sort((B,E)=>E.rowNode.rowIndex-B.rowNode.rowIndex),!J)H.reverse();for(let B of H)B.setRowTop(B.rowNode.stickyRowTop);let U=this.beans.pageBounds,W=0;if(J){for(let B of z)if(B.rowIndexthis.topContainerHeight)W=this.topContainerHeight;this.setOffsetTop(W)}else{for(let B of z)if(B.rowIndex>U.getLastRow())W+=B.rowHeight;if(W>this.bottomContainerHeight)W=this.bottomContainerHeight;this.setOffsetBottom(W)}if(!_)return!1;if(J)this.stickyTopRowCtrls=H;else this.stickyBottomRowCtrls=H;return!0}ensureRowHeightsValid(){let $=!1,z=(Q)=>{let J=Q.rowNode;if(J.rowHeightEstimated){let Z=sQ(this.beans,J);J.setRowHeight(Z.height),$=!0}};return this.stickyTopRowCtrls.forEach(z),this.stickyBottomRowCtrls.forEach(z),$}};function Aj($){if($.isExpandable()||$.footer){if($.master&&$.detailNode)return $.detailNode.rowTop+$.detailNode.rowHeight;if(!$.sibling||Math.abs($.sibling.rowIndex-$.rowIndex)===1){let Q=$.childStore?.getStoreBounds();if($.footer)Q=$.sibling.childStore?.getStoreBounds();return(Q?.heightPx??0)+(Q?.topPx??0)}if($.footer)return $.rowTop+$.rowHeight;return $.sibling.rowTop+$.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function Sj($){if($.isExpandable()||$.footer){if($.footer&&$.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!$.sibling||Math.abs($.sibling.rowIndex-$.rowIndex)===1){let J=$.footer?$.sibling:$;while(J.isExpandable()&&J.expanded)if(J.master&&J.detailNode)J=J.detailNode;else if(J.childrenAfterSort){if(J.childrenAfterSort.length===0)break;J=b(J.childrenAfterSort)}return J.rowTop+J.rowHeight}if($.footer)return $.rowTop+$.rowHeight;return $.sibling.rowTop+$.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var Rj=class extends S{constructor(){super(...arguments);this.beanName="stickyRowSvc"}createStickyRowFeature($,z,Q){let J=this.gos;if(kQ(J)&&o(J)||_z(J))return $.createManagedBean(new Vj(z,Q));return}},qY={moduleName:"GroupCellRenderer",version:Q0,userComponents:{agGroupRowRenderer:r9,agGroupCellRenderer:r9},dynamicBeans:{groupCellRendererCtrl:YY},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[Fj],dependsOn:[I0]},jj={moduleName:"GroupColumn",version:Q0,beans:[eR,kj,Mj,oR,ZY,QY],dependsOn:[I0,qY]},GY={moduleName:"ChangedPath",version:Q0,beans:[Jj],dependsOn:[I0]},DZ={moduleName:"ClientSideRowModelHierarchy",version:Q0,rowModels:["clientSide"],beans:[Ej,Hj,Xj],dependsOn:[I0,GY]},_Y={moduleName:"StickyRow",version:Q0,beans:[Rj]},fj={moduleName:"GroupEdit",version:Q0,beans:[Uj],dependsOn:[I0,DZ]},Oj=({valueSvc:$,dataTypeSvc:z},Q,J)=>{let Z=$.getValue(Q,J,"data"),X=null;if(Z instanceof Date)X=Z;else if(typeof Z==="string")X=(z?.getDateParserFunction(Q)??eQ)(Z)??null;return X},Kz=($,z,Q,J)=>(Z)=>{let X=Oj($,z,Z.node),Y=ZQ(X);if(!Y)return null;return J?.(Y[Q])??Y[Q]},Lz=({colNames:$},z,Q)=>(J)=>{let Z=$.getDisplayNameForColumn(z,J.location);if(Z)return`${Z} (${Q})`;return""},Pj=Object.fromEntries(K4.map(($)=>[$,$.toLowerCase()])),Tj=($)=>{let z=K4[Number.parseInt($,10)-1]??$,Q=Pj[z]??$;return{month:z,localeKey:Q}};function l9($){return $.groupHierarchy??$.rowGroupingHierarchy}var vj=class extends S{constructor(){super(...arguments);this.beanName="groupHierarchyColSvc",this.columns=null,this.sourceColumnMap=new WeakMap,this.inverseColumnMap=new WeakMap}addColumns($){let z=this.columns;if(z==null)return;$.list=z.list.filter((Q)=>!$.list.some((J)=>J.getColId()===Q.getColId())).concat($.list),$.tree=z.tree.filter((Q)=>!$.tree.some((J)=>J.getId()===Q.getId())).concat($.tree),_1($)}createColumns($){let z=new WeakMap,Q=new WeakMap,J=this.createGroupHierarchyColumns($,z,Q);if(G1(J,this.columns?.list??[]))return;J$(this.beans,this.columns?.tree),this.columns=null;let{colGroupSvc:X}=this.beans,Y=X?.findDepth($.tree)??0,q=X?.balanceTreeForAutoCols(J,Y)??[];this.columns={list:J,tree:q,treeDepth:Y,map:{}},this.sourceColumnMap=z,this.inverseColumnMap=Q}updateColumns($){}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}expandColumnInto($,z){let Q=this.getVirtualColumnsForColumn(z).concat(z);for(let J of Q)if(!$.some((Z)=>P$(Z,J)||Z.getColId()===J.getColId()))$.push(J)}compareVirtualColumns($,z){let Q=this.inverseColumnMap.get($),J=this.inverseColumnMap.get(z);if(Q&&Q===J){let Z=this.sourceColumnMap.get(Q)??[];return Z?.indexOf($)-Z?.indexOf(z)}if(this.sourceColumnMap.get($)?.includes(z))return 1;if(this.sourceColumnMap.get(z)?.includes($))return-1;return null}insertVirtualColumnsForCol($,z){let Q=this.getVirtualColumnsForColumn(z);if(!Q)return[];let J=$.indexOf(z);if(J<0)J=$.length-1;return Q1($,Q),$.splice(J,0,...Q),Q}getVirtualColumnsForColumn($){if(this.isGroupHierarchyColsEnabledForCol($))return this.sourceColumnMap.get($)??[];return[]}isGroupHierarchyColsEnabled($){return $.list.some((z)=>this.isGroupHierarchyColsEnabledForCol(z))}isGroupHierarchyColsEnabledForCol($){let z=$.getColDef();return!!(l9(z)&&(z.rowGroup||z.enableRowGroup||z.rowGroupIndex!=null||z.pivot||z.enablePivot||z.pivotIndex!=null))}createGroupHierarchyColDefs($){let z=[],Q=$.getColDef(),J=l9(Q);if(!J)return z;if(!this.isGroupHierarchyColsEnabledForCol($))return z;for(let Z of J){let X=null;if(typeof Z==="string")X=this.createColDefForPart(Z,$,Q);else X=Z;if(X)z.push(X)}return z}createGroupHierarchyColumns($,z,Q){if(!this.isGroupHierarchyColsEnabled($))return[];let J=[];for(let Z of $.list)for(let X of this.createGroupHierarchyColDefs(Z)){let Y=X.colId;this.gos.validateColDef(X,Y,!0);let q=new q$(X,null,Y,!0);this.createBean(q),J.push(q),Ij(z,Z,q),Q.set(q,Z)}return J}createColDefForPart($,z,Q){let{beans:J,gos:Z}=this,X=`${F7}-${z.getColId()}-${$}`,Y={enableRowGroup:Q.enableRowGroup,rowGroup:Q.rowGroup,enablePivot:Q.enablePivot,hide:!0,editable:!1},q=Z.get("groupHierarchyConfig")??{};if($ in q){let U={...Y,...q[$]};return U.colId??(U.colId=X),u$(J,U,U.colId,!0)}let G=u$(J,{colId:X,...Y},X,!0),_=this.getLocaleTextFunc(),H=(U,W)=>_?.(U,W)??W;switch($){case"year":return{...G,headerValueGetter:Lz(J,z,H($,"Year")),valueGetter:Kz(J,z,0)};case"quarter":return{...G,headerValueGetter:Lz(J,z,H($,"Quarter")),valueGetter:Kz(J,z,1,(U)=>(Math.floor(Number(U)/4)+1).toString())};case"month":return{...G,headerValueGetter:Lz(J,z,H($,"Month")),valueGetter:Kz(J,z,1)};case"formattedMonth":return{...G,headerValueGetter:Lz(J,z,H("month","Month")),valueGetter:Kz(J,z,1,(U)=>{let W=Tj(U);return H(W.localeKey,W.month)})};case"day":return{...G,headerValueGetter:Lz(J,z,H($,"Day")),valueGetter:Kz(J,z,2)};case"hour":return{...G,headerValueGetter:Lz(J,z,H($,"Hour")),valueGetter:Kz(J,z,3)};case"minute":return{...G,headerValueGetter:Lz(J,z,H($,"Minute")),valueGetter:Kz(J,z,4)};case"second":return{...G,headerValueGetter:Lz(J,z,H($,"Second")),valueGetter:Kz(J,z,5)};default:return null}}};function Ij($,z,Q){let J=$.get(z);$.set(z,(J??[]).concat(Q))}var Cj={moduleName:"GroupHierarchy",version:Q0,beans:[vj],dependsOn:[GY]};var bj=($,z)=>{if(!$){z.length=0;return}let Q=$.length;z.length=Q;for(let J=0;J{let Q=$.length;if(Q!==z?.length)return!0;for(let J=0;J0){Q=!0;break}if(!Q)return!1;return $.sort(a9),!0}function a9($,z){let Q=$.sourceRowIndex,J=z.sourceRowIndex,Z=Q>=0,X=J>=0,Y=Z&&X,q=!Z&&!X;if(Y)return Q-J;if(q)return $.__objectId-z.__objectId;if(Z)return 1;return-1}var wj=class extends S{constructor(){super(...arguments);this.groupCols=[],this.nonLeafsById=new Map,this.checkGroupCols=!0,this.pivotMode=!1,this.groupEmpty=!1}invalidateGroupCols(){this.checkGroupCols=!0}destroy(){super.destroy(),this.groupCols.length=0,this.nonLeafsById.clear()}clearNonLeafs(){let $=this.nonLeafsById;for(let z of $.values())z._destroy(!1);$.clear()}loadGroupData($){if(!$.group)return $._groupData=null,null;let z=$.rowGroupColumn,{valueSvc:Q,showRowGroupCols:J}=this.beans,Z={};if($._groupData=Z,!z)return Z;let X=pz($),Y=z.getId();if(!J)return Z;let q=J.columns;for(let G=0,_=q.length;G<_;++G){let H=q[G];if(H.isRowGroupDisplayed(Y))Z[H.getColId()]=Q.getValue(z,X,"data")}return Z}execute($,z){let Q=z.changedPath;if(this.initRefresh(z)!=="skip"){let Z=z.changedRowNodes;if(Z)this.handleDeltaUpdate($,Q,Z,!!z.animate);else this.shotgunResetEverything($)}this.positionLeafsAndGroups($,Q),this.orderGroups($),this.beans.selectionSvc?.updateSelectableAfterGrouping(Q)}positionLeafsAndGroups($,z){S0($,!0,z,(Q)=>{let J=Q.childrenAfterGroup,Z=J?.length;if(!Z)return;let X=Array(Z),Y=0,q=!1,G;for(let _=0;_1)}}if(Z.size)for(let G of Z){this.insertOneNode($,G);let _=G.parent;z?.addRow(_),X||(X=(_?.childrenAfterGroup?.length??0)>1)}if(q.size)o9(q),this.removeEmptyGroups(q,Y);if(X)this.sortChildren($,z)}sortChildren($,z){S0($,!0,void 0,(Q)=>{if(xj(Q.childrenAfterGroup))z?.addRow(Q)})}orderGroups($){let z=this.gos.getCallback("initialGroupOrderComparator");if(!z)return;let Q=this.beans,J=Q.gridApi,Z=Q.gridOptions.context,X=(q,G)=>z({api:J,context:Z,nodeA:q,nodeB:G}),Y=(q)=>{let G=q.childrenAfterGroup,_=G?.length;if(!_||q.leafGroup)return;if(_>1)G.sort(X);for(let H=0,U=_;H=0;--q){let{col:G}=Y[q],_=Q.getKeyForNode(G,z);if(_==null||_===""){if(!J)continue;_=""}if(!Z?.parent||Z.key!==_){X=!0;break}Z=Z.parent}if(X||(X=!!Z?.parent),!X)return!1;return this.removeFromParent(z),this.insertOneNode($,z),z.setData(z.data),!0}groupShouldBeRemoved($){let z=this.getChildrenMappedKey($.key,$.rowGroupColumn),Q=$.parent?.childrenMapped;if(Q?!Q[z]:!0)return!1;return!!$.group&&($.childrenAfterGroup?.length??0)===0}removeEmptyGroups($,z){let Q=this.beans.selectionSvc,J,Z=Array.from($),X=this.nonLeafsById;do{$.clear();for(let Y=0;Y=q-1,K=this.createGroup(Q,_,U,B,E,z);this.addToParent(K,Q),Q=K}if(!Q.group)j(184,{parentGroupData:Q.data,childNodeData:z.data});z.parent=Q,z.level=Q.level+1,Q.childrenAfterGroup.push(z),Q.updateHasChildren(),XZ(Q)}createGroup($,z,Q,J,Z,X){let Y=z.col,q=($.level>=0?$.id+"-":"row-group-")+(Y.getColId()+"-"+Q),G=this.nonLeafsById,_=G.get(q),H=!0;if(_){if(_.childrenAfterGroup!==null)return _._expanded??(_._expanded=null),_;H=!1,XZ(_)}else _=new Wz(this.beans),_.group=!0,_.key=Q,_.id=q,_.aggData=null,G.set(q,_);let U=(K)=>{K.childrenAfterGroup=W,K.childrenMapped=B,K.parent=$,K.level=J,K.rowGroupIndex=J,K.leafGroup=Z},W=[],B={};if(U(_),_.field=z.field??null,_.rowGroupColumn=Y,_.groupValue=this.beans.valueSvc.getValue(Y,X,"data"),_._expanded??(_._expanded=null),H)return _.setAllChildrenCount(0),_.updateHasChildren(),_;let E=_.sibling;if(E)U(E);return _.dispatchRowEvent("hasChildrenChanged"),_}getChildrenMappedKey($,z){return z?z.getId()+"-"+$:$}onShowRowGroupColsSetChanged(){let{rowModel:$,valueSvc:z}=this.beans;for(let J of this.nonLeafsById.values()){J._groupData=void 0;let Z=J.rowGroupColumn,X=Z&&pz(J);J.groupValue=X&&z.getValue(Z,X,"data")}let Q=$.rootNode?._leafs;if(Q)for(let J=0,Z=Q.length;J{for(let z of $){let Q=z?.childrenAfterGroup;if(!Q)continue;let J=Q.length,Z=0;for(let X=0;X{while($._leafs!==void 0){let z=$.parent;if(!z)break;$._leafs=void 0,$=z}};function Nj($,z){$.rowGroupColsSvc?.setColumns(z,"api")}function gj($,z){$.rowGroupColsSvc?.removeColumns(z,"api")}function hj($,z){$.rowGroupColsSvc?.addColumns(z,"api")}function uj($,z,Q){$.rowGroupColsSvc?.moveColumn?.(z,Q,"api")}function mj($){return $.rowGroupColsSvc?.columns??[]}var HY={moduleName:"SharedRowGrouping",version:Q0,apiFunctions:{setRowGroupColumns:Nj,removeRowGroupColumns:gj,addRowGroupColumns:hj,getRowGroupColumns:mj,moveRowGroupColumn:uj},dependsOn:[I0,JY,jj,_Y,Cj]},cj={moduleName:"RowGrouping",version:Q0,dynamicBeans:{groupStrategy:wj},rowModels:["clientSide"],dependsOn:[HY,aR,DZ,fj]};function pj($,z){$.clipboardSvc?.copyToClipboard(z)}function ij($,z){$.clipboardSvc?.cutToClipboard(z)}function nj($,z){$.clipboardSvc?.copySelectedRowsToClipboard(z)}function dj($,z){$.clipboardSvc?.copySelectedRangeToClipboard(z)}function tj($){$.clipboardSvc?.copyRangeDown()}function sj($){$.clipboardSvc?.pasteFromClipboard()}var $Z="paste",n4="dragCopy",d4="clipboard";function rj($,z=","){let Q=[],J=(X)=>X==="\r"||X===` +`,Z=!1;if($==="")return[[""]];for(let X=0,Y=0,q=0;q<$.length;q++){let G=$[q-1],_=$[q],H=$[q+1],U=()=>{if(!Q[X])Q[X]=[];if(!Q[X][Y])Q[X][Y]=""};if(U(),_==='"'){if(Z)if(H==='"')Q[X][Y]+='"',q++;else Z=!1;else if(G===void 0||G===z||J(G))Z=!0}if(!Z&&_!=='"'){if(_===z){Y++,U();continue}else if(J(_)){if(Y=0,X++,U(),_==="\r"&&H===` +`)q++;continue}}Q[X][Y]+=_}return Q}var lj=class extends S{constructor(){super(...arguments);this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){let{gos:$,rowModel:z,ctrlsSvc:Q}=this.beans;if(o($,z))this.clientSideRowModel=z;Q.whenReady(this,(J)=>{this.gridCtrl=J.gridCtrl})}destroy(){super.destroy(),this.clientSideRowModel=null,this.gridCtrl=null}pasteFromClipboard(){if(!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&navigator.clipboard?.readText)navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((z)=>{j(40,{e:z,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()});else this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let $=!1,z=(Q)=>{let J=Date.now();if(J-this.lastPasteOperationTime<50)$=!0,Q.preventDefault();this.lastPasteOperationTime=J};this.executeOnTempElement((Q)=>{Q.addEventListener("paste",z),Q.focus({preventScroll:!0})},(Q)=>{let J=Q.value;if(!$)this.processClipboardData(J);else this.refocusLastFocusedCell();Q.removeEventListener("paste",z)})}refocusLastFocusedCell(){let{focusSvc:$}=this.beans,z=$.getFocusedCell();if(z)$.setFocusedCell({rowIndex:z.rowIndex,column:z.column,rowPinned:z.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){let $=this.gos.get("clipboardDelimiter");return T($)?$:"\t"}processClipboardData($){if($==null)return;let z=rj($,this.getClipboardDelimiter()),Q=this.gos.getCallback("processDataFromClipboard");if(Q)z=Q({data:z});if(z==null)return;if(this.gos.get("suppressLastEmptyLineOnPaste"))this.removeLastLineIfBlank(z);let{rangeSvc:J,editSvc:Z}=this.beans,X=(Y,q,G,_)=>{if(J?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(z))this.pasteIntoActiveRange(z,Y,q,_);else this.pasteStartingFromFocusedCell(z,Y,q,G,_);Z?.stopEditing(void 0,{source:$Z})};this.doPasteOperation(X)}doPasteOperation($){let{eventSvc:Q,focusSvc:J,rowRenderer:Z,gos:X}=this.beans;Q.dispatchEvent({type:"pasteStart",source:"clipboard"});let{clientSideRowModel:Y}=this,q=Y?.rootNode,G=q&&this.beans.changedPathFactory?.newPath(X.get("aggregateOnlyChangedColumns")),_={},H=[],U=J.getFocusedCell();$(_,H,U,G);let W=H.slice();if(G)Y.doAggregate(G),S0(q,Y.hierarchical,G,(B)=>{W.push(B)});Z.refreshCells({rowNodes:W}),this.dispatchFlashCells(_),this.fireRowChanged(H),this.refocusLastFocusedCell(),Q.dispatchEvent({type:"pasteEnd",source:"clipboard"})}getPreProcessRangeCallback($){return(z)=>{let{rangeSvc:Q}=this.beans;if(!Q)return;let{rowDiff:J,colDiff:Z}=this.getAdjustedRangeDimensionForPaste(z,$);if(J!==0)Q.extendRangeRowCountBy(z,J);if(Z!==0)Q.extendRangeColumnCountBy(z,Z)}}getAdjustedRangeDimensionForPaste($,z){let Q=this.beans.rangeSvc,J=z.length,Z=Q.getRangeRowCount($),X=Z>=J&&Z%J===0,Y=z[0].length,q=$.columns.length,G=q>=Y&&q%Y===0;return{rowDiff:X?0:J-Z,colDiff:G?0:Y-q}}pasteIntoActiveRange($,z,Q,J){let Z=0,X=0,Y=(q,G,_,H)=>{if(H-Z>=$.length){if(H%$.length!==0)return;Z+=X,X=0}let W=$[H-Z];Q.push(G);let B=this.gos.getCallback("processCellFromClipboard"),E=_.columns,K=E.findIndex(I$);if(K!==-1)E.splice(K,1);for(let L=0;L=W.length)F=L%W.length;let M=this.processCell(G,D,W[F],n4,B,!0);G.setDataValue(D,M,$Z),J?.addCell(G.parent,D.getId());let{rowIndex:k,rowPinned:V}=q,R=b$({rowIndex:k,column:D,rowPinned:V});z[R]=!0}X++};this.iterateActiveRanges(Y,!1,this.getPreProcessRangeCallback($))}getDisplayedColumnsStartingAt($){let z=$,Q=[],{visibleCols:J}=this.beans;while(z&&q1(z))z=J.getColAfter(z);while(z!=null)Q.push(z),z=J.getColAfter(z);return Q}pasteStartingFromFocusedCell($,z,Q,J,Z){if(!J)return;let X={rowIndex:J.rowIndex,rowPinned:J.rowPinned},Y=this.getDisplayedColumnsStartingAt(J.column);if(this.isPasteSingleValueIntoRange($))this.pasteSingleValueIntoRange($,Q,z,Z);else this.pasteMultipleValues($,X,Q,Y,z,d4,Z)}isPasteSingleValueIntoRange($){let z=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste($)&&!!z&&!z.isEmpty()}pasteSingleValueIntoRange($,z,Q,J){let Z=$[0][0],X=(Y,q,G)=>{z.push(q),G.columns.forEach((_)=>this.updateCellValue(q,_,Z,Q,d4,J))};this.iterateActiveRanges(X)}hasOnlyOneValueToPaste($){return $.length===1&&$[0].length===1}copyRangeDown(){let{rangeSvc:$,gos:z,formula:Q,valueSvc:J}=this.beans;if(!$||$.isEmpty())return;let Z=[],X=(Y,q,G,_)=>{let H=z.getCallback("processCellForClipboard"),U=z.getCallback("processCellFromClipboard"),W=(B,E,K)=>{let{columns:L}=K;if(!Z.length)L.forEach((D)=>{let F=this.processCell(E,D,J.getValue(D,E,"batch"),n4,H,!1,!0);Z.push(F)});else q.push(E),L.forEach((D,F)=>{if(!D.isCellEditable(E)||D.isSuppressPaste(E))return;if(D.isAllowFormula()&&Q?.isFormula(Z[F]))Z[F]=Q?.updateFormulaByOffset({value:Z[F],rowDelta:1});let k=this.processCell(E,D,Z[F],n4,U,!0);E.setDataValue(D,k,$Z),_?.addCell(E.parent,D.getId());let{rowIndex:V,rowPinned:R}=B,O=b$({rowIndex:V,column:D,rowPinned:R});Y[O]=!0})};this.iterateActiveRanges(W,!0)};this.doPasteOperation(X)}removeLastLineIfBlank($){let z=b($);if(z&&z.length===1&&z[0]===""){if($.length===1)return;Z0($,z)}}fireRowChanged($){if(this.gos.get("editType")!=="fullRow")return;for(let z of $)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:z,data:z.data,rowIndex:z.rowIndex,rowPinned:z.rowPinned})}shouldSkipPasteRow($,z,Q){if($.detail||$.footer)return!0;if(Q&&$.group){for(let J of z)if(J.isCellEditable($))return!1;return!0}return!1}pasteMultipleValues($,z,Q,J,Z,X,Y){let q=z,G=this.beans,{gos:_}=G,H=this.clientSideRowModel!=null&&!_.get("enableGroupEdit")&&!_.get("treeData"),U=()=>{while(q){let W=M0(G,q);if(q=L0(G,{rowPinned:q.rowPinned,rowIndex:q.rowIndex}),W!=null&&!this.shouldSkipPasteRow(W,J,H))return W}return null};for(let W of $){let B=U();if(!B)continue;W.forEach((E,K)=>this.updateCellValue(B,J[K],E,Z,X,Y)),Q.push(B)}}updateCellValue($,z,Q,J,Z,X){if(!$||!z?.isCellEditable($)||z?.isSuppressPaste($))return;let Y=this.processCell($,z,Q,Z,this.gos.getCallback("processCellFromClipboard"),!0);$.setDataValue(z,Y,$Z);let{rowIndex:q,rowPinned:G}=$,_=b$({rowIndex:q,column:z,rowPinned:G});J[_]=!0,X?.addCell($.parent,z.getId())}copyToClipboard($={}){this.copyOrCutToClipboard($)}cutToClipboard($={},z="api"){if(this.gos.get("suppressCutToClipboard"))return;this.eventSvc.dispatchEvent({type:"cutStart",source:z}),this.copyOrCutToClipboard($,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:z})}copyOrCutToClipboard($,z){let{includeHeaders:Q,includeGroupHeaders:J}=$,{gos:Z,focusSvc:X}=this.beans;if(Q==null)Q=Z.get("copyHeadersToClipboard");if(J==null)J=Z.get("copyGroupHeadersToClipboard");let Y={includeHeaders:Q,includeGroupHeaders:J},q=Z.get("rowSelection"),G=Z.get("cellSelection"),_=null;if(this.shouldCopyCells(G,q))this.copySelectedRangeToClipboard(Y),_=0;else if(this.shouldCopyRows(q))this.copySelectedRowsToClipboard(Y),_=1;else if(X.isAnyCellFocused())this.copyFocusedCellToClipboard(Y),_=2;if(z&&_!==null)this.clearCellsAfterCopy(_)}shouldCopyCells($,z){let{rangeSvc:Q,selectionSvc:J,gos:Z}=this.beans;if(!Q||Q.isEmpty())return!1;if($)return!(typeof z==="object"&&z.copySelectedRows&&!J?.isEmpty());else{let X=Z.get("suppressCopySingleCellRanges");return!(!Q.isMoreThanOneCell()&&X)}}shouldCopyRows($){let{selectionSvc:z,gos:Q}=this.beans;if(z?.isEmpty()??!0)return!1;if($&&typeof $!=="string")return $.copySelectedRows??!1;else return!Q.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy($){let z=this.beans,{rangeSvc:Q,focusSvc:J,eventSvc:Z}=z;if(Z.dispatchEvent({type:"keyShortcutChangedCellStart"}),$===0)Q.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if($===1)this.clearSelectedRows();else{let X=J.getFocusedCell();if(X==null)return;let Y=M0(z,X);if(Y)this.clearCellValue(Y,X.column)}Z.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){let{selectionSvc:$,visibleCols:z}=this.beans,Q=$?.getSelectedNodes()??[],J=z.allCols;for(let Z of Q)for(let X of J)this.clearCellValue(Z,X)}clearCellValue($,z){if(!z.isCellEditable($))return;let Q=this.beans.valueSvc.getDeleteValue(z,$);$.setDataValue(z,Q,"clipboardSvc")}iterateActiveRanges($,z,Q){let J=this.beans.rangeSvc;if(!J||J.isEmpty())return;let Z=J.getCellRanges(),X=z?[Z[0]]:Z;for(let Y of X)this.iterateActiveRange({cellRange:Y,rowCallback:$,preProcessRange:Q})}iterateActiveRange($){let{cellRange:z,preProcessRange:Q,rowCallback:J}=$,{beans:Z}=this,{rangeSvc:X}=Z;if(!X)return;if(Q)Q(z);let Y=X.getRangeStartRow(z),q=X.getRangeEndRow(z),G=0,_=!1;while(!_&&Y!=null){let H=M0(Z,Y);_=l(Y,q),J(Y,H,z,G++),Y=L0(Z,Y)}}copySelectedRangeToClipboard($={}){let z=this.beans.rangeSvc;if(!z||z.isEmpty())return;let Q=z.areAllRangesAbleToMerge(),{data:J,cellsToFlash:Z}=Q?this.buildDataFromMergedRanges(z,$):this.buildDataFromRanges(z,$);this.copyDataToClipboard(J),this.dispatchFlashCells(Z)}buildDataFromMergedRanges($,z){let Q=new Set,J=$.getCellRanges(),Z=new Map,X=[],Y={},q=o(this.gos,this.beans.rowModel),G=new Set;if(!q)this.beans.rowModel.forEachNode((W)=>{G.add(W.rowIndex)});for(let W of J){W.columns.forEach((K)=>Q.add(K));let{rowPositions:B,cellsToFlash:E}=this.getRangeRowPositionsAndCellsToFlash($,W);for(let K of B){let L=G.has(K.rowIndex);if(!q&&!L)continue;let D=`${K.rowIndex}-${K.rowPinned||"null"}`;if(!Z.get(D))Z.set(D,!0),X.push(K)}Object.assign(Y,E)}let _=this.beans.visibleCols.allCols,H=Array.from(Q);return H.sort((W,B)=>{let E=_.indexOf(W),K=_.indexOf(B);return E-K}),{data:this.buildExportParams({columns:H,rowPositions:X,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}),cellsToFlash:Y}}buildDataFromRanges($,z){let Q=$.getCellRanges(),J=[],Z={};for(let X of Q){let{rowPositions:Y,cellsToFlash:q}=this.getRangeRowPositionsAndCellsToFlash($,X);Object.assign(Z,q),J.push(this.buildExportParams({columns:X.columns,rowPositions:Y,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}))}return{data:J.join(` +`),cellsToFlash:Z}}getRangeRowPositionsAndCellsToFlash($,z){let Q=[],J={},Z=$.getRangeStartRow(z),X=$.getRangeEndRow(z),Y=Z;while(Y){Q.push(Y);for(let q of z.columns){let{rowIndex:G,rowPinned:_}=Y,H=b$({rowIndex:G,column:q,rowPinned:_});J[H]=!0}if(l(Y,X))break;Y=L0(this.beans,Y)}return{rowPositions:Q,cellsToFlash:J}}getCellsToFlashFromRowNodes($){let z=this.beans.visibleCols.allCols,Q={};for(let J=0;J<$.length;J++){let{level:Z,rowIndex:X,rowPinned:Y,sibling:q}=$[J],G=Z===-1?q.rowIndex:X;if(G==null)continue;for(let _=0;_{let{value:U,valueFormatted:W}=this.beans.valueSvc.getValueForDisplay({column:H,node:_,includeValueFormatted:!0,from:"batch"}),B=W??U??"",E=X.getCallback("processCellForClipboard");if(!E)return B;return E({column:H,node:_,value:B,type:d4,formatValue:(K)=>this.beans.valueSvc.formatValue(H,_,K)??K,parseValue:(K)=>this.beans.valueSvc.parseValue(H,_,K,U)??K})},G={columnKeys:z,rowPositions:Q,skipColumnHeaders:!J,skipColumnGroupHeaders:!Z,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!Q,valueFrom:"batch",processCellCallback:X.getCallback("processCellForClipboard"),processRowGroupCallback:q,processHeaderCallback:X.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:X.getCallback("processGroupHeaderForClipboard")};return Y.getDataAsCsv(G,!0)}dispatchFlashCells($){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:$})},0)}processCell($,z,Q,J,Z,X,Y){let{valueSvc:q,formula:G}=this.beans;if(Z)return Z({column:z,node:$,value:Q,type:J,formatValue:(H)=>q.formatValue(z,$??null,H)??H,parseValue:(H)=>q.parseValue(z,$??null,H,q.getValue(z,$,"edit"))});if(X&&z.getColDef().useValueParserForImport!==!1)return q.parseValue(z,$??null,Q,q.getValue(z,$,"edit"));if(Y&&z.getColDef().useValueFormatterForExport!==!1){if(G?.isFormula(Q))return Q;return q.formatValue(z,$??null,Q)??Q}return Q}copyDataToClipboard($){let z=this.gos.getCallback("sendToClipboard");if(z){z({data:$});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText($).catch((J)=>{j(40,{e:J,method:"writeText"}),this.copyDataToClipboardLegacy($)});return}this.copyDataToClipboardLegacy($)}copyDataToClipboardLegacy($){this.executeOnTempElement((z)=>{let Q=Y0(this.beans),J=d(this.beans);if(z.value=$||" ",z.select(),z.focus({preventScroll:!0}),!Q.execCommand("copy"))j(41);if(J?.focus!=null)J.focus({preventScroll:!0})})}executeOnTempElement($,z){if(!this.gridCtrl)return;let Q=Y0(this.beans),J=Q.createElement("textarea"),Z=J.style;Z.width="1px",Z.height="1px";let X=Q.documentElement;Z.top=X.scrollTop+"px",Z.left=X.scrollLeft+"px",Z.position="absolute",Z.opacity="0",this.gridCtrl.getGui().appendChild(J);try{$(J)}catch(q){j(42)}if(z)window.setTimeout(()=>{z(J),J.remove()},100);else J.remove()}},UY={moduleName:"Clipboard",version:Q0,beans:[lj],apiFunctions:{copyToClipboard:pj,cutToClipboard:ij,copySelectedRowsToClipboard:nj,copySelectedRangeToClipboard:dj,copySelectedRangeDown:tj,pasteFromClipboard:sj},dependsOn:[I0,$9,iz,L9]};var WY=class extends S{constructor(){super(...arguments);this.loadRowDataVersion=0}wireBeans($){this.environment=$.environment}init($,z){if(this.params=z,this.comp=$,z.pinned!=null)return;this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)})}onFullWidthRowFocused($){let z=this.params,Q={rowIndex:z.node.rowIndex,rowPinned:z.node.rowPinned},J={rowIndex:$.rowIndex,rowPinned:$.rowPinned};if(!l(Q,J))return;F0(this.comp.getGui(),$.fromBelow)}setAutoHeightClasses(){let $=this.gos.get("detailRowAutoHeight"),z=$?"ag-details-row-auto-height":"ag-details-row-fixed-height",Q=$?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",J=this.comp;J.toggleCss(z,!0),J.toggleDetailGridCss(Q,!0)}setupRefreshStrategy(){let $=this.params.refreshStrategy;if($=="everything"||$=="nothing"||$=="rows"){this.refreshStrategy=$;return}if($!=null)j(170,{providedStrategy:$});this.refreshStrategy="rows"}createDetailGrid(){let{params:$,gos:z}=this;if(n($.detailGridOptions)){j(171);return}let Q=z.get("theme"),J=$.detailGridOptions.theme;if(J&&J!==Q)j(267);let Z={themeStyleContainer:this.environment.eStyleContainer,...$.detailGridOptions,theme:Q};if(z.get("detailRowAutoHeight"))Z.domLayout="autoHeight";this.comp.setDetailGrid(Z)}registerDetailWithMaster($){let{params:z,beans:{selectionSvc:Q,findSvc:J,expansionSvc:Z}}=this,X=z.node.id,Y=z.api,q={id:X,api:$},G=z.node;if(Y.isDestroyed())return;Y.addDetailGridInfo(X,q),G.detailGridInfo=q;let _=G.parent;J?.registerDetailGrid(G,$);function H(){if(_)Q?.refreshMasterNodeState(_)}function U({source:B}){if(B==="expandAll")return $.expandAll();if(B==="collapseAll")return $.collapseAll()}function W({node:B,source:E}){if(B!==_||E==="masterDetail"||$.isDestroyed())return;Q?.setDetailSelectionState(_,z.detailGridOptions,$)}$.addEventListener("firstDataRendered",()=>{if($.isDestroyed()||Y.isDestroyed())return;Q?.setDetailSelectionState(_,z.detailGridOptions,$),$.addEventListener("selectionChanged",H),Y.addEventListener("rowSelected",W);let E=`${"CsrmSsrmSharedApi"}Module`;if($.isModuleRegistered(E))Y.addEventListener("expandOrCollapseAll",U),Z?.setDetailsExpansionState($)}),this.addManagedListeners(_,{masterChanged:(B)=>{if(!B.node.master)this.onDestroy(q)}}),this.addDestroyFunc(()=>this.onDestroy(q))}onDestroy($){let{params:z}=this,Q=z.node,J=z.api;if(Q.detailGridInfo!==$)return;if(!J.isDestroyed())J.removeDetailGridInfo(Q.id);Q.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;let $=this.loadRowDataVersion,z=this.params;if(z.detailGridOptions?.rowModelType==="serverSide"){z.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}let Q=z.getDetailRowData;if(!Q){j(172);return}let J=(X)=>{if(this.loadRowDataVersion===$)this.comp.setRowData(X)},Z={node:z.node,data:z.node.data,successCallback:J,context:y(this.gos,{}).context};Q(Z)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},aj=class{constructor($){this.parentWrapper=$}wrap($,z,Q,J){return this.parentWrapper.wrap($,z,Q,J)}},oj={tag:"div",cls:"ag-details-row"},ej={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},$f=class extends x{constructor(){super(...arguments);this.eDetailGrid=f}wireBeans($){this.context=$.context}init($){this.params=$,this.selectAndSetTemplate();let z={toggleCss:(Q,J)=>this.toggleCss(Q,J),toggleDetailGridCss:(Q,J)=>this.eDetailGrid.classList.toggle(Q,J),setDetailGrid:(Q)=>this.setDetailGrid(Q),setRowData:(Q)=>this.setRowData(Q),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new WY),this.ctrl.init(z,$)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){let $=this.params;if($.pinned){this.setTemplate(oj);return}let z=()=>{this.setTemplate(ej)};if(n($.template))z();else if(typeof $.template==="string")this.setTemplate($.template,[]);else if(typeof $.template==="function"){let Q=$.template,J=Q($);this.setTemplate(J,[])}else j(168),z();if(this.eDetailGrid==null)j(169)}setDetailGrid($){if(!this.eDetailGrid)return;let z=this.context.getBean("frameworkCompWrapper"),Q=new aj(z),{frameworkOverrides:J}=this.beans,Z=nJ(this.eDetailGrid,$,{frameworkOverrides:J,providedBeanInstances:{frameworkCompWrapper:Q},modules:d6(this.params.api.getGridId(),$.rowModelType??"clientSide")});this.detailApi=Z,this.ctrl?.registerDetailWithMaster(Z),this.addDestroyFunc(()=>{Z.destroy()})}setRowData($){this.detailApi?.setGridOption("rowData",$)}};function FZ($,z){let Q=$.masterDetailSvc?.store;return Q?z(Q):void 0}function zf($,z,Q){FZ($,(J)=>{J[z]=Q})}function Qf($,z){FZ($,(Q)=>{delete Q[z]})}function Jf($,z){return FZ($,(Q)=>Q[z])}function Zf($,z){FZ($,(Q)=>{let J=0;Object.values(Q).forEach((Z)=>{if(Z)z(Z,J++)})})}var Xf=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}",Yf=class extends S{constructor(){super(...arguments);this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){let $=this.gos;if(o($))this.enabled=this.isEnabled();if(_z($))this.addEventListeners()}addEventListeners(){let $=(J)=>{this.setMaster(J.node,!1,!0)},z,Q=()=>{if(z){for(let J of z)J();z=void 0}if(this.isEnabled())z=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:$})};Q(),this.gos.addPropertyEventListener("masterDetail",Q)}refreshModel($){if($.changedProps){let z=this.isEnabled();if(this.enabled!==z){this.setMasters(null);return}}if($.rowDataUpdated)this.setMasters($.changedRowNodes)}setMaster($,z,Q){let J=$.master,Z=this.isEnabled(),X=Z,Y=this.gos,q=Y.get("isRowMaster"),G=Y.get("treeData");if(Z)if(z||Q){if(q){let _=$.data;X=!!_&&!!q(_)}}else X=J;if(!G){if(X&&z||!X&&J)$._expanded??($._expanded=null)}if(X!==J)$.master=X,$.dispatchRowEvent("masterChanged")}setMasters($){if(this.enabled=this.isEnabled(),$){for(let z of $.updates)this.setMaster(z,!1,!0);for(let z of $.adds)this.setMaster(z,!0,!1)}else{let z=l2(this.beans)?.rootNode?._leafs;if(z)for(let Q=0,J=z.length;Q{let Y=z.clientHeight;if(Y!=null&&Y>0){let q=()=>{let{rowModel:G}=this.beans,{rowNode:_}=$;if(_.setRowHeight(Y),o(Q,G)||_z(Q,G))G.onRowHeightChanged()};window.setTimeout(q,0)}},X=F$(J,z,Z);$.addDestroyFunc(X),Z()}destroy(){this.store={},super.destroy()}},qf={moduleName:"SharedMasterDetail",version:Q0,beans:[Yf],userComponents:{agDetailCellRenderer:$f},dynamicBeans:{detailCellRendererCtrl:WY},apiFunctions:{addDetailGridInfo:zf,removeDetailGridInfo:Qf,getDetailGridInfo:Jf,forEachDetailGridInfo:Zf},dependsOn:[I0,qY,_Y],css:[Xf]},BY={moduleName:"MasterDetail",version:Q0,dependsOn:[qf,DZ,K9]},EY=class extends x{constructor(){super(...arguments);this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:($)=>{let z=!1;if(!this.dragging)z=!0,this.dragging=!0,FQ(this.beans).classList?.add(this.getDraggingCssClass());if(this.updateValuesOnMove($),z){this.changedCalculatedValues=!1;return}if(this.beans.rangeSvc.autoScrollService.check($),this.changedCalculatedValues)this.onDrag($),this.changedCalculatedValues=!1},onDragStop:($)=>{this.dragging=!1,this.onDragEnd($),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:e9,mousedown:e9})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove($){let z=_4(this.gos,$);if(!z||this.shouldSkipCell(z)||this.lastCellHovered&&AQ(z,this.lastCellHovered))return;this.lastCellHovered=z,this.changedCalculatedValues=!0}clearDragProperties(){if(this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),FQ(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging)this.destroy()}getType(){return this.type}refresh($,z){let Q=this.cellCtrl,J=this.getGui(),Z=z??b(this.beans.rangeSvc.getCellRanges()),X=Z.startRow,Y=Z.endRow;if(X&&Y)if(G0(Y,X))this.rangeStartRow=Y,this.rangeEndRow=X;else this.rangeStartRow=X,this.rangeEndRow=Y;if(Q!==$||!A0(J)){this.cellCtrl=$;let q=$.comp.getParentOfValue();if(q)q.appendChild(J)}this.cellRange=Z}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){N(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded($){if(!this.cellRange)return;let{id:z,type:Q}=this.cellRange;if(!z||z!==$.id)return;let J=this.beans.rangeSvc?.getCellRanges().find((Z)=>Z.id===z&&Z.type===Q);if(J&&J!==this.cellRange)this.cellRange=J}},e9=($)=>{$.stopPropagation()};function Gf($){let z=$.length,Q=0;if(z<=1)return $;for(let U=0;U<$.length;U++){let W=$[U],B=W.toString().split("e-");if(B.length>1){Q=Math.max(Q,parseInt(B[1],10));continue}if(Math.floor(W)===W)continue;Q=Math.max(Q,W.toString().split(".")[1].length)}let J=0,Z=0,X=0,Y=0,q=0;for(let U=0;UY?"x":"y";else G=q;if(G!==this.dragAxis)this.dragAxis=G,this.changedCalculatedValues=!0}shouldSkipCell($){return v0($.column)}onDrag($){if(!this.initialPosition){let Q=this.cellCtrl;if(!Q)return;this.initialPosition=Q.cellPosition}let z=this.getLastCellHovered();if(z)this.markPathFrom(this.initialPosition,z)}onDragEnd($){if(this.initialXY=null,!this.markedCells.length)return;let z=this.dragAxis==="x",{cellRange:Q,rangeStartRow:J,rangeEndRow:Z,beans:{rangeSvc:X}}=this,Y=Q.columns.length,q;if(!this.isUp&&!this.isLeft)q=X.createCellRangeFromCellRangeParams({rowStartIndex:J.rowIndex,rowStartPinned:J.rowPinned,columnStart:Q.columns[0],rowEndIndex:z?Z.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:z?Z.rowPinned:this.lastCellMarked.rowPinned,columnEnd:z?this.lastCellMarked.column:Q.columns[Y-1]});else{let G=z?J:this.lastCellMarked;q=X.createCellRangeFromCellRangeParams({rowStartIndex:G.rowIndex,rowStartPinned:G.rowPinned,columnStart:z?this.lastCellMarked.column:Q.columns[0],rowEndIndex:Z.rowIndex,rowEndPinned:Z.rowPinned,columnEnd:Q.columns[Y-1]})}if(q)this.performFill({event:$,initialRange:Q,finalRange:q,shouldUpdateRange:!0})}onDragCancel(){if(this.initialXY=null,!this.markedCells.length)return;this.clearMarkedPath()}performFill({event:$,initialRange:z,finalRange:Q,shouldUpdateRange:J}){let{eventSvc:Z,rangeSvc:X}=this.beans;if(Z.dispatchEvent({type:"fillStart"}),this.handleValueChanged(z,Q,$),J)X.setCellRanges([Q]);Z.dispatchEvent({type:"fillEnd",initialRange:z,finalRange:Q})}getFillHandleDirection(){let $=TJ(this.gos)?.direction;if(!$)return"xy";if($!=="x"&&$!=="y"&&$!=="xy")return j(177),"xy";return $}handleValueChanged($,z,Q){let{beans:J}=this,{rangeSvc:Z,gos:X,valueSvc:Y}=J,q=Z.getRangeEndRow($),G=Z.getRangeStartRow($),_=Z.getRangeEndRow(z),H=Z.getRangeStartRow(z),U=this.dragAxis==="y";if(this.isReduce&&!TJ(X)?.suppressClearOnFillReduction){let R=U?$.columns:$.columns.filter((I)=>z.columns.indexOf(I)<0),O=U?L0(J,_):H;if(O)this.clearCellsInRange(O,q,R);return}let W=[],B=[],E=[],K=[],L=!0,D=0,F=()=>{W.length=0,B.length=0,E.length=0,K.length=0,D=0},M=(R,O)=>{let I=this.isUp?q:G,v=!1;if(U)L=!0,F();while(!v&&I){let C=M0(J,I);if(!C)break;if(U&&R)k(W,R,C,()=>!l(I,this.isUp?G:q));else if(O){L=!0,F();for(let m of O)k(W,m,C,()=>m!==(this.isLeft?$.columns[0]:b($.columns)))}v=l(I,this.isUp?H:_),I=this.isUp?m0(this.beans,I):L0(J,I)}},k=(R,O,I,v)=>{let C,m=!1;if(L)C=Y.getValue(O,I,"edit"),B.push(C),E.push(Y.getValue(O,I,"edit",!0)),K.push(Y.getValueForDisplay({column:O,node:I,from:"edit"}).valueFormatted),L=v();else{let{value:w,fromUserFunction:a,sourceCol:t,sourceRowNode:u}=this.processValues({event:Q,values:R,initialValues:B,initialNonAggregatedValues:E,initialFormattedValues:K,col:O,rowNode:I,idx:D++});if(C=w,O.isCellEditable(I)){let $0=Y.getValue(O,I,"edit");if(!a){if(t){let s=t.getColDef();if(s.useValueFormatterForExport!==!1&&s.valueFormatter){let f0=Y.getValueForDisplay({column:t,node:u,includeValueFormatted:!0,from:"edit"}).valueFormatted;if(f0!=null)C=f0}}if(O.getColDef().useValueParserForImport!==!1)C=Y.parseValue(O,I,t?C:cQ(C),$0)}if(!a||$0!==C)I.setDataValue(O,C,"rangeSvc");else m=!0}}if(!m)R.push({value:C,column:O,rowNode:I})},{changeDetectionSvc:V}=this.beans;V?.beginDeferred();try{if(U)$.columns.forEach((R)=>{M(R)});else{let R=this.isLeft?[...z.columns].reverse():z.columns;M(void 0,R)}this.beans.editSvc?.stopEditing(void 0,{source:"fillHandle"})}finally{V?.endDeferred()}}clearCellsInRange($,z,Q){let J={startRow:$,endRow:z,columns:Q,startColumn:Q[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[J],restoreSourceInBatch:!0})}processValues($){let{formula:z,valueSvc:Q}=this.beans,{event:J,values:Z,initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,col:G,rowNode:_,idx:H}=$,U=TJ(this.gos)?.setFillValue,W=this.dragAxis==="y",B;if(W)B=this.isUp?"up":"down";else B=this.isLeft?"left":"right";if(U){let L=y(this.gos,{event:J,values:Z.map(({value:F})=>F),initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,currentIndex:H,currentCellValue:Q.getValue(G,_,"edit"),direction:B,column:G,rowNode:_}),D=U(L);if(D!==!1)return{value:D,fromUserFunction:!0}}let E=(L)=>typeof L==="number"&&Number.isFinite(L)||typeof L==="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(L.trim()),K=Z.every(({value:L})=>E(L));if(J.altKey||!K){let L=String(b(Z)?.value??"");if(K&&X.length===1){let R=this.isUp||this.isLeft?-1:1;return{value:parseFloat(L)+1*R,fromUserFunction:!1}}let{value:D,column:F,rowNode:M}=Z[H%Z.length],k,V=F.isAllowFormula()&&z?.isFormula(L);if(V){let R=B==="up"?-1:B==="down"?1:0,O=B==="left"?-1:B==="right"?1:0;k=z.updateFormulaByOffset({value:L,rowDelta:R,columnDelta:O})}else k=D;return{value:k,fromUserFunction:!1,sourceCol:V?void 0:F,sourceRowNode:M}}return{value:b(Gf(Z.map(({value:L})=>Number(L)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(let $ of this.markedCells){if(!$.isAlive())continue;let{comp:z}=$;z.toggleCss("ag-selection-fill-top",!1),z.toggleCss("ag-selection-fill-right",!1),z.toggleCss("ag-selection-fill-bottom",!1),z.toggleCss("ag-selection-fill-left",!1)}this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1}clearCellValues(){this.cellValues.length=0}markPathFrom($,z){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(l(z,$))return;let Q=G0(z,$),{rangeStartRow:J,rangeEndRow:Z}=this;if(Q&&(z.rowPinned==J.rowPinned&&z.rowIndex>=J.rowIndex||J.rowPinned!=Z.rowPinned&&z.rowPinned==Z.rowPinned&&z.rowIndex<=Z.rowIndex))this.reduceVertical($,z),this.isReduce=!0;else this.extendVertical($,z,Q),this.isReduce=!1}else{let Q=$.column,J=z.column;if(Q===J)return;let Z=this.beans.visibleCols.allCols,X=Z.indexOf(Q),Y=Z.indexOf(J);if(Y<=X&&Y>=Z.indexOf(this.cellRange.columns[0]))this.reduceHorizontal($,z),this.isReduce=!0;else this.extendHorizontal($,z,Y=4),$.toggleCss(Kf,X),j2(J,Z>0?!0:void 0),$.toggleCss(Lf,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){let $=this.getRangeBorders(),z=this.isSingleCell(),Q=!z&&$.top,J=!z&&$.right,Z=!z&&$.bottom,X=!z&&$.left,Y=this.cellComp;Y.toggleCss(Ff,Q),Y.toggleCss(Mf,J),Y.toggleCss(kf,Z),Y.toggleCss(Vf,X)}isSingleCell(){let{rangeSvc:$}=this;return this.rangeCount===1&&!!$&&!$.isMoreThanOneCell()}getHasChartRange(){let{rangeSvc:$}=this;if(!this.rangeCount||!$)return!1;let z=$.getCellRanges();return z.length>0&&z.every((Q)=>[C$.DIMENSION,C$.VALUE].includes(Q.type))}updateRangeBordersIfRangeCount(){if(this.rangeCount>0)this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}getRangeBorders(){let $=this.beans.gos.get("enableRtl"),z=!1,Q=!1,J=!1,Z=!1,{rangeSvc:X,beans:{visibleCols:Y},cellCtrl:{cellPosition:q}}=this,G=q.column,_=X.getCellRanges().filter((W)=>X.isCellInSpecificRange(q,W));if(!_.length)return{top:z,right:Q,bottom:J,left:Z};let H,U;if($)H=Y.getColAfter(G),U=Y.getColBefore(G);else H=Y.getColBefore(G),U=Y.getColAfter(G);if(!H)Z=!0;if(!U)Q=!0;for(let W=0;W<_.length;W++){if(z&&Q&&J&&Z)break;let B=_[W],E=X.getRangeStartRow(B),K=X.getRangeEndRow(B);if(!z&&l(E,q))z=!0;if(!J&&l(K,q))J=!0;if(!Z&&H&&B.columns.indexOf(H)<0)Z=!0;if(!Q&&U&&B.columns.indexOf(U)<0)Q=!0}return{top:z,right:Q,bottom:J,left:Z}}refreshRangeStyleAndHandle(){let{context:$}=this.beans;if($.isDestroyed())return;this.styleCellForRangeType();let z=this.getRangeForHandle();if(this.selectionHandle&&!z)this.selectionHandle=$.destroyBean(this.selectionHandle);if(z)this.addSelectionHandle(z);this.refreshHandleColor(z),this.cellComp.toggleCss(Df,!!this.selectionHandle)}styleCellForRangeType(){if(this.hasChartRange){let{rangeSvc:$}=this,z=$.getCellRanges()[0],J=z.type===C$.DIMENSION&&$.isCellInSpecificRange(this.cellCtrl.cellPosition,z);this.cellComp.toggleCss(zX,J)}else this.cellComp.toggleCss(zX,!1),this.applyRangeColor(this.getRangeColorClass())}applyRangeColor($){if(this.rangeColorClass&&this.rangeColorClass!==$)this.cellComp.toggleCss(this.rangeColorClass,!1),this.cellComp.toggleCss("ag-formula-range",!1);if($)this.cellComp.toggleCss($,!0),this.cellComp.toggleCss("ag-formula-range",$.startsWith("ag-formula-range"));this.rangeColorClass=$??null}getRangeColorClass(){let{rangeSvc:$,rangeCount:z}=this;if(!$||!z)return null;let Q=$.getCellRanges();for(let J=Q.length-1;J>=0;J--){let Z=Q[J],X=Z.colorClass;if(!X)continue;if($.isCellInSpecificRange(this.cellCtrl.cellPosition,Z))return X}return null}refreshHandleColor($){let z=this.selectionHandle?.getGui?.(),Q=$?.colorClass??null;if(!z){this.handleColorClass=null;return}if(this.handleColorClass&&this.handleColorClass!==Q)z.classList.remove(this.handleColorClass);if(Q)z.classList.add(Q);else if(this.handleColorClass)z.classList.remove(this.handleColorClass);this.handleColorClass=Q??null}getRangeForHandle(){let{gos:$,editSvc:z}=this.beans,Q=this.rangeSvc,J=Q.getCellRanges(),Z=J.length;if(this.rangeCount<1||Z<1)return null;let X=z?.isRangeSelectionEnabledWhileEditing(),Y=X?J:[b(J)];for(let q of Y){let{cellPosition:G,column:_}=this.cellCtrl,H=QX($)&&!_.isSuppressFillHandle(),U=Af($),B=!z?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(X||Z===1&&(H||U));if(this.hasChartRange)B=q.type===C$.VALUE;if(B&&q.endRow!=null&&Q.isContiguousRange(q)&&Q.isBottomRightCell(q,G))return q}return null}addSelectionHandle($){let{beans:z}=this,Q=z.editSvc?.isRangeSelectionEnabledWhileEditing(),J=$.type,X=!Q&&QX(z.gos)&&n(J)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==X)this.selectionHandle=z.context.destroyBean(this.selectionHandle);if(!this.selectionHandle){let Y=z.registry.createDynamicBean(X===0?"fillHandle":"rangeHandle",!1);if(Y)this.selectionHandle=z.context.createBean(Y)}this.selectionHandle?.refresh(this.cellCtrl,$)}destroy(){this.unsetComp()}},Rf=class extends S{constructor($){super();this.eContainer=$}postConstruct(){let{beans:$,gos:z,eContainer:Q}=this,J=$.rangeSvc,Z={eElement:Q,onDragStart:J.onDragStart.bind(J),onDragStop:J.onDragStop.bind(J),onDragging:J.onDragging.bind(J)},X=$.dragSvc,Y=X.addDragSource.bind(X,Z),q=X.removeDragSource.bind(X,Z);if(this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(z))Y();else q()}),this.addDestroyFunc(q),u0(z))Y()}},jf=class extends S{constructor($,z){super();this.column=$,this.eGui=z}postConstruct(){this.addManagedElementListeners(this.eGui,{click:($)=>$&&this.onClick($)})}onClick($){this.beans.rangeSvc?.handleColumnSelection(this.column,$)}},ff=class extends S{constructor($,z){super();this.column=$,this.comp=z,this.columnMap=new Map,this.isActive=!1,this.resetColumnMap()}postConstruct(){this.addManagedPropertyListener("cellSelection",()=>{this.refreshActive()}),this.refreshActive(),this.setupRangeHeaderHighlight()}resetColumnMap(){this.columnMap.clear();let $;if(this.column.isColumn)$=[this.column];else $=this.column.getDisplayedLeafColumns();for(let z of $)this.columnMap.set(z,!1)}refreshActive(){let{gos:$,rangeSvc:z}=this.beans,Q=$.get("cellSelection");this.isActive=!!(Q&&z&&typeof Q==="object"&&Q.enableHeaderHighlight)}setupRangeHeaderHighlight(){let $=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:$,columnPinned:$,columnMoved:$,columnGroupOpened:$}),$()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();let $=this.beans.rangeSvc.getCellRanges(),z=!1,Q=!0;for(let J of $){if(z)break;for(let Z of J.columns)if(this.columnMap.has(Z))this.columnMap.set(Z,!0),z||(z=!0)}for(let J of Array.from(this.columnMap.values()))if(J===!1){Q=!1;break}this.comp.toggleCss("ag-header-range-highlight",z&&Q)}destroy(){super.destroy(),this.comp=null,this.column=null}},Of=class extends S{constructor(){super(...arguments);this.beanName="rangeSvc",this.rangeSelectionExtensions=[],this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1,this.columnRangeSelectionCtx={}}wireBeans($){this.rowModel=$.rowModel,this.dragSvc=$.dragSvc,this.colModel=$.colModel,this.visibleCols=$.visibleCols,this.cellNavigation=$.cellNavigation,this.ctrlsSvc=$.ctrlsSvc}postConstruct(){let $=this.onColumnsChanged.bind(this),z=()=>this.removeAllCellRanges(),Q=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:$,columnVisible:$,columnValueChanged:$,columnPivotModeChanged:z,columnRowGroupChanged:z,columnPivotChanged:z,columnGroupOpened:Q,columnMoved:Q,columnPinned:Q}),this.ctrlsSvc.whenReady(this,(J)=>{let Z=J.gridBodyCtrl;this.autoScrollService=new uJ({scrollContainer:Z.eBodyViewport,scrollAxis:"xy",getVerticalPosition:()=>Z.scrollFeature.getVScrollPosition().top,setVerticalPosition:(X)=>Z.scrollFeature.setVerticalScrollPosition(X),getHorizontalPosition:()=>Z.scrollFeature.getHScrollPosition().left,setHorizontalPosition:(X)=>Z.scrollFeature.setHorizontalScrollPosition(X),shouldSkipVerticalScroll:()=>!V0(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!Z.scrollFeature.isHorizontalScrollShowing()})})}registerRangeSelectionExtension($){if(this.rangeSelectionExtensions.includes($))return;this.rangeSelectionExtensions.push($)}unregisterRangeSelectionExtension($){Z0(this.rangeSelectionExtensions,$)}shouldSuppressRangeSelection($){return this.rangeSelectionExtensions.some((z)=>z.shouldSuppressRangeSelection?.($))}shouldSkipColumn($){return this.rangeSelectionExtensions.some((z)=>z.shouldSkipColumn?.($))}isAllColumnsSelectionCell($){return this.rangeSelectionExtensions.some((z)=>z.isAllColumnsSelectionCell?.($))}isAllColumnsRange($,z){return this.rangeSelectionExtensions.some((Q)=>Q.isAllColumnsRange?.($,z))}updateSelectionModeForCell($){this.setSelectionMode(this.isAllColumnsSelectionCell($))}onDragStart($){let z=this.gos,Q=$.target;if(!u0(z)||Y4(z,Q)?.isSuppressMouseEvent($))return;if(this.shouldSuppressRangeSelection(Q))return;let{shiftKey:J}=$,Z=this.isMultiRange($),X=J&&!!this.cellRanges?.length;if(!Z&&(!X||T(b(this.cellRanges).type)))this.removeAllCellRanges(!0);let Y=this.dragSvc.startTarget;if(Y)this.updateValuesOnMove(Y);if(!this.lastCellHovered)return;if(this.dragging=!0,this.lastMouseEvent=$,this.intersectionRange=Z&&this.getCellRangeCount(this.lastCellHovered)>1,!X)this.setNewestRangeStartCell(this.lastCellHovered);if(this.cellRanges.length>0)this.draggingRange=b(this.cellRanges);else{let q={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},G=this.getColumnsFromModel([this.lastCellHovered.column]);if(!G?.length)return;this.draggingRange={startRow:q,endRow:q,columns:G,startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.addEventListener("scroll",this.bodyScrollListener,{passive:!0}),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}onDragging($){let{dragging:z,lastCellHovered:Q,newestRangeStartCell:J,autoScrollService:Z,cellHasChanged:X}=this;if(!z||!$)return;this.updateValuesOnMove($.target),this.lastMouseEvent=$;let Y=(B)=>Q&&Q.rowPinned===B&&J.rowPinned===B,q=Y("top")||Y("bottom");if(Z.check($,q),!X||!Q)return;let G=J?.column,_=Q?.column,H=this.calculateColumnsBetween(G,_);if(!H)return;let{rowIndex:U,rowPinned:W}=Q;this.draggingRange.endRow={rowIndex:U,rowPinned:W},this.draggingRange.columns=H,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;let{id:$}=this.draggingRange;if(this.autoScrollService.ensureCleared(),this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.removeEventListener("scroll",this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange)this.intersectionRange=!1,this.intersectLastRange();this.dispatchChangedEvent(!1,!0,$)}onColumnsChanged(){this.refreshLastRangeStart();let $=this.visibleCols.allCols;for(let Q of this.cellRanges){let J=Q.columns;if(Q.columns=Q.columns.filter((X)=>X.isVisible()&&$.indexOf(X)!==-1),!X0(J,Q.columns))this.dispatchChangedEvent(!1,!0,Q.id)}let z=this.cellRanges.length;if(this.cellRanges=this.cellRanges.filter((Q)=>Q.columns.length>0),z>this.cellRanges.length)this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){let $=b(this.cellRanges);if(!$)return;this.refreshRangeStart($)}isContiguousRange($){let z=$.columns;if(!z.length)return!1;let Q=this.visibleCols.allCols,J=z.map((Z)=>Q.indexOf(Z)).sort((Z,X)=>Z-X);return b(J)-J[0]+1===z.length}getRangeStartRow($){if($.startRow&&$.endRow)return G0($.startRow,$.endRow)?$.startRow:$.endRow;return{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow($){if($.startRow&&$.endRow)return G0($.startRow,$.endRow)?$.endRow:$.startRow;let z=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;if(z>0)return{rowIndex:z-1,rowPinned:"bottom"};return{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount($){let z=this.beans,Q=this.getRangeStartRow($),J=this.getRangeEndRow($),Z=o2(z,Q);return o2(z,J)-Z+1}handleCellMouseDown($,z){let Q=$.ctrlKey||$.metaKey;this.handleCellSelectionInput(z,{target:$.target,shiftKey:$.shiftKey,isRightClick:g2(this.beans,$),isMultiRange:this.isMultiRange($),isMultiKey:Q,preventDefault:()=>$.preventDefault()})}handleCellKeyboardSelect($,z){let Q=$.ctrlKey||$.metaKey;this.handleCellSelectionInput(z,{target:$.target,shiftKey:$.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(Q),isMultiKey:Q,preventDefault:()=>$.preventDefault()})}handleCellSelectionInput($,z){let{target:Q,shiftKey:J,isRightClick:Z,isMultiRange:X,isMultiKey:Y,preventDefault:q}=z;if(this.shouldSuppressRangeSelection(Q))return;let G=this.isAllColumnsSelectionCell($);if(G)q();if(J)return this.extendLatestRangeToCell($);if(G&&Z)return;this.updateSelectionModeForCell($);let _=this.calculateColumnsBetween($.column,$.column);if(!_)return;let H=G?this.findContainingRange({columns:_,startRow:$,endRow:$}):void 0;if(G&&!!H&&X&&Y&&H)this.removeRowFromAllColumnsRange($,H);else this.setRangeToCell($,X)}isMultiRange($){return this.isMultiRangeForKeyState($.ctrlKey||$.metaKey)}isMultiRangeForKeyState($){let{editingWithRanges:z,allowMulti:Q}=this.getMultiRangeContext();return z||(Q?$:!1)}getMultiRangeContext(){let{gos:$,editSvc:z}=this.beans,Q=!!z?.isEditing()&&!!z?.isRangeSelectionEnabledWhileEditing(),J=X7($)&&!Q;return{editingWithRanges:Q,suppressMultiRanges:J,allowMulti:!J}}removeRowFromAllColumnsRange($,z){let{beans:Q,cellRanges:J}=this,Z=KQ(Q),X=qz(Q),Y=this.getRangeStartRow(z),q=this.getRangeEndRow(z);if(!Y&&l(Z,$))zZ(z,L0(Q,Z),"top");else if(!q&&l(X,$))zZ(z,m0(Q,X),"bottom");else if(l(Y,q))Z0(J,z);else if(l(Y,$))zZ(z,L0(Q,$),"top");else if(l(q,$))zZ(z,m0(Q,$),"bottom");else{let G=m0(Q,$),_=L0(Q,$);z.startRow=Y,z.endRow=G??void 0,J.push({...z,startRow:_??void 0,endRow:q})}this.dispatchChangedEvent(!0,!0)}setRangeToCell($,z=!1){let{gos:Q}=this;if(!u0(Q))return;this.updateSelectionModeForCell($);let J=this.calculateColumnsBetween($.column,$.column);if(!J)return;let{suppressMultiRanges:Z}=this.getMultiRangeContext();if(Z||!z||n(this.cellRanges))this.removeAllCellRanges(!0);let X={rowIndex:$.rowIndex,rowPinned:$.rowPinned},Y={startRow:X,endRow:X,columns:J,startColumn:$.column},q=this.ensureRangeStartColumn(Y);if(!q)return;this.cellRanges.push(Y),this.setNewestRangeStartCell({...$,column:q}),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}getRangeLastColumn($){let z=$.columns[0],Q=b($.columns);return this.newestRangeStartCell?.column===z?Q:z}extendRangeRowCountBy($,z){let{beans:Q}=this,{startRow:J,endRow:Z}=$;if(!J||!Z)return;let X=0,Y,q=G0(Z,J);if(q)Y=J;else Y=Z;let G=z>0?L0:m0,_=Math.abs(z);while(X<_){let U=G(Q,Y);if(!U)break;Y=U,X++}if(X!==_)return;let H={...Y,column:this.getRangeLastColumn($)};this.updateRangeRowBoundary({cellRange:$,boundary:q?"start":"end",cellPosition:H})}extendRangeColumnCountBy($,z){let{columns:Q}=$;if(z===0)return;let J=this.getColumnsFromModel();if(!J)return;let Z=this.ensureRangeStartColumn($);if(!Z)return;let X=b(Q),Y=Z===Q[0]?X:Q[0];if(!X||!Y)return;let q=J.indexOf(Z),G=J.indexOf(Y),_=Gz.indexOf(J)).filter((J)=>J>-1).sort((J,Z)=>J-Z);return{left:z[Q[0]],right:z[b(Q)]}}extendLatestRangeInDirection($){if(this.isEmpty()||!this.newestRangeStartCell)return;let z=$.key,Q=$.ctrlKey||$.metaKey,J=b(this.cellRanges),Z=this.newestRangeStartCell,X=J.endRow.rowIndex,Y=J.endRow.rowPinned,G={column:this.getRangeLastColumn(J),rowIndex:X,rowPinned:Y},_=this.cellNavigation.getNextCellToFocus(z,G,Q);if(!_)return;if(this.shouldSkipColumn(_.column))return;return this.setCellRange({rowStartIndex:Z.rowIndex,rowStartPinned:Z.rowPinned,rowEndIndex:_.rowIndex,rowEndPinned:_.rowPinned,columnStart:Z.column,columnEnd:_.column}),_}setCellRange($){if(!u0(this.gos))return;this.removeAllCellRanges(!0),this.addCellRange($)}setCellRanges($){if(X0(this.cellRanges,$))return;if(!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);let z=this.getColumnsFromModel(this.visibleCols.allCols)??[],Q=!1;for(let J of $){if(J.columns&&J.startRow){let Z=this.getColumnsFromModel(J.columns);if(!Z||Z.length===0)continue;J.columns=Z;let{startRow:X}=J;this.setNewestRangeStartCell({rowIndex:X.rowIndex,rowPinned:X.rowPinned,column:J.columns[0]})}if(!Q&&z.length>0&&this.isAllColumnsRange(J,z))Q=!0;this.cellRanges.push(J)}this.setSelectionMode(Q),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues($){let{beans:z,eventSvc:Q}=this,{cellEventSource:J="rangeSvc",dispatchWrapperEvents:Z,wrapperEventSource:X="deleteKey",restoreSourceInBatch:Y}=$,{cellRanges:q}=$;if(Z)Q.dispatchEvent({type:"cellSelectionDeleteStart",source:X}),Q.dispatchEvent({type:"rangeDeleteStart",source:X});if(!q)q=this.cellRanges;let{valueSvc:G,editSvc:_}=z,H=!!_?.isBatchEditing(),{changeDetectionSvc:U}=z;U?.beginDeferred();try{this.forEachEditableCellInRanges(q,(W,B)=>{if(Y&&H){_?.batchResetToSourceValue({rowNode:W,column:B});return}let E=G.getDeleteValue(B,W);W.setDataValue(B,E,J)})}finally{U?.endDeferred()}if(Z)Q.dispatchEvent({type:"cellSelectionDeleteEnd",source:X}),Q.dispatchEvent({type:"rangeDeleteEnd",source:X})}createCellRangeFromCellRangeParams($){return this.createPartialCellRangeFromRangeParams($,!1)}createPartialCellRangeFromRangeParams($,z){let{columns:Q,columnStart:J,columnEnd:Z,rowStartIndex:X,rowStartPinned:Y,rowEndIndex:q,rowEndPinned:G}=$,_=this.getColumnsFromParams(Q,J,Z);if(!_||!z&&_.columns.length===0)return;let{columns:H,startsOnTheRight:U}=_,W=JX(X,Y),B=JX(q,G);return{startRow:W,endRow:B,columns:H,startColumn:this.getColumnFromModel(J)??(U?b(H):H[0])}}addCellRange($){let z=this.gos;if(!u0(z)||!this.verifyCellRanges(z))return;this.setSelectionMode(!1);let Q=this.createCellRangeFromCellRangeParams($);if(Q){if(Q.startRow)this.setNewestRangeStartCell({rowIndex:Q.startRow.rowIndex,rowPinned:Q.startRow.rowPinned,column:Q.startColumn});return this.cellRanges.push(Q),this.dispatchChangedEvent(!1,!0,Q.id),Q}}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){let $=this.cellRanges.length;if($===0)return!1;if($>1)return!0;let z=this.cellRanges[0],Q=this.getRangeStartRow(z),J=this.getRangeEndRow(z);return Q.rowPinned!==J.rowPinned||Q.rowIndex!==J.rowIndex||z.columns.length!==1}areAllRangesAbleToMerge(){let $=new Map;if(this.cellRanges.length<=1)return!0;for(let J of this.cellRanges)this.forEachRowInRange(J,(Z)=>{let X=`${Z.rowPinned||"normal"}_${Z.rowIndex}`,Y=$.get(X),q=J.columns.map((G)=>G.getId());if(Y){let G=q.filter((_)=>Y.indexOf(_)===-1);Y.push(...G)}else $.set(X,q)});let Q;for(let J of $.values()){let Z=J.sort().join();if(Q===void 0){Q=Z;continue}if(Q!==Z)return!1}return!0}removeAllCellRanges($){if(this.isEmpty())return;if(this.onDragStop(),this.cellRanges.length=0,!$)this.dispatchChangedEvent(!1,!0)}isCellInAnyRange($){return this.getCellRangeCount($)>0}isCellInSpecificRange($,z){let Q=z.columns?.includes($.column),J=this.isRowInRange($,z);return Q&&J}isColumnInAnyRange($){let{beans:z}=this,Q=KQ(z),J=qz(z);if(!Q||!J)return!1;let Z=$.isColumn?[$]:$.getDisplayedLeafColumns();return this.findContainingRange({columns:Z,startRow:Q,endRow:J},!0)!=null}findContainingRange({columns:$,startRow:z,endRow:Q},J=!1){let Z=this.cellRanges;for(let X=Z.length-1;X>=0;X--){let Y=Z[X],q=$.every((_)=>Y.columns.includes(_)),G=!1;if(J)G=l(Y.startRow,z)&&l(Y.endRow,Q);else{let _=z&&this.isRowInRange(z,Y),H=Q&&this.isRowInRange(Q,Y);G=!!_&&!!H}if(q&&G)return Y}}isBottomRightCell($,z){let Q=this.visibleCols.allCols,J=$.columns.map((_)=>Q.indexOf(_)).sort((_,H)=>_-H),{startRow:Z,endRow:X}=$,Y=G0(Z,X)?X:Z,q=Q.indexOf(z.column)===b(J),G=z.rowIndex===Y.rowIndex&&j$(z.rowPinned)===j$(Y.rowPinned);return q&&G}getCellRangeCount($){return this.cellRanges.filter((z)=>this.isCellInSpecificRange($,z)).length}isRowInRange($,z){let Q=this.getRangeStartRow(z),J=this.getRangeEndRow(z),Z=l($,Q),X=l($,J);if(Z||X)return!0;let Y=!G0($,Q),q=G0($,J);return Y&&q}intersectLastRange($){let{editingWithRanges:z,suppressMultiRanges:Q}=this.getMultiRangeContext();if(z||Q||$&&this.dragging||this.isEmpty())return;let J=b(this.cellRanges),Z=this.getRangeStartRow(J),X=this.getRangeEndRow(J),Y=[];for(let q of this.cellRanges.slice(0,-1)){let G=this.getRangeStartRow(q),_=this.getRangeEndRow(q),H=q.columns,U=H.filter((B)=>J.columns.indexOf(B)===-1);if(U.length===H.length){Y.push(q);continue}if(G0(X,G)||G0(_,Z)){Y.push(q);continue}let W=Y.length;if(G0(G,Z)){let B={columns:[...H],startColumn:J.startColumn,startRow:{...G},endRow:m0(this.beans,Z)};Y.push(B)}if(U.length>0){let B={columns:U,startColumn:U.includes(J.startColumn)?J.startColumn:U[0],startRow:Pf([{...Z},{...G}]),endRow:Tf([{...X},{..._}])};Y.push(B)}if(G0(X,_))Y.push({columns:[...H],startColumn:J.startColumn,startRow:L0(this.beans,X),endRow:{..._}});if(Y.length-W===1)Y[Y.length-1].id=q.id}if(this.cellRanges=Y,$)this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature($,z,Q){$.createManagedBean(new ff(z,Q))}setSelectionMode($){this.selectionMode=$?1:0}refreshRangeStart($){let{columns:z}=$,Q=this.ensureRangeStartColumn($);if(!Q)return;let J=(G,_)=>{let H=$.columns.filter((U)=>U!==G);if(G)$.startColumn=G,$.columns=_?[G,...H]:[...H,G];else $.columns=H},{left:Z,right:X}=this.getRangeEdgeColumns($);if(Q===z[0]&&Q!==Z){J(Z,!0);return}if(Q===b(z)&&Q===X)J(X,!1)}setNewestRangeStartCell($){this.newestRangeStartCell=$}getColumnsFromParams($,z,Q){let J=!$&&!z&&!Q,Z,X=!1;if(J||$)Z=this.getColumnsFromModel(J?void 0:$);else if(z&&Q){if(Z=this.calculateColumnsBetween(z,Q),Z?.length)X=Z[0]!==this.getColumnFromModel(z)}return Z?{columns:Z,startsOnTheRight:X}:void 0}verifyCellRanges($){let{suppressMultiRanges:z}=this.getMultiRangeContext(),Q=Z7($)&&z&&this.cellRanges.length>1;if(Q)j(93);return!Q}forEachRowInRange($,z){let Q=this.getRangeStartRow($),J=this.getRangeEndRow($),Z=Q;while(Z){if(z(Z),l(Z,J))break;Z=L0(this.beans,Z)}}forEachEditableCellInRanges($,z){let{beans:Q}=this;for(let J of $)this.forEachRowInRange(J,(Z)=>{let X=M0(Q,Z);if(!X)return;for(let Y=0;Y0,_=z.ctrlKey||z.metaKey,H=!q||_,U=KQ(J),W=qz(J);if(!U||!W)return;if(z.key===A.ENTER)z.preventDefault();if(z.shiftKey){let E=Z.root;if(!E)return;let K=$.isColumn?$:b($.getLeafColumns()),L=this.findContainingRange({columns:[E],startRow:U,endRow:W},!0);if(!L){Z0(X,Z.lastCellRange),this.selectColumns(this.calculateColumnsBetween(E,K),U,W);return}this.updateRangeRowBoundary({cellRange:L,boundary:"end",cellPosition:{column:K,...W}});return}if(G&&(Y||!_&&!q))this.removeAllCellRanges(!0);let B=(E,K)=>{let L=this.findContainingRange({columns:E,startRow:U,endRow:W},!0);if(L&&H)this.deselectColumnsFromRange(L,E);else{let D=this.selectColumns(E,U,W);if(D)Z.lastCellRange=D}Z.root=K};if($.isColumn)B([$],$);else{let E=$.getDisplayedLeafColumns();B(E,E[0])}}deselectColumnsFromRange($,z){if(Q1($.columns,z),z.includes($.startColumn))$.startColumn=$.columns[0];if($.columns.length===0)Z0(this.cellRanges,$);this.dispatchChangedEvent(!0,!0)}selectColumns($,z,Q){return this.addCellRange({columns:$,columnStart:$[0],columnEnd:b($),rowStartIndex:z.rowIndex,rowStartPinned:z.rowPinned,rowEndIndex:Q.rowIndex,rowEndPinned:Q.rowPinned})}};function JX($,z){return $!=null?{rowIndex:$,rowPinned:z}:void 0}function Pf($){let z;for(let Q of $)if(z===void 0||G0(z,Q))z=Q;return z}function Tf($){let z;for(let Q of $)if(z===void 0||G0(Q,z))z=Q;return z}function vf($,z){let{startRow:Q,endRow:J}=$,Z=G0(Q,J)?J:Q,X=z.rowIndex===Z.rowIndex&&z.rowPinned===Z.rowPinned,Y=$.columns[0],q=b($.columns),G=$.startColumn===Y?q:Y;return z.column===G&&X}function zZ($,z,Q){let J;if(Q==="top")J=!$.startRow||!$.endRow||G0($.startRow,$.endRow)?"startRow":"endRow";else J=!$.startRow||!$.endRow||G0($.startRow,$.endRow)?"endRow":"startRow";$[J]=z??void 0}var KY={moduleName:"CellSelection",version:Q0,beans:[Of],dynamicBeans:{fillHandle:Hf,rangeHandle:Uf},apiFunctions:{getCellRanges:Bf,addCellRange:Ef,clearRangeSelection:$X,clearCellSelection:$X},dependsOn:[I0,iz,mJ],css:[Wf]};function If($){return $.colModel.isPivotMode()}function Cf($,z,Q){return $.pivotResultCols?.lookupPivotResultCol(z,Q)??null}function bf($,z){$.valueColsSvc?.setColumns(z,"api")}function yf($){return $.valueColsSvc?.columns??[]}function xf($,z){$.valueColsSvc?.removeColumns(z,"api")}function wf($,z){$.valueColsSvc?.addColumns(z,"api")}function Nf($,z){$.pivotColsSvc?.setColumns(z,"api")}function gf($,z){$.pivotColsSvc?.removeColumns(z,"api")}function hf($,z){$.pivotColsSvc?.addColumns(z,"api")}function uf($){return $.pivotColsSvc?.columns??[]}function mf($,z){$.pivotResultCols?.setPivotResultCols(z,"api")}function cf($){let z=$.pivotResultCols?.getPivotResultCols();return z?z.list:null}var ZX="PivotRowTotal_",pf=({headerName:$},{headerName:z})=>{if($&&!z)return 1;else if(!$&&z)return-1;else if(!$&&!z)return 0;if($z)return 1;else return 0},nf=($)=>(z,Q)=>$(z.headerName,Q.headerName),df=class extends S{constructor(){super(...arguments);this.beanName="pivotColDefSvc"}wireBeans($){this.colModel=$.colModel,this.pivotColsSvc=$.pivotColsSvc,this.valueColsSvc=$.valueColsSvc,this.colNames=$.colNames}postConstruct(){let $=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=$(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=$()});let z=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=z(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=z()})}createPivotColumnDefs($){let z=this.createPivotColumnsFromUniqueValues($);function Q(Z,X=[]){return Z.forEach((Y)=>{if(Y.children!==void 0)Q(Y.children,X);else X.push(Y)}),X}let J=Q(z);return this.addRowGroupTotals(z,J),this.addExpandablePivotGroups(z,J),this.addPivotTotalsToGroups(z,J),z}createPivotColumnsFromUniqueValues($){let z=this.pivotColsSvc?.columns??[],Q=z.length;return this.recursivelyBuildGroup(0,$,[],Q,z)}recursivelyBuildGroup($,z,Q,J,Z){if($>=J)return this.buildMeasureCols(Q);let{pivotComparator:X}=Z[$].getColDef(),Y=X?nf(X):pf,q=this.valueColsSvc?.columns;if(q?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&$===J-1){let _=[];for(let H of z.keys()){let U=[...Q,H],W=this.createColDef(q[0],H,U);W.columnGroupShow="open",_.push(W)}return _.sort(Y),_}let G=[];for(let _ of z.keys()){let H=this.pivotDefaultExpanded===-1||${let J=this.colNames.getDisplayNameForColumn(Q,"header"),Z=this.createColDef(Q,J,$);return Z.columnGroupShow="open",Z})}addExpandablePivotGroups($,z){let Q=this.gos.get("suppressExpandablePivotGroups");if(Q||this.gos.get("pivotColumnGroupTotals"))return;let J=(Z,X,Y)=>{if("children"in Z){let{valueColsSvc:_}=this,{columns:H=[]}=_??{},U=new Map;Z.children.forEach((E)=>{J(E,X,U)});let W=!Z.children.some((E)=>E.children),B=W&&H.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let E of H){let K=this.colNames.getDisplayNameForColumn(E,"header"),L=this.createColDef(E,K,Z.pivotKeys);if(L.pivotTotalColumnIds=U.get(E.getColId()),L.columnGroupShow=!Q?"closed":"open",L.aggFunc=E.getAggFunc(),!W||B)Z.children.push(L),X.push(L)}this.merge(Y,U);return}if(!Z.pivotValueColumn)return;let q=Z.pivotValueColumn.getColId();if(Y.has(q))Y.get(q).push(Z.colId);else Y.set(q,[Z.colId])};$.forEach((Z)=>{J(Z,z,new Map)})}addPivotTotalsToGroups($,z){if(!this.gos.get("pivotColumnGroupTotals"))return;let Q=this.gos.get("pivotColumnGroupTotals")==="after",J=this.valueColsSvc?.columns,Z=J?.map((X)=>X.getAggFunc());if(!Z||Z.length<1||!this.sameAggFuncs(Z))return;if(J){let X=J[0];$.forEach((Y)=>{this.recursivelyAddPivotTotal(Y,z,X,Q)})}}recursivelyAddPivotTotal($,z,Q,J){let Z=$;if(!Z.children){let Y=$;return Y.colId?[Y.colId]:null}let X=[];if(Z.children.forEach((Y)=>{let q=this.recursivelyAddPivotTotal(Y,z,Q,J);if(q)X=X.concat(q)}),Z.children.length>1){let q=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),G=this.createColDef(Q,q,$.pivotKeys,!0);G.pivotTotalColumnIds=X,G.aggFunc=Q.getAggFunc(),G.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;let _=$.children;if(J)_.push(G);else _.unshift(G);z.push(G)}return X}addRowGroupTotals($,z){if(!this.gos.get("pivotRowTotals"))return;let Q=this.gos.get("pivotRowTotals")==="after",Z=(this.valueColsSvc?.columns??[]).slice();if(!Q)Z.reverse();let X=Z.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let Y=0;YX.data?.[X.colDef.field],Z.pivotKeys=Q,Z.pivotValueColumn=$,Z.filter===!0)Z.filter="agNumberColumnFilter";return Z}sameAggFuncs($){if($.length==1)return!0;for(let z=1;z<$.length;z++)if($[z]!==$[0])return!1;return!0}merge($,z){z.forEach((Q,J)=>{let X=[...$.has(J)?$.get(J):[],...Q];$.set(J,X)})}generateColumnGroupId($){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map((Q)=>Q.getColId()).join("-")}_${$.join("-")}`}generateColumnId($,z){return`pivot_${(this.pivotColsSvc?.columns??[]).map((J)=>J.getColId()).join("-")}_${$.join("-")}_${z}`}createColDefsFromFields($){let z=new Map;for(let Z=0;Z<$.length;Z++){let Y=$[Z].split(this.fieldSeparator),q=z;for(let G=0;G{let G=[];for(let[U,W]of Y){let B=Q(`${Z}${this.fieldSeparator}${U}`,U,W,q+1);G.push(B)}if(G.length===0){let U=this.colModel.getColDefCol(X);if(U){let B=this.colNames.getDisplayNameForColumn(U,"header")??X,E=this.createColDef(U,B,void 0,!1);return E.colId=Z,E.aggFunc=U.getAggFunc(),E.valueGetter=(K)=>K.data?.[Z],E}return{colId:Z,headerName:X,valueGetter:(B)=>B.data?.[Z]}}if(this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&G.length===1&&"colId"in G[0])return G[0].headerName=X,G[0];return{openByDefault:this.pivotDefaultExpanded===-1||q{Z.forEach((X)=>{if(T(X.children)){let q=X;if(Q)Q(q);J(q.children)}else{let q=X;if(z)z(q)}})};if($)J($)}},XX="Exceeded maximum allowed pivot column count.",YZ=($)=>{let z={};return $.forEach((Q,J)=>z[J]=Q instanceof Map?YZ(Q):Q),z},sf=class extends S{constructor(){super(...arguments);this.beanName="pivotStage",this.step="pivot",this.refreshProps=["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"],this.uniqueValues=new Map,this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans($){this.valueSvc=$.valueSvc,this.colModel=$.colModel,this.pivotResultCols=$.pivotResultCols,this.rowGroupColsSvc=$.rowGroupColsSvc,this.valueColsSvc=$.valueColsSvc,this.pivotColsSvc=$.pivotColsSvc,this.pivotColDefSvc=$.pivotColDefSvc}execute($){if(this.colModel.isPivotActive())return this.executePivotOn($);else return this.executePivotOff()}executePivotOff(){if(this.aggregationColumnsHashLastTime=null,this.uniqueValues=new Map,this.pivotResultCols.isPivotResultColsPresent())return this.pivotResultCols.setPivotResultCols(null,"rowModelUpdated"),!0;return!1}executePivotOn($){let z=this.valueColsSvc?.columns.length??1,Q=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=Q===-1?-1:Q/z;let J;try{J=this.bucketUpRowNodes($)}catch(D){if(D.message===XX)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:D.message}),this.lastTimeFailed=!0,!1;throw D}let Z=this.setUniqueValues(J),X=this.valueColsSvc?.columns??[],Y=X.map((D)=>`${D.getId()}-${D.getColDef().headerName}`).join("#"),q=X.map((D)=>D.getAggFunc().toString()).join("#"),G=this.aggregationColumnsHashLastTime!==Y,_=this.aggregationFuncsHashLastTime!==q;this.aggregationColumnsHashLastTime=Y,this.aggregationFuncsHashLastTime=q;let H=(this.rowGroupColsSvc?.columns??[]).map((D)=>D.getId()).join("#"),U=H!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=H;let W=this.gos.get("pivotRowTotals"),B=this.gos.get("pivotColumnGroupTotals"),E=this.gos.get("suppressExpandablePivotGroups"),K=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),L=W!==this.pivotRowTotalsLastTime||B!==this.pivotColumnGroupTotalsLastTime||E!==this.suppressExpandablePivotGroupsLastTime||K!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=W,this.pivotColumnGroupTotalsLastTime=B,this.suppressExpandablePivotGroupsLastTime=E,this.removePivotHeaderRowWhenSingleValueColumnLastTime=K,this.lastTimeFailed||Z||G||U||_||L){let D=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(D,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues($){if(!DJ(YZ(this.uniqueValues),YZ($)))return this.uniqueValues=$,!0;return!1}bucketUpRowNodes($){this.currentUniqueCount=0;let z=new Map;S0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,$,(J)=>{if(J.leafGroup)J.childrenMapped=null});let Q=(J)=>{if(J.leafGroup)this.bucketRowNode(J,z);else{let Z=J.childrenAfterFilter;if(Z)for(let X=0,Y=Z.length;Xthis.maxUniqueValues;if(Y&&W)throw Error(XX)}if(!Z.has(U))Z.set(U,[]);Z.get(U).push(H)}if(Q===z.length-1)return Z;let q=new Map;for(let G of Z.keys())q.set(G,this.bucketChildren(Z.get(G),z,Q+1,J.get(G)));return q}},rf={moduleName:"SharedPivot",version:Q0,beans:[tf,df,ZY],apiFunctions:{isPivotMode:If,getPivotResultColumn:Cf,setValueColumns:bf,getValueColumns:yf,removeValueColumns:xf,addValueColumns:wf,setPivotColumns:Nf,removePivotColumns:gf,addPivotColumns:hf,getPivotColumns:uf,setPivotResultColumns:mf,getPivotResultColumns:cf},dependsOn:[HY,W4]},LY={moduleName:"Pivot",version:Q0,rowModels:["clientSide"],beans:[sf],dependsOn:[rf,cj,DZ]};var Rb=String.fromCodePoint(31,41150,8291);var DY=[{symbol:"%",fixity:"postfix",precedence:100},{symbol:"-",fixity:"prefix",precedence:90},{symbol:"+",fixity:"prefix",precedence:90},{symbol:"^",fixity:"infix",precedence:80,associativity:"right"},{symbol:"*",fixity:"infix",precedence:70,associativity:"left",isAssociative:!0},{symbol:"/",fixity:"infix",precedence:70,associativity:"left"},{symbol:"+",fixity:"infix",precedence:60,associativity:"left",isAssociative:!0},{symbol:"-",fixity:"infix",precedence:60,associativity:"left"},{symbol:"&",fixity:"infix",precedence:55,associativity:"left",isAssociative:!0},{symbol:"=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<>",fixity:"infix",precedence:50,associativity:"left"},{symbol:">=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<=",fixity:"infix",precedence:50,associativity:"left"},{symbol:">",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<",fixity:"infix",precedence:50,associativity:"left"}],YX=new Map;for(let $ of DY){let z=YX.get($.symbol)??[];z.push($),YX.set($.symbol,z)}var jb=[...new Set(DY.map(($)=>$.symbol))].sort(($,z)=>z.length-$.length);var fb=Symbol("WrappedFunctionMarker");var lf={column:"bar",groupedColumn:"bar",stackedColumn:"bar",normalizedColumn:"bar",bar:"bar",groupedBar:"bar",stackedBar:"bar",normalizedBar:"bar",line:"line",stackedLine:"line",normalizedLine:"line",scatter:"scatter",bubble:"bubble",pie:"pie",donut:"donut",doughnut:"donut",area:"area",stackedArea:"area",normalizedArea:"area",histogram:"histogram",radarLine:"radar-line",radarArea:"radar-area",nightingale:"nightingale",radialColumn:"radial-column",radialBar:"radial-bar",sunburst:"sunburst",rangeBar:"range-bar",rangeArea:"range-area",boxPlot:"box-plot",treemap:"treemap",heatmap:"heatmap",waterfall:"waterfall",funnel:"funnel",coneFunnel:"cone-funnel",pyramid:"pyramid"},af=new Set(["columnLineCombo","areaColumnCombo","customCombo"]);function of($){return af.has($)}function ef($){return $==="doughnut"?"donut":$}function $O($){return lf[$]}var zO=["number","category","grouped-category","log","time"];var Ob=zO.reduce(($,z)=>({...$,[z]:{title:{_enabledFromTheme:!0}}}),{});var MZ=($)=>{return(z)=>{if(z==null)return!0;return $(z)}};var QO=["doughnut"];function JO($){return!!$O($)||of($)}function ZO($){return QO.includes($)}var Tb=MZ(($)=>{if(JO($))return!0;if(ZO($)){let z=ef($);return zz(`The chart type '${$}' has been deprecated. Please use '${z}' instead.`),z}return!1}),vb=MZ(($)=>{return typeof $==="object"}),Ib=MZ(($)=>{return typeof $==="object"}),Cb=MZ(($)=>{return typeof $==="string"||typeof $==="function"});function FY($){return $.map((z,Q,J)=>z.map((Z,X)=>J.slice(0,Q+1).reduce((Y,q)=>Y+q[X],0)))}function MY($){let z=$.map((Q,J)=>$.reduce((Z,X)=>Math.max(Z,X[J]),0));return $.map((Q)=>Q.map((J,Z)=>J/z[Z]*19))}var kY=[[1,3,5],[2,6,4],[5,3,1]];var XO=FY(kY);var bb=MY(XO);var YO=kY;var qO=FY(YO);var yb=MY(qO);var GO=["number","category","time","grouped-category"],_O=["angle-category","angle-number","radius-category","radius-number"],xb=[...GO,..._O];t6.registerModules([A9,e8,V9,E9,k9,G9,a8,oX,KY,LY,BY,z5,cX,iX,dX,sX,UY]);var ax=($,z)=>{let{data:Q,options:J,api:Z,on:X,class:Y,style:q="height: 100%; width: 100%;"}=$,G=null,_=()=>{return document.documentElement.getAttribute("data-theme")==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches},H=(U)=>{return U?"ag-theme-alpine-dark":"ag-theme-alpine"};return $html("div",{style:q,class:Y,ref:(U)=>{try{let W=typeof Q==="function"?Q():Q,B=typeof J==="function"?J():J,E=["onFilterChanged","onModelUpdated","onGridSizeChanged","onFirstDataRendered","onRowValueChanged","onSelectionChanged","onCellClicked","onCellDoubleClicked","onCellValueChanged","onRowClicked","onSortChanged","onContextMenu","onColumnResized","onColumnMoved","onRowDataUpdated","onCellEditingStarted","onCellEditingStopped","onPaginationChanged","onBodyScroll"],K={};E.forEach((V)=>{if(X?.[V])K[V]=(R)=>X[V](R)});let L={...B,theme:H(_()),rowData:W||[],onGridReady:(V)=>{if(G=V.api,Z)Z.current=G;if(X?.onGridReady)X.onGridReady(V);if(B?.autoSizeColumns)setTimeout(()=>{if(G&&!G.isDestroyed()){let R=G.getColumns();if(R?.length)G.autoSizeColumns(R)}},100)},...K};G=nJ(U,L);let D=$watch([Q],()=>{if(!G||G.isDestroyed())return;let V=typeof Q==="function"?Q():Q;if(Array.isArray(V)){let R=G.getGridOption("rowData");if(V!==R)G.setGridOption("rowData",V)}}),F=$watch([_],()=>{if(G&&!G.isDestroyed()){let V=_(),R=H(V),O=G.getGridOption("theme");if(R!==O)G.setGridOption("theme",R)}}),M=["pagination","paginationPageSize","suppressRowClickSelection","rowSelection","enableCellTextSelection","ensureDomOrder","stopEditingWhenCellsLoseFocus","enterMovesDown","enterMovesDownAfterEdit"],k=$watch([J],()=>{if(!G||G.isDestroyed()||!J)return;let V=typeof J==="function"?J():J;M.forEach((R)=>{if(V[R]!==void 0)try{G.setGridOption(R,V[R])}catch(O){console.warn(`Could not set grid option ${R}:`,O)}})});U._cleanups.add(D),U._cleanups.add(F),U._cleanups.add(k),U._cleanups.add(()=>{if(G&&!G.isDestroyed()){if(G.destroy(),Z)Z.current=null;G=null}})}catch(W){console.error("Failed to initialize AG Grid:",W),U.innerHTML=`
Error loading grid: ${W.message}
`}}})};export{y8 as themeQuartz,zB as iconSetQuartzLight,nJ as createGrid,t6 as ModuleRegistry,ax as Grid}; diff --git a/dist/sigpro-grid.min.js b/dist/sigpro-grid.min.js new file mode 100644 index 0000000..44992d3 --- /dev/null +++ b/dist/sigpro-grid.min.js @@ -0,0 +1,70 @@ +(()=>{var{defineProperty:VZ,getOwnPropertyNames:RY,getOwnPropertyDescriptor:jY}=Object,fY=Object.prototype.hasOwnProperty;function OY($){return this[$]}var PY=($)=>{var z=(_5??=new WeakMap).get($),Q;if(z)return z;if(z=VZ({},"__esModule",{value:!0}),$&&typeof $==="object"||typeof $==="function"){for(var J of RY($))if(!fY.call(z,J))VZ(z,J,{get:OY.bind($,J),enumerable:!(Q=jY($,J))||Q.enumerable})}return _5.set($,z),z},_5;var TY=($)=>$;function vY($,z){this[$]=TY.bind(null,z)}var IY=($,z)=>{for(var Q in z)VZ($,Q,{get:z[Q],enumerable:!0,configurable:!0,set:vY.bind(z,Q)})};var VO={};IY(VO,{themeQuartz:()=>V4,iconSetQuartzLight:()=>N8,createGrid:()=>M1,ModuleRegistry:()=>N2,Grid:()=>kO});function b($){if(!$?.length)return;return $[$.length-1]}function X0($,z,Q){if($===z)return!0;if(!$||!z)return $==null&&z==null;let J=$.length;if(J!==z.length)return!1;for(let Z=0;Z=0)$.splice(Q,1)}function Q1($,z){let Q=0,J=0;for(;Q<$.length;Q++)if(!z.includes($[Q]))$[J]=$[Q],J++;while(J<$.length)$.pop()}function H5($,z,Q){for(let J=0;J=0;J--)$.splice(Q,0,z[J])}var j$=($)=>{if($==null||$==="")return null;return $};function T($){return $!=null&&$!==""}function n($){return!T($)}var cQ=($)=>{return $!=null&&typeof $.toString==="function"?$.toString():null},FJ=($,z)=>{let Q=$?JSON.stringify($):null,J=z?JSON.stringify(z):null;return Q===J},CY=($,z,Q=!1)=>{if($==null)return z==null?0:-1;if(z==null)return 1;if(typeof $==="object"&&$.toNumber)$=$.toNumber();if(typeof z==="object"&&z.toNumber)z=z.toNumber();if(!Q||typeof $!=="string"){if($>z)return 1;if(${let G=J?()=>J.wrapIncoming(q):q;if(z)this.dispatchAsync(G);else G()},X=this.getListeners(Q,z,!1);if((X?.size??0)>0){let q=new Set(X);for(let G of q){if(!X?.has(G))continue;Z(()=>G($))}}let Y=this.getGlobalListeners(z);if(Y.size>0){let q=new Set(Y);for(let G of q)Z(()=>G(Q,$))}}getGlobalListeners($){return $?this.globalAsyncListeners:this.globalSyncListeners}dispatchAsync($){if(this.asyncFunctionsQueue.push($),!this.scheduled){let z=()=>{window.setTimeout(this.flushAsyncQueue.bind(this),0)},Q=this.frameworkOverrides;if(Q)Q.wrapIncoming(z);else z();this.scheduled=!0}}flushAsyncQueue(){this.scheduled=!1;let $=this.asyncFunctionsQueue.slice();this.asyncFunctionsQueue=[];for(let z of $)z()}},bY=/[&<>"']/g,yY={"&":"&","<":"<",">":">",'"':""","'":"'"};function J1($){return $?.toString().toString()??null}function W0($){return J1($)?.replace(bY,(z)=>yY[z])??null}function o1($){return typeof $==="string"&&$.startsWith("=")&&$.length>1}function xY($){if(!$||$==null)return null;let z=/([a-z])([A-Z])/g,Q=/([A-Z]+)([A-Z])([a-z])/g;return $.replace(z,"$1 $2").replace(Q,"$1 $2$3").replace(/\./g," ").split(" ").map((Z)=>Z.substring(0,1).toUpperCase()+(Z.length>1?Z.substring(1,Z.length):"")).join(" ")}function r0($){return $.eRootDiv.getRootNode()}function d($){return r0($).activeElement}function Y0($){let{gos:z,eRootDiv:Q}=$,J=null,Z=z.get("getDocument");if(Z&&T(Z))J=Z();else if(Q)J=Q.ownerDocument;if(J&&T(J))return J;return document}function hz($){let z=d($);return z===null||z===Y0($).body}function R2($){return Y0($).defaultView||window}function FQ($){let z=null,Q=null;try{z=Y0($).fullscreenElement}catch(J){}finally{if(!z)z=r0($);let J=z.querySelector("body");if(J)Q=J;else if(z instanceof ShadowRoot)Q=z;else if(z instanceof Document)Q=z?.documentElement;else Q=z}return Q}function wY($){return FQ($)?.clientWidth??(window.innerWidth||-1)}function NY($){return FQ($)?.clientHeight??(window.innerHeight||-1)}function c0($,z,Q){if(Q==null||typeof Q==="string"&&Q=="")j2($,z);else X$($,z,Q)}function X$($,z,Q){$.setAttribute(A6(z),Q.toString())}function j2($,z){$.removeAttribute(A6(z))}function A6($){return`aria-${$}`}function _0($,z){if(z)$.setAttribute("role",z);else $.removeAttribute("role")}function gY($){let z=$?.direction;if(z==="asc")return"ascending";else if(z==="desc")return"descending";else if(z==="mixed")return"other";return"none"}function S6($){return Number.parseInt($.getAttribute("aria-posinset"),10)}function hY($){return $.getAttribute("aria-label")}function E0($,z){c0($,"label",z)}function pQ($,z){c0($,"labelledby",z)}function MJ($,z){c0($,"describedby",z)}function R6($,z){c0($,"live",z)}function uY($,z){c0($,"atomic",z)}function mY($,z){c0($,"relevant",z)}function j6($,z){c0($,"invalid",z)}function f6($,z){c0($,"level",z)}function O6($,z){c0($,"disabled",z)}function kJ($,z){c0($,"hidden",z)}function w0($,z){X$($,"expanded",z)}function P6($){j2($,"expanded")}function VJ($,z){X$($,"setsize",z)}function AJ($,z){X$($,"posinset",z)}function cY($,z){X$($,"multiselectable",z)}function pY($,z){X$($,"rowcount",z)}function e1($,z){X$($,"rowindex",z)}function iY($,z){X$($,"colcount",z)}function T6($,z){X$($,"colindex",z)}function nY($,z){X$($,"colspan",z)}function dY($,z){X$($,"sort",z)}function tY($){j2($,"sort")}function f2($,z){c0($,"selected",z)}function v6($,z){X$($,"checked",z===void 0?"mixed":z)}function sY($,z){c0($,"controls",z)}function I6($,z){sY($,z.id),pQ(z,$.id)}function U5($,z){c0($,"owns",z)}function C6($,z){c0($,"haspopup",z===!1?null:z)}function O2($,z){return z===void 0?$("ariaIndeterminate","indeterminate"):z===!0?$("ariaChecked","checked"):$("ariaUnchecked","unchecked")}function P2($,z,Q){let J=$.parentElement,Z=J&&J.firstChild;while(Z){if(z)Z.classList.toggle(z,Z===$);if(Q)Z.classList.toggle(Q,Z!==$);Z=Z.nextSibling}}var rY="[tabindex], input, select, button, textarea, [href]",b6="[disabled], .ag-disabled:not(.ag-button), .ag-disabled *";function wQ($){if(!$)return!1;if(!$.matches("input, select, button, textarea"))return!1;if(!$.matches(b6))return!1;return A0($)}function N($,z,Q={}){let{skipAriaHidden:J}=Q;if($.classList.toggle("ag-hidden",!z),!J)kJ($,!z)}function lY($,z,Q={}){let{skipAriaHidden:J}=Q;if($.classList.toggle("ag-invisible",!z),!J)kJ($,!z)}function T2($,z){let J=z?(X)=>X.setAttribute("disabled",""):(X)=>X.removeAttribute("disabled");J($);let Z=$.querySelectorAll("input")??[];for(let X of Z)J(X)}function vz($,z,Q){let J=0;while($){if($.classList.contains(z))return!0;if($=$.parentElement,typeof Q=="number"){if(++J>Q)break}else if($===Q)break}return!1}function MQ($){let{height:z,width:Q,borderTopWidth:J,borderRightWidth:Z,borderBottomWidth:X,borderLeftWidth:Y,paddingTop:q,paddingRight:G,paddingBottom:_,paddingLeft:H,marginTop:U,marginRight:W,marginBottom:B,marginLeft:E,boxSizing:K}=window.getComputedStyle($),L=Number.parseFloat;return{height:L(z||"0"),width:L(Q||"0"),borderTopWidth:L(J||"0"),borderRightWidth:L(Z||"0"),borderBottomWidth:L(X||"0"),borderLeftWidth:L(Y||"0"),paddingTop:L(q||"0"),paddingRight:L(G||"0"),paddingBottom:L(_||"0"),paddingLeft:L(H||"0"),marginTop:L(U||"0"),marginRight:L(W||"0"),marginBottom:L(B||"0"),marginLeft:L(E||"0"),boxSizing:K}}function SJ($){let z=MQ($);if(z.boxSizing==="border-box")return z.height-z.paddingTop-z.paddingBottom-z.borderTopWidth-z.borderBottomWidth;return z.height}function xz($){let z=MQ($);if(z.boxSizing==="border-box")return z.width-z.paddingLeft-z.paddingRight-z.borderLeftWidth-z.borderRightWidth;return z.width}function y6($){let{height:z,marginBottom:Q,marginTop:J}=MQ($);return Math.floor(z+Q+J)}function x6($){let{width:z,marginLeft:Q,marginRight:J}=MQ($);return Math.floor(z+Q+J)}function w6($){let z=$.getBoundingClientRect(),{borderTopWidth:Q,borderLeftWidth:J,borderRightWidth:Z,borderBottomWidth:X}=MQ($);return{top:z.top+(Q||0),left:z.left+(J||0),right:z.right+(Z||0),bottom:z.bottom+(X||0)}}function $J($,z){let Q=$.scrollLeft;if(z)Q=Math.abs(Q);return Q}function zJ($,z,Q){if(Q)z*=-1;$.scrollLeft=z}function z0($){while($?.firstChild)$.firstChild.remove()}function T0($){if($?.parentNode)$.remove()}function N6($){return!!$.offsetParent}function A0($){if($.checkVisibility)return $.checkVisibility({checkVisibilityCSS:!0});return!(!N6($)||window.getComputedStyle($).visibility!=="visible")}function v2($){let z=document.createElement("div");return z.innerHTML=($||"").trim(),z.firstChild}function g6($,z,Q){if(Q&&Q.nextSibling===z)return;if(!$.firstChild)$.appendChild(z);else if(Q)if(Q.nextSibling)$.insertBefore(z,Q.nextSibling);else $.appendChild(z);else if($.firstChild&&$.firstChild!==z)$.prepend(z)}function h6($,z){for(let Q=0;Q`-${z.toLocaleLowerCase()}`)}function Z1($,z){if(!z)return;for(let Q of Object.keys(z)){let J=z[Q];if(!Q?.length||J==null)continue;let Z=aY(Q),X=J.toString(),Y=X.replace(/\s*!important/g,""),q=Y.length!=X.length?"important":void 0;$.style.setProperty(Z,Y,q)}}function iQ($){return()=>{let z=$();if(!z)return!0;return oY(z)||eY(z)}}function oY($){return $.clientWidth<$.scrollWidth}function eY($){return $.clientHeight<$.scrollHeight}function u6($,z){if(z==="flex")$.style.removeProperty("width"),$.style.removeProperty("minWidth"),$.style.removeProperty("maxWidth"),$.style.flex="1 1 auto";else f$($,z)}function f$($,z){z=m6(z),$.style.width=z,$.style.maxWidth=z,$.style.minWidth=z}function NQ($,z){z=m6(z),$.style.height=z,$.style.maxHeight=z,$.style.minHeight=z}function m6($){return typeof $==="number"?`${$}px`:$}function X1($){return $ instanceof Node||$ instanceof HTMLElement}function Pz($,z,Q){if(Q==null||Q==="")$.removeAttribute(z);else $.setAttribute(z,Q.toString())}function $q($,z){if(!z.isContentEditable)return;let Q=R2($).getSelection();if(!Q)return;let J=Y0($).createRange();J.selectNodeContents(z),J.collapse(!1),Q.removeAllRanges(),Q.addRange(J)}function F$($,z,Q){let Z=R2($).ResizeObserver,X=Z?new Z(Q):null;return X?.observe(z),()=>X?.disconnect()}function Y$($,z){let Q=R2($);if(Q.requestAnimationFrame)Q.requestAnimationFrame(z);else if(Q.webkitRequestAnimationFrame)Q.webkitRequestAnimationFrame(z);else Q.setTimeout(z,0)}var c6="data-ref",AZ;function W5(){return AZ??(AZ=document.createTextNode(" ")),AZ.cloneNode()}function K0($){let{attrs:z,children:Q,cls:J,ref:Z,role:X,tag:Y}=$,q=document.createElement(Y);if(J)q.className=J;if(Z)q.setAttribute(c6,Z);if(X)q.setAttribute("role",X);if(z)for(let G of Object.keys(z))q.setAttribute(G,z[G]);if(Q)if(typeof Q==="string")q.textContent=Q;else{let G=!0;for(let _ of Q)if(_)if(typeof _==="string")q.appendChild(document.createTextNode(_)),G=!1;else if(typeof _==="function")q.appendChild(_());else{if(G)q.appendChild(W5()),G=!1;q.append(K0(_)),q.appendChild(W5())}}return q}var zq=["touchstart","touchend","touchmove","touchcancel","scroll"],Qq=["wheel"],SZ={},aZ=(()=>{let $={select:"input",change:"input",submit:"form",reset:"form",error:"img",load:"img",abort:"img"};return(Q)=>{if(typeof SZ[Q]==="boolean")return SZ[Q];let J=document.createElement($[Q]||"div");return Q="on"+Q,SZ[Q]=Q in J}})();function RJ($,z){if(!z||!$)return!1;return Zq(z).indexOf($)>=0}function Jq($){let z=[],Q=$.target;while(Q)z.push(Q),Q=Q.parentElement;return z}function Zq($){let z=$;if(z.path)return z.path;if(z.composedPath)return z.composedPath();return Jq(z)}function Xq($,z,Q){let J=Yq(z),Z;if(J!=null)Z={passive:J};$.addEventListener(z,Q,Z)}var Yq=($)=>{let z=zq.includes($),Q=Qq.includes($);if(z)return!0;if(Q)return!1};function p6($,z,Q){if(Q===0)return!1;let J=Math.abs($.clientX-z.clientX),Z=Math.abs($.clientY-z.clientY);return Math.max(J,Z)<=Q}var qQ=($,z)=>{let Q=$.identifier;for(let J=0,Z=z.length;J0&&W+$.clientWidth>X+L)W=X+L-$.clientWidth;if(W<0)W=0;if(Y>0&&U+$.clientHeight>Y+K)U=Y+K-$.clientHeight;if(U<0)U=0;$.style.left=`${W}px`,$.style.top=`${U}px`}var p1=($,...z)=>{for(let Q of z){let[J,Z,X,Y]=Q;J.addEventListener(Z,X,Y),$.push(Q)}},I2=($)=>{if($){for(let[z,Q,J,Z]of $)z.removeEventListener(Q,J,Z);$.length=0}},QQ=($)=>{if($.cancelable)$.preventDefault()};function Gq($,z){return z}function i6($){return $?.getLocaleTextFunc()??Gq}function _q($,z,Q,J){let Z=z[Q];return $.getLocaleTextFunc()(Q,typeof Z==="function"?Z(J):Z,J)}var R0=class{constructor(){this.destroyFunctions=[],this.destroyed=!1,this.__v_skip=!0,this.propertyListenerId=0,this.lastChangeSetIdLookup={},this.isAlive=()=>!this.destroyed}preWireBeans($){this.beans=$,this.stubContext=$.context,this.eventSvc=$.eventSvc,this.gos=$.gos}destroy(){let{destroyFunctions:$}=this;for(let z=0;z<$.length;z++)$[z]();$.length=0,this.destroyed=!0,this.dispatchLocalEvent({type:"destroyed"})}addEventListener($,z,Q){if(!this.localEventService)this.localEventService=new K$;this.localEventService.addEventListener($,z,Q)}removeEventListener($,z,Q){this.localEventService?.removeEventListener($,z,Q)}dispatchLocalEvent($){this.localEventService?.dispatchEvent($)}addManagedElementListeners($,z){return this._setupListeners($,z)}addManagedEventListeners($){return this._setupListeners(this.eventSvc,$)}addManagedListeners($,z){return this._setupListeners($,z)}_setupListeners($,z){let Q=[];for(let J of Object.keys(z)){let Z=z[J];if(Z)Q.push(this._setupListener($,J,Z))}return Q}_setupListener($,z,Q){if(this.destroyed)return()=>null;let J;if(Hq($))$.__addEventListener(z,Q),J=()=>{return $.__removeEventListener(z,Q),null};else{let Z=Uq($);if($ instanceof HTMLElement)Xq($,z,Q);else if(Z)$.addListener(z,Q);else $.addEventListener(z,Q);J=Z?()=>{return $.removeListener(z,Q),null}:()=>{return $.removeEventListener(z,Q),null}}return this.destroyFunctions.push(J),()=>{return J(),this.destroyFunctions=this.destroyFunctions.filter((Z)=>Z!==J),null}}setupPropertyListener($,z){let{gos:Q}=this;Q.addPropertyEventListener($,z);let J=()=>{return Q.removePropertyEventListener($,z),null};return this.destroyFunctions.push(J),()=>{return J(),this.destroyFunctions=this.destroyFunctions.filter((Z)=>Z!==J),null}}addManagedPropertyListener($,z){if(this.destroyed)return()=>null;return this.setupPropertyListener($,z)}addManagedPropertyListeners($,z){if(this.destroyed)return;let Q=$.join("-")+this.propertyListenerId++,J=(Z)=>{if(Z.changeSet){if(Z.changeSet&&Z.changeSet.id===this.lastChangeSetIdLookup[Q])return;this.lastChangeSetIdLookup[Q]=Z.changeSet.id}let X={type:"propertyChanged",changeSet:Z.changeSet,source:Z.source};z(X)};for(let Z of $)this.setupPropertyListener(Z,J)}getLocaleTextFunc(){return i6(this.beans.localeSvc)}addDestroyFunc($){if(this.isAlive())this.destroyFunctions.push($);else $()}createOptionalManagedBean($,z){return $?this.createManagedBean($,z):void 0}createManagedBean($,z){let Q=this.createBean($,z);return this.addDestroyFunc(this.destroyBean.bind(this,$,z)),Q}createBean($,z,Q){return(z||this.stubContext).createBean($,Q)}destroyBean($,z){return(z||this.stubContext).destroyBean($)}destroyBeans($,z){return(z||this.stubContext).destroyBeans($)}};function Hq($){return $.__addEventListener!==void 0}function Uq($){return $.eventServiceType==="global"}var S=class extends R0{},oZ=new Set,jJ=($,z)=>{if(!oZ.has(z))oZ.add(z),$()};jJ._set=oZ;var Wq={pending:!1,funcs:[]},Bq={pending:!1,funcs:[]};function eZ($,z="setTimeout",Q){let J=z==="raf"?Bq:Wq;if(J.funcs.push($),J.pending)return;J.pending=!0;let Z=()=>{let X=J.funcs.slice();J.funcs.length=0,J.pending=!1;for(let Y of X)Y()};if(z==="raf")Y$(Q,Z);else window.setTimeout(Z,0)}function g$($,z,Q){let J;return function(...Z){let X=this;return window.clearTimeout(J),J=window.setTimeout(function(){if($.isAlive())z.apply(X,Z)},Q),J}}function B5($,z){let Q=0;return function(...J){let Z=this,X=Date.now();if(X-Q{if(X!=null)window.clearInterval(X),X=null};$.addDestroyFunc(q);let G=()=>{let _=Date.now()-Z>J;if(z()||_)Q(),Y=!0,q()};if(G(),!Y)X=window.setInterval(G,10)}var Eq=new Set(["__proto__","constructor","prototype"]);function Kq($,z){if($==null)return;if(Array.isArray($)){for(let Q=0;Q<$.length;Q++)z(Q.toString(),$[Q]);return}for(let Q of Object.keys($).filter((J)=>!Eq.has(J)))z(Q,$[Q])}function B0($,z,Q=!0,J=!1){if(!T(z))return;Kq(z,(Z,X)=>{let Y=$[Z];if(Y===X)return;if(J){if(Y==null&&X!=null){if(typeof X==="object"&&X.constructor===Object)Y={},$[Z]=Y}}if(E5(X)&&E5(Y)&&!Array.isArray(Y))B0(Y,X,Q,J);else if(Q||X!==void 0)$[Z]=X})}function E5($){return typeof $==="object"&&$!==null}var b2=class ${static applyGlobalGridOptions(z){if(!$.gridOptions)return{...z};let Q={};if(B0(Q,$.gridOptions,!0,!0),$.mergeStrategy==="deep")B0(Q,z,!0,!0);else Q={...Q,...z};if($.gridOptions.context)Q.context=$.gridOptions.context;if(z.context){if($.mergeStrategy==="deep"&&Q.context)B0(z.context,Q.context,!0,!0);Q.context=z.context}return Q}static applyGlobalGridOption(z,Q){if($.mergeStrategy==="deep"){let J=Lq(z);if(J&&typeof J==="object"&&typeof Q==="object")return $.applyGlobalGridOptions({[z]:Q})[z]}return Q}};b2.gridOptions=void 0;b2.mergeStrategy="shallow";var y2=b2;function Lq($){return y2.gridOptions?.[$]}var Dq={suppressContextMenu:!1,preventDefaultOnContextMenu:!1,allowContextMenuWithControlKey:!1,suppressMenuHide:!0,enableBrowserTooltips:!1,tooltipTrigger:"hover",tooltipShowDelay:2000,tooltipSwitchShowDelay:200,tooltipHideDelay:1e4,tooltipMouseTrack:!1,tooltipShowMode:"standard",tooltipInteraction:!1,copyHeadersToClipboard:!1,copyGroupHeadersToClipboard:!1,clipboardDelimiter:"\t",suppressCopyRowsToClipboard:!1,suppressCopySingleCellRanges:!1,suppressLastEmptyLineOnPaste:!1,suppressClipboardPaste:!1,suppressClipboardApi:!1,suppressCutToClipboard:!1,maintainColumnOrder:!1,enableStrictPivotColumnOrder:!1,suppressFieldDotNotation:!1,allowDragFromColumnsToolPanel:!1,suppressMovableColumns:!1,suppressColumnMoveAnimation:!1,suppressMoveWhenColumnDragging:!1,suppressDragLeaveHidesColumns:!1,suppressRowGroupHidesColumns:!1,suppressAutoSize:!1,autoSizePadding:20,skipHeaderOnAutoSize:!1,singleClickEdit:!1,suppressClickEdit:!1,readOnlyEdit:!1,stopEditingWhenCellsLoseFocus:!1,enterNavigatesVertically:!1,enterNavigatesVerticallyAfterEdit:!1,enableCellEditingOnBackspace:!1,undoRedoCellEditing:!1,undoRedoCellEditingLimit:10,suppressCsvExport:!1,suppressExcelExport:!1,cacheQuickFilter:!1,includeHiddenColumnsInQuickFilter:!1,excludeChildrenWhenTreeDataFiltering:!1,enableAdvancedFilter:!1,includeHiddenColumnsInAdvancedFilter:!1,enableCharts:!1,masterDetail:!1,keepDetailRows:!1,keepDetailRowsCount:10,detailRowAutoHeight:!1,tabIndex:0,rowBuffer:10,valueCache:!1,valueCacheNeverExpires:!1,enableCellExpressions:!1,suppressTouch:!1,suppressFocusAfterRefresh:!1,suppressBrowserResizeObserver:!1,suppressPropertyNamesCheck:!1,suppressChangeDetection:!1,debug:!1,suppressLoadingOverlay:!1,suppressNoRowsOverlay:!1,pagination:!1,paginationPageSize:100,paginationPageSizeSelector:!0,paginationAutoPageSize:!1,paginateChildRows:!1,suppressPaginationPanel:!1,pivotMode:!1,pivotPanelShow:"never",pivotDefaultExpanded:0,pivotSuppressAutoColumn:!1,suppressExpandablePivotGroups:!1,functionsReadOnly:!1,suppressAggFuncInHeader:!1,alwaysAggregateAtRootLevel:!1,aggregateOnlyChangedColumns:!1,suppressAggFilteredOnly:!1,removePivotHeaderRowWhenSingleValueColumn:!1,animateRows:!0,cellFlashDuration:500,cellFadeDuration:1000,allowShowChangeAfterFilter:!1,domLayout:"normal",ensureDomOrder:!1,enableRtl:!1,suppressColumnVirtualisation:!1,suppressMaxRenderedRowRestriction:!1,suppressRowVirtualisation:!1,rowDragManaged:!1,refreshAfterGroupEdit:!1,rowDragInsertDelay:500,suppressRowDrag:!1,suppressMoveWhenRowDragging:!1,rowDragEntireRow:!1,rowDragMultiRow:!1,embedFullWidthRows:!1,groupDisplayType:"singleColumn",groupDefaultExpanded:0,groupMaintainOrder:!1,groupSelectsChildren:!1,groupSuppressBlankHeader:!1,groupSelectsFiltered:!1,showOpenedGroup:!1,groupRemoveSingleChildren:!1,groupRemoveLowestSingleChildren:!1,groupHideOpenParents:!1,groupHideColumnsUntilExpanded:!1,groupAllowUnbalanced:!1,rowGroupPanelShow:"never",suppressMakeColumnVisibleAfterUnGroup:!1,treeData:!1,rowGroupPanelSuppressSort:!1,suppressGroupRowsSticky:!1,rowModelType:"clientSide",asyncTransactionWaitMillis:50,suppressModelUpdateAfterUpdateTransaction:!1,cacheOverflowSize:1,infiniteInitialRowCount:1,serverSideInitialRowCount:1,cacheBlockSize:100,maxBlocksInCache:-1,maxConcurrentDatasourceRequests:2,blockLoadDebounceMillis:0,purgeClosedRowNodes:!1,serverSideSortAllLevels:!1,serverSideOnlyRefreshFilteredGroups:!1,serverSidePivotResultFieldSeparator:"_",viewportRowModelPageSize:5,viewportRowModelBufferSize:5,alwaysShowHorizontalScroll:!1,alwaysShowVerticalScroll:!1,debounceVerticalScrollbar:!1,suppressHorizontalScroll:!1,suppressScrollOnNewData:!1,suppressScrollWhenPopupsAreOpen:!1,suppressAnimationFrame:!1,suppressMiddleClickScrolls:!1,suppressPreventDefaultOnMouseWheel:!1,rowMultiSelectWithClick:!1,suppressRowDeselection:!1,suppressRowClickSelection:!1,suppressCellFocus:!1,suppressHeaderFocus:!1,suppressMultiRangeSelection:!1,enableCellTextSelection:!1,enableRangeSelection:!1,enableRangeHandle:!1,enableFillHandle:!1,fillHandleDirection:"xy",suppressClearOnFillReduction:!1,accentedSort:!1,unSortIcon:!1,suppressMultiSort:!1,alwaysMultiSort:!1,suppressMaintainUnsortedOrder:!1,suppressRowHoverHighlight:!1,suppressRowTransform:!1,columnHoverHighlight:!1,deltaSort:!1,enableGroupEdit:!1,groupLockGroupColumns:0,serverSideEnableClientSideSort:!1,suppressServerSideFullWidthLoadingRow:!1,pivotMaxGeneratedColumns:-1,columnMenu:"new",reactiveCustomComponents:!0,suppressSetFilterByDefault:!1,enableFilterHandlers:!1},n6="https://www.ag-grid.com";function dQ($,z,...Q){if($.get("debug"))console.log("AG Grid: "+z,...Q)}function zz($,...z){jJ(()=>d6($,...z),$+z?.join(""))}function GQ($,...z){jJ(()=>Fq($,...z),$+z?.join(""))}function Fq($,...z){console.error("AG Grid: "+$,...z)}function d6($,...z){console.warn("AG Grid: "+$,...z)}var t6=new Set,QJ={},Iz={},i1,s6=!1,r6=!1,Mq=!1;function kq($){let[z,Q]=$.version.split(".")||[],[J,Z]=i1.split(".")||[];return z===J&&Q===Z}function Vq($){if(!i1)i1=$.version;let z=(J)=>`You are using incompatible versions of AG Grid modules. Major and minor versions should always match across modules. ${J} Please update all modules to the same version.`;if(!$.version)GQ(z(`'${$.moduleName}' is incompatible.`));else if(!kq($))GQ(z(`'${$.moduleName}' is version ${$.version} but the other modules are version ${i1}.`));let Q=$.validate?.();if(Q&&!Q.isValid)GQ(`${Q.message}`)}function tQ($,z,Q=!1){if(!Q)s6=!0;Vq($);let J=$.rowModels??["all"];t6.add($);let Z;if(z!==void 0){if(r6=!0,Iz[z]===void 0)Iz[z]={};Z=Iz[z]}else Z=QJ;for(let X of J){if(Z[X]===void 0)Z[X]={};Z[X][$.moduleName]=$}if($.dependsOn)for(let X of $.dependsOn)tQ(X,z,Q)}function Aq($){delete Iz[$]}function $2($,z,Q){let J=(Z)=>!!QJ[Z]?.[$]||!!Iz[z]?.[Z]?.[$];return J(Q)||J("all")}function x2(){return r6}function Sq($,z){let Q=Iz[$]??{};return[...Object.values(QJ.all??{}),...Object.values(Q.all??{}),...Object.values(QJ[z]??{}),...Object.values(Q[z]??{})]}function Rq(){return new Set(t6)}function l6($,z){let Q=Iz[$]??{};return[...Object.values(Q.all??{}),...Object.values(Q[z]??{})]}function jq(){return s6}function w2(){return Mq}var N2=class{static register($){tQ($,void 0)}static registerModules($){for(let z of $)tQ(z,void 0)}};var p="35.2.0",K5=2000,L5=100,a6="_version_",o6=null,_Q=`${n6}/javascript-data-grid`;function fq($){o6=$}function Oq($){_Q=$}function e6($,z,Q){return o6?.($,z)??[Iq($,z,Q)]}function fJ($,z,Q,J,Z){$(`${J?"warning":"error"} #${z}`,...e6(z,Q,Z))}function Pq($){if(!$)return String($);let z={};for(let Q of Object.keys($))if(typeof $[Q]!=="object"&&typeof $[Q]!=="function")z[Q]=$[Q];return JSON.stringify(z)}function Tq($){let z=$;if($ instanceof Error)z=$.toString();else if(typeof $==="object")z=Pq($);return z}function n1($){return $===void 0?"undefined":$===null?"null":$}function z2($,z){return`${$}?${z.toString()}`}function vq($,z,Q){let J=Array.from(z.entries()).sort((X,Y)=>Y[1].length-X[1].length),Z=z2($,z);for(let[X,Y]of J){if(X===a6)continue;let q=Z.length-Q;if(q<=0)break;let G="...",_=q+G.length,H=Y.length-_>L5?Y.slice(0,Y.length-_)+G:Y.slice(0,L5)+G;z.set(X,H),Z=z2($,z)}return Z}function $7($,z){let Q=new URLSearchParams;if(Q.append(a6,p),z)for(let X of Object.keys(z))Q.append(X,Tq(z[X]));let J=`${_Q}/errors/${$}`,Z=z2(J,Q);return Z.length<=K5?Z:vq(J,Q,K5)}var Iq=($,z,Q)=>{let J=$7($,z),Z=`${Q?Q+` +`:""}Visit ${J}`;if(w2())return Z;return`${Z}${Q?"":` + Alternatively register the ValidationModule to see the full message in the console.`}`};function j(...$){fJ(zz,$[0],$[1],!0)}function e(...$){fJ(GQ,$[0],$[1],!1)}function yQ($,z,Q){fJ(GQ,$,z,!1,Q)}function z7($,z,Q){fJ(zz,$,z,!0,Q)}function Cq($,z){let Q=z[0];return`error #${Q} `+e6(Q,z[1],$).join(" ")}function $$(...$){return Cq(void 0,$)}function Q7($,z){return $.get("rowModelType")===z}function o($,z){return Q7($,"clientSide")}function _z($,z){return Q7($,"serverSide")}function V0($,z){return $.get("domLayout")===z}function h$($){return JJ($)!==void 0}function J7($){return typeof $.get("getRowHeight")==="function"}function bq($,z){if(z)return!$.get("enableStrictPivotColumnOrder");return $.get("maintainColumnOrder")}function yq({gos:$,formula:z}){let Q=$.get("rowNumbers");return Q||!!z?.active&&Q!==!1}function sQ($,z,Q=!1,J){let{gos:Z,environment:X}=$;if(J==null)J=X.getDefaultRowHeight();if(J7(Z)){if(Q)return{height:J,estimated:!0};let G={node:z,data:z.data},_=Z.getCallback("getRowHeight")(G);if(Q2(_)){if(_===0)j(23);return{height:Math.max(1,_),estimated:!1}}}if(z.detail&&Z.get("masterDetail"))return xq(Z);let Y=Z.get("rowHeight");return{height:Y&&Q2(Y)?Y:J,estimated:!1}}function xq($){if($.get("detailRowAutoHeight"))return{height:1,estimated:!1};let z=$.get("detailRowHeight");if(Q2(z))return{height:z,estimated:!1};return{height:300,estimated:!1}}function Z7($){let{environment:z,gos:Q}=$,J=Q.get("rowHeight");if(!J||n(J))return z.getDefaultRowHeight();let Z=z.refreshRowHeightVariable();if(Z!==-1)return Z;return j(24),z.getDefaultRowHeight()}function Q2($){return!isNaN($)&&typeof $==="number"&&isFinite($)}function X7($,z,Q){let J=z[$.getDomDataKey()];return J?J[Q]:void 0}function wz($,z,Q,J){let Z=$.getDomDataKey(),X=z[Z];if(n(X))X={},z[Z]=X;X[Q]=J}function HQ($){if($.get("ensureDomOrder"))return!1;return $.get("animateRows")}function kQ($){return!($.get("paginateChildRows")||$.get("groupHideOpenParents")||V0($,"print"))}function W$($){return!$.get("autoGroupColumnDef")?.comparator&&!$.get("treeData")}function T$($){let z=$.get("groupAggFiltering");if(typeof z==="function")return $.getCallback("groupAggFiltering");if(z===!0)return()=>!0;return}function Hz($){return $.get("grandTotalRow")}function OJ($){let z=$.get("groupTotalRow");if(typeof z==="function")return $.getCallback("groupTotalRow");return()=>z??void 0}function Y1($){if(!!$.get("groupHideOpenParents"))return!0;return $.get("groupDisplayType")==="multipleColumns"}function g2($){return Y1($)&&$.get("groupHideColumnsUntilExpanded")&&o($)}function PJ($,z){if(z)return!1;return $.get("groupDisplayType")==="groupRows"}function Y7($,z,Q){return!!z.group&&!z.footer&&PJ($,Q)}function J2($){let z=$.getCallback("getRowId");if(z===void 0)return z;return(Q)=>{let J=z(Q);if(typeof J!=="string")jJ(()=>j(25,{id:J}),"getRowIdString"),J=String(J);return J}}function wq($,z){let Q=$.get("groupHideParentOfSingleChild");if(Q===!0)return!0;if(Q==="leafGroupsOnly"&&z.leafGroup)return!0;if($.get("groupRemoveSingleChildren"))return!0;if($.get("groupRemoveLowestSingleChildren")&&z.leafGroup)return!0;return!1}function TJ($,z){let Q=$.get("suppressGroupChangesColumnVisibility");if(Q===!0)return!1;if(z&&Q==="suppressHideOnGroup")return!1;if(!z&&Q==="suppressShowOnUngroup")return!1;let J=$.get("suppressRowGroupHidesColumns");if(z&&J===!0)return!1;let Z=$.get("suppressMakeColumnVisibleAfterUnGroup");if(!z&&Z===!0)return!1;return!0}function Qz($){return $?.checkboxes??!0}function d1($){return $?.mode==="multiRow"&&($.headerCheckbox??!0)}function EQ($){if(typeof $!=="object")return;return $.checkboxLocation??"selectionColumn"}function RZ($){return $?.hideDisabledCheckboxes??!1}function Nq($){return typeof $.get("rowSelection")!=="string"}function q7($){return $.get("cellSelection")!==void 0}function G7($){let z=$.get("cellSelection");if(z===void 0)return $.get("suppressMultiRangeSelection");return typeof z!=="boolean"?z?.suppressMultiRanges??!1:!1}function u0($){let z=$.get("cellSelection");return z!==void 0?!!z:$.get("enableRangeSelection")}function vJ($){let z=$.get("cellSelection");if(z===void 0)return{mode:"fill",setFillValue:$.get("fillOperation"),direction:$.get("fillHandleDirection"),suppressClearOnFillReduction:$.get("suppressClearOnFillReduction")};return typeof z!=="boolean"&&z.handle?.mode==="fill"?z.handle:void 0}function Jz($){let z=$.get("cellSelection")??!1;return(typeof z==="object"&&z.enableColumnSelection)??!1}function _7($){let z=$.get("rowSelection")??"single";if(typeof z==="string"){let Q=$.get("suppressRowClickSelection"),J=$.get("suppressRowDeselection");if(Q&&J)return!1;else if(Q)return"enableDeselection";else if(J)return"enableSelection";else return!0}return z.mode==="singleRow"||z.mode==="multiRow"?z.enableClickSelection??!1:!1}function gq($){let z=_7($);return z===!0||z==="enableSelection"}function hq($){let z=_7($);return z===!0||z==="enableDeselection"}function Z2($){let z=$.get("rowSelection");if(typeof z==="string")return $.get("isRowSelectable");return z?.isRowSelectable}function JJ($){let z="beanName"in $&&$.beanName==="gos"?$.get("rowSelection"):$.rowSelection;if(typeof z==="string")switch(z){case"multiple":return"multiRow";case"single":return"singleRow";default:return}switch(z?.mode){case"multiRow":case"singleRow":return z.mode;default:return}}function rQ($){return JJ($)==="multiRow"}function uq($){let z=$.get("rowSelection");if(typeof z==="string")return $.get("rowMultiSelectWithClick");return z?.enableSelectionWithoutKeys??!1}function ZJ($){let z=$.get("rowSelection");if(typeof z==="string"){let Q=$.get("groupSelectsChildren"),J=$.get("groupSelectsFiltered");if(Q&&J)return"filteredDescendants";else if(Q)return"descendants";else return"self"}return z?.mode==="multiRow"?z.groupSelects:void 0}function H7($,z=!0){let Q=$.get("rowSelection");if(typeof Q!=="object")return z?"all":void 0;return Q.mode==="multiRow"?Q.selectAll:"all"}function mq($){let z=$.get("rowSelection");if(typeof z==="string")return!1;return z?.mode==="multiRow"?z.ctrlASelectsRows??!1:!1}function lQ($){let z=ZJ($);return z==="descendants"||z==="filteredDescendants"}function D5($){let z=$.get("rowSelection");return typeof z==="object"&&z.masterSelects||"self"}function cq($){return $.isModuleRegistered("SetFilter")&&!$.get("suppressSetFilterByDefault")}function U0($){return $.get("columnMenu")==="legacy"}function h2($){return!U0($)}function pq($){if(!$||$.length<2)return $;return"on"+$[0].toUpperCase()+$.substring(1)}function y($,z){return $.addCommon(z)}function u2({gos:$},z){return z.button===2||z.ctrlKey&&$.get("allowContextMenuWithControlKey")}var iq={resizable:!0,sortable:!0},nq=0;function U7(){return nq++}function Q$($){return $ instanceof q$}var dq=["asc","desc",null],tq=[{type:"absolute",direction:"asc"},{type:"absolute",direction:"desc"},null],q$=class extends S{constructor($,z,Q,J){super();this.colDef=$,this.userProvidedColDef=z,this.colId=Q,this.primary=J,this.isColumn=!0,this.instanceId=U7(),this.autoHeaderHeight=null,this.sortDef=a0(),this._wasSortExplicitlyRemoved=!1,this.moving=!1,this.resizing=!1,this.menuVisible=!1,this.formulaRef=null,this.lastLeftPinned=!1,this.firstRightPinned=!1,this.filterActive=!1,this.colEventSvc=new K$,this.tooltipEnabled=!1,this.rowGroupActive=!1,this.pivotActive=!1,this.aggregationActive=!1,this.flex=null,this.colIdSanitised=W0(Q)}destroy(){super.destroy(),this.beans.rowSpanSvc?.deregister(this)}getInstanceId(){return this.instanceId}initState(){let{colDef:$,beans:{sortSvc:z,pinnedCols:Q,colFlex:J}}=this;z?.initCol(this);let Z=$.hide;if(Z!==void 0)this.visible=!Z;else this.visible=!$.initialHide;Q?.initCol(this),J?.initCol(this)}setColDef($,z,Q){let J=$.spanRows!==this.colDef.spanRows;if(this.colDef=$,this.userProvidedColDef=z,this.initMinAndMaxWidths(),this.initDotNotation(),this.initTooltip(),J)this.beans.rowSpanSvc?.deregister(this),this.initRowSpan();this.dispatchColEvent("colDefChanged",Q)}getUserProvidedColDef(){return this.userProvidedColDef}getParent(){return this.parent}getOriginalParent(){return this.originalParent}postConstruct(){this.initState(),this.initMinAndMaxWidths(),this.resetActualWidth("gridInitializing"),this.initDotNotation(),this.initTooltip(),this.initRowSpan(),this.addPivotListener()}initDotNotation(){let{gos:$,colDef:{field:z,tooltipField:Q}}=this,J=$.get("suppressFieldDotNotation");this.fieldContainsDots=T(z)&&z.includes(".")&&!J,this.tooltipFieldContainsDots=T(Q)&&Q.includes(".")&&!J}initMinAndMaxWidths(){let $=this.colDef;this.minWidth=$.minWidth??this.beans.environment.getDefaultColumnMinWidth(),this.maxWidth=$.maxWidth??Number.MAX_SAFE_INTEGER}initTooltip(){this.beans.tooltipSvc?.initCol(this)}initRowSpan(){if(this.colDef.spanRows)this.beans.rowSpanSvc?.register(this)}addPivotListener(){let $=this.beans.pivotColDefSvc,z=this.colDef.pivotValueColumn;if(!$||!z)return;this.addManagedListeners(z,{colDefChanged:(Q)=>{let J=$.recreateColDef(this.colDef);this.setColDef(J,J,Q.source)}})}resetActualWidth($){let z=this.calculateColInitialWidth(this.colDef);this.setActualWidth(z,$,!0)}calculateColInitialWidth($){let z=$.width??$.initialWidth??200;return Math.max(Math.min(z,this.maxWidth),this.minWidth)}isEmptyGroup(){return!1}isRowGroupDisplayed($){return this.beans.showRowGroupCols?.isRowGroupDisplayed(this,$)??!1}isPrimary(){return this.primary}isFilterAllowed(){return!!this.colDef.filter}isFieldContainsDots(){return this.fieldContainsDots}isTooltipEnabled(){return this.tooltipEnabled}isTooltipFieldContainsDots(){return this.tooltipFieldContainsDots}getHighlighted(){return this.highlighted}__addEventListener($,z){this.colEventSvc.addEventListener($,z)}__removeEventListener($,z){this.colEventSvc.removeEventListener($,z)}addEventListener($,z){this.frameworkEventListenerService=this.beans.frameworkOverrides.createLocalEventListenerWrapper?.(this.frameworkEventListenerService,this.colEventSvc);let Q=this.frameworkEventListenerService?.wrap($,z)??z;this.colEventSvc.addEventListener($,Q)}removeEventListener($,z){let Q=this.frameworkEventListenerService?.unwrap($,z)??z;this.colEventSvc.removeEventListener($,Q)}createColumnFunctionCallbackParams($){return y(this.gos,{node:$,data:$.data,column:this,colDef:this.colDef})}isSuppressNavigable($){return this.beans.cellNavigation?.isSuppressNavigable(this,$)??!1}isCellEditable($){return this.beans.editSvc?.isCellEditable({rowNode:$,column:this})??!1}isSuppressFillHandle(){return!!this.colDef.suppressFillHandle}isAutoHeight(){return!!this.colDef.autoHeight}isAutoHeaderHeight(){return!!this.colDef.autoHeaderHeight}isRowDrag($){return this.isColumnFunc($,this.colDef.rowDrag)}isDndSource($){return this.isColumnFunc($,this.colDef.dndSource)}isCellCheckboxSelection($){return this.beans.selectionSvc?.isCellCheckboxSelection(this,$)??!1}isSuppressPaste($){return this.isColumnFunc($,this.colDef?.suppressPaste??null)}isResizable(){return!!this.getColDefValue("resizable")}getColDefValue($){return this.colDef[$]??iq[$]}isColumnFunc($,z){if(typeof z==="boolean")return z;if(typeof z==="function"){let Q=this.createColumnFunctionCallbackParams($);return z(Q)}return!1}createColumnEvent($,z){return y(this.gos,{type:$,column:this,columns:[this],source:z})}isMoving(){return this.moving}getSort(){return this.sortDef.direction}getSortDef(){if(!this.sortDef.direction)return null;return this.sortDef}getColDefAllowedSortTypes(){let $=[],{sort:z,initialSort:Q}=this.colDef,J=z===null?z:L$(z?.type),Z=Q===null?Q:L$(Q?.type);if(J)$.push(J);if(Z)$.push(Z);return $}getSortingOrder(){let $=this.getColDefAllowedSortTypes().includes("absolute")?tq:dq;return(this.colDef.sortingOrder??this.gos.get("sortingOrder")??$).map((z)=>a0(z))}getAvailableSortTypes(){let $=this.getSortingOrder().reduce((z,Q)=>{if(Q.direction)z.push(Q.type);return z},this.getColDefAllowedSortTypes());return new Set($)}get wasSortExplicitlyRemoved(){return this._wasSortExplicitlyRemoved}setSortDef($,z=!1){if(!z)this._wasSortExplicitlyRemoved=!$.direction;this.sortDef=$}isSortable(){return!!this.getColDefValue("sortable")}isSortAscending(){return this.getSort()==="asc"}isSortDescending(){return this.getSort()==="desc"}isSortNone(){return n(this.getSort())}isSorting(){return T(this.getSort())}getSortIndex(){return this.sortIndex}isMenuVisible(){return this.menuVisible}getAggFunc(){return this.aggFunc}getLeft(){return this.left}getOldLeft(){return this.oldLeft}getRight(){return this.left+this.actualWidth}setLeft($,z){if(this.oldLeft=this.left,this.left!==$)this.left=$,this.dispatchColEvent("leftChanged",z)}isFilterActive(){return this.filterActive}isHovered(){return j(261),!!this.beans.colHover?.isHovered(this)}setFirstRightPinned($,z){if(this.firstRightPinned!==$)this.firstRightPinned=$,this.dispatchColEvent("firstRightPinnedChanged",z)}setLastLeftPinned($,z){if(this.lastLeftPinned!==$)this.lastLeftPinned=$,this.dispatchColEvent("lastLeftPinnedChanged",z)}isFirstRightPinned(){return this.firstRightPinned}isLastLeftPinned(){return this.lastLeftPinned}isPinned(){return this.pinned==="left"||this.pinned==="right"}isPinnedLeft(){return this.pinned==="left"}isPinnedRight(){return this.pinned==="right"}getPinned(){return this.pinned}setVisible($,z){let Q=$===!0;if(this.visible!==Q)this.visible=Q,this.dispatchColEvent("visibleChanged",z);this.dispatchStateUpdatedEvent("hide")}isVisible(){return this.visible}isSpanHeaderHeight(){return!this.getColDef().suppressSpanHeaderHeight}getFirstRealParent(){let $=this.getOriginalParent();while($?.isPadding())$=$.getOriginalParent();return $}getColumnGroupPaddingInfo(){let $=this.getParent();if(!$?.isPadding())return{numberOfParents:0,isSpanningTotal:!1};let z=$.getPaddingLevel()+1,Q=!0;while($){if(!$.isPadding()){Q=!1;break}$=$.getParent()}return{numberOfParents:z,isSpanningTotal:Q}}getColDef(){return this.colDef}getDefinition(){return this.colDef}getColumnGroupShow(){return this.colDef.columnGroupShow}getColId(){return this.colId}getId(){return this.colId}getUniqueId(){return this.colId}getActualWidth(){return this.actualWidth}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight($){let z=$!==this.autoHeaderHeight;return this.autoHeaderHeight=$,z}createBaseColDefParams($){return y(this.gos,{node:$,data:$.data,colDef:this.colDef,column:this})}getColSpan($){if(n(this.colDef.colSpan))return 1;let z=this.createBaseColDefParams($),Q=this.colDef.colSpan(z);return Math.max(Q,1)}getRowSpan($){if(n(this.colDef.rowSpan))return 1;let z=this.createBaseColDefParams($),Q=this.colDef.rowSpan(z);return Math.max(Q,1)}setActualWidth($,z,Q=!1){if($=Math.max($,this.minWidth),$=Math.min($,this.maxWidth),this.actualWidth!==$){if(this.actualWidth=$,this.flex!=null&&z!=="flex"&&z!=="gridInitializing")this.flex=null;if(!Q)this.fireColumnWidthChangedEvent(z)}this.dispatchStateUpdatedEvent("width")}fireColumnWidthChangedEvent($){this.dispatchColEvent("widthChanged",$)}isGreaterThanMax($){return $>this.maxWidth}getMinWidth(){return this.minWidth}getMaxWidth(){return this.maxWidth}getFlex(){return this.flex}isRowGroupActive(){return this.rowGroupActive}isPivotActive(){return this.pivotActive}isAnyFunctionActive(){return this.isPivotActive()||this.isRowGroupActive()||this.isValueActive()}isAnyFunctionAllowed(){return this.isAllowPivot()||this.isAllowRowGroup()||this.isAllowValue()}isValueActive(){return this.aggregationActive}isAllowPivot(){return this.colDef.enablePivot===!0}isAllowValue(){return this.colDef.enableValue===!0}isAllowRowGroup(){return this.colDef.enableRowGroup===!0}isAllowFormula(){return this.colDef.allowFormula===!0}dispatchColEvent($,z,Q){let J=this.createColumnEvent($,z);if(Q)B0(J,Q);this.colEventSvc.dispatchEvent(J)}dispatchStateUpdatedEvent($){this.colEventSvc.dispatchEvent({type:"columnStateUpdated",key:$})}};function a0($){if(UQ($))return{direction:$.direction,type:$.type};return{direction:IJ($),type:L$($)}}function Zz($){return $==="asc"||$==="desc"||$===null}function m2($){return $==="default"||$==="absolute"}function UQ($){if(!$||typeof $!=="object")return!1;let z=$;return m2(z.type)&&Zz(z.direction)}function t1($,z){if(!$)return z?z.direction===null:!0;if(!z)return $?$.direction===null:!0;return $.type===z.type&&$.direction===z.direction}function IJ($){return Zz($)?$:null}function L$($){return m2($)?$:"default"}function c2($,z,Q){let Z=Q?.()??z.sortSvc.getDisplaySortForColumn($),X=L$(Z?.type),Y=IJ(Z?.direction),q=$.getAvailableSortTypes(),G=q.has("default"),_=q.has("absolute");return{isDefaultSortAllowed:G,isAbsoluteSortAllowed:_,isAbsoluteSort:X==="absolute",isDefaultSort:X==="default",isAscending:Y==="asc",isDescending:Y==="desc",direction:Y}}function q0($){return $ instanceof Cz}var Cz=class extends S{constructor($,z,Q,J){super();this.colGroupDef=$,this.groupId=z,this.padding=Q,this.level=J,this.isColumn=!1,this.expandable=!1,this.instanceId=U7(),this.expandableListenerRemoveCallback=null,this.expanded=!!$?.openByDefault}destroy(){if(this.expandableListenerRemoveCallback)this.reset(null,void 0);super.destroy()}reset($,z){if(this.colGroupDef=$,this.level=z,this.originalParent=null,this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();this.children=void 0,this.expandable=void 0}getInstanceId(){return this.instanceId}getOriginalParent(){return this.originalParent}getLevel(){return this.level}isVisible(){if(this.children)return this.children.some(($)=>$.isVisible());return!1}isPadding(){return this.padding}setExpanded($){this.expanded=$===void 0?!1:$,this.dispatchLocalEvent({type:"expandedChanged"})}isExpandable(){return this.expandable}isExpanded(){return this.expanded}getGroupId(){return this.groupId}getId(){return this.getGroupId()}setChildren($){this.children=$}getChildren(){return this.children}getColGroupDef(){return this.colGroupDef}getLeafColumns(){let $=[];return this.addLeafColumns($),$}forEachLeafColumn($){if(!this.children)return;for(let z of this.children)if(Q$(z))$(z);else if(q0(z))z.forEachLeafColumn($)}addLeafColumns($){if(!this.children)return;for(let z of this.children)if(Q$(z))$.push(z);else if(q0(z))z.addLeafColumns($)}getColumnGroupShow(){let $=this.colGroupDef;if(!$)return;return $.columnGroupShow}setupExpandable(){if(this.setExpandable(),this.expandableListenerRemoveCallback)this.expandableListenerRemoveCallback();let $=this.onColumnVisibilityChanged.bind(this);for(let z of this.getLeafColumns())z.__addEventListener("visibleChanged",$);this.expandableListenerRemoveCallback=()=>{for(let z of this.getLeafColumns())z.__removeEventListener("visibleChanged",$);this.expandableListenerRemoveCallback=null}}setExpandable(){if(this.isPadding())return;let $=!1,z=!1,Q=!1,J=this.findChildrenRemovingPadding();for(let X=0,Y=J.length;X{for(let J of Q)if(q0(J)&&J.isPadding())z(J.children);else $.push(J)};return z(this.children),$}onColumnVisibilityChanged(){this.setExpandable()}},sq={numericColumn:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"},rightAligned:{headerClass:"ag-right-aligned-header",cellClass:"ag-right-aligned-cell"}};function X2($,z,Q){let J={},Z=$.gos;return Object.assign(J,Z.get("defaultColGroupDef")),Object.assign(J,z),Z.validateColDef(J,Q),J}var rq=class{constructor(){this.existingKeys={}}addExistingKeys($){for(let z=0;z<$.length;z++)this.existingKeys[$[z]]=!0}getUniqueKey($,z){$=cQ($);let Q=0;while(!0){let J=$??z;if(J){if(Q!==0)J+="_"+Q}else J=Q;if(!this.existingKeys[J]){let Z=String(J);if($&&Q>0)j(273,{providedId:$,usedId:Z});return this.existingKeys[Z]=!0,Z}Q++}}},W7=($,z)=>{if(q0($))$.setupExpandable();$.originalParent=z};function B7($,z=null,Q,J,Z){let{existingCols:X,existingGroups:Y}=E7(J),q=new Map(X.map((K)=>[K.getId(),K])),G=new Map(Y.map((K)=>[K.getId(),K])),_=0,H=(K,L)=>{if(_=Math.max(_,L),F7(K)){if(!$.colGroupSvc)return null;let k=K.groupId,V=G.get(k),R=X2($,K,k),O=new Cz(R,k,!1,L);if($.context.createBean(O),V)O.setExpanded(V.isExpanded());return O.setChildren(K.children.map((I)=>H(I,L+1))),O}let D=K.colId,F=q.get(D),M=u$($,K,F?.getColId()??D);if(!F)F=new q$(M,K,D,Q),$.context.createBean(F);else F.setColDef(M,K,Z),D7($,F,M,Z);return $.dataTypeSvc?.addColumnListeners(F),F},U=z?.map((K)=>H(K,0))??[],W=0,B={getUniqueKey:(K,L)=>String(++W)},E=$.colGroupSvc?$.colGroupSvc.balanceColumnTree(U,0,_,B):U;return O$(null,E,W7),{columnTree:E,treeDepth:_}}function p2($,z=null,Q,J,Z){let X=new rq,{existingCols:Y,existingGroups:q,existingColKeys:G}=E7(J);X.addExistingKeys(G);let _=K7($,z,0,Q,Y,X,q,Z),{colGroupSvc:H}=$,U=H?.findMaxDepth(_,0)??0,W=H?H.balanceColumnTree(_,0,U,X):_;return O$(null,W,W7),{columnTree:W,treeDepth:U}}function E7($){let z=[],Q=[],J=[];if($)O$(null,$,(Z)=>{if(q0(Z)){let X=Z;Q.push(X)}else{let X=Z;J.push(X.getId()),z.push(X)}});return{existingCols:z,existingGroups:Q,existingColKeys:J}}function K7($,z,Q,J,Z,X,Y,q){if(!z)return[];let{colGroupSvc:G}=$,_=Array(z.length);for(let H=0;H<_.length;H++){let U=z[H];if(G&&F7(U))_[H]=G.createProvidedColumnGroup(J,U,Q,Z,X,Y,q);else _[H]=lq($,J,U,Z,X,q)}return _}function lq($,z,Q,J,Z,X){let Y=aq(Q,J);if(Y)J?.splice(Y.idx,1);let q=Y?.column;if(!q){let G=Z.getUniqueKey(Q.colId,Q.field),_=u$($,Q,G);q=new q$(_,Q,G,z),$.context.createBean(q)}else{let G=u$($,Q,q.getColId());q.setColDef(G,Q,X),D7($,q,G,X)}return $.dataTypeSvc?.addColumnListeners(q),q}function L7($,z,Q,J,Z,X,Y,q){let{sortSvc:G,pinnedCols:_,colFlex:H}=$;if(Q!==void 0)z.setVisible(!Q,q);if(G){if(G.updateColSort(z,J,q),Z!==void 0)G.setColSortIndex(z,Z)}if(X!==void 0)_?.setColPinned(z,X);if(Y!==void 0)H?.setColFlex(z,Y)}function D7($,z,Q,J){L7($,z,Q.hide,Q.sort,Q.sortIndex,Q.pinned,Q.flex,J);let Z=z.getFlex();if(Z!=null&&Z>0)return;if(Q.width!=null)z.setActualWidth(Q.width,J);else{let X=z.getActualWidth();z.setActualWidth(X,J)}}function aq($,z){if(!z)return;for(let Q=0;Q{for(let Z=0;Zz+Q.getActualWidth(),0)}function J$($,z,Q){let J={};if(!z)return;if(O$(null,z,(X)=>{J[X.getInstanceId()]=X}),Q)O$(null,Q,(X)=>{J[X.getInstanceId()]=null});let Z=Object.values(J).filter((X)=>X!=null);$.context.destroyBeans(Z)}function mz($){return $.getId().startsWith(uz)}function I$($){return(typeof $==="string"?$:("getColId"in $)?$.getColId():$.colId)?.startsWith(M7)??!1}function v0($){return(typeof $==="string"?$:("getColId"in $)?$.getColId():$.colId)?.startsWith(k7)??!1}function q1($){return I$($)||v0($)}function XJ($){let z=[];if($ instanceof Array)z=$;else if(typeof $==="string")z=$.split(",");return z}function G1($,z){return X0($,z,(Q,J)=>Q.getColId()===J.getColId())}function _1($){$.map={};for(let z of $.list)$.map[z.getId()]=z}function Xz($){return $==="optionsUpdated"?"gridOptionsChanged":$}function P$($,z){return $===z||$.colId==z||$.getColDef()===z}var $G=($,z)=>(Q,J)=>{let Z={value1:void 0,value2:void 0},X=!1;if($){if($[Q]!==void 0)Z.value1=$[Q],X=!0;if(T(J)&&$[J]!==void 0)Z.value2=$[J],X=!0}if(!X&&z){if(z[Q]!==void 0)Z.value1=z[Q];if(T(J)&&z[J]!==void 0)Z.value2=z[J]}return Z};function i2($,z){let Q={...$,sort:void 0,colId:z},J=A7($);if(J)Q.sort=J.direction,Q.sortType=J.type;return Q}function A7($){let{sort:z,initialSort:Q}=$,J=UQ(z)||Zz(z),Z=UQ(Q)||Zz(Q);if(J)return a0(z);if(Z)return a0(Q);return null}function S7($,z){return $+"_"+z}function H0($){return $ instanceof aQ}var aQ=class extends S{constructor($,z,Q,J){super();this.providedColumnGroup=$,this.groupId=z,this.partId=Q,this.pinned=J,this.isColumn=!1,this.displayedChildren=[],this.autoHeaderHeight=null,this.parent=null,this.colIdSanitised=W0(this.getUniqueId())}reset(){this.parent=null,this.children=null,this.displayedChildren=null}getParent(){return this.parent}getUniqueId(){return S7(this.groupId,this.partId)}isEmptyGroup(){return this.displayedChildren.length===0}isMoving(){let $=this.getProvidedColumnGroup().getLeafColumns();if(!$||$.length===0)return!1;return $.every((z)=>z.isMoving())}checkLeft(){for(let $ of this.displayedChildren)if(H0($))$.checkLeft();if(this.displayedChildren.length>0)if(this.gos.get("enableRtl")){let z=b(this.displayedChildren).getLeft();this.setLeft(z)}else{let $=this.displayedChildren[0].getLeft();this.setLeft($)}else this.setLeft(null)}getLeft(){return this.left}getOldLeft(){return this.oldLeft}setLeft($){if(this.oldLeft=this.left,this.left!==$)this.left=$,this.dispatchLocalEvent({type:"leftChanged"})}getPinned(){return this.pinned}getGroupId(){return this.groupId}getPartId(){return this.partId}getActualWidth(){let $=0;for(let z of this.displayedChildren??[])$+=z.getActualWidth();return $}isResizable(){if(!this.displayedChildren)return!1;let $=!1;for(let z of this.displayedChildren)if(z.isResizable())$=!0;return $}getMinWidth(){let $=0;for(let z of this.displayedChildren)$+=z.getMinWidth();return $}addChild($){if(!this.children)this.children=[];this.children.push($)}getDisplayedChildren(){return this.displayedChildren}getLeafColumns(){let $=[];return this.addLeafColumns($),$}getDisplayedLeafColumns(){let $=[];return this.addDisplayedLeafColumns($),$}getDefinition(){return this.providedColumnGroup.getColGroupDef()}getColGroupDef(){return this.providedColumnGroup.getColGroupDef()}isPadding(){return this.providedColumnGroup.isPadding()}isExpandable(){return this.providedColumnGroup.isExpandable()}isExpanded(){return this.providedColumnGroup.isExpanded()}setExpanded($){this.providedColumnGroup.setExpanded($)}isAutoHeaderHeight(){return!!this.getColGroupDef()?.autoHeaderHeight}getAutoHeaderHeight(){return this.autoHeaderHeight}setAutoHeaderHeight($){let z=$!==this.autoHeaderHeight;return this.autoHeaderHeight=$,z}addDisplayedLeafColumns($){for(let z of this.displayedChildren??[])if(Q$(z))$.push(z);else if(H0(z))z.addDisplayedLeafColumns($)}addLeafColumns($){for(let z of this.children??[])if(Q$(z))$.push(z);else if(H0(z))z.addLeafColumns($)}getChildren(){return this.children}getColumnGroupShow(){return this.providedColumnGroup.getColumnGroupShow()}getProvidedColumnGroup(){return this.providedColumnGroup}getPaddingLevel(){let $=this.getParent();if(!this.isPadding()||!$?.isPadding())return 0;return 1+$.getPaddingLevel()}calculateDisplayedColumns(){this.displayedChildren=[];let $=this;while($?.isPadding())$=$.getParent();if(!($?$.getProvidedColumnGroup().isExpandable():!1)){this.displayedChildren=this.children,this.dispatchLocalEvent({type:"displayedChildrenChanged"});return}for(let Q of this.children??[]){if(H0(Q)&&!Q.displayedChildren?.length)continue;switch(Q.getColumnGroupShow()){case"open":if($.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;case"closed":if(!$.getProvidedColumnGroup().isExpanded())this.displayedChildren.push(Q);break;default:this.displayedChildren.push(Q);break}}this.dispatchLocalEvent({type:"displayedChildrenChanged"})}},A={BACKSPACE:"Backspace",TAB:"Tab",ENTER:"Enter",ESCAPE:"Escape",SPACE:" ",LEFT:"ArrowLeft",UP:"ArrowUp",RIGHT:"ArrowRight",DOWN:"ArrowDown",DELETE:"Delete",F2:"F2",PAGE_UP:"PageUp",PAGE_DOWN:"PageDown",PAGE_HOME:"Home",PAGE_END:"End",A:"KeyA",C:"KeyC",D:"KeyD",V:"KeyV",X:"KeyX",Y:"KeyY",Z:"KeyZ"},zG=65,QG=67,JG=86,ZG=68,XG=90,YG=89;function R7($){let{keyCode:z}=$,Q;switch(z){case zG:Q=A.A;break;case QG:Q=A.C;break;case JG:Q=A.V;break;case ZG:Q=A.D;break;case XG:Q=A.Z;break;case YG:Q=A.Y;break;default:Q=$.code}return Q}function qG($,z){return new g((Q)=>{Q(window.setInterval($,z))})}var g=class ${constructor(z){this.status=0,this.resolution=null,this.waiters=[],z((Q)=>this.onDone(Q),(Q)=>this.onReject(Q))}static all(z){return z.length?new $((Q)=>{let J=z.length,Z=Array(J);z.forEach((X,Y)=>{X.then((q)=>{if(Z[Y]=q,J--,J===0)Q(Z)})})}):$.resolve()}static resolve(z=null){return new $((Q)=>Q(z))}then(z){return new $((Q)=>{if(this.status===1)Q(z(this.resolution));else this.waiters.push((J)=>Q(z(J)))})}onDone(z){this.status=1,this.resolution=z;for(let Q of this.waiters)Q(z)}onReject(z){}},GG=class extends R0{constructor(){super(...arguments);this.beanName="dragAndDrop",this.dragSourceAndParamsList=[],this.dragItem=null,this.dragInitialSourcePointerOffsetX=0,this.dragInitialSourcePointerOffsetY=0,this.lastMouseEvent=null,this.lastDraggingEvent=null,this.dragSource=null,this.dragImageCompPromise=null,this.dragImageComp=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0,this.dropTargets=[],this.externalDropZoneCount=0,this.lastDropTarget=null}addDragSource($,z=!1){let Q={capturePointer:!0,dragSource:$,eElement:$.eElement,dragStartPixels:$.dragStartPixels,onDragStart:(J)=>this.onDragStart($,J),onDragStop:this.onDragStop.bind(this),onDragging:this.onDragging.bind(this),onDragCancel:this.onDragCancel.bind(this),includeTouch:z};this.dragSourceAndParamsList.push(Q),this.beans.dragSvc.addDragSource(Q)}setDragImageCompIcon($,z=!1){let Q=this.dragImageComp;if(Q&&(z||this.dragImageLastIcon!==$))this.dragImageLastIcon=$,Q.setIcon($,z)}removeDragSource($){let{dragSourceAndParamsList:z,beans:Q}=this;for(let J=0,Z=z.length;J{for(let _ of G){let{width:H,height:U,left:W,right:B,top:E,bottom:K}=_.getBoundingClientRect();if(H===0||U===0)return!1;let L=q.clientX>=W&&q.clientX=E&&q.clientY0}findExternalZone($){let z=this.dropTargets;for(let Q=0,J=z.length;Q0?"down":E<0?"up":null,hDirection:B<0?"left":B>0?"right":null,initialSourcePointerOffsetX:q,initialSourcePointerOffsetY:G,dragSource:J,fromNudge:Q,dragItem:Z,dropZoneTarget:_,dropTarget:X?.dropTarget??null,changed:!!X?.changed});return this.lastDraggingEvent=K,K}positionDragImageComp($){let z=this.dragImageComp?.getGui();if(z)qq(z,$,this.beans)}removeDragImageComp($){if(this.dragImageComp===$)this.dragImageComp=null;if($)$.getGui()?.remove(),this.destroyBean($)}createAndUpdateDragImageComp($){let z=this.createDragImageComp($)??null;this.dragImageCompPromise=z,z?.then((Q)=>{let J=this.lastMouseEvent;if(z!==this.dragImageCompPromise||!J||!this.isAlive()){this.destroyBean(Q);return}this.dragImageCompPromise=null,this.dragImageLastIcon=void 0,this.dragImageLastLabel=void 0;let Z=this.dragImageComp;if(Z!==Q)this.dragImageComp=Q,this.removeDragImageComp(Z);if(Q)this.appendDragImageComp(Q),this.updateDragImageComp(),this.positionDragImageComp(J)})}appendDragImageComp($){let z=$.getGui(),Q=z.style;if(Q.position="absolute",Q.zIndex="9999",this.beans.dragSvc?.hasPointerCapture())Q.pointerEvents="none";this.gos.setInstanceDomData(z),this.beans.environment.applyThemeClasses(z),Q.top="20px",Q.left="20px";let J=FQ(this.beans);if(!J)this.warnNoBody();else J.appendChild(z)}updateDragImageComp(){let{dragImageComp:$,dragSource:z,lastDropTarget:Q,lastDraggingEvent:J,dragImageLastLabel:Z}=this;if(!$)return;this.setDragImageCompIcon(Q?.getIconName?.(J)??null);let X=z?.dragItemName;if(typeof X==="function")X=X(J);if(X||(X=""),Z!==X)this.dragImageLastLabel=X,$.setLabel(X)}};function j7($){return typeof $==="object"&&!!$.component}function _G($){if(!$)return!1;return $.prototype&&"getGui"in $.prototype}function f7($,z,Q,J){let{name:Z}=Q,X,Y,q,G,_,H;if(z){let U=z,W=U[Z+"Selector"],B=W?W(J):null,E=(K)=>{if(typeof K==="string")X=K;else if(K!=null&&K!==!0)if($.isFrameworkComponent(K))q=K;else Y=K};if(B)E(B.component),G=B.params,_=B.popup,H=B.popupPosition;else E(U[Z])}return{compName:X,jsComp:Y,fwComp:q,paramsFromSelector:G,popupFromSelector:_,popupPositionFromSelector:H}}var HG=class extends S{constructor(){super(...arguments);this.beanName="userCompFactory"}wireBeans($){this.agCompUtils=$.agCompUtils,this.registry=$.registry,this.frameworkCompWrapper=$.frameworkCompWrapper,this.gridOptions=$.gridOptions}getCompDetailsFromGridOptions($,z,Q,J=!1){return this.getCompDetails(this.gridOptions,$,z,Q,J)}getCompDetails($,z,Q,J,Z=!1){let{name:X,cellRenderer:Y}=z,{compName:q,jsComp:G,fwComp:_,paramsFromSelector:H,popupFromSelector:U,popupPositionFromSelector:W}=f7(this.beans.frameworkOverrides,$,z,J),B,E,K=(M)=>{let k=this.registry.getUserComponent(X,M);if(k)G=!k.componentFromFramework?k.component:void 0,_=k.componentFromFramework?k.component:void 0,B=k.params,E=k.processParams};if(q!=null)K(q);if(G==null&&_==null&&Q!=null)K(Q);if(G&&Y&&!_G(G))G=this.agCompUtils?.adaptFunction(z,G);if(!G&&!_){let{validation:M}=this.beans;if(Z&&(q!==Q||!Q))if(q){if(!M?.isProvidedUserComp(q))e(50,{compName:q})}else if(Q){if(!M)e(260,{...this.gos.getModuleErrorParams(),propName:X,compName:Q})}else e(216,{name:X});else if(Q&&!M)e(146,{comp:Q});return}let L=this.mergeParams($,z,J,H,B,E),D=G==null,F=G??_;return{componentFromFramework:D,componentClass:F,params:L,type:z,popupFromSelector:U,popupPositionFromSelector:W,newAgStackInstance:()=>this.newAgStackInstance(F,D,L,z)}}newAgStackInstance($,z,Q,J){let Z=!z,X;if(Z)X=new $;else X=this.frameworkCompWrapper.wrap($,J.mandatoryMethods,J.optionalMethods,J);this.createBean(X);let Y=X.init?.(Q);if(Y==null)return g.resolve(X);return Y.then(()=>X)}mergeParams($,z,Q,J=null,Z,X){let Y={...Q,...Z},G=$?.[z.name+"Params"];if(typeof G==="function"){let _=G(Q);B0(Y,_)}else if(typeof G==="object")B0(Y,G);return B0(Y,J),X?X(Y):Y}};var UG={name:"dragAndDropImageComponent",mandatoryMethods:["setIcon","setLabel"]},WG={name:"headerComponent",optionalMethods:["refresh"]},BG={name:"innerHeaderComponent"},EG={name:"innerHeaderGroupComponent"},KG={name:"headerGroupComponent"},LG={name:"innerRenderer",cellRenderer:!0,optionalMethods:["afterGuiAttached"]},DG={name:"cellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0};var FG={name:"loadingCellRenderer",cellRenderer:!0},MG={name:"cellEditor",mandatoryMethods:["getValue"],optionalMethods:["isPopup","isCancelBeforeStart","isCancelAfterEnd","getPopupPosition","focusIn","focusOut","afterGuiAttached","refresh"]},kG={name:"tooltipComponent"},n2={name:"filter",mandatoryMethods:["isFilterActive","doesFilterPass","getModel","setModel"],optionalMethods:["afterGuiAttached","afterGuiDetached","onNewRowsLoaded","getModelAsString","onFloatingFilterChanged","onAnyFilterChanged","refresh"]},VG={name:"floatingFilterComponent",mandatoryMethods:["onParentModelChanged"],optionalMethods:["afterGuiAttached","refresh"]},AG={name:"fullWidthCellRenderer",optionalMethods:["refresh","afterGuiAttached"],cellRenderer:!0},SG={name:"loadingCellRenderer",cellRenderer:!0},RG={name:"groupRowRenderer",optionalMethods:["afterGuiAttached"],cellRenderer:!0},jG={name:"detailCellRenderer",optionalMethods:["refresh"],cellRenderer:!0};function fG($,z){return $.getCompDetailsFromGridOptions(UG,"agDragAndDropImage",z,!0)}function H1($,z,Q){return $.getCompDetails(z,LG,void 0,Q)}function OG($,z,Q){return $.getCompDetails(z,WG,"agColumnHeader",Q)}function PG($,z,Q){return $.getCompDetails(z,BG,void 0,Q)}function TG($,z){let Q=z.columnGroup.getColGroupDef();return $.getCompDetails(Q,KG,"agColumnGroupHeader",z)}function vG($,z,Q){return $.getCompDetails(z,EG,void 0,Q)}function IG($,z){return $.getCompDetailsFromGridOptions(AG,void 0,z,!0)}function CG($,z){return $.getCompDetailsFromGridOptions(SG,"agLoadingCellRenderer",z,!0)}function bG($,z){return $.getCompDetailsFromGridOptions(RG,"agGroupRowRenderer",z,!0)}function yG($,z){return $.getCompDetailsFromGridOptions(jG,"agDetailCellRenderer",z,!0)}function oQ($,z,Q){return $.getCompDetails(z,DG,void 0,Q)}function F5($,z,Q){return $.getCompDetails(z,FG,"agSkeletonCellRenderer",Q,!0)}function O7($,z,Q){return $.getCompDetails(z,MG,"agCellEditor",Q,!0)}function d2($,z,Q,J){let Z=z.filter;if(j7(Z))z={filter:Z.component,filterParams:z.filterParams};return $.getCompDetails(z,n2,J,Q,!0)}function xG($,z){return $.getCompDetails(z.colDef,kG,"agTooltipComponent",z,!0)}function t2($,z,Q,J){return $.getCompDetails(z,VG,J,Q)}function P7($,z){return f7($,z,n2)}function jZ($,z,Q){return $.mergeParams(z,n2,Q)}var G$=(($)=>{return $[$.ToolPanel=0]="ToolPanel",$[$.HeaderCell=1]="HeaderCell",$[$.RowDrag=2]="RowDrag",$[$.ChartPanel=3]="ChartPanel",$[$.AdvancedFilterBuilder=4]="AdvancedFilterBuilder",$})(G$||{}),wG=class extends GG{createEvent($){return y(this.gos,$)}createDragImageComp($){let{gos:z,beans:Q}=this;return fG(Q.userCompFactory,y(z,{dragSource:$}))?.newAgStackInstance()}handleEnter($,z){$?.onGridEnter?.(z)}handleExit($,z){$?.onGridExit?.(z)}warnNoBody(){j(54)}isDropZoneWithinThisGrid($){return this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody.contains($.dropZoneTarget)}registerGridDropTarget($,z){let Q={getContainer:$,isInterestedIn:(J)=>J===1||J===0,getIconName:()=>"notAllowed"};this.addDropTarget(Q),z.addDestroyFunc(()=>this.removeDropTarget(Q))}};var T7="ag-resizer-wrapper",t$=($,z)=>({tag:"div",ref:`${$}Resizer`,cls:`ag-resizer ag-resizer-${z}`}),NG={tag:"div",cls:T7,children:[t$("eTopLeft","topLeft"),t$("eTop","top"),t$("eTopRight","topRight"),t$("eRight","right"),t$("eBottomRight","bottomRight"),t$("eBottom","bottom"),t$("eBottomLeft","bottomLeft"),t$("eLeft","left")]},s2=class extends R0{constructor($,z){super();this.element=$,this.dragStartPosition={x:0,y:0},this.position={x:0,y:0},this.lastSize={width:-1,height:-1},this.positioned=!1,this.resizersAdded=!1,this.resizeListeners=[],this.boundaryEl=null,this.isResizing=!1,this.isMoving=!1,this.resizable={},this.movable=!1,this.currentResizer=null,this.config={popup:!1,...z}}wireBeans($){this.popupSvc=$.popupSvc,this.dragSvc=$.dragSvc}center($){let{clientHeight:z,clientWidth:Q}=this.offsetParent,J=Q/2-this.getWidth()/2,Z=z/2-this.getHeight()/2;this.offsetElement(J,Z,$)}initialisePosition($){if(this.positioned)return;let{centered:z,forcePopupParentAsOffsetParent:Q,minWidth:J,width:Z,minHeight:X,height:Y,x:q,y:G}=this.config;if(!this.offsetParent)this.setOffsetParent();let _=0,H=0,U=A0(this.element);if(U){let W=this.findBoundaryElement(),B=window.getComputedStyle(W);if(B.minWidth!=null){let E=W.offsetWidth-this.element.offsetWidth;H=Number.parseInt(B.minWidth,10)-E}if(B.minHeight!=null){let E=W.offsetHeight-this.element.offsetHeight;_=Number.parseInt(B.minHeight,10)-E}}if(this.minHeight=X||_,this.minWidth=J||H,Z)this.setWidth(Z);if(Y)this.setHeight(Y);if(!Z||!Y)this.refreshSize();if(z)this.center($);else if(q||G)this.offsetElement(q,G,$);else if(U&&Q){let W=this.boundaryEl,B=!0;if(!W)W=this.findBoundaryElement(),B=!1;if(W){let E=Number.parseFloat(W.style.top),K=Number.parseFloat(W.style.left);if(B)this.offsetElement(Number.isNaN(K)?0:K,Number.isNaN(E)?0:E,$);else this.setPosition(K,E)}}this.positioned=!!this.offsetParent}isPositioned(){return this.positioned}getPosition(){return this.position}setMovable($,z){if(!this.config.popup||$===this.movable)return;this.movable=$;let Q=this.moveElementDragListener||{eElement:z,onDragStart:this.onMoveStart.bind(this),onDragging:this.onMove.bind(this),onDragStop:this.onMoveEnd.bind(this)};if($)this.dragSvc?.addDragSource(Q),this.moveElementDragListener=Q;else this.dragSvc?.removeDragSource(Q),this.moveElementDragListener=void 0}setResizable($){if(this.clearResizeListeners(),$)this.addResizers();else this.removeResizers();if(typeof $==="boolean"){if($===!1)return;$={topLeft:$,top:$,topRight:$,right:$,bottomRight:$,bottom:$,bottomLeft:$,left:$}}for(let z of Object.keys($)){let Q=!!$[z],J=this.getResizerElement(z),Z={dragStartPixels:0,eElement:J,onDragStart:(X)=>this.onResizeStart(X,z),onDragging:this.onResize.bind(this),onDragStop:(X)=>this.onResizeEnd(X,z)};if(Q||!this.isAlive()&&!Q){if(Q)this.dragSvc?.addDragSource(Z),this.resizeListeners.push(Z),J.style.pointerEvents="all";else J.style.pointerEvents="none";this.resizable[z]=Q}}}removeSizeFromEl(){this.element.style.removeProperty("height"),this.element.style.removeProperty("width"),this.element.style.removeProperty("flex")}restoreLastSize(){this.element.style.flex="0 0 auto";let{height:$,width:z}=this.lastSize;if(z!==-1)this.element.style.width=`${z}px`;if($!==-1)this.element.style.height=`${$}px`}getHeight(){return this.element.offsetHeight}setHeight($){let{popup:z}=this.config,Q=this.element,J=!1;if(typeof $==="string"&&$.includes("%"))NQ(Q,$),$=y6(Q),J=!0;else if($=Math.max(this.minHeight,$),this.positioned){let Z=this.getAvailableHeight();if(Z&&$>Z)$=Z}if(this.getHeight()===$)return;if(J)Q.style.maxHeight="unset",Q.style.minHeight="unset";else if(z)NQ(Q,$);else Q.style.height=`${$}px`,Q.style.flex="0 0 auto",this.lastSize.height=typeof $==="number"?$:Number.parseFloat($)}getAvailableHeight(){let{popup:$,forcePopupParentAsOffsetParent:z}=this.config;if(!this.positioned)this.initialisePosition();let{clientHeight:Q}=this.offsetParent;if(!Q)return null;let J=this.element.getBoundingClientRect(),Z=this.offsetParent.getBoundingClientRect(),X=$?this.position.y:J.top,Y=$?0:Z.top,q=0;if(z){let _=this.element.parentElement;if(_){let{bottom:H}=_.getBoundingClientRect();q=H-J.bottom}}return Q+Y-X-q}getWidth(){return this.element.offsetWidth}setWidth($){let z=this.element,{popup:Q}=this.config,J=!1;if(typeof $==="string"&&$.includes("%"))f$(z,$),$=x6(z),J=!0;else if(this.positioned){$=Math.max(this.minWidth,$);let{clientWidth:Z}=this.offsetParent,X=Q?this.position.x:this.element.getBoundingClientRect().left;if(Z&&$+X>Z)$=Z-X}if(this.getWidth()===$)return;if(J)z.style.maxWidth="unset",z.style.minWidth="unset";else if(this.config.popup)f$(z,$);else z.style.width=`${$}px`,z.style.flex=" unset",this.lastSize.width=typeof $==="number"?$:Number.parseFloat($)}offsetElement($=0,z=0,Q){let{forcePopupParentAsOffsetParent:J}=this.config,Z=J?this.boundaryEl:this.element;if(!Z)return;this.popupSvc?.positionPopup({ePopup:Z,keepWithinBounds:!0,skipObserver:this.movable||this.isResizable(),updatePosition:()=>({x:$,y:z}),postProcessCallback:Q}),this.setPosition(Number.parseFloat(Z.style.left),Number.parseFloat(Z.style.top))}constrainSizeToAvailableHeight($){if(!this.config.forcePopupParentAsOffsetParent)return;let z=()=>{let Q=this.getAvailableHeight();this.element.style.setProperty("max-height",`${Q}px`)};if($&&this.popupSvc)this.resizeObserverSubscriber?.(),this.resizeObserverSubscriber=F$(this.beans,this.popupSvc?.getPopupParent(),z);else if(this.element.style.removeProperty("max-height"),this.resizeObserverSubscriber)this.resizeObserverSubscriber(),this.resizeObserverSubscriber=void 0}setPosition($,z){this.position.x=$,this.position.y=z}updateDragStartPosition($,z){this.dragStartPosition={x:$,y:z}}calculateMouseMovement($){let{e:z,isLeft:Q,isTop:J,anywhereWithin:Z,topBuffer:X}=$,Y=z.clientX-this.dragStartPosition.x,q=z.clientY-this.dragStartPosition.y,G=this.shouldSkipX(z,!!Q,!!Z,Y)?0:Y,_=this.shouldSkipY(z,!!J,X,q)?0:q;return{movementX:G,movementY:_}}shouldSkipX($,z,Q,J){let Z=this.element.getBoundingClientRect(),X=this.offsetParent.getBoundingClientRect(),Y=this.boundaryEl.getBoundingClientRect(),q=this.config.popup?this.position.x:Z.left,G=q<=0&&X.left>=$.clientX||X.right<=$.clientX&&X.right<=Y.right;if(G)return!0;if(z)G=J<0&&$.clientX>q+X.left||J>0&&$.clientXY.right||J>0&&$.clientXY.right||J>0&&$.clientX=$.clientY||X.bottom<=$.clientY&&X.bottom<=Y.bottom;if(G)return!0;if(z)G=J<0&&$.clientY>q+X.top+Q||J>0&&$.clientYY.bottom||J>0&&$.clientY({element:this.element.querySelector(`[data-ref=${z}Resizer]`)});this.resizerMap={topLeft:$("eTopLeft"),top:$("eTop"),topRight:$("eTopRight"),right:$("eRight"),bottomRight:$("eBottomRight"),bottom:$("eBottom"),bottomLeft:$("eBottomLeft"),left:$("eLeft")}}addResizers(){if(this.resizersAdded)return;let $=this.element;if(!$)return;$.appendChild(K0(NG)),this.createResizeMap(),this.resizersAdded=!0}removeResizers(){this.resizerMap=void 0,this.element.querySelector(`.${T7}`)?.remove(),this.resizersAdded=!1}getResizerElement($){return this.resizerMap[$].element}onResizeStart($,z){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.currentResizer={isTop:!!z.match(/top/i),isRight:!!z.match(/right/i),isBottom:!!z.match(/bottom/i),isLeft:!!z.match(/left/i)},this.element.classList.add("ag-resizing"),this.resizerMap[z].element.classList.add("ag-active");let{popup:Q,forcePopupParentAsOffsetParent:J}=this.config;if(!Q&&!J)this.applySizeToSiblings(this.currentResizer.isBottom||this.currentResizer.isTop);this.isResizing=!0,this.updateDragStartPosition($.clientX,$.clientY)}getSiblings(){let z=this.element.parentElement;if(!z)return null;return Array.prototype.slice.call(z.children).filter((Q)=>!Q.classList.contains("ag-hidden"))}getMinSizeOfSiblings(){let $=this.getSiblings()||[],z=0,Q=0;for(let J of $){let Z=!!J.style.flex&&J.style.flex!=="0 0 auto";if(J===this.element)continue;let X=this.minHeight||0,Y=this.minWidth||0;if(Z){let q=window.getComputedStyle(J);if(q.minHeight)X=Number.parseInt(q.minHeight,10);if(q.minWidth)Y=Number.parseInt(q.minWidth,10)}else X=J.offsetHeight,Y=J.offsetWidth;z+=X,Q+=Y}return{height:z,width:Q}}applySizeToSiblings($){let z=null,Q=this.getSiblings();if(!Q)return;for(let J=0;J$)}onResize($){if(!this.isResizing||!this.currentResizer)return;let{popup:z,forcePopupParentAsOffsetParent:Q}=this.config,{isTop:J,isRight:Z,isBottom:X,isLeft:Y}=this.currentResizer,q=Z||Y,G=X||J,{movementX:_,movementY:H}=this.calculateMouseMovement({e:$,isLeft:Y,isTop:J}),U=this.position.x,W=this.position.y,B=0,E=0;if(q&&_){let K=Y?-1:1,L=this.getWidth(),D=L+_*K,F=!1;if(Y){if(B=L-D,U+B<=0||D<=this.minWidth)F=!0,B=0}if(!F)this.setWidth(D)}if(G&&H){let K=J?-1:1,L=this.getHeight(),D=L+H*K,F=!1;if(J){if(E=L-D,W+E<=0||D<=this.minHeight)F=!0,E=0}else if(!this.config.popup&&!this.config.forcePopupParentAsOffsetParent&&Lthis.element.parentElement.offsetHeight)F=!0;if(!F)this.setHeight(D)}if(this.updateDragStartPosition($.clientX,$.clientY),(z||Q)&&B||E)this.offsetElement(U+B,W+E)}onResizeEnd($,z){this.isResizing=!1,this.currentResizer=null,this.boundaryEl=null,this.element.classList.remove("ag-resizing"),this.resizerMap[z].element.classList.remove("ag-active"),this.dispatchLocalEvent({type:"resize"})}refreshSize(){let $=this.element;if(this.config.popup){if(!this.config.width)this.setWidth($.offsetWidth);if(!this.config.height)this.setHeight($.offsetHeight)}}onMoveStart($){if(this.boundaryEl=this.findBoundaryElement(),!this.positioned)this.initialisePosition();this.isMoving=!0,this.element.classList.add("ag-moving"),this.updateDragStartPosition($.clientX,$.clientY)}onMove($){if(!this.isMoving)return;let{x:z,y:Q}=this.position,J;if(this.config.calculateTopBuffer)J=this.config.calculateTopBuffer();let{movementX:Z,movementY:X}=this.calculateMouseMovement({e:$,isTop:!0,anywhereWithin:!0,topBuffer:J});this.offsetElement(z+Z,Q+X),this.updateDragStartPosition($.clientX,$.clientY)}onMoveEnd(){this.isMoving=!1,this.boundaryEl=null,this.element.classList.remove("ag-moving")}setOffsetParent(){if(this.config.forcePopupParentAsOffsetParent&&this.popupSvc)this.offsetParent=this.popupSvc.getPopupParent();else this.offsetParent=this.element.offsetParent}findBoundaryElement(){let $=this.element;while($){if(window.getComputedStyle($).position!=="static")return $;$=$.parentElement}return this.element}clearResizeListeners(){while(this.resizeListeners.length){let $=this.resizeListeners.pop();this.dragSvc?.removeDragSource($)}}destroy(){if(super.destroy(),this.moveElementDragListener)this.dragSvc?.removeDragSource(this.moveElementDragListener);this.constrainSizeToAvailableHeight(!1),this.clearResizeListeners(),this.removeResizers()}},U1=class extends s2{},f=null;function bJ($){return typeof $?.getGui==="function"}var v7=class{constructor($){this.cssClassStates={},this.getGui=$}toggleCss($,z){if(!$)return;if($.includes(" ")){let J=($||"").split(" ");if(J.length>1){for(let Z of J)this.toggleCss(Z,z);return}}if(this.cssClassStates[$]!==z&&$.length)this.getGui()?.classList.toggle($,z),this.cssClassStates[$]=z}},gG=0,p0=class extends R0{constructor($,z){super();if(this.suppressDataRefValidation=!1,this.displayed=!0,this.visible=!0,this.compId=gG++,this.cssManager=new v7(()=>this.eGui),this.componentSelectors=new Map((z??[]).map((Q)=>[Q.selector,Q])),$)this.setTemplate($)}preConstruct(){this.wireTemplate(this.getGui()),this.addGlobalCss()}wireTemplate($,z){if($&&this.gos)this.applyElementsToComponent($),this.createChildComponentsFromTags($,z)}getCompId(){return this.compId}getDataRefAttribute($){if($.getAttribute)return $.getAttribute(c6);return null}applyElementsToComponent($,z,Q,J=null){if(z===void 0)z=this.getDataRefAttribute($);if(z){let Z=this[z];if(Z===f)this[z]=J??$;else{let X=Q?.[z];if(!this.suppressDataRefValidation&&!X)throw Error(`data-ref: ${z} on ${this.constructor.name} with ${Z}`)}}}createChildComponentsFromTags($,z){let Q=[];for(let J of $.childNodes??[])Q.push(J);for(let J of Q){if(!(J instanceof HTMLElement))continue;let Z=this.createComponentFromElement(J,(X)=>{let Y=X.getGui();if(Y)for(let q of J.attributes??[])Y.setAttribute(q.name,q.value)},z);if(Z){if(Z.addItems&&J.children.length){this.createChildComponentsFromTags(J,z);let X=Array.prototype.slice.call(J.children);Z.addItems(X)}this.swapComponentForNode(Z,$,J)}else if(J.childNodes)this.createChildComponentsFromTags(J,z)}}createComponentFromElement($,z,Q){let J=$.nodeName,Z=this.getDataRefAttribute($),X=J.indexOf("AG-")===0,Y=X?this.componentSelectors.get(J):null,q=null;if(Y){let G=Q&&Z?Q[Z]:void 0;q=new Y.component(G),q.setParentComponent(this),this.createBean(q,null,z)}else if(X)throw Error(`selector: ${J}`);return this.applyElementsToComponent($,Z,Q,q),q}swapComponentForNode($,z,Q){let J=$.getGui();z.replaceChild(J,Q),z.insertBefore(document.createComment(Q.nodeName),J),this.addDestroyFunc(this.destroyBean.bind(this,$))}activateTabIndex($,z){let Q=z??this.gos.get("tabIndex");if(!$)$=[];if(!$.length)$.push(this.getGui());for(let J of $)J.setAttribute("tabindex",Q.toString())}setTemplate($,z,Q){let J;if(typeof $==="string"||$==null)J=v2($);else J=K0($);this.setTemplateFromElement(J,z,Q)}setTemplateFromElement($,z,Q,J=!1){if(this.eGui=$,this.suppressDataRefValidation=J,z)for(let Z=0;Zthis.eGui.removeEventListener($,z))}addCss($){this.cssManager.toggleCss($,!0)}removeCss($){this.cssManager.toggleCss($,!1)}toggleCss($,z){this.cssManager.toggleCss($,z)}registerCSS($){if(this.css===M5)this.css=[$],this.addGlobalCss();else this.css||(this.css=[]),this.css.push($)}addGlobalCss(){if(Array.isArray(this.css)){let $="component-"+Object.getPrototypeOf(this)?.constructor?.name;for(let z of this.css??[])this.beans.environment.addGlobalCSS(z,$)}this.css=M5}},M5=Symbol(),x=class extends p0{},fZ,OZ,PZ,TZ,Y2,q2,vZ;function cz(){if(fZ===void 0)fZ=/^((?!chrome|android).)*safari/i.test(navigator.userAgent);return fZ}function yJ(){if(OZ===void 0)OZ=/(firefox)/i.test(navigator.userAgent);return OZ}function I7(){if(PZ===void 0)PZ=/(Mac|iPhone|iPod|iPad)/i.test(navigator.platform);return PZ}function bz(){if(TZ===void 0)TZ=/iPad|iPhone|iPod/.test(navigator.platform)||navigator.platform==="MacIntel"&&navigator.maxTouchPoints>1;return TZ}function G2($){if(!$)return null;let z=$.tabIndex,Q=$.getAttribute("tabIndex");if(z===-1&&(Q===null||Q===""&&!yJ()))return null;return z.toString()}function hG(){if(vZ!==void 0)return vZ;if(!document.body)return-1;let $=1e6,z=yJ()?6000000:1e9,Q=document.createElement("div");document.body.appendChild(Q);while(!0){let J=$*2;if(Q.style.height=J+"px",J>z||Q.clientHeight!==J)break;else $=J}return Q.remove(),vZ=$,$}function r2(){if(q2==null)C7();return q2}function C7(){let $=document.body,z=document.createElement("div");z.style.width=z.style.height="100px",z.style.opacity="0",z.style.overflow="scroll",z.style.msOverflowStyle="scrollbar",z.style.position="absolute",$.appendChild(z);let Q=z.offsetWidth-z.clientWidth;if(Q===0&&z.clientWidth===0)Q=null;if(z.parentNode)z.remove();if(Q!=null)q2=Q,Y2=Q===0}function b7(){if(Y2==null)C7();return Y2}var _2=!1,YJ=0;function uG($){if(YJ>0)return;$.addEventListener("keydown",qJ),$.addEventListener("mousedown",qJ)}function mG($){if(YJ>0)return;$.removeEventListener("keydown",qJ),$.removeEventListener("mousedown",qJ)}function qJ($){let z=_2,Q=$.type==="keydown";if(Q){if($.ctrlKey||$.metaKey||$.altKey)return}if(z===Q)return;_2=Q}function cG($){let z=Y0($);return uG(z),YJ++,()=>{YJ--,mG(z)}}function VQ(){return _2}function E$($,z,Q=!1){let J=rY,Z=b6;if(z)Z+=", "+z;if(Q)Z+=', [tabindex="-1"]';let X=Array.prototype.slice.apply($.querySelectorAll(J)).filter((G)=>{return A0(G)}),Y=Array.prototype.slice.apply($.querySelectorAll(Z));if(!Y.length)return X;return((G,_)=>G.filter((H)=>_.indexOf(H)===-1))(X,Y)}function F0($,z=!1,Q=!1,J=!1){let Z=E$($,J?".ag-tab-guard":null,Q),X=z?b(Z):Z[0];if(X)return X.focus({preventScroll:!0}),!0;return!1}function j0($,z,Q,J){let Z=E$(z,Q?':not([tabindex="-1"])':null),X=d($),Y;if(Q)Y=Z.findIndex((G)=>G.contains(X));else Y=Z.indexOf(X);let q=Y+(J?-1:1);if(q<0||q>=Z.length)return null;return Z[q]}function xJ($,z=5){let Q=0;while($&&G2($)===null&&++Q<=z)$=$.parentElement;if(G2($)===null)return null;return $}var l2="ag-focus-managed",y7=class extends R0{constructor($,z={isStopPropagation:()=>!1,stopPropagation:()=>{}},Q={}){super();this.eFocusable=$,this.stopPropagationCallbacks=z,this.callbacks=Q,this.callbacks={shouldStopEventPropagation:()=>!1,onTabKeyDown:(J)=>{if(J.defaultPrevented)return;let Z=j0(this.beans,this.eFocusable,!1,J.shiftKey);if(!Z)return;Z.focus(),J.preventDefault()},...Q}}postConstruct(){let{eFocusable:$,callbacks:{onFocusIn:z,onFocusOut:Q}}=this;if($.classList.add(l2),this.addKeyDownListeners($),z)this.addManagedElementListeners($,{focusin:z});if(Q)this.addManagedElementListeners($,{focusout:Q})}addKeyDownListeners($){this.addManagedElementListeners($,{keydown:(z)=>{if(z.defaultPrevented||this.stopPropagationCallbacks.isStopPropagation(z))return;let{callbacks:Q}=this;if(Q.shouldStopEventPropagation(z)){this.stopPropagationCallbacks.stopPropagation(z);return}if(z.key===A.TAB)Q.onTabKeyDown(z);else if(Q.handleKeyDown)Q.handleKeyDown(z)}})}},x7="__ag_Grid_Stop_Propagation";function i0($){$[x7]=!0}function z$($){return $[x7]===!0}var Uz={isStopPropagation:z$,stopPropagation:i0},c$=class extends y7{constructor($,z){super($,Uz,z)}},pG={applyFilter:"Apply",clearFilter:"Clear",resetFilter:"Reset",cancelFilter:"Cancel",textFilter:"Text Filter",numberFilter:"Number Filter",bigintFilter:"BigInt Filter",dateFilter:"Date Filter",setFilter:"Set Filter",filterOoo:"Filter...",empty:"Choose one",equals:"Equals",notEqual:"Does not equal",lessThan:"Less than",greaterThan:"Greater than",inRange:"Between",inRangeStart:"From",inRangeEnd:"To",lessThanOrEqual:"Less than or equal to",greaterThanOrEqual:"Greater than or equal to",contains:"Contains",notContains:"Does not contain",startsWith:"Begins with",endsWith:"Ends with",blank:"Blank",notBlank:"Not blank",before:"Before",after:"After",andCondition:"AND",orCondition:"OR",dateFormatOoo:"yyyy-mm-dd",filterSummaryInactive:"is (All)",filterSummaryContains:"contains",filterSummaryNotContains:"does not contain",filterSummaryTextEquals:"equals",filterSummaryTextNotEqual:"does not equal",filterSummaryStartsWith:"begins with",filterSummaryEndsWith:"ends with",filterSummaryBlank:"is blank",filterSummaryNotBlank:"is not blank",filterSummaryEquals:"=",filterSummaryNotEqual:"!=",filterSummaryGreaterThan:">",filterSummaryGreaterThanOrEqual:">=",filterSummaryLessThan:"<",filterSummaryLessThanOrEqual:"<=",filterSummaryInRange:"between",yesterday:"Yesterday",today:"Today",tomorrow:"Tomorrow",last7Days:"Last 7 Days",lastWeek:"Last Week",thisWeek:"This Week",nextWeek:"Next Week",last30Days:"Last 30 Days",lastMonth:"Last Month",thisMonth:"This Month",nextMonth:"Next Month",last90Days:"Last 90 Days",lastQuarter:"Last Quarter",thisQuarter:"This Quarter",nextQuarter:"Next Quarter",lastYear:"Last Year",thisYear:"This Year",yearToDate:"Year To Date",nextYear:"Next Year",last6Months:"Last 6 Months",last12Months:"Last 12 Months",last24Months:"Last 24 Months",filterSummaryInRangeValues:($)=>`(${$[0]}, ${$[1]})`,filterSummaryTextQuote:($)=>`"${$[0]}"`,minDateValidation:($)=>`Date must be after ${$[0]}`,maxDateValidation:($)=>`Date must be before ${$[0]}`,strictMinValueValidation:($)=>`Must be greater than ${$[0]}`,strictMaxValueValidation:($)=>`Must be less than ${$[0]}`};function w7($,z,Q){return _q($,pG,z,Q)}function iG($,z){let{debounceMs:Q}=$;if(W1($)){if(Q!=null)j(71);return 0}return Q??z}function W1($){return($.buttons?.indexOf("apply")??-1)>=0}var wJ=class extends x{constructor($,z){super();this.filterNameKey=$,this.cssIdentifier=z,this.applyActive=!1,this.debouncePending=!1,this.defaultDebounceMs=0}postConstruct(){let $={tag:"div",cls:`ag-filter-body-wrapper ag-${this.cssIdentifier}-body-wrapper`,children:[this.createBodyTemplate()]};this.setTemplate($,this.getAgComponents()),this.createManagedBean(new c$(this.getFocusableElement(),{handleKeyDown:this.handleKeyDown.bind(this)})),this.positionableFeature=this.createBean(new U1(this.getPositionableElement(),{forcePopupParentAsOffsetParent:!0}))}handleKeyDown($){}init($){let z=$;this.setParams(z),this.setModelIntoUi(z.state.model,!0).then(()=>this.updateUiVisibility())}areStatesEqual($,z){return $===z}refresh($){let z=$,Q=this.params;this.params=z;let{source:J,state:Z,additionalEventAttributes:X}=z;if(J==="colDef")this.updateParams(z,Q);let Y=this.state;this.state=Z;let q=X?.fromAction;if(q&&q!=="apply"||Z.model!==Y.model||!this.areStatesEqual(Z.state,Y.state))this.setModelIntoUi(Z.model);return!0}setParams($){this.params=$,this.state=$.state,this.commonUpdateParams($)}updateParams($,z){this.commonUpdateParams($,z)}commonUpdateParams($,z){this.applyActive=W1($),this.setupApplyDebounced()}doesFilterPass($){j(283);let{getHandler:z,model:Q,column:J}=this.params;return z().doesFilterPass({...$,model:Q,handlerParams:this.beans.colFilter.getHandlerParams(J)})}getFilterTitle(){return this.translate(this.filterNameKey)}isFilterActive(){return j(284),this.params.model!=null}setupApplyDebounced(){let $=iG(this.params,this.defaultDebounceMs),z=g$(this,this.checkApplyDebounce.bind(this),$);this.applyDebounced=()=>{this.debouncePending=!0,z()}}checkApplyDebounce(){if(this.debouncePending)this.debouncePending=!1,this.doApplyModel()}getModel(){return j(285),this.params.model}setModel($){j(286);let{beans:z,params:Q}=this;return z.colFilter.setModelForColumnLegacy(Q.column,$)}applyModel($="api"){return this.doApplyModel()}canApply($){return!0}doApplyModel($){let{params:z,state:{valid:Q=!0,model:J}}=this;if(!Q)return!1;let Z=!this.areModelsEqual(z.model,J);if(Z)z.onAction("apply",$);return Z}onNewRowsLoaded(){}onUiChanged($,z=!1){this.updateUiVisibility();let Q=this.getModelFromUi(),J={model:Q,state:this.getState(),valid:this.canApply(Q)};this.state=J;let{params:Z,gos:X,eventSvc:Y,applyActive:q}=this;if(Z.onStateChange(J),Z.onUiChange(this.getUiChangeEventParams()),!X.get("enableFilterHandlers"))Y.dispatchEvent({type:"filterModified",column:Z.column,filterInstance:this});if(!J.valid)return;if($??($=q?void 0:"debounce"),$==="immediately")this.doApplyModel({afterFloatingFilter:z,afterDataChange:!1});else if($==="debounce")this.applyDebounced()}getState(){return}getUiChangeEventParams(){return}afterGuiAttached($){this.lastContainerType=$?.container,this.refreshFilterResizer($?.container)}refreshFilterResizer($){let{positionableFeature:z,gos:Q}=this;if(!z)return;let J=$==="floatingFilter"||$==="columnFilter";if(J)z.restoreLastSize(),z.setResizable(Q.get("enableRtl")?{bottom:!0,bottomLeft:!0,left:!0}:{bottom:!0,bottomRight:!0,right:!0});else z.removeSizeFromEl(),z.setResizable(!1);z.constrainSizeToAvailableHeight(J)}afterGuiDetached(){this.checkApplyDebounce(),this.positionableFeature?.constrainSizeToAvailableHeight(!1)}destroy(){this.positionableFeature=this.destroyBean(this.positionableFeature),super.destroy()}translate($,z){return w7(this,$,z)}getPositionableElement(){return this.getGui()}areModelsEqual($,z){if($===z||$==null&&z==null)return!0;if($==null||z==null)return!1;return this.areNonNullModelsEqual($,z)}};var a2=class extends p0{isPopup(){return!0}setParentComponent($){$.addCss("ag-has-popup"),super.setParentComponent($)}destroy(){let $=this.parentComponent;if($?.isAlive())$.getGui().classList.remove("ag-has-popup");super.destroy()}},nG=class extends a2{constructor(){super(...arguments);this.errorMessages=null}init($){this.params=$,this.initialiseEditor($),this.eEditor.onValueChange(()=>$.validate())}destroy(){this.eEditor.destroy(),this.errorMessages=null,super.destroy()}};function o2($){let z=$.rowModel;return z.getType()==="clientSide"?z:void 0}var k5="row-group-",dG="t-",tG="b-",sG=0,Wz=class{constructor($){this.id=void 0,this.destroyed=!1,this._groupData=void 0,this.master=!1,this.detail=void 0,this.rowIndex=null,this.field=null,this.rowGroupColumn=null,this.key=null,this.sourceRowIndex=-1,this._leafs=void 0,this.childrenAfterGroup=null,this.childrenAfterFilter=null,this.childrenAfterAggFilter=null,this.childrenAfterSort=null,this.allChildrenCount=null,this.childrenMapped=null,this.treeParent=null,this.treeNodeFlags=0,this._expanded=void 0,this.displayed=!1,this.rowTop=null,this.oldRowTop=null,this.selectable=!0,this.__objectId=sG++,this.alreadyRendered=!1,this.formulaRowIndex=null,this.hovered=!1,this.__selected=!1,this.beans=$}get groupData(){let $=this._groupData;if($!==void 0)return $;if(this.footer)return this.sibling?.groupData;return this.beans.groupStage?.loadGroupData(this)??null}set groupData($){this._groupData=$}get primaryRow(){let $=this.footer&&this.sibling?this.sibling:this,{pinnedSibling:z}=$;if(z&&$.rowPinned){if($=z,$.footer&&$.sibling)$=$.sibling}return $}get allLeafChildren(){let $=this._leafs;return $===void 0?this.beans.groupStage?.loadLeafs?.(this)??null:$}set allLeafChildren($){this._leafs=$}get expanded(){let $=this.beans.expansionSvc;return $?$.isExpanded(this):this.level===-1?!0:!!this._expanded}set expanded($){this._expanded=$}setData($){this.setDataCommon($,!1)}updateData($){this.setDataCommon($,!0)}setDataCommon($,z){let{valueCache:Q,eventSvc:J}=this.beans,Z=this.data;this.data=$,Q?.onDataChanged(),this.updateDataOnDetailNode(),this.resetQuickFilterAggregateText();let X=this.createDataChangedEvent($,Z,z);if(this.__localEventService?.dispatchEvent(X),this.sibling){this.sibling.data=$;let q=this.sibling.createDataChangedEvent($,Z,z);this.sibling.__localEventService?.dispatchEvent(q)}J.dispatchEvent({type:"rowNodeDataChanged",node:this});let Y=this.pinnedSibling;if(Y)Y.data=$,Y.__localEventService?.dispatchEvent(Y.createDataChangedEvent($,Z,z)),J.dispatchEvent({type:"rowNodeDataChanged",node:Y})}updateDataOnDetailNode(){let $=this.detailNode;if($)$.data=this.data}createDataChangedEvent($,z,Q){return{type:"dataChanged",node:this,oldData:z,newData:$,update:Q}}getRowIndexString(){if(this.rowIndex==null)return e(13),null;if(this.rowPinned==="top")return dG+this.rowIndex;if(this.rowPinned==="bottom")return tG+this.rowIndex;return this.rowIndex.toString()}setDataAndId($,z){let{selectionSvc:Q}=this.beans,J=Q?.createDaemonNode?.(this),Z=this.data;if(this.data=$,this.updateDataOnDetailNode(),this.setId(z),Q)Q.updateRowSelectable(this),Q.syncInRowNode(this,J);let X=this.createDataChangedEvent($,Z,!1);this.__localEventService?.dispatchEvent(X)}setId($){let z=J2(this.beans.gos);if(z)if(this.data){let Q=this.parent?.getRoute()??[];if(this.id=z({data:this.data,parentKeys:Q.length>0?Q:void 0,level:this.level,rowPinned:this.rowPinned}),this.id.startsWith(k5))e(14,{groupPrefix:k5})}else this.id=void 0;else this.id=$}setRowTop($){if(this.oldRowTop=this.rowTop,this.rowTop===$)return;this.rowTop=$,this.dispatchRowEvent("topChanged");let z=$!==null;if(this.displayed!==z)this.displayed=z,this.dispatchRowEvent("displayedChanged")}clearRowTopAndRowIndex(){this.oldRowTop=null,this.setRowTop(null),this.setRowIndex(null)}setHovered($){this.hovered=$}isHovered(){return this.hovered}setRowHeight($,z=!1){this.rowHeight=$,this.rowHeightEstimated=z,this.dispatchRowEvent("heightChanged")}setExpanded($,z,Q){this.beans.expansionSvc?.setExpanded(this,$,z,Q)}setDataValue($,z,Q){let{colModel:J,valueSvc:Z,gos:X,editSvc:Y}=this.beans;if($==null)return!1;let q=J.getCol($)??J.getColDefCol($);if(!q)return!1;if(!this.group){let H=q.getColDef();if(H.pivotValueColumn)q=H.pivotValueColumn}let G=Z.getValueForDisplay({column:q,node:this,from:"data"}).value;if(X.get("readOnlyEdit")){let{beans:{eventSvc:H},data:U,rowIndex:W,rowPinned:B}=this;return H.dispatchEvent({type:"cellEditRequest",event:null,rowIndex:W,rowPinned:B,column:q,colDef:q.colDef,data:U,node:this,oldValue:G,newValue:z,value:z,source:Q}),!1}if(Q!=="data"&&Y&&!Y.committing){let H=Y.setDataValue({rowNode:this,column:q},z,Q);if(H!=null)return H}let _=Z.setValue(this,q,z,Q);if(this.dispatchCellChangedEvent(q,z,G),_)this.pinnedSibling?.dispatchCellChangedEvent(q,z,G);return _}getDataValue($,z="data"){let{colModel:Q,valueSvc:J,formula:Z}=this.beans;if($==null)return;let X=Q.getCol($)??Q.getColDefCol($);if(!X)return;let Y=z==="data-raw",q=Y||z==="value"?"data":z,G=J.getValue(X,this,q,Y);if(!Y){if(Z&&X.isAllowFormula()&&Z.isFormula(G))G=Z.resolveValue(X,this);if(z!=="data"&&X.getAggFunc()&&typeof G==="object"&&G!=null){if(typeof G.toNumber==="function")return G.toNumber();if("value"in G)return G.value}}return G}updateHasChildren(){let $=this.group&&!this.footer||!!this.childrenAfterGroup?.length,{rowChildrenSvc:z}=this.beans;if(z)$=z.getHasChildrenValue(this);if($!==this.__hasChildren)this.__hasChildren=!!$,this.dispatchRowEvent("hasChildrenChanged")}hasChildren(){if(this.__hasChildren==null)this.updateHasChildren();return this.__hasChildren}dispatchCellChangedEvent($,z,Q){let J={type:"cellChanged",node:this,column:$,newValue:z,oldValue:Q};this.__localEventService?.dispatchEvent(J)}resetQuickFilterAggregateText(){this.quickFilterAggregateText=null}isExpandable(){return this.beans.expansionSvc?.isExpandable(this)??!1}isSelected(){if(this.footer)return this.sibling.isSelected();let $=this.rowPinned&&this.pinnedSibling;if($)return $.isSelected();return this.__selected}depthFirstSearch($){let z=this.childrenAfterGroup;if(z)for(let Q=0,J=z.length;Q{let Q=new Wz(z);for(let J of Object.keys($)){if(rG.has(J))continue;Q[J]=$[J]}return Q.oldRowTop=null,Q},g7=($,z,Q)=>{if(!Q)return;let J=Q.rowIndex;if(J==null)return;J+=z;let Z=$.getRowCount();while(J>=0&&J{if(!y1)y1=new WeakSet;else if(y1.has($))return!1;return y1.add($),!0},h0=class{constructor($,z=!1){this.eElement=$,this.preventClick=z,this.startListener=null,this.handlers=[],this.eventSvc=void 0,this.touchStart=null,this.lastTapTime=null,this.longPressTimer=0,this.moved=!1}addEventListener($,z){let Q=this.eventSvc;if(!Q){if(Q===null)return;this.eventSvc=Q=new K$;let J=this.onTouchStart.bind(this);this.startListener=J,this.eElement.addEventListener("touchstart",J,{passive:!0})}Q.addEventListener($,z)}removeEventListener($,z){this.eventSvc?.removeEventListener($,z)}onTouchStart($){if(this.touchStart||!oG($))return;let z=$.touches[0];this.touchStart=z;let Q=this.handlers;if(!Q.length){let J=this.eElement,Z=J.ownerDocument,X=this.onTouchMove.bind(this),Y=this.onTouchEnd.bind(this),q=this.onTouchCancel.bind(this),G={passive:!0},_={passive:!1};p1(Q,[J,"touchmove",X,G],[Z,"touchcancel",q,G],[Z,"touchend",Y,_],[Z,"contextmenu",QQ,_])}this.clearLongPress(),this.longPressTimer=window.setTimeout(()=>{if(this.longPressTimer=0,this.touchStart===z&&!this.moved)this.moved=!0,this.eventSvc?.dispatchEvent({type:"longTap",touchStart:z,touchEvent:$})},aG)}onTouchMove($){let{moved:z,touchStart:Q}=this;if(!z&&Q){let J=qQ(Q,$.touches);if(J&&!p6(J,Q,4))this.clearLongPress(),this.moved=!0}}onTouchEnd($){let z=this.touchStart;if(!z||!qQ(z,$.changedTouches))return;if(!this.moved)this.eventSvc?.dispatchEvent({type:"tap",touchStart:z}),this.checkDoubleTap(z);if(this.preventClick)QQ($);this.cancel()}onTouchCancel($){let z=this.touchStart;if(!z||!qQ(z,$.changedTouches))return;this.lastTapTime=null,this.cancel()}checkDoubleTap($){let z=Date.now(),Q=this.lastTapTime;if(Q){if(z-Q>lG)this.eventSvc?.dispatchEvent({type:"doubleTap",touchStart:$}),z=null}this.lastTapTime=z}cancel(){this.clearLongPress(),I2(this.handlers),this.touchStart=null}clearLongPress(){window.clearTimeout(this.longPressTimer),this.longPressTimer=0,this.moved=!1}destroy(){let $=this.startListener;if($)this.startListener=null,this.eElement.removeEventListener("touchstart",$);this.cancel(),this.eElement=null,this.eventSvc=null}},C$=(($)=>{return $[$.VALUE=0]="VALUE",$[$.DIMENSION=1]="DIMENSION",$})(C$||{}),eG=1,$_=class{constructor($){if(this.beans={},this.createdBeans=[],this.destroyed=!1,this.instanceId=eG++,!$?.beanClasses)return;this.beanDestroyComparator=$.beanDestroyComparator,this.init($)}init($){this.id=$.id,this.beans.context=this,this.destroyCallback=$.destroyCallback;for(let z of Object.keys($.providedBeanInstances))this.beans[z]=$.providedBeanInstances[z];for(let z of $.beanClasses){let Q=new z;if(Q.beanName)this.beans[Q.beanName]=Q;else console.error(`Bean ${z.name} is missing beanName`);this.createdBeans.push(Q)}for(let z of $.derivedBeans??[]){let{beanName:Q,bean:J}=z(this);this.beans[Q]=J,this.createdBeans.push(J)}if($.beanInitComparator)this.createdBeans.sort($.beanInitComparator);this.initBeans(this.createdBeans)}getBeanInstances(){return Object.values(this.beans)}createBean($,z){return this.initBeans([$],z),$}initBeans($,z){let Q=this.beans;for(let J of $)J.preWireBeans?.(Q),J.wireBeans?.(Q);for(let J of $)J.preConstruct?.();if(z)$.forEach(z);for(let J of $)J.postConstruct?.()}getBeans(){return this.beans}getBean($){return this.beans[$]}getId(){return this.id}destroy(){if(this.destroyed)return;this.destroyed=!0;let $=this.getBeanInstances();if(this.beanDestroyComparator)$.sort(this.beanDestroyComparator);this.destroyBeans($),this.beans={},this.createdBeans=[],this.destroyCallback?.()}destroyBean($){$?.destroy?.()}destroyBeans($){if($)for(let z=0;z<$.length;z++)this.destroyBean($[z]);return[]}isDestroyed(){return this.destroyed}};function z_($){return{beanName:"gridApi",bean:$.getBean("apiFunctionSvc").api}}var Q_=["licenseManager","environment","eventSvc","gos","paginationAutoPageSizeSvc","apiFunctionSvc","gridApi","registry","agCompUtils","userCompFactory","rowContainerHeight","horizontalResizeSvc","localeSvc","pinnedRowModel","dragSvc","colGroupSvc","visibleCols","popupSvc","selectionSvc","colFilter","quickFilter","filterManager","colModel","headerNavigation","pageBounds","pagination","pageBoundsListener","rowSpanSvc","stickyRowSvc","rowRenderer","expressionSvc","alignedGridsSvc","navigation","valueCache","valueSvc","autoWidthCalc","filterMenuFactory","dragAndDrop","focusSvc","cellNavigation","cellStyles","scrollVisibleSvc","sortSvc","colHover","colAnimation","autoColSvc","selectionColSvc","changeDetectionSvc","animationFrameSvc","undoRedo","colDefFactory","rowStyleSvc","rowNodeBlockLoader","rowNodeSorter","ctrlsSvc","pinnedCols","dataTypeSvc","syncSvc","overlays","stateSvc","expansionSvc","apiEventSvc","ariaAnnounce","menuSvc","colMoves","colAutosize","colFlex","colResize","pivotColsSvc","valueColsSvc","rowGroupColsSvc","colNames","colViewport","pivotResultCols","showRowGroupCols","validation"],V5=Object.fromEntries(Q_.map(($,z)=>[$,z]));function J_($,z){let Q=($.beanName?V5[$.beanName]:void 0)??Number.MAX_SAFE_INTEGER,J=(z.beanName?V5[z.beanName]:void 0)??Number.MAX_SAFE_INTEGER;return Q-J}function Z_($,z){if($?.beanName==="gridDestroySvc")return-1;if(z?.beanName==="gridDestroySvc")return 1;return 0}function b$($){let{rowIndex:z,rowPinned:Q,column:J}=$;return`${z}.${Q==null?"null":Q}.${J.getId()}`}function AQ($,z){let Q=$.column===z.column,J=$.rowPinned===z.rowPinned,Z=$.rowIndex===z.rowIndex;return Q&&J&&Z}function G0($,z){switch($.rowPinned){case"top":if(z.rowPinned!=="top")return!0;break;case"bottom":if(z.rowPinned!=="bottom")return!1;break;default:if(T(z.rowPinned))return z.rowPinned!=="top";break}return $.rowIndexU.rowNode.rowIndex===z.rowIndex),G=q?X:Y,_=(Q?-1:1)*(q?-1:1),H;for(let U=0;U{if(!J.defaultPrevented&&!__(J)&&J.key===A.TAB){let Z=J.shiftKey;if(!j0($,Q,!1,Z)){if(Z$($,Z))J.preventDefault()}}}})}function H$($){return $.gos.get("suppressHeaderFocus")||!!$.overlays?.exclusive}function GJ($){return $.gos.get("suppressCellFocus")||!!$.overlays?.exclusive}function Z$($,z,Q=!1){let J=$.ctrlsSvc.get("gridCtrl"),Z=J.focusNextInnerContainer(z);if(Z===!0)return!0;if(Z===!1)return Z;if(Q||!z&&!J.isDetailGrid()&&J.isFocusInsideGridBody())J.forceFocusOutOfContainer(z);return!1}function q_($,z){let Q=$.focusSvc,J=Q.getFocusedCell();if(J&&z&&AQ(J,z)){let{rowIndex:Z,rowPinned:X,column:Y}=z;if(hz($))Q.setFocusedCell({rowIndex:Z,column:Y,rowPinned:X,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!VQ()})}}function G_($,z){let Q=$.getFocusableContainerName();if(Q==="gridBody")return z();return u7($,()=>E$($.getGui(),".ag-tab-guard").length>0)?Q:null}function u7($,z){$.setAllowFocus?.(!0);try{return z()}finally{$.setAllowFocus?.(!1)}}var m7="__ag_Grid_Skip_Focusable_Container";function c7($){$[m7]=!0}function __($){return $[m7]===!0}function p7($){if(!$.cols)return-1;return $.cols.treeDepth+1}function l0($){return $.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0}function z4($){let z=[],Q=$.ctrlsSvc.getHeaderRowContainerCtrls();for(let J of Q){if(!J)continue;let Z=J.getGroupRowCount()||0;for(let X=0;Xq)z[X]=G}}}return z}function H_($,z){let J=$.colModel.isPivotMode()?W_($):n7($),Z=z.getHeaderCellCtrls();for(let X of Z){let{column:Y}=X,q=Y.getAutoHeaderHeight();if(q!=null&&q>J&&Y.isAutoHeaderHeight())J=q}return J}function Q4($){let Q=$.colModel.isPivotMode()?U_($):NJ($);return $.colModel.forAllCols((J)=>{let Z=J.getAutoHeaderHeight();if(Z!=null&&Z>Q&&J.isAutoHeaderHeight())Q=Z}),Q}function NJ($){return $.gos.get("headerHeight")??$.environment.getDefaultHeaderHeight()}function i7($){return $.gos.get("floatingFiltersHeight")??NJ($)}function n7($){return $.gos.get("groupHeaderHeight")??NJ($)}function U_($){return $.gos.get("pivotHeaderHeight")??NJ($)}function W_($){return $.gos.get("pivotGroupHeaderHeight")??n7($)}function B_($,z){return $.headerRowIndex===z.headerRowIndex&&$.column===z.column}function E_($){return $?.headerRowIndex!=null}var K_=class extends S{setComp($,z,Q){this.comp=$,this.eGui=z;let{beans:J}=this,{headerNavigation:Z,touchSvc:X,ctrlsSvc:Y}=J;if(Z)this.createManagedBean(new c$(Q,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusOut:this.onFocusOut.bind(this)}));this.addManagedEventListeners({columnPivotModeChanged:this.onPivotModeChanged.bind(this,J),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this,J)}),this.onPivotModeChanged(J),this.setupHeaderHeight();let q=this.onHeaderContextMenu.bind(this);this.addManagedElementListeners(this.eGui,{contextmenu:q}),X?.mockHeaderContextMenu(this,q),Y.register("gridHeaderCtrl",this)}setupHeaderHeight(){let $=this.setHeaderHeight.bind(this);$(),this.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],$),this.addManagedEventListeners({headerRowsChanged:$,columnHeaderHeightChanged:$,columnGroupHeaderHeightChanged:()=>Y$(this.beans,()=>$()),stylesChanged:$,advancedFilterEnabledChanged:$})}setHeaderHeight(){let{beans:$}=this,z=0,Q=z4($).reduce((Y,q)=>Y+q,0),J=Q4($);if($.filterManager?.hasFloatingFilters())z+=i7($);z+=Q,z+=J;let Z=$.environment.getHeaderRowBorderWidth(),X=z+Z;if(this.headerHeightWithBorder!==X){this.headerHeightWithBorder=X;let Y=`${X}px`;this.comp.setHeightAndMinHeight(Y)}if(this.headerHeight!==z)this.headerHeight=z,this.eventSvc.dispatchEvent({type:"headerHeightChanged"})}onPivotModeChanged($){let z=$.colModel.isPivotMode();this.comp.toggleCss("ag-pivot-on",z),this.comp.toggleCss("ag-pivot-off",!z)}onDisplayedColumnsChanged($){let Q=$.visibleCols.allCols.some((J)=>J.isSpanHeaderHeight());this.comp.toggleCss("ag-header-allow-overflow",Q)}onTabKeyDown($){let z=this.gos.get("enableRtl"),Q=$.shiftKey,J=Q!==z?"LEFT":"RIGHT",{beans:Z}=this,{headerNavigation:X,focusSvc:Y}=Z;if(X.navigateHorizontally(J,!0,$)||!Q&&Y.focusOverlay(!1)||Z$(Z,Q,!0))$.preventDefault()}handleKeyDown($){let z=null,{headerNavigation:Q}=this.beans;switch($.key){case A.LEFT:z="LEFT";case A.RIGHT:{if(!T(z))z="RIGHT";if(Q.navigateHorizontally(z,!1,$))$.preventDefault();break}case A.UP:z="UP";case A.DOWN:{if(!T(z))z="DOWN";if(Q.navigateVertically(z,$))$.preventDefault();break}default:return}}onFocusOut($){let{relatedTarget:z}=$,{eGui:Q,beans:J}=this;if(!z&&Q.contains(d(J)))return;if(!Q.contains(z))J.focusSvc.focusedHeader=null}onHeaderContextMenu($,z,Q){let{menuSvc:J,ctrlsSvc:Z}=this.beans;if(!$&&!Q||!J?.isHeaderContextMenuEnabled())return;let{target:X}=$??z;if(X===this.eGui||X===Z.getHeaderRowContainerCtrl()?.eViewport)J.showHeaderContextMenu(void 0,$,Q)}},J4=class extends x{constructor($,z){super($);this.ctrl=z}getCtrl(){return this.ctrl}},L_={tag:"div",cls:"ag-header-cell",role:"columnheader",children:[{tag:"div",ref:"eResize",cls:"ag-header-cell-resize",role:"presentation"},{tag:"div",ref:"eHeaderCompWrapper",cls:"ag-header-cell-comp-wrapper",role:"presentation"}]},D_=class extends J4{constructor($){super(L_,$);this.eResize=f,this.eHeaderCompWrapper=f,this.headerCompVersion=0}postConstruct(){let $=this.getGui(),z=()=>{let J=this.ctrl.getSelectAllGui();if(J)this.eResize.insertAdjacentElement("afterend",J),this.addDestroyFunc(()=>J.remove())},Q={setWidth:(J)=>$.style.width=J,toggleCss:(J,Z)=>this.toggleCss(J,Z),setUserStyles:(J)=>Z1($,J),setAriaSort:(J)=>J?dY($,J):tY($),setUserCompDetails:(J)=>this.setUserCompDetails(J),getUserCompInstance:()=>this.headerComp,refreshSelectAllGui:z,removeSelectAllGui:()=>this.ctrl.getSelectAllGui()?.remove()};this.ctrl.setComp(Q,this.getGui(),this.eResize,this.eHeaderCompWrapper,void 0),z()}destroy(){this.destroyHeaderComp(),super.destroy()}destroyHeaderComp(){if(this.headerComp)this.headerCompGui?.remove(),this.headerComp=this.destroyBean(this.headerComp),this.headerCompGui=void 0}setUserCompDetails($){this.headerCompVersion++;let z=this.headerCompVersion;$.newAgStackInstance().then((Q)=>this.afterCompCreated(z,Q))}afterCompCreated($,z){if($!=this.headerCompVersion||!this.isAlive()){this.destroyBean(z);return}this.destroyHeaderComp(),this.headerComp=z,this.headerCompGui=z.getGui(),this.eHeaderCompWrapper.appendChild(this.headerCompGui),this.ctrl.setDragSource(this.getGui())}},F_={tag:"div",cls:"ag-header-group-cell",role:"columnheader",children:[{tag:"div",ref:"eHeaderCompWrapper",cls:"ag-header-cell-comp-wrapper",role:"presentation"},{tag:"div",ref:"eResize",cls:"ag-header-cell-resize",role:"presentation"}]},M_=class extends J4{constructor($){super(F_,$);this.eResize=f,this.eHeaderCompWrapper=f}postConstruct(){let $=this.getGui(),z=(J,Z)=>Z!=null?$.setAttribute(J,Z):$.removeAttribute(J),Q={toggleCss:(J,Z)=>this.toggleCss(J,Z),setUserStyles:(J)=>Z1($,J),setHeaderWrapperHidden:(J)=>{if(J)this.eHeaderCompWrapper.style.setProperty("display","none");else this.eHeaderCompWrapper.style.removeProperty("display")},setHeaderWrapperMaxHeight:(J)=>{if(J!=null)this.eHeaderCompWrapper.style.setProperty("max-height",`${J}px`);else this.eHeaderCompWrapper.style.removeProperty("max-height");this.eHeaderCompWrapper.classList.toggle("ag-header-cell-comp-wrapper-limited-height",J!=null)},setResizableDisplayed:(J)=>N(this.eResize,J),setWidth:(J)=>$.style.width=J,setAriaExpanded:(J)=>z("aria-expanded",J),setUserCompDetails:(J)=>this.setUserCompDetails(J),getUserCompInstance:()=>this.headerGroupComp};this.ctrl.setComp(Q,$,this.eResize,this.eHeaderCompWrapper,void 0)}setUserCompDetails($){$.newAgStackInstance().then((z)=>this.afterHeaderCompCreated(z))}afterHeaderCompCreated($){let z=()=>this.destroyBean($);if(!this.isAlive()){z();return}let Q=this.getGui(),J=$.getGui();this.eHeaderCompWrapper.appendChild(J),this.addDestroyFunc(z),this.headerGroupComp=$,this.ctrl.setDragSource(Q)}},k_={tag:"div",cls:"ag-header-cell ag-floating-filter",role:"gridcell",children:[{tag:"div",ref:"eFloatingFilterBody",role:"presentation"},{tag:"div",ref:"eButtonWrapper",cls:"ag-floating-filter-button ag-hidden",role:"presentation",children:[{tag:"button",ref:"eButtonShowMainFilter",cls:"ag-button ag-floating-filter-button-button",attrs:{type:"button",tabindex:"-1"}}]}]},V_=class extends J4{constructor($){super(k_,$);this.eFloatingFilterBody=f,this.eButtonWrapper=f,this.eButtonShowMainFilter=f}postConstruct(){let $=this.getGui(),z={toggleCss:(Q,J)=>this.toggleCss(Q,J),setUserStyles:(Q)=>Z1($,Q),addOrRemoveBodyCssClass:(Q,J)=>this.eFloatingFilterBody.classList.toggle(Q,J),setButtonWrapperDisplayed:(Q)=>N(this.eButtonWrapper,Q),setCompDetails:(Q)=>this.setCompDetails(Q),getFloatingFilterComp:()=>this.compPromise,setWidth:(Q)=>$.style.width=Q,setMenuIcon:(Q)=>this.eButtonShowMainFilter.appendChild(Q)};this.ctrl.setComp(z,$,this.eButtonShowMainFilter,this.eFloatingFilterBody,void 0)}setCompDetails($){if(!$){this.destroyFloatingFilterComp(),this.compPromise=null;return}this.compPromise=$.newAgStackInstance(),this.compPromise.then((z)=>this.afterCompCreated(z))}destroy(){this.destroyFloatingFilterComp(),super.destroy()}destroyFloatingFilterComp(){this.floatingFilterComp?.getGui().remove(),this.floatingFilterComp=this.destroyBean(this.floatingFilterComp)}afterCompCreated($){if(!$)return;if(!this.isAlive()){this.destroyBean($);return}this.destroyFloatingFilterComp(),this.floatingFilterComp=$,this.eFloatingFilterBody.appendChild($.getGui()),$.afterGuiAttached?.()}},A_=class extends x{constructor($){super({tag:"div",cls:$.headerRowClass,role:"row"});this.ctrl=$,this.headerComps={}}postConstruct(){this.getGui().setAttribute("tabindex",String(this.gos.get("tabIndex"))),e1(this.getGui(),this.ctrl.getAriaRowIndex());let z={setHeight:(Q)=>this.getGui().style.height=Q,setTop:(Q)=>this.getGui().style.top=Q,setHeaderCtrls:(Q,J)=>this.setHeaderCtrls(Q,J),setWidth:(Q)=>this.getGui().style.width=Q,setRowIndex:(Q)=>e1(this.getGui(),Q)};this.ctrl.setComp(z,void 0)}destroy(){this.setHeaderCtrls([],!1),super.destroy()}setHeaderCtrls($,z){if(!this.isAlive())return;let Q=this.headerComps;this.headerComps={};for(let J of $){let Z=J.instanceId,X=Q[Z];if(delete Q[Z],X==null)X=this.createHeaderComp(J),this.getGui().appendChild(X.getGui());this.headerComps[Z]=X}if(Object.values(Q).forEach((J)=>{J.getGui().remove(),this.destroyBean(J)}),z){let J=Object.values(this.headerComps);J.sort((X,Y)=>{let q=X.getCtrl().column.getLeft(),G=Y.getCtrl().column.getLeft();return q-G});let Z=J.map((X)=>X.getGui());h6(this.getGui(),Z)}}createHeaderComp($){let z;switch(this.ctrl.type){case"group":z=new M_($);break;case"filter":z=new V_($);break;default:z=new D_($);break}return this.createBean(z),z.setParentComponent(this),z}},Z4=class extends S{constructor($,z=!1){super();this.callback=$,this.addSpacer=z}postConstruct(){let $=this.setWidth.bind(this);if(this.addManagedPropertyListener("domLayout",$),this.addManagedEventListeners({columnContainerWidthChanged:$,displayedColumnsChanged:$,leftPinnedWidthChanged:$}),this.addSpacer)this.addManagedEventListeners({rightPinnedWidthChanged:$,scrollVisibilityChanged:$,scrollbarWidthChanged:$});this.setWidth()}setWidth(){let $=V0(this.gos,"print"),{visibleCols:z,scrollVisibleSvc:Q}=this.beans,J=z.bodyWidth,Z=z.getColsLeftWidth(),X=z.getDisplayedColumnsRightWidth(),Y;if($)Y=J+Z+X;else if(Y=J,this.addSpacer){if((this.gos.get("enableRtl")?Z:X)===0&&Q.verticalScrollShowing)Y+=Q.getScrollbarWidth()}this.callback(Y)}};function B1($,z,Q){if(Q)$.addDestroyFunc(()=>z.destroyBean(Q));return Q??$}var X4=class extends S{constructor($,z,Q,J){super();this.columnOrGroup=$,this.eCell=z,this.colsSpanning=J,this.columnOrGroup=$,this.ariaEl=z.querySelector("[role=columnheader]")||z,this.beans=Q}setColsSpanning($){this.colsSpanning=$,this.onLeftChanged()}getColumnOrGroup(){let{beans:$,colsSpanning:z}=this;if($.gos.get("enableRtl")&&z)return b(z);return this.columnOrGroup}postConstruct(){let $=this.onLeftChanged.bind(this);this.addManagedListeners(this.columnOrGroup,{leftChanged:$}),this.setLeftFirstTime(),this.addManagedEventListeners({displayedColumnsWidthChanged:$}),this.addManagedPropertyListener("domLayout",$)}setLeftFirstTime(){let{gos:$,colAnimation:z}=this.beans,Q=$.get("suppressColumnMoveAnimation"),J=T(this.columnOrGroup.getOldLeft());if(z?.isActive()&&J&&!Q)this.animateInLeft();else this.onLeftChanged()}animateInLeft(){let $=this.getColumnOrGroup(),z=this.modifyLeftForPrintLayout($,$.getOldLeft()),Q=this.modifyLeftForPrintLayout($,$.getLeft());this.setLeft(z),this.actualLeft=Q,this.beans.colAnimation.executeNextVMTurn(()=>{if(this.actualLeft===Q)this.setLeft(Q)})}onLeftChanged(){let $=this.getColumnOrGroup(),z=$.getLeft();this.actualLeft=this.modifyLeftForPrintLayout($,z),this.setLeft(this.actualLeft)}modifyLeftForPrintLayout($,z){let{gos:Q,visibleCols:J}=this.beans;if(!V0(Q,"print"))return z;if($.getPinned()==="left")return z;let X=J.getColsLeftWidth();if($.getPinned()==="right"){let Y=J.bodyWidth;return X+Y+z}return X+z}setLeft($){if(T($))this.eCell.style.left=`${$}px`;if(H0(this.columnOrGroup)){let z=this.columnOrGroup.getLeafColumns();if(!z.length)return;if(z.length>1)nY(this.ariaEl,z.length)}}},S_="ag-column-first",R_="ag-column-last";function gJ($,z,Q,J){if(n($))return[];return t7($.headerClass,$,z,Q,J)}function hJ($,z,Q,J){if(n($))return[];return t7($.toolPanelClass,$,z,Q,J)}function d7($,z,Q){$.toggleCss(S_,Q.isColAtEdge(z,"first")),$.toggleCss(R_,Q.isColAtEdge(z,"last"))}function j_($,z,Q,J){return y(z,{colDef:$,column:Q,columnGroup:J})}function t7($,z,Q,J,Z){if(n($))return[];let X;if(typeof $==="function"){let Y=j_(z,Q,J,Z);X=$(Y)}else X=$;if(typeof X==="string")return[X];if(Array.isArray(X))return[...X];return[]}var f_=0,s7="headerCtrl",Y4=class extends S{constructor($,z){super();this.column=$,this.rowCtrl=z,this.resizeToggleTimeout=0,this.resizeMultiplier=1,this.resizeFeature=null,this.lastFocusEvent=null,this.dragSource=null,this.reAttemptToFocus=!1,this.instanceId=$.getUniqueId()+"-"+f_++}postConstruct(){let $=this.refreshTabIndex.bind(this);this.addManagedPropertyListeners(["suppressHeaderFocus"],$),this.addManagedEventListeners({overlayExclusiveChanged:$})}setComp($,z,Q,J,Z){if(z.setAttribute("col-id",this.column.colIdSanitised),this.wireComp($,z,Q,J,Z),this.reAttemptToFocus)this.reAttemptToFocus=!1,this.focus(this.lastFocusEvent??void 0)}shouldStopEventPropagation($){let{headerRowIndex:z,column:Q}=this.beans.focusSvc.focusedHeader,J=Q.getDefinition(),Z=J?.suppressHeaderKeyboardEvent;if(!T(Z))return!1;let X=y(this.gos,{colDef:J,column:Q,headerRowIndex:z,event:$});return!!Z(X)}getWrapperHasFocus(){return d(this.beans)===this.eGui}setGui($,z){this.eGui=$,this.addDomData(z),z.addManagedListeners(this.beans.eventSvc,{displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this)}),z.addManagedElementListeners(this.eGui,{focus:this.onGuiFocus.bind(this)}),this.onDisplayedColumnsChanged(),this.refreshTabIndex()}refreshHeaderStyles(){let $=this.column.getDefinition();if(!$)return;let{headerStyle:z}=$,Q;if(typeof z==="function"){let J=this.getHeaderClassParams();Q=z(J)}else Q=z;if(Q)this.comp.setUserStyles(Q)}onGuiFocus(){this.eventSvc.dispatchEvent({type:"headerFocused",column:this.column})}setupAutoHeight($){let{wrapperElement:z,checkMeasuringCallback:Q,compBean:J}=$,{beans:Z}=this,X=(U)=>{if(!this.isAlive()||!J.isAlive())return;let{paddingTop:W,paddingBottom:B,borderBottomWidth:E,borderTopWidth:K}=MQ(this.eGui),L=W+B+E+K,F=z.offsetHeight+L;if(U<5){let k=!Y0(Z)?.contains(z),V=F==0;if(k||V){eZ(()=>X(U+1),"raf",Z);return}}this.setColHeaderHeight(this.column,F)},Y=!1,q,G=()=>{let U=this.column.isAutoHeaderHeight();if(U&&!Y)_();if(!U&&Y)H()},_=()=>{Y=!0,this.comp.toggleCss("ag-header-cell-auto-height",!0),X(0),q=F$(this.beans,z,()=>X(0))},H=()=>{if(Y=!1,q)q();this.comp.toggleCss("ag-header-cell-auto-height",!1),q=void 0};if(G(),J.addDestroyFunc(()=>H()),J.addManagedListeners(this.column,{widthChanged:()=>Y&&X(0)}),J.addManagedEventListeners({sortChanged:()=>{if(Y)window.setTimeout(()=>X(0))}}),Q)Q(G)}onDisplayedColumnsChanged(){let{comp:$,column:z,beans:Q,eGui:J}=this;if(!$||!z||!J)return;d7($,z,Q.visibleCols),T6(J,Q.visibleCols.getAriaColIndex(z))}addResizeAndMoveKeyboardListeners($){$.addManagedListeners(this.eGui,{keydown:this.onGuiKeyDown.bind(this),keyup:this.onGuiKeyUp.bind(this)})}refreshTabIndex(){let $=H$(this.beans);if(this.eGui)Pz(this.eGui,"tabindex",$?null:"-1")}onGuiKeyDown($){let z=d(this.beans),Q=$.key===A.LEFT||$.key===A.RIGHT;if(this.isResizing)$.preventDefault(),$.stopImmediatePropagation();if(z!==this.eGui||!$.shiftKey&&!$.altKey&&!$.ctrlKey&&!$.metaKey)return;if(this.isResizing||Q)$.preventDefault(),$.stopImmediatePropagation();if(($.ctrlKey||$.metaKey)&&R7($)===A.C)return this.beans.clipboardSvc?.copyToClipboard();if(!Q)return;let X=$.key===A.LEFT!==this.gos.get("enableRtl")?"left":"right";if($.altKey){this.isResizing=!0,this.resizeMultiplier+=1;let Y=this.getViewportAdjustedResizeDiff($);this.resizeHeader(Y,$.shiftKey),this.resizeFeature?.toggleColumnResizing(!0)}else this.moveHeader(X)}moveHeader($){this.beans.colMoves?.moveHeader($,this.eGui,this.column,this.rowCtrl.pinned,this)}getViewportAdjustedResizeDiff($){let z=this.getResizeDiff($),{pinnedCols:Q}=this.beans;return Q?Q.getHeaderResizeDiff(z,this.column):z}getResizeDiff($){let{gos:z,column:Q}=this,J=$.key===A.LEFT!==z.get("enableRtl"),Z=Q.getPinned(),X=z.get("enableRtl");if(Z){if(X!==(Z==="right"))J=!J}return(J?-1:1)*this.resizeMultiplier}onGuiKeyUp(){if(!this.isResizing)return;if(this.resizeToggleTimeout)window.clearTimeout(this.resizeToggleTimeout),this.resizeToggleTimeout=0;this.isResizing=!1,this.resizeMultiplier=1,this.resizeToggleTimeout=window.setTimeout(()=>{this.resizeFeature?.toggleColumnResizing(!1)},150)}handleKeyDown($){let z=this.getWrapperHasFocus();switch($.key){case A.PAGE_DOWN:case A.PAGE_UP:case A.PAGE_HOME:case A.PAGE_END:if(z)$.preventDefault()}}addDomData($){let z=s7,{eGui:Q,gos:J}=this;wz(J,Q,z,this),$.addDestroyFunc(()=>wz(J,Q,z,null))}focus($){if(!this.isAlive())return!1;let{eGui:z}=this;if(!z)this.reAttemptToFocus=!0;else this.lastFocusEvent=$||null,z.focus();return!0}focusThis(){this.beans.focusSvc.focusedHeader={headerRowIndex:this.rowCtrl.rowIndex,column:this.column}}removeDragSource(){if(this.dragSource)this.beans.dragAndDrop?.removeDragSource(this.dragSource),this.dragSource=null}handleContextMenuMouseEvent($,z,Q){let J=$??z,{menuSvc:Z,gos:X}=this.beans;if(X.get("preventDefaultOnContextMenu"))J.preventDefault();if(Z?.isHeaderContextMenuEnabled(Q))Z.showHeaderContextMenu(Q,$,z);this.dispatchColumnMouseEvent("columnHeaderContextMenu",Q)}dispatchColumnMouseEvent($,z){this.eventSvc.dispatchEvent({type:$,column:z})}setColHeaderHeight($,z){if(!$.setAutoHeaderHeight(z))return;let{eventSvc:Q}=this;if($.isColumn)Q.dispatchEvent({type:"columnHeaderHeightChanged",column:$,columns:[$],source:"autosizeColumnHeaderHeight"});else Q.dispatchEvent({type:"columnGroupHeaderHeightChanged",columnGroup:$,source:"autosizeColumnGroupHeaderHeight"})}clearComponent(){this.removeDragSource(),this.resizeFeature=null,this.comp=null,this.eGui=null}destroy(){super.destroy(),this.column=null,this.lastFocusEvent=null,this.rowCtrl=null}},O_=class extends Y4{constructor(){super(...arguments);this.refreshFunctions={},this.userHeaderClasses=new Set,this.ariaDescriptionProperties=new Map}wireComp($,z,Q,J,Z){this.comp=$;let{rowCtrl:X,column:Y,beans:q}=this,{colResize:G,context:_,colHover:H,rangeSvc:U}=q,W=B1(this,_,Z);if(this.setGui(z,W),this.updateState(),this.setupWidth(W),this.setupMovingCss(W),this.setupMenuClass(W),this.setupSortableClass(W),this.setupWrapTextClass(),this.refreshSpanHeaderHeight(),this.setupAutoHeight({wrapperElement:J,checkMeasuringCallback:(E)=>this.setRefreshFunction("measuring",E),compBean:W}),this.addColumnHoverListener(W),this.setupFilterClass(W),this.setupStylesFromColDef(),this.setupClassesFromColDef(),this.setupTooltip(),this.addActiveHeaderMouseListeners(W),this.setupSelectAll(W),this.setupUserComp(),this.refreshAria(),G)this.resizeFeature=W.createManagedBean(G.createResizeFeature(X.pinned,Y,Q,$,this));else N(Q,!1);H?.createHoverFeature(W,[Y],z),U?.createRangeHighlightFeature(W,Y,$),W.createManagedBean(new X4(Y,z,q)),W.createManagedBean(new c$(z,{shouldStopEventPropagation:(E)=>this.shouldStopEventPropagation(E),onTabKeyDown:()=>null,handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this),onFocusOut:this.onFocusOut.bind(this)})),this.addResizeAndMoveKeyboardListeners(W),W.addManagedPropertyListeners(["suppressMovableColumns","suppressMenuHide","suppressAggFuncInHeader","enableAdvancedFilter"],()=>this.refresh()),W.addManagedListeners(Y,{colDefChanged:()=>this.refresh(),formulaRefChanged:()=>this.refresh(),headerHighlightChanged:this.onHeaderHighlightChanged.bind(this)});let B=()=>this.checkDisplayName();W.addManagedEventListeners({columnValueChanged:B,columnRowGroupChanged:B,columnPivotChanged:B,headerHeightChanged:this.onHeaderHeightChanged.bind(this)}),W.addDestroyFunc(()=>{this.refreshFunctions={},this.selectAllFeature=null,this.dragSourceElement=void 0,this.userCompDetails=null,this.userHeaderClasses.clear(),this.ariaDescriptionProperties.clear(),this.clearComponent()})}resizeHeader($,z){this.beans.colResize?.resizeHeader(this.column,$,z)}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.colDef;return y(z.gos,{colDef:Q,column:$,floatingFilter:!1})}setupUserComp(){let $=this.lookupUserCompDetails();if($)this.setCompDetails($)}setCompDetails($){this.userCompDetails=$,this.comp.setUserCompDetails($)}lookupUserCompDetails(){let $=this.createParams(),z=this.column.getColDef();return OG(this.beans.userCompFactory,z,$)}createParams(){let{menuSvc:$,sortSvc:z,colFilter:Q,gos:J}=this.beans;return y(J,{column:this.column,displayName:this.displayName,enableSorting:this.column.isSortable(),enableMenu:this.menuEnabled,enableFilterButton:this.openFilterEnabled&&!!$?.isHeaderFilterButtonEnabled(this.column),enableFilterIcon:!!Q&&(!this.openFilterEnabled||U0(this.gos)),showColumnMenu:(X,Y)=>{$?.showColumnMenu({column:this.column,buttonElement:X,positionBy:"button",onClosedCallback:Y})},showColumnMenuAfterMouseClick:(X,Y)=>{$?.showColumnMenu({column:this.column,mouseEvent:X,positionBy:"mouse",onClosedCallback:Y})},showFilter:(X)=>{$?.showFilterMenu({column:this.column,buttonElement:X,containerType:"columnFilter",positionBy:"button"})},progressSort:(X)=>{z?.progressSort(this.column,!!X,"uiColumnSorted")},setSort:(X,Y)=>{z?.setSortForColumn(this.column,a0(X),!!Y,"uiColumnSorted")},eGridHeader:this.eGui,setTooltip:(X,Y)=>{J.assertModuleRegistered("Tooltip",3),this.setupTooltip(X,Y)}})}setupSelectAll($){let{selectionSvc:z}=this.beans;if(!z)return;this.selectAllFeature=$.createOptionalManagedBean(z.createSelectAllFeature(this.column)),this.selectAllFeature?.setComp(this),$.addManagedPropertyListener("rowSelection",()=>{let Q=z.createSelectAllFeature(this.column);if(Q&&!this.selectAllFeature)this.selectAllFeature=$.createManagedBean(Q),this.selectAllFeature?.setComp(this),this.comp.refreshSelectAllGui();else if(this.selectAllFeature&&!Q)this.comp.removeSelectAllGui(),this.selectAllFeature=this.destroyBean(this.selectAllFeature)})}getSelectAllGui(){return this.selectAllFeature?.getCheckboxGui()}handleKeyDown($){if(super.handleKeyDown($),$.key===A.SPACE)this.selectAllFeature?.onSpaceKeyDown($);else if($.key===A.ENTER)this.onEnterKeyDown($);else if($.key===A.DOWN&&$.altKey)this.showMenuOnKeyPress($,!1)}onEnterKeyDown($){let{column:z,gos:Q,sortable:J,beans:Z}=this,X=!1;if($.ctrlKey||$.metaKey)X=this.showMenuOnKeyPress($,!0);if(!X){if(!$.altKey&&Jz(Q))Z.rangeSvc?.handleColumnSelection(z,$);else if(J)Z.sortSvc?.progressSort(z,$.shiftKey,"uiColumnSorted")}}showMenuOnKeyPress($,z){let Q=this.comp.getUserCompInstance();if(!A5(Q))return!1;if(Q.onMenuKeyboardShortcut(z))return $.preventDefault(),!0;return!1}onFocusIn($){if(!this.eGui.contains($.relatedTarget))this.focusThis(),this.announceAriaDescription();if(VQ())this.setActiveHeader(!0)}onFocusOut($){if(this.eGui.contains($.relatedTarget))return;this.setActiveHeader(!1)}setupTooltip($,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderTooltip(this.tooltipFeature,this,$,z)}setupStylesFromColDef(){this.setRefreshFunction("headerStyles",this.refreshHeaderStyles.bind(this)),this.refreshHeaderStyles()}setupClassesFromColDef(){let $=()=>{let z=this.column.getColDef(),Q=gJ(z,this.gos,this.column,null),J=this.userHeaderClasses;this.userHeaderClasses=new Set(Q);for(let Z of Q)if(J.has(Z))J.delete(Z);else this.comp.toggleCss(Z,!0);for(let Z of J)this.comp.toggleCss(Z,!1)};this.setRefreshFunction("headerClasses",$),$()}setDragSource($){if(this.dragSourceElement=$,this.removeDragSource(),!$||!this.draggable)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader($,this.column,this.displayName)??null}updateState(){let{menuSvc:$}=this.beans;this.menuEnabled=!!$?.isColumnMenuInHeaderEnabled(this.column),this.openFilterEnabled=!!$?.isFilterMenuInHeaderEnabled(this.column),this.sortable=this.column.isSortable(),this.displayName=this.calculateDisplayName(),this.draggable=this.workOutDraggable()}setRefreshFunction($,z){this.refreshFunctions[$]=z}refresh(){this.updateState(),this.refreshHeaderComp(),this.refreshAria();for(let $ of Object.values(this.refreshFunctions))$()}refreshHeaderComp(){let $=this.lookupUserCompDetails();if(!$)return;if(this.comp.getUserCompInstance()!=null&&this.userCompDetails.componentClass==$.componentClass?this.attemptHeaderCompRefresh($.params):!1)this.setDragSource(this.dragSourceElement);else this.setCompDetails($)}attemptHeaderCompRefresh($){let z=this.comp.getUserCompInstance();if(!z)return!1;if(!z.refresh)return!1;return z.refresh($)}calculateDisplayName(){return this.beans.colNames.getDisplayNameForColumn(this.column,"header",!0)}checkDisplayName(){if(this.displayName!==this.calculateDisplayName())this.refresh()}workOutDraggable(){let $=this.column.getColDef();return!this.gos.get("suppressMovableColumns")&&!$.suppressMovable&&!$.lockPosition||!!$.enableRowGroup||!!$.enablePivot}setupWidth($){let z=()=>{let Q=this.column.getActualWidth();this.comp.setWidth(`${Q}px`)};$.addManagedListeners(this.column,{widthChanged:z}),z()}setupMovingCss($){let z=()=>{this.comp.toggleCss("ag-header-cell-moving",this.column.isMoving())};$.addManagedListeners(this.column,{movingChanged:z}),z()}setupMenuClass($){let z=()=>{this.comp?.toggleCss("ag-column-menu-visible",this.column.isMenuVisible())};$.addManagedListeners(this.column,{menuVisibleChanged:z}),z()}setupSortableClass($){let z=()=>{this.comp.toggleCss("ag-header-cell-sortable",!!this.sortable)};z(),this.setRefreshFunction("updateSortable",z),$.addManagedEventListeners({sortChanged:this.refreshAriaSort.bind(this)})}setupFilterClass($){let z=()=>{let Q=this.column.isFilterActive();this.comp.toggleCss("ag-header-cell-filtered",Q),this.refreshAria()};$.addManagedListeners(this.column,{filterActiveChanged:z}),z()}setupWrapTextClass(){let $=()=>{let z=!!this.column.getColDef().wrapHeaderText;this.comp.toggleCss("ag-header-cell-wrap-text",z)};$(),this.setRefreshFunction("wrapText",$)}onHeaderHighlightChanged(){let $=this.column.getHighlighted(),z=$===0,Q=$===1;this.comp.toggleCss("ag-header-highlight-before",z),this.comp.toggleCss("ag-header-highlight-after",Q)}onDisplayedColumnsChanged(){if(super.onDisplayedColumnsChanged(),!this.isAlive())return;this.onHeaderHeightChanged()}onHeaderHeightChanged(){this.refreshSpanHeaderHeight()}refreshSpanHeaderHeight(){let{eGui:$,column:z,comp:Q,beans:J}=this,Z=z4(this.beans),X=Z.reduce((W,B)=>W+B,0)===0;if(Q.toggleCss("ag-header-parent-hidden",X),!z.isSpanHeaderHeight()){$.style.removeProperty("top"),$.style.removeProperty("height"),Q.toggleCss("ag-header-span-height",!1),Q.toggleCss("ag-header-span-total",!1);return}let{numberOfParents:Y,isSpanningTotal:q}=this.column.getColumnGroupPaddingInfo();Q.toggleCss("ag-header-span-height",Y>0);let G=Q4(J);if(Y===0){Q.toggleCss("ag-header-span-total",!1),$.style.setProperty("top","0px"),$.style.setProperty("height",`${G}px`);return}Q.toggleCss("ag-header-span-total",q);let _=(this.column.getFirstRealParent()?.getLevel()??-1)+1,H=Z.length-_,U=0;for(let W=0;WZ==="filter"?-1:X.charCodeAt(0)-Z.charCodeAt(0)).map((Z)=>Q.get(Z)).join(". ");$.ariaAnnounce?.announceValue(J,"columnHeader")}refreshAria(){this.refreshAriaSort(),this.refreshAriaMenu(),this.refreshAriaFilterButton(),this.refreshAriaFiltered(),this.refreshAriaCellSelection()}addColumnHoverListener($){this.beans.colHover?.addHeaderColumnHoverListener($,this.comp,this.column)}addActiveHeaderMouseListeners($){let z=(Z)=>this.handleMouseOverChange(Z.type==="mouseenter"),Q=()=>{this.setActiveHeader(!0),this.dispatchColumnMouseEvent("columnHeaderClicked",this.column)},J=(Z)=>this.handleContextMenuMouseEvent(Z,void 0,this.column);$.addManagedListeners(this.eGui,{mouseenter:z,mouseleave:z,click:Q,contextmenu:J})}handleMouseOverChange($){this.setActiveHeader($),this.eventSvc.dispatchEvent({type:$?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column})}setActiveHeader($){this.comp.toggleCss("ag-header-active",$)}getAnchorElementForMenu($){let z=this.comp.getUserCompInstance();if(A5(z))return z.getAnchorElementForMenu($);return this.eGui}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function A5($){return typeof $?.getAnchorElementForMenu==="function"&&typeof $.onMenuKeyboardShortcut==="function"}var P_=0,IZ=class extends S{constructor($,z,Q){super();this.rowIndex=$,this.pinned=z,this.type=Q,this.instanceId=P_++,this.comp=null,this.allCtrls=[];let J="ag-header-row-column";if(Q==="group")J="ag-header-row-group";else if(Q==="filter")J="ag-header-row-filter";this.headerRowClass=`ag-header-row ${J}`}setRowIndex($){this.rowIndex=$,this.comp?.setRowIndex(this.getAriaRowIndex()),this.onRowHeightChanged()}postConstruct(){this.isPrintLayout=V0(this.gos,"print"),this.isEnsureDomOrder=this.gos.get("ensureDomOrder")}areCellsRendered(){if(!this.comp)return!1;return this.allCtrls.every(($)=>$.eGui!=null)}setComp($,z,Q=!0){if(this.comp=$,z=B1(this,this.beans.context,z),Q)this.setRowIndex(this.rowIndex),this.onVirtualColumnsChanged();this.setWidth(),this.addEventListeners(z)}getAriaRowIndex(){return this.rowIndex+1}addEventListeners($){let z=this.onRowHeightChanged.bind(this),Q=this.onDisplayedColumnsChanged.bind(this);$.addManagedEventListeners({columnResized:this.setWidth.bind(this),displayedColumnsChanged:Q,virtualColumnsChanged:(J)=>this.onVirtualColumnsChanged(J.afterScroll),columnGroupHeaderHeightChanged:z,columnHeaderHeightChanged:z,stylesChanged:z,advancedFilterEnabledChanged:z}),$.addManagedPropertyListener("domLayout",Q),$.addManagedPropertyListener("ensureDomOrder",(J)=>this.isEnsureDomOrder=J.currentValue),$.addManagedPropertyListeners(["headerHeight","pivotHeaderHeight","groupHeaderHeight","pivotGroupHeaderHeight","floatingFiltersHeight"],z)}onDisplayedColumnsChanged(){this.isPrintLayout=V0(this.gos,"print"),this.onVirtualColumnsChanged(),this.setWidth(),this.onRowHeightChanged()}setWidth(){if(!this.comp)return;let $=this.getWidthForRow();this.comp.setWidth(`${$}px`)}getWidthForRow(){let{visibleCols:$}=this.beans;if(this.isPrintLayout){if(this.pinned!=null)return 0;return $.getContainerWidth("right")+$.getContainerWidth("left")+$.getContainerWidth(null)}return $.getContainerWidth(this.pinned)}onRowHeightChanged(){if(!this.comp)return;let{topOffset:$,rowHeight:z}=this.getTopAndHeight();this.comp.setTop($+"px"),this.comp.setHeight(z+"px")}getTopAndHeight(){let $=0,z=z4(this.beans);for(let Z=0;Z{let{focusSvc:Z,visibleCols:X}=this.beans;if(!Z.isHeaderWrapperFocused(J))return!1;return X.isVisible(J.column)};if($)for(let[J,Z]of $)if(Q(Z))this.ctrlsById.set(J,Z);else this.destroyBean(Z);return this.allCtrls=Array.from(this.ctrlsById.values()),this.allCtrls}getHeaderCellCtrls(){return this.allCtrls}recycleAndCreateHeaderCtrls($,z,Q){if($.isEmptyGroup())return;let J=$.getUniqueId(),Z;if(Q)Z=Q.get(J),Q.delete(J);if(Z&&Z.column!=$)this.destroyBean(Z),Z=void 0;if(Z==null)switch(this.type){case"filter":{Z=this.createBean(this.beans.registry.createDynamicBean("headerFilterCellCtrl",!0,$,this));break}case"group":Z=this.createBean(this.beans.registry.createDynamicBean("headerGroupCellCtrl",!0,$,this));break;default:Z=this.createBean(new O_($,this));break}z.set(J,Z)}getColumnsInViewport(){if(!this.isPrintLayout)return this.getComponentsToRender();if(this.pinned)return[];let $=[];for(let z of["left",null,"right"])$.push(...this.getComponentsToRender(z));return $}getComponentsToRender($=this.pinned){if(this.type==="group")return this.beans.colViewport.getHeadersToRender($,this.rowIndex);return this.beans.colViewport.getColumnHeadersToRender($)}focusHeader($,z){let Q=this.allCtrls.find((Z)=>Z.column==$);if(!Q)return!1;return Q.focus(z)}destroy(){this.allCtrls=this.destroyBeans(this.allCtrls),this.ctrlsById=void 0,this.comp=null,super.destroy()}},T_=class extends S{constructor($){super();this.pinned=$,this.hidden=!1,this.includeFloatingFilter=!1,this.groupsRowCtrls=[]}setComp($,z){this.comp=$,this.eViewport=z;let{pinnedCols:Q,ctrlsSvc:J,colModel:Z,colMoves:X}=this.beans;this.setupCenterWidth(),Q?.setupHeaderPinnedWidth(this),this.setupDragAndDrop(X,this.eViewport);let Y=this.refresh.bind(this,!0);this.addManagedEventListeners({displayedColumnsChanged:Y,advancedFilterEnabledChanged:Y});let q=`${typeof this.pinned==="string"?this.pinned:"center"}Header`;if(J.register(q,this),Z.ready)this.refresh()}getAllCtrls(){let $=[...this.groupsRowCtrls];if(this.columnsRowCtrl)$.push(this.columnsRowCtrl);if(this.filtersRowCtrl)$.push(this.filtersRowCtrl);return $}refresh($=!1){let{focusSvc:z,filterManager:Q,visibleCols:J}=this.beans,Z=0,X=z.getFocusHeaderToUseAfterRefresh(),Y=()=>{let U=J.headerGroupRowCount;if(Z=U,!$)this.groupsRowCtrls=this.destroyBeans(this.groupsRowCtrls);let W=this.groupsRowCtrls.length;if(W===U)return;if(W>U){for(let B=U;B{let U=Z++;if(this.hidden){this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl);return}if(this.columnsRowCtrl==null||!$)this.columnsRowCtrl=this.destroyBean(this.columnsRowCtrl),this.columnsRowCtrl=this.createBean(new IZ(U,this.pinned,"column"));else if(this.columnsRowCtrl.rowIndex!==U)this.columnsRowCtrl.setRowIndex(U)},G=()=>{this.includeFloatingFilter=!!Q?.hasFloatingFilters()&&!this.hidden;let U=()=>{this.filtersRowCtrl=this.destroyBean(this.filtersRowCtrl)};if(!this.includeFloatingFilter){U();return}if(!$)U();let W=Z++;if(this.filtersRowCtrl){if(this.filtersRowCtrl.rowIndex!==W)this.filtersRowCtrl.setRowIndex(W)}else this.filtersRowCtrl=this.createBean(new IZ(W,this.pinned,"filter"))},_=this.getAllCtrls();Y(),q(),G();let H=this.getAllCtrls();if(this.comp.setCtrls(H),this.restoreFocusOnHeader(z,X),_.length!==H.length)this.beans.eventSvc.dispatchEvent({type:"headerRowsChanged"})}getHeaderCtrlForColumn($){let z=(Q)=>Q?.getHeaderCellCtrls().find((J)=>J.column===$);if(Q$($))return z(this.columnsRowCtrl);if(this.groupsRowCtrls.length===0)return;for(let Q=0;Qthis.comp.setCenterWidth(`${$}px`),!0))}},v_={tag:"div",cls:"ag-pinned-left-header",role:"rowgroup"},I_={tag:"div",cls:"ag-pinned-right-header",role:"rowgroup"},C_={tag:"div",cls:"ag-header-viewport",role:"rowgroup",attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eCenterContainer",cls:"ag-header-container",role:"presentation"}]},CZ=class extends x{constructor($){super();this.eCenterContainer=f,this.headerRowComps={},this.rowCompsList=[],this.pinned=$}postConstruct(){this.selectAndSetTemplate();let $={setDisplayed:(Q)=>this.setDisplayed(Q),setCtrls:(Q)=>this.setCtrls(Q),setCenterWidth:(Q)=>this.eCenterContainer.style.width=Q,setViewportScrollLeft:(Q)=>this.getGui().scrollLeft=Q,setPinnedContainerWidth:(Q)=>{let J=this.getGui();J.style.width=Q,J.style.maxWidth=Q,J.style.minWidth=Q}};this.createManagedBean(new T_(this.pinned)).setComp($,this.getGui())}selectAndSetTemplate(){let $=this.pinned=="left",z=this.pinned=="right",Q=$?v_:z?I_:C_;this.setTemplate(Q),this.eRowContainer=this.eCenterContainer!==f?this.eCenterContainer:this.getGui()}destroy(){this.setCtrls([]),super.destroy()}destroyRowComp($){this.destroyBean($),$.getGui().remove()}setCtrls($){let z=this.headerRowComps;this.headerRowComps={},this.rowCompsList=[];let Q,J=(Z)=>{let X=Z.getGui();if(X.parentElement!=this.eRowContainer)this.eRowContainer.appendChild(X);if(Q)g6(this.eRowContainer,X,Q);Q=X};for(let Z of $){let X=Z.instanceId,Y=z[X];delete z[X];let q=Y?Y:this.createBean(new A_(Z));this.headerRowComps[X]=q,this.rowCompsList.push(q),J(q)}for(let Z of Object.values(z))this.destroyRowComp(Z)}},b_={tag:"div",cls:"ag-header",role:"presentation"},y_=class extends x{constructor(){super(b_)}postConstruct(){let $={toggleCss:(J,Z)=>this.toggleCss(J,Z),setHeightAndMinHeight:(J)=>{this.getGui().style.height=J,this.getGui().style.minHeight=J}};this.createManagedBean(new K_).setComp($,this.getGui(),this.getFocusableElement());let Q=(J)=>{this.createManagedBean(J),this.appendChild(J)};Q(new CZ("left")),Q(new CZ(null)),Q(new CZ("right"))}},x_={selector:"AG-HEADER-ROOT",component:y_},U$={AUTO_HEIGHT:"ag-layout-auto-height",NORMAL:"ag-layout-normal",PRINT:"ag-layout-print"},q4=class extends S{constructor($){super();this.view=$}postConstruct(){this.addManagedPropertyListener("domLayout",this.updateLayoutClasses.bind(this)),this.updateLayoutClasses()}updateLayoutClasses(){let $=this.gos.get("domLayout"),z={autoHeight:$==="autoHeight",normal:$==="normal",print:$==="print"},Q=z.autoHeight?U$.AUTO_HEIGHT:z.print?U$.PRINT:U$.NORMAL;this.view.updateLayoutClasses(Q,z)}},r7=class extends x{constructor($,z){super();this.direction=z,this.eViewport=f,this.eContainer=f,this.hideTimeout=0,this.setTemplate($)}postConstruct(){this.addManagedEventListeners({scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this)}),this.onScrollVisibilityChanged(),this.toggleCss("ag-apple-scrollbar",I7()||bz())}destroy(){super.destroy(),window.clearTimeout(this.hideTimeout)}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.invisibleScrollbar=b7(),this.invisibleScrollbar)this.hideAndShowInvisibleScrollAsNeeded(),this.addActiveListenerToggles()}addActiveListenerToggles(){let $=this.getGui(),z=()=>this.toggleCss("ag-scrollbar-active",!0),Q=()=>this.toggleCss("ag-scrollbar-active",!1);this.addManagedListeners($,{mouseenter:z,mousedown:z,touchstart:z,mouseleave:Q,touchend:Q})}onScrollVisibilityChanged(){if(this.invisibleScrollbar===void 0)this.initialiseInvisibleScrollbar();Y$(this.beans,()=>this.setScrollVisible())}hideAndShowInvisibleScrollAsNeeded(){this.addManagedEventListeners({bodyScroll:($)=>{if($.direction===this.direction){if(this.hideTimeout)window.clearTimeout(this.hideTimeout),this.hideTimeout=0;this.toggleCss("ag-scrollbar-scrolling",!0)}},bodyScrollEnd:()=>{this.hideTimeout=window.setTimeout(()=>{this.toggleCss("ag-scrollbar-scrolling",!1),this.hideTimeout=0},400)}})}attemptSettingScrollPosition($){let z=this.eViewport;C2(this,()=>A0(z),()=>this.setScrollPosition($),100)}onScrollCallback($){this.addManagedElementListeners(this.eViewport,{scroll:$})}},w_={tag:"div",cls:"ag-body-horizontal-scroll",attrs:{"aria-hidden":"true"},children:[{tag:"div",ref:"eLeftSpacer",cls:"ag-horizontal-left-spacer"},{tag:"div",ref:"eViewport",cls:"ag-body-horizontal-scroll-viewport",children:[{tag:"div",ref:"eContainer",cls:"ag-body-horizontal-scroll-container"}]},{tag:"div",ref:"eRightSpacer",cls:"ag-horizontal-right-spacer"}]},N_=class extends r7{constructor(){super(w_,"horizontal");this.eLeftSpacer=f,this.eRightSpacer=f,this.setScrollVisibleDebounce=0}wireBeans($){this.visibleCols=$.visibleCols,this.scrollVisibleSvc=$.scrollVisibleSvc}postConstruct(){super.postConstruct();let $=this.setFakeHScrollSpacerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:$,displayedColumnsWidthChanged:$,pinnedRowDataChanged:this.refreshCompBottom.bind(this)}),this.addManagedPropertyListener("domLayout",$),this.beans.ctrlsSvc.register("fakeHScrollComp",this),this.createManagedBean(new Z4((z)=>this.eContainer.style.width=`${z}px`)),this.addManagedPropertyListeners(["suppressHorizontalScroll"],this.onScrollVisibilityChanged.bind(this))}destroy(){window.clearTimeout(this.setScrollVisibleDebounce),super.destroy()}initialiseInvisibleScrollbar(){if(this.invisibleScrollbar!==void 0)return;if(this.enableRtl=this.gos.get("enableRtl"),super.initialiseInvisibleScrollbar(),this.invisibleScrollbar)this.refreshCompBottom()}refreshCompBottom(){if(!this.invisibleScrollbar)return;let $=this.beans.pinnedRowModel?.getPinnedBottomTotalHeight()??0;this.getGui().style.bottom=`${$}px`}onScrollVisibilityChanged(){super.onScrollVisibilityChanged(),this.setFakeHScrollSpacerWidths()}setFakeHScrollSpacerWidths(){let $=this.scrollVisibleSvc.verticalScrollShowing,z=this.visibleCols.getDisplayedColumnsRightWidth(),Q=!this.enableRtl&&$,J=this.scrollVisibleSvc.getScrollbarWidth();if(Q)z+=J;f$(this.eRightSpacer,z),this.eRightSpacer.classList.toggle("ag-scroller-corner",z<=J);let Z=this.visibleCols.getColsLeftWidth();if(this.enableRtl&&$)Z+=J;f$(this.eLeftSpacer,Z),this.eLeftSpacer.classList.toggle("ag-scroller-corner",Z<=J)}setScrollVisible(){let $=this.scrollVisibleSvc.horizontalScrollShowing,z=this.invisibleScrollbar,Q=this.gos.get("suppressHorizontalScroll"),J=$?this.scrollVisibleSvc.getScrollbarWidth()||0:0,X=!Q?J===0&&z?16:J:0,Y=()=>{if(this.setScrollVisibleDebounce=0,this.toggleCss("ag-scrollbar-invisible",z),NQ(this.getGui(),X),NQ(this.eViewport,X),NQ(this.eContainer,X),!X)this.eContainer.style.setProperty("min-height","1px");this.setVisible($,{skipAriaHidden:!0})};if(window.clearTimeout(this.setScrollVisibleDebounce),!$)Y();else this.setScrollVisibleDebounce=window.setTimeout(Y,100)}getScrollPosition(){return $J(this.eViewport,this.enableRtl)}setScrollPosition($){if(!A0(this.eViewport))this.attemptSettingScrollPosition($);zJ(this.eViewport,$,this.enableRtl)}},g_={selector:"AG-FAKE-HORIZONTAL-SCROLL",component:N_},l7=class extends S{constructor($,z){super();this.eContainer=$,this.eViewport=z}postConstruct(){this.addManagedEventListeners({rowContainerHeightChanged:this.onHeightChanged.bind(this,this.beans.rowContainerHeight)})}onHeightChanged($){let z=$.uiContainerHeight,Q=z!=null?`${z}px`:"";if(this.eContainer.style.height=Q,this.eViewport)this.eViewport.style.height=Q}},h_={tag:"div",cls:"ag-body-vertical-scroll",attrs:{"aria-hidden":"true"},children:[{tag:"div",ref:"eViewport",cls:"ag-body-vertical-scroll-viewport",children:[{tag:"div",ref:"eContainer",cls:"ag-body-vertical-scroll-container"}]}]},u_=class extends r7{constructor(){super(h_,"vertical")}postConstruct(){super.postConstruct(),this.createManagedBean(new l7(this.eContainer));let{ctrlsSvc:$}=this.beans;$.register("fakeVScrollComp",this),this.addManagedEventListeners({rowContainerHeightChanged:this.onRowContainerHeightChanged.bind(this,$)})}setScrollVisible(){let{scrollVisibleSvc:$}=this.beans,z=$.verticalScrollShowing,Q=this.invisibleScrollbar,J=z?$.getScrollbarWidth()||0:0,Z=J===0&&Q?16:J;this.toggleCss("ag-scrollbar-invisible",Q),f$(this.getGui(),Z),f$(this.eViewport,Z),f$(this.eContainer,Z),this.setDisplayed(z,{skipAriaHidden:!0})}onRowContainerHeightChanged($){let Q=$.getGridBodyCtrl().eBodyViewport,J=this.getScrollPosition(),Z=Q.scrollTop;if(J!=Z)this.setScrollPosition(Z,!0)}getScrollPosition(){return this.eViewport.scrollTop}setScrollPosition($,z){if(!z&&!A0(this.eViewport))this.attemptSettingScrollPosition($);this.eViewport.scrollTop=$}},m_={selector:"AG-FAKE-VERTICAL-SCROLL",component:u_};var s$="Viewport",S5="fakeVScrollComp",bZ=["fakeHScrollComp","centerHeader","topCenter","bottomCenter","stickyTopCenter","stickyBottomCenter"],R5=100,yZ=150,c_=class extends S{constructor($){super();this.clearRetryListenerFncs=[],this.lastScrollSource=[null,null],this.scrollLeft=-1,this.nextScrollTop=-1,this.scrollTop=-1,this.lastOffsetHeight=-1,this.lastScrollTop=-1,this.lastIsHorizontalScrollShowing=!1,this.scrollTimer=0,this.isScrollActive=!1,this.isVerticalPositionInvalidated=!0,this.isHorizontalPositionInvalidated=!0,this.eBodyViewport=$,this.resetLastHScrollDebounced=g$(this,()=>this.lastScrollSource[1]=null,yZ),this.resetLastVScrollDebounced=g$(this,()=>this.lastScrollSource[0]=null,yZ)}wireBeans($){this.ctrlsSvc=$.ctrlsSvc,this.animationFrameSvc=$.animationFrameSvc,this.visibleCols=$.visibleCols}destroy(){super.destroy(),this.clearRetryListenerFncs=[],window.clearTimeout(this.scrollTimer)}postConstruct(){this.enableRtl=this.gos.get("enableRtl");let $=this.invalidateVerticalScroll.bind(this),z=this.invalidateHorizontalScroll.bind(this);this.addManagedEventListeners({displayedColumnsWidthChanged:this.onDisplayedColumnsWidthChanged.bind(this),bodyHeightChanged:$,scrollGapChanged:z}),this.addManagedElementListeners(this.eBodyViewport,{scroll:$}),this.ctrlsSvc.whenReady(this,(Q)=>{this.centerRowsCtrl=Q.center,this.fakeVScrollComp=Q.fakeVScrollComp,this.fakeHScrollComp=Q.fakeHScrollComp,this.onDisplayedColumnsWidthChanged(),this.addScrollListener()})}invalidateHorizontalScroll(){this.isHorizontalPositionInvalidated=!0}invalidateVerticalScroll(){this.isVerticalPositionInvalidated=!0}addScrollListener(){this.addHorizontalScrollListeners(),this.addVerticalScrollListeners()}addHorizontalScrollListeners(){this.addManagedElementListeners(this.centerRowsCtrl.eViewport,{scroll:this.onHScroll.bind(this,s$)});for(let $ of bZ){let z=this.ctrlsSvc.get($);this.registerScrollPartner(z,this.onHScroll.bind(this,$))}}addVerticalScrollListeners(){let $=this.gos.get("debounceVerticalScrollbar"),z=$?g$(this,this.onVScroll.bind(this,s$),R5):this.onVScroll.bind(this,s$),Q=$?g$(this,this.onVScroll.bind(this,S5),R5):this.onVScroll.bind(this,S5);this.addManagedElementListeners(this.eBodyViewport,{scroll:z}),this.registerScrollPartner(this.fakeVScrollComp,Q)}registerScrollPartner($,z){$.onScrollCallback(z)}onDisplayedColumnsWidthChanged(){if(this.enableRtl)this.horizontallyScrollHeaderCenterAndFloatingCenter()}horizontallyScrollHeaderCenterAndFloatingCenter($){if(this.centerRowsCtrl==null)return;if($===void 0)$=this.centerRowsCtrl.getCenterViewportScrollLeft();this.setScrollLeftForAllContainersExceptCurrent(Math.abs($))}setScrollLeftForAllContainersExceptCurrent($){for(let z of[...bZ,s$]){if(this.lastScrollSource[1]===z)continue;let Q=this.getViewportForSource(z);zJ(Q,$,this.enableRtl)}}getViewportForSource($){if($===s$)return this.centerRowsCtrl.eViewport;return this.ctrlsSvc.get($).eViewport}isControllingScroll($,z){if(this.lastScrollSource[z]==null){if(z===0)this.lastScrollSource[0]=$;else this.lastScrollSource[1]=$;return!0}return this.lastScrollSource[z]===$}onHScroll($){if(!this.isControllingScroll($,1))return;let z=this.centerRowsCtrl.eViewport,{scrollLeft:Q}=z;if(this.shouldBlockScrollUpdate(1,Q,!0))return;let J=$J(this.getViewportForSource($),this.enableRtl);this.doHorizontalScroll(J),this.resetLastHScrollDebounced()}onVScroll($){if(!this.isControllingScroll($,0))return;let z=$===s$?this.eBodyViewport.scrollTop:this.fakeVScrollComp.getScrollPosition(),Q=z;if(this.shouldBlockScrollUpdate(0,Q,!0))return;if($===s$)this.fakeVScrollComp.setScrollPosition(Q);else if(this.eBodyViewport.scrollTop=z,Q=this.eBodyViewport.scrollTop,this.invalidateVerticalScroll(),Q!==z)this.fakeVScrollComp.setScrollPosition(Q,!0);let{animationFrameSvc:J}=this;if(J?.setScrollTop(Q),this.nextScrollTop=Q,J?.active)J.schedule();else this.scrollGridIfNeeded(!0);this.resetLastVScrollDebounced()}doHorizontalScroll($){let z=this.fakeHScrollComp.getScrollPosition();if(this.scrollLeft===$&&$===z)return;this.scrollLeft=$,this.fireScrollEvent(1),this.horizontallyScrollHeaderCenterAndFloatingCenter($),this.centerRowsCtrl.onHorizontalViewportChanged(!0)}isScrolling(){return this.isScrollActive}fireScrollEvent($){let z={type:"bodyScroll",direction:$===1?"horizontal":"vertical",left:this.scrollLeft,top:this.scrollTop};this.isScrollActive=!0,this.eventSvc.dispatchEvent(z),window.clearTimeout(this.scrollTimer),this.scrollTimer=window.setTimeout(()=>{this.scrollTimer=0,this.isScrollActive=!1,this.eventSvc.dispatchEvent({...z,type:"bodyScrollEnd"})},yZ)}shouldBlockScrollUpdate($,z,Q=!1){if(Q&&!bz())return!1;if($===0)return this.shouldBlockVerticalScroll(z);return this.shouldBlockHorizontalScroll(z)}shouldBlockVerticalScroll($){let z=SJ(this.eBodyViewport),{scrollHeight:Q}=this.eBodyViewport;return $<0||$+z>Q}shouldBlockHorizontalScroll($){let z=this.centerRowsCtrl.getCenterWidth(),{scrollWidth:Q}=this.centerRowsCtrl.eViewport;if(this.enableRtl){if($>0)return!0}else if($<0)return!0;return Math.abs($)+z>Q}redrawRowsAfterScroll(){this.fireScrollEvent(0)}checkScrollLeft(){let $=this.scrollLeft,z=!1;for(let Q of bZ)if(this.getViewportForSource(Q).scrollLeft!==$){z=!0;break}if(z)this.onHScroll(s$)}scrollGridIfNeeded($=!1){let z=this.scrollTop!=this.nextScrollTop;if(z){if(this.scrollTop=this.nextScrollTop,$)this.invalidateVerticalScroll();this.redrawRowsAfterScroll()}return z}setHorizontalScrollPosition($,z=!1){let J=this.centerRowsCtrl.eViewport.scrollWidth-this.centerRowsCtrl.getCenterWidth();if(!z&&this.shouldBlockScrollUpdate(1,$))if(this.enableRtl)$=$>0?0:J;else $=Math.min(Math.max($,0),J);zJ(this.centerRowsCtrl.eViewport,Math.abs($),this.enableRtl),this.doHorizontalScroll($)}setVerticalScrollPosition($){this.invalidateVerticalScroll(),this.eBodyViewport.scrollTop=$}getVScrollPosition(){if(!this.isVerticalPositionInvalidated){let{lastOffsetHeight:Q,lastScrollTop:J}=this;return{top:J,bottom:J+Q}}this.isVerticalPositionInvalidated=!1;let{scrollTop:$,offsetHeight:z}=this.eBodyViewport;return this.lastScrollTop=$,this.lastOffsetHeight=z,{top:$,bottom:$+z}}getApproximateVScollPosition(){if(this.lastScrollTop>=0&&this.lastOffsetHeight>=0)return{top:this.scrollTop,bottom:this.scrollTop+this.lastOffsetHeight};return this.getVScrollPosition()}getHScrollPosition(){return this.centerRowsCtrl.getHScrollPosition()}isHorizontalScrollShowing(){if(this.isHorizontalPositionInvalidated)this.lastIsHorizontalScrollShowing=this.centerRowsCtrl.isHorizontalScrollShowing(),this.isHorizontalPositionInvalidated=!1;return this.lastIsHorizontalScrollShowing}scrollHorizontally($){let z=this.centerRowsCtrl.eViewport.scrollLeft;return this.setHorizontalScrollPosition(z+$),this.centerRowsCtrl.eViewport.scrollLeft-z}scrollToTop(){this.setVerticalScrollPosition(0)}ensureNodeVisible($,z=null){let{rowModel:Q}=this.beans,J=Q.getRowCount(),Z=-1;for(let X=0;X=0)this.ensureIndexVisible(Z,z)}ensureIndexVisible($,z,Q=0){if(V0(this.gos,"print"))return;let{rowModel:J}=this.beans,Z=J.getRowCount();if(typeof $!=="number"||$<0||$>=Z){j(88,{index:$});return}this.clearRetryListeners();let{frameworkOverrides:X,pageBounds:Y,rowContainerHeight:q,rowRenderer:G}=this.beans;X.wrapIncoming(()=>{let _=this.ctrlsSvc.getGridBodyCtrl(),H=J.getRow($),U,W,B=0;this.invalidateVerticalScroll();do{let{stickyTopHeight:E,stickyBottomHeight:K}=_,L=H.rowTop,D=H.rowHeight,F=Y.getPixelOffset(),M=H.rowTop-F,k=M+H.rowHeight,V=this.getVScrollPosition(),R=q.divStretchOffset,O=V.top+R,I=V.bottom+R,v=I-O,C=q.getScrollPositionForPixel(M),m=q.getScrollPositionForPixel(k-v),w=Math.min((C+m)/2,M),a=O+E>M,t=I-Kv)u=C-E;else u=m+K;if(u!==null)this.setVerticalScrollPosition(u),G.redraw({afterScroll:!0});U=L!==H.rowTop||D!==H.rowHeight,W=E!==_.stickyTopHeight||K!==_.stickyBottomHeight,B++}while((U||W)&&B<10);if(this.animationFrameSvc?.flushAllFrames(),Q<10&&(H?.stub||!this.beans.rowAutoHeight?.areRowsMeasured())){let E=this.getVScrollPosition().top;this.clearRetryListenerFncs=this.addManagedEventListeners({bodyScroll:()=>{let K=this.getVScrollPosition().top;if(E===K)return;this.clearRetryListeners()},modelUpdated:()=>{if(this.clearRetryListeners(),$>=J.getRowCount())return;this.ensureIndexVisible($,z,Q+1)}})}})}clearRetryListeners(){for(let $ of this.clearRetryListenerFncs)$();this.clearRetryListenerFncs=[]}ensureColumnVisible($,z="auto"){let{colModel:Q,frameworkOverrides:J}=this.beans,Z=Q.getCol($);if(!Z)return;if(Z.isPinned())return;if(!this.visibleCols.isColDisplayed(Z))return;let X=this.getPositionedHorizontalScroll(Z,z);J.wrapIncoming(()=>{if(X!==null)this.centerRowsCtrl.setCenterViewportScrollLeft(X);this.centerRowsCtrl.onHorizontalViewportChanged(),this.animationFrameSvc?.flushAllFrames()})}getPositionedHorizontalScroll($,z){let{columnBeforeStart:Q,columnAfterEnd:J}=this.isColumnOutsideViewport($),Z=this.centerRowsCtrl.getCenterWidth()<$.getActualWidth(),X=this.centerRowsCtrl.getCenterWidth(),Y=this.enableRtl,q=(Y?Q:J)||Z,G=Y?J:Q;if(z!=="auto")q=z==="start",G=z==="end";let _=z==="middle";if(q||G||_){let{colLeft:H,colMiddle:U,colRight:W}=this.getColumnBounds($);if(_)return U-X/2;if(q)return Y?W:H;return Y?H-X:W-X}return null}isColumnOutsideViewport($){let{start:z,end:Q}=this.getViewportBounds(),{colLeft:J,colRight:Z}=this.getColumnBounds($),X=this.enableRtl,Y=X?z>Z:QJ;return{columnBeforeStart:Y,columnAfterEnd:q}}getColumnBounds($){let z=this.enableRtl,Q=this.visibleCols.bodyWidth,J=$.getActualWidth(),Z=$.getLeft(),X=z?-1:1,Y=z?Q-Z:Z,q=Y+J*X,G=Y+J/2*X;return{colLeft:Y,colMiddle:G,colRight:q}}getViewportBounds(){let $=this.centerRowsCtrl.getCenterWidth(),z=this.centerRowsCtrl.getCenterViewportScrollLeft(),Q=z,J=$+z;return{start:Q,end:J,width:$}}},j5={horizontal:{overflow:($)=>$.scrollWidth-$.clientWidth,scrollSize:($)=>$.scrollWidth,clientSize:($)=>$.clientWidth,opposite:"vertical"},vertical:{overflow:($)=>$.scrollHeight-$.clientHeight,scrollSize:($)=>$.scrollHeight,clientSize:($)=>$.clientHeight,opposite:"horizontal"}};function p_($,z,Q=r2()||0,J,Z){return a7($,z,"horizontal",Q,J,Z)}function i_($,z,Q=r2()||0,J,Z){return a7($,z,"vertical",Q,J,Z)}function a7($,z,Q,J,Z,X){let Y=j5[Q],q=j5[Y.opposite],G=Z?A0(Z):!0,_=X?A0(X):!0,H=Y.overflow($);if(H<=0)return!1;if(!z||J===0)return!0;let U=q.overflow(z);if(U<=0)return!0;if(H<=J){if(G&&_&&n_({candidateOverflow:U,candidateScrollSize:q.scrollSize(z),candidateClientSize:q.clientSize(z),scrollbarWidth:J}))return!1;let W=Y.clientSize($)+J;return Y.scrollSize($)<=W}return!0}function n_({candidateOverflow:$,candidateScrollSize:z,candidateClientSize:Q,scrollbarWidth:J}){if($<=0||$>J)return!1;let Z=Q+J;return z>Q&&z<=Z}var d_=class extends S{constructor($){super();this.centerContainerCtrl=$}wireBeans($){this.scrollVisibleSvc=$.scrollVisibleSvc}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCtrl=$.gridBodyCtrl,this.listenForResize()}),this.addManagedEventListeners({scrollbarWidthChanged:this.onScrollbarWidthChanged.bind(this)}),this.addManagedPropertyListeners(["alwaysShowHorizontalScroll","alwaysShowVerticalScroll"],()=>{this.checkViewportAndScrolls()})}listenForResize(){let{beans:$,centerContainerCtrl:z,gridBodyCtrl:Q}=this,J=()=>{Y$($,()=>{this.onCenterViewportResized()})};z.registerViewportResizeListener(J),Q.registerBodyViewportResizeListener(J)}onScrollbarWidthChanged(){this.checkViewportAndScrolls()}onCenterViewportResized(){if(this.scrollVisibleSvc.updateScrollGap(),this.centerContainerCtrl.isViewportInTheDOMTree()){let{pinnedCols:$,colFlex:z}=this.beans;$?.keepPinnedColumnsNarrowerThanViewport(),this.checkViewportAndScrolls();let Q=this.centerContainerCtrl.getCenterWidth();if(Q!==this.centerWidth)this.centerWidth=Q,z?.refreshFlexedColumns({viewportWidth:this.centerWidth,updateBodyWidths:!0,fireResizedEvent:!0})}else this.bodyHeight=0}checkViewportAndScrolls(){this.updateScrollVisibleService(),this.checkBodyHeight(),this.onHorizontalViewportChanged(),this.gridBodyCtrl.scrollFeature.checkScrollLeft()}getBodyHeight(){return this.bodyHeight}checkBodyHeight(){let $=this.gridBodyCtrl.eBodyViewport,z=SJ($);if(this.bodyHeight!==z)this.bodyHeight=z,this.eventSvc.dispatchEvent({type:"bodyHeightChanged"})}updateScrollVisibleService(){this.updateScrollVisibleServiceImpl(),setTimeout(this.updateScrollVisibleServiceImpl.bind(this),500)}updateScrollVisibleServiceImpl(){if(!this.isAlive())return;let $={horizontalScrollShowing:this.centerContainerCtrl.isHorizontalScrollShowing(),verticalScrollShowing:this.gridBodyCtrl.isVerticalScrollShowing()};this.scrollVisibleSvc.setScrollsVisible($)}onHorizontalViewportChanged(){let{centerContainerCtrl:$,beans:z}=this,Q=$.getCenterWidth(),J=$.getViewportScrollLeft();z.colViewport.setScrollPosition(Q,J)}};function o7($){if($.altKey||$.ctrlKey||$.metaKey)return!1;return $.key?.length===1}function s1($,z,Q,J){let Z=z.getColDef().cellRendererParams?.suppressMouseEventHandling;return e7($,z,Q,J,Z)}function t_($,z,Q,J){let Z=z?.suppressMouseEventHandling;return e7($,void 0,Q,J,Z)}function e7($,z,Q,J,Z){if(!Z)return!1;return Z(y($,{column:z,node:Q,event:J}))}function $8($,z,Q){let J=z;while(J){let Z=X7($,J,Q);if(Z)return Z;J=J.parentElement}return null}var _J="cellCtrl";function E1($,z){return $8($,z,_J)}var HJ="renderedRow";function G4($,z){return $8($,z,HJ)}function H2($,z,Q,J,Z){let X=J?J.getColDef().suppressKeyboardEvent:void 0;if(!X)return!1;let Y=y($,{event:z,editing:Z,column:J,node:Q,data:Q.data,colDef:J.getColDef()});if(X){if(X(Y))return!0}return!1}function s_($){let{pinnedRowModel:z,rowModel:Q,rangeSvc:J,visibleCols:Z}=$;if(!J||Z.allCols.length===0)return;let X=z?.isEmpty("top")??!0,Y=z?.isEmpty("bottom")??!0,q=X?null:"top",G,_;if(Y)G=null,_=Q.getRowCount()-1;else G="bottom",_=z?.getPinnedBottomRowCount()??-1;J.setCellRange({rowStartIndex:0,rowStartPinned:q,rowEndIndex:_,rowEndPinned:G})}var r_=class extends S{constructor($){super();this.element=$}postConstruct(){this.addKeyboardListeners(),this.addMouseListeners(),this.beans.touchSvc?.mockRowContextMenu(this),this.editSvc=this.beans.editSvc}addKeyboardListeners(){let z=this.processKeyboardEvent.bind(this,"keydown");this.addManagedElementListeners(this.element,{["keydown"]:z})}addMouseListeners(){let $="mousedown";if(aZ("pointerdown"))$="pointerdown";else if(aZ("touchstart"))$="touchstart";let z=["dblclick","contextmenu","mouseover","mouseout","click",$];for(let Q of z){let J=this.processMouseEvent.bind(this,Q);this.addManagedElementListeners(this.element,{[Q]:J})}}processMouseEvent($,z){if(!nQ(this.beans,z)||z$(z))return;let{cellCtrl:Q,rowCtrl:J}=this.getControlsForEventTarget(z.target);if($==="contextmenu"){if(Q?.column)Q.dispatchCellContextMenuEvent(z);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(z,void 0,J,Q)}else{if(Q)Q.onMouseEvent($,z);if(J)J.onMouseEvent($,z)}}getControlsForEventTarget($){let{gos:z}=this;return{cellCtrl:E1(z,$),rowCtrl:G4(z,$)}}processKeyboardEvent($,z){let{cellCtrl:Q,rowCtrl:J}=this.getControlsForEventTarget(z.target);if(z.defaultPrevented)return;if(Q)this.processCellKeyboardEvent(Q,$,z);else if(J?.isFullWidth())this.processFullWidthRowKeyboardEvent(J,$,z)}processCellKeyboardEvent($,z,Q){let J=this.editSvc?.isEditing($,{withOpenEditor:!0})??!1;if(!H2(this.gos,Q,$.rowNode,$.column,J)){if(z==="keydown"){if(!(!J&&this.beans.navigation?.handlePageScrollingKey(Q)))$.onKeyDown(Q);if(this.doGridOperations(Q,J),o7(Q))$.processCharacter(Q)}}if(z==="keydown")this.eventSvc.dispatchEvent($.createEvent(Q,"cellKeyDown"))}processFullWidthRowKeyboardEvent($,z,Q){let{rowNode:J}=$,{focusSvc:Z,navigation:X}=this.beans,q=Z.getFocusedCell()?.column;if(!H2(this.gos,Q,J,q,!1)){let _=Q.key;if(z==="keydown")switch(_){case A.PAGE_HOME:case A.PAGE_END:case A.PAGE_UP:case A.PAGE_DOWN:X?.handlePageScrollingKey(Q,!0);break;case A.LEFT:case A.RIGHT:if(!this.gos.get("embedFullWidthRows"))break;case A.UP:case A.DOWN:$.onKeyboardNavigate(Q);break;case A.TAB:$.onTabKeyDown(Q);break;default:}}if(z==="keydown")this.eventSvc.dispatchEvent($.createRowEvent("cellKeyDown",Q))}doGridOperations($,z){if(!$.ctrlKey&&!$.metaKey)return;if(z)return;if(!nQ(this.beans,$))return;let Q=R7($),{clipboardSvc:J,undoRedo:Z}=this.beans;if(Q===A.A)return this.onCtrlAndA($);if(Q===A.C)return this.onCtrlAndC(J,$);if(Q===A.D)return this.onCtrlAndD(J,$);if(Q===A.V)return this.onCtrlAndV(J,$);if(Q===A.X)return this.onCtrlAndX(J,$);if(Q===A.Y)return this.onCtrlAndY(Z);if(Q===A.Z)return this.onCtrlAndZ(Z,$)}onCtrlAndA($){let{beans:{rowModel:z,rangeSvc:Q,selectionSvc:J},gos:Z}=this;if(Q&&u0(Z)&&!mq(Z)&&z.isRowsToRender())s_(this.beans);else if(J)J.selectAllRowNodes({source:"keyboardSelectAll",selectAll:H7(Z)});$.preventDefault()}onCtrlAndC($,z){if(!$||this.gos.get("enableCellTextSelection"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;z.preventDefault(),$.copyToClipboard()}onCtrlAndX($,z){if(!$||this.gos.get("enableCellTextSelection")||this.gos.get("suppressCutToClipboard"))return;let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;z.preventDefault(),$.cutToClipboard(void 0,"ui")}onCtrlAndV($,z){let{cellCtrl:Q}=this.getControlsForEventTarget(z.target);if(this.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if($&&!this.gos.get("suppressClipboardPaste"))$.pasteFromClipboard()}onCtrlAndD($,z){if($&&!this.gos.get("suppressClipboardPaste"))$.copyRangeDown();z.preventDefault()}onCtrlAndZ($,z){if(!this.gos.get("undoRedoCellEditing")||!$)return;if(z.preventDefault(),z.shiftKey)$.redo("ui");else $.undo("ui")}onCtrlAndY($){$?.redo("ui")}},x1=($)=>$.topRowCtrls,w1=($)=>$.getStickyTopRowCtrls(),N1=($)=>$.getStickyBottomRowCtrls(),g1=($)=>$.bottomRowCtrls,h1=($)=>$.allRowCtrls,xZ=($)=>$.getCtrls("top"),wZ=($)=>$.getCtrls("center"),NZ=($)=>$.getCtrls("bottom"),l_={center:{type:"center",name:"center-cols",getRowCtrls:h1,getSpannedRowCtrls:wZ},left:{type:"left",name:"pinned-left-cols",pinnedType:"left",getRowCtrls:h1,getSpannedRowCtrls:wZ},right:{type:"right",name:"pinned-right-cols",pinnedType:"right",getRowCtrls:h1,getSpannedRowCtrls:wZ},fullWidth:{type:"fullWidth",name:"full-width",fullWidth:!0,getRowCtrls:h1},topCenter:{type:"center",name:"floating-top",getRowCtrls:x1,getSpannedRowCtrls:xZ},topLeft:{type:"left",name:"pinned-left-floating",container:"ag-pinned-left-floating-top",pinnedType:"left",getRowCtrls:x1,getSpannedRowCtrls:xZ},topRight:{type:"right",name:"pinned-right-floating",container:"ag-pinned-right-floating-top",pinnedType:"right",getRowCtrls:x1,getSpannedRowCtrls:xZ},topFullWidth:{type:"fullWidth",name:"floating-top-full-width",fullWidth:!0,getRowCtrls:x1},stickyTopCenter:{type:"center",name:"sticky-top",getRowCtrls:w1},stickyTopLeft:{type:"left",name:"pinned-left-sticky-top",container:"ag-pinned-left-sticky-top",pinnedType:"left",getRowCtrls:w1},stickyTopRight:{type:"right",name:"pinned-right-sticky-top",container:"ag-pinned-right-sticky-top",pinnedType:"right",getRowCtrls:w1},stickyTopFullWidth:{type:"fullWidth",name:"sticky-top-full-width",fullWidth:!0,getRowCtrls:w1},stickyBottomCenter:{type:"center",name:"sticky-bottom",getRowCtrls:N1},stickyBottomLeft:{type:"left",name:"pinned-left-sticky-bottom",container:"ag-pinned-left-sticky-bottom",pinnedType:"left",getRowCtrls:N1},stickyBottomRight:{type:"right",name:"pinned-right-sticky-bottom",container:"ag-pinned-right-sticky-bottom",pinnedType:"right",getRowCtrls:N1},stickyBottomFullWidth:{type:"fullWidth",name:"sticky-bottom-full-width",fullWidth:!0,getRowCtrls:N1},bottomCenter:{type:"center",name:"floating-bottom",getRowCtrls:g1,getSpannedRowCtrls:NZ},bottomLeft:{type:"left",name:"pinned-left-floating-bottom",container:"ag-pinned-left-floating-bottom",pinnedType:"left",getRowCtrls:g1,getSpannedRowCtrls:NZ},bottomRight:{type:"right",name:"pinned-right-floating-bottom",container:"ag-pinned-right-floating-bottom",pinnedType:"right",getRowCtrls:g1,getSpannedRowCtrls:NZ},bottomFullWidth:{type:"fullWidth",name:"floating-bottom-full-width",fullWidth:!0,getRowCtrls:g1}};function z8($){return`ag-${K1($).name}-viewport`}function Q8($){let z=K1($);return z.container??`ag-${z.name}-container`}function a_($){return`ag-${K1($).name}-spanned-cells-container`}function K1($){return l_[$]}var o_=["topCenter","topLeft","topRight"],e_=["bottomCenter","bottomLeft","bottomRight"],$H=["center","left","right"],zH=["center","left","right","fullWidth"],QH=["stickyTopCenter","stickyBottomCenter","center","topCenter","bottomCenter"],JH=["left","bottomLeft","topLeft","stickyTopLeft","stickyBottomLeft"],ZH=["right","bottomRight","topRight","stickyTopRight","stickyBottomRight"],J8=["stickyTopCenter","stickyTopLeft","stickyTopRight"],Z8=["stickyBottomCenter","stickyBottomLeft","stickyBottomRight"],XH=[...J8,"stickyTopFullWidth",...Z8,"stickyBottomFullWidth"],YH=[...o_,...e_,...$H,...J8,...Z8],qH=class extends S{constructor($){super();this.name=$,this.visible=!0,this.EMPTY_CTRLS=[],this.options=K1($)}postConstruct(){this.enableRtl=this.gos.get("enableRtl"),this.forContainers(["center"],()=>{this.viewportSizeFeature=this.createManagedBean(new d_(this)),this.addManagedEventListeners({stickyTopOffsetChanged:this.onStickyTopOffsetChanged.bind(this)})})}onStickyTopOffsetChanged($){this.comp.setOffsetTop(`${$.offset}px`)}registerWithCtrlsService(){if(this.options.fullWidth)return;this.beans.ctrlsSvc.register(this.name,this)}forContainers($,z){if($.indexOf(this.name)>=0)z()}setComp($,z,Q,J){this.comp=$,this.eContainer=z,this.eSpannedContainer=Q,this.eViewport=J,this.createManagedBean(new r_(this.eViewport??this.eContainer)),this.addPreventScrollWhileDragging(),this.listenOnDomOrder();let{pinnedCols:Z,rangeSvc:X}=this.beans,Y=()=>this.onPinnedWidthChanged();if(this.forContainers(JH,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean(Z?.createPinnedWidthFeature(!0,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({leftPinnedWidthChanged:Y})}),this.forContainers(ZH,()=>{this.pinnedWidthFeature=this.createOptionalManagedBean(Z?.createPinnedWidthFeature(!1,this.eContainer,this.eSpannedContainer)),this.addManagedEventListeners({rightPinnedWidthChanged:Y})}),this.forContainers(zH,()=>this.createManagedBean(new l7(this.eContainer,this.name==="center"?J:void 0))),X)this.forContainers(YH,()=>this.createManagedBean(X.createDragListenerFeature(this.eContainer)));this.forContainers(QH,()=>this.createManagedBean(new Z4((q)=>this.comp.setContainerWidth(`${q}px`)))),this.visible=this.isContainerVisible(),this.addListeners(),this.registerWithCtrlsService()}onScrollCallback($){this.addManagedElementListeners(this.eViewport,{scroll:$})}addListeners(){let{spannedRowRenderer:$,gos:z}=this.beans,Q=this.onDisplayedColumnsChanged.bind(this);if(this.addManagedEventListeners({displayedColumnsChanged:Q,displayedColumnsWidthChanged:Q,displayedRowsChanged:(J)=>this.onDisplayedRowsChanged(J.afterScroll)}),Q(),this.onDisplayedRowsChanged(),$&&this.options.getSpannedRowCtrls&&z.get("enableCellSpan"))this.addManagedListeners($,{spannedRowsUpdated:()=>{let J=this.options.getSpannedRowCtrls($);if(!J)return;this.comp.setSpannedRowCtrls(J,!1)}})}listenOnDomOrder(){if(XH.indexOf(this.name)>=0){this.comp.setDomOrder(!0);return}let z=()=>{let Q=this.gos.get("ensureDomOrder"),J=V0(this.gos,"print");this.comp.setDomOrder(Q||J)};this.addManagedPropertyListener("domLayout",z),z()}onDisplayedColumnsChanged(){this.forContainers(["center"],()=>this.onHorizontalViewportChanged())}addPreventScrollWhileDragging(){let{dragSvc:$}=this.beans;if(!$)return;let z=(Q)=>{if($.dragging){if(Q.cancelable)Q.preventDefault()}};this.eContainer.addEventListener("touchmove",z,{passive:!1}),this.addDestroyFunc(()=>this.eContainer.removeEventListener("touchmove",z))}onHorizontalViewportChanged($=!1){let z=this.getCenterWidth(),Q=this.getCenterViewportScrollLeft();this.beans.colViewport.setScrollPosition(z,Q,$)}hasHorizontalScrollGap(){return this.eContainer.clientWidth-this.eViewport.clientWidth<0}hasVerticalScrollGap(){return this.eContainer.clientHeight-this.eViewport.clientHeight<0}getCenterWidth(){return xz(this.eViewport)}getCenterViewportScrollLeft(){return $J(this.eViewport,this.enableRtl)}registerViewportResizeListener($){let z=F$(this.beans,this.eViewport,$);this.addDestroyFunc(()=>z())}isViewportInTheDOMTree(){return N6(this.eViewport)}getViewportScrollLeft(){return $J(this.eViewport,this.enableRtl)}isHorizontalScrollShowing(){let{beans:$,gos:z,eViewport:Q}=this,J=z.get("alwaysShowHorizontalScroll"),{ctrlsSvc:Z}=$,X=Z.getGridBodyCtrl()?.eBodyViewport,Y=Z.get("fakeHScrollComp")?.getGui(),q=Z.get("fakeVScrollComp")?.getGui();return J||p_(Q,X,void 0,Y,q)}setHorizontalScroll($){this.comp.setHorizontalScroll($)}getHScrollPosition(){return{left:this.eViewport.scrollLeft,right:this.eViewport.scrollLeft+this.eViewport.offsetWidth}}setCenterViewportScrollLeft($){zJ(this.eViewport,$,this.enableRtl)}isContainerVisible(){return this.options.pinnedType==null||!!this.pinnedWidthFeature&&this.pinnedWidthFeature.getWidth()>0}onPinnedWidthChanged(){let $=this.isContainerVisible();if(this.visible!=$)this.visible=$,this.onDisplayedRowsChanged()}onDisplayedRowsChanged($=!1){let z=this.options.getRowCtrls(this.beans.rowRenderer);if(!this.visible||z.length===0){this.comp.setRowCtrls({rowCtrls:this.EMPTY_CTRLS});return}let Q=V0(this.gos,"print"),Z=this.gos.get("embedFullWidthRows")||Q,X=z.filter((Y)=>{let q=Y.isFullWidth();return this.options.fullWidth?!Z&&q:Z||!q});this.comp.setRowCtrls({rowCtrls:X,useFlushSync:$})}},X8="ag-force-vertical-scroll",GH="ag-selectable",_H="ag-column-moving",HH=class extends S{constructor(){super(...arguments);this.stickyTopHeight=0,this.stickyBottomHeight=0}wireBeans($){this.ctrlsSvc=$.ctrlsSvc,this.colModel=$.colModel,this.scrollVisibleSvc=$.scrollVisibleSvc,this.pinnedRowModel=$.pinnedRowModel,this.filterManager=$.filterManager,this.rowGroupColsSvc=$.rowGroupColsSvc}setComp($,z,Q,J,Z,X,Y){this.comp=$,this.eGridBody=z,this.eBodyViewport=Q,this.eTop=J,this.eBottom=Z,this.eStickyTop=X,this.eStickyBottom=Y,this.eCenterColsViewport=Q.querySelector(`.${z8("center")}`),this.eFullWidthContainer=Q.querySelector(`.${Q8("fullWidth")}`),this.setCellTextSelection(this.gos.get("enableCellTextSelection")),this.addManagedPropertyListener("enableCellTextSelection",(q)=>this.setCellTextSelection(q.currentValue)),this.createManagedBean(new q4(this.comp)),this.scrollFeature=this.createManagedBean(new c_(Q)),this.beans.rowDragSvc?.setupRowDrag(Q,this),this.setupRowAnimationCssClass(),this.addEventListeners(),this.addFocusListeners([J,Q,Z,X,Y]),this.setGridRootRole(),this.onGridColumnsChanged(),this.addBodyViewportListener(),this.setFloatingHeights(),this.disableBrowserDragging(),this.addStopEditingWhenGridLosesFocus(),this.updateScrollingClasses(),this.filterManager?.setupAdvFilterHeaderComp(J),this.ctrlsSvc.register("gridBodyCtrl",this)}addEventListeners(){let $=this.setFloatingHeights.bind(this),z=this.setGridRootRole.bind(this),Q=this.toggleRowResizeStyles.bind(this);this.addManagedEventListeners({gridColumnsChanged:this.onGridColumnsChanged.bind(this),scrollVisibilityChanged:this.onScrollVisibilityChanged.bind(this),scrollGapChanged:this.updateScrollingClasses.bind(this),pinnedRowDataChanged:$,pinnedHeightChanged:$,pinnedRowsChanged:$,headerHeightChanged:this.setStickyTopOffsetTop.bind(this),columnRowGroupChanged:z,columnPivotChanged:z,rowResizeStarted:Q,rowResizeEnded:Q}),this.addManagedPropertyListener("treeData",z)}toggleRowResizeStyles($){let z=$.type==="rowResizeStarted";this.eBodyViewport.classList.toggle("ag-prevent-animation",z)}onGridColumnsChanged(){let $=this.beans.colModel.getCols();this.comp.setColumnCount($.length)}onScrollVisibilityChanged(){let{scrollVisibleSvc:$}=this,z=$.verticalScrollShowing;this.setVerticalScrollPaddingVisible(z),this.setStickyWidth(z),this.setStickyBottomOffsetBottom();let Q=z?$.getScrollbarWidth()||0:0,J=b7()?16:0,Z=`calc(100% + ${Q+J}px)`;Y$(this.beans,()=>this.comp.setBodyViewportWidth(Z)),this.updateScrollingClasses()}setGridRootRole(){let{rowGroupColsSvc:$,colModel:z,gos:Q}=this,J=Q.get("treeData");if(!J){let Z=z.isPivotMode();J=(!$?0:$.columns.length)>=(Z?2:1)}this.comp.setGridRootRole(J?"treegrid":"grid")}addFocusListeners($){for(let z of $)this.addManagedElementListeners(z,{focusin:(Q)=>{let{target:J}=Q,Z=vz(J,"ag-root",z);z.classList.toggle("ag-has-focus",!Z)},focusout:(Q)=>{let{target:J,relatedTarget:Z}=Q,X=z.contains(Z),Y=vz(Z,"ag-root",z);if(vz(J,"ag-root",z))return;if(!X||Y)z.classList.remove("ag-has-focus")}})}setColumnMovingCss($){this.comp.setColumnMovingCss(_H,$)}setCellTextSelection($=!1){this.comp.setCellSelectableCss(GH,$)}updateScrollingClasses(){let{eGridBody:{classList:$},scrollVisibleSvc:z}=this;$.toggle("ag-body-vertical-content-no-gap",!z.verticalScrollGap),$.toggle("ag-body-horizontal-content-no-gap",!z.horizontalScrollGap)}disableBrowserDragging(){this.addManagedElementListeners(this.eGridBody,{dragstart:($)=>{if($.target instanceof HTMLImageElement)return $.preventDefault(),!1}})}addStopEditingWhenGridLosesFocus(){this.beans.editSvc?.addStopEditingWhenGridLosesFocus([this.eBodyViewport,this.eBottom,this.eTop,this.eStickyTop,this.eStickyBottom])}updateRowCount(){let $=(this.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.filterManager?.getHeaderRowCount()??0),{rowModel:z}=this.beans,Q=z.isLastRowIndexKnown()?z.getRowCount():-1,J=Q===-1?-1:$+Q;this.comp.setRowCount(J)}registerBodyViewportResizeListener($){this.comp.registerBodyViewportResizeListener($)}setVerticalScrollPaddingVisible($){let z=$?"scroll":"hidden";this.comp.setPinnedTopBottomOverflowY(z)}isVerticalScrollShowing(){let{gos:$,comp:z,ctrlsSvc:Q}=this,J=$.get("alwaysShowVerticalScroll"),Z=J?X8:null,X=V0($,"normal");z.setAlwaysVerticalScrollClass(Z,J);let Y=Q.get("center")?.eViewport,q=Q.get("fakeHScrollComp")?.getGui(),G=Q.get("fakeVScrollComp")?.getGui();return J||X&&i_(this.eBodyViewport,Y,void 0,G,q)}setupRowAnimationCssClass(){let{rowContainerHeight:$,environment:z}=this.beans,Q=z.sizesMeasured,J=()=>{let Z=Q&&HQ(this.gos)&&!$.stretching,X=Z?"ag-row-animation":"ag-row-no-animation";this.comp.setRowAnimationCssOnBodyViewport(X,Z)};J(),this.addManagedEventListeners({heightScaleChanged:J}),this.addManagedPropertyListener("animateRows",J),this.addManagedEventListeners({stylesChanged:()=>{if(!Q&&z.sizesMeasured)Q=!0,J()}})}addBodyViewportListener(){let{eBodyViewport:$,eStickyTop:z,eStickyBottom:Q,eTop:J,eBottom:Z,beans:{popupSvc:X,touchSvc:Y}}=this,q=this.onBodyViewportContextMenu.bind(this);this.addManagedElementListeners($,{contextmenu:q}),Y?.mockBodyContextMenu(this,q),this.addManagedElementListeners($,{wheel:this.onBodyViewportWheel.bind(this,X)});let G=this.onStickyWheel.bind(this);for(let H of[z,Q,J,Z])this.addManagedElementListeners(H,{wheel:G});let _=this.onHorizontalWheel.bind(this);for(let H of["left","right","topLeft","topRight","bottomLeft","bottomRight"])this.addManagedElementListeners(this.ctrlsSvc.get(H).eContainer,{wheel:_});this.addFullWidthContainerWheelListener()}addFullWidthContainerWheelListener(){this.addManagedElementListeners(this.eFullWidthContainer,{wheel:($)=>this.onFullWidthContainerWheel($)})}onFullWidthContainerWheel($){let{deltaX:z,deltaY:Q,shiftKey:J}=$;if((J||Math.abs(z)>Math.abs(Q))&&nQ(this.beans,$))this.scrollGridBodyToMatchEvent($)}onStickyWheel($){let{deltaY:z}=$;if(this.scrollVertically(z)>0)$.preventDefault()}onHorizontalWheel($){let{deltaX:z,deltaY:Q,shiftKey:J}=$;if(!(J||Math.abs(z)>Math.abs(Q)))return;this.scrollGridBodyToMatchEvent($)}scrollGridBodyToMatchEvent($){let{deltaX:z,deltaY:Q}=$;$.preventDefault(),this.eCenterColsViewport.scrollBy({left:z||Q})}onBodyViewportContextMenu($,z,Q){if(!$&&!Q)return;if(this.gos.get("preventDefaultOnContextMenu"))($||Q).preventDefault();let{target:J}=$||z;if(J===this.eBodyViewport||J===this.ctrlsSvc.get("center").eViewport)this.beans.contextMenuSvc?.showContextMenu({mouseEvent:$,touchEvent:Q,value:null,anchorToElement:this.eGridBody,source:"ui"})}onBodyViewportWheel($,z){if(!this.gos.get("suppressScrollWhenPopupsAreOpen"))return;if($?.hasAnchoredPopup())z.preventDefault()}scrollVertically($){let z=this.eBodyViewport.scrollTop;return this.scrollFeature.setVerticalScrollPosition(z+$),this.eBodyViewport.scrollTop-z}setFloatingHeights(){let{pinnedRowModel:$,beans:{environment:z}}=this,Q=$?.getPinnedTopTotalHeight(),J=$?.getPinnedBottomTotalHeight(),Z=z.getPinnedRowBorderWidth(),X=z.getRowBorderWidth(),Y=Z-X,q=!Q?0:Y+Q,G=!J?0:Y+J;this.comp.setTopHeight(q),this.comp.setBottomHeight(G),this.comp.setTopInvisible(q<=0),this.comp.setBottomInvisible(G<=0),this.setStickyTopOffsetTop(),this.setStickyBottomOffsetBottom()}setStickyTopHeight($=0){this.comp.setStickyTopHeight(`${$}px`),this.stickyTopHeight=$}setStickyBottomHeight($=0){this.comp.setStickyBottomHeight(`${$}px`),this.stickyBottomHeight=$}setStickyWidth($){if(!$)this.comp.setStickyTopWidth("100%"),this.comp.setStickyBottomWidth("100%");else{let z=this.scrollVisibleSvc.getScrollbarWidth();this.comp.setStickyTopWidth(`calc(100% - ${z}px)`),this.comp.setStickyBottomWidth(`calc(100% - ${z}px)`)}}setStickyTopOffsetTop(){let z=this.ctrlsSvc.get("gridHeaderCtrl").headerHeight+(this.filterManager?.getHeaderHeight()??0),Q=this.pinnedRowModel?.getPinnedTopTotalHeight()??0,J=0;if(z>0)J+=z;if(Q>0)J+=Q;if(J>0)J+=1;this.comp.setStickyTopTop(`${J}px`)}setStickyBottomOffsetBottom(){let{pinnedRowModel:$,scrollVisibleSvc:z,comp:Q}=this,J=$?.getPinnedBottomTotalHeight()??0,X=z.horizontalScrollShowing?z.getScrollbarWidth()||0:0,Y=J+X;Q.setStickyBottomBottom(`${Y}px`)}};function J0($){return K0($)}var UH=class extends x{constructor($,z,Q,J,Z){super();this.cellCtrl=z,this.rowResizerElement=null,this.rendererVersion=0,this.editorVersion=0,this.beans=$,this.gos=$.gos,this.column=z.column,this.rowNode=z.rowNode,this.eRow=J;let X=J0({tag:"div",role:z.getCellAriaRole(),attrs:{"comp-id":`${this.getCompId()}`,"col-id":z.column.colIdSanitised}});this.eCell=X;let Y;if(z.isCellSpanning())Y=J0({tag:"div",cls:"ag-spanned-cell-wrapper",role:"presentation"}),Y.appendChild(X),this.setTemplateFromElement(Y);else this.setTemplateFromElement(X);this.cellCssManager=new v7(()=>X),this.forceWrapper=z.isForceWrapper(),this.refreshWrapper(!1);let q={toggleCss:(G,_)=>this.cellCssManager.toggleCss(G,_),setUserStyles:(G)=>Z1(X,G),getFocusableElement:()=>X,setIncludeSelection:(G)=>this.includeSelection=G,setIncludeRowDrag:(G)=>this.includeRowDrag=G,setIncludeDndSource:(G)=>this.includeDndSource=G,setRowResizerElement:(G)=>this.setRowResizerElement(G),setRenderDetails:(G,_,H)=>this.setRenderDetails(G,_,H),setEditDetails:(G,_,H)=>this.setEditDetails(G,_,H),getCellEditor:()=>this.cellEditor||null,getCellRenderer:()=>this.cellRenderer||null,getParentOfValue:()=>this.getParentOfValue(),refreshEditStyles:(G,_)=>this.refreshEditStyles(G,_)};z.setComp(q,X,Y,this.eCellWrapper,Q,Z,void 0)}getParentOfValue(){return this.eCellValue??this.eCellWrapper??this.eCell}setRowResizerElement($){if(this.rowResizerElement)T0(this.rowResizerElement);if(this.rowResizerElement=$,$)this.eCell.appendChild($)}setRenderDetails($,z,Q){if(this.cellEditor&&!this.cellEditorPopupWrapper)return;this.firstRender=this.firstRender==null;let Z=this.refreshWrapper(!1);if(this.refreshEditStyles(!1),$){if(!(Q||Z?!1:this.refreshCellRenderer($)))this.destroyRenderer(),this.createCellRendererInstance($)}else this.destroyRenderer(),this.insertValueWithoutCellRenderer(z);if(this.rowDraggingComp?.refreshVisibility(),this.rowResizerElement&&!this.rowResizerElement.parentElement)this.eCell.appendChild(this.rowResizerElement)}setEditDetails($,z,Q){if($)this.createCellEditorInstance($,z,Q);else this.destroyEditor()}removeControls(){let $=this.beans.context;this.checkboxSelectionComp=$.destroyBean(this.checkboxSelectionComp),this.dndSourceComp=$.destroyBean(this.dndSourceComp),this.rowDraggingComp=$.destroyBean(this.rowDraggingComp)}refreshWrapper($){let z=this.includeRowDrag||this.includeDndSource||this.includeSelection,Q=z||this.forceWrapper,J=Q&&this.eCellWrapper==null;if(J)this.eCellWrapper=J0({tag:"div",cls:"ag-cell-wrapper",role:"presentation"}),this.eCell.appendChild(this.eCellWrapper);let Z=!Q&&this.eCellWrapper!=null;if(Z)T0(this.eCellWrapper),this.eCellWrapper=void 0;this.cellCssManager.toggleCss("ag-cell-value",!Q);let X=!$&&Q,Y=X&&this.eCellValue==null;if(Y){let _=this.cellCtrl.getCellValueClass();this.eCellValue=J0({tag:"span",cls:_,role:"presentation"}),this.eCellWrapper.appendChild(this.eCellValue)}let q=!X&&this.eCellValue!=null;if(q)T0(this.eCellValue),this.eCellValue=void 0;let G=J||Z||Y||q;if(G)this.removeControls();if(!$&&z)this.addControls();return G}addControls(){let{cellCtrl:$,eCellWrapper:z,eCellValue:Q,includeRowDrag:J,includeDndSource:Z,includeSelection:X}=this,Y=(q)=>{if(q)z.insertBefore(q.getGui(),Q)};if(J&&this.rowDraggingComp==null)this.rowDraggingComp=$.createRowDragComp(),Y(this.rowDraggingComp);if(Z&&this.dndSourceComp==null)this.dndSourceComp=$.createDndSource(),Y(this.dndSourceComp);if(X&&this.checkboxSelectionComp==null)this.checkboxSelectionComp=$.createSelectionCheckbox(),Y(this.checkboxSelectionComp)}createCellEditorInstance($,z,Q){let J=this.editorVersion,Z=$.newAgStackInstance(),{params:X}=$;if(Z.then((q)=>this.afterCellEditorCreated(J,q,X,z,Q)),n(this.cellEditor)&&X.cellStartedEdit)this.cellCtrl.focusCell(!0)}insertValueWithoutCellRenderer($){let z=this.getParentOfValue();z0(z);let Q=J1($);if(Q!=null)z.textContent=Q}destroyRenderer(){let{context:$}=this.beans;this.cellRenderer=$.destroyBean(this.cellRenderer),T0(this.cellRendererGui),this.cellRendererGui=null,this.rendererVersion++}destroyEditor(){let{context:$}=this.beans;if(this.cellEditorPopupWrapper?.getGui().contains(d(this.beans))||this.cellCtrl.hasBrowserFocus())this.eCell.focus({preventScroll:!0});this.hideEditorPopup?.(),this.hideEditorPopup=void 0,this.cellEditor=$.destroyBean(this.cellEditor),this.cellEditorPopupWrapper=$.destroyBean(this.cellEditorPopupWrapper),T0(this.cellEditorGui),this.cellCtrl.disableEditorTooltipFeature(),this.cellEditorGui=null,this.editorVersion++}refreshCellRenderer($){if(this.cellRenderer?.refresh==null)return!1;if(this.cellRendererClass!==$.componentClass)return!1;let z=this.cellRenderer.refresh($.params);return z===!0||z===void 0}createCellRendererInstance($){let z=this.rendererVersion,Q=(X)=>(Y)=>{if(this.rendererVersion!==z||!this.isAlive())return;let G=X.newAgStackInstance(),_=this.afterCellRendererCreated.bind(this,z,X.componentClass);G?.then(_)},{animationFrameSvc:J}=this.beans,Z;if(J?.active&&this.firstRender)Z=(X,Y=!1)=>{J.createTask(Q(X),this.rowNode.rowIndex,"p2",X.componentFromFramework,Y)};else Z=(X)=>Q(X)();if($.params?.deferRender&&!this.cellCtrl.rowNode.group){let{loadingComp:X,onReady:Y}=this.cellCtrl.getDeferLoadingCellRenderer();if(X)Z(X),Y.then(()=>Z($,!0))}else Z($)}afterCellRendererCreated($,z,Q){if(!this.isAlive()||$!==this.rendererVersion){this.beans.context.destroyBean(Q);return}this.cellRenderer=Q,this.cellRendererClass=z;let Z=Q.getGui();if(this.cellRendererGui=Z,Z!=null){let X=this.getParentOfValue();z0(X),X.appendChild(Z)}}afterCellEditorCreated($,z,Q,J,Z){let X=$!==this.editorVersion,{context:Y}=this.beans;if(X){Y.destroyBean(z);return}if(z.isCancelBeforeStart?.()){Y.destroyBean(z),this.cellCtrl.stopEditing(!0);return}if(!z.getGui){j(97,{colId:this.column.getId()}),Y.destroyBean(z);return}this.cellEditor=z,this.cellEditorGui=z.getGui();let G=J||z.isPopup?.();if(G)this.addPopupCellEditor(Q,Z);else this.addInCellEditor();this.refreshEditStyles(!0,G),z.afterGuiAttached?.(),this.cellCtrl.enableEditorTooltipFeature(z),this.cellCtrl.cellEditorAttached()}refreshEditStyles($,z){let{cellCssManager:Q}=this;Q.toggleCss("ag-cell-inline-editing",$&&!z),Q.toggleCss("ag-cell-popup-editing",$&&!!z),Q.toggleCss("ag-cell-not-inline-editing",!$||!!z)}addInCellEditor(){let{eCell:$}=this;if($.contains(d(this.beans)))$.focus();if(this.destroyRenderer(),this.refreshWrapper(!0),z0(this.getParentOfValue()),this.cellEditorGui)this.getParentOfValue().appendChild(this.cellEditorGui)}addPopupCellEditor($,z){let{gos:Q,context:J,popupSvc:Z,editSvc:X}=this.beans;if(Q.get("editType")==="fullRow")j(98);let Y=this.cellEditorPopupWrapper=J.createBean(X.createPopupEditorWrapper($)),{cellEditor:q,cellEditorGui:G,eCell:_,rowNode:H,column:U,cellCtrl:W}=this,B=Y.getGui();if(G)B.appendChild(G);let E=Q.get("stopEditingWhenCellsLoseFocus"),K=z!=null?z:q.getPopupPosition?.()??"over",L=Q.get("enableRtl"),D={ePopup:B,additionalParams:{column:U,rowNode:H},type:"popupCellEditor",eventSource:_,position:K,alignSide:L?"right":"left",keepWithinBounds:!0},F=Z.positionPopupByComponent.bind(Z,D),M=Z.addPopup({modal:E,eChild:B,closeOnEsc:!0,closedCallback:(k)=>{W.onPopupEditorClosed(k)},anchorToElement:_,positionCallback:F,ariaOwns:_});if(M)this.hideEditorPopup=M.hideFunc}detach(){this.getGui().remove()}destroy(){this.destroyRenderer(),this.destroyEditor(),this.removeControls(),super.destroy()}},WH=class extends x{constructor($,z,Q){super();this.cellComps=new Map,this.beans=z,this.rowCtrl=$;let J=J0({tag:"div",role:"row",attrs:{"comp-id":`${this.getCompId()}`}});this.setInitialStyle(J,Q),this.setTemplateFromElement(J);let Z=J.style;this.domOrder=this.rowCtrl.getDomOrder();let X={setDomOrder:(Y)=>this.domOrder=Y,setCellCtrls:(Y)=>this.setCellCtrls(Y),showFullWidth:(Y)=>this.showFullWidth(Y),getFullWidthCellRenderer:()=>this.fullWidthCellRenderer,getFullWidthCellRendererParams:()=>this.fullWidthCellRendererParams,toggleCss:(Y,q)=>this.toggleCss(Y,q),setUserStyles:(Y)=>Z1(J,Y),setTop:(Y)=>Z.top=Y,setTransform:(Y)=>Z.transform=Y,setRowIndex:(Y)=>J.setAttribute("row-index",Y),setRowId:(Y)=>J.setAttribute("row-id",Y),setRowBusinessKey:(Y)=>J.setAttribute("row-business-key",Y),refreshFullWidth:(Y)=>{let q=Y();return this.fullWidthCellRendererParams=q,this.fullWidthCellRenderer?.refresh?.(q)??!1}};$.setComp(X,this.getGui(),Q,void 0),this.addDestroyFunc(()=>{$.unsetComp(Q)})}setInitialStyle($,z){let Q=this.rowCtrl.getInitialTransform(z);if(Q)$.style.setProperty("transform",Q);else{let J=this.rowCtrl.getInitialRowTop(z);if(J)$.style.setProperty("top",J)}}showFullWidth($){let z=(J)=>{if(this.isAlive()){let Z=J.getGui();this.getGui().appendChild(Z),this.rowCtrl.setupDetailRowAutoHeight(Z),this.setFullWidthRowComp(J,$.params)}else this.beans.context.destroyBean(J)};$.newAgStackInstance().then(z)}setCellCtrls($){let z=new Map(this.cellComps);for(let Q of $){let J=Q.instanceId;if(!this.cellComps.has(J))this.newCellComp(Q);else z.delete(J)}this.destroyCells(z),this.ensureDomOrder($)}ensureDomOrder($){if(!this.domOrder)return;let z=[];for(let Q of $){let J=this.cellComps.get(Q.instanceId);if(J)z.push(J.getGui())}h6(this.getGui(),z)}newCellComp($){let z=this.beans.editSvc?.isEditing($,{withOpenEditor:!0})??!1,Q=new UH(this.beans,$,this.rowCtrl.printLayout,this.getGui(),z);this.cellComps.set($.instanceId,Q),this.getGui().appendChild(Q.getGui())}destroy(){super.destroy(),this.destroyCells(this.cellComps)}setFullWidthRowComp($,z){this.fullWidthCellRenderer=$,this.fullWidthCellRendererParams=z,this.addDestroyFunc(()=>{this.fullWidthCellRenderer=this.beans.context.destroyBean(this.fullWidthCellRenderer),this.fullWidthCellRendererParams=void 0})}destroyCells($){for(let z of $.values()){if(!z)continue;let Q=z.cellCtrl.instanceId;if(this.cellComps.get(Q)!==z)continue;z.detach(),z.destroy(),this.cellComps.delete(Q)}}};function BH($,z,Q){let J=!!Q.gos.get("enableCellSpan")&&!!z.getSpannedRowCtrls,Z={tag:"div",ref:"eContainer",cls:Q8($),role:"rowgroup"};if(z.type==="center"||J){let X={tag:"div",ref:"eSpannedContainer",cls:`ag-spanning-container ${a_($)}`,role:"presentation"};return Z.role="presentation",{tag:"div",ref:"eViewport",cls:`ag-viewport ${z8($)}`,role:"rowgroup",children:[Z,J?X:null]}}return Z}var EH=class extends x{constructor($){super();this.eViewport=f,this.eContainer=f,this.eSpannedContainer=f,this.rowCompsNoSpan={},this.rowCompsWithSpan={},this.name=$?.name,this.options=K1(this.name)}postConstruct(){this.setTemplate(BH(this.name,this.options,this.beans));let $={setHorizontalScroll:(Q)=>this.eViewport.scrollLeft=Q,setViewportHeight:(Q)=>this.eViewport.style.height=Q,setRowCtrls:({rowCtrls:Q})=>this.setRowCtrls(Q),setSpannedRowCtrls:(Q)=>this.setRowCtrls(Q,!0),setDomOrder:(Q)=>{this.domOrder=Q},setContainerWidth:(Q)=>{if(this.eContainer.style.width=Q,this.eSpannedContainer)this.eSpannedContainer.style.width=Q},setOffsetTop:(Q)=>{let J=`translateY(${Q})`;if(this.eContainer.style.transform=J,this.eSpannedContainer)this.eSpannedContainer.style.transform=J}};this.createManagedBean(new qH(this.name)).setComp($,this.eContainer,this.eSpannedContainer,this.eViewport)}destroy(){this.setRowCtrls([]),this.setRowCtrls([],!0),super.destroy(),this.lastPlacedElement=null}setRowCtrls($,z){let{beans:Q,options:J}=this,Z=z?this.eSpannedContainer:this.eContainer,X=z?{...this.rowCompsWithSpan}:{...this.rowCompsNoSpan},Y={};if(z)this.rowCompsWithSpan=Y;else this.rowCompsNoSpan=Y;this.lastPlacedElement=null;let q=[];for(let G of $){let _=G.instanceId,H=X[_],U;if(H)U=H,delete X[_];else{if(!G.rowNode.displayed)continue;U=new WH(G,Q,J.type)}Y[_]=U,q.push([U,!H])}this.removeOldRows(Object.values(X)),this.addRowNodes(q,Z)}addRowNodes($,z){let{domOrder:Q}=this;for(let[J,Z]of $){let X=J.getGui();if(!Q){if(Z)z.appendChild(X)}else this.ensureDomOrder(X,z)}}removeOldRows($){for(let z of $)z.getGui().remove(),z.destroy()}ensureDomOrder($,z){g6(z,$,this.lastPlacedElement),this.lastPlacedElement=$}},KH={selector:"AG-ROW-CONTAINER",component:EH};function CQ($,z){return z.map((Q)=>{let J=`e${Q[0].toUpperCase()+Q.substring(1)}RowContainer`;return $[J]={name:Q},{tag:"ag-row-container",ref:J,attrs:{name:Q}}})}function LH($){let z={},Q={tag:"div",ref:"eGridRoot",cls:"ag-root ag-unselectable",children:[{tag:"ag-header-root"},{tag:"div",ref:"eTop",cls:"ag-floating-top",role:"presentation",children:CQ(z,["topLeft","topCenter","topRight","topFullWidth"])},{tag:"div",ref:"eBody",cls:"ag-body",role:"presentation",children:[{tag:"div",ref:"eBodyViewport",cls:"ag-body-viewport",role:"presentation",children:CQ(z,["left","center","right","fullWidth"])},{tag:"ag-fake-vertical-scroll"}]},{tag:"div",ref:"eStickyTop",cls:"ag-sticky-top",role:"presentation",children:CQ(z,["stickyTopLeft","stickyTopCenter","stickyTopRight","stickyTopFullWidth"])},{tag:"div",ref:"eStickyBottom",cls:"ag-sticky-bottom",role:"presentation",children:CQ(z,["stickyBottomLeft","stickyBottomCenter","stickyBottomRight","stickyBottomFullWidth"])},{tag:"div",ref:"eBottom",cls:"ag-floating-bottom",role:"presentation",children:CQ(z,["bottomLeft","bottomCenter","bottomRight","bottomFullWidth"])},{tag:"ag-fake-horizontal-scroll"},$?{tag:"ag-overlay-wrapper"}:null]};return{paramsMap:z,elementParams:Q}}var DH=class extends x{constructor(){super(...arguments);this.eGridRoot=f,this.eBodyViewport=f,this.eStickyTop=f,this.eStickyBottom=f,this.eTop=f,this.eBottom=f,this.eBody=f}postConstruct(){let{overlays:$,rangeSvc:z}=this.beans,Q=$?.getOverlayWrapperSelector(),{paramsMap:J,elementParams:Z}=LH(!!Q);this.setTemplate(Z,[...Q?[Q]:[],g_,m_,x_,KH],J);let X=(q,G)=>{let _=`${q}px`;G.style.minHeight=_,G.style.height=_},Y={setRowAnimationCssOnBodyViewport:(q,G)=>this.setRowAnimationCssOnBodyViewport(q,G),setColumnCount:(q)=>iY(this.getGui(),q),setRowCount:(q)=>pY(this.getGui(),q),setTopHeight:(q)=>X(q,this.eTop),setBottomHeight:(q)=>X(q,this.eBottom),setTopInvisible:(q)=>this.eTop.classList.toggle("ag-invisible",q),setBottomInvisible:(q)=>this.eBottom.classList.toggle("ag-invisible",q),setStickyTopHeight:(q)=>this.eStickyTop.style.height=q,setStickyTopTop:(q)=>this.eStickyTop.style.top=q,setStickyTopWidth:(q)=>this.eStickyTop.style.width=q,setStickyBottomHeight:(q)=>{this.eStickyBottom.style.height=q,this.eStickyBottom.classList.toggle("ag-invisible",q==="0px")},setStickyBottomBottom:(q)=>this.eStickyBottom.style.bottom=q,setStickyBottomWidth:(q)=>this.eStickyBottom.style.width=q,setColumnMovingCss:(q,G)=>this.toggleCss(q,G),updateLayoutClasses:(q,G)=>{let _=[this.eBodyViewport.classList,this.eBody.classList];for(let H of _)H.toggle(U$.AUTO_HEIGHT,G.autoHeight),H.toggle(U$.NORMAL,G.normal),H.toggle(U$.PRINT,G.print);this.toggleCss(U$.AUTO_HEIGHT,G.autoHeight),this.toggleCss(U$.NORMAL,G.normal),this.toggleCss(U$.PRINT,G.print)},setAlwaysVerticalScrollClass:(q,G)=>this.eBodyViewport.classList.toggle(X8,G),registerBodyViewportResizeListener:(q)=>{let G=F$(this.beans,this.eBodyViewport,q);this.addDestroyFunc(()=>G())},setPinnedTopBottomOverflowY:(q)=>this.eTop.style.overflowY=this.eBottom.style.overflowY=q,setCellSelectableCss:(q,G)=>{for(let _ of[this.eTop,this.eBodyViewport,this.eBottom])_.classList.toggle(q,G)},setBodyViewportWidth:(q)=>this.eBodyViewport.style.width=q,setGridRootRole:(q)=>_0(this.eGridRoot,q)};if(this.ctrl=this.createManagedBean(new HH),this.ctrl.setComp(Y,this.getGui(),this.eBodyViewport,this.eTop,this.eBottom,this.eStickyTop,this.eStickyBottom),z&&u0(this.gos)||rQ(this.gos))cY(this.getGui(),!0)}setRowAnimationCssOnBodyViewport($,z){let Q=this.eBodyViewport.classList;Q.toggle("ag-row-animation",z),Q.toggle("ag-row-no-animation",!z)}getFocusableContainerName(){return"gridBody"}},FH={selector:"AG-GRID-BODY",component:DH},gQ={TAB_GUARD:"ag-tab-guard",TAB_GUARD_TOP:"ag-tab-guard-top",TAB_GUARD_BOTTOM:"ag-tab-guard-bottom"},MH=class extends R0{constructor($,z){super();this.stopPropagationCallbacks=z,this.skipTabGuardFocus=!1,this.forcingFocusOut=!1,this.allowFocus=!1;let{comp:Q,eTopGuard:J,eBottomGuard:Z,focusTrapActive:X,forceFocusOutWhenTabGuardsAreEmpty:Y,isFocusableContainer:q,focusInnerElement:G,onFocusIn:_,onFocusOut:H,shouldStopEventPropagation:U,onTabKeyDown:W,handleKeyDown:B,isEmpty:E,eFocusableElement:K}=$;this.comp=Q,this.eTopGuard=J,this.eBottomGuard=Z,this.providedFocusInnerElement=G,this.eFocusableElement=K,this.focusTrapActive=!!X,this.forceFocusOutWhenTabGuardsAreEmpty=!!Y,this.isFocusableContainer=!!q,this.providedFocusIn=_,this.providedFocusOut=H,this.providedShouldStopEventPropagation=U,this.providedOnTabKeyDown=W,this.providedHandleKeyDown=B,this.providedIsEmpty=E}postConstruct(){this.createManagedBean(new y7(this.eFocusableElement,this.stopPropagationCallbacks,{shouldStopEventPropagation:()=>this.shouldStopEventPropagation(),onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($),onFocusIn:($)=>this.onFocusIn($),onFocusOut:($)=>this.onFocusOut($)})),this.activateTabGuards();for(let $ of[this.eTopGuard,this.eBottomGuard])this.addManagedElementListeners($,{focus:this.onFocus.bind(this)})}handleKeyDown($){if(this.providedHandleKeyDown)this.providedHandleKeyDown($)}tabGuardsAreActive(){return!!this.eTopGuard&&this.eTopGuard.hasAttribute("tabIndex")}shouldStopEventPropagation(){if(this.providedShouldStopEventPropagation)return this.providedShouldStopEventPropagation();return!1}activateTabGuards(){if(this.forcingFocusOut)return;let $=this.gos.get("tabIndex");this.comp.setTabIndex($.toString())}deactivateTabGuards(){this.comp.setTabIndex()}onFocus($){if(this.isFocusableContainer&&!this.eFocusableElement.contains($.relatedTarget)){if(!this.allowFocus){this.findNextElementOutsideAndFocus($.target===this.eBottomGuard);return}}if(this.skipTabGuardFocus){this.skipTabGuardFocus=!1;return}if(this.forceFocusOutWhenTabGuardsAreEmpty){if(this.providedIsEmpty?this.providedIsEmpty():E$(this.eFocusableElement,".ag-tab-guard").length===0){this.findNextElementOutsideAndFocus($.target===this.eBottomGuard);return}}if(this.isFocusableContainer&&this.eFocusableElement.contains($.relatedTarget))return;let z=$.target===this.eBottomGuard;if(!(this.providedFocusInnerElement?this.providedFocusInnerElement(z):this.focusInnerElement(z))&&this.forceFocusOutWhenTabGuardsAreEmpty)this.findNextElementOutsideAndFocus($.target===this.eBottomGuard)}findNextElementOutsideAndFocus($){let z=Y0(this.beans),Q=E$(z.body,null,!0),J=Q.indexOf($?this.eTopGuard:this.eBottomGuard);if(J===-1)return;let Z,X;if($)Z=0,X=J;else Z=J+1,X=Q.length;let Y=Q.slice(Z,X),q=this.gos.get("tabIndex");Y.sort((G,_)=>{let H=Number.parseInt(G.getAttribute("tabindex")||"0"),U=Number.parseInt(_.getAttribute("tabindex")||"0");if(U===q)return 1;if(H===q)return-1;if(H===0)return 1;if(U===0)return-1;return H-U}),Y[$?Y.length-1:0]?.focus()}onFocusIn($){if(this.focusTrapActive||this.forcingFocusOut)return;if(this.providedFocusIn)this.providedFocusIn($);if(!this.isFocusableContainer)this.deactivateTabGuards()}onFocusOut($){if(this.focusTrapActive)return;if(this.providedFocusOut)this.providedFocusOut($);if(!this.eFocusableElement.contains($.relatedTarget))this.activateTabGuards()}onTabKeyDown($){if(this.providedOnTabKeyDown){this.providedOnTabKeyDown($);return}if(this.focusTrapActive)return;if($.defaultPrevented)return;let z=this.tabGuardsAreActive();if(z)this.deactivateTabGuards();let Q=this.getNextFocusableElement($.shiftKey);if(z)setTimeout(()=>this.activateTabGuards(),0);if(!Q)return;Q.focus(),$.preventDefault()}focusInnerElement($=!1){let z=E$(this.eFocusableElement);if(this.tabGuardsAreActive())z.splice(0,1),z.splice(-1,1);if(!z.length)return!1;return z[$?z.length-1:0].focus({preventScroll:!0}),!0}getNextFocusableElement($){return j0(this.beans,this.eFocusableElement,!1,$)}forceFocusOutOfContainer($=!1){if(this.forcingFocusOut)return;let z=$?this.eTopGuard:this.eBottomGuard;this.activateTabGuards(),this.skipTabGuardFocus=!0,this.forcingFocusOut=!0,z.focus(),window.setTimeout(()=>{this.forcingFocusOut=!1,this.activateTabGuards()})}isTabGuard($,z){return $===this.eTopGuard&&!z||$===this.eBottomGuard&&(z??!0)}setAllowFocus($){this.allowFocus=$}},_4=class extends R0{constructor($,z){super();this.comp=$,this.stopPropagationCallbacks=z}initialiseTabGuard($){this.eTopGuard=this.createTabGuard("top"),this.eBottomGuard=this.createTabGuard("bottom"),this.eFocusableElement=this.comp.getFocusableElement();let{eTopGuard:z,eBottomGuard:Q,eFocusableElement:J,stopPropagationCallbacks:Z}=this,X=[z,Q],Y={setTabIndex:(D)=>{for(let F of X)if(D==null)F.removeAttribute("tabindex");else F.setAttribute("tabindex",D)}};this.addTabGuards(z,Q);let{focusTrapActive:q=!1,onFocusIn:G,onFocusOut:_,focusInnerElement:H,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L}=$;this.tabGuardCtrl=this.createManagedBean(new MH({comp:Y,focusTrapActive:q,eTopGuard:z,eBottomGuard:Q,eFocusableElement:J,onFocusIn:G,onFocusOut:_,focusInnerElement:H,handleKeyDown:U,onTabKeyDown:W,shouldStopEventPropagation:B,isEmpty:E,forceFocusOutWhenTabGuardsAreEmpty:K,isFocusableContainer:L},Z))}getTabGuardCtrl(){return this.tabGuardCtrl}createTabGuard($){let z=Y0(this.beans).createElement("div"),Q=$==="top"?gQ.TAB_GUARD_TOP:gQ.TAB_GUARD_BOTTOM;return z.classList.add(gQ.TAB_GUARD,Q),_0(z,"presentation"),z}addTabGuards($,z){let Q=this.eFocusableElement;Q.prepend($),Q.append(z)}removeAllChildrenExceptTabGuards(){let $=[this.eTopGuard,this.eBottomGuard];z0(this.comp.getFocusableElement()),this.addTabGuards(...$)}forceFocusOutOfContainer($=!1){this.tabGuardCtrl.forceFocusOutOfContainer($)}appendChild($,z,Q){if(!X1(z))z=z.getGui();let{eBottomGuard:J}=this;if(J)J.before(z);else $(z,Q)}destroy(){let{eTopGuard:$,eBottomGuard:z}=this;T0($),T0(z),super.destroy()}},p$=class extends p0{initialiseTabGuard($,z){this.tabGuardFeature=this.createManagedBean(new _4(this,z)),this.tabGuardFeature.initialiseTabGuard($)}forceFocusOutOfContainer($=!1){this.tabGuardFeature.forceFocusOutOfContainer($)}appendChild($,z){this.tabGuardFeature.appendChild(super.appendChild.bind(this),$,z)}},H4=class extends p${initialiseTabGuard($){super.initialiseTabGuard($,Uz)}},f5=($,z)=>{return u7($,()=>F0($.getGui(),z,!1,!0))},O5=($)=>{return $?.getFocusableContainerName()??"external"},kH=($)=>{if($==null)return"external";return typeof $==="string"?$:"gridBody"},VH=class extends S{constructor(){super(...arguments);this.additionalFocusableContainers=new Set}setComp($,z,Q){this.view=$,this.eGridHostDiv=z,this.eGui=Q,this.eGui.setAttribute("grid-id",this.beans.context.getId());let{dragAndDrop:J,ctrlsSvc:Z}=this.beans;J?.registerGridDropTarget(()=>this.eGui,this),this.createManagedBean(new q4(this.view)),this.view.setRtlClass(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let X=F$(this.beans,this.eGridHostDiv,this.onGridSizeChanged.bind(this));this.addDestroyFunc(()=>X()),Z.register("gridCtrl",this)}isDetailGrid(){return xJ(this.getGui())?.getAttribute("row-id")?.startsWith("detail")||!1}getOptionalSelectors(){let $=this.beans;return{paginationSelector:$.pagination?.getPaginationSelector(),gridHeaderDropZonesSelector:$.registry?.getSelector("AG-GRID-HEADER-DROP-ZONES"),sideBarSelector:$.sideBar?.getSelector(),statusBarSelector:$.registry?.getSelector("AG-STATUS-BAR"),watermarkSelector:$.licenseManager?.getWatermarkSelector()}}onGridSizeChanged(){this.eventSvc.dispatchEvent({type:"gridSizeChanged",clientWidth:this.eGridHostDiv.clientWidth,clientHeight:this.eGridHostDiv.clientHeight})}destroyGridUi(){this.view.destroyGridUi()}getGui(){return this.eGui}setResizeCursor($){let{view:z}=this;if($===!1)z.setCursor(null);else z.setCursor($===1?"ew-resize":"ns-resize")}disableUserSelect($){this.view.setUserSelect($?"none":null)}focusNextInnerContainer($){let z=this.getFocusableContainers(),{indexWithFocus:Q,nextIndex:J}=this.getNextFocusableIndex(z,$),Z=Q===-1?$?z.length-1:0:J,{gos:X,beans:{focusSvc:Y,navigation:q}}=this,G=X.getCallback("tabToNextGridContainer");if(G){let _=Y.getDefaultTabToNextGridContainerTarget({backwards:$,focusableContainers:z,nextIndex:Z}),H=O5(z[Z]),U=_==null&&H==="gridBody"?"gridBody":kH(_),W=G({backwards:$,previousContainer:O5(z[Q]),nextContainer:U,defaultTarget:_});if(W!==void 0){if(typeof W==="boolean")return W;if(typeof W==="string"){if(W==="gridBody")return this.focusGridBodyDefault($)||void 0;let B=z.find((E)=>E.getFocusableContainerName()===W);if(!B){d6(`tabToNextGridContainer - ${W} container not found`);return}return f5(B,$)?!0:void 0}if(E_(W))return Y.focusHeaderPosition({headerPosition:W})||void 0;return q?.ensureCellVisible(W),Y.setFocusedCell({...W,forceBrowserFocus:!0}),Y.isCellFocused(W)||void 0}}return this.focusNextInnerContainerDefault({backwards:$,focusableContainers:z,indexWithFocus:Q,nextIndex:Z})||void 0}focusInnerElement($){let{gos:z,beans:Q,beans:{focusSvc:J,visibleCols:Z}}=this;if(z.getCallback("focusGridInnerElement")?.({fromBottom:!!$}))return!0;let Y=this.getFocusableContainers();if($){if(this.focusNextInnerContainerDefault({backwards:!0,focusableContainers:Y,indexWithFocus:Y.length,nextIndex:Y.length-1}))return!0;return J.focusGridView({column:b(Z.allCols),backwards:!0})}let q=Z.allCols;if(z.get("headerHeight")===0||H$(Q)){if(J.focusGridView({column:q[0],backwards:$}))return!0;for(let G=1;GZ.getGui().contains(Q));return{indexWithFocus:J,nextIndex:J+(z?-1:1)}}focusGridBodyDefault($){let{gos:z,beans:Q,beans:{focusSvc:J,visibleCols:{allCols:Z}}}=this;if($)return J.focusGridView({column:b(Z),backwards:!0});if(z.get("headerHeight")===0||H$(Q))return J.focusGridView({column:Z[0]});return J.focusFirstHeader()}focusNextInnerContainerDefault($){let{backwards:z,focusableContainers:Q,indexWithFocus:J}=$,Z=z?-1:1;for(let X=$.nextIndex;X>=0&&XX:Jthis.destroyBean(this),setRtlClass:(X)=>this.addCss(X),forceFocusOutOfContainer:this.forceFocusOutOfContainer.bind(this),updateLayoutClasses:this.updateLayoutClasses.bind(this),getFocusableContainers:this.getFocusableContainers.bind(this),setUserSelect:(X)=>{this.getGui().style.userSelect=X!=null?X:"",this.getGui().style.webkitUserSelect=X!=null?X:""},setCursor:(X)=>{this.getGui().style.cursor=X!=null?X:""}},z=this.createManagedBean(new VH),Q=z.getOptionalSelectors(),J=this.createTemplate(Q),Z=[FH,...Object.values(Q).filter((X)=>!!X)];this.setTemplate(J,Z),z.setComp($,this.eGridDiv,this.getGui()),this.insertGridIntoDom(),this.initialiseTabGuard({onTabKeyDown:()=>{return},focusInnerElement:(X)=>z.focusInnerElement(X),forceFocusOutWhenTabGuardsAreEmpty:!0,isEmpty:()=>!z.isFocusable()})}insertGridIntoDom(){let $=this.getGui();this.eGridDiv.appendChild($),this.addDestroyFunc(()=>{$.remove(),dQ(this.gos,"Grid removed from DOM")})}updateLayoutClasses($,z){let Q=this.rootWrapperBody.classList,{AUTO_HEIGHT:J,NORMAL:Z,PRINT:X}=U$,{autoHeight:Y,normal:q,print:G}=z;Q.toggle(J,Y),Q.toggle(Z,q),Q.toggle(X,G),this.toggleCss(J,Y),this.toggleCss(Z,q),this.toggleCss(X,G)}createTemplate($){let z=$.gridHeaderDropZonesSelector?{tag:"ag-grid-header-drop-zones",ref:"gridHeaderDropZones"}:null,Q=$.sideBarSelector?{tag:"ag-side-bar",ref:"sideBar"}:null,J=$.statusBarSelector?{tag:"ag-status-bar",ref:"statusBar"}:null,Z=$.watermarkSelector?{tag:"ag-watermark"}:null,X=$.paginationSelector?{tag:"ag-pagination",ref:"pagination"}:null;return{tag:"div",cls:"ag-root-wrapper",role:"presentation",children:[z,{tag:"div",ref:"rootWrapperBody",cls:"ag-root-wrapper-body",role:"presentation",children:[{tag:"ag-grid-body",ref:"gridBody"},Q]},J,X,Z]}}getFocusableElement(){return this.rootWrapperBody}forceFocusOutOfContainer($=!1){if(!$&&this.pagination?.isDisplayed()){this.pagination.forceFocusOutOfContainer($);return}super.forceFocusOutOfContainer($)}getFocusableContainers(){let $=[...this.gridHeaderDropZones?.getFocusableContainers?.()??[],this.gridBody];for(let z of[this.sideBar,this.statusBar,this.pagination])if(z)$.push(z);return $.filter((z)=>A0(z.getGui()))}},c=($,z)=>{for(let Q of Object.keys(z))z[Q]=$;return z},P5={dispatchEvent:"CommunityCore",...c("CommunityCore",{destroy:0,getGridId:0,getGridOption:0,isDestroyed:0,setGridOption:0,updateGridOptions:0,isModuleRegistered:0}),...c("GridState",{getState:0,setState:0}),...c("SharedRowSelection",{setNodesSelected:0,selectAll:0,deselectAll:0,selectAllFiltered:0,deselectAllFiltered:0,selectAllOnCurrentPage:0,deselectAllOnCurrentPage:0,getSelectedNodes:0,getSelectedRows:0}),...c("RowApi",{redrawRows:0,setRowNodeExpanded:0,getRowNode:0,addRenderedRowListener:0,getRenderedNodes:0,forEachNode:0,getFirstDisplayedRowIndex:0,getLastDisplayedRowIndex:0,getDisplayedRowAtIndex:0,getDisplayedRowCount:0}),...c("ScrollApi",{getVerticalPixelRange:0,getHorizontalPixelRange:0,ensureColumnVisible:0,ensureIndexVisible:0,ensureNodeVisible:0}),...c("KeyboardNavigation",{getFocusedCell:0,clearFocusedCell:0,setFocusedCell:0,tabToNextCell:0,tabToPreviousCell:0,setFocusedHeader:0}),...c("EventApi",{addEventListener:0,addGlobalListener:0,removeEventListener:0,removeGlobalListener:0}),...c("ValueCache",{expireValueCache:0}),...c("CellApi",{getCellValue:0}),...c("SharedMenu",{showColumnMenu:0,hidePopupMenu:0}),...c("Sort",{onSortChanged:0}),...c("PinnedRow",{getPinnedTopRowCount:0,getPinnedBottomRowCount:0,getPinnedTopRow:0,getPinnedBottomRow:0,forEachPinnedRow:0}),...c("Overlay",{showLoadingOverlay:0,showNoRowsOverlay:0,hideOverlay:0}),...c("RenderApi",{setGridAriaProperty:0,refreshCells:0,refreshHeader:0,isAnimationFrameQueueEmpty:0,flushAllAnimationFrames:0,getSizesForCurrentTheme:0,getCellRendererInstances:0}),...c("HighlightChanges",{flashCells:0}),...c("RowDrag",{addRowDropZone:0,removeRowDropZone:0,getRowDropZoneParams:0,getRowDropPositionIndicator:0,setRowDropPositionIndicator:0}),...c("ColumnApi",{getColumnDefs:0,getColumnDef:0,getDisplayNameForColumn:0,getColumn:0,getColumns:0,applyColumnState:0,getColumnState:0,resetColumnState:0,isPinning:0,isPinningLeft:0,isPinningRight:0,getDisplayedColAfter:0,getDisplayedColBefore:0,setColumnsVisible:0,setColumnsPinned:0,getAllGridColumns:0,getDisplayedLeftColumns:0,getDisplayedCenterColumns:0,getDisplayedRightColumns:0,getAllDisplayedColumns:0,getAllDisplayedVirtualColumns:0}),...c("ColumnAutoSize",{sizeColumnsToFit:0,autoSizeColumns:0,autoSizeAllColumns:0}),...c("ColumnGroup",{setColumnGroupOpened:0,getColumnGroup:0,getProvidedColumnGroup:0,getDisplayNameForColumnGroup:0,getColumnGroupState:0,setColumnGroupState:0,resetColumnGroupState:0,getLeftDisplayedColumnGroups:0,getCenterDisplayedColumnGroups:0,getRightDisplayedColumnGroups:0,getAllDisplayedColumnGroups:0}),...c("ColumnMove",{moveColumnByIndex:0,moveColumns:0}),...c("ColumnResize",{setColumnWidths:0}),...c("ColumnHover",{isColumnHovered:0}),...c("EditCore",{getCellEditorInstances:0,getEditingCells:0,getEditRowValues:0,stopEditing:0,startEditingCell:0,isEditing:0,validateEdit:0}),...c("BatchEdit",{startBatchEdit:0,cancelBatchEdit:0,commitBatchEdit:0,isBatchEditing:0}),...c("UndoRedoEdit",{undoCellEditing:0,redoCellEditing:0,getCurrentUndoSize:0,getCurrentRedoSize:0}),...c("FilterCore",{isAnyFilterPresent:0,onFilterChanged:0}),...c("ColumnFilter",{isColumnFilterPresent:0,getColumnFilterInstance:0,destroyFilter:0,setFilterModel:0,getFilterModel:0,getColumnFilterModel:0,setColumnFilterModel:0,showColumnFilter:0,hideColumnFilter:0,getColumnFilterHandler:0,doFilterAction:0}),...c("QuickFilter",{isQuickFilterPresent:0,getQuickFilter:0,resetQuickFilter:0}),...c("Find",{findGetActiveMatch:0,findGetTotalMatches:0,findGoTo:0,findNext:0,findPrevious:0,findGetNumMatches:0,findGetParts:0,findClearActive:0,findRefresh:0}),...c("Pagination",{paginationIsLastPageFound:0,paginationGetPageSize:0,paginationGetCurrentPage:0,paginationGetTotalPages:0,paginationGetRowCount:0,paginationGoToNextPage:0,paginationGoToPreviousPage:0,paginationGoToFirstPage:0,paginationGoToLastPage:0,paginationGoToPage:0}),...c("CsrmSsrmSharedApi",{expandAll:0,collapseAll:0,resetRowGroupExpansion:0}),...c("SsrmInfiniteSharedApi",{setRowCount:0,getCacheBlockState:0,isLastRowIndexKnown:0}),...c("ClientSideRowModelApi",{onGroupExpandedOrCollapsed:0,refreshClientSideRowModel:0,isRowDataEmpty:0,forEachLeafNode:0,forEachNodeAfterFilter:0,forEachNodeAfterFilterAndSort:0,applyTransaction:0,applyTransactionAsync:0,flushAsyncTransactions:0,getBestCostNodeSelection:0,onRowHeightChanged:0,resetRowHeights:0}),...c("CsvExport",{getDataAsCsv:0,exportDataAsCsv:0}),...c("InfiniteRowModel",{refreshInfiniteCache:0,purgeInfiniteCache:0,getInfiniteRowCount:0}),...c("AdvancedFilter",{getAdvancedFilterModel:0,setAdvancedFilterModel:0,showAdvancedFilterBuilder:0,hideAdvancedFilterBuilder:0}),...c("IntegratedCharts",{getChartModels:0,getChartRef:0,getChartImageDataURL:0,downloadChart:0,openChartToolPanel:0,closeChartToolPanel:0,createRangeChart:0,createPivotChart:0,createCrossFilterChart:0,updateChart:0,restoreChart:0}),...c("Clipboard",{copyToClipboard:0,cutToClipboard:0,copySelectedRowsToClipboard:0,copySelectedRangeToClipboard:0,copySelectedRangeDown:0,pasteFromClipboard:0}),...c("ExcelExport",{getDataAsExcel:0,exportDataAsExcel:0,getSheetDataForExcel:0,getMultipleSheetsAsExcel:0,exportMultipleSheetsAsExcel:0}),...c("SharedMasterDetail",{addDetailGridInfo:0,removeDetailGridInfo:0,getDetailGridInfo:0,forEachDetailGridInfo:0}),...c("ContextMenu",{showContextMenu:0}),...c("ColumnMenu",{showColumnChooser:0,hideColumnChooser:0}),...c("CellSelection",{getCellRanges:0,addCellRange:0,clearRangeSelection:0,clearCellSelection:0}),...c("SharedRowGrouping",{setRowGroupColumns:0,removeRowGroupColumns:0,addRowGroupColumns:0,getRowGroupColumns:0,moveRowGroupColumn:0}),...c("SharedAggregation",{addAggFuncs:0,clearAggFuncs:0,setColumnAggFunc:0}),...c("SharedPivot",{isPivotMode:0,getPivotResultColumn:0,setValueColumns:0,getValueColumns:0,removeValueColumns:0,addValueColumns:0,setPivotColumns:0,removePivotColumns:0,addPivotColumns:0,getPivotColumns:0,setPivotResultColumns:0,getPivotResultColumns:0}),...c("ServerSideRowModelApi",{getServerSideSelectionState:0,setServerSideSelectionState:0,applyServerSideTransaction:0,applyServerSideTransactionAsync:0,applyServerSideRowData:0,retryServerSideLoads:0,flushServerSideAsyncTransactions:0,refreshServerSide:0,getServerSideGroupLevelState:0,onRowHeightChanged:0,resetRowHeights:0}),...c("SideBar",{isSideBarVisible:0,setSideBarVisible:0,setSideBarPosition:0,openToolPanel:0,closeToolPanel:0,getOpenedToolPanel:0,refreshToolPanel:0,isToolPanelShowing:0,getToolPanelInstance:0,getSideBar:0}),...c("StatusBar",{getStatusPanel:0}),...c("AiToolkit",{getStructuredSchema:0})},gZ={isDestroyed:()=>!0,destroy(){},preConstruct(){},postConstruct(){},preWireBeans(){},wireBeans(){}},SH=($,z)=>$.eventSvc.dispatchEvent(z),Y8=class{};Reflect.defineProperty(Y8,"name",{value:"GridApi"});var RH=class extends S{constructor(){super();this.beanName="apiFunctionSvc",this.api=new Y8,this.fns={...gZ,dispatchEvent:SH},this.preDestroyLink="";let{api:$}=this;for(let z of Object.keys(P5))$[z]=this.makeApi(z)[z]}postConstruct(){this.preDestroyLink=this.beans.frameworkOverrides.getDocLink("grid-lifecycle/#grid-pre-destroyed")}addFunction($,z){let{fns:Q,beans:J}=this;if(Q!==gZ)Q[$]=J?.validation?.validateApiFunction($,z)??z}makeApi($){return{[$]:(...z)=>{let{beans:Q,fns:{[$]:J}}=this;return J?J(Q,...z):this.apiNotFound($)}}}apiNotFound($){let{beans:z,gos:Q,preDestroyLink:J}=this;if(!z)j(26,{fnName:$,preDestroyLink:J});else{let Z=P5[$];if(Q.assertModuleRegistered(Z,`api.${$}`))j(27,{fnName:$,module:Z})}}destroy(){super.destroy(),this.fns=gZ,this.beans=null}};function jH($){return $.context.getId()}function fH($){$.gridDestroySvc.destroy()}function OH($){return $.gridDestroySvc.destroyCalled}function PH($,z){return $.gos.get(z)}function TH($,z,Q){q8($,{[z]:Q})}function q8($,z){$.gos.updateGridOptions({options:z})}function vH($,z){let Q=z.replace(/Module$/,"");return $.gos.isModuleRegistered(Q)}function uJ($,z,Q){let J=h($,z,Q);if(J){let{className:X}=J;if(typeof X==="string"&&X.includes("ag-icon")||typeof X==="object"&&X["ag-icon"])return J}let Z=J0({tag:"span"});return Z.appendChild(J),Z}function h($,z,Q){let J=null;if($==="smallDown")j(262);else if($==="smallLeft")j(263);else if($==="smallRight")j(264);let Z=Q?.getColDef().icons;if(Z)J=Z[$];if(z.gos&&!J){let X=z.gos.get("icons");if(X)J=X[$]}if(J){let X;if(typeof J==="function")X=J();else if(typeof J==="string")X=J;else{j(38,{iconName:$});return}if(typeof X==="string")return v2(X);if(X1(X))return X;j(133,{iconName:$});return}else{let X=z.registry.getIcon($);if(!X)z.validation?.validateIcon($);return J0({tag:"span",cls:`ag-icon ag-icon-${X??$}`,role:"presentation",attrs:{unselectable:"on"}})}}var IH=".ag-dnd-ghost{align-items:center;background-color:var(--ag-drag-and-drop-image-background-color);border:var(--ag-drag-and-drop-image-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-drag-and-drop-image-shadow);color:var(--ag-text-color);cursor:move;display:flex;font-weight:500;gap:var(--ag-cell-widget-spacing);height:var(--ag-header-height);overflow:hidden;padding-left:var(--ag-cell-horizontal-padding);padding-right:var(--ag-cell-horizontal-padding);text-overflow:ellipsis;transform:translateY(calc(var(--ag-spacing)*2));white-space:nowrap}.ag-dnd-ghost-not-allowed{border:var(--ag-drag-and-drop-image-not-allowed-border)}",CH={tag:"div",children:[{tag:"div",ref:"eGhost",cls:"ag-dnd-ghost ag-unselectable",children:[{tag:"span",ref:"eIcon",cls:"ag-dnd-ghost-icon ag-shake-left-to-right"},{tag:"div",ref:"eLabel",cls:"ag-dnd-ghost-label"}]}]},bH=class extends x{constructor(){super();this.dragSource=null,this.eIcon=f,this.eLabel=f,this.eGhost=f,this.registerCSS(IH)}postConstruct(){let $=(z)=>uJ(z,this.beans,null);this.dropIconMap={pinned:$("columnMovePin"),hide:$("columnMoveHide"),move:$("columnMoveMove"),left:$("columnMoveLeft"),right:$("columnMoveRight"),group:$("columnMoveGroup"),aggregate:$("columnMoveValue"),pivot:$("columnMovePivot"),notAllowed:$("dropNotAllowed")}}init($){this.dragSource=$.dragSource,this.setTemplate(CH),this.beans.environment.applyThemeClasses(this.eGhost)}destroy(){this.dragSource=null,super.destroy()}setIcon($,z){let{eGhost:Q,eIcon:J,dragSource:Z,dropIconMap:X,gos:Y}=this;z0(J);let q=null;if(!$)$=Z?.getDefaultIconName?Z.getDefaultIconName():"notAllowed";if(q=X[$],Q.classList.toggle("ag-dnd-ghost-not-allowed",$==="notAllowed"),J.classList.toggle("ag-shake-left-to-right",z),q===X.hide&&Y.get("suppressDragLeaveHidesColumns"))return;if(q)J.appendChild(q)}setLabel($){this.eLabel.textContent=$}};var G8=($,z)=>{if(z!=null&&$?.setPointerCapture)try{return $.setPointerCapture(z),$.hasPointerCapture(z)}catch{}return!1},yH=($,z)=>{if(typeof PointerEvent>"u"||!(z instanceof PointerEvent))return null;let Q=z.pointerId;if(!G8($,Q))return null;let J={eElement:$,pointerId:Q,onLost(Z){wH(J,Z)}};return $.addEventListener("lostpointercapture",J.onLost),J},xH=($)=>{if(!$)return;_8($);let{eElement:z,pointerId:Q}=$;if(!z)return;try{z.releasePointerCapture(Q)}catch{}$.eElement=null},_8=($)=>{let{eElement:z,onLost:Q}=$;if(z&&Q)z.removeEventListener("lostpointercapture",Q),$.onLost=null},wH=($,z)=>{_8($);let{eElement:Q,pointerId:J}=$;if(Q&&z.pointerId===J)G8(Q,J)},ez,JQ,hZ={passive:!0},r$={passive:!1},k$=($)=>{if(!JQ)JQ=new WeakSet;else if(JQ.has($))return!1;return JQ.add($),!0},NH=class extends R0{constructor(){super(...arguments);this.beanName="dragSvc",this.dragging=!1,this.drag=null,this.dragSources=[]}get startTarget(){return this.drag?.start.target??null}isPointer(){return!!ez?.has(r0(this.beans))}hasPointerCapture(){let $=this.drag?.pointerCapture;return!!($&&this.beans.eRootDiv.hasPointerCapture?.($.pointerId))}destroy(){if(this.drag)this.cancelDrag();let $=this.dragSources;for(let z of $)T5(z);$.length=0,super.destroy()}removeDragSource($){let z=this.dragSources;for(let Q=0,J=z.length;Qthis.onPointerDown($,_),r$],[z,"mousedown",(_)=>this.onMouseDown($,_)]);let G=this.gos.get("suppressTouch");if(Q&&!G)p1(J,[z,"touchstart",(H)=>this.onTouchStart($,H),r$])}cancelDrag($){let z=this.drag;if($??($=z?.eElement),$)this.eventSvc.dispatchEvent({type:"dragCancelled",target:$});z?.params.onDragCancel?.(),this.destroyDrag()}shouldPreventMouseEvent($){let z=$.type;return(z==="mousemove"||z==="pointermove")&&$.cancelable&&nQ(this.beans,$)&&!wQ(mZ($))}initDrag($,...z){this.drag=$;let Q=this.beans,J=(q)=>this.onScroll(q),Z=(q)=>this.onKeyDown(q),X=r0(Q),Y=Y0(Q);p1($.handlers,[X,"contextmenu",QQ],[X,"keydown",Z],[Y,"scroll",J,{capture:!0}],[Y.defaultView||window,"scroll",J],...z)}destroyDrag(){this.dragging=!1;let $=this.drag;if($){let z=$.rootEl;if(ez?.get(z)===$)ez.delete(z);this.drag=null,xH($.pointerCapture),I2($.handlers)}}onPointerDown($,z){if(this.isPointer())return;let Q=this.beans;if(JQ?.has(z))return;let J=z.pointerType;if(J==="touch"){if(Q.gos.get("suppressTouch")||!$.includeTouch)return;if($.stopPropagationForTouch)z.stopPropagation();if(wQ(mZ(z)))return}if(!z.isPrimary)return;if(J==="mouse"&&z.button!==0)return;this.destroyDrag();let Z=r0(Q),X=$.eElement,Y=z.pointerId,q=new uZ(Z,$,z,Y);ez??(ez=new WeakMap),ez.set(Z,q);let G=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerMove(W)},_=(W)=>{if(W.pointerId===Y)this.onMouseOrPointerUp(W)},H=(W)=>{if(W.pointerId===Y&&k$(W))this.cancelDrag()},U=(W)=>this.draggingPreventDefault(W);if(this.initDrag(q,[Z,"pointerup",_],[Z,"pointercancel",H],[Z,"pointermove",G,r$],[Z,"touchmove",U,r$],[X,"mousemove",U,r$]),$.dragStartPixels===0)this.onMouseOrPointerMove(z);else k$(z)}onTouchStart($,z){if(this.gos.get("suppressTouch")||!$.includeTouch)return;if(!k$(z))return;if(wQ(mZ(z)))return;if($.stopPropagationForTouch)z.stopPropagation();if(this.isPointer()){if(this.dragging)QQ(z);return}this.destroyDrag();let J=this.beans,Z=r0(J),X=new uZ(Z,$,z.touches[0]),Y=(W)=>this.onTouchMove(W),q=(W)=>this.onTouchUp(W),G=(W)=>this.onTouchCancel(W),_=(W)=>this.draggingPreventDefault(W),H=r0(J),U=z.target??$.eElement;if(this.initDrag(X,[U,"touchmove",Y,hZ],[U,"touchend",q,hZ],[U,"touchcancel",G,hZ],[H,"touchmove",_,r$],[H,"touchend",q,r$],[H,"touchcancel",G,r$]),$.dragStartPixels===0)this.onMove(X.start)}draggingPreventDefault($){if(this.dragging)QQ($)}onMouseDown($,z){if(z.button!==0)return;if(JQ?.has(z))return;if(this.isPointer())return;let Q=this.beans;this.destroyDrag();let J=new uZ(r0(Q),$,z),Z=(q)=>this.onMouseOrPointerMove(q),X=(q)=>this.onMouseOrPointerUp(q),Y=r0(Q);if(this.initDrag(J,[Y,"mousemove",Z],[Y,"mouseup",X]),$.dragStartPixels===0)this.onMouseOrPointerMove(z);else k$(z)}onScroll($){if(!k$($))return;let z=this.drag,Q=z?.lastDrag;if(Q&&this.dragging)z.params?.onDragging?.(Q)}onMouseOrPointerMove($){if(!k$($))return;if(cz())Y0(this.beans).getSelection()?.removeAllRanges();if(this.shouldPreventMouseEvent($))QQ($);this.onMove($)}onTouchCancel($){let z=this.drag;if(!z||!k$($))return;if(!qQ(z.start,$.changedTouches))return;this.cancelDrag()}onTouchMove($){let z=this.drag;if(!z||!k$($))return;let Q=qQ(z.start,$.touches);if(Q)this.onMove(Q),this.draggingPreventDefault($)}onMove($){let z=this.drag;if(!z)return;z.lastDrag=$;let Q=z.params;if(!this.dragging){let J=z.start,X=Q.dragStartPixels??4;if(p6($,J,X))return;if(this.dragging=!0,Q.capturePointer)z.pointerCapture=yH(this.beans.eRootDiv,$);if(this.eventSvc.dispatchEvent({type:"dragStarted",target:Q.eElement}),Q.onDragStart?.(J),this.drag!==z)return;if(Q.onDragging?.(J),this.drag!==z)return}Q.onDragging?.($)}onTouchUp($){let z=this.drag;if(z&&k$($))this.onUp(qQ(z.start,$.changedTouches))}onMouseOrPointerUp($){if(k$($))this.onUp($)}onUp($){let z=this.drag;if(!z)return;if(!$)$=z.lastDrag;if($&&this.dragging)this.dragging=!1,z.params.onDragStop?.($),this.eventSvc.dispatchEvent({type:"dragStopped",target:z.params.eElement});this.destroyDrag()}onKeyDown($){if($.key===A.ESCAPE)this.cancelDrag()}},T5=($)=>{I2($.handlers);let z=$.oldTouchAction;if(z!=null){let Q=$.params.eElement.style;if(Q)Q.touchAction=z}},uZ=class{constructor($,z,Q,J=null){this.rootEl=$,this.params=z,this.start=Q,this.pointerId=J,this.handlers=[],this.lastDrag=null,this.pointerCapture=null,this.eElement=z.eElement}},mZ=($)=>{let z=$.target;return z instanceof Element?z:null},gH=class extends NH{shouldPreventMouseEvent($){return this.gos.get("enableCellTextSelection")&&super.shouldPreventMouseEvent($)}},hH=class extends S{constructor(){super(...arguments);this.beanName="horizontalResizeSvc"}addResizeBar($){let z={dragStartPixels:$.dragStartPixels||0,eElement:$.eResizeBar,onDragStart:this.onDragStart.bind(this,$),onDragStop:this.onDragStop.bind(this,$),onDragging:this.onDragging.bind(this,$),onDragCancel:this.onDragStop.bind(this,$),includeTouch:!0,stopPropagationForTouch:!0},{dragSvc:Q}=this.beans;return Q.addDragSource(z),()=>Q.removeDragSource(z)}onDragStart($,z){this.dragStartX=z.clientX,this.setResizeIcons();let Q=z instanceof MouseEvent&&z.shiftKey===!0;$.onResizeStart(Q)}setResizeIcons(){let $=this.beans.ctrlsSvc.get("gridCtrl");$.setResizeCursor(1),$.disableUserSelect(!0)}onDragStop($){$.onResizeEnd(this.resizeAmount),this.resetIcons()}resetIcons(){let $=this.beans.ctrlsSvc.get("gridCtrl");$.setResizeCursor(!1),$.disableUserSelect(!1)}onDragging($,z){this.resizeAmount=z.clientX-this.dragStartX,$.onResizing(this.resizeAmount)}};var mJ=class{constructor($){if(this.tickingInterval=null,this.onScrollCallback=null,this.scrollContainer=$.scrollContainer,this.scrollHorizontally=$.scrollAxis.includes("x"),this.scrollVertically=$.scrollAxis.includes("y"),this.scrollByTick=$.scrollByTick??20,$.onScrollCallback)this.onScrollCallback=$.onScrollCallback;if(this.scrollVertically)this.getVerticalPosition=$.getVerticalPosition,this.setVerticalPosition=$.setVerticalPosition;if(this.scrollHorizontally)this.getHorizontalPosition=$.getHorizontalPosition,this.setHorizontalPosition=$.setHorizontalPosition;this.shouldSkipVerticalScroll=$.shouldSkipVerticalScroll||(()=>!1),this.shouldSkipHorizontalScroll=$.shouldSkipHorizontalScroll||(()=>!1)}get scrolling(){return this.tickingInterval!==null}check($,z=!1){let Q=!this.scrollVertically||z||this.shouldSkipVerticalScroll(),J=!this.scrollHorizontally||this.shouldSkipHorizontalScroll();if(Q&&J)return;let Z=this.scrollContainer.getBoundingClientRect(),X=this.scrollByTick;if(this.tickLeft=!J&&$.clientXZ.right-X,this.tickUp=!Q&&$.clientYZ.bottom-X,this.tickLeft||this.tickRight||this.tickUp||this.tickDown)this.ensureTickingStarted();else this.ensureCleared()}ensureTickingStarted(){if(this.tickingInterval===null)this.tickingInterval=window.setInterval(this.doTick.bind(this),100),this.tickCount=0}doTick(){this.tickCount++;let $=this.tickCount>20?200:this.tickCount>10?80:40;if(this.scrollVertically){let z=this.getVerticalPosition();if(this.tickUp)this.setVerticalPosition(z-$);if(this.tickDown)this.setVerticalPosition(z+$)}if(this.scrollHorizontally){let z=this.getHorizontalPosition();if(this.tickLeft)this.setHorizontalPosition(z-$);if(this.tickRight)this.setHorizontalPosition(z+$)}if(this.onScrollCallback)this.onScrollCallback()}ensureCleared(){if(this.tickingInterval)window.clearInterval(this.tickingInterval),this.tickingInterval=null}},WQ=class{constructor(){this.reordered=!1,this.removals=[],this.updates=new Set,this.adds=new Set}},pz=($)=>{let z=$.childrenAfterGroup;while(z?.length){let Q=z[0];if(Q.sourceRowIndex>=0)return Q;z=Q.childrenAfterGroup}},H8=($,z,Q,J)=>{if(!z.size||!$)return!1;let Z=!1,X=$.length??0,Y=-1;if(Q){if(Y=Q.sourceRowIndex,Q=Y<0?pz(Q):null,Q)Y=Q.sourceRowIndex}if(Y<0||Y>=X)Y=X;else if(!J)++Y;let q=Y,G=Math.min(Y,X-1);for(let U of z){let W=U.sourceRowIndex;if(WG)G=W}let _=q;for(let U=q;U=Y;--U){let W=$[U];if(z.has(W))continue;if(W.sourceRowIndex!==H)W.sourceRowIndex=H,$[H]=W,Z=!0;--H}for(let U of z){if(U.sourceRowIndex!==_)U.sourceRowIndex=_,$[_]=U,Z=!0;++_}return Z};function U4($,z){return E1($,z.target)?.getFocusedCellPosition()??null}function W4($,z){let Q=V0($.gos,"normal"),J=z,Z,X;if(J.clientX!=null||J.clientY!=null)Z=J.clientX,X=J.clientY;else Z=J.x,X=J.y;let{pageFirstPixel:Y}=$.pageBounds.getCurrentPagePixelRange();if(X+=Y,Q){let q=$.ctrlsSvc.getScrollFeature(),G=q.getVScrollPosition(),_=q.getHScrollPosition();Z+=_.left,X+=G.top}return{x:Z,y:X}}var cJ={moduleName:"Drag",version:p,beans:[gH]};var L1={moduleName:"SharedDragAndDrop",version:p,beans:[wG],dependsOn:[cJ],userComponents:{agDragAndDropImage:bH},icons:{columnMovePin:"pin",columnMoveHide:"eye-slash",columnMoveMove:"arrows",columnMoveLeft:"left",columnMoveRight:"right",columnMoveGroup:"group",columnMoveValue:"aggregation",columnMovePivot:"pivot",dropNotAllowed:"not-allowed",rowDrag:"grip"}};var B4={moduleName:"HorizontalResize",version:p,beans:[hH],dependsOn:[cJ]},uH=":where(.ag-ltr) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:left .2s}.ag-header-group-cell{transition:left .2s,width .2s}}:where(.ag-rtl) :where(.ag-column-moving){.ag-cell,.ag-header-cell,.ag-spanned-cell-wrapper{transition:right .2s}.ag-header-group-cell{transition:right .2s,width .2s}}",mH=class extends S{constructor(){super(...arguments);this.beanName="colAnimation",this.executeNextFuncs=[],this.executeLaterFuncs=[],this.active=!1,this.activeNext=!1,this.suppressAnimation=!1,this.animationThreadCount=0}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>this.gridBodyCtrl=$.gridBodyCtrl)}isActive(){return this.active&&!this.suppressAnimation}setSuppressAnimation($){this.suppressAnimation=$}start(){if(this.active)return;let{gos:$}=this;if($.get("suppressColumnMoveAnimation"))return;if($.get("enableRtl"))return;this.ensureAnimationCssClassPresent(),this.active=!0,this.activeNext=!0}finish(){if(!this.active)return;this.flush(()=>this.activeNext=!1,()=>this.active=!1)}executeNextVMTurn($){if(this.activeNext)this.executeNextFuncs.push($);else $()}executeLaterVMTurn($){if(this.active)this.executeLaterFuncs.push($);else $()}ensureAnimationCssClassPresent(){this.animationThreadCount++;let $=this.animationThreadCount,{gridBodyCtrl:z}=this;z.setColumnMovingCss(!0),this.executeLaterFuncs.push(()=>{if(this.animationThreadCount===$)z.setColumnMovingCss(!1)})}flush($,z){let{executeNextFuncs:Q,executeLaterFuncs:J}=this;if(Q.length===0&&J.length===0){$(),z();return}let Z=(X)=>{while(X.length){let Y=X.pop();if(Y)Y()}};this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{$(),Z(Q)},0),window.setTimeout(()=>{z(),Z(J)},200)})}};function cH($,z,Q){$.colMoves?.moveColumnByIndex(z,Q,"api")}function pH($,z,Q){$.colMoves?.moveColumns(z,Q,"api")}var iH=class extends S{constructor($){super();this.pinned=$,this.columnsToAggregate=[],this.columnsToGroup=[],this.columnsToPivot=[]}onDragEnter($){if(this.clearColumnsList(),this.gos.get("functionsReadOnly"))return;let z=$.dragItem.columns;if(!z)return;for(let Q of z){if(!Q.isPrimary())continue;if(Q.isAnyFunctionActive())continue;if(Q.isAllowValue())this.columnsToAggregate.push(Q);else if(Q.isAllowRowGroup())this.columnsToGroup.push(Q);else if(Q.isAllowPivot())this.columnsToPivot.push(Q)}}getIconName(){if(this.columnsToAggregate.length+this.columnsToGroup.length+this.columnsToPivot.length>0)return this.pinned?"pinned":"move";return null}onDragLeave($){this.clearColumnsList()}clearColumnsList(){this.columnsToAggregate.length=0,this.columnsToGroup.length=0,this.columnsToPivot.length=0}onDragging($){}onDragStop($){let{valueColsSvc:z,rowGroupColsSvc:Q,pivotColsSvc:J}=this.beans;if(this.columnsToAggregate.length>0)z?.addColumns(this.columnsToAggregate,"toolPanelDragAndDrop");if(this.columnsToGroup.length>0)Q?.addColumns(this.columnsToGroup,"toolPanelDragAndDrop");if(this.columnsToPivot.length>0)J?.addColumns(this.columnsToPivot,"toolPanelDragAndDrop")}onDragCancel(){this.clearColumnsList()}};function nH($,z){if(!z||z.length<=1)return;if(z.filter((J)=>$.indexOf(J)<0).length>0)return;z.sort((J,Z)=>{let X=$.indexOf(J),Y=$.indexOf(Z);return X-Y})}function dH($){let z=[...$];for(let Q of $){let J=null,Z=Q.getParent();while(Z!=null&&Z.getDisplayedLeafColumns().length===1)J=Z,Z=Z.getParent();if(J!=null){let Y=J.getColGroupDef()?.marryChildren?J.getProvidedColumnGroup().getLeafColumns():J.getLeafColumns();for(let q of Y)if(!z.includes(q))z.push(q)}}return z}function tH($,z,Q,J){let Z=J.allCols,X=null,Y=null;for(let q=0;q<$.length;q++){let G=$[q],_=Q.getProposedColumnOrder(z,G);if(!Q.doesOrderPassRules(_))continue;let H=_.filter((W)=>Z.includes(W));if(Y===null)Y=H;else if(!X0(H,Y))break;let U=rH(_);if(X===null||U=E)return;if(Q&&K<=E)return}let D=tH(B,W,_,H);if(!D)return;let F=D.move;if(F>G.getCols().length-W.length)return;return{columns:W,toIndex:F}}function W8($){let{columns:z,toIndex:Q}=U8($)||{},{finished:J,colMoves:Z}=$;if(!z||Q==null)return null;return Z.moveColumns(z,Q,"uiColumnMoved",J),J?null:{columns:z,toIndex:Q}}function sH($,z){let Q=z.getCols(),J=$.map((G)=>Q.indexOf(G)).sort((G,_)=>G-_),Z=J[0];return b(J)-Z!==J.length-1?null:Z}function rH($){function z(J){let Z=[],X=J.getOriginalParent();while(X!=null)Z.push(X),X=X.getOriginalParent();return Z}let Q=0;for(let J=0;J<$.length-1;J++){let Z=z($[J]),X=z($[J+1]);[Z,X]=Z.length>X.length?[Z,X]:[X,Z];for(let Y of Z)if(X.indexOf(Y)===-1)Q++}return Q}function lH($,z){switch(z){case"left":return $.leftCols;case"right":return $.rightCols;default:return $.centerCols}}function aH($){let{movingCols:z,draggingRight:Q,xPosition:J,pinned:Z,gos:X,colModel:Y,visibleCols:q}=$;if(X.get("suppressMovableColumns")||z.some((M)=>M.getColDef().suppressMovable))return[];let _=lH(q,Z),H=Y.getCols(),U=_.filter((M)=>z.includes(M)),W=_.filter((M)=>!z.includes(M)),B=H.filter((M)=>!z.includes(M)),E=0,K=J;if(Q){let M=0;for(let k of U)M+=k.getActualWidth();K-=M}if(K>0){for(let M=0;M0){let M=W[E-1];L=B.indexOf(M)+1}else if(L=B.indexOf(W[0]),L===-1)L=0;let D=[L],F=(M,k)=>M-k;if(Q){let M=L+1,k=H.length-1;while(M<=k)D.push(M),M++;D.sort(F)}else{let M=L,k=H.length-1,V=H[M];while(M<=k&&_.indexOf(V)<0)M++,D.push(M),V=H[M];M=L-1;let R=0;while(M>=R)D.push(M),M--;D.sort(F).reverse()}return D}function U2($){let{pinned:z,fromKeyboard:Q,gos:J,ctrlsSvc:Z,useHeaderRow:X,skipScrollPadding:Y}=$,q=Z.getHeaderRowContainerCtrl(z)?.eViewport,{x:G}=$;if(!q)return 0;if(Q)G-=q.getBoundingClientRect().left;if(J.get("enableRtl")){if(X)q=q.querySelector(".ag-header-row");G=q.clientWidth-G}if(z==null&&!Y)G+=Z.get("center").getCenterViewportScrollLeft();return G}function cZ($,z){for(let Q of $)Q.moving=z,Q.dispatchColEvent("movingChanged","uiColumnMoved")}var v5=7,W2=100,u1=W2/2,oH=5,eH=100,$U=class extends S{constructor($){super();this.pinned=$,this.needToMoveLeft=!1,this.needToMoveRight=!1,this.lastMovedInfo=null,this.isCenterContainer=!T($)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCon=$.gridBodyCtrl})}getIconName(){let{pinned:$,lastDraggingEvent:z}=this,{dragItem:Q}=z||{},J=Q?.columns??[];for(let Z of J){let X=Z.getPinned();if(Z.getColDef().lockPinned){if(X==$)return"move";continue}let Y=Q?.containerType;if(Y===$||!$)return"move";if($&&(!X||Y!==$))return"pinned"}return"notAllowed"}onDragEnter($){let z=$.dragItem,Q=z.columns;if($.dragSource.type===0)this.setColumnsVisible(Q,!0,"uiColumnDragged");else{let Z=z.visibleState,X=(Q||[]).filter((Y)=>Z[Y.getId()]&&!Y.isVisible());this.setColumnsVisible(X,!0,"uiColumnDragged")}if(!this.gos.get("suppressMoveWhenColumnDragging"))this.attemptToPinColumns(Q,this.pinned);this.onDragging($,!0,!0)}onDragging($=this.lastDraggingEvent,z=!1,Q=!1,J=!1){let{gos:Z,ctrlsSvc:X}=this.beans,Y=Z.get("suppressMoveWhenColumnDragging");if(J&&!Y){this.finishColumnMoving();return}if(this.lastDraggingEvent=$,!$||!J&&n($.hDirection))return;let q=U2({x:$.x,pinned:this.pinned,gos:Z,ctrlsSvc:X});if(!z)this.checkCenterForScrolling(q);if(Y)this.handleColumnDragWhileSuppressingMovement($,z,Q,q,J);else this.handleColumnDragWhileAllowingMovement($,z,Q,q,J)}onDragLeave(){this.ensureIntervalCleared(),this.clearHighlighted(),this.updateDragItemContainerType(),this.lastMovedInfo=null}onDragStop(){this.onDragging(this.lastDraggingEvent,!1,!0,!0),this.ensureIntervalCleared(),this.lastMovedInfo=null}onDragCancel(){this.clearHighlighted(),this.ensureIntervalCleared(),this.lastMovedInfo=null}setColumnsVisible($,z,Q){if(!$?.length)return;let J=$.filter((Z)=>!Z.getColDef().lockVisible);if(!J.length)return;this.beans.colModel.setColsVisible(J,z,Q)}finishColumnMoving(){this.clearHighlighted();let $=this.lastMovedInfo;if(!$)return;let{columns:z,toIndex:Q}=$;this.beans.colMoves.moveColumns(z,Q,"uiColumnMoved",!0)}updateDragItemContainerType(){let{lastDraggingEvent:$}=this;if(this.gos.get("suppressMoveWhenColumnDragging")||!$)return;let z=$.dragItem;if(!z)return;z.containerType=this.pinned}handleColumnDragWhileSuppressingMovement($,z,Q,J,Z){let X=this.getAllMovingColumns($,!0);if(Z){let Y=this.isAttemptingToPin(X);if(Y)this.attemptToPinColumns(X,void 0,!0);let{fromLeft:q,xPosition:G}=this.getNormalisedXPositionInfo(X,Y)||{};if(q==null||G==null){this.finishColumnMoving();return}this.moveColumnsAfterHighlight({allMovingColumns:X,xPosition:G,fromEnter:z,fakeEvent:Q,fromLeft:q})}else{if(!this.beans.dragAndDrop.isDropZoneWithinThisGrid($))return;this.highlightHoveredColumn(X,J)}}handleColumnDragWhileAllowingMovement($,z,Q,J,Z){let X=this.getAllMovingColumns($),Y=this.normaliseDirection($.hDirection)==="right",q=$.dragSource.type===1,G=this.getMoveColumnParams({allMovingColumns:X,isFromHeader:q,xPosition:J,fromLeft:Y,fromEnter:z,fakeEvent:Q}),_=W8({...G,finished:Z});if(_)this.lastMovedInfo=_}getAllMovingColumns($,z=!1){let Q=$.dragSource.getDragItem(),J=null;if(z){if(J=Q.columnsInSplit,!J)J=Q.columns}else J=Q.columns;let Z=(X)=>X.getColDef().lockPinned?X.getPinned()==this.pinned:!0;if(!J)return[];return J.filter(Z)}getMoveColumnParams($){let{allMovingColumns:z,isFromHeader:Q,xPosition:J,fromLeft:Z,fromEnter:X,fakeEvent:Y}=$,{gos:q,colModel:G,colMoves:_,visibleCols:H}=this.beans;return{allMovingColumns:z,isFromHeader:Q,fromLeft:Z,xPosition:J,pinned:this.pinned,fromEnter:X,fakeEvent:Y,gos:q,colModel:G,colMoves:_,visibleCols:H}}highlightHoveredColumn($,z){let{gos:Q,colModel:J}=this.beans,Z=Q.get("enableRtl"),X=J.getCols().filter((H)=>H.isVisible()&&H.getPinned()===this.pinned),Y=null,q=null,G=null;for(let H of X){if(q=H.getActualWidth(),Y=this.getNormalisedColumnLeft(H,0,Z),Y!=null){let U=Y+q;if(Y<=z&&U>=z){G=H;break}}Y=null,q=null}if(!G){for(let H=X.length-1;H>=0;H--){let U=X[H],W=X[H].getParent();if(!W){G=U;break}let B=W?.getDisplayedLeafColumns();if(B.length){G=b(B);break}}if(!G)return;Y=this.getNormalisedColumnLeft(G,0,Z),q=G.getActualWidth()}else if($.indexOf(G)!==-1)G=null;if(G==null||Y==null||q==null){if(this.lastHighlightedColumn?.column!==G)this.clearHighlighted();return}let _;if(z-Yv5;return z&&Q||$.some((J)=>J.getPinned()!==this.pinned)}moveColumnsAfterHighlight($){let{allMovingColumns:z,xPosition:Q,fromEnter:J,fakeEvent:Z,fromLeft:X}=$,Y=this.getMoveColumnParams({allMovingColumns:z,isFromHeader:!0,xPosition:Q,fromLeft:X,fromEnter:J,fakeEvent:Z}),{columns:q,toIndex:G}=U8(Y)||{};if(q&&G!=null)this.lastMovedInfo={columns:q,toIndex:G};this.finishColumnMoving()}clearHighlighted(){let{lastHighlightedColumn:$}=this;if(!$)return;I5($.column,null),this.lastHighlightedColumn=null}checkCenterForScrolling($){if(!this.isCenterContainer)return;let z=this.beans.ctrlsSvc.get("center"),Q=z.getCenterViewportScrollLeft(),J=Q+z.getCenterWidth(),Z,X;if(this.gos.get("enableRtl"))Z=$J-u1;else X=$J-u1;if(this.needToMoveRight=Z,this.needToMoveLeft=X,X||Z)this.ensureIntervalStarted();else this.ensureIntervalCleared()}ensureIntervalStarted(){if(this.movingIntervalId)return;this.intervalCount=0,this.failedMoveAttempts=0,this.movingIntervalId=window.setInterval(this.moveInterval.bind(this),eH),this.beans.dragAndDrop.setDragImageCompIcon(this.needToMoveLeft?"left":"right",!0)}ensureIntervalCleared(){if(!this.movingIntervalId)return;window.clearInterval(this.movingIntervalId),this.movingIntervalId=null,this.failedMoveAttempts=0,this.beans.dragAndDrop.setDragImageCompIcon(this.getIconName())}moveInterval(){let $;if(this.intervalCount++,$=10+this.intervalCount*oH,$>W2)$=W2;let z=null,Q=this.gridBodyCon.scrollFeature;if(this.needToMoveLeft)z=Q.scrollHorizontally(-$);else if(this.needToMoveRight)z=Q.scrollHorizontally($);if(z!==0)this.onDragging(this.lastDraggingEvent),this.failedMoveAttempts=0;else{this.failedMoveAttempts++;let{pinnedCols:J,dragAndDrop:Z,gos:X}=this.beans;if(this.failedMoveAttempts<=v5+1||!J)return;if(Z.setDragImageCompIcon("pinned"),!X.get("suppressMoveWhenColumnDragging")){let Y=this.lastDraggingEvent?.dragItem.columns;this.attemptToPinColumns(Y,void 0,!0)}}}getPinDirection(){if(this.needToMoveLeft||this.pinned==="left")return"left";if(this.needToMoveRight||this.pinned==="right")return"right"}attemptToPinColumns($,z,Q=!1){let J=($||[]).filter((Y)=>!Y.getColDef().lockPinned);if(!J.length)return 0;if(Q)z=this.getPinDirection();let{pinnedCols:Z,dragAndDrop:X}=this.beans;if(Z?.setColsPinned(J,z,"uiColumnDragged"),Q)X.nudge();return J.length}destroy(){super.destroy(),this.lastDraggingEvent=null,this.clearHighlighted(),this.lastMovedInfo=null}};function I5($,z){if($.highlighted===z)return;$.highlighted=z,$.dispatchColEvent("headerHighlightChanged","uiColumnMoved")}function zU($){let z=$.length,Q,J;for(let Z=0;Z{let Z,X=J.gridBodyCtrl.eBodyViewport;switch(Q){case"left":Z=[[X,J.left.eContainer],[J.bottomLeft.eContainer],[J.topLeft.eContainer]];break;case"right":Z=[[X,J.right.eContainer],[J.bottomRight.eContainer],[J.topRight.eContainer]];break;default:Z=[[X,J.center.eViewport],[J.bottomCenter.eViewport],[J.topCenter.eViewport]];break}this.eSecondaryContainers=Z}),this.moveColumnFeature=this.createManagedBean(new $U(Q)),this.bodyDropPivotTarget=this.createManagedBean(new iH(Q)),z.addDropTarget(this),this.addDestroyFunc(()=>z.removeDropTarget(this))}isInterestedIn($){return $===1||$===0&&this.gos.get("allowDragFromColumnsToolPanel")}getSecondaryContainers(){return this.eSecondaryContainers}getContainer(){return this.eContainer}getIconName(){return this.currentDropListener.getIconName()}isDropColumnInPivotMode($){return this.beans.colModel.isPivotMode()&&$.dragSource.type===0}onDragEnter($){this.currentDropListener=this.isDropColumnInPivotMode($)?this.bodyDropPivotTarget:this.moveColumnFeature,this.currentDropListener.onDragEnter($)}onDragLeave($){this.currentDropListener.onDragLeave($)}onDragging($){this.currentDropListener.onDragging($)}onDragStop($){this.currentDropListener.onDragStop($)}onDragCancel(){this.currentDropListener.onDragCancel()}};function B8($,z){let Q=[],J=[],Z=[];if($.forEach((Y)=>{let q=Y.getColDef().lockPosition;if(q==="right")Z.push(Y);else if(q==="left"||q===!0)Q.push(Y);else J.push(Y)}),z.get("enableRtl"))return[...Z,...J,...Q];return[...Q,...J,...Z]}function E8($,z){let Q=!0;return O$(null,z,(J)=>{if(!q0(J))return;let Z=J;if(!Z.getColGroupDef()?.marryChildren)return;let q=[];for(let W of Z.getLeafColumns()){let B=$.indexOf(W);q.push(B)}let G=Math.max.apply(Math,q),_=Math.min.apply(Math,q),H=G-_,U=Z.getLeafColumns().length-1;if(H>U)Q=!1}),Q}var JU=class extends S{constructor(){super(...arguments);this.beanName="colMoves"}moveColumnByIndex($,z,Q){let J=this.beans.colModel.getCols();if(!J)return;let Z=J[$];this.moveColumns([Z],z,Q)}moveColumns($,z,Q,J=!0){let{colModel:Z,colAnimation:X,visibleCols:Y,eventSvc:q}=this.beans,G=Z.getCols();if(!G)return;if(z>G.length-$.length){j(30,{toIndex:z});return}X?.start();let _=Z.getColsForKeys($);if(this.doesMovePassRules(_,z))H5(Z.getCols(),_,z),Y.refresh(Q),q.dispatchEvent({type:"columnMoved",columns:_,column:_.length===1?_[0]:null,toIndex:z,finished:J,source:Q});X?.finish()}doesMovePassRules($,z){let Q=this.getProposedColumnOrder($,z);return this.doesOrderPassRules(Q)}doesOrderPassRules($){let{colModel:z,gos:Q}=this.beans;if(!E8($,z.getColTree()))return!1;if(!((Z)=>{let X=(_)=>{if(!_)return 0;return _==="left"||_===!0?-1:1},Y=Q.get("enableRtl"),q=Y?1:-1,G=!0;for(let _ of Z){let H=X(_.getColDef().lockPosition);if(Y){if(H>q)G=!1}else if(Hq?"hide":"notAllowed",getDragItem:G?()=>YU(z,Y.allCols):()=>XU(z),dragItemName:Q,onDragStarted:()=>{q=!J.get("suppressDragLeaveHidesColumns"),cZ(_,!0)},onDragStopped:()=>cZ(_,!1),onDragCancelled:()=>cZ(_,!1),onGridEnter:(W)=>{if(q){let{columns:B=[],visibleState:E}=W??{},K=G?(D)=>!E||E[D.getColId()]:()=>!0,L=B.filter((D)=>!D.getColDef().lockVisible&&K(D));Z.setColsVisible(L,!0,"uiColumnMoved")}},onGridExit:(W)=>{if(q){let B=W?.columns?.filter((E)=>!E.getColDef().lockVisible)||[];Z.setColsVisible(B,!1,"uiColumnMoved")}}};return X.addDragSource(U,!0),U}};function ZU($,z){while($){if($.getGroupId()===z)return $;$=$.getParent()}return}function XU($){let z={};return z[$.getId()]=$.isVisible(),{columns:[$],visibleState:z,containerType:$.pinned}}function YU($,z){let Q=$.getProvidedColumnGroup().getLeafColumns(),J={};for(let q of Q)J[q.getId()]=q.isVisible();let Z=[];for(let q of z)if(Q.indexOf(q)>=0)Z.push(q),Z0(Q,q);for(let q of Q)Z.push(q);let X=[],Y=$.getLeafColumns();for(let q of Z)if(Y.indexOf(q)!==-1)X.push(q);return{columns:Z,columnsInSplit:X,visibleState:J,containerType:X[0]?.pinned}}var D1={moduleName:"ColumnMove",version:p,beans:[JU,mH],apiFunctions:{moveColumnByIndex:cH,moveColumns:pH},dependsOn:[L1],css:[uH]},qU=class extends S{constructor(){super(...arguments);this.beanName="autoWidthCalc"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.centerRowContainerCtrl=$.center})}getPreferredWidthForColumn($,z){let Q=this.getHeaderCellForColumn($);if(!Q)return-1;let J=this.beans.rowRenderer.getAllCellsNotSpanningForColumn($);if(!z)J.push(Q);return this.getPreferredWidthForElements(J)}getPreferredWidthForColumnGroup($){let z=this.getHeaderCellForColumn($);if(!z)return-1;return this.getPreferredWidthForElements([z])}getPreferredWidthForElements($,z){let Q=document.createElement("form");Q.style.position="fixed";let J=this.centerRowContainerCtrl.eContainer;for(let X of $)this.cloneItemIntoDummy(X,Q);J.appendChild(Q);let Z=Math.ceil(Q.getBoundingClientRect().width);return Q.remove(),z=z??this.gos.get("autoSizePadding"),Z+z}getHeaderCellForColumn($){let z=null;for(let Q of this.beans.ctrlsSvc.getHeaderRowContainerCtrls()){let J=Q.getHtmlElementForColumnHeader($);if(J!=null)z=J}return z}cloneItemIntoDummy($,z){let Q=$.cloneNode(!0);Q.style.width="",Q.style.position="static",Q.style.left="";let J=document.createElement("div"),Z=J.classList;if(["ag-header-cell","ag-header-group-cell"].some((q)=>Q.classList.contains(q)))Z.add("ag-header","ag-header-row"),J.style.position="static";else Z.add("ag-row");let Y=$.parentElement;while(Y){if(["ag-header-row","ag-row"].some((G)=>Y.classList.contains(G))){for(let G=0;GX.getPinned());$.dispatchEvent({type:"columnPinned",pinned:Z!=null?Z:null,columns:z,column:J,source:Q})}function _U($,z,Q){if(!z.length)return;let J=z.length===1?z[0]:null,Z=L8(z,(X)=>X.isVisible());$.dispatchEvent({type:"columnVisible",visible:Z,columns:z,column:J,source:Q})}function F8($,z,Q,J){$.dispatchEvent({type:z,columns:Q,column:Q&&Q.length==1?Q[0]:null,source:J})}function LQ($,z,Q,J,Z=null){if(z?.length)$.dispatchEvent({type:"columnResized",columns:z,column:z.length===1?z[0]:null,flexColumns:Z,finished:Q,source:J})}var HU=class extends S{constructor($,z,Q,J){super();this.comp=$,this.eResize=z,this.pinned=Q,this.columnGroup=J}postConstruct(){if(!this.columnGroup.isResizable()){this.comp.setResizableDisplayed(!1);return}let{horizontalResizeSvc:$,gos:z,colAutosize:Q}=this.beans,J=$.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if(this.addDestroyFunc(J),!z.get("suppressAutoSize")&&Q)this.addDestroyFunc(Q.addColumnGroupResize(this.eResize,this.columnGroup,()=>this.resizeLeafColumnsToFit("uiColumnResized")))}onResizeStart($){let{columnsToResize:z,resizeStartWidth:Q,resizeRatios:J,groupAfterColumns:Z,groupAfterStartWidth:X,groupAfterRatios:Y}=this.getInitialValues($);this.resizeCols=z,this.resizeStartWidth=Q,this.resizeRatios=J,this.resizeTakeFromCols=Z,this.resizeTakeFromStartWidth=X,this.resizeTakeFromRatios=Y,this.toggleColumnResizing(!0)}onResizing($,z,Q="uiColumnResized"){let J=this.normaliseDragChange(z),Z=this.resizeStartWidth+J;this.resizeColumnsFromLocalValues(Z,Q,$)}getInitialValues($){let z=(G)=>G.reduce((_,H)=>_+H.getActualWidth(),0),Q=(G,_)=>G.map((H)=>H.getActualWidth()/_),J=this.getColumnsToResize(),Z=z(J),X=Q(J,Z),Y={columnsToResize:J,resizeStartWidth:Z,resizeRatios:X},q=null;if($)q=this.beans.colGroupSvc?.getGroupAtDirection(this.columnGroup,"After")??null;if(q){let G=q.getDisplayedLeafColumns(),_=Y.groupAfterColumns=G.filter((U)=>U.isResizable()),H=Y.groupAfterStartWidth=z(_);Y.groupAfterRatios=Q(_,H)}else Y.groupAfterColumns=void 0,Y.groupAfterStartWidth=void 0,Y.groupAfterRatios=void 0;return Y}resizeLeafColumnsToFit($){let z=this.beans.autoWidthCalc.getPreferredWidthForColumnGroup(this.columnGroup),Q=this.getInitialValues();if(z>Q.resizeStartWidth)this.resizeColumns(Q,z,$,!0)}resizeColumnsFromLocalValues($,z,Q=!0){if(!this.resizeCols||!this.resizeRatios)return;let J={columnsToResize:this.resizeCols,resizeStartWidth:this.resizeStartWidth,resizeRatios:this.resizeRatios,groupAfterColumns:this.resizeTakeFromCols,groupAfterStartWidth:this.resizeTakeFromStartWidth,groupAfterRatios:this.resizeTakeFromRatios};this.resizeColumns(J,$,z,Q)}resizeColumns($,z,Q,J=!0){let{columnsToResize:Z,resizeStartWidth:X,resizeRatios:Y,groupAfterColumns:q,groupAfterStartWidth:G,groupAfterRatios:_}=$,H=[];if(H.push({columns:Z,ratios:Y,width:z}),q){let U=z-X;H.push({columns:q,ratios:_,width:G-U})}if(this.beans.colResize?.resizeColumnSets({resizeSets:H,finished:J,source:Q}),J)this.toggleColumnResizing(!1)}toggleColumnResizing($){this.comp.toggleCss("ag-column-resizing",$)}getColumnsToResize(){return this.columnGroup.getDisplayedLeafColumns().filter((z)=>z.isResizable())}normaliseDragChange($){let z=$;if(this.gos.get("enableRtl")){if(this.pinned!=="left")z*=-1}else if(this.pinned==="right")z*=-1;return z}destroy(){super.destroy(),this.resizeCols=void 0,this.resizeRatios=void 0,this.resizeTakeFromCols=void 0,this.resizeTakeFromRatios=void 0}},UU=class extends S{constructor($,z,Q,J,Z){super();this.pinned=$,this.column=z,this.eResize=Q,this.comp=J,this.ctrl=Z}postConstruct(){let $=[],z,Q,J=()=>{if(N(this.eResize,z),!z)return;let{horizontalResizeSvc:Y,colAutosize:q}=this.beans,G=Y.addResizeBar({eResizeBar:this.eResize,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this,!1),onResizeEnd:this.onResizing.bind(this,!0)});if($.push(G),Q&&q)$.push(q.addColumnAutosizeListeners(this.eResize,this.column))},Z=()=>{for(let Y of $)Y();$.length=0},X=()=>{let Y=this.column.isResizable(),q=!this.gos.get("suppressAutoSize")&&!this.column.getColDef().suppressAutoSize;if(Y!==z||q!==Q)z=Y,Q=q,Z(),J()};X(),this.addDestroyFunc(Z),this.ctrl.setRefreshFunction("resize",X)}onResizing($,z){let{column:Q,lastResizeAmount:J,resizeStartWidth:Z,beans:X}=this,Y=this.normaliseResizeAmount(z),q=Z+Y,G=[{key:Q,newWidth:q}],{pinnedCols:_,ctrlsSvc:H,colResize:U}=X;if(this.column.getPinned()){let W=_?.leftWidth??0,B=_?.rightWidth??0,E=xz(H.getGridBodyCtrl().eBodyViewport)-50;if(W+B+(Y-J)>E)return}if(this.lastResizeAmount=Y,U?.setColumnWidths(G,this.resizeWithShiftKey,$,"uiColumnResized"),$)this.toggleColumnResizing(!1)}onResizeStart($){this.resizeStartWidth=this.column.getActualWidth(),this.lastResizeAmount=0,this.resizeWithShiftKey=$,this.toggleColumnResizing(!0)}toggleColumnResizing($){this.column.resizing=$,this.comp.toggleCss("ag-column-resizing",$)}normaliseResizeAmount($){let z=$,Q=this.pinned!=="left",J=this.pinned==="right";if(this.gos.get("enableRtl")){if(Q)z*=-1}else if(J)z*=-1;return z}},WU=class extends S{constructor(){super(...arguments);this.beanName="colResize"}setColumnWidths($,z,Q,J){let Z=[],{colModel:X,gos:Y,visibleCols:q}=this.beans;for(let G of $){let _=X.getColDefCol(G.key)||X.getCol(G.key);if(!_)continue;if(Z.push({width:G.newWidth,ratios:[1],columns:[_]}),Y.get("colResizeDefault")==="shift")z=!z;if(z){let U=q.getColAfter(_);if(!U)continue;let W=_.getActualWidth()-G.newWidth,B=U.getActualWidth()+W;Z.push({width:B,ratios:[1],columns:[U]})}}if(Z.length===0)return;this.resizeColumnSets({resizeSets:Z,finished:Q,source:J})}resizeColumnSets($){let{resizeSets:z,finished:Q,source:J}=$;if(!(!z||z.every((H)=>BU(H)))){if(Q){let H=z&&z.length>0?z[0].columns:null;LQ(this.eventSvc,H,Q,J)}return}let X=[],Y=[];for(let H of z){let{width:U,columns:W,ratios:B}=H,E={},K={};for(let F of W)Y.push(F);let L=!0,D=0;while(L){if(D++,D>1000){e(31);break}L=!1;let F=[],M=0,k=U;W.forEach((R,O)=>{if(K[R.getId()])k-=E[R.getId()];else{F.push(R);let v=B[O];M+=v}});let V=1/M;F.forEach((R,O)=>{let I=O===F.length-1,v;if(I)v=k;else v=Math.round(B[O]*U*V),k-=v;let C=R.getMinWidth(),m=R.getMaxWidth();if(v0&&v>m)v=m,K[R.getId()]=!0,L=!0;E[R.getId()]=v})}for(let F of W){let M=E[F.getId()];if(F.getActualWidth()!==M)F.setActualWidth(M,J),X.push(F)}}let q=X.length>0,G=[];if(q){let{colFlex:H,visibleCols:U,colViewport:W}=this.beans;G=H?.refreshFlexedColumns({resizingCols:Y,skipSetLeft:!0})??[],U.setLeftValues(J),U.updateBodyWidths(),W.checkViewportColumns()}let _=Y.concat(G);if(q||Q)LQ(this.eventSvc,_,Q,J,G)}resizeHeader($,z,Q){if(!$.isResizable())return;let J=$.getActualWidth(),Z=$.getMinWidth(),X=$.getMaxWidth(),Y=Math.min(Math.max(J+z,Z),X);this.setColumnWidths([{key:$,newWidth:Y}],Q,!0,"uiColumnResized")}createResizeFeature($,z,Q,J,Z){return new UU($,z,Q,J,Z)}createGroupResizeFeature($,z,Q,J){return new HU($,z,Q,J)}};function BU($){let{columns:z,width:Q}=$,J=0,Z=0,X=!0;for(let G of z){let _=G.getMinWidth();J+=_||0;let H=G.getMaxWidth();if(H>0)Z+=H;else X=!1}let Y=Q>=J,q=!X||Q<=Z;return Y&&q}var EU={moduleName:"ColumnResize",version:p,beans:[WU],apiFunctions:{setColumnWidths:GU},dependsOn:[B4,K8]},KU=class extends S{constructor($,z){super();this.removeChildListenersFuncs=[],this.columnGroup=z,this.comp=$}postConstruct(){this.addListenersToChildrenColumns(),this.addManagedListeners(this.columnGroup,{displayedChildrenChanged:this.onDisplayedChildrenChanged.bind(this)}),this.onWidthChanged(),this.addDestroyFunc(this.removeListenersOnChildrenColumns.bind(this))}addListenersToChildrenColumns(){this.removeListenersOnChildrenColumns();let $=this.onWidthChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())z.__addEventListener("widthChanged",$),z.__addEventListener("visibleChanged",$),this.removeChildListenersFuncs.push(()=>{z.__removeEventListener("widthChanged",$),z.__removeEventListener("visibleChanged",$)})}removeListenersOnChildrenColumns(){for(let $ of this.removeChildListenersFuncs)$();this.removeChildListenersFuncs=[]}onDisplayedChildrenChanged(){this.addListenersToChildrenColumns(),this.onWidthChanged()}onWidthChanged(){let $=this.columnGroup.getActualWidth();this.comp.setWidth(`${$}px`),this.comp.toggleCss("ag-hidden",$===0)}},LU=class extends Y4{constructor(){super(...arguments);this.onSuppressColMoveChange=()=>{if(!this.isAlive()||this.isSuppressMoving())this.removeDragSource();else if(!this.dragSource)this.setDragSource(this.eGui)}}wireComp($,z,Q,J,Z){let{column:X,beans:Y}=this,{context:q,colNames:G,colHover:_,rangeSvc:H,colResize:U}=Y;this.comp=$,Z=B1(this,q,Z),this.setGui(z,Z),this.displayName=G.getDisplayNameForColumnGroup(X,"header"),this.refreshHeaderStyles(),this.addClasses(),this.setupMovingCss(Z),this.setupExpandable(Z),this.setupTooltip(),this.refreshAnnouncement(),this.setupAutoHeight({wrapperElement:J,compBean:Z}),this.setupUserComp(),this.addHeaderMouseListeners(Z,J),this.addManagedPropertyListener("groupHeaderHeight",this.refreshMaxHeaderHeight.bind(this)),this.refreshMaxHeaderHeight();let W=this.rowCtrl.pinned,B=X.getProvidedColumnGroup().getLeafColumns();if(_?.createHoverFeature(Z,B,z),H?.createRangeHighlightFeature(Z,X,$),Z.createManagedBean(new X4(X,z,Y)),Z.createManagedBean(new KU($,X)),U)this.resizeFeature=Z.createManagedBean(U.createGroupResizeFeature($,Q,W,X));else $.setResizableDisplayed(!1);Z.createManagedBean(new c$(z,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:()=>{return},handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)})),this.addHighlightListeners(Z,B),this.addManagedEventListeners({cellSelectionChanged:()=>this.refreshAnnouncement()}),Z.addManagedPropertyListener("suppressMovableColumns",this.onSuppressColMoveChange),this.addResizeAndMoveKeyboardListeners(Z),Z.addDestroyFunc(()=>this.clearComponent())}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.getDefinition();return y(z.gos,{colDef:Q,columnGroup:$,floatingFilter:!1})}refreshMaxHeaderHeight(){let{gos:$,comp:z}=this,Q=$.get("groupHeaderHeight");if(Q!=null)if(Q===0)z.setHeaderWrapperHidden(!0);else z.setHeaderWrapperMaxHeight(Q);else z.setHeaderWrapperHidden(!1),z.setHeaderWrapperMaxHeight(null)}addHighlightListeners($,z){if(!this.beans.gos.get("suppressMoveWhenColumnDragging"))return;for(let Q of z)$.addManagedListeners(Q,{headerHighlightChanged:this.onLeafColumnHighlightChanged.bind(this,Q)})}onLeafColumnHighlightChanged($){let z=this.column.getDisplayedLeafColumns(),Q=z[0]===$,J=b(z)===$;if(!Q&&!J)return;let Z=$.getHighlighted(),X=!!this.rowCtrl.getHeaderCellCtrls().find((G)=>{return G.column.isMoving()}),Y=!1,q=!1;if(X){let G=this.beans.gos.get("enableRtl"),_=Z===1,H=Z===0;if(Q)if(G)q=_;else Y=H;if(J)if(G)Y=H;else q=_}this.comp.toggleCss("ag-header-highlight-before",Y),this.comp.toggleCss("ag-header-highlight-after",q)}resizeHeader($,z){let{resizeFeature:Q}=this;if(!Q)return;let J=Q.getInitialValues(z);Q.resizeColumns(J,J.resizeStartWidth+$,"uiColumnResized",!0)}resizeLeafColumnsToFit($){this.resizeFeature?.resizeLeafColumnsToFit($)}setupUserComp(){let{colGroupSvc:$,userCompFactory:z,gos:Q,enterpriseMenuFactory:J}=this.beans,Z=this.column,X=Z.getProvidedColumnGroup(),Y=y(Q,{displayName:this.displayName,columnGroup:Z,setExpanded:(G)=>{$.setColumnGroupOpened(X,G,"gridInitializing")},setTooltip:(G,_)=>{Q.assertModuleRegistered("Tooltip",3),this.setupTooltip(G,_)},showColumnMenu:(G,_)=>J?.showMenuAfterButtonClick(X,G,"columnMenu",_),showColumnMenuAfterMouseClick:(G,_)=>J?.showMenuAfterMouseEvent(X,G,"columnMenu",_),eGridHeader:this.eGui}),q=TG(z,Y);if(q)this.comp.setUserCompDetails(q)}addHeaderMouseListeners($,z){let{column:Q,comp:J,beans:{rangeSvc:Z},gos:X}=this,Y=(H)=>this.handleMouseOverChange(H.type==="mouseenter"),q=()=>this.dispatchColumnMouseEvent("columnHeaderClicked",Q.getProvidedColumnGroup()),G=(H)=>this.handleContextMenuMouseEvent(H,void 0,Q.getProvidedColumnGroup());$.addManagedListeners(this.eGui,{mouseenter:Y,mouseleave:Y,click:q,contextmenu:G}),J.toggleCss("ag-header-group-cell-selectable",Jz(X));let _=Z?.createHeaderGroupCellMouseListenerFeature(this.column,z);if(_)this.createManagedBean(_)}handleMouseOverChange($){this.eventSvc.dispatchEvent({type:$?"columnHeaderMouseOver":"columnHeaderMouseLeave",column:this.column.getProvidedColumnGroup()})}setupTooltip($,z){this.tooltipFeature=this.beans.tooltipSvc?.setupHeaderGroupTooltip(this.tooltipFeature,this,$,z)}setupExpandable($){let z=this.column.getProvidedColumnGroup();this.refreshExpanded();let Q=this.refreshExpanded.bind(this);$.addManagedListeners(z,{expandedChanged:Q,expandableChanged:Q})}refreshExpanded(){let{column:$}=this;this.expandable=$.isExpandable();let z=$.isExpanded();if(this.expandable)this.comp.setAriaExpanded(z?"true":"false");else this.comp.setAriaExpanded(void 0);this.refreshHeaderStyles()}addClasses(){let{column:$}=this,z=$.getColGroupDef(),Q=gJ(z,this.gos,null,$);if($.isPadding()){if(Q.push("ag-header-group-cell-no-group"),$.getLeafColumns().every((Z)=>Z.isSpanHeaderHeight()))Q.push("ag-header-span-height")}else if(Q.push("ag-header-group-cell-with-group"),z?.wrapHeaderText)Q.push("ag-header-cell-wrap-text");for(let J of Q)this.comp.toggleCss(J,!0)}setupMovingCss($){let{column:z}=this,J=z.getProvidedColumnGroup().getLeafColumns(),Z=()=>this.comp.toggleCss("ag-header-cell-moving",z.isMoving());for(let X of J)$.addManagedListeners(X,{movingChanged:Z});Z()}onFocusIn($){if(!this.eGui.contains($.relatedTarget))this.focusThis(),this.announceAriaDescription()}handleKeyDown($){if(super.handleKeyDown($),!this.getWrapperHasFocus())return;let{column:Q,expandable:J,gos:Z,beans:X}=this,Y=Jz(Z);if($.key!=A.ENTER)return;if(Y&&!$.altKey)X.rangeSvc?.handleColumnSelection(Q,$);else if(J){let q=!Q.isExpanded();X.colGroupSvc.setColumnGroupOpened(Q.getProvidedColumnGroup(),q,"uiColumnExpanded")}}refreshAnnouncement(){let $,{gos:z}=this;if(Jz(z))$=this.getLocaleTextFunc()("ariaColumnGroupCellSelection","Press Enter to toggle selection for all visible cells in this column group");this.ariaAnnouncement=$}announceAriaDescription(){let{beans:$,eGui:z,ariaAnnouncement:Q}=this;if(!Q||!z.contains(d($)))return;$.ariaAnnounce?.announceValue(Q,"columnHeader")}setDragSource($){if(!this.isAlive()||this.isSuppressMoving())return;if(this.removeDragSource(),!$)return;this.dragSource=this.beans.colMoves?.setDragSourceForHeader($,this.column,this.displayName)??null}isSuppressMoving(){return this.gos.get("suppressMovableColumns")||this.column.getLeafColumns().some(($)=>$.getColDef().suppressMovable||$.getColDef().lockPosition)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),super.destroy()}};function DU($,z,Q){$.colGroupSvc?.setColumnGroupOpened(z,Q,"api")}function FU($,z,Q){return $.colGroupSvc?.getColumnGroup(z,Q)??null}function MU($,z){return $.colGroupSvc?.getProvidedColGroup(z)??null}function kU($,z,Q){return $.colNames.getDisplayNameForColumnGroup(z,Q)||""}function VU($){return $.colGroupSvc?.getColumnGroupState()??[]}function AU($,z){$.colGroupSvc?.setColumnGroupState(z,"api")}function SU($){$.colGroupSvc?.resetColumnGroupState("api")}function RU($){return $.visibleCols.treeLeft}function jU($){return $.visibleCols.treeCenter}function fU($){return $.visibleCols.treeRight}function OU($){return $.visibleCols.getAllTrees()}var M8=class{constructor(){this.existingIds={}}getInstanceIdForKey($){let z=this.existingIds[$],Q;if(typeof z!=="number")Q=0;else Q=z+1;return this.existingIds[$]=Q,Q}};function PU($,z){for(let Q=0;Q=0)$[J]=$[$.length-1],$.pop()}}var TU=class extends S{constructor(){super(...arguments);this.beanName="visibleCols",this.colsAndGroupsMap={},this.leftCols=[],this.rightCols=[],this.centerCols=[],this.allCols=[],this.headerGroupRowCount=0,this.bodyWidth=0,this.leftWidth=0,this.rightWidth=0,this.isBodyWidthDirty=!0}refresh($,z=!1){let{colFlex:Q,colModel:J,colGroupSvc:Z,colViewport:X,selectionColSvc:Y}=this.beans;if(!z)this.buildTrees(J,Z);Z?.updateOpenClosedVisibility(),this.leftCols=pZ(this.treeLeft),this.centerCols=pZ(this.treeCenter),this.rightCols=pZ(this.treeRight),Y?.refreshVisibility(this.leftCols,this.centerCols,this.rightCols),this.joinColsAriaOrder(J),this.joinCols(),this.headerGroupRowCount=this.getHeaderRowCount(),this.setLeftValues($),this.autoHeightCols=this.allCols.filter((q)=>q.isAutoHeight()),Q?.refreshFlexedColumns(),this.updateBodyWidths(),this.setFirstRightAndLastLeftPinned(J,this.leftCols,this.rightCols,$),X.checkViewportColumns(!1),this.eventSvc.dispatchEvent({type:"displayedColumnsChanged",source:$})}getHeaderRowCount(){if(!this.gos.get("hidePaddedHeaderRows"))return this.beans.colModel.cols.treeDepth;let $=0;for(let z of this.allCols){let Q=z.getParent();while(Q){if(!Q.isPadding()){let J=Q.getProvidedColumnGroup().getLevel()+1;if(J>$)$=J;break}Q=Q.getParent()}}return $}updateBodyWidths(){let $=N$(this.centerCols),z=N$(this.leftCols),Q=N$(this.rightCols);if(this.isBodyWidthDirty=this.bodyWidth!==$,this.bodyWidth!==$||this.leftWidth!==z||this.rightWidth!==Q)this.bodyWidth=$,this.leftWidth=z,this.rightWidth=Q,this.eventSvc.dispatchEvent({type:"columnContainerWidthChanged"}),this.eventSvc.dispatchEvent({type:"displayedColumnsWidthChanged"})}setLeftValues($){this.setLeftValuesOfCols($),this.setLeftValuesOfGroups()}setFirstRightAndLastLeftPinned($,z,Q,J){let Z,X;if(this.gos.get("enableRtl"))Z=z?z[0]:null,X=Q?b(Q):null;else Z=z?b(z):null,X=Q?Q[0]:null;for(let Y of $.getCols())Y.setLastLeftPinned(Y===Z,J),Y.setFirstRightPinned(Y===X,J)}buildTrees($,z){let Q=$.getColsToShow(),J=Q.filter((G)=>G.getPinned()=="left"),Z=Q.filter((G)=>G.getPinned()=="right"),X=Q.filter((G)=>G.getPinned()!="left"&&G.getPinned()!="right"),Y=new M8,q=(G)=>{return z?z.createColumnGroups(G):G.columns};this.treeLeft=q({columns:J,idCreator:Y,pinned:"left",oldDisplayedGroups:this.treeLeft}),this.treeRight=q({columns:Z,idCreator:Y,pinned:"right",oldDisplayedGroups:this.treeRight}),this.treeCenter=q({columns:X,idCreator:Y,pinned:null,oldDisplayedGroups:this.treeCenter}),this.updateColsAndGroupsMap()}clear(){this.leftCols=[],this.rightCols=[],this.centerCols=[],this.allCols=[],this.ariaOrderColumns=[]}joinColsAriaOrder($){let z=$.getCols(),Q=[],J=[],Z=[];for(let X of z){let Y=X.getPinned();if(!Y)J.push(X);else if(Y===!0||Y==="left")Q.push(X);else Z.push(X)}this.ariaOrderColumns=Q.concat(J).concat(Z)}getAriaColIndex($){let z;if(H0($))z=$.getLeafColumns()[0];else z=$;return this.ariaOrderColumns.indexOf(z)+1}setLeftValuesOfGroups(){for(let $ of[this.treeLeft,this.treeRight,this.treeCenter])for(let z of $)if(H0(z))z.checkLeft()}setLeftValuesOfCols($){let{colModel:z}=this.beans;if(!z.getColDefCols())return;let J=z.getCols().slice(0),Z=this.gos.get("enableRtl");for(let X of[this.leftCols,this.rightCols,this.centerCols]){if(Z){let Y=N$(X);for(let q of X)Y-=q.getActualWidth(),q.setLeft(Y,$)}else{let Y=0;for(let q of X)q.setLeft(Y,$),Y+=q.getActualWidth()}PU(J,X)}for(let X of J)X.setLeft(null,$)}joinCols(){if(this.gos.get("enableRtl"))this.allCols=this.rightCols.concat(this.centerCols).concat(this.leftCols);else this.allCols=this.leftCols.concat(this.centerCols).concat(this.rightCols)}getAllTrees(){if(this.treeLeft&&this.treeRight&&this.treeCenter)return this.treeLeft.concat(this.treeCenter).concat(this.treeRight);return null}isColDisplayed($){return this.allCols.indexOf($)>=0}getLeftColsForRow($){let{leftCols:z,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return z;return this.getColsForRow($,z)}getRightColsForRow($){let{rightCols:z,beans:{colModel:Q}}=this;if(!Q.colSpanActive)return z;return this.getColsForRow($,z)}getColsForRow($,z,Q,J){let Z=[],X=null;for(let Y=0;Y1){let W=_-1;for(let B=1;B<=W;B++)H.push(z[Y+B]);Y+=W}let U;if(Q){U=!1;for(let W of H)if(Q(W))U=!0}else U=!0;if(U){if(Z.length===0&&X){if(J?J(q):!1)Z.push(X)}Z.push(q)}X=q}return Z}getContainerWidth($){switch($){case"left":return this.leftWidth;case"right":return this.rightWidth;default:return this.bodyWidth}}getColBefore($){let z=this.allCols,Q=z.indexOf($);if(Q>0)return z[Q-1];return null}isPinningLeft(){return this.leftCols.length>0}isPinningRight(){return this.rightCols.length>0}updateColsAndGroupsMap(){this.colsAndGroupsMap={};let $=(z)=>{this.colsAndGroupsMap[z.getUniqueId()]=z};yz(this.treeCenter,!1,$),yz(this.treeLeft,!1,$),yz(this.treeRight,!1,$)}isVisible($){return this.colsAndGroupsMap[$.getUniqueId()]===$}getFirstColumn(){let $=this.gos.get("enableRtl"),z=["leftCols","centerCols","rightCols"];if($)z.reverse();for(let Q=0;Q{if(Q$(Q))z.push(Q)}),z}var vU=class extends S{constructor(){super(...arguments);this.beanName="colGroupSvc"}getColumnGroupState(){let $=[],z=this.beans.colModel.getColTree();return O$(null,z,(Q)=>{if(q0(Q))$.push({groupId:Q.getGroupId(),open:Q.isExpanded()})}),$}resetColumnGroupState($){let z=this.beans.colModel.getColDefColTree();if(!z)return;let Q=[];O$(null,z,(J)=>{if(q0(J)){let Z=J.getColGroupDef(),X={groupId:J.getGroupId(),open:!Z?void 0:Z.openByDefault};Q.push(X)}}),this.setColumnGroupState(Q,$)}setColumnGroupState($,z){let{colModel:Q,colAnimation:J,visibleCols:Z,eventSvc:X}=this.beans;if(!Q.getColTree().length)return;J?.start();let q=[];for(let G of $){let{groupId:_,open:H}=G,U=this.getProvidedColGroup(_);if(!U)continue;if(U.isExpanded()===H)continue;U.setExpanded(H),q.push(U)}if(Z.refresh(z,!0),q.length)X.dispatchEvent({type:"columnGroupOpened",columnGroup:q.length===1?q[0]:void 0,columnGroups:q});J?.finish()}setColumnGroupOpened($,z,Q){let J;if(q0($))J=$.getId();else J=$||"";this.setColumnGroupState([{groupId:J,open:z}],Q)}getProvidedColGroup($){let z=null;return O$(null,this.beans.colModel.getColTree(),(Q)=>{if(q0(Q)){if(Q.getId()===$)z=Q}}),z}getGroupAtDirection($,z){let Q=$.getProvidedColumnGroup().getLevel()+$.getPaddingLevel(),J=$.getDisplayedLeafColumns(),Z=z==="After"?b(J):J[0],X=`getCol${z}`;while(!0){let Y=this.beans.visibleCols[X](Z);if(!Y)return null;let q=this.getColGroupAtLevel(Y,Q);if(q!==$)return q}}getColGroupAtLevel($,z){let Q=$.getParent(),J,Z;while(!0){if(J=Q.getProvidedColumnGroup().getLevel(),Z=Q.getPaddingLevel(),J+Z<=z)break;Q=Q.getParent()}return Q}updateOpenClosedVisibility(){let $=this.beans.visibleCols.getAllTrees();yz($,!1,(z)=>{if(H0(z))z.calculateDisplayedColumns()})}getColumnGroup($,z){if(!$)return null;if(H0($))return $;let Q=this.beans.visibleCols.getAllTrees(),J=typeof z==="number",Z=null;return yz(Q,!1,(X)=>{if(H0(X)){let Y=X,q;if(J)q=$===Y.getGroupId()&&z===Y.getPartId();else q=$===Y.getGroupId();if(q)Z=Y}}),Z}createColumnGroups($){let{columns:z,idCreator:Q,pinned:J,oldDisplayedGroups:Z,isStandaloneStructure:X}=$,Y=this.mapOldGroupsById(Z),q=[],G=z;while(G.length){let _=G;G=[];let H=0,U=(W)=>{let B=H;H=W;let E=_[B],L=(H0(E)?E.getProvidedColumnGroup():E).getOriginalParent();if(L==null){for(let F=B;Fq0(H))){G.setChildren([Y]);continue}else{G.setChildren($);break}Z.push(Y)}}return Z}findDepth($){let z=0,Q=$;while(Q?.[0]&&q0(Q[0]))z++,Q=Q[0].getChildren();return z}findMaxDepth($,z){let Q=z;for(let J=0;J<$.length;J++){let Z=$[J];if(q0(Z)){let X=Z,Y=this.findMaxDepth(X.getChildren(),z+1);if(Q=0;X--){let Y=new Cz(null,`FAKE_PATH_${J.getId()}_${X}`,!0,X);this.createBean(Y),Y.setChildren([Z]),Z.originalParent=Y,Z=Y}if(z===0)J.originalParent=null;Q.push(Z)}return Q}findExistingGroup($,z){if($.groupId==null)return;for(let J=0;J{for(let Z of J)if(H0(Z)){let X=Z;z[Z.getUniqueId()]=X,Q(X.getChildren())}};if($)Q($);return z}setupParentsIntoCols($,z){for(let Q of $??[]){if(Q.parent!==z)this.beans.colViewport.colsWithinViewportHash="";if(Q.parent=z,H0(Q)){let J=Q;this.setupParentsIntoCols(J.getChildren(),J)}}}},E4={moduleName:"ColumnGroup",version:p,dynamicBeans:{headerGroupCellCtrl:LU},beans:[vU],apiFunctions:{getAllDisplayedColumnGroups:OU,getCenterDisplayedColumnGroups:jU,getColumnGroup:FU,getColumnGroupState:VU,getDisplayNameForColumnGroup:kU,getLeftDisplayedColumnGroups:RU,getProvidedColumnGroup:MU,getRightDisplayedColumnGroups:fU,resetColumnGroupState:SU,setColumnGroupOpened:DU,setColumnGroupState:AU}};function n0($,z,Q){let{colModel:J,rowGroupColsSvc:Z,pivotColsSvc:X,autoColSvc:Y,selectionColSvc:q,colAnimation:G,visibleCols:_,pivotResultCols:H,environment:U,valueColsSvc:W,eventSvc:B,gos:E}=$,K=J.getColDefCols()??[],L=q?.getColumns();if(!K.length&&!L?.length)return!1;if(z?.state&&!z.state.forEach)return j(32),!1;let D=(V,R,O,I,v)=>{if(!V)return;let C=$G(R,z.defaultState),m=C("flex").value1,w=C("sort").value1,a=C("sortType").value1,t=Zz(w)||m2(a),u=L$(a),$0=IJ(w),s=t?{type:u,direction:$0}:void 0;if(L7($,V,C("hide").value1,s,C("sortIndex").value1,C("pinned").value1,m,Q),m==null){let f0=C("width").value1;if(f0!=null){let O0=V.getColDef().minWidth??U.getDefaultColumnMinWidth();if(O0!=null&&f0>=O0)V.setActualWidth(f0,Q)}}if(v||!V.isPrimary())return;W?.syncColumnWithState(V,Q,C),Z?.syncColumnWithState(V,Q,C,O),X?.syncColumnWithState(V,Q,C,I)},F=(V,R,O)=>{let I=V8($,Q),v=R.slice(),C={},m={},w=[],a=[],t=[],u=0,$0=Z?.columns.slice()??[],s=X?.columns.slice()??[];for(let k0 of V){let Sz=k0.colId;if(Sz.startsWith(uz)){w.push(k0),t.push(k0);continue}if(I$(Sz)){a.push(k0),t.push(k0);continue}let oz=O(Sz);if(!oz)t.push(k0),u+=1;else D(oz,k0,C,m,!1),Z0(v,oz)}let f0=(k0)=>D(k0,null,C,m,!1);v.forEach(f0),Z?.sortColumns(b5.bind(Z,C,$0)),X?.sortColumns(b5.bind(X,m,s)),J.refreshCols(!1,Q);let O0=(k0,Sz,kZ=[])=>{for(let oz of Sz){let G5=k0(oz.colId);Z0(kZ,G5),D(G5,oz,null,null,!0)}kZ.forEach(f0)};return O0((k0)=>Y?.getColumn(k0)??null,w,Y?.getColumns()?.slice()),O0((k0)=>q?.getColumn(k0)??null,a,q?.getColumns()?.slice()),IU(z,J,E),_.refresh(Q),B.dispatchEvent({type:"columnEverythingChanged",source:Q}),I(),{unmatchedAndAutoStates:t,unmatchedCount:u}};G?.start();let{unmatchedAndAutoStates:M,unmatchedCount:k}=F(z.state||[],K,(V)=>J.getColDefCol(V));if(M.length>0||T(z.defaultState)){let V=H?.getPivotResultCols()?.list??[];k=F(M,V,(R)=>H?.getPivotResultCol(R)??null).unmatchedCount}return G?.finish(),k===0}function k8($,z){let{colModel:Q,autoColSvc:J,selectionColSvc:Z,eventSvc:X,gos:Y}=$,q=Q.getColDefCols();if(!q?.length)return;let G=Q.getColDefColTree(),_=CJ(G),H=[],U=1000,W=1000,B=(F)=>{let M=A8(F);if(n(M.rowGroupIndex)&&M.rowGroup)M.rowGroupIndex=U++;if(n(M.pivotIndex)&&M.pivot)M.pivotIndex=W++;H.push(M)};J?.getColumns()?.forEach(B),Z?.getColumns()?.forEach(B),_?.forEach(B),n0($,{state:H},z);let E=J?.getColumns()??[],D=[...Z?.getColumns()??[],...E,...q].map((F)=>({colId:F.colId}));n0($,{state:D,applyOrder:!0},z),X.dispatchEvent(y(Y,{type:"columnsReset",source:z}))}function V8($,z){let{rowGroupColsSvc:Q,pivotColsSvc:J,valueColsSvc:Z,colModel:X,sortSvc:Y,eventSvc:q}=$,G={rowGroupColumns:Q?.columns.slice()??[],pivotColumns:J?.columns.slice()??[],valueColumns:Z?.columns.slice()??[]},_=C5($),H={};for(let U of _)H[U.colId]=U;return()=>{let U=(R,O,I,v)=>{let C=O.map(v),m=I.map(v);if(X0(C,m))return;let a=new Set(O);for(let u of I)if(!a.delete(u))a.add(u);let t=[...a];q.dispatchEvent({type:R,columns:t,column:t.length===1?t[0]:null,source:z})},W=(R)=>{let O=[];return X.forAllCols((I)=>{let v=H[I.getColId()];if(v&&R(v,I))O.push(I)}),O},B=(R)=>R.getColId();U("columnRowGroupChanged",G.rowGroupColumns,Q?.columns??[],B),U("columnPivotChanged",G.pivotColumns,J?.columns??[],B);let K=W((R,O)=>{let I=R.aggFunc!=null,v=I!=O.isValueActive(),C=I&&R.aggFunc!=O.getAggFunc();return v||C});if(K.length>0)F8(q,"columnValueChanged",K,z);LQ(q,W((R,O)=>R.width!=O.getActualWidth()),!0,z),D8(q,W((R,O)=>R.pinned!=O.getPinned()),z),_U(q,W((R,O)=>R.hide==O.isVisible()),z);let k=W((R,O)=>!t1(O.getSortDef(),{type:L$(R.sortType),direction:IJ(R.sort)})||R.sortIndex!=O.getSortIndex());if(k.length>0)Y?.dispatchSortChangedEvents(z,k);let V=C5($);bU(_,V,z,X,q)}}function C5($){let{colModel:z,rowGroupColsSvc:Q,pivotColsSvc:J}=$,Z=z.getColDefCols();if(n(Z)||!z.isAlive())return[];let X=Q?.columns,Y=J?.columns,q=[],G=(H)=>{let U=H.isRowGroupActive()&&X?X.indexOf(H):null,W=H.isPivotActive()&&Y?Y.indexOf(H):null,B=H.isValueActive()?H.getAggFunc():null,E=H.getSortIndex()!=null?H.getSortIndex():null;q.push({colId:H.getColId(),width:H.getActualWidth(),hide:!H.isVisible(),pinned:H.getPinned(),sort:H.getSort(),sortType:H.getSortDef()?.type,sortIndex:E,aggFunc:B,rowGroup:H.isRowGroupActive(),rowGroupIndex:U,pivot:H.isPivotActive(),pivotIndex:W,flex:H.getFlex()??null})};z.forAllCols((H)=>G(H));let _=new Map(z.getCols().map((H,U)=>[H.getColId(),U]));return q.sort((H,U)=>{let W=_.has(H.colId)?_.get(H.colId):-1,B=_.has(U.colId)?_.get(U.colId):-1;return W-B}),q}function A8($){let z=(L,D)=>L!=null?L:D!=null?D:null,Q=$.getColDef(),J=a0(z(Q.sort,Q.initialSort)),Z=J.direction,X=J.type,Y=z(Q.sortIndex,Q.initialSortIndex),q=z(Q.hide,Q.initialHide),G=z(Q.pinned,Q.initialPinned),_=z(Q.width,Q.initialWidth),H=z(Q.flex,Q.initialFlex),U=z(Q.rowGroupIndex,Q.initialRowGroupIndex),W=z(Q.rowGroup,Q.initialRowGroup);if(U==null&&!W)U=null,W=null;let B=z(Q.pivotIndex,Q.initialPivotIndex),E=z(Q.pivot,Q.initialPivot);if(B==null&&!E)B=null,E=null;let K=z(Q.aggFunc,Q.initialAggFunc);return{colId:$.getColId(),sort:Z,sortType:X,sortIndex:Y,hide:q,pinned:G,width:_,flex:H,rowGroup:W,rowGroupIndex:U,pivot:E,pivotIndex:B,aggFunc:K}}function IU($,z,Q){if(!$.applyOrder||!$.state)return;let J=[];for(let Z of $.state)if(Z.colId!=null)J.push(Z.colId);CU(z.cols,J,z,Q)}function CU($,z,Q,J){if($==null)return;let Z=[],X={};for(let q of z){if(X[q])continue;let G=$.map[q];if(G)Z.push(G),X[q]=!0}let Y=0;for(let q of $.list){let G=q.getColId();if(X[G]!=null)continue;if(G.startsWith(uz))Z.splice(Y++,0,q);else Z.push(q)}if(Z=B8(Z,J),!E8(Z,Q.getColTree())){j(39);return}$.list=Z}function bU($,z,Q,J,Z){let X={};for(let H of z)X[H.colId]=H;let Y={};for(let H of $)if(X[H.colId])Y[H.colId]=!0;let q=$.filter((H)=>Y[H.colId]),G=z.filter((H)=>Y[H.colId]),_=[];if(G.forEach((H,U)=>{let W=q?.[U];if(W&&W.colId!==H.colId){let B=J.getCol(W.colId);if(B)_.push(B)}}),!_.length)return;Z.dispatchEvent({type:"columnMoved",columns:_,column:_.length===1?_[0]:null,finished:!0,source:Q})}var b5=($,z,Q,J)=>{let Z=$[Q.getId()],X=$[J.getId()],Y=Z!=null,q=X!=null;if(Y&&q)return Z-X;if(Y)return-1;if(q)return 1;let G=z.indexOf(Q),_=z.indexOf(J),H=G>=0,U=_>=0;if(H&&U)return G-_;if(H)return-1;return 1},yU=class extends S{constructor(){super(...arguments);this.beanName="colModel",this.pivotMode=!1,this.ready=!1,this.changeEventsDispatching=!1}postConstruct(){this.pivotMode=this.gos.get("pivotMode"),this.addManagedPropertyListeners(["groupDisplayType","treeData","treeDataDisplayType","groupHideOpenParents","groupHideColumnsUntilExpanded","rowNumbers","hidePaddedHeaderRows"],($)=>this.refreshAll(Xz($.source))),this.addManagedPropertyListeners(["defaultColDef","defaultColGroupDef","columnTypes","suppressFieldDotNotation"],this.recreateColumnDefs.bind(this)),this.addManagedPropertyListener("pivotMode",($)=>this.setPivotMode(this.gos.get("pivotMode"),Xz($.source)))}createColsFromColDefs($){let{beans:z}=this,{valueCache:Q,colAutosize:J,rowGroupColsSvc:Z,pivotColsSvc:X,valueColsSvc:Y,visibleCols:q,eventSvc:G,groupHierarchyColSvc:_}=z,H=this.colDefs?V8(z,$):void 0;Q?.expire();let U=this.colDefCols?.list,W=this.colDefCols?.tree,B=p2(z,this.colDefs,!0,W,$);J$(z,this.colDefCols?.tree,B.columnTree);let{columnTree:E,treeDepth:K}=B,L=CJ(E),D={};for(let F of L)D[F.getId()]=F;if(this.colDefCols={tree:E,treeDepth:K,list:L,map:D},this.createColumnsForService([_],this.colDefCols,$),Z?.extractCols($,U),X?.extractCols($,U),Y?.extractCols($,U),this.ready=!0,this.changeEventsDispatching=!0,this.refreshCols(!0,$),this.changeEventsDispatching=!1,q.refresh($),G.dispatchEvent({type:"columnEverythingChanged",source:$}),H)this.changeEventsDispatching=!0,H(),this.changeEventsDispatching=!1;if(G.dispatchEvent({type:"newColumnsLoaded",source:$}),$==="gridInitializing")J?.applyAutosizeStrategy()}refreshCols($,z){if(!this.colDefCols)return;let Q=this.cols?.tree;this.saveColOrder();let{autoColSvc:J,selectionColSvc:Z,rowNumbersSvc:X,quickFilter:Y,pivotResultCols:q,showRowGroupCols:G,rowAutoHeight:_,visibleCols:H,colViewport:U,eventSvc:W,formula:B}=this.beans,E=this.selectCols(q,this.colDefCols);B?.setFormulasActive(E),this.createColumnsForService([J,Z,X],E,z);let K=bq(this.gos,this.showingPivotResult);if(!$||K)this.restoreColOrder(E);if(this.positionLockedCols(E),G?.refresh(),Y?.refreshCols(),this.setColSpanActive(),_?.setAutoHeightActive(E),H.clear(),U.clear(),!X0(Q,this.cols.tree))W.dispatchEvent({type:"gridColumnsChanged"})}createColumnsForService($,z,Q){for(let J of $){if(!J)continue;J.createColumns(z,(Z)=>{this.lastOrder=Z(this.lastOrder),this.lastPivotOrder=Z(this.lastPivotOrder)},Q),J.addColumns(z)}}selectCols($,z){let Q=$?.getPivotResultCols()??null;this.showingPivotResult=Q!=null;let{map:J,list:Z,tree:X,treeDepth:Y}=Q??z;if(this.cols={list:Z.slice(),map:{...J},tree:X.slice(),treeDepth:Y},Q){if(!Q.list.some((G)=>this.cols?.map[G.getColId()]!==void 0))this.lastPivotOrder=null}return this.cols}getColsToShow(){if(!this.cols)return[];let{beans:$,showingPivotResult:z,cols:Q}=this,{valueColsSvc:J,selectionColSvc:Z,gos:X}=$,Y=this.isPivotMode()&&!z,q=Z?.isSelectionColumnEnabled(),G=yq($),_=J?.columns,H=g2(X);return Q.list.filter((W)=>{let B=mz(W);if(Y)return _?.includes(W)||B&&(!H||W.isVisible())||q&&I$(W)||G&&v0(W);else return B&&!H||W.isVisible()})}refreshAll($){if(!this.ready)return;this.refreshCols(!1,$),this.beans.visibleCols.refresh($)}setColsVisible($,z=!1,Q){n0(this.beans,{state:$.map((J)=>({colId:typeof J==="string"?J:J.getColId(),hide:!z}))},Q)}restoreColOrder($){let z=this.showingPivotResult?this.lastPivotOrder:this.lastOrder;if(!z)return;let Q=z.filter((U)=>$.map[U.getId()]!=null);if(Q.length===0)return;if(Q.length===$.list.length){$.list=Q;return}let J=(U)=>{let W=U.getOriginalParent();if(!W)return!1;if(W.getChildren().length>1)return!0;return J(W)};if(!Q.some((U)=>J(U))){let U=new Set(Q);for(let W of $.list)if(!U.has(W))Q.push(W);$.list=Q;return}let Z=new Map;for(let U=0;U!Z.has(U));if(X.length===0){$.list=Q;return}let Y=(U,W)=>{let B=W?W.getOriginalParent():U.getOriginalParent();if(!B)return null;let E=null,K=null;for(let L of B.getChildren()){if(L===W||L===U)continue;if(L instanceof q$){let D=Z.get(L);if(D==null)continue;if(E==null||E{let F=Z.get(D);if(F==null)return;if(E==null||E=0;U--)_[H--]=q[U];for(let U=Q.length-1;U>=0;U--){let W=Q[U],B=G.get(W);if(B)if(Array.isArray(B))for(let E=B.length-1;E>=0;E--){let K=B[E];_[H--]=K}else _[H--]=B;_[H--]=W}$.list=_}positionLockedCols($){$.list=B8($.list,this.gos)}saveColOrder(){if(this.showingPivotResult)this.lastPivotOrder=this.cols?.list??null;else this.lastOrder=this.cols?.list??null}getColumnDefs($){return this.colDefCols&&this.beans.colDefFactory?.getColumnDefs(this.colDefCols.list,this.showingPivotResult,this.lastOrder,this.cols?.list??[],$)}setColSpanActive(){this.colSpanActive=!!this.cols?.list.some(($)=>$.getColDef().colSpan!=null)}isPivotMode(){return this.pivotMode}setPivotMode($,z){if($===this.pivotMode)return;if(this.pivotMode=$,!this.ready)return;this.refreshCols(!1,z);let{visibleCols:Q,eventSvc:J}=this.beans;Q.refresh(z),J.dispatchEvent({type:"columnPivotModeChanged"})}isPivotActive(){let $=this.beans.pivotColsSvc?.columns;return this.pivotMode&&!!$?.length}recreateColumnDefs($){if(!this.cols)return;this.beans.autoColSvc?.updateColumns($);let z=Xz($.source);this.createColsFromColDefs(z)}setColumnDefs($,z){this.colDefs=$,this.createColsFromColDefs(z)}destroy(){J$(this.beans,this.colDefCols?.tree),super.destroy()}getColTree(){return this.cols?.tree??[]}getColDefColTree(){return this.colDefCols?.tree??[]}getColDefCols(){return this.colDefCols?.list??null}getCols(){return this.cols?.list??[]}forAllCols($){let{pivotResultCols:z,autoColSvc:Q,selectionColSvc:J,groupHierarchyColSvc:Z}=this.beans;if(IQ(this.colDefCols?.list,$))return;if(IQ(Q?.columns?.list,$))return;if(IQ(J?.columns?.list,$))return;if(IQ(Z?.columns?.list,$))return;if(IQ(z?.getPivotResultCols()?.list,$))return}getColsForKeys($){if(!$)return[];return $.map((z)=>this.getCol(z)).filter((z)=>z!=null)}getColDefCol($){if(!this.colDefCols?.list)return null;return this.getColFromCollection($,this.colDefCols)}getCol($){if($==null)return null;return this.getColFromCollection($,this.cols)}getColById($){return this.cols?.map[$]??null}getColFromCollection($,z){if(z==null)return null;let{map:Q,list:J}=z;if(typeof $=="string"&&Q[$])return Q[$];for(let q=0;q$(this.getValue())}),this}getWidth(){return this.getGui().clientWidth}setWidth($){return f$(this.getGui(),$),this}getPreviousValue(){return this.previousValue}getValue(){return this.value}setValue($,z){if(this.value===$)return this;if(this.previousValue=this.value,this.value=$,!z)this.dispatchLocalEvent({type:"fieldValueChanged"});return this}};function gU($){return{tag:"div",role:"presentation",children:[{tag:"div",ref:"eLabel",cls:"ag-input-field-label"},{tag:"div",ref:"eWrapper",cls:"ag-wrapper ag-input-wrapper",role:"presentation",children:[{tag:$,ref:"eInput",cls:"ag-input-field-input"}]}]}}var S8=class extends NU{constructor($,z,Q="text",J="input"){super($,$?.template??gU(J),[],z);this.inputType=Q,this.displayFieldTag=J,this.eLabel=f,this.eWrapper=f,this.eInput=f}postConstruct(){super.postConstruct(),this.setInputType(this.inputType);let{eLabel:$,eWrapper:z,eInput:Q,className:J}=this;$.classList.add(`${J}-label`),z.classList.add(`${J}-input-wrapper`),Q.classList.add(`${J}-input`),this.addCss("ag-input-field"),Q.id=Q.id||`ag-${this.getCompId()}-input`;let{inputName:Z,inputWidth:X,inputPlaceholder:Y,autoComplete:q,tabIndex:G}=this.config;if(Z!=null)this.setInputName(Z);if(X!=null)this.setInputWidth(X);if(Y!=null)this.setInputPlaceholder(Y);if(q!=null)this.setAutoComplete(q);this.addInputListeners(),this.activateTabIndex([Q],G)}addInputListeners(){this.addManagedElementListeners(this.eInput,{input:($)=>this.setValue($.target.value)})}setInputType($){if(this.displayFieldTag==="input")this.inputType=$,Pz(this.eInput,"type",$)}getInputElement(){return this.eInput}getWrapperElement(){return this.eWrapper}setInputWidth($){return u6(this.eWrapper,$),this}setInputName($){return this.getInputElement().setAttribute("name",$),this}getFocusableElement(){return this.eInput}setMaxLength($){let z=this.eInput;return z.maxLength=$,this}setInputPlaceholder($){return Pz(this.eInput,"placeholder",$),this}setInputAriaLabel($){return E0(this.eInput,$),this.refreshAriaLabelledBy(),this}setDisabled($){return T2(this.eInput,$),super.setDisabled($)}setAutoComplete($){if($===!0)Pz(this.eInput,"autocomplete",null);else{let z=typeof $==="string"?$:"off";Pz(this.eInput,"autocomplete",z)}return this}},K4=class extends S8{constructor($,z="ag-checkbox",Q="checkbox"){super($,z,Q);this.labelAlignment="right",this.selected=!1,this.readOnly=!1,this.passive=!1}postConstruct(){super.postConstruct();let{readOnly:$,passive:z,name:Q}=this.config;if(typeof $==="boolean")this.setReadOnly($);if(typeof z==="boolean")this.setPassive(z);if(Q!=null)this.setName(Q)}addInputListeners(){this.addManagedElementListeners(this.eInput,{click:this.onCheckboxClick.bind(this)}),this.addManagedElementListeners(this.eLabel,{click:this.toggle.bind(this)})}getNextValue(){return this.selected===void 0?!0:!this.selected}setPassive($){this.passive=$}isReadOnly(){return this.readOnly}setReadOnly($){this.eWrapper.classList.toggle("ag-disabled",$),this.eInput.disabled=$,this.readOnly=$}setDisabled($){return this.eWrapper.classList.toggle("ag-disabled",$),super.setDisabled($)}toggle(){if(this.eInput.disabled)return;let $=this.isSelected(),z=this.getNextValue();if(this.passive)this.dispatchChange(z,$);else this.setValue(z)}getValue(){return this.isSelected()}setValue($,z){return this.refreshSelectedClass($),this.setSelected($,z),this}setName($){let z=this.getInputElement();return z.name=$,this}isSelected(){return this.selected}setSelected($,z){if(this.isSelected()===$)return;this.previousValue=this.isSelected(),$=this.selected=typeof $==="boolean"?$:void 0;let Q=this.eInput;if(Q.checked=$,Q.indeterminate=$===void 0,!z)this.dispatchChange(this.selected,this.previousValue)}dispatchChange($,z,Q){this.dispatchLocalEvent({type:"fieldValueChanged",selected:$,previousValue:z,event:Q});let J=this.getInputElement();this.eventSvc.dispatchEvent({type:"checkboxChanged",id:J.id,name:J.name,selected:$,previousValue:z})}onCheckboxClick($){if(this.passive||this.eInput.disabled)return;let z=this.isSelected(),Q=this.selected=$.target.checked;this.refreshSelectedClass(Q),this.dispatchChange(Q,z,$)}refreshSelectedClass($){let z=this.eWrapper.classList;z.toggle("ag-checked",$===!0),z.toggle("ag-indeterminate",$==null)}},y$={selector:"AG-CHECKBOX",component:K4},hU=".ag-checkbox-cell{height:100%}",uU={tag:"div",cls:"ag-cell-wrapper ag-checkbox-cell",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},mU=class extends x{constructor(){super(uU,[y$]);this.eCheckbox=f,this.registerCSS(hU)}init($){this.refresh($);let{eCheckbox:z,beans:Q}=this,J=z.getInputElement();J.setAttribute("tabindex","-1"),R6(J,"polite"),this.addManagedListeners(J,{click:(Z)=>{if(i0(Z),z.isDisabled())return;let X=z.getValue();this.onCheckboxChanged(X)},dblclick:(Z)=>{i0(Z)}}),this.addManagedElementListeners($.eGridCell,{keydown:(Z)=>{if(Z.key===A.SPACE&&!z.isDisabled()){if($.eGridCell===d(Q))z.toggle();let X=z.getValue();this.onCheckboxChanged(X),Z.preventDefault()}}})}refresh($){return this.params=$,this.updateCheckbox($),!0}updateCheckbox($){let z,Q=!0,{value:J,column:Z,node:X}=$;if(X.group&&Z)if(typeof J==="boolean")z=J;else{let U=Z.getColId();if(U.startsWith(uz))z=J==null||J===""?void 0:J==="true";else if(X.aggData&&X.aggData[U]!==void 0)z=J??void 0;else if(X.sourceRowIndex>=0)z=J??void 0;else Q=!1}else z=J??void 0;let{eCheckbox:Y}=this;if(!Q){Y.setDisplayed(!1);return}Y.setValue(z);let q=$.disabled??!Z?.isCellEditable(X);Y.setDisabled(q);let G=this.getLocaleTextFunc(),_=O2(G,z),H=q?_:`${G("ariaToggleCellValue","Press SPACE to toggle cell value")} (${_})`;Y.setInputAriaLabel(H)}onCheckboxChanged($){let{params:z}=this,{column:Q,node:J,value:Z}=z,{editSvc:X}=this.beans;if(!Q)return;let Y={rowNode:J,column:Q};X?.dispatchCellEvent(Y,null,"cellEditingStarted",{value:Z});let q=J.setDataValue(Q,$,"ui");if(X?.dispatchCellEvent(Y,null,"cellEditingStopped",{oldValue:Z,newValue:$,valueChanged:q}),!q)this.updateCheckbox(z)}},cU={tag:"div",cls:"ag-skeleton-container"},pU=class extends x{constructor(){super(cU)}init($){let z=`ag-cell-skeleton-renderer-${this.getCompId()}`;if(this.getGui().setAttribute("id",z),this.addDestroyFunc(()=>pQ($.eParentOfValue)),pQ($.eParentOfValue,z),$.deferRender)this.setupLoading($);else if($.node.failedLoad)this.setupFailed();else this.setupLoading($)}setupFailed(){let $=this.getLocaleTextFunc();this.getGui().textContent=$("loadingError","ERR");let z=$("ariaSkeletonCellLoadingFailed","Row failed to load");E0(this.getGui(),z)}setupLoading($){let z=J0({tag:"div",cls:"ag-skeleton-effect"}),Q=$.node.rowIndex;if(Q!=null){let X=75+25*(Q%2===0?Math.sin(Q):Math.cos(Q));z.style.width=`${X}%`}this.getGui().appendChild(z);let J=this.getLocaleTextFunc(),Z=$.deferRender?J("ariaDeferSkeletonCellLoading","Cell is loading"):J("ariaSkeletonCellLoading","Row data is loading");E0(this.getGui(),Z)}refresh($){return!1}},iU={moduleName:"CheckboxCellRenderer",version:p,userComponents:{agCheckboxCellRenderer:mU}},nU={moduleName:"SkeletonCellRenderer",version:p,userComponents:{agSkeletonCellRenderer:pU}};var dU=class extends S{constructor(){super(...arguments);this.beanName="colFlex",this.columnsHidden=!1}refreshFlexedColumns($={}){let z=$.source??"flex";if($.viewportWidth!=null)this.flexViewportWidth=$.viewportWidth;let Q=this.flexViewportWidth,{visibleCols:J,colDelayRenderSvc:Z}=this.beans,X=J.centerCols,Y=-1;if($.resizingCols){let K=new Set($.resizingCols);for(let L=X.length-1;L>=0;L--)if(K.has(X[L])){Y=L;break}}let q=!1,G=X.map((K,L)=>{let D=K.getFlex(),F=D!=null&&D>0&&L>Y;return q||(q=F),{col:K,isFlex:F,flex:Math.max(0,D??0),initialSize:K.getActualWidth(),min:K.getMinWidth(),max:K.getMaxWidth(),targetSize:0}});if(q)Z?.hideColumns("colFlex"),this.columnsHidden=!0;else if(this.columnsHidden)this.revealColumns(Z);if(!Q||!q)return[];let _=G.length,H=G.reduce((K,L)=>K+L.flex,0),U=Q,W=(K,L)=>{K.frozenSize=L,K.col.setActualWidth(L,z),U-=L,H-=K.flex,_-=1},B=(K)=>K.frozenSize!=null;for(let K of G)if(!K.isFlex)W(K,K.initialSize);while(_>0){let K=Math.round(H<1?U*H:U),L,D=0,F=0;for(let V of G){if(B(V))continue;L=V,F+=K*(V.flex/H);let R=F-D,O=Math.round(R);V.targetSize=O,D+=O}if(L)L.targetSize+=K-D;let M=0;for(let V of G){if(B(V))continue;let R=V.targetSize,O=Math.min(Math.max(R,V.min),V.max);M+=O-R,V.violationType=O===R?void 0:O0?"min":"max";for(let V of G){if(B(V))continue;if(k==="all"||V.violationType===k)W(V,V.targetSize)}}if(!$.skipSetLeft)J.setLeftValues(z);if($.updateBodyWidths)J.updateBodyWidths();let E=G.filter((K)=>K.isFlex&&!K.violationType).map((K)=>K.col);if($.fireResizedEvent){let K=G.filter((D)=>D.initialSize!==D.frozenSize).map((D)=>D.col),L=G.filter((D)=>D.flex).map((D)=>D.col);LQ(this.eventSvc,K,!0,z,L)}return this.revealColumns(Z),E}revealColumns($){if(this.columnsHidden)$?.revealColumns("colFlex"),this.columnsHidden=!1}initCol($){let{flex:z,initialFlex:Q}=$.colDef;if(z!==void 0)$.flex=z;else if(Q!==void 0)$.flex=Q}setColFlex($,z){$.flex=z??null,$.dispatchStateUpdatedEvent("flex")}},Gz=($)=>{if(typeof $==="bigint")return $;let z;if(typeof $==="number")z=$;else if(typeof $==="string"){if(z=$.trim(),z==="")return null;if(z.endsWith("n"))z=z.slice(0,-1);if(!/^[+-]?\d+$/.test(z))return null}if(z==null)return null;try{return BigInt(z)}catch{return null}},L4="T",tU=new RegExp(`[${L4} ]`),sU=new RegExp(`^\\d{4}-\\d{2}-\\d{2}(${L4}\\d{2}:\\d{2}:\\d{2}\\D?)?`);function fz($,z){return $.toString().padStart(z,"0")}function y5($,z=!0,Q=L4){if(!$)return null;let J=[$.getFullYear(),$.getMonth()+1,$.getDate()].map((Z)=>fz(Z,2)).join("-");if(z)J+=Q+[$.getHours(),$.getMinutes(),$.getSeconds()].map((Z)=>fz(Z,2)).join(":");return J}function ZQ($,z=!0){if(!$)return null;if(z)return[String($.getFullYear()),String($.getMonth()+1),fz($.getDate(),2),fz($.getHours(),2),`:${fz($.getMinutes(),2)}`,`:${fz($.getSeconds(),2)}`];return[$.getFullYear(),$.getMonth()+1,fz($.getDate(),2)].map(String)}var D4=["January","February","March","April","May","June","July","August","September","October","November","December"];function r1($,z=!1){return!!eQ($,z)}function rU($){return r1($,!0)}function eQ($,z=!1,Q){if(!$)return null;if(!Q&&!sU.test($))return null;let[J,Z]=$.split(tU);if(!J)return null;let X=J.split("-").map((B)=>Number.parseInt(B,10));if(X.filter((B)=>!isNaN(B)).length!==3)return null;let[Y,q,G]=X,_=new Date(Y,q-1,G);if(_.getFullYear()!==Y||_.getMonth()!==q-1||_.getDate()!==G)return null;if(!Z&&z)return null;if(!Z||Z==="00:00:00")return _;let[H,U,W]=Z.split(":").map((B)=>Number.parseInt(B,10));if(H>=0&&H<24)_.setHours(H);else if(z)return null;if(U>=0&&U<60)_.setMinutes(U);else if(z)return null;if(W>=0&&W<60)_.setSeconds(W);else if(z)return null;return _}function hQ($,z,Q){if(!z||!$)return;if(!Q)return $[z];let J=z.split("."),Z=$;for(let X=0;Xnull,suppressKeyboardEvent:({node:$,event:z,column:Q})=>z.key===A.SPACE&&Q.isCellEditable($)}},date({formatValue:$}){return{cellEditor:"agDateCellEditor",keyCreator:$}},dateString({formatValue:$}){return{cellEditor:"agDateStringCellEditor",keyCreator:$}},dateTime($){return this.date($)},dateTimeString($){return this.dateString($)},object({formatValue:$,colModel:z,colId:Q}){return{cellEditorParams:{useFormatter:!0},comparator:(J,Z)=>{let X=z.getColDefCol(Q),Y=X?.getColDef();if(!X||!Y)return 0;let q=J==null?"":$({column:X,node:null,value:J}),G=Z==null?"":$({column:X,node:null,value:Z});if(q===G)return 0;return q>G?1:-1},keyCreator:$}},text(){return{}}}}wireBeans($){this.colModel=$.colModel}postConstruct(){this.processDataTypeDefinitions(),this.addManagedPropertyListener("dataTypeDefinitions",($)=>{this.processDataTypeDefinitions(),this.colModel.recreateColumnDefs($)})}processDataTypeDefinitions(){let $=this.getDefaultDataTypes(),z={},Q={},J=(H)=>{return(U)=>{let{column:W,node:B,value:E}=U,K=W.getColDef().valueFormatter;if(K===H.groupSafeValueFormatter)K=H.valueFormatter;return this.beans.valueSvc.formatValue(W,B,E,K)}};for(let H of Object.keys($)){let U=$[H],W={...U,groupSafeValueFormatter:N5(U,this.gos)};z[H]=W,Q[H]=J(W)}let Z=this.gos.get("dataTypeDefinitions")??{},X={};for(let H of Object.keys(Z)){let U=Z[H],W=this.processDataTypeDefinition(U,Z,[H],$);if(W){if(z[H]=W,U.dataTypeMatcher)X[H]=U.dataTypeMatcher;Q[H]=J(W)}}let{valueParser:Y,valueFormatter:q}=$.object,{valueParser:G,valueFormatter:_}=z.object;this.hasObjectValueParser=G!==Y,this.hasObjectValueFormatter=_!==q,this.formatValueFuncs=Q,this.dataTypeDefinitions=z,this.dataTypeMatchers=this.sortKeysInMatchers(X,$)}sortKeysInMatchers($,z){let Q={...$};for(let J of lU)delete Q[J],Q[J]=$[J]??z[J].dataTypeMatcher;return Q}processDataTypeDefinition($,z,Q,J){let Z,X=$.extendsDataType;if($.columnTypes)this.isColumnTypeOverrideInDataTypeDefinitions=!0;if($.extendsDataType===$.baseDataType){let Y=J[X],q=z[X];if(Y&&q)Y=q;if(!w5($,Y,X))return;Z=x5(Y,$)}else{if(Q.includes(X)){j(44);return}let Y=z[X];if(!w5($,Y,X))return;let q=this.processDataTypeDefinition(Y,z,[...Q,X],J);if(!q)return;Z=x5(q,$)}return{...Z,groupSafeValueFormatter:N5(Z,this.gos)}}updateColDefAndGetColumnType($,z,Q){let{cellDataType:J}=z;if(J===void 0)J=$.cellDataType;let{field:Z}=z;if(J==null||J===!0)J=this.canInferCellDataType($,z)?this.inferCellDataType(Z,Q):!1;if(this.addFormulaCellEditorToColDef($,z),!J){$.cellDataType=!1;return}let X=this.dataTypeDefinitions[J];if(!X){j(47,{cellDataType:J});return}if($.cellDataType=J,X.groupSafeValueFormatter)$.valueFormatter=X.groupSafeValueFormatter;if(X.valueParser)$.valueParser=X.valueParser;if(!X.suppressDefaultProperties)this.setColDefPropertiesForBaseDataType($,J,X,Q);return X.columnTypes}addFormulaCellEditorToColDef($,z){if(!(z.allowFormula??$.allowFormula)||z.cellEditor)return;$.cellEditor="agFormulaCellEditor"}addColumnListeners($){if(!this.isPendingInference)return;let z=this.columnStateUpdatesPendingInference[$.getColId()];if(!z)return;let Q=(J)=>{z.add(J.key)};$.__addEventListener("columnStateUpdated",Q),this.columnStateUpdateListenerDestroyFuncs.push(()=>$.__removeEventListener("columnStateUpdated",Q))}canInferCellDataType($,z){let{gos:Q}=this;if(!o(Q))return!1;let J={cellRenderer:!0,valueGetter:!0,valueParser:!0,refData:!0};if(iZ(z,J))return!1;let Z=z.type===null?$.type:z.type;if(Z){let X=Q.get("columnTypes")??{};if(XJ(Z).some((q)=>{let G=X[q.trim()];return G&&iZ(G,J)}))return!1}return!iZ($,J)}inferCellDataType($,z){if(!$)return;let Q,J=this.getInitialData();if(J){let X=$.includes(".")&&!this.gos.get("suppressFieldDotNotation");Q=hQ(J,$,X)}else this.initWaitForRowData(z);if(Q==null)return;return Object.keys(this.dataTypeMatchers).find((X)=>this.dataTypeMatchers[X](Q))??"object"}getInitialData(){let $=this.gos.get("rowData");if($?.length)return $[0];else if(this.initialData)return this.initialData;else{let z=this.beans.rowModel.rootNode?._leafs;if(z?.length)return z[0].data}return null}initWaitForRowData($){if(this.columnStateUpdatesPendingInference[$]=new Set,this.isPendingInference)return;this.isPendingInference=!0;let z=this.isColumnTypeOverrideInDataTypeDefinitions,{colAutosize:Q,eventSvc:J}=this.beans;if(z&&Q)Q.shouldQueueResizeOperations=!0;let[Z]=this.addManagedEventListeners({rowDataUpdateStarted:(X)=>{let{firstRowData:Y}=X;if(!Y)return;if(Z?.(),this.isPendingInference=!1,this.processColumnsPendingInference(Y,z),this.columnStateUpdatesPendingInference={},z)Q?.processResizeOperations();J.dispatchEvent({type:"dataTypesInferred"})}})}processColumnsPendingInference($,z){this.initialData=$;let Q=[];this.destroyColumnStateUpdateListeners();let J={},Z={};for(let X of Object.keys(this.columnStateUpdatesPendingInference)){let Y=this.columnStateUpdatesPendingInference[X],q=this.colModel.getCol(X);if(!q)continue;let G=q.getColDef();if(!this.resetColDefIntoCol(q,"cellDataTypeInferred"))continue;let _=q.getColDef();if(z&&_.type&&_.type!==G.type){let H=JW(q,Y);if(H.rowGroup&&H.rowGroupIndex==null)J[X]=H;if(H.pivot&&H.pivotIndex==null)Z[X]=H;Q.push(H)}}if(z)Q.push(...this.generateColumnStateForRowGroupAndPivotIndexes(J,Z));if(Q.length)n0(this.beans,{state:Q},"cellDataTypeInferred");this.initialData=null}generateColumnStateForRowGroupAndPivotIndexes($,z){let Q={},{rowGroupColsSvc:J,pivotColsSvc:Z}=this.beans;return J?.restoreColumnOrder(Q,$),Z?.restoreColumnOrder(Q,z),Object.values(Q)}resetColDefIntoCol($,z){let Q=$.getUserProvidedColDef();if(!Q)return!1;let J=u$(this.beans,Q,$.getColId());return $.setColDef(J,Q,z),!0}getDateStringTypeDefinition($){let{dateString:z}=this.dataTypeDefinitions;if(!$)return z;return this.getDataTypeDefinition($)??z}getDateParserFunction($){return this.getDateStringTypeDefinition($).dateParser}getDateFormatterFunction($){return this.getDateStringTypeDefinition($).dateFormatter}getDateIncludesTimeFlag($){return $==="dateTime"||$==="dateTimeString"}getDataTypeDefinition($){let z=$.getColDef();if(!z.cellDataType)return;return this.dataTypeDefinitions[z.cellDataType]}getBaseDataType($){return this.getDataTypeDefinition($)?.baseDataType}checkType($,z){if(z==null)return!0;let Q=this.getDataTypeDefinition($)?.dataTypeMatcher;if(!Q)return!0;if($.getColDef().allowFormula&&this.beans.formula?.isFormula(z))return!0;return Q(z)}validateColDef($,z,Q,J){if($.cellDataType==="object"){let Z=(G)=>{return G?.cellDataType==null||G?.cellDataType===!0},X=Z(z)&&Z(Q),Y=(G)=>j(48,{property:G,inferred:X,colId:J}),{object:q}=this.dataTypeDefinitions;if($.valueFormatter===q.groupSafeValueFormatter&&!this.hasObjectValueFormatter)Y("Formatter");if($.editable&&$.valueParser===q.valueParser&&!this.hasObjectValueParser)Y("Parser")}}postProcess($){let z=$.cellDataType;if(!z||typeof z!=="string")return;let{dataTypeDefinitions:Q,beans:J,formatValueFuncs:Z}=this,X=Q[z];if(!X)return;J.colFilter?.setColDefPropsForDataType($,X,Z[z])}getFormatValue($){return this.formatValueFuncs[$]}isColPendingInference($){return this.isPendingInference&&!!this.columnStateUpdatesPendingInference[$]}setColDefPropertiesForBaseDataType($,z,Q,J){let Z=this.formatValueFuncs[z],X=this.columnDefinitionPropsPerDataType[Q.baseDataType]({colDef:$,cellDataType:z,colModel:this.colModel,dataTypeDefinition:Q,colId:J,formatValue:Z,filterModuleBean:this.beans.filterManager});if($.cellEditor==="agFormulaCellEditor"&&X.cellEditor!==$.cellEditor)X.cellEditor=$.cellEditor;Object.assign($,X)}getDateObjectTypeDef($){let z=this.getLocaleTextFunc(),Q=this.getDateIncludesTimeFlag($);return{baseDataType:$,valueParser:(J)=>eQ(J.newValue&&String(J.newValue)),valueFormatter:(J)=>{if(J.value==null)return"";if(!(J.value instanceof Date)||isNaN(J.value.getTime()))return z("invalidDate","Invalid Date");return y5(J.value,Q)??""},dataTypeMatcher:(J)=>J instanceof Date}}getDateStringTypeDef($){let z=this.getDateIncludesTimeFlag($);return{baseDataType:$,dateParser:(Q)=>eQ(Q)??void 0,dateFormatter:(Q)=>y5(Q??null,z)??void 0,valueParser:(Q)=>r1(String(Q.newValue))?Q.newValue:null,valueFormatter:(Q)=>r1(String(Q.value))?String(Q.value):"",dataTypeMatcher:(Q)=>typeof Q==="string"&&r1(Q)}}getDefaultDataTypes(){let $=this.getLocaleTextFunc();return{number:{baseDataType:"number",valueParser:(z)=>z.newValue?.trim?.()===""?null:Number(z.newValue),valueFormatter:(z)=>{if(z.value==null)return"";if(typeof z.value!=="number"||isNaN(z.value))return $("invalidNumber","Invalid Number");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="number"},bigint:{baseDataType:"bigint",valueParser:(z)=>{let{newValue:Q}=z;if(Q==null)return null;if(typeof Q==="string"&&Q.trim()==="")return null;return Gz(Q)},valueFormatter:(z)=>{if(z.value==null)return"";if(typeof z.value!=="bigint")return $("invalidBigInt","Invalid BigInt");return String(z.value)},dataTypeMatcher:(z)=>typeof z==="bigint"},text:{baseDataType:"text",valueParser:(z)=>z.newValue===""?null:cQ(z.newValue),dataTypeMatcher:(z)=>typeof z==="string"},boolean:{baseDataType:"boolean",valueParser:(z)=>{if(z.newValue==null)return z.newValue;return z.newValue?.trim?.()===""?null:String(z.newValue).toLowerCase()==="true"},valueFormatter:(z)=>z.value==null?"":String(z.value),dataTypeMatcher:(z)=>typeof z==="boolean"},date:this.getDateObjectTypeDef("date"),dateString:this.getDateStringTypeDef("dateString"),dateTime:this.getDateObjectTypeDef("dateTime"),dateTimeString:{...this.getDateStringTypeDef("dateTimeString"),dataTypeMatcher:(z)=>typeof z==="string"&&rU(z)},object:{baseDataType:"object",valueParser:()=>null,valueFormatter:(z)=>cQ(z.value)??""}}}destroyColumnStateUpdateListeners(){for(let $ of this.columnStateUpdateListenerDestroyFuncs)$();this.columnStateUpdateListenerDestroyFuncs=[]}destroy(){this.dataTypeDefinitions={},this.dataTypeMatchers={},this.formatValueFuncs={},this.columnStateUpdatesPendingInference={},this.destroyColumnStateUpdateListeners(),super.destroy()}};function x5($,z){let Q={...$,...z};if($.columnTypes&&z.columnTypes&&z.appendColumnTypes)Q.columnTypes=[...XJ($.columnTypes),...XJ(z.columnTypes)];return Q}function w5($,z,Q){if(!z)return j(45,{parentCellDataType:Q}),!1;if(z.baseDataType!==$.baseDataType)return j(46),!1;return!0}var oU=($)=>typeof $==="bigint"||typeof $==="number",eU=($)=>$==="number"||$==="bigint";function N5($,z){if(!$.valueFormatter)return;return(Q)=>{let{node:J,colDef:Z,column:X,value:Y}=Q;if(J?.group){let q=(Z.pivotValueColumn??X).getAggFunc();if(q){if(q==="first"||q==="last")return $.valueFormatter(Q);let{baseDataType:G}=$;if(eU(G)&&q!=="count"){if(oU(Y))return $.valueFormatter(Q);if(Y==null)return;if(typeof Y==="object"){if(typeof Y.toNumber==="function")return $.valueFormatter({...Q,value:Y.toNumber()});if("value"in Y)return $.valueFormatter({...Q,value:Y.value})}}return}}else if(z.get("groupHideOpenParents")&&Q.column.isRowGroupActive()){if(typeof Q.value==="string"&&!$.dataTypeMatcher?.(Q.value))return}return $.valueFormatter(Q)}}function $W($,z,Q,J){if(!z[Q])return!1;let Z=$[Q];if(Z===null)return z[Q]=!1,!1;else return J===void 0?!!Z:Z===J}function zW($,z){if($==null)return z==null?0:-1;if(z==null)return 1;let Q=Gz($),J=Gz(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return 0}function QW($,z){if($==null)return z==null?0:-1;if(z==null)return 1;let Q=g5($),J=g5(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return 0}function g5($){let z=Gz($);if(z==null)return null;return z<0n?-z:z}function iZ($,z){return[["cellRenderer","agSparklineCellRenderer"],["valueGetter",void 0],["valueParser",void 0],["refData",void 0]].some(([Q,J])=>$W($,z,Q,J))}function JW($,z){let Q=A8($);for(let J of z)if(delete Q[J],J==="rowGroup")delete Q.rowGroupIndex;else if(J==="pivot")delete Q.pivotIndex;return Q}var ZW={moduleName:"DataType",version:p,beans:[aU],dependsOn:[iU]},XW={moduleName:"ColumnFlex",version:p,beans:[dU]};var YW=class extends S{constructor(){super(...arguments);this.beanName="colNames"}getDisplayNameForColumn($,z,Q=!1){if(!$)return null;let J=this.getHeaderName($.getColDef(),$,null,null,z),{aggColNameSvc:Z}=this.beans;if(Q&&Z)return Z.getHeaderName($,J);return J}getDisplayNameForProvidedColumnGroup($,z,Q){let J=z?.getColGroupDef();if(J)return this.getHeaderName(J,null,$,z,Q);return null}getDisplayNameForColumnGroup($,z){return this.getDisplayNameForProvidedColumnGroup($,$.getProvidedColumnGroup(),z)}getHeaderName($,z,Q,J,Z){let X=$.headerValueGetter;if(X){let Y=y(this.gos,{colDef:$,column:z,columnGroup:Q,providedColumnGroup:J,location:Z});if(typeof X==="function")return X(Y);else if(typeof X==="string")return this.beans.expressionSvc?.evaluate(X,Y)??null;return""}else if($.headerName!=null)return $.headerName;else if($.field)return xY($.field);return""}},qW=class extends S{constructor(){super(...arguments);this.beanName="colViewport",this.colsWithinViewport=[],this.headerColsWithinViewport=[],this.colsWithinViewportHash="",this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.columnsToRenderLeft=[],this.columnsToRenderRight=[],this.columnsToRenderCenter=[]}wireBeans($){this.visibleCols=$.visibleCols,this.colModel=$.colModel}postConstruct(){this.suppressColumnVirtualisation=this.gos.get("suppressColumnVirtualisation")}getScrollPosition(){return this.scrollPosition}setScrollPosition($,z,Q=!1){let{visibleCols:J}=this,Z=J.isBodyWidthDirty;if($===this.scrollWidth&&z===this.scrollPosition&&!Z)return;if(this.scrollWidth=$,this.scrollPosition=z,J.isBodyWidthDirty=!0,this.gos.get("enableRtl")){let Y=J.bodyWidth;this.viewportLeft=Y-z-$,this.viewportRight=Y-z}else this.viewportLeft=z,this.viewportRight=$+z;if(this.colModel.ready)this.checkViewportColumns(Q)}getColumnHeadersToRender($){switch($){case"left":return this.columnsToRenderLeft;case"right":return this.columnsToRenderRight;default:return this.columnsToRenderCenter}}getHeadersToRender($,z){let Q;switch($){case"left":Q=this.rowsOfHeadersToRenderLeft[z];break;case"right":Q=this.rowsOfHeadersToRenderRight[z];break;default:Q=this.rowsOfHeadersToRenderCenter[z];break}return Q??[]}extractViewportColumns(){let $=this.visibleCols.centerCols;if(this.isColumnVirtualisationSuppressed())this.colsWithinViewport=$,this.headerColsWithinViewport=$;else this.colsWithinViewport=$.filter(this.isColumnInRowViewport.bind(this)),this.headerColsWithinViewport=$.filter(this.isColumnInHeaderViewport.bind(this))}isColumnVirtualisationSuppressed(){return this.suppressColumnVirtualisation||this.viewportRight===0}clear(){this.rowsOfHeadersToRenderLeft={},this.rowsOfHeadersToRenderRight={},this.rowsOfHeadersToRenderCenter={},this.colsWithinViewportHash=""}isColumnInHeaderViewport($){if($.isAutoHeaderHeight()||GW($))return!0;return this.isColumnInRowViewport($)}isColumnInRowViewport($){if($.isAutoHeight())return!0;let z=$.getLeft()||0,Q=z+$.getActualWidth(),J=this.viewportLeft-200,Z=this.viewportRight+200,X=zZ&&Q>Z;return!X&&!Y}getViewportColumns(){let{leftCols:$,rightCols:z}=this.visibleCols;return this.colsWithinViewport.concat($).concat(z)}getColsWithinViewport($){if(!this.colModel.colSpanActive)return this.colsWithinViewport;let z=(X)=>{let Y=X.getLeft();return T(Y)&&Y>this.viewportLeft},Q=this.isColumnVirtualisationSuppressed()?void 0:this.isColumnInRowViewport.bind(this),{visibleCols:J}=this,Z=J.centerCols;return J.getColsForRow($,Z,Q,z)}checkViewportColumns($=!1){if(this.extractViewport())this.eventSvc.dispatchEvent({type:"virtualColumnsChanged",afterScroll:$})}calculateHeaderRows(){let{leftCols:$,rightCols:z}=this.visibleCols;this.columnsToRenderLeft=$,this.columnsToRenderRight=z,this.columnsToRenderCenter=this.colsWithinViewport;let Q=(J)=>{let Z=new Set,X={};for(let Y of J){let q=Y.getParent(),G=Y.isSpanHeaderHeight();while(q){if(Z.has(q))break;if(G&&q.isPadding()){q=q.getParent();continue}let H=q.getProvidedColumnGroup().getLevel();X[H]??(X[H]=[]),X[H].push(q),Z.add(q),q=q.getParent()}}return X};this.rowsOfHeadersToRenderLeft=Q($),this.rowsOfHeadersToRenderRight=Q(z),this.rowsOfHeadersToRenderCenter=Q(this.headerColsWithinViewport)}extractViewport(){let $=(J)=>`${J.getId()}-${J.getPinned()||"normal"}`;this.extractViewportColumns();let z=this.getViewportColumns().map($).join("#"),Q=this.colsWithinViewportHash!==z;if(Q)this.colsWithinViewportHash=z,this.calculateHeaderRows();return Q}};function GW($){while($){if($.isAutoHeaderHeight())return!0;$=$.getParent()}return!1}var _W=class extends S{constructor(){super(...arguments);this.beanName="agCompUtils"}adaptFunction($,z){if(!$.cellRenderer)return null;class Q{refresh(){return!1}getGui(){return this.eGui}init(J){let Z=z(J),X=typeof Z;if(X==="string"||X==="number"||X==="boolean"){this.eGui=v2(""+Z+"");return}if(Z==null){this.eGui=J0({tag:"span"});return}this.eGui=Z}}return Q}},HW={moduleName:"CellRendererFunction",version:p,beans:[_W]},UW=class extends R0{constructor(){super(...arguments);this.beanName="registry"}registerDynamicBeans($){if($){this.dynamicBeans??(this.dynamicBeans={});for(let z of Object.keys($))this.dynamicBeans[z]=$[z]}}createDynamicBean($,z,...Q){if(!this.dynamicBeans)throw Error(this.getDynamicError($,!0));let J=this.dynamicBeans[$];if(J==null){if(z)throw Error(this.getDynamicError($,!1));return}return new J(...Q)}};function WW($){return typeof $==="object"&&!!$.getComp}var BW=class extends UW{constructor(){super(...arguments);this.agGridDefaults={},this.agGridDefaultOverrides={},this.jsComps={},this.selectors={},this.icons={}}postConstruct(){let $=this.gos.get("components");if($!=null)for(let z of Object.keys($))this.jsComps[z]=$[z]}registerModule($){let{icons:z,userComponents:Q,dynamicBeans:J,selectors:Z}=$;if(Q){let X=(Y,q,G,_)=>{if(this.agGridDefaults[Y]=q,G||_)this.agGridDefaultOverrides[Y]={params:G,processParams:_}};for(let Y of Object.keys(Q)){let q=Q[Y];if(WW(q))q=q.getComp(this.beans);if(typeof q==="object"){let{classImp:G,params:_,processParams:H}=q;X(Y,G,_,H)}else X(Y,q)}}this.registerDynamicBeans(J);for(let X of Z??[])this.selectors[X.selector]=X;if(z)for(let X of Object.keys(z))this.icons[X]=z[X]}getUserComponent($,z){let Q=(q,G,_,H)=>({componentFromFramework:G,component:q,params:_,processParams:H}),{frameworkOverrides:J}=this.beans,Z=J.frameworkComponent(z,this.gos.get("components"));if(Z!=null)return Q(Z,!0);let X=this.jsComps[z];if(X){let q=J.isFrameworkComponent(X);return Q(X,q)}let Y=this.agGridDefaults[z];if(Y){let q=this.agGridDefaultOverrides[z];return Q(Y,!1,q?.params,q?.processParams)}return this.beans.validation?.missingUserComponent($,z,this.agGridDefaults,this.jsComps),null}getSelector($){return this.selectors[$]}getIcon($){return this.icons[$]}getDynamicError($,z){if(z)return $$(279,{name:$});return this.beans.validation?.missingDynamicBean($)??$$(256)}},EW=23,KW=class extends S{constructor(){super(...arguments);this.beanName="ctrlsSvc",this.params={},this.ready=!1,this.readyCallbacks=[]}postConstruct(){this.addEventListener("ready",()=>{if(this.updateReady(),this.ready){for(let $ of this.readyCallbacks)$(this.params);this.readyCallbacks.length=0}},this.beans.frameworkOverrides.runWhenReadyAsync?.()??!1)}updateReady(){let $=Object.values(this.params);this.ready=$.length===EW&&$.every((z)=>{return z?.isAlive()??!1})}whenReady($,z){if(this.ready)z(this.params);else this.readyCallbacks.push(z);$.addDestroyFunc(()=>{let Q=this.readyCallbacks.indexOf(z);if(Q>=0)this.readyCallbacks.splice(Q,1)})}register($,z){if(this.params[$]=z,this.updateReady(),this.ready)this.dispatchLocalEvent({type:"ready"});z.addDestroyFunc(()=>{this.updateReady()})}get($){return this.params[$]}getGridBodyCtrl(){return this.params.gridBodyCtrl}getHeaderRowContainerCtrls(){let{leftHeader:$,centerHeader:z,rightHeader:Q}=this.params;return[$,Q,z]}getHeaderRowContainerCtrl($){let z=this.params;switch($){case"left":return z.leftHeader;case"right":return z.rightHeader;default:return z.centerHeader}}getScrollFeature(){return this.getGridBodyCtrl().scrollFeature}},LW=':where([class^=ag-]),:where([class^=ag-]):after,:where([class^=ag-]):before{box-sizing:border-box}:where([class^=ag-]):where(button){color:inherit}:where([class^=ag-]):where(div,span,label):focus-visible{box-shadow:inset var(--ag-focus-shadow);outline:none;&:where(.invalid){box-shadow:inset var(--ag-focus-error-shadow)}}:where([class^=ag-]) ::-ms-clear{display:none}.ag-hidden{display:none!important}.ag-invisible{visibility:hidden!important}.ag-tab-guard{display:block;height:0;position:absolute;width:0}.ag-tab-guard-top{top:1px}.ag-tab-guard-bottom{bottom:1px}.ag-measurement-container{height:0;overflow:hidden;visibility:hidden;width:0}.ag-measurement-element-border{display:inline-block}.ag-measurement-element-border:before{border-left:var(--ag-internal-measurement-border);content:"";display:block}.ag-popup-child{top:0;z-index:5}.ag-popup-child:where(:not(.ag-tooltip-custom)){box-shadow:var(--ag-popup-shadow)}.ag-input-wrapper,.ag-picker-field-wrapper{align-items:center;display:flex;flex:1 1 auto;line-height:normal;position:relative}.ag-input-field{align-items:center;display:flex;flex-direction:row}.ag-input-field-input:where(:not([type=checkbox],[type=radio])){flex:1 1 auto;min-width:0;width:100%}.ag-chart,.ag-dnd-ghost,.ag-external,.ag-popup,.ag-root-wrapper{cursor:default;line-height:normal;white-space:normal;-webkit-font-smoothing:antialiased;background-color:var(--ag-background-color);color:var(--ag-text-color);color-scheme:var(--ag-browser-color-scheme);font-family:var(--ag-font-family);font-size:var(--ag-font-size);font-weight:var(--ag-font-weight);--ag-indentation-level:0}:where(.ag-icon):before{align-items:center;background-color:currentcolor;color:inherit;content:"";display:flex;font-family:inherit;font-size:var(--ag-icon-size);font-style:normal;font-variant:normal;height:var(--ag-icon-size);justify-content:center;line-height:var(--ag-icon-size);-webkit-mask-size:contain;mask-size:contain;text-transform:none;width:var(--ag-icon-size)}.ag-icon{background-position:50%;background-repeat:no-repeat;background-size:contain;color:var(--ag-icon-color);display:block;height:var(--ag-icon-size);position:relative;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-icon-size)}.ag-disabled .ag-icon,[disabled] .ag-icon{opacity:.5}.ag-icon-grip.ag-disabled,.ag-icon-grip[disabled]{opacity:.35}.ag-icon-loading{animation-duration:1s;animation-iteration-count:infinite;animation-name:spin;animation-timing-function:linear}@keyframes spin{0%{transform:rotate(0deg)}to{transform:rotate(1turn)}}.ag-resizer{pointer-events:none;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none;z-index:1}:where(.ag-resizer){&.ag-resizer-topLeft{cursor:nwse-resize;height:5px;left:0;top:0;width:5px}&.ag-resizer-top{cursor:ns-resize;height:5px;left:5px;right:5px;top:0}&.ag-resizer-topRight{cursor:nesw-resize;height:5px;right:0;top:0;width:5px}&.ag-resizer-right{bottom:5px;cursor:ew-resize;right:0;top:5px;width:5px}&.ag-resizer-bottomRight{bottom:0;cursor:nwse-resize;height:5px;right:0;width:5px}&.ag-resizer-bottom{bottom:0;cursor:ns-resize;height:5px;left:5px;right:5px}&.ag-resizer-bottomLeft{bottom:0;cursor:nesw-resize;height:5px;left:0;width:5px}&.ag-resizer-left{bottom:5px;cursor:ew-resize;left:0;top:5px;width:5px}}.ag-menu{background-color:var(--ag-menu-background-color);border:var(--ag-menu-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-menu-shadow);color:var(--ag-menu-text-color);max-height:100%;overflow-y:auto;position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}',F4=typeof window!=="object"||!window?.document?.fonts?.forEach,UJ=!1,Nz=($,z,Q,J,Z,X,Y=!1)=>{if(F4||UJ)return;if(J)$=`@layer ${CSS.escape(J).replaceAll("\\.",".")} { ${$} }`;let q=R$.map.get(z);if(!q)q=[],R$.map.set(z,q);if(q.some((U)=>U.css===$))return;let G=document.createElement("style");if(X)G.setAttribute("nonce",X);G.dataset.agCss=Q,G.dataset.agCssVersion=p,G.textContent=$;let _={css:$,el:G,priority:Z,isParams:Y},H;for(let U of q){if(U.priority>Z)break;H=U}if(H){H.el.after(G);let U=q.indexOf(H);q.splice(U+1,0,_)}else{if(z.nodeName==="STYLE")z.after(G);else z.insertBefore(G,z.querySelector(":not(title, meta)"));q.push(_)}},R8=($,z,Q,J)=>{Nz(LW,$,"shared",z,0,Q),J?.forEach((Z,X)=>Z.forEach((Y)=>Nz(Y,$,X,z,0,Q)))},DW=($,z,Q,J,Z,X)=>{if(F4||UJ)return;let Y=R$.grids.get($);if(!Y)R$.grids.set($,{styleContainer:J,paramsCss:z});else Y.paramsCss=z;if(B2(J),z&&Q)Nz(z,J,Q,Z,2,X,!0)},FW=($)=>{let z=R$.grids.get($)?.styleContainer;if(!z)return;if(R$.grids.delete($),Array.from(R$.grids.values()).some((J)=>J.styleContainer===z))B2(z);else B2(z,!0),R$.map.delete(z)},B2=($,z=!1)=>{let Q=new Set;for(let Z of R$.grids.values())if(Z.styleContainer===$)Q.add(Z.paramsCss);let J=R$.map.get($)??[];for(let Z=J.length-1;Z>=0;Z--)if(z||J[Z].isParams&&!Q.has(J[Z].css))J[Z].el.remove(),J.splice(Z,1)},j8=()=>{let $=globalThis.agStyleInjectionVersions??(globalThis.agStyleInjectionVersions=new Map),z=$.get(p);if(!z)z={map:new WeakMap,grids:new Map,paramsId:0},$.set(p,z);return z},R$=j8(),D$=($)=>{return new f8($)},o$="$default",MW=0,f8=class{constructor({feature:$,params:z,modeParams:Q={},css:J,cssImports:Z}){this.feature=$,this.css=J,this.cssImports=Z,this.modeParams={[o$]:{...Q[o$]??{},...z??{}},...Q}}use($,z,Q){let J=this._inject;if(J==null){let{css:Z}=this;if(Z){let X=`ag-theme-${this.feature??"part"}-${++MW}`;if(typeof Z==="function")Z=Z();Z=`:where(.${X}) { +${Z} +} +`;for(let Y of this.cssImports??[])Z=`@import url(${JSON.stringify(Y)}); +${Z}`;J={css:Z,class:X}}else J=!1;this._inject=J}if(J&&$)Nz(J.css,$,J.class,z,1,Q);return J?J.class:!1}},kW=($)=>$.replace(/[A-Z]|\d+/g,(z)=>`-${z}`).toLowerCase(),M4=($)=>`--ag-${kW($)}`,v$=($)=>`var(${M4($)})`,VW=($,z,Q)=>Math.max(z,Math.min(Q,$)),AW=($)=>{let z=new Map;return(Q)=>{let J=Q;if(!z.has(J))z.set(J,$(Q));return z.get(J)}},A$=($)=>({ref:"accentColor",mix:$}),s0=($)=>({ref:"foregroundColor",mix:$}),o0=($)=>({ref:"foregroundColor",mix:$,onto:"backgroundColor"}),SW=($)=>({ref:"foregroundColor",mix:$,onto:"headerBackgroundColor"}),x0={ref:"backgroundColor"},Tz={ref:"foregroundColor"},S$={ref:"accentColor"},WJ={backgroundColor:"#fff",foregroundColor:"#181d1f",borderColor:s0(0.15),chromeBackgroundColor:o0(0.02),browserColorScheme:"light"},RW={...WJ,textColor:Tz,accentColor:"#2196f3",invalidColor:"#e02525",fontFamily:["-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu","Cantarell","Helvetica Neue","sans-serif"],subtleTextColor:{ref:"textColor",mix:0.5},borderWidth:1,borderRadius:4,spacing:8,fontSize:14,fontWeight:"inherit",focusShadow:{spread:3,color:A$(0.5)},focusErrorShadow:{spread:3,color:{ref:"invalidColor",onto:"backgroundColor",mix:0.5}},popupShadow:"0 0 16px #00000026",cardShadow:"0 1px 4px 1px #00000018",dropdownShadow:{ref:"cardShadow"},listItemHeight:{calc:"max(iconSize, dataFontSize) + widgetVerticalSpacing"},dragAndDropImageBackgroundColor:x0,dragAndDropImageBorder:!0,dragAndDropImageNotAllowedBorder:{color:{ref:"invalidColor",onto:"dragAndDropImageBackgroundColor",mix:0.5}},dragAndDropImageShadow:{ref:"popupShadow"},iconSize:16,iconColor:"inherit",toggleButtonWidth:28,toggleButtonHeight:18,toggleButtonOnBackgroundColor:S$,toggleButtonOffBackgroundColor:o0(0.3),toggleButtonSwitchBackgroundColor:x0,toggleButtonSwitchInset:2,tooltipBackgroundColor:{ref:"chromeBackgroundColor"},tooltipErrorBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.1},tooltipTextColor:{ref:"textColor"},tooltipErrorTextColor:{ref:"invalidColor"},tooltipBorder:!0,tooltipErrorBorder:{color:{ref:"invalidColor",onto:"backgroundColor",mix:0.25}},panelBackgroundColor:x0,panelTitleBarHeight:{ref:"headerHeight"},panelTitleBarBackgroundColor:{ref:"headerBackgroundColor"},panelTitleBarIconColor:{ref:"headerTextColor"},panelTitleBarTextColor:{ref:"headerTextColor"},panelTitleBarFontFamily:{ref:"headerFontFamily"},panelTitleBarFontSize:{ref:"headerFontSize"},panelTitleBarFontWeight:{ref:"headerFontWeight"},panelTitleBarBorder:!0,dialogShadow:{ref:"popupShadow"},dialogBorder:{color:s0(0.2)},widgetContainerHorizontalPadding:{calc:"spacing * 1.5"},widgetContainerVerticalPadding:{calc:"spacing * 1.5"},widgetHorizontalSpacing:{calc:"spacing * 1.5"},widgetVerticalSpacing:{ref:"spacing"},dataFontSize:{ref:"fontSize"},headerBackgroundColor:{ref:"chromeBackgroundColor"},headerFontFamily:{ref:"fontFamily"},headerFontSize:{ref:"fontSize"},headerFontWeight:500,headerTextColor:{ref:"textColor"},headerHeight:{calc:"max(iconSize, dataFontSize) + spacing * 4 * headerVerticalPaddingScale"},headerVerticalPaddingScale:1,menuBorder:{color:s0(0.2)},menuBackgroundColor:o0(0.03),menuTextColor:o0(0.95),menuShadow:{ref:"popupShadow"},menuSeparatorColor:{ref:"borderColor"}},jW=["colorScheme","color","length","scale","borderStyle","border","shadow","image","fontFamily","fontWeight","duration"],fW=AW(($)=>{return $=$.toLowerCase(),jW.find((z)=>$.endsWith(z.toLowerCase()))??"length"}),pJ=($)=>{if(typeof $==="object"&&$?.ref)return v$($.ref);if(typeof $==="string")return $;if(typeof $==="number")return String($);return!1},k4=($)=>{if(typeof $==="string")return $;if(typeof $==="object"&&$&&"ref"in $){let z=v$($.ref);if($.mix==null)return z;return`color-mix(in srgb, ${$.onto?v$($.onto):"transparent"}, ${z} ${VW($.mix*100,0,100)}%)`}return!1},OW=pJ,XQ=($)=>{if(typeof $==="string")return $;if(typeof $==="number")return`${$}px`;if(typeof $==="object"&&$&&"calc"in $)return`calc(${$.calc.replace(/ ?[*/+] ?/g," $& ").replace(/-?\b[a-z][a-z0-9]*\b(?![-(])/gi,(Q)=>Q[0]==="-"?Q:" "+v$(Q)+" ")})`;if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},PW=pJ,E2=($,z)=>{if(typeof $==="string")return $;if($===!0)return E2({},z);if($===!1)return z==="columnBorder"?E2({color:"transparent"},z):"none";if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return O8($.style??"solid")+" "+XQ($.width??{ref:"borderWidth"})+" "+k4($.color??{ref:"borderColor"})},h5=($)=>{return[XQ($.offsetX??0),XQ($.offsetY??0),XQ($.radius??0),XQ($.spread??0),k4($.color??{ref:"foregroundColor"}),...$.inset?["inset"]:[]].join(" ")},TW=($)=>{if(typeof $==="string")return $;if($===!1)return"none";if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);if(Array.isArray($))return $.map(h5).join(", ");return h5($)},O8=pJ,P8=($)=>{if(typeof $==="string")return $.includes(",")?$:u5($);if(typeof $==="object"&&$&&"googleFont"in $)return P8($.googleFont);if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);if(Array.isArray($))return $.map((z)=>{if(typeof z==="object"&&"googleFont"in z)z=z.googleFont;return u5(z)}).join(", ");return!1},u5=($)=>/^[\w-]+$|\w\(/.test($)?$:JSON.stringify($),vW=pJ,T8=($)=>{if(typeof $==="string")return $;if(typeof $==="object"&&$&&"url"in $)return`url(${JSON.stringify($.url)})`;if(typeof $==="object"&&$&&"svg"in $)return T8({url:`data:image/svg+xml,${encodeURIComponent($.svg)}`});if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},IW=($,z,Q)=>{if(typeof $==="string")return $;if(typeof $==="number"){if($>=10)Q?.warn(104,{value:$,param:z});return`${$}s`}if(typeof $==="object"&&$&&"ref"in $)return v$($.ref);return!1},CW={color:k4,colorScheme:OW,length:XQ,scale:PW,border:E2,borderStyle:O8,shadow:TW,image:T8,fontFamily:P8,fontWeight:vW,duration:IW},bW=($,z,Q)=>{let J=fW($);return CW[J](z,$,Q)};var yW=($,z)=>new v8({themeLogger:$,overridePrefix:z}),v8=class ${constructor(z,Q=[]){this.params=z,this.parts=Q}withPart(z){if(typeof z==="function")z=z();if(!(z instanceof f8))return this.params.themeLogger.preInitErr(259,"Invalid part",{part:z}),this;return new $(this.params,[...this.parts,z])}withoutPart(z){return this.withPart(D$({feature:z}))}withParams(z,Q=o$){return this.withPart(D$({modeParams:{[Q]:z}}))}_startUse({styleContainer:z,cssLayer:Q,nonce:J,loadThemeGoogleFonts:Z,moduleCss:X}){if(F4)return;if(UJ)return;wW(),R8(z,Q,J,X);let Y=xW(this);if(Y.length>0){for(let q of Y)if(Z)NW(q,J)}for(let q of this.parts)q.use(z,Q,J)}_getCssClass(){if(UJ)return"ag-theme-quartz";return this._cssClassCache??(this._cssClassCache=m5(this.parts).map((z)=>z.use(void 0,void 0,void 0)).filter(Boolean).concat(this._getParamsClassName()).join(" "))}_getParamsClassName(){return this._paramsClassName??(this._paramsClassName=`ag-theme-params-${++j8().paramsId}`)}_getModeParams(){let z=this._paramsCache;if(!z){let Q={[o$]:{...RW}};for(let J of m5(this.parts))for(let Z of Object.keys(J.modeParams)){let X=J.modeParams[Z];if(X){let Y=Q[Z]??(Q[Z]={}),q=new Set;for(let G of Object.keys(X)){let _=X[G];if(_!==void 0)Y[G]=_,q.add(G)}if(Z===o$)for(let G of Object.keys(Q)){let _=Q[G];if(G!==o$)for(let H of q)delete _[H]}}}this._paramsCache=z=Q}return z}_getParamsCss(){if(!this._paramsCssCache){let z="",Q="",J=this._getModeParams(),{overridePrefix:Z,themeLogger:X}=this.params,Y=Z?`--ag-${Z}-`:void 0;for(let _ of Object.keys(J)){let H=J[_];if(_!==o$){let W=`:where([data-ag-theme-mode="${typeof CSS==="object"?CSS.escape(_):_}"]) & { +`;z+=W,Q+=W}for(let U of Object.keys(H).sort()){let W=H[U],B=bW(U,W,X);if(B===!1)X.error(107,{key:U,value:W});else{let E=M4(U),K=Y?E.replace("--ag-",Y):E,L=E.replace("--ag-","--ag-inherited-");z+=` ${E}: var(${L}, ${B}); +`,Q+=` ${L}: var(${K}); +`}}if(_!==o$)z+=`} +`,Q+=`} +`}let q=`:where(.${this._getParamsClassName()})`,G=`${q} { +${z}} +`;G+=`:has(> ${q}):not(${q}) { +${Q}} +`,this._paramsCssCache=G}return this._paramsCssCache}},m5=($)=>{let z=new Map;for(let J of $)z.set(J.feature,J);let Q=[];for(let J of $)if(!J.feature||z.get(J.feature)===J)Q.push(J);return Q},xW=($)=>{let z=new Set,Q=(X)=>{if(Array.isArray(X))X.forEach(Q);else{let Y=X?.googleFont;if(typeof Y==="string")z.add(Y)}};return Object.values($._getModeParams()).flatMap((X)=>Object.values(X)).forEach(Q),Array.from(z).sort()},c5=!1,wW=()=>{if(c5)return;c5=!0;for(let $ of Array.from(document.head.querySelectorAll('style[data-ag-scope="legacy"]')))$.remove()},NW=async($,z)=>{let Q=`@import url('https://${gW}/css2?family=${encodeURIComponent($)}:wght@100;200;300;400;500;600;700;800;900&display=swap'); +`;Nz(Q,document.head,`googleFont:${$}`,void 0,0,z)},gW="fonts.googleapis.com",p5={changeKey:"listItemHeight",type:"length",defaultValue:24},hW=class extends R0{constructor(){super(...arguments);this.beanName="environment",this.sizeEls=new Map,this.lastKnownValues=new Map,this.sizesMeasured=!1,this.globalCSS=[]}wireBeans($){this.eRootDiv=$.eRootDiv}postConstruct(){let{gos:$,eRootDiv:z}=this;$.setInstanceDomData(z);let Q=$.get("themeStyleContainer"),J=typeof ShadowRoot<"u",Z=J&&z.getRootNode()instanceof ShadowRoot;if(this.eStyleContainer=(typeof Q==="function"?Q():Q)??(Z?z:document.head),!Q&&!Z&&J)uW(z,this.shadowRootError.bind(this),this.addDestroyFunc.bind(this));this.cssLayer=$.get("themeCssLayer"),this.styleNonce=$.get("styleNonce"),this.addManagedPropertyListener("theme",()=>this.handleThemeChange()),this.handleThemeChange(),this.getSizeEl(p5),this.initVariables(),this.addDestroyFunc(()=>FW(this)),this.mutationObserver=new MutationObserver(()=>{this.fireStylesChangedEvent("theme")}),this.addDestroyFunc(()=>this.mutationObserver.disconnect())}applyThemeClasses($,z=[]){let{theme:Q}=this,J=Q?Q._getCssClass():this.applyLegacyThemeClasses();for(let Z of Array.from($.classList))if(Z.startsWith("ag-theme-"))$.classList.remove(Z);if(J){let Z=$.className;$.className=`${Z}${Z?" ":""}${J}${z?.length?" "+z.join(" "):""}`}}applyLegacyThemeClasses(){let $="";this.mutationObserver.disconnect();let z=this.eRootDiv;while(z){let Q=!1;for(let J of Array.from(z.classList))if(J.startsWith("ag-theme-"))Q=!0,$=$?`${$} ${J}`:J;if(Q)this.mutationObserver.observe(z,{attributes:!0,attributeFilter:["class"]});z=z.parentElement}return $}addGlobalCSS($,z){if(this.theme)Nz($,this.eStyleContainer,z,this.cssLayer,0,this.styleNonce);else this.globalCSS.push([$,z])}getDefaultListItemHeight(){return this.getCSSVariablePixelValue(p5)}getCSSVariablePixelValue($){let z=this.lastKnownValues.get($);if(z!=null)return z;let Q=this.measureSizeEl($);if(Q==="detached"||Q==="no-styles"){if($.cacheDefault)this.lastKnownValues.set($,$.defaultValue);return $.defaultValue}return this.lastKnownValues.set($,Q),Q}measureSizeEl($){let z=this.getSizeEl($);if(z.offsetParent==null)return"detached";let Q=z.offsetWidth;if(Q===nZ)return"no-styles";return this.sizesMeasured=!0,Q}getMeasurementContainer(){let $=this.eMeasurementContainer;if(!$)$=this.eMeasurementContainer=K0({tag:"div",cls:"ag-measurement-container"}),this.eRootDiv.appendChild($);return $}getSizeEl($){let z=this.sizeEls.get($);if(z)return z;let Q=this.getMeasurementContainer();z=K0({tag:"div"});let J=this.setSizeElStyles(z,$);Q.appendChild(z),this.sizeEls.set($,z);let{type:Z,noWarn:X}=$;if(Z!=="length"&&Z!=="border")return z;let Y=this.measureSizeEl($);if(Y==="no-styles"&&!X)this.varError(J,$.defaultValue);let q=F$(this.beans,z,()=>{let G=this.measureSizeEl($);if(G==="detached"||G==="no-styles")return;if(this.lastKnownValues.set($,G),G!==Y)Y=G,this.fireStylesChangedEvent($.changeKey)});return this.addDestroyFunc(()=>q()),z}setSizeElStyles($,z){let{changeKey:Q,type:J}=z,Z=M4(Q);if(J==="border"){if(Z.endsWith("-width"))Z=Z.slice(0,-6);$.className="ag-measurement-element-border",$.style.setProperty("--ag-internal-measurement-border",`var(${Z}, solid ${nZ}px)`)}else $.style.width=`var(${Z}, ${nZ}px)`;return Z}handleThemeChange(){let{gos:$,theme:z}=this,Q=$.get("theme"),J;if(Q==="legacy")J=void 0;else{let Z=Q??this.getDefaultTheme();if(Z instanceof v8)J=Z;else this.themeError(Z)}if(J!==z)this.handleNewTheme(J);this.postProcessThemeChange(J,Q)}handleNewTheme($){let{gos:z,eRootDiv:Q,globalCSS:J}=this,Z=this.getAdditionalCss();if($){R8(this.eStyleContainer,this.cssLayer,this.styleNonce,Z);for(let[X,Y]of J)Nz(X,this.eStyleContainer,Y,this.cssLayer,0,this.styleNonce);J.length=0}this.theme=$,$?._startUse({loadThemeGoogleFonts:z.get("loadThemeGoogleFonts"),styleContainer:this.eStyleContainer,cssLayer:this.cssLayer,nonce:this.styleNonce,moduleCss:Z}),DW(this,$?._getParamsCss()??null,$?._getParamsClassName()??null,this.eStyleContainer,this.cssLayer,this.styleNonce),this.applyThemeClasses(Q),this.fireStylesChangedEvent("theme")}fireStylesChangedEvent($){this.eventSvc.dispatchEvent({type:"stylesChanged",[`${$}Changed`]:!0})}},nZ=15538,uW=($,z,Q)=>{let J=60,Z=setInterval(()=>{if(typeof ShadowRoot<"u"&&$.getRootNode()instanceof ShadowRoot)z(),clearInterval(Z);if($.isConnected||--J<0)clearInterval(Z)},1000);Q(()=>clearInterval(Z))},mW=".ag-aria-description-container{border:0;z-index:9999;clip:rect(1px,1px,1px,1px);height:1px;overflow:hidden;padding:0;position:absolute;white-space:nowrap;width:1px}.ag-unselectable{-webkit-user-select:none;-moz-user-select:none;user-select:none}.ag-selectable{-webkit-user-select:text;-moz-user-select:text;user-select:text}.ag-shake-left-to-right{animation-direction:alternate;animation-duration:.2s;animation-iteration-count:infinite;animation-name:ag-shake-left-to-right}@keyframes ag-shake-left-to-right{0%{padding-left:6px;padding-right:2px}to{padding-left:2px;padding-right:6px}}.ag-body-horizontal-scroll-viewport,.ag-body-vertical-scroll-viewport,.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport{flex:1 1 auto;height:100%;min-width:0;overflow:hidden;position:relative}.ag-viewport{position:relative}.ag-spanning-container{position:absolute;top:0;z-index:1}.ag-body-viewport,.ag-center-cols-viewport,.ag-floating-bottom-viewport,.ag-floating-top-viewport,.ag-header-viewport,.ag-sticky-bottom-viewport,.ag-sticky-top-viewport{overflow-x:auto;-ms-overflow-style:none!important;scrollbar-width:none!important}.ag-body-viewport::-webkit-scrollbar,.ag-center-cols-viewport::-webkit-scrollbar,.ag-floating-bottom-viewport::-webkit-scrollbar,.ag-floating-top-viewport::-webkit-scrollbar,.ag-header-viewport::-webkit-scrollbar,.ag-sticky-bottom-viewport::-webkit-scrollbar,.ag-sticky-top-viewport::-webkit-scrollbar{display:none!important}.ag-body-viewport{display:flex;overflow-x:hidden;&:where(.ag-layout-normal){overflow-y:auto;-webkit-overflow-scrolling:touch}}.ag-floating-bottom-container,.ag-floating-top-container,.ag-sticky-bottom-container,.ag-sticky-top-container{min-height:1px}.ag-center-cols-viewport{min-height:100%;width:100%}.ag-body-horizontal-scroll-viewport{overflow-x:scroll}.ag-body-vertical-scroll-viewport{overflow-y:scroll}.ag-body-container,.ag-body-horizontal-scroll-container,.ag-body-vertical-scroll-container,.ag-center-cols-container,.ag-floating-bottom-container,.ag-floating-bottom-full-width-container,.ag-floating-top-container,.ag-full-width-container,.ag-header-container,.ag-pinned-left-cols-container,.ag-pinned-left-sticky-bottom,.ag-pinned-right-cols-container,.ag-pinned-right-sticky-bottom,.ag-sticky-bottom-container,.ag-sticky-top-container{position:relative}.ag-floating-bottom-container,.ag-floating-top-container,.ag-header-container,.ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top,.ag-sticky-bottom-container,.ag-sticky-top-container{height:100%;white-space:nowrap}.ag-center-cols-container,.ag-pinned-right-cols-container{display:block}.ag-body-horizontal-scroll-container{height:100%}.ag-body-vertical-scroll-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container,.ag-full-width-container,.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{pointer-events:none;position:absolute;top:0}:where(.ag-ltr) .ag-floating-bottom-full-width-container,:where(.ag-ltr) .ag-floating-top-full-width-container,:where(.ag-ltr) .ag-full-width-container,:where(.ag-ltr) .ag-sticky-bottom-full-width-container,:where(.ag-ltr) .ag-sticky-top-full-width-container{left:0}:where(.ag-rtl) .ag-floating-bottom-full-width-container,:where(.ag-rtl) .ag-floating-top-full-width-container,:where(.ag-rtl) .ag-full-width-container,:where(.ag-rtl) .ag-sticky-bottom-full-width-container,:where(.ag-rtl) .ag-sticky-top-full-width-container{right:0}.ag-full-width-container{width:100%}.ag-floating-bottom-full-width-container,.ag-floating-top-full-width-container{display:inline-block;height:100%;overflow:hidden;width:100%}.ag-body{display:flex;flex:1 1 auto;flex-direction:row!important;min-height:0;position:relative}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:flex;min-height:0;min-width:0;position:relative;&:where(.ag-scrollbar-invisible){bottom:0;position:absolute;&:where(.ag-apple-scrollbar){opacity:0;transition:opacity .4s;visibility:hidden;&:where(.ag-scrollbar-active),&:where(.ag-scrollbar-scrolling){opacity:1;visibility:visible}}}}.ag-body-horizontal-scroll{width:100%;&:where(.ag-scrollbar-invisible){left:0;right:0}}.ag-body-vertical-scroll{height:100%;&:where(.ag-scrollbar-invisible){top:0;z-index:10}}:where(.ag-ltr) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){right:0}}:where(.ag-rtl) .ag-body-vertical-scroll{&:where(.ag-scrollbar-invisible){left:0}}.ag-force-vertical-scroll{overflow-y:scroll!important}.ag-horizontal-left-spacer,.ag-horizontal-right-spacer{height:100%;min-width:0;overflow-x:scroll;&:where(.ag-scroller-corner){overflow-x:hidden}}:where(.ag-row-animation) .ag-row{transition:transform .4s,top .4s,opacity .2s;&:where(.ag-after-created){transition:transform .4s,top .4s,height .4s,opacity .2s}}:where(.ag-row-animation.ag-prevent-animation) .ag-row{transition:none!important;&:where(.ag-row.ag-after-created){transition:none!important}}:where(.ag-row-no-animation) .ag-row{transition:none}.ag-row-loading{align-items:center;display:flex}.ag-row-position-absolute{position:absolute}.ag-row-position-relative{position:relative}.ag-full-width-row{overflow:hidden;pointer-events:all}.ag-row-inline-editing{z-index:1}.ag-row-dragging{z-index:2}.ag-stub-cell{align-items:center;display:flex}.ag-cell{display:inline-block;height:100%;position:absolute;white-space:nowrap;&:focus-visible{box-shadow:none}}.ag-cell-value{flex:1 1 auto}.ag-cell-value:not(.ag-allow-overflow),.ag-group-value{overflow:hidden;text-overflow:ellipsis}.ag-cell-wrap-text{white-space:normal;word-break:break-word}:where(.ag-cell) .ag-icon{display:inline-block;vertical-align:middle}.ag-floating-top{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-top:not(.ag-invisible)){border-bottom:var(--ag-pinned-row-border)}.ag-floating-bottom{display:flex;overflow:hidden;position:relative;white-space:nowrap;width:100%}:where(.ag-floating-bottom:not(.ag-invisible)){border-top:var(--ag-pinned-row-border)}.ag-sticky-bottom,.ag-sticky-top{background-color:var(--ag-data-background-color);display:flex;height:0;overflow:hidden;position:absolute;width:100%;z-index:1}.ag-sticky-bottom{box-sizing:content-box!important;:where(.ag-pinned-left-sticky-bottom),:where(.ag-pinned-right-sticky-bottom),:where(.ag-sticky-bottom-container){border-top:var(--ag-row-border);box-sizing:border-box}}.ag-opacity-zero{opacity:0!important}.ag-cell-label-container{align-items:center;display:flex;flex-direction:row-reverse;height:100%;justify-content:space-between;width:100%}:where(.ag-right-aligned-header){.ag-cell-label-container{flex-direction:row}.ag-header-cell-text{text-align:end}}.ag-column-group-icons{display:block;:where(.ag-column-group-closed-icon),:where(.ag-column-group-opened-icon){cursor:pointer}}:where(.ag-ltr){direction:ltr;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row}}:where(.ag-rtl){direction:rtl;text-align:right;.ag-body,.ag-body-horizontal-scroll,.ag-body-viewport,.ag-floating-bottom,.ag-floating-top,.ag-header,.ag-sticky-bottom,.ag-sticky-top{flex-direction:row-reverse}.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{display:block}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(180deg)}}:where(.ag-rtl){.ag-icon-contracted,.ag-icon-expanded,.ag-icon-tree-closed{transform:rotate(-180deg)}}:where(.ag-ltr) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-left:var(--ag-row-group-indent-size)}:where(.ag-rtl) .ag-row:not(.ag-row-level-0) .ag-pivot-leaf-group{margin-right:var(--ag-row-group-indent-size)}:where(.ag-ltr) .ag-row-group-leaf-indent{margin-left:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}:where(.ag-rtl) .ag-row-group-leaf-indent{margin-right:calc(var(--ag-cell-widget-spacing) + var(--ag-icon-size))}.ag-value-change-delta{padding:0 2px}.ag-value-change-delta-up{color:var(--ag-value-change-delta-up-color)}.ag-value-change-delta-down{color:var(--ag-value-change-delta-down-color)}.ag-value-change-value{background-color:transparent;border-radius:1px;padding-left:1px;padding-right:1px;transition:background-color 1s}.ag-value-change-value-highlight{background-color:var(--ag-value-change-value-highlight-background-color);transition:background-color .1s}.ag-cell-data-changed{background-color:var(--ag-value-change-value-highlight-background-color)!important}.ag-cell-data-changed-animation{background-color:transparent}.ag-cell-highlight{background-color:var(--ag-range-selection-highlight-color)!important}.ag-row,.ag-spanned-row{color:var(--ag-cell-text-color);font-family:var(--ag-cell-font-family);font-size:var(--ag-cell-font-size);font-weight:var(--ag-cell-font-weight);white-space:nowrap;--ag-internal-content-line-height:calc(min(var(--ag-row-height), var(--ag-line-height, 1000px)) - var(--ag-internal-row-border-width, 1px) - 2px)}.ag-row{background-color:var(--ag-data-background-color);border-bottom:var(--ag-row-border);height:var(--ag-row-height);width:100%;&.ag-row-editing-invalid{background-color:var(--ag-full-row-edit-invalid-background-color)}}:where(.ag-body-vertical-content-no-gap>div>div>div,.ag-body-vertical-content-no-gap>div>div>div>div)>.ag-row-last{border-bottom-color:transparent}.ag-group-contracted,.ag-group-expanded{cursor:pointer}.ag-cell,.ag-full-width-row .ag-cell-wrapper.ag-row-group{border:1px solid transparent;line-height:var(--ag-internal-content-line-height);-webkit-font-smoothing:subpixel-antialiased}:where(.ag-ltr) .ag-cell{border-right:var(--ag-column-border)}:where(.ag-rtl) .ag-cell{border-left:var(--ag-column-border)}.ag-spanned-cell-wrapper{background-color:var(--ag-data-background-color);position:absolute}.ag-spanned-cell-wrapper>.ag-spanned-cell{display:block;position:relative}:where(.ag-ltr) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-right-color:transparent}:where(.ag-rtl) :where(.ag-body-horizontal-content-no-gap) .ag-column-last{border-left-color:transparent}.ag-cell-wrapper{align-items:center;display:flex;>:where(:not(.ag-cell-value,.ag-group-value)){align-items:center;display:flex;height:var(--ag-internal-content-line-height)}&:where(.ag-row-group){align-items:flex-start}:where(.ag-full-width-row) &:where(.ag-row-group){align-items:center;height:100%}}:where(.ag-ltr) .ag-cell-wrapper{padding-left:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-rtl) .ag-cell-wrapper{padding-right:calc(var(--ag-indentation-level)*var(--ag-row-group-indent-size))}:where(.ag-cell-wrap-text:not(.ag-cell-auto-height)) .ag-cell-wrapper{align-items:normal;height:100%;:where(.ag-cell-value){height:100%}}:where(.ag-ltr) .ag-row>.ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}:where(.ag-rtl) .ag-row>.ag-cell-wrapper.ag-row-group{padding-right:calc(var(--ag-cell-horizontal-padding) + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-cell-focus:not(.ag-cell-range-selected):focus-within,.ag-cell-range-single-cell,.ag-cell-range-single-cell.ag-cell-range-handle,.ag-context-menu-open .ag-cell-focus:not(.ag-cell-range-selected),.ag-context-menu-open .ag-full-width-row.ag-row-focus .ag-cell-wrapper.ag-row-group,.ag-full-width-row.ag-row-focus:focus .ag-cell-wrapper.ag-row-group{border:1px solid;border-color:var(--ag-range-selection-border-color);border-style:var(--ag-range-selection-border-style);outline:initial}.ag-full-width-row.ag-row-focus:focus{box-shadow:none}:where(.ag-ltr) .ag-group-contracted,:where(.ag-ltr) .ag-group-expanded,:where(.ag-ltr) .ag-row-drag,:where(.ag-ltr) .ag-selection-checkbox{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-contracted,:where(.ag-rtl) .ag-group-expanded,:where(.ag-rtl) .ag-row-drag,:where(.ag-rtl) .ag-selection-checkbox{margin-left:var(--ag-cell-widget-spacing)}.ag-drag-handle-disabled{opacity:.35;pointer-events:none}:where(.ag-ltr) .ag-group-child-count{margin-left:3px}:where(.ag-rtl) .ag-group-child-count{margin-right:3px}.ag-row-highlight-above:after,.ag-row-highlight-below:after,.ag-row-highlight-inside:after{background-color:var(--ag-row-drag-indicator-color);border-radius:calc(var(--ag-row-drag-indicator-width)/2);content:\"\";height:var(--ag-row-drag-indicator-width);pointer-events:none;position:absolute;width:calc(100% - 1px)}:where(.ag-ltr) .ag-row-highlight-above:after,:where(.ag-ltr) .ag-row-highlight-below:after,:where(.ag-ltr) .ag-row-highlight-inside:after{left:1px}:where(.ag-rtl) .ag-row-highlight-above:after,:where(.ag-rtl) .ag-row-highlight-below:after,:where(.ag-rtl) .ag-row-highlight-inside:after{right:1px}.ag-row-highlight-above:after{top:0}.ag-row-highlight-below:after{bottom:0}.ag-row-highlight-indent:after{display:block;width:auto}:where(.ag-ltr) .ag-row-highlight-indent:after{left:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size));right:1px}:where(.ag-rtl) .ag-row-highlight-indent:after{left:1px;right:calc((var(--ag-cell-widget-spacing) + var(--ag-icon-size))*2 + var(--ag-cell-horizontal-padding) + var(--ag-row-highlight-level)*var(--ag-row-group-indent-size))}.ag-row-highlight-inside:after{background-color:var(--ag-selected-row-background-color);border:1px solid var(--ag-range-selection-border-color);display:block;height:auto;inset:0;width:auto}.ag-body,.ag-floating-bottom,.ag-floating-top{background-color:var(--ag-data-background-color)}.ag-row-odd{background-color:var(--ag-odd-row-background-color)}.ag-row-selected:before{background-color:var(--ag-selected-row-background-color);content:\"\";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-full-width-row.ag-row-group:before,.ag-row-hover:not(.ag-full-width-row):before{background-color:var(--ag-row-hover-color);content:\"\";display:block;inset:0;pointer-events:none;position:absolute}.ag-row-hover.ag-row-selected:before{background-color:var(--ag-row-hover-color);background-image:linear-gradient(var(--ag-selected-row-background-color),var(--ag-selected-row-background-color))}.ag-row.ag-full-width-row.ag-row-group>*{position:relative}.ag-column-hover{background-color:var(--ag-column-hover-color)}.ag-header-range-highlight{background-color:var(--ag-range-header-highlight-color)}.ag-right-aligned-cell{font-variant-numeric:tabular-nums}:where(.ag-ltr) .ag-right-aligned-cell{text-align:right}:where(.ag-rtl) .ag-right-aligned-cell{text-align:left}.ag-right-aligned-cell .ag-cell-value,.ag-right-aligned-cell .ag-group-value{margin-left:auto}:where(.ag-ltr) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-ltr) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level));padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}:where(.ag-rtl) .ag-cell:not(.ag-cell-inline-editing),:where(.ag-rtl) .ag-full-width-row .ag-cell-wrapper.ag-row-group{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px + var(--ag-row-group-indent-size)*var(--ag-indentation-level))}.ag-row>.ag-cell-wrapper{padding-left:calc(var(--ag-cell-horizontal-padding) - 1px);padding-right:calc(var(--ag-cell-horizontal-padding) - 1px)}.ag-row-dragging{cursor:move;opacity:.5}.ag-details-row{background-color:var(--ag-data-background-color);padding:calc(var(--ag-spacing)*3.75)}.ag-layout-auto-height,.ag-layout-print{.ag-center-cols-container,.ag-center-cols-viewport{min-height:150px}}.ag-overlay-exporting-wrapper,.ag-overlay-loading-wrapper,.ag-overlay-modal-wrapper{background-color:var(--ag-modal-overlay-background-color)}.ag-skeleton-container{align-content:center;height:100%;width:100%}.ag-skeleton-effect{animation:ag-skeleton-loading 1.5s ease-in-out .5s infinite;background-color:var(--ag-row-loading-skeleton-effect-color);border-radius:.25rem;height:1em;width:100%}:where(.ag-ltr) .ag-right-aligned-cell .ag-skeleton-effect{margin-left:auto}:where(.ag-rtl) .ag-right-aligned-cell .ag-skeleton-effect{margin-right:auto}@keyframes ag-skeleton-loading{0%{background-color:var(--ag-row-loading-skeleton-effect-color)}50%{background-color:color-mix(in srgb,transparent,var(--ag-row-loading-skeleton-effect-color) 40%)}to{background-color:var(--ag-row-loading-skeleton-effect-color)}}.ag-loading{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-loading{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-loading{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-ltr) .ag-loading-icon{padding-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-loading-icon{padding-left:var(--ag-cell-widget-spacing)}.ag-header{background-color:var(--ag-header-background-color);border-bottom:var(--ag-header-row-border);color:var(--ag-header-text-color);display:flex;font-family:var(--ag-header-font-family);font-size:var(--ag-header-font-size);font-weight:var(--ag-header-font-weight);overflow:hidden;white-space:nowrap;width:100%}.ag-header-row{height:var(--ag-header-height);position:absolute}.ag-floating-filter-button-button,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,:where(.ag-header-cell-sortable) .ag-header-cell-label,:where(.ag-header-group-cell-selectable) .ag-header-cell-comp-wrapper{cursor:pointer}:where(.ag-ltr) .ag-header-expand-icon{margin-left:4px}:where(.ag-rtl) .ag-header-expand-icon{margin-right:4px}.ag-header-row:where(:not(:first-child)){:where(.ag-header-cell:not(.ag-header-span-height.ag-header-span-total,.ag-header-parent-hidden)),:where(.ag-header-group-cell.ag-header-group-cell-with-group){border-top:var(--ag-header-row-border)}}.ag-header-row:where(:not(.ag-header-row-column-group)){overflow:hidden}:where(.ag-header.ag-header-allow-overflow) .ag-header-row{overflow:visible}.ag-header-cell{display:inline-flex;overflow:hidden}.ag-header-group-cell{contain:paint;display:flex}.ag-header-cell,.ag-header-group-cell{align-items:center;gap:var(--ag-cell-widget-spacing);height:100%;padding:0 var(--ag-cell-horizontal-padding);position:absolute}@property --ag-internal-moving-color{syntax:\"\";inherits:false;initial-value:transparent}@property --ag-internal-hover-color{syntax:\"\";inherits:false;initial-value:transparent}.ag-header-cell:where(:not(.ag-floating-filter)):before,.ag-header-group-cell:before{background-image:linear-gradient(var(--ag-internal-hover-color),var(--ag-internal-hover-color)),linear-gradient(var(--ag-internal-moving-color),var(--ag-internal-moving-color));content:\"\";inset:0;position:absolute;--ag-internal-moving-color:transparent;--ag-internal-hover-color:transparent;transition:--ag-internal-moving-color var(--ag-header-cell-background-transition-duration),--ag-internal-hover-color var(--ag-header-cell-background-transition-duration)}.ag-header-cell:where(:not(.ag-floating-filter)):where(:hover):before,.ag-header-group-cell:where(:hover):before{--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}.ag-header-cell:where(:not(.ag-floating-filter)):where(.ag-header-cell-moving):before,.ag-header-group-cell:where(.ag-header-cell-moving):before{--ag-internal-moving-color:var(--ag-header-cell-moving-background-color);--ag-internal-hover-color:var(--ag-header-cell-hover-background-color)}:where(.ag-header-cell:not(.ag-floating-filter)>*,.ag-header-group-cell>*){position:relative;z-index:1}.ag-header-cell-menu-button:where(:not(.ag-header-menu-always-show)){opacity:0;transition:opacity .2s}.ag-header-cell-filter-button,:where(.ag-header-cell.ag-header-active) .ag-header-cell-menu-button{opacity:1}.ag-header-cell-label,.ag-header-group-cell-label{align-items:center;align-self:stretch;display:flex;flex:1 1 auto;overflow:hidden;padding:5px 0}:where(.ag-ltr) .ag-sort-indicator-icon{padding-left:var(--ag-spacing)}:where(.ag-rtl) .ag-sort-indicator-icon{padding-right:var(--ag-spacing)}.ag-header-cell-label{text-overflow:ellipsis}.ag-header-group-cell-label.ag-sticky-label{flex:none;max-width:100%;overflow:visible;position:sticky}:where(.ag-ltr) .ag-header-group-cell-label.ag-sticky-label{left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-header-group-cell-label.ag-sticky-label{right:var(--ag-cell-horizontal-padding)}.ag-header-cell-text,.ag-header-group-text{overflow:hidden;text-overflow:ellipsis}.ag-header-cell-text{word-break:break-word}.ag-header-cell-comp-wrapper{width:100%}:where(.ag-header-group-cell) .ag-header-cell-comp-wrapper{display:flex}:where(.ag-header-cell:not(.ag-header-cell-auto-height)) .ag-header-cell-comp-wrapper{align-items:center;display:flex;height:100%}.ag-header-cell-wrap-text .ag-header-cell-comp-wrapper{white-space:normal}.ag-header-cell-comp-wrapper-limited-height>*{overflow:hidden}:where(.ag-right-aligned-header) .ag-header-cell-label{flex-direction:row-reverse}:where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{margin-right:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell:not(.ag-right-aligned-header)){.ag-header-col-ref{margin-left:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{color:var(--ag-subtle-text-color)}}:where(.ag-ltr) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{margin-left:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-right:var(--ag-spacing)}}:where(.ag-rtl) :where(.ag-header-cell.ag-right-aligned-header){.ag-header-col-ref{margin-right:var(--ag-spacing)}.ag-header-label-icon,.ag-header-menu-icon{margin-left:var(--ag-spacing)}}.ag-header-cell:after,.ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{content:\"\";height:var(--ag-header-column-border-height);position:absolute;top:calc(50% - var(--ag-header-column-border-height)*.5);z-index:1}:where(.ag-ltr) .ag-header-cell:after,:where(.ag-ltr) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-right:var(--ag-header-column-border);right:0}:where(.ag-rtl) .ag-header-cell:after,:where(.ag-rtl) .ag-header-group-cell:where(:not(.ag-header-span-height.ag-header-group-cell-no-group)):after{border-left:var(--ag-header-column-border);left:0}.ag-header-highlight-after:after,.ag-header-highlight-before:after{background-color:var(--ag-column-drag-indicator-color);border-radius:calc(var(--ag-column-drag-indicator-width)/2);content:\"\";height:100%;position:absolute;top:0;width:var(--ag-column-drag-indicator-width)}:where(.ag-ltr) .ag-header-highlight-before:after{left:0}:where(.ag-rtl) .ag-header-highlight-before:after{right:0}:where(.ag-ltr) .ag-header-highlight-after:after{right:0;:where(.ag-pinned-left-header) &{right:1px}}:where(.ag-rtl) .ag-header-highlight-after:after{left:0;:where(.ag-pinned-left-header) &{left:1px}}.ag-header-cell-resize{align-items:center;cursor:ew-resize;display:flex;height:100%;position:absolute;top:0;width:8px;z-index:2}:where(.ag-ltr) .ag-header-cell-resize{right:-3px}:where(.ag-rtl) .ag-header-cell-resize{left:-3px}.ag-header-cell-resize:after{background-color:var(--ag-header-column-resize-handle-color);content:\"\";height:var(--ag-header-column-resize-handle-height);position:absolute;top:calc(50% - var(--ag-header-column-resize-handle-height)*.5);width:var(--ag-header-column-resize-handle-width);z-index:1}:where(.ag-ltr) .ag-header-cell-resize:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}:where(.ag-rtl) .ag-header-cell-resize:after{right:calc(50% - var(--ag-header-column-resize-handle-width))}:where(.ag-header-cell.ag-header-span-height) .ag-header-cell-resize:after{height:calc(100% - var(--ag-spacing)*4);top:calc(var(--ag-spacing)*2)}.ag-header-group-cell-no-group:where(.ag-header-span-height){display:none}.ag-sort-indicator-container{display:flex;gap:var(--ag-spacing)}.ag-layout-print{&.ag-body{display:block;height:unset}&.ag-root-wrapper{container-type:normal;display:inline-block}.ag-body-horizontal-scroll,.ag-body-vertical-scroll{display:none}&.ag-force-vertical-scroll{overflow-y:visible!important}}@media print{.ag-root-wrapper.ag-layout-print{container-type:normal;display:table;.ag-body-horizontal-scroll-viewport,.ag-body-viewport,.ag-center-cols-container,.ag-center-cols-viewport,.ag-root,.ag-root-wrapper-body,.ag-virtual-list-viewport{display:block!important;height:auto!important;overflow:hidden!important}.ag-cell,.ag-row{-moz-column-break-inside:avoid;break-inside:avoid}}}ag-grid,ag-grid-angular{display:block}.ag-root-wrapper{border:var(--ag-wrapper-border);border-radius:var(--ag-wrapper-border-radius);container-type:inline-size;display:flex;flex-direction:column;overflow:hidden;position:relative;&.ag-layout-normal{height:100%}}.ag-root-wrapper-body{display:flex;flex-direction:row;&.ag-layout-normal{flex:1 1 auto;height:0;min-height:0}}.ag-root{display:flex;flex-direction:column;position:relative;&.ag-layout-auto-height,&.ag-layout-normal{flex:1 1 auto;overflow:hidden;width:0}&.ag-layout-normal{height:100%}}.ag-drag-handle{color:var(--ag-drag-handle-color);cursor:grab;:where(.ag-icon){color:var(--ag-drag-handle-color)}}.ag-chart-menu-icon,.ag-chart-settings-next,.ag-chart-settings-prev,.ag-column-group-icons,.ag-column-select-header-icon,.ag-filter-toolpanel-expand,.ag-floating-filter-button-button,.ag-group-title-bar-icon,.ag-header-cell-filter-button,.ag-header-cell-menu-button,.ag-header-expand-icon,.ag-panel-title-bar-button,.ag-panel-title-bar-button-icon,.ag-set-filter-group-icons,:where(.ag-group-contracted) .ag-icon,:where(.ag-group-expanded) .ag-icon{background-color:var(--ag-icon-button-background-color);border-radius:var(--ag-icon-button-border-radius);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-background-color);color:var(--ag-icon-button-color)}.ag-chart-menu-icon:hover,.ag-chart-settings-next:hover,.ag-chart-settings-prev:hover,.ag-column-group-icons:hover,.ag-column-select-header-icon:hover,.ag-filter-toolpanel-expand:hover,.ag-floating-filter-button-button:hover,.ag-group-title-bar-icon:hover,.ag-header-cell-filter-button:hover,.ag-header-cell-menu-button:hover,.ag-header-expand-icon:hover,.ag-panel-title-bar-button-icon:hover,.ag-panel-title-bar-button:hover,.ag-set-filter-group-icons:hover,:where(.ag-group-contracted) .ag-icon:hover,:where(.ag-group-expanded) .ag-icon:hover{background-color:var(--ag-icon-button-hover-background-color);box-shadow:0 0 0 var(--ag-icon-button-background-spread) var(--ag-icon-button-hover-background-color);color:var(--ag-icon-button-hover-color)}:where(.ag-filter-active),:where(.ag-filter-toolpanel-group-instance-header-icon),:where(.ag-filter-toolpanel-instance-header-icon){position:relative}:where(.ag-filter-active):after,:where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-filter-toolpanel-instance-header-icon):after{background-color:var(--ag-icon-button-active-indicator-color);border-radius:50%;content:\"\";height:6px;position:absolute;top:-1px;width:6px}:where(.ag-ltr) :where(.ag-filter-active):after,:where(.ag-ltr) :where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-ltr) :where(.ag-filter-toolpanel-instance-header-icon):after{right:-1px}:where(.ag-rtl) :where(.ag-filter-active):after,:where(.ag-rtl) :where(.ag-filter-toolpanel-group-instance-header-icon):after,:where(.ag-rtl) :where(.ag-filter-toolpanel-instance-header-icon):after{left:-1px}.ag-filter-active{background-image:linear-gradient(var(--ag-icon-button-active-background-color),var(--ag-icon-button-active-background-color));border-radius:1px;outline:solid var(--ag-icon-button-background-spread) var(--ag-icon-button-active-background-color);:where(.ag-icon-filter){clip-path:path(\"M8,0C8,4.415 11.585,8 16,8L16,16L0,16L0,0L8,0Z\");color:var(--ag-icon-button-active-color)}}",cW={wrapperBorder:!0,rowBorder:!0,headerRowBorder:!0,footerRowBorder:{ref:"rowBorder"},columnBorder:{style:"solid",width:1,color:"transparent"},headerColumnBorder:!1,headerColumnBorderHeight:"100%",pinnedColumnBorder:!0,pinnedRowBorder:!0,sidePanelBorder:!0,sideBarPanelWidth:250,sideBarPanelAnimationDuration:0,sideBarBackgroundColor:{ref:"chromeBackgroundColor"},sideButtonBarBackgroundColor:{ref:"sideBarBackgroundColor"},sideButtonBarTopPadding:0,sideButtonSelectedUnderlineWidth:2,sideButtonSelectedUnderlineColor:"transparent",sideButtonSelectedUnderlineTransitionDuration:0,sideButtonBackgroundColor:"transparent",sideButtonTextColor:{ref:"textColor"},sideButtonHoverBackgroundColor:{ref:"sideButtonBackgroundColor"},sideButtonHoverTextColor:{ref:"sideButtonTextColor"},sideButtonSelectedBackgroundColor:x0,sideButtonSelectedTextColor:{ref:"sideButtonTextColor"},sideButtonBorder:"solid 1px transparent",sideButtonSelectedBorder:!0,sideButtonLeftPadding:{ref:"spacing"},sideButtonRightPadding:{ref:"spacing"},sideButtonVerticalPadding:{calc:"spacing * 3"},cellFontFamily:{ref:"fontFamily"},cellFontSize:{ref:"dataFontSize"},cellFontWeight:{ref:"fontWeight"},headerCellHoverBackgroundColor:"transparent",headerCellMovingBackgroundColor:{ref:"headerCellHoverBackgroundColor"},headerCellBackgroundTransitionDuration:"0.2s",cellTextColor:{ref:"textColor"},rangeSelectionBorderStyle:"solid",rangeSelectionBorderColor:S$,rangeSelectionBackgroundColor:A$(0.2),rangeSelectionChartBackgroundColor:"#0058FF1A",rangeSelectionChartCategoryBackgroundColor:"#00FF841A",rangeSelectionHighlightColor:A$(0.5),rangeHeaderHighlightColor:SW(0.08),rowNumbersSelectedColor:A$(0.5),rowHoverColor:A$(0.08),columnHoverColor:A$(0.05),selectedRowBackgroundColor:A$(0.12),modalOverlayBackgroundColor:{ref:"backgroundColor",mix:0.66},dataBackgroundColor:x0,oddRowBackgroundColor:{ref:"dataBackgroundColor"},wrapperBorderRadius:8,cellHorizontalPadding:{calc:"spacing * 2 * cellHorizontalPaddingScale"},cellWidgetSpacing:{calc:"spacing * 1.5"},cellHorizontalPaddingScale:1,rowGroupIndentSize:{calc:"cellWidgetSpacing + iconSize"},valueChangeDeltaUpColor:"#43a047",valueChangeDeltaDownColor:"#e53935",valueChangeValueHighlightBackgroundColor:"#16a08580",rowHeight:{calc:"max(iconSize, cellFontSize) + spacing * 3.25 * rowVerticalPaddingScale"},rowVerticalPaddingScale:1,paginationPanelHeight:{ref:"rowHeight",calc:"max(rowHeight, 22px)"},dragHandleColor:s0(0.7),headerColumnResizeHandleHeight:"30%",headerColumnResizeHandleWidth:2,headerColumnResizeHandleColor:{ref:"borderColor"},iconButtonColor:{ref:"iconColor"},iconButtonBackgroundColor:"transparent",iconButtonBackgroundSpread:4,iconButtonBorderRadius:1,iconButtonHoverColor:{ref:"iconButtonColor"},iconButtonHoverBackgroundColor:s0(0.1),iconButtonActiveColor:S$,iconButtonActiveBackgroundColor:A$(0.28),iconButtonActiveIndicatorColor:S$,setFilterIndentSize:{ref:"iconSize"},chartMenuPanelWidth:260,chartMenuLabelColor:s0(0.8),cellEditingBorder:{color:S$},cellEditingShadow:{ref:"cardShadow"},fullRowEditInvalidBackgroundColor:{ref:"invalidColor",onto:"backgroundColor",mix:0.25},columnSelectIndentSize:{ref:"iconSize"},toolPanelSeparatorBorder:!0,columnDropCellBackgroundColor:s0(0.07),columnDropCellTextColor:{ref:"textColor"},columnDropCellDragHandleColor:{ref:"textColor"},columnDropCellBorder:{color:s0(0.13)},selectCellBackgroundColor:s0(0.07),selectCellBorder:{color:s0(0.13)},advancedFilterBuilderButtonBarBorder:!0,advancedFilterBuilderIndentSize:{calc:"spacing * 2 + iconSize"},advancedFilterBuilderJoinPillColor:"#f08e8d",advancedFilterBuilderColumnPillColor:"#a6e194",advancedFilterBuilderOptionPillColor:"#f3c08b",advancedFilterBuilderValuePillColor:"#85c0e4",filterPanelApplyButtonColor:x0,filterPanelApplyButtonBackgroundColor:S$,columnPanelApplyButtonColor:x0,columnPanelApplyButtonBackgroundColor:S$,filterPanelCardSubtleColor:{ref:"textColor",mix:0.7},filterPanelCardSubtleHoverColor:{ref:"textColor"},findMatchColor:Tz,findMatchBackgroundColor:"#ffff00",findActiveMatchColor:Tz,findActiveMatchBackgroundColor:"#ffa500",filterToolPanelGroupIndent:{ref:"spacing"},rowLoadingSkeletonEffectColor:s0(0.15),statusBarLabelColor:Tz,statusBarLabelFontWeight:500,statusBarValueColor:Tz,statusBarValueFontWeight:500,pinnedSourceRowTextColor:{ref:"textColor"},pinnedSourceRowBackgroundColor:{ref:"dataBackgroundColor"},pinnedSourceRowFontWeight:600,pinnedRowFontWeight:600,pinnedRowBackgroundColor:{ref:"dataBackgroundColor"},pinnedRowTextColor:{ref:"textColor"},rowDragIndicatorColor:{ref:"rangeSelectionBorderColor"},rowDragIndicatorWidth:2,columnDragIndicatorColor:{ref:"accentColor"},columnDragIndicatorWidth:2},pW=".ag-cell-batch-edit{background-color:var(--ag-cell-batch-edit-background-color);color:var(--ag-cell-batch-edit-text-color);display:inherit}.ag-row-batch-edit{background-color:var(--ag-row-batch-edit-background-color);color:var(--ag-row-batch-edit-text-color)}",I8={cellBatchEditBackgroundColor:"rgba(220 181 139 / 16%)",cellBatchEditTextColor:"#422f00",rowBatchEditBackgroundColor:{ref:"cellBatchEditBackgroundColor"},rowBatchEditTextColor:{ref:"cellBatchEditTextColor"}},iW={...I8,cellBatchEditTextColor:"#f3d0b3"},nW=()=>D$({feature:"batchEditStyle",params:I8,css:pW}),dW=nW(),tW=":where(.ag-button){background:none;border:none;color:inherit;cursor:pointer;font-family:inherit;font-size:inherit;font-weight:inherit;letter-spacing:inherit;line-height:inherit;margin:0;padding:0;text-indent:inherit;text-shadow:inherit;text-transform:inherit;word-spacing:inherit;&:disabled{cursor:default}&:focus-visible{box-shadow:var(--ag-focus-shadow);outline:none}}.ag-standard-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;background-color:var(--ag-button-background-color);border:var(--ag-button-border);border-radius:var(--ag-button-border-radius);color:var(--ag-button-text-color);cursor:pointer;font-weight:var(--ag-button-font-weight);padding:var(--ag-button-vertical-padding) var(--ag-button-horizontal-padding);&:active{background-color:var(--ag-button-active-background-color);border:var(--ag-button-active-border);color:var(--ag-button-active-text-color)}&:disabled{background-color:var(--ag-button-disabled-background-color);border:var(--ag-button-disabled-border);color:var(--ag-button-disabled-text-color)}}.ag-standard-button:hover{background-color:var(--ag-button-hover-background-color);border:var(--ag-button-hover-border);color:var(--ag-button-hover-text-color)}",sW={buttonTextColor:"inherit",buttonFontWeight:"normal",buttonBackgroundColor:"transparent",buttonBorder:!1,buttonBorderRadius:{ref:"borderRadius"},buttonHorizontalPadding:{calc:"spacing * 2"},buttonVerticalPadding:{ref:"spacing"},buttonHoverTextColor:{ref:"buttonTextColor"},buttonHoverBackgroundColor:{ref:"buttonBackgroundColor"},buttonHoverBorder:{ref:"buttonBorder"},buttonActiveTextColor:{ref:"buttonHoverTextColor"},buttonActiveBackgroundColor:{ref:"buttonHoverBackgroundColor"},buttonActiveBorder:{ref:"buttonHoverBorder"},buttonDisabledTextColor:{ref:"inputDisabledTextColor"},buttonDisabledBackgroundColor:{ref:"inputDisabledBackgroundColor"},buttonDisabledBorder:{ref:"inputDisabledBorder"}};var rW=()=>D$({feature:"buttonStyle",params:{...sW,buttonBackgroundColor:x0,buttonBorder:!0,buttonHoverBackgroundColor:{ref:"rowHoverColor"},buttonActiveBorder:{color:S$}},css:tW}),lW=rW();var aW=".ag-column-drop-vertical-empty-message{align-items:center;border:dashed var(--ag-border-width);border-color:var(--ag-border-color);display:flex;inset:0;justify-content:center;margin:calc(var(--ag-spacing)*1.5) calc(var(--ag-spacing)*2);overflow:hidden;padding:calc(var(--ag-spacing)*2);position:absolute}";var oW=()=>{return D$({feature:"columnDropStyle",css:aW})},C8=oW();var eW={formulaToken1Color:"#3269c6",formulaToken1BackgroundColor:{ref:"formulaToken1Color",mix:0.08},formulaToken1Border:{color:{ref:"formulaToken1Color"}},formulaToken2Color:"#c0343f",formulaToken2BackgroundColor:{ref:"formulaToken2Color",mix:0.06},formulaToken2Border:{color:{ref:"formulaToken2Color"}},formulaToken3Color:"#8156b8",formulaToken3BackgroundColor:{ref:"formulaToken3Color",mix:0.08},formulaToken3Border:{color:{ref:"formulaToken3Color"}},formulaToken4Color:"#007c1f",formulaToken4BackgroundColor:{ref:"formulaToken4Color",mix:0.06},formulaToken4Border:{color:{ref:"formulaToken4Color"}},formulaToken5Color:"#b03e85",formulaToken5BackgroundColor:{ref:"formulaToken5Color",mix:0.08},formulaToken5Border:{color:{ref:"formulaToken5Color"}},formulaToken6Color:"#b74900",formulaToken6BackgroundColor:{ref:"formulaToken6Color",mix:0.06},formulaToken6Border:{color:{ref:"formulaToken6Color"}},formulaToken7Color:"#247492",formulaToken7BackgroundColor:{ref:"formulaToken7Color",mix:0.08},formulaToken7Border:{color:{ref:"formulaToken7Color"}}},$B=()=>D$({feature:"formulaStyle",params:eW}),zB=$B(),QB={warn:(...$)=>{j($[0],$[1])},error:(...$)=>{e($[0],$[1])},preInitErr:(...$)=>{yQ($[0],$[2],$[1])}},JB=()=>yW(QB).withParams(cW).withPart(lW).withPart(C8).withPart(dW).withPart(zB),ZB='.ag-checkbox-input-wrapper,.ag-radio-button-input-wrapper{background-color:var(--ag-checkbox-unchecked-background-color);border:solid var(--ag-checkbox-border-width) var(--ag-checkbox-unchecked-border-color);flex:none;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:where(.ag-checked){background-color:var(--ag-checkbox-checked-background-color);border-color:var(--ag-checkbox-checked-border-color)}&:where(.ag-checked):after{background-color:var(--ag-checkbox-checked-shape-color)}&:where(.ag-disabled){filter:grayscale();opacity:.5}}.ag-checkbox-input,.ag-radio-button-input{-webkit-appearance:none;-moz-appearance:none;appearance:none;cursor:pointer;display:block;height:var(--ag-icon-size);margin:0;opacity:0;width:var(--ag-icon-size)}.ag-checkbox-input-wrapper:after,.ag-radio-button-input-wrapper:after{content:"";display:block;inset:0;-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;pointer-events:none;position:absolute}.ag-checkbox-input-wrapper:where(:focus-within,:active),.ag-radio-button-input-wrapper:where(:focus-within,:active){box-shadow:var(--ag-focus-shadow)}.ag-checkbox-input-wrapper{border-radius:var(--ag-checkbox-border-radius);&:where(.ag-checked):after{-webkit-mask-image:var(--ag-checkbox-checked-shape-image);mask-image:var(--ag-checkbox-checked-shape-image)}&:where(.ag-indeterminate){background-color:var(--ag-checkbox-indeterminate-background-color);border-color:var(--ag-checkbox-indeterminate-border-color)}&:where(.ag-indeterminate):after{background-color:var(--ag-checkbox-indeterminate-shape-color);-webkit-mask-image:var(--ag-checkbox-indeterminate-shape-image);mask-image:var(--ag-checkbox-indeterminate-shape-image)}}.ag-cell-editing-error .ag-checkbox-input-wrapper:focus-within{box-shadow:var(--ag-focus-error-shadow)}.ag-radio-button-input-wrapper{border-radius:100%;&:where(.ag-checked):after{-webkit-mask-image:var(--ag-radio-checked-shape-image);mask-image:var(--ag-radio-checked-shape-image)}}',XB=()=>D$({feature:"checkboxStyle",params:{checkboxBorderWidth:1,checkboxBorderRadius:{ref:"borderRadius"},checkboxUncheckedBackgroundColor:x0,checkboxUncheckedBorderColor:o0(0.3),checkboxCheckedBackgroundColor:S$,checkboxCheckedBorderColor:{ref:"checkboxCheckedBackgroundColor"},checkboxCheckedShapeImage:{svg:''},checkboxCheckedShapeColor:x0,checkboxIndeterminateBackgroundColor:o0(0.3),checkboxIndeterminateBorderColor:{ref:"checkboxIndeterminateBackgroundColor"},checkboxIndeterminateShapeImage:{svg:''},checkboxIndeterminateShapeColor:x0,radioCheckedShapeImage:{svg:''}},css:ZB}),YB=XB();var b8=()=>({...WJ,...iW,backgroundColor:"hsl(217, 0%, 17%)",foregroundColor:"#FFF",chromeBackgroundColor:o0(0.05),rowHoverColor:A$(0.15),selectedRowBackgroundColor:A$(0.2),menuBackgroundColor:o0(0.1),browserColorScheme:"dark",popupShadow:"0 0px 20px #000A",cardShadow:"0 1px 4px 1px #000A",advancedFilterBuilderJoinPillColor:"#7a3a37",advancedFilterBuilderColumnPillColor:"#355f2d",advancedFilterBuilderOptionPillColor:"#5a3168",advancedFilterBuilderValuePillColor:"#374c86",filterPanelApplyButtonColor:Tz,columnPanelApplyButtonColor:Tz,findMatchColor:x0,findActiveMatchColor:x0,checkboxUncheckedBorderColor:o0(0.4),toggleButtonOffBackgroundColor:o0(0.4),rowBatchEditBackgroundColor:o0(0.1),formulaToken1Color:"#4da3e5",formulaToken2Color:"#f55864",formulaToken3Color:"#b688f2",formulaToken4Color:"#24bb4a",formulaToken5Color:"#e772ba",formulaToken6Color:"#f69b5f",formulaToken7Color:"#a3e6ff"});var qB=()=>({...b8(),backgroundColor:"#1f2836"});var GB=()=>D$({feature:"colorScheme",params:WJ,modeParams:{light:WJ,dark:b8(),"dark-blue":qB()}}),_B=GB();var y8={aggregation:'',arrows:'',asc:'',cancel:'',chart:'',"color-picker":'',columns:'',contracted:'',copy:'',cross:'',csv:'',cut:'',desc:'',down:'',excel:'',expanded:'',eye:'',"eye-slash":'',filter:'',first:'',grip:'',group:'',last:'',left:'',linked:'',loading:'',maximize:'',menu:'',"menu-alt":'',minimize:'',minus:'',next:'',none:'',"not-allowed":'',paste:'',pin:'',pivot:'',plus:'',previous:'',right:'',save:'',settings:'',"small-left":'',"small-right":'',tick:'',"tree-closed":'',"tree-indeterminate":'',"tree-open":'',unlinked:'',up:''},x8={aasc:'',adesc:'',"chevron-down":'',"chevron-left":'',"chevron-right":'',"chevron-up":'',"column-arrow":'',edit:'',"filter-add":'',"pinned-bottom":'',"pinned-top":'',"small-down":'',"small-up":'',"un-pin":''},HB=($={})=>{let z="";for(let Q of[...Object.keys(y8),...Object.keys(x8)]){let J=UB(Q,$.strokeWidth);z+=`.ag-icon-${Q}::before { mask-image: url('data:image/svg+xml,${encodeURIComponent(J)}'); } +`}return z},UB=($,z=1.5)=>{let Q=x8[$];if(Q)return Q;let J=y8[$];if(!J)throw Error(`Missing icon data for ${$}`);return``+J+""},w8=($={})=>{return D$({feature:"iconSet",css:()=>HB($)})},N8=w8({strokeWidth:1}),WB=w8();var BB=":where(.ag-input-field-input[type=number]:not(.ag-number-field-input-stepper)){-webkit-appearance:textfield;-moz-appearance:textfield;appearance:textfield;&::-webkit-inner-spin-button,&::-webkit-outer-spin-button{-webkit-appearance:none;appearance:none;margin:0}}.ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){background-color:var(--ag-input-background-color);border:var(--ag-input-border);border-radius:var(--ag-input-border-radius);color:var(--ag-input-text-color);font-family:inherit;font-size:inherit;line-height:inherit;margin:0;min-height:var(--ag-input-height);padding:0;&:where(:disabled){background-color:var(--ag-input-disabled-background-color);border:var(--ag-input-disabled-border);color:var(--ag-input-disabled-text-color)}&:where(:focus){background-color:var(--ag-input-focus-background-color);border:var(--ag-input-focus-border);box-shadow:var(--ag-input-focus-shadow);color:var(--ag-input-focus-text-color);outline:none}&:where(:invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&:where(.invalid){background-color:var(--ag-input-invalid-background-color);border:var(--ag-input-invalid-border);color:var(--ag-input-invalid-text-color)}&::-moz-placeholder{color:var(--ag-input-placeholder-text-color)}&::placeholder{color:var(--ag-input-placeholder-text-color)}}:where(.ag-ltr) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-left:var(--ag-input-padding-start)}:where(.ag-rtl) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding-right:var(--ag-input-padding-start)}&:where(.ag-ltr,.ag-rtl) .ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){padding:0 var(--ag-input-padding-start)}:where(.ag-column-select-header-filter-wrapper),:where(.ag-filter-add-select),:where(.ag-filter-filter),:where(.ag-filter-toolpanel-search),:where(.ag-floating-filter-search-icon),:where(.ag-mini-filter){.ag-input-wrapper:before{background-color:currentcolor;color:var(--ag-input-icon-color);content:\"\";display:block;height:12px;-webkit-mask-image:url(\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==\");mask-image:url(\"data:image/svg+xml;charset=utf-8;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIxMiIgaGVpZ2h0PSIxMiIgZmlsbD0ibm9uZSIgc3Ryb2tlPSIjMDAwIiBzdHJva2UtbGluZWNhcD0icm91bmQiIHN0cm9rZS1saW5lam9pbj0icm91bmQiIHN0cm9rZS13aWR0aD0iMS41Ij48cGF0aCBkPSJNNS4zIDlhMy43IDMuNyAwIDEgMCAwLTcuNSAzLjcgMy43IDAgMCAwIDAgNy41Wk0xMC41IDEwLjUgOC4zIDguMiIvPjwvc3ZnPg==\");-webkit-mask-position:center;mask-position:center;-webkit-mask-repeat:no-repeat;mask-repeat:no-repeat;opacity:.5;position:absolute;width:12px}}:where(.ag-ltr) :where(.ag-column-select-header-filter-wrapper),:where(.ag-ltr) :where(.ag-filter-add-select),:where(.ag-ltr) :where(.ag-filter-filter),:where(.ag-ltr) :where(.ag-filter-toolpanel-search),:where(.ag-ltr) :where(.ag-floating-filter-search-icon),:where(.ag-ltr) :where(.ag-mini-filter){.ag-input-wrapper:before{margin-left:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-left:calc(var(--ag-spacing)*1.5 + 12px)}}:where(.ag-rtl) :where(.ag-column-select-header-filter-wrapper),:where(.ag-rtl) :where(.ag-filter-add-select),:where(.ag-rtl) :where(.ag-filter-filter),:where(.ag-rtl) :where(.ag-filter-toolpanel-search),:where(.ag-rtl) :where(.ag-floating-filter-search-icon),:where(.ag-rtl) :where(.ag-mini-filter){.ag-input-wrapper:before{margin-right:var(--ag-spacing)}.ag-number-field-input,.ag-text-field-input{padding-right:calc(var(--ag-spacing)*1.5 + 12px)}}",EB=".ag-input-field-input:where(input:not([type]),input[type=text],input[type=number],input[type=tel],input[type=date],input[type=datetime-local],textarea){&:focus{box-shadow:var(--ag-focus-shadow);&:where(.invalid),&:where(:invalid){box-shadow:var(--ag-focus-error-shadow)}}}";var KB={inputBackgroundColor:"transparent",inputBorder:!1,inputBorderRadius:0,inputTextColor:{ref:"textColor"},inputPlaceholderTextColor:{ref:"inputTextColor",mix:0.5},inputPaddingStart:0,inputHeight:{calc:"max(iconSize, fontSize) + spacing * 2"},inputFocusBackgroundColor:{ref:"inputBackgroundColor"},inputFocusBorder:{ref:"inputBorder"},inputFocusShadow:"none",inputFocusTextColor:{ref:"inputTextColor"},inputDisabledBackgroundColor:{ref:"inputBackgroundColor"},inputDisabledBorder:{ref:"inputBorder"},inputDisabledTextColor:{ref:"inputTextColor"},inputInvalidBackgroundColor:{ref:"inputBackgroundColor"},inputInvalidBorder:{ref:"inputBorder"},inputInvalidTextColor:{ref:"inputTextColor"},inputIconColor:{ref:"inputTextColor"},pickerButtonBorder:!1,pickerButtonFocusBorder:{ref:"inputFocusBorder"},pickerButtonBackgroundColor:{ref:"backgroundColor"},pickerButtonFocusBackgroundColor:{ref:"backgroundColor"},pickerListBorder:!1,pickerListBackgroundColor:{ref:"backgroundColor"},colorPickerThumbSize:18,colorPickerTrackSize:12,colorPickerThumbBorderWidth:3,colorPickerTrackBorderRadius:12,colorPickerColorBorderRadius:4};var LB=()=>D$({feature:"inputStyle",params:{...KB,inputBackgroundColor:x0,inputBorder:!0,inputBorderRadius:{ref:"borderRadius"},inputPaddingStart:{ref:"spacing"},inputFocusBorder:{color:S$},inputFocusShadow:{ref:"focusShadow"},inputDisabledBackgroundColor:o0(0.06),inputDisabledTextColor:{ref:"textColor",mix:0.5},inputInvalidBorder:{color:{ref:"invalidColor"}},pickerButtonBorder:!0,pickerListBorder:!0},css:()=>BB+EB}),DB=LB();var FB=".ag-tabs-header{background-color:var(--ag-tab-bar-background-color);border-bottom:var(--ag-tab-bar-border);display:flex;flex:1;gap:var(--ag-tab-spacing);padding:var(--ag-tab-bar-top-padding) var(--ag-tab-bar-horizontal-padding) 0}.ag-tabs-header-wrapper{display:flex}.ag-tabs-close-button-wrapper{align-items:center;border:0;display:flex;padding:var(--ag-spacing)}:where(.ag-ltr) .ag-tabs-close-button-wrapper{border-right:solid var(--ag-border-width) var(--ag-border-color)}:where(.ag-rtl) .ag-tabs-close-button-wrapper{border-left:solid var(--ag-border-width) var(--ag-border-color)}.ag-tabs-close-button{background-color:unset;border:0;cursor:pointer;padding:0}.ag-tab{align-items:center;background-color:var(--ag-tab-background-color);border-left:var(--ag-tab-selected-border-width) solid transparent;border-right:var(--ag-tab-selected-border-width) solid transparent;color:var(--ag-tab-text-color);cursor:pointer;display:flex;flex:1;justify-content:center;padding:var(--ag-tab-top-padding) var(--ag-tab-horizontal-padding) var(--ag-tab-bottom-padding);position:relative}.ag-tab:hover{background-color:var(--ag-tab-hover-background-color);color:var(--ag-tab-hover-text-color)}.ag-tab.ag-tab-selected{background-color:var(--ag-tab-selected-background-color);color:var(--ag-tab-selected-text-color)}:where(.ag-ltr) .ag-tab.ag-tab-selected:where(:not(:first-of-type)){border-left-color:var(--ag-tab-selected-border-color)}:where(.ag-rtl) .ag-tab.ag-tab-selected:where(:not(:first-of-type)){border-right-color:var(--ag-tab-selected-border-color)}:where(.ag-ltr) .ag-tab.ag-tab-selected:where(:not(:last-of-type)){border-right-color:var(--ag-tab-selected-border-color)}:where(.ag-rtl) .ag-tab.ag-tab-selected:where(:not(:last-of-type)){border-left-color:var(--ag-tab-selected-border-color)}.ag-tab:after{background-color:var(--ag-tab-selected-underline-color);bottom:0;content:\"\";display:block;height:var(--ag-tab-selected-underline-width);left:0;opacity:0;position:absolute;right:0;transition:opacity var(--ag-tab-selected-underline-transition-duration)}.ag-tab.ag-tab-selected:after{opacity:1}";var MB={tabBarBackgroundColor:"transparent",tabBarHorizontalPadding:0,tabBarTopPadding:0,tabBackgroundColor:"transparent",tabTextColor:{ref:"textColor"},tabHorizontalPadding:{ref:"spacing"},tabTopPadding:{ref:"spacing"},tabBottomPadding:{ref:"spacing"},tabSpacing:"0",tabHoverBackgroundColor:{ref:"tabBackgroundColor"},tabHoverTextColor:{ref:"tabTextColor"},tabSelectedBackgroundColor:{ref:"tabBackgroundColor"},tabSelectedTextColor:{ref:"tabTextColor"},tabSelectedBorderWidth:{ref:"borderWidth"},tabSelectedBorderColor:"transparent",tabSelectedUnderlineColor:"transparent",tabSelectedUnderlineWidth:0,tabSelectedUnderlineTransitionDuration:0,tabBarBorder:!1};var kB=()=>D$({feature:"tabStyle",params:{...MB,tabBarBorder:!0,tabBarBackgroundColor:s0(0.05),tabTextColor:{ref:"textColor",mix:0.7},tabSelectedTextColor:{ref:"textColor"},tabHoverTextColor:{ref:"textColor"},tabSelectedBorderColor:{ref:"borderColor"},tabSelectedBackgroundColor:x0},css:FB}),VB=kB();var AB=()=>({fontFamily:[{googleFont:"IBM Plex Sans"},"-apple-system","BlinkMacSystemFont","Segoe UI","Roboto","Oxygen-Sans","Ubuntu"]}),SB=()=>JB().withPart(YB).withPart(_B).withPart(WB).withPart(VB).withPart(DB).withPart(C8).withParams(AB()),V4=SB();var Ez=($,z,Q,J,Z)=>({changeKey:$,type:z,defaultValue:Q,noWarn:J,cacheDefault:Z}),RB=Ez("cellHorizontalPadding","length",16),jB=Ez("indentationLevel","length",0,!0,!0),fB=Ez("rowGroupIndentSize","length",0),i5=Ez("rowHeight","length",42),n5=Ez("headerHeight","length",48),dZ=Ez("rowBorderWidth","border",1),d5=Ez("pinnedRowBorderWidth","border",1),OB=Ez("headerRowBorderWidth","border",1);function PB($,z){for(let Q of z.sort((J,Z)=>J.moduleName.localeCompare(Z.moduleName))){let J=Q.css;if(J)$.set(`module-${Q.moduleName}`,J)}}var TB=class extends hW{initVariables(){this.addManagedPropertyListener("rowHeight",()=>this.refreshRowHeightVariable()),this.getSizeEl(i5),this.getSizeEl(n5),this.getSizeEl(dZ),this.getSizeEl(d5),this.refreshRowBorderWidthVariable()}getPinnedRowBorderWidth(){return this.getCSSVariablePixelValue(d5)}getRowBorderWidth(){return this.getCSSVariablePixelValue(dZ)}getHeaderRowBorderWidth(){return this.getCSSVariablePixelValue(OB)}getDefaultRowHeight(){return this.getCSSVariablePixelValue(i5)}getDefaultHeaderHeight(){return this.getCSSVariablePixelValue(n5)}getDefaultCellHorizontalPadding(){return this.getCSSVariablePixelValue(RB)}getCellPaddingLeft(){let $=this.getDefaultCellHorizontalPadding(),z=this.getCSSVariablePixelValue(jB),Q=this.getCSSVariablePixelValue(fB);return $-1+Q*z}getCellPadding(){let $=this.getDefaultCellHorizontalPadding()-1;return this.getCellPaddingLeft()+$}getDefaultColumnMinWidth(){return Math.min(36,this.getDefaultRowHeight())}refreshRowHeightVariable(){let{eRootDiv:$}=this,z=$.style.getPropertyValue("--ag-line-height").trim(),Q=this.gos.get("rowHeight");if(Q==null||isNaN(Q)||!isFinite(Q)){if(z!==null)$.style.setProperty("--ag-line-height",null);return-1}let J=`${Q}px`;if(z!=J)return $.style.setProperty("--ag-line-height",J),Q;return z!=""?Number.parseFloat(z):-1}fireStylesChangedEvent($){if($==="rowBorderWidth")this.refreshRowBorderWidthVariable();super.fireStylesChangedEvent($)}refreshRowBorderWidthVariable(){let $=this.getCSSVariablePixelValue(dZ);this.eRootDiv.style.setProperty("--ag-internal-row-border-width",`${$}px`)}postProcessThemeChange($,z){if($&&getComputedStyle(this.getMeasurementContainer()).getPropertyValue("--ag-legacy-styles-loaded"))if(z)e(106);else e(239)}getAdditionalCss(){let $=new Map;return $.set("core",[mW]),PB($,Array.from(Rq())),$}getDefaultTheme(){return V4}varError($,z){j(9,{variable:{cssName:$,defaultValue:z}})}themeError($){e(240,{theme:$})}shadowRootError(){e(293)}},vB=class extends R0{constructor(){super(...arguments);this.beanName="eventSvc",this.eventServiceType="global",this.globalSvc=new K$}addListener($,z,Q){this.globalSvc.addEventListener($,z,Q)}removeListener($,z,Q){this.globalSvc.removeEventListener($,z,Q)}addGlobalListener($,z=!1){this.globalSvc.addGlobalListener($,z)}removeGlobalListener($,z=!1){this.globalSvc.removeGlobalListener($,z)}dispatchEvent($){this.globalSvc.dispatchEvent(this.gos.addCommon($))}dispatchEventOnce($){this.globalSvc.dispatchEventOnce(this.gos.addCommon($))}},IB=class extends vB{postConstruct(){let{globalListener:$,globalSyncListener:z}=this.beans;if($)this.addGlobalListener($,!0);if(z)this.addGlobalListener(z,!1)}};function K2($,z,Q){let J=$.visibleCols.headerGroupRowCount;if(Q>=J)return{column:z,headerRowIndex:Q};let Z=z.getParent();while(Z&&Z.getProvidedColumnGroup().getLevel()>Q)Z=Z.getParent();let X=z.isSpanHeaderHeight();if(!Z||X&&Z.isPadding())return{column:z,headerRowIndex:J};return{column:Z,headerRowIndex:Z.getProvidedColumnGroup().getLevel()}}var CB=class extends S{constructor(){super(...arguments);this.beanName="headerNavigation",this.currentHeaderRowWithoutSpan=-1}postConstruct(){let $=this.beans;$.ctrlsSvc.whenReady(this,(Q)=>{this.gridBodyCon=Q.gridBodyCtrl});let z=Y0($);this.addManagedElementListeners(z,{mousedown:()=>{this.currentHeaderRowWithoutSpan=-1}})}getHeaderPositionForColumn($,z){let Q,{colModel:J,colGroupSvc:Z,ctrlsSvc:X}=this.beans;if(typeof $==="string"){if(Q=J.getCol($),!Q)Q=Z?.getColumnGroup($)??null}else Q=$;if(!Q)return null;let q=X.getHeaderRowContainerCtrl()?.getAllCtrls(),G=b(q||[]).type==="filter",_=l0(this.beans)-1,H=-1,U=Q;while(U)H++,U=U.getParent();let W=H;if(z&&G&&W===_-1)W++;return W===-1?null:{headerRowIndex:W,column:Q}}navigateVertically($,z){let{focusSvc:Q,visibleCols:J}=this.beans,{focusedHeader:Z}=Q;if(!Z)return!1;let{headerRowIndex:X}=Z,Y=Z.column,q=l0(this.beans),G=this.getHeaderRowType(X),_=J.headerGroupRowCount,{headerRowIndex:H,column:U,headerRowIndexWithoutSpan:W}=$==="UP"?bB(G,Y,X):yB(Y,X,_),B=!1;if(H<0)H=0,U=Y,B=!0;if(H>=q)H=-1,this.currentHeaderRowWithoutSpan=-1;else if(W!==void 0)this.currentHeaderRowWithoutSpan=W;if(!B&&!U)return!1;return Q.focusHeaderPosition({headerPosition:{headerRowIndex:H,column:U},allowUserOverride:!0,event:z})}navigateHorizontally($,z=!1,Q){let{focusSvc:J,gos:Z}=this.beans,X={...J.focusedHeader},Y,q;if(this.currentHeaderRowWithoutSpan!==-1)X.headerRowIndex=this.currentHeaderRowWithoutSpan;else this.currentHeaderRowWithoutSpan=X.headerRowIndex;if($==="LEFT"!==Z.get("enableRtl"))q="Before",Y=this.findHeader(X,q);else q="After",Y=this.findHeader(X,q);let G=Z.getCallback("tabToNextHeader");if(z&&G){let _=J.focusHeaderPositionFromUserFunc({userFunc:G,headerPosition:Y,direction:q});if(_){let{headerRowIndex:H}=J.focusedHeader||{};if(H!=null&&H!=X.headerRowIndex)this.currentHeaderRowWithoutSpan=H}return _}if(Y||!z)return J.focusHeaderPosition({headerPosition:Y,direction:q,fromTab:z,allowUserOverride:!0,event:Q});return this.focusNextHeaderRow(X,q,Q)}focusNextHeaderRow($,z,Q){let J=this.beans,Z=$.headerRowIndex,X=null,Y,q=l0(J),G=this.beans.visibleCols.allCols;if(z==="Before"){if(Z<=0)return!1;X=b(G),Y=Z-1,this.currentHeaderRowWithoutSpan-=1}else if(X=G[0],Y=Z+1,this.currentHeaderRowWithoutSpan=q)H=-1;return J.focusSvc.focusHeaderPosition({headerPosition:{column:_,headerRowIndex:H},direction:z,fromTab:!0,allowUserOverride:!0,event:Q})}scrollToColumn($,z="After"){if($.getPinned())return;let Q;if(H0($)){let J=$.getDisplayedLeafColumns();Q=z==="Before"?b(J):J[0]}else Q=$;this.gridBodyCon.scrollFeature.ensureColumnVisible(Q)}findHeader($,z){let{colGroupSvc:Q,visibleCols:J}=this.beans,Z=$.column;if(Z instanceof aQ){let G=Z.getDisplayedLeafColumns();Z=z==="Before"?G[0]:G[G.length-1]}let X=z==="Before"?J.getColBefore(Z):J.getColAfter(Z);if(!X)return;let Y=J.headerGroupRowCount;if($.headerRowIndex>=Y)return{headerRowIndex:$.headerRowIndex,column:X};let q=Q?.getColGroupAtLevel(X,$.headerRowIndex);if(!q)return{headerRowIndex:X instanceof q$&&X.isSpanHeaderHeight()?J.headerGroupRowCount:$.headerRowIndex,column:X};if(q.isPadding()&&X.isSpanHeaderHeight())return{headerRowIndex:J.headerGroupRowCount,column:X};return{headerRowIndex:$.headerRowIndex,column:q??X}}getHeaderRowType($){let z=this.beans.ctrlsSvc.getHeaderRowContainerCtrl();if(z)return z.getRowType($)}};function bB($,z,Q){let J=Q-1;if($!=="filter"){let Z=z instanceof q$&&z.isSpanHeaderHeight(),X=z.getParent();while(X&&(X.getProvidedColumnGroup().getLevel()>J||Z&&X.isPadding()))X=X.getParent();if(X)if(Z)return{column:X,headerRowIndex:X.getProvidedColumnGroup().getLevel(),headerRowIndexWithoutSpan:J};else return{column:X,headerRowIndex:J,headerRowIndexWithoutSpan:J}}return{column:z,headerRowIndex:J,headerRowIndexWithoutSpan:J}}function yB($,z,Q){let J=z+1,Z={column:$,headerRowIndex:J,headerRowIndexWithoutSpan:J};if($ instanceof aQ){if(J>=Q)return{column:$.getDisplayedLeafColumns()[0],headerRowIndex:Q,headerRowIndexWithoutSpan:J};let Y=$.getDisplayedChildren()[0];if(Y instanceof aQ&&Y.isPadding()){let G=Y.getDisplayedLeafColumns()[0];if(G.isSpanHeaderHeight())Y=G}if(Z.column=Y,Y instanceof q$&&Y.isSpanHeaderHeight())Z.headerRowIndex=Q,Z.headerRowIndexWithoutSpan=J}return Z}var xB=class extends S{constructor(){super(...arguments);this.beanName="focusSvc",this.focusFallbackTimeout=null,this.needsFocusRestored=!1}wireBeans($){this.colModel=$.colModel,this.visibleCols=$.visibleCols,this.rowRenderer=$.rowRenderer,this.navigation=$.navigation,this.filterManager=$.filterManager,this.overlays=$.overlays}postConstruct(){let $=this.clearFocusedCell.bind(this);this.addManagedEventListeners({columnPivotModeChanged:$,newColumnsLoaded:this.onColumnEverythingChanged.bind(this),columnGroupOpened:$,columnRowGroupChanged:$}),this.addDestroyFunc(cG(this.beans))}attemptToRecoverFocus(){if(this.needsFocusRestored=!0,this.focusFallbackTimeout!=null)clearTimeout(this.focusFallbackTimeout);this.focusFallbackTimeout=window.setTimeout(this.setFocusRecovered.bind(this),100)}setFocusRecovered(){if(this.needsFocusRestored=!1,this.focusFallbackTimeout!=null)clearTimeout(this.focusFallbackTimeout),this.focusFallbackTimeout=null}shouldTakeFocus(){if(this.gos.get("suppressFocusAfterRefresh"))return this.setFocusRecovered(),!1;if(this.needsFocusRestored)return this.setFocusRecovered(),!0;return this.doesRowOrCellHaveBrowserFocus()}onColumnEverythingChanged(){if(!this.focusedCell)return;let $=this.focusedCell.column,z=this.colModel.getCol($.getId());if($!==z)this.clearFocusedCell()}getFocusCellToUseAfterRefresh(){let{gos:$,focusedCell:z}=this;if($.get("suppressFocusAfterRefresh")||$.get("suppressCellFocus")||!z)return null;if(!this.doesRowOrCellHaveBrowserFocus())return null;return z}getFocusHeaderToUseAfterRefresh(){if(this.gos.get("suppressFocusAfterRefresh")||!this.focusedHeader)return null;if(!this.isDomDataPresentInHierarchy(d(this.beans),s7))return null;return this.focusedHeader}doesRowOrCellHaveBrowserFocus(){let $=d(this.beans);if(this.isDomDataPresentInHierarchy($,_J,!0))return!0;return this.isDomDataPresentInHierarchy($,HJ,!0)}isDomDataPresentInHierarchy($,z,Q){let J=$;while(J){let Z=X7(this.gos,J,z);if(Z){if(Z.destroyed&&Q)return this.attemptToRecoverFocus(),!1;return!0}J=J.parentNode}return!1}getFocusedCell(){return this.focusedCell}getFocusEventParams($){let{rowIndex:z,rowPinned:Q,column:J}=$,Z={rowIndex:z,rowPinned:Q,column:J,isFullWidthCell:!1},X=this.rowRenderer.getRowByPosition({rowIndex:z,rowPinned:Q});if(X)Z.isFullWidthCell=X.isFullWidth();return Z}clearFocusedCell(){if(this.focusedCell==null)return;let $=this.getFocusEventParams(this.focusedCell);this.focusedCell=null,this.eventSvc.dispatchEvent({type:"cellFocusCleared",...$})}setFocusedCell($){this.setFocusRecovered();let{column:z,rowIndex:Q,rowPinned:J,forceBrowserFocus:Z=!1,preventScrollOnBrowserFocus:X=!1,sourceEvent:Y}=$,q=this.colModel.getCol(z);if(!q){this.focusedCell=null;return}this.focusedCell={rowIndex:Q,rowPinned:j$(J),column:q};let G=this.getFocusEventParams(this.focusedCell);this.eventSvc.dispatchEvent({type:"cellFocused",...G,...this.previousCellFocusParams&&{previousParams:this.previousCellFocusParams},forceBrowserFocus:Z,preventScrollOnBrowserFocus:X,sourceEvent:Y}),this.previousCellFocusParams=G}isCellFocused($){if(this.focusedCell==null)return!1;return AQ($,this.focusedCell)}isHeaderWrapperFocused($){if(this.focusedHeader==null)return!1;let{column:z,rowCtrl:{rowIndex:Q,pinned:J}}=$,{column:Z,headerRowIndex:X}=this.focusedHeader;return z===Z&&Q===X&&J==Z.getPinned()}focusHeaderPosition($){if(this.setFocusRecovered(),H$(this.beans))return!1;let{direction:z,fromTab:Q,allowUserOverride:J,event:Z,fromCell:X,rowWithoutSpanValue:Y,scroll:q=!0}=$,{headerPosition:G}=$;if(X&&this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(G);if(J){let _=this.focusedHeader,H=l0(this.beans);if(Q){let U=this.gos.getCallback("tabToNextHeader");if(U)G=this.getHeaderPositionFromUserFunc({userFunc:U,direction:z,currentPosition:_,headerPosition:G,headerRowCount:H})}else{let U=this.gos.getCallback("navigateToNextHeader");if(U&&Z){let W={key:Z.key,previousHeaderPosition:_,nextHeaderPosition:G,headerRowCount:H,event:Z},B=U(W);G=B===null?_:B}}}if(!G)return!1;return this.focusProvidedHeaderPosition({headerPosition:G,direction:z,event:Z,fromCell:X,rowWithoutSpanValue:Y,scroll:q})}focusHeaderPositionFromUserFunc($){if(H$(this.beans))return!1;let{userFunc:z,headerPosition:Q,direction:J,event:Z}=$,X=this.focusedHeader,Y=l0(this.beans),q=this.getHeaderPositionFromUserFunc({userFunc:z,direction:J,currentPosition:X,headerPosition:Q,headerRowCount:Y});return!!q&&this.focusProvidedHeaderPosition({headerPosition:q,direction:J,event:Z})}getHeaderPositionFromUserFunc($){let{userFunc:z,direction:Q,currentPosition:J,headerPosition:Z,headerRowCount:X}=$,q=z({backwards:Q==="Before",previousHeaderPosition:J,nextHeaderPosition:Z,headerRowCount:X});if(q===!0)return J;if(q===!1)return null;return q}focusProvidedHeaderPosition($){let{headerPosition:z,direction:Q,fromCell:J,rowWithoutSpanValue:Z,event:X,scroll:Y=!0}=$,{column:q,headerRowIndex:G}=z,{filterManager:_,ctrlsSvc:H,headerNavigation:U}=this.beans;if(this.focusedHeader&&B_($.headerPosition,this.focusedHeader))return!1;if(G===-1){if(_?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(z);return this.focusGridView({column:q,event:X})}if(Y)U?.scrollToColumn(q,Q);let B=H.getHeaderRowContainerCtrl(q.getPinned())?.focusHeader(z.headerRowIndex,q,X)||!1;if(U&&B&&(Z!=null||J))U.currentHeaderRowWithoutSpan=Z??-1;return B}focusFirstHeader(){if(this.overlays?.exclusive&&this.focusOverlay())return!0;let $=this.visibleCols.allCols[0];if(!$)return!1;let z=K2(this.beans,$,0);return this.focusHeaderPosition({headerPosition:z,rowWithoutSpanValue:0})}focusLastHeader($){if(this.overlays?.exclusive&&this.focusOverlay(!0))return!0;let z=l0(this.beans)-1,Q=b(this.visibleCols.allCols);return this.focusHeaderPosition({headerPosition:{headerRowIndex:z,column:Q},rowWithoutSpanValue:-1,event:$})}focusPreviousFromFirstCell($){if(this.filterManager?.isAdvFilterHeaderActive())return this.focusAdvancedFilter(null);return this.focusLastHeader($)}isAnyCellFocused(){return!!this.focusedCell}isRowFocused($,z){if(this.focusedCell==null)return!1;return this.focusedCell.rowIndex===$&&this.focusedCell.rowPinned===j$(z)}focusOverlay($){let z=this.overlays?.isVisible()&&this.overlays.eWrapper?.getGui();return!!z&&F0(z,$)}getDefaultTabToNextGridContainerTarget($){let{backwards:z,focusableContainers:Q}=$,J=z?-1:1,Z,X=()=>{if(Z===void 0)Z=this.getGridBodyTabTarget(z);return Z};for(let Y=$.nextIndex;Y>=0&&Y{$.executeLaterVMTurn(()=>this.updateScrollVisibleImpl())});else this.updateScrollVisibleImpl()}updateScrollVisibleImpl(){let $=this.ctrlsSvc.get("center");if(!$||this.colAnimation?.isActive())return;let z={horizontalScrollShowing:$.isHorizontalScrollShowing(),verticalScrollShowing:this.verticalScrollShowing};this.setScrollsVisible(z),this.updateScrollGap()}updateScrollGap(){let $=this.ctrlsSvc.get("center"),z=$.hasHorizontalScrollGap(),Q=$.hasVerticalScrollGap();if(this.horizontalScrollGap!==z||this.verticalScrollGap!==Q)this.horizontalScrollGap=z,this.verticalScrollGap=Q,this.eventSvc.dispatchEvent({type:"scrollGapChanged"})}setScrollsVisible($){if(this.horizontalScrollShowing!==$.horizontalScrollShowing||this.verticalScrollShowing!==$.verticalScrollShowing)this.horizontalScrollShowing=$.horizontalScrollShowing,this.verticalScrollShowing=$.verticalScrollShowing,this.eventSvc.dispatchEvent({type:"scrollVisibilityChanged"})}getScrollbarWidth(){if(this.scrollbarWidth==null){let $=this.gos.get("scrollbarWidth"),Q=typeof $==="number"&&$>=0?$:r2();if(Q!=null)this.scrollbarWidth=Q,this.eventSvc.dispatchEvent({type:"scrollbarWidthChanged"})}return this.scrollbarWidth}},NB=class extends S{constructor(){super(...arguments);this.beanName="gridDestroySvc",this.destroyCalled=!1}destroy(){if(this.destroyCalled)return;let{stateSvc:$,ctrlsSvc:z,context:Q}=this.beans;this.eventSvc.dispatchEvent({type:"gridPreDestroyed",state:$?.getState()??{}}),this.destroyCalled=!0,z.get("gridCtrl")?.destroyGridUi(),Q.destroy(),super.destroy()}},gB=["columnEverythingChanged","newColumnsLoaded","columnPivotModeChanged","pivotMaxColumnsExceeded","columnRowGroupChanged","expandOrCollapseAll","columnPivotChanged","gridColumnsChanged","columnValueChanged","columnMoved","columnVisible","columnPinned","columnGroupOpened","columnResized","displayedColumnsChanged","virtualColumnsChanged","columnHeaderMouseOver","columnHeaderMouseLeave","columnHeaderClicked","columnHeaderContextMenu","asyncTransactionsFlushed","rowGroupOpened","rowDataUpdated","pinnedRowDataChanged","pinnedRowsChanged","rangeSelectionChanged","cellSelectionChanged","chartCreated","chartRangeSelectionChanged","chartOptionsChanged","chartDestroyed","toolPanelVisibleChanged","toolPanelSizeChanged","modelUpdated","cutStart","cutEnd","pasteStart","pasteEnd","fillStart","fillEnd","cellSelectionDeleteStart","cellSelectionDeleteEnd","rangeDeleteStart","rangeDeleteEnd","undoStarted","undoEnded","redoStarted","redoEnded","cellClicked","cellDoubleClicked","cellMouseDown","cellContextMenu","cellValueChanged","cellEditRequest","rowValueChanged","headerFocused","cellFocused","rowSelected","selectionChanged","tooltipShow","tooltipHide","cellKeyDown","cellMouseOver","cellMouseOut","filterChanged","filterModified","filterUiChanged","filterOpened","floatingFilterUiChanged","advancedFilterBuilderVisibleChanged","sortChanged","virtualRowRemoved","rowClicked","rowDoubleClicked","gridReady","gridPreDestroyed","gridSizeChanged","viewportChanged","firstDataRendered","dragStarted","dragStopped","dragCancelled","rowEditingStarted","rowEditingStopped","cellEditingStarted","cellEditingStopped","bodyScroll","bodyScrollEnd","paginationChanged","componentStateChanged","storeRefreshed","stateUpdated","columnMenuVisibleChanged","contextMenuVisibleChanged","rowDragEnter","rowDragMove","rowDragLeave","rowDragEnd","rowDragCancel","findChanged","rowResizeStarted","rowResizeEnded","columnsReset","bulkEditingStarted","bulkEditingStopped","batchEditingStarted","batchEditingStopped"];var l1=new Set(["gridPreDestroyed","fillStart","pasteStart"]),A4=gB.reduce(($,z)=>{return $[z]=pq(z),$},{}),BQ={agSetColumnFilter:"SetFilter",agSetColumnFloatingFilter:"SetFilter",agMultiColumnFilter:"MultiFilter",agMultiColumnFloatingFilter:"MultiFilter",agGroupColumnFilter:"GroupFilter",agGroupColumnFloatingFilter:"GroupFilter",agGroupCellRenderer:"GroupCellRenderer",agGroupRowRenderer:"GroupCellRenderer",agRichSelect:"RichSelect",agRichSelectCellEditor:"RichSelect",agDetailCellRenderer:"SharedMasterDetail",agSparklineCellRenderer:"Sparklines",agDragAndDropImage:"SharedDragAndDrop",agColumnHeader:"ColumnHeaderComp",agColumnGroupHeader:"ColumnGroupHeaderComp",agSortIndicator:"Sort",agAnimateShowChangeCellRenderer:"HighlightChanges",agAnimateSlideCellRenderer:"HighlightChanges",agLoadingCellRenderer:"LoadingCellRenderer",agSkeletonCellRenderer:"SkeletonCellRenderer",agCheckboxCellRenderer:"CheckboxCellRenderer",agLoadingOverlay:"Overlay",agExportingOverlay:"Overlay",agNoRowsOverlay:"Overlay",agNoMatchingRowsOverlay:"Overlay",agTooltipComponent:"Tooltip",agReadOnlyFloatingFilter:"CustomFilter",agTextColumnFilter:"TextFilter",agNumberColumnFilter:"NumberFilter",agBigIntColumnFilter:"BigIntFilter",agDateColumnFilter:"DateFilter",agDateInput:"DateFilter",agTextColumnFloatingFilter:"TextFilter",agNumberColumnFloatingFilter:"NumberFilter",agBigIntColumnFloatingFilter:"BigIntFilter",agDateColumnFloatingFilter:"DateFilter",agFormulaCellEditor:"Formula",agCellEditor:"TextEditor",agSelectCellEditor:"SelectEditor",agTextCellEditor:"TextEditor",agNumberCellEditor:"NumberEditor",agDateCellEditor:"DateEditor",agDateStringCellEditor:"DateEditor",agCheckboxCellEditor:"CheckboxEditor",agLargeTextCellEditor:"LargeTextEditor",agMenuItem:"MenuItem",agColumnsToolPanel:"ColumnsToolPanel",agFiltersToolPanel:"FiltersToolPanel",agNewFiltersToolPanel:"NewFiltersToolPanel",agAggregationComponent:"StatusBar",agSelectedRowCountComponent:"StatusBar",agTotalRowCountComponent:"StatusBar",agFilteredRowCountComponent:"StatusBar",agTotalAndFilteredRowCountComponent:"StatusBar",agFindCellRenderer:"Find"};function t5($){return`"${$}"`}var hB=()=>({checkboxSelection:{version:"32.2",message:"Use `rowSelection.checkboxes` in `GridOptions` instead."},headerCheckboxSelection:{version:"32.2",message:"Use `rowSelection.headerCheckbox = true` in `GridOptions` instead."},headerCheckboxSelectionFilteredOnly:{version:"32.2",message:'Use `rowSelection.selectAll = "filtered"` in `GridOptions` instead.'},headerCheckboxSelectionCurrentPageOnly:{version:"32.2",message:'Use `rowSelection.selectAll = "currentPage"` in `GridOptions` instead.'},showDisabledCheckboxes:{version:"32.2",message:"Use `rowSelection.hideDisabledCheckboxes = true` in `GridOptions` instead."},rowGroupingHierarchy:{version:"34.3",message:"Use `colDef.groupHierarchy` instead."}}),uB={allowFormula:"Formula",aggFunc:"SharedAggregation",autoHeight:"RowAutoHeight",cellClass:"CellStyle",cellClassRules:"CellStyle",cellEditor:({cellEditor:$,editable:z,groupRowEditable:Q})=>{if(!(!!z||!!Q))return null;if(typeof $==="string")return BQ[$]??"CustomEditor";return"CustomEditor"},cellRenderer:({cellRenderer:$})=>{if(typeof $!=="string")return null;return BQ[$]},cellStyle:"CellStyle",columnChooserParams:"ColumnMenu",contextMenuItems:"ContextMenu",dndSource:"DragAndDrop",dndSourceOnRowDrag:"DragAndDrop",editable:({editable:$,cellEditor:z})=>{if($&&!z)return"TextEditor";return null},groupRowEditable:({groupRowEditable:$,cellEditor:z})=>{if(!$)return null;return z?"RowGroupingEdit":["RowGroupingEdit","TextEditor"]},groupRowValueSetter:({groupRowValueSetter:$})=>$?"RowGroupingEdit":null,enableCellChangeFlash:"HighlightChanges",enablePivot:"SharedPivot",enableRowGroup:"SharedRowGrouping",enableValue:"SharedAggregation",filter:({filter:$})=>{if($&&typeof $!=="string"&&typeof $!=="boolean")return"CustomFilter";if(typeof $==="string")return BQ[$]??"ColumnFilter";return"ColumnFilter"},floatingFilter:"ColumnFilter",getQuickFilterText:"QuickFilter",headerTooltip:"Tooltip",headerTooltipValueGetter:"Tooltip",mainMenuItems:"ColumnMenu",menuTabs:($)=>{let z=["columnsMenuTab","generalMenuTab"];if($.menuTabs?.some((Q)=>z.includes(Q)))return"ColumnMenu";return null},pivot:"SharedPivot",pivotIndex:"SharedPivot",rowDrag:"RowDrag",rowGroup:"SharedRowGrouping",rowGroupIndex:"SharedRowGrouping",tooltipField:"Tooltip",tooltipValueGetter:"Tooltip",tooltipComponentSelector:"Tooltip",spanRows:"CellSpan",groupHierarchy:"SharedRowGrouping"},mB=()=>{return{autoHeight:{supportedRowModels:["clientSide","serverSide"],validate:(z,{paginationAutoPageSize:Q})=>{if(Q)return"colDef.autoHeight is not supported with paginationAutoPageSize.";return null}},allowFormula:{supportedRowModels:["clientSide"]},cellRendererParams:{validate:(z)=>{if((z.rowGroup!=null||z.rowGroupIndex!=null||z.cellRenderer==="agGroupCellRenderer")&&"checkbox"in z.cellRendererParams)return'Since v33.0, `cellRendererParams.checkbox` has been deprecated. Use `rowSelection.checkboxLocation = "autoGroupColumn"` instead.';return null}},flex:{validate:(z,Q)=>{if(Q.autoSizeStrategy)return"colDef.flex is not supported with gridOptions.autoSizeStrategy";return null}},headerCheckboxSelection:{supportedRowModels:["clientSide","serverSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelection is only supported with rowSelection=multiple"},headerCheckboxSelectionCurrentPageOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionCurrentPageOnly is only supported with rowSelection=multiple"},headerCheckboxSelectionFilteredOnly:{supportedRowModels:["clientSide"],validate:(z,{rowSelection:Q})=>Q==="multiple"?null:"headerCheckboxSelectionFilteredOnly is only supported with rowSelection=multiple"},headerValueGetter:{validate:(z)=>{let Q=z.headerValueGetter;if(typeof Q==="function"||typeof Q==="string")return null;return"headerValueGetter must be a function or a valid string expression"}},icons:{validate:({icons:z})=>{if(z){if(z.smallDown)return $$(262);if(z.smallLeft)return $$(263);if(z.smallRight)return $$(264)}return null}},sort:{validate:(z)=>{if(UQ(z.sort)||Zz(z.sort))return null;return`sort must be of type (SortDirection | SortDef), currently it is ${typeof z.sort==="object"?JSON.stringify(z.sort):n1(z.sort)}`}},initialSort:{validate:(z)=>{if(UQ(z.initialSort)||Zz(z.initialSort))return null;return`initialSort must be of non-null type (SortDirection | SortDef), currently it is ${typeof z.initialSort==="object"?JSON.stringify(z.initialSort):n1(z.initialSort)}`}},sortingOrder:{validate:(z)=>{let Q=z.sortingOrder;if(Array.isArray(Q)&&Q.length>0){let J=Q.filter((Z)=>{return!(UQ(Z)||Zz(Z))});if(J.length>0)return`sortingOrder must be an array of type non-null (SortDirection | SortDef)[], incorrect items are: [${J.map((Z)=>typeof Z==="string"||Z==null?n1(Z):JSON.stringify(Z)).join(", ")}]`}else if(!Array.isArray(Q)||!Q.length)return`sortingOrder must be an array with at least one element, currently it is [${Q}]`;return null}},type:{validate:(z)=>{let Q=z.type;if(Q instanceof Array){if(Q.some((Z)=>typeof Z!=="string"))return"if colDef.type is supplied an array it should be of type 'string[]'";return null}if(typeof Q==="string")return null;return"colDef.type should be of type 'string' | 'string[]'"}},rowSpan:{validate:(z,{suppressRowTransform:Q})=>{if(!Q)return"colDef.rowSpan requires suppressRowTransform to be enabled.";return null}},spanRows:{dependencies:{editable:{required:[!1,void 0]},groupRowEditable:{required:[!1,void 0]},rowDrag:{required:[!1,void 0]},colSpan:{required:[void 0]},rowSpan:{required:[void 0]}},validate:(z,{rowSelection:Q,cellSelection:J,suppressRowTransform:Z,enableCellSpan:X,rowDragEntireRow:Y,enableCellTextSelection:q})=>{if(typeof Q==="object"){if(Q?.mode==="singleRow"&&Q?.enableClickSelection)return"colDef.spanRows is not supported with rowSelection.clickSelection"}if(J)return"colDef.spanRows is not supported with cellSelection.";if(Z)return"colDef.spanRows is not supported with suppressRowTransform.";if(!X)return"colDef.spanRows requires enableCellSpan to be enabled.";if(Y)return"colDef.spanRows is not supported with rowDragEntireRow.";if(q)return"colDef.spanRows is not supported with enableCellTextSelection.";return null}},groupHierarchy:{validate(z,{groupHierarchyConfig:Q={}},J){let Z=new Set(["year","quarter","month","formattedMonth","day","hour","minute","second"]),X=[];for(let Y of z.groupHierarchy??[]){if(typeof Y==="object"){J.validation?.validateColDef(Y);continue}if(!Z.has(Y)&&!(Y in Q))X.push(t5(Y))}if(X.length>0){let Y=`The following parts of colDef.groupHierarchy are not recognised: ${X.join(", ")}.`,q=`Choose one of ${[...Z].map(t5).join(", ")}, or define your own parts in gridOptions.groupHierarchyConfig.`;return`${Y} +${q}`}return null}}}},cB={headerName:void 0,columnGroupShow:void 0,headerStyle:void 0,headerClass:void 0,toolPanelClass:void 0,headerValueGetter:void 0,pivotKeys:void 0,groupId:void 0,colId:void 0,sort:void 0,initialSort:void 0,field:void 0,type:void 0,cellDataType:void 0,tooltipComponent:void 0,tooltipField:void 0,headerTooltip:void 0,headerTooltipValueGetter:void 0,cellClass:void 0,showRowGroup:void 0,filter:void 0,initialAggFunc:void 0,defaultAggFunc:void 0,aggFunc:void 0,groupRowEditable:void 0,groupRowValueSetter:void 0,pinned:void 0,initialPinned:void 0,chartDataType:void 0,cellAriaRole:void 0,cellEditorPopupPosition:void 0,headerGroupComponent:void 0,headerGroupComponentParams:void 0,cellStyle:void 0,cellRenderer:void 0,cellRendererParams:void 0,cellEditor:void 0,cellEditorParams:void 0,filterParams:void 0,pivotValueColumn:void 0,headerComponent:void 0,headerComponentParams:void 0,floatingFilterComponent:void 0,floatingFilterComponentParams:void 0,tooltipComponentParams:void 0,refData:void 0,columnChooserParams:void 0,children:void 0,sortingOrder:void 0,allowedAggFuncs:void 0,menuTabs:void 0,pivotTotalColumnIds:void 0,cellClassRules:void 0,icons:void 0,sortIndex:void 0,initialSortIndex:void 0,flex:void 0,initialFlex:void 0,width:void 0,initialWidth:void 0,minWidth:void 0,maxWidth:void 0,rowGroupIndex:void 0,initialRowGroupIndex:void 0,pivotIndex:void 0,initialPivotIndex:void 0,suppressColumnsToolPanel:void 0,suppressFiltersToolPanel:void 0,openByDefault:void 0,marryChildren:void 0,suppressStickyLabel:void 0,hide:void 0,initialHide:void 0,rowGroup:void 0,initialRowGroup:void 0,pivot:void 0,initialPivot:void 0,checkboxSelection:void 0,showDisabledCheckboxes:void 0,headerCheckboxSelection:void 0,headerCheckboxSelectionFilteredOnly:void 0,headerCheckboxSelectionCurrentPageOnly:void 0,suppressHeaderMenuButton:void 0,suppressMovable:void 0,lockPosition:void 0,lockVisible:void 0,lockPinned:void 0,unSortIcon:void 0,suppressSizeToFit:void 0,suppressAutoSize:void 0,enableRowGroup:void 0,enablePivot:void 0,enableValue:void 0,editable:void 0,suppressPaste:void 0,suppressNavigable:void 0,enableCellChangeFlash:void 0,rowDrag:void 0,dndSource:void 0,autoHeight:void 0,wrapText:void 0,sortable:void 0,resizable:void 0,singleClickEdit:void 0,floatingFilter:void 0,cellEditorPopup:void 0,suppressFillHandle:void 0,wrapHeaderText:void 0,autoHeaderHeight:void 0,dndSourceOnRowDrag:void 0,valueGetter:void 0,valueSetter:void 0,filterValueGetter:void 0,keyCreator:void 0,valueFormatter:void 0,valueParser:void 0,comparator:void 0,equals:void 0,pivotComparator:void 0,suppressKeyboardEvent:void 0,suppressHeaderKeyboardEvent:void 0,colSpan:void 0,rowSpan:void 0,spanRows:void 0,getQuickFilterText:void 0,onCellValueChanged:void 0,onCellClicked:void 0,onCellDoubleClicked:void 0,onCellContextMenu:void 0,rowDragText:void 0,tooltipValueGetter:void 0,tooltipComponentSelector:void 0,cellRendererSelector:void 0,cellEditorSelector:void 0,suppressSpanHeaderHeight:void 0,useValueFormatterForExport:void 0,useValueParserForImport:void 0,mainMenuItems:void 0,contextMenuItems:void 0,suppressFloatingFilterButton:void 0,suppressHeaderFilterButton:void 0,suppressHeaderContextMenu:void 0,loadingCellRenderer:void 0,loadingCellRendererParams:void 0,loadingCellRendererSelector:void 0,context:void 0,dateComponent:void 0,dateComponentParams:void 0,getFindText:void 0,rowGroupingHierarchy:void 0,groupHierarchy:void 0,allowFormula:void 0},pB=()=>Object.keys(cB),iB=()=>({objectName:"colDef",allProperties:pB(),docsUrl:"column-properties/",deprecations:hB(),validations:mB()}),nB=["overlayLoadingTemplate","overlayNoRowsTemplate","gridId","quickFilterText","rowModelType","editType","domLayout","clipboardDelimiter","rowGroupPanelShow","multiSortKey","pivotColumnGroupTotals","pivotRowTotals","pivotPanelShow","fillHandleDirection","groupDisplayType","treeDataDisplayType","treeDataChildrenField","treeDataParentIdField","colResizeDefault","tooltipTrigger","serverSidePivotResultFieldSeparator","columnMenu","tooltipShowMode","invalidEditValueMode","grandTotalRow","themeCssLayer","findSearchValue","styleNonce","renderingMode"],dB=["components","rowStyle","context","autoGroupColumnDef","localeText","icons","datasource","dragAndDropImageComponentParams","serverSideDatasource","viewportDatasource","groupRowRendererParams","aggFuncs","fullWidthCellRendererParams","defaultColGroupDef","defaultColDef","defaultCsvExportParams","defaultExcelExportParams","columnTypes","rowClassRules","detailCellRendererParams","loadingCellRendererParams","overlayComponentParams","loadingOverlayComponentParams","noRowsOverlayComponentParams","activeOverlayParams","popupParent","themeStyleContainer","statusBar","chartThemeOverrides","customChartThemes","chartToolPanelsDef","dataTypeDefinitions","advancedFilterParent","advancedFilterBuilderParams","advancedFilterParams","formulaDataSource","formulaFuncs","initialState","autoSizeStrategy","selectionColumnDef","findOptions","filterHandlers","groupHierarchyConfig"],tB=["sortingOrder","alignedGrids","rowData","columnDefs","excelStyles","pinnedTopRowData","pinnedBottomRowData","chartThemes","rowClass","paginationPageSizeSelector","suppressOverlays"],g8=["rowHeight","detailRowHeight","rowBuffer","headerHeight","groupHeaderHeight","groupLockGroupColumns","floatingFiltersHeight","pivotHeaderHeight","pivotGroupHeaderHeight","groupDefaultExpanded","pivotDefaultExpanded","viewportRowModelPageSize","viewportRowModelBufferSize","autoSizePadding","maxBlocksInCache","maxConcurrentDatasourceRequests","tooltipShowDelay","tooltipSwitchShowDelay","tooltipHideDelay","cacheOverflowSize","paginationPageSize","cacheBlockSize","infiniteInitialRowCount","serverSideInitialRowCount","scrollbarWidth","asyncTransactionWaitMillis","blockLoadDebounceMillis","keepDetailRowsCount","undoRedoCellEditingLimit","cellFlashDuration","cellFadeDuration","tabIndex","pivotMaxGeneratedColumns","rowDragInsertDelay"],sB=["theme","rowSelection"],rB=["cellSelection","sideBar","rowNumbers","suppressGroupChangesColumnVisibility","groupAggFiltering","suppressStickyTotalRow","groupHideParentOfSingleChild","enableRowPinning"],h8=["loadThemeGoogleFonts","suppressMakeColumnVisibleAfterUnGroup","suppressRowClickSelection","suppressCellFocus","suppressHeaderFocus","suppressHorizontalScroll","groupSelectsChildren","alwaysShowHorizontalScroll","alwaysShowVerticalScroll","debug","enableBrowserTooltips","enableCellExpressions","groupSuppressBlankHeader","suppressMenuHide","suppressRowDeselection","unSortIcon","suppressMultiSort","alwaysMultiSort","singleClickEdit","suppressLoadingOverlay","suppressNoRowsOverlay","suppressAutoSize","skipHeaderOnAutoSize","suppressColumnMoveAnimation","suppressMoveWhenColumnDragging","suppressMovableColumns","suppressFieldDotNotation","enableRangeSelection","enableRangeHandle","enableFillHandle","suppressClearOnFillReduction","deltaSort","suppressTouch","allowContextMenuWithControlKey","suppressContextMenu","suppressDragLeaveHidesColumns","suppressRowGroupHidesColumns","suppressMiddleClickScrolls","suppressPreventDefaultOnMouseWheel","suppressCopyRowsToClipboard","copyHeadersToClipboard","copyGroupHeadersToClipboard","pivotMode","suppressAggFuncInHeader","suppressColumnVirtualisation","alwaysAggregateAtRootLevel","suppressFocusAfterRefresh","functionsReadOnly","animateRows","groupSelectsFiltered","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","enableRtl","enableCellSpan","suppressClickEdit","rowDragEntireRow","rowDragManaged","refreshAfterGroupEdit","suppressRowDrag","suppressMoveWhenRowDragging","rowDragMultiRow","enableGroupEdit","embedFullWidthRows","suppressPaginationPanel","groupHideOpenParents","groupHideColumnsUntilExpanded","groupAllowUnbalanced","pagination","paginationAutoPageSize","suppressScrollOnNewData","suppressScrollWhenPopupsAreOpen","purgeClosedRowNodes","cacheQuickFilter","includeHiddenColumnsInQuickFilter","ensureDomOrder","accentedSort","suppressChangeDetection","valueCache","valueCacheNeverExpires","aggregateOnlyChangedColumns","suppressAnimationFrame","suppressExcelExport","suppressCsvExport","includeHiddenColumnsInAdvancedFilter","suppressMultiRangeSelection","enterNavigatesVerticallyAfterEdit","enterNavigatesVertically","suppressPropertyNamesCheck","rowMultiSelectWithClick","suppressRowHoverHighlight","suppressRowTransform","suppressClipboardPaste","suppressLastEmptyLineOnPaste","enableCharts","suppressMaintainUnsortedOrder","enableCellTextSelection","suppressBrowserResizeObserver","suppressMaxRenderedRowRestriction","excludeChildrenWhenTreeDataFiltering","tooltipMouseTrack","tooltipInteraction","keepDetailRows","paginateChildRows","preventDefaultOnContextMenu","undoRedoCellEditing","allowDragFromColumnsToolPanel","pivotSuppressAutoColumn","suppressExpandablePivotGroups","debounceVerticalScrollbar","detailRowAutoHeight","serverSideSortAllLevels","serverSideEnableClientSideSort","serverSideOnlyRefreshFilteredGroups","suppressAggFilteredOnly","showOpenedGroup","suppressClipboardApi","suppressModelUpdateAfterUpdateTransaction","stopEditingWhenCellsLoseFocus","groupMaintainOrder","columnHoverHighlight","readOnlyEdit","suppressRowVirtualisation","enableCellEditingOnBackspace","resetRowDataOnUpdate","removePivotHeaderRowWhenSingleValueColumn","suppressCopySingleCellRanges","suppressGroupRowsSticky","suppressCutToClipboard","rowGroupPanelSuppressSort","allowShowChangeAfterFilter","enableAdvancedFilter","masterDetail","treeData","reactiveCustomComponents","applyQuickFilterBeforePivotOrAgg","suppressServerSideFullWidthLoadingRow","suppressAdvancedFilterEval","loading","maintainColumnOrder","enableStrictPivotColumnOrder","suppressSetFilterByDefault","enableFilterHandlers","suppressStartEditOnTab","hidePaddedHeaderRows","ssrmExpandAllAffectsAllRows","animateColumnResizing"],lB=["doesExternalFilterPass","processPivotResultColDef","processPivotResultColGroupDef","getBusinessKeyForNode","isRowSelectable","rowDragText","groupRowRenderer","dragAndDropImageComponent","fullWidthCellRenderer","loadingCellRenderer","overlayComponent","loadingOverlayComponent","noRowsOverlayComponent","overlayComponentSelector","activeOverlay","detailCellRenderer","quickFilterParser","quickFilterMatcher","getLocaleText","isExternalFilterPresent","getRowHeight","getRowClass","getRowStyle","getFullRowEditValidationErrors","getContextMenuItems","getMainMenuItems","processRowPostCreate","processCellForClipboard","getGroupRowAgg","isFullWidthRow","sendToClipboard","focusGridInnerElement","navigateToNextHeader","tabToNextHeader","navigateToNextCell","tabToNextCell","tabToNextGridContainer","processCellFromClipboard","getDocument","postProcessPopup","getChildCount","getDataPath","isRowMaster","postSortRows","processHeaderForClipboard","processUnpinnedColumns","processGroupHeaderForClipboard","paginationNumberFormatter","processDataFromClipboard","getServerSideGroupKey","isServerSideGroup","createChartContainer","getChartToolbarItems","fillOperation","isApplyServerSideTransaction","getServerSideGroupLevelParams","isServerSideGroupOpenByDefault","isGroupOpenByDefault","initialGroupOrderComparator","loadingCellRendererSelector","getRowId","chartMenuItems","groupTotalRow","alwaysPassFilter","isRowPinnable","isRowPinned","isRowValidDropPosition"],aB=()=>[...tB,...dB,...nB,...g8,...lB,...h8,...rB,...sB];var oB=()=>({suppressLoadingOverlay:{version:"32",message:"Use `loading`=false instead."},enableFillHandle:{version:"32.2",message:"Use `cellSelection.handle` instead."},enableRangeHandle:{version:"32.2",message:"Use `cellSelection.handle` instead."},enableRangeSelection:{version:"32.2",message:"Use `cellSelection = true` instead."},suppressMultiRangeSelection:{version:"32.2",message:"Use `cellSelection.suppressMultiRanges` instead."},suppressClearOnFillReduction:{version:"32.2",message:"Use `cellSelection.handle.suppressClearOnFillReduction` instead."},fillHandleDirection:{version:"32.2",message:"Use `cellSelection.handle.direction` instead."},fillOperation:{version:"32.2",message:"Use `cellSelection.handle.setFillValue` instead."},suppressRowClickSelection:{version:"32.2",message:"Use `rowSelection.enableClickSelection` instead."},suppressRowDeselection:{version:"32.2",message:"Use `rowSelection.enableClickSelection` instead."},rowMultiSelectWithClick:{version:"32.2",message:"Use `rowSelection.enableSelectionWithoutKeys` instead."},groupSelectsChildren:{version:"32.2",message:'Use `rowSelection.groupSelects = "descendants"` instead.'},groupSelectsFiltered:{version:"32.2",message:'Use `rowSelection.groupSelects = "filteredDescendants"` instead.'},isRowSelectable:{version:"32.2",message:"Use `selectionOptions.isRowSelectable` instead."},suppressCopySingleCellRanges:{version:"32.2",message:"Use `rowSelection.copySelectedRows` instead."},suppressCopyRowsToClipboard:{version:"32.2",message:"Use `rowSelection.copySelectedRows` instead."},onRangeSelectionChanged:{version:"32.2",message:"Use `onCellSelectionChanged` instead."},onRangeDeleteStart:{version:"32.2",message:"Use `onCellSelectionDeleteStart` instead."},onRangeDeleteEnd:{version:"32.2",message:"Use `onCellSelectionDeleteEnd` instead."},suppressBrowserResizeObserver:{version:"32.2",message:"The grid always uses the browser's ResizeObserver, this grid option has no effect."},onColumnEverythingChanged:{version:"32.2",message:"Either use `onDisplayedColumnsChanged` which is fired at the same time, or use one of the more specific column events."},groupRemoveSingleChildren:{version:"33",message:"Use `groupHideParentOfSingleChild` instead."},groupRemoveLowestSingleChildren:{version:"33",message:'Use `groupHideParentOfSingleChild: "leafGroupsOnly"` instead.'},suppressRowGroupHidesColumns:{version:"33",message:'Use `suppressGroupChangesColumnVisibility: "suppressHideOnGroup"` instead.'},suppressMakeColumnVisibleAfterUnGroup:{version:"33",message:'Use `suppressGroupChangesColumnVisibility: "suppressShowOnUngroup"` instead.'},unSortIcon:{version:"33",message:"Use `defaultColDef.unSortIcon` instead."},sortingOrder:{version:"33",message:"Use `defaultColDef.sortingOrder` instead."},suppressPropertyNamesCheck:{version:"33",message:"`gridOptions` and `columnDefs` both have a `context` property that should be used for arbitrary user data. This means that column definitions and gridOptions should only contain valid properties making this property redundant."},suppressAdvancedFilterEval:{version:"34",message:"Advanced filter no longer uses function evaluation, so this option has no effect."}});function V$($,z,Q){if(typeof z==="number"||z==null){if(z==null)return null;return z>=Q?null:`${$}: value should be greater than or equal to ${Q}`}return`${$}: value should be a number`}var eB={alignedGrids:"AlignedGrids",allowContextMenuWithControlKey:"ContextMenu",autoSizeStrategy:"ColumnAutoSize",cellSelection:"CellSelection",columnHoverHighlight:"ColumnHover",datasource:"InfiniteRowModel",doesExternalFilterPass:"ExternalFilter",editType:"EditCore",invalidEditValueMode:"EditCore",enableAdvancedFilter:"AdvancedFilter",enableCellSpan:"CellSpan",enableCharts:"IntegratedCharts",enableRangeSelection:"CellSelection",enableRowPinning:"PinnedRow",findSearchValue:"Find",getFullRowEditValidationErrors:"EditCore",getContextMenuItems:"ContextMenu",getLocaleText:"Locale",getMainMenuItems:"ColumnMenu",getRowClass:"RowStyle",getRowStyle:"RowStyle",groupTotalRow:"SharedRowGrouping",grandTotalRow:"ClientSideRowModelHierarchy",initialState:"GridState",isExternalFilterPresent:"ExternalFilter",isRowPinnable:"PinnedRow",isRowPinned:"PinnedRow",localeText:"Locale",masterDetail:"SharedMasterDetail",pagination:"Pagination",pinnedBottomRowData:"PinnedRow",pinnedTopRowData:"PinnedRow",pivotMode:"SharedPivot",pivotPanelShow:"RowGroupingPanel",quickFilterText:"QuickFilter",rowClass:"RowStyle",rowClassRules:"RowStyle",rowData:"ClientSideRowModel",rowDragManaged:"RowDrag",refreshAfterGroupEdit:["RowGrouping","TreeData"],rowGroupPanelShow:"RowGroupingPanel",rowNumbers:"RowNumbers",rowSelection:"SharedRowSelection",rowStyle:"RowStyle",serverSideDatasource:"ServerSideRowModel",sideBar:"SideBar",statusBar:"StatusBar",treeData:"SharedTreeData",undoRedoCellEditing:"UndoRedoEdit",valueCache:"ValueCache",viewportDatasource:"ViewportRowModel"},$E=()=>{let $={autoSizePadding:{validate({autoSizePadding:Q}){return V$("autoSizePadding",Q,0)}},cacheBlockSize:{supportedRowModels:["serverSide","infinite"],validate({cacheBlockSize:Q}){return V$("cacheBlockSize",Q,1)}},cacheOverflowSize:{validate({cacheOverflowSize:Q}){return V$("cacheOverflowSize",Q,1)}},datasource:{supportedRowModels:["infinite"]},domLayout:{validate:(Q)=>{let J=Q.domLayout,Z=["autoHeight","normal","print"];if(J&&!Z.includes(J))return`domLayout must be one of [${Z.join()}], currently it's ${J}`;return null}},enableFillHandle:{dependencies:{enableRangeSelection:{required:[!0]}}},enableRangeHandle:{dependencies:{enableRangeSelection:{required:[!0]}}},enableCellSpan:{supportedRowModels:["clientSide","serverSide"]},enableRangeSelection:{dependencies:{rowDragEntireRow:{required:[!1,void 0]}}},enableRowPinning:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,pinnedTopRowData:J,pinnedBottomRowData:Z}){if(Q&&(J||Z))return"Manual row pinning cannot be used together with pinned row data. Either set `enableRowPinning` to `false`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";return null}},isRowPinnable:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,isRowPinnable:J,pinnedTopRowData:Z,pinnedBottomRowData:X}){if(J&&(Z||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinnable`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&J)return"`isRowPinnable` requires `enableRowPinning` to be set.";return null}},isRowPinned:{supportedRowModels:["clientSide"],validate({enableRowPinning:Q,isRowPinned:J,pinnedTopRowData:Z,pinnedBottomRowData:X}){if(J&&(Z||X))return"Manual row pinning cannot be used together with pinned row data. Either remove `isRowPinned`, or remove `pinnedTopRowData` and `pinnedBottomRowData`.";if(!Q&&J)return"`isRowPinned` requires `enableRowPinning` to be set.";return null}},groupDefaultExpanded:{supportedRowModels:["clientSide"]},groupHideColumnsUntilExpanded:{supportedRowModels:["clientSide"],validate({groupHideColumnsUntilExpanded:Q,groupHideOpenParents:J,groupDisplayType:Z}){if(Q&&!J&&Z!=="multipleColumns")return"`groupHideColumnsUntilExpanded = true` requires either `groupDisplayType = 'multipleColumns'` or `groupHideOpenParents = true`";return null}},groupHideOpenParents:{supportedRowModels:["clientSide","serverSide"],dependencies:{groupTotalRow:{required:[void 0,"bottom"]},treeData:{required:[void 0,!1],reason:"Tree Data has values at the group level so it doesn't make sense to hide them."}}},groupHideParentOfSingleChild:{dependencies:{groupHideOpenParents:{required:[void 0,!1]}}},groupRemoveLowestSingleChildren:{dependencies:{groupHideOpenParents:{required:[void 0,!1]},groupRemoveSingleChildren:{required:[void 0,!1]}}},groupRemoveSingleChildren:{dependencies:{groupHideOpenParents:{required:[void 0,!1]},groupRemoveLowestSingleChildren:{required:[void 0,!1]}}},groupSelectsChildren:{dependencies:{rowSelection:{required:["multiple"]}}},groupHierarchyConfig:{validate({groupHierarchyConfig:Q={}},J,Z){for(let X of Object.keys(Q))Z.validation?.validateColDef(Q[X]);return null}},icons:{validate:({icons:Q})=>{if(Q){if(Q.smallDown)return $$(262);if(Q.smallLeft)return $$(263);if(Q.smallRight)return $$(264)}return null}},infiniteInitialRowCount:{validate({infiniteInitialRowCount:Q}){return V$("infiniteInitialRowCount",Q,1)}},initialGroupOrderComparator:{supportedRowModels:["clientSide"]},ssrmExpandAllAffectsAllRows:{validate:(Q)=>{if(typeof Q.ssrmExpandAllAffectsAllRows==="boolean"){if(Q.rowModelType!=="serverSide")return"'ssrmExpandAllAffectsAllRows' is only supported with the Server Side Row Model.";if(Q.ssrmExpandAllAffectsAllRows&&typeof Q.getRowId!=="function")return"'getRowId' callback must be provided for Server Side Row Model grouping to work correctly."}return null}},keepDetailRowsCount:{validate({keepDetailRowsCount:Q}){return V$("keepDetailRowsCount",Q,1)}},paginationPageSize:{validate({paginationPageSize:Q}){return V$("paginationPageSize",Q,1)}},paginationPageSizeSelector:{validate:(Q)=>{let J=Q.paginationPageSizeSelector;if(typeof J==="boolean"||J==null)return null;if(!J.length)return`'paginationPageSizeSelector' cannot be an empty array. + If you want to hide the page size selector, set paginationPageSizeSelector to false.`;return null}},pivotMode:{dependencies:{treeData:{required:[!1,void 0],reason:"Pivot Mode is not supported with Tree Data."}}},quickFilterText:{supportedRowModels:["clientSide"]},rowBuffer:{validate({rowBuffer:Q}){return V$("rowBuffer",Q,0)}},rowClass:{validate:(Q)=>{if(typeof Q.rowClass==="function")return"rowClass should not be a function, please use getRowClass instead";return null}},rowData:{supportedRowModels:["clientSide"]},rowDragManaged:{supportedRowModels:["clientSide"],dependencies:{pagination:{required:[!1,void 0]}}},rowSelection:{validate({rowSelection:Q}){if(Q&&typeof Q==="string")return'As of version 32.2.1, using `rowSelection` with the values "single" or "multiple" has been deprecated. Use the object value instead.';if(Q&&typeof Q!=="object")return"Expected `RowSelectionOptions` object for the `rowSelection` property.";if(Q&&Q.mode!=="multiRow"&&Q.mode!=="singleRow")return`Selection mode "${Q.mode}" is invalid. Use one of 'singleRow' or 'multiRow'.`;return null}},rowStyle:{validate:(Q)=>{let J=Q.rowStyle;if(J&&typeof J==="function")return"rowStyle should be an object of key/value styles, not be a function, use getRowStyle() instead";return null}},serverSideDatasource:{supportedRowModels:["serverSide"]},serverSideInitialRowCount:{supportedRowModels:["serverSide"],validate({serverSideInitialRowCount:Q}){return V$("serverSideInitialRowCount",Q,1)}},serverSideOnlyRefreshFilteredGroups:{supportedRowModels:["serverSide"]},serverSideSortAllLevels:{supportedRowModels:["serverSide"]},sortingOrder:{validate:(Q)=>{let J=Q.sortingOrder;if(Array.isArray(J)&&J.length>0){let Z=J.filter((X)=>!a0(X));if(Z.length>0)return`sortingOrder must be an array of type (SortDirection | SortDef)[], incorrect items are: ${Z.map((X)=>typeof X==="string"||X==null?n1(X):JSON.stringify(X))}]`}else if(!Array.isArray(J)||!J.length)return`sortingOrder must be an array with at least one element, currently it's ${J}`;return null}},tooltipHideDelay:{validate:(Q)=>{if(Q.tooltipHideDelay&&Q.tooltipHideDelay<0)return"tooltipHideDelay should not be lower than 0";return null}},tooltipShowDelay:{validate:(Q)=>{if(Q.tooltipShowDelay&&Q.tooltipShowDelay<0)return"tooltipShowDelay should not be lower than 0";return null}},tooltipSwitchShowDelay:{validate:(Q)=>{if(Q.tooltipSwitchShowDelay&&Q.tooltipSwitchShowDelay<0)return"tooltipSwitchShowDelay should not be lower than 0";return null}},treeData:{supportedRowModels:["clientSide","serverSide"],validate:(Q)=>{let J=Q.rowModelType??"clientSide";switch(J){case"clientSide":{let{treeDataChildrenField:Z,treeDataParentIdField:X,getDataPath:Y,getRowId:q}=Q;if(!Z&&!X&&!Y)return"treeData requires either 'treeDataChildrenField' or 'treeDataParentIdField' or 'getDataPath' in the clientSide row model.";if(Z){if(Y)return"Cannot use both 'treeDataChildrenField' and 'getDataPath' at the same time.";if(X)return"Cannot use both 'treeDataChildrenField' and 'treeDataParentIdField' at the same time."}if(X){if(!q)return"getRowId callback not provided, tree data with parent id cannot be built.";if(Y)return"Cannot use both 'treeDataParentIdField' and 'getDataPath' at the same time."}return null}case"serverSide":{let Z=`treeData requires 'isServerSideGroup' and 'getServerSideGroupKey' in the ${J} row model.`;return Q.isServerSideGroup&&Q.getServerSideGroupKey?null:Z}}return null}},viewportDatasource:{supportedRowModels:["viewport"]},viewportRowModelBufferSize:{validate({viewportRowModelBufferSize:Q}){return V$("viewportRowModelBufferSize",Q,0)}},viewportRowModelPageSize:{validate({viewportRowModelPageSize:Q}){return V$("viewportRowModelPageSize",Q,1)}},rowDragEntireRow:{dependencies:{cellSelection:{required:[void 0]}}},autoGroupColumnDef:{validate({autoGroupColumnDef:Q,showOpenedGroup:J}){if(Q?.field&&J)return"autoGroupColumnDef.field and showOpenedGroup are not supported when used together.";if(Q?.valueGetter&&J)return"autoGroupColumnDef.valueGetter and showOpenedGroup are not supported when used together.";return null}},renderingMode:{validate:(Q)=>{let J=Q.renderingMode,Z=["default","legacy"];if(J&&!Z.includes(J))return`renderingMode must be one of [${Z.join()}], currently it's ${J}`;return null}},autoSizeStrategy:{validate:({autoSizeStrategy:Q})=>{if(!Q)return null;let J=["fitCellContents","fitGridWidth","fitProvidedWidth"],Z=Q.type;if(Z!=="fitCellContents"&&Z!=="fitGridWidth"&&Z!=="fitProvidedWidth")return`Invalid Auto-size strategy. \`autoSizeStrategy\` must be one of ${J.map((X)=>'"'+X+'"').join(", ")}, currently it's ${Z}`;if(Z==="fitProvidedWidth"&&typeof Q.width!="number")return`When using the 'fitProvidedWidth' auto-size strategy, must provide a numeric \`width\`. You provided ${Q.width}`;return null}}},z={};for(let Q of h8)z[Q]={expectedType:"boolean"};for(let Q of g8)z[Q]={expectedType:"number"};return B0(z,$),z},zE=()=>({objectName:"gridOptions",allProperties:[...aB(),...Object.values(A4)],propertyExceptions:["api"],docsUrl:"grid-options/",deprecations:oB(),validations:$E()}),QE=0,JE=0,s5="__ag_grid_instance",ZE=class extends S{constructor(){super(...arguments);this.beanName="gos",this.domDataKey="__AG_"+Math.random().toString(),this.instanceId=JE++,this.gridReadyFired=!1,this.queueEvents=[],this.propEventSvc=new K$,this.globalEventHandlerFactory=($)=>{return(z,Q)=>{if(!this.isAlive())return;let J=l1.has(z);if(J&&!$||!J&&$)return;if(!XE(z))return;let Z=(X,Y)=>{let q=A4[X],G=this.gridOptions[q];if(typeof G==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>G(Y))};if(this.gridReadyFired)Z(z,Q);else if(z==="gridReady"){Z(z,Q),this.gridReadyFired=!0;for(let X of this.queueEvents)Z(X.eventName,X.event);this.queueEvents=[]}else this.queueEvents.push({eventName:z,event:Q})}}}wireBeans($){this.gridOptions=$.gridOptions,this.validation=$.validation,this.api=$.gridApi,this.gridId=$.context.getId()}get gridOptionsContext(){return this.gridOptions.context}postConstruct(){this.validateGridOptions(this.gridOptions),this.eventSvc.addGlobalListener(this.globalEventHandlerFactory().bind(this),!0),this.eventSvc.addGlobalListener(this.globalEventHandlerFactory(!0).bind(this),!1),this.propEventSvc.setFrameworkOverrides(this.beans.frameworkOverrides),this.addManagedEventListeners({gridOptionsChanged:({options:$})=>{this.updateGridOptions({options:$,force:!0,source:"optionsUpdated"})}})}destroy(){super.destroy(),this.queueEvents=[]}get($){return this.gridOptions[$]??Dq[$]}getCallback($){return this.mergeGridCommonParams(this.gridOptions[$])}exists($){return T(this.gridOptions[$])}mergeGridCommonParams($){if($)return(Q)=>{return $(this.addCommon(Q))};return $}updateGridOptions({options:$,force:z,source:Q="api"}){let J={id:QE++,properties:[]},Z=[],{gridOptions:X,validation:Y}=this;for(let q of Object.keys($)){let G=y2.applyGlobalGridOption(q,$[q]);Y?.warnOnInitialPropertyUpdate(Q,q);let _=z||typeof G==="object"&&Q==="api",H=X[q];if(_||H!==G){X[q]=G;let U={type:q,currentValue:G,previousValue:H,changeSet:J,source:Q};Z.push(U)}}this.validateGridOptions(this.gridOptions),J.properties=Z.map((q)=>q.type);for(let q of Z)dQ(this,`Updated property ${q.type} from`,q.previousValue," to ",q.currentValue),this.propEventSvc.dispatchEvent(q)}addPropertyEventListener($,z){this.propEventSvc.addEventListener($,z)}removePropertyEventListener($,z){this.propEventSvc.removeEventListener($,z)}getDomDataKey(){return this.domDataKey}addCommon($){return $.api=this.api,$.context=this.gridOptionsContext,$}validateOptions($,z){for(let Q of Object.keys($)){let J=$[Q];if(J==null||J===!1)continue;let Z=z[Q];if(typeof Z==="function")Z=Z($,this.gridOptions,this.beans);if(Z)this.assertModuleRegistered(Z,Q)}}validateGridOptions($){this.validateOptions($,eB),this.validation?.processGridOptions($)}validateColDef($,z,Q){if(Q||!this.beans.dataTypeSvc?.isColPendingInference(z))this.validateOptions($,uB),this.validation?.validateColDef($)}assertModuleRegistered($,z){let Q=Array.isArray($)?$.some((J)=>this.isModuleRegistered(J)):this.isModuleRegistered($);if(!Q)e(200,{...this.getModuleErrorParams(),moduleName:$,reasonOrId:z});return Q}getModuleErrorParams(){return{gridId:this.gridId,gridScoped:x2(),rowModelType:this.get("rowModelType"),isUmd:w2()}}isModuleRegistered($){return $2($,this.gridId,this.get("rowModelType"))}setInstanceDomData($){$[s5]=this.instanceId}isElementInThisInstance($){let z=$;while(z){let Q=z[s5];if(T(Q))return Q===this.instanceId;z=z.parentElement}return!1}};function XE($){return!!A4[$]}var YE=class extends S{constructor($,z){super();this.column=$,this.eGui=z,this.lastMovingChanged=0}postConstruct(){this.addManagedElementListeners(this.eGui,{click:($)=>$&&this.onClick($)}),this.addManagedListeners(this.column,{movingChanged:()=>{this.lastMovingChanged=Date.now()}})}onClick($){let{sortSvc:z,rangeSvc:Q,gos:J}=this.beans;if(!(Jz(J)?$.altKey:!0))Q?.handleColumnSelection(this.column,$);else if(this.column.isSortable()){let X=this.column.isMoving(),q=Date.now()-this.lastMovingChanged<50;if(!(X||q))z?.progressSortFromEvent(this.column,$)}}};function qE($,z){let Q={"aria-hidden":"true"};return{tag:"div",cls:"ag-cell-label-container",role:"presentation",children:[{tag:"span",ref:"eMenu",cls:"ag-header-icon ag-header-cell-menu-button",attrs:Q},{tag:"span",ref:"eFilterButton",cls:"ag-header-icon ag-header-cell-filter-button",attrs:Q},{tag:"div",ref:"eLabel",cls:"ag-header-cell-label",role:"presentation",children:[$?{tag:"span",ref:"eColRef",cls:"ag-header-col-ref"}:null,{tag:"span",ref:"eText",cls:"ag-header-cell-text"},{tag:"span",ref:"eFilter",cls:"ag-header-icon ag-header-label-icon ag-filter-icon",attrs:Q},z?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:null]}]}}var GE=class extends x{constructor(){super(...arguments);this.eFilter=f,this.eFilterButton=f,this.eSortIndicator=f,this.eMenu=f,this.eLabel=f,this.eText=f,this.eColRef=f,this.eSortOrder=f,this.eSortAsc=f,this.eSortDesc=f,this.eSortMixed=f,this.eSortNone=f,this.eSortAbsoluteAsc=f,this.eSortAbsoluteDesc=f,this.isLoadingInnerComponent=!1}refresh($){let z=this.params;if(this.params=$,this.workOutTemplate($,!!this.beans?.sortSvc)!=this.currentTemplate||this.workOutShowMenu()!=this.currentShowMenu||$.enableSorting!=this.currentSort||$.column.formulaRef!=this.currentRef||this.currentSuppressMenuHide!=null&&this.shouldSuppressMenuHide()!=this.currentSuppressMenuHide||z.enableFilterButton!=$.enableFilterButton||z.enableFilterIcon!=$.enableFilterIcon)return!1;if(this.innerHeaderComponent){let Q={...$};B0(Q,$.innerHeaderComponentParams),this.innerHeaderComponent.refresh?.(Q)}else this.setDisplayName($);return!0}workOutTemplate($,z){let{formula:Q}=this.beans,J=$.template;if(J)return J?.trim?J.trim():J;return qE(!!Q?.active,z)}init($){this.params=$;let{sortSvc:z,touchSvc:Q,rowNumbersSvc:J,userCompFactory:Z}=this.beans,X=z?.getSortIndicatorSelector();if(this.currentTemplate=this.workOutTemplate($,!!X),this.setTemplate(this.currentTemplate,X?[X]:void 0),this.eLabel)this.mouseListener??(this.mouseListener=this.createManagedBean(new YE($.column,this.eLabel)));Q?.setupForHeader(this),this.setMenu(),this.setupSort(),this.setupColumnRefIndicator(),J?.setupForHeader(this),this.setupFilterIcon(),this.setupFilterButton(),this.workOutInnerHeaderComponent(Z,$),this.setDisplayName($)}workOutInnerHeaderComponent($,z){let Q=PG($,z,z);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((J)=>{if(this.isLoadingInnerComponent=!1,!J)return;if(this.isAlive()){if(this.innerHeaderComponent=J,this.eText)this.eText.appendChild(J.getGui())}else this.destroyBean(J)})}setDisplayName($){let{displayName:z}=$,Q=this.currentDisplayName;if(this.currentDisplayName=z,!this.eText||Q===z||this.innerHeaderComponent||this.isLoadingInnerComponent)return;this.eText.textContent=J1(z)}addInIcon($,z,Q){let J=h($,this.beans,Q);if(J)z.appendChild(J)}workOutShowMenu(){return this.params.enableMenu&&!!this.beans.menuSvc?.isHeaderMenuButtonEnabled()}shouldSuppressMenuHide(){return!!this.beans.menuSvc?.isHeaderMenuButtonAlwaysShowEnabled()}setMenu(){if(!this.eMenu)return;if(this.currentShowMenu=this.workOutShowMenu(),!this.currentShowMenu){T0(this.eMenu),this.eMenu=void 0;return}let{gos:$,eMenu:z,params:Q}=this,J=U0($);this.addInIcon(J?"menu":"menuAlt",z,Q.column),z.classList.toggle("ag-header-menu-icon",!J);let Z=this.shouldSuppressMenuHide();this.currentSuppressMenuHide=Z,this.addManagedElementListeners(z,{click:()=>this.showColumnMenu(this.eMenu)}),this.toggleMenuAlwaysShow(Z)}toggleMenuAlwaysShow($){this.eMenu?.classList.toggle("ag-header-menu-always-show",$)}showColumnMenu($){let{currentSuppressMenuHide:z,params:Q}=this;if(!z)this.toggleMenuAlwaysShow(!0);Q.showColumnMenu($,()=>{if(!z)this.toggleMenuAlwaysShow(!1)})}onMenuKeyboardShortcut($){let{params:z,gos:Q,beans:J,eMenu:Z,eFilterButton:X}=this,Y=z.column,q=U0(Q);if($&&!q){if(J.menuSvc?.isFilterMenuInHeaderEnabled(Y))return z.showFilter(X??Z??this.getGui()),!0}else if(z.enableMenu)return this.showColumnMenu(Z??X??this.getGui()),!0;return!1}setupSort(){let{sortSvc:$}=this.beans;if(!$)return;let{enableSorting:z,column:Q}=this.params;if(this.currentSort=z,!this.eSortIndicator){this.eSortIndicator=this.createBean($.createSortIndicator(!0));let{eSortIndicator:J,eSortOrder:Z,eSortAsc:X,eSortDesc:Y,eSortMixed:q,eSortNone:G,eSortAbsoluteAsc:_,eSortAbsoluteDesc:H}=this;J.attachCustomElements(Z,X,Y,q,G,_,H)}if(this.eSortIndicator.setupSort(Q),!this.currentSort)return;$.setupHeader(this,Q)}setupColumnRefIndicator(){let{eColRef:$,beans:{editModelSvc:z},params:Q}=this;if(!$)return;this.currentRef=Q.column.formulaRef,$.textContent=this.currentRef,N($,!1),this.addManagedEventListeners({cellEditingStarted:()=>{let J=z?.getEditPositions(),Z=!!this.currentRef&&!!J?.some((X)=>X.column.isAllowFormula());N($,Z)},cellEditingStopped:()=>{N($,!1)}})}setupFilterIcon(){let{eFilter:$,params:z}=this;if(!$)return;let Q=()=>{let J=z.column.isFilterActive();N($,J,{skipAriaHidden:!0})};this.configureFilter(z.enableFilterIcon,$,Q,"filterActive")}setupFilterButton(){let{eFilterButton:$,params:z}=this;if(!$)return;if(this.configureFilter(z.enableFilterButton,$,this.onFilterChangedButton.bind(this),"filter"))this.addManagedElementListeners($,{click:()=>z.showFilter($)});else this.eFilterButton=void 0}configureFilter($,z,Q,J){if(!$)return T0(z),!1;let Z=this.params.column;return this.addInIcon(J,z,Z),this.addManagedListeners(Z,{filterChanged:Q}),Q(),!0}onFilterChangedButton(){let $=this.params.column.isFilterActive();this.eFilterButton.classList.toggle("ag-filter-active",$)}getAnchorElementForMenu($){let{eFilterButton:z,eMenu:Q}=this;if($)return z??Q??this.getGui();return Q??z??this.getGui()}destroy(){super.destroy(),this.innerHeaderComponent=this.destroyBean(this.innerHeaderComponent),this.mouseListener=this.destroyBean(this.mouseListener)}},_E=class extends S{constructor($,z){super();this.eLabel=$,this.columnGroup=z,this.isSticky=!1,this.left=null,this.right=null}postConstruct(){let{columnGroup:$,beans:z}=this,{ctrlsSvc:Q}=z;Q.whenReady(this,()=>{let J=this.refreshPosition.bind(this);if($.getPinned()==null)this.addManagedEventListeners({bodyScroll:(Z)=>{if(Z.direction==="horizontal")this.updateSticky(Z.left)}});this.addManagedListeners($,{leftChanged:J,displayedChildrenChanged:J}),this.addManagedEventListeners({columnResized:J}),this.refreshPosition()})}refreshPosition(){let{columnGroup:$,beans:z}=this,Q=$.getLeft(),J=$.getActualWidth();if(Q==null||J===0){this.left=null,this.right=null,this.setSticky(!1);return}this.left=Q,this.right=Q+J;let Z=z.colViewport.getScrollPosition();if(Z!=null)this.updateSticky(Z)}updateSticky($){let{beans:z,left:Q,right:J}=this;if(Q==null||J==null){this.setSticky(!1);return}let{gos:Z,visibleCols:X}=z,q=Z.get("enableRtl")?X.bodyWidth-$:$;this.setSticky(Qq)}setSticky($){let{isSticky:z,eLabel:Q}=this;if(z===$)return;this.isSticky=$,Q.classList.toggle("ag-sticky-label",$)}},HE={tag:"div",cls:"ag-header-group-cell-label",role:"presentation",children:[{tag:"span",ref:"agLabel",cls:"ag-header-group-text",role:"presentation"},{tag:"span",ref:"agOpened",cls:"ag-header-icon ag-header-expand-icon ag-header-expand-icon-expanded"},{tag:"span",ref:"agClosed",cls:"ag-header-icon ag-header-expand-icon ag-header-expand-icon-collapsed"}]},UE=class extends x{constructor(){super(HE);this.agOpened=f,this.agClosed=f,this.agLabel=f,this.isLoadingInnerComponent=!1}init($){let{userCompFactory:z,touchSvc:Q}=this.beans;this.params=$,this.checkWarnings(),this.workOutInnerHeaderGroupComponent(z,$),this.setupLabel($),this.addGroupExpandIcon($),this.setupExpandIcons(),Q?.setupForHeaderGroup(this)}checkWarnings(){if(this.params.template)j(89)}workOutInnerHeaderGroupComponent($,z){let Q=vG($,z,z);if(!Q)return;this.isLoadingInnerComponent=!0,Q.newAgStackInstance().then((J)=>{if(this.isLoadingInnerComponent=!1,!J)return;if(this.isAlive())this.innerHeaderGroupComponent=J,this.agLabel.appendChild(J.getGui());else this.destroyBean(J)})}setupExpandIcons(){let{agOpened:$,agClosed:z,params:{columnGroup:Q},beans:{colGroupSvc:J}}=this;this.addInIcon("columnGroupOpened",$),this.addInIcon("columnGroupClosed",z);let Z=(G)=>{if(z$(G))return;let _=!Q.isExpanded();J.setColumnGroupOpened(Q.getProvidedColumnGroup(),_,"uiColumnExpanded")};this.addTouchAndClickListeners(z,Z),this.addTouchAndClickListeners($,Z);let X=(G)=>{i0(G)};this.addManagedElementListeners(z,{dblclick:X}),this.addManagedElementListeners($,{dblclick:X}),this.addManagedElementListeners(this.getGui(),{dblclick:Z}),this.updateIconVisibility();let Y=Q.getProvidedColumnGroup(),q=this.updateIconVisibility.bind(this);this.addManagedListeners(Y,{expandedChanged:q,expandableChanged:q})}addTouchAndClickListeners($,z){this.beans.touchSvc?.setupForHeaderGroupElement(this,$,z),this.addManagedElementListeners($,{click:z})}updateIconVisibility(){let{agOpened:$,agClosed:z,params:{columnGroup:Q}}=this;if(Q.isExpandable()){let J=Q.isExpanded();N($,J),N(z,!J)}else N($,!1),N(z,!1)}addInIcon($,z){let Q=h($,this.beans,null);if(Q)z.appendChild(Q)}addGroupExpandIcon($){if(!$.columnGroup.isExpandable()){let{agOpened:z,agClosed:Q}=this;N(z,!1),N(Q,!1)}}setupLabel($){let{displayName:z,columnGroup:Q}=$,{innerHeaderGroupComponent:J,isLoadingInnerComponent:Z}=this,X=J||Z;if(T(z)&&!X)this.agLabel.textContent=J1(z);if(!Q.getColGroupDef()?.suppressStickyLabel)this.createManagedBean(new _E(this.getGui(),Q))}destroy(){if(super.destroy(),this.innerHeaderGroupComponent)this.destroyBean(this.innerHeaderGroupComponent),this.innerHeaderGroupComponent=void 0}},WE={moduleName:"ColumnHeaderComp",version:p,userComponents:{agColumnHeader:GE},icons:{menu:"menu",menuAlt:"menu-alt"}},BE={moduleName:"ColumnGroupHeaderComp",version:p,userComponents:{agColumnGroupHeader:UE},icons:{columnGroupOpened:"expanded",columnGroupClosed:"contracted"}},EE=class extends S{constructor(){super(...arguments);this.beanName="animationFrameSvc",this.p1={list:[],sorted:!1},this.p2={list:[],sorted:!1},this.f1={list:[],sorted:!1},this.destroyTasks=[],this.ticking=!1,this.scrollGoingDown=!0,this.lastScrollTop=0,this.taskCount=0}setScrollTop($){if(this.scrollGoingDown=$>=this.lastScrollTop,$===0)this.scrollGoingDown=!0;this.lastScrollTop=$}postConstruct(){this.active=!this.gos.get("suppressAnimationFrame"),this.batchFrameworkComps=this.beans.frameworkOverrides.batchFrameworkComps}verify(){if(this.active===!1)j(92)}createTask($,z,Q,J,Z=!1){this.verify();let X=Q;if(J&&this.batchFrameworkComps)X="f1";let Y={task:$,index:z,createOrder:++this.taskCount,deferred:Z};this.addTaskToList(this[X],Y),this.schedule()}addTaskToList($,z){$.list.push(z),$.sorted=!1}sortTaskList($){if($.sorted)return;let z=this.scrollGoingDown?1:-1;$.list.sort((Q,J)=>{if(Q.deferred!==J.deferred)return Q.deferred?-1:1;if(Q.index!==J.index)return z*(J.index-Q.index);return J.createOrder-Q.createOrder}),$.sorted=!0}addDestroyTask($){this.verify(),this.destroyTasks.push($),this.schedule()}executeFrame($){let{p1:z,p2:Q,f1:J,destroyTasks:Z,beans:X}=this,{ctrlsSvc:Y,frameworkOverrides:q}=X,G=z.list,_=Q.list,H=J.list,U=Date.now(),W=0,B=$<=0,E=Y.getScrollFeature();while(B||W<$){if(!E.scrollGridIfNeeded()){let L;if(G.length)this.sortTaskList(z),L=G.pop().task;else if(_.length)this.sortTaskList(Q),L=_.pop().task;else if(H.length)q.wrapOutgoing(()=>{while(B||W<$){if(!E.scrollGridIfNeeded())if(H.length)this.sortTaskList(J),L=H.pop().task,L();else break;else break;W=Date.now()-U}}),L=()=>{};else if(Z.length)L=Z.pop();else break;L()}W=Date.now()-U}if(G.length||_.length||H.length||Z.length)this.requestFrame();else this.ticking=!1}flushAllFrames(){if(!this.active)return;this.executeFrame(-1)}schedule(){if(!this.active)return;if(!this.ticking)this.ticking=!0,this.requestFrame()}requestFrame(){let $=this.executeFrame.bind(this,60);Y$(this.beans,$)}isQueueEmpty(){return!this.ticking}},KE={moduleName:"AnimationFrame",version:p,beans:[EE]},LE=class extends S{constructor(){super(...arguments);this.beanName="iconSvc"}createIconNoSpan($,z){return h($,this.beans,z?.column)}},DE=($,z,Q)=>z||$&&Q,FE=class extends S{constructor(){super(...arguments);this.beanName="touchSvc"}mockBodyContextMenu($,z){this.mockContextMenu($,$.eBodyViewport,z)}mockHeaderContextMenu($,z){this.mockContextMenu($,$.eGui,z)}mockRowContextMenu($){if(!bz())return;let z=(Q,J,Z)=>{let{rowCtrl:X,cellCtrl:Y}=$.getControlsForEventTarget(Z?.target??null);if(Y?.column)Y.dispatchCellContextMenuEvent(Z??null);this.beans.contextMenuSvc?.handleContextMenuMouseEvent(void 0,Z,X,Y)};this.mockContextMenu($,$.element,z)}handleCellDoubleClick($,z){if((()=>{if(!bz()||aZ("dblclick"))return!1;let J=Date.now(),Z=J-$.lastIPadMouseClickEvent<200;return $.lastIPadMouseClickEvent=J,Z})())return $.onCellDoubleClicked(z),z.preventDefault(),!0;return!1}setupForHeader($){let{gos:z,sortSvc:Q,menuSvc:J}=this.beans;if(z.get("suppressTouch"))return;let{params:Z,eMenu:X,eFilterButton:Y}=$,q=new h0($.getGui(),!0);$.addDestroyFunc(()=>q.destroy());let G=$.shouldSuppressMenuHide(),_=G&&T(X)&&Z.enableMenu,H=!!J?.isHeaderContextMenuEnabled(Z.column),U=DE(Z.enableMenu,H,U0(z)),W=q;if(_)W=new h0(X,!0),$.addDestroyFunc(()=>W.destroy());let B=(E)=>Z.showColumnMenuAfterMouseClick(E.touchStart);if(_&&Z.enableMenu)$.addManagedListeners(W,{tap:B});if(U)$.addManagedListeners(q,{longTap:B});if(Z.enableSorting){let E=(K)=>{let L=K.touchStart.target;if(G&&(X?.contains(L)||Y?.contains(L)))return;Q?.progressSort(Z.column,!1,"uiColumnSorted")};$.addManagedListeners(q,{tap:E})}if(Z.enableFilterButton&&Y){let E=new h0(Y,!0);$.addManagedListeners(E,{tap:()=>Z.showFilter(Y)}),$.addDestroyFunc(()=>E.destroy())}}setupForHeaderGroup($){let z=$.params;if(this.beans.menuSvc?.isHeaderContextMenuEnabled(z.columnGroup.getProvidedColumnGroup())){let Q=new h0(z.eGridHeader,!0),J=(Z)=>z.showColumnMenuAfterMouseClick(Z.touchStart);$.addManagedListeners(Q,{longTap:J}),$.addDestroyFunc(()=>Q.destroy())}}setupForHeaderGroupElement($,z,Q){let J=new h0(z,!0);$.addManagedListeners(J,{tap:Q}),$.addDestroyFunc(()=>J.destroy())}mockContextMenu($,z,Q){if(!bz())return;let J=new h0(z),Z=(X)=>{if(!nQ(this.beans,X.touchEvent))return;Q(void 0,X.touchStart,X.touchEvent)};$.addManagedListeners(J,{longTap:Z}),$.addDestroyFunc(()=>J.destroy())}},ME={moduleName:"Touch",version:p,beans:[FE]},kE=class extends S{constructor(){super(...arguments);this.beanName="cellNavigation"}wireBeans($){this.rowSpanSvc=$.rowSpanSvc}getNextCellToFocus($,z,Q=!1){if(Q)return this.getNextCellToFocusWithCtrlPressed($,z);return this.getNextCellToFocusWithoutCtrlPressed($,z)}getNextCellToFocusWithCtrlPressed($,z){let Q=$===A.UP,J=$===A.DOWN,Z=$===A.LEFT,X,Y,{pageBounds:q,gos:G,visibleCols:_,pinnedRowModel:H}=this.beans,{rowPinned:U}=z;if(Q||J){if(U&&H)if(Q)Y=0;else Y=U==="top"?H.getPinnedTopRowCount()-1:H.getPinnedBottomRowCount()-1;else Y=Q?q.getFirstRow():q.getLastRow();X=z.column}else{let W=G.get("enableRtl");Y=z.rowIndex,X=(Z!==W?_.allCols:[..._.allCols].reverse()).find((E)=>!v0(E)&&this.isCellGoodToFocusOn({rowIndex:Y,rowPinned:null,column:E}))}return X?{rowIndex:Y,rowPinned:U,column:X}:null}getNextCellToFocusWithoutCtrlPressed($,z){let Q=z,J=!1;while(!J){switch($){case A.UP:Q=this.getCellAbove(Q);break;case A.DOWN:Q=this.getCellBelow(Q);break;case A.RIGHT:Q=this.gos.get("enableRtl")?this.getCellToLeft(Q):this.getCellToRight(Q);break;case A.LEFT:Q=this.gos.get("enableRtl")?this.getCellToRight(Q):this.getCellToLeft(Q);break;default:Q=null,j(8,{key:$});break}if(Q)J=this.isCellGoodToFocusOn(Q);else J=!0}return Q}isCellGoodToFocusOn($){let z=$.column,Q,{pinnedRowModel:J,rowModel:Z}=this.beans;switch($.rowPinned){case"top":Q=J?.getPinnedTopRow($.rowIndex);break;case"bottom":Q=J?.getPinnedBottomRow($.rowIndex);break;default:Q=Z.getRow($.rowIndex);break}if(!Q)return!1;return!this.isSuppressNavigable(z,Q)}getCellToLeft($){if(!$)return null;let z=this.beans.visibleCols.getColBefore($.column);if(!z)return null;return{rowIndex:$.rowIndex,column:z,rowPinned:$.rowPinned}}getCellToRight($){if(!$)return null;let z=this.beans.visibleCols.getColAfter($.column);if(!z)return null;return{rowIndex:$.rowIndex,column:z,rowPinned:$.rowPinned}}getCellBelow($){if(!$)return null;let z=this.rowSpanSvc?.getCellEnd($)??$,Q=L0(this.beans,z,!0);if(Q)return{rowIndex:Q.rowIndex,column:$.column,rowPinned:Q.rowPinned};return null}getCellAbove($){if(!$)return null;let z=this.rowSpanSvc?.getCellStart($)??$,Q=m0(this.beans,{rowIndex:z.rowIndex,rowPinned:z.rowPinned},!0);if(Q)return{rowIndex:Q.rowIndex,column:$.column,rowPinned:Q.rowPinned};return null}getNextTabbedCell($,z){if(z)return this.getNextTabbedCellBackwards($);return this.getNextTabbedCellForwards($)}getNextTabbedCellForwards($){let{visibleCols:z,pagination:Q}=this.beans,J=z.allCols,Z=$.rowIndex,X=$.rowPinned,Y=z.getColAfter($.column);if(!Y){Y=J[0];let q=L0(this.beans,$,!0);if(n(q))return null;if(!q.rowPinned&&!(Q?.isRowInPage(q.rowIndex)??!0))return null;Z=q?q.rowIndex:null,X=q?q.rowPinned:null}return{rowIndex:Z,column:Y,rowPinned:X}}getNextTabbedCellBackwards($){let{beans:z}=this,{visibleCols:Q,pagination:J}=z,Z=Q.allCols,X=$.rowIndex,Y=$.rowPinned,q=Q.getColBefore($.column);if(!q){q=b(Z);let G=m0(z,{rowIndex:$.rowIndex,rowPinned:$.rowPinned},!0);if(n(G))return null;if(!G.rowPinned&&!(J?.isRowInPage(G.rowIndex)??!0))return null;X=G?G.rowIndex:null,Y=G?G.rowPinned:null}return{rowIndex:X,column:q,rowPinned:Y}}isSuppressNavigable($,z){let{suppressNavigable:Q}=$.colDef;if(typeof Q==="boolean")return Q;if(typeof Q==="function"){let J=$.createColumnFunctionCallbackParams(z);return Q(J)}return!1}};function VE($){return $.focusSvc.getFocusedCell()}function AE($){return $.focusSvc.clearFocusedCell()}function SE($,z,Q,J){$.focusSvc.setFocusedCell({rowIndex:z,column:Q,rowPinned:J,forceBrowserFocus:!0})}function RE($,z){return $.navigation?.tabToNextCell(!1,z)??!1}function jE($,z){return $.navigation?.tabToNextCell(!0,z)??!1}function fE($,z,Q=!1){let J=$.headerNavigation?.getHeaderPositionForColumn(z,Q);if(!J)return;$.focusSvc.focusHeaderPosition({headerPosition:J})}function m$($){let z=$;return z?.getFrameworkComponentInstance!=null?z.getFrameworkComponentInstance():$}var OE=class extends S{constructor(){super(...arguments);this.beanName="editModelSvc",this.edits=new Map,this.cellValidations=new u8,this.rowValidations=new m8,this.suspendEdits=!1}suspend($){this.suspendEdits=$}removeEdits({rowNode:$,column:z}){if(!this.hasEdits({rowNode:$})||!$)return;let Q=this.getEditRow($);if(z)Q.delete(z);else Q.clear();if(Q.size===0)this.edits.delete($)}getEditRow($,z={}){if(this.suspendEdits)return;if(this.edits.size===0)return;let Q=$&&this.edits.get($);if(Q)return Q;if(z.checkSiblings){let J=$.pinnedSibling;if(J)return this.getEditRow(J)}return}getEditRowDataValue($,{checkSiblings:z}={}){if(!$||this.edits.size===0)return;let Q=this.getEditRow($),J=$.pinnedSibling,Z=z&&J&&this.getEditRow(J);if(!Q&&!Z)return;let X={...$.data},Y=(q,G)=>q.forEach(({editorValue:_,pendingValue:H},U)=>{let W=_===void 0?H:_;if(W!==P0)G[U.getColId()]=W});if(Q)Y(Q,X);if(Z)Y(Z,X);return X}getEdit($={},z){let{rowNode:Q,column:J}=$,Z=this.edits;if(this.suspendEdits||Z.size===0||!Q||!J)return;let X=Z.get(Q)?.get(J);if(X)return X;if(z?.checkSiblings){let Y=Q.pinnedSibling;if(Y)return Z.get(Y)?.get(J)}return}getEditMap($=!0){if(this.suspendEdits||this.edits.size===0)return new Map;if(!$)return this.edits;let z=new Map;return this.edits.forEach((Q,J)=>{let Z=new Map;Q.forEach(({editorState:X,...Y},q)=>Z.set(q,{...Y})),z.set(J,Z)}),z}setEditMap($){this.edits.clear(),$.forEach((z,Q)=>{let J=new Map;z.forEach((Z,X)=>J.set(X,{...Z})),this.edits.set(Q,J)})}setEdit($,z){let Q=this.edits;if(Q.size===0||!Q.has($.rowNode))Q.set($.rowNode,new Map);let J=this.getEdit($),Z={editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0},...J,...z};return this.getEditRow($.rowNode).set($.column,Z),Z}clearEditValue($){let{rowNode:z,column:Q}=$;if(!z)return;let J=(X)=>{X.editorValue=void 0,X.pendingValue=X.sourceValue,X.state="changed"};if(!Q){this.getEditRow(z)?.forEach(J);return}let Z=this.getEdit($);if(Z)J(Z)}getState($){if(this.suspendEdits)return;return this.getEdit($)?.state}getEditPositions($){if(this.suspendEdits||($??this.edits).size===0)return[];let z=[];return($??this.edits).forEach((Q,J)=>{for(let Z of Q.keys()){let{editorState:X,...Y}=Q.get(Z);z.push({rowNode:J,column:Z,...Y})}}),z}hasRowEdits($,z){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;return!!this.getEditRow($,z)}hasEdits($={},z={}){if(this.suspendEdits)return!1;if(this.edits.size===0)return!1;let{rowNode:Q,column:J}=$,{withOpenEditor:Z}=z;if(Q){let X=this.getEditRow(Q,z);if(!X)return!1;if(J){if(Z)return this.getEdit($)?.state==="editing";return X.has(J)}if(X.size!==0){if(Z)return Array.from(X.values()).some(({state:Y})=>Y==="editing");return!0}return!1}if(Z)return this.getEditPositions().some(({state:X})=>X==="editing");return this.edits.size>0}start($){let z=this.getEditRow($.rowNode)??new Map,{rowNode:Q,column:J}=$;if(J&&!z.has(J))z.set(J,{editorValue:void 0,pendingValue:P0,sourceValue:this.beans.valueSvc.getValue(J,Q,"data"),state:"editing",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}});this.edits.set(Q,z)}stop($,z,Q){if(!this.hasEdits($))return;if(z){let J=this.getEditRow($.rowNode)?.get($.column);if(J&&(J.pendingValue===P0||J.pendingValue===J.sourceValue))this.removeEdits($);else if(J&&Q)J.editorValue=void 0}else this.removeEdits($)}clear(){for(let $ of this.edits.values())$.clear();this.edits.clear()}getCellValidationModel(){return this.cellValidations}getRowValidationModel(){return this.rowValidations}setCellValidationModel($){this.cellValidations=$}setRowValidationModel($){this.rowValidations=$}destroy(){super.destroy(),this.clear()}},u8=class{constructor(){this.cellValidations=new Map}getCellValidation($){let{rowNode:z,column:Q}=$||{};return this.cellValidations?.get(z)?.get(Q)}hasCellValidation($){if(!$?.rowNode||!$.column)return this.cellValidations.size>0;return!!this.getCellValidation($)}setCellValidation($,z){let{rowNode:Q,column:J}=$;if(!this.cellValidations.has(Q))this.cellValidations.set(Q,new Map);this.cellValidations.get(Q).set(J,z)}clearCellValidation($){let{rowNode:z,column:Q}=$;this.cellValidations.get(z)?.delete(Q)}setCellValidationMap($){this.cellValidations=$}getCellValidationMap(){return this.cellValidations}clearCellValidationMap(){this.cellValidations.clear()}},m8=class{constructor(){this.rowValidations=new Map}getRowValidation($){let{rowNode:z}=$||{};return this.rowValidations.get(z)}hasRowValidation($){if(!$?.rowNode)return this.rowValidations.size>0;return!!this.getRowValidation($)}setRowValidation({rowNode:$},z){this.rowValidations.set($,z)}clearRowValidation({rowNode:$}){this.rowValidations.delete($)}setRowValidationMap($){this.rowValidations=$}getRowValidationMap(){return this.rowValidations}clearRowValidationMap(){this.rowValidations.clear()}};function BJ($,z={}){let{rowIndex:Q,rowId:J,rowCtrl:Z,rowPinned:X}=z;if(Z)return Z;let{rowModel:Y,rowRenderer:q}=$,{rowNode:G}=z;if(!G){if(J)G=X_($,J,X);else if(Q!=null)G=Y.getRow(Q)}return G?q.getRowCtrlByNode(G):void 0}function r($,z={}){let{cellCtrl:Q,colId:J,columnId:Z,column:X}=z;if(Q)return Q;let Y=$.colModel.getCol(J??Z??L2(X)),q=z.rowCtrl??BJ($,z),G=q?.getCellCtrl(Y)??void 0;if(G)return G;let _=z.rowNode??q?.rowNode;if(_)return $.rowRenderer.getCellCtrls([_],[Y])?.[0];return}function r5($){let{editSvc:z}=$;if(z?.isBatchEditing())$z($,{persist:!0}),e$($);else z?.stopEditing(void 0,{source:"api"})}function PE($,z,Q){let{gos:J,popupSvc:Z}=z;if(!J.get("stopEditingWhenCellsLoseFocus"))return;let X=(Y)=>{let q=Y.relatedTarget;if(G2(q)===null){r5(z);return}let G=Q.some((_)=>_.contains(q))&&J.isElementInThisInstance(q);if(!G)G=!!Z&&(Z.getActivePopups().some((_)=>_.contains(q))||Z.isElementWithinCustomPopup(q));if(!G)r5(z)};for(let Y of Q)$.addManagedElementListeners(Y,{focusout:X})}function L2($){if(!$)return;if(typeof $==="string")return $;return $.getColId()}var P0=Symbol("unedited"),TE=($,z={})=>{let Q=$.rowRenderer.getCellCtrls(z.rowNodes,z.columns),J=Array(Q.length),Z=0;for(let X=0,Y=Q.length;X0)z.set(Q,Z)}return z}function gz($,z,Q){let{key:J,event:Z,cellStartedEdit:X,silent:Y}=Q??{},{editModelSvc:q,gos:G,userCompFactory:_}=$,H=r($,z),U=H?.comp?.getCellEditor(),W=p8($,z,J,X&&!Y),B=q?.getEdit(z),E=W.value??B?.sourceValue;if(U){q?.setEdit(z,{editorValue:DQ($,E,!0,z.column),state:"editing"}),U.refresh?.(W);return}let K=z.column.getColDef(),L=O7(_,K,W);if(!L)return;let{popupFromSelector:D,popupPositionFromSelector:F}=L,M=D??!!K.cellEditorPopup,k=F??K.cellEditorPopupPosition;if(i8(L.params,Z),!H)return;let{rangeFeature:V,rowCtrl:R,comp:O,onEditorAttachedFuncs:I}=H;q?.setEdit(z,{editorValue:DQ($,E,!0,z.column),state:"editing",editorState:{cellStartedEditing:void 0,cellStoppedEditing:void 0}}),H.editCompDetails=L,I.push(()=>V?.unsetComp()),O?.setEditDetails(L,M,k,G.get("reactiveCustomComponents")),R?.refreshRow({suppressFlash:!0}),CE($,z,Z,E,Y)}function CE($,z,Q,J,Z){let{editSvc:X,editModelSvc:Y}=$,q=Y?.getEdit(z);if(!Z&&q?.state==="editing"&&!q?.editorState?.cellStartedEditing)X?.dispatchCellEvent(z,Q,"cellEditingStarted",{value:J}),Y?.setEdit(z,{editorState:{cellStartedEditing:!0}})}function c8($,z,Q){let J={editorValueExists:!1};if(S4($)){if((z.getValidationErrors?.()?.length??0)>0)return J}if(Q?.isCancelling)return J;if(Q?.isStopping){let X=z?.isCancelAfterEnd?.();if(X)return{...J,isCancelAfterEnd:X}}return{editorValue:z.getValue(),editorValueExists:!0}}function p8($,z,Q,J){let{valueSvc:Z,gos:X,editSvc:Y}=$,q=$.gos.get("enableGroupEdit"),G=r($,z),_=z.rowNode?.rowIndex??void 0,H=Y?.isBatchEditing(),U=$.colModel.getCol(z.column.getId()),{rowNode:W,column:B}=z,E=G.comp?.getCellEditor(),K=Y?.getCellDataValue(z),L=K===void 0?E?c8($,E)?.editorValue:void 0:K,D=L===P0?Z.getValueForDisplay({column:U,node:W,from:"edit"})?.value:L,F=q?L:D;if(B.isAllowFormula()&&$.formula?.isFormula(F))F=$.formula?.normaliseFormula(F,!0)??F;return y(X,{value:F,eventKey:Q??null,column:B,colDef:B.getColDef(),rowIndex:_,node:W,data:W.data,cellStartedEdit:!!J,onKeyDown:G?.onKeyDown.bind(G),stopEditing:(M)=>{Y.stopEditing(z,{source:H?"ui":"api",suppressNavigateAfterEdit:M}),$1($,z,{})},eGridCell:G?.eGui,parseValue:(M)=>Z.parseValue(U,W,M,G?.value),formatValue:G?.formatValue.bind(G),validate:()=>{Y?.validateEdit()}})}function xQ($,z){let{editModelSvc:Q}=$;Q?.getEditMap().forEach((J,Z)=>{J.forEach((X,Y)=>{if(!z&&(X.state==="editing"||X.pendingValue===P0))return;if(!B$(X)&&(X.state!=="editing"||z))Q?.removeEdits({rowNode:Z,column:Y})})})}function bE($,z){let Q=z.comp?.getCellEditor();if(!Q?.refresh)return;let{eventKey:J,cellStartedEdit:Z}=z.editCompDetails.params,{column:X}=z,Y=p8($,z,J,Z),q=X.getColDef(),G=O7($.userCompFactory,q,Y);Q.refresh(i8(G.params,J))}function i8($,z){if(z instanceof KeyboardEvent&&$.column.getColDef().cellEditor==="agNumberCellEditor")$.suppressPreventDefault=["-","+",".","e"].includes(z?.key??"")||$.suppressPreventDefault;else z?.preventDefault?.();return $}function $z($,z){for(let Q of $.editModelSvc?.getEditPositions()??[]){let J=r($,Q);if(!J)continue;let Z=J.comp?.getCellEditor();if(!Z)continue;let{editorValue:X,editorValueExists:Y,isCancelAfterEnd:q}=c8($,Z,z);if(q){let{cellStartedEditing:G,cellStoppedEditing:_}=$.editModelSvc?.getEdit(Q)?.editorState||{};$.editModelSvc?.setEdit(Q,{editorState:{isCancelAfterEnd:q,cellStartedEditing:G,cellStoppedEditing:_}})}zQ($,Q,X,void 0,!Y,z)}}function zQ($,z,Q,J,Z,X){let{editModelSvc:Y,valueSvc:q}=$;if(!Y)return;let{rowNode:G,column:_}=z;if(!(G&&_))return;let H=Y.getEdit(z);if(H?.sourceValue===void 0){let U=H?DQ($,H.editorValue,!1,_):P0,W={sourceValue:q.getValue(_,G,"data"),pendingValue:U};if(X?.persist)W.state="changed";H=Y.setEdit(z,W)}if(Y.setEdit(z,{editorValue:Z?DQ($,H.sourceValue,!0,_):Q}),X?.persist)yE($,z)}function DQ($,z,Q,J){let{formula:Z}=$;if(J.isAllowFormula()&&Z?.isFormula(z))return Z?.normaliseFormula(z,Q)??z;return z}function yE($,z){let{editModelSvc:Q}=$,J=Q?.getEdit(z),X={pendingValue:DQ($,J?.editorValue,!1,z.column)};if(!J?.editorState?.cellStoppedEditing&&J?.state!=="editing")X.state="changed";Q?.setEdit(z,X)}function e$($,z,Q={}){if(!z)z=$.editModelSvc?.getEditPositions();if(z)for(let J of z)$1($,J,Q)}function $1($,z,Q,J=r($,z)){let Z=$.editModelSvc,X=Z?.getEdit(z),Y;if(X&&X.state!=="editing"&&X.editorState?.cellStoppedEditing)Y=X.state;else Y="changed";if(!J){if(X)Z?.setEdit(z,{state:Y});return}let q=J.comp,G=q?.getCellEditor();if(q&&!G){if(J?.refreshCell(),X){Z?.setEdit(z,{state:Y});let H=$.gos.get("enableGroupEdit")?l5(X,Q?.cancel):{valueChanged:!1,newValue:void 0,oldValue:X.sourceValue};a5($,z,H,Q)}return}if(S4($)){let H=X&&G?.getValidationErrors?.(),U=Z?.getCellValidationModel();if(H?.length)U?.setCellValidation(z,{errorMessages:H});else U?.clearCellValidation(z)}if(X)Z?.setEdit(z,{state:Y});q?.setEditDetails(),q?.refreshEditStyles(!1,!1),J?.refreshCell({force:!0,suppressFlash:!0});let _=Z?.getEdit(z);if(_&&_.state!=="editing"){let H=Q?.cancel,U=$.gos.get("enableGroupEdit")?l5(_,H):xE(_,X,H);a5($,z,U,Q)}}function l5($,z){let{sourceValue:Q,pendingValue:J}=$,Z;if(!z&&J!==P0)Z=J;return{valueChanged:!z&&B$($),newValue:Z,oldValue:Q,value:Q}}function xE($,z,Q){if(Q||$.editorState.isCancelAfterEnd)return{valueChanged:!1,newValue:void 0,oldValue:$.sourceValue};let J=$.editorValue;if(J==null||J===P0)J=z?.pendingValue;if(J===P0)J=void 0;return{valueChanged:B$($),newValue:J,oldValue:$.sourceValue}}function a5($,z,Q,{silent:J,event:Z}={}){let{editSvc:X,editModelSvc:Y}=$,q=Y?.getEdit(z),{editorState:G}=q||{},{isCancelBeforeStart:_,cellStartedEditing:H,cellStoppedEditing:U}=G||{};if(!J&&!_&&H&&!U)X?.dispatchCellEvent(z,Z,"cellEditingStopped",Q),Y?.setEdit(z,{editorState:{cellStoppedEditing:!0}})}function wE($){if(!$)return!1;for(let z=0,Q=$.length;z0,M=F?L.join(". "):"";if(j6(D,F),F)J.announceValue(`${_} ${L}`,"editorValidation");if(D instanceof HTMLInputElement)D.setCustomValidity(M);else D.classList.toggle("invalid",F)}if(L?.length>0)Q.setCellValidation({rowNode:E,column:K},{errorMessages:L});H.add(U.rowCtrl)}if($z($,{persist:!1}),X?.setCellValidationModel(Q),q){let U=gE($);X?.setRowValidationModel(U)}for(let U of H.values()){U.rowEditStyleFeature?.applyRowStyles();for(let W of U.getAllCellCtrls())W.tooltipFeature?.refreshTooltip(!0),W.editorTooltipFeature?.refreshTooltip(!0),W.editStyleFeature?.applyCellStyles?.()}}var gE=($)=>{let z=new m8,Q=$.gos.get("getFullRowEditValidationErrors"),J=$.editModelSvc?.getEditMap();if(!J)return z;for(let Z of J.keys()){let X=J.get(Z);if(!X)continue;let Y=[],{rowIndex:q,rowPinned:G}=Z;for(let H of X.keys()){let U=X.get(H);if(!U)continue;let{editorValue:W,pendingValue:B,sourceValue:E}=U,K=W??(B===P0?void 0:B)??E;Y.push({column:H,colId:H.getColId(),rowIndex:q,rowPinned:G,oldValue:E,newValue:K})}let _=Q?.({editorsState:Y})??[];if(_.length>0)z.setRowValidation({rowNode:Z},{errorMessages:_})}return z};function hE($){Yz($,!0);let z=$.editModelSvc?.getCellValidationModel().getCellValidationMap();if(!z)return null;let Q=[];return z.forEach((J,Z)=>{J.forEach(({errorMessages:X},Y)=>{Q.push({column:Y,rowIndex:Z.rowIndex,rowPinned:Z.rowPinned,messages:X??null})})}),Q}function iJ($){return!!($.rowPinned&&$.pinnedSibling)}function t0($,z,Q,J){let Z=z==="top";if(!Q)return t0($,z,Z?$.getPinnedTopRow(0):$.getPinnedBottomRow(0),J);if(!J){let G=Z?$.getPinnedTopRowCount():$.getPinnedBottomRowCount();return t0($,z,Q,Z?$.getPinnedTopRow(G-1):$.getPinnedBottomRow(G-1))}let X=!1,Y=!1,q=[];return $.forEachPinnedRow(z,(G)=>{if(G===Q&&!X){X=!0,q.push(G);return}if(X&&G===J){Y=!0,q.push(G);return}if(X&&!Y)q.push(G)}),q}function uE($,z,Q,{rowNode:J,column:Z},X){return y($.gos,{type:Q,node:J,data:J.data,value:X,column:Z,colDef:Z.getColDef(),rowPinned:J.rowPinned,event:z,rowIndex:J.rowIndex})}function mE($,z=!1){if($===A.DELETE)return!0;if(!z&&$===A.BACKSPACE)return I7();return!1}var cE=class extends S{constructor($,z,Q,J){super();this.cellCtrl=$,this.rowNode=Q,this.rowCtrl=J,this.beans=z}init(){this.eGui=this.cellCtrl.eGui}onKeyDown($){let z=$.key;if(z===A.ENTER&&v0(this.cellCtrl.column)&&this.beans.rowNumbersSvc?.handleKeyDownOnCell(this.cellCtrl.cellPosition,$))return;switch(z){case A.ENTER:this.onEnterKeyDown($);break;case A.F2:this.onF2KeyDown($);break;case A.ESCAPE:this.onEscapeKeyDown($);break;case A.TAB:this.onTabKeyDown($);break;case A.BACKSPACE:case A.DELETE:this.onBackspaceOrDeleteKeyDown(z,$);break;case A.DOWN:case A.UP:case A.RIGHT:case A.LEFT:this.onNavigationKeyDown($,z);break}}onNavigationKeyDown($,z){let{cellCtrl:Q,beans:J}=this;if(J.editSvc?.isEditing(Q,{withOpenEditor:!0}))return;if($.shiftKey&&Q.isRangeSelectionEnabled())this.onShiftRangeSelect($);else{let Z=Q.getFocusedCellPosition();J.navigation?.navigateToNextCell($,z,Z,!0)}$.preventDefault()}onShiftRangeSelect($){let{rangeSvc:z,navigation:Q}=this.beans;if(!z)return;let J=z.extendLatestRangeInDirection($);if(!J)return;if($.key===A.LEFT||$.key===A.RIGHT)Q?.ensureColumnVisible(J.column);else Q?.ensureRowVisible(J.rowIndex)}onTabKeyDown($){this.beans.navigation?.onTabKeyDown(this.cellCtrl,$)}onBackspaceOrDeleteKeyDown($,z){let{cellCtrl:Q,beans:J,rowNode:Z}=this,{gos:X,rangeSvc:Y,eventSvc:q,editSvc:G}=J;if(q.dispatchEvent({type:"keyShortcutChangedCellStart"}),mE($,X.get("enableCellEditingOnBackspace"))&&!G?.isEditing(Q,{withOpenEditor:!0})){if(Y&&u0(X))Y.clearCellRangeCellValues({dispatchWrapperEvents:!0,wrapperEventSource:"deleteKey"});else if(Q.isCellEditable()){let _=J.valueSvc.getDeleteValue(Q.column,Z);Z.setDataValue(Q.column,_,"cellClear")}}else if(!G?.isEditing(Q,{withOpenEditor:!0}))J.editSvc?.startEditing(Q,{startedEdit:!0,event:z});q.dispatchEvent({type:"keyShortcutChangedCellEnd"})}onEnterKeyDown($){let{cellCtrl:z,beans:Q}=this,{editSvc:J,navigation:Z}=Q,X=J?.isEditing(z,{withOpenEditor:!0}),Y=z.rowNode,q=J?.isRowEditing(Y,{withOpenEditor:!0}),G=(_)=>{if(J?.startEditing(_,{startedEdit:!0,event:$,source:"edit"}))$.preventDefault()};if(X||q){if(this.isCtrlEnter($)){J?.applyBulkEdit(z,Q?.rangeSvc?.getCellRanges()||[]);return}if(Yz(Q),J?.checkNavWithValidation(void 0,$)==="block-stop")return;if(J?.isEditing(z,{withOpenEditor:!0}))J?.stopEditing(z,{event:$,source:"edit"});else if(q&&!z.isCellEditable())J?.stopEditing({rowNode:Y},{event:$,source:"edit"});else G(z)}else if(Q.gos.get("enterNavigatesVertically")){let _=$.shiftKey?A.UP:A.DOWN;Z?.navigateToNextCell(null,_,z.cellPosition,!1)}else{if(J?.hasValidationErrors())return;if(J?.hasValidationErrors(z))J.revertSingleCellEdit(z,!0);G(z)}}isCtrlEnter($){return($.ctrlKey||$.metaKey)&&$.key===A.ENTER}onF2KeyDown($){let{cellCtrl:z,beans:{editSvc:Q}}=this;if(Q?.isEditing()){if(Yz(this.beans),Q?.checkNavWithValidation(void 0,$)==="block-stop")return}Q?.startEditing(z,{startedEdit:!0,event:$})}onEscapeKeyDown($){let{cellCtrl:z,beans:{editSvc:Q}}=this;if(Q?.checkNavWithValidation(z,$)==="block-stop")Q.revertSingleCellEdit(z);setTimeout(()=>{Q?.stopEditing(z,{event:$,cancel:!0})})}processCharacter($){let Q=$.target!==this.eGui,{beans:{editSvc:J},cellCtrl:Z}=this;if(Q)return;if(J?.isEditing(Z,{withOpenEditor:!0}))return;if($.key===A.SPACE)this.onSpaceKeyDown($);else if(J?.isCellEditable(Z,"ui")){if(J?.hasValidationErrors()&&!J?.hasValidationErrors(Z))return;if(J?.startEditing(Z,{startedEdit:!0,event:$,source:"api",editable:!0}),!Z.editCompDetails?.params?.suppressPreventDefault)$.preventDefault()}}onSpaceKeyDown($){let{gos:z,editSvc:Q}=this.beans,{rowNode:J}=this.cellCtrl;if(!Q?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&h$(z))this.beans.selectionSvc?.handleSelectionEvent($,J,"spaceKey");$.preventDefault()}},pE=class extends S{constructor($,z,Q){super();this.cellCtrl=$,this.column=Q,this.beans=z}onMouseEvent($,z){if(z$(z))return;switch($){case"click":this.onCellClicked(z);break;case"pointerdown":case"mousedown":case"touchstart":this.onMouseDown(z);break;case"dblclick":this.onCellDoubleClicked(z);break;case"mouseout":this.onMouseOut(z);break;case"mouseover":this.onMouseOver(z);break}}onCellClicked($){if(this.beans.touchSvc?.handleCellDoubleClick(this,$))return;let{eventSvc:z,rangeSvc:Q,editSvc:J,editModelSvc:Z,frameworkOverrides:X,gos:Y}=this.beans,q=$.ctrlKey||$.metaKey,{cellCtrl:G}=this,{column:_,cellPosition:H,rowNode:U}=G,W=s1(Y,_,U,$);if(Q&&q&&!W){if(Q.getCellRangeCount(H)>1)Q.intersectLastRange(!0)}let B=G.createEvent($,"cellClicked");B.isEventHandlingSuppressed=W,z.dispatchEvent(B);let E=_.getColDef();if(E.onCellClicked)window.setTimeout(()=>{X.wrapOutgoing(()=>{E.onCellClicked(B)})},0);if(W)return;if(Z?.getState(G)!=="editing"){let K=J?.isEditing(),L=J?.isRangeSelectionEnabledWhileEditing(),D=Z?.getCellValidationModel().getCellValidationMap().size??0,F=Z?.getRowValidationModel().getRowValidationMap().size??0;if(K&&(L||D>0||F>0))return;if(J?.shouldStartEditing(G,$))J?.startEditing(G,{event:$});else if(J?.shouldStopEditing(G,$))if(this.beans.gos.get("editType")==="fullRow")J?.stopEditing(G,{event:$,source:"edit"});else J?.stopEditing(void 0,{event:$,source:"edit"})}}onCellDoubleClicked($){let{column:z,beans:Q,cellCtrl:J}=this,{eventSvc:Z,frameworkOverrides:X,editSvc:Y,editModelSvc:q,gos:G}=Q,_=s1(G,J.column,J.rowNode,$),H=z.getColDef(),U=J.createEvent($,"cellDoubleClicked");if(U.isEventHandlingSuppressed=_,Z.dispatchEvent(U),typeof H.onCellDoubleClicked==="function")window.setTimeout(()=>{X.wrapOutgoing(()=>{H.onCellDoubleClicked(U)})},0);if(_)return;if(Y?.shouldStartEditing(J,$)&&q?.getState(J)!=="editing"){let W=Y?.isEditing(),B=Y?.isRangeSelectionEnabledWhileEditing(),E=q?.getCellValidationModel().getCellValidationMap().size??0,K=q?.getRowValidationModel().getRowValidationMap().size??0;if(W&&(B||E>0||K>0))return;Y?.startEditing(J,{event:$})}}onMouseDown($){let{shiftKey:z}=$,Q=$.target,{cellCtrl:J,beans:Z}=this,{eventSvc:X,rangeSvc:Y,rowNumbersSvc:q,focusSvc:G,gos:_,editSvc:H}=Z,{column:U,rowNode:W,cellPosition:B}=J,E=s1(_,U,W,$),K=()=>{let M=J.createEvent($,"cellMouseDown");M.isEventHandlingSuppressed=E,X.dispatchEvent(M)};if(E){K();return}if(this.isRightClickInExistingRange($))return;let L=Y&&!Y.isEmpty(),D=this.containsWidget(Q),F=v0(U);if(q&&F&&!q.handleMouseDownOnCell(B,$))return;if(!z||!L){let M=H?.isEditing(J),V=_.get("enableCellTextSelection")&&$.defaultPrevented,R=(cz()||V)&&!M&&!wQ(Q)&&!D;J.focusCell(R,$)}if(z&&L&&!G.isCellFocused(B)){$.preventDefault();let M=G.getFocusedCell();if(M){let{column:k,rowIndex:V,rowPinned:R}=M,O=!!H?.isRangeSelectionEnabledWhileEditing?.();if(H?.isEditing(M)&&!O)H?.stopEditing(M);if(!O)G.setFocusedCell({column:k,rowIndex:V,rowPinned:R,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,sourceEvent:$})}}if(D)return;Y?.handleCellMouseDown($,B),K()}isRightClickInExistingRange($){let{rangeSvc:z}=this.beans;if(z){let Q=z.isCellInAnyRange(this.cellCtrl.cellPosition),J=u2(this.beans,$);if(Q&&J)return!0}return!1}containsWidget($){return vz($,"ag-selection-checkbox",3)||vz($,"ag-drag-handle",3)}onMouseOut($){if(this.mouseStayingInsideCell($))return;let{eventSvc:z,colHover:Q}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent($,"cellMouseOut")),Q?.clearMouseOver()}onMouseOver($){if(this.mouseStayingInsideCell($))return;let{eventSvc:z,colHover:Q}=this.beans;z.dispatchEvent(this.cellCtrl.createEvent($,"cellMouseOver")),Q?.setMouseOver([this.column])}mouseStayingInsideCell($){if(!$.target||!$.relatedTarget)return!1;let z=this.cellCtrl.eGui,Q=z.contains($.target),J=z.contains($.relatedTarget);return Q&&J}},iE=class extends S{constructor($,z){super();this.cellCtrl=$,this.beans=z,this.column=$.column,this.rowNode=$.rowNode}setupRowSpan(){this.rowSpan=this.column.getRowSpan(this.rowNode),this.addManagedListeners(this.beans.eventSvc,{newColumnsLoaded:()=>this.onNewColumnsLoaded()})}init(){this.eSetLeft=this.cellCtrl.getRootElement(),this.eContent=this.cellCtrl.eGui;let $=this.cellCtrl.getCellSpan();if(!$)this.setupColSpan(),this.setupRowSpan();if(this.onLeftChanged(),this.onWidthChanged(),!$)this._legacyApplyRowSpan();if($){let z=this.refreshSpanHeight.bind(this,$);z(),this.addManagedListeners(this.beans.eventSvc,{paginationChanged:z,recalculateRowBounds:z,pinnedHeightChanged:z})}}refreshSpanHeight($){let z=$.getCellHeight();if(z!=null)this.eContent.style.height=`${z}px`}onNewColumnsLoaded(){let $=this.column.getRowSpan(this.rowNode);if(this.rowSpan===$)return;this.rowSpan=$,this._legacyApplyRowSpan(!0)}onDisplayColumnsChanged(){let $=this.getColSpanningList();if(!X0(this.colsSpanning,$))this.colsSpanning=$,this.onWidthChanged(),this.onLeftChanged()}setupColSpan(){if(this.column.getColDef().colSpan==null)return;this.colsSpanning=this.getColSpanningList(),this.addManagedListeners(this.beans.eventSvc,{displayedColumnsChanged:this.onDisplayColumnsChanged.bind(this),displayedColumnsWidthChanged:this.onWidthChanged.bind(this)})}onWidthChanged(){if(!this.eContent)return;let $=this.getCellWidth();this.eContent.style.width=`${$}px`}getCellWidth(){if(!this.colsSpanning)return this.column.getActualWidth();return this.colsSpanning.reduce(($,z)=>$+z.getActualWidth(),0)}getColSpanningList(){let{column:$,rowNode:z}=this,Q=$.getColSpan(z),J=[];if(Q===1)J.push($);else{let Z=$,X=$.getPinned();for(let Y=0;Z&&Ythis.removeFeatures()),this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.setupFocus(),this.applyStaticCssClasses(),this.setWrapText(),this.onFirstRightPinnedChanged(),this.onLastLeftPinnedChanged(),this.onColumnHover(),this.setupControlComps(),this.setupAutoHeight(J,Y),this.refreshFirstAndLastStyles(),this.checkFormulaError(),this.refreshAriaRowIndex(),this.refreshAriaColIndex(),this.positionFeature?.init(),this.customStyleFeature?.setComp($),this.editStyleFeature?.setComp($),this.tooltipFeature?.refreshTooltip(),this.keyboardListener?.init(),this.rangeFeature?.setComp($),this.rowResizeFeature?.refreshRowResizer();let q=X?this.isCellEditable():void 0,G=!q&&this.hasEdit&&this.editSvc?.isEditing(this,{withOpenEditor:!0});if(q||G)this.editSvc?.startEditing(this,{startedEdit:!1,source:"api",silent:!0,continueEditing:!0,editable:q});else this.showValue(!1,!0);if(this.onCompAttachedFuncs.length){for(let _ of this.onCompAttachedFuncs)_();this.onCompAttachedFuncs=[]}}checkFormulaError(){let $=!!this.beans.formula?.getFormulaError(this.column,this.rowNode);this.eGui.classList.toggle("formula-error",$)}setupAutoHeight($,z){this.isAutoHeight=this.beans.rowAutoHeight?.setupCellAutoHeight(this,$,z)??!1}getCellAriaRole(){return this.column.getColDef().cellAriaRole??"gridcell"}isCellRenderer(){let $=this.column.getColDef();return $.cellRenderer!=null||$.cellRendererSelector!=null}getValueToDisplay(){return this.valueFormatted??this.value}getDeferLoadingCellRenderer(){let{beans:$,column:z}=this,{userCompFactory:Q,ctrlsSvc:J,eventSvc:Z}=$,X=z.getColDef(),Y=this.createCellRendererParams();Y.deferRender=!0;let q=F5(Q,X,Y);if(J.getGridBodyCtrl()?.scrollFeature?.isScrolling()){let G,_=new g((U)=>{G=U}),[H]=this.addManagedListeners(Z,{bodyScrollEnd:()=>{G(),H()}});return{loadingComp:q,onReady:_}}return{loadingComp:q,onReady:g.resolve()}}showValue($,z){let{beans:Q,column:J,rowNode:Z,rangeFeature:X}=this,{userCompFactory:Y}=Q,q=this.getValueToDisplay(),G,_=Z.stub&&Z.groupData?.[J.getId()]==null,H=J.getColDef();if(_||this.isCellRenderer()){let U=this.createCellRendererParams();if(!_||v0(J))G=oQ(Y,H,U);else G=F5(Y,H,U)}if(!G&&!_&&Q.findSvc?.isMatch(Z,J)){let U=this.createCellRendererParams();G=oQ(Y,{...J.getColDef(),cellRenderer:"agFindCellRenderer"},U)}if(this.hasEdit&&this.editSvc.isBatchEditing()&&this.editSvc.isRowEditing(Z,{checkSiblings:!0})){let U=this.editSvc.prepDetailsDuringBatch(this,{compDetails:G,valueToDisplay:q});if(U){if(U.compDetails)G=U.compDetails;else if(U.valueToDisplay)q=U.valueToDisplay}}if(this.comp.setRenderDetails(G,q,$),this.customRowDragComp?.refreshVisibility(),!z&&X)Y$(Q,()=>X?.refreshRangeStyleAndHandle());this.rowResizeFeature?.refreshRowResizer()}setupControlComps(){let $=this.column.getColDef();this.includeSelection=this.isIncludeControl(this.isCheckboxSelection($),!0),this.includeRowDrag=this.isIncludeControl($.rowDrag),this.includeDndSource=this.isIncludeControl($.dndSource),this.comp.setIncludeSelection(this.includeSelection),this.comp.setIncludeDndSource(this.includeDndSource),this.comp.setIncludeRowDrag(this.includeRowDrag)}isForceWrapper(){return this.beans.gos.get("enableCellTextSelection")||this.column.isAutoHeight()}getCellValueClass(){let z=this.column.getColDef().cellRenderer==="agCheckboxCellRenderer",Q="";if(z)Q=" ag-allow-overflow";return`ag-cell-value${Q}`}isIncludeControl($,z=!1){return(this.rowNode.rowPinned==null||z&&iJ(this.rowNode))&&!!$}isCheckboxSelection($){let{rowSelection:z,groupDisplayType:Q}=this.beans.gridOptions,J=EQ(z),Z=I$(this.column);if(Q==="custom"&&J!=="selectionColumn"&&Z)return!1;return $.checkboxSelection||Z&&typeof z==="object"&&Qz(z)}refreshShouldDestroy(){let $=this.column.getColDef(),z=this.includeSelection!=this.isIncludeControl(this.isCheckboxSelection($),!0),Q=this.includeRowDrag!=this.isIncludeControl($.rowDrag),J=this.includeDndSource!=this.isIncludeControl($.dndSource),Z=this.isAutoHeight!=this.column.isAutoHeight();return z||Q||J||Z}onPopupEditorClosed($){let{editSvc:z}=this.beans;if(!z?.isEditing(this,{withOpenEditor:!0}))return;let Q=$ instanceof KeyboardEvent,J=$ instanceof MouseEvent,Z=Q&&$.key===A.ESCAPE;if(z.stopEditing(this,{source:z.isBatchEditing()?"ui":"api",cancel:Z,event:Q||J?$:void 0}),Z)this.focusCell(!0,$)}stopEditing($=!1){let{editSvc:z}=this.beans;return z?.stopEditing(this,{cancel:$,source:z?.isBatchEditing()?"ui":"api"})??!1}createCellRendererParams(){let{value:$,valueFormatted:z,column:Q,rowNode:J,comp:Z,eGui:X,beans:{valueSvc:Y,gos:q,editSvc:G}}=this;return y(q,{value:$,valueFormatted:z,getValue:()=>Y.getValueForDisplay({column:Q,node:J,from:"edit"}).value,setValue:(H)=>G?.setDataValue({rowNode:J,column:Q},H)||J.setDataValue(Q,H),formatValue:this.formatValue.bind(this),data:J.data,node:J,pinned:Q.getPinned(),colDef:Q.getColDef(),column:Q,refreshCell:this.refreshCell.bind(this),eGridCell:X,eParentOfValue:Z.getParentOfValue(),registerRowDragger:(H,U,W,B)=>this.registerRowDragger(H,U,B),setTooltip:(H,U)=>{if(q.assertModuleRegistered("Tooltip",3),this.tooltipFeature)this.disableTooltipFeature();this.enableTooltipFeature(H,U),this.tooltipFeature?.refreshTooltip()}})}onCellChanged($){if($.column===this.column)this.refreshCell()}refreshOrDestroyCell($){if(this.refreshShouldDestroy())this.rowCtrl?.recreateCell(this);else this.refreshCell($);if(this.hasEdit&&this.editCompDetails){let{editSvc:z,comp:Q}=this;if(!Q?.getCellEditor()&&z.isEditing(this,{withOpenEditor:!0}))z.startEditing(this,{startedEdit:!1,source:"api",silent:!0})}}refreshCell($){let{editStyleFeature:z,customStyleFeature:Q,rowCtrl:{rowEditStyleFeature:J},beans:{cellFlashSvc:Z,filterManager:X},column:Y,comp:q,suppressRefreshCell:G,tooltipFeature:_}=this;if(G)return;let{field:H,valueGetter:U,showRowGroup:W,enableCellChangeFlash:B}=Y.getColDef(),E=H==null&&U==null&&W==null,K=$?.newData??!1,L=E||$&&($.force||K),D=!!q,F=this.updateAndFormatValue(D),M=L||F;if(!D)return;if(M){this.showValue(!!K,!1);let k=X?.isSuppressFlashingCellsBecauseFiltering();if(!$?.suppressFlash&&!k&&B)Z?.flashCell(this);z?.applyCellStyles?.(),Q?.applyUserStyles(),Q?.applyClassesFromColDef(),J?.applyRowStyles(),this.checkFormulaError()}_?.refreshTooltip(),Q?.applyCellClassRules()}isCellEditable(){return this.column.isCellEditable(this.rowNode)}formatValue($){return this.callValueFormatter($)??$}callValueFormatter($){return this.beans.valueSvc.formatValue(this.column,this.rowNode,$)}updateAndFormatValue($){let z=this.value,Q=this.valueFormatted,{value:J,valueFormatted:Z}=this.beans.valueSvc.getValueForDisplay({column:this.column,node:this.rowNode,includeValueFormatted:!0,from:"edit"});if(this.value=J,this.valueFormatted=Z,$)return!this.valuesAreEqual(z,this.value)||this.valueFormatted!=Q;return!0}valuesAreEqual($,z){let Q=this.column.getColDef();return Q.equals?Q.equals($,z):$===z}addDomData($){let z=this.eGui;wz(this.beans.gos,z,_J,this),$.addDestroyFunc(()=>wz(this.beans.gos,z,_J,null))}createEvent($,z){let{rowNode:Q,column:J,value:Z,beans:X}=this;return uE(X,$,z,{rowNode:Q,column:J},Z)}processCharacter($){this.keyboardListener?.processCharacter($)}onKeyDown($){this.keyboardListener?.onKeyDown($)}onMouseEvent($,z){this.mouseListener?.onMouseEvent($,z)}getColSpanningList(){return this.positionFeature?.getColSpanningList()??[]}onLeftChanged(){if(!this.comp)return;this.positionFeature?.onLeftChanged()}onDisplayedColumnsChanged(){if(!this.eGui)return;this.refreshAriaColIndex(),this.refreshFirstAndLastStyles()}refreshFirstAndLastStyles(){let{comp:$,column:z,beans:Q}=this;d7($,z,Q.visibleCols)}refreshAriaColIndex(){let $=this.beans.visibleCols.getAriaColIndex(this.column);T6(this.eGui,$)}onWidthChanged(){return this.positionFeature?.onWidthChanged()}getRowPosition(){let{rowIndex:$,rowPinned:z}=this.cellPosition;return{rowIndex:$,rowPinned:z}}updateRangeBordersIfRangeCount(){if(!this.comp)return;this.rangeFeature?.updateRangeBordersIfRangeCount()}onCellSelectionChanged(){if(!this.comp)return;this.rangeFeature?.onCellSelectionChanged()}isRangeSelectionEnabled(){return this.rangeFeature!=null}focusCell($=!1,z){let Q=this.editSvc?.allowedFocusTargetOnValidation(this);if(Q&&Q!==this)return;this.beans.focusSvc.setFocusedCell({...this.getFocusedCellPosition(),forceBrowserFocus:$,sourceEvent:z})}restoreFocus($=!1){let{beans:{editSvc:z,focusSvc:Q},comp:J}=this;if(!J||z?.isEditing(this)||!this.isCellFocused()||!Q.shouldTakeFocus())return;let Z=()=>{if(!this.isAlive())return;let X=J.getFocusableElement();if(this.isCellFocused())X.focus({preventScroll:!0})};if($){setTimeout(Z,0);return}Z()}onRowIndexChanged(){this.createCellPosition(),this.refreshAriaRowIndex(),this.onCellFocused(),this.restoreFocus(),this.rangeFeature?.onCellSelectionChanged(),this.rowResizeFeature?.refreshRowResizer()}onSuppressCellFocusChanged($){let z=this.eGui;if(!z)return;Pz(z,"tabindex",$?void 0:-1)}onFirstRightPinnedChanged(){if(!this.comp)return;let $=this.column.isFirstRightPinned();this.comp.toggleCss(rE,$)}onLastLeftPinnedChanged(){if(!this.comp)return;let $=this.column.isLastLeftPinned();this.comp.toggleCss(lE,$)}checkCellFocused(){return this.beans.focusSvc.isCellFocused(this.cellPosition)}isCellFocused(){let $=this.checkCellFocused();return this.hasBeenFocused||(this.hasBeenFocused=$),$}setupFocus(){this.restoreFocus(!0),this.onCellFocused(this.focusEventWhileNotReady??void 0)}onCellFocused($){let{beans:z}=this;if(GJ(z))return;if(!this.comp){if($)this.focusEventWhileNotReady=$;return}let Q=this.isCellFocused(),J=z.editSvc?.isEditing(this)??!1;if(this.comp.toggleCss(sE,Q),Q&&($?.forceBrowserFocus||!this.hasBrowserFocus()&&this.beans.focusSvc.shouldTakeFocus())){let Z=this.comp.getFocusableElement();if(J){let Y=E$(Z,null,!0);if(Y.length)Z=Y[0]}let X=$?$.preventScrollOnBrowserFocus:!0;Z.focus({preventScroll:X}),$q(z,Z)}if(Q&&this.focusEventWhileNotReady)this.focusEventWhileNotReady=null;if(Q&&$)this.rowCtrl.announceDescription()}createCellPosition(){let{rowIndex:$,rowPinned:z}=this.rowNode;this.cellPosition={rowIndex:$,rowPinned:j$(z),column:this.column}}applyStaticCssClasses(){let{comp:$}=this;$.toggleCss(nE,!0),$.toggleCss(aE,!0);let z=this.column.isAutoHeight()==!0;$.toggleCss(dE,z),$.toggleCss(tE,!z)}onColumnHover(){this.beans.colHover?.onCellColumnHover(this.column,this.comp)}onColDefChanged(){if(!this.comp)return;if(this.column.isTooltipEnabled())this.disableTooltipFeature(),this.enableTooltipFeature();else this.disableTooltipFeature();if(this.setWrapText(),this.editSvc?.isEditing(this))this.editSvc?.handleColDefChanged(this);else this.refreshOrDestroyCell({force:!0,suppressFlash:!0})}setWrapText(){let $=this.column.getColDef().wrapText==!0;this.comp.toggleCss(oE,$)}dispatchCellContextMenuEvent($){let z=this.column.getColDef(),Q=this.createEvent($,"cellContextMenu"),{beans:J}=this;if(J.eventSvc.dispatchEvent(Q),z.onCellContextMenu)window.setTimeout(()=>{J.frameworkOverrides.wrapOutgoing(()=>{z.onCellContextMenu(Q)})},0)}getCellRenderer(){return this.comp?.getCellRenderer()??null}destroy(){if(this.onCompAttachedFuncs=[],this.onEditorAttachedFuncs=[],this.isCellFocused()&&this.hasBrowserFocus())this.beans.focusSvc.attemptToRecoverFocus();super.destroy()}hasBrowserFocus(){return this.eGui?.contains(d(this.beans))??!1}createSelectionCheckbox(){let $=this.beans.selectionSvc?.createCheckboxSelectionComponent();if(!$)return;return this.beans.context.createBean($),$.init({rowNode:this.rowNode,column:this.column}),$}createDndSource(){let $=this.beans.registry.createDynamicBean("dndSourceComp",!1,this.rowNode,this.column,this.eGui);if($)this.beans.context.createBean($);return $}registerRowDragger($,z,Q){if(this.customRowDragComp){this.customRowDragComp.setDragElement($,z);return}let J=this.createRowDragComp($,z,Q);if(J)this.customRowDragComp=J,this.addDestroyFunc(()=>{this.beans.context.destroyBean(J),this.customRowDragComp=null}),J.refreshVisibility()}createRowDragComp($,z,Q){let J=this.beans.rowDragSvc?.createRowDragCompForCell(this.rowNode,this.column,()=>this.value,$,z,Q);if(!J)return;return this.beans.context.createBean(J),J}cellEditorAttached(){for(let $ of this.onEditorAttachedFuncs)$();this.onEditorAttachedFuncs=[]}setFocusedCellPosition($){}getFocusedCellPosition(){return this.cellPosition}refreshAriaRowIndex(){if(!v0(this.column)||!this.eGui)return;let{ariaRowIndex:$}=this.rowCtrl;if($!=null)e1(this.eGui,$)}getRootElement(){return this.eGui}};function n8($,z,Q,J,Z,X){if(Q==null&&z==null)return;let Y={},q={},G=(_,H)=>{for(let U of _.split(" ")){if(U.trim()=="")continue;H(U)}};if(Q){let _=Object.keys(Q);for(let H=0;H<_.length;H++){let U=_[H],W=Q[U],B;if(typeof W==="string")B=$?$.evaluate(W,J):!0;else if(typeof W==="function")B=W(J);G(U,(E)=>{if(B)Y[E]=!0;else q[E]=!0})}}if(z&&X)for(let _ of Object.keys(z))G(_,(H)=>{if(!Y[H])q[H]=!0});if(X)Object.keys(q).forEach(X);Object.keys(Y).forEach(Z)}function o5($){if($.group)return $.level;let z=$.parent;return z?z.level+1:0}var $3=0,D2=class extends S{constructor($,z,Q,J,Z){super();this.rowNode=$,this.useAnimationFrameForCreate=J,this.printLayout=Z,this.focusEventWhileNotReady=null,this.allRowGuis=[],this.active=!0,this.centerCellCtrls={list:[],map:{}},this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}},this.slideInAnimation={left:!1,center:!1,right:!1,fullWidth:!1},this.fadeInAnimation={left:!1,center:!1,right:!1,fullWidth:!1},this.rowDragComps=[],this.lastMouseDownOnDragger=!1,this.emptyStyle={},this.updateColumnListsPending=!1,this.rowId=null,this.ariaRowIndex=null,this.businessKey=null,this.beans=z,this.gos=z.gos,this.paginationPage=z.pagination?.getCurrentPage()??0,this.suppressRowTransform=this.gos.get("suppressRowTransform"),this.instanceId=$.id+"-"+$3++,this.rowId=W0($.id),this.initRowBusinessKey(),this.rowFocused=z.focusSvc.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned),this.rowLevel=o5(this.rowNode),this.setRowType(),this.setAnimateFlags(Q),this.rowStyles=this.processStylesFromGridOptions(),this.rowEditStyleFeature=z.editSvc?.createRowStyleFeature(this),this.addListeners()}initRowBusinessKey(){this.businessKeyForNodeFunc=this.gos.get("getBusinessKeyForNode"),this.updateRowBusinessKey()}updateRowBusinessKey(){if(typeof this.businessKeyForNodeFunc!=="function")return;let $=this.businessKeyForNodeFunc(this.rowNode);this.businessKey=W0($)}updateGui($,z){if($==="left")this.leftGui=z;else if($==="right")this.rightGui=z;else if($==="fullWidth")this.fullWidthGui=z;else this.centerGui=z}setComp($,z,Q,J){let{context:Z,rowRenderer:X}=this.beans;J=B1(this,Z,J);let Y={rowComp:$,element:z,containerType:Q,compBean:J};this.allRowGuis.push(Y),this.updateGui(Q,Y),this.initialiseRowComp(Y);let q=this.rowNode,G=this.rowType==="FullWidthLoading"||q.stub,_=!q.data&&this.beans.rowModel.getType()==="infinite";if(!G&&!_&&!q.rowPinned)X.dispatchFirstDataRenderedEvent();this.setupFocus()}unsetComp($){this.allRowGuis=this.allRowGuis.filter((z)=>z.containerType!==$),this.updateGui($,void 0)}isCacheable(){return this.rowType==="FullWidthDetail"&&this.gos.get("keepDetailRows")}setCached($){let z=$?"none":"";for(let Q of this.allRowGuis)Q.element.style.display=z}initialiseRowComp($){let z=this.gos;if(this.onSuppressCellFocusChanged(this.beans.gos.get("suppressCellFocus")),this.listenOnDomOrder($),this.onRowHeightChanged($),this.updateRowIndexes($),this.setFocusedClasses($),this.setStylesFromGridOptions(!1,$),h$(z)&&this.rowNode.selectable)this.onRowSelected($);this.updateColumnLists(!this.useAnimationFrameForCreate);let Q=$.rowComp,J=this.getInitialRowClasses($.containerType);for(let Z of J)Q.toggleCss(Z,!0);if(this.executeSlideAndFadeAnimations($),this.rowNode.group)w0($.element,!!this.rowNode.expanded);if(this.setRowCompRowId(Q),this.setRowCompRowBusinessKey(Q),wz(z,$.element,HJ,this),$.compBean.addDestroyFunc(()=>wz(z,$.element,HJ,null)),this.useAnimationFrameForCreate)this.beans.animationFrameSvc.createTask(this.addHoverFunctionality.bind(this,$),this.rowNode.rowIndex,"p2",!1);else this.addHoverFunctionality($);if(this.isFullWidth())this.setupFullWidth($);if(z.get("rowDragEntireRow"))this.addRowDraggerToRow($);if(this.useAnimationFrameForCreate)this.beans.animationFrameSvc.addDestroyTask(()=>{if(!this.isAlive())return;$.rowComp.toggleCss("ag-after-created",!0)});this.executeProcessRowPostCreateFunc()}setRowCompRowBusinessKey($){if(this.businessKey==null)return;$.setRowBusinessKey(this.businessKey)}setRowCompRowId($){let z=W0(this.rowNode.id);if(this.rowId=z,z==null)return;$.setRowId(z)}executeSlideAndFadeAnimations($){let{containerType:z}=$;if(this.slideInAnimation[z])eZ(()=>{this.onTopChanged()}),this.slideInAnimation[z]=!1;if(this.fadeInAnimation[z])eZ(()=>{$.rowComp.toggleCss("ag-opacity-zero",!1)}),this.fadeInAnimation[z]=!1}addRowDraggerToRow($){let z=this.beans.rowDragSvc?.createRowDragCompForRow(this.rowNode,$.element);if(!z)return;let Q=this.createBean(z,this.beans.context);this.rowDragComps.push(Q),$.compBean.addDestroyFunc(()=>{this.rowDragComps=this.rowDragComps.filter((J)=>J!==Q),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,this.beans.context),this.destroyBean(Q,this.beans.context)})}setupFullWidth($){let z=this.getPinnedForContainer($.containerType),Q=this.createFullWidthCompDetails($.element,z);$.rowComp.showFullWidth(Q)}getFullWidthCellRenderers(){if(this.gos.get("embedFullWidthRows"))return this.allRowGuis.map(($)=>$?.rowComp?.getFullWidthCellRenderer());return[this.fullWidthGui?.rowComp?.getFullWidthCellRenderer()]}executeProcessRowPostCreateFunc(){let $=this.gos.getCallback("processRowPostCreate");if(!$||!this.areAllContainersReady())return;let z={eRow:this.centerGui.element,ePinnedLeftRow:this.leftGui?this.leftGui.element:void 0,ePinnedRightRow:this.rightGui?this.rightGui.element:void 0,node:this.rowNode,rowIndex:this.rowNode.rowIndex,addRenderedRowListener:this.addEventListener.bind(this)};$(z)}areAllContainersReady(){let{leftGui:$,centerGui:z,rightGui:Q,beans:{visibleCols:J}}=this,Z=!!$||!J.isPinningLeft(),X=!!z,Y=!!Q||!J.isPinningRight();return Z&&X&&Y}isNodeFullWidthCell(){if(this.rowNode.detail)return!0;let $=this.beans.gos.getCallback("isFullWidthRow");return $?$({rowNode:this.rowNode}):!1}setRowType(){let{rowNode:$,gos:z,beans:{colModel:Q}}=this,J=$.stub&&!z.get("suppressServerSideFullWidthLoadingRow")&&!z.get("groupHideOpenParents"),Z=this.isNodeFullWidthCell(),X=z.get("masterDetail")&&$.detail,Y=Q.isPivotMode(),q=Y7(z,$,Y);if(J)this.rowType="FullWidthLoading";else if(X)this.rowType="FullWidthDetail";else if(Z)this.rowType="FullWidth";else if(q)this.rowType="FullWidthGroup";else this.rowType="Normal"}updateColumnLists($=!1,z=!1){if(this.isFullWidth())return;let{animationFrameSvc:Q}=this.beans;if(!Q?.active||$||this.printLayout){this.updateColumnListsImpl(z);return}if(this.updateColumnListsPending)return;Q.createTask(()=>{if(!this.active)return;this.updateColumnListsImpl(!0)},this.rowNode.rowIndex,"p1",!1),this.updateColumnListsPending=!0}getNewCellCtrl($){if(this.beans.rowSpanSvc?.isCellSpanning($,this.rowNode))return;return new uQ($,this.rowNode,this.beans,this)}isCorrectCtrlForSpan($){return!this.beans.rowSpanSvc?.isCellSpanning($.column,this.rowNode)}createCellCtrls($,z,Q=null){let J={list:[],map:{}},Z=(_,H,U)=>{if(U!=null)J.list.splice(U,0,H);else J.list.push(H);J.map[_]=H},X=[];for(let _ of z){let H=_.getInstanceId(),U=$.map[H];if(U&&!this.isCorrectCtrlForSpan(U))U.destroy(),U=void 0;if(!U)U=this.getNewCellCtrl(_);if(!U)continue;Z(H,U)}for(let _ of $.list){let H=_.column.getInstanceId();if(J.map[H]!=null)continue;if(!this.isCellEligibleToBeRemoved(_,Q))X.push([H,_]);else _.destroy()}if(X.length)for(let[_,H]of X){let U=J.list.findIndex((B)=>B.column.getLeft()>H.column.getLeft()),W=U===-1?void 0:Math.max(U-1,0);Z(_,H,W)}let{focusSvc:Y,visibleCols:q}=this.beans,G=Y.getFocusedCell();if(G&&G.column.getPinned()==Q){let _=G.column.getInstanceId();if(!J.map[_]&&q.allCols.includes(G.column)){let U=this.createFocusedCellCtrl();if(U){let W=J.list.findIndex((E)=>E.column.getLeft()>U.column.getLeft()),B=W===-1?void 0:Math.max(W-1,0);Z(_,U,B)}}}return J}createFocusedCellCtrl(){let{focusSvc:$,rowSpanSvc:z}=this.beans,Q=$.getFocusedCell();if(!Q)return;let J=z?.getCellSpan(Q.column,this.rowNode);if(J){if(J.firstNode!==this.rowNode||!J.doesSpanContain(Q))return}else if(!$.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))return;return this.getNewCellCtrl(Q.column)}updateColumnListsImpl($){this.updateColumnListsPending=!1,this.createAllCellCtrls(),this.setCellCtrls($)}setCellCtrls($){for(let z of this.allRowGuis){let Q=this.getCellCtrlsForContainer(z.containerType);z.rowComp.setCellCtrls(Q,$)}}getCellCtrlsForContainer($){switch($){case"left":return this.leftCellCtrls.list;case"right":return this.rightCellCtrls.list;case"fullWidth":return[];case"center":return this.centerCellCtrls.list}}createAllCellCtrls(){let $=this.beans.colViewport,z=this.beans.visibleCols;if(this.printLayout)this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,z.allCols),this.leftCellCtrls={list:[],map:{}},this.rightCellCtrls={list:[],map:{}};else{let Q=$.getColsWithinViewport(this.rowNode);this.centerCellCtrls=this.createCellCtrls(this.centerCellCtrls,Q);let J=z.getLeftColsForRow(this.rowNode);this.leftCellCtrls=this.createCellCtrls(this.leftCellCtrls,J,"left");let Z=z.getRightColsForRow(this.rowNode);this.rightCellCtrls=this.createCellCtrls(this.rightCellCtrls,Z,"right")}}isCellEligibleToBeRemoved($,z){let{column:Z}=$;if(Z.getPinned()!=z)return!0;if(!this.isCorrectCtrlForSpan($))return!0;let{visibleCols:X,editSvc:Y}=this.beans,q=Y?.isEditing($),G=$.isCellFocused();if(q||G)return X.allCols.indexOf(Z)>=0?!1:!0;return!0}getDomOrder(){return this.gos.get("ensureDomOrder")||V0(this.gos,"print")}listenOnDomOrder($){let z=()=>{$.rowComp.setDomOrder(this.getDomOrder())};$.compBean.addManagedPropertyListeners(["domLayout","ensureDomOrder"],z)}setAnimateFlags($){if(this.rowNode.sticky||!$)return;let z=T(this.rowNode.oldRowTop),{visibleCols:Q}=this.beans,J=Q.isPinningLeft(),Z=Q.isPinningRight();if(z){let{slideInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=J,X.right=Z}else{let{fadeInAnimation:X}=this;if(this.isFullWidth()&&!this.gos.get("embedFullWidthRows")){X.fullWidth=!0;return}X.center=!0,X.left=J,X.right=Z}}isFullWidth(){return this.rowType!=="Normal"}refreshFullWidth(){let $=(Y,q)=>{if(!Y)return!0;return Y.rowComp.refreshFullWidth(()=>{return this.createFullWidthCompDetails(Y.element,q).params})},z=$(this.fullWidthGui,null),Q=$(this.centerGui,null),J=$(this.leftGui,"left"),Z=$(this.rightGui,"right");return z&&Q&&J&&Z}addListeners(){let{beans:$,gos:z,rowNode:Q}=this,{expansionSvc:J,eventSvc:Z,context:X,rowSpanSvc:Y}=$;if(this.addManagedListeners(this.rowNode,{heightChanged:()=>this.onRowHeightChanged(),rowSelected:()=>this.onRowSelected(),rowIndexChanged:this.onRowIndexChanged.bind(this),topChanged:this.onTopChanged.bind(this),...J?.getRowExpandedListeners(this)??{}}),Q.detail)this.addManagedListeners(Q.parent,{dataChanged:this.onRowNodeDataChanged.bind(this)});if(this.addManagedListeners(Q,{dataChanged:this.onRowNodeDataChanged.bind(this),cellChanged:this.postProcessCss.bind(this),rowHighlightChanged:this.onRowNodeHighlightChanged.bind(this),draggingChanged:this.postProcessRowDragging.bind(this),uiLevelChanged:this.onUiLevelChanged.bind(this),rowPinned:this.onRowPinned.bind(this)}),this.addManagedListeners(Z,{paginationPixelOffsetChanged:this.onPaginationPixelOffsetChanged.bind(this),heightScaleChanged:this.onTopChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),virtualColumnsChanged:this.onVirtualColumnsChanged.bind(this),cellFocused:this.onCellFocusChanged.bind(this),cellFocusCleared:this.onCellFocusChanged.bind(this),paginationChanged:this.onPaginationChanged.bind(this),modelUpdated:this.refreshFirstAndLastRowStyles.bind(this),columnMoved:()=>this.updateColumnLists()}),Y)this.addManagedListeners(Y,{spannedCellsUpdated:({pinned:q})=>{if(q&&!Q.rowPinned)return;this.updateColumnLists()}});this.addDestroyFunc(()=>{this.rowDragComps=this.destroyBeans(this.rowDragComps,X),this.tooltipFeature=this.destroyBean(this.tooltipFeature,X),this.rowEditStyleFeature=this.destroyBean(this.rowEditStyleFeature,X)}),this.addManagedPropertyListeners(["rowStyle","getRowStyle","rowClass","getRowClass","rowClassRules"],this.postProcessCss.bind(this)),this.addManagedPropertyListener("rowDragEntireRow",()=>{if(z.get("rowDragEntireRow")){for(let G of this.allRowGuis)this.addRowDraggerToRow(G);return}this.rowDragComps=this.destroyBeans(this.rowDragComps,X)}),this.addListenersForCellComps()}addListenersForCellComps(){this.addManagedListeners(this.rowNode,{rowIndexChanged:()=>{for(let $ of this.getAllCellCtrls())$.onRowIndexChanged()},cellChanged:($)=>{for(let z of this.getAllCellCtrls())z.onCellChanged($)}})}onRowPinned(){for(let $ of this.allRowGuis)$.rowComp.toggleCss("ag-row-pinned-source",!!this.rowNode.pinnedSibling)}onRowNodeDataChanged($){this.refreshRow({suppressFlash:!$.update,newData:!$.update})}refreshRow($){if(this.isFullWidth()!==!!this.isNodeFullWidthCell()){this.beans.rowRenderer.redrawRow(this.rowNode);return}if(this.isFullWidth()){if(!this.refreshFullWidth())this.beans.rowRenderer.redrawRow(this.rowNode);return}for(let Q of this.getAllCellCtrls())Q.refreshCell($);for(let Q of this.allRowGuis)this.setRowCompRowId(Q.rowComp),this.updateRowBusinessKey(),this.setRowCompRowBusinessKey(Q.rowComp);this.onRowSelected(),this.postProcessCss()}postProcessCss(){this.setStylesFromGridOptions(!0),this.postProcessClassesFromGridOptions(),this.postProcessRowClassRules(),this.rowEditStyleFeature?.applyRowStyles(),this.postProcessRowDragging()}onRowNodeHighlightChanged(){let $=this.beans.rowDropHighlightSvc,z=$?.row===this.rowNode?$.position:"none",Q=z==="above",J=z==="inside",Z=z==="below",X=z!=="none",Y=Q||Z,q=this.rowNode.uiLevel,G=Y&&q>0,_=G?q.toString():"0";for(let H of this.allRowGuis){let U=H.rowComp;if(U.toggleCss("ag-row-highlight-above",Q),U.toggleCss("ag-row-highlight-inside",J),U.toggleCss("ag-row-highlight-below",Z),U.toggleCss("ag-row-highlight-indent",G),X)H.element.style.setProperty("--ag-row-highlight-level",_);else H.element.style.removeProperty("--ag-row-highlight-level")}}postProcessRowDragging(){let $=this.rowNode.dragging;for(let z of this.allRowGuis)z.rowComp.toggleCss("ag-row-dragging",$)}onDisplayedColumnsChanged(){this.updateColumnLists(!0),this.beans.rowAutoHeight?.requestCheckAutoHeight()}onVirtualColumnsChanged(){this.updateColumnLists(!1,!0)}getRowPosition(){return{rowPinned:j$(this.rowNode.rowPinned),rowIndex:this.rowNode.rowIndex}}onKeyboardNavigate($){let z=this.findFullWidthInfoForEvent($);if(!z)return;let{rowGui:Q,column:J}=z;if(Q.element!==$.target)return;let Y=this.rowNode,{focusSvc:q,navigation:G}=this.beans,_=q.getFocusedCell(),H={rowIndex:Y.rowIndex,rowPinned:Y.rowPinned,column:_?.column??J};G?.navigateToNextCell($,$.key,H,!0),$.preventDefault()}onTabKeyDown($){if($.defaultPrevented||z$($))return;let z=this.allRowGuis.find((q)=>q.element.contains($.target)),Q=z?z.element:null,J=Q===$.target,Z=d(this.beans),X=!1;if(Q&&Z)X=Q.contains(Z)&&Z.classList.contains("ag-cell");let Y=null;if(!J&&!X)Y=j0(this.beans,Q,!1,$.shiftKey);if(this.isFullWidth()&&J||!Y)this.beans.navigation?.onTabKeyDown(this,$)}getFullWidthElement(){if(this.fullWidthGui)return this.fullWidthGui.element;return null}getRowYPosition(){let $=this.allRowGuis.find((z)=>A0(z.element))?.element;if($)return $.getBoundingClientRect().top;return 0}onSuppressCellFocusChanged($){let z=this.isFullWidth()&&$?void 0:this.gos.get("tabIndex");for(let Q of this.allRowGuis)Pz(Q.element,"tabindex",z)}setupFocus(){if(!this.isFullWidth())return;this.restoreFullWidthFocus(!0),this.onFullWidthRowFocused(this.focusEventWhileNotReady??void 0)}restoreFullWidthFocus($=!1){let{focusSvc:z,editSvc:Q}=this.beans;if(Q?.isEditing(this))return;if(!z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned)||!z.shouldTakeFocus())return;let J=this.getFullWidthRowGuiForFocus();if(!J)return;let Z=()=>{if(!this.isAlive())return;if(z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))J.element.focus({preventScroll:!0})};if($){setTimeout(Z,0);return}Z()}getFullWidthRowGuiForFocus($){if(this.fullWidthGui)return this.fullWidthGui;let z=this.beans.focusSvc.getFocusedCell(),Q=this.beans.colModel.getCol($?.column??z?.column);if(!Q)return;let J=Q?.pinned;if(J==="right")return this.rightGui;if(J==="left")return this.leftGui;return this.centerGui}setFullWidthRowFocusedClass($,z){this.forEachGui(void 0,(Q)=>{Q.element.classList.toggle("ag-full-width-focus",z&&Q===$)})}onFullWidthRowFocused($){let{focusSvc:z}=this.beans;if(!(this.isFullWidth()&&z.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned))){this.setFullWidthRowFocusedClass(void 0,!1);return}let J=this.getFullWidthRowGuiForFocus($);if(!J){if($)this.focusEventWhileNotReady=$;this.setFullWidthRowFocusedClass(void 0,!1);return}if(this.setFullWidthRowFocusedClass(J,!0),this.focusEventWhileNotReady=null,$?.forceBrowserFocus)J.element.focus({preventScroll:!0})}recreateCell($){this.centerCellCtrls=this.removeCellCtrl(this.centerCellCtrls,$),this.leftCellCtrls=this.removeCellCtrl(this.leftCellCtrls,$),this.rightCellCtrls=this.removeCellCtrl(this.rightCellCtrls,$),$.destroy(),this.updateColumnLists()}removeCellCtrl($,z){let Q={list:[],map:{}};for(let J of $.list){if(J===z)continue;Q.list.push(J),Q.map[J.column.getInstanceId()]=J}return Q}onMouseEvent($,z){switch($){case"dblclick":this.onRowDblClick(z);break;case"click":this.onRowClick(z);break;case"pointerdown":case"touchstart":case"mousedown":this.onRowMouseDown(z);break}}createRowEvent($,z){let{rowNode:Q}=this;return y(this.gos,{type:$,node:Q,data:Q.data,rowIndex:Q.rowIndex,rowPinned:Q.rowPinned,event:z})}createRowEventWithSource($,z){let Q=this.createRowEvent($,z);return Q.source=this,Q}onRowDblClick($){if(z$($))return;let z=this.createRowEventWithSource("rowDoubleClicked",$);z.isEventHandlingSuppressed=this.isSuppressMouseEvent($),this.beans.eventSvc.dispatchEvent(z)}findFullWidthInfoForEvent($){if(!$)return;let z=this.findFullWidthRowGui($.target),Q=this.getColumnForFullWidth(z);if(!z||!Q)return;return{rowGui:z,column:Q}}findFullWidthRowGui($){return this.allRowGuis.find((z)=>z.element.contains($))}getColumnForFullWidth($){let{visibleCols:z}=this.beans;switch($?.containerType){case"center":return z.centerCols[0];case"left":return z.leftCols[0];case"right":return z.rightCols[0];default:return z.allCols[0]}}onRowMouseDown($){if(this.lastMouseDownOnDragger=vz($.target,"ag-row-drag",3),!this.isFullWidth()||this.isSuppressMouseEvent($))return;let{rangeSvc:z,focusSvc:Q}=this.beans;z?.removeAllCellRanges();let J=this.findFullWidthInfoForEvent($);if(!J)return;let{rowGui:Z,column:X}=J,Y=Z.element,q=$.target,G=this.rowNode,_=$.defaultPrevented||cz();if(Y&&Y.contains(q)&&wQ(q))_=!1;Q.setFocusedCell({rowIndex:G.rowIndex,column:X,rowPinned:G.rowPinned,forceBrowserFocus:_})}isSuppressMouseEvent($){let{gos:z,rowNode:Q}=this;if(this.isFullWidth()){let Z=this.findFullWidthRowGui($.target);return t_(z,Z?.rowComp.getFullWidthCellRendererParams(),Q,$)}let J=E1(z,$.target);return J!=null&&s1(z,J.column,Q,$)}onRowClick($){if(z$($)||this.lastMouseDownOnDragger)return;let Q=this.isSuppressMouseEvent($),{eventSvc:J,selectionSvc:Z}=this.beans,X=this.createRowEventWithSource("rowClicked",$);if(X.isEventHandlingSuppressed=Q,J.dispatchEvent(X),Q)return;Z?.handleSelectionEvent($,this.rowNode,"rowClicked")}setupDetailRowAutoHeight($){if(this.rowType!=="FullWidthDetail")return;this.beans.masterDetailSvc?.setupDetailRowAutoHeight(this,$)}createFullWidthCompDetails($,z){let{gos:Q,rowNode:J}=this,Z=y(Q,{fullWidth:!0,data:J.data,node:J,value:J.key,valueFormatted:J.key,eGridCell:$,eParentOfValue:$,pinned:z,addRenderedRowListener:this.addEventListener.bind(this),registerRowDragger:(Y,q,G,_)=>this.addFullWidthRowDragging(Y,q,G,_),setTooltip:(Y,q)=>{Q.assertModuleRegistered("Tooltip",3),this.setupFullWidthRowTooltip(Y,q)}}),X=this.beans.userCompFactory;switch(this.rowType){case"FullWidthDetail":return yG(X,Z);case"FullWidthGroup":{let{value:Y,valueFormatted:q}=this.beans.valueSvc.getValueForDisplay({node:this.rowNode,includeValueFormatted:!0,from:"edit"});return Z.value=Y,Z.valueFormatted=q,bG(X,Z)}case"FullWidthLoading":return CG(X,Z);default:return IG(X,Z)}}setupFullWidthRowTooltip($,z){if(!this.fullWidthGui)return;this.tooltipFeature=this.beans.tooltipSvc?.setupFullWidthRowTooltip(this.tooltipFeature,this,$,z)}addFullWidthRowDragging($,z,Q="",J){let{rowDragSvc:Z,context:X}=this.beans;if(!Z||!this.isFullWidth())return;let Y=Z.createRowDragComp(()=>Q,this.rowNode,void 0,$,z,J);this.createBean(Y,X),this.addDestroyFunc(()=>{this.destroyBean(Y,X)})}onUiLevelChanged(){let $=o5(this.rowNode);if(this.rowLevel!=$){let z="ag-row-level-"+$,Q="ag-row-level-"+this.rowLevel;for(let J of this.allRowGuis)J.rowComp.toggleCss(z,!0),J.rowComp.toggleCss(Q,!1)}this.rowLevel=$}isFirstRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getFirstRow()}isLastRowOnPage(){return this.rowNode.rowIndex===this.beans.pageBounds.getLastRow()}refreshFirstAndLastRowStyles(){let $=this.isFirstRowOnPage(),z=this.isLastRowOnPage();if(this.firstRowOnPage!==$){this.firstRowOnPage=$;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-first",$)}if(this.lastRowOnPage!==z){this.lastRowOnPage=z;for(let Q of this.allRowGuis)Q.rowComp.toggleCss("ag-row-last",z)}}getAllCellCtrls(){if(this.leftCellCtrls.list.length===0&&this.rightCellCtrls.list.length===0)return this.centerCellCtrls.list;return[...this.centerCellCtrls.list,...this.leftCellCtrls.list,...this.rightCellCtrls.list]}postProcessClassesFromGridOptions(){let $=[];if(this.beans.rowStyleSvc?.processClassesFromGridOptions($,this.rowNode),!$.length)return;for(let z of $)for(let Q of this.allRowGuis)Q.rowComp.toggleCss(z,!0)}postProcessRowClassRules(){this.beans.rowStyleSvc?.processRowClassRules(this.rowNode,($)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss($,!0)},($)=>{for(let z of this.allRowGuis)z.rowComp.toggleCss($,!1)})}setStylesFromGridOptions($,z){if($)this.rowStyles=this.processStylesFromGridOptions();this.forEachGui(z,(Q)=>Q.rowComp.setUserStyles(this.rowStyles))}getPinnedForContainer($){if($==="left"||$==="right")return $;return null}getInitialRowClasses($){let z=this.getPinnedForContainer($),Q=this.isFullWidth(),{rowNode:J,beans:Z}=this,X=[];if(X.push("ag-row"),X.push(this.rowFocused?"ag-row-focus":"ag-row-no-focus"),this.fadeInAnimation[$])X.push("ag-opacity-zero");if(X.push(J.rowIndex%2===0?"ag-row-even":"ag-row-odd"),J.isRowPinned()){if(X.push("ag-row-pinned"),Z.pinnedRowModel?.isManual())X.push("ag-row-pinned-manual")}if(!J.isRowPinned()&&J.pinnedSibling)X.push("ag-row-pinned-source");if(J.isSelected())X.push("ag-row-selected");if(J.footer)X.push("ag-row-footer");if(X.push("ag-row-level-"+this.rowLevel),J.stub)X.push("ag-row-loading");if(Q)X.push("ag-full-width-row");if(Z.expansionSvc?.addExpandedCss(X,J),J.dragging)X.push("ag-row-dragging");let{rowStyleSvc:Y}=Z;if(Y)Y.processClassesFromGridOptions(X,J),Y.preProcessRowClassRules(X,J);if(X.push(this.printLayout?"ag-row-position-relative":"ag-row-position-absolute"),this.isFirstRowOnPage())X.push("ag-row-first");if(this.isLastRowOnPage())X.push("ag-row-last");if(Q){if(z==="left")X.push("ag-cell-last-left-pinned");if(z==="right")X.push("ag-cell-first-right-pinned")}return X}processStylesFromGridOptions(){return this.beans.rowStyleSvc?.processStylesFromGridOptions(this.rowNode)??this.emptyStyle}onRowSelected($){this.beans.selectionSvc?.onRowCtrlSelected(this,(z)=>{if(z===this.centerGui||z===this.fullWidthGui)this.announceDescription()},$)}announceDescription(){this.beans.selectionSvc?.announceAriaRowSelection(this.rowNode)}addHoverFunctionality($){if(!this.active)return;let{element:z,compBean:Q}=$,{rowNode:J,beans:Z,gos:X}=this;Q.addManagedListeners(z,{pointerenter:(Y)=>{if(Y.pointerType==="mouse")J.dispatchRowEvent("mouseEnter")},pointerleave:(Y)=>{if(Y.pointerType==="mouse")J.dispatchRowEvent("mouseLeave")}}),Q.addManagedListeners(J,{mouseEnter:()=>{if(!Z.dragSvc?.dragging&&!X.get("suppressRowHoverHighlight"))z.classList.add("ag-row-hover"),J.setHovered(!0)},mouseLeave:()=>{this.resetHoveredStatus(z)}})}resetHoveredStatus($){let z=$?[$]:this.allRowGuis.map((Q)=>Q.element);for(let Q of z)Q.classList.remove("ag-row-hover");this.rowNode.setHovered(!1)}roundRowTopToBounds($){let z=this.beans.ctrlsSvc.getScrollFeature().getApproximateVScollPosition(),Q=this.applyPaginationOffset(z.top,!0)-100,J=this.applyPaginationOffset(z.bottom,!0)+100;return Math.min(Math.max(Q,$),J)}forEachGui($,z){if($)z($);else for(let Q of this.allRowGuis)z(Q)}isRowRendered(){return this.allRowGuis.length>0}onRowHeightChanged($){if(this.rowNode.rowHeight==null)return;let z=this.rowNode.rowHeight,Q=this.beans.environment.getDefaultRowHeight(),Z=J7(this.gos)?sQ(this.beans,this.rowNode).height:void 0,X=Z?`${Math.min(Q,Z)-2}px`:void 0;this.forEachGui($,(Y)=>{if(Y.element.style.height=`${z}px`,X)Y.element.style.setProperty("--ag-line-height",X)})}destroyFirstPass($=!1){this.active=!1;let{rowNode:z}=this;if(!$&&HQ(this.gos)&&!z.sticky)if(z.rowTop!=null){let Z=this.roundRowTopToBounds(z.rowTop);this.setRowTop(Z)}else for(let Z of this.allRowGuis)Z.rowComp.toggleCss("ag-opacity-zero",!0);if(this.fullWidthGui?.element.contains(d(this.beans)))this.beans.focusSvc.attemptToRecoverFocus();z.setHovered(!1);let Q=this.createRowEvent("virtualRowRemoved");this.dispatchLocalEvent(Q),this.beans.eventSvc.dispatchEvent(Q),super.destroy()}destroySecondPass(){this.allRowGuis.length=0;let $=(z)=>{for(let Q of z.list)Q.destroy();return{list:[],map:{}}};this.centerCellCtrls=$(this.centerCellCtrls),this.leftCellCtrls=$(this.leftCellCtrls),this.rightCellCtrls=$(this.rightCellCtrls)}setFocusedClasses($){this.forEachGui($,(z)=>{z.rowComp.toggleCss("ag-row-focus",this.rowFocused),z.rowComp.toggleCss("ag-row-no-focus",!this.rowFocused)})}onCellFocusChanged(){let{focusSvc:$}=this.beans,z=$.isRowFocused(this.rowNode.rowIndex,this.rowNode.rowPinned);if(z!==this.rowFocused)this.rowFocused=z,this.setFocusedClasses()}onPaginationChanged(){let $=this.beans.pagination?.getCurrentPage()??0;if(this.paginationPage!==$)this.paginationPage=$,this.onTopChanged();this.refreshFirstAndLastRowStyles()}onTopChanged(){this.setRowTop(this.rowNode.rowTop)}onPaginationPixelOffsetChanged(){this.onTopChanged()}applyPaginationOffset($,z=!1){if(this.rowNode.isRowPinned()||this.rowNode.sticky)return $;let Q=this.beans.pageBounds.getPixelOffset();return $+Q*(z?1:-1)}setRowTop($){if(this.printLayout)return;if(T($)){let z=this.applyPaginationOffset($),Z=`${this.rowNode.isRowPinned()||this.rowNode.sticky?z:this.beans.rowContainerHeight.getRealPixelPosition(z)}px`;this.setRowTopStyle(Z)}}getInitialRowTop($){return this.suppressRowTransform?this.getInitialRowTopShared($):void 0}getInitialTransform($){return this.suppressRowTransform?void 0:`translateY(${this.getInitialRowTopShared($)})`}getInitialRowTopShared($){if(this.printLayout)return"";let z=this.rowNode,Q;if(z.sticky)Q=z.stickyRowTop;else{let J=this.slideInAnimation[$]?this.roundRowTopToBounds(z.oldRowTop):z.rowTop,Z=this.applyPaginationOffset(J);Q=z.isRowPinned()?Z:this.beans.rowContainerHeight.getRealPixelPosition(Z)}return Q+"px"}setRowTopStyle($){for(let z of this.allRowGuis)if(this.suppressRowTransform)z.rowComp.setTop($);else z.rowComp.setTransform(`translateY(${$})`)}getCellCtrl($,z=!1){let Q=null;for(let J of this.getAllCellCtrls())if(J.column==$)Q=J;if(Q!=null||z)return Q;for(let J of this.getAllCellCtrls())if(J?.getColSpanningList().indexOf($)>=0)Q=J;return Q}onRowIndexChanged(){if(this.rowNode.rowIndex!=null)this.onCellFocusChanged(),this.updateRowIndexes(),this.postProcessCss()}updateRowIndexes($){let z=this.rowNode.getRowIndexString();if(z===null)return;let Q=(this.beans.ctrlsSvc.getHeaderRowContainerCtrl()?.getRowCount()??0)+(this.beans.filterManager?.getHeaderRowCount()??0),J=this.rowNode.rowIndex%2===0,Z=this.ariaRowIndex=Q+this.rowNode.rowIndex+1;this.forEachGui($,(X)=>{X.rowComp.setRowIndex(z),X.rowComp.toggleCss("ag-row-even",J),X.rowComp.toggleCss("ag-row-odd",!J),e1(X.element,Z)})}},z3=class extends S{constructor(){super();this.beanName="navigation",this.onPageDown=B5(this.onPageDown,100),this.onPageUp=B5(this.onPageUp,100)}postConstruct(){this.beans.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCon=$.gridBodyCtrl})}handlePageScrollingKey($,z=!1){let{key:Q,altKey:J}=$,Z=$.ctrlKey||$.metaKey,X=!!this.beans.rangeSvc&&$.shiftKey,Y=U4(this.gos,$),q=!1;switch(Q){case A.PAGE_HOME:case A.PAGE_END:if(!Z&&!J)this.onHomeOrEndKey(Q),q=!0;break;case A.LEFT:case A.RIGHT:case A.UP:case A.DOWN:if(!Y)return!1;if(Z&&!J&&!X)this.onCtrlUpDownLeftRight(Q,Y),q=!0;break;case A.PAGE_DOWN:case A.PAGE_UP:if(!Z&&!J)q=this.handlePageUpDown(Q,Y,z);break}if(q)$.preventDefault();return q}handlePageUpDown($,z,Q){if(Q)z=this.beans.focusSvc.getFocusedCell();if(!z)return!1;if($===A.PAGE_UP)this.onPageUp(z);else this.onPageDown(z);return!0}navigateTo({scrollIndex:$,scrollType:z,scrollColumn:Q,focusIndex:J,focusColumn:Z,isAsync:X,rowPinned:Y}){let{scrollFeature:q}=this.gridBodyCon;if(T(Q)&&!Q.isPinned())q.ensureColumnVisible(Q);if(T($))q.ensureIndexVisible($,z);if(!X)q.ensureIndexVisible(J);let{focusSvc:G}=this.beans;G.setFocusedCell({rowIndex:J,column:Z,rowPinned:Y,forceBrowserFocus:!0}),this.setRangeToCellIfSupported({rowIndex:J,rowPinned:Y,column:Z})}onPageDown($){let z=this.beans,Q=tZ(z),J=this.getViewportHeight(),{pageBounds:Z,rowModel:X,rowAutoHeight:Y}=z,q=Z.getPixelOffset(),G=Q.top+J,_=X.getRowIndexAtPixel(G+q);if(Y?.active)this.navigateToNextPageWithAutoHeight($,_);else this.navigateToNextPage($,_)}onPageUp($){let z=this.beans,Q=tZ(z),{pageBounds:J,rowModel:Z,rowAutoHeight:X}=z,Y=J.getPixelOffset(),q=Q.top,G=Z.getRowIndexAtPixel(q+Y);if(X?.active)this.navigateToNextPageWithAutoHeight($,G,!0);else this.navigateToNextPage($,G,!0)}navigateToNextPage($,z,Q=!1){let{pageBounds:J,rowModel:Z}=this.beans,X=this.getViewportHeight(),Y=J.getFirstRow(),q=J.getLastRow(),G=J.getPixelOffset(),_=Z.getRow($.rowIndex),H=Q?_?.rowHeight-X-G:X-G,U=_?.rowTop+H,W=Z.getRowIndexAtPixel(U+G);if(W===$.rowIndex){let E=Q?-1:1;z=W=$.rowIndex+E}let B;if(Q){if(B="bottom",Wq)W=q;if(z>q)z=q}if(this.isRowTallerThanView(Z.getRow(W)))z=W,B="top";this.navigateTo({scrollIndex:z,scrollType:B,scrollColumn:null,focusIndex:W,focusColumn:$.column})}navigateToNextPageWithAutoHeight($,z,Q=!1){this.navigateTo({scrollIndex:z,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:z,focusColumn:$.column}),setTimeout(()=>{let J=this.getNextFocusIndexForAutoHeight($,Q);this.navigateTo({scrollIndex:z,scrollType:Q?"bottom":"top",scrollColumn:null,focusIndex:J,focusColumn:$.column,isAsync:!0})},50)}getNextFocusIndexForAutoHeight($,z=!1){let Q=z?-1:1,J=this.getViewportHeight(),{pageBounds:Z,rowModel:X}=this.beans,Y=Z.getLastRow(),q=0,G=$.rowIndex;while(G>=0&&G<=Y){let _=X.getRow(G);if(_){let H=_.rowHeight??0;if(q+H>J)break;q+=H}G+=Q}return Math.max(0,Math.min(G,Y))}getViewportHeight(){let $=this.beans,z=tZ($),Q=this.beans.scrollVisibleSvc.getScrollbarWidth(),J=z.bottom-z.top;if($.ctrlsSvc.get("center").isHorizontalScrollShowing())J-=Q;return J}isRowTallerThanView($){if(!$)return!1;let z=$.rowHeight;if(typeof z!=="number")return!1;return z>this.getViewportHeight()}onCtrlUpDownLeftRight($,z){let Q=this.beans.cellNavigation.getNextCellToFocus($,z,!0);if(!Q)return;let J=this.getNormalisedPosition(Q),{rowIndex:Z,rowPinned:X,column:Y}=J??Q,q=Y;this.navigateTo({scrollIndex:Z,scrollType:null,scrollColumn:q,focusIndex:Z,focusColumn:q,rowPinned:X})}onHomeOrEndKey($){let z=$===A.PAGE_HOME,{visibleCols:Q,pageBounds:J,rowModel:Z}=this.beans,X=Q.allCols,Y=z?J.getFirstRow():J.getLastRow(),q=Z.getRow(Y);if(!q)return;let G=(z?X:[...X].reverse()).find((_)=>!_.isSuppressNavigable(q)&&!v0(_));if(!G)return;this.navigateTo({scrollIndex:Y,scrollType:null,scrollColumn:G,focusIndex:Y,focusColumn:G})}onTabKeyDown($,z){let Q=z.shiftKey,J=this.tabToNextCellCommon($,Q,z),Z=this.beans,{ctrlsSvc:X,pageBounds:Y,focusSvc:q,gos:G}=Z;if(J!==!1){if(J)z.preventDefault();else if(J===null)X.get("gridCtrl").allowFocusForNextCoreContainer(Q);return}if(Q){let{rowIndex:_,rowPinned:H}=$.getRowPosition();if(H?_===0:_===Y.getFirstRow())if(G.get("headerHeight")===0||H$(Z))Z$(Z,!0,!0);else z.preventDefault(),q.focusPreviousFromFirstCell(z)}else{if($ instanceof uQ)$.focusCell(!0);if(q.focusOverlay(!1)||Z$(Z,Q))z.preventDefault()}}tabToNextCell($,z){let Q=this.beans,{focusSvc:J,rowRenderer:Z}=Q,X=J.getFocusedCell();if(!X)return!1;let Y=e0(Q,X);if(!Y){if(Y=Z.getRowByPosition(X),!Y?.isFullWidth())return!1}return!!this.tabToNextCellCommon(Y,$,z,"api")}tabToNextCellCommon($,z,Q,J="ui"){let{editSvc:Z,focusSvc:X}=this.beans,Y=void 0,q=$ instanceof uQ?$:$.getAllCellCtrls()?.[0];if(Z?.isEditing())Y=Z?.moveToNextCell(q,z,Q,J);else Y=this.moveToNextCellNotEditing($,z,Q);if(Y===null)return Y;return Y||!!X.focusedHeader}moveToNextCellNotEditing($,z,Q){let J=this.beans.visibleCols.allCols,Z;if($ instanceof D2){if(Z={...$.getRowPosition(),column:z?J[0]:b(J)},this.gos.get("embedFullWidthRows")&&Q){let Y=$.findFullWidthInfoForEvent(Q);if(Y)Z.column=Y.column}}else Z=$.getFocusedCellPosition();let X=this.findNextCellToFocusOn(Z,{backwards:z,startEditing:!1});if(X===!1)return null;if(X instanceof uQ)X.focusCell(!0);else if(X)return this.tryToFocusFullWidthRow(X,z);return T(X)}findNextCellToFocusOn($,{backwards:z,startEditing:Q,skipToNextEditableCell:J}){let Z=$,X=this.beans,{cellNavigation:Y,gos:q,focusSvc:G,rowRenderer:_}=X;while(!0){if($!==Z)$=Z;if(!z)Z=this.getLastCellOfColSpan(Z);Z=Y.getNextTabbedCell(Z,z);let H=q.getCallback("tabToNextCell");if(T(H)){let E=H({backwards:z,editing:Q,previousCellPosition:$,nextCellPosition:Z?Z:null});if(E===!0)Z=$;else if(E===!1)return!1;else Z={rowIndex:E.rowIndex,column:E.column,rowPinned:E.rowPinned}}if(!Z)return null;if(Z.rowIndex<0){let B=l0(X);return G.focusHeaderPosition({headerPosition:{headerRowIndex:B+Z.rowIndex,column:Z.column},fromCell:!0}),null}let U=q.get("editType")==="fullRow";if(Q&&(!U||J)){if(!this.isCellEditable(Z))continue}this.ensureCellVisible(Z);let W=e0(X,Z);if(!W){let B=_.getRowByPosition(Z);if(!B||!B.isFullWidth()||Q)continue;return{...B.getRowPosition(),column:Z?.column}}if(Y.isSuppressNavigable(W.column,W.rowNode))continue;return W.setFocusedCellPosition(Z),this.setRangeToCellIfSupported(Z),W}}isCellEditable($){let z=this.lookupRowNodeForCell($);if(z)return $.column.isCellEditable(z);return!1}lookupRowNodeForCell({rowIndex:$,rowPinned:z}){let{pinnedRowModel:Q,rowModel:J}=this.beans;if(z==="top")return Q?.getPinnedTopRow($);if(z==="bottom")return Q?.getPinnedBottomRow($);return J.getRow($)}navigateToNextCell($,z,Q,J){let Z=Q,X=!1,Y=this.beans,{cellNavigation:q,focusSvc:G,gos:_}=Y;while(Z&&(Z===Q||!this.isValidNavigateCell(Z))){if(_.get("enableRtl")){if(z===A.LEFT)Z=this.getLastCellOfColSpan(Z)}else if(z===A.RIGHT)Z=this.getLastCellOfColSpan(Z);Z=q.getNextCellToFocus(z,Z),X=n(Z)}if(X&&$&&$.key===A.UP)Z={rowIndex:-1,rowPinned:null,column:Q.column};if(J){let U=_.getCallback("navigateToNextCell");if(T(U)){let B=U({key:z,previousCellPosition:Q,nextCellPosition:Z?Z:null,event:$});if(T(B))Z={rowPinned:B.rowPinned,rowIndex:B.rowIndex,column:B.column};else Z=null}}if(!Z)return;if(Z.rowIndex<0){let U=l0(Y);G.focusHeaderPosition({headerPosition:{headerRowIndex:U+Z.rowIndex,column:Z.column??Q.column},event:$||void 0,fromCell:!0});return}let H=this.getNormalisedPosition(Z);if(H)this.focusPosition(H);else this.tryToFocusFullWidthRow(Z)}getNormalisedPosition($){if(!!this.beans.spannedRowRenderer?.getCellByPosition($))return $;this.ensureCellVisible($);let Q=e0(this.beans,$);if(!Q)return null;return $=Q.getFocusedCellPosition(),this.ensureCellVisible($),$}tryToFocusFullWidthRow($,z){let{visibleCols:Q,rowRenderer:J,focusSvc:Z,eventSvc:X}=this.beans,Y=Q.allCols;if(!J.getRowByPosition($)?.isFullWidth())return!1;let G=Z.getFocusedCell(),_={rowIndex:$.rowIndex,rowPinned:$.rowPinned,column:$.column||(z?b(Y):Y[0])};this.focusPosition(_);let H=z==null?G!=null&&G0(_,G):z;return X.dispatchEvent({type:"fullWidthRowFocused",rowIndex:_.rowIndex,rowPinned:_.rowPinned,column:_.column,isFullWidthCell:!0,fromBelow:H}),!0}focusPosition($){let{focusSvc:z}=this.beans;z.setFocusedCell({rowIndex:$.rowIndex,column:$.column,rowPinned:$.rowPinned,forceBrowserFocus:!0}),this.setRangeToCellIfSupported($)}setRangeToCellIfSupported($){if(v0($.column))return;this.beans.rangeSvc?.setRangeToCell($)}isValidNavigateCell($){return!!M0(this.beans,$)}getLastCellOfColSpan($){let z=e0(this.beans,$);if(!z)return $;let Q=z.getColSpanningList();if(Q.length===1)return $;return{rowIndex:$.rowIndex,column:b(Q),rowPinned:$.rowPinned}}ensureCellVisible($){let z=kQ(this.gos),Q=this.beans.rowModel.getRow($.rowIndex),J=z&&Q?.sticky,{scrollFeature:Z}=this.gridBodyCon;if(!J&&n($.rowPinned))Z.ensureIndexVisible($.rowIndex);if(!$.column.isPinned())Z.ensureColumnVisible($.column)}ensureColumnVisible($){let z=this.gridBodyCon.scrollFeature;if(!$.isPinned())z.ensureColumnVisible($)}ensureRowVisible($){this.gridBodyCon.scrollFeature.ensureIndexVisible($)}};function tZ($){return $.ctrlsSvc.getScrollFeature().getVScrollPosition()}var iz={moduleName:"KeyboardNavigation",version:p,beans:[z3,kE,CB],apiFunctions:{getFocusedCell:VE,clearFocusedCell:AE,setFocusedCell:SE,setFocusedHeader:fE,tabToNextCell:RE,tabToPreviousCell:jE}},Q3=class extends S{constructor(){super(...arguments);this.beanName="pageBoundsListener"}postConstruct(){this.addManagedEventListeners({modelUpdated:this.onModelUpdated.bind(this),recalculateRowBounds:this.calculatePages.bind(this)}),this.onModelUpdated()}onModelUpdated($){this.calculatePages(),this.eventSvc.dispatchEvent({type:"paginationChanged",animate:$?.animate??!1,newData:$?.newData??!1,newPage:$?.newPage??!1,newPageSize:$?.newPageSize??!1,keepRenderedRows:$?.keepRenderedRows??!1})}calculatePages(){let{pageBounds:$,pagination:z,rowModel:Q}=this.beans;if(z)z.calculatePages();else $.calculateBounds(0,Q.getRowCount()-1)}},J3=class extends S{constructor(){super(...arguments);this.beanName="pageBounds",this.pixelOffset=0}getFirstRow(){return this.topRowBounds?.rowIndex??-1}getLastRow(){return this.bottomRowBounds?.rowIndex??-1}getCurrentPageHeight(){let{topRowBounds:$,bottomRowBounds:z}=this;if(!$||!z)return 0;return Math.max(z.rowTop+z.rowHeight-$.rowTop,0)}getCurrentPagePixelRange(){let{topRowBounds:$,bottomRowBounds:z}=this,Q=$?.rowTop??0,J=z?z.rowTop+z.rowHeight:0;return{pageFirstPixel:Q,pageLastPixel:J}}calculateBounds($,z){let{rowModel:Q}=this.beans,J=Q.getRowBounds($);if(J)J.rowIndex=$;this.topRowBounds=J;let Z=Q.getRowBounds(z);if(Z)Z.rowIndex=z;this.bottomRowBounds=Z,this.calculatePixelOffset()}getPixelOffset(){return this.pixelOffset}calculatePixelOffset(){let $=this.topRowBounds?.rowTop??0;if(this.pixelOffset===$)return;this.pixelOffset=$,this.eventSvc.dispatchEvent({type:"paginationPixelOffsetChanged"})}},Z3=".ag-pinned-left-floating-bottom,.ag-pinned-left-floating-top,.ag-pinned-right-floating-bottom,.ag-pinned-right-floating-top{min-width:0;overflow:hidden;position:relative}.ag-pinned-left-sticky-top,.ag-pinned-right-sticky-top{height:100%;overflow:hidden;position:relative}.ag-sticky-bottom-full-width-container,.ag-sticky-top-full-width-container{height:100%;overflow:hidden;width:100%}.ag-pinned-left-header,.ag-pinned-right-header{display:inline-block;height:100%;overflow:hidden;position:relative}.ag-body-horizontal-scroll:not(.ag-scrollbar-invisible){.ag-horizontal-left-spacer:not(.ag-scroller-corner){border-right:var(--ag-pinned-column-border)}.ag-horizontal-right-spacer:not(.ag-scroller-corner){border-left:var(--ag-pinned-column-border)}}.ag-pinned-right-header{border-left:var(--ag-pinned-column-border)}.ag-pinned-left-header{border-right:var(--ag-pinned-column-border)}.ag-cell.ag-cell-first-right-pinned:not(.ag-cell-range-left,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-left:var(--ag-pinned-column-border)}.ag-cell.ag-cell-last-left-pinned:not(.ag-cell-range-right,.ag-cell-range-single-cell,.ag-cell-focus:not(.ag-cell-range-selected):focus-within){border-right:var(--ag-pinned-column-border)}.ag-pinned-left-header .ag-header-cell-resize:after{left:calc(50% - var(--ag-header-column-resize-handle-width))}.ag-pinned-right-header .ag-header-cell-resize:after{left:50%}.ag-pinned-left-header .ag-header-cell-resize{right:-3px}.ag-pinned-right-header .ag-header-cell-resize{left:-3px}",X3=class extends S{constructor($,z){super();this.isLeft=$,this.elements=z,this.getWidth=$?()=>this.beans.pinnedCols.leftWidth:()=>this.beans.pinnedCols.rightWidth}postConstruct(){this.addManagedEventListeners({[`${this.isLeft?"left":"right"}PinnedWidthChanged`]:this.onPinnedWidthChanged.bind(this)})}onPinnedWidthChanged(){let $=this.getWidth(),z=$>0;for(let Q of this.elements)if(Q)N(Q,z),f$(Q,$)}},Y3=class extends S{constructor(){super(...arguments);this.beanName="pinnedCols"}postConstruct(){this.beans.ctrlsSvc.whenReady(this,(z)=>{this.gridBodyCtrl=z.gridBodyCtrl});let $=this.checkContainerWidths.bind(this);this.addManagedEventListeners({displayedColumnsChanged:$,displayedColumnsWidthChanged:$}),this.addManagedPropertyListener("domLayout",$)}checkContainerWidths(){let{gos:$,visibleCols:z,eventSvc:Q}=this.beans,J=V0($,"print"),Z=J?0:z.getColsLeftWidth(),X=J?0:z.getDisplayedColumnsRightWidth();if(Z!=this.leftWidth)this.leftWidth=Z,Q.dispatchEvent({type:"leftPinnedWidthChanged"});if(X!=this.rightWidth)this.rightWidth=X,Q.dispatchEvent({type:"rightPinnedWidthChanged"})}keepPinnedColumnsNarrowerThanViewport(){let $=this.gridBodyCtrl.eBodyViewport,z=xz($);if(z<=50)return;let Q=this.getPinnedColumnsOverflowingViewport(z-50),J=this.gos.getCallback("processUnpinnedColumns"),{columns:Z,hasLockedPinned:X}=Q,Y=Z;if(!Y.length&&!X)return;if(J)Y=J({columns:Y,viewportWidth:z});if(!Y?.length)return;Y=Y.filter((q)=>!v0(q)),this.setColsPinned(Y,null,"viewportSizeFeature")}createPinnedWidthFeature($,...z){return new X3($,z)}setColsPinned($,z,Q){let{colModel:J,colAnimation:Z,visibleCols:X,gos:Y}=this.beans;if(!J.cols)return;if(!$?.length)return;if(V0(Y,"print")){j(37);return}Z?.start();let q;if(z===!0||z==="left")q="left";else if(z==="right")q="right";else q=null;let G=[];for(let _ of $){if(!_)continue;let H=J.getCol(_);if(!H)continue;if(H.getPinned()!==q)this.setColPinned(H,q),G.push(H)}if(G.length)X.refresh(Q),D8(this.eventSvc,G,Q);Z?.finish()}initCol($){let{pinned:z,initialPinned:Q}=$.colDef;if(z!==void 0)this.setColPinned($,z);else this.setColPinned($,Q)}setColPinned($,z){if(z===!0||z==="left")$.pinned="left";else if(z==="right")$.pinned="right";else $.pinned=null;$.dispatchStateUpdatedEvent("pinned")}setupHeaderPinnedWidth($){let{scrollVisibleSvc:z}=this.beans;if($.pinned==null)return;let Q=$.pinned==="left",J=$.pinned==="right";$.hidden=!0;let Z=()=>{let X=Q?this.leftWidth:this.rightWidth;if(X==null)return;let Y=X==0,q=$.hidden!==Y,G=this.gos.get("enableRtl"),_=z.getScrollbarWidth(),U=z.verticalScrollShowing&&(G&&Q||!G&&J)?X+_:X;if($.comp.setPinnedContainerWidth(`${U}px`),$.comp.setDisplayed(!Y),q)$.hidden=Y,$.refresh()};$.addManagedEventListeners({leftPinnedWidthChanged:Z,rightPinnedWidthChanged:Z,scrollVisibilityChanged:Z,scrollbarWidthChanged:Z})}getHeaderResizeDiff($,z){if(z.getPinned()){let{leftWidth:J,rightWidth:Z}=this,X=xz(this.beans.ctrlsSvc.getGridBodyCtrl().eBodyViewport)-50;if(J+Z+$>X)if(X>J+Z)$=X-J-Z;else return 0}return $}getPinnedColumnsOverflowingViewport($){let z=this.rightWidth??0,Q=this.leftWidth??0,J=z+Q,Z=!1;if(J<$)return{columns:[],hasLockedPinned:Z};let{visibleCols:X}=this.beans,Y=[...X.leftCols],q=[...X.rightCols],G=0,_=0,H=0,U=[],W=J-H-$;while((_0){if(G0){let B=Y[_++];if(B.colDef.lockPinned){Z=!0;continue}W-=B.getActualWidth(),U.push(B)}}return{columns:U,hasLockedPinned:Z}}},q3={moduleName:"PinnedColumn",version:p,beans:[Y3],css:[Z3]},G3=class extends R0{constructor(){super();this.beanName="ariaAnnounce",this.descriptionContainer=null,this.pendingAnnouncements=new Map,this.lastAnnouncement="",this.updateAnnouncement=g$(this,this.updateAnnouncement.bind(this),200)}postConstruct(){let $=this.beans,z=Y0($),Q=this.descriptionContainer=z.createElement("div");Q.classList.add("ag-aria-description-container"),R6(Q,"polite"),mY(Q,"additions text"),uY(Q,!0),$.eRootDiv.appendChild(Q)}announceValue($,z){this.pendingAnnouncements.set(z,$),this.updateAnnouncement()}updateAnnouncement(){if(!this.descriptionContainer)return;let $=Array.from(this.pendingAnnouncements.values()).join(". ");this.pendingAnnouncements.clear(),this.descriptionContainer.textContent="",setTimeout(()=>{this.handleAnnouncementUpdate($)},50)}handleAnnouncementUpdate($){if(!this.isAlive()||!this.descriptionContainer)return;let z=$;if(z==null||z.replace(/[ .]/g,"")==""){this.lastAnnouncement="";return}if(this.lastAnnouncement===z)z=`${z}​`;this.lastAnnouncement=z,this.descriptionContainer.textContent=z}destroy(){super.destroy();let{descriptionContainer:$}=this;if($)z0($),$.remove();this.descriptionContainer=null,this.pendingAnnouncements.clear()}},_3=class extends G3{},H3={moduleName:"Aria",version:p,beans:[_3]},U3=":where(.ag-delay-render){.ag-cell,.ag-header-cell,.ag-header-group-cell,.ag-row,.ag-spanned-cell-wrapper{visibility:hidden}}",e5="ag-delay-render",W3=class extends S{constructor(){super(...arguments);this.beanName="colDelayRenderSvc",this.hideRequested=!1,this.alreadyRevealed=!1,this.timesRetried=0,this.requesters=new Set}hideColumns($){if(this.alreadyRevealed||this.requesters.has($))return;if(this.requesters.add($),!this.hideRequested)this.beans.ctrlsSvc.whenReady(this,(z)=>{z.gridBodyCtrl.eGridBody.classList.add(e5)}),this.hideRequested=!0}revealColumns($){if(this.alreadyRevealed||!this.isAlive())return;if(this.requesters.delete($),this.requesters.size>0)return;let{renderStatus:z,ctrlsSvc:Q}=this.beans;if(z){if(!z.areHeaderCellsRendered()&&this.timesRetried<5){this.timesRetried++,setTimeout(()=>this.revealColumns($));return}this.timesRetried=0}Q.getGridBodyCtrl().eGridBody.classList.remove(e5),this.alreadyRevealed=!0}},B3={moduleName:"ColumnDelayRender",version:p,beans:[W3],css:[U3]},nJ=class extends x{constructor(){super()}},E3={tag:"div",cls:"ag-overlay-exporting-center",children:[{tag:"span",ref:"eExportingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eExportingText",cls:"ag-exporting-text"}]},K3=class extends nJ{constructor(){super(...arguments);this.eExportingIcon=f,this.eExportingText=f}init($){let{beans:z}=this;this.setTemplate(E3);let Q=h("overlayExporting",z,null);if(Q)this.eExportingIcon.appendChild(Q);let J=$.exporting?.overlayText??this.getLocaleTextFunc()("exportingOoo","Exporting...");this.eExportingText.textContent=J,z.ariaAnnounce.announceValue(J,"overlay")}},L3={tag:"div",cls:"ag-overlay-loading-center",children:[{tag:"span",ref:"eLoadingIcon",cls:"ag-loading-icon"},{tag:"span",ref:"eLoadingText",cls:"ag-loading-text"}]},D3=class extends nJ{constructor(){super(...arguments);this.eLoadingIcon=f,this.eLoadingText=f}init($){let{beans:z,gos:Q}=this,J=j$(Q.get("overlayLoadingTemplate")?.trim());if(this.setTemplate(J??L3),!J){let Z=h("overlayLoading",z,null);if(Z)this.eLoadingIcon.appendChild(Z);let X=$.loading?.overlayText??this.getLocaleTextFunc()("loadingOoo","Loading...");this.eLoadingText.textContent=X,z.ariaAnnounce.announceValue(X,"overlay")}}},F3={tag:"span",cls:"ag-overlay-no-matching-rows-center"},M3=class extends nJ{init($){let{beans:z}=this;this.setTemplate(F3);let Q=$.noMatchingRows?.overlayText??this.getLocaleTextFunc()("noMatchingRows","No Matching Rows");this.getGui().textContent=Q,z.ariaAnnounce.announceValue(Q,"overlay")}},k3={tag:"span",cls:"ag-overlay-no-rows-center"},V3=class extends nJ{init($){let{beans:z,gos:Q}=this,J=j$(Q.get("overlayNoRowsTemplate")?.trim());if(this.setTemplate(J??k3),!J){let Z=$.noRows?.overlayText??this.getLocaleTextFunc()("noRowsToShow","No Rows To Show");this.getGui().textContent=Z,z.ariaAnnounce.announceValue(Z,"overlay")}}};function A3($){$.overlays?.showLoadingOverlay()}function S3($){$.overlays?.showNoRowsOverlay()}function R3($){$.overlays?.hideOverlay()}var j3=".ag-overlay{inset:0;pointer-events:none;position:absolute;z-index:2}.ag-overlay-panel,.ag-overlay-wrapper{display:flex;height:100%;width:100%}.ag-overlay-wrapper{align-items:center;flex:none;justify-content:center;text-align:center}.ag-overlay-exporting-wrapper,.ag-overlay-loading-wrapper,.ag-overlay-modal-wrapper{pointer-events:all}.ag-overlay-exporting-center,.ag-overlay-loading-center{background:var(--ag-background-color);border:solid var(--ag-border-width) var(--ag-border-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-popup-shadow);display:flex;padding:var(--ag-spacing)}",f3={tag:"div",cls:"ag-overlay",role:"presentation",children:[{tag:"div",cls:"ag-overlay-panel",role:"presentation",children:[{tag:"div",ref:"eOverlayWrapper",cls:"ag-overlay-wrapper",role:"presentation"}]}]},d8=class extends x{constructor(){super(f3);this.eOverlayWrapper=f,this.activeOverlay=null,this.activePromise=null,this.activeCssClass=null,this.elToFocusAfter=null,this.overlayExclusive=!1,this.oldWrapperPadding=null,this.registerCSS(j3)}handleKeyDown($){if($.key!==A.TAB||$.defaultPrevented||z$($))return;let{beans:z,eOverlayWrapper:Q}=this;if(Q&&j0(z,Q,!1,$.shiftKey))return;let Z=!1;if($.shiftKey)Z=z.focusSvc.focusGridView({column:b(z.visibleCols.allCols),backwards:!0,canFocusOverlay:!1});else Z=Z$(z,!1);if(Z)$.preventDefault()}updateLayoutClasses($,z){let Q=this.eOverlayWrapper;if(!Q)return;let J=Q.classList,{AUTO_HEIGHT:Z,NORMAL:X,PRINT:Y}=U$;J.toggle(Z,z.autoHeight),J.toggle(X,z.normal),J.toggle(Y,z.print)}postConstruct(){this.createManagedBean(new q4(this)),this.setDisplayed(!1,{skipAriaHidden:!0}),this.beans.overlays.setWrapperComp(this,!1),this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)}),this.addManagedEventListeners({gridSizeChanged:this.refreshWrapperPadding.bind(this)})}setWrapperTypeClass($){let z=this.eOverlayWrapper?.classList;if(!z){this.activeCssClass=null;return}if(this.activeCssClass)z.toggle(this.activeCssClass,!1);this.activeCssClass=$,z.toggle($,!0)}showOverlay($,z,Q){if(this.destroyActiveOverlay(),this.elToFocusAfter=null,this.activePromise=$,this.overlayExclusive=Q,!$)return this.refreshWrapperPadding(),g.resolve();if(this.setWrapperTypeClass(z),this.setDisplayed(!0,{skipAriaHidden:!0}),this.refreshWrapperPadding(),Q&&this.isGridFocused()){let J=d(this.beans);if(J&&!hz(this.beans))this.elToFocusAfter=J}return $.then((J)=>{let Z=this.eOverlayWrapper;if(!Z){this.destroyBean(J);return}if(this.activePromise!==$){if(this.activeOverlay!==J)this.destroyBean(J),J=null;return}if(this.activePromise=null,!J)return;if(this.activeOverlay!==J)Z.appendChild(J.getGui()),this.activeOverlay=J;if(Q&&this.isGridFocused())F0(Z)}),$}refreshWrapperPadding(){if(!this.eOverlayWrapper){this.oldWrapperPadding=null;return}let $=!!this.activeOverlay||!!this.activePromise,z=0;if($&&!this.overlayExclusive)z=this.beans.ctrlsSvc.get("gridHeaderCtrl")?.headerHeight||0;if(z!==this.oldWrapperPadding)this.oldWrapperPadding=z,this.eOverlayWrapper.style.setProperty("padding-top",`${z}px`)}destroyActiveOverlay(){this.activePromise=null;let $=this.activeOverlay;if(!$){this.overlayExclusive=!1,this.elToFocusAfter=null,this.refreshWrapperPadding();return}let z=this.elToFocusAfter;if(this.elToFocusAfter=null,this.activeOverlay=null,this.overlayExclusive=!1,z&&!this.isGridFocused())z=null;this.destroyBean($);let Q=this.eOverlayWrapper;if(Q)z0(Q);z?.focus?.({preventScroll:!0}),this.refreshWrapperPadding()}hideOverlay(){this.destroyActiveOverlay(),this.setDisplayed(!1,{skipAriaHidden:!0})}isGridFocused(){let $=d(this.beans);return!!$&&this.beans.eGridDiv.contains($)}destroy(){this.elToFocusAfter=null,this.destroyActiveOverlay(),this.beans.overlays.setWrapperComp(this,!0),super.destroy(),this.eOverlayWrapper=null}},O3={selector:"AG-OVERLAY-WRAPPER",component:d8},P3=["refresh"],F1=($)=>({name:$,optionalMethods:P3}),Oz={id:"agLoadingOverlay",overlayType:"loading",comp:F1("loadingOverlayComponent"),wrapperCls:"ag-overlay-loading-wrapper",exclusive:!0,compKey:"loadingOverlayComponent",paramsKey:"loadingOverlayComponentParams",isSuppressed:($)=>{let z=$.get("loading");return z===!1||$.get("suppressLoadingOverlay")===!0&&z!==!0}},YQ={id:"agNoRowsOverlay",overlayType:"noRows",comp:F1("noRowsOverlayComponent"),wrapperCls:"ag-overlay-no-rows-wrapper",compKey:"noRowsOverlayComponent",paramsKey:"noRowsOverlayComponentParams",isSuppressed:($)=>$.get("suppressNoRowsOverlay")},R4={id:"agNoMatchingRowsOverlay",overlayType:"noMatchingRows",comp:F1("noMatchingRowsOverlayComponent"),wrapperCls:"ag-overlay-no-matching-rows-wrapper"},EJ={id:"agExportingOverlay",overlayType:"exporting",comp:F1("exportingOverlayComponent"),wrapperCls:"ag-overlay-exporting-wrapper",exclusive:!0},a1={id:"activeOverlay",comp:F1("activeOverlay"),wrapperCls:"ag-overlay-modal-wrapper",exclusive:!0},T3=($)=>{if(!$)return null;return{agLoadingOverlay:Oz,agNoRowsOverlay:YQ,agNoMatchingRowsOverlay:R4,agExportingOverlay:EJ}[$]??a1},v3=($)=>{if(!$)return null;return{loading:Oz,noRows:YQ,noMatchingRows:R4,exporting:EJ}[$]},I3=class extends S{constructor(){super(...arguments);this.beanName="overlays",this.eWrapper=void 0,this.exclusive=!1,this.oldExclusive=!1,this.currentDef=null,this.showInitialOverlay=!0,this.userForcedNoRows=!1,this.exportsInProgress=0,this.newColumnsLoadedCleanup=null}postConstruct(){let $=this.gos;this.showInitialOverlay=o($);let z=()=>{if(this.userForcedNoRows)return;this.updateOverlay(!1)},[Q,J,Z,X]=this.addManagedEventListeners({newColumnsLoaded:z,rowCountReady:()=>{this.disableInitialOverlay(),z(),J()},rowDataUpdated:z,modelUpdated:z});this.newColumnsLoadedCleanup=Q,this.addManagedPropertyListeners(["loading","activeOverlay","activeOverlayParams","overlayComponentParams","loadingOverlayComponentParams","noRowsOverlayComponentParams"],(Y)=>this.onPropChange(new Set(Y.changeSet?.properties)))}destroy(){this.doHideOverlay(),super.destroy(),this.eWrapper=void 0}setWrapperComp($,z){if(!this.isAlive())return;if(!z)this.eWrapper=$;else if(this.eWrapper===$)this.eWrapper=void 0;this.updateOverlay(!1)}isVisible(){return!!this.currentDef}showLoadingOverlay(){this.showInitialOverlay=!1;let $=this.gos;if(!this.eWrapper||$.get("activeOverlay"))return;if(this.isDisabled(Oz))return;let z=$.get("loading");if(!z&&z!==void 0)return;this.doShowOverlay(Oz)}showNoRowsOverlay(){this.showInitialOverlay=!1;let $=this.gos;if(!this.eWrapper||$.get("activeOverlay")||$.get("loading")||this.isDisabled(YQ))return;this.userForcedNoRows=!0,this.doShowOverlay(YQ)}async showExportOverlay($){let{gos:z,beans:Q}=this;if(!this.eWrapper||z.get("activeOverlay")||z.get("loading")||this.isDisabled(EJ)||this.userForcedNoRows&&this.currentDef===YQ){$();return}let J=this.getDesiredDefWithOverride(EJ);if(!J){$();return}this.exportsInProgress++,this.focusedCell=Q.focusSvc.getFocusedCell(),await this.doShowOverlay(J),await new Promise((X)=>setTimeout(()=>X()));let Z=Date.now();try{$()}finally{let X=Date.now()-Z,Y=Math.max(0,300-X),q=()=>{if(this.exportsInProgress--,this.exportsInProgress===0)this.updateOverlay(!1),q_(Q,this.focusedCell),this.focusedCell=null};if(Y>0)setTimeout(()=>q(),Y);else q()}}hideOverlay(){let $=this.gos;this.showInitialOverlay=!1;let z=this.userForcedNoRows;if(this.userForcedNoRows=!1,$.get("loading")){j(99);return}if($.get("activeOverlay")){j(296);return}if(this.currentDef===R4){j(297);return}if(this.doHideOverlay(),z){if(this.getOverlayDef()!==YQ)this.updateOverlay(!1)}}getOverlayWrapperSelector(){return O3}getOverlayWrapperCompClass(){return d8}onPropChange($){let z=$.has("activeOverlay");if(z||$.has("loading")){if(this.updateOverlay(z))return}let Q=this.currentDef,J=this.eWrapper?.activeOverlay;if(J&&Q){let Z=$.has("activeOverlayParams");if(Q===a1){if(Z)J.refresh?.(this.makeCompParams(!0))}else{let X=Q.paramsKey;if($.has("overlayComponentParams")||X&&$.has(X))J.refresh?.(this.makeCompParams(!1,X,Q.overlayType))}}}updateOverlay($){let z=this.eWrapper;if(!z)return this.currentDef=null,!1;let Q=this.getDesiredDefWithOverride(),J=this.currentDef,Z=Q===a1&&$;if(Q!==J){if(!Q)return this.disableInitialOverlay(),this.doHideOverlay();return this.doShowOverlay(Q),!0}if(Z&&Q)return z.hideOverlay(),this.doShowOverlay(Q),!0;if(!Q)this.disableInitialOverlay();return!1}getDesiredDefWithOverride($){let{gos:z}=this,Q=T3(z.get("activeOverlay"));if(!Q){if(Q=$??this.getOverlayDef(),Q&&this.isDisabled(Q))Q=null}return Q}getOverlayDef(){let{gos:$,beans:z}=this,{rowModel:Q}=z,J=$.get("loading");if(J!==void 0){if(this.disableInitialOverlay(),J)return Oz}else if(this.showInitialOverlay){if(!this.isDisabled(Oz)&&(!$.get("columnDefs")||!$.get("rowData")))return Oz;this.disableInitialOverlay()}else this.disableInitialOverlay();let X=Q.getOverlayType();return v3(X)}disableInitialOverlay(){this.showInitialOverlay=!1,this.newColumnsLoadedCleanup?.(),this.newColumnsLoadedCleanup=null}doShowOverlay($){let{gos:z,beans:Q}=this,{userCompFactory:J}=Q;this.currentDef=$;let Z=$!==a1,X=!!$.exclusive;this.exclusive=X;let Y;if($.paramsKey&&z.get($.paramsKey)||$.compKey&&z.get($.compKey))Y=$.paramsKey;let q=void 0;if(Z){if(z.get("overlayComponent")||z.get("overlayComponentSelector"))q=J.getCompDetailsFromGridOptions({name:"overlayComponent",optionalMethods:["refresh"]},void 0,this.makeCompParams(!1,$.paramsKey,$.overlayType))}q??(q=J.getCompDetailsFromGridOptions($.comp,Z?$.id:void 0,this.makeCompParams(!Z,Y,$.overlayType),!1));let G=q?.newAgStackInstance()??null,_=this.eWrapper?this.eWrapper.showOverlay(G,$.wrapperCls,X):g.resolve();return this.eWrapper?.refreshWrapperPadding(),this.setExclusive(X),_}makeCompParams($,z,Q){let{gos:J}=this,Z=$?J.get("activeOverlayParams"):{...J.get("overlayComponentParams"),...z&&J.get(z)||null,overlayType:Q};return y(J,Z??{})}doHideOverlay(){let $=!1;if(this.currentDef)this.currentDef=null,$=!0;this.exclusive=!1;let z=this.eWrapper;if(z)z.hideOverlay(),z.refreshWrapperPadding(),this.setExclusive(!1);return $}setExclusive($){if(this.oldExclusive!==$)this.oldExclusive=$,this.eventSvc.dispatchEvent({type:"overlayExclusiveChanged"})}isDisabled($){let{gos:z}=this;return $.overlayType&&z.get("suppressOverlays")?.includes($.overlayType)||$.isSuppressed?.(z)===!0}},C3={moduleName:"Overlay",version:p,userComponents:{agLoadingOverlay:D3,agNoRowsOverlay:V3,agNoMatchingRowsOverlay:M3,agExportingOverlay:K3},apiFunctions:{showLoadingOverlay:A3,showNoRowsOverlay:S3,hideOverlay:R3},icons:{overlayLoading:"loading",overlayExporting:"loading"},beans:[I3]},b3=class extends S{constructor(){super(...arguments);this.beanName="rowContainerHeight",this.scrollY=0,this.uiBodyHeight=0}postConstruct(){this.addManagedEventListeners({bodyHeightChanged:this.updateOffset.bind(this)}),this.maxDivHeight=hG(),dQ(this.gos,"RowContainerHeightService - maxDivHeight = "+this.maxDivHeight)}updateOffset(){if(!this.stretching)return;let $=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition().top,z=this.getUiBodyHeight();if($!==this.scrollY||z!==this.uiBodyHeight)this.scrollY=$,this.uiBodyHeight=z,this.calculateOffset()}calculateOffset(){this.setUiContainerHeight(this.maxDivHeight),this.pixelsToShave=this.modelHeight-this.uiContainerHeight,this.maxScrollY=this.uiContainerHeight-this.uiBodyHeight;let $=this.scrollY/this.maxScrollY,z=$*this.pixelsToShave;dQ(this.gos,`RowContainerHeightService - Div Stretch Offset = ${z} (${this.pixelsToShave} * ${$})`),this.setDivStretchOffset(z)}setUiContainerHeight($){if($!==this.uiContainerHeight)this.uiContainerHeight=$,this.eventSvc.dispatchEvent({type:"rowContainerHeightChanged"})}clearOffset(){this.setUiContainerHeight(this.modelHeight),this.pixelsToShave=0,this.setDivStretchOffset(0)}setDivStretchOffset($){let z=typeof $==="number"?Math.floor($):null;if(this.divStretchOffset===z)return;this.divStretchOffset=z,this.eventSvc.dispatchEvent({type:"heightScaleChanged"})}setModelHeight($){if(this.modelHeight=$,this.stretching=$!=null&&this.maxDivHeight>0&&$>this.maxDivHeight,this.stretching)this.calculateOffset();else this.clearOffset()}getRealPixelPosition($){return $-this.divStretchOffset}getUiBodyHeight(){let $=this.beans.ctrlsSvc.getScrollFeature().getVScrollPosition();return $.bottom-$.top}getScrollPositionForPixel($){if(this.pixelsToShave<=0)return $;let z=this.modelHeight-this.getUiBodyHeight(),Q=$/z;return this.maxScrollY*Q}},y3=400,x3=class extends S{constructor(){super(...arguments);this.beanName="rowRenderer",this.destroyFuncsForColumnListeners=[],this.rowCtrlsByRowIndex={},this.zombieRowCtrls={},this.allRowCtrls=[],this.topRowCtrls=[],this.bottomRowCtrls=[],this.refreshInProgress=!1,this.dataFirstRenderedFired=!1,this.setupRangeSelectionListeners=()=>{let $=()=>{for(let X of this.getAllCellCtrls())X.onCellSelectionChanged()},z=()=>{for(let X of this.getAllCellCtrls())X.updateRangeBordersIfRangeCount()},Q=()=>{this.eventSvc.addListener("cellSelectionChanged",$),this.eventSvc.addListener("columnMoved",z),this.eventSvc.addListener("columnPinned",z),this.eventSvc.addListener("columnVisible",z)},J=()=>{this.eventSvc.removeListener("cellSelectionChanged",$),this.eventSvc.removeListener("columnMoved",z),this.eventSvc.removeListener("columnPinned",z),this.eventSvc.removeListener("columnVisible",z)};if(this.addDestroyFunc(()=>J()),this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(this.gos))Q();else J()}),u0(this.gos))Q()}}wireBeans($){this.pageBounds=$.pageBounds,this.colModel=$.colModel,this.pinnedRowModel=$.pinnedRowModel,this.rowModel=$.rowModel,this.focusSvc=$.focusSvc,this.rowContainerHeight=$.rowContainerHeight,this.ctrlsSvc=$.ctrlsSvc,this.editSvc=$.editSvc}postConstruct(){this.ctrlsSvc.whenReady(this,($)=>{this.gridBodyCtrl=$.gridBodyCtrl,this.initialise()})}initialise(){this.addManagedEventListeners({paginationChanged:this.onPageLoaded.bind(this),pinnedRowDataChanged:this.onPinnedRowDataChanged.bind(this),pinnedRowsChanged:this.onPinnedRowsChanged.bind(this),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),bodyScroll:this.onBodyScroll.bind(this),bodyHeightChanged:this.redraw.bind(this,{})}),this.addManagedPropertyListeners(["domLayout","embedFullWidthRows"],()=>this.onDomLayoutChanged()),this.addManagedPropertyListeners(["suppressMaxRenderedRowRestriction","rowBuffer"],()=>this.redraw()),this.addManagedPropertyListener("suppressCellFocus",(J)=>this.onSuppressCellFocusChanged(J.currentValue)),this.addManagedPropertyListeners(["groupSuppressBlankHeader","getBusinessKeyForNode","fullWidthCellRenderer","fullWidthCellRendererParams","suppressStickyTotalRow","groupRowRenderer","groupRowRendererParams","loadingCellRenderer","loadingCellRendererParams","detailCellRenderer","detailCellRendererParams","enableRangeSelection","enableCellTextSelection"],()=>this.redrawRows()),this.addManagedPropertyListener("cellSelection",({currentValue:J,previousValue:Z})=>{if(!Z&&J||Z&&!J)this.redrawRows()});let{stickyRowSvc:$,gos:z,showRowGroupCols:Q}=this.beans;if(Q)this.addManagedPropertyListener("showOpenedGroup",()=>{let J=Q.columns;if(J.length)this.refreshCells({columns:J,force:!0})});if($)this.stickyRowFeature=$.createStickyRowFeature(this,this.createRowCon.bind(this),this.destroyRowCtrls.bind(this));else{let J=this.gridBodyCtrl;J.setStickyTopHeight(0),J.setStickyBottomHeight(0)}this.registerCellEventListeners(),this.initialiseCache(),this.printLayout=V0(z,"print"),this.embedFullWidthRows=this.printLayout||z.get("embedFullWidthRows"),this.redrawAfterModelUpdate()}initialiseCache(){if(this.gos.get("keepDetailRows")){let $=this.getKeepDetailRowsCount(),z=$!=null?$:3;this.cachedRowCtrls=new w3(z)}}getKeepDetailRowsCount(){return this.gos.get("keepDetailRowsCount")}getStickyTopRowCtrls(){return this.stickyRowFeature?.stickyTopRowCtrls??[]}getStickyBottomRowCtrls(){return this.stickyRowFeature?.stickyBottomRowCtrls??[]}updateAllRowCtrls(){let $=Object.values(this.rowCtrlsByRowIndex),z=Object.values(this.zombieRowCtrls),Q=this.cachedRowCtrls?.getEntries()??[];if(z.length>0||Q.length>0)this.allRowCtrls=[...$,...z,...Q];else this.allRowCtrls=$}isCellBeingRendered($,z){let Q=this.rowCtrlsByRowIndex[$];if(!z||!Q)return!!Q;if(Q.isFullWidth())return!0;return!!this.beans.spannedRowRenderer?.getCellByPosition({rowIndex:$,column:z,rowPinned:null})||!!Q.getCellCtrl(z)||!Q.isRowRendered()}updateCellFocus($){for(let z of this.getAllCellCtrls())z.onCellFocused($);for(let z of this.getFullWidthRowCtrls())z.onFullWidthRowFocused($)}onCellFocusChanged($){if($?.rowIndex!=null&&!$.rowPinned){let z=this.beans.colModel.getCol($.column)??void 0;if(!this.isCellBeingRendered($.rowIndex,z))this.redraw()}this.updateCellFocus($)}onSuppressCellFocusChanged($){for(let z of this.getAllCellCtrls())z.onSuppressCellFocusChanged($);for(let z of this.getFullWidthRowCtrls())z.onSuppressCellFocusChanged($)}registerCellEventListeners(){this.addManagedEventListeners({cellFocused:($)=>this.onCellFocusChanged($),cellFocusCleared:()=>this.updateCellFocus(),flashCells:($)=>{let{cellFlashSvc:z}=this.beans;if(z)for(let Q of this.getAllCellCtrls())z.onFlashCells(Q,$)},columnHoverChanged:()=>{for(let $ of this.getAllCellCtrls())$.onColumnHover()},displayedColumnsChanged:()=>{for(let $ of this.getAllCellCtrls())$.onDisplayedColumnsChanged()},displayedColumnsWidthChanged:()=>{if(this.printLayout)for(let $ of this.getAllCellCtrls())$.onLeftChanged()}}),this.setupRangeSelectionListeners(),this.refreshListenersToColumnsForCellComps(),this.addManagedEventListeners({gridColumnsChanged:this.refreshListenersToColumnsForCellComps.bind(this)}),this.addDestroyFunc(this.removeGridColumnListeners.bind(this))}removeGridColumnListeners(){for(let $ of this.destroyFuncsForColumnListeners)$();this.destroyFuncsForColumnListeners.length=0}refreshListenersToColumnsForCellComps(){this.removeGridColumnListeners();let $=this.colModel.getCols();for(let z of $){let Q=(G)=>{for(let _ of this.getAllCellCtrls())if(_.column===z)G(_)},J=()=>{Q((G)=>G.onLeftChanged())},Z=()=>{Q((G)=>G.onWidthChanged())},X=()=>{Q((G)=>G.onFirstRightPinnedChanged())},Y=()=>{Q((G)=>G.onLastLeftPinnedChanged())},q=()=>{Q((G)=>G.onColDefChanged())};z.__addEventListener("leftChanged",J),z.__addEventListener("widthChanged",Z),z.__addEventListener("firstRightPinnedChanged",X),z.__addEventListener("lastLeftPinnedChanged",Y),z.__addEventListener("colDefChanged",q),this.destroyFuncsForColumnListeners.push(()=>{z.__removeEventListener("leftChanged",J),z.__removeEventListener("widthChanged",Z),z.__removeEventListener("firstRightPinnedChanged",X),z.__removeEventListener("lastLeftPinnedChanged",Y),z.__removeEventListener("colDefChanged",q)})}}onDomLayoutChanged(){let $=V0(this.gos,"print"),z=$||this.gos.get("embedFullWidthRows"),Q=z!==this.embedFullWidthRows||this.printLayout!==$;if(this.printLayout=$,this.embedFullWidthRows=z,Q)this.redrawAfterModelUpdate({domLayoutChanged:!0})}datasourceChanged(){this.firstRenderedRow=0,this.lastRenderedRow=-1;let $=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls($)}onPageLoaded($){let z={recycleRows:$.keepRenderedRows,animate:$.animate,newData:$.newData,newPage:$.newPage,onlyBody:!0};this.redrawAfterModelUpdate(z)}getAllCellsNotSpanningForColumn($){let z=[];for(let Q of this.getAllRowCtrls()){let J=Q.getCellCtrl($,!0)?.eGui;if(J)z.push(J)}return z}refreshFloatingRowComps($=!0){this.refreshFloatingRows(this.topRowCtrls,"top",$),this.refreshFloatingRows(this.bottomRowCtrls,"bottom",$)}refreshFloatingRows($,z,Q){let{pinnedRowModel:J,beans:Z,printLayout:X}=this,Y=Object.fromEntries($.map((G)=>[G.rowNode.id,G]));J?.forEachPinnedRow(z,(G,_)=>{let H=$[_];if(H&&J.getPinnedRowById(H.rowNode.id,z)===void 0)H.destroyFirstPass(),H.destroySecondPass();if(G.id in Y&&Q)$[_]=Y[G.id],delete Y[G.id];else $[_]=new D2(G,Z,!1,!1,X)});let q=(z==="top"?J?.getPinnedTopRowCount():J?.getPinnedBottomRowCount())??0;$.length=q}onPinnedRowDataChanged(){let $={recycleRows:!0};this.redrawAfterModelUpdate($)}onPinnedRowsChanged(){this.redrawAfterModelUpdate({recycleRows:!0})}redrawRow($,z=!1){if($.sticky)this.stickyRowFeature?.refreshStickyNode($);else if(this.cachedRowCtrls?.has($)){this.cachedRowCtrls.removeRow($);return}else{let Q=(J)=>{let Z=J[$.rowIndex];if(!Z)return;if(Z.rowNode!==$)return;Z.destroyFirstPass(),Z.destroySecondPass(),J[$.rowIndex]=this.createRowCon($,!1,!1)};switch($.rowPinned){case"top":Q(this.topRowCtrls);break;case"bottom":Q(this.bottomRowCtrls);break;default:Q(this.rowCtrlsByRowIndex),this.updateAllRowCtrls()}}if(!z)this.dispatchDisplayedRowsChanged(!1)}redrawRows($){let{editSvc:z}=this.beans;if(z?.isEditing())if(z.isBatchEditing())z.cleanupEditors();else z.stopEditing(void 0,{source:"api"});if($!=null){for(let J of $??[])this.redrawRow(J,!0);this.dispatchDisplayedRowsChanged(!1);return}this.redrawAfterModelUpdate()}redrawAfterModelUpdate($={}){this.getLockOnRefresh();let z=this.beans.focusSvc?.getFocusCellToUseAfterRefresh();this.updateContainerHeights(),this.scrollToTopIfNewData($);let Q=!$.domLayoutChanged&&!!$.recycleRows,J=$.animate&&HQ(this.gos),Z=Q?this.getRowsToRecycle():null;if(!Q)this.removeAllRowComps();this.workOutFirstAndLastRowsToRender();let{stickyRowFeature:X,gos:Y}=this;if(X){X.checkStickyRows();let q=X.extraTopHeight+X.extraBottomHeight;if(q)this.updateContainerHeights(q)}if(this.recycleRows(Z,J),this.gridBodyCtrl.updateRowCount(),!$.onlyBody)this.refreshFloatingRowComps(Y.get("enableRowPinning")?Q:void 0);if(this.dispatchDisplayedRowsChanged(),z!=null)this.restoreFocusedCell(z);this.releaseLockOnRefresh()}scrollToTopIfNewData($){let z=$.newData||$.newPage,Q=this.gos.get("suppressScrollOnNewData");if(z&&!Q)this.gridBodyCtrl.scrollFeature.scrollToTop(),this.stickyRowFeature?.resetOffsets()}updateContainerHeights($=0){let{rowContainerHeight:z}=this;if(this.printLayout){z.setModelHeight(null);return}let Q=this.pageBounds.getCurrentPageHeight();if(Q===0)Q=1;z.setModelHeight(Q+$)}getLockOnRefresh(){if(this.refreshInProgress)throw Error($$(252));this.refreshInProgress=!0,this.beans.frameworkOverrides.getLockOnRefresh?.()}releaseLockOnRefresh(){this.refreshInProgress=!1,this.beans.frameworkOverrides.releaseLockOnRefresh?.()}isRefreshInProgress(){return this.refreshInProgress}restoreFocusedCell($){if(!$)return;let z=this.beans.focusSvc,Q=this.findPositionToFocus($);if(!Q){z.focusHeaderPosition({headerPosition:{headerRowIndex:l0(this.beans)-1,column:$.column}});return}if($.rowIndex!==Q.rowIndex||$.rowPinned!=Q.rowPinned){z.setFocusedCell({...Q,preventScrollOnBrowserFocus:!0,forceBrowserFocus:!0});return}if(!z.doesRowOrCellHaveBrowserFocus())this.updateCellFocus(y(this.gos,{...Q,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0,type:"cellFocused"}))}findPositionToFocus($){let{pagination:z,pageBounds:Q}=this.beans,J=$;if(J.rowPinned==null&&z&&Q&&!z.isRowInPage(J.rowIndex))J={rowPinned:null,rowIndex:Q.getFirstRow()};while(J){if(J.rowPinned==null&&Q){if(J.rowIndexQ.getLastRow())J={rowPinned:null,rowIndex:Q.getLastRow()}}let Z=this.getRowByPosition(J);if(Z?.isAlive())return{...Z.getRowPosition(),column:$.column};J=m0(this.beans,J)}return null}getAllCellCtrls(){let $=[],z=this.getAllRowCtrls(),Q=z.length;for(let J=0;J{let Z=J.rowNode;return z6(Z,z)})}getCellCtrls($,z){let Q;if(T(z))Q={},z.forEach((Z)=>{let X=this.colModel.getCol(Z);if(T(X))Q[X.getId()]=!0});let J=[];for(let Z of this.getRowCtrls($))for(let X of Z.getAllCellCtrls()){let Y=X.column.getId();if(Q&&!Q[Y])continue;J.push(X)}return J}destroy(){this.removeAllRowComps(!0),super.destroy()}removeAllRowComps($=!1){let z=Object.keys(this.rowCtrlsByRowIndex);this.removeRowCtrls(z,$),this.stickyRowFeature?.destroyStickyCtrls()}getRowsToRecycle(){let $=[];for(let Q of Object.keys(this.rowCtrlsByRowIndex))if(this.rowCtrlsByRowIndex[Q].rowNode.id==null)$.push(Q);this.removeRowCtrls($);let z={};for(let Q of Object.values(this.rowCtrlsByRowIndex)){let J=Q.rowNode;z[J.id]=Q}return this.rowCtrlsByRowIndex={},z}removeRowCtrls($,z=!1){for(let Q of $){let J=this.rowCtrlsByRowIndex[Q];if(J)J.destroyFirstPass(z),J.destroySecondPass();delete this.rowCtrlsByRowIndex[Q]}}onBodyScroll($){if($.direction!=="vertical")return;this.redraw({afterScroll:!0})}redraw($={}){let{focusSvc:z,animationFrameSvc:Q}=this.beans,{afterScroll:J}=$,Z,X=this.stickyRowFeature;if(X)Z=z?.getFocusCellToUseAfterRefresh()||void 0;let Y=this.firstRenderedRow,q=this.lastRenderedRow;this.workOutFirstAndLastRowsToRender();let G=!1;if(X){G=X.checkStickyRows();let H=X.extraTopHeight+X.extraBottomHeight;if(H)this.updateContainerHeights(H)}let _=this.firstRenderedRow!==Y||this.lastRenderedRow!==q;if(J&&!G&&!_)return;if(this.getLockOnRefresh(),this.recycleRows(null,!1,J),this.releaseLockOnRefresh(),this.dispatchDisplayedRowsChanged(J&&!G),Z!=null){let H=z?.getFocusCellToUseAfterRefresh();if(Z!=null&&H==null)Q?.flushAllFrames(),this.restoreFocusedCell(Z)}}removeRowCompsNotToDraw($,z){let Q={};for(let X of $)Q[X]=!0;let Z=Object.keys(this.rowCtrlsByRowIndex).filter((X)=>!Q[X]);this.removeRowCtrls(Z,z)}calculateIndexesToDraw($){let z=[];for(let Y=this.firstRenderedRow;Y<=this.lastRenderedRow;Y++)z.push(Y);let Q=this.beans.pagination,J=this.beans.focusSvc?.getFocusedCell()?.rowIndex;if(J!=null&&(Jthis.lastRenderedRow)&&(!Q||Q.isRowInPage(J))&&J{let q=Y.rowNode.rowIndex;if(q==null||q===J)return;if(qthis.lastRenderedRow){if(this.doNotUnVirtualiseRow(Y))z.push(q)}};for(let Y of Object.values(this.rowCtrlsByRowIndex))Z(Y);if($)for(let Y of Object.values($))Z(Y);z.sort((Y,q)=>Y-q);let X=[];for(let Y=0;Y{this.destroyRowCtrls($,z),this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()});else this.destroyRowCtrls($,z)}this.updateAllRowCtrls()}dispatchDisplayedRowsChanged($=!1){this.eventSvc.dispatchEvent({type:"displayedRowsChanged",afterScroll:$})}onDisplayedColumnsChanged(){let{visibleCols:$}=this.beans,z=$.isPinningLeft(),Q=$.isPinningRight();if(this.pinningLeft!==z||Q!==this.pinningRight){if(this.pinningLeft=z,this.pinningRight=Q,this.embedFullWidthRows)this.redrawFullWidthEmbeddedRows()}}redrawFullWidthEmbeddedRows(){let $=[];for(let z of this.getFullWidthRowCtrls()){let Q=z.rowNode.rowIndex;$.push(Q.toString())}this.refreshFloatingRowComps(),this.removeRowCtrls($),this.redraw({afterScroll:!0})}getFullWidthRowCtrls($){let z=$6($);return this.getAllRowCtrls().filter((Q)=>{if(!Q.isFullWidth())return!1;let J=Q.rowNode;if(z!=null&&!z6(J,z))return!1;return!0})}createOrUpdateRowCtrl($,z,Q,J){let Z,X=this.rowCtrlsByRowIndex[$];if(!X){if(Z=this.rowModel.getRow($),T(Z)&&T(z)&&z[Z.id]&&Z.alreadyRendered)X=z[Z.id],z[Z.id]=null}if(!X){if(!Z)Z=this.rowModel.getRow($);if(T(Z))X=this.createRowCon(Z,Q,J);else return}if(Z)Z.alreadyRendered=!0;this.rowCtrlsByRowIndex[$]=X}destroyRowCtrls($,z){let Q=[];if($)for(let J of Object.values($)){if(!J)continue;if(this.cachedRowCtrls&&J.isCacheable()){this.cachedRowCtrls.addRow(J);continue}if(J.destroyFirstPass(!z),z){let Z=J.instanceId;this.zombieRowCtrls[Z]=J,Q.push(()=>{J.destroySecondPass(),delete this.zombieRowCtrls[Z]})}else J.destroySecondPass()}if(z)Q.push(()=>{if(this.isAlive())this.updateAllRowCtrls(),this.dispatchDisplayedRowsChanged()}),window.setTimeout(()=>{for(let J of Q)J()},y3)}getRowBuffer(){return this.gos.get("rowBuffer")}getRowBufferInPixels(){let $=this.getRowBuffer(),z=Z7(this.beans);return $*z}workOutFirstAndLastRowsToRender(){let{rowContainerHeight:$,pageBounds:z,rowModel:Q}=this;$.updateOffset();let J,Z;if(!Q.isRowsToRender())J=0,Z=-1;else if(this.printLayout)this.beans.environment.refreshRowHeightVariable(),J=z.getFirstRow(),Z=z.getLastRow();else{let H=this.getRowBufferInPixels(),U=this.ctrlsSvc.getScrollFeature(),W=this.gos.get("suppressRowVirtualisation"),B=!1,E,K;do{let k=z.getPixelOffset(),{pageFirstPixel:V,pageLastPixel:R}=z.getCurrentPagePixelRange(),O=$.divStretchOffset,I=U.getVScrollPosition(),v=I.top,C=I.bottom;if(W)E=V+O,K=R+O;else E=Math.max(v+k-H,V)+O,K=Math.min(C+k+H,R)+O;this.firstVisibleVPixel=Math.max(v+k,V)+O,this.lastVisibleVPixel=Math.min(C+k,R)+O,B=this.ensureAllRowsInRangeHaveHeightsCalculated(E,K)}while(B);let L=Q.getRowIndexAtPixel(E),D=Q.getRowIndexAtPixel(K),F=z.getFirstRow(),M=z.getLastRow();if(LM)D=M;J=L,Z=D}let X=V0(this.gos,"normal"),Y=this.gos.get("suppressMaxRenderedRowRestriction"),q=Math.max(this.getRowBuffer(),500);if(X&&!Y){if(Z-J>q)Z=J+q}let G=J!==this.firstRenderedRow,_=Z!==this.lastRenderedRow;if(G||_)this.firstRenderedRow=J,this.lastRenderedRow=Z,this.eventSvc.dispatchEvent({type:"viewportChanged",firstRow:J,lastRow:Z})}dispatchFirstDataRenderedEvent(){if(this.dataFirstRenderedFired)return;this.dataFirstRenderedFired=!0,Y$(this.beans,()=>{this.beans.eventSvc.dispatchEvent({type:"firstDataRendered",firstRow:this.firstRenderedRow,lastRow:this.lastRenderedRow})})}ensureAllRowsInRangeHaveHeightsCalculated($,z){let Q=this.pinnedRowModel?.ensureRowHeightsValid(),J=this.stickyRowFeature?.ensureRowHeightsValid(),{pageBounds:Z,rowModel:X}=this,Y=X.ensureRowHeightsValid($,z,Z.getFirstRow(),Z.getLastRow());if(Y||J)this.eventSvc.dispatchEvent({type:"recalculateRowBounds"});if(J||Y||Q)return this.updateContainerHeights(),!0;return!1}doNotUnVirtualiseRow($){let J=$.rowNode,Z=this.focusSvc.isRowFocused(J.rowIndex,J.rowPinned),X=this.editSvc?.isEditing($),Y=J.detail;if(!(Z||X||Y))return!1;return this.isRowPresent(J)?!0:!1}isRowPresent($){if(!this.rowModel.isRowPresent($))return!1;return this.beans.pagination?.isRowInPage($.rowIndex)??!0}createRowCon($,z,Q){let J=this.cachedRowCtrls?.getRow($)??null;if(J)return J;let Z=Q&&!this.printLayout&&!!this.beans.animationFrameSvc?.active;return new D2($,this.beans,z,Z,this.printLayout)}getRenderedNodes(){let $=Object.values(this.rowCtrlsByRowIndex).map((J)=>J.rowNode),z=this.getStickyTopRowCtrls().map((J)=>J.rowNode),Q=this.getStickyBottomRowCtrls().map((J)=>J.rowNode);return[...z,...$,...Q]}getRowByPosition($){let z,{rowIndex:Q}=$;switch($.rowPinned){case"top":z=this.topRowCtrls[Q];break;case"bottom":z=this.bottomRowCtrls[Q];break;default:if(z=this.rowCtrlsByRowIndex[Q],!z){if(z=this.getStickyTopRowCtrls().find((J)=>J.rowNode.rowIndex===Q)||null,!z)z=this.getStickyBottomRowCtrls().find((J)=>J.rowNode.rowIndex===Q)||null}break}return z}isRangeInRenderedViewport($,z){if($==null||z==null)return!1;let J=$>this.lastRenderedRow;return!(zthis.maxCount){let z=this.entriesList[0];z.destroyFirstPass(),z.destroySecondPass(),this.removeFromCache(z)}}getRow($){if($?.id==null)return null;let z=this.entriesMap[$.id];if(!z)return null;return this.removeFromCache(z),z.setCached(!1),z.rowNode!=$?null:z}has($){return this.entriesMap[$.id]!=null}removeRow($){let z=$.id,Q=this.entriesMap[z];delete this.entriesMap[z],Z0(this.entriesList,Q)}removeFromCache($){let z=$.rowNode.id;delete this.entriesMap[z],Z0(this.entriesList,$)}getEntries(){return this.entriesList}};function $6($){if(!$)return;let z={top:{},bottom:{},normal:{}};for(let Q of $){let J=Q.id;switch(Q.rowPinned){case"top":z.top[J]=Q;break;case"bottom":z.bottom[J]=Q;break;default:z.normal[J]=Q;break}}return z}function z6($,z){let Q=$.id;switch($.rowPinned){case"top":return z.top[Q]!=null;case"bottom":return z.bottom[Q]!=null;default:return z.normal[Q]!=null}}var N3=class extends S{constructor(){super(...arguments);this.beanName="rowNodeSorter",this.accentedSort=!1,this.primaryColumnsSortGroups=!1,this.pivotActive=!1}postConstruct(){this.firstLeaf=o(this.gos)?pz:g3,this.addManagedPropertyListeners(["accentedSort","autoGroupColumnDef","treeData"],this.updateOptions.bind(this));let $=this.updatePivotModeState.bind(this);this.addManagedEventListeners({columnPivotModeChanged:$,columnPivotChanged:$}),this.updateOptions(),$()}updateOptions(){this.accentedSort=!!this.gos.get("accentedSort"),this.primaryColumnsSortGroups=W$(this.gos)}updatePivotModeState(){this.pivotActive=this.beans.colModel.isPivotActive()}doFullSortInPlace($,z){return $.sort((Q,J)=>this.compareRowNodes(z,Q,J))}compareRowNodes($,z,Q){if(z===Q)return 0;let J=this.accentedSort;for(let Z=0,X=$.length;Z{if($.data)return $;let z=$.childrenAfterGroup;while(z?.length){let Q=z[0];if(Q.data)return Q;z=Q.childrenAfterGroup}},Q6=($)=>{if(!$)return $;if(typeof $==="bigint")return $<0n?-$:$;let z=Number($);return isNaN(z)?$:Math.abs(z)};function h3($){$.sortSvc?.onSortChanged("api")}var Rz=($,z)=>({tag:"span",ref:`eSort${$}`,cls:`ag-sort-indicator-icon ag-sort-${z} ag-hidden`,attrs:{"aria-hidden":"true"}}),u3={tag:"span",cls:"ag-sort-indicator-container",children:[Rz("Order","order"),Rz("Asc","ascending-icon"),Rz("Desc","descending-icon"),Rz("Mixed","mixed-icon"),Rz("AbsoluteAsc","absolute-ascending-icon"),Rz("AbsoluteDesc","absolute-descending-icon"),Rz("None","none-icon")]},j4=class extends x{constructor($){super();if(this.eSortOrder=f,this.eSortAsc=f,this.eSortDesc=f,this.eSortMixed=f,this.eSortNone=f,this.eSortAbsoluteAsc=f,this.eSortAbsoluteDesc=f,!$)this.setTemplate(u3)}attachCustomElements($,z,Q,J,Z,X,Y){this.eSortOrder=$,this.eSortAsc=z,this.eSortDesc=Q,this.eSortMixed=J,this.eSortNone=Z,this.eSortAbsoluteAsc=X,this.eSortAbsoluteDesc=Y}setupSort($,z=!1,Q){if(this.column=$,this.suppressOrder=z,this.getSortDefOverride=Q,this.setupMultiSortIndicator(),!$.isSortable()&&!$.getColDef().showRowGroup)return;this.addInIcon("sortAscending",this.eSortAsc,$),this.addInIcon("sortDescending",this.eSortDesc,$),this.addInIcon("sortUnSort",this.eSortNone,$),this.addInIcon("sortAbsoluteAscending",this.eSortAbsoluteAsc,$),this.addInIcon("sortAbsoluteDescending",this.eSortAbsoluteDesc,$);let J=this.updateIcons.bind(this),Z=this.onSortChanged.bind(this);this.addManagedPropertyListener("unSortIcon",J),this.addManagedEventListeners({newColumnsLoaded:J,sortChanged:Z,columnRowGroupChanged:Z}),this.onSortChanged()}addInIcon($,z,Q){if(z==null)return;let J=h($,this.beans,Q);if(J)z.appendChild(J)}onSortChanged(){if(this.updateIcons(),!this.suppressOrder)this.updateSortOrder()}updateIcons(){let{eSortAsc:$,eSortDesc:z,eSortAbsoluteAsc:Q,eSortAbsoluteDesc:J,eSortNone:Z,column:X,gos:Y,beans:q}=this,G=c2(X,q,this.getSortDefOverride),_=G.isDefaultSortAllowed,H=G.isAbsoluteSortAllowed,{isAbsoluteSort:U,isDefaultSort:W,isAscending:B,isDescending:E,direction:K}=G;if($)N($,B&&W&&_,{skipAriaHidden:!0});if(z)N(z,E&&W&&_,{skipAriaHidden:!0});if(Z){let L=!X.getColDef().unSortIcon&&!Y.get("unSortIcon");N(Z,!L&&!K,{skipAriaHidden:!0})}if(Q)N(Q,B&&U&&H,{skipAriaHidden:!0});if(J)N(J,E&&U&&H,{skipAriaHidden:!0})}setupMultiSortIndicator(){let{eSortMixed:$,column:z,gos:Q}=this;this.addInIcon("sortUnSort",$,z);let J=z.getColDef().showRowGroup;if(W$(Q)&&J)this.addManagedEventListeners({sortChanged:this.updateMultiSortIndicator.bind(this),columnRowGroupChanged:this.updateMultiSortIndicator.bind(this)}),this.updateMultiSortIndicator()}updateMultiSortIndicator(){let{eSortMixed:$,beans:z,column:Q}=this;if($){let J=z.sortSvc.getDisplaySortForColumn(Q)?.direction==="mixed";N($,J,{skipAriaHidden:!0})}}updateSortOrder(){let{eSortOrder:$,column:z,beans:{sortSvc:Q}}=this;if(!$)return;let J=Q.getColumnsWithSortingOrdered(),Z=Q.getDisplaySortIndexForColumn(z)??-1,X=J.some((q)=>Q.getDisplaySortIndexForColumn(q)??!1),Y=Z>=0&&X;if(N($,Y,{skipAriaHidden:!0}),Z>=0)$.textContent=(Z+1).toString();else z0($)}refresh(){this.onSortChanged()}},m3={selector:"AG-SORT-INDICATOR",component:j4},c3=class extends S{constructor(){super(...arguments);this.beanName="sortSvc"}progressSort($,z,Q){let J=this.getNextSortDirection($);this.setSortForColumn($,J,z,Q)}progressSortFromEvent($,z){let J=this.gos.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey;this.progressSort($,J,"uiColumnSorted")}setSortForColumn($,z,Q,J){let{gos:Z,showRowGroupCols:X}=this.beans,Y=W$(Z),q=[$];if(Y){if($.getColDef().showRowGroup){let U=X?.getSourceColumnsForGroupColumn?.($)?.filter((W)=>W.isSortable());if(U)q=[$,...U]}}for(let H of q)this.setColSort(H,z,J);let G=(Q||Z.get("alwaysMultiSort"))&&!Z.get("suppressMultiSort"),_=[];if(!G){let H=this.clearSortBarTheseColumns(q,J);_.push(...H)}this.updateSortIndex($),_.push(...q),this.dispatchSortChangedEvents(J,_)}updateSortIndex($){let{gos:z,colModel:Q,showRowGroupCols:J}=this.beans,Z=W$(z),X=J?.getShowRowGroupCol($.getId()),Y=Z?X||$:$,q=this.getColumnsWithSortingOrdered();Q.forAllCols((H)=>this.setColSortIndex(H,null));let G=q.filter((H)=>{if(Z&&H.getColDef().showRowGroup)return!1;return H!==Y});(Y.getSortDef()?[...G,Y]:G).forEach((H,U)=>this.setColSortIndex(H,U))}onSortChanged($,z){this.dispatchSortChangedEvents($,z)}isSortActive(){let $=!1;return this.beans.colModel.forAllCols((z)=>{if(z.getSortDef())return $=!0,!0}),$}dispatchSortChangedEvents($,z){let Q={type:"sortChanged",source:$};if(z)Q.columns=z;this.eventSvc.dispatchEvent(Q)}clearSortBarTheseColumns($,z){let Q=[];return this.beans.colModel.forAllCols((J)=>{if(!$.includes(J)){if(J.getSortDef())Q.push(J);this.setColSort(J,void 0,z)}}),Q}getNextSortDirection($,z){let Q=$.getSortingOrder(),J=z===void 0?$.getSortDef():a0(z),X=Q.findIndex((Y)=>t1(Y,J))+1;if(X>=Q.length)X=0;return a0(Q[X])}getIndexedSortMap(){let{gos:$,colModel:z,showRowGroupCols:Q,rowGroupColsSvc:J}=this.beans,Z=[];if(z.forAllCols((_)=>{if(_.getSortDef())Z.push(_)}),z.isPivotMode()){let _=W$($);Z=Z.filter((H)=>{let U=!!H.getAggFunc(),W=!H.isPrimary(),B=_?Q?.getShowRowGroupCol(H.getId()):H.getColDef().showRowGroup;return U||W||B})}let X=J?.columns.filter((_)=>!!_.getSortDef())??[],Y={};Z.forEach((_,H)=>Y[_.getId()]=H),Z.sort((_,H)=>{let U=_.getSortIndex(),W=H.getSortIndex();if(U!=null&&W!=null)return U-W;else if(U==null&&W==null){let B=Y[_.getId()],E=Y[H.getId()];return B>E?1:-1}else if(W==null)return-1;else return 1});let q=W$($)&&!!X.length;if(q)Z=[...new Set(Z.map((_)=>Q?.getShowRowGroupCol(_.getId())??_))];let G=new Map;if(Z.forEach((_,H)=>G.set(_,H)),q)for(let _ of X){let H=Q.getShowRowGroupCol(_.getId());G.set(_,G.get(H))}return G}getColumnsWithSortingOrdered(){return[...this.getIndexedSortMap().entries()].sort(([,$],[,z])=>$-z).map(([$])=>$)}collectSortItems($=!1){let z=[],Q=this.getColumnsWithSortingOrdered();for(let J of Q){let Z=J.getSortDef()?.direction;if(!Z)continue;let X=L$(J.getSortDef()?.type),Y={sort:Z,type:X};if($)Y.colId=J.getId();else Y.column=J;z.push(Y)}return z}getSortModel(){return this.collectSortItems(!0)}getSortOptions(){return this.collectSortItems()}canColumnDisplayMixedSort($){let z=W$(this.gos),Q=!!$.getColDef().showRowGroup;return z&&Q}getDisplaySortForColumn($){let z=this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn($);if(!this.canColumnDisplayMixedSort($)||!z?.length)return $.getSortDef();let J=$.getColDef().field!=null||!!$.getColDef().valueGetter?[$,...z]:z,Z=J[0].getSortDef();if(!J.every((Y)=>t1(Y.getSortDef(),Z)))return{type:L$($.getSortDef()?.type),direction:"mixed"};return Z}getDisplaySortIndexForColumn($){return this.getIndexedSortMap().get($)}setupHeader($,z){let Q=()=>{let{type:J,direction:Z}=a0(z.getSortDef());if($.toggleCss("ag-header-cell-sorted-asc",Z==="asc"),$.toggleCss("ag-header-cell-sorted-desc",Z==="desc"),$.toggleCss("ag-header-cell-sorted-abs-asc",J==="absolute"&&Z==="asc"),$.toggleCss("ag-header-cell-sorted-abs-desc",J==="absolute"&&Z==="desc"),$.toggleCss("ag-header-cell-sorted-none",!Z),z.getColDef().showRowGroup){let q=!this.beans.showRowGroupCols?.getSourceColumnsForGroupColumn(z)?.every((G)=>Z==G.getSortDef()?.direction);$.toggleCss("ag-header-cell-sorted-mixed",q)}};$.addManagedEventListeners({sortChanged:Q,columnPinned:Q,columnRowGroupChanged:Q,displayedColumnsChanged:Q})}initCol($){let{sortIndex:z,initialSortIndex:Q}=$.colDef,J=A7($.colDef);if(J)$.setSortDef(J,!0);if(z!==void 0){if(z!==null)$.sortIndex=z}else if(Q!==null)$.sortIndex=Q}updateColSort($,z,Q){if(z===void 0)return;this.setColSort($,a0(z),Q)}setColSort($,z,Q){if(!t1($.getSortDef(),z))$.setSortDef(a0(z),z===void 0),$.dispatchColEvent("sortChanged",Q);$.dispatchStateUpdatedEvent("sort")}setColSortIndex($,z){$.sortIndex=z,$.dispatchStateUpdatedEvent("sortIndex")}createSortIndicator($){return new j4($)}getSortIndicatorSelector(){return m3}},t8={moduleName:"Sort",version:p,beans:[c3,N3],apiFunctions:{onSortChanged:h3},userComponents:{agSortIndicator:j4},icons:{sortAscending:"asc",sortDescending:"desc",sortUnSort:"none",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc"}},p3=class extends S{constructor(){super(...arguments);this.beanName="syncSvc",this.waitingForColumns=!1}postConstruct(){this.addManagedPropertyListener("columnDefs",($)=>this.setColumnDefs($))}start(){this.beans.ctrlsSvc.whenReady(this,()=>{let $=this.gos.get("columnDefs");if($)this.setColumnsAndData($);else this.waitingForColumns=!0;this.gridReady()})}setColumnsAndData($){let{colModel:z,rowModel:Q}=this.beans;z.setColumnDefs($??[],"gridInitializing"),Q.start()}gridReady(){let{eventSvc:$,gos:z}=this;$.dispatchEvent({type:"gridReady"}),dQ(z,`initialised successfully, enterprise = ${z.isModuleRegistered("EnterpriseCore")}`)}setColumnDefs($){let z=this.gos.get("columnDefs");if(!z)return;if(this.waitingForColumns){this.waitingForColumns=!1,this.setColumnsAndData(z);return}this.beans.colModel.setColumnDefs(z,Xz($.source))}};var i3="paste",n3=class extends S{constructor(){super(...arguments);this.beanName="changeDetectionSvc",this.deferredDepth=0,this.batchedPath=null,this.batchedNodes=null}destroy(){super.destroy(),this.batchedPath=null,this.batchedNodes=null}postConstruct(){this.csrm=o2(this.beans),this.addManagedEventListeners({cellValueChanged:this.onCellValueChanged.bind(this)})}beginDeferred(){this.deferredDepth++}endDeferred(){if(this.deferredDepth===0)return;if(--this.deferredDepth>0)return;let $=this.batchedPath,z=this.batchedNodes;if(this.batchedPath=null,this.batchedNodes=null,$)this.csrm?.doAggregate($);let{rowRenderer:Q}=this.beans;if(z)for(let J of z)J6(Q,J);if($){let J=$.getSortedRows();for(let Z=0,X=J.length;Z{let{sibling:Q,pinnedSibling:J}=z;$.refreshRowByNode(z),$.refreshRowByNode(Q),$.refreshRowByNode(J),$.refreshRowByNode(Q?.pinnedSibling),$.refreshRowByNode(J?.sibling)},d3=class extends S{constructor(){super(...arguments);this.beanName="expressionSvc",this.cache={}}evaluate($,z){if(typeof $==="string")return this.evaluateExpression($,z);else e(15,{expression:$})}evaluateExpression($,z){try{return this.createExpressionFunction($)(z.value,z.context,z.oldValue,z.newValue,z.value,z.node,z.data,z.colDef,z.rowIndex,z.api,z.getValue,z.column,z.columnGroup)}catch(Q){return e(16,{expression:$,params:z,e:Q}),null}}createExpressionFunction($){let z=this.cache;if(z[$])return z[$];let Q=this.createFunctionBody($),J=Function("x, ctx, oldValue, newValue, value, node, data, colDef, rowIndex, api, getValue, column, columnGroup",Q);return z[$]=J,J}createFunctionBody($){if($.includes("return"))return $;else return"return "+$+";"}};var t3={moduleName:"Expression",version:p,beans:[d3]},s3={moduleName:"ChangeDetection",version:p,beans:[n3]};var r3=class extends S{constructor(){super(...arguments);this.beanName="valueSvc",this.initialised=!1,this.isSsrm=!1}wireBeans($){this.expressionSvc=$.expressionSvc,this.colModel=$.colModel,this.valueCache=$.valueCache,this.dataTypeSvc=$.dataTypeSvc,this.editSvc=$.editSvc,this.formulaDataSvc=$.formulaDataSvc,this.rowGroupColsSvc=$.rowGroupColsSvc}postConstruct(){if(!this.initialised)this.init()}init(){let{gos:$,valueCache:z}=this;this.executeValueGetter=z?this.executeValueGetterWithValueCache.bind(this):this.executeValueGetterWithoutValueCache.bind(this),this.isSsrm=_z($),this.cellExpressions=$.get("enableCellExpressions"),this.isTreeData=$.get("treeData"),this.initialised=!0;let Q=(J)=>this.callColumnCellValueChangedHandler(J);this.eventSvc.addListener("cellValueChanged",Q,!0),this.addDestroyFunc(()=>this.eventSvc.removeListener("cellValueChanged",Q,!0)),this.addManagedPropertyListener("treeData",(J)=>this.isTreeData=J.currentValue)}getValueForDisplay($){let z=this.beans,Q=$.column,J=$.node,Z=z.showRowGroupColValueSvc,X=!Q&&J.group,Y=Q?.colDef.showRowGroup,q=!this.isTreeData||J.footer;if(Z&&q&&(X||Y)){let W=Z.getGroupValue(J,Q,this.displayIgnoresAggData(J));if(W==null)return{value:null,valueFormatted:null};return{value:W.value,valueFormatted:$.includeValueFormatted?Z.formatAndPrefixGroupColValue(W,Q,$.exporting):null}}if(!Q)return{value:J.key,valueFormatted:null};let G=this.getValue(Q,J,$.from,this.displayIgnoresAggData(J)),_=G,H=z.formula;if(Q.isAllowFormula()&&H?.isFormula(G))if($.useRawFormula)G=H.normaliseFormula(G,!0),_=H.resolveValue(Q,J);else G=H.resolveValue(Q,J),_=G;let U=$.includeValueFormatted&&!($.exporting&&Q.colDef.useValueFormatterForExport===!1);return{value:G,valueFormatted:U?this.formatValue(Q,J,_):null}}getValue($,z,Q,J=!1){if(!this.initialised)this.init();if(!z)return;let Z=$.colDef,X=z.group;if(!X){let G=Z.pivotValueColumn;if(G)$=G}let Y=this.editSvc?.getPendingEditValue(z,$,Q);if(Y!==void 0)return Y;let q=this.resolveValue($,z,J,X);if(q===void 0){if(X){let G=Z.showRowGroup;if(typeof G==="string"){let _=this.rowGroupColsSvc?.getColumnIndex(G);if(_!=null&&_>z.level)return null}}return}if(this.cellExpressions&&o1(q)){let G=q.substring(1);q=this.executeValueGetter(G,z.data,$,z)}return q}displayIgnoresAggData($){if(!$.group||$.footer||$.level===-1)return!1;if(!$.sibling||this.gos.get("groupSuppressBlankHeader"))return!1;if($.leafGroup&&this.colModel.isPivotMode())return!1;return!!$.expanded}resolveValue($,z,Q,J){let{colDef:Z,colId:X}=$,Y=!J&&this.formulaDataSvc;if(Y&&Y.hasDataSource()&&Z.allowFormula===!0){let F=Y.getFormula({column:$,rowNode:z});if(o1(F))return F}let q=J&&!Q?z.aggData:void 0,G=this.isTreeData;if(G&&q?.[X]!==void 0)return q[X];let _=z.data,H=Z.field,U=Z.valueGetter;if(G){if(U)return this.executeValueGetter(U,_,$,z);if(H&&_)return hQ(_,H,$.isFieldContainsDots())}let W=z.groupData;if(W&&X in W)return W[X];if(q?.[X]!==void 0)return q[X];let B=Z.showRowGroup,E=typeof B!=="string"||!J,K=this.isSsrm,L=K&&Q&&!!Z.aggFunc;if(U&&!L)return E?this.executeValueGetter(U,_,$,z):void 0;if(K&&z.footer&&z.field&&(B===!0||B===z.field))return hQ(_,z.field,$.isFieldContainsDots());if(H&&_&&!L)return E?hQ(_,H,$.isFieldContainsDots()):void 0;return}parseValue($,z,Q,J){let Z=$.getColDef();if(Z.allowFormula&&this.beans.formula?.isFormula(Q))return Q;let X=Z.valueParser;if(T(X)){let Y=y(this.gos,{node:z,data:z?.data,oldValue:J,newValue:Q,colDef:Z,column:$});if(typeof X==="function")return X(Y);return this.expressionSvc?.evaluate(X,Y)}return Q}getDeleteValue($,z){if(T($.getColDef().valueParser))return this.parseValue($,z,"",this.getValueForDisplay({column:$,node:z,from:"edit"}).value)??null;return null}formatValue($,z,Q,J,Z=!0){let{expressionSvc:X}=this.beans,Y=null,q,G=$.getColDef();if(J)q=J;else if(Z)q=G.valueFormatter;if(q){let _=z?z.data:null,H=y(this.gos,{value:Q,node:z,data:_,colDef:G,column:$});if(typeof q==="function")Y=q(H);else Y=X?X.evaluate(q,H):null}else if(G.refData)return G.refData[Q]||"";if(Y==null&&Array.isArray(Q))Y=Q.join(", ");return Y}setValue($,z,Q,J){let Z=z.getColDef();if(!$.data&&this.canCreateRowNodeData($,Z))$.data={};if(!this.isSetValueSupported(z,$,Q,Z))return!1;let X=this.getValue(z,$,"data"),Y=y(this.gos,{node:$,data:$.data,oldValue:X,newValue:Q,colDef:Z,column:z}),q=!1;if($.data){let _=this.handleExternalFormulaChange({column:z,eventSource:J,newValue:Q,setterParams:Y,rowNode:$});if(_!==null)return _;q=this.computeValueChange({column:z,rowNode:$,newValue:Q,params:Y,rowData:$.data,valueSetter:Z.valueSetter,field:Z.field})??!0}let G=this.beans.changeDetectionSvc;G?.beginDeferred();try{if($.group){let _=this.beans.rowGroupingEditValueSvc?.setGroupDataValue($,z,Q,X,J,q||Q!==X);if(_!==void 0){if(!q&&!_)return!1;return this.finishValueChange($,z,Y,J,Q)}}if(!q)return!1;return this.finishValueChange($,z,Y,J)}finally{G?.endDeferred()}}canCreateRowNodeData($,z){if(!$.group)return!0;if(z.groupRowValueSetter!=null||z.groupRowEditable!=null)return!1;if(z.pivotValueColumn)return!1;return!0}finishValueChange($,z,Q,J,Z){$.resetQuickFilterAggregateText(),this.valueCache?.onDataChanged();let X=Z===void 0?this.getValue(z,$,"data"):Z;if(this.dispatchCellValueChangedEvent($,Q,X,J),$.pinnedSibling)this.dispatchCellValueChangedEvent($.pinnedSibling,Q,X,J);return!0}isSetValueSupported($,z,Q,J){let{field:Z,valueSetter:X}=J,Y=this.beans.formula,q=$.isAllowFormula()&&Y?.isFormula(Q),G=!!this.formulaDataSvc?.hasDataSource();if(n(Z)&&n(X)&&!(G&&q)){if(z.group&&(J.groupRowValueSetter||J.groupRowEditable))return!0;return j(17),!1}if(this.dataTypeSvc&&!this.dataTypeSvc.checkType($,Q))return j(135),!1;return!0}handleExternalFormulaChange($){let{column:z,rowNode:Q,newValue:J,eventSource:Z,setterParams:X}=$,Y=this.beans.formula,q=this.formulaDataSvc;if(!q?.hasDataSource()||!z.isAllowFormula())return null;let G=Y?.isFormula(J),_=q.getFormula({column:z,rowNode:Q});if(G){if(_===J)return!1;q.setFormula({column:z,rowNode:Q,formula:J});let U=Y?.resolveValue(z,Q),W=z.getColDef();if(T(W.valueSetter)||!n(W.field)){let B={...X,newValue:U};this.computeValueChange({column:z,rowNode:Q,newValue:U,params:B,rowData:Q.data,valueSetter:W.valueSetter,field:W.field})}return this.finishValueChange(Q,z,X,Z)}if(_!==void 0)q.setFormula({column:z,rowNode:Q,formula:void 0});return null}computeValueChange($){let{valueSetter:z,params:Q,rowData:J,field:Z,column:X,newValue:Y}=$;if(T(z)){if(typeof z==="function")return z(Q);return this.expressionSvc?.evaluate(z,Q)}return!!J&&this.setValueUsingField(J,Z,Y,X.isFieldContainsDots())}dispatchCellValueChangedEvent($,z,Q,J){this.eventSvc.dispatchEvent({type:"cellValueChanged",event:null,rowIndex:$.rowIndex,rowPinned:$.rowPinned,column:z.column,colDef:z.colDef,data:$.data,node:$,oldValue:z.oldValue,newValue:Q,newRawValue:z.newValue,value:Q,source:J})}callColumnCellValueChangedHandler($){let z=$.colDef.onCellValueChanged;if(typeof z==="function")this.beans.frameworkOverrides.wrapOutgoing(()=>{z($)})}setValueUsingField($,z,Q,J){if(!z)return!1;let Z=!1;if(!J){if(Z=$[z]===Q,!Z)$[z]=Q}else{let X=z.split("."),Y=$;while(X.length>0&&Y){let q=X.shift();if(X.length===0){if(Z=Y[q]===Q,!Z)Y[q]=Q}else Y=Y[q]}}return!Z}executeValueGetterWithValueCache($,z,Q,J){let Z=Q.getColId(),X=this.valueCache.getValue(J,Z);if(X!==void 0)return X;let Y=this.executeValueGetterWithoutValueCache($,z,Q,J);return this.valueCache.setValue(J,Z,Y),Y}executeValueGetterWithoutValueCache($,z,Q,J){let Z=y(this.gos,{data:z,node:J,column:Q,colDef:Q.getColDef(),getValue:(Y)=>this.getValueCallback(J,Y)}),X;if(typeof $==="function")X=$(Z);else X=this.expressionSvc?.evaluate($,Z);return X}getValueCallback($,z){let Q=this.colModel.getColDefCol(z);if(Q)return this.getValue(Q,$,"data");return null}getKeyForNode($,z){let Q=this.getValue($,z,"data"),J=$.getColDef().keyCreator,Z=Q;if(J){let X=y(this.gos,{value:Q,colDef:$.getColDef(),column:$,node:z,data:z.data});Z=J(X)}if(typeof Z==="string"||Z==null)return Z;if(Z=String(Z),Z==="[object Object]")j(121);return Z}},l3={moduleName:"CommunityCore",version:p,beans:[NB,RH,BW,HG,b3,TU,IB,ZE,yU,J3,Q3,x3,r3,xB,TB,wB,KW,p3,YW,qW,LE],icons:{selectOpen:"small-down",smallDown:"small-down",colorPicker:"color-picker",smallUp:"small-up",checkboxChecked:"small-up",checkboxIndeterminate:"checkbox-indeterminate",checkboxUnchecked:"checkbox-unchecked",radioButtonOn:"radio-button-on",radioButtonOff:"radio-button-off",smallLeft:"small-left",smallRight:"small-right"},apiFunctions:{getGridId:jH,destroy:fH,isDestroyed:OH,getGridOption:PH,setGridOption:TH,updateGridOptions:q8,isModuleRegistered:vH},dependsOn:[ZW,D1,EU,t8,WE,E4,BE,C3,s3,KE,iz,q3,H3,ME,HW,XW,t3,nU,B3]};function F2($){let{inputValue:z,allSuggestions:Q,hideIrrelevant:J,filterByPercentageOfBestMatch:Z}=$,X=(Q??[]).map((G,_)=>({value:G,relevance:a3(z,G),idx:_}));if(X.sort((G,_)=>G.relevance-_.relevance),J)X=X.filter((G)=>G.relevance0&&Z&&Z>0){let _=X[0].relevance*Z;X=X.filter((H)=>_-H.relevance<0)}let Y=[],q=[];for(let G of X)Y.push(G.value),q.push(G.idx);return{values:Y,indices:q}}function a3($,z){let Q=$.length,J=z.length;if(J===0)return Q?Q:0;let Z=$.toLocaleLowerCase(),X=z.toLocaleLowerCase(),Y;if($.length1&&E>1){let D=$[U-2],F=Z[U-2],M=z[E-2],k=X[E-2];if(F===k){if(_++,D===M)_++}}if(U`No AG Grid modules are registered! It is recommended to start with all Community features via the AllCommunityModule: + + import { ModuleRegistry, AllCommunityModule } from 'ag-grid-community'; + + ModuleRegistry.registerModules([ AllCommunityModule ]); + `,zK=($)=>{let z=$.map((J)=>`import { ${mQ(J)} } from '${s8[J]?"ag-grid-enterprise":"ag-grid-community"}';`);if($.some((J)=>J==="IntegratedCharts"||J==="Sparklines"))z.push("import { AgChartsEnterpriseModule } from 'ag-charts-enterprise';");return`import { ModuleRegistry } from 'ag-grid-community'; +${z.join(` +`)} + +ModuleRegistry.registerModules([ ${$.map((J)=>mQ(J,!0)).join(", ")} ]); + +For more info see: ${_Q}/modules/`};function mQ($,z=!1){if(z&&($==="IntegratedCharts"||$==="Sparklines"))return`${$}Module.with(AgChartsEnterpriseModule)`;return`${$}Module`}function QK($,z){let Q=z.filter((X)=>X==="IntegratedCharts"||X==="Sparklines"),J="";if(!globalThis?.agCharts&&Q.length>0)J=`Unable to use ${$} as either the ag-charts-community or ag-charts-enterprise script needs to be included alongside ag-grid-enterprise. +`;else if(z.some((X)=>s8[X]))J=J+`Unable to use ${$} as that requires the ag-grid-enterprise script to be included. +`;return J}function l8({moduleName:$,rowModelType:z}){return`To use the ${$}Module you must set the gridOption "rowModelType='${z}'"`}var Z6=({reasonOrId:$,moduleName:z,gridScoped:Q,gridId:J,rowModelType:Z,additionalText:X,isUmd:Y})=>{let q=$K(z,Z),G=typeof $==="string"?$:YK[$];if(Y)return QK(G,q);let _=q.filter((W)=>W==="IntegratedCharts"||W==="Sparklines"),H=_.length>0?`${_.map((W)=>mQ(W)).join()} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'.`:"";return`${`Unable to use ${G} as ${q.length>1?"one of "+q.map((W)=>mQ(W)).join(", "):mQ(q[0])} is not registered${Q?" for gridId: "+J:""}. ${H} Check if you have registered the module: +`} +${zK(q)}`+(X?` + +${X}`:"")},X6=($)=>{return`${$} must be initialised with an AG Charts module. One of 'AgChartsCommunityModule' / 'AgChartsEnterpriseModule'. + +import { AgChartsEnterpriseModule } from 'ag-charts-enterprise'; +import { ModuleRegistry } from 'ag-grid-community'; +import { ${$} } from 'ag-grid-enterprise'; + +ModuleRegistry.registerModules([${$}.with(AgChartsEnterpriseModule)]); + `},JK=($)=>`AG Grid: Unable to use the Clipboard API (navigator.clipboard.${$}()). The reason why it could not be used has been logged in the previous line. For this reason the grid has defaulted to using a workaround which doesn't perform as well. Either fix why Clipboard API is blocked, OR stop this message from appearing by setting grid property suppressClipboardApi=true (which will default the grid to using the workaround rather than the API.`,ZK={1:()=>"`rowData` must be an array",2:({nodeId:$})=>`Duplicate node id '${$}' detected from getRowId callback, this could cause issues in your grid.`,3:()=>"Calling gridApi.resetRowHeights() makes no sense when using Auto Row Height.",4:({id:$})=>`Could not find row id=${$}, data item was not found for this id`,5:({data:$})=>["Could not find data item as object was not found.",$," Consider using getRowId to help the Grid find matching row data"],6:()=>"'groupHideOpenParents' only works when specifying specific columns for 'colDef.showRowGroup'",7:()=>"Pivoting is not supported with aligned grids as it may produce different columns in each grid.",8:({key:$})=>`Unknown key for navigation ${$}`,9:({variable:$})=>`No value for ${$?.cssName}. This usually means that the grid has been initialised before styles have been loaded. The default value of ${$?.defaultValue} will be used and updated when styles load.`,10:({eventType:$})=>`As of v33, the '${$}' event is deprecated. Use the global 'modelUpdated' event to determine when row children have changed.`,11:()=>"No gridOptions provided to createGrid",12:({colKey:$})=>["column ",$," not found"],13:()=>"Could not find rowIndex, this means tasks are being executed on a rowNode that has been removed from the grid.",14:({groupPrefix:$})=>`Row IDs cannot start with ${$}, this is a reserved prefix for AG Grid's row grouping feature.`,15:({expression:$})=>["value should be either a string or a function",$],16:({expression:$,params:z,e:Q})=>["Processing of the expression failed","Expression = ",$,"Params = ",z,"Exception = ",Q],17:()=>"you need either field or valueSetter set on colDef for editing to work",18:()=>"alignedGrids contains an undefined option.",19:()=>"alignedGrids - No api found on the linked grid.",20:()=>`You may want to configure via a callback to avoid setup race conditions: + "alignedGrids: () => [linkedGrid]"`,21:()=>"pivoting is not supported with aligned grids. You can only use one of these features at a time in a grid.",22:({key:$})=>`${$} is an initial property and cannot be updated.`,23:()=>"The return of `getRowHeight` cannot be zero. If the intention is to hide rows, use a filter instead.",24:()=>"row height must be a number if not using standard row model",25:({id:$})=>["The getRowId callback must return a string. The ID ",$," is being cast to a string."],26:({fnName:$,preDestroyLink:z})=>{return`Grid API function ${$}() cannot be called as the grid has been destroyed. + Either clear local references to the grid api, when it is destroyed, or check gridApi.isDestroyed() to avoid calling methods against a destroyed grid. + To run logic when the grid is about to be destroyed use the gridPreDestroy event. See: ${z}`},27:({fnName:$,module:z})=>`API function '${$}' not registered to module '${z}'`,28:()=>"setRowCount cannot be used while using row grouping.",29:()=>"tried to call sizeColumnsToFit() but the grid is coming back with zero width, maybe the grid is not visible yet on the screen?",30:({toIndex:$})=>["tried to insert columns in invalid location, toIndex = ",$,"remember that you should not count the moving columns when calculating the new index"],31:()=>"infinite loop in resizeColumnSets",32:()=>"applyColumnState() - the state attribute should be an array, however an array was not found. Please provide an array of items (one for each col you want to change) for state.",33:()=>"stateItem.aggFunc must be a string. if using your own aggregation functions, register the functions first before using them in get/set state. This is because it is intended for the column state to be stored and retrieved as simple JSON.",34:({key:$})=>`the column type '${$}' is a default column type and cannot be overridden.`,35:()=>"Column type definitions 'columnTypes' with a 'type' attribute are not supported because a column type cannot refer to another column type. Only column definitions 'columnDefs' can use the 'type' attribute to refer to a column type.",36:({t:$})=>"colDef.type '"+$+"' does not correspond to defined gridOptions.columnTypes",37:()=>"Changing the column pinning status is not allowed with domLayout='print'",38:({iconName:$})=>`provided icon '${$}' needs to be a string or a function`,39:()=>"Applying column order broke a group where columns should be married together. Applying new order has been discarded.",40:({e:$,method:z})=>`${$} +${JK(z)}`,41:()=>"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.",42:()=>"Browser does not support document.execCommand('copy') for clipboard operations",43:({iconName:$})=>`As of v33, icon '${$}' is deprecated. Use the icon CSS name instead.`,44:()=>'Data type definition hierarchies (via the "extendsDataType" property) cannot contain circular references.',45:({parentCellDataType:$})=>`The data type definition ${$} does not exist.`,46:()=>'The "baseDataType" property of a data type definition must match that of its parent.',47:({cellDataType:$})=>`Missing data type definition - "${$}"`,48:({property:$,inferred:z,colId:Q})=>{let J=z?" (inferred)":"",Z=Q?` for column "${Q}"`:"";return`Cell data type is "object"${J} but no Value ${$} has been provided${Z}. Please either provide an object data type definition with a Value ${$}, or set: + - "colDef.value${$}"${z&&$==="Parser"?` + - "colDef.cellDataType = 'object'"`:""}`},49:({methodName:$})=>`Framework component is missing the method ${$}()`,50:({compName:$})=>`Could not find component ${$}, did you forget to configure this component?`,51:()=>"Export cancelled. Export is not allowed as per your configuration.",52:()=>"There is no `window` associated with the current `document`",53:()=>"unknown value type during csv conversion",54:()=>"Could not find document body, it is needed for drag and drop and context menu.",55:()=>"addRowDropZone - A container target needs to be provided",56:()=>"addRowDropZone - target already exists in the list of DropZones. Use `removeRowDropZone` before adding it again.",57:()=>"unable to show popup filter, filter instantiation failed",58:()=>"no values found for select cellEditor",59:()=>"cannot select pinned rows",60:()=>"cannot select node until it has finished loading",61:()=>"since version v32.2.0, rowNode.isFullWidthCell() has been deprecated. Instead check `rowNode.detail` followed by the user provided `isFullWidthRow` grid option.",62:({colId:$})=>`setFilterModel() - no column found for colId: ${$}`,63:({colId:$})=>`setFilterModel() - unable to fully apply model, filtering disabled for colId: ${$}`,64:({colId:$})=>`setFilterModel() - unable to fully apply model, unable to create filter for colId: ${$}`,65:()=>"filter missing setModel method, which is needed for setFilterModel",66:()=>"filter API missing getModel method, which is needed for getFilterModel",67:()=>"Filter is missing isFilterActive() method",68:()=>"Column Filter API methods have been disabled as Advanced Filters are enabled.",69:({guiFromFilter:$})=>`getGui method from filter returned ${$}; it should be a DOM element.`,70:({newFilter:$})=>`Grid option quickFilterText only supports string inputs, received: ${typeof $}`,71:()=>"debounceMs is ignored when apply button is present",72:({keys:$})=>["ignoring FilterOptionDef as it doesn't contain one of ",$],73:()=>"invalid FilterOptionDef supplied as it doesn't contain a 'displayKey'",74:()=>"no filter options for filter",75:()=>"Unknown button type specified",76:({filterModelType:$})=>['Unexpected type of filter "',$,'", it looks like the filter was configured with incorrect Filter Options'],77:()=>"Filter model is missing 'conditions'",78:()=>'Filter Model contains more conditions than "filterParams.maxNumConditions". Additional conditions have been ignored.',79:()=>'"filterParams.maxNumConditions" must be greater than or equal to zero.',80:()=>'"filterParams.numAlwaysVisibleConditions" must be greater than or equal to zero.',81:()=>'"filterParams.numAlwaysVisibleConditions" cannot be greater than "filterParams.maxNumConditions".',82:({param:$})=>`DateFilter ${$} is not a number`,83:()=>"DateFilter minValidYear should be <= maxValidYear",84:()=>"DateFilter minValidDate should be <= maxValidDate",85:()=>"DateFilter should not have both minValidDate and minValidYear parameters set at the same time! minValidYear will be ignored.",86:()=>"DateFilter should not have both maxValidDate and maxValidYear parameters set at the same time! maxValidYear will be ignored.",87:()=>"DateFilter parameter minValidDate should always be lower than or equal to parameter maxValidDate.",88:({index:$})=>`Invalid row index for ensureIndexVisible: ${$}`,89:()=>"A template was provided for Header Group Comp - templates are only supported for Header Comps (not groups)",90:()=>"datasource is missing getRows method",91:()=>"Filter is missing method doesFilterPass",92:()=>"AnimationFrameService called but animation frames are off",93:()=>"cannot add multiple ranges when `cellSelection.suppressMultiRanges = true`",94:({paginationPageSizeOption:$,pageSizeSet:z,pageSizesSet:Q,pageSizeOptions:J})=>`'paginationPageSize=${$}'${z?"":" (default value)"}, but ${$} is not included in${Q?"":" the default"} paginationPageSizeSelector=[${J?.join(", ")}].`,95:({paginationPageSizeOption:$,paginationPageSizeSelector:z})=>`Either set '${z}' to an array that includes ${$} or to 'false' to disable the page size selector.`,96:({id:$,data:z})=>["Duplicate ID",$,"found for pinned row with data",z,"When `getRowId` is defined, it must return unique IDs for all pinned rows. Use the `rowPinned` parameter."],97:({colId:$})=>`cellEditor for column ${$} is missing getGui() method`,98:()=>"popup cellEditor does not work with fullRowEdit - you cannot use them both - either turn off fullRowEdit, or stop using popup editors.",99:()=>"Since v32, `api.hideOverlay()` does not hide the loading overlay when `loading=true`. Set `loading=false` instead.",101:({propertyName:$,componentName:z,agGridDefaults:Q,jsComps:J})=>{let Z=[],X=[...Object.keys(Q??[]).filter((q)=>!["agCellEditor","agGroupRowRenderer","agSortIndicator"].includes(q)),...Object.keys(J??[]).filter((q)=>!!J[q])],Y=F2({inputValue:z,allSuggestions:X,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;if(Z.push(`Could not find '${z}' component. It was configured as "${$}: '${z}'" but it wasn't found in the list of registered components. +`),Y.length>0)Z.push(` Did you mean: [${Y.slice(0,3)}]? +`);return Z.push("If using a custom component check it has been registered correctly."),Z},102:()=>"selectAll: 'filtered' only works when gridOptions.rowModelType='clientSide'",103:()=>"Invalid selection state. When using client-side row model, the state must conform to `string[]`.",104:({value:$,param:z})=>`Numeric value ${$} passed to ${z} param will be interpreted as ${$} seconds. If this is intentional use "${$}s" to silence this warning.`,105:({e:$})=>["chart rendering failed",$],106:()=>`Theming API and Legacy Themes are both used in the same page. A Theming API theme has been provided to the 'theme' grid option, but the file (ag-grid.css) is also included and will cause styling issues. Remove ag-grid.css from the page. See the migration guide: ${_Q}/theming-migration/`,107:({key:$,value:z})=>`Invalid value for theme param ${$} - ${z}`,108:({e:$})=>["chart update failed",$],109:({inputValue:$,allSuggestions:z})=>{let Q=F2({inputValue:$,allSuggestions:z,hideIrrelevant:!0,filterByPercentageOfBestMatch:0.8}).values;return[`Could not find '${$}' aggregate function. It was configured as "aggFunc: '${$}'" but it wasn't found in the list of registered aggregations.`,Q.length>0?` Did you mean: [${Q.slice(0,3)}]?`:"","If using a custom aggregation function check it has been registered correctly."].join(` +`)},110:()=>"groupHideOpenParents only works when specifying specific columns for colDef.showRowGroup",111:()=>"Invalid selection state. When `groupSelects` is enabled, the state must conform to `IServerSideGroupSelectionState`.",113:()=>"Set Filter cannot initialise because you are using a row model that does not contain all rows in the browser. Either use a different filter type, or configure Set Filter such that you provide it with values",114:({component:$})=>`Could not find component with name of ${$}. Is it in Vue.components?`,116:()=>"Invalid selection state. The state must conform to `IServerSideSelectionState`.",117:()=>"selectAll must be of boolean type.",118:()=>"Infinite scrolling must be enabled in order to set the row count.",119:()=>"Unable to instantiate filter",120:()=>"MultiFloatingFilterComp expects MultiFilter as its parent",121:()=>"a column you are grouping or pivoting by has objects as values. If you want to group by complex objects then either a) use a colDef.keyCreator (see AG Grid docs) or b) to toString() on the object to return a key",122:()=>"could not find the document, document is empty",123:()=>"Advanced Filter is only supported with the Client-Side Row Model or Server-Side Row Model.",124:()=>"No active charts to update.",125:({chartId:$})=>`Unable to update chart. No active chart found with ID: ${$}.`,126:()=>"unable to restore chart as no chart model is provided",127:({allRange:$})=>`unable to create chart as ${$?"there are no columns in the grid":"no range is selected"}.`,128:({feature:$})=>`${$} is only available if using 'multiRow' selection mode.`,129:({feature:$,rowModel:z})=>`${$} is only available if using 'clientSide' or 'serverSide' rowModelType, you are using ${z}.`,130:()=>'cannot multi select unless selection mode is "multiRow"',132:()=>"Row selection features are not available unless `rowSelection` is enabled.",133:({iconName:$})=>`icon '${$}' function should return back a string or a dom object`,134:({iconName:$})=>`Did not find icon '${$}'`,135:()=>"Data type of the new value does not match the cell data type of the column",136:()=>"Unable to update chart as the 'type' is missing. It must be either 'rangeChartUpdate', 'pivotChartUpdate', or 'crossFilterChartUpdate'.",137:({type:$,currentChartType:z})=>`Unable to update chart as a '${$}' update type is not permitted on a ${z}.`,138:({chartType:$})=>`invalid chart type supplied: ${$}`,139:({customThemeName:$})=>`a custom chart theme with the name ${$} has been supplied but not added to the 'chartThemes' list`,140:({name:$})=>`no stock theme exists with the name '${$}' and no custom chart theme with that name was supplied to 'customChartThemes'`,141:()=>"cross filtering with row grouping is not supported.",142:()=>"cross filtering is only supported in the client side row model.",143:({panel:$})=>`'${$}' is not a valid Chart Tool Panel name`,144:({type:$})=>`Invalid charts data panel group name supplied: '${$}'`,145:({group:$})=>`As of v32, only one charts customize panel group can be expanded at a time. '${$}' will not be expanded.`,146:({comp:$})=>`Unable to instantiate component '${$}' as its module hasn't been loaded. Add 'ValidationModule' to see which module is required.`,147:({group:$})=>`Invalid charts customize panel group name supplied: '${$}'`,148:({group:$})=>`invalid chartGroupsDef config '${$}'`,149:({group:$,chartType:z})=>`invalid chartGroupsDef config '${$}.${z}'`,150:()=>"'seriesChartTypes' are required when the 'customCombo' chart type is specified.",151:({chartType:$})=>`invalid chartType '${$}' supplied in 'seriesChartTypes', converting to 'line' instead.`,152:({colId:$})=>`no 'seriesChartType' found for colId = '${$}', defaulting to 'line'.`,153:({chartDataType:$})=>`unexpected chartDataType value '${$}' supplied, instead use 'category', 'series' or 'excluded'`,154:({colId:$})=>`cross filtering requires a 'agSetColumnFilter' or 'agMultiColumnFilter' to be defined on the column with id: ${$}`,155:({option:$})=>`'${$}' is not a valid Chart Toolbar Option`,156:({panel:$})=>`Invalid panel in chartToolPanelsDef.panels: '${$}'`,157:({unrecognisedGroupIds:$})=>["unable to find group(s) for supplied groupIds:",$],158:()=>"can not expand a column item that does not represent a column group header",159:()=>"Invalid params supplied to createExcelFileForExcel() - `ExcelExportParams.data` is empty.",160:()=>"Export cancelled. Export is not allowed as per your configuration.",161:()=>"The Excel Exporter is currently on Multi Sheet mode. End that operation by calling 'api.getMultipleSheetAsExcel()' or 'api.exportMultipleSheetsAsExcel()'",162:({id:$,dataType:z})=>`Unrecognized data type for excel export [${$}.dataType=${z}]`,163:({featureName:$})=>`Excel table export does not work with ${$}. The exported Excel file will not contain any Excel tables. + Please turn off ${$} to enable Excel table exports.`,164:()=>"Unable to add data table to Excel sheet: A table already exists.",165:()=>"Unable to add data table to Excel sheet: Missing required parameters.",166:({unrecognisedGroupIds:$})=>["unable to find groups for these supplied groupIds:",$],167:({unrecognisedColIds:$})=>["unable to find columns for these supplied colIds:",$],168:()=>"detailCellRendererParams.template should be function or string",169:()=>'Reference to eDetailGrid was missing from the details template. Please add data-ref="eDetailGrid" to the template.',170:({providedStrategy:$})=>`invalid cellRendererParams.refreshStrategy = ${$} supplied, defaulting to refreshStrategy = 'rows'.`,171:()=>"could not find detail grid options for master detail, please set gridOptions.detailCellRendererParams.detailGridOptions",172:()=>"could not find getDetailRowData for master / detail, please set gridOptions.detailCellRendererParams.getDetailRowData",173:({group:$})=>`invalid chartGroupsDef config '${$}'`,174:({group:$,chartType:z})=>`invalid chartGroupsDef config '${$}.${z}'`,175:({menuTabName:$,itemsToConsider:z})=>[`Trying to render an invalid menu item '${$}'. Check that your 'menuTabs' contains one of `,z],176:({key:$})=>`unknown menu item type ${$}`,177:()=>"valid values for cellSelection.handle.direction are 'x', 'y' and 'xy'. Default to 'xy'.",178:({colId:$})=>`column ${$} is not visible`,179:()=>"totalValueGetter should be either a function or a string (expression)",180:()=>"agRichSelectCellEditor requires cellEditorParams.values to be set",181:()=>"agRichSelectCellEditor cannot have `multiSelect` and `allowTyping` set to `true`. AllowTyping has been turned off.",182:()=>'you cannot mix groupDisplayType = "multipleColumns" with treeData, only one column can be used to display groups when doing tree data',183:()=>"Group Column Filter only works on group columns. Please use a different filter.",184:({parentGroupData:$,childNodeData:z})=>["duplicate group keys for row data, keys should be unique",[$,z]],185:({data:$})=>["getDataPath() should not return an empty path",[$]],186:({rowId:$,rowData:z,duplicateRowsData:Q})=>["duplicate group keys for row data, keys should be unique",$,z,...Q??[]],187:({rowId:$,firstData:z,secondData:Q})=>[`Duplicate node id ${$}. Row IDs are provided via the getRowId() callback. Please modify the getRowId() callback code to provide unique row id values.`,"first instance",z,"second instance",Q],188:($)=>`getRowId callback must be provided for Server Side Row Model ${$?.feature||"selection"} to work correctly.`,189:({startRow:$})=>`invalid value ${$} for startRow, the value should be >= 0`,190:({rowGroupId:$,data:z})=>["null and undefined values are not allowed for server side row model keys",$?`column = ${$}`:"","data is ",z],194:({method:$})=>`calling gridApi.${$}() is only possible when using rowModelType=\`clientSide\`.`,195:({justCurrentPage:$})=>`selecting just ${$?"current page":"filtered"} only works when gridOptions.rowModelType='clientSide'`,196:({key:$})=>`Provided ids must be of string type. Invalid id provided: ${$}`,197:()=>"`toggledNodes` must be an array of string ids.",199:()=>"getSelectedNodes and getSelectedRows functions cannot be used with select all functionality with the server-side row model. Use `api.getServerSideSelectionState()` instead.",200:Z6,201:({rowModelType:$})=>`Could not find row model for rowModelType = ${$}`,202:()=>"`getSelectedNodes` and `getSelectedRows` functions cannot be used with `groupSelectsChildren` and the server-side row model. Use `api.getServerSideSelectionState()` instead.",203:()=>"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.",204:()=>"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.",205:({duplicateIdText:$})=>`Unable to display rows as duplicate row ids (${$}) were returned by the getRowId callback. Please modify the getRowId callback to provide unique ids.`,206:()=>"getRowId callback must be implemented for transactions to work. Transaction was ignored.",207:()=>'The Set Filter Parameter "defaultToNothingSelected" value was ignored because it does not work when "excelMode" is used.',208:()=>"Set Filter Value Formatter must return string values. Please ensure the Set Filter Value Formatter returns string values for complex objects.",209:()=>`Set Filter Key Creator is returning null for provided values and provided values are primitives. Please provide complex objects. See ${_Q}/filter-set-filter-list/#filter-value-types`,210:()=>"Set Filter has a Key Creator, but provided values are primitives. Did you mean to provide complex objects?",211:()=>"property treeList=true for Set Filter params, but you did not provide a treeListPathGetter or values of type Date.",212:()=>"please review all your toolPanel components, it seems like at least one of them doesn't have an id",213:()=>"Advanced Filter does not work with Filters Tool Panel. Filters Tool Panel has been disabled.",214:({key:$})=>`unable to lookup Tool Panel as invalid key supplied: ${$}`,215:({key:$,defaultByKey:z})=>`the key ${$} is not a valid key for specifying a tool panel, valid keys are: ${Object.keys(z??{}).join(",")}`,216:({name:$})=>`Missing component for '${$}'`,217:({invalidColIds:$})=>["unable to find grid columns for the supplied colDef(s):",$],218:({property:$,defaultOffset:z})=>`${$} must be a number, the value you provided is not a valid number. Using the default of ${z}px.`,219:({property:$})=>`Property ${$} does not exist on the target object.`,220:({lineDash:$})=>`'${$}' is not a valid 'lineDash' option.`,221:()=>"agAggregationComponent should only be used with the client and server side row model.",222:()=>"agFilteredRowCountComponent should only be used with the client side row model.",223:()=>"agSelectedRowCountComponent should only be used with the client and server side row model.",224:()=>"agTotalAndFilteredRowCountComponent should only be used with the client side row model.",225:()=>"agTotalRowCountComponent should only be used with the client side row model.",226:()=>"viewport is missing init method.",227:()=>"menu item icon must be DOM node or string",228:({menuItemOrString:$})=>`unrecognised menu item ${$}`,230:()=>"detailCellRendererParams.template is not supported by AG Grid React. To change the template, provide a Custom Detail Cell Renderer. See https://www.ag-grid.com/react-data-grid/master-detail-custom-detail/",231:()=>"As of v32, using custom components with `reactiveCustomComponents = false` is deprecated.",232:()=>"Using both rowData and v-model. rowData will be ignored.",233:({methodName:$})=>`Framework component is missing the method ${$}()`,234:()=>'Group Column Filter does not work with the colDef property "field". This property will be ignored.',235:()=>'Group Column Filter does not work with the colDef property "filterValueGetter". This property will be ignored.',236:()=>'Group Column Filter does not work with the colDef property "filterParams". This property will be ignored.',237:()=>"Group Column Filter does not work with Tree Data enabled. Please disable Tree Data, or use a different filter.",238:()=>"setRowCount can only accept a positive row count.",239:()=>'Theming API and CSS File Themes are both used in the same page. In v33 we released the Theming API as the new default method of styling the grid. See the migration docs https://www.ag-grid.com/react-data-grid/theming-migration/. Because no value was provided to the `theme` grid option it defaulted to themeQuartz. But the file (ag-grid.css) is also included and will cause styling issues. Either pass the string "legacy" to the theme grid option to use v32 style themes, or remove ag-grid.css from the page to use Theming API.',240:({theme:$})=>`theme grid option must be a Theming API theme object or the string "legacy", received: ${$}`,243:()=>"Failed to deserialize state - each provided state object must be an object.",244:()=>"Failed to deserialize state - `selectAllChildren` must be a boolean value or undefined.",245:()=>"Failed to deserialize state - `toggledNodes` must be an array.",246:()=>"Failed to deserialize state - Every `toggledNode` requires an associated string id.",247:()=>`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. +Please rebuild the selection state and reapply it.`,248:()=>"SetFloatingFilter expects SetFilter as its parent",249:()=>"Must supply a Value Formatter in Set Filter params when using a Key Creator",250:()=>"Must supply a Key Creator in Set Filter params when `treeList = true` on a group column, and Tree Data or Row Grouping is enabled.",251:({chartType:$})=>`AG Grid: Unable to create chart as an invalid chartType = '${$}' was supplied.`,252:()=>`cannot get grid to draw rows when it is in the middle of drawing rows. +Your code probably called a grid API method while the grid was in the render stage. +To overcome this, put the API call into a timeout, e.g. instead of api.redrawRows(), call setTimeout(function() { api.redrawRows(); }, 0). +To see what part of your code that caused the refresh check this stacktrace.`,253:({version:$})=>["Illegal version string: ",$],254:()=>"Cannot create chart: no chart themes available.",255:({point:$})=>`Lone surrogate U+${$?.toString(16).toUpperCase()} is not a scalar value`,256:()=>"Unable to initialise. See validation error, or load ValidationModule if missing.",257:()=>X6("IntegratedChartsModule"),258:()=>X6("SparklinesModule"),259:({part:$})=>`the argument to theme.withPart must be a Theming API part object, received: ${$}`,260:({propName:$,compName:z,gridScoped:Q,gridId:J,rowModelType:Z})=>Z6({reasonOrId:`AG Grid '${$}' component: ${z}`,moduleName:BQ[z],gridId:J,gridScoped:Q,rowModelType:Z}),261:()=>"As of v33, `column.isHovered()` is deprecated. Use `api.isColumnHovered(column)` instead.",262:()=>'As of v33, icon key "smallDown" is deprecated. Use "advancedFilterBuilderSelect" for Advanced Filter Builder dropdown, "selectOpen" for Select cell editor and dropdowns (e.g. Integrated Charts menu), "richSelectOpen" for Rich Select cell editor.',263:()=>'As of v33, icon key "smallLeft" is deprecated. Use "panelDelimiterRtl" for Row Group Panel / Pivot Panel, "subMenuOpenRtl" for sub-menus.',264:()=>'As of v33, icon key "smallRight" is deprecated. Use "panelDelimiter" for Row Group Panel / Pivot Panel, "subMenuOpen" for sub-menus.',265:({colId:$})=>`Unable to infer chart data type for column '${$}' if first data entry is null. Please specify "chartDataType", or a "cellDataType" in the column definition. For more information, see ${_Q}/integrated-charts-range-chart#coldefchartdatatype .`,266:()=>'As of v33.1, using "keyCreator" with the Rich Select Editor has been deprecated. It now requires the "formatValue" callback to convert complex data to strings.',267:()=>"Detail grids can not use a different theme to the master grid, the `theme` detail grid option will be ignored.",268:()=>"Transactions aren't supported with tree data when using treeDataChildrenField",269:()=>"When `masterSelects: 'detail'`, detail grids must be configured with multi-row selection",270:({id:$,parentId:z})=>`Cycle detected for row with id='${$}' and parent id='${z}'. Resetting the parent for row with id='${$}' and showing it as a root-level node.`,271:({id:$,parentId:z})=>`Parent row not found for row with id='${$}' and parent id='${z}'. Showing row with id='${$}' as a root-level node.`,272:()=>r8(),273:({providedId:$,usedId:z})=>`Provided column id '${$}' was already in use, ensure all column and group ids are unique. Using '${z}' instead.`,274:({prop:$})=>{let z=`Since v33, ${$} has been deprecated.`;switch($){case"maxComponentCreationTimeMs":z+=" This property is no longer required and so will be removed in a future version.";break;case"setGridApi":z+=" This method is not called by AG Grid. To access the GridApi see: https://ag-grid.com/react-data-grid/grid-interface/#grid-api ";break;case"children":z+=" For multiple versions AgGridReact does not support children.";break}return z},275:l8,276:()=>"Row Numbers Row Resizer cannot be used when Grid Columns have `autoHeight` enabled.",277:({colId:$})=>`'enableFilterHandlers' is set to true, but column '${$}' does not have 'filter.doesFilterPass' or 'filter.handler' set.`,278:({colId:$})=>`Unable to create filter handler for column '${$}'`,279:($)=>{},280:({colId:$})=>`'name' must be provided for custom filter components for column '${$}`,281:({colId:$})=>`Filter for column '${$}' does not have 'filterParams.buttons', but the new Filters Tool Panel has buttons configured. Either configure buttons for the filter, or disable buttons on the Filters Tool Panel.`,282:()=>"New filter tool panel requires `enableFilterHandlers: true`.",283:()=>"As of v34, use the same method on the filter handler (`api.getColumnFilterHandler(colKey)`) instead.",284:()=>"As of v34, filters are active when they have a model. Use `api.getColumnFilterModel()` instead.",285:()=>"As of v34, use (`api.getColumnFilterModel()`) instead.",286:()=>"As of v34, use (`api.setColumnFilterModel()`) instead.",287:()=>"`api.doFilterAction()` requires `enableFilterHandlers = true",288:()=>"`api.getColumnFilterModel(key, true)` requires `enableFilterHandlers = true",289:({rowModelType:$})=>`Row Model '${$}' is not supported with Batch Editing`,290:({rowIndex:$,rowPinned:z})=>`Row with index '${$}' and pinned state '${z}' not found`,291:()=>"License Key being set multiple times with different values. This can result in an incorrect license key being used,",292:({colId:$})=>`The Multi Filter for column '${$}' has buttons configured against the child filters. When 'enableFilterHandlers=true', buttons must instead be provided against the parent Multi Filter params. The child filter buttons will be ignored.`,293:()=>"The grid was initialised detached from the DOM and was then inserted into a Shadow Root. Theme styles are probably broken. Pass the themeStyleContainer grid option to let the grid know where in the document to insert theme CSS.",294:()=>"When using the `agRichSelectCellEditor` setting `filterListAsync = true` requires `allowTyping = true` and the `values()` callback must return a Promise of filtered values.",295:({blockedService:$})=>`colDef.allowFormula is not supported with ${$}. Formulas has been turned off.`,296:()=>"Since v35, `api.hideOverlay()` does not hide the overlay when `activeOverlay` is set. Set `activeOverlay=null` instead.",297:()=>'`api.hideOverlay()` does not hide the no matching rows overlay as it is only controlled by grid state. Set `suppressOverlays=["noMatchingRows"] to not show it.',298:()=>"Columns Tool Panel 'buttons' requires 'apply' to enable Deferred Updates."};function XK($,z){let Q=ZK[$];if(!Q)return[`Missing error text for error id ${$}!`];let J=Q(z),X=` +See ${$7($,z)}`;return Array.isArray(J)?J.concat(X):[J,X]}var YK={1:"Charting Aggregation",2:"pivotResultFields",3:"setTooltip"},qK=class{constructor($="javascript"){this.frameworkName=$,this.renderingEngine="vanilla",this.batchFrameworkComps=!1,this.wrapIncoming=(z)=>z(),this.wrapOutgoing=(z)=>z(),this.baseDocLink=`${n6}/${this.frameworkName}-data-grid`,Oq(this.baseDocLink)}frameworkComponent($){return null}isFrameworkComponent($){return!1}getDocLink($){return this.baseDocLink+($?"/"+$:"")}},Y6=new WeakMap,q6=new WeakMap;function M1($,z,Q){if(!z)return e(11),{};let J=Q,Z;if(!J?.setThemeOnGridDiv){let Y=J0({tag:"div"});Y.style.height="100%",$.appendChild(Y),$=Y,Z=()=>$.remove()}return new _K().create($,z,(Y)=>{let q=new AH($);Y.createBean(q)},void 0,Q,Z)}var GK=1,_K=class{create($,z,Q,J,Z,X){let Y=y2.applyGlobalGridOptions(z),q=Y.gridId??String(GK++),G=this.getRegisteredModules(Z,q,Y.rowModelType),_=this.createBeansList(Y.rowModelType,G,q),H=this.createProvidedBeans($,Y,Z);if(!_)return;let B=new $_({providedBeanInstances:H,beanClasses:_,id:q,beanInitComparator:J_,beanDestroyComparator:Z_,derivedBeans:[z_],destroyCallback:()=>{q6.delete(E),Y6.delete($),Aq(q),X?.()}});this.registerModuleFeatures(B,G),Q(B),B.getBean("syncSvc").start(),J?.(B);let E=B.getBean("gridApi");return Y6.set($,E),q6.set(E,$),E}getRegisteredModules($,z,Q){return tQ(l3,void 0,!0),$?.modules?.forEach((J)=>tQ(J,z)),Sq(z,G6(Q))}registerModuleFeatures($,z){let Q=$.getBean("registry"),J=$.getBean("apiFunctionSvc");for(let Z of z){Q.registerModule(Z);let X=Z.apiFunctions;if(X){let Y=Object.keys(X);for(let q of Y)J?.addFunction(q,X[q])}}}createProvidedBeans($,z,Q){let J=Q?Q.frameworkOverrides:null;if(n(J))J=new qK;let Z={gridOptions:z,eGridDiv:$,eRootDiv:$,globalListener:Q?Q.globalListener:null,globalSyncListener:Q?Q.globalSyncListener:null,frameworkOverrides:J,withinStudio:Q?.withinStudio};if(Q?.providedBeanInstances)Object.assign(Z,Q.providedBeanInstances);return Z}createBeansList($,z,Q){let J={clientSide:"ClientSideRowModel",infinite:"InfiniteRowModel",serverSide:"ServerSideRowModel",viewport:"ViewportRowModel"},Z=G6($),X=J[Z];if(!X){yQ(201,{rowModelType:Z},`Unknown rowModelType ${Z}.`);return}if(!jq()){yQ(272,void 0,r8());return}if(!$){let q=Object.entries(J).filter(([G,_])=>$2(_,Q,G));if(q.length==1){let[G,_]=q[0];if(G!==Z){let H={moduleName:_,rowModelType:G};yQ(275,H,l8(H));return}}}if(!$2(X,Q,Z)){let q=w2(),G=`rowModelType = '${Z}'`,_=q?`Unable to use ${G} as that requires the ag-grid-enterprise script to be included. +`:`Missing module ${X}Module for rowModelType ${Z}.`;yQ(200,{reasonOrId:G,moduleName:X,gridScoped:x2(),gridId:Q,rowModelType:Z,isUmd:q},_);return}let Y=new Set;for(let q of z)for(let G of q.beans??[])Y.add(G);return Array.from(Y)}};function G6($){return $??"clientSide"}function HK($,z,Q="auto"){$.frameworkOverrides.wrapIncoming(()=>$.ctrlsSvc.getScrollFeature().ensureColumnVisible(z,Q),"ensureVisible")}function UK($,z,Q){$.frameworkOverrides.wrapIncoming(()=>$.ctrlsSvc.getScrollFeature().ensureIndexVisible(z,Q),"ensureVisible")}var a8=($,z)=>{for(let Q=0,J=$.length;Q{if(Q!=null){let X=Q.getSortedRows();for(let Y=0,q=X.length;Y{let _=q.level+1;for(let H=0,U=G.length;H{if(!U&&U!==void 0){let M=D.sourceRowIndex;U=M<=W,W=M}if(D.data!==F){if(D.updateData(F),!Y.has(D))q.add(D);if(!D.selectable&&D.isSelected())_.push(D)}},K=(D,F,M)=>{for(let k=0,V=F.length;k0;if(L){let D=Q._leafs??(Q._leafs=[]);if(U===void 0)DK(D,G,X);else if(LK(D,G))X.reordered=!0}if(L||B||q.size)$.rowDataUpdated=!0,this.deselect(_)}deleteUnusedNodes($,{removals:z},Q,J){let Z=this.rootNode._leafs;for(let X=0,Y=Z.length;X0}updateRowData($,z,Q){if(this.dispatchRowDataUpdateStarted($.add),this.beans.groupStage?.getNestedDataGetter())return j(268),{remove:[],update:[],add:[]};let J=[],Z=J2(this.gos),X=this.executeRemove(Z,$,z,J,Q),Y=this.executeUpdate(Z,$,z,J),q=this.executeAdd($,z);return this.deselect(J),{remove:X,update:Y,add:q}}executeRemove($,{remove:z},{adds:Q,updates:J,removals:Z},X,Y){let q=this.rootNode._leafs,G=q?.length,_=z?.length;if(!_||!G)return[];let H=0,U=G,W=0,B=Array(_);for(let E=0;E<_;++E){let K=this.lookupNode($,z[E]);if(!K)continue;let L=K.sourceRowIndex;if(LW)W=L;if(B[H++]=K,!this.destroyNode(K,Y))continue;if(K.isSelected())X.push(K);if(!Q.delete(K))J.delete(K),Z.push(K)}if(B.length=H,H)KK(q,U,W);return B}executeUpdate($,{update:z},{adds:Q,updates:J},Z){let X=z?.length;if(!X)return[];let Y=Array(X),q=0;for(let G=0;G=G;--U){let B=J[U];B.sourceRowIndex=W,J[W--]=B}z.reordered=!0}J.length=q;let _=Array(Y),H=z.adds;for(let U=0;U=Q||Number.isNaN(z))return Q;z=Math.ceil(z);let J=this.gos;if(z>0&&J.get("treeData")&&J.get("getDataPath"))z=BK($,z);return z}},BK=($,z)=>{for(let Q=0,J=$.length;Q{if($.group=!0,$.level=-1,$._expanded=!0,$.id="ROOT_NODE_ID",$._leafs?.length!==0)$._leafs=[];let z=[],Q=[],J=[],Z=[];$.childrenAfterGroup=z,$.childrenAfterSort=Q,$.childrenAfterAggFilter=J,$.childrenAfterFilter=Z;let X=$.sibling;if(X)X.childrenAfterGroup=z,X.childrenAfterSort=Q,X.childrenAfterAggFilter=J,X.childrenAfterFilter=Z,X.childrenMapped=$.childrenMapped;return $.updateHasChildren(),$},EK=($,z)=>{if($)for(let Q=0,J=$.length;Q{z=Math.max(0,z);for(let J=z,Z=$.length;J{let Q=z.size;$.length=Q;let J=0,Z=!1,X=!1;for(let Y of z){let q=Y.sourceRowIndex;if(q===J)X||(X=Z);else{if(q>=0)X=!0;else Z=!0;Y.sourceRowIndex=J,$[J]=Y}++J}return X},DK=($,z,{adds:Q})=>{let J=$.length,Z=z.size;if(Z>J)$.length=Z;let X=0;for(let Y=0;Y{if(J.hasChildren())if($&&!Z)J.childrenAfterFilter=J.childrenAfterGroup.filter((X)=>{let Y=X.childrenAfterFilter&&X.childrenAfterFilter.length>0,q=X.data&&this.filterManager.doesRowPassFilter({rowNode:X});return Y||q});else J.childrenAfterFilter=J.childrenAfterGroup;else J.childrenAfterFilter=J.childrenAfterGroup;M2(J)};if(this.doingTreeDataFiltering()){let J=(Z,X)=>{if(Z.childrenAfterGroup)for(let Y=0;YQ(Z,!1);S0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,z,J)}}softFilter($,z){let Q=(Z)=>{if(Z.childrenAfterFilter=Z.childrenAfterGroup,Z.hasChildren())for(let X of Z.childrenAfterGroup)X.softFiltered=$&&!(X.data&&this.filterManager.doesRowPassFilter({rowNode:X}));M2(Z)},J=this.beans.rowModel;S0(J.rootNode,J.hierarchical,z,Q)}doingTreeDataFiltering(){let{gos:$}=this;return!!this.beans.groupStage?.treeData&&!$.get("excludeChildrenWhenTreeDataFiltering")}},MK=4,kK=($,z,Q,J,Z)=>{let{childrenAfterSort:X,childrenAfterAggFilter:Y}=z;if(!Y)return X&&X.length>0?X:[];let q=Y.length;if(q<=1){if(X?.length===q&&(q===0||X[0]===Y[0]))return X;return Y.slice()}if(!X||q<=MK)return $.doFullSortInPlace(Y.slice(),Z);let G=new Map,{updates:_,adds:H}=Q,U=[];for(let B=0;B$.compareRowNodes(Z,B,E)||~G.get(B)-~G.get(E)),W===q)return U;return VK($,Z,U,X,G,q)},VK=($,z,Q,J,Z,X)=>{let Y=Array(X),q=0,G=Q[q],_,H=-1,U=0,W=0,B=Q.length,E=J.length;while(!0){if(H<0){if(U>=E)break;if(_=J[U++],H=Z.get(_)??-1,H<0)continue}if(($.compareRowNodes(z,G,_)||~Z.get(G)-H)<0){if(Y[W++]=G,++q>=B)break;G=Q[q]}else Y[W++]=_,H=-1}while(q=0)Y[W++]=K}return Y},AK=($,z,Q)=>{let J=0;Q.length=z.size;for(let Z=0,X=$.length;Z{let{childrenAfterSort:z,sibling:Q}=$;if(Q)Q.childrenAfterSort=z;if(!z)return;for(let J=0,Z=z.length-1;J<=Z;J++){let X=z[J],Y=J===0,q=J===Z;if(X.firstChild!==Y)X.firstChild=Y,X.dispatchRowEvent("firstChildChanged");if(X.lastChild!==q)X.lastChild=q,X.dispatchRowEvent("lastChildChanged");if(X.childIndex!==J)X.childIndex=J,X.dispatchRowEvent("childIndexChanged")}},SK=class extends S{constructor(){super(...arguments);this.beanName="sortStage",this.step="sort",this.refreshProps=["postSortRows","groupDisplayType","accentedSort"]}execute($,z){let Q=this.beans.sortSvc.getSortOptions(),J=Q.length>0&&!!z&&this.gos.get("deltaSort"),{gos:Z,colModel:X,rowGroupColsSvc:Y,rowNodeSorter:q,rowRenderer:G,showRowGroupCols:_}=this.beans,H=Z.get("groupMaintainOrder"),U=X.getCols().some((F)=>F.isRowGroupActive()),W=Y?.columns,B=X.isPivotMode(),E=Z.getCallback("postSortRows"),K=!1,L,D=(F)=>{let M=B&&F.leafGroup,k=H&&U&&!F.leafGroup;if(k)L??(L=this.shouldSortContainsGroupCols(Q)),k&&(k=!L);let V=null;if(k){let R=!1;if(W){let O=F.level+1;if(O{let{childrenAfterSort:z,childrenAfterAggFilter:Q}=$,J=z?.length,Z=Q?.length;if(!J||!Z)return null;let X=Array(Z),Y=new Set;for(let G=0;G{this.beans.groupStage?.invalidateGroupCols(),this.refreshModel({step:"group",afterColumnsChanged:!0,keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame")})};this.addManagedEventListeners({newColumnsLoaded:Q,columnRowGroupChanged:Q,columnValueChanged:this.onValueChanged.bind(this),columnPivotChanged:()=>this.refreshModel({step:"pivot"}),columnPivotModeChanged:()=>this.refreshModel({step:"group"}),filterChanged:this.onFilterChanged.bind(this),sortChanged:this.onSortChanged.bind(this),stylesChanged:this.onGridStylesChanges.bind(this),gridReady:this.onGridReady.bind(this),rowExpansionStateChanged:this.onRowGroupOpened.bind(this)}),this.addPropertyListeners()}addPropertyListeners(){let{beans:$,stagesRefreshProps:z}=this,Q=[$.groupStage,$.filterStage,$.pivotStage,$.aggStage,$.sortStage,$.filterAggStage,$.flattenStage].filter((J)=>!!J);this.stages=Q;for(let J=Q.length-1;J>=0;--J){let Z=Q[J];for(let X of Z.refreshProps)z.set(X,J)}this.addManagedPropertyListeners([...z.keys(),"rowData"],(J)=>{let Z=J.changeSet?.properties;if(Z)this.onPropChange(Z)}),this.addManagedPropertyListener("rowHeight",()=>this.resetRowHeights())}start(){if(this.started=!0,this.rowNodesCountReady)this.refreshModel({step:"group",rowDataUpdated:!0,newData:!0});else this.setInitialData()}setInitialData(){if(this.gos.get("rowData"))this.onPropChange(["rowData"])}ensureRowHeightsValid($,z,Q,J){let Z,X=!1;do{Z=!1;let Y=this.getRowIndexAtPixel($),q=this.getRowIndexAtPixel(z),G=Math.max(Y,Q),_=Math.min(q,J);for(let H=G;H<=_;H++){let U=this.getRow(H);if(U.rowHeightEstimated){let W=sQ(this.beans,U);U.setRowHeight(W.height),Z=!0,X=!0}}if(Z)this.setRowTopAndRowIndex()}while(Z);return X}onPropChange($){let{nodeManager:z,gos:Q,beans:J}=this,Z=J.groupStage;if(!z)return;let X=new Set($),Y=Z?.onPropChange(X),q;if(X.has("rowData"))q=Q.get("rowData");else if(Y)q=Z?.extractData();if(q&&!Array.isArray(q))q=null,j(1);let G={step:"nothing",changedProps:X};if(q){let H=!Y&&!this.isEmpty()&&q.length>0&&Q.exists("getRowId")&&!Q.get("resetRowDataOnUpdate");if(this.refreshingData=!0,H)G.keepRenderedRows=!0,G.animate=!Q.get("suppressAnimationFrame"),G.changedRowNodes=new WQ,z.setImmutableRowData(G,q);else G.rowDataUpdated=!0,G.newData=!0,z.setNewRowData(q),this.rowNodesCountReady=!0}let _=G.rowDataUpdated?"group":this.getRefreshedStage($);if(_)G.step=_,this.refreshModel(G)}getRefreshedStage($){let{stages:z,stagesRefreshProps:Q}=this;if(!z)return null;let J=z.length,Z=J;for(let X=0,Y=$.length;X{if(X?.id!=null&&!z.has(X.id))X.clearRowTopAndRowIndex()},J=(X)=>{Q(X),Q(X.detailNode),Q(X.sibling);let Y=X.childrenAfterGroup;if(!X.hasChildren()||!Y)return;if($&&X.level!==-1&&!X.expanded)return;for(let q=0,G=Y.length;q{let _=X[G];if(this.gos.get("groupHideOpenParents"))while(_.expanded&&_.childrenAfterSort&&_.childrenAfterSort.length>0)_=_.childrenAfterSort[0];return _.rowIndex},q=z.footerSvc;if(q)return q?.getTopDisplayIndex(J,$,X,Y);return Y($)}getTopLevelIndexFromDisplayedIndex($){let{rootNode:z,rowsToDisplay:Q}=this;if(!z||!Q.length||Q[0]===z)return $;let Z=this.getRow($);if(Z.footer)Z=Z.sibling;let X=Z.parent;while(X&&X!==z)Z=X,X=Z.parent;let Y=z.childrenAfterSort?.indexOf(Z)??-1;return Y>=0?Y:$}getRowBounds($){let z=this.rowsToDisplay[$];return z?{rowTop:z.rowTop,rowHeight:z.rowHeight}:null}onRowGroupOpened(){this.refreshModel({step:"map",keepRenderedRows:!0,animate:HQ(this.gos)})}onFilterChanged({afterDataChange:$,columns:z}){if(!$){let J=z.length===0||z.some((Z)=>Z.isPrimary())?"filter":"filter_aggregates";this.refreshModel({step:J,keepRenderedRows:!0,animate:HQ(this.gos)})}}onSortChanged(){this.refreshModel({step:"sort",keepRenderedRows:!0,animate:HQ(this.gos)})}getType(){return"clientSide"}onValueChanged(){this.refreshModel({step:this.beans.colModel.isPivotActive()?"pivot":"aggregate"})}isSuppressModelUpdateAfterUpdateTransaction($){if(!this.gos.get("suppressModelUpdateAfterUpdateTransaction"))return!1;let{changedRowNodes:z,newData:Q,rowDataUpdated:J}=$;if(!z||Q||!J)return!1;if(z.removals.length||z.adds.size)return!1;return!0}reMapRows(){if(this.refreshingModel||this.refreshingData){this.noKeepRenderedRows=!0,this.noKeepUndoRedoStack=!0,this.noAnimate=!0;return}this.refreshModel({step:"map",keepRenderedRows:!1,keepUndoRedoStack:!1,animate:!1})}refreshModel($){let{nodeManager:z,eventSvc:Q,started:J}=this;if(!z)return;let Z=!!$.rowDataUpdated;if(J&&Z)Q.dispatchEvent({type:"rowDataUpdated"});if(this.deferRefresh($)){this.setPendingRefreshFlags($),this.rowDataUpdatedPending||(this.rowDataUpdatedPending=Z);return}if(this.rowDataUpdatedPending)this.rowDataUpdatedPending=!1,$.step="group";this.updateRefreshParams($);let X=!1;this.refreshingModel=!0;try{this.executeRefresh($,Z),X=!0}finally{if(this.refreshingData=!1,this.refreshingModel=!1,!X)this.setPendingRefreshFlags($)}this.clearPendingRefreshFlags(),Q.dispatchEvent({type:"modelUpdated",animate:$.animate,keepRenderedRows:$.keepRenderedRows,newData:$.newData,newPage:!1,keepUndoRedoStack:$.keepUndoRedoStack})}executeRefresh($,z){let{beans:Q,rootNode:J}=this;if(Q.masterDetailSvc?.refreshModel($),z&&$.step!=="group")Q.colFilter?.refreshModel();let Z=$.changedPath;if(Z?.addRow(J),$.step==="group")this.doGrouping(J,$),Z??(Z=$.changedPath);switch(Z??(Z=Q.changedPathFactory?.ensureRowsPath($,J)),$.step){case"group":case"filter":this.doFilter(Z);case"pivot":if(this.doPivot(Z))Z=void 0,$.changedPath=void 0;case"aggregate":this.doAggregate(Z);case"filter_aggregates":this.doFilterAggregates(Z);case"sort":this.doSort(Z,$.changedRowNodes);case"map":this.doRowsToDisplay()}let X=new Set;this.setRowTopAndRowIndex(X),this.clearRowTopAndRowIndex(Z,X),this.updateRefreshParams($)}deferRefresh($){if(this.refreshingModel)return!0;if(this.beans.colModel.changeEventsDispatching)return!0;if(this.isSuppressModelUpdateAfterUpdateTransaction($)){if(this.started)this.refreshingData=!1;return!0}if(!this.started)return!0;return!1}setPendingRefreshFlags($){this.pendingNewData||(this.pendingNewData=!!$.newData),this.noKeepRenderedRows||(this.noKeepRenderedRows=!$.keepRenderedRows),this.noKeepUndoRedoStack||(this.noKeepUndoRedoStack=!$.keepUndoRedoStack),this.noAnimate||(this.noAnimate=!$.animate)}clearPendingRefreshFlags(){this.pendingNewData=!1,this.noKeepRenderedRows=!1,this.noKeepUndoRedoStack=!1,this.noAnimate=!1}updateRefreshParams($){$.newData=this.pendingNewData||!!$.newData,$.keepRenderedRows=!this.noKeepRenderedRows&&!!$.keepRenderedRows,$.keepUndoRedoStack=!this.noKeepUndoRedoStack&&!!$.keepUndoRedoStack,$.animate=!this.noAnimate&&!!$.animate}isEmpty(){return!this.rootNode?._leafs?.length||!this.beans.colModel?.ready}isRowsToRender(){return this.rowsToDisplay.length>0}getOverlayType(){let{beans:$,gos:z}=this;if(this.rootNode?._leafs?.length){if($.filterManager?.isAnyFilterPresent()&&this.getRowCount()===0)return"noMatchingRows"}else if(this.rowCountReady||(z.get("rowData")?.length??0)==0)return"noRows";return null}getNodesInRangeForSelection($,z){let Q=!1,J=!1,Z=[],X=lQ(this.gos);return this.forEachNodeAfterFilterAndSort((Y)=>{if(J)return;if(Q){if(Y===z||Y===$){if(J=!0,X&&Y.group){e8(Z,Y);return}}}if(!Q){if(Y!==z&&Y!==$)return;if(Q=!0,z===$)J=!0}if(!Y.group||!X)Z.push(Y)}),Z}getTopLevelNodes(){return this.rootNode?.childrenAfterGroup??null}getRow($){return this.rowsToDisplay[$]}getFormulaRow($){return this.formulaRows[$]}isRowPresent($){return this.rowsToDisplay.indexOf($)>=0}getRowIndexAtPixel($){let z=this.rowsToDisplay,Q=z.length;if(this.isEmpty()||Q===0)return-1;let J=0,Z=Q-1;if($<=0)return 0;if(z[Z].rowTop<=$)return Z;let Y=-1,q=-1;while(!0){let G=Math.floor((J+Z)/2),_=z[G];if(this.isRowInPixel(_,$))return G;if(_.rowTop<$)J=G+1;else if(_.rowTop>$)Z=G-1;if(Y===J&&q===Z)return G;Y=J,q=Z}}isRowInPixel($,z){let Q=$.rowTop,J=Q+$.rowHeight;return Q<=z&&J>z}forEachLeafNode($){let z=this.rootNode?._leafs;if(z)for(let Q=0,J=z.length;QQ.childrenAfterAggFilter)}forEachNodeAfterFilterAndSort($,z=!1){this.depthFirstSearchRowNodes($,z,(Q)=>Q.childrenAfterSort)}forEachPivotNode($,z,Q){let{colModel:J,rowGroupColsSvc:Z}=this.beans;if(!J.isPivotMode())return;if(!Z?.columns.length){$(this.rootNode,0);return}let X=Q?"childrenAfterSort":"childrenAfterGroup";this.depthFirstSearchRowNodes($,z,(Y)=>!Y.leafGroup?Y[X]:null)}depthFirstSearchRowNodes($,z=!1,Q=(X)=>X.childrenAfterGroup,J=this.rootNode,Z=0){let X=Z;if(!J)return X;let Y=J===this.rootNode;if(!Y)$(J,X++);if(J.hasChildren()&&!J.footer){let q=Y||this.hierarchical?Q(J):null;if(q){let G=this.beans.footerSvc;X=G?.addTotalRows(X,J,$,z,Y,"top")??X;for(let _ of q)X=this.depthFirstSearchRowNodes($,z,Q,_,X);return G?.addTotalRows(X,J,$,z,Y,"bottom")??X}}return X}doAggregate($){if(this.rootNode)this.beans.aggStage?.execute($)}doFilterAggregates($){let z=this.rootNode,Q=this.beans.filterAggStage;if(Q&&this.hierarchical){Q.execute($);return}z.childrenAfterAggFilter=z.childrenAfterFilter;let J=z.sibling;if(J)J.childrenAfterAggFilter=z.childrenAfterFilter}doSort($,z){let Q=this.beans.sortStage;if(Q){Q.execute($,z);return}S0(this.rootNode,this.hierarchical,$,(J)=>{J.childrenAfterSort=J.childrenAfterAggFilter.slice(0),o8(J)})}doGrouping($,z){let J=this.beans.groupStage?.execute(z);if(J===void 0){let Z=$._leafs;$.childrenAfterGroup=Z,$.updateHasChildren();let X=$.sibling;if(X)X.childrenAfterGroup=Z}if(J||z.rowDataUpdated)this.beans.colFilter?.refreshModel();if(!this.rowCountReady&&this.rowNodesCountReady)this.rowCountReady=!0,this.eventSvc.dispatchEventOnce({type:"rowCountReady"})}doFilter($){let z=this.beans.filterStage;if(z){z.execute($);return}S0(this.rootNode,this.hierarchical,$,(Q)=>{Q.childrenAfterFilter=Q.childrenAfterGroup,M2(Q)})}doPivot($){return this.beans.pivotStage?.execute($)??!1}getRowNode($){let z=this.nodeManager?.getRowNode($);if(typeof z==="object")return z;return this.beans.groupStage?.getNonLeaf($)}batchUpdateRowData($,z){if(!this.asyncTransactionsTimer){this.asyncTransactions=[];let Q=this.gos.get("asyncTransactionWaitMillis");this.asyncTransactionsTimer=setTimeout(()=>this.executeBatchUpdateRowData(),Q)}this.asyncTransactions.push({rowDataTransaction:$,callback:z})}flushAsyncTransactions(){let $=this.asyncTransactionsTimer;if($)clearTimeout($),this.executeBatchUpdateRowData()}executeBatchUpdateRowData(){let{nodeManager:$,beans:z,eventSvc:Q,asyncTransactions:J}=this;if(!$)return;z.valueCache?.onDataChanged();let Z=[],X=[],Y=new WQ,q=!this.gos.get("suppressAnimationFrame");for(let{rowDataTransaction:G,callback:_}of J??[]){this.rowNodesCountReady=!0,this.refreshingData=!0;let H=$.updateRowData(G,Y,q);if(Z.push(H),_)X.push(_.bind(null,H))}if(this.commitTransactions(Y,q),X.length>0)setTimeout(()=>{for(let G=0,_=X.length;G<_;G++)X[G]()},0);if(Z.length>0)Q.dispatchEvent({type:"asyncTransactionsFlushed",results:Z});this.asyncTransactionsTimer=0,this.asyncTransactions=null}updateRowData($){let z=this.nodeManager;if(!z)return null;this.beans.valueCache?.onDataChanged(),this.rowNodesCountReady=!0;let Q=new WQ,J=!this.gos.get("suppressAnimationFrame");this.refreshingData=!0;let Z=z.updateRowData($,Q,J);return this.commitTransactions(Q,J),Z}commitTransactions($,z){this.refreshModel({step:"group",rowDataUpdated:!0,keepRenderedRows:!0,animate:z,changedRowNodes:$})}doRowsToDisplay(){let{rootNode:$,beans:z}=this;if(z.formula?.active){let Z=$?.childrenAfterSort??[];this.formulaRows=Z,this.rowsToDisplay=Z.filter((X)=>!X.softFiltered);for(let X of this.rowsToDisplay)X.setUiLevel(0);return}let Q=z.flattenStage;if(Q){this.rowsToDisplay=Q.execute();return}let J=this.rootNode.childrenAfterSort??[];for(let Z of J)Z.setUiLevel(0);this.rowsToDisplay=J}onRowHeightChanged(){this.refreshModel({step:"map",keepRenderedRows:!0,keepUndoRedoStack:!0})}resetRowHeights(){let $=this.rootNode;if(!$)return;let z=this.resetRowHeightsForAllRowNodes();$.setRowHeight($.rowHeight,!0);let Q=$.sibling;if(Q?.setRowHeight(Q.rowHeight,!0),z)this.onRowHeightChanged()}resetRowHeightsForAllRowNodes(){let $=!1;return this.forEachNode((z)=>{z.setRowHeight(z.rowHeight,!0);let Q=z.detailNode;Q?.setRowHeight(Q.rowHeight,!0);let J=z.sibling;J?.setRowHeight(J.rowHeight,!0),$=!0}),$}onGridStylesChanges($){if($.rowHeightChanged&&!this.beans.rowAutoHeight?.active)this.resetRowHeights()}onGridReady(){if(!this.started)this.setInitialData()}destroy(){super.destroy(),this.nodeManager=this.destroyBean(this.nodeManager),this.started=!1,this.rootNode=null,this.rowsToDisplay=[],this.asyncTransactions=null,this.stages=null,this.stagesRefreshProps.clear(),clearTimeout(this.asyncTransactionsTimer)}onRowHeightChangedDebounced(){this.onRowHeightChanged_debounced()}},e8=($,z)=>{let Q=z.childrenAfterGroup;if(Q)for(let J=0,Z=Q.length;Jthis.onFirstDataRendered(z)});let Z=$.get("rowData");Q=Z!=null&&Z.length>0&&o($)}if(Q)this.beans.colDelayRenderSvc?.hideColumns(J)}}autoSizeCols($){let{eventSvc:z,visibleCols:Q,colModel:J}=this.beans;bQ(this.beans,!0),this.innerAutoSizeCols($).then((Z)=>{let X=(H)=>LQ(z,Array.from(H),!0,"autosizeColumns");if(!$.scaleUpToFitGridWidth)return bQ(this.beans,!1),X(Z);let Y=H6(this.beans),q=(H)=>Q.leftCols.some((U)=>P$(U,H)),G=(H)=>Q.rightCols.some((U)=>P$(U,H)),_=$.colKeys.filter((H)=>{return!J.getCol(H)?.getColDef().suppressAutoSize&&!v0(H)&&!q(H)&&!G(H)});this.sizeColumnsToFit(Y,$.source,!0,{defaultMaxWidth:$.defaultMaxWidth,defaultMinWidth:$.defaultMinWidth,columnLimits:$.columnLimits?.map((H)=>({...H,key:H.colId})),colKeys:_,onlyScaleUp:!0,animate:!1}),bQ(this.beans,!1),X(Z)})}innerAutoSizeCols($){return new Promise((z,Q)=>{if(this.shouldQueueResizeOperations)return this.pushResizeOperation(()=>this.innerAutoSizeCols($).then(z,Q));let{colKeys:J,skipHeader:Z,skipHeaderGroups:X,stopAtGroup:Y,defaultMaxWidth:q,defaultMinWidth:G,columnLimits:_=[],source:H="api"}=$,{animationFrameSvc:U,renderStatus:W,colModel:B,autoWidthCalc:E,visibleCols:K}=this.beans;if(U?.flushAllFrames(),this.timesDelayed<5&&W&&(!W.areHeaderCellsRendered()||!W.areCellsRendered())){this.timesDelayed++,setTimeout(()=>{if(this.isAlive())this.innerAutoSizeCols($).then(z,Q)});return}this.timesDelayed=0;let L=new Set,D=-1,F=Object.fromEntries(_.map(({colId:V,...R})=>[V,R])),M=Z??this.gos.get("skipHeaderOnAutoSize"),k=X??M;while(D!==0){D=0;let V=[];for(let R of J){if(!R||q1(R))continue;let O=B.getCol(R);if(!O||L.has(O)||O.getColDef().suppressAutoSize)continue;let I=E.getPreferredWidthForColumn(O,M);if(I>0){let v=F[O.colId]??{};v.minWidth??(v.minWidth=G),v.maxWidth??(v.maxWidth=q);let C=vK(O,I,v);O.setActualWidth(C,H),L.add(O),D++}V.push(O)}if(V.length)K.refresh(H)}if(!k)this.autoSizeColumnGroupsByColumns(J,H,Y);z(L)})}autoSizeColumn($,z,Q){this.autoSizeCols({colKeys:[$],skipHeader:Q,skipHeaderGroups:!0,source:z})}autoSizeColumnGroupsByColumns($,z,Q){let{colModel:J,ctrlsSvc:Z}=this.beans,X=new Set,Y=J.getColsForKeys($);for(let G of Y){let _=G.getParent();while(_&&_!=Q){if(!_.isPadding())X.add(_);_=_.getParent()}}let q;for(let G of X){for(let _ of Z.getHeaderRowContainerCtrls())if(q=_.getHeaderCtrlForColumn(G),q)break;q?.resizeLeafColumnsToFit(z)}}autoSizeAllColumns($){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.autoSizeAllColumns($));return}this.autoSizeCols({colKeys:this.beans.visibleCols.allCols,...$})}addColumnAutosizeListeners($,z){let Q=this.gos.get("skipHeaderOnAutoSize"),J=()=>{this.autoSizeColumn(z,"uiColumnResized",Q)};$.addEventListener("dblclick",J);let Z=new h0($);return Z.addEventListener("doubleTap",J),()=>{$.removeEventListener("dblclick",J),Z.destroy()}}addColumnGroupResize($,z,Q){let J=this.gos.get("skipHeaderOnAutoSize"),Z=()=>{let X=[],Y=z.getDisplayedLeafColumns();for(let q of Y)if(!q.getColDef().suppressAutoSize)X.push(q.getColId());if(X.length>0)this.autoSizeCols({colKeys:X,skipHeader:J,stopAtGroup:z,source:"uiColumnResized"});Q()};return $.addEventListener("dblclick",Z),()=>$.removeEventListener("dblclick",Z)}sizeColumnsToFitGridBody($,z){if(!this.isAlive())return;let Q=H6(this.beans);if(Q>0){this.sizeColumnsToFit(Q,"sizeColumnsToFit",!1,$);return}if(z===void 0)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,100)},0);else if(z===100)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,500)},100);else if(z===500)window.setTimeout(()=>{this.sizeColumnsToFitGridBody($,-1)},500);else j(29)}sizeColumnsToFit($,z="sizeColumnsToFit",Q,J){if(this.shouldQueueResizeOperations){this.pushResizeOperation(()=>this.sizeColumnsToFit($,z,Q,J));return}let{beans:Z}=this,X=J?.animate??!0;if(X)bQ(Z,!0);let Y={};for(let{key:D,...F}of J?.columnLimits??[])Y[typeof D==="string"?D:D.getColId()]=F;let q=Z.visibleCols.allCols;if($<=0||!q.length)return;let G=N$(q);if(J?.onlyScaleUp&&G>$)return;if($===G){if(q.every((F)=>{if(F.colDef.suppressSizeToFit)return!0;let M=Y?.[F.getId()],k=M?.minWidth??J?.defaultMinWidth,V=M?.maxWidth??J?.defaultMaxWidth,R=F.getActualWidth();return(k==null||R>=k)&&(V==null||R<=V)}))return}let H=[],U=[];for(let D of q){let F=J?.colKeys?.some((M)=>P$(D,M))??!0;if(D.getColDef().suppressSizeToFit||!F)U.push(D);else H.push(D)}let W=H.slice(0),B=!1,E=(D)=>{Z0(H,D),U.push(D)},K={};for(let D of H){if(J?.onlyScaleUp)K[D.getColId()]=D.getActualWidth();D.resetActualWidth(z);let F=Y?.[D.getId()],M=F?.minWidth??J?.defaultMinWidth??-1/0,k=F?.maxWidth??J?.defaultMaxWidth??1/0,V=D.getActualWidth(),R=Math.max(Math.min(V,k),M);if(R!=V)D.setActualWidth(R,z,!0)}while(!B){B=!0;let D=$-N$(U);if(D<=0)for(let F of H){let M=Y?.[F.getId()]?.minWidth??J?.defaultMinWidth??F.minWidth;F.setActualWidth(M,z,!0)}else{let F=D/N$(H),M=D;for(let k=H.length-1;k>=0;k--){let V=H[k],R=V.getColId(),O=K[R],I=Y?.[R],v=I?.minWidth??J?.defaultMinWidth??O,C=I?.maxWidth??J?.defaultMaxWidth,m=Math.max(v??-1/0,V.getMinWidth()),w=Math.min(C??1/0,V.getMaxWidth()),a=Math.round(V.getActualWidth()*F);if(aw)a=w,E(V),B=!1;else if(k===0)a=M;V.setActualWidth(a,z,!0),M-=a}}}for(let D of W)D.fireColumnWidthChangedEvent(z);let L=Z.visibleCols;if(L.setLeftValues(z),L.updateBodyWidths(),Q)return;if(LQ(this.eventSvc,W,!0,z),X)bQ(Z,!1)}applyAutosizeStrategy(){let{gos:$,colDelayRenderSvc:z}=this.beans,Q=$.get("autoSizeStrategy");if(Q?.type!=="fitGridWidth"&&Q?.type!=="fitProvidedWidth")return;setTimeout(()=>{if(!this.isAlive())return;let J=Q.type;if(J==="fitGridWidth"){let{columnLimits:Z,defaultMinWidth:X,defaultMaxWidth:Y}=Q,q=Z?.map(({colId:G,minWidth:_,maxWidth:H})=>({key:G,minWidth:_,maxWidth:H}));this.sizeColumnsToFitGridBody({defaultMinWidth:X,defaultMaxWidth:Y,columnLimits:q})}else if(J==="fitProvidedWidth")this.sizeColumnsToFit(Q.width,"sizeColumnsToFit");z?.revealColumns(J)})}onFirstDataRendered({colIds:$,...z}){setTimeout(()=>{if(!this.isAlive())return;let Q="autosizeColumns";if($)this.autoSizeCols({...z,source:Q,colKeys:$});else this.autoSizeAllColumns({...z,source:Q});this.beans.colDelayRenderSvc?.revealColumns(z.type)})}processResizeOperations(){this.shouldQueueResizeOperations=!1;for(let $ of this.resizeOperationQueue)$();this.resizeOperationQueue=[]}pushResizeOperation($){this.resizeOperationQueue.push($)}destroy(){this.resizeOperationQueue.length=0,super.destroy()}};function vK($,z,Q={}){let J=Q.minWidth??$.getMinWidth();if(zZ)z=Z;return z}function H6({ctrlsSvc:$,scrollVisibleSvc:z}){let Q=$.getGridBodyCtrl(),Z=Q.isVerticalScrollShowing()?z.getScrollbarWidth():0;return xz(Q.eGridBody)-Z}var U6="ag-animate-autosize";function bQ({ctrlsSvc:$,gos:z},Q){if(!z.get("animateColumnResizing")||z.get("enableRtl")||!$.isAlive())return;let J=$.getGridBodyCtrl().eGridBody.classList;if(Q)J.add(U6);else J.remove(U6)}var Q9={moduleName:"ColumnAutoSize",version:p,beans:[TK],apiFunctions:{sizeColumnsToFit:OK,autoSizeColumns:z9,autoSizeAllColumns:PK},dependsOn:[K8],css:[fK]};var IK=class extends S{constructor(){super(...arguments);this.beanName="gridSerializer"}wireBeans($){this.visibleCols=$.visibleCols,this.colModel=$.colModel,this.rowModel=$.rowModel,this.pinnedRowModel=$.pinnedRowModel}serialize($,z={}){let{allColumns:Q,columnKeys:J,skipRowGroups:Z,exportRowNumbers:X}=z,Y=this.getColumnsToExport({allColumns:Q,skipRowGroups:Z,columnKeys:J,exportRowNumbers:X});return[this.prepareSession(Y),this.prependContent(z),this.exportColumnGroups(z,Y),this.exportHeaders(z,Y),this.processPinnedTopRows(z,Y),this.processRows(z,Y),this.processPinnedBottomRows(z,Y),this.appendContent(z)].reduce((q,G)=>G(q),$).parse()}processRow($,z,Q,J){let Z=z.shouldRowBeSkipped||(()=>!1),Y=z.rowPositions!=null||!!z.onlySelected,q=this.gos.get("groupHideOpenParents")&&!Y,G=this.colModel.isPivotMode()?J.leafGroup:!J.group,_=!!J.footer,H=J.allChildrenCount===1&&J.childrenAfterGroup?.length===1&&wq(this.gos,J);if(!G&&!_&&(z.skipRowGroups||H||q)||z.onlySelected&&!J.isSelected()||z.skipPinnedTop&&J.rowPinned==="top"||z.skipPinnedBottom&&J.rowPinned==="bottom"||J.stub)return;if(J.level===-1&&!G&&!_)return;if(Z(y(this.gos,{node:J})))return;let B=$.onNewBodyRow(J);if(Q.forEach((E,K)=>{B.onColumn(E,K,J)}),z.getCustomContentBelowRow){let E=z.getCustomContentBelowRow(y(this.gos,{node:J}));if(E)$.addCustomContent(E)}}appendContent($){return(z)=>{let Q=$.appendContent;if(Q)z.addCustomContent(Q);return z}}prependContent($){return(z)=>{let Q=$.prependContent;if(Q)z.addCustomContent(Q);return z}}prepareSession($){return(z)=>{return z.prepare($),z}}exportColumnGroups($,z){return(Q)=>{if(!$.skipColumnGroupHeaders){let J=new M8,{colGroupSvc:Z}=this.beans,X=Z?Z.createColumnGroups({columns:z,idCreator:J,pinned:null,isStandaloneStructure:!0}):z;this.recursivelyAddHeaderGroups(X,Q,$.processGroupHeaderCallback)}return Q}}exportHeaders($,z){return(Q)=>{if(!$.skipColumnHeaders){let J=Q.onNewHeaderRow();z.forEach((Z,X)=>{J.onColumn(Z,X,void 0)})}return Q}}processPinnedTopRows($,z){return(Q)=>{let J=this.processRow.bind(this,Q,$,z);if($.rowPositions)$.rowPositions.filter((Z)=>Z.rowPinned==="top").sort((Z,X)=>Z.rowIndex-X.rowIndex).map((Z)=>this.pinnedRowModel?.getPinnedTopRow(Z.rowIndex)).forEach(J);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("top",J);return Q}}processRows($,z){return(Q)=>{let J=this.rowModel,Z=o(this.gos,J),X=_z(this.gos,J),Y=!Z&&$.onlySelected,q=this.processRow.bind(this,Q,$,z),{exportedRows:G="filteredAndSorted"}=$;if($.rowPositions)$.rowPositions.filter((_)=>_.rowPinned==null).sort((_,H)=>_.rowIndex-H.rowIndex).map((_)=>J.getRow(_.rowIndex)).forEach(q);else if(this.colModel.isPivotMode())if(Z)J.forEachPivotNode(q,!0,G==="filteredAndSorted");else if(X)J.forEachNodeAfterFilterAndSort(q,!0);else J.forEachNode(q);else if($.onlySelectedAllPages||Y){let _=this.beans.selectionSvc?.getSelectedNodes()??[];this.replicateSortedOrder(_),_.forEach(q)}else if(G==="all")J.forEachNode(q);else if(Z||X)J.forEachNodeAfterFilterAndSort(q,!0);else J.forEachNode(q);return Q}}replicateSortedOrder($){let{sortSvc:z,rowNodeSorter:Q}=this.beans;if(!z||!Q)return;let J=z.getSortOptions(),Z=(X,Y)=>{if(X.rowIndex!=null&&Y.rowIndex!=null)return X.rowIndex-Y.rowIndex;if(X.level===Y.level){if(X.parent?.id===Y.parent?.id)return Q.compareRowNodes(J,X,Y)||(X.rowIndex??-1)-(Y.rowIndex??-1);return Z(X.parent,Y.parent)}if(X.level>Y.level)return Z(X.parent,Y);return Z(X,Y.parent)};$.sort(Z)}processPinnedBottomRows($,z){return(Q)=>{let J=this.processRow.bind(this,Q,$,z);if($.rowPositions)$.rowPositions.filter((Z)=>Z.rowPinned==="bottom").sort((Z,X)=>Z.rowIndex-X.rowIndex).map((Z)=>this.pinnedRowModel?.getPinnedBottomRow(Z.rowIndex)).forEach(J);else if(!this.pinnedRowModel?.isManual())this.pinnedRowModel?.forEachPinnedRow("bottom",J);return Q}}getColumnsToExport($){let{allColumns:z=!1,skipRowGroups:Q=!1,exportRowNumbers:J=!1,columnKeys:Z}=$,{colModel:X,gos:Y,visibleCols:q}=this,G=X.isPivotMode(),_=(W)=>{if(I$(W))return!1;return!v0(W)||J};if(Z?.length)return X.getColsForKeys(Z).filter(_);let H=Y.get("treeData"),U=[];if(z&&!G)U=X.getCols();else U=q.allCols;return U=U.filter((W)=>_(W)&&(Q&&!H?!mz(W):!0)),U}recursivelyAddHeaderGroups($,z,Q){let J=[];for(let Z of $){let X=Z;if(!X.getChildren)continue;for(let Y of X.getChildren()??[])J.push(Y)}if($.length>0&&H0($[0]))this.doAddHeaderHeader(z,$,Q);if(J&&J.length>0)this.recursivelyAddHeaderGroups(J,z,Q)}doAddHeaderHeader($,z,Q){let J=$.onNewHeaderGroupingRow(),Z=0;for(let X of z){let Y=X,q;if(Q)q=Q(y(this.gos,{columnGroup:Y}));else q=this.beans.colNames.getDisplayNameForColumnGroup(Y,"header");let _=(Y.isExpandable()?Y.getLeafColumns():[]).reduce((H,U,W,B)=>{let E=b(H);if(U.getColumnGroupShow()!=="open"){if(E&&E[1]==null)E[1]=W-1}else if(!E||E[1]!=null)E=[W],H.push(E);if(W===B.length-1&&E&&E[1]==null)E[1]=W;return H},[]);J.onColumn(Y,q||"",Z++,Y.getLeafColumns().length-1,_)}}},f4={moduleName:"SharedExport",version:p,beans:[IK]},O4=class extends S{getFileName($){let z=this.getDefaultFileExtension();if(!$?.length)$=this.getDefaultFileName();return $.includes(".")?$:`${$}.${z}`}getData($){return this.beans.gridSerializer.serialize(this.createSerializingSession($),$)}getDefaultFileName(){return`export.${this.getDefaultFileExtension()}`}};function dJ($,z){let Q=document.defaultView||window;if(!Q){j(52);return}let J=document.createElement("a"),Z=Q.URL.createObjectURL(z);J.setAttribute("href",Z),J.setAttribute("download",$),J.style.display="none",document.body.appendChild(J),J.dispatchEvent(new MouseEvent("click",{bubbles:!1,cancelable:!0,view:Q})),J.remove(),Q.setTimeout(()=>{Q.URL.revokeObjectURL(Z)},0)}var P4=class{constructor($){this.valueFrom="data";let{colModel:z,rowGroupColsSvc:Q,colNames:J,valueSvc:Z,gos:X,processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:_,valueFrom:H}=$;if(this.colModel=z,this.rowGroupColsSvc=Q,this.colNames=J,this.valueSvc=Z,this.gos=X,this.processCellCallback=Y,this.processHeaderCallback=q,this.processGroupHeaderCallback=G,this.processRowGroupCallback=_,H)this.valueFrom=H}prepare($){}extractHeaderValue($){return this.getHeaderName(this.processHeaderCallback,$)??""}extractRowCellValue($){let{column:z,node:Q,currentColumnIndex:J,accumulatedRowIndex:Z,type:X,useRawFormula:Y}=$,q=J===0&&Y7(this.gos,Q,this.colModel.isPivotMode());if(this.processRowGroupCallback&&(this.gos.get("treeData")||Q.group)&&(z.isRowGroupDisplayed(Q.rowGroupColumn?.getColId()??"")||q))return{value:this.processRowGroupCallback(y(this.gos,{column:z,node:Q}))??""};if(this.processCellCallback)return{value:this.processCellCallback(y(this.gos,{accumulatedRowIndex:Z,column:z,node:Q,value:this.valueSvc.getValueForDisplay({column:z,node:Q,from:this.valueFrom}).value,type:X,parseValue:(E)=>this.valueSvc.parseValue(z,Q,E,this.valueSvc.getValue(z,Q,this.valueFrom)),formatValue:(E)=>this.valueSvc.formatValue(z,Q,E)??E}))??""};let G=this.gos.get("treeData"),_=this.valueSvc,H=Q.level===-1&&Q.footer,U=z.colDef.showRowGroup===!0&&(Q.group||G);if(!H&&(q||U)){let E="",K=Q;while(K&&K.level!==-1){let{value:L,valueFormatted:D}=_.getValueForDisplay({column:q?void 0:z,node:K,includeValueFormatted:!0,exporting:!0,from:this.valueFrom});E=` -> ${D??L??""}${E}`,K=K.parent}return{value:E,valueFormatted:E}}let{value:W,valueFormatted:B}=_.getValueForDisplay({column:z,node:Q,includeValueFormatted:!0,exporting:!0,useRawFormula:Y,from:this.valueFrom});return{value:W??"",valueFormatted:B}}getHeaderName($,z){if($)return $(y(this.gos,{column:z}));return this.colNames.getDisplayNameForColumn(z,"csv",!0)}},W6=`\r +`,CK=class extends P4{constructor($){super($);this.config=$,this.isFirstLine=!0,this.result="";let{suppressQuotes:z,columnSeparator:Q}=$;this.suppressQuotes=z,this.columnSeparator=Q}addCustomContent($){if(!$)return;if(typeof $==="string"){if(!/^\s*\n/.test($))this.beginNewLine();$=$.replace(/\r?\n/g,W6),this.result+=$}else $.forEach((z)=>{this.beginNewLine(),z.forEach((Q,J)=>{if(J!==0)this.result+=this.columnSeparator;if(this.result+=this.putInQuotes(Q.data.value||""),Q.mergeAcross)this.appendEmptyCells(Q.mergeAcross)})})}onNewHeaderGroupingRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderGroupingRowColumn.bind(this)}}onNewHeaderGroupingRowColumn($,z,Q,J){if(Q!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(z),this.appendEmptyCells(J)}appendEmptyCells($){for(let z=1;z<=$;z++)this.result+=this.columnSeparator+this.putInQuotes("")}onNewHeaderRow(){return this.beginNewLine(),{onColumn:this.onNewHeaderRowColumn.bind(this)}}onNewHeaderRowColumn($,z){if(z!=0)this.result+=this.columnSeparator;this.result+=this.putInQuotes(this.extractHeaderValue($))}onNewBodyRow(){return this.beginNewLine(),{onColumn:this.onNewBodyRowColumn.bind(this)}}onNewBodyRowColumn($,z,Q){if(z!=0)this.result+=this.columnSeparator;let J=this.extractRowCellValue({column:$,node:Q,currentColumnIndex:z,accumulatedRowIndex:z,type:"csv",useRawFormula:!1});this.result+=this.putInQuotes(J.valueFormatted??J.value)}putInQuotes($){if(this.suppressQuotes)return $;if($===null||$===void 0)return'""';let z;if(typeof $==="string")z=$;else if(typeof $.toString==="function")z=$.toString();else j(53),z="";return'"'+z.replace(/"/g,'""')+'"'}parse(){return this.result}beginNewLine(){if(!this.isFirstLine)this.result+=W6;this.isFirstLine=!1}},bK=class extends O4{constructor(){super(...arguments);this.beanName="csvCreator"}getMergedParams($){let z=this.gos.get("defaultCsvExportParams");return Object.assign({},z,$)}export($){if(this.isExportSuppressed()){j(51);return}let z=()=>{let J=this.getMergedParams($),Z=this.getData(J),X=new Blob(["\uFEFF",Z],{type:"text/plain"}),Y=J.fileName,q=typeof Y==="function"?Y(y(this.gos,{})):Y;dJ(this.getFileName(q),X)},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(z);else z()}exportDataAsCsv($){this.export($)}getDataAsCsv($,z=!1){let Q=z?Object.assign({},$):this.getMergedParams($);return this.getData(Q)}getDefaultFileExtension(){return"csv"}createSerializingSession($){let{colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,gos:X}=this.beans,{processCellCallback:Y,processHeaderCallback:q,processGroupHeaderCallback:G,processRowGroupCallback:_,suppressQuotes:H,columnSeparator:U,valueFrom:W}=$;return new CK({colModel:z,colNames:Q,valueSvc:Z,gos:X,processCellCallback:Y||void 0,processHeaderCallback:q||void 0,processGroupHeaderCallback:G||void 0,processRowGroupCallback:_||void 0,suppressQuotes:H||!1,columnSeparator:U||",",rowGroupColsSvc:J,valueFrom:W})}isExportSuppressed(){return this.gos.get("suppressCsvExport")}};function yK($,z){return $.csvCreator?.getDataAsCsv(z)}function xK($,z){$.csvCreator?.exportDataAsCsv(z)}var J9={moduleName:"CsvExport",version:p,beans:[bK],apiFunctions:{getDataAsCsv:yK,exportDataAsCsv:xK},dependsOn:[f4]},Z9=class extends R0{constructor($,z){super();if(this.ctrl=$,z)this.beans=z}postConstruct(){this.refreshTooltip()}setBrowserTooltip($,z){let J=this.ctrl.getGui();if(!J)return;if($!=null&&($!=""||z))J.setAttribute("title",$);else J.removeAttribute("title")}updateTooltipText(){let{getTooltipValue:$}=this.ctrl;if($)this.tooltip=$()}createTooltipFeatureIfNeeded(){if(this.tooltipManager==null){let $=this.beans.registry.createDynamicBean("tooltipStateManager",!0,this.ctrl,()=>this.tooltip);if($)this.tooltipManager=this.createBean($,this.beans.context)}}attemptToShowTooltip(){this.tooltipManager?.prepareToShowTooltip()}attemptToHideTooltip(){this.tooltipManager?.hideTooltip()}setTooltipAndRefresh($){this.tooltip=$,this.refreshTooltip()}refreshTooltip($){if(this.browserTooltips=this.beans.gos.get("enableBrowserTooltips"),this.updateTooltipText(),this.browserTooltips)this.setBrowserTooltip(this.tooltip),this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context);else this.setBrowserTooltip($?"":null,$),this.createTooltipFeatureIfNeeded()}destroy(){this.tooltipManager=this.destroyBean(this.tooltipManager,this.beans.context),super.destroy()}},wK=1000,NK=1000,B6=100,E6,m1=!1,gK=class extends R0{constructor($,z){super();this.tooltipCtrl=$,this.getTooltipValue=z,this.interactionEnabled=!1,this.isInteractingWithTooltip=!1,this.state=0,this.tooltipInstanceCount=0,this.tooltipMouseTrack=!1}wireBeans($){this.popupSvc=$.popupSvc}postConstruct(){if(this.gos.get("tooltipInteraction"))this.interactionEnabled=!0;this.tooltipTrigger=this.getTooltipTrigger(),this.tooltipMouseTrack=this.gos.get("tooltipMouseTrack");let $=this.tooltipCtrl.getGui();if(this.tooltipTrigger===0)this.addManagedListeners($,{mouseenter:this.onMouseEnter.bind(this),mouseleave:this.onMouseLeave.bind(this)});if(this.tooltipTrigger===1)this.addManagedListeners($,{focusin:this.onFocusIn.bind(this),focusout:this.onFocusOut.bind(this)});if(this.addManagedListeners($,{mousemove:this.onMouseMove.bind(this)}),!this.interactionEnabled)this.addManagedListeners($,{mousedown:this.onMouseDown.bind(this),keydown:this.onKeyDown.bind(this)})}getGridOptionsTooltipDelay($){let z=this.gos.get($);return Math.max(200,z)}getTooltipDelay($){return this.tooltipCtrl[`getTooltip${$}DelayOverride`]?.()??this.getGridOptionsTooltipDelay(`tooltip${$}Delay`)}destroy(){this.setToDoNothing(),super.destroy()}getTooltipTrigger(){let $=this.gos.get("tooltipTrigger");if(!$||$==="hover")return 0;return 1}onMouseEnter($){if(this.interactionEnabled&&this.interactiveTooltipTimeoutId)this.unlockService(),this.startHideTimeout();if(bz())return;if(m1)this.showTooltipTimeoutId=window.setTimeout(()=>{this.prepareToShowTooltip($)},B6);else this.prepareToShowTooltip($)}onMouseMove($){if(this.lastMouseEvent)this.lastMouseEvent=$;if(this.tooltipMouseTrack&&this.state===2&&this.tooltipComp)this.positionTooltip()}onMouseDown(){this.setToDoNothing()}onMouseLeave(){if(this.interactionEnabled)this.lockService();else this.setToDoNothing()}onFocusIn(){this.prepareToShowTooltip()}onFocusOut($){let z=$.relatedTarget,Q=this.tooltipCtrl.getGui(),J=this.tooltipComp?.getGui();if(this.isInteractingWithTooltip||Q.contains(z)||this.interactionEnabled&&J?.contains(z))return;this.setToDoNothing()}onKeyDown(){if(this.isInteractingWithTooltip)this.isInteractingWithTooltip=!1;this.setToDoNothing()}prepareToShowTooltip($){if(this.state!=0||m1)return;let z=0;if($)z=this.isLastTooltipHiddenRecently()?this.getTooltipDelay("SwitchShow"):this.getTooltipDelay("Show");this.lastMouseEvent=$||null,this.showTooltipTimeoutId=window.setTimeout(this.showTooltip.bind(this),z),this.state=1}isLastTooltipHiddenRecently(){return Date.now()-E6this.hideTooltip(!0),...z.getAdditionalParams?.()});this.state=2,this.tooltipInstanceCount++;let J=this.newTooltipComponentCallback.bind(this,this.tooltipInstanceCount);this.createTooltipComp(Q,J)}hideTooltip($){if(!$&&this.isInteractingWithTooltip)return;if(this.tooltipComp)this.destroyTooltipComp(),E6=Date.now();if(this.eventSvc.dispatchEvent({type:"tooltipHide",parentGui:this.tooltipCtrl.getGui()}),$)this.isInteractingWithTooltip=!1;this.setToDoNothing(!0)}newTooltipComponentCallback($,z){if(this.state!==2||this.tooltipInstanceCount!==$){this.destroyBean(z);return}let J=z.getGui();if(this.tooltipComp=z,!J.classList.contains("ag-tooltip"))J.classList.add("ag-tooltip-custom");if(this.tooltipTrigger===0)J.classList.add("ag-tooltip-animate");if(this.interactionEnabled)J.classList.add("ag-tooltip-interactive");let Z=this.getLocaleTextFunc(),X=this.popupSvc?.addPopup({eChild:J,ariaLabel:Z("ariaLabelTooltip","Tooltip")});if(X)this.tooltipPopupDestroyFunc=X.hideFunc;if(this.positionTooltip(),this.tooltipTrigger===1){let Y=()=>this.setToDoNothing();[this.onBodyScrollEventCallback]=this.addManagedEventListeners({bodyScroll:Y}),this.setEventHandlers(Y)}if(this.interactionEnabled){if([this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener]=this.addManagedElementListeners(J,{mouseenter:this.onTooltipMouseEnter.bind(this),mouseleave:this.onTooltipMouseLeave.bind(this)}),[this.onDocumentKeyDownCallback]=this.addManagedElementListeners(Y0(this.beans),{keydown:(Y)=>{if(!J.contains(Y?.target))this.onKeyDown()}}),this.tooltipTrigger===1)[this.tooltipFocusInListener,this.tooltipFocusOutListener]=this.addManagedElementListeners(J,{focusin:this.onTooltipFocusIn.bind(this),focusout:this.onTooltipFocusOut.bind(this)})}this.eventSvc.dispatchEvent({type:"tooltipShow",tooltipGui:J,parentGui:this.tooltipCtrl.getGui()}),this.startHideTimeout()}onTooltipMouseEnter(){this.isInteractingWithTooltip=!0,this.unlockService()}onTooltipMouseLeave(){if(this.isTooltipFocused())return;this.isInteractingWithTooltip=!1,this.lockService()}onTooltipFocusIn(){this.isInteractingWithTooltip=!0}isTooltipFocused(){let $=this.tooltipComp?.getGui(),z=d(this.beans);return!!$&&$.contains(z)}onTooltipFocusOut($){let z=this.tooltipCtrl.getGui();if(this.isTooltipFocused())return;if(this.isInteractingWithTooltip=!1,z.contains($.relatedTarget))this.startHideTimeout();else this.hideTooltip()}positionTooltip(){let $={type:"tooltip",ePopup:this.tooltipComp.getGui(),nudgeY:18,skipObserver:this.tooltipMouseTrack};if(this.lastMouseEvent)this.popupSvc?.positionPopupUnderMouseEvent({...$,mouseEvent:this.lastMouseEvent});else this.popupSvc?.positionPopupByComponent({...$,eventSource:this.tooltipCtrl.getGui(),position:"under",keepWithinBounds:!0,nudgeY:5})}destroyTooltipComp(){this.tooltipComp.getGui().classList.add("ag-tooltip-hiding");let $=this.tooltipPopupDestroyFunc,z=this.tooltipComp,Q=this.tooltipTrigger===0?NK:0;window.setTimeout(()=>{$(),this.destroyBean(z)},Q),this.clearTooltipListeners(),this.tooltipPopupDestroyFunc=void 0,this.tooltipComp=void 0}clearTooltipListeners(){for(let $ of[this.tooltipMouseEnterListener,this.tooltipMouseLeaveListener,this.tooltipFocusInListener,this.tooltipFocusOutListener])if($)$();this.tooltipMouseEnterListener=this.tooltipMouseLeaveListener=this.tooltipFocusInListener=this.tooltipFocusOutListener=null}lockService(){m1=!0,this.interactiveTooltipTimeoutId=window.setTimeout(()=>{this.unlockService(),this.setToDoNothing()},B6)}unlockService(){m1=!1,this.clearInteractiveTimeout()}startHideTimeout(){this.clearHideTimeout(),this.hideTooltipTimeoutId=window.setTimeout(this.hideTooltip.bind(this),this.getTooltipDelay("Hide"))}clearShowTimeout(){if(!this.showTooltipTimeoutId)return;window.clearTimeout(this.showTooltipTimeoutId),this.showTooltipTimeoutId=void 0}clearHideTimeout(){if(!this.hideTooltipTimeoutId)return;window.clearTimeout(this.hideTooltipTimeoutId),this.hideTooltipTimeoutId=void 0}clearInteractiveTimeout(){if(!this.interactiveTooltipTimeoutId)return;window.clearTimeout(this.interactiveTooltipTimeoutId),this.interactiveTooltipTimeoutId=void 0}clearTimeouts(){this.clearShowTimeout(),this.clearHideTimeout(),this.clearInteractiveTimeout()}},hK=class extends Z9{constructor($,z,Q){super($,Q);this.highlightTracker=z,this.onHighlight=this.onHighlight.bind(this)}postConstruct(){super.postConstruct(),this.wireHighlightListeners()}wireHighlightListeners(){this.addManagedPropertyListener("tooltipTrigger",({currentValue:$})=>{this.setTooltipMode($)}),this.setTooltipMode(this.gos.get("tooltipTrigger")),this.highlightTracker.addEventListener("itemHighlighted",this.onHighlight)}onHighlight($){if(this.tooltipMode!==1)return;if($.highlighted)this.attemptToShowTooltip();else this.attemptToHideTooltip()}setTooltipMode($="focus"){this.tooltipMode=$==="focus"?1:0}destroy(){this.highlightTracker.removeEventListener("itemHighlighted",this.onHighlight),super.destroy()}},uK=class extends a2{constructor(){super({tag:"div",cls:"ag-tooltip"})}init($){let{value:z}=$,Q=this.getGui();Q.textContent=J1(z);let J=$.location.replace(/([a-z])([A-Z0-9])/g,"$1-$2").toLowerCase();Q.classList.add(`ag-${J}-tooltip`)}},mK=".ag-tooltip{background-color:var(--ag-tooltip-background-color);border:var(--ag-tooltip-border);border-radius:var(--ag-border-radius);color:var(--ag-tooltip-text-color);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;white-space:normal;z-index:99999;&:where(.ag-cell-editor-tooltip),&:where(.ag-cell-formula-tooltip){background-color:var(--ag-tooltip-error-background-color);border:var(--ag-tooltip-error-border);color:var(--ag-tooltip-error-text-color);font-weight:500}}.ag-tooltip-custom{position:absolute;z-index:99999}.ag-tooltip-custom:where(:not(.ag-tooltip-interactive)),.ag-tooltip:where(:not(.ag-tooltip-interactive)){pointer-events:none}.ag-tooltip-animate{transition:opacity 1s;&:where(.ag-tooltip-hiding){opacity:0}}",c1=0,cK=200,pK=class extends R0{constructor(){super(...arguments);this.beanName="popupSvc",this.popupList=[]}postConstruct(){this.addManagedEventListeners({stylesChanged:this.handleThemeChange.bind(this)})}getPopupParent(){let $=this.gos.get("popupParent");if($)return $;return this.getDefaultPopupParent()}positionPopupUnderMouseEvent($){let{ePopup:z,nudgeX:Q,nudgeY:J,skipObserver:Z}=$;this.positionPopup({ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:!0,skipObserver:Z,updatePosition:()=>this.calculatePointerAlign($.mouseEvent),postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,$.type,$.ePopup,null,$.mouseEvent)})}calculatePointerAlign($){let z=this.getParentRect();return{x:$.clientX-z.left,y:$.clientY-z.top}}positionPopupByComponent($){let{ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:Z,eventSource:X,alignSide:Y="left",position:q="over",type:G}=$,_=X.getBoundingClientRect(),H=this.getParentRect();this.setAlignedTo(X,z);let U=()=>{let W=_.left-H.left;if(Y==="right")W-=z.offsetWidth-_.width;let B;if(q==="over")B=_.top-H.top,this.setAlignedStyles(z,"over");else if(this.setAlignedStyles(z,"under"),this.shouldRenderUnderOrAbove(z,_,H,$.nudgeY||0)==="under")B=_.top-H.top+_.height;else B=_.top-z.offsetHeight-(J||0)*2-H.top;return{x:W,y:B}};this.positionPopup({ePopup:z,nudgeX:Q,nudgeY:J,keepWithinBounds:Z,updatePosition:U,postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,G,z,X,null)})}positionPopupForMenu($){let{eventSource:z,ePopup:Q,event:J}=$,Z=z.getBoundingClientRect(),X=this.getParentRect();this.setAlignedTo(z,Q);let Y=!1,q=()=>{let G=this.keepXYWithinBounds(Q,Z.top-X.top,0),_=Q.clientWidth>0?Q.clientWidth:200;if(!Y)Q.style.minWidth=`${_}px`,Y=!0;let U=X.right-X.left-_,W;if(this.gos.get("enableRtl")){if(W=E(),W<0)W=B(),this.setAlignedStyles(Q,"left");if(W>U)W=0,this.setAlignedStyles(Q,"right")}else{if(W=B(),W>U)W=E(),this.setAlignedStyles(Q,"right");if(W<0)W=0,this.setAlignedStyles(Q,"left")}return{x:W,y:G};function B(){return Z.right-X.left-2}function E(){return Z.left-X.left-_}};this.positionPopup({ePopup:Q,keepWithinBounds:!0,updatePosition:q,postProcessCallback:()=>this.callPostProcessPopup($.additionalParams,"subMenu",Q,z,J instanceof MouseEvent?J:void 0)})}shouldRenderUnderOrAbove($,z,Q,J){let Z=Q.bottom-z.bottom,X=z.top-Q.top,Y=$.offsetHeight+J;if(Z>Y)return"under";if(X>Y||X>Z)return"above";return"under"}setAlignedStyles($,z){let Q=this.getPopupIndex($);if(Q===-1)return;let J=this.popupList[Q],{alignedToElement:Z}=J;if(!Z)return;let X=["right","left","over","above","under"];for(let Y of X)Z.classList.remove(`ag-has-popup-positioned-${Y}`),$.classList.remove(`ag-popup-positioned-${Y}`);if(!z)return;Z.classList.add(`ag-has-popup-positioned-${z}`),$.classList.add(`ag-popup-positioned-${z}`)}setAlignedTo($,z){let Q=this.getPopupIndex(z);if(Q!==-1){let J=this.popupList[Q];J.alignedToElement=$}}positionPopup($){let{ePopup:z,keepWithinBounds:Q,nudgeX:J,nudgeY:Z,skipObserver:X,updatePosition:Y}=$,q={width:0,height:0},G=(_=!1)=>{let{x:H,y:U}=Y();if(_&&z.clientWidth===q.width&&z.clientHeight===q.height)return;if(q.width=z.clientWidth,q.height=z.clientHeight,J)H+=J;if(Z)U+=Z;if(Q)H=this.keepXYWithinBounds(z,H,1),U=this.keepXYWithinBounds(z,U,0);if(z.style.left=`${H}px`,z.style.top=`${U}px`,$.postProcessCallback)$.postProcessCallback()};if(G(),!X){let _=F$(this.beans,z,()=>G(!0));setTimeout(()=>_(),cK)}}getParentRect(){let $=Y0(this.beans),z=this.getPopupParent();if(z===$.body)z=$.documentElement;else if(getComputedStyle(z).position==="static")z=z.offsetParent;return w6(z)}keepXYWithinBounds($,z,Q){let J=Q===0,Z=J?"clientHeight":"clientWidth",X=J?"top":"left",Y=J?"height":"width",q=J?"scrollTop":"scrollLeft",G=Y0(this.beans),_=G.documentElement,H=this.getPopupParent(),U=$.getBoundingClientRect(),W=H.getBoundingClientRect(),B=G.documentElement.getBoundingClientRect(),E=H===G.body,K=Math.ceil(U[Y]),D=E?(J?y6:x6)(_)+_[q]:H[Z];if(E)D-=Math.abs(B[X]-W[X]);let F=D-K;return Math.min(Math.max(z,0),Math.max(F,0))}addPopup($){let{eChild:z,ariaLabel:Q,ariaOwns:J,alwaysOnTop:Z,positionCallback:X,anchorToElement:Y}=$,q=this.getPopupIndex(z);if(q!==-1)return{hideFunc:this.popupList[q].hideFunc};this.initialisePopupPosition(z);let G=this.createPopupWrapper(z,!!Z,Q,J),_=this.addEventListenersToPopup({...$,wrapperEl:G});if(X)X();return this.addPopupToPopupList(z,G,_,Y),{hideFunc:_}}initialisePopupPosition($){let Q=this.getPopupParent().getBoundingClientRect();if(!T($.style.top))$.style.top=`${Q.top*-1}px`;if(!T($.style.left))$.style.left=`${Q.left*-1}px`}createPopupWrapper($,z,Q,J){let Z=this.getPopupParent(),{environment:X,gos:Y}=this.beans,q=K0({tag:"div"});if(X.applyThemeClasses(q),q.classList.add("ag-popup"),$.classList.add(Y.get("enableRtl")?"ag-rtl":"ag-ltr","ag-popup-child"),!$.hasAttribute("role"))_0($,"dialog");if(Q)E0($,Q);else if(J)$.id||($.id=`popup-component-${c1}`),U5(J,$.id);if(q.appendChild($),Z.appendChild(q),z)this.setAlwaysOnTop($,!0);else this.bringPopupToFront($);return q}addEventListenersToPopup($){let z=this.beans,Q=Y0(z),{wrapperEl:J,eChild:Z,closedCallback:X,afterGuiAttached:Y,closeOnEsc:q,modal:G,ariaOwns:_}=$,H=!1,U=(K)=>{if(!J.contains(d(z)))return;if(K.key===A.ESCAPE&&!this.isStopPropagation(K))E({keyboardEvent:K})},W=(K)=>E({mouseEvent:K}),B=(K)=>E({touchEvent:K}),E=(K={})=>{let{mouseEvent:L,touchEvent:D,keyboardEvent:F,forceHide:M}=K;if(!M&&(this.isEventFromCurrentPopup({mouseEvent:L,touchEvent:D},Z)||H))return;if(H=!0,J.remove(),Q.removeEventListener("keydown",U),Q.removeEventListener("mousedown",W),Q.removeEventListener("touchstart",B),Q.removeEventListener("contextmenu",W),this.eventSvc.removeListener("dragStarted",W),X)X(L||D||F);this.removePopupFromPopupList(Z,_)};if(Y)Y({hidePopup:E});return window.setTimeout(()=>{if(q)Q.addEventListener("keydown",U);if(G)Q.addEventListener("mousedown",W),this.eventSvc.addListener("dragStarted",W),Q.addEventListener("touchstart",B),Q.addEventListener("contextmenu",W)},0),E}addPopupToPopupList($,z,Q,J){if(this.popupList.push({element:$,wrapper:z,hideFunc:Q,instanceId:c1,isAnchored:!!J}),J)this.setPopupPositionRelatedToElement($,J);c1=c1+1}getPopupIndex($){return this.popupList.findIndex((z)=>z.element===$)}setPopupPositionRelatedToElement($,z){let Q=this.getPopupIndex($);if(Q===-1)return;let J=this.popupList[Q];if(J.stopAnchoringPromise)J.stopAnchoringPromise.then((X)=>X&&X());if(J.stopAnchoringPromise=void 0,J.isAnchored=!1,!z)return;let Z=this.keepPopupPositionedRelativeTo({element:z,ePopup:$,hidePopup:J.hideFunc});return J.stopAnchoringPromise=Z,J.isAnchored=!0,Z}removePopupFromPopupList($,z){if(this.setAlignedStyles($,null),this.setPopupPositionRelatedToElement($,null),z)U5(z,null);this.popupList=this.popupList.filter((Q)=>Q.element!==$)}keepPopupPositionedRelativeTo($){let z=this.getPopupParent(),Q=z.getBoundingClientRect(),{element:J,ePopup:Z}=$,X=J.getBoundingClientRect(),Y=(U)=>Number.parseInt(U.substring(0,U.length-1),10),q=(U,W)=>{let B=Q[U]-X[U],E=Y(Z.style[U]);return{initialDiff:B,lastDiff:B,initial:E,last:E,direction:W}},G=q("top",0),_=q("left",1),H=this.beans.frameworkOverrides;return new g((U)=>{H.wrapIncoming(()=>{qG(()=>{let W=z.getBoundingClientRect(),B=J.getBoundingClientRect();if(B.top==0&&B.left==0&&B.height==0&&B.width==0){$.hidePopup();return}let K=(L,D)=>{let F=Y(Z.style[D]);if(L.last!==F)L.initial=F,L.last=F;let M=W[D]-B[D];if(M!=L.lastDiff){let k=this.keepXYWithinBounds(Z,L.initial+L.initialDiff-M,L.direction);Z.style[D]=`${k}px`,L.last=k}L.lastDiff=M};K(G,"top"),K(_,"left")},200).then((W)=>{U(()=>{if(W!=null)window.clearInterval(W)})})},"popupPositioning")})}isEventFromCurrentPopup($,z){let{mouseEvent:Q,touchEvent:J}=$,Z=Q?Q:J;if(!Z)return!1;let X=this.getPopupIndex(z);if(X===-1)return!1;for(let Y=X;Y$.element)}hasAnchoredPopup(){return this.popupList.some(($)=>$.isAnchored)}isStopPropagation($){return z$($)}},nz={moduleName:"Popup",version:p,beans:[iK]};function KJ($){return $.get("tooltipShowMode")==="whenTruncated"}function tJ($,z){return KJ($)?iQ(z):void 0}var nK=($,z)=>{let Q=$;if(typeof Q.getTranslatedMessage==="function")return Q.getTranslatedMessage(z);return $.message},k2=($,z,Q)=>{let{editModelSvc:J}=$,Z=J?.getCellValidationModel()?.getCellValidation(z)?.errorMessages,X=J?.getRowValidationModel().getRowValidation(z)?.errorMessages,Y=Z||X;return Y?.length?Y.join(Q("tooltipValidationErrorSeparator",". ")):void 0},dK=($,z)=>{if(!KJ($.gos))return;if(z.isCellRenderer()){let J=z.column.getColDef();if(!(!!J.showRowGroup||J.cellRenderer==="agGroupCellRenderer"))return;return iQ(()=>{let X=z.eGui;return X.querySelector(".ag-group-value")||X.querySelector(".ag-cell-value")||X})}return iQ(()=>{let J=z.eGui;return J.children.length===0?J:J.querySelector(".ag-cell-value")})},tK=($,z,Q)=>{let{editSvc:J}=$,{column:Z}=z,X=dK($,z),Y=()=>{if(J?.isEditing(z))return!1;if(!X)return!0;if(!Z.isTooltipEnabled())return!1;return X()};return{shouldDisplayDefault:Y,shouldDisplayColumnTooltip:Y,shouldDisplayCustomTooltip:Q??Y}},sK=({beans:$,ctrl:z,value:Q,displayFunctions:J,translate:Z})=>{let{editSvc:X,formula:Y,gos:q}=$,{column:G,rowNode:_}=z;if(Y?.active&&G.isAllowFormula()){let L=Y.getFormulaError(G,_);if(L)return{value:nK(L,Z),location:"cellFormula",shouldDisplay:()=>!!Y?.getFormulaError(G,_)}}if(!X?.isEditing(z)){let L=k2($,z,Z);if(L)return{value:L,location:"cellEditor",shouldDisplay:()=>!X?.isEditing(z)&&!!k2($,z,Z)}}let{shouldDisplayCustomTooltip:U,shouldDisplayColumnTooltip:W}=J;if(Q!=null)return{value:Q,location:"cell",shouldDisplay:U};let B=G.getColDef(),E=_.data;if(B.tooltipField&&T(E))return{value:hQ(E,B.tooltipField,G.isTooltipFieldContainsDots()),location:"cell",shouldDisplay:W};let K=B.tooltipValueGetter;if(K)return{value:K(y(q,{location:"cell",colDef:G.getColDef(),column:G,rowIndex:z.cellPosition.rowIndex,node:_,data:_.data,value:z.value,valueFormatted:z.valueFormatted})),location:"cell",shouldDisplay:W};return null},rK=class extends S{constructor(){super(...arguments);this.beanName="tooltipSvc"}setupHeaderTooltip($,z,Q,J){if($)z.destroyBean($);let Z=this.gos,X=KJ(Z),{column:Y,eGui:q}=z,G=Y.getColDef();if(!J&&X&&!G.headerComponent)J=iQ(()=>q.querySelector(".ag-header-cell-text"));let _="header",H="header",U=this.beans.colNames.getDisplayNameForColumn(Y,H,!0),W=Q??U,B={getGui:()=>q,getLocation:()=>_,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(y(Z,{location:_,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:J,getAdditionalParams:()=>({column:Y,colDef:Y.getColDef()})},E=this.createTooltipFeature(B);if(E)E=z.createBean(E),z.setRefreshFunction("tooltip",()=>E.refreshTooltip());return E}setupHeaderGroupTooltip($,z,Q,J){if($)z.destroyBean($);let Z=this.gos,X=KJ(Z),{column:Y,eGui:q}=z,G=Y.getColGroupDef();if(!J&&X&&!G?.headerGroupComponent)J=iQ(()=>q.querySelector(".ag-header-group-text"));let _="headerGroup",H="header",U=this.beans.colNames.getDisplayNameForColumnGroup(Y,H),W=Q??U,B={getGui:()=>q,getLocation:()=>_,getTooltipValue:()=>Q??G?.headerTooltipValueGetter?.(y(Z,{location:_,colDef:G,column:Y,value:W,valueFormatted:U}))??G?.headerTooltip,shouldDisplayTooltip:J,getAdditionalParams:()=>{let K={column:Y};if(G)K.colDef=G;return K}},E=this.createTooltipFeature(B);return E?z.createBean(E):E}enableCellTooltipFeature($,z,Q){let{beans:J}=this,{column:Z,rowNode:X}=$,Y=tK(J,$,Q),q=this.getLocaleTextFunc(),G=null,_=()=>{return G=sK({beans:J,ctrl:$,value:z,displayFunctions:Y,translate:q}),G},U={getGui:()=>$.eGui,getLocation:()=>G?.location??"cell",getTooltipValue:()=>_()?.value,shouldDisplayTooltip:()=>{let W=G??_();if(!W)return!1;return W.shouldDisplay?W.shouldDisplay():!0},getAdditionalParams:()=>({column:Z,colDef:Z.getColDef(),rowIndex:$.cellPosition.rowIndex,node:X,data:X.data,valueFormatted:$.valueFormatted})};return this.createTooltipFeature(U,J)}setupFullWidthRowTooltip($,z,Q,J){let Z={getGui:()=>z.getFullWidthElement(),getTooltipValue:()=>Q,getLocation:()=>"fullWidthRow",shouldDisplayTooltip:J},X=this.beans,Y=X.context;if($)z.destroyBean($,Y);let q=this.createTooltipFeature(Z,X);if(!q)return;return z.createBean(q,Y)}setupCellEditorTooltip($,z){let{beans:Q}=this,{context:J}=Q,Z=z.getValidationElement?.(!0)||!z.isPopup?.()&&$.eGui;if(!Z)return;let X={getGui:()=>Z,getTooltipValue:()=>k2(Q,$,this.getLocaleTextFunc()),getLocation:()=>"cellEditor",shouldDisplayTooltip:()=>{let{editModelSvc:q}=Q,G=q?.getRowValidationModel()?.getRowValidationMap(),_=q?.getCellValidationModel()?.getCellValidationMap(),H=!!G&&G.size>0,U=!!_&&_.size>0;return H||U}},Y=this.createTooltipFeature(X,Q);if(!Y)return;return $.createBean(Y,J)}initCol($){let{colDef:z}=$;$.tooltipEnabled=T(z.tooltipField)||T(z.tooltipValueGetter)||T(z.tooltipComponent)}createTooltipFeature($,z){return this.beans.registry.createDynamicBean("tooltipFeature",!1,$,z)}},lK=class extends gK{createTooltipComp($,z){xG(this.beans.userCompFactory,$)?.newAgStackInstance().then(z)}setEventHandlers($){[this.onColumnMovedEventCallback]=this.addManagedEventListeners({columnMoved:$})}clearEventHandlers(){this.onColumnMovedEventCallback?.(),this.onColumnMovedEventCallback=void 0}},aK={moduleName:"Tooltip",version:p,beans:[rK],dynamicBeans:{tooltipFeature:Z9,highlightTooltipFeature:hK,tooltipStateManager:lK},userComponents:{agTooltipComponent:uK},dependsOn:[nz],css:[mK]};var oK=".ag-cell-inline-editing{border:var(--ag-cell-editing-border)!important;border-radius:var(--ag-border-radius);box-shadow:var(--ag-cell-editing-shadow);padding:0;z-index:1;.ag-cell-edit-wrapper,.ag-cell-editor,.ag-cell-wrapper,:where(.ag-cell-editor) .ag-input-field-input,:where(.ag-cell-editor) .ag-wrapper{height:100%;line-height:normal;min-height:100%;width:100%}&.ag-cell-editing-error{border-color:var(--ag-invalid-color)!important}}:where(.ag-popup-editor) .ag-large-text{background-color:var(--ag-background-color);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dropdown-shadow);padding:0}.ag-large-text-input{display:block;height:auto;padding:var(--ag-cell-horizontal-padding)}:where(.ag-rtl .ag-large-text-input) .ag-text-area-input{resize:none}:where(.ag-ltr) .ag-checkbox-edit{padding-left:var(--ag-cell-horizontal-padding)}:where(.ag-rtl) .ag-checkbox-edit{padding-right:var(--ag-cell-horizontal-padding)}:where(.ag-row.ag-row-editing-invalid .ag-cell-inline-editing){opacity:.8}.ag-popup-editor{position:absolute;-webkit-user-select:none;-moz-user-select:none;user-select:none}";var eK=class extends S8{constructor($,z="ag-text-field",Q="text"){super($,z,Q)}postConstruct(){if(super.postConstruct(),this.config.allowedCharPattern)this.preventDisallowedCharacters()}setValue($,z){let Q=this.eInput;if(Q.value!==$)Q.value=T($)?$:"";return super.setValue($,z)}setStartValue($){this.setValue($,!0)}setCustomValidity($){let z=this.eInput,Q=$.length>0;if(z.setCustomValidity($),Q)z.reportValidity();j6(z,Q)}preventDisallowedCharacters(){let $=new RegExp(`[${this.config.allowedCharPattern}]`),z=(Q)=>{if(!o7(Q))return;if(Q.key&&!$.test(Q.key))Q.preventDefault()};this.addManagedListeners(this.eInput,{keydown:z,paste:(Q)=>{if(Q.clipboardData?.getData("text")?.split("").some((Z)=>!$.test(Z)))Q.preventDefault()}})}},T4={selector:"AG-INPUT-TEXT-FIELD",component:eK};var $L=class extends nG{constructor($){super();this.cellEditorInput=$,this.eEditor=f}initialiseEditor($){let{cellEditorInput:z}=this;this.setTemplate({tag:"div",cls:"ag-cell-edit-wrapper",children:[z.getTemplate()]},z.getAgComponents());let{eEditor:Q}=this,{cellStartedEdit:J,eventKey:Z,suppressPreventDefault:X}=$;Q.getInputElement().setAttribute("title",""),z.init(Q,$);let Y,q=!0;if(J){if(this.focusAfterAttached=!0,Z===A.BACKSPACE||Z===A.DELETE)Y="";else if(Z&&Z.length===1)if(X)q=!1;else Y=Z;else if(Y=z.getStartValue(),Z!==A.F2)this.highlightAllOnFocus=!0}else this.focusAfterAttached=!1,Y=z.getStartValue();if(q&&Y!=null)Q.setStartValue(Y);this.addGuiEventListener("keydown",(G)=>{let{key:_}=G;if(_===A.PAGE_UP||_===A.PAGE_DOWN)G.preventDefault()})}afterGuiAttached(){let $=this.getLocaleTextFunc(),z=this.eEditor;if(z.setInputAriaLabel($("ariaInputEditor","Input Editor")),!this.focusAfterAttached)return;if(!cz())z.getFocusableElement().focus();let Q=z.getInputElement();if(this.highlightAllOnFocus)Q.select();else this.cellEditorInput.setCaret?.()}focusIn(){let{eEditor:$}=this,z=$.getFocusableElement(),Q=$.getInputElement();z.focus(),Q.select()}getValue(){return this.cellEditorInput.getValue()}agSetEditValue($){this.params.value=$;let z=this.cellEditorInput.getStartValue();this.eEditor.setStartValue(z??null)}isPopup(){return!1}getValidationElement(){return this.eEditor.getInputElement()}getValidationErrors(){return this.cellEditorInput.getValidationErrors()}};var zL={tag:"ag-input-text-field",ref:"eEditor",cls:"ag-cell-editor"},QL=class{constructor($){this.getLocaleTextFunc=$}getTemplate(){return zL}getAgComponents(){return[T4]}init($,z){this.eEditor=$,this.params=z;let Q=z.maxLength;if(Q!=null)$.setMaxLength(Q)}getValidationErrors(){let{params:$}=this,{maxLength:z,getValidationErrors:Q}=$,J=this.getValue(),Z=this.getLocaleTextFunc(),X=[];if(z!=null&&typeof J==="string"&&J.length>z)X.push(Z("maxLengthValidation",`Must be ${z} characters or fewer.`,[String(z)]));if(!X.length)X=null;if(Q)return Q({value:J,cellEditorParams:$,internalErrors:X});return X}getValue(){let{eEditor:$,params:z}=this,Q=$.getValue();if(!T(Q)&&!T(z.value))return z.value;return z.parseValue(Q)}getStartValue(){let $=this.params;return $.useFormatter||$.column.getColDef().refData?$.formatValue($.value):$.value}setCaret(){if(cz())this.eEditor.getInputElement().focus({preventScroll:!0});let $=this.eEditor,z=$.getValue(),Q=T(z)&&z.length||0;if(Q)$.getInputElement().setSelectionRange(Q,Q)}},K6=class extends $L{constructor(){super(new QL(()=>this.getLocaleTextFunc()))}};function JL($,z){return $.editModelSvc?.getEditRowDataValue(z,{checkSiblings:!0})}function ZL($){let z=$.editModelSvc?.getEditMap(),Q=[];return z?.forEach((J,Z)=>{let{rowIndex:X,rowPinned:Y}=Z;J.forEach((q,G)=>{let{editorValue:_,pendingValue:H,sourceValue:U,state:W}=q,B=B$(q),E=_??H;if(E===P0)E=void 0;let K={newValue:E,oldValue:U,state:W,column:G,colId:G.getColId(),colKey:G.getColId(),rowIndex:X,rowPinned:Y},L=W==="editing";if(L||!L&&B)Q.push(K)})}),Q}function XL($,z=!1){let{editSvc:Q}=$;if(Q?.isBatchEditing()){if(z){for(let J of $.editModelSvc?.getEditPositions()??[])if(J.state==="editing")Q.revertSingleCellEdit(J)}else $z($,{persist:!0});e$($,void 0,{cancel:z})}else Q?.stopEditing(void 0,{cancel:z,source:"edit",forceStop:!z,forceCancel:z})}function YL($,z){let Q=r($,z);return!!$.editSvc?.isEditing(Q)}function qL($,z){let{key:Q,colKey:J,rowIndex:Z,rowPinned:X}=z,{editSvc:Y,colModel:q}=$,G=q.getCol(J);if(!G){j(12,{colKey:J});return}let H=M0($,{rowIndex:Z,rowPinned:X||null,column:G});if(!H){j(290,{rowIndex:Z,rowPinned:X});return}if(!Y?.isCellEditable({rowNode:H,column:G},"api"))return;if(X==null)UK($,Z);HK($,J),Y?.startEditing({rowNode:H,column:G},{event:Q?new KeyboardEvent("keydown",{key:Q}):void 0,source:"api",editable:!0})}function GL($){return $.editSvc?.validateEdit()||null}var _L={tag:"div",cls:"ag-popup-editor",attrs:{tabindex:"-1"}},HL=class extends a2{constructor($){super(_L);this.params=$}postConstruct(){wz(this.gos,this.getGui(),"popupEditorWrapper",!0),this.addKeyDownListener()}addKeyDownListener(){let $=this.getGui(),z=this.params,Q=(J)=>{if(!H2(this.gos,J,z.node,z.column,!0))z.onKeyDown(J)};this.addManagedElementListeners($,{keydown:Q})}};function UL($,{column:z},Q,J,Z="ui"){if(Q instanceof KeyboardEvent&&(Q.key===A.TAB||Q.key===A.ENTER||Q.key===A.F2||Q.key===A.BACKSPACE&&J))return!0;if(Q?.shiftKey&&$.rangeSvc?.getCellRanges().length!=0)return!1;let Y=z?.getColDef(),q=WL($.gos,Y),G=Q?.type;if(G==="click"&&Q?.detail===1&&q===1)return!0;if(G==="dblclick"&&Q?.detail===2&&q===2)return!0;if(Z==="api")return!!J;return!1}function WL($,z){if($.get("suppressClickEdit")===!0)return 0;if($.get("singleClickEdit")===!0)return 1;if(z?.singleClickEdit)return 1;return 2}function rZ($,z){return $.editModelSvc?.hasEdits(z,{withOpenEditor:!0})??!1}function V2($,z){let{column:Q,rowNode:J}=z,Z=Q.getColDef();if(!J)return rZ($,z);let X=Z.editable;if(J.group&&Z.groupRowEditable!=null){if($.rowGroupingEditValueSvc?.isGroupCellEditable(J,Q))return!0;return rZ($,z)}if(Q.isColumnFunc(J,X))return!0;return rZ($,z)}function BL($,z,Q="ui"){let J=V2($,z);if(J||Q==="ui")return J;let{rowNode:Z,column:X}=z;for(let Y of $.colModel.getCols())if(Y!==X&&V2($,{rowNode:Z,column:Y}))return!0;return!1}var LJ=($,z=!1)=>{if($!==void 0)return B$($)||z&&$.state==="editing"};function X9($,z,Q=!1){return LJ($.editModelSvc?.getEdit(z),Q)}var Y9=($,z,Q)=>{if(!$)return;for(let J=0,Z=$.length;J{let G={rowNode:J,column:q};return X9(Q,G,!0)||q9(Q,G)||G9(Q,G)});this.applyStyle(X,Y);return}this.applyStyle(X)}applyStyle($=!1,z=!1){let Q=!!this.editSvc?.isBatchEditing(),J=this.gos.get("editType")==="fullRow";this.rowCtrl?.forEachGui(void 0,({rowComp:Z})=>{Z.toggleCss("ag-row-editing",J&&z),Z.toggleCss("ag-row-batch-edit",J&&z&&Q),Z.toggleCss("ag-row-inline-editing",z),Z.toggleCss("ag-row-not-inline-editing",!z),Z.toggleCss("ag-row-editing-invalid",J&&z&&$)})}},LL=({rowModel:$,pinnedRowModel:z,editModelSvc:Q},J)=>{let Z=new Set;$.forEachNode((X)=>J.has(X)&&Z.add(X)),z?.forEachPinnedRow("top",(X)=>J.has(X)&&Z.add(X)),z?.forEachPinnedRow("bottom",(X)=>J.has(X)&&Z.add(X));for(let X of J)if(!Z.has(X))Q.removeEdits({rowNode:X});return Z},DL=({editModelSvc:$},z,Q)=>{for(let J of z)$?.getEditRow(J)?.forEach((Z,X)=>!Q.has(X)&&$.removeEdits({rowNode:J,column:X}))},FL=($)=>()=>{let z=new Set($.colModel.getCols()),Q=$.editModelSvc.getEditMap(!0),J=new Set(Q.keys());DL($,LL($,J),z)},ML=new Set(["undo","redo","paste","bulk","rangeSvc"]),kL=new Set(["ui","api"]),_9={paste:"api",rangeSvc:"api",fillHandle:"api",cellClear:"api",bulk:"api"},VL=new Set(Object.keys(_9)),AL=new Set(["paste","rangeSvc","cellClear","redo","undo"]),lZ={cancel:!0,source:"api"},SL={cancel:!1,source:"api"},jz={checkSiblings:!0},l$={force:!0,suppressFlash:!0},RL={force:!0},jL=class extends S{constructor(){super(...arguments);this.beanName="editSvc",this.committing=!1,this.batch=!1,this.batchStartDispatched=!1,this.stopping=!1,this.rangeSelectionWhileEditing=0}postConstruct(){let{beans:$}=this;this.model=$.editModelSvc,this.valueSvc=$.valueSvc,this.rangeSvc=$.rangeSvc,this.addManagedPropertyListener("editType",({currentValue:J})=>{this.stopEditing(void 0,lZ),this.createStrategy(J)});let z=FL($),Q=()=>{let J=this.model.getCellValidationModel().getCellValidationMap().size>0,Z=this.model.getRowValidationModel().getRowValidationMap().size>0;if(J||Z)this.stopEditing(void 0,lZ);else if(this.isEditing())if(this.batch)e$($,this.model.getEditPositions());else this.stopEditing(void 0,SL);return!1};this.addManagedEventListeners({columnPinned:z,columnVisible:z,columnRowGroupChanged:z,rowExpansionStateChanged:z,pinnedRowsChanged:z,displayedRowsChanged:z,sortChanged:Q,filterChanged:Q,cellFocused:this.onCellFocused.bind(this)})}isBatchEditing(){return this.batch}startBatchEditing(){if(this.batch)return;this.batch=!0,this.batchStartDispatched=!1,this.stopEditing(void 0,lZ)}stopBatchEditing($){if(!this.batch)return;if($)this.stopEditing(void 0,$);if(this.batchStartDispatched)this.dispatchBatchStopped(new Map,!1);this.batch=!1,this.batchStartDispatched=!1}ensureBatchStarted(){if(!this.batch||this.batchStartDispatched)return;this.batchStartDispatched=!0,this.dispatchBatchEvent("batchEditingStarted",new Map)}createStrategy($){let{beans:z,gos:Q,strategy:J}=this,Z=L6(Q,$);if(J){if(J.beanName===Z)return J;this.destroyStrategy()}return this.strategy=this.createOptionalManagedBean(z.registry.createDynamicBean(Z,!0))}destroyStrategy(){if(!this.strategy)return;this.strategy.destroy(),this.strategy=this.destroyBean(this.strategy)}shouldStartEditing($,z,Q,J="ui"){let Z=UL(this.beans,$,z,Q,J);if(Z)this.strategy??(this.strategy=this.createStrategy());return Z}shouldStopEditing($,z,Q="ui"){return this.strategy?.shouldStop($,z,Q)??null}shouldCancelEditing($,z,Q="ui"){return this.strategy?.shouldCancel($,z,Q)??null}validateEdit(){return hE(this.beans)}isEditing($,z){return this.model.hasEdits($??void 0,z??jz)}isRowEditing($,z){return!!$&&this.model.hasRowEdits($,z)}enableRangeSelectionWhileEditing(){if(this.beans.rangeSvc&&this.gos.get("cellSelection"))this.rangeSelectionWhileEditing++}disableRangeSelectionWhileEditing(){this.rangeSelectionWhileEditing=Math.max(0,this.rangeSelectionWhileEditing-1)}isRangeSelectionEnabledWhileEditing(){return this.rangeSelectionWhileEditing>0}startEditing($,z){let{startedEdit:Q=!0,event:J=null,source:Z="ui",ignoreEventKey:X=!1,silent:Y}=z;if(this.strategy??(this.strategy=this.createStrategy()),!(z.editable??this.isCellEditable($,"api")))return;let G=r(this.beans,$);if(G&&!G.comp){z.editable=void 0,G.onCompAttachedFuncs.push(()=>this.startEditing($,z));return}let _=this.shouldStartEditing($,J,Q,Z);if(_===!1&&Z!=="api"){if(this.isEditing($))this.stopEditing();return}if(!this.batch&&this.shouldStopEditing($,void 0,Z)&&!z.continueEditing)this.stopEditing(void 0,{source:Z});if(_)this.ensureBatchStarted();this.strategy.start({position:$,event:J,source:Z,ignoreEventKey:X,startedEdit:Q,silent:Y})}stopEditing($,z){let Q=this.prepareStopContext($,z);if(!Q)return!1;this.stopping=!0;let J=!1,{edits:Z}=Q;try{let X=this.processStopRequest(Q);return J||(J=X.res),Z=X.edits,this.finishStopEditing({...Q,edits:Z,params:z,position:$,res:J}),J}finally{this.rangeSelectionWhileEditing=0,this.stopping=!1}}prepareStopContext($,z){let{event:Q=null,cancel:J=!1,source:Z="ui",forceCancel:X=!1,forceStop:Y=!1,commit:q=!1}=z||{};if(VL.has(Z)&&this.batch){if($?.rowNode&&$?.column)this.bulkRefreshCell($);return null}let G=this.committing?_9[Z]:Z;if(!(this.committing||this.isEditing($)||this.batch&&this.model.hasEdits($,jz))||!this.strategy||this.stopping)return null;let H=r(this.beans,$);if(H)H.onEditorAttachedFuncs=[];let U=!J&&(!!this.shouldStopEditing($,Q,G)||(this.committing||Z==="paste")&&!this.batch)||Y,W=J&&!!this.shouldCancelEditing($,Q,G)||X;return{cancel:J,cellCtrl:H,edits:this.model.getEditMap(!0),event:Q??null,forceCancel:X,forceStop:Y,commit:q,position:$,source:Z,treatAsSource:G,willCancel:W,willStop:U}}processStopRequest($){let{event:z,position:Q,willCancel:J,willStop:Z}=$;if(Z||J)return this.handleStopOrCancel($);if(this.shouldHandleMidBatchKey(z,Q))return{res:!1,edits:this.handleMidBatchKey(z,Q,$)};if($z(this.beans,{persist:!0}),this.batch)this.strategy?.cleanupEditors(Q);return{res:!1,edits:this.model.getEditMap()}}handleStopOrCancel($){let{beans:z,model:Q}=this,{cancel:J,commit:Z,edits:X,event:Y,source:q,willCancel:G,willStop:_}=$,H=!this.batch||!G;$z(z,{persist:H,isCancelling:G||J,isStopping:_});let U=Q.getEditMap(),B=!G&&(!this.batch||Z)?this.processEdits(U,q):[];if(J)this.strategy?.stopCancelled($.forceCancel);else this.strategy?.stopCommitted(Y,Z);this.clearValidationIfNoOpenEditors();for(let E of B)Q.clearEditValue(E);this.bulkRefreshMap(X);for(let E of Q.getEditPositions(U)){let K=r(z,E),L=B$(E);K?.refreshCell({force:!0,suppressFlash:!L})}return{res:_,edits:U}}shouldHandleMidBatchKey($,z){return $ instanceof KeyboardEvent&&this.batch&&!!this.strategy?.midBatchInputsAllowed(z)&&this.isEditing(z,{withOpenEditor:!0})}handleMidBatchKey($,z,Q){let{beans:J,model:Z}=this,{cellCtrl:X,edits:Y}=Q,{key:q}=$,G=q===A.ENTER,_=q===A.ESCAPE,H=q===A.TAB;if(G||H||_){if(G||H)$z(J,{persist:!0});else if(_&&X){let{rowNode:U,column:W}=X;if(this.batch&&U&&W){let B={rowNode:U,column:W};e$(J,[B],{silent:!0}),this.model.stop(B,!0,!0),r(J,B)?.refreshCell(l$)}else this.revertSingleCellEdit(X)}if(this.batch)this.strategy?.cleanupEditors();else e$(J,Z.getEditPositions(),{event:$,cancel:_});return $.preventDefault(),this.bulkRefreshMap(Y,{suppressFlash:!0}),Z.getEditMap()}return Y}finishStopEditing({cellCtrl:$,edits:z,params:Q,position:J,res:Z,commit:X,forceCancel:Y,willCancel:q,willStop:G}){let _=this.beans;if(Z&&J){if(!this.batch||X)this.model.removeEdits(J)}this.navigateAfterEdit(Q,$?.cellPosition),xQ(_),this.clearValidationIfNoOpenEditors();let{rowRenderer:H,formula:U}=_;if(q)H.refreshRows({rowNodes:Array.from(z.keys())});if(this.batch){if(U)U.refreshFormulas(!0);else H.refreshRows({suppressFlash:!0,force:!0});let W=G&&X;if(W||q&&Y)this.dispatchBatchStopped(z,W)}}dispatchBatchStopped($,z){let Q;if(z){if(Q=IE($),Q.size>0)this.ensureBatchStarted()}if(this.batchStartDispatched)this.batchStartDispatched=!1,this.dispatchBatchEvent("batchEditingStopped",Q??new Map)}clearValidationIfNoOpenEditors(){if(!this.model.hasEdits(void 0,{withOpenEditor:!0}))this.model.getCellValidationModel().clearCellValidationMap(),this.model.getRowValidationModel().clearRowValidationMap()}navigateAfterEdit($,z){if(!$||!z)return;let{event:Q,suppressNavigateAfterEdit:J}=$;if(!(Q instanceof KeyboardEvent)||J)return;let{key:X,shiftKey:Y}=Q,q=this.gos.get("enterNavigatesVerticallyAfterEdit");if(X!==A.ENTER||!q)return;let G=Y?A.UP:A.DOWN;this.beans.navigation?.navigateToNextCell(null,G,z,!1)}processEdits($,z){let Q=Array.from($.keys()),J=this.model.getCellValidationModel().getCellValidationMap().size>0||this.model.getRowValidationModel().getRowValidationMap().size>0,Z=[],{changeDetectionSvc:X}=this.beans;X?.beginDeferred();try{for(let Y of Q){let q=$.get(Y);for(let G of q.keys()){let _=q.get(G),H={rowNode:Y,column:G};if(B$(_)&&!J){let U=r(this.beans,H);if(!this.setNodeDataValue(Y,G,_.pendingValue,U,z))Z.push(H)}}}}finally{X?.endDeferred()}return Z}setNodeDataValue($,z,Q,J,Z="edit"){let X=kL.has(Z)?"edit":Z;if(J)J.suppressRefreshCell=!0;this.committing=!0;try{return $.setDataValue(z,Q,X)}finally{if(this.committing=!1,J)J.suppressRefreshCell=!1}}syncEditAfterCommit($,z){let Q=this.model.getEdit($);if(Q&&Q.state!=="editing")if(z)this.beans.editModelSvc?.setEdit($,{sourceValue:Q.pendingValue});else this.model.clearEditValue($)}setEditMap($,z){this.strategy??(this.strategy=this.createStrategy()),this.strategy?.setEditMap($,z),this.bulkRefreshMap($);let Q=l$;if(z?.forceRefreshOfEditCellsOnly)Q={...fL($),...l$};this.beans.rowRenderer.refreshCells(Q)}dispatchEditValuesChanged({rowNode:$,column:z},Q={}){if(!$||!z||!Q)return;let{pendingValue:J,sourceValue:Z}=Q,{rowIndex:X,rowPinned:Y,data:q}=$;this.beans.eventSvc.dispatchEvent({type:"cellEditValuesChanged",node:$,rowIndex:X,rowPinned:Y,column:z,source:"api",data:q,newValue:J,oldValue:Z,value:J,colDef:z.getColDef()})}bulkRefreshCell($,z){if(o(this.gos,this.beans.rowModel))this.refCell($,this.model.getEdit($),z)}bulkRefreshMap($,z){if(o(this.gos,this.beans.rowModel))$.forEach((Q,J)=>{for(let Z of Q.keys())this.refCell({rowNode:J,column:Z},Q.get(Z),z)})}refCell({rowNode:$,column:z},Q,J={}){let{beans:Z,gos:X}=this,Y=new Set([$]),q=new Set,G=$.pinnedSibling;if(G)Y.add(G);let _=$.sibling;if(_)q.add(_);let H=$.parent;while(H){if(H.sibling?.footer&&X.get("groupTotalRow"))q.add(H.sibling);else if(!H.parent&&H.sibling&&X.get("grandTotalRow"))q.add(H.sibling);else q.add(H);H=H.parent}for(let U of Y)this.dispatchEditValuesChanged({rowNode:U,column:z},Q);for(let U of Y)r(Z,{rowNode:U,column:z})?.refreshCell(J);for(let U of q){let W=r(Z,{rowNode:U,column:z});if(W){if(W.refreshCell(J),!J.force&&this.batch)W.editStyleFeature?.applyCellStyles?.()}}}stopAllEditing($=!1,z="ui"){if(this.isEditing())this.stopEditing(void 0,{cancel:$,source:z})}isCellEditable($,z="ui"){let{gos:Q,beans:J}=this,Z=$.rowNode;if(Z.group&&$.column.getColDef().groupRowEditable==null){if(Q.get("treeData")){if(!Z.data&&!Q.get("enableGroupEdit"))return!1}else if(!Q.get("enableGroupEdit"))return!1}let X=L6(Q)==="fullRow"?BL(J,$,z):V2(J,$);if(X)this.strategy??(this.strategy=this.createStrategy());return X}cellEditingInvalidCommitBlocks(){return this.gos.get("invalidEditValueMode")==="block"}checkNavWithValidation($,z,Q=!0){if(this.hasValidationErrors($)){let J=r(this.beans,$);if(this.cellEditingInvalidCommitBlocks()){if(z?.preventDefault?.(),Q){if(J&&!J.hasBrowserFocus())J.focusCell();J?.comp?.getCellEditor()?.focusIn?.()}return"block-stop"}if(J)this.revertSingleCellEdit(J);return"revert-continue"}return"continue"}revertSingleCellEdit($,z=!1){let Q=r(this.beans,$);if(!Q?.comp?.getCellEditor())return;if(e$(this.beans,[$],{silent:!0}),this.model.clearEditValue($),gz(this.beans,$,{silent:!0}),Yz(this.beans),Q?.refreshCell(l$),!z)return;Q?.focusCell(),Q?.comp?.getCellEditor()?.focusIn?.()}hasValidationErrors($){Yz(this.beans);let z=r(this.beans,$);if(z)z.refreshCell(l$),z.rowCtrl.rowEditStyleFeature?.applyRowStyles();let Q=!1;if($?.rowNode){if(Q||(Q=this.model.getRowValidationModel().hasRowValidation({rowNode:$.rowNode})),$.column)Q||(Q=this.model.getCellValidationModel().hasCellValidation({rowNode:$.rowNode,column:$.column}))}else Q||(Q=this.model.getCellValidationModel().getCellValidationMap().size>0),Q||(Q=this.model.getRowValidationModel().getRowValidationMap().size>0);return Q}moveToNextCell($,z,Q,J="ui"){let Z,X=this.isEditing(),Y=X&&this.checkNavWithValidation(void 0,Q)==="block-stop";if($ instanceof uQ&&X)Z=this.strategy?.moveToNextEditingCell($,z,Q,J,Y);if(Z===null)return Z;if(Z=Z||!!this.beans.focusSvc.focusedHeader,Z===!1&&!Y)this.stopEditing();return Z}getPendingEditValue($,z,Q){if(Q==="data")return;if(Q==="batch"&&!this.batch)return;let J=this.model.getEdit({rowNode:$,column:z},jz);if(!J)return;if(this.stopping&&!this.batch&&!J.editorState?.cellStartedEditing)return;if(Q==="edit"){let X=J.editorValue;if(X!=null&&X!==P0)return X}let Z=J.pendingValue;if(Z!==P0)return Z;return}getCellDataValue($){let z=this.model.getEdit($,jz);if(z){let Q=z.pendingValue;if(Q!==P0)return Q;let J=z.sourceValue;if(J!=null)return J}return this.valueSvc.getValue($.column,$.rowNode,"data")}addStopEditingWhenGridLosesFocus($){PE(this,this.beans,$)}createPopupEditorWrapper($){return new HL($)}batchResetToSourceValue($){if(!this.batch)return!1;let z=this.model.getEdit($);if(!z)return!1;let{pendingValue:Q,sourceValue:J,state:Z}=z;if(Q===J)return!1;if(Z==="editing")return!1;return this.dispatchEditValuesChanged($,{...z,pendingValue:J}),this.beans.editModelSvc?.removeEdits($),r(this.beans,$)?.refreshCell(l$),!0}setDataValue($,z,Q){try{let J=this.batch,Z=this.isEditing(J?void 0:$);if((!Z||this.committing)&&!J&&!AL.has(Q))return;if(!Z&&!J&&Q==="paste")return;if(Q==="batch"&&!J)return;if(Q==="edit"){if(Z&&this.applyEditorValue($,z))return!0;if(!J)return}if(this.strategy??(this.strategy=this.createStrategy()),Q==="batch"||Q==="edit")return this.applyDirectValue($,z,Q);let X=this.beans,Y;if(J)Y="ui";else if(this.committing)Y=Q??"api";else Y="api";if(!Q||ML.has(Q))return this.applyDirectValue($,z,Q);let q=this.applyExistingEdit($,z,Q,Y);if(q!==void 0)return q;return zQ(X,$,z,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing($,{source:Y,suppressNavigateAfterEdit:!0}),!0}finally{this.committing=!1}}applyExistingEdit($,z,Q,J){let Z=this.model.getEdit($);if(!Z)return;if(Z.pendingValue===z)return!1;if(Z.sourceValue!==z)return zQ(this.beans,$,z,Q,void 0,{persist:!0}),this.ensureBatchStarted(),this.stopEditing($,{source:J,suppressNavigateAfterEdit:!0}),!0;return this.beans.editModelSvc?.removeEdits($),this.ensureBatchStarted(),this.dispatchEditValuesChanged($,{...Z,pendingValue:z}),!0}applyEditorValue($,z){let Q=this.beans,J=r(Q,$),Z=J?.comp?.getCellEditor();if(!J||!Z)return!1;if(zQ(Q,$,z,"edit",void 0,{persist:!0}),J.editStyleFeature?.applyCellStyles?.(),"agSetEditValue"in Z)return Z.agSetEditValue(z),!0;if(Z.refresh&&J.editCompDetails)return Z.refresh({...J.editCompDetails.params,value:z}),!0;if(J.hasBrowserFocus())J.onEditorAttachedFuncs.push(()=>{let Y=r(this.beans,$);Y?.focusCell(!0),Y?.comp?.getCellEditor()?.focusIn?.()});return e$(Q,[$],{silent:!0,cancel:!0}),gz(Q,$,{silent:!0}),Yz(Q),r(Q,$)?.refreshCell(l$),!0}applyDirectValue($,z,Q){let J=this.beans;if(this.batch){if(Q==="batch"&&r(J,$)?.comp?.getCellEditor()){let{editModelSvc:Y,valueSvc:q}=J,{rowNode:G,column:_}=$;if(Y?.getEdit($)?.sourceValue===void 0)Y?.setEdit($,{sourceValue:q.getValue(_,G,"data")});Y?.setEdit($,{pendingValue:z})}else if(zQ(J,$,z,Q,void 0,{persist:!0}),Q!=="batch")this.cleanupEditors();return xQ(J),this.ensureBatchStarted(),this.bulkRefreshCell($),!0}zQ(J,$,z,Q,void 0,{persist:!0});let Z=r(J,$),X=this.setNodeDataValue($.rowNode,$.column,z,Z,Q);return this.syncEditAfterCommit($,X),xQ(J),r(J,$)?.refreshCell(X?RL:l$),X}handleColDefChanged($){bE(this.beans,$)}destroy(){this.model.clear(),this.destroyStrategy(),super.destroy()}prepDetailsDuringBatch($,z){let{model:Q}=this;if(!this.batch)return;if(!Q.hasRowEdits($.rowNode,jz))return;let{rowNode:Z}=$,{compDetails:X,valueToDisplay:Y}=z;if(X){let{params:q}=X;return q.data=Q.getEditRowDataValue(Z,jz),{compDetails:X}}return{valueToDisplay:Y}}cleanupEditors(){this.strategy?.cleanupEditors()}dispatchCellEvent($,z,Q,J){this.strategy?.dispatchCellEvent($,z,Q,J)}dispatchBatchEvent($,z){this.eventSvc.dispatchEvent(this.createBatchEditEvent($,z))}createBatchEditEvent($,z){return y(this.gos,{type:$,...$==="batchEditingStopped"?{changes:this.toEventChangeList(z)}:{}})}toEventChangeList($){return this.model.getEditPositions($).map((z)=>({rowIndex:z.rowNode.rowIndex,rowPinned:z.rowNode.rowPinned,columnId:z.column.getColId(),newValue:z.pendingValue,oldValue:z.sourceValue}))}applyBulkEdit({rowNode:$,column:z},Q){if(!Q||Q.length===0)return;let{beans:J,rangeSvc:Z,valueSvc:X}=this,{formula:Y}=J;$z(J,{persist:!0});let q=this.model.getEditMap(!0),G=q.get($)?.get(z)?.pendingValue,_=!1;if(!this.batch)this.eventSvc.dispatchEvent({type:"bulkEditingStarted"}),_=!0;let H=Y?.isFormula(G)??!1;Q.forEach((W)=>{let B=W.columns.some((E)=>E?.isAllowFormula());if(Z?.forEachRowInRange(W,(E)=>{let K=M0(J,E);if(K===void 0)return;let L=q.get(K)??new Map,D=G;for(let F of W.columns){if(!F)continue;let M=!!H&&F.isAllowFormula();if(this.isCellEditable({rowNode:K,column:F},"api")){let k=X.getValue(F,K,"data",!0),V=X.parseValue(F,K??null,D,k);if(Number.isNaN(V))V=null;L.set(F,{editorValue:void 0,pendingValue:V,sourceValue:k,state:"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}if(M)D=Y?.updateFormulaByOffset({value:D,columnDelta:1})}if(L.size>0)q.set(K,L);if(H&&B)G=Y?.updateFormulaByOffset({value:G,rowDelta:1})}),this.setEditMap(q),this.batch){this.cleanupEditors(),xQ(J),this.ensureBatchStarted();return}this.committing=!0;try{this.stopEditing(void 0,{source:"bulk"})}finally{if(this.committing=!1,_)this.eventSvc.dispatchEvent({type:"bulkEditingStopped",changes:this.toEventChangeList(q)})}});let U=r(J,{rowNode:$,column:z});if(U)U.focusCell(!0)}createCellStyleFeature($){return new EL($,this.beans)}createRowStyleFeature($){return new KL($,this.beans)}setEditingCells($,z){let{beans:Q}=this,{colModel:J,valueSvc:Z}=Q,X=new Map;for(let{colId:Y,column:q,colKey:G,rowIndex:_,rowPinned:H,newValue:U,state:W}of $){let B=Y?J.getCol(Y):G?J.getCol(G):q;if(!B)continue;let E=M0(Q,{rowIndex:_,rowPinned:H});if(!E)continue;let K=Z.getValue(B,E,"data",!0);if(!z?.forceRefreshOfEditCellsOnly&&!B$({pendingValue:U,sourceValue:K})&&W!=="editing")continue;let L=X.get(E);if(!L)L=new Map,X.set(E,L);if(U===void 0)U=P0;L.set(B,{editorValue:void 0,pendingValue:U,sourceValue:K,state:W??"changed",editorState:{isCancelAfterEnd:void 0,isCancelBeforeStart:void 0}})}this.setEditMap(X,z)}onCellFocused($){let z=r(this.beans,$);if(!z||!this.isEditing(z,jz))return;let Q=this.model.getEdit(z);if(!Q||!B$(Q))return;let Z=this.getLocaleTextFunc()("ariaPendingChange","Pending Change");this.beans.ariaAnnounce?.announceValue(Z,"pendingChange")}allowedFocusTargetOnValidation($){return r(this.beans,$)}};function fL($){return{rowNodes:$?Array.from($.keys()):void 0,columns:$?[...new Set(Array.from($.values()).flatMap((z)=>Array.from(z.keys())))]:void 0}}function L6($,z){return z??$.get("editType")??"singleCell"}var H9=class extends S{postConstruct(){this.model=this.beans.editModelSvc,this.editSvc=this.beans.editSvc,this.addManagedEventListeners({cellFocused:this.onCellFocusChanged?.bind(this),cellFocusCleared:this.onCellFocusChanged?.bind(this)})}clearEdits($){this.model.clearEditValue($)}onCellFocusChanged($){let z,Q=$.previousParams,{editSvc:J,beans:Z}=this,X=$.type==="cellFocused"?$.sourceEvent:null;if(Q)z=r(Z,Q);let{gos:Y,editModelSvc:q}=Z,G=$.type==="cellFocusCleared";if(J.isEditing(void 0,{withOpenEditor:!0})){let{column:_,rowIndex:H,rowPinned:U}=$,W={column:_,rowNode:M0(Z,{rowIndex:H,rowPinned:U})},B=Y.get("invalidEditValueMode")==="block";if(B)return;let E=!B,K=!!q?.getCellValidationModel().hasCellValidation(W),L=E&&K;if(!(Q||G?J.stopEditing(void 0,{cancel:L,source:G&&E?"api":void 0,event:X}):!0))if(J.isBatchEditing())J.cleanupEditors();else J.stopEditing(void 0,{source:"api"})}z?.refreshCell({suppressFlash:!0,force:!0})}stopCancelled($){let z=this.editSvc.isBatchEditing()&&!$;for(let Q of this.model.getEditPositions())$1(this.beans,Q,{cancel:!0},r(this.beans,Q)),this.model.stop(Q,z,!0);return!0}stopCommitted($,z){let Q=this.model.getEditPositions(),J={all:[],pass:[],fail:[]};for(let Y of Q)if(J.all.push(Y),(this.model.getCellValidationModel().getCellValidation(Y)?.errorMessages?.length??0)>0)J.fail.push(Y);else J.pass.push(Y);let Z=this.processValidationResults(J),X=this.editSvc.isBatchEditing()&&!z;for(let Y of Z.destroy)$1(this.beans,Y,{event:$},r(this.beans,Y)),this.model.stop(Y,X,!1);for(let Y of Z.keep){let q=r(this.beans,Y);if(!this.editSvc.cellEditingInvalidCommitBlocks()&&q)this.editSvc.revertSingleCellEdit(q)}return!0}cleanupEditors({rowNode:$}={},z){$z(this.beans,{persist:!1});let Q=this.model.getEditPositions(),J=[];if($){for(let Z of Q)if(Z.rowNode!==$)J.push(Z)}else for(let Z of Q)J.push(Z);e$(this.beans,J),xQ(this.beans,z)}setFocusOutOnEditor($){$.comp?.getCellEditor()?.focusOut?.()}setFocusInOnEditor($){let z=$.comp,Q=z?.getCellEditor();if(Q?.focusIn)Q.focusIn();else{let J=this.beans.gos.get("editType")==="fullRow";$.focusCell(J),$.onEditorAttachedFuncs.push(()=>z?.getCellEditor()?.focusIn?.())}}setupEditors($){let{event:z,ignoreEventKey:Q=!1,startedEdit:J,position:Z,cells:X=this.model.getEditPositions()}=$,Y=z instanceof KeyboardEvent&&!Q&&z.key||void 0;vE(this.beans,X,Z,Y,z,J)}dispatchCellEvent($,z,Q,J){let Z=r(this.beans,$);if(Z)this.eventSvc.dispatchEvent({...Z.createEvent(z??null,Q),...J})}dispatchRowEvent($,z,Q){if(Q)return;let J=BJ(this.beans,$);if(J)this.eventSvc.dispatchEvent(J.createRowEvent(z))}shouldStop($,z,Q="ui"){let J=this.editSvc.isBatchEditing();if(J&&Q==="api")return!0;if(J&&(Q==="ui"||Q==="edit"))return!1;if(Q==="api")return!0;if(z instanceof KeyboardEvent&&!J)return z.key===A.ENTER;return null}shouldCancel($,z,Q="ui"){let J=this.editSvc.isBatchEditing();if(z instanceof KeyboardEvent&&!J){if(z.key===A.ESCAPE)return!0}if(J&&Q==="api")return!0;if(Q==="api")return!0;return!1}setEditMap($,z){if(!z?.update)this.editSvc.stopEditing(void 0,{cancel:!0,source:"api"});let Q=[];if($.forEach((J,Z)=>{J.forEach((X,Y)=>{if(X.state==="editing")Q.push({...X,rowNode:Z,column:Y})})}),z?.update)$=new Map([...this.model.getEditMap(),...$]);if(this.model?.setEditMap($),Q.length>0){let J=Q.at(-1),Z=J.pendingValue===P0?void 0:J.pendingValue;this.start({position:J,event:new KeyboardEvent("keydown",{key:Z}),source:"api"});let X=r(this.beans,J);if(X)this.setFocusInOnEditor(X)}}destroy(){this.cleanupEditors(),super.destroy()}},OL=class extends H9{constructor(){super(...arguments);this.beanName="fullRow",this.startedRows=new Set}shouldStop($,z,Q="ui"){let{rowNode:J,beans:Z}=this,{rowNode:X}=$||{};if(!BJ(Z,{rowNode:J}))return!0;let q=super.shouldStop({rowNode:J},z,Q);if(q!==null)return q;if(!J)return!1;return X!==J}midBatchInputsAllowed({rowNode:$}){if(!$)return!1;return this.model.hasEdits({rowNode:$})}clearEdits($){this.model.clearEditValue($)}start($){let{position:z,silent:Q,startedEdit:J,event:Z,ignoreEventKey:X}=$,{rowNode:Y}=z,{beans:q,model:G,startedRows:_}=this;if(this.rowNode!==Y)super.cleanupEditors(z);let H=q.visibleCols.allCols,U=[],W=[];for(let B of H)if(B.isCellEditable(Y))W.push(B);if(W.length==0)return;if(!_.has(Y))this.dispatchRowEvent({rowNode:Y},"rowEditingStarted",Q),_.add(Y);for(let B of W){let E={rowNode:Y,column:B};U.push(E),G.start(E)}this.rowNode=Y,this.setupEditors({cells:U,position:z,startedEdit:J,event:Z,ignoreEventKey:X})}processValidationResults($){if($.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:$.all};return{destroy:$.all,keep:[]}}stopCancelled($){let{rowNode:z,model:Q}=this;if(z&&!Q.hasRowEdits(z))return!1;return super.stopCancelled($),this.cleanupEditors({rowNode:z},!0),this.rowNode=void 0,!0}stopCommitted($,z){let{rowNode:Q,beans:J,model:Z,editSvc:X}=this;if(Q&&!Z.hasRowEdits(Q))return!1;let Y=[];if(Z.getEditMap().forEach((q,G)=>{if(!q||q.size===0)return;for(let _ of q.values())if(B$(_)){Y.push(G);break}}),Yz(J),X.checkNavWithValidation({rowNode:Q})==="block-stop")return!1;if(super.stopCommitted($,z),z||!X.isBatchEditing())for(let q of Y)this.dispatchRowEvent({rowNode:q},"rowValueChanged");return this.cleanupEditors({rowNode:Q},!0),this.rowNode=void 0,!0}onCellFocusChanged($){let{rowIndex:z}=$,Q=$.previousParams;if(Q?.rowIndex===z||$.sourceEvent instanceof KeyboardEvent)return;let{beans:J,gos:Z,model:X}=this;if(J.editSvc?.isRangeSelectionEnabledWhileEditing())return;let Y=r(J,Q);if(Z.get("invalidEditValueMode")==="block"&&Y&&(X.getCellValidationModel().getCellValidation(Y)||X.getRowValidationModel().getRowValidation(Y)))return;super.onCellFocusChanged($)}cleanupEditors($={},z){super.cleanupEditors($,z);let{startedRows:Q}=this;for(let J of Q)this.dispatchRowEvent({rowNode:J},"rowEditingStopped"),this.destroyEditorsForRow(J);Q.clear()}destroyEditorsForRow($){let z=BJ(this.beans,{rowNode:$});if(!z)return;let Q={};for(let J of z.getAllCellCtrls())if(J.comp?.getCellEditor())$1(this.beans,J,Q,J)}moveToNextEditingCell($,z,Q,J="ui",Z=!1){let{beans:X,model:Y,gos:q,editSvc:G}=this,_=$.cellPosition,H;Y.suspend(!0);try{H=X.navigation?.findNextCellToFocusOn(_,{backwards:z,startEditing:!0,skipToNextEditableCell:!1})}finally{Y.suspend(!1)}if(H===!1)return null;if(H==null)return!1;let U=H.cellPosition,W=$.isCellEditable(),B=H.isCellEditable(),E=U&&_.rowIndex===U.rowIndex&&_.rowPinned===U.rowPinned;if(W)this.setFocusOutOnEditor($);this.restoreEditors();let K=q.get("suppressStartEditOnTab");if(B&&!Z)if(K)H.focusCell(!0,Q);else{if(!H.comp?.getCellEditor())gz(X,H,{event:Q,cellStartedEdit:!0});this.setFocusInOnEditor(H),H.focusCell(!1,Q)}else{if(B&&Z)this.setFocusInOnEditor(H);H.focusCell(!0,Q)}if(!E&&!Z){if(G?.stopEditing({rowNode:$.rowNode},{event:Q,forceStop:!0}),G?.isRowEditing($.rowNode,{withOpenEditor:!0}))this.cleanupEditors(H,!0);if(K)H.focusCell(!0,Q);else G.startEditing(H,{startedEdit:!0,event:Q,source:J,ignoreEventKey:!0,editable:B||void 0})}return $.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}restoreEditors(){let{beans:$,model:z}=this;z.getEditMap().forEach((Q,J)=>Q.forEach(({state:Z},X)=>{if(Z!=="editing")return;let Y=r($,{rowNode:J,column:X});if(Y&&!Y.comp?.getCellEditor())gz($,Y,{silent:!0})}))}destroy(){super.destroy(),this.rowNode=void 0,this.startedRows.clear()}},PL=class extends H9{constructor(){super(...arguments);this.beanName="singleCell"}shouldStop($,z,Q="ui"){let J=super.shouldStop($,z,Q);if(J!==null)return J;let Z=$?.rowNode,X=$?.column,Y=this.rowNode,q=this.column;if((!Y||!q)&&Z&&X)return null;if(Y!==Z||q!==X)return!0;if(!Y&&!q)return this.model.hasEdits(void 0,{withOpenEditor:!0});return!1}midBatchInputsAllowed($){return this.model.hasEdits($)}start($){let{position:z,startedEdit:Q,event:J,ignoreEventKey:Z}=$;if(this.rowNode!==z.rowNode||this.column!==z.column)super.cleanupEditors();this.rowNode=z.rowNode,this.column=z.column,this.model.start(z),this.setupEditors({cells:[z],position:z,startedEdit:Q,event:J,ignoreEventKey:Z})}dispatchRowEvent($,z,Q){}processValidationResults($){if($.fail.length>0&&this.editSvc.cellEditingInvalidCommitBlocks())return{destroy:[],keep:$.all};return{destroy:$.all,keep:[]}}stopCancelled($){return super.stopCancelled($),this.clearPosition()}stopCommitted($,z){return super.stopCommitted($,z),this.clearPosition()}clearPosition(){return this.rowNode=void 0,this.column=void 0,!0}onCellFocusChanged($){let{colModel:z,editSvc:Q}=this.beans,{rowIndex:J,column:Z,rowPinned:X}=$,Y=M0(this.beans,{rowIndex:J,rowPinned:X}),q=L2(Z),G=z.getCol(q),_=$.previousParams;if(_){let H=L2(_.column);if(_?.rowIndex===J&&H===q&&_?.rowPinned===X)return}if($.type=="cellFocused"&&(Q?.isRangeSelectionEnabledWhileEditing()||Q?.isEditing({rowNode:Y,column:G},{withOpenEditor:!0})))return;super.onCellFocusChanged($)}moveToNextEditingCell($,z,Q,J="ui",Z=!1){let X=this.beans.focusSvc.getFocusedCell();if(X)$=e0(this.beans,X)??$;let Y=$.cellPosition,q,G=this.beans.gos.get("editType")==="fullRow";if(G)this.model.suspend(!0);if(!Z)$.eGui.focus(),this.editSvc?.stopEditing($,{source:this.editSvc?.isBatchEditing()?"ui":"api",event:Q});try{q=this.beans.navigation?.findNextCellToFocusOn(Y,{backwards:z,startEditing:!0})}finally{if(G)this.model.suspend(!1)}if(q===!1)return null;if(q==null)return!1;let _=q.cellPosition,H=$.isCellEditable(),U=q.isCellEditable(),W=_&&Y.rowIndex===_.rowIndex&&Y.rowPinned===_.rowPinned;if(H&&!Z)this.setFocusOutOnEditor($);let B=this.gos.get("suppressStartEditOnTab"),E=!1;if(!W&&!Z)if(super.cleanupEditors(q,!0),B)q.focusCell(!0,Q);else E=!0,this.editSvc.startEditing(q,{startedEdit:!0,event:Q,source:J,ignoreEventKey:!0,editable:U});if(U&&!Z){if(q.focusCell(!1,Q),B)q.focusCell(!0,Q);else if(!q.comp?.getCellEditor()){if(!E){let K=this.editSvc?.isEditing(q,{withOpenEditor:!0});gz(this.beans,q,{event:Q,cellStartedEdit:!0,silent:K})}this.setFocusInOnEditor(q),this.cleanupEditors(q)}}else{if(U&&Z)this.setFocusInOnEditor(q);q.focusCell(!0,Q)}return $.rowCtrl?.refreshRow({suppressFlash:!0,force:!0}),!0}destroy(){super.destroy(),this.rowNode=void 0,this.column=void 0}},TL={moduleName:"EditCore",version:p,beans:[OE,jL],apiFunctions:{getEditingCells:ZL,getEditRowValues:JL,getCellEditorInstances:TE,startEditingCell:qL,stopEditing:XL,isEditing:YL,validateEdit:GL},dynamicBeans:{singleCell:PL,fullRow:OL},dependsOn:[nz,aK],css:[oK]};var U9={moduleName:"TextEditor",version:p,userComponents:{agCellEditor:K6,agTextCellEditor:K6},dependsOn:[TL]};var W9={agSetColumnFilter:"agSetColumnFilterHandler",agMultiColumnFilter:"agMultiColumnFilterHandler",agGroupColumnFilter:"agGroupColumnFilterHandler",agNumberColumnFilter:"agNumberColumnFilterHandler",agBigIntColumnFilter:"agBigIntColumnFilterHandler",agDateColumnFilter:"agDateColumnFilterHandler",agTextColumnFilter:"agTextColumnFilterHandler"},vL=new Set(Object.values(W9));function a$($,z){let Q=$.filterUi;if(!Q)return null;if(Q.created)return Q.promise;if(z)return null;let J=Q.create(Q.refreshed),Z=Q;return Z.created=!0,Z.promise=J,J}function sJ($,z,Q,J,Z,X,Y){return z.refresh?.({...Q,model:J,source:X,additionalEventAttributes:Y}),$().then((q)=>{if(q){let{filter:G,filterParams:_}=q;SQ(G,_,J,Z,X,Y)}})}function SQ($,z,Q,J,Z,X){$?.refresh?.({...z,model:Q,state:J,source:Z,additionalEventAttributes:X})}function B9($,z,Q,J){let Z=$();if(Z?.created)Z.promise.then((X)=>{let Y=z();SQ(X,Z.filterParams,Y,Q()??{model:Y},"ui",J)})}function DJ($){let z,Q=!1,J,{action:Z,filterParams:X,getFilterUi:Y,getModel:q,getState:G,updateState:_,updateModel:H,processModelToApply:U}=$;switch(Z){case"apply":{let W=G();if(J=W?.model??null,U)J=U(J);z={state:W?.state,model:J},Q=!0;break}case"clear":{if(z={model:null},!X?.buttons?.includes("apply"))Q=!0,J=null;break}case"reset":{z={model:null},Q=!0,J=null;break}case"cancel":{z={model:q()};break}}if(_(z),Q)H(J);else B9(Y,q,G,{fromAction:Z})}function D0($,z){return $[z]??null}var IL=class extends Y4{constructor(){super(...arguments);this.iconCreated=!1}wireComp($,z,Q,J,Z){this.comp=$;let X=B1(this,this.beans.context,Z);this.eButtonShowMainFilter=Q,this.eFloatingFilterBody=J,this.setGui(z,X),this.setupActive(),this.refreshHeaderStyles(),this.setupWidth(X),this.setupLeft(X),this.setupHover(X),this.setupFocus(X),this.setupAria(),this.setupFilterButton(),this.setupUserComp(),this.setupSyncWithFilter(X),this.setupUi(),X.addManagedElementListeners(this.eButtonShowMainFilter,{click:this.showParentFilter.bind(this)}),this.setupFilterChangedListener(X);let Y=()=>this.onColDefChanged(X);X.addManagedListeners(this.column,{colDefChanged:Y}),X.addManagedEventListeners({filterSwitched:({column:q})=>{if(q===this.column)Y()}}),X.addDestroyFunc(()=>{this.eButtonShowMainFilter=null,this.eFloatingFilterBody=null,this.userCompDetails=null,this.clearComponent()})}resizeHeader(){}moveHeader(){}getHeaderClassParams(){let{column:$,beans:z}=this,Q=$.colDef;return y(z.gos,{colDef:Q,column:$,floatingFilter:!0})}setupActive(){let $=this.column.getColDef(),z=!!$.filter,Q=!!$.floatingFilter;this.active=z&&Q}setupUi(){if(this.comp.setButtonWrapperDisplayed(!this.suppressFilterButton&&this.active),this.comp.addOrRemoveBodyCssClass("ag-floating-filter-full-body",this.suppressFilterButton),this.comp.addOrRemoveBodyCssClass("ag-floating-filter-body",!this.suppressFilterButton),!this.active||this.iconCreated)return;let $=h("filter",this.beans,this.column);if($)this.iconCreated=!0,this.eButtonShowMainFilter.appendChild($)}setupFocus($){$.createManagedBean(new c$(this.eGui,{shouldStopEventPropagation:this.shouldStopEventPropagation.bind(this),onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this),onFocusIn:this.onFocusIn.bind(this)}))}setupAria(){let $=this.getLocaleTextFunc();E0(this.eButtonShowMainFilter,$("ariaFilterMenuOpen","Open Filter Menu"))}onTabKeyDown($){let{beans:z}=this;if(d(z)===this.eGui)return;let Z=j0(z,this.eGui,null,$.shiftKey);if(Z){z.headerNavigation?.scrollToColumn(this.column),$.preventDefault(),Z.focus();return}let X=this.findNextColumnWithFloatingFilter($.shiftKey);if(!X)return;if(z.focusSvc.focusHeaderPosition({headerPosition:{headerRowIndex:this.rowCtrl.rowIndex,column:X},event:$}))$.preventDefault()}findNextColumnWithFloatingFilter($){let z=this.beans.visibleCols,Q=this.column;do if(Q=$?z.getColBefore(Q):z.getColAfter(Q),!Q)break;while(!Q.getColDef().filter||!Q.getColDef().floatingFilter);return Q}handleKeyDown($){super.handleKeyDown($);let z=this.getWrapperHasFocus();switch($.key){case A.UP:case A.DOWN:case A.LEFT:case A.RIGHT:if(z)return;i0($);case A.ENTER:if(z){if(F0(this.eGui))$.preventDefault()}break;case A.ESCAPE:if(!z)this.eGui.focus()}}onFocusIn($){if(this.eGui.contains($.relatedTarget))return;let Q=!!$.relatedTarget&&!$.relatedTarget.classList.contains("ag-floating-filter"),J=!!$.relatedTarget&&vz($.relatedTarget,"ag-floating-filter");if(Q&&J&&$.target===this.eGui){let Z=this.lastFocusEvent,X=!!(Z&&Z.key===A.TAB);if(Z&&X){let Y=Z.shiftKey;F0(this.eGui,Y)}}this.focusThis()}setupHover($){this.beans.colHover?.addHeaderFilterColumnHoverListener($,this.comp,this.column,this.eGui)}setupLeft($){let z=new X4(this.column,this.eGui,this.beans);$.createManagedBean(z)}setupFilterButton(){this.suppressFilterButton=!this.beans.menuSvc?.isFloatingFilterButtonEnabled(this.column),this.highlightFilterButtonWhenActive=!U0(this.gos)}setupUserComp(){if(!this.active)return;let $=this.beans.colFilter?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter());if($)this.setCompDetails($)}setCompDetails($){this.userCompDetails=$,this.comp.setCompDetails($)}showParentFilter(){let $=this.suppressFilterButton?this.eFloatingFilterBody:this.eButtonShowMainFilter;this.beans.menuSvc?.showFilterMenu({column:this.column,buttonElement:$,containerType:"floatingFilter",positionBy:"button"})}setupSyncWithFilter($){if(!this.active)return;let{beans:{colFilter:z},column:Q,gos:J}=this,Z=(X)=>{if(X?.source==="filterDestroyed"&&(!this.isAlive()||!z?.isAlive()))return;let Y=this.comp.getFloatingFilterComp();if(!Y)return;Y.then((q)=>{if(q){if(J.get("enableFilterHandlers")){let H=X,U="filter";if(H?.afterFloatingFilter)U="ui";else if(H?.afterDataChange)U="dataChanged";else if(X?.source==="api")U="api";this.updateFloatingFilterParams(this.userCompDetails,U);return}let G=z?.getCurrentFloatingFilterParentModel(Q),_=X?{...X,columns:X.columns??[],source:X.source==="api"?"api":"columnFilter"}:null;q.onParentModelChanged(G,_)}})};if([this.destroySyncListener]=$.addManagedListeners(Q,{filterChanged:Z}),z?.isFilterActive(Q))Z(null)}setupWidth($){let z=()=>{let Q=`${this.column.getActualWidth()}px`;this.comp.setWidth(Q)};$.addManagedListeners(this.column,{widthChanged:z}),z()}setupFilterChangedListener($){if(this.active)[this.destroyFilterChangedListener]=$.addManagedListeners(this.column,{filterChanged:this.updateFilterButton.bind(this)}),this.updateFilterButton()}updateFilterButton(){if(!this.suppressFilterButton&&this.comp){let $=!!this.beans.filterManager?.isFilterAllowed(this.column);if(this.comp.setButtonWrapperDisplayed($),this.highlightFilterButtonWhenActive&&$)this.eButtonShowMainFilter.classList.toggle("ag-filter-active",this.column.isFilterActive())}}onColDefChanged($){let z=this.active;this.setupActive();let Q=!z&&this.active;if(z&&!this.active)this.destroySyncListener(),this.destroyFilterChangedListener();let J=this.beans.colFilter,Z=this.active?J?.getFloatingFilterCompDetails(this.column,()=>this.showParentFilter()):null,X=this.comp.getFloatingFilterComp();if(!X||!Z)this.updateCompDetails($,Z,Q);else X.then((Y)=>{if(!Y||J?.areFilterCompsDifferent(this.userCompDetails??null,Z))this.updateCompDetails($,Z,Q);else this.updateFloatingFilterParams(Z,"colDef")})}updateCompDetails($,z,Q){if(!this.isAlive())return;if(this.setCompDetails(z),this.setupFilterButton(),this.setupUi(),Q)this.setupSyncWithFilter($),this.setupFilterChangedListener($)}updateFloatingFilterParams($,z){if(!$)return;let Q=$.params;this.comp.getFloatingFilterComp()?.then((J)=>{if(typeof J?.refresh==="function"){if(this.gos.get("enableFilterHandlers"))Q={...Q,model:D0(this.beans.colFilter?.model??{},this.column.getColId()),source:z};J.refresh(Q)}})}addResizeAndMoveKeyboardListeners(){}destroy(){super.destroy(),this.destroySyncListener=null,this.destroyFilterChangedListener=null}};function CL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}$.menuSvc?.showColumnMenu({column:Q,positionBy:"auto"})}function bL($){$.menuSvc?.hidePopupMenu()}var yL=class extends S{constructor(){super(...arguments);this.beanName="menuSvc"}postConstruct(){let{enterpriseMenuFactory:$,filterMenuFactory:z}=this.beans;this.activeMenuFactory=$??z}showColumnMenu($){this.showColumnMenuCommon(this.activeMenuFactory,$,"columnMenu")}showFilterMenu($){this.showColumnMenuCommon(D6(this.beans),$,$.containerType,!0)}showHeaderContextMenu($,z,Q){this.activeMenuFactory?.showMenuAfterContextMenuEvent($,z,Q)}hidePopupMenu(){this.beans.contextMenuSvc?.hideActiveMenu(),this.activeMenuFactory?.hideActiveMenu()}hideFilterMenu(){D6(this.beans)?.hideActiveMenu()}isColumnMenuInHeaderEnabled($){let{suppressHeaderMenuButton:z}=$.getColDef();return!z&&!!this.activeMenuFactory?.isMenuEnabled($)&&(U0(this.gos)||!!this.beans.enterpriseMenuFactory)}isFilterMenuInHeaderEnabled($){return!$.getColDef().suppressHeaderFilterButton&&!!this.beans.filterManager?.isFilterAllowed($)}isHeaderContextMenuEnabled($){return!($&&Q$($)?$.getColDef():$?.getColGroupDef())?.suppressHeaderContextMenu&&this.gos.get("columnMenu")==="new"}isHeaderMenuButtonAlwaysShowEnabled(){return this.isSuppressMenuHide()}isHeaderMenuButtonEnabled(){let $=!this.isSuppressMenuHide();return!(bz()&&$)}isHeaderFilterButtonEnabled($){return this.isFilterMenuInHeaderEnabled($)&&!U0(this.gos)&&!this.isFloatingFilterButtonDisplayed($)}isFilterMenuItemEnabled($){return!!this.beans.filterManager?.isFilterAllowed($)&&!U0(this.gos)&&!this.isFilterMenuInHeaderEnabled($)&&!this.isFloatingFilterButtonDisplayed($)}isFloatingFilterButtonEnabled($){return!$.getColDef().suppressFloatingFilterButton}isFloatingFilterButtonDisplayed($){return!!$.getColDef().floatingFilter&&this.isFloatingFilterButtonEnabled($)}isSuppressMenuHide(){let $=this.gos,z=$.get("suppressMenuHide");if(U0($))return $.exists("suppressMenuHide")?z:!1;return z}showColumnMenuCommon($,z,Q,J){let{positionBy:Z,onClosedCallback:X}=z,Y=z.column;if(Z==="button"){let{buttonElement:q}=z;$?.showMenuAfterButtonClick(Y,q,Q,X,J)}else if(Z==="mouse"){let{mouseEvent:q}=z;$?.showMenuAfterMouseEvent(Y,q,Q,X,J)}else if(Y){let q=this.beans,G=q.ctrlsSvc;G.getScrollFeature().ensureColumnVisible(Y,"auto"),Y$(q,()=>{let _=G.getHeaderRowContainerCtrl(Y.getPinned())?.getHeaderCtrlForColumn(Y);if(_)$?.showMenuAfterButtonClick(Y,_.getAnchorElementForMenu(J),Q,X,J)})}}};function z1($,z,Q){if($.menuVisible!==z)$.menuVisible=z,$.dispatchColEvent("menuVisibleChanged",Q)}function D6($){let{enterpriseMenuFactory:z,filterMenuFactory:Q,gos:J}=$;return z&&U0(J)?z:Q}var v4={moduleName:"SharedMenu",version:p,beans:[yL],apiFunctions:{showColumnMenu:CL,hidePopupMenu:bL}},xL=".ag-set-filter{--ag-indentation-level:0}.ag-set-filter-item{align-items:center;display:flex;height:100%}:where(.ag-ltr) .ag-set-filter-item{padding-left:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}:where(.ag-rtl) .ag-set-filter-item{padding-right:calc(var(--ag-widget-container-horizontal-padding) + var(--ag-indentation-level)*var(--ag-set-filter-indent-size))}.ag-set-filter-item-checkbox{display:flex;height:100%;width:100%}.ag-set-filter-group-icons{display:block;:where(.ag-set-filter-group-closed-icon),:where(.ag-set-filter-group-indeterminate-icon),:where(.ag-set-filter-group-opened-icon){cursor:pointer}}:where(.ag-ltr) .ag-set-filter-group-icons{margin-right:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-set-filter-group-icons{margin-left:var(--ag-widget-container-horizontal-padding)}.ag-filter-body-wrapper{display:flex;flex-direction:column}:where(.ag-menu:not(.ag-tabs) .ag-filter) .ag-filter-body-wrapper{min-width:180px}.ag-filter-filter{flex:1 1 0px}.ag-filter-condition{display:flex;justify-content:center}.ag-floating-filter-body{display:flex;flex:1 1 auto;height:100%;position:relative}.ag-floating-filter-full-body{align-items:center;display:flex;flex:1 1 auto;height:100%;overflow:hidden;width:100%}.ag-floating-filter-input{align-items:center;display:flex;width:100%;>:where(.ag-date-floating-filter-wrapper),>:where(.ag-floating-filter-input),>:where(.ag-input-field){flex:1 1 auto}:where(.ag-input-field-input[type=date]),:where(.ag-input-field-input[type=datetime-local]){width:1px}}.ag-floating-filter-button{display:flex;flex:none}.ag-date-floating-filter-wrapper{display:flex}.ag-set-floating-filter-input :where(.ag-input-field-input)[disabled]{pointer-events:none}.ag-floating-filter-button-button{-webkit-appearance:none;-moz-appearance:none;appearance:none;border:none;height:var(--ag-icon-size);width:var(--ag-icon-size)}.ag-filter-loading{align-items:unset;background-color:var(--ag-chrome-background-color);height:100%;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);position:absolute;width:100%;z-index:1;:where(.ag-menu) &{background-color:var(--ag-menu-background-color)}}.ag-filter-separator{border-top:solid var(--ag-border-width) var(--menu-separator-color)}:where(.ag-filter-select) .ag-picker-field-wrapper{width:0}.ag-filter-condition-operator{height:17px}:where(.ag-ltr) .ag-filter-condition-operator-or{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-condition-operator-or{margin-right:calc(var(--ag-spacing)*2)}.ag-set-filter-select-all{padding-top:var(--ag-widget-container-vertical-padding)}.ag-filter-no-matches,.ag-set-filter-list{height:calc(var(--ag-list-item-height)*6)}.ag-filter-no-matches{padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}.ag-set-filter-tree-list{height:calc(var(--ag-list-item-height)*10)}.ag-set-filter-filter{margin-left:var(--ag-widget-container-horizontal-padding);margin-right:var(--ag-widget-container-horizontal-padding);margin-top:var(--ag-widget-container-vertical-padding)}.ag-filter-to{margin-top:var(--ag-widget-vertical-spacing)}.ag-mini-filter{margin:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}:where(.ag-ltr) .ag-set-filter-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-rtl) .ag-set-filter-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-widget-container-horizontal-padding))}:where(.ag-filter-menu) .ag-set-filter-list{min-width:200px}.ag-filter-virtual-list-item:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-filter-apply-panel{display:flex;justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-vertical-spacing) var(--ag-widget-container-horizontal-padding) var(--ag-widget-container-vertical-padding)}.ag-filter-apply-panel-button{line-height:1.5}:where(.ag-ltr) .ag-filter-apply-panel-button{margin-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-filter-apply-panel-button{margin-right:calc(var(--ag-spacing)*2)}.ag-simple-filter-body-wrapper{display:flex;flex-direction:column;gap:var(--ag-widget-vertical-spacing);min-height:calc(var(--ag-list-item-height) + var(--ag-widget-container-vertical-padding) + var(--ag-widget-vertical-spacing));overflow-y:auto;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding);padding-bottom:var(--ag-widget-container-vertical-padding);:where(.ag-resizer-wrapper){margin:0}}.ag-multi-filter-menu-item{margin:var(--ag-spacing) 0}.ag-multi-filter-group-title-bar{background-color:transparent;color:var(--ag-header-text-color);font-weight:500;padding:calc(var(--ag-spacing)*1.5) var(--ag-spacing)}.ag-group-filter-field-select-wrapper{display:flex;flex-direction:column;gap:var(--ag-widget-vertical-spacing);padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding)}";function wL($){let z=$.filterManager;return!!z?.isColumnFilterPresent()||!!z?.isAggregateFilterPresent()}function NL($,z){return $.filterManager?.getColumnFilterInstance(z)??Promise.resolve(void 0)}function gL($,z){let Q=$.colModel.getColDefCol(z);if(Q)return $.colFilter?.destroyFilter(Q,"api")}function hL($,z){$.frameworkOverrides.wrapIncoming(()=>$.filterManager?.setFilterModel(z))}function uL($){return $.filterManager?.getFilterModel()??{}}function mL($,z,Q){let{gos:J,colModel:Z,colFilter:X}=$;if(Q&&!J.get("enableFilterHandlers"))j(288),Q=!1;let Y=Z.getColDefCol(z);return Y?X?.getModelForColumn(Y,Q)??null:null}function cL($,z,Q){return $.filterManager?.setColumnFilterModel(z,Q)??Promise.resolve()}function pL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}$.menuSvc?.showFilterMenu({column:Q,containerType:"columnFilter",positionBy:"auto"})}function iL($){$.menuSvc?.hideFilterMenu()}function nL($,z){let Q=$.colModel.getCol(z);if(!Q){e(12,{colKey:z});return}return $.colFilter?.getHandler(Q,!0)}function dL($,z){let{colModel:Q,colFilter:J,gos:Z}=$;if(!Z.get("enableFilterHandlers")){j(287);return}let{colId:X,action:Y}=z;if(X){let q=Q.getColById(X);if(q)J?.updateModel(q,Y)}else J?.updateAllModels(Y)}var F6={january:"January",february:"February",march:"March",april:"April",may:"May",june:"June",july:"July",august:"August",september:"September",october:"October",november:"November",december:"December"},M6=["january","february","march","april","may","june","july","august","september","october","november","december"];function tL($,z){if($==null)return-1;if(z==null)return 1;return Number.parseFloat($)-Number.parseFloat(z)}function sL($,z){if($==null)return-1;if(z==null)return 1;let Q=Gz($),J=Gz(z);if(Q!=null&&J!=null){if(Q===J)return 0;return Q>J?1:-1}return String($).localeCompare(String(z))}function k6($){return $ instanceof Date&&!isNaN($.getTime())}var A2={number:()=>{return},bigint:()=>{return},boolean:()=>({maxNumConditions:1,debounceMs:0,filterOptions:["empty",{displayKey:"true",displayName:"True",predicate:($,z)=>z,numberOfInputs:0},{displayKey:"false",displayName:"False",predicate:($,z)=>z===!1,numberOfInputs:0}]}),date:()=>({isValidDate:k6}),dateString:({dataTypeDefinition:$})=>({comparator:(z,Q)=>{let J=$.dateParser(Q);if(Q==null||Jz)return 1;return 0},isValidDate:(z)=>typeof z==="string"&&k6($.dateParser(z))}),dateTime:($)=>A2.date($),dateTimeString:($)=>A2.dateString($),object:()=>{return},text:()=>{return}},S2={number:()=>({comparator:tL}),bigint:()=>({comparator:sL}),boolean:({t:$})=>({valueFormatter:(z)=>T(z.value)?$(String(z.value),z.value?"True":"False"):$("blanks","(Blanks)")}),date:({formatValue:$,t:z})=>({valueFormatter:(Q)=>{let J=$(Q);return T(J)?J:z("blanks","(Blanks)")},treeList:!0,treeListFormatter:(Q,J)=>{if(Q==="NaN")return z("invalidDate","Invalid Date");if(J===1&&Q!=null){let Z=M6[Number(Q)-1];return z(Z,F6[Z])}return Q??z("blanks","(Blanks)")},treeListPathGetter:(Q)=>ZQ(Q,!1)}),dateString:({formatValue:$,dataTypeDefinition:z,t:Q})=>({valueFormatter:(J)=>{let Z=$(J);return T(Z)?Z:Q("blanks","(Blanks)")},treeList:!0,treeListPathGetter:(J)=>ZQ(z.dateParser(J??void 0),!1),treeListFormatter:(J,Z)=>{if(Z===1&&J!=null){let X=M6[Number(J)-1];return Q(X,F6[X])}return J??Q("blanks","(Blanks)")}}),dateTime:($)=>{let z=S2.date($);return z.treeListPathGetter=ZQ,z},dateTimeString($){let z=$.dataTypeDefinition.dateParser,Q=S2.dateString($);return Q.treeListPathGetter=(J)=>ZQ(z(J??void 0)),Q},object:({formatValue:$,t:z})=>({valueFormatter:(Q)=>{let J=$(Q);return T(J)?J:z("blanks","(Blanks)")}}),text:()=>{return}};function I4($,z,Q,J,Z,X,Y){let q=z,G=Q,_=$==="agSetColumnFilter";if(!G&&J.baseDataType==="object"&&!_)G=({column:B,node:E})=>Z({column:B,node:E,value:X.valueSvc.getValue(B,E,"data")});let U=(_?S2:A2)[J.baseDataType],W=U({dataTypeDefinition:J,formatValue:Z,t:Y});return q=typeof z==="object"?{...W,...z}:W,{filterParams:q,filterValueGetter:G}}var rL={boolean:"agTextColumnFilter",date:"agDateColumnFilter",dateString:"agDateColumnFilter",dateTime:"agDateColumnFilter",dateTimeString:"agDateColumnFilter",bigint:"agBigIntColumnFilter",number:"agNumberColumnFilter",object:"agTextColumnFilter",text:"agTextColumnFilter"},lL={boolean:"agTextColumnFloatingFilter",date:"agDateColumnFloatingFilter",dateString:"agDateColumnFloatingFilter",dateTime:"agDateColumnFloatingFilter",dateTimeString:"agDateColumnFloatingFilter",bigint:"agBigIntColumnFloatingFilter",number:"agNumberColumnFloatingFilter",object:"agTextColumnFloatingFilter",text:"agTextColumnFloatingFilter"};function C4($,z=!1){return(z?lL:rL)[$??"text"]}function b4($,z,Q){if(z==null)return null;let J=null,{compName:Z,jsComp:X,fwComp:Y}=P7($,z);if(Z)J={agSetColumnFilter:"agSetColumnFloatingFilter",agMultiColumnFilter:"agMultiColumnFloatingFilter",agGroupColumnFilter:"agGroupColumnFloatingFilter",agNumberColumnFilter:"agNumberColumnFloatingFilter",agBigIntColumnFilter:"agBigIntColumnFloatingFilter",agDateColumnFilter:"agDateColumnFloatingFilter",agTextColumnFilter:"agTextColumnFloatingFilter"}[Z];else if(X==null&&Y==null&&z.filter===!0)J=Q();return J}var aL={filterHandler:()=>({doesFilterPass:()=>!0})};function V6($,z,Q,J){if(!$.isPrimary())return!0;let X=!Q;if(!$.isValueActive()||!X)return!1;if(z)return!0;return J}var oL=class extends S{constructor(){super(...arguments);this.beanName="colFilter",this.allColumnFilters=new Map,this.allColumnListeners=new Map,this.activeAggregateFilters=[],this.activeColumnFilters=[],this.processingFilterChange=!1,this.modelUpdates=[],this.columnModelUpdates=[],this.state=new Map,this.handlerMap={...W9},this.isGlobalButtons=!1,this.activeFilterComps=new Set}postConstruct(){this.addManagedEventListeners({gridColumnsChanged:this.onColumnsChanged.bind(this),dataTypesInferred:this.processFilterModelUpdateQueue.bind(this)}),this.addManagedPropertyListener("pivotMode",this.onPivotModeChanged.bind(this));let $=this.gos,z={...$.get("initialState")?.filter?.filterModel??{}};if(this.initialModel=z,this.model={...z},!$.get("enableFilterHandlers"))delete this.handlerMap.agMultiColumnFilter}refreshModel(){this.onNewRowsLoaded("rowDataUpdated")}setModel($,z="api",Q){let{colModel:J,dataTypeSvc:Z,filterManager:X}=this.beans;if(Z?.isPendingInference){this.modelUpdates.push({model:$,source:z});return}let Y=[],q=this.getModel(!0);if($){let G=new Set(Object.keys($));this.allColumnFilters.forEach((_,H)=>{let U=$[H];Y.push(this.setModelOnFilterWrapper(_,U)),G.delete(H)}),G.forEach((_)=>{let H=J.getColDefCol(_)||J.getCol(_);if(!H){j(62,{colId:_});return}if(!H.isFilterAllowed()){j(63,{colId:_});return}let U=this.getOrCreateFilterWrapper(H,!0);if(!U){j(64,{colId:_});return}Y.push(this.setModelOnFilterWrapper(U,$[_],!0))})}else this.model={},this.allColumnFilters.forEach((G)=>{Y.push(this.setModelOnFilterWrapper(G,null))});g.all(Y).then(()=>{let G=this.getModel(!0),_=[];if(this.allColumnFilters.forEach((H,U)=>{let W=q?q[U]:null,B=G?G[U]:null;if(!FJ(W,B))_.push(H.column)}),_.length>0)X?.onFilterChanged({columns:_,source:z});else if(Q)this.updateActive("filterChanged")})}getModel($){let z={},{allColumnFilters:Q,initialModel:J,beans:{colModel:Z}}=this;if(Q.forEach((X,Y)=>{let q=this.getModelFromFilterWrapper(X);if(T(q))z[Y]=q}),!$)for(let X of Object.keys(J)){let Y=J[X];if(T(Y)&&!Q.has(X)&&Z.getCol(X)?.isFilterAllowed())z[X]=Y}return z}setState($,z,Q="api"){if(this.state.clear(),z)for(let J of Object.keys(z)){let Z=z[J];this.state.set(J,{model:D0(this.model,J),state:Z})}this.setModel($,Q,!0)}getState(){let $=this.state;if(!$.size)return;let z={},Q=!1;return $.forEach((J,Z)=>{let X=J.state;if(X!=null)Q=!0,z[Z]=X}),Q?z:void 0}getModelFromFilterWrapper($){let Q=$.column.getColId();if($.isHandler)return D0(this.model,Q);let J=$.filter;if(J){if(typeof J.getModel!=="function")return j(66),null;return J.getModel()}return D0(this.initialModel,Q)}isFilterPresent(){return this.activeColumnFilters.length>0}isAggFilterPresent(){return!!this.activeAggregateFilters.length}disableFilters(){this.initialModel={};let{allColumnFilters:$}=this;if($.size)return $.forEach((z)=>this.disposeFilterWrapper(z,"advancedFilterEnabled")),!0;return!1}updateActiveFilters(){let $=(G)=>{if(!G)return!1;if(!G.isFilterActive)return j(67),!1;return G.isFilterActive()},{colModel:z,gos:Q}=this.beans,J=!!T$(Q),Z=[],X=[],Y=(G,_,H)=>{if(_)if(V6(G,z.isPivotMode(),z.isPivotActive(),J))Z.push(H);else X.push(H)},q=[];return this.allColumnFilters.forEach((G)=>{let _=G.column,H=_.getColId();if(G.isHandler)q.push(g.resolve().then(()=>{Y(_,this.isHandlerActive(_),{colId:H,isHandler:!0,handler:G.handler,handlerParams:G.handlerParams})}));else{let U=a$(G);if(U)q.push(U.then((W)=>{Y(_,$(W),{colId:H,isHandler:!1,comp:W})}))}}),g.all(q).then(()=>{this.activeAggregateFilters=Z,this.activeColumnFilters=X})}updateFilterFlagInColumns($,z){let Q=[];return this.allColumnFilters.forEach((J)=>{let Z=J.column;if(J.isHandler)Q.push(g.resolve().then(()=>{this.setColFilterActive(Z,this.isHandlerActive(Z),$,z)}));else{let X=a$(J);if(X)Q.push(X.then((Y)=>{this.setColFilterActive(Z,Y.isFilterActive(),$,z)}))}}),this.beans.groupFilter?.updateFilterFlags($,z),g.all(Q)}doFiltersPass($,z,Q){let{data:J,aggData:Z}=$,X=Q?this.activeAggregateFilters:this.activeColumnFilters,Y=Q?Z:J,q=this.model;for(let G=0;G{if(this.isAlive())Q?.onFilterChanged($)};if(z.isRefreshInProgress())setTimeout(J,0);else J()}updateBeforeFilterChanged($={}){let{column:z,additionalEventAttributes:Q}=$,J=z?.getColId();return this.updateActiveFilters().then(()=>this.updateFilterFlagInColumns("filterChanged",Q).then(()=>{this.allColumnFilters.forEach((Z)=>{let{column:X,isHandler:Y}=Z;if(J===X.getColId())return;if(Y)Z.handler.onAnyFilterChanged?.();a$(Z,Y)?.then((q)=>{if(typeof q?.onAnyFilterChanged==="function")q.onAnyFilterChanged()})}),this.processingFilterChange=!0}))}updateAfterFilterChanged(){this.processingFilterChange=!1}isSuppressFlashingCellsBecauseFiltering(){return!(this.gos.get("allowShowChangeAfterFilter")??!1)&&this.processingFilterChange}onNewRowsLoaded($){let z=[];this.allColumnFilters.forEach((Q)=>{let J=Q.isHandler;if(J)Q.handler.onNewRowsLoaded?.();let Z=a$(Q,J);if(Z)z.push(Z.then((X)=>{X.onNewRowsLoaded?.()}))}),g.all(z).then(()=>this.updateActive($,{afterDataChange:!0}))}updateActive($,z){this.updateFilterFlagInColumns($,z).then(()=>this.updateActiveFilters())}createGetValue($,z){let{filterValueSvc:Q,colModel:J}=this.beans;return(Z,X)=>{let Y=X?J.getCol(X):$;return Y?Q.getValue(Y,Z,z):void 0}}isFilterActive($){let z=this.cachedFilter($);if(z?.isHandler)return this.isHandlerActive($);let Q=z?.filter;if(Q)return Q.isFilterActive();return D0(this.initialModel,$.getColId())!=null}isHandlerActive($){let z=T(D0(this.model,$.getColId()));if(z)return z;let Q=this.beans.groupFilter;return Q?.isGroupFilter($)?Q.isFilterActive($):!1}getOrCreateFilterUi($){let z=this.getOrCreateFilterWrapper($,!0);return z?a$(z):null}getFilterUiForDisplay($){let z=this.getOrCreateFilterWrapper($,!0);if(!z)return null;let Q=a$(z);if(!Q)return null;return Q.then((J)=>({comp:J,params:z.filterUi.filterParams,isHandler:z.isHandler}))}getHandler($,z){let Q=this.getOrCreateFilterWrapper($,z);return Q?.isHandler?Q.handler:void 0}getOrCreateFilterWrapper($,z){if(!$.isFilterAllowed())return;let Q=this.cachedFilter($);if(!Q&&z)Q=this.createFilterWrapper($),this.setColumnFilterWrapper($,Q);return Q}cachedFilter($){return this.allColumnFilters.get($.getColId())}getDefaultFilter($,z=!1){return this.getDefaultFilterFromDataType(()=>this.beans.dataTypeSvc?.getBaseDataType($),z)}getDefaultFilterFromDataType($,z=!1){if(cq(this.gos))return z?"agSetColumnFloatingFilter":"agSetColumnFilter";return C4($(),z)}getDefaultFloatingFilter($){return this.getDefaultFilter($,!0)}createFilterComp($,z,Q,J,Z,X){let Y=()=>{let _=this.createFilterCompParams($,Z,X),H=J(_,Z);return d2(this.beans.userCompFactory,z,H,Q)},q=Y();if(!q)return null;return{compDetails:q,createFilterUi:(_)=>{return(_?Y():q).newAgStackInstance()}}}createFilterInstance($,z,Q,J){let Z=this.beans.selectableFilter;if(Z?.isSelectable(z))z=Z.getFilterDef($,z);let{handler:X,handlerParams:Y,handlerGenerator:q}=this.createHandler($,z,Q)??{},G=this.createFilterComp($,z,Q,J,!!X,"init");if(!G)return{compDetails:null,createFilterUi:null,handler:X,handlerGenerator:q,handlerParams:Y};let{compDetails:_,createFilterUi:H}=G;if(this.isGlobalButtons){if(!_.params?.buttons?.length)j(281,{colId:$.getColId()})}return{compDetails:_,handler:X,handlerGenerator:q,handlerParams:Y,createFilterUi:H}}createBaseFilterParams($,z){let{filterManager:Q,rowModel:J}=this.beans;return y(this.gos,{column:$,colDef:$.getColDef(),getValue:this.createGetValue($),doesRowPassOtherFilter:z?()=>!0:(Z)=>Q?.doesRowPassOtherFilters($.getColId(),Z)??!0,rowModel:J})}createFilterCompParams($,z,Q,J){let Z=this.filterChangedCallbackFactory($),X=this.createBaseFilterParams($,J);if(X.filterChangedCallback=Z,X.filterModifiedCallback=J?()=>{}:(Y)=>this.filterModified($,Y),z){let Y=X,q=$.getColId(),G=D0(this.model,q);Y.model=G,Y.state=this.state.get(q)??{model:G},Y.onModelChange=(_,H)=>{this.updateStoredModel(q,_),this.refreshHandlerAndUi($,_,"ui",!1,H).then(()=>{Z({...H,source:"columnFilter"})})},Y.onStateChange=(_)=>{this.updateState($,_),this.updateOrRefreshFilterUi($)},Y.onAction=(_,H,U)=>{this.updateModel($,_,H),this.dispatchLocalEvent({type:"filterAction",column:$,action:_,event:U})},Y.getHandler=()=>this.getHandler($,!0),Y.onUiChange=(_)=>this.filterUiChanged($,_),Y.source=Q}return X}createFilterUiForHandler($,z){return z?{created:!1,create:z,filterParams:$.params,compDetails:$}:null}createFilterUiLegacy($,z,Q){let J=z(),Z={created:!0,create:z,filterParams:$.params,compDetails:$,promise:J};return J.then(Q),Z}createFilterWrapper($){let{compDetails:z,handler:Q,handlerGenerator:J,handlerParams:Z,createFilterUi:X}=this.createFilterInstance($,$.getColDef(),this.getDefaultFilter($),(q)=>q),Y=$.getColId();if(Q)return delete this.initialModel[Y],Q.init?.({...Z,source:"init",model:D0(this.model,Y)}),{column:$,isHandler:!0,handler:Q,handlerGenerator:J,handlerParams:Z,filterUi:this.createFilterUiForHandler(z,X)};if(X){let q={column:$,filterUi:null,isHandler:!1};return q.filterUi=this.createFilterUiLegacy(z,X,(G)=>{q.filter=G??void 0}),q}return{column:$,filterUi:null,isHandler:!1}}createHandlerFunc($,z,Q){let{gos:J,frameworkOverrides:Z,registry:X}=this.beans,Y,q=(B)=>{let E=B.filter;if(j7(E)){let K=E.handler;if(K)return K;if(Y=E.doesFilterPass,Y)return()=>({doesFilterPass:Y});return}return typeof E==="string"?E:void 0},G=J.get("enableFilterHandlers"),_=G?q(z):void 0,H=(B)=>()=>this.createBean(X.createDynamicBean(B,!0)),U,W;if(typeof _==="string"){let B=J.get("filterHandlers")?.[_];if(B!=null)U=B;else if(vL.has(_))U=H(_),W=_}else U=_;if(!U){let B,{compName:E,jsComp:K,fwComp:L}=P7(Z,z);if(E)B=E;else if(K==null&&L==null&&z.filter===!0)B=Q;if(W=this.handlerMap[B],W)U=H(W)}if(!U){if(!G)return;if(o(J))j(277,{colId:$.getColId()});return aL}return{filterHandler:U,handlerNameOrCallback:Y??W}}createHandler($,z,Q){let J=this.createHandlerFunc($,z,Q);if(!J)return;let Z=jZ(this.beans.userCompFactory,z,this.createFilterCompParams($,!0,"init")),{handlerNameOrCallback:X,filterHandler:Y}=J,{handler:q,handlerParams:G}=this.createHandlerFromFunc($,Y,Z);return{handler:q,handlerParams:G,handlerGenerator:X??Y}}createHandlerFromFunc($,z,Q){let J=$.getColDef(),Z=z(y(this.gos,{column:$,colDef:J})),X=this.createHandlerParams($,Q);return{handler:Z,handlerParams:X}}createHandlerParams($,z){let Q=$.getColDef(),J=$.getColId(),Z=this.filterChangedCallbackFactory($);return y(this.gos,{colDef:Q,column:$,getValue:this.createGetValue($),doesRowPassOtherFilter:(X)=>this.beans.filterManager?.doesRowPassOtherFilters(J,X)??!0,onModelChange:(X,Y)=>{this.updateStoredModel(J,X),this.refreshHandlerAndUi($,X,"handler",!1,Y).then(()=>{Z({...Y,source:"columnFilter"})})},onModelAsStringChange:()=>{$.dispatchColEvent("filterChanged","filterChanged"),this.dispatchLocalEvent({type:"filterModelAsStringChanged",column:$})},filterParams:z})}onColumnsChanged(){let $=[],{colModel:z,filterManager:Q,groupFilter:J}=this.beans;this.allColumnFilters.forEach((X,Y)=>{let q;if(X.column.isPrimary())q=z.getColDefCol(Y);else q=z.getCol(Y);if(q&&q===X.column)return;$.push(X.column),this.disposeFilterWrapper(X,"columnChanged"),this.disposeColumnListener(Y)});let Z=J&&$.every((X)=>J.isGroupFilter(X));if($.length>0&&!Z)Q?.onFilterChanged({columns:$,source:"api"})}isFilterAllowed($){if(!$.isFilterAllowed())return!1;let Q=this.beans.groupFilter;if(Q?.isGroupFilter($))return Q.isFilterAllowed($);return!0}getFloatingFilterCompDetails($,z){let{userCompFactory:Q,frameworkOverrides:J,selectableFilter:Z,gos:X}=this.beans,Y=(B)=>{this.getOrCreateFilterUi($)?.then((K)=>{B(m$(K))})},q=$.getColDef(),G=Z?.isSelectable(q)?Z.getFilterDef($,q):q,_=b4(J,G,()=>this.getDefaultFloatingFilter($))??"agReadOnlyFloatingFilter",H=X.get("enableFilterHandlers"),U=jZ(Q,G,this.createFilterCompParams($,H,"init",!0)),W=y(X,{column:$,filterParams:U,currentParentModel:()=>this.getCurrentFloatingFilterParentModel($),parentFilterInstance:Y,showParentFilter:z});if(H){let B=W,E=$.getColId(),K=this.filterChangedCallbackFactory($);B.onUiChange=(L)=>this.floatingFilterUiChanged($,L),B.model=D0(this.model,E),B.onModelChange=(L,D)=>{this.updateStoredModel(E,L),this.refreshHandlerAndUi($,L,"floating",!0,D).then(()=>{K({...D,source:"columnFilter"})})},B.getHandler=()=>this.getHandler($,!0),B.source="init"}return t2(Q,q,W,_)}getCurrentFloatingFilterParentModel($){return this.getModelFromFilterWrapper(this.cachedFilter($)??{column:$})}destroyFilterUi($,z,Q,J){if($.isHandler){let X=z.getColId();delete this.initialModel[X],this.state.delete(X);let Y=$.filterUi,q=this.createFilterUiForHandler(Q,J);$.filterUi=q;let G=this.eventSvc;if(Y?.created)Y.promise.then((_)=>{this.destroyBean(_),G.dispatchEvent({type:"filterDestroyed",source:"paramsUpdated",column:z})});else G.dispatchEvent({type:"filterHandlerDestroyed",source:"paramsUpdated",column:z})}else this.destroyFilter(z,"paramsUpdated")}destroyFilter($,z="api"){let Q=$.getColId(),J=this.allColumnFilters.get(Q);if(this.disposeColumnListener(Q),delete this.initialModel[Q],J)this.disposeFilterWrapper(J,z).then((Z)=>{if(Z&&this.isAlive())this.beans.filterManager?.onFilterChanged({columns:[$],source:"api"})})}disposeColumnListener($){let z=this.allColumnListeners.get($);if(z)this.allColumnListeners.delete($),z()}disposeFilterWrapper($,z){let Q=!1,{column:J,isHandler:Z,filterUi:X}=$,Y=J.getColId();if(Z)Q=this.isHandlerActive(J),this.destroyBean($.handler),delete this.model[Y],this.state.delete(Y);let q=()=>{this.setColFilterActive(J,!1,"filterDestroyed"),this.allColumnFilters.delete(Y),this.eventSvc.dispatchEvent({type:"filterDestroyed",source:z,column:J})};if(X)if(X.created)return X.promise.then((G)=>{return Q=Z?Q:!!G?.isFilterActive(),this.destroyBean(G),q(),Q});else q();return g.resolve(Q)}filterChangedCallbackFactory($){return(z)=>{this.callOnFilterChangedOutsideRenderCycle({additionalEventAttributes:z,columns:[$],column:$,source:z?.source??"columnFilter"})}}filterParamsChanged($,z="api"){let Q=this.allColumnFilters.get($);if(!Q)return;let J=this.beans,Z=Q.column,X=Z.getColDef(),Y=Z.isFilterAllowed(),q=this.getDefaultFilter(Z),G=J.selectableFilter,_=G?.isSelectable(X)?G.getFilterDef(Z,X):X,H=Y?this.createHandlerFunc(Z,_,this.getDefaultFilter(Z)):void 0,U=!!H,W=Q.isHandler;if(W!=U){this.destroyFilter(Z,"paramsUpdated");return}let{compDetails:B,createFilterUi:E}=(Y?this.createFilterComp(Z,_,q,(L)=>L,U,"colDef"):null)??{compDetails:null,createFilterUi:null},K=B?.params??jZ(J.userCompFactory,_,this.createFilterCompParams(Z,U,"colDef"));if(W){let L=H?.handlerNameOrCallback??H?.filterHandler,D=D0(this.model,$);if(Q.handlerGenerator!=L){let F=Q.handler,{handler:M,handlerParams:k}=this.createHandlerFromFunc(Z,H.filterHandler,K);if(Q.handler=M,Q.handlerParams=k,Q.handlerGenerator=L,delete this.model[$],M.init?.({...k,source:"init",model:null}),this.destroyBean(F),D!=null)this.beans.filterManager?.onFilterChanged({columns:[Z],source:z})}else{let F=this.createHandlerParams(Z,B?.params);Q.handlerParams=F,Q.handler.refresh?.({...F,source:"colDef",model:D})}}if(this.areFilterCompsDifferent(Q.filterUi?.compDetails??null,B)||!Q.filterUi||!B){this.destroyFilterUi(Q,Z,B,E);return}Q.filterUi.filterParams=K,a$(Q,W)?.then((L)=>{if((L?.refresh?L.refresh(K):!0)===!1)this.destroyFilterUi(Q,Z,B,E);else this.dispatchLocalEvent({type:"filterParamsChanged",column:Z,params:K})})}refreshHandlerAndUi($,z,Q,J,Z){let X=this.cachedFilter($);if(!X){if(J)this.getOrCreateFilterWrapper($,!0);return g.resolve()}if(!X.isHandler)return g.resolve();let{filterUi:Y,handler:q,handlerParams:G}=X;return sJ(()=>{if(Y){let{created:_,filterParams:H}=Y;if(_)return Y.promise.then((U)=>{return U?{filter:U,filterParams:H}:void 0});else Y.refreshed=!0}return g.resolve(void 0)},q,G,z,this.state.get($.getColId())??{model:z},Q,Z)}setColumnFilterWrapper($,z){let Q=$.getColId();this.allColumnFilters.set(Q,z),this.allColumnListeners.set(Q,this.addManagedListeners($,{colDefChanged:()=>this.filterParamsChanged(Q)})[0])}areFilterCompsDifferent($,z){if(!z||!$)return!0;let{componentClass:Q}=$,{componentClass:J}=z;return!(Q===J||Q?.render&&J?.render&&Q.render===J.render)}hasFloatingFilters(){return this.beans.colModel.getCols().some((z)=>z.getColDef().floatingFilter)}getFilterInstance($){let z=this.beans.colModel.getColDefCol($);if(!z)return Promise.resolve(void 0);let Q=this.getOrCreateFilterUi(z);if(!Q)return Promise.resolve(null);return new Promise((J)=>{Q.then((Z)=>{J(m$(Z))})})}processFilterModelUpdateQueue(){this.modelUpdates.forEach(({model:$,source:z})=>this.setModel($,z)),this.modelUpdates=[],this.columnModelUpdates.forEach(({key:$,model:z,resolve:Q})=>{this.setModelForColumn($,z).then(()=>Q())}),this.columnModelUpdates=[]}getModelForColumn($,z){if(z){let{state:J,model:Z}=this,X=$.getColId(),Y=J.get(X);if(Y)return Y.model??null;return D0(Z,X)}let Q=this.cachedFilter($);return Q?this.getModelFromFilterWrapper(Q):null}setModelForColumn($,z){if(this.beans.dataTypeSvc?.isPendingInference){let Q=()=>{},J=new Promise((Z)=>{Q=Z});return this.columnModelUpdates.push({key:$,model:z,resolve:Q}),J}return new Promise((Q)=>{this.setModelForColumnLegacy($,z).then((J)=>Q(J))})}getStateForColumn($){return this.state.get($)??{model:D0(this.model,$)}}setModelForColumnLegacy($,z){let Q=this.beans.colModel.getColDefCol($),J=Q?this.getOrCreateFilterWrapper(Q,!0):null;return J?this.setModelOnFilterWrapper(J,z):g.resolve()}setColDefPropsForDataType($,z,Q){let J=$.filter,Z=J===!0?this.getDefaultFilterFromDataType(()=>z.baseDataType):J;if(typeof Z!=="string")return;let X,Y,q=this.beans,{filterParams:G,filterValueGetter:_}=$;if(Z==="agMultiColumnFilter")({filterParams:X,filterValueGetter:Y}=q.multiFilter?.getParamsForDataType(G,_,z,Q)??{});else({filterParams:X,filterValueGetter:Y}=I4(Z,G,_,z,Q,q,this.getLocaleTextFunc()));if($.filterParams=X,Y)$.filterValueGetter=Y}setColFilterActive($,z,Q,J){if($.filterActive!==z)$.filterActive=z,$.dispatchColEvent("filterActiveChanged",Q);$.dispatchColEvent("filterChanged",Q,J)}setModelOnFilterWrapper($,z,Q){return new g((J)=>{if($.isHandler){let X=$.column,Y=X.getColId(),q=this.model[Y];if(this.updateStoredModel(Y,z),Q&&z===q){J();return}this.refreshHandlerAndUi(X,z,"api").then(()=>J());return}let Z=a$($);if(Z){Z.then((X)=>{if(typeof X?.setModel!=="function"){j(65),J();return}(X.setModel(z)||g.resolve()).then(()=>J())});return}J()})}updateStoredModel($,z){if(T(z))this.model[$]=z;else delete this.model[$];let Q=this.state.get($),J={model:z,state:Q?.state};this.state.set($,J)}filterModified($,z){this.getOrCreateFilterUi($)?.then((Q)=>{this.eventSvc.dispatchEvent({type:"filterModified",column:$,filterInstance:Q,...z})})}filterUiChanged($,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"filterUiChanged",column:$,...z})}floatingFilterUiChanged($,z){if(this.gos.get("enableFilterHandlers"))this.eventSvc.dispatchEvent({type:"floatingFilterUiChanged",column:$,...z})}updateModel($,z,Q){let J=$.getColId(),Z=this.cachedFilter($),X=()=>Z?.filterUi;DJ({action:z,filterParams:Z?.filterUi?.filterParams,getFilterUi:X,getModel:()=>D0(this.model,J),getState:()=>this.state.get(J),updateState:(Y)=>this.updateState($,Y),updateModel:(Y)=>X()?.filterParams?.onModelChange(Y,{...Q,fromAction:z}),processModelToApply:Z?.isHandler?Z.handler.processModelToApply?.bind(Z.handler):void 0})}updateAllModels($,z){let Q=[];if(this.allColumnFilters.forEach((J,Z)=>{let X=this.beans.colModel.getColDefCol(Z);if(X)DJ({action:$,filterParams:J.filterUi?.filterParams,getFilterUi:()=>J.filterUi,getModel:()=>D0(this.model,Z),getState:()=>this.state.get(Z),updateState:(Y)=>this.updateState(X,Y),updateModel:(Y)=>{this.updateStoredModel(Z,Y),this.dispatchLocalEvent({type:"filterAction",column:X,action:$}),Q.push(this.refreshHandlerAndUi(X,Y,"ui"))},processModelToApply:J?.isHandler?J.handler.processModelToApply?.bind(J.handler):void 0})}),Q.length)g.all(Q).then(()=>{this.callOnFilterChangedOutsideRenderCycle({source:"columnFilter",additionalEventAttributes:z,columns:[]})})}updateOrRefreshFilterUi($){let z=$.getColId();B9(()=>this.cachedFilter($)?.filterUi,()=>D0(this.model,z),()=>this.state.get(z))}updateState($,z){this.state.set($.getColId(),z),this.dispatchLocalEvent({type:"filterStateChanged",column:$,state:z})}canApplyAll(){let{state:$,model:z,activeFilterComps:Q}=this;for(let Z of Q)if(Z.source==="COLUMN_MENU")return!1;let J=!1;for(let Z of $.keys()){let X=$.get(Z);if(X.valid===!1)return!1;if((X.model??null)!==D0(z,Z))J=!0}return J}hasUnappliedModel($){let{model:z,state:Q}=this;return(Q.get($)?.model??null)!==D0(z,$)}setGlobalButtons($){this.isGlobalButtons=$,this.dispatchLocalEvent({type:"filterGlobalButtons",isGlobal:$})}shouldKeepStateOnDetach($,z){if(z==="newFiltersToolPanel")return!0;let Q=this.beans.filterPanelSvc;if(Q?.isActive)return!!Q.getState($.getColId());return!1}onPivotModeChanged($){let{colModel:z,pivotColsSvc:Q}=this.beans,J=!!T$(this.gos),Z=$.currentValue,X=Z?this.activeColumnFilters:this.activeAggregateFilters,Y=Z?this.activeAggregateFilters:this.activeColumnFilters,q=[];for(let G of X){let _=z.getColById(G.colId),H=Z&&!!Q?.columns.length;if(_&&Z===V6(_,Z,H,J))Y.push(G),q.push(G)}Q1(X,q)}destroy(){super.destroy(),this.allColumnFilters.forEach(($)=>this.disposeFilterWrapper($,"gridDestroyed")),this.allColumnListeners.clear(),this.state.clear(),this.activeFilterComps.clear()}};function eL($){return!!$.filterManager?.isAnyFilterPresent()}function $D($,z="api"){$.filterManager?.onFilterChanged({source:z})}var zD=class extends S{constructor(){super(...arguments);this.beanName="filterManager",this.advFilterModelUpdateQueue=[]}wireBeans($){this.quickFilter=$.quickFilter,this.advancedFilter=$.advancedFilter,this.colFilter=$.colFilter}postConstruct(){let $=this.refreshFiltersForAggregations.bind(this),z=this.updateAdvFilterColumns.bind(this);if(this.addManagedEventListeners({columnValueChanged:$,columnPivotChanged:$,columnPivotModeChanged:$,newColumnsLoaded:z,columnVisible:z,advancedFilterEnabledChanged:({enabled:J})=>this.onAdvFilterEnabledChanged(J),dataTypesInferred:this.processFilterModelUpdateQueue.bind(this)}),this.externalFilterPresent=this.isExternalFilterPresentCallback(),this.addManagedPropertyListeners(["isExternalFilterPresent","doesExternalFilterPass"],()=>{this.onFilterChanged({source:"api"})}),this.updateAggFiltering(),this.addManagedPropertyListener("groupAggFiltering",()=>{this.updateAggFiltering(),this.onFilterChanged()}),this.quickFilter)this.addManagedListeners(this.quickFilter,{quickFilterChanged:()=>this.onFilterChanged({source:"quickFilter"})});let{gos:Q}=this;this.alwaysPassFilter=Q.get("alwaysPassFilter"),this.addManagedPropertyListener("alwaysPassFilter",()=>{this.alwaysPassFilter=Q.get("alwaysPassFilter"),this.onFilterChanged({source:"api"})})}isExternalFilterPresentCallback(){let $=this.gos.getCallback("isExternalFilterPresent");return typeof $==="function"&&$({})}doesExternalFilterPass($){let z=this.gos.get("doesExternalFilterPass");return typeof z==="function"&&z($)}setFilterState($,z,Q="api"){if(this.isAdvFilterEnabled())return;this.colFilter?.setState($,z,Q)}setFilterModel($,z="api",Q){if(this.isAdvFilterEnabled()){if(!Q)this.warnAdvFilters();return}this.colFilter?.setModel($,z)}getFilterModel(){return this.colFilter?.getModel()??{}}getFilterState(){return this.colFilter?.getState()}isColumnFilterPresent(){return!!this.colFilter?.isFilterPresent()}isAggregateFilterPresent(){return!!this.colFilter?.isAggFilterPresent()}isChildFilterPresent(){return this.isColumnFilterPresent()||this.isQuickFilterPresent()||this.externalFilterPresent||this.isAdvFilterPresent()}isAnyFilterPresent(){return this.isChildFilterPresent()||this.isAggregateFilterPresent()}isAdvFilterPresent(){return this.isAdvFilterEnabled()&&this.advancedFilter.isFilterPresent()}onAdvFilterEnabledChanged($){if($){if(this.colFilter?.disableFilters())this.onFilterChanged({source:"advancedFilter"})}else if(this.advancedFilter?.isFilterPresent())this.advancedFilter.setModel(null),this.onFilterChanged({source:"advancedFilter"})}isAdvFilterEnabled(){return!!this.advancedFilter?.isEnabled()}isAdvFilterHeaderActive(){return this.isAdvFilterEnabled()&&this.advancedFilter.isHeaderActive()}refreshFiltersForAggregations(){if(T$(this.gos)&&this.isAnyFilterPresent())this.onFilterChanged()}onFilterChanged($={}){let{source:z,additionalEventAttributes:Q,columns:J=[]}=$;this.externalFilterPresent=this.isExternalFilterPresentCallback(),(this.colFilter?this.colFilter.updateBeforeFilterChanged($):g.resolve()).then(()=>{let Z={source:z,type:"filterChanged",columns:J};if(Q)B0(Z,Q);this.eventSvc.dispatchEvent(Z),this.colFilter?.updateAfterFilterChanged()})}isSuppressFlashingCellsBecauseFiltering(){return!!this.colFilter?.isSuppressFlashingCellsBecauseFiltering()}isQuickFilterPresent(){return!!this.quickFilter?.isFilterPresent()}updateAggFiltering(){this.aggFiltering=!!T$(this.gos)}isAggregateQuickFilterPresent(){return this.isQuickFilterPresent()&&this.shouldApplyQuickFilterAfterAgg()}isNonAggregateQuickFilterPresent(){return this.isQuickFilterPresent()&&!this.shouldApplyQuickFilterAfterAgg()}shouldApplyQuickFilterAfterAgg(){return(this.aggFiltering||this.beans.colModel.isPivotMode())&&!this.gos.get("applyQuickFilterBeforePivotOrAgg")}doesRowPassOtherFilters($,z){return this.doesRowPassFilter({rowNode:z,colIdToSkip:$})}doesRowPassAggregateFilters($){let{rowNode:z}=$;if(this.alwaysPassFilter?.(z))return!0;if(this.isAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(z))return!1;if(this.isAggregateFilterPresent()&&!this.colFilter.doFiltersPass(z,$.colIdToSkip,!0))return!1;return!0}doesRowPassFilter($){let{rowNode:z}=$;if(this.alwaysPassFilter?.(z))return!0;if(this.isNonAggregateQuickFilterPresent()&&!this.quickFilter.doesRowPass(z))return!1;if(this.externalFilterPresent&&!this.doesExternalFilterPass(z))return!1;if(this.isColumnFilterPresent()&&!this.colFilter.doFiltersPass(z,$.colIdToSkip))return!1;if(this.isAdvFilterPresent()&&!this.advancedFilter.doesFilterPass(z))return!1;return!0}isFilterAllowed($){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.isFilterAllowed($)}getAdvFilterModel(){return this.isAdvFilterEnabled()?this.advancedFilter.getModel():null}setAdvFilterModel($,z="api"){if(!this.isAdvFilterEnabled())return;if(this.beans.dataTypeSvc?.isPendingInference){this.advFilterModelUpdateQueue.push($);return}this.advancedFilter.setModel($??null),this.onFilterChanged({source:z})}toggleAdvFilterBuilder($,z){if(!this.isAdvFilterEnabled())return;this.advancedFilter.getCtrl().toggleFilterBuilder({source:z,force:$})}updateAdvFilterColumns(){if(!this.isAdvFilterEnabled())return;if(this.advancedFilter.updateValidity())this.onFilterChanged({source:"advancedFilter"})}hasFloatingFilters(){if(this.isAdvFilterEnabled())return!1;return!!this.colFilter?.hasFloatingFilters()}getColumnFilterInstance($){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve(void 0);return this.colFilter?.getFilterInstance($)??Promise.resolve(void 0)}warnAdvFilters(){j(68)}setupAdvFilterHeaderComp($){this.advancedFilter?.getCtrl().setupHeaderComp($)}getHeaderRowCount(){return this.isAdvFilterHeaderActive()?1:0}getHeaderHeight(){return this.isAdvFilterHeaderActive()?this.advancedFilter.getCtrl().getHeaderHeight():0}processFilterModelUpdateQueue(){for(let $ of this.advFilterModelUpdateQueue)this.setAdvFilterModel($);this.advFilterModelUpdateQueue=[]}setColumnFilterModel($,z){if(this.isAdvFilterEnabled())return this.warnAdvFilters(),Promise.resolve();return this.colFilter?.setModelForColumn($,z)??Promise.resolve()}};function QD($){return{tag:"div",cls:$}}var y4=class extends x{constructor($){let{className:z="ag-filter-apply-panel"}=$??{};super(QD(z));this.listeners=[],this.validationMessage=null,this.className=z}updateButtons($,z){let Q=this.buttons;if(this.buttons=$,Q===$)return;let J=this.getGui();z0(J);let Z;this.destroyListeners();let X=document.createDocumentFragment(),Y=this.className,q=({type:_,label:H})=>{let U=(D)=>{this.dispatchLocalEvent({type:_,event:D})};if(!["apply","clear","reset","cancel"].includes(_))j(75);let W=_==="apply",E=J0({tag:"button",attrs:{type:W&&z?"submit":"button"},ref:`${_}FilterButton`,cls:`ag-button ag-standard-button ${Y}-button${W?" "+Y+"-apply-button":""}`,children:H});if(this.activateTabIndex([E]),W)Z=E;let K=(D)=>{if(D.key===A.ENTER)D.preventDefault(),U(D)},L=this.listeners;E.addEventListener("click",U),L.push(()=>E.removeEventListener("click",U)),E.addEventListener("keydown",K),L.push(()=>E.removeEventListener("keydown",K)),X.append(E)};for(let _ of $)q(_);this.eApply=Z;let G=this.validationTooltipFeature;if(Z&&!G)this.validationTooltipFeature=this.createOptionalManagedBean(this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.eApply,getLocation:()=>"advancedFilter",getTooltipShowDelayOverride:()=>1000}));else if(!Z&&G)this.validationTooltipFeature=this.destroyBean(G);J.append(X)}getApplyButton(){return this.eApply}updateValidity($,z=null){let Q=this.eApply;if(!Q)return;T2(Q,!$),this.validationMessage=z,this.validationTooltipFeature?.setTooltipAndRefresh(this.validationMessage)}destroyListeners(){for(let $ of this.listeners)$();this.listeners=[]}destroy(){this.destroyListeners(),super.destroy()}};var x4=class extends x{constructor($,z,Q,J,Z,X){super();this.column=$,this.wrapper=z,this.eventParent=Q,this.updateModel=J,this.isGlobalButtons=Z,this.enableGlobalButtonCheck=X,this.hidePopup=null,this.applyActive=!1}postConstruct(){let{comp:$,params:z}=this.wrapper,Q=z,J=Q.useForm,Z=J?"form":"div";if(this.setTemplate({tag:Z,cls:"ag-filter-wrapper"}),J)this.addManagedElementListeners(this.getGui(),{submit:(X)=>{X?.preventDefault()},keydown:this.handleKeyDown.bind(this)});this.appendChild($.getGui()),this.params=Q,this.resetButtonsPanel(Q),this.addManagedListeners(this.eventParent,{filterParamsChanged:({column:X,params:Y})=>{if(X===this.column)this.resetButtonsPanel(Y,this.params)},filterStateChanged:({column:X,state:Y})=>{if(X===this.column)this.eButtons?.updateValidity(Y.valid!==!1)},filterAction:({column:X,action:Y,event:q})=>{if(X===this.column)this.afterAction(Y,q)},...this.enableGlobalButtonCheck?{filterGlobalButtons:({isGlobal:X})=>{if(X!==this.isGlobalButtons){this.isGlobalButtons=X;let Y=this.params;this.resetButtonsPanel(Y,Y,!0)}}}:void 0})}afterGuiAttached($){if($)this.hidePopup=$.hidePopup}resetButtonsPanel($,z,Q){let{buttons:J,readOnly:Z}=z??{},{buttons:X,readOnly:Y,useForm:q}=$;if(!Q&&Z===Y&&FJ(J,X))return;let G=X&&X.length>0&&!$.readOnly&&!this.isGlobalButtons,_=this.eButtons;if(G){let H=X.map((U)=>{let W=`${U}Filter`;return{type:U,label:w7(this,W)}});if(this.applyActive=W1(this.params),!_){_=this.createBean(new y4),this.appendChild(_.getGui());let U=this.column,W=(B)=>({event:E})=>{this.updateModel(U,B,{fromButtons:!0}),this.afterAction(B,E)};_?.addManagedListeners(_,{apply:W("apply"),clear:W("clear"),reset:W("reset"),cancel:W("cancel")}),this.eButtons=_}_.updateButtons(H,q)}else if(this.applyActive=!1,_)T0(_.getGui()),this.eButtons=this.destroyBean(_)}close($){let z=this.hidePopup;if(!z)return;let Q=$,J=Q?.key,Z;if(J===A.ENTER||J===A.SPACE)Z={keyboardEvent:Q};z(Z),this.hidePopup=null}afterAction($,z){let{params:Q,applyActive:J}=this,Z=Q?.closeOnApply;switch($){case"apply":{if(z?.preventDefault(),Z&&J)this.close(z);break}case"reset":{if(Z&&J)this.close();break}case"cancel":{if(Z)this.close(z);break}}}handleKeyDown($){if(!$.defaultPrevented&&$.key===A.ENTER&&this.applyActive)this.updateModel(this.column,"apply",{fromButtons:!0}),this.afterAction("apply",$)}destroy(){this.hidePopup=null,this.eButtons=this.destroyBean(this.eButtons)}},JD=":where(.ag-menu:not(.ag-tabs) .ag-filter)>:not(.ag-filter-wrapper){min-width:180px}",ZD={tag:"div",cls:"ag-filter"},w4=class extends x{constructor($,z,Q){super(ZD);this.column=$,this.source=z,this.enableGlobalButtonCheck=Q,this.wrapper=null}postConstruct(){this.beans.colFilter?.activeFilterComps.add(this),this.createFilter(!0),this.addManagedEventListeners({filterDestroyed:this.onFilterDestroyed.bind(this)})}hasFilter(){return this.wrapper!=null}getFilter(){return this.wrapper?.then(($)=>$.comp)??null}afterInit(){return this.wrapper?.then(()=>{})??g.resolve()}afterGuiAttached($){this.afterGuiAttachedParams=$,this.wrapper?.then((z)=>{this.comp?.afterGuiAttached($),z?.comp?.afterGuiAttached?.($)})}afterGuiDetached(){this.wrapper?.then(($)=>{$?.comp?.afterGuiDetached?.()})}createFilter($){let{column:z,source:Q,beans:{colFilter:J}}=this,Z=J.getFilterUiForDisplay(z)??null;this.wrapper=Z,Z?.then((X)=>{if(!X)return;let{isHandler:Y,comp:q}=X,G;if(Y){let _=!!this.enableGlobalButtonCheck,H=this.createBean(new x4(z,X,J,J.updateModel.bind(J),_&&J.isGlobalButtons,_));this.comp=H,G=H.getGui()}else if(this.registerCSS(JD),G=q.getGui(),!T(G))j(69,{guiFromFilter:G});if(this.appendChild(G),$)this.eventSvc.dispatchEvent({type:"filterOpened",column:z,source:Q,eGui:this.getGui()});else q.afterGuiAttached?.(this.afterGuiAttachedParams)})}onFilterDestroyed($){let{source:z,column:Q}=$;if((z==="api"||z==="paramsUpdated")&&Q.getId()===this.column.getId()&&this.beans.colModel.getColDefCol(this.column))z0(this.getGui()),this.comp=this.destroyBean(this.comp),this.createFilter()}destroy(){this.beans.colFilter?.activeFilterComps.delete(this),this.eventSvc.dispatchEvent({type:"filterClosed",column:this.column}),this.wrapper=null,this.comp=this.destroyBean(this.comp),this.afterGuiAttachedParams=void 0,super.destroy()}},XD=class extends S{constructor(){super(...arguments);this.beanName="filterMenuFactory"}wireBeans($){this.popupSvc=$.popupSvc}hideActiveMenu(){this.hidePopup?.()}showMenuAfterMouseEvent($,z,Q,J){if($&&!$.isColumn)return;this.showPopup($,(Z)=>{this.popupSvc?.positionPopupUnderMouseEvent({additionalParams:{column:$},type:Q,mouseEvent:z,ePopup:Z})},Q,z.target,U0(this.gos),J)}showMenuAfterButtonClick($,z,Q,J){if($&&!$.isColumn)return;let Z=-1,X="left",Y=U0(this.gos);if(!Y&&this.gos.get("enableRtl"))Z=1,X="right";let q=Y?void 0:4*Z,G=Y?void 0:4;this.showPopup($,(_)=>{this.popupSvc?.positionPopupByComponent({type:Q,eventSource:z,ePopup:_,nudgeX:q,nudgeY:G,alignSide:X,keepWithinBounds:!0,position:"under",additionalParams:{column:$}})},Q,z,Y,J)}showPopup($,z,Q,J,Z,X){let Y=$?this.createBean(new w4($,"COLUMN_MENU")):void 0;if(this.activeMenu=Y,!Y?.hasFilter()||!$){e(57);return}let q=J0({tag:"div",cls:`ag-menu${!Z?" ag-filter-menu":""}`,role:"presentation"});[this.tabListener]=this.addManagedElementListeners(q,{keydown:(K)=>this.trapFocusWithin(K,q)}),q.appendChild(Y?.getGui());let G,_=()=>Y?.afterGuiDetached(),H=h2(this.gos)?J??this.beans.ctrlsSvc.getGridBodyCtrl().eGridBody:void 0,U=(K)=>{z1($,!1,"contextMenu");let L=K instanceof KeyboardEvent;if(this.tabListener)this.tabListener=this.tabListener();if(L&&J&&A0(J))xJ(J)?.focus({preventScroll:!0});_(),this.destroyBean(this.activeMenu),this.dispatchVisibleChangedEvent(!1,Q,$),X?.()},W=this.getLocaleTextFunc(),B=Z&&Q!=="columnFilter"?W("ariaLabelColumnMenu","Column Menu"):W("ariaLabelColumnFilter","Column Filter"),E=this.popupSvc?.addPopup({modal:!0,eChild:q,closeOnEsc:!0,closedCallback:U,positionCallback:()=>z(q),anchorToElement:H,ariaLabel:B});if(E)this.hidePopup=G=E.hideFunc;Y.afterInit().then(()=>{z(q),Y.afterGuiAttached({container:Q,hidePopup:G})}),z1($,!0,"contextMenu"),this.dispatchVisibleChangedEvent(!0,Q,$)}trapFocusWithin($,z){if($.key!==A.TAB||$.defaultPrevented||j0(this.beans,z,!1,$.shiftKey))return;$.preventDefault(),F0(z,$.shiftKey)}dispatchVisibleChangedEvent($,z,Q){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:!1,key:z,column:Q??null,columnGroup:null})}isMenuEnabled($){return $.isFilterAllowed()&&($.getColDef().menuTabs??["filterMenuTab"]).includes("filterMenuTab")}showMenuAfterContextMenuEvent(){}destroy(){this.destroyBean(this.activeMenu),super.destroy()}},YD=class extends S{constructor(){super(...arguments);this.beanName="filterValueSvc"}getValue($,z,Q){if(!z)return;let J=$.getColDef(),{selectableFilter:Z,valueSvc:X,formula:Y}=this.beans,q=Q??Z?.getFilterValueGetter($.getColId())??J.filterValueGetter;if(q)return this.executeFilterValueGetter(q,z.data,$,z,J);let G=X.getValue($,z,"data");if($.isAllowFormula()&&Y?.isFormula(G))return Y.resolveValue($,z);return G}executeFilterValueGetter($,z,Q,J,Z){let{expressionSvc:X,valueSvc:Y}=this.beans,q=y(this.gos,{data:z,node:J,column:Q,colDef:Z,getValue:Y.getValueCallback.bind(Y,J)});if(typeof $==="function")return $(q);return X?.evaluate($,q)}};function qD($){return!!$.quickFilter?.isFilterPresent()}function GD($){return $.quickFilter?.getText()}function _D($){$.quickFilter?.resetCache()}var HD=class extends S{constructor(){super(...arguments);this.beanName="quickFilter",this.quickFilter=null,this.quickFilterParts=null}postConstruct(){let $=this.resetCache.bind(this),z=this.gos;this.addManagedEventListeners({columnPivotModeChanged:$,newColumnsLoaded:$,columnRowGroupChanged:$,columnVisible:()=>{if(!z.get("includeHiddenColumnsInQuickFilter"))this.resetCache()}}),this.addManagedPropertyListener("quickFilterText",(Q)=>this.setFilter(Q.currentValue)),this.addManagedPropertyListeners(["includeHiddenColumnsInQuickFilter","applyQuickFilterBeforePivotOrAgg"],()=>this.onColumnConfigChanged()),this.quickFilter=this.parseFilter(z.get("quickFilterText")),this.parser=z.get("quickFilterParser"),this.matcher=z.get("quickFilterMatcher"),this.setFilterParts(),this.addManagedPropertyListeners(["quickFilterMatcher","quickFilterParser"],()=>this.setParserAndMatcher())}refreshCols(){let{autoColSvc:$,colModel:z,gos:Q,pivotResultCols:J}=this.beans,Z=z.isPivotMode(),X=$?.getColumns(),Y=z.getColDefCols(),q=(Z&&!Q.get("applyQuickFilterBeforePivotOrAgg")?J?.getPivotResultCols()?.list:Y)??[];if(X)q=q.concat(X);this.colsToUse=Q.get("includeHiddenColumnsInQuickFilter")?q:q.filter((G)=>G.isVisible()||G.isRowGroupActive())}isFilterPresent(){return this.quickFilter!==null}doesRowPass($){let z=this.gos.get("cacheQuickFilter");if(this.matcher)return this.doesRowPassMatcher(z,$);return this.quickFilterParts.every((Q)=>z?this.doesRowPassCache($,Q):this.doesRowPassNoCache($,Q))}resetCache(){this.beans.rowModel.forEachNode(($)=>$.quickFilterAggregateText=null)}getText(){return this.gos.get("quickFilterText")}setFilterParts(){let{quickFilter:$,parser:z}=this;if($)this.quickFilterParts=z?z($):$.split(" ");else this.quickFilterParts=null}parseFilter($){if(!T($))return null;return $.toUpperCase()}setFilter($){if($!=null&&typeof $!=="string"){j(70,{newFilter:$});return}let z=this.parseFilter($);if(this.quickFilter!==z)this.quickFilter=z,this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}setParserAndMatcher(){let $=this.gos.get("quickFilterParser"),z=this.gos.get("quickFilterMatcher"),Q=$!==this.parser||z!==this.matcher;if(this.parser=$,this.matcher=z,Q)this.setFilterParts(),this.dispatchLocalEvent({type:"quickFilterChanged"})}onColumnConfigChanged(){if(this.refreshCols(),this.resetCache(),this.isFilterPresent())this.dispatchLocalEvent({type:"quickFilterChanged"})}doesRowPassNoCache($,z){return this.colsToUse.some((Q)=>{let J=this.getTextForColumn(Q,$);return T(J)&&J.includes(z)})}doesRowPassCache($,z){return this.checkGenerateAggText($),$.quickFilterAggregateText.includes(z)}doesRowPassMatcher($,z){let Q;if($)this.checkGenerateAggText(z),Q=z.quickFilterAggregateText;else Q=this.getAggText(z);let{quickFilterParts:J,matcher:Z}=this;return Z(J,Q)}checkGenerateAggText($){if(!$.quickFilterAggregateText)$.quickFilterAggregateText=this.getAggText($)}getTextForColumn($,z){let Q=this.beans.filterValueSvc.getValue($,z),J=$.getColDef();if(J.getQuickFilterText){let Z=y(this.gos,{value:Q,node:z,data:z.data,column:$,colDef:J});Q=J.getQuickFilterText(Z)}return T(Q)?Q.toString().toUpperCase():null}getAggText($){let z=[];for(let Q of this.colsToUse){let J=this.getTextForColumn(Q,$);if(T(J))z.push(J)}return z.join(` +`)}},UD={moduleName:"ClientSideRowModelFilter",version:p,rowModels:["clientSide"],beans:[FK]},E9={moduleName:"FilterCore",version:p,beans:[zD],apiFunctions:{isAnyFilterPresent:eL,onFilterChanged:$D},css:[xL],dependsOn:[UD]},K9={moduleName:"FilterValue",version:p,beans:[YD]},L9={moduleName:"ColumnFilter",version:p,beans:[oL,XD],dynamicBeans:{headerFilterCellCtrl:IL},icons:{filter:"filter",filterActive:"filter"},apiFunctions:{isColumnFilterPresent:wL,getColumnFilterInstance:NL,destroyFilter:gL,setFilterModel:hL,getFilterModel:uL,getColumnFilterModel:mL,setColumnFilterModel:cL,showColumnFilter:pL,hideColumnFilter:iL,getColumnFilterHandler:nL,doFilterAction:dL},dependsOn:[E9,nz,K9,v4]};var WD={moduleName:"QuickFilterCore",version:p,rowModels:["clientSide"],beans:[HD],dependsOn:[E9,K9]},D9={moduleName:"QuickFilter",version:p,apiFunctions:{isQuickFilterPresent:qD,getQuickFilter:GD,resetQuickFilter:_D},dependsOn:[WD]};var BD=class extends S{constructor(){super(...arguments);this.beanName="apiEventSvc",this.syncListeners=new Map,this.asyncListeners=new Map,this.syncGlobalListeners=new Set,this.globalListenerPairs=new Map}postConstruct(){this.wrapSvc=this.beans.frameworkOverrides.createGlobalEventListenerWrapper?.()}addListener($,z){let Q=this.wrapSvc?.wrap($,z)??z,J=!l1.has($),Z=J?this.asyncListeners:this.syncListeners;if(!Z.has($))Z.set($,new Set);Z.get($).add(Q),this.eventSvc.addListener($,Q,J)}removeListener($,z){let Q=this.wrapSvc?.unwrap($,z)??z,Z=!!this.asyncListeners.get($)?.delete(Q);if(!Z)this.syncListeners.get($)?.delete(Q);this.eventSvc.removeListener($,Q,Z)}addGlobalListener($){let z=this.wrapSvc?.wrapGlobal($)??$,Q=(X,Y)=>{if(l1.has(X))z(X,Y)},J=(X,Y)=>{if(!l1.has(X))z(X,Y)};this.globalListenerPairs.set($,{syncListener:Q,asyncListener:J});let Z=this.eventSvc;Z.addGlobalListener(Q,!1),Z.addGlobalListener(J,!0)}removeGlobalListener($){let{eventSvc:z,wrapSvc:Q,globalListenerPairs:J}=this,Z=Q?.unwrapGlobal($)??$;if(J.has(Z)){let{syncListener:Y,asyncListener:q}=J.get(Z);z.removeGlobalListener(Y,!1),z.removeGlobalListener(q,!0),J.delete($)}else this.syncGlobalListeners.delete(Z),z.removeGlobalListener(Z,!1)}destroyEventListeners($,z){$.forEach((Q,J)=>{Q.forEach((Z)=>this.eventSvc.removeListener(J,Z,z)),Q.clear()}),$.clear()}destroyGlobalListeners($,z){for(let Q of $)this.eventSvc.removeGlobalListener(Q,z);$.clear()}destroy(){super.destroy(),this.destroyEventListeners(this.syncListeners,!1),this.destroyEventListeners(this.asyncListeners,!0),this.destroyGlobalListeners(this.syncGlobalListeners,!1);let{globalListenerPairs:$,eventSvc:z}=this;$.forEach(({syncListener:Q,asyncListener:J})=>{z.removeGlobalListener(Q,!1),z.removeGlobalListener(J,!0)}),$.clear()}};function ED($,z,Q){$.apiEventSvc?.addListener(z,Q)}function KD($,z,Q){$.apiEventSvc?.removeListener(z,Q)}function LD($,z){$.apiEventSvc?.addGlobalListener(z)}function DD($,z){$.apiEventSvc?.removeGlobalListener(z)}var F9={moduleName:"EventApi",version:p,apiFunctions:{addEventListener:ED,addGlobalListener:LD,removeEventListener:KD,removeGlobalListener:DD},beans:[BD]};function M$($,z){if(typeof $!=="number")return"";let Q=z(),J=Q("thousandSeparator",","),Z=Q("decimalSeparator",".");return $.toString().replace(".",Z).replace(/(\d)(?=(\d{3})+(?!\d))/g,`$1${J}`)}var FD="↑",MD="↓",kD={tag:"span",children:[{tag:"span",ref:"eDelta",cls:"ag-value-change-delta"},{tag:"span",ref:"eValue",cls:"ag-value-change-value"}]},VD=class extends x{constructor(){super(kD);this.eValue=f,this.eDelta=f,this.refreshCount=0}init($){this.refresh($,!0)}showDelta($,z){let Q=Math.abs(z),J=$.formatValue(Q),Z=T(J)?J:Q,X=z>=0,Y=this.eDelta;if(X)Y.textContent=FD+Z;else Y.textContent=MD+Z;Y.classList.toggle("ag-value-change-delta-up",X),Y.classList.toggle("ag-value-change-delta-down",!X)}setTimerToRemoveDelta(){this.refreshCount++;let $=this.refreshCount;this.beans.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if($===this.refreshCount)this.hideDeltaValue()},2000)})}hideDeltaValue(){this.eValue.classList.remove("ag-value-change-value-highlight"),z0(this.eDelta)}refresh($,z=!1){let{value:Q,valueFormatted:J}=$,{eValue:Z,lastValue:X,beans:Y}=this;if(Q===X)return!1;if(T(J))Z.textContent=J;else if(T(Q))Z.textContent=Q;else z0(Z);if(Y.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;let q=Q&&typeof Q==="object"&&"toNumber"in Q?Q.toNumber():Q,G=X&&typeof X==="object"&&"toNumber"in X?X.toNumber():X;if(q===G)return!1;if(typeof q==="number"&&typeof G==="number"){let _=q-G;this.showDelta($,_)}if(X)Z.classList.add("ag-value-change-value-highlight");if(!z)this.setTimerToRemoveDelta();return this.lastValue=Q,!0}},AD=".ag-value-slide-out{opacity:1}:where(.ag-ltr) .ag-value-slide-out{margin-right:5px;transition:opacity 3s,margin-right 3s}:where(.ag-rtl) .ag-value-slide-out{margin-left:5px;transition:opacity 3s,margin-left 3s}:where(.ag-ltr,.ag-rtl) .ag-value-slide-out{transition-timing-function:linear}.ag-value-slide-out-end{opacity:0}:where(.ag-ltr) .ag-value-slide-out-end{margin-right:10px}:where(.ag-rtl) .ag-value-slide-out-end{margin-left:10px}",SD={tag:"span",children:[{tag:"span",ref:"eCurrent",cls:"ag-value-slide-current"}]},RD=class extends x{constructor(){super(SD);this.eCurrent=f,this.refreshCount=0,this.registerCSS(AD)}init($){this.refresh($,!0)}addSlideAnimation(){this.refreshCount++;let $=this.refreshCount;this.ePrevious?.remove();let{beans:z,eCurrent:Q}=this,J=J0({tag:"span",cls:"ag-value-slide-previous ag-value-slide-out"});this.ePrevious=J,J.textContent=Q.textContent,this.getGui().insertBefore(J,Q),z.frameworkOverrides.wrapIncoming(()=>{window.setTimeout(()=>{if($!==this.refreshCount)return;this.ePrevious.classList.add("ag-value-slide-out-end")},50),window.setTimeout(()=>{if($!==this.refreshCount)return;this.ePrevious?.remove(),this.ePrevious=null},3000)})}refresh($,z=!1){let Q=$.value;if(n(Q))Q="";if(Q===this.lastValue)return!1;if(this.beans.filterManager?.isSuppressFlashingCellsBecauseFiltering())return!1;if(!z)this.addSlideAnimation();this.lastValue=Q;let J=this.eCurrent;if(T($.valueFormatted))J.textContent=$.valueFormatted;else if(T($.value))J.textContent=Q;else z0(J);return!0}},jD=class extends S{constructor(){super(...arguments);this.beanName="cellFlashSvc",this.nextAnimationTime=null,this.nextAnimationCycle=null,this.animations={highlight:new Map,"data-changed":new Map}}animateCell($,z,Q=this.beans.gos.get("cellFlashDuration"),J=this.beans.gos.get("cellFadeDuration")){let Z=this.animations[z];Z.delete($);let X=Date.now(),Y=X+Q,q=X+Q+J,G={phase:"flash",flashEndTime:Y,fadeEndTime:q};Z.set($,G);let _=`ag-cell-${z}`,H=`${_}-animation`,{comp:U,eGui:{style:W}}=$;if(U.toggleCss(_,!0),U.toggleCss(H,!1),W.removeProperty("transition"),W.removeProperty("transition-delay"),this.nextAnimationTime&&Y+15{this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),Q)}),this.nextAnimationTime=Y}advanceAnimations(){let $=Date.now(),z=null;for(let Q of Object.keys(this.animations)){let J=this.animations[Q],Z=`ag-cell-${Q}`,X=`${Z}-animation`;for(let[Y,q]of J){if(!Y.isAlive()||!Y.comp){J.delete(Y);continue}let{phase:G,flashEndTime:_,fadeEndTime:H}=q,U=G==="flash"?_:H;if(!($+15>=U)){z=Math.min(U,z??1/0);continue}let{comp:B,eGui:{style:E}}=Y;switch(G){case"flash":B.toggleCss(Z,!1),B.toggleCss(X,!0),E.transition=`background-color ${H-_}ms`,E.transitionDelay=`${_-$}ms`,z=Math.min(H,z??1/0),q.phase="fade";break;case"fade":B.toggleCss(Z,!1),B.toggleCss(X,!1),E.removeProperty("transition"),E.removeProperty("transition-delay"),J.delete(Y);break}}}if(z==null)this.nextAnimationTime=null,this.nextAnimationCycle=null;else if(z)this.nextAnimationCycle=setTimeout(this.advanceAnimations.bind(this),z-$),this.nextAnimationTime=z}onFlashCells($,z){if(!$.comp)return;let Q=b$($.cellPosition);if(z.cells[Q])this.animateCell($,"highlight")}flashCell($,z){this.animateCell($,"data-changed",z?.flashDuration,z?.fadeDuration)}destroy(){for(let $ of Object.keys(this.animations))this.animations[$].clear()}};function fD($,z={}){let{cellFlashSvc:Q}=$;if(!Q)return;$.frameworkOverrides.wrapIncoming(()=>{for(let J of $.rowRenderer.getCellCtrls(z.rowNodes,z.columns))Q.flashCell(J,z)})}var M9={moduleName:"HighlightChanges",version:p,beans:[jD],userComponents:{agAnimateShowChangeCellRenderer:VD,agAnimateSlideCellRenderer:RD},apiFunctions:{flashCells:fD}};var OD=class extends S{constructor(){super(...arguments);this.beanName="selectionColSvc"}postConstruct(){this.addManagedPropertyListener("rowSelection",($)=>{this.onSelectionOptionsChanged($.currentValue,$.previousValue,Xz($.source))}),this.addManagedPropertyListener("selectionColumnDef",this.updateColumns.bind(this))}addColumns($){let z=this.columns;if(z==null)return;$.list=z.list.concat($.list),$.tree=z.tree.concat($.tree),_1($)}createColumns($,z){let Q=()=>{J$(this.beans,this.columns?.tree),this.columns=null},J=$.treeDepth,X=(this.columns?.treeDepth??-1)==J,Y=this.generateSelectionCols();if(G1(Y,this.columns?.list??[])&&X)return;Q();let{colGroupSvc:G}=this.beans,_=G?.findDepth($.tree)??0,H=G?.balanceTreeForAutoCols(Y,_)??[];this.columns={list:Y,tree:H,treeDepth:_,map:{}},z((W)=>{if(!W)return null;let B=W.filter((E)=>!I$(E));return[...Y,...B]})}updateColumns($){let z=Xz($.source),{beans:Q}=this;for(let J of this.columns?.list??[]){let Z=this.createSelectionColDef($.currentValue);J.setColDef(Z,null,z),n0(Q,{state:[i2(Z,J.colId)]},z)}}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}isSelectionColumnEnabled(){let{gos:$,beans:z}=this,Q=$.get("rowSelection");if(typeof Q!=="object"||!h$($))return!1;let J=(z.autoColSvc?.getColumns()?.length??0)>0;if(Q.checkboxLocation==="autoGroupColumn"&&J)return!1;let Z=!!Qz(Q),X=d1(Q);return Z||X}createSelectionColDef($){let{gos:z}=this,Q=$??z.get("selectionColumnDef"),J=z.get("enableRtl"),{rowSpan:Z,spanRows:X,...Y}=Q??{};return{width:50,resizable:!1,suppressHeaderMenuButton:!0,sortable:!1,suppressMovable:!0,lockPosition:J?"right":"left",comparator(q,G,_,H){let U=_.isSelected(),W=H.isSelected();return U===W?0:U?1:-1},editable:!1,suppressFillHandle:!0,suppressAutoSize:!0,pinned:null,...Y,colId:M7,chartDataType:"excluded"}}generateSelectionCols(){if(!this.isSelectionColumnEnabled())return[];let $=this.createSelectionColDef(),z=$.colId;this.gos.validateColDef($,z,!0);let Q=new q$($,null,z,!1);return this.createBean(Q),[Q]}onSelectionOptionsChanged($,z,Q){let J=z&&typeof z!=="string"?Qz(z):void 0,Z=$&&typeof $!=="string"?Qz($):void 0,X=J!==Z,Y=z&&typeof z!=="string"?d1(z):void 0,q=$&&typeof $!=="string"?d1($):void 0,G=Y!==q,_=EQ($),H=EQ(z);if(X||G||_!==H)this.beans.colModel.refreshAll(Q)}destroy(){J$(this.beans,this.columns?.tree),super.destroy()}refreshVisibility($,z,Q){if(!this.columns?.list.length)return;let J=$.length+z.length+Q.length;if(J===0)return;let Z=this.columns.list[0];if(!Z.isVisible())return;let X=()=>{let G;switch(Z.pinned){case"left":case!0:G=$;break;case"right":G=Q;break;default:G=z}if(G)Z0(G,Z)};if((this.beans.rowNumbersSvc?.getColumn(k7)?2:1)===J)X()}},PD=':where(.ag-selection-checkbox) .ag-checkbox-input-wrapper:before{content:"";cursor:pointer;inset:-8px;position:absolute}';function TD($,z){if(!z.nodes.every((Y)=>{if(Y.rowPinned&&!iJ(Y))return j(59),!1;if(Y.id===void 0)return j(60),!1;return!0}))return;let{nodes:J,source:Z,newValue:X}=z;$.selectionSvc?.setNodesSelected({nodes:J,source:Z??"api",newValue:X})}function vD($,z,Q="apiSelectAll"){$.selectionSvc?.selectAllRowNodes({source:Q,selectAll:z})}function ID($,z,Q="apiSelectAll"){$.selectionSvc?.deselectAllRowNodes({source:Q,selectAll:z})}function CD($,z="apiSelectAllFiltered"){$.selectionSvc?.selectAllRowNodes({source:z,selectAll:"filtered"})}function bD($,z="apiSelectAllFiltered"){$.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"filtered"})}function yD($,z="apiSelectAllCurrentPage"){$.selectionSvc?.selectAllRowNodes({source:z,selectAll:"currentPage"})}function xD($,z="apiSelectAllCurrentPage"){$.selectionSvc?.deselectAllRowNodes({source:z,selectAll:"currentPage"})}function wD($){return $.selectionSvc?.getSelectedNodes()??[]}function ND($){return $.selectionSvc?.getSelectedRows()??[]}var gD={tag:"div",cls:"ag-selection-checkbox",role:"presentation",children:[{tag:"ag-checkbox",ref:"eCheckbox",role:"presentation"}]},hD=class extends x{constructor(){super(gD,[y$]);this.eCheckbox=f}postConstruct(){this.eCheckbox.setPassive(!0)}onDataChanged(){this.onSelectionChanged()}onSelectableChanged(){this.showOrHideSelect()}onSelectionChanged(){let $=this.getLocaleTextFunc(),{rowNode:z,eCheckbox:Q}=this,J=z.isSelected(),Z=O2($,J),[X,Y]=z.selectable?["ariaRowToggleSelection","Press Space to toggle row selection"]:["ariaRowSelectionDisabled","Row Selection is disabled for this row"],q=$(X,Y);Q.setValue(J,!0),Q.setInputAriaLabel(`${q} (${Z})`)}init($){if(this.rowNode=$.rowNode,this.column=$.column,this.overrides=$.overrides,this.onSelectionChanged(),this.addManagedListeners(this.eCheckbox.getWrapperElement(),{dblclick:i0,click:(J)=>{if(i0(J),this.eCheckbox.isDisabled())return;this.beans.selectionSvc?.handleSelectionEvent(J,this.rowNode,"checkboxSelected")}}),this.addManagedListeners(this.rowNode,{rowSelected:this.onSelectionChanged.bind(this),dataChanged:this.onDataChanged.bind(this),selectableChanged:this.onSelectableChanged.bind(this)}),this.addManagedPropertyListener("rowSelection",({currentValue:J,previousValue:Z})=>{let X=typeof J==="object"?RZ(J):void 0,Y=typeof Z==="object"?RZ(Z):void 0;if(X!==Y)this.onSelectableChanged()}),Z2(this.gos)||typeof this.getIsVisible()==="function"){let J=this.showOrHideSelect.bind(this);this.addManagedEventListeners({displayedColumnsChanged:J}),this.addManagedListeners(this.rowNode,{dataChanged:J,cellChanged:J}),this.showOrHideSelect()}this.eCheckbox.getInputElement().setAttribute("tabindex","-1")}showOrHideSelect(){let{column:$,rowNode:z,overrides:Q,gos:J}=this,Z=z.selectable,X=this.getIsVisible(),Y=void 0;if(typeof X==="function"){let U=Q?.callbackParams;if(!$)Y=X({...U,node:z,data:z.data});else{let W=$.createColumnFunctionCallbackParams(z);Y=X({...U,...W})}}else Y=X??!1;let q=Z&&!Y||!Z&&Y,G=Z||Y,_=J.get("rowSelection"),H=_&&typeof _!=="string"?!RZ(_):!!$?.getColDef().showDisabledCheckboxes;if(this.setVisible(G&&(q?H:!0)),this.setDisplayed(G&&(q?H:!0)),G)this.eCheckbox.setDisabled(q);if(Q?.removeHidden)this.setDisplayed(G)}getIsVisible(){let $=this.overrides;if($)return $.isVisible;let z=this.gos.get("rowSelection");if(z&&typeof z!=="string")return Qz(z);return this.column?.getColDef()?.checkboxSelection}},uD=class{constructor($,z){this.rowModel=$,this.pinnedRowModel=z,this.selectAll=!1,this.rootId=null,this.endId=null,this.cachedRange=[]}reset(){this.rootId=null,this.endId=null,this.cachedRange.length=0}setRoot($){this.rootId=$.id,this.endId=null,this.cachedRange.length=0}setEndRange($){this.endId=$.id,this.cachedRange.length=0}getRange(){if(this.cachedRange.length===0){let $=this.getRoot(),z=this.getEnd();if($==null||z==null)return this.cachedRange;this.cachedRange=this.getNodesInRange($,z)??[]}return this.cachedRange}isInRange($){if(this.rootId===null)return!1;return this.getRange().some((z)=>z.id===$.id)}getRoot($){if(this.rootId)return this.getRowNode(this.rootId);if($)return this.setRoot($),$}getEnd(){if(this.endId)return this.getRowNode(this.endId)}getRowNode($){let z,{rowModel:Q,pinnedRowModel:J}=this;if(z??(z=Q.getRowNode($)),J?.isManual())z??(z=J.getPinnedRowById($,"top")),z??(z=J.getPinnedRowById($,"bottom"));return z}truncate($){let z=this.getRange();if(z.length===0)return{keep:[],discard:[]};let Q=z[0].id===this.rootId,J=z.findIndex((Z)=>Z.id===$.id);if(J>-1){let Z=z.slice(0,J),X=z.slice(J+1);return this.setEndRange($),Q?{keep:Z,discard:X}:{keep:X,discard:Z}}else return{keep:z,discard:[]}}extend($,z=!1){let Q=this.getRoot();if(Q==null){let Z=this.getRange().slice();if(z)$.depthFirstSearch((X)=>!X.group&&Z.push(X));return Z.push($),this.setRoot($),{keep:Z,discard:[]}}let J=this.getNodesInRange(Q,$);if(!J)return this.setRoot($),{keep:[$],discard:[]};if(J.find((Z)=>Z.id===this.endId))return this.setEndRange($),{keep:this.getRange(),discard:[]};else{let Z=this.getRange().slice();return this.setEndRange($),{keep:this.getRange(),discard:Z}}}getNodesInRange($,z){let{pinnedRowModel:Q,rowModel:J}=this;if(!Q?.isManual())return J.getNodesInRangeForSelection($,z);if($.rowPinned==="top"&&!z.rowPinned)return t0(Q,"top",$,void 0).concat(J.getNodesInRangeForSelection(J.getRow(0),z)??[]);if($.rowPinned==="bottom"&&!z.rowPinned){let Z=t0(Q,"bottom",void 0,$),X=J.getRowCount(),Y=J.getRow(X-1);return(J.getNodesInRangeForSelection(z,Y)??[]).concat(Z)}if(!$.rowPinned&&!z.rowPinned)return J.getNodesInRangeForSelection($,z);if($.rowPinned==="top"&&z.rowPinned==="top")return t0(Q,"top",$,z);if($.rowPinned==="bottom"&&z.rowPinned==="top"){let Z=t0(Q,"top",z,void 0),X=t0(Q,"bottom",void 0,$),Y=J.getRow(0),q=J.getRow(J.getRowCount()-1);return Z.concat(J.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if(!$.rowPinned&&z.rowPinned==="top")return t0(Q,"top",z,void 0).concat(J.getNodesInRangeForSelection(J.getRow(0),$)??[]);if($.rowPinned==="top"&&z.rowPinned==="bottom"){let Z=t0(Q,"top",$,void 0),X=t0(Q,"bottom",void 0,z),Y=J.getRow(0),q=J.getRow(J.getRowCount()-1);return Z.concat(J.getNodesInRangeForSelection(Y,q)??[]).concat(X)}if($.rowPinned==="bottom"&&z.rowPinned==="bottom")return t0(Q,"bottom",$,z);if(!$.rowPinned&&z.rowPinned==="bottom"){let Z=t0(Q,"bottom",void 0,z),X=J.getRow(J.getRowCount());return(J.getNodesInRangeForSelection($,X)??[]).concat(Z)}return null}},mD=class extends S{constructor($){super();this.column=$,this.cbSelectAllVisible=!1,this.processingEventFromCheckbox=!1}onSpaceKeyDown($){let z=this.cbSelectAll;if(z.isDisplayed()&&!z.getGui().contains(d(this.beans)))$.preventDefault(),z.setValue(!z.getValue())}getCheckboxGui(){return this.cbSelectAll.getGui()}setComp($){this.headerCellCtrl=$;let z=this.createManagedBean(new K4);this.cbSelectAll=z,z.addCss("ag-header-select-all"),_0(z.getGui(),"presentation"),this.showOrHideSelectAll();let Q=this.updateStateOfCheckbox.bind(this);this.addManagedEventListeners({newColumnsLoaded:()=>this.showOrHideSelectAll(),displayedColumnsChanged:this.onDisplayedColumnsChanged.bind(this),selectionChanged:Q,paginationChanged:Q,modelUpdated:Q}),this.addManagedPropertyListener("rowSelection",({currentValue:J,previousValue:Z})=>{let X=(Y)=>typeof Y==="string"||!Y||Y.mode==="singleRow"?void 0:Y.selectAll;if(X(J)!==X(Z))this.showOrHideSelectAll();this.updateStateOfCheckbox()}),this.addManagedListeners(z,{fieldValueChanged:this.onCbSelectAll.bind(this)}),z.getInputElement().setAttribute("tabindex","-1"),this.refreshSelectAllLabel()}onDisplayedColumnsChanged($){if(!this.isAlive())return;this.showOrHideSelectAll($.source==="uiColumnMoved")}showOrHideSelectAll($=!1){let z=this.isCheckboxSelection();if(this.cbSelectAllVisible=z,this.cbSelectAll.setDisplayed(z),z)this.checkRightRowModelType("selectAllCheckbox"),this.checkSelectionType("selectAllCheckbox"),this.updateStateOfCheckbox();this.refreshSelectAllLabel($)}updateStateOfCheckbox(){if(!this.cbSelectAllVisible||this.processingEventFromCheckbox)return;this.processingEventFromCheckbox=!0;let $=this.getSelectAllMode(),z=this.beans.selectionSvc,Q=this.cbSelectAll,J=z.getSelectAllState($);Q.setValue(J);let Z=z.hasNodesToSelect($);Q.setDisabled(!Z),this.refreshSelectAllLabel(),this.processingEventFromCheckbox=!1}refreshSelectAllLabel($=!1){let z=this.getLocaleTextFunc(),{headerCellCtrl:Q,cbSelectAll:J,cbSelectAllVisible:Z}=this,X=J.getValue(),Y=O2(z,X),q=z("ariaRowSelectAll","Press Space to toggle all rows selection");if(Q.setAriaDescriptionProperty("selectAll",Z?`${q} (${Y})`:null),J.setInputAriaLabel(z("ariaHeaderSelection","Column with Header Selection")),!$)Q.announceAriaDescription()}checkSelectionType($){if(!rQ(this.gos))return j(128,{feature:$}),!1;return!0}checkRightRowModelType($){let{gos:z,rowModel:Q}=this.beans;if(!(o(z)||_z(z)))return j(129,{feature:$,rowModel:Q.getType()}),!1;return!0}onCbSelectAll(){if(this.processingEventFromCheckbox)return;if(!this.cbSelectAllVisible)return;let $=this.cbSelectAll.getValue(),z=this.getSelectAllMode(),Q="uiSelectAll";if(z==="currentPage")Q="uiSelectAllCurrentPage";else if(z==="filtered")Q="uiSelectAllFiltered";let J={source:Q,selectAll:z},Z=this.beans.selectionSvc;if($)Z.selectAllRowNodes(J);else Z.deselectAllRowNodes(J)}isCheckboxSelection(){let{column:$,gos:z,beans:Q}=this,X=typeof z.get("rowSelection")==="object"?"headerCheckbox":"headerCheckboxSelection";return k9(Q,$)&&this.checkRightRowModelType(X)&&this.checkSelectionType(X)}getSelectAllMode(){let $=H7(this.gos,!1);if($)return $;let{headerCheckboxSelectionCurrentPageOnly:z,headerCheckboxSelectionFilteredOnly:Q}=this.column.getColDef();if(z)return"currentPage";if(Q)return"filtered";return"all"}destroy(){super.destroy(),this.cbSelectAll=void 0,this.headerCellCtrl=void 0}};function k9({gos:$,selectionColSvc:z},Q){let J=$.get("rowSelection"),Z=Q.getColDef(),{headerCheckboxSelection:X}=Z,Y=!1;if(typeof J==="object"){let G=I$(Q),_=mz(Q);if(EQ(J)==="autoGroupColumn"&&_||G&&z?.isSelectionColumnEnabled())Y=d1(J)}else if(typeof X==="function")Y=X(y($,{column:Q,colDef:Z}));else Y=!!X;return Y}var cD=class extends S{postConstruct(){let{gos:$,beans:z}=this;this.selectionCtx=new uD(z.rowModel,z.pinnedRowModel),this.addManagedPropertyListeners(["isRowSelectable","rowSelection"],()=>{let Q=Z2($);if(Q!==this.isRowSelectable)this.isRowSelectable=Q,this.updateSelectable()}),this.isRowSelectable=Z2($),this.addManagedEventListeners({cellValueChanged:(Q)=>this.updateRowSelectable(Q.node),rowNodeDataChanged:(Q)=>this.updateRowSelectable(Q.node)})}destroy(){super.destroy(),this.selectionCtx.reset()}createCheckboxSelectionComponent(){return new hD}createSelectAllFeature($){if(k9(this.beans,$))return new mD($)}isMultiSelect(){return rQ(this.gos)}onRowCtrlSelected($,z,Q){let J=!!$.rowNode.isSelected();$.forEachGui(Q,(Z)=>{Z.rowComp.toggleCss("ag-row-selected",J);let X=Z.element;if(f2(X,J),X.contains(d(this.beans)))z(Z)})}announceAriaRowSelection($){if(this.isRowSelectionBlocked($))return;let z=$.isSelected(),Q=this.beans.editSvc?.isEditing({rowNode:$});if(!$.selectable||Q)return;let Z=this.getLocaleTextFunc()(z?"ariaRowDeselect":"ariaRowSelect",`Press SPACE to ${z?"deselect":"select"} this row`);this.beans.ariaAnnounce?.announceValue(Z,"rowSelection")}isRowSelectionBlocked($){return!$.selectable||$.rowPinned&&!iJ($)||!h$(this.gos)}updateRowSelectable($,z){let Q=$.rowPinned&&$.pinnedSibling?$.pinnedSibling.selectable:this.isRowSelectable?.($)??!0;return this.setRowSelectable($,Q,z),Q}setRowSelectable($,z,Q){if($.selectable!==z){if($.selectable=z,$.dispatchRowEvent("selectableChanged"),Q)return;if(lQ(this.gos)){let Z=this.calculateSelectedFromChildren($);this.setNodesSelected({nodes:[$],newValue:Z??!1,source:"selectableChanged"});return}if($.isSelected()&&!$.selectable)this.setNodesSelected({nodes:[$],newValue:!1,source:"selectableChanged"})}}calculateSelectedFromChildren($){let z=!1,Q=!1;if(!$.childrenAfterGroup?.length)return $.selectable?$.__selected:null;for(let J=0;J<$.childrenAfterGroup.length;J++){let Z=$.childrenAfterGroup[J],X=Z.isSelected();if(!Z.selectable){let Y=this.calculateSelectedFromChildren(Z);if(Y===null)continue;X=Y}switch(X){case!0:z=!0;break;case!1:Q=!0;break;default:return}}if(z&&Q)return;if(z)return!0;if(Q)return!1;if(!$.selectable)return null;return $.__selected}selectRowNode($,z,Q,J="api"){if(z&&$.destroyed)return!1;let Z=!$.selectable&&z,X=$.__selected===z;if(Z||X)return!1;$.__selected=z,$.dispatchRowEvent("rowSelected");let Y=$.sibling;if(Y&&Y.footer&&Y.__localEventService)Y.dispatchRowEvent("rowSelected");let q=$.pinnedSibling;if(q?.rowPinned&&q.__localEventService)q.dispatchRowEvent("rowSelected");return this.eventSvc.dispatchEvent({...e2($,this.gos,"rowSelected"),event:Q||null,source:J}),!0}isCellCheckboxSelection($,z){let Q=this.gos.get("rowSelection");if(Q&&typeof Q!=="string"){let J=I$($)&&Qz(Q);return $.isColumnFunc(z,J)}else return $.isColumnFunc(z,$.colDef.checkboxSelection)}inferNodeSelections($,z,Q,J){let{gos:Z,selectionCtx:X}=this,Y=$.isSelected(),q=lQ(Z),G=gq(Z),_=hq(Z),H=this.isMultiSelect(),U=J==="rowClicked";if(U&&!(G||_))return null;if(z&&Q&&H){let W=X.getRoot();if(!W)return null;else if(!W.isSelected()){let B=X.extend($,q);return{select:[],deselect:B.keep,reset:!1}}else{let B=X.isInRange($)?X.truncate($):X.extend($,q);return{deselect:B.discard,select:B.keep,reset:!1}}}else if(z&&H){let W=X.selectAll?this.beans.rowModel.getRow(0):void 0,B=X.getRoot(W),E=X.isInRange($)?X.truncate($):X.extend($,q);return{select:E.keep,deselect:E.discard,reset:X.selectAll||!!(B&&!B.isSelected())}}else if(Q){if(U){let W=!Y;if(W&&!G||!W&&!_)return null;return X.setRoot($),{node:$,newValue:W,clearSelection:!1}}return X.setRoot($),{node:$,newValue:!Y,clearSelection:!H}}else{X.setRoot($);let W=uq(Z),B=ZJ(Z)==="filteredDescendants",E=U&&(!W||!G);if(B&&Y===void 0&&o(Z))return{node:$,newValue:!1,checkFilteredNodes:!0,clearSelection:!H||E};if(U){let K=Y?!W:G;if(K===Y&&!E||K&&!G||!K&&!_)return null;return{node:$,newValue:K,clearSelection:!H||E,keepDescendants:$.group&&q}}return{node:$,newValue:!Y,clearSelection:!H||E}}}},pD=class extends cD{constructor(){super(...arguments);this.beanName="selectionSvc",this.selectedNodes=new Map,this.detailSelection=new Map,this.masterSelectsDetail=!1}postConstruct(){super.postConstruct();let{gos:$}=this;this.mode=JJ($),this.groupSelectsDescendants=lQ($),this.groupSelectsFiltered=ZJ($)==="filteredDescendants",this.masterSelectsDetail=D5($)==="detail",this.addManagedPropertyListeners(["groupSelectsChildren","groupSelectsFiltered","rowSelection"],()=>{let z=lQ($),Q=JJ($),J=ZJ($)==="filteredDescendants";if(this.masterSelectsDetail=D5($)==="detail",z!==this.groupSelectsDescendants||J!==this.groupSelectsFiltered||Q!==this.mode)this.deselectAllRowNodes({source:"api"}),this.groupSelectsDescendants=z,this.groupSelectsFiltered=J,this.mode=Q}),this.addManagedEventListeners({rowSelected:this.onRowSelected.bind(this)})}destroy(){super.destroy(),this.resetNodes()}handleSelectionEvent($,z,Q){if(this.isRowSelectionBlocked(z))return 0;let J=this.inferNodeSelections(z,$.shiftKey,$.metaKey||$.ctrlKey,Q);if(J==null)return 0;if(this.selectionCtx.selectAll=!1,"select"in J){if(J.reset)this.resetNodes();else this.selectRange(J.deselect,!1,Q);return this.selectRange(J.select,!0,Q)}else{let Z=J.checkFilteredNodes?A9(J.node):J.newValue;return this.setNodesSelected({nodes:[J.node],newValue:Z,clearSelection:J.clearSelection,keepDescendants:J.keepDescendants,event:$,source:Q})}}setNodesSelected({newValue:$,clearSelection:z,suppressFinishActions:Q,nodes:J,event:Z,source:X,keepDescendants:Y=!1}){if(J.length===0)return 0;let{gos:q}=this;if(!h$(q)&&$)return j(132),0;if(J.length>1&&!this.isMultiSelect())return j(130),0;let G=0;for(let _=0;_0)this.updateGroupsFromChildrenSelections(X),this.dispatchSelectionChanged(X)}return G}selectRange($,z,Q){let J=0;if($.forEach((Z)=>{let X=Z.primaryRow;if(X.group&&this.groupSelectsDescendants)return;if(this.selectRowNode(X,z,void 0,Q))J++}),J>0)this.updateGroupsFromChildrenSelections(Q),this.dispatchSelectionChanged(Q);return J}selectChildren($,z,Q){let J=this.groupSelectsFiltered?$.childrenAfterAggFilter:$.childrenAfterGroup;if(!J)return 0;return this.setNodesSelected({newValue:z,clearSelection:!1,suppressFinishActions:!0,source:Q,nodes:J})}getSelectedNodes(){return Array.from(this.selectedNodes.values())}getSelectedRows(){let $=[];return this.selectedNodes.forEach((z)=>z.data&&$.push(z.data)),$}getSelectionCount(){return this.selectedNodes.size}filterFromSelection($){let z=new Map;this.selectedNodes.forEach((Q,J)=>{if($(Q))z.set(J,Q)}),this.selectedNodes=z}updateGroupsFromChildrenSelections($,z){if(!this.groupSelectsDescendants)return!1;let{gos:Q,rowModel:J}=this.beans;if(!o(Q,J))return!1;let Z=J.rootNode;if(!Z)return!1;let X=!1,Y=(q)=>{if(q!==Z){let G=this.calculateSelectedFromChildren(q);X=this.selectRowNode(q,G===null?!1:G,void 0,$)||X}};return S0(Z,this.beans.rowModel.hierarchical,z,Y),X}clearOtherNodes($,z,Q){let J=new Map,Z=0;return this.selectedNodes.forEach((X)=>{let Y=X.id==$.id;if((z?!nD($,X):!0)&&!Y){let G=this.selectedNodes.get(X.id);if(Z+=this.setNodesSelected({nodes:[G],newValue:!1,clearSelection:!1,suppressFinishActions:!0,source:Q}),this.groupSelectsDescendants&&X.parent)J.set(X.parent.id,X.parent)}}),J.forEach((X)=>{let Y=this.calculateSelectedFromChildren(X);this.selectRowNode(X,Y===null?!1:Y,void 0,Q)}),Z}onRowSelected($){let z=$.node;if(this.groupSelectsDescendants&&z.group)return;if(z.isSelected())this.selectedNodes.set(z.id,z);else this.selectedNodes.delete(z.id)}syncInRowNode($,z){this.syncInOldRowNode($,z),this.syncInNewRowNode($)}createDaemonNode($){if(!$.id)return;let z=new Wz(this.beans);return z.id=$.id,z.data=$.data,z.__selected=$.__selected,z.level=$.level,z}syncInOldRowNode($,z){if(z&&$.id!==z.id){if(this.selectedNodes.get(z.id)==$)this.selectedNodes.set(z.id,z)}}syncInNewRowNode($){if(this.selectedNodes.has($.id))$.__selected=!0,this.selectedNodes.set($.id,$);else $.__selected=!1}reset($){let z=this.getSelectionCount();if(this.resetNodes(),z)this.dispatchSelectionChanged($)}resetNodes(){this.selectedNodes.forEach(($)=>{this.selectRowNode($,!1)}),this.selectedNodes.clear()}getBestCostNodeSelection(){let{gos:$,rowModel:z}=this.beans;if(!o($,z))return;let Q=z.getTopLevelNodes();if(Q===null)return;let J=[];function Z(X){for(let Y=0,q=X.length;Y{let Y=this.selectRowNode(X.primaryRow,!1,void 0,$);J||(J=Y)};if(z==="currentPage"||z==="filtered"){if(!Q){e(102);return}this.getNodesToSelect(z).forEach(Z)}else this.selectedNodes.forEach(Z),this.reset($);if(this.selectionCtx.selectAll=!1,Q&&this.groupSelectsDescendants){let X=this.updateGroupsFromChildrenSelections($);J||(J=X)}if(J)this.dispatchSelectionChanged($)}getSelectedCounts($){let z=0,Q=0;return this.getNodesToSelect($).forEach((J)=>{if(this.groupSelectsDescendants&&J.group)return;if(J.isSelected())z++;else if(J.selectable)Q++}),{selectedCount:z,notSelectedCount:Q}}getSelectAllState($){let{selectedCount:z,notSelectedCount:Q}=this.getSelectedCounts($);return V9(z,Q)??null}hasNodesToSelect($){return this.getNodesToSelect($).filter((z)=>z.selectable).length>0}getNodesToSelect($){if(!this.canSelectAll())return[];let z=[],Q=(Z)=>z.push(Z);if($==="currentPage")return this.forEachNodeOnPage((Z)=>{if(!Z.group){Q(Z);return}if(!Z.footer&&!Z.expanded){let X=(Y)=>{Q(Y);let q=Y.childrenAfterFilter;if(q)for(let G=0,_=q.length;G<_;++G)X(q[G])};X(Z);return}if(!this.groupSelectsDescendants)Q(Z)}),z;let J=this.beans.rowModel;if($==="filtered")return J.forEachNodeAfterFilter(Q),z;return J.forEachNode(Q),z}forEachNodeOnPage($){let{pageBounds:z,rowModel:Q}=this.beans,J=z.getFirstRow(),Z=z.getLastRow();for(let X=J;X<=Z;X++){let Y=Q.getRow(X);if(Y)$(Y)}}selectAllRowNodes($){let{gos:z,selectionCtx:Q}=this;if(!h$(z)){j(132);return}if(Nq(z)&&!rQ(z)){j(130);return}if(!this.canSelectAll())return;let{source:J,selectAll:Z}=$,X=!1;if(this.getNodesToSelect(Z).forEach((Y)=>{let q=this.selectRowNode(Y.primaryRow,!0,void 0,J);X||(X=q)}),Q.selectAll=!0,o(z)&&this.groupSelectsDescendants){let Y=this.updateGroupsFromChildrenSelections(J);X||(X=Y)}if(X)this.dispatchSelectionChanged(J)}getSelectionState(){return this.isEmpty()?null:Array.from(this.selectedNodes.keys())}setSelectionState($,z,Q){if(!$)$=[];if(!Array.isArray($)){e(103);return}let J=new Set($),Z=[];if(this.beans.rowModel.forEachNode((X)=>{if(J.has(X.id))Z.push(X)}),Q)this.resetNodes();this.setNodesSelected({newValue:!0,nodes:Z,source:z})}canSelectAll(){return o(this.beans.gos)}updateSelectable($){let{gos:z,rowModel:Q}=this.beans;if(!h$(z))return;let J="selectableChanged",Z=o(z)&&this.groupSelectsDescendants,X=[];if(Z){let Y=Q.rootNode;if(Y)S0(Y,Q.hierarchical,$,(q)=>{let G=!1;for(let _ of q.childrenAfterGroup)if(G||(G=_.selectable),!_.group&&!this.updateRowSelectable(_,!0)&&_.isSelected())X.push(_);this.setRowSelectable(q,G,!0)})}else Q.forEachNode((Y)=>{if(!this.updateRowSelectable(Y,!0)&&Y.isSelected())X.push(Y)});if(X.length)this.setNodesSelected({nodes:X,newValue:!1,source:J});if(!$&&Z)this.updateGroupsFromChildrenSelections?.(J)}updateSelectableAfterGrouping($){if(this.updateSelectable($),this.groupSelectsDescendants){if(this.updateGroupsFromChildrenSelections?.("rowGroupChanged",$))this.dispatchSelectionChanged("rowGroupChanged")}}refreshMasterNodeState($,z){if(!this.masterSelectsDetail)return;let Q=$.detailNode?.detailGridInfo?.api;if(!Q)return;let J=iD(Q);if($.isSelected()!==J){if(this.selectRowNode($,J,z,"masterDetail"))this.dispatchSelectionChanged("masterDetail")}if(!J)this.detailSelection.set($.id,new Set(Q.getSelectedNodes().map((X)=>X.id)))}setDetailSelectionState($,z,Q){if(!this.masterSelectsDetail)return;if(!rQ(z)){j(269);return}switch($.isSelected()){case!0:{Q.selectAll();break}case!1:{Q.deselectAll();break}case void 0:{let J=this.detailSelection.get($.id);if(J){let Z=[];for(let X of J){let Y=Q.getRowNode(X);if(Y)Z.push(Y)}Q.setNodesSelected({nodes:Z,newValue:!0,source:"masterDetail"})}break}default:break}}dispatchSelectionChanged($){this.eventSvc.dispatchEvent({type:"selectionChanged",source:$,selectedNodes:this.getSelectedNodes(),serverSideState:null})}};function iD($){let z=0,Q=0;return $.forEachNode((J)=>{if(J.isSelected())z++;else if(J.selectable)Q++}),V9(z,Q)}function V9($,z){if($===0&&z===0)return!1;if($>0&&z>0)return;return $>0}function nD($,z){let Q=z.parent;while(Q){if(Q===$)return!0;Q=Q.parent}return!1}function A9($){let z=$.isSelected()===!1,Q=$.childrenAfterFilter?.some(A9)??!1;return z||Q}var dD={moduleName:"SharedRowSelection",version:p,beans:[OD],css:[PD],apiFunctions:{setNodesSelected:TD,selectAll:vD,deselectAll:ID,selectAllFiltered:CD,deselectAllFiltered:bD,selectAllOnCurrentPage:yD,deselectAllOnCurrentPage:xD,getSelectedNodes:wD,getSelectedRows:ND}},S9={moduleName:"RowSelection",version:p,rowModels:["clientSide","infinite","viewport"],beans:[pD],dependsOn:[dD]},tD=class extends S{constructor($,z){super();this.cellCtrl=$,this.staticClasses=[],this.beans=z,this.column=$.column}setComp($){this.cellComp=$,this.applyUserStyles(),this.applyCellClassRules(),this.applyClassesFromColDef()}applyCellClassRules(){let{column:$,cellComp:z}=this,Q=$.colDef,J=Q.cellClassRules,Z=this.getCellClassParams($,Q);n8(this.beans.expressionSvc,J===this.cellClassRules?void 0:this.cellClassRules,J,Z,(X)=>z.toggleCss(X,!0),(X)=>z.toggleCss(X,!1)),this.cellClassRules=J}applyUserStyles(){let $=this.column,z=$.colDef,Q=z.cellStyle;if(!Q)return;let J;if(typeof Q==="function"){let Z=this.getCellClassParams($,z);J=Q(Z)}else J=Q;if(J)this.cellComp.setUserStyles(J)}applyClassesFromColDef(){let{column:$,cellComp:z}=this,Q=$.colDef,J=this.getCellClassParams($,Q);for(let X of this.staticClasses)z.toggleCss(X,!1);let Z=this.beans.cellStyles.getStaticCellClasses(Q,J);this.staticClasses=Z;for(let X of Z)z.toggleCss(X,!0)}getCellClassParams($,z){let{value:Q,rowNode:J}=this.cellCtrl;return y(this.beans.gos,{value:Q,data:J.data,node:J,colDef:z,column:$,rowIndex:J.rowIndex})}},sD=class extends S{constructor(){super(...arguments);this.beanName="cellStyles"}processAllCellClasses($,z,Q,J){n8(this.beans.expressionSvc,void 0,$.cellClassRules,z,Q,J),this.processStaticCellClasses($,z,Q)}getStaticCellClasses($,z){let{cellClass:Q}=$;if(!Q)return[];let J;if(typeof Q==="function")J=Q(z);else J=Q;if(typeof J==="string")J=[J];return J||[]}createCellCustomStyleFeature($){return new tD($,this.beans)}processStaticCellClasses($,z,Q){this.getStaticCellClasses($,z).forEach((Z)=>{Q(Z)})}},R9={moduleName:"CellStyle",version:p,beans:[sD]};var rD={enableBrowserTooltips:!0,tooltipTrigger:!0,tooltipMouseTrack:!0,tooltipShowMode:!0,tooltipInteraction:!0,defaultColGroupDef:!0,suppressAutoSize:!0,skipHeaderOnAutoSize:!0,autoSizeStrategy:!0,components:!0,stopEditingWhenCellsLoseFocus:!0,undoRedoCellEditing:!0,undoRedoCellEditingLimit:!0,excelStyles:!0,cacheQuickFilter:!0,customChartThemes:!0,chartThemeOverrides:!0,chartToolPanelsDef:!0,loadingCellRendererSelector:!0,localeText:!0,keepDetailRows:!0,keepDetailRowsCount:!0,detailRowHeight:!0,detailRowAutoHeight:!0,tabIndex:!0,valueCache:!0,valueCacheNeverExpires:!0,enableCellExpressions:!0,suppressTouch:!0,suppressBrowserResizeObserver:!0,suppressPropertyNamesCheck:!0,debug:!0,dragAndDropImageComponent:!0,overlayComponent:!0,suppressOverlays:!0,loadingOverlayComponent:!0,suppressLoadingOverlay:!0,noRowsOverlayComponent:!0,paginationPageSizeSelector:!0,paginateChildRows:!0,pivotPanelShow:!0,pivotSuppressAutoColumn:!0,suppressExpandablePivotGroups:!0,aggFuncs:!0,allowShowChangeAfterFilter:!0,ensureDomOrder:!0,enableRtl:!0,suppressColumnVirtualisation:!0,suppressMaxRenderedRowRestriction:!0,suppressRowVirtualisation:!0,rowDragText:!0,groupLockGroupColumns:!0,suppressGroupRowsSticky:!0,rowModelType:!0,cacheOverflowSize:!0,infiniteInitialRowCount:!0,serverSideInitialRowCount:!0,maxBlocksInCache:!0,maxConcurrentDatasourceRequests:!0,blockLoadDebounceMillis:!0,serverSideOnlyRefreshFilteredGroups:!0,serverSidePivotResultFieldSeparator:!0,viewportRowModelPageSize:!0,viewportRowModelBufferSize:!0,debounceVerticalScrollbar:!0,suppressAnimationFrame:!0,suppressPreventDefaultOnMouseWheel:!0,scrollbarWidth:!0,icons:!0,suppressRowTransform:!0,gridId:!0,enableGroupEdit:!0,initialState:!0,processUnpinnedColumns:!0,createChartContainer:!0,getLocaleText:!0,getRowId:!0,reactiveCustomComponents:!0,renderingMode:!0,columnMenu:!0,suppressSetFilterByDefault:!0,getDataPath:!0,enableCellSpan:!0,enableFilterHandlers:!0,filterHandlers:!0},g0="clientSide",C0="serverSide",$Q="infinite",lD={onGroupExpandedOrCollapsed:[g0],refreshClientSideRowModel:[g0],isRowDataEmpty:[g0],forEachLeafNode:[g0],forEachNodeAfterFilter:[g0],forEachNodeAfterFilterAndSort:[g0],resetRowHeights:[g0,C0],applyTransaction:[g0],applyTransactionAsync:[g0],flushAsyncTransactions:[g0],getBestCostNodeSelection:[g0],getServerSideSelectionState:[C0],setServerSideSelectionState:[C0],applyServerSideTransaction:[C0],applyServerSideTransactionAsync:[C0],applyServerSideRowData:[C0],retryServerSideLoads:[C0],flushServerSideAsyncTransactions:[C0],refreshServerSide:[C0],getServerSideGroupLevelState:[C0],refreshInfiniteCache:[$Q],purgeInfiniteCache:[$Q],getInfiniteRowCount:[$Q],isLastRowIndexKnown:[$Q,C0],expandAll:[g0,C0],collapseAll:[g0,C0],onRowHeightChanged:[g0,C0],setRowCount:[$Q,C0],getCacheBlockState:[$Q,C0]},aD={showLoadingOverlay:{version:"v32",message:'`showLoadingOverlay` is deprecated. Use the grid option "loading"=true instead or setGridOption("loading", true).'},clearRangeSelection:{version:"v32.2",message:"Use `clearCellSelection` instead."},getInfiniteRowCount:{version:"v32.2",old:"getInfiniteRowCount()",new:"getDisplayedRowCount()"},selectAllFiltered:{version:"v33",old:"selectAllFiltered()",new:'selectAll("filtered")'},deselectAllFiltered:{version:"v33",old:"deselectAllFiltered()",new:'deselectAll("filtered")'},selectAllOnCurrentPage:{version:"v33",old:"selectAllOnCurrentPage()",new:'selectAll("currentPage")'},deselectAllOnCurrentPage:{version:"v33",old:"deselectAllOnCurrentPage()",new:'deselectAll("currentPage")'}};function oD($,z,Q){let J=aD[$];if(J){let{version:X,new:Y,old:q,message:G}=J,_=q??$;return(...H)=>{let U=Y?`Please use ${Y} instead. `:"";return zz(`Since ${X} api.${_} is deprecated. ${U}${G??""}`),z.apply(z,H)}}let Z=lD[$];if(Z)return(...X)=>{let Y=Q.rowModel.getType();if(!Z.includes(Y)){GQ(`api.${$} can only be called when gridOptions.rowModelType is ${Z.join(" or ")}`);return}return z.apply(z,X)};return z}var eD={detailCellRendererCtrl:"SharedMasterDetail",dndSourceComp:"DragAndDrop",fillHandle:"CellSelection",groupCellRendererCtrl:"GroupCellRenderer",headerFilterCellCtrl:"ColumnFilter",headerGroupCellCtrl:"ColumnGroup",rangeHandle:"CellSelection",tooltipFeature:"Tooltip",highlightTooltipFeature:"Tooltip",tooltipStateManager:"Tooltip",groupStrategy:"RowGrouping",treeGroupStrategy:"TreeData",rowNumberRowResizer:"RowNumbers",singleCell:"EditCore",fullRow:"EditCore",agSetColumnFilterHandler:"SetFilter",agMultiColumnFilterHandler:"MultiFilter",agGroupColumnFilterHandler:"GroupFilter",agNumberColumnFilterHandler:"NumberFilter",agBigIntColumnFilterHandler:"BigIntFilter",agDateColumnFilterHandler:"DateFilter",agTextColumnFilterHandler:"TextFilter"},$F={expanded:1,contracted:1,"tree-closed":1,"tree-open":1,"tree-indeterminate":1,pin:1,"eye-slash":1,arrows:1,left:1,right:1,group:1,aggregation:1,pivot:1,"not-allowed":1,chart:1,cross:1,cancel:1,tick:1,first:1,previous:1,next:1,last:1,linked:1,unlinked:1,"color-picker":1,loading:1,menu:1,"menu-alt":1,filter:1,"filter-add":1,columns:1,maximize:1,minimize:1,copy:1,cut:1,paste:1,grip:1,save:1,csv:1,excel:1,"small-down":1,"small-left":1,"small-right":1,"small-up":1,asc:1,desc:1,aasc:1,adesc:1,none:1,up:1,down:1,plus:1,minus:1,settings:1,"checkbox-checked":1,"checkbox-indeterminate":1,"checkbox-unchecked":1,"radio-button-on":1,"radio-button-off":1,eye:1,"column-arrow":1,"un-pin":1,"pinned-top":1,"pinned-bottom":1,"chevron-up":1,"chevron-down":1,"chevron-left":1,"chevron-right":1,edit:1},zF={chart:"MenuCore",cancel:"EnterpriseCore",first:"Pagination",previous:"Pagination",next:"Pagination",last:"Pagination",linked:"IntegratedCharts",loadingMenuItems:"MenuCore",unlinked:"IntegratedCharts",menu:"ColumnHeaderComp",legacyMenu:"ColumnMenu",filter:"ColumnFilter",filterActive:"ColumnFilter",filterAdd:"NewFiltersToolPanel",filterCardCollapse:"NewFiltersToolPanel",filterCardExpand:"NewFiltersToolPanel",filterCardEditing:"NewFiltersToolPanel",filterTab:"ColumnMenu",filtersToolPanel:"FiltersToolPanel",columns:["MenuCore"],columnsToolPanel:["ColumnsToolPanel"],maximize:"EnterpriseCore",minimize:"EnterpriseCore",save:"MenuCore",columnGroupOpened:"ColumnGroupHeaderComp",columnGroupClosed:"ColumnGroupHeaderComp",accordionOpen:"EnterpriseCore",accordionClosed:"EnterpriseCore",accordionIndeterminate:"EnterpriseCore",columnSelectClosed:["ColumnsToolPanel","ColumnMenu"],columnSelectOpen:["ColumnsToolPanel","ColumnMenu"],columnSelectIndeterminate:["ColumnsToolPanel","ColumnMenu"],columnMovePin:"SharedDragAndDrop",columnMoveHide:"SharedDragAndDrop",columnMoveMove:"SharedDragAndDrop",columnMoveLeft:"SharedDragAndDrop",columnMoveRight:"SharedDragAndDrop",columnMoveGroup:"SharedDragAndDrop",columnMoveValue:"SharedDragAndDrop",columnMovePivot:"SharedDragAndDrop",dropNotAllowed:"SharedDragAndDrop",ensureColumnVisible:["ColumnsToolPanel","ColumnMenu"],groupContracted:"GroupCellRenderer",groupExpanded:"GroupCellRenderer",setFilterGroupClosed:"SetFilter",setFilterGroupOpen:"SetFilter",setFilterGroupIndeterminate:"SetFilter",setFilterLoading:"SetFilter",close:"EnterpriseCore",check:"MenuItem",colorPicker:"CommunityCore",groupLoading:"LoadingCellRenderer",overlayLoading:"Overlay",overlayExporting:"Overlay",menuAlt:"ColumnHeaderComp",menuPin:"MenuCore",menuValue:"MenuCore",menuAddRowGroup:["MenuCore","ColumnsToolPanel"],menuRemoveRowGroup:["MenuCore","ColumnsToolPanel"],clipboardCopy:"MenuCore",clipboardCut:"MenuCore",clipboardPaste:"MenuCore",pivotPanel:["ColumnsToolPanel","RowGroupingPanel"],rowGroupPanel:["ColumnsToolPanel","RowGroupingPanel"],valuePanel:"ColumnsToolPanel",columnDrag:"EnterpriseCore",rowDrag:["RowDrag","DragAndDrop"],csvExport:"MenuCore",excelExport:"MenuCore",smallDown:"CommunityCore",selectOpen:"CommunityCore",richSelectOpen:"RichSelect",richSelectRemove:"RichSelect",richSelectLoading:"RichSelect",smallLeft:"CommunityCore",smallRight:"CommunityCore",subMenuOpen:"MenuItem",subMenuOpenRtl:"MenuItem",panelDelimiter:"RowGroupingPanel",panelDelimiterRtl:"RowGroupingPanel",smallUp:"CommunityCore",sortAscending:["MenuCore","Sort"],sortDescending:["MenuCore","Sort"],sortAbsoluteAscending:["MenuCore","Sort"],sortAbsoluteDescending:["MenuCore","Sort"],sortUnSort:["MenuCore","Sort"],advancedFilterBuilder:"AdvancedFilter",advancedFilterBuilderDrag:"AdvancedFilter",advancedFilterBuilderInvalid:"AdvancedFilter",advancedFilterBuilderMoveUp:"AdvancedFilter",advancedFilterBuilderMoveDown:"AdvancedFilter",advancedFilterBuilderAdd:"AdvancedFilter",advancedFilterBuilderRemove:"AdvancedFilter",advancedFilterBuilderSelectOpen:"AdvancedFilter",chartsMenu:"IntegratedCharts",chartsMenuEdit:"IntegratedCharts",chartsMenuAdvancedSettings:"IntegratedCharts",chartsMenuAdd:"IntegratedCharts",chartsColorPicker:"IntegratedCharts",chartsThemePrevious:"IntegratedCharts",chartsThemeNext:"IntegratedCharts",chartsDownload:"IntegratedCharts",checkboxChecked:"CommunityCore",checkboxIndeterminate:"CommunityCore",checkboxUnchecked:"CommunityCore",radioButtonOn:"CommunityCore",radioButtonOff:"CommunityCore",rowPin:"PinnedRow",rowUnpin:"PinnedRow",rowPinBottom:"PinnedRow",rowPinTop:"PinnedRow"},QF=new Set(["colorPicker","smallUp","checkboxChecked","checkboxIndeterminate","checkboxUnchecked","radioButtonOn","radioButtonOff","smallDown","smallLeft","smallRight"]),JF=class extends S{constructor(){super(...arguments);this.beanName="validation"}wireBeans($){this.gridOptions=$.gridOptions,fq(XK)}warnOnInitialPropertyUpdate($,z){if($==="api"&&rD[z])j(22,{key:z})}processGridOptions($){this.processOptions($,zE())}validateApiFunction($,z){return oD($,z,this.beans)}missingUserComponent($,z,Q,J){let Z=BQ[z];if(Z)this.gos.assertModuleRegistered(Z,`AG Grid '${$}' component: ${z}`);else j(101,{propertyName:$,componentName:z,agGridDefaults:Q,jsComps:J})}missingDynamicBean($){let z=eD[$];return z?$$(200,{...this.gos.getModuleErrorParams(),moduleName:z,reasonOrId:$}):void 0}checkRowEvents($){if(XF.has($))j(10,{eventType:$})}validateIcon($){if(QF.has($))j(43,{iconName:$});if($F[$])return;let z=zF[$];if(z){e(200,{reasonOrId:`icon '${$}'`,moduleName:z,gridScoped:x2(),gridId:this.beans.context.getId(),rowModelType:this.gos.get("rowModelType"),additionalText:"Alternatively, use the CSS icon name directly."});return}j(134,{iconName:$})}isProvidedUserComp($){return!!BQ[$]}validateColDef($){this.processOptions($,iB())}processOptions($,z){let{validations:Q,deprecations:J,allProperties:Z,propertyExceptions:X,objectName:Y,docsUrl:q}=z;if(Z&&this.gridOptions.suppressPropertyNamesCheck!==!0)this.checkProperties($,[...X??[],...Object.keys(J)],Z,Y,q);let G=new Set;if(Object.keys($).forEach((H)=>{let U=J[H];if(U){let{message:F,version:M}=U;G.add(`As of v${M}, ${String(H)} is deprecated. ${F??""}`)}let W=$[H];if(W==null||W===!1)return;let B=Q[H];if(!B)return;let{dependencies:E,validate:K,supportedRowModels:L,expectedType:D}=B;if(D){let F=typeof W;if(F!==D){G.add(`${String(H)} should be of type '${D}' but received '${F}' (${W}).`);return}}if(L){let F=this.gridOptions.rowModelType??"clientSide";if(!L.includes(F)){G.add(`${String(H)} is not supported with the '${F}' row model. It is only valid with: ${L.join(", ")}.`);return}}if(E){let F=this.checkForRequiredDependencies(H,E,$);if(F){G.add(F);return}}if(K){let F=K($,this.gridOptions,this.beans);if(F){G.add(F);return}}}),G.size>0)for(let H of G)zz(H)}checkForRequiredDependencies($,z,Q){let Z=Object.entries(z).filter(([X,Y])=>{let q=Q[X];return!Y.required.includes(q)});if(Z.length===0)return null;return Z.map(([X,Y])=>`'${String($)}' requires '${X}' to be one of [${Y.required.map((q)=>{if(q===null)return"null";else if(q===void 0)return"undefined";return q}).join(", ")}]. ${Y.reason??""}`).join(` + `)}checkProperties($,z,Q,J,Z){let X=["__ob__","__v_skip","__metadata__"],Y=ZF(Object.getOwnPropertyNames($),[...X,...z,...Q],Q),q=Object.keys(Y);for(let G of q){let _=Y[G],H=`invalid ${J} property '${G}' did you mean any of these: ${_.slice(0,8).join(", ")}.`;if(Q.includes("context"))H+=` +If you are trying to annotate ${J} with application data, use the '${J}.context' property instead.`;zz(H)}if(q.length>0&&Z){let G=this.beans.frameworkOverrides.getDocLink(Z);zz(`to see all the valid ${J} properties please check: ${G}`)}}};function ZF($,z,Q){let J={},Z=$.filter((X)=>!z.some((Y)=>Y===X));if(Z.length>0)for(let X of Z)J[X]=F2({inputValue:X,allSuggestions:Q}).values;return J}var XF=new Set(["firstChildChanged","lastChildChanged","childIndexChanged"]),j9={moduleName:"Validation",version:p,beans:[JF]};var RQ=class extends S{constructor(){super(...arguments);this.dispatchColumnChangedEvent=F8,this.columns=[],this.columnIndexMap={},this.updateIndexMap=()=>{this.columnIndexMap={},this.columns.forEach(($,z)=>this.columnIndexMap[$.getId()]=z)}}wireBeans($){this.colModel=$.colModel,this.aggFuncSvc=$.aggFuncSvc,this.visibleCols=$.visibleCols,this.groupHierarchCols=$.groupHierarchyColSvc}sortColumns($){let{groupHierarchCols:z}=this;this.columns.sort((Q,J)=>z?.compareVirtualColumns(Q,J)??$(Q,J)),this.updateIndexMap()}setColumns($,z){this.setColList($,this.columns,this.eventName,!0,!0,this.columnProcessors.set,z)}addColumns($,z){this.updateColList($,this.columns,!0,!0,this.columnProcessors.add,this.eventName,z)}removeColumns($,z){this.updateColList($,this.columns,!1,!0,this.columnProcessors.remove,this.eventName,z)}getColumnIndex($){return this.columnIndexMap[$]}setColList($=[],z,Q,J,Z,X,Y){let q=this.colModel.getCols();if(!q||q.length===0)return;let G=new Map;z.forEach((H,U)=>G.set(H,U)),z.length=0;for(let H of $){let U=this.colModel.getColDefCol(H);if(U)z.push(U)}z.forEach((H,U)=>{let W=G.get(H);if(W===void 0){G.set(H,0);return}if(J&&W!==U)return;G.delete(H)}),this.updateIndexMap();let _=this.colModel.getColDefCols();for(let H of _??[]){let U=z.indexOf(H)>=0;X(H,U,Y)}if(Z)this.colModel.refreshCols(!1,Y);this.visibleCols.refresh(Y),this.dispatchColumnChangedEvent(this.eventSvc,Q,[...G.keys()],Y)}updateColList($=[],z,Q,J,Z,X,Y){if(!$||$.length===0)return;let q=!1,G=new Set;for(let H of $){if(!H)continue;let U=this.colModel.getColDefCol(H);if(!U)continue;if(G.add(U),Q){if(z.indexOf(U)>=0)continue;z.push(U)}else{let W=z.indexOf(U);if(W<0)continue;for(let B=W+1;B=0;else if(L)if(v)R=M;else if(C)R=V!=null&&V>=0;else R=!1;else R=Q.indexOf(K)>=0;if(R)if(L?k!=null||V!=null:k!=null)J.push(K);else Z.push(K)}let U=(K)=>{let L=K.getColDef();return Y(L)??q(L)};J.sort((K,L)=>U(K)-U(L));let W=[],B=this.groupHierarchCols,E=(K)=>{if(B)B.expandColumnInto(W,K);else W.push(K)};J.forEach(E);for(let K of Q)if(Z.indexOf(K)>=0)E(K);for(let K of Z)if(W.indexOf(K)<0)E(K);for(let K of Q)if(W.indexOf(K)<0)X(K,!1,$);for(let K of W)if(Q.indexOf(K)<0)X(K,!0,$);return this.columns=W,this.updateIndexMap(),this.columns}restoreColumnOrder($,z){let Q=this.columns,J=this.colModel.getColDefCols();if(!Q.length||!J)return $;let Z=Object.keys(z),X=new Set(Z),Y=new Set(Z),q=new Set(Q.map((M)=>{let k=M.getColId();return Y.delete(k),k}).concat(Z)),G=[],_={},H=0;for(let M=0;M{let k=_[M];for(let V=B;V>>32-Z,Q)}ff($,z,Q,J,Z,X,Y){return this.cmn(z&Q|~z&J,$,z,Z,X,Y)}gg($,z,Q,J,Z,X,Y){return this.cmn(z&J|Q&~J,$,z,Z,X,Y)}hh($,z,Q,J,Z,X,Y){return this.cmn(z^Q^J,$,z,Z,X,Y)}ii($,z,Q,J,Z,X,Y){return this.cmn(Q^(z|~J),$,z,Z,X,Y)}md51($){let z=$.length,Q=[1732584193,-271733879,-1732584194,271733878],J;for(J=64;J<=$.length;J+=64)this.md5cycle(Q,this.md5blk($.substring(J-64,J)));$=$.substring(J-64);let Z=[0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0];for(J=0;J<$.length;J++)Z[J>>2]|=$.charCodeAt(J)<<(J%4<<3);if(Z[J>>2]|=128<<(J%4<<3),J>55){this.md5cycle(Q,Z);for(J=0;J<16;J++)Z[J]=0}return Z[14]=z*8,this.md5cycle(Q,Z),Q}md5blk($){let z=[];for(let Q=0;Q<64;Q+=4)z[Q>>2]=$.charCodeAt(Q)+($.charCodeAt(Q+1)<<8)+($.charCodeAt(Q+2)<<16)+($.charCodeAt(Q+3)<<24);return z}rhex($){let z="0123456789abcdef".split(""),Q="",J=0;for(;J<4;J++)Q+=z[$>>J*8+4&15]+z[$>>J*8&15];return Q}hex($){for(let z=0;z<$.length;z++)$[z]=this.rhex($[z]);return $.join("")}md5($){return this.hex(this.md51($))}add32($,z){return this.ieCompatibility?this.add32Compat($,z):this.add32Std($,z)}add32Std($,z){return $+z&4294967295}add32Compat($,z){let Q=($&65535)+(z&65535);return($>>16)+(z>>16)+(Q>>16)<<16|Q&65535}},rJ={"01":"GRID","02":"CHARTS","0102":"BOTH"};var HX=class ${constructor(z){this.watermarkMessage=void 0,this.totalMessageLength=124,this.document=z,this.md5=new qF,this.md5.init()}validateLicense(){let z=this.getLicenseDetails($.licenseKey),Q=`AG Grid ${z.currentLicenseType==="BOTH"?"and AG Charts ":""}Enterprise`,J=z.suppliedLicenseType===void 0?"":`AG ${z.suppliedLicenseType==="BOTH"?"Grid and AG Charts":z.suppliedLicenseType==="GRID"?"Grid":"Charts"} Enterprise`;if(z.missing){if(!this.isWebsiteUrl()||this.isForceWatermark())this.outputMissingLicenseKey(Q)}else if(z.expired){let Z=$.getGridReleaseDate(),X=$.formatDate(Z);this.outputExpiredKey(z.expiry,X,Q,J)}else if(!z.valid)this.outputInvalidLicenseKey(!!z.incorrectLicenseType,Q,J);else if(z.isTrial&&z.trialExpired)this.outputExpiredTrialKey(z.expiry,Q,J)}static extractExpiry(z){let Q=z.substring(z.lastIndexOf("_")+1,z.length);return new Date(parseInt($.decode(Q),10))}static extractLicenseComponents(z){let Q=z.replace(/[\u200B-\u200D\uFEFF]/g,"");if(Q=Q.replace(/\r?\n|\r/g,""),z.length<=32)return{md5:null,license:z,version:null,isTrial:null};let J=Q.length-32,Z=Q.substring(J),X=Q.substring(0,J),[Y,q,G]=$.extractBracketedInformation(Q);return{md5:Z,license:X,version:Y,isTrial:q,type:G}}getLicenseDetails(z){let Q=$.chartsLicenseManager?"BOTH":"GRID";if(!z?.length)return{licenseKey:z,valid:!1,missing:!0,currentLicenseType:Q};let J=$.getGridReleaseDate(),{md5:Z,license:X,version:Y,isTrial:q,type:G}=$.extractLicenseComponents(z),_=Z===this.md5.md5(X)&&!z.includes("For_Trialing_ag-Grid_Only"),H=void 0,U=void 0,W=null,B=!1,E=void 0;function K(){H=WW,Y){case"legacy":case"2":{if(q)K();break}case"3":if(!G?.length)_=!1;else if(E=G,G!==rJ["01"]&&G!==rJ["0102"]||Q==="BOTH"&&E!=="BOTH")_=!1,B=!0;else if(q)K()}}if(!_)return{licenseKey:z,valid:_,incorrectLicenseType:B,currentLicenseType:Q,suppliedLicenseType:E};return{licenseKey:z,valid:_,expiry:$.formatDate(W),expired:U,version:Y,isTrial:q,trialExpired:H,incorrectLicenseType:B,currentLicenseType:Q,suppliedLicenseType:E}}isDisplayWatermark(){return this.isForceWatermark()||!this.isLocalhost()&&!this.isWebsiteUrl()&&!!this.watermarkMessage?.length}getWatermarkMessage(){return this.watermarkMessage||""}getHostname(){let Q=(this.document.defaultView||window).location,{hostname:J=""}=Q;return J}isForceWatermark(){let Q=(this.document.defaultView||window).location,{pathname:J}=Q;return J?J.includes("forceWatermark"):!1}isWebsiteUrl(){return this.getHostname().match(/^(?:[\w-]+\.)?(ag-grid|bryntum)\.com$/)!==null}isLocalhost(){return this.getHostname().match(/^(?:127\.0\.0\.1|localhost)$/)!==null}static formatDate(z){let Q=["January","February","March","April","May","June","July","August","September","October","November","December"],J=z.getDate(),Z=z.getMonth(),X=z.getFullYear();return J+" "+Q[Z]+" "+X}static getGridReleaseDate(){return new Date(parseInt($.decode($.RELEASE_INFORMATION),10))}static decode(z){let J="",Z,X,Y,q,G,_,H,U=0,W=z.replace(/[^A-Za-z0-9+/=]/g,"");while(U>4,X=(G&15)<<4|_>>2,Y=(_&3)<<6|H,J=J+String.fromCharCode(Z),_!=64)J=J+String.fromCharCode(X);if(H!=64)J=J+String.fromCharCode(Y)}return J=$.utf8_decode(J),J}static utf8_decode(z){z=z.replace(/rn/g,"n");let Q="";for(let J=0;J127&&Z<2048)Q+=String.fromCharCode(Z>>6|192),Q+=String.fromCharCode(Z&63|128);else Q+=String.fromCharCode(Z>>12|224),Q+=String.fromCharCode(Z>>6&63|128),Q+=String.fromCharCode(Z&63|128)}return Q}static setChartsLicenseManager(z){this.chartsLicenseManager=z,this.chartsLicenseManager?.setLicenseKey(this.licenseKey,!0)}static setLicenseKey(z){if(T(this.licenseKey)&&this.licenseKey!==z)z7(291,void 0,"AG Grid: License Key being set multiple times with different values. This can result in an incorrect license key being used.");this.licenseKey=z,this.chartsLicenseManager?.setLicenseKey(z,!0)}static extractBracketedInformation(z){if(!z.includes("["))return["legacy",!1,void 0];let Q=z.match(/\[(.*?)\]/g).map((q)=>q.replace("[","").replace("]",""));if(!Q||Q.length===0)return["legacy",!1,void 0];let J=Q.filter((q)=>q==="TRIAL").length===1,Z=Q.filter((q)=>q.indexOf("v")===0)[0],X=Z?Z.replace("v",""):"legacy",Y=rJ[Q.filter((q)=>rJ[q])[0]];return[X,J,Y]}centerPadAndOutput(z){let Q=this.totalMessageLength-z.length}padAndOutput(z,Q="*",J=""){}outputInvalidLicenseKey(z,Q,J){}outputExpiredTrialKey(z,Q,J){}outputMissingLicenseKey(z){}outputExpiredKey(z,Q,J,Z){}};HX.RELEASE_INFORMATION="MTc3NDQyNTc0Nzc3NQ==";var lJ=HX,GF='.ag-watermark{bottom:20px;color:#9b9b9b;opacity:.7;position:absolute;transition:opacity 1s ease-out 3s}:where(.ag-ltr) .ag-watermark{right:25px}:where(.ag-rtl) .ag-watermark{left:25px}.ag-watermark:before{background-image:url("data:image/svg+xml;base64,PHN2ZyB4bWxucz0iaHR0cDovL3d3dy53My5vcmcvMjAwMC9zdmciIHdpZHRoPSIyMDkiIGhlaWdodD0iMzYiIGZpbGw9Im5vbmUiIHZpZXdCb3g9IjAgMCAyMDkgMzYiPjxwYXRoIGZpbGw9IiM5YjliOWIiIGQ9Ik0xOTIuOTkzIDIzLjY1OHYtNy45NDZoLTEzLjU0MWwtNy45NDcgNy45NDZ6TTIwOC4yNSAzLjk1aC0xNi45NzRsLTguMDEgNy45NDdoMjQuOTg0ek0xNjMuNjIyIDMxLjYwNWw0LjA2OS00LjA2OWgxMy43MzJ2Ny45NDdoLTE3LjgwMXoiLz48cGF0aCBmaWxsPSIjOWI5YjliIiBkPSJNMTY2LjYxIDE5Ljc4aDguNzczbDguMDEtNy45NDZIMTY2LjYxek0xNTcuMDExIDMxLjYwNWg2LjYxMWw3Ljg4My03Ljk0N2gtMTQuNDk0ek0xOTEuMjc2IDMuOTVsLTQuMDY4IDQuMDdIMTYxLjI3Vi4wNzJoMzAuMDA2ek0yMC44NCAzMC4yMDZIOC4zNzhsLTIuMTYyIDUuMzRILjc1TDEyLjI1NyA4LjU5Mmg0Ljc2OEwyOC41MyAzNS41NDZoLTUuNTN6bS0xLjcxNy00LjI2TDE0LjYwOSAxNC45NWwtNC41MTQgMTAuOTk4ek0xMDQuNDM3IDE4LjUwOWMxLjU4OS0yLjM1MiA1LjU5NC0yLjYwNyA3LjI0Ny0yLjYwN3Y0LjU3OGMtMi4wMzQgMC00LjA2OS4wNjMtNS4yNzcuOTUzLTEuMjA3Ljg5LTEuODQzIDIuMDk4LTEuODQzIDMuNTZ2MTAuNTUzaC00Ljk1OVYxNS45MDJoNC43Njh6TTExOS4zNzYgMTUuOTAyaC00Ljk1OHYxOS42NDRoNC45NTh6TTExOS4zNzYgNy4xM2gtNC45NTh2NS44NDhoNC45NTh6TTE0My45NzkgNy4xM3YyOC40MTZoLTQuNzY4bC0uMTI3LTIuOTg4YTguMyA4LjMgMCAwIDEtMi42NyAyLjQ4Yy0xLjA4MS41NzItMi40MTYuODktMy45NDIuODktMS4zMzUgMC0yLjYwNi0uMjU1LTMuNjg3LS43LTEuMTQ0LS41MDgtMi4xNjItMS4xNDQtMi45ODgtMi4wMzRhOS42IDkuNiAwIDAgMS0xLjk3MS0zLjE3OWMtLjUwOC0xLjIwNy0uNjk5LTIuNjA2LS42OTktNC4xMzJzLjI1NC0yLjkyNC42OTktNC4xOTZjLjUwOS0xLjI3MSAxLjE0NS0yLjM1MiAxLjk3MS0zLjI0MnMxLjg0NC0xLjU4OSAyLjk4OC0yLjA5OCAyLjM1Mi0uNzYzIDMuNjg3LS43NjNjMS41MjYgMCAyLjc5Ny4yNTUgMy44NzguODI3czEuOTcxIDEuMzM1IDIuNjcgMi40MTZWNy4xOTNoNC45NTl6bS0xMC40MjYgMjQuNTM4YzEuNjUzIDAgMi45MjQtLjU3MiAzLjk0MS0xLjY1M3MxLjUyNi0yLjU0MyAxLjUyNi00LjMyMy0uNTA5LTMuMTc4LTEuNTI2LTQuMzIyYy0xLjAxNy0xLjA4MS0yLjI4OC0xLjY1My0zLjk0MS0xLjY1My0xLjU5IDAtMi45MjUuNTcyLTMuODc4IDEuNjUzLTEuMDE3IDEuMDgtMS41MjYgMi41NDMtMS41MjYgNC4zMjIgMCAxLjc4LjUwOSAzLjE4IDEuNTI2IDQuMjYgMS4wMTcgMS4xNDQgMi4yODggMS43MTYgMy44NzggMS43MTZNNTcuMjAyIDIwLjM1M0g0NC45MzN2NC4yNTloNi45OTNjLS4xOSAyLjE2MS0xLjAxNyAzLjgxNC0yLjQxNiA1LjE1LTEuMzk4IDEuMjctMy4xNzggMS45MDYtNS40NjcgMS45MDYtMS4yNzEgMC0yLjQ4LS4yNTQtMy40OTYtLjY5OWE3IDcgMCAwIDEtMi43MzQtMS45N2MtLjc2My0uODI3LTEuMzM1LTEuODQ0LTEuNzgtMy4wNTJzLS42MzYtMi40OC0uNjM2LTMuOTQyLjE5LTIuNzMzLjYzNi0zLjk0MWMuMzgxLTEuMjA4IDEuMDE3LTIuMTYyIDEuNzgtMy4wNTIuNzYzLS44MjYgMS42NTMtMS40NjIgMi43MzMtMS45N2E5LjEgOS4xIDAgMCAxIDMuNTYtLjdxNC4wMDUgMCA2LjEwMyAxLjkwN2wzLjMwNi0zLjMwNWMtMi40OC0xLjkwNy01LjY1OC0yLjkyNS05LjQwOS0yLjkyNS0yLjA5NyAwLTQuMDA0LjMxOC01LjcyMSAxLjAxOC0xLjcxNi42OTktMy4xNzkgMS41ODktNC4zODYgMi43OTdBMTIuMSAxMi4xIDAgMCAwIDMxLjIgMTYuMjJjLS42MzUgMS43MTctLjk1MyAzLjYyNC0uOTUzIDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1NyAxLjAxNyAyLjAzNSAwIDMuODc4LS4zMTggNS41MzEtMS4wMTcgMS42NTMtLjcgMy4wNTItMS41OSA0LjE5Ni0yLjc5N3ExLjcxNi0xLjgxMiAyLjY3LTQuMzg3Yy42MzYtMS43MTYuOTU0LTMuNjIzLjk1NC01LjY1OHYtLjgyNmMtLjE5MS0uMTI3LS4yNTUtLjQ0NS0uMjU1LS43TTk1Ljk4MiAyMC4zNTNoLTEyLjI3djQuMjU5aDYuOTkzYy0uMTkgMi4xNjEtMS4wMTcgMy44MTQtMi40MTYgNS4xNS0xLjM5OCAxLjI3LTMuMTc4IDEuOTA2LTUuNDY3IDEuOTA2LTEuMjcxIDAtMi40OC0uMjU0LTMuNDk2LS42OTlhNyA3IDAgMCAxLTIuNzM0LTEuOTdjLS43NjMtLjgyNy0xLjMzNS0xLjg0NC0xLjc4LTMuMDUycy0uNjM2LTIuNDgtLjYzNi0zLjk0Mi4xOS0yLjczMy42MzYtMy45NDFjLjM4MS0xLjIwOCAxLjAxNy0yLjE2MiAxLjc4LTMuMDUyLjc2My0uODI2IDEuNjUzLTEuNDYyIDIuNzM0LTEuOTdhOS4xIDkuMSAwIDAgMSAzLjU2LS43cTQuMDA1IDAgNi4xMDMgMS45MDdsMy4zMDUtMy4zMDVjLTIuNDc5LTEuOTA3LTUuNjU4LTIuOTI1LTkuNDA4LTIuOTI1LTIuMDk4IDAtNC4wMDUuMzE4LTUuNzIyIDEuMDE4LTEuNzE2LjY5OS0zLjE3OCAxLjU4OS00LjM4NiAyLjc5N2ExMi4xIDEyLjEgMCAwIDAtMi43OTcgNC4zODZjLS42MzYgMS43MTctLjk1NCAzLjYyNC0uOTU0IDUuNjU4cy4zMTggMy45NDIgMS4wMTcgNS42NThjLjcgMS43MTcgMS41OSAzLjE3OSAyLjc5NyA0LjM4N2ExMi4xIDEyLjEgMCAwIDAgNC4zODcgMi43OTdjMS43MTYuNyAzLjYyMyAxLjAxNyA1LjY1OCAxLjAxNyAyLjAzNCAwIDMuODc4LS4zMTggNS41My0xLjAxNyAxLjY1My0uNyAzLjA1Mi0xLjU5IDQuMTk2LTIuNzk3cTEuNzE4LTEuODEyIDIuNjctNC4zODdjLjYzNi0xLjcxNi45NTQtMy42MjMuOTU0LTUuNjU4di0uODI2Yy0uMTktLjEyNy0uMjU1LS40NDUtLjI1NS0uNyIvPjwvc3ZnPg==");background-repeat:no-repeat;background-size:170px 40px;content:"";display:block;height:40px;width:170px}.ag-watermark-text{font-family:Impact,sans-serif;font-size:19px;font-weight:700;opacity:.5}:where(.ag-ltr) .ag-watermark-text{padding-left:.7rem}:where(.ag-rtl) .ag-watermark-text{padding-right:.7rem}',_F={tag:"div",cls:"ag-watermark",children:[{tag:"div",ref:"eLicenseTextRef",cls:"ag-watermark-text"}]},HF=class extends x{constructor(){super(_F);this.eLicenseTextRef=f,this.registerCSS(GF)}wireBeans($){this.licenseManager=$.licenseManager}postConstruct(){let $=this.shouldDisplayWatermark();if(this.setDisplayed($),$)this.eLicenseTextRef.textContent=this.licenseManager.getWatermarkMessage(),window.setTimeout(()=>this.addCss("ag-opacity-zero"),0),window.setTimeout(()=>this.setDisplayed(!1),5000)}shouldDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}},UF={selector:"AG-WATERMARK",component:HF},O9=class extends S{constructor(){super(...arguments);this.beanName="licenseManager"}postConstruct(){this.validateLicense()}validateLicense(){let $=this.beans;if($.withinStudio)this.licenseManager={isDisplayWatermark:()=>!1,getWatermarkMessage:()=>""};else{let z=new lJ(Y0($));this.licenseManager=z,z.validateLicense()}}static getLicenseDetails($){return new lJ(null).getLicenseDetails($)}getWatermarkSelector(){return UF}isDisplayWatermark(){return this.licenseManager.isDisplayWatermark()}getWatermarkMessage(){return this.licenseManager.getWatermarkMessage()}static setLicenseKey($){lJ.setLicenseKey($)}static setChartsLicenseManager($){lJ.setChartsLicenseManager($)}},WF=9525,P9={"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},aJ=`\r +`;function T9($,z,Q){if(!z&&z!==""&&z!==0)return"";let J=z;if(typeof z==="boolean"){if(Q)J=Q(z)}return` ${$}="${J}"`}function BF($={}){let J=["version"];if(!$.version)$.version="1.0";if($.encoding)J.push("encoding");if($.standalone)J.push("standalone");return``${X}="${$[X]}"`).join(" ")} ?>`}function UX($,z){let Q="";if($.properties){if($.properties.prefixedAttributes)$.properties.prefixedAttributes.forEach((Z)=>{for(let X of Object.keys(Z.map))Q+=T9(Z.prefix+X,Z.map[X],z)});if($.properties.rawMap)for(let Z of Object.keys($.properties.rawMap))Q+=T9(Z,$.properties.rawMap[Z],z)}let J="<"+$.name+Q;if(!$.children&&$.textNode==null)return J+"/>"+aJ;if($.textNode!=null)return J+">"+$.textNode+""+aJ;if(J+=">"+aJ,$.children)for(let Z of $.children)J+=UX(Z,z);return J+""+aJ}var EF=($)=>{return Math.round($*96/72)},jQ=($)=>{return Math.ceil($*WF)},KF=($)=>{if($===void 0)return;let Q=["Automatic","Roman","Swiss","Modern","Script","Decorative"].indexOf($||"Automatic");return Math.max(Q,0)},QZ=($,z)=>{if(!z)return;let Q;if(typeof z==="number")Q=z;else Q=z({rowIndex:$});return Q},LF=($,z)=>{let{colSpan:Q,column:J}=$.position;if(!$.width)return;if(Q){let Z=z.slice(J-1,J+Q-1),X=0;for(let Y=0;Y{let{rowSpan:Q,row:J}=$.position;if(!$.height)return;if(Q){let Z=0,X=0;for(let Y=J;Y{let Q=BF({encoding:"UTF-8",standalone:"yes"}),J=UX($);if(z)return J;return`${Q}${J}`},az=($)=>{let J=String.fromCharCode,Z=Math.floor($/26),X=$%26;if(!Z||$===26)return J(65+$-1);if(!X)return az(Z-1)+"Z";if(Z<26)return J(65+Z-1)+J(65+X-1);return az(Z)+J(65+X-1)},FF=($)=>{return $.replaceAll(` +`,"_x000a_")},qZ=($)=>{if($==null)return null;let z="";for(let Q=0;Q<$.length;Q++){let J=$.charCodeAt(Q);if(J>=0&&J<=31&&J!==10){let Y=`_x${J.toString(16).toUpperCase().padStart(4,"0")}_`;z+=Y}else z+=$[Q]}return z},MF=($)=>{let z=[];for(let Q of $.keys()){let J=Q.toString(),Z={name:"t",textNode:W0(qZ(J))};if(J.trim().length!==J.length)Z.properties={rawMap:{"xml:space":"preserve"}};z.push({name:"si",children:[Z]})}return z},kF=class extends P4{constructor($){super($);this.mixedStyles={},this.mixedStyleCounter=0,this.rows=[],this.frozenRowCount=0,this.skipFrozenRows=!1,this.frozenColumnCount=0,this.skipFrozenColumns=!1,this.formulaSvc=$.formulaSvc,this.config=Object.assign({},$),this.workbook=$.workbook,this.stylesByIds={};for(let Q of this.config.baseExcelStyles)this.stylesByIds[Q.id]=Q;let z={id:"_quotePrefix",quotePrefix:1};this.stylesByIds[z.id]=z,this.excelStyles=[...this.config.baseExcelStyles,z]}addCustomContent($){for(let z of $){let Q=this.rows.length+1,J;if(!this.config.suppressRowOutline&&z.outlineLevel!=null)J=z.outlineLevel;let Z={height:QZ(Q,z.height||this.config.rowHeight),cells:(z.cells||[]).map((X,Y)=>{let q=this.addImage(Q,this.columnsToExport[Y],X.data?.value),G=null;if(X.styleId)G=typeof X.styleId==="string"?[X.styleId]:X.styleId;let _=this.getStyleId(G);if(q)return this.createCell(_,this.getDataTypeForValue(q.value),q.value==null?"":q.value);let H=X.data?.value??"",U=this.getDataTypeForValue(H);if(X.mergeAcross)return this.createMergedCell(_,U,H,X.mergeAcross);return this.createCell(_,U,H)}),outlineLevel:J};if(z.collapsed!=null)Z.collapsed=z.collapsed;if(z.hidden!=null)Z.hidden=z.hidden;this.rows.push(Z)}}onNewHeaderGroupingRow(){let $=[],{freezeRows:z,headerRowHeight:Q}=this.config;if(this.rows.push({cells:$,height:QZ(this.rows.length+1,Q)}),z)this.frozenRowCount++;return{onColumn:(J,Z,X,Y,q)=>{let G=this.config.styleLinker({rowType:"HEADER_GROUPING",rowIndex:1,value:`grouping-${Z}`,columnGroup:J});$.push({...this.createMergedCell(this.getStyleId(G),this.getDataTypeForValue("string"),Z,Y),collapsibleRanges:q})}}}onNewHeaderRow(){let{freezeRows:$,headerRowHeight:z}=this.config;if($)this.frozenRowCount++;return this.onNewRow(this.onNewHeaderColumn,z)}onNewBodyRow($){let{freezeRows:z,rowHeight:Q}=this.config;if(!this.skipFrozenRows)if(z==="headersAndPinnedRows"&&$?.rowPinned==="top")this.frozenRowCount++;else if(typeof z==="function")if(z(y(this.gos,{node:$})))this.frozenRowCount++;else this.skipFrozenRows=!0;else this.skipFrozenRows=!0;let J=this.onNewRow(this.onNewBodyColumn,Q);if($)this.addRowOutlineIfNecessary($);return J}prepare($){super.prepare($),this.columnsToExport=[...$],this.cols=$.map((z,Q)=>this.convertColumnToExcel(z,Q))}parse(){let $=this.rows.reduce((Q,J)=>Math.max(Q,J.cells.length),0);while(this.cols.length<$)this.cols.push(this.convertColumnToExcel(null,this.cols.length+1));let z=this.createWorksheet();return this.addWorksheetToWorkbook(z)}createWorksheet(){let{sheetName:$}=this.config,z;if($!=null){let Q=typeof $==="function"?$(y(this.gos,{})):$;z=String(Q).substring(0,31)}else z="ag-grid";return{name:z,table:{columns:this.cols,rows:this.rows}}}addRowOutlineIfNecessary($){let{gos:z,suppressRowOutline:Q,rowGroupExpandState:J="expanded"}=this.config;if(z.get("groupHideOpenParents")||Q||$.level==null)return;let X=$.footer?1:0,Y=b(this.rows);if($.uiLevel==null||$.level===$.uiLevel){let G=Math.min($.level+X,7);Y.outlineLevel=G}if(J==="expanded")return;let q=J==="collapsed";if($.isExpandable()){let G=!q&&$.expanded;Y.collapsed=!G}Y.hidden=!!$.parent&&$.parent.level!==-1&&(q||this.isAnyParentCollapsed($.parent))}isAnyParentCollapsed($){while($&&$.level!==-1){if(!$.expanded)return!0;$=$.parent}return!1}convertColumnToExcel($,z){let Q=this.config.columnWidth,Z=($?this.extractHeaderValue($):void 0)??"",X=$?$.isFilterAllowed():!1;if(Q){if(typeof Q==="number")return{width:Q,displayName:Z,filterAllowed:X};return{width:Q({column:$,index:z}),displayName:Z,filterAllowed:X}}if($)return{width:Math.max($.getActualWidth(),75),displayName:Z,filterAllowed:X};return{displayName:Z,filterAllowed:X}}onNewHeaderColumn($,z){return(Q)=>{let J=this.extractHeaderValue(Q),Z=this.config.styleLinker({rowType:"HEADER",rowIndex:$,value:J,column:Q});z.push(this.createCell(this.getStyleId(Z),this.getDataTypeForValue("string"),J))}}onNewBodyColumn($,z){let Q=0,{freezeColumns:J,rightToLeft:Z}=this.config;return(X,Y,q)=>{if(Q>0){Q-=1;return}if(!this.skipFrozenColumns){let L=X.getPinned();if(J==="pinned"&&L&&(L===!0||L==="left")!==Z)this.frozenColumnCount++;else if(typeof J==="function"&&J(y(this.gos,{column:X})))this.frozenColumnCount++;else this.skipFrozenColumns=!0}let{value:G,valueFormatted:_}=this.extractRowCellValue({column:X,node:q,currentColumnIndex:Y,accumulatedRowIndex:$,type:"excel",useRawFormula:!0}),H=G,U=typeof H==="bigint"?H.toString():H,W=this.config.styleLinker({rowType:"BODY",rowIndex:$,value:H,column:X,node:q}),B=this.getStyleId(W),E=X.getColSpan(q),K=this.addImage($,X,U);if(K)z.push(this.createCell(B,this.getDataTypeForValue(K.value),K.value==null?"":K.value));else if(E>1)Q=E-1,z.push(this.createMergedCell(B,this.getDataTypeForValue(H),U,E-1));else{let L=X.isAllowFormula()&&this.formulaSvc?.isFormula(U),D=this.createCell(B,L?"f":this.getDataTypeForValue(H),L?this.formulaSvc?.updateFormulaByOffset({value:U,rowDelta:$-(q.formulaRowIndex+1),useRefFormat:!1}):U,_);z.push(D)}}}onNewRow($,z){let Q=[];return this.rows.push({cells:Q,height:QZ(this.rows.length+1,z)}),{onColumn:$.bind(this,this.rows.length,Q)()}}addWorksheetToWorkbook($){let{excelStyles:z,config:Q}=this;if(this.mapSharedStrings($),this.frozenColumnCount)Q.frozenColumnCount=this.frozenColumnCount;if(this.frozenRowCount)Q.frozenRowCount=this.frozenRowCount;return this.workbook.addWorksheet(z,$,Q)}mapSharedStrings($){let z;for(let Q of $.table.rows)for(let J of Q.cells){let Z=J.data;if(!Z||Z.type!=="s")continue;let X=Z.value;if(X==null)continue;if(X===""){z??(z=this.workbook.getStringPosition("").toString()),Z.value=z;continue}Z.value=this.workbook.getStringPosition(String(X)).toString()}}getDataTypeForValue($){if($===void 0)return"empty";let z="s";try{if(this.isNumerical($))z="n"}catch(Q){}return z}getTypeFromStyle($,z){if(this.isFormula(z))return"f";if($?.dataType)switch($.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:j(162,{id:$.id,dataType:$.dataType})}return null}addImage($,z,Q){if(!this.config.addImageToCell)return;let J=this.config.addImageToCell($,z,Q);if(!J)return;return this.workbook.addBodyImageToMap(J.image,$,z,this.columnsToExport,this.config.rowHeight),J}createCell($,z,Q,J){let Z=this.getStyleById($);if(!Z?.dataType&&z==="s"&&J!=null)Q=J;let X=this.getTypeFromStyle(Z,Q)||z,{value:Y,escaped:q}=this.getCellValue(X,Q),G=[];if(Z)G.push($);if(q)G.push("_quotePrefix");return $=this.getStyleId(G)||void 0,{styleId:$,data:{type:X,value:Y}}}createMergedCell($,z,Q,J){let Z=Q==null?"":Q;return{styleId:this.getStyleById($)?$:void 0,data:{type:z,value:z==="s"?String(Z):Q},mergeAcross:J}}getCellValue($,z){let Q=!1;if(z==null||$==="s"&&z==="")return{value:"",escaped:!1};if($==="s"){if(z=String(z),z[0]==="'")Q=!0,z=z.slice(1)}else if($==="f")z=this.addXlfnPrefix(z).slice(1);else if($==="n"){let J=Number(z);if(isNaN(J))z="";else if(z!=="")z=J.toString()}return{value:z,escaped:Q}}addXlfnPrefix($){if(!$)return $;let z=/(^|[^A-Z0-9._])(CONCAT)(\s*\()/gi;return $.replace(z,(Q,J,Z,X)=>`${J}_xlfn.${Z}${X}`)}getStyleId($){if(!$?.length)return null;let z=$.filter((J)=>this.stylesByIds[J]!=null);if(!z.length)return null;if(z.length===1)return z[0];let Q=z.join("-");if(!this.mixedStyles[Q])this.addNewMixedStyle(z);return this.mixedStyles[Q].excelID}addNewMixedStyle($){this.mixedStyleCounter+=1;let z=`mixedStyle${this.mixedStyleCounter}`,Q={};for(let Z of $){let X=this.stylesByIds[Z];if(X)B0(Q,X,!0,!0)}Q.id=z;let J=$.join("-");this.mixedStyles[J]={excelID:z,key:J,result:Q},this.excelStyles.push(Q),this.stylesByIds[z]=Q}isFormula($){if($==null)return!1;let z=String($);return this.config.autoConvertFormulas&&o1(z)}isNumerical($){if(typeof $==="bigint")return!1;return isFinite($)&&$!==""&&!isNaN(parseFloat($))}getStyleById($){if($==null)return null;return this.stylesByIds[$]||null}},VF={getTemplate($){let{name:z,ContentType:Q,Extension:J,PartName:Z}=$;return{name:z,properties:{rawMap:{Extension:J,PartName:Z,ContentType:Q}}}}},AF=VF,KZ=($)=>$==="jpg"?"jpeg":$,SF={getTemplate({sheetLen:$,hasCustomProperties:z}){let Q=Array($).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml",PartName:`/xl/worksheets/sheet${W+1}.xml`})),J=Az.size,Z=d$.size,X={};TQ.forEach((U)=>{X[KZ(U.type)]=!0});let Y=Array(J).fill(void 0).map((U,W)=>({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.drawing+xml",PartName:`/xl/drawings/drawing${W+1}.xml`})),q=[];w$.forEach(({name:U})=>{q.push({name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml",PartName:`/xl/tables/${U}.xml`})});let G=z?[{name:"Override",ContentType:"application/vnd.openxmlformats-officedocument.custom-properties+xml",PartName:"/docProps/custom.xml"}]:[],_=Object.keys(X).map((U)=>({name:"Default",ContentType:`image/${U}`,Extension:U}));if(Z)_.push({name:"Default",Extension:"vml",ContentType:"application/vnd.openxmlformats-officedocument.vmlDrawing"});let H=[..._,{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"},...Q,{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"},...Y,...q,{name:"Override",ContentType:"application/vnd.openxmlformats-package.core-properties+xml",PartName:"/docProps/core.xml"},...G].map((U)=>AF.getTemplate(U));return{name:"Types",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/content-types"}},children:H}}},RF=SF,jF={getTemplate($){let Q=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:$},{name:"dc:title",textNode:"Workbook"},{name:"dcterms:created",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:Q},{name:"dcterms:modified",properties:{rawMap:{"xsi:type":"dcterms:W3CDTF"}},textNode:Q}]}}},fF=jF,OF="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}",PF=($)=>{return Object.keys($).filter((Q)=>Q&&$[Q]!=null).map((Q,J)=>({name:"property",properties:{rawMap:{fmtid:OF,pid:(J+2).toString(),name:W0(Q)??""}},children:[{name:"vt:lpwstr",textNode:W0(qZ(String($[Q])))??""}]}))},TF={getTemplate($){return{name:"Properties",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/officeDocument/2006/custom-properties","xmlns:vt":"http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes"}},children:PF($)}}},vF=TF,v9=($,z)=>({name:`xdr:${$}`,children:[{name:"xdr:col",textNode:z.col.toString()},{name:"xdr:colOff",textNode:z.offsetX.toString()},{name:"xdr:row",textNode:z.row.toString()},{name:"xdr:rowOff",textNode:z.offsetY.toString()}]}),IF=($)=>{let z=[{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($.recolor?.toLowerCase()){case"grayscale":case"sepia":case"washout":z.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:z}},CF=($,z)=>({name:"xdr:nvPicPr",children:[{name:"xdr:cNvPr",properties:{rawMap:{id:z,name:$.id,descr:$.altText!=null?$.altText:void 0}},children:[IF($)]},{name:"xdr:cNvPicPr",properties:{rawMap:{preferRelativeResize:"0"}},children:[{name:"a:picLocks"}]}]}),I9=($)=>{if(!$.saturation&&!$.tint)return;let z=[];if($.saturation)z.push({name:"a:satMod",properties:{rawMap:{val:$.saturation*1000}}});if($.tint)z.push({name:"a:tint",properties:{rawMap:{val:$.tint*1000}}});return z},bF=($,z)=>{return{name:"a:duotone",children:[{name:"a:prstClr",properties:{rawMap:{val:$.color}},children:I9($)},{name:"a:srgbClr",properties:{rawMap:{val:z.color}},children:I9(z)}]}},yF=($,z)=>{let Q;if($.transparency){let J=Math.min(Math.max($.transparency,0),100);Q=[{name:"a:alphaModFix",properties:{rawMap:{amt:1e5-Math.round(J*1000)}}}]}if($.recolor){if(!Q)Q=[];switch($.recolor.toLocaleLowerCase()){case"grayscale":Q.push({name:"a:grayscl"});break;case"sepia":Q.push(bF({color:"black"},{color:"D9C3A5",tint:50,saturation:180}));break;case"washout":Q.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${z}`,"xmlns:r":"http://schemas.openxmlformats.org/officeDocument/2006/relationships"}},children:Q},{name:"a:stretch",children:[{name:"a:fillRect"}]}]}},xF=($,z)=>{let Q={name:"a:xfrm",children:[{name:"a:off",properties:{rawMap:{x:0,y:0}}},{name:"a:ext",properties:{rawMap:{cx:z.width,cy:z.height}}}]};if($.rotation){let X=$.rotation;Q.properties={rawMap:{rot:Math.min(Math.max(X,0),360)*60000}}}return{name:"xdr:spPr",children:[Q,{name:"a:prstGeom",properties:{rawMap:{prst:"rect"}},children:[{name:"a:avLst"}]}]}},wF=($)=>{$.fitCell=!!$.fitCell||!$.width||!$.height;let{position:z={},fitCell:Q,width:J=0,height:Z=0,totalHeight:X,totalWidth:Y}=$,{offsetX:q=0,offsetY:G=0,row:_=1,rowSpan:H=1,column:U=1,colSpan:W=1}=z;return{from:{row:_-1,col:U-1,offsetX:jQ(q),offsetY:jQ(G)},to:{row:_-1+(Q?1:H-1),col:U-1+(Q?1:W-1),offsetX:jQ(J+q),offsetY:jQ(Z+G)},height:jQ(X||Z),width:jQ(Y||J)}},NF=($,z,Q,J)=>{return{name:"xdr:pic",children:[CF($,z+1),yF($,Q+1),xF($,J)]}},gF={getTemplate($){let{sheetIndex:z}=$,Q=Az.get(z),J=vQ.get(z),Z=Q.map((X,Y)=>{let q=wF(X);return{name:"xdr:twoCellAnchor",properties:{rawMap:{editAs:"absolute"}},children:[v9("from",q.from),v9("to",q.to),NF(X,Y,J.get(X.id).index,q),{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:Z}}},hF=gF,uF={getTemplate($){let{Id:z,Type:Q,Target:J}=$;return{name:"Relationship",properties:{rawMap:{Id:z,Type:Q,Target:J}}}}},mF=uF,cF={getTemplate($){let z=$.map((Q)=>mF.getTemplate(Q));return{name:"Relationships",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/package/2006/relationships"}},children:z}}},I1=cF,pF={getTemplate($){return{name:"sst",properties:{rawMap:{xmlns:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",count:$.size,uniqueCount:$.size}},children:MF($)}}},iF=pF,nF=($)=>{switch($){case 1:return"thin";case 2:return"medium";case 3:return"thick";default:return"hair"}},dF={None:"None",Dot:"Dotted",Dash:"Dashed",Double:"Double",DashDot:"DashDot",DashDotDot:"DashDotDot",SlantDashDot:"SlantDashDot",Continuous:"Continuous"},tF=["Dashed","DashDot","DashDotDot"],sF={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"},rF={Automatic:"general",Left:"left",Center:"center",Right:"right",Fill:"fill",Justify:"justify",CenterAcrossSelection:"centerContinuous",Distributed:"distributed",JustifyDistributed:"justify"},lF={Automatic:void 0,Top:"top",Bottom:"bottom",Center:"center",Justify:"justify",Distributed:"distributed",JustifyDistributed:"justify"},aF=($)=>{if(!$)return"none";return sF[$]||$},kz=($)=>{if($==null)return $;if($.charAt(0)==="#")$=$.substring(1);return $.length===6?"FF"+$:$},oJ=($,z)=>{if(!$)return"thin";let Q=nF(z);if($==="Continuous")return Q;let J=dF[$];if(Q==="medium"&&tF.some((Z)=>Z===J))return`medium${J}`;return`${J.charAt(0).toLowerCase()}${J.substring(1)}`},oF=($)=>{return rF[$]||"general"},eF=($)=>{return lF[$]||void 0},k1=($)=>{return{name:"color",properties:{rawMap:{rgb:kz($||"#000000")}}}},$M={getTemplate($){let{left:z,right:Q,top:J,bottom:Z,diagonal:X}=$,Y=z?[k1(z.color)]:void 0,q=Q?[k1(Q.color)]:void 0,G=J?[k1(J.color)]:void 0,_=Z?[k1(Z.color)]:void 0,H=X?[k1(X.color)]:void 0;return{name:"border",children:[{name:"left",properties:{rawMap:{style:z?.style}},children:Y},{name:"right",properties:{rawMap:{style:Q?.style}},children:q},{name:"top",properties:{rawMap:{style:J?.style}},children:G},{name:"bottom",properties:{rawMap:{style:Z?.style}},children:_},{name:"diagonal",properties:{rawMap:{style:X?.style}},children:H}]}}},zM=$M,QM={getTemplate($){return{name:"borders",properties:{rawMap:{count:$.length}},children:$.map((z)=>zM.getTemplate(z))}}},JM=QM,ZM=($)=>{let Q=["Context","LeftToRight","RightToLeft"].indexOf($);return Math.max(Q,0)},XM={getTemplate($){let{horizontal:z,indent:Q,readingOrder:J,rotate:Z,shrinkToFit:X,vertical:Y,wrapText:q}=$;return{name:"alignment",properties:{rawMap:{horizontal:z&&oF(z),indent:Q,readingOrder:J&&ZM(J),textRotation:Z,shrinkToFit:X,vertical:Y&&eF(Y),wrapText:q}}}}},YM=XM,qM={getTemplate($){let z=$.protected===!1?0:1;return{name:"protection",properties:{rawMap:{hidden:$.hideFormula===!0?1:0,locked:z}}}}},GM=qM,_M={getTemplate($){let{alignment:z,borderId:Q,fillId:J,fontId:Z,numFmtId:X,protection:Y,quotePrefix:q,xfId:G}=$,_=[];if(z)_.push(YM.getTemplate(z));if(Y)_.push(GM.getTemplate(Y));return{name:"xf",properties:{rawMap:{applyAlignment:z?1:void 0,applyProtection:Y?1:void 0,applyBorder:Q?1:void 0,applyFill:J?1:void 0,borderId:Q,fillId:J,applyFont:Z?1:void 0,fontId:Z,applyNumberFormat:X?1:void 0,numFmtId:X,quotePrefix:q?1:void 0,xfId:G}},children:_.length?_:void 0}}},WX=_M,HM={getTemplate($){return{name:"cellStyleXfs",properties:{rawMap:{count:$.length}},children:$.map((z)=>WX.getTemplate(z))}}},UM=HM,WM={getTemplate($){let{builtinId:z,name:Q,xfId:J}=$;return{name:"cellStyle",properties:{rawMap:{builtinId:z,name:Q,xfId:J}}}}},BM=WM,EM={getTemplate($){return{name:"cellStyles",properties:{rawMap:{count:$.length}},children:$.map((z)=>BM.getTemplate(z))}}},KM=EM,LM={getTemplate($){return{name:"cellXfs",properties:{rawMap:{count:$.length}},children:$.map((z)=>WX.getTemplate(z))}}},DM=LM,FM={getTemplate($){let{patternType:z,fgTheme:Q,fgTint:J,fgRgb:Z,bgRgb:X,bgIndexed:Y}=$,q={name:"patternFill",properties:{rawMap:{patternType:z}}};if(Q||J||Z)q.children=[{name:"fgColor",properties:{rawMap:{theme:Q,tint:J,rgb:Z}}}];if(Y||X){if(!q.children)q.children=[];q.children.push({name:"bgColor",properties:{rawMap:{indexed:Y,rgb:X}}})}return{name:"fill",children:[q]}}},MM=FM,kM={getTemplate($){return{name:"fills",properties:{rawMap:{count:$.length}},children:$.map((z)=>MM.getTemplate(z))}}},VM=kM,AM={getTemplate($){let{size:z,colorTheme:Q,color:J="FF000000",fontName:Z="Calibri",family:X,scheme:Y,italic:q,bold:G,strikeThrough:_,outline:H,shadow:U,underline:W,verticalAlign:B}=$,E=[{name:"sz",properties:{rawMap:{val:z}}},{name:"color",properties:{rawMap:{theme:Q,rgb:J}}},{name:"name",properties:{rawMap:{val:Z}}}];if(X)E.push({name:"family",properties:{rawMap:{val:X}}});if(Y)E.push({name:"scheme",properties:{rawMap:{val:Y}}});if(q)E.push({name:"i"});if(G)E.push({name:"b"});if(_)E.push({name:"strike"});if(H)E.push({name:"outline"});if(U)E.push({name:"shadow"});if(W)E.push({name:"u",properties:{rawMap:{val:W}}});if(B)E.push({name:"vertAlign",properties:{rawMap:{val:B}}});return{name:"font",children:E}}},SM=AM,RM={getTemplate($){return{name:"fonts",properties:{rawMap:{count:$.length}},children:$.map((z)=>SM.getTemplate(z))}}},jM=RM;function fM($){let z=$.split(/(\[[^\]]*\])/);for(let Q=0;QPM.getTemplate(z))}}},vM=TM,GZ,fQ,S1,R1,j1,BX,_Z,EX,l4,KX=($,z)=>{if($.includes("mixedStyle")&&z>1)$+=`_${z}`;return $},LX=()=>{GZ={base:0},fQ=[],S1=[{fontName:"Calibri",colorTheme:"1",family:"2",scheme:"minor"}],R1=[{patternType:"none"},{patternType:"gray125"}],j1=[{left:void 0,right:void 0,top:void 0,bottom:void 0,diagonal:void 0}],BX=[{borderId:0,fillId:0,fontId:0,numFmtId:0}],_Z=[{borderId:0,fillId:0,fontId:0,numFmtId:0,xfId:0}],EX=[{builtinId:0,name:"Normal",xfId:0}]},IM=($)=>{let z=aF($.pattern),Q=kz($.color),J=kz($.patternColor),Z=R1.findIndex((X)=>{let{patternType:Y,fgRgb:q,bgRgb:G}=X;return!(Y!=z||q!=Q||G!=J)});if(Z===-1)Z=R1.length,R1.push({patternType:z,fgRgb:Q,bgRgb:J});return Z},CM=($)=>{if(P9[$])return P9[$];let z=fQ.findIndex((Q)=>Q.formatCode===$);if(z===-1)z=fQ.length+164,fQ.push({formatCode:$,numFmtId:z});else z=fQ[z].numFmtId;return z},bM=($)=>{let{borderBottom:z,borderTop:Q,borderLeft:J,borderRight:Z}=$,X,Y,q,G,_,H,U,W;if(J)q=oJ(J.lineStyle,J.weight),U=kz(J.color);if(Z)G=oJ(Z.lineStyle,Z.weight),W=kz(Z.color);if(z)X=oJ(z.lineStyle,z.weight),_=kz(z.color);if(Q)Y=oJ(Q.lineStyle,Q.weight),H=kz(Q.color);let B=j1.findIndex((E)=>{let{left:K,right:L,top:D,bottom:F}=E;if(!K&&(q||U))return!1;if(!L&&(G||W))return!1;if(!D&&(Y||H))return!1;if(!F&&(X||_))return!1;let{style:M,color:k}=K||{},{style:V,color:R}=L||{},{style:O,color:I}=D||{},{style:v,color:C}=F||{};if(M!=q||k!=U)return!1;if(V!=G||R!=W)return!1;if(O!=Y||I!=H)return!1;if(v!=X||C!=_)return!1;return!0});if(B===-1)B=j1.length,j1.push({left:{style:q,color:U},right:{style:G,color:W},top:{style:Y,color:H},bottom:{style:X,color:_},diagonal:{style:void 0,color:void 0}});return B},yM=($)=>{let{fontName:z="Calibri",color:Q,size:J,bold:Z,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:_,family:H,verticalAlign:U}=$,W=kz(Q),B=KF(H),E=_?_.toLocaleLowerCase():void 0,K=U?U.toLocaleLowerCase():void 0,L=S1.findIndex((D)=>{return!(D.fontName!=z||D.color!=W||D.size!=J||D.bold!=Z||D.italic!=X||D.outline!=Y||D.shadow!=q||D.strikeThrough!=G||D.underline!=E||D.verticalAlign!=K||D.family!=B)});if(L===-1)L=S1.length,S1.push({fontName:z,color:W,size:J,bold:Z,italic:X,outline:Y,shadow:q,strikeThrough:G,underline:E,verticalAlign:K,family:B!=null?B.toString():void 0});return L},xM=($)=>{let{alignment:z,borders:Q,font:J,interior:Z,numberFormat:X,protection:Y,quotePrefix:q}=$,{id:G}=$,_=0,H=0,U=0,W=0;if(!G)return;if(G=KX(G,l4),GZ[G]!=null)return;if(Z)_=IM(Z);if(Q)H=bM(Q);if(J)U=yM(J);if(X)W=CM(X.format);GZ[G]=_Z.length,_Z.push({alignment:z,borderId:H||0,fillId:_||0,fontId:U||0,numFmtId:W||0,protection:Y,quotePrefix:q,xfId:0})},wM={getTemplate($){let z=vM.getTemplate(fQ),Q=jM.getTemplate(S1.map((G)=>({...G,size:G.size!=null?G.size:$}))),J=VM.getTemplate(R1),Z=JM.getTemplate(j1),X=UM.getTemplate(BX),Y=DM.getTemplate(_Z),q=KM.getTemplate(EX);return LX(),{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:[z,Q,J,Z,X,Y,q,{name:"tableStyles",properties:{rawMap:{count:0,defaultPivotStyle:"PivotStyleLight16",defaultTableStyle:"TableStyleMedium2"}}}]}}},NM=($,z)=>{return GZ[KX($,z)]||0},gM=($,z)=>{if(l4=z,l4===1)LX();$.forEach(xM)},hM=wM,uM={getTemplate($,z){let{name:Q,columns:J,rowRange:Z,displayName:X,showRowStripes:Y,showColumnStripes:q,showFilterButtons:G,highlightFirstColumn:_,highlightLastColumn:H}=$||{},U=!Z||Z[0]-Z[1]===0;if(!$||!Q||!Array.isArray(J)||!J.length||U)return{name:"table"};let W=J.map((F,M)=>({name:"filterColumn",properties:{rawMap:{colId:M.toString(),hiddenButton:G[M]?0:1}}})),B=`A${Z[0]}`,E=`${az(J.length)}${Z[1]}`,K=`${B}:${E}`,L=`${z+1}`,D=z?`${X}_${L}`:X;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:D,displayName:D,ref:K,totalsRowShown:0,id:L}},children:[{name:"autoFilter",properties:{rawMap:{ref:K}},children:W},{name:"tableColumns",properties:{rawMap:{count:J.length}},children:J.map((F,M)=>({name:"tableColumn",properties:{rawMap:{id:(M+1).toString(),name:W0(FF(F)),dataCellStyle:"Normal"}}}))},{name:"tableStyleInfo",properties:{rawMap:{name:"TableStyleLight1",showFirstColumn:_?1:0,showLastColumn:H?1:0,showRowStripes:Y?1:0,showColumnStripes:q?1:0}}}]}}},mM=uM,_$=($)=>{let[z,Q,J,Z]=$;return{name:`a:${z}`,children:[{name:`a:${Q}`,properties:{rawMap:{val:J,lastClr:Z}}}]}},cM={getTemplate(){return{name:"a:clrScheme",properties:{rawMap:{name:"Office"}},children:[_$(["dk1","sysClr","windowText","000000"]),_$(["lt1","sysClr","window","FFFFFF"]),_$(["dk2","srgbClr","44546A"]),_$(["lt2","srgbClr","E7E6E6"]),_$(["accent1","srgbClr","4472C4"]),_$(["accent2","srgbClr","ED7D31"]),_$(["accent3","srgbClr","A5A5A5"]),_$(["accent4","srgbClr","FFC000"]),_$(["accent5","srgbClr","5B9BD5"]),_$(["accent6","srgbClr","70AD47"]),_$(["hlink","srgbClr","0563C1"]),_$(["folHlink","srgbClr","954F72"])]}}},pM=cM,P=($)=>{let[z,Q,J,Z]=$;return{name:`a:${z}`,properties:{rawMap:{script:J,typeface:Q,panose:Z}}}},iM={getTemplate(){return{name:"a:fontScheme",properties:{rawMap:{name:"Office"}},children:[{name:"a:majorFont",children:[P(["latin","Calibri Light",void 0,"020F0302020204030204"]),P(["ea",""]),P(["cs",""]),P(["font","游ゴシック Light","Jpan"]),P(["font","맑은 고딕","Hang"]),P(["font","等线 Light","Hans"]),P(["font","新細明體","Hant"]),P(["font","Times New Roman","Arab"]),P(["font","Times New Roman","Hebr"]),P(["font","Tahoma","Thai"]),P(["font","Nyala","Ethi"]),P(["font","Vrinda","Beng"]),P(["font","Shruti","Gujr"]),P(["font","MoolBoran","Khmr"]),P(["font","Tunga","Knda"]),P(["font","Raavi","Guru"]),P(["font","Euphemia","Cans"]),P(["font","Plantagenet Cherokee","Cher"]),P(["font","Microsoft Yi Baiti","Yiii"]),P(["font","Microsoft Himalaya","Tibt"]),P(["font","MV Boli","Thaa"]),P(["font","Mangal","Deva"]),P(["font","Gautami","Telu"]),P(["font","Latha","Taml"]),P(["font","Estrangelo Edessa","Syrc"]),P(["font","Kalinga","Orya"]),P(["font","Kartika","Mlym"]),P(["font","DokChampa","Laoo"]),P(["font","Iskoola Pota","Sinh"]),P(["font","Mongolian Baiti","Mong"]),P(["font","Times New Roman","Viet"]),P(["font","Microsoft Uighur","Uigh"]),P(["font","Sylfaen","Geor"]),P(["font","Arial","Armn"]),P(["font","Leelawadee UI","Bugi"]),P(["font","Microsoft JhengHei","Bopo"]),P(["font","Javanese Text","Java"]),P(["font","Segoe UI","Lisu"]),P(["font","Myanmar Text","Mymr"]),P(["font","Ebrima","Nkoo"]),P(["font","Nirmala UI","Olck"]),P(["font","Ebrima","Osma"]),P(["font","Phagspa","Phag"]),P(["font","Estrangelo Edessa","Syrn"]),P(["font","Estrangelo Edessa","Syrj"]),P(["font","Estrangelo Edessa","Syre"]),P(["font","Nirmala UI","Sora"]),P(["font","Microsoft Tai Le","Tale"]),P(["font","Microsoft New Tai Lue","Talu"]),P(["font","Ebrima","Tfng"])]},{name:"a:minorFont",children:[P(["latin","Calibri",void 0,"020F0502020204030204"]),P(["ea",""]),P(["cs",""]),P(["font","游ゴシック","Jpan"]),P(["font","맑은 고딕","Hang"]),P(["font","等线","Hans"]),P(["font","新細明體","Hant"]),P(["font","Arial","Arab"]),P(["font","Arial","Hebr"]),P(["font","Tahoma","Thai"]),P(["font","Nyala","Ethi"]),P(["font","Vrinda","Beng"]),P(["font","Shruti","Gujr"]),P(["font","DaunPenh","Khmr"]),P(["font","Tunga","Knda"]),P(["font","Raavi","Guru"]),P(["font","Euphemia","Cans"]),P(["font","Plantagenet Cherokee","Cher"]),P(["font","Microsoft Yi Baiti","Yiii"]),P(["font","Microsoft Himalaya","Tibt"]),P(["font","MV Boli","Thaa"]),P(["font","Mangal","Deva"]),P(["font","Gautami","Telu"]),P(["font","Latha","Taml"]),P(["font","Estrangelo Edessa","Syrc"]),P(["font","Kalinga","Orya"]),P(["font","Kartika","Mlym"]),P(["font","DokChampa","Laoo"]),P(["font","Iskoola Pota","Sinh"]),P(["font","Mongolian Baiti","Mong"]),P(["font","Arial","Viet"]),P(["font","Microsoft Uighur","Uigh"]),P(["font","Sylfaen","Geor"]),P(["font","Arial","Armn"]),P(["font","Leelawadee UI","Bugi"]),P(["font","Microsoft JhengHei","Bopo"]),P(["font","Javanese Text","Java"]),P(["font","Segoe UI","Lisu"]),P(["font","Myanmar Text","Mymr"]),P(["font","Ebrima","Nkoo"]),P(["font","Nirmala UI","Olck"]),P(["font","Ebrima","Osma"]),P(["font","Phagspa","Phag"]),P(["font","Estrangelo Edessa","Syrn"]),P(["font","Estrangelo Edessa","Syrj"]),P(["font","Estrangelo Edessa","Syre"]),P(["font","Nirmala UI","Sora"]),P(["font","Microsoft Tai Le","Tale"]),P(["font","Microsoft New Tai Lue","Talu"]),P(["font","Ebrima","Tfng"])]}]}}},nM=iM,x$=($,z,Q)=>({name:`a:${$}`,properties:{rawMap:{val:z}},children:Q}),g4=($)=>{let[z,Q,J,Z,X,Y]=$,q=[];if(q.push(x$("satMod",J)),Z)q.push(x$("lumMod",Z));if(X)q.push(x$("tint",X));if(Y)q.push(x$("shade",Y));return{name:"a:gs",properties:{rawMap:{pos:z}},children:[{name:"a:schemeClr",properties:{rawMap:{val:Q}},children:q}]}},HZ=($,z)=>({name:"a:solidFill",children:[x$("schemeClr",$,z)]}),a4=($)=>{let[z,Q,J,Z,X]=$,[Y,q]=X;return{name:"a:gradFill",properties:{rawMap:{rotWithShape:z}},children:[{name:"a:gsLst",children:[g4(Q),g4(J),g4(Z)]},{name:"a:lin",properties:{rawMap:{ang:Y,scaled:q}}}]}},h4=($)=>{let[z,Q,J,Z]=$;return{name:"a:ln",properties:{rawMap:{w:z,cap:Q,cmpd:J,algn:Z}},children:[HZ("phClr"),x$("prstDash","solid"),{name:"a:miter",properties:{rawMap:{lim:"800000"}}}]}},u4=($)=>{let z=[];if($){let[Q,J,Z,X,Y]=$;z.push({name:"a:outerShdw",properties:{rawMap:{blurRad:Q,dist:J,dir:Z,algn:X,rotWithShape:Y}},children:[x$("srgbClr","000000",[x$("alpha","63000")])]})}return{name:"a:effectStyle",children:[Object.assign({},{name:"a:effectLst"},z.length?{children:z}:{})]}},dM=()=>({name:"a:fillStyleLst",children:[HZ("phClr"),a4(["1",["0","phClr","105000","110000","67000"],["50000","phClr","103000","105000","73000"],["100000","phClr","109000","105000","81000"],["5400000","0"]]),a4(["1",["0","phClr","103000","102000","94000"],["50000","phClr","110000","100000",void 0,"100000"],["100000","phClr","120000","99000",void 0,"78000"],["5400000","0"]])]}),tM=()=>({name:"a:lnStyleLst",children:[h4(["6350","flat","sng","ctr"]),h4(["12700","flat","sng","ctr"]),h4(["19050","flat","sng","ctr"])]}),sM=()=>({name:"a:effectStyleLst",children:[u4(),u4(),u4(["57150","19050","5400000","ctr","0"])]}),rM=()=>({name:"a:bgFillStyleLst",children:[HZ("phClr"),HZ("phClr",[x$("tint","95000"),x$("satMod","170000")]),a4(["1",["0","phClr","150000","102000","93000","98000"],["50000","phClr","130000","103000","98000","90000"],["100000","phClr","120000",void 0,void 0,"63000"],["5400000","0"]])]}),lM={getTemplate(){return{name:"a:fmtScheme",properties:{rawMap:{name:"Office"}},children:[dM(),tM(),sM(),rM()]}}},aM=lM,oM={getTemplate(){return{name:"a:themeElements",children:[pM.getTemplate(),nM.getTemplate(),aM.getTemplate()]}}},eM=oM,$k={getTemplate(){return{name:"a:theme",properties:{prefixedAttributes:[{prefix:"xmlns:",map:{a:"http://schemas.openxmlformats.org/drawingml/2006/main"}}],rawMap:{name:"Office Theme"}},children:[eM.getTemplate(),{name:"a:objectDefaults"},{name:"a:extraClrSchemeLst"}]}}},zk=$k,Qk=()=>({name:"o:shapelayout",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}]},children:[{name:"o:idmap",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:{data:"1"}}}]}),Jk=()=>({name:"v:stroke",properties:{rawMap:{joinstyle:"miter"}}}),Zk=($)=>({name:"v:formulas",children:$.map((z)=>({name:"v:f",properties:{rawMap:{eqn:z}}}))}),Xk=()=>({name:"v:path",properties:{prefixedAttributes:[{prefix:"o:",map:{connecttype:"rect",extrusionok:"f"}}],rawMap:{gradientshapeok:"t"}}}),DX=($)=>{let{aspectratio:z,rotation:Q}=$||{},J={};if(z)J.aspectratio="t";if(Q)J.rotation="t";return{name:"o:lock",properties:{prefixedAttributes:[{prefix:"v:",map:{ext:"edit"}}],rawMap:J}}};function Yk($,z,Q,J,Z){return($-z)/(Q-z)*(Z-J)+J}var qk=($,z)=>{let Q,{recolor:J,brightness:Z,contrast:X,id:Y}=$;if(J){if(Q={},J==="Washout"||J==="Grayscale")Q.gain="19661f",Q.blacklevel="22938f";if(J==="Black & White"||J==="Grayscale"){if(Q.grayscale="t",J==="Black & White")Q.bilevel="t"}}if(!J||J==="Grayscale"){if(!Q)Q={};if(X!=null&&X!==50){let q="1";if(X>=0){if(X<50)q=String(X/50);else if(X<100)q=String(50/(100-X));else if(X===100)q="2147483647f"}Q.gain=q}if(Z!=null&&Z!==50)Q.blacklevel=Yk(Z,0,100,-0.5,0.5).toString()}return{name:"v:imagedata",properties:{prefixedAttributes:[{prefix:"o:",map:{relid:`rId${z}`,title:Y}}],rawMap:Q}}},Gk=()=>{let $=["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:[Jk(),Zk($),Xk(),DX({aspectratio:!0})]}},C9=($)=>Math.floor(($??0)*0.74999943307122),_k=($,z)=>{let{width:Q=0,height:J=0,altText:Z}=$,X=C9(Q),Y=C9(J);return{name:"v:shape",properties:{rawMap:{id:$.headerFooterPosition,"o:spid":"_x0000_s1025",style:`position: absolute; margin-left: 0; margin-top: 10in; margin-bottom: 0; margin-right: 0; width: ${X}pt; height: ${Y}pt; z-index: ${z+1}`,type:"#_x0000_t75",alt:Z}},children:[qk($,z+1),DX({rotation:!0})]}},Hk={getTemplate($){let z=d$.get($.sheetIndex)||[],Q=[Qk(),Gk(),...z.map((J,Z)=>_k(J,Z))];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:Q}}},Uk=Hk,Wk={getTemplate($,z){let Q=(z+1).toString();return{name:"sheet",properties:{rawMap:{name:$,sheetId:Q,"r:id":`rId${Q}`}}}}},Bk=Wk,Ek={getTemplate($){return{name:"sheets",children:$.map((z,Q)=>Bk.getTemplate(z,Q))}}},Kk=Ek,Lk={getTemplate($,z){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:z}}}]},Kk.getTemplate($)]}}},Dk=Lk,Fk=($)=>Math.ceil(($-12)/7+1),Mk={getTemplate($){let{min:z,max:Q,outlineLevel:J,s:Z,width:X,hidden:Y,bestFit:q}=$,G=1,_="0";if(X>1)G=Fk(X),_="1";return{name:"col",properties:{rawMap:{min:z,max:Q,outlineLevel:J!=null?J:void 0,width:G,style:Z,hidden:Y?"1":"0",bestFit:q?"1":"0",customWidth:_}}}}},kk=Mk,Vk={getTemplate($){return{name:"mergeCell",properties:{rawMap:{ref:$}}}}},Ak=Vk,Sk=($)=>{let z=$.charAt(0).toLowerCase();return z==="s"?"inlineStr":z},Rk={getTemplate($,z,Q){let{ref:J,data:Z,styleId:X}=$,{type:Y,value:q}=Z||{type:"empty",value:null},G=Y;if(Y==="f")G="str";else if(Y.charAt(0)===Y.charAt(0).toUpperCase())G=Sk(Y);let _={name:"c",properties:{rawMap:{r:J,t:G==="empty"?void 0:G,s:X?NM(X,Q):void 0}}};if(G==="empty")return _;let H;if(G==="str"&&Y==="f")H=[{name:"f",textNode:W0(qZ(q))}];else if(G==="inlineStr")H=[{name:"is",children:[{name:"t",textNode:W0(qZ(q))}]}];else H=[{name:"v",textNode:q}];return Object.assign({},_,{children:H})}},jk=Rk,fk=($,z)=>{let Q=[],J=0;for(let Z=0;Z<$.length;Z++){let X=$[Z];if(X.mergeAcross)Q.push({pos:Z,excelPos:J}),J+=X.mergeAcross;J++}if(Q.length)for(let Z=Q.length-1;Z>=0;Z--){let X=[],Y=$[Q[Z].pos];for(let q=1;q<=Y.mergeAcross;q++)X.push({ref:`${az(Q[Z].excelPos+1+q)}${z+1}`,styleId:Y.styleId,data:{type:"empty",value:null}});if(X.length)$.splice(Q[Z].pos+1,0,...X)}},Ok=($)=>$.data?.value!==""||$.styleId!==void 0,Pk={getTemplate($,z,Q){let{collapsed:J,hidden:Z,height:X,outlineLevel:Y,cells:q=[]}=$;fk(q,z);let G=q.filter(Ok).map((_,H)=>jk.getTemplate(_,H,Q));return{name:"row",properties:{rawMap:{r:z+1,collapsed:J?"1":"0",hidden:Z?"1":"0",ht:X,customHeight:X!=null?"1":"0",spans:"1:1",outlineLevel:Y||void 0}},children:G}}},Tk=Pk,vk=($,z,Q)=>{let J=[],Z=[];$.forEach((q,G)=>{let _=q.cells,H=0,U;_.forEach((W,B)=>{let E=B+H+1,K=az(E),L=G+1;if(W.mergeAcross){H+=W.mergeAcross;let F=az(B+H+1);J.push(`${K}${L}:${F}${L}`)}if(!z[E-1])z[E-1]={};let{collapsibleRanges:D}=W;if(D)D.forEach((F)=>{Z.push([E+F[0],E+F[1]])});U=z[E-1],U.min=E,U.max=E,W.ref=`${K}${L}`})}),Z.sort((q,G)=>{if(q[0]!==G[0])return q[0]-G[0];return G[1]-q[1]});let X=new Map,Y=new Map;return Z.filter((q)=>{let G=q.toString();if(X.get(G))return!1;return X.set(G,!0),!0}).forEach((q)=>{let G=z.find((H)=>H.min==q[0]&&H.max==q[1]),_=Y.get(q[0]);z.push({min:q[0],max:q[1],outlineLevel:Q?void 0:_||1,width:(G||{width:100}).width}),Y.set(q[0],(_||0)+1)}),J},Ik=($)=>{if(!$||$!=="Portrait"&&$!=="Landscape")return"portrait";return $.toLocaleLowerCase()},Ck=($)=>{if($==null)return 1;let Q=["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($);return Q===-1?1:Q+1},bk=($)=>{let z={"&[Page]":"&P","&[Pages]":"&N","&[Date]":"&D","&[Time]":"&T","&[Tab]":"&A","&[Path]":"&Z","&[File]":"&F","&[Picture]":"&G"};for(let Q of Object.keys(z))$=$.replace(Q,z[Q]);return $},yk=($)=>{if($==="Center")return"C";if($==="Right")return"R";return"L"},xk=($,z)=>{if(!z)return $;if($+="&"",$+=z.fontName||"Calibri",z.bold!==z.italic)$+=z.bold?",Bold":",Italic";else if(z.bold)$+=",Bold Italic";else $+=",Regular";if($+=""",z.size)$+=`&${z.size}`;if(z.strikeThrough)$+="&S";if(z.underline)$+=`&${z.underline==="Double"?"E":"U"}`;if(z.color)$+=`&K${z.color.replace("#","").toUpperCase()}`;return $},wk=($,z,Q)=>$.reduce((J,Z,X)=>{let Y=yk(Z.position),q=xk(`${J}&${Y}`,Z.font),G=["Left","Center","Right"];if(!Z.position)Z.position=G[X];let{image:_}=Z;if(Z.value==="&[Picture]"&&_){let H=`${Y}${z}${Q}`;FX(_,H)}return`${q}${W0(bk(Z.value))}`},""),Nk=($)=>{let z=["all","first","even"],Q=[];return z.forEach((J)=>{let Z=$[J],X=J==="all"?"odd":J;if(!Z)return;for(let Y of Object.keys(Z)){let q=Z[Y],G=`${Y.charAt(0).toUpperCase()}${Y.slice(1)}`,_=Y[0].toUpperCase();if(q){let H=J==="all"?"":J.toUpperCase();Q.push({name:`${X}${G}`,properties:{rawMap:{"xml:space":"preserve"}},textNode:wk(q,_,H)})}}}),Q},gk=($)=>{return(z)=>{if($.length)z.children.push({name:"cols",children:$.map((Q)=>kk.getTemplate(Q))});return z}},hk=($,z)=>{return(Q)=>{if($.length)Q.children.push({name:"sheetData",children:$.map((J,Z)=>Tk.getTemplate(J,Z,z))});return Q}},uk=($)=>{let z=$.length;if(!z)return"";let Q=Array(z+1);Q[0]=z;for(let Z=1;Z<=z;Z++)Q[Z]=$.charCodeAt(Z-1)&255;let J=0;for(let Z=Q.length-1;Z>=0;Z--){let X=Q[Z],Y=(J&16384)===0?0:1,q=J<<1&32767;J=(Y|q)^X}return(J^52811).toString(16).toUpperCase().padStart(4,"0")},mk=($)=>{return(z)=>{if(!$)return z;let Q=typeof $==="boolean"?{}:$,J={sheet:1},Z=Q.password?uk(Q.password):"";if(Z)J.password=Z;let X={autoFilter:!1,deleteColumns:!1,deleteRows:!1,formatCells:!1,formatColumns:!1,formatRows:!1,insertColumns:!1,insertHyperlinks:!1,insertRows:!1,pivotTables:!1,selectLockedCells:!0,selectUnlockedCells:!0};return Object.keys(X).forEach((Y)=>{let q=Q[Y];if(q==null||q===X[Y])return;J[Y]=q?0:1}),z.children.push({name:"sheetProtection",properties:{rawMap:J}}),z}},ck=($)=>{return(z)=>{if($.length)z.children.push({name:"mergeCells",properties:{rawMap:{count:$.length}},children:$.map((Q)=>Ak.getTemplate(Q))});return z}},pk=($)=>{return(z)=>{let{top:Q=0.75,right:J=0.7,bottom:Z=0.75,left:X=0.7,header:Y=0.3,footer:q=0.3}=$;return z.children.push({name:"pageMargins",properties:{rawMap:{bottom:Z,footer:q,header:Y,left:X,right:J,top:Q}}}),z}},ik=($)=>{return(z)=>{if($)z.children.push({name:"pageSetup",properties:{rawMap:{horizontalDpi:0,verticalDpi:0,orientation:Ik($.orientation),paperSize:Ck($.pageSize)}}});return z}},nk=($)=>{return(z)=>{if(!$)return z;let Q=$.first!=null?1:0,J=$.even!=null?1:0;return z.children.push({name:"headerFooter",properties:{rawMap:{differentFirst:Q,differentOddEven:J}},children:Nk($)}),z}},dk=($)=>{return(z)=>{if($)z.children.push({name:"tableParts",properties:{rawMap:{count:"1"}},children:[{name:"tablePart",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}}]});return z}},tk=($)=>{return(z)=>{if(Az.get($)?.length)z.children.push({name:"drawing",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},sk=($)=>{return(z)=>{if(d$.get($))z.children.push({name:"legacyDrawingHF",properties:{rawMap:{"r:id":`rId${++z.rIdCounter}`}}});return z}},rk=($=0,z=0)=>{let Q=$>0||z>0;return Q?[{name:"pane",properties:{rawMap:{state:Q?"frozen":void 0,topLeftCell:Q?`${az($+1)}${z+1}`:void 0,xSplit:$===0?void 0:$,ySplit:z===0?void 0:z}}}]:void 0},lk=($=!1,z,Q)=>{return(J)=>{return J.children.push({name:"sheetViews",children:[{name:"sheetView",properties:{rawMap:{rightToLeft:$===!0?"1":"0",workbookViewId:"0"}},children:rk(z,Q)}]}),J}},ak=()=>{return($)=>{return $.children.push({name:"sheetPr",children:[{name:"outlinePr",properties:{rawMap:{summaryBelow:0}}}]}),$}},ok=($)=>{return(z)=>{let Q=$.reduce((J,Z)=>{if(Z.outlineLevel&&Z.outlineLevel>J)return Z.outlineLevel;return J},0);return z.children.push({name:"sheetFormatPr",properties:{rawMap:{baseColWidth:10,defaultRowHeight:16,outlineLevelRow:Q?Q:void 0}}}),z}},ek={getTemplate($){let{worksheet:z,currentSheet:Q,config:J}=$,{margins:Z={},pageSetup:X,headerFooterConfig:Y,suppressColumnOutline:q,rightToLeft:G,frozenRowCount:_,frozenColumnCount:H,protectSheet:U}=J,{table:W}=z,{rows:B,columns:E}=W,K=E?.length?vk(B,E,!!q):[],L=w$.get(Q),{children:D}=[ak(),lk(G,H,_),ok(B),gk(E),hk(B,Q+1),mk(U),ck(K),pk(Z),ik(X),nk(Y),tk(Q),sk(Q),dk(L)].reduce((F,M)=>M(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:D}}},$V=ek,sz=new Map,d0=[],rz=[],lz=new Map,Vz=new Map,Az=new Map,d$=new Map,TQ=new Map,vQ=new Map,w$=new Map,zV="AG-GRID-TABLE",Q5="SINGLE_SHEET";function QV(){return Q5}function JV($){Q5=$}function ZV($,z,Q){_V(z),gM($,d0.length);let J=Object.assign({},Q);if(Q.exportAsExcelTable&&Q.pivotModeActive)j(163,{featureName:"pivot mode"}),J.exportAsExcelTable=!1;qV(z,J);let Z=OV(z,J);return PV(Z),Z}function XV($){return $.replace(/^[^a-zA-Z_]+/,"_").replace(/\s/g,"_").replace(/[^a-zA-Z0-9_]/g,"_")}function YV($,z){if(w$.has($)){j(164);return}w$.set($,z)}function qV($,z){let{exportAsExcelTable:Q,prependContent:J,appendContent:Z,headerRowCount:X=0}=z;if(!Q)return;let Y=typeof Q==="boolean"?{}:Q,{name:q,showColumnStripes:G,showRowStripes:_,showFilterButton:H,highlightFirstColumn:U,highlightLastColumn:W}=Y,B=XV(q||zV),E=d0.length-1,{table:K}=$,{rows:L,columns:D}=K,F=J?J.length:0,M=Z?Z.length:0,k=L.length,V=D.length,R=[],O=[];for(let I=0;IX.id===$.id))Z.push($)}function GV($,z,Q,J,Z){let X=d0.length,{row:Y,column:q}=$.position||{},G=$;if(J){if(z!=null&&Q!=null&&(!Y||!q)){if(!$.position)$.position={};$.position=Object.assign({},$.position,{row:z,column:J.indexOf(Q)+1})}LF(G,J),DF(G,Z)}MX({imageToAdd:G,idx:X});let _=vQ.get(X);if(!_)_=new Map,vQ.set(X,_);let H=Az.get(X);if(!H)Az.set(X,[G]);else H.push(G);if(!_.get($.id))_.set($.id,{index:_.size,type:$.imageType})}function MX($){let{imageToAdd:z,idx:Q}=$,J=Vz.get(z.id);if(J){let Z=J.find((X)=>X.sheetId===Q);if(Z)Z.image.push(z);else J.push({sheetId:Q,image:[z]})}else Vz.set(z.id,[{sheetId:Q,image:[z]}]),TQ.set(z.id,{type:z.imageType,index:TQ.size})}function _V($){let z=W0($.name)||"",Q="";while(d0.indexOf(`${z}${Q}`)!==-1)if(Q==="")Q="_1";else Q=`_${parseInt(Q.slice(1),10)+1}`;$.name=`${z}${Q}`,d0.push($.name)}function HV($){if(sz.has($))return sz.get($);return sz.set($,sz.size),sz.size-1}function UV(){sz.clear(),Vz.clear(),Az.clear(),d$.clear(),TQ.clear(),vQ.clear(),w$.clear(),d0=[],rz=[],lz=new Map,Q5="SINGLE_SHEET"}function WV($){return y0(Dk.getTemplate(d0,$))}function BV($){return y0(hM.getTemplate($))}function EV(){return y0(iF.getTemplate(sz))}function KV($){return y0(fF.getTemplate($))}function LV($){return y0(vF.getTemplate($))}function DV($,z){return y0(RF.getTemplate({sheetLen:$,hasCustomProperties:z}))}function FV($){let z=[{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"}];if($)z.push({Id:"rId3",Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties",Target:"docProps/custom.xml"});let Q=I1.getTemplate(z);return y0(Q)}function MV(){return y0(zk.getTemplate())}function kV($,z){return y0(mM.getTemplate($,z))}function VV($){let z=Array($).fill(void 0).map((J,Z)=>({Id:`rId${Z+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",Target:`worksheets/sheet${Z+1}.xml`})),Q=I1.getTemplate([...z,{Id:`rId${$+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme",Target:"theme/theme1.xml"},{Id:`rId${$+2}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",Target:"styles.xml"},{Id:`rId${$+3}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",Target:"sharedStrings.xml"}]);return y0(Q)}function AV($){return y0(hF.getTemplate({sheetIndex:$}))}function SV($){let z=vQ.get($)||[],Q=[];for(let[J,Z]of z){let{index:X,type:Y}=Z;Q.push({Id:`rId${X+1}`,Type:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",Target:`../media/image${TQ.get(J).index+1}.${KZ(Y)}`})}return y0(I1.getTemplate(Q))}function RV($){return y0(Uk.getTemplate({sheetIndex:$}),!0)}function jV($){let z=d$.get($)||[],Q=[];for(let J=0;J{if(!$.size)return;let Q=new Map;z.forEach((J,Z)=>{if($.has(J))Q.set(Z,$.get(J))}),$.clear(),Q.forEach((J,Z)=>$.set(Z,J))},PV=($)=>{let z=lz.get($)??[];z.push(d0.length-1),lz.set($,z),rz.push($)},TV=($)=>{let z=new Map(lz),Q=[];for(let J of $){let Z=z.get(J);if(!Z?.length)return null;let X=Z.shift();Q.push(X),z.set(J,Z)}return Q},vV=($)=>{if(!$.length||rz.length===0)return null;let z=new Set,Q=[];for(let J of $){let Z=rz.findIndex((X,Y)=>!z.has(Y)&&X===J);if(Z===-1)return null;z.add(Z),Q.push(Z)}return Q},IV=($)=>{let z=new Map;$.forEach((Q,J)=>z.set(Q,J)),d0=$.map((Q)=>d0[Q]),rz=$.map((Q)=>rz[Q]),eJ(Az,$),eJ(d$,$),eJ(w$,$),eJ(vQ,$),Vz.forEach((Q)=>{Q.forEach((J)=>{let Z=z.get(J.sheetId);if(Z!=null)J.sheetId=Z})}),lz=new Map,rz.forEach((Q,J)=>{let Z=lz.get(Q)??[];Z.push(J),lz.set(Q,Z)})},CV=($)=>{if($.length<=1)return;let z=TV($)??vV($);if(!z)return;IV(z)},J5=class{getStringPosition($){return HV($)}addBodyImageToMap($,z,Q,J,Z){GV($,z,Q,J,Z)}addHeaderFooterImageToMap($,z){FX($,z)}addWorksheet($,z,Q){return ZV($,z,Q)}syncOrderWithSheetData($){CV($)}reset(){UV()}setFactoryMode($){JV($)}getFactoryMode(){return QV()}getSheetNames(){return[...d0]}},bV=async($)=>{let z=0,Q=[],J=new WritableStream({write:(Y)=>{Q.push(Y),z+=Y.length}}),Z=new ReadableStream({start:(Y)=>{let q=new FileReader;q.onload=(G)=>{if(G.target?.result)Y.enqueue(G.target.result);Y.close()},q.readAsArrayBuffer($)}}),X=new window.CompressionStream("deflate-raw");return await Z.pipeThrough(X).pipeTo(J),{size:z,content:new Blob(Q)}},yV=async($)=>{let z=new Blob([$]),{size:Q,content:J}=await bV(z),Z=new Uint8Array(await J.arrayBuffer());return{size:Q,content:Z}},xV=($)=>{let z=$.getHours();return z<<=6,z=z|$.getMinutes(),z<<=5,z=z|$.getSeconds()/2,z},wV=($)=>{let z=$.getFullYear()-1980;return z<<=4,z=z|$.getMonth()+1,z<<=5,z=z|$.getDate(),z};function b0($,z){let Q="";for(let J=0;J>>=8;return Q}var b9=($)=>{if(!$.length)return 0;let z=-1,Q=0,J=0,Z=0;for(let X=0;X<$.length;X++)Q=$[X],J=(z^Q)&255,Z=NV[J],z=z>>>8^Z;return z^-1},y9=($)=>{if(!$.length)return 0;if(typeof $==="string")return b9(new TextEncoder().encode($));return b9($)},NV=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,1088359270,936918000,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function gV($){let z=String.fromCharCode;function Q(U){let W=[];if(!U)return[];let B=U.length,E=0,K,L;while(E=55296&&K<=56319&&E=55296&&U<=57343)throw Error($$(255,{point:U}))}function Z(U,W){return z(U>>W&63|128)}function X(U){if((U&4294967168)==0)return z(U);let W="";if((U&4294965248)==0)W=z(U>>6&31|192);else if((U&4294901760)==0)J(U),W=z(U>>12&15|224),W+=Z(U,6);else if((U&4292870144)==0)W=z(U>>18&7|240),W+=Z(U,12),W+=Z(U,6);return W+=z(U&63|128),W}let Y=Q($),q=Y.length,G=-1,_,H="";while(++G{let{content:Y,path:q,created:G}=$,_=xV(G),H=wV(G),U=y9(Z),W=X!==void 0?X:J,B=gV(q),E=B!==q,K="";if(E){let M=b0(1,1)+b0(y9(B),4)+B;K="up"+b0(M.length,2)+M}let L="\x14\x00"+(E?"\x00\b":"\x00\x00")+b0(z?8:0,2)+b0(_,2)+b0(H,2)+b0(W?U:0,4)+b0(X??J,4)+b0(J,4)+b0(B.length,2)+b0(K.length,2),D="PK\x03\x04"+L+B+K,F="PK\x01\x02\x14\x00"+L+"\x00\x00\x00\x00\x00\x00"+(Y?"\x00\x00\x00\x00":"\x10\x00\x00\x00")+b0(Q,4)+B+K;return{localFileHeader:Uint8Array.from(D,(M)=>M.charCodeAt(0)),centralDirectoryHeader:Uint8Array.from(F,(M)=>M.charCodeAt(0))}},VX=($)=>{let z;if(typeof $==="string"){let Q=atob($.split(";base64,")[1]);z=Uint8Array.from(Q,(J)=>J.charCodeAt(0))}else z=$;return{size:z.length,content:z}},hV=async($)=>{let{content:z}=$,{size:Q,content:J}=!z?{size:0,content:Uint8Array.from([])}:VX(z),Z,X,Y=!1;if($.type==="file"&&J&&Q>0){let G=await yV(J);Z=G.content,X=G.size,Y=!0}return{rawContent:J,rawSize:Q,deflatedContent:Z,deflatedSize:X,isCompressed:Y}},uV=($,z)=>{let{content:Q}=$,{content:J}=!Q?{content:Uint8Array.from([])}:VX(Q);return{...kX($,!1,z,J.length,J,void 0),content:J,isCompressed:!1}},mV=($,z,Q)=>{let J="PK\x05\x06\x00\x00\x00\x00"+b0($,2)+b0($,2)+b0(z,4)+b0(Q,4)+"\x00\x00";return Uint8Array.from(J,(Z)=>Z.charCodeAt(0))},AX=class{constructor(){this.folders=[],this.files=[]}addFolders($){$.forEach(this.addFolder.bind(this))}addFolder($){this.folders.push({path:$,created:new Date,isBase64:!1,type:"folder"})}addFile($,z,Q=!1){this.files.push({path:$,created:new Date,content:Q?z:new TextEncoder().encode(z),isBase64:Q,type:"file"})}async getZipFile($="application/zip"){let z=await this.buildCompressedFileStream();return this.clearStream(),new Blob([z],{type:$})}getUncompressedZipFile($="application/zip"){let z=this.buildFileStream();return this.clearStream(),new Blob([z],{type:$})}clearStream(){this.folders=[],this.files=[]}packageFiles($){let z=0,Q=0;for(let _ of $){let{localFileHeader:H,centralDirectoryHeader:U,content:W}=_;z+=H.length+W.length,Q+=U.length}let J=new Uint8Array(z),Z=new Uint8Array(Q),X=0,Y=0;for(let _ of $){let{localFileHeader:H,centralDirectoryHeader:U,content:W}=_;J.set(H,X),X+=H.length,J.set(W,X),X+=W.length,Z.set(U,Y),Y+=U.length}let q=mV($.length,Q,z),G=new Uint8Array(J.length+Z.length+q.length);return G.set(J),G.set(Z,J.length),G.set(q,J.length+Z.length),G}async buildCompressedFileStream(){let $=[...this.folders,...this.files],z=await Promise.all($.map(hV)),Q=[],J=0;for(let Z=0;Z<$.length;Z++){let X=$[Z],{rawContent:Y,rawSize:q,deflatedContent:G,deflatedSize:_,isCompressed:H}=z[Z],U=kX(X,H,J,q,Y,_),W=G??Y;Q.push({...U,content:W,isCompressed:H}),J+=U.localFileHeader.length+W.length}return this.packageFiles(Q)}buildFileStream(){let $=[...this.folders,...this.files],z=[],Q=0;for(let J of $){let Z=uV(J,Q),{localFileHeader:X,content:Y}=Z;z.push(Z),Q+=X.length+Y.length}return this.packageFiles(z)}},cV=($)=>{if($.addFolders(["_rels/","docProps/","xl/","xl/theme/","xl/_rels/","xl/worksheets/"]),!Vz.size)return;$.addFolders(["xl/worksheets/_rels","xl/drawings/","xl/drawings/_rels","xl/media/"]);let z=0;Vz.forEach((Q)=>{let J=Q[0].image[0],{base64:Z,imageType:X}=J;$.addFile(`xl/media/image${++z}.${KZ(X)}`,Z,!0)})},pV=($,z)=>{let Q=0,J=0;for(let Z=0;Z0&&Az.has(Z),q=w$.size>0&&w$.get(Z),G=Vz.size&&d$.has(Z);if(!Y&&!q&&!G)continue;let _,H,U;if(Y)iV($,Z,Q),H=Q,Q++;if(G)nV($,Z,J),U=J,J++;if(q)_=q.name;let W=`xl/worksheets/_rels/sheet${Z+1}.xml.rels`;$.addFile(W,fV({tableName:_,drawingIndex:H,vmlDrawingIndex:U}))}},iV=($,z,Q)=>{let Z=`xl/drawings/drawing${Q+1}.xml`,X=`xl/drawings/_rels/drawing${Q+1}.xml.rels`;$.addFile(X,SV(z)),$.addFile(Z,AV(z))},nV=($,z,Q)=>{let Z=`xl/drawings/vmlDrawing${Q+1}.vml`,X=`xl/drawings/_rels/vmlDrawing${Q+1}.vml.rels`;$.addFile(Z,RV(z)),$.addFile(X,jV(z))},dV=($)=>{let z=w$,Q=Array.from(z.keys());for(let J=0;J{let Y=!!X&&Object.keys(X).some((q)=>X[q]!=null);if($.addFile("xl/workbook.xml",WV(Z)),$.addFile("xl/styles.xml",BV(z)),$.addFile("xl/sharedStrings.xml",EV()),$.addFile("xl/theme/theme1.xml",MV()),$.addFile("xl/_rels/workbook.xml.rels",VV(J)),$.addFile("docProps/core.xml",KV(Q)),Y)$.addFile("docProps/custom.xml",LV(X));$.addFile("[Content_Types].xml",DV(J,Y)),$.addFile("_rels/.rels",FV(Y))},SX=($,z,Q={},J)=>{if(!z||z.length===0)return j(159),J.reset(),!1;J.syncOrderWithSheetData(z);let{fontSize:Z=11,author:X="AG Grid",activeTab:Y=0,customMetadata:q}=Q,G=z.length,_=Math.max(Math.min(Y,G-1),0);return cV($),dV($),pV($,z),tV($,Z,X,G,_,q),J.reset(),!0},x9=($,z=new J5)=>{let{data:Q,fontSize:J,author:Z,activeSheetIndex:X,customMetadata:Y}=$,q=$.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new AX;if(!SX(G,Q,{author:Z,fontSize:J,activeTab:X,customMetadata:Y},z))return Promise.resolve(void 0);return G.getZipFile(q)},w9=($,z=new J5)=>{let{data:Q,fontSize:J,author:Z,activeSheetIndex:X,customMetadata:Y}=$,q=$.mimeType||"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet",G=new AX;if(!SX(G,Q,{author:Z,fontSize:J,activeTab:X,customMetadata:Y},z))return;return G.getUncompressedZipFile(q)};var sV=class extends O4{constructor(){super(...arguments);this.beanName="excelCreator",this.workbook=new J5}getMergedParams($){let z=this.gos.get("defaultExcelExportParams");return Object.assign({},z,$)}export($){if(this.isExportSuppressed()){j(160);return}let z=()=>{let J=this.getMergedParams($),Z=this.getData(J),{fontSize:X,author:Y,mimeType:q,customMetadata:G}=J,_={data:[Z],fontSize:X,author:Y,mimeType:q,customMetadata:G};this.packageCompressedFile(_).then((H)=>{if(H){let{fileName:U}=J,W=typeof U==="function"?U(y(this.gos,{})):U;dJ(this.getFileName(W),H)}})},{overlays:Q}=this.beans;if(Q)Q.showExportOverlay(z);else z()}exportDataAsExcel($){this.export($)}getDataAsExcel($){let z=this.getMergedParams($),Q=this.getData(z),{fontSize:J,author:Z,mimeType:X,customMetadata:Y}=z,q={data:[Q],fontSize:J,author:Z,mimeType:X,customMetadata:Y};return this.packageFile(q)}setFactoryMode($){this.workbook.setFactoryMode($)}getFactoryMode(){return this.workbook.getFactoryMode()}getSheetDataForExcel($){let z=this.getMergedParams($);return this.getData(z)}getMultipleSheetsAsExcel($){return w9($,this.workbook)}exportMultipleSheetsAsExcel($){x9($,this.workbook).then((z)=>{let{fileName:Q="export.xlsx"}=$;if(z){let J=typeof Q==="function"?Q():Q;dJ(J,z)}})}getDefaultFileExtension(){return"xlsx"}createSerializingSession($){let{colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,formula:X,gos:Y}=this.beans,q=Y.get("excelStyles")||[],G=this.createStyleLinker(q),_={...$,colModel:z,colNames:Q,rowGroupColsSvc:J,valueSvc:Z,formulaSvc:X,gos:Y,suppressRowOutline:$.suppressRowOutline||$.skipRowGroups,headerRowHeight:$.headerRowHeight||$.rowHeight,baseExcelStyles:q,rightToLeft:$.rightToLeft??Y.get("enableRtl"),styleLinker:G,headerRowCount:p7(z),pivotModeActive:z.isPivotActive(),workbook:this.workbook};return new kF(_)}createStyleLinker($){let z=[],Q=new Set,J=new Map;$.forEach((Y,q)=>{z.push(Y.id),Q.add(Y.id),J.set(Y.id,q)});let{gos:Z,cellStyles:X}=this.beans;return(Y)=>{let{rowType:q,rowIndex:G,value:_,column:H,columnGroup:U,node:W}=Y,B=q==="HEADER",E=q==="HEADER_GROUPING",K=B?H:U,L=[];if(B||E){if(L.push("header"),E)L.push("headerGroup");if(K)L=L.concat(gJ(K.getDefinition(),Z,H||null,U||null));return L}let D=["cell"];if(!z.length)return D;let F=H.getDefinition();return X?.processAllCellClasses(F,y(Z,{value:_,data:W.data,node:W,colDef:F,column:H,rowIndex:G}),(M)=>{if(Q.has(M))D.push(M)}),D.sort((M,k)=>{let V=J.get(M)??-1,R=J.get(k)??-1;return V===R?0:Vthis.onFocusIn($),onFocusOut:($)=>this.onFocusOut($),focusInnerElement:($)=>this.focusInnerElement($),onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($)},this.stopPropagationCallbacks),this.refreshAriaProperties(),this.addManagedEventListeners({stylesChanged:this.onStylesChanged.bind(this)})}onStylesChanged($){if($.listItemHeightChanged)this.rowHeight=this.getItemHeight(),this.refresh()}refreshAriaProperties(){let z=this.getLocaleTextFunc()("ariaDefaultListName",this.listName||"List"),Q=this.eContainer;_0(Q,this.model?.getRowCount()>0?this.ariaRole:"presentation"),E0(Q,z)}addResizeObserver(){let $=()=>Y$(this.beans,()=>this.drawVirtualRows()),z=F$(this.beans,this.getGui(),$);this.addDestroyFunc(z)}focusInnerElement($){return this.focusRow($?this.model.getRowCount()-1:0),!0}onFocusIn($){let z=$.target;if(z.classList.contains("ag-virtual-list-item"))this.lastFocusedRowIndex=S6(z)-1}onFocusOut($){if(!this.getFocusableElement().contains($.relatedTarget))this.lastFocusedRowIndex=null}handleKeyDown($){let{key:z,shiftKey:Q}=$;switch(z){case A.UP:case A.DOWN:{let J=z===A.UP;if($.preventDefault(),Q)this.moveItem(J);else this.navigate(J)}break;case A.PAGE_HOME:case A.PAGE_END:case A.PAGE_UP:case A.PAGE_DOWN:if(this.navigateToPage(z)!==null)$.preventDefault();break}}onTabKeyDown($){this.stopPropagationCallbacks?.stopPropagation($),this.forceFocusOutOfContainer($.shiftKey)}getNextRow($){if(this.lastFocusedRowIndex==null)return;let z=this.lastFocusedRowIndex+($?-1:1);if(z<0||z>=this.model.getRowCount())return;return z}moveItem($){if(!this.moveItemCallback)return;let z=this.getComponentAt(this.lastFocusedRowIndex);if(!z)return;this.moveItemCallback(z,$)}navigate($){let z=this.getNextRow($);if(z===void 0)return;this.focusRow(z)}navigateToPage($,z="focused"){let Q=!1;if(z==="focused")z=this.getLastFocusedRow(),Q=!0;let J=this.model.getRowCount()-1,Z=-1;if($===A.PAGE_HOME)Z=0;else if($===A.PAGE_END)Z=J;else if($===A.PAGE_DOWN)Z=Math.min(z+this.pageSize,J);else if($===A.PAGE_UP)Z=Math.max(z-this.pageSize,0);if(Z===-1)return null;if(Q)this.focusRow(Z);else this.ensureIndexVisible(Z);return Z}getLastFocusedRow(){return this.lastFocusedRowIndex}focusRow($){if(this.isScrolling)return;this.isScrolling=!0,this.ensureIndexVisible($),Y$(this.beans,()=>{if(this.isScrolling=!1,!this.isAlive())return;let z=this.renderedRows.get($);if(z)z.eDiv.focus()})}getComponentAt($){let z=this.renderedRows.get($);return z&&z.rowComponent}forEachRenderedRow($){this.renderedRows.forEach((z,Q)=>$(z.rowComponent,Q))}getItemHeight(){if(!this.isHeightFromTheme)return this.rowHeight;return this.beans.environment.getDefaultListItemHeight()}ensureIndexVisible($,z=!0){let Q=this.model.getRowCount();if(typeof $!=="number"||$<0||$>=Q)return!1;let J=$*this.rowHeight,Z=J+this.rowHeight,X=this.getGui(),Y=X.scrollTop,q=X.offsetHeight,G=Y+q,_=z?0:this.rowHeight,H=Y>J+_,U=G{if(!this.isAlive())return;if(this.canSoftRefresh($))this.drawVirtualRows(!0);else this.clearVirtualRows(),this.drawVirtualRows()})}awaitStable($){if(this.awaitStableCallbacks.push($),this.awaitStableCallbacks.length>1)return;let z=this.model.getRowCount();C2(this,()=>this.eContainer.clientHeight>=z*this.rowHeight,()=>{if(!this.isAlive())return;let Q=this.awaitStableCallbacks;this.awaitStableCallbacks=[];for(let J of Q)J()})}canSoftRefresh($){return!!($&&this.renderedRows.size&&typeof this.model.areRowsEqual==="function"&&this.componentUpdater)}clearVirtualRows(){this.renderedRows.forEach(($,z)=>this.removeRow(z))}drawVirtualRows($){if(!this.isAlive()||!this.model)return;let z=this.getGui(),Q=z.scrollTop,J=Q+z.offsetHeight;if(Q===J)this.clearVirtualRows();else{let Z=Math.floor(Q/this.rowHeight),X=Math.floor(J/this.rowHeight);this.pageSize=Math.floor((J-Q)/this.rowHeight),this.ensureRowsRendered(Z,X,$)}}ensureRowsRendered($,z,Q){if(this.renderedRows.forEach((J,Z)=>{if((Z<$||Z>z)&&Z!==this.lastFocusedRowIndex)this.removeRow(Z)}),Q)this.refreshRows();for(let J=$;J<=z;J++){if(this.renderedRows.has(J))continue;if(J=z.getRowCount())return;let{cssIdentifier:Q,ariaRole:J,renderedRows:Z,eContainer:X}=this,Y=z.getRow($),q=J==="tree"?"treeitem":"option",G=K0({tag:"div",cls:`ag-virtual-list-item ag-${Q}-virtual-list-item`,role:q,attrs:{tabindex:"-1"}});VJ(G,z.getRowCount()),AJ(G,$+1);let _=this.rowHeight;G.style.height=`${_}px`,G.style.top=`${_*$}px`;let H=this.componentCreator(Y,G);if(H.addGuiEventListener("focusin",()=>this.lastFocusedRowIndex=$),G.appendChild(H.getGui()),Z.has($-1))Z.get($-1).eDiv.insertAdjacentElement("afterend",G);else if(Z.has($+1))Z.get($+1).eDiv.insertAdjacentElement("beforebegin",G);else X.appendChild(G);Z.set($,{rowComponent:H,eDiv:G,value:Y})}removeRow($){let z=this.renderedRows.get($);z.eDiv.remove(),this.destroyBean(z.rowComponent),this.renderedRows.delete($)}refreshRows(){let $=this.model.getRowCount();this.renderedRows.forEach((z,Q)=>{if(Q>=$)this.removeRow(Q);else{let J=this.model.getRow(Q);if(this.model.areRowsEqual?.(z.value,J))this.componentUpdater(J,z.rowComponent);else this.removeRow(Q)}})}addScrollListener(){this.addGuiEventListener("scroll",()=>this.drawVirtualRows(),{passive:!0})}setModel($){this.model=$}getAriaElement(){return this.eContainer}destroy(){if(!this.isAlive())return;this.clearVirtualRows(),this.awaitStableCallbacks.length=0,super.destroy()}},oV='.ag-list-item-hovered:after{background-color:var(--ag-accent-color);content:"";height:1px;left:0;position:absolute;right:0}.ag-item-highlight-top:after{top:0}.ag-item-highlight-bottom:after{bottom:0}',m4="ag-list-item-hovered",eV=class extends R0{constructor($,z,Q){super();this.comp=$,this.virtualList=z,this.params=Q,this.currentDragValue=null,this.lastHoveredListItem=null}postConstruct(){this.beans.environment.addGlobalCSS(oV,"component-AgVirtualListDragFeature"),this.params.addListeners(this,this.listItemDragStart.bind(this),this.listItemDragEnd.bind(this)),this.createDropTarget(),this.createAutoScrollService()}listItemDragStart($){this.currentDragValue=this.params.getCurrentDragValue($),this.moveBlocked=this.params.isMoveBlocked(this.currentDragValue)}listItemDragEnd(){window.setTimeout(()=>{this.currentDragValue=null,this.moveBlocked=!1},10)}createDropTarget(){let $={isInterestedIn:(z)=>z===this.params.dragSourceType,getIconName:()=>this.moveBlocked?"pinned":"move",getContainer:()=>this.comp.getGui(),onDragging:(z)=>this.onDragging(z),onDragStop:()=>this.onDragStop(),onDragLeave:()=>this.onDragLeave(),onDragCancel:()=>this.onDragCancel()};this.beans.dragAndDrop?.addDropTarget($)}createAutoScrollService(){let $=this.virtualList.getGui();this.autoScrollService=new mJ({scrollContainer:$,scrollAxis:"y",getVerticalPosition:()=>$.scrollTop,setVerticalPosition:(z)=>$.scrollTop=z})}onDragging($){if(!this.currentDragValue||this.moveBlocked)return;let z=this.getListDragItem($),Q=this.virtualList.getComponentAt(z.rowIndex);if(!Q)return;let J=Q.getGui().parentElement;if(this.lastHoveredListItem&&this.lastHoveredListItem.rowIndex===z.rowIndex&&this.lastHoveredListItem.position===z.position)return;this.autoScrollService.check($.event),this.clearHoveredItems(),this.lastHoveredListItem=z,P2(J,m4),P2(J,`ag-item-highlight-${z.position}`)}getListDragItem($){let z=this.virtualList.getGui(),Q=Number.parseFloat(window.getComputedStyle(z).paddingTop),J=this.virtualList.getRowHeight(),Z=this.virtualList.getScrollTop(),X=Math.max(0,($.y-Q+Z)/J),Y=this.params.getNumRows(this.comp)-1,q=Math.min(Y,X)|0;return{rowIndex:q,position:Math.round(X)>X||X>Y?"bottom":"top",component:this.virtualList.getComponentAt(q)}}onDragStop(){if(this.moveBlocked)return;this.params.moveItem(this.currentDragValue,this.lastHoveredListItem),this.clearDragProperties()}onDragCancel(){this.clearDragProperties()}onDragLeave(){this.clearDragProperties()}clearDragProperties(){this.clearHoveredItems(),this.autoScrollService.ensureCleared()}clearHoveredItems(){let $=this.virtualList.getGui();for(let z of $.querySelectorAll(`.${m4}`))for(let Q of[m4,"ag-item-highlight-top","ag-item-highlight-bottom"])z.classList.remove(Q);this.lastHoveredListItem=null}};var $A=".ag-panel{background-color:var(--ag-panel-background-color);display:flex;flex-direction:column;overflow:hidden;position:relative}.ag-dialog{border:var(--ag-dialog-border);border-radius:var(--ag-border-radius);box-shadow:var(--ag-dialog-shadow);position:absolute}.ag-panel-title-bar{align-items:center;background-color:var(--ag-panel-title-bar-background-color);border-bottom:var(--ag-panel-title-bar-border);color:var(--ag-panel-title-bar-text-color);cursor:default;display:flex;flex:none;font-family:var(--ag-panel-title-bar-font-family);font-size:var(--ag-panel-title-bar-font-size);font-weight:var(--ag-panel-title-bar-font-weight);height:var(--ag-panel-title-bar-height);padding:var(--ag-spacing) var(--ag-cell-horizontal-padding)}.ag-panel-title-bar-button{cursor:pointer;:where(.ag-icon){color:var(--ag-panel-title-bar-icon-color)}}:where(.ag-ltr) .ag-panel-title-bar-button{margin-left:calc(var(--ag-spacing)*2);margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-panel-title-bar-button{margin-left:var(--ag-spacing);margin-right:calc(var(--ag-spacing)*2)}.ag-panel-title-bar-title{flex:1 1 auto}.ag-panel-title-bar-buttons{display:flex}.ag-panel-content-wrapper{display:flex;flex:1 1 auto;overflow:hidden;position:relative}:where(.ag-dragging-fill-handle) .ag-dialog,:where(.ag-dragging-range-handle) .ag-dialog{opacity:.7;pointer-events:none}";function zA($){return $??($=$||"default"),{tag:"div",cls:`ag-panel ag-${$}-panel`,attrs:{tabindex:"-1"},children:[{tag:"div",ref:"eTitleBar",cls:`ag-panel-title-bar ag-${$}-panel-title-bar ag-unselectable`,children:[{tag:"span",ref:"eTitle",cls:`ag-panel-title-bar-title ag-${$}-panel-title-bar-title`},{tag:"div",ref:"eTitleBarButtons",cls:`ag-panel-title-bar-buttons ag-${$}-panel-title-bar-buttons`}]},{tag:"div",ref:"eContentWrapper",cls:`ag-panel-content-wrapper ag-${$}-panel-content-wrapper`}]}}var QA=class extends p0{constructor($){super(zA($.cssIdentifier));this.config=$,this.closable=!0,this.eContentWrapper=f,this.eTitleBar=f,this.eTitleBarButtons=f,this.eTitle=f,this.registerCSS($A)}postConstruct(){let{component:$,closable:z,hideTitleBar:Q,title:J,minWidth:Z=250,width:X,minHeight:Y=250,height:q,centered:G,popup:_,x:H,y:U,postProcessPopupParams:W}=this.config,B=this.beans,E=this.createManagedBean(new s2(this.getGui(),{minWidth:Z,width:X,minHeight:Y,height:q,centered:G,x:H,y:U,popup:_,calculateTopBuffer:()=>this.positionableFeature.getHeight()-this.getBodyHeight()}));this.positionableFeature=E;let K=this.getGui();if($)this.setBodyComponent($);if(!Q){if(J)this.setTitle(J);this.setClosable(z!=null?z:this.closable)}else N(this.eTitleBar,!1);if(this.addManagedElementListeners(this.eTitleBar,{mousedown:(D)=>{if(K.contains(D.relatedTarget)||K.contains(d(B))||this.eTitleBarButtons.contains(D.target)){D.preventDefault();return}let F=this.eContentWrapper.querySelector("button, [href], input, select, textarea, [tabindex]");if(F)F.focus()}}),_&&E.isPositioned())return;if(this.renderComponent)this.renderComponent();let L;if(W){let{type:D,eventSource:F,mouseEvent:M}=W;L=()=>B.popupSvc?.callPostProcessPopup(W,D,K,F,M)}E.initialisePosition(L),this.eContentWrapper.style.height="0"}renderComponent(){let $=this.getGui();$.focus(),this.close=()=>{$.remove(),this.destroy()}}getHeight(){return this.positionableFeature.getHeight()}setHeight($){this.positionableFeature.setHeight($)}getWidth(){return this.positionableFeature.getWidth()}setWidth($){this.positionableFeature.setWidth($)}setClosable($){if($!==this.closable)this.closable=$;if($){let z=this.closeButtonComp=new p0({tag:"div",cls:"ag-button"});this.createBean(z);let Q=z.getGui(),J=this.beans.iconSvc.createIconNoSpan("close",this.beans);J.classList.add("ag-panel-title-bar-button-icon"),Q.appendChild(J),this.addTitleBarButton(z),z.addManagedElementListeners(Q,{click:this.onBtClose.bind(this)})}else if(this.closeButtonComp)this.closeButtonComp.getGui().remove(),this.closeButtonComp=this.destroyBean(this.closeButtonComp)}setBodyComponent($){$.setParentComponent(this),this.eContentWrapper.appendChild($.getGui())}addTitleBarButton($,z){let Q=this.eTitleBarButtons,J=Q.children,Z=J.length;if(z==null)z=Z;z=Math.max(0,Math.min(z,Z)),$.addCss("ag-panel-title-bar-button");let X=$.getGui();if(z===0)Q.prepend(X);else if(z===Z)Q.append(X);else J[z-1].after(X);$.setParentComponent(this)}getBodyHeight(){return SJ(this.eContentWrapper)}getBodyWidth(){return xz(this.eContentWrapper)}setTitle($){this.eTitle.innerText=$}onBtClose(){this.close()}destroy(){if(this.closeButtonComp)this.closeButtonComp=this.destroyBean(this.closeButtonComp);let $=this.getGui();if($&&A0($))this.close();super.destroy()}},JA=class extends QA{constructor($,z){super({...$,popup:!0});this.callbacks=z,this.isMaximizable=!1,this.isMaximized=!1,this.maximizeListeners=[],this.resizeListenerDestroy=null,this.lastPosition={x:0,y:0,width:0,height:0}}wireBeans($){this.popupSvc=$.popupSvc}postConstruct(){let $=this.getGui(),{movable:z,resizable:Q,maximizable:J,modal:Z}=this.config;if(this.addCss("ag-dialog"),super.postConstruct(),this.tabGuardFeature=this.createManagedBean(new _4(this,this.callbacks?.stopPropagationCallbacks)),this.tabGuardFeature.initialiseTabGuard({isFocusableContainer:!0,onFocusIn:()=>{this.popupSvc?.bringPopupToFront($)},onTabKeyDown:(X)=>{if(Z)return;let Y=X.shiftKey,q=j0(this.beans,$,!1,Y);if(!q||this.tabGuardFeature.getTabGuardCtrl().isTabGuard(q)){if(this.callbacks?.focusNextContainer(this.beans,Y))X.preventDefault()}}}),z)this.setMovable(z);if(J)this.setMaximizable(J);if(Q)this.setResizable(Q);if(!this.config.modal)this.callbacks?.configureFocusableContainer(this.beans,this)}setAllowFocus($){this.tabGuardFeature.getTabGuardCtrl().setAllowFocus($)}renderComponent(){let $=this.getGui(),{alwaysOnTop:z,modal:Q,title:J,afterGuiAttached:Z}=this.config,X=this.getLocaleTextFunc(),Y=this.popupSvc?.addPopup({modal:Q,eChild:$,closeOnEsc:!0,closedCallback:this.onClosed.bind(this),alwaysOnTop:z,ariaLabel:J||X("ariaLabelDialog","Dialog"),afterGuiAttached:Z});if(Y)this.close=Y.hideFunc}onClosed($){this.destroy(),this.config.closedCallback?.($)}setMaximized($){if(this.isMaximizable&&$!==this.isMaximized)this.toggleMaximize()}toggleMaximize(){let $=this.positionableFeature.getPosition();if(this.isMaximized){let{x:z,y:Q,width:J,height:Z}=this.lastPosition;this.setWidth(J),this.setHeight(Z),this.positionableFeature.offsetElement(z,Q)}else this.lastPosition.width=this.getWidth(),this.lastPosition.height=this.getHeight(),this.lastPosition.x=$.x,this.lastPosition.y=$.y,this.positionableFeature.offsetElement(0,0),this.setHeight("100%"),this.setWidth("100%");this.isMaximized=!this.isMaximized,this.refreshMaximizeIcon()}refreshMaximizeIcon(){N(this.maximizeIcon,!this.isMaximized),N(this.minimizeIcon,this.isMaximized)}clearMaximizebleListeners(){if(this.maximizeListeners.length){for(let $ of this.maximizeListeners)$();this.maximizeListeners.length=0}if(this.resizeListenerDestroy)this.resizeListenerDestroy(),this.resizeListenerDestroy=null}destroy(){this.maximizeButtonComp=this.destroyBean(this.maximizeButtonComp),this.clearMaximizebleListeners(),super.destroy()}setResizable($){this.positionableFeature.setResizable($)}setMovable($){this.positionableFeature.setMovable($,this.eTitleBar)}setMaximizable($){if(!$){if(this.clearMaximizebleListeners(),this.maximizeButtonComp)this.destroyBean(this.maximizeButtonComp),this.maximizeButtonComp=this.maximizeIcon=this.minimizeIcon=void 0;return}let z=this.eTitleBar;if(!z||$===this.isMaximizable)return;this.isMaximizable=$;let Q=this.buildMaximizeAndMinimizeElements();this.refreshMaximizeIcon(),Q.addManagedElementListeners(Q.getGui(),{click:this.toggleMaximize.bind(this)}),this.addTitleBarButton(Q,0),this.maximizeListeners.push(...this.addManagedElementListeners(z,{dblclick:this.toggleMaximize.bind(this)})),[this.resizeListenerDestroy]=this.addManagedListeners(this.positionableFeature,{resize:()=>{this.isMaximized=!1,this.refreshMaximizeIcon()}})}buildMaximizeAndMinimizeElements(){let $=this.maximizeButtonComp=this.createBean(new p0({tag:"div",cls:"ag-dialog-button"})),z=$.getGui(),Q=this.beans.iconSvc;return this.maximizeIcon=Q.createIconNoSpan("maximize"),z.appendChild(this.maximizeIcon),this.maximizeIcon.classList.add("ag-panel-title-bar-button-icon"),this.minimizeIcon=Q.createIconNoSpan("minimize"),z.appendChild(this.minimizeIcon),this.minimizeIcon.classList.add("ag-panel-title-bar-button-icon"),$}};var ZA=class extends p${constructor($){super();this.setTemplateFromElement($.getGui(),void 0,void 0,!0)}postConstruct(){this.initialiseTabGuard({onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.handleKeyDown($)})}handleKeyDown($){if($.key===A.ESCAPE)this.closePanel()}onTabKeyDown($){if($.defaultPrevented)return;this.closePanel(),$.preventDefault()}closePanel(){let $=this.parentComponent;$.closeSubMenu(),setTimeout(()=>$.getGui().focus(),0)}},o4=class extends R0{constructor($){super();this.callbacks=$,this.ACTIVATION_DELAY=80,this.isActive=!1,this.subMenuIsOpen=!1,this.subMenuIsOpening=!1,this.suppressRootStyles=!0,this.suppressAria=!0,this.suppressFocus=!0}init($){let{menuItemDef:z,isAnotherSubMenuOpen:Q,level:J,childComponent:Z,contextParams:X}=$;return this.params=$.menuItemDef,this.level=J,this.isAnotherSubMenuOpen=Q,this.childComponent=Z,this.contextParams=X,this.cssClassPrefix=this.params.menuItemParams?.cssClassPrefix??"ag-menu-option",this.callbacks.getMenuItemComp(this.beans,this.params,{...z,level:J,isAnotherSubMenuOpen:Q,openSubMenu:(Y)=>this.openSubMenu(Y),closeSubMenu:()=>this.closeSubMenu(),closeMenu:(Y)=>this.closeMenu(Y),updateTooltip:(Y,q)=>this.refreshTooltip(Y,q),onItemActivated:()=>this.onItemActivated()}).then((Y)=>{if(!Y)return;this.menuItemComp=Y;let q=Y.configureDefaults?.();if(q)this.configureDefaults(q===!0?void 0:q)})}addListeners($,z){if(!z?.suppressClick)this.addManagedElementListeners($,{click:(Q)=>this.onItemSelected(Q)});if(!z?.suppressKeyboardSelect)this.addManagedElementListeners($,{keydown:(Q)=>{if(Q.key===A.ENTER||Q.key===A.SPACE)Q.preventDefault(),this.onItemSelected(Q)}});if(!z?.suppressMouseDown)this.addManagedElementListeners($,{mousedown:(Q)=>{Q.stopPropagation(),Q.preventDefault()}});if(!z?.suppressMouseOver)this.addManagedElementListeners($,{mouseenter:()=>this.onMouseEnter(),mouseleave:()=>this.onMouseLeave()})}isDisabled(){return!!this.params.disabled}openSubMenu($=!1,z){if(this.closeSubMenu(),!this.params.subMenu)return;this.subMenuIsOpening=!0;let Q=J0({tag:"div",cls:"ag-menu",role:"presentation"});this.eSubMenuGui=Q;let J,Z=()=>{this.subMenuIsOpening=!1};if(this.childComponent){let _=this.createBean(new ZA(this.childComponent));_.setParentComponent(this);let H=_.getGui(),U="mouseenter",W=()=>this.cancelDeactivate();if(H.addEventListener(U,W),J=()=>{H.removeEventListener(U,W),this.destroyBean(_)},Q.appendChild(H),this.childComponent.afterGuiAttached)Z=()=>{this.childComponent.afterGuiAttached(),this.subMenuIsOpening=!1}}else if(this.params.subMenu){let _=this.createBean(new RX(this.level+1,this.contextParams,this.callbacks));if(_.setParentComponent(this),_.addMenuItems(this.params.subMenu),Q.appendChild(_.getGui()),this.addManagedListeners(_,{closeMenu:(H)=>this.dispatchLocalEvent(H)}),_.addGuiEventListener("mouseenter",()=>this.cancelDeactivate()),J=()=>this.destroyBean(_),$)Z=()=>{_.activateFirstItem(),this.subMenuIsOpening=!1}}let X=this.beans.popupSvc,Y=()=>{let _=this.eGui;X?.positionPopupForMenu({eventSource:_,ePopup:Q,event:z instanceof MouseEvent?z:void 0,additionalParams:this.callbacks.getPostProcessPopupParams(this.contextParams)})},q=this.getLocaleTextFunc(),G=X?.addPopup({modal:!0,eChild:Q,positionCallback:Y,anchorToElement:this.eGui,ariaLabel:q("ariaLabelSubMenu","SubMenu"),afterGuiAttached:Z});this.subMenuIsOpen=!0,this.setAriaExpanded(!0),this.hideSubMenu=()=>{if(G)G.hideFunc();this.subMenuIsOpen=!1,this.setAriaExpanded(!1),J(),this.menuItemComp.setExpanded?.(!1),this.eSubMenuGui=void 0},this.menuItemComp.setExpanded?.(!0)}setAriaExpanded($){if(!this.suppressAria)w0(this.eGui,$)}closeSubMenu(){if(!this.hideSubMenu)return;this.hideSubMenu(),this.hideSubMenu=null,this.setAriaExpanded(!1)}isSubMenuOpen(){return this.subMenuIsOpen}isSubMenuOpening(){return this.subMenuIsOpening}activate($,z){if(this.cancelActivate(),this.params.disabled&&!z)return;if(this.isActive=!0,!this.suppressRootStyles)this.eGui.classList.add(`${this.cssClassPrefix}-active`);if(this.menuItemComp.setActive?.(!0),!this.suppressFocus)this.callbacks.preserveRangesWhile(this.beans,()=>this.eGui.focus({preventScroll:!z}));if($&&this.params.subMenu)window.setTimeout(()=>{if(this.isAlive()&&this.isActive)this.openSubMenu()},300);this.onItemActivated()}deactivate(){if(this.cancelDeactivate(),!this.suppressRootStyles)this.eGui.classList.remove(`${this.cssClassPrefix}-active`);if(this.menuItemComp.setActive?.(!1),this.isActive=!1,this.subMenuIsOpen)this.closeSubMenu()}getGui(){return this.menuItemComp.getGui()}getParentComponent(){return this.parentComponent}setParentComponent($){this.parentComponent=$}getSubMenuGui(){return this.eSubMenuGui}onItemSelected($){if(this.menuItemComp.select?.(),this.params.action)this.beans.frameworkOverrides.wrapOutgoing(()=>this.params.action(this.gos.addCommon({...this.contextParams})));else this.openSubMenu($&&$.type==="keydown",$);if(this.params.subMenu&&!this.params.action||this.params.suppressCloseOnSelect)return;this.closeMenu($)}closeMenu($){let z={type:"closeMenu"};if($)if($ instanceof MouseEvent)z.mouseEvent=$;else z.keyboardEvent=$;this.dispatchLocalEvent(z)}onItemActivated(){let $={type:"menuItemActivated",menuItem:this};this.dispatchLocalEvent($)}cancelActivate(){if(this.activateTimeoutId)window.clearTimeout(this.activateTimeoutId),this.activateTimeoutId=0}cancelDeactivate(){if(this.deactivateTimeoutId)window.clearTimeout(this.deactivateTimeoutId),this.deactivateTimeoutId=0}onMouseEnter(){if(this.cancelDeactivate(),this.isAnotherSubMenuOpen())this.activateTimeoutId=window.setTimeout(()=>this.activate(!0),this.ACTIVATION_DELAY);else this.activate(!0)}onMouseLeave(){if(this.cancelActivate(),this.isSubMenuOpen())this.deactivateTimeoutId=window.setTimeout(()=>this.deactivate(),this.ACTIVATION_DELAY);else this.deactivate()}refreshRootElementGui($){let z=this.menuItemComp.getGui(),{cssClassPrefix:Q,params:{cssClasses:J,disabled:Z}}=this,X=this.menuItemComp.getRootElement?.();if(X){if(!$)z.classList.add("ag-menu-option-custom");z=X}if(this.suppressRootStyles=!!$,!this.suppressRootStyles){z.classList.add(Q);for(let Y of J??[])z.classList.add(Y);if(Z)z.classList.add(`${Q}-disabled`)}return z}applyAriaProperties($){let{params:{checked:z,subMenu:Q,subMenuRole:J,disabled:Z}}=this,X=z!=null;if(_0($,X?"menuitemcheckbox":"menuitem"),Q)C6($,J??"menu");if(Z)O6($,!0)}configureDefaults($){if(!this.menuItemComp){setTimeout(()=>this.configureDefaults($));return}let{suppressRootStyles:z,suppressTooltip:Q,suppressAria:J,suppressTabIndex:Z,suppressFocus:X}=$||{},{params:{tooltip:Y,disabled:q}}=this,G=this.eGui=this.refreshRootElementGui(!!z);if(this.suppressAria=!!J,!J)this.applyAriaProperties(G);if(!Z)G.setAttribute("tabindex","-1");if(!Q)this.refreshTooltip(Y);if(!q)this.addListeners(G,$);this.suppressFocus=!!X}refreshTooltip($,z){if(this.tooltip=$,this.tooltipFeature=this.destroyBean(this.tooltipFeature),!$||!this.menuItemComp)return;let Q=this.beans.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui(),getTooltipValue:()=>this.tooltip,getLocation:()=>"menu",shouldDisplayTooltip:z});if(Q)this.tooltipFeature=this.createBean(Q)}destroy(){this.tooltipFeature=this.destroyBean(this.tooltipFeature),this.menuItemComp?.destroy?.(),super.destroy()}},RX=class extends p${constructor($=0,z,Q){super({tag:"div",cls:"ag-menu-list",role:"menu"});this.level=$,this.menuActionParams=z,this.callbacks=Q,this.menuItems=[]}postConstruct(){this.initialiseTabGuard({onTabKeyDown:($)=>this.onTabKeyDown($),handleKeyDown:($)=>this.callbacks.preserveRangesWhile(this.beans,()=>this.handleKeyDown($)),onFocusIn:($)=>this.handleFocusIn($),onFocusOut:($)=>this.handleFocusOut($)})}onTabKeyDown($){if(!this.getParentComponent()?.getGui()?.classList.contains("ag-focus-managed"))$.preventDefault();if($.shiftKey)this.closeIfIsChild($)}handleKeyDown($){switch($.key){case A.UP:case A.RIGHT:case A.DOWN:case A.LEFT:$.preventDefault(),this.handleNavKey($.key);break;case A.ESCAPE:if(this.closeIfIsChild())this.callbacks.stopPropagationCallbacks.stopPropagation($);break}}handleFocusIn($){let z=$.relatedTarget;if(!this.tabGuardFeature.getTabGuardCtrl().isTabGuard(z)&&(this.getGui().contains(z)||this.activeMenuItem?.getSubMenuGui()?.contains(z)))return;if(this.activeMenuItem)this.activeMenuItem.activate();else this.activateFirstItem()}handleFocusOut($){let z=$.relatedTarget;if(!this.activeMenuItem||this.getGui().contains(z)||this.activeMenuItem.getSubMenuGui()?.contains(z))return;if(!this.activeMenuItem.isSubMenuOpening())this.activeMenuItem.deactivate()}clearActiveItem(){if(this.activeMenuItem)this.activeMenuItem.deactivate(),this.activeMenuItem=null}addMenuItems($){if($==null)return;g.all($.map((z)=>{if(z==="separator")return g.resolve({eGui:this.createSeparator()});else if(typeof z==="string")return this.callbacks.warnNoItem?.(z),g.resolve({eGui:null});else return this.addItem(z)})).then((z)=>{for(let Q of z??[])if(Q?.eGui){if(this.appendChild(Q.eGui),Q.comp)this.menuItems.push(Q.comp)}})}addItem($){let z=this.createManagedBean(new o4(this.callbacks));return z.init({menuItemDef:$,isAnotherSubMenuOpen:()=>this.menuItems.some((Q)=>Q.isSubMenuOpen()),level:this.level,contextParams:this.menuActionParams}).then(()=>{return z.setParentComponent(this),this.addManagedListeners(z,{closeMenu:(Q)=>{this.dispatchLocalEvent(Q)},menuItemActivated:(Q)=>{if(this.activeMenuItem&&this.activeMenuItem!==Q.menuItem)this.activeMenuItem.deactivate();this.activeMenuItem=Q.menuItem}}),{comp:z,eGui:z.getGui()}})}activateFirstItem(){let $=this.menuItems.filter((z)=>!z.isDisabled())[0];if(!$)return;$.activate()}createSeparator(){let $={tag:"div",cls:"ag-menu-separator-part"};return K0({tag:"div",cls:"ag-menu-separator",attrs:{"aria-hidden":"true"},children:[$,$,$,$]})}handleNavKey($){switch($){case A.UP:case A.DOWN:{let Q=this.findNextItem($===A.UP);if(Q&&Q!==this.activeMenuItem)Q.activate(!1,!0);return}}let z=this.gos.get("enableRtl")?A.RIGHT:A.LEFT;if($===z)this.closeIfIsChild();else this.openChild()}closeIfIsChild($){let z=this.getParentComponent();if(z&&z instanceof o4){if($)$.preventDefault();return z.closeSubMenu(),z.getGui().focus(),!0}return!1}openChild(){if(this.activeMenuItem)this.activeMenuItem.openSubMenu(!0)}findNextItem($){let z=[...this.menuItems];if(!z.length)return;if(!this.activeMenuItem)return $?b(z):z[0];if($)z.reverse();let Q,J=!1;for(let Z of z){if(!J){if(Z===this.activeMenuItem)J=!0;continue}Q=Z;break}if(J&&!Q)return z[0];return Q||this.activeMenuItem}destroy(){this.clearActiveItem(),super.destroy()}};var XA=class extends p0{constructor($){super({tag:"div"});this.callbacks=$}init($){this.params=$,this.cssClassPrefix=this.params.cssClassPrefix??"ag-menu-option",this.addAriaAttributes(),this.addIcon(),this.addName(),this.addShortcut(),this.addSubMenu()}configureDefaults(){return!0}addAriaAttributes(){let{checked:$,subMenu:z}=this.params,Q=this.getGui();if($)v6(Q,$);if(z)w0(Q,!1)}addIcon(){if(this.params.isCompact)return;let $=K0({tag:"span",ref:"eIcon",cls:`${this.getClassName("part")} ${this.getClassName("icon")}`,role:"presentation"}),{checked:z,icon:Q}=this.params;if(z)$.appendChild(this.beans.iconSvc.createIconNoSpan("check"));else if(Q)if(X1(Q))$.appendChild(Q);else if(typeof Q==="string")$.innerHTML=Q;else this.callbacks?.warnNoIcon?.();this.getGui().appendChild($)}addName(){let $=K0({tag:"span",ref:"eName",cls:`${this.getClassName("part")} ${this.getClassName("text")}`,children:this.params.name||""});this.getGui().appendChild($)}addShortcut(){if(this.params.isCompact)return;let $=K0({tag:"span",ref:"eShortcut",cls:`${this.getClassName("part")} ${this.getClassName("shortcut")}`,children:this.params.shortcut||""});this.getGui().appendChild($)}addSubMenu(){let $=K0({tag:"span",ref:"ePopupPointer",cls:`${this.getClassName("part")} ${this.getClassName("popup-pointer")}`}),z=this.getGui();if(this.params.subMenu){let Q=this.gos.get("enableRtl")?"subMenuOpenRtl":"subMenuOpen";$.appendChild(this.beans.iconSvc.createIconNoSpan(Q))}z.appendChild($)}getClassName($){return`${this.cssClassPrefix}-${$}`}};function e4($,z){if(!z)return null;let Q=E$($),J=Q.indexOf(z);if(J===-1)return null;let Z=-1;for(let X=J-1;X>=0;X--)if(Q[X].classList.contains(gQ.TAB_GUARD_TOP)){Z=X;break}if(Z<=0)return null;return Q[Z-1]}function jX($,z){if(!z)return!1;let Q=$.querySelectorAll(`.${l2}`);if(!Q.length)return!1;for(let J=0;Jthis.activeItem?.tabbedItem?.afterDetachedCallback?.())}setupHeader(){let{enableCloseButton:$,cssClass:z}=this.params,Q=(J,Z)=>{if(J.classList.add(`ag-tabs-${Z}`),z)J.classList.add(`${z}-${Z}`)};if($)this.setupCloseButton(Q),this.eTabHeader=K0({tag:"div",role:"presentation"}),Q(this.eHeader,"header-wrapper"),this.eHeader.appendChild(this.eTabHeader);else this.eTabHeader=this.eHeader;_0(this.eTabHeader,"tablist"),Q(this.eTabHeader,"header")}setupCloseButton($){let z=K0({tag:"button"});$(z,"close-button");let Q=this.beans.iconSvc.createIconNoSpan("close");E0(z,this.params.closeButtonAriaLabel),z.appendChild(Q),this.addManagedElementListeners(z,{click:()=>this.params.onCloseClicked?.()});let J=K0({tag:"div",role:"presentation"});$(J,"close-button-wrapper"),J.appendChild(z),this.eHeader.appendChild(J),this.eCloseButton=z}handleKeyDown($){switch($.key){case A.RIGHT:case A.LEFT:{if(!this.eTabHeader.contains(d(this.beans)))return;let z=$.key===A.RIGHT,Q=this.gos.get("enableRtl"),J=this.items.indexOf(this.activeItem),Z=z!==Q?Math.min(J+1,this.items.length-1):Math.max(J-1,0);if(J===Z)return;$.preventDefault();let X=this.items[Z];this.showItemWrapper(X),X.eHeaderButton.focus();break}case A.UP:case A.DOWN:$.stopPropagation();break}}onTabKeyDown($){if($.defaultPrevented)return;let{beans:z,eHeader:Q,eBody:J,activeItem:Z,params:X}=this,{suppressTrapFocus:Y,enableCloseButton:q}=X,G=d(z),_=$.target,H=$.shiftKey;if(Q.contains(G)){if($.preventDefault(),q&&H&&!this.eCloseButton?.contains(G))this.eCloseButton?.focus();else if(Y&&H)e4(Y0(z).body,_)?.focus();else this.focusBody($.shiftKey);return}let U=null;if(jX(J,_)){if(H)U=e4(J,_);if(!U&&!Y)U=Z.eHeaderButton}if(!U&&J.contains(G)){if(U=j0(z,J,!1,H),!U){if(Y&&!H)this.forceFocusOutOfContainer(H);else if(q&&!H)$.preventDefault(),this.eCloseButton?.focus();else $.preventDefault(),this.focusHeader();return}}if(U)$.preventDefault(),U.focus()}focusInnerElement($){if($)return this.focusBody(!0);else return this.focusHeader(),!0}focusHeader($){this.activeItem.eHeaderButton.focus({preventScroll:$})}focusBody($){return F0(this.eBody,$)}setAfterAttachedParams($){this.afterAttachedParams=$}showFirstItem(){if(this.items.length>0)this.showItemWrapper(this.items[0])}addItem($){let z=K0({tag:"span",cls:"ag-tab",role:"tab",attrs:{tabindex:"-1"}});z.appendChild($.title),this.eTabHeader.appendChild(z),E0(z,$.titleLabel);let Q={tabbedItem:$,eHeaderButton:z};this.items.push(Q),z.addEventListener("click",this.showItemWrapper.bind(this,Q))}showItem($){let z=this.items.find((Q)=>Q.tabbedItem===$);if(z)this.showItemWrapper(z)}showItemWrapper($){let{tabbedItem:z,eHeaderButton:Q}=$;if(this.params.onItemClicked?.({item:z}),this.activeItem===$){this.params.onActiveItemClicked?.();return}if(this.lastScrollListener)this.lastScrollListener=this.lastScrollListener();if(z0(this.eBody),z.bodyPromise.then((J)=>{this.eBody.appendChild(J);let Z=!VQ();if(!this.params.suppressFocusBodyOnOpen)F0(this.eBody,!1,Z);if(z.afterAttachedCallback)z.afterAttachedCallback(this.afterAttachedParams);if(this.params.keepScrollPosition){let X=z.getScrollableContainer?.()||J;[this.lastScrollListener]=this.addManagedElementListeners(X,{scroll:()=>{this.tabbedItemScrollMap.set(z.name,X.scrollTop)}});let Y=this.tabbedItemScrollMap.get(z.name);if(Y!==void 0)setTimeout(()=>{X.scrollTop=Y},0)}}),this.activeItem)this.activeItem.eHeaderButton.classList.remove("ag-tab-selected"),this.activeItem.tabbedItem.afterDetachedCallback?.();Q.classList.add("ag-tab-selected"),this.activeItem=$}},GA=".ag-group{position:relative;width:100%}.ag-group-title-bar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-title{display:inline;min-width:0;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}:where(.ag-group-title-bar) .ag-group-title{cursor:default}.ag-group-toolbar{align-items:center;display:flex;padding:var(--ag-spacing)}.ag-group-container{display:flex}.ag-disabled .ag-group-container{pointer-events:none}.ag-disabled-group-container,.ag-disabled-group-title-bar{opacity:.5}.ag-group-container-horizontal{flex-flow:row wrap}.ag-group-container-vertical{flex-direction:column}.ag-group-title-bar-icon{cursor:pointer;flex:none}:where(.ag-ltr) .ag-group-title-bar-icon{margin-right:var(--ag-spacing)}:where(.ag-rtl) .ag-group-title-bar-icon{margin-left:var(--ag-spacing)}:where(.ag-group-item-alignment-stretch) .ag-group-item{align-items:stretch}:where(.ag-group-item-alignment-start) .ag-group-item{align-items:flex-start}:where(.ag-group-item-alignment-end) .ag-group-item{align-items:flex-end}";function _A($){let z=$.cssIdentifier||"default",Q=$.direction||"vertical";return{tag:"div",cls:`ag-group ag-${z}-group`,role:"presentation",children:[{tag:"div",ref:"eToolbar",cls:`ag-group-toolbar ag-${z}-group-toolbar`,children:[{tag:"ag-checkbox",ref:"cbGroupEnabled"}]},{tag:"div",ref:"eContainer",cls:`ag-group-container ag-group-container-${Q} ag-${z}-group-container`}]}}var HA=class extends p0{constructor($={}){super(_A($),[y$]);this.params=$,this.suppressEnabledCheckbox=!0,this.suppressToggleExpandOnEnableChange=!1,this.eToolbar=f,this.cbGroupEnabled=f,this.eContainer=f,this.registerCSS(GA);let{enabled:z,items:Q,suppressEnabledCheckbox:J,expanded:Z,suppressToggleExpandOnEnableChange:X,useToggle:Y}=$;if(this.cssIdentifier=$.cssIdentifier||"default",this.enabled=z!=null?z:!0,this.items=Q||[],this.useToggle=Y??!1,this.alignItems=$.alignItems||"center",this.expanded=Z==null?!0:Z,J!=null)this.suppressEnabledCheckbox=J;if(X!=null)this.suppressToggleExpandOnEnableChange=X}postConstruct(){if(this.setupTitleBar(),this.items.length){let Z=this.items;this.items=[],this.addItems(Z)}let $=this.getLocaleTextFunc();if(this.cbGroupEnabled.setLabel($("enabled","Enabled")),this.enabled)this.setEnabled(this.enabled,void 0,!0);this.setAlignItems(this.alignItems);let{onEnableChange:z,onExpandedChange:Q,suppressOpenCloseIcons:J}=this.params;if(this.hideEnabledCheckbox(this.suppressEnabledCheckbox),this.hideOpenCloseIcons(J??!1),this.refreshChildDisplay(),N(this.eContainer,this.expanded),this.cbGroupEnabled.onValueChange((Z)=>{this.setEnabled(Z,!0,this.suppressToggleExpandOnEnableChange),this.dispatchEnableChangeEvent(Z)}),z!=null)this.onEnableChange(z);if(Q!=null)this.onExpandedChange(Q)}refreshChildDisplay(){N(this.eToolbar,this.expanded&&!this.suppressEnabledCheckbox),this.eTitleBar?.refreshOnExpand(this.expanded)}isExpanded(){return this.expanded}setAlignItems($){if(this.alignItems!==$)this.removeCss(`ag-group-item-alignment-${this.alignItems}`);this.alignItems=$;let z=`ag-group-item-alignment-${this.alignItems}`;return this.addCss(z),this}toggleGroupExpand($,z){if(this.eTitleBar?.isSuppressCollapse()&&!this.useToggle)$=!0,z=!0;else if($=$!=null?$:!this.expanded,this.expanded===$)return this;if(this.expanded=$,this.refreshChildDisplay(),N(this.eContainer,$),!z)this.dispatchLocalEvent({type:$?"expanded":"collapsed"});return this}addItems($){for(let z of $)this.addItem(z)}prependItem($){this.insertItem($,!0)}addItem($){this.insertItem($,!1)}updateItems($){let z=this.items,Q=0;for(let J=0;J$(z.enabled)}),this}onExpandedChange($){return this.addManagedListeners(this,{expanded:()=>$(!0),collapsed:()=>$(!1)}),this}hideEnabledCheckbox($){return this.suppressEnabledCheckbox=$,this.refreshChildDisplay(),this.refreshDisabledStyles(),this}hideOpenCloseIcons($){return this.eTitleBar?.hideOpenCloseIcons($),this}refreshDisabledStyles(){let $=!this.enabled;this.eContainer.classList.toggle("ag-disabled",$),this.eTitleBar?.refreshDisabledStyles(this.suppressEnabledCheckbox&&$),this.eContainer.classList.toggle("ag-disabled-group-container",$)}setupTitleBar(){let $=this.useToggle?this.createToggleTitleBar():this.createDefaultTitleBar();this.eToolbar.insertAdjacentElement("beforebegin",$.getGui())}createDefaultTitleBar(){let $=this.createManagedBean(new WA(this.params));return this.eTitleBar=$,$.refreshOnExpand(this.expanded),this.addManagedListeners($,{expandedChanged:(z)=>this.toggleGroupExpand(z.expanded)}),$}createToggleTitleBar(){let $=this.createManagedBean(new N4({value:this.enabled,label:this.params.title,labelAlignment:"left",labelWidth:"flex",onValueChange:(z)=>{this.setEnabled(z,!0),this.dispatchEnableChangeEvent(z)}}));return $.addCss("ag-group-title-bar"),$.addCss(`ag-${this.params.cssIdentifier??"default"}-group-title-bar ag-unselectable`),this.eToggle=$,this.toggleGroupExpand(this.enabled),$}},c4="ag-disabled-group-title-bar";function UA($){let z=$.cssIdentifier??"default";return{tag:"div",cls:`ag-group-title-bar ag-${z}-group-title-bar ag-unselectable`,role:$.suppressKeyboardNavigation?"presentation":"group",children:[{tag:"span",ref:"eGroupOpenedIcon",cls:`ag-group-title-bar-icon ag-${z}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eGroupClosedIcon",cls:`ag-group-title-bar-icon ag-${z}-group-title-bar-icon`,role:"presentation"},{tag:"span",ref:"eTitle",cls:`ag-group-title ag-${z}-group-title`}]}}var WA=class extends p0{constructor($={}){super(UA($));this.suppressOpenCloseIcons=!1,this.suppressKeyboardNavigation=!1,this.eGroupOpenedIcon=f,this.eGroupClosedIcon=f,this.eTitle=f;let{title:z,suppressOpenCloseIcons:Q,suppressKeyboardNavigation:J}=$;if(!!z&&z.length>0)this.title=z;if(Q!=null)this.suppressOpenCloseIcons=Q;this.suppressKeyboardNavigation=J??!1}postConstruct(){this.setTitle(this.title),this.hideOpenCloseIcons(this.suppressOpenCloseIcons),this.setupExpandContract()}setupExpandContract(){let $=this.beans.iconSvc;this.eGroupClosedIcon.appendChild($.createIconNoSpan("accordionClosed")),this.eGroupOpenedIcon.appendChild($.createIconNoSpan("accordionOpen")),this.addManagedElementListeners(this.getGui(),{click:()=>this.dispatchExpandChanged(),keydown:(z)=>{switch(z.key){case A.ENTER:case A.SPACE:z.preventDefault(),this.dispatchExpandChanged();break;case A.RIGHT:case A.LEFT:z.preventDefault(),this.dispatchExpandChanged(z.key===A.RIGHT);break}}})}refreshOnExpand($){this.refreshAriaStatus($),this.refreshOpenCloseIcons($)}refreshAriaStatus($){if(!this.suppressOpenCloseIcons)w0(this.getGui(),$)}refreshOpenCloseIcons($){let z=!this.suppressOpenCloseIcons;N(this.eGroupOpenedIcon,z&&$),N(this.eGroupClosedIcon,z&&!$)}isSuppressCollapse(){return this.suppressOpenCloseIcons}dispatchExpandChanged($){let z={type:"expandedChanged",expanded:$};this.dispatchLocalEvent(z)}setTitle($){let z=this.getGui(),Q=!!$&&$.length>0;if($=Q?$:void 0,this.eTitle.textContent=$??"",N(z,Q),$!==this.title)this.title=$;let J=z.classList.contains(c4);return this.refreshDisabledStyles(J),this}addWidget($){return this.getGui().appendChild($),this}hideOpenCloseIcons($){if(this.suppressOpenCloseIcons=$,$)this.dispatchExpandChanged(!0);return this}refreshDisabledStyles($){let z=this.getGui();if($)z.classList.add(c4),z.removeAttribute("tabindex"),_0(z,"presentation");else if(z.classList.remove(c4),typeof this.title==="string"&&!this.suppressKeyboardNavigation)this.activateTabIndex([z]),_0(z,"group");else z.removeAttribute("tabindex"),_0(z,"presentation")}};var Q0="35.2.0",I0={moduleName:"EnterpriseCore",version:Q0,beans:[O9],icons:{accordionOpen:"tree-open",accordionClosed:"tree-closed",accordionIndeterminate:"tree-indeterminate",close:"cross",cancel:"cancel",maximize:"maximize",minimize:"minimize",columnDrag:"grip"},dependsOn:[],setLicenseKey:O9.setLicenseKey};var BA={stopPropagationCallbacks:Uz,focusNextContainer:($,z)=>{return Z$($,z)},configureFocusableContainer:($,z)=>{let Q=$.ctrlsSvc.get("gridCtrl");Q.addFocusableContainer(z),z.addDestroyFunc(()=>Q.removeFocusableContainer(z))}},EA=class extends JA{constructor($){super($,BA)}getFocusableContainerName(){return"dialog"}};var fX=class extends aV{constructor($){super(Uz,$)}};var KA=class extends eV{};function LA($){return $.sideBar?.comp.isDisplayed()??!1}function DA($,z){$.sideBar?.comp.setDisplayed(z)}function FA($,z){$.sideBar?.comp.setSideBarPosition(z)}function MA($,z,Q){$.sideBar?.comp.openToolPanel(z,"api",Q)}function kA($){$.sideBar?.comp.close("api")}function VA($){return $.sideBar?.comp.openedItem()??null}function AA($){$.sideBar?.comp.refresh()}function SA($){return $.sideBar?.comp.isToolPanelShowing()??!1}function RA($,z){let Q=$.sideBar?.comp.getToolPanelInstance(z);return m$(Q)}function jA($){return $.sideBar?.comp.getDef()}var fA=`.ag-tool-panel-wrapper{overflow:hidden;-webkit-user-select:none;-moz-user-select:none;user-select:none;width:var(--ag-horizontal-size,var(--ag-side-bar-panel-width))}.ag-tool-panel-content{display:flex;height:100%;overflow:hidden auto}.ag-tool-panel-wrapper.ag-tool-panel-animating{ + /* !important required to override .ag-hidden to tool panel remains visible while animating */display:block!important;transition:width var(--ag-side-bar-panel-animation-duration) ease-in-out}@media (prefers-reduced-motion:reduce){.ag-tool-panel-wrapper.ag-tool-panel-animating{transition:none}}.ag-tool-panel-external{display:flex;flex-direction:row}:where(.ag-tool-panel-external) .ag-tool-panel-wrapper{flex-grow:1}.ag-select-agg-func-item{align-items:center;display:flex;flex:1 1 auto;flex-flow:row nowrap;height:100%;overflow:hidden;position:relative;text-overflow:ellipsis;white-space:nowrap}.ag-tool-panel-horizontal-resize{cursor:ew-resize;height:100%;position:absolute;top:0;width:5px;z-index:1}.ag-side-bar{background-color:var(--ag-side-bar-background-color);display:flex;flex-direction:row-reverse;position:relative}:where(.ag-ltr) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{right:-3px}:where(.ag-rtl) :where(.ag-side-bar-left) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-ltr) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{left:-3px}:where(.ag-rtl) :where(.ag-side-bar-right) .ag-tool-panel-horizontal-resize{right:-3px}.ag-side-bar-left{flex-direction:row;order:-1}.ag-side-buttons{background-color:var(--ag-side-button-bar-background-color);padding-top:var(--ag-side-button-bar-top-padding);position:relative}.ag-side-button{background-color:var(--ag-side-button-background-color);border-bottom:var(--ag-side-button-border);border-top:var(--ag-side-button-border);color:var(--ag-side-button-text-color);margin-top:-1px;position:relative}.ag-side-button:before{background-color:transparent;bottom:0;content:"";display:block;position:absolute;top:0;transition:background-color var(--ag-side-button-selected-underline-transition-duration);width:var(--ag-side-button-selected-underline-width)}:where(.ag-ltr) .ag-side-button:before{left:0}:where(.ag-rtl) .ag-side-button:before{right:0}.ag-side-button:hover{background-color:var(--ag-side-button-hover-background-color);color:var(--ag-side-button-hover-text-color)}.ag-side-button.ag-selected{background-color:var(--ag-side-button-selected-background-color);border-bottom:var(--ag-side-button-selected-border);border-top:var(--ag-side-button-selected-border);color:var(--ag-side-button-selected-text-color)}.ag-side-button.ag-selected:before{background-color:var(--ag-side-button-selected-underline-color)}.ag-side-button-button{align-items:center;display:flex;flex-direction:column;gap:var(--ag-spacing);position:relative;white-space:nowrap;width:100%;&:focus{box-shadow:none}}:where(.ag-ltr) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding)}:where(.ag-rtl) .ag-side-button-button{padding:var(--ag-side-button-vertical-padding) var(--ag-side-button-left-padding) var(--ag-side-button-vertical-padding) var(--ag-side-button-right-padding)}.ag-side-button-button:focus-visible{box-shadow:inset var(--ag-focus-shadow)}.ag-side-button-label{writing-mode:vertical-lr}@media (resolution <= 1.5x){.ag-side-button-label{font-family:"Segoe UI",var(--ag-font-family)}:where(.ag-ltr) .ag-side-button-label{transform:rotate(.05deg)}:where(.ag-rtl) .ag-side-button-label{transform:rotate(-.05deg)}}:where(.ag-ltr) .ag-side-bar-left,:where(.ag-rtl) .ag-side-bar-right{border-right:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-left:var(--ag-side-panel-border)}}:where(.ag-ltr) .ag-side-bar-right,:where(.ag-rtl) .ag-side-bar-left{border-left:var(--ag-side-panel-border);:where(.ag-tool-panel-wrapper){border-right:var(--ag-side-panel-border)}}`,OA={tag:"div",cls:"ag-side-button",role:"presentation",children:[{tag:"button",ref:"eToggleButton",cls:"ag-button ag-side-button-button",role:"tab",attrs:{type:"button",tabindex:"-1","aria-expanded":"false"},children:[{tag:"div",ref:"eIconWrapper",cls:"ag-side-button-icon-wrapper",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eLabel",cls:"ag-side-button-label"}]}]},PA=class extends x{constructor($){super();this.toolPanelDef=$,this.eToggleButton=f,this.eIconWrapper=f,this.eLabel=f}getToolPanelId(){return this.toolPanelDef.id}postConstruct(){this.setTemplate(OA,[]),this.setLabel(),this.setIcon(),this.addManagedElementListeners(this.eToggleButton,{click:this.onButtonPressed.bind(this)}),this.eToggleButton.setAttribute("id",`ag-${this.getCompId()}-button`)}setLabel(){let $=this.toolPanelDef,z=this.getLocaleTextFunc()($.labelKey,$.labelDefault);this.eLabel.textContent=z}setIcon(){this.eIconWrapper.insertAdjacentElement("afterbegin",h(this.toolPanelDef.iconKey,this.beans))}onButtonPressed(){this.dispatchLocalEvent({type:"toggleButtonClicked"})}setSelected($){this.toggleCss("ag-selected",$),w0(this.eToggleButton,$)}},TA={tag:"div",cls:"ag-side-buttons",role:"tablist"},vA=class extends x{constructor(){super(TA);this.buttonComps=[]}postConstruct(){this.addManagedElementListeners(this.getFocusableElement(),{keydown:this.handleKeyDown.bind(this)})}handleKeyDown($){if($.key!==A.TAB||!$.shiftKey)return;if(Z$(this.beans,!0)){$.preventDefault();return}i0($)}setActiveButton($){for(let z of this.buttonComps)z.setSelected($===z.getToolPanelId())}addButtonComp($){let z=this.createBean(new PA($));return this.buttonComps.push(z),this.appendChild(z),z.addEventListener("toggleButtonClicked",()=>{this.dispatchLocalEvent({type:"sideBarButtonClicked",toolPanelId:$.id})}),z}clearButtons(){this.buttonComps=this.destroyBeans(this.buttonComps),z0(this.getGui())}destroy(){this.clearButtons(),super.destroy()}},IA={selector:"AG-SIDE-BAR-BUTTONS",component:vA},OX={id:"columns",labelDefault:"Columns",labelKey:"columns",iconKey:"columnsToolPanel",toolPanel:"agColumnsToolPanel"},PX={id:"filters",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agFiltersToolPanel"},CA={id:"filters-new",labelDefault:"Filters",labelKey:"filters",iconKey:"filtersToolPanel",toolPanel:"agNewFiltersToolPanel"},f1={columns:OX,filters:PX,"filters-new":CA};function $5($){if(!$)return;if($===!0)return{toolPanels:[OX,PX],defaultToolPanel:"columns"};if(typeof $==="string")return $5([$]);if(Array.isArray($)){let z=[];for(let Q of $){let J=f1[Q];if(!J){j(215,{key:Q,defaultByKey:f1});continue}z.push(J)}if(z.length===0)return;return{toolPanels:z,defaultToolPanel:z[0].id}}return{toolPanels:bA($.toolPanels),defaultToolPanel:$.defaultToolPanel,hiddenByDefault:$.hiddenByDefault,position:$.position,hideButtons:$.hideButtons}}function bA($){let z=[];if(!$)return z;return $.forEach((Q)=>{let J=yA(Q);if(!J)return;z.push(J)}),z}function yA($){if(typeof $!=="string")return $;if(f1[$])return f1[$];return j(215,{key:$,defaultByKey:f1}),null}var xA=class extends x{constructor(){super({tag:"div",cls:"ag-tool-panel-horizontal-resize"});this.minWidth=100,this.maxWidth=null}postConstruct(){let $=this.beans.horizontalResizeSvc.addResizeBar({eResizeBar:this.getGui(),dragStartPixels:1,onResizeStart:this.onResizeStart.bind(this),onResizing:this.onResizing.bind(this),onResizeEnd:this.onResizeEnd.bind(this)});this.addDestroyFunc($),this.inverted=this.gos.get("enableRtl")}dispatchResizeEvent($,z,Q){this.eventSvc.dispatchEvent({type:"toolPanelSizeChanged",width:Q,started:$,ended:z})}onResizeStart(){this.startingWidth=this.elementToResize.offsetWidth,this.dispatchResizeEvent(!0,!1,this.startingWidth)}onResizeEnd($){return this.onResizing($,!0)}onResizing($,z=!1){let Q=this.inverted?-1:1,J=Math.max(this.minWidth,Math.floor(this.startingWidth-$*Q));if(this.maxWidth!=null)J=Math.min(this.maxWidth,J);this.elementToResize.style.setProperty("--ag-horizontal-size",`${J}px`),this.dispatchResizeEvent(!1,z,J)}};function wA($,z,Q){return $.getCompDetails(z,NA,void 0,Q,!0)}var NA={name:"toolPanel",optionalMethods:["refresh","getState"]},gA={tag:"div",cls:"ag-tool-panel-wrapper",role:"tabpanel",children:[{tag:"div",cls:"ag-tool-panel-content",ref:"eContent"}]},hA=class extends x{constructor(){super(gA);this.eContent=f,this.animationId=0,this.defParent=null}postConstruct(){let $=this.getGui(),z=this.resizeBar=this.createManagedBean(new xA);$.setAttribute("id",`ag-${this.getCompId()}`),z.elementToResize=$,this.appendChild(z)}getToolPanelId(){return this.toolPanelId}getDefParent(){return this.defParent}setDefParent($){this.defParent=$}setToolPanelDef($,z){let{id:Q,minWidth:J,maxWidth:Z,width:X,parent:Y}=$;if(this.toolPanelId=Q,this.defParent=Y??null,X)this.getGui().style.setProperty("--ag-side-bar-panel-width",`${X}px`);let q=wA(this.beans.userCompFactory,$,z);if(q==null)return!1;let G=q.newAgStackInstance();this.params=q.params,G.then(this.setToolPanelComponent.bind(this));let _=this.resizeBar;if(J!=null)_.minWidth=J;if(Z!=null)_.maxWidth=Z;return!0}setToolPanelComponent($){this.toolPanelCompInstance=$;let{eContent:z}=this;z.appendChild($.getGui()),this.addDestroyFunc(()=>{this.destroyBean($)})}getToolPanelInstance(){return this.toolPanelCompInstance}setResizerSizerSide($){let z=this.gos.get("enableRtl"),Q=$==="left",J=z?Q:!Q;this.resizeBar.inverted=J}refresh(){this.toolPanelCompInstance?.refresh(this.params)}animateDisplayed($){if(this.isDisplayed()===$)return;let z=++this.animationId,{eContent:Q}=this,J=()=>{if(this.animationId===z)Z.classList.remove("ag-tool-panel-animating"),Q.style.width="",Z.style.width=""},Z=this.getGui(),X=Z.offsetWidth;this.setDisplayed($),Z.classList.add("ag-tool-panel-animating");let Y=getComputedStyle(Z).transitionDuration;if(!parseFloat(Y)){J();return}Z.style.transition="none",Z.style.width="",Q.style.width=`${Q.offsetWidth}px`,Z.style.width=`${X}px`;let q=Z.offsetWidth;Z.style.transition="",Z.style.width=$?"":"0";let G=setTimeout(J,100);Z.addEventListener("transitionstart",()=>clearTimeout(G),{once:!0}),Z.addEventListener("transitionend",J,{once:!0})}},uA={tag:"div",cls:"ag-side-bar ag-unselectable",children:[{tag:"ag-side-bar-buttons",ref:"sideBarButtons"}]},mA=class extends x{constructor(){super(uA,[IA]);this.sideBarButtons=f,this.toolPanelWrappers=[],this.registerCSS(fA)}postConstruct(){this.sideBarButtons.addEventListener("sideBarButtonClicked",this.onToolPanelButtonClicked.bind(this));let{beans:$,gos:z}=this,{sideBar:Q}=z.get("initialState")??{};this.setSideBarDef({sideBarDef:$5(z.get("sideBar")),sideBarState:Q}),this.addManagedPropertyListener("sideBar",()=>this.setState()),$.sideBar.comp=this;let J=this.getFocusableElement();this.createManagedBean(new c$(J,{onTabKeyDown:this.onTabKeyDown.bind(this),handleKeyDown:this.handleKeyDown.bind(this)})),Bz($,this,J),this.addManagedPropertyListener("enableAdvancedFilter",this.onAdvancedFilterChanged.bind(this))}getFocusableContainerName(){return"sideBar"}onTabKeyDown($){if($.defaultPrevented)return;let{beans:z,sideBarButtons:Q}=this,J=this.getGui(),Z=Q.getGui(),X=d(z),Y=J.querySelector(".ag-tool-panel-wrapper:not(.ag-hidden)"),q=$.target,G=$.shiftKey;if(!Y){if(Z$(z,G,!0))return $.preventDefault(),!0;return c7($),!1}if(Z.contains(X)){if(F0(Y,G))$.preventDefault();return}if(!G)return;let _=null;if(Y.contains(X))_=j0(z,Y,void 0,!0);else if(jX(Y,q))_=e4(Y,q);if(!_)_=Z.querySelector(".ag-selected button"),_=A0(_)?_:null;if(_&&_!==$.target)$.preventDefault(),_.focus()}handleKeyDown($){let z=d(this.beans),Q=this.sideBarButtons;if(!Q.getGui().contains(z))return;let J=Q.getGui(),Z=Array.prototype.slice.call(J.querySelectorAll(".ag-side-button")),X=Z.findIndex((G)=>G.contains(z)),Y=null;switch($.key){case A.LEFT:case A.UP:Y=Math.max(0,X-1);break;case A.RIGHT:case A.DOWN:Y=Math.min(X+1,Z.length-1);break}if(Y===null)return;let q=Z[Y].querySelector("button");if(q)q.focus(),$.preventDefault()}onToolPanelButtonClicked($){let z=$.toolPanelId;if(this.openedItem()===z)this.openToolPanel(void 0,"sideBarButtonClicked");else this.openToolPanel(z,"sideBarButtonClicked")}clearDownUi(){this.sideBarButtons.clearButtons(),this.destroyToolPanelWrappers()}setSideBarDef({sideBarDef:$,sideBarState:z,existingToolPanelWrappers:Q}){if(this.setDisplayed(!1),this.sideBar=$,$)this.sideBarButtons.setDisplayed(!$.hideButtons);if($?.toolPanels){let J=$.toolPanels;if(this.createToolPanelsAndSideButtons(J,z,Q),!this.toolPanelWrappers.length)return;let Z=z?z.visible:!$.hiddenByDefault;if(this.setDisplayed(Z),this.setSideBarPosition(z?z.position:$.position),Z)if(z){let{openToolPanel:X}=z;if(X)this.openToolPanel(X,"sideBarInitializing")}else this.openToolPanel($.defaultToolPanel,"sideBarInitializing")}}getDef(){return this.sideBar}setSideBarPosition($){if(!$)$="right";this.position=$;let z=$==="left",Q=z?"right":"left";this.toggleCss("ag-side-bar-left",z),this.toggleCss("ag-side-bar-right",!z);for(let J of this.toolPanelWrappers)J.setResizerSizerSide(Q);return this.dispatchSideBarUpdated(),this}setDisplayed($,z){super.setDisplayed($,z),this.dispatchSideBarUpdated()}getState(){let $={};for(let z of this.toolPanelWrappers)$[z.getToolPanelId()]=z.getToolPanelInstance()?.getState?.();return{visible:this.isDisplayed(),position:this.position,openToolPanel:this.openedItem(),toolPanels:$}}createToolPanelsAndSideButtons($,z,Q){for(let J of $)this.createToolPanelAndSideButton(J,z?.toolPanels?.[J.id],Q?.[J.id])}validateDef($){let{id:z,toolPanel:Q}=$;if(z==null)return j(212),!1;if(N9(Q)){if(this.beans.filterManager?.isAdvFilterEnabled())return j(213),!1}return!0}createToolPanelAndSideButton($,z,Q){if(!this.validateDef($)){this.destroyBean(Q);return}let J;if(Q)J=Q,J.setDefParent($.parent??null);else if(J=this.createBean(new hA),!J.setToolPanelDef($,y(this.gos,{initialState:z,onStateUpdated:()=>this.dispatchSideBarUpdated()})))return;J.setDisplayed(!1),this.renderToolPanelUnderParent(J,$.parent),this.toolPanelWrappers.push(J);let Z=this.sideBarButtons.addButtonComp($);I6(Z.eToggleButton,J.getGui())}refresh(){for(let $ of this.toolPanelWrappers)$.refresh()}renderToolPanelUnderParent($,z){let Q=$.getGui();if(z)this.beans.environment.applyThemeClasses(z,["ag-external","ag-tool-panel-external"]),Q.classList.add(this.gos.get("enableRtl")?"ag-rtl":"ag-ltr");let J=z??$.getDefParent()??this.getGui();if(Q.parentElement!==J)J.appendChild(Q)}getWrapper($){return this.toolPanelWrappers.find((z)=>z.getToolPanelId()===$)}openToolPanel($,z="api",Q){let J=this.openedItem(),X=!!$&&!!J||z==="sideBarInitializing";for(let G of this.toolPanelWrappers){let _=$===G.getToolPanelId();if(_)this.renderToolPanelUnderParent(G,Q??null);if(X)G.setDisplayed(_);else G.animateDisplayed(_)}let Y=this.openedItem();if(J!==Y)this.sideBarButtons.setActiveButton($),this.raiseToolPanelVisibleEvent($,J??void 0,z)}getToolPanelInstance($){let z=this.getWrapper($);if(!z){j(214,{key:$});return}return z.getToolPanelInstance()}raiseToolPanelVisibleEvent($,z,Q){let J=!!$&&!!z,Z=this.eventSvc;if(z)Z.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:z,visible:!1,switchingToolPanel:J});if($)Z.dispatchEvent({type:"toolPanelVisibleChanged",source:Q,key:$,visible:!0,switchingToolPanel:J})}close($="api"){this.openToolPanel(void 0,$)}isToolPanelShowing(){return!!this.openedItem()}openedItem(){let $=null;for(let z of this.toolPanelWrappers)if(z.isDisplayed())$=z.getToolPanelId();return $}setState($){let z=$5(this.gos.get("sideBar")),Q={};if(z&&this.sideBar)z.toolPanels?.forEach((J)=>{let{id:Z}=J;if(!Z)return;let X=this.sideBar.toolPanels?.find((_)=>_.id===Z);if(!X||J.toolPanel!==X.toolPanel)return;let Y=this.getWrapper(Z);if(!Y)return;let q=y(this.gos,{...J.toolPanelParams??{},initialState:$?.toolPanels?.[Z],onStateUpdated:()=>this.dispatchSideBarUpdated()});if(Y.getToolPanelInstance()?.refresh(q)!==!0)return;this.toolPanelWrappers=this.toolPanelWrappers.filter((_)=>_!==Y),T0(Y.getGui()),Q[Z]=Y});this.clearDownUi(),this.setSideBarDef({sideBarDef:z,sideBarState:$,existingToolPanelWrappers:Q})}dispatchSideBarUpdated(){this.eventSvc.dispatchEvent({type:"sideBarUpdated"})}destroyToolPanelWrappers(){for(let $ of this.toolPanelWrappers)T0($.getGui()),this.destroyBean($);this.toolPanelWrappers.length=0}onAdvancedFilterChanged(){if(this.sideBar?.toolPanels?.some((z)=>N9(typeof z==="string"?z:z.toolPanel)))this.setState()}destroy(){this.destroyToolPanelWrappers(),super.destroy()}};function N9($){return $==="agFiltersToolPanel"||$==="agNewFiltersToolPanel"}var cA={selector:"AG-SIDE-BAR",component:mA},pA=class extends S{constructor(){super(...arguments);this.beanName="sideBar"}getSelector(){return cA}},Z5={moduleName:"SideBar",version:Q0,beans:[pA],apiFunctions:{isSideBarVisible:LA,setSideBarVisible:DA,setSideBarPosition:FA,openToolPanel:MA,closeToolPanel:kA,getOpenedToolPanel:VA,refreshToolPanel:AA,isToolPanelShowing:SA,getToolPanelInstance:RA,getSideBar:jA},dependsOn:[I0,B4]},iA='.ag-menu-list{cursor:default;display:table;padding:var(--ag-spacing) 0;width:100%}.ag-menu-option,.ag-menu-separator{display:table-row}.ag-menu-option-part,.ag-menu-separator-part{display:table-cell;vertical-align:middle}.ag-menu-option{cursor:pointer;font-weight:500}:where(.ag-ltr) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:right}:where(.ag-rtl) :where(.ag-menu-option-popup-pointer) .ag-icon{text-align:left}.ag-menu-option-text{white-space:nowrap}.ag-menu-option-custom{display:contents}.ag-compact-menu-option{display:flex;flex-wrap:nowrap;width:100%}.ag-compact-menu-option-text{flex:1 1 auto;white-space:nowrap}.ag-menu-separator{height:calc(var(--ag-spacing)*2 + 1px)}.ag-menu-separator-part:after{border-top:solid var(--ag-border-width) var(--ag-menu-separator-color);content:"";display:block}.ag-compact-menu-option-active,.ag-menu-option-active{background-color:var(--ag-row-hover-color)}.ag-compact-menu-option-part,.ag-menu-option-part{line-height:var(--ag-icon-size);padding:calc(var(--ag-spacing) + 2px) 0}.ag-compact-menu-option-disabled,.ag-menu-option-disabled{cursor:not-allowed;opacity:.5}.ag-compact-menu-option-icon,.ag-menu-option-icon{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-compact-menu-option-icon,:where(.ag-ltr) .ag-menu-option-icon{padding-left:calc(var(--ag-spacing)*2)}:where(.ag-rtl) .ag-compact-menu-option-icon,:where(.ag-rtl) .ag-menu-option-icon{padding-right:calc(var(--ag-spacing)*2)}.ag-compact-menu-option-text,.ag-menu-option-text{padding-left:calc(var(--ag-spacing)*2);padding-right:calc(var(--ag-spacing)*2)}:where(.ag-ltr) .ag-compact-menu-option-shortcut,:where(.ag-ltr) .ag-menu-option-shortcut{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-shortcut,:where(.ag-rtl) .ag-menu-option-shortcut{padding-left:var(--ag-spacing)}:where(.ag-ltr) .ag-compact-menu-option-popup-pointer,:where(.ag-ltr) .ag-menu-option-popup-pointer{padding-right:var(--ag-spacing)}:where(.ag-rtl) .ag-compact-menu-option-popup-pointer,:where(.ag-rtl) .ag-menu-option-popup-pointer{padding-left:var(--ag-spacing)}.ag-menu-column-select-wrapper{height:265px;overflow:auto;:where(.ag-column-select){height:100%}}.ag-menu:where(.ag-tabs){min-width:290px}.ag-context-menu-loading-icon{pointer-events:none;position:absolute}',TX=class extends XA{constructor(){super({warnNoIcon:()=>j(227)})}},X5={moduleName:"MenuItem",version:Q0,userComponents:{agMenuItem:TX},icons:{check:"tick",subMenuOpen:"small-right",subMenuOpenRtl:"small-left"},css:[iA]},nA=".ag-column-select{display:flex;flex:3 1 0px;flex-direction:column;overflow:hidden;position:relative}.ag-column-select-header{flex:none;height:var(--ag-header-height);padding-left:var(--ag-widget-container-horizontal-padding);padding-right:var(--ag-widget-container-horizontal-padding)}.ag-column-select-column,.ag-column-select-column-group,.ag-column-select-header{align-items:center;display:flex;gap:var(--ag-widget-horizontal-spacing);position:relative}.ag-column-select-column,.ag-column-select-column-group{height:100%}:where(.ag-ltr) .ag-column-select-column,:where(.ag-ltr) .ag-column-select-column-group{padding-left:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}:where(.ag-rtl) .ag-column-select-column,:where(.ag-rtl) .ag-column-select-column-group{padding-right:calc(var(--ag-indentation-level)*var(--ag-column-select-indent-size))}.ag-column-select-column-group:where(:not(:last-child)),.ag-column-select-column:where(:not(:last-child)){margin-bottom:var(--ag-widget-vertical-spacing)}.ag-column-select-header-icon{border-radius:var(--ag-border-radius);cursor:pointer;height:var(--ag-icon-size);position:relative;width:var(--ag-icon-size);&:focus-visible{box-shadow:var(--ag-focus-shadow)}}.ag-column-select-header-filter-wrapper{flex:1 1 auto}.ag-column-select-header-filter{width:100%}.ag-column-select-list{flex:1 1 0px;overflow:hidden}:where(.ag-ltr) .ag-column-select-add-group-indent{margin-left:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}:where(.ag-rtl) .ag-column-select-add-group-indent{margin-right:calc(var(--ag-icon-size) + var(--ag-spacing)*1.5)}.ag-column-select-column-group-readonly,.ag-column-select-column-readonly{opacity:.5;pointer-events:none;.ag-icon{opacity:.5}&.ag-icon-grip{opacity:.35}}.ag-column-select-column-readonly{&.ag-icon-grip,.ag-icon-grip{opacity:.35}}.ag-column-select-virtual-list-viewport{padding:calc(var(--ag-widget-container-vertical-padding)*.5) 0}.ag-column-select-virtual-list-item{padding:0 var(--ag-widget-container-horizontal-padding)}.ag-column-select-column-label{flex:1 1 auto;overflow:hidden;text-overflow:ellipsis;white-space:nowrap}.ag-column-select-checkbox{display:flex}",dA=300,tA={tag:"div",cls:"ag-column-select-header",role:"presentation",children:[{tag:"div",ref:"eExpand",cls:"ag-column-select-header-icon"},{tag:"ag-checkbox",ref:"eSelect",cls:"ag-column-select-header-checkbox"},{tag:"ag-input-text-field",ref:"eFilterTextField",cls:"ag-column-select-header-filter-wrapper"}]},sA=class extends x{constructor(){super(tA,[y$,T4]);this.eExpand=f,this.eSelect=f,this.eFilterTextField=f}postConstruct(){this.createExpandIcons(),this.addManagedListeners(this.eExpand,{click:this.onExpandClicked.bind(this),keydown:(z)=>{if(z.key===A.SPACE)z.preventDefault(),this.onExpandClicked()}}),this.addManagedElementListeners(this.eSelect.getInputElement(),{click:this.onSelectClicked.bind(this)}),this.addManagedPropertyListener("functionsReadOnly",()=>this.onFunctionsReadOnlyPropChanged()),this.eFilterTextField.setAutoComplete(!1).onValueChange(()=>this.onFilterTextChanged()),this.addManagedEventListeners({newColumnsLoaded:this.showOrHideOptions.bind(this)});let $=this.getLocaleTextFunc();this.eSelect.setInputAriaLabel($("ariaColumnSelectAll","Toggle All Columns Visibility")),this.eFilterTextField.setInputAriaLabel($("ariaFilterColumnsInput","Filter Columns Input")),this.activateTabIndex([this.eExpand])}onFunctionsReadOnlyPropChanged(){let $=this.gos.get("functionsReadOnly");this.eSelect.setReadOnly($),this.eSelect.toggleCss("ag-column-select-column-readonly",$)}init($){this.params=$;let z=this.gos.get("functionsReadOnly");if(this.eSelect.setReadOnly(z),this.eSelect.toggleCss("ag-column-select-column-readonly",z),this.beans.colModel.ready)this.showOrHideOptions()}createExpandIcons(){let $=this.beans;this.eExpand.appendChild(this.eExpandChecked=h("columnSelectOpen",$)),this.eExpand.appendChild(this.eExpandUnchecked=h("columnSelectClosed",$)),this.eExpand.appendChild(this.eExpandIndeterminate=h("columnSelectIndeterminate",$)),this.setExpandState(0)}showOrHideOptions(){let $=this.params,z=!$.suppressColumnFilter,Q=!$.suppressColumnSelectAll,J=!$.suppressColumnExpandAll,Z=!!this.beans.colModel.colDefCols?.treeDepth,X=this.getLocaleTextFunc();this.eFilterTextField.setInputPlaceholder(X("searchOoo","Search...")),N(this.eFilterTextField.getGui(),z),N(this.eSelect.getGui(),Q),N(this.eExpand,J&&Z)}onFilterTextChanged(){if(!this.onFilterTextChangedDebounced)this.onFilterTextChangedDebounced=g$(this,()=>{let $=this.eFilterTextField.getValue();this.dispatchLocalEvent({type:"filterChanged",filterText:$})},dA);this.onFilterTextChangedDebounced()}onSelectClicked(){this.dispatchLocalEvent({type:this.selectState?"unselectAll":"selectAll"})}onExpandClicked(){this.dispatchLocalEvent({type:this.expandState===0?"collapseAll":"expandAll"})}setExpandState($){this.expandState=$,N(this.eExpandChecked,$===0),N(this.eExpandUnchecked,$===1),N(this.eExpandIndeterminate,$===2)}setSelectionState($){this.selectState=$,this.eSelect.setValue(this.selectState)}},rA={selector:"AG-PRIMARY-COLS-HEADER",component:sA};function PQ($){return!!$&&typeof $.children<"u"}function Dz($){return PQ($)?$.groupId:$.colId}function vX($,z,Q){let J=(Y,q)=>{let _=Y.children.map(Dz).includes(Dz(q)),H=b(Y.children),U=H&&Dz(H)!==Dz(q);return _&&U};if(!PQ($))return!0;let Z=$,X=Q;if(J(Z,X))return Z.children.push(X),!0;if(Z.groupId===z){if(!Z.children.map(Dz).includes(Dz(X)))return Z.children.push(X),!0}for(let Y=Z.children.length-1;Y>=0;Y--)if(vX(Z.children[Y],z,Q))break;return!1}function IX($){let z=(Z,X)=>{return PQ(Z)&&PQ(X)&&Dz(Z)===Dz(X)},Q=(Z,X)=>{if(!PQ(X))return Z;let Y=Z,q=X;if(q.children&&q.groupId){if(vX(Y,q.groupId,q.children[0]))return Y}for(let G of q.children)Q(Y,G);return Y},J=[];for(let Z=1;Z<=$.length;Z++){let X=$[Z-1],Y=$[Z];if(z(X,Y))$[Z]=Q(X,Y);else J.push(X)}return J}function lA($,z){let Q=[],J=(X,Y)=>{if(PQ(X)){let q=X,G=typeof q.groupId<"u"?q.groupId:q.headerName,_=new Cz(q,G,!1,Y),H=[];for(let U of q.children){let W=J(U,Y+1);if(W)H.push(W)}return _.setChildren(H),_}else{let q=X,G=q.colId?q.colId:q.field,_=$.getColDefCol(G);if(!_)Q.push(q);return _}},Z=[];for(let X of z){let Y=J(X,0);if(Y)Z.push(Y)}if(Q.length>0)j(217,{invalidColIds:Q});return Z}function aA($,z){let Q=CX(eA($)),J=IX(Q);z(J)}function oA($,z){let Q=CX($),J=IX(Q);z(J)}function CX($){let z=(Q,J)=>{let Z;if(q0(Q))if(Q.isPadding())Z=J;else{let Y=Object.assign({},Q.getColGroupDef());Y.groupId=Q.getGroupId(),Y.children=[J],Z=Y}else{let Y=Object.assign({},Q.getColDef());Y.colId=Q.getColId(),Z=Y}let X=Q.getOriginalParent();if(X)return z(X,Z);else return Z};return $.map((Q)=>z(Q,Q.getColDef()))}function eA($){return $.getCols().filter((z)=>{let Q=z.getColDef();return z.isPrimary()&&!Q.showRowGroup})}var g9=class{constructor($,z,Q,J=!1,Z){if(this.displayName=$,this.depth=Q,this.group=J,this.localEventService=new K$,J)this.columnGroup=z,this._expanded=Z,this.children=[];else this.column=z}get expanded(){return!!this._expanded}set expanded($){if($===this._expanded)return;this._expanded=$,this.localEventService.dispatchEvent({type:"expandedChanged"})}addEventListener($,z){this.localEventService.addEventListener($,z)}removeEventListener($,z){this.localEventService.removeEventListener($,z)}};function i($){return!!$?.buttons?.includes("apply")}function N0($,z){if(!i(z))return;let Q=$.sideBar?.comp.openedItem();if(!Q)return;$.sideBar?.comp.getToolPanelInstance(Q)?.refreshDeferredUi()}function bX($,z,Q,J,Z){let X=$S(z);yX($,X,Q,J,Z)}function yX($,z,Q,J,Z){if($.columnStateUpdateStrategy.getPivotMode(i(Z)))QS($,z,Q,J,Z);else zS($,z,Q,J,Z)}function $S($){let z=[],Q=(J)=>{for(let Z of J){if(!Z.passesFilter)continue;if(Z.group)Q(Z.children);else z.push(Z.column)}};return Q($),z}function zS($,z,Q,J,Z){let X=$.columnStateUpdateStrategy,Y=[];for(let q of z){if(q.getColDef().lockVisible)continue;if(X.isColumnVisibleInToolPanel(i(Z),q)!==Q)Y.push({colId:q.getId(),hide:!Q})}X.applyColumnState(i(Z),Y,J),N0($,Z)}function QS($,z,Q,J,Z){JS($,z,Q,J,Z)}function JS($,z,Q,J,Z){let X=$.columnStateUpdateStrategy,Y=[],_=Q?(H)=>{if(X.isColumnSelectedInPivotModeToolPanel(i(Z),H))return;if(H.isAllowValue()){let U=typeof H.getAggFunc()==="string"?H.getAggFunc():$.aggFuncSvc?.getDefaultAggFunc(H);Y.push({colId:H.getId(),aggFunc:U})}else if(H.isAllowRowGroup())Y.push({colId:H.getId(),rowGroup:!0});else if(H.isAllowPivot())Y.push({colId:H.getId(),pivot:!0})}:(H)=>{if(X.isColumnSelectedInPivotModeToolPanel(i(Z),H))Y.push({colId:H.getId(),pivot:!1,rowGroup:!1,aggFunc:null})};z.forEach(_),X.applyColumnState(i(Z),Y,J),N0($,Z)}function xX($,z){let{columns:Q,visibleState:J,pivotState:Z,eventType:X}=z,Y=$.columnStateUpdateStrategy,q=Y.getPivotMode(i(z)),G=Q.map((_)=>{let H=_.getColId();if(q){let U=Z?.[H];return{colId:H,pivot:U?.pivot,rowGroup:U?.rowGroup,aggFunc:U?.aggFunc}}else return{colId:H,hide:!J?.[H]}});Y.applyColumnState(i(z),G,X),N0($,z)}function ZS($){return{pivot:$.isPivotActive(),rowGroup:$.isRowGroupActive(),aggFunc:$.isValueActive()?$.getAggFunc():void 0}}function wX($,z,Q){if(!Q)return ZS($);let J=z.getRowGroupColumns(Q).includes($),Z=z.getPivotColumns(Q).includes($),X=z.getValueColumns(Q).includes($);return{pivot:Z,rowGroup:J,aggFunc:X?z.getColumnAggFunc(Q,$):void 0}}var NX=($,z)=>{if(!z)return[];let Q=$;for(let J=0,Z=z.length;J{let J=$.aggData;if(J===z)return;if($.aggData=z,$.__localEventService)XS($,J,z,Q)},h9=($,z,Q)=>{OQ($,z,Q);let J=$.pinnedSibling;if(J)OQ(J,z,Q);let Z=$.sibling;if(Z){OQ(Z,z,Q);let X=Z.pinnedSibling;if(X)OQ(X,z,Q)}},XS=($,z,Q,J)=>{if(!Q){if(!z)return;let Y=Object.keys(z);for(let q=0,G=Y.length;q{if(!$)return;let J=$.group;if(J===Q)return;if($.group=Q,$.updateHasChildren(),J&&!Q)OQ($,null,z.colModel),$.setAllChildrenCount(null);z.selectionSvc?.updateRowSelectable($),$.dispatchRowEvent("groupChanged")},gX=($,z,Q)=>{u9($,z,Q),u9($.pinnedSibling,z,Q)},T1=($,z)=>{let{gos:Q,rowGroupColsSvc:J}=z;if(!J||!$)return!1;let Z=Q.get("groupLockGroupColumns");if(!$.isRowGroupActive()||Z===0)return!1;if(Z===-1)return!0;let X=J.columns.findIndex((Y)=>Y.getColId()===$.getColId());return Z>X},O1=($,z,Q)=>{let Z=$(z,`${z==="groupBy"?"Group by":"Un-Group by"} ${Q}`,[Q]);if(Z.indexOf(Q)>=0)return Z;else return`${Z} ${Q}`};function YS($){let z=r0($),Q="getSelection"in z?z.getSelection():null,J=[];for(let Z=0;Z<(Q?.rangeCount??0);Z++){let X=Q?.getRangeAt(Z);if(X)J.push(X)}return{selection:Q,ranges:J}}function qS($,z){if(!$.gos.get("enableCellTextSelection"))return z();if(!yJ()&&!cz())return z();let{selection:J,ranges:Z}=YS($);z(),J?.removeAllRanges();for(let X of Z)J?.addRange(X)}var GS={name:"menuItem",optionalMethods:["setActive","select","setExpanded","configureDefaults"]},hX={getMenuItemComp:($,z,Q)=>{return $.userCompFactory.getCompDetails(z,GS,"agMenuItem",y($.gos,Q),!0)?.newAgStackInstance()??g.resolve()},getPostProcessPopupParams:({column:$,node:z})=>({column:$,rowNode:z}),preserveRangesWhile:qS,stopPropagationCallbacks:Uz,warnNoItem:($)=>{j(228,{menuItemOrString:$})}},_S=class extends o4{constructor(){super(hX)}},uX=class extends RX{constructor($,z={column:null,node:null,value:null}){super($,z,hX)}},mX=class extends x{constructor($,z,Q,J={}){super({tag:"div",cls:"ag-menu"});this.column=$,this.mouseEventOrTouch=z,this.parentEl=Q,this.params=J,this.displayName=null}postConstruct(){let{column:$,beans:{colNames:z}}=this;this.initializeProperties($);let Q;if(Q$($))Q=z.getDisplayNameForColumn($,"columnToolPanel");else Q=z.getDisplayNameForProvidedColumnGroup(null,$,"columnToolPanel");if(this.displayName=Q,this.buildMenuItemMap(),this.isActive()){let J=this.mouseEventOrTouch;if("preventDefault"in J)J.preventDefault();let Z=this.getMappedMenuItems();if(Z.length===0)return;this.displayContextMenu(Z)}}initializeProperties($){let z=this.beans.columnStateUpdateStrategy,Q;if(q0($))Q=$.getLeafColumns();else Q=[$];this.columns=Q;let J=z.getPivotMode(i(this.params));this.allowScrollIntoView=!J&&Q.some(this.isColumnValidForScrollIntoView),this.allowGrouping=Q.some((Z)=>Z.isPrimary()&&Z.isAllowRowGroup()),this.allowValues=Q.some((Z)=>Z.isPrimary()&&Z.isAllowValue()),this.allowPivoting=J&&Q.some((Z)=>Z.isPrimary()&&Z.isAllowPivot())}buildMenuItemMap(){let $=this.getLocaleTextFunc(),{beans:z,displayName:Q}=this,J=this.beans.columnStateUpdateStrategy,Z=new Map;this.menuItemMap=Z;let X=i(this.params),Y=J.getPivotMode(X),q=new Set(J.getRowGroupColumns(X).map((B)=>B.getColId())),G=new Set(J.getValueColumns(X).map((B)=>B.getColId())),_=new Set(J.getPivotColumns(X).map((B)=>B.getColId()));Z.set("scrollIntoView",{allowedFunction:(B)=>!B.isPinned()&&!Y&&this.isColumnValidForScrollIntoView(B),activeFunction:()=>!1,activateLabel:()=>$("scrollColumnIntoView",`Scroll ${Q} into View`,[Q]),activateFunction:()=>{let B=this.columns.find(this.isColumnValidForScrollIntoView);if(B)this.beans.ctrlsSvc.getScrollFeature().ensureColumnVisible(B)},deActivateFunction:()=>{},addIcon:"ensureColumnVisible"});let H=(B)=>B.isPrimary()&&B.isAllowRowGroup()&&!T1(B,z);Z.set("rowGroup",{allowedFunction:H,activeFunction:(B)=>q.has(B.getColId()),activateLabel:()=>O1($,"groupBy",Q),deactivateLabel:()=>O1($,"ungroupBy",Q),activateFunction:()=>{let B=this.addColumnsToList(J.getRowGroupColumns(X),H);J.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getRowGroupColumns(X),H);J.setRowGroupColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"menuAddRowGroup",removeIcon:"menuRemoveRowGroup"});let U=(B)=>B.isPrimary()&&B.isAllowValue();Z.set("value",{allowedFunction:U,activeFunction:(B)=>G.has(B.getColId()),activateLabel:()=>$("addToValues",`Add ${Q} to values`,[Q]),deactivateLabel:()=>$("removeFromValues",`Remove ${Q} from values`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(J.getValueColumns(X),U);J.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getValueColumns(X),U);J.setValueColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"valuePanel",removeIcon:"valuePanel"});let W=(B)=>Y&&B.isPrimary()&&B.isAllowPivot();Z.set("pivot",{allowedFunction:W,activeFunction:(B)=>_.has(B.getColId()),activateLabel:()=>$("addToLabels",`Add ${Q} to labels`,[Q]),deactivateLabel:()=>$("removeFromLabels",`Remove ${Q} from labels`,[Q]),activateFunction:()=>{let B=this.addColumnsToList(J.getPivotColumns(X),W);J.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},deActivateFunction:()=>{let B=this.removeColumnsFromList(J.getPivotColumns(X),W);J.setPivotColumns(X,B,"toolPanelUi"),N0(this.beans,this.params)},addIcon:"pivotPanel",removeIcon:"pivotPanel"})}isColumnValidForScrollIntoView($){if(!$.isVisible())return!1;let Q=$.getParent();if(!Q)return!0;return Q.getDisplayedChildren()?.includes($)??!0}addColumnsToList($,z){return[...$].concat(this.columns.filter((Q)=>z(Q)&&!$.includes(Q)))}removeColumnsFromList($,z){return $.filter((Q)=>!z(Q)||!this.columns.includes(Q))}displayContextMenu($){let z=this.getGui(),Q=this.createBean(new uX),J=this.getLocaleTextFunc(),Z=()=>{};z.appendChild(Q.getGui()),Q.addMenuItems($),Q.addManagedListeners(Q,{closeMenu:()=>{this.parentEl.focus(),Z()}});let X=this.beans.popupSvc,Y=X.addPopup({modal:!0,eChild:z,closeOnEsc:!0,afterGuiAttached:()=>F0(Q.getGui()),ariaLabel:J("ariaLabelContextMenu","Context Menu"),closedCallback:(q)=>{if(q instanceof KeyboardEvent)this.parentEl.focus();this.destroyBean(Q)}});if(Y)Z=Y.hideFunc;X.positionPopupUnderMouseEvent({type:"columnContextMenu",mouseEvent:this.mouseEventOrTouch,ePopup:z})}isActive(){return this.allowScrollIntoView||this.allowGrouping||this.allowValues||this.allowPivoting}getMappedMenuItems(){let $=[],{menuItemMap:z,columns:Q,displayName:J,beans:Z}=this;for(let X of z.values()){let Y=Q.some((G)=>X.allowedFunction(G)&&!X.activeFunction(G)),q=Q.some((G)=>X.allowedFunction(G)&&X.activeFunction(G));if(Y)$.push({name:X.activateLabel(J),icon:h(X.addIcon,Z,null),action:()=>X.activateFunction()});if(q&&X.removeIcon&&X.deactivateLabel)$.push({name:X.deactivateLabel(J),icon:h(X.removeIcon,Z,null),action:()=>X.deActivateFunction?.()})}return $}},HS={tag:"div",cls:"ag-column-select-column-group",children:[{tag:"span",ref:"eColumnGroupIcons",cls:"ag-column-group-icons",children:[{tag:"span",ref:"eGroupClosedIcon",cls:"ag-column-group-closed-icon"},{tag:"span",ref:"eGroupOpenedIcon",cls:"ag-column-group-opened-icon"}]},{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},cX=class extends x{constructor($,z,Q,J,Z){super();this.modelItem=$,this.allowDragging=z,this.eventType=Q,this.focusWrapper=J,this.params=Z,this.cbSelect=f,this.eLabel=f,this.eGroupOpenedIcon=f,this.eGroupClosedIcon=f,this.eColumnGroupIcons=f,this.processingColumnStateChange=!1;let{columnGroup:X,depth:Y,displayName:q}=$;this.columnGroup=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate(HS,[y$]);let{beans:$,cbSelect:z,eLabel:Q,displayName:J,columnDepth:Z,modelItem:X,focusWrapper:Y,columnGroup:q}=this,{registry:G,gos:_}=$,H=h("columnDrag",$);this.eDragHandle=H,H.classList.add("ag-drag-handle","ag-column-select-column-group-drag-handle");let U=z.getGui(),W=z.getInputElement();U.after(H),W.setAttribute("tabindex","-1"),Q.textContent=J??"",this.setupExpandContract(),this.addCss("ag-column-select-indent-"+Z),this.getGui().style.setProperty("--ag-indentation-level",String(Z)),this.tooltipFeature=this.createOptionalManagedBean(G.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumnGroup",shouldDisplayTooltip:tJ(_,()=>Q)})),this.addManagedEventListeners({columnPivotModeChanged:this.onColumnStateChanged.bind(this)}),this.addManagedElementListeners(Q,{click:this.onLabelClicked.bind(this)}),this.addManagedListeners(z,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedListeners(X,{expandedChanged:this.onExpandChanged.bind(this)});let B=new h0(this.getGui(),!1);this.addManagedListeners(B,{longTap:(K)=>this.onContextMenu(K.touchStart)}),this.addDestroyFunc(B.destroy.bind(B)),this.addManagedListeners(Y,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)}),this.setOpenClosedIcons(),this.setupDragging(),this.onColumnStateChanged(),this.addVisibilityListenersToAllChildren(),this.refreshAriaExpanded(),this.refreshAriaLabel(),this.setupTooltip();let E=hJ(q.getColGroupDef(),_,null,q);for(let K of E)this.toggleCss(K,!0)}getColumns(){return this.columnGroup.getLeafColumns()}setupTooltip(){let $=this.columnGroup.getColGroupDef();if(!$)return;let z=()=>this.tooltipFeature?.setTooltipAndRefresh($.headerTooltip);z(),this.addManagedEventListeners({newColumnsLoaded:z})}handleKeyDown($){switch($.key){case A.LEFT:$.preventDefault(),this.modelItem.expanded=!1;break;case A.RIGHT:$.preventDefault(),this.modelItem.expanded=!0;break;case A.SPACE:if($.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected());break}}onContextMenu($){let{columnGroup:z,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let J=this.createBean(new mX(z,$,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(J.isAlive())this.destroyBean(J)})}addVisibilityListenersToAllChildren(){let $=this.onColumnStateChanged.bind(this);for(let z of this.columnGroup.getLeafColumns())this.addManagedListeners(z,{visibleChanged:$,columnValueChanged:$,columnPivotChanged:$,columnRowGroupChanged:$})}setupDragging(){if(!this.allowDragging){N(this.eDragHandle,!1);return}let $=this.beans,{gos:z,eventSvc:Q,dragAndDrop:J}=$,Z=!z.get("suppressDragLeaveHidesColumns"),X={type:G$.ToolPanel,eElement:this.eDragHandle,dragItemName:this.displayName,getDefaultIconName:()=>Z?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{Z=!z.get("suppressDragLeaveHidesColumns"),Q.dispatchEvent({type:"columnPanelItemDragStart",column:this.columnGroup})},onDragStopped:()=>{Q.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(Y)=>{if(Z)xX($,{columns:this.columnGroup.getLeafColumns(),visibleState:Y?.visibleState,pivotState:Y?.pivotState,eventType:this.eventType,buttons:this.params.buttons})},onGridExit:()=>{if(Z)this.onChangeCommon(!1)}};J.addDragSource(X,!0),this.addDestroyFunc(()=>J.removeDragSource(X))}createDragItem(){let $=this.columnGroup.getLeafColumns(),z={},Q={},J=this.beans.columnStateUpdateStrategy,Z=i(this.params);for(let X of $){let Y=X.getId();z[Y]=X.isVisible(),Q[Y]=wX(X,J,Z)}return{columns:$,visibleState:z,pivotState:Q}}setupExpandContract(){let{beans:$,eGroupClosedIcon:z,eGroupOpenedIcon:Q,eColumnGroupIcons:J}=this;z.appendChild(uJ("columnSelectClosed",$,null)),Q.appendChild(uJ("columnSelectOpen",$,null));let Z=this.onExpandOrContractClicked.bind(this);this.addManagedElementListeners(z,{click:Z}),this.addManagedElementListeners(Q,{click:Z});let X=new h0(J,!0);this.addManagedListeners(X,{tap:Z}),this.addDestroyFunc(X.destroy.bind(X))}onLabelClicked(){let $=!this.cbSelect.getValue();this.onChangeCommon($)}onCheckboxChanged($){this.onChangeCommon($.selected)}getVisibleLeafColumns(){let $=[],z=(Q)=>{for(let J of Q)if(J.passesFilter)if(J.group)z(J.children);else $.push(J.column)};return z(this.modelItem.children),$}onChangeCommon($){if(this.refreshAriaLabel(),this.processingColumnStateChange)return;bX(this.beans,this.modelItem.children,$,this.eventType,this.params)}refreshAriaLabel(){let{cbSelect:$,focusWrapper:z,displayName:Q}=this,J=this.getLocaleTextFunc(),Z=J("ariaColumnGroup","Column Group"),X=$.getValue(),Y=X===void 0?J("ariaIndeterminate","indeterminate"):X?J("ariaVisible","visible"):J("ariaHidden","hidden"),q=J("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${Q} ${Z}`),$.setInputAriaLabel(`${q} (${Y})`),MJ(z,$.getInputElement().id)}onColumnStateChanged(){let $=this.workOutSelectedValue(),z=this.workOutReadOnlyValue();this.processingColumnStateChange=!0;let Q=this.cbSelect;Q.setValue($),Q.setReadOnly(z),this.toggleCss("ag-column-select-column-group-readonly",z),this.processingColumnStateChange=!1}workOutSelectedValue(){let z=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),Q=this.getVisibleLeafColumns(),J=0,Z=0;for(let X of Q)if(z||!X.getColDef().lockVisible)if(this.isColumnChecked(X))J++;else Z++;if(J>0&&Z>0)return;return J>0}workOutReadOnlyValue(){let $=this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params)),z=0;for(let Q of this.columnGroup.getLeafColumns())if($){if(Q.isAnyFunctionAllowed())z++}else if(!Q.getColDef().lockVisible)z++;return z===0}isColumnChecked($){let z=this.beans.columnStateUpdateStrategy;if(z.getPivotMode(i(this.params)))return z.isColumnSelectedInPivotModeToolPanel(i(this.params),$);return z.isColumnVisibleInToolPanel(i(this.params),$)}onExpandOrContractClicked(){let $=this.modelItem,z=$.expanded;$.expanded=!z}onExpandChanged(){this.setOpenClosedIcons(),this.refreshAriaExpanded()}setOpenClosedIcons(){let $=this.modelItem.expanded;N(this.eGroupClosedIcon,!$),N(this.eGroupOpenedIcon,$)}refreshAriaExpanded(){w0(this.focusWrapper,this.modelItem.expanded)}getDisplayName(){return this.displayName}onSelectAllChanged($){let z=this.cbSelect,Q=z.getValue();if(!z.isReadOnly()&&($&&!Q||!$&&Q))z.toggle()}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}setSelected($){this.cbSelect.setValue($,!0)}},p4=($)=>{if(q0($))return $.getLeafColumns();return $?[$]:[]},US=($,z,Q,J)=>{if(!z||!$)return null;let Z=J.indexOf(z),X=Q?Z:Z+1,Y=WS(J,$,X);return X-Y},WS=($,z,Q)=>{if(!z)return 0;let J=z[0],Z=z.length;if($.indexOf(J){let Z=i(J);if($.get("suppressMovableColumns")||z.columnStateUpdateStrategy.getPivotMode(Z))return!0;return!!Q.find(({colDef:q})=>!!q.suppressMovable||!!q.lockPosition)},c9=($,z,Q,J)=>{if(!Q)return;let{component:Z}=Q,X=null,Y=Q.position==="top";if(Z instanceof cX)X=Z.getColumns()[0],Y=!0;else if(Z)X=Z.column;if(!X)return;let q=i(J),G=q?$.columnStateUpdateStrategy.getPrimaryColumns(q):$.colModel.getCols(),_=US(z,X,Y,G);if(_!=null)$.columnStateUpdateStrategy.moveColumns(q,z,_,"toolPanelUi"),N0($,J)},BS=($)=>{return $.column},ES={tag:"div",cls:"ag-column-select-column",children:[{tag:"ag-checkbox",ref:"cbSelect",cls:"ag-column-select-checkbox"},{tag:"span",ref:"eLabel",cls:"ag-column-select-column-label"}]},KS=class extends x{constructor($,z,Q,J,Z){super();this.modelItem=$,this.allowDragging=z,this.groupsExist=Q,this.focusWrapper=J,this.params=Z,this.eLabel=f,this.cbSelect=f,this.processingColumnStateChange=!1;let{column:X,depth:Y,displayName:q}=$;this.column=X,this.columnDepth=Y,this.displayName=q}postConstruct(){this.setTemplate(ES,[y$]);let{beans:$,cbSelect:z,displayName:Q,eLabel:J,columnDepth:Z,groupsExist:X,column:Y,gos:q,focusWrapper:G}=this,_=h("columnDrag",$);this.eDragHandle=_,_.classList.add("ag-drag-handle","ag-column-select-column-drag-handle");let H=z.getGui(),U=z.getInputElement();if(H.after(_),U.setAttribute("tabindex","-1"),J.textContent=Q,X)this.addCss("ag-column-select-add-group-indent");this.addCss(`ag-column-select-indent-${Z}`),this.getGui().style.setProperty("--ag-indentation-level",String(Z)),this.tooltipFeature=this.createOptionalManagedBean($.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.focusWrapper,getLocation:()=>"columnToolPanelColumn",shouldDisplayTooltip:tJ(q,()=>J),getAdditionalParams:()=>({colDef:Y.getColDef()})})),this.setupDragging();let W=this.onColumnStateChanged.bind(this);this.addManagedEventListeners({columnPivotModeChanged:W}),this.addManagedListeners(Y,{columnValueChanged:W,columnPivotChanged:W,columnRowGroupChanged:W,visibleChanged:W}),this.addManagedListeners(G,{keydown:this.handleKeyDown.bind(this),contextmenu:this.onContextMenu.bind(this)});let B=new h0(G);this.addManagedListeners(B,{longTap:(K)=>this.onContextMenu(K.touchStart)}),this.addDestroyFunc(B.destroy.bind(B)),this.addManagedPropertyListener("functionsReadOnly",this.onColumnStateChanged.bind(this)),this.addManagedListeners(z,{fieldValueChanged:this.onCheckboxChanged.bind(this)}),this.addManagedElementListeners(J,{click:this.onLabelClicked.bind(this)}),this.onColumnStateChanged(),this.refreshAriaLabel(),this.setupTooltip();let E=hJ(Y.getColDef(),q,Y,null);for(let K of E)this.toggleCss(K,!0)}getColumn(){return this.column}setupTooltip(){let $=()=>this.tooltipFeature?.setTooltipAndRefresh(this.column.getColDef().headerTooltip);$(),this.addManagedEventListeners({newColumnsLoaded:$})}onContextMenu($){let{column:z,gos:Q}=this;if(Q.get("functionsReadOnly"))return;let J=this.createBean(new mX(z,$,this.focusWrapper,this.params));this.addDestroyFunc(()=>{if(J.isAlive())this.destroyBean(J)})}handleKeyDown($){if($.key===A.SPACE){if($.preventDefault(),this.isSelectable())this.onSelectAllChanged(!this.isSelected())}}onLabelClicked(){if(this.gos.get("functionsReadOnly"))return;let $=!this.cbSelect.getValue();this.onChangeCommon($)}onCheckboxChanged($){this.onChangeCommon($.selected)}onChangeCommon($){if(this.cbSelect.isReadOnly())return;if(this.refreshAriaLabel(),this.processingColumnStateChange)return;yX(this.beans,[this.column],$,"toolPanelUi",this.params)}refreshAriaLabel(){let{cbSelect:$,focusWrapper:z,displayName:Q}=this,J=this.getLocaleTextFunc(),Z=J("ariaColumn","Column"),X=$.getValue()?J("ariaVisible","visible"):J("ariaHidden","hidden"),Y=J("ariaToggleVisibility","Press SPACE to toggle visibility");E0(z,`${Q} ${Z}`),this.cbSelect.setInputAriaLabel(`${Y} (${X})`),MJ(z,$.getInputElement().id)}setupDragging(){let $=this.eDragHandle;if(!this.allowDragging){N($,!1);return}let z=this.beans,{gos:Q,eventSvc:J,dragAndDrop:Z}=z;if(i(this.params))$.setAttribute("data-column-tool-panel-deferred","");let X=!Q.get("suppressDragLeaveHidesColumns"),Y={type:G$.ToolPanel,eElement:$,dragItemName:this.displayName,getDefaultIconName:()=>X&&!i(this.params)?"hide":"notAllowed",getDragItem:()=>this.createDragItem(),onDragStarted:()=>{X=!Q.get("suppressDragLeaveHidesColumns"),J.dispatchEvent({type:"columnPanelItemDragStart",column:this.column})},onDragStopped:()=>{J.dispatchEvent({type:"columnPanelItemDragEnd"})},onGridEnter:(q)=>{if(X&&!i(this.params))xX(z,{columns:[this.column],visibleState:q?.visibleState,pivotState:q?.pivotState,eventType:"toolPanelUi",buttons:this.params.buttons})},onGridExit:()=>{if(X&&!i(this.params))this.onChangeCommon(!1)}};Z.addDragSource(Y,!0),this.addDestroyFunc(()=>Z.removeDragSource(Y))}createDragItem(){let $=this.column.getColId(),z={[$]:this.column.isVisible()},Q=this.beans.columnStateUpdateStrategy,J={[$]:wX(this.column,Q,i(this.params))};return{columns:[this.column],visibleState:z,pivotState:J}}onColumnStateChanged(){this.processingColumnStateChange=!0;let $=this.beans.columnStateUpdateStrategy,z=$.getPivotMode(i(this.params));if(z){let Z=$.isColumnSelectedInPivotModeToolPanel(i(this.params),this.column);this.cbSelect.setValue(Z)}else this.cbSelect.setValue($.isColumnVisibleInToolPanel(i(this.params),this.column));let Q=!0,J=!0;if(z){let Z=this.gos.get("functionsReadOnly"),X=!this.column.isAnyFunctionAllowed();Q=!Z&&!X,J=Q}else{let{enableRowGroup:Z,enableValue:X,lockPosition:Y,suppressMovable:q,lockVisible:G}=this.column.getColDef(),_=!!Z||!!X,H=!!Y||!!q;Q=!G,J=_||!H}this.cbSelect.setReadOnly(!Q),this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!J),this.toggleCss("ag-column-select-column-readonly",!J&&!Q),this.cbSelect.setPassive(!1),this.processingColumnStateChange=!1}getDisplayName(){return this.displayName}onSelectAllChanged($){let z=this.cbSelect;if($!==z.getValue()){if(!z.isReadOnly())z.toggle()}}isSelected(){return this.cbSelect.getValue()}isSelectable(){return!this.cbSelect.isReadOnly()}isExpandable(){return!1}setExpanded($){j(158)}},LS=class{constructor($){this.items=$}getRowCount(){return this.items.length}getRow($){return this.items[$]}},DS="ag-column-select-list",FS=class extends x{constructor(){super({tag:"div",cls:DS,role:"presentation"});this.destroyColumnItemFuncs=[],this.hasLoadedInitialState=!1,this.isInitialState=!1,this.skipRefocus=!1}wireBeans($){this.colModel=$.colModel}destroy(){this.destroyColumnTree(),super.destroy()}destroyColumnTree(){this.allColsTree=[];for(let $ of this.destroyColumnItemFuncs)$();this.destroyColumnItemFuncs=[]}init($,z,Q){this.params=$;let{suppressSyncLayoutWithGrid:J,contractColumnSelection:Z,suppressColumnMove:X}=$;if(this.allowDragging=z,this.eventType=Q,!J)this.addManagedEventListeners({columnMoved:this.onColumnsChanged.bind(this)});this.addManagedEventListeners({newColumnsLoaded:this.onColumnsChanged.bind(this)});let Y=this.fireSelectionChangedEvent.bind(this);this.addManagedEventListeners({columnPivotChanged:Y,columnPivotModeChanged:Y,columnRowGroupChanged:Y,columnValueChanged:Y,columnVisible:Y,newColumnsLoaded:Y}),this.expandGroupsByDefault=!Z;let q=X||J,G=this.createManagedBean(new fX({cssIdentifier:"column-select",ariaRole:"tree",moveItemCallback:(_,H)=>{if(q)return;this.moveItems(_,H)}}));if(this.virtualList=G,this.appendChild(G.getGui()),G.setComponentCreator((_,H)=>{return f6(H,_.depth+1),this.createComponentFromItem(_,H)}),this.colModel.ready)this.onColumnsChanged();if(q)return;this.createItemDragFeature()}createItemDragFeature(){let{gos:$,beans:z,virtualList:Q}=this;this.createManagedBean(new KA(this,Q,{dragSourceType:G$.ToolPanel,addListeners:(J,Z,X)=>{J.addManagedEventListeners({columnPanelItemDragStart:Z,columnPanelItemDragEnd:X})},getCurrentDragValue:(J)=>BS(J),isMoveBlocked:(J)=>m9($,z,p4(J),this.params),getNumRows:(J)=>J.getDisplayedColsList().length,moveItem:(J,Z)=>c9(z,p4(J),Z,this.params)}))}moveItems($,z){let{gos:Q,beans:J}=this,{modelItem:Z}=$,{group:X,columnGroup:Y,column:q,expanded:G}=Z,_=p4(X?Y:q);if(m9(Q,J,_,this.params))return;let H=this.displayedColsList.indexOf(Z),U=z?-1:1,W=0;if(z){let E=$.columnDepth>0?q.getParent()?.getChildren():null;if(E?.length&&q===E[0])W=-1}else if(X)W=G?Z.children.length:0;let B=Math.min(Math.max(H+W+U,0),this.displayedColsList.length-1);this.skipRefocus=!0,c9(J,_,{rowIndex:B,position:z?"top":"bottom",component:this.virtualList.getComponentAt(B)},this.params),this.focusRowIfAlive(B-W).then(()=>{this.skipRefocus=!1})}createComponentFromItem($,z){let Q=this.allowDragging;if($.group){let Z=new cX($,Q,this.eventType,z,this.params);return this.createBean(Z),Z}let J=new KS($,Q,this.groupsExist,z,this.params);return this.createBean(J),J}onColumnsChanged(){let $=this.params;if(!this.hasLoadedInitialState)this.hasLoadedInitialState=!0,this.isInitialState=!!$.initialState;let z=this.getExpandedStates(),Q=this.colModel.isPivotMode(),J=i($),Z=J&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder(J);if((!$.suppressSyncLayoutWithGrid||J)&&!Q||Z)this.buildTreeFromWhatGridIsDisplaying();else this.buildTreeFromProvidedColumnDefs();this.setExpandedStates(z),this.markFilteredColumns(),this.flattenAndFilterModel(),this.isInitialState=!1}getDisplayedColsList(){return this.displayedColsList}getExpandedStates(){let $={};if(this.isInitialState){let{expandedGroupIds:z}=this.params.initialState;for(let Q of z)$[Q]=!0;return $}if(!this.allColsTree)return{};return this.forEachItem((z)=>{if(!z.group)return;let Q=z.columnGroup;if(Q)$[Q.getId()]=z.expanded}),$}setExpandedStates($){if(!this.allColsTree)return;let{isInitialState:z}=this;this.forEachItem((Q)=>{if(!Q.group)return;let J=Q.columnGroup;if(J){let Z=$[J.getId()];if(Z!=null||z)Q.expanded=!!Z}})}buildTreeFromWhatGridIsDisplaying(){let $=i(this.params);if($&&this.beans.columnStateUpdateStrategy.hasDeferredColumnOrder($)){let z=this.beans.columnStateUpdateStrategy.getPrimaryColumns($);if(z.length>0){oA(z,this.setColumnLayout.bind(this));return}}if(this.params.suppressSyncLayoutWithGrid){this.buildTreeFromProvidedColumnDefs();return}aA(this.colModel,this.setColumnLayout.bind(this))}setColumnLayout($){let z=lA(this.colModel,$);this.buildListModel(z),this.groupsExist=$.some((Q)=>{return Q&&typeof Q.children<"u"}),this.markFilteredColumns(),this.flattenAndFilterModel()}buildTreeFromProvidedColumnDefs(){let $=this.colModel;this.buildListModel($.getColDefColTree()),this.groupsExist=!!$.colDefCols?.treeDepth}buildListModel($){let z=this.onColumnExpanded.bind(this),Q=(q)=>{q.addEventListener("expandedChanged",z);let G=q.removeEventListener.bind(q,"expandedChanged",z);this.destroyColumnItemFuncs.push(G)},J=this.beans.colNames,Z=(q,G,_)=>{for(let H of q)if(q0(H))X(H,G,_);else Y(H,G,_)},X=(q,G,_)=>{if(q.getColGroupDef()?.suppressColumnsToolPanel)return;if(q.isPadding()){Z(q.getChildren(),G,_);return}let W=J.getDisplayNameForProvidedColumnGroup(null,q,"columnToolPanel"),B=new g9(W,q,G,!0,this.expandGroupsByDefault);_.push(B),Q(B),Z(q.getChildren(),G+1,B.children)},Y=(q,G,_)=>{if(q.getColDef()?.suppressColumnsToolPanel)return;let U=J.getDisplayNameForColumn(q,"columnToolPanel");_.push(new g9(U,q,G))};this.destroyColumnTree(),Z($,0,this.allColsTree)}onColumnExpanded(){this.flattenAndFilterModel()}flattenAndFilterModel(){this.displayedColsList=[];let $=(J)=>{if(!J.passesFilter)return;if(this.displayedColsList.push(J),J.group&&J.expanded)J.children.forEach($)},z=this.virtualList;this.allColsTree.forEach($),z.setModel(new LS(this.displayedColsList));let Q=null;if(!this.skipRefocus)Q=z.getLastFocusedRow();if(z.refresh(),Q!=null)this.focusRowIfAlive(Q);this.notifyListeners(),this.refreshAriaLabel()}refreshAriaLabel(){let $=this.getLocaleTextFunc(),z=$("ariaColumnPanelList","Column List"),Q=$("columns","Columns"),J=this.displayedColsList.length;E0(this.virtualList.getAriaElement(),`${z} ${J} ${Q}`)}focusRowIfAlive($){if($===-1)return Promise.resolve();return new Promise((z)=>{window.setTimeout(()=>{if(this.isAlive())this.virtualList.focusRow($);z()},0)})}forEachItem($){let z=(J)=>{for(let Z of J)if($(Z),Z.group)z(Z.children)},Q=this.allColsTree;if(!Q)return;z(Q)}doSetExpandedAll($){this.forEachItem((z)=>{if(z.group)z.expanded=$})}setGroupsExpanded($,z){if(!z){this.doSetExpandedAll($);return}let Q=[];this.forEachItem((Z)=>{if(!Z.group)return;let X=Z.columnGroup.getId();if(z.indexOf(X)>=0)Z.expanded=$,Q.push(X)});let J=z.filter((Z)=>!Q.includes(Z));if(J.length>0)j(157,{unrecognisedGroupIds:J})}getExpandState(){let $=0,z=0;if(this.forEachItem((Q)=>{if(!Q.group)return;if(Q.expanded)$++;else z++}),$>0&&z>0)return 2;if(z>0)return 1;return 0}doSetSelectedAll($){bX(this.beans,this.allColsTree,$,this.eventType,this.params),this.syncVisibleSelectionState(),this.fireSelectionChangedEvent()}syncVisibleSelectionState(){for(let $=0;${if(Z.group)return;if(!Z.passesFilter)return;let X=Z.column,Y=X.getColDef(),q;if(J){if(!X.isAllowPivot()&&!X.isAllowRowGroup()&&!X.isAllowValue())return;q=Q.isColumnSelectedInPivotModeToolPanel(i(this.params),X)??!1}else{if(Y.lockVisible)return;q=Q.isColumnVisibleInToolPanel(i(this.params),X)??!1}if(q)$++;else z++}),$>0&&z>0)return;return!($===0||z>0)}setFilterText($){this.filterText=T($)?$.toLowerCase():null,this.markFilteredColumns(),this.flattenAndFilterModel()}markFilteredColumns(){let $=(Q)=>{if(!T(this.filterText))return!0;let J=Q.displayName;return J==null||J.toLowerCase().indexOf(this.filterText)!==-1},z=(Q,J)=>{let Z=!1;if(Q.group){let Y=$(Q);for(let q of Q.children){let G=z(q,Y||J);if(G)Z=G}}let X=J||Z?!0:$(Q);return Q.passesFilter=X,X};for(let Q of this.allColsTree)z(Q,!1)}notifyListeners(){this.fireGroupExpandedEvent(),this.fireSelectionChangedEvent()}fireGroupExpandedEvent(){let $=this.getExpandState();this.dispatchLocalEvent({type:"groupExpanded",state:$})}fireSelectionChangedEvent(){if(!this.allColsTree)return;let $=this.getSelectionState();this.dispatchLocalEvent({type:"selectionChanged",state:$})}getExpandedGroups(){let $=[];if(!this.allColsTree)return $;return this.forEachItem((z)=>{if(z.group&&z.expanded)$.push(z.columnGroup.getId())}),$}},MS={selector:"AG-PRIMARY-COLS-LIST",component:FS},kS={tag:"div",cls:"ag-column-select",children:[{tag:"ag-primary-cols-header",ref:"primaryColsHeaderPanel"},{tag:"ag-primary-cols-list",ref:"primaryColsListPanel"}]},pX=class extends x{constructor(){super(kS,[rA,MS]);this.primaryColsHeaderPanel=f,this.primaryColsListPanel=f,this.registerCSS(nA)}init($,z,Q){let{primaryColsHeaderPanel:J,primaryColsListPanel:Z}=this;J.init(z);let{suppressColumnFilter:X,suppressColumnSelectAll:Y}=z;if(z.suppressColumnExpandAll&&X&&Y)J.setDisplayed(!1);this.addManagedListeners(Z,{groupExpanded:(G)=>{J.setExpandState(G.state),z.onStateUpdated()},selectionChanged:(G)=>J.setSelectionState(G.state)}),Z.init(z,$,Q),this.addManagedListeners(J,{expandAll:Z.doSetExpandedAll.bind(Z,!0),collapseAll:Z.doSetExpandedAll.bind(Z,!1),selectAll:Z.doSetSelectedAll.bind(Z,!0),unselectAll:Z.doSetSelectedAll.bind(Z,!1),filterChanged:(G)=>Z.setFilterText(G.filterText)}),this.positionableFeature=this.createManagedBean(new U1(this.getGui(),{minHeight:100}))}toggleResizable($){this.positionableFeature.setResizable($?{bottom:!0}:!1)}expandGroups($){this.primaryColsListPanel.setGroupsExpanded(!0,$)}collapseGroups($){this.primaryColsListPanel.setGroupsExpanded(!1,$)}setColumnLayout($){this.primaryColsListPanel.setColumnLayout($)}syncLayoutWithGrid(){this.primaryColsListPanel.onColumnsChanged()}getExpandedGroups(){return this.primaryColsListPanel.getExpandedGroups()}},VS=".ag-column-panel{display:flex;flex:1 1 auto;flex-direction:column;overflow:hidden}.ag-pivot-mode-panel{display:flex;height:var(--ag-header-height)}.ag-pivot-mode-select{align-items:center;display:flex}:where(.ag-ltr) .ag-pivot-mode-select{margin-left:var(--ag-widget-container-horizontal-padding)}:where(.ag-rtl) .ag-pivot-mode-select{margin-right:var(--ag-widget-container-horizontal-padding)}.ag-column-panel-column-select:where(:not(.ag-last-visible-child)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-column-select:where(:nth-child(n+2 of :not(.ag-hidden))){border-top:var(--ag-tool-panel-separator-border)}:where(.ag-column-panel) .ag-column-drop-vertical{flex:1 1 0px;min-height:50px}:where(.ag-column-panel) .ag-column-drop-vertical:where(:not(.ag-last-column-drop)){border-bottom:var(--ag-tool-panel-separator-border)}.ag-column-panel-buttons{display:flex;flex-wrap:wrap;gap:var(--ag-widget-vertical-spacing) var(--ag-widget-horizontal-spacing);justify-content:flex-end;overflow:hidden;padding:var(--ag-widget-container-vertical-padding) var(--ag-widget-container-horizontal-padding) 0;:where(.ag-standard-button){transition:background-color .25s ease-in-out,color .25s ease-in-out}}.ag-column-panel-buttons:where(:last-child){padding-bottom:var(--ag-widget-container-vertical-padding)}.ag-column-panel-buttons-button{line-height:1.5}:where(.ag-column-panel) .ag-column-panel-buttons-apply-button:not(:disabled){background-color:var(--ag-column-panel-apply-button-background-color);color:var(--ag-column-panel-apply-button-color)}",AS="ag-column-panel-deferred",SS=class extends x{constructor(){super({tag:"div",cls:"ag-column-panel"});this.initialised=!1,this.childDestroyFuncs=[],this.isDeferModeEnabled=!1,this.isCommitting=!1,this.onDeferredApply=()=>{this.isCommitting=!0;try{this.beans.columnStateUpdateStrategy.commit(this.isDeferModeEnabled)}finally{this.isCommitting=!1}this.deferredButtonsComp?.updateValidity(!1),this.lastKnownGridState=this.captureGridState()},this.onDeferredCancel=()=>{this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy(),this.lastKnownGridState=this.captureGridState()},this.onPivotModePanelValueChanged=()=>{this.refreshToolPanelLayouts(),this.setLastVisible(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))},this.onColumnEverythingChanged=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;let $=this.captureGridState();if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled)){this.lastKnownGridState=$;return}let z=this.lastKnownGridState&&this.isGridStateEqual(this.lastKnownGridState,$);if(this.lastKnownGridState=$,!z)return;this.resetDeferredState()},this.onExternalGridChange=()=>{if(!this.isDeferModeEnabled||this.isCommitting)return;if(!this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))return;this.resetDeferredState(),this.lastKnownGridState=this.captureGridState()},this.registerCSS(VS)}wireBeans($){this.colToolPanelFactory=$.colToolPanelFactory}setVisible($){if(super.setDisplayed($),$&&!this.initialised)this.init(this.params)}init($){let Q={...y(this.gos,{suppressColumnMove:!1,suppressColumnSelectAll:!1,suppressColumnFilter:!1,suppressColumnExpandAll:!1,contractColumnSelection:!1,suppressPivotMode:!1,suppressRowGroups:!1,suppressValues:!1,suppressPivots:!1,suppressSyncLayoutWithGrid:!1}),...$};this.params=Q;let{childDestroyFuncs:J,colToolPanelFactory:Z,gos:X}=this,Y=X.isModuleRegistered("SharedPivot"),q=Y||X.isModuleRegistered("SharedRowGrouping");if(this.isDeferModeEnabled=i(Q),this.toggleCss(AS,this.isDeferModeEnabled),!Q.suppressPivotMode&&Z&&Y)this.pivotModePanel=Z.createPivotModePanel(this,J,Q,this.onPivotModePanelValueChanged);let G=this.createBean(new pX);if(this.primaryColsPanel=G,J.push(()=>this.destroyBean(this.primaryColsPanel)),G.init(!0,Q,"toolPanelUi"),G.addCss("ag-column-panel-column-select"),this.appendChild(G),Z){if(!Q.suppressRowGroups&&q)this.rowGroupDropZonePanel=Z.createRowGroupPanel(this,J,Q);if(!Q.suppressValues&&q)this.valuesDropZonePanel=Z.createValuesPanel(this,J,Q);if(!Q.suppressPivots&&Y)this.pivotDropZonePanel=Z.createPivotPanel(this,J,Q);this.setLastVisible();let[_]=this.addManagedEventListeners({columnPivotModeChanged:()=>{this.resetChildrenHeight(),this.setLastVisible()}});J.push(()=>_())}if(this.isDeferModeEnabled){let _=this.onExternalGridChange;J.push(...this.addManagedEventListeners({columnEverythingChanged:this.onColumnEverythingChanged,sortChanged:_,columnVisible:_,columnRowGroupChanged:_,columnValueChanged:_,columnPivotChanged:_,columnPivotModeChanged:_,newColumnsLoaded:_,...Q.suppressSyncLayoutWithGrid?{}:{columnMoved:_}}))}if(Q.buttons){if(!Q.buttons.includes("apply"))j(298);if(Q.buttons.length)this.initDeferredButtons(Q.buttons)}this.initialised=!0}initDeferredButtons($){let z=this.createBean(new y4({className:"ag-column-panel-buttons"}));this.deferredButtonsComp=z,this.childDestroyFuncs.push(()=>{this.deferredButtonsComp=this.destroyBean(this.deferredButtonsComp)});let Q=this.getLocaleTextFunc(),J=$.map((Z)=>({type:Z,label:Q(Z==="apply"?"applyColumnToolPanel":"cancelColumnToolPanel",Z==="apply"?"Apply":"Cancel")}));z.updateButtons(J),z.updateValidity(!1),z.addManagedListeners(z,{apply:this.onDeferredApply,cancel:this.onDeferredCancel}),this.appendChild(z)}resetDeferredState(){this.beans.columnStateUpdateStrategy.reset(this.isDeferModeEnabled),this.deferredButtonsComp?.updateValidity(!1),this.refreshToolPanelLayouts(),this.pivotModePanel?.refreshEditStrategy()}captureGridState(){let{beans:$}=this,z=(Q)=>(Q??[]).map((J)=>J.getColId());return{rowGroupColIds:z($.rowGroupColsSvc?.columns),valueColIds:z($.valueColsSvc?.columns),pivotColIds:z($.pivotColsSvc?.columns),pivotMode:$.colModel.isPivotMode(),columnOrder:$.colModel.getCols().map((Q)=>Q.getColId()),visibleColIds:$.colModel.getCols().filter((Q)=>Q.isVisible()).map((Q)=>Q.getColId()),sortState:$.colModel.getCols().filter((Q)=>Q.getSort()).map((Q)=>`${Q.getColId()}:${Q.getSort()}:${Q.getSortIndex()}`),aggFuncState:($.valueColsSvc?.columns??[]).map((Q)=>Q.getAggFunc()),widthState:$.colModel.getCols().map((Q)=>`${Q.getColId()}:${Q.getActualWidth()}`)}}isGridStateEqual($,z){return X0($.rowGroupColIds,z.rowGroupColIds)&&X0($.valueColIds,z.valueColIds)&&X0($.pivotColIds,z.pivotColIds)&&$.pivotMode===z.pivotMode&&X0($.columnOrder,z.columnOrder)&&X0($.visibleColIds,z.visibleColIds)&&X0($.sortState,z.sortState)&&X0($.aggFuncState,z.aggFuncState)&&X0($.widthState,z.widthState)}refreshDeferredUi(){this.refreshToolPanelLayouts(),this.setLastVisible(),this.pivotModePanel?.refreshEditStrategy(),this.deferredButtonsComp?.updateValidity(this.beans.columnStateUpdateStrategy.hasPendingChanges(this.isDeferModeEnabled))}refreshToolPanelLayouts(){this.primaryColsPanel.syncLayoutWithGrid(),this.rowGroupDropZonePanel?.refreshGui(),this.valuesDropZonePanel?.refreshGui(),this.pivotDropZonePanel?.refresh()}setPivotModeSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.pivotModePanel=z.setPanelVisible(this.pivotModePanel,$,z.createPivotModePanel.bind(z,this,this.childDestroyFuncs,this.params,this.onPivotModePanelValueChanged,!0)),this.setLastVisible()}setRowGroupsSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.rowGroupDropZonePanel=z.setPanelVisible(this.rowGroupDropZonePanel,$,z.createRowGroupPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setValuesSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.valuesDropZonePanel=z.setPanelVisible(this.valuesDropZonePanel,$,z.createValuesPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.setLastVisible()}setPivotSectionVisible($){let z=this.colToolPanelFactory;if(!z)return;this.pivotDropZonePanel=z.setPanelVisible(this.pivotDropZonePanel,$,z.createPivotPanel.bind(z,this,this.childDestroyFuncs,this.params)),this.pivotDropZonePanel?.setDisplayed($),this.setLastVisible()}setResizers(){for(let $ of[this.primaryColsPanel,this.rowGroupDropZonePanel,this.valuesDropZonePanel,this.pivotDropZonePanel]){if(!$)continue;let z=$.getGui();$.toggleResizable(!z.classList.contains("ag-last-column-drop")&&!z.classList.contains("ag-hidden")&&!z.classList.contains("ag-last-visible-child"))}}setLastVisible(){let $=this.getGui(),z=Array.prototype.slice.call($.querySelectorAll(".ag-column-drop"));for(let Z of z)Z.classList.remove("ag-last-column-drop");let Q=$.querySelectorAll(".ag-column-drop:not(.ag-hidden)"),J=b(Q);if(J)J.classList.add("ag-last-column-drop");this.primaryColsPanel.getGui().classList.toggle("ag-last-visible-child",!J),this.setResizers()}resetChildrenHeight(){let z=this.getGui().children;for(let Q=0;QX.getGui().getBoundingClientRect()),Z=J.findIndex((X)=>this.horizontal?X.right>Q&&X.leftQ);if(Z===-1){let X=this.gos.get("enableRtl");if(J.every((G)=>Q>(this.horizontal?G.right:G.bottom)))return X&&this.horizontal?0:this.childPillComponents.length;if(J.every((G)=>Q<(this.horizontal?G.left:G.top)))return X&&this.horizontal?this.childPillComponents.length:0;return this.insertIndex}if(this.insertIndex<=Z)return Z+1;return Z}checkDragStartedBySelf($){if(this.state!=="notDragging")return;this.state="rearrangeItems",this.potentialDndItems=this.getItems($.dragSource.getDragItem()),this.refreshGui(),this.checkInsertIndex($),this.refreshGui()}onDragging($){if(this.checkDragStartedBySelf($),this.checkInsertIndex($))this.refreshGui()}handleDragEnterEnd($){}onDragEnter($){let z=this.getItems($.dragSource.getDragItem());this.state="newItemsIn";let Q=z.filter((Z)=>this.isItemDroppable(Z,$)),J=Q.every((Z)=>this.childPillComponents.map((X)=>X.getItem()).indexOf(Z)!==-1);if(Q.length===0)return;if(this.potentialDndItems=Q,J){this.state="notDragging";return}this.handleDragEnterEnd($),this.checkInsertIndex($),this.refreshGui()}isPotentialDndItems(){return!!this.potentialDndItems?.length}handleDragLeaveEnd($){}onDragLeave($){if(this.state==="rearrangeItems"){let z=this.getItems($.dragSource.getDragItem());this.removeItems(z)}if(this.isPotentialDndItems())this.handleDragLeaveEnd($),this.potentialDndItems=[],this.refreshGui();this.state="notDragging"}onDragCancel($){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.handleDragLeaveEnd($);this.potentialDndItems=[],this.refreshGui()}this.state="notDragging"}onDragStop(){if(this.isPotentialDndItems()){if(this.state==="newItemsIn")this.addItems(this.potentialDndItems);else this.rearrangeItems(this.potentialDndItems);this.potentialDndItems=[],this.refreshGui()}this.state="notDragging"}removeItems($){let z=this.getExistingItems().filter((Q)=>!$.includes(Q));this.updateItems(z),this.refreshGui()}addItems($){if(!$)return;let z=this.getExistingItems().slice(),Q=$.filter((J)=>z.indexOf(J)<0);p9(z,Q,this.insertIndex),this.updateItems(z),this.refreshGui()}addItem($){this.insertIndex=this.getExistingItems().length,this.addItems([$])}rearrangeItems($,z){let Q;if(!z)Q=this.getNonGhostItems().slice();else Q=this.getExistingItems().filter((J)=>$.indexOf(J)===-1);if(p9(Q,$,this.insertIndex),X0(Q,this.getExistingItems()))return!1;return this.updateItems(Q),this.refreshGui(),!0}refreshGui(){let $=0;if(!this.horizontal)$=this.ePillDropList.scrollTop;let z=this.resizeEnabled,Q=this.getFocusedItem(),{eGridDiv:J}=this.beans,Z=VQ(),X=null;if(Z)X=j0(this.beans,J)??j0(this.beans,J,!1,!0);if(this.toggleResizable(!1),this.destroyGui(),this.addIconAndTitleToGui(),this.addEmptyMessageToGui(),this.addItemsToGui(),$!==0)this.ePillDropList.scrollTop=$;if(z)this.toggleResizable(z);if(Z)this.restoreFocus(Q,X)}getFocusedItem(){let $=this.getGui(),z=d(this.beans);if(!$.contains(z))return-1;return Array.from($.querySelectorAll(".ag-column-drop-cell")).indexOf(z)}focusItemAtIndex($){let z=this.getGui(),J=Array.from(z.querySelectorAll(".ag-column-drop-cell"))[$];if(!J)return;J.focus({preventScroll:!0})}restoreFocus($,z){let Q=this.getGui(),J=Array.from(Q.querySelectorAll(".ag-column-drop-cell"));if($===-1)return;if(J.length===0)z.focus();let Z=Math.min(J.length-1,$),X=J[Z];if(X)X.focus()}focusList($){let z=$?this.childPillComponents.length-1:0;this.restoreFocus(z,this.getFocusableElement())}getNonGhostItems(){let $=this.getExistingItems();if(this.isPotentialDndItems())return $.filter((z)=>!this.potentialDndItems.includes(z));return $}addItemsToGui(){let z=this.getNonGhostItems().map((Q)=>this.createItemComponent(Q,!1));if(this.isPotentialDndItems()){let Q=this.potentialDndItems.map((J)=>this.createItemComponent(J,!0));if(this.insertIndex>=z.length)z.push(...Q);else z.splice(this.insertIndex,0,...Q)}this.appendChild(this.ePillDropList),z.forEach((Q,J)=>{if(J>0)this.addArrow(this.ePillDropList);this.ePillDropList.appendChild(Q.getGui())}),this.addAriaLabelsToComponents()}addAriaLabelsToComponents(){let{childPillComponents:$,ePillDropList:z}=this,Q=$.length;_0(z,Q===0?"presentation":"listbox");for(let J=0;Jthis.destroyBean(Q)),!z)this.childPillComponents.push(Q);return Q}addIconAndTitleToGui(){let{title:$,icon:z}=this.params;if(!$||!z)return;let Q=J0({tag:"div"});if(kJ(Q,!0),this.addElementClasses(Q,"title-bar"),this.addElementClasses(z,"icon"),this.toggleCss("ag-column-drop-empty",this.isExistingItemsEmpty()),Q.appendChild(z),!this.horizontal){let J=J0({tag:"span"});this.addElementClasses(J,"title"),J.textContent=$,Q.appendChild(J)}this.appendChild(Q)}isExistingItemsEmpty(){return this.getExistingItems().length===0}addEmptyMessageToGui(){let{emptyMessage:$}=this.params;if(!$||!this.isExistingItemsEmpty()||this.isPotentialDndItems())return;let z=J0({tag:"span"});z.textContent=$,this.addElementClasses(z,"empty-message"),this.ePillDropList.appendChild(z)}addArrow($){if(this.horizontal){let z=this.gos.get("enableRtl"),Q=h(z?"panelDelimiterRtl":"panelDelimiter",this.beans);this.addElementClasses(Q,"cell-separator"),$.appendChild(Q)}}},OS={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},PS=class extends x{constructor($,z,Q,J,Z){super();this.dragSourceDropTarget=$,this.ghost=z,this.horizontal=Q,this.template=J,this.agComponents=Z,this.eText=f,this.eDragHandle=f,this.eButton=f}postConstruct(){this.setTemplate(this.template??OS,this.agComponents);let $=this.getGui(),{beans:z,eDragHandle:Q,eText:J,eButton:Z}=this;if(this.addElementClasses($),this.addElementClasses(Q,"drag-handle"),this.addElementClasses(J,"text"),this.addElementClasses(Z,"button"),Q.appendChild(h("columnDrag",z)),Z.appendChild(h("cancel",z)),this.tooltipFeature=this.createOptionalManagedBean(z.registry.createDynamicBean("tooltipFeature",!1,{getGui:()=>this.getGui()})),this.setupComponents(),!this.ghost&&this.isDraggable())this.addDragSource();this.setupAria(),this.setupTooltip(),this.activateTabIndex(),this.refreshDraggable()}isDraggable(){return!0}refreshDraggable(){this.eDragHandle.classList.toggle("ag-column-select-column-readonly",!this.isDraggable())}setupAria(){let $=this.getLocaleTextFunc(),z=[this.getAriaDisplayName()];this.addAdditionalAriaInstructions(z,$),E0(this.getGui(),z.join(". "))}addAdditionalAriaInstructions($,z){if(this.isRemovable()){let Q=z("ariaDropZoneColumnComponentDescription","Press DELETE to remove");$.push(Q)}}setupTooltip(){let $=()=>this.tooltipFeature?.setTooltipAndRefresh(this.getTooltip());$(),this.addManagedEventListeners({newColumnsLoaded:$})}getDragSourceId(){return}getDefaultIconName(){return"notAllowed"}addDragSource(){let{beans:{dragAndDrop:$},eDragHandle:z}=this,Q=this.createGetDragItem(),J=this.getDefaultIconName(),Z={type:this.getDragSourceType(),sourceId:this.getDragSourceId(),eElement:z,getDefaultIconName:()=>J,getDragItem:Q,dragItemName:this.getDisplayName()};$?.addDragSource(Z,!0),this.addDestroyFunc(()=>$?.removeDragSource(Z))}setupComponents(){if(this.eText.textContent=this.getDisplayValue(),this.setupRemove(),this.ghost)this.addCss("ag-column-drop-cell-ghost")}isRemovable(){return!0}refreshRemove(){N(this.eButton,this.isRemovable())}setupRemove(){this.refreshRemove();let $={type:"columnRemove"};this.addGuiEventListener("keydown",(Q)=>this.onKeyDown(Q)),this.addManagedElementListeners(this.eButton,{click:(Q)=>{this.dispatchLocalEvent($),Q.stopPropagation()}});let z=new h0(this.eButton);this.addManagedListeners(z,{tap:()=>this.dispatchLocalEvent($)}),this.addDestroyFunc(z.destroy.bind(z))}onKeyDown($){if($.key===A.DELETE){if(this.isRemovable())$.preventDefault(),this.dispatchLocalEvent({type:"columnRemove"})}}getDisplayValue(){return this.getDisplayName()}addElementClasses($,z){z=z?`-${z}`:"";let Q=this.horizontal?"horizontal":"vertical";$.classList.add(`ag-column-drop-cell${z}`,`ag-column-drop-${Q}-cell${z}`)}destroy(){super.destroy(),this.dragSourceDropTarget=null}},TS=class extends PS{constructor($,z,Q,J,Z,X){super(z,Q,Z);this.column=$,this.dropZonePurpose=J,this.updateParams=X,this.eSortIndicator=f,this.popupShowing=!1,this.deferApply=i(X)}postConstruct(){let{sortSvc:$,colNames:z}=this.beans;if(this.template={tag:"span",role:"option",children:[{tag:"span",ref:"eDragHandle",cls:"ag-drag-handle ag-column-drop-cell-drag-handle",role:"presentation"},{tag:"span",ref:"eText",cls:"ag-column-drop-cell-text",attrs:{"aria-hidden":"true"}},$?{tag:"ag-sort-indicator",ref:"eSortIndicator"}:void 0,{tag:"span",ref:"eButton",cls:"ag-column-drop-cell-button",role:"presentation"}]},$)this.agComponents=[$.getSortIndicatorSelector()];if(this.displayName=z.getDisplayNameForColumn(this.column,"columnDrop"),super.postConstruct(),this.deferApply)this.eDragHandle.setAttribute("data-column-tool-panel-deferred","");if($)this.setupSort(),this.addManagedEventListeners({sortChanged:()=>{this.setupAria()}});if(this.isGroupingZone())this.addManagedPropertyListener("groupLockGroupColumns",()=>{this.refreshRemove(),this.refreshDraggable(),this.setupAria()})}getItem(){return this.column}getDisplayName(){return this.displayName}getTooltip(){return this.column.getColDef().headerTooltip}addAdditionalAriaInstructions($,z){let Q=this.gos.get("rowGroupPanelSuppressSort"),J=this.gos.get("functionsReadOnly");if(this.isAggregationZone()&&!J){let Z=z("ariaDropZoneColumnValueItemDescription","Press ENTER to change the aggregation type");$.push(Z)}if(this.isGroupingZone()&&this.column.isSortable()&&!Q){let Z=z("ariaDropZoneColumnGroupItemDescription","Press ENTER to sort");$.push(Z)}super.addAdditionalAriaInstructions($,z)}isMovable(){return this.isDraggable()}isDraggable(){return this.isReadOnly()}isRemovable(){return this.isReadOnly()}isReadOnly(){return!this.isGroupingAndLocked()&&!this.gos.get("functionsReadOnly")}getAriaDisplayName(){let $=this.getLocaleTextFunc(),{name:z,aggFuncName:Q}=this.getColumnAndAggFuncName(),J=$("ariaDropZoneColumnComponentAggFuncSeparator"," of "),Z={asc:$("ariaDropZoneColumnComponentSortAscending","ascending"),desc:$("ariaDropZoneColumnComponentSortDescending","descending")},X=this.getCurrentSortDirection(this.column),Y=this.gos.get("rowGroupPanelSuppressSort");return[Q&&`${Q}${J}`,z,this.isGroupingZone()&&!Y&&X&&`, ${Z[X]}`].filter((q)=>!!q).join("")}getColumnAndAggFuncName(){let $=this.displayName,z="";if(this.isAggregationZone()){let Q=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),J=typeof Q==="string"?Q:"agg";z=this.getLocaleTextFunc()(J,J)}return{name:$,aggFuncName:z}}setupSort(){if(!this.column.isSortable()||!this.isGroupingZone())return;let{gos:$,column:z,eSortIndicator:Q}=this;if(!$.get("rowGroupPanelSuppressSort")){Q.setupSort(z,!0,this.getSortDefOverride.bind(this));let J=(Z)=>{Z.preventDefault(),this.beans.columnStateUpdateStrategy.progressSortFromEvent(this.deferApply,z,Z),Q.refresh(),this.setupAria(),N0(this.beans,this.updateParams)};this.addGuiEventListener("click",J),this.addGuiEventListener("keydown",(Z)=>{if(Z.key===A.ENTER&&this.isGroupingZone())J(Z)})}}getCurrentSortDirection($){return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,$)?.direction??null}getSortDefOverride(){if(!this.deferApply)return;return this.beans.columnStateUpdateStrategy.getSortDef(this.deferApply,this.column)}getDefaultIconName(){return"hide"}createGetDragItem(){let{column:$}=this;return()=>{let z={};return z[$.getId()]=$.isVisible(),{columns:[$],visibleState:z}}}setupComponents(){if(super.setupComponents(),this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))this.addGuiEventListener("click",this.onShowAggFuncSelection.bind(this))}onKeyDown($){if(super.onKeyDown($),$.key===A.ENTER&&this.isAggregationZone()&&!this.gos.get("functionsReadOnly"))$.preventDefault(),this.onShowAggFuncSelection()}getDisplayValue(){let{name:$,aggFuncName:z}=this.getColumnAndAggFuncName();return this.isAggregationZone()?`${z}(${$})`:$}onShowAggFuncSelection(){if(this.popupShowing)return;this.popupShowing=!0;let{aggFuncSvc:$,popupSvc:z}=this.beans,Q=new fX({cssIdentifier:"select-agg-func"}),J=$.getFuncNames(this.column),Z=this.getGui(),X=Q.getGui();Q.setModel({getRow:function(B){return J[B]},getRowCount:function(){return J.length}}),this.createBean(Q);let Y=J0({tag:"div",cls:"ag-select-agg-func-popup"});Y.style.top="0px",Y.style.left="0px",Y.appendChild(X),Y.style.width=`${Z.clientWidth}px`;let[q]=this.addManagedElementListeners(Y,{focusout:(B)=>{if(!Y.contains(B.relatedTarget)&&H)H.hideFunc()}}),G=(B)=>{if(this.destroyBean(Q),this.popupShowing=!1,B?.key==="Escape")Z.focus();if(q)q()},_=this.getLocaleTextFunc(),H=z.addPopup({modal:!0,eChild:Y,closeOnEsc:!0,closedCallback:G,ariaLabel:_("ariaLabelAggregationFunction","Aggregation Function")});if(H)Q.setComponentCreator(this.createAggSelect.bind(this,H.hideFunc));Q.addGuiEventListener("keydown",(B)=>{if(B.key===A.ENTER||B.key===A.SPACE){let E=Q.getLastFocusedRow();if(E==null)return;let K=Q.getComponentAt(E);if(K)K.selectItem()}}),z.positionPopupByComponent({type:"aggFuncSelect",eventSource:Z,ePopup:Y,keepWithinBounds:!0,additionalParams:{column:this.column},position:"under"}),Q.refresh();let U=this.beans.columnStateUpdateStrategy.getColumnAggFunc(this.deferApply,this.column),W=J.findIndex((B)=>B===U);if(W===-1)W=0;Q.focusRow(W)}createAggSelect($,z){let Q=()=>{if($(),this.getGui().focus(),this.beans.columnStateUpdateStrategy.setColumnAggFunc(this.deferApply,this.column,z,"toolPanelDragAndDrop"),this.column){let q=this.getGui().querySelector(".ag-column-drop-cell-text");if(q)q.textContent=this.getDisplayValue();this.setupAria()}N0(this.beans,this.updateParams)},J=this.getLocaleTextFunc(),Z=(z||"").toString(),X=J(Z,Z);return new vS(Q,X)}isGroupingAndLocked(){return this.isGroupingZone()&&T1(this.column,this.beans)}isAggregationZone(){return this.dropZonePurpose==="aggregation"}isGroupingZone(){return this.dropZonePurpose==="rowGroup"}getDragSourceType(){return G$.ToolPanel}destroy(){super.destroy(),this.column=null}},vS=class extends x{constructor($,z){super({tag:"div",cls:"ag-select-agg-func-item",children:z});this.selectItem=$,this.addGuiEventListener("click",this.selectItem)}},Y5=class extends fS{constructor($,z,Q){super($);this.dropZonePurpose=z,this.updateParams=Q,this.addElementClasses(this.getGui(),this.dropZonePurpose.toLowerCase())}init($){super.init($),this.addManagedEventListeners({newColumnsLoaded:this.refreshGui.bind(this)}),this.addManagedPropertyListeners(["functionsReadOnly","rowGroupPanelSuppressSort","groupLockGroupColumns"],this.refreshGui.bind(this))}getItems($){return $.columns??[]}isInterestedIn($,z){if($===G$.HeaderCell)return!0;if($!==G$.ToolPanel)return!1;if(!this.horizontal)return!0;return!z.hasAttribute("data-column-tool-panel-deferred")}minimumAllowedNewInsertIndex(){let{gos:$,rowGroupColsSvc:z}=this.beans,Q=$.get("groupLockGroupColumns"),J=z?.columns.length??0;if(Q===-1)return J;return Math.min(Q,J)}showOrHideColumnOnExit($){return this.isRowGroupPanel()&&TJ(this.gos,!0)&&!$.fromNudge}handleDragEnterEnd($){if(this.showOrHideColumnOnExit($)){let J=$.dragSource.getDragItem().columns;this.setColumnsVisible(J,!1,"uiColumnDragged")}}handleDragLeaveEnd($){if(this.showOrHideColumnOnExit($)){let Q=$.dragSource.getDragItem();this.setColumnsVisible(Q.columns,!0,"uiColumnDragged")}}setColumnsVisible($,z,Q){if(!$)return;if(i(this.updateParams))return;let J=$.filter((Z)=>!Z.getColDef().lockVisible);this.beans.columnStateUpdateStrategy.setColumnsVisible(!1,J,z,Q)}isRowGroupPanel(){return this.dropZonePurpose==="rowGroup"}createPillComponent($,z,Q,J){return new TS($,z,Q,this.dropZonePurpose,J,this.updateParams)}},IS=class extends Y5{constructor($,z){super($,"pivot",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("pivotColumnsEmptyMessage","Drag here to set column labels"),Q=$("pivots","Column Labels");if(super.init({icon:h("pivotPanel",this.beans,null),emptyMessage:z,title:Q}),this.horizontal)Bz(this.beans,this,this.getGui());this.addManagedEventListeners({newColumnsLoaded:this.refresh.bind(this),columnPivotChanged:this.refresh.bind(this),columnPivotModeChanged:this.checkVisibility.bind(this)}),this.refresh()}getAriaLabel(){return this.getLocaleTextFunc()("ariaPivotDropZonePanelLabel","Column Labels")}refresh(){this.checkVisibility(),this.refreshGui()}checkVisibility(){let $=this.beans.colModel,z=$.isPivotMode();if(this.horizontal)switch(this.gos.get("pivotPanelShow")){case"always":this.setDisplayed(z);break;case"onlyWhenPivoting":{let Q=$.isPivotActive();this.setDisplayed(z&&Q);break}default:this.setDisplayed(!1);break}else this.setDisplayed(this.beans.columnStateUpdateStrategy.getPivotMode(i(this.updateParams)))}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams)).includes($);return $.isAllowPivot()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setPivotColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"pivot":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getPivotColumns(i(this.updateParams))}getFocusableContainerName(){return"pivotToolbar"}},CS=class extends Y5{constructor($,z){super($,"rowGroup",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("rowGroupColumnsEmptyMessage","Drag here to set row groups"),Q=$("groups","Row Groups");if(super.init({icon:h("rowGroupPanel",this.beans,null),emptyMessage:z,title:Q}),this.horizontal)Bz(this.beans,this,this.getGui());this.addManagedEventListeners({columnRowGroupChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaRowGroupDropZonePanelLabel","Row Groups")}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary()||$.colDef.showRowGroup)return!1;let Q=this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams)).includes($);return $.isAllowRowGroup()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setRowGroupColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getIconName(){return this.isPotentialDndItems()?"group":"notAllowed"}getExistingItems(){return this.beans.columnStateUpdateStrategy.getRowGroupColumns(i(this.updateParams))}getFocusableContainerName(){return"rowGroupToolbar"}},bS=class extends Y5{constructor($,z){super($,"aggregation",z)}postConstruct(){let $=this.getLocaleTextFunc(),z=$("valueColumnsEmptyMessage","Drag here to aggregate"),Q=$("values","Values");super.init({icon:h("valuePanel",this.beans,null),emptyMessage:z,title:Q}),this.addManagedEventListeners({columnValueChanged:this.refreshGui.bind(this)})}getAriaLabel(){return this.getLocaleTextFunc()("ariaValuesDropZonePanelLabel","Values")}getIconName(){return this.isPotentialDndItems()?"aggregate":"notAllowed"}isItemDroppable($,z){if(this.gos.get("functionsReadOnly")||!$.isPrimary())return!1;let Q=this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams)).includes($);return $.isAllowValue()&&(!Q||this.isSourceEventFromTarget(z))}updateItems($){this.beans.columnStateUpdateStrategy.setValueColumns(i(this.updateParams),$,"toolPanelUi"),N0(this.beans,this.updateParams)}getExistingItems(){return this.beans.columnStateUpdateStrategy.getValueColumns(i(this.updateParams))}},yS={tag:"div",cls:"ag-pivot-mode-panel",children:[{tag:"ag-toggle-button",ref:"cbPivotMode",cls:"ag-pivot-mode-select"}]},xS=class extends x{constructor($,z){super();this.params=$,this.onPivotModeValueChanged=z,this.cbPivotMode=f}getCurrentPivotMode(){return this.beans.columnStateUpdateStrategy.getPivotMode(i(this.params))}syncFromGrid(){this.cbPivotMode.setValue(this.getCurrentPivotMode())}refreshEditStrategy(){this.syncFromGrid()}postConstruct(){this.setTemplate(yS,[f9]);let $=this.cbPivotMode;$.setValue(this.getCurrentPivotMode());let z=this.getLocaleTextFunc();$.setLabel(z("pivotMode","Pivot Mode"));let Q=()=>{let Z=!!$.getValue();this.beans.columnStateUpdateStrategy.setPivotMode(i(this.params),Z,"toolPanelUi"),this.onPivotModeValueChanged?.()},J=()=>{$.setValue(this.getCurrentPivotMode())};this.addManagedListeners($,{fieldValueChanged:Q}),this.addManagedEventListeners({newColumnsLoaded:J,columnPivotModeChanged:J})}},wS=class extends S{constructor(){super(...arguments);this.beanName="colToolPanelFactory"}setPanelVisible($,z,Q){if($)$.setDisplayed(z);else if(z)$=Q();return $}createRowGroupPanel($,z,Q){return this.createPanel($,z,new CS(!1,Q))}createValuesPanel($,z,Q){return this.createPanel($,z,new bS(!1,Q))}createPivotPanel($,z,Q){return this.createPanel($,z,new IS(!1,Q))}createPivotModePanel($,z,Q,J,Z){return this.createPanel($,z,new xS(Q,J),Z)}createPanel($,z,Q,J){if(Q=$.createBean(Q),z.push(()=>$.destroyBean(Q)),J)$.prependChild(Q);else $.appendChild(Q);return Q}},i9=()=>{},NS=class extends S{constructor(){super(...arguments);this.beanName="columnStateUpdateExecutionStrategy"}applyColumnState($,z,Q){this.getUpdateStrategy($).applyColumnState(z,Q)}commit($){this.getUpdateStrategy($).commit()}hasPendingChanges($){return this.getUpdateStrategy($).hasPendingChanges()}moveColumns($,z,Q,J){this.getUpdateStrategy($).moveColumns(z,Q,J)}reset($){this.getUpdateStrategy($).reset()}setColumnsVisible($,z,Q,J){this.getUpdateStrategy($).setColumnsVisible(z,Q,J)}isColumnVisibleInToolPanel($,z){return this.getUpdateStrategy($).isColumnVisibleInToolPanel(z)}setRowGroupColumns($,z,Q){this.getUpdateStrategy($).setRowGroupColumns(z,Q)}getRowGroupColumns($){return this.getUpdateStrategy($).getRowGroupColumns()}getPrimaryColumns($){return this.getUpdateStrategy($).getPrimaryColumns()}hasDeferredColumnOrder($){return this.getUpdateStrategy($).hasDeferredColumnOrder()}setValueColumns($,z,Q){this.getUpdateStrategy($).setValueColumns(z,Q)}getValueColumns($){return this.getUpdateStrategy($).getValueColumns()}setColumnAggFunc($,z,Q,J){this.getUpdateStrategy($).setColumnAggFunc(z,Q,J)}getColumnAggFunc($,z){return this.getUpdateStrategy($).getColumnAggFunc(z)}setPivotColumns($,z,Q){this.getUpdateStrategy($).setPivotColumns(z,Q)}getPivotColumns($){return this.getUpdateStrategy($).getPivotColumns()}setPivotMode($,z,Q){this.getUpdateStrategy($).setPivotMode(z,Q)}getPivotMode($){return this.getUpdateStrategy($).getPivotMode()}isColumnSelectedInPivotModeToolPanel($,z){return this.getUpdateStrategy($).isColumnSelectedInPivotModeToolPanel(z)}progressSortFromEvent($,z,Q){this.getUpdateStrategy($).progressSortFromEvent(z,Q)}getSortDef($,z){return this.getUpdateStrategy($).getSortDef(z)}getUpdateStrategy($){return $?this.getDeferredUpdateStrategy():this.getSyncUpdateStrategy()}getSyncUpdateStrategy(){return this.syncUpdateStrategy??(this.syncUpdateStrategy=new gS(this.beans))}getDeferredUpdateStrategy(){return this.deferredUpdateStrategy??(this.deferredUpdateStrategy=new hS(this.beans))}},gS=class{constructor($){this.beans=$,this.lastPivotColIds=[],this.reset=i9,this.commit=i9,this.hasPendingChanges=()=>!1,this.hasDeferredColumnOrder=()=>!1}applyColumnState($,z){if($.length===0)return;n0(this.beans,{state:$},z)}moveColumns($,z,Q){this.beans.colMoves?.moveColumns($,z,Q),uS(this.beans)}setColumnsVisible($,z,Q){let J=$.filter((Z)=>!Z.getColDef().lockVisible);this.beans.colModel.setColsVisible(J,z,Q)}setRowGroupColumns($,z){this.beans.rowGroupColsSvc?.setColumns($,z)}getRowGroupColumns(){return this.beans.rowGroupColsSvc?.columns??[]}getPrimaryColumns(){return q5(this.beans)}setValueColumns($,z){this.beans.valueColsSvc?.setColumns($,z)}getValueColumns(){return this.beans.valueColsSvc?.columns??[]}setColumnAggFunc($,z,Q){this.beans.valueColsSvc?.setColumnAggFunc?.($,z,Q)}getColumnAggFunc($){return $.getAggFunc()}setPivotColumns($,z){this.lastPivotColIds=$.map((Q)=>Q.getColId()),this.beans.pivotColsSvc?.setColumns($,z)}getPivotColumns(){return this.beans.pivotColsSvc?.columns??[]}setPivotMode($,z){let{colModel:Q,gos:J,ctrlsSvc:Z}=this.beans;if($===Q.isPivotMode())return;let X=this.beans.pivotColsSvc?.columns.map((Y)=>Y.getColId())??[];if(X.length>0)this.lastPivotColIds=X;if(!$){let Y=this.beans.colModel.getColDefCols()??[];n0(this.beans,{state:Y.map((q)=>({colId:q.getColId(),pivot:!1,pivotIndex:null}))},z)}if(J.updateGridOptions({options:{pivotMode:$},source:z}),$&&this.lastPivotColIds.length>0)this.beans.pivotColsSvc?.setColumns(this.lastPivotColIds,z);for(let Y of Z.getHeaderRowContainerCtrls())Y.refresh()}progressSortFromEvent($,z){this.beans.sortSvc?.progressSortFromEvent($,z)}isColumnVisibleInToolPanel($){return $.isVisible()}isColumnSelectedInPivotModeToolPanel($){return $.isAnyFunctionActive()}getPivotMode(){return this.beans.colModel.isPivotMode()}getSortDef($){return $.getSortDef()}},hS=class{constructor($){this.beans=$,this.state={},this.sequence=0,this.lastPivotColIds=[]}reset(){this.sequence=0,this.state={}}hasPendingChanges(){let{state:$,beans:z}=this,{columnState:Q,columnOrder:J,rowGroup:Z,aggregation:X,pivot:Y,pivotMode:q,sort:G,aggFuncs:_}=$,H=(U)=>(U??[]).map((W)=>W.getColId());if(Q)for(let[U,W]of Q.patches){let B=z.colModel.getColDefCol(U);if(!B)continue;if(W.hide!==void 0&&W.hide!==!B.isVisible()||W.rowGroup!==void 0&&!!W.rowGroup!==B.isRowGroupActive()||W.pivot!==void 0&&!!W.pivot!==B.isPivotActive()||W.aggFunc!==void 0&&(W.aggFunc??null)!==(B.getAggFunc()??null))return!0}if(J&&!X0(J.colIds,n4(z)))return!0;if(Z&&!X0(Z.colIds,H(z.rowGroupColsSvc?.columns)))return!0;if(X&&!X0(X.colIds,H(z.valueColsSvc?.columns)))return!0;if(Y&&!X0(Y.colIds,H(z.pivotColsSvc?.columns)))return!0;if(q&&q.pivotMode!==z.colModel.isPivotMode())return!0;if(G){for(let[U,W]of G.sortDefsByColId){let B=z.colModel.getColDefCol(U);if(!B)continue;if((W?.direction??null)!==(B.getSortDef()?.direction??null))return!0}if(G.baselineCleared){let U=q5(z);for(let W of U)if(!G.sortDefsByColId.has(W.getColId())&&W.getSortDef()!==null)return!0}}if(_)for(let[U,W]of _.values){let B=z.colModel.getColDefCol(U);if(!B)continue;if(W!==B.getAggFunc())return!0}return!1}commit(){let{beans:$,state:z}=this,Q=[];for(let Z of Object.keys(z)){let X=z[Z];if(X)Q.push({type:Z,...X})}let J=Q.sort((Z,X)=>Z.seq-X.seq);for(let Z of J)switch(Z.type){case"columnState":{n0($,{state:[...Z.patches.values()]},Z.eventType);break}case"columnOrder":{let X=Z.colIds.map((Y)=>$.colModel.getColDefCol(Y)).filter((Y)=>!!Y&&v1(Y));if(!$.colModel.isPivotMode())for(let Y=0;Yv1(U)),H=(_>=0?_:0)+Y;if(G[H]!==q)$.colMoves?.moveColumns([q],H,Z.eventType,!0)}iX($,X);break}case"rowGroup":{$.rowGroupColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"aggregation":{$.valueColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"pivot":{this.lastPivotColIds=Z.colIds,$.pivotColsSvc?.setColumns(Z.colIds,Z.eventType);break}case"pivotMode":{let{colModel:X,ctrlsSvc:Y,gos:q,stateSvc:G}=$;if(Z.pivotMode!==X.isPivotMode()){let _=$.pivotColsSvc?.columns.map((W)=>W.getColId())??[];if(_.length>0)this.lastPivotColIds=_;let H=G?.getState().pivot?.pivotColIds??_,U=Z.pivotMode?this.state.pivot?.colIds??this.lastPivotColIds:H;if(G?.setState({...G.getState(),pivot:{pivotMode:Z.pivotMode,pivotColIds:U}},["pivot"]),!Z.pivotMode){let W=$.colModel.getColDefCols()??[];n0($,{state:W.map((B)=>({colId:B.getColId(),pivot:!1,pivotIndex:null}))},Z.eventType)}if(q.updateGridOptions({options:{pivotMode:Z.pivotMode},source:Z.eventType}),Z.pivotMode&&U.length>0)$.pivotColsSvc?.setColumns(U,Z.eventType);for(let W of Y.getHeaderRowContainerCtrls())W.refresh()}break}case"sort":{let X=[],Y=0;for(let[q,G]of Z.sortDefsByColId)X.push({colId:q,sort:G?.direction??null,sortIndex:G?.direction?Y++:null,sortType:G?.type??void 0});n0($,{state:X,defaultState:Z.baselineCleared?{sort:null,sortIndex:null,sortType:void 0}:void 0},Z.eventType);break}case"aggFuncs":{for(let[X,Y]of Z.values){let q=$.colModel.getColDefCol(X);if(!q)continue;$.valueColsSvc?.setColumnAggFunc?.(q,Y,Z.eventType)}break}}this.reset()}applyColumnState($,z){for(let J of $)d4(this.state,J);let Q=JZ(this.state);Q.seq=i$(this.sequence),this.sequence=Q.seq,Q.eventType=z}moveColumns($,z,Q){let J=new Set($.map((G)=>G.getColId())),X=(this.state.columnOrder?.colIds??n4(this.beans)).filter((G)=>!J.has(G)),Y=$.map((G)=>G.getColId()),q=i$(this.sequence);this.sequence=q,this.state.columnOrder={colIds:[...X.slice(0,z),...Y,...X.slice(z)],eventType:Q,seq:q}}setColumnsVisible($,z,Q){for(let Z of $){if(Z.getColDef().lockVisible)continue;d4(this.state,{colId:Z.getColId(),hide:!z})}let J=JZ(this.state);J.seq=i$(this.sequence),this.sequence=J.seq,J.eventType=Q}setRowGroupColumns($,z){t4(this.state,"rowGroup");let Q=i$(this.sequence);this.sequence=Q,this.state.rowGroup={colIds:$.map((J)=>J.getColId()),eventType:z,seq:Q}}setValueColumns($,z){t4(this.state,"aggFunc");let Q=new Set((this.beans.valueColsSvc?.columns??[]).map((X)=>X.getColId())),J=n9(this.state);for(let X of $)if(!Q.has(X.getColId())&&!J.values.has(X.getColId())){let Y=X.getAggFunc(),q=Y!=null?Y:this.beans.aggFuncSvc?.getDefaultAggFunc(X);if(q!=null)J.values.set(X.getColId(),q)}let Z=i$(this.sequence);this.sequence=Z,J.seq=Z,J.eventType=z,this.state.aggregation={colIds:$.map((X)=>X.getColId()),eventType:z,seq:Z}}setColumnAggFunc($,z,Q){d4(this.state,{colId:$.getColId(),aggFunc:z});let J=JZ(this.state);J.seq=i$(this.sequence),this.sequence=J.seq,J.eventType=Q;let Z=n9(this.state);Z.seq=J.seq,Z.eventType=Q,Z.values.set($.getColId(),z)}getColumnAggFunc($){let z=$.getColId();if(this.state.aggFuncs?.values.has(z))return this.state.aggFuncs.values.get(z);return $.getAggFunc()}isColumnVisibleInToolPanel($){let z=this.state.columnState?.patches.get($.getColId());if(z?.hide!==void 0)return!z.hide;return $.isVisible()}isColumnSelectedInPivotModeToolPanel($){let z=$.getColId(),Q=this.state.columnState?.patches.get(z),J;if(Q?.rowGroup!==void 0)J=!!Q.rowGroup;else if(this.state.rowGroup)J=this.state.rowGroup.colIds.includes(z);else J=$.isRowGroupActive();let Z;if(Q?.pivot!==void 0)Z=!!Q.pivot;else if(this.state.pivot)Z=this.state.pivot.colIds.includes(z);else Z=$.isPivotActive();let X;if(Q?.aggFunc!==void 0)X=Q.aggFunc!=null;else if(this.state.aggregation)X=this.state.aggregation.colIds.includes(z);else X=$.isValueActive();return J||Z||X}setPivotColumns($,z){t4(this.state,"pivot");let Q=i$(this.sequence);this.sequence=Q,this.state.pivot={colIds:$.map((J)=>J.getColId()),eventType:z,seq:Q}}setPivotMode($,z){let Q=i$(this.sequence);this.sequence=Q,this.state.pivotMode={pivotMode:$,eventType:z,seq:Q}}getRowGroupColumns(){return V1(this.beans,i4(this.state.rowGroup?.colIds,this.beans.rowGroupColsSvc?.columns,this.state.columnState?.patches,($)=>$.rowGroup==null?void 0:!!$.rowGroup))}getPrimaryColumns(){return V1(this.beans,this.state.columnOrder?.colIds??n4(this.beans))}hasDeferredColumnOrder(){return!!this.state.columnOrder}getValueColumns(){return V1(this.beans,i4(this.state.aggregation?.colIds,this.beans.valueColsSvc?.columns,this.state.columnState?.patches,($)=>$.aggFunc===void 0?void 0:$.aggFunc!=null))}getPivotColumns(){if(!this.getPivotMode())return[];let $=this.beans.pivotColsSvc?.columns,z=$?.length?$:V1(this.beans,this.lastPivotColIds);return V1(this.beans,i4(this.state.pivot?.colIds,z,this.state.columnState?.patches,(Q)=>Q.pivot==null?void 0:!!Q.pivot))}getPivotMode(){return this.state.pivotMode?.pivotMode??this.beans.colModel.isPivotMode()}getSortDef($){let z=this.state.sort,Q=$.getColId(),J=z?.sortDefsByColId;if(J?.has(Q))return J.get(Q)??null;if(z?.baselineCleared)return null;return $.getSortDef()}progressSortFromEvent($,z){let Q=this.state.sort??{sortDefsByColId:new Map,baselineCleared:!1,seq:0,eventType:"toolPanelUi"},{sortSvc:J}=this.beans,Z=$.getColId(),X;if(Q.sortDefsByColId.has(Z))X=Q.sortDefsByColId.get(Z);else if(Q.baselineCleared)X=null;else X=$.getSortDef();let Y=J?.getNextSortDirection($,X);if(!Y)return;let{gos:q}=this.beans;if(!(((q.get("multiSortKey")==="ctrl"?z.ctrlKey||z.metaKey:z.shiftKey)||q.get("alwaysMultiSort"))&&!q.get("suppressMultiSort")))Q.sortDefsByColId.clear(),Q.baselineCleared=!0;Q.sortDefsByColId.set(Z,Y.direction?Y:null),Q.seq=i$(this.sequence),this.sequence=Q.seq,this.state.sort=Q}};function V1($,z){if(!z)return[];return z.map((Q)=>$.colModel.getColDefCol(Q)).filter((Q)=>!!Q)}function i4($,z,Q,J){let Z=[...$??z?.map((Y)=>Y.getColId())??[]];if(!Q?.size)return Z;let X=new Set(Z);for(let[Y,q]of Q){let G=J(q);if(G===void 0)continue;if(G){if(!X.has(Y))Z.push(Y),X.add(Y);continue}if(!X.has(Y))continue;X.delete(Y);let _=Z.indexOf(Y);if(_>=0)Z.splice(_,1)}return Z}function uS($){let z=$.colModel.getCols().filter((Q)=>v1(Q)).map((Q)=>$.colModel.getColDefCol(Q.getColId())).filter((Q)=>!!Q);iX($,z)}function iX($,z){let Q=mS($);if(!Q)return;let J=new Set(z);Q.list=[...z,...Q.list.filter((Z)=>v1(Z)&&!J.has(Z))]}function n4($){return q5($).map((z)=>z.getColId())}function q5($){return($.colModel.getColDefCols()??$.colModel.getCols()).filter((z)=>v1(z))}function mS($){let z=$.colModel.colDefCols,Q=z?.list;if(!Array.isArray(Q))return;return z}function v1($){if(!$.isPrimary())return!1;return!mz($)&&!q1($)}function i$($){return $+1}function d4($,z){let Q=JZ($),J=Q.patches.get(z.colId);Q.patches.set(z.colId,J?{...J,...z}:z)}function t4($,z){let Q=$.columnState?.patches;if(!Q?.size)return;for(let[J,Z]of Q){if(!(z in Z))continue;let X={...Z};if(delete X[z],Object.keys(X).length===1){Q.delete(J);continue}Q.set(J,X)}}function JZ($){let{columnState:z}=$;if(!z)z={patches:new Map,seq:0,eventType:"toolPanelUi"},$.columnState=z;return z}function n9($){let{aggFuncs:z}=$;if(!z)z={values:new Map,seq:0,eventType:"toolPanelUi"},$.aggFuncs=z;return z}var cS=class extends S{constructor(){super(...arguments);this.beanName="columnStateUpdateStrategy"}applyColumnState($,z,Q){this.delegate("applyColumnState",$,z,Q)}commit($){this.delegate("commit",$)}hasPendingChanges($){return this.delegate("hasPendingChanges",$)}moveColumns($,z,Q,J){this.delegate("moveColumns",$,z,Q,J)}reset($){this.delegate("reset",$)}setColumnsVisible($,z,Q,J){this.delegate("setColumnsVisible",$,z,Q,J)}isColumnVisibleInToolPanel($,z){return this.delegate("isColumnVisibleInToolPanel",$,z)}setRowGroupColumns($,z,Q){this.delegate("setRowGroupColumns",$,z,Q)}getRowGroupColumns($){return this.delegate("getRowGroupColumns",$)}getPrimaryColumns($){return this.delegate("getPrimaryColumns",$)}hasDeferredColumnOrder($){return this.delegate("hasDeferredColumnOrder",$)}setValueColumns($,z,Q){this.delegate("setValueColumns",$,z,Q)}getValueColumns($){return this.delegate("getValueColumns",$)}setColumnAggFunc($,z,Q,J){this.delegate("setColumnAggFunc",$,z,Q,J)}getColumnAggFunc($,z){return this.delegate("getColumnAggFunc",$,z)}setPivotColumns($,z,Q){this.delegate("setPivotColumns",$,z,Q)}getPivotColumns($){return this.delegate("getPivotColumns",$)}setPivotMode($,z,Q){this.delegate("setPivotMode",$,z,Q)}getPivotMode($){return this.delegate("getPivotMode",$)}isColumnSelectedInPivotModeToolPanel($,z){return this.delegate("isColumnSelectedInPivotModeToolPanel",$,z)}progressSortFromEvent($,z,Q){this.delegate("progressSortFromEvent",$,z,Q)}getSortDef($,z){return this.delegate("getSortDef",$,z)}getUpdateStrategy(){return this.executionStrategy??(this.executionStrategy=this.createManagedBean(new NS))}delegate($,...z){let Q=this.getUpdateStrategy();return Q[$].bind(Q)(...z)}},pS={moduleName:"SharedColumnStateUpdateStrategy",version:Q0,beans:[cS],dependsOn:[I0]},nX={moduleName:"ColumnsToolPanel",version:Q0,beans:[wS],userComponents:{agColumnsToolPanel:SS},icons:{ensureColumnVisible:"column-arrow",columnsToolPanel:"columns",menuAddRowGroup:"group",menuRemoveRowGroup:"group",pivotPanel:"pivot",rowGroupPanel:"group",valuePanel:"aggregation",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},dependsOn:[I0,pS,Z5,D1,L1,nz,X5]},iS=class extends S{constructor(){super(...arguments);this.beanName="chartMenuItemMapper"}getChartItems($){let z=this.beans,Q=z.chartSvc,J=$==="pivotChart";if(!Q)return null;let Z=this.getLocaleTextFunc.bind(this),X=J?new nS(z,Q,Z):new dS(z,Q,Z),Y=Q.isEnterprise(),q=X.getMenuItem();if(q?.subMenu&&!Y){let _=(H)=>({...H,subMenu:H.subMenu?.filter((U)=>!U._enterprise).map((U)=>_(U))});q=_(q)}let G=this.gos.get("chartToolPanelsDef")?.settingsPanel?.chartGroupsDef;if(G)q=this.filterAndOrderChartMenu(q,G,X.getConfigLookup());return this.cleanInternals(q)}cleanInternals($){if(!$)return $;let z=(Q)=>{delete Q?._key,delete Q?._enterprise;for(let J of Q?.subMenu??[])z(J);return Q};return z($)}buildLookup($){let z={},Q=(J)=>{if(z[J._key]=J,J.subMenu)for(let Z of J.subMenu)Q(Z)};return Q($),z}filterAndOrderChartMenu($,z,Q){let J=this.buildLookup($),Z={...$,subMenu:[]};for(let X of Object.keys(z)){let Y=z[X],q=Q[X];if(q===null)continue;if(q==null){j(173,{group:X});continue}let G=J[q._key];if(G)if(G.subMenu){let _=Y.map((H)=>{let U=q[H];if(U==null){j(174,{group:X,chartType:H});return}return J[U]}).filter((H)=>H!==void 0);if(_.length>0)G.subMenu=_,Z.subMenu?.push(G)}else Z.subMenu?.push(G)}if(Z.subMenu?.length==0)return null;return Z}},nS=class{constructor($,z,Q){this.beans=$,this.chartSvc=z,this.getLocaleTextFunc=Q}getMenuItem(){let $=this.getLocaleTextFunc(),z=(Q,J,Z,X,Y=!1)=>{return{name:$(Q,J+"‎"),action:()=>this.chartSvc.createPivotChart({chartType:Z}),_key:X,_enterprise:Y}};return{name:$("pivotChart","Pivot Chart"),_key:"pivotChart",subMenu:[{_key:"pivotColumnChart",name:$("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","pivotGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","pivotStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","pivotNormalizedColumn")]},{_key:"pivotBarChart",name:$("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","pivotGroupedBar"),z("stackedBar","Stacked","stackedBar","pivotStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","pivotNormalizedBar")]},{_key:"pivotPieChart",name:$("pieChart","Pie"),subMenu:[z("pie","Pie","pie","pivotPie"),z("donut","Donut","donut","pivotDonut")]},{_key:"pivotLineChart",name:$("lineChart","Line"),subMenu:[z("lineChart","Line","line","pivotLineChart"),z("stackedLine","Stacked","stackedLine","pivotStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","pivotNormalizedLine")]},{_key:"pivotAreaChart",name:$("areaChart","Area"),subMenu:[z("areaChart","Area","area","pivotArea"),z("stackedArea","Stacked","stackedArea","pivotStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","pivotNormalizedArea")]},{_key:"pivotXYChart",name:$("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","pivotScatter"),z("bubble","Bubble","bubble","pivotBubble")]},{_key:"pivotStatisticalChart",_enterprise:!1,name:$("statisticalChart","Statistical"),subMenu:[z("histogramChart","Histogram","histogram","pivotHistogram",!1)]},{_key:"pivotHierarchicalChart",_enterprise:!0,name:$("hierarchicalChart","Hierarchical"),subMenu:[z("treemapChart","Treemap","treemap","pivotTreemap",!0),z("sunburstChart","Sunburst","sunburst","pivotSunburst",!0)]},{_key:"pivotFunnel",name:$("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","pivotFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","pivotConeFunnel"),z("pyramid","Pyramid","pyramid","pivotPyramid")]},{_key:"pivotCombinationChart",name:$("combinationChart","Combination"),subMenu:[z("columnLineCombo","Column & Line","columnLineCombo","pivotColumnLineCombo"),z("AreaColumnCombo","Area & Column","areaColumnCombo","pivotAreaColumnCombo")]}],icon:h("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"pivotColumnChart",column:"pivotGroupedColumn",stackedColumn:"pivotStackedColumn",normalizedColumn:"pivotNormalizedColumn"},barGroup:{_key:"pivotBarChart",bar:"pivotGroupedBar",stackedBar:"pivotStackedBar",normalizedBar:"pivotNormalizedBar"},pieGroup:{_key:"pivotPieChart",pie:"pivotPie",donut:"pivotDonut",doughnut:"pivotDonut"},lineGroup:{_key:"pivotLineChart",line:"pivotLineChart",stackedLine:"pivotStackedLine",normalizedLine:"pivotNormalizedLine"},areaGroup:{_key:"pivotAreaChart",area:"pivotArea",stackedArea:"pivotStackedArea",normalizedArea:"pivotNormalizedArea"},scatterGroup:{_key:"pivotXYChart",bubble:"pivotBubble",scatter:"pivotScatter"},combinationGroup:{_key:"pivotCombinationChart",columnLineCombo:"pivotColumnLineCombo",areaColumnCombo:"pivotAreaColumnCombo",customCombo:null},hierarchicalGroup:{_key:"pivotHierarchicalChart",treemap:"pivotTreemap",sunburst:"pivotSunburst"},statisticalGroup:{_key:"pivotStatisticalChart",histogram:"pivotHistogram",rangeBar:null,rangeArea:null,boxPlot:null},funnelGroup:{_key:"pivotFunnel",funnel:"pivotFunnel",coneFunnel:"pivotConeFunnel",pyramid:"pivotPyramid"},polarGroup:null,specializedGroup:null}}},dS=class{constructor($,z,Q){this.beans=$,this.chartSvc=z,this.getLocaleTextFunc=Q}getMenuItem(){let $=this.getLocaleTextFunc(),z=(Q,J,Z,X,Y=!1)=>{return{name:$(Q,J),action:()=>this.chartSvc.createChartFromCurrentRange(Z),_key:X,_enterprise:Y}};return{name:$("chartRange","Chart Range"),_key:"chartRange",subMenu:[{name:$("columnChart","Column"),subMenu:[z("groupedColumn","Grouped","groupedColumn","rangeGroupedColumn"),z("stackedColumn","Stacked","stackedColumn","rangeStackedColumn"),z("normalizedColumn","100% Stacked","normalizedColumn","rangeNormalizedColumn")],_key:"rangeColumnChart"},{name:$("barChart","Bar"),subMenu:[z("groupedBar","Grouped","groupedBar","rangeGroupedBar"),z("stackedBar","Stacked","stackedBar","rangeStackedBar"),z("normalizedBar","100% Stacked","normalizedBar","rangeNormalizedBar")],_key:"rangeBarChart"},{name:$("pieChart","Pie"),subMenu:[z("pie","Pie","pie","rangePie"),z("donut","Donut","donut","rangeDonut")],_key:"rangePieChart"},{name:$("lineChart","Line"),subMenu:[z("lineChart","Line","line","rangeLineChart"),z("stackedLine","Stacked","stackedLine","rangeStackedLine"),z("normalizedLine","100% Stacked","normalizedLine","rangeNormalizedLine")],_key:"rangeLineChart"},{name:$("areaChart","Area"),subMenu:[z("areaChart","Area","area","rangeArea"),z("stackedArea","Stacked","stackedArea","rangeStackedArea"),z("normalizedArea","100% Stacked","normalizedArea","rangeNormalizedArea")],_key:"rangeAreaChart"},{name:$("xyChart","X Y (Scatter)"),subMenu:[z("scatter","Scatter","scatter","rangeScatter"),z("bubble","Bubble","bubble","rangeBubble")],_key:"rangeXYChart"},{name:$("polarChart","Polar"),subMenu:[z("radarLine","Radar Line","radarLine","rangeRadarLine"),z("radarArea","Radar Area","radarArea","rangeRadarArea"),z("nightingale","Nightingale","nightingale","rangeNightingale"),z("radialColumn","Radial Column","radialColumn","rangeRadialColumn"),z("radialBar","Radial Bar","radialBar","rangeRadialBar")],_key:"rangePolarChart",_enterprise:!0},{name:$("statisticalChart","Statistical"),subMenu:[z("boxPlot","Box Plot","boxPlot","rangeBoxPlot",!0),z("histogramChart","Histogram","histogram","rangeHistogram",!1),z("rangeBar","Range Bar","rangeBar","rangeRangeBar",!0),z("rangeArea","Range Area","rangeArea","rangeRangeArea",!0)],_key:"rangeStatisticalChart",_enterprise:!1},{name:$("hierarchicalChart","Hierarchical"),subMenu:[z("treemap","Treemap","treemap","rangeTreemap"),z("sunburst","Sunburst","sunburst","rangeSunburst")],_key:"rangeHierarchicalChart",_enterprise:!0},{name:$("specializedChart","Specialized"),subMenu:[z("heatmap","Heatmap","heatmap","rangeHeatmap"),z("waterfall","Waterfall","waterfall","rangeWaterfall")],_key:"rangeSpecializedChart",_enterprise:!0},{name:$("funnel","Funnel"),subMenu:[z("funnel","Funnel","funnel","rangeFunnel"),z("coneFunnel","Cone Funnel","coneFunnel","rangeConeFunnel"),z("pyramid","Pyramid","pyramid","rangePyramid")],_key:"rangeFunnel",_enterprise:!0},{name:$("combinationChart","Combination"),subMenu:[z("columnLineCombo","Column & Line","columnLineCombo","rangeColumnLineCombo"),z("AreaColumnCombo","Area & Column","areaColumnCombo","rangeAreaColumnCombo")],_key:"rangeCombinationChart"}],icon:h("chart",this.beans,void 0)}}getConfigLookup(){return{columnGroup:{_key:"rangeColumnChart",column:"rangeGroupedColumn",stackedColumn:"rangeStackedColumn",normalizedColumn:"rangeNormalizedColumn"},barGroup:{_key:"rangeBarChart",bar:"rangeGroupedBar",stackedBar:"rangeStackedBar",normalizedBar:"rangeNormalizedBar"},pieGroup:{_key:"rangePieChart",pie:"rangePie",donut:"rangeDonut",doughnut:"rangeDonut"},lineGroup:{_key:"rangeLineChart",line:"rangeLineChart",stackedLine:"rangeStackedLine",normalizedLine:"rangeNormalizedLine"},areaGroup:{_key:"rangeAreaChart",area:"rangeArea",stackedArea:"rangeStackedArea",normalizedArea:"rangeNormalizedArea"},scatterGroup:{_key:"rangeXYChart",bubble:"rangeBubble",scatter:"rangeScatter"},polarGroup:{_key:"rangePolarChart",radarLine:"rangeRadarLine",radarArea:"rangeRadarArea",nightingale:"rangeNightingale",radialColumn:"rangeRadialColumn",radialBar:"rangeRadialBar"},statisticalGroup:{_key:"rangeStatisticalChart",boxPlot:"rangeBoxPlot",histogram:"rangeHistogram",rangeBar:"rangeRangeBar",rangeArea:"rangeRangeArea"},hierarchicalGroup:{_key:"rangeHierarchicalChart",treemap:"rangeTreemap",sunburst:"rangeSunburst"},specializedGroup:{_key:"rangeSpecializedChart",heatmap:"rangeHeatmap",waterfall:"rangeWaterfall"},funnelGroup:{_key:"rangeFunnel",funnel:"rangeFunnel",coneFunnel:"rangeConeFunnel",pyramid:"rangePyramid"},combinationGroup:{_key:"rangeCombinationChart",columnLineCombo:"rangeColumnLineCombo",areaColumnCombo:"rangeAreaColumnCombo",customCombo:null}}}},tS=class extends S{constructor(){super(...arguments);this.beanName="colChooserFactory"}createColumnSelectPanel($,z,Q,J){let Z=$.createManagedBean(new pX),X=J??z?.getColDef().columnChooserParams??{},{contractColumnSelection:Y,suppressColumnExpandAll:q,suppressColumnFilter:G,suppressColumnSelectAll:_,suppressSyncLayoutWithGrid:H,columnLayout:U}=X;if(Z.init(!!Q,y(this.gos,{suppressColumnMove:!1,suppressValues:!1,suppressPivots:!1,suppressRowGroups:!1,suppressPivotMode:!1,contractColumnSelection:!!Y,suppressColumnExpandAll:!!q,suppressColumnFilter:!!G,suppressColumnSelectAll:!!_,suppressSyncLayoutWithGrid:!!U||!!H,onStateUpdated:()=>{}}),"columnMenu"),U)Z.setColumnLayout(U);return Z}showColumnChooser({column:$,chooserParams:z,eventSource:Q,headerPosition:J}){this.hideActiveColumnChooser();let Z=this.createColumnSelectPanel(this,$,!0,z),X=this.getLocaleTextFunc(),Y=this.beans,{visibleCols:q,focusSvc:G,menuUtils:_}=Y,H=q.allCols.indexOf($),U=$?G.focusedHeader??J??null:null;this.activeColumnChooserDialog=this.createBean(new EA({title:X("chooseColumns","Choose Columns"),component:Z,width:300,height:300,resizable:!0,movable:!0,centered:!0,closable:!0,afterGuiAttached:()=>{j0(Y,Z.getGui())?.focus({preventScroll:!0}),this.dispatchVisibleChangedEvent(!0,$)},closedCallback:(W)=>{let B=this.activeColumnChooser.getGui();if(this.destroyBean(this.activeColumnChooser),this.activeColumnChooser=void 0,this.activeColumnChooserDialog=void 0,this.dispatchVisibleChangedEvent(!1,$),$)_.restoreFocusOnClose({column:$,headerPosition:U,columnIndex:H,eventSource:Q},B,W,!0)},postProcessPopupParams:{type:"columnChooser",column:$,eventSource:Q}})),this.activeColumnChooser=Z}hideActiveColumnChooser(){this.destroyBean(this.activeColumnChooserDialog)}dispatchVisibleChangedEvent($,z){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:!1,key:"columnChooser",column:z??null})}},sS={pinSubMenu:"PinnedColumn",pinLeft:"PinnedColumn",pinRight:"PinnedColumn",clearPinned:"PinnedColumn",pinRowSubMenu:"PinnedRow",pinBottom:"PinnedRow",pinTop:"PinnedRow",unpinRow:"PinnedRow",valueAggSubMenu:"SharedAggregation",autoSizeThis:"ColumnAutoSize",autoSizeAll:"ColumnAutoSize",rowGroup:"SharedRowGrouping",rowUnGroup:"SharedRowGrouping",resetColumns:"CommunityCore",expandAll:["ClientSideRowModelHierarchy","ServerSideRowModel"],contractAll:["ClientSideRowModelHierarchy","ServerSideRowModel"],copy:"Clipboard",copyWithHeaders:"Clipboard",copyWithGroupHeaders:"Clipboard",cut:"Clipboard",paste:"Clipboard",export:["CsvExport","ExcelExport"],csvExport:"CsvExport",excelExport:"ExcelExport",separator:"CommunityCore",pivotChart:"IntegratedCharts",chartRange:"IntegratedCharts",columnFilter:"ColumnFilter",columnChooser:"ColumnMenu",sortAscending:"Sort",sortDescending:"Sort",sortAbsoluteAscending:"Sort",sortAbsoluteDescending:"Sort",sortUnSort:"Sort"};function rS($,z){let Q=sS[z];if(Q)$.assertModuleRegistered(Q,`menu item '${z}'`)}var dz="separator";function dX($,z){if(!$)return;for(let Q=$.length-2;Q>=0;Q--){let J=$[Q]===z,Z=$[Q+1]===z;if(J&&Z)$.splice(Q+1,1)}}var lS={sortAscending:{fallback:"Sort Ascending",getSortDef:()=>({type:"default",direction:"asc"})},sortDescending:{fallback:"Sort Descending",getSortDef:()=>({type:"default",direction:"desc"})},sortAbsoluteAscending:{fallback:"Sort Absolute Ascending",getSortDef:()=>({type:"absolute",direction:"asc"})},sortAbsoluteDescending:{fallback:"Sort Absolute Descending",getSortDef:()=>({type:"absolute",direction:"desc"})},sortUnSort:{fallback:"Clear Sort",getSortDef:($)=>({type:L$($.getSortDef()?.type),direction:null})}},aS=class extends S{constructor(){super(...arguments);this.beanName="menuItemMapper"}mapWithStockItems($,z,Q,J,Z){if(!$)return[];let X=[],Y=this.getLocaleTextFunc(),{beans:q,gos:G}=this,{pinnedCols:_,colAutosize:H,aggFuncSvc:U,rowGroupColsSvc:W,colNames:B,colModel:E,clipboardSvc:K,expansionSvc:L,focusSvc:D,csvCreator:F,excelCreator:M,menuSvc:k,colChooserFactory:V,sortSvc:R,chartMenuItemMapper:O,valueColsSvc:I,pinnedRowModel:v}=q,C=(m,w,a,t)=>{switch(rS(G,m),m){case"pinSubMenu":return _&&w?{name:Y("pinColumn","Pin Column"),icon:h("menuPin",q,null),subMenu:["clearPinned","pinLeft","pinRight"]}:null;case"pinLeft":return _&&w?{name:Y("pinLeft","Pin Left"),action:()=>_.setColsPinned([w],"left",t),checked:!!w&&w.isPinnedLeft()}:null;case"pinRight":return _&&w?{name:Y("pinRight","Pin Right"),action:()=>_.setColsPinned([w],"right",t),checked:!!w&&w.isPinnedRight()}:null;case"clearPinned":return _&&w?{name:Y("noPin","No Pin"),action:()=>_.setColsPinned([w],null,t),checked:!!w&&!w.isPinned()}:null;case"pinRowSubMenu":{let u=G.get("enableRowPinning"),$0=[],s=Q?.rowPinned??Q?.pinnedSibling?.rowPinned;if(s)$0.push("unpinRow");if(u&&u!=="bottom"&&s!="top")$0.push("pinTop");if(u&&u!=="top"&&s!="bottom")$0.push("pinBottom");return v?.isManual()?{name:Y("pinRow","Pin Row"),icon:h("rowPin",q,w),subMenu:$0}:null}case"pinTop":return v?.isManual()?{name:Y("pinTop","Pin to Top"),icon:h("rowPinTop",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,"top",$0)}:null;case"pinBottom":return v?.isManual()?{name:Y("pinBottom","Pin to Bottom"),icon:h("rowPinBottom",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,"bottom",$0)}:null;case"unpinRow":return v?.isManual()?{name:Y("unpinRow","Unpin Row"),icon:h("rowUnpin",q,w),action:({node:u,column:$0})=>u&&v.pinRow(u,null,$0)}:null;case"valueAggSubMenu":if(U&&I&&(w?.isPrimary()||w?.getColDef().pivotValueColumn))return{name:Y("valueAggregation","Value Aggregation"),icon:h("menuValue",q,null),subMenu:oS(w,U,I,Y),disabled:G.get("functionsReadOnly")};else return null;case"autoSizeThis":return H?{name:Y("autosizeThisColumn","Autosize This Column"),action:()=>w&&H.autoSizeColumn(w,t,G.get("skipHeaderOnAutoSize"))}:null;case"autoSizeAll":return H?{name:Y("autosizeAllColumns","Autosize All Columns"),action:()=>H.autoSizeAllColumns({source:t,skipHeader:G.get("skipHeaderOnAutoSize")})}:null;case"rowGroup":return W?{name:O1(Y,"groupBy",B.getDisplayNameForColumn(w,"header")),disabled:G.get("functionsReadOnly")||w?.isRowGroupActive()||!w?.getColDef().enableRowGroup,action:()=>W.addColumns([w],t),icon:h("menuAddRowGroup",q,null)}:null;case"rowUnGroup":if(W&&G.isModuleRegistered("SharedRowGrouping")){let u=w?.getColDef().showRowGroup,$0=G.get("groupLockGroupColumns"),s,f0,O0;if(u===!0)s=Y("ungroupAll","Un-Group All"),f0=G.get("functionsReadOnly")||$0===-1||$0>=(W.columns.length??0),O0=()=>W.setColumns(W.columns.slice(0,$0),t);else if(typeof u==="string"){let k0=E.getColDefCol(u),Sz=k0!=null?B.getDisplayNameForColumn(k0,"header"):u;s=O1(Y,"ungroupBy",Sz),f0=G.get("functionsReadOnly")||T1(k0,q),O0=()=>{W.removeColumns([u],t)}}else s=O1(Y,"ungroupBy",B.getDisplayNameForColumn(w,"header")),f0=G.get("functionsReadOnly")||!w?.isRowGroupActive()||!w?.getColDef().enableRowGroup||T1(w,q),O0=()=>W.removeColumns([w],t);return{name:s,disabled:f0,action:O0,icon:h("menuRemoveRowGroup",q,null)}}else return null;case"resetColumns":return{name:Y("resetColumns","Reset Columns"),action:()=>k8(q,t)};case"expandAll":return L?{name:Y("expandAll","Expand All Row Groups"),action:()=>L.expandAll(!0)}:null;case"contractAll":return L?{name:Y("collapseAll","Collapse All Row Groups"),action:()=>L.expandAll(!1)}:null;case"copy":return K?{name:Y("copy","Copy"),shortcut:Y("ctrlC","Ctrl+C"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard()}:null;case"copyWithHeaders":return K?{name:Y("copyWithHeaders","Copy with Headers"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard({includeHeaders:!0})}:null;case"copyWithGroupHeaders":return K?{name:Y("copyWithGroupHeaders","Copy with Group Headers"),icon:h("clipboardCopy",q,null),action:()=>K.copyToClipboard({includeHeaders:!0,includeGroupHeaders:!0})}:null;case"cut":if(K){let u=D.getFocusedCell(),$0=u?M0(q,u):null,s=$0?u?.column.isCellEditable($0):!1;return{name:Y("cut","Cut"),shortcut:Y("ctrlX","Ctrl+X"),icon:h("clipboardCut",q,null),disabled:!s||G.get("suppressCutToClipboard"),action:()=>K.cutToClipboard(void 0,"contextMenu")}}else return null;case"paste":if(K){let u=G.get("suppressClipboardApi")||G.get("suppressClipboardPaste")||!w||!Q||!w.isCellEditable(Q)||w.isSuppressPaste(Q);return{name:Y("paste","Paste"),shortcut:Y("ctrlV","Ctrl+V"),icon:h("clipboardPaste",q,null),disabled:u,action:()=>K.pasteFromClipboard()}}else return null;case"export":{let u=[];if(!G.get("suppressCsvExport")&&F)u.push("csvExport");if(!G.get("suppressExcelExport")&&M)u.push("excelExport");return u.length?{name:Y("export","Export"),subMenu:u,icon:h("save",q,null)}:null}case"csvExport":return F?{name:Y("csvExport","CSV Export"),icon:h("csvExport",q,null),action:()=>F.exportDataAsCsv()}:null;case"excelExport":return M?{name:Y("excelExport","Excel Export"),icon:h("excelExport",q,null),action:()=>M.exportDataAsExcel()}:null;case"separator":return m;case"pivotChart":case"chartRange":return O.getChartItems(m);case"columnFilter":return k&&w?{name:Y("columnFilter","Column Filter"),icon:h("filter",q,null),action:()=>k.showFilterMenu({column:w,buttonElement:a(),containerType:"columnFilter",positionBy:"button"})}:null;case"columnChooser":{let u=D.focusedHeader;return V?{name:Y("columnChooser","Choose Columns"),icon:h("columns",q,null),action:()=>V.showColumnChooser({column:w,eventSource:a(),headerPosition:u})}:null}case"sortUnSort":case"sortAscending":case"sortDescending":case"sortAbsoluteAscending":case"sortAbsoluteDescending":{if(!R||!w)return null;let{fallback:u,getSortDef:$0}=lS[m];return{name:Y(m,u),icon:h(m,q,null),action:()=>R.setSortForColumn(w,$0(w),!1,t)}}default:return j(176,{key:m}),null}};for(let m of $){let w;if(typeof m==="string")w=C(m,z,J,Z);else w={...m};if(!w)continue;let a=w,{subMenu:t}=a;if(t&&t instanceof Array)a.subMenu=this.mapWithStockItems(t,z,Q,J,Z);if(w!=null)X.push(w)}return dX(X,dz),X}};function oS($,z,Q,J){let Z;if($.isPrimary())Z=$;else{let Y=$.getColDef().pivotValueColumn;Z=T(Y)?Y:void 0}let X=[];if(Z){let Y=Z.isValueActive(),q=z.getFuncNames(Z);X.push({name:J("noAggregation","None"),action:()=>{Q.removeColumns([Z],"contextMenu"),Q.setColumnAggFunc(Z,void 0,"contextMenu")},checked:!Y});for(let G of q)X.push({name:J(G,z.getDefaultFuncLabel(G)),action:()=>{Q.setColumnAggFunc(Z,G,"contextMenu"),Q.addColumns([Z],"contextMenu")},checked:Y&&Z.getAggFunc()===G})}return X}var eS=class extends S{constructor(){super(...arguments);this.beanName="colMenuFactory"}createMenu($,z,Q,J){let Z=$.createManagedBean(new uX(0,{column:Q??null,node:null,value:null})),X=this.beans.menuItemMapper.mapWithStockItems(z,Q??null,null,J,"columnMenu");return Z.addMenuItems(X),Z}getMenuItems($=null,z=null){let Q=this.getDefaultMenuOptions($),J,Z=($?.getColDef()??z?.getColGroupDef())?.mainMenuItems;if(Array.isArray(Z))J=Z;else if(typeof Z==="function")J=Z(y(this.gos,{column:$,columnGroup:z,defaultItems:Q}));else{let X=this.gos.getCallback("getMainMenuItems");if(X)J=X({column:$,columnGroup:z,defaultItems:Q});else J=Q}return dX(J,dz),J}getDefaultMenuOptions($){let z=[],{beans:Q,gos:J}=this,{colChooserFactory:Z,rowGroupColsSvc:X,colModel:Y,expansionSvc:q,sortSvc:G,menuSvc:_,pinnedCols:H,aggFuncSvc:U,colAutosize:W}=Q,B=U0(J),E=()=>{if(!B&&Z)z.push("columnChooser");z.push("resetColumns")};if(!$)return E(),z;let{colDef:K}=$,L=H&&!K.lockPinned,D=X?.columns.length??0,F=D>0,M=Hz(J),k=J.get("treeData"),V=$.isPrimary(),R=!V||U&&$.isAllowValue()&&(F||M||k);if(G&&!B&&$.isSortable()){let{isDefaultSortAllowed:O,isAbsoluteSortAllowed:I,isAbsoluteSort:v,isDefaultSort:C,isAscending:m,isDescending:w,direction:a}=c2($,Q);if(O&&!(m&&C))z.push("sortAscending");if(O&&!(w&&C))z.push("sortDescending");if(I&&!(m&&v))z.push("sortAbsoluteAscending");if(I&&!(w&&v))z.push("sortAbsoluteDescending");if(a)z.push("sortUnSort");z.push(dz)}if(_?.isFilterMenuItemEnabled($))z.push("columnFilter"),z.push(dz);if(L)z.push("pinSubMenu");if(R)z.push("valueAggSubMenu");if(L||R)z.push(dz);if(W){if(!K.suppressAutoSize)z.push("autoSizeThis");z.push("autoSizeAll"),z.push(dz)}if(X&&J.isModuleRegistered("SharedRowGrouping")){let O=z.length;if(K.showRowGroup)z.push("rowUnGroup");else if($.isAllowRowGroup()&&V)if($.isRowGroupActive()){if(!T1($,Q))z.push("rowUnGroup")}else z.push("rowGroup");if(z.length>O)z.push(dz)}if(E(),q&&(o(J)||J.get("ssrmExpandAllAffectsAllRows"))&&(k||D>(Y.isPivotMode()?1:0)))z.push("expandAll"),z.push("contractAll");return z}};var Fz="filterMenuTab",Mz="generalMenuTab",tz="columnsMenuTab",ZZ=[Mz,Fz,tz],$R=class extends S{constructor(){super(...arguments);this.beanName="enterpriseMenuFactory"}hideActiveMenu(){this.destroyBean(this.activeMenu)}showMenuAfterMouseEvent($,z,Q,J,Z){let{column:X,columnGroup:Y}=this.splitColumnOrGroup($),q=Z?"filterMenuTab":void 0;this.showMenu(X,Y,(G)=>{let _=G.getGui();if(this.beans.popupSvc.positionPopupUnderMouseEvent({type:Q,additionalParams:{column:X},mouseEvent:z,ePopup:_}),q)G.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,X,Y,q)},Q,q,void 0,z.target,J)}splitColumnOrGroup($){let z=$&&Q$($);return{column:z?$:void 0,columnGroup:z?void 0:$}}showMenuAfterButtonClick($,z,Q,J,Z){let X=-1,Y="left";if(this.gos.get("enableRtl"))X=1,Y="right";let q=Z?"filterMenuTab":void 0,G=q?[q]:void 0,_=U0(this.gos),H=(_?9:4)*X,U=_?-23:4,{column:W,columnGroup:B}=this.splitColumnOrGroup($);this.showMenu(W,B,(E)=>{let K=E.getGui();if(this.beans.popupSvc.positionPopupByComponent({type:Q,additionalParams:{column:W},eventSource:z,ePopup:K,alignSide:Y,nudgeX:H,nudgeY:U,position:"under",keepWithinBounds:!0}),q)E.showTab?.(q);this.dispatchVisibleChangedEvent(!0,!1,W,B,q)},Q,q,G,z,J)}showMenu($,z,Q,J,Z,X,Y,q){let G=this.getMenuParams($,z,X,Y);if(!G)return;let{menu:_,eMenuGui:H,anchorToElement:U,restoreFocusParams:W}=G,B=[],{menuUtils:E,popupSvc:K}=this.beans;B.push((D)=>{let F=_.getGui();if(this.destroyBean(_),$)z1($,!1,"contextMenu"),E.restoreFocusOnClose(W,F,D);q?.()});let L=this.getLocaleTextFunc();if(K.addPopup({modal:!0,eChild:H,closeOnEsc:!0,closedCallback:(D)=>{for(let F of B)F(D);this.dispatchVisibleChangedEvent(!1,!1,$,z,Z)},afterGuiAttached:(D)=>_.afterGuiAttached(Object.assign({},{container:J},D)),positionCallback:Z?()=>Q(_):void 0,ariaLabel:L("ariaLabelColumnMenu","Column Menu")}),!Z)_.showTabBasedOnPreviousSelection?.(),Q(_);if(h2(this.gos)){let D=K.setPopupPositionRelatedToElement(H,U);if(D&&$)this.addStopAnchoring(D,$,B)}if(_.addEventListener("tabSelected",(D)=>{this.dispatchVisibleChangedEvent(!1,!0,$),this.lastSelectedTab=D.key,this.dispatchVisibleChangedEvent(!0,!0,$)}),$)z1($,!0,"contextMenu");this.activeMenu=_,_.addEventListener("destroyed",()=>{if(this.activeMenu===_)this.activeMenu=null})}addStopAnchoring($,z,Q){$.then((J)=>{z.__addEventListener("leftChanged",J),z.__addEventListener("visibleChanged",J),Q.push(()=>{z.__removeEventListener("leftChanged",J),z.__removeEventListener("visibleChanged",J)})})}getMenuParams($,z,Q,J){let{focusSvc:Z,visibleCols:X,ctrlsSvc:Y}=this.beans,q={column:$,headerPosition:Z.focusedHeader,columnIndex:X.allCols.indexOf($),eventSource:J},G=this.createMenu($,z,q,Q,J);return G?{menu:G,eMenuGui:G.getGui(),anchorToElement:J||Y.getGridBodyCtrl().eGridBody,restoreFocusParams:q}:void 0}createMenu($,z,Q,J,Z){if(U0(this.gos))return this.createBean(new zR($,Q,this.lastSelectedTab,J,Z));else{let X=this.beans.colMenuFactory.getMenuItems($,z);return X.length?this.createBean(new QR(X,$,Q,Z)):void 0}}dispatchVisibleChangedEvent($,z,Q,J,Z){this.eventSvc.dispatchEvent({type:"columnMenuVisibleChanged",visible:$,switchingTab:z,key:this.lastSelectedTab??Z??(U0(this.gos)?Mz:"columnMenu"),column:Q??null,columnGroup:J??null})}isMenuEnabled($){if(!U0(this.gos))return!0;let z=!this.beans.filterManager?.isFilterAllowed($),Q=$.getColDef().menuTabs??ZZ;return(z&&Q.includes(Fz)?Q.length-1:Q.length)>0}showMenuAfterContextMenuEvent($,z,Q){this.beans.menuUtils.onContextMenu({mouseEvent:z,touchEvent:Q,source:"ui",showMenuCallback:(J)=>{return this.showMenuAfterMouseEvent($,J,"columnMenu"),!0}})}},zR=class extends S{constructor($,z,Q,J,Z){super();this.column=$,this.restoreFocusParams=z,this.initialSelection=Q,this.restrictTo=J,this.sourceElement=Z,this.tabFactories={},this.includeChecks={};let{tabFactories:X,includeChecks:Y}=this;X[Mz]=this.createMainPanel.bind(this),X[Fz]=this.createFilterPanel.bind(this),X[tz]=this.createColumnsPanel.bind(this),Y[Mz]=()=>!0,Y[Fz]=()=>$?!!this.beans.filterManager?.isFilterAllowed($):!1,Y[tz]=()=>!0}postConstruct(){let $=this.getTabsToCreate().map((Q)=>this.createTab(Q)),z=new qA({items:$,cssClass:"ag-menu",onActiveItemClicked:this.onHidePopup.bind(this),onItemClicked:this.onTabItemClicked.bind(this)});this.tabbedLayout=this.createBean(z),this.mainMenuList?.setParentComponent(z),this.addDestroyFunc(()=>this.destroyBean(z))}getTabsToCreate(){if(this.restrictTo)return this.restrictTo;return(this.column?.getColDef().menuTabs??ZZ).filter(($)=>this.isValidMenuTabItem($)&&this.isNotSuppressed($))}isValidMenuTabItem($){let z=!0,Q=ZZ;if(this.restrictTo!=null)z=this.restrictTo.indexOf($)>-1,Q=this.restrictTo;if(z=z&&ZZ.indexOf($)>-1,!z)j(175,{menuTabName:$,itemsToConsider:Q});return z}isNotSuppressed($){return this.includeChecks[$]()}createTab($){return this.tabFactories[$]()}showTabBasedOnPreviousSelection(){this.showTab(this.initialSelection)}showTab($){let{tabItemColumns:z,tabbedLayout:Q,tabItemFilter:J,tabItemGeneral:Z}=this;if(z&&$===tz)Q.showItem(z);else if(J&&$===Fz)Q.showItem(J);else if(Z&&$===Mz)Q.showItem(Z);else Q.showFirstItem()}onTabItemClicked($){let z=null;switch($.item){case this.tabItemColumns:z=tz;break;case this.tabItemFilter:z=Fz;break;case this.tabItemGeneral:z=Mz;break}if(z)this.activateTab(z)}activateTab($){let z={type:"tabSelected",key:$};this.dispatchLocalEvent(z)}createMainPanel(){let{beans:$,column:z}=this,Q=$.colMenuFactory,J=Q.createMenu(this,Q.getMenuItems(z),this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=J,J.addEventListener("closeMenu",this.onHidePopup.bind(this));let Z={title:h("legacyMenu",$,z),titleLabel:Mz.replace("MenuTab",""),bodyPromise:g.resolve(J.getGui()),name:Mz};return this.tabItemGeneral=Z,Z}onHidePopup($){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,$)}createFilterPanel(){let $=this.column?this.createBean(new w4(this.column,"COLUMN_MENU")):null;if(this.filterComp=$,!$?.hasFilter())e(119);let z=(J)=>$?.afterGuiAttached(J),Q=()=>$?.afterGuiDetached();return this.tabItemFilter={title:h("filterTab",this.beans,this.column),titleLabel:Fz.replace("MenuTab",""),bodyPromise:g.resolve($?.getGui()),afterAttachedCallback:z,afterDetachedCallback:Q,name:Fz},this.tabItemFilter}createColumnsPanel(){let $=J0({tag:"div",cls:"ag-menu-column-select-wrapper"}),{beans:z,column:Q}=this,Z=z.colChooserFactory.createColumnSelectPanel(this,Q).getGui();Z.classList.add("ag-menu-column-select"),$.appendChild(Z);let X={title:h("columns",z,Q),titleLabel:tz.replace("MenuTab",""),bodyPromise:g.resolve($),name:tz};return this.tabItemColumns=X,X}afterGuiAttached($){let{container:z,hidePopup:Q}=$;if(this.tabbedLayout.setAfterAttachedParams({container:z,hidePopup:Q}),Q)this.hidePopupFunc=Q,this.addDestroyFunc(Q)}getGui(){return this.tabbedLayout.getGui()}destroy(){super.destroy(),this.destroyBean(this.filterComp)}},QR=class extends x{constructor($,z,Q,J){super({tag:"div",ref:"eColumnMenu",cls:"ag-menu ag-column-menu",role:"presentation"});this.menuItems=$,this.column=z,this.restoreFocusParams=Q,this.sourceElement=J,this.eColumnMenu=f}postConstruct(){let $=this.beans.colMenuFactory.createMenu(this,this.menuItems,this.column,()=>this.sourceElement??this.getGui());this.mainMenuList=$,$.addEventListener("closeMenu",this.onHidePopup.bind(this)),this.eColumnMenu.appendChild($.getGui())}onHidePopup($){this.beans.menuUtils.closePopupAndRestoreFocusOnSelect(this.hidePopupFunc,this.restoreFocusParams,$)}afterGuiAttached({hidePopup:$}){if($)this.hidePopupFunc=$,this.addDestroyFunc($);F0(this.mainMenuList.getGui())}};function JR($,z){$.colChooserFactory?.showColumnChooser({chooserParams:z})}function ZR($){$.colChooserFactory?.hideActiveColumnChooser()}var XR=class extends S{constructor(){super(...arguments);this.beanName="menuUtils"}restoreFocusOnClose($,z,Q,J){let{eventSource:Z}=$,X=Q instanceof KeyboardEvent;if(!J&&!X||!Z)return;let Y=d(this.beans);if(!z.contains(Y)&&!hz(this.beans))return;this.focusHeaderCell($)}closePopupAndRestoreFocusOnSelect($,z,Q){let J;if(Q?.keyboardEvent)J=Q.keyboardEvent;$(J&&{keyboardEvent:J});let Z=this.beans,X=Z.focusSvc,Y=X.getFocusedCell();if(hz(Z))if(Y){let{rowIndex:q,rowPinned:G,column:_}=Y;X.setFocusedCell({rowIndex:q,column:_,rowPinned:G,forceBrowserFocus:!0,preventScrollOnBrowserFocus:!0})}else this.focusHeaderCell(z)}onContextMenu($){let{mouseEvent:z,touchEvent:Q,showMenuCallback:J,source:Z}=$;if(!this.gos.get("allowContextMenuWithControlKey")){if(z&&(z.ctrlKey||z.metaKey))return}if(z)this.blockMiddleClickScrollsIfNeeded(z);if(Z==="ui"&&this.gos.get("suppressContextMenu"))return;let X=z??Q.touches[0];if(J(X)){let Y=z??Q;if(Y?.cancelable)Y.preventDefault()}}async focusHeaderCell($){let{column:z,columnIndex:Q,headerPosition:J,eventSource:Z}=$,{visibleCols:X,headerNavigation:Y,focusSvc:q}=this.beans,G=await X.allCols.some((_)=>_===z);if(!this.isAlive())return;if(z?.isAlive()&&G&&Z&&A0(Z)){let _=xJ(Z);if(_)Y?.scrollToColumn(z),_.focus()}else if(J&&Q!==-1){let _=X.allCols,H=_[Q]||b(_);if(H)q.focusHeaderPosition({headerPosition:{headerRowIndex:J.headerRowIndex,column:H}})}}blockMiddleClickScrollsIfNeeded($){if(this.gos.get("suppressMiddleClickScrolls")&&$.which===2)$.preventDefault()}},YR={moduleName:"MenuCore",version:Q0,beans:[aS,iS,XR],icons:{chart:"chart",columns:"columns",loadingMenuItems:"loading",menuPin:"pin",menuValue:"aggregation",menuAddRowGroup:"group",menuRemoveRowGroup:"group",clipboardCopy:"copy",clipboardCut:"cut",clipboardPaste:"paste",save:"save",csvExport:"csv",excelExport:"excel",sortAscending:"asc",sortDescending:"desc",sortAbsoluteAscending:"aasc",sortAbsoluteDescending:"adesc",sortUnSort:"none"},dependsOn:[I0,nz,v4,X5]},tX={moduleName:"ColumnMenu",version:Q0,beans:[$R,eS,tS],icons:{ensureColumnVisible:"column-arrow",legacyMenu:"menu",filterTab:"filter",columnSelectClosed:"tree-closed",columnSelectOpen:"tree-open",columnSelectIndeterminate:"tree-indeterminate"},apiFunctions:{showColumnChooser:JR,hideColumnChooser:ZR},dependsOn:[YR,L1,D1]};var qR=".ag-status-bar{border-top:var(--ag-footer-row-border);display:flex;justify-content:space-between;line-height:1.5;overflow:hidden;padding-left:calc(var(--ag-spacing)*4);padding-right:calc(var(--ag-spacing)*4)}.ag-status-panel,:where(.ag-status-panel.ag-status-panel-aggregations .ag-status-name-value){display:inline-flex}.ag-status-name-value{color:var(--ag-status-bar-label-color);font-weight:var(--ag-status-bar-label-font-weight);margin-left:var(--ag-spacing);margin-right:var(--ag-spacing);padding-bottom:var(--ag-widget-container-vertical-padding);padding-top:var(--ag-widget-container-vertical-padding);white-space:nowrap}.ag-status-name-value-value{color:var(--ag-status-bar-value-color);font-weight:var(--ag-status-bar-value-font-weight)}.ag-status-bar-left{display:inline-flex}.ag-status-bar-center{display:inline-flex;text-align:center}.ag-status-bar-right{display:inline-flex}";function GR($,z,Q){return $.getCompDetails(z,_R,void 0,Q,!0)}var _R={name:"statusPanel",optionalMethods:["refresh"]},HR={agAggregationComponent:{rowModels:["clientSide","serverSide"],warnArgs:[221]},agFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[222]},agSelectedRowCountComponent:{rowModels:["clientSide","serverSide"],warnArgs:[223]},agTotalAndFilteredRowCountComponent:{rowModels:["clientSide"],warnArgs:[224]},agTotalRowCountComponent:{rowModels:["clientSide"],warnArgs:[225]}},UR={tag:"div",cls:"ag-status-bar",children:[{tag:"div",ref:"eStatusBarLeft",cls:"ag-status-bar-left",role:"status"},{tag:"div",ref:"eStatusBarCenter",cls:"ag-status-bar-center",role:"status"},{tag:"div",ref:"eStatusBarRight",cls:"ag-status-bar-right",role:"status"}]},WR=class extends x{constructor(){super(UR);this.updateQueued=!1,this.panelsPromise=g.resolve(),this.eStatusBarLeft=f,this.eStatusBarCenter=f,this.eStatusBarRight=f,this.compDestroyFunctions={},this.registerCSS(qR)}wireBeans($){this.userCompFactory=$.userCompFactory,this.statusBarSvc=$.statusBarSvc}postConstruct(){this.processStatusPanels(new Map),this.addManagedPropertyListeners(["statusBar"],this.handleStatusBarChanged.bind(this)),Bz(this.beans,this,this.getGui())}getFocusableContainerName(){return"statusBar"}getValidPanels(){let $=this.gos,z=$.get("statusBar")?.statusPanels;if(!z)return z;return z.filter((Q)=>{let{rowModels:J,warnArgs:Z}=HR[Q.statusPanel]??{};if(!J)return!0;if(J.includes($.get("rowModelType")))return!0;return j(...Z),!1})}processStatusPanels($){let z=this.getValidPanels();if(z){let Q=z.filter((X)=>X.align==="left"),J=z.filter((X)=>X.align==="center"),Z=z.filter((X)=>!X.align||X.align==="right");this.panelsPromise=g.all([this.createAndRenderComponents(Q,this.eStatusBarLeft,$),this.createAndRenderComponents(J,this.eStatusBarCenter,$),this.createAndRenderComponents(Z,this.eStatusBarRight,$)])}else this.setDisplayed(!1)}handleStatusBarChanged(){if(this.updateQueued)return;this.updateQueued=!0,this.panelsPromise.then(()=>{this.updateStatusBar(),this.updateQueued=!1})}updateStatusBar(){let $=this.getValidPanels(),z=Array.isArray($)&&$.length>0;this.setDisplayed(z);let Q=new Map;if(z)for(let J of $){let Z=J.key??J.statusPanel,X=this.statusBarSvc.getStatusPanel(Z);if(X?.refresh){let Y=y(this.gos,{...J.statusPanelParams??{},key:Z});if(X.refresh(Y))Q.set(Z,X),delete this.compDestroyFunctions[Z],T0(X.getGui())}}if(this.resetStatusBar(),z)this.processStatusPanels(Q)}resetStatusBar(){z0(this.eStatusBarLeft),z0(this.eStatusBarCenter),z0(this.eStatusBarRight),this.destroyComponents(),this.statusBarSvc.unregisterAllComponents()}destroy(){this.destroyComponents(),super.destroy()}destroyComponents(){for(let $ of Object.values(this.compDestroyFunctions))$();this.compDestroyFunctions={}}createAndRenderComponents($,z,Q){let J=[];for(let Z of $){let X=Z.key||Z.statusPanel,Y=Q.get(X),q;if(Y)q=g.resolve(Y);else{let G=GR(this.userCompFactory,Z,y(this.gos,{key:X}));if(G==null)continue;q=G.newAgStackInstance()}J.push({key:X,promise:q})}return g.all(J.map((Z)=>Z.promise)).then(()=>{for(let Z of J)Z.promise.then((X)=>{let Y=()=>{this.destroyBean(X)};if(this.isAlive())this.statusBarSvc.registerStatusPanel(Z.key,X),z.appendChild(X.getGui()),this.compDestroyFunctions[Z.key]=Y;else Y()})})}},BR={selector:"AG-STATUS-BAR",component:WR},ER={tag:"div",cls:"ag-status-name-value",children:[{tag:"span",ref:"eLabel"},": ",{tag:"span",ref:"eValue",cls:"ag-status-name-value-value"}]},KR=BigInt(Number.MIN_SAFE_INTEGER),LR=BigInt(Number.MAX_SAFE_INTEGER),C1=class extends x{constructor(){super(ER);this.eLabel=f,this.eValue=f}setLabel($,z){this.setDisplayed(!1),this.eLabel.textContent=this.getLocaleTextFunc()($,z)}setValue($,z){let Q=null,J;if(typeof $==="bigint"){if(J=$,$>=KR&&$<=LR)Q=Number($)}else Q=$;this.eValue.textContent=this.valueFormatter(y(this.gos,{value:Q,bigintValue:J,totalRows:z,key:this.key}))}},DR={selector:"AG-NAME-VALUE",component:C1},sX=($)=>{let z=0;return $.forEachNodeAfterFilter((Q)=>{if(Q.data)z++}),z},b1=($)=>{let z=0;return $.forEachNode((Q)=>{if(Q.data)z++}),z};function FR($,z){if(typeof $!=="number")return"";return M$(Math.round($*100)/100,z)}var MR={tag:"div",cls:"ag-status-panel ag-status-panel-aggregations",children:[{tag:"ag-name-value",ref:"avgAggregationComp"},{tag:"ag-name-value",ref:"countAggregationComp"},{tag:"ag-name-value",ref:"minAggregationComp"},{tag:"ag-name-value",ref:"maxAggregationComp"},{tag:"ag-name-value",ref:"sumAggregationComp"}]},kR=class extends x{constructor(){super(MR,[DR]);this.sumAggregationComp=f,this.countAggregationComp=f,this.minAggregationComp=f,this.maxAggregationComp=f,this.avgAggregationComp=f}postConstruct(){this.avgAggregationComp.setLabel("avg","Average"),this.countAggregationComp.setLabel("count","Count"),this.minAggregationComp.setLabel("min","Min"),this.maxAggregationComp.setLabel("max","Max"),this.sumAggregationComp.setLabel("sum","Sum"),this.addManagedEventListeners({cellSelectionChanged:this.onCellSelectionChanged.bind(this),modelUpdated:this.onCellSelectionChanged.bind(this)})}init($){this.refresh($)}refresh($){this.params=$;let z=$.valueFormatter??((J)=>{let{value:Z,bigintValue:X}=J;if(X!=null)return X.toString();return FR(Z,this.getLocaleTextFunc.bind(this))}),Q=["avg","count","min","max","sum"];for(let J of Q){let Z=this.getAllowedAggregationValueComponent(J);if(Z)Z.key=J,Z.valueFormatter=z.bind(this)}return this.onCellSelectionChanged(),!0}setAggregationComponentValue($,z,Q){let J=this.getAllowedAggregationValueComponent($),Z=b1(this.beans.rowModel);if(T(J)&&J)J.setValue(z,Z),J.setDisplayed(Q);else this.getAggregationValueComponent($)?.setDisplayed(!1)}getAllowedAggregationValueComponent($){let{aggFuncs:z}=this.params;if(!z||z.includes($))return this.getAggregationValueComponent($);return null}getAggregationValueComponent($){let z=`${$}AggregationComp`;return this[z]}onCellSelectionChanged(){let $=this.beans,{rangeSvc:z,valueSvc:Q}=$,J=z?.getCellRanges(),Z=0,X=0n,Y=!1,q=!1,G=0,_=0,H=null,U=null,W=null,B=null,E=(v)=>{if(typeof v==="number"){if(Z+=v,H===null||vU)U=v;if(!Number.isInteger(v)||!Number.isSafeInteger(v))q=!0;else{let C=BigInt(v);if(X+=C,W===null||CB)B=C}}else{if(Y=!0,X+=v,W===null||vB)B=v;let C=Number(v);if(Z+=C,H===null||CU)U=C}_++},K={};if(J?.length&&z)for(let v=0;v{if(m===null)return;let u=b$({rowPinned:m.rowPinned,column:t,rowIndex:m.rowIndex});if(K[u])return;K[u]=!0;let $0=M0($,m);if(n($0))return;let s=Q.getValue(t,$0,"data");if(n(s)||s==="")return;if(G++,typeof s==="object"&&"value"in s){if(s=s.value,s==="")return}if(typeof s==="string"){let f0=s.trim();if(f0==="")return;let O0=Number(f0);if(!Number.isFinite(O0))return;if(Z+O0>=Number.MAX_SAFE_INTEGER||Z+O0<=Number.MIN_SAFE_INTEGER||O0>=Number.MAX_SAFE_INTEGER||O0<=Number.MIN_SAFE_INTEGER){if(s=Gz(f0),s===null)s=O0}else s=O0}if(typeof s==="number"&&!isNaN(s)||typeof s==="bigint")E(s)}),m=L0($,m)}}let L=G>1,D=_>1,F=Y&&!q,M;if(F)M=X/BigInt(_);else M=Z/_;let k=D?F?X:Z:null,V=D?F?W:H:null,R=D?F?B:U:null,O=D?M:null,I=D;this.setAggregationComponentValue("count",G,L),this.setAggregationComponentValue("sum",k,D),this.setAggregationComponentValue("min",V,D),this.setAggregationComponentValue("max",R,D),this.setAggregationComponentValue("avg",O,I)}},VR=class extends C1{postConstruct(){this.setLabel("filteredRows","Filtered"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-filtered-row-count"),this.setDisplayed(!0);let $=this.onDataChanged.bind(this);this.addManagedEventListeners({modelUpdated:$})}onDataChanged(){let{rowModel:$}=this.beans,z=b1($),Q=sX($);this.setValue(Q,z),this.setDisplayed(z!==Q)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>M$(z,this.getLocaleTextFunc.bind(this)))}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},AR=class extends C1{postConstruct(){this.setLabel("selectedRows","Selected"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-selected-row-count");let $=this.onRowSelectionChanged.bind(this);this.addManagedEventListeners({modelUpdated:$,selectionChanged:$})}onRowSelectionChanged(){let{selectionSvc:$,rowModel:z}=this.beans,Q=$?.getSelectionCount()??0,J=b1(z);if(this.setValue(Q,J),Q<0){this.setDisplayed(!0);return}this.setDisplayed(Q>0)}init($){this.refresh($),this.onRowSelectionChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>{if(z==null||z>=0)return M$(z,this.getLocaleTextFunc.bind(this));return this.getLocaleTextFunc()("statusBarLastRowUnknown","?")})}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},SR=class extends C1{postConstruct(){this.setLabel("totalAndFilteredRows","Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-and-filtered-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){let{rowModel:$}=this.beans,z=sX($),Q=b1($);this.setValue(z,Q)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z,totalRows:Q})=>{let J=this.getLocaleTextFunc.bind(this),Z=M$(z,J),X=M$(Q??z,J);if(z===Q)return Z;let Y=J();return`${Z} ${Y("of","of")} ${X}`})}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}},RR=class extends C1{postConstruct(){this.setLabel("totalRows","Total Rows"),this.addCss("ag-status-panel"),this.addCss("ag-status-panel-total-row-count"),this.setDisplayed(!0),this.addManagedEventListeners({modelUpdated:this.onDataChanged.bind(this)})}onDataChanged(){let $=b1(this.beans.rowModel);this.setValue($,$)}init($){this.refresh($),this.onDataChanged()}updateValueFormatter($){this.valueFormatter=$??(({value:z})=>M$(z,this.getLocaleTextFunc.bind(this)))}refresh($){let{key:z,valueFormatter:Q}=$;return this.key=z,this.updateValueFormatter(Q),!0}};function jR($,z){let Q=$.statusBarSvc?.getStatusPanel(z);return m$(Q)}var fR=class extends S{constructor(){super();this.beanName="statusBarSvc",this.comps=new Map}registerStatusPanel($,z){this.comps.set($,z)}unregisterStatusPanel($){this.comps.delete($)}unregisterAllComponents(){this.comps.clear()}getStatusPanel($){return this.comps.get($)}destroy(){this.unregisterAllComponents(),super.destroy()}},rX={moduleName:"StatusBar",version:Q0,beans:[fR],userComponents:{agAggregationComponent:kR,agTotalRowCountComponent:RR,agFilteredRowCountComponent:VR,agTotalAndFilteredRowCountComponent:SR,agSelectedRowCountComponent:AR},selectors:[BR],apiFunctions:{getStatusPanel:jR},dependsOn:[I0,iz]};function lX($){if($.excelCreator?.getFactoryMode()==="MULTI_SHEET")return j(161),!1;return!0}function OR($,z){if(lX($))return $.excelCreator?.getDataAsExcel(z);return}function PR($,z){if(lX($))$.excelCreator?.exportDataAsExcel(z)}function TR($,z){return $.excelCreator?.setFactoryMode("MULTI_SHEET"),$.excelCreator?.getSheetDataForExcel(z)}function vR($,z){return $.excelCreator?.getMultipleSheetsAsExcel(z)}function IR($,z){$.excelCreator?.exportMultipleSheetsAsExcel(z)}var aX={moduleName:"ExcelExport",version:Q0,beans:[sV],apiFunctions:{getDataAsExcel:OR,exportDataAsExcel:PR,getSheetDataForExcel:TR,getMultipleSheetsAsExcel:vR,exportMultipleSheetsAsExcel:IR},dependsOn:[f4,I0]};function LZ($){let{filters:z}=$;return z&&z.length>0?z:[{filter:"agTextColumnFilter"},{filter:"agSetColumnFilter"}]}function UZ($,z){if($==null)return;for(let Q=$.length-1;Q>=0;Q--)z($[Q],Q)}function CR($,z){if(z.title!=null)return z.title;return $ instanceof wJ?$.getFilterTitle():"Filter"}function WZ($,z,Q,J){let Z=[],X=$?.filterModels;for(let Y=0;YY==null)?null:{filterType:"multi",filterModels:Z}}function n$($,z){return $?.filterModels?.[z]??null}function BZ($,z,Q,J){let Z=Q.filterValueGetter;return Z?$.colFilter.createGetValue(z,Z):J}var oX=class extends H4{constructor(){super({tag:"div",cls:"ag-multi-filter ag-menu-list-compact"});this.filterDefs=[],this.guiDestroyFuncs=[],this.filterGuis=[],this.lastActivatedMenuItem=null}postConstruct(){this.initialiseTabGuard({onFocusIn:($)=>this.onFocusIn($)})}refreshGui($){if($===this.lastOpenedInContainer)return g.resolve();return this.tabGuardFeature.removeAllChildrenExceptTabGuards(),this.destroyChildren(),g.all(this.getFilterWrappers().map((z,Q)=>{if(!z)return g.resolve(null);let J=this.getFilterFromWrapper(z),Z=this.getCompFromWrapper(z),X=this.filterDefs[Q],Y=CR(J,X),q;if(X.display==="subMenu"&&$!=="toolPanel")q=this.insertFilterMenu(Z,J,Y).then((G)=>G.getGui());else if(X.display==="subMenu"||X.display==="accordion"){let G=this.insertFilterGroup(J,Z,Y);q=g.resolve(G.getGui())}else q=g.resolve(Z.getGui());return q})).then((z)=>{z.forEach((Q,J)=>{if(!Q)return;if(J>0)this.appendChild(J0({tag:"div",cls:"ag-filter-separator"}));this.appendChild(Q)}),this.filterGuis=z,this.lastOpenedInContainer=$})}destroyChildren(){for(let $ of this.guiDestroyFuncs)$();this.guiDestroyFuncs.length=0,this.filterGuis.length=0}insertFilterMenu($,z,Q){let J=$.getGui();_0(J,"dialog");let Z=this.createBean(new _S),X={getGui:()=>$.getGui(),afterGuiAttached:(Y)=>{if($.afterGuiAttached?.(Y),$!==z)z.afterGuiAttached?.(Y)}};return Z.init({menuItemDef:{name:Q,subMenu:[],subMenuRole:"dialog",cssClasses:["ag-multi-filter-menu-item"],menuItem:TX,menuItemParams:{cssClassPrefix:"ag-compact-menu-option",isCompact:!0}},level:0,isAnotherSubMenuOpen:()=>!1,childComponent:X,contextParams:{column:null,node:null,value:null}}).then(()=>{Z.setParentComponent(this),this.guiDestroyFuncs.push(()=>this.destroyBean(Z)),this.addManagedListeners(Z,{menuItemActivated:(q)=>{if(this.lastActivatedMenuItem&&this.lastActivatedMenuItem!==q.menuItem)this.lastActivatedMenuItem.deactivate();this.lastActivatedMenuItem=q.menuItem}});let Y=Z.getGui();return Z.addManagedElementListeners(Y,{keydown:(q)=>{let{key:G}=q;switch(G){case A.UP:case A.RIGHT:case A.DOWN:case A.LEFT:if(q.preventDefault(),G===A.RIGHT)Z.openSubMenu(!0);break}},focusin:()=>Z.activate(),focusout:()=>{if(!Z.isSubMenuOpen()&&!Z.isSubMenuOpening())Z.deactivate()}}),Z})}insertFilterGroup($,z,Q){let J=this.createBean(new HA({title:Q,cssIdentifier:"multi-filter"}));if(this.guiDestroyFuncs.push(()=>this.destroyBean(J)),J.addItem(z.getGui()),J.toggleGroupExpand(!1),$.afterGuiAttached)J.addManagedListeners(J,{expanded:()=>$.afterGuiAttached({container:this.lastOpenedInContainer,suppressFocus:!0,hidePopup:this.hidePopup})});return J}afterGuiAttached($){let z;if($)this.hidePopup=$.hidePopup,z=this.refreshGui($.container);else this.hidePopup=void 0,z=g.resolve();let Q=$?.suppressFocus;z.then(()=>{let{filterDefs:J,filterGuis:Z,beans:X}=this,Y=this.getFilterWrappers(),q=!!Q;if(J)UZ(J,(_,H)=>{let U=H===0,W=_.display&&_.display!=="inline",B=Q||!U||W,E={...$??{},suppressFocus:B},K=Y[H],L=K?this.getFilterFromWrapper(K):void 0;if(K){let D=this.getCompFromWrapper(K);if(D!==L)D.afterGuiAttached(E)}if(L){if(this.executeFunctionIfExistsOnFilter(L,"afterGuiAttached",E),U&&!B)q=!0}if(!Q&&U&&W){let D=Z[H];if(D){if(!F0(D))D.focus({preventScroll:!0});q=!0}}});let G=d(X);if(!q&&(hz(X)||this.getGui().contains(G)))this.forceFocusOutOfContainer(!0)})}afterGuiDetached(){this.executeFunctionIfExists("afterGuiDetached")}onAnyFilterChanged(){this.executeFunctionIfExists("onAnyFilterChanged",($)=>this.executeOnWrapper($,"onAnyFilterChanged"))}onNewRowsLoaded(){this.executeFunctionIfExists("onNewRowsLoaded",($)=>this.executeOnWrapper($,"onNewRowsLoaded"))}destroy(){this.destroyChildren(),this.hidePopup=void 0,super.destroy()}executeOnWrapper($,z){}executeFunctionIfExists($,z){UZ(this.getFilterWrappers(),(Q)=>{if(Q)z?.(Q),this.executeFunctionIfExistsOnFilter(this.getFilterFromWrapper(Q),$)})}executeFunctionIfExistsOnFilter($,z,...Q){let J=$[z];if(typeof J==="function")J.apply($,Q)}onFocusIn($){let z=this.lastActivatedMenuItem;if(z!=null&&!z.getGui().contains($.target))z.deactivate(),this.lastActivatedMenuItem=null}},eX=class extends oX{constructor(){super(...arguments);this.filterType="multi",this.wrappers=[],this.activeFilterIndices=[],this.afterFiltersReadyFuncs=[]}init($){this.params=$,this.filterDefs=LZ($);let z=D0(this.beans.colFilter.model,$.column.getColId()),{filterChangedCallback:Q}=$;this.filterChangedCallback=Q;let J=this.filterDefs.map((Z,X)=>this.createFilter(Z,X,z));return new g((Z)=>{g.all(J).then((X)=>{this.wrappers=X,this.refreshGui("columnMenu").then(()=>{Z()})})}).then(()=>{for(let Z of this.afterFiltersReadyFuncs)Z();this.afterFiltersReadyFuncs.length=0})}refresh($){return this.params=$,!0}isFilterActive(){return this.wrappers.some(($)=>{if(!$)return!1;let{filter:z,handler:Q,model:J}=$;if(Q)return J!=null;return z.isFilterActive()})}getLastActiveFilterIndex(){let $=this.activeFilterIndices;return $.length>0?$[$.length-1]:null}doesFilterPass($,z){return this.wrappers.every((Q,J)=>{if(!Q||z!=null&&J===z)return!0;let{handler:Z,filter:X,model:Y}=Q;if(Z)return Y==null||Z.doesFilterPass({...$,model:Y,handlerParams:Q.handlerParams});return!X.isFilterActive()||X.doesFilterPass($)})}getModelFromUi(){return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let Q=z.filter;if(typeof Q.getModelFromUi==="function")return Q.getModelFromUi();return null})}}getModel(){if(!this.isFilterActive())return null;return{filterType:this.filterType,filterModels:this.wrappers.map((z)=>{if(!z)return null;let{filter:Q,handler:J,model:Z}=z;if(J)return Z;return Q.isFilterActive()?Q.getModel():null})}}setModel($){let z=(J,Z)=>{return new g((X)=>{let Y=J.setModel(Z);if(Y)Y.then(X);else X()})},Q=[];return this.wrappers.forEach((J,Z)=>{if(!J)return;let X=n$($,Z),{filter:Y,filterParams:q,handler:G,handlerParams:_,state:H}=J;if(G){let U={model:X,state:H?.state};J.state=U,J.model=X,Q.push(sJ(()=>g.resolve({filter:Y,filterParams:q}),G,_,X,U,"api").then(()=>{this.updateActiveListForHandler(Z,J.model)}))}else Q.push(z(Y,X).then(()=>{this.updateActiveListForFilter(Z,Y)}))}),g.all(Q).then(()=>{})}applyModel($="api"){let z=!1;for(let Q of this.wrappers)if(Q){let J=Q.filter;if(J instanceof wJ)z=J.applyModel($)||z}return z}getChildFilterInstance($){return this.wrappers[$]?.filter}getNumChildFilters(){return this.wrappers.length}destroy(){for(let $ of this.wrappers)this.destroyBean($?.filter),this.destroyBean($?.handler);this.wrappers.length=0,super.destroy()}getFilterWrappers(){return this.wrappers}getFilterFromWrapper($){return $.filter}getCompFromWrapper($){return $.comp}executeOnWrapper($,z){$.handler?.[z]?.()}createFilter($,z,Q){let J=this.params.column,Z=null,X,Y=this.beans,q=(B,E)=>{let K=this.wrappers[z];if(!K)return;let L={model:B,state:K.state?.state};K.state=L,K.model=B,sJ(()=>g.resolve({filter:K.filter,filterParams:K.filterParams}),K.handler,K.handlerParams,B,L,"ui").then(()=>{this.onHandlerModelChanged(z,K.model,E)})},{compDetails:G,handler:_,handlerParams:H,createFilterUi:U}=Y.colFilter.createFilterInstance(J,$,"agTextColumnFilter",(B,E)=>{let K={...B,filterChangedCallback:E?()=>{}:(L)=>{this.executeWhenAllFiltersReady(()=>this.onFilterModelChanged(z,L))},doesRowPassOtherFilter:(L)=>B.doesRowPassOtherFilter(L)&&this.doesFilterPass({node:L,data:L.data},z),getValue:BZ(Y,J,$,B.getValue)};if(E)Z=n$(Q,z),X=this.updateDisplayParams(K,z,Z,()=>G,()=>_,q);return K});if(!U)return g.resolve(null);let W;if(_){let{doesRowPassOtherFilter:B,getValue:E}=H;W={...H,onModelChange:q,doesRowPassOtherFilter:(K)=>B(K)&&this.doesFilterPass({node:K,data:K.data},z),getValue:BZ(Y,J,$,E)},_.init?.({...W,model:Z,source:"init"})}return U().then((B)=>{if(!_)return{filter:B,comp:B};let E=G?.params,K=X(B);return{filter:B,comp:K,filterParams:E,handler:_,handlerParams:W,model:Z}})}updateDisplayParams($,z,Q,J,Z,X){let Y=this.params.column,q=new K$;$.model=Q,$.state={model:Q},$.onModelChange=X,$.getHandler=Z;let G=(H,U)=>{H.state=U,q.dispatchEvent({type:"filterStateChanged",column:Y,state:U})};$.onStateChange=(H)=>{let U=this.wrappers[z];if(!U)return;G(U,H),SQ(U.filter,U.filterParams,U.model??null,H,"ui")};let _=(H,U,W)=>{let B=this.wrappers[z];if(!B)return;let E=()=>B?.model??null;DJ({action:U,filterParams:B.filterParams,getFilterUi:()=>{let K=g.resolve(B.filter);return{created:!0,filterParams:B.filterParams,compDetails:J(),create:()=>K,promise:K}},getModel:E,getState:()=>B?.state??{model:E()},updateState:(K)=>G(B,K),updateModel:(K)=>B.filterParams?.onModelChange(K,W),processModelToApply:B.handler?.processModelToApply?.bind(B.handler)})};return $.onAction=(H,U,W)=>{_(Y,H,U),q.dispatchEvent({type:"filterAction",column:Y,action:H,event:W})},(H)=>{let U=J()?.params;return this.createManagedBean(new x4(Y,{comp:H,params:U,isHandler:!0},q,_,!1))}}executeWhenAllFiltersReady($){if((this.wrappers?.length??0)>0)$();else this.afterFiltersReadyFuncs.push($)}updateActiveListForFilter($,z){this.updateActiveList($,()=>z?.isFilterActive())}updateActiveListForHandler($,z){this.updateActiveList($,()=>z!=null)}updateActiveList($,z){let Q=this.activeFilterIndices;if(Z0(this.activeFilterIndices,$),z())Q.push($)}onFilterModelChanged($,z){this.updateActiveListForFilter($,this.wrappers[$]?.filter),this.filterChanged($,z)}onHandlerModelChanged($,z,Q){this.updateActiveListForHandler($,z),this.filterChanged($,Q)}filterChanged($,z){this.filterChangedCallback(z),this.wrappers.forEach((Q,J)=>{if($===J||!Q)return;let{filter:Z,handler:X}=Q;if(X?.onAnyFilterChanged?.(),typeof Z.onAnyFilterChanged==="function")Z.onAnyFilterChanged()})}getModelAsString($){if(!$?.filterModels?.length)return"";let z=this.getLastActiveFilterIndex()??0;return this.wrappers[z]?.filter?.getModelAsString?.($.filterModels[z])??""}},bR=class extends S{constructor(){super(...arguments);this.filterType="multi",this.handlerWrappers=[],this.activeFilterIndices=[],this.filterDefs=[]}init($){this.params=$;let z=LZ($.filterParams);this.filterDefs=z,z.forEach((Q,J)=>{let Z=this.beans.colFilter.createHandler($.column,Q,"agTextColumnFilter");if(this.handlerWrappers.push(Z),!Z){j(278,{colId:$.column.getColId()});return}let{handler:X,handlerParams:Y}=Z;X.init?.({...this.updateHandlerParams(Y,J,!0),model:n$($.model,J),source:"init"})}),this.resetActiveList($.model)}refresh($){this.params=$;let{model:z,source:Q,filterParams:J}=$,Z=J?.filters;if(this.handlerWrappers.forEach((X,Y)=>{if(X){let q=this.updateHandlerParams($,Y,!1,Z?.[Y].filterParams);X.handlerParams=q,X.handler.refresh?.({...q,model:n$(z,Y),source:Q})}}),$.source!=="floating"&&$.source!=="ui")this.resetActiveList($.model);if($.additionalEventAttributes?.fromButtons)this.onAnyFilterChanged()}updateHandlerParams($,z,Q,J){let{onModelChange:Z,doesRowPassOtherFilter:X,getValue:Y}=$,q={...$,onModelChange:(G,_)=>Z(WZ(this.params.model,this.handlerWrappers.length,G,z),_),doesRowPassOtherFilter:(G)=>X(G)&&this.doesFilterPass({node:G,data:G.data,model:this.params.model,handlerParams:q},z),getValue:BZ(this.beans,$.column,this.filterDefs[z],Y),filterParams:this.updateFilterParams($,Q,J)};return q}updateFilterParams($,z,Q){let J=$.filterParams;if(Q?.buttons&&z)j(292,{colId:$.column.getColId()});let Z=Q?{...J,...Q}:J;if(!Z.buttons)return Z;if(Q)return delete Z.buttons,Z;let{buttons:X,...Y}=Z;return Y}doesFilterPass($,z){let Q=$.model?.filterModels;if(Q==null)return!0;return this.handlerWrappers.every((J,Z)=>{let X=Q[Z];if(X==null||z!=null&&Z===z)return!0;let Y=J?.handler;return!Y||Y.doesFilterPass({...$,model:X,handlerParams:J.handlerParams})})}resetActiveList($){this.activeFilterIndices=[];let z=$?.filterModels;if(z==null)return;for(let Q=0;Q0?$[$.length-1]:null}getModelAsString($,z){let Q=z==="filterToolPanel",J=()=>Q?this.getLocaleTextFunc()("filterSummaryInactive","is (All)"):"";if(!$?.filterModels?.length)return J();let Z=this.getLastActiveFilterIndex()??0;return this.handlerWrappers[Z]?.handler.getModelAsString?.($.filterModels[Z],z)??J()}getHandler($){return this.handlerWrappers[$]?.handler}onAnyFilterChanged(){UZ(this.handlerWrappers,($)=>$?.handler?.onAnyFilterChanged?.())}onNewRowsLoaded(){UZ(this.handlerWrappers,($)=>$?.handler?.onNewRowsLoaded?.())}destroy(){for(let $ of this.handlerWrappers)this.destroyBean($?.handler);this.handlerWrappers.length=0,super.destroy()}},yR=class extends S{constructor(){super(...arguments);this.beanName="multiFilter"}getParamsForDataType($,z,Q,J){let Z=$?.filters,X=this.beans;if(!Z)Z=[{filter:C4(Q.baseDataType)},{filter:"agSetColumnFilter"}];let Y=this.getLocaleTextFunc();return Z=Z.map((q)=>{let{filter:G,filterParams:_,filterValueGetter:H}=q;if(typeof G!=="string")return q;let{filterParams:U,filterValueGetter:W}=I4(G,_,H??z,Q,J,X,Y);return{...q,filterParams:U,filterValueGetter:W}}),{filterParams:{...$,filters:Z}}}},$Y=class extends oX{constructor(){super(...arguments);this.filterType="multi",this.filters=[],this.filterParams=[],this.validity=[]}init($){this.params=$;let z=LZ($).map((J)=>{if(J.filterParams?.buttons){j(292,{colId:$.column.getColId()});let Z={...J.filterParams};return delete Z.buttons,{...J,filterParams:Z}}return J});this.filterDefs=z,this.allState=$.state;let Q=this.filterDefs.map((J,Z)=>this.createFilter(J,Z));return new g((J)=>{g.all(Q).then((Z)=>{this.filters=Z,this.refreshGui("columnMenu").then(()=>{J()})})})}refresh($){let{model:z,state:Q,source:J}=$;if(J==="colDef")return!1;this.params=$;let Z=this.filterParams;if(Q===this.allState)return!0;this.allState=Q;let X=Q.state;return this.filters.forEach((Y,q)=>{let G=n$(z,q),_={state:X?.[q],model:n$(Q.model,q)};SQ(Y,Z[q],G,_,J)}),!0}getLastActiveFilterIndex(){return this.getHandler().getLastActiveFilterIndex?.()??null}getChildFilterInstance($){return this.filters[$]??void 0}getNumChildFilters(){return this.filters.length}destroy(){for(let $ of this.filters)this.destroyBean($);this.filters.length=0,super.destroy()}getFilterWrappers(){return this.filters}getFilterFromWrapper($){return $}getCompFromWrapper($){return $}createFilter($,z){let Q=this.beans.userCompFactory,J=this.updateParams($,this.params,z),Z=d2(Q,$,J,"agTextColumnFilter");if(!Z)return g.resolve(null);return this.filterParams[z]=Z.params,Z.newAgStackInstance()}updateParams($,z,Q){let{doesRowPassOtherFilter:J,model:Z,onModelChange:X,state:Y,onStateChange:q,column:G,source:_,onAction:H,onUiChange:U,getValue:W}=z,B=n$(Z,Q),E=Y?{model:n$(Y.model,Q),state:Y.state?.[Q]}:{model:B},K=()=>{let D=this.getHandler();this.filters.forEach((F,M)=>{if(Q!==M)D.getHandler(M)?.onAnyFilterChanged?.(),F?.onAnyFilterChanged?.()})},L=this.beans.colFilter;return{...L.createBaseFilterParams(G),...$,doesRowPassOtherFilter:(D)=>J(D)&&this.getHandler().doesFilterPass({node:D,data:D.data,model:this.params.model,handlerParams:L.getHandlerParams(G)},Q),model:B,state:E,onModelChange:(D,F)=>{let{filters:M,params:k}=this,V=WZ(k.model,M.length,D,Q);this.updateActiveList(Q,D),X(V,F),K()},onStateChange:(D)=>this.onStateChange(q,Q,D),getHandler:()=>this.getHandler().getHandler(Q),onAction:(D,F,M)=>{if(W1(z))return;let k=D==="apply"||D==="reset";if(k)this.updateActiveList(Q,n$(this.params.state.model,Q));if(H(D,F,M),k)K()},onUiChange:U,source:_,getValue:BZ(this.beans,G,$,W)}}updateActiveList($,z){this.getHandler().updateActiveList?.($,z)}getHandler(){return this.params.getHandler()}onStateChange($,z,Q){let{model:J,state:Z,valid:X}=Q,Y=this.validity;Y[z]=X;let q=this.allState,G=WZ(q.model,this.filters.length,J,z),_=Y.every((W)=>W!==!1),H=[...q.state??[]];H[z]=Z;let U={state:H,model:G,valid:_};this.allState=U,$(U)}getModelAsString($){return this.getHandler().getModelAsString?.($)??""}},xR={tag:"div",cls:"ag-multi-floating-filter ag-floating-filter-input"},wR=class extends x{constructor(){super(xR);this.floatingFilters=[],this.compDetailsList=[]}init($){this.params=$;let{compDetailsList:z}=this.getCompDetailsList($);return this.setParams(z)}setParams($){let z=[];return $.forEach((Q)=>{let J=Q?.newAgStackInstance();if(J!=null)this.compDetailsList.push(Q),z.push(J)}),g.all(z).then((Q)=>{Q.forEach((J,Z)=>{this.floatingFilters.push(J);let X=J.getGui();if(this.appendChild(X),Z>0)N(X,!1)})})}refresh($){this.params=$;let{compDetailsList:z,floatingFilterParamsList:Q}=this.getCompDetailsList($);if(z.length===this.compDetailsList.length&&z.every((Z,X)=>!this.beans.colFilter?.areFilterCompsDifferent(this.compDetailsList[X],Z))){if(Q.forEach((Z,X)=>{this.floatingFilters[X].refresh?.(Z)}),this.gos.get("enableFilterHandlers")){let Z=$;if(Z.model==null)this.floatingFilters.forEach((X,Y)=>{N(X.getGui(),Y===0)});else{let X=Z.getHandler()?.getLastActiveFilterIndex?.();this.floatingFilters.forEach((Y,q)=>{let G=X==null?q===0:q===X;N(Y.getGui(),G)})}}}else z0(this.getGui()),this.destroyBeans(this.floatingFilters),this.floatingFilters=[],this.compDetailsList=[],this.setParams(z)}getCompDetailsList($){let z=[],Q=[],J=$.filterParams,Z=$.currentParentModel,X=LZ(J);return X.forEach((Y,q)=>{let G={...$,parentFilterInstance:(H)=>{this.parentMultiFilterInstance((U)=>{let W=U.getChildFilterInstance(q);if(W==null)return;H(W)})},currentParentModel:()=>Z()?.filterModels?.[q]??null};if(this.gos.get("enableFilterHandlers")){let H=G;H.model=H.model?.filterModels?.[q]??null;let{onModelChange:U,getHandler:W}=H;H.onModelChange=(B,E)=>U(WZ(this.params.model,X.length,B,q),E),H.getHandler=()=>{return W().getHandler(q)}}B0(G.filterParams,Y.filterParams);let _=this.getCompDetails(Y,G);if(_)z.push(_),Q.push(G)}),{compDetailsList:z,floatingFilterParamsList:Q}}onParentModelChanged($,z){if(z?.afterFloatingFilter)return;this.parentMultiFilterInstance((Q)=>{if($==null)this.floatingFilters.forEach((J,Z)=>{J.onParentModelChanged(null,z),N(J.getGui(),Z===0)});else{let J=Q.getLastActiveFilterIndex();this.floatingFilters.forEach((Z,X)=>{let Y=$.filterModels.length>X?$.filterModels[X]:null;Z.onParentModelChanged(Y,z);let q=J==null?X===0:X===J;N(Z.getGui(),q)})}})}destroy(){this.destroyBeans(this.floatingFilters),this.floatingFilters.length=0,super.destroy()}getCompDetails($,z){let{colFilter:Q,frameworkOverrides:J,userCompFactory:Z}=this.beans,X=b4(J,$,()=>Q.getDefaultFloatingFilter(this.params.column))??"agReadOnlyFloatingFilter";return t2(Z,$,z,X)}parentMultiFilterInstance($){this.params.parentFilterInstance((z)=>{if(!(z instanceof eX||z instanceof $Y))e(120);$(z)})}},zY={moduleName:"MultiFilter",version:Q0,userComponents:{agMultiColumnFilter:{getComp:($)=>$.gos.get("enableFilterHandlers")?{classImp:$Y,params:{useForm:!0}}:eX},agMultiColumnFloatingFilter:wR},beans:[yR],dynamicBeans:{agMultiColumnFilterHandler:bR},dependsOn:[I0,L9,X5]},NR=class extends S{constructor(){super(...arguments);this.beanName="aggColNameSvc"}getHeaderName($,z){if(this.gos.get("suppressAggFuncInHeader"))return z;let{valueColsSvc:Q,colModel:J,rowGroupColsSvc:Z}=this.beans,X=$.getColDef().pivotValueColumn,Y=T(X),q=null,G;if(Y){let _=Q?.columns??[],H=this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&_.length===1,U=$.getColDef().pivotTotalColumnIds!==void 0;if(H&&!U)return z;q=X?X.getAggFunc():null,G=!0}else{let _=$.isValueActive(),H=Z?.columns.length!==0,U=J.isPivotMode()||H||this.gos.get("treeData");if(_&&U)q=$.getAggFunc(),G=!0;else G=!1}if(G){let _=typeof q==="string"?q:"func";return`${this.getLocaleTextFunc()(_,_)}(${z})`}return z}},gR={sum:"Sum",first:"First",last:"Last",min:"Min",max:"Max",count:"Count",avg:"Average"},hR=class extends S{constructor(){super(...arguments);this.beanName="aggFuncSvc",this.aggFuncsMap={},this.initialised=!1}postConstruct(){this.init()}init(){if(this.initialised)return;this.initialiseWithDefaultAggregations(),this.addAggFuncs(this.gos.get("aggFuncs"))}initialiseWithDefaultAggregations(){let $=this.aggFuncsMap;$.sum=uR,$.first=mR,$.last=cR,$.min=pR,$.max=iR,$.count=dR,$.avg=sR,this.initialised=!0}isAggFuncPossible($,z){let J=this.getFuncNames($).includes(z),Z=T(this.aggFuncsMap[z]);return J&&Z}getDefaultFuncLabel($){return gR[$]??$}getDefaultAggFunc($){let z=$.getColDef().defaultAggFunc;if(T(z)&&this.isAggFuncPossible($,z))return z;if(this.isAggFuncPossible($,"sum"))return"sum";let Q=this.getFuncNames($);return Q?.length?Q[0]:null}addAggFuncs($){if(this.init(),!$)return;for(let z of Object.keys($))if($[z])this.aggFuncsMap[z]=$[z]}getAggFunc($){return this.init(),this.aggFuncsMap[$]}getFuncNames($){let z=$.getColDef().allowedAggFuncs;return z==null?Object.keys(this.aggFuncsMap).sort():z}clear(){this.aggFuncsMap={}}};function uR($){let{values:z}=$,Q=null;for(let J=0;J0?$.values[0]:null}function cR($){return $.values.length>0?b($.values):null}function pR($){let{values:z}=$,Q=null;for(let J=0;JZ))Q=Z}return Q}function iR($){let{values:z}=$,Q=null;for(let J=0;J0)Z=Q/(typeof Q==="number"?J:BigInt(J));let X=$.rowNode?.aggData?.[$.column?.getColId()];if(X&&X.count===J&&X.value===Z)return X;let Y=Object.create(tR);return Y.count=J,Y.value=Z,Y}var rR=class extends S{constructor(){super(...arguments);this.beanName="aggChildrenSvc"}getAggregatedChildren($,z,Q){if(!$?.group)return[];if($.rowPinned){if($=$.pinnedSibling,!$)return[]}let J=this.gos,Z=QY($,z,J);if(!Q)return Z;let X=[];return JY(Z,z,J,X),X}},QY=($,z,Q)=>{let J=z?.colDef,Z=J?.pivotKeys;if(Z){if($.leafGroup&&Z.length&&!J.pivotTotalColumnIds)return NX($.childrenMapped,Z);return $.childrenAfterFilter??$.childrenAfterGroup??[]}if(T$(Q)||Q.get("suppressAggFilteredOnly"))return $.childrenAfterGroup??[];return $.childrenAfterFilter??$.childrenAfterGroup??[]},JY=($,z,Q,J)=>{for(let Z=0,X=$.length;Z{h9(R,null,k)})}return}this.hadAgg=!0;let{colModel:X,aggFuncSvc:Y}=Q,q=z.get("alwaysAggregateAtRootLevel")||!!Hz(z)||X.isPivotMode(),G=!T$(z)&&!z.get("suppressAggFilteredOnly"),_=Q.valueSvc,H=Q.gridApi,U=Q.gridOptions.context,W=Z??[],B=W.length,E=$?.kind==="cells"?$:void 0,K,L=Array(B);for(let k=0;k=0)K=E;L[k]={column:V,colId:V.colId,colDef:V.colDef,aggFunc:ZY(V.getAggFunc(),Y,V),colSlot:R}}let D=Qj(X,Q.pivotResultCols,Y),F=B>0?Array(B):null,M=Q.rowModel;S0(M.rootNode,M.hierarchical,$,(k)=>{if(k.level===-1&&!q){OQ(k,null,X);return}let V;if(J)V=J({nodes:k.childrenAfterFilter});else if(!F)V=null;else if(D)V=zj(k,D,_,H,U);else V=$j(k,L,B,F,K,G,_,H,U);h9(k,V,X)})}},$j=($,z,Q,J,Z,X,Y,q,G)=>{let _=(X?$.childrenAfterFilter:$.childrenAfterGroup)??[],H=_.length,U=$.data,W=Object.create(null),B=Z?Z.getSlot($):-1,E=B>=0?$.aggData:void 0,K=0;for(let L=0;L=0&&!Z.hasCellBySlot(B,D.colSlot)){if(J[L]=null,E)W[D.colId]=E[D.colId]}else J[L]=Array(H),++K}if(K===0)return W;for(let L=0;L{let X=z.length,Y=$.leafGroup,q=$.data,G=$.childrenMapped,_=$.childrenAfterFilter??[],H=Object.create(null),U,W;for(let B=0;B{if(typeof $==="function")return $;if($==null)return null;let J=z.getAggFunc($);if(typeof J!=="function")return j(109,{inputValue:$.toString(),allSuggestions:z.getFuncNames(Q)}),null;return J},Qj=($,z,Q)=>{if(!$.isPivotActive())return null;let J=z?.getAggregationOrderedList();if(!J||J.length===0)return null;let Z=J.length,X=Array(Z),Y=0;for(let q=0;q{let z=$.childrenAfterAggFilter,Q=0;if(z){let Z=z.length;Q=Z;for(let X=0;X=0?null:Q;$.setAllChildrenCount(J),$.pinnedSibling?.setAllChildrenCount(J)},this.setAllChildrenCountGridGrouping=($)=>{let z=$.childrenAfterAggFilter,Q=0;for(let J=0,Z=z.length;J!E.node.group,_=(E)=>E.node.leafGroup,H=T$(this.gos)||(X?_:G),U=q?this.setAllChildrenCountTreeData:this.setAllChildrenCountGridGrouping,W=(E,K=!1)=>{if(E.childrenAfterFilter){if(E.childrenAfterAggFilter=E.childrenAfterFilter,K){let L=E.childrenAfterAggFilter;for(let D=0,F=L.length;D{if(E.childrenAfterAggFilter=E.childrenAfterFilter?.filter((K)=>{if(H({node:K})){if(Z.doesRowPassAggregateFilters({rowNode:K}))return W(K,!0),!0}return K.childrenAfterAggFilter?.length})||null,E.hasChildren())U(E);else E.setAllChildrenCount(null),E.pinnedSibling?.setAllChildrenCount(null);if(E.sibling)E.sibling.childrenAfterAggFilter=E.childrenAfterAggFilter};S0(z.rootNode,z.hierarchical,$,Y?B:W)}};function P1($,z){if($.sibling)return;let Q=N7($,z);Q.footer=!0,Q.setRowTop(null),Q.setRowIndex(null),Q.oldRowTop=null,Q.id="rowGroupFooter_"+$.id,Q.sibling=$,$.sibling=Q}function Zj($){let z=$.sibling;if(!z)return;z._destroy(!1),$.sibling=void 0,z.sibling=void 0}var Xj=class extends S{constructor(){super(...arguments);this.beanName="footerSvc"}addTotalRows($,z,Q,J,Z,X){let Y=$;if(Z){let _=J&&Hz(this.gos);if(Yj(X,_))P1(z,this.beans),Q(z.sibling,Y++);return Y}let q=OJ(this.gos);if((J&&q({node:z}))===X)P1(z,this.beans),Q(z.sibling,Y++);return Y}getTopDisplayIndex($,z,Q,J){let Z=z;if($[0].footer){if(z===0)return 0;Z-=1}let X=$[$.length-1],Y=Z>=Q.length;if(X.footer&&Y)return X.rowIndex;return J(Z)}doesCellShowTotalPrefix($,z){if(!$.footer||!z?.getColDef().showRowGroup)return!1;if(this.gos.get("treeData"))return!0;if($.level===-1)return this.beans.showRowGroupCols?.columns[0]===z;return!!$.rowGroupColumn&&z?.isRowGroupDisplayed($.rowGroupColumn.getId())}applyTotalPrefix($,z,Q,J){let Z=J.getColDef().cellRendererParams?.totalValueGetter;if(Z){let X=y(this.gos,{column:J,node:Q,value:$,formattedValue:z});if(typeof Z==="function")return Z(X);if(typeof Z==="string")return this.beans.expressionSvc?.evaluate(Z,X);j(179)}if(Q.level===-1)return this.getLocaleTextFunc()("footerTotal","Total")+" ";return this.getTotalValue(z??$)??""}getTotalValue($){return this.getLocaleTextFunc()("footerTotal","Total")+" "+($??"")}};function Yj($,z){switch(z){case"top":case"pinnedTop":return $==="top";case"bottom":case"pinnedBottom":return $==="bottom";default:return!1}}var XY=class extends RQ{constructor(){super(...arguments);this.beanName="valueColsSvc",this.eventName="columnValueChanged",this.columnProcessors={set:($,z,Q)=>this.setValueActive(z,$,Q),add:($,z,Q)=>this.setValueActive(!0,$,Q),remove:($,z,Q)=>this.setValueActive(!1,$,Q)},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColValueActive($,z,Q),getIndexFunc:()=>{return},getInitialIndexFunc:()=>{return},getValueFunc:($)=>{let z=$.aggFunc;if(z===null||z==="")return null;if(z===void 0)return;return!!z},getInitialValueFunc:($)=>{return $.initialAggFunc!=null&&$.initialAggFunc!=""}},this.modifyColumnsNoEventsCallbacks={addCol:($)=>this.columns.push($),removeCol:($)=>Z0(this.columns,$)}}extractCols($,z){this.columns=super.extractCols($,z);for(let Q of this.columns){let J=Q.getColDef();if(J.aggFunc!=null&&J.aggFunc!="")this.setColAggFunc(Q,J.aggFunc);else if(!Q.getAggFunc())this.setColAggFunc(Q,J.initialAggFunc)}return this.columns}setColumnAggFunc($,z,Q){if(!$)return;let J=this.colModel.getColDefCol($);if(!J)return;this.setColAggFunc(J,z),this.dispatchColumnChangedEvent(this.eventSvc,this.eventName,[J],Q)}syncColumnWithState($,z,Q){let J=Q("aggFunc").value1;if(J!==void 0)if(typeof J==="string"){if(this.setColAggFunc($,J),!$.isValueActive())this.setColValueActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($)}else{if(T(J))j(33);if($.isValueActive())this.setColValueActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setValueActive($,z,Q){if($===z.isValueActive())return;if(this.setColValueActive(z,$,Q),$&&!z.getAggFunc()&&this.aggFuncSvc){let J=this.aggFuncSvc.getDefaultAggFunc(z);this.setColAggFunc(z,J)}}setColAggFunc($,z){$.aggFunc=z,$.dispatchStateUpdatedEvent("aggFunc")}setColValueActive($,z,Q){if($.aggregationActive!==z)$.aggregationActive=z,$.dispatchColEvent("columnValueChanged",Q)}},YY={moduleName:"SharedAggregation",version:Q0,beans:[hR,NR,Xj,XY],apiFunctions:{addAggFuncs:lR,clearAggFuncs:aR,setColumnAggFunc:oR},dependsOn:[I0]},qj={moduleName:"Aggregation",version:Q0,beans:[eR,Jj,rR],rowModels:["clientSide"],dependsOn:[YY]},qY=class extends RQ{constructor(){super(...arguments);this.beanName="pivotColsSvc",this.eventName="columnPivotChanged",this.columnProcessors={set:($,z,Q)=>this.setColPivotActive($,z,Q),add:($,z,Q)=>this.setColPivotActive($,!0,Q),remove:($,z,Q)=>this.setColPivotActive($,!1,Q)},this.columnOrdering={enableProp:"pivot",initialEnableProp:"initialPivot",indexProp:"pivotIndex",initialIndexProp:"initialPivotIndex"},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColPivotActive($,z,Q),getIndexFunc:($)=>$.pivotIndex,getInitialIndexFunc:($)=>$.initialPivotIndex,getValueFunc:($)=>$.pivot,getInitialValueFunc:($)=>$.initialPivot},this.modifyColumnsNoEventsCallbacks={addCol:($)=>{if(!this.columns.includes($))this.columns.push($)},removeCol:($)=>Z0(this.columns,$)}}syncColumnWithState($,z,Q,J){let{value1:Z,value2:X}=Q("pivot","pivotIndex");if(Z!==void 0||X!==void 0){if(typeof X==="number"||Z){if(!$.isPivotActive())this.setColPivotActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($);if(J&&typeof X==="number")J[$.getId()]=X}else if($.isPivotActive())this.setColPivotActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setColPivotActive($,z,Q){if($.pivotActive!==z){if($.pivotActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,$)?.forEach((Z)=>this.setColPivotActive(Z,z,Q));$.dispatchColEvent("columnPivotChanged",Q)}$.dispatchStateUpdatedEvent("pivot")}},Gj=class extends RQ{constructor(){super(...arguments);this.beanName="rowGroupColsSvc",this.eventName="columnRowGroupChanged",this.columnProcessors={set:($,z,Q)=>this.setActive(z,$,Q),add:($,z,Q)=>this.setActive(!0,$,Q),remove:($,z,Q)=>this.setActive(!1,$,Q)},this.columnOrdering={enableProp:"rowGroup",initialEnableProp:"initialRowGroup",indexProp:"rowGroupIndex",initialIndexProp:"initialRowGroupIndex"},this.columnExtractors={setFlagFunc:($,z,Q)=>this.setColRowGroupActive($,z,Q),getIndexFunc:($)=>$.rowGroupIndex,getInitialIndexFunc:($)=>$.initialRowGroupIndex,getValueFunc:($)=>$.rowGroup,getInitialValueFunc:($)=>$.initialRowGroup},this.modifyColumnsNoEventsCallbacks={addCol:($)=>{if(!this.columns.includes($))this.columns.push($)},removeCol:($)=>Z0(this.columns,$)}}moveColumn($,z,Q){if(this.columns.length===0)return;let J=this.columns[$],Z=this.columns.slice($,z);this.columns.splice($,1),this.columns.splice(z,0,J),this.updateIndexMap(),this.eventSvc.dispatchEvent({type:this.eventName,columns:Z,column:Z.length===1?Z[0]:null,source:Q})}syncColumnWithState($,z,Q,J){let{value1:Z,value2:X}=Q("rowGroup","rowGroupIndex");if(Z!==void 0||X!==void 0){if(typeof X==="number"||Z){if(!$.isRowGroupActive())this.setColRowGroupActive($,!0,z),this.modifyColumnsNoEventsCallbacks.addCol($);if(J&&typeof X==="number")J[$.getId()]=X}else if($.isRowGroupActive())this.setColRowGroupActive($,!1,z),this.modifyColumnsNoEventsCallbacks.removeCol($)}}setActive($,z,Q){if($===z.isRowGroupActive())return;this.setColRowGroupActive(z,$,Q);let J=this.beans.groupHierarchyColSvc?.getColumn(z);if(TJ(this.gos,$)&&!J)this.colModel.setColsVisible([z],!$,Q)}setColRowGroupActive($,z,Q){if($.rowGroupActive!==z){if($.rowGroupActive=z,z)this.beans.groupHierarchyColSvc?.insertVirtualColumnsForCol(this.columns,$)?.forEach((Z)=>this.setColRowGroupActive(Z,z,Q));$.dispatchColEvent("columnRowGroupChanged",Q)}$.dispatchStateUpdatedEvent("rowGroup")}},_j=class extends S{constructor(){super(...arguments);this.beanName="autoColSvc"}postConstruct(){this.addManagedPropertyListener("autoGroupColumnDef",this.updateColumns.bind(this)),this.setupGroupHideColumnsUntilExpanded()}setupGroupHideColumnsUntilExpanded(){let $=()=>this.updateGroupColumnVisibility();this.addManagedEventListeners({modelUpdated:$}),this.addManagedPropertyListeners(["groupHideColumnsUntilExpanded","groupDisplayType","groupHideOpenParents"],$)}addColumns($){let{columns:z}=this;if(z==null)return;$.list=z.list.concat($.list),$.tree=z.tree.concat($.tree),_1($)}createColumns($,z,Q){let J=this.beans,{colModel:Z,gos:X,rowGroupColsSvc:Y,colGroupSvc:q}=J,G=Z.isPivotMode(),_=PJ(X,G),H=G?X.get("pivotSuppressAutoColumn"):this.isSuppressAutoCol(),U=Y?.columns,B=!(U&&U.length>0||X.get("treeData"))||H||_,E=()=>{if(this.columns)J$(J,this.columns.tree),this.columns=null};if(B){E();return}let K=this.generateAutoCols(U),L=G1(K,this.columns?.list||null),D=$.treeDepth,M=(this.columns?this.columns.treeDepth:-1)==D;if(L&&M){let O=new Map(K.map((I)=>[I.getId(),I]));for(let I of this.columns?.list??[]){let v=O.get(I.getId());if(v)I.setColDef(v.getColDef(),null,Q)}return}E();let k=q?.findDepth($.tree)??0,V=q?.balanceTreeForAutoCols(K,k)??[];this.columns={list:K,tree:V,treeDepth:k,map:{}},z((O)=>{if(!O)return null;let I=O.filter((v)=>!mz(v));return[...K,...I]})}updateColumns($){let z=Xz($.source);this.columns?.list.forEach((Q,J)=>this.updateOneAutoCol(Q,J,z))}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}generateAutoCols($=[]){let z=[],{gos:Q}=this,J=Q.get("treeData"),Z=Y1(Q);if(J&&Z)j(182),Z=!1;if(Z)$.forEach((X,Y)=>{z.push(this.createOneAutoCol(X,Y))});else z.push(this.createOneAutoCol());return z}isSuppressAutoCol(){let $=this.gos;if($.get("groupDisplayType")==="custom")return!0;return $.get("treeDataDisplayType")==="custom"}createOneAutoCol($,z){let Q;if($)Q=`${uz}-${$.getId()}`;else Q=uz;let J=this.createAutoColDef(Q,$,z);J.colId=Q;let Z=new q$(J,null,Q,!0);return this.createBean(Z),Z}updateOneAutoCol($,z,Q){let J=$.getColDef(),Z=typeof J.showRowGroup=="string"?J.showRowGroup:void 0,X=this.beans,Y=Z!=null?X.colModel.getColDefCol(Z):void 0,q=$.getId(),G=this.createAutoColDef(q,Y??void 0,z);$.setColDef(G,null,Q),n0(X,{state:[i2(G,q)]},Q)}createAutoColDef($,z,Q){let J=this.createBaseColDef(z),Z=this.gos.get("autoGroupColumnDef");if(B0(J,Z),J=u$(this.beans,J,$,!0),Z?.groupRowEditable==null)J.groupRowEditable=void 0;if(Z?.groupRowValueSetter==null)J.groupRowValueSetter=void 0;if(!this.gos.get("treeData")){if(n(J.field)&&n(J.valueGetter)&&n(J.filterValueGetter)&&J.filter!=="agGroupColumnFilter")J.filter=!1}if(Q&&Q>0)J.headerCheckboxSelection=!1;let X=W$(this.gos),Y=J.valueGetter||J.field!=null;if(X&&!Y)J.sortIndex=void 0,J.initialSort=void 0;return J}createBaseColDef($){let z=this.gos.get("autoGroupColumnDef"),J={headerName:this.getLocaleTextFunc()("group","Group"),showRowGroup:$?.getColId()??!0};if(!(z&&(z.cellRenderer||z.cellRendererSelector)))J.cellRenderer="agGroupCellRenderer";if($)J.headerName=this.beans.colNames.getDisplayNameForColumn($,"header")??void 0,J.headerValueGetter=$.colDef.headerValueGetter;return J}getDeepestExpandedLevel($,z){let Q=-1;if(!$)return Q;for(let J of $){if(!J.group||!J.expanded)continue;if(J.level>Q)Q=J.level;if(Q>=z)return Q;let Z=this.getDeepestExpandedLevel(J.childrenAfterGroup,z);if(Z>Q)Q=Z;if(Q>=z)return Q}return Q}updateGroupColumnVisibility(){let $=this.columns?.list;if(!$||$.length===0)return;let{gos:z,visibleCols:Q,rowModel:J}=this.beans,Z=g2(z),X=!1,Y=(G,_)=>{if(_!==G.isVisible())G.setVisible(_,"api"),X=!0},q=()=>{for(let G of $)Y(G,!0)};if(!Z)q();else if($.length>1){let G=$.length-2,_=J?.rootNode?.childrenAfterGroup,H=this.getDeepestExpandedLevel(_,G);if(H>=G)q();else for(let U=0;U<$.length-1;U++)Y($[U+1],H>=U)}if(X)Q.refresh("api")}destroy(){J$(this.beans,this.columns?.tree),super.destroy()}},z5=null,d9=($)=>{let z=z5,Q=new Uint32Array(1<<32-Math.clz32($|63));if(z)Q.set(z);return z5=Q,Q},Hj=($,z,Q,J)=>{let Z=z-J,X=Q-1;if(Z===1){let _=0;while($[_].level===X)++_;if(_0){let H=$[_];$.copyWithin(1,0,_),$[0]=H}return $}let Y=Array(Z),q=0,G=0;for(let _=0;_{let Q=$[0].level+1,J=Q,Z=0,X=Q,Y=z5;if(!Y||Q>=Y.length)Y=d9(Q);++Y[Q];for(let U=1;UQ){if(Q=W,Q>=Y.length)Y=d9(Q)}else if(W=0)return Y.fill(0,J,Q+1),$;let q=Y[J],G=Y[Q];if(q+G===z)return Y[J]=0,Y[Q]=0,Hj($,z,Q,G);let _=0;for(let U=Q;U>=J;--U){let W=Y[U];Y[U]=_,_+=W}let H=Array(z);for(let U=0;U{if(z===2){if($[0].level<$[1].level){let Q=$[0];$[0]=$[1],$[1]=Q}return $}if(z>16)return Uj($,z);for(let Q=1;Q=0&&$[X].level=0)Q.set(z,-1),z=z.parent;return}let J=this.rows;do Q.set(z,-1),J.push(z),z=z.parent;while(z!=null&&!Q.has(z));this.unsorted=!0}addCell($,z){if(z==null){this.addRow($);return}if($==null)return;let Q=this.slots,J=this.bits,Z=Q.get(z)??this.ensureCol(z),X=Q.get($);if(X===void 0)X=this.ensureRow($);else if(X<0)return;let Y=Z<32?J:this.extraBits[(Z>>>5)-1],q=1<<(Z&31),G=Y[X];if((G&q)!==0)return;Y[X]=G|q;let _=$.parent;while(_!=null){let H=Q.get(_);if(H<0)break;let U=Y[H];if((U&q)!==0)break;Y[H]=U|q,_=_.parent}}hasRow($){return this.slots.has($)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let $=GY(this.rows);return this.rows=$,$}getSlot($){return this.slots.get($)??-1}hasCellBySlot($,z){if($<0)return!0;if(z<32)return z>=0&&(this.bits[$]&1<>>5)-1][$]&1<<(z&31))!==0}ensureRow($){let z=this.slots,Q=this.rows,J=this.bits,Z=this.extraBits,X=J.push(0),Y=X-1;if(Z!==null)for(let G=0,_=Z.length;G<_;++G)Z[G].push(0);z.set($,Y),Q.push($),this.unsorted=!0;let q=$.parent;while(q!=null&&!z.has(q)){if(z.set(q,X),Q.push(q),X=J.push(0),Z!==null)for(let G=0,_=Z.length;G<_;++G)Z[G].push(0);q=q.parent}return Y}ensureCol($){let z=this.colCount++;if(this.slots.set($,z),z>=32){let Q=(z>>>5)-1,J=this.extraBits;if(J===null)J=[],this.extraBits=J;if(Q>=J.length)J.push(Array(this.bits.length).fill(0))}return z}},t9=class{constructor(){this.kind="rows",this.rows=[],this.unsorted=!1,this.rowSet=new Set}addRow($){let z=$;if(z==null)return;let Q=this.rowSet;if(Q.has(z))return;let J=this.rows;do Q.add(z),J.push(z),z=z.parent;while(z!=null&&!Q.has(z));this.unsorted=!0}addCell($,z){this.addRow($)}hasRow($){return this.rowSet.has($)}getSortedRows(){if(!this.unsorted)return this.rows;this.unsorted=!1;let $=GY(this.rows);return this.rows=$,$}},Bj=class extends S{constructor(){super(...arguments);this.beanName="changedPathFactory"}newPath($){return $?new Wj:new t9}ensureRowsPath($){let z=$.changedPath;if(!z&&$.changedRowNodes&&!$.newData){let Q=this.beans.rowModel;if(Q.hierarchical)z=new t9,$.changedPath=z,z.addRow(Q.rootNode)}return z}},Ej=class extends S{addExpandedCss($,z){if(z.isExpandable())$.push("ag-row-group"),$.push(z.expanded?"ag-row-group-expanded":"ag-row-group-contracted")}getRowExpandedListeners($){let{rowNode:z}=$,Q=this.updateExpandedCss.bind(this,$,z);return{expandedChanged:Q,hasChildrenChanged:Q}}setExpanded($,z,Q,J){if($.expanded===z)return;$._expanded=z,$.dispatchRowEvent("expandedChanged");let Z={...e2($,this.gos,"rowGroupOpened"),expanded:z,event:Q||null};this.dispatchExpandedEvent(Z,J)}defaultExpanded($){let Q=this.beans.gos,J=$.level??0,Z=$.group&&Q.get("isGroupOpenByDefault");if(!Z){let Y=Q.get("groupDefaultExpanded");return Y===-1||J{let X=Z.rowComp;X.toggleCss("ag-row-group",Q),X.toggleCss("ag-row-group-expanded",Q&&J),X.toggleCss("ag-row-group-contracted",Q&&!J),w0(Z.element,Q&&J)})}dispatchStateUpdatedEvent(){this.eventSvc.dispatchEvent({type:"rowExpansionStateChanged"})}},Kj=class extends Ej{constructor(){super(...arguments);this.beanName="expansionSvc",this.events=null,this.dispatchExpandedDebounced=null}destroy(){super.destroy(),this.events=null,this.dispatchExpandedDebounced=null}setExpansionState($){let z=new Set($.expandedRowGroupIds);this.beans.rowModel.forEachNode((Q)=>{let J=Q.id;if(!J)return;Q._expanded=z.has(J)}),this.onGroupExpandedOrCollapsed()}getInternalExpansionState($=!1){let z=[],Q=[];return this.beans.rowModel.forEachNode((J)=>{let Z=J.id;if(!Z)return;if(J.expanded)z.push(Z);else if($&&J.isExpandable())Q.push(Z)}),{expandedRowGroupIds:z,collapsedRowGroupIds:Q}}getExpansionState(){return this.getInternalExpansionState()}isExpanded($){if($.footer)return!!$._expanded;if(!($.group||$.master)||$.leafGroup&&this.beans.colModel.isPivotMode())return!1;let z=$._expanded;if(z===null)z=this.defaultExpanded($)??!1,$._expanded=z;return!!z}resetExpansion(){let{rowModel:$}=this.beans;$.forEachNode((z)=>{if(!z.group&&!z.master)return;z._expanded=null}),this.onGroupExpandedOrCollapsed()}expandAll($){let{gos:z,rowModel:Q,colModel:J,eventSvc:Z}=this.beans,X=z.get("treeData"),Y=J.isPivotActive(),q=(_)=>{if(!_)return;for(let H of _){let U=()=>{H._expanded=$,q(H.childrenAfterGroup)};if(H.master){U();continue}if(X){if(T(H.childrenAfterGroup))U();continue}if(Y){if(!H.leafGroup)U();continue}if(H.group)U()}},G=Q.rootNode;if(G)q(G.childrenAfterGroup);this.onGroupExpandedOrCollapsed(),Z.dispatchEvent({type:"expandOrCollapseAll",source:$?"expandAll":"collapseAll"})}onGroupExpandedOrCollapsed(){this.dispatchStateUpdatedEvent(),this.beans.rowModel.reMapRows()}setDetailsExpansionState($){let z=this.getInternalExpansionState(!0),Q=z.collapsedRowGroupIds.length===0;if(z.expandedRowGroupIds.length===0===Q)return;return Q?$.expandAll():$.collapseAll()}dispatchExpandedEvent($,z){if((this.events??(this.events=[])).push($),z){this.dispatchExpandedEvents();return}let Q=this.dispatchExpandedDebounced;if(!Q){if(!this.isAlive())return;Q=this.debounce(()=>this.dispatchExpandedEvents()),this.dispatchExpandedDebounced=Q}Q()}dispatchExpandedEvents(){let{eventSvc:$,rowRenderer:z}=this.beans,Q=this.events,J=Q?.length;if(!J)return;this.events=null;let Z=Array(J);for(let X=0;Xwindow.setTimeout($,0);let Q=!1;return()=>{if(!z.active){window.setTimeout($,0);return}if(Q)return;Q=!0,z.addDestroyTask(()=>{Q=!1,$()})}}};function Lj($){let z=$.get("groupHideParentOfSingleChild");if(!z){if(z=$.get("groupRemoveSingleChildren"),!z&&$.get("groupRemoveLowestSingleChildren"))z="leafGroupsOnly"}return{groupHideParentOfSingleChild:z,isGroupMultiAutoColumn:Y1($),hideOpenParents:$.get("groupHideOpenParents"),grandTotalRow:Hz($),groupTotalRow:OJ($)}}function Dj($,z,Q){return $.groupHideParentOfSingleChild===!0&&Q&&z.childrenAfterGroup.length===1}function Fj($,z,Q){return $.groupHideParentOfSingleChild==="leafGroupsOnly"&&Q&&z.leafGroup&&z.childrenAfterGroup.length===1}function Mj($,z,Q,J,Z,X){if(J&&!Q)return!1;if(Z||X)return!1;if(!$.hideOpenParents)return!0;if(z.master||z.level===-1)return!0;if(!(J&&z.leafGroup)&&z.expanded)return!1;return!0}var kj=class extends S{constructor(){super(...arguments);this.beanName="flattenStage",this.step="map",this.refreshProps=["groupHideParentOfSingleChild","groupRemoveSingleChildren","groupRemoveLowestSingleChildren","groupTotalRow","masterDetail"]}execute(){let{beans:$,gos:z}=this,Q=[],J=$.rowModel.rootNode;if(!J)return Q;let Z=$.colModel.isPivotMode(),X=Z&&J.leafGroup&&J.aggData,Y=X?[J]:J.childrenAfterSort,q=Lj(z);this.recursivelyAddToRowsToDisplay(q,Y,Q,Z,0);let G=Q.length>0,_=q.grandTotalRow;if(!X&&G&&_)if(P1(J,$),_==="pinnedBottom"||_==="pinnedTop")this.beans.pinnedRowModel?.setGrandTotalPinned(_==="pinnedBottom"?"bottom":"top");else{let U=_==="top";this.addRowNodeToRowsToDisplay(q,J.sibling,Q,0,U)}return Q}recursivelyAddToRowsToDisplay($,z,Q,J,Z){if(!z?.length)return;let X=this.beans.masterDetailSvc;for(let Y=0;Ythis.onCsrmCellChange($),batchEditingStopped:()=>this.flushGroupEdits()})}destroy(){this.stopDragging(!0),super.destroy()}isGroupingDrop($){if(!$.rowDragManaged||!$.sameGrid)return!1;if(!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length&&!this.beans.colModel.isPivotMode()}initDraggingGroups($){let z=new Map,Q=(J)=>{let Z=J.childrenAfterGroup;if(Z){if(z.has(J))return;let X=Z.slice();z.set(J,X);for(let Y of X)Q(Y)}};for(let J of $.rows)if(J.group)Q(J);this.draggingGroups=z}canSetParent($){if(!$.sameGrid)return!1;if(this.beans.groupStage?.treeData)return!0;if($.rowDragManaged&&!this.gos.get("refreshAfterGroupEdit"))return!1;return!!this.beans.rowGroupColsSvc?.columns?.length}canDropRow($,z){if(this.beans.groupStage?.treeData)return!Aj($,z.newParent);let{position:Q,target:J,newParent:Z,rootNode:X}=z,Y=$.parent;if($.group&&(r9($,J)||r9($,Z)))return!1;if(Q==="inside")return!0;if(Z&&Z!==Y)return Z!==X||Y===X;let q=Z??J?.parent??X;if(q!==Y)return!1;let G=$.group?$.level:Y.level??-1,_=-1;if(J)_=J.group?J.level:J.parent?.level??-1;else if(q)_=q.level;if(G>=0&&_>=0&&_!==G)return!1;return!0}fixRowsDrop($,z,Q,J){let Z=!!this.beans.groupStage?.treeData;if($.treeData=Z,!(!!this.beans.rowGroupColsSvc?.columns?.length||this.gos.get("pivotMode"))&&!Z)return;if(!this.draggingGroups&&this.isGroupingDrop($)&&!$.suppressMoveWhenRowDragging)this.initDraggingGroups($);let Y=$.target,q=null,G=!1,_=$.rootNode,H=this.beans.rowModel,U=this.canStartGroup(Y,Z);this.updateDropTarget($,Q,U);let W=this.beans.pageBounds?.getLastRow?.()??H.getRowCount()-1;if(z){if(!Y||J>=0.5&&Y.rowIndex===W)q=_;else if($.moved&&Y&&this.dropGroupThrottled&&this.shouldDropTargetBeParent($))q=Y;if(!q)q=Y?.parent??_}if(!Q&&Y&&U&&!(Y.group&&Y.expanded))this.startDropGroupDelay(Y);if(q){if(Y&&q===Y&&q!==_){let B=q.expanded?g7(H,1,Y):null;if(B?.parent===q)Y=B,J=-0.5;else G=!0}if(Y&&!G){let B=Y;while(B&&B!==_&&B!==q)Y=B,B=B.parent}}$.target=Y,$.newParent=q,$.yDelta=J,$.inside=G}clearNewSameParent($,z){let Q=$.newParent;if(Q&&(!z||Sj($.rows,Q)))$.newParent=null}updateDropTarget($,z,Q){let J=Q?$.target:null;if(this.dropGroupTarget&&this.dropGroupTarget!==J)this.resetDragGroup();if(!J?.childrenAfterSort?.length)return;if(z&&this.dropGroupThrottled&&!J.expanded&&J.isExpandable?.())J.setExpanded(!0,void 0,!0);if(this.canDropInTarget(J,$))this.dropGroupThrottled=!0,this.dropGroupTarget=J}canDropInTarget($,z){if($.expanded)return!0;if(!$.group)return!1;if(z.pointerPos==="inside")return!0;if(z.treeData)return!1;let Q=z.rows,J=$.level;for(let Z=0,X=Q.length;Z{this.dropGroupTimer=null,this.dropGroupThrottled=!0,this.beans.dragAndDrop?.nudge()},z)}resetDragGroup(){if(this.dropGroupTimer!==null)window.clearTimeout(this.dropGroupTimer),this.dropGroupTimer=null;this.dropGroupTarget=null,this.dropGroupThrottled=!1}stopDragging($){if($)this.draggingGroups=null;this.resetDragGroup()}shouldDropTargetBeParent({target:$,rows:z,pointerPos:Q,treeData:J}){if(!$||Q==="none")return!1;if(Q==="inside")return!0;if(!J&&$.group&&!$.expanded)return!0;if(Q==="above")return!1;let Z=this.beans.rowModel,Y=$.rowIndex+1,q;do q=Z.getRow(Y++);while(q?.footer);let G=this.draggingGroups?.get($)??$.childrenAfterGroup;if(q&&q.parent===$&&G?.length){let _=new Set(z);for(let H=0,U=G.length;H{if(_.has(F))return;if(_.add(F),W??(W=this.newGroupValues(X)),this.setRowGroup(F,W))U.add(F)},E=(F)=>{let M=this.draggingGroups?.get(F)??F.childrenAfterGroup,k=M?.length;if(k)for(let V=0;V=0)B(R);else E(R)}};for(let F of $.rows)if(F.group)E(F);else{let M=F.sourceRowIndex>=0&&!F.destroyed?F:this.csrmFirstLeaf(F);if(M)B(M)}let K=Q==="inside"?"above":Q,L=Q==="inside"?this.findFirstLeafForParent(X,_)??J:J,D=!1;if(_.size&&K!=="none")D=H8(Z._leafs,_,L,K==="above");if(!U.size&&!D)return!1;H.reordered=D;for(let F of _)H.updates.add(F);if(this.csrmRefresh(H),G)G.focusCell();else Y.clearFocusedCell();return!0}canStartGroup($,z){if(!$||$.level<0||$.footer||$.detail)return!1;if($.group)return!0;return z}flushGroupEdits(){let $=this.pendingEditRefresh;if($)this.pendingEditRefresh=null,this.csrmRefresh($)}csrmRefresh($){let z=this.beans.rowModel;if(!z.rootNode)return;z.refreshModel({step:"group",keepRenderedRows:!0,animate:!this.gos.get("suppressAnimationFrame"),changedRowNodes:$})}newGroupValues($){let z=this.beans.rowGroupColsSvc?.columns??[],Q=Array(z.length),J=-1,Z=$;while(Z&&Z.level>=0){let X=z[Z.level];if(X){let Y=X.getColId(),q=Z.level;if(Q[q]=Z.groupData?.[Y]??Z.key??void 0,q>J)J=q}Z=Z.parent}return{values:Q,columns:z,maxLevel:J}}setRowGroup($,{values:z,columns:Q,maxLevel:J}){if(J<0)return!1;let{valueSvc:Z,changeDetectionSvc:X}=this.beans,Y=!1;X?.beginDeferred();try{for(let q=0;qJ)continue;let _=z[q],H=Z.getValue(G,$,"data");if(H===_||H==null&&_==null)continue;let U=_,W=Z.parseValue(G,$,_,H);if(W!==void 0)U=W;if($.setDataValue(G,U,"rowDrag"))Y=!0}}finally{X?.endDeferred()}return Y}onCsrmCellChange($){let{column:z,node:Q,source:J}=$;if(!this.gos.get("refreshAfterGroupEdit"))return;if(J==="rowDrag")return;if(!z?.isRowGroupActive())return;if(Q.group||!Q.data)return;if(this.beans.editSvc?.isBatchEditing()){let X=this.pendingEditRefresh;if(!X)X=s9(),this.pendingEditRefresh=X;X.updates.add(Q)}else{let X=s9();X.updates.add(Q),this.csrmRefresh(X)}}csrmFirstLeaf($){if(!$)return null;let z=this.draggingGroups,Q=z?.get($)??$.childrenAfterGroup;while(Q?.length){let J=Q[0];if(J.sourceRowIndex>=0){if(!J.destroyed)return J;return this.firstAliveChildLeaf(J)}Q=z?.get(J)??J.childrenAfterGroup}return pz($)}firstAliveChildLeaf($){let z=this.draggingGroups?.get($)??$.childrenAfterGroup;if(z){for(let Q of z)if(Q.sourceRowIndex>=0&&!Q.destroyed)return Q}return null}findFirstLeafForParent($,z){if(!$)return null;let Q=this.draggingGroups?.get($)??$?.childrenAfterGroup;if(!Q)return null;for(let J=0,Z=Q.length;J=0&&!z.has(X))return X;let Y=this.findFirstLeafForParent(X,z);if(Y!==null)return Y}return null}},s9=()=>{let $=new WQ;return $.reordered=!0,$},r9=($,z)=>{if(!$||!z)return!1;let Q=z;while(Q){if(Q===$)return!0;Q=Q.parent}return!1},Aj=($,z)=>{if(!z||$.parent===z)return!1;let Q=z,J=$.id;while(Q){if(Q===$)return!0;if(J!=null&&Q.id===J)return!0;Q=Q.parent}return!1},Sj=($,z)=>{for(let Q=0,J=$.length;Qthis.strategy?.onShowRowGroupColsSetChanged()})}invalidateGroupCols(){this.columnsInvalidated=!0,this.strategy?.invalidateGroupCols?.()}destroy(){this.strategy=this.destroyBean(this.strategy),super.destroy()}getNonLeaf($){return this.strategy?.nonLeafsById?.get($)}getNestedDataGetter(){return this.getStrategy()?.nestedDataGetter}onPropChange($){let z=this.gos,Q=this.strategy?.nestedDataGetter;if($.has("treeData"))this.gosTreeData=z.get("treeData")&&this.hasTreeData,this.columnsInvalidated=!0;return this.strategy?.onPropChange?.($),this.getNestedDataGetter()!==Q}extractData(){let $=this.beans.rowModel.rootNode,z=this.nested?$?.childrenAfterGroup:$?._leafs;if(!z)return this.gos.get("rowData")??[];let Q=z.length,J=Array(Q),Z=0;for(let X=0;X{let z=$.sibling;if(!z)return null;let Q=z._leafs;if(Q!==void 0)return Q;return EZ(z)},EZ=($)=>{let z=$.childrenAfterGroup,Q=z?.length;if($._leafs=null,!Q)return null;let J,Z=Q===1?z[0]:null;if(Z?.group&&Z.sourceRowIndex<0){if(J=Z._leafs,J===void 0)J=EZ(Z)}else if($.leafGroup)J=z;else{J=[];for(let X=0;X=0)J.push(Y);if(!Y.group)continue;let q=Y._leafs;if(q===void 0)q=EZ(Y);if(q)for(let G=0,_=q.length;G<_;++G)J.push(q[G])}}return $._leafs=J,J},fj=($,z,Q)=>{let{_leafs:J,sibling:Z}=$;if($.treeNodeFlags=0,$.childrenAfterGroup=J,$.childrenMapped=null,$._groupData=void 0,$.aggData=null,Z)Z.childrenAfterGroup=$.childrenAfterGroup,Z.childrenAfterAggFilter=$.childrenAfterAggFilter,Z.childrenAfterFilter=$.childrenAfterFilter,Z.childrenAfterSort=$.childrenAfterSort,Z.childrenMapped=null,Z._groupData=void 0,Z.aggData=null;for(let X=0,Y=J.length??0;X{$.key=null,$.treeNodeFlags=0,$.allChildrenCount=null,$.childrenAfterGroup=null,$.childrenAfterAggFilter=null,$.childrenAfterFilter=null,$.childrenAfterSort=null,$.childrenMapped=null,$.level=0,$._groupData=void 0};function a9($,z,Q){let J=$,Z=J.level-z.level;if(Z<=0)return!1;if(!Q.get("groupHideOpenParents"))return!1;for(let Y=0;Y{let{rowDragSvc:z}=this.beans;if(!this.params.rowDrag||!z)return;let Q=z.createRowDragComp(()=>this.params.value,this.params.node);this.createManagedBean(Q),this.eGui.insertAdjacentElement("afterbegin",Q.getGui())};this.setupExpand(),$(),this.setupCheckbox(),this.addGroupValue(),this.setupIndent()}getCellAriaRole(){let $=this.params.colDef?.cellAriaRole,z=this.params.column?.getColDef().cellAriaRole;return $||z||"gridcell"}isEmbeddedRowMismatch(){if(!this.params.fullWidth||!this.gos.get("embedFullWidthRows"))return!1;let{visibleCols:$}=this.beans,z=this.params.pinned==="left",Q=this.params.pinned==="right",J=!z&&!Q;if(this.gos.get("enableRtl")){if($.isPinningLeft())return!Q;return!J}if($.isPinningLeft())return!z;return!J}addGroupValue(){let{params:{value:$,valueFormatted:z}}=this,Q=this.getInnerCompDetails();this.comp.setInnerRenderer(Q,z??$??null)}setupExpand(){let{colModel:$}=this.beans,{eGridCell:z,suppressDoubleClickExpand:Q}=this.params,J=(G,_)=>{let H=h(G,this.beans,null);if(H)_.appendChild(H),this.addDestroyFunc(()=>H.remove())};J("groupExpanded",this.eExpanded),J("groupContracted",this.eContracted);let Z=this.comp,X=()=>{if(!this.isExpandable())return;let _=!!this.displayedNode.expanded;Z.setExpandedDisplayed(_),Z.setContractedDisplayed(!_),w0(z,_)},Y=()=>{let G=this.isExpandable();Z.toggleCss("ag-cell-expandable",G),Z.toggleCss("ag-row-group",G);let _=!G&&$.isPivotMode();Z.toggleCss("ag-pivot-leaf-group",_);let H=!$.isPivotMode()&&(!this.displayedNode.footer||this.displayedNode.level!==-1);Z.toggleCss("ag-row-group-leaf-indent",!G&&H);let U=this.getChildCount(),W=U>0?`(${U})`:"";if(Z.setChildCount(W),!G)Z.setExpandedDisplayed(!1),Z.setContractedDisplayed(!1),P6(z);else X()};(()=>{if(!Q&&!this.isGroupCellEditable(this.displayedNode))this.addManagedListeners(z,{dblclick:this.onCellDblClicked.bind(this)});this.addManagedListeners(this.eExpanded,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(this.eContracted,{click:this.onExpandClicked.bind(this)}),this.addManagedListeners(z,{keydown:this.onKeyDown.bind(this)}),this.addManagedListeners(this.displayedNode,{allChildrenCountChanged:Y,masterChanged:Y,groupChanged:Y,hasChildrenChanged:Y,expandedChanged:X})})(),Y()}getInnerCompDetails(){let{userCompFactory:$,findSvc:z}=this.beans,Q=this.params;if(Q.fullWidth){let G=this.gos.get("groupRowRendererParams"),_=H1($,G,Q);if(_)return _;if(z?.isMatch(Q.node,null))return H1($,{...G,innerRenderer:"agFindCellRenderer"},Q);return}let J=(G)=>G&&G.componentClass==this.compClass,Z=H1($,Q,Q);if(Z&&!J(Z))return Z;let{displayedNode:{rowGroupColumn:X}}=this,Y=X?.colDef,q=X&&Q.column?.isRowGroupDisplayed(X.getId());if(Y&&q){let G=oQ($,Y,Q);if(G)if(J(G)){if(Y?.cellRendererParams?.innerRenderer)return H1($,Y.cellRendererParams,Q)}else return G}if(z?.isMatch(Q.node,Q.column))return oQ($,{...Y??Q.colDef,cellRenderer:"agFindCellRenderer"},Q)}getChildCount(){let{column:$,suppressCount:z}=this.params;if(z)return 0;let{allChildrenCount:Q,rowGroupColumn:J}=this.displayedNode;if(!((Q??0)>0&&(!J||!$||$?.isRowGroupDisplayed(J.getId()))))return 0;if(this.gos.get("showOpenedGroup")&&this.displayedNode!==this.node&&!a9(this.node,this.displayedNode,this.gos))return 0;return Q??0}isExpandable(){let{node:$,column:z,colDef:Q}=this.params;if(!this.displayedNode.isExpandable())return!1;if($.rowPinned)return!1;if(!z)return!0;if($.hasChildren()&&Q){let{showRowGroup:X}=Q;if(!X)return!1;if(X===!0)return!0}if($===this.displayedNode){if($.rowGroupColumn){if(z?.isRowGroupDisplayed($.rowGroupColumn.getId()))return!0}if($.master)return Q?.showRowGroup===!0||Q?.showRowGroup==null;return!1}return a9(this.node,this.displayedNode,this.gos)}setupIndent(){let{suppressPadding:$,node:z,colDef:Q}=this.params;if($)return;let J=()=>{let Z=z.uiLevel;if(Q&&Q.showRowGroup!==!0)Z=0;let X="ag-row-group-indent-"+Z;if(X===this.indentClass)return;if(this.indentClass)this.comp.toggleCss(this.indentClass,!1);this.indentClass=X,this.comp.toggleCss(X,!0),this.eGui.style.setProperty("--ag-indentation-level",String(Z))};this.addManagedListeners(z,{uiLevelChanged:J.bind(this)}),J()}setupCheckbox(){let{node:$}=this.params;if(!(!$.footer&&!$.rowPinned&&!$.detail))return;this.addManagedPropertyListener("rowSelection",({currentValue:Q,previousValue:J})=>{let Z=typeof Q==="object"?Q:void 0,X=typeof J==="object"?J:void 0;if(Z?.checkboxLocation!==X?.checkboxLocation)this.destroyCheckbox(),this.addCheckbox()}),this.addCheckbox()}addCheckbox(){let{selectionSvc:$}=this.beans;if(!$||!h$(this.gos))return;let{node:z,column:Q}=this.params,J=this.gos.get("rowSelection"),Z=EQ(J);if(Z==="selectionColumn")return;if(Z==="autoGroupColumn"){let _=Q?.getColDef().showRowGroup!=null,H=!Q&&z.group;if(!(_||H))return}let X=typeof J==="object"?Qz(J):this.params.checkbox;if(!(typeof X==="function"||X===!0))return;if(typeof Q?.getColDef().showRowGroup==="string"&&!this.isExpandable()){this.comp.setCheckboxSpacing(!0);return}let G=$.createCheckboxSelectionComponent();this.cbComp=G,this.createBean(G),G.init({rowNode:z,column:Q,overrides:{isVisible:X,callbackParams:this.params,removeHidden:!0}}),this.eCheckbox.appendChild(G.getGui()),this.comp.setCheckboxVisible(!0)}destroyCheckbox(){this.comp.setCheckboxSpacing(!1),this.comp.setCheckboxVisible(!1),this.cbComp?.getGui().remove(),this.cbComp=this.destroyBean(this.cbComp)}isGroupCellEditable($){let z=this.params.column;return!!z&&(!!z.getColDef().groupRowEditable||this.gos.get("enableGroupEdit"))&&z.isCellEditable($)}onExpandClicked($){if(z$($))return;i0($),this.onExpandOrContract($)}onKeyDown($){if($.key!==A.ENTER||this.params.suppressEnterExpand)return;if(this.isGroupCellEditable(this.params.node))return;this.onExpandOrContract($)}onCellDblClicked($){if(z$($))return;if(!(RJ(this.eExpanded,$)||RJ(this.eContracted,$)))this.onExpandOrContract($)}onExpandOrContract($){if(!this.isExpandable())return;let z=this.displayedNode,Q=!z.expanded;if(!Q&&z.sticky)this.beans.ctrlsSvc.getScrollFeature().setVerticalScrollPosition(z.rowTop-z.stickyRowTop);z.setExpanded(Q,$)}destroy(){super.destroy(),this.destroyCheckbox()}},Oj={tag:"span",cls:"ag-cell-wrapper",children:[{tag:"span",ref:"eExpanded",cls:"ag-group-expanded ag-hidden"},{tag:"span",ref:"eContracted",cls:"ag-group-contracted ag-hidden"},{tag:"span",ref:"eCheckbox",cls:"ag-group-checkbox ag-invisible"},{tag:"span",ref:"eValue",cls:"ag-group-value"},{tag:"span",ref:"eChildCount",cls:"ag-group-child-count"}]},o9=class extends x{constructor(){super(Oj);this.eExpanded=f,this.eContracted=f,this.eCheckbox=f,this.eValue=f,this.eChildCount=f}init($){let z={setInnerRenderer:(X,Y)=>this.setRenderDetails(X,Y),setChildCount:(X)=>this.eChildCount.textContent=X,toggleCss:(X,Y)=>this.toggleCss(X,Y),setContractedDisplayed:(X)=>N(this.eContracted,X),setExpandedDisplayed:(X)=>N(this.eExpanded,X),setCheckboxVisible:(X)=>this.eCheckbox.classList.toggle("ag-invisible",!X),setCheckboxSpacing:(X)=>this.eCheckbox.classList.toggle("ag-group-checkbox-spacing",X)},Q=this.createManagedBean(new _Y),J=!$.colDef,Z=this.getGui();if(Q.init(z,Z,this.eCheckbox,this.eExpanded,this.eContracted,this.constructor,$),J)_0(Z,Q.getCellAriaRole())}setRenderDetails($,z){if($)$.newAgStackInstance().then((Q)=>{if(!Q)return;let J=()=>this.destroyBean(Q);if(this.isAlive())this.eValue.appendChild(Q.getGui()),this.addDestroyFunc(J);else J()});else this.eValue.innerText=z}destroy(){this.destroyBean(this.innerCellRenderer),super.destroy()}refresh(){return!1}},Pj=".ag-group-checkbox-spacing{width:var(--ag-icon-size)}:where(.ag-ltr) .ag-group-checkbox-spacing{margin-right:var(--ag-cell-widget-spacing)}:where(.ag-rtl) .ag-group-checkbox-spacing{margin-left:var(--ag-cell-widget-spacing)}",Tj=class extends S{constructor(){super(...arguments);this.beanName="showRowGroupColValueSvc"}getGroupValue($,z,Q){if(!z){if(!$.group)return null;return{displayedNode:$,value:$.groupValue}}let J=this.beans.valueSvc,Z=z.colDef.showRowGroup;if(!Z)return null;if($.level===-1&&$.footer)return{displayedNode:$,value:null};if(typeof Z==="string"){if((this.beans.rowGroupColsSvc?.getColumnIndex(Z)??-1)>$.level)return null;let q=this.getDisplayedNode($,z,!0);if(q)return{displayedNode:q,value:J.getValue(z,q,"data",Q)}}let X=J.getValue(z,$,"data",Q);if(X==null){let Y=this.getDisplayedNode($,z);if(Y)return{displayedNode:Y,value:J.getValue(z,Y,"data",Q)}}return{displayedNode:$,value:X}}formatAndPrefixGroupColValue($,z,Q=!1){let J=this.formatGroupColValue($,z,Q),{value:Z,displayedNode:X}=$,Y=this.beans.footerSvc;if(Y?.doesCellShowTotalPrefix(X,z))return Y.applyTotalPrefix(Z,J,X,z);if(X.footer&&X.level===-1)return null;return J}formatGroupColValue($,z,Q=!1){let J=this.beans.valueSvc,{displayedNode:Z,value:X}=$,Y=Z.rowGroupColumn,q=Z.group&&!z;if(Y&&(q||z?.isRowGroupDisplayed(Y.colId))){if(Q&&Y.colDef.useValueFormatterForExport===!1)return null;let _=J.formatValue(Y,Z,X);if(_==null&&Z.key==="")return this.getLocaleTextFunc()("blanks","(Blanks)");return _}if(!z||Z.group)return null;if(Q&&z.colDef.useValueFormatterForExport===!1)return null;return J.formatValue(z,Z,X)}getDisplayedNode($,z,Q=!1){let J=this.gos,Z=J.get("groupHideOpenParents"),X=J.get("showOpenedGroup")&&!Q;if(!Z&&!X)return;let Y=z.colDef.showRowGroup;if(Y===!0){if($.group)return;return $.parent??void 0}let q=$;while(q&&q.rowGroupColumn?.getId()!=Y){let G=q===q.parent?.getFirstChild();if(!X&&!G)return;q=q.parent}if(q===$)return;return q??void 0}},vj=class extends S{constructor(){super(...arguments);this.beanName="showRowGroupCols",this.columns=[],this.colsSet=new Set,this.colsMap=new Map}destroy(){super.destroy(),this.columns.length=0,this.colsSet.clear(),this.colsMap.clear()}refresh(){let{colModel:$,rowGroupColsSvc:z}=this.beans,Q=this.columns,J=this.colsSet,Z=this.colsMap;Z.clear();let X=Q.length,Y=0,q=!1,G=$.getCols();for(let _=0,H=G.length;_=X||!J.has(U)),Q[Y++]=U}if(q||(q=Y!==X),q){Q.length=Y,J.clear();for(let _=0;_{this.gridBodyCtrl=$.gridBodyCtrl}),this.resetStickyContainers()}setOffsetTop($){if(this.extraTopHeight===$)return;this.extraTopHeight=$,this.eventSvc.dispatchEvent({type:"stickyTopOffsetChanged",offset:$})}setOffsetBottom($){if(this.extraBottomHeight===$)return;this.extraBottomHeight=$}resetOffsets(){this.setOffsetBottom(0),this.setOffsetTop(0)}getLastPixelOfGroup($){return this.isClientSide?bj($):Cj($)}getFirstPixelOfGroup($){if($.footer)return $.sibling.rowTop+$.sibling.rowHeight-1;if($.hasChildren())return $.rowTop-1;return 0}updateStickyRows($){let z=$==="top",Q=0;if(!this.canRowsBeSticky())return this.refreshNodesAndContainerHeight($,new Set,Q);let J=new Set,{rowModel:Z,rowRenderer:X,pinnedRowModel:Y,pageBounds:q,rowContainerHeight:G}=this.beans,{pageFirstPixel:_,pageLastPixel:H}=q.getCurrentPagePixelRange(),U=z?X.firstVisibleVPixel-this.extraTopHeight:X.lastVisibleVPixel-this.extraTopHeight,W=G.divStretchOffset??0,B=_+W,E=H+W,K=(M)=>{if(J.add(M),z){let k=this.getLastPixelOfGroup(M),V=U+Q+M.rowHeight;if(kV)M.stickyRowTop=Q-(k-V);else M.stickyRowTop=Q}Q=0,J.forEach((k)=>{let V=k.stickyRowTop+k.rowHeight;if(Q{if(!M.displayed)return!1;if(M.footer){if(L===!0)return!1;if(L==="grand"&&M.level===-1)return!1;if(L==="group"&&M.level>-1)return!1;let k=M.sibling.rowIndex?M.sibling.rowIndex+1===M.rowIndex:!1;if($==="bottom"&&k)return!1;if(M.level===-1&&Y?.getGrandTotalPinned())return!1;return!J.has(M)}if(M.isExpandable()){if(D===!0)return!1;if($==="bottom")return!1;return!J.has(M)&&!!M.expanded}return!1};for(let M=0;M<100;M++){let k=U+Q;if(!z)k=U-Q;if(z&&kE)k=E;let V=Z.getRowIndexAtPixel(k),R=Z.getRow(V);if(R==null)break;let I=this.getStickyAncestors(R).find((C)=>(z?C.rowIndexV)&&F(C));if(I){K(I);continue}if((z?R.rowTopk)&&F(R)){K(R);continue}break}if(!z)J.forEach((M)=>{M.stickyRowTop=Q-(M.stickyRowTop+M.rowHeight)});return this.refreshNodesAndContainerHeight($,J,Q)}areFooterRowsStickySuppressed(){let $=this.gos.get("suppressStickyTotalRow");if($===!0)return!0;let z=$==="group",Q=$==="grand";if(z&&Q)return!0;if(Q)return"grand";if(z)return"group";return!1}canRowsBeSticky(){let $=kQ(this.gos),z=this.areFooterRowsStickySuppressed(),Q=this.gos.get("suppressGroupRowsSticky");return $&&(!z||!Q)}getStickyAncestors($){let z=[],Q=$.footer?$.sibling:$.parent;while(Q){if(Q.sibling)z.push(Q.sibling);z.push(Q),Q=Q.parent}return z.reverse()}checkStickyRows(){let $=this.updateStickyRows("top"),z=this.updateStickyRows("bottom");return $||z}destroyStickyCtrls(){this.resetStickyContainers()}resetStickyContainers(){this.refreshNodesAndContainerHeight("top",new Set,0),this.refreshNodesAndContainerHeight("bottom",new Set,0)}refreshStickyNode($){let z=new Set;if(this.stickyTopRowCtrls.some((Q)=>Q.rowNode===$)){for(let Q=0;Q{if(q.has(B))return;B.sticky=!0,G.push(this.createRowCon(B,!1,!1))});let _=!!G.length||Y.length!==Z.length;if(J){if(this.topContainerHeight!==Q)this.topContainerHeight=Q,this.gridBodyCtrl.setStickyTopHeight(Q),_=!0}else if(this.bottomContainerHeight!==Q)this.bottomContainerHeight=Q,this.gridBodyCtrl.setStickyBottomHeight(Q),_=!0;this.destroyRowCtrls(X,!1);let H=[...Y,...G];if(H.sort((B,E)=>E.rowNode.rowIndex-B.rowNode.rowIndex),!J)H.reverse();for(let B of H)B.setRowTop(B.rowNode.stickyRowTop);let U=this.beans.pageBounds,W=0;if(J){for(let B of z)if(B.rowIndexthis.topContainerHeight)W=this.topContainerHeight;this.setOffsetTop(W)}else{for(let B of z)if(B.rowIndex>U.getLastRow())W+=B.rowHeight;if(W>this.bottomContainerHeight)W=this.bottomContainerHeight;this.setOffsetBottom(W)}if(!_)return!1;if(J)this.stickyTopRowCtrls=H;else this.stickyBottomRowCtrls=H;return!0}ensureRowHeightsValid(){let $=!1,z=(Q)=>{let J=Q.rowNode;if(J.rowHeightEstimated){let Z=sQ(this.beans,J);J.setRowHeight(Z.height),$=!0}};return this.stickyTopRowCtrls.forEach(z),this.stickyBottomRowCtrls.forEach(z),$}};function Cj($){if($.isExpandable()||$.footer){if($.master&&$.detailNode)return $.detailNode.rowTop+$.detailNode.rowHeight;if(!$.sibling||Math.abs($.sibling.rowIndex-$.rowIndex)===1){let Q=$.childStore?.getStoreBounds();if($.footer)Q=$.sibling.childStore?.getStoreBounds();return(Q?.heightPx??0)+(Q?.topPx??0)}if($.footer)return $.rowTop+$.rowHeight;return $.sibling.rowTop+$.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}function bj($){if($.isExpandable()||$.footer){if($.footer&&$.rowIndex===0)return Number.MAX_SAFE_INTEGER;if(!$.sibling||Math.abs($.sibling.rowIndex-$.rowIndex)===1){let J=$.footer?$.sibling:$;while(J.isExpandable()&&J.expanded)if(J.master&&J.detailNode)J=J.detailNode;else if(J.childrenAfterSort){if(J.childrenAfterSort.length===0)break;J=b(J.childrenAfterSort)}return J.rowTop+J.rowHeight}if($.footer)return $.rowTop+$.rowHeight;return $.sibling.rowTop+$.sibling.rowHeight}return Number.MAX_SAFE_INTEGER}var yj=class extends S{constructor(){super(...arguments);this.beanName="stickyRowSvc"}createStickyRowFeature($,z,Q){let J=this.gos;if(kQ(J)&&o(J)||_z(J))return $.createManagedBean(new Ij(z,Q));return}},HY={moduleName:"GroupCellRenderer",version:Q0,userComponents:{agGroupRowRenderer:o9,agGroupCellRenderer:o9},dynamicBeans:{groupCellRendererCtrl:_Y},icons:{groupContracted:"tree-closed",groupExpanded:"tree-open"},css:[Pj],dependsOn:[I0]},xj={moduleName:"GroupColumn",version:Q0,beans:[_j,vj,Tj,Gj,qY,XY],dependsOn:[I0,HY]},UY={moduleName:"ChangedPath",version:Q0,beans:[Bj],dependsOn:[I0]},DZ={moduleName:"ClientSideRowModelHierarchy",version:Q0,rowModels:["clientSide"],beans:[Rj,kj,Kj],dependsOn:[I0,UY]},WY={moduleName:"StickyRow",version:Q0,beans:[yj]},wj={moduleName:"GroupEdit",version:Q0,beans:[Vj],dependsOn:[I0,DZ]},Nj=({valueSvc:$,dataTypeSvc:z},Q,J)=>{let Z=$.getValue(Q,J,"data"),X=null;if(Z instanceof Date)X=Z;else if(typeof Z==="string")X=(z?.getDateParserFunction(Q)??eQ)(Z)??null;return X},Kz=($,z,Q,J)=>(Z)=>{let X=Nj($,z,Z.node),Y=ZQ(X);if(!Y)return null;return J?.(Y[Q])??Y[Q]},Lz=({colNames:$},z,Q)=>(J)=>{let Z=$.getDisplayNameForColumn(z,J.location);if(Z)return`${Z} (${Q})`;return""},gj=Object.fromEntries(D4.map(($)=>[$,$.toLowerCase()])),hj=($)=>{let z=D4[Number.parseInt($,10)-1]??$,Q=gj[z]??$;return{month:z,localeKey:Q}};function e9($){return $.groupHierarchy??$.rowGroupingHierarchy}var uj=class extends S{constructor(){super(...arguments);this.beanName="groupHierarchyColSvc",this.columns=null,this.sourceColumnMap=new WeakMap,this.inverseColumnMap=new WeakMap}addColumns($){let z=this.columns;if(z==null)return;$.list=z.list.filter((Q)=>!$.list.some((J)=>J.getColId()===Q.getColId())).concat($.list),$.tree=z.tree.filter((Q)=>!$.tree.some((J)=>J.getId()===Q.getId())).concat($.tree),_1($)}createColumns($){let z=new WeakMap,Q=new WeakMap,J=this.createGroupHierarchyColumns($,z,Q);if(G1(J,this.columns?.list??[]))return;J$(this.beans,this.columns?.tree),this.columns=null;let{colGroupSvc:X}=this.beans,Y=X?.findDepth($.tree)??0,q=X?.balanceTreeForAutoCols(J,Y)??[];this.columns={list:J,tree:q,treeDepth:Y,map:{}},this.sourceColumnMap=z,this.inverseColumnMap=Q}updateColumns($){}getColumn($){return this.columns?.list.find((z)=>P$(z,$))??null}getColumns(){return this.columns?.list??null}expandColumnInto($,z){let Q=this.getVirtualColumnsForColumn(z).concat(z);for(let J of Q)if(!$.some((Z)=>P$(Z,J)||Z.getColId()===J.getColId()))$.push(J)}compareVirtualColumns($,z){let Q=this.inverseColumnMap.get($),J=this.inverseColumnMap.get(z);if(Q&&Q===J){let Z=this.sourceColumnMap.get(Q)??[];return Z?.indexOf($)-Z?.indexOf(z)}if(this.sourceColumnMap.get($)?.includes(z))return 1;if(this.sourceColumnMap.get(z)?.includes($))return-1;return null}insertVirtualColumnsForCol($,z){let Q=this.getVirtualColumnsForColumn(z);if(!Q)return[];let J=$.indexOf(z);if(J<0)J=$.length-1;return Q1($,Q),$.splice(J,0,...Q),Q}getVirtualColumnsForColumn($){if(this.isGroupHierarchyColsEnabledForCol($))return this.sourceColumnMap.get($)??[];return[]}isGroupHierarchyColsEnabled($){return $.list.some((z)=>this.isGroupHierarchyColsEnabledForCol(z))}isGroupHierarchyColsEnabledForCol($){let z=$.getColDef();return!!(e9(z)&&(z.rowGroup||z.enableRowGroup||z.rowGroupIndex!=null||z.pivot||z.enablePivot||z.pivotIndex!=null))}createGroupHierarchyColDefs($){let z=[],Q=$.getColDef(),J=e9(Q);if(!J)return z;if(!this.isGroupHierarchyColsEnabledForCol($))return z;for(let Z of J){let X=null;if(typeof Z==="string")X=this.createColDefForPart(Z,$,Q);else X=Z;if(X)z.push(X)}return z}createGroupHierarchyColumns($,z,Q){if(!this.isGroupHierarchyColsEnabled($))return[];let J=[];for(let Z of $.list)for(let X of this.createGroupHierarchyColDefs(Z)){let Y=X.colId;this.gos.validateColDef(X,Y,!0);let q=new q$(X,null,Y,!0);this.createBean(q),J.push(q),mj(z,Z,q),Q.set(q,Z)}return J}createColDefForPart($,z,Q){let{beans:J,gos:Z}=this,X=`${V7}-${z.getColId()}-${$}`,Y={enableRowGroup:Q.enableRowGroup,rowGroup:Q.rowGroup,enablePivot:Q.enablePivot,hide:!0,editable:!1},q=Z.get("groupHierarchyConfig")??{};if($ in q){let U={...Y,...q[$]};return U.colId??(U.colId=X),u$(J,U,U.colId,!0)}let G=u$(J,{colId:X,...Y},X,!0),_=this.getLocaleTextFunc(),H=(U,W)=>_?.(U,W)??W;switch($){case"year":return{...G,headerValueGetter:Lz(J,z,H($,"Year")),valueGetter:Kz(J,z,0)};case"quarter":return{...G,headerValueGetter:Lz(J,z,H($,"Quarter")),valueGetter:Kz(J,z,1,(U)=>(Math.floor(Number(U)/4)+1).toString())};case"month":return{...G,headerValueGetter:Lz(J,z,H($,"Month")),valueGetter:Kz(J,z,1)};case"formattedMonth":return{...G,headerValueGetter:Lz(J,z,H("month","Month")),valueGetter:Kz(J,z,1,(U)=>{let W=hj(U);return H(W.localeKey,W.month)})};case"day":return{...G,headerValueGetter:Lz(J,z,H($,"Day")),valueGetter:Kz(J,z,2)};case"hour":return{...G,headerValueGetter:Lz(J,z,H($,"Hour")),valueGetter:Kz(J,z,3)};case"minute":return{...G,headerValueGetter:Lz(J,z,H($,"Minute")),valueGetter:Kz(J,z,4)};case"second":return{...G,headerValueGetter:Lz(J,z,H($,"Second")),valueGetter:Kz(J,z,5)};default:return null}}};function mj($,z,Q){let J=$.get(z);$.set(z,(J??[]).concat(Q))}var cj={moduleName:"GroupHierarchy",version:Q0,beans:[uj],dependsOn:[UY]};var pj=($,z)=>{if(!$){z.length=0;return}let Q=$.length;z.length=Q;for(let J=0;J{let Q=$.length;if(Q!==z?.length)return!0;for(let J=0;J0){Q=!0;break}if(!Q)return!1;return $.sort($X),!0}function $X($,z){let Q=$.sourceRowIndex,J=z.sourceRowIndex,Z=Q>=0,X=J>=0,Y=Z&&X,q=!Z&&!X;if(Y)return Q-J;if(q)return $.__objectId-z.__objectId;if(Z)return 1;return-1}var dj=class extends S{constructor(){super(...arguments);this.groupCols=[],this.nonLeafsById=new Map,this.checkGroupCols=!0,this.pivotMode=!1,this.groupEmpty=!1}invalidateGroupCols(){this.checkGroupCols=!0}destroy(){super.destroy(),this.groupCols.length=0,this.nonLeafsById.clear()}clearNonLeafs(){let $=this.nonLeafsById;for(let z of $.values())z._destroy(!1);$.clear()}loadGroupData($){if(!$.group)return $._groupData=null,null;let z=$.rowGroupColumn,{valueSvc:Q,showRowGroupCols:J}=this.beans,Z={};if($._groupData=Z,!z)return Z;let X=pz($),Y=z.getId();if(!J)return Z;let q=J.columns;for(let G=0,_=q.length;G<_;++G){let H=q[G];if(H.isRowGroupDisplayed(Y))Z[H.getColId()]=Q.getValue(z,X,"data")}return Z}execute($,z){let Q=z.changedPath;if(this.initRefresh(z)!=="skip"){let Z=z.changedRowNodes;if(Z)this.handleDeltaUpdate($,Q,Z,!!z.animate);else this.shotgunResetEverything($)}this.positionLeafsAndGroups($,Q),this.orderGroups($),this.beans.selectionSvc?.updateSelectableAfterGrouping(Q)}positionLeafsAndGroups($,z){S0($,!0,z,(Q)=>{let J=Q.childrenAfterGroup,Z=J?.length;if(!Z)return;let X=Array(Z),Y=0,q=!1,G;for(let _=0;_1)}}if(Z.size)for(let G of Z){this.insertOneNode($,G);let _=G.parent;z?.addRow(_),X||(X=(_?.childrenAfterGroup?.length??0)>1)}if(q.size)zX(q),this.removeEmptyGroups(q,Y);if(X)this.sortChildren($,z)}sortChildren($,z){S0($,!0,void 0,(Q)=>{if(nj(Q.childrenAfterGroup))z?.addRow(Q)})}orderGroups($){let z=this.gos.getCallback("initialGroupOrderComparator");if(!z)return;let Q=this.beans,J=Q.gridApi,Z=Q.gridOptions.context,X=(q,G)=>z({api:J,context:Z,nodeA:q,nodeB:G}),Y=(q)=>{let G=q.childrenAfterGroup,_=G?.length;if(!_||q.leafGroup)return;if(_>1)G.sort(X);for(let H=0,U=_;H=0;--q){let{col:G}=Y[q],_=Q.getKeyForNode(G,z);if(_==null||_===""){if(!J)continue;_=""}if(!Z?.parent||Z.key!==_){X=!0;break}Z=Z.parent}if(X||(X=!!Z?.parent),!X)return!1;return this.removeFromParent(z),this.insertOneNode($,z),z.setData(z.data),!0}groupShouldBeRemoved($){let z=this.getChildrenMappedKey($.key,$.rowGroupColumn),Q=$.parent?.childrenMapped;if(Q?!Q[z]:!0)return!1;return!!$.group&&($.childrenAfterGroup?.length??0)===0}removeEmptyGroups($,z){let Q=this.beans.selectionSvc,J,Z=Array.from($),X=this.nonLeafsById;do{$.clear();for(let Y=0;Y=q-1,K=this.createGroup(Q,_,U,B,E,z);this.addToParent(K,Q),Q=K}if(!Q.group)j(184,{parentGroupData:Q.data,childNodeData:z.data});z.parent=Q,z.level=Q.level+1,Q.childrenAfterGroup.push(z),Q.updateHasChildren(),XZ(Q)}createGroup($,z,Q,J,Z,X){let Y=z.col,q=($.level>=0?$.id+"-":"row-group-")+(Y.getColId()+"-"+Q),G=this.nonLeafsById,_=G.get(q),H=!0;if(_){if(_.childrenAfterGroup!==null)return _._expanded??(_._expanded=null),_;H=!1,XZ(_)}else _=new Wz(this.beans),_.group=!0,_.key=Q,_.id=q,_.aggData=null,G.set(q,_);let U=(K)=>{K.childrenAfterGroup=W,K.childrenMapped=B,K.parent=$,K.level=J,K.rowGroupIndex=J,K.leafGroup=Z},W=[],B={};if(U(_),_.field=z.field??null,_.rowGroupColumn=Y,_.groupValue=this.beans.valueSvc.getValue(Y,X,"data"),_._expanded??(_._expanded=null),H)return _.setAllChildrenCount(0),_.updateHasChildren(),_;let E=_.sibling;if(E)U(E);return _.dispatchRowEvent("hasChildrenChanged"),_}getChildrenMappedKey($,z){return z?z.getId()+"-"+$:$}onShowRowGroupColsSetChanged(){let{rowModel:$,valueSvc:z}=this.beans;for(let J of this.nonLeafsById.values()){J._groupData=void 0;let Z=J.rowGroupColumn,X=Z&&pz(J);J.groupValue=X&&z.getValue(Z,X,"data")}let Q=$.rootNode?._leafs;if(Q)for(let J=0,Z=Q.length;J{for(let z of $){let Q=z?.childrenAfterGroup;if(!Q)continue;let J=Q.length,Z=0;for(let X=0;X{while($._leafs!==void 0){let z=$.parent;if(!z)break;$._leafs=void 0,$=z}};function tj($,z){$.rowGroupColsSvc?.setColumns(z,"api")}function sj($,z){$.rowGroupColsSvc?.removeColumns(z,"api")}function rj($,z){$.rowGroupColsSvc?.addColumns(z,"api")}function lj($,z,Q){$.rowGroupColsSvc?.moveColumn?.(z,Q,"api")}function aj($){return $.rowGroupColsSvc?.columns??[]}var BY={moduleName:"SharedRowGrouping",version:Q0,apiFunctions:{setRowGroupColumns:tj,removeRowGroupColumns:sj,addRowGroupColumns:rj,getRowGroupColumns:aj,moveRowGroupColumn:lj},dependsOn:[I0,YY,xj,WY,cj]},oj={moduleName:"RowGrouping",version:Q0,dynamicBeans:{groupStrategy:dj},rowModels:["clientSide"],dependsOn:[BY,qj,DZ,wj]};function ej($,z){$.clipboardSvc?.copyToClipboard(z)}function $f($,z){$.clipboardSvc?.cutToClipboard(z)}function zf($,z){$.clipboardSvc?.copySelectedRowsToClipboard(z)}function Qf($,z){$.clipboardSvc?.copySelectedRangeToClipboard(z)}function Jf($){$.clipboardSvc?.copyRangeDown()}function Zf($){$.clipboardSvc?.pasteFromClipboard()}var $Z="paste",s4="dragCopy",r4="clipboard";function Xf($,z=","){let Q=[],J=(X)=>X==="\r"||X===` +`,Z=!1;if($==="")return[[""]];for(let X=0,Y=0,q=0;q<$.length;q++){let G=$[q-1],_=$[q],H=$[q+1],U=()=>{if(!Q[X])Q[X]=[];if(!Q[X][Y])Q[X][Y]=""};if(U(),_==='"'){if(Z)if(H==='"')Q[X][Y]+='"',q++;else Z=!1;else if(G===void 0||G===z||J(G))Z=!0}if(!Z&&_!=='"'){if(_===z){Y++,U();continue}else if(J(_)){if(Y=0,X++,U(),_==="\r"&&H===` +`)q++;continue}}Q[X][Y]+=_}return Q}var Yf=class extends S{constructor(){super(...arguments);this.beanName="clipboardSvc",this.clientSideRowModel=null,this.gridCtrl=null,this.lastPasteOperationTime=0,this.navigatorApiFailed=!1}postConstruct(){let{gos:$,rowModel:z,ctrlsSvc:Q}=this.beans;if(o($,z))this.clientSideRowModel=z;Q.whenReady(this,(J)=>{this.gridCtrl=J.gridCtrl})}destroy(){super.destroy(),this.clientSideRowModel=null,this.gridCtrl=null}pasteFromClipboard(){if(!this.gos.get("suppressClipboardApi")&&!this.navigatorApiFailed&&navigator.clipboard?.readText)navigator.clipboard.readText().then(this.processClipboardData.bind(this)).catch((z)=>{j(40,{e:z,method:"readText"}),this.navigatorApiFailed=!0,this.pasteFromClipboardLegacy()});else this.pasteFromClipboardLegacy()}pasteFromClipboardLegacy(){let $=!1,z=(Q)=>{let J=Date.now();if(J-this.lastPasteOperationTime<50)$=!0,Q.preventDefault();this.lastPasteOperationTime=J};this.executeOnTempElement((Q)=>{Q.addEventListener("paste",z),Q.focus({preventScroll:!0})},(Q)=>{let J=Q.value;if(!$)this.processClipboardData(J);else this.refocusLastFocusedCell();Q.removeEventListener("paste",z)})}refocusLastFocusedCell(){let{focusSvc:$}=this.beans,z=$.getFocusedCell();if(z)$.setFocusedCell({rowIndex:z.rowIndex,column:z.column,rowPinned:z.rowPinned,forceBrowserFocus:!0})}getClipboardDelimiter(){let $=this.gos.get("clipboardDelimiter");return T($)?$:"\t"}processClipboardData($){if($==null)return;let z=Xf($,this.getClipboardDelimiter()),Q=this.gos.getCallback("processDataFromClipboard");if(Q)z=Q({data:z});if(z==null)return;if(this.gos.get("suppressLastEmptyLineOnPaste"))this.removeLastLineIfBlank(z);let{rangeSvc:J,editSvc:Z}=this.beans,X=(Y,q,G,_)=>{if(J?.isMoreThanOneCell()&&!this.hasOnlyOneValueToPaste(z))this.pasteIntoActiveRange(z,Y,q,_);else this.pasteStartingFromFocusedCell(z,Y,q,G,_);Z?.stopEditing(void 0,{source:$Z})};this.doPasteOperation(X)}doPasteOperation($){let{eventSvc:Q,focusSvc:J,rowRenderer:Z,gos:X}=this.beans;Q.dispatchEvent({type:"pasteStart",source:"clipboard"});let{clientSideRowModel:Y}=this,q=Y?.rootNode,G=q&&this.beans.changedPathFactory?.newPath(X.get("aggregateOnlyChangedColumns")),_={},H=[],U=J.getFocusedCell();$(_,H,U,G);let W=H.slice();if(G)Y.doAggregate(G),S0(q,Y.hierarchical,G,(B)=>{W.push(B)});Z.refreshCells({rowNodes:W}),this.dispatchFlashCells(_),this.fireRowChanged(H),this.refocusLastFocusedCell(),Q.dispatchEvent({type:"pasteEnd",source:"clipboard"})}getPreProcessRangeCallback($){return(z)=>{let{rangeSvc:Q}=this.beans;if(!Q)return;let{rowDiff:J,colDiff:Z}=this.getAdjustedRangeDimensionForPaste(z,$);if(J!==0)Q.extendRangeRowCountBy(z,J);if(Z!==0)Q.extendRangeColumnCountBy(z,Z)}}getAdjustedRangeDimensionForPaste($,z){let Q=this.beans.rangeSvc,J=z.length,Z=Q.getRangeRowCount($),X=Z>=J&&Z%J===0,Y=z[0].length,q=$.columns.length,G=q>=Y&&q%Y===0;return{rowDiff:X?0:J-Z,colDiff:G?0:Y-q}}pasteIntoActiveRange($,z,Q,J){let Z=0,X=0,Y=(q,G,_,H)=>{if(H-Z>=$.length){if(H%$.length!==0)return;Z+=X,X=0}let W=$[H-Z];Q.push(G);let B=this.gos.getCallback("processCellFromClipboard"),E=_.columns,K=E.findIndex(I$);if(K!==-1)E.splice(K,1);for(let L=0;L=W.length)F=L%W.length;let M=this.processCell(G,D,W[F],s4,B,!0);G.setDataValue(D,M,$Z),J?.addCell(G.parent,D.getId());let{rowIndex:k,rowPinned:V}=q,R=b$({rowIndex:k,column:D,rowPinned:V});z[R]=!0}X++};this.iterateActiveRanges(Y,!1,this.getPreProcessRangeCallback($))}getDisplayedColumnsStartingAt($){let z=$,Q=[],{visibleCols:J}=this.beans;while(z&&q1(z))z=J.getColAfter(z);while(z!=null)Q.push(z),z=J.getColAfter(z);return Q}pasteStartingFromFocusedCell($,z,Q,J,Z){if(!J)return;let X={rowIndex:J.rowIndex,rowPinned:J.rowPinned},Y=this.getDisplayedColumnsStartingAt(J.column);if(this.isPasteSingleValueIntoRange($))this.pasteSingleValueIntoRange($,Q,z,Z);else this.pasteMultipleValues($,X,Q,Y,z,r4,Z)}isPasteSingleValueIntoRange($){let z=this.beans.rangeSvc;return this.hasOnlyOneValueToPaste($)&&!!z&&!z.isEmpty()}pasteSingleValueIntoRange($,z,Q,J){let Z=$[0][0],X=(Y,q,G)=>{z.push(q),G.columns.forEach((_)=>this.updateCellValue(q,_,Z,Q,r4,J))};this.iterateActiveRanges(X)}hasOnlyOneValueToPaste($){return $.length===1&&$[0].length===1}copyRangeDown(){let{rangeSvc:$,gos:z,formula:Q,valueSvc:J}=this.beans;if(!$||$.isEmpty())return;let Z=[],X=(Y,q,G,_)=>{let H=z.getCallback("processCellForClipboard"),U=z.getCallback("processCellFromClipboard"),W=(B,E,K)=>{let{columns:L}=K;if(!Z.length)L.forEach((D)=>{let F=this.processCell(E,D,J.getValue(D,E,"batch"),s4,H,!1,!0);Z.push(F)});else q.push(E),L.forEach((D,F)=>{if(!D.isCellEditable(E)||D.isSuppressPaste(E))return;if(D.isAllowFormula()&&Q?.isFormula(Z[F]))Z[F]=Q?.updateFormulaByOffset({value:Z[F],rowDelta:1});let k=this.processCell(E,D,Z[F],s4,U,!0);E.setDataValue(D,k,$Z),_?.addCell(E.parent,D.getId());let{rowIndex:V,rowPinned:R}=B,O=b$({rowIndex:V,column:D,rowPinned:R});Y[O]=!0})};this.iterateActiveRanges(W,!0)};this.doPasteOperation(X)}removeLastLineIfBlank($){let z=b($);if(z&&z.length===1&&z[0]===""){if($.length===1)return;Z0($,z)}}fireRowChanged($){if(this.gos.get("editType")!=="fullRow")return;for(let z of $)this.eventSvc.dispatchEvent({type:"rowValueChanged",node:z,data:z.data,rowIndex:z.rowIndex,rowPinned:z.rowPinned})}shouldSkipPasteRow($,z,Q){if($.detail||$.footer)return!0;if(Q&&$.group){for(let J of z)if(J.isCellEditable($))return!1;return!0}return!1}pasteMultipleValues($,z,Q,J,Z,X,Y){let q=z,G=this.beans,{gos:_}=G,H=this.clientSideRowModel!=null&&!_.get("enableGroupEdit")&&!_.get("treeData"),U=()=>{while(q){let W=M0(G,q);if(q=L0(G,{rowPinned:q.rowPinned,rowIndex:q.rowIndex}),W!=null&&!this.shouldSkipPasteRow(W,J,H))return W}return null};for(let W of $){let B=U();if(!B)continue;W.forEach((E,K)=>this.updateCellValue(B,J[K],E,Z,X,Y)),Q.push(B)}}updateCellValue($,z,Q,J,Z,X){if(!$||!z?.isCellEditable($)||z?.isSuppressPaste($))return;let Y=this.processCell($,z,Q,Z,this.gos.getCallback("processCellFromClipboard"),!0);$.setDataValue(z,Y,$Z);let{rowIndex:q,rowPinned:G}=$,_=b$({rowIndex:q,column:z,rowPinned:G});J[_]=!0,X?.addCell($.parent,z.getId())}copyToClipboard($={}){this.copyOrCutToClipboard($)}cutToClipboard($={},z="api"){if(this.gos.get("suppressCutToClipboard"))return;this.eventSvc.dispatchEvent({type:"cutStart",source:z}),this.copyOrCutToClipboard($,!0),this.eventSvc.dispatchEvent({type:"cutEnd",source:z})}copyOrCutToClipboard($,z){let{includeHeaders:Q,includeGroupHeaders:J}=$,{gos:Z,focusSvc:X}=this.beans;if(Q==null)Q=Z.get("copyHeadersToClipboard");if(J==null)J=Z.get("copyGroupHeadersToClipboard");let Y={includeHeaders:Q,includeGroupHeaders:J},q=Z.get("rowSelection"),G=Z.get("cellSelection"),_=null;if(this.shouldCopyCells(G,q))this.copySelectedRangeToClipboard(Y),_=0;else if(this.shouldCopyRows(q))this.copySelectedRowsToClipboard(Y),_=1;else if(X.isAnyCellFocused())this.copyFocusedCellToClipboard(Y),_=2;if(z&&_!==null)this.clearCellsAfterCopy(_)}shouldCopyCells($,z){let{rangeSvc:Q,selectionSvc:J,gos:Z}=this.beans;if(!Q||Q.isEmpty())return!1;if($)return!(typeof z==="object"&&z.copySelectedRows&&!J?.isEmpty());else{let X=Z.get("suppressCopySingleCellRanges");return!(!Q.isMoreThanOneCell()&&X)}}shouldCopyRows($){let{selectionSvc:z,gos:Q}=this.beans;if(z?.isEmpty()??!0)return!1;if($&&typeof $!=="string")return $.copySelectedRows??!1;else return!Q.get("suppressCopyRowsToClipboard")}clearCellsAfterCopy($){let z=this.beans,{rangeSvc:Q,focusSvc:J,eventSvc:Z}=z;if(Z.dispatchEvent({type:"keyShortcutChangedCellStart"}),$===0)Q.clearCellRangeCellValues({cellEventSource:"clipboardSvc"});else if($===1)this.clearSelectedRows();else{let X=J.getFocusedCell();if(X==null)return;let Y=M0(z,X);if(Y)this.clearCellValue(Y,X.column)}Z.dispatchEvent({type:"keyShortcutChangedCellEnd"})}clearSelectedRows(){let{selectionSvc:$,visibleCols:z}=this.beans,Q=$?.getSelectedNodes()??[],J=z.allCols;for(let Z of Q)for(let X of J)this.clearCellValue(Z,X)}clearCellValue($,z){if(!z.isCellEditable($))return;let Q=this.beans.valueSvc.getDeleteValue(z,$);$.setDataValue(z,Q,"clipboardSvc")}iterateActiveRanges($,z,Q){let J=this.beans.rangeSvc;if(!J||J.isEmpty())return;let Z=J.getCellRanges(),X=z?[Z[0]]:Z;for(let Y of X)this.iterateActiveRange({cellRange:Y,rowCallback:$,preProcessRange:Q})}iterateActiveRange($){let{cellRange:z,preProcessRange:Q,rowCallback:J}=$,{beans:Z}=this,{rangeSvc:X}=Z;if(!X)return;if(Q)Q(z);let Y=X.getRangeStartRow(z),q=X.getRangeEndRow(z),G=0,_=!1;while(!_&&Y!=null){let H=M0(Z,Y);_=l(Y,q),J(Y,H,z,G++),Y=L0(Z,Y)}}copySelectedRangeToClipboard($={}){let z=this.beans.rangeSvc;if(!z||z.isEmpty())return;let Q=z.areAllRangesAbleToMerge(),{data:J,cellsToFlash:Z}=Q?this.buildDataFromMergedRanges(z,$):this.buildDataFromRanges(z,$);this.copyDataToClipboard(J),this.dispatchFlashCells(Z)}buildDataFromMergedRanges($,z){let Q=new Set,J=$.getCellRanges(),Z=new Map,X=[],Y={},q=o(this.gos,this.beans.rowModel),G=new Set;if(!q)this.beans.rowModel.forEachNode((W)=>{G.add(W.rowIndex)});for(let W of J){W.columns.forEach((K)=>Q.add(K));let{rowPositions:B,cellsToFlash:E}=this.getRangeRowPositionsAndCellsToFlash($,W);for(let K of B){let L=G.has(K.rowIndex);if(!q&&!L)continue;let D=`${K.rowIndex}-${K.rowPinned||"null"}`;if(!Z.get(D))Z.set(D,!0),X.push(K)}Object.assign(Y,E)}let _=this.beans.visibleCols.allCols,H=Array.from(Q);return H.sort((W,B)=>{let E=_.indexOf(W),K=_.indexOf(B);return E-K}),{data:this.buildExportParams({columns:H,rowPositions:X,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}),cellsToFlash:Y}}buildDataFromRanges($,z){let Q=$.getCellRanges(),J=[],Z={};for(let X of Q){let{rowPositions:Y,cellsToFlash:q}=this.getRangeRowPositionsAndCellsToFlash($,X);Object.assign(Z,q),J.push(this.buildExportParams({columns:X.columns,rowPositions:Y,includeHeaders:z.includeHeaders,includeGroupHeaders:z.includeGroupHeaders}))}return{data:J.join(` +`),cellsToFlash:Z}}getRangeRowPositionsAndCellsToFlash($,z){let Q=[],J={},Z=$.getRangeStartRow(z),X=$.getRangeEndRow(z),Y=Z;while(Y){Q.push(Y);for(let q of z.columns){let{rowIndex:G,rowPinned:_}=Y,H=b$({rowIndex:G,column:q,rowPinned:_});J[H]=!0}if(l(Y,X))break;Y=L0(this.beans,Y)}return{rowPositions:Q,cellsToFlash:J}}getCellsToFlashFromRowNodes($){let z=this.beans.visibleCols.allCols,Q={};for(let J=0;J<$.length;J++){let{level:Z,rowIndex:X,rowPinned:Y,sibling:q}=$[J],G=Z===-1?q.rowIndex:X;if(G==null)continue;for(let _=0;_{let{value:U,valueFormatted:W}=this.beans.valueSvc.getValueForDisplay({column:H,node:_,includeValueFormatted:!0,from:"batch"}),B=W??U??"",E=X.getCallback("processCellForClipboard");if(!E)return B;return E({column:H,node:_,value:B,type:r4,formatValue:(K)=>this.beans.valueSvc.formatValue(H,_,K)??K,parseValue:(K)=>this.beans.valueSvc.parseValue(H,_,K,U)??K})},G={columnKeys:z,rowPositions:Q,skipColumnHeaders:!J,skipColumnGroupHeaders:!Z,suppressQuotes:!0,columnSeparator:this.getClipboardDelimiter(),onlySelected:!Q,valueFrom:"batch",processCellCallback:X.getCallback("processCellForClipboard"),processRowGroupCallback:q,processHeaderCallback:X.getCallback("processHeaderForClipboard"),processGroupHeaderCallback:X.getCallback("processGroupHeaderForClipboard")};return Y.getDataAsCsv(G,!0)}dispatchFlashCells($){window.setTimeout(()=>{this.eventSvc.dispatchEvent({type:"flashCells",cells:$})},0)}processCell($,z,Q,J,Z,X,Y){let{valueSvc:q,formula:G}=this.beans;if(Z)return Z({column:z,node:$,value:Q,type:J,formatValue:(H)=>q.formatValue(z,$??null,H)??H,parseValue:(H)=>q.parseValue(z,$??null,H,q.getValue(z,$,"edit"))});if(X&&z.getColDef().useValueParserForImport!==!1)return q.parseValue(z,$??null,Q,q.getValue(z,$,"edit"));if(Y&&z.getColDef().useValueFormatterForExport!==!1){if(G?.isFormula(Q))return Q;return q.formatValue(z,$??null,Q)??Q}return Q}copyDataToClipboard($){let z=this.gos.getCallback("sendToClipboard");if(z){z({data:$});return}if(!this.gos.get("suppressClipboardApi")&&navigator.clipboard){navigator.clipboard.writeText($).catch((J)=>{j(40,{e:J,method:"writeText"}),this.copyDataToClipboardLegacy($)});return}this.copyDataToClipboardLegacy($)}copyDataToClipboardLegacy($){this.executeOnTempElement((z)=>{let Q=Y0(this.beans),J=d(this.beans);if(z.value=$||" ",z.select(),z.focus({preventScroll:!0}),!Q.execCommand("copy"))j(41);if(J?.focus!=null)J.focus({preventScroll:!0})})}executeOnTempElement($,z){if(!this.gridCtrl)return;let Q=Y0(this.beans),J=Q.createElement("textarea"),Z=J.style;Z.width="1px",Z.height="1px";let X=Q.documentElement;Z.top=X.scrollTop+"px",Z.left=X.scrollLeft+"px",Z.position="absolute",Z.opacity="0",this.gridCtrl.getGui().appendChild(J);try{$(J)}catch(q){j(42)}if(z)window.setTimeout(()=>{z(J),J.remove()},100);else J.remove()}},EY={moduleName:"Clipboard",version:Q0,beans:[Yf],apiFunctions:{copyToClipboard:ej,cutToClipboard:$f,copySelectedRowsToClipboard:zf,copySelectedRangeToClipboard:Qf,copySelectedRangeDown:Jf,pasteFromClipboard:Zf},dependsOn:[I0,J9,iz,M9]};var KY=class extends S{constructor(){super(...arguments);this.loadRowDataVersion=0}wireBeans($){this.environment=$.environment}init($,z){if(this.params=z,this.comp=$,z.pinned!=null)return;this.setAutoHeightClasses(),this.setupRefreshStrategy(),this.createDetailGrid(),this.loadRowData(),this.addManagedEventListeners({fullWidthRowFocused:this.onFullWidthRowFocused.bind(this)})}onFullWidthRowFocused($){let z=this.params,Q={rowIndex:z.node.rowIndex,rowPinned:z.node.rowPinned},J={rowIndex:$.rowIndex,rowPinned:$.rowPinned};if(!l(Q,J))return;F0(this.comp.getGui(),$.fromBelow)}setAutoHeightClasses(){let $=this.gos.get("detailRowAutoHeight"),z=$?"ag-details-row-auto-height":"ag-details-row-fixed-height",Q=$?"ag-details-grid-auto-height":"ag-details-grid-fixed-height",J=this.comp;J.toggleCss(z,!0),J.toggleDetailGridCss(Q,!0)}setupRefreshStrategy(){let $=this.params.refreshStrategy;if($=="everything"||$=="nothing"||$=="rows"){this.refreshStrategy=$;return}if($!=null)j(170,{providedStrategy:$});this.refreshStrategy="rows"}createDetailGrid(){let{params:$,gos:z}=this;if(n($.detailGridOptions)){j(171);return}let Q=z.get("theme"),J=$.detailGridOptions.theme;if(J&&J!==Q)j(267);let Z={themeStyleContainer:this.environment.eStyleContainer,...$.detailGridOptions,theme:Q};if(z.get("detailRowAutoHeight"))Z.domLayout="autoHeight";this.comp.setDetailGrid(Z)}registerDetailWithMaster($){let{params:z,beans:{selectionSvc:Q,findSvc:J,expansionSvc:Z}}=this,X=z.node.id,Y=z.api,q={id:X,api:$},G=z.node;if(Y.isDestroyed())return;Y.addDetailGridInfo(X,q),G.detailGridInfo=q;let _=G.parent;J?.registerDetailGrid(G,$);function H(){if(_)Q?.refreshMasterNodeState(_)}function U({source:B}){if(B==="expandAll")return $.expandAll();if(B==="collapseAll")return $.collapseAll()}function W({node:B,source:E}){if(B!==_||E==="masterDetail"||$.isDestroyed())return;Q?.setDetailSelectionState(_,z.detailGridOptions,$)}$.addEventListener("firstDataRendered",()=>{if($.isDestroyed()||Y.isDestroyed())return;Q?.setDetailSelectionState(_,z.detailGridOptions,$),$.addEventListener("selectionChanged",H),Y.addEventListener("rowSelected",W);let E=`${"CsrmSsrmSharedApi"}Module`;if($.isModuleRegistered(E))Y.addEventListener("expandOrCollapseAll",U),Z?.setDetailsExpansionState($)}),this.addManagedListeners(_,{masterChanged:(B)=>{if(!B.node.master)this.onDestroy(q)}}),this.addDestroyFunc(()=>this.onDestroy(q))}onDestroy($){let{params:z}=this,Q=z.node,J=z.api;if(Q.detailGridInfo!==$)return;if(!J.isDestroyed())J.removeDetailGridInfo(Q.id);Q.detailGridInfo=null}loadRowData(){this.loadRowDataVersion++;let $=this.loadRowDataVersion,z=this.params;if(z.detailGridOptions?.rowModelType==="serverSide"){z.node.detailGridInfo?.api?.refreshServerSide({purge:!0});return}let Q=z.getDetailRowData;if(!Q){j(172);return}let J=(X)=>{if(this.loadRowDataVersion===$)this.comp.setRowData(X)},Z={node:z.node,data:z.node.data,successCallback:J,context:y(this.gos,{}).context};Q(Z)}refresh(){switch(this.refreshStrategy){case"nothing":return!0;case"everything":return!1}return this.loadRowData(),!0}},qf=class{constructor($){this.parentWrapper=$}wrap($,z,Q,J){return this.parentWrapper.wrap($,z,Q,J)}},Gf={tag:"div",cls:"ag-details-row"},_f={tag:"div",cls:"ag-details-row",role:"gridcell",children:[{tag:"div",ref:"eDetailGrid",cls:"ag-details-grid",role:"presentation"}]},Hf=class extends x{constructor(){super(...arguments);this.eDetailGrid=f}wireBeans($){this.context=$.context}init($){this.params=$,this.selectAndSetTemplate();let z={toggleCss:(Q,J)=>this.toggleCss(Q,J),toggleDetailGridCss:(Q,J)=>this.eDetailGrid.classList.toggle(Q,J),setDetailGrid:(Q)=>this.setDetailGrid(Q),setRowData:(Q)=>this.setRowData(Q),getGui:()=>this.eDetailGrid};this.ctrl=this.createManagedBean(new KY),this.ctrl.init(z,$)}refresh(){return this.ctrl?.refresh()??!1}selectAndSetTemplate(){let $=this.params;if($.pinned){this.setTemplate(Gf);return}let z=()=>{this.setTemplate(_f)};if(n($.template))z();else if(typeof $.template==="string")this.setTemplate($.template,[]);else if(typeof $.template==="function"){let Q=$.template,J=Q($);this.setTemplate(J,[])}else j(168),z();if(this.eDetailGrid==null)j(169)}setDetailGrid($){if(!this.eDetailGrid)return;let z=this.context.getBean("frameworkCompWrapper"),Q=new qf(z),{frameworkOverrides:J}=this.beans,Z=M1(this.eDetailGrid,$,{frameworkOverrides:J,providedBeanInstances:{frameworkCompWrapper:Q},modules:l6(this.params.api.getGridId(),$.rowModelType??"clientSide")});this.detailApi=Z,this.ctrl?.registerDetailWithMaster(Z),this.addDestroyFunc(()=>{Z.destroy()})}setRowData($){this.detailApi?.setGridOption("rowData",$)}};function FZ($,z){let Q=$.masterDetailSvc?.store;return Q?z(Q):void 0}function Uf($,z,Q){FZ($,(J)=>{J[z]=Q})}function Wf($,z){FZ($,(Q)=>{delete Q[z]})}function Bf($,z){return FZ($,(Q)=>Q[z])}function Ef($,z){FZ($,(Q)=>{let J=0;Object.values(Q).forEach((Z)=>{if(Z)z(Z,J++)})})}var Kf=".ag-details-row{width:100%}.ag-details-row-fixed-height{height:100%}.ag-details-grid{width:100%}.ag-details-grid-fixed-height{height:100%}",Lf=class extends S{constructor(){super(...arguments);this.beanName="masterDetailSvc",this.store={}}isEnabled(){return this.gos.get("masterDetail")}postConstruct(){let $=this.gos;if(o($))this.enabled=this.isEnabled();if(_z($))this.addEventListeners()}addEventListeners(){let $=(J)=>{this.setMaster(J.node,!1,!0)},z,Q=()=>{if(z){for(let J of z)J();z=void 0}if(this.isEnabled())z=this.addManagedListeners(this.beans.eventSvc,{rowNodeDataChanged:$})};Q(),this.gos.addPropertyEventListener("masterDetail",Q)}refreshModel($){if($.changedProps){let z=this.isEnabled();if(this.enabled!==z){this.setMasters(null);return}}if($.rowDataUpdated)this.setMasters($.changedRowNodes)}setMaster($,z,Q){let J=$.master,Z=this.isEnabled(),X=Z,Y=this.gos,q=Y.get("isRowMaster"),G=Y.get("treeData");if(Z)if(z||Q){if(q){let _=$.data;X=!!_&&!!q(_)}}else X=J;if(!G){if(X&&z||!X&&J)$._expanded??($._expanded=null)}if(X!==J)$.master=X,$.dispatchRowEvent("masterChanged")}setMasters($){if(this.enabled=this.isEnabled(),$){for(let z of $.updates)this.setMaster(z,!1,!0);for(let z of $.adds)this.setMaster(z,!0,!1)}else{let z=o2(this.beans)?.rootNode?._leafs;if(z)for(let Q=0,J=z.length;Q{let Y=z.clientHeight;if(Y!=null&&Y>0){let q=()=>{let{rowModel:G}=this.beans,{rowNode:_}=$;if(_.setRowHeight(Y),o(Q,G)||_z(Q,G))G.onRowHeightChanged()};window.setTimeout(q,0)}},X=F$(J,z,Z);$.addDestroyFunc(X),Z()}destroy(){this.store={},super.destroy()}},Df={moduleName:"SharedMasterDetail",version:Q0,beans:[Lf],userComponents:{agDetailCellRenderer:Hf},dynamicBeans:{detailCellRendererCtrl:KY},apiFunctions:{addDetailGridInfo:Uf,removeDetailGridInfo:Wf,getDetailGridInfo:Bf,forEachDetailGridInfo:Ef},dependsOn:[I0,HY,WY],css:[Kf]},LY={moduleName:"MasterDetail",version:Q0,dependsOn:[Df,DZ,F9]},DY=class extends x{constructor(){super(...arguments);this.changedCalculatedValues=!1,this.dragging=!1,this.shouldDestroyOnEndDragging=!1}postConstruct(){this.beans.dragSvc.addDragSource({dragStartPixels:0,eElement:this.getGui(),onDragging:($)=>{let z=!1;if(!this.dragging)z=!0,this.dragging=!0,FQ(this.beans).classList?.add(this.getDraggingCssClass());if(this.updateValuesOnMove($),z){this.changedCalculatedValues=!1;return}if(this.beans.rangeSvc.autoScrollService.check($),this.changedCalculatedValues)this.onDrag($),this.changedCalculatedValues=!1},onDragStop:($)=>{this.dragging=!1,this.onDragEnd($),this.clearDragProperties()},onDragCancel:()=>{this.dragging=!1,this.onDragCancel(),this.clearDragProperties()}}),this.addManagedEventListeners({cellSelectionChanged:this.updateLocalRangeIfNeeded.bind(this)}),this.addManagedElementListeners(this.getGui(),{pointerdown:QX,mousedown:QX})}getLastCellHovered(){return this.lastCellHovered}getDraggingCssClass(){return`ag-dragging-${this.type===0?"fill":"range"}-handle`}updateValuesOnMove($){let z=U4(this.gos,$);if(!z||this.shouldSkipCell(z)||this.lastCellHovered&&AQ(z,this.lastCellHovered))return;this.lastCellHovered=z,this.changedCalculatedValues=!0}clearDragProperties(){if(this.clearValues(),this.beans.rangeSvc.autoScrollService.ensureCleared(),FQ(this.beans).classList?.remove(this.getDraggingCssClass()),this.shouldDestroyOnEndDragging)this.destroy()}getType(){return this.type}refresh($,z){let Q=this.cellCtrl,J=this.getGui(),Z=z??b(this.beans.rangeSvc.getCellRanges()),X=Z.startRow,Y=Z.endRow;if(X&&Y)if(G0(Y,X))this.rangeStartRow=Y,this.rangeEndRow=X;else this.rangeStartRow=X,this.rangeEndRow=Y;if(Q!==$||!A0(J)){this.cellCtrl=$;let q=$.comp.getParentOfValue();if(q)q.appendChild(J)}this.cellRange=Z}clearValues(){this.lastCellHovered=void 0}destroy(){if(!this.shouldDestroyOnEndDragging&&this.dragging){N(this.getGui(),!1),this.shouldDestroyOnEndDragging=!0;return}this.shouldDestroyOnEndDragging=!1,super.destroy(),this.getGui()?.remove()}updateLocalRangeIfNeeded($){if(!this.cellRange)return;let{id:z,type:Q}=this.cellRange;if(!z||z!==$.id)return;let J=this.beans.rangeSvc?.getCellRanges().find((Z)=>Z.id===z&&Z.type===Q);if(J&&J!==this.cellRange)this.cellRange=J}},QX=($)=>{$.stopPropagation()};function Ff($){let z=$.length,Q=0;if(z<=1)return $;for(let U=0;U<$.length;U++){let W=$[U],B=W.toString().split("e-");if(B.length>1){Q=Math.max(Q,parseInt(B[1],10));continue}if(Math.floor(W)===W)continue;Q=Math.max(Q,W.toString().split(".")[1].length)}let J=0,Z=0,X=0,Y=0,q=0;for(let U=0;UY?"x":"y";else G=q;if(G!==this.dragAxis)this.dragAxis=G,this.changedCalculatedValues=!0}shouldSkipCell($){return v0($.column)}onDrag($){if(!this.initialPosition){let Q=this.cellCtrl;if(!Q)return;this.initialPosition=Q.cellPosition}let z=this.getLastCellHovered();if(z)this.markPathFrom(this.initialPosition,z)}onDragEnd($){if(this.initialXY=null,!this.markedCells.length)return;let z=this.dragAxis==="x",{cellRange:Q,rangeStartRow:J,rangeEndRow:Z,beans:{rangeSvc:X}}=this,Y=Q.columns.length,q;if(!this.isUp&&!this.isLeft)q=X.createCellRangeFromCellRangeParams({rowStartIndex:J.rowIndex,rowStartPinned:J.rowPinned,columnStart:Q.columns[0],rowEndIndex:z?Z.rowIndex:this.lastCellMarked.rowIndex,rowEndPinned:z?Z.rowPinned:this.lastCellMarked.rowPinned,columnEnd:z?this.lastCellMarked.column:Q.columns[Y-1]});else{let G=z?J:this.lastCellMarked;q=X.createCellRangeFromCellRangeParams({rowStartIndex:G.rowIndex,rowStartPinned:G.rowPinned,columnStart:z?this.lastCellMarked.column:Q.columns[0],rowEndIndex:Z.rowIndex,rowEndPinned:Z.rowPinned,columnEnd:Q.columns[Y-1]})}if(q)this.performFill({event:$,initialRange:Q,finalRange:q,shouldUpdateRange:!0})}onDragCancel(){if(this.initialXY=null,!this.markedCells.length)return;this.clearMarkedPath()}performFill({event:$,initialRange:z,finalRange:Q,shouldUpdateRange:J}){let{eventSvc:Z,rangeSvc:X}=this.beans;if(Z.dispatchEvent({type:"fillStart"}),this.handleValueChanged(z,Q,$),J)X.setCellRanges([Q]);Z.dispatchEvent({type:"fillEnd",initialRange:z,finalRange:Q})}getFillHandleDirection(){let $=vJ(this.gos)?.direction;if(!$)return"xy";if($!=="x"&&$!=="y"&&$!=="xy")return j(177),"xy";return $}handleValueChanged($,z,Q){let{beans:J}=this,{rangeSvc:Z,gos:X,valueSvc:Y}=J,q=Z.getRangeEndRow($),G=Z.getRangeStartRow($),_=Z.getRangeEndRow(z),H=Z.getRangeStartRow(z),U=this.dragAxis==="y";if(this.isReduce&&!vJ(X)?.suppressClearOnFillReduction){let R=U?$.columns:$.columns.filter((I)=>z.columns.indexOf(I)<0),O=U?L0(J,_):H;if(O)this.clearCellsInRange(O,q,R);return}let W=[],B=[],E=[],K=[],L=!0,D=0,F=()=>{W.length=0,B.length=0,E.length=0,K.length=0,D=0},M=(R,O)=>{let I=this.isUp?q:G,v=!1;if(U)L=!0,F();while(!v&&I){let C=M0(J,I);if(!C)break;if(U&&R)k(W,R,C,()=>!l(I,this.isUp?G:q));else if(O){L=!0,F();for(let m of O)k(W,m,C,()=>m!==(this.isLeft?$.columns[0]:b($.columns)))}v=l(I,this.isUp?H:_),I=this.isUp?m0(this.beans,I):L0(J,I)}},k=(R,O,I,v)=>{let C,m=!1;if(L)C=Y.getValue(O,I,"edit"),B.push(C),E.push(Y.getValue(O,I,"edit",!0)),K.push(Y.getValueForDisplay({column:O,node:I,from:"edit"}).valueFormatted),L=v();else{let{value:w,fromUserFunction:a,sourceCol:t,sourceRowNode:u}=this.processValues({event:Q,values:R,initialValues:B,initialNonAggregatedValues:E,initialFormattedValues:K,col:O,rowNode:I,idx:D++});if(C=w,O.isCellEditable(I)){let $0=Y.getValue(O,I,"edit");if(!a){if(t){let s=t.getColDef();if(s.useValueFormatterForExport!==!1&&s.valueFormatter){let f0=Y.getValueForDisplay({column:t,node:u,includeValueFormatted:!0,from:"edit"}).valueFormatted;if(f0!=null)C=f0}}if(O.getColDef().useValueParserForImport!==!1)C=Y.parseValue(O,I,t?C:cQ(C),$0)}if(!a||$0!==C)I.setDataValue(O,C,"rangeSvc");else m=!0}}if(!m)R.push({value:C,column:O,rowNode:I})},{changeDetectionSvc:V}=this.beans;V?.beginDeferred();try{if(U)$.columns.forEach((R)=>{M(R)});else{let R=this.isLeft?[...z.columns].reverse():z.columns;M(void 0,R)}this.beans.editSvc?.stopEditing(void 0,{source:"fillHandle"})}finally{V?.endDeferred()}}clearCellsInRange($,z,Q){let J={startRow:$,endRow:z,columns:Q,startColumn:Q[0]};this.beans.rangeSvc.clearCellRangeCellValues({cellRanges:[J],restoreSourceInBatch:!0})}processValues($){let{formula:z,valueSvc:Q}=this.beans,{event:J,values:Z,initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,col:G,rowNode:_,idx:H}=$,U=vJ(this.gos)?.setFillValue,W=this.dragAxis==="y",B;if(W)B=this.isUp?"up":"down";else B=this.isLeft?"left":"right";if(U){let L=y(this.gos,{event:J,values:Z.map(({value:F})=>F),initialValues:X,initialNonAggregatedValues:Y,initialFormattedValues:q,currentIndex:H,currentCellValue:Q.getValue(G,_,"edit"),direction:B,column:G,rowNode:_}),D=U(L);if(D!==!1)return{value:D,fromUserFunction:!0}}let E=(L)=>typeof L==="number"&&Number.isFinite(L)||typeof L==="string"&&/^[+-]?\d+(?:\.\d+)?$/.test(L.trim()),K=Z.every(({value:L})=>E(L));if(J.altKey||!K){let L=String(b(Z)?.value??"");if(K&&X.length===1){let R=this.isUp||this.isLeft?-1:1;return{value:parseFloat(L)+1*R,fromUserFunction:!1}}let{value:D,column:F,rowNode:M}=Z[H%Z.length],k,V=F.isAllowFormula()&&z?.isFormula(L);if(V){let R=B==="up"?-1:B==="down"?1:0,O=B==="left"?-1:B==="right"?1:0;k=z.updateFormulaByOffset({value:L,rowDelta:R,columnDelta:O})}else k=D;return{value:k,fromUserFunction:!1,sourceCol:V?void 0:F,sourceRowNode:M}}return{value:b(Ff(Z.map(({value:L})=>Number(L)))),fromUserFunction:!1}}clearValues(){this.clearMarkedPath(),this.clearCellValues(),this.lastCellMarked=void 0,super.clearValues()}clearMarkedPath(){for(let $ of this.markedCells){if(!$.isAlive())continue;let{comp:z}=$;z.toggleCss("ag-selection-fill-top",!1),z.toggleCss("ag-selection-fill-right",!1),z.toggleCss("ag-selection-fill-bottom",!1),z.toggleCss("ag-selection-fill-left",!1)}this.markedCells.length=0,this.isUp=!1,this.isLeft=!1,this.isReduce=!1}clearCellValues(){this.cellValues.length=0}markPathFrom($,z){if(this.clearMarkedPath(),this.clearCellValues(),this.dragAxis==="y"){if(l(z,$))return;let Q=G0(z,$),{rangeStartRow:J,rangeEndRow:Z}=this;if(Q&&(z.rowPinned==J.rowPinned&&z.rowIndex>=J.rowIndex||J.rowPinned!=Z.rowPinned&&z.rowPinned==Z.rowPinned&&z.rowIndex<=Z.rowIndex))this.reduceVertical($,z),this.isReduce=!0;else this.extendVertical($,z,Q),this.isReduce=!1}else{let Q=$.column,J=z.column;if(Q===J)return;let Z=this.beans.visibleCols.allCols,X=Z.indexOf(Q),Y=Z.indexOf(J);if(Y<=X&&Y>=Z.indexOf(this.cellRange.columns[0]))this.reduceHorizontal($,z),this.isReduce=!0;else this.extendHorizontal($,z,Y=4),$.toggleCss(jf,X),f2(J,Z>0?!0:void 0),$.toggleCss(ff,this.isSingleCell()),this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}updateRangeBorders(){let $=this.getRangeBorders(),z=this.isSingleCell(),Q=!z&&$.top,J=!z&&$.right,Z=!z&&$.bottom,X=!z&&$.left,Y=this.cellComp;Y.toggleCss(Pf,Q),Y.toggleCss(Tf,J),Y.toggleCss(vf,Z),Y.toggleCss(If,X)}isSingleCell(){let{rangeSvc:$}=this;return this.rangeCount===1&&!!$&&!$.isMoreThanOneCell()}getHasChartRange(){let{rangeSvc:$}=this;if(!this.rangeCount||!$)return!1;let z=$.getCellRanges();return z.length>0&&z.every((Q)=>[C$.DIMENSION,C$.VALUE].includes(Q.type))}updateRangeBordersIfRangeCount(){if(this.rangeCount>0)this.updateRangeBorders(),this.refreshRangeStyleAndHandle()}getRangeBorders(){let $=this.beans.gos.get("enableRtl"),z=!1,Q=!1,J=!1,Z=!1,{rangeSvc:X,beans:{visibleCols:Y},cellCtrl:{cellPosition:q}}=this,G=q.column,_=X.getCellRanges().filter((W)=>X.isCellInSpecificRange(q,W));if(!_.length)return{top:z,right:Q,bottom:J,left:Z};let H,U;if($)H=Y.getColAfter(G),U=Y.getColBefore(G);else H=Y.getColBefore(G),U=Y.getColAfter(G);if(!H)Z=!0;if(!U)Q=!0;for(let W=0;W<_.length;W++){if(z&&Q&&J&&Z)break;let B=_[W],E=X.getRangeStartRow(B),K=X.getRangeEndRow(B);if(!z&&l(E,q))z=!0;if(!J&&l(K,q))J=!0;if(!Z&&H&&B.columns.indexOf(H)<0)Z=!0;if(!Q&&U&&B.columns.indexOf(U)<0)Q=!0}return{top:z,right:Q,bottom:J,left:Z}}refreshRangeStyleAndHandle(){let{context:$}=this.beans;if($.isDestroyed())return;this.styleCellForRangeType();let z=this.getRangeForHandle();if(this.selectionHandle&&!z)this.selectionHandle=$.destroyBean(this.selectionHandle);if(z)this.addSelectionHandle(z);this.refreshHandleColor(z),this.cellComp.toggleCss(Of,!!this.selectionHandle)}styleCellForRangeType(){if(this.hasChartRange){let{rangeSvc:$}=this,z=$.getCellRanges()[0],J=z.type===C$.DIMENSION&&$.isCellInSpecificRange(this.cellCtrl.cellPosition,z);this.cellComp.toggleCss(ZX,J)}else this.cellComp.toggleCss(ZX,!1),this.applyRangeColor(this.getRangeColorClass())}applyRangeColor($){if(this.rangeColorClass&&this.rangeColorClass!==$)this.cellComp.toggleCss(this.rangeColorClass,!1),this.cellComp.toggleCss("ag-formula-range",!1);if($)this.cellComp.toggleCss($,!0),this.cellComp.toggleCss("ag-formula-range",$.startsWith("ag-formula-range"));this.rangeColorClass=$??null}getRangeColorClass(){let{rangeSvc:$,rangeCount:z}=this;if(!$||!z)return null;let Q=$.getCellRanges();for(let J=Q.length-1;J>=0;J--){let Z=Q[J],X=Z.colorClass;if(!X)continue;if($.isCellInSpecificRange(this.cellCtrl.cellPosition,Z))return X}return null}refreshHandleColor($){let z=this.selectionHandle?.getGui?.(),Q=$?.colorClass??null;if(!z){this.handleColorClass=null;return}if(this.handleColorClass&&this.handleColorClass!==Q)z.classList.remove(this.handleColorClass);if(Q)z.classList.add(Q);else if(this.handleColorClass)z.classList.remove(this.handleColorClass);this.handleColorClass=Q??null}getRangeForHandle(){let{gos:$,editSvc:z}=this.beans,Q=this.rangeSvc,J=Q.getCellRanges(),Z=J.length;if(this.rangeCount<1||Z<1)return null;let X=z?.isRangeSelectionEnabledWhileEditing(),Y=X?J:[b(J)];for(let q of Y){let{cellPosition:G,column:_}=this.cellCtrl,H=XX($)&&!_.isSuppressFillHandle(),U=Cf($),B=!z?.isEditing(this.cellCtrl,{withOpenEditor:!0})&&(X||Z===1&&(H||U));if(this.hasChartRange)B=q.type===C$.VALUE;if(B&&q.endRow!=null&&Q.isContiguousRange(q)&&Q.isBottomRightCell(q,G))return q}return null}addSelectionHandle($){let{beans:z}=this,Q=z.editSvc?.isRangeSelectionEnabledWhileEditing(),J=$.type,X=!Q&&XX(z.gos)&&n(J)?0:1;if(this.selectionHandle&&this.selectionHandle.getType()!==X)this.selectionHandle=z.context.destroyBean(this.selectionHandle);if(!this.selectionHandle){let Y=z.registry.createDynamicBean(X===0?"fillHandle":"rangeHandle",!1);if(Y)this.selectionHandle=z.context.createBean(Y)}this.selectionHandle?.refresh(this.cellCtrl,$)}destroy(){this.unsetComp()}},yf=class extends S{constructor($){super();this.eContainer=$}postConstruct(){let{beans:$,gos:z,eContainer:Q}=this,J=$.rangeSvc,Z={eElement:Q,onDragStart:J.onDragStart.bind(J),onDragStop:J.onDragStop.bind(J),onDragging:J.onDragging.bind(J)},X=$.dragSvc,Y=X.addDragSource.bind(X,Z),q=X.removeDragSource.bind(X,Z);if(this.addManagedPropertyListeners(["enableRangeSelection","cellSelection"],()=>{if(u0(z))Y();else q()}),this.addDestroyFunc(q),u0(z))Y()}},xf=class extends S{constructor($,z){super();this.column=$,this.eGui=z}postConstruct(){this.addManagedElementListeners(this.eGui,{click:($)=>$&&this.onClick($)})}onClick($){this.beans.rangeSvc?.handleColumnSelection(this.column,$)}},wf=class extends S{constructor($,z){super();this.column=$,this.comp=z,this.columnMap=new Map,this.isActive=!1,this.resetColumnMap()}postConstruct(){this.addManagedPropertyListener("cellSelection",()=>{this.refreshActive()}),this.refreshActive(),this.setupRangeHeaderHighlight()}resetColumnMap(){this.columnMap.clear();let $;if(this.column.isColumn)$=[this.column];else $=this.column.getDisplayedLeafColumns();for(let z of $)this.columnMap.set(z,!1)}refreshActive(){let{gos:$,rangeSvc:z}=this.beans,Q=$.get("cellSelection");this.isActive=!!(Q&&z&&typeof Q==="object"&&Q.enableHeaderHighlight)}setupRangeHeaderHighlight(){let $=this.onRangeSelectionChanged.bind(this);this.addManagedEventListeners({rangeSelectionChanged:$,columnPinned:$,columnMoved:$,columnGroupOpened:$}),$()}onRangeSelectionChanged(){if(!this.isActive)return;this.resetColumnMap();let $=this.beans.rangeSvc.getCellRanges(),z=!1,Q=!0;for(let J of $){if(z)break;for(let Z of J.columns)if(this.columnMap.has(Z))this.columnMap.set(Z,!0),z||(z=!0)}for(let J of Array.from(this.columnMap.values()))if(J===!1){Q=!1;break}this.comp.toggleCss("ag-header-range-highlight",z&&Q)}destroy(){super.destroy(),this.comp=null,this.column=null}},Nf=class extends S{constructor(){super(...arguments);this.beanName="rangeSvc",this.rangeSelectionExtensions=[],this.cellRanges=[],this.bodyScrollListener=this.onBodyScroll.bind(this),this.dragging=!1,this.intersectionRange=!1,this.columnRangeSelectionCtx={}}wireBeans($){this.rowModel=$.rowModel,this.dragSvc=$.dragSvc,this.colModel=$.colModel,this.visibleCols=$.visibleCols,this.cellNavigation=$.cellNavigation,this.ctrlsSvc=$.ctrlsSvc}postConstruct(){let $=this.onColumnsChanged.bind(this),z=()=>this.removeAllCellRanges(),Q=this.refreshLastRangeStart.bind(this);this.addManagedEventListeners({newColumnsLoaded:$,columnVisible:$,columnValueChanged:$,columnPivotModeChanged:z,columnRowGroupChanged:z,columnPivotChanged:z,columnGroupOpened:Q,columnMoved:Q,columnPinned:Q}),this.ctrlsSvc.whenReady(this,(J)=>{let Z=J.gridBodyCtrl;this.autoScrollService=new mJ({scrollContainer:Z.eBodyViewport,scrollAxis:"xy",getVerticalPosition:()=>Z.scrollFeature.getVScrollPosition().top,setVerticalPosition:(X)=>Z.scrollFeature.setVerticalScrollPosition(X),getHorizontalPosition:()=>Z.scrollFeature.getHScrollPosition().left,setHorizontalPosition:(X)=>Z.scrollFeature.setHorizontalScrollPosition(X),shouldSkipVerticalScroll:()=>!V0(this.gos,"normal"),shouldSkipHorizontalScroll:()=>!Z.scrollFeature.isHorizontalScrollShowing()})})}registerRangeSelectionExtension($){if(this.rangeSelectionExtensions.includes($))return;this.rangeSelectionExtensions.push($)}unregisterRangeSelectionExtension($){Z0(this.rangeSelectionExtensions,$)}shouldSuppressRangeSelection($){return this.rangeSelectionExtensions.some((z)=>z.shouldSuppressRangeSelection?.($))}shouldSkipColumn($){return this.rangeSelectionExtensions.some((z)=>z.shouldSkipColumn?.($))}isAllColumnsSelectionCell($){return this.rangeSelectionExtensions.some((z)=>z.isAllColumnsSelectionCell?.($))}isAllColumnsRange($,z){return this.rangeSelectionExtensions.some((Q)=>Q.isAllColumnsRange?.($,z))}updateSelectionModeForCell($){this.setSelectionMode(this.isAllColumnsSelectionCell($))}onDragStart($){let z=this.gos,Q=$.target;if(!u0(z)||G4(z,Q)?.isSuppressMouseEvent($))return;if(this.shouldSuppressRangeSelection(Q))return;let{shiftKey:J}=$,Z=this.isMultiRange($),X=J&&!!this.cellRanges?.length;if(!Z&&(!X||T(b(this.cellRanges).type)))this.removeAllCellRanges(!0);let Y=this.dragSvc.startTarget;if(Y)this.updateValuesOnMove(Y);if(!this.lastCellHovered)return;if(this.dragging=!0,this.lastMouseEvent=$,this.intersectionRange=Z&&this.getCellRangeCount(this.lastCellHovered)>1,!X)this.setNewestRangeStartCell(this.lastCellHovered);if(this.cellRanges.length>0)this.draggingRange=b(this.cellRanges);else{let q={rowIndex:this.lastCellHovered.rowIndex,rowPinned:this.lastCellHovered.rowPinned},G=this.getColumnsFromModel([this.lastCellHovered.column]);if(!G?.length)return;this.draggingRange={startRow:q,endRow:q,columns:G,startColumn:this.newestRangeStartCell.column},this.cellRanges.push(this.draggingRange)}this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.addEventListener("scroll",this.bodyScrollListener,{passive:!0}),this.dispatchChangedEvent(!0,!1,this.draggingRange.id)}onDragging($){let{dragging:z,lastCellHovered:Q,newestRangeStartCell:J,autoScrollService:Z,cellHasChanged:X}=this;if(!z||!$)return;this.updateValuesOnMove($.target),this.lastMouseEvent=$;let Y=(B)=>Q&&Q.rowPinned===B&&J.rowPinned===B,q=Y("top")||Y("bottom");if(Z.check($,q),!X||!Q)return;let G=J?.column,_=Q?.column,H=this.calculateColumnsBetween(G,_);if(!H)return;let{rowIndex:U,rowPinned:W}=Q;this.draggingRange.endRow={rowIndex:U,rowPinned:W},this.draggingRange.columns=H,this.dispatchChangedEvent(!1,!1,this.draggingRange.id)}onDragStop(){if(!this.dragging)return;let{id:$}=this.draggingRange;if(this.autoScrollService.ensureCleared(),this.ctrlsSvc.getGridBodyCtrl().eBodyViewport.removeEventListener("scroll",this.bodyScrollListener),this.lastMouseEvent=null,this.dragging=!1,this.draggingRange=void 0,this.lastCellHovered=void 0,this.intersectionRange)this.intersectionRange=!1,this.intersectLastRange();this.dispatchChangedEvent(!1,!0,$)}onColumnsChanged(){this.refreshLastRangeStart();let $=this.visibleCols.allCols;for(let Q of this.cellRanges){let J=Q.columns;if(Q.columns=Q.columns.filter((X)=>X.isVisible()&&$.indexOf(X)!==-1),!X0(J,Q.columns))this.dispatchChangedEvent(!1,!0,Q.id)}let z=this.cellRanges.length;if(this.cellRanges=this.cellRanges.filter((Q)=>Q.columns.length>0),z>this.cellRanges.length)this.dispatchChangedEvent(!1,!0)}refreshLastRangeStart(){let $=b(this.cellRanges);if(!$)return;this.refreshRangeStart($)}isContiguousRange($){let z=$.columns;if(!z.length)return!1;let Q=this.visibleCols.allCols,J=z.map((Z)=>Q.indexOf(Z)).sort((Z,X)=>Z-X);return b(J)-J[0]+1===z.length}getRangeStartRow($){if($.startRow&&$.endRow)return G0($.startRow,$.endRow)?$.startRow:$.endRow;return{rowIndex:0,rowPinned:(this.beans.pinnedRowModel?.getPinnedTopRowCount()??0)>0?"top":null}}getRangeEndRow($){if($.startRow&&$.endRow)return G0($.startRow,$.endRow)?$.endRow:$.startRow;let z=this.beans.pinnedRowModel?.getPinnedBottomRowCount()??0;if(z>0)return{rowIndex:z-1,rowPinned:"bottom"};return{rowIndex:this.rowModel.getRowCount()-1,rowPinned:null}}getRangeRowCount($){let z=this.beans,Q=this.getRangeStartRow($),J=this.getRangeEndRow($),Z=$4(z,Q);return $4(z,J)-Z+1}handleCellMouseDown($,z){let Q=$.ctrlKey||$.metaKey;this.handleCellSelectionInput(z,{target:$.target,shiftKey:$.shiftKey,isRightClick:u2(this.beans,$),isMultiRange:this.isMultiRange($),isMultiKey:Q,preventDefault:()=>$.preventDefault()})}handleCellKeyboardSelect($,z){let Q=$.ctrlKey||$.metaKey;this.handleCellSelectionInput(z,{target:$.target,shiftKey:$.shiftKey,isRightClick:!1,isMultiRange:this.isMultiRangeForKeyState(Q),isMultiKey:Q,preventDefault:()=>$.preventDefault()})}handleCellSelectionInput($,z){let{target:Q,shiftKey:J,isRightClick:Z,isMultiRange:X,isMultiKey:Y,preventDefault:q}=z;if(this.shouldSuppressRangeSelection(Q))return;let G=this.isAllColumnsSelectionCell($);if(G)q();if(J)return this.extendLatestRangeToCell($);if(G&&Z)return;this.updateSelectionModeForCell($);let _=this.calculateColumnsBetween($.column,$.column);if(!_)return;let H=G?this.findContainingRange({columns:_,startRow:$,endRow:$}):void 0;if(G&&!!H&&X&&Y&&H)this.removeRowFromAllColumnsRange($,H);else this.setRangeToCell($,X)}isMultiRange($){return this.isMultiRangeForKeyState($.ctrlKey||$.metaKey)}isMultiRangeForKeyState($){let{editingWithRanges:z,allowMulti:Q}=this.getMultiRangeContext();return z||(Q?$:!1)}getMultiRangeContext(){let{gos:$,editSvc:z}=this.beans,Q=!!z?.isEditing()&&!!z?.isRangeSelectionEnabledWhileEditing(),J=G7($)&&!Q;return{editingWithRanges:Q,suppressMultiRanges:J,allowMulti:!J}}removeRowFromAllColumnsRange($,z){let{beans:Q,cellRanges:J}=this,Z=KQ(Q),X=qz(Q),Y=this.getRangeStartRow(z),q=this.getRangeEndRow(z);if(!Y&&l(Z,$))zZ(z,L0(Q,Z),"top");else if(!q&&l(X,$))zZ(z,m0(Q,X),"bottom");else if(l(Y,q))Z0(J,z);else if(l(Y,$))zZ(z,L0(Q,$),"top");else if(l(q,$))zZ(z,m0(Q,$),"bottom");else{let G=m0(Q,$),_=L0(Q,$);z.startRow=Y,z.endRow=G??void 0,J.push({...z,startRow:_??void 0,endRow:q})}this.dispatchChangedEvent(!0,!0)}setRangeToCell($,z=!1){let{gos:Q}=this;if(!u0(Q))return;this.updateSelectionModeForCell($);let J=this.calculateColumnsBetween($.column,$.column);if(!J)return;let{suppressMultiRanges:Z}=this.getMultiRangeContext();if(Z||!z||n(this.cellRanges))this.removeAllCellRanges(!0);let X={rowIndex:$.rowIndex,rowPinned:$.rowPinned},Y={startRow:X,endRow:X,columns:J,startColumn:$.column},q=this.ensureRangeStartColumn(Y);if(!q)return;this.cellRanges.push(Y),this.setNewestRangeStartCell({...$,column:q}),this.onDragStop(),this.dispatchChangedEvent(!0,!0)}getRangeLastColumn($){let z=$.columns[0],Q=b($.columns);return this.newestRangeStartCell?.column===z?Q:z}extendRangeRowCountBy($,z){let{beans:Q}=this,{startRow:J,endRow:Z}=$;if(!J||!Z)return;let X=0,Y,q=G0(Z,J);if(q)Y=J;else Y=Z;let G=z>0?L0:m0,_=Math.abs(z);while(X<_){let U=G(Q,Y);if(!U)break;Y=U,X++}if(X!==_)return;let H={...Y,column:this.getRangeLastColumn($)};this.updateRangeRowBoundary({cellRange:$,boundary:q?"start":"end",cellPosition:H})}extendRangeColumnCountBy($,z){let{columns:Q}=$;if(z===0)return;let J=this.getColumnsFromModel();if(!J)return;let Z=this.ensureRangeStartColumn($);if(!Z)return;let X=b(Q),Y=Z===Q[0]?X:Q[0];if(!X||!Y)return;let q=J.indexOf(Z),G=J.indexOf(Y),_=Gz.indexOf(J)).filter((J)=>J>-1).sort((J,Z)=>J-Z);return{left:z[Q[0]],right:z[b(Q)]}}extendLatestRangeInDirection($){if(this.isEmpty()||!this.newestRangeStartCell)return;let z=$.key,Q=$.ctrlKey||$.metaKey,J=b(this.cellRanges),Z=this.newestRangeStartCell,X=J.endRow.rowIndex,Y=J.endRow.rowPinned,G={column:this.getRangeLastColumn(J),rowIndex:X,rowPinned:Y},_=this.cellNavigation.getNextCellToFocus(z,G,Q);if(!_)return;if(this.shouldSkipColumn(_.column))return;return this.setCellRange({rowStartIndex:Z.rowIndex,rowStartPinned:Z.rowPinned,rowEndIndex:_.rowIndex,rowEndPinned:_.rowPinned,columnStart:Z.column,columnEnd:_.column}),_}setCellRange($){if(!u0(this.gos))return;this.removeAllCellRanges(!0),this.addCellRange($)}setCellRanges($){if(X0(this.cellRanges,$))return;if(!this.verifyCellRanges(this.gos))return;this.setSelectionMode(!1),this.removeAllCellRanges(!0);let z=this.getColumnsFromModel(this.visibleCols.allCols)??[],Q=!1;for(let J of $){if(J.columns&&J.startRow){let Z=this.getColumnsFromModel(J.columns);if(!Z||Z.length===0)continue;J.columns=Z;let{startRow:X}=J;this.setNewestRangeStartCell({rowIndex:X.rowIndex,rowPinned:X.rowPinned,column:J.columns[0]})}if(!Q&&z.length>0&&this.isAllColumnsRange(J,z))Q=!0;this.cellRanges.push(J)}this.setSelectionMode(Q),this.dispatchChangedEvent(!1,!0)}clearCellRangeCellValues($){let{beans:z,eventSvc:Q}=this,{cellEventSource:J="rangeSvc",dispatchWrapperEvents:Z,wrapperEventSource:X="deleteKey",restoreSourceInBatch:Y}=$,{cellRanges:q}=$;if(Z)Q.dispatchEvent({type:"cellSelectionDeleteStart",source:X}),Q.dispatchEvent({type:"rangeDeleteStart",source:X});if(!q)q=this.cellRanges;let{valueSvc:G,editSvc:_}=z,H=!!_?.isBatchEditing(),{changeDetectionSvc:U}=z;U?.beginDeferred();try{this.forEachEditableCellInRanges(q,(W,B)=>{if(Y&&H){_?.batchResetToSourceValue({rowNode:W,column:B});return}let E=G.getDeleteValue(B,W);W.setDataValue(B,E,J)})}finally{U?.endDeferred()}if(Z)Q.dispatchEvent({type:"cellSelectionDeleteEnd",source:X}),Q.dispatchEvent({type:"rangeDeleteEnd",source:X})}createCellRangeFromCellRangeParams($){return this.createPartialCellRangeFromRangeParams($,!1)}createPartialCellRangeFromRangeParams($,z){let{columns:Q,columnStart:J,columnEnd:Z,rowStartIndex:X,rowStartPinned:Y,rowEndIndex:q,rowEndPinned:G}=$,_=this.getColumnsFromParams(Q,J,Z);if(!_||!z&&_.columns.length===0)return;let{columns:H,startsOnTheRight:U}=_,W=YX(X,Y),B=YX(q,G);return{startRow:W,endRow:B,columns:H,startColumn:this.getColumnFromModel(J)??(U?b(H):H[0])}}addCellRange($){let z=this.gos;if(!u0(z)||!this.verifyCellRanges(z))return;this.setSelectionMode(!1);let Q=this.createCellRangeFromCellRangeParams($);if(Q){if(Q.startRow)this.setNewestRangeStartCell({rowIndex:Q.startRow.rowIndex,rowPinned:Q.startRow.rowPinned,column:Q.startColumn});return this.cellRanges.push(Q),this.dispatchChangedEvent(!1,!0,Q.id),Q}}getCellRanges(){return this.cellRanges}isEmpty(){return this.cellRanges.length===0}isMoreThanOneCell(){let $=this.cellRanges.length;if($===0)return!1;if($>1)return!0;let z=this.cellRanges[0],Q=this.getRangeStartRow(z),J=this.getRangeEndRow(z);return Q.rowPinned!==J.rowPinned||Q.rowIndex!==J.rowIndex||z.columns.length!==1}areAllRangesAbleToMerge(){let $=new Map;if(this.cellRanges.length<=1)return!0;for(let J of this.cellRanges)this.forEachRowInRange(J,(Z)=>{let X=`${Z.rowPinned||"normal"}_${Z.rowIndex}`,Y=$.get(X),q=J.columns.map((G)=>G.getId());if(Y){let G=q.filter((_)=>Y.indexOf(_)===-1);Y.push(...G)}else $.set(X,q)});let Q;for(let J of $.values()){let Z=J.sort().join();if(Q===void 0){Q=Z;continue}if(Q!==Z)return!1}return!0}removeAllCellRanges($){if(this.isEmpty())return;if(this.onDragStop(),this.cellRanges.length=0,!$)this.dispatchChangedEvent(!1,!0)}isCellInAnyRange($){return this.getCellRangeCount($)>0}isCellInSpecificRange($,z){let Q=z.columns?.includes($.column),J=this.isRowInRange($,z);return Q&&J}isColumnInAnyRange($){let{beans:z}=this,Q=KQ(z),J=qz(z);if(!Q||!J)return!1;let Z=$.isColumn?[$]:$.getDisplayedLeafColumns();return this.findContainingRange({columns:Z,startRow:Q,endRow:J},!0)!=null}findContainingRange({columns:$,startRow:z,endRow:Q},J=!1){let Z=this.cellRanges;for(let X=Z.length-1;X>=0;X--){let Y=Z[X],q=$.every((_)=>Y.columns.includes(_)),G=!1;if(J)G=l(Y.startRow,z)&&l(Y.endRow,Q);else{let _=z&&this.isRowInRange(z,Y),H=Q&&this.isRowInRange(Q,Y);G=!!_&&!!H}if(q&&G)return Y}}isBottomRightCell($,z){let Q=this.visibleCols.allCols,J=$.columns.map((_)=>Q.indexOf(_)).sort((_,H)=>_-H),{startRow:Z,endRow:X}=$,Y=G0(Z,X)?X:Z,q=Q.indexOf(z.column)===b(J),G=z.rowIndex===Y.rowIndex&&j$(z.rowPinned)===j$(Y.rowPinned);return q&&G}getCellRangeCount($){return this.cellRanges.filter((z)=>this.isCellInSpecificRange($,z)).length}isRowInRange($,z){let Q=this.getRangeStartRow(z),J=this.getRangeEndRow(z),Z=l($,Q),X=l($,J);if(Z||X)return!0;let Y=!G0($,Q),q=G0($,J);return Y&&q}intersectLastRange($){let{editingWithRanges:z,suppressMultiRanges:Q}=this.getMultiRangeContext();if(z||Q||$&&this.dragging||this.isEmpty())return;let J=b(this.cellRanges),Z=this.getRangeStartRow(J),X=this.getRangeEndRow(J),Y=[];for(let q of this.cellRanges.slice(0,-1)){let G=this.getRangeStartRow(q),_=this.getRangeEndRow(q),H=q.columns,U=H.filter((B)=>J.columns.indexOf(B)===-1);if(U.length===H.length){Y.push(q);continue}if(G0(X,G)||G0(_,Z)){Y.push(q);continue}let W=Y.length;if(G0(G,Z)){let B={columns:[...H],startColumn:J.startColumn,startRow:{...G},endRow:m0(this.beans,Z)};Y.push(B)}if(U.length>0){let B={columns:U,startColumn:U.includes(J.startColumn)?J.startColumn:U[0],startRow:gf([{...Z},{...G}]),endRow:hf([{...X},{..._}])};Y.push(B)}if(G0(X,_))Y.push({columns:[...H],startColumn:J.startColumn,startRow:L0(this.beans,X),endRow:{..._}});if(Y.length-W===1)Y[Y.length-1].id=q.id}if(this.cellRanges=Y,$)this.dispatchChangedEvent(!1,!0)}createRangeHighlightFeature($,z,Q){$.createManagedBean(new wf(z,Q))}setSelectionMode($){this.selectionMode=$?1:0}refreshRangeStart($){let{columns:z}=$,Q=this.ensureRangeStartColumn($);if(!Q)return;let J=(G,_)=>{let H=$.columns.filter((U)=>U!==G);if(G)$.startColumn=G,$.columns=_?[G,...H]:[...H,G];else $.columns=H},{left:Z,right:X}=this.getRangeEdgeColumns($);if(Q===z[0]&&Q!==Z){J(Z,!0);return}if(Q===b(z)&&Q===X)J(X,!1)}setNewestRangeStartCell($){this.newestRangeStartCell=$}getColumnsFromParams($,z,Q){let J=!$&&!z&&!Q,Z,X=!1;if(J||$)Z=this.getColumnsFromModel(J?void 0:$);else if(z&&Q){if(Z=this.calculateColumnsBetween(z,Q),Z?.length)X=Z[0]!==this.getColumnFromModel(z)}return Z?{columns:Z,startsOnTheRight:X}:void 0}verifyCellRanges($){let{suppressMultiRanges:z}=this.getMultiRangeContext(),Q=q7($)&&z&&this.cellRanges.length>1;if(Q)j(93);return!Q}forEachRowInRange($,z){let Q=this.getRangeStartRow($),J=this.getRangeEndRow($),Z=Q;while(Z){if(z(Z),l(Z,J))break;Z=L0(this.beans,Z)}}forEachEditableCellInRanges($,z){let{beans:Q}=this;for(let J of $)this.forEachRowInRange(J,(Z)=>{let X=M0(Q,Z);if(!X)return;for(let Y=0;Y0,_=z.ctrlKey||z.metaKey,H=!q||_,U=KQ(J),W=qz(J);if(!U||!W)return;if(z.key===A.ENTER)z.preventDefault();if(z.shiftKey){let E=Z.root;if(!E)return;let K=$.isColumn?$:b($.getLeafColumns()),L=this.findContainingRange({columns:[E],startRow:U,endRow:W},!0);if(!L){Z0(X,Z.lastCellRange),this.selectColumns(this.calculateColumnsBetween(E,K),U,W);return}this.updateRangeRowBoundary({cellRange:L,boundary:"end",cellPosition:{column:K,...W}});return}if(G&&(Y||!_&&!q))this.removeAllCellRanges(!0);let B=(E,K)=>{let L=this.findContainingRange({columns:E,startRow:U,endRow:W},!0);if(L&&H)this.deselectColumnsFromRange(L,E);else{let D=this.selectColumns(E,U,W);if(D)Z.lastCellRange=D}Z.root=K};if($.isColumn)B([$],$);else{let E=$.getDisplayedLeafColumns();B(E,E[0])}}deselectColumnsFromRange($,z){if(Q1($.columns,z),z.includes($.startColumn))$.startColumn=$.columns[0];if($.columns.length===0)Z0(this.cellRanges,$);this.dispatchChangedEvent(!0,!0)}selectColumns($,z,Q){return this.addCellRange({columns:$,columnStart:$[0],columnEnd:b($),rowStartIndex:z.rowIndex,rowStartPinned:z.rowPinned,rowEndIndex:Q.rowIndex,rowEndPinned:Q.rowPinned})}};function YX($,z){return $!=null?{rowIndex:$,rowPinned:z}:void 0}function gf($){let z;for(let Q of $)if(z===void 0||G0(z,Q))z=Q;return z}function hf($){let z;for(let Q of $)if(z===void 0||G0(Q,z))z=Q;return z}function uf($,z){let{startRow:Q,endRow:J}=$,Z=G0(Q,J)?J:Q,X=z.rowIndex===Z.rowIndex&&z.rowPinned===Z.rowPinned,Y=$.columns[0],q=b($.columns),G=$.startColumn===Y?q:Y;return z.column===G&&X}function zZ($,z,Q){let J;if(Q==="top")J=!$.startRow||!$.endRow||G0($.startRow,$.endRow)?"startRow":"endRow";else J=!$.startRow||!$.endRow||G0($.startRow,$.endRow)?"endRow":"startRow";$[J]=z??void 0}var FY={moduleName:"CellSelection",version:Q0,beans:[Nf],dynamicBeans:{fillHandle:kf,rangeHandle:Vf},apiFunctions:{getCellRanges:Sf,addCellRange:Rf,clearRangeSelection:JX,clearCellSelection:JX},dependsOn:[I0,iz,cJ],css:[Af]};function mf($){return $.colModel.isPivotMode()}function cf($,z,Q){return $.pivotResultCols?.lookupPivotResultCol(z,Q)??null}function pf($,z){$.valueColsSvc?.setColumns(z,"api")}function nf($){return $.valueColsSvc?.columns??[]}function df($,z){$.valueColsSvc?.removeColumns(z,"api")}function tf($,z){$.valueColsSvc?.addColumns(z,"api")}function sf($,z){$.pivotColsSvc?.setColumns(z,"api")}function rf($,z){$.pivotColsSvc?.removeColumns(z,"api")}function lf($,z){$.pivotColsSvc?.addColumns(z,"api")}function af($){return $.pivotColsSvc?.columns??[]}function of($,z){$.pivotResultCols?.setPivotResultCols(z,"api")}function ef($){let z=$.pivotResultCols?.getPivotResultCols();return z?z.list:null}var qX="PivotRowTotal_",$O=({headerName:$},{headerName:z})=>{if($&&!z)return 1;else if(!$&&z)return-1;else if(!$&&!z)return 0;if($z)return 1;else return 0},zO=($)=>(z,Q)=>$(z.headerName,Q.headerName),QO=class extends S{constructor(){super(...arguments);this.beanName="pivotColDefSvc"}wireBeans($){this.colModel=$.colModel,this.pivotColsSvc=$.pivotColsSvc,this.valueColsSvc=$.valueColsSvc,this.colNames=$.colNames}postConstruct(){let $=()=>this.gos.get("serverSidePivotResultFieldSeparator")??"_";this.fieldSeparator=$(),this.addManagedPropertyListener("serverSidePivotResultFieldSeparator",()=>{this.fieldSeparator=$()});let z=()=>this.gos.get("pivotDefaultExpanded");this.pivotDefaultExpanded=z(),this.addManagedPropertyListener("pivotDefaultExpanded",()=>{this.pivotDefaultExpanded=z()})}createPivotColumnDefs($){let z=this.createPivotColumnsFromUniqueValues($);function Q(Z,X=[]){return Z.forEach((Y)=>{if(Y.children!==void 0)Q(Y.children,X);else X.push(Y)}),X}let J=Q(z);return this.addRowGroupTotals(z,J),this.addExpandablePivotGroups(z,J),this.addPivotTotalsToGroups(z,J),z}createPivotColumnsFromUniqueValues($){let z=this.pivotColsSvc?.columns??[],Q=z.length;return this.recursivelyBuildGroup(0,$,[],Q,z)}recursivelyBuildGroup($,z,Q,J,Z){if($>=J)return this.buildMeasureCols(Q);let{pivotComparator:X}=Z[$].getColDef(),Y=X?zO(X):$O,q=this.valueColsSvc?.columns;if(q?.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&$===J-1){let _=[];for(let H of z.keys()){let U=[...Q,H],W=this.createColDef(q[0],H,U);W.columnGroupShow="open",_.push(W)}return _.sort(Y),_}let G=[];for(let _ of z.keys()){let H=this.pivotDefaultExpanded===-1||${let J=this.colNames.getDisplayNameForColumn(Q,"header"),Z=this.createColDef(Q,J,$);return Z.columnGroupShow="open",Z})}addExpandablePivotGroups($,z){let Q=this.gos.get("suppressExpandablePivotGroups");if(Q||this.gos.get("pivotColumnGroupTotals"))return;let J=(Z,X,Y)=>{if("children"in Z){let{valueColsSvc:_}=this,{columns:H=[]}=_??{},U=new Map;Z.children.forEach((E)=>{J(E,X,U)});let W=!Z.children.some((E)=>E.children),B=W&&H.length===1&&this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let E of H){let K=this.colNames.getDisplayNameForColumn(E,"header"),L=this.createColDef(E,K,Z.pivotKeys);if(L.pivotTotalColumnIds=U.get(E.getColId()),L.columnGroupShow=!Q?"closed":"open",L.aggFunc=E.getAggFunc(),!W||B)Z.children.push(L),X.push(L)}this.merge(Y,U);return}if(!Z.pivotValueColumn)return;let q=Z.pivotValueColumn.getColId();if(Y.has(q))Y.get(q).push(Z.colId);else Y.set(q,[Z.colId])};$.forEach((Z)=>{J(Z,z,new Map)})}addPivotTotalsToGroups($,z){if(!this.gos.get("pivotColumnGroupTotals"))return;let Q=this.gos.get("pivotColumnGroupTotals")==="after",J=this.valueColsSvc?.columns,Z=J?.map((X)=>X.getAggFunc());if(!Z||Z.length<1||!this.sameAggFuncs(Z))return;if(J){let X=J[0];$.forEach((Y)=>{this.recursivelyAddPivotTotal(Y,z,X,Q)})}}recursivelyAddPivotTotal($,z,Q,J){let Z=$;if(!Z.children){let Y=$;return Y.colId?[Y.colId]:null}let X=[];if(Z.children.forEach((Y)=>{let q=this.recursivelyAddPivotTotal(Y,z,Q,J);if(q)X=X.concat(q)}),Z.children.length>1){let q=this.getLocaleTextFunc()("pivotColumnGroupTotals","Total"),G=this.createColDef(Q,q,$.pivotKeys,!0);G.pivotTotalColumnIds=X,G.aggFunc=Q.getAggFunc(),G.columnGroupShow=this.gos.get("suppressExpandablePivotGroups")?"open":void 0;let _=$.children;if(J)_.push(G);else _.unshift(G);z.push(G)}return X}addRowGroupTotals($,z){if(!this.gos.get("pivotRowTotals"))return;let Q=this.gos.get("pivotRowTotals")==="after",Z=(this.valueColsSvc?.columns??[]).slice();if(!Q)Z.reverse();let X=Z.length>1||!this.gos.get("removePivotHeaderRowWhenSingleValueColumn");for(let Y=0;YX.data?.[X.colDef.field],Z.pivotKeys=Q,Z.pivotValueColumn=$,Z.filter===!0)Z.filter="agNumberColumnFilter";return Z}sameAggFuncs($){if($.length==1)return!0;for(let z=1;z<$.length;z++)if($[z]!==$[0])return!1;return!0}merge($,z){z.forEach((Q,J)=>{let X=[...$.has(J)?$.get(J):[],...Q];$.set(J,X)})}generateColumnGroupId($){return`pivotGroup_${(this.pivotColsSvc?.columns??[]).map((Q)=>Q.getColId()).join("-")}_${$.join("-")}`}generateColumnId($,z){return`pivot_${(this.pivotColsSvc?.columns??[]).map((J)=>J.getColId()).join("-")}_${$.join("-")}_${z}`}createColDefsFromFields($){let z=new Map;for(let Z=0;Z<$.length;Z++){let Y=$[Z].split(this.fieldSeparator),q=z;for(let G=0;G{let G=[];for(let[U,W]of Y){let B=Q(`${Z}${this.fieldSeparator}${U}`,U,W,q+1);G.push(B)}if(G.length===0){let U=this.colModel.getColDefCol(X);if(U){let B=this.colNames.getDisplayNameForColumn(U,"header")??X,E=this.createColDef(U,B,void 0,!1);return E.colId=Z,E.aggFunc=U.getAggFunc(),E.valueGetter=(K)=>K.data?.[Z],E}return{colId:Z,headerName:X,valueGetter:(B)=>B.data?.[Z]}}if(this.gos.get("removePivotHeaderRowWhenSingleValueColumn")&&G.length===1&&"colId"in G[0])return G[0].headerName=X,G[0];return{openByDefault:this.pivotDefaultExpanded===-1||q{Z.forEach((X)=>{if(T(X.children)){let q=X;if(Q)Q(q);J(q.children)}else{let q=X;if(z)z(q)}})};if($)J($)}},GX="Exceeded maximum allowed pivot column count.",YZ=($)=>{let z={};return $.forEach((Q,J)=>z[J]=Q instanceof Map?YZ(Q):Q),z},ZO=class extends S{constructor(){super(...arguments);this.beanName="pivotStage",this.step="pivot",this.refreshProps=["removePivotHeaderRowWhenSingleValueColumn","pivotRowTotals","pivotColumnGroupTotals","suppressExpandablePivotGroups"],this.uniqueValues=new Map,this.lastTimeFailed=!1,this.maxUniqueValues=-1,this.currentUniqueCount=0}wireBeans($){this.valueSvc=$.valueSvc,this.colModel=$.colModel,this.pivotResultCols=$.pivotResultCols,this.rowGroupColsSvc=$.rowGroupColsSvc,this.valueColsSvc=$.valueColsSvc,this.pivotColsSvc=$.pivotColsSvc,this.pivotColDefSvc=$.pivotColDefSvc}execute($){if(this.colModel.isPivotActive())return this.executePivotOn($);else return this.executePivotOff()}executePivotOff(){if(this.aggregationColumnsHashLastTime=null,this.uniqueValues=new Map,this.pivotResultCols.isPivotResultColsPresent())return this.pivotResultCols.setPivotResultCols(null,"rowModelUpdated"),!0;return!1}executePivotOn($){let z=this.valueColsSvc?.columns.length??1,Q=this.gos.get("pivotMaxGeneratedColumns");this.maxUniqueValues=Q===-1?-1:Q/z;let J;try{J=this.bucketUpRowNodes($)}catch(D){if(D.message===GX)return this.pivotResultCols.setPivotResultCols([],"rowModelUpdated"),this.eventSvc.dispatchEvent({type:"pivotMaxColumnsExceeded",message:D.message}),this.lastTimeFailed=!0,!1;throw D}let Z=this.setUniqueValues(J),X=this.valueColsSvc?.columns??[],Y=X.map((D)=>`${D.getId()}-${D.getColDef().headerName}`).join("#"),q=X.map((D)=>D.getAggFunc().toString()).join("#"),G=this.aggregationColumnsHashLastTime!==Y,_=this.aggregationFuncsHashLastTime!==q;this.aggregationColumnsHashLastTime=Y,this.aggregationFuncsHashLastTime=q;let H=(this.rowGroupColsSvc?.columns??[]).map((D)=>D.getId()).join("#"),U=H!==this.groupColumnsHashLastTime;this.groupColumnsHashLastTime=H;let W=this.gos.get("pivotRowTotals"),B=this.gos.get("pivotColumnGroupTotals"),E=this.gos.get("suppressExpandablePivotGroups"),K=this.gos.get("removePivotHeaderRowWhenSingleValueColumn"),L=W!==this.pivotRowTotalsLastTime||B!==this.pivotColumnGroupTotalsLastTime||E!==this.suppressExpandablePivotGroupsLastTime||K!==this.removePivotHeaderRowWhenSingleValueColumnLastTime;if(this.pivotRowTotalsLastTime=W,this.pivotColumnGroupTotalsLastTime=B,this.suppressExpandablePivotGroupsLastTime=E,this.removePivotHeaderRowWhenSingleValueColumnLastTime=K,this.lastTimeFailed||Z||G||U||_||L){let D=this.pivotColDefSvc.createPivotColumnDefs(this.uniqueValues);return this.pivotResultCols.setPivotResultCols(D,"rowModelUpdated"),this.lastTimeFailed=!1,!0}return this.lastTimeFailed=!1,!1}setUniqueValues($){if(!FJ(YZ(this.uniqueValues),YZ($)))return this.uniqueValues=$,!0;return!1}bucketUpRowNodes($){this.currentUniqueCount=0;let z=new Map;S0(this.beans.rowModel.rootNode,this.beans.rowModel.hierarchical,$,(J)=>{if(J.leafGroup)J.childrenMapped=null});let Q=(J)=>{if(J.leafGroup)this.bucketRowNode(J,z);else{let Z=J.childrenAfterFilter;if(Z)for(let X=0,Y=Z.length;Xthis.maxUniqueValues;if(Y&&W)throw Error(GX)}if(!Z.has(U))Z.set(U,[]);Z.get(U).push(H)}if(Q===z.length-1)return Z;let q=new Map;for(let G of Z.keys())q.set(G,this.bucketChildren(Z.get(G),z,Q+1,J.get(G)));return q}},XO={moduleName:"SharedPivot",version:Q0,beans:[JO,QO,qY],apiFunctions:{isPivotMode:mf,getPivotResultColumn:cf,setValueColumns:pf,getValueColumns:nf,removeValueColumns:df,addValueColumns:tf,setPivotColumns:sf,removePivotColumns:rf,addPivotColumns:lf,getPivotColumns:af,setPivotResultColumns:of,getPivotResultColumns:ef},dependsOn:[BY,E4]},MY={moduleName:"Pivot",version:Q0,rowModels:["clientSide"],beans:[ZO],dependsOn:[XO,oj,DZ]};var Nb=String.fromCodePoint(31,41150,8291);var kY=[{symbol:"%",fixity:"postfix",precedence:100},{symbol:"-",fixity:"prefix",precedence:90},{symbol:"+",fixity:"prefix",precedence:90},{symbol:"^",fixity:"infix",precedence:80,associativity:"right"},{symbol:"*",fixity:"infix",precedence:70,associativity:"left",isAssociative:!0},{symbol:"/",fixity:"infix",precedence:70,associativity:"left"},{symbol:"+",fixity:"infix",precedence:60,associativity:"left",isAssociative:!0},{symbol:"-",fixity:"infix",precedence:60,associativity:"left"},{symbol:"&",fixity:"infix",precedence:55,associativity:"left",isAssociative:!0},{symbol:"=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<>",fixity:"infix",precedence:50,associativity:"left"},{symbol:">=",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<=",fixity:"infix",precedence:50,associativity:"left"},{symbol:">",fixity:"infix",precedence:50,associativity:"left"},{symbol:"<",fixity:"infix",precedence:50,associativity:"left"}],_X=new Map;for(let $ of kY){let z=_X.get($.symbol)??[];z.push($),_X.set($.symbol,z)}var gb=[...new Set(kY.map(($)=>$.symbol))].sort(($,z)=>z.length-$.length);var hb=Symbol("WrappedFunctionMarker");var YO={column:"bar",groupedColumn:"bar",stackedColumn:"bar",normalizedColumn:"bar",bar:"bar",groupedBar:"bar",stackedBar:"bar",normalizedBar:"bar",line:"line",stackedLine:"line",normalizedLine:"line",scatter:"scatter",bubble:"bubble",pie:"pie",donut:"donut",doughnut:"donut",area:"area",stackedArea:"area",normalizedArea:"area",histogram:"histogram",radarLine:"radar-line",radarArea:"radar-area",nightingale:"nightingale",radialColumn:"radial-column",radialBar:"radial-bar",sunburst:"sunburst",rangeBar:"range-bar",rangeArea:"range-area",boxPlot:"box-plot",treemap:"treemap",heatmap:"heatmap",waterfall:"waterfall",funnel:"funnel",coneFunnel:"cone-funnel",pyramid:"pyramid"},qO=new Set(["columnLineCombo","areaColumnCombo","customCombo"]);function GO($){return qO.has($)}function _O($){return $==="doughnut"?"donut":$}function HO($){return YO[$]}var UO=["number","category","grouped-category","log","time"];var ub=UO.reduce(($,z)=>({...$,[z]:{title:{_enabledFromTheme:!0}}}),{});var MZ=($)=>{return(z)=>{if(z==null)return!0;return $(z)}};var WO=["doughnut"];function BO($){return!!HO($)||GO($)}function EO($){return WO.includes($)}var cb=MZ(($)=>{if(BO($))return!0;if(EO($)){let z=_O($);return zz(`The chart type '${$}' has been deprecated. Please use '${z}' instead.`),z}return!1}),pb=MZ(($)=>{return typeof $==="object"}),ib=MZ(($)=>{return typeof $==="object"}),nb=MZ(($)=>{return typeof $==="string"||typeof $==="function"});function VY($){return $.map((z,Q,J)=>z.map((Z,X)=>J.slice(0,Q+1).reduce((Y,q)=>Y+q[X],0)))}function AY($){let z=$.map((Q,J)=>$.reduce((Z,X)=>Math.max(Z,X[J]),0));return $.map((Q)=>Q.map((J,Z)=>J/z[Z]*19))}var SY=[[1,3,5],[2,6,4],[5,3,1]];var KO=VY(SY);var db=AY(KO);var LO=SY;var DO=VY(LO);var tb=AY(DO);var FO=["number","category","time","grouped-category"],MO=["angle-category","angle-number","radius-category","radius-number"],sb=[...FO,...MO];N2.registerModules([j9,Q9,R9,D9,S9,U9,$9,zY,FY,MY,LY,Z5,nX,tX,rX,aX,EY]);var kO=($,z)=>{let{data:Q,options:J,api:Z,on:X,class:Y,style:q="height: 100%; width: 100%;"}=$,G=null,_=()=>{return document.documentElement.getAttribute("data-theme")==="dark"||window.matchMedia("(prefers-color-scheme: dark)").matches},H=(U)=>{return U?"ag-theme-alpine-dark":"ag-theme-alpine"};return $html("div",{style:q,class:Y,ref:(U)=>{try{let W=typeof Q==="function"?Q():Q,B=typeof J==="function"?J():J,E=["onFilterChanged","onModelUpdated","onGridSizeChanged","onFirstDataRendered","onRowValueChanged","onSelectionChanged","onCellClicked","onCellDoubleClicked","onCellValueChanged","onRowClicked","onSortChanged","onContextMenu","onColumnResized","onColumnMoved","onRowDataUpdated","onCellEditingStarted","onCellEditingStopped","onPaginationChanged","onBodyScroll"],K={};E.forEach((V)=>{if(X?.[V])K[V]=(R)=>X[V](R)});let L={...B,theme:H(_()),rowData:W||[],onGridReady:(V)=>{if(G=V.api,Z)Z.current=G;if(X?.onGridReady)X.onGridReady(V);if(B?.autoSizeColumns)setTimeout(()=>{if(G&&!G.isDestroyed()){let R=G.getColumns();if(R?.length)G.autoSizeColumns(R)}},100)},...K};G=M1(U,L);let D=$watch([Q],()=>{if(!G||G.isDestroyed())return;let V=typeof Q==="function"?Q():Q;if(Array.isArray(V)){let R=G.getGridOption("rowData");if(V!==R)G.setGridOption("rowData",V)}}),F=$watch([_],()=>{if(G&&!G.isDestroyed()){let V=_(),R=H(V),O=G.getGridOption("theme");if(R!==O)G.setGridOption("theme",R)}}),M=["pagination","paginationPageSize","suppressRowClickSelection","rowSelection","enableCellTextSelection","ensureDomOrder","stopEditingWhenCellsLoseFocus","enterMovesDown","enterMovesDownAfterEdit"],k=$watch([J],()=>{if(!G||G.isDestroyed()||!J)return;let V=typeof J==="function"?J():J;M.forEach((R)=>{if(V[R]!==void 0)try{G.setGridOption(R,V[R])}catch(O){console.warn(`Could not set grid option ${R}:`,O)}})});U._cleanups.add(D),U._cleanups.add(F),U._cleanups.add(k),U._cleanups.add(()=>{if(G&&!G.isDestroyed()){if(G.destroy(),Z)Z.current=null;G=null}})}catch(W){console.error("Failed to initialize AG Grid:",W),U.innerHTML=`
Error loading grid: ${W.message}
`}}})};})();